From c73056e05f13c380d3fa335af0d086ac3ae4b026 Mon Sep 17 00:00:00 2001 From: Zane Meyers Date: Mon, 1 Jun 2026 17:13:50 -0400 Subject: [PATCH] vault backup: 2026-06-01 17:13:50 --- .obsidian/bookmarks.json | 74 +- .obsidian/community-plugins.json | 6 +- .../plugins/daily-notes-editor/data.json | 16 + .obsidian/plugins/daily-notes-editor/main.js | 4251 +++ .../plugins/daily-notes-editor/manifest.json | 15 + .../plugins/daily-notes-editor/styles.css | 220 + .obsidian/plugins/inline-spoilers/data.json | 4 + .../plugins/obsidian-quiet-outline/data.json | 55 + .../markdown-states.json | 697 + .../plugins/obsidian-tasks-plugin/data.json | 3 + .obsidian/plugins/tasknotes/data.json | 518 + .obsidian/plugins/tasknotes/main.js | 1155 + .obsidian/plugins/tasknotes/manifest.json | 10 + .obsidian/plugins/tasknotes/styles.css | 22230 ++++++++++++++++ capek_1935_pov-of-a-cat.md | 2 +- circular-mil.md | 25 +- digital-garden-homepage.md | 1 + electrical-takeoff.md | 8 +- jared-defanti.md | 1 + joshua-komis.md | 8 + milan-hrvacevic.md | 7 + ...onal-electrical-contractors-association.md | 1 + periodic/daily/2026-06-01.md | 10 + periodic/weekly/2026w23.md | 7 + tasks/views/agenda-default.base | 68 + tasks/views/calendar-default.base | 72 + tasks/views/kanban-default.base | 69 + tasks/views/mini-calendar-default.base | 75 + tasks/views/pomodoro-stats.base | 85 + tasks/views/relationships.base | 121 + tasks/views/tasks-default.base | 239 + templates/task.md | 10 + timestamped/2025-12-03_15-54-22.md | 2 +- timestamped/2026-01-07_10-42-00.md | 2 +- timestamped/2026-01-13_11-28-14.md | 2 +- timestamped/2026-02-10_15-49-04.md | 2 +- timestamped/2026-03-11_11-58-49.md | 5 + timestamped/2026-03-19_09-00-43.md | 2 +- timestamped/2026-05-27_21-32-16.md | 7 +- timestamped/2026-05-28_09-17-29.md | 2 +- timestamped/2026-05-30_20-18-01.md | 2 +- timestamped/2026-06-01_08-31-48.md | 21 + transparency.md | 7 + 43 files changed, 30067 insertions(+), 50 deletions(-) create mode 100644 .obsidian/plugins/daily-notes-editor/data.json create mode 100644 .obsidian/plugins/daily-notes-editor/main.js create mode 100644 .obsidian/plugins/daily-notes-editor/manifest.json create mode 100644 .obsidian/plugins/daily-notes-editor/styles.css create mode 100644 .obsidian/plugins/inline-spoilers/data.json create mode 100644 .obsidian/plugins/obsidian-quiet-outline/data.json create mode 100644 .obsidian/plugins/obsidian-quiet-outline/markdown-states.json create mode 100644 .obsidian/plugins/tasknotes/data.json create mode 100644 .obsidian/plugins/tasknotes/main.js create mode 100644 .obsidian/plugins/tasknotes/manifest.json create mode 100644 .obsidian/plugins/tasknotes/styles.css create mode 100644 joshua-komis.md create mode 100644 milan-hrvacevic.md create mode 100644 periodic/daily/2026-06-01.md create mode 100644 periodic/weekly/2026w23.md create mode 100644 tasks/views/agenda-default.base create mode 100644 tasks/views/calendar-default.base create mode 100644 tasks/views/kanban-default.base create mode 100644 tasks/views/mini-calendar-default.base create mode 100644 tasks/views/pomodoro-stats.base create mode 100644 tasks/views/relationships.base create mode 100644 tasks/views/tasks-default.base create mode 100644 templates/task.md create mode 100644 timestamped/2026-06-01_08-31-48.md create mode 100644 transparency.md diff --git a/.obsidian/bookmarks.json b/.obsidian/bookmarks.json index e41896c..bd5e751 100644 --- a/.obsidian/bookmarks.json +++ b/.obsidian/bookmarks.json @@ -1,35 +1,59 @@ { "items": [ { - "type": "file", - "ctime": 1754398939230, - "path": "full-takeoff.md", - "title": "Full Takeoff" + "type": "group", + "ctime": 1780330987866, + "items": [ + { + "type": "file", + "ctime": 1760361633886, + "path": "TODO.md" + }, + { + "type": "file", + "ctime": 1780330914026, + "path": "home.md", + "title": "Home" + } + ], + "title": "General" }, { - "type": "file", - "ctime": 1760361633886, - "path": "TODO.md" + "type": "group", + "ctime": 1780330954006, + "items": [ + { + "type": "file", + "ctime": 1769779428614, + "path": "wishlist.md" + } + ], + "title": "Personal" }, { - "type": "file", - "ctime": 1769779428614, - "path": "wishlist.md" - }, - { - "type": "file", - "ctime": 1761313177282, - "path": "nfpa-70_national-electric-code.md" - }, - { - "type": "file", - "ctime": 1766074735360, - "path": "consolidate-estimating-thoughts.md" - }, - { - "type": "file", - "ctime": 1769269535439, - "path": "digital-garden-homepage.md" + "type": "group", + "ctime": 1780330940827, + "items": [ + { + "type": "file", + "ctime": 1754398939230, + "path": "full-takeoff.md", + "title": "Full Takeoff" + }, + { + "type": "file", + "ctime": 1761313177282, + "path": "nfpa-70_national-electric-code.md" + }, + { + "type": "file", + "ctime": 1780328464803, + "path": "timestamped/2026-05-22_11-57-18.md", + "subpath": "#ConEst's Purpose Considering its Accuracy", + "title": "ConEst's Purpose Considering its Accuracy" + } + ], + "title": "Occupational" } ] } \ No newline at end of file diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json index e2c34eb..18e91b9 100644 --- a/.obsidian/community-plugins.json +++ b/.obsidian/community-plugins.json @@ -25,5 +25,9 @@ "neighbouring-files", "cmdr", "sheets", - "tabout" + "tabout", + "inline-spoilers", + "obsidian-quiet-outline", + "tasknotes", + "daily-notes-editor" ] \ No newline at end of file diff --git a/.obsidian/plugins/daily-notes-editor/data.json b/.obsidian/plugins/daily-notes-editor/data.json new file mode 100644 index 0000000..83e2429 --- /dev/null +++ b/.obsidian/plugins/daily-notes-editor/data.json @@ -0,0 +1,16 @@ +{ + "hideFrontmatter": true, + "hideBacklinks": false, + "createAndOpenOnStartup": false, + "useArrowUpOrDownToNavigate": false, + "preset": [ + { + "type": "folder", + "target": "timestamped" + }, + { + "type": "folder", + "target": "daily" + } + ] +} \ No newline at end of file diff --git a/.obsidian/plugins/daily-notes-editor/main.js b/.obsidian/plugins/daily-notes-editor/main.js new file mode 100644 index 0000000..8ddaf44 --- /dev/null +++ b/.obsidian/plugins/daily-notes-editor/main.js @@ -0,0 +1,4251 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __publicField = (obj, key, value) => { + __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; +}; +const require$$0 = require("obsidian"); +const view = require("@codemirror/view"); +const state = require("@codemirror/state"); +function around(obj, factories) { + const removers = Object.keys(factories).map((key) => around1(obj, key, factories[key])); + return removers.length === 1 ? removers[0] : function() { + removers.forEach((r) => r()); + }; +} +function around1(obj, method, createWrapper) { + const original = obj[method], hadOwn = obj.hasOwnProperty(method); + let current = createWrapper(original); + if (original) + Object.setPrototypeOf(current, original); + Object.setPrototypeOf(wrapper, current); + obj[method] = wrapper; + return remove; + function wrapper(...args) { + if (current === original && obj[method] === wrapper) + remove(); + return current.apply(this, args); + } + function remove() { + if (obj[method] === wrapper) { + if (hadOwn) + obj[method] = original; + else + delete obj[method]; + } + if (current === original) + return; + current = original; + Object.setPrototypeOf(wrapper, original || Function); + } +} +function genId(size2) { + const chars = []; + for (let n = 0; n < size2; n++) + chars.push((16 * Math.random() | 0).toString(16)); + return chars.join(""); +} +const popovers = /* @__PURE__ */ new WeakMap(); +function isDailyNoteLeaf(leaf) { + return leaf.containerEl.matches(".dn-editor.dn-leaf-view .workspace-leaf"); +} +function nosuper(base) { + const derived = function() { + return Object.setPrototypeOf(new require$$0.Component(), new.target.prototype); + }; + derived.prototype = base.prototype; + return Object.setPrototypeOf(derived, base); +} +const spawnLeafView = (plugin, initiatingEl, leaf, onShowCallback) => { + let parent = plugin.app.workspace.activeLeaf; + if (!parent) + parent = leaf; + if (!initiatingEl) + initiatingEl = parent == null ? void 0 : parent.containerEl; + const hoverPopover = new DailyNoteEditor(parent, initiatingEl, plugin, void 0, onShowCallback); + return [hoverPopover.attachLeaf(), hoverPopover]; +}; +class DailyNoteEditor extends nosuper(require$$0.HoverPopover) { + constructor(parent, targetEl, plugin, waitTime, onShowCallback) { + var _a, _b; + super(); + this.targetEl = targetEl; + this.plugin = plugin; + this.onShowCallback = onShowCallback; + this.abortController = this.addChild(new require$$0.Component()); + this.detaching = false; + this.opening = false; + this.rootSplit = new require$$0.WorkspaceSplit(window.app.workspace, "vertical"); + this.isPinned = true; + this.oldPopover = (_a = this.parent) == null ? void 0 : _a.DailyNoteEditor; + this.id = genId(8); + if (waitTime === void 0) { + waitTime = 300; + } + this.onTarget = true; + this.parent = parent; + this.waitTime = waitTime; + this.state = require$$0.PopoverState.Showing; + this.document = ((_b = this.targetEl) == null ? void 0 : _b.ownerDocument) ?? window.activeDocument ?? window.document; + this.hoverEl = this.document.defaultView.createDiv({ + cls: "dn-editor dn-leaf-view", + attr: { id: "dn-" + this.id } + }); + const { hoverEl } = this; + this.abortController.load(); + this.timer = window.setTimeout(this.show.bind(this), waitTime); + this.setActive = this._setActive.bind(this); + if (hoverEl) { + hoverEl.addEventListener("mousedown", this.setActive); + } + popovers.set(this.hoverEl, this); + this.hoverEl.addClass("dn-editor"); + this.containerEl = this.hoverEl.createDiv("dn-content"); + this.buildWindowControls(); + this.setInitialDimensions(); + } + static activeWindows() { + const windows = [window]; + const { floatingSplit } = app.workspace; + if (floatingSplit) { + for (const split of floatingSplit.children) { + if (split.win) + windows.push(split.win); + } + } + return windows; + } + static containerForDocument(plugin, doc) { + if (doc !== document && plugin.app.workspace.floatingSplit) + for (const container of plugin.app.workspace.floatingSplit.children) { + if (container.doc === doc) + return container; + } + return plugin.app.workspace.rootSplit; + } + static activePopovers() { + return this.activeWindows().flatMap(this.popoversForWindow); + } + static popoversForWindow(win) { + var _a; + return Array.prototype.slice.call(((_a = win == null ? void 0 : win.document) == null ? void 0 : _a.body.querySelectorAll(".dn-leaf-view")) ?? []).map((el) => popovers.get(el)).filter((he) => he); + } + static forLeaf(leaf) { + const el = leaf && document.body.matchParent.call(leaf.containerEl, ".dn-leaf-view"); + return el ? popovers.get(el) : void 0; + } + static iteratePopoverLeaves(ws, cb) { + for (const popover of this.activePopovers()) { + if (popover.rootSplit && ws.iterateLeaves(cb, popover.rootSplit)) + return true; + } + return false; + } + _setActive(evt) { + evt.preventDefault(); + evt.stopPropagation(); + this.plugin.app.workspace.setActiveLeaf(this.leaves()[0], { focus: true }); + } + getDefaultMode() { + return "source"; + } + updateLeaves() { + if (this.onTarget && this.targetEl && !this.document.contains(this.targetEl)) { + this.onTarget = false; + this.transition(); + } + let leafCount = 0; + this.plugin.app.workspace.iterateLeaves((leaf) => { + leafCount++; + }, this.rootSplit); + if (leafCount === 0) { + this.hide(); + } + this.hoverEl.setAttribute("data-leaf-count", leafCount.toString()); + } + leaves() { + const leaves = []; + this.plugin.app.workspace.iterateLeaves((leaf) => { + leaves.push(leaf); + }, this.rootSplit); + return leaves; + } + setInitialDimensions() { + this.hoverEl.style.height = "auto"; + this.hoverEl.style.width = "100%"; + } + transition() { + if (this.shouldShow()) { + if (this.state === require$$0.PopoverState.Hiding) { + this.state = require$$0.PopoverState.Shown; + window.clearTimeout(this.timer); + } + } else { + if (this.state === require$$0.PopoverState.Showing) { + this.hide(); + } else { + if (this.state === require$$0.PopoverState.Shown) { + this.state = require$$0.PopoverState.Hiding; + this.timer = window.setTimeout(() => { + if (this.shouldShow()) { + this.transition(); + } else { + this.hide(); + } + }, this.waitTime); + } + } + } + } + buildWindowControls() { + this.titleEl = this.document.defaultView.createDiv("popover-titlebar"); + this.titleEl.createDiv("popover-title"); + this.containerEl.prepend(this.titleEl); + } + attachLeaf() { + this.rootSplit.getRoot = () => this.plugin.app.workspace[this.document === document ? "rootSplit" : "floatingSplit"]; + this.rootSplit.getContainer = () => DailyNoteEditor.containerForDocument(this.plugin, this.document); + this.titleEl.insertAdjacentElement("afterend", this.rootSplit.containerEl); + const leaf = this.plugin.app.workspace.createLeafInParent(this.rootSplit, 0); + this.updateLeaves(); + return leaf; + } + onload() { + super.onload(); + this.registerEvent(this.plugin.app.workspace.on("layout-change", this.updateLeaves, this)); + this.registerEvent(this.plugin.app.workspace.on("layout-change", () => { + this.rootSplit.children.forEach((item, index) => { + if (item instanceof require$$0.WorkspaceTabs) { + this.rootSplit.replaceChild(index, item.children[0]); + } + }); + })); + } + onShow() { + var _a, _b; + const closeDelay = 600; + setTimeout(() => this.waitTime = closeDelay, closeDelay); + (_a = this.oldPopover) == null ? void 0 : _a.hide(); + this.oldPopover = null; + this.hoverEl.toggleClass("is-new", true); + this.document.body.addEventListener( + "click", + () => { + this.hoverEl.toggleClass("is-new", false); + }, + { once: true, capture: true } + ); + if (this.parent) { + this.parent.DailyNoteEditor = this; + } + const viewHeaderEl = this.hoverEl.querySelector(".view-header"); + viewHeaderEl == null ? void 0 : viewHeaderEl.remove(); + const sizer = this.hoverEl.querySelector(".workspace-leaf"); + if (sizer) + this.hoverEl.appendChild(sizer); + const inlineTitle = this.hoverEl.querySelector(".inline-title"); + if (inlineTitle) + inlineTitle.remove(); + (_b = this.onShowCallback) == null ? void 0 : _b.call(this); + this.onShowCallback = void 0; + } + detect(el) { + const { targetEl } = this; + if (targetEl) { + this.onTarget = el === targetEl || targetEl.contains(el); + } + } + shouldShow() { + return this.shouldShowSelf() || this.shouldShowChild(); + } + shouldShowChild() { + return DailyNoteEditor.activePopovers().some((popover) => { + if (popover !== this && popover.targetEl && this.hoverEl.contains(popover.targetEl)) { + return popover.shouldShow(); + } + return false; + }); + } + shouldShowSelf() { + return !this.detaching && !!(this.onTarget || this.state == require$$0.PopoverState.Shown || this.document.querySelector(`body>.modal-container, body > #he${this.id} ~ .menu, body > #he${this.id} ~ .suggestion-container`)); + } + show() { + if (!this.targetEl || this.document.body.contains(this.targetEl)) { + this.state = require$$0.PopoverState.Shown; + this.timer = 0; + this.targetEl.appendChild(this.hoverEl); + this.onShow(); + this.plugin.app.workspace.onLayoutChange(); + this.load(); + } else { + this.hide(); + } + if (this.hoverEl.dataset.imgHeight && this.hoverEl.dataset.imgWidth) { + this.hoverEl.style.height = parseFloat(this.hoverEl.dataset.imgHeight) + this.titleEl.offsetHeight + "px"; + this.hoverEl.style.width = parseFloat(this.hoverEl.dataset.imgWidth) + "px"; + } + } + onHide() { + var _a; + this.oldPopover = null; + if (((_a = this.parent) == null ? void 0 : _a.DailyNoteEditor) === this) { + this.parent.DailyNoteEditor = null; + } + } + hide() { + var _a; + this.onTarget = false; + this.detaching = true; + if (this.timer) { + window.clearTimeout(this.timer); + this.timer = 0; + } + this.hoverEl.hide(); + if (this.opening) + return; + const leaves = this.leaves(); + if (leaves.length) { + leaves[0].detach(); + } else { + this.parent = null; + (_a = this.abortController) == null ? void 0 : _a.unload(); + this.abortController = void 0; + return this.nativeHide(); + } + } + nativeHide() { + var _a; + const { hoverEl, targetEl } = this; + this.state = require$$0.PopoverState.Hidden; + hoverEl.detach(); + if (targetEl) { + const parent = targetEl.matchParent(".dn-leaf-view"); + if (parent) + (_a = popovers.get(parent)) == null ? void 0 : _a.transition(); + } + this.onHide(); + this.unload(); + } + resolveLink(linkText, sourcePath) { + const link = require$$0.parseLinktext(linkText); + const tFile = link ? this.plugin.app.metadataCache.getFirstLinkpathDest(link.path, sourcePath) : null; + return tFile; + } + async openLink(linkText, sourcePath, eState, createInLeaf) { + var _a, _b, _c; + let file = this.resolveLink(linkText, sourcePath); + const link = require$$0.parseLinktext(linkText); + if (!file && createInLeaf) { + const folder = this.plugin.app.fileManager.getNewFileParent(sourcePath); + file = await this.plugin.app.fileManager.createNewMarkdownFile(folder, link.path); + } + if (!file) { + return; + } + const { viewRegistry } = this.plugin.app; + const viewType = viewRegistry.typeByExtension[file.extension]; + if (!viewType || !viewRegistry.viewByType[viewType]) { + return; + } + eState = Object.assign(this.buildEphemeralState(file, link), eState); + const parentMode = this.getDefaultMode(); + const state2 = this.buildState(parentMode, eState); + const leaf = await this.openFile(file, state2, createInLeaf); + const leafViewType = (_a = leaf == null ? void 0 : leaf.view) == null ? void 0 : _a.getViewType(); + if (leafViewType === "image") { + if (((_b = this.parent) == null ? void 0 : _b.hasOwnProperty("editorEl")) && this.parent.editorEl.hasClass("is-live-preview")) { + this.waitTime = 3e3; + } + const img = leaf.view.contentEl.querySelector("img"); + this.hoverEl.dataset.imgHeight = String(img.naturalHeight); + this.hoverEl.dataset.imgWidth = String(img.naturalWidth); + this.hoverEl.dataset.imgRatio = String(img.naturalWidth / img.naturalHeight); + } else if (leafViewType === "pdf") { + this.hoverEl.style.height = "800px"; + this.hoverEl.style.width = "600px"; + } + if (((_c = state2.state) == null ? void 0 : _c.mode) === "source") { + this.whenShown(() => { + var _a2, _b2, _c2, _d; + if (require$$0.requireApiVersion("1.0")) + (_c2 = (_b2 = (_a2 = leaf == null ? void 0 : leaf.view) == null ? void 0 : _a2.editMode) == null ? void 0 : _b2.reinit) == null ? void 0 : _c2.call(_b2); + (_d = leaf == null ? void 0 : leaf.view) == null ? void 0 : _d.setEphemeralState(state2.eState); + }); + } + } + whenShown(callback) { + if (this.detaching) + return; + const existingCallback = this.onShowCallback; + this.onShowCallback = () => { + if (this.detaching) + return; + callback(); + if (typeof existingCallback === "function") + existingCallback(); + }; + if (this.state === require$$0.PopoverState.Shown) { + this.onShowCallback(); + this.onShowCallback = void 0; + } + } + async openFile(file, openState, useLeaf) { + if (this.detaching) + return; + const leaf = useLeaf ?? this.attachLeaf(); + this.opening = true; + try { + await leaf.openFile(file, openState); + } catch (e) { + console.error(e); + } finally { + this.opening = false; + if (this.detaching) + this.hide(); + } + this.plugin.app.workspace.setActiveLeaf(leaf); + return leaf; + } + buildState(parentMode, eState) { + return { + active: false, + // Don't let Obsidian force focus if we have autofocus off + state: { mode: "source" }, + // Don't set any state for the view, because this leaf is stayed on another view. + eState + }; + } + buildEphemeralState(file, link) { + const cache = this.plugin.app.metadataCache.getFileCache(file); + const subpath = cache ? require$$0.resolveSubpath(cache, (link == null ? void 0 : link.subpath) || "") : void 0; + const eState = { subpath: link == null ? void 0 : link.subpath }; + if (subpath) { + eState.line = subpath.start.line; + eState.startLoc = subpath.start; + eState.endLoc = subpath.end || void 0; + } + return eState; + } +} +const addIconList = () => { + require$$0.addIcon("daily-note", ``); +}; +const DEFAULT_SETTINGS = { + hideFrontmatter: false, + hideBacklinks: false, + createAndOpenOnStartup: false, + useArrowUpOrDownToNavigate: false, + preset: [] +}; +class DailyNoteSettingTab extends require$$0.PluginSettingTab { + constructor(app2, plugin) { + super(app2, plugin); + this.debounceApplySettingsUpdate = require$$0.debounce( + async () => { + await this.plugin.saveSettings(); + }, + 200, + true + ); + this.debounceDisplay = require$$0.debounce( + async () => { + await this.display(); + }, + 400, + true + ); + this.plugin = plugin; + } + applySettingsUpdate() { + this.debounceApplySettingsUpdate(); + } + async display() { + await this.plugin.loadSettings(); + const { containerEl } = this; + const settings = this.plugin.settings; + containerEl.toggleClass("daily-note-settings-container", true); + containerEl.empty(); + new require$$0.Setting(containerEl).setName("Hide frontmatter").setDesc("Hide frontmatter in daily notes").addToggle( + (toggle) => toggle.setValue(settings.hideFrontmatter).onChange(async (value) => { + this.plugin.settings.hideFrontmatter = value; + document.body.classList.toggle( + "daily-notes-hide-frontmatter", + value + ); + this.applySettingsUpdate(); + }) + ); + new require$$0.Setting(containerEl).setName("Hide backlinks").setDesc("Hide backlinks in daily notes").addToggle( + (toggle) => toggle.setValue(settings.hideBacklinks).onChange(async (value) => { + this.plugin.settings.hideBacklinks = value; + document.body.classList.toggle( + "daily-notes-hide-backlinks", + value + ); + this.applySettingsUpdate(); + }) + ); + new require$$0.Setting(containerEl).setName("Create and open Daily Notes Editor on startup").setDesc( + "Automatically create today's daily note and open the Daily Notes Editor when Obsidian starts" + ).addToggle( + (toggle) => toggle.setValue(settings.createAndOpenOnStartup).onChange(async (value) => { + this.plugin.settings.createAndOpenOnStartup = value; + this.applySettingsUpdate(); + }) + ); + new require$$0.Setting(containerEl).setName("Use arrow up/down key to navigate between notes").addToggle( + (toggle) => toggle.setValue(settings.useArrowUpOrDownToNavigate).onChange(async (value) => { + this.plugin.settings.useArrowUpOrDownToNavigate = value; + this.applySettingsUpdate(); + }) + ); + new require$$0.Setting(containerEl).setName("Saved presets").setHeading(); + const presetContainer = containerEl.createDiv("preset-container"); + if (settings.preset.length === 0) { + presetContainer.createEl("p", { + text: "No presets saved yet. Select a folder or tag in the Daily Notes Editor to create a preset.", + cls: "no-presets-message" + }); + } else { + settings.preset.forEach((preset, index) => { + new require$$0.Setting(containerEl).setName( + preset.type === "folder" ? "Focus on Folder: " : "Focus on Tag: " + ).setDesc(preset.target).addButton((button) => { + button.setIcon("trash"); + button.onClick(() => { + settings.preset.splice(index, 1); + this.applySettingsUpdate(); + this.debounceDisplay(); + }); + }); + }); + } + new require$$0.Setting(containerEl).setName("Add new preset").setDesc("Add a new folder or tag preset").addButton((button) => { + button.setButtonText("Add Preset").setCta().onClick(() => { + const modal = new AddPresetModal( + this.app, + (type, target) => { + const existingPresetIndex = settings.preset.findIndex( + (p) => p.type === type && p.target === target + ); + if (existingPresetIndex === -1) { + settings.preset.push({ + type, + target + }); + this.applySettingsUpdate(); + this.debounceDisplay(); + } + } + ); + modal.open(); + }); + }); + } +} +class AddPresetModal extends require$$0.Modal { + constructor(app2, saveCallback) { + super(app2); + this.type = "folder"; + this.saveCallback = saveCallback; + } + onOpen() { + const { contentEl } = this; + contentEl.empty(); + contentEl.createEl("h2", { text: "Add New Preset" }); + const form = contentEl.createEl("form"); + form.addEventListener("submit", (e) => { + e.preventDefault(); + this.save(); + }); + const typeSetting = form.createDiv(); + typeSetting.addClass("setting-item"); + const typeSettingInfo = typeSetting.createDiv(); + typeSettingInfo.addClass("setting-item-info"); + typeSettingInfo.createEl("div", { + text: "Preset Type", + cls: "setting-item-name" + }); + const typeSettingControl = typeSetting.createDiv(); + typeSettingControl.addClass("setting-item-control"); + const folderRadio = typeSettingControl.createEl("input", { + type: "radio", + attr: { + name: "preset-type", + id: "preset-type-folder", + value: "folder", + checked: true + } + }); + typeSettingControl.createEl("label", { + text: "Folder", + attr: { + for: "preset-type-folder" + } + }); + const tagRadio = typeSettingControl.createEl("input", { + type: "radio", + attr: { + name: "preset-type", + id: "preset-type-tag", + value: "tag" + } + }); + typeSettingControl.createEl("label", { + text: "Tag", + attr: { + for: "preset-type-tag" + } + }); + folderRadio.addEventListener("change", () => { + if (folderRadio.checked) { + this.type = "folder"; + } + }); + tagRadio.addEventListener("change", () => { + if (tagRadio.checked) { + this.type = "tag"; + } + }); + const targetSetting = form.createDiv(); + targetSetting.addClass("setting-item"); + const targetSettingInfo = targetSetting.createDiv(); + targetSettingInfo.addClass("setting-item-info"); + targetSettingInfo.createEl("div", { + text: "Target", + cls: "setting-item-name" + }); + targetSettingInfo.createEl("div", { + text: "Enter the folder path or tag name", + cls: "setting-item-description" + }); + const targetSettingControl = targetSetting.createDiv(); + targetSettingControl.addClass("setting-item-control"); + this.targetInput = targetSettingControl.createEl("input", { + type: "text", + value: "", + placeholder: "Enter folder path or tag name" + }); + this.targetInput.addClass("target-input"); + const footerEl = contentEl.createDiv(); + footerEl.addClass("modal-button-container"); + footerEl.createEl("button", { + text: "Cancel", + cls: "mod-warning", + attr: { + type: "button" + } + }).addEventListener("click", () => { + this.close(); + }); + footerEl.createEl("button", { + text: "Save", + cls: "mod-cta", + attr: { + type: "submit" + } + }).addEventListener("click", (e) => { + e.preventDefault(); + this.save(); + }); + } + save() { + const target = this.targetInput.value.trim(); + if (target) { + this.saveCallback(this.type, target); + this.close(); + } + } + onClose() { + const { contentEl } = this; + contentEl.empty(); + } +} +var main = {}; +Object.defineProperty(main, "__esModule", { value: true }); +var obsidian = require$$0; +const DEFAULT_DAILY_NOTE_FORMAT = "YYYY-MM-DD"; +const DEFAULT_WEEKLY_NOTE_FORMAT = "gggg-[W]ww"; +const DEFAULT_MONTHLY_NOTE_FORMAT = "YYYY-MM"; +const DEFAULT_QUARTERLY_NOTE_FORMAT = "YYYY-[Q]Q"; +const DEFAULT_YEARLY_NOTE_FORMAT = "YYYY"; +function shouldUsePeriodicNotesSettings(periodicity) { + var _a, _b; + const periodicNotes = window.app.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a[periodicity]) == null ? void 0 : _b.enabled); +} +function getDailyNoteSettings() { + var _a, _b, _c, _d; + try { + const { internalPlugins, plugins } = window.app; + if (shouldUsePeriodicNotesSettings("daily")) { + const { format: format2, folder: folder2, template: template2 } = ((_b = (_a = plugins.getPlugin("periodic-notes")) == null ? void 0 : _a.settings) == null ? void 0 : _b.daily) || {}; + return { + format: format2 || DEFAULT_DAILY_NOTE_FORMAT, + folder: (folder2 == null ? void 0 : folder2.trim()) || "", + template: (template2 == null ? void 0 : template2.trim()) || "" + }; + } + const { folder, format, template } = ((_d = (_c = internalPlugins.getPluginById("daily-notes")) == null ? void 0 : _c.instance) == null ? void 0 : _d.options) || {}; + return { + format: format || DEFAULT_DAILY_NOTE_FORMAT, + folder: (folder == null ? void 0 : folder.trim()) || "", + template: (template == null ? void 0 : template.trim()) || "" + }; + } catch (err) { + console.info("No custom daily note settings found!", err); + } +} +function getWeeklyNoteSettings() { + var _a, _b, _c, _d, _e, _f, _g; + try { + const pluginManager = window.app.plugins; + const calendarSettings = (_a = pluginManager.getPlugin("calendar")) == null ? void 0 : _a.options; + const periodicNotesSettings = (_c = (_b = pluginManager.getPlugin("periodic-notes")) == null ? void 0 : _b.settings) == null ? void 0 : _c.weekly; + if (shouldUsePeriodicNotesSettings("weekly")) { + return { + format: periodicNotesSettings.format || DEFAULT_WEEKLY_NOTE_FORMAT, + folder: ((_d = periodicNotesSettings.folder) == null ? void 0 : _d.trim()) || "", + template: ((_e = periodicNotesSettings.template) == null ? void 0 : _e.trim()) || "" + }; + } + const settings = calendarSettings || {}; + return { + format: settings.weeklyNoteFormat || DEFAULT_WEEKLY_NOTE_FORMAT, + folder: ((_f = settings.weeklyNoteFolder) == null ? void 0 : _f.trim()) || "", + template: ((_g = settings.weeklyNoteTemplate) == null ? void 0 : _g.trim()) || "" + }; + } catch (err) { + console.info("No custom weekly note settings found!", err); + } +} +function getMonthlyNoteSettings() { + var _a, _b, _c, _d; + const pluginManager = window.app.plugins; + try { + const settings = shouldUsePeriodicNotesSettings("monthly") && ((_b = (_a = pluginManager.getPlugin("periodic-notes")) == null ? void 0 : _a.settings) == null ? void 0 : _b.monthly) || {}; + return { + format: settings.format || DEFAULT_MONTHLY_NOTE_FORMAT, + folder: ((_c = settings.folder) == null ? void 0 : _c.trim()) || "", + template: ((_d = settings.template) == null ? void 0 : _d.trim()) || "" + }; + } catch (err) { + console.info("No custom monthly note settings found!", err); + } +} +function getQuarterlyNoteSettings() { + var _a, _b, _c, _d; + const pluginManager = window.app.plugins; + try { + const settings = shouldUsePeriodicNotesSettings("quarterly") && ((_b = (_a = pluginManager.getPlugin("periodic-notes")) == null ? void 0 : _a.settings) == null ? void 0 : _b.quarterly) || {}; + return { + format: settings.format || DEFAULT_QUARTERLY_NOTE_FORMAT, + folder: ((_c = settings.folder) == null ? void 0 : _c.trim()) || "", + template: ((_d = settings.template) == null ? void 0 : _d.trim()) || "" + }; + } catch (err) { + console.info("No custom quarterly note settings found!", err); + } +} +function getYearlyNoteSettings() { + var _a, _b, _c, _d; + const pluginManager = window.app.plugins; + try { + const settings = shouldUsePeriodicNotesSettings("yearly") && ((_b = (_a = pluginManager.getPlugin("periodic-notes")) == null ? void 0 : _a.settings) == null ? void 0 : _b.yearly) || {}; + return { + format: settings.format || DEFAULT_YEARLY_NOTE_FORMAT, + folder: ((_c = settings.folder) == null ? void 0 : _c.trim()) || "", + template: ((_d = settings.template) == null ? void 0 : _d.trim()) || "" + }; + } catch (err) { + console.info("No custom yearly note settings found!", err); + } +} +function join(...partSegments) { + let parts = []; + for (let i = 0, l = partSegments.length; i < l; i++) { + parts = parts.concat(partSegments[i].split("/")); + } + const newParts = []; + for (let i = 0, l = parts.length; i < l; i++) { + const part = parts[i]; + if (!part || part === ".") + continue; + else + newParts.push(part); + } + if (parts[0] === "") + newParts.unshift(""); + return newParts.join("/"); +} +function basename(fullPath) { + let base = fullPath.substring(fullPath.lastIndexOf("/") + 1); + if (base.lastIndexOf(".") != -1) + base = base.substring(0, base.lastIndexOf(".")); + return base; +} +async function ensureFolderExists(path) { + const dirs = path.replace(/\\/g, "/").split("/"); + dirs.pop(); + if (dirs.length) { + const dir = join(...dirs); + if (!window.app.vault.getAbstractFileByPath(dir)) { + await window.app.vault.createFolder(dir); + } + } +} +async function getNotePath(directory, filename) { + if (!filename.endsWith(".md")) { + filename += ".md"; + } + const path = obsidian.normalizePath(join(directory, filename)); + await ensureFolderExists(path); + return path; +} +async function getTemplateInfo(template) { + const { metadataCache, vault } = window.app; + const templatePath = obsidian.normalizePath(template); + if (templatePath === "/") { + return Promise.resolve(["", null]); + } + try { + const templateFile = metadataCache.getFirstLinkpathDest(templatePath, ""); + const contents = await vault.cachedRead(templateFile); + const IFoldInfo = window.app.foldManager.load(templateFile); + return [contents, IFoldInfo]; + } catch (err) { + console.error(`Failed to read the daily note template '${templatePath}'`, err); + new obsidian.Notice("Failed to read the daily note template"); + return ["", null]; + } +} +function getDateUID(date, granularity = "day") { + const ts = date.clone().startOf(granularity).format(); + return `${granularity}-${ts}`; +} +function removeEscapedCharacters(format) { + return format.replace(/\[[^\]]*\]/g, ""); +} +function isFormatAmbiguous(format, granularity) { + if (granularity === "week") { + const cleanFormat = removeEscapedCharacters(format); + return /w{1,2}/i.test(cleanFormat) && (/M{1,4}/.test(cleanFormat) || /D{1,4}/.test(cleanFormat)); + } + return false; +} +function getDateFromFile(file, granularity) { + return getDateFromFilename(file.basename, granularity); +} +function getDateFromPath(path, granularity) { + return getDateFromFilename(basename(path), granularity); +} +function getDateFromFilename(filename, granularity) { + const getSettings = { + day: getDailyNoteSettings, + week: getWeeklyNoteSettings, + month: getMonthlyNoteSettings, + quarter: getQuarterlyNoteSettings, + year: getYearlyNoteSettings + }; + const format = getSettings[granularity]().format.split("/").pop(); + const noteDate = window.moment(filename, format, true); + if (!noteDate.isValid()) { + return null; + } + if (isFormatAmbiguous(format, granularity)) { + if (granularity === "week") { + const cleanFormat = removeEscapedCharacters(format); + if (/w{1,2}/i.test(cleanFormat)) { + return window.moment( + filename, + // If format contains week, remove day & month formatting + format.replace(/M{1,4}/g, "").replace(/D{1,4}/g, ""), + false + ); + } + } + } + return noteDate; +} +class DailyNotesFolderMissingError extends Error { +} +async function createDailyNote(date) { + const app2 = window.app; + const { vault } = app2; + const moment = window.moment; + const { template, format, folder } = getDailyNoteSettings(); + const [templateContents, IFoldInfo] = await getTemplateInfo(template); + const filename = date.format(format); + const normalizedPath = await getNotePath(folder, filename); + try { + const createdFile = await vault.create(normalizedPath, templateContents.replace(/{{\s*date\s*}}/gi, filename).replace(/{{\s*time\s*}}/gi, moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi, filename).replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => { + const now = moment(); + const currentDate = date.clone().set({ + hour: now.get("hour"), + minute: now.get("minute"), + second: now.get("second") + }); + if (calc) { + currentDate.add(parseInt(timeDelta, 10), unit); + } + if (momentFormat) { + return currentDate.format(momentFormat.substring(1).trim()); + } + return currentDate.format(format); + }).replace(/{{\s*yesterday\s*}}/gi, date.clone().subtract(1, "day").format(format)).replace(/{{\s*tomorrow\s*}}/gi, date.clone().add(1, "d").format(format))); + app2.foldManager.save(createdFile, IFoldInfo); + return createdFile; + } catch (err) { + console.error(`Failed to create file: '${normalizedPath}'`, err); + new obsidian.Notice("Unable to create new file."); + } +} +function getDailyNote(date, dailyNotes) { + return dailyNotes[getDateUID(date, "day")] ?? null; +} +function getAllDailyNotes() { + const { vault } = window.app; + const { folder } = getDailyNoteSettings(); + const dailyNotesFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!dailyNotesFolder) { + throw new DailyNotesFolderMissingError("Failed to find daily notes folder"); + } + const dailyNotes = {}; + obsidian.Vault.recurseChildren(dailyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "day"); + if (date) { + const dateString = getDateUID(date, "day"); + dailyNotes[dateString] = note; + } + } + }); + return dailyNotes; +} +class WeeklyNotesFolderMissingError extends Error { +} +function getDaysOfWeek() { + const { moment } = window; + let weekStart = moment.localeData()._week.dow; + const daysOfWeek = [ + "sunday", + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday" + ]; + while (weekStart) { + daysOfWeek.push(daysOfWeek.shift()); + weekStart--; + } + return daysOfWeek; +} +function getDayOfWeekNumericalValue(dayOfWeekName) { + return getDaysOfWeek().indexOf(dayOfWeekName.toLowerCase()); +} +async function createWeeklyNote(date) { + const { vault } = window.app; + const { template, format, folder } = getWeeklyNoteSettings(); + const [templateContents, IFoldInfo] = await getTemplateInfo(template); + const filename = date.format(format); + const normalizedPath = await getNotePath(folder, filename); + try { + const createdFile = await vault.create(normalizedPath, templateContents.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => { + const now = window.moment(); + const currentDate = date.clone().set({ + hour: now.get("hour"), + minute: now.get("minute"), + second: now.get("second") + }); + if (calc) { + currentDate.add(parseInt(timeDelta, 10), unit); + } + if (momentFormat) { + return currentDate.format(momentFormat.substring(1).trim()); + } + return currentDate.format(format); + }).replace(/{{\s*title\s*}}/gi, filename).replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")).replace(/{{\s*(sunday|monday|tuesday|wednesday|thursday|friday|saturday)\s*:(.*?)}}/gi, (_, dayOfWeek, momentFormat) => { + const day = getDayOfWeekNumericalValue(dayOfWeek); + return date.weekday(day).format(momentFormat.trim()); + })); + window.app.foldManager.save(createdFile, IFoldInfo); + return createdFile; + } catch (err) { + console.error(`Failed to create file: '${normalizedPath}'`, err); + new obsidian.Notice("Unable to create new file."); + } +} +function getWeeklyNote(date, weeklyNotes) { + return weeklyNotes[getDateUID(date, "week")] ?? null; +} +function getAllWeeklyNotes() { + const weeklyNotes = {}; + if (!appHasWeeklyNotesPluginLoaded()) { + return weeklyNotes; + } + const { vault } = window.app; + const { folder } = getWeeklyNoteSettings(); + const weeklyNotesFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!weeklyNotesFolder) { + throw new WeeklyNotesFolderMissingError("Failed to find weekly notes folder"); + } + obsidian.Vault.recurseChildren(weeklyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "week"); + if (date) { + const dateString = getDateUID(date, "week"); + weeklyNotes[dateString] = note; + } + } + }); + return weeklyNotes; +} +class MonthlyNotesFolderMissingError extends Error { +} +async function createMonthlyNote(date) { + const { vault } = window.app; + const { template, format, folder } = getMonthlyNoteSettings(); + const [templateContents, IFoldInfo] = await getTemplateInfo(template); + const filename = date.format(format); + const normalizedPath = await getNotePath(folder, filename); + try { + const createdFile = await vault.create(normalizedPath, templateContents.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => { + const now = window.moment(); + const currentDate = date.clone().set({ + hour: now.get("hour"), + minute: now.get("minute"), + second: now.get("second") + }); + if (calc) { + currentDate.add(parseInt(timeDelta, 10), unit); + } + if (momentFormat) { + return currentDate.format(momentFormat.substring(1).trim()); + } + return currentDate.format(format); + }).replace(/{{\s*date\s*}}/gi, filename).replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi, filename)); + window.app.foldManager.save(createdFile, IFoldInfo); + return createdFile; + } catch (err) { + console.error(`Failed to create file: '${normalizedPath}'`, err); + new obsidian.Notice("Unable to create new file."); + } +} +function getMonthlyNote(date, monthlyNotes) { + return monthlyNotes[getDateUID(date, "month")] ?? null; +} +function getAllMonthlyNotes() { + const monthlyNotes = {}; + if (!appHasMonthlyNotesPluginLoaded()) { + return monthlyNotes; + } + const { vault } = window.app; + const { folder } = getMonthlyNoteSettings(); + const monthlyNotesFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!monthlyNotesFolder) { + throw new MonthlyNotesFolderMissingError("Failed to find monthly notes folder"); + } + obsidian.Vault.recurseChildren(monthlyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "month"); + if (date) { + const dateString = getDateUID(date, "month"); + monthlyNotes[dateString] = note; + } + } + }); + return monthlyNotes; +} +class QuarterlyNotesFolderMissingError extends Error { +} +async function createQuarterlyNote(date) { + const { vault } = window.app; + const { template, format, folder } = getQuarterlyNoteSettings(); + const [templateContents, IFoldInfo] = await getTemplateInfo(template); + const filename = date.format(format); + const normalizedPath = await getNotePath(folder, filename); + try { + const createdFile = await vault.create(normalizedPath, templateContents.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => { + const now = window.moment(); + const currentDate = date.clone().set({ + hour: now.get("hour"), + minute: now.get("minute"), + second: now.get("second") + }); + if (calc) { + currentDate.add(parseInt(timeDelta, 10), unit); + } + if (momentFormat) { + return currentDate.format(momentFormat.substring(1).trim()); + } + return currentDate.format(format); + }).replace(/{{\s*date\s*}}/gi, filename).replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi, filename)); + window.app.foldManager.save(createdFile, IFoldInfo); + return createdFile; + } catch (err) { + console.error(`Failed to create file: '${normalizedPath}'`, err); + new obsidian.Notice("Unable to create new file."); + } +} +function getQuarterlyNote(date, quarterly) { + return quarterly[getDateUID(date, "quarter")] ?? null; +} +function getAllQuarterlyNotes() { + const quarterly = {}; + if (!appHasQuarterlyNotesPluginLoaded()) { + return quarterly; + } + const { vault } = window.app; + const { folder } = getQuarterlyNoteSettings(); + const quarterlyFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!quarterlyFolder) { + throw new QuarterlyNotesFolderMissingError("Failed to find quarterly notes folder"); + } + obsidian.Vault.recurseChildren(quarterlyFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "quarter"); + if (date) { + const dateString = getDateUID(date, "quarter"); + quarterly[dateString] = note; + } + } + }); + return quarterly; +} +class YearlyNotesFolderMissingError extends Error { +} +async function createYearlyNote(date) { + const { vault } = window.app; + const { template, format, folder } = getYearlyNoteSettings(); + const [templateContents, IFoldInfo] = await getTemplateInfo(template); + const filename = date.format(format); + const normalizedPath = await getNotePath(folder, filename); + try { + const createdFile = await vault.create(normalizedPath, templateContents.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => { + const now = window.moment(); + const currentDate = date.clone().set({ + hour: now.get("hour"), + minute: now.get("minute"), + second: now.get("second") + }); + if (calc) { + currentDate.add(parseInt(timeDelta, 10), unit); + } + if (momentFormat) { + return currentDate.format(momentFormat.substring(1).trim()); + } + return currentDate.format(format); + }).replace(/{{\s*date\s*}}/gi, filename).replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi, filename)); + window.app.foldManager.save(createdFile, IFoldInfo); + return createdFile; + } catch (err) { + console.error(`Failed to create file: '${normalizedPath}'`, err); + new obsidian.Notice("Unable to create new file."); + } +} +function getYearlyNote(date, yearlyNotes) { + return yearlyNotes[getDateUID(date, "year")] ?? null; +} +function getAllYearlyNotes() { + const yearlyNotes = {}; + if (!appHasYearlyNotesPluginLoaded()) { + return yearlyNotes; + } + const { vault } = window.app; + const { folder } = getYearlyNoteSettings(); + const yearlyNotesFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!yearlyNotesFolder) { + throw new YearlyNotesFolderMissingError("Failed to find yearly notes folder"); + } + obsidian.Vault.recurseChildren(yearlyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "year"); + if (date) { + const dateString = getDateUID(date, "year"); + yearlyNotes[dateString] = note; + } + } + }); + return yearlyNotes; +} +function appHasDailyNotesPluginLoaded() { + var _a, _b; + const { app: app2 } = window; + const dailyNotesPlugin = app2.internalPlugins.plugins["daily-notes"]; + if (dailyNotesPlugin && dailyNotesPlugin.enabled) { + return true; + } + const periodicNotes = app2.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a.daily) == null ? void 0 : _b.enabled); +} +function appHasWeeklyNotesPluginLoaded() { + var _a, _b; + const { app: app2 } = window; + if (app2.plugins.getPlugin("calendar")) { + return true; + } + const periodicNotes = app2.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a.weekly) == null ? void 0 : _b.enabled); +} +function appHasMonthlyNotesPluginLoaded() { + var _a, _b; + const { app: app2 } = window; + const periodicNotes = app2.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a.monthly) == null ? void 0 : _b.enabled); +} +function appHasQuarterlyNotesPluginLoaded() { + var _a, _b; + const { app: app2 } = window; + const periodicNotes = app2.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a.quarterly) == null ? void 0 : _b.enabled); +} +function appHasYearlyNotesPluginLoaded() { + var _a, _b; + const { app: app2 } = window; + const periodicNotes = app2.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a.yearly) == null ? void 0 : _b.enabled); +} +function getPeriodicNoteSettings(granularity) { + const getSettings = { + day: getDailyNoteSettings, + week: getWeeklyNoteSettings, + month: getMonthlyNoteSettings, + quarter: getQuarterlyNoteSettings, + year: getYearlyNoteSettings + }[granularity]; + return getSettings(); +} +function createPeriodicNote(granularity, date) { + const createFn = { + day: createDailyNote, + month: createMonthlyNote, + week: createWeeklyNote + }; + return createFn[granularity](date); +} +var DEFAULT_DAILY_NOTE_FORMAT_1 = main.DEFAULT_DAILY_NOTE_FORMAT = DEFAULT_DAILY_NOTE_FORMAT; +main.DEFAULT_MONTHLY_NOTE_FORMAT = DEFAULT_MONTHLY_NOTE_FORMAT; +main.DEFAULT_QUARTERLY_NOTE_FORMAT = DEFAULT_QUARTERLY_NOTE_FORMAT; +main.DEFAULT_WEEKLY_NOTE_FORMAT = DEFAULT_WEEKLY_NOTE_FORMAT; +main.DEFAULT_YEARLY_NOTE_FORMAT = DEFAULT_YEARLY_NOTE_FORMAT; +main.appHasDailyNotesPluginLoaded = appHasDailyNotesPluginLoaded; +main.appHasMonthlyNotesPluginLoaded = appHasMonthlyNotesPluginLoaded; +main.appHasQuarterlyNotesPluginLoaded = appHasQuarterlyNotesPluginLoaded; +main.appHasWeeklyNotesPluginLoaded = appHasWeeklyNotesPluginLoaded; +main.appHasYearlyNotesPluginLoaded = appHasYearlyNotesPluginLoaded; +var createDailyNote_1 = main.createDailyNote = createDailyNote; +main.createMonthlyNote = createMonthlyNote; +main.createPeriodicNote = createPeriodicNote; +main.createQuarterlyNote = createQuarterlyNote; +main.createWeeklyNote = createWeeklyNote; +main.createYearlyNote = createYearlyNote; +var getAllDailyNotes_1 = main.getAllDailyNotes = getAllDailyNotes; +main.getAllMonthlyNotes = getAllMonthlyNotes; +main.getAllQuarterlyNotes = getAllQuarterlyNotes; +main.getAllWeeklyNotes = getAllWeeklyNotes; +main.getAllYearlyNotes = getAllYearlyNotes; +var getDailyNote_1 = main.getDailyNote = getDailyNote; +var getDailyNoteSettings_1 = main.getDailyNoteSettings = getDailyNoteSettings; +var getDateFromFile_1 = main.getDateFromFile = getDateFromFile; +main.getDateFromPath = getDateFromPath; +main.getDateUID = getDateUID; +main.getMonthlyNote = getMonthlyNote; +main.getMonthlyNoteSettings = getMonthlyNoteSettings; +main.getPeriodicNoteSettings = getPeriodicNoteSettings; +main.getQuarterlyNote = getQuarterlyNote; +main.getQuarterlyNoteSettings = getQuarterlyNoteSettings; +main.getTemplateInfo = getTemplateInfo; +main.getWeeklyNote = getWeeklyNote; +main.getWeeklyNoteSettings = getWeeklyNoteSettings; +main.getYearlyNote = getYearlyNote; +main.getYearlyNoteSettings = getYearlyNoteSettings; +function getEditor(leaf) { + if (!leaf) + return null; + const view2 = leaf.view; + if (!(view2 instanceof require$$0.MarkdownView)) + return null; + return view2.editor; +} +function findAdjacentLeaf(app2, currentLeaf, direction) { + if (!currentLeaf || !isDailyNoteLeaf(currentLeaf)) + return null; + const dailyNoteLeaves = []; + app2.workspace.iterateAllLeaves((leaf) => { + if (isDailyNoteLeaf(leaf)) { + dailyNoteLeaves.push(leaf); + } + }); + dailyNoteLeaves.sort((a, b) => { + const rectA = a.containerEl.getBoundingClientRect(); + const rectB = b.containerEl.getBoundingClientRect(); + return rectA.top - rectB.top; + }); + const currentIndex = dailyNoteLeaves.findIndex( + (leaf) => leaf === currentLeaf + ); + if (currentIndex === -1) + return null; + const targetIndex = direction === "up" ? currentIndex - 1 : currentIndex + 1; + return targetIndex >= 0 && targetIndex < dailyNoteLeaves.length ? dailyNoteLeaves[targetIndex] : null; +} +function navigateToAdjacentLeaf(app2, currentLeaf, direction) { + const targetLeaf = findAdjacentLeaf(app2, currentLeaf, direction); + if (!targetLeaf) + return false; + app2.workspace.setActiveLeaf(targetLeaf, { focus: true }); + const editor = getEditor(targetLeaf); + if (!editor) + return false; + let pos; + if (direction === "up") { + const lastLine = editor.lastLine(); + const lastLineLength = editor.getLine(lastLine).length; + pos = { line: lastLine, ch: lastLineLength }; + } else { + pos = { line: 0, ch: 0 }; + } + editor.setCursor(pos); + editor.scrollIntoView( + { + from: pos, + to: pos + }, + true + ); + setTimeout(() => { + if (targetLeaf.view instanceof require$$0.MarkdownView) { + if (targetLeaf.view.editMode && targetLeaf.view.editMode.editor) { + targetLeaf.view.editMode.editor.focus(); + } else { + editor.focus(); + } + } + }, 10); + return true; +} +function isFrontmatterHidden(plugin) { + var _a; + return ((_a = plugin.settings) == null ? void 0 : _a.hideFrontmatter) === true; +} +function isAtFirstVisibleLine(view2, file, app2, plugin) { + var _a, _b; + if (!isFrontmatterHidden(plugin)) { + const pos2 = view2.state.selection.main.head; + const line2 = view2.state.doc.lineAt(pos2); + return line2.number === 1 && pos2 === line2.from; + } + const pos = view2.state.selection.main.head; + const line = view2.state.doc.lineAt(pos); + const fileCache = app2.metadataCache.getFileCache(file); + if (!fileCache || !fileCache.frontmatter) { + return line.number === 1 && pos === line.from; + } + const frontmatterEndLine = (((_b = (_a = fileCache.frontmatterPosition) == null ? void 0 : _a.end) == null ? void 0 : _b.line) ?? 0) + 2; + return line.number === frontmatterEndLine && pos === line.from; +} +function createUpDownNavigationExtension(options) { + const { app: app2, plugin } = options; + const keyBindings = [ + { + key: "ArrowUp", + run: (view2) => { + var _a; + if (!view2.state) + return false; + const infoView = view2.state.field(require$$0.editorInfoField); + const currentLeaf = infoView == null ? void 0 : infoView.leaf; + const currentFile = (_a = currentLeaf == null ? void 0 : currentLeaf.view) == null ? void 0 : _a.file; + if (currentFile && isAtFirstVisibleLine(view2, currentFile, app2, plugin)) { + if (currentLeaf && navigateToAdjacentLeaf(app2, currentLeaf, "up")) { + return true; + } + } + return false; + } + }, + { + key: "ArrowDown", + run: (view2) => { + if (!view2.state) + return false; + const pos = view2.state.selection.main.head; + const line = view2.state.doc.lineAt(pos); + const infoView = view2.state.field(require$$0.editorInfoField); + const currentLeaf = infoView == null ? void 0 : infoView.leaf; + const lastLineNumber = view2.state.doc.lines; + if (line.number === lastLineNumber && pos === line.to) { + if (currentLeaf && navigateToAdjacentLeaf(app2, currentLeaf, "down")) { + return true; + } + } + return false; + } + } + ]; + return state.Prec.highest(view.keymap.of(keyBindings)); +} +function noop() { +} +function run$1(fn) { + return fn(); +} +function blank_object() { + return /* @__PURE__ */ Object.create(null); +} +function run_all$1(fns) { + fns.forEach(run$1); +} +function is_function(thing) { + return typeof thing === "function"; +} +function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function"; +} +function is_empty(obj) { + return Object.keys(obj).length === 0; +} +function action_destroyer(action_result) { + return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; +} +function append(target, node) { + target.appendChild(node); +} +function insert(target, node, anchor) { + target.insertBefore(node, anchor || null); +} +function detach(node) { + if (node.parentNode) { + node.parentNode.removeChild(node); + } +} +function element(name) { + return document.createElement(name); +} +function svg_element(name) { + return document.createElementNS("http://www.w3.org/2000/svg", name); +} +function text(data) { + return document.createTextNode(data); +} +function space() { + return text(" "); +} +function listen(node, event, handler, options) { + node.addEventListener(event, handler, options); + return () => node.removeEventListener(event, handler, options); +} +function attr(node, attribute, value) { + if (value == null) + node.removeAttribute(attribute); + else if (node.getAttribute(attribute) !== value) + node.setAttribute(attribute, value); +} +function children(element2) { + return Array.from(element2.childNodes); +} +function set_data(text2, data) { + data = "" + data; + if (text2.data === data) + return; + text2.data = /** @type {string} */ + data; +} +function set_style(node, key, value, important) { + if (value == null) { + node.style.removeProperty(key); + } else { + node.style.setProperty(key, value, ""); + } +} +let current_component; +function set_current_component(component) { + current_component = component; +} +function get_current_component() { + if (!current_component) + throw new Error("Function called outside component initialization"); + return current_component; +} +function onMount(fn) { + get_current_component().$$.on_mount.push(fn); +} +function onDestroy(fn) { + get_current_component().$$.on_destroy.push(fn); +} +const dirty_components$1 = []; +const binding_callbacks$1 = []; +let render_callbacks$1 = []; +const flush_callbacks$1 = []; +const resolved_promise$1 = /* @__PURE__ */ Promise.resolve(); +let update_scheduled$1 = false; +function schedule_update$1() { + if (!update_scheduled$1) { + update_scheduled$1 = true; + resolved_promise$1.then(flush$1); + } +} +function add_render_callback$1(fn) { + render_callbacks$1.push(fn); +} +const seen_callbacks$1 = /* @__PURE__ */ new Set(); +let flushidx$1 = 0; +function flush$1() { + if (flushidx$1 !== 0) { + return; + } + const saved_component = current_component; + do { + try { + while (flushidx$1 < dirty_components$1.length) { + const component = dirty_components$1[flushidx$1]; + flushidx$1++; + set_current_component(component); + update$1(component.$$); + } + } catch (e) { + dirty_components$1.length = 0; + flushidx$1 = 0; + throw e; + } + set_current_component(null); + dirty_components$1.length = 0; + flushidx$1 = 0; + while (binding_callbacks$1.length) + binding_callbacks$1.pop()(); + for (let i = 0; i < render_callbacks$1.length; i += 1) { + const callback = render_callbacks$1[i]; + if (!seen_callbacks$1.has(callback)) { + seen_callbacks$1.add(callback); + callback(); + } + } + render_callbacks$1.length = 0; + } while (dirty_components$1.length); + while (flush_callbacks$1.length) { + flush_callbacks$1.pop()(); + } + update_scheduled$1 = false; + seen_callbacks$1.clear(); + set_current_component(saved_component); +} +function update$1($$) { + if ($$.fragment !== null) { + $$.update(); + run_all$1($$.before_update); + const dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback$1); + } +} +function flush_render_callbacks(fns) { + const filtered = []; + const targets = []; + render_callbacks$1.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c)); + targets.forEach((c) => c()); + render_callbacks$1 = filtered; +} +const outroing = /* @__PURE__ */ new Set(); +let outros; +function group_outros() { + outros = { + r: 0, + c: [], + p: outros + // parent group + }; +} +function check_outros() { + if (!outros.r) { + run_all$1(outros.c); + } + outros = outros.p; +} +function transition_in(block, local) { + if (block && block.i) { + outroing.delete(block); + block.i(local); + } +} +function transition_out(block, local, detach2, callback) { + if (block && block.o) { + if (outroing.has(block)) + return; + outroing.add(block); + outros.c.push(() => { + outroing.delete(block); + if (callback) { + if (detach2) + block.d(1); + callback(); + } + }); + block.o(local); + } else if (callback) { + callback(); + } +} +function ensure_array_like(array_like_or_iterator) { + return (array_like_or_iterator == null ? void 0 : array_like_or_iterator.length) !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator); +} +function outro_and_destroy_block(block, lookup) { + transition_out(block, 1, 1, () => { + lookup.delete(block.key); + }); +} +function update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block2, next, get_context) { + let o = old_blocks.length; + let n = list.length; + let i = o; + const old_indexes = {}; + while (i--) + old_indexes[old_blocks[i].key] = i; + const new_blocks = []; + const new_lookup = /* @__PURE__ */ new Map(); + const deltas = /* @__PURE__ */ new Map(); + const updates = []; + i = n; + while (i--) { + const child_ctx = get_context(ctx, list, i); + const key = get_key(child_ctx); + let block = lookup.get(key); + if (!block) { + block = create_each_block2(key, child_ctx); + block.c(); + } else { + updates.push(() => block.p(child_ctx, dirty)); + } + new_lookup.set(key, new_blocks[i] = block); + if (key in old_indexes) + deltas.set(key, Math.abs(i - old_indexes[key])); + } + const will_move = /* @__PURE__ */ new Set(); + const did_move = /* @__PURE__ */ new Set(); + function insert2(block) { + transition_in(block, 1); + block.m(node, next); + lookup.set(block.key, block); + next = block.first; + n--; + } + while (o && n) { + const new_block = new_blocks[n - 1]; + const old_block = old_blocks[o - 1]; + const new_key = new_block.key; + const old_key = old_block.key; + if (new_block === old_block) { + next = new_block.first; + o--; + n--; + } else if (!new_lookup.has(old_key)) { + destroy(old_block, lookup); + o--; + } else if (!lookup.has(new_key) || will_move.has(new_key)) { + insert2(new_block); + } else if (did_move.has(old_key)) { + o--; + } else if (deltas.get(new_key) > deltas.get(old_key)) { + did_move.add(new_key); + insert2(new_block); + } else { + will_move.add(old_key); + o--; + } + } + while (o--) { + const old_block = old_blocks[o]; + if (!new_lookup.has(old_block.key)) + destroy(old_block, lookup); + } + while (n) + insert2(new_blocks[n - 1]); + run_all$1(updates); + return new_blocks; +} +function create_component(block) { + block && block.c(); +} +function mount_component(component, target, anchor) { + const { fragment, after_update } = component.$$; + fragment && fragment.m(target, anchor); + add_render_callback$1(() => { + const new_on_destroy = component.$$.on_mount.map(run$1).filter(is_function); + if (component.$$.on_destroy) { + component.$$.on_destroy.push(...new_on_destroy); + } else { + run_all$1(new_on_destroy); + } + component.$$.on_mount = []; + }); + after_update.forEach(add_render_callback$1); +} +function destroy_component(component, detaching) { + const $$ = component.$$; + if ($$.fragment !== null) { + flush_render_callbacks($$.after_update); + run_all$1($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } +} +function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components$1.push(component); + schedule_update$1(); + component.$$.dirty.fill(0); + } + component.$$.dirty[i / 31 | 0] |= 1 << i % 31; +} +function init(component, options, instance2, create_fragment2, not_equal, props, append_styles = null, dirty = [-1]) { + const parent_component = current_component; + set_current_component(component); + const $$ = component.$$ = { + fragment: null, + ctx: [], + // state + props, + update: noop, + not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + on_disconnect: [], + before_update: [], + after_update: [], + context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), + // everything else + callbacks: blank_object(), + dirty, + skip_bound: false, + root: options.target || parent_component.$$.root + }; + append_styles && append_styles($$.root); + let ready = false; + $$.ctx = instance2 ? instance2(component, options.props || {}, (i, ret, ...rest) => { + const value = rest.length ? rest[0] : ret; + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) + $$.bound[i](value); + if (ready) + make_dirty(component, i); + } + return ret; + }) : []; + $$.update(); + ready = true; + run_all$1($$.before_update); + $$.fragment = create_fragment2 ? create_fragment2($$.ctx) : false; + if (options.target) { + if (options.hydrate) { + const nodes = children(options.target); + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } else { + $$.fragment && $$.fragment.c(); + } + if (options.intro) + transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor); + flush$1(); + } + set_current_component(parent_component); +} +class SvelteComponent { + constructor() { + /** + * ### PRIVATE API + * + * Do not use, may change at any time + * + * @type {any} + */ + __publicField(this, "$$"); + /** + * ### PRIVATE API + * + * Do not use, may change at any time + * + * @type {any} + */ + __publicField(this, "$$set"); + } + /** @returns {void} */ + $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + /** + * @template {Extract} K + * @param {K} type + * @param {((e: Events[K]) => void) | null | undefined} callback + * @returns {() => void} + */ + $on(type, callback) { + if (!is_function(callback)) { + return noop; + } + const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); + callbacks.push(callback); + return () => { + const index = callbacks.indexOf(callback); + if (index !== -1) + callbacks.splice(index, 1); + }; + } + /** + * @param {Partial} props + * @returns {void} + */ + $set(props) { + if (this.$$set && !is_empty(props)) { + this.$$.skip_bound = true; + this.$$set(props); + this.$$.skip_bound = false; + } + } +} +const PUBLIC_VERSION = "4"; +if (typeof window !== "undefined") + (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION); +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, [])).next()); + }); +} +function create_if_block_2$1(ctx) { + let div; + let span0; + let svg; + let path; + let span0_title_value; + let t0; + let span1; + let t1; + let mounted; + let dispose; + return { + c() { + div = element("div"); + span0 = element("span"); + svg = svg_element("svg"); + path = svg_element("path"); + t0 = space(); + span1 = element("span"); + t1 = text( + /*title*/ + ctx[5] + ); + attr(path, "d", "m6 9 6 6 6-6"); + attr(svg, "xmlns", "http://www.w3.org/2000/svg"); + attr(svg, "width", "24"); + attr(svg, "height", "24"); + attr(svg, "viewBox", "0 0 24 24"); + attr(svg, "fill", "none"); + attr(svg, "stroke", "currentColor"); + attr(svg, "stroke-width", "2"); + attr(svg, "stroke-linecap", "round"); + attr(svg, "stroke-linejoin", "round"); + attr(svg, "class", "lucide lucide-chevron-down"); + attr(span0, "role", "button"); + attr( + span0, + "data-collapsed", + /*isCollapsed*/ + ctx[7] + ); + attr(span0, "class", "collapse-button svelte-1d2sruf"); + attr(span0, "title", span0_title_value = /*isCollapsed*/ + ctx[7] ? "Expand" : "Collapse"); + attr(span1, "role", "link"); + attr(span1, "class", "clickable-link svelte-1d2sruf"); + attr( + span1, + "data-title", + /*title*/ + ctx[5] + ); + attr(div, "class", "daily-note-title inline-title svelte-1d2sruf"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, span0); + append(span0, svg); + append(svg, path); + append(div, t0); + append(div, span1); + append(span1, t1); + if (!mounted) { + dispose = [ + listen( + span0, + "click", + /*toggleCollapse*/ + ctx[10] + ), + listen( + span1, + "click", + /*handleFileIconClick*/ + ctx[8] + ) + ]; + mounted = true; + } + }, + p(ctx2, dirty) { + if (dirty & /*isCollapsed*/ + 128) { + attr( + span0, + "data-collapsed", + /*isCollapsed*/ + ctx2[7] + ); + } + if (dirty & /*isCollapsed*/ + 128 && span0_title_value !== (span0_title_value = /*isCollapsed*/ + ctx2[7] ? "Expand" : "Collapse")) { + attr(span0, "title", span0_title_value); + } + if (dirty & /*title*/ + 32) + set_data( + t1, + /*title*/ + ctx2[5] + ); + if (dirty & /*title*/ + 32) { + attr( + span1, + "data-title", + /*title*/ + ctx2[5] + ); + } + }, + d(detaching) { + if (detaching) { + detach(div); + } + mounted = false; + run_all$1(dispose); + } + }; +} +function create_if_block_1$1(ctx) { + let div; + return { + c() { + div = element("div"); + div.textContent = "Loading..."; + attr(div, "class", "editor-placeholder svelte-1d2sruf"); + }, + m(target, anchor) { + insert(target, div, anchor); + }, + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} +function create_if_block$1(ctx) { + let div; + return { + c() { + div = element("div"); + div.textContent = "Scroll to view content"; + attr(div, "class", "editor-placeholder svelte-1d2sruf"); + }, + m(target, anchor) { + insert(target, div, anchor); + }, + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} +function create_fragment$1(ctx) { + let div2; + let div1; + let t0; + let div0; + let t1; + let div2_data_id_value; + let mounted; + let dispose; + let if_block0 = ( + /*title*/ + ctx[5] && create_if_block_2$1(ctx) + ); + let if_block1 = !/*rendered*/ + ctx[3] && /*shouldRender*/ + ctx[1] && create_if_block_1$1(); + let if_block2 = !/*shouldRender*/ + ctx[1] && !/*rendered*/ + ctx[3] && create_if_block$1(); + return { + c() { + div2 = element("div"); + div1 = element("div"); + if (if_block0) + if_block0.c(); + t0 = space(); + div0 = element("div"); + if (if_block1) + if_block1.c(); + t1 = space(); + if (if_block2) + if_block2.c(); + attr(div0, "class", "daily-note-editor svelte-1d2sruf"); + attr( + div0, + "data-collapsed", + /*isCollapsed*/ + ctx[7] + ); + attr(div0, "aria-hidden", "true"); + attr( + div0, + "data-title", + /*title*/ + ctx[5] + ); + attr(div1, "class", "daily-note svelte-1d2sruf"); + attr(div2, "class", "daily-note-container"); + attr(div2, "data-id", div2_data_id_value = "dn-editor-" + /*file*/ + ctx[0].path); + set_style( + div2, + "min-height", + /*isCollapsed*/ + ctx[7] ? "auto" : ( + /*editorHeight*/ + ctx[6] + "px" + ) + ); + }, + m(target, anchor) { + insert(target, div2, anchor); + append(div2, div1); + if (if_block0) + if_block0.m(div1, null); + append(div1, t0); + append(div1, div0); + if (if_block1) + if_block1.m(div0, null); + append(div0, t1); + if (if_block2) + if_block2.m(div0, null); + ctx[13](div0); + ctx[14](div2); + if (!mounted) { + dispose = listen( + div0, + "click", + /*handleEditorClick*/ + ctx[9] + ); + mounted = true; + } + }, + p(ctx2, [dirty]) { + if ( + /*title*/ + ctx2[5] + ) { + if (if_block0) { + if_block0.p(ctx2, dirty); + } else { + if_block0 = create_if_block_2$1(ctx2); + if_block0.c(); + if_block0.m(div1, t0); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if (!/*rendered*/ + ctx2[3] && /*shouldRender*/ + ctx2[1]) { + if (if_block1) + ; + else { + if_block1 = create_if_block_1$1(); + if_block1.c(); + if_block1.m(div0, t1); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + if (!/*shouldRender*/ + ctx2[1] && !/*rendered*/ + ctx2[3]) { + if (if_block2) + ; + else { + if_block2 = create_if_block$1(); + if_block2.c(); + if_block2.m(div0, null); + } + } else if (if_block2) { + if_block2.d(1); + if_block2 = null; + } + if (dirty & /*isCollapsed*/ + 128) { + attr( + div0, + "data-collapsed", + /*isCollapsed*/ + ctx2[7] + ); + } + if (dirty & /*title*/ + 32) { + attr( + div0, + "data-title", + /*title*/ + ctx2[5] + ); + } + if (dirty & /*file*/ + 1 && div2_data_id_value !== (div2_data_id_value = "dn-editor-" + /*file*/ + ctx2[0].path)) { + attr(div2, "data-id", div2_data_id_value); + } + if (dirty & /*isCollapsed, editorHeight*/ + 192) { + set_style( + div2, + "min-height", + /*isCollapsed*/ + ctx2[7] ? "auto" : ( + /*editorHeight*/ + ctx2[6] + "px" + ) + ); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div2); + } + if (if_block0) + if_block0.d(); + if (if_block1) + if_block1.d(); + if (if_block2) + if_block2.d(); + ctx[13](null); + ctx[14](null); + mounted = false; + dispose(); + } + }; +} +function instance$1($$self, $$props, $$invalidate) { + let { file } = $$props; + let { plugin } = $$props; + let { leaf } = $$props; + let { shouldRender = true } = $$props; + let editorEl; + let containerEl; + let title; + let rendered = false; + let createdLeaf; + let unloadTimeout = null; + let editorHeight = 100; + let isDestroying = false; + let isCollapsed = false; + onMount(() => { + if (file instanceof require$$0.TFile) { + $$invalidate(5, title = file.basename); + } + }); + console.log(shouldRender, rendered); + onDestroy(() => { + isDestroying = true; + if (unloadTimeout) { + window.clearTimeout(unloadTimeout); + } + if (rendered && createdLeaf) { + unloadEditor(); + } + }); + function showEditor() { + if (!(file instanceof require$$0.TFile)) + return; + if (rendered) + return; + if (isDestroying) + return; + if (unloadTimeout) { + window.clearTimeout(unloadTimeout); + unloadTimeout = null; + } + try { + const fileName = file instanceof require$$0.TFile ? file.basename : "unknown"; + console.log(`Loading editor for ${fileName}`); + [createdLeaf] = spawnLeafView(plugin, editorEl, leaf); + createdLeaf.setPinned(true); + createdLeaf.setViewState({ + type: "markdown", + state: { + file: file.path, + mode: "source", + source: false, + backlinks: !plugin.settings.hideBacklinks, + backlinkOpts: { + collapseAll: false, + extraContext: false, + sortOrder: "alphabetical", + showSearch: false, + searchQuery: "", + backlinkCollapsed: false, + unlinkedCollapsed: true + } + } + }); + createdLeaf.parentLeaf = leaf; + $$invalidate(3, rendered = true); + const timeout = window.setTimeout( + () => { + var _a, _b, _c; + if (createdLeaf && containerEl) { + if (!(createdLeaf.view instanceof require$$0.MarkdownView)) + return; + const actualHeight = (_c = (_b = (_a = createdLeaf.view.editMode) === null || _a === void 0 ? void 0 : _a.editor) === null || _b === void 0 ? void 0 : _b.cm) === null || _c === void 0 ? void 0 : _c.dom.innerHeight; + if (actualHeight > 0) { + $$invalidate(6, editorHeight = actualHeight); + $$invalidate(4, containerEl.style.minHeight = `${editorHeight}px`, containerEl); + window.clearTimeout(timeout); + } + } + }, + 400 + ); + } catch (error) { + console.error("Error creating leaf view:", error); + } + } + function scheduleUnload() { + if (unloadTimeout) { + window.clearTimeout(unloadTimeout); + } + unloadTimeout = window.setTimeout( + () => { + if (!shouldRender && rendered) { + unloadEditor(); + } + }, + 1e3 + ); + } + function unloadEditor() { + if (!rendered || !createdLeaf) + return; + try { + const fileName = file instanceof require$$0.TFile ? file.basename : "unknown"; + console.log(`Unloading editor for ${fileName}`); + if (createdLeaf.detach) { + createdLeaf.detach(); + } + if (editorEl) { + editorEl.empty(); + } + $$invalidate(3, rendered = false); + } catch (error) { + console.error( + "Error unloading editor:", + error + ); + } + } + function handleFileIconClick() { + if (!(file instanceof require$$0.TFile)) + return; + if (leaf && !(leaf === null || leaf === void 0 ? void 0 : leaf.pinned)) { + leaf.openFile(file); + } else + plugin.app.workspace.getLeaf(false).openFile(file); + } + function handleEditorClick() { + var _a, _b; + const editor = (_b = (_a = createdLeaf === null || createdLeaf === void 0 ? void 0 : createdLeaf.view) === null || _a === void 0 ? void 0 : _a.editMode) === null || _b === void 0 ? void 0 : _b.editor; + if (editor && !editor.hasFocus()) { + editor.focus(); + } + } + function toggleCollapse() { + $$invalidate(7, isCollapsed = !isCollapsed); + } + function div0_binding($$value) { + binding_callbacks$1[$$value ? "unshift" : "push"](() => { + editorEl = $$value; + $$invalidate(2, editorEl); + }); + } + function div2_binding($$value) { + binding_callbacks$1[$$value ? "unshift" : "push"](() => { + containerEl = $$value; + $$invalidate(4, containerEl); + }); + } + $$self.$$set = ($$props2) => { + if ("file" in $$props2) + $$invalidate(0, file = $$props2.file); + if ("plugin" in $$props2) + $$invalidate(11, plugin = $$props2.plugin); + if ("leaf" in $$props2) + $$invalidate(12, leaf = $$props2.leaf); + if ("shouldRender" in $$props2) + $$invalidate(1, shouldRender = $$props2.shouldRender); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*editorEl, shouldRender, rendered*/ + 14) { + if (editorEl && shouldRender && !rendered) { + showEditor(); + } else if (editorEl && !shouldRender && rendered) { + scheduleUnload(); + } + } + }; + return [ + file, + shouldRender, + editorEl, + rendered, + containerEl, + title, + editorHeight, + isCollapsed, + handleFileIconClick, + handleEditorClick, + toggleCollapse, + plugin, + leaf, + div0_binding, + div2_binding + ]; +} +class DailyNote extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$1, create_fragment$1, safe_not_equal, { + file: 0, + plugin: 11, + leaf: 12, + shouldRender: 1 + }); + } +} +function run(fn) { + return fn(); +} +function run_all(fns) { + fns.forEach(run); +} +const dirty_components = []; +const binding_callbacks = []; +const render_callbacks = []; +const flush_callbacks = []; +const resolved_promise = Promise.resolve(); +let update_scheduled = false; +function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } +} +function tick() { + schedule_update(); + return resolved_promise; +} +function add_render_callback(fn) { + render_callbacks.push(fn); +} +const seen_callbacks = /* @__PURE__ */ new Set(); +let flushidx = 0; +function flush() { + do { + while (flushidx < dirty_components.length) { + const component = dirty_components[flushidx]; + flushidx++; + update(component.$$); + } + dirty_components.length = 0; + flushidx = 0; + while (binding_callbacks.length) + binding_callbacks.pop()(); + for (let i = 0; i < render_callbacks.length; i += 1) { + const callback = render_callbacks[i]; + if (!seen_callbacks.has(callback)) { + seen_callbacks.add(callback); + callback(); + } + } + render_callbacks.length = 0; + } while (dirty_components.length); + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + update_scheduled = false; + seen_callbacks.clear(); +} +function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + const dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } +} +const defaultOptions = { + root: null, + rootMargin: "0px", + threshold: 0, + unobserveOnEnter: false +}; +const createEvent = (name, detail) => new CustomEvent(name, { detail }); +function inview(node, options = {}) { + const { root, rootMargin, threshold, unobserveOnEnter } = Object.assign(Object.assign({}, defaultOptions), options); + let prevPos = { + x: void 0, + y: void 0 + }; + let scrollDirection = { + vertical: void 0, + horizontal: void 0 + }; + if (typeof IntersectionObserver !== "undefined" && node) { + const observer = new IntersectionObserver((entries, _observer) => { + entries.forEach((singleEntry) => { + if (prevPos.y > singleEntry.boundingClientRect.y) { + scrollDirection.vertical = "up"; + } else { + scrollDirection.vertical = "down"; + } + if (prevPos.x > singleEntry.boundingClientRect.x) { + scrollDirection.horizontal = "left"; + } else { + scrollDirection.horizontal = "right"; + } + prevPos = { + y: singleEntry.boundingClientRect.y, + x: singleEntry.boundingClientRect.x + }; + const detail = { + inView: singleEntry.isIntersecting, + entry: singleEntry, + scrollDirection, + node, + observer: _observer + }; + node.dispatchEvent(createEvent("inview_change", detail)); + node.dispatchEvent(createEvent("change", detail)); + if (singleEntry.isIntersecting) { + node.dispatchEvent(createEvent("inview_enter", detail)); + node.dispatchEvent(createEvent("enter", detail)); + unobserveOnEnter && _observer.unobserve(node); + } else { + node.dispatchEvent(createEvent("inview_leave", detail)); + node.dispatchEvent(createEvent("leave", detail)); + } + }); + }, { + root, + rootMargin, + threshold + }); + tick().then(() => { + node.dispatchEvent(createEvent("inview_init", { observer, node })); + node.dispatchEvent( + //@ts-expect-error only for backward compatibility + createEvent("init", { observer, node }) + ); + }); + observer.observe(node); + return { + destroy() { + observer.unobserve(node); + } + }; + } +} +class FileManager { + constructor(options) { + this.allFiles = []; + this.filteredFiles = []; + this.hasFetched = false; + this.hasCurrentDay = true; + this.cacheDailyNotes = {}; + this.options = options; + this.fetchFiles(); + } + /** + * Helper method to parse time field and check if it's reverse + * @param timeField The time field to parse + * @returns An object containing isReverse flag and baseTimeField + */ + parseTimeField(timeField) { + const field = timeField || "mtime"; + const isReverse = field.endsWith("Reverse"); + const baseTimeField = isReverse ? field.replace("Reverse", "") : field; + return { isReverse, baseTimeField }; + } + /** + * Helper method to sort files by time field + * @param files The files to sort + * @param timeField The time field to sort by + * @returns Sorted files + */ + sortFilesByTimeField(files, timeField) { + const { isReverse, baseTimeField } = this.parseTimeField(timeField); + return [...files].sort((a, b) => { + if (baseTimeField === "name") { + if (isReverse) { + return b.name.localeCompare(a.name); + } + return a.name.localeCompare(b.name); + } + if (isReverse) { + return a.stat[baseTimeField] - b.stat[baseTimeField]; + } + return b.stat[baseTimeField] - a.stat[baseTimeField]; + }); + } + fetchFiles() { + if (this.hasFetched) + return; + switch (this.options.mode) { + case "daily": + this.fetchDailyNotes(); + break; + case "folder": + this.fetchFolderFiles(); + break; + case "tag": + this.fetchTaggedFiles(); + break; + } + this.hasFetched = true; + this.checkDailyNote(); + this.filterFilesByRange(); + } + fetchDailyNotes() { + this.cacheDailyNotes = getAllDailyNotes_1(); + const notes = Object.values(this.cacheDailyNotes); + const { isReverse, baseTimeField } = this.parseTimeField( + this.options.timeField + ); + if (baseTimeField === "name") { + this.allFiles = [...notes].sort((a, b) => { + const result = a.name.localeCompare(b.name); + return isReverse ? -result : result; + }); + } else { + for (const string of Object.keys(this.cacheDailyNotes).sort().reverse()) { + this.allFiles.push(this.cacheDailyNotes[string]); + } + if (baseTimeField !== "ctime" && baseTimeField !== "mtime") { + this.allFiles = this.sortFilesByTimeField( + this.allFiles, + this.options.timeField + ); + } + } + } + fetchFolderFiles() { + if (!this.options.target || !this.options.app) + return; + const allFiles = this.options.app.vault.getMarkdownFiles(); + this.allFiles = allFiles.filter((file) => { + var _a; + const folderPath = ((_a = file.parent) == null ? void 0 : _a.path) || ""; + return folderPath === this.options.target || folderPath.startsWith(this.options.target + "/"); + }); + this.allFiles = this.sortFilesByTimeField( + this.allFiles, + this.options.timeField + ); + } + fetchTaggedFiles() { + if (!this.options.target || !this.options.app) + return; + const allFiles = this.options.app.vault.getMarkdownFiles(); + const targetTag = this.options.target.startsWith("#") ? this.options.target : "#" + this.options.target; + this.allFiles = allFiles.filter((file) => { + var _a; + const fileCache = (_a = this.options.app) == null ? void 0 : _a.metadataCache.getFileCache(file); + if (!fileCache || !fileCache.tags) + return false; + return fileCache.tags.some((tag) => tag.tag === targetTag); + }); + this.allFiles = this.sortFilesByTimeField( + this.allFiles, + this.options.timeField + ); + } + filterFilesByRange() { + if (!this.options.timeRange) { + this.filteredFiles = [...this.allFiles]; + return this.filteredFiles; + } + this.filteredFiles = []; + if (this.options.timeRange === "all") { + this.filteredFiles = [...this.allFiles]; + return this.filteredFiles; + } + if (this.options.mode === "daily") { + this.filterDailyNotesByRange(); + } else { + this.filterFilesByTimeRange(); + } + return this.filteredFiles; + } + /** + * Filter files by time range + * Applicable to folder and tag modes + */ + filterFilesByTimeRange() { + const now = require$$0.moment(); + const { isReverse, baseTimeField } = this.parseTimeField( + this.options.timeField + ); + this.filteredFiles = this.allFiles.filter((file) => { + const fileDate = require$$0.moment(file.stat[baseTimeField]); + return this.isDateInRange(fileDate, now); + }); + if (isReverse) { + this.filteredFiles.reverse(); + } + } + /** + * Filter daily notes by date + * Applicable to daily mode + */ + filterDailyNotesByRange() { + const now = require$$0.moment(); + const fileFormat = getDailyNoteSettings_1().format || DEFAULT_DAILY_NOTE_FORMAT_1; + this.filteredFiles = this.allFiles.filter((file) => { + const fileDate = require$$0.moment(file.basename, fileFormat); + return this.isDateInRange(fileDate, now); + }); + } + /** + * Check if the file date is in the range + * @param fileDate file date + * @param now current date + * @returns whether in the range + */ + isDateInRange(fileDate, now) { + switch (this.options.timeRange) { + case "week": + return fileDate.isSame(now, "week"); + case "month": + return fileDate.isSame(now, "month"); + case "year": + return fileDate.isSame(now, "year"); + case "last-week": + return fileDate.isBetween( + require$$0.moment().subtract(1, "week").startOf("week"), + require$$0.moment().subtract(1, "week").endOf("week"), + null, + "[]" + ); + case "last-month": + return fileDate.isBetween( + require$$0.moment().subtract(1, "month").startOf("month"), + require$$0.moment().subtract(1, "month").endOf("month"), + null, + "[]" + ); + case "last-year": + return fileDate.isBetween( + require$$0.moment().subtract(1, "year").startOf("year"), + require$$0.moment().subtract(1, "year").endOf("year"), + null, + "[]" + ); + case "quarter": + return fileDate.isSame(now, "quarter"); + case "last-quarter": + return fileDate.isBetween( + require$$0.moment().subtract(1, "quarter").startOf("quarter"), + require$$0.moment().subtract(1, "quarter").endOf("quarter"), + null, + "[]" + ); + case "custom": + if (this.options.customRange) { + const startDate = require$$0.moment(this.options.customRange.start); + const endDate = require$$0.moment(this.options.customRange.end); + return fileDate.isBetween(startDate, endDate, null, "[]"); + } + return false; + default: + return true; + } + } + checkDailyNote() { + if (this.options.mode !== "daily") { + this.hasCurrentDay = true; + return true; + } + this.cacheDailyNotes = getAllDailyNotes_1(); + const currentDate = require$$0.moment(); + const currentDailyNote = getDailyNote_1( + currentDate, + this.cacheDailyNotes + ); + if (!currentDailyNote) { + this.hasCurrentDay = false; + return false; + } + if (this.hasCurrentDay === false) { + this.allFiles = []; + this.fetchDailyNotes(); + this.filterFilesByRange(); + } + this.hasCurrentDay = true; + return true; + } + async createNewDailyNote() { + if (this.options.mode !== "daily" || this.hasCurrentDay) { + return null; + } + const currentDate = require$$0.moment(); + const currentDailyNote = await createDailyNote_1(currentDate); + if (currentDailyNote) { + this.allFiles.push(currentDailyNote); + this.allFiles = this.sortDailyNotes(this.allFiles); + this.hasCurrentDay = true; + this.filterFilesByRange(); + return currentDailyNote; + } + return null; + } + fileCreate(file) { + if (this.options.mode === "daily") { + this.handleDailyNoteCreate(file); + } else if (this.options.mode === "folder") { + this.handleFolderFileCreate(file); + } else if (this.options.mode === "tag") { + this.handleTaggedFileCreate(file); + } + } + handleDailyNoteCreate(file) { + const fileDate = getDateFromFile_1(file, "day"); + const fileFormat = getDailyNoteSettings_1().format || DEFAULT_DAILY_NOTE_FORMAT_1; + if (!fileDate) + return; + if (this.filteredFiles.length === 0) { + this.allFiles.push(file); + this.allFiles = this.sortDailyNotes(this.allFiles); + this.filterFilesByRange(); + return; + } + const lastFilteredFile = this.filteredFiles[this.filteredFiles.length - 1]; + const firstFilteredFile = this.filteredFiles[0]; + const lastFilteredFileDate = require$$0.moment( + lastFilteredFile.basename, + fileFormat + ); + const firstFilteredFileDate = require$$0.moment( + firstFilteredFile.basename, + fileFormat + ); + if (fileDate.isBetween(lastFilteredFileDate, firstFilteredFileDate)) { + this.filteredFiles.push(file); + this.filteredFiles = this.sortDailyNotes(this.filteredFiles); + } else if (fileDate.isBefore(lastFilteredFileDate)) { + this.allFiles.push(file); + this.allFiles = this.sortDailyNotes(this.allFiles); + this.filterFilesByRange(); + } else if (fileDate.isAfter(firstFilteredFileDate)) { + this.filteredFiles.push(file); + this.filteredFiles = this.sortDailyNotes(this.filteredFiles); + } + if (fileDate.isSame(require$$0.moment(), "day")) + this.hasCurrentDay = true; + } + handleFolderFileCreate(file) { + var _a; + if (!this.options.target) + return; + const folderPath = ((_a = file.parent) == null ? void 0 : _a.path) || ""; + if (folderPath === this.options.target || folderPath.startsWith(this.options.target + "/")) { + this.allFiles.push(file); + this.allFiles = this.sortFilesByTimeField( + this.allFiles, + this.options.timeField + ); + this.filterFilesByRange(); + } + } + handleTaggedFileCreate(file) { + if (!this.options.target || !this.options.app) + return; + const targetTag = this.options.target.startsWith("#") ? this.options.target : "#" + this.options.target; + const fileCache = this.options.app.metadataCache.getFileCache(file); + if (!fileCache || !fileCache.tags) + return; + if (fileCache.tags.some((tag) => tag.tag === targetTag)) { + this.allFiles.push(file); + this.allFiles = this.sortFilesByTimeField( + this.allFiles, + this.options.timeField + ); + this.filterFilesByRange(); + } + } + fileDelete(file) { + if (this.options.mode === "daily" && getDateFromFile_1(file, "day")) { + this.filteredFiles = this.filteredFiles.filter((f) => { + return f.basename !== file.basename; + }); + this.allFiles = this.allFiles.filter((f) => { + return f.basename !== file.basename; + }); + this.filterFilesByRange(); + this.checkDailyNote(); + } else { + this.filteredFiles = this.filteredFiles.filter((f) => { + return f.basename !== file.basename; + }); + this.allFiles = this.allFiles.filter((f) => { + return f.basename !== file.basename; + }); + } + } + sortDailyNotes(notes) { + const { isReverse, baseTimeField } = this.parseTimeField( + this.options.timeField + ); + if (baseTimeField === "name") { + return [...notes].sort((a, b) => { + if (isReverse) { + return b.name.localeCompare(a.name); + } + return a.name.localeCompare(b.name); + }); + } + return this.sortFilesByTimeField(notes, this.options.timeField); + } + getAllFiles() { + return this.allFiles; + } + getFilteredFiles() { + return this.filteredFiles; + } + hasCurrentDayNote() { + return this.hasCurrentDay; + } + updateOptions(options) { + this.options = { ...this.options, ...options }; + if (options.timeRange || options.customRange) { + this.filterFilesByRange(); + } + if (options.mode || options.target) { + this.allFiles = []; + this.filteredFiles = []; + this.hasFetched = false; + this.fetchFiles(); + } + } +} +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[29] = list[i]; + return child_ctx; +} +function create_if_block_2(ctx) { + let div1; + return { + c() { + div1 = element("div"); + div1.innerHTML = `
No files found
`; + attr(div1, "class", "dn-stock svelte-4q3cv7"); + }, + m(target, anchor) { + insert(target, div1, anchor); + }, + d(detaching) { + if (detaching) { + detach(div1); + } + } + }; +} +function create_if_block_1(ctx) { + let div1; + let mounted; + let dispose; + return { + c() { + div1 = element("div"); + div1.innerHTML = `
Create a daily note for today ✍
`; + attr(div1, "class", "dn-blank-day svelte-4q3cv7"); + attr(div1, "aria-hidden", "true"); + }, + m(target, anchor) { + insert(target, div1, anchor); + if (!mounted) { + dispose = listen( + div1, + "click", + /*createNewDailyNote*/ + ctx[12] + ); + mounted = true; + } + }, + p: noop, + d(detaching) { + if (detaching) { + detach(div1); + } + mounted = false; + dispose(); + } + }; +} +function create_each_block(key_1, ctx) { + let div; + let dailynote; + let inview_action; + let current; + let mounted; + let dispose; + dailynote = new DailyNote({ + props: { + file: ( + /*file*/ + ctx[29] + ), + plugin: ( + /*plugin*/ + ctx[0] + ), + leaf: ( + /*leaf*/ + ctx[1] + ), + shouldRender: ( + /*visibleNotes*/ + ctx[4].has( + /*file*/ + ctx[29].path + ) + ) + } + }); + function inview_change_handler(...args) { + return ( + /*inview_change_handler*/ + ctx[22]( + /*file*/ + ctx[29], + ...args + ) + ); + } + return { + key: key_1, + first: null, + c() { + div = element("div"); + create_component(dailynote.$$.fragment); + attr(div, "class", "daily-note-wrapper svelte-4q3cv7"); + this.first = div; + }, + m(target, anchor) { + insert(target, div, anchor); + mount_component(dailynote, div, null); + current = true; + if (!mounted) { + dispose = [ + action_destroyer(inview_action = inview.call(null, div, { + rootMargin: "80%", + unobserveOnEnter: false, + root: ( + /*leaf*/ + ctx[1].view.contentEl + ) + })), + listen(div, "inview_change", inview_change_handler) + ]; + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + const dailynote_changes = {}; + if (dirty[0] & /*renderedFiles*/ + 64) + dailynote_changes.file = /*file*/ + ctx[29]; + if (dirty[0] & /*plugin*/ + 1) + dailynote_changes.plugin = /*plugin*/ + ctx[0]; + if (dirty[0] & /*leaf*/ + 2) + dailynote_changes.leaf = /*leaf*/ + ctx[1]; + if (dirty[0] & /*visibleNotes, renderedFiles*/ + 80) + dailynote_changes.shouldRender = /*visibleNotes*/ + ctx[4].has( + /*file*/ + ctx[29].path + ); + dailynote.$set(dailynote_changes); + if (inview_action && is_function(inview_action.update) && dirty[0] & /*leaf*/ + 2) + inview_action.update.call(null, { + rootMargin: "80%", + unobserveOnEnter: false, + root: ( + /*leaf*/ + ctx[1].view.contentEl + ) + }); + }, + i(local) { + if (current) + return; + transition_in(dailynote.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(dailynote.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_component(dailynote); + mounted = false; + run_all$1(dispose); + } + }; +} +function create_if_block(ctx) { + let div; + return { + c() { + div = element("div"); + div.textContent = "—— No more of results ——"; + attr(div, "class", "no-more-text svelte-4q3cv7"); + }, + m(target, anchor) { + insert(target, div, anchor); + }, + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} +function create_fragment(ctx) { + var _a; + let div1; + let t0; + let show_if = ( + /*selectionMode*/ + ctx[3] === "daily" && !/*fileManager*/ + ((_a = ctx[5]) == null ? void 0 : _a.hasCurrentDayNote()) && /*selectedRange*/ + (ctx[2] === "all" || /*selectedRange*/ + ctx[2] === "week" || /*selectedRange*/ + ctx[2] === "month" || /*selectedRange*/ + ctx[2] === "year" || /*selectedRange*/ + ctx[2] === "quarter") + ); + let t1; + let each_blocks = []; + let each_1_lookup = /* @__PURE__ */ new Map(); + let t2; + let div0; + let inview_action; + let t3; + let current; + let mounted; + let dispose; + let if_block0 = ( + /*renderedFiles*/ + ctx[6].length === 0 && create_if_block_2() + ); + let if_block1 = show_if && create_if_block_1(ctx); + let each_value = ensure_array_like( + /*renderedFiles*/ + ctx[6] + ); + const get_key = (ctx2) => ( + /*file*/ + ctx2[29].path + ); + for (let i = 0; i < each_value.length; i += 1) { + let child_ctx = get_each_context(ctx, each_value, i); + let key = get_key(child_ctx); + each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx)); + } + let if_block2 = !/*hasMore*/ + ctx[7] && create_if_block(); + return { + c() { + div1 = element("div"); + if (if_block0) + if_block0.c(); + t0 = space(); + if (if_block1) + if_block1.c(); + t1 = space(); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + t2 = space(); + div0 = element("div"); + t3 = space(); + if (if_block2) + if_block2.c(); + attr(div0, "class", "dn-view-loader"); + attr(div1, "class", "daily-note-view"); + }, + m(target, anchor) { + insert(target, div1, anchor); + if (if_block0) + if_block0.m(div1, null); + append(div1, t0); + if (if_block1) + if_block1.m(div1, null); + append(div1, t1); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div1, null); + } + } + append(div1, t2); + append(div1, div0); + ctx[23](div0); + append(div1, t3); + if (if_block2) + if_block2.m(div1, null); + current = true; + if (!mounted) { + dispose = [ + action_destroyer(inview_action = inview.call(null, div0, { root: ( + /*leaf*/ + ctx[1].view.containerEl + ) })), + listen( + div0, + "inview_init", + /*startFillViewport*/ + ctx[9] + ), + listen( + div0, + "inview_change", + /*infiniteHandler*/ + ctx[11] + ), + listen( + div0, + "inview_leave", + /*stopFillViewport*/ + ctx[10] + ) + ]; + mounted = true; + } + }, + p(ctx2, dirty) { + var _a2; + if ( + /*renderedFiles*/ + ctx2[6].length === 0 + ) { + if (if_block0) + ; + else { + if_block0 = create_if_block_2(); + if_block0.c(); + if_block0.m(div1, t0); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if (dirty[0] & /*selectionMode, fileManager, selectedRange*/ + 44) + show_if = /*selectionMode*/ + ctx2[3] === "daily" && !/*fileManager*/ + ((_a2 = ctx2[5]) == null ? void 0 : _a2.hasCurrentDayNote()) && /*selectedRange*/ + (ctx2[2] === "all" || /*selectedRange*/ + ctx2[2] === "week" || /*selectedRange*/ + ctx2[2] === "month" || /*selectedRange*/ + ctx2[2] === "year" || /*selectedRange*/ + ctx2[2] === "quarter"); + if (show_if) { + if (if_block1) { + if_block1.p(ctx2, dirty); + } else { + if_block1 = create_if_block_1(ctx2); + if_block1.c(); + if_block1.m(div1, t1); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + if (dirty[0] & /*leaf, handleNoteVisibilityChange, renderedFiles, plugin, visibleNotes*/ + 8275) { + each_value = ensure_array_like( + /*renderedFiles*/ + ctx2[6] + ); + group_outros(); + each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, div1, outro_and_destroy_block, create_each_block, t2, get_each_context); + check_outros(); + } + if (inview_action && is_function(inview_action.update) && dirty[0] & /*leaf*/ + 2) + inview_action.update.call(null, { root: ( + /*leaf*/ + ctx2[1].view.containerEl + ) }); + if (!/*hasMore*/ + ctx2[7]) { + if (if_block2) + ; + else { + if_block2 = create_if_block(); + if_block2.c(); + if_block2.m(div1, null); + } + } else if (if_block2) { + if_block2.d(1); + if_block2 = null; + } + }, + i(local) { + if (current) + return; + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + current = true; + }, + o(local) { + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + current = false; + }, + d(detaching) { + if (detaching) { + detach(div1); + } + if (if_block0) + if_block0.d(); + if (if_block1) + if_block1.d(); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].d(); + } + ctx[23](null); + if (if_block2) + if_block2.d(); + mounted = false; + run_all$1(dispose); + } + }; +} +const size = 1; +function instance($$self, $$props, $$invalidate) { + let fileManagerOptions; + let { plugin } = $$props; + let { leaf } = $$props; + let { selectedRange = "all" } = $$props; + let { customRange = null } = $$props; + let { selectionMode = "daily" } = $$props; + let { target = "" } = $$props; + let { timeField = "mtime" } = $$props; + let intervalId; + let renderedFiles = []; + let filteredFiles = []; + let visibleNotes = /* @__PURE__ */ new Set(); + let hasMore = true; + let firstLoaded = true; + let loaderRef; + let fileManager; + onMount(() => { + $$invalidate(5, fileManager = new FileManager(fileManagerOptions)); + $$invalidate(21, filteredFiles = fileManager.getFilteredFiles()); + $$invalidate(7, hasMore = filteredFiles.length > 0); + startFillViewport(); + updateTitleElement(); + }); + function updateTitleElement() { + if (!leaf || !leaf.view || !leaf.view.titleEl) + return; + const titleEl = leaf.view.titleEl; + titleEl.empty(); + let titleText = ""; + if (selectionMode === "daily" && selectedRange !== "all") { + if (selectedRange === "custom" && customRange) { + titleText = `Showing notes from: ${require$$0.moment(customRange.start).format("YYYY-MM-DD")} to ${require$$0.moment(customRange.end).format("YYYY-MM-DD")}`; + } else { + titleText = `Showing notes for: ${selectedRange}`; + } + } else if (selectionMode === "folder") { + titleText = `Showing files from folder: ${target}`; + if (selectedRange !== "all") { + titleText += ` (${timeField === "ctime" ? "created" : "modified"} ${selectedRange})`; + } + } else if (selectionMode === "tag") { + titleText = `Showing files with tag: ${target}`; + if (selectedRange !== "all") { + titleText += ` (${timeField === "ctime" ? "created" : "modified"} ${selectedRange})`; + } + } + if (titleText) { + titleEl.setText(titleText); + } else { + titleEl.setText("Daily Notes"); + } + } + function startFillViewport() { + if (!intervalId) { + intervalId = setInterval(infiniteHandler, 1); + } + } + function stopFillViewport() { + clearInterval(intervalId); + intervalId = null; + } + function infiniteHandler() { + if (leaf.height === 0) + return; + if (!fileManager || !hasMore) + return; + if (filteredFiles.length === 0) { + $$invalidate(7, hasMore = false); + } else { + $$invalidate(6, renderedFiles = [...renderedFiles, ...filteredFiles.splice(0, size)]); + if (firstLoaded) { + window.setTimeout( + () => { + ensureViewFilled(); + firstLoaded = false; + }, + 100 + ); + } + } + } + function ensureViewFilled() { + if (!loaderRef) + return; + const loaderRect = loaderRef.getBoundingClientRect(); + const viewportHeight = window.innerHeight; + const contentHeight = leaf.view.contentEl.clientHeight || leaf.view.contentEl.innerHeight || viewportHeight; + const effectiveHeight = Math.max(viewportHeight, contentHeight) + 200; + if (loaderRect.top < effectiveHeight) { + infiniteHandler(); + window.setTimeout( + () => { + if (hasMore && loaderRef && loaderRef.getBoundingClientRect().top < effectiveHeight) { + ensureViewFilled(); + } + }, + 50 + ); + } + } + function createNewDailyNote() { + return __awaiter(this, void 0, void 0, function* () { + const newNote = yield fileManager.createNewDailyNote(); + if (newNote) { + $$invalidate(6, renderedFiles = [newNote, ...renderedFiles]); + visibleNotes.add(newNote.path); + $$invalidate(4, visibleNotes); + } + }); + } + function tick2() { + check(); + $$invalidate(6, renderedFiles), $$invalidate(5, fileManager), $$invalidate(2, selectedRange), $$invalidate(14, customRange), $$invalidate(3, selectionMode), $$invalidate(15, target), $$invalidate(16, timeField), $$invalidate(4, visibleNotes), $$invalidate(21, filteredFiles); + } + function check() { + const hadDailyNote = fileManager.hasCurrentDayNote(); + fileManager.checkDailyNote(); + const hasDailyNote = fileManager.hasCurrentDayNote(); + if (hadDailyNote !== hasDailyNote || selectionMode === "daily" && selectedRange !== "all") { + $$invalidate(21, filteredFiles = fileManager.getFilteredFiles()); + if (selectionMode === "daily") { + $$invalidate(6, renderedFiles = []); + visibleNotes.clear(); + $$invalidate(7, hasMore = filteredFiles.length > 0); + firstLoaded = true; + startFillViewport(); + } + } + } + function fileCreate(file) { + fileManager.fileCreate(file); + if (selectionMode === "daily") { + const filteredFiles2 = fileManager.getFilteredFiles(); + if (filteredFiles2.some((f) => f.basename === file.basename) && !renderedFiles.some((f) => f.basename === file.basename)) { + $$invalidate(6, renderedFiles = [file, ...renderedFiles]); + visibleNotes.add(file.path); + $$invalidate(4, visibleNotes); + } + } else { + $$invalidate(6, renderedFiles = fileManager.getFilteredFiles().slice(0, renderedFiles.length)); + } + } + function fileDelete(file) { + fileManager.fileDelete(file); + $$invalidate(6, renderedFiles = renderedFiles.filter((dailyNote) => { + return dailyNote.basename !== file.basename; + })); + if (visibleNotes.has(file.path)) { + visibleNotes.delete(file.path); + $$invalidate(4, visibleNotes); + } + } + function handleNoteVisibilityChange(file, isVisible) { + console.log("inview", isVisible); + if (isVisible) { + visibleNotes.add(file.path); + } else { + visibleNotes.delete(file.path); + } + $$invalidate(4, visibleNotes); + } + const inview_change_handler = (file, { detail }) => handleNoteVisibilityChange(file, detail.inView); + function div0_binding($$value) { + binding_callbacks$1[$$value ? "unshift" : "push"](() => { + loaderRef = $$value; + $$invalidate(8, loaderRef); + }); + } + $$self.$$set = ($$props2) => { + if ("plugin" in $$props2) + $$invalidate(0, plugin = $$props2.plugin); + if ("leaf" in $$props2) + $$invalidate(1, leaf = $$props2.leaf); + if ("selectedRange" in $$props2) + $$invalidate(2, selectedRange = $$props2.selectedRange); + if ("customRange" in $$props2) + $$invalidate(14, customRange = $$props2.customRange); + if ("selectionMode" in $$props2) + $$invalidate(3, selectionMode = $$props2.selectionMode); + if ("target" in $$props2) + $$invalidate(15, target = $$props2.target); + if ("timeField" in $$props2) + $$invalidate(16, timeField = $$props2.timeField); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty[0] & /*selectionMode, target, selectedRange, customRange, plugin, timeField*/ + 114701) { + fileManagerOptions = { + mode: selectionMode, + target, + timeRange: selectedRange, + customRange, + app: plugin.app, + timeField + }; + } + if ($$self.$$.dirty[0] & /*fileManager, selectedRange, customRange, selectionMode, target, timeField, visibleNotes, filteredFiles*/ + 2211900) { + if (fileManager && (selectedRange !== fileManager.options.timeRange || customRange !== fileManager.options.customRange || selectionMode !== fileManager.options.mode || target !== fileManager.options.target || timeField !== fileManager.options.timeField)) { + fileManager.updateOptions({ + timeRange: selectedRange, + customRange, + mode: selectionMode, + target, + timeField + }); + $$invalidate(6, renderedFiles = []); + visibleNotes.clear(); + $$invalidate(21, filteredFiles = fileManager.getFilteredFiles()); + $$invalidate(7, hasMore = filteredFiles.length > 0); + firstLoaded = true; + startFillViewport(); + updateTitleElement(); + } + } + }; + return [ + plugin, + leaf, + selectedRange, + selectionMode, + visibleNotes, + fileManager, + renderedFiles, + hasMore, + loaderRef, + startFillViewport, + stopFillViewport, + infiniteHandler, + createNewDailyNote, + handleNoteVisibilityChange, + customRange, + target, + timeField, + tick2, + check, + fileCreate, + fileDelete, + filteredFiles, + inview_change_handler, + div0_binding + ]; +} +class DailyNoteEditorView extends SvelteComponent { + constructor(options) { + super(); + init( + this, + options, + instance, + create_fragment, + safe_not_equal, + { + plugin: 0, + leaf: 1, + selectedRange: 2, + customRange: 14, + selectionMode: 3, + target: 15, + timeField: 16, + tick: 17, + check: 18, + fileCreate: 19, + fileDelete: 20 + }, + null, + [-1, -1] + ); + } + get tick() { + return this.$$.ctx[17]; + } + get check() { + return this.$$.ctx[18]; + } + get fileCreate() { + return this.$$.ctx[19]; + } + get fileDelete() { + return this.$$.ctx[20]; + } +} +const DAILY_NOTE_VIEW_TYPE = "daily-note-editor-view"; +class DailyNoteView extends require$$0.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.selectedDaysRange = "all"; + this.selectionMode = "daily"; + this.target = ""; + this.timeField = "mtime"; + this.customRange = null; + this.getMode = () => { + return "source"; + }; + this.onFileCreate = (file) => { + if (file instanceof require$$0.TFile) + this.view.fileCreate(file); + }; + this.onFileDelete = (file) => { + if (file instanceof require$$0.TFile) + this.view.fileDelete(file); + }; + this.plugin = plugin; + this.scope = new require$$0.Scope(plugin.app.scope); + } + getViewType() { + return DAILY_NOTE_VIEW_TYPE; + } + getDisplayText() { + if (this.selectionMode === "daily") { + return "Daily Notes"; + } else if (this.selectionMode === "folder") { + return `Folder: ${this.target}`; + } else if (this.selectionMode === "tag") { + return `Tag: ${this.target}`; + } + return "Notes"; + } + getIcon() { + if (this.selectionMode === "daily") { + return "calendar"; + } else if (this.selectionMode === "folder") { + return "folder"; + } else if (this.selectionMode === "tag") { + return "tag"; + } + return "document"; + } + setSelectedRange(range) { + this.selectedDaysRange = range; + if (this.view) { + if (range === "custom") { + this.view.$set({ + selectedRange: range, + customRange: this.customRange + }); + } else { + this.view.$set({ selectedRange: range }); + } + } + } + setSelectionMode(mode, target = "") { + this.selectionMode = mode; + this.target = target; + if (this.view) { + this.view.$set({ + selectionMode: mode, + target + }); + } + } + saveCurrentSelectionAsPreset() { + if (this.selectionMode !== "daily" && this.target) { + const existingPresetIndex = this.plugin.settings.preset.findIndex( + (p) => p.type === this.selectionMode && p.target === this.target + ); + if (existingPresetIndex === -1) { + this.plugin.settings.preset.push({ + type: this.selectionMode, + target: this.target + }); + this.plugin.saveSettings(); + } + } + } + getState() { + const state2 = super.getState(); + return { + ...state2, + selectionMode: this.selectionMode, + target: this.target, + timeField: this.timeField, + selectedRange: this.selectedDaysRange, + customRange: this.customRange + }; + } + async setState(state2, result) { + await super.setState(state2, result); + if (state2 && typeof state2 === "object" && !this.view) { + const customState = state2; + if (customState.selectionMode) + this.selectionMode = customState.selectionMode; + if (customState.target) + this.target = customState.target; + if (customState.timeField) + this.timeField = customState.timeField; + if (customState.selectedRange) + this.selectedDaysRange = customState.selectedRange; + if (customState.customRange) + this.customRange = customState.customRange; + this.view = new DailyNoteEditorView({ + target: this.contentEl, + props: { + plugin: this.plugin, + leaf: this.leaf, + selectedRange: this.selectedDaysRange, + customRange: this.customRange, + selectionMode: this.selectionMode, + target: this.target, + timeField: this.timeField + } + }); + this.app.workspace.onLayoutReady(this.view.tick.bind(this)); + this.registerInterval( + window.setInterval(async () => { + this.view.check(); + }, 1e3 * 60 * 60) + ); + } + } + setTimeField(field) { + this.timeField = field; + if (this.view) { + this.view.$set({ timeField: field }); + } + } + openDailyNoteEditor() { + this.plugin.openDailyNoteEditor(); + } + async onOpen() { + this.scope.register(["Mod"], "f", (e) => { + }); + this.addAction("clock", "Select time field", (e) => { + const menu = new require$$0.Menu(); + const addTimeFieldOption = (title, field) => { + menu.addItem((item) => { + item.setTitle(title); + item.setChecked(this.timeField === field); + item.onClick(() => { + this.setTimeField(field); + }); + }); + }; + addTimeFieldOption("Creation Time", "ctime"); + addTimeFieldOption("Modification Time", "mtime"); + addTimeFieldOption("Creation Time (Reverse)", "ctimeReverse"); + addTimeFieldOption("Modification Time (Reverse)", "mtimeReverse"); + addTimeFieldOption("Name (A-Z)", "name"); + addTimeFieldOption("Name (Z-A)", "nameReverse"); + menu.showAtMouseEvent(e); + }); + this.addAction("layers-2", "Select view mode", (e) => { + const menu = new require$$0.Menu(); + const addModeOption = (title, mode) => { + menu.addItem((item) => { + item.setTitle(title); + item.setChecked( + this.selectionMode === mode && !this.target + ); + item.onClick(() => { + if (mode === "daily") { + this.setSelectionMode(mode); + } else { + const modal = new SelectTargetModal( + this.plugin.app, + mode, + (target) => { + this.setSelectionMode(mode, target); + this.saveCurrentSelectionAsPreset(); + } + ); + modal.open(); + } + }); + }); + }; + addModeOption("Daily Notes", "daily"); + addModeOption("Folder", "folder"); + addModeOption("Tag", "tag"); + if (this.plugin.settings.preset.length > 0) { + menu.addSeparator(); + menu.addItem((item) => { + item.setTitle("Saved Presets"); + item.setDisabled(true); + }); + for (const preset of this.plugin.settings.preset) { + const title = preset.type === "folder" ? `Folder: ${preset.target}` : `Tag: ${preset.target}`; + menu.addItem((item) => { + item.setTitle(title); + item.setChecked( + this.selectionMode === preset.type && this.target === preset.target + ); + item.onClick(() => { + this.setSelectionMode(preset.type, preset.target); + }); + }); + } + } + menu.showAtMouseEvent(e); + }); + this.addAction("calendar-range", "Select date range", (e) => { + const menu = new require$$0.Menu(); + const addRangeOption = (title, range) => { + menu.addItem((item) => { + item.setTitle(title); + item.setChecked(this.selectedDaysRange === range); + item.onClick(() => { + this.setSelectedRange(range); + }); + }); + }; + addRangeOption("All Notes", "all"); + addRangeOption("This Week", "week"); + addRangeOption("This Month", "month"); + addRangeOption("This Year", "year"); + addRangeOption("Last Week", "last-week"); + addRangeOption("Last Month", "last-month"); + addRangeOption("Last Year", "last-year"); + addRangeOption("This Quarter", "quarter"); + addRangeOption("Last Quarter", "last-quarter"); + menu.addSeparator(); + menu.addItem((item) => { + item.setTitle("Custom Date Range"); + item.setChecked(this.selectedDaysRange === "custom"); + item.onClick(() => { + const modal = new CustomRangeModal(this.app, (range) => { + this.customRange = range; + this.setSelectedRange("custom"); + }); + modal.open(); + }); + }); + menu.showAtMouseEvent(e); + }); + this.addAction("refresh", "Refresh", () => { + if (this.view) { + this.view.check(); + this.view.tick(); + this.view.$set({ + selectedRange: this.selectedDaysRange, + customRange: this.customRange + }); + } + }); + this.app.vault.on("create", this.onFileCreate); + this.app.vault.on("delete", this.onFileDelete); + } + onPaneMenu(menu, source) { + if (source === "tab-header" || source === "more-options") { + menu.addItem((item) => { + item.setIcon(this.leaf.pinned ? "pin-off" : "pin"); + item.setTitle(this.leaf.pinned ? "Unpin" : "Pin"); + item.onClick(() => { + this.leaf.togglePinned(); + }); + }); + } + } + /** + * Refresh the view for a new day + * This is called when the date changes (e.g., after midnight) + */ + refreshForNewDay() { + if (this.selectionMode === "daily") { + if (this.view) { + this.view.check(); + this.view.tick(); + this.view.$set({ + selectedRange: this.selectedDaysRange, + customRange: this.customRange + }); + } + } + } +} +class CustomRangeModal extends require$$0.Modal { + constructor(app2, saveCallback) { + super(app2); + this.saveCallback = saveCallback; + this.startDate = /* @__PURE__ */ new Date(); + this.endDate = /* @__PURE__ */ new Date(); + } + onOpen() { + const { contentEl } = this; + contentEl.createEl("h2", { text: "Select Custom Date Range" }); + const startDateContainer = contentEl.createEl("div", { + cls: "custom-range-date-container" + }); + startDateContainer.createEl("span", { text: "Start Date: " }); + const startDatePicker = startDateContainer.createEl("input", { + type: "date", + value: this.formatDate(this.startDate) + }); + startDatePicker.addEventListener("change", (e) => { + this.startDate = new Date(e.target.value); + }); + const endDateContainer = contentEl.createEl("div", { + cls: "custom-range-date-container" + }); + endDateContainer.createEl("span", { text: "End Date: " }); + const endDatePicker = endDateContainer.createEl("input", { + type: "date", + value: this.formatDate(this.endDate) + }); + endDatePicker.addEventListener("change", (e) => { + this.endDate = new Date(e.target.value); + }); + const buttonContainer = contentEl.createEl("div", { + cls: "custom-range-button-container" + }); + new require$$0.ButtonComponent(buttonContainer).setButtonText("Cancel").onClick(() => { + this.close(); + }); + new require$$0.ButtonComponent(buttonContainer).setButtonText("Confirm").setCta().onClick(() => { + this.saveCallback({ + start: this.startDate, + end: this.endDate + }); + this.close(); + }); + } + formatDate(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, "0"); + const day = String(date.getDate()).padStart(2, "0"); + return `${year}-${month}-${day}`; + } + onClose() { + this.contentEl.empty(); + } +} +class SelectTargetModal extends require$$0.Modal { + constructor(app2, mode, saveCallback) { + super(app2); + this.mode = mode; + this.saveCallback = saveCallback; + } + onOpen() { + const { contentEl } = this; + contentEl.empty(); + contentEl.createEl("h2", { + text: this.mode === "folder" ? "Select Folder" : "Select Tag" + }); + const form = contentEl.createEl("form"); + form.addEventListener("submit", (e) => { + e.preventDefault(); + this.save(); + }); + const targetSetting = form.createDiv(); + targetSetting.addClass("setting-item"); + const targetSettingInfo = targetSetting.createDiv(); + targetSettingInfo.addClass("setting-item-info"); + targetSettingInfo.createEl("div", { + text: this.mode === "folder" ? "Folder Path" : "Tag Name", + cls: "setting-item-name" + }); + targetSettingInfo.createEl("div", { + text: this.mode === "folder" ? "Enter the path to the folder (e.g., 'folder/subfolder')" : "Enter the tag name without the '#' (e.g., 'tag')", + cls: "setting-item-description" + }); + const targetSettingControl = targetSetting.createDiv(); + targetSettingControl.addClass("setting-item-control"); + this.targetInput = targetSettingControl.createEl("input", { + type: "text", + value: "" + }); + this.targetInput.addClass("target-input"); + const footerEl = contentEl.createDiv(); + footerEl.addClass("modal-button-container"); + footerEl.createEl("button", { + text: "Cancel", + cls: "mod-warning", + attr: { + type: "button" + } + }).addEventListener("click", () => { + this.close(); + }); + footerEl.createEl("button", { + text: "Save", + cls: "mod-cta", + attr: { + type: "submit" + } + }).addEventListener("click", (e) => { + e.preventDefault(); + this.save(); + }); + } + save() { + const target = this.targetInput.value.trim(); + if (target) { + this.saveCallback(target); + this.close(); + } + } + onClose() { + const { contentEl } = this; + contentEl.empty(); + } +} +class DailyNoteViewPlugin extends require$$0.Plugin { + async onload() { + this.addSettingTab(new DailyNoteSettingTab(this.app, this)); + await this.loadSettings(); + this.patchWorkspace(); + this.patchWorkspaceLeaf(); + addIconList(); + this.lastCheckedDay = require$$0.moment().format("YYYY-MM-DD"); + this.settings.useArrowUpOrDownToNavigate && this.registerEditorExtension([ + createUpDownNavigationExtension({ + app: this.app, + plugin: this + }) + // setActiveEditorExt({ app: this.app, plugin: this }), + ]); + this.registerView( + DAILY_NOTE_VIEW_TYPE, + (leaf) => this.view = new DailyNoteView(leaf, this) + ); + this.addRibbonIcon( + "calendar-range", + "Open Daily Note Editor", + (evt) => this.openDailyNoteEditor() + ); + this.addCommand({ + id: "open-daily-note-editor", + name: "Open Daily Note Editor", + callback: () => this.openDailyNoteEditor() + }); + this.initCssRules(); + if (this.settings.createAndOpenOnStartup) { + this.app.workspace.onLayoutReady(async () => { + await this.ensureTodaysDailyNoteExists(); + if (this.app.workspace.getLeavesOfType(DAILY_NOTE_VIEW_TYPE).length > 0) + return; + await this.openDailyNoteEditor(); + }); + } + this.registerInterval( + window.setInterval(this.checkDayChange.bind(this), 1e3 * 60 * 15) + ); + this.app.workspace.on("file-menu", (menu, file, source, leaf) => { + if (file instanceof require$$0.TFolder) { + menu.addItem((item) => { + item.setIcon("calendar-range"); + item.setTitle("Open daily notes for this folder"); + item.onClick(() => { + this.openFolderView(file.path); + }); + }); + } + }); + } + onunload() { + this.app.workspace.detachLeavesOfType(DAILY_NOTE_VIEW_TYPE); + document.body.toggleClass("daily-notes-hide-frontmatter", false); + document.body.toggleClass("daily-notes-hide-backlinks", false); + } + async openDailyNoteEditor() { + const workspace = this.app.workspace; + const leaf = workspace.getLeaf(true); + await leaf.setViewState({ type: DAILY_NOTE_VIEW_TYPE }); + workspace.revealLeaf(leaf); + } + async openFolderView(folderPath, timeField = "mtime") { + const workspace = this.app.workspace; + const leaf = workspace.getLeaf(true); + await leaf.setViewState({ type: DAILY_NOTE_VIEW_TYPE }); + const view2 = leaf.view; + view2.setSelectionMode("folder", folderPath); + view2.setTimeField(timeField); + workspace.revealLeaf(leaf); + } + async openTagView(tagName, timeField = "mtime") { + const workspace = this.app.workspace; + const leaf = workspace.getLeaf(true); + await leaf.setViewState({ type: DAILY_NOTE_VIEW_TYPE }); + const view2 = leaf.view; + view2.setSelectionMode("tag", tagName); + view2.setTimeField(timeField); + workspace.revealLeaf(leaf); + } + async ensureTodaysDailyNoteExists() { + try { + const currentDate = require$$0.moment(); + const allDailyNotes = getAllDailyNotes_1(); + const currentDailyNote = getDailyNote_1(currentDate, allDailyNotes); + if (!currentDailyNote) { + await createDailyNote_1(currentDate); + } + } catch (error) { + console.error("Failed to create daily note:", error); + } + } + initCssRules() { + document.body.toggleClass( + "daily-notes-hide-frontmatter", + this.settings.hideFrontmatter + ); + document.body.toggleClass( + "daily-notes-hide-backlinks", + this.settings.hideBacklinks + ); + } + patchWorkspace() { + let layoutChanging = false; + const uninstaller = around(require$$0.Workspace.prototype, { + getActiveViewOfType: (next) => function(t) { + const result = next.call(this, t); + if (!result) { + if ((t == null ? void 0 : t.VIEW_TYPE) === "markdown") { + const activeLeaf = this.activeLeaf; + if ((activeLeaf == null ? void 0 : activeLeaf.view) instanceof DailyNoteView) { + return activeLeaf.view.editMode; + } else { + return result; + } + } + } + return result; + }, + changeLayout(old) { + return async function(workspace) { + layoutChanging = true; + try { + await old.call(this, workspace); + } finally { + layoutChanging = false; + } + }; + }, + iterateLeaves(old) { + return function(arg1, arg2) { + if (old.call(this, arg1, arg2)) + return true; + const cb = typeof arg1 === "function" ? arg1 : arg2; + const parent = typeof arg1 === "function" ? arg2 : arg1; + if (!parent) + return false; + if (layoutChanging) + return false; + if (!require$$0.requireApiVersion("0.15.0")) { + if (parent === this.app.workspace.rootSplit || require$$0.WorkspaceContainer && parent instanceof require$$0.WorkspaceContainer) { + for (const popover of DailyNoteEditor.popoversForWindow( + parent.win + )) { + if (old.call(this, cb, popover.rootSplit)) + return true; + } + } + } + return false; + }; + }, + setActiveLeaf: (next) => function(e, t) { + if (e.parentLeaf) { + e.parentLeaf.activeTime = 17e11; + next.call(this, e.parentLeaf, t); + if (e.view.editMode) { + this.activeEditor = e.view; + e.parentLeaf.view.editMode = e.view; + } + return; + } + return next.call(this, e, t); + } + }); + this.register(uninstaller); + } + // Used for patch workspaceleaf pinned behaviors + patchWorkspaceLeaf() { + this.register( + around(require$$0.WorkspaceLeaf.prototype, { + getRoot(old) { + return function() { + const top = old.call(this); + return (top == null ? void 0 : top.getRoot) === this.getRoot ? top : top == null ? void 0 : top.getRoot(); + }; + }, + setPinned(old) { + return function(pinned) { + old.call(this, pinned); + if (isDailyNoteLeaf(this) && !pinned) + this.setPinned(true); + }; + }, + openFile(old) { + return function(file, openState) { + if (isDailyNoteLeaf(this)) { + setTimeout( + around(require$$0.Workspace.prototype, { + recordMostRecentOpenedFile(old2) { + return function(_file) { + if (_file !== file) { + return old2.call(this, _file); + } + }; + } + }), + 1 + ); + const recentFiles = this.app.plugins.plugins["recent-files-obsidian"]; + if (recentFiles) + setTimeout( + around(recentFiles, { + shouldAddFile(old2) { + return function(_file) { + return _file !== file && old2.call(this, _file); + }; + } + }), + 1 + ); + } + return old.call(this, file, openState); + }; + } + }) + ); + } + async loadSettings() { + this.settings = Object.assign( + {}, + DEFAULT_SETTINGS, + await this.loadData() + ); + } + async saveSettings() { + await this.saveData(this.settings); + } + async checkDayChange() { + const currentDay = require$$0.moment().format("YYYY-MM-DD"); + if (currentDay !== this.lastCheckedDay) { + this.lastCheckedDay = currentDay; + console.log("Day changed, updating daily notes view"); + await this.ensureTodaysDailyNoteExists(); + const dailyNoteLeaves = this.app.workspace.getLeavesOfType(DAILY_NOTE_VIEW_TYPE); + if (dailyNoteLeaves.length > 0) { + for (const leaf of dailyNoteLeaves) { + const view2 = leaf.view; + if (view2) { + view2.refreshForNewDay(); + } + } + } + } + } +} +module.exports = DailyNoteViewPlugin; + + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/daily-notes-editor/manifest.json b/.obsidian/plugins/daily-notes-editor/manifest.json new file mode 100644 index 0000000..a8b8646 --- /dev/null +++ b/.obsidian/plugins/daily-notes-editor/manifest.json @@ -0,0 +1,15 @@ +{ + "id": "daily-notes-editor", + "name": "Daily Notes Editor", + "version": "1.1.0", + "minAppVersion": "0.15.0", + "description": "Edit a bunch of daily notes in one page(inline), which works similar to Roam Research's default daily note view.", + "author": "Boninall", + "authorUrl": "https://github.com/Quorafind", + "fundingUrl": { + "Buy Me a Coffee": "https://www.buymeacoffee.com/boninall", + "爱发电": "https://afdian.net/a/boninall", + "支付宝": "https://cdn.jsdelivr.net/gh/Quorafind/.github@main/IMAGE/%E6%94%AF%E4%BB%98%E5%AE%9D%E4%BB%98%E6%AC%BE%E7%A0%81.jpg" + }, + "isDesktopOnly": false +} \ No newline at end of file diff --git a/.obsidian/plugins/daily-notes-editor/styles.css b/.obsidian/plugins/daily-notes-editor/styles.css new file mode 100644 index 0000000..33df896 --- /dev/null +++ b/.obsidian/plugins/daily-notes-editor/styles.css @@ -0,0 +1,220 @@ +.dn-editor { + /*overflow-y: hidden;*/ +} + +.dn-editor .cm-scroller { + /*overflow-y: hidden;*/ + padding: unset; +} + +.dn-editor .workspace-leaf { + all: unset; +} + +.dn-editor .dn-content { + display: none; + /*margin: 0;*/ + /*border-radius: var(--he-popover-border-radius);*/ + /*overflow: hidden;*/ + /*height: 100%;*/ +} + +.dn-editor .workspace-leaf, +.dn-editor .workspace-split { + height: 100%; + width: 100%; +} + +.dn-editor .markdown-source-view.mod-cm6 .cm-editor { + min-height: auto; +} + +.dn-editor .cm-content { + padding-bottom: 0 !important; + padding-top: 0 !important; +} + +.dn-editor .view-content { + background: none !important; +} + +.dn-editor .cm-scroller { + padding: 0 !important; + overflow-y: clip; +} +.daily-note-view .daily-note-wrapper::before { + content: ""; + display: block; + height: 1px; + width: var(--file-line-width); + margin-bottom: 30px; + margin-left: auto; + margin-right: auto; + background-color: var(--background-modifier-border); +} + +.daily-note-view .daily-note-wrapper:first-of-type::before { + height: 0px; +} + +.daily-note-view .dn-range-indicator + .daily-note-container::before { + height: 0px; +} + +.is-popout-window .dn-editor .dn-content { + margin: 0; + border-radius: var(--he-popover-border-radius); + overflow: hidden; + height: auto; +} + +.is-popout-window .dn-editor .workspace-leaf, +.is-popout-window .dn-editor .workspace-split { + height: auto; + width: 100%; +} + +.is-popout-window .dn-editor .cm-scroller { + height: auto; +} + +.is-popout-window .dn-editor .markdown-source-view.mod-cm6 { + height: auto; +} + +.is-popout-window .dn-editor .view-content { + height: auto; +} + +.is-popout-window .dn-editor .workspace-leaf-content { + height: auto; +} + +.daily-note-view .embedded-backlinks { + min-height: unset !important; +} + +.daily-note-view { + display: flex; + flex-direction: column; + gap: var(--size-4-4); + overflow-x: hidden; +} + +body.daily-notes-hide-frontmatter + .daily-note-view + .markdown-source-view.is-live-preview.show-properties + .metadata-container { + display: none; +} + +body.daily-notes-hide-backlinks .daily-note-view .embedded-backlinks { + display: none; +} + +/* Custom Range Modal Styles */ +.custom-range-date-container { + margin-bottom: var(--size-4-2); + display: flex; + align-items: center; +} + +.custom-range-date-container span { + width: 100px; + display: inline-block; +} + +.custom-range-date-container input { + flex: 1; +} + +.custom-range-button-container { + display: flex; + justify-content: flex-end; + margin-top: var(--size-4-4); + gap: var(--size-4-2); +} + +/* Preset management styles */ +.preset-container { + margin-bottom: var(--size-4-4); +} + +.no-presets-message { + color: var(--text-muted); + font-style: italic; + margin: var(--size-4-2) 0; +} + +.preset-list { + display: flex; + flex-direction: column; + gap: var(--size-4-2); + margin: var(--size-4-2) 0; +} + +.preset-item { + display: flex; + justify-content: space-between; + align-items: center; + padding: var(--size-2-4) var(--size-4-3); + background-color: var(--background-secondary); + border-radius: var(--radius-s); +} + +.preset-info { + display: flex; + align-items: center; +} + +.preset-type { + font-weight: bold; + margin-right: var(--size-2-2); +} + +.preset-actions { + display: flex; + gap: var(--size-4-2); +} + +.preset-action-button { + padding: var(--size-2-2) var(--size-2-4); + border-radius: var(--radius-s); + font-size: var(--font-ui-small); + cursor: pointer; +} + +.preset-open-button { + background-color: var(--interactive-accent); + color: var(--text-on-accent); +} + +.preset-delete-button { + background-color: var(--background-modifier-error); + color: var(--text-on-accent); +} + +/* Add preset modal styles */ +.setting-item { + margin-bottom: var(--size-4-4); +} + +.target-input { + width: 100%; + padding: var(--size-2-3); + border-radius: var(--radius-s); + border: 1px solid var(--background-modifier-border); + background-color: var(--background-primary); +} + +.modal-button-container { + display: flex; + justify-content: flex-end; + gap: var(--size-4-2); + margin-top: var(--size-4-4); +} + +.is-phone .mod-root .workspace-tabs:not(.mod-visible):has(.daily-note-view) { + display: flex !important; +} +.daily-note.svelte-1d2sruf.svelte-1d2sruf{margin-bottom:var(--size-4-5);padding-bottom:var(--size-4-8)}.daily-note.svelte-1d2sruf.svelte-1d2sruf:has(.daily-note-editor[data-collapsed="true"]){margin-bottom:0;padding-bottom:0}.daily-note-editor.svelte-1d2sruf.svelte-1d2sruf{min-height:100px}.daily-note-editor[data-collapsed="true"].svelte-1d2sruf.svelte-1d2sruf{display:none}.daily-note.svelte-1d2sruf .collapse-button.svelte-1d2sruf{display:none}.daily-note.svelte-1d2sruf:hover .collapse-button.svelte-1d2sruf{display:block}.daily-note.svelte-1d2sruf .collapse-button.svelte-1d2sruf{color:var(--text-muted)}.daily-note.svelte-1d2sruf .collapse-button.svelte-1d2sruf:hover{color:var(--text-normal)}.daily-note.svelte-1d2sruf:has(.is-readable-line-width) .daily-note-title.svelte-1d2sruf{max-width:calc(var(--file-line-width) + var(--size-4-4));width:calc(var(--file-line-width) + var(--size-4-4));margin-left:auto;margin-right:auto;margin-bottom:var(--size-4-8);display:flex;align-items:center;justify-content:start;gap:var(--size-4-2)}.collapse-button.svelte-1d2sruf.svelte-1d2sruf{margin-left:calc(var(--size-4-8) * -1)}.collapse-button[data-collapsed="true"].svelte-1d2sruf.svelte-1d2sruf{transform:rotate(-90deg);transition:transform 0.2s ease}.daily-note.svelte-1d2sruf:not(:has(.is-readable-line-width)) .daily-note-title.svelte-1d2sruf{display:flex;justify-content:start;align-items:center;width:100%;padding-left:calc(calc(100% - var(--file-line-width)) / 2 - var(--size-4-2));padding-right:calc(calc(100% - var(--file-line-width)) / 2 - var(--size-4-2));margin-top:var(--size-4-8);gap:var(--size-4-2)}.clickable-link.svelte-1d2sruf.svelte-1d2sruf{cursor:pointer;text-decoration:none}.clickable-link.svelte-1d2sruf.svelte-1d2sruf:hover{color:var(--color-accent);text-decoration:underline}.editor-placeholder.svelte-1d2sruf.svelte-1d2sruf{display:flex;justify-content:center;align-items:center;height:100px;color:var(--text-muted);font-style:italic}.collapse-button.svelte-1d2sruf.svelte-1d2sruf{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;color:var(--text-muted);transition:background-color 0.2s ease}.collapse-button.svelte-1d2sruf.svelte-1d2sruf:hover{color:var(--text-normal)}.dn-stock.svelte-4q3cv7{height:1000px;width:100%;display:flex;justify-content:center;align-items:center}.dn-stock-text.svelte-4q3cv7{text-align:center}.no-more-text.svelte-4q3cv7{margin-left:auto;margin-right:auto;text-align:center}.dn-blank-day.svelte-4q3cv7{display:flex;margin-left:auto;margin-right:auto;max-width:var(--file-line-width);color:var(--color-base-40);padding-top:20px;padding-bottom:20px;transition:all 300ms}.dn-blank-day.svelte-4q3cv7:hover{padding-top:40px;padding-bottom:40px;transition:padding 300ms}.dn-blank-day-text.svelte-4q3cv7{margin-left:auto;margin-right:auto;text-align:center}.daily-note-wrapper.svelte-4q3cv7{width:100%} \ No newline at end of file diff --git a/.obsidian/plugins/inline-spoilers/data.json b/.obsidian/plugins/inline-spoilers/data.json new file mode 100644 index 0000000..63a07f9 --- /dev/null +++ b/.obsidian/plugins/inline-spoilers/data.json @@ -0,0 +1,4 @@ +{ + "showAllSpoilers": false, + "enableEditorMode": true +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-quiet-outline/data.json b/.obsidian/plugins/obsidian-quiet-outline/data.json new file mode 100644 index 0000000..0437cd8 --- /dev/null +++ b/.obsidian/plugins/obsidian-quiet-outline/data.json @@ -0,0 +1,55 @@ +{ + "search_support": true, + "level_switch": true, + "markdown": true, + "expand_level": "0", + "hide_unsearched": true, + "auto_expand_ext": "only-expand", + "regex_search": false, + "ellipsis": false, + "label_direction": "left", + "drag_modify": false, + "locate_by_cursor": false, + "show_popover_key": "ctrlKey", + "persist_md_states": true, + "keep_search_input": false, + "export_format": "{title}", + "lang_direction_decide_by": "system", + "auto_scroll_into_view": true, + "vimlize_canvas": false, + "canvas_sort_by": "area", + "shown_node_types": [ + "file", + "group", + "text", + "link" + ], + "heading_truncate_length": 20, + "patch_color": false, + "primary_color_light": "#18a058", + "primary_color_dark": "#63e2b7", + "rainbow_line": false, + "rainbow_color_1": "#FD8B1F", + "rainbow_color_2": "#FFDF00", + "rainbow_color_3": "#07EB23", + "rainbow_color_4": "#2D8FF0", + "rainbow_color_5": "#BC01E2", + "font_size": "", + "font_family": "", + "font_weight": "", + "line_height": "", + "line_gap": "", + "custom_font_color": false, + "h1_color": "#000000", + "h2_color": "#000000", + "h3_color": "#000000", + "h4_color": "#000000", + "h5_color": "#000000", + "h6_color": "#000000", + "h1_color_dark": "#000000", + "h2_color_dark": "#000000", + "h3_color_dark": "#000000", + "h4_color_dark": "#000000", + "h5_color_dark": "#000000", + "h6_color_dark": "#000000" +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-quiet-outline/markdown-states.json b/.obsidian/plugins/obsidian-quiet-outline/markdown-states.json new file mode 100644 index 0000000..3733522 --- /dev/null +++ b/.obsidian/plugins/obsidian-quiet-outline/markdown-states.json @@ -0,0 +1,697 @@ +{ + "timestamped/2026-05-22_11-57-18.md": { + "scroll": 8, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [ + "item-1-0" + ] + }, + "home.md": { + "scroll": 3.870503487346841, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [ + "item-1-0", + "item-2-1" + ] + }, + "periodic/daily/2026-06-01.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 9, + "ch": 0 + }, + "to": { + "line": 9, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "periodic/daily/2026-05-30.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "periodic/daily/2026-05-29.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "periodic/daily/2026-05-27.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 9, + "ch": 0 + }, + "to": { + "line": 9, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "periodic/daily/2026-05-28.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 9, + "ch": 0 + }, + "to": { + "line": 9, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-06-13_00-00-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [ + "item-2-1", + "item-1-0" + ] + }, + "periodic/daily/2025-03-08.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "periodic/daily/2026-05-26.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 9, + "ch": 0 + }, + "to": { + "line": 9, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "periodic/daily/2026-05-25.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 9, + "ch": 0 + }, + "to": { + "line": 9, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "periodic/daily/2026-05-24.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "periodic/daily/2026-05-23.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 9, + "ch": 0 + }, + "to": { + "line": 9, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-01_08-25-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-04_14-52-05.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-05_00-00-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-06_18-12-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-10_06-53-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-10_10-40-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-10_11-14-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-10_15-15-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-10_20-00-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-11_00-00-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-11_06-06-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-11_14-41-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-13_08-03-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-13_08-19-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-13_08-19-01.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-13_13-25-27.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-13_20-41-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-14_13-41-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2025-11-16_08-09-00.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2026-05-25_15-02-03.md": { + "scroll": 40.27835051546392, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "the-failure-of-risk-management.md": { + "scroll": 110.97590067300452, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [ + "item-1-0", + "item-3-8", + "item-2-2", + "item-3-11", + "item-2-15", + "item-2-18" + ] + }, + "timestamped/2026-01-25_21-02-00.md": { + "scroll": 0.4805194681340998, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "fooled-by-randomness.md": { + "scroll": 102.7064700909515, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [ + "item-1-0", + "item-3-7", + "item-2-2" + ] + }, + "hubbard_2020_failure.md": { + "scroll": 296.0055643717448, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [ + "item-3-46", + "item-2-28", + "item-1-0" + ] + }, + "consolidate-electrical-info.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 11, + "ch": 0 + }, + "to": { + "line": 11, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/YYYY-MM-DD_HH-mm-ss.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 13, + "ch": 33 + }, + "to": { + "line": 13, + "ch": 33 + } + }, + "expandedKeys": [] + }, + "timestamped/2026-06-01_16-44-31.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2026-06-01_16-54-37.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 11, + "ch": 0 + }, + "to": { + "line": 11, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "templates/Untitled 1.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "templates/task.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 9, + "ch": 82 + }, + "to": { + "line": 9, + "ch": 82 + } + }, + "expandedKeys": [] + }, + "templates/timestamped.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 6, + "ch": 2 + }, + "to": { + "line": 6, + "ch": 2 + } + }, + "expandedKeys": [] + }, + "templates/untitled.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 0, + "ch": 0 + }, + "to": { + "line": 0, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2026-06-01_17-07-41.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 8, + "ch": 40 + }, + "to": { + "line": 8, + "ch": 40 + } + }, + "expandedKeys": [] + }, + "timestamped/2026-06-01_17-09-04.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 11, + "ch": 0 + }, + "to": { + "line": 11, + "ch": 0 + } + }, + "expandedKeys": [] + }, + "timestamped/2026-06-01_08-31-48.md": { + "scroll": 0, + "cursor": { + "from": { + "line": 21, + "ch": 0 + }, + "to": { + "line": 21, + "ch": 0 + } + }, + "expandedKeys": [] + } +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-tasks-plugin/data.json b/.obsidian/plugins/obsidian-tasks-plugin/data.json index 83b47db..18d0ea5 100644 --- a/.obsidian/plugins/obsidian-tasks-plugin/data.json +++ b/.obsidian/plugins/obsidian-tasks-plugin/data.json @@ -25,6 +25,9 @@ "filenameAsDateFolders": [], "recurrenceOnNextLine": false, "removeScheduledDateOnRecurrence": false, + "searchResults": { + "taskCountLocation": "bottom" + }, "statusSettings": { "coreStatuses": [ { diff --git a/.obsidian/plugins/tasknotes/data.json b/.obsidian/plugins/tasknotes/data.json new file mode 100644 index 0000000..cd16208 --- /dev/null +++ b/.obsidian/plugins/tasknotes/data.json @@ -0,0 +1,518 @@ +{ + "tasksFolder": "tasks", + "moveArchivedTasks": false, + "archiveFolder": "TaskNotes/Archive", + "taskTag": "type/task", + "taskIdentificationMethod": "tag", + "hideIdentifyingTagsInCards": false, + "hideIdentifyingTagsMode": "all", + "taskPropertyName": "", + "taskPropertyValue": "", + "excludedFolders": "templates", + "defaultTaskPriority": "normal", + "defaultTaskStatus": "open", + "taskOrgFiltersCollapsed": false, + "taskFilenameFormat": "custom", + "storeTitleInFilename": false, + "customFilenameTemplate": "{{date}}_{{hourPadded}}-{{minute}}-{{second}}", + "taskCreationDefaults": { + "defaultContexts": "", + "defaultTags": "", + "defaultProjects": "", + "useParentNoteAsProject": false, + "useParentHeaderAsProject": false, + "inheritParentTaskProperties": false, + "defaultTimeEstimate": 0, + "defaultRecurrence": "none", + "defaultDueDate": "none", + "defaultDueTime": "none", + "defaultScheduledDate": "today", + "defaultScheduledTime": "none", + "bodyTemplate": "templates/task", + "useBodyTemplate": true, + "defaultReminders": [] + }, + "openTaskAfterCreation": "none", + "calendarViewSettings": { + "defaultView": "dayGridMonth", + "customDayCount": 3, + "slotDuration": "00:15:00", + "slotMinTime": "00:00:00", + "slotMaxTime": "24:00:00", + "scrollTime": "08:00:00", + "firstDay": 0, + "timeFormat": "24", + "showWeekends": true, + "locale": "", + "defaultShowScheduled": true, + "defaultShowDue": true, + "defaultShowDueWhenScheduled": true, + "defaultShowScheduledToDueSpan": false, + "defaultShowTimeEntries": false, + "defaultShowRecurring": true, + "defaultShowICSEvents": true, + "enableTimeblocking": true, + "defaultShowTimeblocks": true, + "defaultTimeblockColor": "#6366f1", + "timeblockAttachmentSearchOrder": "name-asc", + "nowIndicator": true, + "selectMirror": true, + "weekNumbers": true, + "showTodayHighlight": true, + "eventMinHeight": 15, + "slotEventOverlap": true, + "eventMaxStack": null, + "dayMaxEvents": true, + "dayMaxEventRows": false + }, + "pomodoroWorkDuration": 25, + "pomodoroShortBreakDuration": 5, + "pomodoroLongBreakDuration": 15, + "pomodoroLongBreakInterval": 4, + "pomodoroAutoStartBreaks": false, + "pomodoroAutoStartWork": false, + "pomodoroNotifications": true, + "pomodoroSoundEnabled": true, + "pomodoroSoundVolume": 50, + "pomodoroStorageLocation": "daily-notes", + "pomodoroMobileSidebar": "tab", + "showPomodoroInStatusBar": true, + "enableTaskLinkOverlay": true, + "disableOverlayOnAlias": false, + "enableInstantTaskConvert": true, + "useDefaultsOnInstantConvert": true, + "preserveCheckboxOnConvert": false, + "taskModalTabMovesFocus": true, + "enableNaturalLanguageInput": false, + "nlpDefaultToScheduled": true, + "nlpLanguage": "en", + "uiLanguage": "system", + "statusSuggestionTrigger": "*", + "nlpTriggers": { + "triggers": [ + { + "propertyId": "tags", + "trigger": "#", + "enabled": true + }, + { + "propertyId": "contexts", + "trigger": "@", + "enabled": true + }, + { + "propertyId": "projects", + "trigger": "+", + "enabled": true + }, + { + "propertyId": "status", + "trigger": "*", + "enabled": true + }, + { + "propertyId": "priority", + "trigger": "!", + "enabled": false + }, + { + "propertyId": "field_1780347153381", + "trigger": "daily:", + "enabled": false + } + ] + }, + "singleClickAction": "edit", + "doubleClickAction": "openNote", + "projectAutosuggest": { + "enableFuzzy": false, + "rows": [ + "{title|n(Title)}", + "{aliases|n(Aliases)}", + "{file.path|n(Path)}" + ], + "showAdvanced": false, + "requiredTags": [], + "includeFolders": [], + "propertyKey": "", + "propertyValue": "" + }, + "inlineTaskConvertFolder": "", + "disableNoteIndexing": false, + "suggestionDebounceMs": 0, + "fieldMapping": { + "title": "title", + "status": "status", + "priority": "priority", + "due": "due", + "scheduled": "scheduled", + "contexts": "contexts", + "projects": "projects", + "timeEstimate": "timeEstimate", + "completedDate": "completedDate", + "dateCreated": "dateCreated", + "dateModified": "dateModified", + "recurrence": "recurrence", + "recurrenceAnchor": "recurrence_anchor", + "recurrenceParent": "recurrence_parent", + "occurrenceDate": "occurrence_date", + "occurrenceMaterialization": "occurrence_materialization", + "occurrenceNextTrigger": "occurrence_next_trigger", + "occurrenceTemplate": "occurrence_template", + "occurrencePastHorizon": "occurrence_past_horizon", + "occurrenceFutureHorizon": "occurrence_future_horizon", + "archiveTag": "archived", + "timeEntries": "timeEntries", + "completeInstances": "complete_instances", + "skippedInstances": "skipped_instances", + "blockedBy": "blockedBy", + "pomodoros": "pomodoros", + "icsEventId": "icsEventId", + "icsEventTag": "ics_event", + "googleCalendarEventId": "googleCalendarEventId", + "googleCalendarExceptionEventId": "googleCalendarExceptionEventId", + "googleCalendarExceptionOriginalScheduled": "googleCalendarExceptionOriginalScheduled", + "googleCalendarMovedOriginalDates": "googleCalendarMovedOriginalDates", + "reminders": "reminders", + "sortOrder": "tasknotes_manual_order" + }, + "customStatuses": [ + { + "id": "none", + "value": "none", + "label": "None", + "color": "#cccccc", + "isCompleted": false, + "excludeFromCycle": false, + "order": 0, + "autoArchive": false, + "autoArchiveDelay": 5 + }, + { + "id": "open", + "value": "open", + "label": "Open", + "color": "#808080", + "isCompleted": false, + "excludeFromCycle": false, + "order": 1, + "autoArchive": false, + "autoArchiveDelay": 5 + }, + { + "id": "in-progress", + "value": "in-progress", + "label": "In progress", + "color": "#0066cc", + "isCompleted": false, + "excludeFromCycle": false, + "order": 2, + "autoArchive": false, + "autoArchiveDelay": 5 + }, + { + "id": "done", + "value": "done", + "label": "Done", + "color": "#00aa00", + "isCompleted": true, + "excludeFromCycle": false, + "order": 3, + "autoArchive": false, + "autoArchiveDelay": 5 + } + ], + "customPriorities": [ + { + "id": "none", + "value": "none", + "label": "None", + "color": "#cccccc", + "weight": 0 + }, + { + "id": "low", + "value": "low", + "label": "Low", + "color": "#00aa00", + "weight": 1 + }, + { + "id": "normal", + "value": "normal", + "label": "Normal", + "color": "#ffaa00", + "weight": 2 + }, + { + "id": "high", + "value": "high", + "label": "High", + "color": "#ff0000", + "weight": 3 + } + ], + "recurrenceMigrated": false, + "lastSeenVersion": "4.10.0", + "showReleaseNotesOnUpdate": false, + "showTrackedTasksInStatusBar": false, + "autoStopTimeTrackingOnComplete": true, + "autoStopTimeTrackingNotification": false, + "showRelationships": true, + "relationshipsPosition": "bottom", + "showTaskCardInNote": true, + "showCompletedTaskStrikethrough": true, + "showExpandableSubtasks": true, + "expandSubtasksByDefault": false, + "subtaskChevronPosition": "right", + "viewsButtonAlignment": "right", + "hideCompletedFromOverdue": true, + "icsIntegration": { + "defaultNoteTemplate": "", + "defaultNoteFolder": "", + "icsNoteFilenameFormat": "title", + "customICSNoteFilenameTemplate": "{title}", + "enableAutoExport": false, + "autoExportPath": "tasknotes-calendar.ics", + "autoExportInterval": 60, + "useDurationForExport": false, + "excludeArchivedFromExport": false, + "excludeCompletedFromExport": false, + "requireDueDateForExport": false, + "requireScheduledDateForExport": false, + "useICSEndAsDue": false + }, + "savedViews": [], + "enableNotifications": false, + "notificationType": "system", + "notificationSoundEnabled": false, + "notificationSoundVolume": 50, + "enableAPI": false, + "apiPort": 8080, + "apiAuthToken": "", + "enableMCP": false, + "webhooks": [], + "userFields": [], + "modalFieldsConfig": { + "version": 1, + "fields": [ + { + "id": "title", + "fieldType": "core", + "group": "basic", + "displayName": "Title", + "visibleInCreation": true, + "visibleInEdit": true, + "order": 0, + "enabled": true, + "required": true + }, + { + "id": "details", + "fieldType": "core", + "group": "basic", + "displayName": "Details", + "visibleInCreation": true, + "visibleInEdit": true, + "order": 1, + "enabled": true + }, + { + "id": "contexts", + "fieldType": "core", + "group": "metadata", + "displayName": "Contexts", + "visibleInCreation": true, + "visibleInEdit": true, + "order": 0, + "enabled": true + }, + { + "id": "tags", + "fieldType": "core", + "group": "metadata", + "displayName": "Tags", + "visibleInCreation": true, + "visibleInEdit": true, + "order": 1, + "enabled": true + }, + { + "id": "time-estimate", + "fieldType": "core", + "group": "metadata", + "displayName": "Time Estimate", + "visibleInCreation": true, + "visibleInEdit": true, + "order": 2, + "enabled": true + }, + { + "id": "projects", + "fieldType": "organization", + "group": "organization", + "displayName": "Projects", + "visibleInCreation": true, + "visibleInEdit": true, + "order": 0, + "enabled": true + }, + { + "id": "subtasks", + "fieldType": "organization", + "group": "organization", + "displayName": "Subtasks", + "visibleInCreation": true, + "visibleInEdit": true, + "order": 1, + "enabled": true + }, + { + "id": "blocked-by", + "fieldType": "dependency", + "group": "dependencies", + "displayName": "Blocked By", + "visibleInCreation": true, + "visibleInEdit": true, + "order": 0, + "enabled": true + }, + { + "id": "blocking", + "fieldType": "dependency", + "group": "dependencies", + "displayName": "Blocking", + "visibleInCreation": true, + "visibleInEdit": true, + "order": 1, + "enabled": true + } + ], + "groups": [ + { + "id": "basic", + "displayName": "Basic Information", + "order": 0, + "collapsible": false, + "defaultCollapsed": false + }, + { + "id": "metadata", + "displayName": "Metadata", + "order": 1, + "collapsible": true, + "defaultCollapsed": false + }, + { + "id": "organization", + "displayName": "Organization", + "order": 2, + "collapsible": true, + "defaultCollapsed": false + }, + { + "id": "dependencies", + "displayName": "Dependencies", + "order": 3, + "collapsible": true, + "defaultCollapsed": false + }, + { + "id": "custom", + "displayName": "Custom Fields", + "order": 4, + "collapsible": true, + "defaultCollapsed": false + } + ] + }, + "enableModalSplitLayout": true, + "defaultVisibleProperties": [ + "status", + "priority", + "blocked", + "blocking" + ], + "inlineVisibleProperties": [ + "status", + "priority", + "due", + "scheduled", + "recurrence" + ], + "enableBases": true, + "enableMdbaseSpec": false, + "autoCreateDefaultBasesFiles": true, + "commandFileMapping": { + "open-calendar-view": "tasks/views/mini-calendar-default.base", + "open-kanban-view": "tasks/views/kanban-default.base", + "open-tasks-view": "tasks/views/tasks-default.base", + "open-advanced-calendar-view": "tasks/views/calendar-default.base", + "open-agenda-view": "tasks/views/agenda-default.base", + "pomodoro-stats-base": "tasks/views/pomodoro-stats.base", + "relationships": "tasks/views/relationships.base" + }, + "maintainDueDateOffsetInRecurring": false, + "resetCheckboxesOnRecurrence": false, + "useFrontmatterMarkdownLinks": false, + "googleOAuthClientId": "", + "googleOAuthClientSecret": "", + "microsoftOAuthClientId": "", + "microsoftOAuthClientSecret": "", + "enableGoogleCalendar": false, + "enableMicrosoftCalendar": false, + "disableCalendarOnMobile": false, + "enabledGoogleCalendars": [], + "googleCalendarSyncTokens": {}, + "enabledMicrosoftCalendars": [], + "microsoftCalendarSyncTokens": {}, + "googleCalendarExport": { + "enabled": false, + "targetCalendarId": "", + "syncOnTaskCreate": true, + "syncOnTaskUpdate": true, + "syncOnTaskComplete": true, + "syncOnTaskDelete": true, + "eventTitleTemplate": "{{title}}", + "includeDescription": true, + "eventColorId": null, + "syncTrigger": "scheduled", + "createAsAllDay": true, + "defaultEventDuration": 60, + "includeObsidianLink": true, + "defaultReminderMinutes": null + }, + "enableDebugLogging": false, + "googleCalendarSyncQueue": [ + { + "taskPath": "timestamped/YYYY-MM-DD_HH-mm-ss.md", + "requestedAt": 1780346458397, + "attempts": 0, + "lastError": "Google Calendar sync is not ready" + }, + { + "taskPath": "timestamped/2026-06-01_16-44-31.md", + "requestedAt": 1780346671952, + "attempts": 0, + "lastError": "Google Calendar sync is not ready" + }, + { + "taskPath": "timestamped/2026-06-01_16-54-37.md", + "requestedAt": 1780347277788, + "attempts": 0, + "lastError": "Google Calendar sync is not ready" + }, + { + "taskPath": "timestamped/2026-06-01_17-07-41.md", + "requestedAt": 1780348061498, + "attempts": 0, + "lastError": "Google Calendar sync is not ready" + }, + { + "taskPath": "timestamped/2026-06-01_17-09-04.md", + "requestedAt": 1780348144101, + "attempts": 0, + "lastError": "Google Calendar sync is not ready" + } + ] +} \ No newline at end of file diff --git a/.obsidian/plugins/tasknotes/main.js b/.obsidian/plugins/tasknotes/main.js new file mode 100644 index 0000000..3d9e3d8 --- /dev/null +++ b/.obsidian/plugins/tasknotes/main.js @@ -0,0 +1,1155 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ + +var y5e=Object.create;var qy=Object.defineProperty;var aae=Object.getOwnPropertyDescriptor;var v5e=Object.getOwnPropertyNames;var b5e=Object.getPrototypeOf,T5e=Object.prototype.hasOwnProperty;var sae=r=>{throw TypeError(r)};var k5e=(r,e,t)=>e in r?qy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var y=(r,e)=>()=>(r&&(e=r(r=0)),e);var E=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),et=(r,e)=>{for(var t in e)qy(r,t,{get:e[t],enumerable:!0})},oae=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of v5e(e))!T5e.call(r,i)&&i!==t&&qy(r,i,{get:()=>e[i],enumerable:!(n=aae(e,i))||n.enumerable});return r};var tt=(r,e,t)=>(t=r!=null?y5e(b5e(r)):{},oae(e||!r||!r.__esModule?qy(t,"default",{value:r,enumerable:!0}):t,r)),WM=r=>oae(qy({},"__esModule",{value:!0}),r),rt=(r,e,t,n)=>{for(var i=n>1?void 0:n?aae(e,t):e,a=r.length-1,s;a>=0;a--)(s=r[a])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&qy(e,t,i),i};var A=(r,e,t)=>k5e(r,typeof e!="symbol"?e+"":e,t),lae=(r,e,t)=>e.has(r)||sae("Cannot "+t);var ho=(r,e,t)=>(lae(r,e,"read from private field"),t?t.call(r):e.get(r)),Hf=(r,e,t)=>e.has(r)?sae("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),$d=(r,e,t,n)=>(lae(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var w5e,O4t,YM,cae,gj,yj,S5e,dae,L4t,E5e,x5e,F4t,vj,Wy=y(()=>{w5e=Math.pow(10,8)*24*60*60*1e3,O4t=-w5e,YM=6048e5,cae=864e5,gj=6e4,yj=36e5,S5e=3600,dae=S5e*24,L4t=dae*7,E5e=dae*365.2425,x5e=E5e/12,F4t=x5e*3,vj=Symbol.for("constructDateFrom")});function Ln(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&vj in r?r[vj](e):r instanceof Date?new r.constructor(e):new Date(e)}var gl=y(()=>{Wy()});function dt(r,e){return Ln(e||r,r)}var Cn=y(()=>{gl()});function Vf(r,e,t){let n=dt(r,t==null?void 0:t.in);return isNaN(e)?Ln((t==null?void 0:t.in)||r,NaN):(e&&n.setDate(n.getDate()+e),n)}var GM=y(()=>{gl();Cn()});function KM(r,e,t){let n=dt(r,t==null?void 0:t.in);if(isNaN(e))return Ln((t==null?void 0:t.in)||r,NaN);if(!e)return n;let i=n.getDate(),a=Ln((t==null?void 0:t.in)||r,n.getTime());a.setMonth(n.getMonth()+e+1,0);let s=a.getDate();return i>=s?a:(n.setFullYear(a.getFullYear(),a.getMonth(),i),n)}var bj=y(()=>{gl();Cn()});var uae=y(()=>{});var pae=y(()=>{});var mae=y(()=>{});var fae=y(()=>{});var hae=y(()=>{});var gae=y(()=>{});var yae=y(()=>{});function lc(){return C5e}var C5e,Yy=y(()=>{C5e={}});function Ca(r,e){var o,l,c,d,u,p,m,f;let t=lc(),n=(f=(m=(d=(c=e==null?void 0:e.weekStartsOn)!=null?c:(l=(o=e==null?void 0:e.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)!=null?d:t.weekStartsOn)!=null?m:(p=(u=t.locale)==null?void 0:u.options)==null?void 0:p.weekStartsOn)!=null?f:0,i=dt(r,e==null?void 0:e.in),a=i.getDay(),s=(a{Yy();Cn()});function qf(r,e){return Ca(r,{...e,weekStartsOn:1})}var Sw=y(()=>{Gy()});function ZM(r,e){let t=dt(r,e==null?void 0:e.in),n=t.getFullYear(),i=Ln(t,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);let a=qf(i),s=Ln(t,0);s.setFullYear(n,0,4),s.setHours(0,0,0,0);let o=qf(s);return t.getTime()>=a.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}var QM=y(()=>{gl();Sw();Cn()});function Tj(r){let e=dt(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}var vae=y(()=>{Cn()});function JM(r,...e){let t=Ln.bind(null,r||e.find(n=>typeof n=="object"));return e.map(t)}var kj=y(()=>{gl()});function yl(r,e){let t=dt(r,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}var XM=y(()=>{Cn()});function bae(r,e,t){let[n,i]=JM(t==null?void 0:t.in,r,e),a=yl(n),s=yl(i),o=+a-Tj(a),l=+s-Tj(s);return Math.round((o-l)/cae)}var wj=y(()=>{vae();kj();Wy();XM()});function Tae(r,e){let t=ZM(r,e),n=Ln((e==null?void 0:e.in)||r,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),qf(n)}var Sj=y(()=>{gl();QM();Sw()});var kae=y(()=>{});var wae=y(()=>{});var Sae=y(()=>{});var Eae=y(()=>{});var xae=y(()=>{});function Cae(r,e,t){return Vf(r,e*7,t)}var Dae=y(()=>{GM()});function Pae(r,e,t){return KM(r,e*12,t)}var Mae=y(()=>{bj()});var _ae=y(()=>{});var Aae=y(()=>{});var Iae=y(()=>{});var Nae=y(()=>{});var Rae=y(()=>{});var Oae=y(()=>{});var Lae=y(()=>{});var Fae=y(()=>{});var $ae=y(()=>{});var zae=y(()=>{});function Ej(r,e,t){let[n,i]=JM(t==null?void 0:t.in,r,e);return+yl(n)==+yl(i)}var jae=y(()=>{kj();XM()});function Bae(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}var xj=y(()=>{});function bi(r){return!(!Bae(r)&&typeof r!="number"||isNaN(+dt(r)))}var Cj=y(()=>{xj();Cn()});var Uae=y(()=>{});var Hae=y(()=>{});var Vae=y(()=>{});var qae=y(()=>{});var Wae=y(()=>{});var Yae=y(()=>{});var Gae=y(()=>{});var Kae=y(()=>{});var Zae=y(()=>{});var Qae=y(()=>{});var Jae=y(()=>{});var Xae=y(()=>{});var ese=y(()=>{});var tse=y(()=>{});function Ew(r,e){let t=dt(r,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}var rse=y(()=>{Cn()});function e_(r,e){let t=dt(r,e==null?void 0:e.in),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}var nse=y(()=>{Cn()});var ise=y(()=>{});var ase=y(()=>{});var sse=y(()=>{});var ose=y(()=>{});var lse=y(()=>{});var cse=y(()=>{});var dse=y(()=>{});var use=y(()=>{});var pse=y(()=>{});var mse=y(()=>{});var fse=y(()=>{});var hse=y(()=>{});var gse=y(()=>{});var yse=y(()=>{});function t_(r,e){let t=dt(r,e==null?void 0:e.in);return t.setDate(1),t.setHours(0,0,0,0),t}var vse=y(()=>{Cn()});var bse=y(()=>{});function Tse(r,e){let t=dt(r,e==null?void 0:e.in),n=t.getFullYear();return t.setFullYear(n+1,0,0),t.setHours(23,59,59,999),t}var kse=y(()=>{Cn()});function r_(r,e){let t=dt(r,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}var Dj=y(()=>{Cn()});var wse=y(()=>{});var Sse=y(()=>{});var Ese=y(()=>{});var xse=y(()=>{});function Ky(r,e){var o,l,c,d,u,p,m,f;let t=lc(),n=(f=(m=(d=(c=e==null?void 0:e.weekStartsOn)!=null?c:(l=(o=e==null?void 0:e.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)!=null?d:t.weekStartsOn)!=null?m:(p=(u=t.locale)==null?void 0:u.options)==null?void 0:p.weekStartsOn)!=null?f:0,i=dt(r,e==null?void 0:e.in),a=i.getDay(),s=(a{Yy();Cn()});var Dse=y(()=>{});var Pse=y(()=>{});var Mse=y(()=>{});var _se=y(()=>{});var Ase=y(()=>{});var Ise=y(()=>{});var Nse=y(()=>{});var Rse=y(()=>{});var D5e,Ose,Lse=y(()=>{D5e={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ose=(r,e,t)=>{let n,i=D5e[r];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n}});function n_(r){return(e={})=>{let t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}var Fse=y(()=>{});var P5e,M5e,_5e,$se,zse=y(()=>{Fse();P5e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},M5e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},_5e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$se={date:n_({formats:P5e,defaultWidth:"full"}),time:n_({formats:M5e,defaultWidth:"full"}),dateTime:n_({formats:_5e,defaultWidth:"full"})}});var A5e,jse,Bse=y(()=>{A5e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},jse=(r,e,t,n)=>A5e[r]});function Zy(r){return(e,t)=>{let n=t!=null&&t.context?String(t.context):"standalone",i;if(n==="formatting"&&r.formattingValues){let s=r.defaultFormattingWidth||r.defaultWidth,o=t!=null&&t.width?String(t.width):s;i=r.formattingValues[o]||r.formattingValues[s]}else{let s=r.defaultWidth,o=t!=null&&t.width?String(t.width):r.defaultWidth;i=r.values[o]||r.values[s]}let a=r.argumentCallback?r.argumentCallback(e):e;return i[a]}}var Use=y(()=>{});var I5e,N5e,R5e,O5e,L5e,F5e,$5e,Hse,Vse=y(()=>{Use();I5e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},N5e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},R5e={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},O5e={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},L5e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},F5e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},$5e=(r,e)=>{let t=Number(r),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},Hse={ordinalNumber:$5e,era:Zy({values:I5e,defaultWidth:"wide"}),quarter:Zy({values:N5e,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Zy({values:R5e,defaultWidth:"wide"}),day:Zy({values:O5e,defaultWidth:"wide"}),dayPeriod:Zy({values:L5e,defaultWidth:"wide",formattingValues:F5e,defaultFormattingWidth:"wide"})}});function Qy(r){return(e,t={})=>{let n=t.width,i=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],a=e.match(i);if(!a)return null;let s=a[0],o=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],l=Array.isArray(o)?j5e(o,u=>u.test(s)):z5e(o,u=>u.test(s)),c;c=r.valueCallback?r.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;let d=e.slice(s.length);return{value:c,rest:d}}}function z5e(r,e){for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function j5e(r,e){for(let t=0;t{});function Wse(r){return(e,t={})=>{let n=e.match(r.matchPattern);if(!n)return null;let i=n[0],a=e.match(r.parsePattern);if(!a)return null;let s=r.valueCallback?r.valueCallback(a[0]):a[0];s=t.valueCallback?t.valueCallback(s):s;let o=e.slice(i.length);return{value:s,rest:o}}}var Yse=y(()=>{});var B5e,U5e,H5e,V5e,q5e,W5e,Y5e,G5e,K5e,Z5e,Q5e,J5e,Gse,Kse=y(()=>{qse();Yse();B5e=/^(\d+)(th|st|nd|rd)?/i,U5e=/\d+/i,H5e={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},V5e={any:[/^b/i,/^(a|c)/i]},q5e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},W5e={any:[/1/i,/2/i,/3/i,/4/i]},Y5e={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},G5e={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},K5e={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Z5e={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Q5e={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},J5e={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Gse={ordinalNumber:Wse({matchPattern:B5e,parsePattern:U5e,valueCallback:r=>parseInt(r,10)}),era:Qy({matchPatterns:H5e,defaultMatchWidth:"wide",parsePatterns:V5e,defaultParseWidth:"any"}),quarter:Qy({matchPatterns:q5e,defaultMatchWidth:"wide",parsePatterns:W5e,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Qy({matchPatterns:Y5e,defaultMatchWidth:"wide",parsePatterns:G5e,defaultParseWidth:"any"}),day:Qy({matchPatterns:K5e,defaultMatchWidth:"wide",parsePatterns:Z5e,defaultParseWidth:"any"}),dayPeriod:Qy({matchPatterns:Q5e,defaultMatchWidth:"any",parsePatterns:J5e,defaultParseWidth:"any"})}});var Pj,Zse=y(()=>{Lse();zse();Bse();Vse();Kse();Pj={code:"en-US",formatDistance:Ose,formatLong:$se,formatRelative:jse,localize:Hse,match:Gse,options:{weekStartsOn:0,firstWeekContainsDate:1}}});var Qse=y(()=>{Zse()});function Jse(r,e){let t=dt(r,e==null?void 0:e.in);return bae(t,r_(t))+1}var Mj=y(()=>{wj();Dj();Cn()});function Xse(r,e){let t=dt(r,e==null?void 0:e.in),n=+qf(t)-+Tae(t);return Math.round(n/YM)+1}var _j=y(()=>{Wy();Sw();Sj();Cn()});function i_(r,e){var d,u,p,m,f,h,g,v;let t=dt(r,e==null?void 0:e.in),n=t.getFullYear(),i=lc(),a=(v=(g=(m=(p=e==null?void 0:e.firstWeekContainsDate)!=null?p:(u=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)!=null?m:i.firstWeekContainsDate)!=null?g:(h=(f=i.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)!=null?v:1,s=Ln((e==null?void 0:e.in)||r,0);s.setFullYear(n+1,0,a),s.setHours(0,0,0,0);let o=Ca(s,e),l=Ln((e==null?void 0:e.in)||r,0);l.setFullYear(n,0,a),l.setHours(0,0,0,0);let c=Ca(l,e);return+t>=+o?n+1:+t>=+c?n:n-1}var a_=y(()=>{Yy();gl();Gy();Cn()});function eoe(r,e){var o,l,c,d,u,p,m,f;let t=lc(),n=(f=(m=(d=(c=e==null?void 0:e.firstWeekContainsDate)!=null?c:(l=(o=e==null?void 0:e.locale)==null?void 0:o.options)==null?void 0:l.firstWeekContainsDate)!=null?d:t.firstWeekContainsDate)!=null?m:(p=(u=t.locale)==null?void 0:u.options)==null?void 0:p.firstWeekContainsDate)!=null?f:1,i=i_(r,e),a=Ln((e==null?void 0:e.in)||r,0);return a.setFullYear(i,0,n),a.setHours(0,0,0,0),Ca(a,e)}var Aj=y(()=>{Yy();gl();a_();Gy()});function toe(r,e){let t=dt(r,e==null?void 0:e.in),n=+Ca(t,e)-+eoe(t,e);return Math.round(n/YM)+1}var Ij=y(()=>{Wy();Gy();Aj();Cn()});function fr(r,e){let t=r<0?"-":"",n=Math.abs(r).toString().padStart(e,"0");return t+n}var Nj=y(()=>{});var zd,roe=y(()=>{Nj();zd={y(r,e){let t=r.getFullYear(),n=t>0?t:1-t;return fr(e==="yy"?n%100:n,e.length)},M(r,e){let t=r.getMonth();return e==="M"?String(t+1):fr(t+1,2)},d(r,e){return fr(r.getDate(),e.length)},a(r,e){let t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(r,e){return fr(r.getHours()%12||12,e.length)},H(r,e){return fr(r.getHours(),e.length)},m(r,e){return fr(r.getMinutes(),e.length)},s(r,e){return fr(r.getSeconds(),e.length)},S(r,e){let t=e.length,n=r.getMilliseconds(),i=Math.trunc(n*Math.pow(10,t-3));return fr(i,e.length)}}});function noe(r,e=""){let t=r>0?"-":"+",n=Math.abs(r),i=Math.trunc(n/60),a=n%60;return a===0?t+String(i):t+String(i)+e+fr(a,2)}function ioe(r,e){return r%60===0?(r>0?"-":"+")+fr(Math.abs(r)/60,2):Wf(r,e)}function Wf(r,e=""){let t=r>0?"-":"+",n=Math.abs(r),i=fr(Math.trunc(n/60),2),a=fr(n%60,2);return t+i+e+a}var Jy,Rj,aoe=y(()=>{Mj();_j();QM();Ij();a_();Nj();roe();Jy={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Rj={G:function(r,e,t){let n=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){let n=r.getFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return zd.y(r,e)},Y:function(r,e,t,n){let i=i_(r,n),a=i>0?i:1-i;if(e==="YY"){let s=a%100;return fr(s,2)}return e==="Yo"?t.ordinalNumber(a,{unit:"year"}):fr(a,e.length)},R:function(r,e){let t=ZM(r);return fr(t,e.length)},u:function(r,e){let t=r.getFullYear();return fr(t,e.length)},Q:function(r,e,t){let n=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return fr(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){let n=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return fr(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){let n=r.getMonth();switch(e){case"M":case"MM":return zd.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){let n=r.getMonth();switch(e){case"L":return String(n+1);case"LL":return fr(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){let i=toe(r,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):fr(i,e.length)},I:function(r,e,t){let n=Xse(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):fr(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):zd.d(r,e)},D:function(r,e,t){let n=Jse(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):fr(n,e.length)},E:function(r,e,t){let n=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){let i=r.getDay(),a=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(a);case"ee":return fr(a,2);case"eo":return t.ordinalNumber(a,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){let i=r.getDay(),a=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(a);case"cc":return fr(a,e.length);case"co":return t.ordinalNumber(a,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(r,e,t){let n=r.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return fr(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){let i=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(r,e,t){let n=r.getHours(),i;switch(n===12?i=Jy.noon:n===0?i=Jy.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(r,e,t){let n=r.getHours(),i;switch(n>=17?i=Jy.evening:n>=12?i=Jy.afternoon:n>=4?i=Jy.morning:i=Jy.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let n=r.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return zd.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):zd.H(r,e)},K:function(r,e,t){let n=r.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):fr(n,e.length)},k:function(r,e,t){let n=r.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):fr(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):zd.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):zd.s(r,e)},S:function(r,e){return zd.S(r,e)},X:function(r,e,t){let n=r.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return ioe(n);case"XXXX":case"XX":return Wf(n);case"XXXXX":case"XXX":default:return Wf(n,":")}},x:function(r,e,t){let n=r.getTimezoneOffset();switch(e){case"x":return ioe(n);case"xxxx":case"xx":return Wf(n);case"xxxxx":case"xxx":default:return Wf(n,":")}},O:function(r,e,t){let n=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+noe(n,":");case"OOOO":default:return"GMT"+Wf(n,":")}},z:function(r,e,t){let n=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+noe(n,":");case"zzzz":default:return"GMT"+Wf(n,":")}},t:function(r,e,t){let n=Math.trunc(+r/1e3);return fr(n,e.length)},T:function(r,e,t){return fr(+r,e.length)}}});var soe,ooe,X5e,loe,coe=y(()=>{soe=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},ooe=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},X5e=(r,e)=>{let t=r.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return soe(r,e);let a;switch(n){case"P":a=e.dateTime({width:"short"});break;case"PP":a=e.dateTime({width:"medium"});break;case"PPP":a=e.dateTime({width:"long"});break;case"PPPP":default:a=e.dateTime({width:"full"});break}return a.replace("{{date}}",soe(n,e)).replace("{{time}}",ooe(i,e))},loe={p:ooe,P:X5e}});function doe(r){return eKe.test(r)}function uoe(r){return tKe.test(r)}function poe(r,e,t){let n=nKe(r,e,t);if(console.warn(n),rKe.includes(r))throw new RangeError(n)}function nKe(r,e,t){let n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var eKe,tKe,rKe,moe=y(()=>{eKe=/^D+$/,tKe=/^Y+$/,rKe=["D","DD","YY","YYYY"]});function P(r,e,t){var d,u,p,m,f,h,g,v,k,b,w,S,x,C,D,_,O,L;let n=lc(),i=(u=(d=t==null?void 0:t.locale)!=null?d:n.locale)!=null?u:Pj,a=(b=(k=(h=(f=t==null?void 0:t.firstWeekContainsDate)!=null?f:(m=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:m.firstWeekContainsDate)!=null?h:n.firstWeekContainsDate)!=null?k:(v=(g=n.locale)==null?void 0:g.options)==null?void 0:v.firstWeekContainsDate)!=null?b:1,s=(L=(O=(C=(x=t==null?void 0:t.weekStartsOn)!=null?x:(S=(w=t==null?void 0:t.locale)==null?void 0:w.options)==null?void 0:S.weekStartsOn)!=null?C:n.weekStartsOn)!=null?O:(_=(D=n.locale)==null?void 0:D.options)==null?void 0:_.weekStartsOn)!=null?L:0,o=dt(r,t==null?void 0:t.in);if(!bi(o))throw new RangeError("Invalid time value");let l=e.match(aKe).map(N=>{let R=N[0];if(R==="p"||R==="P"){let z=loe[R];return z(N,i.formatLong)}return N}).join("").match(iKe).map(N=>{if(N==="''")return{isToken:!1,value:"'"};let R=N[0];if(R==="'")return{isToken:!1,value:cKe(N)};if(Rj[R])return{isToken:!0,value:N};if(R.match(lKe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+R+"`");return{isToken:!1,value:N}});i.localize.preprocessor&&(l=i.localize.preprocessor(o,l));let c={firstWeekContainsDate:a,weekStartsOn:s,locale:i};return l.map(N=>{if(!N.isToken)return N.value;let R=N.value;(!(t!=null&&t.useAdditionalWeekYearTokens)&&uoe(R)||!(t!=null&&t.useAdditionalDayOfYearTokens)&&doe(R))&&poe(R,e,String(r));let z=Rj[R[0]];return z(o,R,i.localize,c)}).join("")}function cKe(r){let e=r.match(sKe);return e?e[1].replace(oKe,"'"):r}var iKe,aKe,sKe,oKe,lKe,foe=y(()=>{Qse();Yy();aoe();coe();moe();Cj();Cn();iKe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,aKe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,sKe=/^'([^]*?)'?$/,oKe=/''/g,lKe=/[a-zA-Z]/});var hoe=y(()=>{});var goe=y(()=>{});var yoe=y(()=>{});var voe=y(()=>{});var boe=y(()=>{});var Toe=y(()=>{});var koe=y(()=>{});var woe=y(()=>{});var Soe=y(()=>{});var Eoe=y(()=>{});var xoe=y(()=>{});var Coe=y(()=>{});var Doe=y(()=>{});var Poe=y(()=>{});var Moe=y(()=>{});var _oe=y(()=>{});var Aoe=y(()=>{});var Ioe=y(()=>{});var Noe=y(()=>{});var Roe=y(()=>{});var Ooe=y(()=>{});var Loe=y(()=>{});var Foe=y(()=>{});var $oe=y(()=>{});var zoe=y(()=>{});var joe=y(()=>{});var Boe=y(()=>{});var Uoe=y(()=>{});var Hoe=y(()=>{});var Voe=y(()=>{});var qoe=y(()=>{});var Woe=y(()=>{});var Yoe=y(()=>{});var Goe=y(()=>{});var Koe=y(()=>{});var Zoe=y(()=>{});var Qoe=y(()=>{});var Joe=y(()=>{});var Xoe=y(()=>{});var ele=y(()=>{});var tle=y(()=>{});function Oj(r,e){return+dt(r)<+dt(e)}var rle=y(()=>{Cn()});var nle=y(()=>{});var ile=y(()=>{});var ale=y(()=>{});var sle=y(()=>{});var ole=y(()=>{});var lle=y(()=>{});var cle=y(()=>{});var dle=y(()=>{});var ule=y(()=>{});var ple=y(()=>{});var mle=y(()=>{});var fle=y(()=>{});var hle=y(()=>{});var gle=y(()=>{});var yle=y(()=>{});var vle=y(()=>{});var ble=y(()=>{});var Tle=y(()=>{});var kle=y(()=>{});var wle=y(()=>{});var Sle=y(()=>{});var Ele=y(()=>{});var xle=y(()=>{});var Cle=y(()=>{});var Dle=y(()=>{});var Ple=y(()=>{});var Mle=y(()=>{});var _le=y(()=>{});var Ale=y(()=>{});var Ile=y(()=>{});var Nle=y(()=>{});var Rle=y(()=>{});var Ole=y(()=>{});var Lle=y(()=>{});var Fle=y(()=>{});var $le=y(()=>{});var zle=y(()=>{});var jle=y(()=>{});var Ble=y(()=>{});var Ule=y(()=>{});function Xy(r,e,t){return Vf(r,-e,t)}var Hle=y(()=>{GM()});var Vle=y(()=>{});var qle=y(()=>{});var Wle=y(()=>{});var Yle=y(()=>{});var Gle=y(()=>{});var Kle=y(()=>{});var Zle=y(()=>{});var Qle=y(()=>{});var Jle=y(()=>{});var Xle=y(()=>{});var ece=y(()=>{});var tce=y(()=>{});var rce=y(()=>{});var nce=y(()=>{});var ice=y(()=>{});var ace=y(()=>{});var sce=y(()=>{});var oce=y(()=>{});var lce=y(()=>{});var cce=y(()=>{});var dce=y(()=>{});var uce=y(()=>{});var pce=y(()=>{});var mce=y(()=>{});var fce=y(()=>{});function Ls(r,e){var c;let t=()=>Ln(e==null?void 0:e.in,NaN),n=(c=e==null?void 0:e.additionalDigits)!=null?c:2,i=mKe(r),a;if(i.date){let d=fKe(i.date,n);a=hKe(d.restDateString,d.year)}if(!a||isNaN(+a))return t();let s=+a,o=0,l;if(i.time&&(o=gKe(i.time),isNaN(o)))return t();if(i.timezone){if(l=yKe(i.timezone),isNaN(l))return t()}else{let d=new Date(s+o),u=dt(0,e==null?void 0:e.in);return u.setFullYear(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()),u.setHours(d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds()),u}return dt(s+o+l,e==null?void 0:e.in)}function mKe(r){let e={},t=r.split(s_.dateTimeDelimiter),n;if(t.length>2)return e;if(/:/.test(t[0])?n=t[0]:(e.date=t[0],n=t[1],s_.timeZoneDelimiter.test(e.date)&&(e.date=r.split(s_.timeZoneDelimiter)[0],n=r.substr(e.date.length,r.length))),n){let i=s_.timezone.exec(n);i?(e.time=n.replace(i[1],""),e.timezone=i[1]):e.time=n}return e}function fKe(r,e){let t=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=r.match(t);if(!n)return{year:NaN,restDateString:""};let i=n[1]?parseInt(n[1]):null,a=n[2]?parseInt(n[2]):null;return{year:a===null?i:a*100,restDateString:r.slice((n[1]||n[2]).length)}}function hKe(r,e){if(e===null)return new Date(NaN);let t=r.match(dKe);if(!t)return new Date(NaN);let n=!!t[4],i=xw(t[1]),a=xw(t[2])-1,s=xw(t[3]),o=xw(t[4]),l=xw(t[5])-1;if(n)return wKe(e,o,l)?vKe(e,o,l):new Date(NaN);{let c=new Date(0);return!TKe(e,a,s)||!kKe(e,i)?new Date(NaN):(c.setUTCFullYear(e,a,Math.max(i,s)),c)}}function xw(r){return r?parseInt(r):1}function gKe(r){let e=r.match(uKe);if(!e)return NaN;let t=Lj(e[1]),n=Lj(e[2]),i=Lj(e[3]);return SKe(t,n,i)?t*yj+n*gj+i*1e3:NaN}function Lj(r){return r&&parseFloat(r.replace(",","."))||0}function yKe(r){if(r==="Z")return 0;let e=r.match(pKe);if(!e)return 0;let t=e[1]==="+"?-1:1,n=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return EKe(n,i)?t*(n*yj+i*gj):NaN}function vKe(r,e,t){let n=new Date(0);n.setUTCFullYear(r,0,4);let i=n.getUTCDay()||7,a=(e-1)*7+t+1-i;return n.setUTCDate(n.getUTCDate()+a),n}function hce(r){return r%400===0||r%4===0&&r%100!==0}function TKe(r,e,t){return e>=0&&e<=11&&t>=1&&t<=(bKe[e]||(hce(r)?29:28))}function kKe(r,e){return e>=1&&e<=(hce(r)?366:365)}function wKe(r,e,t){return e>=1&&e<=53&&t>=0&&t<=6}function SKe(r,e,t){return r===24?e===0&&t===0:t>=0&&t<60&&e>=0&&e<60&&r>=0&&r<25}function EKe(r,e){return e>=0&&e<=59}var s_,dKe,uKe,pKe,bKe,gce=y(()=>{Wy();gl();Cn();s_={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},dKe=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,uKe=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,pKe=/^([+-])(\d{2})(?::?(\d{2}))?$/;bKe=[31,null,31,30,31,30,31,31,30,31,30,31]});var yce=y(()=>{});var vce=y(()=>{});var bce=y(()=>{});var Tce=y(()=>{});var kce=y(()=>{});var wce=y(()=>{});var Sce=y(()=>{});var Ece=y(()=>{});var xce=y(()=>{});var Cce=y(()=>{});var Dce=y(()=>{});var Pce=y(()=>{});var Mce=y(()=>{});var _ce=y(()=>{});var Ace=y(()=>{});var Ice=y(()=>{});var Nce=y(()=>{});var Rce=y(()=>{});var Oce=y(()=>{});var Lce=y(()=>{});var Fce=y(()=>{});var $ce=y(()=>{});var zce=y(()=>{});var jce=y(()=>{});var Bce=y(()=>{});var Uce=y(()=>{});var Hce=y(()=>{});var Vce=y(()=>{});var qce=y(()=>{});var Wce=y(()=>{});var Yce=y(()=>{});var Gce=y(()=>{});var Kce=y(()=>{});var Zce=y(()=>{});var Qce=y(()=>{});var Jce=y(()=>{});var Xce=y(()=>{});var ede=y(()=>{});var tde=y(()=>{});var rde=y(()=>{});var nde=y(()=>{});var ide=y(()=>{});var ade=y(()=>{});var sde=y(()=>{});var ode=y(()=>{});var lde=y(()=>{});var Br=y(()=>{uae();hae();GM();yae();wae();gae();Sae();bj();Eae();xae();Dae();Mae();_ae();Nae();Rae();Oae();Lae();Fae();gl();$ae();zae();Uae();wj();Hae();Vae();qae();Yae();Gae();Kae();Zae();Qae();Xae();ese();tse();ase();sse();ose();lse();cse();dse();use();pse();mse();hse();gse();yse();bse();wse();Sse();rse();Ese();xse();Dse();Pse();Mse();nse();_se();Ase();Ise();Nse();Cse();kse();Rse();foe();hoe();goe();yoe();voe();boe();Toe();koe();woe();Soe();Eoe();xoe();Coe();Doe();Poe();Mj();Moe();Aoe();Ioe();Noe();Roe();Ooe();_j();QM();Loe();Foe();$oe();zoe();joe();Wae();Boe();Uoe();Hoe();Ij();Voe();a_();Woe();Yoe();Goe();Koe();Zoe();Qoe();Joe();Xoe();ele();tle();rle();xj();nle();ile();ale();sle();ole();ise();_oe();fle();hle();gle();jae();vle();Tle();kle();Sle();Ele();xle();Dle();ble();Ple();pae();mae();Mle();_le();Ale();Ile();Nle();Rle();Ole();Lle();Fle();$le();zle();jle();Cj();Ble();fae();Ule();Vle();qle();Yle();Gle();qoe();Kle();Wle();Zle();Qle();Aae();Jle();Xle();ece();tce();Iae();rce();nce();ice();ace();sce();oce();lce();cce();dce();uce();pce();mce();fce();mle();gce();yce();vce();bce();Tce();kce();wce();Sce();Ece();xce();Cce();Dce();Pce();Mce();_ce();Ace();Ice();Rce();Oce();ule();Lce();Fce();$ce();ple();dle();kae();zce();jce();Nce();Bce();Uce();cle();Hce();Vce();XM();qce();yle();Sw();Sj();wle();vse();fse();Cle();Wce();Yce();Gy();Aj();Dj();Gce();Zce();Qce();Hle();Jce();Jae();Xce();ede();Kce();tde();rde();nde();ide();Cn();lle();ade();sde();ode();lde()});var jd=E(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});var yn=require("obsidian"),Fj="YYYY-MM-DD",$j="gggg-[W]ww",cde="YYYY-MM",dde="YYYY-[Q]Q",ude="YYYY";function Cw(r){var t,n;let e=window.app.plugins.getPlugin("periodic-notes");return e&&((n=(t=e.settings)==null?void 0:t[r])==null?void 0:n.enabled)}function Dw(){var r,e,t,n;try{let{internalPlugins:i,plugins:a}=window.app;if(Cw("daily")){let{format:c,folder:d,template:u}=((e=(r=a.getPlugin("periodic-notes"))==null?void 0:r.settings)==null?void 0:e.daily)||{};return{format:c||Fj,folder:(d==null?void 0:d.trim())||"",template:(u==null?void 0:u.trim())||""}}let{folder:s,format:o,template:l}=((n=(t=i.getPluginById("daily-notes"))==null?void 0:t.instance)==null?void 0:n.options)||{};return{format:o||Fj,folder:(s==null?void 0:s.trim())||"",template:(l==null?void 0:l.trim())||""}}catch(i){console.info("No custom daily note settings found!",i)}}function Pw(){var r,e,t,n,i,a,s;try{let o=window.app.plugins,l=(r=o.getPlugin("calendar"))==null?void 0:r.options,c=(t=(e=o.getPlugin("periodic-notes"))==null?void 0:e.settings)==null?void 0:t.weekly;if(Cw("weekly"))return{format:c.format||$j,folder:((n=c.folder)==null?void 0:n.trim())||"",template:((i=c.template)==null?void 0:i.trim())||""};let d=l||{};return{format:d.weeklyNoteFormat||$j,folder:((a=d.weeklyNoteFolder)==null?void 0:a.trim())||"",template:((s=d.weeklyNoteTemplate)==null?void 0:s.trim())||""}}catch(o){console.info("No custom weekly note settings found!",o)}}function Mw(){var e,t,n,i;let r=window.app.plugins;try{let a=Cw("monthly")&&((t=(e=r.getPlugin("periodic-notes"))==null?void 0:e.settings)==null?void 0:t.monthly)||{};return{format:a.format||cde,folder:((n=a.folder)==null?void 0:n.trim())||"",template:((i=a.template)==null?void 0:i.trim())||""}}catch(a){console.info("No custom monthly note settings found!",a)}}function _w(){var e,t,n,i;let r=window.app.plugins;try{let a=Cw("quarterly")&&((t=(e=r.getPlugin("periodic-notes"))==null?void 0:e.settings)==null?void 0:t.quarterly)||{};return{format:a.format||dde,folder:((n=a.folder)==null?void 0:n.trim())||"",template:((i=a.template)==null?void 0:i.trim())||""}}catch(a){console.info("No custom quarterly note settings found!",a)}}function Aw(){var e,t,n,i;let r=window.app.plugins;try{let a=Cw("yearly")&&((t=(e=r.getPlugin("periodic-notes"))==null?void 0:e.settings)==null?void 0:t.yearly)||{};return{format:a.format||ude,folder:((n=a.folder)==null?void 0:n.trim())||"",template:((i=a.template)==null?void 0:i.trim())||""}}catch(a){console.info("No custom yearly note settings found!",a)}}function pde(...r){let e=[];for(let n=0,i=r.length;n{let k=n(),b=r.clone().set({hour:k.get("hour"),minute:k.get("minute"),second:k.get("second")});return f&&b.add(parseInt(h,10),g),v?b.format(v.substring(1).trim()):b.format(a)}).replace(/{{\s*yesterday\s*}}/gi,r.clone().subtract(1,"day").format(a)).replace(/{{\s*tomorrow\s*}}/gi,r.clone().add(1,"d").format(a)));return e.foldManager.save(u,l),u}catch(u){console.error(`Failed to create file: '${d}'`,u),new yn.Notice("Unable to create new file.")}}function MKe(r,e){var t;return(t=e[vl(r,"day")])!=null?t:null}function _Ke(){let{vault:r}=window.app,{folder:e}=Dw(),t=r.getAbstractFileByPath(yn.normalizePath(e));if(!t)throw new zj("Failed to find daily notes folder");let n={};return yn.Vault.recurseChildren(t,i=>{if(i instanceof yn.TFile){let a=tv(i,"day");if(a){let s=vl(a,"day");n[s]=i}}}),n}var jj=class extends Error{};function AKe(){let{moment:r}=window,e=r.localeData()._week.dow,t=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];for(;e;)t.push(t.shift()),e--;return t}function IKe(r){return AKe().indexOf(r.toLowerCase())}async function gde(r){let{vault:e}=window.app,{template:t,format:n,folder:i}=Pw(),[a,s]=await ev(t),o=r.format(n),l=await Iw(i,o);try{let c=await e.create(l,a.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(d,u,p,m,f,h)=>{let g=window.moment(),v=r.clone().set({hour:g.get("hour"),minute:g.get("minute"),second:g.get("second")});return p&&v.add(parseInt(m,10),f),h?v.format(h.substring(1).trim()):v.format(n)}).replace(/{{\s*title\s*}}/gi,o).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*(sunday|monday|tuesday|wednesday|thursday|friday|saturday)\s*:(.*?)}}/gi,(d,u,p)=>{let m=IKe(u);return r.weekday(m).format(p.trim())}));return window.app.foldManager.save(c,s),c}catch(c){console.error(`Failed to create file: '${l}'`,c),new yn.Notice("Unable to create new file.")}}function NKe(r,e){var t;return(t=e[vl(r,"week")])!=null?t:null}function RKe(){let r={};if(!vde())return r;let{vault:e}=window.app,{folder:t}=Pw(),n=e.getAbstractFileByPath(yn.normalizePath(t));if(!n)throw new jj("Failed to find weekly notes folder");return yn.Vault.recurseChildren(n,i=>{if(i instanceof yn.TFile){let a=tv(i,"week");if(a){let s=vl(a,"week");r[s]=i}}}),r}var Bj=class extends Error{};async function yde(r){let{vault:e}=window.app,{template:t,format:n,folder:i}=Mw(),[a,s]=await ev(t),o=r.format(n),l=await Iw(i,o);try{let c=await e.create(l,a.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(d,u,p,m,f,h)=>{let g=window.moment(),v=r.clone().set({hour:g.get("hour"),minute:g.get("minute"),second:g.get("second")});return p&&v.add(parseInt(m,10),f),h?v.format(h.substring(1).trim()):v.format(n)}).replace(/{{\s*date\s*}}/gi,o).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi,o));return window.app.foldManager.save(c,s),c}catch(c){console.error(`Failed to create file: '${l}'`,c),new yn.Notice("Unable to create new file.")}}function OKe(r,e){var t;return(t=e[vl(r,"month")])!=null?t:null}function LKe(){let r={};if(!bde())return r;let{vault:e}=window.app,{folder:t}=Mw(),n=e.getAbstractFileByPath(yn.normalizePath(t));if(!n)throw new Bj("Failed to find monthly notes folder");return yn.Vault.recurseChildren(n,i=>{if(i instanceof yn.TFile){let a=tv(i,"month");if(a){let s=vl(a,"month");r[s]=i}}}),r}var Uj=class extends Error{};async function FKe(r){let{vault:e}=window.app,{template:t,format:n,folder:i}=_w(),[a,s]=await ev(t),o=r.format(n),l=await Iw(i,o);try{let c=await e.create(l,a.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(d,u,p,m,f,h)=>{let g=window.moment(),v=r.clone().set({hour:g.get("hour"),minute:g.get("minute"),second:g.get("second")});return p&&v.add(parseInt(m,10),f),h?v.format(h.substring(1).trim()):v.format(n)}).replace(/{{\s*date\s*}}/gi,o).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi,o));return window.app.foldManager.save(c,s),c}catch(c){console.error(`Failed to create file: '${l}'`,c),new yn.Notice("Unable to create new file.")}}function $Ke(r,e){var t;return(t=e[vl(r,"quarter")])!=null?t:null}function zKe(){let r={};if(!Tde())return r;let{vault:e}=window.app,{folder:t}=_w(),n=e.getAbstractFileByPath(yn.normalizePath(t));if(!n)throw new Uj("Failed to find quarterly notes folder");return yn.Vault.recurseChildren(n,i=>{if(i instanceof yn.TFile){let a=tv(i,"quarter");if(a){let s=vl(a,"quarter");r[s]=i}}}),r}var Hj=class extends Error{};async function jKe(r){let{vault:e}=window.app,{template:t,format:n,folder:i}=Aw(),[a,s]=await ev(t),o=r.format(n),l=await Iw(i,o);try{let c=await e.create(l,a.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(d,u,p,m,f,h)=>{let g=window.moment(),v=r.clone().set({hour:g.get("hour"),minute:g.get("minute"),second:g.get("second")});return p&&v.add(parseInt(m,10),f),h?v.format(h.substring(1).trim()):v.format(n)}).replace(/{{\s*date\s*}}/gi,o).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi,o));return window.app.foldManager.save(c,s),c}catch(c){console.error(`Failed to create file: '${l}'`,c),new yn.Notice("Unable to create new file.")}}function BKe(r,e){var t;return(t=e[vl(r,"year")])!=null?t:null}function UKe(){let r={};if(!kde())return r;let{vault:e}=window.app,{folder:t}=Aw(),n=e.getAbstractFileByPath(yn.normalizePath(t));if(!n)throw new Hj("Failed to find yearly notes folder");return yn.Vault.recurseChildren(n,i=>{if(i instanceof yn.TFile){let a=tv(i,"year");if(a){let s=vl(a,"year");r[s]=i}}}),r}function HKe(){var n,i;let{app:r}=window,e=r.internalPlugins.plugins["daily-notes"];if(e&&e.enabled)return!0;let t=r.plugins.getPlugin("periodic-notes");return t&&((i=(n=t.settings)==null?void 0:n.daily)==null?void 0:i.enabled)}function vde(){var t,n;let{app:r}=window;if(r.plugins.getPlugin("calendar"))return!0;let e=r.plugins.getPlugin("periodic-notes");return e&&((n=(t=e.settings)==null?void 0:t.weekly)==null?void 0:n.enabled)}function bde(){var t,n;let{app:r}=window,e=r.plugins.getPlugin("periodic-notes");return e&&((n=(t=e.settings)==null?void 0:t.monthly)==null?void 0:n.enabled)}function Tde(){var t,n;let{app:r}=window,e=r.plugins.getPlugin("periodic-notes");return e&&((n=(t=e.settings)==null?void 0:t.quarterly)==null?void 0:n.enabled)}function kde(){var t,n;let{app:r}=window,e=r.plugins.getPlugin("periodic-notes");return e&&((n=(t=e.settings)==null?void 0:t.yearly)==null?void 0:n.enabled)}function VKe(r){let e={day:Dw,week:Pw,month:Mw,quarter:_w,year:Aw}[r];return e()}function qKe(r,e){return{day:hde,month:yde,week:gde}[r](e)}xt.DEFAULT_DAILY_NOTE_FORMAT=Fj;xt.DEFAULT_MONTHLY_NOTE_FORMAT=cde;xt.DEFAULT_QUARTERLY_NOTE_FORMAT=dde;xt.DEFAULT_WEEKLY_NOTE_FORMAT=$j;xt.DEFAULT_YEARLY_NOTE_FORMAT=ude;xt.appHasDailyNotesPluginLoaded=HKe;xt.appHasMonthlyNotesPluginLoaded=bde;xt.appHasQuarterlyNotesPluginLoaded=Tde;xt.appHasWeeklyNotesPluginLoaded=vde;xt.appHasYearlyNotesPluginLoaded=kde;xt.createDailyNote=hde;xt.createMonthlyNote=yde;xt.createPeriodicNote=qKe;xt.createQuarterlyNote=FKe;xt.createWeeklyNote=gde;xt.createYearlyNote=jKe;xt.getAllDailyNotes=_Ke;xt.getAllMonthlyNotes=LKe;xt.getAllQuarterlyNotes=zKe;xt.getAllWeeklyNotes=RKe;xt.getAllYearlyNotes=UKe;xt.getDailyNote=MKe;xt.getDailyNoteSettings=Dw;xt.getDateFromFile=tv;xt.getDateFromPath=PKe;xt.getDateUID=vl;xt.getMonthlyNote=OKe;xt.getMonthlyNoteSettings=Mw;xt.getPeriodicNoteSettings=VKe;xt.getQuarterlyNote=$Ke;xt.getQuarterlyNoteSettings=_w;xt.getTemplateInfo=ev;xt.getWeeklyNote=NKe;xt.getWeeklyNoteSettings=Pw;xt.getYearlyNote=BKe;xt.getYearlyNoteSettings=Aw});function wde(r){return r.replace(/\\/g,"/").replace(/^\/+/,"").replace(/\/+$/,"")}function cc(r){let e=Array.isArray(r)?r:typeof r=="string"?r.split(","):[];return Array.from(new Set(e.map(t=>wde(t.trim())).filter(t=>t.length>0)))}function rv(r,e){let t=wde(r);return e.some(n=>t===n||t.startsWith(`${n}/`))}var Nw=y(()=>{});function WKe(r){let e=r.toLowerCase();return e==="true"||e==="false"?e==="true":r}function Rw(r){let e=r.trim();return(e.startsWith("#")?e.slice(1).trim():e).replace(/\s+/g,"-")}function Vj(r){return r.trim().toLowerCase()==="tags"}function YKe(r){return typeof r=="string"&&r.trim().length===0}function Sde(r,e){return r===e}function dc(r){let e=[],t=new Set,n=i=>{let a=Rw(String(i));!a||t.has(a)||(t.add(a),e.push(a))};return Array.isArray(r)?(r.forEach(n),e):typeof r=="string"&&r.trim().length>0?(n(r),e):[]}function nv(r,e,t){if(!e||!t)return;if(Vj(e)){let a=dc(r.tags),s=Rw(t);a.some(l=>Rw(l)===s)||a.push(s),r.tags=a;return}let n=WKe(t),i=r[e];if(Array.isArray(i)){i.some(a=>Sde(a,n))||i.push(n),r[e]=i;return}if(i==null||YKe(i)){r[e]=n;return}if(Sde(i,n)){r[e]=i;return}r[e]=[i,n]}var iv=y(()=>{});var Ide,Nde,Bd,av,sv,ea,nt,Ja,Ud,Hd,Vd,Pa,xp,Rde,Ode,Ur=y(()=>{Ide="tasknotes-mini-calendar-view",Nde="tasknotes-agenda-view",Bd="tasknotes-pomodoro-view",av="tasknotes-pomodoro-stats-view",sv="tasknotes-stats-view",ea="data-changed",nt="task-updated",Ja="task-deleted",Ud="pomodoro-start",Hd="pomodoro-complete",Vd="pomodoro-interrupt",Pa="pomodoro-tick",xp="date-changed",Rde=[{id:"title",label:"Title",category:"text",supportedOperators:["is","is-not","contains","does-not-contain","is-empty","is-not-empty"],valueInputType:"text"},{id:"path",label:"Path",category:"select",supportedOperators:["contains","does-not-contain","is-empty","is-not-empty"],valueInputType:"select"},{id:"status",label:"Status",category:"select",supportedOperators:["is","is-not","is-empty","is-not-empty"],valueInputType:"select"},{id:"priority",label:"Priority",category:"select",supportedOperators:["is","is-not","is-empty","is-not-empty"],valueInputType:"select"},{id:"tags",label:"Tags",category:"select",supportedOperators:["contains","does-not-contain","is-empty","is-not-empty"],valueInputType:"select"},{id:"contexts",label:"Contexts",category:"select",supportedOperators:["contains","does-not-contain","is-empty","is-not-empty"],valueInputType:"select"},{id:"projects",label:"Projects",category:"select",supportedOperators:["contains","does-not-contain","is-empty","is-not-empty"],valueInputType:"select"},{id:"blockedBy",label:"Blocked By",category:"select",supportedOperators:["contains","does-not-contain","is-empty","is-not-empty"],valueInputType:"text"},{id:"blocking",label:"Blocking",category:"select",supportedOperators:["contains","does-not-contain","is-empty","is-not-empty"],valueInputType:"text"},{id:"due",label:"Due Date",category:"date",supportedOperators:["is","is-not","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty"],valueInputType:"date"},{id:"scheduled",label:"Scheduled Date",category:"date",supportedOperators:["is","is-not","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty"],valueInputType:"date"},{id:"completedDate",label:"Completed Date",category:"date",supportedOperators:["is","is-not","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty"],valueInputType:"date"},{id:"dateCreated",label:"Created Date",category:"date",supportedOperators:["is","is-not","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty"],valueInputType:"date"},{id:"dateModified",label:"Modified Date",category:"date",supportedOperators:["is","is-not","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty"],valueInputType:"date"},{id:"archived",label:"Archived",category:"boolean",supportedOperators:["is-checked","is-not-checked"],valueInputType:"none"},{id:"hasSubtasks",label:"Has Subtasks",category:"boolean",supportedOperators:["is-checked","is-not-checked"],valueInputType:"none"},{id:"timeEstimate",label:"Time Estimate",category:"numeric",supportedOperators:["is","is-not","is-greater-than","is-less-than","is-greater-than-or-equal","is-less-than-or-equal"],valueInputType:"number"},{id:"recurrence",label:"Recurrence",category:"special",supportedOperators:["is-empty","is-not-empty"],valueInputType:"none"},{id:"status.isCompleted",label:"Completed",category:"boolean",supportedOperators:["is-checked","is-not-checked"],valueInputType:"none"},{id:"dependencies.isBlocked",label:"Blocked",category:"boolean",supportedOperators:["is-checked","is-not-checked"],valueInputType:"none"},{id:"dependencies.isBlocking",label:"Blocking Others",category:"boolean",supportedOperators:["is-checked","is-not-checked"],valueInputType:"none"}],Ode=[{id:"is",label:"is",requiresValue:!0},{id:"is-not",label:"is not",requiresValue:!0},{id:"contains",label:"contains",requiresValue:!0},{id:"does-not-contain",label:"does not contain",requiresValue:!0},{id:"is-before",label:"is before",requiresValue:!0},{id:"is-after",label:"is after",requiresValue:!0},{id:"is-on-or-before",label:"is on or before",requiresValue:!0},{id:"is-on-or-after",label:"is on or after",requiresValue:!0},{id:"is-empty",label:"is empty",requiresValue:!1},{id:"is-not-empty",label:"is not empty",requiresValue:!1},{id:"is-checked",label:"is checked",requiresValue:!1},{id:"is-not-checked",label:"is not checked",requiresValue:!1},{id:"is-greater-than",label:"is greater than",requiresValue:!0},{id:"is-less-than",label:"is less than",requiresValue:!0},{id:"is-greater-than-or-equal",label:"is equal or greater than",requiresValue:!0},{id:"is-less-than-or-equal",label:"is equal or less than",requiresValue:!0}]});var Bde={};et(Bde,{DEFAULT_CORE_FIELDS:()=>Fde,DEFAULT_FIELD_GROUPS:()=>Lde,createDefaultFieldConfig:()=>$de,getFieldsByGroup:()=>n8e,getFieldsForModal:()=>zde,initializeFieldConfig:()=>uc,migrateUserFieldsToFieldConfig:()=>jde});function $de(){return{version:1,fields:[...Fde],groups:[...Lde]}}function zde(r,e){return r.fields.filter(t=>t.enabled).filter(t=>e?t.visibleInCreation:t.visibleInEdit).sort((t,n)=>{var o,l;let i=r.groups.find(c=>c.id===t.group),a=r.groups.find(c=>c.id===n.group),s=((o=i==null?void 0:i.order)!=null?o:0)-((l=a==null?void 0:a.order)!=null?l:0);return s!==0?s:t.order-n.order})}function n8e(r,e){let t=zde(r,e),n=new Map;for(let i of t){let a=n.get(i.group)||[];a.push(i),n.set(i.group,a)}return n}function jde(r){return!r||r.length===0?[]:r.map((e,t)=>({id:e.id||`user-${t}`,fieldType:"user",group:"custom",displayName:e.displayName||`Field ${t+1}`,visibleInCreation:!0,visibleInEdit:!0,order:t,enabled:!0}))}function uc(r,e){if(r)return r;let t=$de();if(e&&e.length>0){let n=jde(e);t.fields.push(...n)}return t}var Lde,Fde,$w=y(()=>{Lde=[{id:"basic",displayName:"Basic Information",order:0,collapsible:!1,defaultCollapsed:!1},{id:"metadata",displayName:"Metadata",order:1,collapsible:!0,defaultCollapsed:!1},{id:"organization",displayName:"Organization",order:2,collapsible:!0,defaultCollapsed:!1},{id:"dependencies",displayName:"Dependencies",order:3,collapsible:!0,defaultCollapsed:!1},{id:"custom",displayName:"Custom Fields",order:4,collapsible:!0,defaultCollapsed:!1}],Fde=[{id:"title",fieldType:"core",group:"basic",displayName:"Title",visibleInCreation:!0,visibleInEdit:!0,order:0,enabled:!0,required:!0},{id:"details",fieldType:"core",group:"basic",displayName:"Details",visibleInCreation:!0,visibleInEdit:!0,order:1,enabled:!0},{id:"contexts",fieldType:"core",group:"metadata",displayName:"Contexts",visibleInCreation:!0,visibleInEdit:!0,order:0,enabled:!0},{id:"tags",fieldType:"core",group:"metadata",displayName:"Tags",visibleInCreation:!0,visibleInEdit:!0,order:1,enabled:!0},{id:"time-estimate",fieldType:"core",group:"metadata",displayName:"Time Estimate",visibleInCreation:!0,visibleInEdit:!0,order:2,enabled:!0},{id:"projects",fieldType:"organization",group:"organization",displayName:"Projects",visibleInCreation:!0,visibleInEdit:!0,order:0,enabled:!0},{id:"subtasks",fieldType:"organization",group:"organization",displayName:"Subtasks",visibleInCreation:!0,visibleInEdit:!0,order:1,enabled:!0},{id:"blocked-by",fieldType:"dependency",group:"dependencies",displayName:"Blocked By",visibleInCreation:!0,visibleInEdit:!0,order:0,enabled:!0},{id:"blocking",fieldType:"dependency",group:"dependencies",displayName:"Blocking",visibleInCreation:!0,visibleInEdit:!0,order:1,enabled:!0}]});function Ude(r,e,t){if(!(e!=null&&e.fields))return!0;let n=e.fields.find(a=>a.id===r);if(!n)return!0;let i=t?n.visibleInCreation:n.visibleInEdit;return!!n.enabled&&!!i}function Hde(r,e){let{getFieldsByGroup:t}=($w(),WM(Bde)),n=t(r,e);return[...r.groups||[]].sort((a,s)=>a.order-s.order).map(a=>({id:a.id,fields:n.get(a.id)||[]})).filter(a=>a.fields.length>0)}var Wj=y(()=>{});function Yj(r){let{container:e,fieldConfig:t,fieldRenderers:n,renderUserField:i}=r,a=n[t.id];return a?(a(e,t),!0):t.fieldType==="user"?(i(e,t),!0):!1}function Vde(r){let e=Hde(r.config,r.isCreationMode),t={groupsRendered:0,fieldsRendered:0,ignoredFieldIds:[]};for(let n of e){if(n.id==="basic")continue;let i=r.container.createDiv({cls:"task-modal__field-group"});t.groupsRendered+=1;for(let a of n.fields)Yj({container:i,fieldConfig:a,fieldRenderers:r.fieldRenderers,renderUserField:r.renderUserField})?t.fieldsRendered+=1:t.ignoredFieldIds.push(a.id)}return t}var qde=y(()=>{Wj()});function Gj(r){let e=typeof r=="function"?r():r,t=e==null?void 0:e.trim();return t||null}function i8e(r,e,t={}){let n=["TaskNotes"],i=Gj(r);return i&&n.push(i),t.category&&n.push(t.category),t.operation&&n.push(t.operation),`${n.map(a=>`[${a}]`).join("")} ${e}`}function o_(r,e,t,n,i){let a=[i8e(t,n,i)];i!=null&&i.details&&a.push(i.details),(i==null?void 0:i.error)!==void 0&&a.push(i.error),r[e](...a)}function I(r={}){var n,i;let e=(n=r.sink)!=null?n:console,t=(i=r.isDebugEnabled)!=null?i:(()=>!1);return{debug(a,s){t()&&o_(e,"debug",r.tag,a,s)},info(a,s){o_(e,"info",r.tag,a,s)},warn(a,s){o_(e,"warn",r.tag,a,s)},error(a,s){o_(e,"error",r.tag,a,s)},child(a){let s=r.tag;return I({...r,tag:()=>{let o=Gj(s),l=Gj(a);return[o,l].filter(Boolean).join("/")}})}}}var G=y(()=>{});function Wde(r,e){let t=Object.keys(e).map(n=>a8e(r,n,e[n]));return t.length===1?t[0]:function(){t.forEach(n=>n())}}function a8e(r,e,t){let n=r[e],i=r.hasOwnProperty(e),a=i?n:function(){return Object.getPrototypeOf(r)[e].apply(this,arguments)},s=t(a);return n&&Object.setPrototypeOf(s,n),Object.setPrototypeOf(o,s),r[e]=o,l;function o(...c){return s===a&&r[e]===o&&l(),s.apply(this,c)}function l(){r[e]===o&&(i?r[e]=a:delete r[e]),s!==a&&(s=a,Object.setPrototypeOf(o,n||Function))}}var Yde=y(()=>{});var Qj={};et(Qj,{EmbeddableMarkdownEditor:()=>Zj,getMarkdownEditorTooltipParent:()=>Kde});function s8e(r){let e=r.workspace.getActiveFile();if(!(e instanceof l_.TFile))throw new Error("Cannot resolve markdown editor prototype without an active markdown file.");let t=r.embedRegistry.embedByExtension.md({app:r,containerEl:activeDocument.createElement("div")},e,"");t.editable=!0,t.showEditor();let n=t.editMode;if(!n)throw t.unload(),new Error("Markdown editor edit mode was not initialized");let i=Object.getPrototypeOf(Object.getPrototypeOf(n));return t.unload(),i.constructor}function o8e(){return typeof app=="undefined"?class{constructor(e,t,n){this.containerEl=activeDocument.createElement("div");this.editor={cm:new qd.EditorView};this.editorEl=activeDocument.createElement("div");this.owner={editMode:null,editor:null};this._loaded=!1;this.app=e,this.containerEl=t}set(e){let t=this.editor.cm;t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})}onUpdate(e,t){}buildLocalExtensions(){return[]}destroy(){}unload(){}}:s8e(app)}function Kde(r){var e,t;return(t=(e=r.ownerDocument)==null?void 0:e.body)!=null?t:activeDocument.body}var l_,pc,qd,Gde,Kj,Zj,Jj=y(()=>{l_=require("obsidian"),pc=require("@codemirror/state"),qd=require("@codemirror/view");Yde();Gde={cursorLocation:void 0,value:"",cls:"",placeholder:"",onEnter:()=>!1,onEscape:()=>{},onTab:()=>!1,onSubmit:()=>{},onBlur:()=>{},onPaste:()=>{},onChange:()=>{},extensions:[],enterVimInsertMode:!1,file:void 0};Kj=class{constructor(e){this.view=e}getDoc(){return this}getValue(){return this.view.state.doc.toString()}setValue(e){this.view.dispatch({changes:{from:0,to:this.view.state.doc.length,insert:e}})}getLine(e){return this.view.state.doc.line(e+1).text}lineCount(){return this.view.state.doc.lines}lastLine(){return this.lineCount()-1}getSelection(){let e=this.view.state.selection.main;return this.view.state.doc.sliceString(e.from,e.to)}somethingSelected(){return!this.view.state.selection.main.empty}getRange(e,t){return this.view.state.doc.sliceString(this.posToOffset(e),this.posToOffset(t))}replaceSelection(e){let t=this.view.state.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:pc.EditorSelection.cursor(n.from+e.length)}));this.view.dispatch(t)}replaceRange(e,t,n){this.view.dispatch({changes:{from:this.posToOffset(t),to:this.posToOffset(n!=null?n:t),insert:e}})}getCursor(e="head"){let t=this.view.state.selection.main;switch(e){case"from":return this.offsetToPos(t.from);case"to":return this.offsetToPos(t.to);case"anchor":return this.offsetToPos(t.anchor);case"head":default:return this.offsetToPos(t.head)}}listSelections(){return this.view.state.selection.ranges.map(e=>({anchor:this.offsetToPos(e.anchor),head:this.offsetToPos(e.head)}))}setCursor(e,t){if(typeof e=="number"){this.setSelection({line:e,ch:t!=null?t:0});return}this.setSelection(e)}setSelection(e,t){this.view.dispatch({selection:pc.EditorSelection.range(this.posToOffset(e),this.posToOffset(t!=null?t:e))})}setSelections(e,t=0){e.length!==0&&this.view.dispatch({selection:pc.EditorSelection.create(e.map(n=>{var i;return pc.EditorSelection.range(this.posToOffset(n.anchor),this.posToOffset((i=n.head)!=null?i:n.anchor))}),t)})}focus(){this.view.focus()}blur(){this.view.contentDOM.blur()}hasFocus(){return this.view.hasFocus}transaction(e){var i,a;if(e.replaceSelection!==void 0){this.replaceSelection(e.replaceSelection);return}let t=(i=e.changes)==null?void 0:i.map(s=>{var o;return{from:this.posToOffset(s.from),to:this.posToOffset((o=s.to)!=null?o:s.from),insert:s.text}}),n=(a=e.selections)!=null?a:e.selection?[e.selection]:void 0;this.view.dispatch({...t?{changes:t}:{},...n&&n.length>0?{selection:pc.EditorSelection.create(n.map(s=>{var o;return pc.EditorSelection.range(this.posToOffset(s.from),this.posToOffset((o=s.to)!=null?o:s.from))}))}:{}})}posToOffset(e){let t=Math.max(1,Math.min(e.line+1,this.view.state.doc.lines)),n=this.view.state.doc.line(t);return Math.max(n.from,Math.min(n.from+e.ch,n.to))}offsetToPos(e){let t=Math.max(0,Math.min(e,this.view.state.doc.length)),n=this.view.state.doc.lineAt(t);return{line:n.number-1,ch:t-n.from}}},Zj=class extends o8e(){constructor(t,n,i={}){super(t,n,{app:t,onMarkdownScroll:()=>{},getMode:()=>"source"});this.hasEnteredVimInsertMode=!1;this.options={...Gde,...i},this.initial_value=this.options.value,this.scope=new l_.Scope(this.app.scope),this.scope.register(["Mod"],"Enter",(a,s)=>!0),this.scope.register(["Mod","Shift"],"Enter",(a,s)=>!0),this.owner.editMode=this,this.owner.editor=this.editor,this.activeEditorOwner={editMode:this,editor:new Kj(this.editor.cm),file:this.getActiveEditorFile()},this.set(i.value||""),this.uninstaller=Wde(this.app.workspace,{setActiveLeaf:a=>function(...s){var o;(o=this.activeCM)!=null&&o.hasFocus||a.call(this,...s)}}),this.options.onBlur!==Gde.onBlur&&this.editor.cm.contentDOM.addEventListener("blur",()=>{this.app.keymap.popScope(this.scope),this._loaded&&this.options.onBlur(this)}),this.editor.cm.contentDOM.addEventListener("focusin",()=>{this.app.keymap.pushScope(this.scope),this.activeEditorOwner.file=this.getActiveEditorFile(),this.app.workspace.activeEditor=this.activeEditorOwner,this.options.enterVimInsertMode&&!this.hasEnteredVimInsertMode&&(this.hasEnteredVimInsertMode=!0,this.enterVimInsertMode())}),i.cls&&this.editorEl.classList.add(i.cls),i.cursorLocation&&this.editor.cm.dispatch({selection:pc.EditorSelection.range(i.cursorLocation.anchor,i.cursorLocation.head)})}getActiveEditorFile(){var t;return this.options.file!==void 0?(t=this.options.file)!=null?t:null:this.app.workspace.getActiveFile()}get value(){return this.editor.cm.state.doc.toString()}setValue(t){this.set(t)}enterVimInsertMode(){window.setTimeout(()=>{var t,n;try{if(!this.app.vault.getConfig("vimMode"))return;let a=(t=window.CodeMirrorAdapter)==null?void 0:t.Vim;if(!a)return;let s=(n=this.editor.cm.cm)!=null?n:this.activeCM;if(!s)return;a.handleKey(s,"i","api")}catch(i){}},50)}onUpdate(t,n){super.onUpdate(t,n),n&&this.options.onChange(this.value,t)}buildLocalExtensions(){let t=super.buildLocalExtensions();return t.push((0,qd.tooltips)({parent:Kde(this.containerEl)})),this.options.placeholder&&t.push((0,qd.placeholder)(this.options.placeholder)),t.push(qd.EditorView.domEventHandlers({paste:n=>{this.options.onPaste(n,this)}})),t.push(pc.Prec.highest(qd.keymap.of([{key:"Enter",run:n=>this.options.onEnter(this,!1,!1),shift:n=>this.options.onEnter(this,!1,!0)},{key:"Shift-Mod-Enter",run:n=>(this.options.onSubmit(this,!0),!0)},{key:"Mod-Enter",run:n=>(this.options.onSubmit(this,!1),!0)},{key:"Escape",run:n=>(this.options.onEscape(this),!0)},{key:"Tab",run:n=>this.options.onTab(this,!1)},{key:"Shift-Tab",run:n=>this.options.onTab(this,!0)}]))),this.options.extensions&&this.options.extensions.length>0&&t.push(...this.options.extensions),t}destroy(){this._loaded&&this.unload(),this.app.keymap.popScope(this.scope);let t=this.app.workspace;t.activeEditor===this.activeEditorOwner&&(t.activeEditor=null),this.uninstaller&&(this.uninstaller(),this.uninstaller=void 0),this.containerEl.empty(),super.destroy()}onunload(){this.destroy()}}});function c8e(){return(Jj(),WM(Qj)).EmbeddableMarkdownEditor}function c_(r,e,t){try{let n=c8e();return new n(r,e,{...t,onSubmit:(i,a)=>t.onSubmit(a),onTab:(i,a)=>t.onTab(a)})}catch(n){l8e.error("Failed to create markdown editor:",{category:"persistence",operation:"create-markdown-editor",error:n});let i=e.createEl("textarea",{cls:t.cls+"-fallback",placeholder:t.placeholder});return i.value=t.value,i.addEventListener("input",a=>{t.onChange(a.target.value)}),i.addEventListener("keydown",a=>{a.key==="Enter"&&(a.ctrlKey||a.metaKey)?(a.preventDefault(),t.onSubmit(a.shiftKey)):a.key==="Escape"?(a.preventDefault(),t.onEscape()):a.key==="Tab"&&t.onTab(a.shiftKey)&&a.preventDefault()}),null}}var l8e,Xj=y(()=>{G();l8e=I({tag:"Modals/TaskModalEditorAdapter"})});function Zde(r){var n;let e=r.parent.createDiv("detail-label");e.textContent=r.label;let t=r.parent.createDiv("tn-task-modal__markdown-editor tn-task-modal__markdown-editor--details");return c_(r.app,t,{value:r.value,placeholder:r.placeholder,cls:"details-editor",onChange:r.onChange,onSubmit:r.onSubmit,onEscape:r.onEscape,onTab:i=>r.tabMovesFocus?i?r.focusPreviousField():r.focusNextField():!1,file:(n=r.file)!=null?n:null})}function Qde(r,e){r==null||r.setValue(e)}function Jde(r){r==null||r.destroy()}var eB=y(()=>{Xj()});function iue(r){let e=f8e(r),t=e.match(rB);if(t){let[,i,a,s]=t,o=Number(i),l=Number(a),c=Number(s);if(!aue(o,l,c))throw new Error(`Invalid date "${r}".`);return new Date(Date.UTC(o,l-1,c,0,0,0,0))}if(!h8e(e))throw new Error(`Invalid date "${r}".`);let n=new Date(e);if(!sue(n))throw new Error(`Invalid date "${r}".`);return n}function u8e(r){if(!sue(r))return"";let e=r.getUTCFullYear(),t=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0");return`${e}-${t}-${n}`}function p8e(r){if(!/^\d{4}-\d{2}-\d{2}$/.test(r))throw new Error(`Invalid date "${r}". Expected YYYY-MM-DD.`);return iue(r),r}function m8e(r){if(!r)return"";let e=r.trim();if(rB.test(e))return e;let t=e.indexOf("T");if(t>-1)return e.slice(0,t);let n=e.indexOf(" ");return n>-1&&rB.test(e.slice(0,n))?e.slice(0,n):u8e(iue(e))}function Xde(r){let e=[],t=new Set;for(let n of r)if(typeof n=="string")try{let i=p8e(m8e(n.trim()));t.has(i)||(t.add(i),e.push(i))}catch(i){}return e}function f8e(r,e="Date string cannot be empty"){if(!r||r.trim().length===0)throw new Error(e);return r.trim()}function h8e(r){let e=r.match(d8e);if(!e)return!1;let[,t,n,i,a,s,o,,l,c,d]=e;return aue(Number(t),Number(n),Number(i))&&g8e(Number(a),Number(s),Number(o))&&y8e(l,c,d)}function aue(r,e,t){let n=new Date(Date.UTC(r,e-1,t,0,0,0,0));return n.getUTCFullYear()===r&&n.getUTCMonth()===e-1&&n.getUTCDate()===t}function g8e(r,e,t){return r>=0&&r<=23&&e>=0&&e<=59&&t>=0&&t<=59}function y8e(r,e,t){if(!r)return!0;let n=Number(e),i=Number(t);return!(n>14||i>59||n===14&&i!==0)}function sue(r){return r instanceof Date&&!Number.isNaN(r.getTime())}function aB(r,e){return r[e]}function lue(r){if(typeof r=="string")return r;if(Array.isArray(r))return r.map(e=>String(e)).join(", ");if(r!=null){if(typeof r=="object")return"";if(typeof r=="number"||typeof r=="boolean")return String(r)}}function Wd(r,e=rue){return fue(Yn(r),e)}function Cp(r,e=nue){return fue(Yn(r),e)}function p_(r){let e=[],t=new Set,n=i=>{let a=cue(String(i));!a||t.has(a)||(t.add(a),e.push(a))};return Array.isArray(r)?(r.forEach(n),e):(typeof r=="string"&&r.trim().length>0&&n(r),e)}function cue(r){let e=r.trim();return(e.startsWith("#")?e.slice(1).trim():e).replace(/\s+/g,"-")}function sB(r,e,t,n=!1,i=[],a=rue,s=nue){if(!e)return{};let o={path:t};if(e[r.title]!==void 0){let l=lue(e[r.title]);l!==void 0&&l.trim().length>0?o.title=l:o.title=eue(t)}else(n||t)&&(o.title=eue(t));if(e[r.status]!==void 0&&(o.status=Wd(e[r.status],a)),e[r.priority]!==void 0&&(o.priority=Cp(e[r.priority],s)),e[r.due]!==void 0&&(o.due=Yn(e[r.due])),e[r.scheduled]!==void 0&&(o.scheduled=Yn(e[r.scheduled])),e[r.contexts]!==void 0&&(o.contexts=d_(e[r.contexts])),e[r.projects]!==void 0&&(o.projects=d_(e[r.projects])),e[r.timeEstimate]!==void 0&&(o.timeEstimate=v8e(e[r.timeEstimate])),e[r.completedDate]!==void 0&&(o.completedDate=Yn(e[r.completedDate])),e[r.recurrence]!==void 0&&(o.recurrence=Yn(e[r.recurrence])),e[r.recurrenceAnchor]!==void 0){let l=e[r.recurrenceAnchor];l==="scheduled"||l==="completion"?o.recurrence_anchor=l:l!=null&&!hue(l)&&(o.recurrence_anchor="scheduled")}if(e[r.dateCreated]!==void 0&&(o.dateCreated=Yn(e[r.dateCreated])),e[r.dateModified]!==void 0&&(o.dateModified=Yn(e[r.dateModified])),e[r.timeEntries]!==void 0&&(o.timeEntries=Array.isArray(e[r.timeEntries])?e[r.timeEntries]:[]),e[r.completeInstances]!==void 0){let l=e[r.completeInstances];o.complete_instances=Xde(Array.isArray(l)?l:[l])}if(e[r.skippedInstances]!==void 0){let l=e[r.skippedInstances];o.skipped_instances=Xde(Array.isArray(l)?l:[l])}if(e[r.recurrenceParent]!==void 0&&(o.recurrence_parent=Yn(e[r.recurrenceParent])),e[r.occurrenceDate]!==void 0&&(o.occurrence_date=Yn(e[r.occurrenceDate])),e[r.occurrenceMaterialization]!==void 0){let l=Yn(e[r.occurrenceMaterialization]);(l==="manual"||l==="on_completion"||l==="rolling")&&(o.occurrence_materialization=l)}if(e[r.occurrenceNextTrigger]!==void 0){let l=Yn(e[r.occurrenceNextTrigger]);(l==="completion"||l==="completion_or_skip")&&(o.occurrence_next_trigger=l)}if(e[r.occurrenceTemplate]!==void 0&&(o.occurrence_template=Yn(e[r.occurrenceTemplate])),e[r.occurrencePastHorizon]!==void 0&&(o.occurrence_past_horizon=Yn(e[r.occurrencePastHorizon])),e[r.occurrenceFutureHorizon]!==void 0&&(o.occurrence_future_horizon=Yn(e[r.occurrenceFutureHorizon])),r.blockedBy&&e[r.blockedBy]!==void 0&&(o.blockedBy=pue(e[r.blockedBy])),e[r.icsEventId]!==void 0&&(o.icsEventId=d_(e[r.icsEventId])),e[r.googleCalendarEventId]!==void 0&&(o.googleCalendarEventId=Yn(e[r.googleCalendarEventId])),e[r.googleCalendarExceptionEventId]!==void 0&&(o.googleCalendarExceptionEventId=Yn(e[r.googleCalendarExceptionEventId])),e[r.googleCalendarExceptionOriginalScheduled]!==void 0&&(o.googleCalendarExceptionOriginalScheduled=Yn(e[r.googleCalendarExceptionOriginalScheduled])),e[r.googleCalendarMovedOriginalDates]!==void 0&&(o.googleCalendarMovedOriginalDates=d_(e[r.googleCalendarMovedOriginalDates])),e[r.reminders]!==void 0&&(o.reminders=b8e(e[r.reminders])),e[r.sortOrder]!==void 0&&(o.sortOrder=Yn(e[r.sortOrder])),e.tags!==void 0){let l=p_(e.tags);o.tags=l,o.archived=l.includes(iB(r.archiveTag))}if(i.length>0){let l={},c=o;for(let d of i)e[d.key]!==void 0&&(c[d.key]=e[d.key],l[d.key]=e[d.key]);Object.keys(l).length>0&&(o.customProperties={...o.customProperties,...l})}return o}function oB(r,e,t,n=!1,i=[]){let a={};if(e.title!==void 0&&!n&&(a[r.title]=e.title),e.status!==void 0&&(a[r.status]=due(e.status)),e.priority!==void 0&&(a[r.priority]=e.priority),e.due!==void 0&&(a[r.due]=e.due),e.scheduled!==void 0&&(a[r.scheduled]=e.scheduled),e.contexts!==void 0&&(!Array.isArray(e.contexts)||e.contexts.length>0)&&(a[r.contexts]=e.contexts),e.projects!==void 0&&(!Array.isArray(e.projects)||e.projects.length>0)&&(a[r.projects]=e.projects),e.timeEstimate!==void 0&&(a[r.timeEstimate]=e.timeEstimate),e.completedDate!==void 0&&(a[r.completedDate]=e.completedDate),e.recurrence!==void 0&&(a[r.recurrence]=e.recurrence),e.recurrence_anchor!==void 0&&(a[r.recurrenceAnchor]=e.recurrence_anchor),e.recurrence_parent!==void 0&&(a[r.recurrenceParent]=e.recurrence_parent),e.occurrence_date!==void 0&&(a[r.occurrenceDate]=e.occurrence_date),e.occurrence_materialization!==void 0&&(a[r.occurrenceMaterialization]=e.occurrence_materialization),e.occurrence_next_trigger!==void 0&&(a[r.occurrenceNextTrigger]=e.occurrence_next_trigger),e.occurrence_template!==void 0&&(a[r.occurrenceTemplate]=e.occurrence_template),e.occurrence_past_horizon!==void 0&&(a[r.occurrencePastHorizon]=e.occurrence_past_horizon),e.occurrence_future_horizon!==void 0&&(a[r.occurrenceFutureHorizon]=e.occurrence_future_horizon),e.dateCreated!==void 0&&(a[r.dateCreated]=e.dateCreated),e.dateModified!==void 0&&(a[r.dateModified]=e.dateModified),e.sortOrder!==void 0&&(a[r.sortOrder]=e.sortOrder),e.timeEntries!==void 0&&(a[r.timeEntries]=e.timeEntries),e.complete_instances!==void 0&&(a[r.completeInstances]=e.complete_instances),e.skipped_instances!==void 0&&e.skipped_instances.length>0&&(a[r.skippedInstances]=e.skipped_instances),e.blockedBy!==void 0){let u=Array.isArray(e.blockedBy)?e.blockedBy.map(pB).filter(p=>!!p):[];u.length>0&&(a[r.blockedBy]=mue(u))}e.icsEventId!==void 0&&e.icsEventId.length>0&&(a[r.icsEventId]=e.icsEventId),e.googleCalendarEventId!==void 0&&(a[r.googleCalendarEventId]=e.googleCalendarEventId),e.googleCalendarExceptionEventId!==void 0&&(a[r.googleCalendarExceptionEventId]=e.googleCalendarExceptionEventId),e.googleCalendarExceptionOriginalScheduled!==void 0&&(a[r.googleCalendarExceptionOriginalScheduled]=e.googleCalendarExceptionOriginalScheduled),e.googleCalendarMovedOriginalDates!==void 0&&e.googleCalendarMovedOriginalDates.length>0&&(a[r.googleCalendarMovedOriginalDates]=e.googleCalendarMovedOriginalDates),e.reminders!==void 0&&e.reminders.length>0&&(a[r.reminders]=e.reminders);let s=p_(e.tags),o=t?iB(t):"",l=iB(r.archiveTag);o&&!s.includes(o)&&s.push(o),e.archived===!0&&!s.includes(l)?s.push(l):e.archived===!1&&(s=s.filter(u=>u!==l)),s.length>0&&(a.tags=s);let c=e.customProperties,d=e;for(let u of i)Object.prototype.hasOwnProperty.call(d,u.key)&&d[u.key]!==void 0?a[u.key]=d[u.key]:c&&Object.prototype.hasOwnProperty.call(c,u.key)&&c[u.key]!==void 0&&(a[u.key]=c[u.key]);return a}function due(r){let e=r.toLowerCase();return e==="true"||e==="false"?e==="true":r}function m_(r,e){for(let[t,n]of Object.entries(r))if(n===e)return t;return null}function lB(r,e){return m_(r,e)!==null}function cB(r,e,t){return r[t]===e}function dB(r,e){return e.map(t=>r[t])}function uB(r){let e=[],t=Object.keys(r);for(let i of t)(!r[i]||r[i].trim()==="")&&e.push(`Field "${i}" cannot be empty`);let n=Object.values(r);return n.length!==new Set(n).size&&e.push("Field mappings must have unique property names"),{valid:e.length===0,errors:e}}function uue(r){return oue.includes(r)}function pB(r){if(typeof r=="string"){let s=u_(r.trim());return s?{uid:s,reltype:nB}:null}if(!r||typeof r!="object")return null;let e=r,t=typeof e.uid=="string"?e.uid.trim():"";if(!t)return null;let n=typeof e.reltype=="string"?e.reltype.trim().toUpperCase():"",i=uue(n)?n:nB,a=typeof e.gap=="string"&&e.gap.trim().length>0?e.gap.trim():void 0;return a?{uid:u_(t),reltype:i,gap:a}:{uid:u_(t),reltype:i}}function pue(r){if(r==null)return;let e=(Array.isArray(r)?r:[r]).map(pB).filter(t=>!!t);return e.length>0?e:void 0}function mue(r){return r.map(e=>{let n={uid:e.uid.startsWith("[[")?e.uid:`[[${e.uid}]]`,reltype:e.reltype};return e.gap&&e.gap.trim().length>0&&(n.gap=e.gap),n})}function u_(r){let e=r.trim(),t=e.match(/^\[\[([^|\]#]+)(?:#[^\]|]+)?(?:\|[^\]]+)?\]\]$/);if(t)return t[1].trim();let n=e.match(/^\[[^\]]+\]\(([^)#]+)(?:#[^)]+)?\)$/);return n?decodeURI(n[1].trim()):e}function fue(r,e=[]){if(r===void 0||e.length===0)return r;let t=e.find(o=>o.value===r);if(t)return t.value;let n=tB(e,o=>o.label===r);if(n)return n.value;let i=r.trim().toLocaleLowerCase();if(i.length===0)return r;let a=tB(e,o=>o.value.trim().toLocaleLowerCase()===i);if(a)return a.value;let s=tB(e,o=>o.label.trim().toLocaleLowerCase()===i);return s?s.value:r}function tB(r,e){let t=r.filter(e);return t.length===1?t[0]:void 0}function Yn(r){if(r!=null){if(typeof r=="string")return hue(r)?void 0:r;if(typeof r=="number"||typeof r=="boolean")return String(r);if(Array.isArray(r))return r.length===1?Yn(r[0]):void 0}}function d_(r){return Array.isArray(r)?r.map(String):[String(r)]}function v8e(r){if(typeof r=="number")return r;if(typeof r=="string"&&r.trim()!==""){let e=Number(r);return Number.isNaN(e)?void 0:e}}function b8e(r){if(Array.isArray(r)){let e=r.filter(t=>t!=null);return e.length>0?e:void 0}return r!=null?[r]:void 0}function iB(r){var e;return(e=p_(r)[0])!=null?e:""}function eue(r){var e;return((e=r.split("/").pop())==null?void 0:e.replace(/\.md$/i,"").trim())||void 0}function hue(r){return typeof r=="string"&&r.trim().length===0}var tue,rue,nue,rB,d8e,nB,oue,mB=y(()=>{tue={title:"title",status:"status",priority:"priority",due:"due",scheduled:"scheduled",contexts:"contexts",projects:"projects",timeEstimate:"timeEstimate",completedDate:"completedDate",dateCreated:"dateCreated",dateModified:"dateModified",recurrence:"recurrence",recurrenceAnchor:"recurrence_anchor",recurrenceParent:"recurrence_parent",occurrenceDate:"occurrence_date",occurrenceMaterialization:"occurrence_materialization",occurrenceNextTrigger:"occurrence_next_trigger",occurrenceTemplate:"occurrence_template",occurrencePastHorizon:"occurrence_past_horizon",occurrenceFutureHorizon:"occurrence_future_horizon",archiveTag:"archived",timeEntries:"timeEntries",completeInstances:"complete_instances",skippedInstances:"skipped_instances",blockedBy:"blockedBy",pomodoros:"pomodoros",icsEventId:"icsEventId",icsEventTag:"ics_event",googleCalendarEventId:"googleCalendarEventId",googleCalendarExceptionEventId:"googleCalendarExceptionEventId",googleCalendarExceptionOriginalScheduled:"googleCalendarExceptionOriginalScheduled",googleCalendarMovedOriginalDates:"googleCalendarMovedOriginalDates",reminders:"reminders",sortOrder:"tasknotes_manual_order"},rue=[{id:"none",value:"none",label:"None",color:"#cccccc",isCompleted:!1,excludeFromCycle:!1,order:0,autoArchive:!1,autoArchiveDelay:5},{id:"open",value:"open",label:"Open",color:"#808080",isCompleted:!1,excludeFromCycle:!1,order:1,autoArchive:!1,autoArchiveDelay:5},{id:"in-progress",value:"in-progress",label:"In progress",color:"#0066cc",isCompleted:!1,excludeFromCycle:!1,order:2,autoArchive:!1,autoArchiveDelay:5},{id:"done",value:"done",label:"Done",color:"#00aa00",isCompleted:!0,excludeFromCycle:!1,order:3,autoArchive:!1,autoArchiveDelay:5}],nue=[{id:"none",value:"none",label:"None",color:"#cccccc",weight:0},{id:"low",value:"low",label:"Low",color:"#00aa00",weight:1},{id:"normal",value:"normal",label:"Normal",color:"#ffaa00",weight:2},{id:"high",value:"high",label:"High",color:"#ff0000",weight:3}],rB=/^(\d{4})-(\d{2})-(\d{2})$/,d8e=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,3})?(?:Z|([+-])(\d{2}):(\d{2}))?$/;nB="FINISHTOSTART",oue=["FINISHTOSTART","FINISHTOFINISH","STARTTOSTART","STARTTOFINISH"]});var zw=y(()=>{mB()});var Yf,fB=y(()=>{zw();Yf=class{constructor(e,t=[],n=[],i=[]){this.mapping=e;this.userFields=t;this.statuses=n;this.priorities=i}updateUserFields(e){this.userFields=e}updateConfiguredValues(e,t){this.statuses=e,this.priorities=t}getUserFields(){return[...this.userFields]}toUserField(e){return aB(this.mapping,e)}mapFromFrontmatter(e,t,n){let i=e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0;return sB(this.mapping,i,t,n,this.userFields,this.statuses,this.priorities)}mapToFrontmatter(e,t,n){return oB(this.mapping,e,t,n,this.userFields)}updateMapping(e){this.mapping=e}getMapping(){return{...this.mapping}}lookupMappingKey(e){return m_(this.mapping,e)}isRecognizedProperty(e){return lB(this.mapping,e)}isPropertyForField(e,t){return cB(this.mapping,e,t)}toUserFields(e){return dB(this.mapping,e)}fromUserField(e){return this.lookupMappingKey(e)}static validateMapping(e){return uB(e)}}});var jw,f_=y(()=>{mB();jw=tue});var ov,Fn,Gf=y(()=>{ov=["MO","TU","WE","TH","FR","SA","SU"],Fn=(function(){function r(e,t){if(t===0)throw new Error("Can't create weekday with n == 0");this.weekday=e,this.n=t}return r.fromStr=function(e){return new r(ov.indexOf(e))},r.prototype.nth=function(e){return this.n===e?this:new r(this.weekday,e)},r.prototype.equals=function(e){return this.weekday===e.weekday&&this.n===e.n},r.prototype.toString=function(){var e=ov[this.weekday];return this.n&&(e=(this.n>0?"+":"")+String(this.n)+e),e},r.prototype.getJsWeekday=function(){return this.weekday===6?0:this.weekday+1},r})()});function Kf(r,e,t){t===void 0&&(t=" ");var n=String(r);return e=e>>0,n.length>e?String(n):(e=e-n.length,e>t.length&&(t+=$t(t,e/t.length)),t.slice(0,e)+String(n))}var Hr,Fs,hB,_i,go,$t,gue,yue,ta,h_,$s,$n,qt,Ma=y(()=>{Gf();Hr=function(r){return r!=null},Fs=function(r){return typeof r=="number"},hB=function(r){return typeof r=="string"&&ov.includes(r)},_i=Array.isArray,go=function(r,e){e===void 0&&(e=r),arguments.length===1&&(e=r,r=0);for(var t=[],n=r;n{Ma();bl=function(r,e,t,n,i,a){return n===void 0&&(n=0),i===void 0&&(i=0),a===void 0&&(a=0),new Date(Date.UTC(r,e-1,t,n,i,a))},T8e=[31,28,31,30,31,30,31,31,30,31,30,31],bue=1e3*60*60*24,g_=9999,Tue=bl(1970,1,1),k8e=[6,0,1,2,3,4,5],lv=function(r){return r%4===0&&r%100!==0||r%400===0},gB=function(r){return r instanceof Date},Zf=function(r){return gB(r)&&!isNaN(r.getTime())},w8e=function(r,e){var t=r.getTime(),n=e.getTime(),i=t-n;return Math.round(i/bue)},Bw=function(r){return w8e(r,Tue)},y_=function(r){return new Date(Tue.getTime()+r*bue)},S8e=function(r){var e=r.getUTCMonth();return e===1&&lv(r.getUTCFullYear())?29:T8e[e]},Yd=function(r){return k8e[r.getUTCDay()]},yB=function(r,e){var t=bl(r,e+1,1);return[Yd(t),S8e(t)]},v_=function(r,e){return e=e||r,new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()))},b_=function(r){var e=new Date(r.getTime());return e},vB=function(r){for(var e=[],t=0;t{E8e=(function(){function r(e,t){this.minDate=null,this.maxDate=null,this._result=[],this.total=0,this.method=e,this.args=t,e==="between"?(this.maxDate=t.inc?t.before:new Date(t.before.getTime()-1),this.minDate=t.inc?t.after:new Date(t.after.getTime()+1)):e==="before"?this.maxDate=t.inc?t.dt:new Date(t.dt.getTime()-1):e==="after"&&(this.minDate=t.inc?t.dt:new Date(t.dt.getTime()+1))}return r.prototype.accept=function(e){++this.total;var t=this.minDate&&ethis.maxDate;if(this.method==="between"){if(t)return!0;if(n)return!1}else if(this.method==="before"){if(n)return!1}else if(this.method==="after")return t?!0:(this.add(e),!1);return this.add(e)},r.prototype.add=function(e){return this._result.push(e),!0},r.prototype.getValue=function(){var e=this._result;switch(this.method){case"all":case"between":return e;case"before":case"after":default:return e.length?e[e.length-1]:null}},r.prototype.clone=function(){return new r(this.method,this.args)},r})(),Kd=E8e});function dv(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");bB(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function de(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n{bB=function(r,e){return bB=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},bB(r,e)};Ai=function(){return Ai=Object.assign||function(e){for(var t,n=1,i=arguments.length;n{Zd();T_();x8e=(function(r){dv(e,r);function e(t,n,i){var a=r.call(this,t,n)||this;return a.iterator=i,a}return e.prototype.add=function(t){return this.iterator(t,this._result.length)?(this._result.push(t),!0):!1},e})(Kd),TB=x8e});var C8e,Qf,k_=y(()=>{C8e={dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],tokens:{SKIP:/^[ \r\n\t]+|^\.$/,number:/^[1-9][0-9]*/,numberAsText:/^(one|two|three)/i,every:/^every/i,"day(s)":/^days?/i,"weekday(s)":/^weekdays?/i,"week(s)":/^weeks?/i,"hour(s)":/^hours?/i,"minute(s)":/^minutes?/i,"month(s)":/^months?/i,"year(s)":/^years?/i,on:/^(on|in)/i,at:/^(at)/i,the:/^the/i,first:/^first/i,second:/^second/i,third:/^third/i,nth:/^([1-9][0-9]*)(\.|th|nd|rd|st)/i,last:/^last/i,for:/^for/i,"time(s)":/^times?/i,until:/^(un)?til/i,monday:/^mo(n(day)?)?/i,tuesday:/^tu(e(s(day)?)?)?/i,wednesday:/^we(d(n(esday)?)?)?/i,thursday:/^th(u(r(sday)?)?)?/i,friday:/^fr(i(day)?)?/i,saturday:/^sa(t(urday)?)?/i,sunday:/^su(n(day)?)?/i,january:/^jan(uary)?/i,february:/^feb(ruary)?/i,march:/^mar(ch)?/i,april:/^apr(il)?/i,may:/^may/i,june:/^june?/i,july:/^july?/i,august:/^aug(ust)?/i,september:/^sep(t(ember)?)?/i,october:/^oct(ober)?/i,november:/^nov(ember)?/i,december:/^dec(ember)?/i,comma:/^(,\s*|(and|or)\s*)+/i}},Qf=C8e});var Sue,D8e,P8e,M8e,mc,Eue=y(()=>{k_();yo();Ma();Sue=function(r,e){return r.indexOf(e)!==-1},D8e=function(r){return r.toString()},P8e=function(r,e,t){return"".concat(e," ").concat(t,", ").concat(r)},M8e=(function(){function r(e,t,n,i){if(t===void 0&&(t=D8e),n===void 0&&(n=Qf),i===void 0&&(i=P8e),this.text=[],this.language=n||Qf,this.gettext=t,this.dateFormatter=i,this.rrule=e,this.options=e.options,this.origOptions=e.origOptions,this.origOptions.bymonthday){var a=[].concat(this.options.bymonthday),s=[].concat(this.options.bynmonthday);a.sort(function(d,u){return d-u}),s.sort(function(d,u){return u-d}),this.bymonthday=a.concat(s),this.bymonthday.length||(this.bymonthday=null)}if(Hr(this.origOptions.byweekday)){var o=_i(this.origOptions.byweekday)?this.origOptions.byweekday:[this.origOptions.byweekday],l=String(o);this.byweekday={allWeeks:o.filter(function(d){return!d.n}),someWeeks:o.filter(function(d){return!!d.n}),isWeekdays:l.indexOf("MO")!==-1&&l.indexOf("TU")!==-1&&l.indexOf("WE")!==-1&&l.indexOf("TH")!==-1&&l.indexOf("FR")!==-1&&l.indexOf("SA")===-1&&l.indexOf("SU")===-1,isEveryDay:l.indexOf("MO")!==-1&&l.indexOf("TU")!==-1&&l.indexOf("WE")!==-1&&l.indexOf("TH")!==-1&&l.indexOf("FR")!==-1&&l.indexOf("SA")!==-1&&l.indexOf("SU")!==-1};var c=function(d,u){return d.weekday-u.weekday};this.byweekday.allWeeks.sort(c),this.byweekday.someWeeks.sort(c),this.byweekday.allWeeks.length||(this.byweekday.allWeeks=null),this.byweekday.someWeeks.length||(this.byweekday.someWeeks=null)}else this.byweekday=null}return r.isFullyConvertible=function(e){var t=!0;if(!(e.options.freq in r.IMPLEMENTED)||e.origOptions.until&&e.origOptions.count)return!1;for(var n in e.origOptions){if(Sue(["dtstart","tzid","wkst","freq"],n))return!0;if(!Sue(r.IMPLEMENTED[e.options.freq],n))return!1}return t},r.prototype.isFullyConvertible=function(){return r.isFullyConvertible(this.rrule)},r.prototype.toString=function(){var e=this.gettext;if(!(this.options.freq in r.IMPLEMENTED))return e("RRule error: Unable to fully convert this rrule to text");if(this.text=[e("every")],this[ye.FREQUENCIES[this.options.freq]](),this.options.until){this.add(e("until"));var t=this.options.until;this.add(this.dateFormatter(t.getUTCFullYear(),this.language.monthNames[t.getUTCMonth()],t.getUTCDate()))}else this.options.count&&this.add(e("for")).add(this.options.count.toString()).add(this.plural(this.options.count)?e("times"):e("time"));return this.isFullyConvertible()||this.add(e("(~ approximate)")),this.text.join("")},r.prototype.HOURLY=function(){var e=this.gettext;this.options.interval!==1&&this.add(this.options.interval.toString()),this.add(this.plural(this.options.interval)?e("hours"):e("hour"))},r.prototype.MINUTELY=function(){var e=this.gettext;this.options.interval!==1&&this.add(this.options.interval.toString()),this.add(this.plural(this.options.interval)?e("minutes"):e("minute"))},r.prototype.DAILY=function(){var e=this.gettext;this.options.interval!==1&&this.add(this.options.interval.toString()),this.byweekday&&this.byweekday.isWeekdays?this.add(this.plural(this.options.interval)?e("weekdays"):e("weekday")):this.add(this.plural(this.options.interval)?e("days"):e("day")),this.origOptions.bymonth&&(this.add(e("in")),this._bymonth()),this.bymonthday?this._bymonthday():this.byweekday?this._byweekday():this.origOptions.byhour&&this._byhour()},r.prototype.WEEKLY=function(){var e=this.gettext;this.options.interval!==1&&this.add(this.options.interval.toString()).add(this.plural(this.options.interval)?e("weeks"):e("week")),this.byweekday&&this.byweekday.isWeekdays?this.options.interval===1?this.add(this.plural(this.options.interval)?e("weekdays"):e("weekday")):this.add(e("on")).add(e("weekdays")):this.byweekday&&this.byweekday.isEveryDay?this.add(this.plural(this.options.interval)?e("days"):e("day")):(this.options.interval===1&&this.add(e("week")),this.origOptions.bymonth&&(this.add(e("in")),this._bymonth()),this.bymonthday?this._bymonthday():this.byweekday&&this._byweekday(),this.origOptions.byhour&&this._byhour())},r.prototype.MONTHLY=function(){var e=this.gettext;this.origOptions.bymonth?(this.options.interval!==1&&(this.add(this.options.interval.toString()).add(e("months")),this.plural(this.options.interval)&&this.add(e("in"))),this._bymonth()):(this.options.interval!==1&&this.add(this.options.interval.toString()),this.add(this.plural(this.options.interval)?e("months"):e("month"))),this.bymonthday?this._bymonthday():this.byweekday&&this.byweekday.isWeekdays?this.add(e("on")).add(e("weekdays")):this.byweekday&&this._byweekday()},r.prototype.YEARLY=function(){var e=this.gettext;this.origOptions.bymonth?(this.options.interval!==1&&(this.add(this.options.interval.toString()),this.add(e("years"))),this._bymonth()):(this.options.interval!==1&&this.add(this.options.interval.toString()),this.add(this.plural(this.options.interval)?e("years"):e("year"))),this.bymonthday?this._bymonthday():this.byweekday&&this._byweekday(),this.options.byyearday&&this.add(e("on the")).add(this.list(this.options.byyearday,this.nth,e("and"))).add(e("day")),this.options.byweekno&&this.add(e("in")).add(this.plural(this.options.byweekno.length)?e("weeks"):e("week")).add(this.list(this.options.byweekno,void 0,e("and")))},r.prototype._bymonthday=function(){var e=this.gettext;this.byweekday&&this.byweekday.allWeeks?this.add(e("on")).add(this.list(this.byweekday.allWeeks,this.weekdaytext,e("or"))).add(e("the")).add(this.list(this.bymonthday,this.nth,e("or"))):this.add(e("on the")).add(this.list(this.bymonthday,this.nth,e("and")))},r.prototype._byweekday=function(){var e=this.gettext;this.byweekday.allWeeks&&!this.byweekday.isWeekdays&&this.add(e("on")).add(this.list(this.byweekday.allWeeks,this.weekdaytext)),this.byweekday.someWeeks&&(this.byweekday.allWeeks&&this.add(e("and")),this.add(e("on the")).add(this.list(this.byweekday.someWeeks,this.weekdaytext,e("and"))))},r.prototype._byhour=function(){var e=this.gettext;this.add(e("at")).add(this.list(this.origOptions.byhour,void 0,e("and")))},r.prototype._bymonth=function(){this.add(this.list(this.options.bymonth,this.monthtext,this.gettext("and")))},r.prototype.nth=function(e){e=parseInt(e.toString(),10);var t,n=this.gettext;if(e===-1)return n("last");var i=Math.abs(e);switch(i){case 1:case 21:case 31:t=i+n("st");break;case 2:case 22:t=i+n("nd");break;case 3:case 23:t=i+n("rd");break;default:t=i+n("th")}return e<0?t+" "+n("last"):t},r.prototype.monthtext=function(e){return this.language.monthNames[e-1]},r.prototype.weekdaytext=function(e){var t=Fs(e)?(e+1)%7:e.getJsWeekday();return(e.n?this.nth(e.n)+" ":"")+this.language.dayNames[t]},r.prototype.plural=function(e){return e%100!==1},r.prototype.add=function(e){return this.text.push(" "),this.text.push(e),this},r.prototype.list=function(e,t,n,i){var a=this;i===void 0&&(i=","),_i(e)||(e=[e]);var s=function(l,c,d){for(var u="",p=0;p366)throw new Error("Nth out of range: "+p);return n.nextSymbol(),n.accept("last")?-p:p;default:return!1}}function d(){n.accept("on"),n.accept("the");var p=c();if(p)for(t.bymonthday=[p],n.nextSymbol();n.accept("comma");){if(p=c(),!p)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");t.bymonthday.push(p),n.nextSymbol()}}function u(){if(n.symbol==="until"){var p=Date.parse(n.text);if(!p)throw new Error("Cannot parse until date:"+n.text);t.until=new Date(p)}else n.accept("for")&&(t.count=parseInt(n.value[0],10),n.expect("number"))}}var _8e,xue=y(()=>{k_();yo();_8e=(function(){function r(e){this.done=!0,this.rules=e}return r.prototype.start=function(e){return this.text=e,this.done=!1,this.nextSymbol()},r.prototype.isDone=function(){return this.done&&this.symbol===null},r.prototype.nextSymbol=function(){var e,t;this.symbol=null,this.value=null;do{if(this.done)return!1;var n=void 0;e=null;for(var i in this.rules){n=this.rules[i];var a=n.exec(this.text);a&&(e===null||a[0].length>e[0].length)&&(e=a,t=i)}if(e!=null&&(this.text=this.text.substr(e[0].length),this.text===""&&(this.done=!0)),e==null){this.done=!0,this.symbol=null,this.value=null;return}}while(t==="SKIP");return this.symbol=t,this.value=e,!0},r.prototype.accept=function(e){if(this.symbol===e){if(this.value){var t=this.value;return this.nextSymbol(),t}return this.nextSymbol(),!0}return!1},r.prototype.acceptNumber=function(){return this.accept("number")},r.prototype.expect=function(e){if(this.accept(e))return!0;throw new Error("expected "+e+" but found "+this.symbol)},r})()});function Vw(r){return r{(function(r){r[r.YEARLY=0]="YEARLY",r[r.MONTHLY=1]="MONTHLY",r[r.WEEKLY=2]="WEEKLY",r[r.DAILY=3]="DAILY",r[r.HOURLY=4]="HOURLY",r[r.MINUTELY=5]="MINUTELY",r[r.SECONDLY=6]="SECONDLY"})(Tt||(Tt={}))});var Cue,uv,Due,Pue,Mue=y(()=>{Eue();xue();yo();Qd();k_();Cue=function(r,e){return e===void 0&&(e=Qf),new ye(Hw(r,e)||void 0)},uv=["count","until","interval","byweekday","bymonthday","bymonth"];mc.IMPLEMENTED=[];mc.IMPLEMENTED[Tt.HOURLY]=uv;mc.IMPLEMENTED[Tt.MINUTELY]=uv;mc.IMPLEMENTED[Tt.DAILY]=["byhour"].concat(uv);mc.IMPLEMENTED[Tt.WEEKLY]=uv;mc.IMPLEMENTED[Tt.MONTHLY]=uv;mc.IMPLEMENTED[Tt.YEARLY]=["byweekno","byyearday"].concat(uv);Due=function(r,e,t,n){return new mc(r,e,t,n).toString()},Pue=mc.isFullyConvertible});var pv,_ue,w_=y(()=>{Zd();Qd();Ma();ra();pv=(function(){function r(e,t,n,i){this.hour=e,this.minute=t,this.second=n,this.millisecond=i||0}return r.prototype.getHours=function(){return this.hour},r.prototype.getMinutes=function(){return this.minute},r.prototype.getSeconds=function(){return this.second},r.prototype.getMilliseconds=function(){return this.millisecond},r.prototype.getTime=function(){return(this.hour*60*60+this.minute*60+this.second)*1e3+this.millisecond},r})(),_ue=(function(r){dv(e,r);function e(t,n,i,a,s,o,l){var c=r.call(this,a,s,o,l)||this;return c.year=t,c.month=n,c.day=i,c}return e.fromDate=function(t){return new this(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.valueOf()%1e3)},e.prototype.getWeekday=function(){return Yd(new Date(this.getTime()))},e.prototype.getTime=function(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond)).getTime()},e.prototype.getDay=function(){return this.day},e.prototype.getMonth=function(){return this.month},e.prototype.getYear=function(){return this.year},e.prototype.addYears=function(t){this.year+=t},e.prototype.addMonths=function(t){if(this.month+=t,this.month>12){var n=Math.floor(this.month/12),i=ta(this.month,12);this.month=i,this.year+=n,this.month===0&&(this.month=12,--this.year)}},e.prototype.addWeekly=function(t,n){n>this.getWeekday()?this.day+=-(this.getWeekday()+1+(6-n))+t*7:this.day+=-(this.getWeekday()-n)+t*7,this.fixDay()},e.prototype.addDaily=function(t){this.day+=t,this.fixDay()},e.prototype.addHours=function(t,n,i){for(n&&(this.hour+=Math.floor((23-this.hour)/t)*t);;){this.hour+=t;var a=h_(this.hour,24),s=a.div,o=a.mod;if(s&&(this.hour=o,this.addDaily(s)),$s(i)||qt(i,this.hour))break}},e.prototype.addMinutes=function(t,n,i,a){for(n&&(this.minute+=Math.floor((1439-(this.hour*60+this.minute))/t)*t);;){this.minute+=t;var s=h_(this.minute,60),o=s.div,l=s.mod;if(o&&(this.minute=l,this.addHours(o,!1,i)),($s(i)||qt(i,this.hour))&&($s(a)||qt(a,this.minute)))break}},e.prototype.addSeconds=function(t,n,i,a,s){for(n&&(this.second+=Math.floor((86399-(this.hour*3600+this.minute*60+this.second))/t)*t);;){this.second+=t;var o=h_(this.second,60),l=o.div,c=o.mod;if(l&&(this.second=c,this.addMinutes(l,!1,i,a)),($s(i)||qt(i,this.hour))&&($s(a)||qt(a,this.minute))&&($s(s)||qt(s,this.second)))break}},e.prototype.fixDay=function(){if(!(this.day<=28)){var t=yB(this.year,this.month-1)[1];if(!(this.day<=t))for(;this.day>t;){if(this.day-=t,++this.month,this.month===13&&(this.month=1,++this.year,this.year>g_))return;t=yB(this.year,this.month-1)[1]}}},e.prototype.add=function(t,n){var i=t.freq,a=t.interval,s=t.wkst,o=t.byhour,l=t.byminute,c=t.bysecond;switch(i){case Tt.YEARLY:return this.addYears(a);case Tt.MONTHLY:return this.addMonths(a);case Tt.WEEKLY:return this.addWeekly(a,s);case Tt.DAILY:return this.addDaily(a);case Tt.HOURLY:return this.addHours(a,n,o);case Tt.MINUTELY:return this.addMinutes(a,n,o,l);case Tt.SECONDLY:return this.addSeconds(a,n,o,l,c)}},e})(pv)});function kB(r){for(var e=[],t=Object.keys(r),n=0,i=t;n=-366&&n<=366))throw new Error("bysetpos must be between 1 and 366, or between -366 and -1")}}if(!(e.byweekno||$n(e.byweekno)||$n(e.byyearday)||e.bymonthday||$n(e.bymonthday)||Hr(e.byweekday)||Hr(e.byeaster)))switch(e.freq){case ye.YEARLY:e.bymonth||(e.bymonth=e.dtstart.getUTCMonth()+1),e.bymonthday=e.dtstart.getUTCDate();break;case ye.MONTHLY:e.bymonthday=e.dtstart.getUTCDate();break;case ye.WEEKLY:e.byweekday=[Yd(e.dtstart)];break}if(Hr(e.bymonth)&&!_i(e.bymonth)&&(e.bymonth=[e.bymonth]),Hr(e.byyearday)&&!_i(e.byyearday)&&Fs(e.byyearday)&&(e.byyearday=[e.byyearday]),!Hr(e.bymonthday))e.bymonthday=[],e.bynmonthday=[];else if(_i(e.bymonthday)){for(var i=[],a=[],t=0;t0?i.push(n):n<0&&a.push(n)}e.bymonthday=i,e.bynmonthday=a}else e.bymonthday<0?(e.bynmonthday=[e.bymonthday],e.bymonthday=[]):(e.bynmonthday=[],e.bymonthday=[e.bymonthday]);if(Hr(e.byweekno)&&!_i(e.byweekno)&&(e.byweekno=[e.byweekno]),!Hr(e.byweekday))e.bynweekday=null;else if(Fs(e.byweekday))e.byweekday=[e.byweekday],e.bynweekday=null;else if(hB(e.byweekday))e.byweekday=[Fn.fromStr(e.byweekday).weekday],e.bynweekday=null;else if(e.byweekday instanceof Fn)!e.byweekday.n||e.freq>ye.MONTHLY?(e.byweekday=[e.byweekday.weekday],e.bynweekday=null):(e.bynweekday=[[e.byweekday.weekday,e.byweekday.n]],e.byweekday=null);else{for(var s=[],o=[],t=0;tye.MONTHLY?s.push(l.weekday):o.push([l.weekday,l.n])}e.byweekday=$n(s)?s:null,e.bynweekday=$n(o)?o:null}return Hr(e.byhour)?Fs(e.byhour)&&(e.byhour=[e.byhour]):e.byhour=e.freq{Zd();Qd();Ma();yo();ra();Gf();w_()});function Yw(r){var e=r.split(` +`).map(A8e).filter(function(t){return t!==null});return Ai(Ai({},e[0]),e[1])}function Ww(r){var e={},t=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(r);if(!t)return e;var n=t[1],i=t[2];return n&&(e.tzid=n),e.dtstart=Uw(i),e}function A8e(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return Rue(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return Rue(r);case"DTSTART":return Ww(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function Rue(r){var e=r.replace(/^RRULE:/i,""),t=Ww(e),n=r.replace(/^(?:RRULE|EXRULE):/i,"").split(";");return n.forEach(function(i){var a=i.split("="),s=a[0],o=a[1];switch(s.toUpperCase()){case"FREQ":t.freq=Tt[o.toUpperCase()];break;case"WKST":t.wkst=vo[o.toUpperCase()];break;case"COUNT":case"INTERVAL":case"BYSETPOS":case"BYMONTH":case"BYMONTHDAY":case"BYYEARDAY":case"BYWEEKNO":case"BYHOUR":case"BYMINUTE":case"BYSECOND":var l=I8e(o),c=s.toLowerCase();t[c]=l;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=N8e(o);break;case"DTSTART":case"TZID":var d=Ww(r);t.tzid=d.tzid,t.dtstart=d.dtstart;break;case"UNTIL":t.until=Uw(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+s+"'")}}),t}function I8e(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(Oue)}return Oue(r)}function Oue(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function N8e(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return vo[t];var n=t.match(/^([+-]?\d{1,2})([A-Z]{2})$/);if(!n||n.length<3)throw new SyntaxError("Invalid weekday string: ".concat(t));var i=Number(n[1]),a=n[2],s=vo[a].weekday;return new Fn(s,i)})}var SB=y(()=>{Zd();Qd();Gf();ra();yo()});var Jf,S_=y(()=>{ra();Jf=(function(){function r(e,t){if(isNaN(e.getTime()))throw new RangeError("Invalid date passed to DateWithZone");this.date=e,this.tzid=t}return Object.defineProperty(r.prototype,"isUTC",{get:function(){return!this.tzid||this.tzid.toUpperCase()==="UTC"},enumerable:!1,configurable:!0}),r.prototype.toString=function(){var e=cv(this.date.getTime(),this.isUTC);return this.isUTC?":".concat(e):";TZID=".concat(this.tzid,":").concat(e)},r.prototype.getTime=function(){return this.date.getTime()},r.prototype.rezonedDate=function(){return this.isUTC?this.date:kue(this.date,this.tzid)},r})()});function Gw(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys(qw),a=0;a{yo();Ma();Gf();ra();S_()});function O8e(r,e){return Array.isArray(r)?!Array.isArray(e)||r.length!==e.length?!1:r.every(function(t,n){return t.getTime()===e[n].getTime()}):r instanceof Date?e instanceof Date&&r.getTime()===e.getTime():r===e}var Lue,Fue=y(()=>{T_();ra();Ma();Lue=(function(){function r(){this.all=!1,this.before=[],this.after=[],this.between=[]}return r.prototype._cacheAdd=function(e,t,n){t&&(t=t instanceof Date?b_(t):vB(t)),e==="all"?this.all=t:(n._value=t,this[e].push(n))},r.prototype._cacheGet=function(e,t){var n=!1,i=t?Object.keys(t):[],a=function(d){for(var u=0;u{Zd();Ma();$ue=de(de(de(de(de(de(de(de(de(de(de(de(de([],$t(1,31),!0),$t(2,28),!0),$t(3,31),!0),$t(4,30),!0),$t(5,31),!0),$t(6,30),!0),$t(7,31),!0),$t(8,31),!0),$t(9,30),!0),$t(10,31),!0),$t(11,30),!0),$t(12,31),!0),$t(1,7),!0),zue=de(de(de(de(de(de(de(de(de(de(de(de(de([],$t(1,31),!0),$t(2,29),!0),$t(3,31),!0),$t(4,30),!0),$t(5,31),!0),$t(6,30),!0),$t(7,31),!0),$t(8,31),!0),$t(9,30),!0),$t(10,31),!0),$t(11,30),!0),$t(12,31),!0),$t(1,7),!0),L8e=go(1,29),F8e=go(1,30),Dp=go(1,31),na=go(1,32),jue=de(de(de(de(de(de(de(de(de(de(de(de(de([],na,!0),F8e,!0),na,!0),Dp,!0),na,!0),Dp,!0),na,!0),na,!0),Dp,!0),na,!0),Dp,!0),na,!0),na.slice(0,7),!0),Bue=de(de(de(de(de(de(de(de(de(de(de(de(de([],na,!0),L8e,!0),na,!0),Dp,!0),na,!0),Dp,!0),na,!0),na,!0),Dp,!0),na,!0),Dp,!0),na,!0),na.slice(0,7),!0),$8e=go(-28,0),z8e=go(-29,0),Pp=go(-30,0),ia=go(-31,0),Uue=de(de(de(de(de(de(de(de(de(de(de(de(de([],ia,!0),z8e,!0),ia,!0),Pp,!0),ia,!0),Pp,!0),ia,!0),ia,!0),Pp,!0),ia,!0),Pp,!0),ia,!0),ia.slice(0,7),!0),Hue=de(de(de(de(de(de(de(de(de(de(de(de(de([],ia,!0),$8e,!0),ia,!0),Pp,!0),ia,!0),Pp,!0),ia,!0),ia,!0),Pp,!0),ia,!0),Pp,!0),ia,!0),ia.slice(0,7),!0),Vue=[0,31,60,91,121,152,182,213,244,274,305,335,366],que=[0,31,59,90,120,151,181,212,243,273,304,334,365],xB=(function(){for(var r=[],e=0;e<55;e++)r=r.concat(go(7));return r})()});function Yue(r,e){var t=bl(r,1,1),n=lv(r)?366:365,i=lv(r+1)?366:365,a=Bw(t),s=Yd(t),o=Ai(Ai({yearlen:n,nextyearlen:i,yearordinal:a,yearweekday:s},j8e(r)),{wnomask:null});if($s(e.byweekno))return o;o.wnomask=$t(0,n+7);var l,c,d=l=ta(7-s+e.wkst,7);d>=4?(d=0,c=o.yearlen+ta(s-e.wkst,7)):c=n-d;for(var u=Math.floor(c/7),p=ta(c,7),m=Math.floor(u+p/4),f=0;f0&&h<=m){var g=void 0;h>1?(g=d+(h-1)*7,d!==l&&(g-=7-l)):g=d;for(var v=0;v<7&&(o.wnomask[g]=1,g++,o.wdaymask[g]!==e.wkst);v++);}}if(qt(e.byweekno,1)){var g=d+m*7;if(d!==l&&(g-=7-l),g=4?(w=0,x=S+ta(b-e.wkst,7)):x=n-d,k=Math.floor(52+ta(x,7)/4)}if(qt(e.byweekno,k))for(var g=0;g{Zd();ra();Ma();Wue()});function Kue(r,e,t,n,i,a){var s={lastyear:r,lastmonth:e,nwdaymask:[]},o=[];if(a.freq===ye.YEARLY)if($s(a.bymonth))o=[[0,t]];else for(var l=0;l{yo();Ma()});function Que(r,e){e===void 0&&(e=0);var t=r%19,n=Math.floor(r/100),i=r%100,a=Math.floor(n/4),s=n%4,o=Math.floor((n+8)/25),l=Math.floor((n-o+1)/3),c=Math.floor(19*t+n-a-l+15)%30,d=Math.floor(i/4),u=i%4,p=Math.floor(32+2*s+2*d-c-u)%7,m=Math.floor((t+11*c+22*p)/451),f=Math.floor((c+p-7*m+114)/31),h=(c+p-7*m+114)%31+1,g=Date.UTC(r,f-1,h+e),v=Date.UTC(r,0,1);return[Math.ceil((g-v)/(1e3*60*60*24))]}var Jue=y(()=>{});var B8e,Xue,epe=y(()=>{Ma();Qd();Gue();Zue();Jue();w_();ra();B8e=(function(){function r(e){this.options=e}return r.prototype.rebuild=function(e,t){var n=this.options;if(e!==this.lastyear&&(this.yearinfo=Yue(e,n)),$n(n.bynweekday)&&(t!==this.lastmonth||e!==this.lastyear)){var i=this.yearinfo,a=i.yearlen,s=i.mrange,o=i.wdaymask;this.monthinfo=Kue(e,t,a,s,o,n)}Hr(n.byeaster)&&(this.eastermask=Que(e,n.byeaster))},Object.defineProperty(r.prototype,"lastyear",{get:function(){return this.monthinfo?this.monthinfo.lastyear:null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lastmonth",{get:function(){return this.monthinfo?this.monthinfo.lastmonth:null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"yearlen",{get:function(){return this.yearinfo.yearlen},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"yearordinal",{get:function(){return this.yearinfo.yearordinal},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"mrange",{get:function(){return this.yearinfo.mrange},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"wdaymask",{get:function(){return this.yearinfo.wdaymask},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"mmask",{get:function(){return this.yearinfo.mmask},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"wnomask",{get:function(){return this.yearinfo.wnomask},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"nwdaymask",{get:function(){return this.monthinfo?this.monthinfo.nwdaymask:[]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"nextyearlen",{get:function(){return this.yearinfo.nextyearlen},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"mdaymask",{get:function(){return this.yearinfo.mdaymask},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"nmdaymask",{get:function(){return this.yearinfo.nmdaymask},enumerable:!1,configurable:!0}),r.prototype.ydayset=function(){return[go(this.yearlen),0,this.yearlen]},r.prototype.mdayset=function(e,t){for(var n=this.mrange[t-1],i=this.mrange[t],a=$t(null,this.yearlen),s=n;s{ra();Ma()});function E_(r,e){var t=e.dtstart,n=e.freq,i=e.interval,a=e.until,s=e.bysetpos,o=e.count;if(o===0||i===0)return Jd(r);var l=_ue.fromDate(t),c=new Xue(e);c.rebuild(l.year,l.month);for(var d=V8e(c,l,e);;){var u=c.getdayset(n)(l.year,l.month,l.day),p=u[0],m=u[1],f=u[2],h=H8e(p,m,f,c,e);if($n(s))for(var g=tpe(s,d,m,f,c,p),v=0;va)return Jd(r);if(k>=t){var b=npe(k,e);if(!r.accept(b)||o&&(--o,!o))return Jd(r)}}else for(var v=m;va)return Jd(r);if(k>=t){var b=npe(k,e);if(!r.accept(b)||o&&(--o,!o))return Jd(r)}}}if(e.interval===0||(l.add(e,h),l.year>g_))return Jd(r);Vw(n)||(d=c.gettimeset(n)(l.hour,l.minute,l.second,0)),c.rebuild(l.year,l.month)}}function U8e(r,e,t){var n=t.bymonth,i=t.byweekno,a=t.byweekday,s=t.byeaster,o=t.bymonthday,l=t.bynmonthday,c=t.byyearday;return $n(n)&&!qt(n,r.mmask[e])||$n(i)&&!r.wnomask[e]||$n(a)&&!qt(a,r.wdaymask[e])||$n(r.nwdaymask)&&!r.nwdaymask[e]||s!==null&&!qt(r.eastermask,e)||($n(o)||$n(l))&&!qt(o,r.mdaymask[e])&&!qt(l,r.nmdaymask[e])||$n(c)&&(e=r.yearlen&&!qt(c,e+1-r.yearlen)&&!qt(c,-r.nextyearlen+e-r.yearlen))}function npe(r,e){return new Jf(r,e.tzid).rezonedDate()}function Jd(r){return r.getValue()}function H8e(r,e,t,n,i){for(var a=!1,s=e;s=ye.HOURLY&&$n(i)&&!qt(i,e.hour)||n>=ye.MINUTELY&&$n(a)&&!qt(a,e.minute)||n>=ye.SECONDLY&&$n(s)&&!qt(s,e.second)?[]:r.gettimeset(n)(e.hour,e.minute,e.second,e.millisecond)}var CB=y(()=>{Qd();ra();epe();yo();wB();Ma();S_();rpe();w_()});var vo,qw,Nue,ye,yo=y(()=>{ra();T_();wue();Mue();Qd();wB();SB();EB();Fue();Gf();CB();vo={MO:new Fn(0),TU:new Fn(1),WE:new Fn(2),TH:new Fn(3),FR:new Fn(4),SA:new Fn(5),SU:new Fn(6)},qw={freq:Tt.YEARLY,dtstart:null,interval:1,wkst:vo.MO,count:null,until:null,tzid:null,bysetpos:null,bymonth:null,bymonthday:null,bynmonthday:null,byyearday:null,byweekno:null,byweekday:null,bynweekday:null,byhour:null,byminute:null,bysecond:null,byeaster:null},Nue=Object.keys(qw),ye=(function(){function r(e,t){e===void 0&&(e={}),t===void 0&&(t=!1),this._cache=t?null:new Lue,this.origOptions=kB(e);var n=Aue(e).parsedOptions;this.options=n}return r.parseText=function(e,t){return Hw(e,t)},r.fromText=function(e,t){return Cue(e,t)},r.fromString=function(e){return new r(r.parseString(e)||void 0)},r.prototype._iter=function(e){return E_(e,this.options)},r.prototype._cacheGet=function(e,t){return this._cache?this._cache._cacheGet(e,t):!1},r.prototype._cacheAdd=function(e,t,n){if(this._cache)return this._cache._cacheAdd(e,t,n)},r.prototype.all=function(e){if(e)return this._iter(new TB("all",{},e));var t=this._cacheGet("all");return t===!1&&(t=this._iter(new Kd("all",{})),this._cacheAdd("all",t)),t},r.prototype.between=function(e,t,n,i){if(n===void 0&&(n=!1),!Zf(e)||!Zf(t))throw new Error("Invalid date passed in to RRule.between");var a={before:t,after:e,inc:n};if(i)return this._iter(new TB("between",a,i));var s=this._cacheGet("between",a);return s===!1&&(s=this._iter(new Kd("between",a)),this._cacheAdd("between",s,a)),s},r.prototype.before=function(e,t){if(t===void 0&&(t=!1),!Zf(e))throw new Error("Invalid date passed in to RRule.before");var n={dt:e,inc:t},i=this._cacheGet("before",n);return i===!1&&(i=this._iter(new Kd("before",n)),this._cacheAdd("before",i,n)),i},r.prototype.after=function(e,t){if(t===void 0&&(t=!1),!Zf(e))throw new Error("Invalid date passed in to RRule.after");var n={dt:e,inc:t},i=this._cacheGet("after",n);return i===!1&&(i=this._iter(new Kd("after",n)),this._cacheAdd("after",i,n)),i},r.prototype.count=function(){return this.all().length},r.prototype.toString=function(){return Gw(this.origOptions)},r.prototype.toText=function(e,t,n){return Due(this,e,t,n)},r.prototype.isFullyConvertibleToText=function(){return Pue(this)},r.prototype.clone=function(){return new r(this.origOptions)},r.FREQUENCIES=["YEARLY","MONTHLY","WEEKLY","DAILY","HOURLY","MINUTELY","SECONDLY"],r.YEARLY=Tt.YEARLY,r.MONTHLY=Tt.MONTHLY,r.WEEKLY=Tt.WEEKLY,r.DAILY=Tt.DAILY,r.HOURLY=Tt.HOURLY,r.MINUTELY=Tt.MINUTELY,r.SECONDLY=Tt.SECONDLY,r.MO=vo.MO,r.TU=vo.TU,r.WE=vo.WE,r.TH=vo.TH,r.FR=vo.FR,r.SA=vo.SA,r.SU=vo.SU,r.parseString=Yw,r.optionsToString=Gw,r})()});function ipe(r,e,t,n,i,a){var s={},o=r.accept;function l(p,m){t.forEach(function(f){f.between(p,m,!0).forEach(function(h){s[Number(h)]=!0})})}i.forEach(function(p){var m=new Jf(p,a).rezonedDate();s[Number(m)]=!0}),r.accept=function(p){var m=Number(p);return isNaN(m)?o.call(this,p):!s[m]&&(l(new Date(m-1),new Date(m+1)),!s[m])?(s[m]=!0,o.call(this,p)):!0},r.method==="between"&&(l(r.args.after,r.args.before),r.accept=function(p){var m=Number(p);return s[m]?!0:(s[m]=!0,o.call(this,p))});for(var c=0;c{S_();CB();ra()});function q8e(r,e){var t=[],n=[],i=[],a=[],s=Ww(r),o=s.dtstart,l=s.tzid,c=Z8e(r,e.unfold);return c.forEach(function(d){var u;if(d){var p=K8e(d),m=p.name,f=p.parms,h=p.value;switch(m.toUpperCase()){case"RRULE":if(f.length)throw new Error("unsupported RRULE parm: ".concat(f.join(",")));t.push(Yw(d));break;case"RDATE":var g=(u=/RDATE(?:;TZID=([^:=]+))?/i.exec(d))!==null&&u!==void 0?u:[],v=g[1];v&&!l&&(l=v),n=n.concat(ope(h,f));break;case"EXRULE":if(f.length)throw new Error("unsupported EXRULE parm: ".concat(f.join(",")));i.push(Yw(h));break;case"EXDATE":a=a.concat(ope(h,f));break;case"DTSTART":break;default:throw new Error("unsupported property: "+m)}}}),{dtstart:o,tzid:l,rrulevals:t,rdatevals:n,exrulevals:i,exdatevals:a}}function W8e(r,e){var t=q8e(r,e),n=t.rrulevals,i=t.rdatevals,a=t.exrulevals,s=t.exdatevals,o=t.dtstart,l=t.tzid,c=e.cache===!1;if(e.compatible&&(e.forceset=!0,e.unfold=!0),e.forceset||n.length>1||i.length||a.length||s.length){var d=new x_(c);return d.dtstart(o),d.tzid(l||void 0),n.forEach(function(p){d.rrule(new ye(DB(p,o,l),c))}),i.forEach(function(p){d.rdate(p)}),a.forEach(function(p){d.exrule(new ye(DB(p,o,l),c))}),s.forEach(function(p){d.exdate(p)}),e.compatible&&e.dtstart&&d.rdate(o),d}var u=n[0]||{};return new ye(DB(u,u.dtstart||e.dtstart||o,u.tzid||e.tzid||l),c)}function Kw(r,e){return e===void 0&&(e={}),W8e(r,Y8e(e))}function DB(r,e,t){return Ai(Ai({},r),{dtstart:e,tzid:t})}function Y8e(r){var e=[],t=Object.keys(r),n=Object.keys(spe);if(t.forEach(function(i){qt(n,i)||e.push(i)}),e.length)throw new Error("Invalid options: "+e.join(", "));return Ai(Ai({},spe),r)}function G8e(r){if(r.indexOf(":")===-1)return{name:"RRULE",value:r};var e=yue(r,":",1),t=e[0],n=e[1];return{name:t,value:n}}function K8e(r){var e=G8e(r),t=e.name,n=e.value,i=t.split(";");if(!i)throw new Error("empty property name");return{name:i[0].toUpperCase(),parms:i.slice(1),value:n}}function Z8e(r,e){if(e===void 0&&(e=!1),r=r&&r.trim(),!r)throw new Error("Invalid empty string");if(!e)return r.split(/\s/);for(var t=r.split(` +`),n=0;n0&&i[0]===" "?(t[n-1]+=i.slice(1),t.splice(n,1)):n+=1:t.splice(n,1)}return t}function Q8e(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function ope(r,e){return Q8e(e),r.split(",").map(function(t){return Uw(t)})}var spe,PB=y(()=>{Zd();yo();MB();ra();Ma();SB();spe={dtstart:null,cache:!1,unfold:!1,forceset:!1,compatible:!1,tzid:null}});function lpe(r){var e=this;return function(t){if(t!==void 0&&(e["_".concat(r)]=t),e["_".concat(r)]!==void 0)return e["_".concat(r)];for(var n=0;n{Zd();yo();ra();Ma();ape();PB();EB();x_=(function(r){dv(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=lpe.apply(n,["dtstart"]),n.tzid=lpe.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return ipe(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){cpe(t,this._rrule)},e.prototype.exrule=function(t){cpe(t,this._exrule)},e.prototype.rdate=function(t){dpe(t,this._rdate)},e.prototype.exdate=function(t){dpe(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return Kw(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return Kw(t.toString())})},e.prototype.rdates=function(){return this._rdate.map(function(t){return new Date(t.getTime())})},e.prototype.exdates=function(){return this._exdate.map(function(t){return new Date(t.getTime())})},e.prototype.valueOf=function(){var t=[];return!this._rrule.length&&this._dtstart&&(t=t.concat(Gw({dtstart:this._dtstart}))),this._rrule.forEach(function(n){t=t.concat(n.toString().split(` +`))}),this._exrule.forEach(function(n){t=t.concat(n.toString().split(` +`).map(function(i){return i.replace(/^RRULE:/,"EXRULE:")}).filter(function(i){return!/^DTSTART/.test(i)}))}),this._rdate.length&&t.push(upe("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(upe("EXDATE",this._exdate,this.tzid())),t},e.prototype.toString=function(){return this.valueOf().join(` +`)},e.prototype.clone=function(){var t=new e(!!this._cache);return this._rrule.forEach(function(n){return t.rrule(n.clone())}),this._exrule.forEach(function(n){return t.exrule(n.clone())}),this._rdate.forEach(function(n){return t.rdate(new Date(n.getTime()))}),this._exdate.forEach(function(n){return t.exdate(new Date(n.getTime()))}),t},e})(ye)});var Mp={};et(Mp,{ALL_WEEKDAYS:()=>ov,Frequency:()=>Tt,RRule:()=>ye,RRuleSet:()=>x_,Weekday:()=>Fn,datetime:()=>bl,rrulestr:()=>Kw});var mv=y(()=>{yo();MB();PB();Qd();Gf();ra()});function eu(r){let e=fpe(r),t=e.match(C_);if(t){let[,i,a,s]=t,o=Number(i),l=Number(a),c=Number(s);if(!gpe(o,l,c))throw new Error(`Invalid date "${r}".`);return new Date(Date.UTC(o,l-1,c,0,0,0,0))}if(!hpe(e))throw new Error(`Invalid date "${r}".`);let n=new Date(e);if(!D_(n))throw new Error(`Invalid date "${r}".`);return n}function X8e(r){let e=fpe(r),t=e.match(C_);if(t){let[,i,a,s]=t,o=Number(i),l=Number(a),c=Number(s),d=new Date(o,l-1,c,0,0,0,0);if(!D_(d)||d.getFullYear()!==o||d.getMonth()!==l-1||d.getDate()!==c)throw new Error(`Invalid date "${r}".`);return d}if(!hpe(e))throw new Error(`Invalid date "${r}".`);let n=new Date(e);if(!D_(n))throw new Error(`Invalid date "${r}".`);return n}function Xd(r){if(!D_(r))return"";let e=r.getUTCFullYear(),t=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0");return`${e}-${t}-${n}`}function e7e(r){return Xd(r)}function t7e(){let r=new Date,e=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${e}-${t}-${n}`}function AB(r){return eu(n7e(r))}function r7e(r){return r?/T\d{2}:\d{2}/.test(r):!1}function n7e(r){if(!r)return"";let e=r.trim();if(C_.test(e))return e;let t=e.indexOf("T");if(t>-1)return e.slice(0,t);let n=e.indexOf(" ");return n>-1&&C_.test(e.slice(0,n))?e.slice(0,n):Xd(eu(e))}function fpe(r,e="Date string cannot be empty"){if(!r||r.trim().length===0)throw new Error(e);return r.trim()}function hpe(r){let e=r.match(J8e);if(!e)return!1;let[,t,n,i,a,s,o,,l,c,d]=e;return gpe(Number(t),Number(n),Number(i))&&i7e(Number(a),Number(s),Number(o))&&a7e(l,c,d)}function gpe(r,e,t){let n=new Date(Date.UTC(r,e-1,t,0,0,0,0));return n.getUTCFullYear()===r&&n.getUTCMonth()===e-1&&n.getUTCDate()===t}function i7e(r,e,t){return r>=0&&r<=23&&e>=0&&e<=59&&t>=0&&t<=59}function a7e(r,e,t){if(!r)return!0;let n=Number(e),i=Number(t);return!(n>14||i>59||n===14&&i!==0)}function D_(r){return r instanceof Date&&!Number.isNaN(r.getTime())}function NB(r,e){if(!r.recurrence||typeof r.recurrence!="string")return!0;try{let t=wpe(r);if(!t)return!1;let n=AB(e7e(e));return t.between(n,new Date(n.getTime()+1440*60*1e3-1),!0).length>0}catch(t){return!0}}function P_(r,e,t="done"){if(!r.recurrence)return r.status||"open";let n=Xd(e);return(Array.isArray(r.complete_instances)?r.complete_instances:[]).includes(n)?t:r.status||"open"}function Zw(r,e,t){if(!r.recurrence||typeof r.recurrence!="string")return[];try{let n=wpe(r);if(!n)return[];let i=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),0,0,0,0)),a=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),23,59,59,999));return n.between(i,a,!0)}catch(n){let i=[],a=new Date(e);for(;a<=t;)NB(r,a)&&i.push(new Date(a)),a.setUTCDate(a.getUTCDate()+1);return i}}function ype(r){if(!r.recurrence||typeof r.recurrence!="string")return null;let e=r.recurrence.match(/(?:^|;)COUNT=(\d+)(?:;|$)/);if(e){let t=Number.parseInt(e[1],10);return Number.isFinite(t)&&t>0?t:null}if(!/(?:^|;)UNTIL=/.test(r.recurrence))return null;try{let t=Spe(r),n=o7e(r.recurrence);if(!t||!n||n=s7e?null:i.length>0?i.length:null}catch(t){return null}}function vpe(r,e={}){return r.recurrence?(r.recurrence_anchor||"scheduled")==="completion"?d7e(r,e):c7e(r,e):null}function bpe(r,e=!0,t={}){let n=vpe(r,t),i=null,a=null,s=null;if(n){try{let o=r.scheduled?eu(r.scheduled):null,l=r.due?eu(r.due):null;if(o&&l){let c=!e&&l.getTime()=t)return c}return null}function d7e(r,e){if(!r.recurrence||typeof r.recurrence!="string")return null;let t=eu(e.today||mpe()),n=xpe(r.recurrence),i=RB(r.recurrence),a=i||t,s=new Date(a.getTime()+n*24*60*60*1e3),o=Zw(r,a,s),l=new Set(r.skipped_instances||[]),c=i?i.getTime():0;for(let d of o){let u=Xd(d);if(d.getTime()>c&&d>=t&&!l.has(u))return d}return null}var C_,J8e,mpe,_B,ppe,IB,s7e,OB=y(()=>{mv();C_=/^(\d{4})-(\d{2})-(\d{2})$/,J8e=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,3})?(?:Z|([+-])(\d{2}):(\d{2}))?$/;mpe=t7e;_B=Reflect.get(Mp,"default"),IB=(ppe=ye)!=null?ppe:_B==null?void 0:_B.RRule,s7e=1e4});var UB={};et(UB,{NATURAL_LANGUAGE_DATE_PATTERNS:()=>Qw,addDaysToDateString:()=>eh,addDaysToDateTime:()=>gv,addMonthsToDateString:()=>f7e,addWeeksToDateString:()=>FB,addYearsToDateString:()=>h7e,combineDateAndTime:()=>Ni,convertUTCToLocalCalendarDate:()=>tu,createSafeDate:()=>m7e,createSafeUTCDate:()=>__,createTimeFormatHelper:()=>S7e,createUTCDateForRRule:()=>_p,createUTCDateFromLocalCalendarDate:()=>vn,formatDateAsUTCString:()=>P7e,formatDateForDisplay:()=>ru,formatDateForStorage:()=>ce,formatDateStringTime:()=>_pe,formatDateTime:()=>Mpe,formatDateTimeForDisplay:()=>Ti,formatTime:()=>hv,formatTimestampForDisplay:()=>A_,generateUTCCalendarDates:()=>jB,getCurrentDateString:()=>fv,getCurrentDateTimeString:()=>C7e,getCurrentTimestamp:()=>Ye,getDatePart:()=>ke,getEndOfMonthString:()=>b7e,getEndOfWeekString:()=>y7e,getEndOfYearString:()=>k7e,getNaturalLanguageDateSuggestions:()=>_7e,getStartOfMonthString:()=>v7e,getStartOfWeekString:()=>g7e,getStartOfYearString:()=>T7e,getTimePart:()=>_a,getTodayLocal:()=>wr,getTodayString:()=>zn,getUTCEndOfMonth:()=>O_,getUTCEndOfWeek:()=>BB,getUTCStartOfMonth:()=>R_,getUTCStartOfWeek:()=>N_,hasTimeComponent:()=>kr,isBeforeDateSafe:()=>th,isBeforeDateTimeAware:()=>nu,isNaturalLanguageDate:()=>L_,isOverdueTimeAware:()=>iu,isPastDate:()=>$B,isSameDateSafe:()=>bo,isToday:()=>Jw,isTodayTimeAware:()=>I_,isTodayUTC:()=>zB,isValidDateInput:()=>M7e,normalizeCalendarBoundariesToUTC:()=>D7e,normalizeDateString:()=>p7e,parseDate:()=>u7e,parseDateAsLocal:()=>rh,parseDateToLocal:()=>ut,parseDateToUTC:()=>zt,parseTimestamp:()=>Ppe,resolveNaturalLanguageDate:()=>nh,startOfDayForDateString:()=>w7e,validateCompleteInstances:()=>x7e,validateDateInput:()=>LB,validateDateTimeInput:()=>E7e});function Ii(r){if(!r){let t=new Error("Date string cannot be empty");throw qe.error("Date parsing error:",{category:"validation",operation:"date-parsing",details:{dateString:r},error:t.message}),t}let e=r.trim();try{let t=e.match(/^(\d{4}-\d{2}-\d{2})\s+(Mon|Tue|Wed|Thu|Fri|Sat|Sun|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)$/i);if(t){let n=t[1];return Ii(n)}if(e.startsWith("T")&&/^T\d{2}:\d{2}(:\d{2})?/.test(e)){let n=new Error(`Invalid date format - time without date: ${r}`);throw qe.warn("Date parsing error - incomplete time format:",{category:"validation",operation:"date-parsing-incomplete-time-format",details:{original:r,trimmed:e},error:n.message}),n}if(/^\d{4}-W\d{2}$/.test(e)){let[n,i]=e.split("-W"),a=parseInt(n,10),s=parseInt(i,10);if(isNaN(a)||isNaN(s)){let u=new Error(`Invalid numeric values in ISO week format: ${r}`);throw qe.warn("Date parsing error - invalid ISO week numbers:",{category:"validation",operation:"date-parsing-invalid-iso-week-numbers",details:{original:r,year:n,week:i,yearNum:a,weekNum:s}}),u}if(s<1||s>53){let u=new Error(`Invalid week number in ISO week format: ${r} (week must be 1-53)`);throw qe.warn("Date parsing error - week number out of range:",{category:"validation",operation:"date-parsing-week-number-out-of-range",details:{original:r,weekNum:s},error:u.message}),u}let o=new Date(a,0,4),l=o.getDay(),c=new Date(o);c.setDate(o.getDate()-(l===0?6:l-1));let d=new Date(c);if(d.setDate(c.getDate()+(s-1)*7),!bi(d)){let u=new Error(`Failed to calculate date from ISO week format: ${r}`);throw qe.error("Date parsing error - ISO week calculation failed:",{category:"validation",operation:"date-parsing-iso-week-calculation",details:{original:r,yearNum:a,weekNum:s,jan4:o.toISOString(),targetWeekMonday:d.toString()}}),u}return d}if(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?/.test(e)){let n=e.replace(" ","T"),i=Ls(n);if(!bi(i)){let a=new Error(`Invalid space-separated datetime: ${r}`);throw qe.warn("Date parsing error - space-separated datetime invalid:",{category:"validation",operation:"date-parsing-space-separated-datetime-invalid",details:{original:r,converted:n},error:a.message}),a}return i}if(e.includes("T")||e.includes("Z")||e.match(/[+-]\d{2}:\d{2}$/)){let n=Ls(e);if(!bi(n)){let i=new Error(`Invalid timezone-aware date: ${r}`);throw qe.warn("Date parsing error - timezone-aware format invalid:",{category:"validation",operation:"date-parsing-timezone-aware-format-invalid",details:{original:r,trimmed:e},error:i.message}),i}return n}else{let n=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!n){let l=new Error(`Invalid date-only string: ${r} (expected format: yyyy-MM-dd)`);throw qe.warn("Date parsing error - date-only format invalid:",{category:"validation",operation:"date-parsing-date-only-format-invalid",details:{original:r,trimmed:e,expectedFormat:"yyyy-MM-dd"},error:l.message}),l}let[,i,a,s]=n,o=new Date(parseInt(i,10),parseInt(a,10)-1,parseInt(s,10));if(!bi(o)||o.getFullYear()!==parseInt(i,10)||o.getMonth()!==parseInt(a,10)-1||o.getDate()!==parseInt(s,10)){let l=new Error(`Invalid date values: ${r}`);throw qe.warn("Date parsing error - invalid date values:",{category:"validation",operation:"date-parsing-invalid-date-values",details:{original:r,year:i,month:a,day:s},error:l.message}),l}return o}}catch(t){if(t instanceof Error&&t.message.includes("Invalid date"))throw t;let n=new Error(`Unexpected error parsing date "${r}": ${t instanceof Error?t.message:String(t)}`);throw qe.error("Unexpected date parsing error:",{category:"validation",operation:"unexpected-date-parsing",details:{original:r,trimmed:e,stack:t instanceof Error?t.stack:void 0},error:t instanceof Error?t.message:String(t)}),n}}function zt(r){if(!r){let t=new Error("Date string cannot be empty");throw qe.error("Date parsing error:",{category:"validation",operation:"date-parsing",details:{dateString:r},error:t.message}),t}let e=r.trim();try{let t=e.match(/^(\d{4}-\d{2}-\d{2})\s+(Mon|Tue|Wed|Thu|Fri|Sat|Sun|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)$/i);if(t){let i=t[1];return zt(i)}let n=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(n){let[,i,a,s]=n,o=parseInt(i,10),l=parseInt(a,10),c=parseInt(s,10);if(l<1||l>12)throw new Error(`Invalid month in date: ${r}`);if(c<1||c>31)throw new Error(`Invalid day in date: ${r}`);let d=new Date(Date.UTC(o,l-1,c));if(d.getUTCFullYear()!==o||d.getUTCMonth()!==l-1||d.getUTCDate()!==c)throw new Error(`Invalid date values: ${r}`);return d}return Ii(e)}catch(t){let n=new Error(`Failed to parse date to UTC: ${e}`);throw qe.error("Date parsing error:",{category:"validation",operation:"date-parsing",details:{dateString:r,trimmed:e,stack:t instanceof Error?t.stack:void 0},error:t instanceof Error?t.message:String(t)}),n}}function ut(r){return Ii(r)}function u7e(r){return Ii(r)}function bo(r,e){try{let t=ke(r),n=ke(e),i=zt(t),a=zt(n);return i.getTime()===a.getTime()}catch(t){return qe.error("Error comparing dates:",{category:"validation",operation:"comparing-dates",details:{date1:r,date2:e},error:t}),!1}}function th(r,e){try{let t=ke(r),n=ke(e),i=zt(t),a=zt(n);return i.getTime()=0?"+":"-",n=m=>String(Math.abs(m)).padStart(2,"0"),i=n(Math.floor(Math.abs(e)/60)),a=n(Math.abs(e)%60),s=r.getFullYear(),o=n(r.getMonth()+1),l=n(r.getDate()),c=n(r.getHours()),d=n(r.getMinutes()),u=n(r.getSeconds()),p=String(r.getMilliseconds()).padStart(3,"0");return`${s}-${o}-${l}T${c}:${d}:${u}.${p}${t}${i}:${a}`}function fv(){let r=new Date,e=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${e}-${t}-${n}`}function Ppe(r){try{if(!r)throw new Error("Timestamp string cannot be empty");let e=Ls(r);if(!bi(e))throw new Error(`Invalid timestamp: ${r}`);return e}catch(e){throw qe.error("Error parsing timestamp:",{category:"validation",operation:"parsing-timestamp",details:{timestampString:r},error:e}),e}}function A_(r,e,t="24"){if(!r)return r;try{let n=Ppe(r);return bi(n)?P(n,e||(t==="12"?"MMM d, yyyy h:mm a":"MMM d, yyyy HH:mm")):r}catch(n){return qe.error("Error formatting timestamp for display:",{category:"validation",operation:"formatting-timestamp-display",details:{timestampString:r},error:n}),r}}function kr(r){return r?/T\d{2}:\d{2}/.test(r):!1}function ke(r){if(!r)return"";try{if(/^\d{4}-\d{2}-\d{2}$/.test(r))return r;let e=r.indexOf("T");if(e>-1)return r.substring(0,e);let t=zt(r);return ce(t)}catch(e){return qe.error("Error extracting date part:",{category:"validation",operation:"extracting-date-part",details:{dateString:r},error:e}),r}}function _a(r){if(!r||!kr(r))return null;try{let e=Ii(r);return P(e,"HH:mm")}catch(e){return qe.error("Error extracting time part:",{category:"validation",operation:"extracting-time-part",details:{dateString:r},error:e}),null}}function hv(r,e="24"){return bi(r)?P(r,e==="12"?"h:mm a":"HH:mm"):(qe.warn("Invalid date provided to formatTime:",{category:"validation",operation:"invalid-date-provided-formattime",details:{value:r}}),"")}function Mpe(r,e="24"){return bi(r)?P(r,e==="12"?"MMM d, yyyy h:mm a":"MMM d, yyyy HH:mm"):(qe.warn("Invalid date provided to formatDateTime:",{category:"validation",operation:"invalid-date-provided-formatdatetime",details:{value:r}}),"")}function _pe(r,e="24"){if(!r||!kr(r))return r;try{let t=ut(r);return hv(t,e)}catch(t){return qe.error("Error formatting date string time:",{category:"validation",operation:"formatting-date-string-time",details:{dateString:r},error:t}),r}}function S7e(r){return{formatDateTimeForDisplay:(e,t={})=>Ti(e,{...t,userTimeFormat:r}),formatTime:e=>hv(e,r),formatDateTime:e=>Mpe(e,r),formatDateStringTime:e=>_pe(e,r)}}function Ni(r,e){if(!r)return"";if(!e)return r;try{let t=r.match(/^(\d{4}-\d{2}-\d{2})$/);if(t)return/^\d{2}:\d{2}$/.test(e)?`${t[1]}T${e}`:(qe.warn("Invalid time format, expected HH:mm:",{category:"validation",operation:"invalid-time-format-expected-hh-mm",details:{value:e}}),r);let n=ke(r);return!n||!/^\d{4}-\d{2}-\d{2}$/.test(n)?(qe.warn("Invalid date part from dateString:",{category:"validation",operation:"invalid-date-part-datestring",details:{dateString:r,datePart:n}}),r):/^\d{2}:\d{2}$/.test(e)?`${n}T${e}`:(qe.warn("Invalid time format, expected HH:mm:",{category:"validation",operation:"invalid-time-format-expected-hh-mm",details:{value:e}}),r)}catch(t){return qe.error("Error combining date and time:",{category:"validation",operation:"combining-date-and-time",details:{dateString:r,timeString:e},error:t}),r}}function Ti(r,e={}){if(!r)return"";let{dateFormat:t="MMM d, yyyy",timeFormat:n,showTime:i=!0,userTimeFormat:a="24"}=e,s=n||(a==="12"?"h:mm a":"HH:mm");try{let o=Ii(r);return kr(r)&&i?!t||t.trim()===""?P(o,s):P(o,`${t} ${s}`):!t||t.trim()===""?"":P(o,t)}catch(o){return qe.error("Error formatting datetime for display:",{category:"validation",operation:"formatting-datetime-display",details:{dateString:r},error:o}),r}}function nu(r,e){try{let t=zt(r),n=zt(e),i=t,a=n;if(kr(r)){let s=_a(r);if(s){let[o,l]=s.split(":").map(Number);i=new Date(t),i.setUTCHours(o,l,0,0)}}if(kr(e)){let s=_a(e);if(s){let[o,l]=s.split(":").map(Number);a=new Date(n),a.setUTCHours(o,l,0,0)}}return kr(r)&&!kr(e)?(a=new Date(n),a.setUTCHours(23,59,59,999)):!kr(r)&&kr(e)&&(i=new Date(t),i.setUTCHours(23,59,59,999)),i.getTime(){if(typeof e!="string"||!e.trim())return!1;let t=e.trim();if(t.startsWith("T")&&/^T\d{2}:\d{2}(:\d{2})?/.test(t)||!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;try{return Ii(t),!0}catch(n){return qe.warn("Invalid complete_instances entry (date parsing failed):",{category:"validation",operation:"invalid-complete-instances-entry-date-parsing",details:{value:e},error:n}),!1}}).map(e=>e.trim()):[]}function C7e(){return P(new Date,"yyyy-MM-dd'T'HH:mm")}function gv(r,e){try{let t=Ii(r),n=Vf(t,e);return kr(r)?P(n,"yyyy-MM-dd'T'HH:mm"):P(n,"yyyy-MM-dd")}catch(t){throw qe.error("Error adding days to datetime:",{category:"validation",operation:"adding-days-datetime",details:{dateString:r,days:e},error:t}),t}}function _p(r){try{let e=r.match(/^(\d{4})-(\d{2})-(\d{2})/);if(!e)throw new Error(`Invalid date format for RRULE: ${r}`);let[,t,n,i]=e,a=parseInt(t,10),s=parseInt(n,10),o=parseInt(i,10);if(s<1||s>12)throw new Error(`Invalid month in date: ${r}`);if(o<1||o>31)throw new Error(`Invalid day in date: ${r}`);let l=new Date(Date.UTC(a,s-1,o));if(l.getUTCFullYear()!==a||l.getUTCMonth()!==s-1||l.getUTCDate()!==o)throw new Error(`Invalid date values: ${r}`);return l}catch(e){throw qe.error("Error creating UTC date for RRULE:",{category:"validation",operation:"creating-utc-date-rrule",details:{dateString:r},error:e}),e}}function vn(r){let e=r.getFullYear(),t=r.getMonth(),n=r.getDate();return new Date(Date.UTC(e,t,n,0,0,0,0))}function zB(r){try{let e=wr(),t=vn(e);return r.getUTCFullYear()===t.getUTCFullYear()&&r.getUTCMonth()===t.getUTCMonth()&&r.getUTCDate()===t.getUTCDate()}catch(e){return qe.error("Error in isTodayUTC:",{category:"validation",operation:"istodayutc",error:e}),!1}}function D7e(r,e){try{let t=P(r,"yyyy-MM-dd"),n=P(e,"yyyy-MM-dd"),i=_p(t),a=_p(n);return{utcStart:i,utcEnd:a}}catch(t){throw qe.error("Error normalizing calendar boundaries to UTC:",{category:"provider",operation:"normalizing-calendar-boundaries-utc",details:{startDate:r,endDate:e},error:t}),t}}function P7e(r){try{let e=r.getUTCFullYear(),t=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0");return`${e}-${t}-${n}`}catch(e){return qe.error("Error formatting date as UTC string:",{category:"validation",operation:"formatting-date-as-utc-string",details:{date:r},error:e}),r.toISOString().split("T")[0]}}function ce(r){try{if(!r||!(r instanceof Date)||isNaN(r.getTime()))return qe.warn("formatDateForStorage received invalid date:",{category:"validation",operation:"formatdateforstorage-received-invalid-date",details:{value:r}}),"";let e=r.getUTCFullYear(),t=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0");return`${e}-${t}-${n}`}catch(e){return qe.error("Error formatting date for storage:",{category:"validation",operation:"formatting-date-storage",details:{date:r},error:e}),""}}function jB(r,e){let t=[],n=ce(r),i=ce(e),a=_p(n),s=_p(i);for(;a<=s;)t.push(new Date(a)),a.setUTCDate(a.getUTCDate()+1);return t}function N_(r,e=1){let t=_p(ce(r)),i=(t.getUTCDay()-e+7)%7,a=new Date(t);return a.setUTCDate(a.getUTCDate()-i),a}function BB(r,e=1){let t=N_(r,e),n=new Date(t);return n.setUTCDate(n.getUTCDate()+6),n}function R_(r){let e=_p(ce(r));return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1))}function O_(r){let e=_p(ce(r));return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0))}function L_(r){if(!r||typeof r!="string")return!1;let e=r.toLowerCase().trim().replace(/\s+/g," ");return e in Qw?!0:[/^in\s+(\d+)\s+(days?)$/,/^(\d+)\s+(days?)\s+ago$/,/^in\s+(\d+)\s+(weeks?)$/,/^(\d+)\s+(weeks?)\s+ago$/].some(n=>n.test(e))}function M7e(r){if(typeof r!="string")return!1;let e=r.trim();if(e===""||L_(e))return!0;try{let t=Ii(e);return bi(t)}catch(t){return!1}}function nh(r){if(!r||typeof r!="string")return r;let e=r.toLowerCase().trim().replace(/\s+/g," ");if(e in Qw)try{return Qw[e]()}catch(t){return qe.error("Error resolving natural language date:",{category:"validation",operation:"resolving-natural-language-date",details:{value:r},error:t}),r}try{let t=e.match(/^in\s+(\d+)\s+(days?)$/);if(t){let n=parseInt(t[1],10);return eh(zn(),n)}if(t=e.match(/^(\d+)\s+(days?)\s+ago$/),t){let n=parseInt(t[1],10);return eh(zn(),-n)}if(t=e.match(/^in\s+(\d+)\s+(weeks?)$/),t){let n=parseInt(t[1],10);return FB(zn(),n)}if(t=e.match(/^(\d+)\s+(weeks?)\s+ago$/),t){let n=parseInt(t[1],10);return FB(zn(),-n)}}catch(t){qe.error("Error parsing relative natural language date:",{category:"validation",operation:"parsing-relative-natural-language-date",details:{value:r},error:t})}return r}function _7e(){let r=Object.keys(Qw),e=["in 3 days","2 days ago","in 1 week","2 weeks ago"];return[...r,...e].sort()}var qe,Qw,Ne=y(()=>{Br();G();qe=I({tag:"Utils/DateUtils"});Qw={today:()=>zn(),tomorrow:()=>eh(zn(),1),yesterday:()=>eh(zn(),-1),"next week":()=>eh(zn(),7),"last week":()=>eh(zn(),-7)}});function ih(r,e=!0){return bpe(r,e,{today:zn()})}var yv=y(()=>{OB();OB();Ne()});function _r(r,e=""){var i;let t=(i=r==null?void 0:r.trim())!=null?i:"";if(!t)return e;let n=t.toLowerCase();if(HB.has(n))return`var(--color-${n})`;if(n==="accent")return"var(--color-accent)";if(n.startsWith("color-")){let a=n.slice(6);if(HB.has(a)||a==="accent")return`var(--${n})`}return n.startsWith("--")?`var(${t})`:t}function au(r){var a;let e=(a=r==null?void 0:r.trim())!=null?a:"",t=e.match(A7e);if(!t)return e;let n=t[1].toLowerCase();if(n==="--color-accent")return"accent";let i=n.replace(/^--color-/,"");return HB.has(i)?i:e}function su(r){return _r(r).startsWith("var(")}function $_(r){let e=_r(r);return e?!!(I7e.test(e)||su(e)||Ipe.test(e)):!1}function vv(r,e){let t=_r(r);if(!t)return`rgba(128, 128, 128, ${e})`;if(su(t)||Ipe.test(t))return`color-mix(in srgb, ${t} ${Math.round(e*100)}%, transparent)`;let n=t.replace("#","");if(/^[0-9a-f]{3}$/i.test(n)){let o=parseInt(n[0]+n[0],16),l=parseInt(n[1]+n[1],16),c=parseInt(n[2]+n[2],16);return`rgba(${o}, ${l}, ${c}, ${e})`}if(!/^[0-9a-f]{6}$/i.test(n))return`rgba(128, 128, 128, ${e})`;let i=parseInt(n.substring(0,2),16),a=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16);return`rgba(${i}, ${a}, ${s}, ${e})`}var Ape,HB,A7e,I7e,Ipe,F_,Npe,fc=y(()=>{Ape=["red","orange","yellow","green","cyan","blue","purple","pink"],HB=new Set(Ape),A7e=/^var\(\s*(--[a-z0-9_-]+)\s*\)$/i,I7e=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,Ipe=/^(?:rgb|rgba|hsl|hsla|oklch|lab|color|color-mix)\(/i,F_="#6366f1, red, blue, cyan",Npe=[...Ape,"accent","var(--color-accent)"]});async function ah(r,e,t){await r.fileManager.processFrontMatter(e,t)}async function sh(r,e,t){return r.vault.create(e,t)}async function Xw(r,e){await r.vault.createFolder(e)}async function Xa(r,e,t){await r.vault.modify(e,t)}async function VB(r,e,t){await r.vault.rename(e,t)}var qB=y(()=>{});function Lpe(r){return window.moment(r)}function z_(r){if(!r.startsWith("---"))return{};let e=r.indexOf("---",3);if(e===-1)return{};let t=r.substring(3,e);try{return(0,lh.parseYaml)(t)||{}}catch(n){return oh.error("Error parsing frontmatter:",{category:"validation",operation:"parsing-frontmatter",error:n}),{}}}async function Ap(r,e){try{let n=(0,lh.normalizePath)(e).split("/").filter(a=>a.length>0),i="";for(let a of n)if(i=i?`${i}/${a}`:a,!await r.adapter.exists(i))try{await r.createFolder(i)}catch(s){if(!await r.adapter.exists(i))throw new Error(`Failed to create folder "${i}"`)}}catch(t){let n=t instanceof Error?t.message:String(t),i=t instanceof Error?t.stack:void 0;oh.error("Error creating folder structure:",{category:"internal",operation:"creating-folder-structure",details:{stack:i,folderPath:e,normalizedPath:(0,lh.normalizePath)(e)},error:n});let a=new Error(`Failed to create folder "${e}": ${n}`);throw i&&(a.stack=i),a}}function N7e(r,e){try{let t=new Date(r),n=new Date(e);if(isNaN(t.getTime())||isNaN(n.getTime()))return oh.error("Invalid timestamps for duration calculation:",{category:"validation",operation:"invalid-timestamps-duration-calculation",details:{startTime:r,endTime:e}}),0;if(n<=t)return oh.error("End time is not after start time:",{category:"internal",operation:"end-time-not-start-time",details:{startTime:r,endTime:e}}),0;let i=n.getTime()-t.getTime(),a=Math.round(i/(1e3*60));return Math.max(0,a)}catch(t){return oh.error("Error calculating duration:",{category:"internal",operation:"calculating-duration",details:{startTime:r,endTime:e},error:t}),0}}function Aa(r){return!r||!Array.isArray(r)?0:r.reduce((e,t)=>{if(!t.startTime||!t.endTime)return e;let n=N7e(t.startTime,t.endTime);return e+n},0)}function j_(r){return!r||!Array.isArray(r)?null:r.find(e=>e.startTime&&!e.endTime)||null}function B_(r){if(!r||r===0||isNaN(r))return"0m";let e=Math.floor(r/60),t=r%60;return e===0?`${t}m`:t===0?`${e}h`:`${e}h ${t}m`}function eS(r){if(r==="none")return"";let e=new Date,t;switch(r){case"today":t=e;break;case"tomorrow":t=new Date(e),t.setDate(e.getDate()+1);break;case"next-week":t=new Date(e),t.setDate(e.getDate()+7);break;default:return""}return P(t,"yyyy-MM-dd")}function R7e(r){return typeof r=="string"&&/^([01]\d|2[0-3]):[0-5]\d$/.test(r)}function Ip(r,e){let t=eS(r);return!t||!R7e(e)?t:Ni(t,e)}function WB(r,e){return r.getUTCFullYear()===e.getUTCFullYear()&&r.getUTCMonth()===e.getUTCMonth()&&r.getUTCDate()===e.getUTCDate()}function Fpe(r,e,t,n,i,a,s){var d;let o=r.metadataCache.getFileCache(n),l=o==null?void 0:o.frontmatter;if(l)if(i){let u=i.mapFromFrontmatter(l,t,a);return{title:u.title||"Untitled task",status:u.status||s||"open",priority:u.priority||"normal",due:u.due,scheduled:u.scheduled,path:t,archived:u.archived||!1,tags:u.tags||[],contexts:u.contexts||[],projects:u.projects||[],recurrence:u.recurrence,complete_instances:u.complete_instances,completedDate:u.completedDate,timeEstimate:u.timeEstimate,timeEntries:u.timeEntries,dateCreated:u.dateCreated,dateModified:u.dateModified,reminders:u.reminders}}else{let p=new Yf(jw).mapFromFrontmatter(l,t,a);return{title:p.title||"Untitled task",status:p.status||s||"open",priority:p.priority||"normal",due:p.due,scheduled:p.scheduled,path:t,archived:p.archived||!1,tags:p.tags||[],contexts:p.contexts||[],projects:p.projects||[],recurrence:p.recurrence,complete_instances:p.complete_instances,completedDate:p.completedDate,timeEstimate:p.timeEstimate,timeEntries:p.timeEntries,dateCreated:p.dateCreated,dateModified:p.dateModified,reminders:p.reminders}}return{title:((d=t.split("/").pop())==null?void 0:d.replace(".md",""))||"Untitled",status:s||"open",priority:"normal",path:t,archived:!1,reminders:[]}}function Np(r){if(r.startsWith("---")){let e=r.match(/^---\s*\r?\n([\s\S]*?)\r?\n---\s*\r?\n?([\s\S]*)$/);if(e)return{frontmatter:e[1],body:e[2]||""}}return{frontmatter:null,body:r}}function $pe(r){let e=/^(\s*)([-*+]|\d+\.)(\s+\[)[xX](\].*)/gm,t=!1;return{content:r.replace(e,(i,a,s,o,l)=>(t=!0,`${a}${s}${o} ${l}`)),changed:t}}function U_(r,e){return NB(r,e)}function bv(r,e,t){return P_(r,e,t)}function Tv(r,e,t){return Zw(r,e,t)}function zpe(r){return ype(r)}function jpe(r,e=!0){return ih(r,e)}function Bpe(r){return Tpe(r)}function Rpe(r,e=!1){if(e&&r==="24:00")return Ope;let t=/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])$/.exec(r);return t?Number(t[1])*60+Number(t[2]):null}function O7e(r){if(!r||typeof r!="object")return!1;let e=r;if(!e.id||typeof e.id!="string"||!e.title||typeof e.title!="string"||!e.startTime||typeof e.startTime!="string"||!e.endTime||typeof e.endTime!="string")return!1;let t=Rpe(e.startTime),n=Rpe(e.endTime,!0);if(t===null||n===null||(e.endTime==="00:00"&&t>0?Ope:n)<=t||e.attachments&&!Array.isArray(e.attachments))return!1;if(e.attachments){for(let a of e.attachments)if(typeof a!="string"||!a.trim())return!1}return!(e.color&&typeof e.color!="string"||e.description&&typeof e.description!="string")}function L7e(r,e){try{let t=z_(r);if(!t||!t.timeblocks||!Array.isArray(t.timeblocks))return[];let n=[];for(let i of t.timeblocks)O7e(i)?n.push(i):oh.warn(`Invalid timeblock in ${e}:`,{category:"validation",operation:"invalid-timeblock",details:{value:i}});return n}catch(t){return oh.error(`Error extracting timeblocks from ${e}:`,{category:"internal",operation:"extracting-timeblocks",error:t}),[]}}function YB(){return`tb-${Date.now()}-${Math.random().toString(36).substring(2,11)}`}function F7e(r,e,t){return{...r,id:YB(),startTime:e,endTime:t,attachments:r.attachments?[...r.attachments]:void 0}}async function GB(r,e,t,n,i,a){let{getDailyNote:s,getAllDailyNotes:o,appHasDailyNotesPluginLoaded:l}=await Promise.resolve().then(()=>tt(jd()));if(!l())throw new Error("Daily Notes plugin is not enabled");let c=o(),d=Lpe(t),u=s(d,c);if(!u)throw new Error(`Daily note for ${t} not found`);let p=await r.vault.read(u),m=L7e(p,u.path),f=m.findIndex(v=>v.id===e);if(f===-1)throw new Error(`Timeblock ${e} not found`);let h=m[f];if(t===n){await $7e(r,u,e,i,a);return}await z7e(r,u,e);let g={...h,startTime:i,endTime:a};await Hpe(r,n,g)}async function Upe(r,e,t,n,i){let a=F7e(t,n,i);return await Hpe(r,e,a),a}async function $7e(r,e,t,n,i){let a=await r.vault.read(e),s=z_(a)||{};if(!s.timeblocks||!Array.isArray(s.timeblocks))throw new Error("No timeblocks found in frontmatter");let o=s.timeblocks.findIndex(l=>l.id===t);if(o===-1)throw new Error(`Timeblock ${t} not found`);s.timeblocks[o].startTime=n,s.timeblocks[o].endTime=i,await KB(r,e,s,a)}async function z7e(r,e,t){let n=await r.vault.read(e),i=z_(n)||{};!i.timeblocks||!Array.isArray(i.timeblocks)||(i.timeblocks=i.timeblocks.filter(a=>a.id!==t),await KB(r,e,i,n))}async function Hpe(r,e,t){let{createDailyNote:n,getDailyNote:i,getAllDailyNotes:a}=await Promise.resolve().then(()=>tt(jd())),s=Lpe(e),o=a(),l=i(s,o);if(!l){try{l=await n(s)}catch(u){let p=u instanceof Error?u.message:String(u);throw new Error(`Failed to create daily note: ${p}. Please check your Daily Notes plugin configuration and ensure the daily notes folder exists.`)}if(!l)throw new Error("Failed to create daily note. Please check your Daily Notes plugin configuration and ensure the daily notes folder exists.")}let c=await r.vault.read(l),d=z_(c)||{};d.timeblocks||(d.timeblocks=[]),d.timeblocks.push(t),await KB(r,l,d,c)}async function KB(r,e,t,n){let i=n;if(n.startsWith("---")){let o=n.indexOf("---",3);o!==-1&&(i=n.substring(o+3))}let s=`--- +${(0,lh.stringifyYaml)(t)}---${i}`;await Xa(r,e,s)}function Tl(r){return!r||!Array.isArray(r)?[]:r.filter(e=>{if(typeof e!="string")return!1;let t=e.trim();return!(t.length===0||t==='""'||t==="''")})}function Vpe(r,e){return M_(r,e)}function qpe(r,e,t){return kpe(r,e,t)}function Ri(r){return!r||typeof r!="string"?"":r.split(",").map(e=>Rw(e)).filter(e=>e.length>0).join(", ")}function ou(r){return!r||typeof r!="string"?"":r.replace(/[^a-zA-Z0-9-]/g,"-").toLowerCase()}var lh,oh,Ope,Ct=y(()=>{lh=require("obsidian");Br();fB();f_();yv();Ne();iv();fc();G();qB();oh=I({tag:"Utils/Helpers"}),Ope=1440});function Z(r){var e;if(r==null)return"";if(typeof r=="string")return r;if(typeof r=="number")return Number.prototype.toString.call(r);if(typeof r=="bigint")return BigInt.prototype.toString.call(r);if(typeof r=="boolean")return r?"true":"false";if(typeof r=="symbol")return(e=r.description)!=null?e:"";if(r instanceof Date)return r.toISOString();if(Array.isArray(r))return r.map(t=>Z(t)).filter(t=>t.length>0).join(", ");try{let t=JSON.stringify(r);return typeof t=="string"?t:""}catch(t){return""}}function H_(r){return Array.isArray(r)?r.map(e=>Z(e)):[Z(r)]}var gr=y(()=>{});var ltr,Rp,V_=y(()=>{gr();G();ltr=I({tag:"Utils/ProjectMetadataResolver"}),Rp=class{constructor(e){this.deps=e}buildMetadataRows(e,t,n){var s;let i=[],a=Math.min(e.length,3);for(let o=0;o0&&i.push(d.join(" "))}catch(c){}}return i}stringifyFmValue(e){if(e==null)return"";if(Array.isArray(e))return e.map(i=>this.stringifyFmValue(i)).filter(Boolean).join(", ");let t=typeof e;if(t==="string"){let i=e.trim(),a=i.match(/^\[\[([^\]]+)\]\]$/);if(a){let l=a[1].split("|");if(l.length>1&&l[1].trim())return l[1].trim();let c=l[0].split("#")[0].trim();return(c.split("/").pop()||c).replace(/\.md$/i,"")}let s=i.match(/^\[([^\]]+)\]\(([^)]+)\)$/);return s?s[1].trim():i}if(t==="number"||t==="boolean")return Z(e);if(t==="object"){let n=e;if(typeof n.path=="string"){let i=n.path;return(i.split("/").pop()||i).replace(/\.md$/i,"")}return""}return""}resolve(e,t){if(!e)return"";if(e.startsWith("file."))switch(e){case"file.basename":return t.basename||"";case"file.name":return t.name||"";case"file.path":return t.path||"";case"file.parent":return t.parent||"";default:return""}if(e==="title")return t.title||"";if(e==="aliases"){let a=t.aliases||[];return a.length?a.join(", "):""}let n=e;e.startsWith("frontmatter:")&&(n=e.slice(12));let i=this.deps.getFrontmatter(t)||{};return this.stringifyFmValue(i[n])}}});function j7e(r){let e=[],t="",n=0;for(;ni.length>0)}function B7e(r){return r.replace(/\\\|/g,"|").replace(/\\\)/g,")")}function hc(r){let e=[];if(!r)return e;let t=/\{([^}]*)\}/g,n,i=0;for(;(n=t.exec(r))!==null;){let s=r.slice(i,n.index);s.length>0&&e.push({property:`literal:${s}`,showName:!1}),i=t.lastIndex;let o=n[1].trim();if(!o)continue;let l=j7e(o);if(l.length===0)continue;let c=l[0];if(!c)throw new Error("Missing property name in token");let d={property:c,showName:!1};for(let u=1;u0&&e.push({property:`literal:${a}`,showName:!1}),e}var tS=y(()=>{});function Wpe(r){return r!=null?r.trim():""}function U7e(r){let e=Wpe(r);return e.length>0?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function H7e(r){return r?r.trim():""}function kv(r){let e=H7e(r==null?void 0:r.propertyKey),t=Wpe(r==null?void 0:r.propertyValue);return{key:e,value:t,enabled:e.length>0}}function wv(r,e){if(!e.enabled)return!0;if(!r||typeof r!="object"||!(e.key in r))return!1;let t=r[e.key],n=U7e(e.value);if(n.length===0)return t!=null;let i=new Set(n.map(s=>s.toLowerCase())),a=s=>{if(s==null)return!1;if(Array.isArray(s))return s.some(o=>a(o));if(typeof s=="string")return i.has(s.trim().toLowerCase());if(typeof s=="number"||typeof s=="boolean")return i.has(String(s).toLowerCase());if(typeof s=="object")try{return i.has(JSON.stringify(s).toLowerCase())}catch(o){return!1}return i.has(Z(s).toLowerCase())};return a(t)}var q_=y(()=>{gr()});var Oi,lu,ch,yr,cu=y(()=>{Ne();Oi=class extends Error{constructor(t,n,i){super(t);this.field=n;this.nodeId=i;this.name="FilterValidationError"}},lu=class extends Error{constructor(t,n){super(t);this.nodeId=n;this.name="FilterEvaluationError"}},ch=class ch{static generateId(){return`filter_${Date.now()}_${++this.idCounter}`}static deepCloneFilterQuery(e){return JSON.parse(JSON.stringify(e))}static validateFilterNode(e,t=!0){if(!e||typeof e!="object")throw new Oi("Filter node must be an object");if(!("id"in e)||!e.id||typeof e.id!="string")throw new Oi("Filter node must have a valid string ID",void 0,"id"in e?String(e.id):"unknown");if(e.type==="condition")this.validateCondition(e,t);else if(e.type==="group")this.validateGroup(e,t);else{let n=e;throw new Oi(`Unknown filter node type: ${String(n.type)}`,void 0,typeof n.id=="string"?n.id:void 0)}}static validateCondition(e,t=!0){if(typeof e.property!="string")throw new Oi("Condition must have a valid property","property",e.id);if(t&&e.property==="")throw new Oi("Property must be selected","property",e.id);if(e.property==="")return;if(!e.operator||typeof e.operator!="string")throw new Oi("Condition must have a valid operator","operator",e.id);if(!this.getValidOperatorsForProperty(e.property).includes(e.operator))throw new Oi(`Operator '${e.operator}' is not valid for property '${e.property}'`,"operator",e.id);if(t&&this.operatorRequiresValue(e.operator)&&(e.value===null||e.value===void 0||e.value===""))throw new Oi(`Operator '${e.operator}' requires a value`,"value",e.id)}static validateGroup(e,t=!0){if(!e.conjunction||!["and","or"].includes(e.conjunction))throw new Oi("Group must have a valid conjunction (and/or)","conjunction",e.id);if(!Array.isArray(e.children))throw new Oi("Group must have a children array","children",e.id);e.children.forEach((n,i)=>{try{this.validateFilterNode(n,t)}catch(a){throw a instanceof Oi?new Oi(`Child ${i}: ${a.message}`,a.field,e.id):a}})}static getValidOperatorsForProperty(e){return typeof e=="string"&&e.startsWith("user:")?["is","is-not","contains","does-not-contain","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty","is-checked","is-not-checked","is-greater-than","is-less-than","is-greater-than-or-equal","is-less-than-or-equal"]:{"":[],title:["is","is-not","contains","does-not-contain","is-empty","is-not-empty"],path:["contains","does-not-contain","is-empty","is-not-empty"],status:["is","is-not","is-empty","is-not-empty"],priority:["is","is-not","is-empty","is-not-empty"],tags:["contains","does-not-contain","is-empty","is-not-empty"],contexts:["contains","does-not-contain","is-empty","is-not-empty"],projects:["contains","does-not-contain","is-empty","is-not-empty"],blockedBy:["contains","does-not-contain","is-empty","is-not-empty"],blocking:["contains","does-not-contain","is-empty","is-not-empty"],due:["is","is-not","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty"],scheduled:["is","is-not","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty"],completedDate:["is","is-not","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty"],dateCreated:["is","is-not","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty"],dateModified:["is","is-not","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty"],archived:["is-checked","is-not-checked"],hasSubtasks:["is-checked","is-not-checked"],"dependencies.isBlocked":["is-checked","is-not-checked"],"dependencies.isBlocking":["is-checked","is-not-checked"],timeEstimate:["is","is-not","is-greater-than","is-less-than","is-greater-than-or-equal","is-less-than-or-equal"],recurrence:["is-empty","is-not-empty"],"status.isCompleted":["is-checked","is-not-checked"]}[e]||[]}static isFilterNodeComplete(e){try{return this.validateFilterNode(e,!0),!0}catch(t){return!1}}static operatorRequiresValue(e){return!["is-empty","is-not-empty","is-checked","is-not-checked"].includes(e)}static getTaskPropertyValue(e,t){var n;switch(t){case"title":return e.title;case"path":return e.path;case"status":return e.status;case"priority":return e.priority;case"tags":return e.tags||[];case"contexts":return e.contexts||[];case"projects":return e.projects||[];case"blockedBy":return((n=e.blockedBy)==null?void 0:n.map(i=>i.uid))||[];case"blocking":return e.blocking||[];case"due":return e.due;case"scheduled":return e.scheduled;case"completedDate":return e.completedDate;case"dateCreated":return e.dateCreated;case"dateModified":return e.dateModified;case"archived":return e.archived;case"hasSubtasks":return e.hasSubtasks===!0;case"timeEstimate":return e.timeEstimate;case"recurrence":return e.recurrence;case"status.isCompleted":return;case"dependencies.isBlocked":return e.isBlocked===!0;case"dependencies.isBlocking":return e.isBlocking===!0;default:throw new lu(`Unknown property: ${t}`)}}static applyOperator(e,t,n,i,a){try{switch(t){case"is":return this.isEqual(e,n,a);case"is-not":return!this.isEqual(e,n,a);case"contains":return this.contains(e,n,a);case"does-not-contain":return!this.contains(e,n,a);case"is-before":return this.isBefore(e,n);case"is-after":return this.isAfter(e,n);case"is-on-or-before":return this.isOnOrBefore(e,n);case"is-on-or-after":return this.isOnOrAfter(e,n);case"is-empty":return this.isEmpty(e);case"is-not-empty":return!this.isEmpty(e);case"is-checked":return e===!0;case"is-not-checked":return e!==!0;case"is-greater-than":return this.isGreaterThan(e,n);case"is-less-than":return this.isLessThan(e,n);case"is-greater-than-or-equal":return this.isGreaterThanOrEqual(e,n);case"is-less-than-or-equal":return this.isLessThanOrEqual(e,n);default:throw new lu("Unknown operator",i)}}catch(s){throw s instanceof lu?s:new lu(`Error applying operator '${t}': ${s.message}`,i)}}static isEqual(e,t,n){if(n&&this.isDateProperty(n)&&typeof e=="string"&&typeof t=="string"&&(e||L_(t)))return this.isEqualDate(e,t);let i=(a,s)=>this.hasNumericComparison(a,s)?this.toFiniteNumber(a)===this.toFiniteNumber(s):a===s;return Array.isArray(e)?Array.isArray(t)?e.some(a=>t.some(s=>i(a,s))):e.some(a=>i(a,t)):Array.isArray(t)?t.some(a=>i(e,a)):i(e,t)}static hasNumericComparison(e,t){return!(typeof e=="number")&&!(typeof t=="number")?!1:this.toFiniteNumber(e)!==void 0&&this.toFiniteNumber(t)!==void 0}static toFiniteNumber(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string")return;let t=e.trim();if(!t)return;let n=Number(t);return Number.isFinite(n)?n:void 0}static matchesHierarchicalTag(e,t){if(!e||!t)return!1;let n=e.toLowerCase(),i=t.toLowerCase();return!!(n===i||n.startsWith(i+"/")||n.includes(i))}static matchesHierarchicalTagExact(e,t){if(!e||!t)return!1;let n=e.toLowerCase(),i=t.toLowerCase();return!!(n===i||n.startsWith(i+"/"))}static matchesTagConditions(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(t.length===0)return!0;let n=[],i=[];for(let a of t)if(typeof a=="string"&&a.startsWith("-")){let s=a.slice(1);s&&i.push(s)}else typeof a=="string"&&n.push(a);for(let a of i)if(e.some(o=>this.matchesHierarchicalTag(o,a)))return!1;return n.length>0?n.some(a=>e.some(s=>this.matchesHierarchicalTag(s,a))):!0}static contains(e,t,n){if(Array.isArray(e))if(Array.isArray(t))if(n==="tags"){let i=e.filter(s=>typeof s=="string"),a=t.filter(s=>typeof s=="string");return ch.matchesTagConditions(i,a)}else return t.some(i=>e.some(a=>typeof a=="string"&&typeof i=="string"&&a.toLowerCase().includes(i.toLowerCase())));else{let i=typeof t=="string"?t:String(t!=null?t:"");if(n==="tags"){let a=e.filter(s=>typeof s=="string");return ch.matchesTagConditions(a,[i])}else{let a=i.toLowerCase();return e.some(s=>typeof s=="string"&&s.toLowerCase().includes(a))}}else if(typeof e=="string")if(Array.isArray(t))if(n==="tags"){let i=t.filter(a=>typeof a=="string");return ch.matchesTagConditions([e],i)}else return t.some(i=>typeof i=="string"&&e.toLowerCase().includes(i.toLowerCase()));else return n==="tags"&&typeof t=="string"?ch.matchesTagConditions([e],[t]):typeof t=="string"&&e.toLowerCase().includes(t.toLowerCase());return!1}static isBefore(e,t){if(!e||!t)return!1;try{let n=nh(t);return nu(e,n)}catch(n){return!1}}static isAfter(e,t){if(!e||!t)return!1;try{let n=nh(t);return nu(n,e)}catch(n){return!1}}static isOnOrBefore(e,t){if(!e||!t)return!1;try{let n=nh(t);return nu(e,n)||bo(ke(e),ke(n))}catch(n){return!1}}static isOnOrAfter(e,t){if(!e||!t)return!1;try{let n=nh(t);return nu(n,e)||bo(ke(e),ke(n))}catch(n){return!1}}static isDateProperty(e){return["due","scheduled","completedDate","dateCreated","dateModified"].includes(e)}static isEqualDate(e,t){try{let n=nh(t);return bo(ke(e),ke(n))}catch(n){return!1}}static isEmpty(e){return e==null?!0:typeof e=="string"?e.trim()==="":Array.isArray(e)?e.length===0?!0:e.every(t=>{if(typeof t!="string")return!1;let n=t.trim();return n.length===0||n==='""'||n==="''"}):!1}static isGreaterThan(e,t){let n=typeof e=="number"?e:parseFloat(e),i=typeof t=="number"?t:parseFloat(t);return isNaN(n)||isNaN(i)?!1:n>i}static isLessThan(e,t){let n=typeof e=="number"?e:parseFloat(e),i=typeof t=="number"?t:parseFloat(t);return isNaN(n)||isNaN(i)?!1:n=i}static isLessThanOrEqual(e,t){let n=typeof e=="number"?e:parseFloat(e),i=typeof t=="number"?t:parseFloat(t);return isNaN(n)||isNaN(i)?!1:n<=i}};ch.idCounter=0;yr=ch});function Sv(r){var n,i,a;let e=new Set;for(let s of(n=r==null?void 0:r.tags)!=null?n:[])QB(e,s.tag);let t=(i=r==null?void 0:r.frontmatter)!=null?i:null;for(let s of(a=(0,Ype.parseFrontMatterTags)(t))!=null?a:[])QB(e,s);return ZB(e,t==null?void 0:t.tags),ZB(e,t==null?void 0:t.tag),Array.from(e)}function ZB(r,e){if(Array.isArray(e)){for(let t of e)ZB(r,t);return}if(typeof e=="string")for(let t of e.split(/[,\s]+/))QB(r,t)}function QB(r,e){if(typeof e!="string")return;let t=e.trim().replace(/^#/,"");t&&r.add(t)}var Ype,W_=y(()=>{Ype=require("obsidian")});function rS(r,e){if(!r||!e)return 0;let t=r.toLowerCase().split(" ").filter(Boolean),n=e.toLowerCase(),i=0,a=0;for(let s=0;s0&&l===i&&(a+=5),i=l+o.length}return a}var Gpe=y(()=>{});var XB={};et(XB,{FileSuggestHelper:()=>JB,getActiveFolderPath:()=>Y_,isPathInIncludedFolders:()=>G_,resolveIncludeFolders:()=>Qpe});function V7e(r){var t;let e=(t=r==null?void 0:r.app)==null?void 0:t.vault;return typeof(e==null?void 0:e.getFiles)=="function"?e.getFiles():typeof(e==null?void 0:e.getMarkdownFiles)=="function"?e.getMarkdownFiles():[]}function q7e(r){return r.extension==="md"?r.basename:r.name||r.path.split("/").pop()||r.basename}function Zpe(r){return r.trim().replace(/\\/g,"/").replace(/^\/+/,"").replace(/\/+$/,"")}function W7e(r,e=""){let t=Zpe(e).split("/").filter(Boolean);for(let n of r.replace(/\\/g,"/").split("/"))!n||n==="."||(n===".."?t.pop():t.push(n));return t.join("/")}function Y7e(r,e){let t=Zpe(r);return t==="."||t===".."||t.startsWith("./")||t.startsWith("../")?W7e(t,e):t}function Y_(r){var t,n,i,a;let e=(i=(n=(t=r==null?void 0:r.app)==null?void 0:t.workspace)==null?void 0:n.getActiveFile)==null?void 0:i.call(n);if(((a=e==null?void 0:e.parent)==null?void 0:a.path)!==void 0)return e.parent.path;if(typeof(e==null?void 0:e.path)=="string")return e.path.split("/").slice(0,-1).join("/")}function Qpe(r,e){return r.filter(t=>t.trim().length>0).map(t=>Y7e(t,e))}function G_(r,e,t){return Qpe(e,t).some(i=>i===""||r===i||r.startsWith(`${i}/`))}var Kpe,JB,nS=y(()=>{Kpe=require("obsidian");Gpe();tS();q_();cu();Nw();W_();JB={async suggest(r,e,t=20,n,i=Y_(r)){var o,l;let a=async()=>{var w,S,x,C,D,_,O;let c=V7e(r),d=[],u=cc((w=r.settings)==null?void 0:w.excludedFolders),p=((C=(x=(S=r.settings)==null?void 0:S.projectAutosuggest)==null?void 0:x.rows)!=null?C:[]).slice(0,3),m=new Set;for(let L of p)try{let N=hc(L);for(let R of N)R.searchable&&!R.property.startsWith("literal:")&&m.add(R.property)}catch(N){}let f=(e||"").toLowerCase(),h=(D=n==null?void 0:n.requiredTags)!=null?D:[],g=(_=n==null?void 0:n.includeFolders)!=null?_:[],v=kv(n);for(let L of c){if(rv(L.path,u))continue;let N=r.app.metadataCache.getFileCache(L);if(h.length>0&&!yr.matchesTagConditions(Sv(N),h)||g.length>0&&!G_(L.path,g,i))continue;if(v.enabled){let te=N==null?void 0:N.frontmatter;if(!wv(te,v))continue}let R=L.basename,z="";if(N!=null&&N.frontmatter){let te=r.fieldMapper.mapFromFrontmatter(N.frontmatter,L.path,r.settings.storeTitleInFilename);z=typeof te.title=="string"?te.title:""}let H=N!=null&&N.frontmatter?(0,Kpe.parseFrontMatterAliases)(N.frontmatter)||[]:[],Y=0,J=f.length>0?rS(e,R):1;if(J>0&&(Y=Math.max(Y,J+15)),z){let te=rS(e,z);te>0&&(Y=Math.max(Y,te+5))}if(Array.isArray(H)){for(let te of H)if(typeof te=="string"){let Te=rS(e,te);Te>0&&(Y=Math.max(Y,Te))}}if(m.size>0){let te=(N==null?void 0:N.frontmatter)||{};for(let Te of m){let Ce="";if(Te==="file.path")Ce=L.path;else if(Te==="file.parent")Ce=((O=L.parent)==null?void 0:O.path)||"";else if(Te==="file.basename")Ce=R;else if(Te==="title")Ce=z;else if(Te==="aliases")Ce=(Array.isArray(H)?H.filter(ne=>typeof ne=="string"):[]).join(" ");else{let X=te[Te];X!=null&&(Array.isArray(X)?Ce=X.filter(ne=>typeof ne=="string").join(" "):typeof X=="object"?Ce=JSON.stringify(X):(typeof X=="string"||typeof X=="number"||typeof X=="boolean")&&(Ce=String(X)))}if(Ce){let X=rS(e,Ce),ne=X>0?X:Ce.toLowerCase().includes(f)?30:0;ne>0&&(Y=Math.max(Y,ne))}}}if(Y>0){let te=[];z&&z!==R&&te.push(`title: ${z}`);let Te=Array.isArray(H)?H.filter(X=>typeof X=="string"):[];Te.length&&te.push(`aliases: ${Te.join(", ")}`);let Ce=te.length?`${R} [${te.join(" | ")}]`:R;d.push({insertText:q7e(L),displayText:Ce,score:Y})}}d.sort((L,N)=>N.score-L.score);let k=[],b=new Set;for(let L of d)if(!b.has(L.insertText)&&(k.push(L),b.add(L.insertText),k.length>=t))break;return k},s=(l=(o=r.settings)==null?void 0:o.suggestionDebounceMs)!=null?l:0;return s?new Promise(c=>{let d=r;d.__fileSuggestTimer&&window.clearTimeout(d.__fileSuggestTimer),d.__fileSuggestTimer=window.setTimeout(()=>{(async()=>{let u=await a();c(u)})()},s)}):a()}}});var gc,G7e,yc,iS=y(()=>{gc=require("obsidian");V_();tS();q_();cu();W_();nS();G();G7e=I({tag:"Modals/ProjectSelectModal"}),yc=class extends gc.FuzzySuggestModal{constructor(e,t,n){super(e),this.plugin=t,this.onChoose=n,this.setPlaceholder("Type to search for project notes..."),this.setInstructions([{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to select"},{command:"esc",purpose:"to cancel"}])}getItems(){var s,o,l,c,d,u,p;let e=this.app.vault.getAllLoadedFiles().filter(m=>m instanceof gc.TFile&&m.extension==="md"&&!m.path.includes(".trash")),t=(l=(o=(s=this.plugin.settings)==null?void 0:s.projectAutosuggest)==null?void 0:o.requiredTags)!=null?l:[],n=(u=(d=(c=this.plugin.settings)==null?void 0:c.projectAutosuggest)==null?void 0:d.includeFolders)!=null?u:[],i=kv((p=this.plugin.settings)==null?void 0:p.projectAutosuggest),a=Y_(this.plugin);return t.length===0&&n.length===0&&!i.enabled?e:e.filter(m=>{if(!(m instanceof gc.TFile))return!1;let f=this.app.metadataCache.getFileCache(m);if(t.length>0&&!yr.matchesTagConditions(Sv(f),t)||n.length>0&&!G_(m.path,n,a))return!1;if(i.enabled){let h=f==null?void 0:f.frontmatter;if(!wv(h,i))return!1}return!0})}getItemText(e){var s,o,l,c;if(!(e instanceof gc.TFile))return e.name;let t=`${e.name} ${e.path}`,n=(l=(o=(s=this.plugin.settings)==null?void 0:s.projectAutosuggest)==null?void 0:o.rows)!=null?l:[],i=new Set;for(let d of n)try{let u=hc(d);for(let p of u)p.searchable&&!p.property.startsWith("literal:")&&i.add(p.property)}catch(u){}let a=this.app.metadataCache.getFileCache(e);if(a!=null&&a.frontmatter){let d=this.plugin.fieldMapper.mapFromFrontmatter(a.frontmatter,e.path,this.plugin.settings.storeTitleInFilename),u=typeof d.title=="string"?d.title:"";u&&(t+=` ${u}`);let p=(0,gc.parseFrontMatterAliases)(a.frontmatter)||[];Array.isArray(p)&&p.length>0&&(t+=` ${p.join(" ")}`);for(let m of i){let f="";switch(m){case"file.path":f=e.path;break;case"file.parent":f=((c=e.parent)==null?void 0:c.name)||"";break;case"file.basename":f=e.basename;break;case"title":case"aliases":break;default:{let h=a.frontmatter[m];h!=null&&(f=Array.isArray(h)?h.join(" "):String(h));break}}f&&(t+=` ${f}`)}}return t}renderSuggestion(e,t){var s,o,l,c;let n=e.item;if(t.empty(),!(n instanceof gc.TFile)){t.textContent=n.name;return}let i=t.createDiv({cls:"project-suggestion"}),a=((l=(o=(s=this.plugin.settings)==null?void 0:s.projectAutosuggest)==null?void 0:o.rows)!=null?l:[]).slice(0,3);if(a.length===0){i.createSpan({cls:"project-name",text:n.basename});return}try{let d=this.app.metadataCache.getFileCache(n),u=(d==null?void 0:d.frontmatter)||{},p=this.plugin.fieldMapper.mapFromFrontmatter(u,n.path,this.plugin.settings.storeTitleInFilename),m=typeof p.title=="string"?p.title:"",f=(0,gc.parseFrontMatterAliases)(u)||[],h=Array.isArray(f)?f.filter(b=>typeof b=="string"):[],g={basename:n.basename,name:n.name,path:n.path,parent:((c=n.parent)==null?void 0:c.path)||"",title:m,aliases:h,frontmatter:u},v=new Rp({getFrontmatter:()=>u});i.createDiv({cls:"project-name",text:n.basename});let k=v.buildMetadataRows(a,g,hc);for(let b of k){let w=i.createDiv({cls:"project-meta"});w.textContent=b}}catch(d){G7e.error("Error rendering project suggestion:",{category:"internal",operation:"rendering-project-suggestion",error:d}),i.createSpan({cls:"project-name",text:n.basename})}}onChooseItem(e,t){this.onChoose(e)}}});function zs(r){if(r==null)return[];let e=[],t="",n=0,i=null;for(let s=0;s0){n--,t+="]]",s++;continue}if(!n&&(o==='"'||o==="'")){i===null?i=o:i===o&&(i=null),t+=o;continue}if(o===","&&n===0&&i===null){let c=t.trim();c&&e.push(c),t="";continue}t+=o}let a=t.trim();return a&&e.push(a),e}var Op=y(()=>{});function K_(r){let e=r.search(/[#^]/);return(e===-1?r:r.slice(0,e)).trim()}function jt(r){if(!r)return r;let e=r.trim();if(e.startsWith("<")&&e.endsWith(">")){let n=e.slice(1,-1).trim(),i=/\.md$/i.test(n);try{n=decodeURIComponent(n)}catch(s){Jpe.debug("Failed to decode URI component:",{category:"internal",operation:"decode-uri-component",details:{value:n},error:s})}let a=K_(n);return i?n:a||n}if(e.startsWith("[[")&&e.endsWith("]]")){let n=e.slice(2,-2).trim(),i=n.indexOf("|"),a=i!==-1?n.substring(0,i):n;return K_(a)}let t=e.match(/^\[([^\]]*)\]\(([^)]+)\)$/);if(t){let n=t[2].trim();n.startsWith("<")&&n.endsWith(">")&&(n=n.slice(1,-1).trim());let i=/\.md$/i.test(n);try{n=decodeURIComponent(n)}catch(s){Jpe.debug("Failed to decode URI component:",{category:"internal",operation:"decode-uri-component",details:{value:n},error:s})}let a=K_(n);return i?n:a}return e}function kl(r,e){if(!r)return"";let t=r.trim(),n=t.match(/^\[([^\]]+)\]\(([^)]+)\)$/);if(n){let i=n[1].trim(),a=n[2].trim(),s=jt(a),o=Xpe(s,e,i);if(o)return o;if(i)return i;let l=s.replace(/\.md$/i,""),c=l.split("/");return c[c.length-1]||l}if(t.startsWith("[[")&&t.endsWith("]]")){let i=t.slice(2,-2).trim(),a=i.indexOf("|");if(a!==-1){let d=i.slice(a+1).trim();if(d)return d}let s=K_(i.split("|")[0]||i)||jt(t),o=Xpe(s,e);if(o)return o;let l=s.replace(/\.md$/i,""),c=l.split("/");return c[c.length-1]||l}return t}function Xpe(r,e,t){let n=e==null?void 0:e.metadataCache.getFirstLinkpathDest(r,"");if(!n)return null;let i=K7e(n,e);return i&&Z7e(t,n,r)?i:(t==null?void 0:t.trim())||n.basename}function K7e(r,e){var i,a,s,o;let t=(s=e==null?void 0:e.metadataCache.getFileCache(r))!=null?s:(a=(i=e==null?void 0:e.metadataCache)==null?void 0:i.getCache)==null?void 0:a.call(i,r.path),n=(o=t==null?void 0:t.frontmatter)==null?void 0:o.title;return typeof n=="string"&&n.trim().length>0?n.trim():null}function Z7e(r,e,t){let n=(r==null?void 0:r.trim())||"";if(!n)return!0;let i=e.path.replace(/\.md$/i,""),a=t.replace(/\.md$/i,"");return new Set([e.name,e.basename,e.path,i,t,a]).has(n)}function js(r,e,t,n,i,a){if(a)return r.fileManager.generateMarkdownLink(e,t,n||"",i||"");let o=`[[${r.metadataCache.fileToLinktext(e,t,!0)}`;return n&&(o+=n),i&&(o+=`|${i}`),o+="]]",o}function Z_(r,e,t,n,i){return js(r,e,t,"",n,i)}var Jpe,jn=y(()=>{G();Jpe=I({tag:"Utils/LinkUtils"})});function J7e(r){return Q7e.includes(r)}function e2(r){if(typeof r=="string")return r;if(typeof r=="object"&&r!==null){let e=r.uid;return typeof e=="string"?e:""}return""}function ts(r){if(typeof r=="string"){let e=r.trim();return e?{uid:jt(e),reltype:es}:null}if(typeof r=="object"&&r!==null){let e=r,t=typeof e.uid=="string"?e.uid.trim():"";if(!t)return null;let n=jt(t),i=typeof e.reltype=="string"?e.reltype.trim().toUpperCase():"",a=J7e(i)?i:es,s=typeof e.gap=="string"&&e.gap.trim().length>0?e.gap.trim():void 0;return s?{uid:n,reltype:a,gap:s}:{uid:n,reltype:a}}return null}function xv(r){if(r==null)return;let e=Array.isArray(r)?r:[r],t=[];for(let n of e){let i=ts(n);i&&t.push(i)}return t.length>0?t:void 0}function eme(r){return r.map(e=>{let n={uid:e.uid.startsWith("[[")?e.uid:`[[${e.uid}]]`,reltype:e.reltype};return e.gap&&e.gap.trim().length>0&&(n.gap=e.gap),n})}function wl(r,e,t){let n=e2(t);if(!n)return null;let i=jt(n);if(!i)return null;let a=new Set;a.add(i),i.endsWith(".md")&&a.add(i.replace(/\.md$/i,""));let s=(0,Ev.parseLinktext)(i);s.path&&s.path!==i&&a.add(s.path);for(let o of a){let l=r.metadataCache.getFirstLinkpathDest(o,e);if(l instanceof Ev.TFile)return{path:l.path,file:l};let c=r.vault.getAbstractFileByPath(o);if(c instanceof Ev.TFile)return{path:c.path,file:c}}return null}function To(r,e,t,n){let i=r.vault.getAbstractFileByPath(t);return i instanceof Ev.TFile?js(r,i,e,"","",n):`[[${(t.split("/").pop()||t).replace(/\.md$/i,"")}]]`}var Ev,es,Q7e,ko=y(()=>{Ev=require("obsidian");Op();jn();es="FINISHTOSTART",Q7e=["FINISHTOSTART","FINISHTOFINISH","STARTTOSTART","STARTTOFINISH"]});function Q_(r,e){var t;return new tme.Setting(r).setName(e.label).addButton(n=>{n.setButtonText(e.buttonText).setTooltip(e.buttonTooltip).onClick(e.onButtonClick),n.buttonEl.addClasses(["tn-btn","tn-btn--ghost"])}),(t=e.listElement)!=null?t:r.createDiv({cls:"task-projects-list"})}function rme(r,e){return Q_(e.container,{label:r.translate("modals.task.organization.projects"),buttonText:r.translate("modals.task.organization.addToProjectButton"),buttonTooltip:r.translate("modals.task.projectsTooltip"),onButtonClick:e.onButtonClick,listElement:e.listElement})}function nme(r,e){return Q_(e.container,{label:r.translate("modals.task.organization.subtasks"),buttonText:r.translate("modals.task.organization.addSubtasksButton"),buttonTooltip:r.translate("modals.task.organization.addSubtasksTooltip"),onButtonClick:e.onButtonClick,listElement:e.listElement})}function ime(r,e){return Q_(e.container,{label:r.translate("modals.task.dependencies.blockedBy"),buttonText:r.translate("modals.task.dependencies.addTaskButton"),buttonTooltip:r.translate("modals.task.dependencies.selectTaskTooltip"),onButtonClick:e.onButtonClick,listElement:e.listElement})}function ame(r,e){return Q_(e.container,{label:r.translate("modals.task.dependencies.blocking"),buttonText:r.translate("modals.task.dependencies.addTaskButton"),buttonTooltip:r.translate("modals.task.dependencies.selectTaskTooltip"),onButtonClick:e.onButtonClick,listElement:e.listElement})}var tme,sme=y(()=>{tme=require("obsidian")});function lme(r){let{task:e,plugin:t,excludeSelector:n,onSingleClick:i,onDoubleClick:a,contextMenuHandler:s,createBatchContextMenu:o}=r,l=n?`${ome}, ${n}`:ome,c=null,d=(S=!1)=>{let x=t.app.vault.getAbstractFileByPath(e.path);x instanceof t2.TFile&&(S?t.app.workspace.openLinkText(e.path,"",!0):t.app.workspace.getLeaf(!1).openFile(x))},u=async()=>{await t.openTaskEditModal(e)},p=async S=>{if(i){await i(S);return}if(S.ctrlKey||S.metaKey){d(!0);return}let x=t.settings.singleClickAction;x==="edit"?await u():x==="openNote"&&d(!1)},m=async S=>{if(a){await a(S);return}let x=t.settings.doubleClickAction;x==="edit"?await u():x==="openNote"&&d()},f=async S=>{if(S.target.closest(l))return;let C=t.taskSelectionService;if(C){if(S.shiftKey){S.stopPropagation(),C.isSelectionModeActive()||C.enterSelectionMode(),C.toggleSelection(e.path);return}C.isSelectionModeActive()&&(C.clearSelection(),C.exitSelectionMode())}if(S.stopPropagation(),t.settings.doubleClickAction==="none"){await p(S);return}c?(window.clearTimeout(c),c=null,await m(S)):c=window.setTimeout(()=>{c=null,p(S)},250)},h=S=>{f(S)},g=S=>{S.button!==1||S.target.closest(l)||(S.preventDefault(),S.stopPropagation(),c&&(window.clearTimeout(c),c=null),d(!0))},v=S=>{g(S)},k=S=>{},b=async S=>{S.preventDefault(),S.stopPropagation();let x=t.taskSelectionService;if(S.shiftKey&&x){if(x.isSelectionModeActive()||x.enterSelectionMode(),x.isSelected(e.path)||x.addToSelection(e.path),x.getSelectionCount()>0){let C=o==null?void 0:o(x.getSelectedPaths(),()=>{});C==null||C.show(S)}return}if(x&&x.getSelectionCount()>1){x.isSelected(e.path)||x.addToSelection(e.path);let C=o==null?void 0:o(x.getSelectedPaths(),()=>{});C==null||C.show(S);return}x!=null&&x.isSelectionModeActive()&&(x.clearSelection(),x.exitSelectionMode()),s&&await s(S)};return{clickHandler:h,auxclickHandler:v,dblclickHandler:k,contextmenuHandler:S=>{b(S)},cleanup:()=>{c&&(window.clearTimeout(c),c=null)}}}function cme(r,e){return t=>{e.app.vault.getAbstractFileByPath(r.path)&&e.app.workspace.trigger("hover-link",{event:t,source:"tasknotes-task-card",hoverParent:t.currentTarget,targetEl:t.currentTarget,linktext:r.path,sourcePath:r.path})}}async function dme(r,e,t,n,i){let a=(d=!1)=>{let u=e.app.vault.getAbstractFileByPath(r.path);u instanceof t2.TFile&&(d?e.app.workspace.openLinkText(r.path,"",!0):e.app.workspace.getLeaf(!1).openFile(u))},s=async()=>{await e.openTaskEditModal(r,i?()=>i():void 0)},o=async d=>{if(d.ctrlKey||d.metaKey){a(!0);return}let u=e.settings.singleClickAction;u==="edit"?await s():u==="openNote"&&a(!1)},l=async d=>{let u=e.settings.doubleClickAction;u==="edit"?await s():u==="openNote"&&a()};if(e.settings.doubleClickAction==="none"){await o(t);return}let c=J_.get(n);if(c)window.clearTimeout(c),J_.delete(n),await l(t);else{let d=window.setTimeout(()=>{J_.delete(n),o(t)},250);J_.set(n,d)}}var t2,ome,J_,r2=y(()=>{t2=require("obsidian"),ome=["a","button","input","textarea","select",'[role="button"]','[data-tn-no-drag="true"]','[data-tn-click-exclude="true"]',".tag"].join(", ");J_=new Map});var ume,ki,du=y(()=>{ume=require("obsidian"),ki=class extends ume.Menu{show(e){var t;if(e.instanceOf(MouseEvent))this.showAtMouseEvent(e);else if(e.instanceOf(KeyboardEvent)){let n=e.currentTarget;if(!n||!((t=n.instanceOf)!=null&&t.call(n,HTMLElement)))return;this.showAtPosition({x:n.getBoundingClientRect().left,y:n.getBoundingClientRect().bottom+4})}}}});var pme=y(()=>{});var mme,n2=y(()=>{mme={triggers:[{propertyId:"tags",trigger:"#",enabled:!0},{propertyId:"contexts",trigger:"@",enabled:!0},{propertyId:"projects",trigger:"+",enabled:!0},{propertyId:"status",trigger:"*",enabled:!0},{propertyId:"priority",trigger:"!",enabled:!1}]}});var fme,hme=y(()=>{fme={code:"en",name:"English",chronoLocale:"en",dateTriggers:{due:["due","deadline","must be done by","by"],scheduled:["scheduled for","start on","begin on","work on","on","scheduled","start"]},recurrence:{frequencies:{daily:["daily","every day"],weekly:["weekly","every week"],monthly:["monthly","every month"],yearly:["yearly","annually","every year"]},every:["every"],other:["other"],weekdays:{monday:["monday"],tuesday:["tuesday"],wednesday:["wednesday"],thursday:["thursday"],friday:["friday"],saturday:["saturday"],sunday:["sunday"]},pluralWeekdays:{monday:["mondays"],tuesday:["tuesdays"],wednesday:["wednesdays"],thursday:["thursdays"],friday:["fridays"],saturday:["saturdays"],sunday:["sundays"]},ordinals:{first:["first"],second:["second"],third:["third"],fourth:["fourth"],last:["last"]},periods:{day:["day","days"],week:["week","weeks"],month:["month","months"],year:["year","years"]}},timeEstimate:{hours:["h","hr","hrs","hour","hours"],minutes:["m","min","mins","minute","minutes"]},fallbackStatus:{open:["todo","to do","open"],inProgress:["in progress","in-progress","doing"],done:["done","completed","finished"],cancelled:["cancelled","canceled"],waiting:["waiting","blocked","on hold"]},fallbackPriority:{urgent:["urgent","critical","highest"],high:["high","important"],normal:["medium","normal"],low:["low","minor"]}}});var gme,yme=y(()=>{gme={code:"es",name:"Espa\xF1ol",chronoLocale:"es",dateTriggers:{due:["vence","fecha l\xEDmite","debe terminarse","para el","antes del"],scheduled:["programado para","programado el","comenzar el","empezar el","trabajar en","el"]},recurrence:{frequencies:{daily:["diario","diaria","diariamente","cada d\xEDa","todos los d\xEDas","a diario"],weekly:["semanal","semanalmente","cada semana","todas las semanas","por semana"],monthly:["mensual","mensualmente","cada mes","todos los meses","por mes"],yearly:["anual","anualmente","cada a\xF1o","todos los a\xF1os","por a\xF1o"]},every:["cada","todos los","todas las"],other:["otro","otra"],weekdays:{monday:["lunes"],tuesday:["martes"],wednesday:["mi\xE9rcoles"],thursday:["jueves"],friday:["viernes"],saturday:["s\xE1bado"],sunday:["domingo"]},pluralWeekdays:{monday:["lunes"],tuesday:["martes"],wednesday:["mi\xE9rcoles"],thursday:["jueves"],friday:["viernes"],saturday:["s\xE1bados"],sunday:["domingos"]},ordinals:{first:["primer","primera","primero"],second:["segundo","segunda"],third:["tercer","tercera","tercero"],fourth:["cuarto","cuarta"],last:["\xFAltimo","\xFAltima"]},periods:{day:["d\xEDa","d\xEDas"],week:["semana","semanas"],month:["mes","meses"],year:["a\xF1o","a\xF1os"]}},timeEstimate:{hours:["h","hr","hrs","hora","horas"],minutes:["m","min","mins","minuto","minutos"]},fallbackStatus:{open:["pendiente","por hacer","abierto","todo"],inProgress:["en progreso","en curso","haciendo","trabajando"],done:["hecho","terminado","completado","finalizado"],cancelled:["cancelado","anulado"],waiting:["esperando","bloqueado","en espera"]},fallbackPriority:{urgent:["urgente","cr\xEDtico","cr\xEDtica","m\xE1ximo","m\xE1xima","prioritario","prioritaria"],high:["alto","alta","importante","elevado","elevada"],normal:["medio","media","normal","regular","est\xE1ndar"],low:["bajo","baja","menor","m\xEDnimo","m\xEDnima"]}}});var vme,bme=y(()=>{vme={code:"fr",name:"Fran\xE7ais",chronoLocale:"fr",dateTriggers:{due:["\xE9ch\xE9ance","date limite","doit \xEAtre termin\xE9","pour le","avant le"],scheduled:["programm\xE9 pour","programm\xE9 le","commencer le","d\xE9buter le","travailler sur","le"]},recurrence:{frequencies:{daily:["quotidien","quotidienne","quotidiennement","chaque jour","tous les jours","journalier","journali\xE8re"],weekly:["hebdomadaire","chaque semaine","toutes les semaines","par semaine"],monthly:["mensuel","mensuelle","mensuellement","chaque mois","tous les mois","par mois"],yearly:["annuel","annuelle","annuellement","chaque ann\xE9e","tous les ans","par an","par ann\xE9e"]},every:["chaque","tous les","toutes les"],other:["autre"],weekdays:{monday:["lundi"],tuesday:["mardi"],wednesday:["mercredi"],thursday:["jeudi"],friday:["vendredi"],saturday:["samedi"],sunday:["dimanche"]},pluralWeekdays:{monday:["lundis"],tuesday:["mardis"],wednesday:["mercredis"],thursday:["jeudis"],friday:["vendredis"],saturday:["samedis"],sunday:["dimanches"]},ordinals:{first:["premier","premi\xE8re"],second:["deuxi\xE8me","second","seconde"],third:["troisi\xE8me"],fourth:["quatri\xE8me"],last:["dernier","derni\xE8re"]},periods:{day:["jour","jours"],week:["semaine","semaines"],month:["mois"],year:["an","ans","ann\xE9e","ann\xE9es"]}},timeEstimate:{hours:["h","hr","hrs","heure","heures"],minutes:["m","min","mins","minute","minutes"]},fallbackStatus:{open:["\xE0 faire","ouvert","en attente","todo"],inProgress:["en cours","en progression","en train de faire"],done:["termin\xE9","fini","accompli","fait"],cancelled:["annul\xE9","abandonn\xE9"],waiting:["en attente","bloqu\xE9","suspendu"]},fallbackPriority:{urgent:["urgent","urgente","critique","maximum","prioritaire"],high:["\xE9lev\xE9","\xE9lev\xE9e","haut","haute","important","importante","sup\xE9rieur","sup\xE9rieure"],normal:["moyen","moyenne","normal","normale","standard","r\xE9gulier","r\xE9guli\xE8re"],low:["faible","bas","basse","mineur","mineure","minimum"]}}});var Tme,kme=y(()=>{Tme={code:"de",name:"Deutsch",chronoLocale:"de",dateTriggers:{due:["f\xE4llig","termin","abgabe","deadline","bis zum","bis"],scheduled:["geplant f\xFCr","geplant am","beginnen am","anfangen am","arbeiten an","am","geplant","starten"]},recurrence:{frequencies:{daily:["t\xE4glich","jeden Tag","alle Tage","tagaus tagein"],weekly:["w\xF6chentlich","jede Woche","alle Wochen"],monthly:["monatlich","jeden Monat","alle Monate"],yearly:["j\xE4hrlich","jedes Jahr","alle Jahre"]},every:["jede","jeden","jedes","alle"],other:["andere","anderen","anderes"],weekdays:{monday:["montag"],tuesday:["dienstag"],wednesday:["mittwoch"],thursday:["donnerstag"],friday:["freitag"],saturday:["samstag"],sunday:["sonntag"]},pluralWeekdays:{monday:["montags"],tuesday:["dienstags"],wednesday:["mittwochs"],thursday:["donnerstags"],friday:["freitags"],saturday:["samstags"],sunday:["sonntags"]},ordinals:{first:["erste","ersten","erster"],second:["zweite","zweiten","zweiter"],third:["dritte","dritten","dritter"],fourth:["vierte","vierten","vierter"],last:["letzte","letzten","letzter"]},periods:{day:["tag","tage"],week:["woche","wochen"],month:["monat","monate"],year:["jahr","jahre"]}},timeEstimate:{hours:["h","std","stunde","stunden"],minutes:["m","min","minute","minuten"]},fallbackStatus:{open:["offen","zu erledigen","ausstehend","todo"],inProgress:["in bearbeitung","wird bearbeitet","l\xE4uft","in arbeit"],done:["erledigt","fertig","abgeschlossen","gemacht"],cancelled:["abgebrochen","storniert","abgesagt"],waiting:["wartend","warten","blockiert","pausiert"]},fallbackPriority:{urgent:["dringend","eilig","kritisch","sofort","h\xF6chste"],high:["hoch","hohe","wichtig","priorit\xE4r"],normal:["normal","mittel","mittlere","standard"],low:["niedrig","niedrige","gering","geringe"]}}});var wme,Sme=y(()=>{wme={code:"ru",name:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",chronoLocale:"ru",dateTriggers:{due:["\u0441\u0440\u043E\u043A","\u0434\u0435\u0434\u043B\u0430\u0439\u043D","\u0434\u043E","\u043A","\u0441\u0434\u0430\u0442\u044C \u0434\u043E"],scheduled:["\u0437\u0430\u043F\u043B\u0430\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u043E \u043D\u0430","\u043D\u0430\u0447\u0430\u0442\u044C","\u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u043D\u0430\u0434","\u043D\u0430"]},recurrence:{frequencies:{daily:["\u0435\u0436\u0435\u0434\u043D\u0435\u0432\u043D\u043E","\u043A\u0430\u0436\u0434\u044B\u0439 \u0434\u0435\u043D\u044C","\u0435\u0436\u0435\u0434\u043D\u0435\u0432\u043D\u044B\u0439","\u043A\u0430\u0436\u0434\u043E\u0434\u043D\u0435\u0432\u043D\u044B\u0439"],weekly:["\u0435\u0436\u0435\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u043E","\u043A\u0430\u0436\u0434\u0443\u044E \u043D\u0435\u0434\u0435\u043B\u044E","\u0435\u0436\u0435\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u044B\u0439"],monthly:["\u0435\u0436\u0435\u043C\u0435\u0441\u044F\u0447\u043D\u043E","\u043A\u0430\u0436\u0434\u044B\u0439 \u043C\u0435\u0441\u044F\u0446","\u0435\u0436\u0435\u043C\u0435\u0441\u044F\u0447\u043D\u044B\u0439"],yearly:["\u0435\u0436\u0435\u0433\u043E\u0434\u043D\u043E","\u043A\u0430\u0436\u0434\u044B\u0439 \u0433\u043E\u0434","\u0435\u0436\u0435\u0433\u043E\u0434\u043D\u044B\u0439"]},every:["\u043A\u0430\u0436\u0434\u044B\u0439","\u043A\u0430\u0436\u0434\u0443\u044E","\u043A\u0430\u0436\u0434\u043E\u0435","\u0432\u0441\u0435"],other:["\u0434\u0440\u0443\u0433\u043E\u0439","\u0434\u0440\u0443\u0433\u0443\u044E","\u0434\u0440\u0443\u0433\u043E\u0435"],weekdays:{monday:["\u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A"],tuesday:["\u0432\u0442\u043E\u0440\u043D\u0438\u043A"],wednesday:["\u0441\u0440\u0435\u0434\u0430"],thursday:["\u0447\u0435\u0442\u0432\u0435\u0440\u0433"],friday:["\u043F\u044F\u0442\u043D\u0438\u0446\u0430"],saturday:["\u0441\u0443\u0431\u0431\u043E\u0442\u0430"],sunday:["\u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435"]},pluralWeekdays:{monday:["\u043F\u043E \u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A\u0430\u043C"],tuesday:["\u043F\u043E \u0432\u0442\u043E\u0440\u043D\u0438\u043A\u0430\u043C"],wednesday:["\u043F\u043E \u0441\u0440\u0435\u0434\u0430\u043C"],thursday:["\u043F\u043E \u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0430\u043C"],friday:["\u043F\u043E \u043F\u044F\u0442\u043D\u0438\u0446\u0430\u043C"],saturday:["\u043F\u043E \u0441\u0443\u0431\u0431\u043E\u0442\u0430\u043C"],sunday:["\u043F\u043E \u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u044F\u043C"]},ordinals:{first:["\u043F\u0435\u0440\u0432\u044B\u0439","\u043F\u0435\u0440\u0432\u0430\u044F","\u043F\u0435\u0440\u0432\u043E\u0435"],second:["\u0432\u0442\u043E\u0440\u043E\u0439","\u0432\u0442\u043E\u0440\u0430\u044F","\u0432\u0442\u043E\u0440\u043E\u0435"],third:["\u0442\u0440\u0435\u0442\u0438\u0439","\u0442\u0440\u0435\u0442\u044C\u044F","\u0442\u0440\u0435\u0442\u044C\u0435"],fourth:["\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044B\u0439","\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044F","\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435"],last:["\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0439","\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F","\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0435"]},periods:{day:["\u0434\u0435\u043D\u044C","\u0434\u043D\u0438"],week:["\u043D\u0435\u0434\u0435\u043B\u044F","\u043D\u0435\u0434\u0435\u043B\u0438"],month:["\u043C\u0435\u0441\u044F\u0446","\u043C\u0435\u0441\u044F\u0446\u044B"],year:["\u0433\u043E\u0434","\u0433\u043E\u0434\u044B"]}},timeEstimate:{hours:["\u0447","\u0447\u0430\u0441","\u0447\u0430\u0441\u0430","\u0447\u0430\u0441\u043E\u0432"],minutes:["\u043C","\u043C\u0438\u043D","\u043C\u0438\u043D\u0443\u0442\u0430","\u043C\u0438\u043D\u0443\u0442\u044B","\u043C\u0438\u043D\u0443\u0442"]},fallbackStatus:{open:["\u043E\u0442\u043A\u0440\u044B\u0442\u043E","\u043A \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044E","\u043D\u043E\u0432\u043E\u0435","todo"],inProgress:["\u0432 \u0440\u0430\u0431\u043E\u0442\u0435","\u0432\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F","\u0432 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0435"],done:["\u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u043E","\u0433\u043E\u0442\u043E\u0432\u043E","\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E","\u0441\u0434\u0435\u043B\u0430\u043D\u043E"],cancelled:["\u043E\u0442\u043C\u0435\u043D\u0435\u043D\u043E","\u043E\u0442\u043C\u0435\u043D\u0451\u043D","\u043E\u0442\u043C\u0435\u043D\u0435\u043D\u0430"],waiting:["\u043E\u0436\u0438\u0434\u0430\u043D\u0438\u0435","\u0437\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043E","\u043D\u0430 \u043F\u0430\u0443\u0437\u0435"]},fallbackPriority:{urgent:["\u0441\u0440\u043E\u0447\u043D\u043E","\u043A\u0440\u0438\u0442\u0438\u0447\u043D\u043E","\u044D\u043A\u0441\u0442\u0440\u0435\u043D\u043D\u043E","\u043D\u0435\u043C\u0435\u0434\u043B\u0435\u043D\u043D\u043E"],high:["\u0432\u044B\u0441\u043E\u043A\u0438\u0439","\u0432\u044B\u0441\u043E\u043A\u0430\u044F","\u0432\u0430\u0436\u043D\u043E","\u043F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442\u043D\u043E"],normal:["\u043D\u043E\u0440\u043C\u0430\u043B\u044C\u043D\u044B\u0439","\u043D\u043E\u0440\u043C\u0430\u043B\u044C\u043D\u0430\u044F","\u0441\u0440\u0435\u0434\u043D\u0438\u0439","\u0441\u0440\u0435\u0434\u043D\u044F\u044F"],low:["\u043D\u0438\u0437\u043A\u0438\u0439","\u043D\u0438\u0437\u043A\u0430\u044F","\u043D\u0435\u0432\u0430\u0436\u043D\u043E","\u043C\u043E\u0436\u043D\u043E \u043F\u043E\u0437\u0436\u0435"]}}});var Eme,xme=y(()=>{Eme={code:"zh",name:"\u4E2D\u6587",chronoLocale:"zh",dateTriggers:{due:["\u622A\u6B62","\u5230\u671F","\u671F\u9650","\u5728","\u4E4B\u524D"],scheduled:["\u5B89\u6392\u5728","\u8BA1\u5212\u5728","\u5F00\u59CB\u5728","\u5728"]},recurrence:{frequencies:{daily:["\u6BCF\u5929","\u6BCF\u65E5","\u5929\u5929","\u65E5\u5E38"],weekly:["\u6BCF\u5468","\u6BCF\u661F\u671F","\u5468\u5468"],monthly:["\u6BCF\u6708","\u6BCF\u4E2A\u6708","\u6708\u6708"],yearly:["\u6BCF\u5E74","\u5E74\u5E74","\u6BCF\u4E00\u5E74"]},every:["\u6BCF","\u6BCF\u4E2A","\u6BCF\u4E00\u4E2A"],other:["\u5176\u4ED6","\u53E6\u4E00\u4E2A"],weekdays:{monday:["\u5468\u4E00","\u661F\u671F\u4E00","\u793C\u62DC\u4E00"],tuesday:["\u5468\u4E8C","\u661F\u671F\u4E8C","\u793C\u62DC\u4E8C"],wednesday:["\u5468\u4E09","\u661F\u671F\u4E09","\u793C\u62DC\u4E09"],thursday:["\u5468\u56DB","\u661F\u671F\u56DB","\u793C\u62DC\u56DB"],friday:["\u5468\u4E94","\u661F\u671F\u4E94","\u793C\u62DC\u4E94"],saturday:["\u5468\u516D","\u661F\u671F\u516D","\u793C\u62DC\u516D"],sunday:["\u5468\u65E5","\u661F\u671F\u65E5","\u793C\u62DC\u65E5"]},pluralWeekdays:{monday:["\u5468\u4E00","\u661F\u671F\u4E00","\u793C\u62DC\u4E00"],tuesday:["\u5468\u4E8C","\u661F\u671F\u4E8C","\u793C\u62DC\u4E8C"],wednesday:["\u5468\u4E09","\u661F\u671F\u4E09","\u793C\u62DC\u4E09"],thursday:["\u5468\u56DB","\u661F\u671F\u56DB","\u793C\u62DC\u56DB"],friday:["\u5468\u4E94","\u661F\u671F\u4E94","\u793C\u62DC\u4E94"],saturday:["\u5468\u516D","\u661F\u671F\u516D","\u793C\u62DC\u516D"],sunday:["\u5468\u65E5","\u661F\u671F\u65E5","\u793C\u62DC\u65E5"]},ordinals:{first:["\u7B2C\u4E00\u4E2A","\u7B2C\u4E00","\u9996\u4E2A"],second:["\u7B2C\u4E8C\u4E2A","\u7B2C\u4E8C"],third:["\u7B2C\u4E09\u4E2A","\u7B2C\u4E09"],fourth:["\u7B2C\u56DB\u4E2A","\u7B2C\u56DB"],last:["\u6700\u540E\u4E00\u4E2A","\u6700\u540E","\u672B\u5C3E"]},periods:{day:["\u5929","\u65E5"],week:["\u5468","\u661F\u671F"],month:["\u6708","\u4E2A\u6708"],year:["\u5E74"]}},timeEstimate:{hours:["\u5C0F\u65F6","\u65F6","\u4E2A\u5C0F\u65F6"],minutes:["\u5206\u949F","\u5206","\u4E2A\u5206\u949F"]},fallbackStatus:{open:["\u5F85\u529E","\u672A\u5B8C\u6210","\u5F00\u653E","\u65B0\u5EFA"],inProgress:["\u8FDB\u884C\u4E2D","\u6B63\u5728\u5904\u7406","\u5904\u7406\u4E2D","\u5DE5\u4F5C\u4E2D"],done:["\u5B8C\u6210","\u5DF2\u5B8C\u6210","\u7ED3\u675F","\u641E\u5B9A"],cancelled:["\u53D6\u6D88","\u5DF2\u53D6\u6D88","\u5E9F\u5F03"],waiting:["\u7B49\u5F85","\u6682\u505C","\u963B\u585E","\u5F85\u5B9A"]},fallbackPriority:{urgent:["\u7D27\u6025","\u6025\u8FEB","\u7ACB\u5373","\u9A6C\u4E0A"],high:["\u9AD8","\u91CD\u8981","\u9AD8\u4F18\u5148\u7EA7"],normal:["\u6B63\u5E38","\u666E\u901A","\u4E2D\u7B49","\u6807\u51C6"],low:["\u4F4E","\u4E0D\u91CD\u8981","\u4F4E\u4F18\u5148\u7EA7","\u6B21\u8981"]}}});var Cme,Dme=y(()=>{Cme={code:"ja",name:"\u65E5\u672C\u8A9E",chronoLocale:"ja",dateTriggers:{due:["\u671F\u9650","\u7DE0\u5207","\u3006\u5207","\u307E\u3067","\u307E\u3067\u306B","\u306B"],scheduled:["\u4E88\u5B9A","\u8A08\u753B","\u958B\u59CB","\u304B\u3089","\u306B\u958B\u59CB","\u3092\u958B\u59CB"]},recurrence:{frequencies:{daily:["\u6BCE\u65E5","\u65E5\u3005","\u6BCE\u65E5\u6BCE\u65E5","\u9023\u65E5"],weekly:["\u6BCE\u9031","\u9031\u6BCE","\u9031\u4E00","\u6BCE\u9031\u6BCE\u9031"],monthly:["\u6BCE\u6708","\u6708\u6BCE","\u6708\u4E00","\u6BCE\u6708\u6BCE\u6708"],yearly:["\u6BCE\u5E74","\u5E74\u6BCE","\u5E74\u4E00","\u6BCE\u5E74\u6BCE\u5E74","\u5E74\u6B21"]},every:["\u6BCE","\u5404","\u5168\u3066"],other:["\u4ED6\u306E","\u5225\u306E","\u7570\u306A\u308B"],weekdays:{monday:["\u6708\u66DC\u65E5","\u6708\u66DC","\u6708","\u3052\u3064\u3088\u3046\u3073"],tuesday:["\u706B\u66DC\u65E5","\u706B\u66DC","\u706B","\u304B\u3088\u3046\u3073"],wednesday:["\u6C34\u66DC\u65E5","\u6C34\u66DC","\u6C34","\u3059\u3044\u3088\u3046\u3073"],thursday:["\u6728\u66DC\u65E5","\u6728\u66DC","\u6728","\u3082\u304F\u3088\u3046\u3073"],friday:["\u91D1\u66DC\u65E5","\u91D1\u66DC","\u91D1","\u304D\u3093\u3088\u3046\u3073"],saturday:["\u571F\u66DC\u65E5","\u571F\u66DC","\u571F","\u3069\u3088\u3046\u3073"],sunday:["\u65E5\u66DC\u65E5","\u65E5\u66DC","\u65E5","\u306B\u3061\u3088\u3046\u3073"]},pluralWeekdays:{monday:["\u6708\u66DC\u65E5","\u6708\u66DC","\u6708","\u3052\u3064\u3088\u3046\u3073"],tuesday:["\u706B\u66DC\u65E5","\u706B\u66DC","\u706B","\u304B\u3088\u3046\u3073"],wednesday:["\u6C34\u66DC\u65E5","\u6C34\u66DC","\u6C34","\u3059\u3044\u3088\u3046\u3073"],thursday:["\u6728\u66DC\u65E5","\u6728\u66DC","\u6728","\u3082\u304F\u3088\u3046\u3073"],friday:["\u91D1\u66DC\u65E5","\u91D1\u66DC","\u91D1","\u304D\u3093\u3088\u3046\u3073"],saturday:["\u571F\u66DC\u65E5","\u571F\u66DC","\u571F","\u3069\u3088\u3046\u3073"],sunday:["\u65E5\u66DC\u65E5","\u65E5\u66DC","\u65E5","\u306B\u3061\u3088\u3046\u3073"]},ordinals:{first:["\u6700\u521D\u306E","\u7B2C\u4E00\u306E","\u4E00\u756A\u76EE\u306E","\u521D\u56DE"],second:["\u4E8C\u756A\u76EE\u306E","\u7B2C\u4E8C\u306E","\u6B21\u306E"],third:["\u4E09\u756A\u76EE\u306E","\u7B2C\u4E09\u306E"],fourth:["\u56DB\u756A\u76EE\u306E","\u7B2C\u56DB\u306E"],last:["\u6700\u5F8C\u306E","\u6700\u7D42\u306E","\u7D42\u308F\u308A\u306E"]},periods:{day:["\u65E5","\u65E5\u9593"],week:["\u9031","\u9031\u9593"],month:["\u6708","\u6708\u9593","\u30F6\u6708"],year:["\u5E74","\u5E74\u9593"]}},timeEstimate:{hours:["\u6642\u9593","\u6642","\u3058\u304B\u3093"],minutes:["\u5206","\u5206\u9593","\u3075\u3093","\u3077\u3093"]},fallbackStatus:{open:["\u672A\u7740\u624B","\u65B0\u898F","\u30AA\u30FC\u30D7\u30F3","\u958B\u59CB\u524D","\u5F85\u6A5F"],inProgress:["\u9032\u884C\u4E2D","\u4F5C\u696D\u4E2D","\u5B9F\u884C\u4E2D","\u51E6\u7406\u4E2D","\u9032\u884C"],done:["\u5B8C\u4E86","\u7D42\u4E86","\u6E08\u307F","\u7D42\u308F\u308A","\u9054\u6210"],cancelled:["\u30AD\u30E3\u30F3\u30BB\u30EB","\u4E2D\u6B62","\u53D6\u6D88","\u5EC3\u6B62","\u505C\u6B62"],waiting:["\u5F85\u6A5F","\u4FDD\u7559","\u30D6\u30ED\u30C3\u30AF","\u4E00\u6642\u505C\u6B62","\u5F85\u3061"]},fallbackPriority:{urgent:["\u7DCA\u6025","\u81F3\u6025","\u6025\u52D9","\u6700\u512A\u5148","\u3059\u3050\u306B"],high:["\u9AD8","\u91CD\u8981","\u9AD8\u512A\u5148\u5EA6","\u91CD\u70B9"],normal:["\u666E\u901A","\u901A\u5E38","\u6A19\u6E96","\u4E00\u822C","\u30CE\u30FC\u30DE\u30EB"],low:["\u4F4E","\u8EFD\u5FAE","\u5F8C\u56DE\u3057","\u4F4E\u512A\u5148\u5EA6","\u4F59\u88D5"]}}});var Pme,Mme=y(()=>{Pme={code:"it",name:"Italiano",chronoLocale:"it",dateTriggers:{due:["scadenza","entro","entro il","deve essere fatto entro","per il","termine"],scheduled:["programmato per","programmato il","iniziare il","lavorare su","il","per"]},recurrence:{frequencies:{daily:["giornaliero","giornaliera","quotidiano","quotidiana","ogni giorno","tutti i giorni","giornalmente"],weekly:["settimanale","ogni settimana","tutte le settimane","settimanalmente","alla settimana"],monthly:["mensile","ogni mese","tutti i mesi","mensilmente","al mese"],yearly:["annuale","ogni anno","tutti gli anni","annualmente","all'anno"]},every:["ogni","tutti i","tutte le"],other:["altro","altra","altri","altre"],weekdays:{monday:["luned\xEC"],tuesday:["marted\xEC"],wednesday:["mercoled\xEC"],thursday:["gioved\xEC"],friday:["venerd\xEC"],saturday:["sabato"],sunday:["domenica"]},pluralWeekdays:{monday:["luned\xEC"],tuesday:["marted\xEC"],wednesday:["mercoled\xEC"],thursday:["gioved\xEC"],friday:["venerd\xEC"],saturday:["sabati"],sunday:["domeniche"]},ordinals:{first:["primo","prima"],second:["secondo","seconda"],third:["terzo","terza"],fourth:["quarto","quarta"],last:["ultimo","ultima"]},periods:{day:["giorno","giorni"],week:["settimana","settimane"],month:["mese","mesi"],year:["anno","anni"]}},timeEstimate:{hours:["h","hr","ore","ora","o"],minutes:["m","min","minuto","minuti"]},fallbackStatus:{open:["da fare","aperto","pendente","todo","in sospeso"],inProgress:["in corso","in progresso","facendo","lavorando"],done:["fatto","completato","finito","terminato","chiuso"],cancelled:["cancellato","annullato","rimosso"],waiting:["in attesa","aspettando","bloccato","fermo"]},fallbackPriority:{urgent:["urgente","critico","critica","massimo","massima","prioritario","prioritaria"],high:["alto","alta","importante","elevato","elevata"],normal:["medio","media","normale","regolare","standard"],low:["basso","bassa","minore","minimo","minima"]}}});var _me,Ame=y(()=>{_me={code:"nl",name:"Nederlands",chronoLocale:"nl",dateTriggers:{due:["vervalt op","deadline","moet klaar zijn op","tegen","uiterlijk","voor"],scheduled:["gepland voor","gepland op","beginnen op","werken aan","op","voor"]},recurrence:{frequencies:{daily:["dagelijks","elke dag","alle dagen","per dag"],weekly:["wekelijks","elke week","alle weken","per week"],monthly:["maandelijks","elke maand","alle maanden","per maand"],yearly:["jaarlijks","elk jaar","alle jaren","per jaar"]},every:["elke","alle","iedere"],other:["andere","ander"],weekdays:{monday:["maandag"],tuesday:["dinsdag"],wednesday:["woensdag"],thursday:["donderdag"],friday:["vrijdag"],saturday:["zaterdag"],sunday:["zondag"]},pluralWeekdays:{monday:["maandagen"],tuesday:["dinsdagen"],wednesday:["woensdagen"],thursday:["donderdagen"],friday:["vrijdagen"],saturday:["zaterdagen"],sunday:["zondagen"]},ordinals:{first:["eerste"],second:["tweede"],third:["derde"],fourth:["vierde"],last:["laatste"]},periods:{day:["dag","dagen"],week:["week","weken"],month:["maand","maanden"],year:["jaar","jaren"]}},timeEstimate:{hours:["u","uur","uren","h"],minutes:["m","min","minuut","minuten"]},fallbackStatus:{open:["te doen","open","nog te doen","todo","openstaand"],inProgress:["bezig","in behandeling","aan het werk","lopend","in uitvoering"],done:["klaar","voltooid","gedaan","afgerond","gesloten"],cancelled:["geannuleerd","afgezegd","ingetrokken"],waiting:["wachtend","in de wacht","geblokkeerd","uitgesteld"]},fallbackPriority:{urgent:["urgent","kritiek","hoogste","spoed","direct"],high:["hoog","hoge","belangrijk","belangrijke"],normal:["normaal","normale","gemiddeld","standaard"],low:["laag","lage","klein","kleine","onbelangrijk"]}}});var Ime,Nme=y(()=>{Ime={code:"pt",name:"Portugu\xEAs",chronoLocale:"pt",dateTriggers:{due:["vencimento","prazo","deve estar pronto at\xE9","at\xE9","para","limite"],scheduled:["programado para","agendado para","come\xE7ar em","trabalhar em","em","no"]},recurrence:{frequencies:{daily:["di\xE1rio","di\xE1ria","diariamente","todos os dias","cada dia","por dia"],weekly:["semanal","semanalmente","toda semana","todas as semanas","por semana"],monthly:["mensal","mensalmente","todo m\xEAs","todos os meses","por m\xEAs"],yearly:["anual","anualmente","todo ano","todos os anos","por ano"]},every:["todo","toda","todos","todas","cada"],other:["outro","outra","outros","outras"],weekdays:{monday:["segunda","segunda-feira"],tuesday:["ter\xE7a","ter\xE7a-feira"],wednesday:["quarta","quarta-feira"],thursday:["quinta","quinta-feira"],friday:["sexta","sexta-feira"],saturday:["s\xE1bado"],sunday:["domingo"]},pluralWeekdays:{monday:["segundas","segundas-feiras"],tuesday:["ter\xE7as","ter\xE7as-feiras"],wednesday:["quartas","quartas-feiras"],thursday:["quintas","quintas-feiras"],friday:["sextas","sextas-feiras"],saturday:["s\xE1bados"],sunday:["domingos"]},ordinals:{first:["primeiro","primeira"],second:["segundo","segunda"],third:["terceiro","terceira"],fourth:["quarto","quarta"],last:["\xFAltimo","\xFAltima"]},periods:{day:["dia","dias"],week:["semana","semanas"],month:["m\xEAs","meses"],year:["ano","anos"]}},timeEstimate:{hours:["h","hr","hora","horas"],minutes:["m","min","minuto","minutos"]},fallbackStatus:{open:["a fazer","pendente","aberto","todo","por fazer"],inProgress:["em andamento","em progresso","fazendo","trabalhando","executando"],done:["feito","conclu\xEDdo","terminado","finalizado","completo"],cancelled:["cancelado","anulado","suspenso"],waiting:["aguardando","esperando","bloqueado","em espera"]},fallbackPriority:{urgent:["urgente","cr\xEDtico","cr\xEDtica","m\xE1ximo","m\xE1xima","priorit\xE1rio","priorit\xE1ria"],high:["alto","alta","importante","elevado","elevada"],normal:["m\xE9dio","m\xE9dia","normal","regular","padr\xE3o"],low:["baixo","baixa","menor","m\xEDnimo","m\xEDnima"]}}});var Rme,Ome=y(()=>{Rme={code:"sv",name:"Svenska",chronoLocale:"sv",dateTriggers:{due:["f\xF6rfaller","deadline","m\xE5ste vara klar","senast","till","innan"],scheduled:["schemalagd","planerad f\xF6r","b\xF6rja","arbeta med","den","p\xE5"]},recurrence:{frequencies:{daily:["dagligen","varje dag","alla dagar","per dag"],weekly:["veckovis","varje vecka","alla veckor","per vecka"],monthly:["m\xE5nadsvis","varje m\xE5nad","alla m\xE5nader","per m\xE5nad"],yearly:["\xE5rligen","varje \xE5r","alla \xE5r","per \xE5r"]},every:["varje","alla","var"],other:["annan","annat","andra"],weekdays:{monday:["m\xE5ndag"],tuesday:["tisdag"],wednesday:["onsdag"],thursday:["torsdag"],friday:["fredag"],saturday:["l\xF6rdag"],sunday:["s\xF6ndag"]},pluralWeekdays:{monday:["m\xE5ndagar"],tuesday:["tisdagar"],wednesday:["onsdagar"],thursday:["torsdagar"],friday:["fredagar"],saturday:["l\xF6rdagar"],sunday:["s\xF6ndagar"]},ordinals:{first:["f\xF6rsta"],second:["andra"],third:["tredje"],fourth:["fj\xE4rde"],last:["sista"]},periods:{day:["dag","dagar"],week:["vecka","veckor"],month:["m\xE5nad","m\xE5nader"],year:["\xE5r"]}},timeEstimate:{hours:["t","tim","timme","timmar","h"],minutes:["m","min","minut","minuter"]},fallbackStatus:{open:["att g\xF6ra","\xF6ppen","kvar","todo","v\xE4ntande"],inProgress:["p\xE5g\xE5ende","arbetar","g\xF6r","i process","under arbete"],done:["klar","f\xE4rdig","slutf\xF6rd","avslutad","gjord"],cancelled:["avbruten","inst\xE4lld","avbokad"],waiting:["v\xE4ntar","blockerad","pausad","vilande"]},fallbackPriority:{urgent:["br\xE5dskande","kritisk","h\xF6gsta","akut","omedelbar"],high:["h\xF6g","viktig","f\xF6rh\xF6jd","prioriterad"],normal:["normal","medel","standard","vanlig"],low:["l\xE5g","mindre","minimal","obetydlig"]}}});var Lme,Fme=y(()=>{Lme={code:"uk",name:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",chronoLocale:"uk",dateTriggers:{due:["\u0442\u0435\u0440\u043C\u0456\u043D","\u0434\u0435\u0434\u043B\u0430\u0439\u043D","\u043C\u0430\u0454 \u0431\u0443\u0442\u0438 \u0433\u043E\u0442\u043E\u0432\u043E \u0434\u043E","\u0434\u043E","\u043D\u0435 \u043F\u0456\u0437\u043D\u0456\u0448\u0435","\u043A\u0440\u0430\u0439\u043D\u0456\u0439 \u0442\u0435\u0440\u043C\u0456\u043D"],scheduled:["\u0437\u0430\u043F\u043B\u0430\u043D\u043E\u0432\u0430\u043D\u043E \u043D\u0430","\u0437\u0430\u043F\u043B\u0430\u043D\u043E\u0432\u0430\u043D\u0438\u0439","\u043F\u043E\u0447\u0430\u0442\u0438","\u043F\u0440\u0430\u0446\u044E\u0432\u0430\u0442\u0438 \u043D\u0430\u0434","\u043D\u0430","\u0432"]},recurrence:{frequencies:{daily:["\u0449\u043E\u0434\u043D\u044F","\u0449\u043E\u0434\u0435\u043D\u043D\u043E","\u043A\u043E\u0436\u0435\u043D \u0434\u0435\u043D\u044C","\u0432\u0441\u0456 \u0434\u043D\u0456","\u043D\u0430 \u0434\u0435\u043D\u044C"],weekly:["\u0449\u043E\u0442\u0438\u0436\u043D\u044F","\u0449\u043E\u0442\u0438\u0436\u043D\u0435\u0432\u043E","\u043A\u043E\u0436\u0435\u043D \u0442\u0438\u0436\u0434\u0435\u043D\u044C","\u0432\u0441\u0456 \u0442\u0438\u0436\u043D\u0456","\u043D\u0430 \u0442\u0438\u0436\u0434\u0435\u043D\u044C"],monthly:["\u0449\u043E\u043C\u0456\u0441\u044F\u0446\u044F","\u0449\u043E\u043C\u0456\u0441\u044F\u0447\u043D\u043E","\u043A\u043E\u0436\u0435\u043D \u043C\u0456\u0441\u044F\u0446\u044C","\u0432\u0441\u0456 \u043C\u0456\u0441\u044F\u0446\u0456","\u043D\u0430 \u043C\u0456\u0441\u044F\u0446\u044C"],yearly:["\u0449\u043E\u0440\u043E\u043A\u0443","\u0449\u043E\u0440\u0456\u0447\u043D\u043E","\u043A\u043E\u0436\u0435\u043D \u0440\u0456\u043A","\u0432\u0441\u0456 \u0440\u043E\u043A\u0438","\u043D\u0430 \u0440\u0456\u043A"]},every:["\u043A\u043E\u0436\u0435\u043D","\u043A\u043E\u0436\u043D\u0430","\u043A\u043E\u0436\u043D\u0435","\u0432\u0441\u0456"],other:["\u0456\u043D\u0448\u0438\u0439","\u0456\u043D\u0448\u0430","\u0456\u043D\u0448\u0435","\u0456\u043D\u0448\u0456"],weekdays:{monday:["\u043F\u043E\u043D\u0435\u0434\u0456\u043B\u043E\u043A"],tuesday:["\u0432\u0456\u0432\u0442\u043E\u0440\u043E\u043A"],wednesday:["\u0441\u0435\u0440\u0435\u0434\u0430"],thursday:["\u0447\u0435\u0442\u0432\u0435\u0440"],friday:["\u043F'\u044F\u0442\u043D\u0438\u0446\u044F"],saturday:["\u0441\u0443\u0431\u043E\u0442\u0430"],sunday:["\u043D\u0435\u0434\u0456\u043B\u044F"]},pluralWeekdays:{monday:["\u043F\u043E\u043D\u0435\u0434\u0456\u043B\u043A\u0438"],tuesday:["\u0432\u0456\u0432\u0442\u043E\u0440\u043A\u0438"],wednesday:["\u0441\u0435\u0440\u0435\u0434\u0438"],thursday:["\u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0438"],friday:["\u043F'\u044F\u0442\u043D\u0438\u0446\u0456"],saturday:["\u0441\u0443\u0431\u043E\u0442\u0438"],sunday:["\u043D\u0435\u0434\u0456\u043B\u0456"]},ordinals:{first:["\u043F\u0435\u0440\u0448\u0438\u0439","\u043F\u0435\u0440\u0448\u0430","\u043F\u0435\u0440\u0448\u0435"],second:["\u0434\u0440\u0443\u0433\u0438\u0439","\u0434\u0440\u0443\u0433\u0430","\u0434\u0440\u0443\u0433\u0435"],third:["\u0442\u0440\u0435\u0442\u0456\u0439","\u0442\u0440\u0435\u0442\u044F","\u0442\u0440\u0435\u0442\u0454"],fourth:["\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0438\u0439","\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0430","\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0435"],last:["\u043E\u0441\u0442\u0430\u043D\u043D\u0456\u0439","\u043E\u0441\u0442\u0430\u043D\u043D\u044F","\u043E\u0441\u0442\u0430\u043D\u043D\u0454"]},periods:{day:["\u0434\u0435\u043D\u044C","\u0434\u043D\u0456","\u0434\u043D\u0456\u0432"],week:["\u0442\u0438\u0436\u0434\u0435\u043D\u044C","\u0442\u0438\u0436\u043D\u0456","\u0442\u0438\u0436\u043D\u0456\u0432"],month:["\u043C\u0456\u0441\u044F\u0446\u044C","\u043C\u0456\u0441\u044F\u0446\u0456","\u043C\u0456\u0441\u044F\u0446\u0456\u0432"],year:["\u0440\u0456\u043A","\u0440\u043E\u043A\u0438","\u0440\u043E\u043A\u0456\u0432"]}},timeEstimate:{hours:["\u0433","\u0433\u043E\u0434","\u0433\u043E\u0434\u0438\u043D\u0430","\u0433\u043E\u0434\u0438\u043D\u0438","\u0433\u043E\u0434\u0438\u043D"],minutes:["\u0445\u0432","\u043C\u0456\u043D","\u0445\u0432\u0438\u043B\u0438\u043D\u0430","\u0445\u0432\u0438\u043B\u0438\u043D\u0438","\u0445\u0432\u0438\u043B\u0438\u043D"]},fallbackStatus:{open:["\u0437\u0440\u043E\u0431\u0438\u0442\u0438","\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u0439","\u043E\u0447\u0456\u043A\u0443\u0454","todo","\u0432 \u043E\u0447\u0456\u043A\u0443\u0432\u0430\u043D\u043D\u0456"],inProgress:["\u0432 \u0440\u043E\u0431\u043E\u0442\u0456","\u0432\u0438\u043A\u043E\u043D\u0443\u0454\u0442\u044C\u0441\u044F","\u0440\u043E\u0431\u043B\u044E","\u043F\u0440\u0430\u0446\u044E\u044E","\u0432 \u043F\u0440\u043E\u0446\u0435\u0441\u0456"],done:["\u0433\u043E\u0442\u043E\u0432\u043E","\u0432\u0438\u043A\u043E\u043D\u0430\u043D\u043E","\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E","\u0437\u0430\u043A\u0456\u043D\u0447\u0435\u043D\u043E","\u0437\u0440\u043E\u0431\u043B\u0435\u043D\u043E"],cancelled:["\u0441\u043A\u0430\u0441\u043E\u0432\u0430\u043D\u043E","\u0432\u0456\u0434\u043C\u0456\u043D\u0435\u043D\u043E","\u043F\u0440\u0438\u043F\u0438\u043D\u0435\u043D\u043E"],waiting:["\u0447\u0435\u043A\u0430\u044E","\u043E\u0447\u0456\u043A\u0443\u044E","\u0437\u0430\u0431\u043B\u043E\u043A\u043E\u0432\u0430\u043D\u043E","\u043F\u0440\u0438\u0437\u0443\u043F\u0438\u043D\u0435\u043D\u043E"]},fallbackPriority:{urgent:["\u0442\u0435\u0440\u043C\u0456\u043D\u043E\u0432\u043E","\u043A\u0440\u0438\u0442\u0438\u0447\u043D\u043E","\u043D\u0430\u0439\u0432\u0438\u0449\u0438\u0439","\u043D\u0435\u0432\u0456\u0434\u043A\u043B\u0430\u0434\u043D\u043E","\u043F\u0440\u0456\u043E\u0440\u0438\u0442\u0435\u0442\u043D\u043E"],high:["\u0432\u0438\u0441\u043E\u043A\u0438\u0439","\u0432\u0438\u0441\u043E\u043A\u0430","\u0432\u0430\u0436\u043B\u0438\u0432\u043E","\u043F\u0456\u0434\u0432\u0438\u0449\u0435\u043D\u0438\u0439"],normal:["\u0441\u0435\u0440\u0435\u0434\u043D\u0456\u0439","\u0441\u0435\u0440\u0435\u0434\u043D\u044F","\u043D\u043E\u0440\u043C\u0430\u043B\u044C\u043D\u043E","\u0437\u0432\u0438\u0447\u0430\u0439\u043D\u043E","\u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u043E"],low:["\u043D\u0438\u0437\u044C\u043A\u0438\u0439","\u043D\u0438\u0437\u044C\u043A\u0430","\u043C\u0435\u043D\u0448\u0438\u0439","\u043C\u0456\u043D\u0456\u043C\u0430\u043B\u044C\u043D\u0438\u0439","\u043D\u0435\u0437\u043D\u0430\u0447\u043D\u0438\u0439"]}}});var $me=y(()=>{});function jme(r){return zme[r]||zme.en}var zme,i2=y(()=>{hme();yme();bme();kme();Sme();xme();Dme();Mme();Ame();Nme();Ome();Fme();$me();zme={en:fme,es:gme,fr:vme,de:Tme,ru:wme,zh:Eme,ja:Cme,it:Pme,nl:_me,pt:Ime,sv:Rme,uk:Lme}});var X_,a2=y(()=>{X_=class{constructor(e,t=[]){this.config=e,this.userFields=t,this.triggerMap=new Map,this.propertyMap=new Map,this.buildMaps()}buildMaps(){this.triggerMap.clear(),this.propertyMap.clear();for(let e of this.config.triggers)e.enabled&&(this.triggerMap.set(e.trigger,e),this.propertyMap.set(e.propertyId,e))}getTriggerForProperty(e){return this.propertyMap.get(e)}getPropertyForTrigger(e){var t;return(t=this.triggerMap.get(e))==null?void 0:t.propertyId}getAllEnabledTriggers(){return this.config.triggers.filter(e=>e.enabled)}getTriggersOrderedByLength(){return this.getAllEnabledTriggers().sort((e,t)=>t.trigger.length-e.trigger.length)}usesNativeTagSuggester(){let e=this.getTriggerForProperty("tags");return(e==null?void 0:e.trigger)==="#"&&(e==null?void 0:e.enabled)}getTagTrigger(){let e=this.getTriggerForProperty("tags");return e!=null&&e.enabled?e.trigger:void 0}getContextTrigger(){let e=this.getTriggerForProperty("contexts");return e!=null&&e.enabled?e.trigger:void 0}getProjectTrigger(){let e=this.getTriggerForProperty("projects");return e!=null&&e.enabled?e.trigger:void 0}getStatusTrigger(){let e=this.getTriggerForProperty("status");return e!=null&&e.enabled?e.trigger:void 0}getPriorityTrigger(){let e=this.getTriggerForProperty("priority");return e!=null&&e.enabled?e.trigger:void 0}getUserField(e){return this.userFields.find(t=>t.id===e)}isUserField(e){return this.userFields.some(t=>t.id===e)}getSuggesterType(e){if(e==="tags")return this.usesNativeTagSuggester()?"native-tag":"list";if(e==="contexts")return"list";if(e==="projects")return"file";if(e==="status")return"status";if(e==="priority")return"priority";let t=this.getUserField(e);if(t)switch(t.type){case"text":return t.autosuggestFilter?"file":"list";case"list":return"list";case"boolean":return"boolean";default:return"none"}return"none"}updateConfig(e){this.config=e,this.buildMaps()}updateUserFields(e){this.userFields=e}}});var Bme=E((s2,o2)=>{(function(r,e){typeof s2=="object"&&typeof o2!="undefined"?o2.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs_plugin_quarterOfYear=e()})(s2,(function(){"use strict";var r="month",e="quarter";return function(t,n){var i=n.prototype;i.quarter=function(o){return this.$utils().u(o)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(o-1))};var a=i.add;i.add=function(o,l){return o=Number(o),this.$utils().p(l)===e?this.add(3*o,r):a.bind(this)(o,l)};var s=i.startOf;i.startOf=function(o,l){var c=this.$utils(),d=!!c.u(l)||l;if(c.p(o)===e){var u=this.quarter()-1;return d?this.month(3*u).startOf(r).startOf("day"):this.month(3*u+2).endOf(r).endOf("day")}return s.bind(this)(o,l)}}}))});var Xt=E((l2,c2)=>{(function(r,e){typeof l2=="object"&&typeof c2!="undefined"?c2.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs=e()})(l2,(function(){"use strict";var r=1e3,e=6e4,t=36e5,n="millisecond",i="second",a="minute",s="hour",o="day",l="week",c="month",d="quarter",u="year",p="date",m="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var R=["th","st","nd","rd"],z=N%100;return"["+N+(R[(z-20)%10]||R[z]||R[0])+"]"}},v=function(N,R,z){var H=String(N);return!H||H.length>=R?N:""+Array(R+1-H.length).join(z)+N},k={s:v,z:function(N){var R=-N.utcOffset(),z=Math.abs(R),H=Math.floor(z/60),Y=z%60;return(R<=0?"+":"-")+v(H,2,"0")+":"+v(Y,2,"0")},m:function N(R,z){if(R.date()1)return N(J[0])}else{var te=R.name;w[te]=R,Y=te}return!H&&Y&&(b=Y),Y||!H&&b},D=function(N,R){if(x(N))return N.clone();var z=typeof R=="object"?R:{};return z.date=N,z.args=arguments,new O(z)},_=k;_.l=C,_.i=x,_.w=function(N,R){return D(N,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var O=(function(){function N(z){this.$L=C(z.locale,null,!0),this.parse(z),this.$x=this.$x||z.x||{},this[S]=!0}var R=N.prototype;return R.parse=function(z){this.$d=(function(H){var Y=H.date,se=H.utc;if(Y===null)return new Date(NaN);if(_.u(Y))return new Date;if(Y instanceof Date)return new Date(Y);if(typeof Y=="string"&&!/Z$/i.test(Y)){var J=Y.match(f);if(J){var te=J[2]-1||0,Te=(J[7]||"0").substring(0,3);return se?new Date(Date.UTC(J[1],te,J[3]||1,J[4]||0,J[5]||0,J[6]||0,Te)):new Date(J[1],te,J[3]||1,J[4]||0,J[5]||0,J[6]||0,Te)}}return new Date(Y)})(z),this.init()},R.init=function(){var z=this.$d;this.$y=z.getFullYear(),this.$M=z.getMonth(),this.$D=z.getDate(),this.$W=z.getDay(),this.$H=z.getHours(),this.$m=z.getMinutes(),this.$s=z.getSeconds(),this.$ms=z.getMilliseconds()},R.$utils=function(){return _},R.isValid=function(){return this.$d.toString()!==m},R.isSame=function(z,H){var Y=D(z);return this.startOf(H)<=Y&&Y<=this.endOf(H)},R.isAfter=function(z,H){return D(z){(function(r){r[r.AM=0]="AM",r[r.PM=1]="PM"})(B||(B={}));(function(r){r[r.SUNDAY=0]="SUNDAY",r[r.MONDAY=1]="MONDAY",r[r.TUESDAY=2]="TUESDAY",r[r.WEDNESDAY=3]="WEDNESDAY",r[r.THURSDAY=4]="THURSDAY",r[r.FRIDAY=5]="FRIDAY",r[r.SATURDAY=6]="SATURDAY"})(We||(We={}));(function(r){r[r.JANUARY=1]="JANUARY",r[r.FEBRUARY=2]="FEBRUARY",r[r.MARCH=3]="MARCH",r[r.APRIL=4]="APRIL",r[r.MAY=5]="MAY",r[r.JUNE=6]="JUNE",r[r.JULY=7]="JULY",r[r.AUGUST=8]="AUGUST",r[r.SEPTEMBER=9]="SEPTEMBER",r[r.OCTOBER=10]="OCTOBER",r[r.NOVEMBER=11]="NOVEMBER",r[r.DECEMBER=12]="DECEMBER"})(Bs||(Bs={}))});function Ume(r,e){r.assign("day",e.getDate()),r.assign("month",e.getMonth()+1),r.assign("year",e.getFullYear())}function Hme(r,e){r.assign("hour",e.getHours()),r.assign("minute",e.getMinutes()),r.assign("second",e.getSeconds()),r.assign("millisecond",e.getMilliseconds()),r.assign("meridiem",e.getHours()<12?B.AM:B.PM)}function eA(r,e){r.imply("day",e.getDate()),r.imply("month",e.getMonth()+1),r.imply("year",e.getFullYear())}function Vme(r,e){r.imply("hour",e.getHours()),r.imply("minute",e.getMinutes()),r.imply("second",e.getSeconds()),r.imply("millisecond",e.getMilliseconds()),r.imply("meridiem",e.getHours()<12?B.AM:B.PM)}var d2=y(()=>{Bt()});function Lp(r,e,t,n,i=0){let a=0,s=0;for(;s{u2=tt(Xt(),1);Bt();eZe={ACDT:630,ACST:570,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,ALMT:360,AMST:-180,AMT:-240,ANAST:720,ANAT:720,AQTT:300,ART:-180,AST:-240,AWDT:540,AWST:480,AZOST:0,AZOT:-60,AZST:300,AZT:240,BNT:480,BOT:-240,BRST:-120,BRT:-180,BST:60,BTT:360,CAST:480,CAT:120,CCT:390,CDT:-300,CEST:120,CET:{timezoneOffsetDuringDst:120,timezoneOffsetNonDst:60,dstStart:r=>qme(r,Bs.MARCH,We.SUNDAY,2),dstEnd:r=>qme(r,Bs.OCTOBER,We.SUNDAY,3)},CHADT:825,CHAST:765,CKT:-600,CLST:-180,CLT:-240,COT:-300,CST:-360,CT:{timezoneOffsetDuringDst:-300,timezoneOffsetNonDst:-360,dstStart:r=>Lp(r,Bs.MARCH,We.SUNDAY,2,2),dstEnd:r=>Lp(r,Bs.NOVEMBER,We.SUNDAY,1,2)},CVT:-60,CXT:420,ChST:600,DAVT:420,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEST:180,EET:120,EGST:0,EGT:-60,EST:-300,ET:{timezoneOffsetDuringDst:-240,timezoneOffsetNonDst:-300,dstStart:r=>Lp(r,Bs.MARCH,We.SUNDAY,2,2),dstEnd:r=>Lp(r,Bs.NOVEMBER,We.SUNDAY,1,2)},FJST:780,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GMT:0,GST:240,GYT:-240,HAA:-180,HAC:-300,HADT:-540,HAE:-240,HAP:-420,HAR:-360,HAST:-600,HAT:-90,HAY:-480,HKT:480,HLV:-210,HNA:-240,HNC:-360,HNE:-300,HNP:-480,HNR:-420,HNT:-150,HNY:-540,HOVT:420,ICT:420,IDT:180,IOT:360,IRDT:270,IRKST:540,IRKT:540,IRST:210,IST:330,JST:540,KGT:360,KRAST:480,KRAT:480,KST:540,KUYT:240,LHDT:660,LHST:630,LINT:840,MAGST:720,MAGT:720,MART:-510,MAWT:300,MDT:-360,MESZ:120,MEZ:60,MHT:720,MMT:390,MSD:240,MSK:180,MST:-420,MT:{timezoneOffsetDuringDst:-360,timezoneOffsetNonDst:-420,dstStart:r=>Lp(r,Bs.MARCH,We.SUNDAY,2,2),dstEnd:r=>Lp(r,Bs.NOVEMBER,We.SUNDAY,1,2)},MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:690,NOVST:420,NOVT:360,NPT:345,NST:-150,NUT:-660,NZDT:780,NZST:720,OMSST:420,OMST:420,PDT:-420,PET:-300,PETST:720,PETT:720,PGT:600,PHOT:780,PHT:480,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PT:{timezoneOffsetDuringDst:-420,timezoneOffsetNonDst:-480,dstStart:r=>Lp(r,Bs.MARCH,We.SUNDAY,2,2),dstEnd:r=>Lp(r,Bs.NOVEMBER,We.SUNDAY,1,2)},PWT:540,PYST:-180,PYT:-240,RET:240,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SRT:-180,SST:-660,TAHT:-600,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TVT:720,ULAT:480,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-210,VLAST:660,VLAT:660,VUT:660,WAST:120,WAT:60,WEST:60,WESZ:60,WET:0,WEZ:0,WFT:720,WGST:-120,WGT:-180,WIB:420,WIT:540,WITA:480,WST:780,WT:0,YAKST:600,YAKT:600,YAPT:600,YEKST:360,YEKT:360}});function Wme(r,e){var n,i,a,s,o,l,c;let t=new Date(r);if(e.y&&(e.year=e.y,delete e.y),e.mo&&(e.month=e.mo,delete e.mo),e.M&&(e.month=e.M,delete e.M),e.w&&(e.week=e.w,delete e.w),e.d&&(e.day=e.d,delete e.d),e.h&&(e.hour=e.h,delete e.h),e.m&&(e.minute=e.m,delete e.m),e.s&&(e.second=e.s,delete e.s),e.ms&&(e.millisecond=e.ms,delete e.ms),"year"in e){let d=Math.floor(e.year);t.setFullYear(t.getFullYear()+d);let u=e.year-d;u>0&&(e.month=(n=e==null?void 0:e.month)!=null?n:0,e.month+=u*12)}if("quarter"in e){let d=Math.floor(e.quarter);t.setMonth(t.getMonth()+d*3)}if("month"in e){let d=Math.floor(e.month);t.setMonth(t.getMonth()+d);let u=e.month-d;u>0&&(e.week=(i=e==null?void 0:e.week)!=null?i:0,e.week+=u*4)}if("week"in e){let d=Math.floor(e.week);t.setDate(t.getDate()+d*7);let u=e.week-d;u>0&&(e.day=(a=e==null?void 0:e.day)!=null?a:0,e.day+=Math.round(u*7))}if("day"in e){let d=Math.floor(e.day);t.setDate(t.getDate()+d);let u=e.day-d;u>0&&(e.hour=(s=e==null?void 0:e.hour)!=null?s:0,e.hour+=Math.round(u*24))}if("hour"in e){let d=Math.floor(e.hour);t.setHours(t.getHours()+d);let u=e.hour-d;u>0&&(e.minute=(o=e==null?void 0:e.minute)!=null?o:0,e.minute+=Math.round(u*60))}if("minute"in e){let d=Math.floor(e.minute);t.setMinutes(t.getMinutes()+d);let u=e.minute-d;u>0&&(e.second=(l=e==null?void 0:e.second)!=null?l:0,e.second+=Math.round(u*60))}if("second"in e){let d=Math.floor(e.second);t.setSeconds(t.getSeconds()+d);let u=e.second-d;u>0&&(e.millisecond=(c=e==null?void 0:e.millisecond)!=null?c:0,e.millisecond+=Math.round(u*1e3))}if("millisecond"in e){let d=Math.floor(e.millisecond);t.setMilliseconds(t.getMilliseconds()+d)}return t}function Cv(r){let e={};for(let t in r)e[t]=-r[t];return e}var aS=y(()=>{});var Yme,m2,er,ee,Wt,lt=y(()=>{Yme=tt(Bme(),1),m2=tt(Xt(),1);d2();p2();aS();m2.default.extend(Yme.default);er=class r{constructor(e,t){A(this,"instant");A(this,"timezoneOffset");this.instant=e!=null?e:new Date,this.timezoneOffset=t!=null?t:null}static fromDate(e){return new r(e)}static fromInput(e,t){var a;if(e instanceof Date)return r.fromDate(e);let n=(a=e==null?void 0:e.instant)!=null?a:new Date,i=tA(e==null?void 0:e.timezone,n,t);return new r(n,i)}getDateWithAdjustedTimezone(){let e=new Date(this.instant);return this.timezoneOffset!==null&&e.setMinutes(e.getMinutes()-this.getSystemTimezoneAdjustmentMinute(this.instant)),e}getSystemTimezoneAdjustmentMinute(e,t){var a;(!e||e.getTime()<0)&&(e=new Date);let n=-e.getTimezoneOffset(),i=(a=t!=null?t:this.timezoneOffset)!=null?a:n;return n-i}getTimezoneOffset(){var e;return(e=this.timezoneOffset)!=null?e:-this.instant.getTimezoneOffset()}},ee=class r{constructor(e,t){A(this,"knownValues");A(this,"impliedValues");A(this,"reference");A(this,"_tags",new Set);if(this.reference=e,this.knownValues={},this.impliedValues={},t)for(let i in t)this.knownValues[i]=t[i];let n=e.getDateWithAdjustedTimezone();this.imply("day",n.getDate()),this.imply("month",n.getMonth()+1),this.imply("year",n.getFullYear()),this.imply("hour",12),this.imply("minute",0),this.imply("second",0),this.imply("millisecond",0)}get(e){return e in this.knownValues?this.knownValues[e]:e in this.impliedValues?this.impliedValues[e]:null}isCertain(e){return e in this.knownValues}getCertainComponents(){return Object.keys(this.knownValues)}imply(e,t){return e in this.knownValues?this:(this.impliedValues[e]=t,this)}assign(e,t){return this.knownValues[e]=t,delete this.impliedValues[e],this}delete(e){delete this.knownValues[e],delete this.impliedValues[e]}clone(){let e=new r(this.reference);e.knownValues={},e.impliedValues={};for(let t in this.knownValues)e.knownValues[t]=this.knownValues[t];for(let t in this.impliedValues)e.impliedValues[t]=this.impliedValues[t];return e}isOnlyDate(){return!this.isCertain("hour")&&!this.isCertain("minute")&&!this.isCertain("second")}isOnlyTime(){return!this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")&&!this.isCertain("year")}isOnlyWeekdayComponent(){return this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")}isDateWithUnknownYear(){return this.isCertain("month")&&!this.isCertain("year")}isValidDate(){let e=this.dateWithoutTimezoneAdjustment();return!(e.getFullYear()!==this.get("year")||e.getMonth()!==this.get("month")-1||e.getDate()!==this.get("day")||this.get("hour")!=null&&e.getHours()!=this.get("hour")||this.get("minute")!=null&&e.getMinutes()!=this.get("minute"))}toString(){return`[ParsingComponents { + tags: ${JSON.stringify(Array.from(this._tags).sort())}, + knownValues: ${JSON.stringify(this.knownValues)}, + impliedValues: ${JSON.stringify(this.impliedValues)}}, + reference: ${JSON.stringify(this.reference)}]`}dayjs(){return(0,m2.default)(this.dateWithoutTimezoneAdjustment())}date(){let e=this.dateWithoutTimezoneAdjustment(),t=this.reference.getSystemTimezoneAdjustmentMinute(e,this.get("timezoneOffset"));return new Date(e.getTime()+t*6e4)}addTag(e){return this._tags.add(e),this}addTags(e){for(let t of e)this._tags.add(t);return this}tags(){return new Set(this._tags)}dateWithoutTimezoneAdjustment(){let e=new Date(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond"));return e.setFullYear(this.get("year")),e}static createRelativeFromReference(e,t){let n=Wme(e.getDateWithAdjustedTimezone(),t),i=new r(e);return i.addTag("result/relativeDate"),t.hour||t.minute||t.second?(i.addTag("result/relativeDateAndTime"),Hme(i,n),Ume(i,n),i.assign("timezoneOffset",e.getTimezoneOffset())):(Vme(i,n),i.imply("timezoneOffset",e.getTimezoneOffset()),t.day?(i.assign("day",n.getDate()),i.assign("month",n.getMonth()+1),i.assign("year",n.getFullYear()),i.assign("weekday",n.getDay())):t.week?(i.assign("day",n.getDate()),i.assign("month",n.getMonth()+1),i.assign("year",n.getFullYear()),i.imply("weekday",n.getDay())):(i.imply("day",n.getDate()),t.month?(i.assign("month",n.getMonth()+1),i.assign("year",n.getFullYear())):(i.imply("month",n.getMonth()+1),t.year?i.assign("year",n.getFullYear()):i.imply("year",n.getFullYear())))),i}},Wt=class r{constructor(e,t,n,i,a){A(this,"refDate");A(this,"index");A(this,"text");A(this,"reference");A(this,"start");A(this,"end");this.reference=e,this.refDate=e.instant,this.index=t,this.text=n,this.start=i||new ee(e),this.end=a}clone(){let e=new r(this.reference,this.index,this.text);return e.start=this.start?this.start.clone():null,e.end=this.end?this.end.clone():null,e}date(){return this.start.date()}addTag(e){return this.start.addTag(e),this.end&&this.end.addTag(e),this}addTags(e){return this.start.addTags(e),this.end&&this.end.addTags(e),this}tags(){let e=new Set(this.start.tags());if(this.end)for(let t of this.end.tags())e.add(t);return e}toString(){let e=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(e)} ...}]`}}});function Ia(r,e,t="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${r}${n}(?:${t}${n}){0,10}`}function tZe(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}function oe(r){return`(?:${tZe(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}var At=y(()=>{});function rs(r){return r<100&&(r>50?r=r+1900:r=r+2e3),r}function dr(r,e,t){let n=(0,Gme.default)(r),i=n;i=i.month(t-1),i=i.date(e),i=i.year(n.year());let a=i.add(1,"y"),s=i.add(-1,"y");return Math.abs(a.diff(n)){Gme=tt(Xt(),1)});function rZe(r){let e=r.toLowerCase();return f2[e]!==void 0?f2[e]:e==="a"||e==="an"||e=="the"?1:e.match(/few/)?3:e.match(/half/)?.5:e.match(/couple/)?2:e.match(/several/)?7:parseFloat(e)}function Pv(r){let e=r.toLowerCase();return h2[e]!==void 0?h2[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}function $p(r){if(/BE/i.test(r))return r=r.replace(/BE/i,""),parseInt(r)-543;if(/BCE?/i.test(r))return r=r.replace(/BCE?/i,""),-parseInt(r);if(/(AD|CE)/i.test(r))return r=r.replace(/(AD|CE)/i,""),parseInt(r);let e=parseInt(r);return rs(e)}function So(r){let e={},t=r,n=Kme.exec(t);for(;n;)iZe(e,n),t=t.substring(n[0].length).trim(),n=Kme.exec(t);return Object.keys(e).length==0?null:e}function iZe(r,e){if(e[0].match(/^[a-zA-Z]+$/))return;let t=rZe(e[1]),n=sS[e[2].toLowerCase()];r[n]=t}var rA,g2,wo,f2,h2,Zme,sS,Qme,Dv,Fp,Jme,Kme,nZe,Xme,uu,zp,si=y(()=>{At();Dn();rA={sunday:0,sun:0,"sun.":0,monday:1,mon:1,"mon.":1,tuesday:2,tue:2,"tue.":2,wednesday:3,wed:3,"wed.":3,thursday:4,thurs:4,"thurs.":4,thur:4,"thur.":4,thu:4,"thu.":4,friday:5,fri:5,"fri.":5,saturday:6,sat:6,"sat.":6},g2={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},wo={...g2,jan:1,"jan.":1,feb:2,"feb.":2,mar:3,"mar.":3,apr:4,"apr.":4,jun:6,"jun.":6,jul:7,"jul.":7,aug:8,"aug.":8,sep:9,"sep.":9,sept:9,"sept.":9,oct:10,"oct.":10,nov:11,"nov.":11,dec:12,"dec.":12},f2={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},h2={first:1,second:2,third:3,fourth:4,fifth:5,sixth:6,seventh:7,eighth:8,ninth:9,tenth:10,eleventh:11,twelfth:12,thirteenth:13,fourteenth:14,fifteenth:15,sixteenth:16,seventeenth:17,eighteenth:18,nineteenth:19,twentieth:20,"twenty first":21,"twenty-first":21,"twenty second":22,"twenty-second":22,"twenty third":23,"twenty-third":23,"twenty fourth":24,"twenty-fourth":24,"twenty fifth":25,"twenty-fifth":25,"twenty sixth":26,"twenty-sixth":26,"twenty seventh":27,"twenty-seventh":27,"twenty eighth":28,"twenty-eighth":28,"twenty ninth":29,"twenty-ninth":29,thirtieth:30,"thirty first":31,"thirty-first":31},Zme={second:"second",seconds:"second",minute:"minute",minutes:"minute",hour:"hour",hours:"hour",day:"d",days:"d",week:"week",weeks:"week",month:"month",months:"month",quarter:"quarter",quarters:"quarter",year:"year",years:"year"},sS={s:"second",sec:"second",second:"second",seconds:"second",m:"minute",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",hour:"hour",hours:"hour",d:"d",day:"d",days:"d",w:"w",week:"week",weeks:"week",mo:"month",mon:"month",mos:"month",month:"month",months:"month",qtr:"quarter",quarter:"quarter",quarters:"quarter",y:"year",yr:"year",year:"year",years:"year",...Zme},Qme=`(?:${oe(f2)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|the|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;Dv=`(?:${oe(h2)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;Fp="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9]|2[0-5])";Jme=`(${Qme})\\s{0,3}(${oe(sS)})`,Kme=new RegExp(Jme,"i"),nZe=`(${Qme})\\s{0,3}(${oe(Zme)})`,Xme="\\s{0,5},?(?:\\s*and)?\\s{0,5}",uu=Ia("(?:(?:about|around)\\s{0,3})?",Jme,Xme),zp=Ia("(?:(?:about|around)\\s{0,3})?",nZe,Xme)});var V,we=y(()=>{V=class{constructor(){A(this,"cachedInnerPattern",null);A(this,"cachedPattern",null)}innerPatternHasChange(e,t){return this.innerPattern(e)!==t}patternLeftBoundary(){return"(\\W|^)"}pattern(e){return this.cachedInnerPattern&&!this.innerPatternHasChange(e,this.cachedInnerPattern)?this.cachedPattern:(this.cachedInnerPattern=this.innerPattern(e),this.cachedPattern=new RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`,this.cachedInnerPattern.flags),this.cachedPattern)}extract(e,t){var i;let n=(i=t[1])!=null?i:"";t.index=t.index+n.length,t[0]=t[0].substring(n.length);for(let a=2;a{si();lt();we();aZe=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${uu})(?=\\W|$)`,"i"),sZe=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${uu})(?=\\W|$)`,"i"),oZe=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${zp})(?=\\W|$)`,"i"),oS=class extends V{constructor(t){super();A(this,"strictMode");this.strictMode=t}innerPattern(t){return this.strictMode?oZe:t.option.forwardDate?aZe:sZe}innerExtract(t,n){if(n[0].match(/^for\s*the\s*\w+/))return null;let i=So(n[1]);return i?(t.debug(()=>{console.log(i),console.log(ee.createRelativeFromReference(t.reference,i))}),ee.createRelativeFromReference(t.reference,i)):null}}});var lZe,tfe,rfe,cZe,nfe,lS,ife=y(()=>{Dn();si();si();si();At();we();lZe=new RegExp(`(?:on\\s{0,3})?(${Dv})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${Dv}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${oe(wo)})(?:(?:-|/|,?\\s{0,3})(${Fp}(?!\\w)))?(?=\\W|$)`,"i"),tfe=1,rfe=2,cZe=3,nfe=4,lS=class extends V{innerPattern(){return lZe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=wo[t[cZe].toLowerCase()],a=Pv(t[tfe]);if(a>31)return t.index=t.index+t[tfe].length,null;if(n.start.assign("month",i),n.start.assign("day",a),t[nfe]){let s=$p(t[nfe]);n.start.assign("year",s)}else{let s=dr(e.refDate,a,i);n.start.imply("year",s)}if(t[rfe]){let s=Pv(t[rfe]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var dZe,uZe,afe,y2,v2,cS,sfe=y(()=>{Dn();si();si();si();At();we();dZe=new RegExp(`(${oe(wo)})(?:-|/|\\s*,?\\s*)(${Dv})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${Dv})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${Fp}))?(?=\\W|$)(?!\\:\\d)`,"i"),uZe=1,afe=2,y2=3,v2=4,cS=class extends V{constructor(t){super();A(this,"shouldSkipYearLikeDate");this.shouldSkipYearLikeDate=t}innerPattern(){return dZe}innerExtract(t,n){let i=wo[n[uZe].toLowerCase()],a=Pv(n[afe]);if(a>31||this.shouldSkipYearLikeDate&&!n[y2]&&!n[v2]&&n[afe].match(/^2[0-5]$/))return null;let s=t.createParsingComponents({day:a,month:i}).addTag("parser/ENMonthNameMiddleEndianParser");if(n[v2]){let c=$p(n[v2]);s.assign("year",c)}else{let c=dr(t.refDate,a,i);s.imply("year",c)}if(!n[y2])return s;let o=Pv(n[y2]),l=t.createParsingResult(n.index,n[0]);return l.start=s,l.end=s.clone(),l.end.assign("day",o),l}}});var pZe,mZe,fZe,ofe,dS,lfe=y(()=>{si();Dn();At();si();we();pZe=new RegExp(`((?:in)\\s*)?(${oe(wo)})\\s*(?:(?:,|-|of)?\\s*(${Fp})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),mZe=1,fZe=2,ofe=3,dS=class extends V{innerPattern(){return pZe}innerExtract(e,t){let n=t[fZe].toLowerCase();if(t[0].length<=3&&!g2[n])return null;let i=e.createParsingResult(t.index+(t[mZe]||"").length,t.index+t[0].length);i.start.imply("day",1),i.start.addTag("parser/ENMonthNameParser");let a=wo[n];if(i.start.assign("month",a),t[ofe]){let s=$p(t[ofe]);i.start.assign("year",s)}else{let s=dr(e.refDate,1,a);i.start.imply("year",s)}return i}}});var hZe,gZe,yZe,cfe,vZe,uS,dfe=y(()=>{si();At();we();hZe=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${oe(wo)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),gZe=1,yZe=2,cfe=3,vZe=4,uS=class extends V{constructor(t){super();A(this,"strictMonthDateOrder");this.strictMonthDateOrder=t}innerPattern(){return hZe}innerExtract(t,n){let i=parseInt(n[gZe]),a=parseInt(n[vZe]),s=n[cfe]?parseInt(n[cfe]):wo[n[yZe].toLowerCase()];if(s<1||s>12){if(this.strictMonthDateOrder)return null;a>=1&&a<=12&&([s,a]=[a,s])}return a<1||a>31?null:{day:a,month:s,year:i}}}});var bZe,TZe,kZe,pS,ufe=y(()=>{we();bZe=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),TZe=1,kZe=2,pS=class extends V{innerPattern(){return bZe}innerExtract(e,t){let n=parseInt(t[kZe]),i=parseInt(t[TZe]);return e.createParsingComponents().imply("day",1).assign("month",i).assign("year",n)}}});function wZe(r,e,t,n){return new RegExp(`${r}${e}(\\d{1,4})(?:(?:\\.|:|\uFF1A)(\\d{1,2})(?:(?::|\uFF1A)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${t}`,n)}function SZe(r,e){return new RegExp(`^(${r})(\\d{1,4})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${e}`,"i")}var pfe,Mv,nA,iA,mS,wi,pu=y(()=>{Bt();pfe=2,Mv=3,nA=4,iA=5,mS=6,wi=class{constructor(e=!1){A(this,"strictMode");A(this,"cachedPrimaryPrefix",null);A(this,"cachedPrimarySuffix",null);A(this,"cachedPrimaryTimePattern",null);A(this,"cachedFollowingPhase",null);A(this,"cachedFollowingSuffix",null);A(this,"cachedFollowingTimePatten",null);this.strictMode=e}patternFlags(){return"i"}primaryPatternLeftBoundary(){return"(^|\\s|T|\\b)"}primarySuffix(){return"(?!/)(?=\\W|$)"}followingSuffix(){return"(?!/)(?=\\W|$)"}pattern(e){return this.getPrimaryTimePatternThroughCache()}extract(e,t){let n=this.extractPrimaryTimeComponents(e,t);if(!n)return t[0].match(/^\d{4}/)?(t.index+=4,null):(t.index+=t[0].length,null);let i=t.index+t[1].length,a=t[0].substring(t[1].length),s=e.createParsingResult(i,a,n);t.index+=t[0].length;let o=e.text.substring(t.index),c=this.getFollowingTimePatternThroughCache().exec(o);return a.match(/^\d{3,4}/)&&c&&(c[0].match(/^\s*([+-])\s*\d{2,4}$/)||c[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/))?null:!c||c[0].match(/^\s*([+-])\s*\d{3,4}$/)?this.checkAndReturnWithoutFollowingPattern(s):(s.end=this.extractFollowingTimeComponents(e,c,s),s.end&&(s.text+=c[0]),this.checkAndReturnWithFollowingPattern(s))}extractPrimaryTimeComponents(e,t,n=!1){let i=e.createParsingComponents(),a=0,s=null,o=parseInt(t[pfe]);if(o>100){if(this.strictMode||t[Mv]!=null)return null;a=o%100,o=Math.floor(o/100)}if(o>24)return null;if(t[Mv]!=null){if(t[Mv].length==1&&!t[mS])return null;a=parseInt(t[Mv])}if(a>=60)return null;if(o>12&&(s=B.PM),t[mS]!=null){if(o>12)return null;let l=t[mS][0].toLowerCase();l=="a"&&(s=B.AM,o==12&&(o=0)),l=="p"&&(s=B.PM,o!=12&&(o+=12))}if(i.assign("hour",o),i.assign("minute",a),s!==null?i.assign("meridiem",s):o<12?i.imply("meridiem",B.AM):i.imply("meridiem",B.PM),t[iA]!=null){let l=parseInt(t[iA].substring(0,3));if(l>=1e3)return null;i.assign("millisecond",l)}if(t[nA]!=null){let l=parseInt(t[nA]);if(l>=60)return null;i.assign("second",l)}return i}extractFollowingTimeComponents(e,t,n){let i=e.createParsingComponents();if(t[iA]!=null){let l=parseInt(t[iA].substring(0,3));if(l>=1e3)return null;i.assign("millisecond",l)}if(t[nA]!=null){let l=parseInt(t[nA]);if(l>=60)return null;i.assign("second",l)}let a=parseInt(t[pfe]),s=0,o=-1;if(t[Mv]!=null?s=parseInt(t[Mv]):a>100&&(s=a%100,a=Math.floor(a/100)),s>=60||a>24)return null;if(a>=12&&(o=B.PM),t[mS]!=null){if(a>12)return null;let l=t[mS][0].toLowerCase();l=="a"&&(o=B.AM,a==12&&(a=0,i.isCertain("day")||i.imply("day",i.get("day")+1))),l=="p"&&(o=B.PM,a!=12&&(a+=12)),n.start.isCertain("meridiem")||(o==B.AM?(n.start.imply("meridiem",B.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",B.PM),n.start.get("hour")!=12&&n.start.assign("hour",n.start.get("hour")+12)))}return i.assign("hour",a),i.assign("minute",s),o>=0?i.assign("meridiem",o):n.start.isCertain("meridiem")&&n.start.get("hour")>12?n.start.get("hour")-12>a?i.imply("meridiem",B.AM):a<=12&&(i.assign("hour",a+12),i.assign("meridiem",B.PM)):a>12?i.imply("meridiem",B.PM):a<=12&&i.imply("meridiem",B.AM),i.date().getTime()24)return null}return e}checkAndReturnWithFollowingPattern(e){if(e.text.match(/^\d+-\d+$/))return null;let t=e.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);if(t){if(this.strictMode)return null;let n=t[1],i=t[2];if(i.includes(".")&&!i.match(/\d(\.\d{2})+$/))return null;let a=parseInt(i),s=parseInt(n);if(a>24||s>24)return null}return e}getPrimaryTimePatternThroughCache(){let e=this.primaryPrefix(),t=this.primarySuffix();return this.cachedPrimaryPrefix===e&&this.cachedPrimarySuffix===t?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=wZe(this.primaryPatternLeftBoundary(),e,t,this.patternFlags()),this.cachedPrimaryPrefix=e,this.cachedPrimarySuffix=t,this.cachedPrimaryTimePattern)}getFollowingTimePatternThroughCache(){let e=this.followingPhase(),t=this.followingSuffix();return this.cachedFollowingPhase===e&&this.cachedFollowingSuffix===t?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=SZe(e,t),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=t,this.cachedFollowingTimePatten)}}});var fS,mfe=y(()=>{Bt();pu();fS=class extends wi{constructor(e){super(e)}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|to|until|through|till|\\?)\\s*"}primaryPrefix(){return"(?:(?:at|from)\\s*)??"}primarySuffix(){return"(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(!n)return n;if(t[0].endsWith("night")){let i=n.get("hour");i>=6&&i<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",B.PM)):i<6&&n.assign("meridiem",B.AM)}if(t[0].endsWith("afternoon")){n.assign("meridiem",B.PM);let i=n.get("hour");i>=0&&i<=6&&n.assign("hour",n.get("hour")+12)}return t[0].endsWith("morning")&&(n.assign("meridiem",B.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}extractFollowingTimeComponents(e,t,n){let i=super.extractFollowingTimeComponents(e,t,n);return i&&i.addTag("parser/ENTimeExpressionParser"),i}}});var EZe,xZe,hS,ffe=y(()=>{si();lt();we();aS();EZe=new RegExp(`(${uu})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),xZe=new RegExp(`(${zp})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),hS=class extends V{constructor(t){super();A(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?xZe:EZe}innerExtract(t,n){let i=So(n[1]);return i?ee.createRelativeFromReference(t.reference,Cv(i)):null}}});var CZe,DZe,PZe,gS,hfe=y(()=>{si();lt();we();CZe=new RegExp(`(${uu})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),DZe=new RegExp(`(${zp})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),PZe=1,gS=class extends V{constructor(t){super();A(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?DZe:CZe}innerExtract(t,n){let i=So(n[PZe]);return i?ee.createRelativeFromReference(t.reference,i):null}}});var _v,ns,mu=y(()=>{_v=class{refine(e,t){return t.filter(n=>this.isValid(e,n))}},ns=class{refine(e,t){if(t.length<2)return t;let n=[],i=t[0],a=null;for(let s=1;s{console.log(`${this.constructor.name} merged ${l} and ${c} into ${d}`)}),i=d}}return i!=null&&n.push(i),n}}});var Jr,Eo=y(()=>{mu();Jr=class extends ns{shouldMergeResults(e,t,n){return!t.end&&!n.end&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){if(!t.start.isOnlyWeekdayComponent()&&!n.start.isOnlyWeekdayComponent()&&(n.start.getCertainComponents().forEach(a=>{t.start.isCertain(a)||t.start.imply(a,n.start.get(a))}),t.start.getCertainComponents().forEach(a=>{n.start.isCertain(a)||n.start.imply(a,t.start.get(a))})),t.start.date().getTime()>n.start.date().getTime()){let a=t.start.dayjs(),s=n.start.dayjs();n.start.isOnlyWeekdayComponent()&&s.add(7,"days").isAfter(a)?(s=s.add(7,"days"),n.start.imply("day",s.date()),n.start.imply("month",s.month()+1),n.start.imply("year",s.year())):t.start.isOnlyWeekdayComponent()&&a.add(-7,"days").isBefore(s)?(a=a.add(-7,"days"),t.start.imply("day",a.date()),t.start.imply("month",a.month()+1),t.start.imply("year",a.year())):n.start.isDateWithUnknownYear()&&s.add(1,"years").isAfter(a)?(s=s.add(1,"years"),n.start.imply("year",s.year())):t.start.isDateWithUnknownYear()&&a.add(-1,"years").isBefore(s)?(a=a.add(-1,"years"),t.start.imply("year",a.year())):[n,t]=[t,n]}let i=t.clone();return i.start=t.start,i.end=n.start,i.index=Math.min(t.index,n.index),t.index{Eo();yS=class extends Jr{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}}});function Sl(r,e){e=e.add(1,"day"),Vr(r,e),vc(r,e)}function yfe(r,e){e=e.add(1,"day"),b2(r,e),vc(r,e)}function Vr(r,e){r.assign("day",e.date()),r.assign("month",e.month()+1),r.assign("year",e.year())}function vfe(r,e){r.assign("hour",e.hour()),r.assign("minute",e.minute()),r.assign("second",e.second()),r.assign("millisecond",e.millisecond()),r.get("hour")<12?r.assign("meridiem",B.AM):r.assign("meridiem",B.PM)}function b2(r,e){r.imply("day",e.date()),r.imply("month",e.month()+1),r.imply("year",e.year())}function vc(r,e){r.imply("hour",e.hour()),r.imply("minute",e.minute()),r.imply("second",e.second()),r.imply("millisecond",e.millisecond())}var Us=y(()=>{Bt()});function T2(r,e){let t=r.clone(),n=r.start,i=e.start;if(t.start=bfe(n,i),r.end!=null||e.end!=null){let a=r.end==null?r.start:r.end,s=e.end==null?e.start:e.end,o=bfe(a,s);if(r.end==null&&o.date().getTime(){Bt();Us()});var Xr,xo=y(()=>{mu();Tfe();Xr=class extends ns{shouldMergeResults(e,t,n){return(t.start.isOnlyDate()&&n.start.isOnlyTime()||n.start.isOnlyDate()&&t.start.isOnlyTime())&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){let i=t.start.isOnlyDate()?T2(t,n):T2(n,t);return i.index=t.index,i.text=t.text+e+n.text,i}}});var Av,kfe=y(()=>{xo();Av=class extends Xr{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}}});var MZe,vS,wfe=y(()=>{p2();MZe=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),vS=class{constructor(e){A(this,"timezoneOverrides");this.timezoneOverrides=e}refine(e,t){var i;let n=(i=e.option.timezones)!=null?i:{};return t.forEach(a=>{var m,f;let s=e.text.substring(a.index+a.text.length),o=MZe.exec(s);if(!o)return;let l=o[1].toUpperCase(),c=(f=(m=a.start.date())!=null?m:a.refDate)!=null?f:new Date,d={...this.timezoneOverrides,...n},u=tA(l,c,d);if(u==null)return;e.debug(()=>{console.log(`Extracting timezone: '${l}' into: ${u} for: ${a.start}`)});let p=a.start.get("timezoneOffset");p!==null&&u!=p&&(a.start.isCertain("timezoneOffset")||l!=o[1])||a.start.isOnlyDate()&&l!=o[1]||(a.text+=o[0],a.start.isCertain("timezoneOffset")||a.start.assign("timezoneOffset",u),a.end!=null&&!a.end.isCertain("timezoneOffset")&&a.end.assign("timezoneOffset",u))}),t}}});var _Ze,AZe,IZe,NZe,El,bS=y(()=>{_Ze=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),AZe=1,IZe=2,NZe=3,El=class{refine(e,t){return t.forEach(function(n){if(n.start.isCertain("timezoneOffset"))return;let i=e.text.substring(n.index+n.text.length),a=_Ze.exec(i);if(!a)return;e.debug(()=>{console.log(`Extracting timezone: '${a[0]}' into : ${n}`)});let s=parseInt(a[IZe]),o=parseInt(a[NZe]||"0"),l=s*60+o;l>840||(a[AZe]==="-"&&(l=-l),n.end!=null&&n.end.assign("timezoneOffset",l),n.start.assign("timezoneOffset",l),n.text+=a[0])}),t}}});var jp,k2=y(()=>{jp=class{refine(e,t){if(t.length<2)return t;let n=[],i=t[0];for(let a=1;a=i.index+i.text.length){n.push(i),i=s;continue}let o=null,l=null;s.text.length>i.text.length?(o=s,l=i):(o=i,l=s),e.debug(()=>{console.log(`${this.constructor.name} remove ${l} by ${o}`)}),i=o}return i!=null&&n.push(i),n}}});var Sfe,TS,Efe=y(()=>{Sfe=tt(Xt(),1);d2();TS=class{refine(e,t){return e.option.forwardDate&&t.forEach(n=>{let i=(0,Sfe.default)(e.reference.getDateWithAdjustedTimezone());if(n.start.isOnlyTime()&&e.reference.instant>n.start.date()){let a=e.reference.getDateWithAdjustedTimezone(),s=new Date(a);s.setDate(s.getDate()+1),eA(n.start,s),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} time from the ref date (${a}) to the following day (${s})`)}),n.end&&n.end.isOnlyTime()&&(eA(n.end,s),n.start.date()>n.end.date()&&(s.setDate(s.getDate()+1),eA(n.end,s)))}if(n.start.isOnlyWeekdayComponent()&&i.isAfter(n.start.dayjs())&&(i.day()>=n.start.get("weekday")?i=i.day(n.start.get("weekday")+7):i=i.day(n.start.get("weekday")),n.start.imply("day",i.date()),n.start.imply("month",i.month()+1),n.start.imply("year",i.year()),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.start})`)}),n.end&&n.end.isOnlyWeekdayComponent()&&(i.day()>n.end.get("weekday")?i=i.day(n.end.get("weekday")+7):i=i.day(n.end.get("weekday")),n.end.imply("day",i.date()),n.end.imply("month",i.month()+1),n.end.imply("year",i.year()),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.end})`)}))),n.start.isDateWithUnknownYear()&&i.isAfter(n.start.dayjs()))for(let a=0;a<3&&i.isAfter(n.start.dayjs());a++)n.start.imply("year",n.start.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} year (${n.start})`)}),n.end&&!n.end.isCertain("year")&&(n.end.imply("year",n.end.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} month (${n.start})`)}))}),t}}});var kS,xfe=y(()=>{mu();kS=class extends _v{constructor(t){super();A(this,"strictMode");this.strictMode=t}isValid(t,n){return n.text.replace(" ","").match(/^\d*(\.\d*)?$/)?(t.debug(()=>{console.log(`Removing unlikely result '${n.text}'`)}),!1):n.start.isValidDate()?n.end&&!n.end.isValidDate()?(t.debug(()=>{console.log(`Removing invalid result: ${n} (${n.end})`)}),!1):this.strictMode?this.isStrictModeValid(t,n):!0:(t.debug(()=>{console.log(`Removing invalid result: ${n} (${n.start})`)}),!1)}isStrictModeValid(t,n){return n.start.isOnlyWeekdayComponent()?(t.debug(()=>{console.log(`(Strict) Removing weekday only component: ${n} (${n.end})`)}),!1):!0}}});var RZe,OZe,LZe,FZe,Cfe,$Ze,Dfe,Pfe,zZe,Mfe,_fe,fu,aA=y(()=>{we();RZe=new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})(?:T([0-9]{1,2}):([0-9]{1,2})(?::([0-9]{1,2})(?:\\.(\\d{1,4}))?)?(Z|([+-]\\d{2}):?(\\d{2})?)?)?(?=\\W|$)","i"),OZe=1,LZe=2,FZe=3,Cfe=4,$Ze=5,Dfe=6,Pfe=7,zZe=8,Mfe=9,_fe=10,fu=class extends V{innerPattern(){return RZe}innerExtract(e,t){let n=e.createParsingComponents({year:parseInt(t[OZe]),month:parseInt(t[LZe]),day:parseInt(t[FZe])});if(t[Cfe]!=null&&(n.assign("hour",parseInt(t[Cfe])),n.assign("minute",parseInt(t[$Ze])),t[Dfe]!=null&&n.assign("second",parseInt(t[Dfe])),t[Pfe]!=null&&n.assign("millisecond",parseInt(t[Pfe])),t[zZe]!=null)){let i=0;if(t[Mfe]){let a=parseInt(t[Mfe]),s=0;t[_fe]!=null&&(s=parseInt(t[_fe])),i=a*60,i<0?i-=s:i+=s}n.assign("timezoneOffset",i)}return n.addTag("parser/ISOFormatParser")}}});var dh,w2=y(()=>{mu();dh=class extends ns{mergeResults(e,t,n){let i=n.clone();return i.index=t.index,i.text=t.text+e+i.text,i.start.assign("weekday",t.start.get("weekday")),i.end&&i.end.assign("weekday",t.start.get("weekday")),i}shouldMergeResults(e,t,n){return t.start.isOnlyWeekdayComponent()&&!t.start.isCertain("hour")&&n.start.isCertain("day")&&e.match(/^,?\s*$/)!=null}}});function ln(r,e=!1){return r.parsers.unshift(new fu),r.refiners.unshift(new dh),r.refiners.unshift(new El),r.refiners.unshift(new jp),r.refiners.push(new vS),r.refiners.push(new jp),r.refiners.push(new TS),r.refiners.push(new kS(e)),r}var Hs=y(()=>{wfe();bS();k2();Efe();xfe();aA();w2()});function aa(r){let e=(0,Bp.default)(r.getDateWithAdjustedTimezone()),t=new ee(r,{});return Vr(t,e),vfe(t,e),t.assign("timezoneOffset",r.getTimezoneOffset()),t.addTag("casualReference/now"),t}function Si(r){let e=(0,Bp.default)(r.getDateWithAdjustedTimezone()),t=new ee(r,{});return Vr(t,e),vc(t,e),t.addTag("casualReference/today"),t}function sa(r){return uh(r,1).addTag("casualReference/yesterday")}function uh(r,e){return bc(r,-e)}function oa(r){return bc(r,1).addTag("casualReference/tomorrow")}function bc(r,e){let t=(0,Bp.default)(r.getDateWithAdjustedTimezone()),n=new ee(r,{});return t=t.add(e,"day"),Vr(n,t),vc(n,t),n}function Afe(r,e=22){let t=(0,Bp.default)(r.getDateWithAdjustedTimezone()),n=new ee(r,{});return Vr(n,t),n.imply("hour",e),n.imply("meridiem",B.PM),n.addTag("casualReference/tonight"),n}function sA(r,e=0){let t=(0,Bp.default)(r.getDateWithAdjustedTimezone()),n=new ee(r,{});return t.hour()<6&&(t=t.add(-1,"day")),Vr(n,t),n.imply("hour",e),n}function Iv(r,e=20){let t=new ee(r,{});return t.imply("meridiem",B.PM),t.imply("hour",e),t.addTag("casualReference/evening"),t}function oA(r,e=20){let t=(0,Bp.default)(r.getDateWithAdjustedTimezone()),n=new ee(r,{});return t=t.add(-1,"day"),Vr(n,t),n.imply("hour",e),n.imply("meridiem",B.PM),n.addTag("casualReference/yesterday"),n.addTag("casualReference/evening"),n}function ph(r){let e=new ee(r,{}),t=(0,Bp.default)(r.getDateWithAdjustedTimezone());return t.hour()>2&&yfe(e,t),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function Nv(r,e=6){let t=new ee(r,{});return t.imply("meridiem",B.AM),t.imply("hour",e),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/morning"),t}function Ife(r,e=15){let t=new ee(r,{});return t.imply("meridiem",B.PM),t.imply("hour",e),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/afternoon"),t}function Rv(r){let e=new ee(r,{});return e.imply("meridiem",B.AM),e.assign("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var Bp,Vs=y(()=>{lt();Bp=tt(Xt(),1);Us();Bt()});var Nfe,jZe,wS,Rfe=y(()=>{Nfe=tt(Xt(),1);we();Us();Vs();jZe=/(now|today|tonight|tomorrow|overmorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,wS=class extends V{innerPattern(e){return jZe}innerExtract(e,t){let n=(0,Nfe.default)(e.refDate),i=t[0].toLowerCase(),a=e.createParsingComponents();switch(i){case"now":a=aa(e.reference);break;case"today":a=Si(e.reference);break;case"yesterday":a=sa(e.reference);break;case"tomorrow":case"tmr":case"tmrw":a=oa(e.reference);break;case"tonight":a=Afe(e.reference);break;case"overmorrow":a=bc(e.reference,2);break;default:i.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),Vr(a,n),a.imply("hour",0));break}return a.addTag("parser/ENCasualDateParser"),a}}});var BZe,SS,Ofe=y(()=>{we();Vs();BZe=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,SS=class extends V{innerPattern(){return BZe}innerExtract(e,t){let n=null;switch(t[1].toLowerCase()){case"afternoon":n=Ife(e.reference);break;case"evening":case"night":n=Iv(e.reference);break;case"midnight":n=ph(e.reference);break;case"morning":n=Nv(e.reference);break;case"noon":case"midday":n=Rv(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}}});function Gn(r){let e={};for(let t in r)e[t]=-r[t];return e}function lA(r,e){let t=r.clone(),n=r.dayjs();for(let i in e)n=n.add(e[i],i);return("day"in e||"d"in e||"week"in e||"month"in e||"year"in e)&&(t.imply("day",n.date()),t.imply("month",n.month()+1),t.imply("year",n.year())),("second"in e||"minute"in e||"hour"in e)&&(t.imply("second",n.second()),t.imply("minute",n.minute()),t.imply("hour",n.hour())),t}var qs=y(()=>{});function Kn(r,e,t){let n=r.getDateWithAdjustedTimezone(),i=UZe(n,e,t),a=new ee(r);return a=lA(a,{day:i}),a.assign("weekday",e),a}function UZe(r,e,t){let n=r.getDay();switch(t){case"this":return cA(r,e);case"last":return Lfe(r,e);case"next":return n==We.SUNDAY?e==We.SUNDAY?7:e:n==We.SATURDAY?e==We.SATURDAY?7:e==We.SUNDAY?8:1+e:e=0&&(n-=7),n}var xl=y(()=>{Bt();lt();qs()});var VZe,qZe,WZe,YZe,ES,Ffe=y(()=>{si();At();we();xl();Bt();VZe=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${oe(rA)}|weekend|weekday)(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),qZe=1,WZe=2,YZe=3,ES=class extends V{innerPattern(){return VZe}innerExtract(e,t){let n=t[qZe],i=t[YZe],a=n||i;a=a||"",a=a.toLowerCase();let s=null;a=="last"||a=="past"?s="last":a=="next"?s="next":a=="this"&&(s="this");let o=t[WZe].toLowerCase(),l;if(rA[o]!==void 0)l=rA[o];else if(o=="weekend")l=s=="last"?We.SUNDAY:We.SATURDAY;else if(o=="weekday"){let c=e.reference.getDateWithAdjustedTimezone().getDay();c==We.SUNDAY||c==We.SATURDAY?l=s=="last"?We.FRIDAY:We.MONDAY:(l=c-1,l=s=="last"?l-1:l+1,l=l%5+1)}else return null;return Kn(e.reference,l,s)}}});var $fe,GZe,KZe,ZZe,xS,zfe=y(()=>{si();lt();$fe=tt(Xt(),1);we();At();GZe=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${oe(sS)})(?=\\s*)(?=\\W|$)`,"i"),KZe=1,ZZe=2,xS=class extends V{innerPattern(){return GZe}innerExtract(e,t){let n=t[KZe].toLowerCase(),i=t[ZZe].toLowerCase(),a=sS[i];if(n=="next"||n.startsWith("after")){let l={};return l[a]=1,ee.createRelativeFromReference(e.reference,l)}if(n=="last"||n=="past"){let l={};return l[a]=-1,ee.createRelativeFromReference(e.reference,l)}let s=e.createParsingComponents(),o=(0,$fe.default)(e.reference.instant);return i.match(/week/i)?(o=o.add(-o.get("d"),"d"),s.imply("day",o.date()),s.imply("month",o.month()+1),s.imply("year",o.year())):i.match(/month/i)?(o=o.add(-o.date()+1,"d"),s.imply("day",o.date()),s.assign("year",o.year()),s.assign("month",o.month()+1)):i.match(/year/i)&&(o=o.add(-o.date()+1,"d"),o=o.add(-o.month(),"month"),s.imply("day",o.date()),s.imply("month",o.month()+1),s.assign("year",o.year())),s}}});var QZe,JZe,XZe,jfe,Bfe,S2,oi,hu=y(()=>{Dn();QZe=new RegExp("([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)","i"),JZe=1,XZe=5,jfe=2,Bfe=3,S2=4,oi=class{constructor(e){A(this,"groupNumberMonth");A(this,"groupNumberDay");this.groupNumberMonth=e?Bfe:jfe,this.groupNumberDay=e?jfe:Bfe}pattern(){return QZe}extract(e,t){let n=t.index+t[JZe].length,i=t.index+t[0].length-t[XZe].length;if(n>0&&e.text.substring(0,n).match("\\d/?$")||i12)&&o>12)if(l>=1&&l<=12&&o<=31)[l,o]=[o,l];else return null;if(l<1||l>31)return null;if(s.start.assign("day",l),s.start.assign("month",o),t[S2]){let c=parseInt(t[S2]),d=rs(c);s.start.assign("year",d)}else{let c=dr(e.refDate,l,o);s.start.imply("year",c)}return s.addTag("parser/SlashDateFormatParser")}}});var eQe,tQe,CS,Ufe=y(()=>{si();lt();we();aS();eQe=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${uu})(?=\\W|$)`,"i"),tQe=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${zp})(?=\\W|$)`,"i"),CS=class extends V{constructor(t=!0){super();A(this,"allowAbbreviations");this.allowAbbreviations=t}innerPattern(){return this.allowAbbreviations?eQe:tQe}innerExtract(t,n){let i=n[1].toLowerCase(),a=So(n[2]);if(!a)return null;switch(i){case"last":case"past":case"-":a=Cv(a);break}return ee.createRelativeFromReference(t.reference,a)}}});function rQe(r){return r.text.match(/^[+-]/i)!=null}function Hfe(r){return r.text.match(/^-/i)!=null}var DS,Vfe=y(()=>{mu();lt();si();qs();DS=class extends ns{shouldMergeResults(e,t,n){return e.match(/^\s*$/i)?rQe(n)||Hfe(n):!1}mergeResults(e,t,n,i){let a=So(n.text);Hfe(n)&&(a=Gn(a));let s=ee.createRelativeFromReference(er.fromDate(t.start.date()),a);return new Wt(t.reference,t.index,`${t.text}${e}${n.text}`,s)}}});function qfe(r){return r.text.match(/\s+(before|from)$/i)!=null}function nQe(r){return r.text.match(/\s+(after|since)$/i)!=null}var PS,Wfe=y(()=>{mu();lt();si();aS();PS=class extends ns{patternBetween(){return/^\s*$/i}shouldMergeResults(e,t,n){return!e.match(this.patternBetween())||!qfe(t)&&!nQe(t)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,t,n){let i=So(t.text);qfe(t)&&(i=Cv(i));let a=ee.createRelativeFromReference(er.fromDate(n.start.date()),i);return new Wt(n.reference,t.index,`${t.text}${e}${n.text}`,a)}}});var iQe,aQe,MS,Yfe=y(()=>{si();iQe=new RegExp(`^\\s*(${Fp})`,"i"),aQe=1,MS=class{refine(e,t){return t.forEach(function(n){if(!n.start.isDateWithUnknownYear())return;let i=e.text.substring(n.index+n.text.length),a=iQe.exec(i);if(!a||a[0].trim().length<=3)return;e.debug(()=>{console.log(`Extracting year: '${a[0]}' into : ${n}`)});let s=$p(a[aQe]);n.end!=null&&n.end.assign("year",s),n.start.assign("year",s),n.text+=a[0]}),t}}});var _S,Gfe=y(()=>{mu();_S=class extends _v{constructor(){super()}isValid(e,t){let n=t.text.trim();return n===e.text.trim()?!0:n.toLowerCase()==="may"&&!e.text.substring(0,t.index).trim().match(/\b(in)$/i)?(e.debug(()=>{console.log(`Removing unlikely result: ${t}`)}),!1):n.toLowerCase().endsWith("the second")?(e.text.substring(t.index+t.text.length).trim().length>0&&e.debug(()=>{console.log(`Removing unlikely result: ${t}`)}),!1):!0}}});var mh,E2=y(()=>{efe();ife();sfe();lfe();dfe();ufe();mfe();ffe();hfe();gfe();kfe();Hs();Rfe();Ofe();Ffe();zfe();hu();Ufe();Vfe();Wfe();k2();Yfe();Gfe();mh=class{createCasualConfiguration(e=!1){let t=this.createConfiguration(!1,e);return t.parsers.push(new wS),t.parsers.push(new SS),t.parsers.push(new dS),t.parsers.push(new xS),t.parsers.push(new CS),t.refiners.push(new _S),t}createConfiguration(e=!0,t=!1){let n=ln({parsers:[new oi(t),new oS(e),new lS,new cS(t),new ES,new pS,new fS(e),new hS(e),new gS(e)],refiners:[new Av]},e);return n.parsers.unshift(new uS(e)),n.refiners.unshift(new PS),n.refiners.unshift(new DS),n.refiners.unshift(new jp),n.refiners.push(new Av),n.refiners.push(new MS),n.refiners.push(new yS),n}}});var ze,AS,is=y(()=>{lt();E2();ze=class r{constructor(e){A(this,"parsers");A(this,"refiners");A(this,"defaultConfig",new mh);e=e||this.defaultConfig.createCasualConfiguration(),this.parsers=[...e.parsers],this.refiners=[...e.refiners]}clone(){return new r({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(e,t,n){let i=this.parse(e,t,n);return i.length>0?i[0].start.date():null}parse(e,t,n){let i=new AS(e,t,n),a=[];return this.parsers.forEach(s=>{let o=r.executeParser(i,s);a=a.concat(o)}),a.sort((s,o)=>s.index-o.index),this.refiners.forEach(function(s){a=s.refine(i,a)}),a}static executeParser(e,t){let n=[],i=t.pattern(e),a=e.text,s=e.text,o=i.exec(s);for(;o;){let l=o.index+a.length-s.length;o.index=l;let c=t.extract(e,o);if(!c){s=a.substring(o.index+1),o=i.exec(s);continue}let d=null;c instanceof Wt?d=c:c instanceof ee?(d=e.createParsingResult(o.index,o[0]),d.start=c):d=e.createParsingResult(o.index,o[0],c);let u=d.index,p=d.text;e.debug(()=>console.log(`${t.constructor.name} extracted (at index=${u}) '${p}'`)),n.push(d),s=a.substring(u+p.length),o=i.exec(s)}return n}},AS=class{constructor(e,t,n){A(this,"text");A(this,"option");A(this,"reference");A(this,"refDate");this.text=e,this.option=n!=null?n:{},this.reference=er.fromInput(t,this.option.timezones),this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof ee?e:new ee(this.reference,e)}createParsingResult(e,t,n,i){let a=typeof t=="string"?t:this.text.substring(e,t),s=n?this.createParsingComponents(n):null,o=i?this.createParsingComponents(i):null;return new Wt(this.reference,e,a,s,o)}debug(e){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(e):this.option.debug.debug(e))}}});var C2={};et(C2,{Chrono:()=>ze,GB:()=>sQe,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>IS,configuration:()=>dA,parse:()=>oQe,parseDate:()=>lQe,strict:()=>x2});function oQe(r,e,t){return IS.parse(r,e,t)}function lQe(r,e,t){return IS.parseDate(r,e,t)}var dA,IS,x2,sQe,Kfe=y(()=>{is();lt();Bt();E2();dA=new mh,IS=new ze(dA.createCasualConfiguration(!1)),x2=new ze(dA.createConfiguration(!0,!1)),sQe=new ze(dA.createCasualConfiguration(!0))});var NS,Zfe=y(()=>{pu();NS=class extends wi{primaryPrefix(){return"(?:(?:um|von)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|bis)\\s*"}extractPrimaryTimeComponents(e,t){return t[0].match(/^\s*\d{4}\s*$/)?null:super.extractPrimaryTimeComponents(e,t)}}});function A2(r){let e=r.toLowerCase();return D2[e]!==void 0?D2[e]:e==="ein"||e==="einer"||e==="einem"||e==="einen"||e==="eine"?1:e.match(/wenigen/)?2:e.match(/halb/)||e.match(/halben/)?.5:e.match(/einigen/)?3:e.match(/mehreren/)?7:parseFloat(e)}function Xfe(r){if(/v/i.test(r))return-parseInt(r.replace(/[^0-9]+/gi,""));if(/n/i.test(r))return parseInt(r.replace(/[^0-9]+/gi,""));if(/z/i.test(r))return parseInt(r.replace(/[^0-9]+/gi,""));let e=parseInt(r);return rs(e)}function rhe(r){let e={},t=r,n=Qfe.exec(t);for(;n;)cQe(e,n),t=t.substring(n[0].length),n=Qfe.exec(t);return e}function cQe(r,e){let t=A2(e[1]),n=RS[e[2].toLowerCase()];r[n]=t}var P2,M2,D2,RS,_2,Jfe,ehe,Qfe,the,Ov=y(()=>{At();Dn();P2={sonntag:0,so:0,montag:1,mo:1,dienstag:2,di:2,mittwoch:3,mi:3,donnerstag:4,do:4,freitag:5,fr:5,samstag:6,sa:6},M2={januar:1,j\u00E4nner:1,janner:1,jan:1,"jan.":1,februar:2,feber:2,feb:2,"feb.":2,m\u00E4rz:3,maerz:3,m\u00E4r:3,"m\xE4r.":3,mrz:3,"mrz.":3,april:4,apr:4,"apr.":4,mai:5,juni:6,jun:6,"jun.":6,juli:7,jul:7,"jul.":7,august:8,aug:8,"aug.":8,september:9,sep:9,"sep.":9,sept:9,"sept.":9,oktober:10,okt:10,"okt.":10,november:11,nov:11,"nov.":11,dezember:12,dez:12,"dez.":12},D2={eins:1,eine:1,einem:1,einen:1,einer:1,zwei:2,drei:3,vier:4,f\u00FCnf:5,fuenf:5,sechs:6,sieben:7,acht:8,neun:9,zehn:10,elf:11,zw\u00F6lf:12,zwoelf:12},RS={sek:"second",sekunde:"second",sekunden:"second",min:"minute",minute:"minute",minuten:"minute",h:"hour",std:"hour",stunde:"hour",stunden:"hour",tag:"d",tage:"d",tagen:"d",woche:"week",wochen:"week",monat:"month",monate:"month",monaten:"month",monats:"month",quartal:"quarter",quartals:"quarter",quartale:"quarter",quartalen:"quarter",a:"year",j:"year",jr:"year",jahr:"year",jahre:"year",jahren:"year",jahres:"year"},_2=`(?:${oe(D2)}|[0-9]+|[0-9]+\\.[0-9]+|halb?|halbe?|einigen?|wenigen?|mehreren?)`;Jfe="(?:[0-9]{1,4}(?:\\s*[vn]\\.?\\s*(?:C(?:hr)?|(?:u\\.?|d\\.?(?:\\s*g\\.?)?)?\\s*Z)\\.?|\\s*(?:u\\.?|d\\.?(?:\\s*g\\.)?)\\s*Z\\.?)?)";ehe=`(${_2})\\s{0,5}(${oe(RS)})\\s{0,5}`,Qfe=new RegExp(ehe,"i"),the=Ia("",ehe)});var dQe,uQe,pQe,mQe,OS,nhe=y(()=>{Ov();At();we();xl();dQe=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:a[mn]\\s*?)?(?:(diese[mn]|letzte[mn]|n(?:\xE4|ae)chste[mn])\\s*)?(${oe(P2)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(diese|letzte|n(?:\xE4|ae)chste)\\s*woche)?(?=\\W|$)`,"i"),uQe=1,pQe=3,mQe=2,OS=class extends V{innerPattern(){return dQe}innerExtract(e,t){let n=t[mQe].toLowerCase(),i=P2[n],a=t[uQe],s=t[pQe],o=a||s;o=o||"",o=o.toLowerCase();let l=null;return o.match(/letzte/)?l="last":o.match(/chste/)?l="next":o.match(/diese/)&&(l="this"),Kn(e.reference,i,l)}}});var fQe,hQe,gQe,ihe,ahe,she,LS,ohe=y(()=>{Bt();fQe=new RegExp("(^|\\s|T)(?:(?:um|von)\\s*)?(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s)?)?(?:\\s*Uhr)?(?:\\s*(morgens|vormittags|nachmittags|abends|nachts|am\\s+(?:Morgen|Vormittag|Nachmittag|Abend)|in\\s+der\\s+Nacht))?(?=\\W|$)","i"),hQe=new RegExp("^\\s*(\\-|\\\u2013|\\~|\\\u301C|bis(?:\\s+um)?|\\?)\\s*(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s)?)?(?:\\s*Uhr)?(?:\\s*(morgens|vormittags|nachmittags|abends|nachts|am\\s+(?:Morgen|Vormittag|Nachmittag|Abend)|in\\s+der\\s+Nacht))?(?=\\W|$)","i"),gQe=2,ihe=3,ahe=4,she=5,LS=class r{pattern(e){return fQe}extract(e,t){let n=e.createParsingResult(t.index+t[1].length,t[0].substring(t[1].length));if(n.text.match(/^\d{4}$/)||(n.start=r.extractTimeComponent(n.start.clone(),t),!n.start))return t.index+=t[0].length,null;let i=e.text.substring(t.index+t[0].length),a=hQe.exec(i);return a&&(n.end=r.extractTimeComponent(n.start.clone(),a),n.end&&(n.text+=a[0])),n}static extractTimeComponent(e,t){let n=0,i=0,a=null;if(n=parseInt(t[gQe]),t[ihe]!=null&&(i=parseInt(t[ihe])),i>=60||n>24)return null;if(n>=12&&(a=B.PM),t[she]!=null){if(n>12)return null;let s=t[she].toLowerCase();s.match(/morgen|vormittag/)&&(a=B.AM,n==12&&(n=0)),s.match(/nachmittag|abend/)&&(a=B.PM,n!=12&&(n+=12)),s.match(/nacht/)&&(n==12?(a=B.AM,n=0):n<6?a=B.AM:(a=B.PM,n+=12))}if(e.assign("hour",n),e.assign("minute",i),a!==null?e.assign("meridiem",a):n<12?e.imply("meridiem",B.AM):e.imply("meridiem",B.PM),t[ahe]!=null){let s=parseInt(t[ahe]);if(s>=60)return null;e.assign("second",s)}return e}}});var FS,lhe=y(()=>{Eo();FS=class extends Jr{patternBetween(){return/^\s*(bis(?:\s*(?:am|zum))?|-)\s*$/i}}});var $S,che=y(()=>{xo();$S=class extends Xr{patternBetween(){return new RegExp("^\\s*(T|um|am|,|-)?\\s*$")}}});var dhe,fh,I2=y(()=>{dhe=tt(Xt(),1);Bt();we();Us();qs();fh=class r extends V{innerPattern(e){return/(diesen)?\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht)(?=\W|$)/i}innerExtract(e,t){let n=(0,dhe.default)(e.refDate),i=t[2].toLowerCase(),a=e.createParsingComponents();return vc(a,n),r.extractTimeComponents(a,i)}static extractTimeComponents(e,t){switch(t){case"morgen":e.imply("hour",6),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",B.AM);break;case"vormittag":e.imply("hour",9),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",B.AM);break;case"mittag":case"mittags":e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",B.AM);break;case"nachmittag":e.imply("hour",15),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",B.PM);break;case"abend":e.imply("hour",18),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",B.PM);break;case"nacht":e.imply("hour",22),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",B.PM);break;case"mitternacht":e.get("hour")>1&&(e=lA(e,{day:1})),e.imply("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",B.AM);break}return e}}});var uhe,yQe,vQe,bQe,zS,phe=y(()=>{uhe=tt(Xt(),1);we();Us();I2();Vs();yQe=new RegExp("(jetzt|heute|morgen|\xFCbermorgen|uebermorgen|gestern|vorgestern|letzte\\s*nacht)(?:\\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht))?(?=\\W|$)","i"),vQe=1,bQe=2,zS=class extends V{innerPattern(e){return yQe}innerExtract(e,t){let n=(0,uhe.default)(e.refDate),i=(t[vQe]||"").toLowerCase(),a=(t[bQe]||"").toLowerCase(),s=e.createParsingComponents();switch(i){case"jetzt":s=aa(e.reference);break;case"heute":s=Si(e.reference);break;case"morgen":Sl(s,n);break;case"\xFCbermorgen":case"uebermorgen":n=n.add(1,"day"),Sl(s,n);break;case"gestern":n=n.add(-1,"day"),Vr(s,n),vc(s,n);break;case"vorgestern":n=n.add(-2,"day"),Vr(s,n),vc(s,n);break;default:i.match(/letzte\s*nacht/)&&(n.hour()>6&&(n=n.add(-1,"day")),Vr(s,n),s.imply("hour",0));break}return a&&(s=fh.extractTimeComponents(s,a)),s}}});var TQe,mhe,fhe,kQe,hhe,jS,ghe=y(()=>{Dn();Ov();Ov();At();we();TQe=new RegExp(`(?:am\\s*?)?(?:den\\s*?)?([0-9]{1,2})\\.(?:\\s*(?:bis(?:\\s*(?:am|zum))?|\\-|\\\u2013|\\s)\\s*([0-9]{1,2})\\.?)?\\s*(${oe(M2)})(?:(?:-|/|,?\\s*)(${Jfe}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),mhe=1,fhe=2,kQe=3,hhe=4,jS=class extends V{innerPattern(){return TQe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=M2[t[kQe].toLowerCase()],a=parseInt(t[mhe]);if(a>31)return t.index=t.index+t[mhe].length,null;if(n.start.assign("month",i),n.start.assign("day",a),t[hhe]){let s=Xfe(t[hhe]);n.start.assign("year",s)}else{let s=dr(e.refDate,a,i);n.start.imply("year",s)}if(t[fhe]){let s=parseInt(t[fhe]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var BS,yhe=y(()=>{Ov();lt();we();qs();At();BS=class extends V{constructor(){super()}innerPattern(){return new RegExp(`(?:\\s*((?:n\xE4chste|kommende|folgende|letzte|vergangene|vorige|vor(?:her|an)gegangene)(?:s|n|m|r)?|vor|in)\\s*)?(${_2})?(?:\\s*(n\xE4chste|kommende|folgende|letzte|vergangene|vorige|vor(?:her|an)gegangene)(?:s|n|m|r)?)?\\s*(${oe(RS)})`,"i")}innerExtract(e,t){let n=t[2]?A2(t[2]):1,i=RS[t[4].toLowerCase()],a={};a[i]=n;let s=t[1]||t[3]||"";if(s=s.toLowerCase(),!!s)return(/vor/.test(s)||/letzte/.test(s)||/vergangen/.test(s))&&(a=Gn(a)),ee.createRelativeFromReference(e.reference,a)}}});var US,vhe=y(()=>{Ov();lt();we();US=class extends V{innerPattern(){return new RegExp(`(?:in|f\xFCr|w\xE4hrend)\\s*(${the})(?=\\W|$)`,"i")}innerExtract(e,t){let n=rhe(t[1]);return ee.createRelativeFromReference(e.reference,n)}}});var O2={};et(O2,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>N2,createCasualConfiguration:()=>bhe,createConfiguration:()=>R2,parse:()=>SQe,parseDate:()=>EQe,strict:()=>wQe});function SQe(r,e,t){return N2.parse(r,e,t)}function EQe(r,e,t){return N2.parseDate(r,e,t)}function bhe(r=!0){let e=R2(!1,r);return e.parsers.unshift(new fh),e.parsers.unshift(new zS),e.parsers.unshift(new BS),e}function R2(r=!0,e=!0){return ln({parsers:[new fu,new oi(e),new NS,new LS,new jS,new OS,new US],refiners:[new FS,new $S]},r)}var N2,wQe,The=y(()=>{Hs();is();lt();Bt();hu();aA();Zfe();nhe();ohe();lhe();che();phe();I2();ghe();yhe();vhe();N2=new ze(bhe()),wQe=new ze(R2(!0))});var khe,HS,whe=y(()=>{khe=tt(Xt(),1);Bt();we();Us();Vs();HS=class extends V{innerPattern(e){return/(maintenant|aujourd'hui|demain|hier|cette\s*nuit|la\s*veille)(?=\W|$)/i}innerExtract(e,t){let n=(0,khe.default)(e.refDate),i=t[0].toLowerCase(),a=e.createParsingComponents();switch(i){case"maintenant":return aa(e.reference);case"aujourd'hui":return Si(e.reference);case"hier":return sa(e.reference);case"demain":return oa(e.reference);default:i.match(/cette\s*nuit/)?(Vr(a,n),a.imply("hour",22),a.imply("meridiem",B.PM)):i.match(/la\s*veille/)&&(n=n.add(-1,"day"),Vr(a,n),a.imply("hour",0))}return a}}});var VS,She=y(()=>{Bt();we();VS=class extends V{innerPattern(e){return/(cet?)?\s*(matin|soir|après-midi|aprem|a midi|à minuit)(?=\W|$)/i}innerExtract(e,t){let n=t[2].toLowerCase(),i=e.createParsingComponents();switch(n){case"apr\xE8s-midi":case"aprem":i.imply("hour",14),i.imply("minute",0),i.imply("meridiem",B.PM);break;case"soir":i.imply("hour",18),i.imply("minute",0),i.imply("meridiem",B.PM);break;case"matin":i.imply("hour",8),i.imply("minute",0),i.imply("meridiem",B.AM);break;case"a midi":i.imply("hour",12),i.imply("minute",0),i.imply("meridiem",B.AM);break;case"\xE0 minuit":i.imply("hour",0),i.imply("meridiem",B.AM);break}return i}}});var qS,Ehe=y(()=>{pu();qS=class extends wi{primaryPrefix(){return"(?:(?:[\xE0a])\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|[\xE0a]|\\?)\\s*"}extractPrimaryTimeComponents(e,t){return t[0].match(/^\s*\d{4}\s*$/)?null:super.extractPrimaryTimeComponents(e,t)}}});var WS,xhe=y(()=>{xo();WS=class extends Xr{patternBetween(){return new RegExp("^\\s*(T|\xE0|a|au|vers|de|,|-)?\\s*$")}}});var YS,Che=y(()=>{Eo();YS=class extends Jr{patternBetween(){return/^\s*(à|a|au|-)\s*$/i}}});function j2(r){let e=r.toLowerCase();return L2[e]!==void 0?L2[e]:e==="une"||e==="un"?1:e.match(/quelques?/)?3:e.match(/demi-?/)?.5:parseFloat(e)}function U2(r){let e=r.toLowerCase();return e=e.replace(/(?:er)$/i,""),parseInt(e)}function Mhe(r){if(/AC/i.test(r))return r=r.replace(/BC/i,""),-parseInt(r);if(/AD/i.test(r)||/C/i.test(r))return r=r.replace(/[^\d]+/i,""),parseInt(r);let e=parseInt(r);return e<100&&(e>50?e=e+1900:e=e+2e3),e}function pA(r){let e={},t=r,n=Dhe.exec(t);for(;n;)xQe(e,n),t=t.substring(n[0].length),n=Dhe.exec(t);return e}function xQe(r,e){let t=j2(e[1]),n=GS[e[2].toLowerCase()];r[n]=t}var F2,$2,L2,GS,z2,B2,Phe,_he,Dhe,uA,Up=y(()=>{At();F2={dimanche:0,dim:0,lundi:1,lun:1,mardi:2,mar:2,mercredi:3,mer:3,jeudi:4,jeu:4,vendredi:5,ven:5,samedi:6,sam:6},$2={janvier:1,jan:1,"jan.":1,f\u00E9vrier:2,f\u00E9v:2,"f\xE9v.":2,fevrier:2,fev:2,"fev.":2,mars:3,mar:3,"mar.":3,avril:4,avr:4,"avr.":4,mai:5,juin:6,jun:6,juillet:7,juil:7,jul:7,"jul.":7,ao\u00FBt:8,aout:8,septembre:9,sep:9,"sep.":9,sept:9,"sept.":9,octobre:10,oct:10,"oct.":10,novembre:11,nov:11,"nov.":11,d\u00E9cembre:12,decembre:12,dec:12,"dec.":12},L2={un:1,deux:2,trois:3,quatre:4,cinq:5,six:6,sept:7,huit:8,neuf:9,dix:10,onze:11,douze:12,treize:13},GS={sec:"second",seconde:"second",secondes:"second",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",heure:"hour",heures:"hour",jour:"d",jours:"d",semaine:"week",semaines:"week",mois:"month",trimestre:"quarter",trimestres:"quarter",ans:"year",ann\u00E9e:"year",ann\u00E9es:"year"},z2=`(?:${oe(L2)}|[0-9]+|[0-9]+\\.[0-9]+|une?\\b|quelques?|demi-?)`;B2="(?:[0-9]{1,2}(?:er)?)";Phe="(?:[1-9][0-9]{0,3}\\s*(?:AC|AD|p\\.\\s*C(?:hr?)?\\.\\s*n\\.)|[1-2][0-9]{3}|[5-9][0-9])";_he=`(${z2})\\s{0,5}(${oe(GS)})\\s{0,5}`,Dhe=new RegExp(_he,"i"),uA=Ia("",_he)});var CQe,DQe,PQe,KS,Ahe=y(()=>{Up();At();we();xl();CQe=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(?:ce)\\s*)?(${oe(F2)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(dernier|prochain)\\s*)?(?=\\W|\\d|$)`,"i"),DQe=1,PQe=2,KS=class extends V{innerPattern(){return CQe}innerExtract(e,t){let n=t[DQe].toLowerCase(),i=F2[n];if(i===void 0)return null;let a=t[PQe];a=a||"",a=a.toLowerCase();let s=null;return a=="dernier"?s="last":a=="prochain"&&(s="next"),Kn(e.reference,i,s)}}});var MQe,_Qe,AQe,Ihe,Nhe,Rhe,ZS,Ohe=y(()=>{Bt();MQe=new RegExp("(^|\\s|T)(?:(?:[\xE0a])\\s*)?(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s|:)?)?(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?(?=\\W|$)","i"),_Qe=new RegExp("^\\s*(\\-|\\\u2013|\\~|\\\u301C|[\xE0a]|\\?)\\s*(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s|:)?)?(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?(?=\\W|$)","i"),AQe=2,Ihe=3,Nhe=4,Rhe=5,ZS=class r{pattern(e){return MQe}extract(e,t){let n=e.createParsingResult(t.index+t[1].length,t[0].substring(t[1].length));if(n.text.match(/^\d{4}$/)||(n.start=r.extractTimeComponent(n.start.clone(),t),!n.start))return t.index+=t[0].length,null;let i=e.text.substring(t.index+t[0].length),a=_Qe.exec(i);return a&&(n.end=r.extractTimeComponent(n.start.clone(),a),n.end&&(n.text+=a[0])),n}static extractTimeComponent(e,t){let n=0,i=0,a=null;if(n=parseInt(t[AQe]),t[Ihe]!=null&&(i=parseInt(t[Ihe])),i>=60||n>24)return null;if(n>=12&&(a=B.PM),t[Rhe]!=null){if(n>12)return null;let s=t[Rhe][0].toLowerCase();s=="a"&&(a=B.AM,n==12&&(n=0)),s=="p"&&(a=B.PM,n!=12&&(n+=12))}if(e.assign("hour",n),e.assign("minute",i),a!==null?e.assign("meridiem",a):n<12?e.imply("meridiem",B.AM):e.imply("meridiem",B.PM),t[Nhe]!=null){let s=parseInt(t[Nhe]);if(s>=60)return null;e.assign("second",s)}return e}}});var IQe,Lhe,Fhe,NQe,$he,QS,zhe=y(()=>{Dn();Up();Up();Up();At();we();IQe=new RegExp(`(?:on\\s*?)?(${B2})(?:\\s*(?:au|\\-|\\\u2013|jusqu'au?|\\s)\\s*(${B2}))?(?:-|/|\\s*(?:de)?\\s*)(${oe($2)})(?:(?:-|/|,?\\s*)(${Phe}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),Lhe=1,Fhe=2,NQe=3,$he=4,QS=class extends V{innerPattern(){return IQe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=$2[t[NQe].toLowerCase()],a=U2(t[Lhe]);if(a>31)return t.index=t.index+t[Lhe].length,null;if(n.start.assign("month",i),n.start.assign("day",a),t[$he]){let s=Mhe(t[$he]);n.start.assign("year",s)}else{let s=dr(e.refDate,a,i);n.start.imply("year",s)}if(t[Fhe]){let s=U2(t[Fhe]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var JS,jhe=y(()=>{Up();lt();we();qs();JS=class extends V{constructor(){super()}innerPattern(){return new RegExp(`il y a\\s*(${uA})(?=(?:\\W|$))`,"i")}innerExtract(e,t){let n=pA(t[1]),i=Gn(n);return ee.createRelativeFromReference(e.reference,i)}}});var XS,Bhe=y(()=>{Up();lt();we();XS=class extends V{innerPattern(){return new RegExp(`(?:dans|en|pour|pendant|de)\\s*(${uA})(?=\\W|$)`,"i")}innerExtract(e,t){let n=pA(t[1]);return ee.createRelativeFromReference(e.reference,n)}}});var eE,Uhe=y(()=>{Up();lt();we();qs();At();eE=class extends V{constructor(){super()}innerPattern(){return new RegExp(`(?:les?|la|l'|du|des?)\\s*(${z2})?(?:\\s*(prochaine?s?|derni[e\xE8]re?s?|pass[\xE9e]e?s?|pr[\xE9e]c[\xE9e]dents?|suivante?s?))?\\s*(${oe(GS)})(?:\\s*(prochaine?s?|derni[e\xE8]re?s?|pass[\xE9e]e?s?|pr[\xE9e]c[\xE9e]dents?|suivante?s?))?`,"i")}innerExtract(e,t){let n=t[1]?j2(t[1]):1,i=GS[t[3].toLowerCase()],a={};a[i]=n;let s=t[2]||t[4]||"";if(s=s.toLowerCase(),!!s)return(/derni[eè]re?s?/.test(s)||/pass[ée]e?s?/.test(s)||/pr[ée]c[ée]dents?/.test(s))&&(a=Gn(a)),ee.createRelativeFromReference(e.reference,a)}}});var q2={};et(q2,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>H2,createCasualConfiguration:()=>Hhe,createConfiguration:()=>V2,parse:()=>OQe,parseDate:()=>LQe,strict:()=>RQe});function OQe(r,e,t){return H2.parse(r,e,t)}function LQe(r,e,t){return H2.parseDate(r,e,t)}function Hhe(r=!0){let e=V2(!1,r);return e.parsers.unshift(new HS),e.parsers.unshift(new VS),e.parsers.unshift(new eE),e}function V2(r=!0,e=!0){return ln({parsers:[new oi(e),new QS,new qS,new ZS,new JS,new XS,new KS],refiners:[new WS,new YS]},r)}var H2,RQe,Vhe=y(()=>{Hs();is();lt();Bt();whe();She();hu();Ehe();xhe();Che();Ahe();Ohe();zhe();jhe();Bhe();Uhe();H2=new ze(Hhe()),RQe=new ze(V2(!0))});function Na(r){return String(r).replace(/\u2019/g,"'").replace(/\u201D/g,'"').replace(/\u3000/g," ").replace(/\uFFE5/g,"\xA5").replace(/[\uFF01\uFF03-\uFF06\uFF08\uFF09\uFF0C-\uFF19\uFF1C-\uFF1F\uFF21-\uFF3B\uFF3D\uFF3F\uFF41-\uFF5B\uFF5D\uFF5E]/g,FQe)}function FQe(r){return String.fromCharCode(r.charCodeAt(0)-65248)}function hh(r){let e=0;for(let t=0;t{Tc={\u96F6:0,"\u3007":0,\u4E00:1,\u4E8C:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6,\u4E03:7,\u516B:8,\u4E5D:9,\u5341:10},Lv={\u65E5:0,\u6708:1,\u706B:2,\u6C34:3,\u6728:4,\u91D1:5,\u571F:6}});var Whe,$Qe,qhe,zQe,W2,jQe,BQe,UQe,tE,Yhe=y(()=>{Fv();Dn();Whe=tt(Xt(),1),$Qe=/(?:(?:([同今本])|((昭和|平成|令和)?([0-90-9]{1,4}|元)))年\s*)?([0-90-9]{1,2})月\s*([0-90-9]{1,2})日/i,qhe=1,zQe=2,W2=3,jQe=4,BQe=5,UQe=6,tE=class{pattern(){return $Qe}extract(e,t){let n=parseInt(Na(t[BQe])),i=parseInt(Na(t[UQe])),a=e.createParsingComponents({day:i,month:n});if(t[qhe]&&t[qhe].match("\u540C|\u4ECA|\u672C")){let s=(0,Whe.default)(e.refDate);a.assign("year",s.year())}if(t[zQe]){let s=t[jQe],o=s=="\u5143"?1:parseInt(Na(s));t[W2]=="\u4EE4\u548C"?o+=2018:t[W2]=="\u5E73\u6210"?o+=1988:t[W2]=="\u662D\u548C"&&(o+=1925),a.assign("year",o)}else{let s=dr(e.refDate,i,n);a.imply("year",s)}return a}}});var rE,Ghe=y(()=>{Eo();rE=class extends Jr{patternBetween(){return/^\s*(から|-|ー|-|~|~)\s*$/i}}});function VQe(r){switch(r){case"\u304D\u3087\u3046":return"\u4ECA\u65E5";case"\u307B\u3093\u3058\u3064":return"\u672C\u65E5";case"\u304D\u306E\u3046":return"\u6628\u65E5";case"\u3042\u3057\u305F":return"\u660E\u65E5";case"\u3053\u3093\u3084":return"\u4ECA\u591C";case"\u3053\u3093\u3086\u3046":return"\u4ECA\u5915";case"\u3053\u3093\u3070\u3093":return"\u4ECA\u6669";case"\u3051\u3055":return"\u4ECA\u671D";default:return r}}var Khe,HQe,nE,Zhe=y(()=>{Khe=tt(Xt(),1);Bt();Vs();HQe=/今日|きょう|本日|ほんじつ|昨日|きのう|明日|あした|今夜|こんや|今夕|こんゆう|今晩|こんばん|今朝|けさ/i;nE=class{pattern(){return HQe}extract(e,t){let n=VQe(t[0]),i=(0,Khe.default)(e.refDate),a=e.createParsingComponents();switch(n){case"\u6628\u65E5":return sa(e.reference);case"\u660E\u65E5":return oa(e.reference);case"\u672C\u65E5":case"\u4ECA\u65E5":return Si(e.reference)}return n=="\u4ECA\u591C"||n=="\u4ECA\u5915"||n=="\u4ECA\u6669"?(a.imply("hour",22),a.assign("meridiem",B.PM)):n.match("\u4ECA\u671D")&&(a.imply("hour",6),a.assign("meridiem",B.AM)),a.assign("day",i.date()),a.assign("month",i.month()+1),a.assign("year",i.year()),a}}});var qQe,iE,Qhe=y(()=>{Fv();xl();qQe=new RegExp("((?\u524D\u306E|\u6B21\u306E|\u4ECA\u9031))?(?"+Object.keys(Lv).join("|")+")(?:\u66DC\u65E5|\u66DC)","i"),iE=class{pattern(){return qQe}extract(e,t){let n=t.groups.weekday,i=Lv[n];if(i===void 0)return null;let a=t.groups.prefix||"",s=null;return a.match(/前の/)?s="last":a.match(/次の/)?s="next":a.match(/今週/)&&(s="this"),Kn(e.reference,i,s)}}});var WQe,Jhe,YQe,GQe,aE,Xhe=y(()=>{Dn();Fv();WQe=new RegExp("([0-9\uFF10-\uFF19]{4}[\\/|\\\uFF0F])?([0-1\uFF10-\uFF11]{0,1}[0-9\uFF10-\uFF19]{1})(?:[\\/|\\\uFF0F]([0-3\uFF10-\uFF13]{0,1}[0-9\uFF10-\uFF19]{1}))","i"),Jhe=1,YQe=2,GQe=3,aE=class{pattern(){return WQe}extract(e,t){let n=e.createParsingComponents(),i=parseInt(Na(t[YQe])),a=parseInt(Na(t[GQe]));if(i<1||i>12||a<1||a>31)return null;if(n.assign("day",a),n.assign("month",i),t[Jhe]){let s=parseInt(Na(t[Jhe])),o=rs(s);n.assign("year",o)}else{let s=dr(e.reference.instant,a,i);n.imply("year",s)}return n}}});var KQe,ZQe,mA,fA,Hp,$v,hA,sE,ege=y(()=>{we();Bt();Fv();KQe=new RegExp("(?:(\u5348\u524D|\u5348\u5F8C|A.M.|P.M.|AM|PM))?(?:[\\s,\uFF0C\u3001]*)(?:([0-9\uFF10-\uFF19]+|["+Object.keys(Tc).join("")+"]+)(?:\\s*)(?:\u6642|:|\uFF1A)(?:\\s*)([0-9\uFF10-\uFF19]+|\u534A|["+Object.keys(Tc).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)([0-9\uFF10-\uFF19]+|["+Object.keys(Tc).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),ZQe=new RegExp("(?:^\\s*(?:\u304B\u3089|\\-|\\\u2013|\\\uFF0D|\\~|\\\u301C)\\s*)(?:(\u5348\u524D|\u5348\u5F8C|A.M.|P.M.|AM|PM))?(?:[\\s,\uFF0C\u3001]*)(?:([0-9\uFF10-\uFF19]+|["+Object.keys(Tc).join("")+"]+)(?:\\s*)(?:\u6642|:|\uFF1A)(?:\\s*)([0-9\uFF10-\uFF19]+|\u534A|["+Object.keys(Tc).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)([0-9\uFF10-\uFF19]+|["+Object.keys(Tc).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),mA=1,fA=2,Hp=3,$v=4,hA=5,sE=class extends V{innerPattern(){return KQe}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=e.createParsingResult(t.index,t[0]),i=0,a=0,s=-1;if(t[$v]){let o=parseInt(Na(t[$v]));if(isNaN(o)&&(o=hh(t[$v])),o>=60)return null;n.start.assign("second",o)}if(i=parseInt(Na(t[fA])),isNaN(i)&&(i=hh(t[fA])),t[Hp]?t[Hp]==="\u534A"?a=30:(a=parseInt(Na(t[Hp])),isNaN(a)&&(a=hh(t[Hp]))):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=B.PM),t[mA]){if(i>12)return null;let o=t[mA],l=o[0].toLowerCase();o==="\u5348\u524D"||l==="a"?(s=B.AM,i===12&&(i=0)):(o==="\u5348\u5F8C"||l==="p")&&(s=B.PM,i!=12&&(i+=12))}else if(t[hA]){if(i>12)return null;let o=t[hA][0].toLowerCase();o==="a"&&(s=B.AM,i===12&&(i=0)),o==="p"&&(s=B.PM,i!=12&&(i+=12))}if(n.start.assign("hour",i),n.start.assign("minute",a),s>=0?n.start.assign("meridiem",s):i<12?n.start.imply("meridiem",0):n.start.imply("meridiem",1),t=ZQe.exec(e.text.substring(n.index+n.text.length)),!t)return n.text.match(/^\d+$/)?null:n;if(n.end=e.createParsingComponents(),i=0,a=0,s=-1,t[$v]){let o=parseInt(Na(t[$v]));if(isNaN(o)&&(o=hh(t[$v])),o>=60)return null;n.end.assign("second",o)}if(i=parseInt(Na(t[fA])),isNaN(i)&&(i=hh(t[fA])),t[Hp]?t[Hp]==="\u534A"?a=30:(a=parseInt(Na(t[Hp])),isNaN(a)&&(a=hh(t[Hp]))):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=B.PM),t[mA]){if(i>12)return null;let o=t[mA],l=o[0].toLowerCase();o==="\u5348\u524D"||l==="a"?(s=B.AM,i===12&&(i=0)):(o==="\u5348\u5F8C"||l==="p")&&(s=B.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s===B.AM?(n.start.imply("meridiem",B.AM),n.start.get("hour")===12&&n.start.assign("hour",0)):(n.start.imply("meridiem",1),n.start.get("hour")!=12&&n.start.assign("hour",n.start.get("hour")+12)))}else if(t[hA]){if(i>12)return null;let o=t[hA][0].toLowerCase();o==="a"&&(s=B.AM,i===12&&(i=0)),o==="p"&&(s=B.PM,i!=12&&(i+=12))}return n.text=n.text+t[0],n.end.assign("hour",i),n.end.assign("minute",a),s>=0?n.end.assign("meridiem",s):n.start.isCertain("meridiem")&&n.start.get("hour")>12?n.start.get("hour")-12>i?n.end.imply("meridiem",B.AM):i<=12&&(n.end.assign("hour",i+12),n.end.assign("meridiem",B.PM)):i>12?n.end.imply("meridiem",B.PM):i<=12&&n.end.imply("meridiem",B.AM),n.end.date().getTime(){xo();oE=class extends Xr{patternBetween(){return/^\s*(の)?\s*$/i}}});var lE,rge=y(()=>{mu();lE=class extends ns{mergeResults(e,t,n){let i=t.clone();return i.text=t.text+e+n.text,i.start.assign("weekday",n.start.get("weekday")),i.end&&i.end.assign("weekday",n.start.get("weekday")),i}shouldMergeResults(e,t,n){return t.start.isCertain("day")&&n.start.isOnlyWeekdayComponent()&&!n.start.isCertain("hour")&&e.match(/^[,、の]?\s*$/)!==null}}});var QQe,cE,nge=y(()=>{Fv();xl();QQe=new RegExp("(?:\\(|\\\uFF08)(?"+Object.keys(Lv).join("|")+")(?:\\)|\\\uFF09)","i"),cE=class{pattern(){return QQe}extract(e,t){let n=t.groups.weekday,i=Lv[n];return i===void 0?null:Kn(e.reference,i)}}});var K2={};et(K2,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>Y2,createCasualConfiguration:()=>ige,createConfiguration:()=>G2,parse:()=>XQe,parseDate:()=>eJe,strict:()=>JQe});function XQe(r,e,t){return Y2.parse(r,e,t)}function eJe(r,e,t){return Y2.parseDate(r,e,t)}function ige(){let r=G2(!1);return r.parsers.unshift(new nE),r}function G2(r=!0){let e=ln({parsers:[new tE,new iE,new cE,new aE,new sE],refiners:[new lE,new oE,new rE]},r);return e.refiners=e.refiners.filter(t=>!(t instanceof dh)),e}var Y2,JQe,age=y(()=>{Yhe();Ghe();Zhe();Qhe();Xhe();ege();tge();is();lt();Bt();rge();nge();Hs();w2();Y2=new ze(ige()),JQe=new ze(G2(!0))});function oge(r){if(r.match(/^[0-9]{1,4}$/)){let e=parseInt(r);return e<100&&(e>50?e=e+1900:e=e+2e3),e}return r.match(/a\.?\s*c\.?/i)?(r=r.replace(/a\.?\s*c\.?/i,""),-parseInt(r)):parseInt(r)}var Z2,Q2,sge,gA=y(()=>{Z2={domingo:0,dom:0,segunda:1,"segunda-feira":1,seg:1,ter\u00E7a:2,"ter\xE7a-feira":2,ter:2,quarta:3,"quarta-feira":3,qua:3,quinta:4,"quinta-feira":4,qui:4,sexta:5,"sexta-feira":5,sex:5,s\u00E1bado:6,sabado:6,sab:6},Q2={janeiro:1,jan:1,"jan.":1,fevereiro:2,fev:2,"fev.":2,mar\u00E7o:3,mar:3,"mar.":3,abril:4,abr:4,"abr.":4,maio:5,mai:5,"mai.":5,junho:6,jun:6,"jun.":6,julho:7,jul:7,"jul.":7,agosto:8,ago:8,"ago.":8,setembro:9,set:9,"set.":9,outubro:10,out:10,"out.":10,novembro:11,nov:11,"nov.":11,dezembro:12,dez:12,"dez.":12},sge="[0-9]{1,4}(?![^\\s]\\d)(?:\\s*[a|d]\\.?\\s*c\\.?|\\s*a\\.?\\s*d\\.?)?"});var tJe,rJe,nJe,iJe,dE,lge=y(()=>{gA();At();we();xl();tJe=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(este|esta|passado|pr[o\xF3]ximo)\\s*)?(${oe(Z2)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(este|esta|passado|pr[\xF3o]ximo)\\s*semana)?(?=\\W|\\d|$)`,"i"),rJe=1,nJe=2,iJe=3,dE=class extends V{innerPattern(){return tJe}innerExtract(e,t){let n=t[nJe].toLowerCase(),i=Z2[n];if(i===void 0)return null;let a=t[rJe],s=t[iJe],o=a||s||"";o=o.toLowerCase();let l=null;return o=="passado"?l="this":o=="pr\xF3ximo"||o=="proximo"?l="next":o=="este"&&(l="this"),Kn(e.reference,i,l)}}});var uE,cge=y(()=>{pu();uE=class extends wi{primaryPrefix(){return"(?:(?:ao?|\xE0s?|das|da|de|do)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|a(?:o)?|\\?)\\s*"}}});var pE,dge=y(()=>{xo();pE=class extends Xr{patternBetween(){return new RegExp("^\\s*(?:,|\xE0)?\\s*$")}}});var mE,uge=y(()=>{Eo();mE=class extends Jr{patternBetween(){return/^\s*(?:-)\s*$/i}}});var aJe,pge,mge,sJe,fge,fE,hge=y(()=>{Dn();gA();gA();At();we();aJe=new RegExp(`([0-9]{1,2})(?:\xBA|\xAA|\xB0)?(?:\\s*(?:desde|de|\\-|\\\u2013|ao?|\\s)\\s*([0-9]{1,2})(?:\xBA|\xAA|\xB0)?)?\\s*(?:de)?\\s*(?:-|/|\\s*(?:de|,)?\\s*)(${oe(Q2)})(?:\\s*(?:de|,)?\\s*(${sge}))?(?=\\W|$)`,"i"),pge=1,mge=2,sJe=3,fge=4,fE=class extends V{innerPattern(){return aJe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=Q2[t[sJe].toLowerCase()],a=parseInt(t[pge]);if(a>31)return t.index=t.index+t[pge].length,null;if(n.start.assign("month",i),n.start.assign("day",a),t[fge]){let s=oge(t[fge]);n.start.assign("year",s)}else{let s=dr(e.refDate,a,i);n.start.imply("year",s)}if(t[mge]){let s=parseInt(t[mge]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var hE,gge=y(()=>{we();Vs();hE=class extends V{innerPattern(e){return/(agora|hoje|amanha|amanhã|ontem)(?=\W|$)/i}innerExtract(e,t){let n=t[0].toLowerCase(),i=e.createParsingComponents();switch(n){case"agora":return aa(e.reference);case"hoje":return Si(e.reference);case"amanha":case"amanh\xE3":return oa(e.reference);case"ontem":return sa(e.reference)}return i}}});var yge,gE,vge=y(()=>{Bt();we();Us();yge=tt(Xt(),1),gE=class extends V{innerPattern(){return/(?:esta\s*)?(manha|manhã|tarde|meia-noite|meio-dia|noite)(?=\W|$)/i}innerExtract(e,t){let n=(0,yge.default)(e.refDate),i=e.createParsingComponents();switch(t[1].toLowerCase()){case"tarde":i.imply("meridiem",B.PM),i.imply("hour",15);break;case"noite":i.imply("meridiem",B.PM),i.imply("hour",22);break;case"manha":case"manh\xE3":i.imply("meridiem",B.AM),i.imply("hour",6);break;case"meia-noite":Sl(i,n),i.imply("hour",0),i.imply("minute",0),i.imply("second",0);break;case"meio-dia":i.imply("meridiem",B.AM),i.imply("hour",12);break}return i}}});var eU={};et(eU,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>J2,createCasualConfiguration:()=>bge,createConfiguration:()=>X2,parse:()=>lJe,parseDate:()=>cJe,strict:()=>oJe});function lJe(r,e,t){return J2.parse(r,e,t)}function cJe(r,e,t){return J2.parseDate(r,e,t)}function bge(r=!0){let e=X2(!1,r);return e.parsers.push(new hE),e.parsers.push(new gE),e}function X2(r=!0,e=!0){return ln({parsers:[new oi(e),new dE,new uE,new fE],refiners:[new pE,new mE]},r)}var J2,oJe,Tge=y(()=>{Hs();is();lt();Bt();hu();lge();cge();dge();uge();hge();gge();vge();J2=new ze(bge()),oJe=new ze(X2(!0))});var yE,kge=y(()=>{Eo();yE=class extends Jr{patternBetween(){return/^\s*(tot|-)\s*$/i}}});var vE,wge=y(()=>{xo();vE=class extends Xr{patternBetween(){return new RegExp("^\\s*(om|na|voor|in de|,|-)?\\s*$")}}});var bE,Sge=y(()=>{we();Vs();bE=class extends V{innerPattern(e){return/(nu|vandaag|morgen|morgend|gisteren)(?=\W|$)/i}innerExtract(e,t){let n=t[0].toLowerCase(),i=e.createParsingComponents();switch(n){case"nu":return aa(e.reference);case"vandaag":return Si(e.reference);case"morgen":case"morgend":return oa(e.reference);case"gisteren":return sa(e.reference)}return i}}});var Ege,dJe,uJe,TE,xge=y(()=>{Bt();we();Ege=tt(Xt(),1);Us();dJe=1,uJe=2,TE=class extends V{innerPattern(){return/(deze)?\s*(namiddag|avond|middernacht|ochtend|middag|'s middags|'s avonds|'s ochtends)(?=\W|$)/i}innerExtract(e,t){let n=(0,Ege.default)(e.refDate),i=e.createParsingComponents();switch(t[dJe]==="deze"&&(i.assign("day",e.refDate.getDate()),i.assign("month",e.refDate.getMonth()+1),i.assign("year",e.refDate.getFullYear())),t[uJe].toLowerCase()){case"namiddag":case"'s namiddags":i.imply("meridiem",B.PM),i.imply("hour",15);break;case"avond":case"'s avonds'":i.imply("meridiem",B.PM),i.imply("hour",20);break;case"middernacht":Sl(i,n),i.imply("hour",0),i.imply("minute",0),i.imply("second",0);break;case"ochtend":case"'s ochtends":i.imply("meridiem",B.AM),i.imply("hour",6);break;case"middag":case"'s middags":i.imply("meridiem",B.AM),i.imply("hour",12);break}return i}}});function mJe(r){let e=r.toLowerCase();return tU[e]!==void 0?tU[e]:e==="paar"?2:e==="half"||e.match(/halve?/)?.5:parseFloat(e.replace(",","."))}function aU(r){let e=r.toLowerCase();return rU[e]!==void 0?rU[e]:(e=e.replace(/(?:ste|de)$/i,""),parseInt(e))}function vA(r){if(/voor Christus/i.test(r))return r=r.replace(/voor Christus/i,""),-parseInt(r);if(/na Christus/i.test(r))return r=r.replace(/na Christus/i,""),parseInt(r);let e=parseInt(r);return rs(e)}function Vp(r){let e={},t=r,n=Cge.exec(t);for(;n;)fJe(e,n),t=t.substring(n[0].length),n=Cge.exec(t);return e}function fJe(r,e){let t=mJe(e[1]),n=kE[e[2].toLowerCase()];r[n]=t}var nU,gu,tU,rU,kE,pJe,iU,yA,Dge,Cge,kc,Ws=y(()=>{At();Dn();nU={zondag:0,zon:0,"zon.":0,zo:0,"zo.":0,maandag:1,ma:1,"ma.":1,dinsdag:2,din:2,"din.":2,di:2,"di.":2,woensdag:3,woe:3,"woe.":3,wo:3,"wo.":3,donderdag:4,dond:4,"dond.":4,do:4,"do.":4,vrijdag:5,vrij:5,"vrij.":5,vr:5,"vr.":5,zaterdag:6,zat:6,"zat.":6,za:6,"za.":6},gu={januari:1,jan:1,"jan.":1,februari:2,feb:2,"feb.":2,maart:3,mar:3,"mar.":3,mrt:3,"mrt.":3,april:4,apr:4,"apr.":4,mei:5,juni:6,jun:6,"jun.":6,juli:7,jul:7,"jul.":7,augustus:8,aug:8,"aug.":8,september:9,sep:9,"sep.":9,sept:9,"sept.":9,oktober:10,okt:10,"okt.":10,november:11,nov:11,"nov.":11,december:12,dec:12,"dec.":12},tU={een:1,twee:2,drie:3,vier:4,vijf:5,zes:6,zeven:7,acht:8,negen:9,tien:10,elf:11,twaalf:12},rU={eerste:1,tweede:2,derde:3,vierde:4,vijfde:5,zesde:6,zevende:7,achtste:8,negende:9,tiende:10,elfde:11,twaalfde:12,dertiende:13,veertiende:14,vijftiende:15,zestiende:16,zeventiende:17,achttiende:18,negentiende:19,twintigste:20,eenentwintigste:21,twee\u00EBntwintigste:22,drieentwintigste:23,vierentwintigste:24,vijfentwintigste:25,zesentwintigste:26,zevenentwintigste:27,achtentwintig:28,negenentwintig:29,dertigste:30,eenendertigste:31},kE={sec:"second",second:"second",seconden:"second",min:"minute",mins:"minute",minute:"minute",minuut:"minute",minuten:"minute",minuutje:"minute",h:"hour",hr:"hour",hrs:"hour",uur:"hour",u:"hour",uren:"hour",dag:"d",dagen:"d",week:"week",weken:"week",maand:"month",maanden:"month",jaar:"year",jr:"year",jaren:"year"},pJe=`(?:${oe(tU)}|[0-9]+|[0-9]+[\\.,][0-9]+|halve?|half|paar)`;iU=`(?:${oe(rU)}|[0-9]{1,2}(?:ste|de)?)`;yA="(?:[1-9][0-9]{0,3}\\s*(?:voor Christus|na Christus)|[1-2][0-9]{3}|[5-9][0-9])";Dge=`(${pJe})\\s{0,5}(${oe(kE)})\\s{0,5}`,Cge=new RegExp(Dge,"i"),kc=Ia("(?:(?:binnen|in)\\s*)?",Dge)});var wE,Pge=y(()=>{Ws();lt();we();wE=class extends V{innerPattern(){return new RegExp("(?:binnen|in|binnen de|voor)\\s*("+kc+")(?=\\W|$)","i")}innerExtract(e,t){let n=Vp(t[1]);return ee.createRelativeFromReference(e.reference,n)}}});var hJe,gJe,yJe,vJe,SE,Mge=y(()=>{Ws();At();we();xl();hJe=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:op\\s*?)?(?:(deze|vorige|volgende)\\s*(?:week\\s*)?)?(${oe(nU)})(?=\\W|$)`,"i"),gJe=1,yJe=2,vJe=3,SE=class extends V{innerPattern(){return hJe}innerExtract(e,t){let n=t[yJe].toLowerCase(),i=nU[n],a=t[gJe],s=t[vJe],o=a||s;o=o||"",o=o.toLowerCase();let l=null;return o=="vorige"?l="last":o=="volgende"?l="next":o=="deze"&&(l="this"),Kn(e.reference,i,l)}}});var bJe,TJe,_ge,Age,Ige,EE,Nge=y(()=>{Dn();Ws();Ws();Ws();At();we();bJe=new RegExp(`(?:on\\s*?)?(${iU})(?:\\s*(?:tot|\\-|\\\u2013|until|through|till|\\s)\\s*(${iU}))?(?:-|/|\\s*(?:of)?\\s*)(`+oe(gu)+`)(?:(?:-|/|,?\\s*)(${yA}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),TJe=3,_ge=1,Age=2,Ige=4,EE=class extends V{innerPattern(){return bJe}innerExtract(e,t){let n=gu[t[TJe].toLowerCase()],i=aU(t[_ge]);if(i>31)return t.index=t.index+t[_ge].length,null;let a=e.createParsingComponents({day:i,month:n});if(t[Ige]){let l=vA(t[Ige]);a.assign("year",l)}else{let l=dr(e.refDate,i,n);a.imply("year",l)}if(!t[Age])return a;let s=aU(t[Age]),o=e.createParsingResult(t.index,t[0]);return o.start=a,o.end=a.clone(),o.end.assign("day",s),o}}});var kJe,wJe,Rge,zv,Oge=y(()=>{Ws();Dn();At();Ws();we();kJe=new RegExp(`(${oe(gu)})\\s*(?:[,-]?\\s*(${yA})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),wJe=1,Rge=2,zv=class extends V{innerPattern(){return kJe}innerExtract(e,t){let n=e.createParsingComponents();n.imply("day",1);let i=t[wJe],a=gu[i.toLowerCase()];if(n.assign("month",a),t[Rge]){let s=vA(t[Rge]);n.assign("year",s)}else{let s=dr(e.refDate,1,a);n.imply("year",s)}return n}}});var SJe,EJe,xJe,xE,Lge=y(()=>{we();SJe=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),EJe=1,xJe=2,xE=class extends V{innerPattern(){return SJe}innerExtract(e,t){let n=parseInt(t[xJe]),i=parseInt(t[EJe]);return e.createParsingComponents().imply("day",1).assign("month",i).assign("year",n)}}});var CE,Fge=y(()=>{pu();CE=class extends wi{primaryPrefix(){return"(?:(?:om)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|om|\\?)\\s*"}primarySuffix(){return"(?:\\s*(?:uur))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(e,t){return t[0].match(/^\s*\d{4}\s*$/)?null:super.extractPrimaryTimeComponents(e,t)}}});var CJe,DJe,PJe,$ge,MJe,DE,zge=y(()=>{Ws();At();we();CJe=new RegExp(`([0-9]{4})[\\.\\/\\s](?:(${oe(gu)})|([0-9]{1,2}))[\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),DJe=1,PJe=2,$ge=3,MJe=4,DE=class extends V{innerPattern(){return CJe}innerExtract(e,t){let n=t[$ge]?parseInt(t[$ge]):gu[t[PJe].toLowerCase()];if(n<1||n>12)return null;let i=parseInt(t[DJe]);return{day:parseInt(t[MJe]),month:n,year:i}}}});var jge,_Je,AJe,PE,Bge=y(()=>{we();Bt();Us();jge=tt(Xt(),1),_Je=1,AJe=2,PE=class extends V{innerPattern(e){return/(gisteren|morgen|van)(ochtend|middag|namiddag|avond|nacht)(?=\W|$)/i}innerExtract(e,t){let n=t[_Je].toLowerCase(),i=t[AJe].toLowerCase(),a=e.createParsingComponents(),s=(0,jge.default)(e.refDate);switch(n){case"gisteren":Vr(a,s.add(-1,"day"));break;case"van":Vr(a,s);break;case"morgen":Sl(a,s);break}switch(i){case"ochtend":a.imply("meridiem",B.AM),a.imply("hour",6);break;case"middag":a.imply("meridiem",B.AM),a.imply("hour",12);break;case"namiddag":a.imply("meridiem",B.PM),a.imply("hour",15);break;case"avond":a.imply("meridiem",B.PM),a.imply("hour",20);break}return a}}});var IJe,NJe,RJe,ME,Uge=y(()=>{Ws();lt();we();qs();IJe=new RegExp(`(dit|deze|vorig|afgelopen|(?:aan)?komend|over|\\+|-)e?\\s*(${kc})(?=\\W|$)`,"i"),NJe=1,RJe=2,ME=class extends V{innerPattern(){return IJe}innerExtract(e,t){let n=t[NJe].toLowerCase(),i=Vp(t[RJe]);switch(n){case"vorig":case"afgelopen":case"-":i=Gn(i);break}return ee.createRelativeFromReference(e.reference,i)}}});var Hge,OJe,LJe,FJe,_E,Vge=y(()=>{Ws();lt();Hge=tt(Xt(),1);we();At();OJe=new RegExp(`(dit|deze|(?:aan)?komend|volgend|afgelopen|vorig)e?\\s*(${oe(kE)})(?=\\s*)(?=\\W|$)`,"i"),LJe=1,FJe=2,_E=class extends V{innerPattern(){return OJe}innerExtract(e,t){let n=t[LJe].toLowerCase(),i=t[FJe].toLowerCase(),a=kE[i];if(n=="volgend"||n=="komend"||n=="aankomend"){let l={};return l[a]=1,ee.createRelativeFromReference(e.reference,l)}if(n=="afgelopen"||n=="vorig"){let l={};return l[a]=-1,ee.createRelativeFromReference(e.reference,l)}let s=e.createParsingComponents(),o=(0,Hge.default)(e.reference.instant);return i.match(/week/i)?(o=o.add(-o.get("d"),"d"),s.imply("day",o.date()),s.imply("month",o.month()+1),s.imply("year",o.year())):i.match(/maand/i)?(o=o.add(-o.date()+1,"d"),s.imply("day",o.date()),s.assign("year",o.year()),s.assign("month",o.month()+1)):i.match(/jaar/i)&&(o=o.add(-o.date()+1,"d"),o=o.add(-o.month(),"month"),s.imply("day",o.date()),s.imply("month",o.month()+1),s.assign("year",o.year())),s}}});var $Je,zJe,AE,qge=y(()=>{Ws();lt();we();qs();$Je=new RegExp("("+kc+")(?:geleden|voor|eerder)(?=(?:\\W|$))","i"),zJe=new RegExp("("+kc+")geleden(?=(?:\\W|$))","i"),AE=class extends V{constructor(t){super();A(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?zJe:$Je}innerExtract(t,n){let i=Vp(n[1]),a=Gn(i);return ee.createRelativeFromReference(t.reference,a)}}});var jJe,BJe,UJe,IE,Wge=y(()=>{Ws();lt();we();jJe=new RegExp("("+kc+")(later|na|vanaf nu|voortaan|vooruit|uit)(?=(?:\\W|$))","i"),BJe=new RegExp("("+kc+")(later|vanaf nu)(?=(?:\\W|$))","i"),UJe=1,IE=class extends V{constructor(t){super();A(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?BJe:jJe}innerExtract(t,n){let i=Vp(n[UJe]);return ee.createRelativeFromReference(t.reference,i)}}});var lU={};et(lU,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>sU,createCasualConfiguration:()=>Yge,createConfiguration:()=>oU,parse:()=>VJe,parseDate:()=>qJe,strict:()=>HJe});function VJe(r,e,t){return sU.parse(r,e,t)}function qJe(r,e,t){return sU.parseDate(r,e,t)}function Yge(r=!0){let e=oU(!1,r);return e.parsers.unshift(new bE),e.parsers.unshift(new TE),e.parsers.unshift(new PE),e.parsers.unshift(new zv),e.parsers.unshift(new _E),e.parsers.unshift(new ME),e}function oU(r=!0,e=!0){return ln({parsers:[new oi(e),new wE,new EE,new zv,new SE,new DE,new xE,new CE(r),new AE(r),new IE(r)],refiners:[new vE,new yE]},r)}var sU,HJe,Gge=y(()=>{Hs();is();lt();Bt();kge();wge();Sge();xge();hu();Pge();Mge();Nge();Oge();Lge();Fge();zge();Bge();Uge();Vge();qge();Wge();sU=new ze(Yge()),HJe=new ze(oU(!0))});function Do(r){let e=0;for(let t=0;t{Ei={\u96F6:0,"\u3007":0,\u4E00:1,\u4E8C:2,\u4E24:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6,\u4E03:7,\u516B:8,\u4E5D:9,\u5341:10},jv={\u5929:0,\u65E5:0,\u4E00:1,\u4E8C:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6}});var Qge,cU,Zge,dU,gh,uU=y(()=>{Qge=tt(Xt(),1);we();Bv();cU=1,Zge=2,dU=3,gh=class extends V{innerPattern(){return new RegExp("(\\d{2,4}|["+Object.keys(Ei).join("")+"]{4}|["+Object.keys(Ei).join("")+"]{2})?(?:\\s*)(?:\u5E74)?(?:[\\s|,|\uFF0C]*)(\\d{1,2}|["+Object.keys(Ei).join("")+"]{1,3})(?:\\s*)(?:\u6708)(?:\\s*)(\\d{1,2}|["+Object.keys(Ei).join("")+"]{1,3})?(?:\\s*)(?:\u65E5|\u53F7)?")}innerExtract(e,t){let n=(0,Qge.default)(e.refDate),i=e.createParsingResult(t.index,t[0]),a=parseInt(t[Zge]);if(isNaN(a)&&(a=Do(t[Zge])),i.start.assign("month",a),t[dU]){let s=parseInt(t[dU]);isNaN(s)&&(s=Do(t[dU])),i.start.assign("day",s)}else i.start.imply("day",n.date());if(t[cU]){let s=parseInt(t[cU]);isNaN(s)&&(s=Kge(t[cU])),i.start.assign("year",s)}else i.start.imply("year",n.year());return i}}});var Jge,WJe,pU,YJe,yh,mU=y(()=>{Jge=tt(Xt(),1);we();Bv();WJe=new RegExp("(\\d+|["+Object.keys(Ei).join("")+"]+|\u534A|\u51E0)(?:\\s*)(?:\u4E2A)?(\u79D2(?:\u949F)?|\u5206\u949F|\u5C0F\u65F6|\u949F|\u65E5|\u5929|\u661F\u671F|\u793C\u62DC|\u6708|\u5E74)(?:(?:\u4E4B|\u8FC7)?\u540E|(?:\u4E4B)?\u5185)","i"),pU=1,YJe=2,yh=class extends V{innerPattern(){return WJe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=parseInt(t[pU]);if(isNaN(i)&&(i=Do(t[pU])),isNaN(i)){let l=t[pU];if(l==="\u51E0")i=3;else if(l==="\u534A")i=.5;else return null}let a=(0,Jge.default)(e.refDate),o=t[YJe][0];return o.match(/[日天星礼月年]/)?(o=="\u65E5"||o=="\u5929"?a=a.add(i,"d"):o=="\u661F"||o=="\u793C"?a=a.add(i*7,"d"):o=="\u6708"?a=a.add(i,"month"):o=="\u5E74"&&(a=a.add(i,"year")),n.start.assign("year",a.year()),n.start.assign("month",a.month()+1),n.start.assign("day",a.date()),n):(o=="\u79D2"?a=a.add(i,"second"):o=="\u5206"?a=a.add(i,"minute"):(o=="\u5C0F"||o=="\u949F")&&(a=a.add(i,"hour")),n.start.imply("year",a.year()),n.start.imply("month",a.month()+1),n.start.imply("day",a.date()),n.start.assign("hour",a.hour()),n.start.assign("minute",a.minute()),n.start.assign("second",a.second()),n)}}});var Xge,GJe,vh,fU=y(()=>{Xge=tt(Xt(),1);we();Bv();GJe=new RegExp("(?\u4E0A|\u4E0B|\u8FD9)(?:\u4E2A)?(?:\u661F\u671F|\u793C\u62DC|\u5468)(?"+Object.keys(jv).join("|")+")"),vh=class extends V{innerPattern(){return GJe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,a=jv[i];if(a===void 0)return null;let s=null,o=t.groups.prefix;o=="\u4E0A"?s="last":o=="\u4E0B"?s="next":o=="\u8FD9"&&(s="this");let l=(0,Xge.default)(e.refDate),c=!1,d=l.day();return s=="last"||s=="past"?(l=l.day(a-7),c=!0):s=="next"?(l=l.day(a+7),c=!0):s=="this"?l=l.day(a):Math.abs(a-7-d){eye=tt(Xt(),1);we();Bv();KJe=new RegExp("(?:\u4ECE|\u81EA)?(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(Ei).join("")+"]+)(?:\\s*)(?:\u70B9|\u65F6|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(Ei).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(Ei).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),ZJe=new RegExp("(?:^\\s*(?:\u5230|\u81F3|\\-|\\\u2013|\\~|\\\u301C)\\s*)(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(Ei).join("")+"]+)(?:\\s*)(?:\u70B9|\u65F6|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(Ei).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(Ei).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),bA=1,TA=2,kA=3,wA=4,SA=5,EA=6,Po=7,Uv=8,xA=9,bh=class extends V{innerPattern(){return KJe}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=(0,eye.default)(e.refDate),i=e.createParsingResult(t.index,t[0]),a=n.clone();if(t[bA]){let d=t[bA];d=="\u660E"?n.hour()>1&&(a=a.add(1,"day")):d=="\u6628"?a=a.add(-1,"day"):d=="\u524D"?a=a.add(-2,"day"):d=="\u5927\u524D"?a=a.add(-3,"day"):d=="\u540E"?a=a.add(2,"day"):d=="\u5927\u540E"&&(a=a.add(3,"day")),i.start.assign("day",a.date()),i.start.assign("month",a.month()+1),i.start.assign("year",a.year())}else if(t[wA]){let d=t[wA];d=="\u660E"?a=a.add(1,"day"):d=="\u6628"?a=a.add(-1,"day"):d=="\u524D"?a=a.add(-2,"day"):d=="\u5927\u524D"?a=a.add(-3,"day"):d=="\u540E"?a=a.add(2,"day"):d=="\u5927\u540E"&&(a=a.add(3,"day")),i.start.assign("day",a.date()),i.start.assign("month",a.month()+1),i.start.assign("year",a.year())}else i.start.imply("day",a.date()),i.start.imply("month",a.month()+1),i.start.imply("year",a.year());let s=0,o=0,l=-1;if(t[Uv]){let d=parseInt(t[Uv]);if(isNaN(d)&&(d=Do(t[Uv])),d>=60)return null;i.start.assign("second",d)}if(s=parseInt(t[EA]),isNaN(s)&&(s=Do(t[EA])),t[Po]?t[Po]=="\u534A"?o=30:t[Po]=="\u6B63"||t[Po]=="\u6574"?o=0:(o=parseInt(t[Po]),isNaN(o)&&(o=Do(t[Po]))):s>100&&(o=s%100,s=Math.floor(s/100)),o>=60||s>24)return null;if(s>=12&&(l=1),t[xA]){if(s>12)return null;let d=t[xA][0].toLowerCase();d=="a"&&(l=0,s==12&&(s=0)),d=="p"&&(l=1,s!=12&&(s+=12))}else if(t[TA]){let u=t[TA][0];u=="\u65E9"?(l=0,s==12&&(s=0)):u=="\u665A"&&(l=1,s!=12&&(s+=12))}else if(t[kA]){let u=t[kA][0];u=="\u4E0A"||u=="\u65E9"||u=="\u51CC"?(l=0,s==12&&(s=0)):(u=="\u4E0B"||u=="\u665A")&&(l=1,s!=12&&(s+=12))}else if(t[SA]){let u=t[SA][0];u=="\u4E0A"||u=="\u65E9"||u=="\u51CC"?(l=0,s==12&&(s=0)):(u=="\u4E0B"||u=="\u665A")&&(l=1,s!=12&&(s+=12))}if(i.start.assign("hour",s),i.start.assign("minute",o),l>=0?i.start.assign("meridiem",l):s<12?i.start.imply("meridiem",0):i.start.imply("meridiem",1),t=ZJe.exec(e.text.substring(i.index+i.text.length)),!t)return i.text.match(/^\d+$/)?null:i;let c=a.clone();if(i.end=e.createParsingComponents(),t[bA]){let d=t[bA];d=="\u660E"?n.hour()>1&&(c=c.add(1,"day")):d=="\u6628"?c=c.add(-1,"day"):d=="\u524D"?c=c.add(-2,"day"):d=="\u5927\u524D"?c=c.add(-3,"day"):d=="\u540E"?c=c.add(2,"day"):d=="\u5927\u540E"&&(c=c.add(3,"day")),i.end.assign("day",c.date()),i.end.assign("month",c.month()+1),i.end.assign("year",c.year())}else if(t[wA]){let d=t[wA];d=="\u660E"?c=c.add(1,"day"):d=="\u6628"?c=c.add(-1,"day"):d=="\u524D"?c=c.add(-2,"day"):d=="\u5927\u524D"?c=c.add(-3,"day"):d=="\u540E"?c=c.add(2,"day"):d=="\u5927\u540E"&&(c=c.add(3,"day")),i.end.assign("day",c.date()),i.end.assign("month",c.month()+1),i.end.assign("year",c.year())}else i.end.imply("day",c.date()),i.end.imply("month",c.month()+1),i.end.imply("year",c.year());if(s=0,o=0,l=-1,t[Uv]){let d=parseInt(t[Uv]);if(isNaN(d)&&(d=Do(t[Uv])),d>=60)return null;i.end.assign("second",d)}if(s=parseInt(t[EA]),isNaN(s)&&(s=Do(t[EA])),t[Po]?t[Po]=="\u534A"?o=30:t[Po]=="\u6B63"||t[Po]=="\u6574"?o=0:(o=parseInt(t[Po]),isNaN(o)&&(o=Do(t[Po]))):s>100&&(o=s%100,s=Math.floor(s/100)),o>=60||s>24)return null;if(s>=12&&(l=1),t[xA]){if(s>12)return null;let d=t[xA][0].toLowerCase();d=="a"&&(l=0,s==12&&(s=0)),d=="p"&&(l=1,s!=12&&(s+=12)),i.start.isCertain("meridiem")||(l==0?(i.start.imply("meridiem",0),i.start.get("hour")==12&&i.start.assign("hour",0)):(i.start.imply("meridiem",1),i.start.get("hour")!=12&&i.start.assign("hour",i.start.get("hour")+12)))}else if(t[TA]){let u=t[TA][0];u=="\u65E9"?(l=0,s==12&&(s=0)):u=="\u665A"&&(l=1,s!=12&&(s+=12))}else if(t[kA]){let u=t[kA][0];u=="\u4E0A"||u=="\u65E9"||u=="\u51CC"?(l=0,s==12&&(s=0)):(u=="\u4E0B"||u=="\u665A")&&(l=1,s!=12&&(s+=12))}else if(t[SA]){let u=t[SA][0];u=="\u4E0A"||u=="\u65E9"||u=="\u51CC"?(l=0,s==12&&(s=0)):(u=="\u4E0B"||u=="\u665A")&&(l=1,s!=12&&(s+=12))}return i.text=i.text+t[0],i.end.assign("hour",s),i.end.assign("minute",o),l>=0?i.end.assign("meridiem",l):i.start.isCertain("meridiem")&&i.start.get("meridiem")==1&&i.start.get("hour")>s?i.end.imply("meridiem",0):s>12&&i.end.imply("meridiem",1),i.end.date().getTime(){tye=tt(Xt(),1);we();Bv();QJe=new RegExp("(?:\u661F\u671F|\u793C\u62DC|\u5468)(?"+Object.keys(jv).join("|")+")"),Th=class extends V{innerPattern(){return QJe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,a=jv[i];if(a===void 0)return null;let s=(0,tye.default)(e.refDate),o=!1,l=s.day();return Math.abs(a-7-l){aye=tt(Xt(),1);we();JJe=1,rye=2,XJe=3,nye=4,iye=5,eXe=6,kh=class extends V{innerPattern(e){return new RegExp("(\u800C\u5BB6|\u7ACB(?:\u523B|\u5373)|\u5373\u523B)|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s|,|\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?","i")}innerExtract(e,t){let n=t.index,i=e.createParsingResult(n,t[0]),a=(0,aye.default)(e.refDate),s=a;if(t[JJe])i.start.imply("hour",a.hour()),i.start.imply("minute",a.minute()),i.start.imply("second",a.second()),i.start.imply("millisecond",a.millisecond());else if(t[rye]){let o=t[rye],l=t[XJe];o=="\u660E"||o=="\u807D"?a.hour()>1&&(s=s.add(1,"day")):o=="\u6628"||o=="\u5C0B"||o=="\u7434"?s=s.add(-1,"day"):o=="\u524D"?s=s.add(-2,"day"):o=="\u5927\u524D"?s=s.add(-3,"day"):o=="\u5F8C"?s=s.add(2,"day"):o=="\u5927\u5F8C"&&(s=s.add(3,"day")),l=="\u65E9"||l=="\u671D"?i.start.imply("hour",6):l=="\u665A"&&(i.start.imply("hour",22),i.start.imply("meridiem",1))}else if(t[nye]){let l=t[nye][0];l=="\u65E9"||l=="\u671D"||l=="\u4E0A"?i.start.imply("hour",6):l=="\u4E0B"||l=="\u664F"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):l=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):l=="\u591C"||l=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):l=="\u51CC"&&i.start.imply("hour",0)}else if(t[iye]){let o=t[iye];o=="\u660E"||o=="\u807D"?a.hour()>1&&(s=s.add(1,"day")):o=="\u6628"||o=="\u5C0B"||o=="\u7434"?s=s.add(-1,"day"):o=="\u524D"?s=s.add(-2,"day"):o=="\u5927\u524D"?s=s.add(-3,"day"):o=="\u5F8C"?s=s.add(2,"day"):o=="\u5927\u5F8C"&&(s=s.add(3,"day"));let l=t[eXe];if(l){let c=l[0];c=="\u65E9"||c=="\u671D"||c=="\u4E0A"?i.start.imply("hour",6):c=="\u4E0B"||c=="\u664F"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):c=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):c=="\u591C"||c=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):c=="\u51CC"&&i.start.imply("hour",0)}}return i.start.assign("day",s.date()),i.start.assign("month",s.month()+1),i.start.assign("year",s.year()),i}}});function Mo(r){let e=0;for(let t=0;t{xi={\u96F6:0,\u4E00:1,\u4E8C:2,\u5169:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6,\u4E03:7,\u516B:8,\u4E5D:9,\u5341:10,\u5EFF:20,\u5345:30},Hv={\u5929:0,\u65E5:0,\u4E00:1,\u4E8C:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6}});var lye,vU,oye,bU,wh,TU=y(()=>{lye=tt(Xt(),1);we();Vv();vU=1,oye=2,bU=3,wh=class extends V{innerPattern(){return new RegExp("(\\d{2,4}|["+Object.keys(xi).join("")+"]{4}|["+Object.keys(xi).join("")+"]{2})?(?:\\s*)(?:\u5E74)?(?:[\\s|,|\uFF0C]*)(\\d{1,2}|["+Object.keys(xi).join("")+"]{1,2})(?:\\s*)(?:\u6708)(?:\\s*)(\\d{1,2}|["+Object.keys(xi).join("")+"]{1,2})?(?:\\s*)(?:\u65E5|\u865F)?")}innerExtract(e,t){let n=(0,lye.default)(e.refDate),i=e.createParsingResult(t.index,t[0]),a=parseInt(t[oye]);if(isNaN(a)&&(a=Mo(t[oye])),i.start.assign("month",a),t[bU]){let s=parseInt(t[bU]);isNaN(s)&&(s=Mo(t[bU])),i.start.assign("day",s)}else i.start.imply("day",n.date());if(t[vU]){let s=parseInt(t[vU]);isNaN(s)&&(s=sye(t[vU])),i.start.assign("year",s)}else i.start.imply("year",n.year());return i}}});var cye,tXe,kU,rXe,Sh,wU=y(()=>{cye=tt(Xt(),1);we();Vv();tXe=new RegExp("(\\d+|["+Object.keys(xi).join("")+"]+|\u534A|\u5E7E)(?:\\s*)(?:\u500B)?(\u79D2(?:\u9418)?|\u5206\u9418|\u5C0F\u6642|\u9418|\u65E5|\u5929|\u661F\u671F|\u79AE\u62DC|\u6708|\u5E74)(?:(?:\u4E4B|\u904E)?\u5F8C|(?:\u4E4B)?\u5167)","i"),kU=1,rXe=2,Sh=class extends V{innerPattern(){return tXe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=parseInt(t[kU]);if(isNaN(i)&&(i=Mo(t[kU])),isNaN(i)){let l=t[kU];if(l==="\u5E7E")i=3;else if(l==="\u534A")i=.5;else return null}let a=(0,cye.default)(e.refDate),o=t[rXe][0];return o.match(/[日天星禮月年]/)?(o=="\u65E5"||o=="\u5929"?a=a.add(i,"d"):o=="\u661F"||o=="\u79AE"?a=a.add(i*7,"d"):o=="\u6708"?a=a.add(i,"month"):o=="\u5E74"&&(a=a.add(i,"year")),n.start.assign("year",a.year()),n.start.assign("month",a.month()+1),n.start.assign("day",a.date()),n):(o=="\u79D2"?a=a.add(i,"second"):o=="\u5206"?a=a.add(i,"minute"):(o=="\u5C0F"||o=="\u9418")&&(a=a.add(i,"hour")),n.start.imply("year",a.year()),n.start.imply("month",a.month()+1),n.start.imply("day",a.date()),n.start.assign("hour",a.hour()),n.start.assign("minute",a.minute()),n.start.assign("second",a.second()),n)}}});var dye,nXe,Eh,SU=y(()=>{dye=tt(Xt(),1);we();Vv();nXe=new RegExp("(?\u4E0A|\u4ECA|\u4E0B|\u9019|\u5462)(?:\u500B)?(?:\u661F\u671F|\u79AE\u62DC|\u9031)(?"+Object.keys(Hv).join("|")+")"),Eh=class extends V{innerPattern(){return nXe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,a=Hv[i];if(a===void 0)return null;let s=null,o=t.groups.prefix;o=="\u4E0A"?s="last":o=="\u4E0B"?s="next":(o=="\u4ECA"||o=="\u9019"||o=="\u5462")&&(s="this");let l=(0,dye.default)(e.refDate),c=!1,d=l.day();return s=="last"||s=="past"?(l=l.day(a-7),c=!0):s=="next"?(l=l.day(a+7),c=!0):s=="this"?l=l.day(a):Math.abs(a-7-d){uye=tt(Xt(),1);we();Vv();iXe=new RegExp("(?:\u7531|\u5F9E|\u81EA)?(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(xi).join("")+"]+)(?:\\s*)(?:\u9EDE|\u6642|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(xi).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(xi).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),aXe=new RegExp("(?:^\\s*(?:\u5230|\u81F3|\\-|\\\u2013|\\~|\\\u301C)\\s*)(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(xi).join("")+"]+)(?:\\s*)(?:\u9EDE|\u6642|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(xi).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(xi).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),CA=1,DA=2,PA=3,MA=4,_A=5,AA=6,_o=7,qv=8,IA=9,xh=class extends V{innerPattern(){return iXe}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=(0,uye.default)(e.refDate),i=e.createParsingResult(t.index,t[0]),a=n.clone();if(t[CA]){var s=t[CA];s=="\u660E"||s=="\u807D"?n.hour()>1&&(a=a.add(1,"day")):s=="\u6628"||s=="\u5C0B"||s=="\u7434"?a=a.add(-1,"day"):s=="\u524D"?a=a.add(-2,"day"):s=="\u5927\u524D"?a=a.add(-3,"day"):s=="\u5F8C"?a=a.add(2,"day"):s=="\u5927\u5F8C"&&(a=a.add(3,"day")),i.start.assign("day",a.date()),i.start.assign("month",a.month()+1),i.start.assign("year",a.year())}else if(t[MA]){var o=t[MA];o=="\u660E"||o=="\u807D"?a=a.add(1,"day"):o=="\u6628"||o=="\u5C0B"||o=="\u7434"?a=a.add(-1,"day"):o=="\u524D"?a=a.add(-2,"day"):o=="\u5927\u524D"?a=a.add(-3,"day"):o=="\u5F8C"?a=a.add(2,"day"):o=="\u5927\u5F8C"&&(a=a.add(3,"day")),i.start.assign("day",a.date()),i.start.assign("month",a.month()+1),i.start.assign("year",a.year())}else i.start.imply("day",a.date()),i.start.imply("month",a.month()+1),i.start.imply("year",a.year());let l=0,c=0,d=-1;if(t[qv]){var u=parseInt(t[qv]);if(isNaN(u)&&(u=Mo(t[qv])),u>=60)return null;i.start.assign("second",u)}if(l=parseInt(t[AA]),isNaN(l)&&(l=Mo(t[AA])),t[_o]?t[_o]=="\u534A"?c=30:t[_o]=="\u6B63"||t[_o]=="\u6574"?c=0:(c=parseInt(t[_o]),isNaN(c)&&(c=Mo(t[_o]))):l>100&&(c=l%100,l=Math.floor(l/100)),c>=60||l>24)return null;if(l>=12&&(d=1),t[IA]){if(l>12)return null;var p=t[IA][0].toLowerCase();p=="a"&&(d=0,l==12&&(l=0)),p=="p"&&(d=1,l!=12&&(l+=12))}else if(t[DA]){var m=t[DA],f=m[0];f=="\u671D"||f=="\u65E9"?(d=0,l==12&&(l=0)):f=="\u665A"&&(d=1,l!=12&&(l+=12))}else if(t[PA]){var h=t[PA],g=h[0];g=="\u4E0A"||g=="\u671D"||g=="\u65E9"||g=="\u51CC"?(d=0,l==12&&(l=0)):(g=="\u4E0B"||g=="\u664F"||g=="\u665A")&&(d=1,l!=12&&(l+=12))}else if(t[_A]){var v=t[_A],k=v[0];k=="\u4E0A"||k=="\u671D"||k=="\u65E9"||k=="\u51CC"?(d=0,l==12&&(l=0)):(k=="\u4E0B"||k=="\u664F"||k=="\u665A")&&(d=1,l!=12&&(l+=12))}if(i.start.assign("hour",l),i.start.assign("minute",c),d>=0?i.start.assign("meridiem",d):l<12?i.start.imply("meridiem",0):i.start.imply("meridiem",1),t=aXe.exec(e.text.substring(i.index+i.text.length)),!t)return i.text.match(/^\d+$/)?null:i;let b=a.clone();if(i.end=e.createParsingComponents(),t[CA]){var s=t[CA];s=="\u660E"||s=="\u807D"?n.hour()>1&&(b=b.add(1,"day")):s=="\u6628"||s=="\u5C0B"||s=="\u7434"?b=b.add(-1,"day"):s=="\u524D"?b=b.add(-2,"day"):s=="\u5927\u524D"?b=b.add(-3,"day"):s=="\u5F8C"?b=b.add(2,"day"):s=="\u5927\u5F8C"&&(b=b.add(3,"day")),i.end.assign("day",b.date()),i.end.assign("month",b.month()+1),i.end.assign("year",b.year())}else if(t[MA]){var o=t[MA];o=="\u660E"||o=="\u807D"?b=b.add(1,"day"):o=="\u6628"||o=="\u5C0B"||o=="\u7434"?b=b.add(-1,"day"):o=="\u524D"?b=b.add(-2,"day"):o=="\u5927\u524D"?b=b.add(-3,"day"):o=="\u5F8C"?b=b.add(2,"day"):o=="\u5927\u5F8C"&&(b=b.add(3,"day")),i.end.assign("day",b.date()),i.end.assign("month",b.month()+1),i.end.assign("year",b.year())}else i.end.imply("day",b.date()),i.end.imply("month",b.month()+1),i.end.imply("year",b.year());if(l=0,c=0,d=-1,t[qv]){var u=parseInt(t[qv]);if(isNaN(u)&&(u=Mo(t[qv])),u>=60)return null;i.end.assign("second",u)}if(l=parseInt(t[AA]),isNaN(l)&&(l=Mo(t[AA])),t[_o]?t[_o]=="\u534A"?c=30:t[_o]=="\u6B63"||t[_o]=="\u6574"?c=0:(c=parseInt(t[_o]),isNaN(c)&&(c=Mo(t[_o]))):l>100&&(c=l%100,l=Math.floor(l/100)),c>=60||l>24)return null;if(l>=12&&(d=1),t[IA]){if(l>12)return null;var p=t[IA][0].toLowerCase();p=="a"&&(d=0,l==12&&(l=0)),p=="p"&&(d=1,l!=12&&(l+=12)),i.start.isCertain("meridiem")||(d==0?(i.start.imply("meridiem",0),i.start.get("hour")==12&&i.start.assign("hour",0)):(i.start.imply("meridiem",1),i.start.get("hour")!=12&&i.start.assign("hour",i.start.get("hour")+12)))}else if(t[DA]){var m=t[DA],f=m[0];f=="\u671D"||f=="\u65E9"?(d=0,l==12&&(l=0)):f=="\u665A"&&(d=1,l!=12&&(l+=12))}else if(t[PA]){var h=t[PA],g=h[0];g=="\u4E0A"||g=="\u671D"||g=="\u65E9"||g=="\u51CC"?(d=0,l==12&&(l=0)):(g=="\u4E0B"||g=="\u664F"||g=="\u665A")&&(d=1,l!=12&&(l+=12))}else if(t[_A]){var v=t[_A],k=v[0];k=="\u4E0A"||k=="\u671D"||k=="\u65E9"||k=="\u51CC"?(d=0,l==12&&(l=0)):(k=="\u4E0B"||k=="\u664F"||k=="\u665A")&&(d=1,l!=12&&(l+=12))}return i.text=i.text+t[0],i.end.assign("hour",l),i.end.assign("minute",c),d>=0?i.end.assign("meridiem",d):i.start.isCertain("meridiem")&&i.start.get("meridiem")==1&&i.start.get("hour")>l?i.end.imply("meridiem",0):l>12&&i.end.imply("meridiem",1),i.end.date().getTime(){pye=tt(Xt(),1);we();Vv();sXe=new RegExp("(?:\u661F\u671F|\u79AE\u62DC|\u9031)(?"+Object.keys(Hv).join("|")+")"),Ch=class extends V{innerPattern(){return sXe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,a=Hv[i];if(a===void 0)return null;let s=(0,pye.default)(e.refDate),o=!1,l=s.day();return Math.abs(a-7-l){Eo();Dh=class extends Jr{patternBetween(){return/^\s*(至|到|\-|\~|~|-|ー)\s*$/i}}});var Ph,DU=y(()=>{xo();Ph=class extends Xr{patternBetween(){return/^\s*$/i}}});var NA={};et(NA,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>PU,createCasualConfiguration:()=>MU,createConfiguration:()=>_U,hant:()=>oXe,parse:()=>cXe,parseDate:()=>dXe,strict:()=>lXe});function cXe(r,e,t){return PU.parse(r,e,t)}function dXe(r,e,t){return PU.parseDate(r,e,t)}function MU(){let r=_U();return r.parsers.unshift(new kh),r}function _U(){let r=ln({parsers:[new wh,new Eh,new Ch,new xh,new Sh],refiners:[new Dh,new Ph]});return r.refiners=r.refiners.filter(e=>!(e instanceof El)),r}var oXe,PU,lXe,mye=y(()=>{bS();Hs();is();lt();Bt();yU();TU();wU();SU();EU();xU();CU();DU();oXe=new ze(MU()),PU=new ze(MU()),lXe=new ze(_U())});var yye,uXe,fye,pXe,hye,gye,mXe,NE,vye=y(()=>{yye=tt(Xt(),1);we();uXe=1,fye=2,pXe=3,hye=4,gye=5,mXe=6,NE=class extends V{innerPattern(e){return new RegExp("(\u73B0\u5728|\u7ACB(?:\u523B|\u5373)|\u5373\u523B)|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s|,|\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?","i")}innerExtract(e,t){let n=t.index,i=e.createParsingResult(n,t[0]),a=(0,yye.default)(e.refDate),s=a;if(t[uXe])i.start.imply("hour",a.hour()),i.start.imply("minute",a.minute()),i.start.imply("second",a.second()),i.start.imply("millisecond",a.millisecond());else if(t[fye]){let o=t[fye],l=t[pXe];o=="\u660E"?a.hour()>1&&(s=s.add(1,"day")):o=="\u6628"?s=s.add(-1,"day"):o=="\u524D"?s=s.add(-2,"day"):o=="\u5927\u524D"?s=s.add(-3,"day"):o=="\u540E"?s=s.add(2,"day"):o=="\u5927\u540E"&&(s=s.add(3,"day")),l=="\u65E9"?i.start.imply("hour",6):l=="\u665A"&&(i.start.imply("hour",22),i.start.imply("meridiem",1))}else if(t[hye]){let l=t[hye][0];l=="\u65E9"||l=="\u4E0A"?i.start.imply("hour",6):l=="\u4E0B"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):l=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):l=="\u591C"||l=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):l=="\u51CC"&&i.start.imply("hour",0)}else if(t[gye]){let o=t[gye];o=="\u660E"?a.hour()>1&&(s=s.add(1,"day")):o=="\u6628"?s=s.add(-1,"day"):o=="\u524D"?s=s.add(-2,"day"):o=="\u5927\u524D"?s=s.add(-3,"day"):o=="\u540E"?s=s.add(2,"day"):o=="\u5927\u540E"&&(s=s.add(3,"day"));let l=t[mXe];if(l){let c=l[0];c=="\u65E9"||c=="\u4E0A"?i.start.imply("hour",6):c=="\u4E0B"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):c=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):c=="\u591C"||c=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):c=="\u51CC"&&i.start.imply("hour",0)}}return i.start.assign("day",s.date()),i.start.assign("month",s.month()+1),i.start.assign("year",s.year()),i}}});var RE,bye=y(()=>{Eo();RE=class extends Jr{patternBetween(){return/^\s*(至|到|-|~|~|-|ー)\s*$/i}}});var OE,Tye=y(()=>{xo();OE=class extends Xr{patternBetween(){return/^\s*$/i}}});var RA={};et(RA,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>AU,createCasualConfiguration:()=>IU,createConfiguration:()=>NU,hans:()=>fXe,parse:()=>gXe,parseDate:()=>yXe,strict:()=>hXe});function gXe(r,e,t){return AU.parse(r,e,t)}function yXe(r,e,t){return AU.parseDate(r,e,t)}function IU(){let r=NU();return r.parsers.unshift(new NE),r}function NU(){let r=ln({parsers:[new gh,new vh,new Th,new bh,new yh],refiners:[new RE,new OE]});return r.refiners=r.refiners.filter(e=>!(e instanceof El)),r}var fXe,AU,hXe,kye=y(()=>{bS();Hs();is();lt();Bt();vye();uU();mU();fU();hU();gU();bye();Tye();fXe=new ze(IU()),AU=new ze(IU()),hXe=new ze(NU())});var LU={};et(LU,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>RU,createCasualConfiguration:()=>wye,createConfiguration:()=>OU,hans:()=>RA,hant:()=>NA,parse:()=>bXe,parseDate:()=>TXe,strict:()=>vXe});function bXe(r,e,t){return RU.parse(r,e,t)}function TXe(r,e,t){return RU.parseDate(r,e,t)}function wye(){let r=OU();return r.parsers.unshift(new kh),r}function OU(){let r=ln({parsers:[new wh,new gh,new Eh,new vh,new Ch,new Th,new xh,new bh,new Sh,new yh],refiners:[new Dh,new Ph]});return r.refiners=r.refiners.filter(e=>!(e instanceof El)),r}var RU,vXe,Sye=y(()=>{Hs();is();lt();Bt();bS();uU();mU();fU();hU();gU();yU();TU();wU();SU();EU();xU();CU();DU();mye();kye();RU=new ze(wye()),vXe=new ze(OU())});function wXe(r){let e=r.toLowerCase();return $U[e]!==void 0?$U[e]:e.match(/несколько/)?3:e.match(/пол/)?.5:e.match(/пар/)?2:e===""?1:parseFloat(e)}function HU(r){let e=r.toLowerCase();return zU[e]!==void 0?zU[e]:parseInt(e)}function LA(r){if(/(год|года|г|г.)/i.test(r)&&(r=r.replace(/(год|года|г|г.)/i,"")),/(до н.э.|до н. э.)/i.test(r))return r=r.replace(/(до н.э.|до н. э.)/i,""),-parseInt(r);if(/(н. э.|н.э.)/i.test(r))return r=r.replace(/(н. э.|н.э.)/i,""),parseInt(r);let e=parseInt(r);return rs(e)}function Gv(r){let e={},t=r,n=Eye.exec(t);for(;n;)SXe(e,n),t=t.substring(n[0].length).trim(),n=Eye.exec(t);return e}function SXe(r,e){let t=wXe(e[1]),n=LE[e[2].toLowerCase()];r[n]=t}var Ys,jU,BU,Wv,$U,zU,LE,kXe,UU,FU,OA,xye,Eye,Yv,Gs=y(()=>{At();Dn();Ys={leftBoundary:"([^\\p{L}\\p{N}_]|^)",rightBoundary:"(?=[^\\p{L}\\p{N}_]|$)",flags:"iu"},jU={\u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435:0,\u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u044F:0,\u0432\u0441\u043A:0,"\u0432\u0441\u043A.":0,\u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A:1,\u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A\u0430:1,\u043F\u043D:1,"\u043F\u043D.":1,\u0432\u0442\u043E\u0440\u043D\u0438\u043A:2,\u0432\u0442\u043E\u0440\u043D\u0438\u043A\u0430:2,\u0432\u0442:2,"\u0432\u0442.":2,\u0441\u0440\u0435\u0434\u0430:3,\u0441\u0440\u0435\u0434\u044B:3,\u0441\u0440\u0435\u0434\u0443:3,\u0441\u0440:3,"\u0441\u0440.":3,\u0447\u0435\u0442\u0432\u0435\u0440\u0433:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0430:4,\u0447\u0442:4,"\u0447\u0442.":4,\u043F\u044F\u0442\u043D\u0438\u0446\u0430:5,\u043F\u044F\u0442\u043D\u0438\u0446\u0443:5,\u043F\u044F\u0442\u043D\u0438\u0446\u044B:5,\u043F\u0442:5,"\u043F\u0442.":5,\u0441\u0443\u0431\u0431\u043E\u0442\u0430:6,\u0441\u0443\u0431\u0431\u043E\u0442\u0443:6,\u0441\u0443\u0431\u0431\u043E\u0442\u044B:6,\u0441\u0431:6,"\u0441\u0431.":6},BU={\u044F\u043D\u0432\u0430\u0440\u044C:1,\u044F\u043D\u0432\u0430\u0440\u044F:1,\u044F\u043D\u0432\u0430\u0440\u0435:1,\u0444\u0435\u0432\u0440\u0430\u043B\u044C:2,\u0444\u0435\u0432\u0440\u0430\u043B\u044F:2,\u0444\u0435\u0432\u0440\u0430\u043B\u0435:2,\u043C\u0430\u0440\u0442:3,\u043C\u0430\u0440\u0442\u0430:3,\u043C\u0430\u0440\u0442\u0435:3,\u0430\u043F\u0440\u0435\u043B\u044C:4,\u0430\u043F\u0440\u0435\u043B\u044F:4,\u0430\u043F\u0440\u0435\u043B\u0435:4,\u043C\u0430\u0439:5,\u043C\u0430\u044F:5,\u043C\u0430\u0435:5,\u0438\u044E\u043D\u044C:6,\u0438\u044E\u043D\u044F:6,\u0438\u044E\u043D\u0435:6,\u0438\u044E\u043B\u044C:7,\u0438\u044E\u043B\u044F:7,\u0438\u044E\u043B\u0435:7,\u0430\u0432\u0433\u0443\u0441\u0442:8,\u0430\u0432\u0433\u0443\u0441\u0442\u0430:8,\u0430\u0432\u0433\u0443\u0441\u0442\u0435:8,\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044C:9,\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044F:9,\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u0435:9,\u043E\u043A\u0442\u044F\u0431\u0440\u044C:10,\u043E\u043A\u0442\u044F\u0431\u0440\u044F:10,\u043E\u043A\u0442\u044F\u0431\u0440\u0435:10,\u043D\u043E\u044F\u0431\u0440\u044C:11,\u043D\u043E\u044F\u0431\u0440\u044F:11,\u043D\u043E\u044F\u0431\u0440\u0435:11,\u0434\u0435\u043A\u0430\u0431\u0440\u044C:12,\u0434\u0435\u043A\u0430\u0431\u0440\u044F:12,\u0434\u0435\u043A\u0430\u0431\u0440\u0435:12},Wv={...BU,\u044F\u043D\u0432:1,"\u044F\u043D\u0432.":1,\u0444\u0435\u0432:2,"\u0444\u0435\u0432.":2,\u043C\u0430\u0440:3,"\u043C\u0430\u0440.":3,\u0430\u043F\u0440:4,"\u0430\u043F\u0440.":4,\u0430\u0432\u0433:8,"\u0430\u0432\u0433.":8,\u0441\u0435\u043D:9,"\u0441\u0435\u043D.":9,\u043E\u043A\u0442:10,"\u043E\u043A\u0442.":10,\u043D\u043E\u044F:11,"\u043D\u043E\u044F.":11,\u0434\u0435\u043A:12,"\u0434\u0435\u043A.":12},$U={\u043E\u0434\u0438\u043D:1,\u043E\u0434\u043D\u0430:1,\u043E\u0434\u043D\u043E\u0439:1,\u043E\u0434\u043D\u0443:1,\u0434\u0432\u0435:2,\u0434\u0432\u0430:2,\u0434\u0432\u0443\u0445:2,\u0442\u0440\u0438:3,\u0442\u0440\u0435\u0445:3,\u0442\u0440\u0451\u0445:3,\u0447\u0435\u0442\u044B\u0440\u0435:4,\u0447\u0435\u0442\u044B\u0440\u0435\u0445:4,\u0447\u0435\u0442\u044B\u0440\u0451\u0445:4,\u043F\u044F\u0442\u044C:5,\u043F\u044F\u0442\u0438:5,\u0448\u0435\u0441\u0442\u044C:6,\u0448\u0435\u0441\u0442\u0438:6,\u0441\u0435\u043C\u044C:7,\u0441\u0435\u043C\u0438:7,\u0432\u043E\u0441\u0435\u043C\u044C:8,\u0432\u043E\u0441\u044C\u043C\u0438:8,\u0434\u0435\u0432\u044F\u0442\u044C:9,\u0434\u0435\u0432\u044F\u0442\u0438:9,\u0434\u0435\u0441\u044F\u0442\u044C:10,\u0434\u0435\u0441\u044F\u0442\u0438:10,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u044C:11,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u0438:11,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u044C:12,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u0438:12},zU={\u043F\u0435\u0440\u0432\u043E\u0435:1,\u043F\u0435\u0440\u0432\u043E\u0433\u043E:1,\u0432\u0442\u043E\u0440\u043E\u0435:2,\u0432\u0442\u043E\u0440\u043E\u0433\u043E:2,\u0442\u0440\u0435\u0442\u044C\u0435:3,\u0442\u0440\u0435\u0442\u044C\u0435\u0433\u043E:3,\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E:4,\u043F\u044F\u0442\u043E\u0435:5,\u043F\u044F\u0442\u043E\u0433\u043E:5,\u0448\u0435\u0441\u0442\u043E\u0435:6,\u0448\u0435\u0441\u0442\u043E\u0433\u043E:6,\u0441\u0435\u0434\u044C\u043C\u043E\u0435:7,\u0441\u0435\u0434\u044C\u043C\u043E\u0433\u043E:7,\u0432\u043E\u0441\u044C\u043C\u043E\u0435:8,\u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E:8,\u0434\u0435\u0432\u044F\u0442\u043E\u0435:9,\u0434\u0435\u0432\u044F\u0442\u043E\u0433\u043E:9,\u0434\u0435\u0441\u044F\u0442\u043E\u0435:10,\u0434\u0435\u0441\u044F\u0442\u043E\u0433\u043E:10,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:11,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:11,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:12,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:12,\u0442\u0440\u0438\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:13,\u0442\u0440\u0438\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:13,\u0447\u0435\u0442\u044B\u0440\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:14,\u0447\u0435\u0442\u044B\u0440\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:14,\u043F\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:15,\u043F\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:15,\u0448\u0435\u0441\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:16,\u0448\u0435\u0441\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:16,\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:17,\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:17,\u0432\u043E\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:18,\u0432\u043E\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:18,\u0434\u0435\u0432\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:19,\u0434\u0435\u0432\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:19,\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u043E\u0435:20,\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:20,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0435":21,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0433\u043E":21,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u0442\u043E\u0440\u043E\u0435":22,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u0442\u043E\u0440\u043E\u0433\u043E":22,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0442\u0440\u0435\u0442\u044C\u0435":23,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0442\u0440\u0435\u0442\u044C\u0435\u0433\u043E":23,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435":24,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E":24,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u044F\u0442\u043E\u0435":25,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u044F\u0442\u043E\u0433\u043E":25,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0448\u0435\u0441\u0442\u043E\u0435":26,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0448\u0435\u0441\u0442\u043E\u0433\u043E":26,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0441\u0435\u0434\u044C\u043C\u043E\u0435":27,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0441\u0435\u0434\u044C\u043C\u043E\u0433\u043E":27,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u043E\u0435":28,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E":28,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0434\u0435\u0432\u044F\u0442\u043E\u0435":29,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0434\u0435\u0432\u044F\u0442\u043E\u0433\u043E":29,\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u043E\u0435:30,\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u043E\u0433\u043E:30,"\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0435":31,"\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0433\u043E":31},LE={\u0441\u0435\u043A:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0430:"second",\u0441\u0435\u043A\u0443\u043D\u0434:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u044B:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0443:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0430:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0438:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u0435\u043A:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0443:"second",\u043C\u0438\u043D:"minute",\u043C\u0438\u043D\u0443\u0442\u0430:"minute",\u043C\u0438\u043D\u0443\u0442:"minute",\u043C\u0438\u043D\u0443\u0442\u044B:"minute",\u043C\u0438\u043D\u0443\u0442\u0443:"minute",\u043C\u0438\u043D\u0443\u0442\u043E\u043A:"minute",\u043C\u0438\u043D\u0443\u0442\u043A\u0438:"minute",\u043C\u0438\u043D\u0443\u0442\u043A\u0443:"minute",\u043C\u0438\u043D\u0443\u0442\u043E\u0447\u0435\u043A:"minute",\u043C\u0438\u043D\u0443\u0442\u043E\u0447\u043A\u0438:"minute",\u043C\u0438\u043D\u0443\u0442\u043E\u0447\u043A\u0443:"minute",\u0447\u0430\u0441:"hour",\u0447\u0430\u0441\u043E\u0432:"hour",\u0447\u0430\u0441\u0430:"hour",\u0447\u0430\u0441\u0443:"hour",\u0447\u0430\u0441\u0438\u043A\u043E\u0432:"hour",\u0447\u0430\u0441\u0438\u043A\u0430:"hour",\u0447\u0430\u0441\u0438\u043A\u0435:"hour",\u0447\u0430\u0441\u0438\u043A:"hour",\u0434\u0435\u043D\u044C:"d",\u0434\u043D\u044F:"d",\u0434\u043D\u0435\u0439:"d",\u0441\u0443\u0442\u043E\u043A:"d",\u0441\u0443\u0442\u043A\u0438:"d",\u043D\u0435\u0434\u0435\u043B\u044F:"week",\u043D\u0435\u0434\u0435\u043B\u0435:"week",\u043D\u0435\u0434\u0435\u043B\u0438:"week",\u043D\u0435\u0434\u0435\u043B\u044E:"week",\u043D\u0435\u0434\u0435\u043B\u044C:"week",\u043D\u0435\u0434\u0435\u043B\u044C\u043A\u0435:"week",\u043D\u0435\u0434\u0435\u043B\u044C\u043A\u0438:"week",\u043D\u0435\u0434\u0435\u043B\u0435\u043A:"week",\u043C\u0435\u0441\u044F\u0446:"month",\u043C\u0435\u0441\u044F\u0446\u0435:"month",\u043C\u0435\u0441\u044F\u0446\u0435\u0432:"month",\u043C\u0435\u0441\u044F\u0446\u0430:"month",\u043A\u0432\u0430\u0440\u0442\u0430\u043B:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0435:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u043E\u0432:"quarter",\u0433\u043E\u0434:"year",\u0433\u043E\u0434\u0430:"year",\u0433\u043E\u0434\u0443:"year",\u0433\u043E\u0434\u043E\u0432:"year",\u043B\u0435\u0442:"year",\u0433\u043E\u0434\u0438\u043A:"year",\u0433\u043E\u0434\u0438\u043A\u0430:"year",\u0433\u043E\u0434\u0438\u043A\u043E\u0432:"year"},kXe=`(?:${oe($U)}|[0-9]+|[0-9]+\\.[0-9]+|\u043F\u043E\u043B|\u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E|\u043F\u0430\u0440(?:\u044B|\u0443)|\\s{0,3})`;UU=`(?:${oe(zU)}|[0-9]{1,2}(?:\u0433\u043E|\u043E\u0433\u043E|\u0435|\u043E\u0435)?)`;FU="(?:\\s+(?:\u0433\u043E\u0434\u0443|\u0433\u043E\u0434\u0430|\u0433\u043E\u0434|\u0433|\u0433.))?",OA=`(?:[1-9][0-9]{0,3}${FU}\\s*(?:\u043D.\u044D.|\u0434\u043E \u043D.\u044D.|\u043D. \u044D.|\u0434\u043E \u043D. \u044D.)|[1-2][0-9]{3}${FU}|[5-9][0-9]${FU})`;xye=`(${kXe})\\s{0,3}(${oe(LE)})`,Eye=new RegExp(xye,"i"),Yv=Ia("(?:(?:\u043E\u043A\u043E\u043B\u043E|\u043F\u0440\u0438\u043C\u0435\u0440\u043D\u043E)\\s{0,3})?",xye)});var Cye,FE,Dye=y(()=>{Gs();lt();we();Cye=`(?:(?:\u043E\u043A\u043E\u043B\u043E|\u043F\u0440\u0438\u043C\u0435\u0440\u043D\u043E)\\s*(?:~\\s*)?)?(${Yv})${Ys.rightBoundary}`,FE=class extends V{patternLeftBoundary(){return Ys.leftBoundary}innerPattern(e){return e.option.forwardDate?new RegExp(Cye,Ys.flags):new RegExp(`(?:\u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0435|\u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0438)\\s*${Cye}`,Ys.flags)}innerExtract(e,t){let n=Gv(t[1]);return ee.createRelativeFromReference(e.reference,n)}}});var Mh,as,yu=y(()=>{we();Gs();Mh=class extends V{patternLeftBoundary(){return Ys.leftBoundary}innerPattern(e){return new RegExp(this.innerPatternString(e),Ys.flags)}innerPatternHasChange(e,t){return!1}},as=class extends Mh{innerPattern(e){return new RegExp(`${this.innerPatternString(e)}${Ys.rightBoundary}`,Ys.flags)}}});var Pye,Mye,EXe,_ye,$E,Aye=y(()=>{Dn();Gs();Gs();Gs();At();yu();Pye=1,Mye=2,EXe=3,_ye=4,$E=class extends as{innerPatternString(e){return`(?:\u0441)?\\s*(${UU})(?:\\s{0,3}(?:\u043F\u043E|-|\u2013|\u0434\u043E)?\\s{0,3}(${UU}))?(?:-|\\/|\\s{0,3}(?:of)?\\s{0,3})(${oe(Wv)})(?:(?:-|\\/|,?\\s{0,3})(${OA}(?![^\\s]\\d)))?`}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=Wv[t[EXe].toLowerCase()],a=HU(t[Pye]);if(a>31)return t.index=t.index+t[Pye].length,null;if(n.start.assign("month",i),n.start.assign("day",a),t[_ye]){let s=LA(t[_ye]);n.start.assign("year",s)}else{let s=dr(e.refDate,a,i);n.start.imply("year",s)}if(t[Mye]){let s=HU(t[Mye]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var xXe,Iye,zE,Nye=y(()=>{Gs();Dn();At();Gs();yu();xXe=2,Iye=3,zE=class extends Mh{innerPatternString(e){return`((?:\u0432)\\s*)?(${oe(Wv)})\\s*(?:[,-]?\\s*(${OA})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`}innerExtract(e,t){let n=t[xXe].toLowerCase();if(t[0].length<=3&&!BU[n])return null;let i=e.createParsingResult(t.index,t.index+t[0].length);i.start.imply("day",1);let a=Wv[n];if(i.start.assign("month",a),t[Iye]){let s=LA(t[Iye]);i.start.assign("year",s)}else{let s=dr(e.refDate,1,a);i.start.imply("year",s)}return i}}});var jE,Rye=y(()=>{Bt();pu();Gs();jE=class extends wi{constructor(e){super(e)}patternFlags(){return Ys.flags}primaryPatternLeftBoundary(){return"(^|\\s|T|(?:[^\\p{L}\\p{N}_]))"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|\u0434\u043E|\u0438|\u043F\u043E|\\?)\\s*"}primaryPrefix(){return"(?:(?:\u0432|\u0441)\\s*)??"}primarySuffix(){return`(?:\\s*(?:\u0443\u0442\u0440\u0430|\u0432\u0435\u0447\u0435\u0440\u0430|\u043F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0434\u043D\u044F))?(?!\\/)${Ys.rightBoundary}`}extractPrimaryTimeComponents(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(n){if(t[0].endsWith("\u0432\u0435\u0447\u0435\u0440\u0430")){let i=n.get("hour");i>=6&&i<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",B.PM)):i<6&&n.assign("meridiem",B.AM)}if(t[0].endsWith("\u043F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0434\u043D\u044F")){n.assign("meridiem",B.PM);let i=n.get("hour");i>=0&&i<=6&&n.assign("hour",n.get("hour")+12)}t[0].endsWith("\u0443\u0442\u0440\u0430")&&(n.assign("meridiem",B.AM),n.get("hour")<12&&n.assign("hour",n.get("hour")))}return n}}});var BE,Oye=y(()=>{Gs();lt();qs();yu();BE=class extends Mh{innerPatternString(e){return`(${Yv})\\s{0,5}\u043D\u0430\u0437\u0430\u0434(?=(?:\\W|$))`}innerExtract(e,t){let n=Gv(t[1]),i=Gn(n);return ee.createRelativeFromReference(e.reference,i)}}});var UE,Lye=y(()=>{Eo();UE=class extends Jr{patternBetween(){return/^\s*(и до|и по|до|по|-)\s*$/i}}});var HE,Fye=y(()=>{xo();HE=class extends Xr{patternBetween(){return new RegExp("^\\s*(T|\u0432|,|-)?\\s*$")}}});var VE,$ye=y(()=>{Vs();yu();VE=class extends as{innerPatternString(e){return"(?:\u0441|\u0441\u043E)?\\s*(\u0441\u0435\u0433\u043E\u0434\u043D\u044F|\u0432\u0447\u0435\u0440\u0430|\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0441\u043B\u0435\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0437\u0430\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430|\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430)"}innerExtract(e,t){let n=t[1].toLowerCase(),i=e.createParsingComponents();switch(n){case"\u0441\u0435\u0433\u043E\u0434\u043D\u044F":return Si(e.reference);case"\u0432\u0447\u0435\u0440\u0430":return sa(e.reference);case"\u0437\u0430\u0432\u0442\u0440\u0430":return oa(e.reference);case"\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430":return bc(e.reference,2);case"\u043F\u043E\u0441\u043B\u0435\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430":return bc(e.reference,3);case"\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430":return uh(e.reference,2);case"\u043F\u043E\u0437\u0430\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430":return uh(e.reference,3)}return i}}});var zye,qE,jye=y(()=>{Vs();Us();zye=tt(Xt(),1);yu();qE=class extends as{innerPatternString(e){return"(\u0441\u0435\u0439\u0447\u0430\u0441|\u043F\u0440\u043E\u0448\u043B\u044B\u043C\\s*\u0432\u0435\u0447\u0435\u0440\u043E\u043C|\u043F\u0440\u043E\u0448\u043B\u043E\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u0441\u0435\u0433\u043E\u0434\u043D\u044F\\s*\u043D\u043E\u0447\u044C\u044E|\u044D\u0442\u043E\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u043D\u043E\u0447\u044C\u044E|\u044D\u0442\u0438\u043C \u0443\u0442\u0440\u043E\u043C|\u0443\u0442\u0440\u043E\u043C|\u0443\u0442\u0440\u0430|\u0432\\s*\u043F\u043E\u043B\u0434\u0435\u043D\u044C|\u0432\u0435\u0447\u0435\u0440\u043E\u043C|\u0432\u0435\u0447\u0435\u0440\u0430|\u0432\\s*\u043F\u043E\u043B\u043D\u043E\u0447\u044C)"}innerExtract(e,t){let n=(0,zye.default)(e.refDate),i=t[0].toLowerCase(),a=e.createParsingComponents();if(i==="\u0441\u0435\u0439\u0447\u0430\u0441")return aa(e.reference);if(i==="\u0432\u0435\u0447\u0435\u0440\u043E\u043C"||i==="\u0432\u0435\u0447\u0435\u0440\u0430")return Iv(e.reference);if(i.endsWith("\u0443\u0442\u0440\u043E\u043C")||i.endsWith("\u0443\u0442\u0440\u0430"))return Nv(e.reference);if(i.match(/в\s*полдень/))return Rv(e.reference);if(i.match(/прошлой\s*ночью/))return sA(e.reference);if(i.match(/прошлым\s*вечером/))return oA(e.reference);if(i.match(/следующей\s*ночью/)){let s=n.hour()<22?1:2;n=n.add(s,"day"),Vr(a,n),a.imply("hour",0)}return i.match(/в\s*полночь/)||i.endsWith("\u043D\u043E\u0447\u044C\u044E")?ph(e.reference):a}}});var CXe,DXe,PXe,WE,Bye=y(()=>{Gs();At();xl();yu();CXe=1,DXe=2,PXe=3,WE=class extends as{innerPatternString(e){return`(?:(?:,|\\(|\uFF08)\\s*)?(?:\u0432\\s*?)?(?:(\u044D\u0442\u0443|\u044D\u0442\u043E\u0442|\u043F\u0440\u043E\u0448\u043B\u044B\u0439|\u043F\u0440\u043E\u0448\u043B\u0443\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0443\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0433\u043E)\\s*)?(${oe(jU)})(?:\\s*(?:,|\\)|\uFF09))?(?:\\s*\u043D\u0430\\s*(\u044D\u0442\u043E\u0439|\u043F\u0440\u043E\u0448\u043B\u043E\u0439|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439)\\s*\u043D\u0435\u0434\u0435\u043B\u0435)?`}innerExtract(e,t){let n=t[DXe].toLowerCase(),i=jU[n],a=t[CXe],s=t[PXe],o=a||s;o=o||"",o=o.toLowerCase();let l=null;return o=="\u043F\u0440\u043E\u0448\u043B\u044B\u0439"||o=="\u043F\u0440\u043E\u0448\u043B\u0443\u044E"||o=="\u043F\u0440\u043E\u0448\u043B\u043E\u0439"?l="last":o=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439"||o=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0443\u044E"||o=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439"||o=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0433\u043E"?l="next":(o=="\u044D\u0442\u043E\u0442"||o=="\u044D\u0442\u0443"||o=="\u044D\u0442\u043E\u0439")&&(l="this"),Kn(e.reference,i,l)}}});var Uye,MXe,_Xe,YE,Hye=y(()=>{Gs();lt();Uye=tt(Xt(),1);At();yu();MXe=1,_Xe=2,YE=class extends as{innerPatternString(e){return`(\u0432 \u043F\u0440\u043E\u0448\u043B\u043E\u043C|\u043D\u0430 \u043F\u0440\u043E\u0448\u043B\u043E\u0439|\u043D\u0430 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439|\u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C|\u043D\u0430 \u044D\u0442\u043E\u0439|\u0432 \u044D\u0442\u043E\u043C)\\s*(${oe(LE)})`}innerExtract(e,t){let n=t[MXe].toLowerCase(),i=t[_Xe].toLowerCase(),a=LE[i];if(n=="\u043D\u0430 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439"||n=="\u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C"){let l={};return l[a]=1,ee.createRelativeFromReference(e.reference,l)}if(n=="\u0432 \u043F\u0440\u043E\u0448\u043B\u043E\u043C"||n=="\u043D\u0430 \u043F\u0440\u043E\u0448\u043B\u043E\u0439"){let l={};return l[a]=-1,ee.createRelativeFromReference(e.reference,l)}let s=e.createParsingComponents(),o=(0,Uye.default)(e.reference.instant);return a.match(/week/i)?(o=o.add(-o.get("d"),"d"),s.imply("day",o.date()),s.imply("month",o.month()+1),s.imply("year",o.year())):a.match(/month/i)?(o=o.add(-o.date()+1,"d"),s.imply("day",o.date()),s.assign("year",o.year()),s.assign("month",o.month()+1)):a.match(/year/i)&&(o=o.add(-o.date()+1,"d"),o=o.add(-o.month(),"month"),s.imply("day",o.date()),s.imply("month",o.month()+1),s.assign("year",o.year())),s}}});var GE,Vye=y(()=>{Gs();lt();qs();yu();GE=class extends as{innerPatternString(e){return`(\u044D\u0442\u0438|\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435|\u043F\u0440\u043E\u0448\u043B\u044B\u0435|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0435|\u043F\u043E\u0441\u043B\u0435|\u0441\u043F\u0443\u0441\u0442\u044F|\u0447\u0435\u0440\u0435\u0437|\\+|-)\\s*(${Yv})`}innerExtract(e,t){let n=t[1].toLowerCase(),i=Gv(t[2]);switch(n){case"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435":case"\u043F\u0440\u043E\u0448\u043B\u044B\u0435":case"-":i=Gn(i);break}return ee.createRelativeFromReference(e.reference,i)}}});var WU={};et(WU,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>VU,createCasualConfiguration:()=>qye,createConfiguration:()=>qU,parse:()=>IXe,parseDate:()=>NXe,strict:()=>AXe});function IXe(r,e,t){return VU.parse(r,e,t)}function NXe(r,e,t){return VU.parseDate(r,e,t)}function qye(){let r=qU(!1);return r.parsers.unshift(new VE),r.parsers.unshift(new qE),r.parsers.unshift(new zE),r.parsers.unshift(new YE),r.parsers.unshift(new GE),r}function qU(r=!0){return ln({parsers:[new oi(!0),new FE,new $E,new WE,new jE(r),new BE],refiners:[new HE,new UE]},r)}var VU,AXe,Wye=y(()=>{Dye();Aye();Nye();Rye();Oye();Lye();Fye();Hs();$ye();jye();Bye();Hye();is();lt();Bt();hu();Vye();VU=new ze(qye()),AXe=new ze(qU(!0))});function OXe(r){let e=r.toLowerCase();return YU[e]!==void 0?YU[e]:e==="un"||e==="una"||e==="uno"?1:e.match(/algunos?/)||e.match(/unos?/)?3:e.match(/media?/)?.5:parseFloat(e)}function Zye(r){if(r.match(/^[0-9]{1,4}$/)){let e=parseInt(r);return e<100&&(e>50?e=e+1900:e=e+2e3),e}return r.match(/a\.?\s*c\.?/i)?(r=r.replace(/a\.?\s*c\.?/i,""),-parseInt(r)):parseInt(r)}function Xye(r){let e={},t=r,n=Yye.exec(t);for(;n;)LXe(e,n),t=t.substring(n[0].length),n=Yye.exec(t);return e}function LXe(r,e){let t=OXe(e[1]),n=Gye[e[2].toLowerCase()];r[n]=t}var GU,KU,YU,Gye,RXe,Kye,Qye,Yye,Jye,KE=y(()=>{At();GU={domingo:0,dom:0,lunes:1,lun:1,martes:2,mar:2,mi\u00E9rcoles:3,miercoles:3,mi\u00E9:3,mie:3,jueves:4,jue:4,viernes:5,vie:5,s\u00E1bado:6,sabado:6,s\u00E1b:6,sab:6},KU={enero:1,ene:1,"ene.":1,febrero:2,feb:2,"feb.":2,marzo:3,mar:3,"mar.":3,abril:4,abr:4,"abr.":4,mayo:5,may:5,"may.":5,junio:6,jun:6,"jun.":6,julio:7,jul:7,"jul.":7,agosto:8,ago:8,"ago.":8,septiembre:9,setiembre:9,sep:9,"sep.":9,octubre:10,oct:10,"oct.":10,noviembre:11,nov:11,"nov.":11,diciembre:12,dic:12,"dic.":12},YU={uno:1,dos:2,tres:3,cuatro:4,cinco:5,seis:6,siete:7,ocho:8,nueve:9,diez:10,once:11,doce:12,trece:13},Gye={sec:"second",segundo:"second",segundos:"second",min:"minute",mins:"minute",minuto:"minute",minutos:"minute",h:"hour",hr:"hour",hrs:"hour",hora:"hour",horas:"hour",d\u00EDa:"d",d\u00EDas:"d",semana:"week",semanas:"week",mes:"month",meses:"month",cuarto:"quarter",cuartos:"quarter",a\u00F1o:"year",a\u00F1os:"year"},RXe=`(?:${oe(YU)}|[0-9]+|[0-9]+\\.[0-9]+|un?|uno?|una?|algunos?|unos?|demi-?)`;Kye="[0-9]{1,4}(?![^\\s]\\d)(?:\\s*[a|d]\\.?\\s*c\\.?|\\s*a\\.?\\s*d\\.?)?";Qye=`(${RXe})\\s{0,5}(${oe(Gye)})\\s{0,5}`,Yye=new RegExp(Qye,"i"),Jye=Ia("",Qye)});var FXe,$Xe,zXe,jXe,ZE,eve=y(()=>{KE();At();we();xl();FXe=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(este|esta|pasado|pr[o\xF3]ximo)\\s*)?(${oe(GU)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(este|esta|pasado|pr[\xF3o]ximo)\\s*semana)?(?=\\W|\\d|$)`,"i"),$Xe=1,zXe=2,jXe=3,ZE=class extends V{innerPattern(){return FXe}innerExtract(e,t){let n=t[zXe].toLowerCase(),i=GU[n];if(i===void 0)return null;let a=t[$Xe],s=t[jXe],o=a||s||"";o=o.toLowerCase();let l=null;return o=="pasado"?l="this":o=="pr\xF3ximo"||o=="proximo"?l="next":o=="este"&&(l="this"),Kn(e.reference,i,l)}}});var QE,tve=y(()=>{pu();QE=class extends wi{primaryPrefix(){return"(?:(?:aslas|deslas|las?|al?|de|del)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|a(?:l)?|\\?)\\s*"}}});var JE,rve=y(()=>{xo();JE=class extends Xr{patternBetween(){return new RegExp("^\\s*(?:,|de|aslas|a)?\\s*$")}}});var XE,nve=y(()=>{Eo();XE=class extends Jr{patternBetween(){return/^\s*(?:-)\s*$/i}}});var BXe,ive,ave,UXe,sve,ex,ove=y(()=>{Dn();KE();KE();At();we();BXe=new RegExp(`([0-9]{1,2})(?:\xBA|\xAA|\xB0)?(?:\\s*(?:desde|de|\\-|\\\u2013|ao?|\\s)\\s*([0-9]{1,2})(?:\xBA|\xAA|\xB0)?)?\\s*(?:de)?\\s*(?:-|/|\\s*(?:de|,)?\\s*)(${oe(KU)})(?:\\s*(?:de|,)?\\s*(${Kye}))?(?=\\W|$)`,"i"),ive=1,ave=2,UXe=3,sve=4,ex=class extends V{innerPattern(){return BXe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=KU[t[UXe].toLowerCase()],a=parseInt(t[ive]);if(a>31)return t.index=t.index+t[ive].length,null;if(n.start.assign("month",i),n.start.assign("day",a),t[sve]){let s=Zye(t[sve]);n.start.assign("year",s)}else{let s=dr(e.refDate,a,i);n.start.imply("year",s)}if(t[ave]){let s=parseInt(t[ave]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var tx,lve=y(()=>{we();Vs();tx=class extends V{innerPattern(e){return/(ahora|hoy|mañana|ayer)(?=\W|$)/i}innerExtract(e,t){let n=t[0].toLowerCase(),i=e.createParsingComponents();switch(n){case"ahora":return aa(e.reference);case"hoy":return Si(e.reference);case"ma\xF1ana":return oa(e.reference);case"ayer":return sa(e.reference)}return i}}});var cve,rx,dve=y(()=>{Bt();we();Us();cve=tt(Xt(),1),rx=class extends V{innerPattern(){return/(?:esta\s*)?(mañana|tarde|medianoche|mediodia|mediodía|noche)(?=\W|$)/i}innerExtract(e,t){let n=(0,cve.default)(e.refDate),i=e.createParsingComponents();switch(t[1].toLowerCase()){case"tarde":i.imply("meridiem",B.PM),i.imply("hour",15);break;case"noche":i.imply("meridiem",B.PM),i.imply("hour",22);break;case"ma\xF1ana":i.imply("meridiem",B.AM),i.imply("hour",6);break;case"medianoche":Sl(i,n),i.imply("hour",0),i.imply("minute",0),i.imply("second",0);break;case"mediodia":case"mediod\xEDa":i.imply("meridiem",B.AM),i.imply("hour",12);break}return i}}});var nx,uve=y(()=>{KE();lt();we();nx=class extends V{innerPattern(){return new RegExp(`(?:en|por|durante|de|dentro de)\\s*(${Jye})(?=\\W|$)`,"i")}innerExtract(e,t){let n=Xye(t[1]);return ee.createRelativeFromReference(e.reference,n)}}});var JU={};et(JU,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>ZU,createCasualConfiguration:()=>pve,createConfiguration:()=>QU,parse:()=>VXe,parseDate:()=>qXe,strict:()=>HXe});function VXe(r,e,t){return ZU.parse(r,e,t)}function qXe(r,e,t){return ZU.parseDate(r,e,t)}function pve(r=!0){let e=QU(!1,r);return e.parsers.push(new tx),e.parsers.push(new rx),e}function QU(r=!0,e=!0){return ln({parsers:[new oi(e),new ZE,new QE,new ex,new nx],refiners:[new JE,new XE]},r)}var ZU,HXe,mve=y(()=>{Hs();is();lt();Bt();hu();eve();tve();rve();nve();ove();lve();dve();uve();ZU=new ze(pve()),HXe=new ze(QU(!0))});function YXe(r){let e=r.toLowerCase();return eH[e]!==void 0?eH[e]:e.match(/декілька/)?2:e.match(/пів/)?.5:e.match(/пар/)?2:e===""?1:parseFloat(e)}function aH(r){let e=r.toLowerCase();return tH[e]!==void 0?tH[e]:parseInt(e)}function $A(r){if(/(рік|року|р|р.)/i.test(r)&&(r=r.replace(/(рік|року|р|р.)/i,"")),/(до н.е.|до н. е.)/i.test(r))return r=r.replace(/(до н.е.|до н. е.)/i,""),-parseInt(r);if(/(н. е.|н.е.)/i.test(r))return r=r.replace(/(н. е.|н.е.)/i,""),parseInt(r);let e=parseInt(r);return rs(e)}function Qv(r){let e={},t=r,n=fve.exec(t);for(;n;)GXe(e,n),t=t.substring(n[0].length).trim(),n=fve.exec(t);return e}function GXe(r,e){let t=YXe(e[1]),n=ix[e[2].toLowerCase()];r[n]=t}var Ao,rH,nH,Kv,eH,tH,ix,WXe,iH,XU,FA,hve,fve,Zv,Ks=y(()=>{At();Dn();Ao={leftBoundary:"([^\\p{L}\\p{N}_]|^)",rightBoundary:"(?=[^\\p{L}\\p{N}_]|$)",flags:"iu"},rH={\u043D\u0435\u0434\u0456\u043B\u044F:0,\u043D\u0435\u0434\u0456\u043B\u0456:0,\u043D\u0435\u0434\u0456\u043B\u044E:0,\u043D\u0434:0,"\u043D\u0434.":0,\u043F\u043E\u043D\u0435\u0434\u0456\u043B\u043E\u043A:1,\u043F\u043E\u043D\u0435\u0434\u0456\u043B\u043A\u0430:1,\u043F\u043D:1,"\u043F\u043D.":1,\u0432\u0456\u0432\u0442\u043E\u0440\u043E\u043A:2,\u0432\u0456\u0432\u0442\u043E\u0440\u043A\u0430:2,\u0432\u0442:2,"\u0432\u0442.":2,\u0441\u0435\u0440\u0435\u0434\u0430:3,\u0441\u0435\u0440\u0435\u0434\u0438:3,\u0441\u0435\u0440\u0435\u0434\u0443:3,\u0441\u0440:3,"\u0441\u0440.":3,\u0447\u0435\u0442\u0432\u0435\u0440:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0430:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0443:4,\u0447\u0442:4,"\u0447\u0442.":4,"\u043F'\u044F\u0442\u043D\u0438\u0446\u044F":5,"\u043F'\u044F\u0442\u043D\u0438\u0446\u0456":5,"\u043F'\u044F\u0442\u043D\u0438\u0446\u044E":5,\u043F\u0442:5,"\u043F\u0442.":5,\u0441\u0443\u0431\u043E\u0442\u0430:6,\u0441\u0443\u0431\u043E\u0442\u0438:6,\u0441\u0443\u0431\u043E\u0442\u0443:6,\u0441\u0431:6,"\u0441\u0431.":6},nH={\u0441\u0456\u0447\u0435\u043D\u044C:1,\u0441\u0456\u0447\u043D\u044F:1,\u0441\u0456\u0447\u043D\u0456:1,\u043B\u044E\u0442\u0438\u0439:2,\u043B\u044E\u0442\u043E\u0433\u043E:2,\u043B\u044E\u0442\u043E\u043C\u0443:2,\u0431\u0435\u0440\u0435\u0437\u0435\u043D\u044C:3,\u0431\u0435\u0440\u0435\u0437\u043D\u044F:3,\u0431\u0435\u0440\u0435\u0437\u043D\u0456:3,\u043A\u0432\u0456\u0442\u0435\u043D\u044C:4,\u043A\u0432\u0456\u0442\u043D\u044F:4,\u043A\u0432\u0456\u0442\u043D\u0456:4,\u0442\u0440\u0430\u0432\u0435\u043D\u044C:5,\u0442\u0440\u0430\u0432\u043D\u044F:5,\u0442\u0440\u0430\u0432\u043D\u0456:5,\u0447\u0435\u0440\u0432\u0435\u043D\u044C:6,\u0447\u0435\u0440\u0432\u043D\u044F:6,\u0447\u0435\u0440\u0432\u043D\u0456:6,\u043B\u0438\u043F\u0435\u043D\u044C:7,\u043B\u0438\u043F\u043D\u044F:7,\u043B\u0438\u043F\u043D\u0456:7,\u0441\u0435\u0440\u043F\u0435\u043D\u044C:8,\u0441\u0435\u0440\u043F\u043D\u044F:8,\u0441\u0435\u0440\u043F\u043D\u0456:8,\u0432\u0435\u0440\u0435\u0441\u0435\u043D\u044C:9,\u0432\u0435\u0440\u0435\u0441\u043D\u044F:9,\u0432\u0435\u0440\u0435\u0441\u043D\u0456:9,\u0436\u043E\u0432\u0442\u0435\u043D\u044C:10,\u0436\u043E\u0432\u0442\u043D\u044F:10,\u0436\u043E\u0432\u0442\u043D\u0456:10,\u043B\u0438\u0441\u0442\u043E\u043F\u0430\u0434:11,\u043B\u0438\u0441\u0442\u043E\u043F\u0430\u0434\u0430:11,\u043B\u0438\u0441\u0442\u043E\u043F\u0430\u0434\u0443:11,\u0433\u0440\u0443\u0434\u0435\u043D\u044C:12,\u0433\u0440\u0443\u0434\u043D\u044F:12,\u0433\u0440\u0443\u0434\u043D\u0456:12},Kv={...nH,\u0441\u0456\u0447:1,"\u0441\u0456\u0447.":1,\u043B\u044E\u0442:2,"\u043B\u044E\u0442.":2,\u0431\u0435\u0440:3,"\u0431\u0435\u0440.":3,\u043A\u0432\u0456\u0442:4,"\u043A\u0432\u0456\u0442.":4,\u0442\u0440\u0430\u0432:5,"\u0442\u0440\u0430\u0432.":5,\u0447\u0435\u0440\u0432:6,"\u0447\u0435\u0440\u0432.":6,\u043B\u0438\u043F:7,"\u043B\u0438\u043F.":7,\u0441\u0435\u0440\u043F:8,"\u0441\u0435\u0440\u043F.":8,\u0441\u0435\u0440:8,"c\u0435\u0440.":8,\u0432\u0435\u0440:9,"\u0432\u0435\u0440.":9,\u0432\u0435\u0440\u0435\u0441:9,"\u0432\u0435\u0440\u0435\u0441.":9,\u0436\u043E\u0432\u0442:10,"\u0436\u043E\u0432\u0442.":10,\u043B\u0438\u0441\u0442\u043E\u043F:11,"\u043B\u0438\u0441\u0442\u043E\u043F.":11,\u0433\u0440\u0443\u0434:12,"\u0433\u0440\u0443\u0434.":12},eH={\u043E\u0434\u0438\u043D:1,\u043E\u0434\u043D\u0430:1,\u043E\u0434\u043D\u043E\u0457:1,\u043E\u0434\u043D\u0443:1,\u0434\u0432\u0456:2,\u0434\u0432\u0430:2,\u0434\u0432\u043E\u0445:2,\u0442\u0440\u0438:3,\u0442\u0440\u044C\u043E\u0445:3,\u0447\u043E\u0442\u0438\u0440\u0438:4,\u0447\u043E\u0442\u0438\u0440\u044C\u043E\u0445:4,"\u043F'\u044F\u0442\u044C":5,"\u043F'\u044F\u0442\u0438":5,\u0448\u0456\u0441\u0442\u044C:6,\u0448\u0435\u0441\u0442\u0438:6,\u0441\u0456\u043C:7,\u0441\u0435\u043C\u0438:7,\u0432\u0456\u0441\u0456\u043C:8,\u0432\u043E\u0441\u044C\u043C\u0438:8,"\u0434\u0435\u0432'\u044F\u0442\u044C":9,"\u0434\u0435\u0432'\u044F\u0442\u0438":9,\u0434\u0435\u0441\u044F\u0442\u044C:10,\u0434\u0435\u0441\u044F\u0442\u0438:10,\u043E\u0434\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u044C:11,\u043E\u0434\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u0438:11,\u0434\u0432\u0430\u043D\u0430\u0434\u0446\u044F\u0442\u044C:12,\u0434\u0432\u0430\u043D\u0430\u0434\u0446\u044F\u0442\u0438:12},tH={\u043F\u0435\u0440\u0448\u0435:1,\u043F\u0435\u0440\u0448\u043E\u0433\u043E:1,\u0434\u0440\u0443\u0433\u0435:2,\u0434\u0440\u0443\u0433\u043E\u0433\u043E:2,\u0442\u0440\u0435\u0442\u0454:3,\u0442\u0440\u0435\u0442\u044C\u043E\u0433\u043E:3,\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0435:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E:4,"\u043F'\u044F\u0442\u0435":5,"\u043F'\u044F\u0442\u043E\u0433\u043E":5,\u0448\u043E\u0441\u0442\u0435:6,\u0448\u043E\u0441\u0442\u043E\u0433\u043E:6,\u0441\u044C\u043E\u043C\u0435:7,\u0441\u044C\u043E\u043C\u043E\u0433\u043E:7,\u0432\u043E\u0441\u044C\u043C\u0435:8,\u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E:8,"\u0434\u0435\u0432'\u044F\u0442\u0435":9,"\u0434\u0435\u0432'\u044F\u0442\u043E\u0433\u043E":9,\u0434\u0435\u0441\u044F\u0442\u0435:10,\u0434\u0435\u0441\u044F\u0442\u043E\u0433\u043E:10,\u043E\u0434\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u0435:11,\u043E\u0434\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:11,\u0434\u0432\u0430\u043D\u0430\u0434\u0446\u044F\u0442\u0435:12,\u0434\u0432\u0430\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:12,\u0442\u0440\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u0435:13,\u0442\u0440\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:13,\u0447\u043E\u0442\u0438\u0440\u043D\u0430\u0434\u0446\u044F\u0442\u0435:14,\u0447\u043E\u0442\u0438\u043D\u0440\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:14,"\u043F'\u044F\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u0435":15,"\u043F'\u044F\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E":15,\u0448\u0456\u0441\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u0435:16,\u0448\u0456\u0441\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:16,\u0441\u0456\u043C\u043D\u0430\u0434\u0446\u044F\u0442\u0435:17,\u0441\u0456\u043C\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:17,\u0432\u0456\u0441\u0456\u043C\u043D\u0430\u0434\u0446\u044F\u0442\u0435:18,\u0432\u0456\u0441\u0456\u043C\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:18,"\u0434\u0435\u0432'\u044F\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u0435":19,"\u0434\u0435\u0432'\u044F\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E":19,\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u0435:20,\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:20,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u043F\u0435\u0440\u0448\u0435":21,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u043F\u0435\u0440\u0448\u043E\u0433\u043E":21,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0434\u0440\u0443\u0433\u0435":22,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0434\u0440\u0443\u0433\u043E\u0433\u043E":22,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0442\u0440\u0435\u0442\u0454":23,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0442\u0440\u0435\u0442\u044C\u043E\u0433\u043E":23,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0435":24,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E":24,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u043F'\u044F\u0442\u0435":25,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u043F'\u044F\u0442\u043E\u0433\u043E":25,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0448\u043E\u0441\u0442\u0435":26,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0448\u043E\u0441\u0442\u043E\u0433\u043E":26,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0441\u044C\u043E\u043C\u0435":27,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0441\u044C\u043E\u043C\u043E\u0433\u043E":27,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u0435":28,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E":28,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0434\u0435\u0432'\u044F\u0442\u0435":29,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0434\u0435\u0432'\u044F\u0442\u043E\u0433\u043E":29,\u0442\u0440\u0438\u0434\u0446\u044F\u0442\u0435:30,\u0442\u0440\u0438\u0434\u0446\u044F\u0442\u043E\u0433\u043E:30,"\u0442\u0440\u0438\u0434\u0446\u044F\u0442\u044C \u043F\u0435\u0440\u0448\u0435":31,"\u0442\u0440\u0438\u0434\u0446\u044F\u0442\u044C \u043F\u0435\u0440\u0448\u043E\u0433\u043E":31},ix={\u0441\u0435\u043A:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0430:"second",\u0441\u0435\u043A\u0443\u043D\u0434:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0438:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0443:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043E\u043A:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0438:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0443:"second",\u0445\u0432:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u0430:"minute",\u0445\u0432\u0438\u043B\u0438\u043D:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u0438:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u0443:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043E\u043A:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043A\u0438:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043A\u0443:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043E\u0447\u043E\u043A:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043E\u0447\u043A\u0438:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043E\u0447\u043A\u0443:"minute",\u0433\u043E\u0434:"hour",\u0433\u043E\u0434\u0438\u043D\u0430:"hour",\u0433\u043E\u0434\u0438\u043D:"hour",\u0433\u043E\u0434\u0438\u043D\u0438:"hour",\u0433\u043E\u0434\u0438\u043D\u0443:"hour",\u0433\u043E\u0434\u0438\u043D\u043A\u0430:"hour",\u0433\u043E\u0434\u0438\u043D\u043E\u043A:"hour",\u0433\u043E\u0434\u0438\u043D\u043A\u0438:"hour",\u0433\u043E\u0434\u0438\u043D\u043A\u0443:"hour",\u0434\u0435\u043D\u044C:"d",\u0434\u043D\u044F:"d",\u0434\u043D\u0456\u0432:"d",\u0434\u043D\u0456:"d",\u0434\u043E\u0431\u0430:"d",\u0434\u043E\u0431\u0443:"d",\u0442\u0438\u0436\u0434\u0435\u043D\u044C:"week",\u0442\u0438\u0436\u043D\u044E:"week",\u0442\u0438\u0436\u043D\u044F:"week",\u0442\u0438\u0436\u043D\u0456:"week",\u0442\u0438\u0436\u043D\u0456\u0432:"week",\u043C\u0456\u0441\u044F\u0446\u044C:"month",\u043C\u0456\u0441\u044F\u0446\u0456\u0432:"month",\u043C\u0456\u0441\u044F\u0446\u0456:"month",\u043C\u0456\u0441\u044F\u0446\u044F:"month",\u043A\u0432\u0430\u0440\u0442\u0430\u043B:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0443:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0430:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0456\u0432:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0456:"quarter",\u0440\u0456\u043A:"year",\u0440\u043E\u043A\u0443:"year",\u0440\u043E\u0446\u0456:"year",\u0440\u043E\u043A\u0456\u0432:"year",\u0440\u043E\u043A\u0438:"year"},WXe=`(?:${oe(eH)}|[0-9]+|[0-9]+\\.[0-9]+|\u043F\u0456\u0432|\u0434\u0435\u043A\u0456\u043B\u044C\u043A\u0430|\u043F\u0430\u0440(?:\u0443)|\\s{0,3})`;iH=`(?:${oe(tH)}|[0-9]{1,2}(?:\u0433\u043E|\u043E\u0433\u043E|\u0435)?)`;XU="(?:\\s+(?:\u0440\u043E\u043A\u0443|\u0440\u0456\u043A|\u0440|\u0440.))?",FA=`(?:[1-9][0-9]{0,3}${XU}\\s*(?:\u043D.\u0435.|\u0434\u043E \u043D.\u0435.|\u043D. \u0435.|\u0434\u043E \u043D. \u0435.)|[1-2][0-9]{3}${XU}|[5-9][0-9]${XU})`;hve=`(${WXe})\\s{0,3}(${oe(ix)})`,fve=new RegExp(hve,"i"),Zv=Ia("(?:(?:\u0431\u043B\u0438\u0437\u044C\u043A\u043E|\u043F\u0440\u0438\u0431\u043B\u0438\u0437\u043D\u043E)\\s{0,3})?",hve)});var gve,ax,yve=y(()=>{Ks();lt();we();gve=`(?:(?:\u043F\u0440\u0438\u0431\u043B\u0438\u0437\u043D\u043E|\u043E\u0440\u0456\u0454\u043D\u0442\u043E\u0432\u043D\u043E)\\s*(?:~\\s*)?)?(${Zv})${Ao.rightBoundary}`,ax=class extends V{patternLeftBoundary(){return Ao.leftBoundary}innerPattern(e){return e.option.forwardDate?new RegExp(gve,"i"):new RegExp(`(?:\u043F\u0440\u043E\u0442\u044F\u0433\u043E\u043C|\u043D\u0430 \u043F\u0440\u043E\u0442\u044F\u0437\u0456|\u043F\u0440\u043E\u0442\u044F\u0433\u043E\u043C|\u0443\u043F\u0440\u043E\u0434\u043E\u0432\u0436|\u0432\u043F\u0440\u043E\u0434\u043E\u0432\u0436)\\s*${gve}`,Ao.flags)}innerExtract(e,t){let n=Qv(t[1]);return ee.createRelativeFromReference(e.reference,n)}}});var _h,ss,vu=y(()=>{we();Ks();_h=class extends V{patternLeftBoundary(){return Ao.leftBoundary}innerPattern(e){return new RegExp(this.innerPatternString(e),Ao.flags)}innerPatternHasChange(e,t){return!1}},ss=class extends _h{innerPattern(e){return new RegExp(`${this.innerPatternString(e)}${Ao.rightBoundary}`,Ao.flags)}}});var vve,bve,KXe,Tve,sx,kve=y(()=>{Dn();Ks();Ks();Ks();At();vu();vve=1,bve=2,KXe=3,Tve=4,sx=class extends ss{innerPatternString(e){return`(?:\u0437|\u0456\u0437)?\\s*(${iH})(?:\\s{0,3}(?:\u043F\u043E|-|\u2013|\u0434\u043E)?\\s{0,3}(${iH}))?(?:-|\\/|\\s{0,3}(?:of)?\\s{0,3})(${oe(Kv)})(?:(?:-|\\/|,?\\s{0,3})(${FA}(?![^\\s]\\d)))?`}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=Kv[t[KXe].toLowerCase()],a=aH(t[vve]);if(a>31)return t.index=t.index+t[vve].length,null;if(n.start.assign("month",i),n.start.assign("day",a),t[Tve]){let s=$A(t[Tve]);n.start.assign("year",s)}else{let s=dr(e.reference.instant,a,i);n.start.imply("year",s)}if(t[bve]){let s=aH(t[bve]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var ZXe,wve,ox,Sve=y(()=>{Ks();Dn();At();Ks();vu();ZXe=2,wve=3,ox=class extends _h{innerPatternString(e){return`((?:\u0432|\u0443)\\s*)?(${oe(Kv)})\\s*(?:[,-]?\\s*(${FA})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`}innerExtract(e,t){let n=t[ZXe].toLowerCase();if(t[0].length<=3&&!nH[n])return null;let i=e.createParsingResult(t.index,t.index+t[0].length);i.start.imply("day",1);let a=Kv[n];if(i.start.assign("month",a),t[wve]){let s=$A(t[wve]);i.start.assign("year",s)}else{let s=dr(e.reference.instant,1,a);i.start.imply("year",s)}return i}}});var lx,Eve=y(()=>{Bt();pu();Ks();lx=class extends wi{constructor(e){super(e)}patternFlags(){return Ao.flags}primaryPatternLeftBoundary(){return"(^|\\s|T|(?:[^\\p{L}\\p{N}_]))"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|\u0434\u043E|\u0456|\u043F\u043E|\\?)\\s*"}primaryPrefix(){return"(?:(?:\u0432|\u0443|\u043E|\u043E\u0431|\u0437|\u0456\u0437|\u0432\u0456\u0434)\\s*)??"}primarySuffix(){return`(?:\\s*(?:\u0440\u0430\u043D\u043A\u0443|\u0432\u0435\u0447\u043E\u0440\u0430|\u043F\u043E \u043E\u0431\u0456\u0434\u0456|\u043F\u0456\u0441\u043B\u044F \u043E\u0431\u0456\u0434\u0443))?(?!\\/)${Ao.rightBoundary}`}extractPrimaryTimeComponents(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(n){if(t[0].endsWith("\u0432\u0435\u0447\u043E\u0440\u0430")){let i=n.get("hour");i>=6&&i<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",B.PM)):i<6&&n.assign("meridiem",B.AM)}if(t[0].endsWith("\u043F\u043E \u043E\u0431\u0456\u0434\u0456")||t[0].endsWith("\u043F\u0456\u0441\u043B\u044F \u043E\u0431\u0456\u0434\u0443")){n.assign("meridiem",B.PM);let i=n.get("hour");i>=0&&i<=6&&n.assign("hour",n.get("hour")+12)}t[0].endsWith("\u0440\u0430\u043D\u043A\u0443")&&(n.assign("meridiem",B.AM),n.get("hour")<12&&n.assign("hour",n.get("hour")))}return n}}});var cx,xve=y(()=>{Ks();lt();qs();vu();cx=class extends _h{innerPatternString(e){return`(${Zv})\\s{0,5}\u0442\u043E\u043C\u0443(?=(?:\\W|$))`}innerExtract(e,t){let n=Qv(t[1]),i=Gn(n);return ee.createRelativeFromReference(e.reference,i)}}});var dx,Cve=y(()=>{Eo();dx=class extends Jr{patternBetween(){return/^\s*(і до|і по|до|по|-)\s*$/i}}});var ux,Dve=y(()=>{xo();ux=class extends Xr{patternBetween(){return new RegExp("^\\s*(T|\u0432|\u0443|\u043E|,|-)?\\s*$")}}});var px,Pve=y(()=>{Vs();vu();px=class extends ss{innerPatternString(e){return"(?:\u0437|\u0456\u0437|\u0432\u0456\u0434)?\\s*(\u0441\u044C\u043E\u0433\u043E\u0434\u043D\u0456|\u0432\u0447\u043E\u0440\u0430|\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u0456\u0441\u043B\u044F\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u0456\u0441\u043B\u044F\u043F\u0456\u0441\u043B\u044F\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0437\u0430\u043F\u043E\u0437\u0430\u0432\u0447\u043E\u0440\u0430|\u043F\u043E\u0437\u0430\u0432\u0447\u043E\u0440\u0430)"}innerExtract(e,t){let n=t[1].toLowerCase(),i=e.createParsingComponents();switch(n){case"\u0441\u044C\u043E\u0433\u043E\u0434\u043D\u0456":return Si(e.reference);case"\u0432\u0447\u043E\u0440\u0430":return sa(e.reference);case"\u0437\u0430\u0432\u0442\u0440\u0430":return oa(e.reference);case"\u043F\u0456\u0441\u043B\u044F\u0437\u0430\u0432\u0442\u0440\u0430":return bc(e.reference,2);case"\u043F\u0456\u0441\u043B\u044F\u043F\u0456\u0441\u043B\u044F\u0437\u0430\u0432\u0442\u0440\u0430":return bc(e.reference,3);case"\u043F\u043E\u0437\u0430\u0432\u0447\u043E\u0440\u0430":return uh(e.reference,2);case"\u043F\u043E\u0437\u0430\u043F\u043E\u0437\u0430\u0432\u0447\u043E\u0440\u0430":return uh(e.reference,3)}return i}}});var Mve,mx,_ve=y(()=>{Vs();Us();Mve=tt(Xt(),1);vu();mx=class extends ss{innerPatternString(e){return"(\u0437\u0430\u0440\u0430\u0437|\u043C\u0438\u043D\u0443\u043B\u043E\u0433\u043E\\s*\u0432\u0435\u0447\u043E\u0440\u0430|\u043C\u0438\u043D\u0443\u043B\u043E\u0457\\s*\u043D\u043E\u0447\u0456|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u0457\\s*\u043D\u043E\u0447\u0456|\u0441\u044C\u043E\u0433\u043E\u0434\u043D\u0456\\s*\u0432\u043D\u043E\u0447\u0456|\u0446\u0456\u0454\u0457\\s*\u043D\u043E\u0447\u0456|\u0446\u044C\u043E\u0433\u043E \u0440\u0430\u043D\u043A\u0443|\u0432\u0440\u0430\u043D\u0446\u0456|\u0440\u0430\u043D\u043A\u0443|\u0437\u0440\u0430\u043D\u043A\u0443|\u043E\u043F\u0456\u0432\u0434\u043D\u0456|\u0432\u0432\u0435\u0447\u0435\u0440\u0456|\u0432\u0435\u0447\u043E\u0440\u0430|\u043E\u043F\u0456\u0432\u043D\u043E\u0447\u0456|\u0432\u043D\u043E\u0447\u0456)"}innerExtract(e,t){let n=(0,Mve.default)(e.reference.instant),i=t[0].toLowerCase(),a=e.createParsingComponents();if(i==="\u0437\u0430\u0440\u0430\u0437")return aa(e.reference);if(i==="\u0432\u0432\u0435\u0447\u0435\u0440\u0456"||i==="\u0432\u0435\u0447\u043E\u0440\u0430")return Iv(e.reference);if(i.endsWith("\u0432\u0440\u0430\u043D\u0446\u0456")||i.endsWith("\u0440\u0430\u043D\u043A\u0443")||i.endsWith("\u0437\u0440\u0430\u043D\u043A\u0443"))return Nv(e.reference);if(i.endsWith("\u043E\u043F\u0456\u0432\u0434\u043D\u0456"))return Rv(e.reference);if(i.match(/минулої\s*ночі/))return sA(e.reference);if(i.match(/минулого\s*вечора/))return oA(e.reference);if(i.match(/наступної\s*ночі/)){let s=n.hour()<22?1:2;n=n.add(s,"day"),Vr(a,n),a.imply("hour",1)}return i.match(/цієї\s*ночі/)?ph(e.reference):i.endsWith("\u043E\u043F\u0456\u0432\u043D\u043E\u0447\u0456")||i.endsWith("\u0432\u043D\u043E\u0447\u0456")?ph(e.reference):a}}});var QXe,JXe,XXe,fx,Ave=y(()=>{Ks();At();xl();vu();QXe=1,JXe=2,XXe=3,fx=class extends ss{innerPatternString(e){return`(?:(?:,|\\(|\uFF08)\\s*)?(?:\u0432\\s*?)?(?:\u0443\\s*?)?(?:(\u0446\u0435\u0439|\u043C\u0438\u043D\u0443\u043B\u043E\u0433\u043E|\u043C\u0438\u043D\u0443\u043B\u0438\u0439|\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u0456\u0439|\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u044C\u043E\u0433\u043E|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u0433\u043E|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u0438\u0439|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443)\\s*)?(${oe(rH)})(?:\\s*(?:,|\\)|\uFF09))?(?:\\s*(\u043D\u0430|\u0443|\u0432)\\s*(\u0446\u044C\u043E\u043C\u0443|\u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443)\\s*\u0442\u0438\u0436\u043D\u0456)?`}innerExtract(e,t){let n=t[JXe].toLocaleLowerCase(),i=rH[n],a=t[QXe],s=t[XXe],o=a||s;o=o||"",o=o.toLocaleLowerCase();let l=null;return o=="\u043C\u0438\u043D\u0443\u043B\u043E\u0433\u043E"||o=="\u043C\u0438\u043D\u0443\u043B\u0438\u0439"||o=="\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u0456\u0439"||o=="\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u044C\u043E\u0433\u043E"?l="last":o=="\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u0433\u043E"||o=="\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u0438\u0439"?l="next":(o=="\u0446\u0435\u0439"||o=="\u0446\u044C\u043E\u0433\u043E"||o=="\u0446\u044C\u043E\u043C\u0443")&&(l="this"),Kn(e.reference,i,l)}}});var Ive,eet,tet,hx,Nve=y(()=>{Ks();lt();Ive=tt(Xt(),1);At();vu();eet=1,tet=2,hx=class extends ss{innerPatternString(e){return`(\u0432 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443|\u0443 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443|\u043D\u0430 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443|\u043C\u0438\u043D\u0443\u043B\u043E\u0433\u043E|\u043D\u0430 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443|\u0432 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443|\u0443 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u0433\u043E|\u043D\u0430 \u0446\u044C\u043E\u043C\u0443|\u0432 \u0446\u044C\u043E\u043C\u0443|\u0443 \u0446\u044C\u043E\u043C\u0443|\u0446\u044C\u043E\u0433\u043E)\\s*(${oe(ix)})(?=\\s*)`}innerExtract(e,t){let n=t[eet].toLowerCase(),i=t[tet].toLowerCase(),a=ix[i];if(n=="\u043D\u0430 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443"||n=="\u0432 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443"||n=="\u0443 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443"||n=="\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u0433\u043E"){let l={};return l[a]=1,ee.createRelativeFromReference(e.reference,l)}if(n=="\u043D\u0430 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443"||n=="\u0432 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443"||n=="\u0443 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443"||n=="\u043C\u0438\u043D\u0443\u043B\u043E\u0433\u043E"){let l={};return l[a]=-1,ee.createRelativeFromReference(e.reference,l)}let s=e.createParsingComponents(),o=(0,Ive.default)(e.reference.instant);return a.match(/week/i)?(o=o.add(-o.get("d"),"d"),s.imply("day",o.date()),s.imply("month",o.month()+1),s.imply("year",o.year())):a.match(/month/i)?(o=o.add(-o.date()+1,"d"),s.imply("day",o.date()),s.assign("year",o.year()),s.assign("month",o.month()+1)):a.match(/year/i)&&(o=o.add(-o.date()+1,"d"),o=o.add(-o.month(),"month"),s.imply("day",o.date()),s.imply("month",o.month()+1),s.assign("year",o.year())),s}}});var gx,Rve=y(()=>{Ks();lt();qs();vu();gx=class extends ss{innerPatternString(e){return`(\u0446\u0456|\u043E\u0441\u0442\u0430\u043D\u043D\u0456|\u043C\u0438\u043D\u0443\u043B\u0456|\u043C\u0430\u0439\u0431\u0443\u0442\u043D\u0456|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u0456|\u043F\u0456\u0441\u043B\u044F|\u0447\u0435\u0440\u0435\u0437|\\+|-)\\s*(${Zv})`}innerExtract(e,t){let n=t[1].toLowerCase(),i=Qv(t[3]);switch(n){case"\u043E\u0441\u0442\u0430\u043D\u043D\u0456":case"\u043C\u0438\u043D\u0443\u043B\u0456":case"-":i=Gn(i);break}return ee.createRelativeFromReference(e.reference,i)}}});var lH={};et(lH,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>sH,createCasualConfiguration:()=>Ove,createConfiguration:()=>oH,parse:()=>net,parseDate:()=>iet,strict:()=>ret});function Ove(){let r=oH(!1);return r.parsers.unshift(new px),r.parsers.unshift(new mx),r.parsers.unshift(new ox),r.parsers.unshift(new hx),r.parsers.unshift(new gx),r}function oH(r){return ln({parsers:[new fu,new oi(!0),new ax,new sx,new fx,new lx(r),new cx],refiners:[new ux,new dx]},r)}function net(r,e,t){return sH.parse(r,e,t)}function iet(r,e,t){return sH.parseDate(r,e,t)}var sH,ret,Lve=y(()=>{yve();kve();Sve();Eve();xve();Cve();Dve();Hs();Pve();_ve();Ave();Nve();is();lt();Bt();hu();Rve();aA();sH=new ze(Ove()),ret=new ze(oH(!0))});var zA={};et(zA,{Chrono:()=>ze,Meridiem:()=>B,ParsingComponents:()=>ee,ParsingContext:()=>AS,ParsingResult:()=>Wt,ReferenceWithTimezone:()=>er,Weekday:()=>We,casual:()=>cH,de:()=>O2,en:()=>C2,es:()=>JU,fr:()=>q2,ja:()=>K2,nl:()=>lU,parse:()=>set,parseDate:()=>oet,pt:()=>eU,ru:()=>WU,strict:()=>aet,uk:()=>lH,zh:()=>LU});function set(r,e,t){return cH.parse(r,e,t)}function oet(r,e,t){return cH.parseDate(r,e,t)}var aet,cH,Fve=y(()=>{Kfe();is();lt();Bt();The();Vhe();age();Tge();Gge();Sye();Wye();mve();Lve();aet=x2,cH=IS});var cet,jA,$ve=y(()=>{Br();Fve();mv();i2();a2();n2();cet=ye,jA=class{constructor(e=[],t=[],n=!0,i="en",a,s,o={}){this.isValidDateString=c=>/^\d{4}-\d{2}-\d{2}$/.test(c),this.isValidTimeString=c=>/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(c),this.escapeRegex=c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),this.cleanupWhitespace=c=>c.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"").trim(),this.defaultToScheduled=n,this.languageConfig=jme(i),this.options=o,this.statusConfigs=e,this.priorityConfigs=t;let l=a||mme;this.triggerConfig=new X_(l,s||[]),this.boundaries=this.createBoundaryConfig(),this.recurrencePatterns=this.buildRecurrencePatterns(),this.processingPipeline=this.buildProcessingPipeline()}createBoundaryConfig(){let e=["ru","zh","ja","uk","fr"].includes(this.languageConfig.code);return{boundary:e?"(?:^|\\s)":"\\b",endBoundary:e?"(?=\\s|$)":"\\b",isNonAscii:e}}getChronoParser(){let e=this.languageConfig.chronoLocale;return zA[e]||zA}buildProcessingPipeline(){return[{name:"extractTags",process:(e,t)=>this.extractTags(e,t)},{name:"extractContexts",process:(e,t)=>this.extractContexts(e,t)},{name:"extractProjects",process:(e,t)=>this.extractProjects(e,t)},{name:"extractPriority",process:(e,t)=>this.extractPriority(e,t)},{name:"extractStatus",process:(e,t)=>this.extractStatus(e,t)},{name:"extractRecurrence",process:(e,t)=>this.extractRecurrence(e,t)},{name:"extractTimeEstimate",process:(e,t)=>this.extractTimeEstimate(e,t)},{name:"extractUserFields",process:(e,t)=>this.extractUserFields(e,t)},{name:"parseUnifiedDatesAndTimes",process:(e,t)=>this.parseUnifiedDatesAndTimes(e,t)}]}parseInput(e){let t={title:"",tags:[],contexts:[],projects:[]},n=this.protectNlpLiterals(e),i=this.normalizeNumericDateLiterals(n.text),[a,s]=this.extractTitleAndDetails(i);s&&(t.details=s);let o=a;for(let c of this.processingPipeline)try{o=c.process(o,t)}catch(d){console.debug(`Error in processor ${c.name}:`,d)}t.title=o.trim();let l=this.validateAndCleanupResult(t);return this.restoreProtectedLiterals(l,n.literals),l}protectNlpLiterals(e){let t=this.protectQuotedLiterals(e);return this.protectEscapedLiterals(t.text,t.literals)}protectQuotedLiterals(e){let t=[],n="",i=0;for(;i=e.length||!this.shouldProtectEscapedLiteral(e,i,a)){n+=e[i],i+=1;continue}let s=a;for(;sthis.restoreProtectedLiteralsInText(a,t))}restoreProtectedLiteralsInText(e,t){let n=e;return t.forEach((i,a)=>{n=n.replace(`__TASKNOTES_NLP_LITERAL_${a}__`,i)}),n}isQuoteDelimiter(e){return e==='"'||e==="'"||e==="`"}isEligibleQuoteStart(e,t){if(e[t]!=="'")return!0;let i=t>0?e[t-1]:"";return!this.isWordCharacter(i)}isEligibleQuoteEnd(e,t){if(e[t]!=="'")return!0;let i=t+10?e[i-1]:"")==="\\"))return i;return-1}shouldProtectEscapedLiteral(e,t,n){if(this.startsWithEscapableTrigger(e,n))return!0;let i=t>0?e[t-1]:"";return i&&!/\s/u.test(i)?!1:/[\p{L}\p{N}]/u.test(e[n])}startsWithEscapableTrigger(e,t){return this.getEscapableTriggers().some(n=>e.startsWith(n,t))}getEscapableTriggers(){let e=this.triggerConfig.getTriggersOrderedByLength().map(t=>t.trigger).filter(t=>t.length>0);return e.length>0?e:["#","@","+","*","!"]}normalizeNumericDateLiterals(e){let t=e.replace(/(^|[^\p{L}\p{N}_])(\d{4})[/.](\d{1,2})[/.](\d{1,2})(?=$|[^\p{L}\p{N}_])/gu,(n,i,a,s,o)=>{let l=this.toValidatedISODate(Number(a),Number(s),Number(o));return l?`${i}${l}`:n});return this.getNumericDateOrder()!=="day-first"?t:t.replace(/(^|[^\p{L}\p{N}_])(\d{1,2})[/.](\d{1,2})[/.](\d{4})(?=$|[^\p{L}\p{N}_])/gu,(n,i,a,s,o)=>{let l=this.toValidatedISODate(Number(o),Number(s),Number(a));return l?`${i}${l}`:n})}getNumericDateOrder(){if(this.options.dateOrder)return this.options.dateOrder;let e=this.options.dateLocale||this.languageConfig.code;try{let n=new Intl.DateTimeFormat(e).formatToParts(new Date(2006,10,22)).find(i=>i.type==="day"||i.type==="month"||i.type==="year");if((n==null?void 0:n.type)==="day")return"day-first"}catch(t){}return"month-first"}toValidatedISODate(e,t,n){let i=new Date(Date.UTC(e,t-1,n));return i.getUTCFullYear()!==e||i.getUTCMonth()!==t-1||i.getUTCDate()!==n?null:`${e}-${this.padDatePart(t)}-${this.padDatePart(n)}`}padDatePart(e){return String(e).padStart(2,"0")}extractTitleAndDetails(e){let t=e.trim(),n=t.indexOf(` +`);if(n!==-1){let i=t.substring(0,n).trim(),a=t.substring(n+1).trim();return[i,a]}return[t,void 0]}extractTags(e,t){let n=this.triggerConfig.getTagTrigger();if(!n)return e;let i=this.escapeRegex(n),a=new RegExp(`${i}[\\p{L}\\p{N}\\p{M}_/-]+`,"gu"),s=e.match(a);return s?(t.tags.push(...s.map(o=>o.substring(n.length))),this.cleanupWhitespace(e.replace(a,""))):e}extractContexts(e,t){let n=this.triggerConfig.getContextTrigger();if(!n)return e;let i=this.escapeRegex(n),a=new RegExp(`${i}[\\p{L}\\p{N}\\p{M}_/-]+`,"gu"),s=e.match(a);return s?(t.contexts.push(...s.map(o=>o.substring(n.length))),this.cleanupWhitespace(e.replace(a,""))):e}extractProjects(e,t){let n=this.triggerConfig.getProjectTrigger();if(!n)return e;let i=e,a=this.escapeRegex(n),s=new RegExp(`${a}\\[\\[.*?\\]\\]`,"g"),o=i.match(s);o&&(t.projects.push(...o.map(d=>d.slice(n.length))),i=this.cleanupWhitespace(i.replace(s,"")));let l=new RegExp(`${a}[\\p{L}\\p{N}\\p{M}_/-]+`,"gu"),c=i.match(l);return c&&(t.projects.push(...c.map(d=>d.substring(n.length))),i=this.cleanupWhitespace(i.replace(l,""))),i}extractUserFields(e,t){let n=e,i=this.triggerConfig.getAllEnabledTriggers().filter(a=>this.triggerConfig.isUserField(a.propertyId));for(let a of i){let s=this.triggerConfig.getUserField(a.propertyId);if(!s)continue;let o=this.escapeRegex(a.trigger);if(s.type==="list"){let l=new RegExp(`${o}(?:"([^"]+)"|([\\p{L}\\p{N}\\p{M}_/-]+))`,"gu"),c=[],d;for(;(d=l.exec(n))!==null;){let u=d[1]||d[2];c.push(u)}c.length>0&&(t.userFields||(t.userFields={}),t.userFields[s.id]=c,n=this.cleanupWhitespace(n.replace(l,"")))}else if(s.type==="text"||s.type==="boolean"||s.type==="number"){let l=new RegExp(`${o}(?:"([^"]+)"|([\\p{L}\\p{N}\\p{M}_/-]+))`,"u"),c=n.match(l);if(c){let d=c[1]||c[2];t.userFields||(t.userFields={}),s.type==="boolean"?t.userFields[s.id]=d.toLowerCase()==="true"?"true":"false":t.userFields[s.id]=d,n=this.cleanupWhitespace(n.replace(l,""))}}else if(s.type==="date"){let l=new RegExp(`${o}(?:"([^"]+)"|([\\p{L}\\p{N}\\p{M}_/-]+))`,"u"),c=n.match(l);if(c){let d=c[1]||c[2];t.userFields||(t.userFields={}),t.userFields[s.id]=d,n=this.cleanupWhitespace(n.replace(l,""))}}}return n}extractPriority(e,t){if(this.priorityConfigs.length>0){let a=[...this.priorityConfigs].sort((l,c)=>c.label.length-l.label.length),s=this.triggerConfig.getTriggerForProperty("priority"),o=s!=null&&s.enabled?s.trigger:"";for(let l of a){let c=[l.label,l.value];for(let d of c){if(!d||d.trim()==="")continue;if(o){let p=o+d,m=this.findTextMatch(e,p);if(m)return t.priority=l.value,this.cleanupWhitespace(e.replace(m.fullMatch,""))}let u=this.findTextMatch(e,d);if(u)return t.priority=l.value,this.cleanupWhitespace(e.replace(u.fullMatch,""))}}return e}let n=this.languageConfig.fallbackPriority,i=this.findPhraseValueMatch(e,[{value:"urgent",phrases:n.urgent},{value:"high",phrases:n.high},{value:"normal",phrases:n.normal},{value:"low",phrases:n.low}]);return i?(t.priority=i.value,this.removePhraseMatch(e,i.match)):e}extractStatus(e,t){if(this.statusConfigs.length>0){let a=[...this.statusConfigs].sort((l,c)=>c.label.length-l.label.length),s=this.triggerConfig.getTriggerForProperty("status"),o=s!=null&&s.enabled?s.trigger:"";for(let l of a){let c=[l.label,l.value];for(let d of c){if(!d||d.trim()==="")continue;if(o){let p=o+d,m=this.findTextMatch(e,p);if(m)return t.status=l.value,this.cleanupWhitespace(e.replace(m.fullMatch,""))}let u=this.findTextMatch(e,d);if(u)return t.status=l.value,this.cleanupWhitespace(e.replace(u.fullMatch,""))}}return e}let n=this.languageConfig.fallbackStatus,i=this.findPhraseValueMatch(e,[{value:"open",phrases:n.open},{value:"in-progress",phrases:n.inProgress},{value:"done",phrases:n.done},{value:"cancelled",phrases:n.cancelled},{value:"waiting",phrases:n.waiting}]);return i?(t.status=i.value,this.removePhraseMatch(e,i.match)):e}findTextMatch(e,t){let n=this.findPhraseMatch(e,[t]);if(!n)return null;let i=this.includeTrailingPhraseSeparator(e,n.endIndex);return{fullMatch:e.substring(n.startIndex,i),startIndex:n.startIndex}}findPhraseMatch(e,t){let n=t.filter(s=>s&&s.trim()!=="").sort((s,o)=>o.length-s.length);if(n.length===0)return null;let i=e.toLowerCase(),a=null;for(let s of n){let o=s.toLowerCase(),l=0;for(;l<=i.length;){let c=i.indexOf(o,l);if(c===-1)break;let d=c+s.length;if(this.hasPhraseBoundaries(e,c,d)){let u={fullMatch:e.substring(c,d),phrase:s,startIndex:c,endIndex:d};(!a||u.startIndexa.phrase.length)&&(a=u)}l=c+1}}return a}findPhraseValueMatch(e,t){let n=null;for(let i of t){let a=this.findPhraseMatch(e,i.phrases);a&&(!n||a.startIndexn.match.phrase.length)&&(n={value:i.value,match:a})}return n}removePhraseMatch(e,t){let n=this.includeTrailingPhraseSeparator(e,t.endIndex);return this.cleanupWhitespace(e.substring(0,t.startIndex)+e.substring(n))}hasPhraseBoundaries(e,t,n){if(["zh","ja"].includes(this.languageConfig.code))return!0;let i=this.getCodePointBefore(e,t),a=this.getCodePointAt(e,n);return!this.isWordCharacter(i)&&!this.isWordCharacter(a)}getCodePointBefore(e,t){return t<=0?"":Array.from(e.slice(0,t)).pop()||""}getCodePointAt(e,t){return t>=e.length?"":Array.from(e.slice(t))[0]||""}isWordCharacter(e){return e!==""&&/[\p{L}\p{N}\p{M}_]/u.test(e)}includeTrailingPhraseSeparator(e,t){return/[:,;]/.test(e[t]||"")?t+1:t}parseUnifiedDatesAndTimes(e,t){var i,a;let n=e;try{let s=this.getChronoParser(),o=this.languageConfig.dateTriggers,l=[{type:"due",phrases:o.due},{type:"scheduled",phrases:o.scheduled}],c=!1;for(let v of l){let k=this.findPhraseMatch(n,v.phrases);if(k){let b=n.substring(k.endIndex),w=this.parseChronoFromPosition(b);if(w.success){c=!0,v.type==="due"?(t.dueDate=w.date,w.time&&(t.dueTime=w.time)):(t.scheduledDate=w.date,w.time&&(t.scheduledTime=w.time));let S=this.getChronoMatchOffset(b,w),x=w.matchedText?k.endIndex+S+w.matchedText.length:k.endIndex;n=n.substring(0,k.startIndex)+n.substring(x),n=this.cleanupWhitespace(n)}}}if(c)return n;let d=s.parse(e,new Date,{forwardDate:!0});if(d.length===0)return e;let u=d[0],p=u.text,m=u.start.date(),f=(i=u.end)==null?void 0:i.date(),h=this.findPhraseMatch(u.text,o.due)!==null,g=this.findPhraseMatch(u.text,o.scheduled)!==null;if(f&&bi(f)&&f.getTime()!==m.getTime())t.scheduledDate=P(m,"yyyy-MM-dd"),u.start.isCertain("hour")&&(t.scheduledTime=P(m,"HH:mm")),t.dueDate=P(f,"yyyy-MM-dd"),(a=u.end)!=null&&a.isCertain("hour")&&(t.dueTime=P(f,"HH:mm"));else if(bi(m)){let v=P(m,"yyyy-MM-dd"),k=u.start.isCertain("hour")?P(m,"HH:mm"):void 0;h&&!g?(t.dueDate=v,t.dueTime=k):g&&!h||this.defaultToScheduled?(t.scheduledDate=v,t.scheduledTime=k):(t.dueDate=v,t.dueTime=k)}n=n.replace(p,"").trim(),n=this.cleanupWhitespace(n)}catch(s){console.debug("Error in unified date parsing:",s)}return n}parseChronoFromPosition(e){try{let n=this.getChronoParser().parse(e,new Date,{forwardDate:!0});if(n.length>0){let i=n[0];if(i.index<=3){let a=i.start.date();if(bi(a)){let s={success:!0,date:P(a,"yyyy-MM-dd"),matchedText:i.text,startIndex:i.index};return i.start.isCertain("hour")&&(s.time=P(a,"HH:mm")),s}}}}catch(t){console.debug("Error parsing date with chrono:",t)}return{success:!1}}getChronoMatchOffset(e,t){var a;let n=(a=t.startIndex)!=null?a:0;if(!t.matchedText)return n;let i=e.indexOf(t.matchedText);return i!==-1?i:n}buildRecurrencePatterns(){let e=this.languageConfig.recurrence,t=[],{boundary:n,endBoundary:i}=this.boundaries,a=s=>s.map(o=>this.escapeRegex(o)).join("|");return t.push(...this.buildOrdinalWeekdayPatterns(e,n,i,a)),t.push(...this.buildIntervalPatterns(e,n,i,a)),t.push(...this.buildEveryOtherPatterns(e,n,i,a)),t.push(...this.buildWeekdayPatterns(e,n,i,a)),t.push(...this.buildFrequencyPatterns(e,n,i,a)),t}buildOrdinalWeekdayPatterns(e,t,n,i){let a=i(e.every),s=i([...e.ordinals.first,...e.ordinals.second,...e.ordinals.third,...e.ordinals.fourth,...e.ordinals.last]),o=i([...e.weekdays.monday,...e.weekdays.tuesday,...e.weekdays.wednesday,...e.weekdays.thursday,...e.weekdays.friday,...e.weekdays.saturday,...e.weekdays.sunday]);return[{regex:new RegExp(`${t}(${a})\\s+(${s})\\s+(${o})${n}`,"i"),handler:l=>{let c=l[2].toLowerCase(),d=l[3].toLowerCase(),u=1;return e.ordinals.second.some(m=>m.toLowerCase()===c)?u=2:e.ordinals.third.some(m=>m.toLowerCase()===c)?u=3:e.ordinals.fourth.some(m=>m.toLowerCase()===c)?u=4:e.ordinals.last.some(m=>m.toLowerCase()===c)&&(u=-1),`FREQ=MONTHLY;BYDAY=${this.getWeekdayRRuleCode(d,e)};BYSETPOS=${u}`}}]}buildIntervalPatterns(e,t,n,i){let a=i(e.every),s=i([...e.periods.day,...e.periods.week,...e.periods.month,...e.periods.year]);return[{regex:new RegExp(`${t}(${a})\\s+(\\d+)\\s+(${s})${n}`,"i"),handler:o=>{let l=parseInt(o[2]),c=o[3].toLowerCase();return`FREQ=${this.getPeriodFrequency(c,e)};INTERVAL=${l}`}}]}buildEveryOtherPatterns(e,t,n,i){let a=i(e.every),s=i(e.other),o=i([...e.periods.day,...e.periods.week,...e.periods.month,...e.periods.year]);return[{regex:new RegExp(`${t}(${a})\\s+(${s})\\s+(${o})${n}`,"i"),handler:l=>{let c=l[3].toLowerCase();return`FREQ=${this.getPeriodFrequency(c,e)};INTERVAL=2`}}]}buildWeekdayPatterns(e,t,n,i){let a=i(e.every),s=i([...e.weekdays.monday,...e.weekdays.tuesday,...e.weekdays.wednesday,...e.weekdays.thursday,...e.weekdays.friday,...e.weekdays.saturday,...e.weekdays.sunday]),o=i([...e.pluralWeekdays.monday,...e.pluralWeekdays.tuesday,...e.pluralWeekdays.wednesday,...e.pluralWeekdays.thursday,...e.pluralWeekdays.friday,...e.pluralWeekdays.saturday,...e.pluralWeekdays.sunday]);return[{regex:new RegExp(`${t}(${a})\\s+(${s})${n}`,"i"),handler:l=>{let c=l[2].toLowerCase();return`FREQ=WEEKLY;BYDAY=${this.getWeekdayRRuleCode(c,e)}`}},{regex:new RegExp(`${t}(${o})${n}`,"i"),handler:l=>{let c=l[1].toLowerCase();return`FREQ=WEEKLY;BYDAY=${this.getPluralWeekdayRRuleCode(c,e)}`}}]}buildFrequencyPatterns(e,t,n,i){return[{regex:new RegExp(`${t}(${i(e.frequencies.daily)})${n}`,"i"),handler:()=>"FREQ=DAILY"},{regex:new RegExp(`${t}(${i(e.frequencies.weekly)})${n}`,"i"),handler:()=>"FREQ=WEEKLY"},{regex:new RegExp(`${t}(${i(e.frequencies.monthly)})${n}`,"i"),handler:()=>"FREQ=MONTHLY"},{regex:new RegExp(`${t}(${i(e.frequencies.yearly)})${n}`,"i"),handler:()=>"FREQ=YEARLY"}]}getPeriodFrequency(e,t){return t.periods.week.some(n=>n.toLowerCase()===e)?"WEEKLY":t.periods.month.some(n=>n.toLowerCase()===e)?"MONTHLY":t.periods.year.some(n=>n.toLowerCase()===e)?"YEARLY":"DAILY"}getWeekdayRRuleCode(e,t){return t.weekdays.tuesday.some(n=>n.toLowerCase()===e)?"TU":t.weekdays.wednesday.some(n=>n.toLowerCase()===e)?"WE":t.weekdays.thursday.some(n=>n.toLowerCase()===e)?"TH":t.weekdays.friday.some(n=>n.toLowerCase()===e)?"FR":t.weekdays.saturday.some(n=>n.toLowerCase()===e)?"SA":t.weekdays.sunday.some(n=>n.toLowerCase()===e)?"SU":"MO"}getPluralWeekdayRRuleCode(e,t){return t.pluralWeekdays.tuesday.some(n=>n.toLowerCase()===e)?"TU":t.pluralWeekdays.wednesday.some(n=>n.toLowerCase()===e)?"WE":t.pluralWeekdays.thursday.some(n=>n.toLowerCase()===e)?"TH":t.pluralWeekdays.friday.some(n=>n.toLowerCase()===e)?"FR":t.pluralWeekdays.saturday.some(n=>n.toLowerCase()===e)?"SA":t.pluralWeekdays.sunday.some(n=>n.toLowerCase()===e)?"SU":"MO"}extractRecurrence(e,t){for(let n of this.recurrencePatterns){let i=e.match(n.regex);if(i){let a=n.handler(i);if(this.isValidRRuleString(a))return t.recurrence=a,this.cleanupWhitespace(e.replace(n.regex,""))}}return e}isValidRRuleString(e){if(e.includes("BYDAY=undefined")||e.includes("BYDAY=;")||e.includes("BYDAY=")){let t=e.match(/BYDAY=([^;]*)/);if(t&&(!t[1]||t[1]==="undefined"||t[1].trim()===""))return!1}return!!e.includes("FREQ=")}extractTimeEstimate(e,t){let n=this.languageConfig.timeEstimate,{boundary:i,endBoundary:a}=this.boundaries,s=[{regex:new RegExp(`${i}(\\d+)(${n.hours.map(c=>this.escapeRegex(c)).join("|")})\\s*(\\d+)(${n.minutes.map(c=>this.escapeRegex(c)).join("|")})${a}`,"i"),handler:c=>parseInt(c[1])*60+parseInt(c[3])},{regex:new RegExp(`${i}(\\d+)\\s*(${n.hours.map(c=>this.escapeRegex(c)).join("|")})${a}`,"i"),handler:c=>parseInt(c[1])*60},{regex:new RegExp(`${i}(\\d+)\\s*(${n.minutes.map(c=>this.escapeRegex(c)).join("|")})${a}`,"i"),handler:c=>parseInt(c[1])}],o=e,l=0;for(let c of s){let d=o.match(c.regex);d&&(l+=c.handler(d),o=this.cleanupWhitespace(o.replace(c.regex,"")))}return l>0&&(t.estimate=l),o}validateAndCleanupResult(e){return e.title.trim()||(e.title="Untitled Task"),e.tags=[...new Set(e.tags.filter(Boolean))],e.contexts=[...new Set(e.contexts.filter(Boolean))],e.projects=[...new Set(e.projects.filter(Boolean))],e.dueDate&&!this.isValidDateString(e.dueDate)&&delete e.dueDate,e.scheduledDate&&!this.isValidDateString(e.scheduledDate)&&delete e.scheduledDate,e.dueTime&&!this.isValidTimeString(e.dueTime)&&delete e.dueTime,e.scheduledTime&&!this.isValidTimeString(e.scheduledTime)&&delete e.scheduledTime,e}getPreviewData(e){let t=[];if(e.title&&t.push({icon:"edit-3",text:`"${e.title}"`}),e.details&&t.push({icon:"file-text",text:`Details: "${e.details.substring(0,50)}${e.details.length>50?"...":""}"`}),e.dueDate){let n=e.dueTime?`${e.dueDate} at ${e.dueTime}`:e.dueDate;t.push({icon:"calendar",text:`Due: ${n}`})}if(e.scheduledDate){let n=e.scheduledTime?`${e.scheduledDate} at ${e.scheduledTime}`:e.scheduledDate;t.push({icon:"calendar-clock",text:`Scheduled: ${n}`})}if(e.priority&&t.push({icon:"alert-triangle",text:`Priority: ${e.priority}`}),e.status&&t.push({icon:"activity",text:`Status: ${e.status}`}),e.contexts&&e.contexts.length>0&&t.push({icon:"map-pin",text:`Contexts: ${e.contexts.map(n=>"@"+n).join(", ")}`}),e.projects&&e.projects.length>0){let n=e.projects.map(i=>`+${i}`).join(", ");t.push({icon:"folder",text:`Projects: ${n}`})}if(e.tags&&e.tags.length>0&&t.push({icon:"tag",text:`Tags: ${e.tags.map(n=>"#"+n).join(", ")}`}),e.recurrence){let n="Invalid recurrence";try{e.recurrence.includes("FREQ=")&&this.isValidRRuleString(e.recurrence)&&(n=cet.fromString(e.recurrence).toText())}catch(i){console.debug("Error parsing rrule for preview:",i)}t.push({icon:"repeat",text:`Recurrence: ${n}`})}if(e.estimate&&t.push({icon:"clock",text:`Estimate: ${e.estimate} min`}),e.userFields&&Object.keys(e.userFields).length>0)for(let[n,i]of Object.entries(e.userFields)){let a=this.triggerConfig.getUserField(n),s=(a==null?void 0:a.displayName)||n,o;Array.isArray(i)?o=i.join(", "):o=i,t.push({icon:"box",text:`${s}: ${o}`})}return t}getPreviewText(e){return this.getPreviewData(e).map(t=>t.text).join(" \u2022 ")}getStatusSuggestions(e,t=10){let n=e.toLowerCase();return this.statusConfigs.filter(i=>i&&typeof i.value=="string"&&typeof i.label=="string").filter(i=>i.value.trim()!==""&&i.label.trim()!=="").filter(i=>i.value.toLowerCase().includes(n)||i.label.toLowerCase().includes(n)).slice(0,t).map(i=>({value:i.value,label:i.label,display:i.label}))}}});var zve=y(()=>{pme();n2();i2();a2();$ve()});function det(){return typeof navigator!="undefined"&&navigator.language?navigator.language:void 0}function uet(r){var t,n;let e=(n=(t=r.settings.calendarViewSettings)==null?void 0:t.locale)==null?void 0:n.trim();return e||det()||r.settings.nlpLanguage||"en"}var Zn,wc=y(()=>{zve();Zn=class r extends jA{static fromPlugin(e){let t=e.settings;return new r(t.customStatuses,t.customPriorities,t.nlpDefaultToScheduled,t.nlpLanguage,t.nlpTriggers,t.userFields,{dateLocale:uet(e)})}constructor(e=[],t=[],n=!0,i="en",a,s,o){super(e,t,n,i,a,s,o),this.taskNotesNlpTriggers=a,this.taskNotesUserFields=s||[],this.taskNotesPriorityConfigs=t}parseInput(e){let t=super.parseInput(e),n=this.removePriorityShortcutResidue(e,t),i=this.extractLinkedUserFields(e,n);return this.normalizeUserFieldValues(i)}removePriorityShortcutResidue(e,t){if(!t.priority||this.taskNotesPriorityConfigs.length===0)return t;let n=this.taskNotesPriorityConfigs.find(c=>c.value===t.priority);if(!n)return t;let i=this.getPriorityTrigger(),a=[n.value,n.label].filter(c=>typeof c=="string"&&c.trim().length>0).flatMap(c=>i?[`${i}${c}`,c]:[c]),s=[n.label,n.value].filter(c=>typeof c=="string"&&c.trim().length>0),o=new Set;for(let c of a)if(this.containsToken(e,c))for(let d of s){let u=this.removeFirstCaseInsensitive(c,d);!u||u===c||o.add(u)}let l=t.title;for(let c of Array.from(o).sort((d,u)=>u.length-d.length))l=this.removeTokenFragment(l,c);return t.title=l||"Untitled Task",t}getPriorityTrigger(){var t;let e=(t=this.taskNotesNlpTriggers)==null?void 0:t.triggers.find(n=>n.propertyId==="priority");return(e==null?void 0:e.trigger)||""}containsToken(e,t){let n=this.escapeRegexLiteral(t);return new RegExp(`(^|\\s)${n}(?=\\s|$)`,"iu").test(e)}removeTokenFragment(e,t){let n=this.escapeRegexLiteral(t);return e.replace(new RegExp(`(^|\\s)${n}(?=\\s|$)`,"giu"),"$1").replace(/\s+/g," ").trim()}removeFirstCaseInsensitive(e,t){let n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?null:`${e.slice(0,n)}${e.slice(n+t.length)}`}normalizeUserFieldValues(e){if(!e.userFields)return e;let t=e.userFields;for(let n of this.taskNotesUserFields){if(n.type!=="boolean")continue;let i=t[n.id];if(typeof i!="string")continue;let a=i.trim().toLowerCase();a==="true"?t[n.id]=!0:a==="false"&&(t[n.id]=!1)}return e}extractLinkedUserFields(e,t){var a;let n=((a=this.taskNotesNlpTriggers)==null?void 0:a.triggers)||[];if(n.length===0||this.taskNotesUserFields.length===0)return t;let i=t.title;for(let s of n){if(!s.enabled)continue;let o=this.taskNotesUserFields.find(p=>p.id===s.propertyId);if(!o)continue;let l=this.escapeRegexLiteral(s.trigger),c=new RegExp(`${l}(\\[\\[[^\\]]+\\]\\]|\\[[^\\]]+\\]\\([^\\)]+\\))`,"gu"),d=Array.from(e.matchAll(c));if(d.length===0)continue;let u=d.map(p=>p[1]).filter(p=>typeof p=="string"&&p.length>0);if(u.length!==0){if(t.userFields||(t.userFields={}),o.type==="list"){let p=t.userFields[o.id],m=Array.isArray(p)?p:typeof p=="string"?[p]:[];t.userFields[o.id]=[...m,...u]}else t.userFields[o.id]=u[u.length-1];i=i.replace(c,"").replace(/\s+/g," ").trim()}}return t.title=i,t}escapeRegexLiteral(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}});function jve(r){return r.padStart(2,"0")}function Bve(r,e,t){let n=Number(r),i=Number(e),a=Number(t),s=new Date(n,i-1,a);return s.getFullYear()!==n||s.getMonth()!==i-1||s.getDate()!==a?null:`${r}-${jve(e)}-${jve(t)}`}function dH(r){let e=r.trim();if(!e)return null;let t=pet.exec(e);if(t)return Bve(t[1],t[2],t[3]);let n=met.exec(e);return n?Bve(n[1],n[2],n[3]):null}function uH(r,e,t){var n;r.value=e,(n=t.onCommit)==null||n.call(t,e),r.dispatchEvent(new Event("input",{bubbles:!0})),r.dispatchEvent(new Event("change",{bubbles:!0}))}function fet(r){return r.key.length===1&&/\d/.test(r.key)&&!r.altKey&&!r.ctrlKey&&!r.metaKey}function Sc(r,e={}){var c,d;let t="",n=0,i=(c=e.now)!=null?c:(()=>Date.now()),a=(d=e.typeBufferResetMs)!=null?d:1500,s=u=>{if(!fet(u))return;let p=i();p-n>a&&(t=""),n=p,t=`${t}${u.key}`.slice(-8);let m=dH(t);m&&(u.preventDefault(),t="",uH(r,m,e))},o=u=>{var f,h;let p=(h=(f=u.clipboardData)==null?void 0:f.getData("text"))!=null?h:"",m=dH(p);m&&(u.preventDefault(),t="",uH(r,m,e))},l=()=>{let u=dH(r.value);!u||u===r.value||(t="",uH(r,u,e))};return r.addEventListener("keydown",s),r.addEventListener("paste",o),r.addEventListener("input",l),()=>{r.removeEventListener("keydown",s),r.removeEventListener("paste",o),r.removeEventListener("input",l)}}var pet,met,yx=y(()=>{pet=/^(\d{4})(\d{2})(\d{2})$/,met=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/});var Wve={};et(Wve,{DateTimePickerModal:()=>Ih,formatCalendarDate:()=>Hve,getParsedDateTimeSelection:()=>Vve,parseNaturalLanguageDateTime:()=>qve});function Uve(r){return String(r).padStart(2,"0")}function Hve(r,e,t){return`${r}-${Uve(e+1)}-${Uve(t)}`}function Vve(r,e){let t=r.scheduledDate||r.dueDate,n=r.scheduledDate?r.scheduledTime:r.dueTime;if(e==="due"?(t=r.dueDate,n=r.dueTime):e==="scheduled"&&(t=r.scheduledDate,n=r.scheduledTime),t)return{date:t,time:n||null};let i=e==="due"?r.scheduledDate:r.dueDate,a=e==="due"?r.scheduledTime:r.dueTime;return i?{date:i,time:a||null}:null}function qve(r,e,t){let n=r.trim();return n?Vve(e.parseInput(n),t):null}function het(r,e){let t=new Date(r);return t.setDate(t.getDate()+e),t}function get(r){let e=new Date(r),t=(1-e.getDay()+7)%7||7;return e.setDate(e.getDate()+t),e}var Ah,Ih,BA=y(()=>{Ah=require("obsidian");wc();yx();Ih=class extends Ah.Modal{constructor(t,n){var i;super(t);this.naturalLanguageInput=null;this.dateInput=null;this.timeInput=null;this.selectButtonEl=null;this.detachDateInputBehavior=null;this.options=n,this.selectedDate=(i=n.currentDate)!=null?i:null}onOpen(){let{contentEl:t}=this;t.empty(),t.addClass("tasknotes-plugin","date-time-picker-modal"),this.options.title&&t.createEl("h3",{text:this.options.title,cls:"date-time-picker-modal__title"}),this.renderQuickActions(t),this.renderNaturalLanguageInput(t),this.renderDateInput(t),this.renderTimeInput(t),this.renderActions(t),this.updateSelectButtonState(),window.setTimeout(()=>{var n;(n=this.dateInput)==null||n.focus()},100)}onClose(){var t;(t=this.detachDateInputBehavior)==null||t.call(this),this.detachDateInputBehavior=null,this.contentEl.empty()}renderQuickActions(t){let n=new Date,i=[{label:"Today",date:n},{label:"Tomorrow",date:het(n,1)},{label:"Next week",date:get(n)}],a=t.createDiv({cls:"date-time-picker-modal__quick-actions"});for(let s of i)a.createEl("button",{text:s.label,cls:"date-time-picker-modal__quick-button",attr:{type:"button"}}).addEventListener("click",()=>{this.selectDate(Hve(s.date.getFullYear(),s.date.getMonth(),s.date.getDate()))})}renderNaturalLanguageInput(t){if(!this.canUseNaturalLanguageInput())return;let n=t.createDiv({cls:"date-time-picker-modal__nlp-row"});this.naturalLanguageInput=n.createEl("input",{cls:"date-time-picker-modal__nlp-input",attr:{type:"text",placeholder:"Tomorrow at 3pm","aria-label":"Natural language date"}}),this.naturalLanguageInput.addEventListener("keydown",a=>{a.key==="Enter"&&(a.preventDefault(),this.applyNaturalLanguageInput())});let i=n.createEl("button",{cls:"clickable-icon date-time-picker-modal__nlp-button",attr:{type:"button","aria-label":"Apply natural language date",title:"Apply natural language date"}});(0,Ah.setIcon)(i,"wand"),i.addEventListener("click",()=>this.applyNaturalLanguageInput())}renderDateInput(t){var o;let n=t.createDiv({cls:"date-time-picker-modal__date-field"});n.createEl("label",{text:"Date",cls:"date-time-picker-modal__field-label",attr:{for:"tasknotes-date-time-picker-date"}});let i=n.createDiv({cls:"date-time-picker-modal__native-date-control"});this.dateInput=i.createEl("input",{cls:"date-time-picker-modal__date-input",attr:{id:"tasknotes-date-time-picker-date",type:"date",value:(o=this.selectedDate)!=null?o:"","aria-label":"Date"}});let a=()=>{var l;this.updateSelectedDate(((l=this.dateInput)==null?void 0:l.value)||null)};this.dateInput.addEventListener("input",a),this.dateInput.addEventListener("change",a),this.detachDateInputBehavior=Sc(this.dateInput,{onCommit:l=>this.updateSelectedDate(l)}),this.dateInput.addEventListener("keydown",l=>{var c;l.key==="Enter"&&((c=this.dateInput)!=null&&c.value)&&(l.preventDefault(),this.updateSelectedDate(this.dateInput.value),this.confirmSelectedDate())});let s=i.createEl("button",{cls:"clickable-icon date-time-picker-modal__native-date-button",attr:{type:"button","aria-label":"Open native date picker",title:"Open native date picker"}});(0,Ah.setIcon)(s,"calendar-days"),s.addEventListener("click",()=>{var l,c,d;(c=(l=this.dateInput)==null?void 0:l.showPicker)==null||c.call(l),(d=this.dateInput)==null||d.focus()})}renderTimeInput(t){var i;let n=t.createDiv({cls:"date-time-picker-modal__time-field"});n.createEl("label",{text:"Time (optional)",cls:"date-time-picker-modal__field-label",attr:{for:"tasknotes-date-time-picker-time"}}),this.timeInput=n.createEl("input",{cls:"date-time-picker-modal__time-input",attr:{id:"tasknotes-date-time-picker-time",type:"time",value:(i=this.options.currentTime)!=null?i:""}}),this.timeInput.addEventListener("keydown",a=>{a.key==="Enter"&&this.selectedDate&&(a.preventDefault(),this.confirmSelectedDate())})}renderActions(t){let n=t.createDiv({cls:"date-time-picker-modal__actions"});this.options.currentDate&&n.createEl("button",{text:"Clear date",cls:"date-time-picker-modal__action-button",attr:{type:"button"}}).addEventListener("click",()=>{this.options.onSelect(null,null),this.close()}),n.createEl("button",{text:"Cancel",cls:"date-time-picker-modal__action-button",attr:{type:"button"}}).addEventListener("click",()=>this.close()),this.selectButtonEl=n.createEl("button",{text:"Select",cls:"mod-cta date-time-picker-modal__action-button",attr:{type:"button"}}),this.selectButtonEl.addEventListener("click",()=>this.confirmSelectedDate())}selectDate(t){this.updateSelectedDate(t),this.confirmSelectedDate()}updateSelectedDate(t){this.selectedDate=t,this.dateInput&&this.dateInput.value!==(t!=null?t:"")&&(this.dateInput.value=t!=null?t:""),this.updateSelectButtonState()}confirmSelectedDate(){var t;this.selectedDate&&(this.options.onSelect(this.selectedDate,((t=this.timeInput)==null?void 0:t.value)||null),this.close())}updateSelectButtonState(){this.selectButtonEl&&(this.selectButtonEl.disabled=!this.selectedDate)}canUseNaturalLanguageInput(){var t;return this.options.naturalLanguageParser?!0:!!((t=this.options.plugin)!=null&&t.settings.enableNaturalLanguageInput)}getNaturalLanguageParser(){var t;return this.options.naturalLanguageParser?this.options.naturalLanguageParser:(t=this.options.plugin)!=null&&t.settings.enableNaturalLanguageInput?Zn.fromPlugin(this.options.plugin):null}applyNaturalLanguageInput(){var a,s;let t=this.getNaturalLanguageParser(),n=(s=(a=this.naturalLanguageInput)==null?void 0:a.value)!=null?s:"",i=t?qve(n,t,this.options.dateRole):null;if(!i){new Ah.Notice("Could not find a date in that text.");return}this.options.onSelect(i.date,i.time),this.close()}}});var Gve={};et(Gve,{DateContextMenu:()=>Zs});function vet(r){if(!r||typeof r!="object")return null;let e=r;return e.nodeType!==1||typeof e.closest!="function"?null:e}function bet(){return(0,Yve.moment)()}function Tet(r){return r.setSubmenu()}var Yve,yet,Li,Zs,Nh=y(()=>{Yve=require("obsidian");du();BA();Ne();G();yet=I({tag:"Components/DateContextMenu"});Li=class Li{constructor(e){this.menu=new ki,this.options=e,this.buildMenu()}t(e,t,n){var i;return((i=this.options.plugin)==null?void 0:i.i18n.translate(e,n))||t||e}getFirstDayOfWeek(){var t,n,i;let e=(i=(n=(t=this.options.plugin)==null?void 0:t.settings)==null?void 0:n.calendarViewSettings)==null?void 0:i.firstDay;return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=6?e:0}buildMenu(){this.options.title&&(this.menu.addItem(a=>{a.setTitle(this.options.title||""),a.setIcon("calendar"),a.setDisabled(!0)}),this.menu.addSeparator());let e=this.getDateOptions(),t=e.filter(a=>a.category==="increment");t.length>0&&(t.forEach(a=>{this.menu.addItem(s=>{a.icon&&s.setIcon(a.icon),s.setTitle(a.label),s.onClick(async()=>{this.options.onSelect(a.value,null)})})}),this.menu.addSeparator()),e.filter(a=>a.category==="basic").forEach(a=>{this.menu.addItem(s=>{a.icon&&s.setIcon(a.icon);let l=a.value&&a.value===this.options.currentValue?this.t("contextMenus.date.selected","\u2713 {label}",{label:a.label}):a.label;s.setTitle(l),s.onClick(async()=>{this.options.onSelect(a.value,null)})})});let i=e.filter(a=>a.category==="weekday");i.length>0&&(this.menu.addSeparator(),this.menu.addItem(a=>{a.setTitle(this.t("contextMenus.date.weekdaysLabel","Weekdays")),a.setIcon("calendar");let s=Tet(a);i.forEach(o=>{s.addItem(l=>{let d=o.value&&o.value===this.options.currentValue?this.t("contextMenus.date.selected","\u2713 {label}",{label:o.label}):o.label;l.setTitle(d),l.setIcon("calendar"),l.onClick(async()=>{this.options.onSelect(o.value,null)})})})})),this.menu.addSeparator(),this.menu.addItem(a=>{a.setTitle(this.t("contextMenus.date.pickDateTime","Pick date & time\u2026")),a.setIcon("calendar"),a.onClick(async()=>{this.showDateTimePicker()})}),this.options.currentValue&&this.menu.addItem(a=>{a.setTitle(this.t("contextMenus.date.clearDate","Clear date")),a.setIcon("x"),a.onClick(async()=>{this.options.onSelect(null,null)})})}static closeActiveMenu(){let e=Li.activeMenu;Li.activeMenu=null,Li.activeTrigger=null,e==null||e.hide()}static getTriggerFromEvent(e){var n;let t=vet(e.target);return(n=t==null?void 0:t.closest('[data-tn-action="edit-date"], .task-card__metadata-date'))!=null?n:null}showWithTrigger(e,t){if(e&&Li.activeMenu&&Li.activeTrigger===e){Li.closeActiveMenu();return}Li.closeActiveMenu(),Li.activeMenu=this.menu,Li.activeTrigger=e,this.menu.onHide(()=>{Li.activeMenu===this.menu&&(Li.activeMenu=null,Li.activeTrigger=null)}),t()}getDateOptions(){let e=bet(),t=[];this.options.currentValue&&(t.push({label:this.t("contextMenus.date.increment.plusOneDay","+1 day"),value:gv(this.options.currentValue,1),icon:"plus",category:"increment"}),t.push({label:this.t("contextMenus.date.increment.minusOneDay","-1 day"),value:gv(this.options.currentValue,-1),icon:"minus",category:"increment"}),t.push({label:this.t("contextMenus.date.increment.plusOneWeek","+1 week"),value:gv(this.options.currentValue,7),icon:"plus-circle",category:"increment"}),t.push({label:this.t("contextMenus.date.increment.minusOneWeek","-1 week"),value:gv(this.options.currentValue,-7),icon:"minus-circle",category:"increment"})),t.push({label:this.t("contextMenus.date.basic.today","Today"),value:e.format("YYYY-MM-DD"),icon:"calendar-check",isToday:!0,category:"basic"}),t.push({label:this.t("contextMenus.date.basic.tomorrow","Tomorrow"),value:e.clone().add(1,"day").format("YYYY-MM-DD"),icon:"calendar-plus",category:"basic"});let n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=this.getFirstDayOfWeek();[...n.slice(i),...n.slice(0,i)].forEach(c=>{let d=n.indexOf(c),u=e.clone().day(d);u.isSameOrBefore(e,"day")&&(u=u.add(1,"week"));let p=this.t(`common.weekdays.${c.toLowerCase()}`,c);t.push({label:p,value:u.format("YYYY-MM-DD"),icon:"calendar",category:"weekday"})});let s=e.clone().day(6);(s.isBefore(e)||s.isSame(e,"day"))&&s.add(1,"week"),t.push({label:this.t("contextMenus.date.basic.thisWeekend","This weekend"),value:s.format("YYYY-MM-DD"),icon:"calendar-days",category:"basic"});let o=e.clone().day(1).add(1,"week");t.push({label:this.t("contextMenus.date.basic.nextWeek","Next week"),value:o.format("YYYY-MM-DD"),icon:"calendar-plus",category:"basic"});let l=e.clone().add(1,"month").startOf("month");return t.push({label:this.t("contextMenus.date.basic.nextMonth","Next month"),value:l.format("YYYY-MM-DD"),icon:"calendar-range",category:"basic"}),t}show(e){this.showWithTrigger(Li.getTriggerFromEvent(e),()=>{this.menu.show(e)})}showAtElement(e){this.showWithTrigger(e,()=>{this.menu.showAtPosition({x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().bottom+4})})}showDateTimePicker(){var n;let e=this.options.app||((n=this.options.plugin)==null?void 0:n.app);if(!e){yet.error("DateContextMenu: No app instance available for modal",{category:"validation",operation:"datecontextmenu-no-app-instance-modal"});return}new Ih(e,{currentDate:this.options.currentValue||null,currentTime:this.options.currentTime||null,title:this.t("contextMenus.date.modal.title","Set date & time"),dateRole:this.options.dateRole,plugin:this.options.plugin,onSelect:(i,a)=>{this.options.onSelect(i,a)}}).open()}};Li.activeMenu=null,Li.activeTrigger=null;Zs=Li});async function bn(r,e){return new vx(r,e).show()}var UA,vx,Cl=y(()=>{UA=require("obsidian"),vx=class extends UA.Modal{constructor(e,t){super(e),this.options={confirmText:"Confirm",cancelText:"Cancel",isDestructive:!1,...t}}show(){return new Promise(e=>{this.resolve=e,this.open()})}onOpen(){let{contentEl:e}=this;e.empty(),new UA.Setting(e).setName(this.options.title).setHeading(),e.createEl("p",{text:this.options.message});let t=e.createEl("div",{cls:"modal-button-container"});t.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),t.classList.add("tn-static-display-flex-75816cae"),t.classList.remove("tn-static-display-flex-8bb39979","tn-static-gap-0-5rem-ce2fca4d","tn-static-gap-12px-ed7b3d87","tn-static-gap-6px-f0abc1db","tn-static-gap-8px-33fcd4c3"),t.classList.add("tn-static-gap-10px-f3d7ce77"),t.classList.remove("tn-static-justify-content-center-03c4bb6f","tn-static-justify-content-space-between-a562f4fd"),t.classList.add("tn-static-justify-content-flex-end-455f8cca"),t.classList.remove("tn-static-font-size-12px-b0cc7e05","tn-static-margin-top-0-5rem-3dc98b5e","tn-static-margin-top-0-d462248a","tn-static-margin-top-12px-91e0f558","tn-static-margin-top-16px-1b0f4999","tn-static-margin-top-1rem-2239d6d5","tn-static-margin-top-30px-2fbbbcd4","tn-static-margin-top-4px-96ad6099","tn-static-margin-top-8px-8a77e5a3","tn-static-margin-top-8px-f4f01e68"),t.classList.add("tn-static-margin-top-20px-a26bda7d");let n=null;this.options.thirdButtonText&&(n=t.createEl("button",{text:this.options.thirdButtonText}),n.addEventListener("click",()=>{this.options.onThirdButton&&this.options.onThirdButton(),this.close()}));let i=t.createEl("button",{text:this.options.cancelText});i.addEventListener("click",()=>{this.resolve(!1),this.close()});let a=t.createEl("button",{text:this.options.confirmText,cls:this.options.isDestructive?"mod-warning":"mod-cta"});this.options.isDestructive&&(a.classList.remove("tn-static-background-color-var-background-mo-94b219f0","tn-static-background-color-var-background-se-9087a23e","tn-static-background-color-var-color-base-40-ef5f175e","tn-static-background-color-var-text-accent-a954c70f"),a.classList.add("tn-static-background-color-var-color-red-134bc721"),a.classList.remove("tn-static-color-var-color-accent-d2cad743","tn-static-color-var-text-accent-65b47ee3","tn-static-color-var-text-muted-5872de20","tn-static-color-var-text-on-accent-f3e1679d","tn-static-color-var-text-warning-783d5f03","tn-static-color-var-tn-text-muted-a90fb6f3","tn-static-cursor-pointer-2723efcc","tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-2px-0-edce9b14","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c"),a.classList.add("tn-static-color-white-0a43e56a")),a.addEventListener("click",()=>{this.resolve(!0),this.close()}),window.setTimeout(()=>{this.options.defaultToConfirm?a.focus():i.focus()},0)}onClose(){let{contentEl:e}=this;e.empty(),this.resolve&&this.resolve(!1)}}});async function Jv(r,e){return new pH(r,e).show()}var bx,pH,mH=y(()=>{bx=require("obsidian"),pH=class extends bx.Modal{constructor(e,t){super(e),this.options={confirmText:"Confirm",cancelText:"Cancel",...t}}show(){return new Promise(e=>{this.resolve=e,this.open()})}onOpen(){let{contentEl:e}=this;e.empty(),new bx.Setting(e).setName(this.options.title).setHeading(),new bx.Setting(e).addText(a=>{var s,o;this.inputEl=a.inputEl,a.setPlaceholder(this.options.placeholder||"").setValue(this.options.initialValue||"").onChange(()=>{}),window.setTimeout(()=>{this.inputEl.focus(),this.inputEl.select()},100),(o=(s=this.options).onInputReady)==null||o.call(s,this.inputEl)});let t=e.createEl("div",{cls:"modal-button-container"});t.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),t.classList.add("tn-static-display-flex-75816cae"),t.classList.remove("tn-static-display-flex-8bb39979","tn-static-gap-0-5rem-ce2fca4d","tn-static-gap-12px-ed7b3d87","tn-static-gap-6px-f0abc1db","tn-static-gap-8px-33fcd4c3"),t.classList.add("tn-static-gap-10px-f3d7ce77"),t.classList.remove("tn-static-justify-content-center-03c4bb6f","tn-static-justify-content-space-between-a562f4fd"),t.classList.add("tn-static-justify-content-flex-end-455f8cca"),t.classList.remove("tn-static-font-size-12px-b0cc7e05","tn-static-margin-top-0-5rem-3dc98b5e","tn-static-margin-top-0-d462248a","tn-static-margin-top-12px-91e0f558","tn-static-margin-top-16px-1b0f4999","tn-static-margin-top-1rem-2239d6d5","tn-static-margin-top-30px-2fbbbcd4","tn-static-margin-top-4px-96ad6099","tn-static-margin-top-8px-8a77e5a3","tn-static-margin-top-8px-f4f01e68"),t.classList.add("tn-static-margin-top-20px-a26bda7d");let n=t.createEl("button",{text:this.options.cancelText});n.addEventListener("click",()=>{this.resolve(null),this.close()});let i=t.createEl("button",{text:this.options.confirmText,cls:"mod-cta"});i.addEventListener("click",()=>{let a=this.inputEl.value.trim();this.resolve(a||null),this.close()}),this.inputEl.addEventListener("keydown",a=>{a.key==="Enter"?(a.preventDefault(),i.click()):a.key==="Escape"&&(a.preventDefault(),n.click())})}onClose(){let{contentEl:e}=this;e.empty(),this.resolve&&this.resolve(null)}}});function Ec(r){let e=r.trim();return e.startsWith("#")?e.slice(1):e}function ket(r,e){let t=Ec(r),n=Ec(e);return!t||!n?!1:t.toLowerCase()===n.toLowerCase()}function HA(r,e,t="all"){let n=Ec(r),i=Ec(e);return t==="exact-only"?ket(n,i):yr.matchesHierarchicalTagExact(n,i)}function bu(r,e,t="all"){return r.filter(n=>!HA(n,e,t))}function wet(r){return r.taskIdentificationMethod==="tag"&&!!r.hideIdentifyingTagsInCards&&!!r.taskTag}function VA(r,e){return wet(e)?bu(r,e.taskTag,e.hideIdentifyingTagsMode):[...r]}function Kve(r,e,t,n="all"){let i=[...r],a=e.filter(o=>HA(o,t,n)).map(Ec),s=a.length>0?a:[Ec(t)];for(let o of s)o&&(i.some(l=>Ec(l)===o)||i.push(o));return i}var qp=y(()=>{cu()});function Zve(r,e){r.addEventListener("focus",e),r.addEventListener("click",e)}var YA,Eet,qA,Wp,WA,Tx=y(()=>{YA=require("obsidian");qp();G();Eet=I({tag:"Modals/TaskModalSuggests"});qA=class extends YA.AbstractInputSuggest{constructor(e,t,n){super(e,t),this.plugin=n,this.input=t,Zve(this.input,()=>this.open())}async getSuggestions(e){let t=this.input.value.split(",").map(s=>s.trim()),n=t[t.length-1],i=this.plugin.cacheManager.getAllContexts(),a=t.slice(0,-1);return i.filter(s=>s&&typeof s=="string").filter(s=>!a.includes(s)&&(!n||s.toLowerCase().includes(n.toLowerCase()))).slice(0,10).map(s=>({value:s,display:s,type:"context",toString(){return this.value}}))}renderSuggestion(e,t){t.textContent=e.display}selectSuggestion(e){let t=this.input.value.split(",").map(n=>n.trim());t[t.length-1]=e.value,this.input.value=t.join(", ")+", ",this.input.dispatchEvent(new Event("input",{bubbles:!0})),this.input.focus()}},Wp=class extends YA.AbstractInputSuggest{constructor(e,t,n){super(e,t),this.plugin=n,this.input=t,Zve(this.input,()=>this.open())}async getSuggestions(e){let t=this.input.value.split(",").map(s=>s.trim()),n=t[t.length-1],i=VA(this.plugin.cacheManager.getAllTags(),this.plugin.settings),a=t.slice(0,-1);return i.filter(s=>s&&typeof s=="string").filter(s=>!a.includes(s)&&(!n||s.toLowerCase().includes(n.toLowerCase()))).slice(0,10).map(s=>({value:s,display:s,type:"tag",toString(){return this.value}}))}renderSuggestion(e,t){t.textContent=e.display}selectSuggestion(e){let t=this.input.value.split(",").map(n=>n.trim());t[t.length-1]=e.value,this.input.value=t.join(", ")+", ",this.input.dispatchEvent(new Event("input",{bubbles:!0})),this.input.focus()}},WA=class extends YA.AbstractInputSuggest{constructor(e,t,n,i){super(e,t),this.plugin=n,this.input=t,this.fieldConfig=i}async getSuggestions(e){let t=this.fieldConfig.type==="list",n="",i=[];if(t?(i=this.input.value.split(",").map(o=>o.trim()),n=i[i.length-1]||""):n=this.input.value.trim(),!n)return[];let a=n.match(/\[\[([^\]]*)$/);if(a){let o=a[1]||"",{FileSuggestHelper:l}=await Promise.resolve().then(()=>(nS(),XB));return(await l.suggest(this.plugin,o,20,this.fieldConfig.autosuggestFilter)).map(d=>({value:d.insertText,display:d.displayText,type:"user-field",fieldKey:this.fieldConfig.key,toString(){return this.value}}))}return(await this.getExistingUserFieldValues(this.fieldConfig.key)).filter(o=>o&&typeof o=="string").filter(o=>o.toLowerCase().includes(n.toLowerCase())&&(!t||!i.slice(0,-1).includes(o))).slice(0,10).map(o=>({value:o,display:o,type:"user-field",fieldKey:this.fieldConfig.key,toString(){return this.value}}))}async getExistingUserFieldValues(e){var i,a;let t=async()=>{try{let s=this.plugin.app.vault.getMarkdownFiles(),o=new Set;for(let l of s)try{let c=this.plugin.app.metadataCache.getFileCache(l),d=c==null?void 0:c.frontmatter;if(d&&d[e]!==void 0){let u=d[e];Array.isArray(u)?u.forEach(p=>{typeof p=="string"&&p.trim()&&o.add(p.trim())}):typeof u=="string"&&u.trim()?o.add(u.trim()):(typeof u=="number"||typeof u=="boolean")&&o.add(u.toString())}if(o.size>=200)break}catch(c){continue}return Array.from(o).sort()}catch(s){return Eet.error("Error getting user field values:",{category:"persistence",operation:"getting-user-field-values",error:s}),[]}},n=(a=(i=this.plugin.settings)==null?void 0:i.suggestionDebounceMs)!=null?a:0;return n?new Promise(s=>{let o=this.plugin;o.__userFieldSuggestTimer&&window.clearTimeout(o.__userFieldSuggestTimer),o.__userFieldSuggestTimer=window.setTimeout(()=>{(async()=>s(await t()))()},n)}):t()}renderSuggestion(e,t){t.textContent=e.display}selectSuggestion(e){var n;if(this.fieldConfig.type==="list"){let i=this.input.value.split(","),a=(n=i.pop())!=null?n:"",s=i.join(","),o=a.trim(),l=/\[\[/.test(o)?o.replace(/\[\[[^\]]*$/,`[[${e.value}]]`):e.value,c=(s?s+", ":"")+l;this.input.value=c.endsWith(",")?c+" ":c+", "}else{let i=this.input.value,a=i.replace(/\[\[[^\]]*$/,`[[${e.value}]]`);this.input.value=a===i?e.value:a}this.input.dispatchEvent(new Event("input",{bubbles:!0})),this.input.focus()}}});function GA(r,e,t=n=>n.path){return r.map(n=>{switch(e){case"filenames":return Qve(n.path);case"markdown-links":return`[[${t(n)}]]`;case"titles":return n.title||Qve(n.path);case"paths":return n.path}}).join(` +`)}function Qve(r){return(r.split("/").pop()||r).replace(/\.md$/i,"")}var fH=y(()=>{});function Xv(r){let e=new Set,t=[];for(let n of r!=null?r:[]){if(typeof n!="string")continue;let i=Ec(n);!i||e.has(i)||(e.add(i),t.push(i))}return t}function kx(r){return!r||typeof r!="string"?[]:Xv(r.split(","))}function Jve(r,e){let t=Xv(r.tags);return e.taskIdentificationMethod!=="tag"?t:bu(t,e.taskTag,e.hideIdentifyingTagsMode)}function KA(r,e){let t=Xv(r),n=new Set(t);for(let i of e){let a=Ec(i);!a||n.has(a)||(n.add(a),t.push(a))}return t.length>0?t:void 0}function wx(r,e){let t=new Set(kx(e.join(",")));if(t.size===0){let i=Xv(r);return i.length>0?i:void 0}let n=Xv(r).filter(i=>!t.has(i));return n.length>0?n:void 0}function ZA(r,e){let t=Xv(r);if(e.taskIdentificationMethod!=="tag")return;let n=t.filter(i=>HA(i,e.taskTag,e.hideIdentifyingTagsMode));return n.length>0?n:void 0}var hH=y(()=>{qp()});function eb(r){return r.setSubmenu()}function Xve(r){var t,n;let e=r;return(n=(t=e.dom)!=null?t:e.domEl)!=null?n:null}var Qn,Yp,tb,gH=y(()=>{Qn=require("obsidian");Nh();du();Cl();mH();Tx();fH();hH();G();Yp=I({tag:"Components/BatchContextMenu"});tb=class{constructor(e){this.menu=new ki,this.options=e,this.buildMenu()}t(e,t){return this.options.plugin.i18n.translate(e,t)}buildMenu(){let{selectedPaths:e}=this.options,t=e.length;this.menu.addItem(n=>{n.setTitle(`${t} tasks selected`),n.setIcon("check-square"),n.setDisabled(!0)}),this.menu.addSeparator(),this.menu.addItem(n=>{n.setTitle(this.t("contextMenus.task.status")),n.setIcon("circle");let i=eb(n);this.addStatusOptions(i)}),this.menu.addItem(n=>{n.setTitle(this.t("contextMenus.task.priority")),n.setIcon("star");let i=eb(n);this.addPriorityOptions(i)}),this.menu.addItem(n=>{n.setTitle(this.t("contextMenus.task.tags")),n.setIcon("tags");let i=eb(n);this.addTagOptions(i)}),this.menu.addSeparator(),this.menu.addItem(n=>{n.setTitle(this.t("contextMenus.task.dueDate")),n.setIcon("calendar");let i=eb(n);this.addDateOptions(i,"due")}),this.menu.addItem(n=>{n.setTitle(this.t("contextMenus.task.scheduledDate")),n.setIcon("calendar-clock");let i=eb(n);this.addDateOptions(i,"scheduled")}),this.menu.addSeparator(),this.menu.addItem(n=>{n.setTitle(this.t("contextMenus.task.archive")),n.setIcon("archive"),n.onClick(async()=>{await this.batchArchive(!0)})}),this.menu.addItem(n=>{n.setTitle(this.t("contextMenus.task.unarchive")),n.setIcon("archive-restore"),n.onClick(async()=>{await this.batchArchive(!1)})}),this.menu.addSeparator(),this.menu.addItem(n=>{n.setTitle("Copy selected tasks"),n.setIcon("copy");let i=eb(n);this.addCopyOptions(i)}),this.menu.addSeparator(),this.menu.addItem(n=>{n.setTitle("Clear selection"),n.setIcon("x"),n.onClick(()=>{var i,a;(i=this.options.plugin.taskSelectionService)==null||i.clearSelection(),(a=this.options.plugin.taskSelectionService)==null||a.exitSelectionMode()})}),this.menu.addSeparator(),this.menu.addItem(n=>{n.setTitle(`Delete ${t} tasks`),n.setIcon("trash"),n.onClick(async()=>{await this.batchDelete()})})}addTagOptions(e){e.addItem(t=>{t.setTitle(this.t("contextMenus.task.addTag")),t.setIcon("plus"),t.onClick(()=>{this.openBatchTagInput("add")})}),e.addItem(t=>{t.setTitle(this.t("contextMenus.task.removeTagInput")),t.setIcon("x"),t.onClick(()=>{this.openBatchTagInput("remove")})}),e.addSeparator(),e.addItem(t=>{t.setTitle(this.t("contextMenus.task.clearTags")),t.setIcon("eraser"),t.onClick(async()=>{await this.batchUpdateTags(n=>ZA(n.tags,this.options.plugin.settings))})})}addCopyOptions(e){let t=[{title:"Copy filenames",icon:"file-text",format:"filenames"},{title:"Copy Markdown links",icon:"link",format:"markdown-links"},{title:"Copy titles",icon:"text",format:"titles"},{title:"Copy paths",icon:"copy",format:"paths"}];for(let n of t)e.addItem(i=>{i.setTitle(n.title),i.setIcon(n.icon),i.onClick(async()=>{await this.copySelectedTasks(n.format)})})}addStatusOptions(e){let n=[...this.options.plugin.settings.customStatuses].sort((i,a)=>i.order-a.order);for(let i of n)e.addItem(a=>{a.setTitle(i.label),a.setIcon(i.icon||"circle"),a.onClick(async()=>{await this.batchUpdateProperty("status",i.value)}),i.color&&window.setTimeout(()=>{let s=Xve(a);if(s){let o=s.querySelector(".menu-item-icon");o&&(o.style.color=i.color)}},10)})}addPriorityOptions(e){let t=this.options.plugin.priorityManager.getPrioritiesByWeight();for(let n of t)e.addItem(i=>{i.setTitle(n.label),i.setIcon("star"),i.onClick(async()=>{await this.batchUpdateProperty("priority",n.value)}),n.color&&window.setTimeout(()=>{let a=Xve(i);if(a){let s=a.querySelector(".menu-item-icon");s&&(s.style.color=n.color)}},10)});e.addSeparator(),e.addItem(n=>{n.setTitle(this.t("contextMenus.priority.clearPriority")),n.setIcon("x"),n.onClick(async()=>{await this.batchUpdateProperty("priority",void 0)})})}addDateOptions(e,t){let a=new Zs({currentValue:void 0,onSelect:()=>{},plugin:this.options.plugin,app:this.options.plugin.app}).getDateOptions().filter(s=>s.category==="basic");for(let s of a)e.addItem(o=>{s.icon&&o.setIcon(s.icon),o.setTitle(s.label),o.onClick(async()=>{await this.batchUpdateProperty(t,s.value)})});e.addSeparator(),e.addItem(s=>{s.setTitle(this.t("contextMenus.date.clearDate")),s.setIcon("x"),s.onClick(async()=>{await this.batchUpdateProperty(t,void 0)})})}async openBatchTagInput(e){let{plugin:t}=this.options,n=await Jv(t.app,{title:e==="add"?this.t("contextMenus.task.addTag"):this.t("contextMenus.task.removeTagInput"),placeholder:this.t("contextMenus.task.tagPlaceholder"),confirmText:this.t("common.confirm"),cancelText:this.t("common.cancel"),onInputReady:a=>{new Wp(t.app,a,t)}}),i=kx(n);i.length!==0&&await this.batchUpdateTags(a=>e==="add"?KA(a.tags,i):wx(a.tags,i))}async copySelectedTasks(e){let{plugin:t,selectedPaths:n}=this.options,i=[];for(let s of n){let o=await t.cacheManager.getTaskInfo(s);i.push({path:s,title:o==null?void 0:o.title})}let a=GA(i,e,s=>this.getMarkdownLinkText(s.path));await navigator.clipboard.writeText(a),new Qn.Notice(`Copied ${i.length} tasks`)}getMarkdownLinkText(e){let t=this.options.plugin.app.vault.getAbstractFileByPath(e);return t instanceof Qn.TFile?this.options.plugin.app.metadataCache.fileToLinktext(t,""):e}async batchUpdateTags(e){var s,o;let{plugin:t,selectedPaths:n,onUpdate:i}=this.options,a=n.length;try{new Qn.Notice(`Updating tags on ${a} tasks...`);let l=0,c=0;for(let d of n)try{let u=await t.cacheManager.getTaskInfo(d);u?(await t.taskService.updateProperty(u,"tags",e(u)),l++):c++}catch(u){Yp.error(`[BatchContextMenu] Failed to update tags for ${d}:`,{category:"validation",operation:"update-tags",error:u}),c++}c===0?new Qn.Notice(`Updated tags on ${l} tasks`):new Qn.Notice(`Updated tags on ${l} tasks, ${c} failed`),(s=t.taskSelectionService)==null||s.clearSelection(),(o=t.taskSelectionService)==null||o.exitSelectionMode(),i==null||i()}catch(l){Yp.error("[BatchContextMenu] Batch tag update failed:",{category:"validation",operation:"batch-tag-update",error:l}),new Qn.Notice(this.t("contextMenus.task.notices.updateTagsFailed"))}}async batchUpdateProperty(e,t){var o,l;let{plugin:n,selectedPaths:i,onUpdate:a}=this.options,s=i.length;try{new Qn.Notice(`Updating ${s} tasks...`);let c=0,d=0;for(let u of i)try{let p=await n.cacheManager.getTaskInfo(u);p?(await n.taskService.updateProperty(p,e,t),c++):d++}catch(p){Yp.error(`[BatchContextMenu] Failed to update task ${u}:`,{category:"validation",operation:"update-task",error:p}),d++}d===0?new Qn.Notice(`Updated ${c} tasks`):new Qn.Notice(`Updated ${c} tasks, ${d} failed`),(o=n.taskSelectionService)==null||o.clearSelection(),(l=n.taskSelectionService)==null||l.exitSelectionMode(),a==null||a()}catch(c){Yp.error("[BatchContextMenu] Batch update failed:",{category:"validation",operation:"batch-update",error:c}),new Qn.Notice("Failed to update tasks")}}async batchArchive(e){var s,o;let{plugin:t,selectedPaths:n,onUpdate:i}=this.options,a=n.length;try{new Qn.Notice(`${e?"Archiving":"Unarchiving"} ${a} tasks...`);let l=0,c=0;for(let d of n)try{let u=await t.cacheManager.getTaskInfo(d);u&&u.archived!==e?(await t.toggleTaskArchive(u),l++):u?l++:c++}catch(u){Yp.error(`[BatchContextMenu] Failed to archive task ${d}:`,{category:"persistence",operation:"archive-task",error:u}),c++}c===0?new Qn.Notice(`${e?"Archived":"Unarchived"} ${l} tasks`):new Qn.Notice(`${e?"Archived":"Unarchived"} ${l} tasks, ${c} failed`),(s=t.taskSelectionService)==null||s.clearSelection(),(o=t.taskSelectionService)==null||o.exitSelectionMode(),i==null||i()}catch(l){Yp.error("[BatchContextMenu] Batch archive failed:",{category:"persistence",operation:"batch-archive",error:l}),new Qn.Notice("Failed to archive tasks")}}async batchDelete(){var s,o;let{plugin:e,selectedPaths:t,onUpdate:n}=this.options,i=t.length;if(await bn(e.app,{title:"Delete tasks",message:`Are you sure you want to delete ${i} tasks? This action cannot be undone.`,confirmText:"Delete",cancelText:this.t("common.cancel"),isDestructive:!0}))try{new Qn.Notice(`Deleting ${i} tasks...`);let l=0,c=0;for(let d of t)try{let u=await e.cacheManager.getTaskInfo(d);u?(await e.taskService.deleteTask(u),l++):c++}catch(u){Yp.error(`[BatchContextMenu] Failed to delete task ${d}:`,{category:"persistence",operation:"delete-task",error:u}),c++}c===0?new Qn.Notice(`Deleted ${l} tasks`):new Qn.Notice(`Deleted ${l} tasks, ${c} failed`),(s=e.taskSelectionService)==null||s.clearSelection(),(o=e.taskSelectionService)==null||o.exitSelectionMode(),n==null||n()}catch(l){Yp.error("[BatchContextMenu] Batch delete failed:",{category:"persistence",operation:"batch-delete",error:l}),new Qn.Notice("Failed to delete tasks")}}show(e){this.menu.showAtMouseEvent(e)}showAtPosition(e,t){this.menu.showAtPosition({x:e,y:t})}}});function Cet(r){return xet.includes(r)}function Ra(r,e){return r.map(t=>Cet(t)?t:t in e.fieldMapper.getMapping()?e.fieldMapper.toUserField(t):t)}function rb(r,e,t){return t.fieldMapper.isPropertyForField(r,e)}var xet,xc=y(()=>{xet=["tags","blocked","blocking"]});var Sx,Det,Pet,Met,_et,Aet,Iet,Net,yH,li,Rh=y(()=>{f_();f_();Sx=["status","priority","due","scheduled","projects","contexts"],Det=[{id:"none",value:"none",label:"None",color:"#cccccc",isCompleted:!1,excludeFromCycle:!1,order:0,autoArchive:!1,autoArchiveDelay:5},{id:"open",value:"open",label:"Open",color:"#808080",isCompleted:!1,excludeFromCycle:!1,order:1,autoArchive:!1,autoArchiveDelay:5},{id:"in-progress",value:"in-progress",label:"In progress",color:"#0066cc",isCompleted:!1,excludeFromCycle:!1,order:2,autoArchive:!1,autoArchiveDelay:5},{id:"done",value:"done",label:"Done",color:"#00aa00",isCompleted:!0,excludeFromCycle:!1,order:3,autoArchive:!1,autoArchiveDelay:5}],Pet=[{id:"none",value:"none",label:"None",color:"#cccccc",weight:0},{id:"low",value:"low",label:"Low",color:"#00aa00",weight:1},{id:"normal",value:"normal",label:"Normal",color:"#ffaa00",weight:2},{id:"high",value:"high",label:"High",color:"#ff0000",weight:3}],Met={defaultContexts:"",defaultTags:"",defaultProjects:"",useParentNoteAsProject:!1,useParentHeaderAsProject:!1,inheritParentTaskProperties:!1,defaultTimeEstimate:0,defaultRecurrence:"none",defaultDueDate:"none",defaultDueTime:"none",defaultScheduledDate:"today",defaultScheduledTime:"none",bodyTemplate:"",useBodyTemplate:!1,defaultReminders:[]},_et={defaultView:"dayGridMonth",customDayCount:3,slotDuration:"00:30:00",slotMinTime:"00:00:00",slotMaxTime:"24:00:00",scrollTime:"08:00:00",firstDay:1,timeFormat:"24",showWeekends:!0,locale:"",defaultShowScheduled:!0,defaultShowDue:!0,defaultShowDueWhenScheduled:!0,defaultShowScheduledToDueSpan:!1,defaultShowTimeEntries:!1,defaultShowRecurring:!0,defaultShowICSEvents:!0,enableTimeblocking:!1,defaultShowTimeblocks:!0,defaultTimeblockColor:"#6366f1",timeblockAttachmentSearchOrder:"name-asc",nowIndicator:!0,selectMirror:!0,weekNumbers:!1,showTodayHighlight:!0,eventMinHeight:15,slotEventOverlap:!0,eventMaxStack:null,dayMaxEvents:!0,dayMaxEventRows:!1},Aet={defaultNoteTemplate:"",defaultNoteFolder:"",icsNoteFilenameFormat:"title",customICSNoteFilenameTemplate:"{title}",enableAutoExport:!1,autoExportPath:"tasknotes-calendar.ics",autoExportInterval:60,useDurationForExport:!1,excludeArchivedFromExport:!1,excludeCompletedFromExport:!1,requireDueDateForExport:!1,requireScheduledDateForExport:!1,useICSEndAsDue:!1},Iet={enabled:!1,targetCalendarId:"",syncOnTaskCreate:!0,syncOnTaskUpdate:!0,syncOnTaskComplete:!0,syncOnTaskDelete:!0,eventTitleTemplate:"{{title}}",includeDescription:!0,eventColorId:null,syncTrigger:"scheduled",createAsAllDay:!0,defaultEventDuration:60,includeObsidianLink:!0,defaultReminderMinutes:null},Net={enableFuzzy:!1,rows:["{title|n(Title)}","{aliases|n(Aliases)}","{file.path|n(Path)}"],showAdvanced:!1,requiredTags:[],includeFolders:[],propertyKey:"",propertyValue:""},yH={triggers:[{propertyId:"tags",trigger:"#",enabled:!0},{propertyId:"contexts",trigger:"@",enabled:!0},{propertyId:"projects",trigger:"+",enabled:!0},{propertyId:"status",trigger:"*",enabled:!0},{propertyId:"priority",trigger:"!",enabled:!1}]},li={tasksFolder:"TaskNotes/Tasks",moveArchivedTasks:!1,archiveFolder:"TaskNotes/Archive",taskTag:"task",taskIdentificationMethod:"tag",hideIdentifyingTagsInCards:!1,hideIdentifyingTagsMode:"all",taskPropertyName:"",taskPropertyValue:"",excludedFolders:"",defaultTaskPriority:"normal",defaultTaskStatus:"open",taskOrgFiltersCollapsed:!1,taskFilenameFormat:"zettel",storeTitleInFilename:!0,customFilenameTemplate:"{{title}}",taskCreationDefaults:Met,openTaskAfterCreation:"none",calendarViewSettings:_et,pomodoroWorkDuration:25,pomodoroShortBreakDuration:5,pomodoroLongBreakDuration:15,pomodoroLongBreakInterval:4,pomodoroAutoStartBreaks:!0,pomodoroAutoStartWork:!1,pomodoroNotifications:!0,pomodoroSoundEnabled:!0,pomodoroSoundVolume:50,pomodoroStorageLocation:"plugin",pomodoroMobileSidebar:"tab",showPomodoroInStatusBar:!0,enableTaskLinkOverlay:!0,disableOverlayOnAlias:!1,enableInstantTaskConvert:!0,useDefaultsOnInstantConvert:!0,preserveCheckboxOnConvert:!1,taskModalTabMovesFocus:!0,enableNaturalLanguageInput:!0,nlpDefaultToScheduled:!0,nlpLanguage:"en",uiLanguage:"system",statusSuggestionTrigger:"*",nlpTriggers:yH,singleClickAction:"edit",doubleClickAction:"openNote",projectAutosuggest:Net,inlineTaskConvertFolder:"{{currentNotePath}}",disableNoteIndexing:!1,suggestionDebounceMs:0,fieldMapping:jw,customStatuses:Det,customPriorities:Pet,recurrenceMigrated:!1,lastSeenVersion:void 0,showReleaseNotesOnUpdate:!0,showTrackedTasksInStatusBar:!1,autoStopTimeTrackingOnComplete:!0,autoStopTimeTrackingNotification:!1,showRelationships:!0,relationshipsPosition:"bottom",showTaskCardInNote:!0,showCompletedTaskStrikethrough:!0,showExpandableSubtasks:!0,expandSubtasksByDefault:!1,subtaskChevronPosition:"right",viewsButtonAlignment:"right",hideCompletedFromOverdue:!0,icsIntegration:Aet,savedViews:[],enableNotifications:!0,notificationType:"system",notificationSoundEnabled:!1,notificationSoundVolume:50,enableAPI:!1,apiPort:8080,apiAuthToken:"",enableMCP:!1,webhooks:[],userFields:[],modalFieldsConfig:void 0,enableModalSplitLayout:!0,defaultVisibleProperties:["status","priority","due","scheduled","projects","contexts","tags","blocked","blocking"],inlineVisibleProperties:["status","priority","due","scheduled","recurrence"],enableBases:!0,enableMdbaseSpec:!1,autoCreateDefaultBasesFiles:!0,commandFileMapping:{"open-calendar-view":"TaskNotes/Views/mini-calendar-default.base","open-kanban-view":"TaskNotes/Views/kanban-default.base","open-tasks-view":"TaskNotes/Views/tasks-default.base","open-advanced-calendar-view":"TaskNotes/Views/calendar-default.base","open-agenda-view":"TaskNotes/Views/agenda-default.base","pomodoro-stats-base":"TaskNotes/Views/pomodoro-stats.base",relationships:"TaskNotes/Views/relationships.base"},maintainDueDateOffsetInRecurring:!1,resetCheckboxesOnRecurrence:!1,useFrontmatterMarkdownLinks:!1,googleOAuthClientId:"",googleOAuthClientSecret:"",microsoftOAuthClientId:"",microsoftOAuthClientSecret:"",enableGoogleCalendar:!1,enableMicrosoftCalendar:!1,disableCalendarOnMobile:!1,enabledGoogleCalendars:[],googleCalendarSyncTokens:{},enabledMicrosoftCalendars:[],microsoftCalendarSyncTokens:{},googleCalendarExport:Iet,enableDebugLogging:!1}});function ebe(r){return Oet.has(r.trim().toLowerCase())}function JA(r){return typeof r=="object"&&r!==null&&typeof r.renderTo=="function"&&typeof r.toString=="function"}function QA(r){let e=r.toString();return e==="[object Object]"?"":e}function vH(r){var t;return r==null||((t=r.constructor)==null?void 0:t.name)==="NullValue"?!0:JA(r)&&ebe(QA(r))}function Ex(r){return vH(r)?!0:Array.isArray(r)?r.every(Ex):typeof r=="string"?r.trim()===""||ebe(r):JA(r)?QA(r).trim()==="":!1}function XA(r,e,t){if(!JA(e)||vH(e))return!1;try{e.renderTo(r,t),!r.hasChildNodes()&&!r.textContent&&(r.textContent=QA(e))}catch(n){Ret.debug("[TaskNotes] Error rendering Bases value:",{category:"persistence",operation:"rendering-bases-value",error:n}),r.textContent=QA(e)}return!0}function Tu(r){if(vH(r))return"";if(JA(r))return r;if(r&&typeof r=="object"&&"icon"in r){let e=r;if(e.icon==="lucide-link"&&"data"in e&&e.data!==null&&e.data!==void 0){let t=Z(e.data);if(!t.match(/^[a-z]+:\/\//i)){let i="display"in e&&e.display?Z(e.display):null;return i&&i!==t?`[[${t}|${i}]]`:`[[${t}]]`}let n="display"in e&&e.display?Z(e.display):null;return n?`[${n}](${t})`:t}return"display"in e&&e.display!==null&&e.display!==void 0?e.display:"date"in e&&e.date!==null&&e.date!==void 0?e.date:"data"in e&&e.data!==null&&e.data!==void 0?e.data:e.icon==="lucide-file-question"||e.icon==="lucide-help-circle"?"":e.icon?Z(e.icon).replace("lucide-",""):""}return r}function eI(r,e={},t){var i;let n=(i=e.propertyLabels)==null?void 0:i[r];return n&&n.trim()!==""?n:t&&t.trim()!==""?t:r.startsWith("formula.")?r.substring(8):r.charAt(0).toUpperCase()+r.slice(1)}var Ret,Oet,xx=y(()=>{gr();G();Ret=I({tag:"Ui/TaskCardPresentation"}),Oet=new Set(["null","undefined"])});function bH(r){return r!==null&&typeof r=="object"&&typeof r.getValue=="function"?r:null}function tbe(r){return Object.prototype.hasOwnProperty.call(nbe,r)}function rbe(r,e){return nbe[e](r)}function kH(r,e,t){try{let n=t.fieldMapper.lookupMappingKey(e);if(n&&tbe(n))return rbe(r,n);if(tbe(e))return rbe(r,e);if(e.startsWith("user:"))return Let(r,e,t);if(r.customProperties&&e in r.customProperties)return Tu(r.customProperties[e]);if(r.customProperties){let a=`file.${e}`;if(a in r.customProperties)return Tu(r.customProperties[a])}if(e.startsWith("file.")){let a=bH(r.basesData);if(a)try{let s=a.getValue(e);if(s!=null)return Tu(s)}catch(s){}}if(e.startsWith("formula."))try{let a=bH(r.basesData);if(!a)return"";let s=a.getValue(e);if(s==null)return"";let o=Tu(s);return o!==""?o:""}catch(a){return TH.debug(`[TaskNotes] Error computing formula ${e}:`,{category:"validation",operation:"computing-formula",error:a}),"[Formula Error]"}let i=bH(r.basesData);if(i)try{let a=`note.${e}`,s=i.getValue(a);if(s!=null)return Tu(s)}catch(a){}if(r.path){let a=ibe(r.path,e,t);if(a!==void 0)return a}return null}catch(n){return TH.warn(`TaskCard: Error getting property ${e}:`,{category:"persistence",operation:"taskcard-getting-property",error:n}),null}}function Let(r,e,t){var s;let n=e.slice(5),i=(s=t.settings.userFields)==null?void 0:s.find(o=>o.id===n);if(!(i!=null&&i.key))return null;let a=r[i.key];return a===void 0&&(a=ibe(r.path,i.key,t)),a}function ibe(r,e,t){try{let n=t.app.metadataCache.getCache(r);return n!=null&&n.frontmatter?n.frontmatter[e]:void 0}catch(n){TH.warn(`TaskCard: Error accessing frontmatter for ${r}:`,{category:"validation",operation:"taskcard-accessing-frontmatter",error:n});return}}var TH,nbe,abe=y(()=>{xx();G();TH=I({tag:"Ui/TaskCardPropertyAccess"});nbe={due:r=>r.due,scheduled:r=>r.scheduled,projects:r=>r.projects,contexts:r=>r.contexts,tags:r=>r.tags,blocked:r=>r.isBlocked,blocking:r=>r.isBlocking,blockedBy:r=>r.blockedBy,blockingTasks:r=>r.blocking,timeEstimate:r=>r.timeEstimate,timeEntries:r=>r.timeEntries,totalTrackedTime:r=>r.totalTrackedTime,recurrence:r=>r.recurrence,recurrenceParent:r=>r.recurrence_parent,occurrenceDate:r=>r.occurrence_date,occurrenceMaterialization:r=>r.occurrence_materialization,occurrenceNextTrigger:r=>r.occurrence_next_trigger,occurrenceTemplate:r=>r.occurrence_template,occurrencePastHorizon:r=>r.occurrence_past_horizon,occurrenceFutureHorizon:r=>r.occurrence_future_horizon,completedDate:r=>r.completedDate,reminders:r=>r.reminders,icsEventId:r=>r.icsEventId,completeInstances:r=>r.complete_instances,skippedInstances:r=>r.skipped_instances,dateCreated:r=>r.dateCreated,dateModified:r=>r.dateModified,sortOrder:r=>r.sortOrder,googleCalendarSync:r=>r.path,checklistProgress:r=>r.path}});function Qs(r,e,t){return r.i18n.translate(`ui.taskCard.${e}`,t)}function Cc(r,e,t){let n=t==null?void 0:t[r];if(n&&n.trim()!=="")return n;let i=Fet(r,e,t),a={due:Qs(e,"labels.due"),scheduled:Qs(e,"labels.scheduled"),recurrence:Qs(e,"labels.recurrence"),completedDate:Qs(e,"labels.completed"),dateCreated:Qs(e,"labels.created"),dateModified:Qs(e,"labels.modified"),blocked:Qs(e,"labels.blocked"),blocking:Qs(e,"labels.blocking")};return eI(r,{propertyLabels:i?{[r]:i}:t},a[r])}function Fet(r,e,t){var n,i;if(t){for(let[a,s]of Object.entries(t))if(!(a===r||s.trim()==="")&&((i=(n=e.fieldMapper)==null?void 0:n.lookupMappingKey)==null?void 0:i.call(n,a))===r)return s}}function Cx(r,e,t){return Qs(r,"recurrenceTooltip",{label:Cc("recurrence",r,t),value:Bpe(e)})}function wH(r,e){return e===1?Qs(r,"reminderTooltipOne"):Qs(r,"reminderTooltipMany",{count:e})}function tI(r,e){return e?Qs(r,"collapseSubtasks"):Qs(r,"expandSubtasks")}var SH=y(()=>{Ct();xx();abe()});function obe(r,e,t){r.createEl("a",{text:t,attr:{href:e,target:"_blank",rel:"noopener"}}).classList.add("external-link")}function jet(r){return zet.test(r)}function Dl(r,e,t,n,i={}){var p;let{cssClass:a="internal-link",hoverSource:s="tasknotes-property-link",showErrorNotices:o=!1,onPrimaryNavigate:l}=i,c=(p=n.sourcePath)!=null?p:"",d=jt(e),u=r.createEl("a",{cls:a,text:t,attr:{"data-href":d,role:"link",tabindex:"0"}});u.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation(),(async()=>{try{if(m.ctrlKey||m.metaKey){n.workspace.openLinkText(d,c,!0);return}if(l&&await l(d,m)!==!1)return;let f=n.metadataCache.getFirstLinkpathDest(d,c)||n.metadataCache.getFirstLinkpathDest(d,"");f instanceof Gp.TFile?await n.workspace.getLeaf(!1).openFile(f):o&&new Gp.Notice(`Note "${t}" not found`)}catch(f){sbe.error("[TaskNotes] Error opening internal link:",{category:"internal",operation:"opening-internal-link",details:{filePath:e},error:f}),o&&new Gp.Notice(`Failed to open note "${t}"`)}})()}),u.addEventListener("auxclick",m=>{m.button===1&&(m.preventDefault(),m.stopPropagation(),(async()=>{try{(n.metadataCache.getFirstLinkpathDest(d,c)||n.metadataCache.getFirstLinkpathDest(d,""))instanceof Gp.TFile&&n.workspace.openLinkText(d,c,!0)}catch(f){sbe.error("[TaskNotes] Error opening internal link:",{category:"internal",operation:"opening-internal-link",details:{filePath:e},error:f})}})())}),u.addEventListener("keydown",m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),u.click())}),u.addEventListener("mouseover",m=>{let f=n.metadataCache.getFirstLinkpathDest(d,c)||n.metadataCache.getFirstLinkpathDest(d,"");if(f instanceof Gp.TFile){let h={event:m,source:s,hoverParent:r,targetEl:u,linktext:d,sourcePath:c||f.path};n.workspace.trigger("hover-link",h)}})}function Dc(r,e,t,n){let i=0,a;for(;(a=$et.exec(e))!==null;){let[o,l,c,d,u,p]=a,m=a.index;if(m>i&&r.appendChild(activeDocument.createTextNode(e.slice(i,m))),l){let f=l,h=f,g=f;if(f.includes("|")){let[v,k]=f.split("|");h=v,g=k}Dl(r,h,g,t)}else if(c&&d){let f=String(d).trim(),h=String(c).trim();jet(f)?obe(r,f,h):Dl(r,f,h,t)}else if(u||p){let f=String(u||p);obe(r,f,f)}else r.appendChild(activeDocument.createTextNode(o));i=m+o.length}let s=e.slice(i);if(s&&(n!=null&&n.onTagClick)){let o=/(^|\s)(#[\p{L}\p{N}\p{M}_/-]+)/gu,l=0,c;for(;(c=o.exec(s))!==null;){let[,d,u]=c,p=c.index;p>l&&r.appendChild(activeDocument.createTextNode(s.slice(l,p))),d&&r.appendChild(activeDocument.createTextNode(d));let m=r.createEl("a",{cls:"tag",text:u,attr:{href:u,role:"button",tabindex:"0","data-tn-click-exclude":"true"}});m.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),n.onTagClick(u,f)}),m.addEventListener("keydown",f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),f.stopPropagation(),n.onTagClick(u,f))}),l=p+d.length+u.length}l0}function Uet(r){return!r||typeof r!="string"?!1:/^\[([^\]]*)\]\(([^)]+)\)$/.test(r)}function Het(r){let e=r.match(/^\[([^\]]*)\]\(([^)]+)\)$/);if(!e)return null;let t=e[1].trim(),n=e[2].trim(),i=jt(n);return{displayText:t,filePath:i}}function lbe(r,e,t){var u,p;let n=(u=t.sourcePath)!=null?u:"",i=jt(r),a=t.metadataCache.getFirstLinkpathDest(i,n)||t.metadataCache.getFirstLinkpathDest(i,"");if(!(a instanceof Gp.TFile))return e;let s=t.metadataCache.getCache(a.path),o=(p=s==null?void 0:s.frontmatter)==null?void 0:p.title;if(typeof o!="string"||o.trim().length===0)return e;let l=(e==null?void 0:e.trim())||"",c=a.name,d=a.basename;return l===""||l===c||l===d||l===a.path||l===i?o:e}function nb(r,e,t,n={}){r.innerHTML="",e.flat(2).filter(a=>a!=null&&typeof a=="string").forEach((a,s)=>{if(s>0&&r.appendChild(activeDocument.createTextNode(", ")),r.appendChild(activeDocument.createTextNode("+")),Bet(a)){let o=a.slice(2,-2),l=o,c=o;if(o.includes("|")){let u=o.split("|");l=u[0].trim(),c=u[1].trim()}let d=lbe(l,c,t);Dl(r,l,d,t,{cssClass:"task-card__project-link internal-link",hoverSource:"tasknotes-project-link",showErrorNotices:!0,onPrimaryNavigate:n.onPrimaryNavigate})}else if(Uet(a)){let o=Het(a);if(o){let l=lbe(o.filePath,o.displayText,t);Dl(r,o.filePath,l,t,{cssClass:"task-card__project-link internal-link",hoverSource:"tasknotes-project-link",showErrorNotices:!0,onPrimaryNavigate:n.onPrimaryNavigate})}else r.appendChild(activeDocument.createTextNode(a))}else r.appendChild(activeDocument.createTextNode(a))})}var Gp,sbe,$et,zet,Kp=y(()=>{Gp=require("obsidian");jn();G();sbe=I({tag:"Ui/Renderers/LinkRenderer"}),$et=/\[\[([^[\]]+)\]\]|\[([^\]]+)\]\(([^)]+)\)|<(https?:\/\/[^\s>]+)>|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?])|\[([^\]]+)\]\s*\[([^\]]*)\]/g,zet=/^[a-z][a-z0-9+.-]*:/i});function cbe(r,e,t){if(!e||typeof e!="string")return;let n=Wet(e);if(!n)return;let i=r.createEl("a",{cls:"tag",text:n,attr:{href:n,role:"button",tabindex:"0","data-tn-click-exclude":"true"}});t!=null&&t.onTagClick&&(i.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),t.onTagClick(n,a)}),i.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),a.stopPropagation(),t.onTagClick(n,a))}))}function pbe(r,e,t){if(typeof e=="string"){cbe(r,e,t);return}if(Array.isArray(e)){e.flat(2).filter(i=>i!=null&&typeof i=="string").forEach((i,a)=>{a>0&&r.appendChild(activeDocument.createTextNode(" ")),cbe(r,String(i),t)});return}e!=null&&r.appendChild(activeDocument.createTextNode(Z(e)))}function mbe(r,e,t){if(typeof e=="string"){dbe(r,e,t);return}if(Array.isArray(e)){e.flat(2).filter(i=>i!=null&&typeof i=="string").forEach((i,a)=>{a>0&&r.appendChild(activeDocument.createTextNode(", ")),dbe(r,i,t)||r.appendChild(activeDocument.createTextNode(String(i)))});return}e!=null&&r.appendChild(activeDocument.createTextNode(Z(e)))}function dbe(r,e,t){let n=Vet(e);if(t!=null&&t.linkServices&&qet(n)){let o=ube(n),l=r.createEl("span",{cls:`context-tag context-tag--link ${o}`,attr:{"data-tn-click-exclude":"true"}});return l.appendChild(activeDocument.createTextNode("@")),Dc(l,n,t.linkServices),!0}let i=Get(e);if(!i)return!1;let a=ube(i),s=r.createEl("span",{cls:`context-tag ${a}`,text:i,attr:{role:"button",tabindex:"0","data-tn-click-exclude":"true"}});return t!=null&&t.onTagClick&&(s.addEventListener("click",o=>{var l;o.preventDefault(),o.stopPropagation(),(l=t.onTagClick)==null||l.call(t,i,o)}),s.addEventListener("keydown",o=>{var l;(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),o.stopPropagation(),(l=t.onTagClick)==null||l.call(t,i,o))})),!0}function Vet(r){let e=r.trim();return e.startsWith("@")?e.slice(1).trim():e}function qet(r){return/\[\[[^[\]]+\]\]/.test(r)||/\[[^\]]+\]\([^)]+\)/.test(r)||/]+>/i.test(r)||/https?:\/\/[^\s<>()]+[^\s<>().,;:!?]/i.test(r)}function Wet(r){if(!r||typeof r!="string")return null;let e=r.trim();if(!e)return null;let t=e.startsWith("#"),n=e.replace(/[^\p{L}\p{N}_#/-]/gu,"");return t?n.length>1?n:null:n?`#${n}`:null}function Yet(r){let e=5381;for(let t=0;t>>0}function ube(r){if(!r||typeof r!="string")return"context-tag--color-0";let e=r.replace(/^@/,"").toLowerCase();return e?`context-tag--color-${Yet(e)%20}`:"context-tag--color-0"}function Get(r){if(!r||typeof r!="string")return null;let e=r.trim();if(!e)return null;let t=e.startsWith("@"),n=e.replace(/[^\p{L}\p{N}_@/-]/gu,"");return t?n.length>1?n:null:n?`@${n}`:null}var fbe=y(()=>{gr();Kp()});function Zp(r,e,t){return r.i18n.translate(`ui.taskCard.${e}`,t)}function Ket(r){if(r.setAttribute("role","button"),r.tabIndex=0,r.dataset.tnNoDrag==="true"){r.setAttribute("draggable","false");return}r.dataset.tnNoDrag="true",r.setAttribute("draggable","false"),r.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation()}),r.addEventListener("keydown",e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),e.stopPropagation(),r.click())})}function Zet(r){return(Array.isArray(r)?r:r?[r]:[]).filter(t=>typeof t=="string").map(t=>t.trim()).filter(Boolean)}function Qet(r,e){let t=r.start?Ti(r.start,{userTimeFormat:e.settings.calendarViewSettings.timeFormat}):"";return t?`${r.title} (${t})`:r.title}function hbe(r){var e;return((e=r.split("/").pop())==null?void 0:e.replace(/\.md$/i,""))||r}function Jet(r,e,t){let n=ts(r);if(n){let i=wl(t.app,e.path,n),a=(i==null?void 0:i.path)||n.uid;return a?{path:a,displayText:(i==null?void 0:i.file.basename)||hbe(a)}:null}if(typeof r=="object"&&r!==null){let i=r.path;if(typeof i=="string"&&i.trim()!=="")return{path:i.trim(),displayText:hbe(i)}}return null}function bbe(r,e,t,n){Ket(r),r.addEventListener("click",i=>{i.stopPropagation();let a=n==="due"?e.due:e.scheduled;new Zs({currentValue:ke(a||""),currentTime:_a(a||""),onSelect:(o,l)=>{(async()=>{try{let c;o?l?c=`${o}T${l}`:c=o:c=void 0,await t.updateTaskProperty(e,n,c)}catch(c){let d=c instanceof Error?c.message:String(c);xH.error(`Error updating ${n} date:`,{category:"persistence",operation:"updating",details:{value:d}});let u=n==="due"?"contextMenus.task.notices.updateDueDateFailure":"contextMenus.task.notices.updateScheduledFailure";new ib.Notice(t.i18n.translate(u,{message:d}))}})()},dateRole:n,plugin:t,app:t.app}).show(i)})}function Tbe(r){let e=[...Sx,"tags","blocked","blocking","googleCalendarSync"];return Ra(e,r)}function Xet(r,e){let t=e.app.vault.getAbstractFileByPath(r);if(!(t instanceof ib.TFile))return null;let n=e.app.metadataCache.getFileCache(t);return ett(n)}function ett(r){if(r==null)return null;let e=r.listItems;if(!Array.isArray(e)||e.length===0)return null;let t=0,n=0;for(let i of e)!i||typeof i.task!="string"||typeof i.parent=="number"&&i.parent>=0||(t+=1,i.task.toLowerCase()==="x"&&(n+=1));return t===0?null:{completed:n,total:t,percent:Math.round(n/t*100)}}function kbe(r,e,t,n,i={}){let a=kH(t,e,n);if(!nI(a))return null;let s=r.createEl("span",{cls:`task-card__metadata-property task-card__metadata-property--${e.replace(":","-")}`});try{let l=n.fieldMapper.lookupMappingKey(e)||e;return l in gbe?gbe[l](s,a,t,n,i):e.startsWith("user:")?ttt(s,e,a,n):rtt(s,e,a,n,Cc(e,n,i.propertyLabels)),!s.textContent&&!s.hasChildNodes()?(s.remove(),null):s}catch(o){return xH.warn(`TaskCard: Error rendering property ${e}:`,{category:"persistence",operation:"taskcard-rendering-property",error:o}),s.textContent=`${e}: (error)`,s}}function nI(r){return!Ex(r)}function ttt(r,e,t,n){var c;let i=e.slice(5),a=(c=n.settings.userFields)==null?void 0:c.find(d=>d.id===i);if(!a){r.textContent=`${i}: (not found)`;return}let s=a.displayName||i;r.createEl("span",{text:`${s}: `});let o=r.createEl("span",{cls:"task-card__metadata-value"}),l={metadataCache:n.app.metadataCache,workspace:n.app.workspace};if(typeof t=="string"&&t.trim()!==""){let d=t.trim();EH(d)?Dc(o,d,l):o.textContent=vbe(t,a)}else if(a.type==="list"&&Array.isArray(t))t.map(u=>Tu(u)).filter(nI).forEach((u,p)=>{if(p>0&&o.appendChild(activeDocument.createTextNode(", ")),typeof u=="string"&&u.trim()!==""){let m=u.trim();if(EH(m)){let f=o.createEl("span");Dc(f,m,l)}else o.appendChild(activeDocument.createTextNode(String(u)))}else o.appendChild(activeDocument.createTextNode(String(u)))});else{let d=vbe(t,a);o.textContent=d.trim()!==""?d:"(empty)"}}function rtt(r,e,t,n,i){let a=eI(e,{},i);r.createEl("span",{text:`${a}: `});let s=r.createEl("span",{cls:"task-card__metadata-value"});Array.isArray(t)?t.map(l=>Tu(l)).filter(nI).forEach((l,c)=>{c>0&&s.appendChild(activeDocument.createTextNode(", ")),ybe(s,l,n)}):ybe(s,t,n)}function ybe(r,e,t){if(!nI(e)||t&&XA(r,e,t.app.renderContext))return;if(typeof e=="string"&&t){let i={metadataCache:t.app.metadataCache,workspace:t.app.workspace};if(EH(e)){Dc(r,e,i,{onTagClick:async a=>{let s=a.startsWith("#")?a.slice(1):a;await t.openTagsPane(`#${s}`)}});return}r.appendChild(activeDocument.createTextNode(e));return}let n;if(typeof e=="object"&&e!==null)if(e instanceof Date)n=Ti(e.toISOString(),{dateFormat:"MMM d, yyyy",timeFormat:"",showTime:!1});else{let i=Object.entries(e);n=i.length<=3?i.map(([a,s])=>`${a}: ${Z(s)}`).join(", "):Z(e)}else typeof e=="boolean"?n=e?"\u2713":"\u2717":typeof e=="number"?n=Number.isInteger(e)?String(e):e.toFixed(2):n=Z(e);n.length>100&&(n=n.substring(0,97)+"..."),r.appendChild(activeDocument.createTextNode(n))}function EH(r){return r.includes("[[")||r.includes("](")||/]+>/i.test(r)||/(^|\s)https?:\/\/[^\s<>()]+/i.test(r)||r.includes("[")&&r.includes("](")||r.includes("#")&&/\s#\w+|#\w+/.test(r)}function vbe(r,e){if(r==null)return"";try{switch(e.type){case"text":case"number":return Z(r);case"date":return Ti(Z(r),{dateFormat:"MMM d, yyyy",timeFormat:"",showTime:!1});case"boolean":return r?"\u2713":"\u2717";case"list":return Array.isArray(r)?r.flat(2).map(Z).join(", "):Z(r);default:return Z(r)}}catch(t){return xH.warn("TaskCard: Error formatting user property value:",{category:"validation",operation:"taskcard-formatting-user-property-value",error:t}),Z(r)}}function rI(r){let e=Number(ke(r).slice(0,4));return Number.isInteger(e)&&e!==new Date().getFullYear()?"MMM d, yyyy":"MMM d"}function ntt(r,e,t,n,i){var p,m;let a=I_(e),s=n.statusManager.isCompletedStatus(t.status),o=(m=(p=n.settings)==null?void 0:p.hideCompletedFromOverdue)!=null?m:!0,l=iu(e,s,o),c=n.settings.calendarViewSettings.timeFormat,d=Cc("due",n,i),u="";if(a){let f=Ti(e,{dateFormat:"",showTime:!0,userTimeFormat:c});u=f.trim()===""?Zp(n,"dueToday",{label:d}):Zp(n,"dueTodayAt",{label:d,time:f})}else if(l){let f=Ti(e,{dateFormat:rI(e),showTime:!0,userTimeFormat:c});u=Zp(n,"dueOverdue",{label:d,display:f})}else{let f=Ti(e,{dateFormat:rI(e),showTime:!0,userTimeFormat:c});u=Zp(n,"dueLabel",{label:d,display:f})}r.textContent=u,r.classList.add("task-card__metadata-date","task-card__metadata-date--due"),l&&r.classList.add("task-card__metadata-date--overdue"),r.dataset.tnAction="edit-date",r.dataset.tnDateType="due",bbe(r,t,n,"due")}function itt(r,e,t,n,i){var p,m;let a=I_(e),s=n.statusManager.isCompletedStatus(t.status),o=(m=(p=n.settings)==null?void 0:p.hideCompletedFromOverdue)!=null?m:!0,l=iu(e,s,o),c=n.settings.calendarViewSettings.timeFormat,d=Cc("scheduled",n,i),u="";if(a){let f=Ti(e,{dateFormat:"",showTime:!0,userTimeFormat:c});u=f.trim()===""?Zp(n,"scheduledToday",{label:d}):Zp(n,"scheduledTodayAt",{label:d,time:f})}else if(l){let f=Ti(e,{dateFormat:rI(e),showTime:!0,userTimeFormat:c});u=Zp(n,"scheduledPast",{label:d,display:f})}else{let f=Ti(e,{dateFormat:rI(e),showTime:!0,userTimeFormat:c});u=Zp(n,"scheduledLabel",{label:d,display:f})}r.textContent=u,r.classList.add("task-card__metadata-date","task-card__metadata-date--scheduled"),l&&r.classList.add("task-card__metadata-date--past"),r.dataset.tnAction="edit-date",r.dataset.tnDateType="scheduled",bbe(r,t,n,"scheduled")}function wbe(r,e){r.style.display=e.length>0?"":"none"}var ib,xH,gbe,Sbe=y(()=>{ib=require("obsidian");Nh();Rh();Ct();qp();Ne();gr();xc();xx();SH();Kp();fbe();ko();G();xH=I({tag:"Ui/TaskCardProperties"});gbe={due:(r,e,t,n,i)=>{typeof e=="string"&&ntt(r,e,t,n,i==null?void 0:i.propertyLabels)},scheduled:(r,e,t,n,i)=>{typeof e=="string"&&itt(r,e,t,n,i==null?void 0:i.propertyLabels)},projects:(r,e,t,n)=>{if(Array.isArray(e)){let i={metadataCache:n.app.metadataCache,workspace:n.app.workspace,sourcePath:t.path};nb(r,e,i)}},contexts:(r,e,t,n)=>{if(Array.isArray(e)){let i={onTagClick:async a=>{let s=a.startsWith("@")?a.slice(1):a;await n.openTagsPane(`#${s}`)},linkServices:{metadataCache:n.app.metadataCache,workspace:n.app.workspace,sourcePath:t.path}};mbe(r,e,i)}},tags:(r,e,t,n)=>{if(Array.isArray(e)){let i=e;n.settings.taskIdentificationMethod==="tag"&&n.settings.hideIdentifyingTagsInCards&&(i=bu(e,n.settings.taskTag,n.settings.hideIdentifyingTagsMode)),i.length>0&&pbe(r,i,{onTagClick:async s=>{let o=s.startsWith("#")?s.slice(1):s;await n.openTagsPane(`#${o}`)}})}},timeEstimate:(r,e,t,n)=>{typeof e=="number"&&(r.textContent=`${n.formatTime(e)} estimated`)},totalTrackedTime:(r,e,t,n)=>{typeof e=="number"&&e>0&&(r.textContent=`${n.formatTime(e)} tracked`)},recurrence:(r,e,t,n,i)=>{typeof e=="string"&&(r.textContent=Cx(n,e,i==null?void 0:i.propertyLabels))},recurrenceParent:(r,e,t,n)=>{if(typeof e=="string"&&e.trim()!==""){r.createEl("span",{text:"Parent: "});let i={metadataCache:n.app.metadataCache,workspace:n.app.workspace,sourcePath:t.path};Dc(r,e,i)}},occurrenceDate:(r,e,t,n)=>{var i;typeof e=="string"&&(r.textContent=`Occurrence: ${Ti(e,{dateFormat:"MMM d",showTime:!1,userTimeFormat:(i=n.settings.calendarViewSettings)==null?void 0:i.timeFormat})}`,r.classList.add("task-card__metadata-pill--occurrence"))},occurrenceMaterialization:(r,e)=>{e==="manual"?r.textContent="Occurrence notes: manual":e==="on_completion"?r.textContent="Occurrence notes: after completion":e==="rolling"&&(r.textContent="Occurrence notes: rolling")},occurrenceNextTrigger:(r,e)=>{e==="completion"?r.textContent="Next note: completion":e==="completion_or_skip"&&(r.textContent="Next note: completion or skip")},occurrenceTemplate:(r,e,t,n)=>{if(typeof e=="string"&&e.trim()!==""){r.createEl("span",{text:"Template: "});let i={metadataCache:n.app.metadataCache,workspace:n.app.workspace,sourcePath:t.path};Dc(r,e,i)}},completeInstances:(r,e,t)=>{var n;if(Array.isArray(e)&&e.length>0){let i=e.length,a=((n=t.skipped_instances)==null?void 0:n.length)||0,s=zpe(t);if(s){let o=Math.max(s,i+a),l=Math.round(i/o*100);r.textContent=`\u2713 ${i}/${o} completed (${l}%)`}else r.textContent=`\u2713 ${i} completed`;r.classList.add("task-card__metadata-pill--completed-instances")}},skippedInstances:(r,e)=>{Array.isArray(e)&&e.length>0&&(r.textContent=`\u2298 ${e.length} skipped`,r.classList.add("task-card__metadata-pill--skipped-instances"))},completedDate:(r,e,t,n,i)=>{if(typeof e=="string"){let a=Cc("completedDate",n,i==null?void 0:i.propertyLabels);r.textContent=`${a}: ${Ti(e,{dateFormat:"MMM d",showTime:!1,userTimeFormat:n.settings.calendarViewSettings.timeFormat})}`}},dateCreated:(r,e,t,n,i)=>{if(typeof e=="string"){let a=Cc("dateCreated",n,i==null?void 0:i.propertyLabels);r.textContent=`${a}: ${Ti(e,{dateFormat:"MMM d",showTime:!1,userTimeFormat:n.settings.calendarViewSettings.timeFormat})}`}},dateModified:(r,e,t,n,i)=>{if(typeof e=="string"){let a=Cc("dateModified",n,i==null?void 0:i.propertyLabels);r.textContent=`${a}: ${Ti(e,{dateFormat:"MMM d",showTime:!1,userTimeFormat:n.settings.calendarViewSettings.timeFormat})}`}},blocked:(r,e,t,n,i)=>{var a,s;if(e===!0){let o=(s=(a=t.blockedBy)==null?void 0:a.length)!=null?s:0,l=Cc("blocked",n,i==null?void 0:i.propertyLabels);r.textContent=o>0?`${l} (${o})`:l,r.classList.add("task-card__metadata-pill--blocked")}},blocking:(r,e,t,n,i)=>{var a,s;if(e===!0){let o=(s=(a=t.blocking)==null?void 0:a.length)!=null?s:0,l=Cc("blocking",n,i==null?void 0:i.propertyLabels);r.textContent=o>0?`${l} (${o})`:l,r.classList.add("task-card__metadata-pill--blocking")}},blockedBy:(r,e,t,n)=>{if(Array.isArray(e)&&e.length>0){r.createEl("span",{text:"Blocked by: "});let i=r.createEl("span"),a={metadataCache:n.app.metadataCache,workspace:n.app.workspace,sourcePath:t.path};e.forEach((s,o)=>{o>0&&i.appendChild(activeDocument.createTextNode(", "));let l=Jet(s,t,n);l&&Dl(i,l.path,l.displayText,a)})}},blockingTasks:(r,e,t,n)=>{if(Array.isArray(e)&&e.length>0){r.createEl("span",{text:"Blocking: "});let i=r.createEl("span");e.forEach((a,s)=>{var l;s>0&&i.appendChild(activeDocument.createTextNode(", "));let o=i.createEl("a",{cls:"internal-link",attr:{href:a}});o.textContent=((l=a.split("/").pop())==null?void 0:l.replace(".md",""))||a,o.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),n.app.workspace.openLinkText(a,"",!1)})})}},timeEntries:(r,e,t,n)=>{if(Array.isArray(e)&&e.length>0){let i=Aa(e);i>0&&(r.textContent=`${n.formatTime(i)} tracked (${e.length} ${e.length===1?"entry":"entries"})`)}},reminders:(r,e)=>{Array.isArray(e)&&e.length>0&&(r.textContent=`${e.length} ${e.length===1?"reminder":"reminders"}`)},icsEventId:(r,e,t,n)=>{let i=Zet(e);if(i.length===0)return;let a=i.map(s=>{var o;return(o=n.icsNoteService.findEventById(s))==null?void 0:o.event}).filter(s=>!!s).map(s=>Qet(s,n));a.length>0?r.textContent=`Calendar: ${a.join(", ")}`:r.textContent=`Linked to ${i.length} calendar ${i.length===1?"event":"events"}`},checklistProgress:(r,e,t,n)=>{let i=Xet(t.path,n);if(!i)return;let a=r.createEl("span",{cls:"task-card__progress"}),o=a.createEl("span",{cls:"task-card__progress-bar"}).createEl("span",{cls:"task-card__progress-fill"});o.style.width=`${i.percent}%`,i.percent>0&&i.percent<5&&(o.classList.remove("tn-static-min-width-0-3922d326"),o.classList.add("tn-static-min-width-2px-709d7da0")),a.createEl("span",{cls:"task-card__progress-label",text:`${i.completed}/${i.total}`}),(0,ib.setTooltip)(a,`${i.percent}% complete (${i.completed}/${i.total})`,{placement:"top"})}}});function att(r){if(typeof r=="number")return r===1?"show-all":"inherit";let e=Z(r).trim().toLowerCase().replace(/^['"]|['"]$/g,"").replace(/[_\s]+/g,"-");return e==="show-all"||e==="1"?"show-all":"inherit"}function iI(r,e={}){var i,a;if(att((a=(i=e.resolveExpandedRelationshipFilterMode)==null?void 0:i.call(e))!=null?a:e.expandedRelationshipFilterMode)!=="inherit")return r;let n=e.expandedRelationshipTaskPaths;return n?r.filter(s=>n.has(s.path)):r}function Ebe(r,e={},t){let n=e.expandedRelationshipTaskOrder;if(!n||n.size===0)return t([...r]);let i=[],a=[];for(let s of r)n.has(s.path)?i.push(s):a.push(s);return i.sort((s,o)=>{let l=n.get(s.path),c=n.get(o.path);return l===void 0||c===void 0?0:l-c}),[...i,...t([...a])]}function Oh(r,e){let t=Array.isArray(r.blockedBy)?r.blockedBy:[],n=new Set;for(let i of t){let a=ts(i);if(!a)continue;let s=wl(e,r.path,a),o=(s==null?void 0:s.path)||a.uid;o&&n.add(o)}return Array.from(n)}var aI=y(()=>{ko();gr()});function Pl(r){if(r.setAttribute("role","button"),r.tabIndex=0,r.dataset.tnNoDrag==="true"){r.setAttribute("draggable","false");return}r.dataset.tnNoDrag="true",r.setAttribute("draggable","false"),r.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation()}),r.addEventListener("keydown",e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),e.stopPropagation(),r.click())})}function Pc(r){let{container:e,className:t,icon:n,tooltip:i,ariaLabel:a,onClick:s,visible:o=!0}=r;if(!o)return null;let l=e.createEl("div",{cls:t,attr:{"aria-label":a||i}});return(0,Dx.setIcon)(l,n),(0,Dx.setTooltip)(l,i,{placement:"top"}),s&&(Pl(l),l.addEventListener("click",c=>{c.stopPropagation(),s(c)})),l}function Lh(r,e,t){let n=r.querySelector(e);if(!t.shouldExist)return n==null||n.remove(),null;if(n)return n.setAttribute("aria-label",t.ariaLabel||t.tooltip),(0,Dx.setTooltip)(n,t.tooltip,{placement:"top"}),t.onClick&&Pl(n),n;let a=r.querySelector(".task-card__badges")||r.querySelector(".task-card__main-row");return a?Pc({container:a,...t}):null}var Dx,Px=y(()=>{Dx=require("obsidian")});var xbe={};et(xbe,{PriorityContextMenu:()=>ku});var ku,Mx=y(()=>{du();ku=class{constructor(e){this.targetDoc=activeDocument;this.menu=new ki,this.options=e,this.buildMenu()}buildMenu(){this.sortedPriorities=this.options.plugin.priorityManager.getPrioritiesByWeightAsc(),this.sortedPriorities.forEach(e=>{this.menu.addItem(t=>{let n=e.label;t.setIcon("star"),e.value===this.options.currentValue&&(n=`\u2713 ${e.label}`),t.setTitle(n),t.onClick(async()=>{this.options.onSelect(e.value)})})})}show(e){var t,n;(n=(t=e.target)==null?void 0:t.instanceOf)!=null&&n.call(t,HTMLElement)&&(this.targetDoc=e.target.ownerDocument),this.menu.show(e),window.setTimeout(()=>{this.applyColorStyling()},10)}showAtElement(e){this.targetDoc=e.ownerDocument,this.menu.showAtPosition({x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().bottom+4}),window.setTimeout(()=>{this.applyColorStyling()},10)}applyColorStyling(){let e=this.targetDoc.querySelector(".menu");if(!e)return;let t=e.querySelectorAll(".menu-item");this.sortedPriorities.forEach((n,i)=>{let a=t[i];if(a&&n.color){let s=a.querySelector(".menu-item-icon");s&&(s.style.color=n.color)}})}}});var Ibe={};et(Ibe,{RecurrenceContextMenu:()=>Ml,buildCustomRecurrenceRule:()=>Abe,buildRecurrenceOptions:()=>_be,buildWeekdaysOnlyRecurrenceRule:()=>oI,formatDateForDTSTART:()=>Mbe,formatDateForInput:()=>DH,getMonthDayOptions:()=>PH,getOrderedRecurrenceWeekdays:()=>Dbe,getPluginCalendarLocale:()=>Ax,getRecurrenceStartDate:()=>_x,getWeekdayOnlyRRuleCodes:()=>Pbe});function Cbe(r){if(r)try{let e=Intl.Locale;return e?new e(r).weekInfo:void 0}catch(e){return}}function stt(r,e){var n;if(typeof r=="number"&&Number.isInteger(r)&&r>=0&&r<=6)return r;let t=(n=Cbe(e))==null?void 0:n.firstDay;return typeof t=="number"?t%7:1}function Ax(r){var n,i,a;let e=(a=(i=(n=r.settings)==null?void 0:n.calendarViewSettings)==null?void 0:i.locale)==null?void 0:a.trim();if(e)return e;let t=typeof navigator!="undefined"?navigator.language:"";if(t)return t;try{return Intl.DateTimeFormat().resolvedOptions().locale}catch(s){return}}function Dbe(r,e){let t=stt(r,e),n=sI.findIndex(a=>a.dateIndex===t),i=n>=0?n:1;return[...sI.slice(i),...sI.slice(0,i)]}function Pbe(r){var i,a;let e=(a=(i=Cbe(r))==null?void 0:i.weekend)==null?void 0:a.map(s=>s%7).filter(s=>s>=0&&s<=6);if(!e||e.length===0)return["MO","TU","WE","TH","FR"];let t=new Set(e),n=sI.filter(s=>!t.has(s.dateIndex)).map(s=>s.code);return n.length>0&&n.length<7?n:["MO","TU","WE","TH","FR"]}function oI(r,e){return`DTSTART:${r};FREQ=WEEKLY;BYDAY=${Pbe(e).join(",")}`}function _x(r,e=new Date){let t=r==null?void 0:r.match(/^(\d{4})-(\d{2})-(\d{2})/);if(!t)return e;let n=parseInt(t[1],10),i=parseInt(t[2],10),a=parseInt(t[3],10),s=new Date(n,i-1,a);return s.getFullYear()!==n||s.getMonth()!==i-1||s.getDate()!==a?e:s}function Mbe(r){let e=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${e}${t}${n}`}function DH(r){let e=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${e}-${t}-${n}`}function ott(r){if(!(r!=null&&r.includes("T")))return;let e=r.match(/T(\d{2}):(\d{2})/);if(e)return`${e[1]}${e[2]}00Z`}function CH(r){let e=["th","st","nd","rd"],t=r%100;return r+(e[(t-20)%10]||e[t]||e[0])}function _be(r){let e=[],t=_x(r.scheduledDate),n=["SU","MO","TU","WE","TH","FR","SA"],i=["January","February","March","April","May","June","July","August","September","October","November","December"],a=n[t.getDay()],s=t.getDate(),o=t.getMonth()+1,l=i[t.getMonth()],c=t.toLocaleDateString(r.calendarLocale||void 0,{weekday:"long"}),d=Mbe(t);if(r.currentValue){let u=r.currentValue.match(/DTSTART:(\d{8}(?:T\d{6}Z?)?)/);if(u&&u[1].includes("T")){let p=u[1].split("T")[1];d=`${d}T${p}`}}else{let u=ott(r.scheduledDate);u&&(d=`${d}T${u}`)}return e.push({label:r.translate("components.recurrenceContextMenu.daily"),value:`DTSTART:${d};FREQ=DAILY;INTERVAL=1`,icon:"calendar-days"}),e.push({label:r.translate("components.recurrenceContextMenu.weeklyOn",{day:c}),value:`DTSTART:${d};FREQ=WEEKLY;INTERVAL=1;BYDAY=${a}`,icon:"calendar"}),e.push({label:r.translate("components.recurrenceContextMenu.everyTwoWeeksOn",{day:c}),value:`DTSTART:${d};FREQ=WEEKLY;INTERVAL=2;BYDAY=${a}`,icon:"calendar"}),e.push({label:r.translate("components.recurrenceContextMenu.monthlyOnThe",{ordinal:CH(s)}),value:`DTSTART:${d};FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=${s}`,icon:"calendar-range"}),e.push({label:r.translate("components.recurrenceContextMenu.everyThreeMonthsOnThe",{ordinal:CH(s)}),value:`DTSTART:${d};FREQ=MONTHLY;INTERVAL=3;BYMONTHDAY=${s}`,icon:"calendar-range"}),e.push({label:r.translate("components.recurrenceContextMenu.yearlyOn",{month:l,ordinal:CH(s)}),value:`DTSTART:${d};FREQ=YEARLY;INTERVAL=1;BYMONTH=${o};BYMONTHDAY=${s}`,icon:"calendar-clock"}),e.push({label:r.translate("components.recurrenceContextMenu.weekdaysOnly"),value:oI(d,r.calendarLocale),icon:"briefcase"}),e.push({label:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",value:"",icon:void 0}),e.push({label:r.translate("components.recurrenceContextMenu.dailyAfterCompletion"),value:`DTSTART:${d};FREQ=DAILY;INTERVAL=1`,icon:"calendar-days",anchor:"completion"}),e.push({label:r.translate("components.recurrenceContextMenu.every3DaysAfterCompletion"),value:`DTSTART:${d};FREQ=DAILY;INTERVAL=3`,icon:"calendar-days",anchor:"completion"}),e.push({label:r.translate("components.recurrenceContextMenu.weeklyAfterCompletion"),value:`DTSTART:${d};FREQ=WEEKLY;INTERVAL=1`,icon:"calendar",anchor:"completion"}),e.push({label:r.translate("components.recurrenceContextMenu.monthlyAfterCompletion"),value:`DTSTART:${d};FREQ=MONTHLY;INTERVAL=1`,icon:"calendar-range",anchor:"completion"}),e}function Abe(r){let e=[],t=r.recurrenceAnchor==="completion";if(r.dtstart){let n=r.dtstart.replace(/-/g,"");if(r.dtstartTime){let i=r.dtstartTime.replace(":","")+"00";n=`${n}T${i}`}e.push(`DTSTART:${n}`)}switch(e.push(`FREQ=${r.frequency}`),r.interval>1&&e.push(`INTERVAL=${r.interval}`),r.frequency){case"DAILY":!t&&r.byDay.length>0&&e.push(`BYDAY=${r.byDay.join(",")}`);break;case"WEEKLY":!t&&r.byDay.length>0&&e.push(`BYDAY=${r.byDay.join(",")}`);break;case"MONTHLY":if(t)break;if(r.monthlyType==="bydate"){let n=r.byMonthDay.length>0?r.byMonthDay[0]:new Date().getDate();e.push(`BYMONTHDAY=${n}`)}else if(r.monthlyType==="byday"&&r.byDay.length>0){let n=r.bySetPos||1;e.push(`BYDAY=${n}${r.byDay[0]}`)}break;case"YEARLY":if(t)break;if(r.yearlyType==="bydate"){let n=r.byMonth.length>0?r.byMonth[0]:new Date().getMonth()+1,i=r.byMonthDay.length>0?r.byMonthDay[0]:new Date().getDate();e.push(`BYMONTH=${n}`),e.push(`BYMONTHDAY=${i}`)}else if(r.yearlyType==="byday"){let n=r.byMonth.length>0?r.byMonth[0]:new Date().getMonth()+1;if(e.push(`BYMONTH=${n}`),r.byDay.length>0){let i=r.bySetPos||1;e.push(`BYDAY=${i}${r.byDay[0]}`)}}break}switch(r.endType){case"count":r.count&&r.count>0&&e.push(`COUNT=${r.count}`);break;case"until":r.until&&e.push(`UNTIL=${r.until.replace(/-/g,"")}`);break}return e.join(";")}function PH(){return[...Array.from({length:31},(r,e)=>{let t=e+1;return{value:t.toString(),text:t.toString()}}),{value:"-1",text:"Last day"}]}var Io,sI,Ml,MH,ab=y(()=>{Io=require("obsidian");du();yx();sI=[{dateIndex:0,code:"SU",nameKey:"sunday",shortKey:"sun"},{dateIndex:1,code:"MO",nameKey:"monday",shortKey:"mon"},{dateIndex:2,code:"TU",nameKey:"tuesday",shortKey:"tue"},{dateIndex:3,code:"WE",nameKey:"wednesday",shortKey:"wed"},{dateIndex:4,code:"TH",nameKey:"thursday",shortKey:"thu"},{dateIndex:5,code:"FR",nameKey:"friday",shortKey:"fri"},{dateIndex:6,code:"SA",nameKey:"saturday",shortKey:"sat"}];Ml=class{constructor(e){this.menu=new ki,this.options=e,this.translate=e.plugin.i18n.translate.bind(e.plugin.i18n),this.buildMenu()}buildMenu(){this.getRecurrenceOptions().forEach(t=>{if(t.label.startsWith("\u2500")){this.menu.addSeparator();return}this.menu.addItem(n=>{let i=t.label;t.icon&&n.setIcon(t.icon),t.value===this.options.currentValue&&(i=`\u2713 ${t.label}`),n.setTitle(i),n.onClick(async()=>{let a=t.anchor||"scheduled";this.options.onSelect(t.value,a)})})}),this.menu.addSeparator(),this.menu.addItem(t=>{t.setTitle(this.translate("components.recurrenceContextMenu.customRecurrence")),t.setIcon("settings"),t.onClick(async()=>{this.showCustomRecurrenceModal()})}),this.options.currentValue&&this.menu.addItem(t=>{t.setTitle(this.translate("components.recurrenceContextMenu.clearRecurrence")),t.setIcon("x"),t.onClick(async()=>{this.options.onSelect(null)})})}getRecurrenceOptions(){return _be({currentValue:this.options.currentValue,scheduledDate:this.options.scheduledDate,calendarLocale:Ax(this.options.plugin),translate:this.translate})}showCustomRecurrenceModal(){new MH(this.options.app,this.options.currentValue||"",this.options.currentAnchor||"scheduled",this.options.scheduledDate,this.options.plugin,(e,t)=>{e&&this.options.onSelect(e,t)}).open()}show(e){this.menu.show(e)}},MH=class extends Io.Modal{constructor(t,n,i,a,s,o){super(t);this.frequency="DAILY";this.interval=1;this.byDay=[];this.byMonthDay=[];this.byMonth=[];this.until="";this.endType="never";this.dtstart="";this.dtstartTime="";this.recurrenceAnchor="scheduled";this.currentValue=n,this.recurrenceAnchor=i,this.scheduledDate=a,this.plugin=s,this.translate=s.i18n.translate.bind(s.i18n),this.onSubmit=o,this.parseCurrentValue()}parseCurrentValue(){if(!this.currentValue){if(this.dtstart=DH(_x(this.scheduledDate)),this.scheduledDate&&this.scheduledDate.includes("T")){let n=this.scheduledDate.match(/T(\d{2}):(\d{2})/);n&&(this.dtstartTime=`${n[1]}:${n[2]}`)}return}let t=this.currentValue.split(";");for(let n of t){let i=n.includes(":")&&n.startsWith("DTSTART")?":":"=",[a,s]=n.split(i);switch(a){case"DTSTART":if(s.length>=8){if(this.dtstart=`${s.slice(0,4)}-${s.slice(4,6)}-${s.slice(6,8)}`,s.length>8&&s.includes("T")){let o=s.slice(9);o.length>=4&&(this.dtstartTime=`${o.slice(0,2)}:${o.slice(2,4)}`)}}else{let o=new Date(s);isNaN(o.getTime())?this.dtstart=DH(_x(this.scheduledDate)):this.dtstart=s}break;case"FREQ":this.frequency=s;break;case"INTERVAL":this.interval=parseInt(s)||1;break;case"BYDAY":{let o=s.split(","),l=[];for(let c of o){let d=c.match(/^(-?\d+)([A-Z]{2})$/);d?(this.bySetPos=parseInt(d[1]),l.push(d[2])):l.push(c)}this.byDay=l;break}case"BYMONTHDAY":this.byMonthDay=s.split(",").map(o=>parseInt(o));break;case"BYMONTH":this.byMonth=s.split(",").map(o=>parseInt(o));break;case"BYSETPOS":this.bySetPos=parseInt(s);break;case"COUNT":this.count=parseInt(s),this.endType="count";break;case"UNTIL":s.length===8?this.until=`${s.slice(0,4)}-${s.slice(4,6)}-${s.slice(6,8)}`:this.until=s,this.endType="until";break}}}onOpen(){var xn,Os;let{contentEl:t}=this;t.empty();let n=Ax(this.plugin),i=(Os=(xn=this.plugin.settings)==null?void 0:xn.calendarViewSettings)==null?void 0:Os.firstDay,a=Dbe(i,n),s=_x(this.scheduledDate);t.createEl("h2",{text:this.translate("components.recurrenceContextMenu.customRecurrenceModal.title")}),new Io.Setting(t).setName("Start date").setDesc("The date when the recurrence pattern begins").addText(ae=>{ae.inputEl.type="date",ae.setValue(this.dtstart).onChange(xe=>{this.dtstart=xe}),Sc(ae.inputEl,{onCommit:xe=>{this.dtstart=xe}})}),new Io.Setting(t).setName("Start time").setDesc("The time when recurring instances should appear (optional)").addText(ae=>{ae.inputEl.type="time",ae.setValue(this.dtstartTime).onChange(xe=>{this.dtstartTime=xe})}),new Io.Setting(t).setName("Recur from").setDesc("When should the next occurrence be calculated from?").addDropdown(ae=>{ae.addOption("scheduled","Scheduled date (fixed schedule)").addOption("completion","Completion date (flexible schedule)").setValue(this.recurrenceAnchor).onChange(xe=>{this.recurrenceAnchor=xe,this.updateFrequencySpecificVisibility()})}),new Io.Setting(t).setName("Frequency").addDropdown(ae=>{ae.addOption("DAILY","Daily").addOption("WEEKLY","Weekly").addOption("MONTHLY","Monthly").addOption("YEARLY","Yearly").setValue(this.frequency).onChange(xe=>{this.frequency=xe,this.updateFrequencySpecificVisibility()})}),new Io.Setting(t).setName("Interval").setDesc("Every X days/weeks/months/years").addText(ae=>{ae.setValue(this.interval.toString()).onChange(xe=>{this.interval=parseInt(xe)||1})});let o=new Io.Setting(t).setName("Days of week").setDesc("Select specific days (for daily or weekly recurrence)"),l=o.controlEl.createDiv("days-container");a.map(ae=>({key:ae.code,label:this.translate(`components.recurrenceContextMenu.customRecurrenceModal.weekdaysShort.${ae.shortKey}`)})).forEach(ae=>{let xe=l.createEl("label",{cls:"day-checkbox"});xe.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),xe.classList.add("tn-static-display-inline-block-60e32dcb"),xe.classList.remove("tn-static-margin-right-4px-c6b76b85"),xe.classList.add("tn-static-margin-right-8px-539fa9a0");let gn=xe.createEl("input",{type:"checkbox"});gn.checked=this.byDay.includes(ae.key),gn.addEventListener("change",()=>{gn.checked?this.byDay.includes(ae.key)||this.byDay.push(ae.key):this.byDay=this.byDay.filter(Uf=>Uf!==ae.key)}),xe.createSpan({text:` ${ae.label}`})});let d=new Io.Setting(t).setName("Monthly recurrence").setDesc("Choose how to repeat monthly"),u=d.controlEl.createDiv("monthly-options"),p=u.createEl("label",{cls:"radio-option"});p.classList.remove("tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),p.classList.add("tn-static-display-block-2a1b75c9"),p.classList.remove("tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-bottom-0-75rem-c05a3c6e","tn-static-margin-bottom-20px-49f14f8f"),p.classList.add("tn-static-margin-bottom-8px-fdf33f23");let m=p.createEl("input",{type:"radio",value:"bydate"});m.name="monthly-type",m.checked=this.byMonthDay.length>0||this.byDay.length===0&&this.bySetPos===void 0,p.createSpan({text:" On "});let f=p.createEl("select");f.classList.add("tn-static-margin-left-4px-46cec891"),f.classList.remove("tn-static-margin-right-8px-539fa9a0"),f.classList.add("tn-static-margin-right-4px-c6b76b85");for(let ae of PH()){let xe=f.createEl("option",{value:ae.value,text:ae.text}),gn=parseInt(ae.value,10);(this.byMonthDay.length>0&&this.byMonthDay[0]===gn||this.byMonthDay.length===0&&gn===s.getDate())&&(xe.selected=!0)}p.createSpan({text:" of each month"});let h=u.createEl("label",{cls:"radio-option"});h.classList.remove("tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),h.classList.add("tn-static-display-block-2a1b75c9"),h.classList.remove("tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-bottom-0-75rem-c05a3c6e","tn-static-margin-bottom-20px-49f14f8f"),h.classList.add("tn-static-margin-bottom-8px-fdf33f23");let g=h.createEl("input",{type:"radio",value:"byday"});g.name="monthly-type",g.checked=this.byDay.length>0&&this.bySetPos!==void 0,h.createSpan({text:" On the "});let v=h.createEl("select");v.classList.add("tn-static-margin-left-4px-46cec891"),v.classList.remove("tn-static-margin-right-8px-539fa9a0"),v.classList.add("tn-static-margin-right-4px-c6b76b85");let k=[{value:"1",text:"first"},{value:"2",text:"second"},{value:"3",text:"third"},{value:"4",text:"fourth"},{value:"-1",text:"last"}];k.forEach(ae=>{let xe=v.createEl("option",{value:ae.value,text:ae.text});(this.bySetPos===parseInt(ae.value)||!this.bySetPos&&ae.value==="1")&&(xe.selected=!0)});let b=h.createEl("select");b.classList.add("tn-static-margin-left-4px-46cec891"),b.classList.remove("tn-static-margin-right-8px-539fa9a0"),b.classList.add("tn-static-margin-right-4px-c6b76b85");let w=a.map(ae=>({value:ae.code,text:this.translate(`components.recurrenceContextMenu.customRecurrenceModal.weekdays.${ae.nameKey}`)})),S=["SU","MO","TU","WE","TH","FR","SA"][s.getDay()];w.forEach(ae=>{let xe=b.createEl("option",{value:ae.value,text:ae.text});(this.byDay.length>0&&this.byDay[0]===ae.value||this.byDay.length===0&&ae.value===S)&&(xe.selected=!0)}),h.createSpan({text:" of each month"});let x=new Io.Setting(t).setName("Yearly recurrence").setDesc("Choose how to repeat yearly"),C=x.controlEl.createDiv("yearly-options"),D=C.createEl("label",{cls:"radio-option"});D.classList.remove("tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),D.classList.add("tn-static-display-block-2a1b75c9"),D.classList.remove("tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-bottom-0-75rem-c05a3c6e","tn-static-margin-bottom-20px-49f14f8f"),D.classList.add("tn-static-margin-bottom-8px-fdf33f23");let _=D.createEl("input",{type:"radio",value:"bydate"});_.name="yearly-type",_.checked=this.byMonthDay.length>0||this.byDay.length===0&&this.bySetPos===void 0,D.createSpan({text:" On "});let O=D.createEl("select");O.classList.add("tn-static-margin-left-4px-46cec891"),O.classList.remove("tn-static-margin-right-8px-539fa9a0"),O.classList.add("tn-static-margin-right-4px-c6b76b85");let L=["January","February","March","April","May","June","July","August","September","October","November","December"];L.forEach((ae,xe)=>{let gn=O.createEl("option",{value:(xe+1).toString(),text:ae});(this.byMonth.length>0&&this.byMonth[0]===xe+1||this.byMonth.length===0&&xe+1===s.getMonth()+1)&&(gn.selected=!0)});let N=D.createEl("select");N.classList.add("tn-static-margin-left-4px-46cec891"),N.classList.remove("tn-static-margin-right-8px-539fa9a0"),N.classList.add("tn-static-margin-right-4px-c6b76b85");for(let ae of PH()){let xe=N.createEl("option",{value:ae.value,text:ae.text}),gn=parseInt(ae.value,10);(this.byMonthDay.length>0&&this.byMonthDay[0]===gn||this.byMonthDay.length===0&&gn===s.getDate())&&(xe.selected=!0)}D.createSpan({text:" each year"});let R=C.createEl("label",{cls:"radio-option"});R.classList.remove("tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),R.classList.add("tn-static-display-block-2a1b75c9"),R.classList.remove("tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-bottom-0-75rem-c05a3c6e","tn-static-margin-bottom-20px-49f14f8f"),R.classList.add("tn-static-margin-bottom-8px-fdf33f23");let z=R.createEl("input",{type:"radio",value:"byday"});z.name="yearly-type",z.checked=this.byDay.length>0&&this.bySetPos!==void 0,R.createSpan({text:" On the "});let H=R.createEl("select");H.classList.add("tn-static-margin-left-4px-46cec891"),H.classList.remove("tn-static-margin-right-8px-539fa9a0"),H.classList.add("tn-static-margin-right-4px-c6b76b85"),k.forEach(ae=>{let xe=H.createEl("option",{value:ae.value,text:ae.text});(this.bySetPos===parseInt(ae.value)||!this.bySetPos&&ae.value==="1")&&(xe.selected=!0)});let Y=R.createEl("select");Y.classList.add("tn-static-margin-left-4px-46cec891"),Y.classList.remove("tn-static-margin-right-8px-539fa9a0"),Y.classList.add("tn-static-margin-right-4px-c6b76b85"),w.forEach(ae=>{let xe=Y.createEl("option",{value:ae.value,text:ae.text});(this.byDay.length>0&&this.byDay[0]===ae.value||this.byDay.length===0&&ae.value===S)&&(xe.selected=!0)});let se=R.createEl("select");se.classList.add("tn-static-margin-left-4px-46cec891"),se.classList.remove("tn-static-margin-right-8px-539fa9a0"),se.classList.add("tn-static-margin-right-4px-c6b76b85"),L.forEach((ae,xe)=>{let gn=se.createEl("option",{value:(xe+1).toString(),text:ae});(this.byMonth.length>0&&this.byMonth[0]===xe+1||this.byMonth.length===0&&xe+1===s.getMonth()+1)&&(gn.selected=!0)}),R.createSpan({text:" each year"}),new Io.Setting(t).setName("End condition").setDesc("Choose when the recurrence should end");let J=t.createDiv("end-condition-container"),te=J.createEl("label",{cls:"radio-option"});te.classList.remove("tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),te.classList.add("tn-static-display-block-2a1b75c9"),te.classList.remove("tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-bottom-0-75rem-c05a3c6e","tn-static-margin-bottom-20px-49f14f8f"),te.classList.add("tn-static-margin-bottom-8px-fdf33f23");let Te=te.createEl("input",{type:"radio",value:"never"});Te.name="end-type",Te.checked=this.endType==="never",te.createSpan({text:" Never ends"});let Ce=J.createEl("label",{cls:"radio-option"});Ce.classList.remove("tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),Ce.classList.add("tn-static-display-block-2a1b75c9"),Ce.classList.remove("tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-bottom-0-75rem-c05a3c6e","tn-static-margin-bottom-20px-49f14f8f"),Ce.classList.add("tn-static-margin-bottom-8px-fdf33f23");let X=Ce.createEl("input",{type:"radio",value:"count"});X.name="end-type",X.checked=this.endType==="count",Ce.createSpan({text:" End after "});let ne=Ce.createEl("input",{type:"number",placeholder:"10"});ne.classList.remove("tn-static-width-100-0466783d","tn-static-width-12px-fbf353fb","tn-static-width-16px-7375d50b","tn-static-width-1px-aa77e27e","tn-static-width-200px-2acaf3b5","tn-static-width-80px-8573bae3"),ne.classList.add("tn-static-width-60px-bd09c419"),ne.classList.add("tn-static-margin-left-4px-46cec891"),ne.classList.remove("tn-static-margin-right-8px-539fa9a0"),ne.classList.add("tn-static-margin-right-4px-c6b76b85"),ne.value=this.count?this.count.toString():"",Ce.createSpan({text:" occurrences"});let st=J.createEl("label",{cls:"radio-option"});st.classList.remove("tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),st.classList.add("tn-static-display-block-2a1b75c9"),st.classList.remove("tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-bottom-0-75rem-c05a3c6e","tn-static-margin-bottom-20px-49f14f8f"),st.classList.add("tn-static-margin-bottom-8px-fdf33f23");let Ue=st.createEl("input",{type:"radio",value:"until"});Ue.name="end-type",Ue.checked=this.endType==="until",st.createSpan({text:" End on "});let Vt=st.createEl("input",{type:"date"});Vt.classList.add("tn-static-margin-left-4px-46cec891"),Vt.value=this.until?this.until.replace(/(\d{4})(\d{2})(\d{2})/,"$1-$2-$3"):"",Sc(Vt,{onCommit:ae=>{this.until=ae.replace(/-/g,""),Ue.checked=!0,this.endType="until"}}),Te.addEventListener("change",()=>{Te.checked&&(this.endType="never")}),X.addEventListener("change",()=>{X.checked&&(this.endType="count")}),Ue.addEventListener("change",()=>{Ue.checked&&(this.endType="until")}),ne.addEventListener("input",()=>{this.count=parseInt(ne.value)||void 0,ne.value&&(X.checked=!0,this.endType="count")}),Vt.addEventListener("input",()=>{this.until=Vt.value?Vt.value.replace(/-/g,""):"",Vt.value&&(Ue.checked=!0,this.endType="until")}),this.updateFrequencySpecificVisibility=()=>{let ae=this.recurrenceAnchor==="completion";o.settingEl.style.display=(this.frequency==="DAILY"||this.frequency==="WEEKLY")&&!ae?"flex":"none",d.settingEl.style.display=this.frequency==="MONTHLY"&&!ae?"flex":"none",x.settingEl.style.display=this.frequency==="YEARLY"&&!ae?"flex":"none"},this.updateFrequencySpecificVisibility();let ot=t.createDiv("button-container");ot.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),ot.classList.add("tn-static-display-flex-75816cae"),ot.classList.remove("tn-static-justify-content-center-03c4bb6f","tn-static-justify-content-space-between-a562f4fd"),ot.classList.add("tn-static-justify-content-flex-end-455f8cca"),ot.classList.remove("tn-static-display-flex-8bb39979","tn-static-gap-0-5rem-ce2fca4d","tn-static-gap-10px-f3d7ce77","tn-static-gap-12px-ed7b3d87","tn-static-gap-6px-f0abc1db"),ot.classList.add("tn-static-gap-8px-33fcd4c3"),ot.classList.remove("tn-static-font-size-12px-b0cc7e05","tn-static-margin-top-0-5rem-3dc98b5e","tn-static-margin-top-0-d462248a","tn-static-margin-top-12px-91e0f558","tn-static-margin-top-1rem-2239d6d5","tn-static-margin-top-20px-a26bda7d","tn-static-margin-top-30px-2fbbbcd4","tn-static-margin-top-4px-96ad6099","tn-static-margin-top-8px-8a77e5a3","tn-static-margin-top-8px-f4f01e68"),ot.classList.add("tn-static-margin-top-16px-1b0f4999"),ot.createEl("button",{text:"Cancel"}).addEventListener("click",()=>{this.close()}),ot.createEl("button",{text:"Save",cls:"mod-cta"}).addEventListener("click",()=>{let ae=m.checked?"bydate":"byday",xe=_.checked?"bydate":"byday";this.frequency==="MONTHLY"?ae==="bydate"?(this.byMonthDay=[parseInt(f.value)],this.byDay=[],this.bySetPos=void 0):(this.byMonthDay=[],this.byDay=[b.value],this.bySetPos=parseInt(v.value)):this.frequency==="YEARLY"&&(xe==="bydate"?(this.byMonth=[parseInt(O.value)],this.byMonthDay=[parseInt(N.value)],this.byDay=[],this.bySetPos=void 0):(this.byMonth=[parseInt(se.value)],this.byMonthDay=[],this.byDay=[Y.value],this.bySetPos=parseInt(H.value)));let gn=this.buildRRule(ae,xe);this.onSubmit(gn,this.recurrenceAnchor),this.close()})}updateFrequencySpecificVisibility(){}buildRRule(t,n){return Abe({frequency:this.frequency,interval:this.interval,dtstart:this.dtstart,dtstartTime:this.dtstartTime,recurrenceAnchor:this.recurrenceAnchor,byDay:this.byDay,byMonthDay:this.byMonthDay,byMonth:this.byMonth,bySetPos:this.bySetPos,endType:this.endType,count:this.count,until:this.until,monthlyType:t,yearlyType:n})}onClose(){let{contentEl:t}=this;t.empty()}}});var Nbe={};et(Nbe,{ReminderModal:()=>_l});var cn,_H,_l,sb=y(()=>{cn=require("obsidian");Ne();yx();G();_H=I({tag:"Modals/ReminderModal"}),_l=class extends cn.Modal{constructor(t,n,i,a){super(t);this.selectedType="relative";this.relativeAnchor="due";this.relativeOffset=15;this.relativeUnit="minutes";this.relativeDirection="before";this.absoluteDate="";this.absoluteTime="";this.description="";this.plugin=n,this.task=i,this.reminders=i.reminders?[...i.reminders]:[],this.originalReminders=i.reminders?[...i.reminders]:[],this.onSave=a}onOpen(){let{contentEl:t}=this;t.empty(),t.addClass("tasknotes-plugin"),t.addClass("tasknotes-reminder-modal"),t.createDiv({cls:"reminder-modal__loading"}).createEl("div",{text:"Loading reminders..."}),this.initializeWithFreshData().catch(i=>{_H.error("Failed to initialize reminder modal:",{category:"internal",operation:"initialize-reminder-modal",error:i}),t.empty(),t.addClass("tasknotes-plugin"),t.addClass("tasknotes-reminder-modal"),t.createDiv({cls:"reminder-modal__error",text:"Failed to load task data. Please try again."})})}async initializeWithFreshData(){let{contentEl:t}=this;if(this.task.path&&this.task.path.trim()!==""){let s=await this.plugin.cacheManager.getTaskInfo(this.task.path);s?(this.task=s,this.reminders=s.reminders?[...s.reminders]:[],this.originalReminders=s.reminders?[...s.reminders]:[]):(this.reminders=this.task.reminders?[...this.task.reminders]:[],this.originalReminders=this.task.reminders?[...this.task.reminders]:[])}else this.reminders=this.task.reminders?[...this.task.reminders]:[],this.originalReminders=this.task.reminders?[...this.task.reminders]:[];t.empty(),t.addClass("tasknotes-plugin"),t.addClass("tasknotes-reminder-modal");let n=t.createDiv({cls:"reminder-modal__header"});n.createEl("h2",{text:"Task reminders"}),n.createDiv({cls:"reminder-modal__task-title",text:this.task.title});let i=this.getTaskContextInfo();if(i){let s=n.createDiv({cls:"reminder-modal__task-dates"});s.textContent=i}let a=t.createDiv({cls:"reminder-modal__content"});this.renderExistingReminders(a),this.renderAddReminderForm(a),this.renderActionButtons(t),this.setupKeyboardHandlers(),this.updateSaveButtonState()}renderActionButtons(t){let n=t.createDiv({cls:"reminder-modal__actions"});this.saveBtn=n.createEl("button",{text:"Save changes",cls:"mod-cta reminder-modal__save-btn"}),this.saveBtn.disabled=!0,this.saveBtn.onclick=async()=>{await this.save()};let i=n.createEl("button",{text:"Cancel",cls:"reminder-modal__cancel-btn"});i.onclick=()=>{this.cancel()}}getTaskContextInfo(){let t=[];return this.task.due&&t.push(`Due: ${ru(this.task.due)}`),this.task.scheduled&&t.push(`Scheduled: ${ru(this.task.scheduled)}`),t.length>0?t.join(" \u2022 "):null}setupKeyboardHandlers(){let t=n=>{n.key==="Enter"&&(n.ctrlKey||n.metaKey)&&!this.saveBtn.disabled?(n.preventDefault(),this.save()):n.key==="Escape"&&(n.preventDefault(),this.cancel())};this.contentEl.addEventListener("keydown",t),this.onClose=()=>{this.contentEl.removeEventListener("keydown",t);let{contentEl:n}=this;n.empty()}}updateSaveButtonState(){if(!this.saveBtn)return;let t=this.remindersHaveChanged();this.saveBtn.disabled=!t,this.saveBtn.textContent=t?"Save Changes":"No Changes"}renderExistingReminders(t){let n=t.createDiv({cls:"reminder-modal__section"}),i=n.createDiv({cls:"reminder-modal__section-header"});if(i.createEl("h3",{text:"Current reminders"}),this.reminders.length>0&&i.createSpan({cls:"reminder-modal__reminder-count",text:`(${this.reminders.length})`}),this.reminders.length===0){let s=n.createDiv({cls:"reminder-modal__empty-state"});(0,cn.setIcon)(s.createDiv({cls:"reminder-modal__empty-icon"}),"bell-off"),s.createEl("div",{cls:"reminder-modal__empty-text",text:"No reminders set"});return}let a=n.createDiv({cls:"reminder-modal__reminder-list"});this.reminders.forEach((s,o)=>{let l=a.createDiv({cls:"reminder-modal__reminder-card"}),c=l.createDiv({cls:"reminder-modal__reminder-icon"}),d=s.type==="absolute"?"calendar-clock":"timer";(0,cn.setIcon)(c,d);let u=l.createDiv({cls:"reminder-modal__reminder-content"}),p=u.createDiv({cls:"reminder-modal__reminder-primary"});if(p.textContent=this.formatReminderDisplayText(s),s.description){let h=u.createDiv({cls:"reminder-modal__reminder-description"});h.textContent=`"${s.description}"`}let f=l.createDiv({cls:"reminder-modal__reminder-actions"}).createEl("button",{cls:"reminder-modal__action-btn reminder-modal__remove-btn"});(0,cn.setIcon)(f,"trash-2"),(0,cn.setTooltip)(f,"Delete this reminder"),f.onclick=async h=>{h.stopPropagation(),await this.removeReminder(o)}})}formatReminderDisplayText(t){if(t.type==="absolute"){if(t.absoluteTime)try{let n=new Date(t.absoluteTime);return`${n.toLocaleDateString()} at ${n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}catch(n){return`At ${t.absoluteTime}`}return"Absolute reminder"}else{let n=t.relatedTo==="due"?"due date":"scheduled date";return`${this.formatOffset(t.offset||"")} ${n}`}}renderQuickActions(t){if(!(this.task.due||this.task.scheduled))return;let a=t.createDiv({cls:"reminder-modal__quick-actions"}).createDiv({cls:"reminder-modal__quick-buttons"});[{label:"5m",fullLabel:"5 minutes before",offset:"-PT5M",icon:"clock"},{label:"15m",fullLabel:"15 minutes before",offset:"-PT15M",icon:"clock"},{label:"1h",fullLabel:"1 hour before",offset:"-PT1H",icon:"clock"},{label:"1d",fullLabel:"1 day before",offset:"-P1D",icon:"calendar"}].forEach(({label:o,fullLabel:l,offset:c,icon:d})=>{let u=this.task.due?"due":"scheduled",p=a.createEl("button",{cls:"reminder-modal__quick-btn"}),m=p.createSpan({cls:"reminder-modal__quick-btn-icon"});(0,cn.setIcon)(m,d),p.createSpan({cls:"reminder-modal__quick-btn-label",text:o}),(0,cn.setTooltip)(p,`Add reminder ${l} ${u} date`),p.onclick=async()=>{await this.addQuickReminder(u,c,l)}})}async addQuickReminder(t,n,i){let a={id:`rem_${Date.now()}`,type:"relative",relatedTo:t,offset:n,description:i};await this.addReminder(a),new cn.Notice(`Added reminder: ${i}`)}renderAddReminderForm(t){let n=t.createDiv({cls:"reminder-modal__section"});n.createDiv({cls:"reminder-modal__section-header"}).createEl("h3",{text:"Add new reminder"}),this.renderQuickActions(n);let a=n.createDiv({cls:"reminder-modal__form"}),s=a.createDiv({cls:"reminder-modal__type-selector"}),o=s.createEl("button",{cls:"reminder-modal__type-tab reminder-modal__type-tab--active",text:"Relative",attr:{"data-type":"relative"}}),l=s.createEl("button",{cls:"reminder-modal__type-tab",text:"Absolute",attr:{"data-type":"absolute"}});o.classList.toggle("reminder-modal__type-tab--active",this.selectedType==="relative"),l.classList.toggle("reminder-modal__type-tab--active",this.selectedType==="absolute");let c=f=>{this.selectedType=f,o.classList.toggle("reminder-modal__type-tab--active",f==="relative"),l.classList.toggle("reminder-modal__type-tab--active",f==="absolute"),this.updateFormVisibility(a,this.selectedType)};o.onclick=()=>c("relative"),l.onclick=()=>c("absolute");let d=a.createDiv({cls:"relative-fields"});new cn.Setting(d).setName("Time").addText(f=>{f.setPlaceholder("15").setValue(String(this.relativeOffset)).onChange(h=>{this.relativeOffset=parseInt(h)||0})}).addDropdown(f=>{f.addOption("minutes","Minutes").addOption("hours","Hours").addOption("days","Days").setValue(this.relativeUnit).onChange(h=>{this.relativeUnit=h})}),new cn.Setting(d).setName("Direction").addDropdown(f=>{f.addOption("before","Before").addOption("after","After").setValue(this.relativeDirection).onChange(h=>{this.relativeDirection=h})}),new cn.Setting(d).setName("Relative to").addDropdown(f=>{let h={};this.task.due&&(h.due=`Due date (${ru(this.task.due)})`),this.task.scheduled&&(h.scheduled=`Scheduled date (${ru(this.task.scheduled)})`),Object.keys(h).length===0?(h.none="No dates available",f.setDisabled(!0)):(Object.entries(h).forEach(([g,v])=>{f.addOption(g,v)}),f.setValue(this.relativeAnchor)),f.onChange(g=>{this.relativeAnchor=g})});let u=a.createDiv({cls:"absolute-fields"});new cn.Setting(u).setName("Date").addText(f=>{f.setPlaceholder("Yyyy-mm-dd").setValue(this.absoluteDate).onChange(h=>{this.absoluteDate=h}),f.inputEl.type="date",Sc(f.inputEl,{onCommit:h=>{this.absoluteDate=h}})}),new cn.Setting(u).setName("Time").addText(f=>{f.setPlaceholder("Hh:mm").setValue(this.absoluteTime).onChange(h=>{this.absoluteTime=h}),f.inputEl.type="time"}),new cn.Setting(a).setName("Description (optional)").addText(f=>{f.setPlaceholder("Custom reminder message").setValue(this.description).onChange(h=>{this.description=h})});let p=a.createEl("button",{cls:"reminder-add-btn"}),m=p.createSpan({cls:"reminder-add-btn-icon"});(0,cn.setIcon)(m,"plus"),p.createSpan({cls:"reminder-add-btn-text",text:"Add Reminder"}),p.onclick=async()=>{p.disabled=!0,p.classList.add("reminder-add-btn--loading");try{let f=this.createReminder(this.selectedType,this.relativeAnchor,this.relativeOffset,this.relativeUnit,this.relativeDirection,this.absoluteDate,this.absoluteTime,this.description);f&&(await this.addReminder(f),this.selectedType==="relative"?(this.relativeOffset=15,this.relativeUnit="minutes",this.description=""):(this.absoluteDate="",this.absoluteTime="",this.description=""),this.resetFormInputs(a))}catch(f){_H.error("Error adding reminder:",{category:"internal",operation:"adding-reminder",error:f}),new cn.Notice("Failed to add reminder. Please check your inputs.")}finally{p.disabled=!1,p.classList.remove("reminder-add-btn--loading")}},this.updateFormVisibility(a,this.selectedType)}updateFormVisibility(t,n){let i=t.querySelector(".relative-fields"),a=t.querySelector(".absolute-fields");n==="relative"?(i.classList.remove("tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),i.classList.add("tn-static-display-block-2a1b75c9"),a.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"),a.classList.add("tn-static-display-none-6b99de8b")):(i.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"),i.classList.add("tn-static-display-none-6b99de8b"),a.classList.remove("tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),a.classList.add("tn-static-display-block-2a1b75c9"))}createReminder(t,n,i,a,s,o,l,c){let d=`rem_${Date.now()}`;if(t==="relative"){if(!(n==="due"?this.task.due:this.task.scheduled))return new cn.Notice(`Cannot create reminder: Task has no ${n} date`),null;let p="PT";return a==="days"?p=`P${i}D`:a==="hours"?p=`PT${i}H`:p=`PT${i}M`,s==="before"&&(p="-"+p),{id:d,type:"relative",relatedTo:n,offset:p,description:c||void 0}}else{if(!o||!l)return new cn.Notice("Please specify both date and time for absolute reminder"),null;let u=`${o}T${l}:00`;return{id:d,type:"absolute",absoluteTime:u,description:c||void 0}}}formatReminderTiming(t){if(t.type==="absolute")return"Absolute reminder";{let n=t.relatedTo==="due"?"due date":"scheduled date";return`${this.formatOffset(t.offset||"")} ${n}`}}formatReminderDetails(t){if(t.type==="absolute")return`At ${ru(t.absoluteTime||"")}`;{let n=t.relatedTo==="due"?this.task.due:this.task.scheduled;return n?`When ${t.relatedTo} date is ${ru(n)}`:`Relative to ${t.relatedTo} date (not set)`}}formatReminderDescription(t){if(t.description)return t.description;if(t.type==="absolute")return`At ${ru(t.absoluteTime||"")}`;{let n=t.relatedTo==="due"?"due date":"scheduled date";return`${this.formatOffset(t.offset||"")} ${n}`}}formatOffset(t){let n=t.startsWith("-"),a=(n?t.substring(1):t).match(/P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?)?/);if(!a)return t;let[,s,o,l]=a,c=[];if(s&&c.push(`${s} day${s!=="1"?"s":""}`),o&&c.push(`${o} hour${o!=="1"?"s":""}`),l&&c.push(`${l} minute${l!=="1"?"s":""}`),c.length===0)return"At time of";let d=c.join(" ");return n?`${d} before`:`${d} after`}async addReminder(t){this.reminders.push(t),this.refreshRemindersListOnly(),this.task.path&&this.plugin.emitter.trigger("reminder-preview-changed",{taskPath:this.task.path,currentReminders:[...this.reminders],action:"added",reminder:t})}async removeReminder(t){let n=this.reminders[t];this.reminders.splice(t,1),this.refreshRemindersListOnly(),this.task.path&&n&&this.plugin.emitter.trigger("reminder-preview-changed",{taskPath:this.task.path,currentReminders:[...this.reminders],action:"removed",reminder:n})}async refresh(){await this.initializeWithFreshData()}refreshRemindersListOnly(){let t=this.contentEl.querySelector(".reminder-modal__content");if(t){let n=t.querySelector(".reminder-modal__section");n&&n.remove();let i=activeDocument.createElement("div");this.renderExistingReminders(i);let a=i.firstChild;a&&t.insertBefore(a,t.firstChild)}this.updateSaveButtonState()}resetFormInputs(t){let n=t.querySelector('input[placeholder="15"]');n&&(n.value=String(this.relativeOffset));let i=t.querySelector('input[placeholder="Custom reminder message"]');i&&(i.value=this.description);let a=t.querySelector('input[type="date"]');a&&(a.value=this.absoluteDate);let s=t.querySelector('input[type="time"]');s&&(s.value=this.absoluteTime);let o=t.querySelector('.setting-item:has(input[placeholder="15"]) select');o&&(o.value=this.relativeUnit);let l=t.querySelector(".setting-item:nth-child(2) select");l&&(l.value=this.relativeDirection);let c=t.querySelector(".setting-item:nth-child(3) select");c&&(c.value=this.relativeAnchor)}async save(){var t;this.saveBtn.disabled=!0,this.saveBtn.textContent="Saving...";try{this.task.path&&this.task.path.trim()!==""&&((t=this.plugin.notificationService)==null||t.clearProcessedRemindersForTask(this.task.path));let n=this.remindersHaveChanged();this.onSave(this.reminders),n&&this.task.path&&this.plugin.emitter.trigger("reminder-changed",{taskPath:this.task.path,oldReminders:this.originalReminders,newReminders:[...this.reminders]}),this.close()}catch(n){_H.error("Failed to save reminders:",{category:"persistence",operation:"save-reminders",error:n}),new cn.Notice("Failed to save reminders. Please try again."),this.saveBtn.disabled=!1,this.saveBtn.textContent="Save changes"}}cancel(){this.remindersHaveChanged()&&this.task.path&&this.plugin.emitter.trigger("reminder-preview-changed",{taskPath:this.task.path,currentReminders:[...this.originalReminders],action:"cancelled"}),this.close()}remindersHaveChanged(){return this.reminders.length!==this.originalReminders.length?!0:!this.reminders.every((t,n)=>{let i=this.originalReminders[n];return i?t.id===i.id&&t.type===i.type&&t.relatedTo===i.relatedTo&&t.offset===i.offset&&t.absoluteTime===i.absoluteTime&&t.description===i.description:!1})}onClose(){let{contentEl:t}=this;t.empty()}}});function Ix(r){return I({tag:"TaskCard/Actions",isDebugEnabled:()=>r.settings.enableDebugLogging})}function AH(r){let{task:e,plugin:t,targetDate:n,updateStatusVisuals:i}=r;return a=>{a.stopPropagation(),(async()=>{let s=Ix(t);try{if(e.recurrence){let p=await t.toggleRecurringTaskComplete(e,n),m=bv(p,n,t.statusManager.getCompletedStatuses()[0]),f=t.statusManager.isCompletedStatus(m);i(p,m,f);return}let o=await t.cacheManager.getTaskInfo(e.path);if(!o){new Fh.Notice("Task not found");return}let l=o.status||t.settings.defaultTaskStatus,c=a.shiftKey?t.statusManager.getPreviousStatus(l):t.statusManager.getNextStatus(l),d=await t.updateTaskProperty(o,"status",c),u=t.statusManager.isCompletedStatus(c);i(d,c,u)}catch(o){let l=o instanceof Error?o.message:String(o);s.error("Error cycling task status",{category:"persistence",operation:"cycle-status",details:{taskPath:e.path,errorMessage:l},error:o}),new Fh.Notice(`Failed to update task status: ${l}`)}})()}}function IH(r,e){return t=>{t.stopPropagation(),new ku({currentValue:r.priority,onSelect:i=>{(async()=>{let a=Ix(e);try{await e.updateTaskProperty(r,"priority",i)}catch(s){a.error("Error updating priority",{category:"persistence",operation:"update-priority",details:{taskPath:r.path,newPriority:i},error:s}),new Fh.Notice("Failed to update priority")}})()},plugin:e}).show(t)}}function NH(r,e){return t=>{t.stopPropagation(),new Ml({currentValue:typeof r.recurrence=="string"?r.recurrence:void 0,currentAnchor:r.recurrence_anchor||"scheduled",scheduledDate:r.scheduled,onSelect:(i,a)=>{(async()=>{let s=Ix(e);try{await e.updateTaskProperty(r,"recurrence",i||void 0),a!==void 0&&await e.updateTaskProperty(r,"recurrence_anchor",a)}catch(o){s.error("Error updating recurrence",{category:"persistence",operation:"update-recurrence",details:{taskPath:r.path,newRecurrence:i,anchor:a},error:o}),new Fh.Notice("Failed to update recurrence")}})()},app:e.app,plugin:e}).show(t)}}function RH(r,e){return()=>{new _l(e.app,e,r,n=>{(async()=>{let i=Ix(e);try{await e.updateTaskProperty(r,"reminders",n.length>0?n:void 0)}catch(a){i.error("Error updating reminders",{category:"persistence",operation:"update-reminders",details:{taskPath:r.path,reminderCount:n.length},error:a}),new Fh.Notice("Failed to update reminders")}})()}).open()}}function OH(r,e){return()=>{(async()=>{let t=Ix(e);try{await e.applyProjectSubtaskFilter(r)}catch(n){t.error("Error filtering project subtasks",{category:"internal",operation:"filter-project-subtasks",details:{taskPath:r.path},error:n}),new Fh.Notice("Failed to filter project subtasks")}})()}}var Fh,LH=y(()=>{Fh=require("obsidian");Mx();ab();sb();Ct();G()});function lI(r){return I({tag:"TaskCard/Relationships",isDebugEnabled:()=>{var e;return((e=r.settings)==null?void 0:e.enableDebugLogging)===!0}})}function FH(r,e){var t,n;return(n=(t=r.getRelationshipOptions)==null?void 0:t.call(r,e))!=null?n:{}}function ltt(r,e){let t=()=>e.classList.add("task-card--nested-interactive-hover"),n=()=>e.classList.remove("task-card--nested-interactive-hover");r.addEventListener("mouseenter",t),r.addEventListener("mouseleave",n)}function ctt(r){let e=r,t=e._clickHandler;t&&(r.removeEventListener("click",t),delete e._clickHandler)}function os(r,e){let t=r.querySelector(e);t&&(r.classList.remove("task-card--nested-interactive-hover"),ctt(t),t.remove())}function Rbe(r){os(r,".task-card__subtasks"),os(r,".task-card__blocking"),os(r,".task-card__blocked-by")}function $H(r,e,t,n={}){let i=r.querySelector(e);if(i)return i;let a=r.ownerDocument.createElement("div");a.className=t;let s=o=>{o.stopPropagation()};return a.addEventListener("click",s),a._clickHandler=s,n.stopExtraPointerEvents&&(a.addEventListener("dblclick",o=>o.stopPropagation()),a.addEventListener("contextmenu",o=>o.stopPropagation())),ltt(a,r),r.appendChild(a),a}function dtt(r){var n;let e=[],t=r.closest(".task-card");for(;t;){let i=t._taskPath;typeof i=="string"&&e.unshift(i),t=(n=t.parentElement)==null?void 0:n.closest(".task-card")}return e}function zH(r){for(;r.firstChild;)r.removeChild(r.firstChild)}function Obe(r,e,t,n,i){for(let a of e){let s=t.renderTaskCard(a,n);s.classList.add(i),r.appendChild(s)}}async function jH(r,e,t,n){let{plugin:i}=r,a=lI(i);try{if(!n){os(e,".task-card__subtasks");return}let s=$H(e,".task-card__subtasks","task-card__subtasks");zH(s);let o=s.createEl("div",{cls:"task-card__subtasks-loading",text:i.i18n.translate("contextMenus.task.subtasks.loading")});try{let l=i.app.vault.getAbstractFileByPath(t.path);if(!(l instanceof Nx.TFile))throw new Error("Task file not found");if(!i.projectSubtasksService)throw new Error("projectSubtasksService not initialized");let c=FH(r,e),d=iI(await i.projectSubtasksService.getTasksLinkedToProject(l),c);if(o.remove(),d.length===0){s.createEl("div",{cls:"task-card__subtasks-loading",text:i.i18n.translate("contextMenus.task.subtasks.noSubtasks")});return}let u=Ebe(d,c,m=>i.projectSubtasksService.sortTasks(m)),p=dtt(e);for(let m of u){if(p.includes(m.path)){a.warn("Skipped circular task relationship",{category:"validation",operation:"render-subtasks",details:{taskPath:t.path,subtaskPath:m.path,parentChain:p}});continue}let f=r.renderTaskCard(m,c);f.classList.add("task-card--subtask"),s.appendChild(f)}}catch(l){a.error("Error loading subtasks",{category:"provider",operation:"load-subtasks",details:{taskPath:t.path},error:l}),o.textContent=i.i18n.translate("contextMenus.task.subtasks.loadFailed")}}catch(s){throw a.error("Error toggling subtasks",{category:"internal",operation:"toggle-subtasks",details:{taskPath:t.path,expanded:n},error:s}),s}}async function Lbe(r,e,t,n){let{plugin:i}=r,a=lI(i);if(!n){os(e,".task-card__blocking");return}let s=$H(e,".task-card__blocking","task-card__blocking",{stopExtraPointerEvents:!0});zH(s);let o=s.createDiv({cls:"task-card__blocking-loading",text:i.i18n.translate("ui.taskCard.loadingDependencies")});try{let l=t.blocking?await Promise.all(t.blocking.map(u=>i.cacheManager.getTaskInfo(u))):[],c=FH(r,e),d=iI(l.filter(u=>!!u),c);if(o.remove(),d.length===0){s.createDiv({cls:"task-card__blocking-empty",text:i.i18n.translate("ui.taskCard.blockingEmpty")});return}Obe(s,d,r,c,"task-card--dependency")}catch(l){a.error("Error loading blocking tasks",{category:"provider",operation:"load-blocking-tasks",details:{taskPath:t.path},error:l}),o.textContent=i.i18n.translate("ui.taskCard.blockingLoadError")}}async function Fbe(r,e,t,n){let{plugin:i}=r,a=lI(i);if(!n){os(e,".task-card__blocked-by");return}let s=$H(e,".task-card__blocked-by","task-card__blocked-by",{stopExtraPointerEvents:!0});zH(s);let o=s.createDiv({cls:"task-card__blocked-by-loading",text:i.i18n.translate("ui.taskCard.loadingDependencies")});try{let l=Oh(t,i.app),c=await Promise.all(l.map(p=>i.cacheManager.getTaskInfo(p))),d=FH(r,e),u=iI(c.filter(p=>!!p),d);if(o.remove(),u.length===0){s.createDiv({cls:"task-card__blocked-by-empty",text:i.i18n.translate("ui.taskCard.blockedBadge")});return}Obe(s,u,r,d,"task-card--dependency")}catch(l){a.error("Error loading blocked-by tasks",{category:"provider",operation:"load-blocked-by-tasks",details:{taskPath:t.path},error:l}),o.textContent=i.i18n.translate("ui.taskCard.blockingLoadError")}}async function $be(r,e,t){let{plugin:n}=r,i=lI(n);if(!e.projects||e.projects.length===0)return;let a=0,s=10;for(;awindow.setTimeout(l,10)),a++}let o=t.querySelectorAll(".task-card__chevron--expanded");for(let l of o){let c=l.closest(".task-card");if(!c)continue;let d=c.dataset.taskPath;if(!d)continue;let u=n.app.vault.getAbstractFileByPath(d);if(!(u instanceof Nx.TFile))continue;let p=u.basename;if(!(!e.projects.flat(2).some(h=>{if(h&&typeof h=="string"&&h.startsWith("[[")&&h.endsWith("]]")){let g=h.slice(2,-2).trim(),v=(0,Nx.parseLinktext)(g).path,k=n.app.metadataCache.getFirstLinkpathDest(v,"");return v===p||k&&k.path===d}return h===p||h===d})||!c.querySelector(".task-card__subtasks")))try{let h=await n.cacheManager.getTaskInfo(d);h&&await jH(r,c,h,!0)}catch(h){i.error("Error refreshing parent task subtasks",{category:"provider",operation:"refresh-parent-subtasks",details:{taskPath:e.path,projectTaskPath:d},error:h})}}}var Nx,BH=y(()=>{Nx=require("obsidian");G();aI()});function Ox(r){return I({tag:"TaskCard/Badges",isDebugEnabled:()=>r.settings.enableDebugLogging})}function ob(r,e,t){return r.i18n.translate(`ui.taskCard.${e}`,t)}function zbe(r){var e;return((e=r.settings)==null?void 0:e.expandSubtasksByDefault)===!0}function UH(r,e){var t;return((t=e.expandedProjectsService)==null?void 0:t.isExpanded(r.path,zbe(e)))||!1}function ptt(r){for(let e of utt)for(let t of r.querySelectorAll(e))t.remove();os(r,".task-card__subtasks"),os(r,".task-card__blocking"),os(r,".task-card__blocked-by")}function jbe(r,e,t){r.classList.toggle("task-card__chevron--expanded",t);let n=tI(e,t);r.setAttribute("aria-label",n),(0,Rx.setTooltip)(r,n,{placement:"top"})}function Bbe(r,e,t,n){return()=>{(async()=>{let i=Ox(e);try{if(!e.expandedProjectsService){new Rx.Notice("Service not available. Please try reloading the plugin.");return}let a=t.querySelector(".task-card__chevron");if(!a)return;let s=e.expandedProjectsService.toggle(r.path,zbe(e));jbe(a,e,s),await n.toggleSubtasks(t,r,s)}catch(a){i.error("Error toggling subtasks",{category:"internal",operation:"toggle-subtasks",details:{taskPath:r.path},error:a}),new Rx.Notice("Failed to toggle subtasks")}})()}}function Ube(r,e,t){return()=>{(async()=>{let n=e.querySelector(".task-card__blocking-toggle");if(!n)return;let i=n.classList.toggle("task-card__blocking-toggle--expanded");await t.toggleBlockingTasks(e,r,i)})()}}function Hbe(r,e,t,n){return()=>{HH({card:t,task:r,plugin:e,handlers:n})}}function mtt(r,e){let t=r.querySelector(".task-card__blocked-toggle");t&&(t.classList.toggle("task-card__blocked-toggle--expanded",e),t.setAttribute("aria-expanded",String(e)));for(let n of r.querySelectorAll(".task-card__metadata-pill--blocked"))n.getAttribute("role")==="button"&&n.setAttribute("aria-expanded",String(e))}async function HH(r){let{card:e,task:t,handlers:n}=r,i=!e.querySelector(".task-card__blocked-by");mtt(e,i),await n.toggleBlockedByTasks(e,t,i)}function ftt(r,e){var l;let{card:t,task:n,plugin:i,handlers:a}=r;if(!i.projectSubtasksService.isTaskUsedAsProjectSync(n.path)||(Pc({container:e,className:"task-card__project-indicator",icon:"folder",tooltip:ob(i,"projectTooltip"),onClick:OH(n,i)}),!((l=i.settings)!=null&&l.showExpandableSubtasks)))return;let o=UH(n,i);Pc({container:e,className:`task-card__chevron${o?" task-card__chevron--expanded":""}`,icon:"chevron-right",tooltip:tI(i,o),onClick:Bbe(n,i,t,a)}),o&&a.toggleSubtasks(t,n,!0).catch(c=>{Ox(i).error("Error showing initial subtasks",{category:"internal",operation:"show-initial-subtasks",details:{taskPath:n.path},error:c})})}function htt(r,e){let{card:t,task:n,plugin:i,handlers:a}=r;if(n.blocking&&n.blocking.length>0){let o=n.blocking.length,l=i.i18n.translate("ui.taskCard.blockingToggle",{count:o}),c=Pc({container:e,className:"task-card__blocking-toggle is-visible",icon:"git-branch",tooltip:l,onClick:Ube(n,t,a)});c&&(c.dataset.count=String(o))}let s=Oh(n,i.app);if(s.length>0){let o=`${ob(i,"blockedBadge")} (${s.length})`,l=Pc({container:e,className:"task-card__blocked-toggle is-visible",icon:"git-merge",tooltip:o,onClick:Hbe(n,i,t,a)});l&&(l.dataset.count=String(s.length))}}function Vbe(r){let{badgesContainer:e,task:t,plugin:n,hasDetails:i,propertyOptions:a}=r;if(!(!e||a.showSecondaryBadges===!1)){if(t.recurrence&&Pc({container:e,className:"task-card__recurring-indicator",icon:"rotate-ccw",tooltip:Cx(n,t.recurrence,a.propertyLabels),onClick:NH(t,n)}),t.reminders&&t.reminders.length>0){let s=t.reminders.length;Pc({container:e,className:"task-card__reminder-indicator",icon:"bell",tooltip:wH(n,s),onClick:RH(t,n)})}i&&Pc({container:e,className:"task-card__details-indicator",icon:"file-text",tooltip:ob(n,"detailsTooltip")}),ftt(r,e),htt(r,e)}}function gtt(r){let{card:e,mainRow:t,task:n,plugin:i,handlers:a}=r,s=Ox(i);i.projectSubtasksService.isTaskUsedAsProject(n.path).then(o=>{var d,u,p,m,f;(d=e.querySelector(".task-card__project-indicator-placeholder"))==null||d.remove(),(u=e.querySelector(".task-card__chevron-placeholder"))==null||u.remove(),Lh(e,".task-card__project-indicator",{shouldExist:o,className:"task-card__project-indicator",icon:"folder",tooltip:ob(i,"projectTooltip"),onClick:OH(n,i)});let l=o&&((p=i.settings)==null?void 0:p.showExpandableSubtasks),c=e.querySelector(".task-card__chevron");if(l&&!c){let h=UH(n,i);Pc({container:(f=(m=e.querySelector(".task-card__badges"))!=null?m:t)!=null?f:e,className:`task-card__chevron${h?" task-card__chevron--expanded":""}`,icon:"chevron-right",tooltip:tI(i,h),onClick:Bbe(n,i,e,a)}),h&&a.toggleSubtasks(e,n,!0).catch(g=>{s.error("Error showing initial subtasks in update",{category:"internal",operation:"show-initial-subtasks-update",details:{taskPath:n.path},error:g})})}else if(l&&c){let h=UH(n,i);jbe(c,i,h),h?a.toggleSubtasks(e,n,!0).catch(g=>{s.error("Error refreshing default-expanded subtasks",{category:"internal",operation:"refresh-default-expanded-subtasks",details:{taskPath:n.path},error:g})}):os(e,".task-card__subtasks")}else!l&&c&&(c.remove(),os(e,".task-card__subtasks"))}).catch(o=>{s.error("Error checking if task is used as project in update",{category:"internal",operation:"check-project-task",details:{taskPath:n.path},error:o})})}function ytt(r){var c,d;let{card:e,task:t,plugin:n,handlers:i}=r,a=(d=(c=t.blocking)==null?void 0:c.length)!=null?d:0,s=a>0,o=n.i18n.translate("ui.taskCard.blockingToggle",{count:a}),l=Lh(e,".task-card__blocking-toggle",{shouldExist:s,className:"task-card__blocking-toggle is-visible",icon:"git-branch",tooltip:o,onClick:Ube(t,e,i)});if(!s){os(e,".task-card__blocking");return}l&&(l.classList.add("is-visible"),l.classList.remove("is-hidden"),l.dataset.count=String(a),l.classList.contains("task-card__blocking-toggle--expanded")&&i.toggleBlockingTasks(e,t,!0).catch(u=>{Ox(n).error("Error refreshing blocking tasks",{category:"internal",operation:"refresh-blocking-tasks",details:{taskPath:t.path,blockingCount:a},error:u})}))}function vtt(r){let{card:e,task:t,plugin:n,handlers:i}=r,a=Oh(t,n.app),s=a.length>0,o=`${ob(n,"blockedBadge")} (${a.length})`,l=Lh(e,".task-card__blocked-toggle",{shouldExist:s,className:"task-card__blocked-toggle is-visible",icon:"git-merge",tooltip:o,onClick:Hbe(t,n,e,i)});if(!s){os(e,".task-card__blocked-by");return}l&&(l.classList.add("is-visible"),l.classList.remove("is-hidden"),l.dataset.count=String(a.length),l.classList.contains("task-card__blocked-toggle--expanded")&&i.toggleBlockedByTasks(e,t,!0).catch(c=>{Ox(n).error("Error refreshing blocked-by tasks",{category:"internal",operation:"refresh-blocked-by-tasks",details:{taskPath:t.path,blockedByCount:a.length},error:c})}))}function qbe(r){var c,d;let{card:e,mainRow:t,task:n,plugin:i,hasDetails:a,propertyOptions:s}=r,o=e.querySelector(".task-card__badges");if(!o||s.showSecondaryBadges===!1){ptt(e);return}Lh(e,".task-card__recurring-indicator",{shouldExist:!!n.recurrence,className:"task-card__recurring-indicator",icon:"rotate-ccw",tooltip:n.recurrence?Cx(i,n.recurrence,s.propertyLabels):"",onClick:NH(n,i)});let l=(d=(c=n.reminders)==null?void 0:c.length)!=null?d:0;Lh(e,".task-card__reminder-indicator",{shouldExist:l>0,className:"task-card__reminder-indicator",icon:"bell",tooltip:wH(i,l),onClick:RH(n,i)}),Lh(e,".task-card__details-indicator",{shouldExist:a,className:"task-card__details-indicator",icon:"file-text",tooltip:ob(i,"detailsTooltip")}),gtt({...r,mainRow:t!=null?t:o}),ytt(r),vtt(r)}var Rx,utt,VH=y(()=>{Rx=require("obsidian");G();LH();SH();Px();BH();aI();utt=[".task-card__recurring-indicator",".task-card__reminder-indicator",".task-card__details-indicator",".task-card__project-indicator",".task-card__chevron",".task-card__blocking-toggle",".task-card__blocked-toggle"]});function btt(r,e){return r||(e.settings.defaultVisibleProperties?Ra(e.settings.defaultVisibleProperties,e):Tbe(e))}function Ttt(r){var u,p;let{metadataLine:e,card:t,task:n,plugin:i,onBlockedByToggle:a}=r;if(!n.isBlocked)return null;let s=i.i18n.translate("ui.taskCard.blockedBadge"),o=Oh(n,i.app),l=(p=(u=n.blockedBy)==null?void 0:u.length)!=null?p:0,c=l>0?`${s} (${l})`:s,d=e.createSpan({cls:"task-card__metadata-pill task-card__metadata-pill--blocked",text:c});if(o.length>0){let m=`${s} (${o.length})`;Pl(d),d.setAttribute("aria-label",m),d.setAttribute("aria-expanded",String(!!t.querySelector(".task-card__blocked-by"))),(0,wu.setTooltip)(d,m,{placement:"top"}),d.addEventListener("click",f=>{f.stopPropagation(),a()})}else(0,wu.setTooltip)(d,i.i18n.translate("ui.taskCard.blockedBadgeTooltip"),{placement:"top"});return d}function ktt(r){var l,c;let{metadataLine:e,task:t,plugin:n}=r;if(!t.isBlocking)return null;let i=n.i18n.translate("ui.taskCard.blockingBadge"),a=(c=(l=t.blocking)==null?void 0:l.length)!=null?c:0,s=a>0?`${i} (${a})`:i,o=e.createSpan({cls:"task-card__metadata-pill task-card__metadata-pill--blocking",text:s});return(0,wu.setTooltip)(o,n.i18n.translate("ui.taskCard.blockingBadgeTooltip"),{placement:"top"}),o}function wtt(r){let{metadataLine:e,task:t,plugin:n}=r;if(!t.googleCalendarEventId)return null;let i=e.createSpan({cls:"task-card__metadata-pill task-card__metadata-pill--google-calendar"});return(0,wu.setIcon)(i,"calendar"),(0,wu.setTooltip)(i,n.i18n.translate("ui.taskCard.googleCalendarSyncTooltip"),{placement:"top"}),i}function Stt(r){var s;let{metadataLine:e,task:t,plugin:n}=r;if(!t.recurrence_parent||!t.occurrence_date)return null;let i=Ti(t.occurrence_date,{dateFormat:"MMM d",showTime:!1,userTimeFormat:(s=n.settings.calendarViewSettings)==null?void 0:s.timeFormat}),a=e.createSpan({cls:"task-card__metadata-pill task-card__metadata-pill--occurrence"});return(0,wu.setIcon)(a,"refresh-ccw"),a.createSpan({text:`Occurrence: ${i}`}),Pl(a),a.setAttribute("aria-label",`Open recurring parent for occurrence on ${t.occurrence_date}`),(0,wu.setTooltip)(a,`Occurrence of ${t.recurrence_parent} on ${t.occurrence_date}`,{placement:"top"}),a.addEventListener("click",o=>{o.stopPropagation();let l=jt(t.recurrence_parent||"");n.app.workspace.openLinkText(l,t.path,!1)}),a}function Ett(r){let{metadataLine:e,task:t,plugin:n,visibleProperties:i,propertyOptions:a={}}=r;e.empty();let s=[],o=btt(i,n),l=Stt(r);l&&s.push(l);for(let c of o){if(rb(c,"status",n)||rb(c,"priority",n))continue;if(c==="blocked"){let u=Ttt(r);u&&s.push(u);continue}if(c==="blocking"){let u=ktt(r);u&&s.push(u);continue}if(c==="googleCalendarSync"){let u=wtt(r);u&&s.push(u);continue}let d=kbe(e,c,t,n,a);d&&s.push(d)}return wbe(e,s),s}function qH(r){let{metadataLine:e,card:t,task:n,plugin:i,visibleProperties:a,propertyOptions:s,handlers:o}=r;return Ett({metadataLine:e,card:t,task:n,plugin:i,visibleProperties:a,propertyOptions:s,onBlockedByToggle:()=>void HH({card:t,task:n,plugin:i,handlers:o})})}var wu,Wbe=y(()=>{wu=require("obsidian");Ne();jn();xc();Sbe();aI();Px();VH()});function Ybe(r,e,t=!1){return!t&&(!r||r.some(n=>rb(n,"status",e)))}function Gbe(r,e){return!r||r.some(t=>rb(t,"priority",e))}function cI(r,e,t){let n=t.statusManager.getStatusConfig(e);n!=null&&n.color?r.style.setProperty("--current-status-color",n.color):r.style.removeProperty("--current-status-color");let i=t.statusManager.getNextStatus(e),a=t.statusManager.getStatusConfig(i);a!=null&&a.color?r.style.setProperty("--next-status-color",a.color):r.style.removeProperty("--next-status-color")}function YH(r,e,t){let n=t.priorityManager.getPriorityConfig(e.priority);return n!=null&&n.color?(r.style.setProperty("--priority-color",n.color),r.style.setProperty("--current-priority-color",n.color)):(r.style.removeProperty("--priority-color"),r.style.removeProperty("--current-priority-color")),n}function dI(r,e){e!=null&&e.color?r.style.borderColor=e.color:r.style.removeProperty("border-color"),e!=null&&e.icon?(r.addClass("task-card__status-dot--icon"),r.empty(),(0,WH.setIcon)(r,e.icon)):(r.removeClass("task-card__status-dot--icon"),r.empty(),r.removeAttribute("data-icon"),r.classList.remove("has-icon"))}function GH(r){let{mainRow:e,card:t,task:n,plugin:i,effectiveStatus:a,visibleProperties:s,hideStatusIndicator:o,onClick:l}=r;if(!Ybe(s,i,o)||!e)return null;let c=e.createEl("span",{cls:"task-card__status-dot"});return dI(c,i.statusManager.getStatusConfig(a)),Pl(c),c.addEventListener("click",l),c.dataset.taskPath=n.path,cI(t,a,i),c}function Kbe(r,e,t){let n=r.querySelector(t);if(n){n.insertAdjacentElement("afterend",e);return}let i=r.querySelector(".task-card__checkbox");if(i){i.insertAdjacentElement("afterend",e);return}r.insertBefore(e,r.firstChild)}function Zbe(r){let{mainRow:e,card:t,plugin:n,effectiveStatus:i,visibleProperties:a,hideStatusIndicator:s}=r,o=t.querySelector(".task-card__status-dot");if(cI(t,i,n),!Ybe(a,n,s))return o==null||o.remove(),null;if(o)return dI(o,n.statusManager.getStatusConfig(i)),o;if(!e)return null;let l=GH(r);return l&&Kbe(e,l,".task-card__checkbox"),l}function Qbe(r,e,t){r.style.borderColor=e.color,r.setAttribute("aria-label",t.i18n.translate("ui.taskCard.priorityAriaLabel",{label:e.label})),r.replaceChildren(),r.classList.toggle("task-card__priority-dot--icon",!!e.icon),e.icon?(0,WH.setIcon)(r,e.icon):(r.removeAttribute("data-icon"),r.classList.remove("has-icon"))}function KH(r){let{mainRow:e,task:t,plugin:n,visibleProperties:i,onClick:a}=r,s=n.priorityManager.getPriorityConfig(t.priority);if(!t.priority||!s||!Gbe(i,n)||!e)return null;let o=e.createEl("span",{cls:"task-card__priority-dot"});return Qbe(o,s,n),Pl(o),o.addEventListener("click",a),o}function Jbe(r){var c,d;let{mainRow:e,card:t,task:n,plugin:i,visibleProperties:a}={...r,card:(d=(c=r.mainRow)==null?void 0:c.closest(".task-card"))!=null?d:r.mainRow};if(!t)return null;let s=t.querySelector(".task-card__priority-dot"),o=i.priorityManager.getPriorityConfig(n.priority);if(!n.priority||!o||!Gbe(a,i))return s==null||s.remove(),null;if(!s){if(!e)return null;let u=KH(r);return u&&Kbe(e,u,".task-card__status-dot"),u}Qbe(s,o,i);let l=s.cloneNode(!0);return Pl(l),l.addEventListener("click",r.onClick),s.replaceWith(l),l}var WH,ZH=y(()=>{WH=require("obsidian");xc();Px()});function xtt(r){let e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(r);if(!e)return null;let[,t,n,i]=e;return new Date(Date.UTC(Number(t),Number(n)-1,Number(i)))}function Ctt(){let r=new Date;return new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()))}function Dtt(r){if(r.recurrence&&r.recurrence_anchor!=="completion"&&r.scheduled){let e=xtt(ke(r.scheduled));if(e)return e}return Ctt()}function QH(r,e){var n,i,a;if(typeof r.details=="string")return r.details.trim().length>0;if(!e||!r.path)return!1;let t=(a=(i=(n=e.app.metadataCache).getCache)==null?void 0:i.call(n,r.path))==null?void 0:a.sections;return t?t.some(s=>s.type!=="yaml"):!1}function JH(r){var e;return((e=r.settings)==null?void 0:e.showCompletedTaskStrikethrough)!==!1}function XH(r){let e=new Set;for(let t of Tl(r.projects||[])){let n=ou(t);n&&e.add(`task-card--project-${n}`)}return Array.from(e)}function Ptt(r,e,t){var a;let n=["task-card"];t.layout!=="default"&&n.push(`task-card--layout-${t.layout}`),t.isCompleted&&n.push("task-card--completed"),t.isCompleted&&JH(e)&&n.push("task-card--completed-strikethrough"),t.isSkipped&&n.push("task-card--skipped"),r.archived&&n.push("task-card--archived"),t.isActivelyTracked&&n.push("task-card--actively-tracked"),t.isRecurring&&n.push("task-card--recurring"),t.isMaterializedOccurrence&&n.push("task-card--materialized-occurrence"),t.hasDetails&&n.push("task-card--has-details"),r.priority&&n.push(`task-card--priority-${ou(r.priority)}`),t.effectiveStatus&&n.push(`task-card--status-${ou(t.effectiveStatus)}`),((a=e.settings)==null?void 0:a.subtaskChevronPosition)==="left"&&n.push("task-card--chevron-left");let i=XH(r);return i.length>0&&n.push("task-card--has-projects",...i),n}function eV(r,e,t={}){var c,d;let n=t.targetDate||Dtt(r),i=r.recurrence?bv(r,n,e.statusManager.getCompletedStatuses()[0]):r.status,a=t.layout||"default",s=r.recurrence?((c=r.complete_instances)==null?void 0:c.includes(ce(n)))||!1:e.statusManager.isCompletedStatus(i),o=r.recurrence&&((d=r.skipped_instances)==null?void 0:d.includes(ce(n)))||!1,l={targetDate:n,effectiveStatus:i,layout:a,isCompleted:s,isSkipped:o,isRecurring:!!r.recurrence,isMaterializedOccurrence:!!(r.recurrence_parent&&r.occurrence_date),isActivelyTracked:e.getActiveTimeSession(r)!==null,hasDetails:QH(r,e)};return{...l,cardClasses:Ptt(r,e,l)}}var tV=y(()=>{Ne();Ct()});function Ee(r,e,t){r==null||r.trigger(rV,{message:e,timeout:t})}var rV,ls=y(()=>{rV="user-notice"});function uI(r,e,t){return r.i18n.translate(e,t)}function Mtt(r){let e=new Set,t=[];for(let n of r){let i=n.trim();!i||e.has(i)||(e.add(i),t.push(i))}return t}function eTe(r,e,t){return js(r.app,e,t,"","",r.settings.useFrontmatterMarkdownLinks)}function _tt(r,e,t){var s,o;let n=e.trim();if(!n)return"";let i=jt(n),a=(o=(s=r.app.metadataCache).getFirstLinkpathDest)==null?void 0:o.call(s,i,t);return a instanceof Xbe.TFile?eTe(r,a,t):n}async function pI(r,e,t){let n=js(r.app,t,e.path,"","",r.settings.useFrontmatterMarkdownLinks),i=`[[${t.basename}]]`,a=Array.isArray(e.projects)?e.projects:[];if(a.includes(n)||a.includes(i))return Ee(r.emitter,uI(r,"contextMenus.task.organization.notices.alreadyInProject")),null;let o=[...a.filter(c=>c!==i),n],l=await r.updateTaskProperty(e,"projects",o);return Ee(r.emitter,uI(r,"contextMenus.task.organization.notices.addedToProject",{project:t.basename})),l}async function mI(r,e,t){let n=js(r.app,e,t.path,"","",r.settings.useFrontmatterMarkdownLinks),i=`[[${e.basename}]]`,a=Array.isArray(t.projects)?t.projects:[];if(a.includes(n)||a.includes(i))return Ee(r.emitter,uI(r,"contextMenus.task.organization.notices.alreadySubtask")),null;let o=[...a.filter(c=>c!==i),n],l=await r.updateTaskProperty(t,"projects",o);return Ee(r.emitter,uI(r,"contextMenus.task.organization.notices.addedAsSubtask",{subtask:t.title,parent:e.basename})),l}function tTe(r,e,t){var c;let n=!!((c=r.settings.taskCreationDefaults)!=null&&c.inheritParentTaskProperties),i=eTe(r,t,e.path),a=Array.isArray(e.tags)?e.tags:[],s=n?Array.isArray(e.projects)?e.projects.map(d=>_tt(r,d,e.path)):[]:[],o=n?r.settings.taskIdentificationMethod==="tag"?bu(a,r.settings.taskTag,r.settings.hideIdentifyingTagsMode):[...a]:[],l={projects:Mtt([...s,i])};return o.length>0&&(l.tags=o),n&&Array.isArray(e.contexts)&&e.contexts.length>0&&(l.contexts=[...e.contexts]),n&&e.priority&&(l.priority=e.priority),l}var Xbe,nV=y(()=>{Xbe=require("obsidian");jn();qp();ls()});var Mc=y(()=>{qB()});function Su(r,e,t={}){let n=Ye(),i={title:e.title.trim(),status:e.status||r.settings.defaultTaskStatus,priority:e.priority||r.settings.defaultTaskPriority,dateCreated:n,dateModified:n};if(t.creationContext&&(i.creationContext=t.creationContext),e.dueDate&&(i.due=e.dueTime?Ni(e.dueDate,e.dueTime):e.dueDate),e.scheduledDate&&(i.scheduled=e.scheduledTime?Ni(e.scheduledDate,e.scheduledTime):e.scheduledDate),e.contexts&&e.contexts.length>0&&(i.contexts=e.contexts),e.projects&&e.projects.length>0&&(i.projects=e.projects),e.tags&&e.tags.length>0&&(i.tags=e.tags.map(a=>Ri(a))),e.details&&(i.details=e.details),e.recurrence&&(i.recurrence=e.recurrence),e.estimate&&e.estimate>0&&(i.timeEstimate=e.estimate),e.userFields){let a=r.settings.userFields||[],s={};for(let[o,l]of Object.entries(e.userFields)){let c=a.find(d=>d.id===o);c&&(s[c.key]=Array.isArray(l)?l.join(", "):l)}Object.keys(s).length>0&&(i.customFrontmatter=s)}return i}var Lx=y(()=>{Ne();Ct()});function Att(r,e){if(!r.recurrence)return!1;let t=ce(e);return(Array.isArray(r.complete_instances)?r.complete_instances:[]).includes(t)}function rTe(r,e,t,n="open"){let i=t.getCompletedStatuses()[0]||"done",a=P_(r,e,i)||n;return!r.recurrence||Att(r,e)?a:t.isCompletedStatus(a)?n:a}function $h(r,e,t,n="open"){return t.isCompletedStatus(rTe(r,e,t,n))}function fI(r,e,t,n="open"){let i=rTe(r,e,t,n);return i===r.status?r:{...r,status:i}}var hI=y(()=>{yv();Ne()});var cb,Itt,lb,iV=y(()=>{cb=require("obsidian");wc();V_();tS();qp();G();Itt=I({tag:"Modals/TaskCreationSuggest"}),lb=class extends cb.AbstractInputSuggest{constructor(t,n,i){super(t,n);this.currentTrigger=null;this.projectMetadataResolver=null;this.plugin=i,this.textarea=n,this.obsidianApp=t}getCursorPosition(){var t;return(t=this.textarea.selectionStart)!=null?t:this.textarea.value.length}isBoundary(t,n){if(n===-1)return!1;if(n===0)return!0;let i=t[n-1];return!/\w/.test(i)}findActiveTrigger(t){let n=t.lastIndexOf("@"),i=t.lastIndexOf("#"),a=t.lastIndexOf("+"),s=(this.plugin.settings.statusSuggestionTrigger||"").trim(),o=s?t.lastIndexOf(s):-1,l=[{type:"@",index:n},{type:"#",index:i},{type:"+",index:a},{type:"status",index:o}].filter(m=>this.isBoundary(t,m.index));if(l.length===0)return{trigger:null,triggerIndex:-1,queryAfterTrigger:""};l.sort((m,f)=>f.index-m.index);let c=l[0].index,d=l[0].type,u=d==="status"?(s==null?void 0:s.length)||0:1,p=t.slice(c+u);return{trigger:d,triggerIndex:c,queryAfterTrigger:p}}shouldEndSuggestionContext(t,n){return!!(t==="+"&&/^\[\[[^\]]*\]\]/.test(n)||(t==="@"||t==="#"||t==="status")&&(n.includes(" ")||n.includes(` +`)))}getContextSuggestions(t){return this.plugin.cacheManager.getAllContexts().filter(i=>i&&typeof i=="string").filter(i=>i.toLowerCase().includes(t.toLowerCase())).slice(0,10).map(i=>({value:i,display:i,type:"context",toString(){return this.value}}))}getStatusSuggestions(t){return Zn.fromPlugin(this.plugin).getStatusSuggestions(t,10).map(i=>({...i,type:"status",toString(){return this.value}}))}getTagSuggestions(t){return VA(this.plugin.cacheManager.getAllTags(),this.plugin.settings).filter(i=>i&&typeof i=="string").filter(i=>i.toLowerCase().includes(t.toLowerCase())).slice(0,10).map(i=>({value:i,display:i,type:"tag",toString(){return this.value}}))}getProjectMetadataResolver(){var t;if(!this.projectMetadataResolver){let n=(t=this.obsidianApp)!=null?t:this.plugin.app;this.projectMetadataResolver=new Rp({getFrontmatter:i=>{let a=n==null?void 0:n.vault.getAbstractFileByPath(i.path),s=a instanceof cb.TFile?n==null?void 0:n.metadataCache.getFileCache(a):void 0;return(s==null?void 0:s.frontmatter)||{}}})}return this.projectMetadataResolver}async getProjectSuggestions(t){var s,o,l,c;let{FileSuggestHelper:n}=await Promise.resolve().then(()=>(nS(),XB)),i=await n.suggest(this.plugin,t,20,this.plugin.settings.projectAutosuggest),a=(s=this.obsidianApp)!=null?s:this.plugin.app;try{let d=this.getProjectMetadataResolver(),u=((c=(l=(o=this.plugin.settings)==null?void 0:o.projectAutosuggest)==null?void 0:l.rows)!=null?c:[]).slice(0,3);return i.map(p=>{var x;let m=a==null?void 0:a.vault.getMarkdownFiles().find(C=>C.basename===p.insertText);if(!m)return{basename:p.insertText,displayName:p.displayText,type:"project",toString(){return this.basename}};let f=a==null?void 0:a.metadataCache.getFileCache(m),h=(f==null?void 0:f.frontmatter)||{},g=this.plugin.fieldMapper.mapFromFrontmatter(h,m.path,this.plugin.settings.storeTitleInFilename),v=typeof g.title=="string"?g.title:"",k=(0,cb.parseFrontMatterAliases)(h)||[],b=Array.isArray(k)?k.filter(C=>typeof C=="string"):[],w={basename:m.basename,name:m.name,path:m.path,parent:((x=m.parent)==null?void 0:x.path)||"",title:v,aliases:b,frontmatter:h},S=this.generateProjectDisplayName(u,w,d,m.basename);return{basename:p.insertText,displayName:S,type:"project",entry:{basename:w.basename,name:w.name,path:w.path,parent:w.parent,title:w.title,aliases:w.aliases,frontmatter:w.frontmatter},toString(){return this.basename}}})}catch(d){return Itt.error("Enhanced project autosuggest failed, falling back to basic suggestions",{category:"persistence",operation:"enhanced-project-autosuggest-falling-back-basic-suggestions",error:d}),i.map(u=>({basename:u.insertText,displayName:u.displayText,type:"project",toString(){return this.basename}}))}}generateProjectDisplayName(t,n,i,a){var o;let s=[];for(let l of t)try{let c=hc(l),d=[];for(let p of c){if(p.property.startsWith("literal:")){d.push(p.property.slice(8));continue}let m=i.resolve(p.property,n)||"";if(m)if(p.showName){let f=(o=p.displayName)!=null?o:p.property;d.push(`${f}: ${m}`)}else d.push(m)}let u=d.join(" ");u.trim()&&s.push(u)}catch(c){}return s.join(" | ")||a}async getSuggestions(t){let n=this.getCursorPosition(),i=this.textarea.value.slice(0,n),{trigger:a,triggerIndex:s,queryAfterTrigger:o}=this.findActiveTrigger(i);if(!a||s===-1)return this.currentTrigger=null,[];if(this.shouldEndSuggestionContext(a,o))return this.currentTrigger=null,[];switch(this.currentTrigger=a,a){case"@":return this.getContextSuggestions(o);case"status":return this.getStatusSuggestions(o);case"#":return this.getTagSuggestions(o);case"+":return await this.getProjectSuggestions(o);default:return[]}}renderSuggestion(t,n){var c,d,u,p,m;n.setAttribute("role","option");let i=t.type==="project"?t.displayName:t.display;n.setAttribute("aria-label",`${t.type}: ${i}`);let a=n.createSpan("nlp-suggest-icon");a.textContent=this.currentTrigger==="status"?this.plugin.settings.statusSuggestionTrigger||"":this.currentTrigger||"",a.setAttribute("aria-hidden","true");let s=n.createSpan("nlp-suggest-text"),o=(f,h)=>{if(!h)return;let g=h.toLowerCase().split(/\s+/).filter(Boolean);if(!g.length)return;let v=k=>{var b;if(k.nodeType===Node.TEXT_NODE){let w=k.nodeValue||"",S=w.toLowerCase(),x=[];for(let O of g){let L=S.indexOf(O);for(;L!==-1;)x.push({start:L,end:L+O.length}),L=S.indexOf(O,L+1)}x.sort((O,L)=>O.start-L.start);let C=[];for(let O of x)(!C.length||O.start>=C[C.length-1].end)&&C.push(O);if(!C.length)return;let D=activeDocument.createDocumentFragment(),_=0;for(let O of C){O.start>_&&D.appendChild(activeDocument.createTextNode(w.slice(_,O.start)));let L=activeDocument.createElement("mark");L.textContent=w.slice(O.start,O.end),D.appendChild(L),_=O.end}_0&&t.entry){let g=this.getProjectMetadataResolver();for(let v=0;v$x,getTaskSelectorQueryRank:()=>aV,openTaskSelector:()=>Pn,openTaskSelectorWithCreate:()=>Rtt,taskMatchesSelectorQuery:()=>iTe});function Fx(r,e){return r==null||typeof r!="string"&&typeof r!="number"&&typeof r!="boolean"?!1:String(r).toLowerCase().includes(e)}function gI(r,e){if(r==null||typeof r!="string"&&typeof r!="number"&&typeof r!="boolean")return null;let t=String(r).toLowerCase();return t.includes(e)?t===e?0:t.startsWith(e)?1:t.split(/[^a-z0-9]+/).some(i=>i.startsWith(e))?2:3:null}function nTe(r,e){let t=null;for(let n of r){let i=gI(n,e);i!==null&&(t=t===null?i:Math.min(t,i))}return t}function iTe(r,e){var n;return!!(Fx(r.title,e)||Fx(r.due,e)||r.priority!=="normal"&&Fx(r.priority,e)||(n=r.contexts)!=null&&n.some(i=>Fx(i,e))||Tl(r.projects||[]).some(i=>Fx(i,e)))}function aV(r,e){let t=gI(r.title,e);if(t!==null)return t;let n=nTe(r.contexts||[],e);if(n!==null)return 10+n;let i=Tl(r.projects||[]),a=nTe(i,e);if(a!==null)return 20+a;if(r.priority!=="normal"){let o=gI(r.priority,e);if(o!==null)return 30+o}let s=gI(r.due,e);return s!==null?40+s:Number.MAX_SAFE_INTEGER}async function Rtt(r,e){let t=await r.cacheManager.getAllTasks();return new Promise(n=>{new $x(r.app,r,t,{onResult:n,...e}).open()})}function Pn(r,e,t,n){new $x(r.app,r,e,{placeholder:n==null?void 0:n.placeholder,title:n==null?void 0:n.title,targetDate:n==null?void 0:n.targetDate,onResult:a=>{a.type==="selected"||a.type==="created"?t(a.task):t(null)}}).open()}var _c,Ntt,$x,No=y(()=>{_c=require("obsidian");Ct();wc();la();Lx();hI();iV();G();Ntt=I({tag:"Modals/TaskSelectorWithCreateModal"});$x=class extends _c.SuggestModal{constructor(t,n,i,a){super(t);this.nlpSuggest=null;this.createFooterEl=null;this.currentQuery="";this.resultHandled=!1;this.isCreatingTask=!1;this.handleCreateFooterActivation=t=>{!this.createFooterEl||this.createFooterEl.classList.contains("tn-static-display-none-6b99de8b")||(t.preventDefault(),t.stopPropagation(),this.createNewTask())};this.handleCreateFooterKeydown=t=>{t.key!=="Enter"&&t.key!==" "||this.handleCreateFooterActivation(t)};this.handleInputChange=()=>{let t=this.inputEl.value.trim();this.currentQuery=t,this.updateCreateFooter(t)};this.plugin=n,this.tasks=i,this.options=a,this.targetDate=a.targetDate||new Date,this.translate=n.i18n.translate.bind(n.i18n),this.nlParser=Zn.fromPlugin(n),this.setPlaceholder(a.placeholder||this.translate("modals.taskSelectorWithCreate.placeholder")),this.setInstructions([{command:"\u2191\u2193",purpose:this.translate("modals.taskSelector.instructions.navigate")},{command:"\u21B5",purpose:this.translate("modals.taskSelector.instructions.select")},{command:"\u21E7\u21B5",purpose:this.translate("modals.taskSelectorWithCreate.instructions.create")},{command:"esc",purpose:this.translate("modals.taskSelector.instructions.dismiss")}]),this.titleEl.setText(a.title||this.translate("modals.taskSelectorWithCreate.title")),this.titleEl.setAttribute("id","task-selector-with-create-title"),this.containerEl.setAttribute("aria-labelledby","task-selector-with-create-title"),this.containerEl.setAttribute("role","dialog"),this.containerEl.setAttribute("aria-modal","true"),this.containerEl.addClass("task-selector-with-create-modal"),this.containerEl.addClass("tasknotes-plugin")}onOpen(){super.onOpen(),this.scope.register(["Shift"],"Enter",t=>(t.preventDefault(),t.stopPropagation(),this.createNewTask(),!1)),this.inputEl.addEventListener("input",this.handleInputChange),this.nlpSuggest=new lb(this.app,this.inputEl,this.plugin),window.setTimeout(()=>this.createFooter(),0)}createFooter(){var n;let t=((n=this.modalEl.querySelector(".prompt"))==null?void 0:n.parentElement)||this.modalEl;this.createFooterEl=t.createDiv({cls:"task-selector-create-footer"}),this.createFooterEl.setAttribute("role","button"),this.createFooterEl.setAttribute("aria-hidden","true"),this.createFooterEl.tabIndex=-1,this.createFooterEl.addEventListener("click",this.handleCreateFooterActivation),this.createFooterEl.addEventListener("keydown",this.handleCreateFooterKeydown),this.createFooterEl.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"),this.createFooterEl.classList.add("tn-static-display-none-6b99de8b"),this.currentQuery&&this.updateCreateFooter(this.currentQuery)}updateCreateFooter(t){if(!this.createFooterEl)return;if(!t){this.createFooterEl.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"),this.createFooterEl.classList.add("tn-static-display-none-6b99de8b"),this.createFooterEl.setAttribute("aria-hidden","true"),this.createFooterEl.removeAttribute("aria-label"),this.createFooterEl.tabIndex=-1,this.createFooterEl.empty();return}let n=this.nlParser.parseInput(t);if(n.title&&n.title!=="Untitled Task"){this.createFooterEl.empty(),this.createFooterEl.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),this.createFooterEl.classList.add("tn-static-display-flex-75816cae"),this.createFooterEl.setAttribute("aria-hidden","false"),this.createFooterEl.setAttribute("aria-label",`${this.translate("modals.taskSelectorWithCreate.footer.createLabel").trim()} ${n.title}`.trim()),this.createFooterEl.tabIndex=0;let i=this.createFooterEl.createDiv({cls:"task-selector-create-footer__icon"});(0,_c.setIcon)(i,"plus-circle");let a=this.createFooterEl.createDiv({cls:"task-selector-create-footer__content"});a.createDiv({cls:"task-selector-create-footer__title-line"}).createSpan({cls:"task-selector-create-footer__title",text:n.title});let o=this.buildMetadataParts(n);if(o.length>0){let c=a.createDiv({cls:"task-selector-create-footer__meta"});o.forEach(d=>{let u=c.createSpan({cls:`task-selector-create-footer__chip task-selector-create-footer__chip--${d.type}`}),p=u.createSpan({cls:"task-selector-create-footer__chip-icon"});(0,_c.setIcon)(p,d.icon),u.createSpan({cls:"task-selector-create-footer__chip-text",text:d.text})})}let l=a.createDiv({cls:"task-selector-create-footer__hint"});l.createSpan({cls:"task-selector-create-footer__shortcut",text:"\u21E7\u21B5"}),l.createSpan({cls:"task-selector-create-footer__hint-text",text:this.translate("modals.taskSelectorWithCreate.footer.createLabel")})}else this.createFooterEl.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"),this.createFooterEl.classList.add("tn-static-display-none-6b99de8b"),this.createFooterEl.setAttribute("aria-hidden","true"),this.createFooterEl.removeAttribute("aria-label"),this.createFooterEl.tabIndex=-1,this.createFooterEl.empty()}buildMetadataParts(t){let n=[];if(t.dueDate){let i=t.dueTime?`${t.dueDate} ${t.dueTime}`:t.dueDate;n.push({icon:"calendar",text:i,type:"due"})}if(t.scheduledDate){let i=t.scheduledTime?`${t.scheduledDate} ${t.scheduledTime}`:t.scheduledDate;n.push({icon:"calendar-clock",text:i,type:"scheduled"})}if(t.priority&&t.priority!=="normal"&&n.push({icon:"flag",text:t.priority,type:"priority"}),t.status){let i=this.plugin.statusManager.getStatusConfig(t.status);n.push({icon:"circle-dot",text:(i==null?void 0:i.label)||t.status,type:"status"})}if(t.contexts&&t.contexts.length>0&&t.contexts.forEach(i=>{n.push({icon:"at-sign",text:i,type:"context"})}),t.projects&&t.projects.length>0&&t.projects.forEach(i=>{n.push({icon:"folder",text:i.replace(/^\[\[|\]\]$/g,""),type:"project"})}),t.tags&&t.tags.length>0&&t.tags.forEach(i=>{n.push({icon:"hash",text:i,type:"tag"})}),t.recurrence&&n.push({icon:"repeat",text:t.recurrence,type:"recurrence"}),t.estimate&&t.estimate>0){let i=Math.floor(t.estimate/60),a=t.estimate%60,s=i>0?`${i}h ${a}m`:`${a}m`;n.push({icon:"timer",text:s,type:"estimate"})}if(t.details){let i=t.details.length>30?t.details.substring(0,30)+"...":t.details;n.push({icon:"file-text",text:i,type:"details"})}if(t.userFields){let i=this.plugin.settings.userFields||[];for(let[a,s]of Object.entries(t.userFields)){let o=i.find(d=>d.id===a),l=(o==null?void 0:o.displayName)||a,c=Array.isArray(s)?s.join(", "):s;n.push({icon:"sliders-horizontal",text:`${l}: ${c}`,type:"userfield"})}}return n}async createNewTask(){if(this.isCreatingTask)return;let t=this.inputEl.value.trim();if(!t){new _c.Notice(this.translate("modals.taskSelectorWithCreate.notices.emptyQuery"));return}this.isCreatingTask=!0;try{let n=this.nlParser.parseInput(t);if(!n.title||n.title==="Untitled Task"){new _c.Notice(this.translate("modals.taskSelectorWithCreate.notices.invalidTitle"));return}let i=this.buildTaskDataFromParsed(n),a=await this.plugin.taskService.createTask(i);new _c.Notice(this.translate("modals.taskCreation.notices.success",{title:a.taskInfo.title})),this.resultHandled=!0,this.close(),this.options.onResult({type:"created",task:a.taskInfo})}catch(n){Ntt.error("Failed to create task:",{category:"persistence",operation:"create-task",error:n});let i=n instanceof Error?n.message:String(n);new _c.Notice(this.translate("modals.taskCreation.notices.failure",{message:i}))}finally{this.isCreatingTask=!1}}buildTaskDataFromParsed(t){return Su(this.plugin,t)}getSuggestions(t){return this.currentQuery=t,this.getFilteredTasks(t)}getFilteredTasks(t){let n=t.trim().toLowerCase(),i=n.length>0;return this.tasks.filter(a=>!a.archived).filter(a=>i?iTe(a,n):!0).sort((a,s)=>{var p,m;if(i){let f=aV(a,n)-aV(s,n);if(f!==0)return f}let o=$h(a,this.targetDate,this.plugin.statusManager,this.plugin.settings.defaultTaskStatus),l=$h(s,this.targetDate,this.plugin.statusManager,this.plugin.settings.defaultTaskStatus);if(o!==l)return o?1:-1;if(i){let f=a.title.localeCompare(s.title);if(f!==0)return f}if(a.due&&!s.due)return-1;if(!a.due&&s.due)return 1;if(a.due&&s.due){let f=a.due.localeCompare(s.due);if(f!==0)return f}let c={high:0,normal:1,low:2},d=(p=c[a.priority])!=null?p:1,u=(m=c[s.priority])!=null?m:1;return d!==u?d-u:a.title.localeCompare(s.title)})}renderSuggestion(t,n){let i=fI(t,this.targetDate,this.plugin.statusManager,this.plugin.settings.defaultTaskStatus),a=Sr(i,this.plugin,void 0,{layout:"default",targetDate:this.targetDate});a.classList.add("task-selector-modal__suggestion");let s=a.cloneNode(!0);n.appendChild(s)}onChooseSuggestion(t,n){this.resultHandled=!0,this.options.onResult({type:"selected",task:t})}onClose(){var t;this.inputEl.removeEventListener("input",this.handleInputChange),(t=this.nlpSuggest)==null||t.close(),this.nlpSuggest=null,this.createFooterEl&&(this.createFooterEl.removeEventListener("click",this.handleCreateFooterActivation),this.createFooterEl.removeEventListener("keydown",this.handleCreateFooterKeydown),this.createFooterEl.remove(),this.createFooterEl=null),window.setTimeout(()=>{this.resultHandled||this.options.onResult({type:"cancelled"})},0),super.onClose()}}});function aTe(r){let e=String(r.getHours()).padStart(2,"0"),t=String(r.getMinutes()).padStart(2,"0");return`${e}:${t}`}function sTe(r,e){let t=null;if(r.scheduled)try{t=ut(r.scheduled)}catch(a){t=null}(!t||isNaN(t.getTime()))&&(t=new Date(e)),isNaN(t.getTime())&&(t=new Date),(!r.scheduled||!kr(r.scheduled))&&t.setHours(9,0,0,0);let n=r.timeEstimate&&r.timeEstimate>0?r.timeEstimate:60,i=new Date(t.getTime()+n*60*1e3);return{date:ce(t),startTime:aTe(t),endTime:aTe(i)}}var oTe=y(()=>{Ne()});function Qp(r,e,t){new oV(r.app,r,{placeholder:t==null?void 0:t.placeholder,title:t==null?void 0:t.title,filter:t==null?void 0:t.filter,newFileFolder:t==null?void 0:t.newFileFolder,sortOrder:t==null?void 0:t.sortOrder,onResult:i=>{i.type==="selected"||i.type==="created"?e(i.file):e(null)}}).open()}var Ci,Ott,oV,zx=y(()=>{Ci=require("obsidian");G();Mc();Ott=I({tag:"Modals/FileSelectorModal"}),oV=class extends Ci.SuggestModal{constructor(t,n,i){super(t);this.currentQuery="";this.resultHandled=!1;this.createFooterEl=null;this.handleInputChange=()=>{this.currentQuery=this.inputEl.value.trim(),this.updateCreateFooter()};this.plugin=n,this.options=i,this.setPlaceholder(i.placeholder||"Search files or type to create new..."),this.setInstructions([{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to select"},{command:"\u21E7\u21B5",purpose:"to create new"},{command:"esc",purpose:"to cancel"}]),i.title&&this.titleEl.setText(i.title),this.containerEl.addClass("file-selector-modal"),this.containerEl.addClass("tasknotes-plugin")}onOpen(){super.onOpen(),this.scope.register(["Shift"],"Enter",t=>(t.preventDefault(),t.stopPropagation(),this.createNewFile(),!1)),this.inputEl.addEventListener("input",this.handleInputChange),window.setTimeout(()=>this.createFooter(),0)}createFooter(){var n;let t=this.modalEl.querySelector(".prompt");t&&(this.createFooterEl=((n=t.parentElement)==null?void 0:n.createDiv({cls:"file-selector-create-footer"}))||null,this.createFooterEl&&(this.createFooterEl.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"),this.createFooterEl.classList.add("tn-static-display-none-6b99de8b")))}updateCreateFooter(){if(!this.createFooterEl)return;if(!this.currentQuery){this.createFooterEl.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"),this.createFooterEl.classList.add("tn-static-display-none-6b99de8b");return}this.createFooterEl.empty(),this.createFooterEl.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),this.createFooterEl.classList.add("tn-static-display-flex-75816cae");let n=this.createFooterEl.createDiv({cls:"file-selector-create-footer__content"}).createDiv({cls:"file-selector-create-footer__title-line"});n.createSpan({cls:"file-selector-create-footer__shortcut",text:"\u21E7\u21B5"}),n.createSpan({cls:"file-selector-create-footer__hint-text",text:" to create: "}),n.createSpan({cls:"file-selector-create-footer__filename",text:this.getNewFileName()})}getNewFileName(){let t=this.currentQuery;return t.toLowerCase().endsWith(".md")&&(t=t.slice(0,-3)),t+".md"}async createNewFile(){if(!this.currentQuery){new Ci.Notice("Please enter a file name");return}try{let t=this.currentQuery;t.toLowerCase().endsWith(".md")&&(t=t.slice(0,-3));let n=this.options.newFileFolder||"",i=n?`${n}/${t}.md`:`${t}.md`;if(this.app.vault.getAbstractFileByPath(i)){new Ci.Notice(`File "${i}" already exists`);return}n&&!await this.app.vault.adapter.exists(n)&&await Xw(this.app,n);let s=await sh(this.app,i,"");this.resultHandled=!0,this.close(),this.options.onResult({type:"created",file:s})}catch(t){Ott.error("Error creating file:",{category:"persistence",operation:"creating-file",error:t}),new Ci.Notice("Failed to create file")}}getSuggestions(t){this.currentQuery=t.trim(),this.updateCreateFooter();let n=this.app.vault.getAllLoadedFiles(),i=t.toLowerCase(),a,s=this.options.filter||"markdown";typeof s=="function"?a=n.filter(s):s==="markdown"?a=n.filter(c=>c instanceof Ci.TFile&&c.extension==="md"&&!c.path.includes(".trash")):a=n.filter(c=>c instanceof Ci.TFile&&!c.path.includes(".trash"));let o=this.options.sortOrder||"name-asc",l=[...a].sort((c,d)=>{let u=c instanceof Ci.TFile?c.stat.ctime:0,p=d instanceof Ci.TFile?d.stat.ctime:0,m=c instanceof Ci.TFile?c.stat.mtime:0,f=d instanceof Ci.TFile?d.stat.mtime:0;switch(o){case"name-desc":return d.name.localeCompare(c.name);case"path-asc":return c.path.localeCompare(d.path);case"path-desc":return d.path.localeCompare(c.path);case"created-recent":return p-u;case"created-oldest":return u-p;case"modified-recent":return f-m;case"modified-oldest":return m-f;case"name-asc":default:return c.name.localeCompare(d.name)}});return t?l.filter(c=>this.getSearchText(c).toLowerCase().includes(i)).slice(0,50):l.slice(0,50)}getSearchText(t){let n=`${t.name} ${t.path}`;if(t instanceof Ci.TFile){let i=this.app.metadataCache.getFileCache(t);if(i!=null&&i.frontmatter){let a=this.plugin.fieldMapper.toUserField("title"),s=i.frontmatter[a];s&&(n+=` ${s}`);let o=(0,Ci.parseFrontMatterAliases)(i.frontmatter);o&&o.length>0&&(n+=` ${o.join(" ")}`)}}return n}renderSuggestion(t,n){let i=n.createDiv({cls:"file-selector-suggestion"});if(i.createDiv({cls:"file-selector-suggestion__name",text:t.name}),t instanceof Ci.TFile){let a=this.app.metadataCache.getFileCache(t);if(a!=null&&a.frontmatter){let s=this.plugin.fieldMapper.toUserField("title"),o=a.frontmatter[s];if(o)i.createDiv({cls:"file-selector-suggestion__title",text:o});else{let l=(0,Ci.parseFrontMatterAliases)(a.frontmatter);l&&l.length>0&&i.createDiv({cls:"file-selector-suggestion__aliases",text:l.join(", ")})}}}t.parent&&t.parent.path!=="/"&&i.createDiv({cls:"file-selector-suggestion__path",text:t.parent.path})}onChooseSuggestion(t,n){this.resultHandled=!0,this.options.onResult({type:"selected",file:t})}onClose(){this.inputEl.removeEventListener("input",this.handleInputChange),this.createFooterEl&&(this.createFooterEl.remove(),this.createFooterEl=null),window.setTimeout(()=>{this.resultHandled||this.options.onResult({type:"cancelled"})},0),super.onClose()}}});function Ftt(){return(0,Jp.requireApiVersion)("1.11.0")}function Di(r){Promise.resolve().then(r).catch(e=>{Ltt.error("TaskNotes settings callback failed:",{category:"configuration",operation:"settings-callback",error:e})})}function kt(r,e,t){if(Ftt()){let n=new Jp.SettingGroup(r).setHeading(e.heading);if(e.className&&n.addClass(e.className),e.description){let i=e.description;n.addSetting(a=>{a.setDesc(i),a.settingEl.addClass("settings-view__group-description")})}return t(n),n}else{let n=new lV(r).setHeading(e.heading);if(e.className&&n.addClass(e.className),e.description){let i=e.description;n.addSetting(a=>{a.setDesc(i),a.settingEl.addClass("settings-view__group-description")})}return t(n),n}}function me(r,e){return r.setName(e.name).setDesc(e.desc).addToggle(t=>{t.setValue(e.getValue()).onChange(n=>{Di(()=>e.setValue(n))})})}function Mn(r,e){return r.setName(e.name).setDesc(e.desc).addText(t=>{t.setValue(e.getValue());let n=i=>{Di(()=>e.setValue(i))};if(e.debounceMs&&e.debounceMs>0){let i=db(n,e.debounceMs);t.onChange(i)}else t.onChange(n);return e.placeholder&&t.setPlaceholder(e.placeholder),e.ariaLabel&&t.inputEl.setAttribute("aria-label",e.ariaLabel),t.inputEl.addClass("settings-view__input"),t})}function dn(r,e){return r.setName(e.name).setDesc(e.desc).addDropdown(t=>(e.options.forEach(n=>{t.addOption(n.value,n.label)}),t.setValue(e.getValue()).onChange(n=>{Di(()=>e.setValue(n))}),e.ariaLabel&&t.selectEl.setAttribute("aria-label",e.ariaLabel),t))}function Oa(r,e){let t=e.debounceMs?db(n=>{Di(()=>e.setValue(n))},e.debounceMs):n=>{Di(()=>e.setValue(n))};return r.setName(e.name).setDesc(e.desc).addText(n=>(n.setValue(e.getValue().toString()).onChange(i=>{let a=parseInt(i);if(!isNaN(a)){if(e.min!==void 0&&ae.max)return;t(a)}}),n.inputEl.type="number",e.placeholder&&n.setPlaceholder(e.placeholder),e.min!==void 0&&n.inputEl.setAttribute("min",e.min.toString()),e.max!==void 0&&n.inputEl.setAttribute("max",e.max.toString()),e.ariaLabel&&n.inputEl.setAttribute("aria-label",e.ariaLabel),n.inputEl.addClass("settings-view__input"),n))}function Ac(r,e){return r.setName(e.name).setDesc(e.desc).addButton(t=>(t.setButtonText(e.buttonText).onClick(()=>{Di(e.onClick)}),e.buttonClass?t.buttonEl.addClass(e.buttonClass):t.buttonEl.addClasses(["tn-btn","tn-btn--ghost"]),t))}function Xp(r,e){return new Jp.Setting(r).setName(e).setHeading()}function Ic(r,e){return r.createEl("p",{text:e,cls:"settings-view__help-note"})}function db(r,e,t=!1){let n,i,a,s=function(...o){i=o,a=this;let l=()=>{n=void 0,i=void 0,t||r.apply(a,o)},c=t&&!n;window.clearTimeout(n),n=window.setTimeout(l,e),c&&r.apply(this,o)};return s.flush=()=>{n&&i&&(window.clearTimeout(n),n=void 0,r.apply(a,i),i=void 0)},s}var Jp,Ltt,lV,Nc=y(()=>{Jp=require("obsidian");G();Ltt=I({tag:"Settings/Components/SettingHelpers"});lV=class{constructor(e){this.containerEl=e}setHeading(e){return new Jp.Setting(this.containerEl).setName(e).setHeading(),this}addClass(e){return this}addSetting(e){let t=new Jp.Setting(this.containerEl);return e(t),this}}});function vr(r,e){let t=r.createDiv("tasknotes-settings__card");e.id&&t.setAttribute("data-card-id",e.id),e.draggable&&t.addClass("tasknotes-settings__card--draggable"),e.collapsible&&(t.addClass("tasknotes-settings__card--collapsible"),e.defaultCollapsed&&t.addClass("tasknotes-settings__card--collapsed"));let n=t.createDiv("tasknotes-settings__card-header"),i=null;e.draggable&&(n.addClass("tasknotes-settings__card-header--with-drag-handle"),i=n.createDiv("tasknotes-settings__card-drag-handle"),i.textContent="\u22EE\u22EE",i.draggable=!0,i.title="Drag to reorder");let a=n.createDiv();if(a.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),a.classList.add("tn-static-display-flex-75816cae"),a.classList.remove("tn-static-align-items-baseline-4b95b5c7","tn-static-align-items-flex-start-0486f781"),a.classList.add("tn-static-align-items-center-7c619740"),a.classList.remove("tn-static-flex-1-14e3b769","tn-static-margin-top-12px-91e0f558"),a.classList.add("tn-static-flex-1-97445a8d"),a.classList.remove("tn-static-min-width-2px-709d7da0"),a.classList.add("tn-static-min-width-0-3922d326"),e.colorIndicator){let c=a.createDiv("tasknotes-settings__card-color-indicator");c.style.backgroundColor=_r(e.colorIndicator.color),e.colorIndicator.cssVar&&c.style.setProperty("--card-color",_r(e.colorIndicator.color))}let s=a.createDiv("tasknotes-settings__card-info"),o=s.createSpan("tasknotes-settings__card-primary-text");if(o.textContent=e.header.primaryText,e.header.secondaryText){let c=s.createSpan("tasknotes-settings__card-secondary-text");c.textContent=e.header.secondaryText}let l=n.createDiv();if(l.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),l.classList.add("tn-static-display-flex-75816cae"),l.classList.remove("tn-static-align-items-baseline-4b95b5c7","tn-static-align-items-flex-start-0486f781"),l.classList.add("tn-static-align-items-center-7c619740"),l.classList.remove("tn-static-display-flex-8bb39979","tn-static-gap-10px-f3d7ce77","tn-static-gap-12px-ed7b3d87","tn-static-gap-6px-f0abc1db","tn-static-gap-8px-33fcd4c3"),l.classList.add("tn-static-gap-0-5rem-ce2fca4d"),e.header.meta&&e.header.meta.length>0){let c=l.createDiv("tasknotes-settings__card-meta");e.header.meta.forEach(d=>{c.appendChild(d)})}if(e.header.actions&&e.header.actions.length>0){let c=l.querySelector(".tasknotes-settings__card-header-actions")||l.createDiv("tasknotes-settings__card-header-actions");e.header.actions.forEach(d=>{let u=c.createEl("button",{cls:"tasknotes-settings__card-header-btn"});d.variant==="delete"&&u.addClass("tasknotes-settings__card-header-btn--delete");let p=u.createSpan();(0,jx.setIcon)(p,d.icon),d.tooltip&&(u.title=d.tooltip),u.onclick=m=>{m.stopPropagation(),Di(d.onClick)}})}if(e.collapsible){let c=()=>{var u,p;t.hasClass("tasknotes-settings__card--collapsed")?(t.removeClass("tasknotes-settings__card--collapsed"),n.title="Collapse card",(u=e.onCollapseChange)==null||u.call(e,!1)):(t.addClass("tasknotes-settings__card--collapsed"),n.title="Expand card",(p=e.onCollapseChange)==null||p.call(e,!0))};n.addClass("tasknotes-settings__card-header--clickable"),n.title=e.defaultCollapsed?"Expand card":"Collapse card",n.onclick=d=>{d.target.closest(".tasknotes-settings__card-header-actions")||c()}}if(e.content&&e.content.sections.length>0){let c=t.createDiv("tasknotes-settings__card-content");e.draggable&&c.addClass("tasknotes-settings__card-content--with-drag-handle"),e.content.sections.forEach(d=>{d.rows.forEach(u=>{let p=c.createDiv("tasknotes-settings__card-config-row");u.fullWidth&&(p.classList.remove("tn-static-display-flex-4d51fc62","tn-static-display-flex-8bb39979","tn-static-min-height-800px-997b4c8c"),p.classList.add("tn-static-flex-direction-column-06c8b5ed"),p.classList.remove("tn-static-align-items-baseline-4b95b5c7","tn-static-align-items-center-7c619740"),p.classList.add("tn-static-align-items-flex-start-0486f781"),p.classList.remove("tn-static-display-flex-8bb39979","tn-static-gap-10px-f3d7ce77","tn-static-gap-12px-ed7b3d87","tn-static-gap-6px-f0abc1db","tn-static-gap-8px-33fcd4c3"),p.classList.add("tn-static-gap-0-5rem-ce2fca4d"));let m=p.createSpan("tasknotes-settings__card-config-label");m.textContent=u.label,p.appendChild(u.input)})})}if(e.actions&&e.actions.buttons.length>0){let c=t.createDiv("tasknotes-settings__card-actions");e.draggable&&c.addClass("tasknotes-settings__card-actions--with-drag-handle"),e.actions.buttons.forEach(d=>{let u=c.createEl("button",{text:d.text,cls:"tasknotes-settings__card-action-btn"});if(d.variant&&u.addClass(`tasknotes-settings__card-action-btn--${d.variant}`),d.icon){let p=u.createSpan();(0,jx.setIcon)(p,d.icon),u.insertBefore(p,u.firstChild)}d.disabled&&(u.disabled=!0),u.onclick=()=>{Di(d.onClick)}})}return t}function La(r,e="default"){let t=activeDocument.createElement("span");return t.addClass("tasknotes-settings__card-status-badge"),t.addClass(`tasknotes-settings__card-status-badge--${e}`),t.textContent=r,t}function Al(r,e){return{icon:"trash-2",variant:"delete",tooltip:e||"Delete",onClick:r}}function Ge(r="text",e,t){let n=activeDocument.createElement("input");return n.type=r,n.addClass("tasknotes-settings__card-input"),e&&(n.placeholder=e),t&&(n.value=t),n}function Utt(){if(activeDocument.getElementById(dV))return;let r=activeDocument.createElement("datalist");r.id=dV;for(let e of Npe)r.createEl("option",{value:e});activeDocument.body.appendChild(r)}function cV(r){let e=r==null?void 0:r.trim().match(Btt);if(!e)return null;let t=e[1].toLowerCase();return t.length===3?`#${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`:`#${t}`}function Htt(r){r.dispatchEvent(new Event("input",{bubbles:!0})),r.dispatchEvent(new Event("change",{bubbles:!0}))}function Vtt(r){var a;if(!r.parentElement)return;if((a=r.tasknotesThemeColorPicker)!=null&&a.isConnected){let s=cV(r.value);s&&(r.tasknotesThemeColorPicker.value=s);return}let t=activeDocument.createElement("input");t.type="color",t.addClass($tt),t.value=cV(r.value)||jtt,t.title="Open color picker",t.setAttribute("aria-label","Open color picker");let n=()=>{r.value!==t.value&&(r.value=t.value,Htt(r))},i=()=>{let s=cV(r.value);s&&(t.value=s)};t.addEventListener("input",n),t.addEventListener("change",n),r.addEventListener("input",i),r.addEventListener("change",i),r.insertAdjacentElement("afterend",t),r.tasknotesThemeColorPicker=t}function zh(r){let e=r;r.type="text",r.addClass(ztt),r.placeholder=F_,r.setAttribute("list",dV),r.title=F_,Utt(),Vtt(e)}function ub(r){let e=Ge("text",F_,au(r));return zh(e),e}function pb(r,e){let t=_r(r.value,e);return r.value=au(t),t}function _n(r=!1,e){let t=activeDocument.createElement("div"),n=new jx.Setting(t),i=null;if(n.addToggle(a=>{a.setValue(r),e&&a.onChange(s=>{Di(()=>e(s))}),i=a.toggleEl}),!i)throw new Error("Failed to create card toggle");return i}function ci(r,e){let t=activeDocument.createElement("select");return t.addClass("tasknotes-settings__card-input"),r.forEach(n=>{let i=t.createEl("option",{value:n.value,text:n.label});e===n.value&&(i.selected=!0)}),t}function mb(r,e,t){let n=r.querySelector(".tasknotes-settings__card-drag-handle");if(!n)return;let i=r.getAttribute("data-card-id");i&&(n.addEventListener("dragstart",a=>{a.dataTransfer&&(a.dataTransfer.setData("text/plain",i),r.addClass("tasknotes-settings__card--dragging"))}),n.addEventListener("dragend",()=>{r.removeClass("tasknotes-settings__card--dragging")}),r.addEventListener("dragover",a=>{a.preventDefault();let s=e.querySelector(".tasknotes-settings__card--dragging");if(s&&s!==r){let o=r.getBoundingClientRect(),l=o.top+o.height/2;r.removeClass("tasknotes-settings__card--drag-over-top","tasknotes-settings__card--drag-over-bottom"),a.clientY{r.removeClass("tasknotes-settings__card--drag-over-top","tasknotes-settings__card--drag-over-bottom")}),r.addEventListener("drop",a=>{var l;a.preventDefault(),r.removeClass("tasknotes-settings__card--drag-over-top","tasknotes-settings__card--drag-over-bottom");let s=(l=a.dataTransfer)==null?void 0:l.getData("text/plain");if(!s)return;let o=i;if(s!==o){let c=r.getBoundingClientRect(),d=c.top+c.height/2,u=a.clientY{jx=require("obsidian");fc();Nc();dV="tasknotes-theme-color-options",$tt="tasknotes-theme-color-picker",ztt="tasknotes-theme-color-text-input",jtt="#6366f1",Btt=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i});function mV(r){return r instanceof Error?r.message:typeof r=="string"?r:""}function qtt(r=tm.getAllDailyNotes){try{return r()}catch(e){let t=mV(e),n=t?`: ${t}`:"";throw new Error(`Failed to read daily notes${n}. ${vI}`)}}function Wtt(r){let e=mV(r);return e?`Failed to create timeblock: ${e}`:"Failed to create timeblock. Check console for details."}function Ytt(r){return(0,br.moment)(r)}var br,tm,pV,vI,hb,fV=y(()=>{br=require("obsidian");Ct();zx();No();Ne();fc();ca();Mc();tm=tt(jd());G();pV=I({tag:"Modals/TimeblockCreationModal"}),vI="Check the Daily Notes core plugin settings and make sure the configured daily notes folder exists.";hb=class extends br.Modal{constructor(t,n,i){super(t);this.selectedAttachments=[];this.keyboardHandler=null;this.plugin=n,this.options=i,this.translate=n.i18n.translate.bind(n.i18n)}onOpen(){let{contentEl:t}=this;t.empty(),t.addClass("timeblock-creation-modal"),this.keyboardHandler=l=>{l.key==="Enter"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),this.handleSubmit())},this.containerEl.addEventListener("keydown",this.keyboardHandler),new br.Setting(t).setName(this.translate("modals.timeblockCreation.heading")).setHeading();let n=t.createDiv({cls:"timeblock-date-display"});n.createEl("strong",{text:this.translate("modals.timeblockCreation.dateLabel")});let i=rh(this.options.date);n.createSpan({text:i.toLocaleDateString()}),new br.Setting(t).setName(this.translate("modals.timeblockCreation.titleLabel")).setDesc(this.translate("modals.timeblockCreation.titleDesc")).addText(l=>{this.titleInput=l.inputEl,l.setPlaceholder(this.translate("modals.timeblockCreation.titlePlaceholder")).setValue(this.options.prefilledTitle||"").onChange(()=>this.validateForm()),window.setTimeout(()=>this.titleInput.focus(),100)}),new br.Setting(t).setName(this.translate("modals.timeblockCreation.startTimeLabel")).setDesc(this.translate("modals.timeblockCreation.startTimeDesc")).addText(l=>{this.startTimeInput=l.inputEl,l.setPlaceholder(this.translate("modals.timeblockCreation.startTimePlaceholder")).setValue(this.options.startTime||"").onChange(()=>this.validateForm()),this.startTimeInput.type="time"}),new br.Setting(t).setName(this.translate("modals.timeblockCreation.endTimeLabel")).setDesc(this.translate("modals.timeblockCreation.endTimeDesc")).addText(l=>{this.endTimeInput=l.inputEl,l.setPlaceholder(this.translate("modals.timeblockCreation.endTimePlaceholder")).setValue(this.options.endTime||"").onChange(()=>{this.validateForm()}),this.endTimeInput.type="time"}),new br.Setting(t).setName(this.translate("modals.timeblockCreation.descriptionLabel")).setDesc(this.translate("modals.timeblockCreation.descriptionDesc")).addTextArea(l=>{this.descriptionInput=l.inputEl,l.setPlaceholder(this.translate("modals.timeblockCreation.descriptionPlaceholder")).setValue(""),this.descriptionInput.rows=3}),new br.Setting(t).setName(this.translate("modals.timeblockCreation.colorLabel")).setDesc(this.translate("modals.timeblockCreation.colorDesc")).addText(l=>{this.colorInput=l.inputEl,l.setPlaceholder(this.translate("modals.timeblockCreation.colorPlaceholder")).setValue(au(this.plugin.settings.calendarViewSettings.defaultTimeblockColor)),zh(this.colorInput)}),new br.Setting(t).setName(this.translate("modals.timeblockCreation.attachmentsLabel")).setDesc(this.translate("modals.timeblockCreation.attachmentsDesc")).addButton(l=>{l.setButtonText(this.translate("modals.timeblockCreation.addAttachmentButton")).setTooltip(this.translate("modals.timeblockCreation.addAttachmentTooltip")).onClick(()=>{Qp(this.plugin,c=>{c instanceof br.TAbstractFile&&this.addAttachment(c)},{placeholder:"Search files or type to create new...",filter:"all",sortOrder:this.plugin.settings.calendarViewSettings.timeblockAttachmentSearchOrder})})}).addButton(l=>{l.setButtonText("Add task").setTooltip("Select task").onClick(()=>{this.openTaskSelectorForTitle()})}),this.attachmentsList=t.createDiv({cls:"timeblock-attachments-list"}),this.initializePrefilledAttachments(),this.renderAttachmentsList();let a=t.createDiv({cls:"timeblock-modal-buttons"});a.createEl("button",{text:this.translate("common.cancel")}).addEventListener("click",()=>this.close()),a.createEl("button",{text:this.translate("modals.timeblockCreation.createButton"),cls:"mod-cta timeblock-create-button"}).addEventListener("click",()=>{this.handleSubmit()}),this.validateForm()}validateForm(){var o,l,c;let t=this.contentEl.querySelector(".timeblock-create-button");if(!t)return;let n=(o=this.titleInput)==null?void 0:o.value.trim(),i=(l=this.startTimeInput)==null?void 0:l.value,a=(c=this.endTimeInput)==null?void 0:c.value,s=!!(n&&i&&a);if(s&&i&&a){let[d,u]=i.split(":").map(Number),[p,m]=a.split(":").map(Number),f=d*60+u,h=p*60+m;a==="00:00"&&f>0&&(h=1440),h<=f&&(s=!1)}t.disabled=!s,t.style.opacity=s?"1":"0.5"}initializePrefilledAttachments(){let t=this.options.prefilledAttachmentPaths||[];if(t.length===0)return;let n=new Set(t.filter(i=>typeof i=="string"&&i.trim().length>0));for(let i of n){let a=this.app.vault.getAbstractFileByPath(i);a&&this.selectedAttachments.push(a)}}async handleSubmit(){var t,n;try{let i=this.titleInput.value.trim(),a=this.startTimeInput.value,s=this.endTimeInput.value,o=this.descriptionInput.value.trim(),l=_r(this.colorInput.value,this.plugin.settings.calendarViewSettings.defaultTimeblockColor);if(!i||!a||!s){new br.Notice(this.translate("notices.timeblockRequiredFieldsMissing"));return}let c=this.selectedAttachments.map(p=>`[[${p.path}]]`),d={id:YB(),title:i,startTime:a,endTime:s};o&&(d.description=o),l&&(d.color=l),c.length>0&&(d.attachments=c);let u=await this.saveTimeblockToDailyNote(d);this.plugin.emitter.trigger("data-changed"),(n=(t=this.options).onCreated)==null||n.call(t,{timeblock:d,date:this.options.date,dailyNote:u}),new br.Notice(`Timeblock "${i}" created successfully`),this.close()}catch(i){pV.error("Error creating timeblock:",{category:"internal",operation:"creating-timeblock",error:i}),new br.Notice(Wtt(i))}}async saveTimeblockToDailyNote(t){if(!(0,tm.appHasDailyNotesPluginLoaded)())throw new Error(`Daily Notes core plugin is not enabled. ${vI}`);let n=Ytt(this.options.date),i=qtt(),a=(0,tm.getDailyNote)(n,i);if(!a){try{a=await(0,tm.createDailyNote)(n)}catch(u){let p=mV(u),m=p?`: ${p}`:"";throw new Error(`Failed to create daily note${m}. ${vI}`)}if(!a)throw new Error(`Failed to create daily note. ${vI}`)}let s=await this.app.vault.read(a),o={},l=s;if(s.startsWith("---")){let u=s.indexOf("---",3);if(u!==-1){let p=s.substring(3,u);l=s.substring(u+3);try{o=(0,br.parseYaml)(p)||{}}catch(m){pV.error("Error parsing existing frontmatter:",{category:"validation",operation:"parsing-existing-frontmatter",error:m}),o={}}}}o.timeblocks||(o.timeblocks=[]),o.timeblocks.push(t);let d=`--- +${(0,br.stringifyYaml)(o)}---${l}`;return await Xa(this.app,a,d),a}addAttachment(t){if(this.selectedAttachments.some(n=>n.path===t.path)){new br.Notice(this.translate("notices.timeblockAttachmentExists",{fileName:t.name}));return}if(this.titleInput&&!this.titleInput.value.trim()){let n=t instanceof br.TFile?t.basename:t.name;this.titleInput.value=n,this.validateForm()}this.selectedAttachments.push(t),this.renderAttachmentsList(),new br.Notice(this.translate("notices.timeblockAttachmentAdded",{fileName:t.name}))}async openTaskSelectorForTitle(){var t,n,i;try{let s=((i=await((n=(t=this.plugin.cacheManager).getAllTasks)==null?void 0:n.call(t)))!=null?i:[]).filter(o=>!o.archived);if(s.length===0){new br.Notice("No tasks available to select");return}Pn(this.plugin,s,o=>{if(!o)return;this.titleInput.value=o.title||"",this.validateForm();let l=this.app.vault.getAbstractFileByPath(o.path);l&&this.addAttachment(l)},{title:"Select task"})}catch(a){pV.error("Failed to open task selector for timeblock creation:",{category:"persistence",operation:"open-task-selector-timeblock-creation",error:a}),new br.Notice("Failed to open task selector")}}removeAttachment(t){this.selectedAttachments=this.selectedAttachments.filter(n=>n.path!==t.path),this.renderAttachmentsList(),new br.Notice(this.translate("notices.timeblockAttachmentRemoved",{fileName:t.name}))}renderAttachmentsList(){if(this.attachmentsList.empty(),this.selectedAttachments.length===0){let t=this.attachmentsList.createDiv({cls:"timeblock-attachments-empty"});t.textContent="No attachments added yet";return}this.selectedAttachments.forEach(t=>{let n=this.attachmentsList.createDiv({cls:"timeblock-attachment-item"}),i=n.createDiv({cls:"timeblock-attachment-info"}),a=i.createSpan({cls:"timeblock-attachment-name"});if(a.textContent=t.name,t.path!==t.name){let o=i.createDiv({cls:"timeblock-attachment-path"});o.textContent=t.path}let s=n.createEl("button",{cls:"timeblock-attachment-remove",text:"\xD7"});(0,br.setTooltip)(s,"Remove attachment",{placement:"top"}),s.addEventListener("click",()=>{this.removeAttachment(t)})})}onClose(){this.keyboardHandler&&(this.containerEl.removeEventListener("keydown",this.keyboardHandler),this.keyboardHandler=null);let{contentEl:t}=this;t.empty()}}});var lTe,rm,hV=y(()=>{Br();G();lTe=I({tag:"Services/CalendarExportService"}),rm=class{static generateCalendarURL(e){let{type:t,task:n,useScheduledAsDue:i=!0}=e;switch(t){case"google":return this.generateGoogleCalendarURL(n,i);case"outlook":return this.generateOutlookCalendarURL(n,i);case"yahoo":return this.generateYahooCalendarURL(n,i);case"ics":return this.generateICSDownloadURL(n);default:throw new Error("Unsupported calendar type")}}static generateGoogleCalendarURL(e,t){let n="https://calendar.google.com/calendar/render",i=new URLSearchParams;i.append("action","TEMPLATE"),i.append("text",e.title);let a=this.formatGoogleDates(e,t);a&&i.append("dates",a);let s=this.buildDescription(e);return s&&i.append("details",s),e.contexts&&e.contexts.length>0&&i.append("location",e.contexts.join(", ")),`${n}?${i.toString()}`}static generateOutlookCalendarURL(e,t){let n="https://outlook.live.com/calendar/0/deeplink/compose",i=new URLSearchParams;i.append("subject",e.title);let{startISO:a,endISO:s}=this.getTaskDateRange(e,t);a&&i.append("startdt",a),s&&i.append("enddt",s);let o=this.buildDescription(e);return o&&i.append("body",o),e.contexts&&e.contexts.length>0&&i.append("location",e.contexts.join(", ")),i.append("path","/calendar/action/compose"),i.append("rru","addevent"),`${n}?${i.toString()}`}static generateYahooCalendarURL(e,t){let n="https://calendar.yahoo.com/",i=new URLSearchParams;i.append("v","60"),i.append("title",e.title);let{startYahoo:a,endYahoo:s}=this.getYahooDateFormat(e,t);a&&i.append("st",a),s&&i.append("et",s);let o=this.buildDescription(e);return o&&i.append("desc",o),e.contexts&&e.contexts.length>0&&i.append("in_loc",e.contexts.join(", ")),`${n}?${i.toString()}`}static generateICSDownloadURL(e){let t=this.generateICSContent(e);return`data:text/calendar;charset=utf8,${encodeURIComponent(t)}`}static generateICSContent(e,t){let n=`${e.path.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}@tasknotes`,i=new Date().toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),a=["BEGIN:VCALENDAR","VERSION:2.0","PRODID:-//TaskNotes//Task Export//EN","CALSCALE:GREGORIAN","METHOD:PUBLISH","BEGIN:VEVENT",`UID:${n}`,`DTSTAMP:${i}`];a.push(`SUMMARY:${this.escapeICSText(e.title)}`);let{startLine:s,endLine:o}=this.getICSDateProperties(e,!0,t);s&&a.push(s),o&&a.push(o);let l=this.buildDescription(e,t);if(l&&a.push(`DESCRIPTION:${this.escapeICSText(l)}`),e.contexts&&e.contexts.length>0&&a.push(`LOCATION:${this.escapeICSText(e.contexts.join(", "))}`),e.tags&&e.tags.length>0&&a.push(`CATEGORIES:${e.tags.map(c=>this.escapeICSText(c)).join(",")}`),e.priority){let d={highest:"1",high:"3",medium:"5",low:"7",lowest:"9"}[e.priority]||"5";a.push(`PRIORITY:${d}`)}return e.status&&a.push(`STATUS:${this.getVEventStatus(e.status)}`),a.push("END:VEVENT"),a.push("END:VCALENDAR"),a.join(`\r +`)}static buildDescription(e,t){let n=[],i=[];e.priority&&i.push(`Priority: ${e.priority}`),e.status&&i.push(`Status: ${e.status}`),e.projects&&e.projects.length>0&&i.push(`Projects: ${e.projects.join(", ")}`),e.tags&&e.tags.length>0&&i.push(`Tags: ${e.tags.join(", ")}`),e.contexts&&e.contexts.length>0&&i.push(`Contexts: ${e.contexts.join(", ")}`),e.timeEstimate&&i.push(`Estimated time: ${e.timeEstimate} minutes`),i.length>0&&n.push(...i),n.length>0&&n.push(""),n.push(`Exported from TaskNotes: ${e.path}`);let a=this.buildObsidianOpenUri(e,t);return a&&n.push(`Open in Obsidian: ${a}`),n.join(` +`)}static buildObsidianOpenUri(e,t){return!(t!=null&&t.includeObsidianLink)||!t.vaultName?null:`obsidian://open?vault=${encodeURIComponent(t.vaultName)}&file=${encodeURIComponent(e.path)}`}static formatGoogleDates(e,t){let{startICS:n,endICS:i}=this.getICSDateFormat(e,t);if(!n)return null;if(i)return`${n}/${i}`;let a=this.parseICSDate(n),s=new Date(a.getTime()+3600*1e3),o=this.formatDateToICS(s);return`${n}/${o}`}static getTaskDateRange(e,t,n){let i=null,a=null;if(e.scheduled)try{i=this.parseTaskDate(e.scheduled).toISOString()}catch(s){lTe.warn("Invalid scheduled date:",{category:"provider",operation:"invalid-scheduled-date",details:{value:e.scheduled}})}if(n!=null&&n.useDurationForExport&&i&&e.timeEstimate&&e.timeEstimate>0){let s=new Date(i);a=new Date(s.getTime()+e.timeEstimate*60*1e3).toISOString()}else if(e.due)try{a=this.parseTaskDate(e.due).toISOString()}catch(s){lTe.warn("Invalid due date:",{category:"provider",operation:"invalid-due-date",details:{value:e.due}})}else if(t&&i){let s=new Date(i);a=new Date(s.getTime()+3600*1e3).toISOString()}return{startISO:i,endISO:a}}static getYahooDateFormat(e,t){let{startISO:n,endISO:i}=this.getTaskDateRange(e,t),a=s=>{let o=new Date(s);return P(o,"yyyyMMdd'T'HHmmss")};return{startYahoo:n?a(n):null,endYahoo:i?a(i):null}}static getICSDateFormat(e,t=!0,n){let{startISO:i,endISO:a}=this.getTaskDateRange(e,t,n),s=o=>{let l=new Date(o);return this.formatDateToICS(l)};return{startICS:i?s(i):null,endICS:a?s(a):null}}static getICSDateProperties(e,t=!0,n){if(e.scheduled&&!this.hasTimeComponent(e.scheduled)){let s=e.scheduled,o=this.getAllDayEndDate(e,t,n)||s;return{startLine:`DTSTART;VALUE=DATE:${this.formatDateOnlyToICS(s)}`,endLine:`DTEND;VALUE=DATE:${this.formatDateOnlyToICS(o)}`}}let{startICS:i,endICS:a}=this.getICSDateFormat(e,t,n);return{startLine:i?`DTSTART:${i}`:null,endLine:a?`DTEND:${a}`:null}}static formatDateToICS(e){return e.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,"")}static parseICSDate(e){let t=e.slice(0,4),n=e.slice(4,6),i=e.slice(6,8),a=e.slice(9,11),s=e.slice(11,13),o=e.slice(13,15);return new Date(`${t}-${n}-${i}T${a}:${s}:${o}Z`)}static parseTaskDate(e){let t=e.trim().replace(" ","T");return this.hasTimeComponent(t)?Ls(t):Ls(`${t}T00:00:00`)}static hasTimeComponent(e){return/\d{4}-\d{2}-\d{2}[T\s]\d{2}:\d{2}/.test(e)}static formatDateOnlyToICS(e){return e.split(/[T\s]/)[0].replace(/-/g,"")}static getAllDayEndDate(e,t,n){if(!e.scheduled)return null;let i=e.scheduled;if(n!=null&&n.useDurationForExport&&e.timeEstimate&&e.timeEstimate>0){let a=Math.max(1,Math.ceil(e.timeEstimate/1440));return this.addDaysToDateString(e.scheduled,a)}if(e.due)i=e.due;else if(!t)return null;return this.addDaysToDateString(i,1)}static addDaysToDateString(e,t){let n=Ls(`${e.split(/[T\s]/)[0]}T00:00:00`);return n.setDate(n.getDate()+t),P(n,"yyyy-MM-dd")}static escapeICSText(e){return e.replace(/\\/g,"\\\\").replace(/;/g,"\\;").replace(/,/g,"\\,").replace(/\n/g,"\\n").replace(/\r/g,"")}static foldICSLines(e){let t=e.split(`\r +`),n=[];return t.forEach(i=>{if(i.length<=75)n.push(i);else{let a=i;for(;a.length>75;)n.push(a.substring(0,75)),a=" "+a.substring(75);a.length>0&&n.push(a)}}),n.join(`\r +`)}static generateMultipleTasksICSContent(e,t){let n=new Date().toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),i=this.filterTasksForExport(e,t),a=["BEGIN:VCALENDAR","VERSION:2.0","PRODID:-//TaskNotes//EN","CALSCALE:GREGORIAN"];return i.forEach((s,o)=>{let l=`${s.path.replace(/[^a-zA-Z0-9]/g,"-")}-${o}-${Date.now()}@tasknotes`;a.push("BEGIN:VEVENT"),a.push(`UID:${l}`),a.push(`DTSTAMP:${n}`),a.push(`SUMMARY:${this.escapeICSText(s.title)}`);let{startLine:c,endLine:d}=this.getICSDateProperties(s,!0,t);if(c){if(!d){let p=c.split(":",2)[1];if(c.includes("VALUE=DATE")){let m=Ls(`${p.slice(0,4)}-${p.slice(4,6)}-${p.slice(6,8)}T00:00:00`);m.setDate(m.getDate()+1),d=`DTEND;VALUE=DATE:${P(m,"yyyyMMdd")}`}else{let m=this.parseICSDate(p),f=new Date(m.getTime()+3600*1e3);d=`DTEND:${this.formatDateToICS(f)}`}}}else{let p;if(s.dateCreated?p=new Date(s.dateCreated):p=new Date,c=`DTSTART:${this.formatDateToICS(p)}`,!d){let f=new Date(p.getTime()+36e5);d=`DTEND:${this.formatDateToICS(f)}`}}a.push(c),a.push(d);let u=this.buildDescription(s,t);if(u&&a.push(`DESCRIPTION:${this.escapeICSText(u)}`),s.contexts&&s.contexts.length>0&&a.push(`LOCATION:${this.escapeICSText(s.contexts.join(", "))}`),s.tags&&s.tags.length>0&&a.push(`CATEGORIES:${s.tags.map(p=>this.escapeICSText(p)).join(",")}`),s.priority){let m={highest:"1",high:"3",medium:"5",low:"7",lowest:"9"}[s.priority]||"5";a.push(`PRIORITY:${m}`)}s.status&&a.push(`STATUS:${this.getVEventStatus(s.status)}`),a.push("END:VEVENT")}),a.push("END:VCALENDAR"),this.foldICSLines(a.join(`\r +`))}static filterTasksForExport(e,t){var i;if(!(t!=null&&t.excludeArchived)&&!(t!=null&&t.excludeCompleted)&&!(t!=null&&t.requireDueDate)&&!(t!=null&&t.requireScheduledDate))return e;let n=new Set((i=t.completedStatuses)!=null&&i.length?t.completedStatuses:["done"]);return e.filter(a=>!(t.excludeArchived&&a.archived||t.excludeCompleted&&n.has(a.status)||t.requireDueDate&&!a.due||t.requireScheduledDate&&!a.scheduled))}static getVEventStatus(e){let t=e.trim().toLowerCase();return t==="cancelled"||t==="canceled"?"CANCELLED":t==="tentative"?"TENTATIVE":"CONFIRMED"}static createMultipleTasksICSDownload(e,t){if(!e||e.length===0)return null;let n=this.filterTasksForExport(e,t);if(n.length===0)return null;let i=new Date().toISOString().split("T")[0];return{content:this.generateMultipleTasksICSContent(n,t),filename:`tasknotes-all-tasks-${i}.ics`,taskCount:n.length}}static createTaskICSDownload(e,t){return{content:this.generateICSContent(e,t),filename:`${e.title.replace(/[^a-zA-Z0-9]/g,"-")}.ics`,taskCount:1}}}});function Qe(r,e){return e===void 0?new gV.Notice(r):new gV.Notice(r,e)}var gV,Eu=y(()=>{gV=require("obsidian")});var dTe={};et(dTe,{downloadAllTasksICSFile:()=>Gtt,downloadTaskICSFile:()=>vV,openCalendarURL:()=>Bx});function gb(r,e,t,n){return r?r(e,n):t}function cTe(r){let e=new Blob([r.content],{type:"text/calendar"}),t=URL.createObjectURL(e);try{let n=activeDocument.createElement("a");n.href=t,n.download=r.filename,n.click()}finally{URL.revokeObjectURL(t)}}function Bx(r,e){try{let t=rm.generateCalendarURL(r);window.open(t,"_blank")}catch(t){yV.error("Failed to generate calendar URL:",{category:"provider",operation:"generate-calendar-url",error:t}),Qe(gb(e,"services.calendarExport.notices.generateLinkFailed","Failed to generate calendar link"))}}function Gtt(r,e,t){try{let n=rm.createMultipleTasksICSDownload(r,t);if(!n){Qe(gb(e,"services.calendarExport.notices.noTasksToExport","No tasks found to export"));return}cTe(n);let i=n.taskCount===1?"":"s";Qe(gb(e,"services.calendarExport.notices.downloadSuccess",`Downloaded ${n.filename} with ${n.taskCount} task${i}`,{filename:n.filename,count:n.taskCount,plural:i}))}catch(n){yV.error("Failed to download all tasks ICS file:",{category:"provider",operation:"download-all-tasks-ics-file",error:n}),Qe(gb(e,"services.calendarExport.notices.downloadFailed","Failed to download calendar file"))}}function vV(r,e,t){try{let n=rm.createTaskICSDownload(r,t);cTe(n),Qe(gb(e,"services.calendarExport.notices.singleDownloadSuccess",`Downloaded ${n.filename}`,{filename:n.filename}))}catch(n){yV.error("Failed to download ICS file:",{category:"provider",operation:"download-ics-file",error:n}),Qe(gb(e,"services.calendarExport.notices.downloadFailed","Failed to download calendar file"))}}var yV,bV=y(()=>{hV();G();Eu();yV=I({tag:"UI/CalendarExportActions"})});async function pTe(r){let{plugin:e,path:t,openInNewLeaf:n=!1}=r,i=e.app.vault.getAbstractFileByPath(t);if(i instanceof jh.TFile){await e.app.workspace.getLeaf(n).openFile(i);return}await e.app.workspace.openLinkText(t,"",n)}async function yb(r){let{plugin:e,parentTask:t,targetDate:n,openInNewLeaf:i=!1,onUpdate:a}=r,s=ce(n);try{let o=await e.taskService.findMaterializedOccurrence(t,n),l=await e.taskService.materializeOccurrence(t,n);return await pTe({plugin:e,path:l.path,openInNewLeaf:i}),a==null||a(),new jh.Notice(o?`Opened occurrence note for ${s}`:`Created occurrence note for ${s}`),l}catch(o){let l=o instanceof Error?o.message:String(o);return uTe.error("Error opening or creating occurrence note:",{category:"persistence",operation:"open-or-create-occurrence-note",details:{taskPath:t.path,targetDate:s},error:l}),new jh.Notice(`Failed to open occurrence note: ${l}`),null}}async function bI(r){let{plugin:e,occurrenceTask:t,openInNewLeaf:n=!1}=r;try{let i=await e.taskService.getMaterializedOccurrenceParent(t);return i?(await pTe({plugin:e,path:i.path,openInNewLeaf:n}),i):(new jh.Notice("Recurring parent not found"),null)}catch(i){let a=i instanceof Error?i.message:String(i);return uTe.error("Error opening materialized occurrence parent:",{category:"persistence",operation:"open-materialized-occurrence-parent",details:{taskPath:t.path,occurrenceDate:t.occurrence_date},error:a}),new jh.Notice(`Failed to open recurring parent: ${a}`),null}}var jh,uTe,TI=y(()=>{jh=require("obsidian");Ne();G();uTe=I({tag:"UI/OccurrenceNoteActions"})});function kI(r){return r.trim()}function Ux(r){let e=new Set,t=[];for(let n of r!=null?r:[]){if(typeof n!="string")continue;let i=kI(n);!i||e.has(i)||(e.add(i),t.push(i))}return t}function fTe(r,e){let t=kI(e),n=Ux(r);return t?n.includes(t)?n:[...n,t]:n.length>0?n:void 0}function Ktt(r,e){let t=kI(e),n=Ux(r).filter(i=>i!==t);return n.length>0?n:void 0}function Ztt(r,e){let t=kI(e),n=Ux(r);return t?n.includes(t)?Ktt(n,t):fTe(n,t):n.length>0?n:void 0}function Fi(r){return r.setSubmenu()}function mTe(r){var t,n;let e=r;return(n=(t=e.dom)!=null?t:e.domEl)!=null?n:null}function vb(r,e=""){let n=(typeof r=="string"||typeof r=="number"||typeof r=="boolean"||typeof r=="bigint"?String(r):"").trim();return n.length>0?n:e}var Oe,Er,nm,wI=y(()=>{Oe=require("obsidian");Ne();sb();nV();Mc();Cl();Nh();ab();mH();Tx();No();iS();ko();jn();du();oTe();fV();hH();bV();TI();G();Er=I({tag:"Components/TaskContextMenu"});nm=class r{constructor(e,t=new ki){this.targetDoc=activeDocument;this.menu=t,this.options=e,this.buildMenu()}static addToMenu(e,t){new r(t,e)}t(e,t){return this.options.plugin.i18n.translate(e,t)}buildMenu(){let{task:e,plugin:t}=this.options,n=this.addPromotedOccurrenceControls(e,t);this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.status")),i.setIcon("circle");let a=Fi(i);this.addStatusOptions(a,e,t)}),this.menu.addSeparator(),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.priority")),i.setIcon("star");let a=Fi(i);this.addPriorityOptions(a,e,t)}),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.tags")),i.setIcon("tags");let a=Fi(i);this.addTagOptions(a,e,t)}),this.menu.addSeparator(),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.dueDate")),i.setIcon("calendar");let a=Fi(i);this.addDateOptions(a,e.due,async s=>{var o,l;try{await t.updateTaskProperty(e,"due",s||void 0),(l=(o=this.options).onUpdate)==null||l.call(o)}catch(c){let d=c instanceof Error?c.message:String(c);Er.error("Error updating task due date:",{category:"validation",operation:"updating-task-due-date",details:{taskPath:e.path},error:d}),new Oe.Notice(this.t("contextMenus.task.notices.updateDueDateFailure",{message:d}))}},()=>{t.openDueDateModal(e)})}),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.scheduledDate")),i.setIcon("calendar-clock");let a=Fi(i);this.addDateOptions(a,e.scheduled,async s=>{var o,l;try{await t.updateTaskProperty(e,"scheduled",s||void 0),(l=(o=this.options).onUpdate)==null||l.call(o)}catch(c){let d=c instanceof Error?c.message:String(c);Er.error("Error updating task scheduled date:",{category:"validation",operation:"updating-task-scheduled-date",details:{taskPath:e.path},error:d}),new Oe.Notice(this.t("contextMenus.task.notices.updateScheduledFailure",{message:d}))}},()=>{t.openScheduledDateModal(e)})}),e.recurrence&&this.addRecurringInstanceMenuItems(e,t),!n&&e.recurrence_parent&&e.occurrence_date&&this.addMaterializedOccurrenceMenuItems(e,t),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.reminders")),i.setIcon("bell");let a=Fi(i);this.addQuickRemindersSection(a,e,t,"due",this.t("contextMenus.task.remindBeforeDue")),this.addQuickRemindersSection(a,e,t,"scheduled",this.t("contextMenus.task.remindBeforeScheduled")),a.addSeparator(),a.addItem(s=>{s.setTitle(this.t("contextMenus.task.manageReminders")),s.setIcon("settings"),s.onClick(()=>{new _l(t.app,t,e,l=>{(async()=>{var c,d;try{await t.updateTaskProperty(e,"reminders",l.length>0?l:void 0),(d=(c=this.options).onUpdate)==null||d.call(c)}catch(u){Er.error("Error updating reminders:",{category:"persistence",operation:"updating-reminders",error:u}),new Oe.Notice(this.t("contextMenus.task.notices.updateRemindersFailure"))}})()}).open()})}),e.reminders&&e.reminders.length>0&&a.addItem(s=>{s.setTitle(this.t("contextMenus.task.clearReminders")),s.setIcon("trash"),s.onClick(async()=>{var o,l;try{await t.updateTaskProperty(e,"reminders",void 0),(l=(o=this.options).onUpdate)==null||l.call(o)}catch(c){Er.error("Error clearing reminders:",{category:"persistence",operation:"clearing-reminders",error:c}),new Oe.Notice(this.t("contextMenus.task.notices.clearRemindersFailure"))}})})}),this.menu.addSeparator(),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.dependencies.title")),i.setIcon("git-branch");let a=Fi(i);this.addDependencyMenuItems(a,e,t)}),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.organization.title")),i.setIcon("folder-tree");let a=Fi(i);this.addOrganizationMenuItems(a,e,t)}),this.menu.addSeparator(),this.menu.addItem(i=>{let a=t.getActiveTimeSession(e);i.setTitle(a?this.t("contextMenus.task.stopTimeTracking"):this.t("contextMenus.task.startTimeTracking")),i.setIcon(a?"pause":"play"),i.onClick(async()=>{var o,l;t.getActiveTimeSession(e)?await t.stopTimeTracking(e):await t.startTimeTracking(e),(l=(o=this.options).onUpdate)==null||l.call(o)})}),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.editTimeEntries")),i.setIcon("clock"),i.onClick(()=>{t.openTimeEntryEditor(e)})}),t.settings.calendarViewSettings.enableTimeblocking&&this.menu.addItem(i=>{i.setTitle("Create timeblock"),i.setIcon("calendar-plus"),i.onClick(()=>{let a=sTe(e,this.options.targetDate);new hb(t.app,t,{date:a.date,startTime:a.startTime,endTime:a.endTime,prefilledTitle:e.title,prefilledAttachmentPaths:[e.path]}).open()})}),this.menu.addItem(i=>{i.setTitle(e.archived?this.t("contextMenus.task.unarchive"):this.t("contextMenus.task.archive")),i.setIcon(e.archived?"archive-restore":"archive"),i.onClick(async()=>{var a,s;try{await t.toggleTaskArchive(e),(s=(a=this.options).onUpdate)==null||s.call(a)}catch(o){let l=o instanceof Error?o.message:String(o);Er.error("Error toggling task archive:",{category:"persistence",operation:"toggling-task-archive",details:{taskPath:e.path},error:l}),new Oe.Notice(this.t("contextMenus.task.notices.archiveFailure",{message:l}))}})}),this.menu.addSeparator(),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.openNote")),i.setIcon("file-text"),i.onClick(()=>{let a=t.app.vault.getAbstractFileByPath(e.path);a instanceof Oe.TFile&&t.app.workspace.getLeaf(!1).openFile(a)})}),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.openNoteInNewTab")),i.setIcon("external-link"),i.onClick(()=>{t.app.vault.getAbstractFileByPath(e.path)instanceof Oe.TFile&&t.app.workspace.openLinkText(e.path,"",!0)})}),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.copyTitle")),i.setIcon("copy"),i.onClick(async()=>{try{await navigator.clipboard.writeText(e.title),new Oe.Notice(this.t("contextMenus.task.notices.copyTitleSuccess"))}catch(a){new Oe.Notice(this.t("contextMenus.task.notices.copyFailure"))}})}),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.noteActions")),i.setIcon("file-text");let a=Fi(i),s=t.app.vault.getAbstractFileByPath(e.path);if(s instanceof Oe.TFile){try{t.app.workspace.trigger("file-menu",a,s,"tasknotes-context-menu")}catch(o){Er.debug("Native file menu not available, using fallback",{category:"stale-data",operation:"native-file-menu-not-using-fallback"})}a.addItem(o=>{o.setTitle(this.t("contextMenus.task.rename")),o.setIcon("pencil"),o.onClick(async()=>{try{let l=s.basename,c=await Jv(t.app,{title:this.t("contextMenus.task.renameTitle"),placeholder:this.t("contextMenus.task.renamePlaceholder"),initialValue:l});if(c&&c.trim()!==""&&c!==l){let d=s.extension,u=c.endsWith(`.${d}`)?c:`${c}.${d}`,p=s.parent?`${s.parent.path}/${u}`:u;await VB(t.app,s,p),new Oe.Notice(this.t("contextMenus.task.notices.renameSuccess",{name:u})),this.options.onUpdate&&this.options.onUpdate()}}catch(l){Er.error("Error renaming file:",{category:"persistence",operation:"renaming-file",error:l}),new Oe.Notice(this.t("contextMenus.task.notices.renameFailure"))}})}),a.addItem(o=>{o.setTitle(this.t("contextMenus.task.delete")),o.setIcon("trash"),o.onClick(async()=>{if(await bn(t.app,{title:this.t("contextMenus.task.deleteTitle"),message:this.t("contextMenus.task.deleteMessage",{name:s.name}),confirmText:this.t("contextMenus.task.deleteConfirm"),cancelText:this.t("common.cancel"),isDestructive:!0}))try{await t.taskService.deleteTask(e),this.options.onUpdate&&this.options.onUpdate()}catch(c){let d=c instanceof Error?c.message:String(c);Er.error("Error deleting task:",{category:"persistence",operation:"deleting-task",error:c}),new Oe.Notice(`Failed to delete task: ${d}`)}})}),a.addSeparator(),a.addItem(o=>{o.setTitle(this.t("contextMenus.task.copyPath")),o.setIcon("copy"),o.onClick(()=>{navigator.clipboard.writeText(s.path).then(()=>{new Oe.Notice(this.t("contextMenus.task.notices.copyPathSuccess"))}).catch(()=>{new Oe.Notice(this.t("contextMenus.task.notices.copyFailure"))})})}),a.addItem(o=>{o.setTitle(this.t("contextMenus.task.copyUrl")),o.setIcon("link"),o.onClick(()=>{let l=`obsidian://open?vault=${encodeURIComponent(t.app.vault.getName())}&file=${encodeURIComponent(s.path)}`;navigator.clipboard.writeText(l).then(()=>{new Oe.Notice(this.t("contextMenus.task.notices.copyUrlSuccess"))}).catch(()=>{new Oe.Notice(this.t("contextMenus.task.notices.copyFailure"))})})}),a.addSeparator(),a.addItem(o=>{o.setTitle(this.t("contextMenus.task.showInExplorer")),o.setIcon("folder-open"),o.onClick(()=>{t.app.workspace.getLeaf().setViewState({type:"file-explorer",state:{}}).then(()=>{let l=t.app.workspace.getLeavesOfType("file-explorer")[0];l!=null&&l.view&&"revealInFolder"in l.view&&l.view.revealInFolder(s)}).catch(l=>{Er.warn("Failed to reveal task in file explorer:",{category:"persistence",operation:"reveal-task-file-explorer",error:l})})})})}}),this.menu.addSeparator(),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.addToCalendar")),i.setIcon("calendar-plus");let a=Fi(i);a.addItem(s=>{s.setTitle(this.t("contextMenus.task.calendar.google")),s.setIcon("external-link"),s.onClick(()=>{Bx({type:"google",task:e,useScheduledAsDue:!0},this.t.bind(this))})}),a.addItem(s=>{s.setTitle(this.t("contextMenus.task.calendar.outlook")),s.setIcon("external-link"),s.onClick(()=>{Bx({type:"outlook",task:e,useScheduledAsDue:!0},this.t.bind(this))})}),a.addItem(s=>{s.setTitle(this.t("contextMenus.task.calendar.yahoo")),s.setIcon("external-link"),s.onClick(()=>{Bx({type:"yahoo",task:e,useScheduledAsDue:!0},this.t.bind(this))})}),a.addSeparator(),a.addItem(s=>{s.setTitle(this.t("contextMenus.task.calendar.downloadIcs")),s.setIcon("download"),s.onClick(()=>{vV(e,this.t.bind(this),{includeObsidianLink:!0,vaultName:t.app.vault.getName()})})}),a.addSeparator(),a.addItem(s=>{s.setTitle(this.t("contextMenus.task.calendar.syncToGoogle")),s.setIcon("refresh-cw"),s.onClick(async()=>{var o,l,c;if(!((o=t.taskCalendarSyncService)!=null&&o.isEnabled())){new Oe.Notice(this.t("contextMenus.task.calendar.syncToGoogleNotConfigured"));return}try{await t.taskCalendarSyncService.syncTaskToCalendar(e),new Oe.Notice(this.t("contextMenus.task.calendar.syncToGoogleSuccess")),(c=(l=this.options).onUpdate)==null||c.call(l)}catch(d){Er.error("Failed to sync task to Google Calendar:",{category:"provider",operation:"sync-task-google-calendar",error:d}),new Oe.Notice(this.t("contextMenus.task.calendar.syncToGoogleFailed"))}})})}),this.menu.addSeparator(),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.recurrence")),i.setIcon("refresh-ccw");let a=Fi(i),s=typeof e.recurrence=="string"?e.recurrence:void 0;this.addRecurrenceOptions(a,s,async o=>{var l,c;try{await t.updateTaskProperty(e,"recurrence",o||void 0),(c=(l=this.options).onUpdate)==null||c.call(l)}catch(d){let u=d instanceof Error?d.message:String(d);Er.error("Error updating task recurrence:",{category:"persistence",operation:"updating-task-recurrence",details:{taskPath:e.path},error:u}),new Oe.Notice(this.t("contextMenus.task.notices.updateRecurrenceFailure",{message:u}))}},t),s&&this.addOccurrencePolicyOptions(a,e,t)}),this.menu.addSeparator(),this.menu.addItem(i=>{i.setTitle(this.t("contextMenus.task.createSubtask")),i.setIcon("plus"),i.onClick(()=>{let a=t.app.vault.getAbstractFileByPath(e.path);a instanceof Oe.TFile&&t.openTaskCreationModal({...tTe(t,e,a)})})}),this.addMobileDismissOption(),window.setTimeout(()=>{this.updateMainMenuIconColors(e,t)},10)}addMobileDismissOption(){Oe.Platform.isMobile&&(this.menu.addSeparator(),this.menu.addItem(e=>{e.setTitle(this.t("common.close")),e.setIcon("x"),e.onClick(()=>{this.menu.hide()})}))}addRecurringInstanceMenuItems(e,t){var s,o;let n=ce(this.options.targetDate),i=((s=e.complete_instances)==null?void 0:s.includes(n))||!1;this.menu.addItem(l=>{l.setTitle(i?this.t("contextMenus.task.markIncomplete"):this.t("contextMenus.task.markComplete")),l.setIcon(i?"x":"check"),l.onClick(async()=>{var c,d;try{await t.toggleRecurringTaskComplete(e,this.options.targetDate),(d=(c=this.options).onUpdate)==null||d.call(c)}catch(u){let p=u instanceof Error?u.message:String(u);Er.error("Error toggling recurring task completion:",{category:"persistence",operation:"toggling-recurring-task-completion",details:{taskPath:e.path},error:p}),new Oe.Notice(this.t("contextMenus.task.notices.toggleCompletionFailure",{message:p}))}})});let a=((o=e.skipped_instances)==null?void 0:o.includes(n))||!1;this.menu.addItem(l=>{l.setTitle(a?this.t("contextMenus.task.unskipInstance"):this.t("contextMenus.task.skipInstance")),l.setIcon(a?"undo":"x-circle"),l.onClick(async()=>{var c,d;try{await t.taskService.toggleRecurringTaskSkipped(e,this.options.targetDate),(d=(c=this.options).onUpdate)==null||d.call(c)}catch(u){let p=u instanceof Error?u.message:String(u);Er.error("Error toggling recurring task skip:",{category:"persistence",operation:"toggling-recurring-task-skip",details:{taskPath:e.path},error:p}),new Oe.Notice(this.t("contextMenus.task.notices.toggleSkipFailure",{message:p}))}})}),this.options.promoteOccurrenceControls||this.addOccurrenceNoteMenuItem(e,t)}addPromotedOccurrenceControls(e,t){if(!this.options.promoteOccurrenceControls)return!1;let n=!1;return e.recurrence&&(this.addOccurrenceNoteMenuItem(e,t),n=!0),e.recurrence_parent&&e.occurrence_date&&(this.addMaterializedOccurrenceMenuItems(e,t),n=!0),n&&this.menu.addSeparator(),n}addOccurrenceNoteMenuItem(e,t){this.menu.addItem(n=>{n.setTitle("Open or create occurrence note"),n.setIcon("file-plus"),n.onClick(async()=>{await yb({plugin:t,parentTask:e,targetDate:this.options.targetDate,onUpdate:this.options.onUpdate})})})}addMaterializedOccurrenceMenuItems(e,t){this.menu.addItem(a=>{a.setTitle("Open recurring parent"),a.setIcon("refresh-ccw"),a.onClick(async()=>{await bI({plugin:t,occurrenceTask:e})})});let n=this.getSkippedStatusValue(t),i=this.isSkippedMaterializedOccurrence(e,t);!n&&!i||this.menu.addItem(a=>{a.setTitle(i?"Unskip occurrence":"Skip occurrence"),a.setIcon(i?"undo":"x-circle"),a.onClick(async()=>{var s,o;try{let l=i?await t.taskService.unskipMaterializedOccurrence(e):await t.taskService.skipMaterializedOccurrence(e,n);Object.assign(e,l),(o=(s=this.options).onUpdate)==null||o.call(s)}catch(l){let c=l instanceof Error?l.message:String(l);Er.error("Error updating materialized occurrence skip state:",{category:"persistence",operation:"updating-materialized-occurrence-skip-state",details:{taskPath:e.path,occurrenceDate:e.occurrence_date},error:c}),new Oe.Notice(`Failed to update occurrence: ${c}`)}})})}getSkippedStatusValue(e){var t,n;return(n=(t=e.settings.customStatuses)==null?void 0:t.find(i=>i.isSkipped))==null?void 0:n.value}isSkippedMaterializedOccurrence(e,t){var n;return((n=t.settings.customStatuses)==null?void 0:n.some(i=>i.isSkipped&&i.value===e.status))===!0}addDependencyMenuItems(e,t,n){var s,o;e.addItem(l=>{l.setTitle(this.t("contextMenus.task.dependencies.addBlockedBy")),l.setIcon("link-2"),l.onClick(()=>{this.menu.hide(),this.openBlockedBySelector(t,n)})});let i=(s=t.blockedBy)!=null?s:[];i.length>0&&e.addItem(l=>{l.setTitle(this.t("contextMenus.task.dependencies.removeBlockedBy")),l.setIcon("unlink");let c=Fi(l);i.forEach((d,u)=>{c.addItem(p=>{let m=vb(e2(d),this.t("contextMenus.task.dependencies.unknownDependency"));p.setTitle(m),p.onClick(async()=>{var f,h;try{let g=i.filter((k,b)=>b!==u),v=await n.updateTaskProperty(t,"blockedBy",g.length>0?g:void 0);Object.assign(t,v),new Oe.Notice(this.t("contextMenus.task.dependencies.notices.blockedByRemoved")),(h=(f=this.options).onUpdate)==null||h.call(f)}catch(g){Er.error("Failed to remove blocked-by dependency:",{category:"persistence",operation:"remove-blocked-by-dependency",error:g}),new Oe.Notice(this.t("contextMenus.task.dependencies.notices.updateFailed"))}})})})}),e.addSeparator(),e.addItem(l=>{l.setTitle(this.t("contextMenus.task.dependencies.addBlocking")),l.setIcon("git-branch-plus"),l.onClick(()=>{this.menu.hide(),this.openBlockingSelector(t,n)})});let a=(o=t.blocking)!=null?o:[];a.length>0&&e.addItem(l=>{l.setTitle(this.t("contextMenus.task.dependencies.removeBlocking")),l.setIcon("git-branch-minus");let c=Fi(l);a.forEach(d=>{let u=n.app.vault.getAbstractFileByPath(d),p=u instanceof Oe.TFile?n.app.metadataCache.fileToLinktext(u,t.path,!1):d.split("/").pop()||d;c.addItem(m=>{m.setTitle(p),m.onClick(async()=>{var f,h;try{await n.taskService.updateBlockingRelationships(t,[],[d],{});let g=await n.cacheManager.getTaskInfo(t.path);g&&Object.assign(t,g),new Oe.Notice(this.t("contextMenus.task.dependencies.notices.blockingRemoved")),(h=(f=this.options).onUpdate)==null||h.call(f)}catch(g){Er.error("Failed to remove blocking dependency:",{category:"persistence",operation:"remove-blocking-dependency",error:g}),new Oe.Notice(this.t("contextMenus.task.dependencies.notices.updateFailed"))}})})})})}dedupeDependencyEntries(e){let t=new Map;for(let n of e){let i=ts(n);if(!i)continue;let a=this.getDependencyKey(i);t.has(a)||t.set(a,i)}return Array.from(t.values())}async openBlockedBySelector(e,t){let n=new Set((Array.isArray(e.blockedBy)?e.blockedBy:[]).map(i=>i.uid));await this.openTaskDependencySelector(t,i=>{if(i.path===e.path)return!1;let a=To(t.app,e.path,i.path,t.settings.useFrontmatterMarkdownLinks);return!n.has(a)},async i=>{await this.handleBlockedBySelection(e,t,i)})}async openBlockingSelector(e,t){var i;let n=new Set((i=e.blocking)!=null?i:[]);await this.openTaskDependencySelector(t,a=>a.path===e.path?!1:!n.has(a.path),async a=>{await this.handleBlockingSelection(e,t,a)})}async openTaskDependencySelector(e,t,n){try{let a=(await e.cacheManager.getAllTasks()).filter(t);if(a.length===0){new Oe.Notice(this.t("contextMenus.task.dependencies.notices.noEligibleTasks"));return}Pn(e,a,s=>{s&&n(s)})}catch(i){Er.error("Failed to open task selector for dependencies:",{category:"persistence",operation:"open-task-selector-dependencies",error:i}),new Oe.Notice(this.t("contextMenus.task.dependencies.notices.updateFailed"))}}async handleBlockedBySelection(e,t,n){var i,a;if(n.path!==e.path)try{let s={uid:To(t.app,e.path,n.path,t.settings.useFrontmatterMarkdownLinks),reltype:es},o=Array.isArray(e.blockedBy)?e.blockedBy:[],l=this.dedupeDependencyEntries([...o,s]);if(l.length===o.length)return;let c=await t.updateTaskProperty(e,"blockedBy",l);Object.assign(e,c),new Oe.Notice(this.t("contextMenus.task.dependencies.notices.blockedByAdded",{count:1})),(a=(i=this.options).onUpdate)==null||a.call(i)}catch(s){Er.error("Failed to add blocked-by dependency via selector:",{category:"persistence",operation:"add-blocked-by-dependency-via-selector",error:s}),new Oe.Notice(this.t("contextMenus.task.dependencies.notices.updateFailed"))}}async handleBlockingSelection(e,t,n){var a,s,o;let i=n.path;if(i!==e.path&&!((a=e.blocking)!=null&&a.includes(i)))try{let l={uid:To(t.app,i,e.path,t.settings.useFrontmatterMarkdownLinks),reltype:es};await t.taskService.updateBlockingRelationships(e,[i],[],{[i]:l});let c=await t.cacheManager.getTaskInfo(e.path);c?Object.assign(e,c):Array.isArray(e.blocking)?e.blocking=Array.from(new Set([...e.blocking,i])):e.blocking=[i],new Oe.Notice(this.t("contextMenus.task.dependencies.notices.blockingAdded",{count:1})),(o=(s=this.options).onUpdate)==null||o.call(s)}catch(l){Er.error("Failed to add blocking dependency via selector:",{category:"persistence",operation:"add-blocking-dependency-via-selector",error:l}),new Oe.Notice(this.t("contextMenus.task.dependencies.notices.updateFailed"))}}getDependencyKey(e){var t;return`${e.uid}::${e.reltype}::${(t=e.gap)!=null?t:""}`}addOrganizationMenuItems(e,t,n){e.addItem(i=>{i.setTitle(this.t("contextMenus.task.organization.contexts")),i.setIcon("at-sign");let a=Fi(i);this.addContextMenuItems(a,t,n)}),e.addSeparator(),e.addItem(i=>{i.setTitle(this.t("contextMenus.task.organization.addToProject")),i.setIcon("folder-plus"),i.onClick(()=>{this.menu.hide(),this.openProjectSelector(t,n)})}),e.addItem(i=>{i.setTitle(this.t("contextMenus.task.organization.addSubtasks")),i.setIcon("indent"),i.onClick(()=>{this.menu.hide(),this.openSubtaskAssignmentSelector(t,n)})})}addContextMenuItems(e,t,n){let i=Ux(t.contexts),a=this.getContextOptions(t,n);if(e.addItem(s=>{s.setTitle(this.t("contextMenus.task.organization.addContext")),s.setIcon("plus"),s.onClick(()=>{this.menu.hide(),this.openContextInput(t,n)})}),a.length>0){e.addSeparator();for(let s of a)e.addItem(o=>{let l=i.includes(s);o.setTitle(l?this.t("contextMenus.task.organization.contextSelected",{context:s}):s),o.setIcon(l?"check":"at-sign"),o.onClick(async()=>{await this.updateTaskContexts(t,n,Ztt(t.contexts,s))})})}i.length>0&&(e.addSeparator(),e.addItem(s=>{s.setTitle(this.t("contextMenus.task.organization.clearContexts")),s.setIcon("x"),s.onClick(async()=>{await this.updateTaskContexts(t,n,void 0)})}))}getContextOptions(e,t){var a,s,o,l;let n=(o=(s=(a=t.cacheManager).getAllContexts)==null?void 0:s.call(a))!=null?o:[];return Ux([...n,...(l=e.contexts)!=null?l:[]]).sort((c,d)=>c.localeCompare(d))}async openContextInput(e,t){let n=await Jv(t.app,{title:this.t("contextMenus.task.organization.addContext"),placeholder:this.t("contextMenus.task.organization.contextPlaceholder"),confirmText:this.t("common.confirm"),cancelText:this.t("common.cancel")});n&&await this.updateTaskContexts(e,t,fTe(e.contexts,n))}async updateTaskContexts(e,t,n){var i,a;try{let s=await t.updateTaskProperty(e,"contexts",n);Object.assign(e,s),(a=(i=this.options).onUpdate)==null||a.call(i)}catch(s){Er.error("Failed to update task contexts:",{category:"validation",operation:"update-task-contexts",error:s}),new Oe.Notice(this.t("contextMenus.task.organization.notices.updateContextsFailed"))}}addTagOptions(e,t,n){let i=Jve(t,n.settings);if(e.addItem(a=>{a.setTitle(this.t("contextMenus.task.addTag")),a.setIcon("plus"),a.onClick(()=>{this.menu.hide(),this.openTagInput(t,n,"add")})}),i.length>0){e.addSeparator();for(let a of i)e.addItem(s=>{s.setTitle(this.t("contextMenus.task.removeTag",{tag:`#${a}`})),s.setIcon("x"),s.onClick(async()=>{await this.updateTaskTags(t,n,wx(t.tags,[a]))})});e.addSeparator(),e.addItem(a=>{a.setTitle(this.t("contextMenus.task.clearTags")),a.setIcon("eraser"),a.onClick(async()=>{await this.updateTaskTags(t,n,ZA(t.tags,n.settings))})})}}async openTagInput(e,t,n){let i=await Jv(t.app,{title:n==="add"?this.t("contextMenus.task.addTag"):this.t("contextMenus.task.removeTagInput"),placeholder:this.t("contextMenus.task.tagPlaceholder"),confirmText:this.t("common.confirm"),cancelText:this.t("common.cancel"),onInputReady:o=>{new Wp(t.app,o,t)}}),a=kx(i);if(a.length===0)return;let s=n==="add"?KA(e.tags,a):wx(e.tags,a);await this.updateTaskTags(e,t,s)}async updateTaskTags(e,t,n){var i,a;try{let s=await t.updateTaskProperty(e,"tags",n);Object.assign(e,s),(a=(i=this.options).onUpdate)==null||a.call(i)}catch(s){Er.error("Failed to update task tags:",{category:"validation",operation:"update-task-tags",error:s}),new Oe.Notice(this.t("contextMenus.task.notices.updateTagsFailed"))}}async openProjectSelector(e,t){try{new yc(t.app,t,i=>{i&&this.addTaskToProject(e,t,i)}).open()}catch(n){Er.error("Failed to open project selector:",{category:"persistence",operation:"open-project-selector",error:n}),new Oe.Notice(this.t("contextMenus.task.organization.notices.projectSelectFailed"))}}async openSubtaskAssignmentSelector(e,t){try{let i=(await t.cacheManager.getAllTasks()).filter(a=>a.path!==e.path);if(i.length===0){new Oe.Notice(this.t("contextMenus.task.organization.notices.noEligibleSubtasks"));return}Pn(t,i,a=>{a&&this.assignTaskAsSubtask(e,t,a)})}catch(n){Er.error("Failed to open subtask assignment selector:",{category:"persistence",operation:"open-subtask-assignment-selector",error:n}),new Oe.Notice(this.t("contextMenus.task.organization.notices.subtaskSelectFailed"))}}async addTaskToProject(e,t,n){var i,a;try{if(!(n instanceof Oe.TFile)){new Oe.Notice(this.t("contextMenus.task.organization.notices.projectSelectFailed"));return}let s=await pI(t,e,n);s&&(Object.assign(e,s),(a=(i=this.options).onUpdate)==null||a.call(i))}catch(s){Er.error("Failed to add task to project:",{category:"persistence",operation:"add-task-project",error:s}),new Oe.Notice(this.t("contextMenus.task.organization.notices.addToProjectFailed"))}}async assignTaskAsSubtask(e,t,n){var i,a;try{let s=t.app.vault.getAbstractFileByPath(e.path);if(!(s instanceof Oe.TFile)){new Oe.Notice(this.t("contextMenus.task.organization.notices.currentTaskNotFound"));return}let o=await mI(t,s,n);o&&(Object.assign(n,o),(a=(i=this.options).onUpdate)==null||a.call(i))}catch(s){Er.error("Failed to assign task as subtask:",{category:"persistence",operation:"assign-task-as-subtask",error:s}),new Oe.Notice(this.t("contextMenus.task.organization.notices.addAsSubtaskFailed"))}}buildProjectReference(e,t,n){return js(n.app,e,t,"","",n.settings.useFrontmatterMarkdownLinks)}updateMainMenuIconColors(e,t){let n=this.targetDoc.querySelector(".menu");if(!n)return;let i=n.querySelectorAll(".menu-item"),a=this.t("contextMenus.task.status"),s=this.t("contextMenus.task.priority");i.forEach(o=>{let l=o.querySelector(".menu-item-title"),c=o.querySelector(".menu-item-icon");if(l&&c){let d=l.textContent;if(d===a){let u=t.settings.customStatuses.find(p=>p.value===e.status);u&&u.color&&(c.style.color=u.color)}else if(d===s){let u=t.settings.customPriorities.find(p=>p.value===e.priority);u&&u.color&&(c.style.color=u.color)}}})}addStatusOptions(e,t,n){this.getStatusOptions(t,n).forEach((a,s)=>{e.addItem(o=>{let l=vb(a.label,a.value),c=l;o.setIcon(a.icon||"circle"),a.value===t.status&&(c=this.t("contextMenus.task.statusSelected",{label:l})),o.setTitle(c),o.onClick(async()=>{var u,p;try{await n.updateTaskProperty(t,"status",a.value),(p=(u=this.options).onUpdate)==null||p.call(u)}catch(m){let f=m instanceof Error?m.message:String(m);Er.error("Error updating task status:",{category:"persistence",operation:"updating-task-status",details:{taskPath:t.path},error:f}),new Oe.Notice(`Failed to update task status: ${f}`)}});let d=a.color;d&&window.setTimeout(()=>{let u=mTe(o);if(u){let p=u.querySelector(".menu-item-icon");p&&(p.style.color=d)}},10)})})}addPriorityOptions(e,t,n){n.priorityManager.getPrioritiesByWeight().forEach(a=>{let s=vb(a.value);if(!s)return;let o=vb(a.label,s);e.addItem(l=>{let c=o;l.setIcon("star"),s===t.priority&&(c=this.t("contextMenus.task.prioritySelected",{label:o})),l.setTitle(c),l.onClick(async()=>{var d,u;try{await n.updateTaskProperty(t,"priority",s),(u=(d=this.options).onUpdate)==null||u.call(d)}catch(p){let m=p instanceof Error?p.message:String(p);Er.error("Error updating task priority:",{category:"persistence",operation:"updating-task-priority",details:{taskPath:t.path},error:m}),new Oe.Notice(`Failed to update task priority: ${m}`)}}),a.color&&window.setTimeout(()=>{let d=mTe(l);if(d){let u=d.querySelector(".menu-item-icon");u&&(u.style.color=a.color)}},10)})})}addDateOptions(e,t,n,i){let s=new Zs({currentValue:t,onSelect:d=>{n(d)},onCustomDate:i,plugin:this.options.plugin,app:this.options.plugin.app}).getDateOptions(),o=s.filter(d=>d.category==="increment");o.length>0&&(o.forEach(d=>{e.addItem(u=>{d.icon&&u.setIcon(d.icon),u.setTitle(d.label),u.onClick(()=>{n(d.value)})})}),e.addSeparator()),s.filter(d=>d.category==="basic").forEach(d=>{e.addItem(u=>{d.icon&&u.setIcon(d.icon);let m=d.value===t?this.t("contextMenus.date.selected",{label:d.label}):d.label;u.setTitle(m),u.onClick(()=>{n(d.value)})})});let c=s.filter(d=>d.category==="weekday");c.length>0&&(e.addSeparator(),e.addItem(d=>{d.setTitle(this.t("contextMenus.date.weekdaysLabel")),d.setIcon("calendar");let u=Fi(d);c.forEach(p=>{u.addItem(m=>{let h=p.value===t?this.t("contextMenus.date.selected",{label:p.label}):p.label;m.setTitle(h),m.setIcon("calendar"),m.onClick(()=>{n(p.value)})})})})),e.addSeparator(),e.addItem(d=>{d.setTitle(this.t("contextMenus.date.pickDateTime")),d.setIcon("calendar"),d.onClick(i)}),t&&e.addItem(d=>{d.setTitle(this.t("contextMenus.date.clearDate")),d.setIcon("x"),d.onClick(()=>{n(null)})})}addRecurrenceOptions(e,t,n,i){let a=new Date,s=["SU","MO","TU","WE","TH","FR","SA"],o=[i.i18n.translate("common.months.january"),i.i18n.translate("common.months.february"),i.i18n.translate("common.months.march"),i.i18n.translate("common.months.april"),i.i18n.translate("common.months.may"),i.i18n.translate("common.months.june"),i.i18n.translate("common.months.july"),i.i18n.translate("common.months.august"),i.i18n.translate("common.months.september"),i.i18n.translate("common.months.october"),i.i18n.translate("common.months.november"),i.i18n.translate("common.months.december")],l=s[a.getDay()],c=a.getDate(),d=a.getMonth()+1,u=o[a.getMonth()],p=Ax(i),m=a.toLocaleDateString(p||void 0,{weekday:"long"}),f=k=>{let b=k.getFullYear(),w=String(k.getMonth()+1).padStart(2,"0"),S=String(k.getDate()).padStart(2,"0");return`${b}${w}${S}`},h=k=>{let b=["th","st","nd","rd"],w=k%100;return k+(b[(w-20)%10]||b[w]||b[0])},g=f(a);[{label:this.t("modals.task.recurrence.daily"),value:`DTSTART:${g};FREQ=DAILY;INTERVAL=1`,icon:"calendar-days"},{label:this.t("modals.task.recurrence.weeklyOn",{days:m}),value:`DTSTART:${g};FREQ=WEEKLY;INTERVAL=1;BYDAY=${l}`,icon:"calendar"},{label:this.t("modals.task.recurrence.everyTwoWeeks"),value:`DTSTART:${g};FREQ=WEEKLY;INTERVAL=2;BYDAY=${l}`,icon:"calendar"},{label:this.t("modals.task.recurrence.monthlyOnOrdinal",{ordinal:h(c)}),value:`DTSTART:${g};FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=${c}`,icon:"calendar-range"},{label:this.t("modals.task.recurrence.everyThreeMonths"),value:`DTSTART:${g};FREQ=MONTHLY;INTERVAL=3;BYMONTHDAY=${c}`,icon:"calendar-range"},{label:this.t("modals.task.recurrence.yearlyOn",{month:u,day:h(c)}),value:`DTSTART:${g};FREQ=YEARLY;INTERVAL=1;BYMONTH=${d};BYMONTHDAY=${c}`,icon:"calendar-clock"},{label:this.t("modals.task.recurrence.weekdays"),value:oI(g,p),icon:"briefcase"}].forEach(k=>{e.addItem(b=>{let w=k.value===t;b.setTitle(w?`\u2713 ${k.label}`:k.label),b.setIcon(k.icon),b.onClick(()=>{n(k.value)})})}),e.addSeparator(),e.addItem(k=>{k.setTitle(this.t("contextMenus.task.customRecurrence")),k.setIcon("settings"),k.onClick(()=>{new Ml({currentValue:typeof t=="string"?t:void 0,currentAnchor:this.options.task.recurrence_anchor||"scheduled",scheduledDate:this.options.task.scheduled,onSelect:w=>{n(w)},app:i.app,plugin:i}).showCustomRecurrenceModal()})}),t&&e.addItem(k=>{k.setTitle(this.t("contextMenus.task.clearRecurrence")),k.setIcon("x"),k.onClick(()=>{n(null)})})}addOccurrencePolicyOptions(e,t,n){let i=t.occurrence_materialization||"manual",a=t.occurrence_next_trigger||"completion";e.addSeparator(),e.addItem(s=>{s.setTitle("Occurrence notes"),s.setIcon("files");let o=Fi(s),l=(d,u,p)=>{o.addItem(m=>{m.setTitle(i===d?`\u2713 ${u}`:u),m.setIcon(p),m.onClick(async()=>{await this.updateOccurrenceMaterializationPolicy(t,n,d)})})};if(l("manual","Create manually","file-plus"),l("on_completion","Create next after completion","check-circle"),o.addItem(d=>{d.setTitle(i==="rolling"?"\u2713 Rolling window (not automated yet)":"Rolling window (not automated yet)"),d.setIcon("calendar-range"),d.setDisabled(!0)}),i!=="on_completion")return;o.addSeparator(),[{value:"completion",label:"Completion only",icon:"check"},{value:"completion_or_skip",label:"Completion or skip",icon:"check-check"}].forEach(d=>{o.addItem(u=>{u.setTitle(a===d.value?`\u2713 ${d.label}`:d.label),u.setIcon(d.icon),u.onClick(async()=>{await this.updateOccurrenceNextTrigger(t,n,d.value)})})})})}async updateOccurrenceMaterializationPolicy(e,t,n){var i,a;try{let s=await t.updateTaskProperty(e,"occurrence_materialization",n==="manual"?void 0:n);if(Object.assign(e,s),n!=="on_completion"&&e.occurrence_next_trigger){let o=await t.updateTaskProperty(e,"occurrence_next_trigger",void 0);Object.assign(e,o)}(a=(i=this.options).onUpdate)==null||a.call(i),new Oe.Notice(n==="manual"?"Occurrence notes set to manual creation":"Occurrence notes will be created after completion")}catch(s){let o=s instanceof Error?s.message:String(s);Er.error("Error updating occurrence materialization policy:",{category:"persistence",operation:"updating-occurrence-materialization-policy",details:{taskPath:e.path,mode:n},error:o}),new Oe.Notice(`Failed to update occurrence notes setting: ${o}`)}}async updateOccurrenceNextTrigger(e,t,n){var i,a;try{let s=await t.updateTaskProperty(e,"occurrence_next_trigger",n==="completion"?void 0:n);Object.assign(e,s),(a=(i=this.options).onUpdate)==null||a.call(i),new Oe.Notice(n==="completion"?"Next occurrence note will be created after completion":"Next occurrence note will be created after completion or skip")}catch(s){let o=s instanceof Error?s.message:String(s);Er.error("Error updating occurrence next trigger:",{category:"persistence",operation:"updating-occurrence-next-trigger",details:{taskPath:e.path,trigger:n},error:o}),new Oe.Notice(`Failed to update occurrence trigger: ${o}`)}}getStatusOptions(e,t){let n=t.settings.customStatuses,i=[];return n&&n.length>0&&[...n].sort((s,o)=>s.order-o.order).forEach(s=>{let o=vb(s.value);o&&i.push({label:vb(s.label,o),value:o,color:typeof s.color=="string"?s.color:void 0,icon:typeof s.icon=="string"?s.icon:void 0})}),i}addQuickRemindersSection(e,t,n,i,a){if(!(i==="due"?t.due:t.scheduled)){e.addItem(o=>{o.setTitle(a),o.setIcon("bell"),o.setDisabled(!0)});return}e.addItem(o=>{o.setTitle(a),o.setIcon("bell");let l=Fi(o);[{labelKey:"contextMenus.task.quickReminders.atTime",offset:"PT0M"},{labelKey:"contextMenus.task.quickReminders.fiveMinutes",offset:"-PT5M"},{labelKey:"contextMenus.task.quickReminders.fifteenMinutes",offset:"-PT15M"},{labelKey:"contextMenus.task.quickReminders.oneHour",offset:"-PT1H"},{labelKey:"contextMenus.task.quickReminders.oneDay",offset:"-P1D"}].forEach(d=>{l.addItem(u=>{let p=this.t(d.labelKey);u.setTitle(p),u.onClick(()=>{this.addQuickReminder(t,n,i,d.offset,p)})})})})}async addQuickReminder(e,t,n,i,a){var l,c;let s={id:`rem_${Date.now()}`,type:"relative",relatedTo:n,offset:i,description:a},o=[...e.reminders||[],s];try{await t.updateTaskProperty(e,"reminders",o),(c=(l=this.options).onUpdate)==null||c.call(l)}catch(d){Er.error("Error adding reminder:",{category:"persistence",operation:"adding-reminder",error:d}),new Oe.Notice("Failed to add reminder")}}show(e){var t,n;(n=(t=e.target)==null?void 0:t.instanceOf)!=null&&n.call(t,HTMLElement)&&(this.targetDoc=e.target.ownerDocument),this.menu.showAtMouseEvent(e)}showAtElement(e){this.targetDoc=e.ownerDocument,this.menu.showAtPosition({x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().bottom+4})}}});function Qtt(r,e,t){return r.i18n.translate(`ui.taskCard.${e}`,t)}function Jtt(r){return I({tag:"TaskCard/ContextMenu",isDebugEnabled:()=>r.settings.enableDebugLogging})}function hTe(r){let{mainRow:e,taskPath:t,plugin:n,targetDate:i,promoteOccurrenceControls:a}=r,s=Qtt(n,"taskOptions"),o=e.createEl("div",{cls:"task-card__context-menu",attr:{"aria-label":s}});return(0,Oc.setIcon)(o,"ellipsis-vertical"),(0,Oc.setTooltip)(o,s,{placement:"top"}),Pl(o),o.addEventListener("click",l=>{if(l.stopPropagation(),l.preventDefault(),a===void 0){Ro(l,t,n,i);return}Ro(l,t,n,i,{promoteOccurrenceControls:a})}),o}async function Ro(r,e,t,n,i={}){let a=t.app.vault.getAbstractFileByPath(e),s=()=>{a instanceof Oc.TFile&&Xtt(r,a,t)};try{let o=await t.cacheManager.getTaskInfo(e);if(!o){s();return}new nm({task:o,plugin:t,targetDate:n,promoteOccurrenceControls:i.promoteOccurrenceControls,onUpdate:()=>{t.app.workspace.trigger("tasknotes:refresh-views")}}).show(r)}catch(o){let l=o instanceof Error?o.message:String(o);Jtt(t).error("Error creating context menu",{category:"internal",operation:"create-context-menu",details:{taskPath:e,errorMessage:l},error:o}),new Oc.Notice(`Failed to create context menu: ${l}`),s()}}function Xtt(r,e,t){var a,s;let n=new Oc.Menu,i=!1;try{t.app.workspace.trigger("file-menu",n,e,"tasknotes-bases-view"),i=((s=(a=n.items)==null?void 0:a.length)!=null?s:0)>0}catch(o){i=!1}i||(n.addItem(o=>{o.setTitle("Open"),o.setIcon("file-text"),o.onClick(()=>{t.app.workspace.getLeaf(!1).openFile(e)})}),n.addItem(o=>{o.setTitle("Open in new tab"),o.setIcon("external-link"),o.onClick(()=>{t.app.workspace.openLinkText(e.path,"",!0)})})),n.showAtMouseEvent(r)}var Oc,TV=y(()=>{Oc=require("obsidian");wI();G();Px()});function ert(r,e){return Z(e).trim()||Z(r.title)}function gTe(r,e,t,n){r.empty();let i={metadataCache:t.app.metadataCache,workspace:t.app.workspace,sourcePath:e.path};Dc(r,ert(e,n),i)}function kV(r,e){let t=r.querySelector(".task-card__title"),n=r.querySelector(".task-card__title-text");t==null||t.classList.toggle("completed",e),n==null||n.classList.toggle("completed",e)}function yTe(r){let{contentContainer:e,layout:t,task:n,plugin:i,displayText:a,isCompleted:s=!1}=r,o=e.createEl(t==="inline"?"span":"div",{cls:"task-card__title"}),l=o.createSpan({cls:"task-card__title-text"});return gTe(l,n,i,a),o.classList.toggle("completed",s),l.classList.toggle("completed",s),{titleEl:o,titleTextEl:l}}function vTe(r){let{card:e,task:t,plugin:n,displayText:i,isCompleted:a=!1}=r,s=e.querySelector(".task-card__title-text");s&&gTe(s,t,n,i),kV(e,a)}var wV=y(()=>{gr();Kp()});function trt(r,e,t,n,i){var o;r.classList.toggle("task-card--completed",n),r.classList.toggle("task-card--completed-strikethrough",n&&JH(t)),r.classList.toggle("task-card--archived",!!e.archived),r.classList.toggle("task-card--actively-tracked",t.getActiveTimeSession(e)!==null),r.classList.toggle("task-card--recurring",!!e.recurrence),r.classList.toggle("task-card--chevron-left",((o=t.settings)==null?void 0:o.subtaskChevronPosition)==="left");let a=QH(e,t);r.classList.toggle("task-card--has-details",a),r.dataset.hasDetails=a?"true":"false",SV(r,"task-card--priority-"),e.priority&&r.classList.add(`task-card--priority-${ou(e.priority)}`),SV(r,"task-card--status-"),i&&r.classList.add(`task-card--status-${ou(i)}`),SV(r,"task-card--project-");let s=XH(e);r.classList.toggle("task-card--has-projects",s.length>0),s.forEach(l=>r.classList.add(l)),r.dataset.status=i,kV(r,n)}function EV({card:r,statusDot:e,plugin:t,updatedTask:n,effectiveStatus:i,isCompleted:a}){dI(e,t.statusManager.getStatusConfig(i)),cI(r,i,t);let s=r.querySelector(".task-card__checkbox");s&&(s.checked=a),trt(r,n,t,a,i)}function SV(r,e){for(let t of Array.from(r.classList))t.startsWith(e)&&r.classList.remove(t)}var bTe=y(()=>{Ct();tV();ZH();wV()});async function TTe(r,e){return new Promise((t,n)=>{new xV(e.app,r,async()=>{try{await e.taskService.deleteTask(r),t()}catch(a){n(a instanceof Error?a:new Error(String(a)))}}).open()})}var Hx,rrt,xV,kTe=y(()=>{Hx=require("obsidian");G();rrt=I({tag:"Ui/TaskCardDeletion"}),xV=class extends Hx.Modal{constructor(e,t,n){super(e),this.task=t,this.onConfirm=n}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Delete task"});let t=e.createEl("p");t.appendText('Are you sure you want to delete the task "'),t.createEl("strong",{text:this.task.title}),t.appendText('"?'),e.createEl("p",{cls:"mod-warning",text:"This action cannot be undone. The task file will be permanently deleted."});let n=e.createEl("div",{cls:"modal-button-container"});n.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),n.classList.add("tn-static-display-flex-75816cae"),n.classList.remove("tn-static-display-flex-8bb39979","tn-static-gap-0-5rem-ce2fca4d","tn-static-gap-12px-ed7b3d87","tn-static-gap-6px-f0abc1db","tn-static-gap-8px-33fcd4c3"),n.classList.add("tn-static-gap-10px-f3d7ce77"),n.classList.remove("tn-static-justify-content-center-03c4bb6f","tn-static-justify-content-space-between-a562f4fd"),n.classList.add("tn-static-justify-content-flex-end-455f8cca"),n.classList.remove("tn-static-font-size-12px-b0cc7e05","tn-static-margin-top-0-5rem-3dc98b5e","tn-static-margin-top-0-d462248a","tn-static-margin-top-12px-91e0f558","tn-static-margin-top-16px-1b0f4999","tn-static-margin-top-1rem-2239d6d5","tn-static-margin-top-30px-2fbbbcd4","tn-static-margin-top-4px-96ad6099","tn-static-margin-top-8px-8a77e5a3","tn-static-margin-top-8px-f4f01e68"),n.classList.add("tn-static-margin-top-20px-a26bda7d");let i=n.createEl("button",{text:"Cancel"});i.addEventListener("click",()=>{this.close()});let a=n.createEl("button",{text:"Delete",cls:"mod-warning"});a.classList.remove("tn-static-background-color-var-background-mo-94b219f0","tn-static-background-color-var-background-se-9087a23e","tn-static-background-color-var-color-base-40-ef5f175e","tn-static-background-color-var-text-accent-a954c70f"),a.classList.add("tn-static-background-color-var-color-red-134bc721"),a.classList.remove("tn-static-color-var-color-accent-d2cad743","tn-static-color-var-text-accent-65b47ee3","tn-static-color-var-text-muted-5872de20","tn-static-color-var-text-on-accent-f3e1679d","tn-static-color-var-text-warning-783d5f03","tn-static-color-var-tn-text-muted-a90fb6f3","tn-static-cursor-pointer-2723efcc","tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-2px-0-edce9b14","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c"),a.classList.add("tn-static-color-white-0a43e56a"),a.addEventListener("click",()=>{(async()=>{try{await this.onConfirm(),this.close(),new Hx.Notice("Task deleted successfully")}catch(s){let o=s instanceof Error?s.message:String(s);new Hx.Notice(`Failed to delete task: ${o}`),rrt.error("Error in delete confirmation:",{category:"persistence",operation:"delete-confirmation",error:s})}})()}),i.focus()}onClose(){let{contentEl:e}=this;e.empty()}}});var bb={};et(bb,{DEFAULT_TASK_CARD_OPTIONS:()=>CV,cleanupTaskCard:()=>art,createTaskCard:()=>Sr,refreshParentTaskSubtasks:()=>srt,showDeleteConfirmationModal:()=>TTe,showTaskContextMenu:()=>Ro,toggleBlockedByTasks:()=>xTe,toggleBlockingTasks:()=>ETe,toggleSubtasks:()=>STe,updateTaskCard:()=>irt});function nrt(r){var e;return(e=r._taskCardOptions)!=null?e:{}}function SI(r){return{plugin:r,getRelationshipOptions:nrt,renderTaskCard:(e,t)=>Sr(e,r,void 0,t)}}function wTe(r){return{toggleSubtasks:(e,t,n)=>STe(e,t,r,n),toggleBlockingTasks:(e,t,n)=>ETe(e,t,r,n),toggleBlockedByTasks:(e,t,n)=>xTe(e,t,r,n)}}function Sr(r,e,t,n={}){let i={...CV,...n},a=eV(r,e,i),{targetDate:s,effectiveStatus:o,layout:l,isCompleted:c,hasDetails:d}=a,u=activeDocument.createElement(l==="inline"?"span":"div"),p=u;p._taskPath=r.path,p._taskCardOptions=i,u.className=a.cardClasses.join(" "),u.dataset.taskPath=r.path,u.dataset.key=r.path,u.dataset.status=o,r.priority?u.dataset.priority=r.priority:delete u.dataset.priority,u.dataset.hasDetails=d?"true":"false";let m=u.createEl(l==="inline"?"span":"div",{cls:"task-card__main-row"});YH(u,r,e),GH({mainRow:m,card:u,task:r,plugin:e,effectiveStatus:o,visibleProperties:t,hideStatusIndicator:i.hideStatusIndicator,onClick:AH({task:r,plugin:e,targetDate:s,updateStatusVisuals:(x,C,D)=>{let _=u.querySelector(".task-card__status-dot");_&&EV({card:u,statusDot:_,plugin:e,updatedTask:x,effectiveStatus:C,isCompleted:D})}})}),KH({mainRow:m,task:r,plugin:e,visibleProperties:t,onClick:IH(r,e)});let f=m.createEl(l==="inline"?"span":"div",{cls:"task-card__content"}),h=l!=="inline"?m.createEl("div",{cls:"task-card__badges"}):null,g=wTe(e);Vbe({card:u,badgesContainer:h,task:r,plugin:e,hasDetails:d,propertyOptions:i,handlers:g}),hTe({mainRow:m,taskPath:r.path,plugin:e,targetDate:s,promoteOccurrenceControls:i.promoteOccurrenceControlsInContextMenu}),yTe({contentContainer:f,layout:l,task:r,plugin:e,displayText:i.displayText,isCompleted:c});let v=f.createEl(l==="inline"?"span":"div",{cls:"task-card__metadata"});qH({metadataLine:v,card:u,task:r,plugin:e,visibleProperties:t,propertyOptions:i,handlers:g});let{clickHandler:k,auxclickHandler:b,dblclickHandler:w,contextmenuHandler:S}=lme({task:r,plugin:e,contextMenuHandler:x=>{let C=u.dataset.taskPath;if(C){if(i.promoteOccurrenceControlsInContextMenu===void 0){Ro(x,C,e,s);return}Ro(x,C,e,s,{promoteOccurrenceControls:i.promoteOccurrenceControlsInContextMenu})}},createBatchContextMenu:(x,C)=>new tb({plugin:e,selectedPaths:x,onUpdate:C})});return u.addEventListener("click",k),u.addEventListener("auxclick",b),u.addEventListener("dblclick",w),u.addEventListener("contextmenu",S),i.enableHoverPreview&&u.addEventListener("mouseover",cme(r,e)),u}function irt(r,e,t,n,i={}){let a={...CV,...i},s=eV(e,t,a),{targetDate:o,effectiveStatus:l,isCompleted:c,hasDetails:d}=s;r.className=s.cardClasses.join(" "),r.dataset.status=l,e.priority?r.dataset.priority=e.priority:delete r.dataset.priority,r.dataset.hasDetails=d?"true":"false";let u=r.querySelector(".task-card__main-row");YH(r,e,t);let p=r.querySelector(".task-card__checkbox");p&&(p.checked=t.statusManager.isCompletedStatus(l)),Zbe({mainRow:u,card:r,task:e,plugin:t,effectiveStatus:l,visibleProperties:n,hideStatusIndicator:a.hideStatusIndicator,onClick:AH({task:e,plugin:t,targetDate:o,updateStatusVisuals:(g,v,k)=>{let b=r.querySelector(".task-card__status-dot");b&&EV({card:r,statusDot:b,plugin:t,updatedTask:g,effectiveStatus:v,isCompleted:k})}})}),Jbe({mainRow:u,task:e,plugin:t,visibleProperties:n,onClick:IH(e,t)});let m=wTe(t);qbe({card:r,mainRow:u,task:e,plugin:t,hasDetails:d,propertyOptions:a,handlers:m}),vTe({card:r,task:e,plugin:t,displayText:a.displayText,isCompleted:c});let f=r.querySelector(".task-card__badge--blocked");f&&f.remove();let h=r.querySelector(".task-card__metadata");h&&qH({metadataLine:h,card:r,task:e,plugin:t,visibleProperties:n,propertyOptions:a,handlers:m})}function art(r){Rbe(r)}async function STe(r,e,t,n){await jH(SI(t),r,e,n)}async function ETe(r,e,t,n){await Lbe(SI(t),r,e,n)}async function xTe(r,e,t,n){await Fbe(SI(t),r,e,n)}async function srt(r,e,t){await $be(SI(e),r,t)}var CV,la=y(()=>{r2();gH();Wbe();BH();LH();ZH();tV();VH();TV();wV();bTe();kTe();TV();CV={layout:"default",showSecondaryBadges:!0,enableHoverPreview:!0}});function DV({plugin:r,sourcePath:e},t){return{dependency:{uid:To(r.app,e,t.path,r.settings.useFrontmatterMarkdownLinks),reltype:es},path:t.path,name:t.basename}}function CTe({plugin:r,sourcePath:e},t){var s;let n=ts(t);if(!n){let o=typeof t=="object"&&t&&"uid"in t&&typeof t.uid=="string"?t.uid:Z(t);return{dependency:{uid:o,reltype:es},name:o,unresolved:!0}}let i=wl(r.app,e,n);if(i){let o=((s=i.file)==null?void 0:s.basename)||i.path.split("/").pop()||n.uid;return{dependency:n,path:i.path,name:o}}let a=n.uid.replace(/^\[\[/,"").replace(/\]\]$/,"");return{dependency:n,name:a||t.uid,unresolved:!0}}function DTe({plugin:r,sourcePath:e},t){let n=r.app.vault.getAbstractFileByPath(t);if(n instanceof Vx.TFile)return DV({plugin:r,sourcePath:e},n);let a=(t.split("/").pop()||t).replace(/\.md$/i,"");return{dependency:{uid:`[[${a}]]`,reltype:es},path:t,name:a,unresolved:!0}}function ort(r,e){return r.some(t=>t.dependency.uid===e.dependency.uid||!!e.path&&t.path===e.path)}function PV(r,e){return ort(r,e)?[...r]:[...r,e]}function MV(r,e){return r.filter((t,n)=>n!==e)}async function PTe({plugin:r,listEl:e,items:t,linkServices:n,translate:i,onRemove:a}){if(e&&(e.empty(),t.length!==0))for(let[s,o]of t.entries()){let l=!!(o.path&&!o.unresolved),c=e.createDiv({cls:l?"task-project-item task-project-item--task-card":"task-project-item"});o.unresolved&&(c.addClass("task-project-item--unresolved"),(0,Vx.setTooltip)(c,i("contextMenus.task.dependencies.notices.unresolved",{entries:o.dependency.uid}),{placement:"top"}));let d=c.createDiv({cls:l?"task-project-card-host":"task-project-info"});o.path&&!o.unresolved?await lrt(r,d,o,n):crt(d,o);let u=c.createEl("button",{cls:"task-project-remove",text:"\xD7"});(0,Vx.setTooltip)(u,i("modals.task.dependencies.removeTaskTooltip"),{placement:"top"}),u.addEventListener("click",p=>{p.preventDefault(),p.stopPropagation(),a(s)})}}async function lrt(r,e,t,n){if(!t.path)return;let i=await r.cacheManager.getCachedTaskInfo(t.path);if(i){let s=Sr(i,r,void 0,{layout:"default",showSecondaryBadges:!1,enableHoverPreview:!1});e.appendChild(s);return}let a=e.createSpan({cls:"task-project-name clickable-dependency"});Dl(a,t.path,t.name,n,{cssClass:"task-dependency-link internal-link",hoverSource:"tasknotes-dependency-link",showErrorNotices:!0}),t.path!==t.name&&e.createDiv({cls:"task-project-path",text:t.path})}function crt(r,e){var i;let t=r.createSpan({cls:"task-project-name"});t.textContent=e.name;let n=(i=e.path)!=null?i:e.dependency.uid;r.createDiv({cls:"task-project-path",text:n})}function MTe(r,e,t){return To(r.app,e,t.path,r.settings.useFrontmatterMarkdownLinks)}function _Te({plugin:r,sourcePath:e,allTasks:t,existingItems:n,currentPath:i}){let a=new Set(n.map(s=>s.dependency.uid));return t.filter(s=>{if(i&&s.path===i)return!1;let o=MTe(r,e,s);return!a.has(o)})}function ATe({plugin:r,sourcePath:e,allTasks:t,existingItems:n,currentPath:i}){let a=new Set(n.map(o=>o.path).filter(o=>typeof o=="string")),s=new Set(n.map(o=>o.dependency.uid));return t.filter(o=>{if(i&&o.path===i||a.has(o.path))return!1;let l=MTe(r,e,o);return!s.has(l)})}var Vx,ITe=y(()=>{Vx=require("obsidian");ko();Kp();la();gr()});function drt(r){return parseInt(r)||0}function NTe(r,e){let t=null,n=new EI.Setting(e.container);if(n.settingEl.addClass("tn-task-modal__wide-text-setting"),n.setName(r.translate("modals.task.contextsLabel")).addText(i=>{i.setPlaceholder(r.translate("modals.task.contextsPlaceholder")).setValue(e.value).onChange(e.onChange),t=i.inputEl,r.attachMobileKeyboardScrollGuard(i.inputEl),new qA(r.app,i.inputEl,r.plugin)}),!t)throw new Error("Failed to create contexts input");return t}function RTe(r,e){let t=null,n=new EI.Setting(e.container);if(n.settingEl.addClass("tn-task-modal__wide-text-setting"),n.setName(r.translate("modals.task.tagsLabel")).addText(i=>{i.setPlaceholder(r.translate("modals.task.tagsPlaceholder")).setValue(e.value).onChange(a=>{e.onChange(Ri(a))}),t=i.inputEl,r.attachMobileKeyboardScrollGuard(i.inputEl),new Wp(r.app,i.inputEl,r.plugin)}),!t)throw new Error("Failed to create tags input");return t}function OTe(r,e){let t=null;if(new EI.Setting(e.container).setName(r.translate("modals.task.timeEstimateLabel")).addText(n=>{n.setPlaceholder(r.translate("modals.task.timeEstimatePlaceholder")).setValue(e.value.toString()).onChange(i=>{e.onChange(drt(i))}),t=n.inputEl,r.attachMobileKeyboardScrollGuard(n.inputEl)}),!t)throw new Error("Failed to create time estimate input");return t}var EI,LTe=y(()=>{EI=require("obsidian");Ct();Tx()});function im(r){return r==null?"":typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):Array.isArray(r)?r.map(im).join(", "):""}function $Te(r){return Array.isArray(r)?r.map(im).join(", "):im(r)}function _V(r){return r.split(",").map(e=>e.trim()).filter(e=>e.length>0)}function zTe(r){let e=_V(r);return e.length>0?e:null}function AV(r){let e=parseFloat(r);return isNaN(e)?null:e}function xI(r){return r||null}function IV(r){return r===!0||r==="true"}function jTe(r){let e={};for(let[t,n]of Object.entries(r))n!=null&&n!==""&&(e[t]=n);return e}function BTe(r,e,t){let n={};for(let i of t){if(!(i!=null&&i.key))continue;let a=r[i.key],s=e[i.key];urt(a,s)&&(n[i.key]=a==null||a===""?null:a)}return n}function urt(r,e){let t=FTe(r),n=FTe(e);return Array.isArray(t)||Array.isArray(n)?JSON.stringify(t)!==JSON.stringify(n):t!==n}function FTe(r){return r==null||r===""?null:r}var CI=y(()=>{});function UTe(r,e){let{container:t,field:n,values:i,inputRefs:a,toggleRefs:s,onValueChange:o}=e,l=new xu.Setting(t).setName(n.displayName);switch(n.type){case"text":case"list":{l.addText(c=>{let d=i[n.key],u=Array.isArray(d)?d.map(im).join(", "):im(d);c.setValue(u).onChange(p=>{o(n.key,n.type==="list"?_V(p):p)}),Bh(r,a,n,c.inputEl)});break}case"number":{l.addText(c=>{let d=i[n.key];c.setValue(im(d)).onChange(u=>{o(n.key,AV(u))}),c.inputEl.type="number",Bh(r,a,n,c.inputEl,{attachSuggest:!1})});break}case"date":{l.addText(c=>{let d=i[n.key];c.setValue(im(d)).onChange(u=>{o(n.key,u)}),c.inputEl.type="date",Sc(c.inputEl,{onCommit:u=>{o(n.key,u)}}),Bh(r,a,n,c.inputEl,{attachSuggest:!1})});break}case"boolean":{l.addToggle(c=>{let d=i[n.key];c.setValue(d===!0).onChange(u=>{o(n.key,u)}),s.set(n.key,c)});break}}}function HTe(r,e){let{container:t,fields:n}=e;n.length>0&&t.createDiv({cls:"tn-task-modal__user-fields"}).createDiv({text:r.translate("modals.task.customFieldsLabel"),cls:"tn-task-modal__section-label"});for(let i of n)!i||!i.key||!i.displayName||prt(r,e,i)}function VTe(r){for(let e of r.fields){let t=r.values[e.key],n=r.inputRefs.get(e.key);n&&(n.value=$Te(t));let i=r.toggleRefs.get(e.key);i&&i.setValue(IV(t))}}function prt(r,e,t){let n=e.values[t.key]||"";switch(t.type){case"boolean":new xu.Setting(e.container).setName(t.displayName).addToggle(i=>{i.setValue(IV(n)).onChange(a=>{e.onValueChange(t.key,a)}),e.toggleRefs.set(t.key,i)});break;case"number":new xu.Setting(e.container).setName(t.displayName).addText(i=>{i.setPlaceholder(r.translate("modals.task.userFields.numberPlaceholder")).setValue(n?Z(n):"").onChange(a=>{e.onValueChange(t.key,AV(a))}),Bh(r,e.inputRefs,t,i.inputEl,{attachSuggest:!1})});break;case"date":mrt(r,e,t,n);break;case"list":new xu.Setting(e.container).setName(t.displayName).addText(i=>{var o;let a=Array.isArray(n)?n.join(", "):n?Z(n):"";i.setPlaceholder(r.translate("modals.task.userFields.listPlaceholder")).setValue(a).onChange(l=>{e.onValueChange(t.key,zTe(l))}),Bh(r,e.inputRefs,t,i.inputEl);let s=e.container.querySelector(".user-field-link-preview");s&&((o=s.detach)==null||o.call(s))});break;case"text":default:new xu.Setting(e.container).setName(t.displayName).addText(i=>{i.setPlaceholder(r.translate("modals.task.userFields.textPlaceholder",{field:t.displayName})).setValue(n?Z(n):"").onChange(a=>{e.onValueChange(t.key,xI(a))}),Bh(r,e.inputRefs,t,i.inputEl)});break}}function mrt(r,e,t,n){new xu.Setting(e.container).setName(t.displayName).addText(i=>{i.setPlaceholder(r.translate("modals.task.userFields.datePlaceholder")).setValue(n?Z(n):"").onChange(o=>{e.onValueChange(t.key,xI(o))}),Bh(r,e.inputRefs,t,i.inputEl,{attachSuggest:!1});let a=i.inputEl.parentElement;a&&a.addClass("tn-date-control"),Sc(i.inputEl,{onCommit:o=>{e.onValueChange(t.key,o)}});let s=a==null?void 0:a.createEl("button",{cls:"user-field-date-picker-btn"});s&&(s.setAttribute("aria-label",r.translate("modals.task.userFields.pickDate",{field:t.displayName})),(0,xu.setIcon)(s,"calendar"),s.addEventListener("click",o=>{o.preventDefault(),new Zs({currentValue:frt(i)||void 0,onSelect:c=>{i.setValue(c||""),e.onValueChange(t.key,xI(c))},plugin:r.plugin,app:r.app}).showAtElement(s)}))})}function Bh(r,e,t,n,i={}){e.set(t.key,n),r.attachMobileKeyboardScrollGuard(n),i.attachSuggest!==!1&&new WA(r.app,n,r.plugin,t)}function frt(r){return typeof r.getValue=="function"?r.getValue():r.inputEl.value}var xu,qTe=y(()=>{xu=require("obsidian");Nh();yx();gr();Tx();CI()});function DI(r,e){var a;let t=e.container.createDiv("modal-button-container tn-task-modal__button-bar");for(let s of(a=e.leadingButtons)!=null?a:[])t.createEl("button",{cls:s.className,text:s.text}).addEventListener("click",s.onClick);let n=t.createEl("button",{cls:"mod-cta",text:r.translate("modals.task.buttons.save")});return n.addEventListener("click",()=>{hrt(n,e.onSave,e.onSaved)}),t.createEl("button",{text:r.translate("common.cancel")}).addEventListener("click",e.onCancel),t}async function hrt(r,e,t){r.disabled=!0;try{await e(),t()}finally{r.disabled=!1}}var NV=y(()=>{});function RV(r,e){let t=r.createDiv("action-icon");t.setAttribute("aria-label",e.tooltip),t.setAttribute("data-initial-tooltip",e.tooltip),t.setAttribute("tabindex","0"),t.setAttribute("role","button"),e.dataType&&t.setAttribute("data-type",e.dataType),(0,PI.setTooltip)(t,e.tooltip,{placement:"top"});let n=t.createSpan("icon");(0,PI.setIcon)(n,e.iconName);let i=a=>{a.preventDefault(),a.stopPropagation(),e.onClick(t,a)};return t.addEventListener("click",i),t.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&i(a)}),t}function WTe(r,e){return e.map(t=>RV(r,t))}var PI,YTe=y(()=>{PI=require("obsidian")});function KTe(r,e,t){r&&(GTe(r,e,"due-date",t.dueDate,{activeTooltipKey:"modals.task.tooltips.dueValue",defaultTooltipKey:"modals.task.actions.due"}),GTe(r,e,"scheduled-date",t.scheduledDate,{activeTooltipKey:"modals.task.tooltips.scheduledValue",defaultTooltipKey:"modals.task.actions.scheduled"}),yrt(r,e,t),vrt(r,e,t),brt(r,e,t),Trt(r,e,t.reminderCount))}function GTe(r,e,t,n,i){let a=qx(r,t);if(a){if(n){a.classList.add("has-value"),(0,Cu.setTooltip)(a,e.translate(i.activeTooltipKey,{value:n}),{placement:"top"});return}a.classList.remove("has-value"),(0,Cu.setTooltip)(a,e.translate(i.defaultTooltipKey),{placement:"top"})}}function yrt(r,e,t){let n=qx(r,"status");if(!n)return;let i=t.statusConfigs.find(s=>s.value===t.status),a=i?i.label:t.status;ZTe(n,e,{isActive:!!(t.status&&i&&i.value!==t.defaultStatus),activeTooltipKey:"modals.task.tooltips.statusValue",defaultTooltipKey:"modals.task.actions.status",label:a,color:i==null?void 0:i.color})}function vrt(r,e,t){let n=qx(r,"priority");if(!n)return;let i=t.priorityConfigs.find(s=>s.value===t.priority),a=i?i.label:t.priority;ZTe(n,e,{isActive:!!(t.priority&&i&&i.value!==t.defaultPriority),activeTooltipKey:"modals.task.tooltips.priorityValue",defaultTooltipKey:"modals.task.actions.priority",label:a,color:i==null?void 0:i.color})}function ZTe(r,e,t){t.isActive?(r.classList.add("has-value"),(0,Cu.setTooltip)(r,e.translate(t.activeTooltipKey,{value:t.label}),{placement:"top"})):(r.classList.remove("has-value"),(0,Cu.setTooltip)(r,e.translate(t.defaultTooltipKey),{placement:"top"}));let n=r.querySelector(".icon");if(n){if(t.color){n.style.color=t.color;return}n.classList.remove(...grt),n.style.removeProperty("color")}}function brt(r,e,t){let n=qx(r,"recurrence");if(n){if(t.recurrenceRule.trim()){n.classList.add("has-value"),(0,Cu.setTooltip)(n,e.translate("modals.task.tooltips.recurrenceValue",{value:t.recurrenceDisplayText}),{placement:"top"});return}n.classList.remove("has-value"),(0,Cu.setTooltip)(n,e.translate("modals.task.actions.recurrence"),{placement:"top"})}}function Trt(r,e,t){let n=qx(r,"reminders");if(n){if(t>0){n.classList.add("has-value");let i=t===1?e.translate("modals.task.tooltips.remindersSingle"):e.translate("modals.task.tooltips.remindersPlural",{count:t});(0,Cu.setTooltip)(n,i,{placement:"top"});return}n.classList.remove("has-value"),(0,Cu.setTooltip)(n,e.translate("modals.task.actions.reminders"),{placement:"top"})}}function qx(r,e){return r.querySelector(`[data-type="${e}"]`)}var Cu,grt,QTe=y(()=>{Cu=require("obsidian"),grt=["tn-static-color-var-color-accent-d2cad743","tn-static-color-var-text-accent-65b47ee3","tn-static-color-var-text-muted-5872de20","tn-static-color-var-text-on-accent-f3e1679d","tn-static-color-var-text-warning-783d5f03","tn-static-color-var-tn-text-muted-a90fb6f3","tn-static-color-white-0a43e56a","tn-static-cursor-pointer-2723efcc","tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-2px-0-edce9b14","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c"]});function JTe(r){return!r||r.length===0?"open":[...r].sort((t,n)=>t.order-n.order)[0].value}function XTe(r){return!r||r.length===0?"normal":[...r].sort((t,n)=>t.weight-n.weight)[0].value}function eke(r){return r?r.includes("FREQ=DAILY")?"Daily":r.includes("FREQ=WEEKLY")?Srt(r):r.includes("FREQ=MONTHLY")?Ert(r):r.includes("FREQ=YEARLY")?xrt(r):`Custom${Crt(r)}`:""}function tke(r){let e=["th","st","nd","rd"],t=r%100;return r+(e[(t-20)%10]||e[t]||e[0])}function Srt(r){if(r.includes("INTERVAL=2"))return"Every 2 weeks";if(r.includes("BYDAY=MO,TU,WE,TH,FR"))return"Weekdays";if(!r.includes("BYDAY="))return"Weekly";let e=r.match(/BYDAY=([A-Z]{2})/);return e?`Weekly on ${krt[e[1]]||e[1]}`:"Weekly"}function Ert(r){if(r.includes("INTERVAL=3"))return"Every 3 months";if(r.includes("BYMONTHDAY=")){let e=r.match(/BYMONTHDAY=(\d+)/);return e?`Monthly on the ${tke(Number.parseInt(e[1],10))}`:"Monthly"}return r.includes("BYDAY=")?"Monthly (by weekday)":"Monthly"}function xrt(r){if(r.includes("BYMONTH=")&&r.includes("BYMONTHDAY=")){let e=r.match(/BYMONTH=(\d+)/),t=r.match(/BYMONTHDAY=(\d+)/);if(e&&t){let n=wrt[Number.parseInt(e[1],10)],i=tke(Number.parseInt(t[1],10));return`Yearly on ${n} ${i}`}}return"Yearly"}function Crt(r){if(r.includes("COUNT=")){let e=r.match(/COUNT=(\d+)/);return e?` (${e[1]} times)`:""}if(r.includes("UNTIL=")){let e=r.match(/UNTIL=(\d{8})/);if(e){let t=e[1];return` (until ${t.slice(0,4)}-${t.slice(4,6)}-${t.slice(6,8)})`}}return""}var krt,wrt,rke=y(()=>{krt={SU:"Sunday",MO:"Monday",TU:"Tuesday",WE:"Wednesday",TH:"Thursday",FR:"Friday",SA:"Saturday"},wrt=["","January","February","March","April","May","June","July","August","September","October","November","December"]});function nke(r){return{title:r.title,status:r.status,priority:r.priority,dueDate:r.dueDate,scheduledDate:r.scheduledDate,recurrenceRule:r.recurrenceRule,recurrenceAnchor:r.recurrenceAnchor,reminders:r.reminders||[]}}function ike(r){return{app:r.app,plugin:r.plugin,translate:r.translate,getState:r.getState,setDate:(e,t)=>{if(e==="due"){r.setDueDate(t);return}r.setScheduledDate(t)},setStatus:r.setStatus,setPriority:r.setPriority,setRecurrence:(e,t)=>{r.setRecurrenceRule(e),t!==void 0&&r.setRecurrenceAnchor(t)},setReminders:r.setReminders,onChange:r.onChange}}function ake(r,e){let t=e.statusConfigs||[],n=e.priorityConfigs||[];return{dueDate:r.dueDate,scheduledDate:r.scheduledDate,status:r.status,priority:r.priority,recurrenceRule:r.recurrenceRule,recurrenceDisplayText:eke(r.recurrenceRule),reminderCount:r.reminders.length,defaultStatus:JTe(t),defaultPriority:XTe(n),statusConfigs:t,priorityConfigs:n}}var ske=y(()=>{rke()});var MI,oke=y(()=>{sb();du();MI=class{constructor(e,t,n,i){this.plugin=e,this.task=t,this.triggerElement=n,this.onUpdate=i}show(e){let t=new ki;this.addQuickRemindersSection(t,"due",this.plugin.i18n.translate("components.reminderContextMenu.remindBeforeDue")),this.addQuickRemindersSection(t,"scheduled",this.plugin.i18n.translate("components.reminderContextMenu.remindBeforeScheduled")),t.addSeparator(),t.addItem(n=>{n.setTitle(this.plugin.i18n.translate("components.reminderContextMenu.manageAllReminders")).setIcon("settings").onClick(()=>{this.openReminderModal()})}),this.task.reminders&&this.task.reminders.length>0&&t.addItem(n=>{n.setTitle(this.plugin.i18n.translate("components.reminderContextMenu.clearAllReminders")).setIcon("trash").onClick(async()=>{await this.clearAllReminders()})}),t.show(e)}addQuickRemindersSection(e,t,n){if(!(t==="due"?this.task.due:this.task.scheduled)){e.addItem(a=>{a.setTitle(n).setIcon("bell").setDisabled(!0)});return}e.addItem(a=>{a.setTitle(n),a.setIcon("bell"),this.addQuickReminderSubmenu(a.setSubmenu(),t)})}addQuickReminderSubmenu(e,t){[{label:this.plugin.i18n.translate("components.reminderContextMenu.quickReminders.atTime"),offset:"PT0M"},{label:this.plugin.i18n.translate("components.reminderContextMenu.quickReminders.fiveMinutesBefore"),offset:"-PT5M"},{label:this.plugin.i18n.translate("components.reminderContextMenu.quickReminders.fifteenMinutesBefore"),offset:"-PT15M"},{label:this.plugin.i18n.translate("components.reminderContextMenu.quickReminders.oneHourBefore"),offset:"-PT1H"},{label:this.plugin.i18n.translate("components.reminderContextMenu.quickReminders.oneDayBefore"),offset:"-P1D"}].forEach(i=>{e.addItem(a=>{a.setTitle(i.label).onClick(async()=>{await this.addQuickReminder(t,i.offset,i.label)})})})}async addQuickReminder(e,t,n){let i={id:`rem_${Date.now()}`,type:"relative",relatedTo:e,offset:t,description:n},a=[...this.task.reminders||[],i];await this.saveReminders(a)}async clearAllReminders(){await this.saveReminders([])}async saveReminders(e){let t;if(this.task.path&&this.task.path.trim()!==""){let n=await this.plugin.cacheManager.getTaskInfo(this.task.path);n?(t={...n,reminders:e},await this.plugin.taskService.updateProperty(t,"reminders",e)):t={...this.task,reminders:e}}else t={...this.task,reminders:e};this.onUpdate(t)}openReminderModal(){new _l(this.plugin.app,this.plugin,this.task,t=>{this.saveReminders(t)}).open()}}});var _I,lke=y(()=>{du();_I=class{constructor(e){this.targetDoc=activeDocument;this.menu=new ki,this.options=e,this.buildMenu()}buildMenu(){this.getStatusOptions().forEach((t,n)=>{this.menu.addItem(i=>{let a=t.label;i.setIcon(t.icon||"circle"),t.value===this.options.currentValue&&(a=`\u2713 ${t.label}`),i.setTitle(a),i.onClick(async()=>{this.options.onSelect(t.value)})})})}getStatusOptions(){let e=this.options.plugin.settings.customStatuses,t=[];return e&&e.length>0&&[...e].sort((i,a)=>i.order-a.order).forEach(i=>{t.push({label:i.label,value:i.value,color:i.color,icon:i.icon})}),t}capitalizeFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}show(e){var t,n;(n=(t=e.target)==null?void 0:t.instanceOf)!=null&&n.call(t,HTMLElement)&&(this.targetDoc=e.target.ownerDocument),this.menu.show(e),window.setTimeout(()=>{this.applyColorStyling()},10)}showAtElement(e){this.targetDoc=e.ownerDocument,this.menu.showAtPosition({x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().bottom+4}),window.setTimeout(()=>{this.applyColorStyling()},10)}applyColorStyling(){let e=this.getStatusOptions(),t=this.targetDoc.querySelector(".menu");if(!t)return;let n=t.querySelectorAll(".menu-item");e.forEach((i,a)=>{let s=n[a];if(s&&i.color){let o=s.querySelector(".menu-item-icon");o&&(o.style.color=i.color)}})}}});function cke(r,e){let t=Mrt(r.getState(),e);new Ih(r.app,{currentDate:t?ke(t):void 0,currentTime:t?_a(t):void 0,title:_rt(r,e),dateRole:e,plugin:r.plugin,onSelect:(i,a)=>{r.setDate(e,Drt(i,a)),r.onChange()}}).open()}function dke(r,e){new _I({currentValue:r.getState().status,onSelect:n=>{r.setStatus(n),r.onChange()},plugin:r.plugin}).show(e)}function uke(r,e){new ku({currentValue:r.getState().priority,onSelect:n=>{r.setPriority(n),r.onChange()},plugin:r.plugin}).show(e)}function pke(r,e){let t=r.getState();new Ml({currentValue:t.recurrenceRule,currentAnchor:t.recurrenceAnchor,scheduledDate:t.scheduledDate,onSelect:(i,a)=>{r.setRecurrence(i||"",a),r.onChange()},app:r.app,plugin:r.plugin}).show(e)}function AI(r,e,t){new MI(r.plugin,Prt(r.getState(),t),e.target,i=>{r.setReminders(i.reminders||[]),r.onChange()}).show(e)}function Drt(r,e){return r?e?Ni(r,e):r:""}function Prt(r,e){return{...e,title:r.title,status:r.status,priority:r.priority,due:r.dueDate,scheduled:r.scheduledDate,path:(e==null?void 0:e.path)||"",archived:(e==null?void 0:e.archived)||!1,reminders:r.reminders}}function Mrt(r,e){return e==="due"?r.dueDate:r.scheduledDate}function _rt(r,e){return e==="due"?r.translate("modals.task.dateMenu.dueTitle"):r.translate("modals.task.dateMenu.scheduledTitle")}var OV=y(()=>{Mx();ab();oke();lke();Ne();BA()});function II(r,e){return{file:r,name:r.basename,link:e}}function hke(r,e,t){let n=[...r];for(let i of e){let a=Art(i,t);!a||LV(n,a)||n.push(a)}return n}function gke(r,e){return r.filter(t=>t!==e)}function yke(r){return r.map(e=>e.link).join(", ")}function Art(r,e){if(!r||typeof r!="string"||r.trim()==="")return null;let t=r.match(/^\[\[([^\]]+)\]\]$/);if(t)return Nrt(r,t[1],e);let n=r.match(/^\[([^\]]*)\]\(([^)]+)\)$/);return n?Rrt(r,n,e):Ort(r,e)}function LV(r,e){let t=mke(e);return r.some(n=>{let i=mke(n);return t.some(a=>i.includes(a))})}function mke(r){var n;let e=new Set;(n=r.file)!=null&&n.path&&e.add(`path:${fke(r.file.path)}`);let t=jt(r.link);return t&&e.add(`path:${fke(t)}`),r.link&&e.add(`link:${r.link.trim().toLowerCase()}`),Array.from(e)}function fke(r){return r.trim().replace(/\.md$/i,"").toLowerCase()}function vke({app:r,listEl:e,items:t,sourcePath:n,translate:i,onRemove:a}){if(!e||(e.empty(),t.length===0))return;let s={metadataCache:r.metadataCache,workspace:r.workspace};for(let o of t){let l=e.createDiv({cls:"task-project-item"});o.unresolved&&l.addClass("task-project-item--unresolved");let c=l.createDiv({cls:"task-project-info"}),d=c.createDiv({cls:"task-project-name clickable-project"});if(o.file){let p=Z_(r,o.file,n,o.file.name);Irt(d,[p],s),o.file.path!==o.file.name&&c.createDiv({cls:"task-project-path",text:o.file.path})}else d.textContent=o.name,(0,Tb.setTooltip)(d,i("contextMenus.task.dependencies.notices.unresolved",{name:o.name}),{placement:"top"});let u=l.createEl("button",{cls:"task-project-remove",text:"\xD7"});(0,Tb.setTooltip)(u,i("modals.task.projectsRemoveTooltip"),{placement:"top"}),u.addEventListener("click",()=>{a(o)})}}function Irt(r,e,t){nb(r,e,t),Array.from(r.childNodes).forEach(n=>{var i;n.nodeType===Node.TEXT_NODE&&((i=n.textContent)==null?void 0:i.trim())==="+"&&n.remove()})}function Nrt(r,e,t){let n=t.resolveLink(e,t.sourcePath);return n instanceof Tb.TFile?II(n,r):{name:e.split("|")[0],link:r,unresolved:!0}}function Rrt(r,e,t){let n=jt(r),i=t.resolveLink(n,t.sourcePath);return i instanceof Tb.TFile?II(i,r):{name:e[1]||n,link:r,unresolved:!0}}function Ort(r,e){let t=e.getMarkdownFiles().find(n=>n.basename===r||n.name===`${r}.md`);return t?{file:t,name:t.basename,link:`[[${t.basename}]]`}:{name:r,link:r,unresolved:!0}}var Tb,bke=y(()=>{Tb=require("obsidian");Kp();jn()});function Tke(r,e,t){let n=new Set(e.map(i=>i.path));return r.filter(i=>t&&i.path===t?!1:!n.has(i.path))}function kke(r,e){return Lrt(r,e)?[...r]:[...r,e]}function wke(r,e){return r.filter(t=>t.path!==e.path)}function Lrt(r,e){return r.some(t=>t.path===e.path)}async function Ske({app:r,listEl:e,files:t,sourcePath:n,getCachedTaskInfo:i,createTaskCard:a,translate:s,onRemove:o}){if(!e||(e.empty(),t.length===0))return;let l={metadataCache:r.metadataCache,workspace:r.workspace};for(let c of t){if(!(c instanceof NI.TFile))return;let d=e.createDiv({cls:"task-project-item task-project-item--task-card"}),u=d.createDiv({cls:"task-project-card-host"}),p=await i(c.path);p?u.appendChild(a(p)):Frt(r,u,c,n,l);let m=d.createEl("button",{cls:"task-project-remove",text:"\xD7"});(0,NI.setTooltip)(m,s("modals.task.organization.removeSubtaskTooltip"),{placement:"top"}),m.addEventListener("click",()=>{o(c)})}}function Frt(r,e,t,n,i){let a=e.createDiv({cls:"task-project-info"}),s=a.createDiv({cls:"task-project-name clickable-project"}),o=Z_(r,t,n,t.name);$rt(s,[o],i),t.path!==t.name&&a.createDiv({cls:"task-project-path",text:t.path})}function $rt(r,e,t){nb(r,e,t),Array.from(r.childNodes).forEach(n=>{var i;n.nodeType===Node.TEXT_NODE&&((i=n.textContent)==null?void 0:i.trim())==="+"&&n.remove()})}var NI,Eke=y(()=>{NI=require("obsidian");Kp();jn()});async function RI({plugin:r,getAllTasks:e=async()=>{var u,p,m;return(m=await((p=(u=r.cacheManager).getAllTasks)==null?void 0:p.call(u)))!=null?m:[]},getCandidates:t,onSelect:n,translate:i,noEligibleTasksMessageKey:a,openFailedMessageKey:s,logOperation:o,openSelector:l=Pn,showNotice:c=u=>{new xke.Notice(u)},logger:d=zrt}){var u;try{let p=(u=await e())!=null?u:[],m=[...t(p)];return m.length===0?(c(i(a)),"empty"):(l(r,m,f=>{f&&n(f)}),"opened")}catch(p){return d.error("Failed to open task selector",{category:"stale-data",operation:o,error:p}),c(i(s)),"error"}}var xke,zrt,Cke=y(()=>{xke=require("obsidian");G();No();zrt=I({tag:"TaskModal/TaskSelector"})});function Mke({container:r,className:e,placeholder:t,value:n,onChange:i,attachFocusScrollGuard:a}){let s=r.createEl("textarea",{cls:e});return s.placeholder=t,s.rows=1,s.spellcheck=!0,s.setAttribute("aria-label",t),s.addEventListener("keydown",o=>{o.key==="Enter"&&!o.ctrlKey&&!o.metaKey&&o.preventDefault()}),jrt(s,{value:n,onChange:i,attachFocusScrollGuard:a}),s}function jrt(r,{value:e,onChange:t,attachFocusScrollGuard:n}){r.value=e,r.addEventListener("input",i=>{let a=i.target,s=Brt(a.value);a.value!==s&&(a.value=s),t(s),Dke(a)}),n==null||n(r),Dke(r)}function Brt(r){return r.replace(/\s*\n+\s*/g," ")}function Dke(r){var u;let e=r.ownerDocument.defaultView,t=(u=e==null?void 0:e.HTMLTextAreaElement)!=null?u:HTMLTextAreaElement;if(!(r instanceof t))return;let n=e==null?void 0:e.getComputedStyle(r),i=n?Number.parseFloat(n.lineHeight):0,a=n&&Number.parseFloat(n.paddingTop)||0,s=n&&Number.parseFloat(n.paddingBottom)||0,o=n&&Number.parseFloat(n.borderTopWidth)||0,l=n&&Number.parseFloat(n.borderBottomWidth)||0,c=(i>0?i*3:72)+a+s+o+l;Pke(r,{"--tn-task-modal-title-height":"auto"});let d=Math.min(r.scrollHeight,c);Pke(r,{"--tn-task-modal-title-height":`${d}px`,"--tn-task-modal-title-overflow-y":r.scrollHeight>c?"auto":"hidden"})}function Pke(r,e){if(typeof r.setCssProps=="function"){r.setCssProps(e);return}for(let[t,n]of Object.entries(e))r.style.setProperty(t,n)}var _ke=y(()=>{});function FI({detailsContainer:r,splitRightColumn:e}){LI(r),r.classList.add(OI),e&&(LI(e),e.classList.add(OI))}function Lke({containerEl:r,detailsContainer:e,splitRightColumn:t,timerWindow:n}){var a;LI(e,OI),e.classList.add(Hrt),r.classList.add("expanded"),t&&(LI(t,OI),t.style.removeProperty("display")),e.classList.remove(Ike,Nke),e.classList.add(Ake),e.classList.remove(Oke),e.classList.add(Rke),((a=n!=null?n:e.ownerDocument.defaultView)!=null?a:window).setTimeout(()=>{e.classList.remove(Ike,Ake),e.classList.add(Nke),e.classList.remove(Rke),e.classList.add(Oke)},50)}function LI(r,...e){r.classList.remove(...Urt,...e)}var Urt,OI,Hrt,Ake,Ike,Nke,Rke,Oke,FV=y(()=>{Urt=["tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"],OI="tn-static-display-none-6b99de8b",Hrt="tn-static-display-block-2a1b75c9",Ake="tn-static-opacity-0-8d919cb5",Ike="tn-static-opacity-0-6-d95b59ac",Nke="tn-static-opacity-1-c6e7979d",Rke="tn-static-transform-translatey-10px-5b91bf02",Oke="tn-static-transform-translatey-0-1b976432"});function Fke(r,e){var t;return((t=r.instanceOf)==null?void 0:t.call(r,e))===!0||e.prototype.isPrototypeOf(r)}var $I,$ke=y(()=>{$I=class{constructor(e){this.guardedTitleInputs=new WeakSet;this.guardedMobileKeyboardInputs=new WeakSet;this.pendingTitleFocusScrollPositions=null;this.mobileKeyboardFocusCleanups=[];this.mobileKeyboardScrollTimers=[];this.elements=e}focusTitleInput(e){this.getWindow().setTimeout(()=>{this.pendingTitleFocusScrollPositions=this.captureTitleFocusScrollPositions(e),e.focus({preventScroll:!0}),e.select(),this.restoreTitleFocusScrollPositions(this.pendingTitleFocusScrollPositions)},this.getInitialFocusDelay())}getInitialFocusDelay(){return this.isMobileLikeEnvironment()?350:100}isMobileLikeEnvironment(){var n,i;let e=this.elements.containerEl.ownerDocument,t=e.defaultView||window;return e.body.classList.contains("is-mobile")||((i=(n=t.matchMedia)==null?void 0:n.call(t,"(pointer: coarse)"))==null?void 0:i.matches)===!0}attachTitleFocusScrollGuard(e){if(this.guardedTitleInputs.has(e))return;this.guardedTitleInputs.add(e);let t=()=>{this.pendingTitleFocusScrollPositions=this.captureTitleFocusScrollPositions(e)};e.addEventListener("pointerdown",t,{capture:!0}),e.addEventListener("touchstart",t,{capture:!0}),e.addEventListener("focus",()=>{this.pendingTitleFocusScrollPositions&&this.scheduleTitleFocusScrollRestore(this.pendingTitleFocusScrollPositions)})}attachMobileKeyboardScrollGuard(e,t={}){var s;if(this.guardedMobileKeyboardInputs.has(e))return;this.guardedMobileKeyboardInputs.add(e);let n=(s=t.scrollOnFocus)!=null?s:!0,i=()=>{this.isMobileLikeEnvironment()&&(this.elements.containerEl.addClass("is-mobile-keyboard-focused"),n&&this.scheduleMobileKeyboardScrollIntoView(e))},a=()=>{(e.ownerDocument.defaultView||window).setTimeout(()=>{let l=e.ownerDocument.activeElement;(!l||!this.elements.modalEl.contains(l)||!this.isKeyboardTextEntryElement(l))&&this.elements.containerEl.removeClass("is-mobile-keyboard-focused")},100)};e.addEventListener("focus",i),e.addEventListener("blur",a),this.mobileKeyboardFocusCleanups.push(()=>{e.removeEventListener("focus",i),e.removeEventListener("blur",a)})}destroy(){for(let t of this.mobileKeyboardFocusCleanups)t();this.mobileKeyboardFocusCleanups=[];let e=this.getWindow();for(let t of this.mobileKeyboardScrollTimers)e.clearTimeout(t);this.mobileKeyboardScrollTimers=[],this.elements.containerEl.removeClass("is-mobile-keyboard-focused"),this.pendingTitleFocusScrollPositions=null}captureTitleFocusScrollPositions(e){if(!this.isMobileLikeEnvironment())return null;let t=new Set,n=a=>{var l;let s=a==null?void 0:a.ownerDocument.defaultView,o=(l=s==null?void 0:s.HTMLElement)!=null?l:HTMLElement;a instanceof o&&t.add(a)};n(this.elements.containerEl),n(this.elements.modalEl),n(this.elements.contentEl),this.elements.modalEl.querySelectorAll(".modal-content, .minimalist-modal-container, .modal-split-content, .modal-split-left, .modal-split-right, .details-container").forEach(n);let i=e.parentElement;for(;i&&i!==this.elements.containerEl.parentElement;)n(i),i=i.parentElement;return Array.from(t).map(a=>({element:a,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft}))}restoreTitleFocusScrollPositions(e){if(e)for(let{element:t,scrollTop:n,scrollLeft:i}of e)t.scrollTop=n,t.scrollLeft=i}scheduleTitleFocusScrollRestore(e){this.restoreTitleFocusScrollPositions(e);let t=this.getWindow();t.requestAnimationFrame?t.requestAnimationFrame(()=>this.restoreTitleFocusScrollPositions(e)):t.setTimeout(()=>this.restoreTitleFocusScrollPositions(e),16),t.setTimeout(()=>this.restoreTitleFocusScrollPositions(e),50),t.setTimeout(()=>{this.restoreTitleFocusScrollPositions(e),this.pendingTitleFocusScrollPositions===e&&(this.pendingTitleFocusScrollPositions=null)},250)}isKeyboardTextEntryElement(e){var s,o;let t=e.ownerDocument.defaultView||window,n=(s=t.HTMLInputElement)!=null?s:HTMLInputElement,i=(o=t.HTMLTextAreaElement)!=null?o:HTMLTextAreaElement;return Fke(e,i)?!0:Fke(e,n)?!new Set(["button","checkbox","color","file","hidden","radio","range","reset","submit"]).has(e.type):!1}scheduleMobileKeyboardScrollIntoView(e){let t=e.ownerDocument.defaultView||window;for(let n of[0,150,350]){let i=t.setTimeout(()=>{this.mobileKeyboardScrollTimers=this.mobileKeyboardScrollTimers.filter(a=>a!==i),this.scrollMobileKeyboardTargetIntoView(e)},n);this.mobileKeyboardScrollTimers.push(i)}}scrollMobileKeyboardTargetIntoView(e){var n;if(!this.isMobileLikeEnvironment())return;let t=(n=e.closest(".setting-item"))!=null?n:e;t.scrollIntoView({block:"nearest",inline:"nearest",behavior:"auto"}),this.nudgeFocusedFieldInsideVisualViewport(t)}nudgeFocusedFieldInsideVisualViewport(e){var d,u,p;let t=e.ownerDocument.defaultView||window,n=t.visualViewport,i=n&&Number.isFinite(n.height)?n.offsetTop+n.height:t.innerHeight;if(!Number.isFinite(i)||i<=0)return;let a=(u=(d=e.closest(".modal-split-content"))!=null?d:e.closest(".modal-content"))!=null?u:this.elements.contentEl,s=e.getBoundingClientRect(),o=a.getBoundingClientRect(),l=Math.max((p=n==null?void 0:n.offsetTop)!=null?p:0,o.top)+24,c=Math.min(i,o.bottom)-24;s.bottom>c?a.scrollTop+=s.bottom-c:s.top{Wx=require("obsidian");Wj();qde();eB();Ct();iS();ko();jn();sme();la();ITe();LTe();qTe();NV();YTe();QTe();ske();OV();bke();Eke();Cke();_ke();FV();$ke();G();Vrt=I({tag:"Modals/TaskModal"}),kb=class extends Wx.Modal{constructor(t,n){super(t);this.keyboardHandler=null;this.title="";this.details="";this.originalDetails="";this.dueDate="";this.scheduledDate="";this.priority="normal";this.status="open";this.contexts="";this.projects="";this.tags="";this.timeEstimate=0;this.recurrenceRule="";this.recurrenceAnchor="scheduled";this.reminders=[];this.userFields={};this.userFieldInputs=new Map;this.userFieldToggles=new Map;this.blockedByItems=[];this.blockingItems=[];this.selectedProjectItems=[];this.selectedSubtaskFiles=[];this.initialSubtaskFiles=[];this.detailsMarkdownEditor=null;this.isExpanded=!1;this.plugin=n,this.focusGuards=new $I({containerEl:this.containerEl,modalEl:this.modalEl,contentEl:this.contentEl})}createDependencyItemFromFile(t,n={}){var i;return DV({plugin:this.plugin,sourcePath:(i=n.sourcePath)!=null?i:this.getDependencySourcePath()},t)}createDependencyItemFromDependency(t,n){return CTe({plugin:this.plugin,sourcePath:n!=null?n:this.getDependencySourcePath()},t)}createDependencyItemFromPath(t){return DTe({plugin:this.plugin,sourcePath:this.getDependencySourcePath()},t)}getDependencySourcePath(){var t;return this.getCurrentTaskPath()||((t=this.plugin.app.workspace.getActiveFile())==null?void 0:t.path)||""}getCurrentTaskPath(){}getModalEditorFile(){let t=this.getCurrentTaskPath();if(!t)return this.app.workspace.getActiveFile();let n=this.app.vault.getAbstractFileByPath(t);return n instanceof Wx.TFile?n:this.app.workspace.getActiveFile()}async openTaskNote(){}renderDependencyLists(){this.renderBlockedByList(),this.renderBlockingList()}getLinkServices(){var t;return{metadataCache:this.plugin.app.metadataCache,workspace:this.plugin.app.workspace,sourcePath:this.getCurrentTaskPath()||((t=this.plugin.app.workspace.getActiveFile())==null?void 0:t.path)||""}}renderBlockedByList(){this.renderDependencyList(this.blockedByList,this.blockedByItems,t=>{this.blockedByItems=MV(this.blockedByItems,t),this.renderBlockedByList()})}renderBlockingList(){this.renderDependencyList(this.blockingList,this.blockingItems,t=>{this.blockingItems=MV(this.blockingItems,t),this.renderBlockingList()})}async renderDependencyList(t,n,i){t&&await PTe({plugin:this.plugin,listEl:t,items:n,linkServices:this.getLinkServices(),translate:(a,s)=>this.t(a,s),onRemove:i})}extractDetailsFromContent(t){let{body:n}=Np(t);return n.replace(/\r\n/g,` +`).trimEnd()}normalizeDetails(t){return t.replace(/\r\n/g,` +`).trimEnd()}addBlockedByTask(t){let n={uid:To(this.plugin.app,this.getDependencySourcePath(),t.path,this.plugin.settings.useFrontmatterMarkdownLinks),reltype:es};this.addBlockedByDependency(n)}addBlockingTask(t){this.addBlockingTaskFromPath(t.path)}addBlockedByDependency(t){let n=this.getDependencySourcePath(),i=this.createDependencyItemFromDependency(t,n),a=PV(this.blockedByItems,i);a.length!==this.blockedByItems.length&&(this.blockedByItems=a,this.renderBlockedByList())}addBlockingTaskFromPath(t){let n=this.getCurrentTaskPath();if(n&&t===n)return;let i=this.createDependencyItemFromPath(t),a=PV(this.blockingItems,i);a.length!==this.blockingItems.length&&(this.blockingItems=a,this.renderBlockingList())}async openBlockedBySelector(){let t=this.getDependencySourcePath();await RI({plugin:this.plugin,getCandidates:n=>_Te({plugin:this.plugin,sourcePath:t,allTasks:n,existingItems:this.blockedByItems,currentPath:this.getCurrentTaskPath()}),onSelect:n=>{let i={uid:To(this.plugin.app,t,n.path),reltype:es};this.addBlockedByDependency(i)},translate:n=>this.t(n),noEligibleTasksMessageKey:"contextMenus.task.dependencies.notices.noEligibleTasks",openFailedMessageKey:"contextMenus.task.dependencies.notices.updateFailed",logOperation:"open-blocked-by-selector"})}async openBlockingSelector(){let t=this.getDependencySourcePath();await RI({plugin:this.plugin,getCandidates:n=>ATe({plugin:this.plugin,sourcePath:t,allTasks:n,existingItems:this.blockingItems,currentPath:this.getCurrentTaskPath()}),onSelect:n=>{this.addBlockingTaskFromPath(n.path)},translate:n=>this.t(n),noEligibleTasksMessageKey:"contextMenus.task.dependencies.notices.noEligibleTasks",openFailedMessageKey:"contextMenus.task.dependencies.notices.updateFailed",logOperation:"open-blocking-selector"})}getApp(){return this.app}getPlugin(){return this.plugin}t(t,n){return this.plugin.i18n.translate(t,n)}getFileByPath(t){return this.app.vault.getAbstractFileByPath(t)}getMarkdownFiles(){return this.app.vault.getMarkdownFiles()}getFileCache(t){return this.app.metadataCache.getFileCache(t)}resolveLink(t,n){return this.app.metadataCache.getFirstLinkpathDest(t,n)}isEditMode(){return!1}isCreationMode(){return!1}async handleSubmitShortcut(t){await this.handleSave()}onOpen(){this.containerEl.addClass("tasknotes-plugin","minimalist-task-modal"),this.plugin.settings.enableModalSplitLayout&&this.containerEl.addClass("split-layout-enabled"),this.modalEl.addClass("mod-tasknotes"),this.titleEl.setText(this.getModalTitle()),this.keyboardHandler=t=>{if(t.key==="Enter"&&(t.ctrlKey||t.metaKey)){if(t.target.closest(".cm-editor"))return;t.preventDefault(),this.handleSubmitShortcut(t.shiftKey)}},this.containerEl.addEventListener("keydown",this.keyboardHandler),this.initializeFormData().then(()=>{this.createModalContent(),this.focusTitleInput()})}createModalContent(){let{contentEl:t}=this;t.empty();let n=t.createDiv("minimalist-modal-container");this.splitContentWrapper=n.createDiv("modal-split-content"),this.splitLeftColumn=this.splitContentWrapper.createDiv("modal-split-left"),this.createPrimaryInput(this.splitLeftColumn),this.createActionBar(this.splitLeftColumn),this.splitRightColumn=this.splitLeftColumn.createDiv("modal-split-right"),this.createDetailsSection(n),this.createAdditionalSections(this.splitLeftColumn),this.createActionButtons(n)}createPrimaryInput(t){this.createTitleInput(t)}createAdditionalSections(t){}createTitleInput(t){let n=t.createDiv("title-input-container");this.titleInput=this.createTitleTextarea(n,"title-input",this.t("modals.task.titlePlaceholder"))}createTitleTextarea(t,n,i){return Mke({container:t,className:n,placeholder:i,value:this.title,onChange:a=>{this.title=a},attachFocusScrollGuard:a=>{this.attachTitleFocusScrollGuard(a),this.attachMobileKeyboardScrollGuard(a,{scrollOnFocus:!1})}})}createActionBar(t){this.actionBar=t.createDiv("tn-task-modal__action-bar"),this.createCoreActionIcons(this.actionBar),this.updateIconStates()}createCoreActionIcons(t){return WTe(t,this.getCoreActionIconSpecs())}getCoreActionIconSpecs(){return[{iconName:"dot-square",tooltip:this.t("modals.task.actions.status"),onClick:(t,n)=>{this.showStatusContextMenu(n)},dataType:"status"},{iconName:"star",tooltip:this.t("modals.task.actions.priority"),onClick:(t,n)=>{this.showPriorityContextMenu(n)},dataType:"priority"},{iconName:"calendar",tooltip:this.t("modals.task.actions.due"),onClick:(t,n)=>{this.showDateContextMenu(n,"due")},dataType:"due-date"},{iconName:"calendar-clock",tooltip:this.t("modals.task.actions.scheduled"),onClick:(t,n)=>{this.showDateContextMenu(n,"scheduled")},dataType:"scheduled-date"},{iconName:"refresh-ccw",tooltip:this.t("modals.task.actions.recurrence"),onClick:(t,n)=>{this.showRecurrenceContextMenu(n)},dataType:"recurrence"},{iconName:"bell",tooltip:this.t("modals.task.actions.reminders"),onClick:(t,n)=>{this.showReminderContextMenu(n)},dataType:"reminders"}]}createActionIcon(t,n,i,a,s){return RV(t,{iconName:n,tooltip:i,onClick:a,dataType:s})}createDetailsSection(t){this.userFieldInputs.clear(),this.userFieldToggles.clear(),this.detailsContainer=this.splitLeftColumn?this.splitLeftColumn.createDiv("details-container"):t.createDiv("details-container"),this.isExpanded||FI({detailsContainer:this.detailsContainer,splitRightColumn:this.splitRightColumn});let n=this.plugin.settings.modalFieldsConfig,i=this.shouldShowField("title",n),a=this.shouldShowField("details",n);this.splitContentWrapper.classList.toggle("modal-split-content--right-empty",!a);let s=this.isEditMode(),o=this.isCreationMode()&&this.plugin.settings.enableNaturalLanguageInput;if(i&&(s||o)){let l=this.detailsContainer.createDiv("detail-label");l.textContent=this.t("modals.task.titleLabel");let c=this.createTitleTextarea(this.detailsContainer,"title-input-detailed",this.t("modals.task.titleDetailedPlaceholder"));(s||o)&&!this.titleInput&&(this.titleInput=c)}if(a){let l=this.splitRightColumn||this.detailsContainer;this.detailsMarkdownEditor=Zde({app:this.app,parent:l,label:this.t("modals.task.detailsLabel"),value:this.details,placeholder:this.t("modals.task.detailsPlaceholder"),file:this.getModalEditorFile(),tabMovesFocus:this.plugin.settings.taskModalTabMovesFocus,onChange:c=>{this.details=c},onSubmit:c=>{this.handleSubmitShortcut(c)},onEscape:()=>{this.close()},focusNextField:()=>this.focusNextField(),focusPreviousField:()=>this.focusPreviousField()})}this.createAdditionalFields(this.detailsContainer)}shouldShowField(t,n){return Ude(t,n,this.isCreationMode())}createAdditionalFields(t){let n=this.plugin.settings.modalFieldsConfig;if(!n){Vrt.error("TaskModal: modalFieldsConfig is not initialized. This should never happen.",{category:"configuration",operation:"taskmodal-modalfieldsconfig-not-initialized-this-should-never-happen"});return}this.createFieldsFromConfig(t,n)}createFieldsFromConfig(t,n){Vde({container:t,config:n,isCreationMode:this.isCreationMode(),fieldRenderers:this.getFieldRenderers(),renderUserField:(i,a)=>{this.createUserFieldByConfig(i,a)}})}createField(t,n){Yj({container:t,fieldConfig:n,fieldRenderers:this.getFieldRenderers(),renderUserField:(i,a)=>{this.createUserFieldByConfig(i,a)}})}getFieldRenderers(){return{contexts:t=>this.createContextsField(t),tags:t=>this.createTagsField(t),"time-estimate":t=>this.createTimeEstimateField(t),projects:t=>this.createProjectsField(t),subtasks:t=>this.createSubtasksField(t),"blocked-by":t=>this.createBlockedByField(t),blocking:t=>this.createBlockingField(t)}}createContextsField(t){this.contextsInput=NTe(this.getMetadataFieldContext(),{container:t,value:this.contexts,onChange:n=>{this.contexts=n}})}createTagsField(t){this.tagsInput=RTe(this.getMetadataFieldContext(),{container:t,value:this.tags,onChange:n=>{this.tags=n}})}createTimeEstimateField(t){this.timeEstimateInput=OTe(this.getMetadataFieldContext(),{container:t,value:this.timeEstimate,onChange:n=>{this.timeEstimate=n}})}getMetadataFieldContext(){return{app:this.app,plugin:this.plugin,translate:t=>this.t(t),attachMobileKeyboardScrollGuard:t=>{this.attachMobileKeyboardScrollGuard(t)}}}createProjectsField(t){this.projectsList=rme(this.getOrganizationFieldContext(),{container:t,onButtonClick:()=>{new yc(this.app,this.plugin,i=>{this.addProject(i)}).open()},listElement:this.projectsList}),this.renderOrganizationLists()}createSubtasksField(t){this.subtasksList=nme(this.getOrganizationFieldContext(),{container:t,onButtonClick:()=>{this.openSubtaskSelector()},listElement:this.subtasksList}),this.renderOrganizationLists()}getOrganizationFieldContext(){return{translate:t=>this.t(t)}}getUserFieldContext(){return{app:this.app,plugin:this.plugin,translate:(t,n)=>this.t(t,n),attachMobileKeyboardScrollGuard:t=>{this.attachMobileKeyboardScrollGuard(t)}}}createBlockedByField(t){this.blockedByList=ime(this.getOrganizationFieldContext(),{container:t,onButtonClick:()=>{this.openBlockedBySelector()},listElement:this.blockedByList}),this.renderDependencyLists()}createBlockingField(t){this.blockingList=ame(this.getOrganizationFieldContext(),{container:t,onButtonClick:()=>{this.openBlockingSelector()},listElement:this.blockingList}),this.renderDependencyLists()}createUserFieldByConfig(t,n){var a;let i=(a=this.plugin.settings.userFields)==null?void 0:a.find(s=>s.id===n.id);i&&UTe(this.getUserFieldContext(),{container:t,field:i,values:this.userFields,inputRefs:this.userFieldInputs,toggleRefs:this.userFieldToggles,onValueChange:(s,o)=>{this.userFields[s]=o}})}updateUserFieldControls(){var t;VTe({fields:((t=this.plugin.settings)==null?void 0:t.userFields)||[],values:this.userFields,inputRefs:this.userFieldInputs,toggleRefs:this.userFieldToggles})}createUserFields(t){var n;HTe(this.getUserFieldContext(),{container:t,fields:((n=this.plugin.settings)==null?void 0:n.userFields)||[],values:this.userFields,inputRefs:this.userFieldInputs,toggleRefs:this.userFieldToggles,onValueChange:(i,a)=>{this.userFields[i]=a}})}createActionButtons(t){let n=[];this.isEditMode()&&n.push({className:"tn-task-modal__open-note-button",text:this.t("modals.task.buttons.openNote"),onClick:()=>{this.openTaskNote()}}),DI(this.getActionButtonContext(),{container:t,leadingButtons:n,onSave:()=>this.handleSave(),onSaved:()=>{this.close()},onCancel:()=>{this.close()}})}getActionButtonContext(){return{translate:t=>this.t(t)}}expandModal(){this.isExpanded||(this.isExpanded=!0,Lke({containerEl:this.containerEl,detailsContainer:this.detailsContainer,splitRightColumn:this.splitRightColumn}))}showDateContextMenu(t,n){cke(this.getActionMenuContext(),n)}showStatusContextMenu(t){dke(this.getActionMenuContext(),t)}showPriorityContextMenu(t){uke(this.getActionMenuContext(),t)}showRecurrenceContextMenu(t){pke(this.getActionMenuContext(),t)}showReminderContextMenu(t){AI(this.getActionMenuContext(),t)}getActionMenuState(){return nke({title:this.title,status:this.status,priority:this.priority,dueDate:this.dueDate,scheduledDate:this.scheduledDate,recurrenceRule:this.recurrenceRule,recurrenceAnchor:this.recurrenceAnchor,reminders:this.reminders})}getActionMenuContext(){return ike({app:this.app,plugin:this.plugin,translate:(t,n)=>this.t(t,n),getState:()=>this.getActionMenuState(),setDueDate:t=>{this.dueDate=t},setScheduledDate:t=>{this.scheduledDate=t},setStatus:t=>{this.status=t},setPriority:t=>{this.priority=t},setRecurrenceRule:t=>{this.recurrenceRule=t},setRecurrenceAnchor:t=>{this.recurrenceAnchor=t},setReminders:t=>{this.reminders=t},onChange:()=>this.updateIconStates()})}updateDateIconState(){this.updateIconStates()}updateStatusIconState(){this.updateIconStates()}updatePriorityIconState(){this.updateIconStates()}updateRecurrenceIconState(){this.updateIconStates()}updateReminderIconState(){this.updateIconStates()}updateIconStates(){let t=this.getActionMenuState();KTe(this.actionBar,{translate:(n,i)=>this.t(n,i)},ake(t,{statusConfigs:this.plugin.settings.customStatuses||[],priorityConfigs:this.plugin.settings.customPriorities||[]}))}focusTitleInput(){this.focusGuards.focusTitleInput(this.titleInput)}getInitialFocusDelay(){return this.focusGuards.getInitialFocusDelay()}isMobileLikeEnvironment(){return this.focusGuards.isMobileLikeEnvironment()}attachTitleFocusScrollGuard(t){this.focusGuards.attachTitleFocusScrollGuard(t)}attachMobileKeyboardScrollGuard(t,n){this.focusGuards.attachMobileKeyboardScrollGuard(t,n)}addProject(t){if(t instanceof Wx.TFile){let n=II(t,this.buildProjectReference(t,this.getCurrentTaskPath()||""));if(LV(this.selectedProjectItems,n))return;this.selectedProjectItems.push(n)}this.updateProjectsFromFiles(),this.renderProjectsList()}removeProject(t){this.selectedProjectItems=gke(this.selectedProjectItems,t),this.updateProjectsFromFiles(),this.renderProjectsList()}updateProjectsFromFiles(){this.projects=yke(this.selectedProjectItems)}buildProjectReference(t,n){return js(this.app,t,n,"","",this.plugin.settings.useFrontmatterMarkdownLinks)}initializeProjectsFromStrings(t){this.selectedProjectItems=[],this.addProjectsFromStrings(t)}addProjectsFromStrings(t){this.selectedProjectItems=hke(this.selectedProjectItems,t,this.getProjectStringContext()),this.updateProjectsFromFiles()}getProjectStringContext(){return{sourcePath:this.getCurrentTaskPath()||"",getMarkdownFiles:()=>this.getMarkdownFiles(),resolveLink:(t,n)=>this.resolveLink(t,n)}}renderProjectsList(){vke({app:this.app,listEl:this.projectsList,items:this.selectedProjectItems,sourcePath:this.getCurrentTaskPath()||"",translate:(t,n)=>this.t(t,n),onRemove:t=>this.removeProject(t)})}async openSubtaskSelector(){await RI({plugin:this.plugin,getCandidates:t=>Tke(t,this.selectedSubtaskFiles,this.getCurrentTaskPath()),onSelect:t=>{let n=this.app.vault.getAbstractFileByPath(t.path);n&&this.addSubtask(n)},translate:t=>this.t(t),noEligibleTasksMessageKey:"modals.task.organization.notices.noEligibleSubtasks",openFailedMessageKey:"modals.task.organization.notices.subtaskSelectFailed",logOperation:"open-subtask-selector"})}addSubtask(t){let n=kke(this.selectedSubtaskFiles,t);n.length!==this.selectedSubtaskFiles.length&&(this.selectedSubtaskFiles=n,this.renderSubtasksList())}removeSubtask(t){this.selectedSubtaskFiles=wke(this.selectedSubtaskFiles,t),this.renderSubtasksList()}async renderSubtasksList(){await Ske({app:this.app,listEl:this.subtasksList,files:this.selectedSubtaskFiles,sourcePath:this.getCurrentTaskPath()||"",getCachedTaskInfo:t=>this.plugin.cacheManager.getCachedTaskInfo(t),createTaskCard:t=>Sr(t,this.plugin,void 0,{layout:"default",showSecondaryBadges:!1,enableHoverPreview:!1}),translate:(t,n)=>this.t(t,n),onRemove:t=>this.removeSubtask(t)})}renderOrganizationLists(){this.renderProjectsList(),this.renderSubtasksList()}toggleProjectsList(){this.projectsList&&this.projectsList.toggleClass("collapsed",!this.projectsList.hasClass("collapsed"))}toggleSubtasksList(){this.subtasksList&&this.subtasksList.toggleClass("collapsed",!this.subtasksList.hasClass("collapsed"))}validateForm(){return this.title.trim().length>0}focusNextField(){let t=this.contextsInput||this.tagsInput||this.timeEstimateInput;return t?(window.setTimeout(()=>{t.focus()},50),!0):!1}focusPreviousField(){return this.titleInput?(window.setTimeout(()=>{var t;(t=this.titleInput)==null||t.focus()},50),!0):!1}onClose(){this.keyboardHandler&&(this.containerEl.removeEventListener("keydown",this.keyboardHandler),this.keyboardHandler=null),this.focusGuards.destroy(),Jde(this.detailsMarkdownEditor),this.detailsMarkdownEditor=null,super.onClose()}}});var zI,zke=y(()=>{zI=class{constructor(e,t=[]){this.config=e,this.userFields=t,this.triggerMap=new Map,this.propertyMap=new Map,this.buildMaps()}buildMaps(){this.triggerMap.clear(),this.propertyMap.clear();for(let e of this.config.triggers)e.enabled&&(this.triggerMap.set(e.trigger,e),this.propertyMap.set(e.propertyId,e))}getTriggerForProperty(e){return this.propertyMap.get(e)}getPropertyForTrigger(e){var t;return(t=this.triggerMap.get(e))==null?void 0:t.propertyId}getAllEnabledTriggers(){return this.config.triggers.filter(e=>e.enabled)}getTriggersOrderedByLength(){return this.getAllEnabledTriggers().sort((e,t)=>t.trigger.length-e.trigger.length)}usesNativeTagSuggester(){let e=this.getTriggerForProperty("tags");return(e==null?void 0:e.trigger)==="#"&&(e==null?void 0:e.enabled)}getTagTrigger(){let e=this.getTriggerForProperty("tags");return e!=null&&e.enabled?e.trigger:void 0}getContextTrigger(){let e=this.getTriggerForProperty("contexts");return e!=null&&e.enabled?e.trigger:void 0}getProjectTrigger(){let e=this.getTriggerForProperty("projects");return e!=null&&e.enabled?e.trigger:void 0}getStatusTrigger(){let e=this.getTriggerForProperty("status");return e!=null&&e.enabled?e.trigger:void 0}getPriorityTrigger(){let e=this.getTriggerForProperty("priority");return e!=null&&e.enabled?e.trigger:void 0}getUserField(e){return this.userFields.find(t=>t.id===e)}isUserField(e){return this.userFields.some(t=>t.id===e)}getSuggesterType(e){if(e==="tags")return this.usesNativeTagSuggester()?"native-tag":"list";if(e==="contexts")return"list";if(e==="projects")return"file";if(e==="status")return"status";if(e==="priority")return"priority";let t=this.getUserField(e);if(t)switch(t.type){case"text":case"list":return t.autosuggestFilter?"file":"list";case"boolean":return"boolean";default:return"none"}return"none"}updateConfig(e){this.config=e,this.buildMaps()}updateUserFields(e){this.userFields=e}}});function Bke(r){let e=(0,Lc.autocompletion)({override:[Yrt(r)],activateOnTyping:!0,closeOnBlur:!0,maxRenderedOptions:10,addToOptions:[{render:(n,i,a)=>Grt(n,a.dom.ownerDocument),position:100}]}),t=zV.Prec.high(jke.keymap.of([{key:"ArrowDown",run:(0,Lc.moveCompletionSelection)(!0)},{key:"ArrowUp",run:(0,Lc.moveCompletionSelection)(!1)},{key:"Enter",run:Lc.acceptCompletion},{key:"Tab",run:Lc.acceptCompletion},{key:"Escape",run:Lc.closeCompletion}]));return[zV.Prec.high(e),t]}function Yrt(r){return async e=>{let t=new zI(r.settings.nlpTriggers,r.settings.userFields||[]),n=e.state.doc.lineAt(e.pos),i=n.text.slice(0,e.pos-n.from),a=(p,m)=>{if(p===-1)return!1;if(p===0)return!0;let f=m[p-1];return!/\w/.test(f)},s=t.getTriggersOrderedByLength(),o=[];for(let p of s){if(p.propertyId==="tags"&&p.trigger==="#")continue;let m=i.lastIndexOf(p.trigger);a(m,i)&&o.push({propertyId:p.propertyId,trigger:p.trigger,index:m,triggerLength:p.trigger.length})}if(o.length===0)return null;o.sort((p,m)=>m.index-p.index);let l=o[0],c=l.index+l.triggerLength,d=i.slice(c);if(l.propertyId==="projects"&&/^\[\[[^\]]*\]\]/.test(d)||l.propertyId!=="projects"&&(d.includes(" ")||d.includes(` +`)))return null;let u=await Krt(l.propertyId,d,r,t);return!u||u.length===0?null:{from:n.from+l.index+l.triggerLength,to:e.pos,options:u,validFor:/^[\w\s-]*$/}}}function Grt(r,e=activeDocument){let t=r;if(!t.projectMetadata)return null;let n=e.createElement("div");n.className="cm-project-suggestion__metadata";for(let i of t.projectMetadata){let a=e.createElement("div");a.className="cm-project-suggestion__meta",i.forEach((s,o)=>{o>0&&a.appendChild(e.createTextNode(" "));let l=e.createElement("span");l.className=s.kind==="value"?"cm-project-suggestion__meta-value":s.kind==="label"?"cm-project-suggestion__meta-label":"cm-project-suggestion__meta-literal",s.searchable&&l.classList.add("cm-project-suggestion__meta-searchable"),s.searchable&&t.projectQuery?Xrt(l,s.text,t.projectQuery):l.textContent=s.text,a.appendChild(l)}),n.appendChild(a)}return n}async function Krt(r,e,t,n){switch(n.getSuggesterType(r)){case"list":return Zrt(r,e,t);case"file":return Qrt(r,e,t,n);case"status":return ent(e,t);case"priority":return tnt(e,t);case"boolean":return rnt(e);case"native-tag":return null;default:return null}}function Zrt(r,e,t){let n=[],i=r;switch(r){case"tags":n=t.cacheManager.getAllTags(),i="Tag";break;case"contexts":n=t.cacheManager.getAllContexts(),i="Context";break;default:n=[],i=r;break}return n.filter(a=>a&&typeof a=="string").filter(a=>a.toLowerCase().includes(e.toLowerCase())).slice(0,10).map(a=>({label:a,apply:a+" ",type:"text",info:i}))}async function Qrt(r,e,t,n){var i,a,s;try{let o;if(r==="projects")o=t.settings.projectAutosuggest;else{let c=n.getUserField(r);o=c==null?void 0:c.autosuggestFilter}let l=await JB.suggest(t,e,20,o);if(r==="projects"){let c=new Rp({getFrontmatter:u=>u.frontmatter}),d=((s=(a=(i=t.settings)==null?void 0:i.projectAutosuggest)==null?void 0:a.rows)!=null?s:[]).slice(0,3);return l.map(u=>{var g;let p=u.displayText||u.insertText,m=u.insertText,f=t.app.vault.getMarkdownFiles().find(v=>v.basename===u.insertText),h=[];if(f&&d.length>0){let v=t.app.metadataCache.getFileCache(f),k=(v==null?void 0:v.frontmatter)||{},b=t.fieldMapper.mapFromFrontmatter(k,f.path,t.settings.storeTitleInFilename),w=typeof b.title=="string"?b.title:"",S=Array.isArray(k.aliases)?k.aliases.filter(C=>typeof C=="string"):[],x={basename:f.basename,name:f.name,path:f.path,parent:((g=f.parent)==null?void 0:g.path)||"",title:w,aliases:S,frontmatter:k};h=Jrt(d,x,c)}return{label:p,apply:`[[${m}]] `,type:"text",info:"Project",projectMetadata:h.length>0?h:void 0,projectQuery:e}})}return l.map(c=>{let d=c.displayText||c.insertText,u=c.insertText;return{label:d,apply:`[[${u}]] `,type:"text",info:r==="projects"?"Project":r}})}catch(o){return qrt.error(`Error getting file suggestions for ${r}:`,{category:"persistence",operation:"getting-file-suggestions",error:o}),[]}}function Jrt(r,e,t){var a;let n=[],i=Math.min(r.length,3);for(let s=0;sd.text.trim().length>0)&&n.push(c)}catch(l){}}return n}function Xrt(r,e,t){let n=r.ownerDocument,i=t.toLowerCase().split(/\s+/).filter(Boolean);if(i.length===0){r.textContent=e;return}let a=e.toLowerCase(),s=[];for(let c of i){let d=a.indexOf(c);for(;d!==-1;)s.push({start:d,end:d+c.length}),d=a.indexOf(c,d+1)}s.sort((c,d)=>c.start-d.start);let o=[];for(let c of s){let d=o[o.length-1];(!d||c.start>=d.end)&&o.push(c)}if(o.length===0){r.textContent=e;return}let l=0;for(let c of o){c.start>l&&r.appendChild(n.createTextNode(e.slice(l,c.start)));let d=n.createElement("mark");d.textContent=e.slice(c.start,c.end),r.appendChild(d),l=c.end}l({label:i.display,apply:i.value+" ",type:"text",info:"Status"}))}function tnt(r,e){return(e.settings.customPriorities||[]).filter(n=>n.label.toLowerCase().includes(r.toLowerCase())).slice(0,10).map(n=>({label:n.label,apply:n.value+" ",type:"text",info:"Priority"}))}function rnt(r){return["true","false"].filter(t=>t.toLowerCase().includes(r.toLowerCase())).map(t=>({label:t,apply:t+" ",type:"text",info:"Boolean"}))}var Lc,zV,jke,qrt,Wrt,Uke=y(()=>{Lc=require("@codemirror/autocomplete"),zV=require("@codemirror/state"),jke=require("@codemirror/view");wc();zke();nS();V_();tS();G();qrt=I({tag:"Editor/NLPCodeMirrorAutocomplete"}),Wrt=new Set(["title","aliases","file.basename"])});function Hke(r){let e=Ye(),t=r.contexts.split(",").map(l=>l.trim()).filter(l=>l.length>0),n=zs(r.projects),i=Ri(r.tags).split(",").map(l=>l.trim()).filter(l=>l.length>0);r.taskIdentificationMethod==="tag"&&r.taskTag&&!i.includes(r.taskTag)&&i.push(r.taskTag);let a={title:r.title.trim(),due:r.dueDate||void 0,scheduled:r.scheduledDate||void 0,priority:r.priority,status:r.status,contexts:t.length>0?t:void 0,projects:n.length>0?n:void 0,tags:i.length>0?i:void 0,timeEstimate:r.timeEstimate>0?r.timeEstimate:void 0,recurrence:r.recurrenceRule||void 0,recurrence_anchor:r.recurrenceRule?r.recurrenceAnchor:void 0,reminders:r.reminders.length>0?r.reminders:void 0,creationContext:r.creationContext||"manual-creation",dateCreated:e,dateModified:e,customFrontmatter:jTe(r.userFields)},s=r.blockedByItems.map(l=>({...l.dependency}));s.length>0&&(a.blockedBy=s);let o=r.normalizeDetails(r.details).trimEnd();return o.length>0&&(a.details=o),a}function Vke(r){let e=[],t={},n=[];return r.forEach(i=>{i.path?e.includes(i.path)||(e.push(i.path),t[i.path]={...i.dependency}):n.push(i.dependency.uid)}),{added:e,raw:t,unresolved:n}}var qke=y(()=>{Ne();Ct();Op();CI()});var Gke={};et(Gke,{convertDefaultRemindersToReminders:()=>Yx,hasAnyUserFieldsEnabled:()=>Wke,isUserFieldConfigComplete:()=>Yke,isUserFieldEnabled:()=>nnt});function Yx(r,e){return r.map(t=>{let n={id:`rem_${Date.now()}_${Math.random().toString(36).slice(2,11)}`,type:t.type,description:t.description};if(t.type==="relative"){if(t.relatedTo&&t.offset!==void 0&&t.unit&&t.direction){let i="PT";t.unit==="days"?i=`P${t.offset}D`:t.unit==="hours"?i=`PT${t.offset}H`:i=`PT${t.offset}M`,t.direction==="before"&&(i="-"+i),n.relatedTo=t.relatedTo,n.offset=i}}else t.type==="absolute"&&t.absoluteDate&&t.absoluteTime&&(n.absoluteTime=`${t.absoluteDate}T${t.absoluteTime}:00`);return n}).filter(t=>t.type==="relative"?t.relatedTo&&t.offset:!!t.absoluteTime)}function Wke(r){let e=r.userFields;return!e||e.length===0?!1:e.some(t=>!!(t&&t.displayName&&t.key&&t.type))}function Yke(r){return!r||!r.enabled?!1:!!(r.displayName&&r.key&&r.type)}function nnt(r){return r.userFields&&r.userFields.length>0?Wke(r):Yke(r.userField)}var jI=y(()=>{});function Kke(r){let e=r.taskCreationDefaults,t={title:"",dueDate:Ip(e.defaultDueDate,e.defaultDueTime),scheduledDate:Ip(e.defaultScheduledDate,e.defaultScheduledTime),priority:r.defaultPriority,status:r.defaultStatus,contexts:e.defaultContexts||"",tags:e.defaultTags||"",projectStrings:e.defaultProjects?zs(e.defaultProjects):[],timeEstimate:e.defaultTimeEstimate&&e.defaultTimeEstimate>0?e.defaultTimeEstimate:0,recurrenceRule:"",recurrenceAnchor:"scheduled",reminders:e.defaultReminders&&e.defaultReminders.length>0?Yx(e.defaultReminders):[],userFields:int(r.userFields||[])};return r.prePopulatedValues&&snt(t,r.prePopulatedValues,r.taskTag),t}function int(r){let e={};for(let t of r)if(t.defaultValue!==void 0){if(t.type==="date"&&typeof t.defaultValue=="string"){let n=ant(t.defaultValue);n&&(e[t.key]=n);continue}e[t.key]=t.defaultValue}return e}function ant(r){return r!=="none"&&r!=="today"&&r!=="tomorrow"&&r!=="next-week"?"":eS(r)}function snt(r,e,t){if(e.title!==void 0&&(r.title=e.title),e.due!==void 0&&(r.dueDate=e.due),e.scheduled!==void 0&&(r.scheduledDate=e.scheduled),e.priority!==void 0&&(r.priority=e.priority),e.status!==void 0&&(r.status=e.status),e.contexts!==void 0&&(r.contexts=e.contexts.join(", ")),e.projects!==void 0&&(r.projectStrings=e.projects.filter(n=>n&&typeof n=="string"&&n.trim()!=="")),e.tags!==void 0&&(r.tags=Ri(e.tags.filter(n=>n!==t).join(", "))),e.timeEstimate!==void 0&&(r.timeEstimate=e.timeEstimate),e.recurrence!==void 0&&typeof e.recurrence=="string"&&(r.recurrenceRule=e.recurrence),e.recurrence_anchor!==void 0&&(r.recurrenceAnchor=e.recurrence_anchor),e.customFrontmatter)for(let[n,i]of Object.entries(e.customFrontmatter))r.userFields[n]=i}var Zke=y(()=>{Ct();jI();Op()});async function Qke(r){var t;let e={updated:0,missing:0,skipped:0,failed:0};if(!r.currentTaskFile)return e;for(let n of r.subtaskFiles)try{let i=await r.getTaskInfo(n.path);if(!i){e.missing+=1;continue}let a=r.buildProjectReference(r.currentTaskFile,n.path),s=jV(i.projects,a,ont(r.currentTaskFile));if(!s){e.skipped+=1;continue}await r.updateTaskProjects(i,s),e.updated+=1}catch(i){e.failed+=1,(t=r.onError)==null||t.call(r,i,n)}return e}function jV(r,e,t){let i=(Array.isArray(r)?r:[]).filter(a=>typeof a=="string");return i.includes(e)||i.includes(t)?null:[...i,e]}function ont(r){return`[[${r.basename}]]`}var BV=y(()=>{});function Jke(r){return r.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}function Xke(r,e){if(!r||!e)throw new Error("Invalid context or settings provided");if(!r.title||typeof r.title!="string")throw new Error("Context must have a valid title");if(r.title.trim().length===0)throw new Error("Title cannot be empty");let t=r.date||new Date;if(!(t instanceof Date)||isNaN(t.getTime()))throw new Error("Invalid date provided in context");try{let n=e.icsIntegration;if(n)switch(n.icsNoteFilenameFormat){case"title":return en(r.title);case"zettel":return Uh(t);case"timestamp":return twe(t);case"custom":{let i={icsEventTitle:r.icsEventTitle?en(r.icsEventTitle):en(r.title),icsEventLocation:r.icsEventLocation?en(r.icsEventLocation):"",icsEventDescription:r.icsEventDescription?en(r.icsEventDescription.substring(0,50)):"",icsEventTitleWithDate:en(`${r.icsEventTitle||r.title} - ${P(t,"PPP")}`)};return nwe(r,n.customICSNoteFilenameTemplate,t,i)}default:return en(r.title)}return en(r.title)}catch(n){return wb.error("Error generating ICS note filename:",{category:"provider",operation:"generating-ics-note-filename",error:n}),en(r.title)}}function ewe(r,e){if(!r||!e)throw new Error("Invalid context or settings provided");if(!r.title||typeof r.title!="string")throw new Error("Context must have a valid title");if(r.title.trim().length===0)throw new Error("Title cannot be empty");let t=r.date||new Date;if(!(t instanceof Date)||isNaN(t.getTime()))throw new Error("Invalid date provided in context");if(e.storeTitleInFilename)return en(r.title);try{switch(e.taskFilenameFormat){case"title":return en(r.title);case"zettel":return Uh(t);case"timestamp":return twe(t);case"uuid":return rwe();case"custom":return nwe(r,e.customFilenameTemplate,t);default:return Uh(t)}}catch(n){return wb.error("Error generating filename:",{category:"persistence",operation:"generating-filename",error:n}),Uh(t)}}function BI(r,e,t){if(!r.storeTitleInFilename&&r.taskFilenameFormat!=="title")return!1;let n=en(e);return t.startsWith("task-")&&t!==n}function Uh(r){let e=P(r,"yyMMdd"),t=new Date(r);t.setHours(0,0,0,0);let i=Math.floor((r.getTime()-t.getTime())/1e3).toString(36);return`${e}${i}`}function twe(r){return P(r,"yyyy-MM-dd-HHmmss")}function rwe(){let r=typeof window!="undefined"?window.crypto:void 0;if(typeof(r==null?void 0:r.randomUUID)=="function")return r.randomUUID();let e=new Uint8Array(16);if(typeof(r==null?void 0:r.getRandomValues)=="function")r.getRandomValues(e);else for(let n=0;nn.toString(16).padStart(2,"0"));return`${t.slice(0,4).join("")}-${t.slice(4,6).join("")}-${t.slice(6,8).join("")}-${t.slice(8,10).join("")}-${t.slice(10,16).join("")}`}function lnt(r){return Array.isArray(r)?r.map(e=>kl(e).trim()).filter(e=>e.length>0).map(e=>en(e)):[]}function cnt(r){return r?r.replace(/[^a-zA-Z0-9]/g,"").substring(0,4).toUpperCase():""}function nwe(r,e,t,n){var i;if(!r||!e||!t)throw new Error("Invalid inputs for custom filename generation");if(typeof e!="string"||e.trim().length===0)throw new Error("Template must be a non-empty string");if(!(t instanceof Date)||isNaN(t.getTime()))throw new Error("Invalid date for filename generation");try{let a=en(r.title),s=r.priority&&["low","normal","medium","high"].includes(r.priority)?r.priority:"normal",o=r.status?en(r.status):"open",l=Array.isArray(r.contexts)?r.contexts:[],c=lnt(r.projects),d=Array.isArray(r.tags)?r.tags:[],u={title:a,date:P(t,"yyyy-MM-dd"),time:P(t,"HHmmss"),priority:s,status:o,timestamp:P(t,"yyyy-MM-dd-HHmmss"),dateTime:P(t,"yyyy-MM-dd-HHmm"),year:P(t,"yyyy"),month:P(t,"MM"),day:P(t,"dd"),hour:P(t,"HH"),minute:P(t,"mm"),second:P(t,"ss"),dueDate:r.dueDate||"",scheduledDate:r.scheduledDate||"",context:l[0]?en(l[0]):"",contexts:l.map(m=>en(m)).join("/"),project:c[0]||"",projects:c.join("/"),projectId:cnt(c[0]),tags:d.map(m=>en(m)).join(", "),hashtags:d.map(m=>`#${en(m)}`).join(" "),timeEstimate:((i=r.timeEstimate)==null?void 0:i.toString())||"",details:r.details?en(r.details.substring(0,50)):"",parentNote:r.parentNote?en(r.parentNote):"",shortDate:P(t,"yyMMdd"),shortYear:P(t,"yy"),monthName:P(t,"MMMM"),monthNameShort:P(t,"MMM"),dayName:P(t,"EEEE"),dayNameShort:P(t,"EEE"),week:P(t,"ww"),quarter:P(t,"q"),time12:P(t,"hh:mm a"),time24:P(t,"HH:mm"),hourPadded:P(t,"HH"),hour12:P(t,"hh"),ampm:P(t,"a"),unix:Math.floor(t.getTime()/1e3).toString(),unixMs:t.getTime().toString(),milliseconds:P(t,"SSS"),ms:P(t,"SSS"),timezone:P(t,"xxx"),timezoneShort:P(t,"xx"),utcOffset:P(t,"xxx"),utcOffsetShort:P(t,"xx"),utcZ:"Z",priorityShort:s.substring(0,1).toUpperCase(),statusShort:o.substring(0,1).toUpperCase(),titleLower:a.toLowerCase(),titleUpper:a.toUpperCase(),titleSnake:a.toLowerCase().replace(/\s+/g,"_"),titleKebab:a.toLowerCase().replace(/\s+/g,"-"),titleCamel:a.replace(/(?:^\w|[A-Z]|\b\w)/g,(m,f)=>f===0?m.toLowerCase():m.toUpperCase()).replace(/\s+/g,""),titlePascal:a.replace(/(?:^\w|[A-Z]|\b\w)/g,m=>m.toUpperCase()).replace(/\s+/g,""),zettel:Uh(t),uuid:rwe(),nano:Date.now().toString()+Math.random().toString(36).substring(2,7),...n||{}},p=e;if(e.length>500)throw new Error("Template too long");return Object.entries(u).forEach(([m,f])=>{try{let h=new RegExp(`\\{\\{${m}\\}\\}`,"g");p=p.replace(h,f);let g=new RegExp(`\\{${m}\\}`,"g");p=p.replace(g,f)}catch(h){wb.warn(`Error replacing template variable ${m}:`,{category:"persistence",operation:"replacing-template-variable",error:h})}}),p=p.replace(/\{\{[^}]+\}\}/g,""),p=p.replace(/\{[^}]+\}/g,""),p.trim()||(p=a||Uh(t)),en(p)}catch(a){return wb.error("Error generating custom filename:",{category:"persistence",operation:"generating-custom-filename",error:a}),en(r.title)||Uh(t)}}function en(r){if(!r||typeof r!="string")return"untitled";try{let e=r.trim().replace(/\s+/g," ").replace(/[<>:"/\\|?*#[\]]/g,"").replace(/./g,n=>{let i=n.charCodeAt(0);return i<=31||i>=127&&i<=159?"":n}).replace(/^\.+|\.+$/g,"").trim();return(!e||e.length===0)&&(e="untitled"),["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"].includes(e.toUpperCase())&&(e=`task-${e}`),e}catch(e){return wb.error("Error sanitizing filename:",{category:"persistence",operation:"sanitizing-filename",error:e}),"untitled"}}async function Sb(r,e,t){if(!r||typeof r!="string")throw new Error("Base filename must be a non-empty string");if(typeof e!="string")throw new Error("Folder path must be a string");if(!t)throw new Error("Vault must be provided");let n=en(r);if(!n)throw new Error("Base filename cannot be sanitized to a valid name");let i=e.replace(/\.\./g,"").trim();try{let a=Jke(`${i}/${n}.md`);if(a.length>260)throw new Error("Generated path too long");if(!t.getAbstractFileByPath(a))return n;for(let l=2;l<=999;l++){let c=`${n}-${l}`,d=Jke(`${i}/${c}.md`);if(d.length>260)break;if(!t.getAbstractFileByPath(d))return c}let s=Date.now().toString(36),o=`${n.substring(0,50)}-${s}`;return en(o)}catch(a){return wb.error("Error generating unique filename:",{category:"persistence",operation:"generating-unique-filename",error:a}),`task-${Date.now().toString(36)}`}}var wb,Eb=y(()=>{Br();jn();G();wb=I({tag:"Utils/FilenameGenerator"})});var lwe={};et(lwe,{TaskCreationModal:()=>am,getTaskCreationFailureNoticeMessage:()=>awe,openCreatedTaskFileAfterSave:()=>owe,shouldOpenCreatedTaskAfterSave:()=>swe});function awe(r){let e=r instanceof Error&&r.message?r.message:String(r);return e.startsWith(iwe)?e.slice(iwe.length):e}function swe(r,e,t){return(r==="same-tab"||r==="new-tab")&&!e.createAnother&&!t}async function owe(r,e,t){await(t==="new-tab"?r.workspace.getLeaf("tab"):r.workspace.getLeaf(!1)).openFile(e)}function dnt(r,e,t){let n=(Jj(),WM(Qj));return new n.EmbeddableMarkdownEditor(r,e,t)}var Js,UI,iwe,am,HI=y(()=>{Js=require("obsidian");$V();Ct();wc();Ne();Uke();qke();Zke();BV();iV();Eb();eB();FV();G();UI=I({tag:"Modals/TaskCreationModal"}),iwe="Failed to create task: ";am=class r extends kb{constructor(t,n,i={}){super(t,n);this.nlMarkdownEditor=null;this.nlpSuggest=null;this.eventListeners=[];this.options=i,this.nlParser=Zn.fromPlugin(n)}getModalTitle(){return this.t("modals.taskCreation.title")}isCreationMode(){return!0}addTrackedEventListener(t,n,i){t.addEventListener(n,i),this.eventListeners.push({element:t,event:n,handler:i})}removeAllEventListeners(){for(let{element:t,event:n,handler:i}of this.eventListeners)t.removeEventListener(n,i);this.eventListeners=[]}createPrimaryInput(t){this.plugin.settings.enableNaturalLanguageInput?this.createNaturalLanguageInput(t):(this.createTitleInput(t),this.isExpanded=!0,this.containerEl.addClass("expanded"))}createAdditionalSections(t){(this.options.prePopulatedValues&&this.options.prePopulatedValues.projects||this.selectedProjectItems.length>0)&&this.renderProjectsList()}createNaturalLanguageInput(t){let n=t.createDiv("nl-input-container"),i=n.createDiv("tn-task-modal__markdown-editor tn-task-modal__markdown-editor--nlp");i.setAttribute("role","textbox"),i.setAttribute("aria-label",this.t("modals.taskCreation.nlPlaceholder")),i.setAttribute("aria-multiline","true"),this.nlPreviewContainer=n.createDiv("nl-preview-container"),this.nlPreviewContainer.setAttribute("role","status"),this.nlPreviewContainer.setAttribute("aria-live","polite"),this.nlPreviewContainer.setAttribute("aria-label","Task preview");try{let a=Bke(this.plugin);this.nlMarkdownEditor=dnt(this.app,i,{value:"",placeholder:this.t("modals.taskCreation.nlPlaceholder"),cls:"nlp-editor",extensions:a,enterVimInsertMode:!0,onChange:s=>{s.trim()?this.updateNaturalLanguagePreview(s.trim()):this.clearNaturalLanguagePreview()},onSubmit:(s,o)=>{this.handleSubmitShortcut(o)},onEscape:()=>{this.close()},onTab:s=>s?!1:(this.isExpanded||this.expandModal(),window.setTimeout(()=>{let o=this.modalEl.querySelector(".title-input-detailed");o&&o.focus()},50),!0),onEnter:(s,o,l)=>!!o})}catch(a){UI.error("Failed to create NLP markdown editor:",{category:"persistence",operation:"create-nlp-markdown-editor",error:a}),this.nlInput=i.createEl("textarea",{cls:"nl-input",attr:{placeholder:this.t("modals.taskCreation.nlPlaceholder"),rows:"3"}});let s=()=>{let l=this.nlInput.value.trim();l?this.updateNaturalLanguagePreview(l):this.clearNaturalLanguagePreview()};this.addTrackedEventListener(this.nlInput,"input",s);let o=l=>{let c=this.nlInput.value.trim();if(!c)return;let d=l;d.key==="Enter"&&(d.ctrlKey||d.metaKey)?(d.preventDefault(),this.handleSubmitShortcut(d.shiftKey)):d.key==="Tab"&&d.shiftKey&&(d.preventDefault(),this.parseAndFillForm(c))};this.addTrackedEventListener(this.nlInput,"keydown",o),this.nlpSuggest=new lb(this.app,this.nlInput,this.plugin)}}focusTitleInput(){if(!this.plugin.settings.enableNaturalLanguageInput){super.focusTitleInput();return}window.setTimeout(()=>{var n,i;let t=(i=(n=this.nlMarkdownEditor)==null?void 0:n.editor)==null?void 0:i.cm;if(t){t.focus(),t.scrollDOM.scrollTop=0;return}this.nlInput&&(this.nlInput.focus({preventScroll:!0}),this.nlInput.select())},this.getInitialFocusDelay())}updateNaturalLanguagePreview(t){if(!this.nlPreviewContainer)return;let n=this.nlParser.parseInput(t),i=this.nlParser.getPreviewData(n);i.length>0&&n.title?(this.nlPreviewContainer.empty(),this.nlPreviewContainer.classList.add("nl-preview-container--visible"),this.nlPreviewContainer.classList.remove("tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),i.forEach(a=>{let s=this.nlPreviewContainer.createDiv("nl-preview-item");s.textContent=a.text})):this.clearNaturalLanguagePreview()}clearNaturalLanguagePreview(){this.nlPreviewContainer&&(this.nlPreviewContainer.empty(),this.nlPreviewContainer.classList.remove("nl-preview-container--visible"),this.nlPreviewContainer.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"))}getNLPInputValue(){return this.nlMarkdownEditor?this.nlMarkdownEditor.value:this.nlInput?this.nlInput.value:""}createActionBar(t){if(this.actionBar=t.createDiv("tn-task-modal__action-bar"),this.plugin.settings.enableNaturalLanguageInput){this.createActionIcon(this.actionBar,"wand",this.t("modals.taskCreation.actions.fillFromNaturalLanguage"),(i,a)=>{let s=this.getNLPInputValue().trim();s&&this.parseAndFillForm(s)}),this.createActionIcon(this.actionBar,this.isExpanded?"chevron-up":"chevron-down",this.isExpanded?this.t("modals.taskCreation.actions.hideDetailedOptions"):this.t("modals.taskCreation.actions.showDetailedOptions"),(i,a)=>{this.toggleDetailedForm();let s=i.querySelector(".icon");s&&(0,Js.setIcon)(s,this.isExpanded?"chevron-up":"chevron-down"),(0,Js.setTooltip)(i,this.isExpanded?this.t("modals.taskCreation.actions.hideDetailedOptions"):this.t("modals.taskCreation.actions.showDetailedOptions"),{placement:"top"})});let n=this.actionBar.createDiv("action-separator");n.classList.remove("tn-static-width-100-0466783d","tn-static-width-12px-fbf353fb","tn-static-width-16px-7375d50b","tn-static-width-200px-2acaf3b5","tn-static-width-60px-bd09c419","tn-static-width-80px-8573bae3"),n.classList.add("tn-static-width-1px-aa77e27e"),n.classList.remove("tn-static-display-flex-4d51fc62","tn-static-height-0-7a31cef0","tn-static-height-100-62264068","tn-static-height-12px-06c0747e","tn-static-height-16px-30de4aee","tn-static-min-height-800px-997b4c8c"),n.classList.add("tn-static-height-24px-29a11d37"),n.classList.remove("tn-static-background-color-var-background-se-9087a23e","tn-static-background-color-var-color-base-40-ef5f175e","tn-static-background-color-var-color-red-134bc721","tn-static-background-color-var-text-accent-a954c70f"),n.classList.add("tn-static-background-color-var-background-mo-94b219f0"),n.classList.remove("tn-static-margin-0-11696618","tn-static-margin-0-auto-266e9b04","tn-static-margin-0-db0d5f36","tn-static-margin-2px-0-edce9b14","tn-static-margin-8px-0-0-0-a2eb8382","tn-static-padding-12px-43bef435","tn-static-padding-20px-ebe8e48c"),n.classList.add("tn-static-margin-0-var-size-4-2-77f7dc08")}this.createCoreActionIcons(this.actionBar),this.updateIconStates()}parseAndFillForm(t){let n=this.nlParser.parseInput(t);this.applyParsedData(n),this.isExpanded||this.expandModal()}applyParsedData(t){var n;if(t.title&&(this.title=t.title),t.status&&(this.status=t.status),t.priority&&(this.priority=t.priority),t.dueDate&&(this.dueDate=t.dueTime?Ni(t.dueDate,t.dueTime):t.dueDate),t.scheduledDate&&(this.scheduledDate=t.scheduledTime?Ni(t.scheduledDate,t.scheduledTime):t.scheduledDate),t.contexts&&t.contexts.length>0&&(this.contexts=t.contexts.join(", ")),t.tags&&t.tags.length>0&&(this.tags=Ri(t.tags.join(", "))),t.details&&(this.details=t.details),t.recurrence&&(this.recurrenceRule=t.recurrence),t.estimate!==void 0&&(this.timeEstimate=t.estimate>0?t.estimate:0,this.timeEstimateInput&&(this.timeEstimateInput.value=this.timeEstimate>0?this.timeEstimate.toString():"")),this.titleInput&&(this.titleInput.value=this.title),this.detailsInput&&(this.detailsInput.value=this.details),Qde(this.detailsMarkdownEditor,this.details),this.contextsInput&&(this.contextsInput.value=this.contexts),this.tagsInput&&(this.tagsInput.value=this.tags),t.projects&&t.projects.length>0&&(this.addProjectsFromStrings(t.projects),this.renderProjectsList()),t.userFields){for(let[i,a]of Object.entries(t.userFields)){let s=(n=this.plugin.settings.userFields)==null?void 0:n.find(o=>o.id===i);s&&(this.userFields[s.key]=a)}this.updateUserFieldControls()}this.updateIconStates()}toggleDetailedForm(){this.isExpanded?(this.isExpanded=!1,FI({detailsContainer:this.detailsContainer,splitRightColumn:this.splitRightColumn}),this.containerEl.removeClass("expanded")):this.expandModal()}async initializeFormData(){let t=Kke({defaultPriority:this.plugin.settings.defaultTaskPriority,defaultStatus:this.plugin.settings.defaultTaskStatus,taskCreationDefaults:this.plugin.settings.taskCreationDefaults,taskTag:this.plugin.settings.taskTag,userFields:this.plugin.settings.userFields,prePopulatedValues:this.options.prePopulatedValues});this.title=t.title,this.dueDate=t.dueDate,this.scheduledDate=t.scheduledDate,this.priority=t.priority,this.status=t.status,this.contexts=t.contexts,this.tags=t.tags,this.timeEstimate=t.timeEstimate,this.recurrenceRule=t.recurrenceRule,this.recurrenceAnchor=t.recurrenceAnchor,this.reminders=t.reminders,this.userFields=t.userFields,t.projectStrings.length>0&&this.initializeProjectsFromStrings(t.projectStrings),this.details=this.normalizeDetails(this.details),this.originalDetails=this.details}async handleSubmitShortcut(t){await this.handleSave({createAnother:t})}async handleSave(t={}){if(this.plugin.settings.enableNaturalLanguageInput){let n=this.getNLPInputValue().trim();if(n&&!this.title.trim()){let i=this.nlParser.parseInput(n);this.applyParsedData(i)}}if(!this.validateForm()){new Js.Notice(this.t("modals.taskCreation.notices.titleRequired"));return}try{let n=this.buildTaskData(),i=await this.plugin.taskService.createTask(n,{applyDefaults:!1}),a=i.taskInfo;if(BI(this.plugin.settings,i.taskInfo.title,i.file.basename)?new Js.Notice(this.t("modals.taskCreation.notices.successShortened",{title:a.title})):new Js.Notice(this.t("modals.taskCreation.notices.success",{title:a.title})),this.blockingItems.length>0){let s=Vke(this.blockingItems);if(s.added.length>0){await this.plugin.taskService.updateBlockingRelationships(a,s.added,[],s.raw);let o=await this.plugin.cacheManager.getTaskInfo(a.path);o&&(a=o)}s.unresolved.length>0&&new Js.Notice(this.t("modals.taskCreation.notices.blockingUnresolved",{entries:s.unresolved.join(", ")})),this.blockingItems=[]}this.selectedSubtaskFiles.length>0&&await this.applySubtaskAssignments(a),this.options.onTaskCreated&&this.options.onTaskCreated(a),await this.openCreatedTaskIfConfigured(i.file,t),this.close(),t.createAnother&&window.setTimeout(()=>{new r(this.app,this.plugin,this.options).open()},0)}catch(n){UI.error("Failed to create task:",{category:"persistence",operation:"create-task",error:n});let i=awe(n);new Js.Notice(this.t("modals.taskCreation.notices.failure",{message:i}))}}async openCreatedTaskIfConfigured(t,n){var a;let i=(a=this.plugin.settings.openTaskAfterCreation)!=null?a:"none";if(swe(i,n,!!this.options.onTaskCreated))try{await owe(this.app,t,i)}catch(s){UI.error("Failed to open created task note:",{category:"persistence",operation:"open-created-task-note",error:s}),new Js.Notice(this.t("modals.taskCreation.notices.openCreatedTaskFailure"))}}buildTaskData(){var i;let t=Hke({title:this.title,dueDate:this.dueDate,scheduledDate:this.scheduledDate,priority:this.priority,status:this.status,contexts:this.contexts,projects:this.projects,tags:this.tags,timeEstimate:this.timeEstimate,recurrenceRule:this.recurrenceRule,recurrenceAnchor:this.recurrenceAnchor,reminders:this.reminders,blockedByItems:this.blockedByItems,details:this.details,userFields:this.userFields,creationContext:this.options.creationContext,taskIdentificationMethod:this.plugin.settings.taskIdentificationMethod,taskTag:this.plugin.settings.taskTag,normalizeDetails:a=>this.normalizeDetails(a)}),n=(i=this.options.prePopulatedValues)==null?void 0:i.customFrontmatter;return n&&(t.customFrontmatter={...n,...t.customFrontmatter}),t}createTitleInput(t){this.plugin.settings.enableNaturalLanguageInput||super.createTitleInput(t)}async applySubtaskAssignments(t){let n=this.app.vault.getAbstractFileByPath(t.path);n instanceof Js.TFile&&await Qke({currentTaskFile:n,subtaskFiles:this.selectedSubtaskFiles,getTaskInfo:i=>this.plugin.cacheManager.getTaskInfo(i),buildProjectReference:(i,a)=>this.buildProjectReference(i,a),updateTaskProjects:(i,a)=>this.plugin.updateTaskProperty(i,"projects",a),onError:i=>{UI.error("Failed to assign subtask:",{category:"persistence",operation:"assign-subtask",error:i})}})}onClose(){this.nlMarkdownEditor&&(this.nlMarkdownEditor.destroy(),this.nlMarkdownEditor=null),this.nlpSuggest&&(this.nlpSuggest.close(),this.nlpSuggest=null),this.removeAllEventListeners(),super.onClose()}}});var xb,WI,HV=y(()=>{xb=class{constructor(){this.inFlightRequests=new Map;this.prefetchQueue=new Set;this.prefetchPromises=new Map;this.activeTimeouts=new Set}async execute(e,t,n=5e3){if(this.inFlightRequests.has(e))return this.inFlightRequests.get(e);let i=this.createRequest(e,t,n);return this.inFlightRequests.set(e,i),i}async createRequest(e,t,n){try{let i=await t(),a=window.setTimeout(()=>{this.inFlightRequests.delete(e),this.activeTimeouts.delete(a)},n);return this.activeTimeouts.add(a),i}catch(i){throw this.inFlightRequests.delete(e),i}}prefetch(e,t,n="low"){if(!(this.inFlightRequests.has(e)||this.prefetchPromises.has(e)))if(n==="high")this.executePrefetch(e,t);else if(this.prefetchQueue.add(e),"requestIdleCallback"in window)requestIdleCallback(()=>{this.processPrefetchQueue(e,t)});else{let a=window.setTimeout(()=>{this.processPrefetchQueue(e,t),this.activeTimeouts.delete(a)},50);this.activeTimeouts.add(a)}}async executePrefetch(e,t){try{let n=t();this.prefetchPromises.set(e,n),await n;let i=window.setTimeout(()=>{this.prefetchPromises.delete(e),this.activeTimeouts.delete(i)},3e4);this.activeTimeouts.add(i)}catch(n){this.prefetchPromises.delete(e)}}processPrefetchQueue(e,t){this.prefetchQueue.has(e)&&(this.prefetchQueue.delete(e),this.executePrefetch(e,t))}getPrefetchedData(e){return this.prefetchPromises.get(e)||null}cancel(e){this.inFlightRequests.delete(e),this.prefetchPromises.delete(e),this.prefetchQueue.delete(e)}cancelAll(){this.inFlightRequests.clear(),this.prefetchPromises.clear(),this.prefetchQueue.clear();for(let e of this.activeTimeouts)window.clearTimeout(e);this.activeTimeouts.clear()}getStats(){return{inFlightCount:this.inFlightRequests.size,prefetchCount:this.prefetchPromises.size,queuedCount:this.prefetchQueue.size}}},WI=class{constructor(e){this.lastAccessTime=new Map;this.deduplicator=e}recordAccess(e,t,n){let i=this.getDateKey(e);this.lastAccessTime.set(i,Date.now()),this.prefetchAdjacentDates(e,t,n)}prefetchAdjacentDates(e,t,n){this.getAdjacentDates(e).forEach(({date:a,priority:s})=>{let o=`${t}-${this.getDateKey(a)}`;this.deduplicator.prefetch(o,()=>n(a),s)})}getAdjacentDates(e){let t=[],n=new Date(e);n.setDate(e.getDate()-1),t.push({date:n,priority:"high"});let i=new Date(e);i.setDate(e.getDate()+1),t.push({date:i,priority:"high"});for(let a=2;a<=7;a++){let s=new Date(e);s.setDate(e.getDate()-a),t.push({date:s,priority:"low"});let o=new Date(e);o.setDate(e.getDate()+a),t.push({date:o,priority:"low"})}return t}getDateKey(e){return e.toISOString().split("T")[0]}cleanup(){let e=Date.now(),t=1440*60*1e3;for(let[n,i]of this.lastAccessTime)e-i>t&&this.lastAccessTime.delete(n)}}});var Cnt,Cb,YI,Awe=y(()=>{G();Cnt=I({tag:"Utils/DOMReconciler"}),Cb=class{constructor(){this.updateQueue=[];this.isProcessing=!1;this.activeTimeouts=new Set}scheduleUpdate(e){this.updateQueue.push(e),this.isProcessing||(this.isProcessing=!0,window.requestAnimationFrame(()=>{this.processUpdates()}))}processUpdates(){let e=[...this.updateQueue];this.updateQueue=[];try{e.forEach(t=>{try{t()}catch(n){Cnt.error("Error processing DOM update:",{category:"validation",operation:"processing-dom-update",error:n})}})}finally{this.isProcessing=!1,this.updateQueue.length>0&&window.requestAnimationFrame(()=>{this.processUpdates()})}}updateAttributes(e,t){for(let[n,i]of Object.entries(t))i===null?e.removeAttribute(n):e.getAttribute(n)!==i&&e.setAttribute(n,i)}updateClasses(e,t){for(let[n,i]of Object.entries(t))i?e.classList.add(n):e.classList.remove(n)}updateTextContent(e,t){e.textContent!==t&&(e.textContent=t)}updateStyles(e,t){for(let[n,i]of Object.entries(t))i===null?e.style.removeProperty(n):e.style.setProperty(n,i)}preserveState(e){let t={scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,focused:activeDocument.activeElement===e,selection:null};return(e.instanceOf(HTMLInputElement)||e.instanceOf(HTMLTextAreaElement))&&(t.selection={start:e.selectionStart||0,end:e.selectionEnd||0}),t}restoreState(e,t){e.scrollTop=t.scrollTop,e.scrollLeft=t.scrollLeft,t.focused&&e.focus(),t.selection&&(e.instanceOf(HTMLInputElement)||e.instanceOf(HTMLTextAreaElement))&&e.setSelectionRange(t.selection.start,t.selection.end)}animateUpdate(e,t,n=1500){e.classList.add(`task-${t}`);let i=window.setTimeout(()=>{e.classList.remove(`task-${t}`),this.activeTimeouts.delete(i)},n);this.activeTimeouts.add(i)}updateList(e,t,n,i,a){let s=new Map,o=new Set;Array.from(e.children).forEach(d=>{let u=d.dataset.key;u&&(s.set(u,d),o.add(u))});let l=new Set(t.map(n)),c=activeDocument.createDocumentFragment();t.forEach(d=>{let u=n(d),p=s.get(u);if(p)a&&a(p,d),c.appendChild(p);else{let m=i(d);m.dataset.key=u,c.appendChild(m)}}),o.forEach(d=>{if(!l.has(d)){let u=s.get(d);u&&u.parentNode&&u.remove()}}),e.replaceChildren(c)}createOptimisticUpdate(e,t,n){return t(e),{commit:()=>{},revert:()=>{n(e)}}}destroy(){this.updateQueue=[],this.isProcessing=!1;for(let e of this.activeTimeouts)window.clearTimeout(e);this.activeTimeouts.clear()}},YI=class{constructor(){this.stateMap=new Map}saveState(e,t){let n=new Cb;this.stateMap.set(e,n.preserveState(t))}restoreState(e,t){let n=this.stateMap.get(e);n&&new Cb().restoreState(t,n)}clearState(e){e?this.stateMap.delete(e):this.stateMap.clear()}destroy(){this.stateMap.clear()}}});var Iwe=y(()=>{fB()});var Db,VV=y(()=>{zw();fc();Db=class r{constructor(e,t="open"){this.statuses=e;this.defaultStatus=t}normalizeStatusValue(e){var t;return(t=Wd(e,this.statuses))!=null?t:String(e)}findStatusIndex(e,t){let n=this.normalizeStatusValue(t);return e.findIndex(i=>this.normalizeStatusValue(i.value)===n)}getCycleStatuses(){return this.getStatusesByOrder().filter(e=>!e.excludeFromCycle)}getNextStatus(e){var l,c;let t=this.getStatusConfig(e),n=t?this.normalizeStatusValue(t.value):void 0,i=t!=null&&t.nextStatus?this.normalizeStatusValue(t.nextStatus):void 0,a=i&&i!==n?this.getStatusConfig(i):void 0;if(a)return a.value;let s=this.getCycleStatuses(),o=this.findStatusIndex(s,e);if(s.length===0)return(t==null?void 0:t.value)||this.defaultStatus;if(o!==-1){let d=(o+1)%s.length;return s[d].value}return t?((c=s.find(d=>d.order>t.order))==null?void 0:c.value)||s[0].value:((l=s[0])==null?void 0:l.value)||this.defaultStatus}getPreviousStatus(e){var a,s,o;let t=this.getCycleStatuses(),n=this.findStatusIndex(t,e);if(t.length===0)return((a=this.getStatusConfig(e))==null?void 0:a.value)||this.defaultStatus;if(n!==-1){let l=(n-1+t.length)%t.length;return t[l].value}let i=this.getStatusConfig(e);return i?((o=[...t].reverse().find(l=>l.orderthis.normalizeStatusValue(n.value)===t)}getCompletedStatuses(){return this.statuses.filter(e=>e.isCompleted).map(e=>e.value)}getOpenStatuses(){return this.statuses.filter(e=>!e.isCompleted).map(e=>e.value)}getStatusesByOrder(){return[...this.statuses].sort((e,t)=>e.order-t.order)}isCompletedStatus(e){let t=this.getStatusConfig(e);return(t==null?void 0:t.isCompleted)||!1}getStatusOrder(e){let t=this.getStatusConfig(e);return(t==null?void 0:t.order)||0}getStatusStyles(){let e=[];for(let t of this.statuses){let n=`--status-${t.value.replace(/[^a-zA-Z0-9-]/g,"-")}-color`;e.push(`${n}: ${_r(t.color)};`)}return`:root { ${e.join(" ")} }`}getAllStatuses(){return[...this.statuses]}getNonCompletionStatuses(){return this.statuses.filter(e=>!e.isCompleted)}updateStatuses(e){this.statuses=e}static validateStatuses(e){let t=[];e.length<2&&t.push("At least 2 statuses are required"),e.some(l=>l.isCompleted)||t.push("At least one status must be marked as completed");let i=e.map(l=>l.value),a=new Set(i);i.length!==a.size&&t.push("Status values must be unique");let s=e.map(l=>l.id),o=new Set(s);s.length!==o.size&&t.push("Status IDs must be unique");for(let l of e){if(!l.value||l.value.trim()===""){t.push("Status values cannot be empty");break}if(!l.label||l.label.trim()===""){t.push("Status labels cannot be empty");break}if(!$_(l.color)){t.push("Status colors must be valid CSS colors or Obsidian theme colors");break}}return{valid:t.length===0,errors:t}}static generateStatusId(e){let t=new Set(e.map(a=>a.id)),n=1,i=`status-${n}`;for(;t.has(i);)n++,i=`status-${n}`;return i}static createDefaultStatus(e){let t=r.generateStatusId(e),n=Math.max(...e.map(i=>i.order),0)+1;return{id:t,value:"new-status",label:"New status",color:"#808080",isCompleted:!1,excludeFromCycle:!1,order:n,autoArchive:!1,autoArchiveDelay:5}}}});var GI,Nwe=y(()=>{zw();fc();GI=class r{constructor(e){this.priorities=e}normalizePriorityValue(e){var t;return(t=Cp(e,this.priorities))!=null?t:String(e)}getPriorityConfig(e){let t=this.normalizePriorityValue(e);return this.priorities.find(n=>n.value===t)}getPrioritiesByWeight(){return[...this.priorities].sort((e,t)=>t.weight-e.weight)}getPrioritiesByWeightAsc(){return[...this.priorities].sort((e,t)=>e.weight-t.weight)}getNextPriority(e){var s;let t=this.getPrioritiesByWeightAsc(),n=this.normalizePriorityValue(e),i=t.findIndex(o=>o.value===n);if(i===-1)return((s=t[0])==null?void 0:s.value)||"normal";let a=(i+1)%t.length;return t[a].value}comparePriorities(e,t){let n=this.getPriorityConfig(e),i=this.getPriorityConfig(t),a=(n==null?void 0:n.weight)||0;return((i==null?void 0:i.weight)||0)-a}getPriorityStyles(){let e=[];for(let t of this.priorities){let n=`--priority-${t.value.replace(/[^a-zA-Z0-9-]/g,"-")}-color`;e.push(`${n}: ${_r(t.color)};`)}return`:root { ${e.join(" ")} }`}getAllPriorities(){return[...this.priorities]}updatePriorities(e){this.priorities=e}getHighestPriority(){var t;return(t=this.getPrioritiesByWeight()[0])==null?void 0:t.value}getLowestPriority(){var t;return(t=this.getPrioritiesByWeightAsc()[0])==null?void 0:t.value}getPriorityWeight(e){let t=this.getPriorityConfig(e);return(t==null?void 0:t.weight)||0}isHigherPriority(e,t){return this.comparePriorities(e,t)>0}static validatePriorities(e){let t=[];e.length<1&&t.push("At least 1 priority is required");let n=e.map(c=>c.value),i=new Set(n);n.length!==i.size&&t.push("Priority values must be unique");let a=e.map(c=>c.id),s=new Set(a);a.length!==s.size&&t.push("Priority IDs must be unique");let o=e.map(c=>c.weight),l=new Set(o);o.length!==l.size&&t.push("Priority weights must be unique");for(let c of e){if(!c.value||c.value.trim()===""){t.push("Priority values cannot be empty");break}if(!c.label||c.label.trim()===""){t.push("Priority labels cannot be empty");break}if(!$_(c.color)){t.push("Priority colors must be valid CSS colors or Obsidian theme colors");break}if(typeof c.weight!="number"||c.weight<0){t.push("Priority weights must be non-negative numbers");break}}return{valid:t.length===0,errors:t}}static generatePriorityId(e){let t=new Set(e.map(a=>a.id)),n=1,i=`priority-${n}`;for(;t.has(i);)n++,i=`priority-${n}`;return i}static generatePriorityWeight(e){let t=e.map(n=>n.weight);return t.length===0?1:Math.max(...t)+1}static createDefaultPriority(e){let t=r.generatePriorityId(e),n=r.generatePriorityWeight(e);return{id:t,value:"new-priority",label:"New priority",color:"#808080",weight:n}}}});function Rwe({path:r,mappedTask:e,defaultTaskStatus:t,isBlocked:n,blockingTasks:i}){let a=e.timeEntries?Aa(e.timeEntries):0;return{...e,id:r,path:r,title:e.title||"Untitled task",status:e.status||t,priority:e.priority||"normal",archived:e.archived||!1,tags:Array.isArray(e.tags)?e.tags:[],contexts:Array.isArray(e.contexts)?e.contexts:[],projects:Array.isArray(e.projects)?e.projects:[],totalTrackedTime:a,isBlocked:n,isBlocking:i.length>0,blocking:i.length>0?i:void 0}}var Owe=y(()=>{Ct()});function Dnt(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function Lwe(r,e){if(typeof r=="boolean"){let t=e.toLowerCase();if(t==="true"||t==="false")return r===(t==="true")}return r===e}function Fwe(r,e){if(!Dnt(r))return!1;if(e.taskIdentificationMethod==="property"){let n=e.taskPropertyName,i=e.taskPropertyValue;if(!n||!i)return!1;let a=r[n];return a===void 0?!1:Array.isArray(a)?a.some(s=>Lwe(s,i)):Lwe(a,i)}return dc(r.tags).some(n=>yr.matchesHierarchicalTagExact(n,e.taskTag))}var $we=y(()=>{cu();iv()});var Il,Hh,KI,zwe=y(()=>{Il=require("obsidian");Ur();zw();Ne();Nw();Owe();$we();G();Hh=I({tag:"Utils/TaskManager"}),KI=class extends Il.Events{constructor(t,n,i){super();this.initialized=!1;this.eventListeners=[];this.debouncedHandlers=new Map;this.DEBOUNCE_DELAY=300;this.pendingTaskInfoByPath=new Map;this.app=t,this.settings=n,this.taskTag=n.taskTag,this.excludedFolders=cc(n.excludedFolders),this.fieldMapper=i,this.disableNoteIndexing=n.disableNoteIndexing,this.storeTitleInFilename=n.storeTitleInFilename}initialize(){this.initialized||(this.setupNativeEventListeners(),this.initialized=!0,this.trigger("cache-initialized",{message:"Task manager ready"}))}getApp(){return this.app}isTaskFile(t){return Fwe(t,this.settings)}setupNativeEventListeners(){let t=this.app.metadataCache.on("changed",(a,s,o)=>{a instanceof Il.TFile&&a.extension==="md"&&this.isValidFile(a.path)&&this.handleFileChangedDebounced(a,o)});this.eventListeners.push(t);let n=this.app.metadataCache.on("deleted",(a,s)=>{a instanceof Il.TFile&&a.extension==="md"&&this.handleFileDeleted(a.path,s)});this.eventListeners.push(n);let i=this.app.vault.on("rename",(a,s)=>{a instanceof Il.TFile&&a.extension==="md"&&this.handleFileRenamed(a,s)});this.eventListeners.push(i)}handleFileChangedDebounced(t,n){let i=t.path,a=this.debouncedHandlers.get(i);a&&window.clearTimeout(a);let s=window.setTimeout(()=>{this.debouncedHandlers.delete(i),this.handleFileChanged(t,n)},this.DEBOUNCE_DELAY);this.debouncedHandlers.set(i,s)}async handleFileChanged(t,n){let i=null;if(n&&typeof n=="object"&&"frontmatter"in n){let a=n.frontmatter;if(a&&this.isTaskFile(a)){let s=this.extractTaskInfoFromNative(t.path,a),o=this.getPendingTaskInfo(t.path);o&&this.shouldUsePendingTaskInfo(o,s)?i=o:(this.pendingTaskInfoByPath.delete(t.path),i=s)}else this.pendingTaskInfoByPath.delete(t.path)}this.trigger("file-updated",{path:t.path,file:t,updatedTask:i}),i&&this.trigger(nt,{path:t.path,task:i,taskInfo:i,updatedTask:i}),this.trigger("data-changed")}handleFileDeleted(t,n){this.pendingTaskInfoByPath.delete(t);let i=this.debouncedHandlers.get(t);i&&(window.clearTimeout(i),this.debouncedHandlers.delete(t)),this.trigger("file-deleted",{path:t,prevCache:n}),this.trigger("data-changed")}handleFileRenamed(t,n){let i=this.pendingTaskInfoByPath.get(n);i&&(this.pendingTaskInfoByPath.delete(n),this.pendingTaskInfoByPath.set(t.path,{...i,id:t.path,path:t.path}));let a=this.debouncedHandlers.get(n);a&&(window.clearTimeout(a),this.debouncedHandlers.delete(n)),this.trigger("file-renamed",{oldPath:n,newPath:t.path,file:t}),this.trigger("data-changed")}isValidFile(t){return!rv(t,this.excludedFolders)}async getTaskInfo(t){if(!this.isValidFile(t))return null;let n=this.app.vault.getAbstractFileByPath(t);if(!(n instanceof Il.TFile))return null;let i=this.getPendingTaskInfo(t),a=this.app.metadataCache.getFileCache(n);if(!(a!=null&&a.frontmatter)){if(i)return i;let o=await this.readFrontmatterFromFile(n);return!o||!this.isTaskFile(o)?null:this.extractTaskInfoFromNative(t,o)}let s=this.isTaskFile(a.frontmatter)?this.extractTaskInfoFromNative(t,a.frontmatter):null;return i&&this.shouldUsePendingTaskInfo(i,s)?i:(this.pendingTaskInfoByPath.delete(t),s)}getPendingTaskInfo(t){var i;let n=this.pendingTaskInfoByPath.get(t);return n?{...n,id:(i=n.id)!=null?i:t,path:t}:null}shouldUsePendingTaskInfo(t,n){return n?t.dateModified?n.dateModified!==t.dateModified:!1:!0}extractTaskInfoFromNative(t,n){if(!n||!this.fieldMapper||!this.isTaskFile(n))return null;try{let i=this.fieldMapper.mapFromFrontmatter(n,t,this.storeTitleInFilename),a=!1,s=[];return this._dependencyCache?(a=this._dependencyCache.isTaskBlocked(t),s=this._dependencyCache.getBlockedTaskPaths(t)):a=Array.isArray(i.blockedBy)&&i.blockedBy.length>0,Rwe({path:t,mappedTask:i,defaultTaskStatus:this.settings.defaultTaskStatus,isBlocked:a,blockingTasks:s})}catch(i){return Hh.error(`Error extracting task info from native metadata for ${t}:`,{category:"persistence",operation:"extracting-task-info-native-metadata",error:i}),null}}async getAllTasks(){let t=[],n=this.app.vault.getMarkdownFiles();for(let i of n){if(!this.isValidFile(i.path))continue;let a=await this.getTaskInfo(i.path);a&&t.push(a)}return t}getAllTaskPaths(){let t=new Set,n=this.app.vault.getMarkdownFiles();for(let i of n){if(!this.isValidFile(i.path))continue;let a=this.app.metadataCache.getFileCache(i);a!=null&&a.frontmatter&&this.isTaskFile(a.frontmatter)&&t.add(i.path)}return t}getTasksForDate(t){var l,c;let n=[],i=this.app.vault.getMarkdownFiles(),a=ke(t),s=((l=this.fieldMapper)==null?void 0:l.toUserField("scheduled"))||"scheduled",o=((c=this.fieldMapper)==null?void 0:c.toUserField("due"))||"due";for(let d of i){if(!this.isValidFile(d.path))continue;let u=this.app.metadataCache.getFileCache(d);if(!(u!=null&&u.frontmatter)||!this.isTaskFile(u.frontmatter))continue;let p=u.frontmatter[s],m=u.frontmatter[o],f=typeof p=="string"&&p.length>0?ke(p):void 0,h=typeof m=="string"&&m.length>0?ke(m):void 0;(f===a||h===a)&&n.push(d.path)}return n}getTaskPathsByStatus(t){var o,l;let n=[],i=this.app.vault.getMarkdownFiles(),a=((o=this.fieldMapper)==null?void 0:o.toUserField("status"))||"status",s=(l=Wd(t,this.settings.customStatuses))!=null?l:t;for(let c of i){if(!this.isValidFile(c.path))continue;let d=this.app.metadataCache.getFileCache(c);if(!(d!=null&&d.frontmatter)||!this.isTaskFile(d.frontmatter))continue;Wd(d.frontmatter[a],this.settings.customStatuses)===s&&n.push(c.path)}return n}getTaskPathsByPriority(t){var o,l;let n=[],i=this.app.vault.getMarkdownFiles(),a=((o=this.fieldMapper)==null?void 0:o.toUserField("priority"))||"priority",s=(l=Cp(t,this.settings.customPriorities))!=null?l:t;for(let c of i){if(!this.isValidFile(c.path))continue;let d=this.app.metadataCache.getFileCache(c);if(!(d!=null&&d.frontmatter)||!this.isTaskFile(d.frontmatter))continue;Cp(d.frontmatter[a],this.settings.customPriorities)===s&&n.push(c.path)}return n}getOverdueTaskPaths(){var o,l,c;let t=new Set,n=this.app.vault.getMarkdownFiles(),i=zn(),a=((o=this.fieldMapper)==null?void 0:o.toUserField("due"))||"due",s=((l=this.fieldMapper)==null?void 0:l.toUserField("status"))||"status";for(let d of n){if(!this.isValidFile(d.path))continue;let u=this.app.metadataCache.getFileCache(d);if(!(u!=null&&u.frontmatter)||!this.isTaskFile(u.frontmatter))continue;let p=u.frontmatter[a],m=Wd(u.frontmatter[s],this.settings.customStatuses),f=((c=this.settings.customStatuses)==null?void 0:c.some(h=>h.value===m&&h.isCompleted))||!1;p&&!f&&th(p,i)&&t.add(d.path)}return t}getAllStatuses(){var a;let t=new Set,n=this.app.vault.getMarkdownFiles(),i=((a=this.fieldMapper)==null?void 0:a.toUserField("status"))||"status";for(let s of n){if(!this.isValidFile(s.path))continue;let o=this.app.metadataCache.getFileCache(s);if(!(o!=null&&o.frontmatter)||!this.isTaskFile(o.frontmatter))continue;let l=o.frontmatter[i],c=Wd(l,this.settings.customStatuses);c&&t.add(c)}return Array.from(t).sort()}getAllPriorities(){var a;let t=new Set,n=this.app.vault.getMarkdownFiles(),i=((a=this.fieldMapper)==null?void 0:a.toUserField("priority"))||"priority";for(let s of n){if(!this.isValidFile(s.path))continue;let o=this.app.metadataCache.getFileCache(s);if(!(o!=null&&o.frontmatter)||!this.isTaskFile(o.frontmatter))continue;let l=o.frontmatter[i],c=Cp(l,this.settings.customPriorities);c&&t.add(c)}return Array.from(t).sort()}getAllTags(){let t=new Set,n=this.app.vault.getMarkdownFiles();for(let i of n){if(!this.isValidFile(i.path))continue;let a=this.app.metadataCache.getFileCache(i);if(!(a!=null&&a.frontmatter)||!this.isTaskFile(a.frontmatter))continue;let s=a.frontmatter.tags;Array.isArray(s)&&s.forEach(o=>{typeof o=="string"&&t.add(o)})}return Array.from(t).sort()}getAllContexts(){var a;let t=new Set,n=this.app.vault.getMarkdownFiles(),i=((a=this.fieldMapper)==null?void 0:a.toUserField("contexts"))||"context";for(let s of n){if(!this.isValidFile(s.path))continue;let o=this.app.metadataCache.getFileCache(s);if(!(o!=null&&o.frontmatter)||!this.isTaskFile(o.frontmatter))continue;let l=o.frontmatter[i];Array.isArray(l)?l.forEach(c=>{typeof c=="string"&&t.add(c)}):l&&t.add(l)}return Array.from(t).sort()}getAllProjects(){var a;let t=new Set,n=this.app.vault.getMarkdownFiles(),i=((a=this.fieldMapper)==null?void 0:a.toUserField("projects"))||"project";for(let s of n){if(!this.isValidFile(s.path))continue;let o=this.app.metadataCache.getFileCache(s);if(!(o!=null&&o.frontmatter)||!this.isTaskFile(o.frontmatter))continue;let l=o.frontmatter[i];Array.isArray(l)?l.forEach(c=>{typeof c=="string"&&t.add(c)}):l&&t.add(l)}return Array.from(t).sort()}getAllTimeEstimates(){var a;let t=new Map,n=this.app.vault.getMarkdownFiles(),i=((a=this.fieldMapper)==null?void 0:a.toUserField("timeEstimate"))||"timeEstimate";for(let s of n){if(!this.isValidFile(s.path))continue;let o=this.app.metadataCache.getFileCache(s);if(!(o!=null&&o.frontmatter)||!this.isTaskFile(o.frontmatter))continue;let l=o.frontmatter[i];typeof l=="number"&&l>0&&t.set(s.path,l)}return t}async getNotesForDate(t){if(this.disableNoteIndexing)return[];let n=[],i=ce(t),a=this.app.vault.getMarkdownFiles();for(let s of a){if(!this.isValidFile(s.path))continue;let o=this.app.metadataCache.getFileCache(s);if(!(o!=null&&o.frontmatter)||this.isTaskFile(o.frontmatter))continue;(o.frontmatter.date||o.frontmatter.scheduled)===i&&n.push({path:s.path,title:this.storeTitleInFilename?s.basename:o.frontmatter.title||s.basename,tags:o.frontmatter.tags||[]})}return n}async getTaskByPath(t){return this.getTaskInfo(t)}async getCachedTaskInfo(t){return this.getTaskInfo(t)}getCachedTaskInfoSync(t){if(!this.isValidFile(t))return null;let n=this.app.vault.getAbstractFileByPath(t);if(!(n instanceof Il.TFile))return null;let i=this.getPendingTaskInfo(t),a=this.app.metadataCache.getFileCache(n);if(!(a!=null&&a.frontmatter))return i;let s=this.isTaskFile(a.frontmatter)?this.extractTaskInfoFromNative(t,a.frontmatter):null;return i&&this.shouldUsePendingTaskInfo(i,s)?i:(this.pendingTaskInfoByPath.delete(t),s)}async readFrontmatterFromFile(t){try{let n=await this.app.vault.read(t);return this.parseFrontmatterFromContent(n,t.path)}catch(n){return Hh.warn(`TaskManager: Failed to read frontmatter fallback for ${t.path}`,{category:"validation",operation:"taskmanager-read-frontmatter-fallback",error:n}),null}}parseFrontmatterFromContent(t,n){let i=t.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!i)return null;try{let a=(0,Il.parseYaml)(i[1]||"");return!a||typeof a!="object"||Array.isArray(a)?null:a}catch(a){let s=n?` for ${n}`:"";return Hh.warn(`TaskManager: Failed to parse frontmatter fallback${s}`,{category:"validation",operation:"taskmanager-parse-frontmatter-fallback",details:n?{path:n}:void 0,error:a}),null}}isInitialized(){return this.initialized}destroy(){this.debouncedHandlers.forEach(t=>{window.clearTimeout(t)}),this.debouncedHandlers.clear(),this.eventListeners.forEach(t=>{this.app.metadataCache.offref(t)}),this.eventListeners=[],this.initialized=!1}setDependencyCache(t){this._dependencyCache=t}getBlockingTaskPaths(t){return this._dependencyCache?this._dependencyCache.getBlockingTaskPaths(t):(Hh.warn("DependencyCache not set in TaskManager",{category:"stale-data",operation:"dependencycache-not-set-taskmanager"}),[])}getBlockedTaskPaths(t){return this._dependencyCache?this._dependencyCache.getBlockedTaskPaths(t):(Hh.warn("DependencyCache not set in TaskManager",{category:"stale-data",operation:"dependencycache-not-set-taskmanager"}),[])}isTaskBlocked(t){return this._dependencyCache?this._dependencyCache.isTaskBlocked(t):!1}getTasksReferencingProject(t){return this._dependencyCache?this._dependencyCache.getTasksReferencingProject(t):(Hh.warn("DependencyCache not set in TaskManager",{category:"stale-data",operation:"dependencycache-not-set-taskmanager"}),[])}isFileUsedAsProject(t){return this._dependencyCache?this._dependencyCache.isFileUsedAsProject(t):!1}async waitForFreshTaskData(t,n=10){let i=typeof t=="string"?t:t.path,a=typeof t=="string"?this.app.vault.getAbstractFileByPath(i):t;if(!(a instanceof Il.TFile)){await new Promise(s=>window.setTimeout(s,100));return}for(let s=0;swindow.setTimeout(l,50*(s+1)))}Hh.warn(`TaskManager: Metadata cache not ready for ${i} after ${n} retries`,{category:"stale-data",operation:"taskmanager-metadata-cache-not-ready"})}updateConfig(t){this.settings=t,this.taskTag=t.taskTag,this.excludedFolders=cc(t.excludedFolders),this.disableNoteIndexing=t.disableNoteIndexing,this.storeTitleInFilename=t.storeTitleInFilename,this.pruneExcludedPendingTaskInfo(),this.trigger("data-changed")}pruneExcludedPendingTaskInfo(){for(let t of this.pendingTaskInfoByPath.keys())this.isValidFile(t)||this.pendingTaskInfoByPath.delete(t)}subscribe(t,n){return this.on(t,n),()=>{this.off(t,n)}}async getCalendarData(t,n){let i=await this.getAllTasks(),a={};for(let s of i)s.scheduled&&(a[s.scheduled]||(a[s.scheduled]=[]),a[s.scheduled].push(s)),s.due&&(a[s.due]||(a[s.due]=[]),a[s.due].includes(s)||a[s.due].push(s));return a}async getTaskInfoForDate(t){let n=ce(t),i=this.getTasksForDate(n),a=[];for(let s of i){let o=await this.getTaskInfo(s);o&&a.push(o)}return a}getTaskPathsByDate(t){return new Set(this.getTasksForDate(t))}getAllProjectsWithDetails(){return[]}getAllProjectFiles(){return[]}async rebuildDailyNotesCache(t,n){}async clearAllCaches(){this.pendingTaskInfoByPath.clear(),this.trigger("data-changed")}clearCacheEntry(t){this.pendingTaskInfoByPath.delete(t)}updateTaskInfoInCache(t,n){var i;if(!this.isValidFile(t)){this.pendingTaskInfoByPath.delete(t),this.trigger("data-changed");return}this.pendingTaskInfoByPath.set(t,{...n,id:(i=n.id)!=null?i:t,path:t}),this.trigger("file-updated",{path:t,updatedTask:n})}}});var sm,ZI,om,QI,qV=y(()=>{sm=require("obsidian");ko();Nw();G();ZI=I({tag:"Utils/DependencyCache"}),om="dependency-cache-changed",QI=class extends sm.Events{constructor(t,n,i,a,s){super();this.dependencySources=new Map;this.dependencyTargets=new Map;this.projectReferences=new Map;this.projectReferenceSources=new Map;this.initialized=!1;this.indexesBuilt=!1;this.eventListeners=[];this.app=t,this.settings=n,this.excludedFolders=cc(n.excludedFolders),this.fieldMapper=i,this.statusManager=a,this.isTaskFileCallback=s}initialize(){this.initialized||(this.setupEventListeners(),this.initialized=!0)}async buildIndexes(){if(this.indexesBuilt)return;let t=this.app.vault.getMarkdownFiles();for(let n of t){if(!this.isValidFile(n.path))continue;let i=this.app.metadataCache.getFileCache(n);!(i!=null&&i.frontmatter)||!this.isTaskFileCallback(i.frontmatter)||this.indexTaskFile(n.path,i.frontmatter)}this.indexesBuilt=!0,this.trigger(om)}setupEventListeners(){let t=this.app.metadataCache.on("changed",(a,s,o)=>{a instanceof sm.TFile&&a.extension==="md"&&this.handleFileChanged(a,o)});this.eventListeners.push(t);let n=this.app.metadataCache.on("deleted",(a,s)=>{a instanceof sm.TFile&&a.extension==="md"&&this.handleFileDeleted(a.path)});this.eventListeners.push(n);let i=this.app.vault.on("rename",(a,s)=>{a instanceof sm.TFile&&a.extension==="md"&&this.handleFileRenamed(a,s)});this.eventListeners.push(i)}handleFileChanged(t,n){let i=this.getFileRelationshipSignature(t.path);if(!this.isValidFile(t.path)){this.clearFileFromIndexes(t.path),this.triggerIfFileRelationshipsChanged(t.path,i);return}let a=this.app.metadataCache.getFileCache(t);if(!(a!=null&&a.frontmatter)){this.clearForwardDependencies(t.path),this.triggerIfFileRelationshipsChanged(t.path,i);return}if(!this.isTaskFileCallback(a.frontmatter)){this.clearForwardDependencies(t.path),this.triggerIfFileRelationshipsChanged(t.path,i);return}this.clearForwardDependencies(t.path),this.indexTaskFile(t.path,a.frontmatter),this.triggerIfFileRelationshipsChanged(t.path,i)}triggerIfFileRelationshipsChanged(t,n){this.getFileRelationshipSignature(t)!==n&&this.trigger(om)}getFileRelationshipSignature(t){let n=this.sortedSetValues(this.dependencySources.get(t)),i=this.sortedSetValues(this.dependencyTargets.get(t)),a=this.sortedSetValues(this.projectReferenceSources.get(t)),s=this.sortedSetValues(this.projectReferences.get(t));return JSON.stringify({blockedTasks:i,blockingTasks:n,projectTasks:s,referencedProjects:a})}sortedSetValues(t){return t?Array.from(t).sort():[]}handleFileDeleted(t){this.clearFileFromIndexes(t),this.trigger(om)}handleFileRenamed(t,n){let i=this.app.metadataCache.getFileCache(t);this.clearFileFromIndexes(n),this.isValidFile(t.path)&&(i!=null&&i.frontmatter)&&this.isTaskFileCallback(i.frontmatter)&&this.indexTaskFile(t.path,i.frontmatter),this.trigger(om)}resolveProjectReference(t,n){if(!n||typeof n!="string")return null;let i=n.trim();if(!i)return null;let a=wl(this.app,t,i);return(a==null?void 0:a.path)||null}indexTaskFile(t,n){var l,c;if(!this.isValidFile(t))return;let i=((l=this.fieldMapper)==null?void 0:l.toUserField("blockedBy"))||"blockedBy",a=((c=this.fieldMapper)==null?void 0:c.toUserField("projects"))||"project",s=n[i];if(s){let d=xv(s);if(d){let u=new Set;for(let p of d){let m=wl(this.app,t,p);m!=null&&m.path&&this.isValidFile(m.path)&&(u.add(m.path),this.dependencyTargets.has(m.path)||this.dependencyTargets.set(m.path,new Set),this.dependencyTargets.get(m.path).add(t))}u.size>0&&this.dependencySources.set(t,u)}}let o=n[a];if(o){let d=Array.isArray(o)?o:[o];for(let u of d)if(typeof u=="string"){let p=this.resolveProjectReference(t,u);p&&this.isValidFile(p)&&(this.projectReferences.has(p)||this.projectReferences.set(p,new Set),this.projectReferences.get(p).add(t),this.projectReferenceSources.has(t)||this.projectReferenceSources.set(t,new Set),this.projectReferenceSources.get(t).add(p))}}}clearForwardDependencies(t){let n=this.dependencySources.get(t);if(n){for(let a of n){let s=this.dependencyTargets.get(a);s&&(s.delete(t),s.size===0&&this.dependencyTargets.delete(a))}this.dependencySources.delete(t)}let i=this.projectReferenceSources.get(t);if(i){for(let a of i){let s=this.projectReferences.get(a);s&&(s.delete(t),s.size===0&&this.projectReferences.delete(a))}this.projectReferenceSources.delete(t)}}clearFileFromIndexes(t){let n=this.dependencySources.get(t);if(n){for(let o of n){let l=this.dependencyTargets.get(o);l&&(l.delete(t),l.size===0&&this.dependencyTargets.delete(o))}this.dependencySources.delete(t)}let i=this.dependencyTargets.get(t);if(i){for(let o of i){let l=this.dependencySources.get(o);l&&(l.delete(t),l.size===0&&this.dependencySources.delete(o))}this.dependencyTargets.delete(t)}let a=this.projectReferenceSources.get(t);if(a){for(let o of a){let l=this.projectReferences.get(o);l&&(l.delete(t),l.size===0&&this.projectReferences.delete(o))}this.projectReferenceSources.delete(t)}let s=this.projectReferences.get(t);if(s){for(let o of s){let l=this.projectReferenceSources.get(o);l&&(l.delete(t),l.size===0&&this.projectReferenceSources.delete(o))}this.projectReferences.delete(t)}}getBlockingTaskPaths(t){this.indexesBuilt||(ZI.warn("DependencyCache: getBlockingTaskPaths called before indexes built, building now...",{category:"stale-data",operation:"dependencycache-getblockingtaskpaths-called-indexes-built-building-now"}),this.buildIndexesSync());let n=this.dependencySources.get(t);return n?Array.from(n):[]}getBlockedTaskPaths(t){if(this.indexesBuilt||(ZI.warn("DependencyCache: getBlockedTaskPaths called before indexes built, building now...",{category:"stale-data",operation:"dependencycache-getblockedtaskpaths-called-indexes-built-building-now"}),this.buildIndexesSync()),this.isCompletedTask(t))return[];let n=this.dependencyTargets.get(t);return n?Array.from(n):[]}isTaskBlocked(t){var a;let n=this.getBlockingTaskPaths(t);if(n.length===0)return!1;let i=((a=this.fieldMapper)==null?void 0:a.toUserField("status"))||"status";for(let s of n){let o=this.app.vault.getAbstractFileByPath(s);if(!(o instanceof sm.TFile))continue;let l=this.app.metadataCache.getFileCache(o);if(!(l!=null&&l.frontmatter))continue;let c=l.frontmatter[i];if(!c||!this.statusManager.isCompletedStatus(c))return!0}return!1}isCompletedTask(t){var o;let n=this.app.vault.getAbstractFileByPath(t);if(!(n instanceof sm.TFile))return!1;let i=this.app.metadataCache.getFileCache(n);if(!(i!=null&&i.frontmatter))return!1;let a=((o=this.fieldMapper)==null?void 0:o.toUserField("status"))||"status",s=i.frontmatter[a];return!!(s&&this.statusManager.isCompletedStatus(s))}getTasksReferencingProject(t){this.indexesBuilt||(ZI.warn("DependencyCache: getTasksReferencingProject called before indexes built, building now...",{category:"stale-data",operation:"dependencycache-gettasksreferencingproject-called-indexes-built-building-now"}),this.buildIndexesSync());let n=this.projectReferences.get(t);return n?Array.from(n):[]}isFileUsedAsProject(t){return this.indexesBuilt||(ZI.warn("DependencyCache: isFileUsedAsProject called before indexes built, building now...",{category:"stale-data",operation:"dependencycache-isfileusedasproject-called-indexes-built-building-now"}),this.buildIndexesSync()),this.projectReferences.has(t)}buildIndexesSync(){if(this.indexesBuilt)return;let t=this.app.vault.getMarkdownFiles();for(let n of t){if(!this.isValidFile(n.path))continue;let i=this.app.metadataCache.getFileCache(n);!(i!=null&&i.frontmatter)||!this.isTaskFileCallback(i.frontmatter)||this.indexTaskFile(n.path,i.frontmatter)}this.indexesBuilt=!0,this.trigger(om)}updateConfig(t){this.settings=t,this.excludedFolders=cc(t.excludedFolders),this.clearIndexes(),this.indexesBuilt=!1}isValidFile(t){return!rv(t,this.excludedFolders)}clearIndexes(){this.dependencySources.clear(),this.dependencyTargets.clear(),this.projectReferences.clear(),this.projectReferenceSources.clear()}destroy(){this.eventListeners.forEach(t=>{this.app.metadataCache.offref(t)}),this.eventListeners=[],this.clearIndexes(),this.initialized=!1,this.indexesBuilt=!1}}});function Oo(r){let e=Wwe(r),t=e.match(JI);if(t){let[,i,a,s]=t,o=Number(i),l=Number(a),c=Number(s);if(!Gwe(o,l,c))throw new Error(`Invalid date "${r}".`);return new Date(Date.UTC(o,l-1,c,0,0,0,0))}if(!Ywe(e))throw new Error(`Invalid date "${r}".`);let n=new Date(e);if(!XI(n))throw new Error(`Invalid date "${r}".`);return n}function Mnt(r){let e=Wwe(r),t=e.match(JI);if(t){let[,i,a,s]=t,o=Number(i),l=Number(a),c=Number(s),d=new Date(o,l-1,c,0,0,0,0);if(!XI(d)||d.getFullYear()!==o||d.getMonth()!==l-1||d.getDate()!==c)throw new Error(`Invalid date "${r}".`);return d}if(!Ywe(e))throw new Error(`Invalid date "${r}".`);let n=new Date(e);if(!XI(n))throw new Error(`Invalid date "${r}".`);return n}function $c(r){if(!XI(r))return"";let e=r.getUTCFullYear(),t=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0");return`${e}-${t}-${n}`}function _nt(r){return $c(r)}function Ant(){let r=new Date,e=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${e}-${t}-${n}`}function GV(r){return Oo(Pb(r))}function Int(r){if(!/^\d{4}-\d{2}-\d{2}$/.test(r))throw new Error(`Invalid date "${r}". Expected YYYY-MM-DD.`);return Oo(r),r}function Nnt(r){return r?/T\d{2}:\d{2}/.test(r):!1}function Pb(r){if(!r)return"";let e=r.trim();if(JI.test(e))return e;let t=e.indexOf("T");if(t>-1)return e.slice(0,t);let n=e.indexOf(" ");return n>-1&&JI.test(e.slice(0,n))?e.slice(0,n):$c(Oo(e))}function Wwe(r,e="Date string cannot be empty"){if(!r||r.trim().length===0)throw new Error(e);return r.trim()}function Ywe(r){let e=r.match(Pnt);if(!e)return!1;let[,t,n,i,a,s,o,,l,c,d]=e;return Gwe(Number(t),Number(n),Number(i))&&Rnt(Number(a),Number(s),Number(o))&&Ont(l,c,d)}function Gwe(r,e,t){let n=new Date(Date.UTC(r,e-1,t,0,0,0,0));return n.getUTCFullYear()===r&&n.getUTCMonth()===e-1&&n.getUTCDate()===t}function Rnt(r,e,t){return r>=0&&r<=23&&e>=0&&e<=59&&t>=0&&t<=59}function Ont(r,e,t){if(!r)return!0;let n=Number(e),i=Number(t);return!(n>14||i>59||n===14&&i!==0)}function XI(r){return r instanceof Date&&!Number.isNaN(r.getTime())}function Kwe(r,e){if(!r.recurrence||typeof r.recurrence!="string")return!0;try{let t=Qwe(r);if(!t)return!1;let n=GV(_nt(e));return t.between(n,new Date(n.getTime()+1440*60*1e3-1),!0).length>0}catch(t){return!0}}function Zwe(r,e,t){if(!r.recurrence||typeof r.recurrence!="string")return[];try{let n=Qwe(r);if(!n)return[];let i=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),0,0,0,0)),a=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),23,59,59,999));return n.between(i,a,!0)}catch(n){let i=[],a=new Date(e);for(;a<=t;)Kwe(r,a)&&i.push(new Date(a)),a.setUTCDate(a.getUTCDate()+1);return i}}function Lnt(r,e={}){return r.recurrence?(r.recurrence_anchor||"scheduled")==="completion"?qnt(r,e):Vnt(r,e):null}function Fnt(r,e=!0,t={}){let n=Lnt(r,t),i=null,a=null,s=null;if(n){try{let o=r.scheduled?Oo(r.scheduled):null,l=r.due?Oo(r.due):null;if(o&&l){let c=!e&&l.getTime()=t)return c}return null}function qnt(r,e){if(!r.recurrence||typeof r.recurrence!="string")return null;let t=Oo(e.today||qwe()),n=Jwe(r.recurrence),i=KV(r.recurrence),a=i||t,s=new Date(a.getTime()+n*24*60*60*1e3),o=Zwe(r,a,s),l=new Set(r.skipped_instances||[]),c=i?i.getTime():0;for(let d of o){let u=$c(d);if(d.getTime()>c&&d>=t&&!l.has(u))return d}return null}function Wnt(r){let e=r.toLowerCase();return e==="true"||e==="false"?e==="true":r}function Ynt(r){let e=r.trim(),t=e.match(/^\[\[([^|\]#]+)(?:#[^\]|]+)?(?:\|[^\]]+)?\]\]$/);if(t)return t[1].trim();let n=e.match(/^\[[^\]]+\]\(([^)#]+)(?:#[^)]+)?\)$/);return n?decodeURI(n[1].trim()):e}function eSe(r,e="manual"){return Znt(r.occurrence_materialization)?r.occurrence_materialization:e}function Gnt(r,e="completion"){return Qnt(r.occurrence_next_trigger)?r.occurrence_next_trigger:e}function Qx(r){return typeof r.recurrence_parent=="string"&&typeof r.occurrence_date=="string"}function Vh(r){return r?Ynt(r).replace(/\\/g,"/").replace(/^\/+/,"").replace(/\.md$/i,"").trim().toLowerCase():""}function tSe(r){return`[[${r.path.replace(/\.md$/i,"")}]]`}function ZV(r,e,t,n=tSe(e)){let i=Vh(e.path),a=Vh(n);return r.find(s=>{if(s.occurrence_date!==t||!s.recurrence_parent)return!1;let o=Vh(s.recurrence_parent);return o===i||o===a})}function rSe({parentTask:r,targetDate:e,currentTimestamp:t,existingOccurrences:n=[],parentLink:i,defaultStatus:a=r.status,defaultPriority:s=r.priority,templateTask:o={},overrides:l={},allowNonGeneratedTarget:c=!0}){var v,k,b,w,S,x,C,D,_,O,L,N,R,z;if(!r.recurrence)throw new Error("occurrence_parent_not_recurring");let d=lSe(e),u=i||tSe(r),p=ZV(n,r,d,u),m=[];if(ait(r,d)||m.push({code:"materialization_target_not_generated",message:`Target date "${d}" is not generated by the parent recurrence rule.`,severity:c?"warning":"error",field:"occurrence_date"}),p)return{kind:"occurrence.materialize",parentTask:r,targetDate:d,parentReference:u,created:!1,existingOccurrence:p,occurrenceTask:p,fields:eN(p),issues:m,metadata:{idempotent:!0}};let f=Jnt(r,d),h=nit(f.customProperties,o.customProperties,l.customProperties),g=uSe({...f,...o,...l,id:void 0,path:void 0,archived:void 0,status:(k=(v=l.status)!=null?v:o.status)!=null?k:a,priority:(S=(w=(b=l.priority)!=null?b:o.priority)!=null?w:r.priority)!=null?S:s,scheduled:(D=(C=(x=l.scheduled)!=null?x:o.scheduled)!=null?C:f.scheduled)!=null?D:d,due:(O=(_=l.due)!=null?_:o.due)!=null?O:f.due,customProperties:h,recurrence:void 0,recurrence_anchor:void 0,complete_instances:void 0,skipped_instances:void 0,recurrence_parent:u,occurrence_date:d,occurrence_materialization:void 0,occurrence_next_trigger:void 0,occurrence_template:void 0,occurrence_past_horizon:void 0,occurrence_future_horizon:void 0,completedDate:void 0,timeEntries:void 0,totalTrackedTime:void 0,icsEventId:void 0,googleCalendarEventId:void 0,googleCalendarExceptionEventId:void 0,googleCalendarExceptionOriginalScheduled:void 0,googleCalendarMovedOriginalDates:void 0,basesData:void 0,blocking:void 0,isBlocked:void 0,isBlocking:void 0,hasSubtasks:void 0,dateCreated:(N=(L=l.dateCreated)!=null?L:o.dateCreated)!=null?N:t,dateModified:(z=(R=l.dateModified)!=null?R:o.dateModified)!=null?z:t});return{kind:"occurrence.materialize",parentTask:r,targetDate:d,parentReference:u,created:!0,occurrenceTask:g,fields:eN(g),issues:m,metadata:{idempotent:!1,template:r.occurrence_template}}}function nSe({occurrenceTask:r,parentTask:e,completedStatus:t,currentTimestamp:n,targetDate:i,maintainDueDateOffsetInRecurring:a}){let s=tN(r,i);if(rN(r,s),!e.recurrence)throw new Error("occurrence_parent_not_recurring");let o=pSe(Mb(e.complete_instances),s),l=Mb(e.skipped_instances).filter(f=>f!==s),c=dSe({parentTask:e,targetDate:s,completeInstances:o,skippedInstances:l,currentTimestamp:n,maintainDueDateOffsetInRecurring:a,advanceCompletionAnchor:!0}),d={status:t,completedDate:s,dateModified:n},u={...e,...c},p={...r,...d},m=eSe(e)==="on_completion"?Pb(u.scheduled||""):void 0;return nN({kind:"occurrence.complete",targetDate:s,occurrenceTask:r,parentTask:e,updatedOccurrenceTask:p,updatedParentTask:u,occurrenceUpdates:d,parentUpdates:c,currentTimestamp:n,materializeNextDate:m,metadata:{trigger:"completion"}})}function iSe({occurrenceTask:r,parentTask:e,activeStatus:t,currentTimestamp:n,targetDate:i}){let a=tN(r,i);rN(r,a);let s={complete_instances:Mb(e.complete_instances).filter(l=>l!==a),dateModified:n},o={status:t,completedDate:void 0,dateModified:n};return nN({kind:"occurrence.uncomplete",targetDate:a,occurrenceTask:r,parentTask:e,updatedOccurrenceTask:{...r,...o},updatedParentTask:{...e,...s},occurrenceUpdates:o,parentUpdates:s,currentTimestamp:n,metadata:{trigger:"uncomplete"}})}function aSe({occurrenceTask:r,parentTask:e,skippedStatus:t,currentTimestamp:n,targetDate:i,maintainDueDateOffsetInRecurring:a}){if(!t)throw new Error("missing_skipped_status");let s=tN(r,i);if(rN(r,s),!e.recurrence)throw new Error("occurrence_parent_not_recurring");let o=pSe(Mb(e.skipped_instances),s),l=Mb(e.complete_instances).filter(m=>m!==s),c=dSe({parentTask:e,targetDate:s,completeInstances:l,skippedInstances:o,currentTimestamp:n,maintainDueDateOffsetInRecurring:a,advanceCompletionAnchor:!1}),d={status:t,completedDate:void 0,dateModified:n},u={...e,...c},p=eSe(e)==="on_completion"&&Gnt(e)==="completion_or_skip"?Pb(u.scheduled||""):void 0;return nN({kind:"occurrence.skip",targetDate:s,occurrenceTask:r,parentTask:e,updatedOccurrenceTask:{...r,...d},updatedParentTask:u,occurrenceUpdates:d,parentUpdates:c,currentTimestamp:n,materializeNextDate:p,metadata:{trigger:"skip"}})}function sSe({occurrenceTask:r,parentTask:e,activeStatus:t,currentTimestamp:n,targetDate:i}){let a=tN(r,i);rN(r,a);let s={skipped_instances:Mb(e.skipped_instances).filter(l=>l!==a),dateModified:n},o={status:t,completedDate:void 0,dateModified:n};return nN({kind:"occurrence.unskip",targetDate:a,occurrenceTask:r,parentTask:e,updatedOccurrenceTask:{...r,...o},updatedParentTask:{...e,...s},occurrenceUpdates:o,parentUpdates:s,currentTimestamp:n,metadata:{trigger:"unskip"}})}function oSe(r,e){let t=[];for(let[n,i]of Object.entries(r)){let a=Knt(e,n);a&&(i===void 0||Array.isArray(i)&&i.length===0?t.push({op:"delete",field:a}):n==="status"?t.push({op:"set",field:a,value:Wnt(String(i))}):t.push({op:"set",field:a,value:i}))}return t}function eN(r){let e={};return qr(e,"title",r.title),qr(e,"status",r.status),qr(e,"priority",r.priority),qr(e,"due",r.due),qr(e,"scheduled",r.scheduled),qr(e,"completedDate",r.completedDate),qr(e,"dateCreated",r.dateCreated),qr(e,"dateModified",r.dateModified),qr(e,"recurrence",r.recurrence),qr(e,"recurrenceAnchor",r.recurrence_anchor),qr(e,"completeInstances",r.complete_instances),qr(e,"skippedInstances",r.skipped_instances),qr(e,"recurrenceParent",r.recurrence_parent),qr(e,"occurrenceDate",r.occurrence_date),qr(e,"occurrenceMaterialization",r.occurrence_materialization),qr(e,"occurrenceNextTrigger",r.occurrence_next_trigger),qr(e,"occurrenceTemplate",r.occurrence_template),qr(e,"occurrencePastHorizon",r.occurrence_past_horizon),qr(e,"occurrenceFutureHorizon",r.occurrence_future_horizon),qr(e,"timeEntries",r.timeEntries),qr(e,"tags",r.tags),qr(e,"contexts",r.contexts),qr(e,"projects",r.projects),qr(e,"timeEstimate",r.timeEstimate),qr(e,"blockedBy",r.blockedBy),qr(e,"reminders",r.reminders),e}function Knt(r,e){let n={title:"title",status:"status",priority:"priority",due:"due",scheduled:"scheduled",contexts:"contexts",projects:"projects",timeEstimate:"timeEstimate",completedDate:"completedDate",dateCreated:"dateCreated",dateModified:"dateModified",recurrence:"recurrence",recurrence_anchor:"recurrenceAnchor",complete_instances:"completeInstances",skipped_instances:"skippedInstances",recurrence_parent:"recurrenceParent",occurrence_date:"occurrenceDate",occurrence_materialization:"occurrenceMaterialization",occurrence_next_trigger:"occurrenceNextTrigger",occurrence_template:"occurrenceTemplate",occurrence_past_horizon:"occurrencePastHorizon",occurrence_future_horizon:"occurrenceFutureHorizon",timeEntries:"timeEntries",blockedBy:"blockedBy",reminders:"reminders",sortOrder:"sortOrder"}[e];return n?r[n]:void 0}function Znt(r){return r==="manual"||r==="on_completion"||r==="rolling"}function Qnt(r){return r==="completion"||r==="completion_or_skip"}function lSe(r){return Int(r instanceof Date?$c(r):Pb(r))}function tN(r,e){var t;return lSe((t=e!=null?e:r.occurrence_date)!=null?t:"")}function rN(r,e){if(!r.recurrence_parent||!r.occurrence_date)throw new Error("task_not_materialized_occurrence");if(r.occurrence_date!==e)throw new Error("occurrence_date_mismatch")}function Jnt(r,e){let t=r.scheduled?Bwe(r.scheduled,r.scheduled,e):e,n=r.due?Bwe(r.due,r.scheduled||r.due,e):void 0;return uSe({title:r.title,priority:r.priority,due:n,scheduled:t,contexts:YV(r.contexts),projects:YV(r.projects),tags:YV(r.tags),timeEstimate:r.timeEstimate,reminders:Uwe(r.reminders),blockedBy:Uwe(r.blockedBy),details:r.details,customProperties:rit(r.customProperties)})}function Bwe(r,e,t){try{let n=Pb(r),i=Pb(e);if(!n||!i)return;let a=eit(i,n),s=tit(t,a);return Xnt(r,s)}catch(n){return}}function Xnt(r,e){var i;let n=r.trim().match(/^(\d{4}-\d{2}-\d{2})(.*)$/);return n?`${e}${(i=n[2])!=null?i:""}`:e}function eit(r,e){let n=Oo(r).getTime(),i=Oo(e).getTime();return Math.round((i-n)/864e5)}function tit(r,e){let t=Oo(r);return t.setUTCDate(t.getUTCDate()+e),$c(t)}function YV(r){return Array.isArray(r)?[...r]:void 0}function Uwe(r){return Array.isArray(r)?r.map(e=>({...e})):void 0}function rit(r){if(!(!r||Object.keys(r).length===0))return cSe(r)}function nit(...r){let e={};for(let t of r)t&&Object.assign(e,cSe(t));return Object.keys(e).length>0?e:void 0}function cSe(r){let e={};for(let[t,n]of Object.entries(r))Array.isArray(n)?e[t]=[...n]:iit(n)?e[t]={...n}:e[t]=n;return e}function iit(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function ait(r,e){try{return Kwe(r,Oo(e))}catch(t){return!1}}function dSe({parentTask:r,targetDate:e,completeInstances:t,skippedInstances:n,currentTimestamp:i,maintainDueDateOffsetInRecurring:a,advanceCompletionAnchor:s}){let o=r.recurrence;typeof o=="string"&&o.length>0&&(s&&(r.recurrence_anchor||"scheduled")==="completion"?o=znt(o,e)||o:o.includes("DTSTART:")||(o=$nt(r)||o));let l={...r,recurrence:o,complete_instances:t,skipped_instances:n},c=Fnt(l,a,{today:e}),d={recurrence:o,complete_instances:t,skipped_instances:n,dateModified:i};return c.scheduled&&(d.scheduled=c.scheduled),c.due&&(d.due=c.due),d}function nN({kind:r,targetDate:e,occurrenceTask:t,parentTask:n,updatedOccurrenceTask:i,updatedParentTask:a,occurrenceUpdates:s,parentUpdates:o,currentTimestamp:l,materializeNextDate:c,metadata:d}){return{kind:r,targetDate:e,updatedOccurrenceTask:i,updatedParentTask:a,occurrenceUpdates:s,parentUpdates:o,occurrenceFields:eN(s),parentFields:eN(o),dateModified:l,changed:Hwe(t,s)||Hwe(n,o),materializeNextDate:c||void 0,metadata:d}}function Hwe(r,e){return Object.entries(e).some(([t,n])=>r[t]!==n)}function uSe(r){let e={};for(let[t,n]of Object.entries(r))n!==void 0&&(e[t]=n);return e}function qr(r,e,t){t!==void 0&&(r[e]=t)}function pSe(r,e){return r.includes(e)?r:[...r,e]}function Mb(r){return Array.isArray(r)?r.filter(e=>typeof e=="string"):[]}var JI,Pnt,qwe,WV,Vwe,jwe,QV=y(()=>{mv();JI=/^(\d{4})-(\d{2})-(\d{2})$/,Pnt=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,3})?(?:Z|([+-])(\d{2}):(\d{2}))?$/;qwe=Ant;WV=Reflect.get(Mp,"default"),jwe=(Vwe=ye)!=null?Vwe:WV==null?void 0:WV.RRule});function ur(r){if(r&&typeof r=="object")switch(r[Fa]){case Nl:case Du:return!0}return!1}function Ut(r){if(r&&typeof r=="object")switch(r[Fa]){case iN:case Nl:case Xs:case Du:return!0}return!1}var iN,aN,Nl,JV,Xs,Du,Fa,Lo,Fo,$o,It,pt,zo,sN,tr=y(()=>{iN=Symbol.for("yaml.alias"),aN=Symbol.for("yaml.document"),Nl=Symbol.for("yaml.map"),JV=Symbol.for("yaml.pair"),Xs=Symbol.for("yaml.scalar"),Du=Symbol.for("yaml.seq"),Fa=Symbol.for("yaml.node.type"),Lo=r=>!!r&&typeof r=="object"&&r[Fa]===iN,Fo=r=>!!r&&typeof r=="object"&&r[Fa]===aN,$o=r=>!!r&&typeof r=="object"&&r[Fa]===Nl,It=r=>!!r&&typeof r=="object"&&r[Fa]===JV,pt=r=>!!r&&typeof r=="object"&&r[Fa]===Xs,zo=r=>!!r&&typeof r=="object"&&r[Fa]===Du;sN=r=>(pt(r)||ur(r))&&!!r.anchor});function Rl(r,e){let t=fSe(e);Fo(r)?_b(null,r.contents,t,Object.freeze([r]))===zc&&(r.contents=null):_b(null,r,t,Object.freeze([]))}function _b(r,e,t,n){let i=hSe(r,e,t,n);if(Ut(i)||It(i))return gSe(r,n,i),_b(r,i,t,n);if(typeof i!="symbol"){if(ur(e)){n=Object.freeze(n.concat(e));for(let a=0;a{tr();cs=Symbol("break visit"),mSe=Symbol("skip children"),zc=Symbol("remove node");Rl.BREAK=cs;Rl.SKIP=mSe;Rl.REMOVE=zc;Jx.BREAK=cs;Jx.SKIP=mSe;Jx.REMOVE=zc});var sit,oit,jc,XV=y(()=>{tr();Xx();sit={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},oit=r=>r.replace(/[!,[\]{}]/g,e=>sit[e]),jc=class r{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},r.defaultYaml,e),this.tags=Object.assign({},r.defaultTags,t)}clone(){let e=new r(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new r(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:r.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},r.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:r.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},r.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[a,s]=n;return this.tags[a]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[a]=n;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let s=/^\d+\.\d+$/.test(a);return t(6,`Unsupported YAML version ${a}`,s),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);let a=this.tags[n];if(a)try{return a+decodeURIComponent(i)}catch(s){return t(String(s)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+oit(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&Ut(e.contents)){let a={};Rl(e.contents,(s,o)=>{Ut(o)&&o.tag&&(a[o.tag]=!0)}),i=Object.keys(a)}else i=[];for(let[a,s]of n)a==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(o=>o.startsWith(s)))&&t.push(`%TAG ${a} ${s}`);return t.join(` +`)}};jc.defaultYaml={explicit:!1,version:"1.2"};jc.defaultTags={"!!":"tag:yaml.org,2002:"}});function oN(r){if(/[\x00-\x19\s,[\]{}]/.test(r)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(r)}`;throw new Error(t)}return!0}function eq(r){let e=new Set;return Rl(r,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function tq(r,e){for(let t=1;;++t){let n=`${r}${t}`;if(!e.has(n))return n}}function ySe(r,e){let t=[],n=new Map,i=null;return{onAnchor:a=>{t.push(a),i!=null||(i=eq(r));let s=tq(e,i);return i.add(s),s},setAnchors:()=>{for(let a of t){let s=n.get(a);if(typeof s=="object"&&s.anchor&&(pt(s.node)||ur(s.node)))s.node.anchor=s.anchor;else{let o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=a,o}}},sourceObjects:n}}var lN=y(()=>{tr();Xx()});function lm(r,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,a=n.length;i{});function ui(r,e,t){if(Array.isArray(r))return r.map((n,i)=>ui(n,String(i),t));if(r&&typeof r.toJSON=="function"){if(!t||!sN(r))return r.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(r,n),t.onCreate=a=>{n.res=a,delete t.onCreate};let i=r.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof r=="bigint"&&!(t!=null&&t.keep)?Number(r):r}var cm=y(()=>{tr()});var dm,cN=y(()=>{rq();tr();cm();dm=class{constructor(e){Object.defineProperty(this,Fa,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:a}={}){if(!Fo(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},o=ui(this,"",s);if(typeof i=="function")for(let{count:l,res:c}of s.anchors.values())i(c,l);return typeof a=="function"?lm(a,{"":o},"",o):o}}});function dN(r,e,t){if(Lo(e)){let n=e.resolve(r),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(ur(e)){let n=0;for(let i of e.items){let a=dN(r,i,t);a>n&&(n=a)}return n}else if(It(e)){let n=dN(r,e.key,t),i=dN(r,e.value,t);return Math.max(n,i)}return 1}var Bc,eC=y(()=>{lN();Xx();tr();cN();cm();Bc=class extends dm{constructor(e){super(iN),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if((t==null?void 0:t.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let n;t!=null&&t.aliasResolveCache?n=t.aliasResolveCache:(n=[],Rl(e,{Node:(a,s)=>{(Lo(s)||sN(s))&&n.push(s)}}),t&&(t.aliasResolveCache=n));let i;for(let a of n){if(a===this)break;a.anchor===this.source&&(i=a)}return i}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:a}=t,s=this.resolve(i,t);if(!s){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let o=n.get(s);if(o||(ui(s,null,t),o=n.get(s)),(o==null?void 0:o.res)===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(a>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=dN(i,s,n)),o.count*o.aliasCount>a)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return o.res}toString(e,t,n){let i=`*${this.source}`;if(e){if(oN(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${i} `}return i}}});var uN,Pe,Jn=y(()=>{tr();cN();cm();uN=r=>!r||typeof r!="function"&&typeof r!="object",Pe=class extends dm{constructor(e){super(Xs),this.value=e}toJSON(e,t){return t!=null&&t.keep?this.value:ui(this.value,e,t)}toString(){return String(this.value)}};Pe.BLOCK_FOLDED="BLOCK_FOLDED";Pe.BLOCK_LITERAL="BLOCK_LITERAL";Pe.PLAIN="PLAIN";Pe.QUOTE_DOUBLE="QUOTE_DOUBLE";Pe.QUOTE_SINGLE="QUOTE_SINGLE"});function cit(r,e,t){var n;if(e){let i=t.filter(s=>s.tag===e),a=(n=i.find(s=>!s.format))!=null?n:i[0];if(!a)throw new Error(`Tag ${e} not found`);return a}return t.find(i=>{var a;return((a=i.identify)==null?void 0:a.call(i,r))&&!i.format})}function Pu(r,e,t){var u,p,m,f;if(Fo(r)&&(r=r.contents),Ut(r))return r;if(It(r)){let h=(p=(u=t.schema[Nl]).createNode)==null?void 0:p.call(u,t.schema,null,t);return h.items.push(r),h}(r instanceof String||r instanceof Number||r instanceof Boolean||typeof BigInt!="undefined"&&r instanceof BigInt)&&(r=r.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:a,schema:s,sourceObjects:o}=t,l;if(n&&r&&typeof r=="object"){if(l=o.get(r),l)return(m=l.anchor)!=null||(l.anchor=i(r)),new Bc(l.anchor);l={anchor:null,node:null},o.set(r,l)}e!=null&&e.startsWith("!!")&&(e=lit+e.slice(2));let c=cit(r,e,s.tags);if(!c){if(r&&typeof r.toJSON=="function"&&(r=r.toJSON()),!r||typeof r!="object"){let h=new Pe(r);return l&&(l.node=h),h}c=r instanceof Map?s[Nl]:Symbol.iterator in Object(r)?s[Du]:s[Nl]}a&&(a(c),delete t.onTagObj);let d=c!=null&&c.createNode?c.createNode(t.schema,r,t):typeof((f=c==null?void 0:c.nodeClass)==null?void 0:f.from)=="function"?c.nodeClass.from(t.schema,r,t):new Pe(r);return e?d.tag=e:c.default||(d.tag=c.tag),l&&(l.node=d),d}var lit,tC=y(()=>{eC();tr();Jn();lit="tag:yaml.org,2002:"});function rC(r,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let a=e[i];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let s=[];s[a]=n,n=s}else n=new Map([[a,n]])}return Pu(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:r,sourceObjects:new Map})}var Nb,Ib,pN=y(()=>{tC();tr();cN();Nb=r=>r==null||typeof r=="object"&&!!r[Symbol.iterator]().next().done,Ib=class extends dm{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>Ut(n)||It(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Nb(e))this.add(t);else{let[n,...i]=e,a=this.get(n,!0);if(ur(a))a.addIn(i,t);else if(a===void 0&&this.schema)this.set(n,rC(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!0);if(ur(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...i]=e,a=this.get(n,!0);return i.length===0?!t&&pt(a)?a.value:a:ur(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!It(t))return!1;let n=t.value;return n==null||e&&pt(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let i=this.get(t,!0);return ur(i)?i.hasIn(n):!1}setIn(e,t){let[n,...i]=e;if(i.length===0)this.set(n,t);else{let a=this.get(n,!0);if(ur(a))a.setIn(i,t);else if(a===void 0&&this.schema)this.set(n,rC(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}});function jo(r,e){return/^\n+$/.test(r)?r.substring(1):e?r.replace(/^(?! *$)/gm,e):r}var vSe,Uc,nC=y(()=>{vSe=r=>r.replace(/^(?!$)(?: $)?/gm,"#");Uc=(r,e,t)=>r.endsWith(` +`)?jo(t,e):t.includes(` +`)?` +`+jo(t,e):(r.endsWith(" ")?"":" ")+t});function aC(r,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:a=20,onFold:s,onOverflow:o}={}){if(!i||i<0)return r;ii-Math.max(2,a)?c.push(0):u=i-n);let p,m,f=!1,h=-1,g=-1,v=-1;t===mN&&(h=bSe(r,h,e.length),h!==-1&&(u=h+l));for(let b;b=r[h+=1];){if(t===iC&&b==="\\"){switch(g=h,r[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}v=h}if(b===` +`)t===mN&&(h=bSe(r,h,e.length)),u=h+e.length+l,p=void 0;else{if(b===" "&&m&&m!==" "&&m!==` +`&&m!==" "){let w=r[h+1];w&&w!==" "&&w!==` +`&&w!==" "&&(p=h)}if(h>=u)if(p)c.push(p),u=p+l,p=void 0;else if(t===iC){for(;m===" "||m===" ";)m=b,b=r[h+=1],f=!0;let w=h>v+1?h-2:g-1;if(d[w])return r;c.push(w),d[w]=!0,u=w+l,p=void 0}else f=!0}m=b}if(f&&o&&o(),c.length===0)return r;s&&s();let k=r.slice(0,c[0]);for(let b=0;b{nq="flow",mN="block",iC="quoted"});function dit(r,e,t){if(!e||e<0)return!1;let n=e-t,i=r.length;if(i<=n)return!1;for(let a=0,s=0;an)return!0;if(s=a+1,i-s<=n)return!1}return!0}function sC(r,e){let t=JSON.stringify(r);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(gN(r)?" ":""),s="",o=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(s+=t.slice(o,l)+"\\ ",l+=1,o=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{s+=t.slice(o,l);let d=t.substr(l+2,4);switch(d){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:d.substr(0,2)==="00"?s+="\\x"+d.substr(2):s+=t.substr(l,6)}l+=5,o=l+1}break;case"n":if(n||t[l+2]==='"'||t.length +`;let u,p;for(p=t.length;p>0;--p){let S=t[p-1];if(S!==` +`&&S!==" "&&S!==" ")break}let m=t.substring(p),f=m.indexOf(` +`);f===-1?u="-":t===m||f!==m.length-1?(u="+",a&&a()):u="",m&&(t=t.slice(0,-m.length),m[m.length-1]===` +`&&(m=m.slice(0,-1)),m=m.replace(aq,`$&${c}`));let h=!1,g,v=-1;for(g=0;g{x=!0});let D=aC(`${k}${S}${m}`,c,mN,C);if(!x)return`>${w} +${c}${D}`}return t=t.replace(/\n+/g,`$&${c}`),`|${w} +${c}${k}${t}${m}`}function uit(r,e,t,n){let{type:i,value:a}=r,{actualString:s,implicitKey:o,indent:l,indentStep:c,inFlow:d}=e;if(o&&a.includes(` +`)||d&&/[[\]{},]/.test(a))return Rb(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return o||d||!a.includes(` +`)?Rb(a,e):fN(r,e,t,n);if(!o&&!d&&i!==Pe.PLAIN&&a.includes(` +`))return fN(r,e,t,n);if(gN(a)){if(l==="")return e.forceBlockIndent=!0,fN(r,e,t,n);if(o&&l===c)return Rb(a,e)}let u=a.replace(/\n+/g,`$& +${l}`);if(s){let p=h=>{var g;return h.default&&h.tag!=="tag:yaml.org,2002:str"&&((g=h.test)==null?void 0:g.test(u))},{compat:m,tags:f}=e.doc.schema;if(f.some(p)||m!=null&&m.some(p))return Rb(a,e)}return o?u:aC(u,l,nq,hN(e,!1))}function Mu(r,e,t,n){let{implicitKey:i,inFlow:a}=e,s=typeof r.value=="string"?r:Object.assign({},r,{value:String(r.value)}),{type:o}=r;o!==Pe.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(o=Pe.QUOTE_DOUBLE);let l=d=>{switch(d){case Pe.BLOCK_FOLDED:case Pe.BLOCK_LITERAL:return i||a?Rb(s.value,e):fN(s,e,t,n);case Pe.QUOTE_DOUBLE:return sC(s.value,e);case Pe.QUOTE_SINGLE:return iq(s.value,e);case Pe.PLAIN:return uit(s,e,t,n);default:return null}},c=l(o);if(c===null){let{defaultKeyType:d,defaultStringType:u}=e.options,p=i&&d||u;if(c=l(p),c===null)throw new Error(`Unsupported default string type ${p}`)}return c}var hN,gN,aq,oC=y(()=>{Jn();TSe();hN=(r,e)=>({indentAtStart:e?r.indent.length:r.indentAtStart,lineWidth:r.options.lineWidth,minContentWidth:r.options.minContentWidth}),gN=r=>/^(%|---|\.\.\.)/m.test(r);try{aq=new RegExp(`(^|(?c.tag===e.tag);if(l.length>0)return(i=l.find(c=>c.format===e.format))!=null?i:l[0]}let t,n;if(pt(e)){n=e.value;let l=r.filter(c=>{var d;return(d=c.identify)==null?void 0:d.call(c,n)});if(l.length>1){let c=l.filter(d=>d.test);c.length>0&&(l=c)}t=(a=l.find(c=>c.format===e.format))!=null?a:l.find(c=>!c.format)}else n=e,t=r.find(l=>l.nodeClass&&n instanceof l.nodeClass);if(!t){let l=(o=(s=n==null?void 0:n.constructor)==null?void 0:s.name)!=null?o:n===null?"null":typeof n;throw new Error(`Tag not resolved for ${l} value`)}return t}function mit(r,e,{anchors:t,doc:n}){var o;if(!n.directives)return"";let i=[],a=(pt(r)||ur(r))&&r.anchor;a&&oN(a)&&(t.add(a),i.push(`&${a}`));let s=(o=r.tag)!=null?o:e.default?null:e.tag;return s&&i.push(n.directives.tagString(s)),i.join(" ")}function _u(r,e,t,n){var l,c;if(It(r))return r.toString(e,t,n);if(Lo(r)){if(e.doc.directives)return r.toString(e);if((l=e.resolvedAliases)!=null&&l.has(r))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(r):e.resolvedAliases=new Set([r]),r=r.resolve(e.doc)}let i,a=Ut(r)?r:e.doc.createNode(r,{onTagObj:d=>i=d});i!=null||(i=pit(e.doc.schema.tags,a));let s=mit(a,i,e);s.length>0&&(e.indentAtStart=((c=e.indentAtStart)!=null?c:0)+s.length+1);let o=typeof i.stringify=="function"?i.stringify(a,e,t,n):pt(a)?Mu(a,e,t,n):a.toString(e,t,n);return s?pt(a)||o[0]==="{"||o[0]==="["?`${s} ${o}`:`${s} +${e.indent}${o}`:o}var lC=y(()=>{lN();tr();nC();oC()});function kSe({key:r,value:e},t,n,i){var C,D;let{allNullValues:a,doc:s,indent:o,indentStep:l,options:{commentString:c,indentSeq:d,simpleKeys:u}}=t,p=Ut(r)&&r.comment||null;if(u){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(ur(r)||!Ut(r)&&typeof r=="object"){let _="With simple keys, collection cannot be used as a key value";throw new Error(_)}}let m=!u&&(!r||p&&e==null&&!t.inFlow||ur(r)||(pt(r)?r.type===Pe.BLOCK_FOLDED||r.type===Pe.BLOCK_LITERAL:typeof r=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!m&&(u||!a),indent:o+l});let f=!1,h=!1,g=_u(r,t,()=>f=!0,()=>h=!0);if(!m&&!t.inFlow&&g.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(t.inFlow){if(a||e==null)return f&&n&&n(),g===""?"?":m?`? ${g}`:g}else if(a&&!u||e==null&&m)return g=`? ${g}`,p&&!f?g+=Uc(g,t.indent,c(p)):h&&i&&i(),g;f&&(p=null),m?(p&&(g+=Uc(g,t.indent,c(p))),g=`? ${g} +${o}:`):(g=`${g}:`,p&&(g+=Uc(g,t.indent,c(p))));let v,k,b;Ut(e)?(v=!!e.spaceBefore,k=e.commentBefore,b=e.comment):(v=!1,k=null,b=null,e&&typeof e=="object"&&(e=s.createNode(e))),t.implicitKey=!1,!m&&!p&&pt(e)&&(t.indentAtStart=g.length+1),h=!1,!d&&l.length>=2&&!t.inFlow&&!m&&zo(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let w=!1,S=_u(e,t,()=>w=!0,()=>h=!0),x=" ";if(p||v||k){if(x=v?` +`:"",k){let _=c(k);x+=` +${jo(_,t.indent)}`}S===""&&!t.inFlow?x===` +`&&b&&(x=` + +`):x+=` +${t.indent}`}else if(!m&&ur(e)){let _=S[0],O=S.indexOf(` +`),L=O!==-1,N=(D=(C=t.inFlow)!=null?C:e.flow)!=null?D:e.items.length===0;if(L||!N){let R=!1;if(L&&(_==="&"||_==="!")){let z=S.indexOf(" ");_==="&"&&z!==-1&&z{tr();Jn();lC();nC()});function vN(r,e){(r==="debug"||r==="warn")&&console.warn(e)}var sq=y(()=>{});function lq(r,e,t){let n=ESe(r,t);if(zo(n))for(let i of n.items)oq(r,e,i);else if(Array.isArray(n))for(let i of n)oq(r,e,i);else oq(r,e,n)}function oq(r,e,t){let n=ESe(r,t);if(!$o(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,r,Map);for(let[a,s]of i)e instanceof Map?e.has(a)||e.set(a,s):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function ESe(r,e){return r&&Lo(e)?e.resolve(r.doc,r):e}var bN,Ol,SSe,TN=y(()=>{tr();Jn();bN="<<",Ol={identify:r=>r===bN||typeof r=="symbol"&&r.description===bN,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Pe(Symbol(bN)),{addToJSMap:lq}),stringify:()=>bN},SSe=(r,e)=>(Ol.identify(e)||pt(e)&&(!e.type||e.type===Pe.PLAIN)&&Ol.identify(e.value))&&(r==null?void 0:r.doc.schema.tags.some(t=>t.tag===Ol.tag&&t.default))});function kN(r,e,{key:t,value:n}){if(Ut(t)&&t.addToJSMap)t.addToJSMap(r,e,n);else if(SSe(r,t))lq(r,e,n);else{let i=ui(t,"",r);if(e instanceof Map)e.set(i,ui(n,i,r));else if(e instanceof Set)e.add(i);else{let a=fit(t,i,r),s=ui(n,a,r);a in e?Object.defineProperty(e,a,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[a]=s}}return e}function fit(r,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(Ut(r)&&(t!=null&&t.doc)){let n=yN(t.doc,{});n.anchors=new Set;for(let a of t.anchors.keys())n.anchors.add(a.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=r.toString(n);if(!t.mapKeyWarned){let a=JSON.stringify(i);a.length>40&&(a=a.substring(0,36)+'..."'),vN(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}var cq=y(()=>{sq();TN();lC();tr();cm()});function Ob(r,e,t){let n=Pu(r,void 0,t),i=Pu(e,void 0,t);return new Tn(n,i)}var Tn,um=y(()=>{tC();wSe();cq();tr();Tn=class r{constructor(e,t=null){Object.defineProperty(this,Fa,{value:JV}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return Ut(t)&&(t=t.clone(e)),Ut(n)&&(n=n.clone(e)),new r(t,n)}toJSON(e,t){let n=t!=null&&t.mapAsMap?new Map:{};return kN(t,n,this)}toString(e,t,n){return e!=null&&e.doc?kSe(this,e,t,n):JSON.stringify(this)}}});function SN(r,e,t){var a;return(((a=e.inFlow)!=null?a:r.flow)?git:hit)(r,e,t)}function hit({comment:r,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:a,onChompKeep:s,onComment:o}){let{indent:l,options:{commentString:c}}=t,d=Object.assign({},t,{indent:a,type:null}),u=!1,p=[];for(let f=0;fg=null,()=>u=!0);g&&(v+=Uc(v,a,c(g))),u&&g&&(u=!1),p.push(n+v)}let m;if(p.length===0)m=i.start+i.end;else{m=p[0];for(let f=1;fg=null);c||(c=u.length>d||v.includes(` +`)),f0&&(c||(c=u.reduce((k,b)=>k+b.length+2,2)+(v.length+2)>e.options.lineWidth)),c&&(v+=",")),g&&(v+=Uc(v,n,o(g))),u.push(v),d=u.length}let{start:p,end:m}=t;if(u.length===0)return p+m;if(!c){let f=u.reduce((h,g)=>h+g.length+2,2);c=e.options.lineWidth>0&&f>e.options.lineWidth}if(c){let f=p;for(let h of u)f+=h?` +${a}${i}${h}`:` +`;return`${f} +${i}${m}`}else return`${p}${s}${u.join(" ")}${s}${m}`}function wN({indent:r,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let a=jo(e(n),r);t.push(a.trimStart())}}var dq=y(()=>{tr();lC();nC()});function pm(r,e){let t=pt(e)?e.value:e;for(let n of r)if(It(n)&&(n.key===e||n.key===t||pt(n.key)&&n.key.value===t))return n}var An,mm=y(()=>{dq();cq();pN();tr();um();Jn();An=class extends Ib{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Nl,e),this.items=[]}static from(e,t,n){let{keepUndefined:i,replacer:a}=n,s=new this(e),o=(l,c)=>{if(typeof a=="function")c=a.call(t,l,c);else if(Array.isArray(a)&&!a.includes(l))return;(c!==void 0||i)&&s.items.push(Ob(l,c,n))};if(t instanceof Map)for(let[l,c]of t)o(l,c);else if(t&&typeof t=="object")for(let l of Object.keys(t))o(l,t[l]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,t){var s;let n;It(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Tn(e,e==null?void 0:e.value):n=new Tn(e.key,e.value);let i=pm(this.items,n.key),a=(s=this.schema)==null?void 0:s.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);pt(i.value)&&uN(n.value)?i.value.value=n.value:i.value=n.value}else if(a){let o=this.items.findIndex(l=>a(n,l)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=pm(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){var a;let n=pm(this.items,e),i=n==null?void 0:n.value;return(a=!t&&pt(i)?i.value:i)!=null?a:void 0}has(e){return!!pm(this.items,e)}set(e,t){this.add(new Tn(e,t),!0)}toJSON(e,t,n){let i=n?new n:t!=null&&t.mapAsMap?new Map:{};t!=null&&t.onCreate&&t.onCreate(i);for(let a of this.items)kN(t,i,a);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!It(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),SN(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}});var Ll,Lb=y(()=>{tr();mm();Ll={collection:"map",default:!0,nodeClass:An,tag:"tag:yaml.org,2002:map",resolve(r,e){return $o(r)||e("Expected a mapping for this tag"),r},createNode:(r,e,t)=>An.from(r,e,t)}});function EN(r){let e=pt(r)?r.value:r;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var $i,fm=y(()=>{tC();dq();pN();tr();Jn();cm();$i=class extends Ib{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Du,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=EN(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=EN(e);if(typeof n!="number")return;let i=this.items[n];return!t&&pt(i)?i.value:i}has(e){let t=EN(e);return typeof t=="number"&&t{tr();fm();Fl={collection:"seq",default:!0,nodeClass:$i,tag:"tag:yaml.org,2002:seq",resolve(r,e){return zo(r)||e("Expected a sequence for this tag"),r},createNode:(r,e,t)=>$i.from(r,e,t)}});var hm,cC=y(()=>{oC();hm={identify:r=>typeof r=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:r=>r,stringify(r,e,t,n){return e=Object.assign({actualString:!0},e),Mu(r,e,t,n)}}});var qh,xN=y(()=>{Jn();qh={identify:r=>r==null,createNode:()=>new Pe(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Pe(null),stringify:({source:r},e)=>typeof r=="string"&&qh.test.test(r)?r:e.options.nullStr}});var dC,uq=y(()=>{Jn();dC={identify:r=>typeof r=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:r=>new Pe(r[0]==="t"||r[0]==="T"),stringify({source:r,value:e},t){if(r&&dC.test.test(r)){let n=r[0]==="t"||r[0]==="T";if(e===n)return r}return e?t.options.trueStr:t.options.falseStr}}});function da({format:r,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let a=Object.is(n,-0)?"-0":JSON.stringify(n);if(!r&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let s=a.indexOf(".");s<0&&(s=a.length,a+=".");let o=e-(a.length-s-1);for(;o-- >0;)a+="0"}return a}var $b=y(()=>{});var CN,DN,PN,pq=y(()=>{Jn();$b();CN={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:r=>r.slice(-3).toLowerCase()==="nan"?NaN:r[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:da},DN={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:r=>parseFloat(r),stringify(r){let e=Number(r.value);return isFinite(e)?e.toExponential():da(r)}},PN={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(r){let e=new Pe(parseFloat(r)),t=r.indexOf(".");return t!==-1&&r[r.length-1]==="0"&&(e.minFractionDigits=r.length-t-1),e},stringify:da}});function xSe(r,e,t){let{value:n}=r;return MN(n)&&n>=0?t+n.toString(e):da(r)}var MN,mq,_N,AN,IN,fq=y(()=>{$b();MN=r=>typeof r=="bigint"||Number.isInteger(r),mq=(r,e,t,{intAsBigInt:n})=>n?BigInt(r):parseInt(r.substring(e),t);_N={identify:r=>MN(r)&&r>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(r,e,t)=>mq(r,2,8,t),stringify:r=>xSe(r,8,"0o")},AN={identify:MN,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(r,e,t)=>mq(r,0,10,t),stringify:da},IN={identify:r=>MN(r)&&r>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(r,e,t)=>mq(r,2,16,t),stringify:r=>xSe(r,16,"0x")}});var CSe,DSe=y(()=>{Lb();xN();Fb();cC();uq();pq();fq();CSe=[Ll,Fl,hm,qh,dC,_N,AN,IN,CN,DN,PN]});function PSe(r){return typeof r=="bigint"||Number.isInteger(r)}var NN,yit,vit,MSe,_Se=y(()=>{Jn();Lb();Fb();NN=({value:r})=>JSON.stringify(r),yit=[{identify:r=>typeof r=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:r=>r,stringify:NN},{identify:r=>r==null,createNode:()=>new Pe(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:NN},{identify:r=>typeof r=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:r=>r==="true",stringify:NN},{identify:PSe,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(r,e,{intAsBigInt:t})=>t?BigInt(r):parseInt(r,10),stringify:({value:r})=>PSe(r)?r.toString():JSON.stringify(r)},{identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:r=>parseFloat(r),stringify:NN}],vit={default:!0,tag:"",test:/^/,resolve(r,e){return e(`Unresolved plain scalar ${JSON.stringify(r)}`),r}},MSe=[Ll,Fl].concat(yit,vit)});var uC,hq=y(()=>{Jn();oC();uC={identify:r=>r instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(r,e){if(typeof atob=="function"){let t=atob(r.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let i=0;i1&&e("Each pair must have its own sequence indicator");let a=i.items[0]||new Tn(new Pe(null));if(i.commentBefore&&(a.key.commentBefore=a.key.commentBefore?`${i.commentBefore} +${a.key.commentBefore}`:i.commentBefore),i.comment){let s=(t=a.value)!=null?t:a.key;s.comment=s.comment?`${i.comment} +${s.comment}`:i.comment}i=a}r.items[n]=It(i)?i:new Tn(i)}}else e("Expected a sequence for this tag");return r}function yq(r,e,t){let{replacer:n}=t,i=new $i(r);i.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(a++),s));let o,l;if(Array.isArray(s))if(s.length===2)o=s[0],l=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let c=Object.keys(s);if(c.length===1)o=c[0],l=s[o];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else o=s;i.items.push(Ob(o,l,t))}return i}var pC,RN=y(()=>{tr();um();Jn();fm();pC={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:gq,createNode:yq}});var zb,mC,vq=y(()=>{tr();cm();mm();fm();RN();zb=class r extends $i{constructor(){super(),this.add=An.prototype.add.bind(this),this.delete=An.prototype.delete.bind(this),this.get=An.prototype.get.bind(this),this.has=An.prototype.has.bind(this),this.set=An.prototype.set.bind(this),this.tag=r.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t!=null&&t.onCreate&&t.onCreate(n);for(let i of this.items){let a,s;if(It(i)?(a=ui(i.key,"",t),s=ui(i.value,a,t)):a=ui(i,"",t),n.has(a))throw new Error("Ordered maps must not include duplicate keys");n.set(a,s)}return n}static from(e,t,n){let i=yq(e,t,n),a=new this;return a.items=i.items,a}};zb.tag="tag:yaml.org,2002:omap";mC={collection:"seq",identify:r=>r instanceof Map,nodeClass:zb,default:!1,tag:"tag:yaml.org,2002:omap",resolve(r,e){let t=gq(r,e),n=[];for(let{key:i}of t.items)pt(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new zb,t)},createNode:(r,e,t)=>zb.from(r,e,t)}});function ASe({value:r,source:e},t){return e&&(r?bq:Tq).test.test(e)?e:r?t.options.trueStr:t.options.falseStr}var bq,Tq,ISe=y(()=>{Jn();bq={identify:r=>r===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Pe(!0),stringify:ASe},Tq={identify:r=>r===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Pe(!1),stringify:ASe}});var NSe,RSe,OSe,LSe=y(()=>{Jn();$b();NSe={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:r=>r.slice(-3).toLowerCase()==="nan"?NaN:r[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:da},RSe={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:r=>parseFloat(r.replace(/_/g,"")),stringify(r){let e=Number(r.value);return isFinite(e)?e.toExponential():da(r)}},OSe={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(r){let e=new Pe(parseFloat(r.replace(/_/g,""))),t=r.indexOf(".");if(t!==-1){let n=r.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:da}});function ON(r,e,t,{intAsBigInt:n}){let i=r[0];if((i==="-"||i==="+")&&(e+=1),r=r.substring(e).replace(/_/g,""),n){switch(t){case 2:r=`0b${r}`;break;case 8:r=`0o${r}`;break;case 16:r=`0x${r}`;break}let s=BigInt(r);return i==="-"?BigInt(-1)*s:s}let a=parseInt(r,t);return i==="-"?-1*a:a}function kq(r,e,t){let{value:n}=r;if(fC(n)){let i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return da(r)}var fC,FSe,$Se,zSe,jSe,BSe=y(()=>{$b();fC=r=>typeof r=="bigint"||Number.isInteger(r);FSe={identify:fC,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(r,e,t)=>ON(r,2,2,t),stringify:r=>kq(r,2,"0b")},$Se={identify:fC,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(r,e,t)=>ON(r,1,8,t),stringify:r=>kq(r,8,"0")},zSe={identify:fC,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(r,e,t)=>ON(r,0,10,t),stringify:da},jSe={identify:fC,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(r,e,t)=>ON(r,2,16,t),stringify:r=>kq(r,16,"0x")}});var jb,hC,wq=y(()=>{tr();um();mm();jb=class r extends An{constructor(e){super(e),this.tag=r.tag}add(e){let t;It(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new Tn(e.key,null):t=new Tn(e,null),pm(this.items,t.key)||this.items.push(t)}get(e,t){let n=pm(this.items,e);return!t&&It(n)?pt(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=pm(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Tn(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){let{replacer:i}=n,a=new this(e);if(t&&Symbol.iterator in Object(t))for(let s of t)typeof i=="function"&&(s=i.call(t,s,s)),a.items.push(Ob(s,null,n));return a}};jb.tag="tag:yaml.org,2002:set";hC={collection:"map",identify:r=>r instanceof Set,nodeClass:jb,default:!1,tag:"tag:yaml.org,2002:set",createNode:(r,e,t)=>jb.from(r,e,t),resolve(r,e){if($o(r)){if(r.hasAllNullValues(!0))return Object.assign(new jb,r);e("Set items must all have null values")}else e("Expected a mapping for this tag");return r}}});function Sq(r,e){let t=r[0],n=t==="-"||t==="+"?r.substring(1):r,i=s=>e?BigInt(s):Number(s),a=n.replace(/_/g,"").split(":").reduce((s,o)=>s*i(60)+i(o),i(0));return t==="-"?i(-1)*a:a}function USe(r){let{value:e}=r,t=s=>s;if(typeof e=="bigint")t=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return da(r);let n="";e<0&&(n="-",e*=t(-1));let i=t(60),a=[e%i];return e<60?a.unshift(0):(e=(e-a[0])/i,a.unshift(e%i),e>=60&&(e=(e-a[0])/i,a.unshift(e))),n+a.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var LN,FN,Bb,Eq=y(()=>{$b();LN={identify:r=>typeof r=="bigint"||Number.isInteger(r),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(r,e,{intAsBigInt:t})=>Sq(r,t),stringify:USe},FN={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:r=>Sq(r,!1),stringify:USe},Bb={identify:r=>r instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(r){let e=r.match(Bb.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,i,a,s,o]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,n-1,i,a||0,s||0,o||0,l),d=e[8];if(d&&d!=="Z"){let u=Sq(d,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:r})=>{var e;return(e=r==null?void 0:r.toISOString().replace(/(T00:00:00)?\.000Z$/,""))!=null?e:""}}});var xq,HSe=y(()=>{Lb();xN();Fb();cC();hq();ISe();LSe();BSe();TN();vq();RN();wq();Eq();xq=[Ll,Fl,hm,qh,bq,Tq,FSe,$Se,zSe,jSe,NSe,RSe,OSe,uC,Ol,mC,pC,hC,LN,FN,Bb]});function $N(r,e,t){let n=VSe.get(e);if(n&&!r)return t&&!n.includes(Ol)?n.concat(Ol):n.slice();let i=n;if(!i)if(Array.isArray(r))i=[];else{let a=Array.from(VSe.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(r))for(let a of r)i=i.concat(a);else typeof r=="function"&&(i=r(i.slice()));return t&&(i=i.concat(Ol)),i.reduce((a,s)=>{let o=typeof s=="string"?qSe[s]:s;if(!o){let l=JSON.stringify(s),c=Object.keys(qSe).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return a.includes(o)||a.push(o),a},[])}var VSe,qSe,WSe,YSe=y(()=>{Lb();xN();Fb();cC();uq();pq();fq();DSe();_Se();hq();TN();vq();RN();HSe();wq();Eq();VSe=new Map([["core",CSe],["failsafe",[Ll,Fl,hm]],["json",MSe],["yaml11",xq],["yaml-1.1",xq]]),qSe={binary:uC,bool:dC,float:PN,floatExp:DN,floatNaN:CN,floatTime:FN,int:AN,intHex:IN,intOct:_N,intTime:LN,map:Ll,merge:Ol,null:qh,omap:mC,pairs:pC,seq:Fl,set:hC,timestamp:Bb},WSe={"tag:yaml.org,2002:binary":uC,"tag:yaml.org,2002:merge":Ol,"tag:yaml.org,2002:omap":mC,"tag:yaml.org,2002:pairs":pC,"tag:yaml.org,2002:set":hC,"tag:yaml.org,2002:timestamp":Bb}});var bit,Ub,Cq=y(()=>{tr();Lb();Fb();cC();YSe();bit=(r,e)=>r.keye.key?1:0,Ub=class r{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:a,sortMapEntries:s,toStringDefaults:o}){this.compat=Array.isArray(e)?$N(e,"compat"):e?$N(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=i?WSe:{},this.tags=$N(t,this.name,n),this.toStringOptions=o!=null?o:null,Object.defineProperty(this,Nl,{value:Ll}),Object.defineProperty(this,Xs,{value:hm}),Object.defineProperty(this,Du,{value:Fl}),this.sortMapEntries=typeof s=="function"?s:s===!0?bit:null}clone(){let e=Object.create(r.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}});function GSe(r,e){var l;let t=[],n=e.directives===!0;if(e.directives!==!1&&r.directives){let c=r.directives.toString(r);c?(t.push(c),n=!0):r.directives.docStart&&(n=!0)}n&&t.push("---");let i=yN(r,e),{commentString:a}=i.options;if(r.commentBefore){t.length!==1&&t.unshift("");let c=a(r.commentBefore);t.unshift(jo(c,""))}let s=!1,o=null;if(r.contents){if(Ut(r.contents)){if(r.contents.spaceBefore&&n&&t.push(""),r.contents.commentBefore){let u=a(r.contents.commentBefore);t.push(jo(u,""))}i.forceBlockIndent=!!r.comment,o=r.contents.comment}let c=o?void 0:()=>s=!0,d=_u(r.contents,i,()=>o=null,c);o&&(d+=Uc(d,"",a(o))),(d[0]==="|"||d[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${d}`:t.push(d)}else t.push(_u(r.contents,i));if((l=r.directives)!=null&&l.docEnd)if(r.comment){let c=a(r.comment);c.includes(` +`)?(t.push("..."),t.push(jo(c,""))):t.push(`... ${c}`)}else t.push("...");else{let c=r.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||o)&&t[t.length-1]!==""&&t.push(""),t.push(jo(a(c),"")))}return t.join(` +`)+` +`}var KSe=y(()=>{tr();lC();nC()});function Hb(r){if(ur(r))return!0;throw new Error("Expected a YAML collection as document contents")}var Hc,gC=y(()=>{eC();pN();tr();um();cm();Cq();KSe();lN();rq();tC();XV();Hc=class r{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Fa,{value:aN});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=a;let{version:s}=a;n!=null&&n._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new jc({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(r.prototype,{[Fa]:{value:aN}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Ut(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Hb(this.contents)&&this.contents.add(e)}addIn(e,t){Hb(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=eq(this);e.anchor=!t||n.has(t)?tq(t||"a",n):t}return new Bc(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){let g=k=>typeof k=="number"||k instanceof String||k instanceof Number,v=t.filter(g).map(String);v.length>0&&(t=t.concat(v)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:a,anchorPrefix:s,flow:o,keepUndefined:l,onTagObj:c,tag:d}=n!=null?n:{},{onAnchor:u,setAnchors:p,sourceObjects:m}=ySe(this,s||"a"),f={aliasDuplicateObjects:a!=null?a:!0,keepUndefined:l!=null?l:!1,onAnchor:u,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:m},h=Pu(e,d,f);return o&&ur(h)&&(h.flow=!0),p(),h}createPair(e,t,n={}){let i=this.createNode(e,null,n),a=this.createNode(t,null,n);return new Tn(i,a)}delete(e){return Hb(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Nb(e)?this.contents==null?!1:(this.contents=null,!0):Hb(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return ur(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Nb(e)?!t&&pt(this.contents)?this.contents.value:this.contents:ur(this.contents)?this.contents.getIn(e,t):void 0}has(e){return ur(this.contents)?this.contents.has(e):!1}hasIn(e){return Nb(e)?this.contents!==void 0:ur(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=rC(this.schema,[e],t):Hb(this.contents)&&this.contents.set(e,t)}setIn(e,t){Nb(e)?this.contents=t:this.contents==null?this.contents=rC(this.schema,Array.from(e),t):Hb(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new jc({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new jc({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Ub(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:a,reviver:s}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=ui(this.contents,t!=null?t:"",o);if(typeof a=="function")for(let{count:c,res:d}of o.anchors.values())a(d,c);return typeof s=="function"?lm(s,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return GSe(this,e)}}});var Vb,eo,qb,yC,vC=y(()=>{Vb=class extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}},eo=class extends Vb{constructor(e,t,n){super("YAMLParseError",e,t,n)}},qb=class extends Vb{constructor(e,t,n){super("YAMLWarning",e,t,n)}},yC=(r,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(o=>e.linePos(o));let{line:n,col:i}=t.linePos[0];t.message+=` at line ${n}, column ${i}`;let a=i-1,s=r.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(a>=60&&s.length>80){let o=Math.min(a-39,s.length-79);s="\u2026"+s.substring(o),a-=o-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,a))){let o=r.substring(e.lineStarts[n-2],e.lineStarts[n-1]);o.length>80&&(o=o.substring(0,79)+`\u2026 +`),s=o+s}if(/[^ ]/.test(s)){let o=1,l=t.linePos[1];(l==null?void 0:l.line)===n&&l.col>i&&(o=Math.max(1,Math.min(l.col-i,80-a)));let c=" ".repeat(a)+"^".repeat(o);t.message+=`: + +${s} +${c} +`}}});function Vc(r,{flow:e,indicator:t,next:n,offset:i,onError:a,parentIndent:s,startOnNewline:o}){let l=!1,c=o,d=o,u="",p="",m=!1,f=!1,h=null,g=null,v=null,k=null,b=null,w=null,S=null;for(let D of r)switch(f&&(D.type!=="space"&&D.type!=="newline"&&D.type!=="comma"&&a(D.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),f=!1),h&&(c&&D.type!=="comment"&&D.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),D.type){case"space":!e&&(t!=="doc-start"||(n==null?void 0:n.type)!=="flow-collection")&&D.source.includes(" ")&&(h=D),d=!0;break;case"comment":{d||a(D,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let _=D.source.substring(1)||" ";u?u+=p+_:u=_,p="",c=!1;break}case"newline":c?u?u+=D.source:(!w||t!=="seq-item-ind")&&(l=!0):p+=D.source,c=!0,m=!0,(g||v)&&(k=D),d=!0;break;case"anchor":g&&a(D,"MULTIPLE_ANCHORS","A node can have at most one anchor"),D.source.endsWith(":")&&a(D.offset+D.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=D,S!=null||(S=D.offset),c=!1,d=!1,f=!0;break;case"tag":{v&&a(D,"MULTIPLE_TAGS","A node can have at most one tag"),v=D,S!=null||(S=D.offset),c=!1,d=!1,f=!0;break}case t:(g||v)&&a(D,"BAD_PROP_ORDER",`Anchors and tags must be after the ${D.source} indicator`),w&&a(D,"UNEXPECTED_TOKEN",`Unexpected ${D.source} in ${e!=null?e:"collection"}`),w=D,c=t==="seq-item-ind"||t==="explicit-key-ind",d=!1;break;case"comma":if(e){b&&a(D,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=D,c=!1,d=!1;break}default:a(D,"UNEXPECTED_TOKEN",`Unexpected ${D.type} token`),c=!1,d=!1}let x=r[r.length-1],C=x?x.offset+x.source.length:i;return f&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&a(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(c&&h.indent<=s||(n==null?void 0:n.type)==="block-map"||(n==null?void 0:n.type)==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:w,spaceBefore:l,comment:u,hasNewline:m,anchor:g,tag:v,newlineAfterProp:k,end:C,start:S!=null?S:C}}var bC=y(()=>{});function gm(r){if(!r)return null;switch(r.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(r.source.includes(` +`))return!0;if(r.end){for(let e of r.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of r.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(gm(e.key)||gm(e.value))return!0}return!1;default:return!0}}var zN=y(()=>{});function TC(r,e,t){if((e==null?void 0:e.type)==="flow-collection"){let n=e.end[0];n.indent===r&&(n.source==="]"||n.source==="}")&&gm(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}var Dq=y(()=>{zN()});function jN(r,e,t){let{uniqueKeys:n}=r.options;if(n===!1)return!1;let i=typeof n=="function"?n:(a,s)=>a===s||pt(a)&&pt(s)&&a.value===s.value;return e.some(a=>i(a.key,t))}var Pq=y(()=>{tr()});function QSe({composeNode:r,composeEmptyNode:e},t,n,i,a){var d,u;let s=(d=a==null?void 0:a.nodeClass)!=null?d:An,o=new s(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,c=null;for(let p of n.items){let{start:m,key:f,sep:h,value:g}=p,v=Vc(m,{indicator:"explicit-key-ind",next:f!=null?f:h==null?void 0:h[0],offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0}),k=!v.found;if(k){if(f&&(f.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(l,"BAD_INDENT",ZSe)),!v.anchor&&!v.tag&&!h){c=v.end,v.comment&&(o.comment?o.comment+=` +`+v.comment:o.comment=v.comment);continue}(v.newlineAfterProp||gm(f))&&i(f!=null?f:m[m.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((u=v.found)==null?void 0:u.indent)!==n.indent&&i(l,"BAD_INDENT",ZSe);t.atKey=!0;let b=v.end,w=f?r(t,f,v,i):e(t,b,m,null,v,i);t.schema.compat&&TC(n.indent,f,i),t.atKey=!1,jN(t,o.items,w)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=Vc(h!=null?h:[],{indicator:"map-value-ind",next:g,offset:w.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(l=S.end,S.found){k&&((g==null?void 0:g.type)==="block-map"&&!S.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&v.start{um();mm();bC();zN();Dq();Pq();ZSe="All mapping items must start at the same column"});function XSe({composeNode:r,composeEmptyNode:e},t,n,i,a){var d;let s=(d=a==null?void 0:a.nodeClass)!=null?d:$i,o=new s(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=n.offset,c=null;for(let{start:u,value:p}of n.items){let m=Vc(u,{indicator:"seq-item-ind",next:p,offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!m.found)if(m.anchor||m.tag||p)(p==null?void 0:p.type)==="block-seq"?i(m.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=m.end,m.comment&&(o.comment=m.comment);continue}let f=p?r(t,p,m,i):e(t,m.end,u,null,m,i);t.schema.compat&&TC(n.indent,p,i),l=f.range[2],o.items.push(f)}return o.range=[n.offset,l,c!=null?c:l],o}var eEe=y(()=>{fm();bC();Dq()});function qc(r,e,t,n){let i="";if(r){let a=!1,s="";for(let o of r){let{source:l,type:c}=o;switch(c){case"space":a=!0;break;case"comment":{t&&!a&&n(o,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=l.substring(1)||" ";i?i+=s+d:i=d,s="";break}case"newline":i&&(s+=l),a=!0;break;default:n(o,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}var Wb=y(()=>{});function tEe({composeNode:r,composeEmptyNode:e},t,n,i,a){var g,v,k;let s=n.start.source==="{",o=s?"flow map":"flow sequence",l=(g=a==null?void 0:a.nodeClass)!=null?g:s?An:$i,c=new l(t.schema);c.flow=!0;let d=t.atRoot;d&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let u=n.offset+n.start.source.length;for(let b=0;b0){let b=qc(f,h,t.options.strict,i);b.comment&&(c.comment?c.comment+=` +`+b.comment:c.comment=b.comment),c.range=[n.offset,h,b.offset]}else c.range=[n.offset,h,h];return c}var Mq,_q,rEe=y(()=>{tr();um();mm();fm();Wb();bC();zN();Pq();Mq="Block collections are not allowed within flow collections",_q=r=>r&&(r.type==="block-map"||r.type==="block-seq")});function Aq(r,e,t,n,i,a){let s=t.type==="block-map"?QSe(r,e,t,n,a):t.type==="block-seq"?XSe(r,e,t,n,a):tEe(r,e,t,n,a),o=s.constructor;return i==="!"||i===o.tagName?(s.tag=o.tagName,s):(i&&(s.tag=i),s)}function nEe(r,e,t,n,i){var p,m,f;let a=n.tag,s=a?e.directives.tagName(a.source,h=>i(a,"TAG_RESOLVE_FAILED",h)):null;if(t.type==="block-seq"){let{anchor:h,newlineAfterProp:g}=n,v=h&&a?h.offset>a.offset?h:a:h!=null?h:a;v&&(!g||g.offseth.tag===s&&h.collection===o);if(!l){let h=e.schema.knownTags[s];if((h==null?void 0:h.collection)===o)e.schema.tags.push(Object.assign({},h,{default:!1})),l=h;else return h?i(a,"BAD_COLLECTION_TYPE",`${h.tag} used for ${o} collection, but expects ${(p=h.collection)!=null?p:"scalar"}`,!0):i(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),Aq(r,e,t,i,s)}let c=Aq(r,e,t,i,s,l),d=(f=(m=l.resolve)==null?void 0:m.call(l,c,h=>i(a,"TAG_RESOLVE_FAILED",h),e.options))!=null?f:c,u=Ut(d)?d:new Pe(d);return u.range=c.range,u.tag=s,l!=null&&l.format&&(u.format=l.format),u}var iEe=y(()=>{tr();Jn();mm();fm();JSe();eEe();rEe()});function BN(r,e,t){let n=e.offset,i=Tit(e,r.options.strict,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let a=i.mode===">"?Pe.BLOCK_FOLDED:Pe.BLOCK_LITERAL,s=e.source?kit(e.source):[],o=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")o=h;else break}if(o===0){let h=i.chomp==="+"&&s.length>0?` +`.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:a,comment:i.comment,range:[n,g,g]}}let l=e.indent+i.indent,c=e.offset+i.length,d=0;for(let h=0;hl&&(l=g.length);else{g.length=o;--h)s[h][0].length>l&&(o=h+1);let u="",p="",m=!1;for(let h=0;hl||v[0]===" "?(p===" "?p=` +`:!m&&p===` +`&&(p=` + +`),u+=p+g.slice(l)+v,p=` +`,m=!0):v===""?p===` +`?u+=` +`:p=` +`:(u+=p+v,p=" ",m=!1)}switch(i.chomp){case"-":break;case"+":for(let h=o;h{Jn()});function UN(r,e,t){let{offset:n,type:i,source:a,end:s}=r,o,l,c=(p,m,f)=>t(n+p,m,f);switch(i){case"scalar":o=Pe.PLAIN,l=wit(a,c);break;case"single-quoted-scalar":o=Pe.QUOTE_SINGLE,l=Sit(a,c);break;case"double-quoted-scalar":o=Pe.QUOTE_DOUBLE,l=Eit(a,c);break;default:return t(r,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+a.length,n+a.length]}}let d=n+a.length,u=qc(s,d,e,t);return{value:l,type:o,comment:u.comment,range:[n,d,u.offset]}}function wit(r,e){let t="";switch(r[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${r[0]}`;break}case"@":case"`":{t=`reserved character ${r[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),aEe(r)}function Sit(r,e){return(r[r.length-1]!=="'"||r.length===1)&&e(r.length,"MISSING_CHAR","Missing closing 'quote"),aEe(r.slice(1,-1)).replace(/''/g,"'")}function aEe(r){var l;let e,t;try{e=new RegExp(`(.*?)(?a?r.slice(a,n+1):i)}else t+=i}return(r[r.length-1]!=='"'||r.length===1)&&e(r.length,"MISSING_CHAR",'Missing closing "quote'),t}function xit(r,e){let t="",n=r[e+1];for(;(n===" "||n===" "||n===` +`||n==="\r")&&!(n==="\r"&&r[e+2]!==` +`);)n===` +`&&(t+=` +`),e+=1,n=r[e+1];return t||(t=" "),{fold:t,offset:e}}function Dit(r,e,t,n){let i=r.substr(e,t),s=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch(o){let l=r.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}}var Cit,Nq=y(()=>{Jn();Wb();Cit={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` +`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "}});function Rq(r,e,t,n){let{value:i,type:a,comment:s,range:o}=e.type==="block-scalar"?BN(r,e,n):UN(e,r.options.strict,n),l=t?r.directives.tagName(t.source,u=>n(t,"TAG_RESOLVE_FAILED",u)):null,c;r.options.stringKeys&&r.atKey?c=r.schema[Xs]:l?c=Pit(r.schema,i,l,t,n):e.type==="scalar"?c=Mit(r,i,e,n):c=r.schema[Xs];let d;try{let u=c.resolve(i,p=>n(t!=null?t:e,"TAG_RESOLVE_FAILED",p),r.options);d=pt(u)?u:new Pe(u)}catch(u){let p=u instanceof Error?u.message:String(u);n(t!=null?t:e,"TAG_RESOLVE_FAILED",p),d=new Pe(i)}return d.range=o,d.source=i,a&&(d.type=a),l&&(d.tag=l),c.format&&(d.format=c.format),s&&(d.comment=s),d}function Pit(r,e,t,n,i){var o;if(t==="!")return r[Xs];let a=[];for(let l of r.tags)if(!l.collection&&l.tag===t)if(l.default&&l.test)a.push(l);else return l;for(let l of a)if((o=l.test)!=null&&o.test(e))return l;let s=r.knownTags[t];return s&&!s.collection?(r.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),r[Xs])}function Mit({atKey:r,directives:e,schema:t},n,i,a){var o;let s=t.tags.find(l=>{var c;return(l.default===!0||r&&l.default==="key")&&((c=l.test)==null?void 0:c.test(n))})||t[Xs];if(t.compat){let l=(o=t.compat.find(c=>{var d;return c.default&&((d=c.test)==null?void 0:d.test(n))}))!=null?o:t[Xs];if(s.tag!==l.tag){let c=e.tagString(s.tag),d=e.tagString(l.tag),u=`Value may be parsed as either ${c} or ${d}`;a(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}var sEe=y(()=>{tr();Jn();Iq();Nq()});function oEe(r,e,t){if(e){t!=null||(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":r-=i.source.length;continue}for(i=e[++n];(i==null?void 0:i.type)==="space";)r+=i.source.length,i=e[++n];break}}return r}var lEe=y(()=>{});function Oq(r,e,t,n){let i=r.atKey,{spaceBefore:a,comment:s,anchor:o,tag:l}=t,c,d=!0;switch(e.type){case"alias":c=Ait(r,e,n),(o||l)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=Rq(r,e,l,n),o&&(c.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=nEe(_it,r,e,t,n),o&&(c.anchor=o.source.substring(1))}catch(u){let p=u instanceof Error?u.message:String(u);n(e,"RESOURCE_EXHAUSTION",p)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",u),d=!1}}return c!=null||(c=HN(r,e.offset,void 0,null,t,n)),o&&c.anchor===""&&n(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&r.options.stringKeys&&(!pt(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&n(l!=null?l:e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(c.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?c.comment=s:c.commentBefore=s),r.options.keepSourceTokens&&d&&(c.srcToken=e),c}function HN(r,e,t,n,{spaceBefore:i,comment:a,anchor:s,tag:o,end:l},c){let d={type:"scalar",offset:oEe(e,t,n),indent:-1,source:""},u=Rq(r,d,o,c);return s&&(u.anchor=s.source.substring(1),u.anchor===""&&c(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=l),u}function Ait({options:r},{offset:e,source:t,end:n},i){let a=new Bc(t.substring(1));a.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+t.length,o=qc(n,s,r.strict,i);return a.range=[e,s,o.offset],o.comment&&(a.comment=o.comment),a}var _it,cEe=y(()=>{eC();tr();iEe();sEe();Wb();lEe();_it={composeNode:Oq,composeEmptyNode:HN}});function dEe(r,e,{offset:t,start:n,value:i,end:a},s){let o=Object.assign({_directives:e},r),l=new Hc(void 0,o),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=Vc(n,{indicator:"doc-start",next:i!=null?i:a==null?void 0:a[0],offset:t,onError:s,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!d.hasNewline&&s(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?Oq(c,i,d,s):HN(c,d.end,n,null,d,s);let u=l.contents.range[2],p=qc(a,u,!1,s);return p.comment&&(l.comment=p.comment),l.range=[t,u,p.offset],l}var uEe=y(()=>{gC();cEe();Wb();bC()});function kC(r){if(typeof r=="number")return[r,r+1];if(Array.isArray(r))return r.length===2?r:[r[0],r[1]];let{offset:e,source:t}=r;return[e,e+(typeof t=="string"?t.length:1)]}function pEe(r){var i;let e="",t=!1,n=!1;for(let a=0;a{XV();gC();vC();tr();uEe();Wb();Wh=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,i,a)=>{let s=kC(t);a?this.warnings.push(new qb(s,n,i)):this.errors.push(new eo(s,n,i))},this.directives=new jc({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:i}=pEe(this.prelude);if(n){let a=e.contents;if(t)e.comment=e.comment?`${e.comment} +${n}`:n;else if(i||e.directives.docStart||!a)e.commentBefore=n;else if(ur(a)&&!a.flow&&a.items.length>0){let s=a.items[0];It(s)&&(s=s.key);let o=s.commentBefore;s.commentBefore=o?`${n} +${o}`:n}else{let s=a.commentBefore;a.commentBefore=s?`${n} +${s}`:n}}if(t){for(let a=0;a{let a=kC(e);a[0]+=t,this.onError(a,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=dEe(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new eo(kC(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new eo(kC(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let t=qc(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n} +${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new eo(kC(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new Hc(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}}});function mEe(r,e=!0,t){if(r){let n=(i,a,s)=>{let o=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(o,a,s);else throw new eo([o,o+1],a,s)};switch(r.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return UN(r,e,n);case"block-scalar":return BN({options:{strict:e}},r,n)}}return null}function fEe(r,e){var c;let{implicitKey:t=!1,indent:n,inFlow:i=!1,offset:a=-1,type:s="PLAIN"}=e,o=Mu({type:s,value:r},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=(c=e.end)!=null?c:[{type:"newline",offset:-1,indent:n,source:` +`}];switch(o[0]){case"|":case">":{let d=o.indexOf(` +`),u=o.substring(0,d),p=o.substring(d+1)+` +`,m=[{type:"block-scalar-header",offset:a,indent:n,source:u}];return gEe(m,l)||m.push({type:"newline",offset:-1,indent:n,source:` +`}),{type:"block-scalar",offset:a,indent:n,props:m,source:p}}case'"':return{type:"double-quoted-scalar",offset:a,indent:n,source:o,end:l};case"'":return{type:"single-quoted-scalar",offset:a,indent:n,source:o,end:l};default:return{type:"scalar",offset:a,indent:n,source:o,end:l}}}function hEe(r,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:a=!1,type:s}=t,o="indent"in r?r.indent:null;if(n&&typeof o=="number"&&(o+=2),!s)switch(r.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let c=r.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let l=Mu({type:s,value:e},{implicitKey:i||o===null,indent:o!==null&&o>0?" ".repeat(o):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":Iit(r,l);break;case'"':Fq(r,l,"double-quoted-scalar");break;case"'":Fq(r,l,"single-quoted-scalar");break;default:Fq(r,l,"scalar")}}function Iit(r,e){let t=e.indexOf(` +`),n=e.substring(0,t),i=e.substring(t+1)+` +`;if(r.type==="block-scalar"){let a=r.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=n,r.source=i}else{let{offset:a}=r,s="indent"in r?r.indent:-1,o=[{type:"block-scalar-header",offset:a,indent:s,source:n}];gEe(o,"end"in r?r.end:void 0)||o.push({type:"newline",offset:-1,indent:s,source:` +`});for(let l of Object.keys(r))l!=="type"&&l!=="offset"&&delete r[l];Object.assign(r,{type:"block-scalar",indent:s,props:o,source:i})}}function gEe(r,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":r.push(t);break;case"newline":return r.push(t),!0}return!1}function Fq(r,e,t){switch(r.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":r.type=t,r.source=e;break;case"block-scalar":{let n=r.props.slice(1),i=e.length;r.props[0].type==="block-scalar-header"&&(i-=r.props[0].source.length);for(let a of n)a.offset+=i;delete r.props,Object.assign(r,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:r.offset+e.length,indent:r.indent,source:` +`};delete r.items,Object.assign(r,{type:t,source:e,end:[i]});break}default:{let n="indent"in r?r.indent:-1,i="end"in r&&Array.isArray(r.end)?r.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(r))a!=="type"&&a!=="offset"&&delete r[a];Object.assign(r,{type:t,indent:n,source:e,end:i})}}}var yEe=y(()=>{Iq();Nq();vC();oC()});function qN(r){switch(r.type){case"block-scalar":{let e="";for(let t of r.props)e+=qN(t);return e+r.source}case"block-map":case"block-seq":{let e="";for(let t of r.items)e+=VN(t);return e}case"flow-collection":{let e=r.start.source;for(let t of r.items)e+=VN(t);for(let t of r.end)e+=t.source;return e}case"document":{let e=VN(r);if(r.end)for(let t of r.end)e+=t.source;return e}default:{let e=r.source;if("end"in r&&r.end)for(let t of r.end)e+=t.source;return e}}}function VN({start:r,key:e,sep:t,value:n}){let i="";for(let a of r)i+=a.source;if(e&&(i+=qN(e)),t)for(let a of t)i+=a.source;return n&&(i+=qN(n)),i}var vEe,bEe=y(()=>{vEe=r=>"type"in r?qN(r):VN(r)});function ym(r,e){"type"in r&&r.type==="document"&&(r={start:r.start,value:r.value}),kEe(Object.freeze([]),r,e)}function kEe(r,e,t){let n=t(e,r);if(typeof n=="symbol")return n;for(let i of["key","value"]){let a=e[i];if(a&&"items"in a){for(let s=0;s{$q=Symbol("break visit"),Nit=Symbol("skip children"),TEe=Symbol("remove item");ym.BREAK=$q;ym.SKIP=Nit;ym.REMOVE=TEe;ym.itemAtPath=(r,e)=>{let t=r;for(let[n,i]of e){let a=t==null?void 0:t[n];if(a&&"items"in a)t=a.items[i];else return}return t};ym.parentCollection=(r,e)=>{let t=ym.itemAtPath(r,e.slice(0,-1)),n=e[e.length-1][0],i=t==null?void 0:t[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")}});var jq={};et(jq,{BOM:()=>wC,DOCUMENT:()=>SC,FLOW_END:()=>EC,SCALAR:()=>Yb,createScalarToken:()=>fEe,isCollection:()=>Rit,isScalar:()=>Oit,prettyToken:()=>Lit,resolveAsScalar:()=>mEe,setScalarValue:()=>hEe,stringify:()=>vEe,tokenType:()=>zq,visit:()=>ym});function Lit(r){switch(r){case wC:return"";case SC:return"";case EC:return"";case Yb:return"";default:return JSON.stringify(r)}}function zq(r){switch(r){case wC:return"byte-order-mark";case SC:return"doc-mode";case EC:return"flow-error-end";case Yb:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`:case`\r +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(r[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}var wC,SC,EC,Yb,Rit,Oit,WN=y(()=>{yEe();bEe();wEe();wC="\uFEFF",SC="",EC="",Yb="",Rit=r=>!!r&&"items"in r,Oit=r=>!!r&&(r.type==="scalar"||r.type==="single-quoted-scalar"||r.type==="double-quoted-scalar"||r.type==="block-scalar")});function $l(r){switch(r){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var SEe,Fit,YN,$it,Bq,Gb,Uq=y(()=>{WN();SEe=new Set("0123456789ABCDEFabcdef"),Fit=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),YN=new Set(",[]{}"),$it=new Set(` ,[]{} +\r `),Bq=r=>!r||$it.has(r),Gb=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){var i;if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=(i=this.next)!=null?i:"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===` +`?!0:t==="\r"?this.buffer[e+1]===` +`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let i=this.buffer[n+e+1];if(i===` +`||!i&&!this.atEnd)return e+n+1}return t===` +`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&$l(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!$l(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&$l(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Bq),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>$l(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let a=this.pos;n=this.buffer[a];++a)switch(n){case" ":t+=1;break;case` +`:e=a,t=0;break;case"\r":{let s=this.buffer[a+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===` +`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(e+1);if(a===-1)break;e=this.buffer.indexOf(` +`,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===` +`;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let a=e-1,s=this.buffer[a];s==="\r"&&(s=this.buffer[--a]);let o=a;for(;s===" ";)s=this.buffer[--a];if(s===` +`&&a>=this.pos&&a+1+t>o)e=a;else break}while(!0);return yield Yb,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let a=this.buffer[n+1];if($l(a)||e&&YN.has(a))break;t=n}else if($l(i)){let a=this.buffer[n+1];if(i==="\r"&&(a===` +`?(n+=1,i=` +`,a=this.buffer[n+1]):t=n),a==="#"||e&&YN.has(a))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&YN.has(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Yb,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Bq),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,n=this.charAt(1);if($l(n)||t&&YN.has(n)){t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!$l(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Fit.has(t))t=this.buffer[++e];else if(t==="%"&&SEe.has(this.buffer[e+1])&&SEe.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` +`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}});var Kb,Hq=y(()=>{Kb=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t>1;this.lineStarts[a]=0;)switch(r[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((t=r[++e])==null?void 0:t.type)==="space";);return r.splice(e,r.length)}function KN(r,e){if(e.length<1e5)Array.prototype.push.apply(r,e);else for(let t=0;t{WN();Uq();Yh=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Gb,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=zq(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&(e==null?void 0:e.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e!=null?e:this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&xEe(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&EEe(i.start)===-1&&(t.indent===0||i.start.every(a=>a.type!=="comment"||a.indent=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,a=i&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",s=[];if(a&&t.sep&&!t.value){let o=[];for(let l=0;le.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":a||t.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):a||t.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(vm(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(CEe(t.key)&&!vm(t.sep,"newline")){let o=Zb(t.start),l=t.key,c=t.sep;c.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:l,sep:c}]})}else s.length>0?t.sep=t.sep.concat(s,this.sourceToken):t.sep.push(this.sourceToken);else if(vm(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Zb(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||a?e.items.push({start:s,key:null,sep:[this.sourceToken]}):vm(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);a||t.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!vm(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var n;let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let i="end"in t.value?t.value.end:void 0,a=Array.isArray(i)?i[i.length-1]:void 0;(a==null?void 0:a.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2],a=(n=i==null?void 0:i.value)==null?void 0:n.end;if(Array.isArray(a)){KN(a,t.start),a.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||vm(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while((n==null?void 0:n.type)==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=GN(n),a=Zb(i);xEe(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(` +`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(` +`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=GN(e),n=Zb(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=GN(e),n=Zb(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}});function DEe(r){let e=r.prettyErrors!==!1;return{lineCounter:r.lineCounter||e&&new Kb||null,prettyErrors:e}}function PEe(r,e={}){let{lineCounter:t,prettyErrors:n}=DEe(e),i=new Yh(t==null?void 0:t.addNewLine),a=new Wh(e),s=Array.from(a.compose(i.parse(r)));if(n&&t)for(let o of s)o.errors.forEach(yC(r,t)),o.warnings.forEach(yC(r,t));return s.length>0?s:Object.assign([],{empty:!0},a.streamInfo())}function qq(r,e={}){let{lineCounter:t,prettyErrors:n}=DEe(e),i=new Yh(t==null?void 0:t.addNewLine),a=new Wh(e),s=null;for(let o of a.compose(i.parse(r),!0,r.length))if(!s)s=o;else if(s.options.logLevel!=="silent"){s.errors.push(new eo(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(s.errors.forEach(yC(r,t)),s.warnings.forEach(yC(r,t))),s}function MEe(r,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let i=qq(r,t);if(!i)return null;if(i.warnings.forEach(a=>vN(i.options.logLevel,a)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function _Ee(r,e,t){var i;let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let a=Math.round(t);t=a<1?void 0:a>8?{indent:8}:{indent:a}}if(r===void 0){let{keepUndefined:a}=(i=t!=null?t:e)!=null?i:{};if(!a)return}return Fo(r)&&!n?r.toString(t):new Hc(r,n,t).toString(t)}var AEe=y(()=>{Lq();gC();vC();sq();tr();Hq();Vq()});var Wq={};et(Wq,{Alias:()=>Bc,CST:()=>jq,Composer:()=>Wh,Document:()=>Hc,Lexer:()=>Gb,LineCounter:()=>Kb,Pair:()=>Tn,Parser:()=>Yh,Scalar:()=>Pe,Schema:()=>Ub,YAMLError:()=>Vb,YAMLMap:()=>An,YAMLParseError:()=>eo,YAMLSeq:()=>$i,YAMLWarning:()=>qb,isAlias:()=>Lo,isCollection:()=>ur,isDocument:()=>Fo,isMap:()=>$o,isNode:()=>Ut,isPair:()=>It,isScalar:()=>pt,isSeq:()=>zo,parse:()=>MEe,parseAllDocuments:()=>PEe,parseDocument:()=>qq,stringify:()=>_Ee,visit:()=>Rl,visitAsync:()=>Jx});var Yq=y(()=>{Lq();gC();Cq();vC();eC();tr();um();Jn();mm();fm();WN();Uq();Hq();Vq();AEe();Xx()});var xC,ZN=y(()=>{Yq();Yq();xC=Wq});function QN(r,e){let t=zit(r),n=t.frontmatter?jit(t.frontmatter,e):{},i=Bit(t.body,e);return{frontmatter:n,body:i}}function zit(r){var t,n;let e=r.split(` +`);if(((t=e[0])==null?void 0:t.trim())==="---"){let i=-1;for(let a=1;a0){let s=e.slice(1,i).join(` +`),l=e.slice(i+1).join(` +`);return{frontmatter:s.trim()||null,body:l}}}return{frontmatter:null,body:r}}function jit(r,e){try{let t=Hit(Uit(r,e)),n=xC.parse(t);return typeof n!="object"||n===null?(IEe.warn("Template frontmatter did not parse to a valid object",{category:"validation",operation:"template-frontmatter-did-not-parse-valid-object"}),{}):n}catch(t){return IEe.error("Error processing template frontmatter:",{category:"validation",operation:"processing-template-frontmatter",error:t}),{}}}function Bit(r,e){return qit(r,e)}function Uit(r,e){var g;let t=r,n=new Date,i=e.title||"";t=Gh(t,"title",i),t=t.replace(/\{\{priority\}\}/g,e.priority||""),t=t.replace(/\{\{status\}\}/g,e.status||"");let a=Array.isArray(e.contexts)?e.contexts.join(", "):"";t=t.replace(/\{\{contexts\}\}/g,a);let s=Array.isArray(e.tags)?e.tags.join(", "):"";t=t.replace(/\{\{tags\}\}/g,s);let o=Array.isArray(e.tags)?e.tags.map(v=>`#${v}`).join(" "):"";t=t.replace(/\{\{hashtags\}\}/g,o),t=t.replace(/\{\{timeEstimate\}\}/g,((g=e.timeEstimate)==null?void 0:g.toString())||""),t=t.replace(/\{\{dueDate\}\}/g,e.dueDate||""),t=t.replace(/\{\{scheduledDate\}\}/g,e.scheduledDate||""),t=t.replace(/\{\{details\}\}/g,e.details||"");let l=e.parentNote||"";t=Gh(t,"parentNote",l,{alwaysQuote:!0}),t=t.replace(/\{\{date\}\}/g,P(n,"yyyy-MM-dd")),t=t.replace(/\{\{time\}\}/g,P(n,"HH:mm")),t=t.replace(/\{\{year\}\}/g,P(n,"yyyy")),t=t.replace(/\{\{month\}\}/g,P(n,"MM")),t=t.replace(/\{\{day\}\}/g,P(n,"dd")),t=t.replace(/\{\{hour\}\}/g,P(n,"HH")),t=t.replace(/\{\{minute\}\}/g,P(n,"mm")),t=t.replace(/\{\{second\}\}/g,P(n,"ss")),t=t.replace(/\{\{timestamp\}\}/g,P(n,"yyyy-MM-dd-HHmmss")),t=t.replace(/\{\{dateTime\}\}/g,P(n,"yyyy-MM-dd-HHmm")),t=t.replace(/\{\{shortDate\}\}/g,P(n,"yyMMdd")),t=t.replace(/\{\{shortYear\}\}/g,P(n,"yy")),t=t.replace(/\{\{monthName\}\}/g,P(n,"MMMM")),t=t.replace(/\{\{monthNameShort\}\}/g,P(n,"MMM")),t=t.replace(/\{\{dayName\}\}/g,P(n,"EEEE")),t=t.replace(/\{\{dayNameShort\}\}/g,P(n,"EEE")),t=t.replace(/\{\{week\}\}/g,P(n,"ww")),t=t.replace(/\{\{quarter\}\}/g,P(n,"q")),t=t.replace(/\{\{time12\}\}/g,P(n,"hh:mm a")),t=t.replace(/\{\{time24\}\}/g,P(n,"HH:mm")),t=t.replace(/\{\{hourPadded\}\}/g,P(n,"HH")),t=t.replace(/\{\{hour12\}\}/g,P(n,"hh")),t=t.replace(/\{\{ampm\}\}/g,P(n,"a")),t=t.replace(/\{\{unix\}\}/g,Math.floor(n.getTime()/1e3).toString()),t=t.replace(/\{\{unixMs\}\}/g,n.getTime().toString()),t=t.replace(/\{\{milliseconds\}\}/g,P(n,"SSS")),t=t.replace(/\{\{ms\}\}/g,P(n,"SSS")),t=t.replace(/\{\{timezone\}\}/g,P(n,"xxx")),t=t.replace(/\{\{timezoneShort\}\}/g,P(n,"xx")),t=t.replace(/\{\{utcOffset\}\}/g,P(n,"xxx")),t=t.replace(/\{\{utcOffsetShort\}\}/g,P(n,"xx")),t=t.replace(/\{\{utcZ\}\}/g,"Z");let c=P(n,"yyMMdd"),d=new Date(n);d.setHours(0,0,0,0);let u=Math.floor((n.getTime()-d.getTime())/1e3),p=`${c}${u.toString(36)}`;t=t.replace(/\{\{zettel\}\}/g,p),t=t.replace(/\{\{nano\}\}/g,Date.now().toString()+Math.random().toString(36).substring(2,7));let m=e.priority||"",f=e.status||"";t=t.replace(/\{\{priorityShort\}\}/g,m.substring(0,1).toUpperCase()),t=t.replace(/\{\{statusShort\}\}/g,f.substring(0,1).toUpperCase());let h=e.title||"";if(t=t.replace(/\{\{titleLower\}\}/g,h.toLowerCase()),t=t.replace(/\{\{titleUpper\}\}/g,h.toUpperCase()),t=t.replace(/\{\{titleSnake\}\}/g,h.toLowerCase().replace(/\s+/g,"_")),t=t.replace(/\{\{titleKebab\}\}/g,h.toLowerCase().replace(/\s+/g,"-")),t=t.replace(/\{\{titleCamel\}\}/g,h.replace(/(?:^\w|[A-Z]|\b\w)/g,(v,k)=>k===0?v.toLowerCase():v.toUpperCase()).replace(/\s+/g,"")),t=t.replace(/\{\{titlePascal\}\}/g,h.replace(/(?:^\w|[A-Z]|\b\w)/g,v=>v.toUpperCase()).replace(/\s+/g,"")),"icsEventTitle"in e){let v=e,k=v.icsEventTitle||"";t=Gh(t,"icsEventTitle",k),t=t.replace(/\{\{icsEventStart\}\}/g,v.icsEventStart||""),t=t.replace(/\{\{icsEventEnd\}\}/g,v.icsEventEnd||"");let b=v.icsEventLocation||"";t=Gh(t,"icsEventLocation",b);let w=v.icsEventDescription||"";t=Gh(t,"icsEventDescription",w),t=t.replace(/\{\{icsEventUrl\}\}/g,v.icsEventUrl||"");let S=v.icsEventSubscription||"";t=Gh(t,"icsEventSubscription",S);let x=v.icsEventId||"";t=Gh(t,"icsEventId",x,{alwaysQuote:!0})}return t}function Gh(r,e,t,n={}){let i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`(["'])\\{\\{${i}\\}\\}\\1`,"g"),s=t||"",o=r.replace(a,(d,u)=>{let p=u==="'"?s.replace(/'/g,"''"):Gq(s);return`${u}${p}${u}`}),l=s&&(n.alwaysQuote||Vit(s))?`"${Gq(s)}"`:s,c=new RegExp(`\\{\\{${i}\\}\\}`,"g");return o=o.replace(c,l),o}function Hit(r){return r.replace(/^(\s*[^#\n][^:\n]*:\s*)(<%.*?%>)(\s*)$/gm,(e,t,n,i)=>`${t}"${Gq(n)}"${i}`)}function Vit(r){if(!r)return!1;let e=/[[\]{}:>|*&!%#`@,]/,t=/^[-?]/,n=/^\d+\.?\d*$/,i=/^(true|false|yes|no|on|off)$/i;return e.test(r)||t.test(r)||n.test(r)||i.test(r)}function Gq(r){return r?r.replace(/\\/g,"\\\\").replace(/"/g,'\\"'):""}function qit(r,e){var f;let t=r,n=new Date;t=t.replace(/\{\{title\}\}/g,e.title||""),t=t.replace(/\{\{priority\}\}/g,e.priority||""),t=t.replace(/\{\{status\}\}/g,e.status||"");let i=Array.isArray(e.contexts)?e.contexts.join(", "):"";t=t.replace(/\{\{contexts\}\}/g,i);let a=Array.isArray(e.tags)?e.tags.join(", "):"";t=t.replace(/\{\{tags\}\}/g,a);let s=Array.isArray(e.tags)?e.tags.map(h=>`#${h}`).join(" "):"";t=t.replace(/\{\{hashtags\}\}/g,s),t=t.replace(/\{\{timeEstimate\}\}/g,((f=e.timeEstimate)==null?void 0:f.toString())||""),t=t.replace(/\{\{dueDate\}\}/g,e.dueDate||""),t=t.replace(/\{\{scheduledDate\}\}/g,e.scheduledDate||""),t=t.replace(/\{\{details\}\}/g,e.details||""),t=t.replace(/\{\{parentNote\}\}/g,e.parentNote||""),t=t.replace(/\{\{date\}\}/g,P(n,"yyyy-MM-dd")),t=t.replace(/\{\{time\}\}/g,P(n,"HH:mm")),t=t.replace(/\{\{year\}\}/g,P(n,"yyyy")),t=t.replace(/\{\{month\}\}/g,P(n,"MM")),t=t.replace(/\{\{day\}\}/g,P(n,"dd")),t=t.replace(/\{\{hour\}\}/g,P(n,"HH")),t=t.replace(/\{\{minute\}\}/g,P(n,"mm")),t=t.replace(/\{\{second\}\}/g,P(n,"ss")),t=t.replace(/\{\{timestamp\}\}/g,P(n,"yyyy-MM-dd-HHmmss")),t=t.replace(/\{\{dateTime\}\}/g,P(n,"yyyy-MM-dd-HHmm")),t=t.replace(/\{\{shortDate\}\}/g,P(n,"yyMMdd")),t=t.replace(/\{\{shortYear\}\}/g,P(n,"yy")),t=t.replace(/\{\{monthName\}\}/g,P(n,"MMMM")),t=t.replace(/\{\{monthNameShort\}\}/g,P(n,"MMM")),t=t.replace(/\{\{dayName\}\}/g,P(n,"EEEE")),t=t.replace(/\{\{dayNameShort\}\}/g,P(n,"EEE")),t=t.replace(/\{\{week\}\}/g,P(n,"ww")),t=t.replace(/\{\{quarter\}\}/g,P(n,"q")),t=t.replace(/\{\{time12\}\}/g,P(n,"hh:mm a")),t=t.replace(/\{\{time24\}\}/g,P(n,"HH:mm")),t=t.replace(/\{\{hourPadded\}\}/g,P(n,"HH")),t=t.replace(/\{\{hour12\}\}/g,P(n,"hh")),t=t.replace(/\{\{ampm\}\}/g,P(n,"a")),t=t.replace(/\{\{unix\}\}/g,Math.floor(n.getTime()/1e3).toString()),t=t.replace(/\{\{unixMs\}\}/g,n.getTime().toString()),t=t.replace(/\{\{milliseconds\}\}/g,P(n,"SSS")),t=t.replace(/\{\{ms\}\}/g,P(n,"SSS")),t=t.replace(/\{\{timezone\}\}/g,P(n,"xxx")),t=t.replace(/\{\{timezoneShort\}\}/g,P(n,"xx")),t=t.replace(/\{\{utcOffset\}\}/g,P(n,"xxx")),t=t.replace(/\{\{utcOffsetShort\}\}/g,P(n,"xx")),t=t.replace(/\{\{utcZ\}\}/g,"Z");let o=P(n,"yyMMdd"),l=new Date(n);l.setHours(0,0,0,0);let c=Math.floor((n.getTime()-l.getTime())/1e3),d=`${o}${c.toString(36)}`;t=t.replace(/\{\{zettel\}\}/g,d),t=t.replace(/\{\{nano\}\}/g,Date.now().toString()+Math.random().toString(36).substring(2,7));let u=e.priority||"",p=e.status||"";t=t.replace(/\{\{priorityShort\}\}/g,u.substring(0,1).toUpperCase()),t=t.replace(/\{\{statusShort\}\}/g,p.substring(0,1).toUpperCase());let m=e.title||"";if(t=t.replace(/\{\{titleLower\}\}/g,m.toLowerCase()),t=t.replace(/\{\{titleUpper\}\}/g,m.toUpperCase()),t=t.replace(/\{\{titleSnake\}\}/g,m.toLowerCase().replace(/\s+/g,"_")),t=t.replace(/\{\{titleKebab\}\}/g,m.toLowerCase().replace(/\s+/g,"-")),t=t.replace(/\{\{titleCamel\}\}/g,m.replace(/(?:^\w|[A-Z]|\b\w)/g,(h,g)=>g===0?h.toLowerCase():h.toUpperCase()).replace(/\s+/g,"")),t=t.replace(/\{\{titlePascal\}\}/g,m.replace(/(?:^\w|[A-Z]|\b\w)/g,h=>h.toUpperCase()).replace(/\s+/g,"")),"icsEventTitle"in e){let h=e;t=t.replace(/\{\{icsEventTitle\}\}/g,h.icsEventTitle||""),t=t.replace(/\{\{icsEventStart\}\}/g,h.icsEventStart||""),t=t.replace(/\{\{icsEventEnd\}\}/g,h.icsEventEnd||""),t=t.replace(/\{\{icsEventLocation\}\}/g,h.icsEventLocation||""),t=t.replace(/\{\{icsEventDescription\}\}/g,h.icsEventDescription||""),t=t.replace(/\{\{icsEventUrl\}\}/g,h.icsEventUrl||""),t=t.replace(/\{\{icsEventSubscription\}\}/g,h.icsEventSubscription||""),t=t.replace(/\{\{icsEventId\}\}/g,h.icsEventId||"")}return t}function NEe(r,e){return{...e,...r}}var IEe,JN=y(()=>{Br();ZN();G();IEe=I({tag:"Utils/TemplateProcessor"})});function Kit(r,e){return r.replace(Git,t=>P(e,Yit[t]))}function Zit(r){return r.replace(/\\/g,"/").split("/").some(e=>e==="."||e==="..")}function Qit(r){let e=r.replace(/\\/g,"/"),t=e.endsWith("/"),n=[];for(let a of e.split("/"))if(!(!a||a===".")){if(a===".."){n.pop();continue}n.push(a)}let i=n.join("/");return t&&i?`${i}/`:i}function XN(r){return r.replace(/\.md$/i,"")}function Jit(r){let e=r.trim();if(!e)return"";if(e.startsWith("[[")&&e.endsWith("]]")){let n=e.slice(2,-2).trim(),i=n.indexOf("|"),a=i!==-1?n.slice(0,i):n;return XN(a.trim())}let t=e.match(/^\[[^\]]*\]\(([^)]+)\)$/);if(t){let n=t[1].trim();n.startsWith("<")&&n.endsWith(">")&&(n=n.slice(1,-1).trim());try{n=decodeURIComponent(n)}catch(i){Wit.debug("Failed to decode project path:",{category:"persistence",operation:"decode-project-path",details:{value:n},error:i})}return XN(n)}return XN(e)}function Xit(r){return XN(r.trim()).replace(/\\/g,"/").split("/").filter(t=>t.length>0).map(t=>t.replace(/[<>:"|?*]/g,"_")).join("/")}function REe(r,e){let t=e?e(r):Jit(r);return Xit(t)}function eR(r,e={}){if(!r)return r;let{date:t=new Date,taskData:n,icsData:i,extractProjectBasename:a,extractProjectFilePath:s}=e,o=r,l=Zit(r);if(o=Kit(o,t),n){let u=Array.isArray(n.contexts)&&n.contexts.length>0?n.contexts[0]:"";o=o.replace(/\{\{context\}\}/g,u);let p=Array.isArray(n.projects)&&n.projects.length>0?a?a(n.projects[0]):n.projects[0]:"";o=o.replace(/\{\{project\}\}/g,p);let m=Array.isArray(n.projects)&&n.projects.length>0?n.projects.map(z=>a?a(z):z).join("/"):"";o=o.replace(/\{\{projects\}\}/g,m);let f=Array.isArray(n.projects)&&n.projects.length>0?REe(n.projects[0],s):"";o=o.replace(/\{\{projectFilePath\}\}/g,f);let h=Array.isArray(n.projects)&&n.projects.length>0?n.projects.map(z=>REe(z,s)).filter(z=>z.length>0).join("/"):"";o=o.replace(/\{\{projectFilePaths\}\}/g,h);let g=Array.isArray(n.contexts)&&n.contexts.length>0?n.contexts.join("/"):"";o=o.replace(/\{\{contexts\}\}/g,g);let v=n.priority||"";o=o.replace(/\{\{priority\}\}/g,v);let k=n.status||"";o=o.replace(/\{\{status\}\}/g,k);let b=n.title?n.title.replace(/[<>:"/\\|?*]/g,"_"):"";o=o.replace(/\{\{title\}\}/g,b);let w=n.due||"";o=o.replace(/\{\{dueDate\}\}/g,w);let S=n.scheduled||"";o=o.replace(/\{\{scheduledDate\}\}/g,S);let x=v?v.substring(0,1).toUpperCase():"";o=o.replace(/\{\{priorityShort\}\}/g,x);let C=k?k.substring(0,1).toUpperCase():"";o=o.replace(/\{\{statusShort\}\}/g,C);let D=b?b.toLowerCase():"";o=o.replace(/\{\{titleLower\}\}/g,D);let _=b?b.toUpperCase():"";o=o.replace(/\{\{titleUpper\}\}/g,_);let O=b?b.toLowerCase().replace(/\s+/g,"_"):"";o=o.replace(/\{\{titleSnake\}\}/g,O);let L=b?b.toLowerCase().replace(/\s+/g,"-"):"";o=o.replace(/\{\{titleKebab\}\}/g,L);let N=b?b.replace(/(?:^\w|[A-Z]|\b\w)/g,(z,H)=>H===0?z.toLowerCase():z.toUpperCase()).replace(/\s+/g,""):"";o=o.replace(/\{\{titleCamel\}\}/g,N);let R=b?b.replace(/(?:^\w|[A-Z]|\b\w)/g,z=>z.toUpperCase()).replace(/\s+/g,""):"";o=o.replace(/\{\{titlePascal\}\}/g,R)}if(i){let u=i.title?i.title.replace(/[<>:"/\\|?*]/g,"_"):"";o=o.replace(/\{\{icsEventTitle\}\}/g,u);let p=u?u.toLowerCase():"";o=o.replace(/\{\{icsEventTitleLower\}\}/g,p);let m=u?u.toUpperCase():"";o=o.replace(/\{\{icsEventTitleUpper\}\}/g,m);let f=u?u.toLowerCase().replace(/\s+/g,"_"):"";o=o.replace(/\{\{icsEventTitleSnake\}\}/g,f);let h=u?u.toLowerCase().replace(/\s+/g,"-"):"";o=o.replace(/\{\{icsEventTitleKebab\}\}/g,h);let g=u?u.replace(/(?:^\w|[A-Z]|\b\w)/g,(w,S)=>S===0?w.toLowerCase():w.toUpperCase()).replace(/\s+/g,""):"";o=o.replace(/\{\{icsEventTitleCamel\}\}/g,g);let v=u?u.replace(/(?:^\w|[A-Z]|\b\w)/g,w=>w.toUpperCase()).replace(/\s+/g,""):"";o=o.replace(/\{\{icsEventTitlePascal\}\}/g,v);let k=i.location?i.location.replace(/[<>:"/\\|?*]/g,"_"):"";o=o.replace(/\{\{icsEventLocation\}\}/g,k);let b=i.description?i.description.replace(/[<>:"/\\|?*]/g,"_"):"";o=o.replace(/\{\{icsEventDescription\}\}/g,b)}o=o.replace(/\{\{year\}\}/g,P(t,"yyyy")),o=o.replace(/\{\{month\}\}/g,P(t,"MM")),o=o.replace(/\{\{day\}\}/g,P(t,"dd")),o=o.replace(/\{\{date\}\}/g,P(t,"yyyy-MM-dd")),o=o.replace(/\{\{time\}\}/g,P(t,"HHmmss")),o=o.replace(/\{\{timestamp\}\}/g,P(t,"yyyy-MM-dd-HHmmss")),o=o.replace(/\{\{dateTime\}\}/g,P(t,"yyyy-MM-dd-HHmm")),o=o.replace(/\{\{hour\}\}/g,P(t,"HH")),o=o.replace(/\{\{minute\}\}/g,P(t,"mm")),o=o.replace(/\{\{second\}\}/g,P(t,"ss")),o=o.replace(/\{\{shortDate\}\}/g,P(t,"yyMMdd")),o=o.replace(/\{\{shortYear\}\}/g,P(t,"yy")),o=o.replace(/\{\{monthName\}\}/g,P(t,"MMMM")),o=o.replace(/\{\{monthNameShort\}\}/g,P(t,"MMM")),o=o.replace(/\{\{dayName\}\}/g,P(t,"EEEE")),o=o.replace(/\{\{dayNameShort\}\}/g,P(t,"EEE")),o=o.replace(/\{\{week\}\}/g,P(t,"ww")),o=o.replace(/\{\{quarter\}\}/g,P(t,"q")),o=o.replace(/\{\{time12\}\}/g,P(t,"hh:mm a")),o=o.replace(/\{\{time24\}\}/g,P(t,"HH:mm")),o=o.replace(/\{\{hourPadded\}\}/g,P(t,"HH")),o=o.replace(/\{\{hour12\}\}/g,P(t,"hh")),o=o.replace(/\{\{ampm\}\}/g,P(t,"a")),o=o.replace(/\{\{unix\}\}/g,Math.floor(t.getTime()/1e3).toString()),o=o.replace(/\{\{unixMs\}\}/g,t.getTime().toString()),o=o.replace(/\{\{milliseconds\}\}/g,P(t,"SSS")),o=o.replace(/\{\{ms\}\}/g,P(t,"SSS")),o=o.replace(/\{\{timezone\}\}/g,P(t,"xxx")),o=o.replace(/\{\{timezoneShort\}\}/g,P(t,"xx")),o=o.replace(/\{\{utcOffset\}\}/g,P(t,"xxx")),o=o.replace(/\{\{utcOffsetShort\}\}/g,P(t,"xx")),o=o.replace(/\{\{utcZ\}\}/g,"Z");let c=(()=>{let u=P(t,"yyMMdd"),p=new Date(t);p.setHours(0,0,0,0);let f=Math.floor((t.getTime()-p.getTime())/1e3).toString(36);return`${u}${f}`})();o=o.replace(/\{\{zettel\}\}/g,c);let d=Date.now().toString()+Math.random().toString(36).substring(2,7);return o=o.replace(/\{\{nano\}\}/g,d),l?Qit(o):o}var Wit,Yit,Git,Kq=y(()=>{Br();G();Wit=I({tag:"Utils/FolderTemplateProcessor"}),Yit={YYYY:"yyyy",YY:"yy",MMMM:"MMMM",MMM:"MMM",MM:"MM",DD:"dd",dddd:"EEEE",ddd:"EEE"},Git=/YYYY|MMMM|dddd|MMM|ddd|YY|MM|DD/g});var OEe,tR,rR,LEe=y(()=>{OEe=require("obsidian");Ur();yv();Eb();Ct();Ne();gr();JN();iv();G();tR=I({tag:"Services/TaskService/TaskCreationService"}),rR=class{constructor(e){this.deps=e}setWebhookNotifier(e){this.deps.webhookNotifier=e}async createTask(e,t={}){var a;let{applyDefaults:n=!0}=t,{runtime:i}=this.deps;try{if(n&&(e=await this.deps.applyTaskCreationDefaults(e)),!e.title||!e.title.trim())throw new Error("Title is required");let s=e.title.trim(),o=this.deps.sanitizeTitleForStorage(s),l=i.settings.storeTitleInFilename?this.deps.sanitizeTitleForFilename(s):o,c=e.priority||i.settings.defaultTaskPriority,d=e.status||i.settings.defaultTaskStatus,u=e.dateCreated||Ye(),p=e.dateModified||Ye(),m=e.contexts||[],f=e.projects||[],h=dc(e.tags||[]);if(i.settings.taskIdentificationMethod==="tag"){let se=(a=dc(i.settings.taskTag)[0])!=null?a:i.settings.taskTag;se&&!h.includes(se)&&(h=[se,...h])}let g={title:l,priority:c,status:d,date:new Date,dueDate:e.due,scheduledDate:e.scheduled,contexts:m,projects:f,tags:h,timeEstimate:e.timeEstimate,details:e.details,parentNote:e.parentNote},v=ewe(g,i.settings),k=await this.resolveTargetFolder(e);k&&await Ap(i.app.vault,k);let b=await Sb(v,k,i.app.vault),w=k?`${k}/${b}.md`:`${b}.md`,S={title:o,status:d,priority:c,due:e.due||void 0,scheduled:e.scheduled||void 0,contexts:m.length>0?m:void 0,projects:f.length>0?f:void 0,timeEstimate:e.timeEstimate&&e.timeEstimate>0?e.timeEstimate:void 0,dateCreated:u,dateModified:p,recurrence:e.recurrence||void 0,recurrence_anchor:e.recurrence_anchor||void 0,recurrence_parent:e.recurrence_parent||void 0,occurrence_date:e.occurrence_date||void 0,occurrence_materialization:e.occurrence_materialization||void 0,occurrence_next_trigger:e.occurrence_next_trigger||void 0,occurrence_template:e.occurrence_template||void 0,occurrence_past_horizon:e.occurrence_past_horizon||void 0,occurrence_future_horizon:e.occurrence_future_horizon||void 0,reminders:e.reminders&&e.reminders.length>0?e.reminders:void 0,customProperties:e.customProperties||void 0,icsEventId:e.icsEventId||void 0,blockedBy:e.blockedBy&&e.blockedBy.length>0?e.blockedBy:void 0},x=i.fieldMapper.getUserFields();if(x.length>0){let se=e,J=S;for(let te of x)Object.prototype.hasOwnProperty.call(se,te.key)&&se[te.key]!==void 0&&(J[te.key]=se[te.key])}if(S.recurrence&&typeof S.recurrence=="string"&&!S.recurrence.includes("DTSTART:")){let se={...S,title:o,status:d,priority:c,path:"",archived:!1},J=Xf(se);J&&(S.recurrence=J)}let D=i.settings.taskIdentificationMethod==="tag"?i.settings.taskTag:void 0,_=i.fieldMapper.mapToFrontmatter(S,D,i.settings.storeTitleInFilename);if(i.settings.taskIdentificationMethod==="property"){let se=i.settings.taskPropertyName,J=i.settings.taskPropertyValue;se&&J&&nv(_,se,J),h.length>0&&(_.tags=h)}else _.tags=h;let O=await this.deps.applyTemplate(e),L=O.body?O.body.replace(/\r\n/g,` +`).trimEnd():e.details?e.details.replace(/\r\n/g,` +`).trimEnd():"",N=NEe(_,O.frontmatter);e.customFrontmatter&&(N={...N,...e.customFrontmatter}),i.settings.storeTitleInFilename&&delete N[i.fieldMapper.toUserField("title")],i.settings.taskIdentificationMethod==="property"&&nv(N,i.settings.taskPropertyName,i.settings.taskPropertyValue),h=dc(N.tags);let z=`--- +${(0,OEe.stringifyYaml)(N)}--- + +`;L.length>0&&(z+=`${L} +`);let H=await i.app.vault.create(w,z),Y={...S,...N,title:Z(N.title||S.title||o),status:Z(N.status||S.status||d),priority:Z(N.priority||S.priority||c),path:H.path,tags:h,archived:!1,details:L};try{i.cacheManager.waitForFreshTaskData&&await i.cacheManager.waitForFreshTaskData(H),i.cacheManager.updateTaskInfoInCache(H.path,Y)}catch(se){tR.error("Error updating cache for new task:",{category:"stale-data",operation:"updating-cache-new-task",error:se})}if(i.emitter.trigger(nt,{path:H.path,updatedTask:Y}),this.deps.webhookNotifier)try{await this.deps.webhookNotifier.triggerWebhook("task.created",{task:Y})}catch(se){tR.warn("Failed to trigger webhook for task creation:",{category:"provider",operation:"trigger-webhook-task-creation",error:se})}return i.taskCalendarSyncService&&i.settings.googleCalendarExport.syncOnTaskCreate&&i.taskCalendarSyncService.syncTaskToCalendar(Y).catch(se=>{tR.warn("Failed to sync task to Google Calendar:",{category:"provider",operation:"sync-task-google-calendar",error:se})}),{file:H,taskInfo:Y}}catch(s){let o=s instanceof Error?s.message:String(s);throw tR.error("Error creating task:",{category:"persistence",operation:"creating-task",details:{stack:s instanceof Error?s.stack:void 0,taskData:e},error:o}),new Error(`Failed to create task: ${o}`)}}resolveCurrentNoteFolderVariables(e){var n;if(!e.includes("{{currentNotePath}}")&&!e.includes("{{currentNoteTitle}}"))return e;let t=this.deps.runtime.app.workspace.getActiveFile();return e.replace(/\{\{currentNotePath\}\}/g,((n=t==null?void 0:t.parent)==null?void 0:n.path)||"").replace(/\{\{currentNoteTitle\}\}/g,(t==null?void 0:t.basename)||"")}async resolveTargetFolder(e){let{runtime:t}=this.deps,n="";if(e.creationContext==="inline-conversion"||e.creationContext==="modal-inline-creation"){let a=t.settings.inlineTaskConvertFolder||"";if(a.trim())return n=this.resolveCurrentNoteFolderVariables(a),this.deps.processFolderTemplate(n,e);let s=this.resolveCurrentNoteFolderVariables(t.settings.tasksFolder||"");return this.deps.processFolderTemplate(s,e)}let i=this.resolveCurrentNoteFolderVariables(t.settings.tasksFolder||"");return this.deps.processFolderTemplate(i,e)}}});function Zq(r){return!!(r.googleCalendarEventId||r.googleCalendarExceptionEventId||r.googleCalendarExceptionOriginalScheduled||r.googleCalendarMovedOriginalDates&&r.googleCalendarMovedOriginalDates.length>0)&&!!r.recurrence&&(r.recurrence_anchor||"scheduled")==="scheduled"}function eat(r){let e=r.googleCalendarExceptionOriginalScheduled||r.scheduled||r.due;return ke(e||"")||void 0}function nR(r,e,t){if(!Zq(r)||e===r.scheduled)return;let n=eat(r);if(!n)return;let i=typeof e=="string"?ke(e):"";t.googleCalendarExceptionOriginalScheduled=i&&i!==n?n:void 0}function Kh(r){Zq(r)||(r.googleCalendarExceptionOriginalScheduled=void 0,r.googleCalendarMovedOriginalDates=void 0)}function Qq(r,e,t){if(!Zq(r))return;let n=ke(r.googleCalendarExceptionOriginalScheduled||"");if(!n)return;let i=ke(r.scheduled||"");!i||e!==i||(t.googleCalendarMovedOriginalDates=Array.from(new Set([...r.googleCalendarMovedOriginalDates||[],n])).sort(),t.googleCalendarExceptionOriginalScheduled=void 0)}var iR=y(()=>{Ne()});function FEe(r){return Array.isArray(r.timeEntries)?{...r,timeEntries:r.timeEntries.map(tat)}:{...r}}function tat(r){let e={...r};return delete e.duration,e}function $Ee(r){return Object.prototype.hasOwnProperty.call(r,"details")?typeof r.details=="string"?r.details.replace(/\r\n/g,` +`):"":null}function zEe({originalTask:r,updates:e,maintainDueDateOffsetInRecurring:t,updateToNextScheduledOccurrenceFn:n=ih,addDTSTARTToRecurrenceRuleFn:i=Xf}){let a={};if(e.recurrence!==void 0&&e.recurrence!==r.recurrence){let o={...r,...e},l=n(o,t);if(l.scheduled&&(a.scheduled=l.scheduled),l.due&&(a.due=l.due),typeof e.recurrence=="string"&&e.recurrence&&!e.recurrence.includes("DTSTART:")){let c={...r,...e,...a},d=i(c);d&&(a.recurrence=d)}}else if(e.recurrence!==void 0&&!r.recurrence&&e.recurrence&&typeof e.recurrence=="string"&&!e.recurrence.includes("DTSTART:")){let o={...r,...e},l=i(o);l&&(a.recurrence=l)}if(e.scheduled!==void 0&&e.scheduled!==r.scheduled&&r.recurrence&&typeof r.recurrence=="string"&&!r.recurrence.includes("DTSTART:")){let o={...r,...e},l=i(o);l&&(a.recurrence=l)}if(Object.prototype.hasOwnProperty.call(e,"scheduled")){let o={...r,...e,...a};nR(r,e.scheduled,o),a.googleCalendarExceptionOriginalScheduled=o.googleCalendarExceptionOriginalScheduled}let s={...r,...e,...a};return Kh(s),a.googleCalendarExceptionOriginalScheduled=s.googleCalendarExceptionOriginalScheduled,a.googleCalendarMovedOriginalDates=s.googleCalendarMovedOriginalDates,a}function jEe({frontmatter:r,originalTask:e,updates:t,recurrenceUpdates:n,dateModified:i,fieldMapper:a,taskIdentification:s,storeTitleInFilename:o,updateCompletedDateInFrontmatter:l}){let c={...e,...t,...n,dateModified:i},d=a.mapToFrontmatter(c,s.method==="tag"?s.tag:void 0,o);if(Object.entries(d).forEach(([u,p])=>{p!==void 0&&(r[u]=p)}),t.status!==void 0&&l(r,t.status,!!e.recurrence),s.method==="property"&&rat(r,s),t.customFrontmatter&&Object.entries(t.customFrontmatter).forEach(([u,p])=>{p===null?delete r[u]:r[u]=p}),nat(r,{...t,...n},a),o&&delete r[a.toUserField("title")],Object.prototype.hasOwnProperty.call(t,"tags")){let u=dc(t.tags);u.length>0?r.tags=u:delete r.tags}return s.method==="property"&&nv(r,s.propertyName,s.propertyValue),{finalTags:dc(r.tags)}}function rat(r,e){e.propertyName&&e.propertyValue&&nv(r,e.propertyName,e.propertyValue)}function nat(r,e,t){if(Object.prototype.hasOwnProperty.call(e,"due")&&e.due===void 0&&delete r[t.toUserField("due")],Object.prototype.hasOwnProperty.call(e,"scheduled")&&e.scheduled===void 0&&delete r[t.toUserField("scheduled")],Object.prototype.hasOwnProperty.call(e,"contexts")&&e.contexts===void 0&&delete r[t.toUserField("contexts")],Object.prototype.hasOwnProperty.call(e,"projects")){let n=t.toUserField("projects"),i=Array.isArray(e.projects)?e.projects:[];i.length>0?r[n]=i:delete r[n]}Object.prototype.hasOwnProperty.call(e,"timeEstimate")&&e.timeEstimate===void 0&&delete r[t.toUserField("timeEstimate")],Object.prototype.hasOwnProperty.call(e,"completedDate")&&e.completedDate===void 0&&delete r[t.toUserField("completedDate")],Object.prototype.hasOwnProperty.call(e,"recurrence")&&e.recurrence===void 0&&delete r[t.toUserField("recurrence")],Object.prototype.hasOwnProperty.call(e,"googleCalendarExceptionOriginalScheduled")&&e.googleCalendarExceptionOriginalScheduled===void 0&&delete r[t.toUserField("googleCalendarExceptionOriginalScheduled")],Object.prototype.hasOwnProperty.call(e,"googleCalendarMovedOriginalDates")&&(!Array.isArray(e.googleCalendarMovedOriginalDates)||e.googleCalendarMovedOriginalDates.length===0)&&delete r[t.toUserField("googleCalendarMovedOriginalDates")],Object.prototype.hasOwnProperty.call(e,"blockedBy")&&e.blockedBy===void 0&&delete r[t.toUserField("blockedBy")]}function BEe({originalTask:r,updates:e,recurrenceUpdates:t,newPath:n,dateModified:i,currentDateString:a,normalizedDetails:s,finalTags:o,isCompletedStatus:l}){let c={...r,...e,...t,path:n,dateModified:i};return o&&(c.tags=o),s!==null&&(c.details=s),e.status!==void 0&&!r.recurrence&&(l(e.status)?r.completedDate||(c.completedDate=a):c.completedDate=void 0),c}var UEe=y(()=>{yv();iR();iv()});var aR,Qb,sR,HEe=y(()=>{aR=require("obsidian");Ur();Ct();Eb();Ne();UEe();G();Qb=I({tag:"Services/TaskService/TaskUpdateService"}),sR=class{constructor(e){this.deps=e}setWebhookNotifier(e){this.deps.webhookNotifier=e}setAutoArchiveService(e){this.deps.autoArchiveService=e}async updateTask(e,t){var i;let{runtime:n}=this.deps;try{let a=FEe(t),s=n.app.vault.getAbstractFileByPath(e.path);if(!(s instanceof aR.TFile))throw new Error(`Cannot find task file: ${e.path}`);let o=n.settings.storeTitleInFilename&&a.title&&a.title!==e.title,l=e.path;if(o&&a.title){let h=s.parent?s.parent.path:"",g=await Sb(a.title,h,n.app.vault);l=h?`${h}/${g}.md`:`${g}.md`}let c=zEe({originalTask:e,updates:a,maintainDueDateOffsetInRecurring:n.settings.maintainDueDateOffsetInRecurring}),d=$Ee(a),u,p=Ye(),m=a.status!==void 0&&!e.recurrence?fv():"";if(await n.app.fileManager.processFrontMatter(s,h=>{u=jEe({frontmatter:h,originalTask:e,updates:a,recurrenceUpdates:c,dateModified:p,fieldMapper:n.fieldMapper,taskIdentification:{method:n.settings.taskIdentificationMethod,tag:n.settings.taskTag,propertyName:n.settings.taskPropertyName,propertyValue:n.settings.taskPropertyValue},storeTitleInFilename:n.settings.storeTitleInFilename,updateCompletedDateInFrontmatter:(v,k,b)=>this.deps.updateCompletedDateInFrontmatter(v,k,b)}).finalTags}),o&&await n.app.fileManager.renameFile(s,l),d!==null){let h=n.app.vault.getAbstractFileByPath(l);if(h instanceof aR.TFile){let g=await n.app.vault.read(h),{frontmatter:v}=Np(g),k=v!==null?`--- +${v} +--- + +`:"",b=d.trimEnd(),w=b.length>0?`${b} +`:"";await n.app.vault.modify(h,`${k}${w}`)}}let f=BEe({originalTask:e,updates:a,recurrenceUpdates:c,newPath:l,dateModified:p,currentDateString:m,normalizedDetails:d,finalTags:u,isCompletedStatus:h=>n.statusManager.isCompletedStatus(h)});o&&(n.cacheManager.clearCacheEntry(e.path),n.expandedProjectsService.renamePath(e.path,l),n.projectSubtasksService.invalidateIndex());try{let h=n.app.vault.getAbstractFileByPath(l);if(h instanceof aR.TFile&&n.cacheManager.waitForFreshTaskData){let g={};a.title!==void 0&&(g.title=a.title),a.status!==void 0&&(g.status=a.status),a.priority!==void 0&&(g.priority=a.priority),Object.keys(g).length>0&&await n.cacheManager.waitForFreshTaskData(h)}n.cacheManager.updateTaskInfoInCache(l,f)}catch(h){Qb.error("Error updating task cache:",{category:"stale-data",operation:"updating-task-cache",details:{taskPath:l},error:h instanceof Error?h.message:String(h)})}try{n.emitter.trigger(nt,{path:l,originalTask:e,updatedTask:f})}catch(h){Qb.error("Error emitting task update event:",{category:"validation",operation:"emitting-task-update-event",details:{taskPath:l},error:h instanceof Error?h.message:String(h)})}if(this.deps.webhookNotifier)try{let h=n.statusManager.isCompletedStatus(e.status),g=n.statusManager.isCompletedStatus(f.status);!h&&g?await this.deps.webhookNotifier.triggerWebhook("task.completed",{task:f}):await this.deps.webhookNotifier.triggerWebhook("task.updated",{task:f,previous:e})}catch(h){Qb.warn("Failed to trigger webhook for task update:",{category:"provider",operation:"trigger-webhook-task-update",error:h})}if((i=n.taskCalendarSyncService)!=null&&i.isEnabled()){let h=n.statusManager.isCompletedStatus(e.status),g=n.statusManager.isCompletedStatus(f.status);(!h&&g?n.taskCalendarSyncService.completeTaskInCalendar(f):n.taskCalendarSyncService.updateTaskInCalendar(f,e)).catch(k=>{Qb.warn("Failed to sync task update to Google Calendar:",{category:"provider",operation:"sync-task-update-google-calendar",error:k})})}return await this.handleAutoArchive(e,f,a.status),f}catch(a){let s=a instanceof Error?a.message:String(a);throw Qb.error("Error updating task:",{category:"validation",operation:"updating-task",details:{stack:a instanceof Error?a.stack:void 0,taskPath:e.path,updates:t},error:s}),new Error(`Failed to update task: ${s}`)}}async handleAutoArchive(e,t,n){if(!(!this.deps.autoArchiveService||n===void 0||n===e.status))try{let i=this.deps.runtime.statusManager.getStatusConfig(t.status);if(!i)return;i.autoArchive?await this.deps.autoArchiveService.scheduleAutoArchive(t,i):await this.deps.autoArchiveService.cancelAutoArchive(t.path)}catch(i){Qb.warn("Failed to handle auto-archive for status change:",{category:"validation",operation:"handle-auto-archive-status-change",error:i})}}}});function VEe(r,e,t={}){var l,c,d,u;let n=e.taskCreationDefaults,i=(l=t.calculateDefaultDate)!=null?l:eS,a=(c=t.calculateDefaultDateTime)!=null?c:Ip,s=(d=t.convertDefaultRemindersToReminders)!=null?d:Yx,o={...r,customFrontmatter:r.customFrontmatter?{...r.customFrontmatter}:void 0};return o.due===void 0&&n.defaultDueDate!=="none"&&(o.due=a(n.defaultDueDate,n.defaultDueTime)),o.scheduled===void 0&&n.defaultScheduledDate!=="none"&&(o.scheduled=a(n.defaultScheduledDate,n.defaultScheduledTime)),!o.contexts&&n.defaultContexts&&(o.contexts=Jq(n.defaultContexts)),!o.projects&&n.defaultProjects&&(o.projects=Jq(n.defaultProjects)),!o.tags&&n.defaultTags&&(o.tags=Jq(n.defaultTags)),!o.timeEstimate&&n.defaultTimeEstimate>0&&(o.timeEstimate=n.defaultTimeEstimate),!o.recurrence&&n.defaultRecurrence!=="none"&&(o.recurrence=iat[n.defaultRecurrence]),!o.reminders&&n.defaultReminders&&n.defaultReminders.length>0&&(o.reminders=s(n.defaultReminders)),aat(o,(u=e.userFields)!=null?u:[],i),o}function Jq(r){return r.split(",").map(e=>e.trim()).filter(e=>e.length>0)}function aat(r,e,t){if(e.length!==0){r.customFrontmatter||(r.customFrontmatter={});for(let n of e){let i=sat(n);if(i!==void 0&&r.customFrontmatter[n.key]===void 0)if(n.type==="date"&&typeof i=="string"){let a=t(i);a&&(r.customFrontmatter[n.key]=a)}else r.customFrontmatter[n.key]=i}}}function sat(r){if(r.defaultValue!==void 0)return r.defaultValue;if(r.type==="boolean")return!1}var iat,qEe=y(()=>{Ct();jI();iat={none:void 0,daily:"FREQ=DAILY",weekly:"FREQ=WEEKLY",monthly:"FREQ=MONTHLY",yearly:"FREQ=YEARLY"}});function YEe(r){return r.replace(/./g,e=>{let t=e.charCodeAt(0);return t<=31||t>=127&&t<=159?"":e})}function GEe(r){return r.trim().replace(/\s+/g," ")}function KEe(r){return r.length>0?r:CC}function ZEe(r){if(!r||typeof r!="string")return CC;try{let e=YEe(GEe(r)).replace(/[<>:"/\\|?*#[\]]/g,"").replace(/^\.+|\.+$/g,"").trim();return KEe(e)}catch(e){return WEe.error("Error sanitizing title:",{category:"validation",operation:"sanitizing-title",error:e}),CC}}function QEe(r){if(!r||typeof r!="string")return CC;try{return KEe(YEe(GEe(r)).trim())}catch(e){return WEe.error("Error sanitizing title:",{category:"validation",operation:"sanitizing-title",error:e}),CC}}var WEe,CC,JEe=y(()=>{G();WEe=I({tag:"Services/TaskService/TaskTitleSanitizer"}),CC="untitled"});function Xq(r,e,t,n){return e!=="status"?null:{wasCompleted:r.statusManager.isCompletedStatus(r.normalizeStatusValue(t)),isCompleted:r.statusManager.isCompletedStatus(r.normalizeStatusValue(n))}}async function oat(r,e){try{r.cacheManager.waitForFreshTaskData&&await r.cacheManager.waitForFreshTaskData(e.file),r.cacheManager.updateTaskInfoInCache(e.originalTask.path,e.updatedTask)}catch(t){Jb.error("Error updating task cache:",{category:"stale-data",operation:"updating-task-cache",details:{taskPath:e.originalTask.path},error:t instanceof Error?t.message:String(t)})}}async function lat(r,e){try{r.emitter.trigger(nt,{path:e.originalTask.path,originalTask:e.originalTask,updatedTask:e.updatedTask});let t=Xq(r,e.property,e.oldValue,e.newValue);if(!t||t.wasCompleted===t.isCompleted)return;let n=r.cacheManager.getBlockedTaskPaths(e.originalTask.path);for(let i of n)try{let a=await r.cacheManager.getTaskInfo(i);a&&r.emitter.trigger(nt,{path:i,originalTask:a,updatedTask:a})}catch(a){Jb.error(`Error triggering update for dependent task ${i}:`,{category:"validation",operation:"triggering-update-dependent-task",error:a})}}catch(t){Jb.error("Error emitting task update event:",{category:"validation",operation:"emitting-task-update-event",details:{taskPath:e.originalTask.path},error:t instanceof Error?t.message:String(t)})}}async function cat(r,e){if(r.webhookNotifier)try{let t=Xq(r,e.property,e.oldValue,e.newValue);if(t&&!t.wasCompleted&&t.isCompleted){await r.webhookNotifier.triggerWebhook("task.completed",{task:e.updatedTask});return}await r.webhookNotifier.triggerWebhook("task.updated",{task:e.updatedTask,previous:e.originalTask})}catch(t){Jb.warn("Failed to trigger webhook for property update:",{category:"provider",operation:"trigger-webhook-property-update",error:t})}}function dat(r,e){var i;if(!((i=r.taskCalendarSyncService)!=null&&i.isEnabled()))return;let t=Xq(r,e.property,e.oldValue,e.newValue);(t&&!t.wasCompleted&&t.isCompleted?r.taskCalendarSyncService.completeTaskInCalendar(e.updatedTask):r.taskCalendarSyncService.updateTaskInCalendar(e.updatedTask,e.originalTask)).catch(a=>{Jb.warn("Failed to sync task update to Google Calendar:",{category:"provider",operation:"sync-task-update-google-calendar",error:a})})}async function uat(r,e){if(!(!r.autoArchiveService||e.property!=="status"||e.newValue===e.oldValue))try{let t=r.statusManager.getStatusConfig(e.newValue);if(!t)return;t.autoArchive?await r.autoArchiveService.scheduleAutoArchive(e.updatedTask,t):await r.autoArchiveService.cancelAutoArchive(e.updatedTask.path)}catch(t){Jb.warn("Failed to handle auto-archive for status property change:",{category:"persistence",operation:"handle-auto-archive-status-property-change",error:t})}}async function XEe(r,e){await oat(r,e),await lat(r,e),await cat(r,e),dat(r,e),await uat(r,e)}var Jb,exe=y(()=>{Ur();G();Jb=I({tag:"Services/TaskService/TaskPropertyChangeSideEffects"})});function mat(r,e){return typeof r=="string"&&Object.prototype.hasOwnProperty.call(e,r)}function Zh(r,e="frontmatter field"){if(typeof r!="string")throw new Error(`${e} resolved to a non-string frontmatter field name`);if(r.trim().length===0)throw new Error(`${e} resolved to an invalid frontmatter field name: ${r}`);return r}function txe(r,e){let t=r.getMapping();if(mat(e,t))return Zh(r.toUserField(e),`field mapping for ${String(e)}`);let n=pat[e];return n?Zh(r.toUserField(n),`field mapping for ${String(e)}`):Zh(String(e),`task property ${String(e)}`)}var pat,eW=y(()=>{pat={recurrence_anchor:"recurrenceAnchor",complete_instances:"completeInstances",skipped_instances:"skippedInstances",recurrence_parent:"recurrenceParent",occurrence_date:"occurrenceDate",occurrence_materialization:"occurrenceMaterialization",occurrence_next_trigger:"occurrenceNextTrigger",occurrence_template:"occurrenceTemplate",occurrence_past_horizon:"occurrencePastHorizon",occurrence_future_horizon:"occurrenceFutureHorizon"}});function fat(r,e,t){return r==="status"?t(e):r==="blockedBy"?hat(e):e}function hat(r){if(r==null)return;let t=(Array.isArray(r)?r:[r]).map(n=>ts(n)).filter(n=>!!n);return t.length>0?t:void 0}function rxe({freshTask:r,property:e,value:t,currentTimestamp:n,currentDateString:i,normalizeStatusValue:a,isCompletedStatus:s}){let o=fat(e,t,a),l={...r};if(l[e]=o,l.dateModified=n,e==="status"&&!r.recurrence){let c=a(o);s(c)?l.completedDate=i:l.completedDate=void 0}return{updatedTask:l,normalizedValue:o,dateModified:n}}function gat(r){let e=r.toLowerCase();return e==="true"||e==="false"?e==="true":r}function tW(r,e,t,n,i,a){if(!t){if(i(e)){r[n]=a;return}r[n]&&delete r[n]}}function nxe({frontmatter:r,property:e,fieldName:t,rawValue:n,normalizedValue:i,dateModified:a,dateModifiedField:s,completedDateField:o,isRecurring:l,normalizeStatusValue:c,isCompletedStatus:d,currentDateString:u}){let p=Zh(t,`task property ${String(e)}`),m=Zh(s,"dateModified field mapping"),f=Zh(o,"completedDate field mapping");if(e==="status"){let h=c(i);r[p]=gat(h),tW(r,h,l,f,d,u)}else if((e==="due"||e==="scheduled")&&!n)delete r[p];else if(e==="blockedBy"){let h=Array.isArray(i)?i:[];h.length>0?r[p]=eme(h):delete r[p]}else r[p]=i;r[m]=a}var ixe=y(()=>{ko();eW()});function axe(r,e,t){let n=!!r.archived,i={...r};i.archived=!n,i.dateModified=t;let a=Array.isArray(i.tags)?i.tags:[];return n?i.tags=a.filter(s=>s!==e):a.includes(e)?i.tags=[...a]:i.tags=[...a,e],{updatedTask:i,isCurrentlyArchived:n,operation:n?"unarchiving":"archiving",dateModified:t}}function sxe({frontmatter:r,archiveTag:e,isCurrentlyArchived:t,dateModified:n,dateModifiedField:i}){if(t){let a=r.tags;if(Array.isArray(a)){let s=a.filter(o=>o!==e);s.length===0?delete r.tags:r.tags=s}}else r.tags?Array.isArray(r.tags)||(r.tags=[r.tags]):r.tags=[],r.tags.includes(e)||r.tags.push(e);r[i]=n}function oxe({isCurrentlyArchived:r,moveArchivedTasks:e,archiveFolderTemplate:t,tasksFolderTemplate:n,fileName:i,taskData:a,processFolderTemplate:s}){if(!e)return null;let o=r?n==null?void 0:n.trim():t==null?void 0:t.trim();if(!o)return null;let l=r?"tasks":"archive",c=s(o,{title:a.title||"",priority:a.priority,status:a.status,contexts:a.contexts,projects:a.projects});return{operation:r?"unarchiving":"archiving",destinationKind:l,destinationFolder:c,newPath:`${c}/${i}`}}var lxe=y(()=>{});function oR(r){let e={...r};return delete e.duration,e}function lR(r){return Array.isArray(r)?r.map(oR):[]}function rW(r,e,t=e,n="Work session"){let i={startTime:t,description:n};return{updatedTask:{...r,dateModified:e,timeEntries:[...lR(r.timeEntries),i]},newEntry:i,dateModified:e}}function nW(r,e,t,n=t){let i={...r,dateModified:t},a=lR(r.timeEntries),s=a.findIndex(o=>o.startTime===e.startTime&&!o.endTime);return s!==-1&&(a[s]={...a[s],endTime:n},i.timeEntries=a),{updatedTask:i,stopTimestamp:n,dateModified:t}}function iW(r,e,t){if(!Array.isArray(r.timeEntries))throw new Error("Task has no time entries");if(e<0||e>=r.timeEntries.length)throw new Error("Invalid time entry index");return{updatedTask:{...r,dateModified:t,timeEntries:lR(r.timeEntries).filter((n,i)=>i!==e)},timeEntryIndex:e,dateModified:t}}var cxe=y(()=>{});function dxe({frontmatter:r,timeEntriesField:e,dateModifiedField:t,newEntry:n,dateModified:i}){r[e]||(r[e]=[]),Array.isArray(r[e])&&(r[e]=r[e].map(oR)),r[e].push(n),r[t]=i}function uxe({frontmatter:r,timeEntriesField:e,dateModifiedField:t,timeEntryIndex:n,dateModified:i}){r[e]&&Array.isArray(r[e])&&(r[e]=r[e].filter((a,s)=>s!==n)),r[t]=i}function pxe({frontmatter:r,timeEntriesField:e,dateModifiedField:t,activeSession:n,stopTimestamp:i,dateModified:a}){if(r[e]&&Array.isArray(r[e])){let s=r[e].map(oR),o=s.findIndex(l=>l.startTime===n.startTime&&!l.endTime);o!==-1&&(s[o].endTime=i),r[e]=s}r[t]=a}var mxe=y(()=>{cxe()});function Xb(r){return Array.isArray(r)?r.filter(e=>typeof e=="string"):[]}function fxe(r,e){if(e)return e;if(r.recurrence_anchor!=="completion"&&r.scheduled)return zt(ke(r.scheduled));let t=wr();return vn(t)}function hxe({freshTask:r,targetDate:e,currentTimestamp:t,maintainDueDateOffsetInRecurring:n}){if(!r.recurrence)throw new Error("Task is not recurring");let i=ce(e),a=Xb(r.complete_instances),o=!a.includes(i),l={...r,dateModified:t};if(o){a.includes(i)||(l.complete_instances=[...a,i]);let d=Xb(r.skipped_instances);l.skipped_instances=d.filter(u=>u!==i)}else{l.complete_instances=a.filter(u=>u!==i);let d=Xb(r.skipped_instances);l.skipped_instances=d.filter(u=>u!==i)}if(o&&typeof l.recurrence=="string"){if((l.recurrence_anchor||"scheduled")==="completion"){let u=M_(l.recurrence,i);u&&(l.recurrence=u)}else if(!l.recurrence.includes("DTSTART:")){let u=Xf(l);u&&(l.recurrence=u)}}let c=ih(l,n);return c.scheduled&&(l.scheduled=c.scheduled),c.due&&(l.due=c.due),Qq(r,i,l),Kh(l),{updatedTask:l,targetDate:e,dateStr:i,newComplete:o,dateModified:t,originalRecurrence:r.recurrence}}function gxe({frontmatter:r,completeInstancesField:e,skippedInstancesField:t,dateModifiedField:n,scheduledField:i,dueField:a,recurrenceField:s,googleCalendarExceptionOriginalScheduledField:o,googleCalendarMovedOriginalDatesField:l,plan:c}){r[e]||(r[e]=[]),r[t]||(r[t]=[]);let d=Xb(r[e]);c.newComplete?d.includes(c.dateStr)||(r[e]=[...d,c.dateStr]):r[e]=d.filter(u=>u!==c.dateStr),r[t]=c.updatedTask.skipped_instances||[],c.updatedTask.recurrence!==c.originalRecurrence&&(r[s]=c.updatedTask.recurrence),c.updatedTask.scheduled&&(r[i]=c.updatedTask.scheduled),c.updatedTask.due&&(r[a]=c.updatedTask.due),cR(r,o,c.updatedTask.googleCalendarExceptionOriginalScheduled),cR(r,l,c.updatedTask.googleCalendarMovedOriginalDates),r[n]=c.dateModified}function yxe({freshTask:r,targetDate:e,currentTimestamp:t,maintainDueDateOffsetInRecurring:n}){if(!r.recurrence)throw new Error("Task is not recurring");let i=ce(e),a=Xb(r.skipped_instances),o=!a.includes(i),l={...r,dateModified:t};if(o){a.includes(i)||(l.skipped_instances=[...a,i]);let d=Xb(r.complete_instances);l.complete_instances=d.filter(u=>u!==i)}else l.skipped_instances=a.filter(d=>d!==i);let c=ih(l,n);return c.scheduled&&(l.scheduled=c.scheduled),c.due&&(l.due=c.due),Qq(r,i,l),Kh(l),{updatedTask:l,targetDate:e,dateStr:i,newSkipped:o,dateModified:t}}function vxe({frontmatter:r,skippedField:e,completeField:t,dateModifiedField:n,scheduledField:i,dueField:a,googleCalendarExceptionOriginalScheduledField:s,googleCalendarMovedOriginalDatesField:o,plan:l}){r[e]||(r[e]=[]),r[e]=l.updatedTask.skipped_instances||[],r[t]||(r[t]=[]),r[t]=l.updatedTask.complete_instances||[],l.updatedTask.scheduled&&(r[i]=l.updatedTask.scheduled),l.updatedTask.due&&(r[a]=l.updatedTask.due),cR(r,s,l.updatedTask.googleCalendarExceptionOriginalScheduled),cR(r,o,l.updatedTask.googleCalendarMovedOriginalDates),r[n]=l.dateModified}function cR(r,e,t){if(t==null||Array.isArray(t)&&t.length===0){delete r[e];return}r[e]=t}var bxe=y(()=>{yv();Ne();iR()});function Txe(r,e){return{uniqueAdditions:Array.from(new Set(r)),uniqueRemovals:Array.from(new Set(e))}}function kxe({blockedTask:r,blockingTaskPath:e,action:t,rawEntry:n,useFrontmatterMarkdownLinks:i,resolveDependencyPath:a,formatDependencyLink:s}){var u;let o=Array.isArray(r.blockedBy)?r.blockedBy.map(p=>ts(p)).filter(p=>!!p):[];if(o.length===0&&t==="remove")return null;let l=!1,c=!1,d=[];for(let p of o){if(a(r.path,p)===e&&(c=!0,t==="remove")){l=!0;continue}d.push(p)}if(t==="add"&&!c){let p=n?ts(n):null,m={uid:s(r.path,e,i),reltype:(u=p==null?void 0:p.reltype)!=null?u:es};p!=null&&p.gap&&(m.gap=p.gap),d.push(m),l=!0}return l?d:null}function aW(r){return r===null?null:{blockedBy:r.length>0?r:void 0}}var wxe=y(()=>{ko()});var zi,xr,dR,Sxe=y(()=>{Ur();QV();zi=require("obsidian");JN();Ct();ko();jn();Ne();Kq();LEe();ls();HEe();qEe();JEe();exe();ixe();lxe();mxe();bxe();iR();wxe();eW();G();xr=I({tag:"Services/TaskService"}),dR=class{constructor(e){this.plugin=e;this.taskCreationService=new rR({runtime:this.plugin,webhookNotifier:this.webhookNotifier,applyTaskCreationDefaults:t=>Promise.resolve(VEe(t,this.plugin.settings)),applyTemplate:t=>this.applyTemplate(t),processFolderTemplate:(t,n,i)=>this.processFolderTemplate(t,n,i),sanitizeTitleForFilename:ZEe,sanitizeTitleForStorage:QEe}),this.taskUpdateService=new sR({runtime:this.plugin,webhookNotifier:this.webhookNotifier,autoArchiveService:this.autoArchiveService,updateCompletedDateInFrontmatter:(t,n,i)=>this.updateCompletedDateInFrontmatter(t,n,i)})}hasGoogleCalendarLinks(e){return!!(e.googleCalendarEventId||e.googleCalendarExceptionEventId)}createArchiveCalendarDeletionTask(e,t){return{...t,googleCalendarEventId:e.googleCalendarEventId,googleCalendarExceptionEventId:e.googleCalendarExceptionEventId,googleCalendarExceptionOriginalScheduled:e.googleCalendarExceptionOriginalScheduled,googleCalendarMovedOriginalDates:e.googleCalendarMovedOriginalDates?[...e.googleCalendarMovedOriginalDates]:void 0}}clearGoogleCalendarMetadata(e){e.googleCalendarEventId=void 0,e.googleCalendarExceptionEventId=void 0,e.googleCalendarExceptionOriginalScheduled=void 0,e.googleCalendarMovedOriginalDates=void 0}writeOptionalFrontmatterField(e,t,n){if(n==null||Array.isArray(n)&&n.length===0){delete e[t];return}e[t]=n}async deleteArchivedTaskFromCalendar(e){return!this.plugin.taskCalendarSyncService||await this.plugin.taskCalendarSyncService.deleteTaskFromCalendar(e)?!0:(xr.warn("Failed to delete archived task from Google Calendar during archive:",{category:"provider",operation:"delete-archived-task-google-calendar-archive",details:{taskPath:e.path,eventId:e.googleCalendarEventId}}),!1)}translate(e,t){return this.plugin.i18n.translate(e,t)}setWebhookNotifier(e){this.webhookNotifier=e,this.taskCreationService.setWebhookNotifier(e),this.taskUpdateService.setWebhookNotifier(e)}setAutoArchiveService(e){this.autoArchiveService=e,this.taskUpdateService.setAutoArchiveService(e)}normalizeStatusValue(e){return typeof e=="boolean"?e?"true":"false":typeof e=="string"?e:typeof e=="number"?String(e):""}getCompletionDateForTask(e){return e.occurrence_date||fv()}processFolderTemplate(e,t,n=new Date){let i=t?{title:t.title,priority:t.priority,status:t.status,contexts:t.contexts,projects:t.projects,due:t.due,scheduled:t.scheduled}:void 0;return eR(e,{date:n,taskData:i,extractProjectBasename:a=>this.extractProjectBasename(a),extractProjectFilePath:a=>this.extractProjectFilePath(a)})}async createTask(e,t={}){return this.taskCreationService.createTask(e,t)}async applyTemplate(e){var n,i,a,s;let t=this.plugin.settings.taskCreationDefaults;if(!t.useBodyTemplate||!((n=t.bodyTemplate)!=null&&n.trim()))return{frontmatter:{},body:((i=e.details)==null?void 0:i.trim())||""};try{let o=(0,zi.normalizePath)(t.bodyTemplate.trim());o.endsWith(".md")||(o+=".md");let l=this.plugin.app.vault.getAbstractFileByPath(o);if(l instanceof zi.TFile){let c=await this.plugin.app.vault.read(l),d={title:e.title||"",priority:e.priority||"",status:e.status||"",contexts:Array.isArray(e.contexts)?e.contexts:[],tags:Array.isArray(e.tags)?e.tags:[],timeEstimate:e.timeEstimate||0,dueDate:e.due||"",scheduledDate:e.scheduled||"",details:e.details||"",parentNote:e.parentNote||""};return QN(c,d)}else return xr.warn(`Task body template not found: ${o}`,{category:"persistence",operation:"task-body-template-not-found"}),Ee(this.plugin.emitter,this.translate("services.task.notices.templateNotFound",{path:o})),{frontmatter:{},body:((a=e.details)==null?void 0:a.trim())||""}}catch(o){return xr.error("Error reading task body template:",{category:"persistence",operation:"reading-task-body-template",error:o}),Ee(this.plugin.emitter,this.translate("services.task.notices.templateReadError",{template:t.bodyTemplate})),{frontmatter:{},body:((s=e.details)==null?void 0:s.trim())||""}}}async toggleStatus(e){try{let n=this.plugin.statusManager.isCompletedStatus(e.status)?this.plugin.settings.defaultTaskStatus:this.plugin.statusManager.getCompletedStatuses()[0]||"done";return await this.updateProperty(e,"status",n)}catch(t){let n=t instanceof Error?t.message:String(t);throw xr.error("Error toggling task status:",{category:"persistence",operation:"toggling-task-status",details:{stack:t instanceof Error?t.stack:void 0,taskPath:e.path,currentStatus:e.status},error:n}),new Error(`Failed to toggle task status: ${n}`)}}async updateProperty(e,t,n,i={}){try{let a=this.plugin.app.vault.getAbstractFileByPath(e.path);if(!(a instanceof zi.TFile))throw new Error(`Cannot find task file: ${e.path}`);let s=await this.plugin.cacheManager.getTaskInfo(e.path)||e,o=rxe({freshTask:s,property:t,value:n,currentTimestamp:Ye(),currentDateString:this.getCompletionDateForTask(s),normalizeStatusValue:l=>this.normalizeStatusValue(l),isCompletedStatus:l=>this.plugin.statusManager.isCompletedStatus(l)});return t==="scheduled"&&nR(s,o.normalizedValue,o.updatedTask),(t==="recurrence"||t==="recurrence_anchor")&&Kh(o.updatedTask),await this.plugin.app.fileManager.processFrontMatter(a,l=>{let c=txe(this.plugin.fieldMapper,t),d=this.plugin.fieldMapper.toUserField("dateModified"),u=this.plugin.fieldMapper.toUserField("completedDate");nxe({frontmatter:l,property:t,fieldName:c,rawValue:n,normalizedValue:o.normalizedValue,dateModified:o.dateModified,dateModifiedField:d,completedDateField:u,isRecurring:!!s.recurrence,normalizeStatusValue:p=>this.normalizeStatusValue(p),isCompletedStatus:p=>this.plugin.statusManager.isCompletedStatus(p),currentDateString:this.getCompletionDateForTask(s)}),this.writeOptionalFrontmatterField(l,this.plugin.fieldMapper.toUserField("googleCalendarExceptionOriginalScheduled"),o.updatedTask.googleCalendarExceptionOriginalScheduled),this.writeOptionalFrontmatterField(l,this.plugin.fieldMapper.toUserField("googleCalendarMovedOriginalDates"),o.updatedTask.googleCalendarMovedOriginalDates)}),await this.applyPropertyChangeSideEffects(a,s,o.updatedTask,t,s[t],o.normalizedValue),await this.reconcileMaterializedOccurrenceStatusChange(s,o.updatedTask,t,s[t],o.normalizedValue),o.updatedTask}catch(a){let s=a instanceof Error?a.message:String(a);throw xr.error("Error updating task property:",{category:"persistence",operation:"updating-task-property",details:{stack:a instanceof Error?a.stack:void 0,taskPath:e.path,property:t,value:n},error:s}),new Error(`Failed to update task property: ${s}`)}}async applyPropertyChangeSideEffects(e,t,n,i,a,s){await XEe({cacheManager:this.plugin.cacheManager,emitter:this.plugin.emitter,statusManager:this.plugin.statusManager,taskCalendarSyncService:this.plugin.taskCalendarSyncService,webhookNotifier:this.webhookNotifier,autoArchiveService:this.autoArchiveService,normalizeStatusValue:o=>this.normalizeStatusValue(o)},{file:e,originalTask:t,updatedTask:n,property:i,oldValue:a,newValue:s})}async materializeOccurrence(e,t,n={}){let i=await this.plugin.cacheManager.getTaskInfo(e.path)||e;if(!i.recurrence)throw new Error("Task is not recurring");let a=await this.plugin.cacheManager.getAllTasks(),s=rSe({parentTask:i,targetDate:t,currentTimestamp:Ye(),existingOccurrences:a,parentLink:this.buildOccurrenceParentReference(i),defaultStatus:this.plugin.settings.defaultTaskStatus,defaultPriority:this.plugin.settings.defaultTaskPriority,overrides:n});if(!s.created&&s.existingOccurrence)return s.existingOccurrence;let o={...s.occurrenceTask,creationContext:"api"},{taskInfo:l}=await this.createTask(o,{applyDefaults:!1});return l}async findMaterializedOccurrence(e,t){let n=await this.plugin.cacheManager.getTaskInfo(e.path)||e;if(!n.recurrence)return;let i=typeof t=="string"?t.slice(0,10):ce(t),a=await this.plugin.cacheManager.getAllTasks();return ZV(a,n,i,this.buildOccurrenceParentReference(n))}async getMaterializedOccurrenceParent(e){let t=await this.plugin.cacheManager.getTaskInfo(e.path)||e;return this.resolveOccurrenceParentTask(t)}async skipMaterializedOccurrence(e,t=this.getDefaultSkippedOccurrenceStatus()){let n=await this.plugin.cacheManager.getTaskInfo(e.path)||e,i=await this.resolveOccurrenceParentTask(n);if(!i)throw new Error("Cannot resolve occurrence parent");let a=aSe({occurrenceTask:n,parentTask:i,skippedStatus:t,currentTimestamp:Ye(),maintainDueDateOffsetInRecurring:this.plugin.settings.maintainDueDateOffsetInRecurring}),s=await this.persistTaskInfoUpdates(n,a.occurrenceUpdates,"skip-materialized-occurrence"),o=await this.persistTaskInfoUpdates(i,a.parentUpdates,"reconcile-skipped-materialized-occurrence-parent");if(a.materializeNextDate)try{await this.materializeOccurrence(o,a.materializeNextDate)}catch(l){xr.warn("Failed to materialize next occurrence after skip:",{category:"persistence",operation:"materialize-next-occurrence-after-skip",details:{parentPath:o.path,nextDate:a.materializeNextDate},error:l})}return s}async unskipMaterializedOccurrence(e){let t=await this.plugin.cacheManager.getTaskInfo(e.path)||e,n=await this.resolveOccurrenceParentTask(t);if(!n)throw new Error("Cannot resolve occurrence parent");let i=sSe({occurrenceTask:t,parentTask:n,activeStatus:this.plugin.settings.defaultTaskStatus,currentTimestamp:Ye()}),a=await this.persistTaskInfoUpdates(t,i.occurrenceUpdates,"unskip-materialized-occurrence");return await this.persistTaskInfoUpdates(n,i.parentUpdates,"reconcile-unskipped-materialized-occurrence-parent"),a}getDefaultSkippedOccurrenceStatus(){var e;return(e=this.plugin.settings.customStatuses.find(t=>t.isSkipped))==null?void 0:e.value}async reconcileMaterializedOccurrenceStatusChange(e,t,n,i,a){if(n!=="status"||!Qx(t))return;let s=this.plugin.statusManager.isCompletedStatus(this.normalizeStatusValue(i)),o=this.plugin.statusManager.isCompletedStatus(this.normalizeStatusValue(a));if(s===o)return;let l=await this.resolveOccurrenceParentTask(t);if(!l){xr.warn("Could not resolve materialized occurrence parent:",{category:"persistence",operation:"resolve-materialized-occurrence-parent",details:{taskPath:t.path,parent:t.recurrence_parent}});return}let c=Ye(),d=o?nSe({occurrenceTask:t,parentTask:l,completedStatus:this.normalizeStatusValue(a),currentTimestamp:c,maintainDueDateOffsetInRecurring:this.plugin.settings.maintainDueDateOffsetInRecurring}):iSe({occurrenceTask:e,parentTask:l,activeStatus:this.normalizeStatusValue(a),currentTimestamp:c}),u=await this.persistTaskInfoUpdates(l,d.parentUpdates,"reconcile-materialized-occurrence-parent");if(o&&this.webhookNotifier)try{await this.webhookNotifier.triggerWebhook("recurring.instance.completed",{task:u,occurrence:t,date:d.targetDate})}catch(p){xr.warn("Failed to trigger materialized occurrence webhook:",{category:"provider",operation:"trigger-materialized-occurrence-webhook",error:p})}if(o&&d.materializeNextDate)try{await this.materializeOccurrence(u,d.materializeNextDate)}catch(p){xr.warn("Failed to materialize next occurrence after completion:",{category:"persistence",operation:"materialize-next-occurrence-after-completion",details:{parentPath:u.path,nextDate:d.materializeNextDate},error:p})}}async resolveOccurrenceParentTask(e){var a,s;if(!e.recurrence_parent)return null;let t=jt(e.recurrence_parent),n=new Set([t]);t&&!t.endsWith(".md")&&n.add(`${t}.md`);for(let o of n){let l=await this.plugin.cacheManager.getTaskInfo(o);if(l)return l}let i=(s=(a=this.plugin.app.metadataCache).getFirstLinkpathDest)==null?void 0:s.call(a,t,e.path);return i instanceof zi.TFile?await this.plugin.cacheManager.getTaskInfo(i.path):null}buildOccurrenceParentReference(e){let t=this.plugin.app.vault.getAbstractFileByPath(e.path);return t instanceof zi.TFile?js(this.plugin.app,t,"",void 0,void 0,this.plugin.settings.useFrontmatterMarkdownLinks):`[[${e.path.replace(/\.md$/i,"")}]]`}applyModelTaskUpdatesToFrontmatter(e,t){let n=oSe(t,this.plugin.fieldMapper.getMapping());for(let i of n)i.op==="delete"?delete e[i.field]:e[i.field]=i.value}async persistTaskInfoUpdates(e,t,n){var s;if(Object.keys(t).length===0)return e;let i=this.plugin.app.vault.getAbstractFileByPath(e.path);if(!(i instanceof zi.TFile))throw new Error(`Cannot find task file: ${e.path}`);let a={...e,...t};await this.plugin.app.fileManager.processFrontMatter(i,o=>{this.applyModelTaskUpdatesToFrontmatter(o,t)});try{this.plugin.cacheManager.waitForFreshTaskData&&await this.plugin.cacheManager.waitForFreshTaskData(i),this.plugin.cacheManager.updateTaskInfoInCache(e.path,a)}catch(o){xr.error("Error updating cache for model task updates:",{category:"stale-data",operation:"persist-model-task-updates-cache",details:{taskPath:e.path,sourceOperation:n},error:o})}return this.plugin.emitter.trigger(nt,{path:e.path,originalTask:e,updatedTask:a}),(s=this.plugin.taskCalendarSyncService)!=null&&s.isEnabled()&&this.plugin.taskCalendarSyncService.updateTaskInCalendar(a,e).catch(o=>{xr.warn("Failed to sync model task update to Google Calendar:",{category:"provider",operation:"sync-model-task-update-google-calendar",details:{taskPath:e.path,sourceOperation:n},error:o})}),a}async toggleArchive(e){var u,p;let t=this.plugin.app.vault.getAbstractFileByPath(e.path);if(!(t instanceof zi.TFile))throw new Error(`Cannot find task file: ${e.path}`);let n=this.plugin.fieldMapper.getMapping().archiveTag,i=axe(e,n,Ye()),{updatedTask:a,isCurrentlyArchived:s,dateModified:o}=i;await this.plugin.app.fileManager.processFrontMatter(t,m=>{let f=this.plugin.fieldMapper.toUserField("dateModified");sxe({frontmatter:m,archiveTag:n,isCurrentlyArchived:s,dateModified:o,dateModifiedField:f})});let l=t,c=oxe({isCurrentlyArchived:s,moveArchivedTasks:this.plugin.settings.moveArchivedTasks,archiveFolderTemplate:this.plugin.settings.archiveFolder,tasksFolderTemplate:this.plugin.settings.tasksFolder,fileName:t.name,taskData:{title:a.title||"",priority:a.priority,status:a.status,contexts:a.contexts,projects:a.projects},processFolderTemplate:(m,f)=>this.processFolderTemplate(m,f)});if(c)try{if(await Ap(this.plugin.app.vault,c.destinationFolder),this.plugin.app.vault.getAbstractFileByPath(c.newPath))throw new Error(`A file named "${t.name}" already exists in the ${c.destinationKind} folder "${c.destinationFolder}". Cannot move task to avoid overwriting existing file.`);await this.plugin.app.fileManager.renameFile(t,c.newPath);let f=this.plugin.app.vault.getAbstractFileByPath(c.newPath);if(!(f instanceof zi.TFile))throw new Error(`Failed to resolve moved task file: ${c.newPath}`);l=f,a.path=c.newPath,this.plugin.cacheManager.clearCacheEntry(e.path)}catch(m){let f=m instanceof Error?m.message:String(m),h=c.operation;xr.error(`Error moving ${h} task:`,{category:"persistence",operation:"moving",details:{value:f}}),Ee(this.plugin.emitter,this.translate("services.task.notices.moveTaskFailed",{operation:h,error:f}))}let d=!0;if((u=this.plugin.taskCalendarSyncService)!=null&&u.isEnabled()&&a.archived&&this.hasGoogleCalendarLinks(e)){let m=this.createArchiveCalendarDeletionTask(e,a);d=await this.deleteArchivedTaskFromCalendar(m),d&&this.clearGoogleCalendarMetadata(a)}try{l instanceof zi.TFile&&this.plugin.cacheManager.waitForFreshTaskData&&await this.plugin.cacheManager.waitForFreshTaskData(l),this.plugin.cacheManager.updateTaskInfoInCache(a.path,a)}catch(m){xr.error("Error updating cache for archived task:",{category:"stale-data",operation:"updating-cache-archived-task",error:m})}if(this.plugin.emitter.trigger(nt,{path:a.path,originalTask:e,updatedTask:a}),this.webhookNotifier)try{a.archived?await this.webhookNotifier.triggerWebhook("task.archived",{task:a}):await this.webhookNotifier.triggerWebhook("task.unarchived",{task:a})}catch(m){xr.warn("Failed to trigger webhook for task archive/unarchive:",{category:"provider",operation:"trigger-webhook-task-archive-unarchive",error:m})}return(p=this.plugin.taskCalendarSyncService)!=null&&p.isEnabled()&&(a.archived?!d&&this.hasGoogleCalendarLinks(a)&&xr.warn("Archived task still has Google Calendar links and will need retry cleanup:",{category:"provider",operation:"archived-task-still-has-google-calendar-links-and-will-need-retry-cleanup",details:{value:a.path}}):this.plugin.taskCalendarSyncService.updateTaskInCalendar(a,e).catch(m=>{xr.warn("Failed to sync unarchived task to Google Calendar:",{category:"provider",operation:"sync-unarchived-task-google-calendar",error:m})})),a}async startTimeTracking(e){var o;let t=this.plugin.app.vault.getAbstractFileByPath(e.path);if(!(t instanceof zi.TFile))throw new Error(`Cannot find task file: ${e.path}`);if(this.plugin.getActiveTimeSession(e))throw new Error("Time tracking is already active for this task");let i=rW(e,Ye(),new Date().toISOString()),{updatedTask:a,newEntry:s}=i;await this.plugin.app.fileManager.processFrontMatter(t,l=>{let c=this.plugin.fieldMapper.toUserField("timeEntries"),d=this.plugin.fieldMapper.toUserField("dateModified");dxe({frontmatter:l,timeEntriesField:c,dateModifiedField:d,newEntry:s,dateModified:i.dateModified})});try{this.plugin.cacheManager.waitForFreshTaskData&&await this.plugin.cacheManager.waitForFreshTaskData(t),this.plugin.cacheManager.updateTaskInfoInCache(e.path,a)}catch(l){xr.error("Error updating cache for time tracking start:",{category:"stale-data",operation:"updating-cache-time-tracking-start",error:l})}if(this.plugin.emitter.trigger(nt,{path:e.path,originalTask:e,updatedTask:a}),this.webhookNotifier)try{await this.webhookNotifier.triggerWebhook("time.started",{task:a,session:(o=a.timeEntries)==null?void 0:o[a.timeEntries.length-1]})}catch(l){xr.warn("Failed to trigger webhook for time tracking start:",{category:"provider",operation:"trigger-webhook-time-tracking-start",error:l})}return a}async stopTimeTracking(e){var s;let t=this.plugin.app.vault.getAbstractFileByPath(e.path);if(!(t instanceof zi.TFile))throw new Error(`Cannot find task file: ${e.path}`);let n=this.plugin.getActiveTimeSession(e);if(!n)throw new Error("No active time tracking session for this task");let i=nW(e,n,Ye(),new Date().toISOString()),{updatedTask:a}=i;await this.plugin.app.fileManager.processFrontMatter(t,o=>{let l=this.plugin.fieldMapper.toUserField("timeEntries"),c=this.plugin.fieldMapper.toUserField("dateModified");pxe({frontmatter:o,timeEntriesField:l,dateModifiedField:c,activeSession:n,stopTimestamp:i.stopTimestamp,dateModified:i.dateModified})});try{this.plugin.cacheManager.waitForFreshTaskData&&await this.plugin.cacheManager.waitForFreshTaskData(t),this.plugin.cacheManager.updateTaskInfoInCache(e.path,a)}catch(o){xr.error("Error updating cache for time tracking stop:",{category:"stale-data",operation:"updating-cache-time-tracking-stop",error:o})}if(this.plugin.emitter.trigger(nt,{path:e.path,originalTask:e,updatedTask:a}),this.webhookNotifier)try{await this.webhookNotifier.triggerWebhook("time.stopped",{task:a,session:(s=a.timeEntries)==null?void 0:s[a.timeEntries.length-1]})}catch(o){xr.warn("Failed to trigger webhook for time tracking stop:",{category:"provider",operation:"trigger-webhook-time-tracking-stop",error:o})}return a}async updateTask(e,t){return this.taskUpdateService.updateTask(e,t)}async updateBlockingRelationships(e,t,n,i={}){let{uniqueAdditions:a,uniqueRemovals:s}=Txe(t,n);for(let o of s){let l=await this.plugin.cacheManager.getTaskInfo(o);if(!l)continue;let c=aW(this.computeBlockedByUpdate(l,e.path,"remove"));c&&await this.updateTask(l,c)}for(let o of a){let l=await this.plugin.cacheManager.getTaskInfo(o);if(!l)continue;let c=aW(this.computeBlockedByUpdate(l,e.path,"add",i[o]));c&&await this.updateTask(l,c)}}computeBlockedByUpdate(e,t,n,i){return kxe({blockedTask:e,blockingTaskPath:t,action:n,rawEntry:i,useFrontmatterMarkdownLinks:this.plugin.settings.useFrontmatterMarkdownLinks,resolveDependencyPath:(a,s)=>{var o,l;return(l=(o=wl(this.plugin.app,a,s))==null?void 0:o.path)!=null?l:null},formatDependencyLink:(a,s,o)=>To(this.plugin.app,a,s,o)})}async deleteTask(e){try{let t=this.plugin.app.vault.getAbstractFileByPath(e.path);if(!(t instanceof zi.TFile))throw new Error(`Cannot find task file: ${e.path}`);if(this.plugin.taskCalendarSyncService&&this.hasGoogleCalendarLinks(e))try{await this.plugin.taskCalendarSyncService.deleteTaskFromCalendarByPath(e.path,e.googleCalendarEventId,e.googleCalendarExceptionEventId)}catch(n){xr.warn("Failed to delete task from Google Calendar:",{category:"provider",operation:"delete-task-google-calendar",error:n})}if(await this.plugin.app.fileManager.trashFile(t),this.plugin.cacheManager.clearCacheEntry(e.path),this.plugin.emitter.trigger(Ja,{path:e.path,deletedTask:e}),this.webhookNotifier)try{await this.webhookNotifier.triggerWebhook("task.deleted",{task:e})}catch(n){xr.warn("Failed to trigger webhook for task deletion:",{category:"provider",operation:"trigger-webhook-task-deletion",error:n})}}catch(t){let n=t instanceof Error?t.message:String(t);throw xr.error("Error deleting task:",{category:"persistence",operation:"deleting-task",details:{stack:t instanceof Error?t.stack:void 0,taskPath:e.path},error:n}),new Error(`Failed to delete task: ${n}`)}}async resolveRecurringTaskActionDate(e,t){if(t)return t;let n=await this.plugin.cacheManager.getTaskInfo(e.path)||e;return this.getRecurringTaskActionDate(n)}getRecurringTaskActionDate(e,t){return fxe(e,t)}async toggleRecurringTaskComplete(e,t){var d;let n=this.plugin.app.vault.getAbstractFileByPath(e.path);if(!(n instanceof zi.TFile))throw new Error(`Cannot find task file: ${e.path}`);let i=await this.plugin.cacheManager.getTaskInfo(e.path)||e;if(!i.recurrence)throw new Error("Task is not recurring");let a=hxe({freshTask:i,targetDate:this.getRecurringTaskActionDate(i,t),currentTimestamp:Ye(),maintainDueDateOffsetInRecurring:this.plugin.settings.maintainDueDateOffsetInRecurring}),{updatedTask:s,dateStr:o,newComplete:l,targetDate:c}=a;if(await this.plugin.app.fileManager.processFrontMatter(n,u=>{let p=this.plugin.fieldMapper.toUserField("completeInstances"),m=this.plugin.fieldMapper.toUserField("skippedInstances"),f=this.plugin.fieldMapper.toUserField("dateModified"),h=this.plugin.fieldMapper.toUserField("scheduled"),g=this.plugin.fieldMapper.toUserField("due"),v=this.plugin.fieldMapper.toUserField("recurrence"),k=this.plugin.fieldMapper.toUserField("googleCalendarExceptionOriginalScheduled"),b=this.plugin.fieldMapper.toUserField("googleCalendarMovedOriginalDates");gxe({frontmatter:u,completeInstancesField:p,skippedInstancesField:m,dateModifiedField:f,scheduledField:h,dueField:g,recurrenceField:v,googleCalendarExceptionOriginalScheduledField:k,googleCalendarMovedOriginalDatesField:b,plan:a})}),l&&this.plugin.settings.resetCheckboxesOnRecurrence){let u=await this.plugin.app.vault.read(n),{frontmatter:p,body:m}=Np(u),{content:f,changed:h}=$pe(m);if(h){let g=p!==null?`--- +${p} +--- + +`:"",v=f.trimEnd(),k=v.length>0?`${g}${v} +`:g;await this.plugin.app.vault.modify(n,k),s.details=f.replace(/\r\n/g,` +`).trimEnd()}}try{if(this.plugin.cacheManager.waitForFreshTaskData){let u={complete_instances:s.complete_instances};s.scheduled!==i.scheduled&&(u.scheduled=s.scheduled),s.due!==i.due&&(u.due=s.due),await this.plugin.cacheManager.waitForFreshTaskData(n)}this.plugin.cacheManager.updateTaskInfoInCache(i.path,s)}catch(u){xr.error("Error updating cache for recurring task:",{category:"stale-data",operation:"updating-cache-recurring-task",error:u})}if(this.plugin.emitter.trigger(nt,{path:i.path,originalTask:i,updatedTask:s}),l&&this.webhookNotifier)try{await this.webhookNotifier.triggerWebhook("recurring.instance.completed",{task:s,date:o,targetDate:c})}catch(u){xr.error("Error triggering recurring task completion webhook:",{category:"provider",operation:"triggering-recurring-task-completion-webhook",error:u})}return(d=this.plugin.taskCalendarSyncService)!=null&&d.isEnabled()&&this.plugin.taskCalendarSyncService.updateTaskInCalendar(s,i).catch(u=>{xr.warn("Failed to sync recurring task update to Google Calendar:",{category:"provider",operation:"sync-recurring-task-update-google-calendar",error:u})}),s}async toggleRecurringTaskSkipped(e,t){var d;let n=this.plugin.app.vault.getAbstractFileByPath(e.path);if(!(n instanceof zi.TFile))throw new Error(`Cannot find task file: ${e.path}`);let i=await this.plugin.cacheManager.getTaskInfo(e.path)||e;if(!i.recurrence)throw new Error("Task is not recurring");let a=yxe({freshTask:i,targetDate:this.getRecurringTaskActionDate(i,t),currentTimestamp:Ye(),maintainDueDateOffsetInRecurring:this.plugin.settings.maintainDueDateOffsetInRecurring}),{updatedTask:s,dateStr:o,newSkipped:l,targetDate:c}=a;await this.plugin.app.fileManager.processFrontMatter(n,u=>{let p=this.plugin.fieldMapper.toUserField("skippedInstances"),m=this.plugin.fieldMapper.toUserField("completeInstances"),f=this.plugin.fieldMapper.toUserField("dateModified"),h=this.plugin.fieldMapper.toUserField("scheduled"),g=this.plugin.fieldMapper.toUserField("due"),v=this.plugin.fieldMapper.toUserField("googleCalendarExceptionOriginalScheduled"),k=this.plugin.fieldMapper.toUserField("googleCalendarMovedOriginalDates");vxe({frontmatter:u,skippedField:p,completeField:m,dateModifiedField:f,scheduledField:h,dueField:g,googleCalendarExceptionOriginalScheduledField:v,googleCalendarMovedOriginalDatesField:k,plan:a})});try{this.plugin.cacheManager.waitForFreshTaskData&&await this.plugin.cacheManager.waitForFreshTaskData(n),this.plugin.cacheManager.updateTaskInfoInCache(i.path,s)}catch(u){xr.error("Error updating cache for skipped recurring task:",{category:"stale-data",operation:"updating-cache-skipped-recurring-task",error:u})}if(this.plugin.emitter.trigger(nt,{path:i.path,originalTask:i,updatedTask:s}),l&&this.webhookNotifier)try{await this.webhookNotifier.triggerWebhook("recurring.instance.skipped",{task:s,date:o,targetDate:c})}catch(u){xr.error("Error triggering recurring task skip webhook:",{category:"provider",operation:"triggering-recurring-task-skip-webhook",error:u})}return(d=this.plugin.taskCalendarSyncService)!=null&&d.isEnabled()&&this.plugin.taskCalendarSyncService.updateTaskInCalendar(s,i).catch(u=>{xr.warn("Failed to sync recurring task skip to Google Calendar:",{category:"provider",operation:"sync-recurring-task-skip-google-calendar",error:u})}),s}async deleteTimeEntry(e,t){let n=this.plugin.app.vault.getAbstractFileByPath(e.path);if(!(n instanceof zi.TFile))throw new Error(`Cannot find task file: ${e.path}`);let i=iW(e,t,Ye()),{updatedTask:a}=i;await this.plugin.app.fileManager.processFrontMatter(n,s=>{let o=this.plugin.fieldMapper.toUserField("timeEntries"),l=this.plugin.fieldMapper.toUserField("dateModified");uxe({frontmatter:s,timeEntriesField:o,dateModifiedField:l,timeEntryIndex:i.timeEntryIndex,dateModified:i.dateModified})});try{this.plugin.cacheManager.waitForFreshTaskData&&await this.plugin.cacheManager.waitForFreshTaskData(n),this.plugin.cacheManager.updateTaskInfoInCache(e.path,a)}catch(s){xr.error("Error updating cache for time entry deletion:",{category:"stale-data",operation:"updating-cache-time-entry-deletion",error:s})}return this.plugin.emitter.trigger(nt,{path:e.path,originalTask:e,updatedTask:a}),a}updateCompletedDateInFrontmatter(e,t,n){if(n)return;let i=this.plugin.fieldMapper.toUserField("completedDate");tW(e,t,n,i,a=>this.plugin.statusManager.isCompletedStatus(a),fv())}extractProjectBasename(e){return kl(e,this.plugin.app)}extractProjectFilePath(e){var i,a,s;let t=jt(e),n=(a=(i=this.plugin.app.metadataCache).getFirstLinkpathDest)==null?void 0:a.call(i,t,"");return((s=n==null?void 0:n.path)!=null?s:t).replace(/\.md$/i,"")}}});var Wc,DC=y(()=>{Wc=class{constructor(){this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{let n=this.events[e];if(!n)return;let i=n.filter(a=>a!==t);i.length>0?this.events[e]=i:delete this.events[e]}}emit(e,...t){this.events[e]&&this.events[e].forEach(n=>{n(...t)})}removeAllListeners(e){e?delete this.events[e]:this.events={}}}});var uR,Exe=y(()=>{gr();uR=class{constructor(e){this.deps=e;this.indexQueryCache=new Map;this.cacheTimers=new Map;this.cacheTimeout=3e4}getIndexOptimizedTaskPaths(e){let t=this.analyzeQueryOptimizationSafety(e);if(!t.canOptimize)return this.deps.cacheManager.getAllTaskPaths();if(t.strategy==="intersect"){let n=this.getPathsForIndexableCondition(t.conditions[0]);for(let i=1;ii.type==="condition"&&this.isIndexableCondition(i)).length===t.length}hasIndexableConditionInOrGroup(e,t){return this.checkNodeForOrWithIndexable(e,t)}checkNodeForOrWithIndexable(e,t){if(e.type==="condition")return!1;if(e.type==="group"){if(e.conjunction==="or"&&e.children.some(i=>i.type==="condition"&&t.includes(i)))return!0;for(let n of e.children)if(this.checkNodeForOrWithIndexable(n,t))return!0}return!1}findIndexableConditions(e){let t=[];if(e.type==="condition")this.isIndexableCondition(e)&&t.push(e);else if(e.type==="group")for(let n of e.children)t.push(...this.findIndexableConditions(n));return t}isIndexableCondition(e){let{property:t,operator:n,value:i}=e;return!!(t==="status"&&n==="is"&&i||t==="due"&&(n==="is"||n==="is-before"||n==="is-after")&&i||t==="scheduled"&&(n==="is"||n==="is-before"||n==="is-after")&&i)}getCachedIndexResult(e,t){let n=this.indexQueryCache.get(e);if(n)return new Set(n);let i=t();this.indexQueryCache.set(e,new Set(i));let a=this.cacheTimers.get(e);a&&this.deps.timer.clearTimeout(a);let s=this.deps.timer.setTimeout(()=>{this.indexQueryCache.delete(e),this.cacheTimers.delete(e)},this.cacheTimeout);return this.cacheTimers.set(e,s),i}getPathsForIndexableCondition(e){let{property:t,operator:n,value:i}=e,a=`${t}:${n}:${Z(i)}`;return this.getCachedIndexResult(a,()=>t==="status"&&n==="is"&&i&&typeof i=="string"?new Set(this.deps.cacheManager.getTaskPathsByStatus(i)):(t==="due"||t==="scheduled")&&n==="is"&&i&&typeof i=="string"?new Set(this.deps.cacheManager.getTasksForDate(i)):(t==="due"||t==="scheduled")&&(n==="is-before"||n==="is-after")&&i&&typeof i=="string"?this.getTaskPathsForDateRange(t,n,i):this.deps.cacheManager.getAllTaskPaths())}getTaskPathsForDateRange(e,t,n){return this.deps.cacheManager.getAllTaskPaths()}intersectPathSets(e,t){let n=new Set;for(let i of e)t.has(i)&&n.add(i);return n}}});function Cxe(r){return r.id||r.key}function pR(r,e){return r==null?1:e==null?-1:r.localeCompare(e)}function mR(r){if(typeof r=="boolean")return r;if(r==null)return;let e=Z(r).trim().toLowerCase();if(e==="true")return!0;if(e==="false")return!1}function Dxe(r){if(typeof r=="number")return String(r);if(typeof r!="string")return;let e=r.match(/^(\d+(?:\.\d+)?)/);return e?e[1]:void 0}function xxe(r){if(Array.isArray(r))return eT(r)[0];if(typeof r=="string")return r.trim().length===0?"":eT(r)[0]}function eT(r){let e=[],t=a=>{if(!a)return;let s=String(a).trim();if(!s)return;let o=s.match(/^\[\[([^|\]]+)(?:\|([^\]]+))?\]\]$/);if(o){let l=o[1]||"",d=o[2]||l.split("#")[0].split("/").pop()||l;d&&e.push(d),e.push(s);return}e.push(s)};if(Array.isArray(r))for(let a of r)t(Z(a));else if(typeof r=="string"){let a=zs(r);for(let s of a)t(s)}else r!=null&&t(Z(r));let n=new Set,i=[];for(let a of e)n.has(a)||(n.add(a),i.push(a));return i}function Qh(r,e){return r==null?void 0:r.find(t=>Cxe(t)===e)}function Pxe(r,e){return r==null?void 0:r.find(t=>Cxe(t)===e||t.key===e)}function Mxe(r,e){switch(r.type){case"boolean":return typeof e=="boolean"?e:Z(e).toLowerCase()==="true";case"number":return typeof e=="number"?e:e!=null?parseFloat(Z(e)):void 0;case"list":return eT(e);case"date":case"text":default:return e!=null?Z(e):void 0}}function _xe(r,e,t){switch(r.type){case"number":{let n=typeof e=="number"?e:e!=null?parseFloat(Z(e)):NaN,i=typeof t=="number"?t:t!=null?parseFloat(Z(t)):NaN,a=!isNaN(n),s=!isNaN(i);return a&&s?n-i:a&&!s?-1:!a&&s?1:0}case"boolean":{let n=mR(e),i=mR(t);return n===i?0:n===!0?-1:i===!0?1:n===!1?-1:i===!1?1:0}case"date":{let n=e?Date.parse(Z(e)):NaN,i=t?Date.parse(Z(t)):NaN,a=!isNaN(n),s=!isNaN(i);return a&&s?n-i:a&&!s?-1:!a&&s?1:0}case"list":{let n=xxe(e),i=xxe(t);return(n==null||n==="")&&(i==null||i==="")?0:n==null||n===""?1:i==null||i===""?-1:n.localeCompare(i)}case"text":default:{let n=e!=null?Z(e):"",i=t!=null?Z(t):"";return n.localeCompare(i)}}}function Axe(r,e,t=yat){var n;if(!r)return t.unknownField;try{switch(r.type){case"boolean":{let i=mR(e);return i==null?t.noValue:i?"true":"false"}case"number":return(n=Dxe(e))!=null?n:typeof e=="string"?t.nonNumeric:t.noValue;case"date":return e?Z(e):t.noDate;case"list":{if(Array.isArray(e)){let i=eT(e);return i.length>0?i[0]:t.empty}if(typeof e=="string"){if(e.trim().length===0)return t.empty;let i=eT(e);return i.length>0?i[0]:t.empty}return t.noValue}case"text":default:return e?Z(e).trim()||t.empty:t.noValue}}catch(i){return t.error}}function Ixe(r,e,t){if(!r)return[t];switch(r.type){case"boolean":{let n=mR(e);return n==null?[t]:[n?"true":"false"]}case"number":{let n=Dxe(e);return n?[n]:[t]}case"date":return e?[Z(e)]:[t];case"list":{let n=eT(e).filter(i=>!/^\[\[/.test(i));return n.length>0?n:[t]}case"text":default:{let n=Z(e).trim();return n?[n]:[t]}}}function Nxe(r,e){let t=[...r];if(!e)return t.sort();switch(e.type){case"number":return t.sort((n,i)=>{let a=parseFloat(n),s=parseFloat(i),o=!isNaN(a),l=!isNaN(s);return o&&l?s-a:o&&!l?-1:!o&&l?1:pR(n,i)});case"boolean":return t.sort((n,i)=>n==="true"&&i==="false"?-1:n==="false"&&i==="true"?1:pR(n,i));case"date":return t.sort((n,i)=>{let a=Date.parse(n),s=Date.parse(i),o=!isNaN(a),l=!isNaN(s);return o&&l?a-s:o&&!l?-1:!o&&l?1:pR(n,i)});case"text":case"list":default:return t.sort(pR)}}var yat,PC=y(()=>{Op();gr();yat={unknownField:"unknown-field",noValue:"no-value",noDate:"no-date",empty:"empty",nonNumeric:"non-numeric",error:"error"}});function Rxe(r,e){return!!r&&ke(r)!==e}function tT(r,e,t){return!!r&&iu(r,e,t)}function Oxe(r,e){if(r.recurrence)return U_(r,zt(e.dateStr));if(r.due&&ke(r.due)===e.dateStr||r.scheduled&&ke(r.scheduled)===e.dateStr)return!0;if(e.includeOverdue&&e.isViewingToday){let t=e.isCompletedStatus(r.status);if(Rxe(r.due,e.dateStr)&&tT(r.due,t,e.hideCompletedFromOverdue)||Rxe(r.scheduled,e.dateStr)&&tT(r.scheduled,t,e.hideCompletedFromOverdue))return!0}return!1}function Lxe(r,e){let t=e.isCompletedStatus(r.status);return r.recurrence&&!(t&&e.hideCompletedFromOverdue)&&vat(r,e.todayString)?!0:tT(r.due,t,e.hideCompletedFromOverdue)||tT(r.scheduled,t,e.hideCompletedFromOverdue)}function vat(r,e=zn()){if(!r.recurrence)return!1;let t=zt(e),n=new Date(t);n.setUTCDate(n.getUTCDate()-1);let i=bat(r,t);if(i>n)return!1;let a=new Set(r.complete_instances||[]),s=new Set(r.skipped_instances||[]);return Tv(r,i,n).some(l=>{let c=ce(l);return ci?ke(i):"").filter(i=>i.length>0).map(i=>zt(i)).reduce((i,a)=>a{Ct();Ne()});function fR(r,e,t,n){return r.type==="condition"?kat(r,e,t,n):r.type==="group"?Tat(r,e,t,n):!0}function Tat(r,e,t,n){if(r.children.length===0)return!0;let i=r.children.filter(a=>a.type==="condition"?yr.isFilterNodeComplete(a):!0);return i.length===0?!0:r.conjunction==="and"?i.every(a=>fR(a,e,t,n)):r.conjunction==="or"?i.some(a=>fR(a,e,t,n)):!0}function kat(r,e,t,n){let{property:i,operator:a,value:s}=r;if(typeof i=="string"&&i.startsWith("user:"))return wat(r,e,t);let o=yr.getTaskPropertyValue(e,i);if(i==="hasSubtasks"&&t.projectSubtasksService&&(o=t.projectSubtasksService.isTaskUsedAsProjectSync(e.path)),i==="status.isCompleted"){let l=bv(e,n||new Date,t.getCompletedStatuses()[0]);o=t.isCompletedStatus(l)}return i==="projects"&&(a==="contains"||a==="does-not-contain")?Sat(o,a,s,t.app):yr.applyOperator(o,a,s,r.id,i)}function wat(r,e,t){let{property:n,operator:i,value:a}=r,s=n.slice(5),o=Qh(t.userFields,s),l=o?Mxe(o,t.getUserFieldRawValue(e,o.key)):void 0;if((o==null?void 0:o.type)==="list"&&(i==="contains"||i==="does-not-contain")){let d=Array.isArray(l)?l:l!=null?[String(l)]:[],p=(Array.isArray(a)?a:[String(a!=null?a:"")]).some(m=>typeof m=="string"&&d.some(f=>typeof f=="string"&&f.toLowerCase().includes(m.toLowerCase())));return i==="contains"?p:!p}let c=(o==null?void 0:o.type)==="date"?"due":n;return yr.applyOperator(l,i,a,r.id,c)}function Sat(r,e,t,n){if(!Array.isArray(r)||typeof t!="string")return!1;let i=$xe(t,n);if(!i)return!1;let a=r.some(s=>{if(!s||typeof s!="string")return!1;let o=$xe(s,n);return o?o===i?!0:Eat(s,t,n):!1});return e==="contains"?a:!a}function $xe(r,e){if(!r||typeof r!="string")return null;let t=kl(r,e);return t||null}function Eat(r,e,t){if(!t)return!1;let n=zxe(r),i=zxe(e);if(!n||!i)return!1;let a=t.metadataCache.getFirstLinkpathDest(n,""),s=t.metadataCache.getFirstLinkpathDest(i,"");return a&&s?a.path===s.path:!1}function zxe(r){return!r||typeof r!="string"?null:r.startsWith("[[")&&r.endsWith("]]")?r.slice(2,-2):r}var jxe=y(()=>{cu();Ct();jn();PC()});function lW(r,e,t,n){var a;if(e==="none")return new Map([["all",r]]);let i=new Map;for(let s of r){let o=Pat(s,e,t,n);for(let l of o)i.has(l)||i.set(l,[]),(a=i.get(l))==null||a.push(s)}return xat(i,e,t)}function xat(r,e,t){let n=new Map,i=Mat(r,e,t);for(let a of i){let s=r.get(a);s&&n.set(a,s)}return n}function Cat(r,e,t){var s;let n=t||new Date;n.setHours(0,0,0,0);let i=e.isCompletedStatus(r.status),a=(s=e.hideCompletedFromOverdue)!=null?s:!0;if(r.recurrence){if(U_(r,n)){let o=P(n,"yyyy-MM-dd");return sW(o,e,i,a)}return r.due?sW(r.due,e,i,a):bm("none",e)}return r.due?sW(r.due,e,i,a):bm("none",e)}function Dat(r,e){var t;return r.scheduled?Aat(r.scheduled,e,e.isCompletedStatus(r.status),(t=e.hideCompletedFromOverdue)!=null?t:!0):Jh("none",e)}function Pat(r,e,t,n){if(e==="project"){let i=Tl(r.projects||[]);return i.length===0?[Uxe(t)]:i.map(a=>t.resolveProjectToAbsolutePath(a))}if(e==="tags"){let i=r.tags||[];return i.length>0?i:[Hxe(t)]}if(typeof e=="string"&&e.startsWith("user:"))return[_at(r,e,t)];switch(e){case"status":return[r.status||"no-status"];case"priority":return[r.priority||"unknown"];case"context":return[r.contexts&&r.contexts.length>0?r.contexts[0]:"none"];case"due":return[Cat(r,t,n)];case"scheduled":return[Dat(r,t)];case"completedDate":return[Iat(r,t)];default:return["unknown"]}}function Mat(r,e,t){if(typeof e=="string"&&e.startsWith("user:")){let n=Nat(Array.from(r.keys()),e,t);return t.currentSortKey===e&&t.currentSortDirection==="desc"&&n.reverse(),n}switch(e){case"priority":return Array.from(r.keys()).sort((n,i)=>t.getPriorityWeight(i)-t.getPriorityWeight(n));case"status":return Array.from(r.keys()).sort((n,i)=>t.getStatusOrder(n)-t.getStatusOrder(i));case"due":{let n=["overdue","today","tomorrow","nextSevenDays","later","none"],i=new Map(n.map((a,s)=>[bm(a,t),s]));return Array.from(r.keys()).sort((a,s)=>{var c,d;let o=(c=i.get(a))!=null?c:n.length,l=(d=i.get(s))!=null?d:n.length;return o-l})}case"scheduled":{let n=["past","today","tomorrow","nextSevenDays","later","none"],i=new Map(n.map((a,s)=>[Jh(a,t),s]));return Array.from(r.keys()).sort((a,s)=>{var c,d;let o=(c=i.get(a))!=null?c:n.length,l=(d=i.get(s))!=null?d:n.length;return o-l})}case"project":return Array.from(r.keys()).sort((n,i)=>Bxe(n,i,Uxe(t),t.getLocale()));case"tags":return Array.from(r.keys()).sort((n,i)=>Bxe(n,i,Hxe(t),t.getLocale()));case"completedDate":return Array.from(r.keys()).sort((n,i)=>{if(n==="Not completed")return 1;if(i==="Not completed")return-1;if(n==="Invalid date")return 1;if(i==="Invalid date")return-1;if(n==null||i==null){if(n==null)return 1;if(i==null)return-1}return i.localeCompare(n)});default:return Array.from(r.keys()).sort((n,i)=>n==null?1:i==null?-1:n.localeCompare(i,t.getLocale()))}}function _at(r,e,t){let n=e.slice(5),i=Qh(t.userFields||[],n),a=i?t.getUserFieldRawValue(r,i.key):void 0;return Axe(i,a)}function sW(r,e,t,n){let i=zn();if(iu(r,t,n))return bm("overdue",e);let a=ke(r);if(bo(a,i))return bm("today",e);try{let s=new Date;s.setDate(s.getDate()+1);let o=P(s,"yyyy-MM-dd");if(bo(a,o))return bm("tomorrow",e);let l=new Date;l.setDate(l.getDate()+7);let c=P(l,"yyyy-MM-dd");return th(a,c)||bo(a,c)?bm("nextSevenDays",e):bm("later",e)}catch(s){return oW.error(`Error categorizing date ${r}:`,{category:"validation",operation:"categorizing-date",error:s}),MC(e)}}function Aat(r,e,t,n){let i=zn();if(iu(r,t,n))return Jh("past",e);let a=ke(r);if(bo(a,i))return Jh("today",e);try{let s=new Date;s.setDate(s.getDate()+1);let o=P(s,"yyyy-MM-dd");if(bo(a,o))return Jh("tomorrow",e);let l=new Date;l.setDate(l.getDate()+7);let c=P(l,"yyyy-MM-dd");return th(a,c)||bo(a,c)?Jh("nextSevenDays",e):Jh("later",e)}catch(s){return oW.error(`Error categorizing scheduled date ${r}:`,{category:"validation",operation:"categorizing-scheduled-date",error:s}),MC(e)}}function Iat(r,e){if(!r.completedDate)return"Not completed";try{return P(Ls(r.completedDate),"yyyy-MM-dd")}catch(t){return oW.error(`Error formatting completed date ${r.completedDate}:`,{category:"validation",operation:"formatting-completed-date",error:t}),MC(e)}}function Nat(r,e,t){let n=e.slice(5),i=Qh(t.userFields||[],n);return Nxe(r,i)}function Bxe(r,e,t,n){return r===t?1:e===t?-1:r==null?1:e==null?-1:r.localeCompare(e,n)}function bm(r,e){switch(r){case"overdue":return e.translate("services.filter.groupLabels.due.overdue","Overdue");case"today":return e.translate("services.filter.groupLabels.due.today","Today");case"tomorrow":return e.translate("services.filter.groupLabels.due.tomorrow","Tomorrow");case"nextSevenDays":return e.translate("services.filter.groupLabels.due.nextSevenDays","Next seven days");case"later":return e.translate("services.filter.groupLabels.due.later","Later");case"none":return e.translate("services.filter.groupLabels.due.none","No due date");case"invalid":default:return MC(e)}}function Jh(r,e){switch(r){case"past":return e.translate("services.filter.groupLabels.scheduled.past","Past scheduled");case"today":return e.translate("services.filter.groupLabels.scheduled.today","Today");case"tomorrow":return e.translate("services.filter.groupLabels.scheduled.tomorrow","Tomorrow");case"nextSevenDays":return e.translate("services.filter.groupLabels.scheduled.nextSevenDays","Next seven days");case"later":return e.translate("services.filter.groupLabels.scheduled.later","Later");case"none":return e.translate("services.filter.groupLabels.scheduled.none","No scheduled date");case"invalid":default:return MC(e)}}function Uxe(r){return r.translate("services.filter.groupLabels.noProject","No project")}function Hxe(r){return r.translate("services.filter.groupLabels.noTags","No tags")}function MC(r){return r.translate("services.filter.groupLabels.invalidDate","Invalid date")}var oW,Vxe=y(()=>{Br();Ne();Ct();PC();G();oW=I({tag:"Services/FilterService/FilterTaskGrouping"})});function qxe(r,e,t,n){return r.sort((i,a)=>{let s=Oat(i,a,e,n);return s!==0?t==="desc"?-s:s:jat(i,a,e,n)})}function rT(r,e){if(!r&&!e)return 0;if(!r)return 1;if(!e)return-1;try{return nu(r,e)?-1:nu(e,r)?1:0}catch(t){return Rat.error("Error comparing dates time-aware:",{category:"validation",operation:"comparing-dates-time-aware",details:{dateA:r,dateB:e},error:t}),r.localeCompare(e)}}function Oat(r,e,t,n){if(typeof t=="string"&&t.startsWith("user:"))return Bat(r,e,t,n);switch(t){case"due":return rT(r.due,e.due);case"scheduled":return rT(r.scheduled,e.scheduled);case"priority":return Fat(r.priority,e.priority,n);case"status":return $at(r.status,e.status,n);case"title":return r.title.localeCompare(e.title);case"dateCreated":return rT(r.dateCreated,e.dateCreated);case"completedDate":return rT(r.completedDate,e.completedDate);case"tags":return zat(r.tags,e.tags);default:return 0}}function Lat(r,e,t){let n=t.getPriorityWeight(r);return t.getPriorityWeight(e)-n}function Fat(r,e,t){let n=t.getPriorityWeight(r),i=t.getPriorityWeight(e);return n-i}function $at(r,e,t){return t.getStatusOrder(r)-t.getStatusOrder(e)}function zat(r,e){let t=r&&r.length>0?r:[],n=e&&e.length>0?e:[];return t.length===0&&n.length===0?0:t.length===0?1:n.length===0?-1:t[0].toLowerCase().localeCompare(n[0].toLowerCase())}function jat(r,e,t,n){let a=["due","scheduled","priority","title"].filter(s=>s!==t);for(let s of a){let o=0;switch(s){case"scheduled":o=rT(r.scheduled,e.scheduled);break;case"due":o=rT(r.due,e.due);break;case"priority":o=Lat(r.priority,e.priority,n);break;case"title":o=r.title.localeCompare(e.title);break}if(o!==0)return o}return 0}function Bat(r,e,t,n){let i=t.slice(5),a=Qh(n.userFields||[],i);return a?_xe(a,n.getUserFieldRawValue(r,a.key),n.getUserFieldRawValue(e,a.key)):0}var Rat,Wxe=y(()=>{Ne();PC();G();Rat=I({tag:"Services/FilterService/FilterTaskSorting"})});function Yxe(r){return{statuses:r.statuses,priorities:r.priorities,contexts:r.contexts,projects:r.projects,tags:r.tags,folders:Uat(r.taskPaths,r.rootFolderLabel),userProperties:Hat(r.userFields||[])}}function Uat(r,e){let t=new Set;for(let n of r){let i=n.lastIndexOf("/");i>0?t.add(n.substring(0,i)):i===-1&&t.add("")}return Array.from(t).sort().map(n=>n===""?e:n)}function Hat(r){let e=[];for(let t of r)!t||!t.key||!t.displayName||e.push({id:`user:${t.id||t.key}`,label:t.displayName,category:Vat(t.type),supportedOperators:Wat(t.type),valueInputType:qat(t.type)});return e}function Vat(r){switch(r){case"boolean":return"boolean";case"number":return"numeric";case"date":return"date";case"list":case"text":default:return"text"}}function qat(r){switch(r){case"number":return"number";case"date":return"date";case"boolean":return"none";case"list":case"text":default:return"text"}}function Wat(r){switch(r){case"number":return["is","is-not","is-greater-than","is-less-than","is-greater-than-or-equal","is-less-than-or-equal","is-empty","is-not-empty"];case"date":return["is","is-not","is-before","is-after","is-on-or-before","is-on-or-after","is-empty","is-not-empty"];case"boolean":return["is-checked","is-not-checked"];case"list":return["contains","does-not-contain","is-empty","is-not-empty"];case"text":default:return["is","is-not","contains","does-not-contain","is-empty","is-not-empty"]}}var Gxe=y(()=>{});function cW(r){return{type:"group",id:r(),conjunction:"and",children:[],sortKey:"due",sortDirection:"asc",groupKey:"none"}}function Zxe(r,e,t,n){let i=Gat(r);if(Yat(i,e),!t){let a=Kxe[e];i.children.push({type:"condition",id:n(),...a})}return i}function Qxe(r,e){let t=cW(e);return{...t,...r,type:"group",id:r.id||t.id,conjunction:r.conjunction||t.conjunction,children:r.children||t.children,sortKey:r.sortKey||t.sortKey,sortDirection:r.sortDirection||t.sortDirection,groupKey:r.groupKey||t.groupKey}}function Yat(r,e){let t=Kxe[e].property;r.children=r.children.filter(n=>n.type==="condition"?n.property!==t:!0)}function Gat(r){return JSON.parse(JSON.stringify(r))}var Kxe,Jxe=y(()=>{Kxe={showCompleted:{property:"status.isCompleted",operator:"is-not-checked",value:null},showArchived:{property:"archived",operator:"is-not-checked",value:null},showRecurrent:{property:"recurrence",operator:"is-empty",value:null}}});var Xxe={};et(Xxe,{HierarchicalGroupingService:()=>uW});function dW(r){return r==null?"":typeof r=="string"?r.trim():typeof r=="number"||typeof r=="boolean"?String(r):""}var uW,eCe=y(()=>{uW=class{constructor(e){this.resolveUserFieldValues=e}group(e,t,n,i="asc",a=[]){let s=new Map,o=(c,d)=>{var p,m,f,h,g,v,k,b;if(!d||d==="none")return["all"];let u=w=>{let S=w.map(dW).filter(x=>x!=="");return S.length?S:[]};if(d.startsWith("user:")){let w=d.slice(5);if(this.resolveUserFieldValues){let C=this.resolveUserFieldValues(c,w)||[],D=u(C);return D.length?D:[`No ${w}`]}let S=(p=c.customProperties)==null?void 0:p[w];if(Array.isArray(S)){let C=u(S);return C.length?C:[`No ${w}`]}let x=dW(S);return x!==""?[x]:[`No ${w}`]}switch(d){case"status":return[((m=c.status)!=null?m:"").trim()||"No Status"];case"priority":return[((f=c.priority)!=null?f:"").trim()||"No Priority"];case"context":{let w=u((h=c.contexts)!=null?h:[]);return w.length?w:["No Context"]}case"project":{let w=u((g=c.projects)!=null?g:[]).map(C=>{let D=C.match(/^\[\[([^|\]]+)(?:\|([^\]]+))?\]\]$/);if(D){let _=D[1]||"";return D[2]||_.split("#")[0].split("/").pop()||_||C}return C}),S=[],x=new Set;for(let C of w)x.has(C)||(x.add(C),S.push(C));return S.length?S:["No Project"]}case"tags":{let w=u((v=c.tags)!=null?v:[]);return w.length?w:["No Tag"]}case"due":{let w=((k=c.due)!=null?k:"").trim();return w?[w.split("T")[0]]:["No Due Date"]}case"scheduled":{let w=((b=c.scheduled)!=null?b:"").trim();return w?[w.split("T")[0]]:["No Scheduled Date"]}default:{let S=c[d];if(Array.isArray(S)){let C=u(S);return C.length?C:[`No ${d}`]}let x=dW(S);return x!==""?[x]:[`No ${d}`]}}};for(let c of e){let d=o(c,t),u=o(c,n);for(let p of d){s.has(p)||s.set(p,new Map);let m=s.get(p);for(let f of u)m.has(f)||m.set(f,[]),m.get(f).push(c)}}let l=new Map;for(let[c,d]of s){let u=this.sortSubgroups(d,n,i,a);l.set(c,u)}return l}sortSubgroups(e,t,n,i){let a=Array.from(e.keys()),s=this.sortSubgroupKeys(a,t,n,i),o=new Map;for(let l of s)o.set(l,e.get(l));return o}sortSubgroupKeys(e,t,n,i){let a=o=>/^No\s/i.test(o);if(typeof t=="string"&&t.startsWith("user:")){let o=t.slice(5),l=i.find(u=>(u.id||u.key)===o),c=(u,p)=>{if(a(u)&&!a(p))return-1;if(!a(u)&&a(p))return 1;if((l==null?void 0:l.type)==="number"){let m=parseFloat(u),f=parseFloat(p),h=isNaN(m)?Number.POSITIVE_INFINITY:m,g=isNaN(f)?Number.POSITIVE_INFINITY:f;if(h!==g)return h-g}else if((l==null?void 0:l.type)==="boolean"){let m=u==="true"?0:u==="false"?1:2,f=p==="true"?0:p==="false"?1:2;if(m!==f)return m-f}else if((l==null?void 0:l.type)==="date"){let m=Date.parse(u),f=Date.parse(p),h=isNaN(m)?Number.POSITIVE_INFINITY:m,g=isNaN(f)?Number.POSITIVE_INFINITY:f;if(h!==g)return h-g}return u.localeCompare(p)},d=e.slice().sort(c);return n==="desc"?d.reverse():d}let s=e.slice().sort((o,l)=>a(o)&&!a(l)?-1:!a(o)&&a(l)?1:o.localeCompare(l));return n==="desc"?s.reverse():s}}});var tCe,hR,nT,gR,rCe=y(()=>{tCe=require("obsidian");jn();DC();cu();Br();Ne();Exe();PC();Fxe();jxe();Vxe();Wxe();Gxe();Jxe();G();hR=I({tag:"Services/FilterService"}),nT=class nT extends Wc{constructor(t,n,i,a){super();this.runtime=a;this.filterOptionsCache=null;this.filterOptionsCacheTimestamp=0;this.filterOptionsCacheTTL=3e5;this.filterOptionsComputeCount=0;this.filterOptionsCacheHits=0;this.cacheManager=t,this.statusManager=n,this.priorityManager=i,this.queryPlanner=new uR({cacheManager:t,timer:{setTimeout:(s,o)=>window.setTimeout(s,o),clearTimeout:s=>window.clearTimeout(s)}}),nT.lastInstance=this}translate(t,n,i){var a;try{if((a=this.runtime)!=null&&a.i18n)return this.runtime.i18n.translate(t,i)}catch(s){hR.error("FilterService translation error:",{category:"internal",operation:"filterservice-translation",error:s})}return n}static translateStatic(t,n){let i=nT.lastInstance;return i?i.translate(t,n):n}getLocale(){var t,n,i;try{let a=(i=(n=(t=this.runtime)==null?void 0:t.i18n)==null?void 0:n.getCurrentLocale)==null?void 0:i.call(n);if(a)return a}catch(a){hR.error("FilterService locale error:",{category:"internal",operation:"filterservice-locale",error:a})}return"en"}getNoProjectLabel(){return this.translate("services.filter.groupLabels.noProject","No project")}async getGroupedTasks(t,n){try{yr.validateFilterNode(t,!1);let i=this.queryPlanner.getIndexOptimizedTaskPaths(t),s=(await this.pathsToTaskInfos(Array.from(i))).filter(l=>this.evaluateFilterNode(t,l,n)),o=this.sortTasks(s,t.sortKey||"due",t.sortDirection||"asc");return this.currentSortKey=t.sortKey||"due",this.currentSortDirection=t.sortDirection||"asc",lW(o,t.groupKey||"none",this.createTaskGroupingContext(),n)}catch(i){if(i instanceof Oi||i instanceof lu)return hR.error("Filter error:",{category:"internal",operation:"filter",details:{values:[i.message,{nodeId:i.nodeId,field:i.field}]}}),new Map;throw i}}async getHierarchicalGroupedTasks(t,n){var i,a;try{yr.validateFilterNode(t,!1);let s=this.queryPlanner.getIndexOptimizedTaskPaths(t),l=(await this.pathsToTaskInfos(Array.from(s))).filter(p=>this.evaluateFilterNode(t,p,n)),c=this.sortTasks(l,t.sortKey||"due",t.sortDirection||"asc");this.currentSortKey=t.sortKey||"due",this.currentSortDirection=t.sortDirection||"asc";let d=lW(c,t.groupKey||"none",this.createTaskGroupingContext(),n),u=t.subgroupKey;if(u&&u!=="none"&&t.groupKey&&t.groupKey!=="none"){let{HierarchicalGroupingService:p}=await Promise.resolve().then(()=>(eCe(),Xxe)),m=(k,b)=>{var D,_;let w=((_=(D=this.runtime)==null?void 0:D.settings)==null?void 0:_.userFields)||[],S=Pxe(w,b),x=`No ${(S==null?void 0:S.displayName)||(S==null?void 0:S.key)||b}`,C=S?this.getUserFieldRawValue(k,S.key):void 0;return Ixe(S,C,x)},h=new p(m).group(c,t.groupKey,u,this.currentSortDirection,((a=(i=this.runtime)==null?void 0:i.settings)==null?void 0:a.userFields)||[]),g=Array.from(d.keys()),v=new Map;for(let k of g){let b=h.get(k);b&&v.set(k,b)}for(let[k,b]of h)v.has(k)||v.set(k,b);return{groups:d,hierarchicalGroups:v}}return{groups:d}}catch(s){if(s instanceof Oi||s instanceof lu)return hR.error("Filter error (hierarchical):",{category:"internal",operation:"filter-hierarchical",details:{values:[s.message,{nodeId:s.nodeId}]}}),{groups:new Map};throw s}}getCacheStats(){return this.queryPlanner.getCacheStats()}async pathsToTaskInfos(t){let n=[];for(let a=0;athis.cacheManager.getCachedTaskInfo(l)));for(let l of o)l&&n.push(l)}return n}evaluateFilterNode(t,n,i){return fR(t,n,this.createPredicateEvaluationContext(),i)}createPredicateEvaluationContext(){var t,n,i,a;return{app:(t=this.runtime)==null?void 0:t.app,userFields:((i=(n=this.runtime)==null?void 0:n.settings)==null?void 0:i.userFields)||[],projectSubtasksService:(a=this.runtime)==null?void 0:a.projectSubtasksService,getUserFieldRawValue:(s,o)=>this.getUserFieldRawValue(s,o),getCompletedStatuses:()=>this.statusManager.getCompletedStatuses(),isCompletedStatus:s=>this.statusManager.isCompletedStatus(s)}}resolveProjectToAbsolutePath(t){var a;if(!t||typeof t!="string")return t||"";if(!((a=this.runtime)!=null&&a.app))return t;let n=this.parseLinkToPath(t),i=this.runtime.app.metadataCache.getFirstLinkpathDest(n,"");return i?i.path.replace(/\.md$/,""):n.replace(/\.md$/,"")}parseLinkToPath(t){return jt(t)}getPreferredProjectFormat(t){let n=this.getNoProjectLabel();return!t||t===n?t:t.includes("/")||t.endsWith(".md")?`[[${t}]]`:`[[${t}]]`}getOverdueTaskPaths(){return this.cacheManager.getOverdueTaskPaths()}sortTasks(t,n,i){return qxe(t,n,i,this.createTaskSortingContext())}createTaskGroupingContext(){var t,n,i,a;return{userFields:((n=(t=this.runtime)==null?void 0:t.settings)==null?void 0:n.userFields)||[],hideCompletedFromOverdue:(a=(i=this.runtime)==null?void 0:i.settings)==null?void 0:a.hideCompletedFromOverdue,currentSortKey:this.currentSortKey,currentSortDirection:this.currentSortDirection,isCompletedStatus:s=>this.statusManager.isCompletedStatus(s),getPriorityWeight:s=>this.priorityManager.getPriorityWeight(s),getStatusOrder:s=>this.statusManager.getStatusOrder(s),getUserFieldRawValue:(s,o)=>this.getUserFieldRawValue(s,o),resolveProjectToAbsolutePath:s=>this.resolveProjectToAbsolutePath(s),translate:(s,o,l)=>this.translate(s,o,l),getLocale:()=>this.getLocale()}}createTaskSortingContext(){var t,n;return{userFields:((n=(t=this.runtime)==null?void 0:t.settings)==null?void 0:n.userFields)||[],getPriorityWeight:i=>this.priorityManager.getPriorityWeight(i),getStatusOrder:i=>this.statusManager.getStatusOrder(i),getUserFieldRawValue:(i,a)=>this.getUserFieldRawValue(i,a)}}getUserFieldRawValue(t,n){var i;try{let a=this.cacheManager.getApp(),s=a.vault.getAbstractFileByPath(t.path),o=s instanceof tCe.TFile?(i=a.metadataCache.getFileCache(s))==null?void 0:i.frontmatter:void 0;return o?o[n]:void 0}catch(a){return}}async getFilterOptions(){var i,a;let t=Date.now();if(this.filterOptionsCache&&t-this.filterOptionsCacheTimestamp3e4&&this.invalidateFilterOptionsCache()}invalidateFilterOptionsCache(){this.filterOptionsCache&&(this.filterOptionsCache=null)}refreshFilterOptions(){this.invalidateFilterOptionsCache()}getFilterOptionsCacheStats(){let t=Date.now(),n=this.filterOptionsCache?t-this.filterOptionsCacheTimestamp:0,i=this.filterOptionsCache?Math.max(0,this.filterOptionsCacheTTL-n):0,a=this.filterOptionsCacheHits+this.filterOptionsComputeCount,s=a>0?(this.filterOptionsCacheHits/a*100).toFixed(1)+"%":"0%";return{cacheHits:this.filterOptionsCacheHits,computeCount:this.filterOptionsComputeCount,hitRate:s,isCurrentlyCached:!!this.filterOptionsCache,cacheAge:n,ttlRemaining:i}}createDefaultQuery(){return cW(()=>yr.generateId())}addQuickToggleCondition(t,n,i){return Zxe(t,n,i,()=>yr.generateId())}normalizeQuery(t){return Qxe(t,()=>yr.generateId())}initialize(){this.cacheManager.on("file-updated",()=>{this.queryPlanner.clearIndexQueryCache(),this.checkAndInvalidateFilterOptionsCache(),this.emit("data-changed")}),this.cacheManager.on("file-added",()=>{this.queryPlanner.clearIndexQueryCache(),this.checkAndInvalidateFilterOptionsCache(),this.emit("data-changed")}),this.cacheManager.on("file-deleted",()=>{this.queryPlanner.clearIndexQueryCache(),this.checkAndInvalidateFilterOptionsCache(),this.emit("data-changed")}),this.cacheManager.on("file-renamed",()=>{this.queryPlanner.clearIndexQueryCache(),this.checkAndInvalidateFilterOptionsCache(),this.emit("data-changed")}),this.cacheManager.on("indexes-built",()=>{this.queryPlanner.clearIndexQueryCache(),this.checkAndInvalidateFilterOptionsCache(),this.emit("data-changed")})}cleanup(){this.queryPlanner.clearIndexQueryCache(),this.invalidateFilterOptionsCache(),this.removeAllListeners()}static createDateRangeFromDates(t){if(t.length===0)throw new Error(nT.translateStatic("services.filter.errors.noDatesProvided","No dates provided"));let n=t[0],i=t[t.length-1];return{start:P(n,"yyyy-MM-dd"),end:P(i,"yyyy-MM-dd")}}static shouldIncludeOverdueForRange(t,n){if(!n)return!1;let a=P(new Date,"yyyy-MM-dd");return t.some(s=>P(s,"yyyy-MM-dd")===a)}async getTasksForDate(t,n,i=!1){var p,m,f;let a=ce(t),s=Jw(a),o=this.cacheManager.getAllTaskPaths(),c=(await this.pathsToTaskInfos(Array.from(o))).filter(h=>this.evaluateFilterNode(n,h)),d=(f=(m=(p=this.runtime)==null?void 0:p.settings)==null?void 0:m.hideCompletedFromOverdue)!=null?f:!0,u=c.filter(h=>Oxe(h,{dateStr:a,isViewingToday:s,includeOverdue:i,hideCompletedFromOverdue:d,isCompletedStatus:g=>this.statusManager.isCompletedStatus(g)}));return this.sortTasks(u,n.sortKey||"due",n.sortDirection||"asc")}async getOverdueTasks(t){var l,c,d;let n=this.cacheManager.getAllTaskPaths(),a=(await this.pathsToTaskInfos(Array.from(n))).filter(u=>this.evaluateFilterNode(t,u)),s=(d=(c=(l=this.runtime)==null?void 0:l.settings)==null?void 0:c.hideCompletedFromOverdue)!=null?d:!0,o=a.filter(u=>Lxe(u,{hideCompletedFromOverdue:s,isCompletedStatus:p=>this.statusManager.isCompletedStatus(p)}));return this.sortTasks(o,t.sortKey||"due",t.sortDirection||"asc")}async getAgendaDataWithOverdue(t,n,i=!1){let a=[];for(let o of t){let l=await this.getTasksForDate(o,n,!1);a.push({date:new Date(o),tasks:l})}let s=i?await this.getOverdueTasks(n):[];return{dailyData:a,overdueTasks:s}}async getAgendaData(t,n,i=!1){let a=[];for(let s of t){let o=await this.getTasksForDate(s,n,i&&zB(s));a.push({date:new Date(s),tasks:o})}return a}async getFlatAgendaData(t,n,i=!1){let a=await this.getAgendaData(t,n,i),s=[];for(let o of a)for(let l of o.tasks)s.push({...l,agendaDate:o.date});return s}};nT.lastInstance=null;gR=nT});var iT,pW=y(()=>{iT=class{constructor(e,t){this.cache=e;this.statusManager=t}getStats(e){let t={},n={},i=0,a=0,s=0,o=0,l=0,c=0,d=new Date().toISOString().split("T")[0];for(let u of e){t[u.status]=(t[u.status]||0)+1,n[u.priority]=(n[u.priority]||0)+1;let p=this.statusManager.isCompletedStatus(u.status);u.archived&&o++,p&&i++,!p&&!u.archived&&a++,u.due&&u.due0&&(l++,c+=u.totalTrackedTime||0)}return{total:e.length,statusCounts:t,priorityCounts:n,completed:i,active:a,overdue:s,archived:o,withTimeEntries:l,totalTrackedMinutes:c,totalTrackedHours:Math.round(c/60*100)/100}}async getAggregatedTimeEstimate(e){let t=this.cache.getAllTimeEstimates();if(t.size===0)return 0;let{start:n,end:i}=this.getDateRange(e),a=0;for(let[s,o]of t.entries()){let l=await this.cache.getTaskInfo(s);l&&this.isTaskInRange(l,n,i)&&(a+=o)}return a}isTaskInRange(e,t,n){let i=e.due||e.scheduled;if(!i)return!1;let a=new Date(i);return a>=t&&a<=n}getDateRange(e){if(typeof e!="string")return e;let t=new Date,n=new Date(t),i=new Date(t);switch(e){case"daily":n.setHours(0,0,0,0),i.setHours(23,59,59,999);break;case"weekly":{let a=t.getDay(),s=t.getDate()-a+(a===0?-6:1);n.setDate(s),n.setHours(0,0,0,0),i.setDate(n.getDate()+6),i.setHours(23,59,59,999);break}case"monthly":n.setDate(1),n.setHours(0,0,0,0),i.setMonth(n.getMonth()+1),i.setDate(0),i.setHours(23,59,59,999);break;case"yearly":n.setMonth(0,1),n.setHours(0,0,0,0),i.setFullYear(n.getFullYear()+1),i.setDate(0),i.setHours(23,59,59,999);break}return{start:n,end:i}}}});var Tm,yR,nCe=y(()=>{DC();cu();G();Tm=I({tag:"Services/ViewStateManager"}),yR=class extends Wc{constructor(t,n){super();this.filterState={};this.viewPreferences={};this.savedViews=[];this.storageKey="tasknotes-view-filter-state";this.preferencesStorageKey="tasknotes-view-preferences";this.savedViewsStorageKey="tasknotes-saved-views";this.app=t,this.plugin=n,this.loadFromStorage(),this.loadPreferencesFromStorage(),this.savedViews=[...this.plugin.settings.savedViews]}async initializeSavedViews(){await this.migrateAndLoadSavedViews()}getFilterState(t){let n=this.filterState[t];if(n){if(typeof n!="object"||n.type!=="group"||!Array.isArray(n.children)||typeof n.conjunction!="string"){Tm.warn(`ViewStateManager: Ignoring old format filter state for ${t}, will use default`,{category:"validation",operation:"viewstatemanager-ignoring-old-format-filter-state"}),delete this.filterState[t],this.saveToStorage();return}return yr.deepCloneFilterQuery(n)}}setFilterState(t,n){this.filterState[t]=yr.deepCloneFilterQuery(n),this.saveToStorage(),this.emit("filter-state-changed",{viewType:t,query:yr.deepCloneFilterQuery(n)})}clearFilterState(t){delete this.filterState[t],this.saveToStorage(),this.emit("filter-state-cleared",{viewType:t})}clearAllFilterStates(){this.filterState={},this.saveToStorage(),this.emit("all-filter-states-cleared")}getViewPreferences(t){return this.viewPreferences[t]}setViewPreferences(t,n){this.viewPreferences[t]={...n},this.savePreferencesToStorage(),this.emit("view-preferences-changed",{viewType:t,preferences:n})}clearViewPreferences(t){delete this.viewPreferences[t],this.savePreferencesToStorage(),this.emit("view-preferences-cleared",{viewType:t})}clearAllViewPreferences(){this.viewPreferences={},this.savePreferencesToStorage(),this.emit("all-view-preferences-cleared")}loadFromStorage(){try{let t=this.app.loadLocalStorage(this.storageKey);t&&typeof t=="string"&&(this.filterState=JSON.parse(t))}catch(t){Tm.warn("Failed to load view filter state from storage:",{category:"persistence",operation:"load-view-filter-state-storage",error:t}),this.filterState={}}}saveToStorage(){try{this.app.saveLocalStorage(this.storageKey,JSON.stringify(this.filterState))}catch(t){Tm.warn("Failed to save view filter state to storage:",{category:"persistence",operation:"save-view-filter-state-storage",error:t})}}loadPreferencesFromStorage(){try{let t=this.app.loadLocalStorage(this.preferencesStorageKey);t&&typeof t=="string"&&(this.viewPreferences=JSON.parse(t))}catch(t){Tm.warn("Failed to load view preferences from storage:",{category:"configuration",operation:"load-view-preferences-storage",error:t}),this.viewPreferences={}}}savePreferencesToStorage(){try{this.app.saveLocalStorage(this.preferencesStorageKey,JSON.stringify(this.viewPreferences))}catch(t){Tm.warn("Failed to save view preferences to storage:",{category:"configuration",operation:"save-view-preferences-storage",error:t})}}getAllFilterStates(){return{...this.filterState}}getSavedViews(){return this.savedViews.map(t=>({...t,query:yr.deepCloneFilterQuery(t.query),viewOptions:t.viewOptions?{...t.viewOptions}:void 0}))}saveView(t,n,i,a){let s={id:this.generateId(),name:t,query:yr.deepCloneFilterQuery(n),viewOptions:i?{...i}:void 0,visibleProperties:a?[...a]:void 0};return this.savedViews.push(s),this.saveSavedViewsToPluginData(),this.emit("saved-views-changed",this.getSavedViews()),s}updateView(t,n){let i=this.savedViews.findIndex(s=>s.id===t);if(i===-1)throw new Error(`Saved view with ID ${t} not found`);let a={...n};a.query&&(a.query=yr.deepCloneFilterQuery(a.query)),a.viewOptions&&(a.viewOptions={...a.viewOptions}),this.savedViews[i]={...this.savedViews[i],...a},this.saveSavedViewsToPluginData(),this.emit("saved-views-changed",this.getSavedViews())}deleteView(t){let n=this.savedViews.findIndex(i=>i.id===t);if(n===-1)throw new Error(`Saved view with ID ${t} not found`);this.savedViews.splice(n,1),this.saveSavedViewsToPluginData(),this.emit("saved-views-changed",this.getSavedViews())}getSavedView(t){let n=this.savedViews.find(i=>i.id===t);if(n)return{...n,query:yr.deepCloneFilterQuery(n.query),viewOptions:n.viewOptions?{...n.viewOptions}:void 0,visibleProperties:n.visibleProperties?[...n.visibleProperties]:void 0}}clearAllSavedViews(){this.savedViews=[],this.saveSavedViewsToPluginData(),this.emit("saved-views-changed",this.getSavedViews())}updateSavedViewProperties(t,n){let i=this.savedViews.find(a=>a.id===t);i&&(i.visibleProperties=n,this.saveSavedViewsToPluginData(),this.emit("saved-views-changed",this.getSavedViews()))}getSavedViewProperties(t){let n=this.savedViews.find(i=>i.id===t);return n==null?void 0:n.visibleProperties}reorderSavedViews(t,n){if(t<0||t>=this.savedViews.length||n<0||n>this.savedViews.length||t===n)return;n=Math.min(n,this.savedViews.length-1);let[i]=this.savedViews.splice(t,1);this.savedViews.splice(n,0,i),this.saveSavedViewsToPluginData(),this.emit("saved-views-changed",this.getSavedViews())}generateId(){return Date.now().toString(36)+Math.random().toString(36).slice(2,11)}async migrateAndLoadSavedViews(){try{this.savedViews=[...this.plugin.settings.savedViews];let t=this.app.loadLocalStorage(this.savedViewsStorageKey);if(t&&typeof t=="string"&&this.savedViews.length===0){let n=JSON.parse(t);this.savedViews=[...n],await this.saveSavedViewsToPluginData(),this.app.saveLocalStorage(this.savedViewsStorageKey,null)}}catch(t){Tm.warn("Failed to load/migrate saved views:",{category:"persistence",operation:"load-migrate-saved-views",error:t}),this.savedViews=[]}}async saveSavedViewsToPluginData(){try{this.plugin.settings.savedViews=[...this.savedViews],await this.plugin.saveSettings()}catch(t){Tm.warn("Failed to save saved views to plugin data:",{category:"persistence",operation:"save-saved-views-plugin-data",error:t})}}needsMigration(){let n=!!this.app.loadLocalStorage(this.savedViewsStorageKey),i=this.plugin.settings.savedViews&&this.plugin.settings.savedViews.length>0;return n&&!i}async performMigration(){try{this.clearAllFilterStates(),await this.migrateAndLoadSavedViews(),this.emit("migration-complete")}catch(t){Tm.error("Error during ViewStateManager migration:",{category:"configuration",operation:"viewstatemanager-migration",error:t}),this.savedViews=[],await this.saveSavedViewsToPluginData()}}cleanup(){this.removeAllListeners()}}});var iCe,mW,vR,aCe=y(()=>{iCe=require("obsidian");jn();G();mW=I({tag:"Services/ProjectSubtasksService"}),vR=class{constructor(e){this.cacheEventRefs=[];this.projectIndex=new Map;this.indexLastBuilt=0;this.INDEX_TTL=3e4;this.stats={indexBuilds:0,indexHits:0,indexMisses:0};this.plugin=e,this.registerCacheInvalidation()}registerCacheInvalidation(){var t;if(!((t=this.plugin.cacheManager)!=null&&t.on))return;let e=()=>this.invalidateIndex();this.cacheEventRefs=[this.plugin.cacheManager.on("file-updated",e),this.plugin.cacheManager.on("file-renamed",e),this.plugin.cacheManager.on("file-deleted",e)]}getFilesLinkingToProject(e){let t=this.plugin.app.metadataCache.resolvedLinks,n=[];for(let[i,a]of Object.entries(t))a&&a[e]>0&&n.push(i);return n}getUnresolvedProjectReferences(e){let n=this.plugin.app.metadataCache.unresolvedLinks[e];return n?Object.keys(n).filter(i=>!i.includes("#")&&!i.includes("|")):[]}async getTasksLinkedToProject(e){try{let t=this.getFilesLinkingToProject(e.path),n=[];for(let i of t){let a=await this.plugin.cacheManager.getTaskInfo(i);a&&await this.isLinkFromProjectsField(i,e.path)&&n.push(a)}return n}catch(t){return mW.error("Error getting tasks linked to project:",{category:"persistence",operation:"getting-tasks-linked-project",error:t}),[]}}async isTaskUsedAsProject(e){return this.isTaskUsedAsProjectSync(e)}async isLinkFromProjectsField(e,t){var n;try{let i=this.plugin.app.vault.getAbstractFileByPath(e);if(!(i instanceof iCe.TFile))return!1;let a=this.plugin.app.metadataCache.getFileCache(i),s=this.plugin.fieldMapper.toUserField("projects");if(!((n=a==null?void 0:a.frontmatter)!=null&&n[s]))return!1;let o=a.frontmatter[s];if(!Array.isArray(o))return!1;for(let l of o){if(!l||typeof l!="string")continue;let c=jt(l);if(c===l&&!l.startsWith("[["))continue;let d=this.plugin.app.metadataCache.getFirstLinkpathDest(c,e);if(d&&d.path===t)return!0}return!1}catch(i){return mW.error("Error checking if link is from projects field:",{category:"persistence",operation:"checking-if-link-projects-field",error:i}),!1}}isTaskUsedAsProjectSync(e){return this.ensureIndexBuilt(),this.projectIndex.has(e)?(this.stats.indexHits++,this.projectIndex.get(e)):(this.stats.indexMisses++,!1)}buildProjectIndex(){this.projectIndex.clear(),this.stats.indexBuilds++;try{let e=this.plugin.app.metadataCache.resolvedLinks,t=new Set;for(let[n,i]of Object.entries(e)){if(!i)continue;let a=this.plugin.app.metadataCache.getCache(n);if(!(a!=null&&a.frontmatter)||!this.plugin.cacheManager.isTaskFile(a.frontmatter))continue;let s=this.plugin.fieldMapper.toUserField("projects"),o=a.frontmatter[s];if(Array.isArray(o))for(let l of o){if(!l||typeof l!="string")continue;let c=jt(l);if(c===l&&!l.startsWith("[["))continue;let d=this.plugin.app.metadataCache.getFirstLinkpathDest(c,n);d&&t.add(d.path)}}for(let n of t)this.projectIndex.set(n,!0);this.indexLastBuilt=Date.now()}catch(e){mW.error("Error building project index:",{category:"persistence",operation:"building-project-index",error:e})}}ensureIndexBuilt(){Date.now()-this.indexLastBuilt>this.INDEX_TTL&&this.buildProjectIndex()}invalidateIndex(){this.projectIndex.clear(),this.indexLastBuilt=0}destroy(){for(let e of this.cacheEventRefs)this.plugin.cacheManager.offref(e);this.cacheEventRefs=[],this.invalidateIndex(),this.stats={indexBuilds:0,indexHits:0,indexMisses:0}}sortTasks(e){return e.sort((t,n)=>{let i=this.plugin.statusManager.isCompletedStatus(t.status),a=this.plugin.statusManager.isCompletedStatus(n.status);if(i!==a)return i?1:-1;let s=this.plugin.priorityManager.getPriorityWeight(t.priority),o=this.plugin.priorityManager.getPriorityWeight(n.priority);return s!==o?o-s:t.due&&n.due?new Date(t.due).getTime()-new Date(n.due).getTime():t.due?-1:n.due?1:t.title.localeCompare(n.title)})}}});var bR,sCe=y(()=>{bR=class{constructor(e){this.expandedProjects=new Set;this.collapsedDefaultExpandedProjects=new Set;this.plugin=e}isExpanded(e,t=!1){return t?!this.collapsedDefaultExpandedProjects.has(e):this.expandedProjects.has(e)}toggle(e,t=!1){return t?this.collapsedDefaultExpandedProjects.has(e)?(this.collapsedDefaultExpandedProjects.delete(e),!0):(this.collapsedDefaultExpandedProjects.add(e),this.expandedProjects.delete(e),!1):(this.collapsedDefaultExpandedProjects.delete(e),this.expandedProjects.has(e)?(this.expandedProjects.delete(e),!1):(this.expandedProjects.add(e),!0))}setExpanded(e,t,n=!1){if(n){t?this.collapsedDefaultExpandedProjects.delete(e):(this.collapsedDefaultExpandedProjects.add(e),this.expandedProjects.delete(e));return}this.collapsedDefaultExpandedProjects.delete(e),t?this.expandedProjects.add(e):this.expandedProjects.delete(e)}renamePath(e,t){e!==t&&(this.expandedProjects.delete(e)&&this.expandedProjects.add(t),this.collapsedDefaultExpandedProjects.delete(e)&&this.collapsedDefaultExpandedProjects.add(t))}getExpandedProjects(){return Array.from(this.expandedProjects)}clearAll(){this.expandedProjects.clear(),this.collapsedDefaultExpandedProjects.clear()}collapseAll(){this.clearAll()}}});var aT,TR,oCe=y(()=>{G();aT=I({tag:"Services/AutoArchiveService"}),TR=class{constructor(e){this.processorTimer=null;this.isRunning=!1;this.PROCESSOR_INTERVAL_MS=6e4;this.plugin=e}hasGoogleCalendarLink(e){return!!e.googleCalendarEventId}normalizeStatusValue(e){return typeof e=="boolean"?e?"true":"false":String(e)}getCalendarCleanupState(){let e=this.plugin.settings.googleCalendarExport;return!(e!=null&&e.enabled)||!(e!=null&&e.syncOnTaskDelete)?"skip":this.plugin.taskCalendarSyncService&&this.plugin.taskCalendarSyncService.isEnabled()?"ready":"retry"}async start(){this.stop(),this.isRunning=!0,await this.processQueue(),this.scheduleNextProcess()}stop(){this.isRunning=!1,this.processorTimer!==null&&(window.clearTimeout(this.processorTimer),this.processorTimer=null)}scheduleNextProcess(){this.isRunning&&(this.processorTimer=window.setTimeout(()=>{this.processorTimer=null,this.processQueue().catch(e=>{aT.error("Error processing auto-archive queue:",{category:"persistence",operation:"processing-auto-archive-queue",error:e})}).finally(()=>{this.isRunning&&this.scheduleNextProcess()})},this.PROCESSOR_INTERVAL_MS))}async scheduleAutoArchive(e,t){if(!t.autoArchive)return;if(e.recurrence){await this.cancelAutoArchive(e.path);return}let n=Date.now(),i=n+t.autoArchiveDelay*60*1e3,a={taskPath:e.path,statusChangeTimestamp:n,archiveAfterTimestamp:i,statusValue:t.value};await this.cancelAutoArchive(e.path);let s=await this.getQueue();s.push(a),await this.saveQueue(s)}async cancelAutoArchive(e){let t=await this.getQueue(),n=t.filter(i=>i.taskPath!==e);n.length!==t.length&&await this.saveQueue(n)}async processQueue(){let e=await this.getQueue();if(e.length===0)return;let t=Date.now(),n=[],i=[];for(let o of e)t>=o.archiveAfterTimestamp?n.push(o):i.push(o);if(n.length===0)return;let a=[];for(let o of n)try{await this.processItem(o)||a.push(o)}catch(l){aT.error(`Error processing auto-archive for ${o.taskPath}:`,{category:"persistence",operation:"processing-auto-archive",error:l}),a.push(o)}let s=[...a,...i];await this.saveQueue(s)}async processItem(e){let t=await this.plugin.cacheManager.getTaskByPath(e.taskPath);if(!t||this.normalizeStatusValue(t.status)!==this.normalizeStatusValue(e.statusValue))return!0;if(t.archived){if(this.hasGoogleCalendarLink(t)){let n=this.getCalendarCleanupState();if(n==="skip")return!0;if(n==="retry")return aT.warn(`Auto-archive Google cleanup deferred until calendar sync is ready for ${e.taskPath}`,{category:"provider",operation:"auto-archive-google-cleanup-deferred-until-calendar-sync-ready"}),!1;let i=await this.plugin.taskCalendarSyncService.deleteTaskFromCalendar(t);return i||aT.warn(`Auto-archive Google cleanup still pending for ${e.taskPath}`,{category:"provider",operation:"auto-archive-google-cleanup-still-pending"}),i}return!0}try{let n=await this.plugin.taskService.toggleArchive(t);if(n.archived&&this.hasGoogleCalendarLink(n)){e.taskPath=n.path;let i=this.getCalendarCleanupState();return i==="skip"?!0:(i==="retry"&&aT.warn(`Auto-archive Google cleanup deferred until calendar sync is ready for ${e.taskPath}`,{category:"provider",operation:"auto-archive-google-cleanup-deferred-until-calendar-sync-ready"}),!1)}return!0}catch(n){return aT.error(`Failed to archive task ${e.taskPath}:`,{category:"persistence",operation:"archive-task",error:n}),!1}}async getQueue(){let e=await this.plugin.loadData();return(e==null?void 0:e.autoArchiveQueue)||[]}async saveQueue(e){let t=await this.plugin.loadData()||{};t.autoArchiveQueue=e,await this.plugin.saveData(t)}async clearQueue(){await this.saveQueue([])}async getQueueStatus(){let e=await this.getQueue();return{count:e.length,items:e}}}});function km(r,e){for(var t in e)r[t]=e[t];return r}function gCe(r){var e=r.parentNode;e&&e.removeChild(r)}function M(r,e,t){var n,i,a,s={};for(a in e)a=="key"?n=e[a]:a=="ref"?i=e[a]:s[a]=e[a];if(arguments.length>2&&(s.children=arguments.length>3?xR.call(arguments,2):t),typeof r=="function"&&r.defaultProps!=null)for(a in r.defaultProps)s[a]===void 0&&(s[a]=r.defaultProps[a]);return kR(r,s,n,i,null)}function kR(r,e,t,n,i){var a={type:r,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:i==null?++pCe:i};return i==null&&je.vnode!=null&&je.vnode(a),a}function kn(){return{current:null}}function Yt(r){return r.children}function Zat(r,e,t,n,i){var a;for(a in t)a==="children"||a==="key"||a in e||SR(r,a,null,t[a],n);for(a in e)i&&typeof e[a]!="function"||a==="children"||a==="key"||a==="value"||a==="checked"||t[a]===e[a]||SR(r,a,e[a],t[a],n)}function cCe(r,e,t){e[0]==="-"?r.setProperty(e,t==null?"":t):r[e]=t==null?"":typeof t!="number"||Kat.test(e)?t:t+"px"}function SR(r,e,t,n,i){var a;e:if(e==="style")if(typeof t=="string")r.style.cssText=t;else{if(typeof n=="string"&&(r.style.cssText=n=""),n)for(e in n)t&&e in t||cCe(r.style,e,"");if(t)for(e in t)n&&t[e]===n[e]||cCe(r.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")a=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in r?e.toLowerCase().slice(2):e.slice(2),r.l||(r.l={}),r.l[e+a]=t,t?n||r.addEventListener(e,a?uCe:dCe,a):r.removeEventListener(e,a?uCe:dCe,a);else if(e!=="dangerouslySetInnerHTML"){if(i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e in r)try{r[e]=t==null?"":t;break e}catch(s){}typeof t=="function"||(t==null||t===!1&&e.indexOf("-")==-1?r.removeAttribute(e):r.setAttribute(e,t))}}function dCe(r){sT=!0;try{return this.l[r.type+!1](je.event?je.event(r):r)}finally{sT=!1}}function uCe(r){sT=!0;try{return this.l[r.type+!0](je.event?je.event(r):r)}finally{sT=!1}}function ji(r,e){this.props=r,this.context=e}function _C(r,e){if(e==null)return r.__?_C(r.__,r.__.__k.indexOf(r)+1):null;for(var t;ee&&Xh.sort(function(l,c){return l.__v.__b-c.__v.__b}));ER.__r=0}function vCe(r,e,t,n,i,a,s,o,l,c){var d,u,p,m,f,h,g,v=n&&n.__k||hCe,k=v.length;for(t.__k=[],d=0;d0?kR(m.type,m.props,m.key,m.ref?m.ref:null,m.__v):m)!=null){if(m.__=t,m.__b=t.__b+1,(p=v[d])===null||p&&m.key==p.key&&m.type===p.type)v[d]=void 0;else for(u=0;u=0;e--)if((t=r.__k[e])&&(n=kCe(t)))return n}return null}function gW(r,e,t,n,i,a,s,o,l){var c,d,u,p,m,f,h,g,v,k,b,w,S,x,C,D=e.type;if(e.constructor!==void 0)return null;t.__h!=null&&(l=t.__h,o=e.__e=t.__e,e.__h=null,a=[o]),(c=je.__b)&&c(e);try{e:if(typeof D=="function"){if(g=e.props,v=(c=D.contextType)&&n[c.__c],k=c?v?v.props.value:c.__:n,t.__c?h=(d=e.__c=t.__c).__=d.__E:("prototype"in D&&D.prototype.render?e.__c=d=new D(g,k):(e.__c=d=new ji(g,k),d.constructor=D,d.render=Xat),v&&v.sub(d),d.props=g,d.state||(d.state={}),d.context=k,d.__n=n,u=d.__d=!0,d.__h=[],d._sb=[]),d.__s==null&&(d.__s=d.state),D.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=km({},d.__s)),km(d.__s,D.getDerivedStateFromProps(g,d.__s))),p=d.props,m=d.state,d.__v=e,u)D.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(D.getDerivedStateFromProps==null&&g!==p&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(g,k),!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(g,d.__s,k)===!1||e.__v===t.__v){for(e.__v!==t.__v&&(d.props=g,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(_){_&&(_.__=e)}),b=0;b{wR={},hCe=[],Kat=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;xR=hCe.slice,je={__e:function(r,e,t,n){for(var i,a,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(r)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(r,n||{}),s=i.__d),s)return i.__E=i}catch(o){r=o}throw r}},pCe=0,hW=function(r){return r!=null&&r.constructor===void 0},sT=!1,ji.prototype.setState=function(r,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=km({},this.state),typeof r=="function"&&(r=r(km({},t),this.props)),r&&km(t,r),r!=null&&this.__v&&(e&&this._sb.push(e),fW(this))},ji.prototype.forceUpdate=function(r){this.__v&&(this.__e=!0,r&&this.__h.push(r),fW(this))},ji.prototype.render=Yt,Xh=[],mCe=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ER.__r=0,fCe=0});function rst(){for(var r;r=ICe.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(DR),r.__H.__h.forEach(bW),r.__H.__h=[]}catch(e){r.__H.__h=[],je.__e(e,r.__v)}}function nst(r){var e,t=function(){clearTimeout(n),ACe&&cancelAnimationFrame(e),setTimeout(r)},n=setTimeout(t,100);ACe&&(e=requestAnimationFrame(t))}function DR(r){var e=Yc,t=r.__c;typeof t=="function"&&(r.__c=void 0,t()),Yc=e}function bW(r){var e=Yc;r.__c=r.__(),Yc=e}var tst,Yc,yW,xCe,ICe,vW,CCe,DCe,PCe,MCe,_Ce,ACe,TW=y(()=>{Au();ICe=[],vW=[],CCe=je.__b,DCe=je.__r,PCe=je.diffed,MCe=je.__c,_Ce=je.unmount;je.__b=function(r){Yc=null,CCe&&CCe(r)},je.__r=function(r){DCe&&DCe(r),tst=0;var e=(Yc=r.__c).__H;e&&(yW===Yc?(e.__h=[],Yc.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=vW,t.__N=t.i=void 0})):(e.__h.forEach(DR),e.__h.forEach(bW),e.__h=[])),yW=Yc},je.diffed=function(r){PCe&&PCe(r);var e=r.__c;e&&e.__H&&(e.__H.__h.length&&(ICe.push(e)!==1&&xCe===je.requestAnimationFrame||((xCe=je.requestAnimationFrame)||nst)(rst)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==vW&&(t.__=t.__V),t.i=void 0,t.__V=vW})),yW=Yc=null},je.__c=function(r,e){e.some(function(t){try{t.__h.forEach(DR),t.__h=t.__h.filter(function(n){return!n.__||bW(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],je.__e(n,t.__v)}}),MCe&&MCe(r,e)},je.unmount=function(r){_Ce&&_Ce(r);var e,t=r.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{DR(n)}catch(i){e=i}}),t.__H=void 0,e&&je.__e(e,t.__v))};ACe=typeof requestAnimationFrame=="function"});function ist(r,e){for(var t in e)r[t]=e[t];return r}function NCe(r,e){for(var t in r)if(t!=="__source"&&!(t in e))return!0;for(var n in e)if(n!=="__source"&&r[n]!==e[n])return!0;return!1}function RCe(r){this.props=r}function UCe(r,e,t){return r&&(r.__c&&r.__c.__H&&(r.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),r.__c.__H=null),(r=ist({},r)).__c!=null&&(r.__c.__P===t&&(r.__c.__P=e),r.__c=null),r.__k=r.__k&&r.__k.map(function(n){return UCe(n,e,t)})),r}function HCe(r,e,t){return r&&(r.__v=null,r.__k=r.__k&&r.__k.map(function(n){return HCe(n,e,t)}),r.__c&&r.__c.__P===e&&(r.__e&&t.insertBefore(r.__e,r.__d),r.__c.__e=!0,r.__c.__P=t)),r}function kW(){this.__u=0,this.t=null,this.__b=null}function VCe(r){var e=r.__.__c;return e&&e.__a&&e.__a(r)}function PR(){this.u=null,this.o=null}function sst(r){return this.getChildContext=function(){return r.context},r.children}function ost(r){var e=this,t=r.i;e.componentWillUnmount=function(){wm(null,e.l),e.l=null,e.i=null},e.i&&e.i!==t&&e.componentWillUnmount(),r.__v?(e.l||(e.i=t,e.l={nodeType:1,parentNode:t,childNodes:[],appendChild:function(n){this.childNodes.push(n),e.i.appendChild(n)},insertBefore:function(n,i){this.childNodes.push(n),e.i.appendChild(n)},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),e.i.removeChild(n)}}),wm(M(sst,{context:e.context},r.__v),e.l)):e.l&&e.componentWillUnmount()}function wW(r,e){var t=M(ost,{__v:r,i:e});return t.containerInfo=e,t}function pst(){}function mst(){return this.cancelBubble}function fst(){return this.defaultPrevented}var OCe,GAr,ast,LCe,FCe,lst,cst,dst,ust,$Ce,hst,zCe,jCe,BCe,IC=y(()=>{Au();Au();TW();TW();(RCe.prototype=new ji).isPureReactComponent=!0,RCe.prototype.shouldComponentUpdate=function(r,e){return NCe(this.props,r)||NCe(this.state,e)};OCe=je.__b;je.__b=function(r){r.type&&r.type.__f&&r.ref&&(r.props.ref=r.ref,r.ref=null),OCe&&OCe(r)};GAr=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911,ast=je.__e;je.__e=function(r,e,t,n){if(r.then){for(var i,a=e;a=a.__;)if((i=a.__c)&&i.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),i.__c(r,e)}ast(r,e,t,n)};LCe=je.unmount;je.unmount=function(r){var e=r.__c;e&&e.__R&&e.__R(),e&&r.__h===!0&&(r.type=null),LCe&&LCe(r)},(kW.prototype=new ji).__c=function(r,e){var t=e.__c,n=this;n.t==null&&(n.t=[]),n.t.push(t);var i=VCe(n.__v),a=!1,s=function(){a||(a=!0,t.__R=null,i?i(o):o())};t.__R=s;var o=function(){if(!--n.__u){if(n.state.__a){var c=n.state.__a;n.__v.__k[0]=HCe(c,c.__c.__P,c.__c.__O)}var d;for(n.setState({__a:n.__b=null});d=n.t.pop();)d.forceUpdate()}},l=e.__h===!0;n.__u++||l||n.setState({__a:n.__b=n.__v.__k[0]}),r.then(s,s)},kW.prototype.componentWillUnmount=function(){this.t=[]},kW.prototype.render=function(r,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=UCe(this.__b,t,n.__O=n.__P)}this.__b=null}var i=e.__a&&M(Yt,null,r.fallback);return i&&(i.__h=null),[M(Yt,null,e.__a?null:r.children),i]};FCe=function(r,e,t){if(++t[1]===t[0]&&r.o.delete(e),r.props.revealOrder&&(r.props.revealOrder[0]!=="t"||!r.o.size))for(t=r.u;t;){for(;t.length>3;)t.pop()();if(t[1]{oDe(e,r)})}function aDe(r){r.isConnected&&r.getRootNode&&sDe(r.getRootNode())}function sDe(r){let e=NW.get(r);if(!e||!e.isConnected){if(e=r.querySelector("style[data-fullcalendar]"),!e){e=document.createElement("style"),e.setAttribute("data-fullcalendar","");let t=yst();t&&(e.nonce=t);let n=r===document?document.head:r,i=r===document?n.querySelector("script,link[rel=stylesheet],link[as=style],style"):n.firstChild;n.insertBefore(e,i)}NW.set(r,e),gst(e)}}function gst(r){for(let e of iDe)oDe(r,e)}function oDe(r,e){let{sheet:t}=r,n=t.cssRules.length;e.split("}").forEach((i,a)=>{i=i.trim(),i&&t.insertRule(i+"}",n+a)})}function yst(){return SW===void 0&&(SW=vst()),SW}function vst(){let r=document.querySelector('meta[name="csp-nonce"]');if(r&&r.hasAttribute("content"))return r.getAttribute("content");let e=document.querySelector("script[nonce]");return e&&e.nonce||""}function GC(r){r.parentNode&&r.parentNode.removeChild(r)}function pi(r,e){if(r.closest)return r.closest(e);if(!document.documentElement.contains(r))return null;do{if(qR(r,e))return r;r=r.parentElement||r.parentNode}while(r!==null&&r.nodeType===1);return null}function qR(r,e){return(r.matches||r.matchesSelector||r.msMatchesSelector).call(r,e)}function lDe(r,e){let t=r instanceof HTMLElement?[r]:r,n=[];for(let i=0;i{let n=pi(t.target,r);n&&e.call(n,t,n)}}function VW(r,e,t,n){let i=kst(t,n);return r.addEventListener(e,i),()=>{r.removeEventListener(e,i)}}function cDe(r,e,t,n){let i;return VW(r,"mouseover",e,(a,s)=>{if(s!==i){i=s,t(a,s);let o=l=>{i=null,n(l,s),s.removeEventListener("mouseleave",o)};s.addEventListener("mouseleave",o)}})}function qW(r,e){let t=n=>{e(n),WCe.forEach(i=>{r.removeEventListener(i,t)})};WCe.forEach(n=>{r.addEventListener(n,t)})}function dDe(r){return Object.assign({onClick:r},uDe(r))}function uDe(r){return{tabIndex:0,onKeyDown(e){(e.key==="Enter"||e.key===" ")&&(r(e),e.preventDefault())}}}function Fu(){return YCe+=1,String(YCe)}function pT(){document.body.classList.add("fc-not-allowed")}function mT(){document.body.classList.remove("fc-not-allowed")}function WW(r){r.style.userSelect="none",r.style.webkitUserSelect="none",r.addEventListener("selectstart",KC)}function YW(r){r.style.userSelect="",r.style.webkitUserSelect="",r.removeEventListener("selectstart",KC)}function GW(r){r.addEventListener("contextmenu",KC)}function KW(r){r.removeEventListener("contextmenu",KC)}function pDe(r){let e=[],t=[],n,i;for(typeof r=="string"?t=r.split(/\s*,\s*/):typeof r=="function"?t=[r]:Array.isArray(r)&&(t=r),n=0;nn.replace("$"+a,i||""),r):t}function ZW(r,e){return r-e}function NC(r){return r%1===0}function Sst(r){let e=r.querySelector(".fc-scrollgrid-shrink-frame"),t=r.querySelector(".fc-scrollgrid-shrink-cushion");if(!e)throw new Error("needs fc-scrollgrid-shrink-frame className");if(!t)throw new Error("needs fc-scrollgrid-shrink-cushion className");return r.getBoundingClientRect().width-e.getBoundingClientRect().width+t.getBoundingClientRect().width}function ct(r,e){return typeof r=="string"?xst(r):typeof r=="object"&&r?KCe(r):typeof r=="number"?KCe({[e||"milliseconds"]:r}):null}function xst(r){let e=Est.exec(r);if(e){let t=e[1]?-1:1;return{years:0,months:0,days:t*(e[2]?parseInt(e[2],10):0),milliseconds:t*((e[3]?parseInt(e[3],10):0)*60*60*1e3+(e[4]?parseInt(e[4],10):0)*60*1e3+(e[5]?parseInt(e[5],10):0)*1e3+(e[6]?parseInt(e[6],10):0))}}return null}function KCe(r){let e={years:r.years||r.year||0,months:r.months||r.month||0,days:r.days||r.day||0,milliseconds:(r.hours||r.hour||0)*60*60*1e3+(r.minutes||r.minute||0)*60*1e3+(r.seconds||r.second||0)*1e3+(r.milliseconds||r.millisecond||r.ms||0)},t=r.weeks||r.week;return t&&(e.days+=t*7,e.specifiedWeeks=!0),e}function Cst(r,e){return r.years===e.years&&r.months===e.months&&r.days===e.days&&r.milliseconds===e.milliseconds}function ZC(r,e){return{years:r.years+e.years,months:r.months+e.months,days:r.days+e.days,milliseconds:r.milliseconds+e.milliseconds}}function hDe(r,e){return{years:r.years-e.years,months:r.months-e.months,days:r.days-e.days,milliseconds:r.milliseconds-e.milliseconds}}function QW(r,e){return{years:r.years*e,months:r.months*e,days:r.days*e,milliseconds:r.milliseconds*e}}function Dst(r){return oT(r)/365}function Pst(r){return oT(r)/30}function oT(r){return to(r)/864e5}function to(r){return r.years*(365*864e5)+r.months*(30*864e5)+r.days*864e5+r.milliseconds}function QC(r,e){let t=null;for(let n=0;n=1?Math.min(i,a):i}function EW(r,e,t,n){let i=ds([e,0,1+Fst(e,t,n)]),a=pr(r),s=Math.round(Xc(i,a));return Math.floor(s/7)+1}function Fst(r,e,t){let n=7+e-t;return-((7+ds([r,0,n]).getUTCDay()-e)%7)+n-1}function ZCe(r){return[r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()]}function QCe(r){return new Date(r[0],r[1]||0,r[2]==null?1:r[2],r[3]||0,r[4]||0,r[5]||0)}function Em(r){return[r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()]}function ds(r){return r.length===1&&(r=r.concat([0])),new Date(Date.UTC(...r))}function XW(r){return!isNaN(r.valueOf())}function xm(r){return r.getUTCHours()*1e3*60*60+r.getUTCMinutes()*1e3*60+r.getUTCSeconds()*1e3+r.getUTCMilliseconds()}function GR(r,e,t=!1){let n=r.toISOString();return n=n.replace(".000",""),t&&(n=n.replace("T00:00:00Z","")),n.length>10&&(e==null?n=n.replace("Z",""):e!==0&&(n=n.replace("Z",t4(e,!0)))),n}function _m(r){return r.toISOString().replace(/T.*$/,"")}function hT(r){return r.toISOString().match(/^\d{4}-\d{2}/)[0]}function e4(r){return tg(r.getUTCHours(),2)+":"+tg(r.getUTCMinutes(),2)+":"+tg(r.getUTCSeconds(),2)}function t4(r,e=!1){let t=r<0?"-":"+",n=Math.abs(r),i=Math.floor(n/60),a=Math.round(n%60);return e?`${t+tg(i,2)}:${tg(a,2)}`:`GMT${t}${i}${a?`:${tg(a,2)}`:""}`}function Me(r,e,t){let n,i;return function(...a){if(!n)i=r.apply(this,a);else if(!Jc(n,a)){t&&t(i);let s=r.apply(this,a);(!e||!e(s,i))&&(i=s)}return n=a,i}}function gT(r,e,t){let n,i;return a=>{if(!n)i=r.call(this,a);else if(!ua(n,a)){t&&t(i);let s=r.call(this,a);(!e||!e(s,i))&&(i=s)}return n=a,i}}function JCe(r,e,t){let n=Object.keys(r).length;return n===1&&r.timeZoneName==="short"?i=>t4(i.timeZoneOffset):n===0&&e.week?i=>Wst(t.computeWeekNumber(i.marker),t.weekText,t.weekTextLong,t.locale,e.week):Ust(r,e,t)}function Ust(r,e,t){r=Object.assign({},r),e=Object.assign({},e),Hst(r,e),r.timeZone="UTC";let n=new Intl.DateTimeFormat(t.locale.codes,r),i;if(e.omitZeroMinute){let a=Object.assign({},r);delete a.minute,i=new Intl.DateTimeFormat(t.locale.codes,a)}return a=>{let{marker:s}=a,o;i&&!s.getUTCMinutes()?o=i:o=n;let l=o.format(s);return Vst(l,a,r,e,t)}}function Hst(r,e){r.timeZoneName&&(r.hour||(r.hour="2-digit"),r.minute||(r.minute="2-digit")),r.timeZoneName==="long"&&(r.timeZoneName="short"),e.omitZeroMinute&&(r.second||r.millisecond)&&delete e.omitZeroMinute}function Vst(r,e,t,n,i){return r=r.replace(jst,""),t.timeZoneName==="short"&&(r=qst(r,i.timeZone==="UTC"||e.timeZoneOffset==null?"UTC":t4(e.timeZoneOffset))),n.omitCommas&&(r=r.replace($st,"").trim()),n.omitZeroMinute&&(r=r.replace(":00","")),n.meridiem===!1?r=r.replace(MR,"").trim():n.meridiem==="narrow"?r=r.replace(MR,(a,s)=>s.toLocaleLowerCase()):n.meridiem==="short"?r=r.replace(MR,(a,s)=>`${s.toLocaleLowerCase()}m`):n.meridiem==="lowercase"&&(r=r.replace(MR,a=>a.toLocaleLowerCase())),r=r.replace(zst," "),r=r.trim(),r}function qst(r,e){let t=!1;return r=r.replace(Bst,()=>(t=!0,e)),t||(r+=` ${e}`),r}function Wst(r,e,t,n,i){let a=[];return i==="long"?a.push(t):(i==="short"||i==="narrow")&&a.push(e),(i==="long"||i==="short")&&a.push(" "),a.push(n.simpleNumberFormat.format(r)),n.options.direction==="rtl"&&a.reverse(),a.join("")}function Yst(r,e,t){return t.getMarkerYear(r)!==t.getMarkerYear(e)?5:t.getMarkerMonth(r)!==t.getMarkerMonth(e)?4:t.getMarkerDay(r)!==t.getMarkerDay(e)?2:xm(r)!==xm(e)?1:0}function Gst(r,e){let t={};for(let n in r)(!(n in LR)||LR[n]<=e)&&(t[n]=r[n]);return t}function Kst(r,e,t,n){let i=0;for(;i=0;a-=1){let s=r[a][n];if(typeof s=="object"&&s)i.unshift(s);else if(s!==void 0){t[n]=s;break}}i.length&&(t[n]=ZR(i))}}for(let n=r.length-1;n>=0;n-=1){let i=r[n];for(let a in i)a in t||(t[a]=i[a])}return t}function Iu(r,e){let t={};for(let n in r)e(r[n],n)&&(t[n]=r[n]);return t}function Uo(r,e){let t={};for(let n in r)t[n]=e(r[n],n);return t}function a4(r){let e={};for(let t of r)e[t]=!0;return e}function QR(r){let e=[];for(let t in r)e.push(r[t]);return e}function ua(r,e){if(r===e)return!0;for(let t in r)if($R.call(r,t)&&!(t in e))return!1;for(let t in e)if($R.call(e,t)&&r[t]!==e[t])return!1;return!0}function Qst(r,e){let t=Jst(r,e);for(let n of t)if(!Zst.test(n))return!1;return!0}function Jst(r,e){let t=[];for(let n in r)$R.call(r,n)&&(n in e||t.push(n));for(let n in e)$R.call(e,n)&&r[n]!==e[n]&&t.push(n);return t}function RR(r,e,t={}){if(r===e)return!0;for(let n in e)if(!(n in r&&Xst(r[n],e[n],t[n])))return!1;for(let n in r)if(!(n in e))return!1;return!0}function Xst(r,e,t){return r===e||t===!0?!0:t?t(r,e):!1}function bDe(r,e=0,t,n=1){let i=[];t==null&&(t=Object.keys(r).length);for(let a=e;a{this.props.value!==s.value&&a.forEach(o=>{o.context=s.value,o.forceUpdate()})},this.sub=s=>{a.push(s);let o=s.componentWillUnmount;s.componentWillUnmount=()=>{a.splice(a.indexOf(s),1),o&&o.call(s)}}}return i},e}function SDe(r,e,t,n,i,a,s,o,l,c,d,u,p,m){return{dateEnv:i,nowManager:a,options:t,pluginHooks:o,emitter:d,dispatch:l,getCurrentData:c,calendarApi:u,viewSpec:r,viewApi:e,dateProfileGenerator:n,theme:s,isRtl:t.direction==="rtl",addResizeHandler(f){d.on("_resize",f)},removeResizeHandler(f){d.off("_resize",f)},createScrollResponder(f){return new zR(f,d,ct(t.scrollTime),t.scrollTimeReset)},registerInteractiveComponent:p,unregisterInteractiveComponent:m}}function not(r){let e=Object.create(this.prototype.propEquality);Object.assign(e,r),this.prototype.propEquality=e}function iot(r){let e=Object.create(this.prototype.stateEquality);Object.assign(e,r),this.prototype.stateEquality=e}function no(r,e){typeof r=="function"?r(e):r&&(r.current=e)}function zW(r,e){var t;return!!(e.handleCustomRendering&&r&&(!((t=e.customRenderingMetaMap)===null||t===void 0)&&t[r]))}function s4(r,e,t){let n=Object.assign(Object.assign({},r.elAttrs),{ref:t});return(r.elClasses||e)&&(n.className=(r.elClasses||[]).concat(e||[]).concat(n.className||[]).filter(Boolean).join(" ")),r.elStyle&&(n.style=r.elStyle),n}function aot(r){return!!r}function sot(r,e){let t=r.props;return M(FC,Object.assign({renderProps:t.renderProps,generatorName:t.generatorName,customGenerator:t.customGenerator,defaultGenerator:t.defaultGenerator,renderId:r.context},e))}function oot(r,e){let t=typeof r=="function"?r(e):r||[];return typeof t=="string"?[t]:t}function l4(r){return[`fc-${r.type}-view`,"fc-view"]}function lot(r,e){let t=null,n=null;return r.start&&(t=e.createMarker(r.start)),r.end&&(n=e.createMarker(r.end)),!t&&!n||t&&n&&nn&&t.push({start:n,end:a.start}),a.end>n&&(n=a.end);return ne.start)&&(r.start===null||e.end===null||r.start=r.start)&&(r.end===null||e.end!==null&&e.end<=r.end)}function Bo(r,e){return(r.start===null||e>=r.start)&&(r.end===null||e=e.end?new Date(e.end.valueOf()-1):r}function xDe(r){let e=Math.floor(Xc(r.start,r.end))||1,t=pr(r.start),n=un(t,e);return{start:t,end:n}}function XR(r,e=ct(0)){let t=null,n=null;if(r.end){n=pr(r.end);let i=r.end.valueOf()-n.valueOf();i&&i>=to(e)&&(n=un(n,1))}return r.start&&(t=pr(r.start),n&&n<=t&&(n=un(t,1))),{start:t,end:n}}function c4(r){let e=XR(r);return Xc(e.start,e.end)>1}function Cm(r,e,t,n){return n==="year"?ct(t.diffWholeYears(r,e),"year"):n==="month"?ct(t.diffWholeMonths(r,e),"month"):gDe(r,e)}function vT(r,e,t,n){return{instanceId:Fu(),defId:r,range:e,forcedStartTzo:t==null?null:t,forcedEndTzo:n==null?null:n}}function uot(r,e,t,n){for(let i=0;i!s[l.defId].recurringDef);for(let l in s){let c=s[l];if(c.recurringDef){let{duration:d}=c.recurringDef;d||(d=c.allDay?a.defaultAllDayEventDuration:a.defaultTimedEventDuration);let u=pot(c,d,e,n,i.recurringTypes);for(let p of u){let m=vT(l,{start:p,end:n.add(p,d)});o[m.instanceId]=m}}}return{defs:s,instances:o}}function pot(r,e,t,n,i){let s=i[r.recurringDef.typeId].expand(r.recurringDef.typeData,{start:n.subtract(t.start,e),end:t.end},n);return r.allDay&&(s=s.map(pr)),s}function DDe(r,e,t,n,i=d4(t),a,s){let{refined:o,extra:l}=XC(r,t,i),c=hot(e,t),d=uot(o,c,t.dateEnv,t.pluginHooks.recurringTypes);if(d){let p=cT(o,l,e?e.sourceId:"",d.allDay,!!d.duration,t,a);return p.recurringDef={typeId:d.typeId,typeData:d.typeData,duration:d.duration},{def:p,instance:null}}let u=fot(o,c,t,n);if(u){let p=cT(o,l,e?e.sourceId:"",u.allDay,u.hasEnd,t,a),m=vT(p.defId,u.range,u.forcedStartTzo,u.forcedEndTzo);return s&&p.publicId&&s[p.publicId]&&(m.instanceId=s[p.publicId]),{def:p,instance:m}}return null}function XC(r,e,t=d4(e)){return JC(r,t)}function d4(r){return Object.assign(Object.assign(Object.assign({},jR),mot),r.pluginHooks.eventRefiners)}function cT(r,e,t,n,i,a,s){let o={title:r.title||"",groupId:r.groupId||"",publicId:r.id||"",url:r.url||"",recurringDef:null,defId:(s&&r.id?s[r.id]:"")||Fu(),sourceId:t,allDay:n,hasEnd:i,interactive:r.interactive,ui:bT(r,a),extendedProps:Object.assign(Object.assign({},r.extendedProps||{}),e)};for(let l of a.pluginHooks.eventDefMemberAdders)Object.assign(o,l(r));return Object.freeze(o.ui.classNames),Object.freeze(o.extendedProps),o}function fot(r,e,t,n){let{allDay:i}=r,a,s=null,o=!1,l,c=null,d=r.start!=null?r.start:r.date;if(a=t.dateEnv.createMarkerMeta(d),a)s=a.marker;else if(!n)return null;return r.end!=null&&(l=t.dateEnv.createMarkerMeta(r.end)),i==null&&(e!=null?i=e:i=(!a||a.isTimeUnspecified)&&(!l||l.isTimeUnspecified)),i&&s&&(s=pr(s)),l&&(c=l.marker,i&&(c=pr(c)),s&&c<=s&&(c=null)),c?o=!0:n||(o=t.options.forceEventDuration||!1,c=t.dateEnv.add(s,i?t.options.defaultAllDayEventDuration:t.options.defaultTimedEventDuration)),{allDay:i,hasEnd:o,range:{start:s,end:c},forcedStartTzo:a?a.forcedTzo:null,forcedEndTzo:l?l.forcedTzo:null}}function hot(r,e){let t=null;return r&&(t=r.defaultAllDay),t==null&&(t=e.options.defaultAllDay),t}function $C(r,e,t,n,i,a){let s=mi(),o=d4(t);for(let l of r){let c=DDe(l,e,t,n,o,i,a);c&&ag(c,s)}return s}function ag(r,e=mi()){return e.defs[r.def.defId]=r.def,r.instance&&(e.instances[r.instance.instanceId]=r.instance),e}function eD(r,e){let t=r.instances[e];if(t){let n=r.defs[t.defId],i=tO(r,a=>got(n,a));return i.defs[n.defId]=n,i.instances[t.instanceId]=t,i}return mi()}function got(r,e){return!!(r.groupId&&r.groupId===e.groupId)}function mi(){return{defs:{},instances:{}}}function eO(r,e){return{defs:Object.assign(Object.assign({},r.defs),e.defs),instances:Object.assign(Object.assign({},r.instances),e.instances)}}function tO(r,e){let t=Iu(r.defs,e),n=Iu(r.instances,i=>t[i.defId]);return{defs:t,instances:n}}function yot(r,e){let{defs:t,instances:n}=r,i={},a={};for(let s in t)e.defs[s]||(i[s]=t[s]);for(let s in n)!e.instances[s]&&i[n[s].defId]&&(a[s]=n[s]);return{defs:i,instances:a}}function vot(r,e){return Array.isArray(r)?$C(r,null,e,!0):typeof r=="object"&&r?$C([r],null,e,!0):r!=null?String(r):null}function jW(r){return Array.isArray(r)?r:typeof r=="string"?r.split(/\s+/):[]}function bT(r,e){let t=vot(r.constraint,e);return{display:r.display||null,startEditable:r.startEditable!=null?r.startEditable:r.editable,durationEditable:r.durationEditable!=null?r.durationEditable:r.editable,constraints:t!=null?[t]:[],overlap:r.overlap!=null?r.overlap:null,allows:r.allow!=null?[r.allow]:[],backgroundColor:r.backgroundColor||r.color||"",borderColor:r.borderColor||r.color||"",textColor:r.textColor||"",classNames:(r.className||[]).concat(r.classNames||[])}}function u4(r){return r.reduce(Tot,bot)}function Tot(r,e){return{display:e.display!=null?e.display:r.display,startEditable:e.startEditable!=null?e.startEditable:r.startEditable,durationEditable:e.durationEditable!=null?e.durationEditable:r.durationEditable,constraints:r.constraints.concat(e.constraints),overlap:typeof e.overlap=="boolean"?e.overlap:r.overlap,allows:r.allows.concat(e.allows),backgroundColor:e.backgroundColor||r.backgroundColor,borderColor:e.borderColor||r.borderColor,textColor:e.textColor||r.textColor,classNames:r.classNames.concat(e.classNames)}}function p4(r,e,t=m4(e)){let n;if(typeof r=="string"?n={url:r}:typeof r=="function"||Array.isArray(r)?n={events:r}:typeof r=="object"&&r&&(n=r),n){let{refined:i,extra:a}=JC(n,t),s=wot(i,e);if(s)return{_raw:r,isFetching:!1,latestFetchId:"",fetchRange:null,defaultAllDay:i.defaultAllDay,eventDataTransform:i.eventDataTransform,success:i.success,failure:i.failure,publicId:i.id||"",sourceId:Fu(),sourceDefId:s.sourceDefId,meta:s.meta,ui:bT(i,e),extendedProps:a}}return null}function m4(r){return Object.assign(Object.assign(Object.assign({},jR),kot),r.pluginHooks.eventSourceRefiners)}function wot(r,e){let t=e.pluginHooks.eventSourceDefs;for(let n=t.length-1;n>=0;n-=1){let a=t[n].parseMeta(r);if(a)return{sourceDefId:n,meta:a}}return null}function PDe(r,e,t,n,i){switch(e.type){case"RECEIVE_EVENTS":return Sot(r,t[e.sourceId],e.fetchId,e.fetchRange,e.rawEvents,i);case"RESET_RAW_EVENTS":return Eot(r,t[e.sourceId],e.rawEvents,n.activeRange,i);case"ADD_EVENTS":return xot(r,e.eventStore,n?n.activeRange:null,i);case"RESET_EVENTS":return e.eventStore;case"MERGE_EVENTS":return eO(r,e.eventStore);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return n?ig(r,n.activeRange,i):r;case"REMOVE_EVENTS":return yot(r,e.eventStore);case"REMOVE_EVENT_SOURCE":return _De(r,e.sourceId);case"REMOVE_ALL_EVENT_SOURCES":return tO(r,a=>!a.sourceId);case"REMOVE_ALL_EVENTS":return mi();default:return r}}function Sot(r,e,t,n,i,a){if(e&&t===e.latestFetchId){let s=$C(MDe(i,e,a),e,a);return n&&(s=ig(s,n,a)),eO(_De(r,e.sourceId),s)}return r}function Eot(r,e,t,n,i){let{defIdMap:a,instanceIdMap:s}=Dot(r),o=$C(MDe(t,e,i),e,i,!1,a,s);return ig(o,n,i)}function MDe(r,e,t){let n=t.options.eventDataTransform,i=e?e.eventDataTransform:null;return i&&(r=tDe(r,i)),n&&(r=tDe(r,n)),r}function tDe(r,e){let t;if(!e)t=r;else{t=[];for(let n of r){let i=e(n);i?t.push(i):i==null&&t.push(n)}}return t}function xot(r,e,t,n){return t&&(e=ig(e,t,n)),eO(r,e)}function f4(r,e,t){let{defs:n}=r,i=Uo(r.instances,a=>n[a.defId].allDay?a:Object.assign(Object.assign({},a),{range:{start:t.createMarker(e.toDate(a.range.start,a.forcedStartTzo)),end:t.createMarker(e.toDate(a.range.end,a.forcedEndTzo))},forcedStartTzo:t.canComputeOffset?null:a.forcedStartTzo,forcedEndTzo:t.canComputeOffset?null:a.forcedEndTzo}));return{defs:n,instances:i}}function _De(r,e){return tO(r,t=>t.sourceId!==e)}function Cot(r,e){return{defs:r.defs,instances:Iu(r.instances,t=>!e[t.instanceId])}}function Dot(r){let{defs:e,instances:t}=r,n={},i={};for(let a in e){let s=e[a],{publicId:o}=s;o&&(n[o]=a)}for(let a in t){let s=t[a],o=e[s.defId],{publicId:l}=o;l&&(i[l]=a)}return{defIdMap:n,instanceIdMap:i}}function Pot(r,e,t){(r[e]||(r[e]=[])).push(t)}function Mot(r,e,t){t?r[e]&&(r[e]=r[e].filter(n=>n!==t)):delete r[e]}function h4(r,e){return $C(Aot(r),null,e)}function Aot(r){let e;return r===!0?e=[{}]:Array.isArray(r)?e=r.filter(t=>t.daysOfWeek):typeof r=="object"&&r?e=[r]:e=[],e=e.map(t=>Object.assign(Object.assign({},_ot),t)),e}function rO(r,e,t){t.emitter.trigger("select",Object.assign(Object.assign({},g4(r,t)),{jsEvent:e?e.origEvent:null,view:t.viewApi||t.calendarApi.view}))}function Iot(r,e){e.emitter.trigger("unselect",{jsEvent:r?r.origEvent:null,view:e.viewApi||e.calendarApi.view})}function g4(r,e){let t={};for(let n of e.pluginHooks.dateSpanTransforms)Object.assign(t,n(r,e));return Object.assign(t,Vot(r,e.dateEnv)),t}function zC(r,e,t){let{dateEnv:n,options:i}=t,a=e;return r?(a=pr(a),a=n.add(a,i.defaultAllDayEventDuration)):a=n.add(a,i.defaultTimedEventDuration),a}function tD(r,e,t,n){let i=BR(r.defs,e),a=mi();for(let s in r.defs){let o=r.defs[s];a.defs[s]=Not(o,i[s],t,n)}for(let s in r.instances){let o=r.instances[s],l=a.defs[o.defId];a.instances[s]=Rot(o,l,i[o.defId],t,n)}return a}function Not(r,e,t,n){let i=t.standardProps||{};i.hasEnd==null&&e.durationEditable&&(t.startDelta||t.endDelta)&&(i.hasEnd=!0);let a=Object.assign(Object.assign(Object.assign({},r),i),{ui:Object.assign(Object.assign({},r.ui),i.ui)});t.extendedProps&&(a.extendedProps=Object.assign(Object.assign({},a.extendedProps),t.extendedProps));for(let s of n.pluginHooks.eventDefMutationAppliers)s(a,t,n);return!a.hasEnd&&n.options.forceEventDuration&&(a.hasEnd=!0),a}function Rot(r,e,t,n,i){let{dateEnv:a}=i,s=n.standardProps&&n.standardProps.allDay===!0,o=n.standardProps&&n.standardProps.hasEnd===!1,l=Object.assign({},r);return s&&(l.range=xDe(l.range)),n.datesDelta&&t.startEditable&&(l.range={start:a.add(l.range.start,n.datesDelta),end:a.add(l.range.end,n.datesDelta)}),n.startDelta&&t.durationEditable&&(l.range={start:a.add(l.range.start,n.startDelta),end:l.range.end}),n.endDelta&&t.durationEditable&&(l.range={start:l.range.start,end:a.add(l.range.end,n.endDelta)}),o&&(l.range={start:l.range.start,end:zC(e.allDay,l.range.start,i)}),e.allDay&&(l.range={start:pr(l.range.start),end:pr(l.range.end)}),l.range.endIDe(t,e))}function IDe(r,e){let t=[];return e[""]&&t.push(e[""]),e[r.defId]&&t.push(e[r.defId]),t.push(r.ui),u4(t)}function fg(r,e){let t=r.map(Oot);return t.sort((n,i)=>mDe(n,i,e)),t.map(n=>n._seg)}function Oot(r){let{eventRange:e}=r,t=e.def,n=e.instance?e.instance.range:e.range,i=n.start?n.start.valueOf():0,a=n.end?n.end.valueOf():0;return Object.assign(Object.assign(Object.assign({},t.extendedProps),t),{id:t.publicId,start:i,end:a,duration:a-i,allDay:Number(t.allDay),_seg:r})}function Lot(r,e){let{pluginHooks:t}=e,n=t.isDraggableTransformers,{def:i,ui:a}=r.eventRange,s=a.startEditable;for(let o of n)s=o(s,i,a,e);return s}function Fot(r,e){return r.isStart&&r.eventRange.ui.durationEditable&&e.options.eventResizableFromStart}function $ot(r,e){return r.isEnd&&r.eventRange.ui.durationEditable}function Im(r,e,t,n,i,a,s){let{dateEnv:o,options:l}=t,{displayEventTime:c,displayEventEnd:d}=l,u=r.eventRange.def,p=r.eventRange.instance;c==null&&(c=n!==!1),d==null&&(d=i!==!1);let m=p.range.start,f=p.range.end,h=a||r.start||r.eventRange.range.start,g=s||r.end||r.eventRange.range.end,v=pr(m).valueOf()===pr(h).valueOf(),k=pr(Gc(f,-1)).valueOf()===pr(Gc(g,-1)).valueOf();return c&&!u.allDay&&(v||k)?(h=v?m:h,g=k?f:g,d&&u.hasEnd?o.formatRange(h,g,e,{forcedStartTzo:a?null:p.forcedStartTzo,forcedEndTzo:s?null:p.forcedEndTzo}):o.format(h,e,{forcedTzo:a?null:p.forcedStartTzo})):""}function io(r,e,t){let n=r.eventRange.range;return{isPast:n.end<=(t||e.start),isFuture:n.start>=(t||e.end),isToday:e&&Bo(e,n.start)}}function zot(r){let e=["fc-event"];return r.isMirror&&e.push("fc-event-mirror"),r.isDraggable&&e.push("fc-event-draggable"),(r.isStartResizable||r.isEndResizable)&&e.push("fc-event-resizable"),r.isDragging&&e.push("fc-event-dragging"),r.isResizing&&e.push("fc-event-resizing"),r.isSelected&&e.push("fc-event-selected"),r.isStart&&e.push("fc-event-start"),r.isEnd&&e.push("fc-event-end"),r.isPast&&e.push("fc-event-past"),r.isToday&&e.push("fc-event-today"),r.isFuture&&e.push("fc-event-future"),e}function rD(r){return r.instance?r.instance.instanceId:`${r.def.defId}:${r.range.start.toISOString()}`}function TT(r,e){let{def:t,instance:n}=r.eventRange,{url:i}=t;if(i)return{href:i};let{emitter:a,options:s}=e,{eventInteractive:o}=s;return o==null&&(o=t.interactive,o==null&&(o=!!a.hasHandlers("eventClick"))),o?uDe(l=>{a.trigger("eventClick",{el:l.target,event:new Nr(e,t,n),jsEvent:l,view:e.viewApi})}):{}}function Bot(r,e,t){let n=Uot(r,e),{range:i}=n;if(!i.start)return null;if(!i.end){if(t==null)return null;i.end=e.add(i.start,t)}return n}function Uot(r,e){let{refined:t,extra:n}=JC(r,jot),i=t.start?e.createMarkerMeta(t.start):null,a=t.end?e.createMarkerMeta(t.end):null,{allDay:s}=t;return s==null&&(s=i&&i.isTimeUnspecified&&(!a||a.isTimeUnspecified)),Object.assign({range:{start:i?i.marker:null,end:a?a.marker:null},allDay:s},n)}function v4(r,e){return EDe(r.range,e.range)&&r.allDay===e.allDay&&Hot(r,e)}function Hot(r,e){for(let t in e)if(t!=="range"&&t!=="allDay"&&r[t]!==e[t])return!1;for(let t in r)if(!(t in e))return!1;return!0}function Vot(r,e){return Object.assign(Object.assign({},NDe(r.range,e,r.allDay)),{allDay:r.allDay})}function b4(r,e,t){return Object.assign(Object.assign({},NDe(r,e,t)),{timeZone:e.timeZone})}function NDe(r,e,t){return{start:e.toDate(r.start),end:e.toDate(r.end),startStr:e.formatIso(r.start,{omitTime:t}),endStr:e.formatIso(r.end,{omitTime:t})}}function qot(r,e,t){let n=XC({editable:!1},t),i=cT(n.refined,n.extra,"",r.allDay,!0,t);return{def:i,ui:IDe(i,e),instance:vT(i.defId,r.range),range:r.range,isStart:!0,isEnd:!0}}function T4(r,e,t){let n=!1,i=function(o){n||(n=!0,e(o))},a=function(o){n||(n=!0,t(o))},s=r(i,a);s&&typeof s.then=="function"&&s.then(i,a)}function k4(r,e,t){r=r.toUpperCase();let n={method:r};return r==="GET"?e+=(e.indexOf("?")===-1?"?":"&")+new URLSearchParams(t):(n.body=new URLSearchParams(t),n.headers={"Content-Type":"application/x-www-form-urlencoded"}),fetch(e,n).then(i=>{if(i.ok)return i.json().then(a=>[a,i],()=>{throw new UR("Failure parsing JSON",i)});throw new UR("Request failed",i)})}function w4(){return CW==null&&(CW=Wot()),CW}function Wot(){if(typeof document=="undefined")return!0;let r=document.createElement("div");r.style.position="absolute",r.style.top="0px",r.style.left="0px",r.innerHTML="
",r.querySelector("table").style.height="100px",r.querySelector("div").style.height="100%",document.body.appendChild(r);let t=r.querySelector("div").offsetHeight>0;return document.body.removeChild(r),t}function RDe(r,e){return{component:r,el:e.el,useEventCenter:e.useEventCenter!=null?e.useEventCenter:!0,isHitComboAllowed:e.isHitComboAllowed||null}}function nD(r){return{[r.component.uid]:r}}function Yot(r){let e=pr(r),t=un(e,1);return{start:e,end:t}}function S4(r,e){return r.left>=e.left&&r.left=e.top&&r.topt:e&&r>=e.end)}}function kT(r,e){let t=["fc-day",`fc-day-${Mst[r.dow]}`];return r.isDisabled?t.push("fc-day-disabled"):(r.isToday&&(t.push("fc-day-today"),t.push(e.getClass("today"))),r.isPast&&t.push("fc-day-past"),r.isFuture&&t.push("fc-day-future"),r.isOther&&t.push("fc-day-other")),t}function rd(r,e,t="day",n=!0){let{dateEnv:i,options:a,calendarApi:s}=r,o=i.format(e,t==="week"?Zot:Kot);if(a.navLinks){let l=i.toDate(e),c=d=>{let u=t==="day"?a.navLinkDayClick:t==="week"?a.navLinkWeekClick:null;typeof u=="function"?u.call(s,i.toDate(e),d):(typeof u=="string"&&(t=u),s.zoomTo(e,t))};return Object.assign({title:fT(a.navLinkHint,[o,l],o),"data-navlink":""},n?dDe(c):{onClick:c})}return{"aria-label":o}}function ODe(){return PW===null&&(PW=Qot()),PW}function Qot(){let r=document.createElement("div");mg(r,{position:"absolute",top:-1e3,left:0,border:0,padding:0,overflow:"scroll",direction:"rtl"}),r.innerHTML="
",document.body.appendChild(r);let t=r.firstChild.getBoundingClientRect().left>r.getBoundingClientRect().left;return GC(r),t}function LDe(){return MW||(MW=Jot()),MW}function Jot(){let r=document.createElement("div");r.style.overflow="scroll",r.style.position="absolute",r.style.top="-9999px",r.style.left="-9999px",document.body.appendChild(r);let e=FDe(r);return document.body.removeChild(r),e}function FDe(r){return{x:r.offsetHeight-r.clientHeight,y:r.offsetWidth-r.clientWidth}}function $De(r,e=!1){let t=window.getComputedStyle(r),n=parseInt(t.borderLeftWidth,10)||0,i=parseInt(t.borderRightWidth,10)||0,a=parseInt(t.borderTopWidth,10)||0,s=parseInt(t.borderBottomWidth,10)||0,o=FDe(r),l=o.y-n-i,c=o.x-a-s,d={borderLeft:n,borderRight:i,borderTop:a,borderBottom:s,scrollbarBottom:c,scrollbarLeft:0,scrollbarRight:0};return ODe()&&t.direction==="rtl"?d.scrollbarLeft=l:d.scrollbarRight=l,e&&(d.paddingLeft=parseInt(t.paddingLeft,10)||0,d.paddingRight=parseInt(t.paddingRight,10)||0,d.paddingTop=parseInt(t.paddingTop,10)||0,d.paddingBottom=parseInt(t.paddingBottom,10)||0),d}function D4(r,e=!1,t){let n=t?r.getBoundingClientRect():aD(r),i=$De(r,e),a={left:n.left+i.borderLeft+i.scrollbarLeft,right:n.right-i.borderRight-i.scrollbarRight,top:n.top+i.borderTop,bottom:n.bottom-i.borderBottom-i.scrollbarBottom};return e&&(a.left+=i.paddingLeft,a.right-=i.paddingRight,a.top+=i.paddingTop,a.bottom-=i.paddingBottom),a}function aD(r){let e=r.getBoundingClientRect();return{left:e.left+window.scrollX,top:e.top+window.scrollY,right:e.right+window.scrollX,bottom:e.bottom+window.scrollY}}function Xot(r){let e=iO(r),t=r.getBoundingClientRect();for(let n of e){let i=nO(t,n.getBoundingClientRect());if(i)t=i;else return null}return t}function iO(r){let e=[];for(;r instanceof HTMLElement;){let t=window.getComputedStyle(r);if(t.position==="fixed")break;/(auto|scroll)/.test(t.overflow+t.overflowY+t.overflowX)&&e.push(r),r=r.parentNode}return e}function AR(r,e){let t=r.length;if(t!==e.length)return!1;for(let n=0;nt(r[i-1]))return[i,0];for(;ns)n=a+1;else return[a,1]}return[n,0]}function oD(r){let{refined:e,extra:t}=JC(r,tlt);return{startTime:e.startTime||null,duration:e.duration||null,create:e.create!=null?e.create:!0,sourceId:e.sourceId,leftoverProps:t}}function zDe(r,e){return!r||e>10?Gt({weekday:"short"}):e>1?Gt({weekday:"short",month:"numeric",day:"numeric",omitCommas:!0}):Gt({weekday:"long"})}function BDe(r){return r.text}function nlt(r,e,t){return r||zDe(e,t)}function IR(r,e){let t=r.activeRange;return e?t:{start:Gc(t.start,r.slotMinTime.milliseconds),end:Gc(t.end,r.slotMaxTime.milliseconds-864e5)}}function lD(r,e,t){let{instances:n}=r.mutatedEvents;for(let i in n)if(!yT(e.validRange,n[i].range))return!1;return UDe({eventDrag:r},t)}function M4(r,e,t){return yT(e.validRange,r.range)?UDe({dateSelection:r},t):!1}function UDe(r,e){let t=e.getCurrentData(),n=Object.assign({businessHours:t.businessHours,dateSelection:"",eventStore:t.eventStore,eventUiBases:t.eventUiBases,eventSelection:"",eventDrag:null,eventResize:null},r);return(e.pluginHooks.isPropsValid||HDe)(n,e)}function HDe(r,e,t={},n){return!(r.eventDrag&&!ilt(r,e,t,n)||r.dateSelection&&!alt(r,e,t,n))}function ilt(r,e,t,n){let i=e.getCurrentData(),a=r.eventDrag,s=a.mutatedEvents,o=s.defs,l=s.instances,c=BR(o,a.isEvent?r.eventUiBases:{"":i.selectionConfig});n&&(c=Uo(c,n));let d=Cot(r.eventStore,a.affectedEvents.instances),u=d.defs,p=d.instances,m=BR(u,r.eventUiBases);for(let f in l){let h=l[f],g=h.range,v=c[h.defId],k=o[h.defId];if(!VDe(v.constraints,g,d,r.businessHours,e))return!1;let{eventOverlap:b}=e.options,w=typeof b=="function"?b:null;for(let x in p){let C=p[x];if(JR(g,C.range)&&(m[C.defId].overlap===!1&&a.isEvent||v.overlap===!1||w&&!w(new Nr(e,u[C.defId],C),new Nr(e,k,h))))return!1}let S=i.eventStore;for(let x of v.allows){let C=Object.assign(Object.assign({},t),{range:h.range,allDay:k.allDay}),D=S.defs[k.defId],_=S.instances[f],O;if(D?O=new Nr(e,D,_):O=new Nr(e,k),!x(g4(C,e),O))return!1}}return!0}function alt(r,e,t,n){let i=r.eventStore,a=i.defs,s=i.instances,o=r.dateSelection,l=o.range,{selectionConfig:c}=e.getCurrentData();if(n&&(c=n(c)),!VDe(c.constraints,l,i,r.businessHours,e))return!1;let{selectOverlap:d}=e.options,u=typeof d=="function"?d:null;for(let p in s){let m=s[p];if(JR(l,m.range)&&(c.overlap===!1||u&&!u(new Nr(e,a[m.defId],m),null)))return!1}for(let p of c.allows){let m=Object.assign(Object.assign({},t),o);if(!p(g4(m,e),null))return!1}return!0}function VDe(r,e,t,n,i){for(let a of r)if(!olt(slt(a,e,t,n,i),e))return!1;return!0}function slt(r,e,t,n,i){return r==="businessHours"?AW(ig(n,e,i)):typeof r=="string"?AW(tO(t,a=>a.groupId===r)):typeof r=="object"&&r?AW(ig(r,e,i)):[]}function AW(r){let{instances:e}=r,t=[];for(let n in e)t.push(e[n].range);return t}function olt(r,e){for(let t of r)if(yT(t,e))return!0;return!1}function qDe(r){let e=lDe(r,".fc-scrollgrid-shrink"),t=0;for(let n of e)t=Math.max(t,Sst(n));return Math.ceil(t)}function _4(r,e){return r.liquid&&e.liquid}function WDe(r,e){return e.maxHeight!=null||_4(r,e)}function YDe(r,e,t,n){let{expandRows:i}=t;return typeof e.content=="function"?e.content(t):M("table",{role:"presentation",className:[e.tableClassName,r.syncRowHeights?"fc-scrollgrid-sync-table":""].join(" "),style:{minWidth:t.tableMinWidth,width:t.clientWidth,height:i?t.clientHeight:""}},t.tableColGroupNode,M(n?"thead":"tbody",{role:"presentation"},typeof e.rowContent=="function"?e.rowContent(t):e.rowContent))}function GDe(r,e){return Jc(r,e,ua)}function KDe(r,e){let t=[];for(let n of r){let i=n.span||1;for(let a=0;ae.eventRange.range.end?r:e}var iDe,NW,SW,bst,rg,Tst,qCe,WCe,YCe,GCe,Est,Mst,xW,LR,MR,$st,zst,jst,Bst,RW,OW,LW,r4,ed,n4,i4,Am,vDe,$R,Zst,TDe,FW,rot,OC,Nu,$W,zR,Ho,Kc,wt,FC,o4,In,ro,ng,OR,CDe,mot,jR,bot,kot,Ru,_ot,Sm,Nr,jot,UR,CW,jC,zl,hg,us,BC,DW,UC,Kot,Zot,PW,MW,jl,sg,HC,VC,Xn,og,YC,wT,tlt,jDe,HR,rlt,VR,Ou,lg,cg,dg,NR,uT,ps,Dm,Lu,Pm,dD,dlt,Mm,ug,pD,IW,BW,UW,pg,A4=y(()=>{Au();Au();IC();iDe=[],NW=new Map;typeof document!="undefined"&&sDe(document);bst=':root{--fc-small-font-size:.85em;--fc-page-bg-color:#fff;--fc-neutral-bg-color:hsla(0,0%,82%,.3);--fc-neutral-text-color:grey;--fc-border-color:#ddd;--fc-button-text-color:#fff;--fc-button-bg-color:#2c3e50;--fc-button-border-color:#2c3e50;--fc-button-hover-bg-color:#1e2b37;--fc-button-hover-border-color:#1a252f;--fc-button-active-bg-color:#1a252f;--fc-button-active-border-color:#151e27;--fc-event-bg-color:#3788d8;--fc-event-border-color:#3788d8;--fc-event-text-color:#fff;--fc-event-selected-overlay-color:rgba(0,0,0,.25);--fc-more-link-bg-color:#d0d0d0;--fc-more-link-text-color:inherit;--fc-event-resizer-thickness:8px;--fc-event-resizer-dot-total-width:8px;--fc-event-resizer-dot-border-width:1px;--fc-non-business-color:hsla(0,0%,84%,.3);--fc-bg-event-color:#8fdf82;--fc-bg-event-opacity:0.3;--fc-highlight-color:rgba(188,232,241,.3);--fc-today-bg-color:rgba(255,220,40,.15);--fc-now-indicator-color:red}.fc-not-allowed,.fc-not-allowed .fc-event{cursor:not-allowed}.fc{display:flex;flex-direction:column;font-size:1em}.fc,.fc *,.fc :after,.fc :before{box-sizing:border-box}.fc table{border-collapse:collapse;border-spacing:0;font-size:1em}.fc th{text-align:center}.fc td,.fc th{padding:0;vertical-align:top}.fc a[data-navlink]{cursor:pointer}.fc a[data-navlink]:hover{text-decoration:underline}.fc-direction-ltr{direction:ltr;text-align:left}.fc-direction-rtl{direction:rtl;text-align:right}.fc-theme-standard td,.fc-theme-standard th{border:1px solid var(--fc-border-color)}.fc-liquid-hack td,.fc-liquid-hack th{position:relative}@font-face{font-family:fcicons;font-style:normal;font-weight:400;src:url("data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBfAAAAC8AAAAYGNtYXAXVtKNAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZgYydxIAAAF4AAAFNGhlYWQUJ7cIAAAGrAAAADZoaGVhB20DzAAABuQAAAAkaG10eCIABhQAAAcIAAAALGxvY2ED4AU6AAAHNAAAABhtYXhwAA8AjAAAB0wAAAAgbmFtZXsr690AAAdsAAABhnBvc3QAAwAAAAAI9AAAACAAAwPAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpBgPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6Qb//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAWIAjQKeAskAEwAAJSc3NjQnJiIHAQYUFwEWMjc2NCcCnuLiDQ0MJAz/AA0NAQAMJAwNDcni4gwjDQwM/wANIwz/AA0NDCMNAAAAAQFiAI0CngLJABMAACUBNjQnASYiBwYUHwEHBhQXFjI3AZ4BAA0N/wAMJAwNDeLiDQ0MJAyNAQAMIw0BAAwMDSMM4uINIwwNDQAAAAIA4gC3Ax4CngATACcAACUnNzY0JyYiDwEGFB8BFjI3NjQnISc3NjQnJiIPAQYUHwEWMjc2NCcB87e3DQ0MIw3VDQ3VDSMMDQ0BK7e3DQ0MJAzVDQ3VDCQMDQ3zuLcMJAwNDdUNIwzWDAwNIwy4twwkDA0N1Q0jDNYMDA0jDAAAAgDiALcDHgKeABMAJwAAJTc2NC8BJiIHBhQfAQcGFBcWMjchNzY0LwEmIgcGFB8BBwYUFxYyNwJJ1Q0N1Q0jDA0Nt7cNDQwjDf7V1Q0N1QwkDA0Nt7cNDQwkDLfWDCMN1Q0NDCQMt7gMIw0MDNYMIw3VDQ0MJAy3uAwjDQwMAAADAFUAAAOrA1UAMwBoAHcAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMhMjY1NCYjISIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAAVYRGRkR/qoRGRkRA1UFBAUOCQkVDAsZDf2rDRkLDBUJCA4FBQUFBQUOCQgVDAsZDQJVDRkLDBUJCQ4FBAVVAgECBQMCBwQECAX9qwQJAwQHAwMFAQICAgIBBQMDBwQDCQQCVQUIBAQHAgMFAgEC/oAZEhEZGRESGQAAAAADAFUAAAOrA1UAMwBoAIkAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMzFRQWMzI2PQEzMjY1NCYrATU0JiMiBh0BIyIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAgBkSEhmAERkZEYAZEhIZgBEZGREDVQUEBQ4JCRUMCxkN/asNGQsMFQkIDgUFBQUFBQ4JCBUMCxkNAlUNGQsMFQkJDgUEBVUCAQIFAwIHBAQIBf2rBAkDBAcDAwUBAgICAgEFAwMHBAMJBAJVBQgEBAcCAwUCAQL+gIASGRkSgBkSERmAEhkZEoAZERIZAAABAOIAjQMeAskAIAAAExcHBhQXFjI/ARcWMjc2NC8BNzY0JyYiDwEnJiIHBhQX4uLiDQ0MJAzi4gwkDA0N4uINDQwkDOLiDCQMDQ0CjeLiDSMMDQ3h4Q0NDCMN4uIMIw0MDOLiDAwNIwwAAAABAAAAAQAAa5n0y18PPPUACwQAAAAAANivOVsAAAAA2K85WwAAAAADqwNVAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAOrAAEAAAAAAAAAAAAAAAAAAAALBAAAAAAAAAAAAAAAAgAAAAQAAWIEAAFiBAAA4gQAAOIEAABVBAAAVQQAAOIAAAAAAAoAFAAeAEQAagCqAOoBngJkApoAAQAAAAsAigADAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGZjaWNvbnMAZgBjAGkAYwBvAG4Ac1ZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGZjaWNvbnMAZgBjAGkAYwBvAG4Ac2ZjaWNvbnMAZgBjAGkAYwBvAG4Ac1JlZ3VsYXIAUgBlAGcAdQBsAGEAcmZjaWNvbnMAZgBjAGkAYwBvAG4Ac0ZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format("truetype")}.fc-icon{speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;font-family:fcicons!important;font-style:normal;font-variant:normal;font-weight:400;height:1em;line-height:1;text-align:center;text-transform:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:1em}.fc-icon-chevron-left:before{content:"\\e900"}.fc-icon-chevron-right:before{content:"\\e901"}.fc-icon-chevrons-left:before{content:"\\e902"}.fc-icon-chevrons-right:before{content:"\\e903"}.fc-icon-minus-square:before{content:"\\e904"}.fc-icon-plus-square:before{content:"\\e905"}.fc-icon-x:before{content:"\\e906"}.fc .fc-button{border-radius:0;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;overflow:visible;text-transform:none}.fc .fc-button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}.fc .fc-button{-webkit-appearance:button}.fc .fc-button:not(:disabled){cursor:pointer}.fc .fc-button{background-color:transparent;border:1px solid transparent;border-radius:.25em;display:inline-block;font-size:1em;font-weight:400;line-height:1.5;padding:.4em .65em;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle}.fc .fc-button:hover{text-decoration:none}.fc .fc-button:focus{box-shadow:0 0 0 .2rem rgba(44,62,80,.25);outline:0}.fc .fc-button:disabled{opacity:.65}.fc .fc-button-primary{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:hover{background-color:var(--fc-button-hover-bg-color);border-color:var(--fc-button-hover-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:disabled{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button-primary:not(:disabled).fc-button-active,.fc .fc-button-primary:not(:disabled):active{background-color:var(--fc-button-active-bg-color);border-color:var(--fc-button-active-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:not(:disabled).fc-button-active:focus,.fc .fc-button-primary:not(:disabled):active:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button .fc-icon{font-size:1.5em;vertical-align:middle}.fc .fc-button-group{display:inline-flex;position:relative;vertical-align:middle}.fc .fc-button-group>.fc-button{flex:1 1 auto;position:relative}.fc .fc-button-group>.fc-button.fc-button-active,.fc .fc-button-group>.fc-button:active,.fc .fc-button-group>.fc-button:focus,.fc .fc-button-group>.fc-button:hover{z-index:1}.fc-direction-ltr .fc-button-group>.fc-button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0;margin-left:-1px}.fc-direction-ltr .fc-button-group>.fc-button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.fc-direction-rtl .fc-button-group>.fc-button:not(:first-child){border-bottom-right-radius:0;border-top-right-radius:0;margin-right:-1px}.fc-direction-rtl .fc-button-group>.fc-button:not(:last-child){border-bottom-left-radius:0;border-top-left-radius:0}.fc .fc-toolbar{align-items:center;display:flex;justify-content:space-between}.fc .fc-toolbar.fc-header-toolbar{margin-bottom:1.5em}.fc .fc-toolbar.fc-footer-toolbar{margin-top:1.5em}.fc .fc-toolbar-title{font-size:1.75em;margin:0}.fc-direction-ltr .fc-toolbar>*>:not(:first-child){margin-left:.75em}.fc-direction-rtl .fc-toolbar>*>:not(:first-child){margin-right:.75em}.fc-direction-rtl .fc-toolbar-ltr{flex-direction:row-reverse}.fc .fc-scroller{-webkit-overflow-scrolling:touch;position:relative}.fc .fc-scroller-liquid{height:100%}.fc .fc-scroller-liquid-absolute{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-scroller-harness{direction:ltr;overflow:hidden;position:relative}.fc .fc-scroller-harness-liquid{height:100%}.fc-direction-rtl .fc-scroller-harness>.fc-scroller{direction:rtl}.fc-theme-standard .fc-scrollgrid{border:1px solid var(--fc-border-color)}.fc .fc-scrollgrid,.fc .fc-scrollgrid table{table-layout:fixed;width:100%}.fc .fc-scrollgrid table{border-left-style:hidden;border-right-style:hidden;border-top-style:hidden}.fc .fc-scrollgrid{border-bottom-width:0;border-collapse:separate;border-right-width:0}.fc .fc-scrollgrid-liquid{height:100%}.fc .fc-scrollgrid-section,.fc .fc-scrollgrid-section table,.fc .fc-scrollgrid-section>td{height:1px}.fc .fc-scrollgrid-section-liquid>td{height:100%}.fc .fc-scrollgrid-section>*{border-left-width:0;border-top-width:0}.fc .fc-scrollgrid-section-footer>*,.fc .fc-scrollgrid-section-header>*{border-bottom-width:0}.fc .fc-scrollgrid-section-body table,.fc .fc-scrollgrid-section-footer table{border-bottom-style:hidden}.fc .fc-scrollgrid-section-sticky>*{background:var(--fc-page-bg-color);position:sticky;z-index:3}.fc .fc-scrollgrid-section-header.fc-scrollgrid-section-sticky>*{top:0}.fc .fc-scrollgrid-section-footer.fc-scrollgrid-section-sticky>*{bottom:0}.fc .fc-scrollgrid-sticky-shim{height:1px;margin-bottom:-1px}.fc-sticky{position:sticky}.fc .fc-view-harness{flex-grow:1;position:relative}.fc .fc-view-harness-active>.fc-view{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-col-header-cell-cushion{display:inline-block;padding:2px 4px}.fc .fc-bg-event,.fc .fc-highlight,.fc .fc-non-business{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-non-business{background:var(--fc-non-business-color)}.fc .fc-bg-event{background:var(--fc-bg-event-color);opacity:var(--fc-bg-event-opacity)}.fc .fc-bg-event .fc-event-title{font-size:var(--fc-small-font-size);font-style:italic;margin:.5em}.fc .fc-highlight{background:var(--fc-highlight-color)}.fc .fc-cell-shaded,.fc .fc-day-disabled{background:var(--fc-neutral-bg-color)}a.fc-event,a.fc-event:hover{text-decoration:none}.fc-event.fc-event-draggable,.fc-event[href]{cursor:pointer}.fc-event .fc-event-main{position:relative;z-index:2}.fc-event-dragging:not(.fc-event-selected){opacity:.75}.fc-event-dragging.fc-event-selected{box-shadow:0 2px 7px rgba(0,0,0,.3)}.fc-event .fc-event-resizer{display:none;position:absolute;z-index:4}.fc-event-selected .fc-event-resizer,.fc-event:hover .fc-event-resizer{display:block}.fc-event-selected .fc-event-resizer{background:var(--fc-page-bg-color);border-color:inherit;border-radius:calc(var(--fc-event-resizer-dot-total-width)/2);border-style:solid;border-width:var(--fc-event-resizer-dot-border-width);height:var(--fc-event-resizer-dot-total-width);width:var(--fc-event-resizer-dot-total-width)}.fc-event-selected .fc-event-resizer:before{bottom:-20px;content:"";left:-20px;position:absolute;right:-20px;top:-20px}.fc-event-selected,.fc-event:focus{box-shadow:0 2px 5px rgba(0,0,0,.2)}.fc-event-selected:before,.fc-event:focus:before{bottom:0;content:"";left:0;position:absolute;right:0;top:0;z-index:3}.fc-event-selected:after,.fc-event:focus:after{background:var(--fc-event-selected-overlay-color);bottom:-1px;content:"";left:-1px;position:absolute;right:-1px;top:-1px;z-index:1}.fc-h-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-h-event .fc-event-main{color:var(--fc-event-text-color)}.fc-h-event .fc-event-main-frame{display:flex}.fc-h-event .fc-event-time{max-width:100%;overflow:hidden}.fc-h-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-width:0}.fc-h-event .fc-event-title{display:inline-block;left:0;max-width:100%;overflow:hidden;right:0;vertical-align:top}.fc-h-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-start),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-end){border-bottom-left-radius:0;border-left-width:0;border-top-left-radius:0}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-end),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-start){border-bottom-right-radius:0;border-right-width:0;border-top-right-radius:0}.fc-h-event:not(.fc-event-selected) .fc-event-resizer{bottom:0;top:0;width:var(--fc-event-resizer-thickness)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end{cursor:w-resize;left:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start{cursor:e-resize;right:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-h-event.fc-event-selected .fc-event-resizer{margin-top:calc(var(--fc-event-resizer-dot-total-width)*-.5);top:50%}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-start,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-end{left:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-end,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-start{right:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc .fc-popover{box-shadow:0 2px 6px rgba(0,0,0,.15);position:absolute;z-index:9999}.fc .fc-popover-header{align-items:center;display:flex;flex-direction:row;justify-content:space-between;padding:3px 4px}.fc .fc-popover-title{margin:0 2px}.fc .fc-popover-close{cursor:pointer;font-size:1.1em;opacity:.65}.fc-theme-standard .fc-popover{background:var(--fc-page-bg-color);border:1px solid var(--fc-border-color)}.fc-theme-standard .fc-popover-header{background:var(--fc-neutral-bg-color)}';Qc(bst);rg=class{constructor(e){this.drainedOption=e,this.isRunning=!1,this.isDirty=!1,this.pauseDepths={},this.timeoutId=0}request(e){this.isDirty=!0,this.isPaused()||(this.clearTimeout(),e==null?this.tryDrain():this.timeoutId=setTimeout(this.tryDrain.bind(this),e))}pause(e=""){let{pauseDepths:t}=this;t[e]=(t[e]||0)+1,this.clearTimeout()}resume(e="",t){let{pauseDepths:n}=this;e in n&&(t?delete n[e]:(n[e]-=1,n[e]<=0&&delete n[e]),this.tryDrain())}isPaused(){return Object.keys(this.pauseDepths).length}tryDrain(){if(!this.isRunning&&!this.isPaused()){for(this.isRunning=!0;this.isDirty;)this.isDirty=!1,this.drained();this.isRunning=!1}}clear(){this.clearTimeout(),this.isDirty=!1,this.pauseDepths={}}clearTimeout(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=0)}drained(){this.drainedOption&&this.drainedOption()}};Tst=/(top|left|right|bottom|width|height)$/i;qCe=0;WCe=["webkitTransitionEnd","otransitionend","oTransitionEnd","msTransitionEnd","transitionend"];YCe=0;GCe=["years","months","days","milliseconds"],Est=/^(-?)(?:(\d+)\.)?(\d+):(\d\d)(?::(\d\d)(?:\.(\d\d\d))?)?/;Mst=["sun","mon","tue","wed","thu","fri","sat"];xW={week:3,separator:9,omitZeroMinute:9,meridiem:9,omitCommas:9},LR={timeZoneName:7,era:6,year:5,month:4,day:2,weekday:2,hour:1,minute:1,second:1},MR=/\s*([ap])\.?m\.?/i,$st=/,/g,zst=/\s+/g,jst=/\u200e/g,Bst=/UTC|GMT/,RW=class{constructor(e){let t={},n={},i=9;for(let a in e)a in xW?(n[a]=e[a],xW[a]<9&&(i=Math.min(xW[a],i))):(t[a]=e[a],a in LR&&(i=Math.min(LR[a],i)));this.standardDateProps=t,this.extendedSettings=n,this.smallestUnitNum=i,this.buildFormattingFunc=Me(JCe)}format(e,t){return this.buildFormattingFunc(this.standardDateProps,this.extendedSettings,t)(e)}formatRange(e,t,n,i){let{standardDateProps:a,extendedSettings:s}=this,o=Yst(e.marker,t.marker,n.calendarSystem);if(!o)return this.format(e,n);let l=o;l>1&&(a.year==="numeric"||a.year==="2-digit")&&(a.month==="numeric"||a.month==="2-digit")&&(a.day==="numeric"||a.day==="2-digit")&&(l=1);let c=this.format(e,n),d=this.format(t,n);if(c===d)return c;let u=Gst(a,l),p=JCe(u,s,n),m=p(e),f=p(t),h=Kst(c,m,d,f),g=s.separator||i||n.defaultSeparator||"";return h?h.before+m+g+f+h.after:c+g+d}getSmallestUnit(){switch(this.smallestUnitNum){case 7:case 6:case 5:return"year";case 4:return"month";case 3:return"week";case 2:return"day";default:return"time"}}};OW=class{constructor(e){this.cmdStr=e}format(e,t,n){return t.cmdFormatter(this.cmdStr,FR(e,null,t,n))}formatRange(e,t,n,i){return n.cmdFormatter(this.cmdStr,FR(e,t,n,i))}},LW=class{constructor(e){this.func=e}format(e,t,n){return this.func(FR(e,null,t,n))}formatRange(e,t,n,i){return this.func(FR(e,t,n,i))}};r4={navLinkDayClick:j,navLinkWeekClick:j,duration:ct,bootstrapFontAwesome:j,buttonIcons:j,customButtons:j,defaultAllDayEventDuration:ct,defaultTimedEventDuration:ct,nextDayThreshold:ct,scrollTime:ct,scrollTimeReset:Boolean,slotMinTime:ct,slotMaxTime:ct,dayPopoverFormat:Gt,slotDuration:ct,snapDuration:ct,headerToolbar:j,footerToolbar:j,defaultRangeSeparator:String,titleRangeSeparator:String,forceEventDuration:Boolean,dayHeaders:Boolean,dayHeaderFormat:Gt,dayHeaderClassNames:j,dayHeaderContent:j,dayHeaderDidMount:j,dayHeaderWillUnmount:j,dayCellClassNames:j,dayCellContent:j,dayCellDidMount:j,dayCellWillUnmount:j,initialView:String,aspectRatio:Number,weekends:Boolean,weekNumberCalculation:j,weekNumbers:Boolean,weekNumberClassNames:j,weekNumberContent:j,weekNumberDidMount:j,weekNumberWillUnmount:j,editable:Boolean,viewClassNames:j,viewDidMount:j,viewWillUnmount:j,nowIndicator:Boolean,nowIndicatorSnap:j,nowIndicatorClassNames:j,nowIndicatorContent:j,nowIndicatorDidMount:j,nowIndicatorWillUnmount:j,showNonCurrentDates:Boolean,lazyFetching:Boolean,startParam:String,endParam:String,timeZoneParam:String,timeZone:String,locales:j,locale:j,themeSystem:String,dragRevertDuration:Number,dragScroll:Boolean,allDayMaintainDuration:Boolean,unselectAuto:Boolean,dropAccept:j,eventOrder:pDe,eventOrderStrict:Boolean,handleWindowResize:Boolean,windowResizeDelay:Number,longPressDelay:Number,eventDragMinDistance:Number,expandRows:Boolean,height:j,contentHeight:j,direction:String,weekNumberFormat:Gt,eventResizableFromStart:Boolean,displayEventTime:Boolean,displayEventEnd:Boolean,weekText:String,weekTextLong:String,progressiveEventRendering:Boolean,businessHours:j,initialDate:j,now:j,eventDataTransform:j,stickyHeaderDates:j,stickyFooterScrollbar:j,viewHeight:j,defaultAllDay:Boolean,eventSourceFailure:j,eventSourceSuccess:j,eventDisplay:String,eventStartEditable:Boolean,eventDurationEditable:Boolean,eventOverlap:j,eventConstraint:j,eventAllow:j,eventBackgroundColor:String,eventBorderColor:String,eventTextColor:String,eventColor:String,eventClassNames:j,eventContent:j,eventDidMount:j,eventWillUnmount:j,selectConstraint:j,selectOverlap:j,selectAllow:j,droppable:Boolean,unselectCancel:String,slotLabelFormat:j,slotLaneClassNames:j,slotLaneContent:j,slotLaneDidMount:j,slotLaneWillUnmount:j,slotLabelClassNames:j,slotLabelContent:j,slotLabelDidMount:j,slotLabelWillUnmount:j,dayMaxEvents:j,dayMaxEventRows:j,dayMinWidth:Number,slotLabelInterval:ct,allDayText:String,allDayClassNames:j,allDayContent:j,allDayDidMount:j,allDayWillUnmount:j,slotMinWidth:Number,navLinks:Boolean,eventTimeFormat:Gt,rerenderDelay:Number,moreLinkText:j,moreLinkHint:j,selectMinDistance:Number,selectable:Boolean,selectLongPressDelay:Number,eventLongPressDelay:Number,selectMirror:Boolean,eventMaxStack:Number,eventMinHeight:Number,eventMinWidth:Number,eventShortHeight:Number,slotEventOverlap:Boolean,plugins:j,firstDay:Number,dayCount:Number,dateAlignment:String,dateIncrement:ct,hiddenDays:j,fixedWeekCount:Boolean,validRange:j,visibleRange:j,titleFormat:j,eventInteractive:Boolean,noEventsText:String,viewHint:j,navLinkHint:j,closeHint:String,timeHint:String,eventHint:String,moreLinkClick:j,moreLinkClassNames:j,moreLinkContent:j,moreLinkDidMount:j,moreLinkWillUnmount:j,monthStartFormat:Gt,handleCustomRendering:j,customRenderingMetaMap:j,customRenderingReplaces:Boolean},ed={eventDisplay:"auto",defaultRangeSeparator:" - ",titleRangeSeparator:" \u2013 ",defaultTimedEventDuration:"01:00:00",defaultAllDayEventDuration:{day:1},forceEventDuration:!1,nextDayThreshold:"00:00:00",dayHeaders:!0,initialView:"",aspectRatio:1.35,headerToolbar:{start:"title",center:"",end:"today prev,next"},weekends:!0,weekNumbers:!1,weekNumberCalculation:"local",editable:!1,nowIndicator:!1,scrollTime:"06:00:00",scrollTimeReset:!0,slotMinTime:"00:00:00",slotMaxTime:"24:00:00",showNonCurrentDates:!0,lazyFetching:!0,startParam:"start",endParam:"end",timeZoneParam:"timeZone",timeZone:"local",locales:[],locale:"",themeSystem:"standard",dragRevertDuration:500,dragScroll:!0,allDayMaintainDuration:!1,unselectAuto:!0,dropAccept:"*",eventOrder:"start,-duration,allDay,title",dayPopoverFormat:{month:"long",day:"numeric",year:"numeric"},handleWindowResize:!0,windowResizeDelay:100,longPressDelay:1e3,eventDragMinDistance:5,expandRows:!1,navLinks:!1,selectable:!1,eventMinHeight:15,eventMinWidth:30,eventShortHeight:30,monthStartFormat:{month:"long",day:"numeric"},nowIndicatorSnap:"auto"},n4={datesSet:j,eventsSet:j,eventAdd:j,eventChange:j,eventRemove:j,windowResize:j,eventClick:j,eventMouseEnter:j,eventMouseLeave:j,select:j,unselect:j,loading:j,_unmount:j,_beforeprint:j,_afterprint:j,_noEventDrop:j,_noEventResize:j,_resize:j,_scrollRequest:j},i4={buttonText:j,buttonHints:j,views:j,plugins:j,initialEvents:j,events:j,eventSources:j},Am={headerToolbar:eg,footerToolbar:eg,buttonText:eg,buttonHints:eg,buttonIcons:eg,dateIncrement:eg,plugins:_R,events:_R,eventSources:_R,resources:_R};vDe={type:String,component:j,buttonText:String,buttonTextKey:String,dateProfileGeneratorClass:j,usesMinMaxTime:Boolean,classNames:j,content:j,didMount:j,willUnmount:j};({hasOwnProperty:$R}=Object.prototype);Zst=/^on[A-Z]/;TDe={};FW=class{getMarkerYear(e){return e.getUTCFullYear()}getMarkerMonth(e){return e.getUTCMonth()}getMarkerDay(e){return e.getUTCDate()}arrayToMarker(e){return ds(e)}markerToArray(e){return Em(e)}};eot("gregory",FW);rot=/^\s*(\d{4})(-?(\d{2})(-?(\d{2})([T ](\d{2}):?(\d{2})(:?(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/;OC=class{constructor(e){let t=this.timeZone=e.timeZone,n=t!=="local"&&t!=="UTC";e.namedTimeZoneImpl&&n&&(this.namedTimeZoneImpl=new e.namedTimeZoneImpl(t)),this.canComputeOffset=!!(!n||this.namedTimeZoneImpl),this.calendarSystem=tot(e.calendarSystem),this.locale=e.locale,this.weekDow=e.locale.week.dow,this.weekDoy=e.locale.week.doy,e.weekNumberCalculation==="ISO"&&(this.weekDow=1,this.weekDoy=4),typeof e.firstDay=="number"&&(this.weekDow=e.firstDay),typeof e.weekNumberCalculation=="function"&&(this.weekNumberFunc=e.weekNumberCalculation),this.weekText=e.weekText!=null?e.weekText:e.locale.options.weekText,this.weekTextLong=(e.weekTextLong!=null?e.weekTextLong:e.locale.options.weekTextLong)||this.weekText,this.cmdFormatter=e.cmdFormatter,this.defaultSeparator=e.defaultSeparator}createMarker(e){let t=this.createMarkerMeta(e);return t===null?null:t.marker}createNowMarker(){return this.canComputeOffset?this.timestampToMarker(new Date().valueOf()):ds(ZCe(new Date))}createMarkerMeta(e){if(typeof e=="string")return this.parse(e);let t=null;return typeof e=="number"?t=this.timestampToMarker(e):e instanceof Date?(e=e.valueOf(),isNaN(e)||(t=this.timestampToMarker(e))):Array.isArray(e)&&(t=ds(e)),t===null||!XW(t)?null:{marker:t,isTimeUnspecified:!1,forcedTzo:null}}parse(e){let t=kDe(e);if(t===null)return null;let{marker:n}=t,i=null;return t.timeZoneOffset!==null&&(this.canComputeOffset?n=this.timestampToMarker(n.valueOf()-t.timeZoneOffset*60*1e3):i=t.timeZoneOffset),{marker:n,isTimeUnspecified:t.isTimeUnspecified,forcedTzo:i}}getYear(e){return this.calendarSystem.getMarkerYear(e)}getMonth(e){return this.calendarSystem.getMarkerMonth(e)}getDay(e){return this.calendarSystem.getMarkerDay(e)}add(e,t){let n=this.calendarSystem.markerToArray(e);return n[0]+=t.years,n[1]+=t.months,n[2]+=t.days,n[6]+=t.milliseconds,this.calendarSystem.arrayToMarker(n)}subtract(e,t){let n=this.calendarSystem.markerToArray(e);return n[0]-=t.years,n[1]-=t.months,n[2]-=t.days,n[6]-=t.milliseconds,this.calendarSystem.arrayToMarker(n)}addYears(e,t){let n=this.calendarSystem.markerToArray(e);return n[0]+=t,this.calendarSystem.arrayToMarker(n)}addMonths(e,t){let n=this.calendarSystem.markerToArray(e);return n[1]+=t,this.calendarSystem.arrayToMarker(n)}diffWholeYears(e,t){let{calendarSystem:n}=this;return xm(e)===xm(t)&&n.getMarkerDay(e)===n.getMarkerDay(t)&&n.getMarkerMonth(e)===n.getMarkerMonth(t)?n.getMarkerYear(t)-n.getMarkerYear(e):null}diffWholeMonths(e,t){let{calendarSystem:n}=this;return xm(e)===xm(t)&&n.getMarkerDay(e)===n.getMarkerDay(t)?n.getMarkerMonth(t)-n.getMarkerMonth(e)+(n.getMarkerYear(t)-n.getMarkerYear(e))*12:null}greatestWholeUnit(e,t){let n=this.diffWholeYears(e,t);return n!==null?{unit:"year",value:n}:(n=this.diffWholeMonths(e,t),n!==null?{unit:"month",value:n}:(n=yDe(e,t),n!==null?{unit:"week",value:n}:(n=lT(e,t),n!==null?{unit:"day",value:n}:(n=_st(e,t),NC(n)?{unit:"hour",value:n}:(n=Ast(e,t),NC(n)?{unit:"minute",value:n}:(n=Ist(e,t),NC(n)?{unit:"second",value:n}:{unit:"millisecond",value:t.valueOf()-e.valueOf()}))))))}countDurationsBetween(e,t,n){let i;return n.years&&(i=this.diffWholeYears(e,t),i!==null)?i/Dst(n):n.months&&(i=this.diffWholeMonths(e,t),i!==null)?i/Pst(n):n.days&&(i=lT(e,t),i!==null)?i/oT(n):(t.valueOf()-e.valueOf())/to(n)}startOf(e,t){return t==="year"?this.startOfYear(e):t==="month"?this.startOfMonth(e):t==="week"?this.startOfWeek(e):t==="day"?pr(e):t==="hour"?Nst(e):t==="minute"?Rst(e):t==="second"?Ost(e):null}startOfYear(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e)])}startOfMonth(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e),this.calendarSystem.getMarkerMonth(e)])}startOfWeek(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e),this.calendarSystem.getMarkerMonth(e),e.getUTCDate()-(e.getUTCDay()-this.weekDow+7)%7])}computeWeekNumber(e){return this.weekNumberFunc?this.weekNumberFunc(this.toDate(e)):Lst(e,this.weekDow,this.weekDoy)}format(e,t,n={}){return t.format({marker:e,timeZoneOffset:n.forcedTzo!=null?n.forcedTzo:this.offsetForMarker(e)},this)}formatRange(e,t,n,i={}){return i.isEndExclusive&&(t=Gc(t,-1)),n.formatRange({marker:e,timeZoneOffset:i.forcedStartTzo!=null?i.forcedStartTzo:this.offsetForMarker(e)},{marker:t,timeZoneOffset:i.forcedEndTzo!=null?i.forcedEndTzo:this.offsetForMarker(t)},this,i.defaultSeparator)}formatIso(e,t={}){let n=null;return t.omitTimeZoneOffset||(t.forcedTzo!=null?n=t.forcedTzo:n=this.offsetForMarker(e)),GR(e,n,t.omitTime)}timestampToMarker(e){return this.timeZone==="local"?ds(ZCe(new Date(e))):this.timeZone==="UTC"||!this.namedTimeZoneImpl?new Date(e):ds(this.namedTimeZoneImpl.timestampToArray(e))}offsetForMarker(e){return this.timeZone==="local"?-QCe(Em(e)).getTimezoneOffset():this.timeZone==="UTC"?0:this.namedTimeZoneImpl?this.namedTimeZoneImpl.offsetForArray(Em(e)):null}toDate(e,t){return this.timeZone==="local"?QCe(Em(e)):this.timeZone==="UTC"?new Date(e.valueOf()):this.namedTimeZoneImpl?new Date(e.valueOf()-this.namedTimeZoneImpl.offsetForArray(Em(e))*1e3*60):new Date(e.valueOf()-(t||0))}},Nu=class{constructor(e){this.iconOverrideOption&&this.setIconOverride(e[this.iconOverrideOption])}setIconOverride(e){let t,n;if(typeof e=="object"&&e){t=Object.assign({},this.iconClasses);for(n in e)t[n]=this.applyIconOverridePrefix(e[n]);this.iconClasses=t}else e===!1&&(this.iconClasses={})}applyIconOverridePrefix(e){let t=this.iconOverridePrefix;return t&&e.indexOf(t)!==0&&(e=t+e),e}getClass(e){return this.classes[e]||""}getIconClass(e,t){let n;return t&&this.rtlIconClasses?n=this.rtlIconClasses[e]||this.iconClasses[e]:n=this.iconClasses[e],n?`${this.baseIconClass} ${n}`:""}getCustomButtonIconClass(e){let t;return this.iconOverrideCustomButtonOption&&(t=e[this.iconOverrideCustomButtonOption],t)?`${this.baseIconClass} ${this.applyIconOverridePrefix(t)}`:""}};Nu.prototype.classes={};Nu.prototype.iconClasses={};Nu.prototype.baseIconClass="";Nu.prototype.iconOverridePrefix="";$W=class extends ji{render(){return M("div",{})}componentDidMount(){this.setState({})}};zR=class{constructor(e,t,n,i){this.execFunc=e,this.emitter=t,this.scrollTime=n,this.scrollTimeReset=i,this.handleScrollRequest=a=>{this.queuedRequest=Object.assign({},this.queuedRequest||{},a),this.drain()},t.on("_scrollRequest",this.handleScrollRequest),this.fireInitialScroll()}detach(){this.emitter.off("_scrollRequest",this.handleScrollRequest)}update(e){e&&this.scrollTimeReset?this.fireInitialScroll():this.drain()}fireInitialScroll(){this.handleScrollRequest({time:this.scrollTime})}drain(){this.queuedRequest&&this.execFunc(this.queuedRequest)&&(this.queuedRequest=null)}},Ho=wDe({});Kc=class extends ji{shouldComponentUpdate(e,t){return!RR(this.props,e,this.propEquality)||!RR(this.state,t,this.stateEquality)}safeSetState(e){RR(this.state,Object.assign(Object.assign({},this.state),e),this.stateEquality)||this.setState(e)}};Kc.addPropsEquality=not;Kc.addStateEquality=iot;Kc.contextType=Ho;Kc.prototype.propEquality={};Kc.prototype.stateEquality={};wt=class extends Kc{};wt.contextType=Ho;FC=class extends wt{constructor(){super(...arguments),this.id=Fu(),this.queuedDomNodes=[],this.currentDomNodes=[],this.handleEl=e=>{let{options:t}=this.context,{generatorName:n}=this.props;(!t.customRenderingReplaces||!zW(n,t))&&this.updateElRef(e)},this.updateElRef=e=>{this.props.elRef&&no(this.props.elRef,e)}}render(){let{props:e,context:t}=this,{options:n}=t,{customGenerator:i,defaultGenerator:a,renderProps:s}=e,o=s4(e,[],this.handleEl),l=!1,c,d=[],u;if(i!=null){let p=typeof i=="function"?i(s,M):i;if(p===!0)l=!0;else{let m=p&&typeof p=="object";m&&"html"in p?o.dangerouslySetInnerHTML={__html:p.html}:m&&"domNodes"in p?d=Array.prototype.slice.call(p.domNodes):(m?hW(p):typeof p!="function")?c=p:u=p}}else l=!zW(e.generatorName,n);return l&&a&&(c=a(s)),this.queuedDomNodes=d,this.currentGeneratorMeta=u,M(e.elTag,o,c)}componentDidMount(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentDidUpdate(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentWillUnmount(){this.triggerCustomRendering(!1)}triggerCustomRendering(e){var t;let{props:n,context:i}=this,{handleCustomRendering:a,customRenderingMetaMap:s}=i.options;if(a){let o=(t=this.currentGeneratorMeta)!==null&&t!==void 0?t:s==null?void 0:s[n.generatorName];o&&a(Object.assign(Object.assign({id:this.id,isActive:e,containerEl:this.base,reportNewContainerEl:this.updateElRef,generatorMeta:o},n),{elClasses:(n.elClasses||[]).filter(aot)}))}}applyQueueudDomNodes(){let{queuedDomNodes:e,currentDomNodes:t}=this,n=this.base;if(!Jc(e,t)){t.forEach(GC);for(let i of e)n.appendChild(i);this.currentDomNodes=e}}};FC.addPropsEquality({elClasses:Jc,elStyle:ua,elAttrs:Qst,renderProps:ua});o4=wDe(0),In=class extends ji{constructor(){super(...arguments),this.InnerContent=sot.bind(void 0,this),this.handleEl=e=>{this.el=e,this.props.elRef&&(no(this.props.elRef,e),e&&this.didMountMisfire&&this.componentDidMount())}}render(){let{props:e}=this,t=oot(e.classNameGenerator,e.renderProps);if(e.children){let n=s4(e,t,this.handleEl),i=e.children(this.InnerContent,e.renderProps,n);return e.elTag?M(e.elTag,n,i):i}else return M(FC,Object.assign(Object.assign({},e),{elRef:this.handleEl,elTag:e.elTag||"div",elClasses:(e.elClasses||[]).concat(t),renderId:this.context}))}componentDidMount(){var e,t;this.el?(t=(e=this.props).didMount)===null||t===void 0||t.call(e,Object.assign(Object.assign({},this.props.renderProps),{el:this.el})):this.didMountMisfire=!0}componentWillUnmount(){var e,t;(t=(e=this.props).willUnmount)===null||t===void 0||t.call(e,Object.assign(Object.assign({},this.props.renderProps),{el:this.el}))}};In.contextType=o4;ro=class extends wt{render(){let{props:e,context:t}=this,{options:n}=t,i={view:t.viewApi};return M(In,{elRef:e.elRef,elTag:e.elTag||"div",elAttrs:e.elAttrs,elClasses:[...l4(e.viewSpec),...e.elClasses||[]],elStyle:e.elStyle,renderProps:i,classNameGenerator:n.viewClassNames,generatorName:void 0,didMount:n.viewDidMount,willUnmount:n.viewWillUnmount},()=>e.children)}};ng=class{constructor(e){this.props=e,this.initHiddenDays()}buildPrev(e,t,n){let{dateEnv:i}=this.props,a=i.subtract(i.startOf(t,e.currentRangeUnit),e.dateIncrement);return this.build(a,-1,n)}buildNext(e,t,n){let{dateEnv:i}=this.props,a=i.add(i.startOf(t,e.currentRangeUnit),e.dateIncrement);return this.build(a,1,n)}build(e,t,n=!0){let{props:i}=this,a,s,o,l,c,d;return a=this.buildValidRange(),a=this.trimHiddenDays(a),n&&(e=dot(e,a)),s=this.buildCurrentRangeInfo(e,t),o=/^(year|month|week|day)$/.test(s.unit),l=this.buildRenderRange(this.trimHiddenDays(s.range),s.unit,o),l=this.trimHiddenDays(l),c=l,i.showNonCurrentDates||(c=$a(c,s.range)),c=this.adjustActiveRange(c),c=$a(c,a),d=JR(s.range,a),Bo(l,e)||(e=l.start),{currentDate:e,validRange:a,currentRange:s.range,currentRangeUnit:s.unit,isRangeAllDay:o,activeRange:c,renderRange:l,slotMinTime:i.slotMinTime,slotMaxTime:i.slotMaxTime,isValid:d,dateIncrement:this.buildDateIncrement(s.duration)}}buildValidRange(){let e=this.props.validRangeInput,t=typeof e=="function"?e.call(this.props.calendarApi,this.props.dateEnv.toDate(this.props.nowManager.getDateMarker())):e;return this.refineRange(t)||{start:null,end:null}}buildCurrentRangeInfo(e,t){let{props:n}=this,i=null,a=null,s=null,o;return n.duration?(i=n.duration,a=n.durationUnit,s=this.buildRangeFromDuration(e,t,i,a)):(o=this.props.dayCount)?(a="day",s=this.buildRangeFromDayCount(e,t,o)):(s=this.buildCustomVisibleRange(e))?a=n.dateEnv.greatestWholeUnit(s.start,s.end).unit:(i=this.getFallbackDuration(),a=RC(i).unit,s=this.buildRangeFromDuration(e,t,i,a)),{duration:i,unit:a,range:s}}getFallbackDuration(){return ct({day:1})}adjustActiveRange(e){let{dateEnv:t,usesMinMaxTime:n,slotMinTime:i,slotMaxTime:a}=this.props,{start:s,end:o}=e;return n&&(oT(i)<0&&(s=pr(s),s=t.add(s,i)),oT(a)>1&&(o=pr(o),o=un(o,-1),o=t.add(o,a))),{start:s,end:o}}buildRangeFromDuration(e,t,n,i){let{dateEnv:a,dateAlignment:s}=this.props,o,l,c;if(!s){let{dateIncrement:u}=this.props;u&&to(u){LC(()=>{this.setState({forPrint:!0})})},this.handleAfterPrint=()=>{LC(()=>{this.setState({forPrint:!1})})}}render(){let{props:e}=this,{options:t}=e,{forPrint:n}=this.state,i=n||t.height==="auto"||t.contentHeight==="auto",a=!i&&t.height!=null?t.height:"",s=["fc",n?"fc-media-print":"fc-media-screen",`fc-direction-${t.direction}`,e.theme.getClass("root")];return w4()||s.push("fc-liquid-hack"),e.children(s,a,i,n)}componentDidMount(){let{emitter:e}=this.props;e.on("_beforeprint",this.handleBeforePrint),e.on("_afterprint",this.handleAfterPrint)}componentWillUnmount(){let{emitter:e}=this.props;e.off("_beforeprint",this.handleBeforePrint),e.off("_afterprint",this.handleAfterPrint)}},zl=class{constructor(e){this.component=e.component,this.isHitComboAllowed=e.isHitComboAllowed||null}destroy(){}};hg={},us=class extends ji{constructor(e,t){super(e,t),this.handleRefresh=()=>{let n=this.computeTiming();n.state.nowDate.valueOf()!==this.state.nowDate.valueOf()&&this.setState(n.state),this.clearTimeout(),this.setTimeout(n.waitMs)},this.handleVisibilityChange=()=>{document.hidden||this.handleRefresh()},this.state=this.computeTiming().state}render(){let{props:e,state:t}=this;return e.children(t.nowDate,t.todayRange)}componentDidMount(){this.setTimeout(),this.context.nowManager.addResetListener(this.handleRefresh),document.addEventListener("visibilitychange",this.handleVisibilityChange)}componentDidUpdate(e){e.unit!==this.props.unit&&(this.clearTimeout(),this.setTimeout())}componentWillUnmount(){this.clearTimeout(),this.context.nowManager.removeResetListener(this.handleRefresh),document.removeEventListener("visibilitychange",this.handleVisibilityChange)}computeTiming(){let{props:e,context:t}=this,n=t.nowManager.getDateMarker(),{nowIndicatorSnap:i}=t.options;i==="auto"&&(i=/year|month|week|day/.test(e.unit)||(e.unitValue||1)===1);let a,s;return i?(a=t.dateEnv.startOf(n,e.unit),s=t.dateEnv.add(a,ct(1,e.unit)).valueOf()-n.valueOf()):(a=n,s=1e3*60),s=Math.min(1e3*60*60*24,s),{state:{nowDate:a,todayRange:Yot(a)},waitMs:s}}setTimeout(e=this.computeTiming().waitMs){this.timeoutId=setTimeout(()=>{let t=this.computeTiming();this.setState(t.state,()=>{this.setTimeout(t.waitMs)})},e)}clearTimeout(){this.timeoutId&&clearTimeout(this.timeoutId)}};us.contextType=Ho;BC=class{getCurrentData(){return this.currentDataManager.getCurrentData()}dispatch(e){this.currentDataManager.dispatch(e)}get view(){return this.getCurrentData().viewApi}batchRendering(e){e()}updateSize(){this.trigger("_resize",!0)}setOption(e,t){this.dispatch({type:"SET_OPTION",optionName:e,rawOptionValue:t})}getOption(e){return this.currentDataManager.currentCalendarOptionsInput[e]}getAvailableLocaleCodes(){return Object.keys(this.getCurrentData().availableRawLocales)}on(e,t){let{currentDataManager:n}=this;n.currentCalendarOptionsRefiners[e]?n.emitter.on(e,t):console.warn(`Unknown listener name '${e}'`)}off(e,t){this.currentDataManager.emitter.off(e,t)}trigger(e,...t){this.currentDataManager.emitter.trigger(e,...t)}changeView(e,t){this.batchRendering(()=>{if(this.unselect(),t)if(t.start&&t.end)this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e}),this.dispatch({type:"SET_OPTION",optionName:"visibleRange",rawOptionValue:t});else{let{dateEnv:n}=this.getCurrentData();this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e,dateMarker:n.createMarker(t)})}else this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e})})}zoomTo(e,t){let n=this.getCurrentData(),i;t=t||"day",i=n.viewSpecs[t]||this.getUnitViewSpec(t),this.unselect(),i?this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:i.type,dateMarker:e}):this.dispatch({type:"CHANGE_DATE",dateMarker:e})}getUnitViewSpec(e){let{viewSpecs:t,toolbarConfig:n}=this.getCurrentData(),i=[].concat(n.header?n.header.viewsWithButtons:[],n.footer?n.footer.viewsWithButtons:[]),a,s;for(let o in t)i.push(o);for(a=0;a{this.dispatch({type:"REMOVE_EVENTS",eventStore:ADe(e)})}})}getEventById(e){let t=this.getCurrentData(),{defs:n,instances:i}=t.eventStore;e=String(e);for(let a in n){let s=n[a];if(s.publicId===e){if(s.recurringDef)return new Nr(t,s,null);for(let o in i){let l=i[o];if(l.defId===s.defId)return new Nr(t,s,l)}}}return null}getEvents(){let e=this.getCurrentData();return td(e.eventStore,e)}removeAllEvents(){this.dispatch({type:"REMOVE_ALL_EVENTS"})}getEventSources(){let e=this.getCurrentData(),t=e.eventSources,n=[];for(let i in t)n.push(new Sm(e,t[i]));return n}getEventSourceById(e){let t=this.getCurrentData(),n=t.eventSources;e=String(e);for(let i in n)if(n[i].publicId===e)return new Sm(t,n[i]);return null}addEventSource(e){let t=this.getCurrentData();if(e instanceof Sm)return t.eventSources[e.internalEventSource.sourceId]||this.dispatch({type:"ADD_EVENT_SOURCES",sources:[e.internalEventSource]}),e;let n=p4(e,t);return n?(this.dispatch({type:"ADD_EVENT_SOURCES",sources:[n]}),new Sm(t,n)):null}removeAllEventSources(){this.dispatch({type:"REMOVE_ALL_EVENT_SOURCES"})}refetchEvents(){this.dispatch({type:"FETCH_EVENT_SOURCES",isRefetch:!0})}scrollToTime(e){let t=ct(e);t&&this.trigger("_scrollRequest",{time:t})}};DW=mi(),UC=class{constructor(){this.getKeysForEventDefs=Me(this._getKeysForEventDefs),this.splitDateSelection=Me(this._splitDateSpan),this.splitEventStore=Me(this._splitEventStore),this.splitIndividualUi=Me(this._splitIndividualUi),this.splitEventDrag=Me(this._splitInteraction),this.splitEventResize=Me(this._splitInteraction),this.eventUiBuilders={}}splitProps(e){let t=this.getKeyInfo(e),n=this.getKeysForEventDefs(e.eventStore),i=this.splitDateSelection(e.dateSelection),a=this.splitIndividualUi(e.eventUiBases,n),s=this.splitEventStore(e.eventStore,n),o=this.splitEventDrag(e.eventDrag),l=this.splitEventResize(e.eventResize),c={};this.eventUiBuilders=Uo(t,(d,u)=>this.eventUiBuilders[u]||Me(Got));for(let d in t){let u=t[d],p=s[d]||DW,m=this.eventUiBuilders[d];c[d]={businessHours:u.businessHours||e.businessHours,dateSelection:i[d]||null,eventStore:p,eventUiBases:m(e.eventUiBases[""],u.ui,a[d]),eventSelection:p.instances[e.eventSelection]?e.eventSelection:"",eventDrag:o[d]||null,eventResize:l[d]||null}}return c}_splitDateSpan(e){let t={};if(e){let n=this.getKeysForDateSpan(e);for(let i of n)t[i]=e}return t}_getKeysForEventDefs(e){return Uo(e.defs,t=>this.getKeysForEventDef(t))}_splitEventStore(e,t){let{defs:n,instances:i}=e,a={};for(let s in n)for(let o of t[s])a[o]||(a[o]=mi()),a[o].defs[s]=n[s];for(let s in i){let o=i[s];for(let l of t[o.defId])a[l]&&(a[l].instances[s]=o)}return a}_splitIndividualUi(e,t){let n={};for(let i in e)if(i)for(let a of t[i])n[a]||(n[a]={}),n[a][i]=e[i];return n}_splitInteraction(e){let t={};if(e){let n=this._splitEventStore(e.affectedEvents,this._getKeysForEventDefs(e.affectedEvents)),i=this._getKeysForEventDefs(e.mutatedEvents),a=this._splitEventStore(e.mutatedEvents,i),s=o=>{t[o]||(t[o]={affectedEvents:n[o]||DW,mutatedEvents:a[o]||DW,isEvent:e.isEvent})};for(let o in n)s(o);for(let o in a)s(o)}return t}};Kot=Gt({year:"numeric",month:"long",day:"numeric"}),Zot=Gt({week:"long"});PW=null;jl=class{constructor(e,t,n,i){this.els=t;let a=this.originClientRect=e.getBoundingClientRect();n&&this.buildElHorizontals(a.left),i&&this.buildElVerticals(a.top)}buildElHorizontals(e){let t=[],n=[];for(let i of this.els){let a=i.getBoundingClientRect();t.push(a.left-e),n.push(a.right-e)}this.lefts=t,this.rights=n}buildElVerticals(e){let t=[],n=[];for(let i of this.els){let a=i.getBoundingClientRect();t.push(a.top-e),n.push(a.bottom-e)}this.tops=t,this.bottoms=n}leftToIndex(e){let{lefts:t,rights:n}=this,i=t.length,a;for(a=0;a=t[a]&&e=t[a]&&e0}canScrollHorizontally(){return this.getMaxScrollLeft()>0}canScrollUp(){return this.getScrollTop()>0}canScrollDown(){return this.getScrollTop()0}canScrollRight(){return this.getScrollLeft()t.thickness||1){this.getEntryThickness=e,this.strictOrder=!1,this.allowReslicing=!1,this.maxCoord=-1,this.maxStackCnt=-1,this.levelCoords=[],this.entriesByLevel=[],this.stackCnts={}}addSegs(e){let t=[];for(let n of e)this.insertEntry(n,t);return t}insertEntry(e,t){let n=this.findInsertion(e);this.isInsertionValid(n,e)?this.insertEntryAt(e,n):this.handleInvalidInsertion(n,e,t)}isInsertionValid(e,t){return(this.maxCoord===-1||e.levelCoord+this.getEntryThickness(t)<=this.maxCoord)&&(this.maxStackCnt===-1||e.stackCnta.end&&this.insertEntry({index:e.index,thickness:e.thickness,span:{start:a.end,end:i.end}},n)}insertEntryAt(e,t){let{entriesByLevel:n,levelCoords:i}=this;t.lateral===-1?(_W(i,t.level,t.levelCoord),_W(n,t.level,[e])):_W(n[t.level],t.lateral,e),this.stackCnts[Zc(e)]=t.stackCnt}findInsertion(e){let{levelCoords:t,entriesByLevel:n,strictOrder:i,stackCnts:a}=this,s=t.length,o=0,l=-1,c=-1,d=null,u=0;for(let f=0;f=o+this.getEntryThickness(e))break;let g=n[f],v,k=WC(g,e.span.start,qC),b=k[0]+k[1];for(;(v=g[b])&&v.span.starto&&(o=w,d=v,l=f,c=b),w===o&&(u=Math.max(u,a[Zc(v)]+1)),b+=1}}let p=0;if(d)for(p=l+1;p1?rd(this.context,s):{},p=e.toDate(s);e.namedTimeZoneImpl&&(p=Gc(p,36e5));let m=Object.assign(Object.assign(Object.assign({date:p,view:i},a.extraRenderProps),{text:d}),l);return M(In,{elTag:"th",elClasses:c,elAttrs:Object.assign({role:"columnheader",colSpan:a.colSpan,"data-date":l.isDisabled?void 0:_m(s)},a.extraDataAttrs),renderProps:m,generatorName:"dayHeaderContent",customGenerator:t.dayHeaderContent,defaultGenerator:BDe,classNameGenerator:t.dayHeaderClassNames,didMount:t.dayHeaderDidMount,willUnmount:t.dayHeaderWillUnmount},f=>M("div",{className:"fc-scrollgrid-sync-inner"},!l.isDisabled&&M(f,{elTag:"a",elAttrs:u,elClasses:["fc-col-header-cell-cushion",a.isSticky&&"fc-sticky"]})))}},rlt=Gt({weekday:"long"}),VR=class extends wt{render(){let{props:e}=this,{dateEnv:t,theme:n,viewApi:i,options:a}=this.context,s=un(new Date(2592e5),e.dow),o={dow:e.dow,isDisabled:!1,isFuture:!1,isPast:!1,isToday:!1,isOther:!1},l=t.format(s,e.dayHeaderFormat),c=Object.assign(Object.assign(Object.assign(Object.assign({date:s},o),{view:i}),e.extraRenderProps),{text:l});return M(In,{elTag:"th",elClasses:[jDe,...kT(o,n),...e.extraClassNames||[]],elAttrs:Object.assign({role:"columnheader",colSpan:e.colSpan},e.extraDataAttrs),renderProps:c,generatorName:"dayHeaderContent",customGenerator:a.dayHeaderContent,defaultGenerator:BDe,classNameGenerator:a.dayHeaderClassNames,didMount:a.dayHeaderDidMount,willUnmount:a.dayHeaderWillUnmount},d=>M("div",{className:"fc-scrollgrid-sync-inner"},M(d,{elTag:"a",elClasses:["fc-col-header-cell-cushion",e.isSticky&&"fc-sticky"],elAttrs:{"aria-label":t.format(s,rlt)}})))}},Ou=class extends wt{constructor(){super(...arguments),this.createDayHeaderFormatter=Me(nlt)}render(){let{context:e}=this,{dates:t,dateProfile:n,datesRepDistinctDays:i,renderIntro:a}=this.props,s=this.createDayHeaderFormatter(e.options.dayHeaderFormat,i,t.length);return M(us,{unit:"day"},(o,l)=>M("tr",{role:"row"},a&&a("day"),t.map(c=>i?M(HR,{key:c.toISOString(),date:c,dateProfile:n,todayRange:l,colCnt:t.length,dayHeaderFormat:s}):M(VR,{key:c.getUTCDay(),dow:c.getUTCDay(),dayHeaderFormat:s}))))}};lg=class{constructor(e,t){let n=e.start,{end:i}=e,a=[],s=[],o=-1;for(;n=t.length?t[t.length-1]+1:t[n]}},cg=class{constructor(e,t){let{dates:n}=e,i,a,s;if(t){for(a=n[0].getUTCDay(),i=1;i{this.el=e,no(this.props.elRef,e)}}render(){let{props:e}=this,{liquid:t,liquidIsAbsolute:n}=e,i=t&&n,a=["fc-scroller"];return t&&(n?a.push("fc-scroller-liquid-absolute"):a.push("fc-scroller-liquid")),M("div",{ref:this.handleEl,className:a.join(" "),style:{overflowX:e.overflowX,overflowY:e.overflowY,left:i&&-(e.overcomeLeft||0)||"",right:i&&-(e.overcomeRight||0)||"",bottom:i&&-(e.overcomeBottom||0)||"",marginLeft:!i&&-(e.overcomeLeft||0)||"",marginRight:!i&&-(e.overcomeRight||0)||"",marginBottom:!i&&-(e.overcomeBottom||0)||"",maxHeight:e.maxHeight||""}},e.children)}needsXScrolling(){if(NR.test(this.props.overflowX))return!1;let{el:e}=this,t=this.el.getBoundingClientRect().width-this.getYScrollbarWidth(),{children:n}=e;for(let i=0;it)return!0;return!1}needsYScrolling(){if(NR.test(this.props.overflowY))return!1;let{el:e}=this,t=this.el.getBoundingClientRect().height-this.getXScrollbarWidth(),{children:n}=e;for(let i=0;it)return!0;return!1}getXScrollbarWidth(){return NR.test(this.props.overflowX)?0:this.el.offsetHeight-this.el.clientHeight}getYScrollbarWidth(){return NR.test(this.props.overflowY)?0:this.el.offsetWidth-this.el.clientWidth}},ps=class{constructor(e){this.masterCallback=e,this.currentMap={},this.depths={},this.callbackMap={},this.handleValue=(t,n)=>{let{depths:i,currentMap:a}=this,s=!1,o=!1;t!==null?(s=n in a,a[n]=t,i[n]=(i[n]||0)+1,o=!0):(i[n]-=1,i[n]||(delete a[n],delete this.callbackMap[n],s=!0)),this.masterCallback&&(s&&this.masterCallback(null,String(n)),o&&this.masterCallback(t,String(n)))}}createRef(e){let t=this.callbackMap[e];return t||(t=this.callbackMap[e]=n=>{this.handleValue(n,String(e))}),t}collect(e,t,n){return bDe(this.currentMap,e,t,n)}getAll(){return QR(this.currentMap)}};Dm=class extends wt{constructor(){super(...arguments),this.processCols=Me(e=>e,GDe),this.renderMicroColGroup=Me(KDe),this.scrollerRefs=new ps,this.scrollerElRefs=new ps(this._handleScrollerEl.bind(this)),this.state={shrinkWidth:null,forceYScrollbars:!1,scrollerClientWidths:{},scrollerClientHeights:{}},this.handleSizing=()=>{this.safeSetState(Object.assign({shrinkWidth:this.computeShrinkWidth()},this.computeScrollerDims()))}}render(){let{props:e,state:t,context:n}=this,i=e.sections||[],a=this.processCols(e.cols),s=this.renderMicroColGroup(a,t.shrinkWidth),o=JDe(e.liquid,n);e.collapsibleWidth&&o.push("fc-scrollgrid-collapsible");let l=i.length,c=0,d,u=[],p=[],m=[];for(;c{}},i);return M(i?"th":"td",{ref:n.elRef,role:"presentation"},M("div",{className:`fc-scroller-harness${d?" fc-scroller-harness-liquid":""}`},M(uT,{ref:this.scrollerRefs.createRef(p),elRef:this.scrollerElRefs.createRef(p),overflowY:u,overflowX:a.liquid?"hidden":"visible",maxHeight:e.maxHeight,liquid:d,liquidIsAbsolute:!0},m)))}_handleScrollerEl(e,t){let n=llt(this.props.sections,t);n&&no(n.chunk.scrollerElRef,e)}componentDidMount(){this.handleSizing(),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(){this.handleSizing()}componentWillUnmount(){this.context.removeResizeHandler(this.handleSizing)}computeShrinkWidth(){return QDe(this.props.cols)?qDe(this.scrollerElRefs.getAll()):0}computeScrollerDims(){let e=LDe(),{scrollerRefs:t,scrollerElRefs:n}=this,i=!1,a={},s={};for(let o in t.currentMap){let l=t.currentMap[o];if(l&&l.needsYScrolling()){i=!0;break}}for(let o of this.props.sections){let l=o.key,c=n.currentMap[l];if(c){let d=c.parentNode;a[l]=Math.floor(d.getBoundingClientRect().width-(i?e.y:0)),s[l]=Math.floor(d.getBoundingClientRect().height)}}return{forceYScrollbars:i,scrollerClientWidths:a,scrollerClientHeights:s}}};Dm.addStateEquality({scrollerClientWidths:ua,scrollerClientHeights:ua});Lu=class extends wt{constructor(){super(...arguments),this.buildPublicEvent=Me((e,t,n)=>new Nr(e,t,n)),this.handleEl=e=>{this.el=e,no(this.props.elRef,e),e&&rDe(e,this.props.seg)}}render(){let{props:e,context:t}=this,{options:n}=t,{seg:i}=e,{eventRange:a}=i,{ui:s}=a,o={event:this.buildPublicEvent(t,a.def,a.instance),view:t.viewApi,timeText:e.timeText,textColor:s.textColor,backgroundColor:s.backgroundColor,borderColor:s.borderColor,isDraggable:!e.disableDragging&&Lot(i,t),isStartResizable:!e.disableResizing&&Fot(i,t),isEndResizable:!e.disableResizing&&$ot(i),isMirror:!!(e.isDragging||e.isResizing||e.isDateSelecting),isStart:!!i.isStart,isEnd:!!i.isEnd,isPast:!!e.isPast,isFuture:!!e.isFuture,isToday:!!e.isToday,isSelected:!!e.isSelected,isDragging:!!e.isDragging,isResizing:!!e.isResizing};return M(In,{elRef:this.handleEl,elTag:e.elTag,elAttrs:e.elAttrs,elClasses:[...zot(o),...i.eventRange.ui.classNames,...e.elClasses||[]],elStyle:e.elStyle,renderProps:o,generatorName:"eventContent",customGenerator:n.eventContent,defaultGenerator:e.defaultGenerator,classNameGenerator:n.eventClassNames,didMount:n.eventDidMount,willUnmount:n.eventWillUnmount},e.children)}componentDidUpdate(e){this.el&&this.props.seg!==e.seg&&rDe(this.el,this.props.seg)}},Pm=class extends wt{render(){let{props:e,context:t}=this,{options:n}=t,{seg:i}=e,{ui:a}=i.eventRange,s=n.eventTimeFormat||e.defaultTimeFormat,o=Im(i,s,t,e.defaultDisplayEventTime,e.defaultDisplayEventEnd);return M(Lu,Object.assign({},e,{elTag:"a",elStyle:{borderColor:a.borderColor,backgroundColor:a.backgroundColor},elAttrs:TT(i,t),defaultGenerator:clt,timeText:o}),(l,c)=>M(Yt,null,M(l,{elTag:"div",elClasses:["fc-event-main"],elStyle:{color:c.textColor}}),!!c.isStartResizable&&M("div",{className:"fc-event-resizer fc-event-resizer-start"}),!!c.isEndResizable&&M("div",{className:"fc-event-resizer fc-event-resizer-end"})))}};Pm.addPropsEquality({seg:ua});dD=r=>M(Ho.Consumer,null,e=>{let{options:t}=e,n={isAxis:r.isAxis,date:e.dateEnv.toDate(r.date),view:e.viewApi};return M(In,{elRef:r.elRef,elTag:r.elTag||"div",elAttrs:r.elAttrs,elClasses:r.elClasses,elStyle:r.elStyle,renderProps:n,generatorName:"nowIndicatorContent",customGenerator:t.nowIndicatorContent,classNameGenerator:t.nowIndicatorClassNames,didMount:t.nowIndicatorDidMount,willUnmount:t.nowIndicatorWillUnmount},r.children)}),dlt=Gt({day:"numeric"}),Mm=class extends wt{constructor(){super(...arguments),this.refineRenderProps=gT(ult)}render(){let{props:e,context:t}=this,{options:n}=t,i=this.refineRenderProps({date:e.date,dateProfile:e.dateProfile,todayRange:e.todayRange,isMonthStart:e.isMonthStart||!1,showDayNumber:e.showDayNumber,extraRenderProps:e.extraRenderProps,viewApi:t.viewApi,dateEnv:t.dateEnv,monthStartFormat:n.monthStartFormat});return M(In,{elRef:e.elRef,elTag:e.elTag,elAttrs:Object.assign(Object.assign({},e.elAttrs),i.isDisabled?{}:{"data-date":_m(e.date)}),elClasses:[...kT(i,t.theme),...e.elClasses||[]],elStyle:e.elStyle,renderProps:i,generatorName:"dayCellContent",customGenerator:n.dayCellContent,defaultGenerator:e.defaultGenerator,classNameGenerator:i.isDisabled?void 0:n.dayCellClassNames,didMount:n.dayCellDidMount,willUnmount:n.dayCellWillUnmount},e.children)}};ug=class extends wt{render(){let{props:e}=this,{seg:t}=e;return M(Lu,{elTag:"div",elClasses:["fc-bg-event"],elStyle:{backgroundColor:t.eventRange.ui.backgroundColor},defaultGenerator:plt,seg:t,timeText:"",isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:!1,isPast:e.isPast,isFuture:e.isFuture,isToday:e.isToday,disableDragging:!0,disableResizing:!0})}};pD=r=>M(Ho.Consumer,null,e=>{let{dateEnv:t,options:n}=e,{date:i}=r,a=n.weekNumberFormat||r.defaultFormat,s=t.computeWeekNumber(i),o=t.format(i,a),l={num:s,text:o,date:i};return M(In,{elRef:r.elRef,elTag:r.elTag,elAttrs:r.elAttrs,elClasses:r.elClasses,elStyle:r.elStyle,renderProps:l,generatorName:"weekNumberContent",customGenerator:n.weekNumberContent,defaultGenerator:mlt,classNameGenerator:n.weekNumberClassNames,didMount:n.weekNumberDidMount,willUnmount:n.weekNumberWillUnmount},r.children)});IW=10,BW=class extends wt{constructor(){super(...arguments),this.state={titleId:ms()},this.handleRootEl=e=>{this.rootEl=e,this.props.elRef&&no(this.props.elRef,e)},this.handleDocumentMouseDown=e=>{let t=WR(e);this.rootEl.contains(t)||this.handleCloseClick()},this.handleDocumentKeyDown=e=>{e.key==="Escape"&&this.handleCloseClick()},this.handleCloseClick=()=>{let{onClose:e}=this.props;e&&e()}}render(){let{theme:e,options:t}=this.context,{props:n,state:i}=this,a=["fc-popover",e.getClass("popover")].concat(n.extraClassNames||[]);return wW(M("div",Object.assign({},n.extraAttrs,{id:n.id,className:a.join(" "),"aria-labelledby":i.titleId,ref:this.handleRootEl}),M("div",{className:"fc-popover-header "+e.getClass("popoverHeader")},M("span",{className:"fc-popover-title",id:i.titleId},n.title),M("span",{className:"fc-popover-close "+e.getIconClass("close"),title:t.closeHint,onClick:this.handleCloseClick})),M("div",{className:"fc-popover-body "+e.getClass("popoverContent")},n.children)),n.parentEl)}componentDidMount(){document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleDocumentKeyDown),this.updateSize()}componentWillUnmount(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleDocumentKeyDown)}updateSize(){let{isRtl:e}=this.context,{alignmentEl:t,alignGridTop:n}=this.props,{rootEl:i}=this,a=Xot(t);if(a){let s=i.getBoundingClientRect(),o=n?pi(t,".fc-scrollgrid").getBoundingClientRect().top:a.top,l=e?a.right-s.width:a.left;o=Math.max(o,IW),l=Math.min(l,document.documentElement.clientWidth-IW-s.width),l=Math.max(l,IW);let c=i.offsetParent.getBoundingClientRect();mg(i,{top:o-c.top,left:l-c.left})}}},UW=class extends Xn{constructor(){super(...arguments),this.handleRootEl=e=>{this.rootEl=e,e?this.context.registerInteractiveComponent(this,{el:e,useEventCenter:!1}):this.context.unregisterInteractiveComponent(this)}}render(){let{options:e,dateEnv:t}=this.context,{props:n}=this,{startDate:i,todayRange:a,dateProfile:s}=n,o=t.format(i,e.dayPopoverFormat);return M(Mm,{elRef:this.handleRootEl,date:i,dateProfile:s,todayRange:a},(l,c,d)=>M(BW,{elRef:d.ref,id:n.id,title:o,extraClassNames:["fc-more-popover"].concat(d.className||[]),extraAttrs:d,parentEl:n.parentEl,alignmentEl:n.alignmentEl,alignGridTop:n.alignGridTop,onClose:n.onClose},ET(e)&&M(l,{elTag:"div",elClasses:["fc-more-popover-misc"]}),n.children))}queryHit(e,t,n,i){let{rootEl:a,props:s}=this;return e>=0&&e=0&&t{this.linkEl=e,this.props.elRef&&no(this.props.elRef,e)},this.handleClick=e=>{let{props:t,context:n}=this,{moreLinkClick:i}=n.options,a=nDe(t).start;function s(o){let{def:l,instance:c,range:d}=o.eventRange;return{event:new Nr(n,l,c),start:n.dateEnv.toDate(d.start),end:n.dateEnv.toDate(d.end),isStart:o.isStart,isEnd:o.isEnd}}typeof i=="function"&&(i=i({date:a,allDay:!!t.allDayDate,allSegs:t.allSegs.map(s),hiddenSegs:t.hiddenSegs.map(s),jsEvent:e,view:n.viewApi})),!i||i==="popover"?this.setState({isPopoverOpen:!0}):typeof i=="string"&&n.calendarApi.zoomTo(a,i)},this.handlePopoverClose=()=>{this.setState({isPopoverOpen:!1})}}render(){let{props:e,state:t}=this;return M(Ho.Consumer,null,n=>{let{viewApi:i,options:a,calendarApi:s}=n,{moreLinkText:o}=a,{moreCnt:l}=e,c=nDe(e),d=typeof o=="function"?o.call(s,l):`+${l} ${o}`,u=fT(a.moreLinkHint,[l],d),p={num:l,shortText:`+${l}`,text:d,view:i};return M(Yt,null,!!e.moreCnt&&M(In,{elTag:e.elTag||"a",elRef:this.handleLinkEl,elClasses:[...e.elClasses||[],"fc-more-link"],elStyle:e.elStyle,elAttrs:Object.assign(Object.assign(Object.assign({},e.elAttrs),dDe(this.handleClick)),{title:u,"aria-expanded":t.isPopoverOpen,"aria-controls":t.isPopoverOpen?t.popoverId:""}),renderProps:p,generatorName:"moreLinkContent",customGenerator:a.moreLinkContent,defaultGenerator:e.defaultGenerator||flt,classNameGenerator:a.moreLinkClassNames,didMount:a.moreLinkDidMount,willUnmount:a.moreLinkWillUnmount},e.children),t.isPopoverOpen&&M(UW,{id:t.popoverId,startDate:c.start,endDate:c.end,dateProfile:e.dateProfile,todayRange:e.todayRange,extraDateSpan:e.extraDateSpan,parentEl:this.parentEl,alignmentEl:e.alignmentElRef?e.alignmentElRef.current:this.linkEl,alignGridTop:e.alignGridTop,forceTimed:e.forceTimed,onClose:this.handlePopoverClose},e.popoverContent()))})}componentDidMount(){this.updateParentEl()}componentDidUpdate(){this.updateParentEl()}updateParentEl(){this.linkEl&&(this.parentEl=pi(this.linkEl,".fc-view-harness"))}}});function blt(r){let e=r.length>0?r[0].code:"en",t=vlt.concat(r),n={en:oPe};for(let i of t)n[i.code]=i;return{map:n,defaultCode:e}}function lPe(r,e){return typeof r=="object"&&!Array.isArray(r)?cPe(r.code,[r.code],r):Tlt(r,e)}function Tlt(r,e){let t=[].concat(r||[]),n=klt(t,e)||oPe;return cPe(r,t,n)}function klt(r,e){for(let t=0;t0;i-=1){let a=n.slice(0,i).join("-");if(e[a])return e[a]}}return null}function cPe(r,e,t){let n=ZR([sPe,t],["buttonText"]);delete n.code;let{week:i}=n;return delete n.week,{codeArg:r,codes:e,week:i,simpleNumberFormat:new Intl.NumberFormat(r),options:n}}function pa(r){return{id:Fu(),name:r.name,premiumReleaseDate:r.premiumReleaseDate?new Date(r.premiumReleaseDate):void 0,deps:r.deps||[],reducers:r.reducers||[],isLoadingFuncs:r.isLoadingFuncs||[],contextInit:[].concat(r.contextInit||[]),eventRefiners:r.eventRefiners||{},eventDefMemberAdders:r.eventDefMemberAdders||[],eventSourceRefiners:r.eventSourceRefiners||{},isDraggableTransformers:r.isDraggableTransformers||[],eventDragMutationMassagers:r.eventDragMutationMassagers||[],eventDefMutationAppliers:r.eventDefMutationAppliers||[],dateSelectionTransformers:r.dateSelectionTransformers||[],datePointTransforms:r.datePointTransforms||[],dateSpanTransforms:r.dateSpanTransforms||[],views:r.views||{},viewPropsTransformers:r.viewPropsTransformers||[],isPropsValid:r.isPropsValid||null,externalDefTransforms:r.externalDefTransforms||[],viewContainerAppends:r.viewContainerAppends||[],eventDropTransformers:r.eventDropTransformers||[],componentInteractions:r.componentInteractions||[],calendarInteractions:r.calendarInteractions||[],themeClasses:r.themeClasses||{},eventSourceDefs:r.eventSourceDefs||[],cmdFormatter:r.cmdFormatter,recurringTypes:r.recurringTypes||[],namedTimeZonedImpl:r.namedTimeZonedImpl,initialView:r.initialView||"",elementDraggingImpl:r.elementDraggingImpl,optionChangeHandlers:r.optionChangeHandlers||{},scrollGridImpl:r.scrollGridImpl||null,listenerRefiners:r.listenerRefiners||{},optionRefiners:r.optionRefiners||{},propSetHandlers:r.propSetHandlers||{}}}function wlt(r,e){let t={},n={premiumReleaseDate:void 0,reducers:[],isLoadingFuncs:[],contextInit:[],eventRefiners:{},eventDefMemberAdders:[],eventSourceRefiners:{},isDraggableTransformers:[],eventDragMutationMassagers:[],eventDefMutationAppliers:[],dateSelectionTransformers:[],datePointTransforms:[],dateSpanTransforms:[],views:{},viewPropsTransformers:[],isPropsValid:null,externalDefTransforms:[],viewContainerAppends:[],eventDropTransformers:[],componentInteractions:[],calendarInteractions:[],themeClasses:{},eventSourceDefs:[],cmdFormatter:null,recurringTypes:[],namedTimeZonedImpl:null,initialView:"",elementDraggingImpl:null,optionChangeHandlers:{},scrollGridImpl:null,listenerRefiners:{},optionRefiners:{},propSetHandlers:{}};function i(a){for(let s of a){let o=s.name,l=t[o];l===void 0?(t[o]=s.id,i(s.deps),n=Elt(n,s)):l!==s.id&&console.warn(`Duplicate plugin '${o}'`)}}return r&&i(r),i(e),n}function Slt(){let r=[],e=[],t;return(n,i)=>((!t||!Jc(n,r)||!Jc(i,e))&&(t=wlt(n,i)),r=n,e=i,t)}function Elt(r,e){return{premiumReleaseDate:xlt(r.premiumReleaseDate,e.premiumReleaseDate),reducers:r.reducers.concat(e.reducers),isLoadingFuncs:r.isLoadingFuncs.concat(e.isLoadingFuncs),contextInit:r.contextInit.concat(e.contextInit),eventRefiners:Object.assign(Object.assign({},r.eventRefiners),e.eventRefiners),eventDefMemberAdders:r.eventDefMemberAdders.concat(e.eventDefMemberAdders),eventSourceRefiners:Object.assign(Object.assign({},r.eventSourceRefiners),e.eventSourceRefiners),isDraggableTransformers:r.isDraggableTransformers.concat(e.isDraggableTransformers),eventDragMutationMassagers:r.eventDragMutationMassagers.concat(e.eventDragMutationMassagers),eventDefMutationAppliers:r.eventDefMutationAppliers.concat(e.eventDefMutationAppliers),dateSelectionTransformers:r.dateSelectionTransformers.concat(e.dateSelectionTransformers),datePointTransforms:r.datePointTransforms.concat(e.datePointTransforms),dateSpanTransforms:r.dateSpanTransforms.concat(e.dateSpanTransforms),views:Object.assign(Object.assign({},r.views),e.views),viewPropsTransformers:r.viewPropsTransformers.concat(e.viewPropsTransformers),isPropsValid:e.isPropsValid||r.isPropsValid,externalDefTransforms:r.externalDefTransforms.concat(e.externalDefTransforms),viewContainerAppends:r.viewContainerAppends.concat(e.viewContainerAppends),eventDropTransformers:r.eventDropTransformers.concat(e.eventDropTransformers),calendarInteractions:r.calendarInteractions.concat(e.calendarInteractions),componentInteractions:r.componentInteractions.concat(e.componentInteractions),themeClasses:Object.assign(Object.assign({},r.themeClasses),e.themeClasses),eventSourceDefs:r.eventSourceDefs.concat(e.eventSourceDefs),cmdFormatter:e.cmdFormatter||r.cmdFormatter,recurringTypes:r.recurringTypes.concat(e.recurringTypes),namedTimeZonedImpl:e.namedTimeZonedImpl||r.namedTimeZonedImpl,initialView:r.initialView||e.initialView,elementDraggingImpl:r.elementDraggingImpl||e.elementDraggingImpl,optionChangeHandlers:Object.assign(Object.assign({},r.optionChangeHandlers),e.optionChangeHandlers),scrollGridImpl:e.scrollGridImpl||r.scrollGridImpl,listenerRefiners:Object.assign(Object.assign({},r.listenerRefiners),e.listenerRefiners),optionRefiners:Object.assign(Object.assign({},r.optionRefiners),e.optionRefiners),propSetHandlers:Object.assign(Object.assign({},r.propSetHandlers),e.propSetHandlers)}}function xlt(r,e){return r===void 0?e:e===void 0?r:new Date(Math.max(r.valueOf(),e.valueOf()))}function Clt(r,e){let t={},n;for(n in r)N4(n,t,r,e);for(n in e)N4(n,t,r,e);return t}function N4(r,e,t,n){if(e[r])return e[r];let i=Dlt(r,e,t,n);return i&&(e[r]=i),i}function Dlt(r,e,t,n){let i=t[r],a=n[r],s=d=>i&&i[d]!==null?i[d]:a&&a[d]!==null?a[d]:null,o=s("component"),l=s("superType"),c=null;if(l){if(l===r)throw new Error("Can't have a custom view type that references itself");c=N4(l,e,t,n)}return!o&&c&&(o=c.component),o?{type:r,component:o,defaults:Object.assign(Object.assign({},c?c.defaults:{}),i?i.rawOptions:{}),overrides:Object.assign(Object.assign({},c?c.overrides:{}),a?a.rawOptions:{})}:null}function ePe(r){return Uo(r,Plt)}function Plt(r){let e=typeof r=="function"?{component:r}:r,{component:t}=e;return e.content?t=tPe(e):t&&!(t.prototype instanceof wt)&&(t=tPe(Object.assign(Object.assign({},e),{content:t}))),{superType:e.type,component:t,rawOptions:e}}function tPe(r){return e=>M(Ho.Consumer,null,t=>M(In,{elTag:"div",elClasses:l4(t.viewSpec),renderProps:Object.assign(Object.assign({},e),{nextDayThreshold:t.options.nextDayThreshold}),generatorName:void 0,customGenerator:r.content,classNameGenerator:r.classNames,didMount:r.didMount,willUnmount:r.willUnmount}))}function Mlt(r,e,t,n){let i=ePe(r),a=ePe(e.views),s=Clt(i,a);return Uo(s,o=>_lt(o,a,e,t,n))}function _lt(r,e,t,n,i){let a=r.overrides.duration||r.defaults.duration||n.duration||t.duration,s=null,o="",l="",c={};if(a&&(s=Alt(a),s)){let p=RC(s);o=p.unit,p.value===1&&(l=o,c=e[o]?e[o].rawOptions:{})}let d=p=>{let m=p.buttonText||{},f=r.defaults.buttonTextKey;return f!=null&&m[f]!=null?m[f]:m[r.type]!=null?m[r.type]:m[l]!=null?m[l]:null},u=p=>{let m=p.buttonHints||{},f=r.defaults.buttonTextKey;return f!=null&&m[f]!=null?m[f]:m[r.type]!=null?m[r.type]:m[l]!=null?m[l]:null};return{type:r.type,component:r.component,duration:s,durationUnit:o,singleUnit:l,optionDefaults:r.defaults,optionOverrides:Object.assign(Object.assign({},c),r.overrides),buttonTextOverride:d(n)||d(t)||r.overrides.buttonText,buttonTextDefault:d(i)||r.defaults.buttonText||d(ed)||r.type,buttonTitleOverride:u(n)||u(t)||r.overrides.buttonHint,buttonTitleDefault:u(i)||r.defaults.buttonHint||u(ed)}}function Alt(r){let e=JSON.stringify(r),t=rPe[e];return t===void 0&&(t=ct(r),rPe[e]=t),t}function Ilt(r,e){switch(e.type){case"CHANGE_VIEW_TYPE":r=e.viewType}return r}function Nlt(r,e){switch(e.type){case"CHANGE_DATE":return e.dateMarker;default:return r}}function Rlt(r,e,t){let n=r.initialDate;return n!=null?e.createMarker(n):t.getDateMarker()}function Olt(r,e){switch(e.type){case"SET_OPTION":return Object.assign(Object.assign({},r),{[e.optionName]:e.rawOptionValue});default:return r}}function Llt(r,e,t,n){let i;switch(e.type){case"CHANGE_VIEW_TYPE":return n.build(e.dateMarker||t);case"CHANGE_DATE":return n.build(e.dateMarker);case"PREV":if(i=n.buildPrev(r,t),i.isValid)return i;break;case"NEXT":if(i=n.buildNext(r,t),i.isValid)return i;break}return r}function Flt(r,e,t){let n=e?e.activeRange:null;return uPe({},Vlt(r,t),n,t)}function $lt(r,e,t,n){let i=t?t.activeRange:null;switch(e.type){case"ADD_EVENT_SOURCES":return uPe(r,e.sources,i,n);case"REMOVE_EVENT_SOURCE":return jlt(r,e.sourceId);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return t?pPe(r,i,n):r;case"FETCH_EVENT_SOURCES":return U4(r,e.sourceIds?a4(e.sourceIds):mPe(r,n),i,e.isRefetch||!1,n);case"RECEIVE_EVENTS":case"RECEIVE_EVENT_ERROR":return Hlt(r,e.sourceId,e.fetchId,e.fetchRange);case"REMOVE_ALL_EVENT_SOURCES":return{};default:return r}}function zlt(r,e,t){let n=e?e.activeRange:null;return U4(r,mPe(r,t),n,!0,t)}function dPe(r){for(let e in r)if(r[e].isFetching)return!0;return!1}function uPe(r,e,t,n){let i={};for(let a of e)i[a.sourceId]=a;return t&&(i=pPe(i,t,n)),Object.assign(Object.assign({},r),i)}function jlt(r,e){return Iu(r,t=>t.sourceId!==e)}function pPe(r,e,t){return U4(r,Iu(r,n=>Blt(n,e,t)),e,!1,t)}function Blt(r,e,t){return fPe(r,t)?!t.options.lazyFetching||!r.fetchRange||r.isFetching||e.startr.fetchRange.end:!r.latestFetchId}function U4(r,e,t,n,i){let a={};for(let s in r){let o=r[s];e[s]?a[s]=Ult(o,t,n,i):a[s]=o}return a}function Ult(r,e,t,n){let{options:i,calendarApi:a}=n,s=n.pluginHooks.eventSourceDefs[r.sourceDefId],o=Fu();return s.fetch({eventSource:r,range:e,isRefetch:t,context:n},l=>{let{rawEvents:c}=l;i.eventSourceSuccess&&(c=i.eventSourceSuccess.call(a,c,l.response)||c),r.success&&(c=r.success.call(a,c,l.response)||c),n.dispatch({type:"RECEIVE_EVENTS",sourceId:r.sourceId,fetchId:o,fetchRange:e,rawEvents:c})},l=>{let c=!1;i.eventSourceFailure&&(i.eventSourceFailure.call(a,l),c=!0),r.failure&&(r.failure(l),c=!0),c||console.warn(l.message,l),n.dispatch({type:"RECEIVE_EVENT_ERROR",sourceId:r.sourceId,fetchId:o,fetchRange:e,error:l})}),Object.assign(Object.assign({},r),{isFetching:!0,latestFetchId:o})}function Hlt(r,e,t,n){let i=r[e];return i&&t===i.latestFetchId?Object.assign(Object.assign({},r),{[e]:Object.assign(Object.assign({},i),{isFetching:!1,fetchRange:n})}):r}function mPe(r,e){return Iu(r,t=>fPe(t,e))}function Vlt(r,e){let t=m4(e),n=[].concat(r.eventSources||[]),i=[];r.initialEvents&&n.unshift(r.initialEvents),r.events&&n.unshift(r.events);for(let a of n){let s=p4(a,e,t);s&&i.push(s)}return i}function fPe(r,e){return!e.pluginHooks.eventSourceDefs[r.sourceDefId].ignoreRange}function qlt(r,e){switch(e.type){case"UNSELECT_DATES":return null;case"SELECT_DATES":return e.selection;default:return r}}function Wlt(r,e){switch(e.type){case"UNSELECT_EVENT":return"";case"SELECT_EVENT":return e.eventInstanceId;default:return r}}function Ylt(r,e){let t;switch(e.type){case"UNSET_EVENT_DRAG":return null;case"SET_EVENT_DRAG":return t=e.state,{affectedEvents:t.affectedEvents,mutatedEvents:t.mutatedEvents,isEvent:t.isEvent};default:return r}}function Glt(r,e){let t;switch(e.type){case"UNSET_EVENT_RESIZE":return null;case"SET_EVENT_RESIZE":return t=e.state,{affectedEvents:t.affectedEvents,mutatedEvents:t.mutatedEvents,isEvent:t.isEvent};default:return r}}function Klt(r,e,t,n,i){let a=r.headerToolbar?nPe(r.headerToolbar,r,e,t,n,i):null,s=r.footerToolbar?nPe(r.footerToolbar,r,e,t,n,i):null;return{header:a,footer:s}}function nPe(r,e,t,n,i,a){let s={},o=[],l=!1;for(let c in r){let d=r[c],u=Zlt(d,e,t,n,i,a);s[c]=u.widgets,o.push(...u.viewsWithButtons),l=l||u.hasTitle}return{sectionWidgets:s,viewsWithButtons:o,hasTitle:l}}function Zlt(r,e,t,n,i,a){let s=e.direction==="rtl",o=e.customButtons||{},l=t.buttonText||{},c=e.buttonText||{},d=t.buttonHints||{},u=e.buttonHints||{},p=r?r.split(" "):[],m=[],f=!1;return{widgets:p.map(g=>g.split(",").map(v=>{if(v==="title")return f=!0,{buttonName:v};let k,b,w,S,x,C;if(k=o[v])w=D=>{k.click&&k.click.call(D.target,D,D.target)},(S=n.getCustomButtonIconClass(k))||(S=n.getIconClass(v,s))||(x=k.text),C=k.hint||k.text;else if(b=i[v]){m.push(v),w=()=>{a.changeView(v)},(x=b.buttonTextOverride)||(S=n.getIconClass(v,s))||(x=b.buttonTextDefault);let D=b.buttonTextOverride||b.buttonTextDefault;C=fT(b.buttonTitleOverride||b.buttonTitleDefault||e.viewHint,[D,v],D)}else if(a[v])if(w=()=>{a[v]()},(x=l[v])||(S=n.getIconClass(v,s))||(x=c[v]),v==="prevYear"||v==="nextYear"){let D=v==="prevYear"?"prev":"next";C=fT(d[D]||u[D],[c.year||"year","year"],c[v])}else C=D=>fT(d[v]||u[v],[c[D]||D,D],c[v]);return{buttonName:v,buttonClick:w,buttonIcon:S,buttonText:x,buttonHint:C}})),viewsWithButtons:m,hasTitle:f}}function ict(r,e,t){let{dateEnv:n,options:i}=t,a,s,o,l,c={};return a=r.startParam,a==null&&(a=i.startParam),s=r.endParam,s==null&&(s=i.endParam),o=r.timeZoneParam,o==null&&(o=i.timeZoneParam),typeof r.extraParams=="function"?l=r.extraParams():l=r.extraParams||{},Object.assign(c,l),c[a]=n.formatIso(e.start),c[s]=n.formatIso(e.end),n.timeZone!=="local"&&(c[o]=n.timeZone),c}function lct(r,e,t,n,i){let a=r?a4(r):null,s=pr(i.start),o=i.end,l=[];for(e&&(e.milliseconds<0?o=un(o,1):e.milliseconds>=1e3*60*60*24&&(s=un(s,-1)));s1?{year:"numeric",month:"short",day:"numeric"}:{year:"numeric",month:"long",day:"numeric"}}function hct(r,e,t,n,i,a,s,o){let l=lPe(e||s.defaultCode,s.map);return new OC({calendarSystem:"gregory",timeZone:r,namedTimeZoneImpl:a.namedTimeZonedImpl,locale:l,weekNumberCalculation:t,firstDay:n,weekText:i,cmdFormatter:a.cmdFormatter,defaultSeparator:o})}function gct(r,e){let t=e.themeClasses[r.themeSystem]||nd;return new t(r)}function yct(r){let e=r.dateProfileGeneratorClass||ng;return new e(r)}function vct(r,e,t){return new R4(r,e,t)}function bct(r){return Uo(r,e=>e.ui)}function Tct(r,e,t){let n={"":e};for(let i in r){let a=r[i];a.sourceId&&t[a.sourceId]&&(n[i]=t[a.sourceId])}return n}function kct(r){let{options:e}=r;return{eventUiSingleBase:bT({display:e.eventDisplay,editable:e.editable,startEditable:e.eventStartEditable,durationEditable:e.eventDurationEditable,constraint:e.eventConstraint,overlap:typeof e.eventOverlap=="boolean"?e.eventOverlap:void 0,allow:e.eventAllow,backgroundColor:e.eventBackgroundColor,borderColor:e.eventBorderColor,textColor:e.eventTextColor,color:e.eventColor},r),selectionConfig:bT({constraint:e.selectConstraint,overlap:typeof e.selectOverlap=="boolean"?e.selectOverlap:void 0,allow:e.selectAllow},r)}}function I4(r,e){for(let t of e.pluginHooks.isLoadingFuncs)if(t(r))return!0;return!1}function wct(r){return h4(r.options.businessHours,r)}function aPe(r,e){for(let t in r)console.warn(`Unknown option '${t}'`+(e?` for view '${e}'`:""))}function Sct(r,e,t,n,i,a){let s=t.build(i,void 0,!1),o=t.buildPrev(e,n,!1),l=t.buildNext(e,n,!1);return{title:a,activeButton:r.type,navUnit:r.singleUnit,isTodayEnabled:s.isValid&&!Bo(e.currentRange,i),isPrevEnabled:o.isValid,isNextEnabled:l.isValid}}function Ect(r){return r.map(e=>new e)}var vlt,sPe,oPe,nd,rPe,R4,Qlt,Jlt,Xlt,ect,tct,rct,nct,act,sct,oct,cct,pct,O4,sO,L4,F4,oO,$4,z4,j4,B4,lO,yg=y(()=>{A4();Au();IC();vlt=[],sPe={code:"en",week:{dow:0,doy:4},direction:"ltr",buttonText:{prev:"prev",next:"next",prevYear:"prev year",nextYear:"next year",year:"year",today:"today",month:"month",week:"week",day:"day",list:"list"},weekText:"W",weekTextLong:"Week",closeHint:"Close",timeHint:"Time",eventHint:"Event",allDayText:"all-day",moreLinkText:"more",noEventsText:"No events to display"},oPe=Object.assign(Object.assign({},sPe),{buttonHints:{prev:"Previous $0",next:"Next $0",today(r,e){return e==="day"?"Today":`This ${r}`}},viewHint:"$0 view",navLinkHint:"Go to $0",moreLinkHint(r){return`Show ${r} more event${r===1?"":"s"}`}});nd=class extends Nu{};nd.prototype.classes={root:"fc-theme-standard",tableCellShaded:"fc-cell-shaded",buttonGroup:"fc-button-group",button:"fc-button fc-button-primary",buttonActive:"fc-button-active"};nd.prototype.baseIconClass="fc-icon";nd.prototype.iconClasses={close:"fc-icon-x",prev:"fc-icon-chevron-left",next:"fc-icon-chevron-right",prevYear:"fc-icon-chevrons-left",nextYear:"fc-icon-chevrons-right"};nd.prototype.rtlIconClasses={prev:"fc-icon-chevron-right",next:"fc-icon-chevron-left",prevYear:"fc-icon-chevrons-right",nextYear:"fc-icon-chevrons-left"};nd.prototype.iconOverrideOption="buttonIcons";nd.prototype.iconOverrideCustomButtonOption="icon";nd.prototype.iconOverridePrefix="fc-icon-";rPe={};R4=class{constructor(e,t,n){this.type=e,this.getCurrentData=t,this.dateEnv=n}get calendar(){return this.getCurrentData().calendarApi}get title(){return this.getCurrentData().viewTitle}get activeStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.start)}get activeEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.end)}get currentStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.start)}get currentEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.end)}getOption(e){return this.getCurrentData().options[e]}},Qlt={ignoreRange:!0,parseMeta(r){return Array.isArray(r.events)?r.events:null},fetch(r,e){e({rawEvents:r.eventSource.meta})}},Jlt=pa({name:"array-event-source",eventSourceDefs:[Qlt]}),Xlt={parseMeta(r){return typeof r.events=="function"?r.events:null},fetch(r,e,t){let{dateEnv:n}=r.context,i=r.eventSource.meta;T4(i.bind(null,b4(r.range,n)),a=>e({rawEvents:a}),t)}},ect=pa({name:"func-event-source",eventSourceDefs:[Xlt]}),tct={method:String,extraParams:j,startParam:String,endParam:String,timeZoneParam:String},rct={parseMeta(r){return r.url&&(r.format==="json"||!r.format)?{url:r.url,format:"json",method:(r.method||"GET").toUpperCase(),extraParams:r.extraParams,startParam:r.startParam,endParam:r.endParam,timeZoneParam:r.timeZoneParam}:null},fetch(r,e,t){let{meta:n}=r.eventSource,i=ict(n,r.range,r.context);k4(n.method,n.url,i).then(([a,s])=>{e({rawEvents:a,response:s})},t)}},nct=pa({name:"json-event-source",eventSourceRefiners:tct,eventSourceDefs:[rct]});act={daysOfWeek:j,startTime:ct,endTime:ct,duration:ct,startRecur:j,endRecur:j},sct={parse(r,e){if(r.daysOfWeek||r.startTime||r.endTime||r.startRecur||r.endRecur){let t={daysOfWeek:r.daysOfWeek||null,startTime:r.startTime||null,endTime:r.endTime||null,startRecur:r.startRecur?e.createMarker(r.startRecur):null,endRecur:r.endRecur?e.createMarker(r.endRecur):null,dateEnv:e},n;return r.duration&&(n=r.duration),!n&&r.startTime&&r.endTime&&(n=hDe(r.endTime,r.startTime)),{allDayGuess:!r.startTime&&!r.endTime,duration:n,typeData:t}}return null},expand(r,e,t){let n=$a(e,{start:r.startRecur,end:r.endRecur});return n?lct(r.daysOfWeek,r.startTime,r.dateEnv,t,n):[]}},oct=pa({name:"simple-recurring-event",recurringTypes:[sct],eventRefiners:act});cct=pa({name:"change-handler",optionChangeHandlers:{events(r,e){iPe([r],e)},eventSources:iPe}});pct=[Jlt,ect,nct,oct,cct,pa({name:"misc",isLoadingFuncs:[r=>dPe(r.eventSources)],propSetHandlers:{dateProfile:dct,eventStore:uct}})],O4=class{constructor(e,t){this.runTaskOption=e,this.drainedOption=t,this.queue=[],this.delayedRunner=new rg(this.drain.bind(this))}request(e,t){this.queue.push(e),this.delayedRunner.request(t)}pause(e){this.delayedRunner.pause(e)}resume(e,t){this.delayedRunner.resume(e,t)}drain(){let{queue:e}=this;for(;e.length;){let t=[],n;for(;n=e.shift();)this.runTask(n),t.push(n);this.drained(t)}}runTask(e){this.runTaskOption&&this.runTaskOption(e)}drained(e){this.drainedOption&&this.drainedOption(e)}};sO=class{constructor(){this.resetListeners=new Set}handleInput(e,t){let n=this.dateEnv;if(e!==n&&(typeof t=="function"?this.nowFn=t:n||(this.nowAnchorDate=e.toDate(t?e.createMarker(t):e.createNowMarker()),this.nowAnchorQueried=Date.now()),this.dateEnv=e,n))for(let i of this.resetListeners.values())i()}getDateMarker(){return this.nowAnchorDate?this.dateEnv.timestampToMarker(this.nowAnchorDate.valueOf()+(Date.now()-this.nowAnchorQueried)):this.dateEnv.createMarker(this.nowFn())}addResetListener(e){this.resetListeners.add(e)}removeResetListener(e){this.resetListeners.delete(e)}},L4=class{constructor(e){this.computeCurrentViewData=Me(this._computeCurrentViewData),this.organizeRawLocales=Me(blt),this.buildLocale=Me(lPe),this.buildPluginHooks=Slt(),this.buildDateEnv=Me(hct),this.buildTheme=Me(gct),this.parseToolbars=Me(Klt),this.buildViewSpecs=Me(Mlt),this.buildDateProfileGenerator=gT(yct),this.buildViewApi=Me(vct),this.buildViewUiProps=gT(kct),this.buildEventUiBySource=Me(bct,ua),this.buildEventUiBases=Me(Tct),this.parseContextBusinessHours=gT(wct),this.buildTitle=Me(mct),this.nowManager=new sO,this.emitter=new Ru,this.actionRunner=new O4(this._handleAction.bind(this),this.updateData.bind(this)),this.currentCalendarOptionsInput={},this.currentCalendarOptionsRefined={},this.currentViewOptionsInput={},this.currentViewOptionsRefined={},this.currentCalendarOptionsRefiners={},this.optionsForRefining=[],this.optionsForHandling=[],this.getCurrentData=()=>this.data,this.dispatch=p=>{this.actionRunner.request(p)},this.props=e,this.actionRunner.pause(),this.nowManager=new sO;let t={},n=this.computeOptionsData(e.optionOverrides,t,e.calendarApi),i=n.calendarOptions.initialView||n.pluginHooks.initialView,a=this.computeCurrentViewData(i,n,e.optionOverrides,t);e.calendarApi.currentDataManager=this,this.emitter.setThisContext(e.calendarApi),this.emitter.setOptions(a.options);let s={nowManager:this.nowManager,dateEnv:n.dateEnv,options:n.calendarOptions,pluginHooks:n.pluginHooks,calendarApi:e.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData},o=Rlt(n.calendarOptions,n.dateEnv,this.nowManager),l=a.dateProfileGenerator.build(o);Bo(l.activeRange,o)||(o=l.currentRange.start);for(let p of n.pluginHooks.contextInit)p(s);let c=Flt(n.calendarOptions,l,s),d={dynamicOptionOverrides:t,currentViewType:i,currentDate:o,dateProfile:l,businessHours:this.parseContextBusinessHours(s),eventSources:c,eventUiBases:{},eventStore:mi(),renderableEventStore:mi(),dateSelection:null,eventSelection:"",eventDrag:null,eventResize:null,selectionConfig:this.buildViewUiProps(s).selectionConfig},u=Object.assign(Object.assign({},s),d);for(let p of n.pluginHooks.reducers)Object.assign(d,p(null,null,u));I4(d,s)&&this.emitter.trigger("loading",!0),this.state=d,this.updateData(),this.actionRunner.resume()}resetOptions(e,t){let{props:n}=this;t===void 0?n.optionOverrides=e:(n.optionOverrides=Object.assign(Object.assign({},n.optionOverrides||{}),e),this.optionsForRefining.push(...t)),(t===void 0||t.length)&&this.actionRunner.request({type:"NOTHING"})}_handleAction(e){let{props:t,state:n,emitter:i}=this,a=Olt(n.dynamicOptionOverrides,e),s=this.computeOptionsData(t.optionOverrides,a,t.calendarApi),o=Ilt(n.currentViewType,e),l=this.computeCurrentViewData(o,s,t.optionOverrides,a);t.calendarApi.currentDataManager=this,i.setThisContext(t.calendarApi),i.setOptions(l.options);let c={nowManager:this.nowManager,dateEnv:s.dateEnv,options:s.calendarOptions,pluginHooks:s.pluginHooks,calendarApi:t.calendarApi,dispatch:this.dispatch,emitter:i,getCurrentData:this.getCurrentData},{currentDate:d,dateProfile:u}=n;this.data&&this.data.dateProfileGenerator!==l.dateProfileGenerator&&(u=l.dateProfileGenerator.build(d)),d=Nlt(d,e),u=Llt(u,e,d,l.dateProfileGenerator),(e.type==="PREV"||e.type==="NEXT"||!Bo(u.currentRange,d))&&(d=u.currentRange.start);let p=$lt(n.eventSources,e,u,c),m=PDe(n.eventStore,e,p,u,c),h=dPe(p)&&!l.options.progressiveEventRendering&&n.renderableEventStore||m,{eventUiSingleBase:g,selectionConfig:v}=this.buildViewUiProps(c),k=this.buildEventUiBySource(p),b=this.buildEventUiBases(h.defs,g,k),w={dynamicOptionOverrides:a,currentViewType:o,currentDate:d,dateProfile:u,eventSources:p,eventStore:m,renderableEventStore:h,selectionConfig:v,eventUiBases:b,businessHours:this.parseContextBusinessHours(c),dateSelection:qlt(n.dateSelection,e),eventSelection:Wlt(n.eventSelection,e),eventDrag:Ylt(n.eventDrag,e),eventResize:Glt(n.eventResize,e)},S=Object.assign(Object.assign({},c),w);for(let D of s.pluginHooks.reducers)Object.assign(w,D(n,e,S));let x=I4(n,c),C=I4(w,c);!x&&C?i.trigger("loading",!0):x&&!C&&i.trigger("loading",!1),this.state=w,t.onAction&&t.onAction(e)}updateData(){let{props:e,state:t}=this,n=this.data,i=this.computeOptionsData(e.optionOverrides,t.dynamicOptionOverrides,e.calendarApi),a=this.computeCurrentViewData(t.currentViewType,i,e.optionOverrides,t.dynamicOptionOverrides),s=this.data=Object.assign(Object.assign(Object.assign({nowManager:this.nowManager,viewTitle:this.buildTitle(t.dateProfile,a.options,i.dateEnv),calendarApi:e.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData},i),a),t),o=i.pluginHooks.optionChangeHandlers,l=n&&n.calendarOptions,c=i.calendarOptions;if(l&&l!==c){l.timeZone!==c.timeZone&&(t.eventSources=s.eventSources=zlt(s.eventSources,t.dateProfile,s),t.eventStore=s.eventStore=f4(s.eventStore,n.dateEnv,s.dateEnv),t.renderableEventStore=s.renderableEventStore=f4(s.renderableEventStore,n.dateEnv,s.dateEnv));for(let d in o)(this.optionsForHandling.indexOf(d)!==-1||l[d]!==c[d])&&o[d](c[d],s)}this.optionsForHandling=[],e.onData&&e.onData(s)}computeOptionsData(e,t,n){if(!this.optionsForRefining.length&&e===this.stableOptionOverrides&&t===this.stableDynamicOptionOverrides)return this.stableCalendarOptionsData;let{refinedOptions:i,pluginHooks:a,localeDefaults:s,availableLocaleData:o,extra:l}=this.processRawCalendarOptions(e,t);aPe(l);let c=this.buildDateEnv(i.timeZone,i.locale,i.weekNumberCalculation,i.firstDay,i.weekText,a,o,i.defaultRangeSeparator),d=this.buildViewSpecs(a.views,this.stableOptionOverrides,this.stableDynamicOptionOverrides,s),u=this.buildTheme(i,a),p=this.parseToolbars(i,this.stableOptionOverrides,u,d,n);return this.stableCalendarOptionsData={calendarOptions:i,pluginHooks:a,dateEnv:c,viewSpecs:d,theme:u,toolbarConfig:p,localeDefaults:s,availableRawLocales:o.map}}processRawCalendarOptions(e,t){let{locales:n,locale:i}=KR([ed,e,t]),a=this.organizeRawLocales(n),s=a.map,o=this.buildLocale(i||a.defaultCode,s).options,l=this.buildPluginHooks(e.plugins||[],pct),c=this.currentCalendarOptionsRefiners=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},r4),n4),i4),l.listenerRefiners),l.optionRefiners),d={},u=KR([ed,o,e,t]),p={},m=this.currentCalendarOptionsInput,f=this.currentCalendarOptionsRefined,h=!1;for(let g in u)this.optionsForRefining.indexOf(g)===-1&&(u[g]===m[g]||Am[g]&&g in m&&Am[g](m[g],u[g]))?p[g]=f[g]:c[g]?(p[g]=c[g](u[g]),h=!0):d[g]=m[g];return h&&(this.currentCalendarOptionsInput=u,this.currentCalendarOptionsRefined=p,this.stableOptionOverrides=e,this.stableDynamicOptionOverrides=t),this.optionsForHandling.push(...this.optionsForRefining),this.optionsForRefining=[],{rawOptions:this.currentCalendarOptionsInput,refinedOptions:this.currentCalendarOptionsRefined,pluginHooks:l,availableLocaleData:a,localeDefaults:o,extra:d}}_computeCurrentViewData(e,t,n,i){let a=t.viewSpecs[e];if(!a)throw new Error(`viewType "${e}" is not available. Please make sure you've loaded all neccessary plugins`);let{refinedOptions:s,extra:o}=this.processRawViewOptions(a,t.pluginHooks,t.localeDefaults,n,i);aPe(o),this.nowManager.handleInput(t.dateEnv,s.now);let l=this.buildDateProfileGenerator({dateProfileGeneratorClass:a.optionDefaults.dateProfileGeneratorClass,nowManager:this.nowManager,duration:a.duration,durationUnit:a.durationUnit,usesMinMaxTime:a.optionDefaults.usesMinMaxTime,dateEnv:t.dateEnv,calendarApi:this.props.calendarApi,slotMinTime:s.slotMinTime,slotMaxTime:s.slotMaxTime,showNonCurrentDates:s.showNonCurrentDates,dayCount:s.dayCount,dateAlignment:s.dateAlignment,dateIncrement:s.dateIncrement,hiddenDays:s.hiddenDays,weekends:s.weekends,validRangeInput:s.validRange,visibleRangeInput:s.visibleRange,fixedWeekCount:s.fixedWeekCount}),c=this.buildViewApi(e,this.getCurrentData,t.dateEnv);return{viewSpec:a,options:s,dateProfileGenerator:l,viewApi:c}}processRawViewOptions(e,t,n,i,a){let s=KR([ed,e.optionDefaults,n,i,e.optionOverrides,a]),o=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},r4),n4),i4),vDe),t.listenerRefiners),t.optionRefiners),l={},c=this.currentViewOptionsInput,d=this.currentViewOptionsRefined,u=!1,p={};for(let m in s)s[m]===c[m]||Am[m]&&Am[m](s[m],c[m])?l[m]=d[m]:(s[m]===this.currentCalendarOptionsInput[m]||Am[m]&&Am[m](s[m],this.currentCalendarOptionsInput[m])?m in this.currentCalendarOptionsRefined&&(l[m]=this.currentCalendarOptionsRefined[m]):o[m]?l[m]=o[m](s[m]):p[m]=s[m],u=!0);return u&&(this.currentViewOptionsInput=s,this.currentViewOptionsRefined=l),{rawOptions:this.currentViewOptionsInput,refinedOptions:this.currentViewOptionsRefined,extra:p}}};F4=class extends wt{render(){let e=this.props.widgetGroups.map(t=>this.renderWidgetGroup(t));return M("div",{className:"fc-toolbar-chunk"},...e)}renderWidgetGroup(e){let{props:t}=this,{theme:n}=this.context,i=[],a=!0;for(let s of e){let{buttonName:o,buttonClick:l,buttonText:c,buttonIcon:d,buttonHint:u}=s;if(o==="title")a=!1,i.push(M("h2",{className:"fc-toolbar-title",id:t.titleId},t.title));else{let p=o===t.activeButton,m=!t.isTodayEnabled&&o==="today"||!t.isPrevEnabled&&o==="prev"||!t.isNextEnabled&&o==="next",f=[`fc-${o}-button`,n.getClass("button")];p&&f.push(n.getClass("buttonActive")),i.push(M("button",{type:"button",title:typeof u=="function"?u(t.navUnit):u,disabled:m,"aria-pressed":p,className:f.join(" "),onClick:l},c||(d?M("span",{className:d,role:"img"}):"")))}}if(i.length>1){let s=a&&n.getClass("buttonGroup")||"";return M("div",{className:s},...i)}return i[0]}},oO=class extends wt{render(){let{model:e,extraClassName:t}=this.props,n=!1,i,a,s=e.sectionWidgets,o=s.center;return s.left?(n=!0,i=s.left):i=s.start,s.right?(n=!0,a=s.right):a=s.end,M("div",{className:[t||"","fc-toolbar",n?"fc-toolbar-ltr":""].join(" ")},this.renderSection("start",i||[]),this.renderSection("center",o||[]),this.renderSection("end",a||[]))}renderSection(e,t){let{props:n}=this;return M(F4,{key:e,widgetGroups:t,title:n.title,navUnit:n.navUnit,activeButton:n.activeButton,isTodayEnabled:n.isTodayEnabled,isPrevEnabled:n.isPrevEnabled,isNextEnabled:n.isNextEnabled,titleId:n.titleId})}},$4=class extends wt{constructor(){super(...arguments),this.state={availableWidth:null},this.handleEl=e=>{this.el=e,no(this.props.elRef,e),this.updateAvailableWidth()},this.handleResize=()=>{this.updateAvailableWidth()}}render(){let{props:e,state:t}=this,{aspectRatio:n}=e,i=["fc-view-harness",n||e.liquid||e.height?"fc-view-harness-active":"fc-view-harness-passive"],a="",s="";return n?t.availableWidth!==null?a=t.availableWidth/n:s=`${1/n*100}%`:a=e.height||"",M("div",{"aria-labelledby":e.labeledById,ref:this.handleEl,className:i.join(" "),style:{height:a,paddingBottom:s}},e.children)}componentDidMount(){this.context.addResizeHandler(this.handleResize)}componentWillUnmount(){this.context.removeResizeHandler(this.handleResize)}updateAvailableWidth(){this.el&&this.props.aspectRatio&&this.setState({availableWidth:this.el.offsetWidth})}},z4=class extends zl{constructor(e){super(e),this.handleSegClick=(t,n)=>{let{component:i}=this,{context:a}=i,s=$u(n);if(s&&i.isValidSegDownEl(t.target)){let o=pi(t.target,".fc-event-forced-url"),l=o?o.querySelector("a[href]").href:"";a.emitter.trigger("eventClick",{el:n,event:new Nr(i.context,s.eventRange.def,s.eventRange.instance),jsEvent:t,view:a.viewApi}),l&&!t.defaultPrevented&&(window.location.href=l)}},this.destroy=VW(e.el,"click",".fc-event",this.handleSegClick)}},j4=class extends zl{constructor(e){super(e),this.handleEventElRemove=t=>{t===this.currentSegEl&&this.handleSegLeave(null,this.currentSegEl)},this.handleSegEnter=(t,n)=>{$u(n)&&(this.currentSegEl=n,this.triggerEvent("eventMouseEnter",t,n))},this.handleSegLeave=(t,n)=>{this.currentSegEl&&(this.currentSegEl=null,this.triggerEvent("eventMouseLeave",t,n))},this.removeHoverListeners=cDe(e.el,".fc-event",this.handleSegEnter,this.handleSegLeave)}destroy(){this.removeHoverListeners()}triggerEvent(e,t,n){let{component:i}=this,{context:a}=i,s=$u(n);(!t||i.isValidSegDownEl(t.target))&&a.emitter.trigger(e,{el:n,event:new Nr(a,s.eventRange.def,s.eventRange.instance),jsEvent:t,view:a.viewApi})}},B4=class extends Kc{constructor(){super(...arguments),this.buildViewContext=Me(SDe),this.buildViewPropTransformers=Me(Ect),this.buildToolbarProps=Me(Sct),this.headerRef=kn(),this.footerRef=kn(),this.interactionsStore={},this.state={viewLabelId:ms()},this.registerInteractiveComponent=(e,t)=>{let n=RDe(e,t),s=[z4,j4].concat(this.props.pluginHooks.componentInteractions).map(o=>new o(n));this.interactionsStore[e.uid]=s,hg[e.uid]=n},this.unregisterInteractiveComponent=e=>{let t=this.interactionsStore[e.uid];if(t){for(let n of t)n.destroy();delete this.interactionsStore[e.uid]}delete hg[e.uid]},this.resizeRunner=new rg(()=>{this.props.emitter.trigger("_resize",!0),this.props.emitter.trigger("windowResize",{view:this.props.viewApi})}),this.handleWindowResize=e=>{let{options:t}=this.props;t.handleWindowResize&&e.target===window&&this.resizeRunner.request(t.windowResizeDelay)}}render(){let{props:e}=this,{toolbarConfig:t,options:n}=e,i=!1,a="",s;e.isHeightAuto||e.forPrint?a="":n.height!=null?i=!0:n.contentHeight!=null?a=n.contentHeight:s=Math.max(n.aspectRatio,.5);let o=this.buildViewContext(e.viewSpec,e.viewApi,e.options,e.dateProfileGenerator,e.dateEnv,e.nowManager,e.theme,e.pluginHooks,e.dispatch,e.getCurrentData,e.emitter,e.calendarApi,this.registerInteractiveComponent,this.unregisterInteractiveComponent),l=t.header&&t.header.hasTitle?this.state.viewLabelId:void 0;return M(Ho.Provider,{value:o},M(us,{unit:"day"},c=>{let d=this.buildToolbarProps(e.viewSpec,e.dateProfile,e.dateProfileGenerator,e.currentDate,c,e.viewTitle);return M(Yt,null,t.header&&M(oO,Object.assign({ref:this.headerRef,extraClassName:"fc-header-toolbar",model:t.header,titleId:l},d)),M($4,{liquid:i,height:a,aspectRatio:s,labeledById:l},this.renderView(e),this.buildAppendContent()),t.footer&&M(oO,Object.assign({ref:this.footerRef,extraClassName:"fc-footer-toolbar",model:t.footer,titleId:""},d)))}))}componentDidMount(){let{props:e}=this;this.calendarInteractions=e.pluginHooks.calendarInteractions.map(n=>new n(e)),window.addEventListener("resize",this.handleWindowResize);let{propSetHandlers:t}=e.pluginHooks;for(let n in t)t[n](e[n],e)}componentDidUpdate(e){let{props:t}=this,{propSetHandlers:n}=t.pluginHooks;for(let i in n)t[i]!==e[i]&&n[i](t[i],t)}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),this.resizeRunner.clear();for(let e of this.calendarInteractions)e.destroy();this.props.emitter.trigger("_unmount")}buildAppendContent(){let{props:e}=this,t=e.pluginHooks.viewContainerAppends.map(n=>n(e));return M(Yt,{},...t)}renderView(e){let{pluginHooks:t}=e,{viewSpec:n}=e,i={dateProfile:e.dateProfile,businessHours:e.businessHours,eventStore:e.renderableEventStore,eventUiBases:e.eventUiBases,dateSelection:e.dateSelection,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,isHeightAuto:e.isHeightAuto,forPrint:e.forPrint},a=this.buildViewPropTransformers(t.viewPropsTransformers);for(let o of a)Object.assign(i,o.transform(i,e));let s=n.component;return M(s,Object.assign({},i))}};lO=class extends BC{constructor(e,t={}){super(),this.isRendering=!1,this.isRendered=!1,this.currentClassNames=[],this.customContentRenderId=0,this.handleAction=n=>{switch(n.type){case"SET_EVENT_DRAG":case"SET_EVENT_RESIZE":this.renderRunner.tryDrain()}},this.handleData=n=>{this.currentData=n,this.renderRunner.request(n.calendarOptions.rerenderDelay)},this.handleRenderRequest=()=>{if(this.isRendering){this.isRendered=!0;let{currentData:n}=this;LC(()=>{wm(M(jC,{options:n.calendarOptions,theme:n.theme,emitter:n.emitter},(i,a,s,o)=>(this.setClassNames(i),this.setHeight(a),M(o4.Provider,{value:this.customContentRenderId},M(B4,Object.assign({isHeightAuto:s,forPrint:o},n))))),this.el)})}else this.isRendered&&(this.isRendered=!1,wm(null,this.el),this.setClassNames([]),this.setHeight(""))},aDe(e),this.el=e,this.renderRunner=new rg(this.handleRenderRequest),new L4({optionOverrides:t,calendarApi:this,onAction:this.handleAction,onData:this.handleData})}render(){let e=this.isRendering;e?this.customContentRenderId+=1:this.isRendering=!0,this.renderRunner.request(),e&&this.updateSize()}destroy(){this.isRendering&&(this.isRendering=!1,this.renderRunner.request())}updateSize(){LC(()=>{super.updateSize()})}batchRendering(e){this.renderRunner.pause("batchRendering"),e(),this.renderRunner.resume("batchRendering")}pauseRendering(){this.renderRunner.pause("pauseRendering")}resumeRendering(){this.renderRunner.resume("pauseRendering",!0)}resetOptions(e,t){this.currentDataManager.resetOptions(e,t)}setClassNames(e){if(!Jc(e,this.currentClassNames)){let{classList:t}=this.el;for(let n of this.currentClassNames)t.remove(n);for(let n of e)t.add(n);this.currentClassNames=e}}setHeight(e){HW(this.el,"height",e)}}});var vg=y(()=>{A4();Au();IC()});function xct(r){return r.button===0&&!r.ctrlKey}function Cct(){H4+=1,setTimeout(()=>{H4-=1},wT.touchMouseIgnoreWait)}function Dct(){cO+=1,cO===1&&window.addEventListener("touchmove",gPe,{passive:!1})}function Pct(){cO-=1,cO||window.removeEventListener("touchmove",gPe,{passive:!1})}function gPe(r){V4&&r.preventDefault()}function Mct(r){let e=r.tagName;return e==="HTML"||e==="BODY"}function fO(r,e){return!r&&!e?!0:!!r!=!!e?!1:v4(r.dateSpan,e.dateSpan)}function e3(r,e){let t={};for(let n of e.pluginHooks.datePointTransforms)Object.assign(t,n(r,e));return Object.assign(t,_ct(r,e.dateEnv)),t}function _ct(r,e){return{date:e.toDate(r.range.start),dateStr:e.formatIso(r.range.start,{omitTime:r.allDay}),allDay:r.allDay}}function Act(r){let{options:e}=r.context,t=e.selectLongPressDelay;return t==null&&(t=e.longPressDelay),t}function Ict(r,e,t){let n=r.dateSpan,i=e.dateSpan,a=[n.range.start,n.range.end,i.range.start,i.range.end];a.sort(ZW);let s={};for(let o of t){let l=o(r,e);if(l===!1)return null;l&&Object.assign(s,l)}return s.range={start:a[0],end:a[3]},s.allDay=n.allDay,s}function Nct(r,e,t,n){let i=r.dateSpan,a=e.dateSpan,s=i.range.start,o=a.range.start,l={};i.allDay!==a.allDay&&(l.allDay=a.allDay,l.hasEnd=e.context.options.allDayMaintainDuration,a.allDay?s=pr(t):s=t);let c=Cm(s,o,r.context.dateEnv,r.componentId===e.componentId?r.largeUnit:null);c.milliseconds&&(l.allDay=!1);let d={datesDelta:c,standardProps:l};for(let u of n)u(d,r,e);return d}function Rct(r){let{options:e}=r.context,t=e.eventLongPressDelay;return t==null&&(t=e.longPressDelay),t}function Oct(r,e,t,n){let i=r.context.dateEnv,a=r.dateSpan.range.start,s=e.dateSpan.range.start,o=Cm(a,s,i,r.largeUnit);if(t){if(i.add(n.start,o)n.start)return{endDelta:o};return null}function $ct(r,e,t){let n=Object.assign({},e.leftoverProps);for(let d of t.pluginHooks.externalDefTransforms)Object.assign(n,d(r,e));let{refined:i,extra:a}=XC(n,t),s=cT(i,a,e.sourceId,r.allDay,t.options.forceEventDuration||!!e.duration,t),o=r.range.start;r.allDay&&e.startTime&&(o=t.dateEnv.add(o,e.startTime));let l=e.duration?t.dateEnv.add(o,e.duration):zC(r.allDay,o,t),c=vT(s.defId,{start:o,end:l});return{def:s,instance:c}}function zct(r){let e=jct(r,"event"),t=e?JSON.parse(e):{create:!1};return oD(t)}function jct(r,e){let t=wT.dataAttrPrefix,n=(t?t+"-":"")+e;return r.getAttribute("data-"+n)||""}var H4,cO,V4,dO,q4,uO,pO,W4,hPe,Y4,Nm,G4,bg,K4,Z4,mD,Q4,J4,Lct,Fct,X4,mO,yPe,t3=y(()=>{yg();vg();wT.touchMouseIgnoreWait=500;H4=0,cO=0,V4=!1,dO=class{constructor(e){this.subjectEl=null,this.selector="",this.handleSelector="",this.shouldIgnoreMove=!1,this.shouldWatchScroll=!0,this.isDragging=!1,this.isTouchDragging=!1,this.wasTouchScroll=!1,this.handleMouseDown=t=>{if(!this.shouldIgnoreMouse()&&xct(t)&&this.tryStart(t)){let n=this.createEventFromMouse(t,!0);this.emitter.trigger("pointerdown",n),this.initScrollWatch(n),this.shouldIgnoreMove||document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}},this.handleMouseMove=t=>{let n=this.createEventFromMouse(t);this.recordCoords(n),this.emitter.trigger("pointermove",n)},this.handleMouseUp=t=>{document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.emitter.trigger("pointerup",this.createEventFromMouse(t)),this.cleanup()},this.handleTouchStart=t=>{if(this.tryStart(t)){this.isTouchDragging=!0;let n=this.createEventFromTouch(t,!0);this.emitter.trigger("pointerdown",n),this.initScrollWatch(n);let i=t.target;this.shouldIgnoreMove||i.addEventListener("touchmove",this.handleTouchMove),i.addEventListener("touchend",this.handleTouchEnd),i.addEventListener("touchcancel",this.handleTouchEnd),window.addEventListener("scroll",this.handleTouchScroll,!0)}},this.handleTouchMove=t=>{let n=this.createEventFromTouch(t);this.recordCoords(n),this.emitter.trigger("pointermove",n)},this.handleTouchEnd=t=>{if(this.isDragging){let n=t.target;n.removeEventListener("touchmove",this.handleTouchMove),n.removeEventListener("touchend",this.handleTouchEnd),n.removeEventListener("touchcancel",this.handleTouchEnd),window.removeEventListener("scroll",this.handleTouchScroll,!0),this.emitter.trigger("pointerup",this.createEventFromTouch(t)),this.cleanup(),this.isTouchDragging=!1,Cct()}},this.handleTouchScroll=()=>{this.wasTouchScroll=!0},this.handleScroll=t=>{if(!this.shouldIgnoreMove){let n=window.scrollX-this.prevScrollX+this.prevPageX,i=window.scrollY-this.prevScrollY+this.prevPageY;this.emitter.trigger("pointermove",{origEvent:t,isTouch:this.isTouchDragging,subjectEl:this.subjectEl,pageX:n,pageY:i,deltaX:n-this.origPageX,deltaY:i-this.origPageY})}},this.containerEl=e,this.emitter=new Ru,e.addEventListener("mousedown",this.handleMouseDown),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),Dct()}destroy(){this.containerEl.removeEventListener("mousedown",this.handleMouseDown),this.containerEl.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),Pct()}tryStart(e){let t=this.querySubjectEl(e),n=e.target;return t&&(!this.handleSelector||pi(n,this.handleSelector))?(this.subjectEl=t,this.isDragging=!0,this.wasTouchScroll=!1,!0):!1}cleanup(){V4=!1,this.isDragging=!1,this.subjectEl=null,this.destroyScrollWatch()}querySubjectEl(e){return this.selector?pi(e.target,this.selector):this.containerEl}shouldIgnoreMouse(){return H4||this.isTouchDragging}cancelTouchScroll(){this.isDragging&&(V4=!0)}initScrollWatch(e){this.shouldWatchScroll&&(this.recordCoords(e),window.addEventListener("scroll",this.handleScroll,!0))}recordCoords(e){this.shouldWatchScroll&&(this.prevPageX=e.pageX,this.prevPageY=e.pageY,this.prevScrollX=window.scrollX,this.prevScrollY=window.scrollY)}destroyScrollWatch(){this.shouldWatchScroll&&window.removeEventListener("scroll",this.handleScroll,!0)}createEventFromMouse(e,t){let n=0,i=0;return t?(this.origPageX=e.pageX,this.origPageY=e.pageY):(n=e.pageX-this.origPageX,i=e.pageY-this.origPageY),{origEvent:e,isTouch:!1,subjectEl:this.subjectEl,pageX:e.pageX,pageY:e.pageY,deltaX:n,deltaY:i}}createEventFromTouch(e,t){let n=e.touches,i,a,s=0,o=0;return n&&n.length?(i=n[0].pageX,a=n[0].pageY):(i=e.pageX,a=e.pageY),t?(this.origPageX=i,this.origPageY=a):(s=i-this.origPageX,o=a-this.origPageY),{origEvent:e,isTouch:!0,subjectEl:this.subjectEl,pageX:i,pageY:a,deltaX:s,deltaY:o}}};q4=class{constructor(){this.isVisible=!1,this.sourceEl=null,this.mirrorEl=null,this.sourceElRect=null,this.parentNode=document.body,this.zIndex=9999,this.revertDuration=0}start(e,t,n){this.sourceEl=e,this.sourceElRect=this.sourceEl.getBoundingClientRect(),this.origScreenX=t-window.scrollX,this.origScreenY=n-window.scrollY,this.deltaX=0,this.deltaY=0,this.updateElPosition()}handleMove(e,t){this.deltaX=e-window.scrollX-this.origScreenX,this.deltaY=t-window.scrollY-this.origScreenY,this.updateElPosition()}setIsVisible(e){e?this.isVisible||(this.mirrorEl&&(this.mirrorEl.style.display=""),this.isVisible=e,this.updateElPosition()):this.isVisible&&(this.mirrorEl&&(this.mirrorEl.style.display="none"),this.isVisible=e)}stop(e,t){let n=()=>{this.cleanup(),t()};e&&this.mirrorEl&&this.isVisible&&this.revertDuration&&(this.deltaX||this.deltaY)?this.doRevertAnimation(n,this.revertDuration):setTimeout(n,0)}doRevertAnimation(e,t){let n=this.mirrorEl,i=this.sourceEl.getBoundingClientRect();n.style.transition="top "+t+"ms,left "+t+"ms",mg(n,{left:i.left,top:i.top}),qW(n,()=>{n.style.transition="",e()})}cleanup(){this.mirrorEl&&(GC(this.mirrorEl),this.mirrorEl=null),this.sourceEl=null}updateElPosition(){this.sourceEl&&this.isVisible&&mg(this.getMirrorEl(),{left:this.sourceElRect.left+this.deltaX,top:this.sourceElRect.top+this.deltaY})}getMirrorEl(){let e=this.sourceElRect,t=this.mirrorEl;return t||(t=this.mirrorEl=this.sourceEl.cloneNode(!0),t.style.userSelect="none",t.style.webkitUserSelect="none",t.style.pointerEvents="none",t.classList.add("fc-event-dragging"),mg(t,{position:"fixed",zIndex:this.zIndex,visibility:"",boxSizing:"border-box",width:e.right-e.left,height:e.bottom-e.top,right:"auto",bottom:"auto",margin:0}),this.parentNode.appendChild(t)),t}},uO=class extends sg{constructor(e,t){super(),this.handleScroll=()=>{this.scrollTop=this.scrollController.getScrollTop(),this.scrollLeft=this.scrollController.getScrollLeft(),this.handleScrollChange()},this.scrollController=e,this.doesListening=t,this.scrollTop=this.origScrollTop=e.getScrollTop(),this.scrollLeft=this.origScrollLeft=e.getScrollLeft(),this.scrollWidth=e.getScrollWidth(),this.scrollHeight=e.getScrollHeight(),this.clientWidth=e.getClientWidth(),this.clientHeight=e.getClientHeight(),this.clientRect=this.computeClientRect(),this.doesListening&&this.getEventTarget().addEventListener("scroll",this.handleScroll)}destroy(){this.doesListening&&this.getEventTarget().removeEventListener("scroll",this.handleScroll)}getScrollTop(){return this.scrollTop}getScrollLeft(){return this.scrollLeft}setScrollTop(e){this.scrollController.setScrollTop(e),this.doesListening||(this.scrollTop=Math.max(Math.min(e,this.getMaxScrollTop()),0),this.handleScrollChange())}setScrollLeft(e){this.scrollController.setScrollLeft(e),this.doesListening||(this.scrollLeft=Math.max(Math.min(e,this.getMaxScrollLeft()),0),this.handleScrollChange())}getClientWidth(){return this.clientWidth}getClientHeight(){return this.clientHeight}getScrollWidth(){return this.scrollWidth}getScrollHeight(){return this.scrollHeight}handleScrollChange(){}},pO=class extends uO{constructor(e,t){super(new HC(e),t)}getEventTarget(){return this.scrollController.el}computeClientRect(){return D4(this.scrollController.el)}},W4=class extends uO{constructor(e){super(new VC,e)}getEventTarget(){return window}computeClientRect(){return{left:this.scrollLeft,right:this.scrollLeft+this.clientWidth,top:this.scrollTop,bottom:this.scrollTop+this.clientHeight}}handleScrollChange(){this.clientRect=this.computeClientRect()}},hPe=typeof performance=="function"?performance.now:Date.now,Y4=class{constructor(){this.isEnabled=!0,this.scrollQuery=[window,".fc-scroller"],this.edgeThreshold=50,this.maxVelocity=300,this.pointerScreenX=null,this.pointerScreenY=null,this.isAnimating=!1,this.scrollCaches=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.animate=()=>{if(this.isAnimating){let e=this.computeBestEdge(this.pointerScreenX+window.scrollX,this.pointerScreenY+window.scrollY);if(e){let t=hPe();this.handleSide(e,(t-this.msSinceRequest)/1e3),this.requestAnimation(t)}else this.isAnimating=!1}}}start(e,t,n){this.isEnabled&&(this.scrollCaches=this.buildCaches(n),this.pointerScreenX=null,this.pointerScreenY=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.handleMove(e,t))}handleMove(e,t){if(this.isEnabled){let n=e-window.scrollX,i=t-window.scrollY,a=this.pointerScreenY===null?0:i-this.pointerScreenY,s=this.pointerScreenX===null?0:n-this.pointerScreenX;a<0?this.everMovedUp=!0:a>0&&(this.everMovedDown=!0),s<0?this.everMovedLeft=!0:s>0&&(this.everMovedRight=!0),this.pointerScreenX=n,this.pointerScreenY=i,this.isAnimating||(this.isAnimating=!0,this.requestAnimation(hPe()))}}stop(){if(this.isEnabled){this.isAnimating=!1;for(let e of this.scrollCaches)e.destroy();this.scrollCaches=null}}requestAnimation(e){this.msSinceRequest=e,requestAnimationFrame(this.animate)}handleSide(e,t){let{scrollCache:n}=e,{edgeThreshold:i}=this,a=i-e.distance,s=a*a/(i*i)*this.maxVelocity*t,o=1;switch(e.name){case"left":o=-1;case"right":n.setScrollLeft(n.getScrollLeft()+s*o);break;case"top":o=-1;case"bottom":n.setScrollTop(n.getScrollTop()+s*o);break}}computeBestEdge(e,t){let{edgeThreshold:n}=this,i=null,a=this.scrollCaches||[];for(let s of a){let o=s.clientRect,l=e-o.left,c=o.right-e,d=t-o.top,u=o.bottom-t;l>=0&&c>=0&&d>=0&&u>=0&&(d<=n&&this.everMovedUp&&s.canScrollUp()&&(!i||i.distance>d)&&(i={scrollCache:s,name:"top",distance:d}),u<=n&&this.everMovedDown&&s.canScrollDown()&&(!i||i.distance>u)&&(i={scrollCache:s,name:"bottom",distance:u}),l<=n&&this.everMovedLeft&&s.canScrollLeft()&&(!i||i.distance>l)&&(i={scrollCache:s,name:"left",distance:l}),c<=n&&this.everMovedRight&&s.canScrollRight()&&(!i||i.distance>c)&&(i={scrollCache:s,name:"right",distance:c}))}return i}buildCaches(e){return this.queryScrollEls(e).map(t=>t===window?new W4(!1):new pO(t,!1))}queryScrollEls(e){let t=[];for(let n of this.scrollQuery)typeof n=="object"?t.push(n):t.push(...Array.prototype.slice.call(e.getRootNode().querySelectorAll(n)));return t}},Nm=class extends YC{constructor(e,t){super(e),this.containerEl=e,this.delay=null,this.minDistance=0,this.touchScrollAllowed=!0,this.mirrorNeedsRevert=!1,this.isInteracting=!1,this.isDragging=!1,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,this.delayTimeoutId=null,this.onPointerDown=i=>{this.isDragging||(this.isInteracting=!0,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,WW(document.body),GW(document.body),i.isTouch||i.origEvent.preventDefault(),this.emitter.trigger("pointerdown",i),this.isInteracting&&!this.pointer.shouldIgnoreMove&&(this.mirror.setIsVisible(!1),this.mirror.start(i.subjectEl,i.pageX,i.pageY),this.startDelay(i),this.minDistance||this.handleDistanceSurpassed(i)))},this.onPointerMove=i=>{if(this.isInteracting){if(this.emitter.trigger("pointermove",i),!this.isDistanceSurpassed){let a=this.minDistance,s,{deltaX:o,deltaY:l}=i;s=o*o+l*l,s>=a*a&&this.handleDistanceSurpassed(i)}this.isDragging&&(i.origEvent.type!=="scroll"&&(this.mirror.handleMove(i.pageX,i.pageY),this.autoScroller.handleMove(i.pageX,i.pageY)),this.emitter.trigger("dragmove",i))}},this.onPointerUp=i=>{this.isInteracting&&(this.isInteracting=!1,YW(document.body),KW(document.body),this.emitter.trigger("pointerup",i),this.isDragging&&(this.autoScroller.stop(),this.tryStopDrag(i)),this.delayTimeoutId&&(clearTimeout(this.delayTimeoutId),this.delayTimeoutId=null))};let n=this.pointer=new dO(e);n.emitter.on("pointerdown",this.onPointerDown),n.emitter.on("pointermove",this.onPointerMove),n.emitter.on("pointerup",this.onPointerUp),t&&(n.selector=t),this.mirror=new q4,this.autoScroller=new Y4}destroy(){this.pointer.destroy(),this.onPointerUp({})}startDelay(e){typeof this.delay=="number"?this.delayTimeoutId=setTimeout(()=>{this.delayTimeoutId=null,this.handleDelayEnd(e)},this.delay):this.handleDelayEnd(e)}handleDelayEnd(e){this.isDelayEnded=!0,this.tryStartDrag(e)}handleDistanceSurpassed(e){this.isDistanceSurpassed=!0,this.tryStartDrag(e)}tryStartDrag(e){this.isDelayEnded&&this.isDistanceSurpassed&&(!this.pointer.wasTouchScroll||this.touchScrollAllowed)&&(this.isDragging=!0,this.mirrorNeedsRevert=!1,this.autoScroller.start(e.pageX,e.pageY,this.containerEl),this.emitter.trigger("dragstart",e),this.touchScrollAllowed===!1&&this.pointer.cancelTouchScroll())}tryStopDrag(e){this.mirror.stop(this.mirrorNeedsRevert,this.stopDrag.bind(this,e))}stopDrag(e){this.isDragging=!1,this.emitter.trigger("dragend",e)}setIgnoreMove(e){this.pointer.shouldIgnoreMove=e}setMirrorIsVisible(e){this.mirror.setIsVisible(e)}setMirrorNeedsRevert(e){this.mirrorNeedsRevert=e}setAutoScrollEnabled(e){this.autoScroller.isEnabled=e}},G4=class{constructor(e){this.el=e,this.origRect=aD(e),this.scrollCaches=iO(e).map(t=>new pO(t,!0))}destroy(){for(let e of this.scrollCaches)e.destroy()}computeLeft(){let e=this.origRect.left;for(let t of this.scrollCaches)e+=t.origScrollLeft-t.getScrollLeft();return e}computeTop(){let e=this.origRect.top;for(let t of this.scrollCaches)e+=t.origScrollTop-t.getScrollTop();return e}isWithinClipping(e,t){let n={left:e,top:t};for(let i of this.scrollCaches)if(!Mct(i.getEventTarget())&&!S4(n,i.clientRect))return!1;return!0}};bg=class{constructor(e,t){this.useSubjectCenter=!1,this.requireInitial=!0,this.disablePointCheck=!1,this.initialHit=null,this.movingHit=null,this.finalHit=null,this.handlePointerDown=n=>{let{dragging:i}=this;this.initialHit=null,this.movingHit=null,this.finalHit=null,this.prepareHits(),this.processFirstCoord(n),this.initialHit||!this.requireInitial?(i.setIgnoreMove(!1),this.emitter.trigger("pointerdown",n)):i.setIgnoreMove(!0)},this.handleDragStart=n=>{this.emitter.trigger("dragstart",n),this.handleMove(n,!0)},this.handleDragMove=n=>{this.emitter.trigger("dragmove",n),this.handleMove(n)},this.handlePointerUp=n=>{this.releaseHits(),this.emitter.trigger("pointerup",n)},this.handleDragEnd=n=>{this.movingHit&&this.emitter.trigger("hitupdate",null,!0,n),this.finalHit=this.movingHit,this.movingHit=null,this.emitter.trigger("dragend",n)},this.droppableStore=t,e.emitter.on("pointerdown",this.handlePointerDown),e.emitter.on("dragstart",this.handleDragStart),e.emitter.on("dragmove",this.handleDragMove),e.emitter.on("pointerup",this.handlePointerUp),e.emitter.on("dragend",this.handleDragEnd),this.dragging=e,this.emitter=new Ru}processFirstCoord(e){let t={left:e.pageX,top:e.pageY},n=t,i=e.subjectEl,a;i instanceof HTMLElement&&(a=aD(i),n=E4(n,a));let s=this.initialHit=this.queryHitForOffset(n.left,n.top);if(s){if(this.useSubjectCenter&&a){let o=nO(a,s.rect);o&&(n=x4(o))}this.coordAdjust=C4(n,t)}else this.coordAdjust={left:0,top:0}}handleMove(e,t){let n=this.queryHitForOffset(e.pageX+this.coordAdjust.left,e.pageY+this.coordAdjust.top);(t||!fO(this.movingHit,n))&&(this.movingHit=n,this.emitter.trigger("hitupdate",n,!1,e))}prepareHits(){this.offsetTrackers=Uo(this.droppableStore,e=>(e.component.prepareHits(),new G4(e.el)))}releaseHits(){let{offsetTrackers:e}=this;for(let t in e)e[t].destroy();this.offsetTrackers={}}queryHitForOffset(e,t){let{droppableStore:n,offsetTrackers:i}=this,a=null;for(let s in n){let o=n[s].component,l=i[s];if(l&&l.isWithinClipping(e,t)){let c=l.computeLeft(),d=l.computeTop(),u=e-c,p=t-d,{origRect:m}=l,f=m.right-m.left,h=m.bottom-m.top;if(u>=0&&u=0&&pa.layer)&&(g.componentId=s,g.context=o.context,g.rect.left+=c,g.rect.right+=c,g.rect.top+=d,g.rect.bottom+=d,a=g)}}}return a}};K4=class extends zl{constructor(e){super(e),this.handlePointerDown=n=>{let{dragging:i}=this,a=n.origEvent.target;i.setIgnoreMove(!this.component.isValidDateDownEl(a))},this.handleDragEnd=n=>{let{component:i}=this,{pointer:a}=this.dragging;if(!a.wasTouchScroll){let{initialHit:s,finalHit:o}=this.hitDragging;if(s&&o&&fO(s,o)){let{context:l}=i,c=Object.assign(Object.assign({},e3(s.dateSpan,l)),{dayEl:s.dayEl,jsEvent:n.origEvent,view:l.viewApi||l.calendarApi.view});l.emitter.trigger("dateClick",c)}}},this.dragging=new Nm(e.el),this.dragging.autoScroller.isEnabled=!1;let t=this.hitDragging=new bg(this.dragging,nD(e));t.emitter.on("pointerdown",this.handlePointerDown),t.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}},Z4=class extends zl{constructor(e){super(e),this.dragSelection=null,this.handlePointerDown=s=>{let{component:o,dragging:l}=this,{options:c}=o.context,d=c.selectable&&o.isValidDateDownEl(s.origEvent.target);l.setIgnoreMove(!d),l.delay=s.isTouch?Act(o):null},this.handleDragStart=s=>{this.component.context.calendarApi.unselect(s)},this.handleHitUpdate=(s,o)=>{let{context:l}=this.component,c=null,d=!1;if(s){let u=this.hitDragging.initialHit;s.componentId===u.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(u,s)||(c=Ict(u,s,l.pluginHooks.dateSelectionTransformers)),(!c||!M4(c,s.dateProfile,l))&&(d=!0,c=null)}c?l.dispatch({type:"SELECT_DATES",selection:c}):o||l.dispatch({type:"UNSELECT_DATES"}),d?pT():mT(),o||(this.dragSelection=c)},this.handlePointerUp=s=>{this.dragSelection&&(rO(this.dragSelection,s,this.component.context),this.dragSelection=null)};let{component:t}=e,{options:n}=t.context,i=this.dragging=new Nm(e.el);i.touchScrollAllowed=!1,i.minDistance=n.selectMinDistance||0,i.autoScroller.isEnabled=n.dragScroll;let a=this.hitDragging=new bg(this.dragging,nD(e));a.emitter.on("pointerdown",this.handlePointerDown),a.emitter.on("dragstart",this.handleDragStart),a.emitter.on("hitupdate",this.handleHitUpdate),a.emitter.on("pointerup",this.handlePointerUp)}destroy(){this.dragging.destroy()}};mD=class r extends zl{constructor(e){super(e),this.subjectEl=null,this.subjectSeg=null,this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=s=>{let o=s.origEvent.target,{component:l,dragging:c}=this,{mirror:d}=c,{options:u}=l.context,p=l.context;this.subjectEl=s.subjectEl;let m=this.subjectSeg=$u(s.subjectEl),h=(this.eventRange=m.eventRange).instance.instanceId;this.relevantEvents=eD(p.getCurrentData().eventStore,h),c.minDistance=s.isTouch?0:u.eventDragMinDistance,c.delay=s.isTouch&&h!==l.props.eventSelection?Rct(l):null,u.fixedMirrorParent?d.parentNode=u.fixedMirrorParent:d.parentNode=pi(o,".fc"),d.revertDuration=u.dragRevertDuration;let g=l.isValidSegDownEl(o)&&!pi(o,".fc-event-resizer");c.setIgnoreMove(!g),this.isDragging=g&&s.subjectEl.classList.contains("fc-event-draggable")},this.handleDragStart=s=>{let o=this.component.context,l=this.eventRange,c=l.instance.instanceId;s.isTouch?c!==this.component.props.eventSelection&&o.dispatch({type:"SELECT_EVENT",eventInstanceId:c}):o.dispatch({type:"UNSELECT_EVENT"}),this.isDragging&&(o.calendarApi.unselect(s),o.emitter.trigger("eventDragStart",{el:this.subjectEl,event:new Nr(o,l.def,l.instance),jsEvent:s.origEvent,view:o.viewApi}))},this.handleHitUpdate=(s,o)=>{if(!this.isDragging)return;let l=this.relevantEvents,c=this.hitDragging.initialHit,d=this.component.context,u=null,p=null,m=null,f=!1,h={affectedEvents:l,mutatedEvents:mi(),isEvent:!0};if(s){u=s.context;let g=u.options;d===u||g.editable&&g.droppable?(p=Nct(c,s,this.eventRange.instance.range.start,u.getCurrentData().pluginHooks.eventDragMutationMassagers),p&&(m=tD(l,u.getCurrentData().eventUiBases,p,u),h.mutatedEvents=m,lD(h,s.dateProfile,u)||(f=!0,p=null,m=null,h.mutatedEvents=mi()))):u=null}this.displayDrag(u,h),f?pT():mT(),o||(d===u&&fO(c,s)&&(p=null),this.dragging.setMirrorNeedsRevert(!p),this.dragging.setMirrorIsVisible(!s||!this.subjectEl.getRootNode().querySelector(".fc-event-mirror")),this.receivingContext=u,this.validMutation=p,this.mutatedRelevantEvents=m)},this.handlePointerUp=()=>{this.isDragging||this.cleanup()},this.handleDragEnd=s=>{if(this.isDragging){let o=this.component.context,l=o.viewApi,{receivingContext:c,validMutation:d}=this,u=this.eventRange.def,p=this.eventRange.instance,m=new Nr(o,u,p),f=this.relevantEvents,h=this.mutatedRelevantEvents,{finalHit:g}=this.hitDragging;if(this.clearDrag(),o.emitter.trigger("eventDragStop",{el:this.subjectEl,event:m,jsEvent:s.origEvent,view:l}),d){if(c===o){let v=new Nr(o,h.defs[u.defId],p?h.instances[p.instanceId]:null);o.dispatch({type:"MERGE_EVENTS",eventStore:h});let k={oldEvent:m,event:v,relatedEvents:td(h,o,p),revert(){o.dispatch({type:"MERGE_EVENTS",eventStore:f})}},b={};for(let w of o.getCurrentData().pluginHooks.eventDropTransformers)Object.assign(b,w(d,o));o.emitter.trigger("eventDrop",Object.assign(Object.assign(Object.assign({},k),b),{el:s.subjectEl,delta:d.datesDelta,jsEvent:s.origEvent,view:l})),o.emitter.trigger("eventChange",k)}else if(c){let v={event:m,relatedEvents:td(f,o,p),revert(){o.dispatch({type:"MERGE_EVENTS",eventStore:f})}};o.emitter.trigger("eventLeave",Object.assign(Object.assign({},v),{draggedEl:s.subjectEl,view:l})),o.dispatch({type:"REMOVE_EVENTS",eventStore:f}),o.emitter.trigger("eventRemove",v);let k=h.defs[u.defId],b=h.instances[p.instanceId],w=new Nr(c,k,b);c.dispatch({type:"MERGE_EVENTS",eventStore:h});let S={event:w,relatedEvents:td(h,c,b),revert(){c.dispatch({type:"REMOVE_EVENTS",eventStore:h})}};c.emitter.trigger("eventAdd",S),s.isTouch&&c.dispatch({type:"SELECT_EVENT",eventInstanceId:p.instanceId}),c.emitter.trigger("drop",Object.assign(Object.assign({},e3(g.dateSpan,c)),{draggedEl:s.subjectEl,jsEvent:s.origEvent,view:g.context.viewApi})),c.emitter.trigger("eventReceive",Object.assign(Object.assign({},S),{draggedEl:s.subjectEl,view:g.context.viewApi}))}}else o.emitter.trigger("_noEventDrop")}this.cleanup()};let{component:t}=this,{options:n}=t.context,i=this.dragging=new Nm(e.el);i.pointer.selector=r.SELECTOR,i.touchScrollAllowed=!1,i.autoScroller.isEnabled=n.dragScroll;let a=this.hitDragging=new bg(this.dragging,hg);a.useSubjectCenter=e.useEventCenter,a.emitter.on("pointerdown",this.handlePointerDown),a.emitter.on("dragstart",this.handleDragStart),a.emitter.on("hitupdate",this.handleHitUpdate),a.emitter.on("pointerup",this.handlePointerUp),a.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}displayDrag(e,t){let n=this.component.context,i=this.receivingContext;i&&i!==e&&(i===n?i.dispatch({type:"SET_EVENT_DRAG",state:{affectedEvents:t.affectedEvents,mutatedEvents:mi(),isEvent:!0}}):i.dispatch({type:"UNSET_EVENT_DRAG"})),e&&e.dispatch({type:"SET_EVENT_DRAG",state:t})}clearDrag(){let e=this.component.context,{receivingContext:t}=this;t&&t.dispatch({type:"UNSET_EVENT_DRAG"}),e!==t&&e.dispatch({type:"UNSET_EVENT_DRAG"})}cleanup(){this.subjectSeg=null,this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null}};mD.SELECTOR=".fc-event-draggable, .fc-event-resizable";Q4=class extends zl{constructor(e){super(e),this.draggingSegEl=null,this.draggingSeg=null,this.eventRange=null,this.relevantEvents=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=a=>{let{component:s}=this,o=this.querySegEl(a),l=$u(o),c=this.eventRange=l.eventRange;this.dragging.minDistance=s.context.options.eventDragMinDistance,this.dragging.setIgnoreMove(!this.component.isValidSegDownEl(a.origEvent.target)||a.isTouch&&this.component.props.eventSelection!==c.instance.instanceId)},this.handleDragStart=a=>{let{context:s}=this.component,o=this.eventRange;this.relevantEvents=eD(s.getCurrentData().eventStore,this.eventRange.instance.instanceId);let l=this.querySegEl(a);this.draggingSegEl=l,this.draggingSeg=$u(l),s.calendarApi.unselect(),s.emitter.trigger("eventResizeStart",{el:l,event:new Nr(s,o.def,o.instance),jsEvent:a.origEvent,view:s.viewApi})},this.handleHitUpdate=(a,s,o)=>{let{context:l}=this.component,c=this.relevantEvents,d=this.hitDragging.initialHit,u=this.eventRange.instance,p=null,m=null,f=!1,h={affectedEvents:c,mutatedEvents:mi(),isEvent:!0};a&&(a.componentId===d.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(d,a)||(p=Oct(d,a,o.subjectEl.classList.contains("fc-event-resizer-start"),u.range))),p&&(m=tD(c,l.getCurrentData().eventUiBases,p,l),h.mutatedEvents=m,lD(h,a.dateProfile,l)||(f=!0,p=null,m=null,h.mutatedEvents=null)),m?l.dispatch({type:"SET_EVENT_RESIZE",state:h}):l.dispatch({type:"UNSET_EVENT_RESIZE"}),f?pT():mT(),s||(p&&fO(d,a)&&(p=null),this.validMutation=p,this.mutatedRelevantEvents=m)},this.handleDragEnd=a=>{let{context:s}=this.component,o=this.eventRange.def,l=this.eventRange.instance,c=new Nr(s,o,l),d=this.relevantEvents,u=this.mutatedRelevantEvents;if(s.emitter.trigger("eventResizeStop",{el:this.draggingSegEl,event:c,jsEvent:a.origEvent,view:s.viewApi}),this.validMutation){let p=new Nr(s,u.defs[o.defId],l?u.instances[l.instanceId]:null);s.dispatch({type:"MERGE_EVENTS",eventStore:u});let m={oldEvent:c,event:p,relatedEvents:td(u,s,l),revert(){s.dispatch({type:"MERGE_EVENTS",eventStore:d})}};s.emitter.trigger("eventResize",Object.assign(Object.assign({},m),{el:this.draggingSegEl,startDelta:this.validMutation.startDelta||ct(0),endDelta:this.validMutation.endDelta||ct(0),jsEvent:a.origEvent,view:s.viewApi})),s.emitter.trigger("eventChange",m)}else s.emitter.trigger("_noEventResize");this.draggingSeg=null,this.relevantEvents=null,this.validMutation=null};let{component:t}=e,n=this.dragging=new Nm(e.el);n.pointer.selector=".fc-event-resizer",n.touchScrollAllowed=!1,n.autoScroller.isEnabled=t.context.options.dragScroll;let i=this.hitDragging=new bg(this.dragging,nD(e));i.emitter.on("pointerdown",this.handlePointerDown),i.emitter.on("dragstart",this.handleDragStart),i.emitter.on("hitupdate",this.handleHitUpdate),i.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}querySegEl(e){return pi(e.subjectEl,".fc-event")}};J4=class{constructor(e){this.context=e,this.isRecentPointerDateSelect=!1,this.matchesCancel=!1,this.matchesEvent=!1,this.onSelect=n=>{n.jsEvent&&(this.isRecentPointerDateSelect=!0)},this.onDocumentPointerDown=n=>{let i=this.context.options.unselectCancel,a=WR(n.origEvent);this.matchesCancel=!!pi(a,i),this.matchesEvent=!!pi(a,mD.SELECTOR)},this.onDocumentPointerUp=n=>{let{context:i}=this,{documentPointer:a}=this,s=i.getCurrentData();if(!a.wasTouchScroll){if(s.dateSelection&&!this.isRecentPointerDateSelect){let o=i.options.unselectAuto;o&&(!o||!this.matchesCancel)&&i.calendarApi.unselect(n)}s.eventSelection&&!this.matchesEvent&&i.dispatch({type:"UNSELECT_EVENT"})}this.isRecentPointerDateSelect=!1};let t=this.documentPointer=new dO(document);t.shouldIgnoreMove=!0,t.shouldWatchScroll=!1,t.emitter.on("pointerdown",this.onDocumentPointerDown),t.emitter.on("pointerup",this.onDocumentPointerUp),e.emitter.on("select",this.onSelect)}destroy(){this.context.emitter.off("select",this.onSelect),this.documentPointer.destroy()}},Lct={fixedMirrorParent:j},Fct={dateClick:j,eventDragStart:j,eventDragStop:j,eventDrop:j,eventResizeStart:j,eventResizeStop:j,eventResize:j,drop:j,eventReceive:j,eventLeave:j},X4=class{constructor(e,t){this.receivingContext=null,this.droppableEvent=null,this.suppliedDragMeta=null,this.dragMeta=null,this.handleDragStart=i=>{this.dragMeta=this.buildDragMeta(i.subjectEl)},this.handleHitUpdate=(i,a,s)=>{let{dragging:o}=this.hitDragging,l=null,c=null,d=!1,u={affectedEvents:mi(),mutatedEvents:mi(),isEvent:this.dragMeta.create};i&&(l=i.context,this.canDropElOnCalendar(s.subjectEl,l)&&(c=$ct(i.dateSpan,this.dragMeta,l),u.mutatedEvents=ag(c),d=!lD(u,i.dateProfile,l),d&&(u.mutatedEvents=mi(),c=null))),this.displayDrag(l,u),o.setMirrorIsVisible(a||!c||!document.querySelector(".fc-event-mirror")),d?pT():mT(),a||(o.setMirrorNeedsRevert(!c),this.receivingContext=l,this.droppableEvent=c)},this.handleDragEnd=i=>{let{receivingContext:a,droppableEvent:s}=this;if(this.clearDrag(),a&&s){let o=this.hitDragging.finalHit,l=o.context.viewApi,c=this.dragMeta;if(a.emitter.trigger("drop",Object.assign(Object.assign({},e3(o.dateSpan,a)),{draggedEl:i.subjectEl,jsEvent:i.origEvent,view:l})),c.create){let d=ag(s);a.dispatch({type:"MERGE_EVENTS",eventStore:d}),i.isTouch&&a.dispatch({type:"SELECT_EVENT",eventInstanceId:s.instance.instanceId}),a.emitter.trigger("eventReceive",{event:new Nr(a,s.def,s.instance),relatedEvents:[],revert(){a.dispatch({type:"REMOVE_EVENTS",eventStore:d})},draggedEl:i.subjectEl,view:l})}}this.receivingContext=null,this.droppableEvent=null};let n=this.hitDragging=new bg(e,hg);n.requireInitial=!1,n.emitter.on("dragstart",this.handleDragStart),n.emitter.on("hitupdate",this.handleHitUpdate),n.emitter.on("dragend",this.handleDragEnd),this.suppliedDragMeta=t}buildDragMeta(e){return typeof this.suppliedDragMeta=="object"?oD(this.suppliedDragMeta):typeof this.suppliedDragMeta=="function"?oD(this.suppliedDragMeta(e)):zct(e)}displayDrag(e,t){let n=this.receivingContext;n&&n!==e&&n.dispatch({type:"UNSET_EVENT_DRAG"}),e&&e.dispatch({type:"SET_EVENT_DRAG",state:t})}clearDrag(){this.receivingContext&&this.receivingContext.dispatch({type:"UNSET_EVENT_DRAG"})}canDropElOnCalendar(e,t){let n=t.options.dropAccept;return typeof n=="function"?n.call(t.calendarApi,e):typeof n=="string"&&n?!!qR(e,n):!0}};wT.dataAttrPrefix="";mO=class{constructor(e,t={}){this.handlePointerDown=i=>{let{dragging:a}=this,{minDistance:s,longPressDelay:o}=this.settings;a.minDistance=s!=null?s:i.isTouch?0:ed.eventDragMinDistance,a.delay=i.isTouch?o!=null?o:ed.longPressDelay:0},this.handleDragStart=i=>{i.isTouch&&this.dragging.delay&&i.subjectEl.classList.contains("fc-event")&&this.dragging.mirror.getMirrorEl().classList.add("fc-event-selected")},this.settings=t;let n=this.dragging=new Nm(e);n.touchScrollAllowed=!1,t.itemSelector!=null&&(n.pointer.selector=t.itemSelector),t.appendTo!=null&&(n.mirror.parentNode=t.appendTo),n.emitter.on("pointerdown",this.handlePointerDown),n.emitter.on("dragstart",this.handleDragStart),new X4(n,t.eventData)}destroy(){this.dragging.destroy()}},yPe=pa({name:"@fullcalendar/interaction",componentInteractions:[K4,Z4,mD,Q4],calendarInteractions:[J4],elementDraggingImpl:Nm,optionRefiners:Lct,listenerRefiners:Fct})});var hO,vPe=y(()=>{t3();hO=class{constructor(e){this.draggableInstances=new Map;this.plugin=e}makeTaskCardDraggable(e,t){if(this.draggableInstances.has(e))return;e.dataset.taskPath=t;let n=new mO(e);this.draggableInstances.set(e,n),e.classList.remove("tn-static-cursor-pointer-2723efcc","tn-static-cursor-pointer-3b6a3a65"),e.classList.add("tn-static-cursor-grab-dad79857"),e.addEventListener("dragstart",i=>{e.classList.add("task-card--dragging"),i.dataTransfer&&(i.dataTransfer.setData("text/plain",t),i.dataTransfer.setData("application/x-task-path",t),i.dataTransfer.effectAllowed="copy")}),e.addEventListener("dragend",()=>{e.classList.remove("task-card--dragging")})}removeDraggable(e){let t=this.draggableInstances.get(e);t&&(t.destroy(),this.draggableInstances.delete(e))}destroy(){this.draggableInstances.forEach(e=>{e.destroy()}),this.draggableInstances.clear()}}});function gO(r){if(!r)return null;let e=Date.parse(r);return Number.isFinite(e)?e:null}function Rm(r){return Number.isFinite(r)?Math.max(1,Math.min(7200,Math.floor(r))):60}function r3(r){return Rm(r.plannedDuration*60)}function xT(r,e=Date.now()){var t;return((t=r.activePeriods)!=null?t:[]).reduce((n,i)=>{var l;let a=gO(i.startTime);if(a===null)return n;let s=(l=gO(i.endTime))!=null?l:e,o=Math.max(0,s-a);return n+Math.floor(o/1e3)},0)}function yO(r,e=Date.now()){let t=r3(r),n=xT(r,e);return Math.max(0,t-n)}function bPe(r,e=Date.now()){let t=r3(r);if(t<=0)return 0;let n=xT(r,e);return Math.max(0,Math.min(1,n/t))}function TPe(r,e=Date.now()){var n,i;let t=r3(r)*1e3;for(let a of(n=r.activePeriods)!=null?n:[]){let s=gO(a.startTime);if(s===null)continue;let o=(i=gO(a.endTime))!=null?i:e,l=Math.max(0,o-s);if(l>=t)return s+t;t-=l}return null}function kPe(r){let e=new Date(r),t=-e.getTimezoneOffset(),n=t>=0?"+":"-",i=(o,l=2)=>String(Math.abs(o)).padStart(l,"0"),a=i(Math.floor(Math.abs(t)/60)),s=i(Math.abs(t)%60);return`${e.getFullYear()}-${i(e.getMonth()+1)}-${i(e.getDate())}T${i(e.getHours())}:${i(e.getMinutes())}:${i(e.getSeconds())}.${i(e.getMilliseconds(),3)}${n}${a}:${s}`}function CT(r,e={}){var c;let t=Math.max(0,Math.floor(r)),n=Math.floor(t/60),i=t%60,a=Math.floor(n/60),s=n%60,o=(c=e.padMinutes)!=null?c:!0;return a>0?`${a}:${s.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`:`${o?n.toString().padStart(2,"0"):n.toString()}:${i.toString().padStart(2,"0")}`}function wPe(r){let e=r.trim();if(!e)return null;let t=e.split(":");if(t.length<1||t.length>3||!t.every(a=>/^\d+$/.test(a)))return null;let n=t.map(a=>Number(a));if(n.some(a=>!Number.isSafeInteger(a)))return null;let i;if(n.length===1)i=n[0]*60;else if(n.length===2){let[a,s]=n;if(s>59)return null;i=a*60+s}else{let[a,s,o]=n;if(s>59||o>59)return null;i=a*3600+s*60+o}return i<=0?null:Rm(i)}var vO=y(()=>{});var id,SPe,bO,EPe=y(()=>{Ur();HV();id=require("obsidian");No();vO();G();SPe=I({tag:"Services/StatusBarService"}),bO=class{constructor(e){this.statusBarElement=null;this.pomodoroStatusBarElement=null;this.updateTimeout=null;this.pomodoroUpdateTimeout=null;this.elapsedUpdateInterval=null;this.currentTrackedTasks=[];this.pomodoroEventRefs=[];this.plugin=e,this.requestDeduplicator=new xb}initialize(){this.ensureTrackedStatusBarElement(),this.ensurePomodoroStatusBarElement(),this.registerPomodoroEvents(),this.updateStatusBar(),this.updatePomodoroStatusBar()}ensureTrackedStatusBarElement(){this.statusBarElement||!this.plugin.settings.showTrackedTasksInStatusBar||(this.statusBarElement=this.plugin.addStatusBarItem(),this.statusBarElement.addClass("tasknotes-status-bar"),this.statusBarElement.classList.remove("tn-static-cursor-grab-dad79857","tn-static-cursor-pointer-2723efcc"),this.statusBarElement.classList.add("tn-static-cursor-pointer-3b6a3a65"),this.statusBarElement.addEventListener("click",()=>{this.handleStatusBarClick()}))}ensurePomodoroStatusBarElement(){this.pomodoroStatusBarElement||!this.plugin.settings.showPomodoroInStatusBar||(this.pomodoroStatusBarElement=this.plugin.addStatusBarItem(),this.pomodoroStatusBarElement.addClass("tasknotes-status-bar"),this.pomodoroStatusBarElement.addClass("tasknotes-pomodoro-status"),this.pomodoroStatusBarElement.classList.remove("tn-static-cursor-grab-dad79857","tn-static-cursor-pointer-2723efcc"),this.pomodoroStatusBarElement.classList.add("tn-static-cursor-pointer-3b6a3a65"),this.pomodoroStatusBarElement.addEventListener("click",()=>{this.plugin.activatePomodoroView()}))}registerPomodoroEvents(){var t;if(this.pomodoroEventRefs.length>0||!((t=this.plugin.emitter)!=null&&t.on))return;let e=()=>this.requestPomodoroUpdate();this.pomodoroEventRefs=[this.plugin.emitter.on(Ud,e),this.plugin.emitter.on(Pa,e),this.plugin.emitter.on(Hd,e),this.plugin.emitter.on(Vd,e)]}async updateStatusBar(){if(!this.statusBarElement){this.stopElapsedTicker();return}if(!this.plugin.settings.showTrackedTasksInStatusBar){this.hide();return}try{let e=await this.requestDeduplicator.execute("update-status-bar",()=>this.getTrackedTasks());this.renderStatusBar(e)}catch(e){SPe.error("Error updating status bar:",{category:"internal",operation:"updating-status-bar",error:e})}}updatePomodoroStatusBar(){if(!this.plugin.settings.showPomodoroInStatusBar){this.hidePomodoroStatusBar();return}if(this.ensurePomodoroStatusBarElement(),!this.pomodoroStatusBarElement||!this.plugin.pomodoroService)return;let e=this.plugin.pomodoroService.getState();if(!e.currentSession){this.hidePomodoroStatusBar();return}this.showElement(this.pomodoroStatusBarElement),this.renderPomodoroStatusBar(e)}async getTrackedTasks(){return(await this.plugin.cacheManager.getAllTasks()).filter(t=>t.archived?!1:this.plugin.getActiveTimeSession(t)!==null)}renderStatusBar(e){if(!this.statusBarElement)return;this.currentTrackedTasks=[...e];let t=e.length;if(t===0){this.stopElapsedTicker(),this.statusBarElement.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"),this.statusBarElement.classList.add("tn-static-display-none-6b99de8b");return}this.startElapsedTicker(),this.statusBarElement.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),this.statusBarElement.style.removeProperty("display"),this.statusBarElement.empty();let n=this.statusBarElement.createEl("span",{cls:"tasknotes-status-icon"});(0,id.setIcon)(n,"timer");let i=this.statusBarElement.createEl("span",{cls:"tasknotes-status-text"});if(t===1){let a=e[0],s=a.title.length>30?a.title.substring(0,30)+"...":a.title,o=this.formatElapsedDuration(this.getActiveElapsedMs(a));i.setText(`Tracking: ${s} (${o})`),(0,id.setTooltip)(this.statusBarElement,`Currently tracking: ${a.title} +Elapsed: ${o}`,{placement:"top"})}else{let a=this.formatElapsedDuration(e.reduce((l,c)=>l+this.getActiveElapsedMs(c),0));i.setText(`Tracking ${t} tasks (${a} total)`);let s=e.slice(0,5).map(l=>`${l.title} - ${this.formatElapsedDuration(this.getActiveElapsedMs(l))}`).join(` +`),o=t>5?`${s} +... and ${t-5} more`:s;(0,id.setTooltip)(this.statusBarElement,`Currently tracking: +${o}`,{placement:"top"})}}renderPomodoroStatusBar(e){if(!this.pomodoroStatusBarElement||!e.currentSession)return;this.pomodoroStatusBarElement.empty();let t=this.pomodoroStatusBarElement.createEl("span",{cls:"tasknotes-status-icon"});(0,id.setIcon)(t,e.currentSession.type==="work"?"timer":"coffee");let n=this.pomodoroStatusBarElement.createEl("span",{cls:"tasknotes-status-text"}),i=CT(e.timeRemaining),a=this.getPomodoroSessionLabel(e.currentSession.type),s=e.isRunning?a:`${a} paused`;n.setText(`${s}: ${i}`),(0,id.setTooltip)(this.pomodoroStatusBarElement,`${s} +Remaining: ${i} +Click to open Pomodoro`,{placement:"top"})}getPomodoroSessionLabel(e){return e==="work"?"Focus":e==="short-break"?"Short break":"Long break"}showElement(e){e.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),e.style.removeProperty("display")}getActiveElapsedMs(e){let t=this.plugin.getActiveTimeSession(e);if(!(t!=null&&t.startTime))return 0;let n=Date.parse(t.startTime);return Number.isFinite(n)?Math.max(0,Date.now()-n):0}formatElapsedDuration(e){let t=Math.floor(e/1e3),n=t%60,i=Math.floor(t/60),a=i%60,s=Math.floor(i/60);return s>0?`${s}:${a.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`:`${a}:${n.toString().padStart(2,"0")}`}startElapsedTicker(){this.elapsedUpdateInterval===null&&(this.elapsedUpdateInterval=window.setInterval(()=>{if(this.currentTrackedTasks.length===0){this.stopElapsedTicker();return}this.renderStatusBar(this.currentTrackedTasks)},1e3))}stopElapsedTicker(){this.elapsedUpdateInterval!==null&&(window.clearInterval(this.elapsedUpdateInterval),this.elapsedUpdateInterval=null),this.currentTrackedTasks=[]}async handleStatusBarClick(){try{let e=await this.getTrackedTasks();if(e.length===0)return;if(e.length===1){let t=e[0],n=this.plugin.app.vault.getAbstractFileByPath(t.path);n instanceof id.TFile&&await this.plugin.app.workspace.getLeaf(!1).openFile(n)}else Pn(this.plugin,e,t=>{(async()=>{if(t){let n=this.plugin.app.vault.getAbstractFileByPath(t.path);n instanceof id.TFile&&await this.plugin.app.workspace.getLeaf(!1).openFile(n)}})()})}catch(e){SPe.error("Error handling status bar click:",{category:"internal",operation:"handling-status-bar-click",error:e})}}requestUpdate(){this.updateTimeout&&window.clearTimeout(this.updateTimeout),this.updateTimeout=window.setTimeout(()=>{this.updateStatusBar()},100)}requestPomodoroUpdate(){this.pomodoroUpdateTimeout&&window.clearTimeout(this.pomodoroUpdateTimeout),this.pomodoroUpdateTimeout=window.setTimeout(()=>{this.updatePomodoroStatusBar()},100)}updateVisibility(){this.plugin.settings.showTrackedTasksInStatusBar?this.statusBarElement?this.updateStatusBar():this.ensureTrackedStatusBarElement():this.hide(),this.plugin.settings.showPomodoroInStatusBar?(this.ensurePomodoroStatusBarElement(),this.updatePomodoroStatusBar()):this.hidePomodoroStatusBar()}hide(){this.stopElapsedTicker(),this.statusBarElement&&(this.statusBarElement.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"),this.statusBarElement.classList.add("tn-static-display-none-6b99de8b"))}hidePomodoroStatusBar(){this.pomodoroStatusBarElement&&(this.pomodoroStatusBarElement.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-min-height-800px-997b4c8c"),this.pomodoroStatusBarElement.classList.add("tn-static-display-none-6b99de8b"))}destroy(){var e;this.updateTimeout&&(window.clearTimeout(this.updateTimeout),this.updateTimeout=null),this.pomodoroUpdateTimeout&&(window.clearTimeout(this.pomodoroUpdateTimeout),this.pomodoroUpdateTimeout=null),this.stopElapsedTicker(),(e=this.plugin.emitter)!=null&&e.offref&&this.pomodoroEventRefs.forEach(t=>this.plugin.emitter.offref(t)),this.pomodoroEventRefs=[],this.requestDeduplicator&&this.requestDeduplicator.cancelAll(),this.statusBarElement=null,this.pomodoroStatusBarElement=null}}});var xPe,n3,TO,CPe=y(()=>{xPe=require("obsidian");Ur();Ne();G();Eu();n3=I({tag:"Services/NotificationService"}),TO=class{constructor(e){this.notificationQueue=[];this.processedReminders=new Set;this.activeAudioContexts=new Set;this.audioCleanupTimeouts=new Set;this.lastBroadScanTime=Date.now();this.lastQuickCheckTime=Date.now();this.BROAD_SCAN_INTERVAL=300*1e3;this.QUICK_CHECK_INTERVAL=30*1e3;this.QUEUE_WINDOW=300*1e3;this.plugin=e}async initialize(){this.plugin.settings.enableNotifications&&(this.plugin.settings.notificationType==="system"&&typeof Notification!="undefined"&&Notification.permission==="default"&&await Notification.requestPermission(),this.setupTaskUpdateListener(),this.setupFileUpdateListener(),this.startBroadScan(),this.startQuickCheck(),await this.scanTasksAndBuildQueue())}destroy(){this.broadScanInterval&&window.clearInterval(this.broadScanInterval),this.quickCheckInterval&&window.clearInterval(this.quickCheckInterval),this.taskUpdateListener&&this.plugin.emitter.offref(this.taskUpdateListener),this.fileUpdateListener&&this.plugin.emitter.offref(this.fileUpdateListener);for(let e of this.audioCleanupTimeouts)window.clearTimeout(e);this.audioCleanupTimeouts.clear();for(let e of this.activeAudioContexts)e.state!=="closed"&&e.close().catch(()=>{});this.activeAudioContexts.clear(),this.notificationQueue=[],this.processedReminders.clear()}startBroadScan(){this.broadScanInterval=window.setInterval(()=>{(async()=>{let e=Date.now();e-this.lastBroadScanTime>this.BROAD_SCAN_INTERVAL+6e4&&await this.handleSystemWakeUp(),await this.scanTasksAndBuildQueue(),this.lastBroadScanTime=e})()},this.BROAD_SCAN_INTERVAL)}startQuickCheck(){this.quickCheckInterval=window.setInterval(()=>{let e=Date.now();e-this.lastQuickCheckTime>this.QUICK_CHECK_INTERVAL+6e4,this.checkNotificationQueue(),this.lastQuickCheckTime=e},this.QUICK_CHECK_INTERVAL)}async scanTasksAndBuildQueue(){this.notificationQueue=[];let e=await this.plugin.cacheManager.getAllTasks(),t=Date.now(),n=t+this.QUEUE_WINDOW;for(let i of e)if(!(!i.reminders||i.reminders.length===0))for(let a of i.reminders){let s=`${i.path}-${a.id}`;if(this.processedReminders.has(s))continue;let o=this.calculateNotificationTime(i,a);o!==null&&o>t&&o<=n&&this.notificationQueue.push({taskPath:i.path,reminder:a,notifyAt:o})}this.notificationQueue.sort((i,a)=>i.notifyAt-a.notifyAt)}calculateNotificationTime(e,t){try{if(t.type==="absolute")return t.absoluteTime?ut(t.absoluteTime).getTime():null;if(t.type==="relative"){if(!t.relatedTo||!t.offset)return null;let n=t.relatedTo==="due"?e.due:e.scheduled;if(!n)return null;let i=ut(n),a=this.parseISO8601Duration(t.offset);return a===null?null:i.getTime()+a}}catch(n){return n3.error("Error calculating notification time:",{category:"provider",operation:"calculating-notification-time",error:n}),null}return null}parseISO8601Duration(e){let t=e.match(/^(-?)P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);if(!t)return null;let[,n,i,a,s,o,l,c,d]=t,u=0;return i&&(u+=parseInt(i)*365*24*60*60*1e3),a&&(u+=parseInt(a)*30*24*60*60*1e3),s&&(u+=parseInt(s)*7*24*60*60*1e3),o&&(u+=parseInt(o)*24*60*60*1e3),l&&(u+=parseInt(l)*60*60*1e3),c&&(u+=parseInt(c)*60*1e3),d&&(u+=parseInt(d)*1e3),n==="-"?-u:u}checkNotificationQueue(){let e=Date.now(),t=[];for(let n=0;n=0;n--)this.notificationQueue.splice(t[n],1)}async triggerNotification(e){let t=this.plugin.app.vault.getAbstractFileByPath(e.taskPath);if(!(t instanceof xPe.TFile))return;let n=this.plugin.app.metadataCache.getFileCache(t);if(!n||!n.frontmatter)return;let i=this.plugin.fieldMapper.mapFromFrontmatter(n.frontmatter,e.taskPath,this.plugin.settings.storeTitleInFilename),a=e.reminder.description||this.generateDefaultMessage(i,e.reminder);if(this.playNotificationSound(),this.plugin.settings.notificationType==="system")if("Notification"in window&&Notification.permission==="granted"){let s=new Notification(i.title||"TaskNotes Reminder",{body:a,tag:`tasknotes-${e.taskPath}-${e.reminder.id}`});s.onclick=()=>{this.plugin.app.workspace.openLinkText(e.taskPath,"",!1),s.close()}}else this.showInAppNotice(a,e.taskPath);else this.showInAppNotice(a,e.taskPath);this.plugin.apiService&&await this.plugin.apiService.triggerWebhook("reminder.triggered",{task:i,reminder:e.reminder,notificationTime:new Date(e.notifyAt).toISOString(),message:a,notificationType:this.plugin.settings.notificationType})}playNotificationSound(){if(!this.plugin.settings.notificationSoundEnabled)return;let e=window.AudioContext||window.webkitAudioContext;if(e)try{let t=new e,n=t.createGain(),i=Math.max(0,Math.min(1,this.plugin.settings.notificationSoundVolume/100));n.gain.value=i*.3,n.connect(t.destination);let a=(l,c)=>{let d=t.createOscillator();d.connect(n),d.frequency.value=l,d.type="sine",d.start(),d.stop(t.currentTime+c)};a(880,.12),this.activeAudioContexts.add(t);let s=window.setTimeout(()=>{try{a(1175,.12)}catch(l){n3.error("Failed to play notification sound tone:",{category:"provider",operation:"play-notification-sound-tone",error:l})}},140);this.audioCleanupTimeouts.add(s);let o=window.setTimeout(()=>{this.activeAudioContexts.delete(t),this.audioCleanupTimeouts.delete(s),this.audioCleanupTimeouts.delete(o),t.close().catch(()=>{})},320);this.audioCleanupTimeouts.add(o)}catch(t){n3.error("Failed to play notification sound:",{category:"provider",operation:"play-notification-sound",error:t})}}async sendTestReminderNotification(){let e="TaskNotes Reminder",t="This is a test reminder from TaskNotes.";if(this.playNotificationSound(),this.plugin.settings.notificationType==="system"&&typeof Notification!="undefined"&&(Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission==="granted")){new Notification(e,{body:t,tag:"tasknotes-test-reminder"});return}Qe(t,5e3)}showInAppNotice(e,t){let n=Qe(e,0),i=n.noticeEl;i.addEventListener("click",()=>{this.plugin.app.workspace.openLinkText(t,"",!1),n.hide()}),i.classList.remove("tn-static-cursor-grab-dad79857","tn-static-cursor-pointer-2723efcc"),i.classList.add("tn-static-cursor-pointer-3b6a3a65")}generateDefaultMessage(e,t){if(t.type==="absolute")return`Reminder: ${e.title}`;{let n=t.relatedTo==="due"?"due":"scheduled",i=this.formatDurationForDisplay(t.offset||"");return i.startsWith("-")?`${e.title} is ${n} in ${i.substring(1)}`:i==="PT0S"||i==="PT0M"?`${e.title} is ${n} now`:`${e.title} was ${n} ${i} ago`}}formatDurationForDisplay(e){let t=this.parseISO8601Duration(e);if(t===null)return e;let n=Math.abs(t),i=Math.floor(n/(60*1e3)),a=Math.floor(n/(3600*1e3)),s=Math.floor(n/(1440*60*1e3)),o="";return s>0?o=`${s} day${s>1?"s":""}`:a>0?o=`${a} hour${a>1?"s":""}`:i>0?o=`${i} minute${i>1?"s":""}`:o="now",t<0?`-${o}`:o}async refreshReminders(){await this.scanTasksAndBuildQueue()}queueRemindersForTask(e,t){let n=Date.now(),i=n+this.QUEUE_WINDOW;if(!(!t.reminders||t.reminders.length===0)){for(let a of t.reminders){let s=`${e}-${a.id}`;if(this.processedReminders.has(s))continue;let o=this.calculateNotificationTime(t,a);o!==null&&o>n&&o<=i&&this.notificationQueue.push({taskPath:e,reminder:a,notifyAt:o})}this.notificationQueue.sort((a,s)=>a.notifyAt-s.notifyAt)}}async refreshTaskReminders(e,t){this.removeNotificationsForTask(e),this.clearProcessedRemindersForTask(e);let n=t===void 0?await this.plugin.cacheManager.getTaskInfo(e):t;n&&this.queueRemindersForTask(e,n)}clearProcessedRemindersForTask(e){let t=[];for(let n of this.processedReminders)n.startsWith(`${e}-`)&&t.push(n);t.forEach(n=>this.processedReminders.delete(n))}setupTaskUpdateListener(){this.taskUpdateListener=this.plugin.emitter.on(nt,async({path:e,updatedTask:t})=>{!e||!t||await this.refreshTaskReminders(e,t)})}setupFileUpdateListener(){this.fileUpdateListener=this.plugin.emitter.on("file-updated",async({path:e})=>{e&&await this.refreshTaskReminders(e)})}removeNotificationsForTask(e){this.notificationQueue=this.notificationQueue.filter(t=>t.taskPath!==e)}async handleSystemWakeUp(){let e=Date.now(),t=[];for(let n of this.processedReminders){let[i,a]=n.split("-",2);if(!(!i||!a))try{let s=await this.plugin.cacheManager.getTaskInfo(i);if(s&&s.reminders){let o=s.reminders.find(l=>l.id===a);if(o){let l=this.calculateNotificationTime(s,o);l&&l<=e&&t.push(n)}}}catch(s){t.push(n)}}t.forEach(n=>this.processedReminders.delete(n)),await this.scanTasksAndBuildQueue()}}});var i3,kO,DPe=y(()=>{Ur();G();i3=I({tag:"Services/ViewPerformanceService"}),kO=class{constructor(e){this.globalTaskVersionCache=new Map;this.lastGlobalRefreshTime=0;this.globalTaskCount=0;this.viewHandlers=new Map;this.viewDebounceTimers=new Map;this.viewPendingUpdates=new Map;this.viewConfigs=new Map;this.updateInProgress=new Set;this.eventListener=null;this.plugin=e,this.setupGlobalEventListener()}registerView(e,t){this.viewConfigs.set(e.viewId,{debounceDelay:100,maxBatchSize:5,changeDetectionEnabled:!0,...e}),this.viewHandlers.set(e.viewId,t),this.viewPendingUpdates.set(e.viewId,new Set)}unregisterView(e){let t=this.viewDebounceTimers.get(e);t&&(window.clearTimeout(t),this.viewDebounceTimers.delete(e)),this.viewConfigs.delete(e),this.viewHandlers.delete(e),this.viewPendingUpdates.delete(e),this.updateInProgress.delete(e)}setupGlobalEventListener(){this.eventListener=this.plugin.emitter.on(nt,async({path:e,originalTask:t,updatedTask:n})=>{if(!e||!n){await this.triggerFullRefreshForAllViews();return}n.path||(n.path=e),this.hasTaskChanged(n)&&await this.handleTaskUpdateForAllViews(n,t)})}async handleTaskUpdateForAllViews(e,t){let n=[];for(let[i,a]of this.viewHandlers)a.shouldRefreshForTask&&!a.shouldRefreshForTask(t,e)||n.push(this.scheduleViewUpdate(i,e.path));await Promise.all(n),Math.random()<.1&&await this.cleanupTaskVersionCache()}async scheduleViewUpdate(e,t){let n=this.viewConfigs.get(e);if(!n)return;let i=this.viewPendingUpdates.get(e);i&&i.add(t);let a=this.viewDebounceTimers.get(e);a&&window.clearTimeout(a);let s=window.setTimeout(()=>{this.processPendingUpdatesForView(e)},n.debounceDelay);this.viewDebounceTimers.set(e,s)}async processPendingUpdatesForView(e){if(this.updateInProgress.has(e))return;let t=this.viewConfigs.get(e),n=this.viewHandlers.get(e),i=this.viewPendingUpdates.get(e);if(!(!t||!n||!i||i.size===0)){this.updateInProgress.add(e);try{let a=Array.from(i);if(i.clear(),a.length>t.maxBatchSize)await n.refresh();else{let s=a.map(o=>n.updateForTask(o,"update").catch(l=>{i3.error(`[ViewPerformanceService] Error updating task ${o} in ${e}:`,{category:"persistence",operation:"updating-task",error:l})}));await Promise.all(s)}}catch(a){i3.error(`[ViewPerformanceService] Error processing updates for ${e}:`,{category:"validation",operation:"processing-updates",error:a}),await n.refresh()}finally{this.updateInProgress.delete(e),this.viewDebounceTimers.delete(e)}}}async triggerFullRefreshForAllViews(){let e=[];for(let[t,n]of this.viewHandlers)this.updateInProgress.has(t)||e.push(n.refresh(!0));await Promise.all(e),this.lastGlobalRefreshTime=Date.now()}hasTaskChanged(e){let t=this.globalTaskVersionCache.get(e.path),n=e.dateModified||Date.now().toString();return t!==n?(this.globalTaskVersionCache.set(e.path,n),!0):!1}shouldDoFullRefresh(){let e=Date.now()-this.lastGlobalRefreshTime,t=this.globalTaskVersionCache.size;return e>600*1e3||Math.abs(t-this.globalTaskCount)>20||t===0}async cleanupTaskVersionCache(){try{let e=this.plugin.cacheManager.getAllTaskPaths(),t=new Set(e);for(let n of this.globalTaskVersionCache.keys())t.has(n)||this.globalTaskVersionCache.delete(n);this.globalTaskCount=t.size,this.globalTaskVersionCache.size>2e3&&(this.globalTaskVersionCache.clear(),this.lastGlobalRefreshTime=0)}catch(e){i3.error("[ViewPerformanceService] Error during cache cleanup:",{category:"stale-data",operation:"cache-cleanup",error:e})}}async forceRefreshAll(){this.globalTaskVersionCache.clear(),await this.triggerFullRefreshForAllViews()}getStats(){return{registeredViews:Array.from(this.viewConfigs.keys()),cacheSize:this.globalTaskVersionCache.size,activeUpdates:Array.from(this.updateInProgress),totalPendingUpdates:Array.from(this.viewPendingUpdates.values()).reduce((e,t)=>e+t.size,0),lastGlobalRefresh:new Date(this.lastGlobalRefreshTime).toISOString()}}destroy(){this.eventListener&&(this.plugin.emitter.offref(this.eventListener),this.eventListener=null);for(let e of this.viewDebounceTimers.values())window.clearTimeout(e);this.viewHandlers.clear(),this.viewDebounceTimers.clear(),this.viewPendingUpdates.clear(),this.viewConfigs.clear(),this.updateInProgress.clear(),this.globalTaskVersionCache.clear()}}});function Bct(r){return r.width>0&&r.height>0}function Uct(r){let e=r.cacheManager.getAllTaskPaths(),t=[];for(let n of e){let i=r.cacheManager.getCachedTaskInfoSync(n);i&&!i.archived&&t.push(i)}return t}function PPe(r,e){return Bct(r)?r:e}var zu,fD,wO,MPe=y(()=>{zu=require("obsidian");Ur();No();la();xc();hI();vO();G();fD=I({tag:"Views/PomodoroView"});wO=class extends zu.ItemView{constructor(t,n){super(t);this.timerDisplay=null;this.timerInput=null;this.statusDisplay=null;this.sessionMetaDisplay=null;this.progressCircle=null;this.progressContainer=null;this.startButton=null;this.pauseButton=null;this.stopButton=null;this.taskDisplay=null;this.statsDisplay=null;this.taskSelectButton=null;this.taskClearButton=null;this.currentSelectedTask=null;this.taskCardContainer=null;this.addTimeButton=null;this.subtractTimeButton=null;this.skipBreakButton=null;this.isEditingTimer=!1;this.isTaskSelectorOpen=!1;this.todaysPomodoros=0;this.statElements={pomodoros:null};this.resizeObserver=null;this.resizeTimeout=null;this.functionListeners=[];this.currentCircleSize=300;this.currentCircumference=0;this.listeners=[];this.plugin=n,this.registerEvents()}refreshStats(){this.updateStats().catch(t=>{fD.error("Failed to update stats:",{category:"validation",operation:"update-stats",error:t})})}getViewType(){return Bd}getDisplayText(){return this.plugin.i18n.translate("views.pomodoro.title")}getIcon(){return"clock"}t(t,n){return this.plugin.i18n.translate(t,n)}registerEvents(){this.listeners.forEach(o=>this.plugin.emitter.offref(o)),this.listeners=[];let t=this.plugin.emitter.on(Ud,({session:o,task:l})=>{this.updateDisplay(o,l)});this.listeners.push(t);let n=this.plugin.emitter.on(Hd,({session:o,nextType:l})=>{this.onPomodoroComplete(o,l)});this.listeners.push(n);let i=this.plugin.emitter.on(Vd,()=>{this.updateDisplay(void 0,void 0,{refreshStats:!0})});this.listeners.push(i);let a=this.plugin.emitter.on(Pa,({timeRemaining:o,session:l})=>{this.updateTimer(o),this.updateDisplay(l)});this.listeners.push(a);let s=this.plugin.emitter.on(nt,async({path:o,originalTask:l,updatedTask:c})=>{if(!o||!c)return;if(this.currentSelectedTask&&(this.currentSelectedTask.path===o||l&&this.currentSelectedTask.path===l.path)){this.currentSelectedTask=c,this.updateTaskCardDisplay(c);let u=this.plugin.pomodoroService.getState();u.currentSession&&l&&l.path!==c.path&&u.currentSession.taskPath===l.path&&await this.plugin.pomodoroService.assignTaskToCurrentSession(c)}});this.listeners.push(s)}async onOpen(){await this.plugin.onReady(),await this.render(),this.ensureResizeHandlingSetup(),this.plugin.app.workspace.layoutReady?window.setTimeout(()=>this.ensureResizeHandlingSetup(),50):this.plugin.app.workspace.onLayoutReady(()=>{this.ensureResizeHandlingSetup()})}async onClose(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.resizeTimeout&&(window.clearTimeout(this.resizeTimeout),this.resizeTimeout=null),this.listeners.forEach(t=>this.plugin.emitter.offref(t)),this.functionListeners.forEach(t=>t()),this.timerDisplay=null,this.timerInput=null,this.statusDisplay=null,this.sessionMetaDisplay=null,this.progressCircle=null,this.progressContainer=null,this.startButton=null,this.pauseButton=null,this.stopButton=null,this.taskDisplay=null,this.statsDisplay=null,this.taskSelectButton=null,this.taskClearButton=null,this.currentSelectedTask=null,this.taskCardContainer=null,this.addTimeButton=null,this.subtractTimeButton=null,this.skipBreakButton=null,this.isEditingTimer=!1,this.statElements={pomodoros:null},this.contentEl.empty()}async render(){let t=this.contentEl.createDiv({cls:"tasknotes-plugin pomodoro-view"}),n=t.createDiv({cls:"pomodoro-view__timer-section"}),i=n.createDiv({cls:"pomodoro-view__timer-header"});this.statusDisplay=i.createDiv({cls:"pomodoro-view__status",text:this.t("views.pomodoro.status.ready")}),this.sessionMetaDisplay=i.createDiv({cls:"pomodoro-view__session-meta"}),this.progressContainer=n.createDiv({cls:"pomodoro-view__progress-container"});let a=activeDocument.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("class","pomodoro-view__progress-svg"),a.setAttribute("width","300"),a.setAttribute("height","300"),a.setAttribute("viewBox","0 0 300 300"),this.progressContainer.appendChild(a);let s=activeDocument.createElementNS("http://www.w3.org/2000/svg","circle");s.setAttributeNS(null,"cx","150"),s.setAttributeNS(null,"cy","150"),s.setAttributeNS(null,"r","140"),s.setAttributeNS(null,"fill","none"),s.setAttributeNS(null,"stroke","var(--tn-border-color)"),s.setAttributeNS(null,"stroke-width","2"),a.appendChild(s),this.progressCircle=activeDocument.createElementNS("http://www.w3.org/2000/svg","circle"),this.progressCircle.setAttributeNS(null,"cx","150"),this.progressCircle.setAttributeNS(null,"cy","150"),this.progressCircle.setAttributeNS(null,"r","140"),this.progressCircle.setAttributeNS(null,"fill","none"),this.progressCircle.setAttributeNS(null,"stroke","var(--tn-interactive-accent)"),this.progressCircle.setAttributeNS(null,"stroke-width","4"),this.progressCircle.setAttributeNS(null,"stroke-linecap","round");let l=2*Math.PI*140;this.progressCircle.setAttributeNS(null,"stroke-dasharray",l.toString()),this.progressCircle.setAttributeNS(null,"stroke-dashoffset",l.toString()),this.progressCircle.addClass("pomodoro-view__progress-circle"),a.appendChild(this.progressCircle);let c=this.progressContainer.createDiv({cls:"pomodoro-view__timer-overlay"}),u=`${this.plugin.settings.pomodoroWorkDuration.toString().padStart(2,"0")}:00`;this.timerDisplay=c.createDiv({cls:"pomodoro-view__timer-display",text:u}),this.timerDisplay.tabIndex=0,this.timerDisplay.setAttribute("role","button"),this.timerDisplay.setAttribute("aria-label",this.t("views.pomodoro.timer.editLabel")),this.timerInput=c.createEl("input",{cls:"pomodoro-view__timer-input pomodoro-view__timer-input--hidden",attr:{type:"text",inputmode:"numeric","aria-label":this.t("views.pomodoro.timer.inputLabel")}});let p=c.createDiv({cls:"pomodoro-view__time-controls"});this.subtractTimeButton=p.createEl("button",{cls:"pomodoro-view__time-adjust-button pomodoro-view__subtract-time",text:"-1m"}),this.subtractTimeButton.setAttribute("aria-label",this.t("views.pomodoro.buttons.subtractMinute")),this.addTimeButton=p.createEl("button",{cls:"pomodoro-view__time-adjust-button pomodoro-view__add-time",text:"+1m"}),this.addTimeButton.setAttribute("aria-label",this.t("views.pomodoro.buttons.addMinute")),this.taskDisplay=t.createDiv({cls:"pomodoro-view__task-display"});let m=t.createDiv({cls:"pomodoro-view__task-selector"}),f=m.createDiv({cls:"pomodoro-view__task-buttons"});this.taskSelectButton=f.createEl("button",{cls:"pomodoro-view__task-select-button",text:this.t("views.pomodoro.buttons.chooseTask")}),this.taskClearButton=f.createEl("button",{cls:"pomodoro-view__task-clear-button pomodoro-view__task-clear-button--hidden",text:this.t("views.pomodoro.buttons.clearTask")}),this.taskCardContainer=m.createDiv({cls:"pomodoro-view__task-card-container"});let h=t.createDiv({cls:"pomodoro-view__control-section"}),g=h.createDiv({cls:"pomodoro-view__primary-controls"});this.startButton=g.createEl("button",{text:this.t("views.pomodoro.buttons.startFocus"),cls:"pomodoro-view__start-button"}),this.pauseButton=g.createEl("button",{text:this.t("views.pomodoro.buttons.pause"),cls:"pomodoro-view__pause-button"}),this.pauseButton.addClass("pomodoro-view__pause-button--hidden"),this.stopButton=g.createEl("button",{text:this.t("views.pomodoro.buttons.stop"),cls:"pomodoro-view__stop-button"}),this.stopButton.addClass("pomodoro-view__stop-button--hidden"),this.skipBreakButton=h.createEl("button",{cls:"pomodoro-view__skip-break-button",text:this.t("views.pomodoro.buttons.skipBreak")}),this.skipBreakButton.addClass("pomodoro-view__skip-break-button--hidden");let v=t.createDiv({cls:"pomodoro-view__stats-section"});this.statsDisplay=v.createDiv({cls:"pomodoro-view__stats"});let k=this.statsDisplay.createDiv({cls:"pomodoro-view__stat pomodoro-view__stat--clickable"});if(this.statElements.pomodoros=k.createSpan({cls:"pomodoro-view__stat-value",text:"0"}),k.createSpan({cls:"pomodoro-view__stat-label",text:this.t("views.pomodoro.statsLabel")}),this.registerDomEvent(k,"click",()=>{this.plugin.activatePomodoroStatsView()}),this.registerDomEvent(this.startButton,"click",async()=>{var b,w,S;if(!((b=this.startButton)!=null&&b.hasClass("is-loading"))){(w=this.startButton)==null||w.addClass("pomodoro-view__start-button--loading");try{let x=this.plugin.pomodoroService.getState();x.currentSession&&!x.isRunning?await this.plugin.pomodoroService.resumePomodoro():x.nextSessionType==="short-break"?await this.plugin.pomodoroService.startBreak(!1):x.nextSessionType==="long-break"?await this.plugin.pomodoroService.startBreak(!0):await this.plugin.pomodoroService.startPomodoro(this.currentSelectedTask||void 0)}finally{(S=this.startButton)==null||S.removeClass("pomodoro-view__start-button--loading")}}}),this.registerDomEvent(this.pauseButton,"click",()=>{this.plugin.pomodoroService.pausePomodoro()}),this.registerDomEvent(this.stopButton,"click",()=>{this.plugin.pomodoroService.stopPomodoro()}),this.registerDomEvent(this.skipBreakButton,"click",()=>{let b=this.plugin.pomodoroService.getState();b.currentSession?this.plugin.pomodoroService.stopPomodoro():(b.nextSessionType==="short-break"||b.nextSessionType==="long-break")&&this.plugin.pomodoroService.skipBreak()}),this.registerDomEvent(this.addTimeButton,"click",()=>{this.adjustSessionTime(60)}),this.registerDomEvent(this.subtractTimeButton,"click",()=>{this.adjustSessionTime(-60)}),this.registerDomEvent(this.timerDisplay,"click",()=>{this.beginTimerEdit()}),this.registerDomEvent(this.timerDisplay,"keydown",b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),this.beginTimerEdit())}),this.registerDomEvent(this.timerInput,"keydown",b=>{b.key==="Enter"?(b.preventDefault(),this.commitTimerEdit()):b.key==="Escape"&&(b.preventDefault(),this.cancelTimerEdit())}),this.registerDomEvent(this.timerInput,"blur",()=>{this.commitTimerEdit()}),this.registerDomEvent(this.taskSelectButton,"click",async()=>{await this.openTaskSelector()}),this.registerDomEvent(this.taskClearButton,"click",async()=>{await this.selectTask(null)}),this.restoreLastSelectedTask(),this.updateDisplay(),this.refreshStats(),this.plugin.pomodoroService){let b=this.plugin.pomodoroService.getState();this.updateTimer(b.timeRemaining)}}setupResizeHandling(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.resizeTimeout&&(window.clearTimeout(this.resizeTimeout),this.resizeTimeout=null),this.functionListeners.forEach(s=>s()),this.functionListeners=[];let t=this.contentEl.ownerDocument.defaultView||window,n=()=>{this.resizeTimeout&&t.clearTimeout(this.resizeTimeout),this.resizeTimeout=t.setTimeout(()=>{this.updateResponsiveLayout()},150)};t.ResizeObserver&&(this.resizeObserver=new t.ResizeObserver(n),this.contentEl.querySelector(".pomodoro-view")&&this.resizeObserver.observe(this.contentEl));let i=this.plugin.app.workspace.on("layout-change",n);this.listeners.push(i),t.addEventListener("resize",n),this.functionListeners.push(()=>t.removeEventListener("resize",n));let a=this.plugin.app.workspace.on("active-leaf-change",s=>{s===this.leaf&&t.setTimeout(()=>{this.updateResponsiveLayout()},100)});this.listeners.push(a),this.updateResponsiveLayout()}ensureResizeHandlingSetup(t=0){let i=Math.min(100*Math.pow(1.5,t),1e3);window.setTimeout(()=>{if(!this.resizeObserver){let a=this.contentEl.querySelector(".pomodoro-view");if(a){let s=this.contentEl.getBoundingClientRect(),o=a.getBoundingClientRect(),{width:l,height:c}=PPe({width:s.width,height:s.height},{width:o.width,height:o.height});l>0&&c>0?this.setupResizeHandling():t<10&&this.ensureResizeHandlingSetup(t+1)}else t<10&&this.ensureResizeHandlingSetup(t+1)}},i)}updateResponsiveLayout(){let t=this.contentEl.querySelector(".pomodoro-view");if(!t)return;let n=t.getBoundingClientRect(),i=this.contentEl.getBoundingClientRect(),{width:a,height:s}=PPe({width:i.width,height:i.height},{width:n.width,height:n.height}),o=Math.min(a/600,1),l=Math.min(s/800,1),c=Math.min(o*.7+l*.3,1);t.classList.remove("pomodoro-view--tiny","pomodoro-view--extra-narrow","pomodoro-view--very-narrow","pomodoro-view--narrow","pomodoro-view--small","pomodoro-view--medium-small","pomodoro-view--medium","pomodoro-view--wide"),a<=200?t.classList.add("pomodoro-view--tiny"):a<=250?t.classList.add("pomodoro-view--extra-narrow"):a<=300?t.classList.add("pomodoro-view--very-narrow"):a<=350?t.classList.add("pomodoro-view--narrow"):a<=400?t.classList.add("pomodoro-view--small"):a<=500?t.classList.add("pomodoro-view--medium-small"):a<=600?t.classList.add("pomodoro-view--medium"):t.classList.add("pomodoro-view--wide");let d=t.querySelector(".pomodoro-view__timer-display"),u=t.querySelector(".pomodoro-view__timer-input");if(d||u){let p,m;a<=200?(p=2,m="700"):a<=250?(p=2.2,m="650"):a<=300?(p=2.5,m="600"):a<=350?(p=3,m="600"):a<=400?(p=3.2,m="550"):a<=500?(p=3.6,m="500"):a<=600?(p=4,m="500"):(p=4.5,m="400");let h=`${Math.max(p*c,1.5).toFixed(1)}rem`;d&&(d.style.fontSize=h,d.style.fontWeight=m),u&&(u.style.fontSize=h,u.style.fontWeight=m)}this.updateProgressCircleSize(a,s)}updateProgressCircleSize(t,n){if(!this.progressContainer)return;let i=this.progressContainer.querySelector(".pomodoro-view__progress-svg");if(!i)return;let a=Math.min(t*.8,n*.4),s;if(t<=200?s=Math.max(120,Math.min(a,t-40)):t<=250?s=Math.max(150,Math.min(a,t-50)):t<=300?s=Math.max(180,Math.min(a,t-60)):t<=350?s=Math.max(200,Math.min(a,t-70)):t<=400?s=Math.max(230,Math.min(a,t-80)):t<=500?s=Math.max(250,Math.min(a,t-100)):t<=600?s=Math.max(280,Math.min(a,300)):s=Math.max(300,Math.min(a,t*.5,400)),s===this.currentCircleSize)return;this.currentCircleSize=s,i.setAttribute("width",s.toString()),i.setAttribute("height",s.toString()),i.setAttribute("viewBox",`0 0 ${s} ${s}`),this.progressContainer.style.width=`${s}px`,this.progressContainer.style.height=`${s}px`;let o=s/2,l=o-20;if(i.querySelectorAll("circle").forEach(d=>{d.setAttribute("cx",o.toString()),d.setAttribute("cy",o.toString()),d.setAttribute("r",l.toString())}),this.progressCircle){let d=2*Math.PI*l;if(this.currentCircumference=d,this.progressCircle.setAttribute("stroke-dasharray",d.toString()),this.progressCircle.setAttribute("stroke-dashoffset",d.toString()),this.plugin.pomodoroService){let u=this.plugin.pomodoroService.getState();this.updateProgress(u)}}}async openTaskSelector(){if(!this.isTaskSelectorOpen){this.isTaskSelectorOpen=!0;try{let t=Uct(this.plugin),n=new Date;if(t.length===0){new zu.Notice(this.t("views.pomodoro.notices.noTasks")),this.isTaskSelectorOpen=!1;return}Pn(this.plugin,t,i=>{this.isTaskSelectorOpen=!1,this.selectTask(i)},{targetDate:n})}catch(t){this.isTaskSelectorOpen=!1,fD.error("Error opening task selector:",{category:"persistence",operation:"opening-task-selector",error:t}),new zu.Notice(this.t("views.pomodoro.notices.loadFailed"))}}}async selectTask(t){this.currentSelectedTask=t,this.taskSelectButton&&(t?(this.taskSelectButton.textContent=this.t("views.pomodoro.buttons.changeTask"),(0,zu.setTooltip)(this.taskSelectButton,this.t("views.pomodoro.buttons.selectDifferentTask"),{placement:"top"}),this.taskSelectButton.removeClass("pomodoro-view__task-select-button--no-task")):(this.taskSelectButton.textContent=this.t("views.pomodoro.buttons.chooseTask"),this.taskSelectButton.removeAttribute("title"),this.taskSelectButton.addClass("pomodoro-view__task-select-button--no-task"))),this.taskClearButton&&(t?this.taskClearButton.removeClass("pomodoro-view__task-clear-button--hidden"):this.taskClearButton.addClass("pomodoro-view__task-clear-button--hidden")),this.updateTaskCardDisplay(t),await this.plugin.pomodoroService.saveLastSelectedTask(t==null?void 0:t.path);let n=this.plugin.pomodoroService.getState();n.currentSession&&n.currentSession.type==="work"&&await this.plugin.pomodoroService.assignTaskToCurrentSession(t||void 0)}updateTaskCardDisplay(t){if(this.taskCardContainer)if(this.taskCardContainer.empty(),t){let n=this.plugin.settings.defaultVisibleProperties?Ra(this.plugin.settings.defaultVisibleProperties,this.plugin):void 0,i=new Date,a=fI(t,i,this.plugin.statusManager,this.plugin.settings.defaultTaskStatus),s=Sr(a,this.plugin,n,{targetDate:i});this.taskCardContainer.appendChild(s),this.taskCardContainer.removeClass("pomodoro-view__task-card-container--empty")}else this.taskCardContainer.addClass("pomodoro-view__task-card-container--empty")}async restoreLastSelectedTask(){try{if(!this.plugin.pomodoroService)return;let t=await this.plugin.pomodoroService.getLastSelectedTaskPath();if(t){let n=await this.plugin.cacheManager.getTaskByPath(t);n&&!$h(n,new Date,this.plugin.statusManager,this.plugin.settings.defaultTaskStatus)&&!n.archived&&await this.selectTask(n)}}catch(t){fD.error("Error restoring last selected task:",{category:"persistence",operation:"restoring-last-selected-task",error:t})}}async updateTaskButtonFromPath(t){try{let n=await this.plugin.cacheManager.getTaskInfo(t);if(n){this.currentSelectedTask=n,this.taskSelectButton&&(this.taskSelectButton.textContent=this.t("views.pomodoro.buttons.changeTask"),(0,zu.setTooltip)(this.taskSelectButton,this.t("views.pomodoro.buttons.selectDifferentTask"),{placement:"top"}),this.taskSelectButton.removeClass("pomodoro-no-task"),this.taskSelectButton.removeClass("pomodoro-view__task-select-button--no-task")),this.taskClearButton&&this.taskClearButton.removeClass("pomodoro-view__task-clear-button--hidden"),this.updateTaskCardDisplay(n);return}this.currentSelectedTask=null,this.taskSelectButton&&(this.taskSelectButton.textContent=this.t("views.pomodoro.buttons.chooseTask"),this.taskSelectButton.removeAttribute("title"),this.taskSelectButton.addClass("pomodoro-view__task-select-button--no-task")),this.taskClearButton&&this.taskClearButton.addClass("pomodoro-view__task-clear-button--hidden"),this.updateTaskCardDisplay(null)}catch(n){fD.error("Error updating task button from path:",{category:"persistence",operation:"updating-task-button-path",error:n})}}updateDisplay(t,n,i={}){var s,o;if(!this.plugin.pomodoroService){this.statusDisplay&&(this.statusDisplay.textContent=this.t("views.pomodoro.status.ready"),this.statusDisplay.className="pomodoro-status pomodoro-view__status");return}let a=this.plugin.pomodoroService.getState();if(this.updateTimer(a.timeRemaining),this.updateProgress(a),this.updateSessionMeta(a),this.statusDisplay)if(a.isRunning&&a.currentSession){let l=a.currentSession.type==="work"?this.t("views.pomodoro.status.focus"):a.currentSession.type==="short-break"?this.t("views.pomodoro.status.shortBreak"):this.t("views.pomodoro.status.longBreak");this.statusDisplay.textContent=l,this.statusDisplay.className=`pomodoro-status pomodoro-view__status pomodoro-status-${a.currentSession.type} pomodoro-view__status--${a.currentSession.type}`}else a.currentSession&&!a.isRunning?(this.statusDisplay.textContent=this.t("views.pomodoro.status.paused"),this.statusDisplay.className="pomodoro-status pomodoro-view__status pomodoro-status-paused pomodoro-view__status--paused"):(this.statusDisplay.textContent=this.t("views.pomodoro.status.ready"),this.statusDisplay.className="pomodoro-status pomodoro-view__status");if(this.taskDisplay){let l=(s=a.currentSession)==null?void 0:s.taskPath,c=this.taskDisplay.dataset.currentTaskPath;l!==c&&(this.taskDisplay.empty(),this.taskDisplay.dataset.currentTaskPath=l||"")}if(this.taskSelectButton&&(o=a.currentSession)!=null&&o.taskPath&&!this.currentSelectedTask&&this.updateTaskButtonFromPath(a.currentSession.taskPath),this.startButton&&this.pauseButton&&this.stopButton&&(a.isRunning?(this.startButton.addClass("pomodoro-view__start-button--hidden"),this.pauseButton.removeClass("pomodoro-view__pause-button--hidden"),this.stopButton.removeClass("pomodoro-view__stop-button--hidden")):a.currentSession?(this.startButton.removeClass("pomodoro-view__start-button--hidden"),this.startButton.textContent=this.t("views.pomodoro.buttons.resume"),this.pauseButton.addClass("pomodoro-view__pause-button--hidden"),this.stopButton.removeClass("pomodoro-view__stop-button--hidden")):(this.startButton.removeClass("pomodoro-view__start-button--hidden"),a.nextSessionType==="short-break"?this.startButton.textContent=this.t("views.pomodoro.buttons.startShortBreak"):a.nextSessionType==="long-break"?this.startButton.textContent=this.t("views.pomodoro.buttons.startLongBreak"):this.startButton.textContent=this.t("views.pomodoro.buttons.startFocus"),this.pauseButton.addClass("pomodoro-view__pause-button--hidden"),this.stopButton.addClass("pomodoro-view__stop-button--hidden"))),this.skipBreakButton){let l=a.currentSession&&(a.currentSession.type==="short-break"||a.currentSession.type==="long-break"),c=!a.currentSession&&(a.nextSessionType==="short-break"||a.nextSessionType==="long-break");l||c?(this.skipBreakButton.removeClass("pomodoro-view__skip-break-button--hidden"),this.skipBreakButton.textContent=this.t("views.pomodoro.buttons.skipBreak")):this.skipBreakButton.addClass("pomodoro-view__skip-break-button--hidden")}this.addTimeButton&&this.subtractTimeButton&&(this.addTimeButton.removeClass("pomodoro-view__time-adjust-button--hidden"),this.subtractTimeButton.removeClass("pomodoro-view__time-adjust-button--hidden")),this.timerDisplay&&(this.canEditTimer()?(this.timerDisplay.addClass("pomodoro-view__timer-display--editable"),this.timerDisplay.setAttribute("aria-disabled","false")):(this.timerDisplay.removeClass("pomodoro-view__timer-display--editable"),this.timerDisplay.setAttribute("aria-disabled","true"))),i.refreshStats&&this.refreshStats()}updateSessionMeta(t){if(!this.sessionMetaDisplay)return;let n=CT(t.timeRemaining,{padMinutes:!1}),i;if(t.currentSession){let a=this.getSessionTypeLabel(t.currentSession.type);t.isRunning?i=this.t("views.pomodoro.meta.running",{time:n}):i=this.t("views.pomodoro.meta.paused",{type:a,time:n})}else t.nextSessionType==="short-break"||t.nextSessionType==="long-break"?i=this.t("views.pomodoro.meta.breakReady",{type:this.getSessionTypeLabel(t.nextSessionType),time:n}):i=this.t("views.pomodoro.meta.ready",{time:n,count:this.todaysPomodoros});this.sessionMetaDisplay.textContent=i}getSessionTypeLabel(t){return t==="work"?this.t("views.pomodoro.status.focus"):t==="short-break"?this.t("views.pomodoro.status.shortBreak"):this.t("views.pomodoro.status.longBreak")}canEditTimer(){var n;let t=(n=this.plugin.pomodoroService)==null?void 0:n.getState();return!!(t&&!t.isRunning)}beginTimerEdit(){if(!this.timerDisplay||!this.timerInput||!this.plugin.pomodoroService||!this.canEditTimer())return;let t=this.plugin.pomodoroService.getState();this.isEditingTimer=!0,this.timerInput.value=CT(t.timeRemaining,{padMinutes:!1}),this.timerDisplay.addClass("pomodoro-view__timer-display--hidden"),this.timerInput.removeClass("pomodoro-view__timer-input--hidden"),this.timerInput.focus(),this.timerInput.select()}commitTimerEdit(){var a,s;if(!this.isEditingTimer||!this.timerInput||!this.timerDisplay)return;let t=wPe(this.timerInput.value);if(this.isEditingTimer=!1,this.timerInput.addClass("pomodoro-view__timer-input--hidden"),this.timerDisplay.removeClass("pomodoro-view__timer-display--hidden"),t===null){new zu.Notice(this.t("views.pomodoro.notices.invalidDuration"));let o=(a=this.plugin.pomodoroService)==null?void 0:a.getState();o&&this.updateTimer(o.timeRemaining);return}let n=(s=this.plugin.pomodoroService)==null?void 0:s.getState();if(!n)return;n.currentSession?this.plugin.pomodoroService.setCurrentSessionRemainingTime(t):this.plugin.pomodoroService.adjustPreparedTimer(t);let i=this.plugin.pomodoroService.getState();this.updateTimer(i.timeRemaining),this.updateProgress(i),this.updateSessionMeta(i)}cancelTimerEdit(){var n;if(!this.timerInput||!this.timerDisplay)return;this.isEditingTimer=!1,this.timerInput.addClass("pomodoro-view__timer-input--hidden"),this.timerDisplay.removeClass("pomodoro-view__timer-display--hidden");let t=(n=this.plugin.pomodoroService)==null?void 0:n.getState();t&&this.updateTimer(t.timeRemaining)}updateTimer(t){if(this.timerDisplay){if(this.isEditingTimer)return;let n=Math.max(0,Math.floor(t));this.timerDisplay.textContent=CT(n),n<=60&&n>0?this.timerDisplay.addClass("pomodoro-view__timer-display--warning"):this.timerDisplay.removeClass("pomodoro-view__timer-display--warning")}}updateProgress(t){if(!this.progressCircle)return;let n=this.currentCircumference;if(n===0){let s=this.progressCircle.getAttribute("r"),o=s?parseInt(s):140;n=2*Math.PI*o,this.currentCircumference=n}if(!t.currentSession){this.progressCircle.setAttributeNS(null,"stroke-dashoffset",n.toString()),this.progressCircle.removeClass("pomodoro-view__progress-circle--work"),this.progressCircle.removeClass("pomodoro-view__progress-circle--short-break"),this.progressCircle.removeClass("pomodoro-view__progress-circle--long-break"),this.progressCircle.removeClass("pomodoro-view__progress-circle--warning");return}let i=t.isRunning?bPe(t.currentSession):(()=>{let s=xT(t.currentSession),o=t.currentSession.plannedDuration*60;return o>0?Math.max(0,Math.min(1,s/o)):0})(),a=n-i*n;this.progressCircle.setAttributeNS(null,"stroke-dashoffset",a.toString()),this.progressCircle.removeClass("pomodoro-view__progress-circle--work"),this.progressCircle.removeClass("pomodoro-view__progress-circle--short-break"),this.progressCircle.removeClass("pomodoro-view__progress-circle--long-break"),this.progressCircle.addClass(`pomodoro-view__progress-circle--${t.currentSession.type}`),t.timeRemaining<=60&&t.timeRemaining>0?this.progressCircle.addClass("pomodoro-view__progress-circle--warning"):this.progressCircle.removeClass("pomodoro-view__progress-circle--warning")}async updateStats(){try{if(!this.plugin.pomodoroService){this.statElements.pomodoros&&(this.statElements.pomodoros.textContent="0");return}let t=await this.plugin.pomodoroService.getTodayStats();this.todaysPomodoros=t.pomodorosCompleted,this.statElements.pomodoros&&this.statElements.pomodoros.textContent!==t.pomodorosCompleted.toString()&&(this.statElements.pomodoros.textContent=t.pomodorosCompleted.toString()),this.updateSessionMeta(this.plugin.pomodoroService.getState())}catch(t){fD.error("Failed to update stats:",{category:"validation",operation:"update-stats",error:t}),this.statElements.pomodoros&&(this.statElements.pomodoros.textContent="0")}}adjustSessionTime(t){if(!this.plugin.pomodoroService)return;let n=this.plugin.pomodoroService.getState();if(n.currentSession)this.plugin.pomodoroService.adjustSessionTime(t);else{let i=Math.max(60,n.timeRemaining+t);this.plugin.pomodoroService.adjustPreparedTimer(i)}if(this.plugin.pomodoroService){let i=this.plugin.pomodoroService.getState();this.updateTimer(i.timeRemaining),this.updateProgress(i)}}onPomodoroComplete(t,n){if(this.updateDisplay(void 0,void 0,{refreshStats:!0}),this.statusDisplay)if(t.type==="work"){let i=n==="long-break",a=this.t(i?"views.pomodoro.status.breakLength.long":"views.pomodoro.status.breakLength.short");this.statusDisplay.textContent=this.t("views.pomodoro.status.breakPrompt",{length:a})}else this.statusDisplay.textContent=this.t("views.pomodoro.status.breakComplete")}}});function SO(r){if(r.activePeriods&&Array.isArray(r.activePeriods))return r.activePeriods.filter(e=>e.endTime).reduce((e,t)=>{let n=new Date(t.startTime),a=new Date(t.endTime).getTime()-n.getTime();return e+Math.round(a/(1e3*60))},0);if(r.duration!==void 0)return r.duration;if(r.startTime&&r.endTime){let e=new Date(r.startTime),n=new Date(r.endTime).getTime()-e.getTime();return Math.round(n/(1e3*60))}return 0}var a3=y(()=>{});function hD(r){return[...r].sort((e,t)=>new Date(e.startTime).getTime()-new Date(t.startTime).getTime())}function Hct(r){var n;let e=(n=r.match(/^(\d{4}-\d{2}-\d{2})(?:[T\s]|$)/))==null?void 0:n[1];if(e)return e;let t=new Date(r);return isNaN(t.getTime())?"":ce(t)}function DT(r){return Hct(r.startTime)}function _Pe(r,e){return e?r.filter(t=>DT(t)===e):[]}function APe(r,e,t){let n=ce(e),i=ce(t);if(!n||!i)return[];let[a,s]=n<=i?[n,i]:[i,n];return r.filter(o=>{let l=DT(o);return l>=a&&l<=s})}function IPe(r,e){let t=ce(r),n=ce(e);if(!t||!n)return[];let[i,a]=t<=n?[t,n]:[n,t],[s,o,l]=i.split("-").map(Number),[c,d,u]=a.split("-").map(Number),p=new Date(Date.UTC(s,o-1,l)),m=new Date(Date.UTC(c,d-1,u)),f=[];for(;p<=m;)f.push(ce(p)),p.setUTCDate(p.getUTCDate()+1);return f}function PT(r){let e=hD(r).filter(o=>o.type==="work"),t=e.filter(o=>o.completed),n=0;for(let o=e.length-1;o>=0&&e[o].completed;o--)n++;let i=t.reduce((o,l)=>o+SO(l),0),a=t.length>0?i/t.length:0,s=e.length>0?t.length/e.length*100:0;return{pomodorosCompleted:t.length,currentStreak:n,totalMinutes:i,averageSessionLength:Math.round(a),completionRate:Math.round(s)}}var s3=y(()=>{Ne();a3()});function qct(r){return Number.isInteger(r)&&r>=0&&r<=6}var fi,Vct,EO,NPe=y(()=>{fi=require("obsidian");Br();Ur();Cl();Ne();a3();s3();G();Vct=I({tag:"Views/PomodoroStatsView"});EO=class extends fi.ItemView{constructor(t,n){super(t);this.overviewStatsEl=null;this.todayStatsEl=null;this.weekStatsEl=null;this.recentSessionsEl=null;this.overallStatsEl=null;this.plugin=n}getViewType(){return av}getDisplayText(){return this.plugin.i18n.translate("views.pomodoroStats.title")}getIcon(){return"bar-chart"}t(t,n){return this.plugin.i18n.translate(t,n)}async onOpen(){await this.plugin.onReady(),await this.waitForPomodoroService(),await this.render()}async onClose(){this.contentEl.empty()}async render(){this.contentEl.empty();let t=this.contentEl.createDiv({cls:"tasknotes-plugin tasknotes-container pomodoro-stats-container pomodoro-stats-view"}),n=t.createDiv({cls:"pomodoro-stats-header pomodoro-stats-view__header"});new fi.Setting(n).setName(this.t("views.pomodoroStats.heading")).setHeading();let i=n.createDiv({cls:"pomodoro-stats-view__header-actions"});this.renderBasesMigrationHelp(i);let a=i.createEl("button",{cls:"pomodoro-stats-refresh-button pomodoro-stats-view__refresh-button",text:this.t("views.pomodoroStats.refresh")});this.registerDomEvent(a,"click",()=>{this.refreshStats()});let s=t.createDiv({cls:"pomodoro-stats-section pomodoro-stats-view__section"});new fi.Setting(s).setName(this.t("views.pomodoroStats.sections.overview")).setHeading(),this.overviewStatsEl=s.createDiv({cls:"pomodoro-overview-grid pomodoro-stats-view__overview-grid"});let o=t.createDiv({cls:"pomodoro-stats-section pomodoro-stats-view__section"});new fi.Setting(o).setName(this.t("views.pomodoroStats.sections.today")).setHeading(),this.todayStatsEl=o.createDiv({cls:"pomodoro-stats-grid pomodoro-stats-view__stats-grid"});let l=t.createDiv({cls:"pomodoro-stats-section pomodoro-stats-view__section"});new fi.Setting(l).setName(this.t("views.pomodoroStats.sections.week")).setHeading(),this.weekStatsEl=l.createDiv({cls:"pomodoro-stats-grid pomodoro-stats-view__stats-grid"});let c=t.createDiv({cls:"pomodoro-stats-section pomodoro-stats-view__section"});new fi.Setting(c).setName(this.t("views.pomodoroStats.sections.allTime")).setHeading(),this.overallStatsEl=c.createDiv({cls:"pomodoro-stats-grid pomodoro-stats-view__stats-grid"});let d=t.createDiv({cls:"pomodoro-stats-section pomodoro-stats-view__section"});new fi.Setting(d).setName(this.t("views.pomodoroStats.sections.recent")).setHeading(),this.recentSessionsEl=d.createDiv({cls:"pomodoro-recent-sessions pomodoro-stats-view__recent-sessions"}),await this.refreshStats()}renderBasesMigrationHelp(t){if(this.plugin.settings.pomodoroStorageLocation==="daily-notes")return;let n=t.createEl("button",{cls:"pomodoro-stats-view__bases-help"}),i=this.t("views.pomodoroStats.basesMigration.title"),a=this.t("views.pomodoroStats.basesMigration.description");(0,fi.setIcon)(n,"help-circle"),n.setAttr("aria-label",`${i}: ${a}`),(0,fi.setTooltip)(n,a,{placement:"bottom"})}async waitForPomodoroService(){let t=Date.now();for(;!this.plugin.pomodoroService&&Date.now()-t<5e3;)await new Promise(n=>window.setTimeout(n,50))}async refreshStats(){try{if(!this.plugin.pomodoroService)return;let t=wr(),n=vn(t),i=new Date(t);i.setDate(i.getDate()-1);let a=vn(i),s=this.plugin.settings.calendarViewSettings.firstDay||0,l={weekStartsOn:qct(s)?s:0},c=Ca(n,l),d=Ky(n,l),[u,p,m,f]=await Promise.all([this.plugin.pomodoroService.getTodayStats(),this.plugin.pomodoroService.getStatsForDate(a),this.plugin.pomodoroService.getStatsForDateRange(c,d),this.plugin.pomodoroService.getSessionHistory()]),h=PT(f);this.overviewStatsEl&&this.renderOverviewStats(this.overviewStatsEl,u,h,p),this.todayStatsEl&&this.renderStatsGrid(this.todayStatsEl,u),this.weekStatsEl&&this.renderStatsGrid(this.weekStatsEl,m),this.overallStatsEl&&this.renderStatsGrid(this.overallStatsEl,h),this.recentSessionsEl&&this.renderRecentSessions(this.recentSessionsEl,f)}catch(t){Vct.error("Failed to refresh stats:",{category:"stale-data",operation:"refresh-stats",error:t})}}renderRecentSessions(t,n){var a;let i=n.filter(s=>s.type==="work").slice(-10).reverse();if(t.empty(),i.length===0){t.createDiv({cls:"pomodoro-no-sessions pomodoro-stats-view__no-sessions",text:this.t("views.pomodoroStats.recents.empty")});return}for(let s of i){let o=t.createDiv({cls:"pomodoro-session-item pomodoro-stats-view__session-item"});this.registerDomEvent(o,"contextmenu",f=>{f.preventDefault(),this.showSessionContextMenu(f,s)});let l=o.createSpan({cls:"session-date pomodoro-stats-view__session-date"}),c=this.plugin.settings.calendarViewSettings.timeFormat;l.textContent=P(new Date(s.startTime),c==="12"?"MMM d, h:mm a":"MMM d, HH:mm");let d=o.createSpan({cls:"session-duration pomodoro-stats-view__session-duration"}),u=SO(s);d.textContent=this.t("views.pomodoroStats.recents.duration",{minutes:u});let p=o.createSpan({cls:"session-status pomodoro-stats-view__session-status"});if(p.textContent=this.t(s.completed?"views.pomodoroStats.recents.status.completed":"views.pomodoroStats.recents.status.interrupted"),p.addClass(s.completed?"status-completed":"status-interrupted"),p.addClass(s.completed?"pomodoro-stats-view__session-status--completed":"pomodoro-stats-view__session-status--interrupted"),s.taskPath){let f=o.createSpan({cls:"session-task pomodoro-stats-view__session-task"}),h=((a=s.taskPath.split("/").pop())==null?void 0:a.replace(".md",""))||"";f.textContent=h}let m=o.createEl("button",{cls:"pomodoro-stats-view__session-delete-button",attr:{type:"button","aria-label":this.t("views.pomodoroStats.recents.deleteAria")}});(0,fi.setIcon)(m,"trash-2"),(0,fi.setTooltip)(m,this.t("views.pomodoroStats.recents.delete"),{placement:"top"}),this.registerDomEvent(m,"click",f=>{f.preventDefault(),f.stopPropagation(),this.confirmDeleteSession(s)})}}showSessionContextMenu(t,n){let i=new fi.Menu;i.addItem(a=>{a.setTitle(this.t("views.pomodoroStats.recents.delete")),a.setIcon("trash"),a.onClick(()=>{this.confirmDeleteSession(n)})}),i.showAtMouseEvent(t)}async confirmDeleteSession(t){if(!await bn(this.plugin.app,{title:this.t("views.pomodoroStats.recents.deleteConfirmTitle"),message:this.t("views.pomodoroStats.recents.deleteConfirmMessage"),confirmText:this.t("views.pomodoroStats.recents.deleteConfirmButton"),cancelText:this.t("common.cancel"),isDestructive:!0})||!this.plugin.pomodoroService)return;let i=await this.plugin.pomodoroService.deleteSessionFromHistory(t);new fi.Notice(this.t(i?"views.pomodoroStats.recents.deleteSuccess":"views.pomodoroStats.recents.deleteNotFound")),i&&await this.refreshStats()}renderOverviewStats(t,n,i,a){t.empty();let s=v=>{if(v<60)return`${v}m`;let k=Math.floor(v/60),b=v%60;return b>0?`${k}h${b}m`:`${k}h`},o=n.pomodorosCompleted-a.pomodorosCompleted,l=n.totalMinutes-a.totalMinutes,c=t.createDiv({cls:"pomodoro-overview-card pomodoro-stats-view__overview-card"}),d=c.createDiv({cls:"overview-value pomodoro-stats-view__overview-value"});if(d.textContent=n.pomodorosCompleted.toString(),c.createDiv({cls:"overview-label pomodoro-stats-view__overview-label",text:this.t("views.pomodoroStats.overviewCards.todayPomos.label")}),o!==0){let v=c.createDiv({cls:"overview-change pomodoro-stats-view__overview-change"});v.textContent=o>0?this.t("views.pomodoroStats.overviewCards.todayPomos.change.more",{count:o}):this.t("views.pomodoroStats.overviewCards.todayPomos.change.less",{count:Math.abs(o)}),v.addClass(o>0?"positive":"negative")}let u=t.createDiv({cls:"pomodoro-overview-card pomodoro-stats-view__overview-card"}),p=u.createDiv({cls:"overview-value pomodoro-stats-view__overview-value"});p.textContent=i.pomodorosCompleted.toString(),u.createDiv({cls:"overview-label pomodoro-stats-view__overview-label",text:this.t("views.pomodoroStats.overviewCards.totalPomos.label")});let m=t.createDiv({cls:"pomodoro-overview-card pomodoro-stats-view__overview-card"}),f=m.createDiv({cls:"overview-value pomodoro-stats-view__overview-value"});if(f.textContent=s(n.totalMinutes),m.createDiv({cls:"overview-label pomodoro-stats-view__overview-label",text:this.t("views.pomodoroStats.overviewCards.todayFocus.label")}),l!==0){let v=m.createDiv({cls:"overview-change pomodoro-stats-view__overview-change"});v.textContent=l>0?this.t("views.pomodoroStats.overviewCards.todayFocus.change.more",{duration:s(Math.abs(l))}):this.t("views.pomodoroStats.overviewCards.todayFocus.change.less",{duration:s(Math.abs(l))}),v.addClass(l>0?"positive":"negative")}let h=t.createDiv({cls:"pomodoro-overview-card pomodoro-stats-view__overview-card"}),g=h.createDiv({cls:"overview-value pomodoro-stats-view__overview-value"});g.textContent=s(i.totalMinutes),h.createDiv({cls:"overview-label pomodoro-stats-view__overview-label",text:this.t("views.pomodoroStats.overviewCards.totalFocus.label")})}renderStatsGrid(t,n){t.empty();let i=t.createDiv({cls:"pomodoro-stat-card pomodoro-stats-view__stat-card"});i.createDiv({cls:"stat-value pomodoro-stats-view__stat-value",text:n.pomodorosCompleted.toString()}),i.createDiv({cls:"stat-label pomodoro-stats-view__stat-label",text:this.t("views.pomodoroStats.stats.pomodoros")});let a=t.createDiv({cls:"pomodoro-stat-card pomodoro-stats-view__stat-card"});a.createDiv({cls:"stat-value pomodoro-stats-view__stat-value",text:n.currentStreak.toString()}),a.createDiv({cls:"stat-label pomodoro-stats-view__stat-label",text:this.t("views.pomodoroStats.stats.streak")});let s=t.createDiv({cls:"pomodoro-stat-card pomodoro-stats-view__stat-card"});s.createDiv({cls:"stat-value pomodoro-stats-view__stat-value",text:n.totalMinutes.toString()}),s.createDiv({cls:"stat-label pomodoro-stats-view__stat-label",text:this.t("views.pomodoroStats.stats.minutes")});let o=t.createDiv({cls:"pomodoro-stat-card pomodoro-stats-view__stat-card"});o.createDiv({cls:"stat-value pomodoro-stats-view__stat-value",text:n.averageSessionLength.toString()}),o.createDiv({cls:"stat-label pomodoro-stats-view__stat-label",text:this.t("views.pomodoroStats.stats.average")});let l=t.createDiv({cls:"pomodoro-stat-card pomodoro-stats-view__stat-card"});l.createDiv({cls:"stat-value pomodoro-stats-view__stat-value",text:`${n.completionRate}%`}),l.createDiv({cls:"stat-label pomodoro-stats-view__stat-label",text:this.t("views.pomodoroStats.stats.completion")})}}});function Wct(r){return Number.isInteger(r)&&r>=0&&r<=6}function MT(){return{dateRange:"all",selectedProjects:[],minTimeSpent:0}}function Gct(r){return typeof r=="string"&&Yct.has(r)}function OPe(r){return typeof r=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(r)}function Kct(r){if(!r||typeof r!="object")return MT();let e=r,t=MT();Gct(e.dateRange)&&(t.dateRange=e.dateRange),OPe(e.customStartDate)&&(t.customStartDate=e.customStartDate),OPe(e.customEndDate)&&(t.customEndDate=e.customEndDate),Array.isArray(e.selectedProjects)&&(t.selectedProjects=e.selectedProjects.filter(i=>typeof i=="string"));let n=typeof e.minTimeSpent=="number"?e.minTimeSpent:Number(e.minTimeSpent);return Number.isFinite(n)&&n>0&&(t.minTimeSpent=Math.floor(n)),t}var Vo,gD,RPe,Yct,xO,LPe=y(()=>{Vo=require("obsidian");Br();Ur();Ct();Ne();la();xc();jn();G();gD=I({tag:"Views/StatsView"});RPe="tasknotes-stats-view-filters",Yct=new Set(["all","7days","30days","90days","custom"]);xO=class extends Vo.ItemView{constructor(t,n){super(t);this.overviewStatsEl=null;this.todayStatsEl=null;this.weekStatsEl=null;this.monthStatsEl=null;this.projectsStatsEl=null;this.filtersEl=null;this.currentFilters=MT();this.drilldownModal=null;this.currentDrilldownData=null;this.listeners=[];this.statsCache=new Map;this.lastCacheTime=0;this.CACHE_DURATION=6e4;this.debounceTimeout=null;this.plugin=n}getViewType(){return sv}getDisplayText(){return this.plugin.i18n.translate("views.stats.title")}getIcon(){return"bar-chart-4"}async onOpen(){await this.plugin.onReady(),this.currentFilters=this.loadPersistedFilters();let t=this.plugin.emitter.on(nt,async({path:n,originalTask:i,updatedTask:a})=>{if(!n||!a||!this.drilldownModal||!this.currentDrilldownData)return;this.currentDrilldownData.tasks.some(o=>o.path===n||i&&o.path===i.path)&&await this.refreshDrilldownModal()});this.listeners.push(t),await this.render()}async onClose(){this.contentEl.empty(),this.listeners.forEach(t=>this.plugin.emitter.offref(t)),this.listeners=[]}loadPersistedFilters(){try{let t=this.plugin.app.loadLocalStorage(RPe);return typeof t!="string"||t.length===0?MT():Kct(JSON.parse(t))}catch(t){return gD.warn("[TaskNotes] Failed to load Stats view filters:",{category:"persistence",operation:"load-stats-view-filters",error:t}),MT()}}savePersistedFilters(){try{this.plugin.app.saveLocalStorage(RPe,JSON.stringify(this.currentFilters))}catch(t){gD.warn("[TaskNotes] Failed to save Stats view filters:",{category:"persistence",operation:"save-stats-view-filters",error:t})}}async render(){let t=this.contentEl.createDiv({cls:"tasknotes-plugin tasknotes-container stats-container stats-view"}),n=t.createDiv({cls:"stats-header stats-view__header"});new Vo.Setting(n).setName(this.plugin.i18n.translate("views.stats.taskProjectStats")).setHeading();let i=n.createEl("button",{cls:"stats-refresh-button stats-view__refresh-button",text:this.plugin.i18n.translate("views.stats.refreshButton")});this.registerDomEvent(i,"click",()=>{this.refreshStats()});let a=t.createDiv({cls:"stats-section stats-view__section"});new Vo.Setting(a).setName(this.plugin.i18n.translate("views.stats.sections.filters")).setHeading(),this.filtersEl=a.createDiv({cls:"stats-filters stats-view__filters"}),this.renderFilters();let s=t.createDiv({cls:"stats-section stats-view__section"});new Vo.Setting(s).setName(this.plugin.i18n.translate("views.stats.sections.overview")).setHeading(),this.overviewStatsEl=s.createDiv({cls:"stats-overview-grid stats-view__overview-grid"});let o=t.createDiv({cls:"stats-section stats-view__section"});new Vo.Setting(o).setName(this.plugin.i18n.translate("views.stats.sections.today")).setHeading(),this.todayStatsEl=o.createDiv({cls:"stats-grid stats-view__stats-grid"});let l=t.createDiv({cls:"stats-section stats-view__section"});new Vo.Setting(l).setName(this.plugin.i18n.translate("views.stats.sections.thisWeek")).setHeading(),this.weekStatsEl=l.createDiv({cls:"stats-grid stats-view__stats-grid"});let c=t.createDiv({cls:"stats-section stats-view__section"});new Vo.Setting(c).setName(this.plugin.i18n.translate("views.stats.sections.thisMonth")).setHeading(),this.monthStatsEl=c.createDiv({cls:"stats-grid stats-view__stats-grid"});let d=t.createDiv({cls:"stats-section stats-view__section"});new Vo.Setting(d).setName(this.plugin.i18n.translate("views.stats.sections.projectBreakdown")).setHeading(),this.projectsStatsEl=d.createDiv({cls:"stats-projects stats-view__projects"}),await this.refreshStats()}async refreshStats(){try{this.clearCache();let t=await Promise.allSettled([this.updateOverviewStats(),this.updateTodayStats(),this.updateWeekStats(),this.updateMonthStats(),this.updateProjectStats()])}catch(t){}}async getAllTasks(){let t=`all-tasks-${JSON.stringify(this.currentFilters)}`;if(this.isCacheValid()&&this.statsCache.has(t)){let a=this.statsCache.get(t);if(a)return a}let n=this.plugin.cacheManager.getAllTaskPaths(),i=[];for(let a of n)try{let s=await this.plugin.cacheManager.getTaskInfo(a);s&&i.push(s)}catch(s){}return i=this.applyTaskFilters(i),this.statsCache.set(t,i),this.lastCacheTime=Date.now(),i}applyTaskFilters(t){let n=t,i=this.getFilterDateRange();return(i.start||i.end)&&(n=n.filter(a=>{if(a.timeEntries&&a.timeEntries.length>0)return a.timeEntries.some(s=>{if(!s.startTime)return!1;let o=new Date(s.startTime);return!(i.start&&oi.end)});if(a.completedDate){let s=new Date(a.completedDate);return!(i.start&&si.end)}if(a.dateCreated){let s=new Date(a.dateCreated);return!(i.start&&si.end)}return!(i.start||i.end)})),this.currentFilters.minTimeSpent>0&&(n=n.filter(a=>Aa(a.timeEntries||[])>=this.currentFilters.minTimeSpent)),n}async updateOverviewStats(){if(!this.overviewStatsEl)return;let t=await this.getAllTasks(),n=this.calculateOverallStats(t);this.renderOverviewStats(this.overviewStatsEl,n)}async updateTodayStats(){if(!this.todayStatsEl)return;let t=wr(),n=await this.calculateStatsForRange(yl(t),Ew(t));this.renderTimeRangeStats(this.todayStatsEl,n)}async updateWeekStats(){if(!this.weekStatsEl)return;let t=wr(),n=this.plugin.settings.calendarViewSettings.firstDay||0,a={weekStartsOn:Wct(n)?n:0},s=Ca(t,a),o=Ky(t,a),l=await this.calculateStatsForRange(s,o);this.renderTimeRangeStats(this.weekStatsEl,l)}async updateMonthStats(){if(!this.monthStatsEl)return;let t=wr(),n=t_(t),i=e_(t),a=await this.calculateStatsForRange(n,i);this.renderTimeRangeStats(this.monthStatsEl,a)}async updateProjectStats(){if(!this.projectsStatsEl)return;let t=await this.getAllTasks(),n=this.calculateProjectStats(t);await this.renderProjectStats(this.projectsStatsEl,n)}consolidateProjectName(t){var i,a;if(!t||typeof t!="string")return t;let n=kl(t,(i=this.plugin)==null?void 0:i.app);if(n&&n!==t)return n;if(t.startsWith("[[")&&t.endsWith("]]")){let s=this.extractWikilinkPath(t);if(s&&((a=this.plugin)!=null&&a.app)){let o=this.plugin.app.metadataCache.getFirstLinkpathDest(s,"");if(o)return o.basename;let l=this.extractProjectName(t);if(l)return l}}if(t.includes("|")){let s=t.split("|");return s[s.length-1]||t}if(t.includes("/")){let s=t.split("/");return s[s.length-1]||t}return t}extractWikilinkPath(t){if(!t||typeof t!="string"||!t.startsWith("[[")||!t.endsWith("]]"))return null;let n=t.slice(2,-2);return(0,Vo.parseLinktext)(n).path}extractProjectName(t){var i;return t&&kl(t,(i=this.plugin)==null?void 0:i.app)||null}calculateOverallStats(t){let n=0,i=0,a=0,s=new Set;for(let o of t){n+=Aa(o.timeEntries||[]),i+=o.timeEstimate||0,this.plugin.statusManager.isCompletedStatus(o.status)&&a++;let l=this.getTaskProjects(o);for(let c of l)s.add(c)}return{totalTimeSpent:n,totalTimeEstimate:i,totalTasks:t.length,completedTasks:a,activeProjects:s.size,completionRate:t.length>0?a/t.length*100:0,avgTimePerTask:t.length>0?n/t.length:0}}async calculateStatsForRange(t,n){let a=(await this.getAllTasks()).filter(l=>{if(l.timeEntries&&l.timeEntries.length>0)return l.timeEntries.some(c=>{if(!c.startTime)return!1;let d=new Date(c.startTime);return d>=t&&d<=n});if(l.completedDate){let c=new Date(l.completedDate);return c>=t&&c<=n}if(l.dateCreated){let c=new Date(l.dateCreated);return c>=t&&c<=n}return!1}),s=this.calculateOverallStats(a),o=this.calculateProjectStats(a);return{overall:s,projects:o}}calculateProjectStats(t){let n=new Map;for(let s of t){let o=Aa(s.timeEntries||[]),l=s.timeEstimate||0,c=this.plugin.statusManager.isCompletedStatus(s.status),d;s.timeEntries&&s.timeEntries.length>0?d=[...s.timeEntries].sort((m,f)=>new Date(f.startTime).getTime()-new Date(m.startTime).getTime())[0].startTime:s.completedDate?d=s.completedDate:s.dateModified&&(d=s.dateModified);let u=this.getTaskProjects(s);for(let p of u){n.has(p)||n.set(p,{tasks:[],totalTime:0,totalTimeEstimate:0,completedCount:0,lastActivity:void 0});let m=n.get(p);m&&(m.tasks.push(s),m.totalTime+=o,m.totalTimeEstimate+=l,c&&m.completedCount++,d&&(!m.lastActivity||new Date(d)>new Date(m.lastActivity))&&(m.lastActivity=d))}}let i=[];for(let[s,o]of n.entries())i.push({projectName:s,totalTimeSpent:o.totalTime,totalTimeEstimate:o.totalTimeEstimate,taskCount:o.tasks.length,completedTaskCount:o.completedCount,avgTimePerTask:o.tasks.length>0?o.totalTime/o.tasks.length:0,lastActivity:o.lastActivity});let a=this.plugin.i18n.translate("views.stats.noProject");return i.sort((s,o)=>s.projectName===a?1:o.projectName===a?-1:o.totalTimeSpent-s.totalTimeSpent),i}renderFilters(){if(!this.filtersEl)return;this.filtersEl.empty();let t=this.filtersEl.createDiv({cls:"stats-view__filter-grid"}),n=t.createDiv({cls:"stats-view__filter-item"}),i=n.createDiv({cls:"stats-view__filter-label"});i.textContent=this.plugin.i18n.translate("views.stats.sections.dateRange");let a=n.createEl("select",{cls:"stats-view__filter-select"}),s=[{value:"all",text:this.plugin.i18n.translate("views.stats.timeRanges.allTime")},{value:"7days",text:this.plugin.i18n.translate("views.stats.timeRanges.last7Days")},{value:"30days",text:this.plugin.i18n.translate("views.stats.timeRanges.last30Days")},{value:"90days",text:this.plugin.i18n.translate("views.stats.timeRanges.last90Days")},{value:"custom",text:this.plugin.i18n.translate("views.stats.timeRanges.customRange")}];for(let m of s){let f=a.createEl("option",{value:m.value,text:m.text});m.value===this.currentFilters.dateRange&&(f.selected=!0)}this.registerDomEvent(a,"change",()=>{this.currentFilters.dateRange=a.value,this.renderCustomDateInputs(),this.applyFilters()});let o=t.createDiv({cls:"stats-view__custom-dates"});this.currentFilters.dateRange==="custom"&&this.renderCustomDateInputs(o);let l=t.createDiv({cls:"stats-view__filter-item"}),c=l.createDiv({cls:"stats-view__filter-label"});c.textContent=this.plugin.i18n.translate("views.stats.filters.minTime");let d=l.createEl("input",{cls:"stats-view__filter-input",type:"number",value:this.currentFilters.minTimeSpent.toString(),placeholder:"0"});this.registerDomEvent(d,"input",()=>{this.currentFilters.minTimeSpent=parseInt(d.value)||0,this.applyFilters()});let p=t.createDiv({cls:"stats-view__filter-buttons"}).createEl("button",{cls:"stats-view__filter-button stats-view__filter-button--reset",text:this.plugin.i18n.translate("views.stats.resetFiltersButton")});this.registerDomEvent(p,"click",()=>{this.currentFilters=MT(),this.renderFilters(),this.applyFilters()})}renderCustomDateInputs(t){var i;let n=t||((i=this.filtersEl)==null?void 0:i.querySelector(".stats-view__custom-dates"));if(n&&(n.empty(),this.currentFilters.dateRange==="custom")){let a=n.createDiv({cls:"stats-view__date-input-container"});a.createDiv({cls:"stats-view__date-label",text:this.plugin.i18n.translate("views.stats.dateRangeFrom")});let s=a.createEl("input",{cls:"stats-view__date-input",type:"date",value:this.currentFilters.customStartDate||""}),o=n.createDiv({cls:"stats-view__date-input-container"});o.createDiv({cls:"stats-view__date-label",text:this.plugin.i18n.translate("views.stats.dateRangeTo")});let l=o.createEl("input",{cls:"stats-view__date-input",type:"date",value:this.currentFilters.customEndDate||""});this.registerDomEvent(s,"change",()=>{this.currentFilters.customStartDate=s.value,this.applyFilters()}),this.registerDomEvent(l,"change",()=>{this.currentFilters.customEndDate=l.value,this.applyFilters()})}}async applyFilters(){this.savePersistedFilters(),this.debounceTimeout&&window.clearTimeout(this.debounceTimeout),this.debounceTimeout=window.setTimeout(()=>{(async()=>(await this.refreshStats(),this.debounceTimeout=null))()},300)}isCacheValid(){return Date.now()-this.lastCacheTime0?n.map(i=>this.consolidateProjectName(i)).filter(i=>typeof i=="string"&&i.length>0):[this.plugin.i18n.translate("views.stats.noProject")]}catch(n){return[this.plugin.i18n.translate("views.stats.noProject")]}}getFilterDateRange(){let t=wr();switch(this.currentFilters.dateRange){case"7days":return{start:yl(Xy(t,7)),end:Ew(t)};case"30days":return{start:yl(Xy(t,30)),end:Ew(t)};case"90days":return{start:yl(Xy(t,90)),end:Ew(t)};case"custom":return{start:this.currentFilters.customStartDate?new Date(`${this.currentFilters.customStartDate}T00:00:00`):void 0,end:this.currentFilters.customEndDate?new Date(`${this.currentFilters.customEndDate}T23:59:59.999`):void 0};case"all":default:return{}}}renderOverviewStats(t,n){t.empty();let i=h=>{if(h<60)return`${Math.round(h)}m`;let g=Math.floor(h/60),v=Math.round(h%60);return v>0?`${g}h ${v}m`:`${g}h`},a=t.createDiv({cls:"stats-overview-card stats-view__overview-card"}),s=a.createDiv({cls:"overview-value stats-view__overview-value"});s.textContent=`${i(n.totalTimeSpent)} / ${i(n.totalTimeEstimate)}`,a.createDiv({cls:"overview-label stats-view__overview-label",text:this.plugin.i18n.translate("views.stats.cards.timeTrackedEstimated")});let o=t.createDiv({cls:"stats-overview-card stats-view__overview-card"}),l=o.createDiv({cls:"overview-value stats-view__overview-value"});l.textContent=n.totalTasks.toString(),o.createDiv({cls:"overview-label stats-view__overview-label",text:this.plugin.i18n.translate("views.stats.cards.totalTasks")});let c=t.createDiv({cls:"stats-overview-card stats-view__overview-card"}),d=c.createDiv({cls:"overview-value stats-view__overview-value"});d.textContent=`${Math.round(n.completionRate)}%`,c.createDiv({cls:"overview-label stats-view__overview-label",text:this.plugin.i18n.translate("views.stats.cards.completionRate")});let u=t.createDiv({cls:"stats-overview-card stats-view__overview-card"}),p=u.createDiv({cls:"overview-value stats-view__overview-value"});p.textContent=n.activeProjects.toString(),u.createDiv({cls:"overview-label stats-view__overview-label",text:this.plugin.i18n.translate("views.stats.cards.activeProjects")});let m=t.createDiv({cls:"stats-overview-card stats-view__overview-card"}),f=m.createDiv({cls:"overview-value stats-view__overview-value"});f.textContent=i(n.avgTimePerTask),m.createDiv({cls:"overview-label stats-view__overview-label",text:this.plugin.i18n.translate("views.stats.cards.avgTimePerTask")})}renderTimeRangeStats(t,n){t.empty();let i=c=>{if(c<60)return`${Math.round(c)}m`;let d=Math.floor(c/60),u=Math.round(c%60);return u>0?`${d}h ${u}m`:`${d}h`},a=t.createDiv({cls:"stats-stat-card stats-view__stat-card"});a.createDiv({cls:"stat-value stats-view__stat-value",text:`${i(n.overall.totalTimeSpent)} / ${i(n.overall.totalTimeEstimate)}`}),a.createDiv({cls:"stat-label stats-view__stat-label",text:this.plugin.i18n.translate("views.stats.cards.timeTrackedEstimated")});let s=t.createDiv({cls:"stats-stat-card stats-view__stat-card"});s.createDiv({cls:"stat-value stats-view__stat-value",text:n.overall.totalTasks.toString()}),s.createDiv({cls:"stat-label stats-view__stat-label",text:this.plugin.i18n.translate("views.stats.labels.tasks")});let o=t.createDiv({cls:"stats-stat-card stats-view__stat-card"});o.createDiv({cls:"stat-value stats-view__stat-value",text:n.overall.completedTasks.toString()}),o.createDiv({cls:"stat-label stats-view__stat-label",text:this.plugin.i18n.translate("views.stats.labels.completed")});let l=t.createDiv({cls:"stats-stat-card stats-view__stat-card"});l.createDiv({cls:"stat-value stats-view__stat-value",text:n.overall.activeProjects.toString()}),l.createDiv({cls:"stat-label stats-view__stat-label",text:this.plugin.i18n.translate("views.stats.labels.projects")})}async renderProjectStats(t,n){if(t.empty(),n.length===0){t.createDiv({cls:"stats-no-data stats-view__no-data",text:this.plugin.i18n.translate("views.stats.noProjectData")});return}let i=s=>{if(s<60)return`${Math.round(s)}m`;let o=Math.floor(s/60),l=Math.round(s%60);return l>0?`${o}h ${l}m`:`${o}h`},a=s=>{if(!s)return this.plugin.i18n.translate("views.stats.notAvailable");try{let o=new Date(s);return P(o,"MMM d, yyyy")}catch(o){return this.plugin.i18n.translate("views.stats.notAvailable")}};for(let s of n){let o=["stats-project-item","stats-view__project-item","stats-view__project-item--clickable"];s.projectName===this.plugin.i18n.translate("views.stats.noProject")&&o.push("stats-view__project-item--no-project");let l=t.createDiv({cls:o.join(" ")});this.registerDomEvent(l,"click",()=>{this.openProjectDrilldown(s.projectName)});let c=l.createDiv({cls:"stats-view__project-header"}),d=c.createDiv({cls:"project-name stats-view__project-name"});d.textContent=s.projectName,c.createDiv({cls:"stats-view__click-indicator",text:"\u2192"});let u=s.taskCount>0?s.completedTaskCount/s.taskCount*100:0,p=l.createDiv({cls:"stats-view__project-content-grid"}),m=p.createDiv({cls:"stats-view__progress-container"});this.renderProgressCircle(m,u,s.completedTaskCount,s.taskCount);let f=p.createDiv({cls:"stats-view__stats-container"});if(s.totalTimeSpent>0||s.totalTimeEstimate>0){let k=f.createDiv({cls:"stats-view__time-bar"}),w=k.createDiv({cls:"stats-view__time-bar-visual"}).createDiv({cls:"stats-view__time-bar-fill"}),S=0;s.totalTimeEstimate>0?S=s.totalTimeSpent/s.totalTimeEstimate*100:s.totalTimeSpent>0&&(S=100,w.classList.remove("tn-static-background-color-var-background-mo-94b219f0","tn-static-background-color-var-background-se-9087a23e","tn-static-background-color-var-color-red-134bc721","tn-static-background-color-var-text-accent-a954c70f"),w.classList.add("tn-static-background-color-var-color-base-40-ef5f175e")),w.style.width=`${Math.min(S,100)}%`,S>100&&(w.classList.remove("tn-static-background-color-var-background-mo-94b219f0","tn-static-background-color-var-background-se-9087a23e","tn-static-background-color-var-color-base-40-ef5f175e","tn-static-background-color-var-text-accent-a954c70f"),w.classList.add("tn-static-background-color-var-color-red-134bc721"));let x=k.createDiv({cls:"stats-view__time-bar-label"});x.textContent=`${i(s.totalTimeSpent)} / ${i(s.totalTimeEstimate)}`}let h=f.createDiv({cls:"project-stats stats-view__project-stats"});if(s.lastActivity){let k=h.createDiv({cls:"project-stat stats-view__project-stat"});k.textContent=`Last activity: ${a(s.lastActivity)}`}if(s.avgTimePerTask>0){let k=h.createDiv({cls:"project-stat stats-view__project-stat"});k.textContent=`Avg: ${i(s.avgTimePerTask)}/task`}let g=f.createDiv({cls:"stats-view__trend-container"}),v=g.createDiv({cls:"stats-view__sparkline"});try{let k=await this.calculateProjectTrend(s.projectName);k.length>0&&k.some(b=>b.value>0)?this.renderSparkline(v,k):g.remove()}catch(k){g.remove()}}}renderProgressCircle(t,n,i,a){let c=2*Math.PI*27.5,d=c-n/100*c,u=activeDocument.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("width","60"),u.setAttribute("height","60"),u.setAttribute("viewBox","0 0 60 60"),u.classList.add("stats-view__progress-circle-svg");let p=activeDocument.createElementNS("http://www.w3.org/2000/svg","circle");p.setAttribute("cx",(60/2).toString()),p.setAttribute("cy",(60/2).toString()),p.setAttribute("r",27.5.toString()),p.classList.add("stats-view__progress-circle-bg");let m=activeDocument.createElementNS("http://www.w3.org/2000/svg","circle");m.setAttribute("cx",(60/2).toString()),m.setAttribute("cy",(60/2).toString()),m.setAttribute("r",27.5.toString()),m.setAttribute("stroke-dasharray",`${c} ${c}`),m.setAttribute("stroke-dashoffset",d.toString()),m.classList.add("stats-view__progress-circle-fg");let f=activeDocument.createElementNS("http://www.w3.org/2000/svg","text");f.setAttribute("x","50%"),f.setAttribute("y","50%"),f.setAttribute("dy","0.3em"),f.setAttribute("text-anchor","middle"),f.classList.add("stats-view__progress-circle-text"),f.textContent=`${Math.round(n)}%`,u.appendChild(p),u.appendChild(m),u.appendChild(f),t.appendChild(u);let h=t.createDiv({cls:"stats-view__progress-label"});h.textContent=`${i}/${a} tasks`}async calculateProjectTrend(t){try{let n=this.plugin.cacheManager.getAllTaskPaths(),i=[];for(let o of n)try{let l=await this.plugin.cacheManager.getTaskInfo(o);l&&this.getTaskProjects(l).includes(t)&&i.push(l)}catch(l){}let a=[],s=wr();for(let o=29;o>=0;o--){let l=Xy(s,o),c=P(l,"yyyy-MM-dd"),d=0;for(let u of i)if(u.timeEntries)for(let p of u.timeEntries)p.startTime&&P(new Date(p.startTime),"yyyy-MM-dd")===c&&(d+=Aa([p]));a.push({date:c,value:d})}return a}catch(n){return[]}}renderSparkline(t,n){if(t.empty(),n.length===0)return;let i=100,a=20,s=Math.max(...n.map(d=>d.value));if(s===0)return;let o=activeDocument.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("width",i.toString()),o.setAttribute("height",a.toString()),o.setAttribute("viewBox",`0 0 ${i} ${a}`),o.classList.add("stats-view__sparkline-svg");let l=activeDocument.createElementNS("http://www.w3.org/2000/svg","path"),c="";n.forEach((d,u)=>{let p=u/(n.length-1)*i,m=a-d.value/s*a;u===0?c+=`M ${p} ${m}`:c+=` L ${p} ${m}`}),l.setAttribute("d",c),l.setAttribute("fill","none"),l.setAttribute("stroke","currentColor"),l.setAttribute("stroke-width","1.5"),l.setAttribute("opacity","0.7"),o.appendChild(l),t.appendChild(o)}async openProjectDrilldown(t){this.closeDrilldownModal();let n=this.contentEl.ownerDocument,i=n.body.createDiv({cls:"stats-view__modal-backdrop"});this.drilldownModal=i;let a=i.createDiv({cls:"stats-view__modal tasknotes-plugin"}),s=a.createDiv({cls:"stats-view__modal-header"}),o=s.createDiv({cls:"stats-view__modal-title"});o.textContent=`${t} - Detailed View`;let l=s.createEl("button",{cls:"stats-view__modal-close",text:"\xD7"}),c=a.createDiv({cls:"stats-view__modal-content"});c.textContent=this.plugin.i18n.translate("views.stats.loading"),this.registerDomEvent(l,"click",()=>this.closeDrilldownModal()),this.registerDomEvent(i,"click",u=>{u.target===i&&this.closeDrilldownModal()});let d=u=>{u.key==="Escape"&&(this.closeDrilldownModal(),n.removeEventListener("keydown",d))};n.addEventListener("keydown",d);try{let u=await this.getProjectDrilldownData(t);this.currentDrilldownData=u,this.renderDrilldownContent(c,u)}catch(u){gD.error("Error loading drill-down data:",{category:"persistence",operation:"loading-drill-down-data",error:u}),c.textContent=this.plugin.i18n.translate("notices.statsLoadingFailed")}}closeDrilldownModal(){this.drilldownModal&&(this.drilldownModal.remove(),this.drilldownModal=null,this.currentDrilldownData=null)}async refreshDrilldownModal(){if(!this.drilldownModal||!this.currentDrilldownData)return;let t=this.drilldownModal.querySelector(".stats-view__modal-content");if(t)try{let n=await this.getProjectDrilldownData(this.currentDrilldownData.projectName);this.currentDrilldownData=n,this.renderDrilldownContent(t,n)}catch(n){gD.error("Error refreshing drill-down modal:",{category:"stale-data",operation:"refreshing-drill-down-modal",error:n})}}async getProjectDrilldownData(t){var p;let n=this.plugin.cacheManager.getAllTaskPaths(),i=[];for(let m of n)try{let f=await this.plugin.cacheManager.getTaskInfo(m);f&&this.getTaskProjects(f).includes(t)&&i.push(f)}catch(f){gD.error(`Failed to get task for drill-down: ${m}`,{category:"persistence",operation:"get-task-drill-down",error:f})}let a=i.reduce((m,f)=>m+Aa(f.timeEntries||[]),0),s=i.reduce((m,f)=>m+(f.timeEstimate||0),0),o=i.filter(m=>this.plugin.statusManager.isCompletedStatus(m.status)).length,l=i.length>0?o/i.length*100:0,c=i.filter(m=>{var f;return((f=m.timeEntries)==null?void 0:f.length)||m.completedDate}).sort((m,f)=>{var v,k;let h=(v=m.timeEntries)!=null&&v.length?Math.max(...m.timeEntries.map(b=>new Date(b.startTime).getTime())):m.completedDate?new Date(m.completedDate).getTime():0;return((k=f.timeEntries)!=null&&k.length?Math.max(...f.timeEntries.map(b=>new Date(b.startTime).getTime())):f.completedDate?new Date(f.completedDate).getTime():0)-h}).slice(0,10),d=[],u=wr();for(let m=29;m>=0;m--){let f=Xy(u,m),h=P(f,"yyyy-MM-dd"),g=0,v=0,k=0;for(let b of i){if(b.timeEntries){let w=b.timeEntries.filter(S=>P(new Date(S.startTime),"yyyy-MM-dd")===h);w.length>0&&(g+=Aa(w),v++)}b.completedDate&&P(new Date(b.completedDate),"yyyy-MM-dd")===h&&(k++,(p=b.timeEntries)!=null&&p.some(w=>P(new Date(w.startTime),"yyyy-MM-dd")===h)||v++)}d.push({date:h,timeSpent:g,taskCount:v,completedTasks:k})}return{projectName:t,tasks:i,totalTimeSpent:a,totalTimeEstimate:s,completionRate:l,timeByDay:d,recentActivity:c}}renderDrilldownContent(t,n){t.empty();let i=S=>{if(S<60)return`${Math.round(S)}m`;let x=Math.floor(S/60),C=Math.round(S%60);return C>0?`${x}h ${C}m`:`${x}h`},s=t.createDiv({cls:"stats-view__drilldown-overview"}).createDiv({cls:"stats-view__drilldown-stats"}),o=s.createDiv({cls:"stats-view__drilldown-card"});o.createDiv({cls:"stats-view__drilldown-value",text:`${i(n.totalTimeSpent)} / ${i(n.totalTimeEstimate)}`}),o.createDiv({cls:"stats-view__drilldown-label",text:"Total Time"});let l=s.createDiv({cls:"stats-view__drilldown-card"});l.createDiv({cls:"stats-view__drilldown-value",text:n.tasks.length.toString()}),l.createDiv({cls:"stats-view__drilldown-label",text:"Total Tasks"});let c=s.createDiv({cls:"stats-view__drilldown-card"});c.createDiv({cls:"stats-view__drilldown-value",text:`${Math.round(n.completionRate)}%`}),c.createDiv({cls:"stats-view__drilldown-label",text:"Completed"});let d=s.createDiv({cls:"stats-view__drilldown-card"}),u=n.tasks.length>0?n.totalTimeSpent/n.tasks.length:0,p=n.tasks.length>0?n.totalTimeEstimate/n.tasks.length:0;d.createDiv({cls:"stats-view__drilldown-value",text:`${i(u)} / ${i(p)}`}),d.createDiv({cls:"stats-view__drilldown-label",text:"Avg per Task"});let m=t.createDiv({cls:"stats-view__drilldown-section"});m.createDiv({cls:"stats-view__drilldown-heading",text:"Activity Over Time (Last 30 Days)"});let f=m.createDiv({cls:"stats-view__activity-chart"});this.renderActivityChart(f,n.timeByDay);let h=t.createDiv({cls:"stats-view__drilldown-section"}),g=h.createDiv({cls:"stats-view__section-header"});g.createDiv({cls:"stats-view__drilldown-heading",text:"All Project Tasks"});let k=g.createDiv({cls:"stats-view__task-filters"}).createEl("select",{cls:"stats-view__filter-select"});k.createEl("option",{value:"all",text:this.plugin.i18n.translate("views.stats.filters.allTasks")}),k.createEl("option",{value:"active",text:this.plugin.i18n.translate("views.stats.filters.activeOnly")}),k.createEl("option",{value:"completed",text:this.plugin.i18n.translate("views.stats.filters.completedOnly")});let b=h.createDiv({cls:"stats-view__task-list"}),w=(S="all")=>{b.empty();let x=n.tasks;if(S==="active"?x=n.tasks.filter(D=>!this.plugin.statusManager.isCompletedStatus(D.status)):S==="completed"&&(x=n.tasks.filter(D=>this.plugin.statusManager.isCompletedStatus(D.status))),x.sort((D,_)=>{let O=this.plugin.statusManager.isCompletedStatus(D.status),L=this.plugin.statusManager.isCompletedStatus(_.status);if(O!==L)return O?1:-1;let N=R=>{var z;return(z=R.timeEntries)!=null&&z.length?Math.max(...R.timeEntries.map(H=>new Date(H.startTime).getTime())):R.dateModified?new Date(R.dateModified).getTime():0};return N(_)-N(D)}),x.length===0){b.createDiv({cls:"stats-view__no-data",text:this.plugin.i18n.translate("views.stats.noTasks")});return}let C=b.createDiv({cls:"stats-view__task-count"});C.textContent=`Showing ${x.length} task${x.length!==1?"s":""}`;for(let D of x){let _=this.plugin.settings.defaultVisibleProperties?Ra(this.plugin.settings.defaultVisibleProperties,this.plugin):void 0,O=Sr(D,this.plugin,_);b.appendChild(O)}};w("all"),this.registerDomEvent(k,"change",()=>{w(k.value)})}renderActivityChart(t,n){if(t.empty(),n.length===0)return;let i=Math.max(...n.map(s=>s.timeSpent));if(i===0){t.createDiv({cls:"stats-view__no-data",text:"No time tracking data"});return}let a=t.createDiv({cls:"stats-view__bar-chart"});for(let s of n){let l=a.createDiv({cls:"stats-view__bar-container"}).createDiv({cls:"stats-view__bar"}),c=s.timeSpent/i*40;l.style.height=`${c}px`;let d=`${P(new Date(s.date),"MMM d")}: ${Math.round(s.timeSpent)}m`;l.setAttribute("title",d)}}}});function Zct(r,e=o3){return r.replace(/\(((?:#\d+\s*)(?:,\s*#\d+\s*)*)\)/g,(t,n)=>`(${n.split(",").map(a=>a.trim()).filter(Boolean).map(a=>{let s=a.slice(1);return`[#${s}](${e}/issues/${s})`}).join(", ")})`)}var DO,yD,FPe,o3,CO,l3=y(()=>{DO=require("obsidian");Br();yD="tasknotes-release-notes",FPe="https://github.com/callumalpass/tasknotes/releases",o3="https://github.com/callumalpass/tasknotes";CO=class extends DO.ItemView{constructor(e,t,n,i){super(e),this.plugin=t,this.releaseNotesBundle=n,this.version=i}getViewType(){return yD}getDisplayText(){return this.plugin.i18n.translate("views.releaseNotes.title",{version:this.version})}getIcon(){return"book-open"}transformIssueLinks(e){return Zct(e)}formatDate(e){if(!e)return"";try{let t=Ls(e);return P(t,"MMMM d, yyyy")}catch(t){return""}}async createVersionSection(e,t,n){let i=e.createDiv({cls:"release-notes-version-section"});i.classList.remove("tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-bottom-0-75rem-c05a3c6e","tn-static-margin-bottom-8px-fdf33f23"),i.classList.add("tn-static-margin-bottom-20px-49f14f8f"),i.classList.remove("tn-static-border-none-2eda1daa","tn-static-padding-12px-43bef435"),i.classList.add("tn-static-border-1px-solid-var-background-mo-b65b5121"),i.classList.remove("tn-static-border-radius-4px-c290c56e","tn-static-margin-8px-0-0-0-a2eb8382","tn-static-padding-12px-43bef435","tn-static-padding-20px-ebe8e48c"),i.classList.add("tn-static-border-radius-6px-0dc8408c"),i.classList.remove("tn-static-flex-1-14e3b769"),i.classList.add("tn-static-overflow-hidden-69824400");let a=i.createDiv({cls:"release-notes-version-header"});a.classList.remove("tn-static-margin-8px-0-0-0-a2eb8382","tn-static-padding-0-16px-16px-16px-f1aa998c","tn-static-padding-0-41d7d7e2","tn-static-padding-12px-43bef435","tn-static-padding-20px-769fed37","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c","tn-static-padding-2px-8px-c8eea84a","tn-static-padding-2rem-42aa6d9c"),a.classList.add("tn-static-padding-16px-287f770e"),a.classList.remove("tn-static-cursor-grab-dad79857","tn-static-cursor-pointer-2723efcc"),a.classList.add("tn-static-cursor-pointer-3b6a3a65"),a.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),a.classList.add("tn-static-display-flex-75816cae"),a.classList.remove("tn-static-justify-content-center-03c4bb6f","tn-static-justify-content-flex-end-455f8cca"),a.classList.add("tn-static-justify-content-space-between-a562f4fd"),a.classList.remove("tn-static-align-items-baseline-4b95b5c7","tn-static-align-items-flex-start-0486f781"),a.classList.add("tn-static-align-items-center-7c619740"),a.style.backgroundColor=t.isCurrent?"var(--background-secondary)":"var(--background-primary)",a.classList.add("tn-static-transition-background-color-0-2s-8142f01e"),a.addEventListener("mouseenter",()=>{a.classList.remove("tn-static-background-color-var-background-mo-94b219f0","tn-static-background-color-var-color-base-40-ef5f175e","tn-static-background-color-var-color-red-134bc721","tn-static-background-color-var-text-accent-a954c70f"),a.classList.add("tn-static-background-color-var-background-se-9087a23e")}),a.addEventListener("mouseleave",()=>{a.style.backgroundColor=t.isCurrent?"var(--background-secondary)":"var(--background-primary)"});let s=a.createDiv({cls:"release-notes-version-info"});s.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-cccfa456","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),s.classList.add("tn-static-display-flex-75816cae"),s.classList.remove("tn-static-align-items-center-7c619740","tn-static-align-items-flex-start-0486f781"),s.classList.add("tn-static-align-items-baseline-4b95b5c7"),s.classList.remove("tn-static-display-flex-8bb39979","tn-static-gap-0-5rem-ce2fca4d","tn-static-gap-10px-f3d7ce77","tn-static-gap-6px-f0abc1db","tn-static-gap-8px-33fcd4c3"),s.classList.add("tn-static-gap-12px-ed7b3d87");let o=s.createEl("h2",{text:t.version});if(o.classList.remove("tn-static-margin-0-auto-266e9b04","tn-static-margin-0-db0d5f36","tn-static-margin-0-var-size-4-2-77f7dc08","tn-static-margin-2px-0-edce9b14","tn-static-margin-8px-0-0-0-a2eb8382","tn-static-padding-12px-43bef435","tn-static-padding-20px-ebe8e48c"),o.classList.add("tn-static-margin-0-11696618"),o.classList.remove("tn-static-font-size-0-75em-948e16e5","tn-static-font-size-0-8em-19dc7c13","tn-static-font-size-0-9em-65025e95","tn-static-font-size-12px-65574819","tn-static-font-size-12px-b0cc7e05","tn-static-font-size-var-tn-font-size-sm-0274a31d","tn-static-margin-8px-0-0-0-a2eb8382","tn-static-margin-top-8px-f4f01e68"),o.classList.add("tn-static-font-size-1-2em-3a352995"),o.classList.remove("tn-static-cursor-pointer-2723efcc","tn-static-font-weight-500-02a2d333","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd"),o.classList.add("tn-static-font-weight-600-eed0f8fb"),t.isCurrent){let p=s.createEl("span",{text:"Current"});p.classList.remove("tn-static-font-size-0-8em-19dc7c13","tn-static-font-size-0-9em-65025e95","tn-static-font-size-1-2em-3a352995","tn-static-font-size-12px-65574819","tn-static-font-size-12px-b0cc7e05","tn-static-font-size-var-tn-font-size-sm-0274a31d","tn-static-margin-8px-0-0-0-a2eb8382","tn-static-margin-top-8px-f4f01e68"),p.classList.add("tn-static-font-size-0-75em-948e16e5"),p.classList.remove("tn-static-margin-8px-0-0-0-a2eb8382","tn-static-padding-0-16px-16px-16px-f1aa998c","tn-static-padding-0-41d7d7e2","tn-static-padding-12px-43bef435","tn-static-padding-16px-287f770e","tn-static-padding-20px-769fed37","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c","tn-static-padding-2rem-42aa6d9c"),p.classList.add("tn-static-padding-2px-8px-c8eea84a"),p.classList.remove("tn-static-border-radius-6px-0dc8408c","tn-static-margin-8px-0-0-0-a2eb8382","tn-static-padding-12px-43bef435","tn-static-padding-20px-ebe8e48c"),p.classList.add("tn-static-border-radius-4px-c290c56e"),p.classList.remove("tn-static-background-color-var-background-mo-94b219f0","tn-static-background-color-var-background-se-9087a23e","tn-static-background-color-var-color-base-40-ef5f175e","tn-static-background-color-var-color-red-134bc721"),p.classList.add("tn-static-background-color-var-text-accent-a954c70f"),p.classList.remove("tn-static-color-var-color-accent-d2cad743","tn-static-color-var-text-accent-65b47ee3","tn-static-color-var-text-muted-5872de20","tn-static-color-var-text-warning-783d5f03","tn-static-color-var-tn-text-muted-a90fb6f3","tn-static-color-white-0a43e56a","tn-static-cursor-pointer-2723efcc","tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-2px-0-edce9b14","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c"),p.classList.add("tn-static-color-var-text-on-accent-f3e1679d"),p.classList.remove("tn-static-cursor-pointer-2723efcc","tn-static-font-weight-600-eed0f8fb","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd"),p.classList.add("tn-static-font-weight-500-02a2d333")}if(t.date){let p=s.createEl("span",{text:this.formatDate(t.date)});p.classList.remove("tn-static-color-var-color-accent-d2cad743","tn-static-color-var-text-accent-65b47ee3","tn-static-color-var-text-on-accent-f3e1679d","tn-static-color-var-text-warning-783d5f03","tn-static-color-var-tn-text-muted-a90fb6f3","tn-static-color-white-0a43e56a","tn-static-cursor-pointer-2723efcc","tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-2px-0-edce9b14","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c"),p.classList.add("tn-static-color-var-text-muted-5872de20"),p.classList.remove("tn-static-font-size-0-75em-948e16e5","tn-static-font-size-0-8em-19dc7c13","tn-static-font-size-1-2em-3a352995","tn-static-font-size-12px-65574819","tn-static-font-size-12px-b0cc7e05","tn-static-font-size-var-tn-font-size-sm-0274a31d","tn-static-margin-8px-0-0-0-a2eb8382","tn-static-margin-top-8px-f4f01e68"),p.classList.add("tn-static-font-size-0-9em-65025e95")}let l=a.createEl("span",{text:n?"\u25BC":"\u25B6"});l.classList.remove("tn-static-font-size-0-75em-948e16e5","tn-static-font-size-0-9em-65025e95","tn-static-font-size-1-2em-3a352995","tn-static-font-size-12px-65574819","tn-static-font-size-12px-b0cc7e05","tn-static-font-size-var-tn-font-size-sm-0274a31d","tn-static-margin-8px-0-0-0-a2eb8382","tn-static-margin-top-8px-f4f01e68"),l.classList.add("tn-static-font-size-0-8em-19dc7c13"),l.classList.remove("tn-static-color-var-color-accent-d2cad743","tn-static-color-var-text-accent-65b47ee3","tn-static-color-var-text-on-accent-f3e1679d","tn-static-color-var-text-warning-783d5f03","tn-static-color-var-tn-text-muted-a90fb6f3","tn-static-color-white-0a43e56a","tn-static-cursor-pointer-2723efcc","tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-2px-0-edce9b14","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c"),l.classList.add("tn-static-color-var-text-muted-5872de20");let c=i.createDiv({cls:"release-notes-version-content"});c.classList.remove("tn-static-margin-8px-0-0-0-a2eb8382","tn-static-padding-0-41d7d7e2","tn-static-padding-12px-43bef435","tn-static-padding-16px-287f770e","tn-static-padding-20px-769fed37","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c","tn-static-padding-2px-8px-c8eea84a","tn-static-padding-2rem-42aa6d9c"),c.classList.add("tn-static-padding-0-16px-16px-16px-f1aa998c"),c.style.display=n?"block":"none";let d=this.transformIssueLinks(t.content),u=t.isCurrent?`${this.plugin.i18n.translate("views.releaseNotes.baseFilesNotice")} + +${d}`:d;await DO.MarkdownRenderer.render(this.plugin.app,u,c,"",this),a.addEventListener("click",()=>{let p=c.style.display!=="none";c.style.display=p?"none":"block",l.textContent=p?"\u25B6":"\u25BC"})}async onOpen(){let{contentEl:e}=this;e.empty(),e.addClass("tasknotes-release-notes-view");let t=e.createDiv({cls:"tasknotes-release-notes-container"});t.classList.remove("tn-static-margin-8px-0-0-0-a2eb8382","tn-static-padding-0-16px-16px-16px-f1aa998c","tn-static-padding-0-41d7d7e2","tn-static-padding-12px-43bef435","tn-static-padding-16px-287f770e","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c","tn-static-padding-2px-8px-c8eea84a","tn-static-padding-2rem-42aa6d9c"),t.classList.add("tn-static-padding-20px-769fed37"),t.classList.add("tn-static-max-width-900px-1d34c094"),t.classList.remove("tn-static-margin-0-11696618","tn-static-margin-0-db0d5f36","tn-static-margin-0-var-size-4-2-77f7dc08","tn-static-margin-2px-0-edce9b14","tn-static-margin-8px-0-0-0-a2eb8382","tn-static-padding-12px-43bef435","tn-static-padding-20px-ebe8e48c"),t.classList.add("tn-static-margin-0-auto-266e9b04");let n=t.createEl("div",{cls:"release-notes-header"});n.classList.remove("tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-bottom-0-75rem-c05a3c6e","tn-static-margin-bottom-8px-fdf33f23"),n.classList.add("tn-static-margin-bottom-20px-49f14f8f"),n.createEl("h1",{text:this.plugin.i18n.translate("views.releaseNotes.header",{version:this.version})});let i=t.createEl("p");i.classList.remove("tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-bottom-0-75rem-c05a3c6e","tn-static-margin-bottom-8px-fdf33f23"),i.classList.add("tn-static-margin-bottom-20px-49f14f8f"),i.classList.remove("tn-static-font-size-0-75em-948e16e5","tn-static-font-size-0-8em-19dc7c13","tn-static-font-size-1-2em-3a352995","tn-static-font-size-12px-65574819","tn-static-font-size-12px-b0cc7e05","tn-static-font-size-var-tn-font-size-sm-0274a31d","tn-static-margin-8px-0-0-0-a2eb8382","tn-static-margin-top-8px-f4f01e68"),i.classList.add("tn-static-font-size-0-9em-65025e95"),i.classList.remove("tn-static-color-var-color-accent-d2cad743","tn-static-color-var-text-accent-65b47ee3","tn-static-color-var-text-on-accent-f3e1679d","tn-static-color-var-text-warning-783d5f03","tn-static-color-var-tn-text-muted-a90fb6f3","tn-static-color-white-0a43e56a","tn-static-cursor-pointer-2723efcc","tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-2px-0-edce9b14","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c"),i.classList.add("tn-static-color-var-text-muted-5872de20");let a=this.plugin.i18n.translate("views.releaseNotes.starMessage"),s=a.toLowerCase().lastIndexOf("github");if(s!==-1){i.appendText(a.substring(0,s));let d=i.createEl("a",{text:a.substring(s,s+6),href:o3});d.classList.remove("tn-static-color-var-color-accent-d2cad743","tn-static-color-var-text-muted-5872de20","tn-static-color-var-text-on-accent-f3e1679d","tn-static-color-var-text-warning-783d5f03","tn-static-color-var-tn-text-muted-a90fb6f3","tn-static-color-white-0a43e56a","tn-static-cursor-pointer-2723efcc","tn-static-font-size-12px-65574819","tn-static-font-weight-bold-0fe8c30d","tn-static-font-weight-bold-e0b452bd","tn-static-margin-2px-0-edce9b14","tn-static-padding-20px-7a035d95","tn-static-padding-20px-ebe8e48c"),d.classList.add("tn-static-color-var-text-accent-65b47ee3"),d.addEventListener("click",u=>{u.preventDefault(),window.open(o3,"_blank")}),i.appendText(a.substring(s+6))}else i.appendText(a);let o=t.createEl("div",{cls:"release-notes-versions"});for(let d=0;d{d.preventDefault(),window.open(FPe,"_blank")})}async onClose(){let{contentEl:e}=this;e.empty()}}});var $Pe,zPe=y(()=>{$Pe=`# TaskNotes 4.10.0 + +## Added + +- **New companion plugin:** TaskNotes Workflows adds Markdown-defined automation for TaskNotes tasks, events, schedules, and manual commands. It keeps automation workflows outside TaskNotes core while using the runtime API for safe task reads, writes, queries, events, and relationship resolution. See [TaskNotes Workflows](https://tasknotes.dev/companion-plugins/tasknotes-workflows/). + - (#1530) \`Auto-start time tracking\` starts a timer when a task moves into active work. Thanks to @Jendrik0 and @benmartinek for the request and follow-up. + - (#222, #184) \`Stop time tracking on complete\` stops active timers when a task is completed. Thanks to @bcohen44 and @cathywu for the requests, and @amarjt for the follow-up. + - (#265) \`Stamp started timestamp\` records a custom started timestamp when a task first moves into active work. Thanks to @cathywu, @digitaldoctors, and @Leo310 for the request and discussion. + - (#1703) \`Clear scheduled when started\` clears the scheduled date when a task moves into active work. Thanks to @kmaustral for the request. + - (#1293) \`Rollover overdue scheduled tasks\` moves incomplete tasks with past scheduled dates back to today. Thanks to @grosserfrank for the request. + - (#1896) \`Escalate upcoming due tasks\` raises priority as due dates approach. Thanks to @Neptune-Illusion for the request. + - (#214, #518, #1785, #1855) The subtask inheritance workflows can copy parent contexts, tags, priority, planning dates, and dependencies into new subtasks. Thanks to @timfidd, @bepolymathe, @AndyEveritt, @lindsaylearns, @tomsymonds, @wedgen, @poulpoulsen, and @misolex for the related requests and discussion. + - (#1166) \`Blocked task review\` provides a reminder-style review for blocked tasks without automatically deleting dependency links. Thanks to @jpmoo and @jortscity for the request and follow-up. +- Added a versioned TaskNotes JavaScript runtime API for companion plugins, with namespaced model validation, canonical task query validation/normalization/explain helpers, catalogs, query/support helpers, lifecycle events, typed errors/results, task, time-tracking, Pomodoro, recurring-task, settings, NLP, event, and extension-registry surfaces. Runtime API mutations carry source and correlation metadata so companion plugins can debug and coordinate workflow runs. See [JavaScript API](https://tasknotes.dev/javascript-api/). +- Added documentation for the companion-plugin model. See [Companion Plugins](https://tasknotes.dev/companion-plugins/). +- (#288, #345, #361, #523, #573, #703, #925, #929, #1115, #1137, #1260, #1303, #1324, #1394, #1445, #1509, #1735, #1736, #1743, #1780, #1874, #1951, #1974) Added support for TaskNotes spec 0.2.0 materialized occurrences, including recurrence parent/date fields, generated mdbase schema roles, parent reconciliation when occurrence notes are completed, occurrence notes that inherit parent planning metadata without copying history, occurrence note controls in task, calendar, and edit-modal completion menus, and visible occurrence identity on task cards. This gives recurring tasks a concrete occurrence-note path for per-instance state, related notes, subtasks, templates, scheduling changes, completion history, and calendar behavior without forcing every recurring task to create files. See [Recurring Tasks](https://tasknotes.dev/features/recurring-tasks/#materialized-occurrence-notes) and [Property Types Reference](https://tasknotes.dev/settings/property-types-reference/#materialized-occurrence-properties). Thanks to @LuxBetancourt, @jerzy-dudzic, @luciolebrillante, @BryanWall, @jhedlund, @kazerniel, @nschenone, @realJohnDoe, @cathywu, @Lorite, @EllenGYY, @JcMinarro, @gsssr, @slipstyle, @3zra47, @Leonard-44, @ak-42, @RumiaKitinari, @atos2212-blip, @kmaustral, @eugenedefox, @notDavid, @zitongcharliedeng, and @Jomo94 for the related recurrence, occurrence, completion, and calendar requests. +- (#1951) Added Calendar support for recurring tasks stretched between scheduled and due dates when the existing stretch option is enabled. Date-only ranges stay as all-day spans, and timed ranges render once per day in the range. Thanks to @atos2212-blip for the request. +- (#1751, #1792, #1969) Added a Task List and Kanban view option to hide top-level subtasks when their parent task is also in the filtered view, while still allowing inherited expanded relationships to show the subtasks under the parent. Thanks to @Glint-Eye and @Proxybat for the request and follow-up, and @stanley-910 and @Spencerduran for the earlier PRs. + +## Changed + +- Moved core TaskNotes model behavior for field mapping, dates, recurrence, time-tracking, and adapter operation planning into a shared package used by the plugin and companion tooling. +- Calendar views now coalesce materialized occurrence notes with their matching virtual recurring instances. Dragging a materialized occurrence reschedules that occurrence note without changing the parent recurrence rule or the note's \`occurrence_date\` identity. See [Recurring Tasks](https://tasknotes.dev/features/recurring-tasks/#calendar-drag-and-drop). +- Improved the Calendar Bases View Options menu by splitting settings into clearer groups and hiding view-specific controls until they apply to the selected calendar mode. + +## Fixed + +- (#1976) Fixed embedded Calendar and Agenda Bases so "Navigate to date from property" can use the containing note's date property when the Base rows do not have that property. Thanks to @matesvecenik for reporting this. +- (#1977) Fixed Calendar and Agenda views showing duplicate all-day entries when a task's scheduled date and due date are the same day. Timed due dates on the same day still show as separate deadline markers. Thanks to @pdgBC for reporting this. +- Fixed the release notes view using cramped interface typography instead of regular reading typography. +- (#216) Improved inline conversion for Tasks plugin task lines, including Dataview-style fields, priority markers, recurrence text, date aliases, block links, and safer trailing-field parsing. Thanks to @ksdavidc for the request, @natleahh for the Dataview example, and @hangryscribe3 and @nayatiuh for the discussion. +- (#1974) Stopped Calendar and Agenda property-based events from logging date parse errors for entries that do not have the selected date property. Thanks to @Jomo94 for suggesting completed-date Agenda events. +- (#1973) Reduced unnecessary Calendar view recreations when external calendar providers are reported in a different order, and preserved Calendar scroll position when a config-driven refresh has to recreate the view. Thanks to @e-zz for reporting this. +- (#1972) Fixed ICS calendar event related notes so standalone events with similar numeric IDs no longer show unrelated notes or tasks on every event. Thanks to @ks-studio-net for reporting this. +- (#1970) Fixed generated default Base filters so updating default files applies configured excluded folders to TaskNotes task views. Thanks to @henrim01 for reporting that templates could still appear in regenerated views. +- (#1968) Fixed inline task link overlays collapsing on Obsidian mobile, which could hide the task title and leave a tall empty gap after the widget. Thanks to @renatomen for reporting and diagnosing the containment issue. +`});var jPe,BPe=y(()=>{jPe=`# TaskNotes 4.9.2 + +## Added + +- (#1791) Added collapse and expand controls for grouped Bases Task List views, including a default collapsed state option. + - Thanks to @renatomen for the contribution. + +## Fixed + +- Fixed Pomodoro storage migration so existing plugin-data history is written to daily notes before switching storage, and clarified that daily notes can come from either the core Daily Notes plugin or Periodic Notes. +- (#1964) Fixed Microsoft Calendar OAuth so connecting no longer forces a fresh consent prompt every time, and clarified the Microsoft desktop app setup steps. + - Thanks to @thechonta for reporting. +- (#1966) Fixed custom priority icons so they render as icons instead of filled squares on task cards. + - Thanks to @sruiz-savia for reporting. +- (#1963) Fixed Google Calendar sync so duplicate event ID fields are repaired when saving task calendar metadata. + - Thanks to @christenbc for reporting. +- (#1961) Fixed the default custom filename template so it uses the recommended double-brace syntax and no longer warns on first use. + - Thanks to @chmac for reporting. +- (#1962) Fixed task tag normalization so tags entered with spaces are saved with hyphens for Obsidian tag compatibility. + - Thanks to @christenbc for reporting. +- (#1959) Fixed the MCP \`tasknotes_list_tasks\` tool so circular internal task data and live Obsidian object references no longer break task-list responses. + - Thanks to @kmaustral for reporting. +- (#1957) Fixed the Pomodoro timer layout in vertically split panes so the timer header and progress circle remain reachable when the pane is short. + - Thanks to @sumiyalairu03 for reporting. +- (#1956) Fixed Google Calendar sync so completing a recurring task updates the linked event title with the completion checkmark. + - Thanks to @jacksoluke for reporting. +- (#1953) Fixed inline task conversion so source-line wikilinks no longer create nested wikilinks in the replacement link text. + - Thanks to @bgk0018 for reporting. +- (#1952) Fixed Pomodoro task picker search results so matching task titles are ranked and sorted ahead of due-date ordering. + - Thanks to @KFrancoD for reporting. +- (#1392, #1949) Fixed due and scheduled date picker fields so typed or pasted date edits stay open until you choose Select, including compact \`YYYYMMDD\` entry when a date is already set. + - Thanks to @kazerniel for reporting and following up. +- (#982, #1947) Restored larger mobile task-card typography and let secondary card icons wrap below the task details when they no longer fit comfortably on mobile. + - Thanks to @3zra47 for reporting the font-size regression, @chrsdk and @scottaltham-payroc for confirming the mobile font-size issue, and @Jomo94 for reporting the mobile card layout problem. +`});var UPe,HPe=y(()=>{UPe=`# TaskNotes 4.9.1 + +## Added + +- (#1885) Added Shift+arrow keyboard range selection while bulk task selection mode is active. + - Thanks to @chrabia for suggesting bulk selection improvements and @sumiyalairu03 for the keyboard selection idea. + +## Fixed + +- (#781, #1085) Fixed Outlook-published ICS calendar events appearing at the wrong time when their feed used Windows timezone names without matching timezone definitions. + - Thanks to @chrlaney for reporting and @mjkrasny for confirming the Outlook timezone case. +- (#1696) Fixed Google Calendar export for scheduled recurring tasks when a single occurrence is moved to a different date. + - Keeps the recurring master event on its original rule, excludes the original occurrence date, and syncs the moved occurrence as a detached event. + - Thanks to @martin-forge for reporting and contributing the fix. +- (#1912) Fixed "Create subtask" inserting the full path of the parent task in the Projects field instead of using the normal Obsidian link text. + - Thanks to @pkuehne for reporting and @benmartinek for confirming. +- (#1921) Fixed Google Calendar and auto-archive updates not running after direct task file edits. + - TaskNotes now picks up status, completion, and date changes made directly in a task file without triggering a large one-time Google Calendar rewrite at startup. + - Recovery also removes stale Google Calendar links when task files were deleted or replaced outside TaskNotes. + - Thanks to @martin-forge for reporting and contributing the fix. +- (#1938) Fixed partial HTTP API task updates rewriting native tags with \`#\` prefixes or duplicate task tags. + - Thanks to @joseluisgonzalezdelgado-ctrl for reporting. +- (#1939) Fixed the task Details field rendering as a small nested textarea when the embedded editor falls back. + - Thanks to @g-arthurvanderbilt for reporting and @cookbr for confirming the desktop impact. +- Fixed tag and modal preview edge cases found during validation: double-hash tags no longer match the task tag, empty tag lists stay empty when read back, and natural-language previews remain visible when enabled. +- (#1941) Fixed mobile Kanban boards scrolling the whole board vertically instead of keeping each list independently scrollable. + - Thanks to @pxxush for reporting. +- (#1943) Fixed MCP task-query tool instructions so filter operators match the operators TaskNotes actually accepts. + - Thanks to @jordankbartos for reporting and proposing a fix in #1944. +- (#1945) Fixed Google Calendar export so overlapping sync services do not create duplicate events for the same task while the saved event ID is still catching up. + - Thanks to @martin-forge for reporting and contributing the fix. +- (#1946) Fixed the bottom task in virtualized Task List Bases being partially hidden behind Obsidian's mobile bottom bar. + - Thanks to @3zra47 for reporting. +- (#1947) Fixed mobile Task List cards with left-positioned subtask chevrons so the chevron remains visible and project/detail badges stay on the main row. + - Thanks to @Jomo94 for reporting. +- (#1948) Fixed Agenda Calendar Bases so completed recurring instances can appear on their recorded completion dates, even when recurring task projections are hidden or the completion date is outside the recurrence pattern. + - Thanks to @Jomo94 for reporting. +`});var VPe,qPe=y(()=>{VPe=`# TaskNotes 4.9.0 + +## Security + +- (#1923) Restricted the HTTP API server to loopback and limited browser CORS access to loopback origins. + - Thanks to @martin-forge for reporting. + +## Added + +- (#1932) Added middle-click support for opening task cards in a new tab. + - Thanks to @imsuck for the request. + +## Fixed + +- (#1934) Fixed custom priority colors being overridden by default task-card priority styles in views. + - Thanks to @KittehBit for reporting. +- (#1933) Added the note path to fallback frontmatter parse warnings so malformed task YAML is easier to find. + - Thanks to @rayvermey for reporting. +- (#1931) Made the Pomodoro task chooser open from cached task data and ignore repeated clicks while it is already opening. + - Thanks to @sumiyalairu03 for reporting. +- (#1930) Fixed starting the Pomodoro timer from its hotkey without starting time tracking for the selected Pomodoro task. + - Thanks to @sumiyalairu03 for reporting. +- (#1929) Fixed the bottom Relationships widget overlapping embedded content such as Bases/Kanban views in task notes. + - Thanks to @rchaklashiya for reporting and following up with the embed case. +- (#1922) Restored the native color picker alongside manual color text entry in Create/Edit Timeblock fields. + - Thanks to @AndreMonthy for reporting. +- (#1921) Fixed direct frontmatter edits to lifecycle-relevant task fields not triggering Google Calendar sync or auto-archive side effects. + - Thanks to @martin-forge for reporting and verifying the direct-edit reproduction. +- (#1919) Fixed the Pomodoro view rapidly resizing at certain sidebar sizes. + - Thanks to @RumiaKitinari for reporting. +- (#1898, #1907) Fixed Calendar time labels shifting into the middle of Day and sidebar calendar grids after switching views. + - Thanks to @ddevaal for reporting and confirming the regression, and to @kmaustral for confirming the sidebar case in 4.8.1. +- (#1936) Added a Calendar Base drag/drop resolution option so events can snap to smaller increments than the visible time slot grid. + - Thanks to @benmartinek for suggesting this. +- Improved mobile task cards, inline widgets, modals, and settings layouts so dense controls and long labels fit more comfortably on small screens. +- (#1916) Fixed Markdown task links using Obsidian's generated filename label instead of the TaskNote title in the task link overlay. + - Thanks to @minchinweb for reporting. +- (#1911) Fixed recurrence choices starting from today instead of the selected calendar date when creating a task from Calendar view. + - Thanks to @mikhailmarka for reporting. +- (#1912) Fixed "Create subtask" pre-filling the parent task's full folder path in the Projects field instead of using the normal Obsidian link text. + - Thanks to @pkuehne for reporting and @benmartinek for confirming. +`});var WPe,YPe,GPe=y(()=>{zPe();BPe();HPe();qPe();WPe="4.10.0",YPe=[{version:"4.10.0",content:$Pe,date:"2026-06-01T21:50:12+10:00",isCurrent:!0},{version:"4.9.2",content:jPe,date:"2026-05-30T05:43:04+10:00",isCurrent:!1},{version:"4.9.1",content:UPe,date:"2026-05-26T18:40:45+10:00",isCurrent:!1},{version:"4.9.0",content:VPe,date:"2026-05-24T09:35:31+10:00",isCurrent:!1}]});function Qct(r){try{return decodeURIComponent(r)}catch(e){return r}}function Jct(r){let e=r.trim();return e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1).trim():e}function PO(r){var i;if(!r)return"";let e=Qct(Jct(r));return((i=e.split(/[#!^]/)[0])!=null?i:e).replace(/^\/+/,"").replace(/\.md$/i,"").trim()}function KPe(r){var n;let e=PO(r),t=e.split("/").filter(Boolean);return(n=t[t.length-1])!=null?n:e}function c3(r,e,t){let n=PO(r);if(!n||!e)return!1;let i=PO(e),a=PO(t),s=new Set([i,KPe(i)]);return a&&(s.add(a),s.add(KPe(a))),s.has(n)}function _T(r,e,t){let n=r==null?void 0:r.trim();if(n&&!c3(n,e,t))return n}var MO=y(()=>{});var d3={};et(d3,{TaskLinkDetectionService:()=>vD});var Tg,vD,_O=y(()=>{Tg=require("obsidian");G();MO();vD=class{constructor(e,t){this.linkCache=new Map;this.plugin=e,this.logger=t!=null?t:I({tag:"TaskLinkDetectionService",isDebugEnabled:()=>e.settings.enableDebugLogging})}async detectTaskLink(e,t,n="wikilink"){let i=n==="wikilink"?this.parseWikilink(e):this.parseMarkdownLink(e);if(!i)return{isValidTaskLink:!1};let{linkPath:a,displayText:s}=i,o=`${t}:${a}`,l=this.linkCache.get(o);if(l){let p=this.plugin.app.vault.getAbstractFileByPath(a);if(p instanceof Tg.TFile&&p.stat.mtime===l.lastModified)return l.result}let c=this.resolveLinkPath(a,t);if(!c){let p={isValidTaskLink:!1};return this.cacheResult(o,p,0),p}let d=this.plugin.app.vault.getAbstractFileByPath(c);if(!(d instanceof Tg.TFile)){let p={isValidTaskLink:!1};return this.cacheResult(o,p,0),p}try{let p=await this.plugin.cacheManager.getTaskInfo(c);if(p){let m=n==="markdown"?_T(s,p.path,a):s,f={isValidTaskLink:!0,taskPath:c,taskInfo:p,displayText:m};return this.cacheResult(o,f,d.stat.mtime),f}}catch(p){this.logger.debug("Error checking task info for link",{category:"stale-data",operation:"detect-task-link",details:{resolvedPath:c},error:p})}let u={isValidTaskLink:!1};return this.cacheResult(o,u,d.stat.mtime),u}parseWikilink(e){let t=e.slice(2,-2).trim();if(!t)return null;let n=t.indexOf("|");if(n!==-1){let a=t.slice(0,n).trim(),s=t.slice(n+1).trim();return!a||!s?null:{linkPath:(0,Tg.parseLinktext)(a).path,displayText:s}}let i=(0,Tg.parseLinktext)(t);return{linkPath:i.path,displayText:i.subpath||void 0}}parseMarkdownLink(e){let t=e.match(/^\[([^\]]*)\]\(([^)]+)\)$/);if(!t)return null;let n=t[1].trim(),i=t[2].trim();if(i.startsWith("<")&&i.endsWith(">")&&(i=i.slice(1,-1).trim()),!i)return null;try{i=decodeURIComponent(i)}catch(s){this.logger.debug("Failed to decode URI component",{category:"validation",operation:"parse-markdown-link",details:{linkPath:i},error:s})}let a=(0,Tg.parseLinktext)(i);return{linkPath:a.path,displayText:n||a.subpath||void 0}}resolveLinkPath(e,t){try{let n=this.plugin.app.metadataCache.getFirstLinkpathDest(e,t);return(n==null?void 0:n.path)||null}catch(n){return this.logger.debug("Error resolving link path",{category:"provider",operation:"resolve-link-path",details:{linkPath:e,sourcePath:t},error:n}),null}}cacheResult(e,t,n){if(this.linkCache.set(e,{result:t,lastModified:n}),this.linkCache.size>1e3){let i=this.linkCache.keys().next().value;this.linkCache.delete(i)}}clearCacheForFile(e){for(let[t]of this.linkCache)t.includes(e)&&this.linkCache.delete(t)}clearCache(){this.linkCache.clear()}findWikilinks(e){let t=[],n=/\[\[([^\]]+)\]\]/g,i;for(;(i=n.exec(e))!==null;)t.push({match:i[0],start:i.index,end:i.index+i[0].length,type:"wikilink"});let a=/\[([^\]]*)\]\(([^)]+)\)/g;for(n.lastIndex=0;(i=a.exec(e))!==null;)t.push({match:i[0],start:i.index,end:i.index+i[0].length,type:"markdown"});return t.sort((s,o)=>s.start-o.start)}cleanup(){this.linkCache.clear()}}});var ZPe,kg,u3=y(()=>{ZPe=require("@codemirror/view");AO();la();xc();Ne();kg=class r extends ZPe.WidgetType{constructor(e,t,n,i,a=vn(new Date)){super(),this.taskInfo=e,this.plugin=t,this.originalText=n,this.displayText=i,this.targetDate=a,this.targetDateKey=ce(a)}toDOM(e){let t=this.plugin.settings.inlineVisibleProperties||["status","priority","due","scheduled","recurrence"],n=Ra(t,this.plugin),i=activeDocument.createElement("span");i.className="tasknotes-plugin tasknotes-inline-widget",i.classList.remove("tn-static-display-block-2a1b75c9","tn-static-display-flex-4d51fc62","tn-static-display-flex-75816cae","tn-static-display-flex-8bb39979","tn-static-display-inline-block-60e32dcb","tn-static-display-inline-flex-f984c520","tn-static-display-none-6b99de8b","tn-static-min-height-800px-997b4c8c"),i.classList.add("tn-static-display-inline-cccfa456"),i.classList.add("tn-static-vertical-align-baseline-657d9c46");let a=Sr(this.taskInfo,this.plugin,n,{layout:"inline",targetDate:this.targetDate,displayText:this.displayText});return i.appendChild(a),a.dataset.originalText=this.originalText,a.addEventListener("tasknotes:task-updated",()=>{window.setTimeout(()=>{e&&typeof e.dispatch=="function"&&Om(e,this.taskInfo.path)},50)}),i}eq(e){return e instanceof r?this.taskInfo.path===e.taskInfo.path&&this.taskInfo.status===e.taskInfo.status&&this.taskInfo.title===e.taskInfo.title&&this.taskInfo.priority===e.taskInfo.priority&&this.taskInfo.archived===e.taskInfo.archived&&this.taskInfo.due===e.taskInfo.due&&this.taskInfo.scheduled===e.taskInfo.scheduled&&this.taskInfo.recurrence===e.taskInfo.recurrence&&this.displayText===e.displayText&&this.targetDateKey===e.targetDateKey&&JSON.stringify(this.taskInfo.complete_instances)===JSON.stringify(e.taskInfo.complete_instances)&&JSON.stringify(this.taskInfo.skipped_instances)===JSON.stringify(e.taskInfo.skipped_instances)&&this.taskInfo.dateModified===e.taskInfo.dateModified:!1}ignoreEvent(e){return e.type==="mousedown"||e.type==="click"}get estimatedHeight(){return-1}get block(){return!1}}});function Xct(r){let e=new Map,t=new Map;return Bl.ViewPlugin.fromClass(class{constructor(n){this.eventListeners=[];this.view=n,this.decorations=this.buildDecorations(n),this.setupEventListeners()}destroy(){this.eventListeners.forEach(n=>{r.emitter.offref(n)}),this.eventListeners=[]}setupEventListeners(){let n=r.emitter.on(ea,()=>{this.refreshDecorations()}),i=r.emitter.on(nt,()=>{this.refreshDecorations()}),a=r.emitter.on(Ja,l=>{l!=null&&l.path&&t.delete(l.path),this.refreshDecorations()}),s=r.emitter.on(xp,()=>{t.clear(),this.refreshDecorations()}),o=r.emitter.on("settings-changed",()=>{this.refreshDecorations()});this.eventListeners.push(n,i,a,s,o)}refreshDecorations(){this.view&&typeof this.view.dispatch=="function"&&queueMicrotask(()=>{try{e.clear(),this.view.dispatch({effects:[IO.of({})]})}catch(n){bD.error("Error dispatching task link update:",{category:"validation",operation:"dispatching-task-link-update",error:n})}})}update(n){var a,s;if(this.view=n.view,!((a=r==null?void 0:r.settings)!=null&&a.enableTaskLinkOverlay)){this.decorations=Bl.Decoration.none;return}try{if(!n.state.field(Ul.editorLivePreviewField)){this.decorations=Bl.Decoration.none;return}}catch(o){this.decorations=Bl.Decoration.none;return}let i=n.transactions.some(o=>o.effects.some(l=>l.is(IO)));if(n.docChanged||n.selectionSet||i){if(i){let o=(s=n.transactions.flatMap(l=>l.effects).find(l=>l.is(IO)))==null?void 0:s.value;if(o!=null&&o.taskPath)for(let[l]of e.entries())l.includes(o.taskPath)&&e.delete(l);else e.clear()}this.decorations=this.buildDecorations(n.view)}}buildDecorations(n){var i,a;try{if(!((i=r==null?void 0:r.settings)!=null&&i.enableTaskLinkOverlay))return Bl.Decoration.none;if(!n.state.field(Ul.editorLivePreviewField))return Bl.Decoration.none;let o=n.state.field(Ul.editorInfoField,!1),l=(a=o==null?void 0:o.file)==null?void 0:a.path;return edt(n.state,r,e,l,t)}catch(s){return bD.error("Error building task link decorations:",{category:"persistence",operation:"building-task-link-decorations",error:s}),Bl.Decoration.none}}},{decorations:n=>n.decorations})}function edt(r,e,t,n,i){var l,c;let a=new NO.RangeSetBuilder;if(!r||!e||!t)return a.finish();let s=r.doc;if(!s||!e.app||!e.app.workspace)return a.finish();let o=e.taskLinkDetectionService||new vD(e);if(!n){let d=e.app.workspace.getActiveViewOfType(Ul.MarkdownView);if(!d)return a.finish();n=(l=d.file)==null?void 0:l.path}if(!n||typeof n!="string"||n.length===0)return a.finish();try{let d=s.toString();if(typeof d!="string"||d.length>1e5)return a.finish();let u=(c=r.selection)==null?void 0:c.main.head,p=o.findWikilinks(d);if(!Array.isArray(p))return a.finish();for(let m of p)try{if(!m||typeof m.match!="string"||typeof m.start!="number"||typeof m.end!="number"||m.start<0||m.end<=m.start||m.start>=d.length||m.end>d.length||e.settings.disableOverlayOnAlias&&m.type==="wikilink"&&m.match.includes("|"))continue;let f=m.type==="wikilink"?tdt(m.match):rdt(m.match);if(!f)continue;let{linkPath:h}=f;if(!h||typeof h!="string"||h.trim().length===0)continue;let g=ndt(h,n,e);if(!g)continue;let v=idt(g,e);if(v){if(!v.title||typeof v.title!="string"||u!==void 0&&u>=m.start&&u=m.start&&u500)return null;let t=e.indexOf("|");if(t!==-1){let i=e.slice(0,t).trim(),a=e.slice(t+1).trim();if(!i||!a)return null;let s=(0,Ul.parseLinktext)(i);return s.path?{linkPath:s.path,displayText:a}:null}let n=(0,Ul.parseLinktext)(e);return n.path?{linkPath:n.path,displayText:n.subpath||void 0}:null}function rdt(r){if(!r||typeof r!="string")return null;let e=r.match(/^\[([^\]]*)\]\(([^)]+)\)$/);if(!e)return null;let t=e[1].trim(),n=e[2].trim();if(n.startsWith("<")&&n.endsWith(">")&&(n=n.slice(1,-1).trim()),!n||n.length===0||n.length>500)return null;try{n=decodeURIComponent(n)}catch(a){}let i=(0,Ul.parseLinktext)(n);return i.path?{linkPath:i.path,displayText:t||i.subpath||void 0}:null}function ndt(r,e,t){if(!r||typeof r!="string"||r.trim().length===0||!e||typeof e!="string"||!t||!t.app||!t.app.metadataCache)return null;try{let n=t.app.metadataCache.getFirstLinkpathDest(r,e);return!n||!n.path||typeof n.path!="string"?null:n.path}catch(n){return null}}function idt(r,e){if(!r||typeof r!="string"||r.trim().length===0||!e)return null;try{let t=/[<>:"|?*]/,n=r.split("").some(s=>{let o=s.charCodeAt(0);return o<=31||o===127});if(t.test(r)||n)return null;let i=e.cacheManager;if(!i||!i.getCachedTaskInfoSync)return null;let a=i.getCachedTaskInfoSync(r);return a&&typeof a=="object"&&a.title?a:null}catch(t){return null}}function QPe(r){return Xct(r)}function Om(r,e){if(!r||typeof r.dispatch!="function"){bD.warn("Invalid EditorView passed to dispatchTaskUpdate:",{category:"validation",operation:"invalid-editorview-passed-dispatchtaskupdate",details:{value:r}});return}try{r.dispatch({effects:[IO.of({taskPath:e})]})}catch(t){bD.error("Error dispatching task update:",{category:"validation",operation:"dispatching-task-update",error:t})}}var NO,Bl,Ul,bD,IO,AO=y(()=>{NO=require("@codemirror/state"),Bl=require("@codemirror/view"),Ul=require("obsidian");Ur();_O();u3();G();MO();bD=I({tag:"Editor/TaskLinkOverlay"}),IO=NO.StateEffect.define()});var AT,p3=y(()=>{AT=class{constructor(){this.states=new WeakMap}schedule(e,t){let n=this.getState(e);if(n.version+=1,n.running){n.rerun=!0;return}n.running=!0,this.runLoop(e,t)}getState(e){let t=this.states.get(e);return t||(t={running:!1,rerun:!1,version:0},this.states.set(e,t)),t}async runLoop(e,t){let n=this.getState(e);try{do{n.rerun=!1;let i=n.version;await t({isCurrent:()=>{var a;return((a=this.states.get(e))==null?void 0:a.version)===i}})}while(n.rerun)}finally{n.running=!1,n.rerun&&(n.running=!0,this.runLoop(e,t))}}}});function JPe(r){return!!(r!=null&&r.closest(".canvas-node-content"))}function e0e(r){if(!r||typeof r!="object")return!1;let e=r;return"parent"in e&&e.parent==null}function m3(r){return!!(r!=null&&r.closest(adt))}function RO(r,e=sdt){if(JPe(r.dom))return!1;if(m3(r.dom))return!0;try{let t=r.state.field(XPe.editorInfoField,!1);return e0e(t==null?void 0:t.leaf)?!0:JPe(t==null?void 0:t.containerEl)?!1:m3(t==null?void 0:t.containerEl)}catch(t){return e.debug("Error checking markdown widget editor context",{category:"provider",operation:"check-editor-context",error:t}),!1}}function OO(r){var t;if(e0e(r))return!0;let e=(t=r.view)==null?void 0:t.containerEl;return m3(e)}var XPe,adt,sdt,f3=y(()=>{XPe=require("obsidian");G();adt=[".blp-inline-edit-root",".internal-embed.markdown-embed",".markdown-embed",".popover.hover-popover"].join(", "),sdt=I({tag:"MarkdownWidgetContext"})});function odt(r,e){let t=e;for(;t!=null&&t.parentElement&&t.parentElement!==r;)t=t.parentElement;return(t==null?void 0:t.parentElement)===r?t:null}function ldt(r){for(let e=0;e{});function i0e(r){return Array.from(r.children).filter(e=>e.instanceOf(HTMLElement))}function pdt(r,e){var s;let t=r.settings.projectAutosuggest;if(!t)return!1;let n=(s=t.requiredTags)!=null?s:[];if(n.some(o=>!o.trim().startsWith("-"))&&yr.matchesTagConditions(Sv(e),n))return!0;let a=kv(t);return a.enabled&&wv(e==null?void 0:e.frontmatter,a)}function FO(r,e,t){var n;return!!((n=r.dependencyCache)!=null&&n.isFileUsedAsProject(e.path)||pdt(r,t))}function mdt(r){var n;let e=r.querySelector(".cm-content");if(e)return(n=e.closest(".cm-contentContainer"))!=null?n:e;let t=i0e(r).filter(i=>!i.classList.contains(TD)&&!i.classList.contains("embedded-backlinks")&&!i.classList.contains("markdown-preview-pusher")&&!i.classList.contains("mod-footer"));return t.length>0?t[t.length-1]:null}function t0e(r){let e=Number.parseFloat(r);return Number.isFinite(e)?e:null}function fdt(r){var a;let t=((a=r.ownerDocument.defaultView)!=null?a:window).getComputedStyle(r),n=t0e(t.marginTop);if(n!==null)return n;let i=t0e(t.fontSize);return i!==null?i*1.5:24}function r0e(r){let e=r.getBoundingClientRect();return e.width<=0&&e.height<=0?null:e.bottom}function hdt(r){let e=r0e(r);return r.querySelectorAll("*").forEach(t=>{let n=r0e(t);n!==null&&(e===null||n>e)&&(e=n)}),e}function gdt(r){let e=null;for(let t of r){let n=hdt(t);n!==null&&(e===null||n>e)&&(e=n)}return e}function a0e(r,e){e.style.removeProperty("--tn-relationships-widget-margin-top");let t=r.querySelector(".cm-content");if(!t)return;let n=i0e(t).filter(o=>o.classList.contains("cm-line")),i=gdt(n),a=t.closest(".cm-contentContainer");if(i===null||!a)return;let s=Math.max(0,Math.round(a.getBoundingClientRect().bottom-i));if(s>0){let o=fdt(e),l=Math.round(o-s);e.style.setProperty("--tn-relationships-widget-margin-top",`${l}px`)}}function s0e(r,e){let t=mdt(r);t?LO(t,e):r.appendChild(e),a0e(r,e)}async function o0e(r,e){let t=activeDocument.createElement("div");t.className=`tasknotes-plugin ${TD}`,t.setAttribute("contenteditable","false"),t.setAttribute("spellcheck","false"),t.setAttribute("data-widget-type","relationships");let n=activeDocument.createElement("div");n.className="relationships__bases-container",t.appendChild(n);let i=new qo.Component;i.load(),t.component=i;try{let a=r.settings.commandFileMapping.relationships;if(!a){let o=activeDocument.createElement("div");return o.className="relationships__error",o.textContent="Relationships view not configured",n.appendChild(o),t}let s=`![[${a}]]`;await qo.MarkdownRenderer.render(r.app,s,n,e,i)}catch(a){ad.error("[TaskNotes] Error rendering Bases view in relationships widget:",{category:"internal",operation:"rendering-bases-view-relationships-widget",error:a});let s=activeDocument.createElement("div");s.className="relationships__error",s.textContent="Failed to load relationships view",n.appendChild(s)}return t}function l0e(r){return n0e.ViewPlugin.fromClass(class extends g3{constructor(e){super(e,r)}destroy(){super.destroy()}})}async function ydt(r,e,t){var l;let n=r.view;if(!(n instanceof qo.MarkdownView)||n.getMode()!=="preview"||OO(r))return;let i=n.file;if(!i||!e.settings.showRelationships)return;let a=!1,s=!1,o=e.app.metadataCache.getFileCache(i);if(o!=null&&o.frontmatter&&(a=e.cacheManager.isTaskFile(o.frontmatter)),s=FO(e,i,o),!a&&!s){try{n.previewMode.containerEl.querySelectorAll(`.${TD}`).forEach(u=>{var m;(m=u.component)==null||m.unload(),u.remove()})}catch(c){ad.debug("[TaskNotes] Error cleaning up relationships widget in reading mode:",{category:"persistence",operation:"cleaning-up-relationships-widget-reading-mode",error:c})}return}try{let d=n.previewMode.containerEl;d.querySelectorAll(`.${TD}`).forEach(h=>{var v;(v=h.component)==null||v.unload(),h.remove()});let u=e.settings.relationshipsPosition||"bottom",p=i.path,m=await o0e(e,p);if(t&&!t.isCurrent()){(l=m.component)==null||l.unload(),m.remove();return}let f=d.querySelector(".markdown-preview-sizer");if(!f){ad.warn("[TaskNotes] Could not find .markdown-preview-sizer for relationships in reading mode",{category:"stale-data",operation:"find-markdown-preview-sizer-relationships-reading-mode"});return}if(u==="top"){let h=f.querySelector(".tasknotes-task-card-note-widget");h?LO(h,m):wg(f,m)}else s0e(f,m)}catch(c){ad.error("[TaskNotes] Error injecting relationships widget in reading mode:",{category:"persistence",operation:"injecting-relationships-widget-reading-mode",error:c})}}function c0e(r){var f;let e=[],t=[],n=[],i=new AT,a=h=>{i.schedule(h,g=>ydt(h,r,g))},s=null,o=()=>{s&&window.clearTimeout(s),s=window.setTimeout(()=>{r.app.workspace.getLeavesOfType("markdown").forEach(g=>{a(g)})},100)},l=r.app.workspace.on("layout-change",o);e.push(l);let c=r.app.workspace.on("active-leaf-change",h=>{h&&a(h)});e.push(c);let d=new Map,u=r.app.metadataCache.on("changed",h=>{let g=d.get(h.path);g&&window.clearTimeout(g);let v=window.setTimeout(()=>{d.delete(h.path),r.app.workspace.getLeavesOfType("markdown").forEach(b=>{let w=b.view;w instanceof qo.MarkdownView&&w.file===h&&a(b)})},500);d.set(h.path,v)});t.push(u);let p=(f=r.dependencyCache)==null?void 0:f.on(om,o);return p&&n.push(p),r.app.workspace.getLeavesOfType("markdown").forEach(h=>{a(h)}),()=>{s&&window.clearTimeout(s),e.forEach(h=>r.app.workspace.offref(h)),t.forEach(h=>r.app.metadataCache.offref(h)),n.forEach(h=>{var g;return(g=r.dependencyCache)==null?void 0:g.offref(h)})}}var n0e,qo,ad,TD,udt,g3,d0e=y(()=>{n0e=require("@codemirror/view"),qo=require("obsidian");qV();p3();f3();h3();cu();W_();q_();G();ad=I({tag:"Editor/RelationshipsDecorations"}),TD="tasknotes-relationships-widget",udt="task-card-injected";g3=class{constructor(e,t){this.plugin=t;this.currentFile=null;this.currentWidget=null;this.widgetContainer=null;this.debounceTimer=null;this.eventListeners=[];this.dependencyCacheEventListeners=[];this.injectionRunId=0;this.bottomOffsetFrame=null;this.view=e,this.currentFile=this.getFileFromView(e),this.setupEventListeners(),this.debouncedInjectWidget(e)}update(e){this.view=e.view;let t=this.getFileFromView(e.view);t!==this.currentFile?(this.currentFile=t,this.debouncedInjectWidget(e.view)):(e.docChanged||e.geometryChanged||e.viewportChanged)&&this.scheduleBottomOffsetRefresh()}destroy(){this.injectionRunId++,this.debounceTimer&&(window.clearTimeout(this.debounceTimer),this.debounceTimer=null),this.bottomOffsetFrame!==null&&(window.cancelAnimationFrame(this.bottomOffsetFrame),this.bottomOffsetFrame=null),this.removeWidget(),this.eventListeners.forEach(e=>{this.plugin.emitter.offref(e)}),this.eventListeners=[],this.dependencyCacheEventListeners.forEach(e=>{var t;(t=this.plugin.dependencyCache)==null||t.offref(e)}),this.dependencyCacheEventListeners=[]}setupEventListeners(){var i;let e=this.plugin.emitter.on(udt,()=>{this.debouncedInjectWidget(this.view)});this.eventListeners.push(e);let t=this.plugin.emitter.on("settings-changed",()=>{this.debouncedInjectWidget(this.view)});this.eventListeners.push(t);let n=(i=this.plugin.dependencyCache)==null?void 0:i.on(om,()=>{this.debouncedInjectWidget(this.view)});n&&this.dependencyCacheEventListeners.push(n)}debouncedInjectWidget(e){this.debounceTimer&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{this.debounceTimer=null,this.injectWidget(e)},100)}scheduleBottomOffsetRefresh(){!this.currentWidget||!this.widgetContainer||(this.plugin.settings.relationshipsPosition||"bottom")!=="bottom"||(this.bottomOffsetFrame!==null&&window.cancelAnimationFrame(this.bottomOffsetFrame),this.bottomOffsetFrame=window.requestAnimationFrame(()=>{var e,t;this.bottomOffsetFrame=null,(e=this.currentWidget)!=null&&e.isConnected&&((t=this.widgetContainer)!=null&&t.isConnected)&&a0e(this.widgetContainer,this.currentWidget)}))}getFileFromView(e){try{let t=e.state.field(qo.editorInfoField,!1);return(t==null?void 0:t.file)||null}catch(t){return ad.debug("[TaskNotes] Error getting file from editor view:",{category:"persistence",operation:"getting-file-editor-view",error:t}),null}}isTableCellEditor(e){try{let t=e.dom;if(!t)return!1;if(RO(e)||t.closest("td, th")||t.closest(".cm-table-widget")||t.closest(".popover.hover-popover")||t.closest(".markdown-embed[data-type='footnote']"))return!0;let o=e.state.field(qo.editorInfoField,!1);if(!(o!=null&&o.file)){let l=t.parentElement,c=0,d=20;for(;l&&l!==activeDocument.body&&c{var a;(a=n.component)==null||a.unload(),n.remove()}),this.currentWidget=null,this.widgetContainer=null}catch(t){ad.error("[TaskNotes] Error cleaning up orphaned relationships widgets:",{category:"stale-data",operation:"cleaning-up-orphaned-relationships-widgets",error:t})}}async injectWidget(e){var n,i;let t=++this.injectionRunId;if(this.removeWidget(),!this.isTableCellEditor(e)){this.cleanupOrphanedWidgets(e);try{if(!this.plugin.settings.showRelationships)return;let a=this.currentFile||this.getFileFromView(e);if(!(a instanceof qo.TFile))return;let s=!1,o=!1,l=this.plugin.app.metadataCache.getFileCache(a);if(l!=null&&l.frontmatter?(s=this.plugin.cacheManager.isTaskFile(l.frontmatter),o=FO(this.plugin,a,l)):o=FO(this.plugin,a,l),!s&&!o)return;let c=a.path,d=this.plugin.settings.relationshipsPosition||"bottom",u=(n=e.dom.closest(".markdown-source-view"))==null?void 0:n.querySelector(".cm-sizer");if(!u){ad.warn("[TaskNotes] Could not find .cm-sizer container for relationships widget",{category:"stale-data",operation:"find-cm-sizer-container-relationships-widget"});return}let p=await o0e(this.plugin,c);if(t!==this.injectionRunId){(i=p.component)==null||i.unload(),p.remove();return}if(this.cleanupOrphanedWidgets(e),this.currentWidget=p,this.widgetContainer=u,d==="top"){let m=u.querySelector(".tasknotes-task-card-note-widget");m?LO(m,p):wg(u,p)}else s0e(u,p),this.scheduleBottomOffsetRefresh()}catch(a){ad.error("[TaskNotes] Error injecting relationships widget:",{category:"internal",operation:"injecting-relationships-widget",error:a}),this.removeWidget()}}}}});function b3(r,e){let t=activeDocument.createElement("div");t.className=`tasknotes-plugin task-card-note-widget ${kD}`,t.setAttribute("contenteditable","false"),t.setAttribute("spellcheck","false"),t.setAttribute("data-widget-type","task-card"),t.setAttribute("data-task-path",e.path);let n=new Hl.Component;n.load(),t.component=n;let i=r.settings.defaultVisibleProperties?Ra(r.settings.defaultVisibleProperties,r):void 0,a=Sr(e,r,i);return a.classList.add("task-card-note-widget__card"),t.appendChild(a),t}function y3(r){r.querySelectorAll(`.${kD}`).forEach(e=>{var n;(n=e.component)==null||n.unload(),e.remove()})}function p0e(r){return r.querySelector(".markdown-preview-sizer")}function bdt(r){let e=r,t=r.ownerDocument.defaultView;for(;e;){let n=t==null?void 0:t.getComputedStyle(e);if(e.style.display==="none"||(n==null?void 0:n.display)==="none"||(n==null?void 0:n.visibility)==="hidden")return!0;e=e.parentElement}return!1}function m0e(r,e){if(r.isEditing||e.querySelector(".markdown-source-view, .cm-editor"))return!0;let t=p0e(e);return!!(t&&bdt(t))}function Tdt(r,e){let t=Array.from(e.querySelectorAll(`.${kD}`));if(t.length===0)return!0;let n=t.some(a=>a.parentElement===e),i=t.some(a=>!!a.closest(".markdown-preview-sizer"));return m0e(r,e)?!n:n||!i}function kdt(r){var i;let e=(i=r.view)==null?void 0:i.canvas,t=e==null?void 0:e.nodes,n=t==null?void 0:t.values;return typeof n!="function"?[]:Array.from(n.call(t))}function wdt(r){return typeof r.filePath=="string"&&r.filePath.trim()?r.filePath:typeof r.file=="string"&&r.file.trim()?r.file:r.file instanceof Hl.TFile?r.file.path:null}function f0e(r){return u0e.ViewPlugin.fromClass(class extends v3{constructor(e){super(e,r)}destroy(){super.destroy()}})}async function Sdt(r,e,t){var s;let n=r.view;if(!(n instanceof Hl.MarkdownView)||n.getMode()!=="preview"||OO(r))return;let i=n.file;if(!i||!e.settings.showTaskCardInNote)return;let a=e.cacheManager.getCachedTaskInfoSync(i.path);if(!a){try{let l=n.previewMode.containerEl;y3(l)}catch(o){sd.debug("[TaskNotes] Error cleaning up task card in reading mode:",{category:"persistence",operation:"cleaning-up-task-card-reading-mode",error:o})}return}try{let l=n.previewMode.containerEl;y3(l);let c=b3(e,a);if(t&&!t.isCurrent()){(s=c.component)==null||s.unload(),c.remove();return}let d=l.querySelector(".markdown-preview-sizer");if(!d){sd.warn("[TaskNotes] Could not find .markdown-preview-sizer for task card in reading mode",{category:"stale-data",operation:"find-markdown-preview-sizer-task-card-reading-mode"});return}wg(d,c)}catch(o){sd.error("[TaskNotes] Error injecting task card widget in reading mode:",{category:"persistence",operation:"injecting-task-card-widget-reading-mode",error:o})}}function h0e(r,e={}){if(r.settings.showTaskCardInNote)for(let t of r.app.workspace.getLeavesOfType("canvas"))for(let n of kdt(t)){let i=wdt(n),a=n.contentEl;if(!i||!a)continue;let s=m0e(n,a),o=a.querySelector(".markdown-source-view, .cm-editor");if(o!=null&&o.querySelector(`.${kD}`))continue;let l=p0e(a);if(!s&&!l||!e.force&&!Tdt(n,a))continue;let c=r.cacheManager.getCachedTaskInfoSync(i);if(y3(a),!c)continue;let d=b3(r,c);s?a.insertBefore(d,a.firstChild):l&&wg(l,d)}}function g0e(r){let e=[],t=[],n=[],i=[],a=[],s=new WeakSet,o=new AT,l=S=>{o.schedule(S,x=>Sdt(S,r,x))},c=null,d=null,u=(S={})=>{d&&window.clearTimeout(d),d=window.setTimeout(()=>{h0e(r,S),d=null},100)},p=()=>{for(let S of r.app.workspace.getLeavesOfType("canvas")){let x=S.view.containerEl;if(!x||s.has(x))continue;let C=new MutationObserver(()=>{u()});C.observe(x,{attributes:!0,attributeFilter:["class","style"],childList:!0,subtree:!0});let D=()=>{u({force:!0})};x.addEventListener("pointerdown",D,!0),x.addEventListener("focusin",D,!0),a.push(()=>{x.removeEventListener("pointerdown",D,!0),x.removeEventListener("focusin",D,!0)}),s.add(x),i.push(C)}},m=()=>{c&&window.clearTimeout(c),c=window.setTimeout(()=>{r.app.workspace.getLeavesOfType("markdown").forEach(x=>{l(x)}),p(),u({force:!0})},100)},f=r.app.workspace.on("layout-change",m);e.push(f);let h=r.app.workspace.on("active-leaf-change",S=>{S&&(l(S),p(),u())});e.push(h);let g=new Map,v=r.app.metadataCache.on("changed",S=>{let x=g.get(S.path);x&&window.clearTimeout(x);let C=window.setTimeout(()=>{g.delete(S.path),r.app.workspace.getLeavesOfType("markdown").forEach(_=>{let O=_.view;O instanceof Hl.MarkdownView&&O.file===S&&l(_)}),u({force:!0})},500);g.set(S.path,C)});t.push(v);let k=r.emitter.on(nt,m);n.push(k);let b=r.emitter.on(ea,m);return n.push(b),r.app.workspace.getLeavesOfType("markdown").forEach(S=>{l(S)}),p(),u({force:!0}),()=>{c&&window.clearTimeout(c),d&&window.clearTimeout(d),i.forEach(S=>S.disconnect()),a.forEach(S=>S()),e.forEach(S=>r.app.workspace.offref(S)),t.forEach(S=>r.app.metadataCache.offref(S)),n.forEach(S=>r.emitter.offref(S))}}var u0e,Hl,sd,kD,vdt,v3,y0e=y(()=>{u0e=require("@codemirror/view");Ur();Hl=require("obsidian");la();xc();p3();f3();h3();G();sd=I({tag:"Editor/TaskCardNoteDecorations"}),kD="tasknotes-task-card-note-widget",vdt="task-card-injected";v3=class{constructor(e,t){this.plugin=t;this.cachedTask=null;this.currentFile=null;this.eventListeners=[];this.currentWidget=null;this.widgetContainer=null;this.debounceTimer=null;this.view=e,this.currentFile=this.getFileFromView(e),this.setupEventListeners(),this.loadTaskForCurrentFile(e)}update(e){this.view=e.view;let t=this.getFileFromView(e.view);t!==this.currentFile&&(this.currentFile=t,this.loadTaskForCurrentFile(e.view))}destroy(){this.debounceTimer&&(window.clearTimeout(this.debounceTimer),this.debounceTimer=null),this.removeWidget(),this.eventListeners.forEach(e=>{this.plugin.emitter.offref(e)}),this.eventListeners=[]}setupEventListeners(){let e=()=>{this.debounceTimer&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{this.loadTaskForCurrentFile(this.view)},100)},t=this.plugin.emitter.on(ea,e),n=this.plugin.emitter.on(nt,e),i=this.plugin.emitter.on(Ja,e),a=this.plugin.emitter.on(xp,e),s=this.plugin.emitter.on("settings-changed",e);this.eventListeners.push(t,n,i,a,s)}removeWidget(){var e;this.currentWidget&&((e=this.currentWidget.component)==null||e.unload(),this.currentWidget.remove(),this.currentWidget=null),this.widgetContainer=null}cleanupOrphanedWidgets(e){var t;try{let n=(t=e.dom.closest(".canvas-node-content"))!=null?t:e.dom.closest(".workspace-leaf-content");if(!n){sd.debug("[TaskNotes] Could not find workspace-leaf-content for orphan cleanup",{category:"stale-data",operation:"find-workspace-leaf-content-orphan-cleanup"});return}n.querySelectorAll(`.${kD}`).forEach(i=>{var a;i!==this.currentWidget&&((a=i.component)==null||a.unload(),i.remove())})}catch(n){sd.error("[TaskNotes] Error cleaning up orphaned task card widgets:",{category:"stale-data",operation:"cleaning-up-orphaned-task-card-widgets",error:n})}}loadTaskForCurrentFile(e){var n,i,a,s,o,l,c,d,u,p,m,f,h;let t=this.getFileFromView(e);if(t instanceof Hl.TFile)try{let g=this.plugin.cacheManager.getCachedTaskInfoSync(t.path),v=b=>!(b!=null&&b.timeEntries)||b.timeEntries.length===0?!1:!b.timeEntries[b.timeEntries.length-1].endTime;(((n=this.cachedTask)==null?void 0:n.title)!==(g==null?void 0:g.title)||((i=this.cachedTask)==null?void 0:i.status)!==(g==null?void 0:g.status)||((a=this.cachedTask)==null?void 0:a.priority)!==(g==null?void 0:g.priority)||((s=this.cachedTask)==null?void 0:s.due)!==(g==null?void 0:g.due)||((o=this.cachedTask)==null?void 0:o.scheduled)!==(g==null?void 0:g.scheduled)||((l=this.cachedTask)==null?void 0:l.path)!==(g==null?void 0:g.path)||((c=this.cachedTask)==null?void 0:c.archived)!==(g==null?void 0:g.archived)||((d=this.cachedTask)==null?void 0:d.timeEstimate)!==(g==null?void 0:g.timeEstimate)||((u=this.cachedTask)==null?void 0:u.recurrence)!==(g==null?void 0:g.recurrence)||v(this.cachedTask)!==v(g)||JSON.stringify(((p=this.cachedTask)==null?void 0:p.tags)||[])!==JSON.stringify((g==null?void 0:g.tags)||[])||JSON.stringify(((m=this.cachedTask)==null?void 0:m.contexts)||[])!==JSON.stringify((g==null?void 0:g.contexts)||[])||JSON.stringify(((f=this.cachedTask)==null?void 0:f.projects)||[])!==JSON.stringify((g==null?void 0:g.projects)||[])||JSON.stringify(((h=this.cachedTask)==null?void 0:h.complete_instances)||[])!==JSON.stringify((g==null?void 0:g.complete_instances)||[]))&&(this.cachedTask=g,this.injectWidget(e))}catch(g){sd.error("[TaskNotes] Error loading task for task note:",{category:"persistence",operation:"loading-task-task-note",error:g})}else this.cachedTask!==null&&(this.cachedTask=null,this.injectWidget(e))}getFileFromView(e){try{let t=e.state.field(Hl.editorInfoField,!1);return(t==null?void 0:t.file)||null}catch(t){return sd.debug("[TaskNotes] Error getting file from editor view:",{category:"persistence",operation:"getting-file-editor-view",error:t}),null}}isTableCellEditor(e){try{let t=e.dom;if(!t)return!1;if(RO(e)||t.closest("td, th")||t.closest(".cm-table-widget")||t.closest(".popover.hover-popover")||t.closest(".markdown-embed[data-type='footnote']"))return!0;let o=e.state.field(Hl.editorInfoField,!1);if(!(o!=null&&o.file)){let l=t.parentElement,c=0,d=20;for(;l&&l!==activeDocument.body&&c{h0e(this.plugin,{force:!0})},0);return}this.cleanupOrphanedWidgets(e);try{if(!this.plugin.settings.showTaskCardInNote||!this.cachedTask)return;let n=(t=e.dom.closest(".markdown-source-view"))==null?void 0:t.querySelector(".cm-sizer");if(!n){sd.warn("[TaskNotes] Could not find .cm-sizer container for task card widget",{category:"stale-data",operation:"find-cm-sizer-container-task-card-widget"});return}let i=b3(this.plugin,this.cachedTask);this.currentWidget=i,this.widgetContainer=n,wg(n,i),this.plugin.emitter.trigger(vdt,{container:n})}catch(n){sd.error("[TaskNotes] Error injecting task card widget:",{category:"persistence",operation:"injecting-task-card-widget",error:n}),this.removeWidget()}}}});function Edt(r){try{return decodeURIComponent(r)}catch(e){return r}}function wD(r){let e=Edt(r).trim();if(!e)return"";if(e.startsWith("app://"))try{e=new URL(e).pathname}catch(t){}return e=e.replace(/^\/+/,""),e=e.split("#")[0].trim(),e.endsWith(".md")&&(e=e.slice(0,-3)),e}function v0e(r){var n;let e=wD(r),t=e.split("/");return(n=t[t.length-1])!=null?n:e}function xdt(r,e){let t=wD(r),n=wD(e);return!t||!n?!1:t===n?!0:v0e(t)===v0e(n)}function Cdt(r){let e=[],t=/!?\[\[([^\]]+)\]\]/g,n;for(;(n=t.exec(r))!==null;){if(n[0].startsWith("!"))continue;let i=n[1].trim();if(!i)continue;let a=i.indexOf("|"),s=a===-1?i:i.slice(0,a),o=wD(s);o&&e.push({target:o,hasAlias:a!==-1})}return e}function Ddt(r,e,t){let n=wD(t);if(!n)return null;let i=()=>{for(let s=e.index;s0?(e.index=0,i()):null)}function Pdt(r,e){return`${r}\0${e}`}function Mdt(){return{index:0}}function Adt(r){if(!r.disableOverlayOnAlias)return!1;if(r.hasExplicitAlias)return!0;let e=r.linkText.trim();return c3(e,r.taskPath,r.originalLinkPath)?!1:e!==r.originalLinkPath&&e!==r.taskTitle}function Idt(r,e){var t,n,i;try{return(i=(n=(t=r.getSectionInfo)==null?void 0:t.call(r,e))==null?void 0:n.text)!=null?i:""}catch(a){return""}}function b0e(r){return new T3(r).createPostProcessor()}var $O,_dt,T3,T0e=y(()=>{Ur();u3();G();MO();$O=I({tag:"Editor/ReadingModeTaskLinkProcessor"});_dt=".task-inline-preview--reading-mode[data-task-path]";T3=class{constructor(e){this.sourceLinkCursors=new Map;this.refreshTimer=null;this.pendingRefreshAll=!1;this.pendingRefreshTaskPaths=new Set;this.plugin=e,this.setupEventListeners()}createPostProcessor(){return(e,t)=>{var l,c,d;if(!this.plugin.settings.enableTaskLinkOverlay)return;let n=e.querySelectorAll("a"),i=Idt(t,e),a=Cdt(i),s=Pdt(t.sourcePath,i),o=(l=this.sourceLinkCursors.get(s))!=null?l:Mdt();this.sourceLinkCursors.set(s,o);for(let u of Array.from(n)){let p=u,m=p.getAttribute("href"),f=p.getAttribute("data-href")||m||"",h=a.length>0?Ddt(a,o,f):null;p.classList.contains("internal-link")?this.processLink(p,t.sourcePath,"internal",(c=h==null?void 0:h.hasAlias)!=null?c:!1):m&&!m.startsWith("http://")&&!m.startsWith("https://")&&!m.includes("://")&&this.processLink(p,t.sourcePath,"external",(d=h==null?void 0:h.hasAlias)!=null?d:!1)}}}async processLink(e,t,n,i){try{let a=e.getAttribute("href");if(!a)return;let s=a;if(n==="internal"){if(a.startsWith("app://")){let c=new URL(a);s=decodeURIComponent(c.pathname),s.startsWith("/")&&(s=s.substring(1))}}else{if(a.startsWith("http://")||a.startsWith("https://")||a.includes("://"))return;s=a}let o=this.resolveLinkPath(s,t);if(!o)return;let l=this.getTaskInfo(o);if(!l)return;await this.replaceWithTaskWidget(e,l,s,i)}catch(a){$O.debug("Error processing link in reading mode:",{category:"persistence",operation:"processing-link-reading-mode",error:a})}}setupEventListeners(){this.plugin.registerEvent(this.plugin.emitter.on(nt,e=>{var t,n,i,a;this.scheduleReadingModeWidgetRefresh((a=(n=e==null?void 0:e.path)!=null?n:(t=e==null?void 0:e.updatedTask)==null?void 0:t.path)!=null?a:(i=e==null?void 0:e.task)==null?void 0:i.path)})),this.plugin.registerEvent(this.plugin.emitter.on(Ja,e=>{this.scheduleReadingModeWidgetRefresh(e==null?void 0:e.path)})),this.plugin.registerEvent(this.plugin.emitter.on(ea,()=>{this.scheduleReadingModeWidgetRefresh()})),this.plugin.registerEvent(this.plugin.emitter.on(xp,()=>{this.scheduleReadingModeWidgetRefresh()})),this.plugin.registerEvent(this.plugin.emitter.on("settings-changed",()=>{this.scheduleReadingModeWidgetRefresh()})),this.plugin.register(()=>{this.refreshTimer!==null&&(window.clearTimeout(this.refreshTimer),this.refreshTimer=null)})}scheduleReadingModeWidgetRefresh(e){e?this.pendingRefreshAll||this.pendingRefreshTaskPaths.add(e):(this.pendingRefreshAll=!0,this.pendingRefreshTaskPaths.clear()),this.refreshTimer!==null&&window.clearTimeout(this.refreshTimer),this.refreshTimer=window.setTimeout(()=>{this.refreshTimer=null;let t=this.pendingRefreshAll?void 0:new Set(this.pendingRefreshTaskPaths);this.pendingRefreshAll=!1,this.pendingRefreshTaskPaths.clear(),this.refreshReadingModeWidgets(t)},100)}refreshReadingModeWidgets(e){let t=this.getReadingModeContainers();if(t.length!==0)for(let n of t){let i=Array.from(n.querySelectorAll(_dt));for(let a of i){let s=a.dataset.taskPath;if(!s||e&&!e.has(s))continue;if(!this.plugin.settings.enableTaskLinkOverlay){this.replaceWidgetWithOriginalLink(a);continue}let o=this.getTaskInfo(s);if(!o){this.replaceWidgetWithOriginalLink(a);continue}let l=a.dataset.originalLinkPath||o.path,c=a.dataset.originalText||o.title,d=a.dataset.displayText||void 0,u=new kg(o,this.plugin,c,d),p=this.createReadingModeWidget(u,o,l,c,d);a.replaceWith(p)}}}getReadingModeContainers(){var n,i,a,s,o;let e=(a=(i=(n=this.plugin.app.workspace).getLeavesOfType)==null?void 0:i.call(n,"markdown"))!=null?a:[],t=[];for(let l of e){let c=l.view;if(typeof c.getMode=="function"&&c.getMode()!=="preview")continue;let d=(o=(s=c.previewMode)==null?void 0:s.containerEl)!=null?o:c.containerEl;d&&t.push(d)}return t}replaceWidgetWithOriginalLink(e){let t=e.dataset.originalLinkPath;if(!t){e.remove();return}let n=activeDocument.createElement("a");n.className="internal-link",n.setAttribute("href",t),n.setAttribute("data-href",t),n.textContent=e.dataset.originalText||t,e.replaceWith(n)}resolveLinkPath(e,t){try{let n=this.plugin.app.metadataCache.getFirstLinkpathDest(e,t);return(n==null?void 0:n.path)||null}catch(n){return $O.debug("Error resolving link path:",{category:"persistence",operation:"resolving-link-path",details:{value:e},error:n}),null}}getTaskInfo(e){try{if(!e||typeof e!="string"||e.trim().length===0)return null;let t=this.plugin.cacheManager;if(!t||!t.getCachedTaskInfoSync)return null;let n=t.getCachedTaskInfoSync(e);return n&&typeof n=="object"&&n.title?n:null}catch(t){return $O.debug("Error getting task info for:",{category:"persistence",operation:"getting-task-info",details:{value:e},error:t}),null}}async replaceWithTaskWidget(e,t,n,i){var a;try{let s=e.textContent||`[[${n}]]`;if(Adt({disableOverlayOnAlias:this.plugin.settings.disableOverlayOnAlias,hasExplicitAlias:i,linkText:e.textContent||"",originalLinkPath:n,taskPath:t.path,taskTitle:t.title}))return;let o,l=e.textContent||"";i?o=l.trim()||void 0:l!==n&&l!==t.title&&(o=_T(l,t.path,n));let c=new kg(t,this.plugin,s,o),d=this.createReadingModeWidget(c,t,n,s,o);(a=e.parentNode)==null||a.replaceChild(d,e)}catch(s){$O.error("Error replacing wikilink with task widget:",{category:"persistence",operation:"replacing-wikilink-task-widget",error:s})}}createReadingModeWidget(e,t,n,i,a){let s={},o=e.toDOM(s);return o.classList.add("task-inline-preview--reading-mode"),o.dataset.taskPath=t.path,o.dataset.originalLinkPath=n,o.dataset.originalText=i,a&&(o.dataset.displayText=a),o}}});function Odt(r,e,t){let n;switch(r){case"P":e&&e==="-"?t.isNegative=!0:t.isNegative=!1;break;case"D":n="days";break;case"W":n="weeks";break;case"H":n="hours";break;case"M":n="minutes";break;case"S":n="seconds";break;default:return 0}if(n){if(!e&&e!==0)throw new Error('invalid duration value: Missing number before "'+r+'"');let i=parseInt(e,10);if(xD(i))throw new Error('invalid duration value: Invalid number "'+e+'" before "'+r+'"');t[n]=i}return 1}function Tr(r){let e={},t=e.component=[];if(e.stack=[t],Tr._eachLine(r,function(n,i){Tr._handleContentLine(i,e)}),e.stack.length>1)throw new Hu("invalid ical body. component began but did not end");return e=null,t.length==1?t[0]:t}function Udt(r){let e,t,n,i,a;if(!r||r.name!=="vcalendar")return r;for(e=r.getAllSubcomponents(),t=[],n={},a=0;a0&&r[t-1]==="\\")t+=1;else return t;return-1}function Eg(r,e,t){if(!r.length)return 0;let n=0,i=r.length-1,a,s;for(;n<=i;)if(a=n+Math.floor((i-n)/2),s=t(e,r[a]),s<0)i=a-1;else if(s>0)n=a+1;else break;return s<0?a:s>0?a+1:a}function Cg(r,e){if(!r||typeof r!="object")return r;if(r instanceof Date)return new Date(r.getTime());if("clone"in r)return r.clone();if(Array.isArray(r)){let t=[];for(let n=0;n65535?2:1:(e+=oo.newLineChar+" "+t.slice(0,Math.max(0,n)),t=t.slice(Math.max(0,n)),n=i=0)}return e.slice(oo.newLineChar.length+1)}function gs(r){switch(typeof r!="string"&&(typeof r=="number"&&(r=parseInt(r)),r=String(r)),r.length){case 0:return"00";case 1:return"0"+r;default:return r}}function Pi(r){return r<0?Math.ceil(r):Math.floor(r)}function Dg(r,e){for(let t in r){let n=Object.getOwnPropertyDescriptor(r,t);n&&!Object.getOwnPropertyDescriptor(e,t)&&Object.defineProperty(e,t,n)}return e}function Lm(r,e,t,n){let i=n;if(n[0]==="+"&&(i=n.slice(1)),i=ma(i),e!==void 0&&n '+e);if(t!==void 0&&n>t)throw new Error(r+': invalid value "'+n+'" must be < '+e);return i}function E3(r,e){return{matches:/.*/,fromICAL:function(n,i){return Zdt(n,r,i)},toICAL:function(n,i){let a=e;return i&&(a=new RegExp(a.source+"|"+i,a.flags)),n.replace(a,function(s){switch(s){case"\\":return"\\\\";case";":return"\\;";case",":return"\\,";case` +`:return"\\n";default:return s}})}}}function Kdt(r){switch(r){case"\\\\":return"\\";case"\\;":return";";case"\\,":return",";case"\\n":case"\\N":return` +`;default:return r}}function Zdt(r,e,t){return r.indexOf("\\")===-1?r:(t&&(e=new RegExp(e.source+"|\\\\"+t,e.flags)),r.replace(e,Kdt))}function wn(r){typeof r[0]=="string"&&(r=[r]);let e=0,t=r.length,n="";for(;ee[0]?1:e[0]>r[0]?-1:0}var qO,Ndt,Rdt,so,ED,NT,be,_e,Ldt,WO,S3,Fdt,$dt,zdt,jdt,Hu,Bdt,RT,OT,sr,Cr,za,YO,Hdt,Uu,Sg,hs,CD,IT,Vdt,qdt,R0e,Wdt,k0e,Vl,k3,w3,Ydt,Gdt,w0e,S0e,or,DD,GO,zO,jO,BO,fs,E0e,x0e,C0e,C3,D3,Qdt,ei,Jdt,ao,Xdt,eut,tut,rut,nut,ju,D0e,P0e,Dr,VO,M0e,iut,_0e,UO,HO,Fm,xg,$m,od,zm,aut,sut,Wo,KO,SD,ZO,x3,oo,O0e=y(()=>{qO=class r{constructor(e){A(this,"icaltype","binary");this.value=e}static fromString(e){return new r(e)}decodeValue(){return this._b64_decode(this.value)}setEncodedValue(e){this.value=this._b64_encode(e)}_b64_encode(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n,i,a,s,o,l,c,d,u=0,p=0,m="",f=[];if(!e)return e;do n=e.charCodeAt(u++),i=e.charCodeAt(u++),a=e.charCodeAt(u++),d=n<<16|i<<8|a,s=d>>18&63,o=d>>12&63,l=d>>6&63,c=d&63,f[p++]=t.charAt(s)+t.charAt(o)+t.charAt(l)+t.charAt(c);while(u>16&255,i=d>>8&255,a=d&255,l==64?f[p++]=String.fromCharCode(n):c==64?f[p++]=String.fromCharCode(n,i):f[p++]=String.fromCharCode(n,i,a);while(un)-(t0?-1:0}toString(){return this.start+"/"+(this.end||this.duration)}toJSON(){return[this.start.toString(),(this.end||this.duration).toString()]}toICALString(){return this.start.toICALString()+"/"+(this.end||this.duration).toICALString()}},be=class be{constructor(e,t){A(this,"icalclass","icaltime");A(this,"_cachedUnixTime",null);A(this,"zone",null);A(this,"_pendingNormalization",!1);this.wrappedJSObject=this,this._time=Object.create(null),this._time.year=0,this._time.month=1,this._time.day=1,this._time.hour=0,this._time.minute=0,this._time.second=0,this._time.isDate=!1,this.fromData(e,t)}static daysInMonth(e,t){let n=[0,31,28,31,30,31,30,31,31,30,31,30,31],i=30;return e<1||e>12||(i=n[e],e==2&&(i+=be.isLeapYear(t))),i}static isLeapYear(e){return e<=1752?e%4==0:e%4==0&&e%100!=0||e%400==0}static fromDayOfYear(e,t){let n=t,i=e,a=new be;a.auto_normalize=!1;let s=be.isLeapYear(n)?1:0;if(i<1)return n--,s=be.isLeapYear(n)?1:0,i+=be.daysInYearPassedMonth[s][12],be.fromDayOfYear(i,n);if(i>be.daysInYearPassedMonth[s][12])return s=be.isLeapYear(n)?1:0,i-=be.daysInYearPassedMonth[s][12],n++,be.fromDayOfYear(i,n);a.year=n,a.isDate=!0;for(let o=11;o>=0;o--)if(i>be.daysInYearPassedMonth[s][o]){a.month=o+1,a.day=i-be.daysInYearPassedMonth[s][o];break}return a.auto_normalize=!0,a}static fromStringv2(e){return new be({year:parseInt(e.slice(0,4),10),month:parseInt(e.slice(5,7),10),day:parseInt(e.slice(8,10),10),isDate:!0})}static fromDateString(e){return new be({year:ma(e.slice(0,4)),month:ma(e.slice(5,7)),day:ma(e.slice(8,10)),isDate:!0})}static fromDateTimeString(e,t){if(e.length<19)throw new Error('invalid date-time value: "'+e+'"');let n,i;e.slice(-1)==="Z"?n=Cr.utcTimezone:t&&(i=t.getParameter("tzid"),t.parent&&(t.parent.name==="standard"||t.parent.name==="daylight"?n=Cr.localTimezone:i&&(n=t.parent.getTimeZoneByID(i))));let a={year:ma(e.slice(0,4)),month:ma(e.slice(5,7)),day:ma(e.slice(8,10)),hour:ma(e.slice(11,13)),minute:ma(e.slice(14,16)),second:ma(e.slice(17,19))};return i&&!n&&(a.timezone=i),new be(a,n)}static fromString(e,t){return e.length>10?be.fromDateTimeString(e,t):be.fromDateString(e)}static fromJSDate(e,t){return new be().fromJSDate(e,t)}static now(){return be.fromJSDate(new Date,!1)}static weekOneStarts(e,t){let n=be.fromData({year:e,month:1,day:1,isDate:!0}),i=n.dayOfWeek(),a=t||be.DEFAULT_WEEK_START;return i>be.THURSDAY&&(n.day+=7),a>be.THURSDAY&&(n.day-=7),n.day-=i-a,n}static getDominicalLetter(e){let t="GFEDCBA",n=(e+(e/4|0)+(e/400|0)-(e/100|0)-1)%7;return be.isLeapYear(e)?t[(n+6)%7]+t[n]:t[n]}static get epochTime(){return ho(this,NT)||$d(this,NT,be.fromData({year:1970,month:1,day:1,hour:0,minute:0,second:0,isDate:!1,timezone:"Z"})),ho(this,NT)}static _cmp_attr(e,t,n){return e[n]>t[n]?1:e[n]=0){o.day=1,a!=0&&a--,s=o.day;let l=o.dayOfWeek(),c=e-l;c<0&&(c+=7),s+=c,s-=e,i=e}else{o.day=n;let l=o.dayOfWeek();a++,i=l-e,i<0&&(i+=7),i=n-i}return i+=a*7,s+i}isNthWeekDay(e,t){let n=this.dayOfWeek();return t===0&&n===e||this.nthWeekDay(e,t)===this.day}weekNumber(e){let t=(this.year<<12)+(this.month<<8)+(this.day<<3)+e;if(t in be._wnCache)return be._wnCache[t];let n,i=this.clone();i.isDate=!0;let a=this.year;i.month==12&&i.day>25?(n=be.weekOneStarts(a+1,e),i.compare(n)<0?n=be.weekOneStarts(a,e):a++):(n=be.weekOneStarts(a,e),i.compare(n)<0&&(n=be.weekOneStarts(--a,e)));let s=i.subtractDate(n).toSeconds()/86400,o=Pi(s/7)+1;return be._wnCache[t]=o,o}addDuration(e){let t=e.isNegative?-1:1,n=this.second,i=this.minute,a=this.hour,s=this.day;n+=t*e.seconds,i+=t*e.minutes,a+=t*e.hours,s+=t*e.days,s+=t*7*e.weeks,this.second=n,this.minute=i,this.hour=a,this.day=s,this._cachedUnixTime=null}subtractDate(e){let t=this.toUnixTime()+this.utcOffset(),n=e.toUnixTime()+e.utcOffset();return so.fromSeconds(t-n)}subtractDateTz(e){let t=this.toUnixTime(),n=e.toUnixTime();return so.fromSeconds(t-n)}compare(e){if(e instanceof ED)return-1*e.compare(this);{let t=this.toUnixTime(),n=e.toUnixTime();return t>n?1:n>t?-1:0}}compareDateOnlyTz(e,t){let n=this.convertToZone(t),i=e.convertToZone(t),a=0;return(a=be._cmp_attr(n,i,"year"))!=0||(a=be._cmp_attr(n,i,"month"))!=0||(a=be._cmp_attr(n,i,"day"))!=0,a}convertToZone(e){let t=this.clone(),n=this.zone.tzid==e.tzid;return!this.isDate&&!n&&Cr.convert_time(t,this.zone,e),t.zone=e,t}utcOffset(){return this.zone==Cr.localTimezone||this.zone==Cr.utcTimezone?0:this.zone.utcOffset(this)}toICALString(){let e=this.toString();return e.length>10?Dr.icalendar.value["date-time"].toICAL(e):Dr.icalendar.value.date.toICAL(e)}toString(){let e=this.year+"-"+gs(this.month)+"-"+gs(this.day);return this.isDate||(e+="T"+gs(this.hour)+":"+gs(this.minute)+":"+gs(this.second),this.zone===Cr.utcTimezone&&(e+="Z")),e}toJSDate(){return this.zone==Cr.localTimezone?this.isDate?new Date(this.year,this.month-1,this.day):new Date(this.year,this.month-1,this.day,this.hour,this.minute,this.second,0):new Date(this.toUnixTime()*1e3)}_normalize(){return this._time.isDate&&(this._time.hour=0,this._time.minute=0,this._time.second=0),this.adjust(0,0,0,0),this}adjust(e,t,n,i,a){let s,o,l=0,c=0,d,u,p,m,f,h=a||this._time;if(h.isDate||(d=h.second+i,h.second=d%60,s=Pi(d/60),h.second<0&&(h.second+=60,s--),u=h.minute+n+s,h.minute=u%60,o=Pi(u/60),h.minute<0&&(h.minute+=60,o--),p=h.hour+t+o,h.hour=p%24,l=Pi(p/24),h.hour<0&&(h.hour+=24,l--)),h.month>12?c=Pi((h.month-1)/12):h.month<1&&(c=Pi(h.month/12)-1),h.year+=c,h.month-=12*c,m=h.day+e+l,m>0)for(;f=be.daysInMonth(h.month,h.year),!(m<=f);)h.month++,h.month>12&&(h.year++,h.month=1),m-=f;else for(;m<=0;)h.month==1?(h.year--,h.month=12):h.month--,m+=be.daysInMonth(h.month,h.year);return h.day=m,this._cachedUnixTime=null,this}fromUnixTime(e){this.zone=Cr.utcTimezone;let t=new Date(e*1e3);this.year=t.getUTCFullYear(),this.month=t.getUTCMonth()+1,this.day=t.getUTCDate(),this._time.isDate?(this.hour=0,this.minute=0,this.second=0):(this.hour=t.getUTCHours(),this.minute=t.getUTCMinutes(),this.second=t.getUTCSeconds()),this._cachedUnixTime=null}toUnixTime(){if(this._cachedUnixTime!==null)return this._cachedUnixTime;let e=this.utcOffset(),t=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second-e);return this._cachedUnixTime=t/1e3,this._cachedUnixTime}toJSON(){let e=["year","month","day","hour","minute","second","isDate"],t=Object.create(null),n=0,i=e.length,a;for(;nt&&(n=-1);let c;if(n!==-1){if(s=r.slice(0,Math.max(0,n)).toLowerCase(),c=Tr._parseParameters(r.slice(Math.max(0,n)),0,e.designSet),c[2]==-1)throw new Hu("Invalid parameters in '"+r+"'");l=c[0];let v;if(typeof c[1]=="string"?v=c[1].length:v=c[1].reduce((k,b)=>k+b.length,0),i=v+c[2]+n,(a=r.slice(Math.max(0,i)).indexOf(WO))!==-1)o=r.slice(Math.max(0,i+a+1));else throw new Hu("Missing parameter value in '"+r+"'")}else if(t!==-1){if(s=r.slice(0,Math.max(0,t)).toLowerCase(),o=r.slice(Math.max(0,t+1)),s==="begin"){let v=[o.toLowerCase(),[],[]];e.stack.length===1?e.component.push(v):e.component[2].push(v),e.stack.push(e.component),e.component=v,e.designSet||(e.designSet=Dr.getDesignSet(e.component[0]));return}else if(s==="end"){e.component=e.stack.pop();return}}else throw new Hu('invalid line (no token ";" or ":") "'+r+'"');let d,u=!1,p=!1,m,f,h;e.designSet.propertyGroups&&s.indexOf(".")!==-1?(f=s.split("."),l.group=f[0],h=f[1]):h=s,h in e.designSet.property&&(m=e.designSet.property[h],"multiValue"in m&&(u=m.multiValue),"structuredValue"in m&&(p=m.structuredValue),o&&"detectType"in m&&(d=m.detectType(o))),d||("value"in l?d=l.value.toLowerCase():m?d=m.defaultType:d=$dt),delete l.value;let g;u&&p?(o=Tr._parseMultiValue(o,p,d,[],u,e.designSet,p),g=[h,l,d,o]):u?(g=[h,l,d],Tr._parseMultiValue(o,u,d,g,null,e.designSet,!1)):p?(o=Tr._parseMultiValue(o,p,d,[],null,e.designSet,p),g=[h,l,d,o]):(o=Tr._parseValue(o,d,e.designSet,!1),g=[h,l,d,o]),e.component[0]==="vcard"&&e.component[1].length===0&&!(s==="version"&&o==="4.0")&&(e.designSet=Dr.getDesignSet("vcard3")),e.component[1].push(g)};Tr._parseValue=function(r,e,t,n){return e in t.value&&"fromICAL"in t.value[e]?t.value[e].fromICAL(r,n):r};Tr._parseParameters=function(r,e,t){let n=e,i=0,a=Fdt,s={},o,l,c,d=-1,u,p,m;for(;i!==!1&&(i=r.indexOf(a,i+1))!==-1;){if(o=r.slice(n+1,i),o.length==0)throw new Hu("Empty parameter name in '"+r+"'");if(l=o.toLowerCase(),m=!1,p=!1,l in t.param&&t.param[l].valueType?u=t.param[l].valueType:u=zdt,l in t.param&&(p=t.param[l].multiValue,t.param[l].multiValueSeparateDQuote&&(m=Tr._rfc6868Escape('"'+p+'"'))),r[i+1]==='"'){if(d=i+2,i=r.indexOf('"',d),p&&i!=-1){let v=!0;for(;v;)r[i+1]==p&&r[i+2]=='"'?i=r.indexOf('"',i+3):v=!1}if(i===-1)throw new Hu('invalid line (no matching double quote) "'+r+'"');c=r.slice(d,i),n=r.indexOf(S3,i);let g=r.indexOf(WO,i);(n===-1||g!==-1&&n>g)&&(i=!1)}else{d=i+1;let g=r.indexOf(S3,d),v=r.indexOf(WO,d);v!==-1&&g>v?(g=v,i=!1):g===-1?(v===-1?g=r.length:g=v,i=!1):(n=g,i=g),c=r.slice(d,g)}let h=c.length;if(c=Tr._rfc6868Escape(c),d+=h-c.length,p){let g=m||p;c=Tr._parseMultiValue(c,g,u,[],null,t)}else c=Tr._parseValue(c,u,t);p&&l in s?Array.isArray(s[l])?s[l].push(c):s[l]=[s[l],c]:s[l]=c}return[s,c,d]};Tr._rfc6868Escape=function(r){return r.replace(/\^['n^]/g,function(e){return jdt[e]})};Tr._parseMultiValue=function(r,e,t,n,i,a,s){let o=0,l=0,c;if(e.length===0)return r;for(;(o=I0e(r,e,l))!==-1;)c=r.slice(l,o),i?c=Tr._parseMultiValue(c,i,t,[],null,a,s):c=Tr._parseValue(c,t,a,s),n.push(c),l=o+e.length;return c=r.slice(l),i?c=Tr._parseMultiValue(c,i,t,[],null,a,s):c=Tr._parseValue(c,t,a,s),n.push(c),n.length==1?n[0]:n};Tr._eachLine=function(r,e){let t=r.length,n=r.search(Ldt),i=n,a,s,o;do i=r.indexOf(` +`,n)+1,i>1&&r[i-2]==="\r"?o=2:o=1,i===0&&(i=t,o=0),s=r[n],s===" "||s===" "?a+=r.slice(n+1,i-o):(a&&e(null,a),a=r.slice(n,i-o)),n=i;while(i!==t);a=a.trim(),a.length&&e(null,a)};Bdt=["tzid","location","tznames","latitude","longitude"],sr=class sr{constructor(e){A(this,"tzid","");A(this,"location","");A(this,"tznames","");A(this,"latitude",0);A(this,"longitude",0);A(this,"component",null);A(this,"expandedUntilYear",0);A(this,"icalclass","icaltimezone");this.wrappedJSObject=this,this.fromData(e)}static _compare_change_fn(e,t){return e.yeart.year?1:e.montht.month?1:e.dayt.day?1:e.hourt.hour?1:e.minutet.minute?1:e.secondt.second?1:0}static convert_time(e,t,n){if(e.isDate||t.tzid==n.tzid||t==sr.localTimezone||n==sr.localTimezone)return e.zone=n,e;let i=t.utcOffset(e);return e.adjust(0,0,0,-i),i=n.utcOffset(e),e.adjust(0,0,0,i),null}static fromData(e){return new sr().fromData(e)}static get utcTimezone(){return ho(this,RT)||$d(this,RT,sr.fromData({tzid:"UTC"})),ho(this,RT)}static get localTimezone(){return ho(this,OT)||$d(this,OT,sr.fromData({tzid:"floating"})),ho(this,OT)}static adjust_change(e,t,n,i,a){return _e.prototype.adjust.call(e,t,n,i,a,e)}fromData(e){if(this.expandedUntilYear=0,this.changes=[],e instanceof Wo)this.component=e;else{if(e&&"component"in e)if(typeof e.component=="string"){let t=Tr(e.component);this.component=new Wo(t)}else e.component instanceof Wo?this.component=e.component:this.component=null;for(let t of Bdt)e&&t in e&&(this[t]=e[t])}return this.component instanceof Wo&&!this.tzid&&(this.tzid=this.component.getFirstPropertyValue("tzid")),this}utcOffset(e){if(this==sr.utcTimezone||this==sr.localTimezone||(this._ensureCoverage(e.year),!this.changes.length))return 0;let t={year:e.year,month:e.month,day:e.day,hour:e.hour,minute:e.minute,second:e.second},n=this._findNearbyChange(t),i=-1,a=1;for(;;){let l=Cg(this.changes[n],!0);if(l.utcOffset=0?i=n:a=-1,a==-1&&i!=-1)break;if(n+=a,n<0)return 0;if(n>=this.changes.length)break}let s=this.changes[i];if(s.utcOffset-s.prevUtcOffset<0&&i>0){let l=Cg(s,!0);if(sr.adjust_change(l,0,0,0,l.prevUtcOffset),sr._compare_change_fn(t,l)<0){let c=this.changes[i-1],d=!1;s.is_daylight!=d&&c.is_daylight==d&&(s=c)}}return s.utcOffset}_findNearbyChange(e){let t=Eg(this.changes,e,sr._compare_change_fn);return t>=this.changes.length?this.changes.length-1:t}_ensureCoverage(e){if(sr._minimumExpansionYear==-1){let n=_e.now();sr._minimumExpansionYear=n.year}let t=e;if(tt||!u));)a.year=u.year,a.month=u.month,a.day=u.day,a.hour=u.hour,a.minute=u.minute,a.second=u.second,a.isDate=u.isDate,sr.adjust_change(a,0,0,0,-a.prevUtcOffset),n.push(a)}}return n}toString(){return this.tznames?this.tznames:this.tzid}};RT=new WeakMap,OT=new WeakMap,Hf(sr,RT,null),Hf(sr,OT,null),A(sr,"_minimumExpansionYear",-1),A(sr,"EXTRA_COVERAGE",5);Cr=sr,za=null,YO={get count(){return za===null?0:Object.keys(za).length},reset:function(){za=Object.create(null);let r=Cr.utcTimezone;za.Z=r,za.UTC=r,za.GMT=r},_hard_reset:function(){za=null},has:function(r){return za===null?!1:!!za[r]},get:function(r){return za===null&&this.reset(),za[r]},register:function(r,e){if(za===null&&this.reset(),typeof r=="string"&&e instanceof Cr&&([r,e]=[e,r]),e||(r instanceof Cr?e=r.tzid:r.name==="vtimezone"&&(r=new Cr(r),e=r.tzid)),!e)throw new TypeError("Neither a timezone nor a name was passed");if(r instanceof Cr)za[e]=r;else throw new TypeError("timezone must be ICAL.Timezone or ICAL.Component")},remove:function(r){return za===null?null:delete za[r]}};Hdt=Object.freeze({__proto__:null,binsearchInsert:Eg,clone:Cg,extend:Dg,foldline:N0e,formatClassType:Bu,isStrictlyNaN:xD,pad2:gs,strictParseInt:ma,trunc:Pi,unescapedIndexOf:I0e,updateTimezones:Udt}),Uu=class r{constructor(e){A(this,"hours",0);A(this,"minutes",0);A(this,"factor",1);A(this,"icaltype","utc-offset");this.fromData(e)}static fromString(e){let t={};return t.factor=e[0]==="+"?1:-1,t.hours=ma(e.slice(1,3)),t.minutes=ma(e.slice(4,6)),new r(t)}static fromSeconds(e){let t=new r;return t.fromSeconds(e),t}clone(){return r.fromSeconds(this.toSeconds())}fromData(e){if(e)for(let[t,n]of Object.entries(e))this[t]=n;this._normalize()}fromSeconds(e){let t=Math.abs(e);return this.factor=e<0?-1:1,this.hours=Pi(t/3600),t-=this.hours*3600,this.minutes=Pi(t/60),this}toSeconds(){return this.factor*(60*this.minutes+3600*this.hours)}compare(e){let t=this.toSeconds(),n=e.toSeconds();return(t>n)-(n>t)}_normalize(){let e=this.toSeconds(),t=this.factor;for(;e<-43200;)e+=97200;for(;e>50400;)e-=97200;this.fromSeconds(e),e==0&&(this.factor=t)}toICALString(){return Dr.icalendar.value["utc-offset"].toICAL(this.toString())}toString(){return(this.factor==1?"+":"-")+gs(this.hours)+":"+gs(this.minutes)}},Sg=class r extends _e{constructor(t,n,i){super(t,n);A(this,"icalclass","vcardtime");A(this,"icaltype","date-and-or-time");this.icaltype=i||"date-and-or-time"}static fromDateAndOrTimeString(t,n){function i(g,v,k){return g?ma(g.slice(v,v+k)):null}let a=t.split("T"),s=a[0],o=a[1],l=o?Dr.vcard.value.time._splitZone(o):[],c=l[0],d=l[1],u=s?s.length:0,p=d?d.length:0,m=s&&s[0]=="-"&&s[1]=="-",f=d&&d[0]=="-",h={year:m?null:i(s,0,4),month:m&&(u==4||u==7)?i(s,2,2):u==7||u==10?i(s,5,2):null,day:u==5?i(s,3,2):u==7&&m?i(s,5,2):u==10?i(s,8,2):null,hour:f?null:i(d,0,2),minute:f&&p==3?i(d,1,2):p>4?f?i(d,1,2):i(d,3,2):null,second:p==4?i(d,2,2):p==6?i(d,4,2):p==8?i(d,6,2):null};return c=="Z"?c=Cr.utcTimezone:c&&c[3]==":"?c=Uu.fromString(c):c=null,new r(h,c,n)}clone(){return new r(this._time,this.zone,this.icaltype)}_normalize(){return this}utcOffset(){return this.zone instanceof Uu?this.zone.toSeconds():_e.prototype.utcOffset.apply(this,arguments)}toICALString(){return Dr.vcard.value[this.icaltype].toICAL(this.toString())}toString(){let t=this.year,n=this.month,i=this.day,a=this.hour,s=this.minute,o=this.second,l=t!==null,c=n!==null,d=i!==null,u=a!==null,p=s!==null,m=o!==null,f=(l?gs(t)+(c||d?"-":""):c||d?"--":"")+(c?gs(n):"")+(d?"-"+gs(i):""),h=(u?gs(a):"-")+(u&&p?":":"")+(p?gs(s):"")+(!u&&!p?"-":"")+(p&&m?":":"")+(m?gs(o):""),g;switch(this.zone===Cr.utcTimezone?g="Z":this.zone instanceof Uu?g=this.zone.toString():this.zone===Cr.localTimezone?g="":this.zone instanceof Cr?g=Uu.fromSeconds(this.zone.utcOffset(this)).toString():g="",this.icaltype){case"time":return h+g;case"date-and-or-time":case"date-time":return f+(h=="--"?"":"T"+h+g);case"date":return f}return null}},hs=class hs{constructor(e){A(this,"completed",!1);A(this,"rule",null);A(this,"dtstart",null);A(this,"last",null);A(this,"occurrence_number",0);A(this,"by_indices",null);A(this,"initialized",!1);A(this,"by_data",null);A(this,"days",null);A(this,"days_index",0);this.fromData(e)}fromData(e){if(this.rule=Bu(e.rule,Vl),!this.rule)throw new Error("iterator requires a (ICAL.Recur) rule");if(this.dtstart=Bu(e.dtstart,_e),!this.dtstart)throw new Error("iterator requires a (ICAL.Time) dtstart");if(e.by_data?this.by_data=e.by_data:this.by_data=Cg(this.rule.parts,!0),e.occurrence_number&&(this.occurrence_number=e.occurrence_number),this.days=e.days||[],e.last&&(this.last=Bu(e.last,_e)),this.by_indices=e.by_indices,this.by_indices||(this.by_indices={BYSECOND:0,BYMINUTE:0,BYHOUR:0,BYDAY:0,BYMONTH:0,BYWEEKNO:0,BYMONTHDAY:0}),this.initialized=e.initialized||!1,!this.initialized)try{this.init()}catch(t){if(t instanceof IT)this.completed=!0;else throw t}}init(){this.initialized=!0,this.last=this.dtstart.clone();let e=this.by_data;if("BYDAY"in e&&this.sort_byday_rules(e.BYDAY),"BYYEARDAY"in e&&("BYMONTH"in e||"BYWEEKNO"in e||"BYMONTHDAY"in e))throw new Error("Invalid BYYEARDAY rule");if("BYWEEKNO"in e&&"BYMONTHDAY"in e)throw new Error("BYWEEKNO does not fit to BYMONTHDAY");if(this.rule.freq=="MONTHLY"&&("BYYEARDAY"in e||"BYWEEKNO"in e))throw new Error("For MONTHLY recurrences neither BYYEARDAY nor BYWEEKNO may appear");if(this.rule.freq=="WEEKLY"&&("BYYEARDAY"in e||"BYMONTHDAY"in e))throw new Error("For WEEKLY recurrences neither BYMONTHDAY nor BYYEARDAY may appear");if(this.rule.freq!="YEARLY"&&"BYYEARDAY"in e)throw new Error("BYYEARDAY may only appear in YEARLY rules");if(this.last.second=this.setup_defaults("BYSECOND","SECONDLY",this.dtstart.second),this.last.minute=this.setup_defaults("BYMINUTE","MINUTELY",this.dtstart.minute),this.last.hour=this.setup_defaults("BYHOUR","HOURLY",this.dtstart.hour),this.last.day=this.setup_defaults("BYMONTHDAY","DAILY",this.dtstart.day),this.last.month=this.setup_defaults("BYMONTH","MONTHLY",this.dtstart.month),this.rule.freq=="WEEKLY")if("BYDAY"in e){let[,t]=this.ruleDayOfWeek(e.BYDAY[0],this.rule.wkst),n=t-this.last.dayOfWeek(this.rule.wkst);(this.last.dayOfWeek(this.rule.wkst)=0||n<0)&&(this.last.day+=n)}else{let t=Vl.numericDayToIcalDay(this.dtstart.dayOfWeek());e.BYDAY=[t]}if(this.rule.freq=="YEARLY"){let t=this.rule.until?this.rule.until.year:2e4;for(;this.last.year<=t&&(this.expand_year_days(this.last.year),!(this.days.length>0));)this.increment_year(this.rule.interval);if(this.days.length==0)throw new IT;if(!this._nextByYearDay()&&!this.next_year()&&!this.next_year()&&!this.next_year())throw new IT}if(this.rule.freq=="MONTHLY"){if(this.has_by_data("BYDAY")){let t=null,n=this.last.clone(),i=_e.daysInMonth(this.last.month,this.last.year);for(let a of this.by_data.BYDAY){this.last=n.clone();let[s,o]=this.ruleDayOfWeek(a),l=this.last.nthWeekDay(o,s);if(s>=6||s<=-6)throw new Error("Malformed values in BYDAY part");if(l>i||l<=0){if(t&&t.month==n.month)continue;for(;l>i||l<=0;)this.increment_month(),i=_e.daysInMonth(this.last.month,this.last.year),l=this.last.nthWeekDay(o,s)}this.last.day=l,(!t||this.last.compare(t)<0)&&(t=this.last.clone())}if(this.last=t.clone(),this.has_by_data("BYMONTHDAY")&&this._byDayAndMonthDay(!0),this.last.day>i||this.last.day==0)throw new Error("Malformed values in BYDAY part")}else if(this.has_by_data("BYMONTHDAY")){this.last.day=1;let t=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY).filter(n=>n>=this.last.day);if(t.length)this.last.day=t[0],this.by_data.BYMONTHDAY=t;else if(!this.next_month()&&!this.next_month()&&!this.next_month())throw new IT}}}next(e=!1){let t=this.last?this.last.clone():null;if((this.rule.count&&this.occurrence_number>=this.rule.count||this.rule.until&&this.last.compare(this.rule.until)>0)&&(this.completed=!0),this.completed)return null;if(this.occurrence_number==0&&this.last.compare(this.dtstart)>=0)return this.occurrence_number++,this.last;let n,i=0;do switch(n=1,this.rule.freq){case"SECONDLY":this.next_second();break;case"MINUTELY":this.next_minute();break;case"HOURLY":this.next_hour();break;case"DAILY":this.next_day();break;case"WEEKLY":this.next_week();break;case"MONTHLY":if(n=this.next_month(),n)i=0;else if(++i==336)return this.completed=!0,null;break;case"YEARLY":if(n=this.next_year(),n)i=0;else if(++i==28)return this.completed=!0,null;break;default:return null}while(!this.check_contracting_rules()||this.last.compare(this.dtstart)<0||!n);if(this.last.compare(t)==0){if(e)throw new Error("Same occurrence found twice, protecting you from death by recursion");this.next(!0)}return this.rule.until&&this.last.compare(this.rule.until)>0?(this.completed=!0,null):(this.occurrence_number++,this.last)}next_second(){return this.next_generic("BYSECOND","SECONDLY","second","minute")}increment_second(e){return this.increment_generic(e,"second",60,"minute")}next_minute(){return this.next_generic("BYMINUTE","MINUTELY","minute","hour","next_second")}increment_minute(e){return this.increment_generic(e,"minute",60,"hour")}next_hour(){return this.next_generic("BYHOUR","HOURLY","hour","monthday","next_minute")}increment_hour(e){this.increment_generic(e,"hour",24,"monthday")}next_day(){let e=this.rule.freq=="DAILY";return this.next_hour()==0||(e?this.increment_monthday(this.rule.interval):this.increment_monthday(1)),0}next_week(){let e=0;if(this.next_weekday_by_week()==0)return e;if(this.has_by_data("BYWEEKNO")){this.by_indices.BYWEEKNO++,this.by_indices.BYWEEKNO==this.by_data.BYWEEKNO.length&&(this.by_indices.BYWEEKNO=0,e=1),this.last.month=1,this.last.day=1;let t=this.by_data.BYWEEKNO[this.by_indices.BYWEEKNO];this.last.day+=7*t,e&&this.increment_year(1)}else this.increment_monthday(7*this.rule.interval);return e}normalizeByMonthDayRules(e,t,n){let i=_e.daysInMonth(t,e),a=[],s=0,o=n.length,l;for(;si)){if(l<0)l=i+(l+1);else if(l===0)continue;a.indexOf(l)===-1&&a.push(l)}}return a.sort(function(c,d){return c-d})}_byDayAndMonthDay(e){let t,n=this.by_data.BYDAY,i,a=0,s,o=n.length,l=0,c,d=this,u=this.last.day;function p(){for(c=_e.daysInMonth(d.last.month,d.last.year),t=d.normalizeByMonthDayRules(d.last.year,d.last.month,d.by_data.BYMONTHDAY),s=t.length;t[a]<=u&&!(e&&t[a]==u)&&ac){m();continue}let h=t[a++];if(h>=i)u=h;else{m();continue}for(let g=0;gt&&(this.last.day=1,this.increment_month(),this.is_day_in_byday(this.last)?(!this.has_by_data("BYSETPOS")||this.check_set_position(1))&&(e=1):e=0)}else if(this.has_by_data("BYMONTHDAY")){if(this.by_indices.BYMONTHDAY++,this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length&&(this.by_indices.BYMONTHDAY=0,this.increment_month(),this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length))return 0;let t=_e.daysInMonth(this.last.month,this.last.year),n=this.by_data.BYMONTHDAY[this.by_indices.BYMONTHDAY];n<0&&(n=t+n+1),n>t?(this.last.day=1,e=this.is_day_in_byday(this.last)):this.last.day=n}else{this.increment_month();let t=_e.daysInMonth(this.last.month,this.last.year);this.by_data.BYMONTHDAY[0]>t?e=0:this.last.day=this.by_data.BYMONTHDAY[0]}return e}next_weekday_by_week(){let e=0;if(this.next_hour()==0)return e;if(!this.has_by_data("BYDAY"))return 1;for(;;){let t=new _e;this.by_indices.BYDAY++,this.by_indices.BYDAY==Object.keys(this.by_data.BYDAY).length&&(this.by_indices.BYDAY=0,e=1);let n=this.by_data.BYDAY[this.by_indices.BYDAY],a=this.ruleDayOfWeek(n)[1];a-=this.rule.wkst,a<0&&(a+=7),t.year=this.last.year,t.month=this.last.month,t.day=this.last.day;let s=t.startDoyWeek(this.rule.wkst);if(a+s<1&&!e)continue;let o=_e.fromDayOfYear(s+a,this.last.year);return this.last.year=o.year,this.last.month=o.month,this.last.day=o.day,e}}next_year(){return this.next_hour()==0||(this.days.length==0||++this.days_index==this.days.length)&&(this.days_index=0,this.increment_year(this.rule.interval),this.has_by_data("BYMONTHDAY")&&(this.by_data.BYMONTHDAY=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY)),this.expand_year_days(this.last.year),this.days.length==0)?0:this._nextByYearDay()}_nextByYearDay(){let e=this.days[this.days_index],t=this.last.year;if(Math.abs(e)==366&&!_e.isLeapYear(this.last.year))return 0;e<1&&(e+=1,t+=1);let n=_e.fromDayOfYear(e,t);return this.last.day=n.day,this.last.month=n.month,1}ruleDayOfWeek(e,t){let n=e.match(/([+-]?[0-9])?(MO|TU|WE|TH|FR|SA|SU)/);if(n){let i=parseInt(n[1]||0,10);return e=Vl.icalDayToNumericDay(n[2],t),[i,e]}else return[0,0]}next_generic(e,t,n,i,a){let s=e in this.by_data,o=this.rule.freq==t,l=0;if(a&&this[a]()==0)return l;if(s){this.by_indices[e]++;let c=this.by_data[e];this.by_indices[e]==c.length&&(this.by_indices[e]=0,l=1),this.last[n]=c[this.by_indices[e]]}else o&&this["increment_"+n](this.rule.interval);return s&&l&&o&&this["increment_"+i](1),l}increment_monthday(e){for(let t=0;tn&&(this.last.day-=n,this.increment_month())}}increment_month(){if(this.last.day=1,this.has_by_data("BYMONTH"))this.by_indices.BYMONTH++,this.by_indices.BYMONTH==this.by_data.BYMONTH.length&&(this.by_indices.BYMONTH=0,this.increment_year(1)),this.last.month=this.by_data.BYMONTH[this.by_indices.BYMONTH];else{this.rule.freq=="MONTHLY"?this.last.month+=this.rule.interval:this.last.month++,this.last.month--;let e=Pi(this.last.month/12);this.last.month%=12,this.last.month++,e!=0&&this.increment_year(e)}this.has_by_data("BYMONTHDAY")&&(this.by_data.BYMONTHDAY=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY))}increment_year(e){this.last.day=1,this.last.year+=e}increment_generic(e,t,n,i){this.last[t]+=e;let a=Pi(this.last[t]/n);this.last[t]%=n,a!=0&&this["increment_"+i](a)}has_by_data(e){return e in this.rule.parts}expand_year_days(e){let t=new _e;this.days=[];let n={},i=["BYDAY","BYWEEKNO","BYMONTHDAY","BYMONTH","BYYEARDAY"];for(let o of i)o in this.rule.parts&&(n[o]=this.rule.parts[o]);if("BYMONTH"in n&&"BYWEEKNO"in n){let o=1,l={};t.year=e,t.isDate=!0;for(let c=0;c0?(g=v+(f-1)*7,g<=l&&this.days.push(d+g)):(g=k+(f+1)*7,g>0&&this.days.push(d+g))}}this.days.sort(function(o,l){return o-l})}else if(a==2&&"BYDAY"in n&&"BYMONTHDAY"in n){let o=this.expand_by_day(e);for(let l of o){let c=_e.fromDayOfYear(l,e);this.by_data.BYMONTHDAY.indexOf(c.day)>=0&&this.days.push(l)}}else if(a==3&&"BYDAY"in n&&"BYMONTHDAY"in n&&"BYMONTH"in n){let o=this.expand_by_day(e);for(let l of o){let c=_e.fromDayOfYear(l,e);this.by_data.BYMONTH.indexOf(c.month)>=0&&this.by_data.BYMONTHDAY.indexOf(c.day)>=0&&this.days.push(l)}}else if(a==2&&"BYDAY"in n&&"BYWEEKNO"in n){let o=this.expand_by_day(e);for(let l of o){let d=_e.fromDayOfYear(l,e).weekNumber(this.rule.wkst);this.by_data.BYWEEKNO.indexOf(d)&&this.days.push(l)}}else if(!(a==3&&"BYDAY"in n&&"BYWEEKNO"in n&&"BYMONTHDAY"in n))if(a==1&&"BYYEARDAY"in n)this.days=this.days.concat(this.by_data.BYYEARDAY);else if(a==2&&"BYYEARDAY"in n&&"BYDAY"in n){let o=_e.isLeapYear(e)?366:365,l=new Set(this.expand_by_day(e));for(let c of this.by_data.BYYEARDAY)c<0&&(c+=o+1),l.has(c)&&this.days.push(c)}else this.days=[]}}let s=_e.isLeapYear(e)?366:365;return this.days.sort((o,l)=>(o<0&&(o+=s+1),l<0&&(l+=s+1),o-l)),0}expand_by_day(e){let t=[],n=this.last.clone();n.year=e,n.month=1,n.day=1,n.isDate=!0;let i=n.dayOfWeek();n.month=12,n.day=31,n.isDate=!0;let a=n.dayOfWeek(),s=n.dayOfYear();for(let o of this.by_data.BYDAY){let l=this.ruleDayOfWeek(o),c=l[0],d=l[1];if(c==0){let u=(d+7-i)%7+1;for(let p=u;p<=s;p+=7)t.push(p)}else if(c>0){let u;d>=i?u=d-i+1:u=d-i+8,t.push(u+(c-1)*7)}else{let u;c=-c,d<=a?u=s-a+d:u=s-a+d-7,t.push(u-(c-1)*7)}}return t}is_day_in_byday(e){if(this.by_data.BYDAY)for(let t of this.by_data.BYDAY){let n=this.ruleDayOfWeek(t),i=n[0],a=n[1],s=e.dayOfWeek();if(i==0&&a==s||e.nthWeekDay(a,i)==e.day)return 1}return 0}check_set_position(e){return this.has_by_data("BYSETPOS")?this.by_data.BYSETPOS.indexOf(e)!==-1:!1}sort_byday_rules(e){for(let t=0;ta){let s=e[t];e[t]=e[n],e[n]=s}}}check_contract_restriction(e,t){let n=hs._indexMap[e],i=hs._expandMap[this.rule.freq][n],a=!1;if(e in this.by_data&&i==hs.CONTRACT){let s=this.by_data[e];for(let o of s)if(o==t){a=!0;break}}else a=!0;return a}check_contracting_rules(){let e=this.last.dayOfWeek(),t=this.last.weekNumber(this.rule.wkst),n=this.last.dayOfYear();return this.check_contract_restriction("BYSECOND",this.last.second)&&this.check_contract_restriction("BYMINUTE",this.last.minute)&&this.check_contract_restriction("BYHOUR",this.last.hour)&&this.check_contract_restriction("BYDAY",Vl.numericDayToIcalDay(e))&&this.check_contract_restriction("BYWEEKNO",t)&&this.check_contract_restriction("BYMONTHDAY",this.last.day)&&this.check_contract_restriction("BYMONTH",this.last.month)&&this.check_contract_restriction("BYYEARDAY",n)}setup_defaults(e,t,n){let i=hs._indexMap[e];return hs._expandMap[this.rule.freq][i]!=hs.CONTRACT&&(e in this.by_data||(this.by_data[e]=[n]),this.rule.freq!=t)?this.by_data[e][0]:n}toJSON(){let e=Object.create(null);return e.initialized=this.initialized,e.rule=this.rule.toJSON(),e.dtstart=this.dtstart.toJSON(),e.by_data=this.by_data,e.days=this.days,e.last=this.last.toJSON(),e.by_indices=this.by_indices,e.occurrence_number=this.occurrence_number,e}};A(hs,"_indexMap",{BYSECOND:0,BYMINUTE:1,BYHOUR:2,BYDAY:3,BYMONTHDAY:4,BYYEARDAY:5,BYWEEKNO:6,BYMONTH:7,BYSETPOS:8}),A(hs,"_expandMap",{SECONDLY:[1,1,1,1,1,1,1,1],MINUTELY:[2,1,1,1,1,1,1,1],HOURLY:[2,2,1,1,1,1,1,1],DAILY:[2,2,2,1,1,1,1,1],WEEKLY:[2,2,2,2,3,3,1,1],MONTHLY:[2,2,2,2,2,3,3,1],YEARLY:[2,2,2,2,2,2,2,2]}),A(hs,"UNKNOWN",0),A(hs,"CONTRACT",1),A(hs,"EXPAND",2),A(hs,"ILLEGAL",3);CD=hs,IT=class extends Error{constructor(){super("Recurrence rule has no valid occurrences")}},Vdt=/^(SU|MO|TU|WE|TH|FR|SA)$/,qdt=/^([+-])?(5[0-3]|[1-4][0-9]|[1-9])?(SU|MO|TU|WE|TH|FR|SA)$/,R0e={SU:_e.SUNDAY,MO:_e.MONDAY,TU:_e.TUESDAY,WE:_e.WEDNESDAY,TH:_e.THURSDAY,FR:_e.FRIDAY,SA:_e.SATURDAY},Wdt=Object.fromEntries(Object.entries(R0e).map(r=>r.reverse())),k0e=["SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"],Vl=class r{constructor(e){A(this,"parts",null);A(this,"interval",1);A(this,"wkst",_e.MONDAY);A(this,"until",null);A(this,"count",null);A(this,"freq",null);A(this,"icalclass","icalrecur");A(this,"icaltype","recur");this.wrappedJSObject=this,this.parts={},e&&typeof e=="object"&&this.fromData(e)}static fromString(e){let t=this._stringToData(e,!1);return new r(t)}static fromData(e){return new r(e)}static _stringToData(e,t){let n=Object.create(null),i=e.split(";"),a=i.length;for(let s=0;s7&&(i-=7),Wdt[i]}iterator(e){return new CD({rule:this,dtstart:e})}clone(){return new r(this.toJSON())}isFinite(){return!!(this.count||this.until)}isByCount(){return!!(this.count&&!this.until)}addComponent(e,t){let n=e.toUpperCase();n in this.parts?this.parts[n].push(t):this.parts[n]=[t]}setComponent(e,t){this.parts[e.toUpperCase()]=t.slice()}getComponent(e){let t=e.toUpperCase();return t in this.parts?this.parts[t].slice():[]}getNextOccurrence(e,t){let n=this.iterator(e),i;do i=n.next();while(i&&i.compare(t)<=0);return i&&t.zone&&(i.zone=t.zone),i}fromData(e){for(let t in e){let n=t.toUpperCase();n in w3?Array.isArray(e[t])?this.parts[n]=e[t]:this.parts[n]=[e[t]]:this[t]=e[t]}this.interval&&typeof this.interval!="number"&&k3.INTERVAL(this.interval,this),this.wkst&&typeof this.wkst!="number"&&(this.wkst=r.icalDayToNumericDay(this.wkst)),this.until&&!(this.until instanceof _e)&&(this.until=_e.fromString(this.until))}toJSON(){let e=Object.create(null);e.freq=this.freq,this.count&&(e.count=this.count),this.interval>1&&(e.interval=this.interval);for(let[t,n]of Object.entries(this.parts))Array.isArray(n)&&n.length==1?e[t.toLowerCase()]=n[0]:e[t.toLowerCase()]=Cg(n);return this.until&&(e.until=this.until.toString()),"wkst"in this&&this.wkst!==_e.DEFAULT_WEEK_START&&(e.wkst=r.numericDayToIcalDay(this.wkst)),e}toString(){let e="FREQ="+this.freq;this.count&&(e+=";COUNT="+this.count),this.interval>1&&(e+=";INTERVAL="+this.interval);for(let[t,n]of Object.entries(this.parts))e+=";"+t+"="+n;return this.until&&(e+=";UNTIL="+this.until.toICALString()),"wkst"in this&&this.wkst!==_e.DEFAULT_WEEK_START&&(e+=";WKST="+r.numericDayToIcalDay(this.wkst)),e}};k3={FREQ:function(r,e,t){if(k0e.indexOf(r)!==-1)e.freq=r;else throw new Error('invalid frequency "'+r+'" expected: "'+k0e.join(", ")+'"')},COUNT:function(r,e,t){e.count=ma(r)},INTERVAL:function(r,e,t){e.interval=ma(r),e.interval<1&&(e.interval=1)},UNTIL:function(r,e,t){r.length>10?e.until=Dr.icalendar.value["date-time"].fromICAL(r):e.until=Dr.icalendar.value.date.fromICAL(r),t||(e.until=_e.fromString(e.until))},WKST:function(r,e,t){if(Vdt.test(r))e.wkst=Vl.icalDayToNumericDay(r);else throw new Error('invalid WKST value "'+r+'"')}},w3={BYSECOND:Lm.bind(void 0,"BYSECOND",0,60),BYMINUTE:Lm.bind(void 0,"BYMINUTE",0,59),BYHOUR:Lm.bind(void 0,"BYHOUR",0,23),BYDAY:function(r){if(qdt.test(r))return r;throw new Error('invalid BYDAY value "'+r+'"')},BYMONTHDAY:Lm.bind(void 0,"BYMONTHDAY",-31,31),BYYEARDAY:Lm.bind(void 0,"BYYEARDAY",-366,366),BYWEEKNO:Lm.bind(void 0,"BYWEEKNO",-53,53),BYMONTH:Lm.bind(void 0,"BYMONTH",1,12),BYSETPOS:Lm.bind(void 0,"BYSETPOS",-366,366)},Ydt=/\\\\|\\;|\\,|\\[Nn]/g,Gdt=/\\|;|,|\n/g,w0e=/\\\\|\\,|\\[Nn]/g,S0e=/\\|,|\n/g;or={defaultType:"text"},DD={defaultType:"text",multiValue:","},GO={defaultType:"text",structuredValue:";"},zO={defaultType:"integer"},jO={defaultType:"date-time",allowedTypes:["date-time","date"]},BO={defaultType:"date-time"},fs={defaultType:"uri"},E0e={defaultType:"utc-offset"},x0e={defaultType:"recur"},C0e={defaultType:"date-and-or-time",allowedTypes:["date-time","date","text"]};C3={categories:DD,url:fs,version:or,uid:or},D3={boolean:{values:["TRUE","FALSE"],fromICAL:function(r){switch(r){case"TRUE":return!0;case"FALSE":return!1;default:return!1}},toICAL:function(r){return r?"TRUE":"FALSE"}},float:{matches:/^[+-]?\d+\.\d+$/,fromICAL:function(r){let e=parseFloat(r);return xD(e)?0:e},toICAL:function(r){return String(r)}},integer:{fromICAL:function(r){let e=parseInt(r);return xD(e)?0:e},toICAL:function(r){return String(r)}},"utc-offset":{toICAL:function(r){return r.length<7?r.slice(0,3)+r.slice(4,6):r.slice(0,3)+r.slice(4,6)+r.slice(7,9)},fromICAL:function(r){return r.length<6?r.slice(0,3)+":"+r.slice(3,5):r.slice(0,3)+":"+r.slice(3,5)+":"+r.slice(5,7)},decorate:function(r){return Uu.fromString(r)},undecorate:function(r){return r.toString()}}},Qdt={cutype:{values:["INDIVIDUAL","GROUP","RESOURCE","ROOM","UNKNOWN"],allowXName:!0,allowIanaToken:!0},"delegated-from":{valueType:"cal-address",multiValue:",",multiValueSeparateDQuote:!0},"delegated-to":{valueType:"cal-address",multiValue:",",multiValueSeparateDQuote:!0},encoding:{values:["8BIT","BASE64"]},fbtype:{values:["FREE","BUSY","BUSY-UNAVAILABLE","BUSY-TENTATIVE"],allowXName:!0,allowIanaToken:!0},member:{valueType:"cal-address",multiValue:",",multiValueSeparateDQuote:!0},partstat:{values:["NEEDS-ACTION","ACCEPTED","DECLINED","TENTATIVE","DELEGATED","COMPLETED","IN-PROCESS"],allowXName:!0,allowIanaToken:!0},range:{values:["THISANDFUTURE"]},related:{values:["START","END"]},reltype:{values:["PARENT","CHILD","SIBLING"],allowXName:!0,allowIanaToken:!0},role:{values:["REQ-PARTICIPANT","CHAIR","OPT-PARTICIPANT","NON-PARTICIPANT"],allowXName:!0,allowIanaToken:!0},rsvp:{values:["TRUE","FALSE"]},"sent-by":{valueType:"cal-address"},tzid:{matches:/^\//},value:{values:["binary","boolean","cal-address","date","date-time","duration","float","integer","period","recur","text","time","uri","utc-offset"],allowXName:!0,allowIanaToken:!0}},ei=Dg(D3,{text:E3(Ydt,Gdt),uri:{},binary:{decorate:function(r){return qO.fromString(r)},undecorate:function(r){return r.toString()}},"cal-address":{},date:{decorate:function(r,e){return Dr.strict?_e.fromDateString(r,e):_e.fromString(r,e)},undecorate:function(r){return r.toString()},fromICAL:function(r){return!Dr.strict&&r.length>=15?ei["date-time"].fromICAL(r):r.slice(0,4)+"-"+r.slice(4,6)+"-"+r.slice(6,8)},toICAL:function(r){let e=r.length;return e==10?r.slice(0,4)+r.slice(5,7)+r.slice(8,10):e>=19?ei["date-time"].toICAL(r):r}},"date-time":{fromICAL:function(r){if(!Dr.strict&&r.length==8)return ei.date.fromICAL(r);{let e=r.slice(0,4)+"-"+r.slice(4,6)+"-"+r.slice(6,8)+"T"+r.slice(9,11)+":"+r.slice(11,13)+":"+r.slice(13,15);return r[15]&&r[15]==="Z"&&(e+="Z"),e}},toICAL:function(r){let e=r.length;if(e==10&&!Dr.strict)return ei.date.toICAL(r);if(e>=19){let t=r.slice(0,4)+r.slice(5,7)+r.slice(8,13)+r.slice(14,16)+r.slice(17,19);return r[19]&&r[19]==="Z"&&(t+="Z"),t}else return r},decorate:function(r,e){return Dr.strict?_e.fromDateTimeString(r,e):_e.fromString(r,e)},undecorate:function(r){return r.toString()}},duration:{decorate:function(r){return so.fromString(r)},undecorate:function(r){return r.toString()}},period:{fromICAL:function(r){let e=r.split("/");return e[0]=ei["date-time"].fromICAL(e[0]),so.isValueString(e[1])||(e[1]=ei["date-time"].fromICAL(e[1])),e},toICAL:function(r){return r=r.slice(),!Dr.strict&&r[0].length==10?r[0]=ei.date.toICAL(r[0]):r[0]=ei["date-time"].toICAL(r[0]),so.isValueString(r[1])||(!Dr.strict&&r[1].length==10?r[1]=ei.date.toICAL(r[1]):r[1]=ei["date-time"].toICAL(r[1])),r.join("/")},decorate:function(r,e){return ED.fromJSON(r,e,!Dr.strict)},undecorate:function(r){return r.toJSON()}},recur:{fromICAL:function(r){return Vl._stringToData(r,!0)},toICAL:function(r){let e="";for(let[t,n]of Object.entries(r))t=="until"?n.length>10?n=ei["date-time"].toICAL(n):n=ei.date.toICAL(n):t=="wkst"?typeof n=="number"&&(n=Vl.numericDayToIcalDay(n)):Array.isArray(n)&&(n=n.join(",")),e+=t.toUpperCase()+"="+n+";";return e.slice(0,Math.max(0,e.length-1))},decorate:function(e){return Vl.fromData(e)},undecorate:function(r){return r.toJSON()}},time:{fromICAL:function(r){if(r.length<6)return r;let e=r.slice(0,2)+":"+r.slice(2,4)+":"+r.slice(4,6);return r[6]==="Z"&&(e+="Z"),e},toICAL:function(r){if(r.length<8)return r;let e=r.slice(0,2)+r.slice(3,5)+r.slice(6,8);return r[8]==="Z"&&(e+="Z"),e}}}),Jdt=Dg(C3,{action:or,attach:{defaultType:"uri"},attendee:{defaultType:"cal-address"},calscale:or,class:or,comment:or,completed:BO,contact:or,created:BO,description:or,dtend:jO,dtstamp:BO,dtstart:jO,due:jO,duration:{defaultType:"duration"},exdate:{defaultType:"date-time",allowedTypes:["date-time","date"],multiValue:","},exrule:x0e,freebusy:{defaultType:"period",multiValue:","},geo:{defaultType:"float",structuredValue:";"},"last-modified":BO,location:or,method:or,organizer:{defaultType:"cal-address"},"percent-complete":zO,priority:zO,prodid:or,"related-to":or,repeat:zO,rdate:{defaultType:"date-time",allowedTypes:["date-time","date","period"],multiValue:",",detectType:function(r){return r.indexOf("/")!==-1?"period":r.indexOf("T")===-1?"date":"date-time"}},"recurrence-id":jO,resources:DD,"request-status":GO,rrule:x0e,sequence:zO,status:or,summary:or,transp:or,trigger:{defaultType:"duration",allowedTypes:["duration","date-time"]},tzoffsetfrom:E0e,tzoffsetto:E0e,tzurl:fs,tzid:or,tzname:or}),ao=Dg(D3,{text:E3(w0e,S0e),uri:E3(w0e,S0e),date:{decorate:function(r){return Sg.fromDateAndOrTimeString(r,"date")},undecorate:function(r){return r.toString()},fromICAL:function(r){return r.length==8?ei.date.fromICAL(r):r[0]=="-"&&r.length==6?r.slice(0,4)+"-"+r.slice(4):r},toICAL:function(r){return r.length==10?ei.date.toICAL(r):r[0]=="-"&&r.length==7?r.slice(0,4)+r.slice(5):r}},time:{decorate:function(r){return Sg.fromDateAndOrTimeString("T"+r,"time")},undecorate:function(r){return r.toString()},fromICAL:function(r){let e=ao.time._splitZone(r,!0),t=e[0],n=e[1];return n.length==6?n=n.slice(0,2)+":"+n.slice(2,4)+":"+n.slice(4,6):n.length==4&&n[0]!="-"?n=n.slice(0,2)+":"+n.slice(2,4):n.length==5&&(n=n.slice(0,3)+":"+n.slice(3,5)),t.length==5&&(t[0]=="-"||t[0]=="+")&&(t=t.slice(0,3)+":"+t.slice(3)),n+t},toICAL:function(r){let e=ao.time._splitZone(r),t=e[0],n=e[1];return n.length==8?n=n.slice(0,2)+n.slice(3,5)+n.slice(6,8):n.length==5&&n[0]!="-"?n=n.slice(0,2)+n.slice(3,5):n.length==6&&(n=n.slice(0,3)+n.slice(4,6)),t.length==6&&(t[0]=="-"||t[0]=="+")&&(t=t.slice(0,3)+t.slice(4)),n+t},_splitZone:function(r,e){let t=r.length-1,n=r.length-(e?5:6),i=r[n],a,s;return r[t]=="Z"?(a=r[t],s=r.slice(0,Math.max(0,t))):r.length>6&&(i=="-"||i=="+")?(a=r.slice(n),s=r.slice(0,Math.max(0,n))):(a="",s=r),[a,s]}},"date-time":{decorate:function(r){return Sg.fromDateAndOrTimeString(r,"date-time")},undecorate:function(r){return r.toString()},fromICAL:function(r){return ao["date-and-or-time"].fromICAL(r)},toICAL:function(r){return ao["date-and-or-time"].toICAL(r)}},"date-and-or-time":{decorate:function(r){return Sg.fromDateAndOrTimeString(r,"date-and-or-time")},undecorate:function(r){return r.toString()},fromICAL:function(r){let e=r.split("T");return(e[0]?ao.date.fromICAL(e[0]):"")+(e[1]?"T"+ao.time.fromICAL(e[1]):"")},toICAL:function(r){let e=r.split("T");return ao.date.toICAL(e[0])+(e[1]?"T"+ao.time.toICAL(e[1]):"")}},timestamp:ei["date-time"],"language-tag":{matches:/^[a-zA-Z0-9-]+$/},"phone-number":{fromICAL:function(r){return Array.from(r).filter(function(e){return e==="\\"?void 0:e}).join("")},toICAL:function(r){return Array.from(r).map(function(e){return e===","||e===";"?"\\"+e:e}).join("")}}}),Xdt={type:{valueType:"text",multiValue:","},value:{values:["text","uri","date","time","date-time","date-and-or-time","timestamp","boolean","integer","float","utc-offset","language-tag"],allowXName:!0,allowIanaToken:!0}},eut=Dg(C3,{adr:{defaultType:"text",structuredValue:";",multiValue:","},anniversary:C0e,bday:C0e,caladruri:fs,caluri:fs,clientpidmap:GO,email:or,fburl:fs,fn:or,gender:GO,geo:fs,impp:fs,key:fs,kind:or,lang:{defaultType:"language-tag"},logo:fs,member:fs,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:DD,note:or,org:{defaultType:"text",structuredValue:";"},photo:fs,related:fs,rev:{defaultType:"timestamp"},role:or,sound:fs,source:fs,tel:{defaultType:"uri",allowedTypes:["uri","text"]},title:or,tz:{defaultType:"text",allowedTypes:["text","utc-offset","uri"]},xml:or}),tut=Dg(D3,{binary:ei.binary,date:ao.date,"date-time":ao["date-time"],"phone-number":ao["phone-number"],uri:ei.uri,text:ao.text,time:ei.time,vcard:ei.text,"utc-offset":{toICAL:function(r){return r.slice(0,7)},fromICAL:function(r){return r.slice(0,7)},decorate:function(r){return Uu.fromString(r)},undecorate:function(r){return r.toString()}}}),rut={type:{valueType:"text",multiValue:","},value:{values:["text","uri","date","date-time","phone-number","time","boolean","integer","float","utc-offset","vcard","binary"],allowXName:!0,allowIanaToken:!0}},nut=Dg(C3,{fn:or,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:DD,photo:{defaultType:"binary",allowedTypes:["binary","uri"]},bday:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(r){return r.indexOf("T")===-1?"date":"date-time"}},adr:{defaultType:"text",structuredValue:";",multiValue:","},label:or,tel:{defaultType:"phone-number"},email:or,mailer:or,tz:{defaultType:"utc-offset",allowedTypes:["utc-offset","text"]},geo:{defaultType:"float",structuredValue:";"},title:or,role:or,logo:{defaultType:"binary",allowedTypes:["binary","uri"]},agent:{defaultType:"vcard",allowedTypes:["vcard","text","uri"]},org:GO,note:DD,prodid:or,rev:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(r){return r.indexOf("T")===-1?"date":"date-time"}},"sort-string":or,sound:{defaultType:"binary",allowedTypes:["binary","uri"]},class:or,key:{defaultType:"binary",allowedTypes:["binary","text"]}}),ju={name:"ical",value:ei,param:Qdt,property:Jdt,propertyGroups:!1},D0e={name:"vcard4",value:ao,param:Xdt,property:eut,propertyGroups:!0},P0e={name:"vcard3",value:tut,param:rut,property:nut,propertyGroups:!0},Dr={strict:!0,defaultSet:ju,defaultType:"unknown",components:{vcard:D0e,vcard3:P0e,vevent:ju,vtodo:ju,vjournal:ju,valarm:ju,vtimezone:ju,daylight:ju,standard:ju},icalendar:ju,vcard:D0e,vcard3:P0e,getDesignSet:function(r){return r&&r in Dr.components?Dr.components[r]:Dr.defaultSet}},VO=`\r +`,M0e="unknown",iut={'"':"^'","\n":"^n","^":"^^"};wn.component=function(r,e){let t=r[0].toUpperCase(),n="BEGIN:"+t+VO,i=r[1],a=0,s=i.length,o=r[0];for(o==="vcard"&&r[1].length>0&&!(r[1][0][0]==="version"&&r[1][0][3]==="4.0")&&(o="vcard3"),e=e||Dr.getDesignSet(o);a0&&typeof e[0]=="object"&&"icaltype"in e[0]&&this.resetType(e[0].icaltype),this.isDecorated)for(;n=0;s--)(!n||a[s][$m]===n)&&this._removeObjectByIndex(e,i,s)}addSubcomponent(e){this._components||(this._components=[],this._hydratedComponentCount=0),e.parent&&e.parent.removeSubcomponent(e);let t=this.jCal[zm].push(e.jCal);return this._components[t-1]=e,this._hydratedComponentCount++,e.parent=this,e}removeSubcomponent(e){let t=this._removeObject(zm,"_components",e);return t&&this._hydratedComponentCount--,t}removeAllSubcomponents(e){let t=this._removeAllObjects(zm,"_components",e);return this._hydratedComponentCount=0,t}addProperty(e){if(!(e instanceof xg))throw new TypeError("must be instance of ICAL.Property");this._properties||(this._properties=[],this._hydratedPropertyCount=0),e.parent&&e.parent.removeProperty(e);let t=this.jCal[od].push(e.jCal);return this._properties[t-1]=e,this._hydratedPropertyCount++,e.parent=this,e}addPropertyWithValue(e,t){let n=new xg(e);return n.setValue(t),this.addProperty(n),n}updatePropertyWithValue(e,t){let n=this.getFirstProperty(e);return n?n.setValue(t):n=this.addPropertyWithValue(e,t),n}removeProperty(e){let t=this._removeObject(od,"_properties",e);return t&&this._hydratedPropertyCount--,t}removeAllProperties(e){let t=this._removeAllObjects(od,"_properties",e);return this._hydratedPropertyCount=0,t}toJSON(){return this.jCal}toString(){return wn.component(this.jCal,this._designSet)}getTimeZoneByID(e){if(this.parent)return this.parent.getTimeZoneByID(e);if(!this._timezoneCache)return null;if(this._timezoneCache.has(e))return this._timezoneCache.get(e);let t=this.getAllSubcomponents("vtimezone");for(let n of t)if(n.getFirstProperty("tzid").getFirstValue()===e){let i=new Cr({component:n,tzid:e});return this._timezoneCache.set(e,i),i}return null}},KO=class{constructor(e){A(this,"complete",!1);A(this,"ruleIterators",null);A(this,"ruleDates",null);A(this,"exDates",null);A(this,"ruleDateInc",0);A(this,"exDateInc",0);A(this,"exDate",null);A(this,"ruleDate",null);A(this,"dtstart",null);A(this,"last",null);this.ruleDates=[],this.exDates=[],this.fromData(e)}fromData(e){let t=Bu(e.dtstart,_e);if(t)this.dtstart=t;else throw new Error(".dtstart (ICAL.Time) must be given");if(e.component)this._init(e.component);else{if(this.last=Bu(e.last,_e)||t.clone(),!e.ruleIterators)throw new Error(".ruleIterators or .component must be given");this.ruleIterators=e.ruleIterators.map(function(n){return Bu(n,CD)}),this.ruleDateInc=e.ruleDateInc,this.exDateInc=e.exDateInc,e.ruleDates&&(this.ruleDates=e.ruleDates.map(n=>Bu(n,_e)),this.ruleDate=this.ruleDates[this.ruleDateInc]),e.exDates&&(this.exDates=e.exDates.map(n=>Bu(n,_e)),this.exDate=this.exDates[this.exDateInc]),typeof e.complete!="undefined"&&(this.complete=e.complete)}}_compare_special(e,t){return!e.isDate&&t.isDate?new _e({year:e.year,month:e.month,day:e.day}).compare(t):e.compare(t)}next(){let e,t,n,i=500,a=0;for(;;){if(a++>i)throw new Error("max tries have occurred, rule may be impossible to fulfill.");if(t=this.ruleDate,e=this._nextRecurrenceIter(this.last),!t&&!e){this.complete=!0;break}if((!t||e&&t.compare(e.last)>0)&&(t=e.last.clone(),e.next()),this.ruleDate===t&&this._nextRuleDay(),this.last=t,this.exDate&&(n=this._compare_special(this.last,this.exDate),n>0&&this._nextExDay(),n===0)){this._nextExDay();continue}return this.last}}toJSON(){function e(n){return n.toJSON()}let t=Object.create(null);return t.ruleIterators=this.ruleIterators.map(e),this.ruleDates&&(t.ruleDates=this.ruleDates.map(e)),this.exDates&&(t.exDates=this.exDates.map(e)),t.ruleDateInc=this.ruleDateInc,t.exDateInc=this.exDateInc,t.last=this.last.toJSON(),t.dtstart=this.dtstart.toJSON(),t.complete=this.complete,t}_extractDates(e,t){let n=[],i=e.getAllProperties(t);for(let a=0,s=i.length;ac.compare(d));n.splice(l,0,o)}return n}_init(e){if(this.ruleIterators=[],this.last=this.dtstart.clone(),!e.hasProperty("rdate")&&!e.hasProperty("rrule")&&!e.hasProperty("recurrence-id")){this.ruleDate=this.last.clone(),this.complete=!0;return}if(e.hasProperty("rdate")&&(this.ruleDates=this._extractDates(e,"rdate"),this.ruleDates[0]&&this.ruleDates[0].compare(this.dtstart)<0?(this.ruleDateInc=0,this.last=this.ruleDates[0].clone()):this.ruleDateInc=Eg(this.ruleDates,this.last,(t,n)=>t.compare(n)),this.ruleDate=this.ruleDates[this.ruleDateInc]),e.hasProperty("rrule")){let t=e.getAllProperties("rrule"),n=0,i=t.length,a,s;for(;n0)&&(s=n)}return s}},SD=class SD{constructor(e,t){A(this,"exceptions",null);A(this,"strictExceptions",!1);e instanceof Wo||(t=e,e=null),e?this.component=e:this.component=new Wo("vevent"),this._rangeExceptionCache=Object.create(null),this.exceptions=Object.create(null),this.rangeExceptions=[],t&&t.strictExceptions&&(this.strictExceptions=t.strictExceptions),t&&t.exceptions?t.exceptions.forEach(this.relateException,this):this.component.parent&&!this.isRecurrenceException()&&this.component.parent.getAllSubcomponents("vevent").forEach(function(n){n.hasProperty("recurrence-id")&&this.relateException(n)},this)}relateException(e){if(this.isRecurrenceException())throw new Error("cannot relate exception to exceptions");if(e instanceof Wo&&(e=new SD(e)),this.strictExceptions&&e.uid!==this.uid)throw new Error("attempted to relate unrelated exception");let t=e.recurrenceId.toString();if(this.exceptions[t]=e,e.modifiesFuture()){let n=[e.recurrenceId.toUnixTime(),t],i=Eg(this.rangeExceptions,n,A0e);this.rangeExceptions.splice(i,0,n)}}modifiesFuture(){return this.component.hasProperty("recurrence-id")?this.component.getFirstProperty("recurrence-id").getParameter("range")===SD.THISANDFUTURE:!1}findRangeException(e){if(!this.rangeExceptions.length)return null;let t=e.toUnixTime(),n=Eg(this.rangeExceptions,[t],A0e);if(n-=1,n<0)return null;let i=this.rangeExceptions[n];return t{out=Object.freeze({"AUS Central Standard Time":"Australia/Darwin","AUS Eastern Standard Time":"Australia/Sydney","Afghanistan Standard Time":"Asia/Kabul","Alaskan Standard Time":"America/Anchorage","Aleutian Standard Time":"America/Adak","Altai Standard Time":"Asia/Barnaul","Arab Standard Time":"Asia/Riyadh","Arabian Standard Time":"Asia/Dubai","Arabic Standard Time":"Asia/Baghdad","Argentina Standard Time":"America/Buenos_Aires","Astrakhan Standard Time":"Europe/Astrakhan","Atlantic Standard Time":"America/Halifax","Aus Central W. Standard Time":"Australia/Eucla","Azerbaijan Standard Time":"Asia/Baku","Azores Standard Time":"Atlantic/Azores","Bahia Standard Time":"America/Bahia","Bangladesh Standard Time":"Asia/Dhaka","Belarus Standard Time":"Europe/Minsk","Bougainville Standard Time":"Pacific/Bougainville","Canada Central Standard Time":"America/Regina","Cape Verde Standard Time":"Atlantic/Cape_Verde","Caucasus Standard Time":"Asia/Yerevan","Cen. Australia Standard Time":"Australia/Adelaide","Central America Standard Time":"America/Guatemala","Central Asia Standard Time":"Asia/Almaty","Central Brazilian Standard Time":"America/Cuiaba","Central Europe Standard Time":"Europe/Budapest","Central European Standard Time":"Europe/Warsaw","Central Pacific Standard Time":"Pacific/Guadalcanal","Central Standard Time":"America/Chicago","Central Standard Time (Mexico)":"America/Mexico_City","Chatham Islands Standard Time":"Pacific/Chatham","China Standard Time":"Asia/Shanghai","Cuba Standard Time":"America/Havana","Dateline Standard Time":"Etc/GMT+12","E. Africa Standard Time":"Africa/Nairobi","E. Australia Standard Time":"Australia/Brisbane","E. Europe Standard Time":"Europe/Chisinau","E. South America Standard Time":"America/Sao_Paulo","Easter Island Standard Time":"Pacific/Easter","Eastern Standard Time":"America/New_York","Eastern Standard Time (Mexico)":"America/Cancun","Egypt Standard Time":"Africa/Cairo","Ekaterinburg Standard Time":"Asia/Yekaterinburg","FLE Standard Time":"Europe/Kiev","Fiji Standard Time":"Pacific/Fiji","GMT Standard Time":"Europe/London","GTB Standard Time":"Europe/Bucharest","Georgian Standard Time":"Asia/Tbilisi","Greenland Standard Time":"America/Godthab","Greenwich Standard Time":"Atlantic/Reykjavik","Haiti Standard Time":"America/Port-au-Prince","Hawaiian Standard Time":"Pacific/Honolulu","India Standard Time":"Asia/Kolkata","Iran Standard Time":"Asia/Tehran","Israel Standard Time":"Asia/Jerusalem","Jordan Standard Time":"Asia/Amman","Kaliningrad Standard Time":"Europe/Kaliningrad","Korea Standard Time":"Asia/Seoul","Libya Standard Time":"Africa/Tripoli","Line Islands Standard Time":"Pacific/Kiritimati","Lord Howe Standard Time":"Australia/Lord_Howe","Magadan Standard Time":"Asia/Magadan","Magallanes Standard Time":"America/Punta_Arenas","Marquesas Standard Time":"Pacific/Marquesas","Mauritius Standard Time":"Indian/Mauritius","Middle East Standard Time":"Asia/Beirut","Montevideo Standard Time":"America/Montevideo","Morocco Standard Time":"Africa/Casablanca","Mountain Standard Time":"America/Denver","Mountain Standard Time (Mexico)":"America/Chihuahua","Myanmar Standard Time":"Asia/Yangon","N. Central Asia Standard Time":"Asia/Novosibirsk","Namibia Standard Time":"Africa/Windhoek","Nepal Standard Time":"Asia/Katmandu","New Zealand Standard Time":"Pacific/Auckland","Newfoundland Standard Time":"America/St_Johns","Norfolk Standard Time":"Pacific/Norfolk","North Asia East Standard Time":"Asia/Irkutsk","North Asia Standard Time":"Asia/Krasnoyarsk","North Korea Standard Time":"Asia/Pyongyang","Omsk Standard Time":"Asia/Omsk","Pacific SA Standard Time":"America/Santiago","Pacific Standard Time":"America/Los_Angeles","Pacific Standard Time (Mexico)":"America/Tijuana","Pakistan Standard Time":"Asia/Karachi","Paraguay Standard Time":"America/Asuncion","Qyzylorda Standard Time":"Asia/Qyzylorda","Romance Standard Time":"Europe/Paris","Russia Time Zone 10":"Asia/Srednekolymsk","Russia Time Zone 11":"Asia/Kamchatka","Russia Time Zone 3":"Europe/Samara","Russian Standard Time":"Europe/Moscow","SA Eastern Standard Time":"America/Cayenne","SA Pacific Standard Time":"America/Bogota","SA Western Standard Time":"America/La_Paz","SE Asia Standard Time":"Asia/Bangkok","Saint Pierre Standard Time":"America/Miquelon","Sakhalin Standard Time":"Asia/Sakhalin","Samoa Standard Time":"Pacific/Apia","Sao Tome Standard Time":"Africa/Sao_Tome","Saratov Standard Time":"Europe/Saratov","Singapore Standard Time":"Asia/Singapore","South Africa Standard Time":"Africa/Johannesburg","South Sudan Standard Time":"Africa/Juba","Sri Lanka Standard Time":"Asia/Colombo","Sudan Standard Time":"Africa/Khartoum","Syria Standard Time":"Asia/Damascus","Taipei Standard Time":"Asia/Taipei","Tasmania Standard Time":"Australia/Hobart","Tocantins Standard Time":"America/Araguaina","Tokyo Standard Time":"Asia/Tokyo","Tomsk Standard Time":"Asia/Tomsk","Tonga Standard Time":"Pacific/Tongatapu","Transbaikal Standard Time":"Asia/Chita","Turkey Standard Time":"Europe/Istanbul","Turks And Caicos Standard Time":"America/Grand_Turk","US Eastern Standard Time":"America/Indianapolis","US Mountain Standard Time":"America/Phoenix",UTC:"Etc/UTC","UTC+12":"Etc/GMT-12","UTC+13":"Etc/GMT-13","UTC-02":"Etc/GMT+2","UTC-08":"Etc/GMT+8","UTC-09":"Etc/GMT+9","UTC-11":"Etc/GMT+11","Ulaanbaatar Standard Time":"Asia/Ulaanbaatar","Venezuela Standard Time":"America/Caracas","Vladivostok Standard Time":"Asia/Vladivostok","Volgograd Standard Time":"Europe/Volgograd","W. Australia Standard Time":"Australia/Perth","W. Central Africa Standard Time":"Africa/Lagos","W. Europe Standard Time":"Europe/Berlin","W. Mongolia Standard Time":"Asia/Hovd","West Asia Standard Time":"Asia/Tashkent","West Bank Standard Time":"Asia/Hebron","West Pacific Standard Time":"Pacific/Port_Moresby","Yakutsk Standard Time":"Asia/Yakutsk"}),P3=new Map;F0e=new Map});function B0e(r){let e=r.getFirstPropertyValue("tzid");return typeof e=="string"?e.trim():null}function mut(r){let e=r.replace(/\s+\([^)]+\)$/u,"").trim();return e&&e!==r?[e]:[]}function fut(r,e){var t;return(t=r.getAllSubcomponents("vtimezone").find(n=>B0e(n)===e))!=null?t:null}function hut(r,e){let t=new oo.Component(JSON.parse(JSON.stringify(r.toJSON())));return t.updatePropertyWithValue("tzid",e),t}function gut(r){r.getAllSubcomponents("vtimezone").forEach(t=>{let n=B0e(t);oo.TimezoneService.register(t),n&&mut(n).forEach(i=>{let a=fut(r,i),s=a!=null?a:hut(t,i),o=new oo.Timezone({component:s,tzid:i});a||r.addSubcomponent(s),oo.TimezoneService.register(o)})})}var JO,PD,dut,uut,put,QO,U0e=y(()=>{JO=require("obsidian");O0e();DC();gr();G();ls();j0e();PD=I({tag:"Services/ICSSubscriptionService"}),dut=365*24*60*60*1e3,uut=3e3,put=1e4;QO=class extends Wc{constructor(t){super();this.subscriptions=[];this.cache=new Map;this.refreshTimers=new Map;this.fileWatchers=new Map;this.pendingRefreshes=new Set;this.lastFetched=new Map;this.lastError=new Map;this.destroyed=!1;this.CACHE_GRACE_PERIOD=300*1e3;this.plugin=t}translate(t,n){return this.plugin.i18n.translate(t,n)}icalTimeToISOString(t,n){var s;if(t.isDate){let o=t.year.toString().padStart(4,"0"),l=t.month.toString().padStart(2,"0"),c=t.day.toString().padStart(2,"0");return`${o}-${l}-${c}`}let i=(s=t.zone)==null?void 0:s.tzid;if(i==="floating"||i===void 0){let o=$0e(n);if(o)return z0e(t,o)}let a=t.toUnixTime();return new Date(a*1e3).toISOString()}rawTzidOf(t,n){let i=t.getFirstProperty(n);if(!i)return null;let a=i.getParameter("tzid");return typeof a=="string"?a:null}async initialize(){this.destroyed=!1,await this.loadSubscriptions();let t=[];this.subscriptions.forEach(n=>{if(n.enabled){n.type==="remote"?this.startRefreshTimer(n):n.type==="local"&&this.startFileWatcher(n);let i=this.cache.get(n.id);(!i||new Date(i.expires)<=new Date)&&t.push(this.fetchSubscription(n.id))}}),await Promise.allSettled(t),this.emit("data-changed")}async loadSubscriptions(){try{let t=await this.plugin.loadData();this.subscriptions=(t==null?void 0:t.icsSubscriptions)||[]}catch(t){PD.error("Failed to load ICS subscriptions:",{category:"provider",operation:"load-ics-subscriptions",error:t}),this.subscriptions=[]}}async saveSubscriptions(){try{let t=await this.plugin.loadData()||{};t.icsSubscriptions=this.subscriptions,await this.plugin.saveData(t)}catch(t){throw PD.error("Failed to save ICS subscriptions:",{category:"provider",operation:"save-ics-subscriptions",error:t}),t}}getSubscriptions(){return[...this.subscriptions]}getLastFetched(t){return this.lastFetched.get(t)}getLastError(t){return this.lastError.get(t)}async addSubscription(t){let n={...t,filePath:t.type==="local"&&t.filePath?this.normalizeLocalICSFilePathIfPossible(t.filePath):t.filePath,id:this.generateId()};return this.subscriptions.push(n),await this.saveSubscriptions(),n.enabled&&(n.type==="remote"?(this.startRefreshTimer(n),await this.fetchSubscription(n.id)):n.type==="local"&&(this.startFileWatcher(n),await this.fetchSubscription(n.id))),this.emit("data-changed"),n}async updateSubscription(t,n){let i=this.subscriptions.findIndex(l=>l.id===t);if(i===-1)throw new Error("Subscription not found");let a=this.subscriptions[i],s={...n};typeof n.filePath=="string"&&(s.filePath=this.normalizeLocalICSFilePathIfPossible(n.filePath));let o={...a,...s};this.subscriptions[i]=o,await this.saveSubscriptions(),this.stopRefreshTimer(t),this.stopFileWatcher(t),o.enabled&&(o.type==="remote"?this.startRefreshTimer(o):o.type==="local"&&this.startFileWatcher(o)),(n.url&&n.url!==a.url||n.filePath&&n.filePath!==a.filePath)&&this.cache.delete(t),this.emit("data-changed")}async removeSubscription(t){let n=this.subscriptions.findIndex(i=>i.id===t);if(n===-1)throw new Error("Subscription not found");this.subscriptions.splice(n,1),await this.saveSubscriptions(),this.stopRefreshTimer(t),this.stopFileWatcher(t),this.cache.delete(t),this.lastFetched.delete(t),this.lastError.delete(t),this.emit("data-changed")}async fetchSubscription(t){let n=this.subscriptions.find(i=>i.id===t);if(!(!n||!n.enabled))try{let i;if(n.type==="remote"){if(!n.url)throw new Error("Remote subscription missing URL");i=(await(0,JO.requestUrl)({url:n.url,method:"GET",headers:{Accept:"text/calendar,*/*;q=0.1","Accept-Language":"en-US,en;q=0.9","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"}})).text}else if(n.type==="local"){if(!n.filePath)throw new Error("Local subscription missing file path");let o=this.normalizeLocalICSFilePath(n.filePath);i=await this.readLocalICSFile(o),n.filePath!==o&&(n.filePath=o,await this.saveSubscriptions())}else throw new Error("Unknown subscription type");let a=this.parseICS(i,n.id),s={subscriptionId:t,events:a,lastUpdated:new Date().toISOString(),expires:new Date(Date.now()+n.refreshInterval*60*1e3).toISOString()};this.cache.set(t,s),this.lastFetched.set(t,new Date().toISOString()),this.lastError.delete(t),this.emit("data-changed")}catch(i){let a=i instanceof Error?i.message:String(i);this.lastError.set(t,a),n.type==="remote"?a.includes("404")?Ee(this.plugin.emitter,this.translate("services.icsSubscription.notices.calendarNotFound",{name:n.name})):a.includes("500")||a.includes("OwaBasicUnsupportedException")?Ee(this.plugin.emitter,this.translate("services.icsSubscription.notices.calendarAccessDenied",{name:n.name})):Ee(this.plugin.emitter,this.translate("services.icsSubscription.notices.fetchRemoteFailed",{name:n.name,error:a})):Ee(this.plugin.emitter,this.translate("services.icsSubscription.notices.readLocalFailed",{name:n.name,error:a}))}}parseICS(t,n){try{let i=oo.parse(t),a=new oo.Component(i);gut(a);let s=a.getAllSubcomponents("vevent"),o=[],l=new Map;return s.forEach(c=>{let d=new oo.Event(c),u=d.uid;if(!u)return;let p=c.getFirstPropertyValue("recurrence-id");if(p){l.has(u)||l.set(u,new Map);let m=Z(p);l.get(u).set(m,d)}}),s.forEach(c=>{try{let d=new oo.Event(c);if(c.getFirstPropertyValue("recurrence-id"))return;let p=c.getFirstPropertyValue("status");if(typeof p=="string"&&p.toUpperCase()==="CANCELLED")return;let m=c.getAllProperties("attendee");if(m&&m.length>0&&m.some(N=>{let R=N.getParameter("partstat");return typeof R=="string"&&R.toUpperCase()==="DECLINED"}))return;let f=d.summary||"Untitled Event",h=d.description||void 0,g=d.location||void 0,v=d.startDate,k=d.endDate;if(!v)return;let b=this.rawTzidOf(c,"dtstart"),w=this.rawTzidOf(c,"dtend"),S=v.isDate,x=this.icalTimeToISOString(v,b),C=k?this.icalTimeToISOString(k,w!=null?w:b):void 0,D=d.uid||`${n}-${o.length}`,_=`${n}-${D}`,O={id:_,subscriptionId:n,title:f,description:h,start:x,end:C,allDay:S,location:g,url:d.url||void 0};if(d.isRecurring()){let L=new Set;c.getAllProperties("exdate").forEach(te=>{let Te=te.getFirstValue();Te&&(Array.isArray(Te)?Te:[Te]).forEach(X=>{X&&typeof X.toString=="function"&&L.add(X.toString())})});let R=l.get(D)||new Map,z=d.iterator(v),H=new oo.Time;H.fromJSDate(new Date(Date.now()+dut));let Y,se=0,J=0;for(;(Y=z.next())&&se0));){let te=Y.toString();if(L.has(te))continue;let Te=`${_}-${J}`,Ce=R.get(te);if(Ce){let X=Ce.startDate,ne=Ce.endDate,st=Ce.component,Ue=st?this.rawTzidOf(st,"dtstart"):null,Vt=st?this.rawTzidOf(st,"dtend"):null;X&&(o.push({id:Te,subscriptionId:n,title:Ce.summary||f,description:Ce.description||h,start:this.icalTimeToISOString(X,Ue),end:ne?this.icalTimeToISOString(ne,Vt!=null?Vt:Ue):void 0,allDay:X.isDate,location:Ce.location||g,url:Ce.url||O.url,recurringEventId:_}),J++)}else{let X=this.icalTimeToISOString(Y,b),ne=C;if(C&&x&&!S){let st=new Date(C).getTime()-new Date(x).getTime();ne=new Date(new Date(X).getTime()+st).toISOString()}o.push({...O,id:Te,start:X,end:ne,recurringEventId:_}),J++}}}else o.push(O)}catch(d){PD.warn("Failed to parse individual event:",{category:"provider",operation:"parse-individual-event",error:d})}}),o}catch(i){throw PD.error("Failed to parse ICS data:",{category:"provider",operation:"parse-ics-data",error:i}),new Error("Invalid ICS format")}}getAllEvents(){let t=[],n=new Date;return this.subscriptions.forEach(i=>{if(!i.enabled)return;let a=this.cache.get(i.id);if(!a){this.pendingRefreshes.has(i.id)||(this.pendingRefreshes.add(i.id),this.fetchSubscription(i.id).finally(()=>this.pendingRefreshes.delete(i.id)));return}let s=new Date(a.expires),o=new Date(s.getTime()+this.CACHE_GRACE_PERIOD);ns&&!this.pendingRefreshes.has(i.id)&&(this.pendingRefreshes.add(i.id),this.fetchSubscription(i.id).finally(()=>this.pendingRefreshes.delete(i.id)))):this.pendingRefreshes.has(i.id)||(this.pendingRefreshes.add(i.id),this.fetchSubscription(i.id).finally(()=>this.pendingRefreshes.delete(i.id)))}),t}getEventsForSubscription(t){let n=this.cache.get(t);if(!n){let l=this.subscriptions.find(c=>c.id===t);return l&&l.enabled&&!this.pendingRefreshes.has(t)&&(this.pendingRefreshes.add(t),this.fetchSubscription(t).finally(()=>this.pendingRefreshes.delete(t))),[]}let i=new Date,a=new Date(n.expires),s=new Date(a.getTime()+this.CACHE_GRACE_PERIOD);return i>=s?(this.pendingRefreshes.has(t)||(this.pendingRefreshes.add(t),this.fetchSubscription(t).finally(()=>this.pendingRefreshes.delete(t))),[]):(i>a&&!this.pendingRefreshes.has(t)&&(this.pendingRefreshes.add(t),this.fetchSubscription(t).finally(()=>this.pendingRefreshes.delete(t))),[...n.events])}async refreshAllSubscriptions(){let t=this.subscriptions.filter(n=>n.enabled);for(let n of t)await this.fetchSubscription(n.id)}getVaultBasePath(){let t=this.plugin.app.vault.adapter;if(typeof(t==null?void 0:t.getBasePath)=="function")try{let n=t.getBasePath();return typeof n=="string"&&n.trim()?n:void 0}catch(n){PD.warn("Failed to resolve vault base path for local ICS file:",{category:"provider",operation:"resolve-vault-base-path-local-ics-file",error:n});return}}normalizePathSeparators(t){return t.trim().replace(/\\/g,"/").replace(/^\.\/+/u,"")}isAbsoluteFilePath(t){return t.startsWith("/")||/^[A-Za-z]:\//u.test(t)}normalizeLocalICSFilePath(t){let n=this.normalizePathSeparators(t);if(!this.isAbsoluteFilePath(n))return n;let i=this.getVaultBasePath();if(i){let a=this.normalizePathSeparators(i).replace(/\/+$/u,"");if(n.startsWith(`${a}/`))return n.slice(a.length+1)}throw new Error('Local ICS files must be inside the current Obsidian vault. Move the file into the vault or use a vault-relative path such as "Calendar.ics".')}normalizeLocalICSFilePathIfPossible(t){try{return this.normalizeLocalICSFilePath(t)}catch(n){return this.normalizePathSeparators(t)}}async readLocalICSFile(t){try{let n=this.normalizeLocalICSFilePath(t),i=this.plugin.app.vault.getAbstractFileByPath(n);if(!i||!(i instanceof JO.TFile))throw new Error(`File not found: ${n}`);if(i.extension!=="ics")throw new Error(`File is not an ICS file: ${n}`);return await this.plugin.app.vault.cachedRead(i)}catch(n){throw new Error(`Failed to read local ICS file "${t}": ${n instanceof Error?n.message:String(n)}`)}}startFileWatcher(t){if(!t.filePath)return;this.stopFileWatcher(t.id);let n=this.normalizeLocalICSFilePathIfPossible(t.filePath),i=(l,c)=>{(l.path===n||c===n)&&window.setTimeout(()=>{this.fetchSubscription(t.id)},1e3)},a=this.plugin.app.vault.on("modify",i),s=this.plugin.app.vault.on("rename",i),o=this.plugin.app.vault.on("delete",l=>{l.path===n&&this.lastError.set(t.id,"Local ICS file was deleted")});this.fileWatchers.set(t.id,()=>{this.plugin.app.vault.offref(a),this.plugin.app.vault.offref(s),this.plugin.app.vault.offref(o)}),this.startFileRefreshTimer(t)}stopFileWatcher(t){let n=this.fileWatchers.get(t);n&&(n(),this.fileWatchers.delete(t))}async refreshSubscription(t){await this.fetchSubscription(t)}startRefreshTimer(t){this.stopRefreshTimer(t.id),this.startRemoteRefreshTimer(t)}startFileRefreshTimer(t){let n=t.refreshInterval*60*1e3,i=window.setTimeout(()=>{this.refreshTimers.delete(t.id),this.fetchSubscription(t.id).finally(()=>{this.shouldContinueRefresh(t.id)&&this.startFileRefreshTimer(t)})},n);this.refreshTimers.set(t.id,i)}startRemoteRefreshTimer(t){let n=t.refreshInterval*60*1e3,i=window.setTimeout(()=>{this.refreshTimers.delete(t.id),this.fetchSubscription(t.id).finally(()=>{this.shouldContinueRefresh(t.id)&&this.startRemoteRefreshTimer(t)})},n);this.refreshTimers.set(t.id,i)}shouldContinueRefresh(t){return!this.destroyed&&this.subscriptions.some(n=>n.id===t&&n.enabled)}stopRefreshTimer(t){let n=this.refreshTimers.get(t);n&&(window.clearTimeout(n),this.refreshTimers.delete(t))}generateId(){return"ics_"+Math.random().toString(36).substring(2,11)+Date.now().toString(36)}destroy(){this.destroyed=!0,this.refreshTimers.forEach(t=>window.clearTimeout(t)),this.refreshTimers.clear(),this.fileWatchers.forEach(t=>t()),this.fileWatchers.clear(),this.cache.clear(),this.pendingRefreshes.clear(),this.removeAllListeners()}getLocalICSFiles(){return this.plugin.app.vault.getFiles().filter(t=>t.extension==="ics").sort((t,n)=>t.path.localeCompare(n.path))}}});var MD,ld,XO,H0e=y(()=>{MD=require("obsidian");Br();Kq();Ne();Eb();Ct();JN();G();ls();ld=I({tag:"Services/ICSNoteService"}),XO=class{constructor(e){this.plugin=e}translate(e,t){return this.plugin.i18n.translate(e,t)}findEventById(e){var s,o,l,c,d,u,p,m,f;let t=e.trim();if(!t)return null;let n=(s=this.plugin.icsSubscriptionService)==null?void 0:s.getAllEvents().find(h=>h.id===t);if(n){let h=(l=(o=this.plugin.icsSubscriptionService)==null?void 0:o.getSubscriptions().find(g=>g.id===n.subscriptionId))==null?void 0:l.name;return{event:n,subscriptionName:h}}let i=(c=this.plugin.googleCalendarService)==null?void 0:c.getAllEvents().find(h=>h.id===t);if(i){let h=i.subscriptionId.replace("google-",""),g=((u=(d=this.plugin.googleCalendarService)==null?void 0:d.getAvailableCalendars().find(v=>v.id===h))==null?void 0:u.summary)||"Google Calendar";return{event:i,subscriptionName:g}}let a=(p=this.plugin.microsoftCalendarService)==null?void 0:p.getAllEvents().find(h=>h.id===t);if(a){let h=a.subscriptionId.replace("microsoft-",""),g=((f=(m=this.plugin.microsoftCalendarService)==null?void 0:m.getAvailableCalendars().find(v=>v.id===h))==null?void 0:f.summary)||"Microsoft Calendar";return{event:a,subscriptionName:g}}return null}getLoadedCalendarEvents(){var e,t,n,i,a,s;return[...(t=(e=this.plugin.icsSubscriptionService)==null?void 0:e.getAllEvents())!=null?t:[],...(i=(n=this.plugin.googleCalendarService)==null?void 0:n.getAllEvents())!=null?i:[],...(s=(a=this.plugin.microsoftCalendarService)==null?void 0:a.getAllEvents())!=null?s:[]]}getExplicitSeriesId(e){var n;return((n=e.recurringEventId)==null?void 0:n.trim())||null}buildEventSeriesIndex(){let e=new Map;for(let i of this.getLoadedCalendarEvents()){let a=this.getExplicitSeriesId(i);if(!a)continue;let s=e.get(a);s||(s=new Set,e.set(a,s)),s.add(i.id)}let t=new Map,n=new Map;for(let[i,a]of e){n.set(i,a);for(let s of a)t.set(s,i)}return{seriesIdByEventId:t,eventIdsBySeriesId:n}}getRelatedEventIds(e,t){var s;let n=new Set([e]),i=t.seriesIdByEventId.get(e),a=t.eventIdsBySeriesId.has(e)?e:i;if(a){n.add(a);for(let o of(s=t.eventIdsBySeriesId.get(a))!=null?s:[])n.add(o)}return n}eventIdsMatchSeries(e,t,n){for(let i of this.getRelatedEventIds(e,n))if(t.has(i))return!0;return!1}async getRelatedNoteCountsByEventId(){let e=new Map,t=this.plugin.fieldMapper.toUserField("icsEventId"),n=this.buildEventSeriesIndex(),i=(a,s)=>{for(let o of this.normalizeEventIds(a))for(let l of this.getRelatedEventIds(o,n)){let c=e.get(l);c||(c=new Set,e.set(l,c)),c.add(s)}};try{let a=await this.plugin.cacheManager.getAllTasks();for(let o of a)i(o.icsEventId,o.path);let s=this.plugin.app.vault.getMarkdownFiles();for(let o of s){let l=this.plugin.app.metadataCache.getFileCache(o),c=l==null?void 0:l.frontmatter;c&&i(c[t],o.path)}}catch(a){return ld.error("Error counting related notes for ICS events:",{category:"provider",operation:"counting-related-notes-ics-events",error:a}),new Map}return new Map(Array.from(e.entries()).map(([a,s])=>[a,s.size]))}normalizeEventIds(e){return(Array.isArray(e)?e:e?[e]:[]).filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean)}async createTaskFromICS(e,t){var n;try{let i=this.plugin.icsSubscriptionService.getSubscriptions().find(l=>l.id===e.subscriptionId),a=(i==null?void 0:i.name)||"Unknown Calendar",s=(t==null?void 0:t.scheduled)!==void 0?t.scheduled:this.computeScheduledFromICSEvent(e),o={title:(t==null?void 0:t.title)||e.title,status:(t==null?void 0:t.status)||this.plugin.settings.defaultTaskStatus,priority:(t==null?void 0:t.priority)||this.plugin.settings.defaultTaskPriority,due:(t==null?void 0:t.due)!==void 0?t.due:(n=this.plugin.settings.icsIntegration)!=null&&n.useICSEndAsDue?this.computeDueFromICSEnd(e):void 0,scheduled:s,contexts:(t==null?void 0:t.contexts)||(e.location?[e.location]:void 0),projects:t==null?void 0:t.projects,tags:(t==null?void 0:t.tags)||[this.plugin.fieldMapper.toUserField("icsEventTag")],timeEstimate:(t==null?void 0:t.timeEstimate)||this.calculateEventDuration(e),details:(t==null?void 0:t.details)||this.buildICSEventDetails(e,a),icsEventId:[e.id],creationContext:"ics-event",dateCreated:Ye(),dateModified:Ye(),...Object.fromEntries(Object.entries(t||{}).filter(([l])=>l!=="due"))};return await this.plugin.taskService.createTask(o,{applyDefaults:!1})}catch(i){let a=i instanceof Error?i.message:String(i);throw ld.error("Error creating task from ICS event:",{category:"provider",operation:"creating-task-ics-event",details:{icsEventId:e.id,icsEventTitle:e.title},error:a}),new Error(`Failed to create task from ICS event: ${a}`)}}computeScheduledFromICSEvent(e){try{if(!e.start)return;let t=e.allDay&&/^\d{4}-\d{2}-\d{2}$/.test(e.start)?e.start+"T00:00:00":e.start,n=new Date(t);return e.allDay?ce(n):P(n,"yyyy-MM-dd'T'HH:mm")}catch(t){return ld.warn("Failed to compute scheduled from ICS event start:",{category:"provider",operation:"compute-scheduled-ics-event-start",details:{start:e.start},error:t}),e.start}}computeDueFromICSEnd(e){try{if(!e.end)return;if(e.allDay){if(!e.start)return;let i=/^\d{4}-\d{2}-\d{2}$/.test(e.start)?e.start+"T00:00:00":e.start,a=new Date(i);return ce(a)}let t=/^\d{4}-\d{2}-\d{2}$/.test(e.end)?e.end+"T00:00:00":e.end,n=new Date(t);return P(n,"yyyy-MM-dd'T'HH:mm")}catch(t){ld.warn("Failed to compute due from ICS event end:",{category:"provider",operation:"compute-due-ics-event-end",details:{end:e.end},error:t});return}}async createNoteFromICS(e,t){var n;try{let i=this.plugin.icsSubscriptionService.getSubscriptions().find(O=>O.id===e.subscriptionId),a=(i==null?void 0:i.name)||"Unknown Calendar",s=e.allDay&&/^\d{4}-\d{2}-\d{2}$/.test(e.start)?e.start+"T00:00:00":e.start,o=new Date(s),l=(t==null?void 0:t.title)||`${e.title} - ${P(o,"PPP")}`,c=(t==null?void 0:t.folder)||((n=this.plugin.settings.icsIntegration)==null?void 0:n.defaultNoteFolder)||"",d=eR(c,{date:o,icsData:{title:e.title,location:e.location,description:e.description}}),u={title:e.title,priority:"",status:"",date:o,dueDate:e.end,scheduledDate:e.start,icsEventTitle:e.title,icsEventLocation:e.location,icsEventDescription:e.description},p=Xke(u,this.plugin.settings),m=await Sb(p,d,this.plugin.app.vault),f=d?`${d}/${m}.md`:`${m}.md`;d&&await Ap(this.plugin.app.vault,d);let h={title:l,priority:"",status:"",contexts:e.location?[e.location]:[],tags:[this.plugin.fieldMapper.toUserField("icsEventTag")],timeEstimate:0,dueDate:e.end||"",scheduledDate:e.start||"",details:e.description||"",parentNote:"",icsEventTitle:e.title,icsEventStart:e.start,icsEventEnd:e.end||"",icsEventLocation:e.location||"",icsEventDescription:e.description||"",icsEventUrl:e.url||"",icsEventSubscription:a,icsEventId:e.id},g=this.plugin.fieldMapper.toUserField("dateCreated"),v=this.plugin.fieldMapper.toUserField("dateModified"),k={title:l,[g]:Ye(),[v]:Ye(),tags:[this.plugin.fieldMapper.toUserField("icsEventTag")],[this.plugin.fieldMapper.toUserField("icsEventId")]:[e.id]},b=this.buildICSEventDetails(e,a);if(t!=null&&t.template)try{let O=(0,MD.normalizePath)(t.template.trim()),L=this.plugin.app.vault.getAbstractFileByPath(O.endsWith(".md")?O:`${O}.md`);if(L instanceof MD.TFile){let N=await this.plugin.app.vault.read(L),R=QN(N,h);k={...k,...R.frontmatter},b=R.body||b}else ld.warn(`ICS note template not found: ${O}`,{category:"provider",operation:"ics-note-template-not-found"}),Ee(this.plugin.emitter,this.translate("services.icsNote.notices.templateNotFound",{path:O}))}catch(O){ld.error("Error processing ICS note template:",{category:"provider",operation:"processing-ics-note-template",error:O}),Ee(this.plugin.emitter,this.translate("services.icsNote.notices.templateProcessError",{template:t.template}))}let S=`${Object.keys(k).length>0?`--- +${Object.entries(k).map(([O,L])=>`${O}: ${this.formatYamlValue(L)}`).join(` +`)} +--- + +`:""}${b}`,x=await this.plugin.app.vault.create(f,S),C=Array.isArray(k.tags)?k.tags.filter(O=>typeof O=="string"):[],D=typeof k[g]=="string"?k[g]:void 0,_={title:l,path:x.path,tags:C,createdDate:D,lastModified:Date.now()};return{file:x,noteInfo:_}}catch(i){let a=i instanceof Error?i.message:String(i);throw ld.error("Error creating note from ICS event:",{category:"provider",operation:"creating-note-ics-event",details:{icsEventId:e.id,icsEventTitle:e.title},error:a}),new Error(`Failed to create note from ICS event: ${a}`)}}async findRelatedNotes(e){try{let t=[],n=new Set,i=this.plugin.fieldMapper.toUserField("icsEventId"),a=this.buildEventSeriesIndex(),s=this.getRelatedEventIds(e.id,a),o=d=>this.normalizeEventIds(d).some(u=>this.eventIdsMatchSeries(u,s,a)),l=await this.plugin.cacheManager.getAllTasks();for(let d of l)if(o(d.icsEventId)){if(n.has(d.path))continue;t.push(d),n.add(d.path)}let c=this.plugin.app.vault.getMarkdownFiles();for(let d of c)try{let u=this.plugin.app.metadataCache.getFileCache(d),p=u==null?void 0:u.frontmatter;if(p&&o(p[i])){if(n.has(d.path))continue;let m={title:p.title||d.basename,path:d.path,tags:p.tags||[],createdDate:p.dateCreated,lastModified:d.stat.mtime};t.push(m),n.add(d.path)}}catch(u){continue}return t}catch(t){return ld.error("Error finding related notes for ICS event:",{category:"provider",operation:"finding-related-notes-ics-event",error:t}),[]}}async linkNoteToICS(e,t){try{let n=this.plugin.app.vault.getAbstractFileByPath(e);if(!(n instanceof MD.TFile))throw new Error(`Cannot find note file: ${e}`);await this.plugin.app.fileManager.processFrontMatter(n,i=>{let a=this.plugin.fieldMapper.toUserField("icsEventId"),s=i[a];s?Array.isArray(s)||(s=[s]):s=[],s.includes(t.id)||s.push(t.id),i[a]=s;let o=this.plugin.fieldMapper.toUserField("dateModified");i[o]=Ye()}),Ee(this.plugin.emitter,this.translate("services.icsNote.notices.linkedToEvent",{title:t.title}))}catch(n){let i=n instanceof Error?n.message:String(n);throw ld.error("Error linking note to ICS event:",{category:"provider",operation:"linking-note-ics-event",details:{notePath:e,icsEventId:t.id},error:i}),new Error(`Failed to link note to ICS event: ${i}`)}}buildICSEventDetails(e,t){let n=[];if(n.push(`# ${e.title}`),n.push(""),e.start){let i=e.allDay&&/^\d{4}-\d{2}-\d{2}$/.test(e.start)?e.start+"T00:00:00":e.start,a=new Date(i);n.push(`**Start:** ${P(a,"PPPp")}`)}if(e.end&&!e.allDay){let i=/^\d{4}-\d{2}-\d{2}$/.test(e.end)?e.end+"T00:00:00":e.end,a=new Date(i);n.push(`**End:** ${P(a,"PPPp")}`)}return e.location&&n.push(`**Location:** ${e.location}`),n.push(`**Calendar:** ${t}`),e.description&&(n.push(""),n.push("## Description"),n.push(e.description)),e.url&&(n.push(""),n.push(`**Event URL:** ${e.url}`)),n.join(` +`)}formatYamlValue(e){return typeof e=="string"?e.includes(":")||e.includes("#")||e.includes("[")||e.includes("{")?`"${e.replace(/"/g,'\\"')}"`:e:Array.isArray(e)?`[${e.map(t=>typeof t=="string"?`"${t}"`:t).join(", ")}]`:String(e)}calculateEventDuration(e){if(!(!e.start||!e.end))try{let t=e.allDay&&/^\d{4}-\d{2}-\d{2}$/.test(e.start)?e.start+"T00:00:00":e.start,n=e.allDay&&/^\d{4}-\d{2}-\d{2}$/.test(e.end)?e.end+"T00:00:00":e.end,i=new Date(t).getTime(),a=new Date(n).getTime();if(isNaN(i)||isNaN(a))return;let s=a-i,o=Math.round(s/(1e3*60));return o>0&&o<1440?o:void 0}catch(t){ld.warn("Error calculating event duration:",{category:"provider",operation:"calculating-event-duration",error:t});return}}}});var eL,ql,LT,EOr,FT=y(()=>{eL={TOKEN_REFRESH_BUFFER_MS:3e5,CALLBACK_PORT_START:8080,CALLBACK_PORT_END:8090},ql={REFRESH_INTERVAL_MS:900*1e3,MIN_MANUAL_REFRESH_INTERVAL_MS:30*1e3,MAX_RESULTS_PER_REQUEST:2500,VIEW_RANGE:{DAYS_BEFORE:30,DAYS_AFTER:90},DEFAULT_EVENT_DURATION_MS:3600*1e3,MAX_REMINDER_MINUTES:40320,RATE_LIMIT:{MAX_RETRIES:3,INITIAL_BACKOFF_MS:1e3,MAX_BACKOFF_MS:16e3,BACKOFF_MULTIPLIER:2}},LT={REFRESH_INTERVAL_MS:900*1e3,MIN_MANUAL_REFRESH_INTERVAL_MS:30*1e3,MAX_RESULTS_PER_REQUEST:50,VIEW_RANGE:{DAYS_BEFORE:30,DAYS_AFTER:90},DEFAULT_EVENT_DURATION_MS:3600*1e3,RATE_LIMIT:{MAX_RETRIES:3,INITIAL_BACKOFF_MS:1e3,MAX_BACKOFF_MS:16e3,BACKOFF_MULTIPLIER:2}},EOr={SECOND_MS:1e3,MINUTE_MS:60*1e3,HOUR_MS:3600*1e3,DAY_MS:1440*60*1e3}});var _D,AD,ys,Pg,ID,Bi,jm,$T,Yo,Mg,zT=y(()=>{_D=class extends Error{constructor(t,n){super(t);this.code=n;this.name="TaskNotesServiceError",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},AD=class extends _D{constructor(t,n,i){super(t,i);this.provider=n;this.name="OAuthError"}},ys=class extends AD{constructor(e){super(`${e} authentication expired. Please reconnect.`,e,"TOKEN_EXPIRED"),this.name="TokenExpiredError"}},Pg=class extends AD{constructor(t,n,i){let a=`${t} connection expired. Please reconnect in Settings > Integrations.`;super(a,t,"TOKEN_REFRESH_FAILED");this.oauthErrorCode=n;this.oauthErrorDescription=i;this.name="TokenRefreshError"}},ID=class extends AD{constructor(e){super(`${e} OAuth is not configured. Please provide OAuth credentials in settings.`,e,"NOT_CONFIGURED"),this.name="OAuthNotConfiguredError"}},Bi=class extends _D{constructor(t,n,i){super(t,i);this.statusCode=n;this.name="GoogleCalendarError"}},jm=class extends Bi{constructor(e){super(`Calendar event not found: ${e}`,404,"EVENT_NOT_FOUND"),this.name="EventNotFoundError"}},$T=class extends Bi{constructor(e){super(`Calendar not found: ${e}`,404,"CALENDAR_NOT_FOUND"),this.name="CalendarNotFoundError"}},Yo=class extends Bi{constructor(e){let t=e?`Rate limit exceeded. Retry after ${e} seconds.`:"Rate limit exceeded. Please try again later.";super(t,429,"RATE_LIMIT"),this.name="RateLimitError"}},Mg=class extends _D{constructor(t,n){super(t,"VALIDATION_ERROR");this.field=n;this.name="ValidationError"}}});function V0e(){if(!_g.Platform.isDesktopApp)throw new Error("OAuth redirect handling is only available on desktop.");return M3||(M3=require("http")),M3}var _g,Wl,M3,tL,q0e=y(()=>{_g=require("obsidian");FT();zT();G();ls();Wl=I({tag:"Services/OAuthService"}),M3=null;tL=class{constructor(e){this.callbackServer=null;this.pendingOAuthState=new Map;this.tokenRefreshPromises=new Map;this.configs={google:{provider:"google",clientId:"",redirectUri:"http://127.0.0.1:8080",scope:["https://www.googleapis.com/auth/calendar.readonly","https://www.googleapis.com/auth/calendar.events"],authorizationEndpoint:"https://accounts.google.com/o/oauth2/v2/auth",tokenEndpoint:"https://oauth2.googleapis.com/token",deviceCodeEndpoint:"https://oauth2.googleapis.com/device/code",revocationEndpoint:"https://oauth2.googleapis.com/revoke"},microsoft:{provider:"microsoft",clientId:"",redirectUri:"http://localhost:8080",scope:["Calendars.Read","Calendars.ReadWrite","offline_access"],authorizationEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/token",deviceCodeEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/devicecode",revocationEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/logout"}};this.plugin=e,this.loadClientIds()}async loadClientIds(){this.configs.google.clientId=this.plugin.settings.googleOAuthClientId||"",this.configs.google.clientSecret=this.plugin.settings.googleOAuthClientSecret||"",this.configs.microsoft.clientId=this.plugin.settings.microsoftOAuthClientId||"",this.configs.microsoft.clientSecret=this.plugin.settings.microsoftOAuthClientSecret||""}async authenticate(e){if(!this.configs[e].clientId)throw new ID(e);if(!(e==="google"&&this.plugin.settings.googleOAuthClientId||e==="microsoft"&&this.plugin.settings.microsoftOAuthClientId))throw new ID(e);return await this.authenticateStandard(e)}async authenticateStandard(e){try{let t=this.configs[e];if(!_g.Platform.isDesktopApp)throw Ee(this.plugin.emitter,"OAUTH authentication requires the desktop app."),new Error("OAuth authentication requires the desktop app.");let n=this.generateCodeVerifier(),i=await this.generateCodeChallenge(n),a=this.generateState(),s=await this.findAvailablePort(eL.CALLBACK_PORT_START,eL.CALLBACK_PORT_END);await this.startCallbackServer(s);let o=t.redirectUri;t.redirectUri=`http://127.0.0.1:${s}`;try{let l=this.buildAuthorizationUrl(t,i,a);this.pendingOAuthState.set(a,{provider:e,codeVerifier:n,resolve:()=>{},reject:()=>{}}),Ee(this.plugin.emitter,`Opening browser for ${e} authorization...`),window.open(l,"_blank");let c=await this.waitForCallback(a,3e5),d=await this.exchangeCodeForTokens(t,c,n);await this.storeConnection(e,d),Ee(this.plugin.emitter,`Successfully connected to ${e} Calendar!`)}finally{t.redirectUri=o}}catch(t){throw Wl.error(`OAuth authentication failed for ${e}:`,{category:"provider",operation:"oauth-authentication",error:t}),Ee(this.plugin.emitter,`Failed to connect to ${e}: ${t.message}`),t}finally{await this.stopCallbackServer()}}async findAvailablePort(e,t){let n=V0e();for(let i=e;i<=t;i++)try{return await new Promise((a,s)=>{let o=n.createServer();o.once("error",s),o.once("listening",()=>{o.close(),a()}),o.listen(i,"127.0.0.1")}),i}catch(a){continue}throw new Error(`No available ports found between ${e} and ${t}`)}generateCodeVerifier(){return this.base64UrlEncode(crypto.getRandomValues(new Uint8Array(32)))}async generateCodeChallenge(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return this.base64UrlEncode(new Uint8Array(n))}generateState(){return Array.from(crypto.getRandomValues(new Uint8Array(16))).map(e=>e.toString(16).padStart(2,"0")).join("")}base64UrlEncode(e){let t="";return e.forEach(n=>{t+=String.fromCharCode(n)}),btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}buildAuthorizationUrl(e,t,n){let i=new URLSearchParams({client_id:e.clientId,redirect_uri:e.redirectUri,response_type:"code",scope:e.scope.join(" "),state:n,code_challenge:t,code_challenge_method:"S256"});return e.provider==="google"&&(i.set("access_type","offline"),i.set("prompt","consent")),`${e.authorizationEndpoint}?${i.toString()}`}async startCallbackServer(e){return new Promise((t,n)=>{if(this.callbackServer){t();return}let i;try{i=V0e()}catch(a){n(a instanceof Error?a:new Error(String(a)));return}this.callbackServer=i.createServer((a,s)=>{this.handleCallback(a,s)}),this.callbackServer.once("error",a=>{Wl.error("OAuth callback server error:",{category:"provider",operation:"oauth-callback-server",error:a}),n(a)}),this.callbackServer.listen(e,"127.0.0.1",()=>{t()})})}async stopCallbackServer(){return new Promise(e=>{if(!this.callbackServer){e();return}this.callbackServer.close(()=>{this.callbackServer=null,e()})})}handleCallback(e,t){let n=e.headers.host,i=Array.isArray(n)?n[0]:n!=null?n:"localhost",a=new URL(e.url||"",`http://${i}`),s=a.searchParams.get("code"),o=a.searchParams.get("state"),l=a.searchParams.get("error");if(t.writeHead(200,{"Content-Type":"text/html"}),l){t.end(` + + + OAuth Error + +

Authorization Failed

+

Error: ${l}

+

You can close this window.

+ + + `);let d=o?this.pendingOAuthState.get(o):null;d&&o&&(d.reject(new Error(`OAuth error: ${l}`)),this.pendingOAuthState.delete(o));return}if(!s||!o){t.end(` + + + OAuth Error + +

Invalid Callback

+

Missing required parameters.

+

You can close this window.

+ + + `);return}t.end(` + + + OAuth Success + +

Authorization Successful!

+

You can close this window and return to Obsidian.

+