/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ (function initCjs() { const globalThisRecord = globalThis; globalThisRecord["__name"] ??= name; const originalRequire = require; if (originalRequire && !originalRequire.__isPatched) { require = Object.assign( (id) => requirePatched(id), originalRequire, { __isPatched: true } ); } const newFuncs = { __extractDefault() { return extractDefault; }, process() { const browserProcess = { browser: true, cwd() { return "/"; }, env: {}, platform: "android" }; return browserProcess; } }; for (const key of Object.keys(newFuncs)) { globalThisRecord[key] ??= newFuncs[key]?.(); } function name(obj) { return obj; } function extractDefault(module) { return module && module.__esModule && "default" in module ? module.default : module; } const OBSIDIAN_BUILT_IN_MODULE_NAMES = [ "obsidian", "@codemirror/autocomplete", "@codemirror/collab", "@codemirror/commands", "@codemirror/language", "@codemirror/lint", "@codemirror/search", "@codemirror/state", "@codemirror/text", "@codemirror/view", "@lezer/common", "@lezer/lr", "@lezer/highlight" ]; const DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES = [ "@codemirror/closebrackets", "@codemirror/comment", "@codemirror/fold", "@codemirror/gutter", "@codemirror/highlight", "@codemirror/history", "@codemirror/matchbrackets", "@codemirror/panel", "@codemirror/rangeset", "@codemirror/rectangular-selection", "@codemirror/stream-parser", "@codemirror/tooltip" ]; function requirePatched(id) { if (OBSIDIAN_BUILT_IN_MODULE_NAMES.includes(id) || DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES.includes(id)) { return originalRequire?.(id); } if (globalThis.app.isMobile) { if (id === "process" || id === "node:process") { console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Fake process object is returned instead.`); return globalThis.process; } } else { const module = originalRequire?.(id); if (module) { return extractDefault(module); } } console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Empty object is returned instead.`); return {}; } })(); "use strict"; var pf = Object.create; var Ln = Object.defineProperty; var hf = Object.getOwnPropertyDescriptor; var mf = Object.getOwnPropertyNames; var gf = Object.getPrototypeOf, wf = Object.prototype.hasOwnProperty; var i = (t, e) => Ln(t, "name", {value: e, configurable: !0}); var He = (t, e) => () => (e || t((e = {exports: {}}).exports, e), e.exports), ra = (t, e) => { for (var n in e) Ln(t, n, {get: e[n], enumerable: !0}) }, ia = (t, e, n, r) => { if (e && typeof e == "object" || typeof e == "function") for (let o of mf(e)) !wf.call(t, o) && o !== n && Ln(t, o, { get: () => e[o], enumerable: !(r = hf(e, o)) || r.enumerable }); return t }; var qt = (t, e, n) => (n = t != null ? pf(gf(t)) : {}, ia(e || !t || !t.__esModule ? Ln(n, "default", { value: t, enumerable: !0 }) : n, t)), bf = t => ia(Ln({}, "__esModule", {value: !0}), t); var pa = He((Xw, da) => { var Yt = 1e3, Qt = Yt * 60, Xt = Qt * 60, Lt = Xt * 24, np = Lt * 7, rp = Lt * 365.25; da.exports = function (t, e) { e = e || {}; var n = typeof t; if (n === "string" && t.length > 0) return ip(t); if (n === "number" && isFinite(t)) return e.long ? sp(t) : op(t); throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(t)) }; function ip(t) { if (t = String(t), !(t.length > 100)) { var e = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t); if (e) { var n = parseFloat(e[1]), r = (e[2] || "ms").toLowerCase(); switch (r) { case"years": case"year": case"yrs": case"yr": case"y": return n * rp; case"weeks": case"week": case"w": return n * np; case"days": case"day": case"d": return n * Lt; case"hours": case"hour": case"hrs": case"hr": case"h": return n * Xt; case"minutes": case"minute": case"mins": case"min": case"m": return n * Qt; case"seconds": case"second": case"secs": case"sec": case"s": return n * Yt; case"milliseconds": case"millisecond": case"msecs": case"msec": case"ms": return n; default: return } } } } i(ip, "parse"); function op(t) { var e = Math.abs(t); return e >= Lt ? Math.round(t / Lt) + "d" : e >= Xt ? Math.round(t / Xt) + "h" : e >= Qt ? Math.round(t / Qt) + "m" : e >= Yt ? Math.round(t / Yt) + "s" : t + "ms" } i(op, "fmtShort"); function sp(t) { var e = Math.abs(t); return e >= Lt ? cr(t, e, Lt, "day") : e >= Xt ? cr(t, e, Xt, "hour") : e >= Qt ? cr(t, e, Qt, "minute") : e >= Yt ? cr(t, e, Yt, "second") : t + " ms" } i(sp, "fmtLong"); function cr(t, e, n, r) { var o = e >= n * 1.5; return Math.round(t / n) + " " + r + (o ? "s" : "") } i(cr, "plural") }); var Yi = He((e0, ha) => { function ap(t) { n.debug = n, n.default = n, n.coerce = u, n.disable = a, n.enable = o, n.enabled = l, n.humanize = pa(), n.destroy = c, Object.keys(t).forEach(f => { n[f] = t[f] }), n.names = [], n.skips = [], n.formatters = {}; function e(f) { let d = 0; for (let h = 0; h < f.length; h++) d = (d << 5) - d + f.charCodeAt(h), d |= 0; return n.colors[Math.abs(d) % n.colors.length] } i(e, "selectColor"), n.selectColor = e; function n(f) { let d, h = null, p, w; function y(...b) { if (!y.enabled) return; let k = y, x = Number(new Date), v = x - (d || x); k.diff = v, k.prev = d, k.curr = x, d = x, b[0] = n.coerce(b[0]), typeof b[0] != "string" && b.unshift("%O"); let P = 0; b[0] = b[0].replace(/%([a-zA-Z%])/g, (C, O) => { if (C === "%%") return "%"; P++; let W = n.formatters[O]; if (typeof W == "function") { let I = b[P]; C = W.call(k, I), b.splice(P, 1), P-- } return C }), n.formatArgs.call(k, b), (k.log || n.log).apply(k, b) } return i(y, "debug"), y.namespace = f, y.useColors = n.useColors(), y.color = n.selectColor(f), y.extend = r, y.destroy = n.destroy, Object.defineProperty(y, "enabled", { enumerable: !0, configurable: !1, get: i(() => h !== null ? h : (p !== n.namespaces && (p = n.namespaces, w = n.enabled(f)), w), "get"), set: i(b => { h = b }, "set") }), typeof n.init == "function" && n.init(y), y } i(n, "createDebug"); function r(f, d) { let h = n(this.namespace + (typeof d > "u" ? ":" : d) + f); return h.log = this.log, h } i(r, "extend"); function o(f) { n.save(f), n.namespaces = f, n.names = [], n.skips = []; let d = (typeof f == "string" ? f : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean); for (let h of d) h[0] === "-" ? n.skips.push(h.slice(1)) : n.names.push(h) } i(o, "enable"); function s(f, d) { let h = 0, p = 0, w = -1, y = 0; for (; h < f.length;) if (p < d.length && (d[p] === f[h] || d[p] === "*")) d[p] === "*" ? (w = p, y = h, p++) : (h++, p++); else if (w !== -1) p = w + 1, y++, h = y; else return !1; for (; p < d.length && d[p] === "*";) p++; return p === d.length } i(s, "matchesTemplate"); function a() { let f = [...n.names, ...n.skips.map(d => "-" + d)].join(","); return n.enable(""), f } i(a, "disable"); function l(f) { for (let d of n.skips) if (s(f, d)) return !1; for (let d of n.names) if (s(f, d)) return !0; return !1 } i(l, "enabled"); function u(f) { return f instanceof Error ? f.stack || f.message : f } i(u, "coerce"); function c() { console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.") } return i(c, "destroy"), n.enable(n.load()), n } i(ap, "setup"); ha.exports = ap }); var ma = He((ye, fr) => { ye.formatArgs = up; ye.save = cp; ye.load = fp; ye.useColors = lp; ye.storage = dp(); ye.destroy = (() => { let t = !1; return () => { t || (t = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")) } })(); ye.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"]; function lp() { if (typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return !0; if (typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1; let t; return typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator < "u" && navigator.userAgent && (t = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(t[1], 10) >= 31 || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/) } i(lp, "useColors"); function up(t) { if (t[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + t[0] + (this.useColors ? "%c " : " ") + "+" + fr.exports.humanize(this.diff), !this.useColors) return; let e = "color: " + this.color; t.splice(1, 0, e, "color: inherit"); let n = 0, r = 0; t[0].replace(/%[a-zA-Z%]/g, o => { o !== "%%" && (n++, o === "%c" && (r = n)) }), t.splice(r, 0, e) } i(up, "formatArgs"); ye.log = console.debug || console.log || (() => { }); function cp(t) { try { t ? ye.storage.setItem("debug", t) : ye.storage.removeItem("debug") } catch { } } i(cp, "save"); function fp() { let t; try { t = ye.storage.getItem("debug") || ye.storage.getItem("DEBUG") } catch { } return !t && typeof process < "u" && "env" in process && (t = process.env.DEBUG), t } i(fp, "load"); function dp() { try { return localStorage } catch { } } i(dp, "localstorage"); fr.exports = Yi()(ye); var {formatters: pp} = fr.exports; pp.j = function (t) { try { return JSON.stringify(t) } catch (e) { return "[UnexpectedJSONParseError]: " + e.message } } }); var wa = He((r0, ga) => { "use strict"; ga.exports = (t, e = process.argv) => { let n = t.startsWith("-") ? "" : t.length === 1 ? "-" : "--", r = e.indexOf(n + t), o = e.indexOf("--"); return r !== -1 && (o === -1 || r < o) } }); var ya = He((i0, ka) => { "use strict"; var hp = require("os"), ba = require("tty"), Ne = wa(), {env: Q} = process, dt; Ne("no-color") || Ne("no-colors") || Ne("color=false") || Ne("color=never") ? dt = 0 : (Ne("color") || Ne("colors") || Ne("color=true") || Ne("color=always")) && (dt = 1); "FORCE_COLOR" in Q && (Q.FORCE_COLOR === "true" ? dt = 1 : Q.FORCE_COLOR === "false" ? dt = 0 : dt = Q.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(Q.FORCE_COLOR, 10), 3)); function Qi(t) { return t === 0 ? !1 : {level: t, hasBasic: !0, has256: t >= 2, has16m: t >= 3} } i(Qi, "translateLevel"); function Xi(t, e) { if (dt === 0) return 0; if (Ne("color=16m") || Ne("color=full") || Ne("color=truecolor")) return 3; if (Ne("color=256")) return 2; if (t && !e && dt === void 0) return 0; let n = dt || 0; if (Q.TERM === "dumb") return n; if (process.platform === "win32") { let r = hp.release().split("."); return Number(r[0]) >= 10 && Number(r[2]) >= 10586 ? Number(r[2]) >= 14931 ? 3 : 2 : 1 } if ("CI" in Q) return ["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some(r => r in Q) || Q.CI_NAME === "codeship" ? 1 : n; if ("TEAMCITY_VERSION" in Q) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Q.TEAMCITY_VERSION) ? 1 : 0; if (Q.COLORTERM === "truecolor") return 3; if ("TERM_PROGRAM" in Q) { let r = parseInt((Q.TERM_PROGRAM_VERSION || "").split(".")[0], 10); switch (Q.TERM_PROGRAM) { case"iTerm.app": return r >= 3 ? 3 : 2; case"Apple_Terminal": return 2 } } return /-256(color)?$/i.test(Q.TERM) ? 2 : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Q.TERM) || "COLORTERM" in Q ? 1 : n } i(Xi, "supportsColor"); function mp(t) { let e = Xi(t, t && t.isTTY); return Qi(e) } i(mp, "getSupportLevel"); ka.exports = {supportsColor: mp, stdout: Qi(Xi(!0, ba.isatty(1))), stderr: Qi(Xi(!0, ba.isatty(2)))} }); var xa = He((X, pr) => { var gp = require("tty"), dr = require("util"); X.init = Ap; X.log = yp; X.formatArgs = bp; X.save = Cp; X.load = xp; X.useColors = wp; X.destroy = dr.deprecate(() => { }, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); X.colors = [6, 2, 3, 4, 5, 1]; try { let t = ya(); t && (t.stderr || t).level >= 2 && (X.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221]) } catch { } X.inspectOpts = Object.keys(process.env).filter(t => /^debug_/i.test(t)).reduce((t, e) => { let n = e.substring(6).toLowerCase().replace(/_([a-z])/g, (o, s) => s.toUpperCase()), r = process.env[e]; return /^(yes|on|true|enabled)$/i.test(r) ? r = !0 : /^(no|off|false|disabled)$/i.test(r) ? r = !1 : r === "null" ? r = null : r = Number(r), t[n] = r, t }, {}); function wp() { return "colors" in X.inspectOpts ? !!X.inspectOpts.colors : gp.isatty(process.stderr.fd) } i(wp, "useColors"); function bp(t) { let {namespace: e, useColors: n} = this; if (n) { let r = this.color, o = "\x1B[3" + (r < 8 ? r : "8;5;" + r), s = ` ${o};1m${e} \x1B[0m`; t[0] = s + t[0].split(` `).join(` ` + s), t.push(o + "m+" + pr.exports.humanize(this.diff) + "\x1B[0m") } else t[0] = kp() + e + " " + t[0] } i(bp, "formatArgs"); function kp() { return X.inspectOpts.hideDate ? "" : new Date().toISOString() + " " } i(kp, "getDate"); function yp(...t) { return process.stderr.write(dr.formatWithOptions(X.inspectOpts, ...t) + ` `) } i(yp, "log"); function Cp(t) { t ? process.env.DEBUG = t : delete process.env.DEBUG } i(Cp, "save"); function xp() { return process.env.DEBUG } i(xp, "load"); function Ap(t) { t.inspectOpts = {}; let e = Object.keys(X.inspectOpts); for (let n = 0; n < e.length; n++) t.inspectOpts[e[n]] = X.inspectOpts[e[n]] } i(Ap, "init"); pr.exports = Yi()(X); var {formatters: Ca} = pr.exports; Ca.o = function (t) { return this.inspectOpts.colors = this.useColors, dr.inspect(t, this.inspectOpts).split(` `).map(e => e.trim()).join(" ") }; Ca.O = function (t) { return this.inspectOpts.colors = this.useColors, dr.inspect(t, this.inspectOpts) } }); var Aa = He((a0, Zi) => { typeof process > "u" || process.type === "renderer" || process.browser === !0 || process.__nwjs ? Zi.exports = ma() : Zi.exports = xa() }); var ll = He((Yb, al) => { "use strict"; function Ye(t) { if (typeof t != "string") throw new TypeError("Path must be a string. Received " + JSON.stringify(t)) } i(Ye, "assertPath"); function sl(t, e) { for (var n = "", r = 0, o = -1, s = 0, a, l = 0; l <= t.length; ++l) { if (l < t.length) a = t.charCodeAt(l); else { if (a === 47) break; a = 47 } if (a === 47) { if (!(o === l - 1 || s === 1)) if (o !== l - 1 && s === 2) { if (n.length < 2 || r !== 2 || n.charCodeAt(n.length - 1) !== 46 || n.charCodeAt(n.length - 2) !== 46) { if (n.length > 2) { var u = n.lastIndexOf("/"); if (u !== n.length - 1) { u === -1 ? (n = "", r = 0) : (n = n.slice(0, u), r = n.length - 1 - n.lastIndexOf("/")), o = l, s = 0; continue } } else if (n.length === 2 || n.length === 1) { n = "", r = 0, o = l, s = 0; continue } } e && (n.length > 0 ? n += "/.." : n = "..", r = 2) } else n.length > 0 ? n += "/" + t.slice(o + 1, l) : n = t.slice(o + 1, l), r = l - o - 1; o = l, s = 0 } else a === 46 && s !== -1 ? ++s : s = -1 } return n } i(sl, "normalizeStringPosix"); function ph(t, e) { var n = e.dir || e.root, r = e.base || (e.name || "") + (e.ext || ""); return n ? n === e.root ? n + r : n + t + r : r } i(ph, "_format"); var un = { resolve: i(function () { for (var e = "", n = !1, r, o = arguments.length - 1; o >= -1 && !n; o--) { var s; o >= 0 ? s = arguments[o] : (r === void 0 && (r = process.cwd()), s = r), Ye(s), s.length !== 0 && (e = s + "/" + e, n = s.charCodeAt(0) === 47) } return e = sl(e, !n), n ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : "." }, "resolve"), normalize: i(function (e) { if (Ye(e), e.length === 0) return "."; var n = e.charCodeAt(0) === 47, r = e.charCodeAt(e.length - 1) === 47; return e = sl(e, !n), e.length === 0 && !n && (e = "."), e.length > 0 && r && (e += "/"), n ? "/" + e : e }, "normalize"), isAbsolute: i(function (e) { return Ye(e), e.length > 0 && e.charCodeAt(0) === 47 }, "isAbsolute"), join: i(function () { if (arguments.length === 0) return "."; for (var e, n = 0; n < arguments.length; ++n) { var r = arguments[n]; Ye(r), r.length > 0 && (e === void 0 ? e = r : e += "/" + r) } return e === void 0 ? "." : un.normalize(e) }, "join"), relative: i(function (e, n) { if (Ye(e), Ye(n), e === n || (e = un.resolve(e), n = un.resolve(n), e === n)) return ""; for (var r = 1; r < e.length && e.charCodeAt(r) === 47; ++r) ; for (var o = e.length, s = o - r, a = 1; a < n.length && n.charCodeAt(a) === 47; ++a) ; for (var l = n.length, u = l - a, c = s < u ? s : u, f = -1, d = 0; d <= c; ++d) { if (d === c) { if (u > c) { if (n.charCodeAt(a + d) === 47) return n.slice(a + d + 1); if (d === 0) return n.slice(a + d) } else s > c && (e.charCodeAt(r + d) === 47 ? f = d : d === 0 && (f = 0)); break } var h = e.charCodeAt(r + d), p = n.charCodeAt(a + d); if (h !== p) break; h === 47 && (f = d) } var w = ""; for (d = r + f + 1; d <= o; ++d) (d === o || e.charCodeAt(d) === 47) && (w.length === 0 ? w += ".." : w += "/.."); return w.length > 0 ? w + n.slice(a + f) : (a += f, n.charCodeAt(a) === 47 && ++a, n.slice(a)) }, "relative"), _makeLong: i(function (e) { return e }, "_makeLong"), dirname: i(function (e) { if (Ye(e), e.length === 0) return "."; for (var n = e.charCodeAt(0), r = n === 47, o = -1, s = !0, a = e.length - 1; a >= 1; --a) if (n = e.charCodeAt(a), n === 47) { if (!s) { o = a; break } } else s = !1; return o === -1 ? r ? "/" : "." : r && o === 1 ? "//" : e.slice(0, o) }, "dirname"), basename: i(function (e, n) { if (n !== void 0 && typeof n != "string") throw new TypeError('"ext" argument must be a string'); Ye(e); var r = 0, o = -1, s = !0, a; if (n !== void 0 && n.length > 0 && n.length <= e.length) { if (n.length === e.length && n === e) return ""; var l = n.length - 1, u = -1; for (a = e.length - 1; a >= 0; --a) { var c = e.charCodeAt(a); if (c === 47) { if (!s) { r = a + 1; break } } else u === -1 && (s = !1, u = a + 1), l >= 0 && (c === n.charCodeAt(l) ? --l === -1 && (o = a) : (l = -1, o = u)) } return r === o ? o = u : o === -1 && (o = e.length), e.slice(r, o) } else { for (a = e.length - 1; a >= 0; --a) if (e.charCodeAt(a) === 47) { if (!s) { r = a + 1; break } } else o === -1 && (s = !1, o = a + 1); return o === -1 ? "" : e.slice(r, o) } }, "basename"), extname: i(function (e) { Ye(e); for (var n = -1, r = 0, o = -1, s = !0, a = 0, l = e.length - 1; l >= 0; --l) { var u = e.charCodeAt(l); if (u === 47) { if (!s) { r = l + 1; break } continue } o === -1 && (s = !1, o = l + 1), u === 46 ? n === -1 ? n = l : a !== 1 && (a = 1) : n !== -1 && (a = -1) } return n === -1 || o === -1 || a === 0 || a === 1 && n === o - 1 && n === r + 1 ? "" : e.slice(n, o) }, "extname"), format: i(function (e) { if (e === null || typeof e != "object") throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof e); return ph("/", e) }, "format"), parse: i(function (e) { Ye(e); var n = {root: "", dir: "", base: "", ext: "", name: ""}; if (e.length === 0) return n; var r = e.charCodeAt(0), o = r === 47, s; o ? (n.root = "/", s = 1) : s = 0; for (var a = -1, l = 0, u = -1, c = !0, f = e.length - 1, d = 0; f >= s; --f) { if (r = e.charCodeAt(f), r === 47) { if (!c) { l = f + 1; break } continue } u === -1 && (c = !1, u = f + 1), r === 46 ? a === -1 ? a = f : d !== 1 && (d = 1) : a !== -1 && (d = -1) } return a === -1 || u === -1 || d === 0 || d === 1 && a === u - 1 && a === l + 1 ? u !== -1 && (l === 0 && o ? n.base = n.name = e.slice(1, u) : n.base = n.name = e.slice(l, u)) : (l === 0 && o ? (n.name = e.slice(1, a), n.base = e.slice(1, u)) : (n.name = e.slice(l, a), n.base = e.slice(l, u)), n.ext = e.slice(a, u)), l > 0 ? n.dir = e.slice(0, l - 1) : o && (n.dir = "/"), n }, "parse"), sep: "/", delimiter: ":", win32: null, posix: null }; un.posix = un; al.exports = un }); var Nu = He((hE, Ou) => { "use strict"; var ni = Object.prototype.hasOwnProperty, Ru = Object.prototype.toString, Pu = Object.defineProperty, Tu = Object.getOwnPropertyDescriptor, Fu = i(function (e) { return typeof Array.isArray == "function" ? Array.isArray(e) : Ru.call(e) === "[object Array]" }, "isArray"), Lu = i(function (e) { if (!e || Ru.call(e) !== "[object Object]") return !1; var n = ni.call(e, "constructor"), r = e.constructor && e.constructor.prototype && ni.call(e.constructor.prototype, "isPrototypeOf"); if (e.constructor && !n && !r) return !1; var o; for (o in e) ; return typeof o > "u" || ni.call(e, o) }, "isPlainObject"), Iu = i(function (e, n) { Pu && n.name === "__proto__" ? Pu(e, n.name, { enumerable: !0, configurable: !0, value: n.newValue, writable: !0 }) : e[n.name] = n.newValue }, "setProperty"), Mu = i(function (e, n) { if (n === "__proto__") if (ni.call(e, n)) { if (Tu) return Tu(e, n).value } else return; return e[n] }, "getProperty"); Ou.exports = i(function t() { var e, n, r, o, s, a, l = arguments[0], u = 1, c = arguments.length, f = !1; for (typeof l == "boolean" && (f = l, l = arguments[1] || {}, u = 2), (l == null || typeof l != "object" && typeof l != "function") && (l = {}); u < c; ++u) if (e = arguments[u], e != null) for (n in e) r = Mu(l, n), o = Mu(e, n), l !== o && (f && o && (Lu(o) || (s = Fu(o))) ? (s ? (s = !1, a = r && Fu(r) ? r : []) : a = r && Lu(r) ? r : {}, Iu(l, { name: n, newValue: t(f, a, o) })) : typeof o < "u" && Iu(l, {name: n, newValue: o})); return l }, "extend") }); var Mc = He((xi, Ic) => { (function (t, e) { typeof xi == "object" && typeof Ic < "u" ? e(xi) : typeof define == "function" && define.amd ? define(["exports"], e) : (t = typeof globalThis < "u" ? globalThis : t || self, e(t.compareVersions = {})) })(xi, (function (t) { "use strict"; let e = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, n = i(b => { if (typeof b != "string") throw new TypeError("Invalid argument expected string"); let k = b.match(e); if (!k) throw new Error(`Invalid argument not valid semver ('${b}' received)`); return k.shift(), k }, "validateAndParse"), r = i(b => b === "*" || b === "x" || b === "X", "isWildcard"), o = i(b => { let k = parseInt(b, 10); return isNaN(k) ? b : k }, "tryParse"), s = i((b, k) => typeof b != typeof k ? [String(b), String(k)] : [b, k], "forceType"), a = i((b, k) => { if (r(b) || r(k)) return 0; let [x, v] = s(o(b), o(k)); return x > v ? 1 : x < v ? -1 : 0 }, "compareStrings"), l = i((b, k) => { for (let x = 0; x < Math.max(b.length, k.length); x++) { let v = a(b[x] || "0", k[x] || "0"); if (v !== 0) return v } return 0 }, "compareSegments"), u = i((b, k) => { let x = n(b), v = n(k), P = x.pop(), L = v.pop(), C = l(x, v); return C !== 0 ? C : P && L ? l(P.split("."), L.split(".")) : P || L ? P ? -1 : 1 : 0 }, "compareVersions"), c = i((b, k, x) => { h(x); let v = u(b, k); return f[x].includes(v) }, "compare"), f = {">": [1], ">=": [0, 1], "=": [0], "<=": [-1, 0], "<": [-1], "!=": [-1, 1]}, d = Object.keys(f), h = i(b => { if (typeof b != "string") throw new TypeError(`Invalid operator type, expected string but got ${typeof b}`); if (d.indexOf(b) === -1) throw new Error(`Invalid operator, expected one of ${d.join("|")}`) }, "assertValidOperator"), p = i((b, k) => { if (k = k.replace(/([><=]+)\s+/g, "$1"), k.includes("||")) return k.split("||").some(V => p(b, V)); if (k.includes(" - ")) { let [V, H] = k.split(" - ", 2); return p(b, `>=${V} <=${H}`) } else if (k.includes(" ")) return k.trim().replace(/\s{2,}/g, " ").split(" ").every(V => p(b, V)); let x = k.match(/^([<>=~^]+)/), v = x ? x[1] : "="; if (v !== "^" && v !== "~") return c(b, k, v); let [P, L, C, , O] = n(b), [W, I, D, , ne] = n(k), U = [P, L, C], E = [W, I ?? "x", D ?? "x"]; if (ne && (!O || l(U, E) !== 0 || l(O.split("."), ne.split(".")) === -1)) return !1; let F = E.findIndex(V => V !== "0") + 1, M = v === "~" ? 2 : F > 1 ? F : 1; return !(l(U.slice(0, M), E.slice(0, M)) !== 0 || l(U.slice(M), E.slice(M)) === -1) }, "satisfies"), w = i(b => typeof b == "string" && /^[v\d]/.test(b) && e.test(b), "validate"), y = i(b => typeof b == "string" && /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(b), "validateStrict"); t.compare = c, t.compareVersions = u, t.satisfies = p, t.validate = w, t.validateStrict = y })) }); var Dw = {}; ra(Dw, {default: () => Nw}); module.exports = bf(Dw); var kf = require("obsidian"), yf = require("obsidian"), Cf = require("obsidian"), xf = require("obsidian"), Af = require("obsidian"), vf = require("obsidian"), Sf = require("obsidian"), Ef = require("obsidian"), Pf = require("obsidian"), Tf = require("obsidian"), Ff = require("obsidian"), Lf = require("obsidian"), If = require("obsidian"), Mf = require("obsidian"), Rf = require("obsidian"), Of = require("obsidian"), Nf = require("obsidian"), Df = require("obsidian"), Bf = require("obsidian"), _f = require("obsidian"), Vf = require("obsidian"), zf = require("obsidian"), $f = require("obsidian"), Wf = require("obsidian"), Uf = require("obsidian"), Hf = require("obsidian"), jf = require("obsidian"), Kf = require("obsidian"), Gf = require("obsidian"), qf = require("obsidian"), Jf = require("obsidian"), Yf = require("obsidian"), Qf = require("obsidian"), Xf = require("obsidian"), Zf = require("obsidian"), ed = require("obsidian"), td = require("obsidian"), nd = require("obsidian"), rd = require("obsidian"), id = require("obsidian"), od = require("obsidian"), sd = require("obsidian"), ad = require("obsidian"), ld = require("obsidian"), ud = require("obsidian"), cd = require("obsidian"), fd = require("obsidian"), dd = require("obsidian"), sa = require("obsidian"), aa = require("obsidian"), md = require("obsidian"), gd = require("obsidian"), wd = require("obsidian"), bd = require("obsidian"), kd = require("obsidian"), yd = require("obsidian"), Cd = require("obsidian"), xd = require("obsidian"), Ad = require("obsidian"), vd = require("obsidian"), Sd = require("obsidian"), Ed = require("obsidian"), Pd = require("obsidian"), Td = require("obsidian"), Fd = require("obsidian"), Ld = require("obsidian"), Id = require("obsidian"), Md = require("obsidian"), Rd = require("obsidian"), Od = require("obsidian"), Nd = require("obsidian"), Dd = require("obsidian"), Bd = require("obsidian"), _d = require("obsidian"), Vd = require("obsidian"), zd = require("obsidian"), $d = require("obsidian"), Wd = require("obsidian"), Ud = require("obsidian"), Hd = require("obsidian"), jd = require("obsidian"), Kd = require("obsidian"), Gd = require("obsidian"), qd = require("obsidian"), Jd = require("obsidian"), Yd = require("obsidian"), Qd = require("obsidian"), Xd = require("obsidian"); var oa = class { static { i(this, "CustomArrayDictImpl") } data = new Map; add(t, e) { let n = this.get(t); n || (n = [], this.data.set(t, n)), n.includes(e) || n.push(e) } clear(t) { this.data.delete(t) } clearAll() { this.data.clear() } contains(t, e) { return !!this.get(t)?.contains(e) } count() { let t = 0; for (let e of this.keys()) t += this.get(e)?.length ?? 0; return t } get(t) { return this.data.get(t) || null } keys() { return Array.from(this.data.keys()) } remove(t, e) { let n = this.get(t); n && (n.remove(e), n.length === 0 && this.clear(t)) } }; var ke = { AudioRecorder: "audio-recorder", Backlink: "backlink", Bases: "bases", Bookmarks: "bookmarks", Canvas: "canvas", CommandPalette: "command-palette", DailyNotes: "daily-notes", EditorStatus: "editor-status", FileExplorer: "file-explorer", FileRecovery: "file-recovery", Footnotes: "footnotes", GlobalSearch: "global-search", Graph: "graph", MarkdownImporter: "markdown-importer", NoteComposer: "note-composer", OutgoingLink: "outgoing-link", Outline: "outline", PagePreview: "page-preview", Properties: "properties", Publish: "publish", RandomNote: "random-note", SlashCommand: "slash-command", Slides: "slides", Switcher: "switcher", Sync: "sync", TagPane: "tag-pane", Templates: "templates", Webviewer: "webviewer", WordCount: "word-count", Workspaces: "workspaces", ZkPrefixer: "zk-prefixer" }, Tt = { AllProperties: "all-properties", Audio: "audio", Backlink: ke.Backlink, Bases: ke.Bases, Bookmarks: ke.Bookmarks, Canvas: ke.Canvas, Empty: "empty", FileExplorer: ke.FileExplorer, FileProperties: "file-properties", Graph: ke.Graph, Image: "image", LocalGraph: "localgraph", Markdown: "markdown", OutgoingLink: ke.OutgoingLink, Outline: ke.Outline, Pdf: "pdf", ReleaseNotes: "release-notes", Search: "search", Sync: "sync", Table: "table", Tag: "tag", Video: "video", Webviewer: "webviewer", WebviewerHistory: "webviewer-history" }; function pd() { return sa.TFile } i(pd, "getTFileConstructor"); function hd() { return aa.TFolder } i(hd, "getTFolderConstructor"); function je(t) { return t.replace(/\/?[^/]*$/, "") || "/" } i(je, "parentFolderPath"); function lr(t, e) { let n = t.vault.getFolderByPath(e); return n || (n = new (hd())(t.vault, e), n.parent = lr(t, je(e)), n.deleted = !0, n) } i(lr, "createTFolderInstance"); function la(t, e) { let n = t.vault.getFileByPath(e); return n || (n = new (pd())(t.vault, e), n.parent = lr(t, je(e)), n.deleted = !0, n) } i(la, "createTFileInstance"); function Jt(t) { return t.vault.adapter } i(Jt, "getDataAdapterEx"); function ot(t) { return !!t.position } i(ot, "isReferenceCache"); function Te(t) { return !!t.key } i(Te, "isFrontmatterLinkCache"); var Ee = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function Ke(t, e) { let n = t.length, r = 0; for (let o = 0; o < n; o++) { if (!Object.hasOwn(t, o)) continue; let s = t[o]; e(s, o, t) && (t[r++] = s) } t.length = r } i(Ke, "filterInPlace"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function ua(t) { let e = t.toString(); if (Zd.test(e)) return e; let n = ep.exec(e); return n ? `async function ${e.slice(n[0].length)}` : `function ${e}` } i(ua, "getFunctionExpressionString"); function ge() { } i(ge, "noop"); var ur = Promise.resolve(); function $e() { return ur } i($e, "noopAsync"); var Zd = /^(?:function\b|async\b\s*(?:function\b|\()|\()/, ep = /^async\b\s*/; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var tp = Number.POSITIVE_INFINITY; function Ft(...t) { let e = t.filter(s => !!s); if (typeof AbortSignal.any == "function") return AbortSignal.any(e); if (e.length === 0) return Oe(); if (e.length === 1 && e[0]) return e[0]; let n = new AbortController; for (let s of e) if (s.aborted) return s; let r = []; for (let s of e) r.push(fa(s, o)); return n.signal; function o(s) { for (let a of r) a(); n.abort(s.reason) } } i(Ft, "abortSignalAny"); function Oe() { return new AbortController().signal } i(Oe, "abortSignalNever"); function ca(t) { if (t === tp) return Oe(); if (typeof AbortSignal.timeout == "function") return AbortSignal.timeout(t); let e = new AbortController; return window.setTimeout(() => { e.abort(new Error(`Timed out in ${String(t)} milliseconds`)) }, t), e.signal } i(ca, "abortSignalTimeout"); function fa(t, e) { if (t.aborted) return e(t), ge; return t.addEventListener("abort", n, {once: !0}), () => { t.removeEventListener("abort", n) }; function n(r) { e(r.target) } i(n, "wrappedCallback") } i(fa, "onAbort"); function Ji(t, e) { return new Promise((n, r) => { fa(t, () => { e ? r(t.reason) : n(t.reason) }) }) } i(Ji, "waitForAbort"); var so = qt(Aa(), 1); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var to = class { static { i(this, "AsyncEventsBase") } eventRefsMap = new Map; off(e, n) { let r = this.eventRefsMap.get(e); r && (Ke(r, o => o.callback !== n), r.length === 0 && this.eventRefsMap.delete(e)) } offref(e) { let n = this.eventRefsMap.get(e.name); n && (Ke(n, r => r !== e), n.length === 0 && this.eventRefsMap.delete(e.name)) } on(e, n, r) { let o = this.eventRefsMap.get(e); o || (o = [], this.eventRefsMap.set(e, o)); let s = {asyncEventSource: this, callback: n, name: e, thisArg: r}; return o.push(s), s } once(e, n, r) { let o = this.on(e, n, r), s = this.on(e, () => { this.offref(o), this.offref(s) }); return o } trigger(e, ...n) { let r = this.eventRefsMap.get(e) ?? []; for (let o of r.slice()) this.tryTrigger(o, n) } async triggerAsync(e, ...n) { let r = this.eventRefsMap.get(e) ?? []; for (let o of r.slice()) await this.tryTriggerAsync(o, n) } tryTrigger(e, n) { try { let r = e.callback.call(e.thisArg, ...n); r instanceof Promise && r.catch(eo) } catch (r) { eo(r) } } async tryTriggerAsync(e, n) { try { await e.callback.call(e.thisArg, ...n) } catch (r) { eo(r) } } }, It = class extends to { static { i(this, "AsyncEvents") } trigger(e, ...n) { super.trigger(e, ...n) } triggerAsync(e, ...n) { return super.triggerAsync(e, ...n) } tryTrigger(e, n) { super.tryTrigger(e, n) } async tryTriggerAsync(e, n) { return super.tryTriggerAsync(e, n) } }; function hr() { return i(function (e) { class n extends e { static { i(this, "AsyncEventsMixin") } #e = new It; off(o, s) { this.#e.off(o, s) } offref(o) { this.#e.offref(o) } on(o, s, a) { return this.#e.on(o, s, a) } once(o, s, a) { return this.#e.once(o, s, a) } trigger(o, ...s) { this.#e.trigger(o, ...s) } async triggerAsync(o, ...s) { await this.#e.triggerAsync(o, ...s) } tryTrigger(o, s) { this.#e.tryTrigger(o, s) } async tryTriggerAsync(o, s) { await this.#e.tryTriggerAsync(o, s) } } return n }, "inner") } i(hr, "mixinAsyncEvents"); function eo(t) { window.setTimeout(() => { throw t }, 0) } i(eo, "throwDelayed"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function st(t) { throw new Error(`Unhandled value: ${String(t)}`) } i(st, "assertNever"); function Ge(t, e) { if (t != null) return; throw e ??= t === null ? "Value is null" : "Value is undefined", typeof e == "string" ? new Error(e) : e } i(Ge, "assertNonNullable"); function z(t, e) { return Ge(t, e), t } i(z, "ensureNonNullable"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var mr = new It; mr.on("asyncError", vp); var wr = "An unhandled error occurred executing async operation", Sa = " at", We = class t extends Error { static { i(this, "CustomStackTraceError") } constructor(e, n, r) { super(e, {cause: r}), this.name = "CustomStackTraceError", Error.captureStackTrace?.(this, t); let o = r, s = new Set; for (; o instanceof t;) { if (s.has(o)) throw new Error("Circular cause detected"); s.add(o), o = o.cause } let a = z(this.stack).split(` `), l = n.split(` `); /^\w*Error(?:: |$)/.test(z(l[0])) && l.splice(0, 1), a.splice(1, a.length - 1, ...l), this.stack = a.join(` `) } }, gr = class t extends Error { static { i(this, "ErrorWrapper") } constructor(e) { super(`A non-Error value was thrown: ${String(e)}`, {cause: e}), this.name = "ErrorWrapper", Error.captureStackTrace?.(this, t) } static create(e) { return e instanceof Error ? e : new t(e) } }, Zt = class t extends Error { static { i(this, "SilentError") } constructor(e) { super(e), this.name = "SilentError", Error.captureStackTrace?.(this, t) } }; function br(t) { mr.trigger("asyncError", t) } i(br, "emitAsyncErrorEvent"); function kr(t) { if (!(t instanceof Error)) return String(t); let e = t.stack ?? `${t.name}: ${t.message}`; if (t.cause !== void 0) { let n = kr(t.cause).split(` `); e += ` ${va("Caused by:")}`; for (let r of n) r.trim() && (e += r.startsWith(Sa) ? ` ${r}` : ` ${va(r)}`) } return e } i(kr, "errorToString"); function Ce(t = 0) { return z(new Error().stack).split(` `).slice(t + 2).join(` `) } i(Ce, "getStackTrace"); function pt(t, e) { e ??= globalThis.console, e.error(kr(t)) } i(pt, "printError"); function Ea(t) { let e = mr.on("asyncError", t); return () => { mr.offref(e) } } i(Ea, "registerAsyncErrorEventHandler"); function va(t) { return `${Sa} --- ${t} --- (0)` } i(va, "generateStackTraceLine"); function vp(t) { pt(t) } i(vp, "handleAsyncError"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var no = "70.2.2", yr = "obsidian-dev-utils", Pa = `.obsidian-dev-utils.code-highlighter-component textarea, .obsidian-dev-utils.code-highlighter-component pre, .obsidian-dev-utils.code-highlighter-component code { font-family: var(--font-monospace); line-height: var(--line-height-normal); margin: 0; } .obsidian-dev-utils.code-highlighter-component textarea, .obsidian-dev-utils.code-highlighter-component code { font-size: var(--code-size); } .obsidian-dev-utils.code-highlighter-component textarea { background: transparent; color: transparent; z-index: 2; width: 20em; height: 10em; } .obsidian-dev-utils.code-highlighter-component pre { position: absolute; pointer-events: none; border: var(--input-border-width) solid transparent; overflow: auto; inset: 0; padding: var(--size-4-1) var(--size-4-2); z-index: 1; } .obsidian-dev-utils.code-highlighter-component pre::after { content: ""; display: block; height: var(--bottom-gap, 0); } .obsidian-dev-utils.code-highlighter-component pre.is-placeholder { opacity: 0.6; } .obsidian-dev-utils.code-highlighter-component code { display: block; padding: 0; } .obsidian-dev-utils input[type=url] { height: var(--input-height); } .obsidian-dev-utils input[type=month], .obsidian-dev-utils input[type=tel], .obsidian-dev-utils input[type=time], .obsidian-dev-utils input[type=url], .obsidian-dev-utils input[type=week] { -webkit-app-region: no-drag; background: var(--background-modifier-form-field); border: var(--input-border-width) solid var(--background-modifier-border); color: var(--text-normal); font-family: inherit; padding: var(--size-4-1) var(--size-4-2); font-size: var(--font-ui-small); border-radius: var(--input-radius); outline: none; } @media (hover: hover) { .obsidian-dev-utils input[type=month]:hover, .obsidian-dev-utils input[type=tel]:hover, .obsidian-dev-utils input[type=time]:hover, .obsidian-dev-utils input[type=url]:hover, .obsidian-dev-utils input[type=week]:hover { border-color: var(--background-modifier-border-hover); transition: box-shadow 0.15s ease-in-out, border 0.15s ease-in-out; } } .obsidian-dev-utils input[type=month]:active, .obsidian-dev-utils input[type=month]:focus, .obsidian-dev-utils input[type=tel]:active, .obsidian-dev-utils input[type=tel]:focus, .obsidian-dev-utils input[type=time]:active, .obsidian-dev-utils input[type=time]:focus, .obsidian-dev-utils input[type=url]:active, .obsidian-dev-utils input[type=url]:focus, .obsidian-dev-utils input[type=week]:active, .obsidian-dev-utils input[type=week]:focus { border-color: var(--background-modifier-border-focus); transition: box-shadow 0.15s ease-in-out, border 0.15s ease-in-out; } .obsidian-dev-utils input[type=month]:active, .obsidian-dev-utils input[type=month]:focus, .obsidian-dev-utils input[type=month]:focus-visible, .obsidian-dev-utils input[type=tel]:active, .obsidian-dev-utils input[type=tel]:focus, .obsidian-dev-utils input[type=tel]:focus-visible, .obsidian-dev-utils input[type=time]:active, .obsidian-dev-utils input[type=time]:focus, .obsidian-dev-utils input[type=time]:focus-visible, .obsidian-dev-utils input[type=url]:active, .obsidian-dev-utils input[type=url]:focus, .obsidian-dev-utils input[type=url]:focus-visible, .obsidian-dev-utils input[type=week]:active, .obsidian-dev-utils input[type=week]:focus, .obsidian-dev-utils input[type=week]:focus-visible { box-shadow: 0 0 0 2px var(--background-modifier-border-focus); } .obsidian-dev-utils input[type=month]::placeholder, .obsidian-dev-utils input[type=tel]::placeholder, .obsidian-dev-utils input[type=time]::placeholder, .obsidian-dev-utils input[type=url]::placeholder, .obsidian-dev-utils input[type=week]::placeholder { color: var(--text-faint); } .mod-rtl input[type=month], .mod-rtl input[type=time], .mod-rtl input[type=week], .is-rtl input[type=month], .is-rtl input[type=time], .is-rtl input[type=week], .rtl input[type=month], .rtl input[type=time], .rtl input[type=week] { direction: rtl; } .mod-rtl input[type=month]::-webkit-calendar-picker-indicator, .mod-rtl input[type=time]::-webkit-calendar-picker-indicator, .mod-rtl input[type=week]::-webkit-calendar-picker-indicator, .is-rtl input[type=month]::-webkit-calendar-picker-indicator, .is-rtl input[type=time]::-webkit-calendar-picker-indicator, .is-rtl input[type=week]::-webkit-calendar-picker-indicator, .rtl input[type=month]::-webkit-calendar-picker-indicator, .rtl input[type=time]::-webkit-calendar-picker-indicator, .rtl input[type=week]::-webkit-calendar-picker-indicator { right: var(--size-4-1); left: auto; } .obsidian-dev-utils input[type=month], .obsidian-dev-utils input[type=time], .obsidian-dev-utils input[type=week] { font-variant-numeric: tabular-nums; position: relative; } .obsidian-dev-utils input[type=month]::-webkit-datetime-edit-text, .obsidian-dev-utils input[type=time]::-webkit-datetime-edit-text, .obsidian-dev-utils input[type=week]::-webkit-datetime-edit-text { color: var(--text-faint); padding-inline-end: 0; } .obsidian-dev-utils input[type=month]::-webkit-calendar-picker-indicator, .obsidian-dev-utils input[type=time]::-webkit-calendar-picker-indicator, .obsidian-dev-utils input[type=week]::-webkit-calendar-picker-indicator { position: absolute; left: var(--size-4-1); right: auto; opacity: 0.5; } .obsidian-dev-utils input[type=month]::-webkit-datetime-edit-month-field:active, .obsidian-dev-utils input[type=month]::-webkit-datetime-edit-month-field:focus, .obsidian-dev-utils input[type=month]::-webkit-datetime-edit-day-field:active, .obsidian-dev-utils input[type=month]::-webkit-datetime-edit-day-field:focus, .obsidian-dev-utils input[type=month]::-webkit-datetime-edit-year-field:active, .obsidian-dev-utils input[type=month]::-webkit-datetime-edit-year-field:focus, .obsidian-dev-utils input[type=time]::-webkit-datetime-edit-month-field:active, .obsidian-dev-utils input[type=time]::-webkit-datetime-edit-month-field:focus, .obsidian-dev-utils input[type=time]::-webkit-datetime-edit-day-field:active, .obsidian-dev-utils input[type=time]::-webkit-datetime-edit-day-field:focus, .obsidian-dev-utils input[type=time]::-webkit-datetime-edit-year-field:active, .obsidian-dev-utils input[type=time]::-webkit-datetime-edit-year-field:focus, .obsidian-dev-utils input[type=week]::-webkit-datetime-edit-month-field:active, .obsidian-dev-utils input[type=week]::-webkit-datetime-edit-month-field:focus, .obsidian-dev-utils input[type=week]::-webkit-datetime-edit-day-field:active, .obsidian-dev-utils input[type=week]::-webkit-datetime-edit-day-field:focus, .obsidian-dev-utils input[type=week]::-webkit-datetime-edit-year-field:active, .obsidian-dev-utils input[type=week]::-webkit-datetime-edit-year-field:focus { background-color: var(--text-selection); color: var(--text-normal); cursor: text; } .mod-rtl .obsidian-dev-utils input[type=month], .is-rtl .obsidian-dev-utils input[type=month], .rtl .obsidian-dev-utils input[type=month], .mod-rtl .obsidian-dev-utils input[type=time], .is-rtl .obsidian-dev-utils input[type=time], .rtl .obsidian-dev-utils input[type=time], .mod-rtl .obsidian-dev-utils input[type=week], .is-rtl .obsidian-dev-utils input[type=week], .rtl .obsidian-dev-utils input[type=week] { direction: rtl; } .mod-rtl .obsidian-dev-utils input[type=month]::-webkit-calendar-picker-indicator, .is-rtl .obsidian-dev-utils input[type=month]::-webkit-calendar-picker-indicator, .rtl .obsidian-dev-utils input[type=month]::-webkit-calendar-picker-indicator, .mod-rtl .obsidian-dev-utils input[type=time]::-webkit-calendar-picker-indicator, .is-rtl .obsidian-dev-utils input[type=time]::-webkit-calendar-picker-indicator, .rtl .obsidian-dev-utils input[type=time]::-webkit-calendar-picker-indicator, .mod-rtl .obsidian-dev-utils input[type=week]::-webkit-calendar-picker-indicator, .is-rtl .obsidian-dev-utils input[type=week]::-webkit-calendar-picker-indicator, .rtl .obsidian-dev-utils input[type=week]::-webkit-calendar-picker-indicator { left: auto; right: var(--size-4-1); } body:not(.is-ios):not(.is-android) .obsidian-dev-utils input[type=month], body:not(.is-ios):not(.is-android) .obsidian-dev-utils input[type=time], body:not(.is-ios):not(.is-android) .obsidian-dev-utils input[type=week] { padding-inline-start: var(--size-4-6); } .obsidian-dev-utils input[type=time]::-webkit-calendar-picker-indicator { margin-inline-start: 0; } .obsidian-dev-utilsprogress.loop { min-width: 200px; } .obsidian-dev-utils.modal-container .ok-button { margin-right: 10px; margin-top: 20px; } .obsidian-dev-utils .multiple-dropdown-component select, .obsidian-dev-utils .multiple-dropdown-component select:focus, .obsidian-dev-utils .multiple-dropdown-component .dropdown { height: auto; padding-top: 3px; } .obsidian-dev-utils .multiple-dropdown-component select option:checked, .obsidian-dev-utils .multiple-dropdown-component select:focus option:checked, .obsidian-dev-utils .multiple-dropdown-component .dropdown option:checked { background-color: #1967d2; color: #fff; } .obsidian-dev-utils.plugin-settings-tab a:focus { outline: 2px solid var(--link-color); } .obsidian-dev-utils.prompt-modal .text-box { width: 100%; } .obsidian-dev-utils.tri-state-checkbox-component input[type=checkbox]:indeterminate { appearance: checkbox; } .obsidian-dev-utils :invalid { box-shadow: 0 0 0 2px var(--text-error); } .obsidian-dev-utils input.metadata-input-text:active:invalid, .obsidian-dev-utils input.metadata-input-text:focus-visible:invalid, .obsidian-dev-utils input.metadata-input-text:focus:invalid, .obsidian-dev-utils input[type=date]:active:invalid, .obsidian-dev-utils input[type=date]:focus-visible:invalid, .obsidian-dev-utils input[type=date]:focus:invalid, .obsidian-dev-utils input[type=datetime-local]:active:invalid, .obsidian-dev-utils input[type=datetime-local]:focus-visible:invalid, .obsidian-dev-utils input[type=datetime-local]:focus:invalid, .obsidian-dev-utils input[type=email]:active:invalid, .obsidian-dev-utils input[type=email]:focus-visible:invalid, .obsidian-dev-utils input[type=email]:focus:invalid, .obsidian-dev-utils input[type=number]:active:invalid, .obsidian-dev-utils input[type=number]:focus-visible:invalid, .obsidian-dev-utils input[type=number]:focus:invalid, .obsidian-dev-utils input[type=password]:active:invalid, .obsidian-dev-utils input[type=password]:focus-visible:invalid, .obsidian-dev-utils input[type=password]:focus:invalid, .obsidian-dev-utils input[type=search]:active:invalid, .obsidian-dev-utils input[type=search]:focus-visible:invalid, .obsidian-dev-utils input[type=search]:focus:invalid, .obsidian-dev-utils input[type=text]:active:invalid, .obsidian-dev-utils input[type=text]:focus-visible:invalid, .obsidian-dev-utils input[type=text]:focus:invalid, .obsidian-dev-utils textarea:active:invalid, .obsidian-dev-utils textarea:focus-visible:invalid, .obsidian-dev-utils textarea:focus:invalid { box-shadow: 0 0 0 2px var(--text-error); } .obsidian-dev-utils.setting-component-wrapper { position: relative; display: inline-flex; } .obsidian-dev-utils.overlay-validator { caret-color: transparent; cursor: default; position: absolute; background-color: transparent; border: none; outline: none; pointer-events: none; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; } .obsidian-dev-utils.tooltip.tooltip-validator { position: absolute; top: calc(100% + 8px); width: max-content; } /*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../src/styles/code-highlighter-component.scss%22,%22../src/styles/input.scss%22,%22../src/styles/input-time.scss%22,%22../src/styles/loop.scss%22,%22../src/styles/modal-container.scss%22,%22../src/styles/multiple-dropdown-component.scss%22,%22../src/styles/plugin-settings-tab.scss%22,%22../src/styles/prompt-modal.scss%22,%22../src/styles/tri-state-checkbox-component.scss%22,%22../src/styles/validation.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAEI;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;;;ACzCJ;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGE;EACE;AAAA;AAAA;AAAA;AAAA;IACE;IACA,YACE;;;AAMR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAEE;EACA,YACE;;AAIJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;AAGF;AAAA;AAAA;AAAA;AAAA;EACE;;AASE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EACE;EACA;;;AC7DV;AAAA;AAAA;EAGE;EACA;;AAEA;AAAA;AAAA;EACE;EACA;;AAGF;AAAA;AAAA;EACE;EACA;EACA;EACA;;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAEE;EACA;EACA;;AAIK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGP;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EACE;EACA;;;AAKF;AAAA;AAAA;EACE;;;AAMJ;EACE;;;ACjDJ;EACE;;;ACAA;EACE;EACA;;;ACFF;AAAA;AAAA;EAGE;EACA;;AAEA;AAAA;AAAA;EACE;EACA;;;ACRJ;EACE;;;ACDF;EACE;;;ACDF;EACE;;;ACEJ;EAJA;;AAoBI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EApBJ;;AA0BA;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA%22,%22file%22:%22styles.css%22,%22sourcesContent%22:%5B%22.obsidian-dev-utils%20%7B%5Cn%20%20&.code-highlighter-component%20%7B%5Cn%20%20%20%20textarea,%20pre,%20code%20%7B%5Cn%20%20%20%20%20%20font-family:%20var(--font-monospace);%5Cn%20%20%20%20%20%20line-height:%20var(--line-height-normal);%5Cn%20%20%20%20%20%20margin:%200;%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20textarea,%20code%20%7B%5Cn%20%20%20%20%20%20font-size:%20var(--code-size);%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20textarea%20%7B%5Cn%20%20%20%20%20%20background:%20transparent;%5Cn%20%20%20%20%20%20color:%20transparent;%5Cn%20%20%20%20%20%20z-index:%202;%5Cn%20%20%20%20%20%20width:%2020em;%5Cn%20%20%20%20%20%20height:%2010em;%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20pre%20%7B%5Cn%20%20%20%20%20%20position:%20absolute;%5Cn%20%20%20%20%20%20pointer-events:%20none;%5Cn%20%20%20%20%20%20border:%20var(--input-border-width)%20solid%20transparent;%5Cn%20%20%20%20%20%20overflow:%20auto;%5Cn%20%20%20%20%20%20inset:%200;%5Cn%20%20%20%20%20%20padding:%20var(--size-4-1)%20var(--size-4-2);%5Cn%20%20%20%20%20%20z-index:%201;%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20pre::after%20%7B%5Cn%20%20%20%20%20%20content:%20%5C%22%5C%22;%5Cn%20%20%20%20%20%20display:%20block;%5Cn%20%20%20%20%20%20height:%20var(--bottom-gap,%200);%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20pre.is-placeholder%20%7B%5Cn%20%20%20%20%20%20opacity:%200.6;%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20code%20%7B%5Cn%20%20%20%20%20%20display:%20block;%5Cn%20%20%20%20%20%20padding:%200;%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%22,%22.obsidian-dev-utils%20%7B%5Cn%20%20input%5Btype='url'%5D%20%7B%5Cn%20%20%20%20height:%20var(--input-height)%5Cn%20%20%7D%5Cn%5Cn%20%20input%5Btype='month'%5D,%5Cn%20%20input%5Btype='tel'%5D,%5Cn%20%20input%5Btype='time'%5D,%5Cn%20%20input%5Btype='url'%5D,%5Cn%20%20input%5Btype='week'%5D%20%7B%5Cn%20%20%20%20-webkit-app-region:%20no-drag;%5Cn%20%20%20%20background:%20var(--background-modifier-form-field);%5Cn%20%20%20%20border:%20var(--input-border-width)%20solid%20var(--background-modifier-border);%5Cn%20%20%20%20color:%20var(--text-normal);%5Cn%20%20%20%20font-family:%20inherit;%5Cn%20%20%20%20padding:%20var(--size-4-1)%20var(--size-4-2);%5Cn%20%20%20%20font-size:%20var(--font-ui-small);%5Cn%20%20%20%20border-radius:%20var(--input-radius);%5Cn%20%20%20%20outline:%20none;%5Cn%5Cn%20%20%20%20@at-root%20%7B%5Cn%20%20%20%20%20%20@media%20(hover:%20hover)%20%7B%5Cn%20%20%20%20%20%20%20%20&:hover%20%7B%5Cn%20%20%20%20%20%20%20%20%20%20border-color:%20var(--background-modifier-border-hover);%5Cn%20%20%20%20%20%20%20%20%20%20transition:%5Cn%20%20%20%20%20%20%20%20%20%20%20%20box-shadow%200.15s%20ease-in-out,%5Cn%20%20%20%20%20%20%20%20%20%20%20%20border%200.15s%20ease-in-out;%5Cn%20%20%20%20%20%20%20%20%7D%5Cn%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20&:active,%5Cn%20%20%20%20&:focus%20%7B%5Cn%20%20%20%20%20%20border-color:%20var(--background-modifier-border-focus);%5Cn%20%20%20%20%20%20transition:%5Cn%20%20%20%20%20%20%20%20box-shadow%200.15s%20ease-in-out,%5Cn%20%20%20%20%20%20%20%20border%200.15s%20ease-in-out;%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20&:active,%5Cn%20%20%20%20&:focus,%5Cn%20%20%20%20&:focus-visible%20%7B%5Cn%20%20%20%20%20%20box-shadow:%200%200%200%202px%20var(--background-modifier-border-focus);%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20&::placeholder%20%7B%5Cn%20%20%20%20%20%20color:%20var(--text-faint);%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%5Cn%20%20@at-root%20%7B%5Cn%20%20%20%20.mod-rtl,%5Cn%20%20%20%20.is-rtl,%5Cn%20%20%20%20.rtl%20%7B%5Cn%20%20%20%20%20%20&%20%7B%5Cn%20%20%20%20%20%20%20%20input%5Btype='month'%5D,%5Cn%20%20%20%20%20%20%20%20input%5Btype='time'%5D,%5Cn%20%20%20%20%20%20%20%20input%5Btype='week'%5D%20%7B%5Cn%20%20%20%20%20%20%20%20%20%20direction:%20rtl;%5Cn%5Cn%20%20%20%20%20%20%20%20%20%20&::-webkit-calendar-picker-indicator%20%7B%5Cn%20%20%20%20%20%20%20%20%20%20%20%20right:%20var(--size-4-1);%5Cn%20%20%20%20%20%20%20%20%20%20%20%20left:%20auto;%5Cn%20%20%20%20%20%20%20%20%20%20%7D%5Cn%20%20%20%20%20%20%20%20%7D%5Cn%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%22,%22.obsidian-dev-utils%20%7B%5Cn%20%20input%5Btype='month'%5D,%5Cn%20%20input%5Btype='time'%5D,%5Cn%20%20input%5Btype='week'%5D%20%7B%5Cn%20%20%20%20font-variant-numeric:%20tabular-nums;%5Cn%20%20%20%20position:%20relative;%5Cn%5Cn%20%20%20%20&::-webkit-datetime-edit-text%20%7B%5Cn%20%20%20%20%20%20color:%20var(--text-faint);%5Cn%20%20%20%20%20%20padding-inline-end:%200;%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20&::-webkit-calendar-picker-indicator%20%7B%5Cn%20%20%20%20%20%20position:%20absolute;%5Cn%20%20%20%20%20%20left:%20var(--size-4-1);%5Cn%20%20%20%20%20%20right:%20auto;%5Cn%20%20%20%20%20%20opacity:%200.5;%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20&::-webkit-datetime-edit-month-field,%5Cn%20%20%20%20&::-webkit-datetime-edit-day-field,%5Cn%20%20%20%20&::-webkit-datetime-edit-year-field%20%7B%5Cn%20%20%20%20%20%20&:active,%5Cn%20%20%20%20%20%20&:focus%20%7B%5Cn%20%20%20%20%20%20%20%20background-color:%20var(--text-selection);%5Cn%20%20%20%20%20%20%20%20color:%20var(--text-normal);%5Cn%20%20%20%20%20%20%20%20cursor:%20text;%5Cn%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20@at-root%20.mod-rtl%20&,%5Cn%20%20%20%20%20%20.is-rtl%20&,%5Cn%20%20%20%20%20%20.rtl%20&%20%7B%5Cn%20%20%20%20%20%20direction:%20rtl;%5Cn%5Cn%20%20%20%20%20%20&::-webkit-calendar-picker-indicator%20%7B%5Cn%20%20%20%20%20%20%20%20left:%20auto;%5Cn%20%20%20%20%20%20%20%20right:%20var(--size-4-1);%5Cn%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%5Cn%20%20%20%20@at-root%20%7B%5Cn%20%20%20%20%20%20body:not(.is-ios):not(.is-android)%20&%20%7B%5Cn%20%20%20%20%20%20%20%20padding-inline-start:%20var(--size-4-6);%5Cn%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%5Cn%20%20input%5Btype='time'%5D%20%7B%5Cn%20%20%20%20&::-webkit-calendar-picker-indicator%20%7B%5Cn%20%20%20%20%20%20margin-inline-start:%200;%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%22,%22.obsidian-dev-utils%20%7B%5Cn%20%20&progress.loop%20%7B%5Cn%20%20%20%20min-width:%20200px;%5Cn%20%20%7D%5Cn%7D%5Cn%22,%22.obsidian-dev-utils%20%7B%5Cn%20%20&.modal-container%20%7B%5Cn%20%20%20%20.ok-button%20%7B%5Cn%20%20%20%20%20%20margin-right:%2010px;%5Cn%20%20%20%20%20%20margin-top:%2020px;%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%22,%22.obsidian-dev-utils%20%7B%5Cn%20%20.multiple-dropdown-component%20%7B%5Cn%20%20%20%20select,%5Cn%20%20%20%20select:focus,%5Cn%20%20%20%20.dropdown%20%7B%5Cn%20%20%20%20%20%20height:%20auto;%5Cn%20%20%20%20%20%20padding-top:%203px;%5Cn%5Cn%20%20%20%20%20%20option:checked%20%7B%5Cn%20%20%20%20%20%20%20%20background-color:%20%231967d2;%5Cn%20%20%20%20%20%20%20%20color:%20%23fff;%5Cn%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%22,%22.obsidian-dev-utils%20%7B%5Cn%20%20&.plugin-settings-tab%20%7B%5Cn%20%20%20%20a:focus%20%7B%5Cn%20%20%20%20%20%20outline:%202px%20solid%20var(--link-color);%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%22,%22.obsidian-dev-utils%20%7B%5Cn%20%20&.prompt-modal%20%7B%5Cn%20%20%20%20.text-box%20%7B%5Cn%20%20%20%20%20%20width:%20100%25;%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%22,%22.obsidian-dev-utils%20%7B%5Cr%5Cn%20%20&.tri-state-checkbox-component%20%7B%5Cr%5Cn%20%20%20%20input%5Btype='checkbox'%5D:indeterminate%20%7B%5Cr%5Cn%20%20%20%20%20%20appearance:%20checkbox;%5Cr%5Cn%20%20%20%20%7D%5Cr%5Cn%20%20%7D%5Cr%5Cn%7D%5Cr%5Cn%22,%22@mixin%20invalid%20%7B%5Cn%20%20box-shadow:%200%200%200%202px%20var(--text-error);%5Cn%7D%5Cn%5Cn.obsidian-dev-utils%20%7B%5Cn%20%20:invalid%20%7B%5Cn%20%20%20%20@include%20invalid;%5Cn%20%20%7D%5Cn%5Cn%20%20input.metadata-input-text,%5Cn%20%20input%5Btype='date'%5D,%5Cn%20%20input%5Btype='datetime-local'%5D,%5Cn%20%20input%5Btype='email'%5D,%5Cn%20%20input%5Btype='number'%5D,%5Cn%20%20input%5Btype='password'%5D,%5Cn%20%20input%5Btype='search'%5D,%5Cn%20%20input%5Btype='text'%5D,%5Cn%20%20textarea%20%7B%5Cn%20%20%20%20&:active,%5Cn%20%20%20%20&:focus-visible,%5Cn%20%20%20%20&:focus%20%7B%5Cn%20%20%20%20%20%20&:invalid%20%7B%5Cn%20%20%20%20%20%20%20%20@include%20invalid;%5Cn%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%5Cn%20%20&.setting-component-wrapper%20%7B%5Cn%20%20%20%20position:%20relative;%5Cn%20%20%20%20display:%20inline-flex;%5Cn%20%20%7D%5Cn%5Cn%20%20&.overlay-validator%20%7B%5Cn%20%20%20%20caret-color:%20transparent;%5Cn%20%20%20%20cursor:%20default;%5Cn%20%20%20%20position:%20absolute;%5Cn%20%20%20%20background-color:%20transparent;%5Cn%20%20%20%20border:%20none;%5Cn%20%20%20%20outline:%20none;%5Cn%20%20%20%20pointer-events:%20none;%5Cn%20%20%20%20z-index:%209999;%5Cn%20%20%20%20left:%200;%5Cn%20%20%20%20top:%200;%5Cn%20%20%20%20width:%20100%25;%5Cn%20%20%20%20height:%20100%25;%5Cn%20%20%7D%5Cn%5Cn%20%20&.tooltip.tooltip-validator%20%7B%5Cn%20%20%20%20position:%20absolute;%5Cn%20%20%20%20top:%20calc(100%25%20+%208px);%5Cn%20%20%20%20width:%20max-content;%5Cn%20%20%7D%5Cn%7D%5Cn%22%5D%7D */ `; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var ro = class { static { i(this, "ValueWrapper") } value constructor(e) { this.value = e } }; function io() { let t = globalThis.app; if (t) return t; try { return globalThis.require("obsidian/app") } catch { throw new Error("Obsidian App global instance not found") } } i(io, "getApp"); function se(t, e, n) { let o = t ?? Sp() ?? globalThis; return o.obsidianDevUtilsState ??= {}, o.obsidianDevUtilsState[e] ??= new ro(n) } i(se, "getObsidianDevUtilsState"); function Sp() { try { return io() } catch { return null } } i(Sp, "getAppOrNull"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function Cr() { if (typeof window > "u") return !1; try { return io(), !0 } catch { return !1 } } i(Cr, "isInObsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var oo = "__no-plugin-id-initialized__", Ta = oo; function xr() { return Ta } i(xr, "getPluginId"); function Fa(t) { t && (Ta = t) } i(Fa, "setPluginId"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var La = ",", Ar = "-"; function Ia() { return {disable: Ep, enable: Pp, get: vr, set: In} } i(Ia, "getDebugController"); function en(t, e = 0) { let n = `${t}:${String(e)}`, r = se(null, "debuggers", new Map).value, o = r.get(n); return o || (o = Mn()(t), o.log = (s, ...a) => { Tp(t, e, s, ...a) }, r.set(n, o)), o } i(en, "getDebugger"); function K(t) { let e = xr(), n = e === oo ? "" : `${e}:`; return en(`${n}${yr}:${t}`) } i(K, "getLibDebugger"); function qe(t, e, n, ...r) { if (!Cr()) { t(n, ...r); return } t(n, ...r, ` --- Context stack trace: `, Ra(e)) } i(qe, "printWithStackTrace"); function Ma(t) { let e = Mn().enabled(t), n = e ? "enabled" : "disabled", r = e ? "disable" : "enable", o = vr(); In(t), en(t)(`Debug messages for plugin ${t} are ${n}. See https://github.com/mnaoumov/obsidian-dev-utils/blob/main/docs/debugging.md how to ${r} them.`), In(o) } i(Ma, "showInitialDebugMessage"); function Ep(t) { let e = new Set(vr()); for (let n of Rn(t)) { if (n.startsWith(Ar)) continue; let r = Ar + n; e.has(n) && e.delete(n), e.add(r) } In(Array.from(e)) } i(Ep, "disableNamespaces"); function Pp(t) { let e = new Set(vr()); for (let n of Rn(t)) { if (!n.startsWith(Ar)) { let r = Ar + n; e.has(r) && e.delete(r) } e.add(n) } In(Array.from(e)) } i(Pp, "enableNamespaces"); function vr() { return Rn(Mn().load() ?? "") } i(vr, "getNamespaces"); function Mn() { return Cr() ? se(null, "debug", so.default).value : so.default } i(Mn, "getSharedDebugLibInstance"); function Tp(t, e, n, ...r) { if (!Mn().enabled(t)) return; if (!Cr()) { console.debug(n, ...r); return } let o = 4, s = z(new Error().stack).split(` `); s.splice(0, o + e), console.debug(n, ...r, ` --- Logger stack trace: `, Ra(s.join(` `))) } i(Tp, "logWithCaller"); function Ra(t) { return new We("Debug mode: intentional placeholder error. See https://github.com/mnaoumov/obsidian-dev-utils/blob/main/docs/debugging.md.", t, void 0) } i(Ra, "makeStackTraceError"); function In(t) { Mn().enable(Rn(t).join(La)) } i(In, "setNamespaces"); function Rn(t) { return typeof t == "string" ? t.split(La).filter(Boolean) : t.flatMap(Rn) } i(Rn, "toArray"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); async function tn(t, e) { let n = {...e, abortSignal: e.abortSignal ?? Oe()}; return n.abortSignal.throwIfAborted(), Fp(t) ? await t(n) : t } i(tn, "resolveValue"); function Fp(t) { return typeof t == "function" } i(Fp, "isFunction"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Lp = {"\n": "\\n", "\r": "\\r", " ": "\\t", "\b": "\\b", "\f": "\\f", "'": "\\'", '"': '\\"', "\\": "\\\\"}; var Ip = {}; for (let [t, e] of Object.entries(Lp)) Ip[e] = t; function Na(t, e, n, r) { return r ??= n, t.slice(0, n) + e + t.slice(r) } i(Na, "insertAt"); function On(t) { return ce(t, /\u00A0|\u202F/g, " ").normalize("NFC") } i(On, "normalize"); function ce(t, e, n) { return typeof n > "u" ? t : (e instanceof RegExp && !e.global && (e = new RegExp(e.source, `${e.flags}g`)), typeof n == "string" ? t.replaceAll(e, n) : t.replaceAll(e, (r, ...o) => { let a = typeof o.at(-1) == "object", l = a ? o.length - 2 : o.length - 1, u = { capturedGroupArgs: [], groups: a ? o.at(-1) : void 0, missingGroupIndices: [], offset: o.at(l - 1), source: o.at(l), substring: r }; for (let c = 0; c < l - 1; c++) { let f = o[c]; typeof f == "string" ? u.capturedGroupArgs.push(f) : typeof f > "u" && u.missingGroupIndices.push(c) } return n(u) ?? u.substring })) } i(ce, "replaceAll"); function ao(t, e, n) { if (t.endsWith(e)) return t.slice(0, -e.length); if (n) throw new Error(`String ${t} does not end with suffix ${e}`); return t } i(ao, "trimEnd"); function Da(t, e, n) { if (t.startsWith(e)) return t.slice(e.length); if (n) throw new Error(`String ${t} does not start with prefix ${e}`); return t } i(Da, "trimStart"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Ba = ".", Mp = [{constructor: ArrayBuffer, equalityComparer: Op}, { constructor: Date, equalityComparer: Np }, {constructor: RegExp, equalityComparer: Bp}, {constructor: Map, equalityComparer: Dp}, { constructor: Set, equalityComparer: _p }]; function De(t, e) { if (t === e) return !0; if (typeof t != "object" || typeof e != "object" || t === null || e === null) return !1; let n = t.constructor, r = e.constructor; if (n !== r) return !1; if (n !== Object) { let u = Vp(t, e); if (u !== void 0) return u } let o = nn(t), s = nn(e); if (o.length !== s.length) return !1; let a = t, l = e; for (let u of o) if (!s.includes(u) || !De(a[u], l[u])) return !1; return !0 } i(De, "deepEqual"); function nn(t) { let e = [], n = t; for (; n;) { let r = Object.getOwnPropertyDescriptors(n); for (let [o, s] of Object.entries(r)) { if (o === "__proto__" || typeof s.value == "function") continue; let a = typeof s.get == "function", l = typeof s.set == "function"; if (a || l) { a && l && e.push(o); continue } s.enumerable && s.writable && e.push(o) } n = Object.getPrototypeOf(n) } return e.sort() } i(nn, "getAllKeys"); function ht(t, e) { let n = t, r = e.split(Ba); for (let o of r) { if (n === void 0) return; n = n[o] } return n } i(ht, "getNestedPropertyValue"); function at(t) { return t == null ? t : Object.getPrototypeOf(t) } i(at, "getPrototypeOf"); function _a(t, e, n) { let r = new Error(`Property path ${e} not found`), o = t, s = e.split(Ba); for (let l of s.slice(0, -1)) { if (o === void 0) throw r; o = o[l] } let a = z(s.at(-1)); if (o === void 0) throw r; o[a] = n } i(_a, "setNestedPropertyValue"); function uo(t, e = {}) { let n = { functionHandlingMode: "exclude", maxDepth: -1, shouldCatchToJSONErrors: !1, shouldHandleCircularReferences: !1, shouldHandleErrors: !1, shouldHandleUndefined: !1, shouldSortKeys: !1, space: 2, tokenSubstitutions: { circularReference: lo("CircularReference"), maxDepthLimitReached: lo("MaxDepthLimitReached"), toJSONFailed: lo("ToJSONFailed") } }, r = {...n, ...e, tokenSubstitutions: {...n.tokenSubstitutions, ...e.tokenSubstitutions}}; r.maxDepth === -1 && (r.maxDepth = 1 / 0); let o = [], a = Sr(t, "", 0, !0, r, o, new WeakSet), l = z(JSON.stringify(a, null, r.space)); return l = ce(l, /"\[\[(?[A-Za-z]+)(?\d*)\]\]"/g, ({capturedGroupArgs: [u = "", c = ""]}) => Rp({ functionTexts: o, index: c ? parseInt(c, 10) : 0, key: u, substitutions: r.tokenSubstitutions })), l } i(uo, "toJson"); function Rp(t) { switch (t.key) { case"CircularReference": return t.substitutions.circularReference; case"Function": return z(t.functionTexts[t.index], `Function with index ${String(t.index)} not found`); case"MaxDepthLimitReached": return t.substitutions.maxDepthLimitReached; case"MaxDepthLimitReachedArray": return `Array(${String(t.index)})`; case"ToJSONFailed": return t.substitutions.toJSONFailed; case"Undefined": return "undefined"; default: st(t.key) } } i(Rp, "applySubstitutions"); function Op(t, e) { if (t.byteLength !== e.byteLength) return !1; let n = new Uint8Array(t), r = new Uint8Array(e); return De(n, r) } i(Op, "deepEqualArrayBuffer"); function Np(t, e) { return t.getTime() === e.getTime() } i(Np, "deepEqualDate"); function Dp(t, e) { if (t.size !== e.size) return !1; for (let [n, r] of t.entries()) if (!e.has(n) || !De(r, e.get(n))) return !1; return !0 } i(Dp, "deepEqualMap"); function Bp(t, e) { return t.source === e.source && t.flags === e.flags } i(Bp, "deepEqualRegExp"); function _p(t, e) { if (t.size !== e.size) return !1; for (let n of t) { if (e.has(n)) continue; let r = !1; for (let o of e) if (De(n, o)) { r = !0; break } if (!r) return !1 } return !0 } i(_p, "deepEqualSet"); function Vp(t, e) { for (let n of Mp) { let r = jp(n, t, e); if (r !== void 0) return r } } i(Vp, "deepEqualTyped"); function zp(t, e, n, r, o, s) { return e > r.maxDepth ? rn("MaxDepthLimitReachedArray", t.length) : t.map((a, l) => Sr(a, String(l), e + 1, n, r, o, s)) } i(zp, "handleArray"); function $p(t, e, n) { if (n.shouldHandleCircularReferences) return rn("CircularReference"); let r = t.constructor.name || "Object"; throw new TypeError(`Converting circular structure to JSON --> starting at object with constructor '${r}' --- property '${e}' closes the circle`) } i($p, "handleCircularReference"); function Wp(t, e, n) { if (n.functionHandlingMode === "exclude") return; let r = e.length, o = n.functionHandlingMode === "full" ? ua(t) : `function ${t.name || "anonymous"}() { /* ... */ }`; return e.push(o), rn("Function", r) } i(Wp, "handleFunction"); function Up(t, e, n, r, o, s, a) { if (a.has(t)) return $p(t, e, o); if (a.add(t), r) { let l = Kp(t, e, n, o, s, a); if (l !== void 0) return l } return Array.isArray(t) ? zp(t, n, r, o, s, a) : n > o.maxDepth ? rn("MaxDepthLimitReached") : t instanceof Error && o.shouldHandleErrors ? kr(t) : Hp(t, n, r, o, s, a) } i(Up, "handleObject"); function Hp(t, e, n, r, o, s) { let a = Object.entries(t); return r.shouldSortKeys && a.sort(([l], [u]) => l.localeCompare(u)), Object.fromEntries(a.map(([l, u]) => [l, Sr(u, l, e + 1, n, r, o, s)])) } i(Hp, "handlePlainObject"); function lo(t) { return `{ "[[${t}]]": null }` } i(lo, "makeObjectTokenSubstitution"); function rn(t, e) { return `[[${t}${e ? String(e) : ""}]]` } i(rn, "makePlaceholder"); function Sr(t, e, n, r, o, s, a) { return t === void 0 ? n === 0 || o.shouldHandleUndefined ? rn("Undefined") : void 0 : typeof t == "function" ? Wp(t, s, o) : typeof t != "object" || t === null ? t : Up(t, e, n, r, o, s, a) } i(Sr, "toPlainObject"); function jp(t, e, n) { if (e instanceof t.constructor && n instanceof t.constructor) return t.equalityComparer(e, n) } i(jp, "tryEntryEquality"); function Kp(t, e, n, r, o, s) { let a = t.toJSON; if (typeof a == "function") try { let l = a.call(t, e); return Sr(l, e, n, !1, r, o, s) } catch (l) { if (r.shouldCatchToJSONErrors) return rn("ToJSONFailed"); throw l } } i(Kp, "tryHandleToJSON"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); async function Er(t, e) { e ??= Ce(1); try { await t() } catch (n) { let r = new We(wr, e, n); if (Gp(r)) return; br(r) } } i(Er, "addErrorHandler"); function Nn(t, e) { return e ??= Ce(1), (...n) => { Ge(e); let r = Ce(1); e = `${e} at --- convertAsyncToSync --- (0) ${r}`, ae(() => t(...n), e) } } i(Nn, "convertAsyncToSync"); function Gp(t) { let e = t; for (; !(e instanceof Zt);) { if (!(e instanceof Error)) return !1; e = e.cause } return K("Async:handleSilentError")(t), !0 } i(Gp, "handleSilentError"); function ae(t, e) { e ??= Ce(1); let n; try { n = t() } catch (r) { Er(() => Promise.reject(r), e) } n instanceof Promise && Er(() => n, e) } i(ae, "invokeAsyncSafely"); var qp = new WeakSet; async function Pr() { return new Promise(t => { window.requestAnimationFrame(() => { t() }) }) } i(Pr, "requestAnimationFrameAsync"); async function za(t) { let e = K("Async:retryWithTimeout"), n = t.stackTrace ?? Ce(1), o = {...{retryDelayInMilliseconds: 100, shouldRetryOnError: !1, timeoutInMilliseconds: 5e3}, ...t.retryOptions}; o.abortSignal?.throwIfAborted(), await co({ context: {operationName: t.operationName ?? "", retryFn: t.operationFn}, onTimeout: t.onTimeout, async operationFn(s) { let a = Ft(o.abortSignal, s); a.throwIfAborted(); let l = 0; for (; !a.aborted;) { l++; let u; try { u = await t.operationFn(a) } catch (c) { if (a.aborted || !o.shouldRetryOnError || qp.has(c)) throw new We("retryWithTimeout failed", n, c); pt(c), u = !1 } if (u) { qe(e, n, `Retry completed successfully after ${String(l)} attempts`, { operationFn: t.operationFn, operationName: t.operationName ?? "" }); return } qe(e, n, `Retry attempt ${String(l)} completed unsuccessfully. Trying again in ${String(o.retryDelayInMilliseconds)} milliseconds`, { operationFn: t.operationFn, operationName: t.operationName ?? "" }), await $a(o.retryDelayInMilliseconds, s) } }, operationName: t.operationName ?? "", stackTrace: n, timeoutInMilliseconds: o.timeoutInMilliseconds }) } i(za, "retryWithTimeout"); async function co(t) { let e = t.stackTrace ?? Ce(1), n = performance.now(), r = new AbortController, o = new AbortController, s = null, a = !1, l = !1, u = K("Async:runWithTimeout"), c = t.onTimeout ?? h; if (await Promise.race([f(), d()]), a) return s; throw new We("Run with timeout failed", e, r.signal.reason); async function f() { try { s = await t.operationFn(r.signal); let p = Math.trunc(performance.now() - n); qe(u, e, `Execution time: ${String(p)} milliseconds`, { context: t.context, operationFn: t.operationFn, operationName: t.operationName ?? "" }), a = !0 } catch (p) { r.abort(p) } finally { l = !0, o.abort(new Error("Completed")) } } async function d() { if (await $a(t.timeoutInMilliseconds, o.signal), l) return; let p = Math.trunc(performance.now() - n); qe(u, e, `Timed out after ${String(p)} milliseconds`, { context: t.context, operationFn: t.operationFn, operationName: t.operationName ?? "" }); let w = { duration: p, onOperationCompleted(y) { o.signal.addEventListener("abort", y) }, operationName: t.operationName ?? "", terminateOperation() { let y = new Error(`Timed out after ${String(p)} milliseconds`); r.abort(y), o.abort(y) } }; c(w), await Ji(o.signal) } function h(p) { p.terminateOperation() } } i(co, "runWithTimeout"); async function $a(t, e, n) { await Ji(Ft(e, ca(t))), n && e?.throwIfAborted() } i($a, "sleep"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function Jp(t) { let e = new Set; return t.workspace.iterateAllLeaves(n => { e.add(n.getContainer()) }), Array.from(e) } i(Jp, "getAllContainers"); function Wa(t) { return Jp(t).map(e => e.win) } i(Wa, "getAllDomWindows"); var Ua = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var j = class t extends Ua.Component { static { i(this, "ComponentEx") } childrenSet = new Set; loadErrors = []; loadPromise = null; addChild(e) { return this._children.push(e), this.childrenSet.add(e), this._loaded && this.appendEagerLoadStep(this.extractLoadPromisable(e)), e } load() { if (this._loaded) return; this._loaded = !0, this.resetLoadState(), this.onload(); let e = this.onloadAsync(); e !== ur && this.appendEagerLoadStep(e); for (let n of this._children.slice()) this.appendSequentialLoadStep(() => this.extractLoadPromisable(n)); if (this.loadPromise) return this.loadPromise } loadWithPromises() { this.load(); let e = this.loadPromise; return e ? e.then(() => { if (this.loadErrors.length > 0) throw new AggregateError(this.loadErrors) }) : this.loadErrors.length > 0 ? Promise.reject(new AggregateError(this.loadErrors)) : null } onloadAsync() { return ur } removeChild(e) { return super.removeChild(e), this.childrenSet.delete(e), e } [Symbol.dispose]() { this.unload() } ensureLoaded() { if (!this._loaded) throw new Error("Component is not loaded") } appendEagerLoadStep(e) { let n = this.captureSettled(e); if (!n) return; let r = this.loadPromise; this.setLoadPromise(r ? r.then(() => n) : n) } appendSequentialLoadStep(e) { let n = this.loadPromise; if (n) { this.setLoadPromise(n.then(() => this.runAndCapture(e))); return } let r = this.captureSync(e); r && this.setLoadPromise(r) } captureError(e) { this.loadErrors.push(gr.create(e)) } captureSettled(e) { return e == null ? null : Promise.resolve(e).then(ge, n => { this.captureError(n) }) } captureSync(e) { let n; try { n = e() } catch (r) { return this.captureError(r), null } return this.captureSettled(n) } extractLoadPromisable(e) { return this.childrenSet.has(e) ? e instanceof t ? e.loadWithPromises() : e.load() : null } resetLoadState() { this.loadErrors = [], this.loadPromise = null } async runAndCapture(e) { try { await (e() ?? void 0) } catch (n) { this.captureError(n) } } setLoadPromise(e) { let n = e.then(() => { this.loadPromise === n && (this.loadPromise = null) }); this.loadPromise = n } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var fo = class extends j { static { i(this, "LayoutReadyComponent") } app; constructor(e) { super(), this.app = e } onload() { this.app.workspace.onLayoutReady(() => { window.setTimeout(() => { this._loaded && ae(this.onLayoutReady.bind(this)) }, 0) }) } onLayoutReady() { } }, on = class extends fo { static { i(this, "CallbackLayoutReadyComponent") } callback; constructor(e, n) { super(e), this.callback = n } onLayoutReady() { return this.callback() } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var sn = class extends j { static { i(this, "AllWindowsEventComponent") } app; constructor(e) { super(), this.app = e } registerAllDocumentsDomEvent(e, n, r) { this.ensureLoaded(), this.registerAllWindowsHandler(o => { this.registerDomEvent(o.document, e, n, r) }) } registerAllWindowsDomEvent(e, n, r) { this.ensureLoaded(), this.registerAllWindowsHandler(o => { this.registerDomEvent(o, e, n, r) }) } registerAllWindowsHandler(e) { this.ensureLoaded(); let n = activeWindow; e(n), this.addChild(new on(this.app, () => { for (let r of Wa(this.app)) r !== n && e(r); this.registerEvent(this.app.workspace.on("window-open", r => { e(r.win) })) })) } }; function Ha(t, e) { let n = Object.keys(e).map(r => Yp(t, r, e[r])); return n.length === 1 ? n[0] : function () { n.forEach(r => r()) } } i(Ha, "around"); function Yp(t, e, n) { let r = t[e], o = t.hasOwnProperty(e), s = o ? r : function () { return Object.getPrototypeOf(t)[e].apply(this, arguments) }, a = n(s); return r && Object.setPrototypeOf(a, r), Object.setPrototypeOf(l, a), t[e] = l, u; function l(...c) { return a === s && t[e] === l && u(), a.apply(this, c) } i(l, "wrapper"); function u() { t[e] === l && (o ? t[e] = s : delete t[e]), a !== s && (a = s, Object.setPrototypeOf(l, r || Function)) } i(u, "remove") } i(Yp, "around1"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Fe = class extends j { static { i(this, "MonkeyAroundComponent") } registerMethodPatch(e) { if (this.ensureLoaded(), e.patchToken) { let n = e.obj[e.methodName]; Ka().set(n, e.patchToken) } this.registerPatch(e.obj, { [e.methodName]: n => { return r; function r(...o) { let s = this; return e.patchHandler({ fallback() { return n.call(s, ...o) }, originalArgs: o, originalMethod: n, originalMethodBound: n.bind(s), originalThis: s }) } } }) } registerPatch(e, n) { this.ensureLoaded(); let r = Qp(e, n); this.register(r) } }; function Qp(t, e) { return Ha(t, e) } i(Qp, "around"); function ja(t, e) { return Ka().get(t) === e } i(ja, "hasPatchToken"); function Ka() { return se(null, "monkeyAroundPatches", new WeakMap).value } i(Ka, "getMonkeyAroundPatches"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Tr = class extends j { static { i(this, "PluginSettingsTabComponent") } plugin; pluginSettingsTab; constructor(e) { super(), this.plugin = e.plugin, this.pluginSettingsTab = e.pluginSettingsTab } onload() { this.plugin.addSettingTab(this.pluginSettingsTab) } }; var R = i(t => typeof t == "string", "isString"), Dn = i(() => { let t, e, n = new Promise((r, o) => { t = r, e = o }); return n.resolve = t, n.reject = e, n }, "defer"), Ga = i(t => t == null ? "" : String(t), "makeString"), Xp = i((t, e, n) => { t.forEach(r => { e[r] && (n[r] = e[r]) }) }, "copy"), Zp = /###/g, qa = i(t => t && t.includes("###") ? t.replace(Zp, ".") : t, "cleanKey"), Ja = i(t => !t || R(t), "canNotTraverseDeeper"), Bn = i((t, e, n) => { let r = R(e) ? e.split(".") : e, o = 0; for (; o < r.length - 1;) { if (Ja(t)) return {}; let s = qa(r[o]); !t[s] && n && (t[s] = new n), Object.prototype.hasOwnProperty.call(t, s) ? t = t[s] : t = {}, ++o } return Ja(t) ? {} : {obj: t, k: qa(r[o])} }, "getLastOfPath"), Ya = i((t, e, n) => { let {obj: r, k: o} = Bn(t, e, Object); if (r !== void 0 || e.length === 1) { r[o] = n; return } let s = e[e.length - 1], a = e.slice(0, e.length - 1), l = Bn(t, a, Object); for (; l.obj === void 0 && a.length;) s = `${a[a.length - 1]}.${s}`, a = a.slice(0, a.length - 1), l = Bn(t, a, Object), l?.obj && typeof l.obj[`${l.k}.${s}`] < "u" && (l.obj = void 0); l.obj[`${l.k}.${s}`] = n }, "setPath"), eh = i((t, e, n, r) => { let {obj: o, k: s} = Bn(t, e, Object); o[s] = o[s] || [], o[s].push(n) }, "pushPath"), Lr = i((t, e) => { let {obj: n, k: r} = Bn(t, e); if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r] }, "getPath"), th = i((t, e, n) => { let r = Lr(t, n); return r !== void 0 ? r : Lr(e, n) }, "getPathWithDefaults"), nl = i((t, e, n) => { for (let r in e) r !== "__proto__" && r !== "constructor" && (r in t ? R(t[r]) || t[r] instanceof String || R(e[r]) || e[r] instanceof String ? n && (t[r] = e[r]) : nl(t[r], e[r], n) : t[r] = e[r]); return t }, "deepExtend"), lt = i(t => t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), "regexEscape"), nh = {"&": "&", "<": "<", ">": ">", '"': """, "'": "'", "/": "/"}, rh = i(t => R(t) ? t.replace(/[&<>"'\/]/g, e => nh[e]) : t, "escape"), go = class { static { i(this, "RegExpCache") } constructor(e) { this.capacity = e, this.regExpMap = new Map, this.regExpQueue = [] } getRegExp(e) { let n = this.regExpMap.get(e); if (n !== void 0) return n; let r = new RegExp(e); return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, r), this.regExpQueue.push(e), r } }, ih = [" ", ",", "?", "!", ";"], oh = new go(20), sh = i((t, e, n) => { e = e || "", n = n || ""; let r = ih.filter(a => !e.includes(a) && !n.includes(a)); if (r.length === 0) return !0; let o = oh.getRegExp(`(${r.map(a => a === "?" ? "\\?" : a).join("|")})`), s = !o.test(t); if (!s) { let a = t.indexOf(n); a > 0 && !o.test(t.substring(0, a)) && (s = !0) } return s }, "looksLikeObjectPath"), wo = i((t, e, n = ".") => { if (!t) return; if (t[e]) return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0; let r = e.split(n), o = t; for (let s = 0; s < r.length;) { if (!o || typeof o != "object") return; let a, l = ""; for (let u = s; u < r.length; ++u) if (u !== s && (l += n), l += r[u], a = o[l], a !== void 0) { if (["string", "number", "boolean"].includes(typeof a) && u < r.length - 1) continue; s += u - s + 1; break } o = a } return o }, "deepFind"), _n = i(t => t?.replace(/_/g, "-"), "getCleanedCode"), ah = { type: "logger", log(t) { this.output("log", t) }, warn(t) { this.output("warn", t) }, error(t) { this.output("error", t) }, output(t, e) { console?.[t]?.apply?.(console, e) } }, bo = class t { static { i(this, "Logger") } constructor(e, n = {}) { this.init(e, n) } init(e, n = {}) { this.prefix = n.prefix || "i18next:", this.logger = e || ah, this.options = n, this.debug = n.debug } log(...e) { return this.forward(e, "log", "", !0) } warn(...e) { return this.forward(e, "warn", "", !0) } error(...e) { return this.forward(e, "error", "") } deprecate(...e) { return this.forward(e, "warn", "WARNING DEPRECATED: ", !0) } forward(e, n, r, o) { return o && !this.debug ? null : (e = e.map(s => R(s) ? s.replace(/[\r\n\x00-\x1F\x7F]/g, " ") : s), R(e[0]) && (e[0] = `${r}${this.prefix} ${e[0]}`), this.logger[n](e)) } create(e) { return new t(this.logger, {prefix: `${this.prefix}:${e}:`, ...this.options}) } clone(e) { return e = e || this.options, e.prefix = e.prefix || this.prefix, new t(this.logger, e) } }, Je = new bo, ln = class { static { i(this, "EventEmitter") } constructor() { this.observers = {} } on(e, n) { return e.split(" ").forEach(r => { this.observers[r] || (this.observers[r] = new Map); let o = this.observers[r].get(n) || 0; this.observers[r].set(n, o + 1) }), this } off(e, n) { if (this.observers[e]) { if (!n) { delete this.observers[e]; return } this.observers[e].delete(n) } } once(e, n) { let r = i((...o) => { n(...o), this.off(e, r) }, "wrapper"); return this.on(e, r), this } emit(e, ...n) { this.observers[e] && Array.from(this.observers[e].entries()).forEach(([o, s]) => { for (let a = 0; a < s; a++) o(...n) }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([o, s]) => { for (let a = 0; a < s; a++) o(e, ...n) }) } }, Ir = class extends ln { static { i(this, "ResourceStore") } constructor(e, n = {ns: ["translation"], defaultNS: "translation"}) { super(), this.data = e || {}, this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0) } addNamespaces(e) { this.options.ns.includes(e) || this.options.ns.push(e) } removeNamespaces(e) { let n = this.options.ns.indexOf(e); n > -1 && this.options.ns.splice(n, 1) } getResource(e, n, r, o = {}) { let s = o.keySeparator !== void 0 ? o.keySeparator : this.options.keySeparator, a = o.ignoreJSONStructure !== void 0 ? o.ignoreJSONStructure : this.options.ignoreJSONStructure, l; e.includes(".") ? l = e.split(".") : (l = [e, n], r && (Array.isArray(r) ? l.push(...r) : R(r) && s ? l.push(...r.split(s)) : l.push(r))); let u = Lr(this.data, l); return !u && !n && !r && e.includes(".") && (e = l[0], n = l[1], r = l.slice(2).join(".")), u || !a || !R(r) ? u : wo(this.data?.[e]?.[n], r, s) } addResource(e, n, r, o, s = {silent: !1}) { let a = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, l = [e, n]; r && (l = l.concat(a ? r.split(a) : r)), e.includes(".") && (l = e.split("."), o = n, n = l[1]), this.addNamespaces(n), Ya(this.data, l, o), s.silent || this.emit("added", e, n, r, o) } addResources(e, n, r, o = {silent: !1}) { for (let s in r) (R(r[s]) || Array.isArray(r[s])) && this.addResource(e, n, s, r[s], {silent: !0}); o.silent || this.emit("added", e, n, r) } addResourceBundle(e, n, r, o, s, a = {silent: !1, skipCopy: !1}) { let l = [e, n]; e.includes(".") && (l = e.split("."), o = r, r = n, n = l[1]), this.addNamespaces(n); let u = Lr(this.data, l) || {}; a.skipCopy || (r = JSON.parse(JSON.stringify(r))), o ? nl(u, r, s) : u = {...u, ...r}, Ya(this.data, l, u), a.silent || this.emit("added", e, n, r) } removeResourceBundle(e, n) { this.hasResourceBundle(e, n) && delete this.data[e][n], this.removeNamespaces(n), this.emit("removed", e, n) } hasResourceBundle(e, n) { return this.getResource(e, n) !== void 0 } getResourceBundle(e, n) { return n || (n = this.options.defaultNS), this.getResource(e, n) } getDataByLanguage(e) { return this.data[e] } hasLanguageSomeTranslations(e) { let n = this.getDataByLanguage(e); return !!(n && Object.keys(n) || []).find(o => n[o] && Object.keys(n[o]).length > 0) } toJSON() { return this.data } }, rl = { processors: {}, addPostProcessor(t) { this.processors[t.name] = t }, handle(t, e, n, r, o) { return t.forEach(s => { e = this.processors[s]?.process(e, n, r, o) ?? e }), e } }, il = Symbol("i18next/PATH_KEY"); function lh() { let t = [], e = Object.create(null), n; return e.get = (r, o) => (n?.revoke?.(), o === il ? t : (t.push(o), n = Proxy.revocable(r, e), n.proxy)), Proxy.revocable(Object.create(null), e).proxy } i(lh, "createProxy"); function an(t, e) { let {[il]: n} = t(lh()), r = e?.keySeparator ?? ".", o = e?.nsSeparator ?? ":", s = e?.enableSelector === "strict"; if (n.length > 1 && o) { let a = e?.ns, l = s ? Array.isArray(a) ? a : a ? [a] : null : Array.isArray(a) ? a : null; if (l && (s ? l : l.length > 1 ? l.slice(1) : []).includes(n[0])) return `${n[0]}${o}${n.slice(1).join(r)}` } return n.join(r) } i(an, "keysFromSelector"); var po = i(t => !R(t) && typeof t != "boolean" && typeof t != "number", "shouldHandleAsObject"), Mr = class t extends ln { static { i(this, "Translator") } constructor(e, n = {}) { super(), Xp(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = Je.create("translator"), this.checkedLoadedFor = {} } static hasDefaultValue(e) { let n = "defaultValue"; for (let r in e) if (Object.prototype.hasOwnProperty.call(e, r) && r.startsWith(n) && e[r] !== void 0) return !0; return !1 } changeLanguage(e) { e && (this.language = e) } exists(e, n = {interpolation: {}}) { let r = {...n}; if (e == null) return !1; let o = this.resolve(e, r); if (o?.res === void 0) return !1; let s = po(o.res); return !(r.returnObjects === !1 && s) } extractFromKey(e, n) { let r = n.nsSeparator !== void 0 ? n.nsSeparator : this.options.nsSeparator; r === void 0 && (r = ":"); let o = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, s = n.ns || this.options.defaultNS || [], a = r && e.includes(r), l = !this.options.userDefinedKeySeparator && !n.keySeparator && !this.options.userDefinedNsSeparator && !n.nsSeparator && !sh(e, r, o); if (a && !l) { let u = e.match(this.interpolator.nestingRegexp); if (u && u.length > 0) return {key: e, namespaces: R(s) ? [s] : s}; let c = e.split(r); (r !== o || r === o && this.options.ns.includes(c[0])) && (s = c.shift()), e = c.join(o) } return {key: e, namespaces: R(s) ? [s] : s} } translate(e, n, r) { let o = typeof n == "object" ? {...n} : n; if (typeof o != "object" && this.options.overloadTranslationOptionHandler && (o = this.options.overloadTranslationOptionHandler(arguments)), typeof o == "object" && (o = {...o}), o || (o = {}), e == null) return ""; typeof e == "function" && (e = an(e, {...this.options, ...o})), Array.isArray(e) || (e = [String(e)]), e = e.map(E => typeof E == "function" ? an(E, {...this.options, ...o}) : String(E)); let s = o.returnDetails !== void 0 ? o.returnDetails : this.options.returnDetails, a = o.keySeparator !== void 0 ? o.keySeparator : this.options.keySeparator, { key: l, namespaces: u } = this.extractFromKey(e[e.length - 1], o), c = u[u.length - 1], f = o.nsSeparator !== void 0 ? o.nsSeparator : this.options.nsSeparator; f === void 0 && (f = ":"); let d = o.lng || this.language, h = o.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode; if (d?.toLowerCase() === "cimode") return h ? s ? { res: `${c}${f}${l}`, usedKey: l, exactUsedKey: l, usedLng: d, usedNS: c, usedParams: this.getUsedParamsDetails(o) } : `${c}${f}${l}` : s ? { res: l, usedKey: l, exactUsedKey: l, usedLng: d, usedNS: c, usedParams: this.getUsedParamsDetails(o) } : l; let p = this.resolve(e, o), w = p?.res, y = p?.usedKey || l, b = p?.exactUsedKey || l, k = ["[object Number]", "[object Function]", "[object RegExp]"], x = o.joinArrays !== void 0 ? o.joinArrays : this.options.joinArrays, v = !this.i18nFormat || this.i18nFormat.handleAsObject, P = o.count !== void 0 && !R(o.count), L = t.hasDefaultValue(o), C = P ? this.pluralResolver.getSuffix(d, o.count, o) : "", O = o.ordinal && P ? this.pluralResolver.getSuffix(d, o.count, {ordinal: !1}) : "", W = P && !o.ordinal && o.count === 0, I = W && o[`defaultValue${this.options.pluralSeparator}zero`] || o[`defaultValue${C}`] || o[`defaultValue${O}`] || o.defaultValue, D = w; v && !w && L && (D = I); let ne = po(D), U = Object.prototype.toString.apply(D); if (v && D && ne && !k.includes(U) && !(R(x) && Array.isArray(D))) { if (!o.returnObjects && !this.options.returnObjects) { this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!"); let E = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(y, D, { ...o, ns: u }) : `key '${l} (${this.language})' returned an object instead of string.`; return s ? (p.res = E, p.usedParams = this.getUsedParamsDetails(o), p) : E } if (a) { let E = Array.isArray(D), F = E ? [] : {}, M = E ? b : y; for (let V in D) if (Object.prototype.hasOwnProperty.call(D, V)) { let H = `${M}${a}${V}`; L && !w ? F[V] = this.translate(H, { ...o, defaultValue: po(I) ? I[V] : void 0, joinArrays: !1, ns: u }) : F[V] = this.translate(H, {...o, joinArrays: !1, ns: u}), F[V] === H && (F[V] = D[V]) } w = F } } else if (v && R(x) && Array.isArray(w)) w = w.join(x), w && (w = this.extendTranslation(w, e, o, r)); else { let E = !1, F = !1; !this.isValidLookup(w) && L && (E = !0, w = I), this.isValidLookup(w) || (F = !0, w = l); let V = (o.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && F ? void 0 : w, H = L && I !== w && this.options.updateMissing; if (F || E || H) { if (this.logger.log(H ? "updateKey" : "missingKey", d, c, P && !H ? `${l}${this.pluralResolver.getSuffix(d, o.count, o)}` : l, H ? I : w), a) { let q = this.resolve(l, {...o, keySeparator: !1}); q && q.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.") } let re = [], me = this.languageUtils.getFallbackCodes(this.options.fallbackLng, o.lng || this.language); if (this.options.saveMissingTo === "fallback" && me && me[0]) for (let q = 0; q < me.length; q++) re.push(me[q]); else this.options.saveMissingTo === "all" ? re = this.languageUtils.toResolveHierarchy(o.lng || this.language) : re.push(o.lng || this.language); let m = i((q, ie, g) => { let ue = L && g !== w ? g : V; this.options.missingKeyHandler ? this.options.missingKeyHandler(q, c, ie, ue, H, o) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(q, c, ie, ue, H, o), this.emit("missingKey", q, c, ie, w) }, "send"); this.options.saveMissing && (this.options.saveMissingPlurals && P ? re.forEach(q => { let ie = this.pluralResolver.getSuffixes(q, o); W && o[`defaultValue${this.options.pluralSeparator}zero`] && !ie.includes(`${this.options.pluralSeparator}zero`) && ie.push(`${this.options.pluralSeparator}zero`), ie.forEach(g => { m([q], l + g, o[`defaultValue${g}`] || I) }) }) : m(re, l, I)) } w = this.extendTranslation(w, e, o, p, r), F && w === l && this.options.appendNamespaceToMissingKey && (w = `${c}${f}${l}`), (F || E) && this.options.parseMissingKeyHandler && (w = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${c}${f}${l}` : l, E ? w : void 0, o)) } return s ? (p.res = w, p.usedParams = this.getUsedParamsDetails(o), p) : w } extendTranslation(e, n, r, o, s) { if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {...this.options.interpolation.defaultVariables, ...r}, r.lng || this.language || o.usedLng, o.usedNS, o.usedKey, {resolved: o}); else if (!r.skipInterpolation) { r.interpolation && this.interpolator.init({ ...r, interpolation: {...this.options.interpolation, ...r.interpolation} }); let u = R(e) && (r?.interpolation?.skipOnVariables !== void 0 ? r.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables), c; if (u) { let d = e.match(this.interpolator.nestingRegexp); c = d && d.length } let f = r.replace && !R(r.replace) ? r.replace : r; if (this.options.interpolation.defaultVariables && (f = {...this.options.interpolation.defaultVariables, ...f}), e = this.interpolator.interpolate(e, f, r.lng || this.language || o.usedLng, r), u) { let d = e.match(this.interpolator.nestingRegexp), h = d && d.length; c < h && (r.nest = !1) } !r.lng && o && o.res && (r.lng = this.language || o.usedLng), r.nest !== !1 && (e = this.interpolator.nest(e, (...d) => s?.[0] === d[0] && !r.context ? (this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${n[0]}`), null) : this.translate(...d, n), r)), r.interpolation && this.interpolator.reset() } let a = r.postProcess || this.options.postProcess, l = R(a) ? [a] : a; return e != null && l?.length && r.applyPostProcessor !== !1 && (e = rl.handle(l, e, n, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...o, usedParams: this.getUsedParamsDetails(r) }, ...r } : r, this)), e } resolve(e, n = {}) { let r, o, s, a, l; return R(e) && (e = [e]), Array.isArray(e) && (e = e.map(u => typeof u == "function" ? an(u, {...this.options, ...n}) : u)), e.forEach(u => { if (this.isValidLookup(r)) return; let c = this.extractFromKey(u, n), f = c.key; o = f; let d = c.namespaces; this.options.fallbackNS && (d = d.concat(this.options.fallbackNS)); let h = n.count !== void 0 && !R(n.count), p = h && !n.ordinal && n.count === 0, w = n.context !== void 0 && (R(n.context) || typeof n.context == "number") && n.context !== "", y = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng); d.forEach(b => { this.isValidLookup(r) || (l = b, !this.checkedLoadedFor[`${y[0]}-${b}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(l) && (this.checkedLoadedFor[`${y[0]}-${b}`] = !0, this.logger.warn(`key "${o}" for languages "${y.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), y.forEach(k => { if (this.isValidLookup(r)) return; a = k; let x = [f]; if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(x, f, k, b, n); else { let P; h && (P = this.pluralResolver.getSuffix(k, n.count, n)); let L = `${this.options.pluralSeparator}zero`, C = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`; if (h && (n.ordinal && P.startsWith(C) && x.push(f + P.replace(C, this.options.pluralSeparator)), x.push(f + P), p && x.push(f + L)), w) { let O = `${f}${this.options.contextSeparator || "_"}${n.context}`; x.push(O), h && (n.ordinal && P.startsWith(C) && x.push(O + P.replace(C, this.options.pluralSeparator)), x.push(O + P), p && x.push(O + L)) } } let v; for (; v = x.pop();) this.isValidLookup(r) || (s = v, r = this.getResource(k, b, v, n)) })) }) }), {res: r, usedKey: o, exactUsedKey: s, usedLng: a, usedNS: l} } isValidLookup(e) { return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "") } getResource(e, n, r, o = {}) { return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, n, r, o) : this.resourceStore.getResource(e, n, r, o) } getUsedParamsDetails(e = {}) { let n = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], r = e.replace && !R(e.replace), o = r ? e.replace : e; if (r && typeof e.count < "u" && (o.count = e.count), this.options.interpolation.defaultVariables && (o = {...this.options.interpolation.defaultVariables, ...o}), !r) { o = {...o}; for (let s of n) delete o[s] } return o } }, Rr = class { static { i(this, "LanguageUtil") } constructor(e) { this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = Je.create("languageUtils") } getScriptPartFromCode(e) { if (e = _n(e), !e || !e.includes("-")) return null; let n = e.split("-"); return n.length === 2 || (n.pop(), n[n.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(n.join("-")) } getLanguagePartFromCode(e) { if (e = _n(e), !e || !e.includes("-")) return e; let n = e.split("-"); return this.formatLanguageCode(n[0]) } formatLanguageCode(e) { if (R(e) && e.includes("-")) { let n; try { n = Intl.getCanonicalLocales(e)[0] } catch { } return n && this.options.lowerCaseLng && (n = n.toLowerCase()), n || (this.options.lowerCaseLng ? e.toLowerCase() : e) } return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e } isSupportedCode(e) { return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.includes(e) } getBestMatchFromCodes(e) { if (!e) return null; let n; return e.forEach(r => { if (n) return; let o = this.formatLanguageCode(r); (!this.options.supportedLngs || this.isSupportedCode(o)) && (n = o) }), !n && this.options.supportedLngs && e.forEach(r => { if (n) return; let o = this.getScriptPartFromCode(r); if (this.isSupportedCode(o)) return n = o; let s = this.getLanguagePartFromCode(r); if (this.isSupportedCode(s)) return n = s; n = this.options.supportedLngs.find(a => a === s ? !0 : !a.includes("-") && !s.includes("-") ? !1 : !!(a.includes("-") && !s.includes("-") && a.slice(0, a.indexOf("-")) === s || a.startsWith(s) && s.length > 1)) }), n || (n = this.getFallbackCodes(this.options.fallbackLng)[0]), n } getFallbackCodes(e, n) { if (!e) return []; if (typeof e == "function" && (e = e(n)), R(e) && (e = [e]), Array.isArray(e)) return e; if (!n) return e.default || []; let r = e[n]; return r || (r = e[this.getScriptPartFromCode(n)]), r || (r = e[this.formatLanguageCode(n)]), r || (r = e[this.getLanguagePartFromCode(n)]), r || (r = e.default), r || [] } toResolveHierarchy(e, n) { let r = this.getFallbackCodes((n === !1 ? [] : n) || this.options.fallbackLng || [], e), o = [], s = i(a => { a && (this.isSupportedCode(a) ? o.push(a) : this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`)) }, "addCode"); return R(e) && (e.includes("-") || e.includes("_")) ? (this.options.load !== "languageOnly" && s(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && s(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && s(this.getLanguagePartFromCode(e))) : R(e) && s(this.formatLanguageCode(e)), r.forEach(a => { o.includes(a) || s(this.formatLanguageCode(a)) }), o } }, Qa = {zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5}, Xa = { select: i(t => t === 1 ? "one" : "other", "select"), resolvedOptions: i(() => ({pluralCategories: ["one", "other"]}), "resolvedOptions") }, ko = class { static { i(this, "PluralResolver") } constructor(e, n = {}) { this.languageUtils = e, this.options = n, this.logger = Je.create("pluralResolver"), this.pluralRulesCache = {} } clearCache() { this.pluralRulesCache = {} } getRule(e, n = {}) { let r = _n(e === "dev" ? "en" : e), o = n.ordinal ? "ordinal" : "cardinal", s = JSON.stringify({cleanedCode: r, type: o}); if (s in this.pluralRulesCache) return this.pluralRulesCache[s]; let a; try { a = new Intl.PluralRules(r, {type: o}) } catch { if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), Xa; if (!e.match(/-|_/)) return Xa; let u = this.languageUtils.getLanguagePartFromCode(e); a = this.getRule(u, n) } return this.pluralRulesCache[s] = a, a } needsPlural(e, n = {}) { let r = this.getRule(e, n); return r || (r = this.getRule("dev", n)), r?.resolvedOptions().pluralCategories.length > 1 } getPluralFormsOfKey(e, n, r = {}) { return this.getSuffixes(e, r).map(o => `${n}${o}`) } getSuffixes(e, n = {}) { let r = this.getRule(e, n); return r || (r = this.getRule("dev", n)), r ? r.resolvedOptions().pluralCategories.sort((o, s) => Qa[o] - Qa[s]).map(o => `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${o}`) : [] } getSuffix(e, n, r = {}) { let o = this.getRule(e, r); return o ? `${this.options.prepend}${r.ordinal ? `ordinal${this.options.prepend}` : ""}${o.select(n)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", n, r)) } }, Za = i((t, e, n, r = ".", o = !0) => { let s = th(t, e, n); return !s && o && R(n) && (s = wo(t, n, r), s === void 0 && (s = wo(e, n, r))), s }, "deepFindWithDefaults"), ho = i(t => t.replace(/\$/g, "$$$$"), "regexSafe"), Or = class { static { i(this, "Interpolator") } constructor(e = {}) { this.logger = Je.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || (n => n), this.init(e) } init(e = {}) { e.interpolation || (e.interpolation = {escapeValue: !0}); let { escape: n, escapeValue: r, useRawValueToEscape: o, prefix: s, prefixEscaped: a, suffix: l, suffixEscaped: u, formatSeparator: c, unescapeSuffix: f, unescapePrefix: d, nestingPrefix: h, nestingPrefixEscaped: p, nestingSuffix: w, nestingSuffixEscaped: y, nestingOptionsSeparator: b, maxReplaces: k, alwaysFormat: x } = e.interpolation; this.escape = n !== void 0 ? n : rh, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = o !== void 0 ? o : !1, this.prefix = s ? lt(s) : a || "{{", this.suffix = l ? lt(l) : u || "}}", this.formatSeparator = c || ",", this.unescapePrefix = f ? "" : d ? lt(d) : "-", this.unescapeSuffix = this.unescapePrefix ? "" : f ? lt(f) : "", this.nestingPrefix = h ? lt(h) : p || lt("$t("), this.nestingSuffix = w ? lt(w) : y || lt(")"), this.nestingOptionsSeparator = b || ",", this.maxReplaces = k || 1e3, this.alwaysFormat = x !== void 0 ? x : !1, this.resetRegExp() } reset() { this.options && this.init(this.options) } resetRegExp() { let e = i((n, r) => n?.source === r ? (n.lastIndex = 0, n) : new RegExp(r, "g"), "getOrResetRegExp"); this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`) } interpolate(e, n, r, o) { let s, a, l, u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = i(p => { if (!p.includes(this.formatSeparator)) { let k = Za(n, u, p, this.options.keySeparator, this.options.ignoreJSONStructure); return this.alwaysFormat ? this.format(k, void 0, r, {...o, ...n, interpolationkey: p}) : k } let w = p.split(this.formatSeparator), y = w.shift().trim(), b = w.join(this.formatSeparator).trim(); return this.format(Za(n, u, y, this.options.keySeparator, this.options.ignoreJSONStructure), b, r, { ...o, ...n, interpolationkey: y }) }, "handleFormat"); this.resetRegExp(), !this.escapeValue && typeof e == "string" && /\$t\([^)]*\{[^}]*\{\{/.test(e) && this.logger.warn("nesting options string contains interpolated variables with escapeValue: false \u2014 if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true."); let f = o?.missingInterpolationHandler || this.options.missingInterpolationHandler, d = o?.interpolation?.skipOnVariables !== void 0 ? o.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables; return [{regex: this.regexpUnescape, safeValue: i(p => ho(p), "safeValue")}, { regex: this.regexp, safeValue: i(p => this.escapeValue ? ho(this.escape(p)) : ho(p), "safeValue") }].forEach(p => { for (l = 0; s = p.regex.exec(e);) { let w = s[1].trim(); if (a = c(w), a === void 0) if (typeof f == "function") { let b = f(e, s, o); a = R(b) ? b : "" } else if (o && Object.prototype.hasOwnProperty.call(o, w)) a = ""; else if (d) { a = s[0]; continue } else this.logger.warn(`missed to pass in variable ${w} for interpolating ${e}`), a = ""; else !R(a) && !this.useRawValueToEscape && (a = Ga(a)); let y = p.safeValue(a); if (e = e.replace(s[0], y), d ? (p.regex.lastIndex += a.length, p.regex.lastIndex -= s[0].length) : p.regex.lastIndex = 0, l++, l >= this.maxReplaces) break } }), e } nest(e, n, r = {}) { let o, s, a, l = i((u, c) => { let f = this.nestingOptionsSeparator; if (!u.includes(f)) return u; let d = u.split(new RegExp(`${lt(f)}[ ]*{`)), h = `{${d[1]}`; u = d[0], h = this.interpolate(h, a); let p = h.match(/'/g), w = h.match(/"/g); ((p?.length ?? 0) % 2 === 0 && !w || (w?.length ?? 0) % 2 !== 0) && (h = h.replace(/'/g, '"')); try { a = JSON.parse(h), c && (a = {...c, ...a}) } catch (y) { return this.logger.warn(`failed parsing options string in nesting for key ${u}`, y), `${u}${f}${h}` } return a.defaultValue && a.defaultValue.includes(this.prefix) && delete a.defaultValue, u }, "handleHasOptions"); for (; o = this.nestingRegexp.exec(e);) { let u = []; a = {...r}, a = a.replace && !R(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue; let c = /{.*}/.test(o[1]) ? o[1].lastIndexOf("}") + 1 : o[1].indexOf(this.formatSeparator); if (c !== -1 && (u = o[1].slice(c).split(this.formatSeparator).map(f => f.trim()).filter(Boolean), o[1] = o[1].slice(0, c)), s = n(l.call(this, o[1].trim(), a), a), s && o[0] === e && !R(s)) return s; R(s) || (s = Ga(s)), s || (this.logger.warn(`missed to resolve ${o[1]} for nesting ${e}`), s = ""), u.length && (s = u.reduce((f, d) => this.format(f, d, r.lng, { ...r, interpolationkey: o[1].trim() }), s.trim())), e = e.replace(o[0], s), this.regexp.lastIndex = 0 } return e } }, uh = i(t => { let e = t.toLowerCase().trim(), n = {}; if (t.includes("(")) { let r = t.split("("); e = r[0].toLowerCase().trim(); let o = r[1].slice(0, -1); e === "currency" && !o.includes(":") ? n.currency || (n.currency = o.trim()) : e === "relativetime" && !o.includes(":") ? n.range || (n.range = o.trim()) : o.split(";").forEach(a => { if (a) { let [l, ...u] = a.split(":"), c = u.join(":").trim().replace(/^'+|'+$/g, ""), f = l.trim(); n[f] || (n[f] = c), c === "false" && (n[f] = !1), c === "true" && (n[f] = !0), isNaN(c) || (n[f] = parseInt(c, 10)) } }) } return {formatName: e, formatOptions: n} }, "parseFormatStr"), el = i(t => { let e = {}; return (n, r, o) => { let s = o; o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey] && (s = { ...s, [o.interpolationkey]: void 0 }); let a = r + JSON.stringify(s), l = e[a]; return l || (l = t(_n(r), o), e[a] = l), l(n) } }, "createCachedFormatter"), ch = i(t => (e, n, r) => t(_n(n), r)(e), "createNonCachedFormatter"), yo = class { static { i(this, "Formatter") } constructor(e = {}) { this.logger = Je.create("formatter"), this.options = e, this.init(e) } init(e, n = {interpolation: {}}) { this.formatSeparator = n.interpolation.formatSeparator || ","; let r = n.cacheInBuiltFormats ? el : ch; this.formats = { number: r((o, s) => { let a = new Intl.NumberFormat(o, {...s}); return l => a.format(l) }), currency: r((o, s) => { let a = new Intl.NumberFormat(o, {...s, style: "currency"}); return l => a.format(l) }), datetime: r((o, s) => { let a = new Intl.DateTimeFormat(o, {...s}); return l => a.format(l) }), relativetime: r((o, s) => { let a = new Intl.RelativeTimeFormat(o, {...s}); return l => a.format(l, s.range || "day") }), list: r((o, s) => { let a = new Intl.ListFormat(o, {...s}); return l => a.format(l) }) } } add(e, n) { this.formats[e.toLowerCase().trim()] = n } addCached(e, n) { this.formats[e.toLowerCase().trim()] = el(n) } format(e, n, r, o = {}) { if (!n || e == null) return e; let s = n.split(this.formatSeparator); if (s.length > 1 && s[0].indexOf("(") > 1 && !s[0].includes(")") && s.find(l => l.includes(")"))) { let l = s.findIndex(u => u.includes(")")); s[0] = [s[0], ...s.splice(1, l)].join(this.formatSeparator) } return s.reduce((l, u) => { let {formatName: c, formatOptions: f} = uh(u); if (this.formats[c]) { let d = l; try { let h = o?.formatParams?.[o.interpolationkey] || {}, p = h.locale || h.lng || o.locale || o.lng || r; d = this.formats[c](l, p, {...f, ...o, ...h}) } catch (h) { this.logger.warn(h) } return d } else this.logger.warn(`there was no format function for ${c}`); return l }, e) } }, fh = i((t, e) => { t.pending[e] !== void 0 && (delete t.pending[e], t.pendingCount--) }, "removePending"), Co = class extends ln { static { i(this, "Connector") } constructor(e, n, r, o = {}) { super(), this.backend = e, this.store = n, this.services = r, this.languageUtils = r.languageUtils, this.options = o, this.logger = Je.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = o.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = o.maxRetries >= 0 ? o.maxRetries : 5, this.retryTimeout = o.retryTimeout >= 1 ? o.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(r, o.backend, o) } queueLoad(e, n, r, o) { let s = {}, a = {}, l = {}, u = {}; return e.forEach(c => { let f = !0; n.forEach(d => { let h = `${c}|${d}`; !r.reload && this.store.hasResourceBundle(c, d) ? this.state[h] = 2 : this.state[h] < 0 || (this.state[h] === 1 ? a[h] === void 0 && (a[h] = !0) : (this.state[h] = 1, f = !1, a[h] === void 0 && (a[h] = !0), s[h] === void 0 && (s[h] = !0), u[d] === void 0 && (u[d] = !0))) }), f || (l[c] = !0) }), (Object.keys(s).length || Object.keys(a).length) && this.queue.push({ pending: a, pendingCount: Object.keys(a).length, loaded: {}, errors: [], callback: o }), { toLoad: Object.keys(s), pending: Object.keys(a), toLoadLanguages: Object.keys(l), toLoadNamespaces: Object.keys(u) } } loaded(e, n, r) { let o = e.split("|"), s = o[0], a = o[1]; n && this.emit("failedLoading", s, a, n), !n && r && this.store.addResourceBundle(s, a, r, void 0, void 0, {skipCopy: !0}), this.state[e] = n ? -1 : 2, n && r && (this.state[e] = 0); let l = {}; this.queue.forEach(u => { eh(u.loaded, [s], a), fh(u, e), n && u.errors.push(n), u.pendingCount === 0 && !u.done && (Object.keys(u.loaded).forEach(c => { l[c] || (l[c] = {}); let f = u.loaded[c]; f.length && f.forEach(d => { l[c][d] === void 0 && (l[c][d] = !0) }) }), u.done = !0, u.errors.length ? u.callback(u.errors) : u.callback()) }), this.emit("loaded", l), this.queue = this.queue.filter(u => !u.done) } read(e, n, r, o = 0, s = this.retryTimeout, a) { if (!e.length) return a(null, {}); if (this.readingCalls >= this.maxParallelReads) { this.waitingReads.push({lng: e, ns: n, fcName: r, tried: o, wait: s, callback: a}); return } this.readingCalls++; let l = i((c, f) => { if (this.readingCalls--, this.waitingReads.length > 0) { let d = this.waitingReads.shift(); this.read(d.lng, d.ns, d.fcName, d.tried, d.wait, d.callback) } if (c && f && o < this.maxRetries) { setTimeout(() => { this.read(e, n, r, o + 1, s * 2, a) }, s); return } a(c, f) }, "resolver"), u = this.backend[r].bind(this.backend); if (u.length === 2) { try { let c = u(e, n); c && typeof c.then == "function" ? c.then(f => l(null, f)).catch(l) : l(null, c) } catch (c) { l(c) } return } return u(e, n, l) } prepareLoading(e, n, r = {}, o) { if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), o && o(); R(e) && (e = this.languageUtils.toResolveHierarchy(e)), R(n) && (n = [n]); let s = this.queueLoad(e, n, r, o); if (!s.toLoad.length) return s.pending.length || o(), null; s.toLoad.forEach(a => { this.loadOne(a) }) } load(e, n, r) { this.prepareLoading(e, n, {}, r) } reload(e, n, r) { this.prepareLoading(e, n, {reload: !0}, r) } loadOne(e, n = "") { let r = e.split("|"), o = r[0], s = r[1]; this.read(o, s, "read", void 0, void 0, (a, l) => { a && this.logger.warn(`${n}loading namespace ${s} for language ${o} failed`, a), !a && l && this.logger.log(`${n}loaded namespace ${s} for language ${o}`, l), this.loaded(e, a, l) }) } saveMissing(e, n, r, o, s, a = {}, l = () => { }) { if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(n)) { this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"); return } if (!(r == null || r === "")) { if (this.backend?.create) { let u = {...a, isUpdate: s}, c = this.backend.create.bind(this.backend); if (c.length < 6) try { let f; c.length === 5 ? f = c(e, n, r, o, u) : f = c(e, n, r, o), f && typeof f.then == "function" ? f.then(d => l(null, d)).catch(l) : l(null, f) } catch (f) { l(f) } else c(e, n, r, o, l, u) } !e || !e[0] || this.store.addResource(e[0], n, r, o) } } }, mo = i(() => ({ debug: !1, initAsync: !0, ns: ["translation"], defaultNS: ["translation"], fallbackLng: ["dev"], fallbackNS: !1, supportedLngs: !1, nonExplicitSupportedLngs: !1, load: "all", preload: !1, keySeparator: ".", nsSeparator: ":", pluralSeparator: "_", contextSeparator: "_", enableSelector: !1, partialBundledLanguages: !1, saveMissing: !1, updateMissing: !1, saveMissingTo: "fallback", saveMissingPlurals: !0, missingKeyHandler: !1, missingInterpolationHandler: !1, postProcess: !1, postProcessPassResolved: !1, returnNull: !1, returnEmptyString: !0, returnObjects: !1, joinArrays: !1, returnedObjectHandler: !1, parseMissingKeyHandler: !1, appendNamespaceToMissingKey: !1, appendNamespaceToCIMode: !1, overloadTranslationOptionHandler: i(t => { let e = {}; if (typeof t[1] == "object" && (e = t[1]), R(t[1]) && (e.defaultValue = t[1]), R(t[2]) && (e.tDescription = t[2]), typeof t[2] == "object" || typeof t[3] == "object") { let n = t[3] || t[2]; Object.keys(n).forEach(r => { e[r] = n[r] }) } return e }, "overloadTranslationOptionHandler"), interpolation: { escapeValue: !0, prefix: "{{", suffix: "}}", formatSeparator: ",", unescapePrefix: "-", nestingPrefix: "$t(", nestingSuffix: ")", nestingOptionsSeparator: ",", maxReplaces: 1e3, skipOnVariables: !0 }, cacheInBuiltFormats: !0 }), "get"), tl = i(t => (R(t.ns) && (t.ns = [t.ns]), R(t.fallbackLng) && (t.fallbackLng = [t.fallbackLng]), R(t.fallbackNS) && (t.fallbackNS = [t.fallbackNS]), t.supportedLngs && !t.supportedLngs.includes("cimode") && (t.supportedLngs = t.supportedLngs.concat(["cimode"])), t), "transformOptions"), Fr = i(() => { }, "noop"), dh = i(t => { Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n => { typeof t[n] == "function" && (t[n] = t[n].bind(t)) }) }, "bindMemberFunctions"), xo = class t extends ln { static { i(this, "I18n") } constructor(e = {}, n) { if (super(), this.options = tl(e), this.services = {}, this.logger = Je, this.modules = {external: []}, dh(this), n && !this.isInitialized && !e.isClone) { if (!this.options.initAsync) return this.init(e, n), this; setTimeout(() => { this.init(e, n) }, 0) } } static createInstance(e = {}, n) { let r = new t(e, n); return r.createInstance = t.createInstance, r } init(e = {}, n) { this.isInitializing = !0, typeof e == "function" && (n = e, e = {}), e.defaultNS == null && e.ns && (R(e.ns) ? e.defaultNS = e.ns : e.ns.includes("translation") || (e.defaultNS = e.ns[0])); let r = mo(); this.options = {...r, ...this.options, ...tl(e)}, this.options.interpolation = {...r.interpolation, ...this.options.interpolation}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = r.overloadTranslationOptionHandler); let o = i(c => c ? typeof c == "function" ? new c : c : null, "createClassOnDemand"); if (!this.options.isClone) { this.modules.logger ? Je.init(o(this.modules.logger), this.options) : Je.init(null, this.options); let c; this.modules.formatter ? c = this.modules.formatter : c = yo; let f = new Rr(this.options); this.store = new Ir(this.options.resources, this.options); let d = this.services; d.logger = Je, d.resourceStore = this.store, d.languageUtils = f, d.pluralResolver = new ko(f, {prepend: this.options.pluralSeparator}), c && (d.formatter = o(c), d.formatter.init && d.formatter.init(d, this.options), this.options.interpolation.format = d.formatter.format.bind(d.formatter)), d.interpolator = new Or(this.options), d.utils = {hasLoadedNamespace: this.hasLoadedNamespace.bind(this)}, d.backendConnector = new Co(o(this.modules.backend), d.resourceStore, d, this.options), d.backendConnector.on("*", (h, ...p) => { this.emit(h, ...p) }), this.modules.languageDetector && (d.languageDetector = o(this.modules.languageDetector), d.languageDetector.init && d.languageDetector.init(d, this.options.detection, this.options)), this.modules.i18nFormat && (d.i18nFormat = o(this.modules.i18nFormat), d.i18nFormat.init && d.i18nFormat.init(this)), this.translator = new Mr(this.services, this.options), this.translator.on("*", (h, ...p) => { this.emit(h, ...p) }), this.modules.external.forEach(h => { h.init && h.init(this) }) } if (this.format = this.options.interpolation.format, n || (n = Fr), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) { let c = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng); c.length > 0 && c[0] !== "dev" && (this.options.lng = c[0]) } !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach(c => { this[c] = (...f) => this.store[c](...f) }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach(c => { this[c] = (...f) => (this.store[c](...f), this) }); let l = Dn(), u = i(() => { let c = i((f, d) => { this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), l.resolve(d), n(f, d) }, "finish"); if ((this.languages || this.isLanguageChangingTo) && !this.isInitialized) return c(null, this.t.bind(this)); this.changeLanguage(this.options.lng, c) }, "load"); return this.options.resources || !this.options.initAsync ? u() : setTimeout(u, 0), l } loadResources(e, n = Fr) { let r = n, o = R(e) ? e : this.language; if (typeof e == "function" && (r = e), !this.options.resources || this.options.partialBundledLanguages) { if (o?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return r(); let s = [], a = i(l => { if (!l || l === "cimode") return; this.services.languageUtils.toResolveHierarchy(l).forEach(c => { c !== "cimode" && (s.includes(c) || s.push(c)) }) }, "append"); o ? a(o) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(u => a(u)), this.options.preload?.forEach?.(l => a(l)), this.services.backendConnector.load(s, this.options.ns, l => { !l && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), r(l) }) } else r(null) } reloadResources(e, n, r) { let o = Dn(); return typeof e == "function" && (r = e, e = void 0), typeof n == "function" && (r = n, n = void 0), e || (e = this.languages), n || (n = this.options.ns), r || (r = Fr), this.services.backendConnector.reload(e, n, s => { o.resolve(), r(s) }), o } use(e) { if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()"); if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()"); return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && rl.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this } setResolvedLanguage(e) { if (!(!e || !this.languages) && !["cimode", "dev"].includes(e)) { for (let n = 0; n < this.languages.length; n++) { let r = this.languages[n]; if (!["cimode", "dev"].includes(r) && this.store.hasLanguageSomeTranslations(r)) { this.resolvedLanguage = r; break } } !this.resolvedLanguage && !this.languages.includes(e) && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e)) } } changeLanguage(e, n) { this.isLanguageChangingTo = e; let r = Dn(); this.emit("languageChanging", e); let o = i(l => { this.language = l, this.languages = this.services.languageUtils.toResolveHierarchy(l), this.resolvedLanguage = void 0, this.setResolvedLanguage(l) }, "setLngProps"), s = i((l, u) => { u ? this.isLanguageChangingTo === e && (o(u), this.translator.changeLanguage(u), this.isLanguageChangingTo = void 0, this.emit("languageChanged", u), this.logger.log("languageChanged", u)) : this.isLanguageChangingTo = void 0, r.resolve((...c) => this.t(...c)), n && n(l, (...c) => this.t(...c)) }, "done"), a = i(l => { !e && !l && this.services.languageDetector && (l = []); let u = R(l) ? l : l && l[0], c = this.store.hasLanguageSomeTranslations(u) ? u : this.services.languageUtils.getBestMatchFromCodes(R(l) ? [l] : l); c && (this.language || o(c), this.translator.language || this.translator.changeLanguage(c), this.services.languageDetector?.cacheUserLanguage?.(c)), this.loadResources(c, f => { s(f, c) }) }, "setLng"); return !e && this.services.languageDetector && !this.services.languageDetector.async ? a(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a) : this.services.languageDetector.detect(a) : a(e), r } getFixedT(e, n, r, o) { let s = o?.scopeNs, a = i((l, u, ...c) => { let f; typeof u != "object" ? f = this.options.overloadTranslationOptionHandler([l, u].concat(c)) : f = {...u}, f.lng = f.lng || a.lng, f.lngs = f.lngs || a.lngs; let d = f.ns !== void 0 && f.ns !== null; f.ns = f.ns || a.ns, f.keyPrefix !== "" && (f.keyPrefix = f.keyPrefix || r || a.keyPrefix); let h = {...this.options, ...f}; Array.isArray(s) && !d && (h.ns = s), typeof f.keyPrefix == "function" && (f.keyPrefix = an(f.keyPrefix, h)); let p = this.options.keySeparator || ".", w; return f.keyPrefix && Array.isArray(l) ? w = l.map(y => (typeof y == "function" && (y = an(y, h)), `${f.keyPrefix}${p}${y}`)) : (typeof l == "function" && (l = an(l, h)), w = f.keyPrefix ? `${f.keyPrefix}${p}${l}` : l), this.t(w, f) }, "fixedT"); return R(e) ? a.lng = e : a.lngs = e, a.ns = n, a.keyPrefix = r, a } t(...e) { return this.translator?.translate(...e) } exists(...e) { return this.translator?.exists(...e) } setDefaultNamespace(e) { this.options.defaultNS = e } hasLoadedNamespace(e, n = {}) { if (!this.isInitialized) return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1; if (!this.languages || !this.languages.length) return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1; let r = n.lng || this.resolvedLanguage || this.languages[0], o = this.options ? this.options.fallbackLng : !1, s = this.languages[this.languages.length - 1]; if (r.toLowerCase() === "cimode") return !0; let a = i((l, u) => { let c = this.services.backendConnector.state[`${l}|${u}`]; return c === -1 || c === 0 || c === 2 }, "loadNotPending"); if (n.precheck) { let l = n.precheck(this, a); if (l !== void 0) return l } return !!(this.hasResourceBundle(r, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(r, e) && (!o || a(s, e))) } loadNamespaces(e, n) { let r = Dn(); return this.options.ns ? (R(e) && (e = [e]), e.forEach(o => { this.options.ns.includes(o) || this.options.ns.push(o) }), this.loadResources(o => { r.resolve(), n && n(o) }), r) : (n && n(), Promise.resolve()) } loadLanguages(e, n) { let r = Dn(); R(e) && (e = [e]); let o = this.options.preload || [], s = e.filter(a => !o.includes(a) && this.services.languageUtils.isSupportedCode(a)); return s.length ? (this.options.preload = o.concat(s), this.loadResources(a => { r.resolve(), n && n(a) }), r) : (n && n(), Promise.resolve()) } dir(e) { if (e || (e = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language)), !e) return "rtl"; try { let o = new Intl.Locale(e); if (o && o.getTextInfo) { let s = o.getTextInfo(); if (s && s.direction) return s.direction } } catch { } let n = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], r = this.services?.languageUtils || new Rr(mo()); return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : n.includes(r.getLanguagePartFromCode(e)) || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr" } cloneInstance(e = {}, n = Fr) { let r = e.forkResourceStore; r && delete e.forkResourceStore; let o = {...this.options, ...e, isClone: !0}, s = new t(o); if ((e.debug !== void 0 || e.prefix !== void 0) && (s.logger = s.logger.clone(e)), ["store", "services", "language"].forEach(l => { s[l] = this[l] }), s.services = {...this.services}, s.services.utils = {hasLoadedNamespace: s.hasLoadedNamespace.bind(s)}, r) { let l = Object.keys(this.store.data).reduce((u, c) => (u[c] = {...this.store.data[c]}, u[c] = Object.keys(u[c]).reduce((f, d) => (f[d] = {...u[c][d]}, f), u[c]), u), {}); s.store = new Ir(l, o), s.services.resourceStore = s.store } if (e.interpolation) { let u = {...mo().interpolation, ...this.options.interpolation, ...e.interpolation}, c = {...o, interpolation: u}; s.services.interpolator = new Or(c) } return s.translator = new Mr(s.services, o), s.translator.on("*", (l, ...u) => { s.emit(l, ...u) }), s.init(o, n), s.translator.options = o, s.translator.backendConnector.services.utils = {hasLoadedNamespace: s.hasLoadedNamespace.bind(s)}, s } toJSON() { return { options: this.options, store: this.store, language: this.language, languages: this.languages, resolvedLanguage: this.resolvedLanguage } } }, fe = xo.createInstance(), Db = fe.createInstance, Bb = fe.dir, ol = fe.init, _b = fe.loadResources, Vb = fe.reloadResources, zb = fe.use, $b = fe.changeLanguage, Wb = fe.getFixedT, mt = fe.t, Ub = fe.exists, Hb = fe.setDefaultNamespace, jb = fe.hasLoadedNamespace, Kb = fe.loadNamespaces, Gb = fe.loadLanguages; var yi = require("obsidian"); var Ao = qt(ll(), 1); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var hh = /[a-zA-Z]:\/[^:]*$/, Qe = Ao.default.posix, ek = Qe.delimiter, tk = Ao.default.posix.sep, xe = Qe.basename, Z = Qe.dirname, Ue = Qe.extname, nk = Qe.format; var Ae = Qe.join, rk = Qe.normalize, ik = Qe.parse, cn = Qe.relative; function ul(t, e) { return e ? `${t}.${e}` : t } i(ul, "makeFileName"); function cl(...t) { let e = Qe.resolve(...t); return e = mh(e), hh.exec(e)?.[0] ?? e } i(cl, "resolve"); function mh(t) { return ce(t, "\\", "/") } i(mh, "toPosixPath"); var ut = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var gh = "base", Nr = "canvas", Vn = "md"; function vo(t, e, n) { if (Le(e)) return e.extension === n; if (typeof e == "string") { let r = ve(t, e); return r ? r.extension === n : Ue(e).slice(1) === n } return !1 } i(vo, "checkExtension"); function dl(t, e, n) { return z(gt(t, e, n), `Abstract file not found: ${e}`) } i(dl, "getAbstractFile"); function gt(t, e, n) { if (e === null) return null; if (pl(e)) return Le(e) ? t.vault.getFileByPath(e.path) ?? e : Dr(e) ? t.vault.getFolderByPath(e.path) ?? e : t.vault.getAbstractFileByPath(e.path) ?? e; let r = fl(t, e, n); if (r) return r; let o = hl(e); return o === e ? null : fl(t, o, n) } i(gt, "getAbstractFileOrNull"); function ee(t, e, n, r) { let o = ve(t, e, r); if (!o) if (n) o = la(t, e); else throw new Error(`File not found: ${e}`); return o } i(ee, "getFile"); function ve(t, e, n) { let r = gt(t, e, n); return Le(r) ? r : null } i(ve, "getFileOrNull"); function fn(t, e, n, r) { let o = Xe(t, e, r); if (!o) if (n) o = lr(t, e); else throw new Error(`Folder not found: ${e}`); return o } i(fn, "getFolder"); function Xe(t, e, n) { let r = gt(t, e, n); return Dr(r) ? r : null } i(Xe, "getFolderOrNull"); function J(t, e) { if (pl(e)) return e.path; let n = gt(t, e); return n ? n.path : hl(e) } i(J, "getPath"); function pl(t) { return t instanceof ut.TAbstractFile } i(pl, "isAbstractFile"); function wh(t, e) { return vo(t, e, gh) } i(wh, "isBaseFile"); function Mt(t, e) { return vo(t, e, Nr) } i(Mt, "isCanvasFile"); function Le(t) { return t instanceof ut.TFile } i(Le, "isFile"); function Dr(t) { return t instanceof ut.TFolder } i(Dr, "isFolder"); function Ze(t, e) { return vo(t, e, Vn) } i(Ze, "isMarkdownFile"); function dn(t, e) { return Ze(t, e) || Mt(t, e) || wh(t, e) } i(dn, "isNote"); function fl(t, e, n) { return n ??= Jt(t).insensitive, n ? t.vault.getAbstractFileByPathInsensitive(e) : t.vault.getAbstractFileByPath(e) } i(fl, "getFileInternal"); function hl(t) { return (0, ut.normalizePath)(cl("/", t)) } i(hl, "getResolvedPath"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var wt = (t => (t.DeleteNote = "DeleteNote", t.RenameNote = "RenameNote", t.Unknown = "Unknown", t))(wt || {}), gl = "__DUMMY__"; async function So(t) { let {app: e, notePathOrFile: n, oldAttachmentPathOrFile: r, shouldSkipDuplicateCheck: o} = t, s = J(e, r), a = Ue(s), l = xe(s, a), u = ve(e, s), c = e.vault.getAvailablePathForAttachments.extended; return c ? c({ attachmentFileBaseName: l, attachmentFileContent: u ? await e.vault.readBinary(u) : void 0, attachmentFileExtension: a.slice(1), attachmentFileStat: u?.stat, context: t.context, notePathOrFile: n, oldAttachmentPathOrFile: t.oldAttachmentPathOrFile, oldNotePathOrFile: t.oldNotePathOrFile, shouldSkipDuplicateCheck: o, shouldSkipMissingAttachmentFolderCreation: !0 }) : await bh({ app: e, attachmentFileBaseName: l, attachmentFileExtension: a.slice(1), notePathOrFile: n, shouldSkipDuplicateCheck: o, shouldSkipMissingAttachmentFolderCreation: !0 }) } i(So, "getAttachmentFilePath"); async function pn(t, e, n = "Unknown") { return je(await So({ app: t, context: n, notePathOrFile: e, oldAttachmentPathOrFile: gl, shouldSkipDuplicateCheck: !0 })) } i(pn, "getAttachmentFolderPath"); async function bh(t) { let { app: e, attachmentFileExtension: n, notePathOrFile: r, shouldSkipDuplicateCheck: o, shouldSkipMissingAttachmentFolderCreation: s } = t, a = e.vault.getConfig("attachmentFolderPath"), l = a === "." || a === "./", u = a.startsWith("./") ? Da(a, "./") : null, c = ve(e, r); l ? a = c ? c.parent?.path ?? "" : "" : u && (a = (c ? c.parent?.getParentPrefix() ?? "" : "") + u), a = On(ml(a)); let f = On(ml(t.attachmentFileBaseName)), d = Xe(e, a, !0); !d && u && (d = s ? fn(e, a, !0) : await e.vault.createFolder(a)); let h = d?.getParentPrefix() ?? ""; return o ? ul(h + f, n) : e.vault.getAvailablePath(h + f, n) } i(bh, "getAvailablePathForAttachments"); async function Eo(t, e, n = "Unknown") { let r = await pn(t, e, n), o = await pn(t, Ae(Z(e), `${gl}.${Vn}`), n); return r !== o } i(Eo, "hasOwnAttachmentFolder"); function ml(t) { return t = ce(t, /(?:[\\/])+/g, "/"), t = ce(t, /^\/+|\/+$/g, ""), t || "/" } i(ml, "normalizeSlashes"); var An = require("obsidian"); var kh = {}; function Rt(t, e) { let n = e || kh, r = typeof n.includeImageAlt == "boolean" ? n.includeImageAlt : !0, o = typeof n.includeHtml == "boolean" ? n.includeHtml : !0; return bl(t, r, o) } i(Rt, "toString"); function bl(t, e, n) { if (yh(t)) { if ("value" in t) return t.type === "html" && !n ? "" : t.value; if (e && "alt" in t && t.alt) return t.alt; if ("children" in t) return wl(t.children, e, n) } return Array.isArray(t) ? wl(t, e, n) : "" } i(bl, "one"); function wl(t, e, n) { let r = [], o = -1; for (; ++o < t.length;) r[o] = bl(t[o], e, n); return r.join("") } i(wl, "all"); function yh(t) { return !!(t && typeof t == "object") } i(yh, "node"); var kl = document.createElement("i"); function hn(t) { let e = "&" + t + ";"; kl.innerHTML = e; let n = kl.textContent; return n.charCodeAt(n.length - 1) === 59 && t !== "semi" || n === e ? !1 : n } i(hn, "decodeNamedCharacterReference"); function le(t, e, n, r) { let o = t.length, s = 0, a; if (e < 0 ? e = -e > o ? 0 : o + e : e = e > o ? o : e, n = n > 0 ? n : 0, r.length < 1e4) a = Array.from(r), a.unshift(e, n), t.splice(...a); else for (n && t.splice(e, n); s < r.length;) a = r.slice(s, s + 1e4), a.unshift(e, 0), t.splice(...a), s += 1e4, e += 1e4 } i(le, "splice"); function we(t, e) { return t.length > 0 ? (le(t, t.length, 0, e), t) : e } i(we, "push"); var yl = {}.hasOwnProperty; function Cl(t) { let e = {}, n = -1; for (; ++n < t.length;) Ch(e, t[n]); return e } i(Cl, "combineExtensions"); function Ch(t, e) { let n; for (n in e) { let o = (yl.call(t, n) ? t[n] : void 0) || (t[n] = {}), s = e[n], a; if (s) for (a in s) { yl.call(o, a) || (o[a] = []); let l = s[a]; xh(o[a], Array.isArray(l) ? l : l ? [l] : []) } } } i(Ch, "syntaxExtension"); function xh(t, e) { let n = -1, r = []; for (; ++n < e.length;) (e[n].add === "after" ? t : r).push(e[n]); le(t, 0, 0, r) } i(xh, "constructs"); function Br(t, e) { let n = Number.parseInt(t, e); return n < 9 || n === 11 || n > 13 && n < 32 || n > 126 && n < 160 || n > 55295 && n < 57344 || n > 64975 && n < 65008 || (n & 65535) === 65535 || (n & 65535) === 65534 || n > 1114111 ? "\uFFFD" : String.fromCodePoint(n) } i(Br, "decodeNumericCharacterReference"); function ct(t) { return t.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase() } i(ct, "normalizeIdentifier"); var Ie = bt(/[A-Za-z]/), be = bt(/[\dA-Za-z]/), xl = bt(/[#-'*+\--9=?A-Z^-~]/); function zn(t) { return t !== null && (t < 32 || t === 127) } i(zn, "asciiControl"); var $n = bt(/\d/), Al = bt(/[\dA-Fa-f]/), vl = bt(/[!-/:-@[-`{-~]/); function T(t) { return t !== null && t < -2 } i(T, "markdownLineEnding"); function Y(t) { return t !== null && (t < 0 || t === 32) } i(Y, "markdownLineEndingOrSpace"); function N(t) { return t === -2 || t === -1 || t === 32 } i(N, "markdownSpace"); var Sl = bt(/\p{P}|\p{S}/u), El = bt(/\s/); function bt(t) { return e; function e(n) { return n !== null && n > -1 && t.test(String.fromCharCode(n)) } } i(bt, "regexCheck"); function _(t, e, n, r) { let o = r ? r - 1 : Number.POSITIVE_INFINITY, s = 0; return a; function a(u) { return N(u) ? (t.enter(n), l(u)) : e(u) } function l(u) { return N(u) && s++ < o ? (t.consume(u), l) : (t.exit(n), e(u)) } } i(_, "factorySpace"); var Pl = {tokenize: Ah}; function Ah(t) { let e = t.attempt(this.parser.constructs.contentInitial, r, o), n; return e; function r(l) { if (l === null) { t.consume(l); return } return t.enter("lineEnding"), t.consume(l), t.exit("lineEnding"), _(t, e, "linePrefix") } function o(l) { return t.enter("paragraph"), s(l) } function s(l) { let u = t.enter("chunkText", {contentType: "text", previous: n}); return n && (n.next = u), n = u, a(l) } function a(l) { if (l === null) { t.exit("chunkText"), t.exit("paragraph"), t.consume(l); return } return T(l) ? (t.consume(l), t.exit("chunkText"), s) : (t.consume(l), a) } } i(Ah, "initializeContent"); var Fl = {tokenize: vh}, Tl = {tokenize: Sh}; function vh(t) { let e = this, n = [], r = 0, o, s, a; return l; function l(v) { if (r < n.length) { let P = n[r]; return e.containerState = P[1], t.attempt(P[0].continuation, u, c)(v) } return c(v) } function u(v) { if (r++, e.containerState._closeFlow) { e.containerState._closeFlow = void 0, o && x(); let P = e.events.length, L = P, C; for (; L--;) if (e.events[L][0] === "exit" && e.events[L][1].type === "chunkFlow") { C = e.events[L][1].end; break } k(r); let O = P; for (; O < e.events.length;) e.events[O][1].end = {...C}, O++; return le(e.events, L + 1, 0, e.events.slice(P)), e.events.length = O, c(v) } return l(v) } function c(v) { if (r === n.length) { if (!o) return h(v); if (o.currentConstruct && o.currentConstruct.concrete) return w(v); e.interrupt = !!(o.currentConstruct && !o._gfmTableDynamicInterruptHack) } return e.containerState = {}, t.check(Tl, f, d)(v) } function f(v) { return o && x(), k(r), h(v) } function d(v) { return e.parser.lazy[e.now().line] = r !== n.length, a = e.now().offset, w(v) } function h(v) { return e.containerState = {}, t.attempt(Tl, p, w)(v) } function p(v) { return r++, n.push([e.currentConstruct, e.containerState]), h(v) } function w(v) { if (v === null) { o && x(), k(0), t.consume(v); return } return o = o || e.parser.flow(e.now()), t.enter("chunkFlow", { _tokenizer: o, contentType: "flow", previous: s }), y(v) } function y(v) { if (v === null) { b(t.exit("chunkFlow"), !0), k(0), t.consume(v); return } return T(v) ? (t.consume(v), b(t.exit("chunkFlow")), r = 0, e.interrupt = void 0, l) : (t.consume(v), y) } function b(v, P) { let L = e.sliceStream(v); if (P && L.push(null), v.previous = s, s && (s.next = v), s = v, o.defineSkip(v.start), o.write(L), e.parser.lazy[v.start.line]) { let C = o.events.length; for (; C--;) if (o.events[C][1].start.offset < a && (!o.events[C][1].end || o.events[C][1].end.offset > a)) return; let O = e.events.length, W = O, I, D; for (; W--;) if (e.events[W][0] === "exit" && e.events[W][1].type === "chunkFlow") { if (I) { D = e.events[W][1].end; break } I = !0 } for (k(r), C = O; C < e.events.length;) e.events[C][1].end = {...D}, C++; le(e.events, W + 1, 0, e.events.slice(O)), e.events.length = C } } function k(v) { let P = n.length; for (; P-- > v;) { let L = n[P]; e.containerState = L[1], L[0].exit.call(e, t) } n.length = v } function x() { o.write([null]), s = void 0, o = void 0, e.containerState._closeFlow = void 0 } } i(vh, "initializeDocument"); function Sh(t, e, n) { return _(t, t.attempt(this.parser.constructs.document, e, n), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4) } i(Sh, "tokenizeContainer"); function mn(t) { if (t === null || Y(t) || El(t)) return 1; if (Sl(t)) return 2 } i(mn, "classifyCharacter"); function gn(t, e, n) { let r = [], o = -1; for (; ++o < t.length;) { let s = t[o].resolveAll; s && !r.includes(s) && (e = s(e, n), r.push(s)) } return e } i(gn, "resolveAll"); var Wn = {name: "attention", resolveAll: Eh, tokenize: Ph}; function Eh(t, e) { let n = -1, r, o, s, a, l, u, c, f; for (; ++n < t.length;) if (t[n][0] === "enter" && t[n][1].type === "attentionSequence" && t[n][1]._close) { for (r = n; r--;) if (t[r][0] === "exit" && t[r][1].type === "attentionSequence" && t[r][1]._open && e.sliceSerialize(t[r][1]).charCodeAt(0) === e.sliceSerialize(t[n][1]).charCodeAt(0)) { if ((t[r][1]._close || t[n][1]._open) && (t[n][1].end.offset - t[n][1].start.offset) % 3 && !((t[r][1].end.offset - t[r][1].start.offset + t[n][1].end.offset - t[n][1].start.offset) % 3)) continue; u = t[r][1].end.offset - t[r][1].start.offset > 1 && t[n][1].end.offset - t[n][1].start.offset > 1 ? 2 : 1; let d = {...t[r][1].end}, h = {...t[n][1].start}; Ll(d, -u), Ll(h, u), a = { type: u > 1 ? "strongSequence" : "emphasisSequence", start: d, end: {...t[r][1].end} }, l = { type: u > 1 ? "strongSequence" : "emphasisSequence", start: {...t[n][1].start}, end: h }, s = { type: u > 1 ? "strongText" : "emphasisText", start: {...t[r][1].end}, end: {...t[n][1].start} }, o = { type: u > 1 ? "strong" : "emphasis", start: {...a.start}, end: {...l.end} }, t[r][1].end = {...a.start}, t[n][1].start = {...l.end}, c = [], t[r][1].end.offset - t[r][1].start.offset && (c = we(c, [["enter", t[r][1], e], ["exit", t[r][1], e]])), c = we(c, [["enter", o, e], ["enter", a, e], ["exit", a, e], ["enter", s, e]]), c = we(c, gn(e.parser.constructs.insideSpan.null, t.slice(r + 1, n), e)), c = we(c, [["exit", s, e], ["enter", l, e], ["exit", l, e], ["exit", o, e]]), t[n][1].end.offset - t[n][1].start.offset ? (f = 2, c = we(c, [["enter", t[n][1], e], ["exit", t[n][1], e]])) : f = 0, le(t, r - 1, n - r + 3, c), n = r + c.length - f - 2; break } } for (n = -1; ++n < t.length;) t[n][1].type === "attentionSequence" && (t[n][1].type = "data"); return t } i(Eh, "resolveAllAttention"); function Ph(t, e) { let n = this.parser.constructs.attentionMarkers.null, r = this.previous, o = mn(r), s; return a; function a(u) { return s = u, t.enter("attentionSequence"), l(u) } function l(u) { if (u === s) return t.consume(u), l; let c = t.exit("attentionSequence"), f = mn(u), d = !f || f === 2 && o || n.includes(u), h = !o || o === 2 && f || n.includes(r); return c._open = !!(s === 42 ? d : d && (o || !h)), c._close = !!(s === 42 ? h : h && (f || !d)), e(u) } } i(Ph, "tokenizeAttention"); function Ll(t, e) { t.column += e, t.offset += e, t._bufferIndex += e } i(Ll, "movePoint"); var Po = {name: "autolink", tokenize: Th}; function Th(t, e, n) { let r = 0; return o; function o(p) { return t.enter("autolink"), t.enter("autolinkMarker"), t.consume(p), t.exit("autolinkMarker"), t.enter("autolinkProtocol"), s } function s(p) { return Ie(p) ? (t.consume(p), a) : p === 64 ? n(p) : c(p) } function a(p) { return p === 43 || p === 45 || p === 46 || be(p) ? (r = 1, l(p)) : c(p) } function l(p) { return p === 58 ? (t.consume(p), r = 0, u) : (p === 43 || p === 45 || p === 46 || be(p)) && r++ < 32 ? (t.consume(p), l) : (r = 0, c(p)) } function u(p) { return p === 62 ? (t.exit("autolinkProtocol"), t.enter("autolinkMarker"), t.consume(p), t.exit("autolinkMarker"), t.exit("autolink"), e) : p === null || p === 32 || p === 60 || zn(p) ? n(p) : (t.consume(p), u) } function c(p) { return p === 64 ? (t.consume(p), f) : xl(p) ? (t.consume(p), c) : n(p) } function f(p) { return be(p) ? d(p) : n(p) } function d(p) { return p === 46 ? (t.consume(p), r = 0, f) : p === 62 ? (t.exit("autolinkProtocol").type = "autolinkEmail", t.enter("autolinkMarker"), t.consume(p), t.exit("autolinkMarker"), t.exit("autolink"), e) : h(p) } function h(p) { if ((p === 45 || be(p)) && r++ < 63) { let w = p === 45 ? h : d; return t.consume(p), w } return n(p) } } i(Th, "tokenizeAutolink"); var kt = {partial: !0, tokenize: Fh}; function Fh(t, e, n) { return r; function r(s) { return N(s) ? _(t, o, "linePrefix")(s) : o(s) } function o(s) { return s === null || T(s) ? e(s) : n(s) } } i(Fh, "tokenizeBlankLine"); var _r = {continuation: {tokenize: Ih}, exit: Mh, name: "blockQuote", tokenize: Lh}; function Lh(t, e, n) { let r = this; return o; function o(a) { if (a === 62) { let l = r.containerState; return l.open || (t.enter("blockQuote", {_container: !0}), l.open = !0), t.enter("blockQuotePrefix"), t.enter("blockQuoteMarker"), t.consume(a), t.exit("blockQuoteMarker"), s } return n(a) } function s(a) { return N(a) ? (t.enter("blockQuotePrefixWhitespace"), t.consume(a), t.exit("blockQuotePrefixWhitespace"), t.exit("blockQuotePrefix"), e) : (t.exit("blockQuotePrefix"), e(a)) } } i(Lh, "tokenizeBlockQuoteStart"); function Ih(t, e, n) { let r = this; return o; function o(a) { return N(a) ? _(t, s, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(a) : s(a) } function s(a) { return t.attempt(_r, e, n)(a) } } i(Ih, "tokenizeBlockQuoteContinuation"); function Mh(t) { t.exit("blockQuote") } i(Mh, "exit"); var Vr = {name: "characterEscape", tokenize: Rh}; function Rh(t, e, n) { return r; function r(s) { return t.enter("characterEscape"), t.enter("escapeMarker"), t.consume(s), t.exit("escapeMarker"), o } function o(s) { return vl(s) ? (t.enter("characterEscapeValue"), t.consume(s), t.exit("characterEscapeValue"), t.exit("characterEscape"), e) : n(s) } } i(Rh, "tokenizeCharacterEscape"); var zr = {name: "characterReference", tokenize: Oh}; function Oh(t, e, n) { let r = this, o = 0, s, a; return l; function l(d) { return t.enter("characterReference"), t.enter("characterReferenceMarker"), t.consume(d), t.exit("characterReferenceMarker"), u } function u(d) { return d === 35 ? (t.enter("characterReferenceMarkerNumeric"), t.consume(d), t.exit("characterReferenceMarkerNumeric"), c) : (t.enter("characterReferenceValue"), s = 31, a = be, f(d)) } function c(d) { return d === 88 || d === 120 ? (t.enter("characterReferenceMarkerHexadecimal"), t.consume(d), t.exit("characterReferenceMarkerHexadecimal"), t.enter("characterReferenceValue"), s = 6, a = Al, f) : (t.enter("characterReferenceValue"), s = 7, a = $n, f(d)) } function f(d) { if (d === 59 && o) { let h = t.exit("characterReferenceValue"); return a === be && !hn(r.sliceSerialize(h)) ? n(d) : (t.enter("characterReferenceMarker"), t.consume(d), t.exit("characterReferenceMarker"), t.exit("characterReference"), e) } return a(d) && o++ < s ? (t.consume(d), f) : n(d) } } i(Oh, "tokenizeCharacterReference"); var Il = {partial: !0, tokenize: Dh}, $r = {concrete: !0, name: "codeFenced", tokenize: Nh}; function Nh(t, e, n) { let r = this, o = {partial: !0, tokenize: L}, s = 0, a = 0, l; return u; function u(C) { return c(C) } function c(C) { let O = r.events[r.events.length - 1]; return s = O && O[1].type === "linePrefix" ? O[2].sliceSerialize(O[1], !0).length : 0, l = C, t.enter("codeFenced"), t.enter("codeFencedFence"), t.enter("codeFencedFenceSequence"), f(C) } function f(C) { return C === l ? (a++, t.consume(C), f) : a < 3 ? n(C) : (t.exit("codeFencedFenceSequence"), N(C) ? _(t, d, "whitespace")(C) : d(C)) } function d(C) { return C === null || T(C) ? (t.exit("codeFencedFence"), r.interrupt ? e(C) : t.check(Il, y, P)(C)) : (t.enter("codeFencedFenceInfo"), t.enter("chunkString", {contentType: "string"}), h(C)) } function h(C) { return C === null || T(C) ? (t.exit("chunkString"), t.exit("codeFencedFenceInfo"), d(C)) : N(C) ? (t.exit("chunkString"), t.exit("codeFencedFenceInfo"), _(t, p, "whitespace")(C)) : C === 96 && C === l ? n(C) : (t.consume(C), h) } function p(C) { return C === null || T(C) ? d(C) : (t.enter("codeFencedFenceMeta"), t.enter("chunkString", {contentType: "string"}), w(C)) } function w(C) { return C === null || T(C) ? (t.exit("chunkString"), t.exit("codeFencedFenceMeta"), d(C)) : C === 96 && C === l ? n(C) : (t.consume(C), w) } function y(C) { return t.attempt(o, P, b)(C) } function b(C) { return t.enter("lineEnding"), t.consume(C), t.exit("lineEnding"), k } function k(C) { return s > 0 && N(C) ? _(t, x, "linePrefix", s + 1)(C) : x(C) } function x(C) { return C === null || T(C) ? t.check(Il, y, P)(C) : (t.enter("codeFlowValue"), v(C)) } function v(C) { return C === null || T(C) ? (t.exit("codeFlowValue"), x(C)) : (t.consume(C), v) } function P(C) { return t.exit("codeFenced"), e(C) } function L(C, O, W) { let I = 0; return D; function D(M) { return C.enter("lineEnding"), C.consume(M), C.exit("lineEnding"), ne } function ne(M) { return C.enter("codeFencedFence"), N(M) ? _(C, U, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(M) : U(M) } function U(M) { return M === l ? (C.enter("codeFencedFenceSequence"), E(M)) : W(M) } function E(M) { return M === l ? (I++, C.consume(M), E) : I >= a ? (C.exit("codeFencedFenceSequence"), N(M) ? _(C, F, "whitespace")(M) : F(M)) : W(M) } function F(M) { return M === null || T(M) ? (C.exit("codeFencedFence"), O(M)) : W(M) } } } i(Nh, "tokenizeCodeFenced"); function Dh(t, e, n) { let r = this; return o; function o(a) { return a === null ? n(a) : (t.enter("lineEnding"), t.consume(a), t.exit("lineEnding"), s) } function s(a) { return r.parser.lazy[r.now().line] ? n(a) : e(a) } } i(Dh, "tokenizeNonLazyContinuation"); var Un = {name: "codeIndented", tokenize: _h}, Bh = {partial: !0, tokenize: Vh}; function _h(t, e, n) { let r = this; return o; function o(c) { return t.enter("codeIndented"), _(t, s, "linePrefix", 5)(c) } function s(c) { let f = r.events[r.events.length - 1]; return f && f[1].type === "linePrefix" && f[2].sliceSerialize(f[1], !0).length >= 4 ? a(c) : n(c) } function a(c) { return c === null ? u(c) : T(c) ? t.attempt(Bh, a, u)(c) : (t.enter("codeFlowValue"), l(c)) } function l(c) { return c === null || T(c) ? (t.exit("codeFlowValue"), a(c)) : (t.consume(c), l) } function u(c) { return t.exit("codeIndented"), e(c) } } i(_h, "tokenizeCodeIndented"); function Vh(t, e, n) { let r = this; return o; function o(a) { return r.parser.lazy[r.now().line] ? n(a) : T(a) ? (t.enter("lineEnding"), t.consume(a), t.exit("lineEnding"), o) : _(t, s, "linePrefix", 5)(a) } function s(a) { let l = r.events[r.events.length - 1]; return l && l[1].type === "linePrefix" && l[2].sliceSerialize(l[1], !0).length >= 4 ? e(a) : T(a) ? o(a) : n(a) } } i(Vh, "tokenizeFurtherStart"); var To = {name: "codeText", previous: $h, resolve: zh, tokenize: Wh}; function zh(t) { let e = t.length - 4, n = 3, r, o; if ((t[n][1].type === "lineEnding" || t[n][1].type === "space") && (t[e][1].type === "lineEnding" || t[e][1].type === "space")) { for (r = n; ++r < e;) if (t[r][1].type === "codeTextData") { t[n][1].type = "codeTextPadding", t[e][1].type = "codeTextPadding", n += 2, e -= 2; break } } for (r = n - 1, e++; ++r <= e;) o === void 0 ? r !== e && t[r][1].type !== "lineEnding" && (o = r) : (r === e || t[r][1].type === "lineEnding") && (t[o][1].type = "codeTextData", r !== o + 2 && (t[o][1].end = t[r - 1][1].end, t.splice(o + 2, r - o - 2), e -= r - o - 2, r = o + 2), o = void 0); return t } i(zh, "resolveCodeText"); function $h(t) { return t !== 96 || this.events[this.events.length - 1][1].type === "characterEscape" } i($h, "previous"); function Wh(t, e, n) { let r = this, o = 0, s, a; return l; function l(h) { return t.enter("codeText"), t.enter("codeTextSequence"), u(h) } function u(h) { return h === 96 ? (t.consume(h), o++, u) : (t.exit("codeTextSequence"), c(h)) } function c(h) { return h === null ? n(h) : h === 32 ? (t.enter("space"), t.consume(h), t.exit("space"), c) : h === 96 ? (a = t.enter("codeTextSequence"), s = 0, d(h)) : T(h) ? (t.enter("lineEnding"), t.consume(h), t.exit("lineEnding"), c) : (t.enter("codeTextData"), f(h)) } function f(h) { return h === null || h === 32 || h === 96 || T(h) ? (t.exit("codeTextData"), c(h)) : (t.consume(h), f) } function d(h) { return h === 96 ? (t.consume(h), s++, d) : s === o ? (t.exit("codeTextSequence"), t.exit("codeText"), e(h)) : (a.type = "codeTextData", f(h)) } } i(Wh, "tokenizeCodeText"); var Wr = class { static { i(this, "SpliceBuffer") } constructor(e) { this.left = e ? [...e] : [], this.right = [] } get length() { return this.left.length + this.right.length } get(e) { if (e < 0 || e >= this.left.length + this.right.length) throw new RangeError("Cannot access index `" + e + "` in a splice buffer of size `" + (this.left.length + this.right.length) + "`"); return e < this.left.length ? this.left[e] : this.right[this.right.length - e + this.left.length - 1] } shift() { return this.setCursor(0), this.right.pop() } slice(e, n) { let r = n ?? Number.POSITIVE_INFINITY; return r < this.left.length ? this.left.slice(e, r) : e > this.left.length ? this.right.slice(this.right.length - r + this.left.length, this.right.length - e + this.left.length).reverse() : this.left.slice(e).concat(this.right.slice(this.right.length - r + this.left.length).reverse()) } splice(e, n, r) { let o = n || 0; this.setCursor(Math.trunc(e)); let s = this.right.splice(this.right.length - o, Number.POSITIVE_INFINITY); return r && Hn(this.left, r), s.reverse() } pop() { return this.setCursor(Number.POSITIVE_INFINITY), this.left.pop() } push(e) { this.setCursor(Number.POSITIVE_INFINITY), this.left.push(e) } pushMany(e) { this.setCursor(Number.POSITIVE_INFINITY), Hn(this.left, e) } unshift(e) { this.setCursor(0), this.right.push(e) } unshiftMany(e) { this.setCursor(0), Hn(this.right, e.reverse()) } setCursor(e) { if (!(e === this.left.length || e > this.left.length && this.right.length === 0 || e < 0 && this.left.length === 0)) if (e < this.left.length) { let n = this.left.splice(e, Number.POSITIVE_INFINITY); Hn(this.right, n.reverse()) } else { let n = this.right.splice(this.left.length + this.right.length - e, Number.POSITIVE_INFINITY); Hn(this.left, n.reverse()) } } }; function Hn(t, e) { let n = 0; if (e.length < 1e4) t.push(...e); else for (; n < e.length;) t.push(...e.slice(n, n + 1e4)), n += 1e4 } i(Hn, "chunkedPush"); function Ur(t) { let e = {}, n = -1, r, o, s, a, l, u, c, f = new Wr(t); for (; ++n < f.length;) { for (; n in e;) n = e[n]; if (r = f.get(n), n && r[1].type === "chunkFlow" && f.get(n - 1)[1].type === "listItemPrefix" && (u = r[1]._tokenizer.events, s = 0, s < u.length && u[s][1].type === "lineEndingBlank" && (s += 2), s < u.length && u[s][1].type === "content")) for (; ++s < u.length && u[s][1].type !== "content";) u[s][1].type === "chunkText" && (u[s][1]._isInFirstContentOfListItem = !0, s++); if (r[0] === "enter") r[1].contentType && (Object.assign(e, Uh(f, n)), n = e[n], c = !0); else if (r[1]._container) { for (s = n, o = void 0; s--;) if (a = f.get(s), a[1].type === "lineEnding" || a[1].type === "lineEndingBlank") a[0] === "enter" && (o && (f.get(o)[1].type = "lineEndingBlank"), a[1].type = "lineEnding", o = s); else if (!(a[1].type === "linePrefix" || a[1].type === "listItemIndent")) break; o && (r[1].end = {...f.get(o)[1].start}, l = f.slice(o, n), l.unshift(r), f.splice(o, n - o + 1, l)) } } return le(t, 0, Number.POSITIVE_INFINITY, f.slice(0)), !c } i(Ur, "subtokenize"); function Uh(t, e) { let n = t.get(e)[1], r = t.get(e)[2], o = e - 1, s = [], a = n._tokenizer; a || (a = r.parser[n.contentType](n.start), n._contentTypeTextTrailing && (a._contentTypeTextTrailing = !0)); let l = a.events, u = [], c = {}, f, d, h = -1, p = n, w = 0, y = 0, b = [y]; for (; p;) { for (; t.get(++o)[1] !== p;) ; s.push(o), p._tokenizer || (f = r.sliceStream(p), p.next || f.push(null), d && a.defineSkip(p.start), p._isInFirstContentOfListItem && (a._gfmTasklistFirstContentOfListItem = !0), a.write(f), p._isInFirstContentOfListItem && (a._gfmTasklistFirstContentOfListItem = void 0)), d = p, p = p.next } for (p = n; ++h < l.length;) l[h][0] === "exit" && l[h - 1][0] === "enter" && l[h][1].type === l[h - 1][1].type && l[h][1].start.line !== l[h][1].end.line && (y = h + 1, b.push(y), p._tokenizer = void 0, p.previous = void 0, p = p.next); for (a.events = [], p ? (p._tokenizer = void 0, p.previous = void 0) : b.pop(), h = b.length; h--;) { let k = l.slice(b[h], b[h + 1]), x = s.pop(); u.push([x, x + k.length - 1]), t.splice(x, 2, k) } for (u.reverse(), h = -1; ++h < u.length;) c[w + u[h][0]] = w + u[h][1], w += u[h][1] - u[h][0] - 1; return c } i(Uh, "subcontent"); var Fo = {resolve: jh, tokenize: Kh}, Hh = {partial: !0, tokenize: Gh}; function jh(t) { return Ur(t), t } i(jh, "resolveContent"); function Kh(t, e) { let n; return r; function r(l) { return t.enter("content"), n = t.enter("chunkContent", {contentType: "content"}), o(l) } function o(l) { return l === null ? s(l) : T(l) ? t.check(Hh, a, s)(l) : (t.consume(l), o) } function s(l) { return t.exit("chunkContent"), t.exit("content"), e(l) } function a(l) { return t.consume(l), t.exit("chunkContent"), n.next = t.enter("chunkContent", { contentType: "content", previous: n }), n = n.next, o } } i(Kh, "tokenizeContent"); function Gh(t, e, n) { let r = this; return o; function o(a) { return t.exit("chunkContent"), t.enter("lineEnding"), t.consume(a), t.exit("lineEnding"), _(t, s, "linePrefix") } function s(a) { if (a === null || T(a)) return n(a); let l = r.events[r.events.length - 1]; return !r.parser.constructs.disable.null.includes("codeIndented") && l && l[1].type === "linePrefix" && l[2].sliceSerialize(l[1], !0).length >= 4 ? e(a) : t.interrupt(r.parser.constructs.flow, n, e)(a) } } i(Gh, "tokenizeContinuation"); function Hr(t, e, n, r, o, s, a, l, u) { let c = u || Number.POSITIVE_INFINITY, f = 0; return d; function d(k) { return k === 60 ? (t.enter(r), t.enter(o), t.enter(s), t.consume(k), t.exit(s), h) : k === null || k === 32 || k === 41 || zn(k) ? n(k) : (t.enter(r), t.enter(a), t.enter(l), t.enter("chunkString", {contentType: "string"}), y(k)) } function h(k) { return k === 62 ? (t.enter(s), t.consume(k), t.exit(s), t.exit(o), t.exit(r), e) : (t.enter(l), t.enter("chunkString", {contentType: "string"}), p(k)) } function p(k) { return k === 62 ? (t.exit("chunkString"), t.exit(l), h(k)) : k === null || k === 60 || T(k) ? n(k) : (t.consume(k), k === 92 ? w : p) } function w(k) { return k === 60 || k === 62 || k === 92 ? (t.consume(k), p) : p(k) } function y(k) { return !f && (k === null || k === 41 || Y(k)) ? (t.exit("chunkString"), t.exit(l), t.exit(a), t.exit(r), e(k)) : f < c && k === 40 ? (t.consume(k), f++, y) : k === 41 ? (t.consume(k), f--, y) : k === null || k === 32 || k === 40 || zn(k) ? n(k) : (t.consume(k), k === 92 ? b : y) } function b(k) { return k === 40 || k === 41 || k === 92 ? (t.consume(k), y) : y(k) } } i(Hr, "factoryDestination"); function jr(t, e, n, r, o, s) { let a = this, l = 0, u; return c; function c(p) { return t.enter(r), t.enter(o), t.consume(p), t.exit(o), t.enter(s), f } function f(p) { return l > 999 || p === null || p === 91 || p === 93 && !u || p === 94 && !l && "_hiddenFootnoteSupport" in a.parser.constructs ? n(p) : p === 93 ? (t.exit(s), t.enter(o), t.consume(p), t.exit(o), t.exit(r), e) : T(p) ? (t.enter("lineEnding"), t.consume(p), t.exit("lineEnding"), f) : (t.enter("chunkString", {contentType: "string"}), d(p)) } function d(p) { return p === null || p === 91 || p === 93 || T(p) || l++ > 999 ? (t.exit("chunkString"), f(p)) : (t.consume(p), u || (u = !N(p)), p === 92 ? h : d) } function h(p) { return p === 91 || p === 92 || p === 93 ? (t.consume(p), l++, d) : d(p) } } i(jr, "factoryLabel"); function Kr(t, e, n, r, o, s) { let a; return l; function l(h) { return h === 34 || h === 39 || h === 40 ? (t.enter(r), t.enter(o), t.consume(h), t.exit(o), a = h === 40 ? 41 : h, u) : n(h) } function u(h) { return h === a ? (t.enter(o), t.consume(h), t.exit(o), t.exit(r), e) : (t.enter(s), c(h)) } function c(h) { return h === a ? (t.exit(s), u(a)) : h === null ? n(h) : T(h) ? (t.enter("lineEnding"), t.consume(h), t.exit("lineEnding"), _(t, c, "linePrefix")) : (t.enter("chunkString", {contentType: "string"}), f(h)) } function f(h) { return h === a || h === null || T(h) ? (t.exit("chunkString"), c(h)) : (t.consume(h), h === 92 ? d : f) } function d(h) { return h === a || h === 92 ? (t.consume(h), f) : f(h) } } i(Kr, "factoryTitle"); function Ot(t, e) { let n; return r; function r(o) { return T(o) ? (t.enter("lineEnding"), t.consume(o), t.exit("lineEnding"), n = !0, r) : N(o) ? _(t, r, n ? "linePrefix" : "lineSuffix")(o) : e(o) } } i(Ot, "factoryWhitespace"); var Lo = {name: "definition", tokenize: Jh}, qh = {partial: !0, tokenize: Yh}; function Jh(t, e, n) { let r = this, o; return s; function s(p) { return t.enter("definition"), a(p) } function a(p) { return jr.call(r, t, l, n, "definitionLabel", "definitionLabelMarker", "definitionLabelString")(p) } function l(p) { return o = ct(r.sliceSerialize(r.events[r.events.length - 1][1]).slice(1, -1)), p === 58 ? (t.enter("definitionMarker"), t.consume(p), t.exit("definitionMarker"), u) : n(p) } function u(p) { return Y(p) ? Ot(t, c)(p) : c(p) } function c(p) { return Hr(t, f, n, "definitionDestination", "definitionDestinationLiteral", "definitionDestinationLiteralMarker", "definitionDestinationRaw", "definitionDestinationString")(p) } function f(p) { return t.attempt(qh, d, d)(p) } function d(p) { return N(p) ? _(t, h, "whitespace")(p) : h(p) } function h(p) { return p === null || T(p) ? (t.exit("definition"), r.parser.defined.push(o), e(p)) : n(p) } } i(Jh, "tokenizeDefinition"); function Yh(t, e, n) { return r; function r(l) { return Y(l) ? Ot(t, o)(l) : n(l) } function o(l) { return Kr(t, s, n, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(l) } function s(l) { return N(l) ? _(t, a, "whitespace")(l) : a(l) } function a(l) { return l === null || T(l) ? e(l) : n(l) } } i(Yh, "tokenizeTitleBefore"); var Io = {name: "hardBreakEscape", tokenize: Qh}; function Qh(t, e, n) { return r; function r(s) { return t.enter("hardBreakEscape"), t.consume(s), o } function o(s) { return T(s) ? (t.exit("hardBreakEscape"), e(s)) : n(s) } } i(Qh, "tokenizeHardBreakEscape"); var Mo = {name: "headingAtx", resolve: Xh, tokenize: Zh}; function Xh(t, e) { let n = t.length - 2, r = 3, o, s; return t[r][1].type === "whitespace" && (r += 2), n - 2 > r && t[n][1].type === "whitespace" && (n -= 2), t[n][1].type === "atxHeadingSequence" && (r === n - 1 || n - 4 > r && t[n - 2][1].type === "whitespace") && (n -= r + 1 === n ? 2 : 4), n > r && (o = { type: "atxHeadingText", start: t[r][1].start, end: t[n][1].end }, s = { type: "chunkText", start: t[r][1].start, end: t[n][1].end, contentType: "text" }, le(t, r, n - r + 1, [["enter", o, e], ["enter", s, e], ["exit", s, e], ["exit", o, e]])), t } i(Xh, "resolveHeadingAtx"); function Zh(t, e, n) { let r = 0; return o; function o(f) { return t.enter("atxHeading"), s(f) } function s(f) { return t.enter("atxHeadingSequence"), a(f) } function a(f) { return f === 35 && r++ < 6 ? (t.consume(f), a) : f === null || Y(f) ? (t.exit("atxHeadingSequence"), l(f)) : n(f) } function l(f) { return f === 35 ? (t.enter("atxHeadingSequence"), u(f)) : f === null || T(f) ? (t.exit("atxHeading"), e(f)) : N(f) ? _(t, l, "whitespace")(f) : (t.enter("atxHeadingText"), c(f)) } function u(f) { return f === 35 ? (t.consume(f), u) : (t.exit("atxHeadingSequence"), l(f)) } function c(f) { return f === null || f === 35 || Y(f) ? (t.exit("atxHeadingText"), l(f)) : (t.consume(f), c) } } i(Zh, "tokenizeHeadingAtx"); var Ml = ["address", "article", "aside", "base", "basefont", "blockquote", "body", "caption", "center", "col", "colgroup", "dd", "details", "dialog", "dir", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "iframe", "legend", "li", "link", "main", "menu", "menuitem", "nav", "noframes", "ol", "optgroup", "option", "p", "param", "search", "section", "summary", "table", "tbody", "td", "tfoot", "th", "thead", "title", "tr", "track", "ul"], Ro = ["pre", "script", "style", "textarea"]; var Oo = {concrete: !0, name: "htmlFlow", resolveTo: nm, tokenize: rm}, em = {partial: !0, tokenize: om}, tm = {partial: !0, tokenize: im}; function nm(t) { let e = t.length; for (; e-- && !(t[e][0] === "enter" && t[e][1].type === "htmlFlow");) ; return e > 1 && t[e - 2][1].type === "linePrefix" && (t[e][1].start = t[e - 2][1].start, t[e + 1][1].start = t[e - 2][1].start, t.splice(e - 2, 2)), t } i(nm, "resolveToHtmlFlow"); function rm(t, e, n) { let r = this, o, s, a, l, u; return c; function c(g) { return f(g) } function f(g) { return t.enter("htmlFlow"), t.enter("htmlFlowData"), t.consume(g), d } function d(g) { return g === 33 ? (t.consume(g), h) : g === 47 ? (t.consume(g), s = !0, y) : g === 63 ? (t.consume(g), o = 3, r.interrupt ? e : m) : Ie(g) ? (t.consume(g), a = String.fromCharCode(g), b) : n(g) } function h(g) { return g === 45 ? (t.consume(g), o = 2, p) : g === 91 ? (t.consume(g), o = 5, l = 0, w) : Ie(g) ? (t.consume(g), o = 4, r.interrupt ? e : m) : n(g) } function p(g) { return g === 45 ? (t.consume(g), r.interrupt ? e : m) : n(g) } function w(g) { let ue = "CDATA["; return g === ue.charCodeAt(l++) ? (t.consume(g), l === ue.length ? r.interrupt ? e : U : w) : n(g) } function y(g) { return Ie(g) ? (t.consume(g), a = String.fromCharCode(g), b) : n(g) } function b(g) { if (g === null || g === 47 || g === 62 || Y(g)) { let ue = g === 47, St = a.toLowerCase(); return !ue && !s && Ro.includes(St) ? (o = 1, r.interrupt ? e(g) : U(g)) : Ml.includes(a.toLowerCase()) ? (o = 6, ue ? (t.consume(g), k) : r.interrupt ? e(g) : U(g)) : (o = 7, r.interrupt && !r.parser.lazy[r.now().line] ? n(g) : s ? x(g) : v(g)) } return g === 45 || be(g) ? (t.consume(g), a += String.fromCharCode(g), b) : n(g) } function k(g) { return g === 62 ? (t.consume(g), r.interrupt ? e : U) : n(g) } function x(g) { return N(g) ? (t.consume(g), x) : D(g) } function v(g) { return g === 47 ? (t.consume(g), D) : g === 58 || g === 95 || Ie(g) ? (t.consume(g), P) : N(g) ? (t.consume(g), v) : D(g) } function P(g) { return g === 45 || g === 46 || g === 58 || g === 95 || be(g) ? (t.consume(g), P) : L(g) } function L(g) { return g === 61 ? (t.consume(g), C) : N(g) ? (t.consume(g), L) : v(g) } function C(g) { return g === null || g === 60 || g === 61 || g === 62 || g === 96 ? n(g) : g === 34 || g === 39 ? (t.consume(g), u = g, O) : N(g) ? (t.consume(g), C) : W(g) } function O(g) { return g === u ? (t.consume(g), u = null, I) : g === null || T(g) ? n(g) : (t.consume(g), O) } function W(g) { return g === null || g === 34 || g === 39 || g === 47 || g === 60 || g === 61 || g === 62 || g === 96 || Y(g) ? L(g) : (t.consume(g), W) } function I(g) { return g === 47 || g === 62 || N(g) ? v(g) : n(g) } function D(g) { return g === 62 ? (t.consume(g), ne) : n(g) } function ne(g) { return g === null || T(g) ? U(g) : N(g) ? (t.consume(g), ne) : n(g) } function U(g) { return g === 45 && o === 2 ? (t.consume(g), V) : g === 60 && o === 1 ? (t.consume(g), H) : g === 62 && o === 4 ? (t.consume(g), q) : g === 63 && o === 3 ? (t.consume(g), m) : g === 93 && o === 5 ? (t.consume(g), me) : T(g) && (o === 6 || o === 7) ? (t.exit("htmlFlowData"), t.check(em, ie, E)(g)) : g === null || T(g) ? (t.exit("htmlFlowData"), E(g)) : (t.consume(g), U) } function E(g) { return t.check(tm, F, ie)(g) } function F(g) { return t.enter("lineEnding"), t.consume(g), t.exit("lineEnding"), M } function M(g) { return g === null || T(g) ? E(g) : (t.enter("htmlFlowData"), U(g)) } function V(g) { return g === 45 ? (t.consume(g), m) : U(g) } function H(g) { return g === 47 ? (t.consume(g), a = "", re) : U(g) } function re(g) { if (g === 62) { let ue = a.toLowerCase(); return Ro.includes(ue) ? (t.consume(g), q) : U(g) } return Ie(g) && a.length < 8 ? (t.consume(g), a += String.fromCharCode(g), re) : U(g) } function me(g) { return g === 93 ? (t.consume(g), m) : U(g) } function m(g) { return g === 62 ? (t.consume(g), q) : g === 45 && o === 2 ? (t.consume(g), m) : U(g) } function q(g) { return g === null || T(g) ? (t.exit("htmlFlowData"), ie(g)) : (t.consume(g), q) } function ie(g) { return t.exit("htmlFlow"), e(g) } } i(rm, "tokenizeHtmlFlow"); function im(t, e, n) { let r = this; return o; function o(a) { return T(a) ? (t.enter("lineEnding"), t.consume(a), t.exit("lineEnding"), s) : n(a) } function s(a) { return r.parser.lazy[r.now().line] ? n(a) : e(a) } } i(im, "tokenizeNonLazyContinuationStart"); function om(t, e, n) { return r; function r(o) { return t.enter("lineEnding"), t.consume(o), t.exit("lineEnding"), t.attempt(kt, e, n) } } i(om, "tokenizeBlankLineBefore"); var No = {name: "htmlText", tokenize: sm}; function sm(t, e, n) { let r = this, o, s, a; return l; function l(m) { return t.enter("htmlText"), t.enter("htmlTextData"), t.consume(m), u } function u(m) { return m === 33 ? (t.consume(m), c) : m === 47 ? (t.consume(m), L) : m === 63 ? (t.consume(m), v) : Ie(m) ? (t.consume(m), W) : n(m) } function c(m) { return m === 45 ? (t.consume(m), f) : m === 91 ? (t.consume(m), s = 0, w) : Ie(m) ? (t.consume(m), x) : n(m) } function f(m) { return m === 45 ? (t.consume(m), p) : n(m) } function d(m) { return m === null ? n(m) : m === 45 ? (t.consume(m), h) : T(m) ? (a = d, H(m)) : (t.consume(m), d) } function h(m) { return m === 45 ? (t.consume(m), p) : d(m) } function p(m) { return m === 62 ? V(m) : m === 45 ? h(m) : d(m) } function w(m) { let q = "CDATA["; return m === q.charCodeAt(s++) ? (t.consume(m), s === q.length ? y : w) : n(m) } function y(m) { return m === null ? n(m) : m === 93 ? (t.consume(m), b) : T(m) ? (a = y, H(m)) : (t.consume(m), y) } function b(m) { return m === 93 ? (t.consume(m), k) : y(m) } function k(m) { return m === 62 ? V(m) : m === 93 ? (t.consume(m), k) : y(m) } function x(m) { return m === null || m === 62 ? V(m) : T(m) ? (a = x, H(m)) : (t.consume(m), x) } function v(m) { return m === null ? n(m) : m === 63 ? (t.consume(m), P) : T(m) ? (a = v, H(m)) : (t.consume(m), v) } function P(m) { return m === 62 ? V(m) : v(m) } function L(m) { return Ie(m) ? (t.consume(m), C) : n(m) } function C(m) { return m === 45 || be(m) ? (t.consume(m), C) : O(m) } function O(m) { return T(m) ? (a = O, H(m)) : N(m) ? (t.consume(m), O) : V(m) } function W(m) { return m === 45 || be(m) ? (t.consume(m), W) : m === 47 || m === 62 || Y(m) ? I(m) : n(m) } function I(m) { return m === 47 ? (t.consume(m), V) : m === 58 || m === 95 || Ie(m) ? (t.consume(m), D) : T(m) ? (a = I, H(m)) : N(m) ? (t.consume(m), I) : V(m) } function D(m) { return m === 45 || m === 46 || m === 58 || m === 95 || be(m) ? (t.consume(m), D) : ne(m) } function ne(m) { return m === 61 ? (t.consume(m), U) : T(m) ? (a = ne, H(m)) : N(m) ? (t.consume(m), ne) : I(m) } function U(m) { return m === null || m === 60 || m === 61 || m === 62 || m === 96 ? n(m) : m === 34 || m === 39 ? (t.consume(m), o = m, E) : T(m) ? (a = U, H(m)) : N(m) ? (t.consume(m), U) : (t.consume(m), F) } function E(m) { return m === o ? (t.consume(m), o = void 0, M) : m === null ? n(m) : T(m) ? (a = E, H(m)) : (t.consume(m), E) } function F(m) { return m === null || m === 34 || m === 39 || m === 60 || m === 61 || m === 96 ? n(m) : m === 47 || m === 62 || Y(m) ? I(m) : (t.consume(m), F) } function M(m) { return m === 47 || m === 62 || Y(m) ? I(m) : n(m) } function V(m) { return m === 62 ? (t.consume(m), t.exit("htmlTextData"), t.exit("htmlText"), e) : n(m) } function H(m) { return t.exit("htmlTextData"), t.enter("lineEnding"), t.consume(m), t.exit("lineEnding"), re } function re(m) { return N(m) ? _(t, me, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(m) : me(m) } function me(m) { return t.enter("htmlTextData"), a(m) } } i(sm, "tokenizeHtmlText"); var Nt = {name: "labelEnd", resolveAll: cm, resolveTo: fm, tokenize: dm}, am = {tokenize: pm}, lm = {tokenize: hm}, um = {tokenize: mm}; function cm(t) { let e = -1, n = []; for (; ++e < t.length;) { let r = t[e][1]; if (n.push(t[e]), r.type === "labelImage" || r.type === "labelLink" || r.type === "labelEnd") { let o = r.type === "labelImage" ? 4 : 2; r.type = "data", e += o } } return t.length !== n.length && le(t, 0, t.length, n), t } i(cm, "resolveAllLabelEnd"); function fm(t, e) { let n = t.length, r = 0, o, s, a, l; for (; n--;) if (o = t[n][1], s) { if (o.type === "link" || o.type === "labelLink" && o._inactive) break; t[n][0] === "enter" && o.type === "labelLink" && (o._inactive = !0) } else if (a) { if (t[n][0] === "enter" && (o.type === "labelImage" || o.type === "labelLink") && !o._balanced && (s = n, o.type !== "labelLink")) { r = 2; break } } else o.type === "labelEnd" && (a = n); let u = { type: t[s][1].type === "labelLink" ? "link" : "image", start: {...t[s][1].start}, end: {...t[t.length - 1][1].end} }, c = {type: "label", start: {...t[s][1].start}, end: {...t[a][1].end}}, f = {type: "labelText", start: {...t[s + r + 2][1].end}, end: {...t[a - 2][1].start}}; return l = [["enter", u, e], ["enter", c, e]], l = we(l, t.slice(s + 1, s + r + 3)), l = we(l, [["enter", f, e]]), l = we(l, gn(e.parser.constructs.insideSpan.null, t.slice(s + r + 4, a - 3), e)), l = we(l, [["exit", f, e], t[a - 2], t[a - 1], ["exit", c, e]]), l = we(l, t.slice(a + 1)), l = we(l, [["exit", u, e]]), le(t, s, t.length, l), t } i(fm, "resolveToLabelEnd"); function dm(t, e, n) { let r = this, o = r.events.length, s, a; for (; o--;) if ((r.events[o][1].type === "labelImage" || r.events[o][1].type === "labelLink") && !r.events[o][1]._balanced) { s = r.events[o][1]; break } return l; function l(h) { return s ? s._inactive ? d(h) : (a = r.parser.defined.includes(ct(r.sliceSerialize({ start: s.end, end: r.now() }))), t.enter("labelEnd"), t.enter("labelMarker"), t.consume(h), t.exit("labelMarker"), t.exit("labelEnd"), u) : n(h) } function u(h) { return h === 40 ? t.attempt(am, f, a ? f : d)(h) : h === 91 ? t.attempt(lm, f, a ? c : d)(h) : a ? f(h) : d(h) } function c(h) { return t.attempt(um, f, d)(h) } function f(h) { return e(h) } function d(h) { return s._balanced = !0, n(h) } } i(dm, "tokenizeLabelEnd"); function pm(t, e, n) { return r; function r(d) { return t.enter("resource"), t.enter("resourceMarker"), t.consume(d), t.exit("resourceMarker"), o } function o(d) { return Y(d) ? Ot(t, s)(d) : s(d) } function s(d) { return d === 41 ? f(d) : Hr(t, a, l, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(d) } function a(d) { return Y(d) ? Ot(t, u)(d) : f(d) } function l(d) { return n(d) } function u(d) { return d === 34 || d === 39 || d === 40 ? Kr(t, c, n, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(d) : f(d) } function c(d) { return Y(d) ? Ot(t, f)(d) : f(d) } function f(d) { return d === 41 ? (t.enter("resourceMarker"), t.consume(d), t.exit("resourceMarker"), t.exit("resource"), e) : n(d) } } i(pm, "tokenizeResource"); function hm(t, e, n) { let r = this; return o; function o(l) { return jr.call(r, t, s, a, "reference", "referenceMarker", "referenceString")(l) } function s(l) { return r.parser.defined.includes(ct(r.sliceSerialize(r.events[r.events.length - 1][1]).slice(1, -1))) ? e(l) : n(l) } function a(l) { return n(l) } } i(hm, "tokenizeReferenceFull"); function mm(t, e, n) { return r; function r(s) { return t.enter("reference"), t.enter("referenceMarker"), t.consume(s), t.exit("referenceMarker"), o } function o(s) { return s === 93 ? (t.enter("referenceMarker"), t.consume(s), t.exit("referenceMarker"), t.exit("reference"), e) : n(s) } } i(mm, "tokenizeReferenceCollapsed"); var Do = {name: "labelStartImage", resolveAll: Nt.resolveAll, tokenize: gm}; function gm(t, e, n) { let r = this; return o; function o(l) { return t.enter("labelImage"), t.enter("labelImageMarker"), t.consume(l), t.exit("labelImageMarker"), s } function s(l) { return l === 91 ? (t.enter("labelMarker"), t.consume(l), t.exit("labelMarker"), t.exit("labelImage"), a) : n(l) } function a(l) { return l === 94 && "_hiddenFootnoteSupport" in r.parser.constructs ? n(l) : e(l) } } i(gm, "tokenizeLabelStartImage"); var Bo = {name: "labelStartLink", resolveAll: Nt.resolveAll, tokenize: wm}; function wm(t, e, n) { let r = this; return o; function o(a) { return t.enter("labelLink"), t.enter("labelMarker"), t.consume(a), t.exit("labelMarker"), t.exit("labelLink"), s } function s(a) { return a === 94 && "_hiddenFootnoteSupport" in r.parser.constructs ? n(a) : e(a) } } i(wm, "tokenizeLabelStartLink"); var jn = {name: "lineEnding", tokenize: bm}; function bm(t, e) { return n; function n(r) { return t.enter("lineEnding"), t.consume(r), t.exit("lineEnding"), _(t, e, "linePrefix") } } i(bm, "tokenizeLineEnding"); var Dt = {name: "thematicBreak", tokenize: km}; function km(t, e, n) { let r = 0, o; return s; function s(c) { return t.enter("thematicBreak"), a(c) } function a(c) { return o = c, l(c) } function l(c) { return c === o ? (t.enter("thematicBreakSequence"), u(c)) : r >= 3 && (c === null || T(c)) ? (t.exit("thematicBreak"), e(c)) : n(c) } function u(c) { return c === o ? (t.consume(c), r++, u) : (t.exit("thematicBreakSequence"), N(c) ? _(t, l, "whitespace")(c) : l(c)) } } i(km, "tokenizeThematicBreak"); var de = {continuation: {tokenize: Am}, exit: Sm, name: "list", tokenize: xm}, ym = {partial: !0, tokenize: Em}, Cm = {partial: !0, tokenize: vm}; function xm(t, e, n) { let r = this, o = r.events[r.events.length - 1], s = o && o[1].type === "linePrefix" ? o[2].sliceSerialize(o[1], !0).length : 0, a = 0; return l; function l(p) { let w = r.containerState.type || (p === 42 || p === 43 || p === 45 ? "listUnordered" : "listOrdered"); if (w === "listUnordered" ? !r.containerState.marker || p === r.containerState.marker : $n(p)) { if (r.containerState.type || (r.containerState.type = w, t.enter(w, {_container: !0})), w === "listUnordered") return t.enter("listItemPrefix"), p === 42 || p === 45 ? t.check(Dt, n, c)(p) : c(p); if (!r.interrupt || p === 49) return t.enter("listItemPrefix"), t.enter("listItemValue"), u(p) } return n(p) } function u(p) { return $n(p) && ++a < 10 ? (t.consume(p), u) : (!r.interrupt || a < 2) && (r.containerState.marker ? p === r.containerState.marker : p === 41 || p === 46) ? (t.exit("listItemValue"), c(p)) : n(p) } function c(p) { return t.enter("listItemMarker"), t.consume(p), t.exit("listItemMarker"), r.containerState.marker = r.containerState.marker || p, t.check(kt, r.interrupt ? n : f, t.attempt(ym, h, d)) } function f(p) { return r.containerState.initialBlankLine = !0, s++, h(p) } function d(p) { return N(p) ? (t.enter("listItemPrefixWhitespace"), t.consume(p), t.exit("listItemPrefixWhitespace"), h) : n(p) } function h(p) { return r.containerState.size = s + r.sliceSerialize(t.exit("listItemPrefix"), !0).length, e(p) } } i(xm, "tokenizeListStart"); function Am(t, e, n) { let r = this; return r.containerState._closeFlow = void 0, t.check(kt, o, s); function o(l) { return r.containerState.furtherBlankLines = r.containerState.furtherBlankLines || r.containerState.initialBlankLine, _(t, e, "listItemIndent", r.containerState.size + 1)(l) } i(o, "onBlank"); function s(l) { return r.containerState.furtherBlankLines || !N(l) ? (r.containerState.furtherBlankLines = void 0, r.containerState.initialBlankLine = void 0, a(l)) : (r.containerState.furtherBlankLines = void 0, r.containerState.initialBlankLine = void 0, t.attempt(Cm, e, a)(l)) } i(s, "notBlank"); function a(l) { return r.containerState._closeFlow = !0, r.interrupt = void 0, _(t, t.attempt(de, e, n), "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(l) } i(a, "notInCurrentItem") } i(Am, "tokenizeListContinuation"); function vm(t, e, n) { let r = this; return _(t, o, "listItemIndent", r.containerState.size + 1); function o(s) { let a = r.events[r.events.length - 1]; return a && a[1].type === "listItemIndent" && a[2].sliceSerialize(a[1], !0).length === r.containerState.size ? e(s) : n(s) } } i(vm, "tokenizeIndent"); function Sm(t) { t.exit(this.containerState.type) } i(Sm, "tokenizeListEnd"); function Em(t, e, n) { let r = this; return _(t, o, "listItemPrefixWhitespace", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 5); function o(s) { let a = r.events[r.events.length - 1]; return !N(s) && a && a[1].type === "listItemPrefixWhitespace" ? e(s) : n(s) } } i(Em, "tokenizeListItemPrefixWhitespace"); var Gr = {name: "setextUnderline", resolveTo: Pm, tokenize: Tm}; function Pm(t, e) { let n = t.length, r, o, s; for (; n--;) if (t[n][0] === "enter") { if (t[n][1].type === "content") { r = n; break } t[n][1].type === "paragraph" && (o = n) } else t[n][1].type === "content" && t.splice(n, 1), !s && t[n][1].type === "definition" && (s = n); let a = {type: "setextHeading", start: {...t[r][1].start}, end: {...t[t.length - 1][1].end}}; return t[o][1].type = "setextHeadingText", s ? (t.splice(o, 0, ["enter", a, e]), t.splice(s + 1, 0, ["exit", t[r][1], e]), t[r][1].end = {...t[s][1].end}) : t[r][1] = a, t.push(["exit", a, e]), t } i(Pm, "resolveToSetextUnderline"); function Tm(t, e, n) { let r = this, o; return s; function s(c) { let f = r.events.length, d; for (; f--;) if (r.events[f][1].type !== "lineEnding" && r.events[f][1].type !== "linePrefix" && r.events[f][1].type !== "content") { d = r.events[f][1].type === "paragraph"; break } return !r.parser.lazy[r.now().line] && (r.interrupt || d) ? (t.enter("setextHeadingLine"), o = c, a(c)) : n(c) } function a(c) { return t.enter("setextHeadingLineSequence"), l(c) } function l(c) { return c === o ? (t.consume(c), l) : (t.exit("setextHeadingLineSequence"), N(c) ? _(t, u, "lineSuffix")(c) : u(c)) } function u(c) { return c === null || T(c) ? (t.exit("setextHeadingLine"), e(c)) : n(c) } } i(Tm, "tokenizeSetextUnderline"); var Rl = {tokenize: Fm}; function Fm(t) { let e = this, n = t.attempt(kt, r, t.attempt(this.parser.constructs.flowInitial, o, _(t, t.attempt(this.parser.constructs.flow, o, t.attempt(Fo, o)), "linePrefix"))); return n; function r(s) { if (s === null) { t.consume(s); return } return t.enter("lineEndingBlank"), t.consume(s), t.exit("lineEndingBlank"), e.currentConstruct = void 0, n } function o(s) { if (s === null) { t.consume(s); return } return t.enter("lineEnding"), t.consume(s), t.exit("lineEnding"), e.currentConstruct = void 0, n } } i(Fm, "initializeFlow"); var Ol = {resolveAll: _l()}, Nl = Bl("string"), Dl = Bl("text"); function Bl(t) { return {resolveAll: _l(t === "text" ? Lm : void 0), tokenize: e}; function e(n) { let r = this, o = this.parser.constructs[t], s = n.attempt(o, a, l); return a; function a(f) { return c(f) ? s(f) : l(f) } function l(f) { if (f === null) { n.consume(f); return } return n.enter("data"), n.consume(f), u } function u(f) { return c(f) ? (n.exit("data"), s(f)) : (n.consume(f), u) } function c(f) { if (f === null) return !0; let d = o[f], h = -1; if (d) for (; ++h < d.length;) { let p = d[h]; if (!p.previous || p.previous.call(r, r.previous)) return !0 } return !1 } } } i(Bl, "initializeFactory"); function _l(t) { return e; function e(n, r) { let o = -1, s; for (; ++o <= n.length;) s === void 0 ? n[o] && n[o][1].type === "data" && (s = o, o++) : (!n[o] || n[o][1].type !== "data") && (o !== s + 2 && (n[s][1].end = n[o - 1][1].end, n.splice(s + 2, o - s - 2), o = s + 2), s = void 0); return t ? t(n, r) : n } } i(_l, "createResolver"); function Lm(t, e) { let n = 0; for (; ++n <= t.length;) if ((n === t.length || t[n][1].type === "lineEnding") && t[n - 1][1].type === "data") { let r = t[n - 1][1], o = e.sliceStream(r), s = o.length, a = -1, l = 0, u; for (; s--;) { let c = o[s]; if (typeof c == "string") { for (a = c.length; c.charCodeAt(a - 1) === 32;) l++, a--; if (a) break; a = -1 } else if (c === -2) u = !0, l++; else if (c !== -1) { s++; break } } if (e._contentTypeTextTrailing && n === t.length && (l = 0), l) { let c = { type: n === t.length || u || l < 2 ? "lineSuffix" : "hardBreakTrailing", start: { _bufferIndex: s ? a : r.start._bufferIndex + a, _index: r.start._index + s, line: r.end.line, column: r.end.column - l, offset: r.end.offset - l }, end: {...r.end} }; r.end = {...c.start}, r.start.offset === r.end.offset ? Object.assign(r, c) : (t.splice(n, 0, ["enter", c, e], ["exit", c, e]), n += 2) } n++ } return t } i(Lm, "resolveAllLineSuffixes"); var _o = {}; ra(_o, { attentionMarkers: () => _m, contentInitial: () => Mm, disable: () => Vm, document: () => Im, flow: () => Om, flowInitial: () => Rm, insideSpan: () => Bm, string: () => Nm, text: () => Dm }); var Im = { 42: de, 43: de, 45: de, 48: de, 49: de, 50: de, 51: de, 52: de, 53: de, 54: de, 55: de, 56: de, 57: de, 62: _r }, Mm = {91: Lo}, Rm = {[-2]: Un, [-1]: Un, 32: Un}, Om = {35: Mo, 42: Dt, 45: [Gr, Dt], 60: Oo, 61: Gr, 95: Dt, 96: $r, 126: $r}, Nm = {38: zr, 92: Vr}, Dm = { [-5]: jn, [-4]: jn, [-3]: jn, 33: Do, 38: zr, 42: Wn, 60: [Po, No], 91: Bo, 92: [Io, Vr], 93: Nt, 95: Wn, 96: To }, Bm = {null: [Wn, Ol]}, _m = {null: [42, 95]}, Vm = {null: []}; function Vl(t, e, n) { let r = { _bufferIndex: -1, _index: 0, line: n && n.line || 1, column: n && n.column || 1, offset: n && n.offset || 0 }, o = {}, s = [], a = [], l = [], u = !0, c = {attempt: I(O), check: I(W), consume: P, enter: L, exit: C, interrupt: I(W, {interrupt: !0})}, f = { code: null, containerState: {}, defineSkip: k, events: [], now: b, parser: t, previous: null, sliceSerialize: w, sliceStream: y, write: p }, d = e.tokenize.call(f, c), h; return e.resolveAll && s.push(e), f; function p(E) { return a = we(a, E), x(), a[a.length - 1] !== null ? [] : (D(e, 0), f.events = gn(s, f.events, f), f.events) } i(p, "write"); function w(E, F) { return $m(y(E), F) } i(w, "sliceSerialize"); function y(E) { return zm(a, E) } i(y, "sliceStream"); function b() { let {_bufferIndex: E, _index: F, line: M, column: V, offset: H} = r; return {_bufferIndex: E, _index: F, line: M, column: V, offset: H} } i(b, "now"); function k(E) { o[E.line] = E.column, U() } i(k, "defineSkip"); function x() { let E; for (; r._index < a.length;) { let F = a[r._index]; if (typeof F == "string") for (E = r._index, r._bufferIndex < 0 && (r._bufferIndex = 0); r._index === E && r._bufferIndex < F.length;) v(F.charCodeAt(r._bufferIndex)); else v(F) } } i(x, "main"); function v(E) { u = void 0, h = E, d = d(E) } i(v, "go"); function P(E) { T(E) ? (r.line++, r.column = 1, r.offset += E === -3 ? 2 : 1, U()) : E !== -1 && (r.column++, r.offset++), r._bufferIndex < 0 ? r._index++ : (r._bufferIndex++, r._bufferIndex === a[r._index].length && (r._bufferIndex = -1, r._index++)), f.previous = E, u = !0 } i(P, "consume"); function L(E, F) { let M = F || {}; return M.type = E, M.start = b(), f.events.push(["enter", M, f]), l.push(M), M } i(L, "enter"); function C(E) { let F = l.pop(); return F.end = b(), f.events.push(["exit", F, f]), F } i(C, "exit"); function O(E, F) { D(E, F.from) } i(O, "onsuccessfulconstruct"); function W(E, F) { F.restore() } i(W, "onsuccessfulcheck"); function I(E, F) { return M; function M(V, H, re) { let me, m, q, ie; return Array.isArray(V) ? ue(V) : "tokenize" in V ? ue([V]) : g(V); function g(oe) { return Pn; function Pn(nt) { let Et = nt !== null && oe[nt], Kt = nt !== null && oe.null, qi = [...Array.isArray(Et) ? Et : Et ? [Et] : [], ...Array.isArray(Kt) ? Kt : Kt ? [Kt] : []]; return ue(qi)(nt) } } function ue(oe) { return me = oe, m = 0, oe.length === 0 ? re : St(oe[m]) } function St(oe) { return Pn; function Pn(nt) { return ie = ne(), q = oe, oe.partial || (f.currentConstruct = oe), oe.name && f.parser.constructs.disable.null.includes(oe.name) ? ar(nt) : oe.tokenize.call(F ? Object.assign(Object.create(f), F) : f, c, Gi, ar)(nt) } } function Gi(oe) { return u = !0, E(q, ie), H } function ar(oe) { return u = !0, ie.restore(), ++m < me.length ? St(me[m]) : re } } } i(I, "constructFactory"); function D(E, F) { E.resolveAll && !s.includes(E) && s.push(E), E.resolve && le(f.events, F, f.events.length - F, E.resolve(f.events.slice(F), f)), E.resolveTo && (f.events = E.resolveTo(f.events, f)) } i(D, "addResult"); function ne() { let E = b(), F = f.previous, M = f.currentConstruct, V = f.events.length, H = Array.from(l); return {from: V, restore: re}; function re() { r = E, f.previous = F, f.currentConstruct = M, f.events.length = V, l = H, U() } } i(ne, "store"); function U() { r.line in o && r.column < 2 && (r.column = o[r.line], r.offset += o[r.line] - 1) } i(U, "accountForPotentialSkip") } i(Vl, "createTokenizer"); function zm(t, e) { let n = e.start._index, r = e.start._bufferIndex, o = e.end._index, s = e.end._bufferIndex, a; if (n === o) a = [t[n].slice(r, s)]; else { if (a = t.slice(n, o), r > -1) { let l = a[0]; typeof l == "string" ? a[0] = l.slice(r) : a.shift() } s > 0 && a.push(t[o].slice(0, s)) } return a } i(zm, "sliceChunks"); function $m(t, e) { let n = -1, r = [], o; for (; ++n < t.length;) { let s = t[n], a; if (typeof s == "string") a = s; else switch (s) { case-5: { a = "\r"; break } case-4: { a = ` `; break } case-3: { a = `\r `; break } case-2: { a = e ? " " : " "; break } case-1: { if (!e && o) continue; a = " "; break } default: a = String.fromCharCode(s) } o = s === -2, r.push(a) } return r.join("") } i($m, "serializeChunks"); function Vo(t) { let r = { constructs: Cl([_o, ...(t || {}).extensions || []]), content: o(Pl), defined: [], document: o(Fl), flow: o(Rl), lazy: {}, string: o(Nl), text: o(Dl) }; return r; function o(s) { return a; function a(l) { return Vl(r, s, l) } } } i(Vo, "parse"); function zo(t) { for (; !Ur(t);) ; return t } i(zo, "postprocess"); var zl = /[\0\t\n\r]/g; function $o() { let t = 1, e = "", n = !0, r; return o; function o(s, a, l) { let u = [], c, f, d, h, p; for (s = e + (typeof s == "string" ? s.toString() : new TextDecoder(a || void 0).decode(s)), d = 0, e = "", n && (s.charCodeAt(0) === 65279 && d++, n = void 0); d < s.length;) { if (zl.lastIndex = d, c = zl.exec(s), h = c && c.index !== void 0 ? c.index : s.length, p = s.charCodeAt(h), !c) { e = s.slice(d); break } if (p === 10 && d === h && r) u.push(-3), r = void 0; else switch (r && (u.push(-5), r = void 0), d < h && (u.push(s.slice(d, h)), t += h - d), p) { case 0: { u.push(65533), t++; break } case 9: { for (f = Math.ceil(t / 4) * 4, u.push(-2); t++ < f;) u.push(-1); break } case 10: { u.push(-4), t = 1; break } default: r = !0, t = 1 } d = h + 1 } return l && (r && u.push(-5), e && u.push(e), u.push(null)), u } } i($o, "preprocess"); var Wm = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; function qr(t) { return t.replace(Wm, Um) } i(qr, "decodeString"); function Um(t, e, n) { if (e) return e; if (n.charCodeAt(0) === 35) { let o = n.charCodeAt(1), s = o === 120 || o === 88; return Br(n.slice(s ? 2 : 1), s ? 16 : 10) } return hn(n) || t } i(Um, "decode"); function yt(t) { return !t || typeof t != "object" ? "" : "position" in t || "type" in t ? $l(t.position) : "start" in t || "end" in t ? $l(t) : "line" in t || "column" in t ? Wo(t) : "" } i(yt, "stringifyPosition"); function Wo(t) { return Wl(t && t.line) + ":" + Wl(t && t.column) } i(Wo, "point"); function $l(t) { return Wo(t && t.start) + "-" + Wo(t && t.end) } i($l, "position"); function Wl(t) { return t && typeof t == "number" ? t : 1 } i(Wl, "index"); var Hl = {}.hasOwnProperty; function Uo(t, e, n) { return e && typeof e == "object" && (n = e, e = void 0), Hm(n)(zo(Vo(n).document().write($o()(t, e, !0)))) } i(Uo, "fromMarkdown"); function Hm(t) { let e = { transforms: [], canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"], enter: { autolink: s(ta), autolinkProtocol: I, autolinkEmail: I, atxHeading: s(Xs), blockQuote: s(nt), characterEscape: I, characterReference: I, codeFenced: s(Et), codeFencedFenceInfo: a, codeFencedFenceMeta: a, codeIndented: s(Et, a), codeText: s(Kt, a), codeTextData: I, data: I, codeFlowValue: I, definition: s(qi), definitionDestinationString: a, definitionLabelString: a, definitionTitleString: a, emphasis: s(sf), hardBreakEscape: s(Zs), hardBreakTrailing: s(Zs), htmlFlow: s(ea, a), htmlFlowData: I, htmlText: s(ea, a), htmlTextData: I, image: s(af), label: a, link: s(ta), listItem: s(lf), listItemValue: h, listOrdered: s(na, d), listUnordered: s(na), paragraph: s(uf), reference: g, referenceString: a, resourceDestinationString: a, resourceTitleString: a, setextHeading: s(Xs), strong: s(cf), thematicBreak: s(df) }, exit: { atxHeading: u(), atxHeadingSequence: L, autolink: u(), autolinkEmail: Pn, autolinkProtocol: oe, blockQuote: u(), characterEscapeValue: D, characterReferenceMarkerHexadecimal: St, characterReferenceMarkerNumeric: St, characterReferenceValue: Gi, characterReference: ar, codeFenced: u(b), codeFencedFence: y, codeFencedFenceInfo: p, codeFencedFenceMeta: w, codeFlowValue: D, codeIndented: u(k), codeText: u(M), codeTextData: D, data: D, definition: u(), definitionDestinationString: P, definitionLabelString: x, definitionTitleString: v, emphasis: u(), hardBreakEscape: u(U), hardBreakTrailing: u(U), htmlFlow: u(E), htmlFlowData: D, htmlText: u(F), htmlTextData: D, image: u(H), label: me, labelText: re, lineEnding: ne, link: u(V), listItem: u(), listOrdered: u(), listUnordered: u(), paragraph: u(), referenceString: ue, resourceDestinationString: m, resourceTitleString: q, resource: ie, setextHeading: u(W), setextHeadingLineSequence: O, setextHeadingText: C, strong: u(), thematicBreak: u() } }; jl(e, (t || {}).mdastExtensions || []); let n = {}; return r; function r(A) { let S = {type: "root", children: []}, B = {stack: [S], tokenStack: [], config: e, enter: l, exit: c, buffer: a, resume: f, data: n}, $ = [], G = -1; for (; ++G < A.length;) if (A[G][1].type === "listOrdered" || A[G][1].type === "listUnordered") if (A[G][0] === "enter") $.push(G); else { let ze = $.pop(); G = o(A, ze, G) } for (G = -1; ++G < A.length;) { let ze = e[A[G][0]]; Hl.call(ze, A[G][1].type) && ze[A[G][1].type].call(Object.assign({sliceSerialize: A[G][2].sliceSerialize}, B), A[G][1]) } if (B.tokenStack.length > 0) { let ze = B.tokenStack[B.tokenStack.length - 1]; (ze[1] || Ul).call(B, void 0, ze[0]) } for (S.position = { start: Ct(A.length > 0 ? A[0][1].start : {line: 1, column: 1, offset: 0}), end: Ct(A.length > 0 ? A[A.length - 2][1].end : {line: 1, column: 1, offset: 0}) }, G = -1; ++G < e.transforms.length;) S = e.transforms[G](S) || S; return S } function o(A, S, B) { let $ = S - 1, G = -1, ze = !1, Pt, rt, Tn, Fn; for (; ++$ <= B;) { let Pe = A[$]; switch (Pe[1].type) { case"listUnordered": case"listOrdered": case"blockQuote": { Pe[0] === "enter" ? G++ : G--, Fn = void 0; break } case"lineEndingBlank": { Pe[0] === "enter" && (Pt && !Fn && !G && !Tn && (Tn = $), Fn = void 0); break } case"linePrefix": case"listItemValue": case"listItemMarker": case"listItemPrefix": case"listItemPrefixWhitespace": break; default: Fn = void 0 } if (!G && Pe[0] === "enter" && Pe[1].type === "listItemPrefix" || G === -1 && Pe[0] === "exit" && (Pe[1].type === "listUnordered" || Pe[1].type === "listOrdered")) { if (Pt) { let Gt = $; for (rt = void 0; Gt--;) { let it = A[Gt]; if (it[1].type === "lineEnding" || it[1].type === "lineEndingBlank") { if (it[0] === "exit") continue; rt && (A[rt][1].type = "lineEndingBlank", ze = !0), it[1].type = "lineEnding", rt = Gt } else if (!(it[1].type === "linePrefix" || it[1].type === "blockQuotePrefix" || it[1].type === "blockQuotePrefixWhitespace" || it[1].type === "blockQuoteMarker" || it[1].type === "listItemIndent")) break } Tn && (!rt || Tn < rt) && (Pt._spread = !0), Pt.end = Object.assign({}, rt ? A[rt][1].start : Pe[1].end), A.splice(rt || $, 0, ["exit", Pt, Pe[2]]), $++, B++ } if (Pe[1].type === "listItemPrefix") { let Gt = {type: "listItem", _spread: !1, start: Object.assign({}, Pe[1].start), end: void 0}; Pt = Gt, A.splice($, 0, ["enter", Gt, Pe[2]]), $++, B++, Tn = void 0, Fn = !0 } } } return A[S][1]._spread = ze, B } function s(A, S) { return B; function B($) { l.call(this, A($), $), S && S.call(this, $) } } function a() { this.stack.push({type: "fragment", children: []}) } function l(A, S, B) { this.stack[this.stack.length - 1].children.push(A), this.stack.push(A), this.tokenStack.push([S, B || void 0]), A.position = { start: Ct(S.start), end: void 0 } } function u(A) { return S; function S(B) { A && A.call(this, B), c.call(this, B) } } function c(A, S) { let B = this.stack.pop(), $ = this.tokenStack.pop(); if ($) $[0].type !== A.type && (S ? S.call(this, A, $[0]) : ($[1] || Ul).call(this, A, $[0])); else throw new Error("Cannot close `" + A.type + "` (" + yt({ start: A.start, end: A.end }) + "): it\u2019s not open"); B.position.end = Ct(A.end) } function f() { return Rt(this.stack.pop()) } function d() { this.data.expectingFirstListItemValue = !0 } function h(A) { if (this.data.expectingFirstListItemValue) { let S = this.stack[this.stack.length - 2]; S.start = Number.parseInt(this.sliceSerialize(A), 10), this.data.expectingFirstListItemValue = void 0 } } function p() { let A = this.resume(), S = this.stack[this.stack.length - 1]; S.lang = A } function w() { let A = this.resume(), S = this.stack[this.stack.length - 1]; S.meta = A } function y() { this.data.flowCodeInside || (this.buffer(), this.data.flowCodeInside = !0) } function b() { let A = this.resume(), S = this.stack[this.stack.length - 1]; S.value = A.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""), this.data.flowCodeInside = void 0 } function k() { let A = this.resume(), S = this.stack[this.stack.length - 1]; S.value = A.replace(/(\r?\n|\r)$/g, "") } function x(A) { let S = this.resume(), B = this.stack[this.stack.length - 1]; B.label = S, B.identifier = ct(this.sliceSerialize(A)).toLowerCase() } function v() { let A = this.resume(), S = this.stack[this.stack.length - 1]; S.title = A } function P() { let A = this.resume(), S = this.stack[this.stack.length - 1]; S.url = A } function L(A) { let S = this.stack[this.stack.length - 1]; if (!S.depth) { let B = this.sliceSerialize(A).length; S.depth = B } } function C() { this.data.setextHeadingSlurpLineEnding = !0 } function O(A) { let S = this.stack[this.stack.length - 1]; S.depth = this.sliceSerialize(A).codePointAt(0) === 61 ? 1 : 2 } function W() { this.data.setextHeadingSlurpLineEnding = void 0 } function I(A) { let B = this.stack[this.stack.length - 1].children, $ = B[B.length - 1]; (!$ || $.type !== "text") && ($ = ff(), $.position = { start: Ct(A.start), end: void 0 }, B.push($)), this.stack.push($) } function D(A) { let S = this.stack.pop(); S.value += this.sliceSerialize(A), S.position.end = Ct(A.end) } function ne(A) { let S = this.stack[this.stack.length - 1]; if (this.data.atHardBreak) { let B = S.children[S.children.length - 1]; B.position.end = Ct(A.end), this.data.atHardBreak = void 0; return } !this.data.setextHeadingSlurpLineEnding && e.canContainEols.includes(S.type) && (I.call(this, A), D.call(this, A)) } function U() { this.data.atHardBreak = !0 } function E() { let A = this.resume(), S = this.stack[this.stack.length - 1]; S.value = A } function F() { let A = this.resume(), S = this.stack[this.stack.length - 1]; S.value = A } function M() { let A = this.resume(), S = this.stack[this.stack.length - 1]; S.value = A } function V() { let A = this.stack[this.stack.length - 1]; if (this.data.inReference) { let S = this.data.referenceType || "shortcut"; A.type += "Reference", A.referenceType = S, delete A.url, delete A.title } else delete A.identifier, delete A.label; this.data.referenceType = void 0 } function H() { let A = this.stack[this.stack.length - 1]; if (this.data.inReference) { let S = this.data.referenceType || "shortcut"; A.type += "Reference", A.referenceType = S, delete A.url, delete A.title } else delete A.identifier, delete A.label; this.data.referenceType = void 0 } function re(A) { let S = this.sliceSerialize(A), B = this.stack[this.stack.length - 2]; B.label = qr(S), B.identifier = ct(S).toLowerCase() } function me() { let A = this.stack[this.stack.length - 1], S = this.resume(), B = this.stack[this.stack.length - 1]; if (this.data.inReference = !0, B.type === "link") { let $ = A.children; B.children = $ } else B.alt = S } function m() { let A = this.resume(), S = this.stack[this.stack.length - 1]; S.url = A } function q() { let A = this.resume(), S = this.stack[this.stack.length - 1]; S.title = A } function ie() { this.data.inReference = void 0 } function g() { this.data.referenceType = "collapsed" } function ue(A) { let S = this.resume(), B = this.stack[this.stack.length - 1]; B.label = S, B.identifier = ct(this.sliceSerialize(A)).toLowerCase(), this.data.referenceType = "full" } function St(A) { this.data.characterReferenceType = A.type } function Gi(A) { let S = this.sliceSerialize(A), B = this.data.characterReferenceType, $; B ? ($ = Br(S, B === "characterReferenceMarkerNumeric" ? 10 : 16), this.data.characterReferenceType = void 0) : $ = hn(S); let G = this.stack[this.stack.length - 1]; G.value += $ } function ar(A) { let S = this.stack.pop(); S.position.end = Ct(A.end) } function oe(A) { D.call(this, A); let S = this.stack[this.stack.length - 1]; S.url = this.sliceSerialize(A) } function Pn(A) { D.call(this, A); let S = this.stack[this.stack.length - 1]; S.url = "mailto:" + this.sliceSerialize(A) } function nt() { return {type: "blockquote", children: []} } function Et() { return {type: "code", lang: null, meta: null, value: ""} } function Kt() { return {type: "inlineCode", value: ""} } function qi() { return {type: "definition", identifier: "", label: null, title: null, url: ""} } function sf() { return {type: "emphasis", children: []} } function Xs() { return {type: "heading", depth: 0, children: []} } function Zs() { return {type: "break"} } function ea() { return {type: "html", value: ""} } function af() { return {type: "image", title: null, url: "", alt: null} } function ta() { return {type: "link", title: null, url: "", children: []} } function na(A) { return {type: "list", ordered: A.type === "listOrdered", start: null, spread: A._spread, children: []} } function lf(A) { return {type: "listItem", spread: A._spread, checked: null, children: []} } function uf() { return {type: "paragraph", children: []} } function cf() { return {type: "strong", children: []} } function ff() { return {type: "text", value: ""} } function df() { return {type: "thematicBreak"} } } i(Hm, "compiler"); function Ct(t) { return {line: t.line, column: t.column, offset: t.offset} } i(Ct, "point"); function jl(t, e) { let n = -1; for (; ++n < e.length;) { let r = e[n]; Array.isArray(r) ? jl(t, r) : jm(t, r) } } i(jl, "configure"); function jm(t, e) { let n; for (n in e) if (Hl.call(e, n)) switch (n) { case"canContainEols": { let r = e[n]; r && t[n].push(...r); break } case"transforms": { let r = e[n]; r && t[n].push(...r); break } case"enter": case"exit": { let r = e[n]; r && Object.assign(t[n], r); break } } } i(jm, "extension"); function Ul(t, e) { throw t ? new Error("Cannot close `" + t.type + "` (" + yt({ start: t.start, end: t.end }) + "): a different token (`" + e.type + "`, " + yt({ start: e.start, end: e.end }) + ") is open") : new Error("Cannot close document, a token (`" + e.type + "`, " + yt({ start: e.start, end: e.end }) + ") is still open") } i(Ul, "defaultOnError"); function wn(t) { let e = this; e.parser = n; function n(r) { return Uo(r, { ...e.data("settings"), ...t, extensions: e.data("micromarkExtensions") || [], mdastExtensions: e.data("fromMarkdownExtensions") || [] }) } i(n, "parser") } i(wn, "remarkParse"); var Kl = {}.hasOwnProperty; function Gl(t, e) { let n = e || {}; function r(o, ...s) { let a = r.invalid, l = r.handlers; if (o && Kl.call(o, t)) { let u = String(o[t]); a = Kl.call(l, u) ? l[u] : r.unknown } if (a) return a.call(this, o, ...s) } return i(r, "one"), r.handlers = n.handlers || {}, r.invalid = n.invalid, r.unknown = n.unknown, r } i(Gl, "zwitch"); var Km = {}.hasOwnProperty; function Ho(t, e) { let n = -1, r; if (e.extensions) for (; ++n < e.extensions.length;) Ho(t, e.extensions[n]); for (r in e) if (Km.call(e, r)) switch (r) { case"extensions": break; case"unsafe": { ql(t[r], e[r]); break } case"join": { ql(t[r], e[r]); break } case"handlers": { Gm(t[r], e[r]); break } default: t.options[r] = e[r] } return t } i(Ho, "configure"); function ql(t, e) { e && t.push(...e) } i(ql, "list"); function Gm(t, e) { e && Object.assign(t, e) } i(Gm, "map"); function Jl(t, e, n, r) { let o = n.enter("blockquote"), s = n.createTracker(r); s.move("> "), s.shift(2); let a = n.indentLines(n.containerFlow(t, s.current()), qm); return o(), a } i(Jl, "blockquote"); function qm(t, e, n) { return ">" + (n ? "" : " ") + t } i(qm, "map"); function Jr(t, e) { return Yl(t, e.inConstruct, !0) && !Yl(t, e.notInConstruct, !1) } i(Jr, "patternInScope"); function Yl(t, e, n) { if (typeof e == "string" && (e = [e]), !e || e.length === 0) return n; let r = -1; for (; ++r < e.length;) if (t.includes(e[r])) return !0; return !1 } i(Yl, "listInScope"); function jo(t, e, n, r) { let o = -1; for (; ++o < n.unsafe.length;) if (n.unsafe[o].character === ` ` && Jr(n.stack, n.unsafe[o])) return /[ \t]/.test(r.before) ? "" : " "; return `\\ ` } i(jo, "hardBreak"); function Ql(t, e) { let n = String(t), r = n.indexOf(e), o = r, s = 0, a = 0; if (typeof e != "string") throw new TypeError("Expected substring"); for (; r !== -1;) r === o ? ++s > a && (a = s) : s = 1, o = r + e.length, r = n.indexOf(e, o); return a } i(Ql, "longestStreak"); function Kn(t, e) { return !!(e.options.fences === !1 && t.value && !t.lang && /[^ \r\n]/.test(t.value) && !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value)) } i(Kn, "formatCodeAsIndented"); function Xl(t) { let e = t.options.fence || "`"; if (e !== "`" && e !== "~") throw new Error("Cannot serialize code with `" + e + "` for `options.fence`, expected `` ` `` or `~`"); return e } i(Xl, "checkFence"); function Zl(t, e, n, r) { let o = Xl(n), s = t.value || "", a = o === "`" ? "GraveAccent" : "Tilde"; if (Kn(t, n)) { let d = n.enter("codeIndented"), h = n.indentLines(s, Jm); return d(), h } let l = n.createTracker(r), u = o.repeat(Math.max(Ql(s, o) + 1, 3)), c = n.enter("codeFenced"), f = l.move(u); if (t.lang) { let d = n.enter(`codeFencedLang${a}`); f += l.move(n.safe(t.lang, {before: f, after: " ", encode: ["`"], ...l.current()})), d() } if (t.lang && t.meta) { let d = n.enter(`codeFencedMeta${a}`); f += l.move(" "), f += l.move(n.safe(t.meta, { before: f, after: ` `, encode: ["`"], ...l.current() })), d() } return f += l.move(` `), s && (f += l.move(s + ` `)), f += l.move(u), c(), f } i(Zl, "code"); function Jm(t, e, n) { return (n ? "" : " ") + t } i(Jm, "map"); function bn(t) { let e = t.options.quote || '"'; if (e !== '"' && e !== "'") throw new Error("Cannot serialize title with `" + e + "` for `options.quote`, expected `\"`, or `'`"); return e } i(bn, "checkQuote"); function eu(t, e, n, r) { let o = bn(n), s = o === '"' ? "Quote" : "Apostrophe", a = n.enter("definition"), l = n.enter("label"), u = n.createTracker(r), c = u.move("["); return c += u.move(n.safe(n.associationId(t), { before: c, after: "]", ...u.current() })), c += u.move("]: "), l(), !t.url || /[\0- \u007F]/.test(t.url) ? (l = n.enter("destinationLiteral"), c += u.move("<"), c += u.move(n.safe(t.url, { before: c, after: ">", ...u.current() })), c += u.move(">")) : (l = n.enter("destinationRaw"), c += u.move(n.safe(t.url, { before: c, after: t.title ? " " : ` `, ...u.current() }))), l(), t.title && (l = n.enter(`title${s}`), c += u.move(" " + o), c += u.move(n.safe(t.title, { before: c, after: o, ...u.current() })), c += u.move(o), l()), a(), c } i(eu, "definition"); function tu(t) { let e = t.options.emphasis || "*"; if (e !== "*" && e !== "_") throw new Error("Cannot serialize emphasis with `" + e + "` for `options.emphasis`, expected `*`, or `_`"); return e } i(tu, "checkEmphasis"); function Me(t) { return "&#x" + t.toString(16).toUpperCase() + ";" } i(Me, "encodeCharacterReference"); function kn(t, e, n) { let r = mn(t), o = mn(e); return r === void 0 ? o === void 0 ? n === "_" ? {inside: !0, outside: !0} : { inside: !1, outside: !1 } : o === 1 ? {inside: !0, outside: !0} : {inside: !1, outside: !0} : r === 1 ? o === void 0 ? { inside: !1, outside: !1 } : o === 1 ? {inside: !0, outside: !0} : {inside: !1, outside: !1} : o === void 0 ? { inside: !1, outside: !1 } : o === 1 ? {inside: !0, outside: !1} : {inside: !1, outside: !1} } i(kn, "encodeInfo"); Ko.peek = Ym; function Ko(t, e, n, r) { let o = tu(n), s = n.enter("emphasis"), a = n.createTracker(r), l = a.move(o), u = a.move(n.containerPhrasing(t, {after: o, before: l, ...a.current()})), c = u.charCodeAt(0), f = kn(r.before.charCodeAt(r.before.length - 1), c, o); f.inside && (u = Me(c) + u.slice(1)); let d = u.charCodeAt(u.length - 1), h = kn(r.after.charCodeAt(0), d, o); h.inside && (u = u.slice(0, -1) + Me(d)); let p = a.move(o); return s(), n.attentionEncodeSurroundingInfo = {after: h.outside, before: f.outside}, l + u + p } i(Ko, "emphasis"); function Ym(t, e, n) { return n.options.emphasis || "*" } i(Ym, "emphasisPeek"); var yn = i((function (t) { if (t == null) return eg; if (typeof t == "function") return Yr(t); if (typeof t == "object") return Array.isArray(t) ? Qm(t) : Xm(t); if (typeof t == "string") return Zm(t); throw new Error("Expected function, string, or object as test") }), "convert"); function Qm(t) { let e = [], n = -1; for (; ++n < t.length;) e[n] = yn(t[n]); return Yr(r); function r(...o) { let s = -1; for (; ++s < e.length;) if (e[s].apply(this, o)) return !0; return !1 } } i(Qm, "anyFactory"); function Xm(t) { let e = t; return Yr(n); function n(r) { let o = r, s; for (s in t) if (o[s] !== e[s]) return !1; return !0 } } i(Xm, "propertiesFactory"); function Zm(t) { return Yr(e); function e(n) { return n && n.type === t } } i(Zm, "typeFactory"); function Yr(t) { return e; function e(n, r, o) { return !!(tg(n) && t.call(this, n, typeof r == "number" ? r : void 0, o || void 0)) } } i(Yr, "castFactory"); function eg() { return !0 } i(eg, "ok"); function tg(t) { return t !== null && typeof t == "object" && "type" in t } i(tg, "looksLikeANode"); function nu(t) { return "\x1B[33m" + t + "\x1B[39m" } i(nu, "color"); var ru = [], Qr = !0, Bt = !1, Xr = "skip"; function Go(t, e, n, r) { let o; typeof e == "function" && typeof n != "function" ? (r = n, n = e) : o = e; let s = yn(o), a = r ? -1 : 1; l(t, void 0, [])(); function l(u, c, f) { let d = u && typeof u == "object" ? u : {}; if (typeof d.type == "string") { let p = typeof d.tagName == "string" ? d.tagName : typeof d.name == "string" ? d.name : void 0; Object.defineProperty(h, "name", {value: "node (" + nu(u.type + (p ? "<" + p + ">" : "")) + ")"}) } return h; function h() { let p = ru, w, y, b; if ((!e || s(u, c, f[f.length - 1] || void 0)) && (p = ng(n(u, f)), p[0] === Bt)) return p; if ("children" in u && u.children) { let k = u; if (k.children && p[0] !== Xr) for (y = (r ? k.children.length : -1) + a, b = f.concat(k); y > -1 && y < k.children.length;) { let x = k.children[y]; if (w = l(x, y, b)(), w[0] === Bt) return w; y = typeof w[1] == "number" ? w[1] : y + a } } return p } } i(l, "factory") } i(Go, "visitParents"); function ng(t) { return Array.isArray(t) ? t : typeof t == "number" ? [Qr, t] : t == null ? ru : [t] } i(ng, "toResult"); function Gn(t, e, n, r) { let o, s, a; typeof e == "function" && typeof n != "function" ? (s = void 0, a = e, o = n) : (s = e, a = n, o = r), Go(t, s, l, o); function l(u, c) { let f = c[c.length - 1], d = f ? f.children.indexOf(u) : void 0; return a(u, d, f) } i(l, "overload") } i(Gn, "visit"); function Zr(t, e) { let n = !1; return Gn(t, function (r) { if ("value" in r && /\r?\n|\r/.test(r.value) || r.type === "break") return n = !0, Bt }), !!((!t.depth || t.depth < 3) && Rt(t) && (e.options.setext || n)) } i(Zr, "formatHeadingAsSetext"); function iu(t, e, n, r) { let o = Math.max(Math.min(6, t.depth || 1), 1), s = n.createTracker(r); if (Zr(t, n)) { let f = n.enter("headingSetext"), d = n.enter("phrasing"), h = n.containerPhrasing(t, { ...s.current(), before: ` `, after: ` ` }); return d(), f(), h + ` ` + (o === 1 ? "=" : "-").repeat(h.length - (Math.max(h.lastIndexOf("\r"), h.lastIndexOf(` `)) + 1)) } let a = "#".repeat(o), l = n.enter("headingAtx"), u = n.enter("phrasing"); s.move(a + " "); let c = n.containerPhrasing(t, { before: "# ", after: ` `, ...s.current() }); return /^[\t ]/.test(c) && (c = Me(c.charCodeAt(0)) + c.slice(1)), c = c ? a + " " + c : a, n.options.closeAtx && (c += " " + a), u(), l(), c } i(iu, "heading"); qo.peek = rg; function qo(t) { return t.value || "" } i(qo, "html"); function rg() { return "<" } i(rg, "htmlPeek"); Jo.peek = ig; function Jo(t, e, n, r) { let o = bn(n), s = o === '"' ? "Quote" : "Apostrophe", a = n.enter("image"), l = n.enter("label"), u = n.createTracker(r), c = u.move("!["); return c += u.move(n.safe(t.alt, { before: c, after: "]", ...u.current() })), c += u.move("]("), l(), !t.url && t.title || /[\0- \u007F]/.test(t.url) ? (l = n.enter("destinationLiteral"), c += u.move("<"), c += u.move(n.safe(t.url, { before: c, after: ">", ...u.current() })), c += u.move(">")) : (l = n.enter("destinationRaw"), c += u.move(n.safe(t.url, { before: c, after: t.title ? " " : ")", ...u.current() }))), l(), t.title && (l = n.enter(`title${s}`), c += u.move(" " + o), c += u.move(n.safe(t.title, { before: c, after: o, ...u.current() })), c += u.move(o), l()), c += u.move(")"), a(), c } i(Jo, "image"); function ig() { return "!" } i(ig, "imagePeek"); Yo.peek = og; function Yo(t, e, n, r) { let o = t.referenceType, s = n.enter("imageReference"), a = n.enter("label"), l = n.createTracker(r), u = l.move("!["), c = n.safe(t.alt, {before: u, after: "]", ...l.current()}); u += l.move(c + "]["), a(); let f = n.stack; n.stack = [], a = n.enter("reference"); let d = n.safe(n.associationId(t), {before: u, after: "]", ...l.current()}); return a(), n.stack = f, s(), o === "full" || !c || c !== d ? u += l.move(d + "]") : o === "shortcut" ? u = u.slice(0, -1) : u += l.move("]"), u } i(Yo, "imageReference"); function og() { return "!" } i(og, "imageReferencePeek"); Qo.peek = sg; function Qo(t, e, n) { let r = t.value || "", o = "`", s = -1; for (; new RegExp("(^|[^`])" + o + "([^`]|$)").test(r);) o += "`"; for (/[^ \r\n]/.test(r) && (/^[ \r\n]/.test(r) && /[ \r\n]$/.test(r) || /^`|`$/.test(r)) && (r = " " + r + " "); ++s < n.unsafe.length;) { let a = n.unsafe[s], l = n.compilePattern(a), u; if (a.atBreak) for (; u = l.exec(r);) { let c = u.index; r.charCodeAt(c) === 10 && r.charCodeAt(c - 1) === 13 && c--, r = r.slice(0, c) + " " + r.slice(u.index + 1) } } return o + r + o } i(Qo, "inlineCode"); function sg() { return "`" } i(sg, "inlineCodePeek"); function Xo(t, e) { let n = Rt(t); return !!(!e.options.resourceLink && t.url && !t.title && t.children && t.children.length === 1 && t.children[0].type === "text" && (n === t.url || "mailto:" + n === t.url) && /^[a-z][a-z+.-]+:/i.test(t.url) && !/[\0- <>\u007F]/.test(t.url)) } i(Xo, "formatLinkAsAutolink"); Zo.peek = ag; function Zo(t, e, n, r) { let o = bn(n), s = o === '"' ? "Quote" : "Apostrophe", a = n.createTracker(r), l, u; if (Xo(t, n)) { let f = n.stack; n.stack = [], l = n.enter("autolink"); let d = a.move("<"); return d += a.move(n.containerPhrasing(t, { before: d, after: ">", ...a.current() })), d += a.move(">"), l(), n.stack = f, d } l = n.enter("link"), u = n.enter("label"); let c = a.move("["); return c += a.move(n.containerPhrasing(t, { before: c, after: "](", ...a.current() })), c += a.move("]("), u(), !t.url && t.title || /[\0- \u007F]/.test(t.url) ? (u = n.enter("destinationLiteral"), c += a.move("<"), c += a.move(n.safe(t.url, { before: c, after: ">", ...a.current() })), c += a.move(">")) : (u = n.enter("destinationRaw"), c += a.move(n.safe(t.url, { before: c, after: t.title ? " " : ")", ...a.current() }))), u(), t.title && (u = n.enter(`title${s}`), c += a.move(" " + o), c += a.move(n.safe(t.title, { before: c, after: o, ...a.current() })), c += a.move(o), u()), c += a.move(")"), l(), c } i(Zo, "link"); function ag(t, e, n) { return Xo(t, n) ? "<" : "[" } i(ag, "linkPeek"); es.peek = lg; function es(t, e, n, r) { let o = t.referenceType, s = n.enter("linkReference"), a = n.enter("label"), l = n.createTracker(r), u = l.move("["), c = n.containerPhrasing(t, {before: u, after: "]", ...l.current()}); u += l.move(c + "]["), a(); let f = n.stack; n.stack = [], a = n.enter("reference"); let d = n.safe(n.associationId(t), {before: u, after: "]", ...l.current()}); return a(), n.stack = f, s(), o === "full" || !c || c !== d ? u += l.move(d + "]") : o === "shortcut" ? u = u.slice(0, -1) : u += l.move("]"), u } i(es, "linkReference"); function lg() { return "[" } i(lg, "linkReferencePeek"); function Cn(t) { let e = t.options.bullet || "*"; if (e !== "*" && e !== "+" && e !== "-") throw new Error("Cannot serialize items with `" + e + "` for `options.bullet`, expected `*`, `+`, or `-`"); return e } i(Cn, "checkBullet"); function ou(t) { let e = Cn(t), n = t.options.bulletOther; if (!n) return e === "*" ? "-" : "*"; if (n !== "*" && n !== "+" && n !== "-") throw new Error("Cannot serialize items with `" + n + "` for `options.bulletOther`, expected `*`, `+`, or `-`"); if (n === e) throw new Error("Expected `bullet` (`" + e + "`) and `bulletOther` (`" + n + "`) to be different"); return n } i(ou, "checkBulletOther"); function su(t) { let e = t.options.bulletOrdered || "."; if (e !== "." && e !== ")") throw new Error("Cannot serialize items with `" + e + "` for `options.bulletOrdered`, expected `.` or `)`"); return e } i(su, "checkBulletOrdered"); function ei(t) { let e = t.options.rule || "*"; if (e !== "*" && e !== "-" && e !== "_") throw new Error("Cannot serialize rules with `" + e + "` for `options.rule`, expected `*`, `-`, or `_`"); return e } i(ei, "checkRule"); function au(t, e, n, r) { let o = n.enter("list"), s = n.bulletCurrent, a = t.ordered ? su(n) : Cn(n), l = t.ordered ? a === "." ? ")" : "." : ou(n), u = e && n.bulletLastUsed ? a === n.bulletLastUsed : !1; if (!t.ordered) { let f = t.children ? t.children[0] : void 0; if ((a === "*" || a === "-") && f && (!f.children || !f.children[0]) && n.stack[n.stack.length - 1] === "list" && n.stack[n.stack.length - 2] === "listItem" && n.stack[n.stack.length - 3] === "list" && n.stack[n.stack.length - 4] === "listItem" && n.indexStack[n.indexStack.length - 1] === 0 && n.indexStack[n.indexStack.length - 2] === 0 && n.indexStack[n.indexStack.length - 3] === 0 && (u = !0), ei(n) === a && f) { let d = -1; for (; ++d < t.children.length;) { let h = t.children[d]; if (h && h.type === "listItem" && h.children && h.children[0] && h.children[0].type === "thematicBreak") { u = !0; break } } } } u && (a = l), n.bulletCurrent = a; let c = n.containerFlow(t, r); return n.bulletLastUsed = a, n.bulletCurrent = s, o(), c } i(au, "list"); function lu(t) { let e = t.options.listItemIndent || "one"; if (e !== "tab" && e !== "one" && e !== "mixed") throw new Error("Cannot serialize items with `" + e + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"); return e } i(lu, "checkListItemIndent"); function uu(t, e, n, r) { let o = lu(n), s = n.bulletCurrent || Cn(n); e && e.type === "list" && e.ordered && (s = (typeof e.start == "number" && e.start > -1 ? e.start : 1) + (n.options.incrementListMarker === !1 ? 0 : e.children.indexOf(t)) + s); let a = s.length + 1; (o === "tab" || o === "mixed" && (e && e.type === "list" && e.spread || t.spread)) && (a = Math.ceil(a / 4) * 4); let l = n.createTracker(r); l.move(s + " ".repeat(a - s.length)), l.shift(a); let u = n.enter("listItem"), c = n.indentLines(n.containerFlow(t, l.current()), f); return u(), c; function f(d, h, p) { return h ? (p ? "" : " ".repeat(a)) + d : (p ? s : s + " ".repeat(a - s.length)) + d } i(f, "map") } i(uu, "listItem"); function cu(t, e, n, r) { let o = n.enter("paragraph"), s = n.enter("phrasing"), a = n.containerPhrasing(t, r); return s(), o(), a } i(cu, "paragraph"); var ts = yn(["break", "delete", "emphasis", "footnote", "footnoteReference", "image", "imageReference", "inlineCode", "inlineMath", "link", "linkReference", "mdxJsxTextElement", "mdxTextExpression", "strong", "text", "textDirective"]); function fu(t, e, n, r) { return (t.children.some(function (a) { return ts(a) }) ? n.containerPhrasing : n.containerFlow).call(n, t, r) } i(fu, "root"); function du(t) { let e = t.options.strong || "*"; if (e !== "*" && e !== "_") throw new Error("Cannot serialize strong with `" + e + "` for `options.strong`, expected `*`, or `_`"); return e } i(du, "checkStrong"); ns.peek = ug; function ns(t, e, n, r) { let o = du(n), s = n.enter("strong"), a = n.createTracker(r), l = a.move(o + o), u = a.move(n.containerPhrasing(t, {after: o, before: l, ...a.current()})), c = u.charCodeAt(0), f = kn(r.before.charCodeAt(r.before.length - 1), c, o); f.inside && (u = Me(c) + u.slice(1)); let d = u.charCodeAt(u.length - 1), h = kn(r.after.charCodeAt(0), d, o); h.inside && (u = u.slice(0, -1) + Me(d)); let p = a.move(o + o); return s(), n.attentionEncodeSurroundingInfo = {after: h.outside, before: f.outside}, l + u + p } i(ns, "strong"); function ug(t, e, n) { return n.options.strong || "*" } i(ug, "strongPeek"); function pu(t, e, n, r) { return n.safe(t.value, r) } i(pu, "text"); function hu(t) { let e = t.options.ruleRepetition || 3; if (e < 3) throw new Error("Cannot serialize rules with repetition `" + e + "` for `options.ruleRepetition`, expected `3` or more"); return e } i(hu, "checkRuleRepetition"); function mu(t, e, n) { let r = (ei(n) + (n.options.ruleSpaces ? " " : "")).repeat(hu(n)); return n.options.ruleSpaces ? r.slice(0, -1) : r } i(mu, "thematicBreak"); var gu = { blockquote: Jl, break: jo, code: Zl, definition: eu, emphasis: Ko, hardBreak: jo, heading: iu, html: qo, image: Jo, imageReference: Yo, inlineCode: Qo, link: Zo, linkReference: es, list: au, listItem: uu, paragraph: cu, root: fu, strong: ns, text: pu, thematicBreak: mu }; var wu = [cg]; function cg(t, e, n, r) { if (e.type === "code" && Kn(e, r) && (t.type === "list" || t.type === e.type && Kn(t, r))) return !1; if ("spread" in n && typeof n.spread == "boolean") return t.type === "paragraph" && (t.type === e.type || e.type === "definition" || e.type === "heading" && Zr(e, r)) ? void 0 : n.spread ? 1 : 0 } i(cg, "joinDefaults"); var _t = ["autolink", "destinationLiteral", "destinationRaw", "reference", "titleQuote", "titleApostrophe"], bu = [{character: " ", after: "[\\r\\n]", inConstruct: "phrasing"}, { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" }, {character: " ", inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde"]}, { character: "\r", inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde", "codeFencedMetaGraveAccent", "codeFencedMetaTilde", "destinationLiteral", "headingAtx"] }, { character: ` `, inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde", "codeFencedMetaGraveAccent", "codeFencedMetaTilde", "destinationLiteral", "headingAtx"] }, {character: " ", after: "[\\r\\n]", inConstruct: "phrasing"}, { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" }, {character: " ", inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde"]}, { character: "!", after: "\\[", inConstruct: "phrasing", notInConstruct: _t }, {character: '"', inConstruct: "titleQuote"}, {atBreak: !0, character: "#"}, { character: "#", inConstruct: "headingAtx", after: `(?:[\r ]|$)` }, {character: "&", after: "[#A-Za-z]", inConstruct: "phrasing"}, { character: "'", inConstruct: "titleApostrophe" }, {character: "(", inConstruct: "destinationRaw"}, { before: "\\]", character: "(", inConstruct: "phrasing", notInConstruct: _t }, {atBreak: !0, before: "\\d+", character: ")"}, {character: ")", inConstruct: "destinationRaw"}, { atBreak: !0, character: "*", after: `(?:[ \r *])` }, {character: "*", inConstruct: "phrasing", notInConstruct: _t}, { atBreak: !0, character: "+", after: `(?:[ \r ])` }, { atBreak: !0, character: "-", after: `(?:[ \r -])` }, { atBreak: !0, before: "\\d+", character: ".", after: `(?:[ \r ]|$)` }, {atBreak: !0, character: "<", after: "[!/?A-Za-z]"}, { character: "<", after: "[!/?A-Za-z]", inConstruct: "phrasing", notInConstruct: _t }, {character: "<", inConstruct: "destinationLiteral"}, {atBreak: !0, character: "="}, { atBreak: !0, character: ">" }, {character: ">", inConstruct: "destinationLiteral"}, {atBreak: !0, character: "["}, { character: "[", inConstruct: "phrasing", notInConstruct: _t }, {character: "[", inConstruct: ["label", "reference"]}, { character: "\\", after: "[\\r\\n]", inConstruct: "phrasing" }, {character: "]", inConstruct: ["label", "reference"]}, {atBreak: !0, character: "_"}, { character: "_", inConstruct: "phrasing", notInConstruct: _t }, {atBreak: !0, character: "`"}, { character: "`", inConstruct: ["codeFencedLangGraveAccent", "codeFencedMetaGraveAccent"] }, {character: "`", inConstruct: "phrasing", notInConstruct: _t}, {atBreak: !0, character: "~"}]; function ku(t) { return t.label || !t.identifier ? t.label || "" : qr(t.identifier) } i(ku, "association"); function yu(t) { if (!t._compiled) { let e = (t.atBreak ? "[\\r\\n][\\t ]*" : "") + (t.before ? "(?:" + t.before + ")" : ""); t._compiled = new RegExp((e ? "(" + e + ")" : "") + (/[|\\{}()[\]^$+*?.-]/.test(t.character) ? "\\" : "") + t.character + (t.after ? "(?:" + t.after + ")" : ""), "g") } return t._compiled } i(yu, "compilePattern"); function Cu(t, e, n) { let r = e.indexStack, o = t.children || [], s = [], a = -1, l = n.before, u; r.push(-1); let c = e.createTracker(n); for (; ++a < o.length;) { let f = o[a], d; if (r[r.length - 1] = a, a + 1 < o.length) { let w = e.handle.handlers[o[a + 1].type]; w && w.peek && (w = w.peek), d = w ? w(o[a + 1], t, e, { before: "", after: "", ...c.current() }).charAt(0) : "" } else d = n.after; s.length > 0 && (l === "\r" || l === ` `) && f.type === "html" && (s[s.length - 1] = s[s.length - 1].replace(/(\r?\n|\r)$/, " "), l = " ", c = e.createTracker(n), c.move(s.join(""))); let h = e.handle(f, t, e, {...c.current(), after: d, before: l}); u && u === h.slice(0, 1) && (h = Me(u.charCodeAt(0)) + h.slice(1)); let p = e.attentionEncodeSurroundingInfo; e.attentionEncodeSurroundingInfo = void 0, u = void 0, p && (s.length > 0 && p.before && l === s[s.length - 1].slice(-1) && (s[s.length - 1] = s[s.length - 1].slice(0, -1) + Me(l.charCodeAt(0))), p.after && (u = d)), c.move(h), s.push(h), l = h.slice(-1) } return r.pop(), s.join("") } i(Cu, "containerPhrasing"); function xu(t, e, n) { let r = e.indexStack, o = t.children || [], s = e.createTracker(n), a = [], l = -1; for (r.push(-1); ++l < o.length;) { let u = o[l]; r[r.length - 1] = l, a.push(s.move(e.handle(u, t, e, { before: ` `, after: ` `, ...s.current() }))), u.type !== "list" && (e.bulletLastUsed = void 0), l < o.length - 1 && a.push(s.move(fg(u, o[l + 1], t, e))) } return r.pop(), a.join("") } i(xu, "containerFlow"); function fg(t, e, n, r) { let o = r.join.length; for (; o--;) { let s = r.join[o](t, e, n, r); if (s === !0 || s === 1) break; if (typeof s == "number") return ` `.repeat(1 + s); if (s === !1) return ` ` } return ` ` } i(fg, "between"); var dg = /\r?\n|\r/g; function Au(t, e) { let n = [], r = 0, o = 0, s; for (; s = dg.exec(t);) a(t.slice(r, s.index)), n.push(s[0]), r = s.index + s[0].length, o++; return a(t.slice(r)), n.join(""); function a(l) { n.push(e(l, o, !l)) } i(a, "one") } i(Au, "indentLines"); function Su(t, e, n) { let r = (n.before || "") + (e || "") + (n.after || ""), o = [], s = [], a = {}, l = -1; for (; ++l < t.unsafe.length;) { let f = t.unsafe[l]; if (!Jr(t.stack, f)) continue; let d = t.compilePattern(f), h; for (; h = d.exec(r);) { let p = "before" in f || !!f.atBreak, w = "after" in f, y = h.index + (p ? h[1].length : 0); o.includes(y) ? (a[y].before && !p && (a[y].before = !1), a[y].after && !w && (a[y].after = !1)) : (o.push(y), a[y] = { before: p, after: w }) } } o.sort(pg); let u = n.before ? n.before.length : 0, c = r.length - (n.after ? n.after.length : 0); for (l = -1; ++l < o.length;) { let f = o[l]; f < u || f >= c || f + 1 < c && o[l + 1] === f + 1 && a[f].after && !a[f + 1].before && !a[f + 1].after || o[l - 1] === f - 1 && a[f].before && !a[f - 1].before && !a[f - 1].after || (u !== f && s.push(vu(r.slice(u, f), "\\")), u = f, /[!-/:-@[-`{-~]/.test(r.charAt(f)) && (!n.encode || !n.encode.includes(r.charAt(f))) ? s.push("\\") : (s.push(Me(r.charCodeAt(f))), u++)) } return s.push(vu(r.slice(u, c), n.after)), s.join("") } i(Su, "safe"); function pg(t, e) { return t - e } i(pg, "numerical"); function vu(t, e) { let n = /\\(?=[!-/:-@[-`{-~])/g, r = [], o = [], s = t + e, a = -1, l = 0, u; for (; u = n.exec(s);) r.push(u.index); for (; ++a < r.length;) l !== r[a] && o.push(t.slice(l, r[a])), o.push("\\"), l = r[a]; return o.push(t.slice(l)), o.join("") } i(vu, "escapeBackslashes"); function Eu(t) { let e = t || {}, n = e.now || {}, r = e.lineShift || 0, o = n.line || 1, s = n.column || 1; return {move: u, current: a, shift: l}; function a() { return {now: {line: o, column: s}, lineShift: r} } function l(c) { r += c } function u(c) { let f = c || "", d = f.split(/\r?\n|\r/g), h = d[d.length - 1]; return o += d.length - 1, s = d.length === 1 ? s + h.length : 1 + h.length + r, f } } i(Eu, "track"); function rs(t, e) { let n = e || {}, r = { associationId: ku, containerPhrasing: wg, containerFlow: bg, createTracker: Eu, compilePattern: yu, enter: s, handlers: {...gu}, handle: void 0, indentLines: Au, indexStack: [], join: [...wu], options: {}, safe: kg, stack: [], unsafe: [...bu] }; Ho(r, n), r.options.tightDefinitions && r.join.push(gg), r.handle = Gl("type", { invalid: hg, unknown: mg, handlers: r.handlers }); let o = r.handle(t, void 0, r, { before: ` `, after: ` `, now: {line: 1, column: 1}, lineShift: 0 }); return o && o.charCodeAt(o.length - 1) !== 10 && o.charCodeAt(o.length - 1) !== 13 && (o += ` `), o; function s(a) { return r.stack.push(a), l; function l() { r.stack.pop() } i(l, "exit") } i(s, "enter") } i(rs, "toMarkdown"); function hg(t) { throw new Error("Cannot handle value `" + t + "`, expected node") } i(hg, "invalid"); function mg(t) { let e = t; throw new Error("Cannot handle unknown node `" + e.type + "`") } i(mg, "unknown"); function gg(t, e) { if (t.type === "definition" && t.type === e.type) return 0 } i(gg, "joinDefinition"); function wg(t, e) { return Cu(t, this, e) } i(wg, "containerPhrasingBound"); function bg(t, e) { return xu(t, this, e) } i(bg, "containerFlowBound"); function kg(t, e) { return Su(this, t, e) } i(kg, "safeBound"); function ti(t) { let e = this; e.compiler = n; function n(r) { return rs(r, {...e.data("settings"), ...t, extensions: e.data("toMarkdownExtensions") || []}) } i(n, "compiler") } i(ti, "remarkStringify"); function is(t) { if (t) throw t } i(is, "bail"); var oi = qt(Nu(), 1); function qn(t) { if (typeof t != "object" || t === null) return !1; let e = Object.getPrototypeOf(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t) } i(qn, "isPlainObject"); function os() { let t = [], e = {run: n, use: r}; return e; function n(...o) { let s = -1, a = o.pop(); if (typeof a != "function") throw new TypeError("Expected function as last argument, not " + a); l(null, ...o); function l(u, ...c) { let f = t[++s], d = -1; if (u) { a(u); return } for (; ++d < o.length;) (c[d] === null || c[d] === void 0) && (c[d] = o[d]); o = c, f ? Du(f, l)(...c) : a(null, ...c) } i(l, "next") } function r(o) { if (typeof o != "function") throw new TypeError("Expected `middelware` to be a function, not " + o); return t.push(o), e } } i(os, "trough"); function Du(t, e) { let n; return r; function r(...a) { let l = t.length > a.length, u; l && a.push(o); try { u = t.apply(this, a) } catch (c) { let f = c; if (l && n) throw f; return o(f) } l || (u && u.then && typeof u.then == "function" ? u.then(s, o) : u instanceof Error ? o(u) : s(u)) } function o(a, ...l) { n || (n = !0, e(a, ...l)) } function s(a) { o(null, a) } } i(Du, "wrap"); var te = class extends Error { static { i(this, "VFileMessage") } constructor(e, n, r) { super(), typeof n == "string" && (r = n, n = void 0); let o = "", s = {}, a = !1; if (n && ("line" in n && "column" in n ? s = {place: n} : "start" in n && "end" in n ? s = {place: n} : "type" in n ? s = { ancestors: [n], place: n.position } : s = {...n}), typeof e == "string" ? o = e : !s.cause && e && (a = !0, o = e.message, s.cause = e), !s.ruleId && !s.source && typeof r == "string") { let u = r.indexOf(":"); u === -1 ? s.ruleId = r : (s.source = r.slice(0, u), s.ruleId = r.slice(u + 1)) } if (!s.place && s.ancestors && s.ancestors) { let u = s.ancestors[s.ancestors.length - 1]; u && (s.place = u.position) } let l = s.place && "start" in s.place ? s.place.start : s.place; this.ancestors = s.ancestors || void 0, this.cause = s.cause || void 0, this.column = l ? l.column : void 0, this.fatal = void 0, this.file = "", this.message = o, this.line = l ? l.line : void 0, this.name = yt(s.place) || "1:1", this.place = s.place || void 0, this.reason = this.message, this.ruleId = s.ruleId || void 0, this.source = s.source || void 0, this.stack = a && s.cause && typeof s.cause.stack == "string" ? s.cause.stack : "", this.actual = void 0, this.expected = void 0, this.note = void 0, this.url = void 0 } }; te.prototype.file = ""; te.prototype.name = ""; te.prototype.reason = ""; te.prototype.message = ""; te.prototype.stack = ""; te.prototype.column = void 0; te.prototype.line = void 0; te.prototype.ancestors = void 0; te.prototype.cause = void 0; te.prototype.fatal = void 0; te.prototype.place = void 0; te.prototype.ruleId = void 0; te.prototype.source = void 0; var Be = qt(require("node:path"), 1); var ss = qt(require("node:process"), 1); var as = require("node:url"); function ri(t) { return !!(t !== null && typeof t == "object" && "href" in t && t.href && "protocol" in t && t.protocol && t.auth === void 0) } i(ri, "isUrl"); var ls = ["history", "path", "basename", "stem", "extname", "dirname"], Jn = class { static { i(this, "VFile") } constructor(e) { let n; e ? ri(e) ? n = {path: e} : typeof e == "string" || yg(e) ? n = {value: e} : n = e : n = {}, this.cwd = "cwd" in n ? "" : ss.default.cwd(), this.data = {}, this.history = [], this.messages = [], this.value, this.map, this.result, this.stored; let r = -1; for (; ++r < ls.length;) { let s = ls[r]; s in n && n[s] !== void 0 && n[s] !== null && (this[s] = s === "history" ? [...n[s]] : n[s]) } let o; for (o in n) ls.includes(o) || (this[o] = n[o]) } get basename() { return typeof this.path == "string" ? Be.default.basename(this.path) : void 0 } set basename(e) { cs(e, "basename"), us(e, "basename"), this.path = Be.default.join(this.dirname || "", e) } get dirname() { return typeof this.path == "string" ? Be.default.dirname(this.path) : void 0 } set dirname(e) { Bu(this.basename, "dirname"), this.path = Be.default.join(e || "", this.basename) } get extname() { return typeof this.path == "string" ? Be.default.extname(this.path) : void 0 } set extname(e) { if (us(e, "extname"), Bu(this.dirname, "extname"), e) { if (e.codePointAt(0) !== 46) throw new Error("`extname` must start with `.`"); if (e.includes(".", 1)) throw new Error("`extname` cannot contain multiple dots") } this.path = Be.default.join(this.dirname, this.stem + (e || "")) } get path() { return this.history[this.history.length - 1] } set path(e) { ri(e) && (e = (0, as.fileURLToPath)(e)), cs(e, "path"), this.path !== e && this.history.push(e) } get stem() { return typeof this.path == "string" ? Be.default.basename(this.path, this.extname) : void 0 } set stem(e) { cs(e, "stem"), us(e, "stem"), this.path = Be.default.join(this.dirname || "", e + (this.extname || "")) } fail(e, n, r) { let o = this.message(e, n, r); throw o.fatal = !0, o } info(e, n, r) { let o = this.message(e, n, r); return o.fatal = void 0, o } message(e, n, r) { let o = new te(e, n, r); return this.path && (o.name = this.path + ":" + o.name, o.file = this.path), o.fatal = !1, this.messages.push(o), o } toString(e) { return this.value === void 0 ? "" : typeof this.value == "string" ? this.value : new TextDecoder(e || void 0).decode(this.value) } }; function us(t, e) { if (t && t.includes(Be.default.sep)) throw new Error("`" + e + "` cannot be a path: did not expect `" + Be.default.sep + "`") } i(us, "assertPart"); function cs(t, e) { if (!t) throw new Error("`" + e + "` cannot be empty") } i(cs, "assertNonEmpty"); function Bu(t, e) { if (!t) throw new Error("Setting `" + e + "` requires `path` to be set too") } i(Bu, "assertPath"); function yg(t) { return !!(t && typeof t == "object" && "byteLength" in t && "byteOffset" in t) } i(yg, "isUint8Array"); var _u = i((function (t) { let r = this.constructor.prototype, o = r[t], s = i(function () { return o.apply(s, arguments) }, "apply"); return Object.setPrototypeOf(s, r), s }), "CallableInstance"); var Cg = {}.hasOwnProperty, hs = class t extends _u { static { i(this, "Processor") } constructor() { super("copy"), this.Compiler = void 0, this.Parser = void 0, this.attachers = [], this.compiler = void 0, this.freezeIndex = -1, this.frozen = void 0, this.namespace = {}, this.parser = void 0, this.transformers = os() } copy() { let e = new t, n = -1; for (; ++n < this.attachers.length;) { let r = this.attachers[n]; e.use(...r) } return e.data((0, oi.default)(!0, {}, this.namespace)), e } data(e, n) { return typeof e == "string" ? arguments.length === 2 ? (ps("data", this.frozen), this.namespace[e] = n, this) : Cg.call(this.namespace, e) && this.namespace[e] || void 0 : e ? (ps("data", this.frozen), this.namespace = e, this) : this.namespace } freeze() { if (this.frozen) return this; let e = this; for (; ++this.freezeIndex < this.attachers.length;) { let [n, ...r] = this.attachers[this.freezeIndex]; if (r[0] === !1) continue; r[0] === !0 && (r[0] = void 0); let o = n.call(e, ...r); typeof o == "function" && this.transformers.use(o) } return this.frozen = !0, this.freezeIndex = Number.POSITIVE_INFINITY, this } parse(e) { this.freeze(); let n = ii(e), r = this.parser || this.Parser; return fs("parse", r), r(String(n), n) } process(e, n) { let r = this; return this.freeze(), fs("process", this.parser || this.Parser), ds("process", this.compiler || this.Compiler), n ? o(void 0, n) : new Promise(o); function o(s, a) { let l = ii(e), u = r.parse(l); r.run(u, l, function (f, d, h) { if (f || !d || !h) return c(f); let p = d, w = r.stringify(p, h); Ag(w) ? h.value = w : h.result = w, c(f, h) }); function c(f, d) { f || !d ? a(f) : s ? s(d) : n(void 0, d) } i(c, "realDone") } i(o, "executor") } processSync(e) { let n = !1, r; return this.freeze(), fs("processSync", this.parser || this.Parser), ds("processSync", this.compiler || this.Compiler), this.process(e, o), zu("processSync", "process", n), r; function o(s, a) { n = !0, is(s), r = a } i(o, "realDone") } run(e, n, r) { Vu(e), this.freeze(); let o = this.transformers; return !r && typeof n == "function" && (r = n, n = void 0), r ? s(void 0, r) : new Promise(s); function s(a, l) { let u = ii(n); o.run(e, u, c); function c(f, d, h) { let p = d || e; f ? l(f) : a ? a(p) : r(void 0, p, h) } i(c, "realDone") } i(s, "executor") } runSync(e, n) { let r = !1, o; return this.run(e, n, s), zu("runSync", "run", r), o; function s(a, l) { is(a), o = l, r = !0 } i(s, "realDone") } stringify(e, n) { this.freeze(); let r = ii(n), o = this.compiler || this.Compiler; return ds("stringify", o), Vu(e), o(e, r) } use(e, ...n) { let r = this.attachers, o = this.namespace; if (ps("use", this.frozen), e != null) if (typeof e == "function") u(e, n); else if (typeof e == "object") Array.isArray(e) ? l(e) : a(e); else throw new TypeError("Expected usable value, not `" + e + "`"); return this; function s(c) { if (typeof c == "function") u(c, []); else if (typeof c == "object") if (Array.isArray(c)) { let [f, ...d] = c; u(f, d) } else a(c); else throw new TypeError("Expected usable value, not `" + c + "`") } function a(c) { if (!("plugins" in c) && !("settings" in c)) throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither"); l(c.plugins), c.settings && (o.settings = (0, oi.default)(!0, o.settings, c.settings)) } function l(c) { let f = -1; if (c != null) if (Array.isArray(c)) for (; ++f < c.length;) { let d = c[f]; s(d) } else throw new TypeError("Expected a list of plugins, not `" + c + "`") } function u(c, f) { let d = -1, h = -1; for (; ++d < r.length;) if (r[d][0] === c) { h = d; break } if (h === -1) r.push([c, ...f]); else if (f.length > 0) { let [p, ...w] = f, y = r[h][1]; qn(y) && qn(p) && (p = (0, oi.default)(!0, y, p)), r[h] = [c, p, ...w] } } } }, ms = new hs().freeze(); function fs(t, e) { if (typeof e != "function") throw new TypeError("Cannot `" + t + "` without `parser`") } i(fs, "assertParser"); function ds(t, e) { if (typeof e != "function") throw new TypeError("Cannot `" + t + "` without `compiler`") } i(ds, "assertCompiler"); function ps(t, e) { if (e) throw new Error("Cannot call `" + t + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.") } i(ps, "assertUnfrozen"); function Vu(t) { if (!qn(t) || typeof t.type != "string") throw new TypeError("Expected node, got `" + t + "`") } i(Vu, "assertNode"); function zu(t, e, n) { if (!n) throw new Error("`" + t + "` finished async. Use `" + e + "` instead") } i(zu, "assertDone"); function ii(t) { return xg(t) ? t : new Jn(t) } i(ii, "vfile"); function xg(t) { return !!(t && typeof t == "object" && "message" in t && "messages" in t) } i(xg, "looksLikeAVFile"); function Ag(t) { return typeof t == "string" || vg(t) } i(Ag, "looksLikeAValue"); function vg(t) { return !!(t && typeof t == "object" && "byteLength" in t && "byteOffset" in t) } i(vg, "isUint8Array"); var $u = ms().use(wn).use(ti).freeze(); var ws = { d: i((t, e) => { for (var n in e) ws.o(e, n) && !ws.o(t, n) && Object.defineProperty(t, n, {enumerable: !0, get: e[n]}) }, "d"), o: i((t, e) => Object.prototype.hasOwnProperty.call(t, e), "o") }, bs = {}; ws.d(bs, {Z: i(() => Tg, "Z"), $: i(() => ju, "$")}); var xn = {horizontalTab: -2, virtualSpace: -1, nul: 0, eof: null, space: 32}; function Wu(t) { return t < xn.nul || t === xn.space } i(Wu, "n"); function gs(t) { return t < xn.horizontalTab } i(gs, "i"); var Sg = { 553: t => { t.exports = function (e) { var n, r; return e._compiled || (n = e.before ? "(?:" + e.before + ")" : "", r = e.after ? "(?:" + e.after + ")" : "", e.atBreak && (n = "[\\r\\n][\\t ]*" + n), e._compiled = new RegExp((n ? "(" + n + ")" : "") + (/[|\\{}()[\]^$+*?.-]/.test(e.character) ? "\\" : "") + e.character + (r || ""), "g")), e._compiled } }, 112: t => { function e(n, r, o) { var s; if (!r) return o; for (typeof r == "string" && (r = [r]), s = -1; ++s < r.length;) if (n.indexOf(r[s]) !== -1) return !0; return !1 } i(e, "t"), t.exports = function (n, r) { return e(n, r.inConstruct, !0) && !e(n, r.notInConstruct) } }, 113: (t, e, n) => { t.exports = function (l, u, c) { for (var f, d, h, p, w, y, b, k, x = (c.before || "") + (u || "") + (c.after || ""), v = [], P = [], L = {}, C = -1; ++C < l.unsafe.length;) if (p = l.unsafe[C], o(l.stack, p)) for (w = r(p); y = w.exec(x);) f = "before" in p || p.atBreak, d = "after" in p, h = y.index + (f ? y[1].length : 0), v.indexOf(h) === -1 ? (v.push(h), L[h] = { before: f, after: d }) : (L[h].before && !f && (L[h].before = !1), L[h].after && !d && (L[h].after = !1)); for (v.sort(s), b = c.before ? c.before.length : 0, k = x.length - (c.after ? c.after.length : 0), C = -1; ++C < v.length;) (h = v[C]) < b || h >= k || h + 1 < k && v[C + 1] === h + 1 && L[h].after && !L[h + 1].before && !L[h + 1].after || (b !== h && P.push(a(x.slice(b, h), "\\")), b = h, !/[!-/:-@[-`{-~]/.test(x.charAt(h)) || c.encode && c.encode.indexOf(x.charAt(h)) !== -1 ? (P.push("&#x" + x.charCodeAt(h).toString(16).toUpperCase() + ";"), b++) : P.push("\\")); return P.push(a(x.slice(b, k), c.after)), P.join("") }; var r = n(553), o = n(112); function s(l, u) { return l - u } i(s, "a"); function a(l, u) { for (var c, f = /\\(?=[!-/:-@[-`{-~])/g, d = [], h = [], p = -1, w = 0, y = l + u; c = f.exec(y);) d.push(c.index); for (; ++p < d.length;) w !== d[p] && h.push(l.slice(w, d[p])), h.push("\\"), w = d[p]; return h.push(l.slice(w)), h.join("") } i(a, "o") } }, Uu = {}; function et(t) { var e = Uu[t]; if (e !== void 0) return e.exports; var n = Uu[t] = {exports: {}}; return Sg[t](n, n.exports, et), n.exports } i(et, "s"); et.n = t => { var e = t && t.__esModule ? () => t.default : () => t; return et.d(e, {a: e}), e }, et.d = (t, e) => { for (var n in e) et.o(e, n) && !et.o(t, n) && Object.defineProperty(t, n, {enumerable: !0, get: e[n]}) }, et.o = (t, e) => Object.prototype.hasOwnProperty.call(t, e); var ks = {}; (() => { function t(o = {}) { let s = o.permalinks || [], a = o.pageResolver || (h => [h.replace(/ /g, "_").toLowerCase()]), l = o.newClassName || "new", u = o.wikiLinkClassName || "internal", c = o.hrefTemplate || (h => `#/page/${h}`), f; function d(h) { return h[h.length - 1] } return i(d, "s"), { enter: { wikiLink: i(function (h) { f = { type: "wikiLink", value: null, data: {alias: null, permalink: null, exists: null} }, this.enter(f, h) }, "wikiLink") }, exit: { wikiLinkTarget: i(function (h) { let p = this.sliceSerialize(h); d(this.stack).value = p }, "wikiLinkTarget"), wikiLinkAlias: i(function (h) { let p = this.sliceSerialize(h); d(this.stack).data.alias = p }, "wikiLinkAlias"), wikiLink: i(function (h) { this.exit(h); let p = f, w = a(p.value), y = w.find((P => s.indexOf(P) !== -1)), b = y !== void 0, k; k = b ? y : w[0] || ""; let x = p.value; p.data.alias && (x = p.data.alias); let v = u; b || (v += " " + l), p.data.alias = x, p.data.permalink = k, p.data.exists = b, p.data.hName = "a", p.data.hProperties = { className: v, href: c(k) }, p.data.hChildren = [{type: "text", value: x}] }, "wikiLink") } } } i(t, "e"), et.d(ks, {V: i(() => t, "V"), x: i(() => r, "x")}); var e = et(113), n = et.n(e); function r(o = {}) { let s = o.aliasDivider || ":"; return { unsafe: [{character: "[", inConstruct: ["phrasing", "label", "reference"]}, { character: "]", inConstruct: ["label", "reference"] }], handlers: { wikiLink: i(function (a, l, u) { let c = u.enter("wikiLink"), f = n()(u, a.value, {before: "[", after: "]"}), d = n()(u, a.data.alias, {before: "[", after: "]"}), h; return h = d !== f ? `[[${f}${s}${d}]]` : `[[${f}]]`, c(), h }, "wikiLink") } } } i(r, "n") })(); var Eg = ks.V, Pg = ks.x, Hu = !1; function ju(t = {}) { let e = this.data(); function n(r, o) { e[r] ? e[r].push(o) : e[r] = [o] } i(n, "a"), !Hu && (this.Parser && this.Parser.prototype && this.Parser.prototype.blockTokenizers || this.Compiler && this.Compiler.prototype && this.Compiler.prototype.visitors) && (Hu = !0, console.warn("[remark-wiki-link] Warning: please upgrade to remark 13 to use this plugin")), n("micromarkExtensions", (function () { var r = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}).aliasDivider || ":", o = "]]"; return { text: { 91: { tokenize: i(function (s, a, l) { var u, c, f = 0, d = 0, h = 0; return function (x) { return x !== "[[".charCodeAt(d) ? l(x) : (s.enter("wikiLink"), s.enter("wikiLinkMarker"), p(x)) }; function p(x) { return d === 2 ? (s.exit("wikiLinkMarker"), (function (v) { return gs(v) || v === xn.eof ? l(v) : (s.enter("wikiLinkData"), s.enter("wikiLinkTarget"), w(v)) })(x)) : x !== "[[".charCodeAt(d) ? l(x) : (s.consume(x), d++, p) } function w(x) { return x === r.charCodeAt(f) ? u ? (s.exit("wikiLinkTarget"), s.enter("wikiLinkAliasMarker"), y(x)) : l(x) : x === o.charCodeAt(h) ? u ? (s.exit("wikiLinkTarget"), s.exit("wikiLinkData"), s.enter("wikiLinkMarker"), k(x)) : l(x) : gs(x) || x === xn.eof ? l(x) : (Wu(x) || (u = !0), s.consume(x), w) } function y(x) { return f === r.length ? (s.exit("wikiLinkAliasMarker"), s.enter("wikiLinkAlias"), b(x)) : x !== r.charCodeAt(f) ? l(x) : (s.consume(x), f++, y) } function b(x) { return x === o.charCodeAt(h) ? c ? (s.exit("wikiLinkAlias"), s.exit("wikiLinkData"), s.enter("wikiLinkMarker"), k(x)) : l(x) : gs(x) || x === xn.eof ? l(x) : (Wu(x) || (c = !0), s.consume(x), b) } function k(x) { return h === 2 ? (s.exit("wikiLinkMarker"), s.exit("wikiLink"), a(x)) : x !== o.charCodeAt(h) ? l(x) : (s.consume(x), h++, k) } }, "tokenize") } } } })(t)), n("fromMarkdownExtensions", Eg(t)), n("toMarkdownExtensions", Pg(t)) } i(ju, "k"); var Tg = ju, nP = bs.Z, Ku = bs.$; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Fg = /^[A-Za-z][A-Za-z0-9+\-.]*:\S+$/; function ys(t) { if (/\s/.test(t)) return !1; if (t.includes("://")) try { return new URL(t), !0 } catch { return !1 } return Fg.test(t) } i(ys, "isUrl"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function Se(t) { if (!Te(t)) return !1; let e = t; return e.startOffset !== void 0 && e.endOffset !== void 0 } i(Se, "isFrontmatterLinkCacheWithOffsets"); function si(t) { return Se(t) ? t : {...t, endOffset: t.original.length, startOffset: 0} } i(si, "toFrontmatterLinkCacheWithOffsets"); var Vt = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function ai(t) { let e = (0, Vt.getFrontMatterInfo)(t); return (0, Vt.parseYaml)(e.frontmatter) ?? {} } i(ai, "parseFrontmatter"); function Gu(t, e) { let n = (0, Vt.getFrontMatterInfo)(t); if (Object.keys(e).length === 0) return t.slice(n.contentStart); let r = (0, Vt.stringifyYaml)(e); return n.exists ? Na(t, r, n.from, n.to) : `--- ${r}--- ${t}` } i(Gu, "setFrontmatter"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function qu(t) { return Cs(t) && t.type === "file" } i(qu, "isCanvasFileNodeReference"); function Cs(t) { return Te(t) && !!t.isCanvas } i(Cs, "isCanvasReference"); function li(t, e) { return Se(t) ? { newContent: e, oldContent: t.original.slice(t.startOffset, t.endOffset), reference: t } : {newContent: e, oldContent: t.original, reference: t} } i(li, "referenceToFileChange"); function Ju(t) { return t.sort((e, n) => { if (Te(e) && Te(n)) { let r = Se(e) ? e.startOffset : 0, o = Se(n) ? n.startOffset : 0; return e.key.localeCompare(n.key) || Number(Se(n)) - Number(Se(e)) || r - o } return ot(e) && ot(n) ? e.position.start.offset - n.position.start.offset : Te(e) ? 1 : -1 }) } i(Ju, "sortReferences"); var Qn = require("obsidian"); var Xu = require("obsidian"); var Qu = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var ui = { obsidianDevUtils: { asyncWithNotice: { milliseconds: "milliseconds...", operation: "Operation", runningFor: "Running for", terminateOperation: "You can terminate the operation by clicking the button below, but be aware it might leave the vault in an inconsistent state.", timedOut: "The operation timed out after {{duration, number}} milliseconds." }, buttons: {cancel: "Cancel", ok: "OK"}, callout: {loadContent: "Load content for callout"}, dataview: { itemsPerPage: "Items per page:", jumpToPage: "Jump to page:", pageHeader: "Page {{pageNumber, number}} of {{totalPages, number}}, Total items: {{totalItems, number}}" }, metadataCache: {getBacklinksForFilePath: "Get backlinks for {{filePath}}"}, notices: { attachmentIsStillUsed: "Attachment {{attachmentPath}} is still used by other notes. It will not be deleted.", unhandledError: "An unhandled error occurred. Please check the console for more information." }, queue: {flushQueue: "Flush queue"}, renameDeleteHandler: { handleDelete: "Handle delete: {{filePath}}", handleOrphanedRenames: "Handle orphaned renames", handleRename: "Handle rename: {{oldPath}} -> {{newPath}}", updatedLinks: "Updated {{linksCount, number}} links in {{filesCount, number}} files." }, vault: {processFile: "Process file {{filePath}}"} } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var xs = "en", Lg = {en: ui}, ci = Lg; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Yu = "translation", As = !1; async function vs(t, e = !0) { As || (As = !0, await ol({ fallbackLng: xs, initAsync: e, interpolation: {escapeValue: !1}, lng: (0, Qu.getLanguage)(), resources: Object.fromEntries(Object.entries(t).map(([n, r]) => [n, {[Yu]: r}])), returnEmptyString: !1, returnNull: !1 }), fe.addResourceBundle(xs, Yu, ui, !0, !1)) } i(vs, "initI18N"); function Ig(t, e) { return As || (console.warn("I18N was not initialized, initializing default obsidian-dev-utils translations"), ae(() => vs(ci, !1))), e ? mt(t, e) : mt(t) } i(Ig, "tImpl"); var pe = Ig; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); async function fi(t) { return za({...t, onTimeout: t.shouldShowTimeoutNotice ? ec : tc}) } i(fi, "retryWithTimeoutNotice"); async function Zu(t) { return co({...t, onTimeout: t.shouldShowTimeoutNotice ? ec : tc}) } i(Zu, "runWithTimeoutNotice"); function ec(t) { let e = Math.trunc(performance.now() - t.duration), n, r = 1e3, o = {intervalId: 0}, s = new Xu.Notice(createFragment(l => { t.operationName && (l.appendText(pe(c => c.obsidianDevUtils.asyncWithNotice.operation)), l.appendText(": "), l.appendText(t.operationName), l.createEl("br")), l.appendText(pe(c => c.obsidianDevUtils.asyncWithNotice.timedOut, {duration: t.duration})), l.createEl("br"), l.appendText(pe(c => c.obsidianDevUtils.asyncWithNotice.runningFor)), l.appendText(" "), n = l.createSpan(), l.appendText(" "), l.appendText(pe(c => c.obsidianDevUtils.asyncWithNotice.milliseconds)), l.createEl("br"), l.appendText(pe(c => c.obsidianDevUtils.asyncWithNotice.terminateOperation)), l.createEl("br"), l.createEl("button", {text: pe(c => c.obsidianDevUtils.buttons.cancel)}).addEventListener("click", () => { t.terminateOperation(), window.clearInterval(o.intervalId), s.hide() }) })); a(), o.intervalId = window.setInterval(a, r), t.onOperationCompleted(() => { window.clearInterval(o.intervalId), s.hide() }); function a() { let l = Math.max(t.duration, Math.round((performance.now() - e) / r) * r); n.textContent = String(l) } i(a, "updateRunningTime") } i(ec, "onTimeoutNotice"); function tc(t) { let e = Math.trunc(performance.now() - t.duration); t.onOperationCompleted(() => { en("AsyncWithNotice:onTimeoutWithoutNotice")("Operation completed after timeout", { operationName: t.operationName, totalDuration: Math.trunc(performance.now() - e) }) }) } i(tc, "onTimeoutWithoutNotice"); var Yn = require("@codemirror/state"), Ss = require("@codemirror/view"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var nc = new WeakMap; function Es(t) { let e = ic(t); t.cm.dispatch({effects: e.reconfigure([Yn.EditorState.readOnly.of(!0), Ss.EditorView.editable.of(!1)])}) } i(Es, "lockEditor"); function rc(t) { let e = ic(t); t.cm.dispatch({effects: e.reconfigure([Yn.EditorState.readOnly.of(!1), Ss.EditorView.editable.of(!0)])}) } i(rc, "unlockEditor"); function ic(t) { let e = nc.get(t); return e || (e = new Yn.Compartment, nc.set(t, e)), e } i(ic, "ensureCompartment"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); async function Mg(t, e) { if (await t.vault.adapter.exists(e)) return !1; try { return await t.vault.createFolder(e), !0 } catch (n) { if (!await t.vault.exists(e)) throw n; return !0 } } i(Mg, "createFolderSafe"); async function Ps(t, e) { let n = Xe(t, e); n && await di(t, n) && await zt(t, n) } i(Ps, "deleteEmptyFolder"); async function oc(t, e) { let n = Xe(t, e); for (; n;) { if (!await di(t, n)) return; let r = n.parent; await Ps(t, n), n = r } } i(oc, "deleteEmptyFolderHierarchy"); function Rg(t, e) { let n = Ue(e); return t.vault.getAvailablePath(Ae(Z(e), xe(e, n)), n.slice(1)) } i(Rg, "getAvailablePath"); function sc(t) { return t.vault.getMarkdownFiles().sort((e, n) => e.path.localeCompare(n.path)) } i(sc, "getMarkdownFilesSorted"); function Ts(t, e, n) { let r = J(t, e); if (Jt(t).insensitive) { let o = Z(n), s = xe(n), a; for (; a = Xe(t, o, !0), !a;) s = Ae(xe(o), s), o = Z(o); n = Ae(a.getParentPrefix(), s) } return r.toLowerCase() === n.toLowerCase() ? n : Rg(t, n) } i(Ts, "getSafeRenamePath"); async function di(t, e) { let n = await Fs(t, J(t, e)); return n.files.length === 0 && n.folders.length === 0 } i(di, "isEmptyFolder"); async function Fs(t, e) { let n = J(t, e), r = {files: [], folders: []}; if ((await t.vault.adapter.stat(n))?.type !== "folder") return r; try { return await t.vault.adapter.list(n) } catch (o) { if (await t.vault.exists(n)) throw o; return r } } i(Fs, "listSafe"); async function ac(t, e, n, r = {}) { let s = { ...{ shouldFailOnMissingFile: !0, shouldLockEditorWhileProcessing: !0, shouldShowTimeoutNotice: !0, timeoutInMilliseconds: 500 }, ...r }, a = new AbortController; s.abortSignal = Ft(s.abortSignal, a.signal); let l = J(t, e), u = null; if (s.shouldLockEditorWhileProcessing) { for (let c of t.workspace.getLeavesOfType(Tt.Markdown)) c.view instanceof Qn.MarkdownView && c.view.file?.path === l && Es(c.view.editor); u = t.workspace.on("active-leaf-change", c => { c?.view instanceof Qn.MarkdownView && c.view.file?.path === l && Es(c.view.editor) }) } try { await fi({ async operationFn(c) { c.throwIfAborted(); let f = await Ls(t, e); if (c.throwIfAborted(), f === null) return w(); let d = await tn(n, {abortSignal: c, content: f}); if (c.throwIfAborted(), d === null) return !1; let h = !0; if (!await uc(t, e, async y => { c.throwIfAborted(), await t.vault.process(y, b => (c.throwIfAborted(), b !== f ? (K("Vault:process")("Content has changed since it was read. Retrying...", { actualContent: b, expectedContent: f, path: y.path }), h = !1, b) : d)), c.throwIfAborted() })) return w(); return h; function w() { if (s.shouldFailOnMissingFile) throw new Error(`File '${l}' not found`); return !0 } }, operationName: pe(c => c.obsidianDevUtils.vault.processFile, {filePath: l}), retryOptions: s, shouldShowTimeoutNotice: s.shouldShowTimeoutNotice }) } finally { u?.e.offref(u); for (let c of t.workspace.getLeavesOfType(Tt.Markdown)) c.view instanceof Qn.MarkdownView && c.view.file?.path === l && rc(c.view.editor) } } i(ac, "process"); async function Ls(t, e) { let n = null; return await uc(t, e, async r => { await pi(t, r), n = await t.vault.read(r) }), n } i(Ls, "readSafe"); async function lc(t, e, n) { let r = dl(t, e), o = Ts(t, e, n); if (r.path.toLowerCase() === o.toLowerCase()) return r.path !== n && await t.fileManager.renameFile(r, o), o; let s = je(o); await Mg(t, s); try { await t.fileManager.renameFile(r, o) } catch (a) { if (!await t.vault.exists(o) || await t.vault.exists(r.path)) throw a } return o } i(lc, "renameSafe"); async function pi(t, e) { if (!Ze(t, e)) return; let n = J(t, e); for (let r of t.workspace.getLeavesOfType(Tt.Markdown)) r.view instanceof Qn.MarkdownView && r.view.file?.path === n && r.view.dirty && await r.view.save() } i(pi, "saveNote"); async function zt(t, e) { let n = gt(t, e); if (n) try { await t.fileManager.trashFile(n) } catch (r) { if (await t.vault.exists(n.path)) throw r; K("Vault:trashSafe")(`An error occurred while trashing ${n.path}, but the file no longer exists.`, { error: r, path: n.path }) } } i(zt, "trashSafe"); async function uc(t, e, n) { let r = J(t, e), o = ve(t, r); if (!o || o.deleted) return !1; try { return await n(o), !0 } catch (s) { if (o = ve(t, r), !o || o.deleted) return !1; throw s } } i(uc, "invokeFileActionSafe"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); async function gi(t, e, n, r, o = !0) { t.throwIfAborted(); let s = await tn(r, {abortSignal: t, content: e}); if (t.throwIfAborted(), s === null) return null; let {frontmatter: a, hasFrontmatterError: l} = $g(e, n); if (!Hg(s, e, a, n)) return o ? null : e; s = Ug(s); let {frontmatterChanged: u, newContent: c} = _g(s, e, l, n); return await Vg(t, a, u, n), t.throwIfAborted(), zg(c, a, u) } i(gi, "applyContentChanges"); async function cc(t, e, n, r = {}, o = !0) { await ac(t, e, async ({ abortSignal: s, content: a }) => Mt(t, e) ? await Bg(s, a, J(t, e), n, o) : await gi(s, a, J(t, e), n, o), r) } i(cc, "applyFileChanges"); function Xn(t) { return Cs(t.reference) } i(Xn, "isCanvasChange"); function Og(t) { return Xn(t) && t.reference.type === "file" } i(Og, "isCanvasFileNodeChange"); function Ng(t) { return Xn(t) && t.reference.type === "text" } i(Ng, "isCanvasTextNodeChange"); function $t(t) { return ot(t.reference) } i($t, "isContentChange"); function hi(t) { return Te(t.reference) } i(hi, "isFrontmatterChange"); function mi(t) { return Se(t.reference) } i(mi, "isFrontmatterChangeWithOffsets"); function Dg(t) { return mi(t) ? t : {...t, reference: si(t.reference)} } i(Dg, "toFrontmatterChangeWithOffsets"); async function Bg(t, e, n, r, o = !0) { let s = await tn(r, {abortSignal: t, content: e}); if (t.throwIfAborted(), s === null) return null; let a = Wg(e), l = new Map; for (let u of s) { if (!Xn(u)) { console.error("Only canvas changes are supported for canvas files", {change: u, path: n}); continue } let c = a.nodes[u.reference.nodeIndex]; if (!c) return console.error("Node not found", {nodeIndex: u.reference.nodeIndex, path: n}), null; if (Og(u)) { if (c.file !== u.oldContent) return K("FileChange:applyCanvasChanges")("Content mismatch", { actualContent: c.file, expectedContent: u.oldContent, nodeIndex: u.reference.nodeIndex, path: n, type: "file" }), null; c.file = u.newContent } else if (Ng(u)) { let f = l.get(u.reference.nodeIndex); f || (f = [], l.set(u.reference.nodeIndex, f)), f.push(u) } } for (let [u, c] of l.entries()) { let f = a.nodes[u]; if (!f) return console.error("Node not found", {nodeIndex: u, path: n}), null; if (typeof f.text != "string") return console.error("Node text is not a string", {nodeIndex: u, path: n}), null; let d = c.map(h => li(h.reference.originalReference, h.newContent)); f.text = await gi(t, f.text, `${n}.node${String(u)}.VIRTUAL_FILE.md`, d, o) } return JSON.stringify(a, null, " ") } i(Bg, "applyCanvasChanges"); function _g(t, e, n, r) { let o = "", s = 0, a = { newContent: "", oldContent: "", reference: { link: "", original: "", position: {end: {col: 0, line: 0, offset: 0}, start: {col: 0, line: 0, offset: 0}} } }, l = new Map; for (let u of t) if ($t(u)) if (s <= u.reference.position.start.offset) o += e.slice(s, u.reference.position.start.offset), o += u.newContent, s = u.reference.position.end.offset, a = u; else { let c = u.reference.position.start.offset - a.reference.position.start.offset, f = u.reference.position.end.offset - a.reference.position.start.offset; if (a.newContent.slice(c, f) !== u.oldContent) { let h = "Overlapping changes"; throw console.error(h, {change: u, lastContentChange: a}), new Error(h) } o = o.slice(0, o.length - a.newContent.length) + a.newContent.slice(0, c) + u.newContent + a.newContent.slice(f) } else if (hi(u)) if (n) console.error(`Cannot apply frontmatter change in ${r}, because frontmatter parsing failed`, {change: u}); else { let c = l.get(u.reference.key); c || (c = [], l.set(u.reference.key, c)), c.push(Dg(u)) } return o += e.slice(s), {frontmatterChanged: l, newContent: o} } i(_g, "applyContentChangesToText"); async function Vg(t, e, n, r) { for (let [o, s] of n.entries()) { let a = ht(e, o); if (typeof a != "string") return; let l = s.map(c => ({ newContent: c.newContent, oldContent: c.oldContent, reference: { link: "", original: "", position: { end: {col: c.reference.endOffset, line: 0, offset: c.reference.endOffset}, start: {col: c.reference.startOffset, line: 0, offset: c.reference.startOffset} } } })), u = await gi(t, a, `${r}.frontmatter.${o}.VIRTUAL_FILE.md`, l); if (u === null) return; _a(e, o, u) } } i(Vg, "applyFrontmatterChangesWithOffsets"); function zg(t, e, n) { return n.size > 0 ? Gu(t, e) : t } i(zg, "buildFinalContent"); function $g(t, e) { let n = {}, r = !1; try { n = ai(t) } catch (o) { pt(new Error(`Frontmatter parsing failed in ${e}`, {cause: o})), r = !0 } return {frontmatter: n, hasFrontmatterError: r} } i($g, "parseFrontmatterSafely"); function Wg(t) { let e; try { e = JSON.parse(t) } catch { e = null } return (e === null || typeof e != "object") && (e = {}), e } i(Wg, "parseJsonSafe"); function Ug(t) { return t.sort((e, n) => $t(e) && $t(n) ? e.reference.position.start.offset - n.reference.position.start.offset : mi(e) && mi(n) ? e.reference.key.localeCompare(n.reference.key) || e.reference.startOffset - n.reference.startOffset : hi(e) && hi(n) ? e.reference.key.localeCompare(n.reference.key) : $t(e) ? -1 : 1), t.filter((e, n) => e.oldContent === e.newContent ? !1 : n === 0 ? !0 : !De(e, t[n - 1])) } i(Ug, "sortAndFilterChanges"); function Hg(t, e, n, r) { let o = K("FileChange:validateChanges"); for (let s of t) if ($t(s)) { let a = s.reference.position.start.offset, l = s.reference.position.end.offset, u = e.slice(a, l); if (u !== s.oldContent) return o("Content mismatch", { actualContent: u, endOffset: l, expectedContent: s.oldContent, path: r, startOffset: a }), !1 } else if (mi(s)) { let a = ht(n, s.reference.key); if (typeof a != "string") return o("Property value is not a string", { frontmatterKey: s.reference.key, path: r, propertyValue: a }), !1; let l = a.slice(s.reference.startOffset, s.reference.endOffset); if (l !== s.oldContent) return o("Content mismatch", { actualContent: l, expectedContent: s.oldContent, frontmatterKey: s.reference.key, path: r, startOffset: s.reference.startOffset }), !1 } else if (hi(s)) { let a = ht(n, s.reference.key); if (a !== s.oldContent) return o("Content mismatch", { actualContent: a, expectedContent: s.oldContent, frontmatterKey: s.reference.key, path: r }), !1 } return !0 } i(Hg, "validateChanges"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); async function fc(t) { await new Promise(e => { t.metadataCache.onCleanCache(e) }) } i(fc, "ensureMetadataCacheReady"); function Wt(t) { let e = []; return t.links && e.push(...t.links), t.embeds && e.push(...t.embeds), t.frontmatterLinks && e.push(...t.frontmatterLinks), Ju(e), e = e.filter((n, r) => { if (r === 0) return !0; let o = z(e[r - 1]); if (ot(n) && ot(o)) return n.position.start.offset !== o.position.start.offset; if (Te(n) && Te(o)) { let s = Se(n) ? n.startOffset : 0, a = Se(o) ? o.startOffset : 0; return n.key !== o.key || Se(n) !== Se(o) || s !== a } return !0 }), e } i(Wt, "getAllLinks"); function Is(t, e) { let n = ee(t, e, !0); return er(t, [n], () => t.metadataCache.getBacklinksForFile(n)) } i(Is, "getBacklinksForFileOrPath"); async function Ut(t, e, n = {}) { let r = t.metadataCache.getBacklinksForFile.safe; if (r) return r(e); let o = new oa; return await fi({ async operationFn(s) { s.throwIfAborted(); let a = ee(t, e); await fc(t), s.throwIfAborted(), o = Is(t, a); for (let l of o.keys()) { s.throwIfAborted(); let u = ve(t, l); if (!u) return !1; await pi(t, u), s.throwIfAborted(); let c = await Ls(t, u); if (s.throwIfAborted(), !c) return !1; let f = ai(c), d = o.get(l); if (!d) return !1; for (let h of d) { let p; if (ot(h)) p = c.slice(h.position.start.offset, h.position.end.offset); else if (Te(h)) { let w = ht(f, h.key); if (typeof w != "string") return !1; let y = si(h); p = w.slice(y.startOffset, y.endOffset) } else return !0; if (p !== h.original) return !1 } } return !0 }, operationName: pe(s => s.obsidianDevUtils.metadataCache.getBacklinksForFilePath, {filePath: J(t, e)}), retryOptions: n, shouldShowTimeoutNotice: n.shouldShowTimeoutNotice ?? !0 }), o } i(Ut, "getBacklinksForFileSafe"); async function Zn(t, e) { let n = ve(t, e); try { if (!n) return null; if (n.deleted) return t.metadataCache.getFileCache(n); await pi(t, n); let r = t.metadataCache.fileCache[n.path]; return r?.mtime === n.stat.mtime && r.size === n.stat.size && t.metadataCache.metadataCache[r.hash] || (await t.metadataCache.computeFileMetadataAsync(n), await fc(t)), t.metadataCache.getFileCache(n) } catch (r) { if (!n || n.deleted) return null; throw r } } i(Zn, "getCacheSafe"); function dc(t, e, n) { let r = ee(t, e, !0); if (!r.deleted) throw new Error("File is existing"); t.metadataCache.fileCache[r.path] = {hash: r.path, mtime: 0, size: 0}, t.metadataCache.metadataCache[r.path] = n } i(dc, "registerFileCacheForNonExistingFile"); function pc(t, e) { let n = wc(t); for (let r of e) for (; r.deleted;) { let o = n.get(r.path) ?? 0; o++, n.set(r.path, o), t.vault.fileMap[r.path] = r, Le(r) && t.metadataCache.uniqueFileLookup.add(r.name.toLowerCase(), r), r = fn(t, je(r.path), !0) } } i(pc, "registerFiles"); function er(t, e, n) { try { return pc(t, e), n() } finally { gc(t, e) } } i(er, "tempRegisterFilesAndRun"); async function hc(t, e, n) { try { return pc(t, e), await n() } finally { gc(t, e) } } i(hc, "tempRegisterFilesAndRunAsync"); function mc(t, e) { let n = ee(t, e, !0); if (!n.deleted) throw new Error("File is existing"); delete t.metadataCache.fileCache[n.path], delete t.metadataCache.metadataCache[n.path] } i(mc, "unregisterFileCacheForNonExistingFile"); function gc(t, e) { let n = wc(t); for (let r of e) for (; r.deleted;) { let o = n.get(r.path) ?? 1; o--, n.set(r.path, o), o === 0 && (n.delete(r.path), delete t.vault.fileMap[r.path], Le(r) && t.metadataCache.uniqueFileLookup.remove(r.name.toLowerCase(), r)), r = fn(t, je(r.path), !0) } } i(gc, "unregisterFiles"); function wc(t) { return se(t, "registeredFilesCounts", new Map).value } i(wc, "getRegisteredFilesCounts"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function bc(t) { return t.vault.getConfig("newLinkFormat") } i(bc, "getNewLinkFormat"); function Ms(t) { return !t.vault.getConfig("useMarkdownLinks") } i(Ms, "shouldUseWikilinks"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var jg = "\\|", Kg = /[\\\x00\x08\x0B\x0C\x0E-\x1F ]/g, Gg = /[\\[\]<>_*~=`$]/g, yc = /(? { let a = await Zn(t, e); o.throwIfAborted(); let l = ee(t, e), u = await t.vault.cachedRead(l); return o.throwIfAborted(), s !== u ? null : await uw(a, Mt(t, e), n, o) }, r) } i(Os, "editLinks"); function Ns(t) { return ce(t, Kg, ({substring: e}) => encodeURIComponent(e)) } i(Ns, "encodeUrl"); function Jg(t) { return ce(t, Gg, "\\$&") } i(Jg, "escapeAlias"); function tr(t, e, n, r = !1) { let {linkPath: o} = vn(e.link), s = J(t, n), a = t.metadataCache.getFirstLinkpathDest(o, s); if (a) return a; if (!r) return null; if (o.startsWith("/")) return ee(t, o, !0); let l = Ae(Z(s), `./${o}`); return l.startsWith("../") ? null : ee(t, l, !0) } i(tr, "extractLinkFile"); function Yg(t) { let {app: e} = t, n = {isEmptyEmbedAliasAllowed: !0}, r = fw(e).map(s => s()); t = Object.assign({}, n, ...r, t); let o = ee(e, t.targetPathOrFile, t.isNonExistingFileAllowed); return er(e, [o], () => sw(t)) } i(Yg, "generateMarkdownLink"); function Rs(t) { let e = t.isEmbed ? "!" : ""; if (t.isWikilink) { let l = t.alias ? `|${t.alias}` : ""; return `${e}[[${t.url}${l}]]` } let n = t.alias ?? "", o = t.shouldEscapeAlias ?? !1 ? Jg(n) : n, s = t.shouldUseAngleBrackets ? `<${t.url}>` : Ns(t.url), a = t.title ? ` ${JSON.stringify(t.title)}` : ""; return `${e}[${o}](${s}${a})` } i(Rs, "generateRawMarkdownLink"); function _e(t) { let e = ft(t); return e[0]?.raw === t ? e[0] : null } i(_e, "parseLink"); function ft(t) { let e = new Set, n = "![", r = "@[", o = "@", a = ce(t, /\[(?!\[.*?\]\(.+?\))\]\((?.+?)\)/g, ({capturedGroupArgs: [p = "", w = ""]}) => `[${o.repeat(p.length)}](${w})`), l = ce(a, n, p => (e.add(p.offset), r)), c = $u().use(wn).use(Ku, {aliasDivider: Cc}).parse(l), f = [], d = []; Gn(c, p => { let w; switch (p.type) { case"link": w = hw(p, t); break; case"wikiLink": w = mw(p, t); break; default: return } e.has(w.startOffset - 1) && (w.isEmbed = !0, w.startOffset--, w.raw = `!${w.raw}`), f.push(w) }), f.sort((p, w) => p.startOffset - w.startOffset); let h = 0; for (let p of f) kc(t, h, p.startOffset - 1, d), h = p.endOffset + 1; return kc(t, h, t.length - 1, d), f.push(...d), f.sort((p, w) => p.startOffset - w.startOffset), f } i(ft, "parseLinks"); function Qg(t) { let { app: e, displayText: n, isWikilink: r, newSourcePathOrFile: o, oldSourcePathOrFile: s, oldTargetPath: a, targetPathOrFile: l } = t; if (r === !1) return !1; if (!n) return !0; let u = ee(e, l, !0), c = J(e, o), f = J(e, s ?? o), d = Z(c), h = Z(f), p = new Set; for (let y of [u.path, a]) { if (!y) continue; let b = J(e, y); p.add(b), p.add(xe(b)), p.add(cn(d, b)), p.add(cn(h, b)) } for (let y of [f, c]) p.add(e.metadataCache.fileToLinktext(u, y, !1)); let w = ce((0, An.normalizePath)(z(n.split(" > ")[0])), /^\.\//g, "").toLowerCase(); for (let y of p) { if (y.toLowerCase() === w) return !0; let b = Z(y), k = xe(y, Ue(y)); if (Ae(b, k).toLowerCase() === w) return !0 } return !1 } i(Qg, "shouldResetAlias"); function vn(t) { let e = (0, An.parseLinktext)(On(t)); return {linkPath: e.path, subpath: e.subpath} } i(vn, "splitSubpath"); function Xg(t) { return _e(t)?.hasAngleBrackets ?? !1 } i(Xg, "testAngleBrackets"); function xc(t) { return _e(t)?.isEmbed ?? !1 } i(xc, "testEmbed"); function Zg(t) { return _e(t)?.url.startsWith("./") ?? !1 } i(Zg, "testLeadingDot"); function ew(t) { return _e(t)?.url.startsWith("/") ?? !1 } i(ew, "testLeadingSlash"); function tw(t) { return _e(t)?.isWikilink ?? !1 } i(tw, "testWikilink"); function nw(t) { return ce(t, /(?\\+)(?[!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~])/g, ({capturedGroupArgs: [e = "", n = ""]}) => { let o = e.length, s = Math.floor(o / 2); return "\\".repeat(s) + n }) } i(nw, "unescapeAlias"); function Ds(t) { let { app: e, link: n, linkStyle: r, newSourcePathOrFile: o, newTargetPathOrFile: s, oldSourcePathOrFile: a, oldTargetPathOrFile: l, shouldUpdateFileNameAlias: u } = t; if (!s) return n.original; let c = ee(e, s, !0), f = J(e, a ?? o), d = J(e, l ?? s), h = Sc(e, n.original, r), {subpath: p} = vn(n.link), w = !u; if (Mt(e, o) && qu(n)) return c.path + p; let y = _e(n.original), b; return h && y?.alias && (b = y.alias, w = !0), b ??= Qg({ app: e, displayText: n.displayText, isWikilink: h, newSourcePathOrFile: o, oldSourcePathOrFile: a, oldTargetPath: d, targetPathOrFile: c }) ? void 0 : y?.alias, w || (b === xe(d, Ue(d)) ? b = c.basename : b === xe(d) && (b = c.name)), Yg({ alias: b, app: e, isSingleSubpathAllowed: f === d && !!y?.alias, linkStyle: r, originalLink: n.original, sourcePathOrFile: o, subpath: p, targetPathOrFile: c }) } i(Ds, "updateLink"); async function Ac(t) { let { app: e, linkStyle: n, newSourcePathOrFile: r, oldSourcePathOrFile: o, shouldUpdateEmbedOnlyLinks: s, shouldUpdateFileNameAlias: a } = t; Mt(e, r) && !e.internalPlugins.getEnabledPluginById(ke.Canvas) || await Os(e, r, l => { let u = xc(l.original); if (!(s !== void 0 && s !== u)) return qg({ app: e, link: l, linkStyle: n, newSourcePathOrFile: r, oldSourcePathOrFile: o, shouldUpdateFileNameAlias: a }) }, t) } i(Ac, "updateLinksInFile"); function rw(t, e, n) { if (e || n) return t; try { return decodeURIComponent(t) } catch (r) { return console.error(`Failed to decode URL ${t}`, r), t } } i(rw, "decodeUrlSafely"); function iw(t, e, n) { return e < n ? t.slice(e, n) : void 0 } i(iw, "extractAlias"); function kc(t, e, n, r) { if (e > n) return; let o = t.slice(e, n + 1); ce(o, /(?\S+)/g, ({capturedGroupArgs: [s = ""], offset: a}) => { ys(s) && r.push({ encodedUrl: Ns(s), endOffset: e + a + s.length, hasAngleBrackets: !1, isEmbed: !1, isExternal: !0, isWikilink: !1, raw: s, startOffset: e + a, url: s }) }) } i(kc, "extractTextLinks"); function ow(t, e, n, r, o) { n === "/" && (n = ""); let s; if (e.path === n && r && o.isSingleSubpathAllowed) s = ""; else switch (o.linkPathStyle) { case"AbsolutePathInVault": s = e.path, o.shouldUseLeadingSlashForAbsolutePaths && !s.startsWith("/") && (s = `/${s}`); break; case"RelativePathToTheNote": s = cn(Z(n), e.path), o.shouldUseLeadingDotForRelativePaths && !s.startsWith(".") && (s = `./${s}`); break; case"ShortestPathWhenPossible": { let a = Ze(t, e) ? e.basename : e.name, l = t.metadataCache.getLinkpathDest(a, n); s = l.length === 1 && l[0] === e ? e.name : e.path; break } default: st(o.linkPathStyle) } return s = o.isWikilink ? ao(s, `.${Vn}`) : s, s += r, s } i(ow, "generateLinkText"); function sw(t) { let {app: e} = t, n = ee(e, t.targetPathOrFile, t.isNonExistingFileAllowed), r = J(e, t.sourcePathOrFile), o = t.subpath ?? "", s = dw(t, n), a = ow(e, n, r, o, s); return s.isWikilink ? lw(a, t.alias, s.isEmbed) : aw(a, n, t, s) } i(sw, "generateMarkdownLinkImpl"); function aw(t, e, n, r) { let {app: o} = n, s = n.alias ?? "", a = n.shouldEscapeAlias ?? !1; return !s && (Ze(o, e) || !n.isEmptyEmbedAliasAllowed) && (s = !n.shouldIncludeAttachmentExtensionToEmbedAlias || Ze(o, e) ? e.basename : e.name, a = !0), Rs({ alias: s, isEmbed: r.isEmbed, isWikilink: !1, shouldEscapeAlias: a, shouldUseAngleBrackets: r.shouldUseAngleBrackets, url: t }) } i(aw, "generateMarkdownStyleLink"); function lw(t, e, n) { return e?.toLowerCase() === t.toLowerCase() ? Rs({isEmbed: n, isWikilink: !0, url: e}) : Rs({ alias: e, isEmbed: n, isWikilink: !0, url: t }) } i(lw, "generateWikiLink"); async function uw(t, e, n, r) { if (r ??= Oe(), r.throwIfAborted(), !t) return []; let o = [], s = (t.sections ?? []).filter(a => a.type === "table").map(a => ({ end: a.position.end.offset, start: a.position.start.offset })); for (let a of Wt(t)) { r.throwIfAborted(); let l = await n(a, r); if (r.throwIfAborted(), l === void 0) continue; let u = li(a, l); if (e) if (Xn(u)) o.push(u); else { console.error("Unsupported file change", u); } else ww(u, s) && (u.newContent = u.newContent.replaceAll(yc, jg)), o.push(u) } return o } i(uw, "getFileChanges"); function cw(t, e) { let n = e ?? "ObsidianSettingsDefault"; switch (n) { case"AbsolutePathInVault": return "AbsolutePathInVault"; case"ObsidianSettingsDefault": return gw(t); case"RelativePathToTheSource": return "RelativePathToTheNote"; case"ShortestPathWhenPossible": return "ShortestPathWhenPossible"; default: st(n) } } i(cw, "getFinalLinkPathStyle"); function fw(t) { return se(t, "generateMarkdownLinkDefaultOptionsFns", []).value } i(fw, "getGenerateMarkdownLinkDefaultOptionsFns"); function dw(t, e) { let {app: n} = t; return { isEmbed: t.isEmbed ?? (t.originalLink ? xc(t.originalLink) : void 0) ?? (!(0, An.requireApiVersion)("1.10.0") && !Ze(n, e)), isSingleSubpathAllowed: t.isSingleSubpathAllowed ?? !0, isWikilink: Sc(n, t.originalLink, t.linkStyle), linkPathStyle: cw(n, t.linkPathStyle), shouldUseAngleBrackets: t.shouldUseAngleBrackets ?? (t.originalLink ? Xg(t.originalLink) : void 0) ?? !1, shouldUseLeadingDotForRelativePaths: t.shouldUseLeadingDotForRelativePaths ?? (t.originalLink ? Zg(t.originalLink) : void 0) ?? !1, shouldUseLeadingSlashForAbsolutePaths: t.shouldUseLeadingSlashForAbsolutePaths ?? (t.originalLink ? ew(t.originalLink) : void 0) ?? !1 } } i(dw, "getLinkConfig"); function vc(t, e) { let n = z(t.position); return e.slice(n.start.offset, n.end.offset) } i(vc, "getRawLink"); function pw(t, e) { return t.startsWith("<") || e.startsWith("<") } i(pw, "hasAngleBracketsInLink"); function hw(t, e) { let o = vc(t, e), s = t.children[0]?.position?.start.offset ?? 1, a = t.children.at(-1)?.position?.end.offset ?? 1, l = z(t.position), u = z(l.end.offset), c = z(l.start.offset), f = e.slice(a + 2, u - 1), d = pw(o, f), h = ys(t.url), p = rw(t.url, h, d), w = iw(e, s, a); return { alias: w, encodedUrl: h ? Ns(p) : void 0, endOffset: u, hasAngleBrackets: d, isEmbed: !1, isExternal: h, isWikilink: !1, raw: o, startOffset: c, title: t.title ?? void 0, unescapedAlias: w === void 0 ? void 0 : nw(w), url: p } } i(hw, "parseLinkNode"); function mw(t, e) { let n = z(t.position); return { alias: e.includes(Cc) ? t.data.alias : void 0, endOffset: z(n.end.offset), isEmbed: !1, isExternal: !1, isWikilink: !0, raw: vc(t, e), startOffset: z(n.start.offset), url: t.value } } i(mw, "parseWikilinkNode"); function gw(t) { let e = bc(t); switch (e) { case"absolute": return "AbsolutePathInVault"; case"relative": return "RelativePathToTheNote"; case"shortest": return "ShortestPathWhenPossible"; default: st(e) } } i(gw, "resolveFinalLinkPathStyleFromObsidianSettings"); function ww(t, e) { return !$t(t) || !yc.test(t.newContent) ? !1 : e.some(n => n.start <= t.reference.position.start.offset && t.reference.position.end.offset <= n.end) } i(ww, "shouldEscapeWikilinkDivider"); function Sc(t, e, n) { let r = n ?? "PreserveExisting"; switch (r) { case"Markdown": return !1; case"ObsidianSettingsDefault": return Ms(t); case"PreserveExisting": return e === void 0 ? Ms(t) : tw(e); case"Wikilink": return !0; default: st(r) } } i(Sc, "shouldUseWikilinkStyle"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); async function Ec(t, e, n, r) { n.throwIfAborted(); let o = K("Logger:invokeAsyncAndLog"), s = performance.now(); r ??= Ce(1), qe(o, r, `${t}:start`, {fn: e, timestampStart: s}); try { await e(n); let a = performance.now(), l = Math.trunc(a - s); n.aborted && (qe(o, r, `${t}:aborted`, { abortReason: n.reason, duration: l, fn: e, timestampEnd: a, timestampStart: s }), n.throwIfAborted()), qe(o, r, `${t}:end`, {duration: l, fn: e, timestampEnd: a, timestampStart: s}) } catch (a) { let l = performance.now(); throw qe(o, r, `${t}:error`, { duration: Math.trunc(l - s), error: a, fn: e, timestampEnd: l, timestampStart: s }), a } } i(Ec, "invokeAsyncAndLog"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function wi(t) { let e = t.stackTrace ?? Ce(1); ae(() => bw(t), e) } i(wi, "addToQueue"); async function bw(t) { let e = t.abortSignal ?? Oe(); e.throwIfAborted(); let r = t.timeoutInMilliseconds ?? 6e4, o = t.stackTrace ?? Ce(1), s = t.operationName ?? "", a = Pc(t.app).value; a.items.push({ abortSignal: e, operationFn: t.operationFn, operationName: s, shouldShowTimeoutNotice: t.shouldShowTimeoutNotice ?? !0, stackTrace: o, timeoutInMilliseconds: r }), a.promise = a.promise.then(() => Tc(t.app)), await a.promise } i(bw, "addToQueueAndWait"); function Pc(t) { return se(t, "queue", {items: [], promise: $e()}) } i(Pc, "getQueue"); async function Tc(t) { let e = Pc(t).value, n = e.items[0]; n && (await Er(() => Zu({ context: {queuedFn: n.operationFn}, async operationFn(r) { await Ec(n.operationName || Tc.name, n.operationFn, Ft(r, n.abortSignal), n.stackTrace) }, operationName: n.operationName, shouldShowTimeoutNotice: n.shouldShowTimeoutNotice, stackTrace: n.stackTrace, timeoutInMilliseconds: n.timeoutInMilliseconds })), e.items.shift()) } i(Tc, "processNextQueueItem"); var Fc = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); async function bi(t, e, n, r, o) { let s = gt(t, e); if (!s) return !1; let a = Le(s) || (o ?? !0); if (Le(s)) { let l = await Ut(t, s); n && l.clear(n), l.count() !== 0 && (r && new Fc.Notice(pe(u => u.obsidianDevUtils.notices.attachmentIsStillUsed, {attachmentPath: s.path})), a = !1) } else if (Dr(s)) { let l = await Fs(t, s); for (let u of [...l.files, ...l.folders]) a &&= await bi(t, u, n, r); a &&= await di(t, s) } if (a) try { await zt(t, s) } catch (l) { pt(new Error(`Failed to delete ${s.path}`, {cause: l})), a = !1 } return a } i(bi, "deleteIfNotUsed"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var kw = Symbol.for("renameDeleteHandler"), Bs = class { static { i(this, "DeleteHandler") } app; file; abortSignal; settingsManager; deletedMetadataCacheMap; constructor(e, n, r, o, s) { this.app = e, this.file = n, this.abortSignal = r, this.settingsManager = o, this.deletedMetadataCacheMap = s } async handle() { if (this.abortSignal.throwIfAborted(), K("RenameDeleteHandler:handleDelete")(`Handle Delete ${this.file.path}`), !dn(this.app, this.file)) return; let e = this.settingsManager.getSettings(); if (e.isPathIgnored?.(this.file.path)) { K("RenameDeleteHandler:handleDelete")(`Skipping delete handler of ${this.file.path} as the path is ignored.`); return } let n = new Set([Z(this.file.path)]); if (e.shouldHandleDeletions) { let s = this.deletedMetadataCacheMap.get(this.file.path); if (this.deletedMetadataCacheMap.delete(this.file.path), s) { let a = Wt(s); for (let l of a) { let u = tr(this.app, l, this.file.path); u && (this.settingsManager.isNoteEx(u.path) || (n.add(u.parent?.path ?? ""), await bi(this.app, u, this.file.path, !1, e.emptyFolderBehavior !== "Keep"), this.abortSignal.throwIfAborted())) } } } if (n.delete(""), await Lc(this.app, this.settingsManager.getSettings(), Array.from(n)), this.abortSignal.throwIfAborted(), !e.shouldHandleDeletions) return; let r = await pn(this.app, this.file.path, wt.DeleteNote), o = Xe(this.app, r); o && await Eo(this.app, this.file.path, wt.DeleteNote) && (this.abortSignal.throwIfAborted(), await bi(this.app, o, this.file.path, !1, e.emptyFolderBehavior !== "Keep"), this.abortSignal.throwIfAborted()) } }, _s = class { static { i(this, "HandledRenames") } map = new Map; add(e, n) { this.map.set(this.keyToString(e, n), {newPath: n, oldPath: e}) } delete(e, n) { this.map.delete(this.keyToString(e, n)) } has(e, n) { return this.map.has(this.keyToString(e, n)) } keys() { return this.map.values() } keyToString(e, n) { return `${e} -> ${n}` } }, Vs = class { static { i(this, "MetadataDeletedHandler") } app; file; prevCache; settingsManager; deletedMetadataCacheMap; constructor(e, n, r, o, s) { this.app = e, this.file = n, this.prevCache = r, this.settingsManager = o, this.deletedMetadataCacheMap = s } handle() { let e = this.settingsManager.getSettings(); if (e.shouldHandleDeletions) { if (e.isPathIgnored?.(this.file.path)) { K("RenameDeleteHandler:handleMetadataDeleted")(`Skipping metadata delete handler of ${this.file.path} as the path is ignored.`); return } Ze(this.app, this.file) && this.prevCache && this.deletedMetadataCacheMap.set(this.file.path, this.prevCache) } } }, zs = class { static { i(this, "SettingsManager") } app; renameDeleteHandlersMap; constructor(e) { this.app = e, this.renameDeleteHandlersMap = se(e, "renameDeleteHandlersMap", new Map).value } getSettings() { let e = Array.from(this.renameDeleteHandlersMap.values()).reverse(), n = {}; n.isNote = r => dn(this.app, r), n.isPathIgnored = () => !1; for (let r of e) { let o = r(); n.shouldDeleteConflictingAttachments ||= o.shouldDeleteConflictingAttachments ?? !1, o.emptyFolderBehavior && (n.emptyFolderBehavior ??= o.emptyFolderBehavior), n.shouldHandleDeletions ||= o.shouldHandleDeletions ?? !1, n.shouldHandleRenames ||= o.shouldHandleRenames ?? !1, n.shouldRenameAttachmentFiles ||= o.shouldRenameAttachmentFiles ?? !1, n.shouldRenameAttachmentFolder ||= o.shouldRenameAttachmentFolder ?? !1, n.shouldUpdateFileNameAliases ||= o.shouldUpdateFileNameAliases ?? !1; let s = n.isPathIgnored; n.isPathIgnored = l => s(l) || (o.isPathIgnored?.(l) ?? !1); let a = n.isNote; n.isNote = l => a(l) && (o.isNote?.(l) ?? !0) } return n.emptyFolderBehavior ??= "Keep", n } isNoteEx(e) { return this.getSettings().isNote?.(e) ?? !1 } }, $s = class t { static { i(this, "RenameHandler") } abortSignal; app; handledRenames; interruptedCombinedBacklinksMap; interruptedRenamesMap; newPath; oldCache; oldPath; oldPathBacklinksMap; oldPathLinks; settingsManager; constructor(e) { this.app = e.app, this.oldPath = e.oldPath, this.newPath = e.newPath, this.oldPathBacklinksMap = e.oldPathBacklinksMap, this.oldCache = e.oldCache, this.abortSignal = e.abortSignal, this.settingsManager = e.settingsManager, this.interruptedRenamesMap = e.interruptedRenamesMap, this.oldPathLinks = this.oldCache ? Wt(this.oldCache) : [], this.handledRenames = e.handledRenames, this.interruptedCombinedBacklinksMap = e.interruptedCombinedBacklinksMap ?? new Map } async handle() { if (this.oldPath === this.newPath || (this.abortSignal.throwIfAborted(), await this.continueInterruptedRenames(), this.abortSignal.throwIfAborted(), await this.refreshLinks(), this.abortSignal.throwIfAborted(), await this.handleCaseCollision())) return; this.abortSignal.throwIfAborted(); let e = se(this.app, "renamedFilePaths", new Set).value, n = se(this.app, "renamedLinkPaths", new Set).value; try { let r = new Ws({ abortSignal: this.abortSignal, app: this.app, newPath: this.newPath, oldCache: this.oldCache, oldPath: this.oldPath, settingsManager: this.settingsManager }); await r.fill(), this.abortSignal.throwIfAborted(); let o = new Map; r.initOriginalLinksMap(o), r.initBacklinksMap(this.oldPathBacklinksMap, o, this.oldPath); for (let l of r.keys()) { if (l === this.oldPath) continue; let u = (await Ut(this.app, l)).data; this.abortSignal.throwIfAborted(), r.initBacklinksMap(u, o, l) } let s = new Set; for (let [l, u] of r.entries()) { if (l !== this.oldPath) { let c = await this.renameHandled(l, u); this.abortSignal.throwIfAborted(), r.set(l, c) } this.settingsManager.isNoteEx(l) || s.add(Z(l)) } await Lc(this.app, this.settingsManager.getSettings(), Array.from(s)), this.abortSignal.throwIfAborted(); let a = this.settingsManager.getSettings(); for (let [l, u] of Array.from(o.entries()).concat(Array.from(this.interruptedCombinedBacklinksMap.entries()))) { let c = 0; await Os(this.app, l, f => { c++; let d = u.get(uo(f)); if (!d) return; let h = r.get(d) ?? d; return e.add(l), n.add(`${l}//${String(c)}`), Ds({ app: this.app, link: f, newSourcePathOrFile: l, newTargetPathOrFile: h, oldTargetPathOrFile: d, shouldUpdateFileNameAlias: a.shouldUpdateFileNameAliases }) }, {shouldFailOnMissingFile: !1}), this.abortSignal.throwIfAborted() } if (dn(this.app, this.newPath) && (await Ac({ app: this.app, newSourcePathOrFile: this.newPath, oldSourcePathOrFile: this.oldPath, shouldFailOnMissingFile: !1, shouldUpdateFileNameAlias: a.shouldUpdateFileNameAliases }), this.abortSignal.throwIfAborted()), !ve(this.app, this.newPath)) { let l = this.interruptedRenamesMap.get(this.newPath); l || (l = [], this.interruptedRenamesMap.set(this.newPath, l)), l.push({ combinedBacklinksMap: o, oldPath: this.oldPath }) } } finally { let r = Array.from(this.handledRenames.keys()); wi({ abortSignal: this.abortSignal, app: this.app, operationFn: i(() => { for (let o of r) this.handledRenames.delete(o.oldPath, o.newPath); n.size !== 0 && (new yi.Notice(mt(o => o.obsidianDevUtils.renameDeleteHandler.updatedLinks, { filesCount: e.size, linksCount: n.size })), e.clear(), n.clear()) }, "operationFn"), operationName: mt(o => o.obsidianDevUtils.renameDeleteHandler.handleOrphanedRenames) }) } } async continueInterruptedRenames() { let e = this.interruptedRenamesMap.get(this.oldPath); if (e) { this.interruptedRenamesMap.delete(this.oldPath); for (let n of e) await new t({ abortSignal: this.abortSignal, app: this.app, handledRenames: this.handledRenames, interruptedCombinedBacklinksMap: n.combinedBacklinksMap, interruptedRenamesMap: this.interruptedRenamesMap, newPath: this.newPath, oldCache: this.oldCache, oldPath: n.oldPath, oldPathBacklinksMap: this.oldPathBacklinksMap, settingsManager: this.settingsManager }).handle() } } async handleCaseCollision() { if (!Jt(this.app).insensitive || this.oldPath.toLowerCase() !== this.newPath.toLowerCase()) return !1; let e = Ae(Z(this.newPath), `__temp__${xe(this.newPath)}`); return await this.renameHandled(this.newPath, e), await new t({ abortSignal: this.abortSignal, app: this.app, handledRenames: this.handledRenames, interruptedRenamesMap: this.interruptedRenamesMap, newPath: e, oldCache: this.oldCache, oldPath: this.oldPath, oldPathBacklinksMap: this.oldPathBacklinksMap, settingsManager: this.settingsManager }).handle(), await this.app.fileManager.renameFile(ee(this.app, e), this.newPath), !0 } async refreshLinks() { let e = this.app.metadataCache.getCache(this.oldPath) ?? this.app.metadataCache.getCache(this.newPath), n = e ? Wt(e) : [], r = ee(this.app, this.oldPath, !0), o = new Map; await er(this.app, [r], async () => { o = (await Ut(this.app, r)).data }); for (let s of n) this.oldPathLinks.includes(s) || this.oldPathLinks.push(s); for (let [s, a] of o.entries()) { let l = this.oldPathBacklinksMap.get(s); l || (l = [], this.oldPathBacklinksMap.set(s, l)); for (let u of a) l.includes(u) || l.push(u) } } async renameHandled(e, n) { return n = Ts(this.app, e, n), e === n || (this.handledRenames.add(e, n), n = await lc(this.app, e, n)), n } }, Ws = class { static { i(this, "RenameMap") } abortSignal; app; map = new Map; newPath; oldCache; oldPath; oldPathLinks; settingsManager; constructor(e) { this.abortSignal = e.abortSignal, this.app = e.app, this.settingsManager = e.settingsManager, this.oldCache = e.oldCache, this.oldPath = e.oldPath, this.newPath = e.newPath, this.oldPathLinks = this.oldCache ? Wt(this.oldCache) : [] } entries() { return this.map.entries() } async fill() { if (this.abortSignal.throwIfAborted(), this.map.set(this.oldPath, this.newPath), !dn(this.app, this.oldPath)) return; let e = this.settingsManager.getSettings(), n = ee(this.app, this.oldPath, !0), r = ""; await hc(this.app, [n], async () => { let u = this.oldCache && n.deleted; u && dc(this.app, n, this.oldCache); try { r = await pn(this.app, this.oldPath, wt.RenameNote) } finally { u && mc(this.app, n) } }); let o = e.shouldRenameAttachmentFolder ? await pn(this.app, this.newPath, wt.RenameNote) : r, s = r === "/", a = Xe(this.app, r); if (!a || r === o && !e.shouldRenameAttachmentFiles) return; let l = []; if (await Eo(this.app, this.oldPath, wt.RenameNote)) yi.Vault.recurseChildren(a, u => { this.abortSignal.throwIfAborted(), Le(u) && l.push(u) }); else for (let u of this.oldPathLinks) { this.abortSignal.throwIfAborted(); let c = tr(this.app, u, this.oldPath); if (c && (s || c.path.startsWith(r))) { let f = await Ut(this.app, c); this.abortSignal.throwIfAborted(); let d = new Set(f.keys()); d.delete(this.oldPath), d.delete(this.newPath), d.size === 0 && l.push(c) } } for (let u of l) { if (this.abortSignal.throwIfAborted(), this.settingsManager.isNoteEx(u.path)) continue; let c; if (e.shouldRenameAttachmentFiles) c = await So({ app: this.app, context: wt.RenameNote, notePathOrFile: this.newPath, oldAttachmentPathOrFile: u, oldNotePathOrFile: this.oldPath, shouldSkipDuplicateCheck: !0 }), this.abortSignal.throwIfAborted(); else { let f = s ? u.path : cn(r, u.path), d = Ae(o, Z(f)); c = Ae(d, u.name) } if (u.path !== c) { if (e.shouldDeleteConflictingAttachments) { let f = ve(this.app, c); f && (K("RenameDeleteHandler:fillRenameMap")(`Removing conflicting attachment ${f.path}.`), await zt(this.app, f), this.abortSignal.throwIfAborted()) } else { let f = Z(c), d = Ue(c), h = xe(c, d); c = this.app.vault.getAvailablePath(Ae(f, h), d.slice(1)) } this.map.set(u.path, c) } } } get(e) { return this.map.get(e) } initBacklinksMap(e, n, r) { for (let [o, s] of e.entries()) { let a = this.map.get(o) ?? o, l = n.get(a) ?? new Map; n.set(a, l); for (let u of s) l.set(uo(u), r) } } initOriginalLinksMap(e) { for (let n of this.oldPathLinks) { let r = tr(this.app, n, this.oldPath); if (!r) continue; let o = new Map; o.set(this.newPath, [n]), this.initBacklinksMap(o, e, r.path) } } keys() { return this.map.keys() } set(e, n) { this.map.set(e, n) } }, ki = class extends j { static { i(this, "RenameDeleteHandlerComponent") } abortSignalComponent; app; deletedMetadataCacheMap = new Map; handledRenames = new _s; interruptedRenamesMap = new Map; pluginId; settingsBuilder; settingsManager; constructor(e) { super(), this.abortSignalComponent = e.abortSignalComponent, this.app = e.app, this.pluginId = e.pluginId, this.settingsBuilder = e.settingsBuilder, this.settingsManager = new zs(this.app) } onload() { let e = this.settingsManager.renameDeleteHandlersMap; e.set(this.pluginId, this.settingsBuilder), this.logRegisteredHandlers(), this.register(() => { e.delete(this.pluginId), this.logRegisteredHandlers() }), this.registerEvent(this.app.vault.on("delete", this.handleDelete.bind(this))), this.registerEvent(this.app.vault.on("rename", this.handleRename.bind(this))), this.registerEvent(this.app.metadataCache.on("deleted", this.handleMetadataDeleted.bind(this))), this.addChild(new Fe).registerMethodPatch({ methodName: "runAsyncLinkUpdate", obj: this.app.fileManager, patchHandler: i(({ fallback: r, originalArgs: [o], originalMethod: s, originalMethodBound: a }) => ja(s, kw) ? r() : a(i(u => this.wrapLinkUpdatesHandler(u, o), "newHandler")), "patchHandler") }) } handleDelete(e) { this.shouldInvokeHandler() && wi({ app: this.app, operationFn: i(n => new Bs(this.app, e, n, this.settingsManager, this.deletedMetadataCacheMap).handle(), "operationFn"), operationName: mt(n => n.obsidianDevUtils.renameDeleteHandler.handleDelete, {filePath: e.path}) }) } handleMetadataDeleted(e, n) { this.shouldInvokeHandler() && new Vs(this.app, e, n, this.settingsManager, this.deletedMetadataCacheMap).handle() } handleRename(e, n) { if (!this.shouldInvokeHandler() || !Le(e)) return; let r = e.path; if (K("RenameDeleteHandler:handleRename")(`Handle Rename ${n} -> ${r}`), this.handledRenames.has(n, r)) { this.handledRenames.delete(n, r); return } let o = this.settingsManager.getSettings(); if (!o.shouldHandleRenames) return; if (o.isPathIgnored?.(n)) { K("RenameDeleteHandler:handleRename")(`Skipping rename handler of old path ${n} as the path is ignored.`); return } if (o.isPathIgnored?.(r)) { K("RenameDeleteHandler:handleRename")(`Skipping rename handler of new path ${r} as the path is ignored.`); return } let s = this.app.metadataCache.getCache(n) ?? this.app.metadataCache.getCache(r), a = Is(this.app, n).data; wi({ abortSignal: this.abortSignalComponent.abortSignal, app: this.app, operationFn: i(l => new $s({ abortSignal: l, app: this.app, handledRenames: this.handledRenames, interruptedRenamesMap: this.interruptedRenamesMap, newPath: r, oldCache: s, oldPath: n, oldPathBacklinksMap: a, settingsManager: this.settingsManager }).handle(), "operationFn"), operationName: mt(l => l.obsidianDevUtils.renameDeleteHandler.handleRename, {newPath: r, oldPath: n}) }) } logRegisteredHandlers() { let e = this.settingsManager.renameDeleteHandlersMap; K("RenameDeleteHandler:logRegisteredHandlers")(`Plugins with registered rename/delete handlers: ${JSON.stringify(Array.from(e.keys()))}`) } shouldInvokeHandler() { let e = this.settingsManager.renameDeleteHandlersMap; return Array.from(e.keys())[0] === this.pluginId } async wrapLinkUpdatesHandler(e, n) { let r = !1, o = this.app.vault.on("rename", () => { r = !0 }); try { await n(e) } finally { this.app.vault.offref(o) } let s = this.settingsManager.getSettings(); !r || !s.shouldHandleRenames || Ke(e, a => s.isPathIgnored?.(a.sourceFile.path) ? (K("RenameDeleteHandler:runAsyncLinkUpdate")(`Roll back to default link update of source file ${a.sourceFile.path} as the path is ignored.`), !0) : s.isPathIgnored?.(a.resolvedFile.path) ? (K("RenameDeleteHandler:runAsyncLinkUpdate")(`Roll back to default link update of resolved file ${a.resolvedFile.path} as the path is ignored.`), !0) : !this.app.internalPlugins.getEnabledPluginById(ke.Canvas) || this.app.plugins.getPlugin("backlink-cache") ? !1 : a.sourceFile.extension === Nr || a.resolvedFile.extension === Nr) } }; async function Lc(t, e, n) { if (e.emptyFolderBehavior !== "Keep") for (let r of n) switch (e.emptyFolderBehavior) { case"Delete": await Ps(t, r); break; case"DeleteWithEmptyParents": await oc(t, r); break; default: break } } i(Lc, "cleanupParentFolders"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Ci = class { static { i(this, "PluginDataHandler") } plugin; constructor(e) { this.plugin = e } async loadData() { return this.plugin.loadData() } async saveData(e) { return this.plugin.saveData(e) } }; var Bc = require("obsidian"); var Oc = qt(Mc(), 1); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Re = (t => (t.AlertModal = "alert-modal", t.CancelButton = "cancel-button", t.CheckboxComponent = "checkbox-component", t.CodeHighlighterComponent = "code-highlighter-component", t.ConfirmModal = "confirm-modal", t.DateComponent = "date-component", t.DateTimeComponent = "datetime-component", t.EmailComponent = "email-component", t.FileComponent = "file-component", t.IsPlaceholder = "is-placeholder", t.LibraryName = "obsidian-dev-utils", t.MonthComponent = "month-component", t.MultipleDropdownComponent = "multiple-dropdown-component", t.MultipleEmailComponent = "multiple-email-component", t.MultipleFileComponent = "multiple-file-component", t.MultipleTextComponent = "multiple-text-component", t.NumberComponent = "number-component", t.OkButton = "ok-button", t.OverlayValidator = "overlay-validator", t.PasswordComponent = "password-component", t.PluginSettingsTab = "plugin-settings-tab", t.PromptModal = "prompt-modal", t.SelectItemModal = "select-item-modal", t.SettingComponentWrapper = "setting-component-wrapper", t.TelephoneComponent = "telephone-component", t.TextBox = "text-box", t.TimeComponent = "time-component", t.Tooltip = "tooltip", t.TooltipArrow = "tooltip-arrow", t.TooltipValidator = "tooltip-validator", t.TriStateCheckboxComponent = "tri-state-checkbox-component", t.TypedDropdownComponent = "typed-dropdown-component", t.TypedMultipleDropdownComponent = "typed-multiple-dropdown-component", t.UrlComponent = "url-component", t.WeekComponent = "week-component", t))(Re || {}); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Rc = `${yr}-styles`; function tt(t, e) { let n = [Re.LibraryName, xr()]; Array.isArray(e) ? n.push(...e) : typeof e == "string" && n.push(e), t.addClass(...n) } i(tt, "addPluginCssClasses"); function Nc(t, e) { let n = t, r = n.DEBUG, o = Ia(); n.DEBUG = o, e.register(() => { n.DEBUG === o && (n.DEBUG = r) }) } i(Nc, "initDebugController"); function Dc(t, e) { Fa(e), Ma(e); let n = se(t, "lastLibraryVersion", "0.0.0"); (0, Oc.compareVersions)(no, n.value) <= 0 || (n.value = no, document.head.querySelector(`#${Rc}`)?.remove(), document.head.createEl("style", { attr: {id: Rc}, text: Pa })) } i(Dc, "initPluginContext"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); async function _c(t) { let n = { ...{ abortSignal: Oe(), buildNoticeMessage() { throw new Error("buildNoticeMessage is required") }, items: [], noticeBeforeShownTimeoutInMilliseconds: 500, noticeMinTimeoutInMilliseconds: 2e3, processItem: ge, progressBarTitle: "", shouldContinueOnError: !0, shouldShowNotice: !0, shouldShowProgressBar: !0, uiUpdateThresholdInMilliseconds: 100 }, ...t }, r = Ce(1), o = n.items, s = 0, a = null, l = !1; ae(() => d()); let u = sleep(n.noticeMinTimeoutInMilliseconds), c = createEl("progress"); tt(c, "loop"), c.max = o.length; let f = performance.now(); for (let h of o) { if (n.abortSignal.aborted) { a?.hide(); return } s++; let p = `# ${String(s)} / ${String(o.length)}`, w = n.buildNoticeMessage(h, p); n.shouldShowProgressBar || a?.setMessage(w), K("Loop")(w); try { performance.now() - f > n.uiUpdateThresholdInMilliseconds && (await Pr(), f = performance.now()), await n.processItem(h) } catch (y) { if (console.error("Error processing item", h), !n.shouldContinueOnError) throw a?.hide(), new We("loop failed", r, y); br(new We(wr, r, y)) } c.value++ } a && await u, a?.hide(), l = !0; async function d() { if (!n.shouldShowNotice || (await sleep(n.noticeBeforeShownTimeoutInMilliseconds), l) || (a = new Bc.Notice("", 0), !n.shouldShowProgressBar)) return; let h = createFragment(); h.createDiv({text: n.progressBarTitle}), h.appendChild(c), a.setMessage(h) } i(d, "showNotice") } i(_c, "loop"); var Us = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Ai = class extends j { static { i(this, "AbortSignalComponent") } pluginId; abortController; constructor(e) { super(), this.pluginId = e, this.abortController = new AbortController } get abortSignal() { return this.ensureLoaded(), this.abortController.signal } onunload() { this.abortController.abort(new Zt(`Plugin ${this.pluginId} had been unloaded`)) } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var vi = class extends j { static { i(this, "AsyncErrorHandlerComponent") } pluginNoticeComponent; constructor(e) { super(), this.pluginNoticeComponent = e } onload() { this.register(Ea(this.handleAsyncError.bind(this))) } handleAsyncError(e) { this.pluginNoticeComponent.showNotice(pe(n => n.obsidianDevUtils.notices.unhandledError)) } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Si = class extends j { static { i(this, "ConsoleDebugComponent") } pluginId; constructor(e) { super(), this.pluginId = e } consoleDebug(e, ...n) { this.ensureLoaded(), en(this.pluginId, 1)(e, ...n) } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Ei = class extends j { static { i(this, "I18nComponent") } translationsMap; constructor(e = ci) { super(), this.translationsMap = e } async onloadAsync() { await vs(this.translationsMap) } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Pi = class extends j { static { i(this, "PluginContextComponent") } app; pluginId; constructor(e) { super(), this.app = e.app, this.pluginId = e.pluginId } onload() { Dc(this.app, this.pluginId), this.addChild(new sn(this.app)).registerAllWindowsHandler(e => { Nc(e, this) }) } }; var Vc = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Ti = class extends j { static { i(this, "PluginNoticeComponent") } pluginName; notice; constructor(e) { super(), this.pluginName = e } onunload() { this.notice?.hide() } showNotice(e) { this.ensureLoaded(), this.notice?.hide(), this.notice = new Vc.Notice(`${this.pluginName} ${e}`) } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Fi = class extends hr()(Us.Plugin) { static { i(this, "PluginBase") } abortSignalComponent; asyncErrorHandlerComponent; consoleDebugComponent; i18nComponent; pluginContextComponent; pluginNoticeComponent; wrapperComponent; constructor(e, n) { super(e, n), this.wrapperComponent = super.addChild(new j), this.pluginContextComponent = this.addChild(new Pi({ app: this.app, pluginId: this.manifest.id })), this.i18nComponent = this.addChild(new Ei), this.pluginNoticeComponent = this.addChild(new Ti(this.manifest.name)), this.asyncErrorHandlerComponent = this.addChild(new vi(this.pluginNoticeComponent)), this.abortSignalComponent = this.addChild(new Ai(this.manifest.id)), this.consoleDebugComponent = this.addChild(new Si(this.manifest.id)) } addChild(e) { return this.wrapperComponent.addChild(e) } async onExternalSettingsChange() { await super.onExternalSettingsChange?.(), await this.triggerAsync("externalSettingsChange") } async onload() { await this.wrapperComponent.loadWithPromises() } removeChild(e) { return this.wrapperComponent.removeChild(e) } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Li = class { static { i(this, "PluginEventSourceImpl") } plugin; constructor(e) { this.plugin = e } off(e, n) { this.plugin.off(e, n) } offref(e) { this.plugin.offref(e) } on(e, n, r) { return this.plugin.on(e, n, r) } once(e, n, r) { return this.plugin.once(e, n, r) } }; var Wc = require("@codemirror/language"), Uc = require("@codemirror/state"), Ht = require("@codemirror/view"); function Hs(t, e) { let n = t.dataset; n.frontmatterMarkdownLinksLinkData = JSON.stringify(e) } i(Hs, "attachLinkData"); function js(t) { if (!t) return {}; let e = createDiv(); Hs(e, t); let n = z(e.attributes[0]); return {[n.name]: n.value} } i(js, "getDataAttributes"); function nr(t) { let e = t.closest("[data-frontmatter-markdown-links-link-data]"); if (!(e instanceof HTMLElement)) return null; let n = e.dataset; return n.frontmatterMarkdownLinksLinkData ? JSON.parse(n.frontmatterMarkdownLinksLinkData) : null } i(nr, "getLinkData"); var zc = require("obsidian"); function $c(t) { return t.alias ?? t.url.split("#").map(e => e.trim()).join(" > ") } i($c, "extractDisplayText"); function rr(t) { let e = t.workspace.getActiveViewOfType(zc.MarkdownView); return !e || e.getMode() !== "source" ? !1 : !!e.getState().source } i(rr, "isSourceMode"); var Ks = class { app; isSourceMode; static { i(this, "FrontMatterLinksViewPlugin") } constructor(e, n) { this.app = n; this.isSourceMode = rr(this.app), this._decorations = this.buildDecorations(e) } _decorations; get decorations() { return this._decorations } update(e) { let n = rr(this.app); !e.docChanged && !e.viewportChanged && !e.selectionSet && n === this.isSourceMode || (this.isSourceMode = n, this._decorations = this.buildDecorations(e.view)) } buildDecorations(e) { let n = new Uc.RangeSetBuilder, r = -1, o = r, s = !1, a = r, l = r, u = !1, c = this; for (let {from: d, to: h} of e.visibleRanges) (0, Wc.syntaxTree)(e.state).iterate({ enter(p) { let w = e.state.doc.lineAt(p.from).number; if (w !== o && (f(a, l, !1), o = w, s = !1, a = r, l = r, u = !1), p.name === "comment_hmd-frontmatter") { u = !0; return } if (p.name === "hmd-frontmatter_meta" && !s) { s = !0; return } s && (a === r && (a = p.from), l = p.to), p.name === "hmd-frontmatter_string" && (f(p.from + 1, p.to - 1, !0), a = r, l = r) }, from: d, to: h }), f(a, l, !1); return n.finish(); function f(d, h, p) { if (d === r) return; let w = e.state.doc.sliceString(d, h); u && (w = w.trimEnd()); let y = ft(w); for (let b of y) { let k = d + b.startOffset, x = d + b.endOffset; if (e.state.selection.ranges.some(P => Math.max(P.from, k) <= Math.min(P.to, x)) || c.isSourceMode) for (let P of yw(b.raw)) n.add(k + P.from, k + P.to, Ht.Decoration.mark({ attributes: js(P.isClickable ? { isExternalUrl: b.isExternal, isWikilink: b.isWikilink, url: b.url } : null), class: P.cssClass })); else n.add(k, x, Ht.Decoration.replace({inclusive: !0, widget: new Gs(b, p)})) } } } }, Gs = class extends Ht.WidgetType { parseLinkResult; isInQuotes; constructor(n, r) { super(); this.parseLinkResult = n; this.isInQuotes = r } static { i(this, "LinkWidget") } toDOM() { return createSpan({cls: this.isInQuotes ? "" : "cm-hmd-frontmatter cm-string"}, n => { n.createSpan({cls: "cm-hmd-internal-link"}, r => { r.createEl("a", { attr: js({ isExternalUrl: this.parseLinkResult.isExternal, isWikilink: this.parseLinkResult.isWikilink, url: this.parseLinkResult.url }), cls: "cm-underline", text: this.parseLinkResult.alias ?? this.parseLinkResult.url }) }) }) } }; function Hc(t) { let e = Ht.ViewPlugin.define(n => new Ks(n, t.app), {decorations: i(n => n.decorations, "decorations")}); t.registerEditorExtension(e) } i(Hc, "registerFrontmatterLinksEditorExtension"); function yw(t) { let e = _e(t); if (!e) return []; let n = [[{ cssClass: `cm-formatting-link cm-formatting-link-start${e.isEmbed ? " cm-formatting-embed" : ""}`, regExp: /!?\[\[/ }, { cssClass: "cm-hmd-embed cm-hmd-internal-link", isClickable: !0, regExp: /[^|]+/ }, { cssClass: "cm-formatting-link cm-formatting-link-end", regExp: /\]\]/ }], [{ cssClass: `cm-formatting-link cm-formatting-link-start${e.isEmbed ? " cm-formatting-embed" : ""}`, regExp: /!?\[\[/ }, { cssClass: "cm-hmd-internal-link cm-link-has-alias", isClickable: !0, regExp: /[^|]+/ }, { cssClass: "cm-hmd-internal-link cm-link-alias-pipe", regExp: /\|/ }, { cssClass: "cm-hmd-internal-link cm-link-alias", isClickable: !0, regExp: /[^|]+/ }, { cssClass: "cm-formatting-link cm-formatting-link-end", regExp: /\]\]/ }], [{ cssClass: "cm-formatting cm-formatting-image cm-image cm-image-marker", regExp: /!/ }, { cssClass: "cm-formatting cm-formatting-image cm-image cm-image-alt-text cm-link", regExp: /\[/ }, { cssClass: "cm-image cm-image-alt-text cm-link", isClickable: !0, regExp: /.+/ }, { cssClass: "cm-formatting cm-formatting-image cm-image cm-image-alt-text cm-link", regExp: /\]/ }, { cssClass: "cm-formatting cm-formatting-link-string cm-string cm-url", regExp: /\(/ }, { cssClass: "cm-string cm-url", isClickable: !0, regExp: /.+/ }, { cssClass: "cm-formatting cm-formatting-link-string cm-string cm-url", regExp: /\)/ }], [{cssClass: "cm-formatting cm-formatting-link cm-link", regExp: /\[/}, { cssClass: "cm-link", isClickable: !0, regExp: /.+/ }, { cssClass: "cm-formatting cm-formatting-link cm-link", regExp: /\]/ }, { cssClass: "cm-formatting cm-formatting-link-string cm-string cm-url", regExp: /\(/ }, { cssClass: "cm-string cm-url", isClickable: !0, regExp: /.+/ }, { cssClass: "cm-formatting cm-formatting-link-string cm-string cm-url", regExp: /\)/ }], [{ cssClass: "cm-formatting cm-formatting-link cm-link", regExp: // }], [{cssClass: "cm-url", isClickable: !0, regExp: /.+/}]]; for (let r of n) { let o = Cw(t, r); if (o) return o } return [] } i(yw, "getLinkStylingInfos"); function Cw(t, e) { let n = `^${e.map(u => `(${u.regExp.source})`).join("")}$`, o = new RegExp(n).exec(t); if (!o) return null; let s = [], a = 0, l = 0; for (let u of e) { l++; let c = a + z(o[l]).length; s.push({cssClass: u.cssClass, from: a, isClickable: u.isClickable ?? !1, to: c}), a = c } return s } i(Cw, "tryGetLinkStylingInfos"); var jc = require("obsidian"); var xw = 1, Sn = "frontmatter-links", Ii = "file-mtime", Aw = 5e3, ir = class { static { i(this, "FrontmatterMarkdownLinksCache") } fileFrontmatterLinkCacheMap = new Map; pathMtimeMap = new Map; pendingStoreActions = []; processStoreActionsDebounced = (0, jc.debounce)(() => { this.processStoreActions() }, Aw); _db; get db() { if (!this._db) throw new Error("db is not initialized"); return this._db } add(e, n) { let r = this.fileFrontmatterLinkCacheMap.get(e); r || (r = [], this.fileFrontmatterLinkCacheMap.set(e, r)), r.push(n), this.addStoreAction(Sn, o => { o.put({filePath: e, links: r}) }) } delete(e) { this.fileFrontmatterLinkCacheMap.delete(e), this.pathMtimeMap.delete(e), this.addStoreAction(Sn, n => { n.delete(e) }) } deleteKey(e, n) { let r = this.fileFrontmatterLinkCacheMap.get(e); if (!r) return; let o = r.length; if (Ke(r, s => s.key !== n), r.length !== o) { if (r.length === 0) { this.delete(e); return } this.addStoreAction(Sn, s => { s.put({filePath: e, links: r}) }) } } getFilePaths() { return Array.from(this.fileFrontmatterLinkCacheMap.keys()) } getKeys(e) { return (this.fileFrontmatterLinkCacheMap.get(e) ?? []).map(r => r.key) } getLinks(e) { return this.fileFrontmatterLinkCacheMap.get(e.path) ?? [] } async init(e) { let n = window.indexedDB.open(`${e.appId}/frontmatter-markdown-links`, xw); n.addEventListener("upgradeneeded", c => { if (c.newVersion !== 1) return; let f = n.result; f.createObjectStore(Ii, {keyPath: "filePath"}), f.createObjectStore(Sn, {keyPath: "filePath"}) }); let r = await qs(n); this._db = r; let o = r.transaction([Ii, Sn], "readonly"), s = o.objectStore(Ii), a = await qs(s.getAll()); for (let c of a) this.pathMtimeMap.set(c.filePath, c.mtime); let l = o.objectStore(Sn), u = await qs(l.getAll()); for (let c of u) this.fileFrontmatterLinkCacheMap.set(c.filePath, c.links) } isCacheValid(e) { return this.pathMtimeMap.get(e.path) === e.stat.mtime } rename(e, n) { let r = this.fileFrontmatterLinkCacheMap.get(e) ?? []; this.updateFile(n), this.delete(e); for (let o of r) this.add(n.path, o) } updateFile(e) { this.pathMtimeMap.set(e.path, e.stat.mtime), this.addStoreAction(Ii, n => { n.put({filePath: e.path, mtime: e.stat.mtime}) }) } addStoreAction(e, n) { this.pendingStoreActions.push({action: n, storeName: e}), this.processStoreActionsDebounced() } processStoreActions() { let e = this.pendingStoreActions; this.pendingStoreActions = []; let n = e.map(o => o.storeName).unique(), r = this.db.transaction(n, "readwrite"); for (let o of e) { let s = r.objectStore(o.storeName); o.action(s) } r.commit() } }; async function qs(t) { return t.readyState === "done" ? t.result : await new Promise((e, n) => { t.addEventListener("success", () => { e(t.result) }), t.addEventListener("error", () => { n(t.error ?? new Error("IDBRequest failed")) }) }) } i(qs, "getResult"); var Kc = !1; function Gc(t) { let e = t.app.metadataTypeManager.registeredTypeWidgets.multitext; t.addChild(new Fe).registerPatch(e, {render: i(r => (o, s, a) => Sw(o, s, a, r, t), "render")}) } i(Gc, "patchMultiTextPropertyWidgetComponent"); function vw(t, e, n) { n.call(e); let r = Array.from(e.rootEl.querySelectorAll(".multi-select-pill-content")); for (let a = 0; a < r.length; a++) { let w = function (b, k) { b.setText(""), b.createSpan({text: $c(k)}), k.isExternal ? b.addClass("external-link") : (y(b, "internal-link"), t.metadataCache.getFirstLinkpathDest(vn(k.url).linkPath, t.workspace.getActiveFile()?.path ?? "") || y(b, "is-unresolved")), b.setAttribute("title", k.url), Hs(b, { isExternalUrl: k.isExternal, isWikilink: k.isWikilink, url: k.url }) }, y = function (b, k) { b.addClass(k), d && b.parentElement?.addClass(k) }; var o = w, s = y; i(w, "renderChild"), i(y, "addClassToElementAndParent"); let l = e.values[a]; if (!l) continue; let u = ft(l); if (u.length === 0) continue; let c = z(r[a]), f = z(u[0]), d = f.raw === l; if (d) { w(c, f); continue } c.empty(); let h = c.parentElement; if (!h) continue; for (let b of [c, h]) b.removeClass("internal-link", "external-link", "is-unresolved"); h.addEventListener("mouseover", b => { b.stopPropagation() }, {capture: !0}), h.addEventListener("click", b => { b.target instanceof Element && (b.target.closest(".multi-select-pill-remove-button") || b.stopPropagation()) }, {capture: !0}), c.addClass("frontmatter-markdown-links", "multi-text-property-component"); let p = 0; for (let b of u) { p < b.startOffset && c.createDiv({text: l.slice(p, b.startOffset)}); let k = c.createDiv(); w(k, b), p = b.endOffset } p < l.length && c.createDiv({text: l.slice(p)}) } } i(vw, "renderValues"); function Sw(t, e, n, r, o) { if (!Kc) { let s = t.createDiv(), a = r(s, [], n), l = at(a.multiselect); o.addChild(new Fe).registerPatch(l, { renderValues: i(c => i(function () { vw(o.app, this, c) }, "renderValuesPatched"), "renderValues") }), Kc = !0, s.remove() } return r(t, e, n) } i(Sw, "renderWidget"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var xt = class { static { i(this, "Transformer") } getTransformer(e) { if (e === this.id) return this; throw new Error(`Transformer with id ${e} not found`) } transformObjectRecursively(e) { return this.transformValueRecursively(e, "") } getTransformerId(e, n) { return this.canTransform(e, n) ? this.id : null } transformValueRecursively(e, n) { let r = this.getTransformerId(e, n); if (r) { let a = this.transformValue(e, n); return a === void 0 ? void 0 : {__transformerId: r, transformedValue: a} } if (e === null) return null; if (typeof e != "object") return e; if (Array.isArray(e)) return e.map((a, l) => this.transformValueRecursively(a, String(l))); let o = e; if (o.__transformerId) return this.getTransformer(o.__transformerId).restoreValue(o.transformedValue, n); let s = {}; for (let a of nn(e)) { let l = e[a], u = this.transformValueRecursively(l, a); s[a] = u } return s } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Ve = class extends xt { static { i(this, "TypedTransformer") } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Mi = class extends Ve { static { i(this, "DateTransformer") } get id() { return "date" } canTransform(e) { return e instanceof Date } restoreValue(e) { return new Date(e) } transformValue(e) { return e.toISOString() } }; var qc = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Ri = class extends Ve { static { i(this, "DurationTransformer") } get id() { return "duration" } canTransform(e) { let n = e ?? {}; return !!n.asHours && !!n.asMinutes && !!n.asSeconds && !!n.asMilliseconds } restoreValue(e) { return qc.moment.duration(e) } transformValue(e) { return e.toISOString() } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Oi = class extends xt { static { i(this, "GroupTransformer") } transformers; constructor(e) { super(), this.transformers = e } get id() { return "group" } canTransform(e, n) { return this.getFirstTransformerThatCanTransform(e, n) !== null } getTransformer(e) { return z(this.transformers.find(n => n.id === e), `No transformer with id ${e} found`) } transformValue(e, n) { let r = this.getFirstTransformerThatCanTransform(e, n); return Ge(r, "No transformer can transform the value"), r.transformValue(e, n) } getTransformerId(e, n) { let r = this.getFirstTransformerThatCanTransform(e, n); return r === null ? null : r.id } restoreValue() { throw new Error("GroupTransformer does not support restoring values") } getFirstTransformerThatCanTransform(e, n) { return this.transformers.find(r => r.canTransform(e, n)) ?? null } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Ni = class extends Ve { static { i(this, "MapTransformer") } get id() { return "map" } canTransform(e) { return e instanceof Map } restoreValue(e) { return new Map(e) } transformValue(e) { return Array.from(e.entries()) } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Di = class extends Ve { static { i(this, "SetTransformer") } get id() { return "set" } canTransform(e) { return e instanceof Set } restoreValue(e) { return new Set(e) } transformValue(e) { return Array.from(e) } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Ew = "_", Bi = class extends xt { static { i(this, "SkipPrivatePropertyTransformer") } get id() { return "skip-private-property" } canTransform(e, n) { return n.startsWith(Ew) } transformValue() { } restoreValue() { throw new Error("SkipPrivatePropertyTransformer does not support restoring values") } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var or = class { static { i(this, "TwoWayMap") } keyValueMap = new Map; valueKeyMap = new Map; constructor(e = []) { for (let [n, r] of e) this.set(n, r) } clear() { this.keyValueMap.clear(), this.valueKeyMap.clear() } deleteKey(e) { let n = this.getValue(e); n !== void 0 && this.valueKeyMap.delete(n), this.keyValueMap.delete(e) } deleteValue(e) { let n = this.getKey(e); n !== void 0 && this.keyValueMap.delete(n), this.valueKeyMap.delete(e) } entries() { return this.keyValueMap.entries() } getKey(e) { return this.valueKeyMap.get(e) } getValue(e) { return this.keyValueMap.get(e) } hasKey(e) { return this.keyValueMap.has(e) } hasValue(e) { return this.valueKeyMap.has(e) } keys() { return this.keyValueMap.keys() } set(e, n) { this.deleteKey(e), this.deleteValue(n), this.keyValueMap.set(e, n), this.valueKeyMap.set(n, e) } values() { return this.valueKeyMap.keys() } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var _i = class extends Ve { static { i(this, "TwoWayMapTransformer") } get id() { return "two-way-map" } canTransform(e) { return e instanceof or } restoreValue(e) { return new or(e) } transformValue(e) { return Array.from(e.entries()) } }; i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function At(t, e) { t.register(() => { e.asyncEventSource.offref(e) }) } i(At, "registerAsyncEvent"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Pw = new Oi([new Bi, new Mi, new Ri, new Ni, new Di, new _i]), Vi = class extends j { static { i(this, "PluginSettingsComponentBase") } defaultSettings; asyncEvents = new It; currentState; dataHandler; lastSavedState; legacySettingsConverters = []; pluginEventSource; pluginSettingsClass; propertyNames; validators = new Map; constructor(e) { super(), this.dataHandler = e.dataHandler, this.pluginSettingsClass = e.pluginSettingsClass, this.pluginEventSource = e.pluginEventSource, this.defaultSettings = new this.pluginSettingsClass, this.currentState = this.createDefaultState(), this.lastSavedState = this.createDefaultState(), this.propertyNames = nn(this.currentState.inputValues), this.registerValidators(), this.registerLegacySettingsConverters() } get settings() { return this.settingsState.effectiveValues } get settingsState() { return this.currentState } async editAndSave(e, n) { this.ensureLoaded(), await this.edit(e), await this.saveToFile(n) } async ensureSafe(e) { let n = await this.validate(e), r = this.defaultSettings; for (let o of this.propertyNames) n[o] && (e[o] = r[o]) } async getSafeCopy(e) { let n = await this.cloneSettings(e); return await this.ensureSafe(n), n } async loadFromFile(e) { this.ensureLoaded(); let n = await this.dataHandler.loadData(); this.lastSavedState = this.createDefaultState(), this.currentState = this.createDefaultState(); try { if (n == null) return; if (typeof n != "object") { console.error(`Invalid settings from data.json. Expected Object, got: ${typeof n}`); return } let r = n, o = await this.rawRecordToSettings(r), s = await this.validate(o); for (let l of this.propertyNames) this.setPropertyImpl(l, o[l], s[l]); this.lastSavedState = await this.cloneState(this.currentState); let a = await this.settingsToRawRecord(this.currentState.inputValues); De(a, n) || await this.saveToFileImpl() } finally { await this.asyncEvents.triggerAsync("loadSettings", this.currentState, e) } } off(e, n) { this.asyncEvents.off(e, n) } offref(e) { this.asyncEvents.offref(e) } on(e, n, r) { return this.asyncEvents.on(e, n, r) } once(e, n, r) { return this.asyncEvents.once(e, n, r) } async onExternalSettingsChange() { this.ensureLoaded(), await this.loadFromFile(!1) } async onloadAsync() { At(this, this.on("loadSettings", this.onLoadSettings.bind(this))), At(this, this.on("saveSettings", this.onSaveSettings.bind(this))), At(this, this.pluginEventSource.on("externalSettingsChange", this.onExternalSettingsChange.bind(this))), await this.loadFromFile(!0) } registerLegacySettingsConverter(e, n) { let r = this; this.legacySettingsConverters.push(o); function o(s) { let a = new Set(Object.keys(new e)), l = new Set(r.propertyNames), u = s; n(u); for (let c of Object.keys(u)) l.has(c) || a.has(c) && delete s[c] } i(o, "legacySettingsConverter") } registerValidator(e, n) { this.validators.set(e, n) } async revalidate() { return this.ensureLoaded(), await this.edit(ge), this.currentState.validationMessages } async saveToFile(e) { this.ensureLoaded(), !De(this.lastSavedState.inputValues, this.currentState.inputValues) && (await this.saveToFileImpl(), await this.asyncEvents.triggerAsync("saveSettings", this.currentState, this.lastSavedState, e), this.lastSavedState = await this.cloneState(this.currentState)) } async setProperty(e, n) { return this.ensureLoaded(), await this.edit(r => { r[e] = n }), this.currentState.validationMessages[e] } async validate(e) { let n = {}; for (let [r, o] of this.validators.entries()) { let s = await o(e[r], e); s && (n[r] = s) } return n } getTransformer() { return Pw } async onLoadRecord(e) { for (let n of this.legacySettingsConverters) n(e); await $e() } async onLoadSettings(e, n) { await $e() } async onSaveSettings(e, n, r) { await $e() } async onSavingRecord(e) { await $e() } registerLegacySettingsConverters() { } registerValidators() { } async cloneSettings(e) { let n = await this.settingsToRawRecord(e), r = JSON.stringify(n), o = JSON.parse(r); return await this.rawRecordToSettings(o) } async cloneState(e) { return { effectiveValues: await this.cloneSettings(e.effectiveValues), inputValues: await this.cloneSettings(e.inputValues), validationMessages: {...e.validationMessages} } } createDefaultState() { return { effectiveValues: new this.pluginSettingsClass, inputValues: new this.pluginSettingsClass, validationMessages: {} } } async edit(e) { try { await e(this.currentState.inputValues) } finally { let n = await this.validate(this.currentState.inputValues); for (let r of this.propertyNames) { let o = n[r] ?? ""; this.currentState.validationMessages[r] = o; let s = this.defaultSettings; this.currentState.effectiveValues[r] = o ? s[r] : this.currentState.inputValues[r] } } } isValidPropertyName(e) { return typeof e != "string" ? !1 : this.propertyNames.includes(e) } async rawRecordToSettings(e) { e = this.getTransformer().transformObjectRecursively(e), await this.onLoadRecord(e); let n = new this.pluginSettingsClass, r = this.defaultSettings; for (let [o, s] of Object.entries(e)) { if (!this.isValidPropertyName(o)) { K("PluginSettingsComponentBase:rawRecordToSettings")(`Unknown property: ${o}`); continue } typeof s != typeof r[o] && K("PluginSettingsComponentBase:rawRecordToSettings")("Possible invalid value type. It might lead to an unexpected behavior of the plugin. There is also a chance it is a false-negative warning, as we are unable to determine the exact type of the value in runtime.", { defaultValue: r[o], propertyName: o, value: s }), n[o] = s } return n } async saveToFileImpl() { await this.dataHandler.saveData(await this.settingsToRawRecord(this.currentState.inputValues)) } setPropertyImpl(e, n, r) { let o = this.defaultSettings; this.currentState.inputValues[e] = n, this.currentState.validationMessages[e] = r ?? "", this.currentState.effectiveValues[e] = r ? o[e] : n } async settingsToRawRecord(e) { let n = {}; for (let r of this.propertyNames) n[r] = e[r]; return await this.onSavingRecord(n), this.getTransformer().transformObjectRecursively(n) } }; var zi = class { static { i(this, "PluginSettings") } shouldHandleRenames = !0; shouldShowInitializationNotice = !0 }; var $i = class extends Vi { static { i(this, "PluginSettingsComponent") } constructor(e) { super({...e, pluginSettingsClass: zi}) } }; var Qs = require("obsidian"); var jt = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function Wi(t) { let e = t.parentElement; if (Ge(e, "Element must be attached to the DOM"), e.classList.contains(Re.SettingComponentWrapper)) return e; let n = Array.from(e.children), r = createDiv(); tt(r, Re.SettingComponentWrapper); for (let o of n) r.appendChild(o); return e.appendChild(r), r } i(Wi, "ensureWrapped"); var Jc = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Js = class { static { i(this, "AbstractTextComponentWrapper") } abstractTextComponent; constructor(e) { this.abstractTextComponent = e } empty() { this.abstractTextComponent.setValue("") } isEmpty() { return this.abstractTextComponent.getValue() === "" } setPlaceholderValue(e) { return this.abstractTextComponent.setPlaceholder(e), this } }; function Yc(t) { return Tw(t) ? t : t instanceof Jc.AbstractTextComponent ? new Js(t) : null } i(Yc, "getTextBasedComponentValue"); function Tw(t) { let e = t; return typeof e.setPlaceholderValue == "function" && typeof e.isEmpty == "function" } i(Tw, "isTextBasedComponent"); var he = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Ui = class { static { i(this, "OverlayValidatorComponent") } el; constructor(e) { this.el = e; let n = Wi(e); this._validatorEl = n.createEl("input", {attr: {tabindex: -1}}), tt(this._validatorEl, Re.OverlayValidator), this._validatorEl.addEventListener("focus", () => { this.el.focus() }), this._validatorEl.isActiveElement = this.isElementOrDescendantActive.bind(this); let r = this.el.querySelector("[tabindex]"); r || (this.el.getAttr("tabindex") === null && (this.el.tabIndex = -1), r = this.el), this.el.addEventListener("focusin", () => { this.forceBlurValidatorEl() }), this.el.addEventListener("click", () => { r.focus() }), this.el.addEventListener("focusout", () => { window.setTimeout(() => { this.isElementOrDescendantActive() || this.forceBlurValidatorEl() }, 0) }) } _validatorEl; get validatorEl() { return this._validatorEl } forceBlurValidatorEl() { this._validatorEl.dispatchEvent(new Event("blur")) } isElementOrDescendantActive() { return this.el.contains(activeDocument.activeElement) } }, vt = class { static { i(this, "ValidatorElementWrapper") } validatorEl constructor(e) { this.validatorEl = e } }; function Qc(t) { return Fw(t) ? t : t instanceof he.ColorComponent ? new vt(t.colorPickerEl) : t instanceof he.DropdownComponent ? new vt(t.selectEl) : t instanceof he.ProgressBarComponent ? new Ui(t.progressBar) : t instanceof he.SearchComponent ? new vt(t.inputEl) : t instanceof he.SliderComponent ? new vt(t.sliderEl) : t instanceof he.TextAreaComponent ? new vt(t.inputEl) : t instanceof he.TextComponent ? new vt(t.inputEl) : t instanceof he.ToggleComponent ? new Ui(t.toggleEl) : null } i(Qc, "getValidatorComponent"); function Fw(t) { return typeof t == "object" && t !== null && "validatorEl" in t && !!t.validatorEl } i(Fw, "isValidatorComponent"); var Lw = require("obsidian"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); function Xc(t) { return t.validationMessage !== void 0 } i(Xc, "isValidationMessageHolder"); i((function () { if (globalThis.process) return; let e = { browser: !0, cwd() { return "/" }, env: {}, platform: "android" }; globalThis.process = e }), "initEsm")(); var Ys = "PluginSettingsTab", Hi = class extends hr()(jt.PluginSettingTab) { static { i(this, "PluginSettingsTabBase") } pluginSettingsComponent; component; saveSettingsDebounced; constructor(e) { super(e.plugin.app, e.plugin), this.pluginSettingsComponent = e.pluginSettingsComponent, tt(this.containerEl, Re.PluginSettingsTab), this.saveSettingsDebounced = (0, jt.debounce)(Nn(() => this.pluginSettingsComponent.saveToFile(Ys)), this.saveSettingsDebounceTimeoutInMilliseconds), this.component = new j } get saveSettingsDebounceTimeoutInMilliseconds() { return 2e3 } _isOpen = !1; get isOpen() { return this._isOpen } get pluginSettings() { return this.pluginSettingsComponent.settingsState.inputValues } bind(e, n, r) { let s = { ...{ componentToPluginSettingsValueConverter: i(C => C, "componentToPluginSettingsValueConverter"), onChanged: ge, pluginSettingsToComponentValueConverter: i(C => C, "pluginSettingsToComponentValueConverter"), shouldResetSettingWhenComponentIsEmpty: !0, shouldShowPlaceholderForDefaultValues: !0, shouldShowValidationMessage: !0 }, ...r }, a = Qc(e)?.validatorEl, l = Yc(e), u = this.getPluginSettingsProperty(n), f = this.pluginSettingsComponent.defaultSettings[n], d = s.pluginSettingsToComponentValueConverter(f); l?.setPlaceholderValue(d); let h, p = null, w = null; if (a) { let C = Wi(a); p = C.createDiv(), tt(p, [Re.Tooltip, Re.TooltipValidator]), w = p.createSpan(); let O = p.createDiv(); tt(O, Re.TooltipArrow), p.hide(), C.appendChild(p) } At(this.component, this.on("validationMessageChanged", (C, O) => { n === C && (h = O, v()) })); let y = !1, b = !1; l && s.shouldShowPlaceholderForDefaultValues && De(u, f) ? l.empty() : e.setValue(s.pluginSettingsToComponentValueConverter(u)); let k = !1, v = (0, jt.debounce)(() => { window.requestAnimationFrame(() => { L() }) }, 100); return e.onChange(Nn(async C => { if (k) { k = !1; return } y = !1; let O = this.getPluginSettingsProperty(n), W, I = !0; if (b = !!l?.isEmpty() && s.shouldResetSettingWhenComponentIsEmpty, b) W = f; else { let D = s.componentToPluginSettingsValueConverter(C); Xc(D) ? (h = D.validationMessage, I = !1) : W = D } I && (h = await this.pluginSettingsComponent.setProperty(n, W), l && s.shouldShowPlaceholderForDefaultValues && !l.isEmpty() && De(W, f) && (y = !0)), v(), I && await s.onChanged(W, O), this.saveSettingsDebounced() })), a?.addEventListener("focus", () => { v() }), a?.addEventListener("blur", () => { v() }), a?.addEventListener("click", () => { window.requestAnimationFrame(() => { v() }) }), h = this.pluginSettingsComponent.settingsState.validationMessages[n] ?? "", v(), e; function L() { a?.isActiveElement() || (y ? (y = !1, l?.isEmpty() || (k = !0, l?.empty())) : b && (b = !1, l?.isEmpty() && (k = !0, e.setValue(d)))), a && (Ge(w), h === "" && (a.setCustomValidity(""), a.checkValidity(), h = a.validationMessage), a.setCustomValidity(h), s.shouldShowValidationMessage ? (w.textContent = h, p?.toggle(!!h)) : h && (0, jt.setTooltip)(a, h)) } i(L, "updateValidatorEl") } display() { this.containerEl.empty(), this._isOpen = !0, this.component.load(), At(this.component, this.pluginSettingsComponent.on("loadSettings", this.onLoadSettings.bind(this))), At(this.component, this.pluginSettingsComponent.on("saveSettings", this.onSaveSettings.bind(this))) } hide() { super.hide(), this.saveSettingsDebounced.cancel(), this._isOpen = !1, this.component.unload(), ae(() => this.hideAsync()) } async hideAsync() { await this.pluginSettingsComponent.saveToFile(Ys) } show() { this.app.setting.openTab(this) } async onLoadSettings(e, n) { this.display(), await $e() } async revalidate() { let e = await this.pluginSettingsComponent.revalidate(); await this.updateValidations(e) } getPluginSettingsProperty(e) { return this.pluginSettings[e] } async onSaveSettings(e, n, r) { if (r === Ys) { await this.updateValidations(e.validationMessages); return } this.display() } async updateValidations(e) { for (let [n, r] of Object.entries(e)) await this.triggerAsync("validationMessageChanged", n, r) } }; var ji = class extends Hi { static { i(this, "PluginSettingsTab") } display() { super.display(), new Qs.Setting(this.containerEl).setName("Should show initialization notice").setDesc("Whether to show a notice when the plugin is being initialized").addToggle(e => { this.bind(e, "shouldShowInitializationNotice") }), new Qs.Setting(this.containerEl).setName("Should handle renames").setDesc(createFragment(e => { e.appendText("Whether to handle renames."), e.createEl("br"), e.appendText("If enabled, it overrides the default Obsidian link update mechanism."), e.createEl("br"), e.appendText("If disabled, it will use the default Obsidian link update mechanism."), e.createEl("br"), e.appendText("\u26A0\uFE0F Default Obsidian link update mechanism can ruin some of your frontmatter links.") })).addToggle(e => { this.bind(e, "shouldHandleRenames") }) } }; var tf = require("obsidian"); var Zc = !1, En = new WeakMap; function nf(t) { let e = t.app.metadataTypeManager.registeredTypeWidgets.text, n = t.addChild(new Fe); n.registerPatch(e, {render: i(r => (o, s, a) => of(o, s, a, r, t), "render")}), n.registerPatch(tf.AbstractInputSuggest.prototype, { getValue: i(r => i(function () { return Mw(r, this, t) }, "getValuePatched"), "getValue") }) } i(nf, "patchTextPropertyWidgetComponent"); var ef = !1; function rf() { let t = window.getSelection(); return !t || t.rangeCount === 0 ? 0 : t.getRangeAt(0).startOffset } i(rf, "getCaretCharacterOffset"); function Iw(t) { return _e(t.value) } i(Iw, "getParseLinkResult"); function Mw(t, e, n) { if (!ef) { let u = at(e); n.addChild(new Fe).registerPatch(u, { selectSuggestion: i(f => i(function (h, p) { Ow(f, this, h, p) }, "selectSuggestionPatched"), "selectSuggestion") }), ef = !0 } let r = t.call(e); if (!En.has(e.textInputEl)) return r; let o = rf(), s = r.slice(0, o), a = s.lastIndexOf("[["), l = s.lastIndexOf("]]"); return a < 0 || a < l ? r : (En.set(e.textInputEl, {from: a, to: o}), r.slice(a, o)) } i(Mw, "getValue"); function Rw(t, e) { let n = Iw(t); n?.isExternal && n.hasAngleBrackets ? t.value = z(n.encodedUrl) : n?.isEmbed && (t.value = n.raw.slice(1)), e.call(t) } i(Rw, "render"); function of(t, e, n, r, o) { if (typeof e != "string") return r(t, e, n); let s = e; if (!Zc) { let p = t.createDiv(), w = r(p, "", n), y = at(w); o.addChild(new Fe).registerPatch(y, { render: i(k => i(function () { Rw(this, k) }, "renderPatched"), "render") }), Zc = !0, p.remove() } let a = { ...n, onChange: i(p => { n.onChange(p), window.requestAnimationFrame(() => { t.empty(), of(t, p, n, r, o) }) }, "onChange") }, l = ft(s); t.addClass("frontmatter-markdown-links", "text-property-widget-component"); let u = t.createDiv("metadata-property-value"), c = l.length > 0 && l[0]?.raw !== s; if (c) { let p = 0; for (let w of l) h(p, w.startOffset), h(w.startOffset, w.endOffset), p = w.endOffset; h(p, s.length) } let f = r(t, s, a); return c && (f.inputEl.hide(), d(f), t.appendChild(u), f.inputEl.addEventListener("blur", () => { f.inputEl.hide(), d(f), u.show() }), En.set(f.inputEl, {from: 0, to: 0})), f; function d(p) { p.containerEl.find(".metadata-link")?.hide() } i(d, "hideMetadataLink"); function h(p, w) { if (p >= w) return; let y = s.slice(p, w), b = u.createDiv("metadata-property-value"); r(b, y, n).inputEl.addEventListener("focus", () => { window.requestAnimationFrame(() => { let x = rf(); u.hide(), f.inputEl.show(), f.inputEl.focus(); let v = f.inputEl.win.getSelection(); if (!v || !f.inputEl.firstChild) return; let P = f.inputEl.doc.createRange(); P.setStart(f.inputEl.firstChild, p + x), P.collapse(!0), v.removeAllRanges(), v.addRange(P) }) }) } i(h, "createChildWidget") } i(of, "renderWidget"); function Ow(t, e, n, r) { if (!En.has(e.textInputEl)) { t.call(e, n, r); return } let o = e.textInputEl.textContent; t.call(e, n, r); let s = e.textInputEl.textContent, {from: a, to: l} = z(En.get(e.textInputEl)); En.set(e.textInputEl, {from: 0, to: 0}); let u = o.slice(0, a) + s + o.slice(l); t.call(e, {...n, text: u, type: "text"}, r) } i(Ow, "selectSuggestion"); var sr = "https://EXTERNAL_LINK_PREFIX.com/", Ki = class extends Fi { static { i(this, "Plugin") } currentlyProcessingFiles = new Set; externalLinkMaxId = 0; externalLinks = new Map; frontmatterMarkdownLinksCache = new ir; isBasesExternalLinkPatched = !1; isBasesViewPatched = !1; isEditorPatched = !1; monkeyAroundComponent; pluginSettingsComponent; constructor(e, n) { super(e, n), this.monkeyAroundComponent = this.addChild(new Fe), this.pluginSettingsComponent = this.addChild(new $i({ dataHandler: new Ci(this), pluginEventSource: new Li(this) })), this.addChild(new Tr({ plugin: this, pluginSettingsTab: new ji({plugin: this, pluginSettingsComponent: this.pluginSettingsComponent}) })), this.addChild(new on(e, () => { this.onLayoutReady() })) } async onload() { await super.onload(), nf(this), Gc(this), Hc(this), this.register(() => { ae(this.clearMetadataCache.bind(this)) }), this.register(this.refreshMarkdownViews.bind(this)), this.refreshMarkdownViews() } basesExternalLinkRenderTo(e, n, r, o) { e.call(n, r, o), this.fixExternalLinks(r) } basesListRenderTo(e, n, r, o) { e.call(n, r, o), this.fixExternalLinks(r) } async clearMetadataCache() { for (let e of this.frontmatterMarkdownLinksCache.getFilePaths()) { let n = this.app.metadataCache.getCache(e); if (!n?.frontmatterLinks) continue; let r = new Set(this.frontmatterMarkdownLinksCache.getKeys(e)); n.frontmatterLinks = n.frontmatterLinks.filter(a => !r.has(a.key)), n.frontmatterLinks.length === 0 && delete n.frontmatterLinks; let o = this.app.vault.getFileByPath(e); if (!o) continue; let s = await this.app.vault.read(o); this.app.metadataCache.trigger("changed", o, s, n) } } fixExternalLinks(e) { let n = e.querySelectorAll("a"); for (let r of n) { if (!r.href.toLowerCase().startsWith(sr.toLowerCase())) continue; let o = Number(r.href.slice(sr.length)), s = this.externalLinks.get(o); if (!s) return; this.externalLinks.delete(o), r.href = s.url, r.setText(s.alias ?? s.url) } } getClickableTokenAt(e, n, r) { let o = e.call(n, r); if (o) return o; let s = n.posToOffset(r), {node: a} = n.cm.domAtPos(s), u = (a.instanceOf(HTMLElement) ? a : a.parentElement)?.closest(".cm-hmd-frontmatter"); if (!u) return null; let c = u.find("[data-frontmatter-markdown-links-link-data]:is(.cm-hmd-internal-link, .cm-url)"); if (!c) return null; let f = nr(c); if (!f) return null; let d = n.offsetToPos(n.cm.posAtDOM(c)), h = d, p = u.find(".cm-formatting-link-end") ?? c.nextElementSibling; return p && (h = n.offsetToPos(n.cm.posAtDOM(p))), o = { end: h, start: d, text: f.url, type: f.isExternalUrl ? "external-link" : "internal-link" }, o } async handleActiveLeafChange(e) { if (this.isBasesViewPatched || !this.app.internalPlugins.getEnabledPluginById(ke.Bases) || !e || e.view.getViewType() !== Tt.Bases) return; await e.loadIfDeferred(), await Pr(); let o = e.view.controller.ctx.constructor, s = this.app.vault.getMarkdownFiles()[0], a = !1; s || (s = await this.app.vault.create(`__TEMP__${window.crypto.randomUUID()}.md`, ""), a = !0); let l = new o(this.app, {}, {}, s), u = this; this.monkeyAroundComponent.registerPatch(at(l._local.note), { get: i(c => i(function (d) { return u.noteGet(c, this, d) }, "getPatched"), "get") }), a && await zt(this.app, s), this.isBasesViewPatched = !0 } handleDelete(e) { this.frontmatterMarkdownLinksCache.delete(e.path) } handleFileOpen() { if (this.isEditorPatched || !this.app.workspace.activeEditor?.editor) return; this.isEditorPatched = !0; let e = this; this.monkeyAroundComponent.registerPatch(this.app.workspace.activeEditor.editor.constructor.prototype, { getClickableTokenAt: i(n => i(function (o) { return e.getClickableTokenAt(n, this, o) }, "getClickableTokenAtPatched"), "getClickableTokenAt") }) } handleMetadataCacheChanged(e, n, r) { ae(async () => { await this.processFrontmatterLinksInFile(e, r, n) }) } handleMouseDown(e) { if (e.button === 2 || !Ee.Keymap.isModEvent(e) && rr(this.app)) return; let r = e.target; if (!r) return; let o = nr(r); if (o) if (e.preventDefault(), e.stopImmediatePropagation(), r.addEventListener("click", s => { s.preventDefault(), s.stopImmediatePropagation() }, {capture: !0, once: !0}), o.isExternalUrl) window.open(o.url, e.button === 1 ? "tab" : ""); else { let s = this.app.workspace.getActiveFile(); if (!s) return; ae(() => this.app.workspace.openLinkText(o.url, s.path, Ee.Keymap.isModEvent(e))) } } handleMouseOver(e) { let n = this.app.workspace.getActiveViewOfType(Ee.MarkdownView), r = e.target, o = nr(r); o && (o.isExternalUrl || (e.preventDefault(), this.app.workspace.trigger("hover-link", { event: e, hoverParent: this, linktext: o.url, source: n?.getHoverSource() ?? "source", targetEl: r }))) } handleRename(e, n) { e instanceof Ee.TFile && this.frontmatterMarkdownLinksCache.rename(n, e) } noteGet(e, n, r) { let o = n.data[r]; if (!this.isBasesExternalLinkPatched) { this.isBasesExternalLinkPatched = !0; let s = this; n.data[r] = sr; let a = e.call(n, r); this.monkeyAroundComponent.registerPatch(at(a), { renderTo: i(u => i(function (f, d) { s.basesExternalLinkRenderTo(u, this, f, d) }, "renderToPatched"), "renderTo") }), n.data[r] = [sr]; let l = e.call(n, r); this.monkeyAroundComponent.registerPatch(at(l), { renderTo: i(u => i(function (f, d) { s.basesListRenderTo(u, this, f, d) }, "renderToPatched"), "renderTo") }), n.data[r] = o } try { return n.data[r] = this.patchLink(o), e.call(n, r) } finally { n.data[r] = o } } onLayoutReady() { ae(this.processAllNotes.bind(this)), this.registerEvent(this.app.metadataCache.on("changed", this.handleMetadataCacheChanged.bind(this))), this.registerEvent(this.app.vault.on("delete", this.handleDelete.bind(this))), this.registerEvent(this.app.vault.on("rename", this.handleRename.bind(this))), this.registerEvent(this.app.workspace.on("file-open", this.handleFileOpen.bind(this))), this.handleFileOpen(); let e = this; this.monkeyAroundComponent.registerPatch(Ee.Menu.prototype, { showAtMouseEvent: i(r => i(function (s) { return e.showAtMouseEvent(r, this, s) }, "showAtMouseEventPatched"), "showAtMouseEvent") }); let n = this.addChild(new sn(this.app)); n.registerAllDocumentsDomEvent("mousedown", this.handleMouseDown.bind(this), {capture: !0}), n.registerAllDocumentsDomEvent("mouseover", this.handleMouseOver.bind(this), {capture: !0}), ae(async () => { await this.handleActiveLeafChange(this.app.workspace.getLeavesOfType(Tt.Bases)[0] ?? null), this.isBasesViewPatched || this.registerEvent(this.app.workspace.on("active-leaf-change", Nn(this.handleActiveLeafChange.bind(this)))) }), this.addChild(new ki({ abortSignalComponent: this.abortSignalComponent, app: this.app, pluginId: this.manifest.id, settingsBuilder: i(() => ({shouldHandleRenames: this.pluginSettingsComponent.settings.shouldHandleRenames}), "settingsBuilder") })) } patchLink(e) { if (typeof e == "string") { let n = _e(e); return !n || n.isWikilink ? e : n.isExternal ? n.alias === void 0 ? n.url : (this.externalLinkMaxId++, this.externalLinks.set(this.externalLinkMaxId, n), `${sr}${String(this.externalLinkMaxId)}`) : n.alias ? `[[${n.url}|${n.alias}]]` : `[[${n.url}]]` } return Array.isArray(e) ? e.map(n => this.patchLink(n)) : e } async processAllNotes() { this.frontmatterMarkdownLinksCache = new ir, await this.frontmatterMarkdownLinksCache.init(this.app); let e = new Set(this.frontmatterMarkdownLinksCache.getFilePaths()); await _c({ abortSignal: this.abortSignalComponent.abortSignal, buildNoticeMessage: i((n, r) => `Processing frontmatter links ${r} - ${n.path}`, "buildNoticeMessage"), items: sc(this.app), processItem: i(async n => { if (e.delete(n.path), this.frontmatterMarkdownLinksCache.isCacheValid(n)) { let o = this.frontmatterMarkdownLinksCache.getLinks(n); if (o.length === 0) return; let s = await Zn(this.app, n); if (!s) return; s.frontmatterLinks ??= []; let a = new Map; for (let c of s.frontmatterLinks) a.set(c.key, c); let l = new Set(o.map(c => c.key)); Ke(s.frontmatterLinks, c => !l.has(c.key)); let u = []; for (let c of o) { if (ht(s.frontmatter ?? {}, c.key) !== c.original) { this.frontmatterMarkdownLinksCache.deleteKey(n.path, c.key); let d = a.get(c.key); d && (s.frontmatterLinks.push(d), a.delete(c.key)); continue } s.frontmatterLinks.push(c), u.push(c) } for (let c of u) this.updateResolvedOrUnresolvedLinksCache(c.link, n.path); return } let r = await Zn(this.app, n); r && await this.processFrontmatterLinksInFile(n, r) }, "processItem"), progressBarTitle: "Frontmatter Markdown Links: Initializing...", shouldContinueOnError: !0, shouldShowProgressBar: this.pluginSettingsComponent.settings.shouldShowInitializationNotice }); for (let n of e) this.frontmatterMarkdownLinksCache.delete(n) } processFrontmatterLinks(e, n, r, o) { if (typeof e == "string") { this.frontmatterMarkdownLinksCache.deleteKey(o, n); let a = ft(e), l = a[0]?.raw === e, u = !1; Ke(r.frontmatterLinks ?? [], c => c.key !== n); for (let c of a) { if (c.isExternal) continue; r.frontmatterLinks ??= []; let f = l ? {key: n, link: c.url, original: e} : { endOffset: c.endOffset, key: n, link: c.url, original: e, startOffset: c.startOffset }; f.displayText = c.alias ?? c.url, r.frontmatterLinks.push(f), (!l || !c.isWikilink) && (u = !0, this.frontmatterMarkdownLinksCache.add(o, f), this.updateResolvedOrUnresolvedLinksCache(f.link, o)) } return u } if (typeof e != "object" || e === null) return !1; let s = !1; for (let [a, l] of Object.entries(e)) { let u = this.processFrontmatterLinks(l, n ? `${n}.${a}` : a, r, o); s ||= u } return s } async processFrontmatterLinksInFile(e, n, r) { this.frontmatterMarkdownLinksCache.updateFile(e), !(this.currentlyProcessingFiles.has(e.path) || !this.processFrontmatterLinks(n.frontmatter, "", n, e.path)) && (this.currentlyProcessingFiles.add(e.path), r ??= await this.app.vault.read(e), this.app.metadataCache.trigger("changed", e, r, n), this.currentlyProcessingFiles.delete(e.path)) } refreshMarkdownViews() { for (let e of this.app.workspace.getLeavesOfType("markdown")) { if (!(e.view instanceof Ee.MarkdownView)) continue; let n = (0, Ee.parseYaml)(e.view.rawFrontmatter); e.view.metadataEditor.synchronize({}), e.view.metadataEditor.synchronize(n) } } showAtMouseEvent(e, n, r) { let o = r.target; if (!o) return a(); let s = nr(o); if (!s || n.items.some(l => l instanceof Ee.MenuItem && l.section === "open")) return a(); return s.isExternalUrl ? this.app.workspace.handleExternalLinkContextMenu(n, s.url) : this.app.workspace.handleLinkContextMenu(n, s.url, this.app.workspace.getActiveFile()?.path ?? ""), a(); function a() { return e.call(n, r) } i(a, "fallback") } updateResolvedOrUnresolvedLinksCache(e, n) { let {linkPath: r} = vn(e), o = this.app.metadataCache.getFirstLinkpathDest(r, n), s = o ? this.app.metadataCache.resolvedLinks : this.app.metadataCache.unresolvedLinks, a = s[n] ?? {}; s[n] = a; let l = o?.path ?? r; a[l] ??= 0, a[l]++ } }; var Nw = Ki; /* nosourcemap */