initial commit

This commit is contained in:
ben committed 2026-05-17 12:19:19 -07:00
commit fbd12d4a8e
320 files changed
+124298

No files matched your search

BIN
View File
Binary file not shown.
+973
View File
@@ -0,0 +1,973 @@
'use strict';
var obsidian = require('obsidian');
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
// 'path' module extracted from Node.js v8.11.1 (only the posix part)
function assertPath(path) {
if (typeof path !== 'string') {
throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
}
}
// Resolves . and .. elements in a path with directory names
function normalizeStringPosix(path, allowAboveRoot) {
var res = '';
var lastSegmentLength = 0;
var lastSlash = -1;
var dots = 0;
var code;
for (var i = 0; i <= path.length; ++i) {
if (i < path.length)
code = path.charCodeAt(i);
else if (code === 47 /*/*/)
break;
else
code = 47 /*/*/;
if (code === 47 /*/*/) {
if (lastSlash === i - 1 || dots === 1) ; else if (lastSlash !== i - 1 && dots === 2) {
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {
if (res.length > 2) {
var lastSlashIndex = res.lastIndexOf('/');
if (lastSlashIndex !== res.length - 1) {
if (lastSlashIndex === -1) {
res = '';
lastSegmentLength = 0;
} else {
res = res.slice(0, lastSlashIndex);
lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
}
lastSlash = i;
dots = 0;
continue;
}
} else if (res.length === 2 || res.length === 1) {
res = '';
lastSegmentLength = 0;
lastSlash = i;
dots = 0;
continue;
}
}
if (allowAboveRoot) {
if (res.length > 0)
res += '/..';
else
res = '..';
lastSegmentLength = 2;
}
} else {
if (res.length > 0)
res += '/' + path.slice(lastSlash + 1, i);
else
res = path.slice(lastSlash + 1, i);
lastSegmentLength = i - lastSlash - 1;
}
lastSlash = i;
dots = 0;
} else if (code === 46 /*.*/ && dots !== -1) {
++dots;
} else {
dots = -1;
}
}
return res;
}
function _format(sep, pathObject) {
var dir = pathObject.dir || pathObject.root;
var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
if (!dir) {
return base;
}
if (dir === pathObject.root) {
return dir + base;
}
return dir + sep + base;
}
var posix = {
// path.resolve([from ...], to)
resolve: function resolve() {
var resolvedPath = '';
var resolvedAbsolute = false;
var cwd;
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path;
if (i >= 0)
path = arguments[i];
else {
if (cwd === undefined)
cwd = process.cwd();
path = cwd;
}
assertPath(path);
// Skip empty entries
if (path.length === 0) {
continue;
}
resolvedPath = path + '/' + resolvedPath;
resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;
}
// At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// Normalize the path
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
if (resolvedAbsolute) {
if (resolvedPath.length > 0)
return '/' + resolvedPath;
else
return '/';
} else if (resolvedPath.length > 0) {
return resolvedPath;
} else {
return '.';
}
},
normalize: function normalize(path) {
assertPath(path);
if (path.length === 0) return '.';
var isAbsolute = path.charCodeAt(0) === 47 /*/*/;
var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
// Normalize the path
path = normalizeStringPosix(path, !isAbsolute);
if (path.length === 0 && !isAbsolute) path = '.';
if (path.length > 0 && trailingSeparator) path += '/';
if (isAbsolute) return '/' + path;
return path;
},
isAbsolute: function isAbsolute(path) {
assertPath(path);
return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
},
join: function join() {
if (arguments.length === 0)
return '.';
var joined;
for (var i = 0; i < arguments.length; ++i) {
var arg = arguments[i];
assertPath(arg);
if (arg.length > 0) {
if (joined === undefined)
joined = arg;
else
joined += '/' + arg;
}
}
if (joined === undefined)
return '.';
return posix.normalize(joined);
},
relative: function relative(from, to) {
assertPath(from);
assertPath(to);
if (from === to) return '';
from = posix.resolve(from);
to = posix.resolve(to);
if (from === to) return '';
// Trim any leading backslashes
var fromStart = 1;
for (; fromStart < from.length; ++fromStart) {
if (from.charCodeAt(fromStart) !== 47 /*/*/)
break;
}
var fromEnd = from.length;
var fromLen = fromEnd - fromStart;
// Trim any leading backslashes
var toStart = 1;
for (; toStart < to.length; ++toStart) {
if (to.charCodeAt(toStart) !== 47 /*/*/)
break;
}
var toEnd = to.length;
var toLen = toEnd - toStart;
// Compare paths to find the longest common path from root
var length = fromLen < toLen ? fromLen : toLen;
var lastCommonSep = -1;
var i = 0;
for (; i <= length; ++i) {
if (i === length) {
if (toLen > length) {
if (to.charCodeAt(toStart + i) === 47 /*/*/) {
// We get here if `from` is the exact base path for `to`.
// For example: from='/foo/bar'; to='/foo/bar/baz'
return to.slice(toStart + i + 1);
} else if (i === 0) {
// We get here if `from` is the root
// For example: from='/'; to='/foo'
return to.slice(toStart + i);
}
} else if (fromLen > length) {
if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
// We get here if `to` is the exact base path for `from`.
// For example: from='/foo/bar/baz'; to='/foo/bar'
lastCommonSep = i;
} else if (i === 0) {
// We get here if `to` is the root.
// For example: from='/foo'; to='/'
lastCommonSep = 0;
}
}
break;
}
var fromCode = from.charCodeAt(fromStart + i);
var toCode = to.charCodeAt(toStart + i);
if (fromCode !== toCode)
break;
else if (fromCode === 47 /*/*/)
lastCommonSep = i;
}
var out = '';
// Generate the relative path based on the path difference between `to`
// and `from`
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
if (out.length === 0)
out += '..';
else
out += '/..';
}
}
// Lastly, append the rest of the destination (`to`) path that comes after
// the common path parts
if (out.length > 0)
return out + to.slice(toStart + lastCommonSep);
else {
toStart += lastCommonSep;
if (to.charCodeAt(toStart) === 47 /*/*/)
++toStart;
return to.slice(toStart);
}
},
_makeLong: function _makeLong(path) {
return path;
},
dirname: function dirname(path) {
assertPath(path);
if (path.length === 0) return '.';
var code = path.charCodeAt(0);
var hasRoot = code === 47 /*/*/;
var end = -1;
var matchedSlash = true;
for (var i = path.length - 1; i >= 1; --i) {
code = path.charCodeAt(i);
if (code === 47 /*/*/) {
if (!matchedSlash) {
end = i;
break;
}
} else {
// We saw the first non-path separator
matchedSlash = false;
}
}
if (end === -1) return hasRoot ? '/' : '.';
if (hasRoot && end === 1) return '//';
return path.slice(0, end);
},
basename: function basename(path, ext) {
if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
assertPath(path);
var start = 0;
var end = -1;
var matchedSlash = true;
var i;
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
if (ext.length === path.length && ext === path) return '';
var extIdx = ext.length - 1;
var firstNonSlashEnd = -1;
for (i = path.length - 1; i >= 0; --i) {
var code = path.charCodeAt(i);
if (code === 47 /*/*/) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
start = i + 1;
break;
}
} else {
if (firstNonSlashEnd === -1) {
// We saw the first non-path separator, remember this index in case
// we need it if the extension ends up not matching
matchedSlash = false;
firstNonSlashEnd = i + 1;
}
if (extIdx >= 0) {
// Try to match the explicit extension
if (code === ext.charCodeAt(extIdx)) {
if (--extIdx === -1) {
// We matched the extension, so mark this as the end of our path
// component
end = i;
}
} else {
// Extension does not match, so our result is the entire path
// component
extIdx = -1;
end = firstNonSlashEnd;
}
}
}
}
if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;
return path.slice(start, end);
} else {
for (i = path.length - 1; i >= 0; --i) {
if (path.charCodeAt(i) === 47 /*/*/) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
start = i + 1;
break;
}
} else if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// path component
matchedSlash = false;
end = i + 1;
}
}
if (end === -1) return '';
return path.slice(start, end);
}
},
extname: function extname(path) {
assertPath(path);
var startDot = -1;
var startPart = 0;
var end = -1;
var matchedSlash = true;
// Track the state of characters (if any) we see before our first dot and
// after any path separator we find
var preDotState = 0;
for (var i = path.length - 1; i >= 0; --i) {
var code = path.charCodeAt(i);
if (code === 47 /*/*/) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// extension
matchedSlash = false;
end = i + 1;
}
if (code === 46 /*.*/) {
// If this is our first dot, mark it as the start of our extension
if (startDot === -1)
startDot = i;
else if (preDotState !== 1)
preDotState = 1;
} else if (startDot !== -1) {
// We saw a non-dot and non-path separator before our dot, so we should
// have a good chance at having a non-empty extension
preDotState = -1;
}
}
if (startDot === -1 || end === -1 ||
// We saw a non-dot character immediately before the dot
preDotState === 0 ||
// The (right-most) trimmed path component is exactly '..'
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
return '';
}
return path.slice(startDot, end);
},
format: function format(pathObject) {
if (pathObject === null || typeof pathObject !== 'object') {
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
}
return _format('/', pathObject);
},
parse: function parse(path) {
assertPath(path);
var ret = { root: '', dir: '', base: '', ext: '', name: '' };
if (path.length === 0) return ret;
var code = path.charCodeAt(0);
var isAbsolute = code === 47 /*/*/;
var start;
if (isAbsolute) {
ret.root = '/';
start = 1;
} else {
start = 0;
}
var startDot = -1;
var startPart = 0;
var end = -1;
var matchedSlash = true;
var i = path.length - 1;
// Track the state of characters (if any) we see before our first dot and
// after any path separator we find
var preDotState = 0;
// Get non-dir info
for (; i >= start; --i) {
code = path.charCodeAt(i);
if (code === 47 /*/*/) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// extension
matchedSlash = false;
end = i + 1;
}
if (code === 46 /*.*/) {
// If this is our first dot, mark it as the start of our extension
if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
} else if (startDot !== -1) {
// We saw a non-dot and non-path separator before our dot, so we should
// have a good chance at having a non-empty extension
preDotState = -1;
}
}
if (startDot === -1 || end === -1 ||
// We saw a non-dot character immediately before the dot
preDotState === 0 ||
// The (right-most) trimmed path component is exactly '..'
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
if (end !== -1) {
if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);
}
} else {
if (startPart === 0 && isAbsolute) {
ret.name = path.slice(1, startDot);
ret.base = path.slice(1, end);
} else {
ret.name = path.slice(startPart, startDot);
ret.base = path.slice(startPart, end);
}
ret.ext = path.slice(startDot, end);
}
if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';
return ret;
},
sep: '/',
delimiter: ':',
win32: null,
posix: null
};
posix.posix = posix;
var pathBrowserify = posix;
const withSubfolderClass = 'oz-with-subfolder';
const showAllNumbersClass = 'oz-show-all-num';
const isFolder = (item) => item.file instanceof obsidian.TFolder;
const iterateItems = (items, callback) => {
for (const key in items) {
if (!Object.prototype.hasOwnProperty.call(items, key))
continue;
callback(items[key]);
}
};
const getParentPath = (src) => {
if (src === '/')
return null;
const path = pathBrowserify.dirname(src);
if (path === '.')
return '/';
else
return path;
};
const equals = (arr1, arr2) => {
// if the other array is a falsy value, return
if (!Array.isArray(arr1) || !Array.isArray(arr2))
return false;
// compare lengths - can save a lot of time
if (arr1.length != arr2.length)
return false;
return arr1.every((v, i) => v === arr2[i]);
};
const isParent = (parent, child) => {
if (child === parent)
return false;
if (parent === '/')
parent = '';
if (child === '/')
child = '';
const parentTokens = parent.split('/').filter((i) => i.length);
return parentTokens.every((t, i) => child.split('/')[i] === t);
};
// Helper to play with the File Explorer (if exists)
const doWithFileExplorer = (plugin, callback) => {
let leaves;
let count = 0;
const tryGetView = () => {
leaves = plugin.app.workspace.getLeavesOfType('file-explorer');
if (leaves.length === 0) {
if (count++ > 5)
console.error('failed to get file-explorer');
else {
console.log('file-explorer not found, retrying...');
setTimeout(tryGetView, 500);
}
}
else {
if (leaves.length > 1)
console.warn('more then one file-explorer');
callback(leaves[0].view);
}
};
tryGetView();
};
function around(obj, factories) {
const removers = Object.keys(factories).map(key => around1(obj, key, factories[key]));
return removers.length === 1 ? removers[0] : function () { removers.forEach(r => r()); };
}
function around1(obj, method, createWrapper) {
const original = obj[method], hadOwn = obj.hasOwnProperty(method);
let current = createWrapper(original);
// Let our wrapper inherit static props from the wrapping method,
// and the wrapping method, props from the original method
if (original)
Object.setPrototypeOf(current, original);
Object.setPrototypeOf(wrapper, current);
obj[method] = wrapper;
// Return a callback to allow safe removal
return remove;
function wrapper(...args) {
// If we have been deactivated and are no longer wrapped, remove ourselves
if (current === original && obj[method] === wrapper)
remove();
return current.apply(this, args);
}
function remove() {
// If no other patches, just do a direct removal
if (obj[method] === wrapper) {
if (hadOwn)
obj[method] = original;
else
delete obj[method];
}
if (current === original)
return;
// Else pass future calls through, and remove wrapper from the prototype chain
current = original;
Object.setPrototypeOf(wrapper, original || Function);
}
}
const countFolderChildren = (folder, filter) => {
let count = 0;
for (const af of folder.children) {
if (filter(af))
count++;
if (af instanceof obsidian.TFolder)
count += countFolderChildren(af, filter);
}
return count;
};
/** filter out all path that is the parent of existing path */
const filterParent = (pathList) => {
const list = Array.from(pathList);
list.sort();
for (let i = 0; i < list.length; i++) {
if (i < list.length - 1 && (list[i] === list[i + 1] || isParent(list[i], list[i + 1]))) {
list.shift();
i--;
}
}
return new Set(list);
};
/** get all parents and add to set if not exist */
const getAllParents = (path, set) => {
let parent = getParentPath(path);
while (parent && !set.has(parent)) {
set.add(parent);
parent = getParentPath(parent);
}
};
/**
* Update folder count of target's parent
*/
const updateCount = (targetList, plugin) => {
const set = filterParent(targetList);
for (const path of targetList) {
getAllParents(path, set);
}
// set count of path
const { fileExplorer, fileFilter } = plugin;
if (!fileExplorer) {
console.error('fileExplorer missing');
return;
}
for (const path of set) {
// check if path available
if (!fileExplorer.fileItems[path])
continue;
setCount(fileExplorer.fileItems[path], fileFilter);
}
// Update root separately
if (plugin.rootFolderEl && plugin.settings.addRootFolder) {
setupRootCount(plugin);
}
// empty waitingList
targetList.length = 0;
};
const setupRootCount = (plugin) => {
if (plugin.rootFolderEl) {
let rootFolderElChildren = plugin.rootFolderEl.children;
if (rootFolderElChildren && rootFolderElChildren.length > 0) {
let totalCount = countFolderChildren(plugin.app.vault.getAbstractFileByPath('/'), plugin.fileFilter);
rootFolderElChildren[0].setAttr('data-count', totalCount.toString());
}
}
};
const setupCount = (plugin, revert = false) => {
if (!plugin.fileExplorer)
throw new Error('fileExplorer not found');
// For each setup, first setup the root folder
plugin.setupRootFolder();
setupRootCount(plugin);
// Iterate other items and include new counts
iterateItems(plugin.fileExplorer.fileItems, (item) => {
if (!isFolder(item))
return;
if (revert)
removeCount(item);
else
setCount(item, plugin.fileFilter);
});
};
const setCount = (item, filter) => {
// if (item.file.isRoot()) return;
const count = countFolderChildren(item.file, filter);
item.selfEl.dataset['count'] = count.toString();
item.selfEl.toggleClass(withSubfolderClass, Array.isArray(item.file.children) && item.file.children.some((af) => af instanceof obsidian.TFolder));
};
const removeCount = (item) => {
if (item.selfEl.dataset['count'])
delete item.selfEl.dataset['count'];
item.selfEl.removeClass(withSubfolderClass);
};
class VaultHandler {
get app() {
return this.plugin.app;
}
get vault() {
return this.plugin.app.vault;
}
constructor(plugin) {
this.waitingList = [];
this.update = obsidian.debounce(() => updateCount(this.waitingList, this.plugin), 500, true);
this.handler = (...args) => {
var _a;
for (const arg of args) {
const path = arg instanceof obsidian.TAbstractFile ? arg.path : arg;
this.waitingList.push((_a = getParentPath(path)) !== null && _a !== void 0 ? _a : '/');
}
this.update();
};
this.registerVaultEvent = () => {
this.plugin.registerEvent(this.vault.on('create', this.handler));
this.plugin.registerEvent(this.vault.on('rename', this.handler));
this.plugin.registerEvent(this.vault.on('delete', this.handler));
};
this.plugin = plugin;
}
}
const DEFAULT_SETTINGS = {
showAllNumbers: false,
filterList: ['md'],
blacklist: false,
addRootFolder: false,
};
class FENoteCountSettingTab extends obsidian.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
get showOnlyNoteValue() {
const { settings } = this.plugin;
return settings.blacklist === DEFAULT_SETTINGS.blacklist && equals(settings.filterList, DEFAULT_SETTINGS.filterList);
}
set showOnlyNoteValue(value) {
const { blacklist, filterList } = DEFAULT_SETTINGS;
this.plugin.settings.blacklist = blacklist;
if (value) {
// do deep copy
this.plugin.settings.filterList = Array.from(filterList);
}
else {
this.plugin.settings.filterList.length = 0;
}
}
display() {
let { containerEl } = this;
containerEl.empty();
containerEl.createEl('h2', {
text: 'File Explorer Note Count Settings',
});
new obsidian.Setting(containerEl)
.setName('Show All Numbers')
.setDesc('Turn on this option if you want to see the number of notes even after you expand the collapsed folders')
.addToggle((toggle) => toggle.setValue(this.plugin.settings.showAllNumbers).onChange((value) => {
document.body.toggleClass('oz-show-all-num', value);
this.plugin.settings.showAllNumbers = value;
this.plugin.saveSettings();
}));
new obsidian.Setting(containerEl)
.setName('Add Root Folder')
.setDesc('By default, there is no root folder provided by Obsidian. It is moved to drop-down menu to switch between vaults. ' +
'Enable this option if you want to see root folder and its count in the file explorer')
.addToggle((toggle) => toggle.setValue(this.plugin.settings.addRootFolder).onChange((value) => {
this.plugin.settings.addRootFolder = value;
this.plugin.saveSettings();
this.plugin.reloadCount();
}));
this.filterOpt();
}
filterOpt() {
new obsidian.Setting(this.containerEl)
.setName('Show Only Markdown Notes')
.setDesc('Turn off this option to choose file that should be counted')
.addToggle((toggle) => toggle.setValue(this.showOnlyNoteValue).onChange((value) => {
this.showOnlyNoteValue = value;
this.plugin.reloadCount();
this.plugin.saveSettings();
this.display();
}));
if (!this.showOnlyNoteValue) {
new obsidian.Setting(this.containerEl)
.setName('Filter List')
.setDesc(createFragment((descEl) => {
descEl.appendText('Extension list to include/exclude file during counting');
descEl.appendChild(document.createElement('br'));
descEl.appendText('Separated by comma');
}))
.addTextArea((text) => {
const onChange = (value) => __awaiter(this, void 0, void 0, function* () {
const list = value.split(',').map((v) => v.trim());
this.plugin.settings.filterList = list;
this.plugin.reloadCount();
yield this.plugin.saveSettings();
});
text.setPlaceholder('Leave it empty to count all types of files');
text.setValue(this.plugin.settings.filterList.join(', ')).onChange(obsidian.debounce(onChange, 500, true));
text.inputEl.rows = 2;
text.inputEl.cols = 25;
});
new obsidian.Setting(this.containerEl)
.setName('Enable Blacklist')
.setDesc('Turn on this option to use Filter List to exclude files')
.addToggle((toggle) => toggle.setValue(this.plugin.settings.blacklist).onChange((value) => {
this.plugin.settings.blacklist = value;
this.plugin.reloadCount();
this.plugin.saveSettings();
}));
}
}
}
class FileExplorerNoteCount extends obsidian.Plugin {
constructor() {
super(...arguments);
this.settings = DEFAULT_SETTINGS;
this.vaultHandler = new VaultHandler(this);
this.rootFolderEl = null;
this.explorerNavHeaderSelector = '.workspace-leaf-content[data-type="file-explorer"] .nav-header';
this.rootFolderClassName = 'oz-explorer-root-folder';
this.initialize = (revert = false) => {
let plugin = this;
// First Check if the root folder exists
let explorerHeaderEl = document.querySelector(`${this.explorerNavHeaderSelector} .${this.rootFolderClassName}`);
if (explorerHeaderEl)
this.rootFolderEl = explorerHeaderEl;
const getViewHandler = (revert) => (view) => {
this.fileExplorer = view;
setupCount(this, revert);
this.setupRootFolder(revert);
if (!revert) {
this.registerEvent(this.app.workspace.on('css-change', this.setupRootFolder));
this.vaultHandler.registerVaultEvent();
if (this.settings.showAllNumbers)
document.body.addClass('oz-show-all-num');
}
else {
for (const el of document.getElementsByClassName(withSubfolderClass)) {
el.removeClass(withSubfolderClass);
}
document.body.removeClass(showAllNumbersClass);
}
if (!revert) {
// when file explorer is closed (workspace changed)
// try to update fehanlder with new file explorer instance
this.register(around(view, {
onClose: (next) => function () {
setTimeout(() => doWithFileExplorer(plugin, getViewHandler(false)), 1e3);
return next.apply(this);
},
}));
}
};
doWithFileExplorer(plugin, getViewHandler(revert));
};
this.setupRootFolder = (revert = false) => {
var _a, _b, _c;
if (!this.fileExplorer) {
console.error('file-explorer not found');
return;
}
if (this.rootFolderEl && !this.settings.addRootFolder) {
this.rootFolderEl.remove();
this.rootFolderEl = null;
}
// Check if root is provided by Obsidian (it shouldn't be in the new releases)
const root = (_c = (_b = (_a = this.fileExplorer) === null || _a === void 0 ? void 0 : _a.fileItems) === null || _b === void 0 ? void 0 : _b['/']) !== null && _c !== void 0 ? _c : null;
if (!root) {
// Get the Nav Header
let explorerHeaderEl = document.querySelector(this.explorerNavHeaderSelector);
if (!explorerHeaderEl)
return;
if (!this.rootFolderEl && this.settings.addRootFolder) {
this.rootFolderEl = explorerHeaderEl.createEl('div', {
cls: ['tree-item', 'nav-folder', this.rootFolderClassName],
});
let rootTitle = this.rootFolderEl.createEl('div', {
cls: ['oz-explorer-root-nav-folder-title'],
attr: { 'data-path': '/' },
});
let titleContent = rootTitle.createEl('div', {
cls: ['tree-item-inner', 'nav-folder-title-content'],
});
titleContent.textContent = this.app.vault.getName();
}
}
};
}
onload() {
return __awaiter(this, void 0, void 0, function* () {
console.log('loading FileExplorerNoteCount');
this.addSettingTab(new FENoteCountSettingTab(this.app, this));
yield this.loadSettings();
this.app.workspace.onLayoutReady(this.initialize);
});
}
onunload() {
console.log('unloading FileExplorerNoteCount');
this.initialize(true);
}
loadSettings() {
return __awaiter(this, void 0, void 0, function* () {
this.settings = Object.assign(Object.assign({}, this.settings), (yield this.loadData()));
});
}
saveSettings() {
return __awaiter(this, void 0, void 0, function* () {
yield this.saveData(this.settings);
});
}
reloadCount() {
setupCount(this);
}
get fileFilter() {
let list = this.settings.filterList;
return (af) => {
if (af instanceof obsidian.TFile) {
const { extension: target } = af;
// if list is empty, filter nothing
if (list.length === 0)
return true;
else if (this.settings.blacklist)
return !list.includes(target);
else
return list.includes(target);
}
else
return false;
};
}
}
module.exports = FileExplorerNoteCount;
/* nosourcemap */
@@ -0,0 +1,10 @@
{
"id": "file-explorer-note-count",
"name": "File Explorer Note Count",
"version": "1.2.4",
"minAppVersion": "1.2.0",
"description": "The plugin helps you to see the number of notes under each folder within the file explorer.",
"author": "Ozan Tellioglu",
"authorUrl": "https://www.ozan.pl",
"isDesktopOnly": false
}
+34
View File
@@ -0,0 +1,34 @@
.nav-folder-title[data-count]::after {
content: attr(data-count);
display: inline-block;
position: relative;
font-size: calc(100% * 0.8);
margin-right: 4px;
/* border-radius: 3px; */
padding: 2px 0;
/* background-color: var(--background-secondary-alt); */
transition: opacity 100ms ease-in-out;
}
.oz-explorer-root-nav-folder-title {
display: flex;
}
.oz-explorer-root-nav-folder-title[data-count]::after {
content: attr(data-count);
margin-right: 4px;
font-size: calc(100% * 0.8);
display: inline-block;
}
body:not(.oz-show-all-num) .nav-folder:not(.is-collapsed) > .nav-folder-title.oz-with-subfolder[data-count]:not([data-path='/'])::after {
opacity: 0;
}
.nav-folder-title-content {
flex-grow: 1;
}
.oz-explorer-root-folder {
margin-top: 15px;
}
+9
View File
@@ -0,0 +1,9 @@
{
"folderNoteHide": true,
"folderNoteType": "inside",
"folderNoteName": "_about_",
"folderNoteKey": "ctrl",
"folderNoteAutoRename": true,
"folderDelete2Note": false,
"folderNoteStrInit": "# {{FOLDER_NAME}} Overview\n {{FOLDER_BRIEF_LIVE}} \n"
}
File diff suppressed because it is too large. Load diff
+10
View File
@@ -0,0 +1,10 @@
{
"id": "folder-note-plugin",
"name": "Folder Note",
"version": "0.7.3",
"minAppVersion": "0.9.12",
"description": "Click a folder node to show a note describing the folder.",
"author": "xpgo",
"authorUrl": "https://github.com/xpgo/obsidian-folder-note",
"isDesktopOnly": false
}
+229
View File
@@ -0,0 +1,229 @@
/* hide the folder note file node */
div.is-folder-note {
display: none;
}
/* indicate the folder has note */
div.has-folder-note {
color: var(--text-nav-selected);
}
/*---------------------------------------------
Cute card view
-----------------------------------------------*/
.cute-card-band {
width: 100%;
max-width: 900px;
margin: 0 auto;
margin-top: 15px;
margin-bottom: 5px;
display: grid;
grid-template-columns: 1fr;
grid-template-rows: auto;
grid-gap: 20px;
}
@media (min-width: 30em) {
.cute-card-band {
grid-template-columns: 1fr 1fr;
}
}
@media (min-width: 60em) {
.cute-card-band {
grid-template-columns: repeat(3, 1fr);
}
}
.cute-card-view {
background: var(--background-accent);
text-decoration: none !important;
color: var(--text-normal);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
min-height: 100%;
position: relative;
top: 0;
transition: all 0.1s ease-in;
border-radius: 10px;
}
.cute-card-view:hover {
top: -2px;
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.2);
}
.cute-card-view article {
padding: 15px;
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.cute-card-view h1 {
font-size: 1.2rem;
margin: 0;
color: var(--text-accent);
}
.cute-card-view a {
text-decoration: none !important;
}
.cute-card-view p {
flex: 1;
line-height: 1.0;
}
.cute-card-view span {
font-size: 0.8rem;
font-weight: bold;
color: var(--text-faint);
letter-spacing: 0.05em;
}
.cute-card-view .thumb {
padding-bottom: 60%;
background-size: cover;
background-position: center center;
border-radius: 10px 10px 0px 0px;
}
.cute-card-view .thumb-color {
padding-bottom: 10%;
background-size: cover;
background-position: center center;
border-radius: 10px 10px 0px 0px;
text-transform: uppercase;
font-size: 1.2rem;
font-weight: bold;
text-align: center;
color: #FFFFFF;
padding: 10px;
}
.cute-card-view .thumb-color-folder {
background-color: slateblue;
}
.cute-card-view .thumb-color-note {
background-color: salmon;
}
/*---------------------------------------------
strip card view
-----------------------------------------------*/
.strip-card-band {
width: 100%;
}
.strip-card-view {
width: 100%;
max-width: 100%;
margin-top: 1.0rem;
margin-bottom: 1.0rem;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-align: stretch;
-webkit-align-items: stretch;
-ms-flex-align: stretch;
align-items: stretch;
min-height: 8rem;
-webkit-border-radius: 10px;
border-radius: 10px;
overflow: hidden;
-webkit-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
-webkit-box-shadow: 0 1px 1px 0 rgba(31, 35, 46, 0.15);
box-shadow: 0 1px 1px 0 rgba(31, 35, 46, 0.15);
/* add by xpgo */
background: var(--background-accent);
text-decoration: none !important;
color: var(--text-normal);
}
.strip-card-view:hover {
-webkit-transform: translate(0px, -2px);
-ms-transform: translate(0px, -2px);
transform: translate(0px, -2px);
-webkit-box-shadow: 0 15px 45px -10px rgba(10, 16, 34, 0.2);
box-shadow: 0 15px 45px -10px rgba(10, 16, 34, 0.2);
}
.strip-card-view .thumb {
width: 20%;
max-width: 100%;
min-height: 9rem;
-webkit-background-size: cover;
background-size: cover;
background-position: 50% 50%;
}
.strip-card-view .thumb-color {
width: 20%;
max-width: 100%;
min-height: 9rem;
-webkit-background-size: cover;
background-size: cover;
background-position: center center;
/* add by xpgo */
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
text-transform: uppercase;
font-size: 1.2rem;
font-weight: bold;
text-align: center;
color: #FFFFFF;
}
.strip-card-view .thumb-color-folder {
background-color: slateblue;
}
.strip-card-view .thumb-color-note {
background-color: salmon;
}
.strip-card-view article {
padding: 1rem;
width: 80%;
}
.strip-card-view h1 {
font-size: 1.5rem;
margin: 0 0 10px;
color: var(--text-accent);
}
.strip-card-view a {
text-decoration: none !important;
}
.strip-card-view p {
margin-top: 0;
flex: 1;
line-height: 1.0;
}
.strip-card-view span {
font-size: 0.8rem;
font-weight: bold;
color: var(--text-faint);
letter-spacing: 0.05em;
}
+442
View File
@@ -0,0 +1,442 @@
{
"ignoredLints": "{\"context_hashes\":[15865895689566000533,6119222255552956109,11253296314840191199,16721049695819994954,8216002975862858808,214610641060740680,9548152354067699590]}",
"useWebWorker": true,
"lintSettings": {
"ACoupleMore": null,
"ALongTime": null,
"APart": null,
"Addicting": null,
"AdjectiveDoubleDegree": null,
"AdjectiveOfA": null,
"Ado": null,
"AfterAWhile": null,
"AheadAnd": null,
"AllIntentsAndPurposes": null,
"AllOfASudden": null,
"AlzheimersDisease": null,
"AmInTheMorning": null,
"AmazonNames": null,
"Americas": null,
"AmountsFor": null,
"AnA": null,
"AnAnother": null,
"AndIn": null,
"AndTheLike": null,
"AnotherAn": null,
"AnotherOnes": null,
"AnotherThingComing": null,
"AnotherThings": null,
"AnotherThinkComing": null,
"Anybody": null,
"Anyhow": null,
"Anywhere": null,
"AppleNames": null,
"AsFarAsIKnow": null,
"AsFarBackAs": null,
"AsIfThough": null,
"AsItHappens": null,
"AsLongAs": null,
"AsOfLate": null,
"AsSoonAsPossible": null,
"AskNoPreposition": null,
"AtFaceValue": null,
"AtTheEndOfTheDay": null,
"Australia": null,
"AvoidAndAlso": null,
"AvoidCurses": null,
"AzureNames": null,
"BackInTheDay": null,
"Backplane": null,
"BadRap": null,
"BanTogether": null,
"BareInMind": null,
"BatedBreath": null,
"BeRightBack": null,
"BeckAndCall": null,
"BeenThere": null,
"Beforehand": null,
"BesideThePoint": null,
"BestOfAllTime": null,
"BestRegards": null,
"BlanketStatement": null,
"BoringWords": null,
"Brutality": null,
"BuiltIn": null,
"ByAccident": null,
"ByTheWay": null,
"CanBeSeen": null,
"Canada": null,
"Cant": null,
"CapitalizePersonalPronouns": null,
"CaseInPoint": null,
"CaseSensitive": null,
"ChampAtTheBit": null,
"ChangeTack": null,
"ChineseCommunistParty": null,
"ChockFull": null,
"ClientOrServerSide": null,
"CommaFixes": null,
"CompaniesProductsAndTrademarks": null,
"CompoundNouns": null,
"CondenseAllThe": null,
"Confident": null,
"ConfirmThat": null,
"CorrectNumberSuffix": null,
"Countries": null,
"CoursingThroughVeins": null,
"CriteriaPhenomena": null,
"CurrencyPlacement": null,
"DampSquib": null,
"Dashes": null,
"DayAndAge": null,
"DayOneNames": null,
"DefiniteArticle": null,
"DegreesKelvin": null,
"DegreesKelvinSymbol": null,
"Desktop": null,
"DespiteOf": null,
"Devops": null,
"Didnt": null,
"DigestiveTract": null,
"DiscourseMarkers": null,
"Discuss": null,
"DoNotWant": null,
"DoesOrDose": null,
"DontCan": null,
"DotInitialisms": null,
"DoubleModal": null,
"EachAndEveryOne": null,
"EllipsisLength": null,
"ElsePossessive": null,
"EludedTo": null,
"EnMasse": null,
"EnRoute": null,
"EverPresent": null,
"EverSince": null,
"EveryTime": null,
"Everybody": null,
"Everyday": null,
"Everyone": null,
"Everywhere": null,
"Excellent": null,
"ExpandArgument": null,
"ExpandBecause": null,
"ExpandDependencies": null,
"ExpandMemoryShorthands": null,
"ExpandMinimum": null,
"ExpandStandardInputAndOutput": null,
"ExpandTimeShorthands": null,
"ExpandWith": null,
"ExpandWithout": null,
"Expatriate": null,
"ExplanationMark": null,
"ExtendOrExtent": null,
"FaceFirst": null,
"FairBit": null,
"FarAndFewBetween": null,
"FastPaste": null,
"FatalOutcome": null,
"FeelFell": null,
"FetalPosition": null,
"FewUnitsOfTimeAgo": null,
"FillerWords": null,
"FirstAidKit": null,
"FootTheBill": null,
"ForALongTime": null,
"ForAWhile": null,
"ForNoun": null,
"ForYourInformation": null,
"FreeRein": null,
"Freezing": null,
"FriendOfMe": null,
"FromTheGetGo": null,
"Furthermore": null,
"GetRidOf": null,
"GildedAge": null,
"GoingTo": null,
"GoogleNames": null,
"GuineaBissau": null,
"HadOf": null,
"HalfAnHour": null,
"Haphazard": null,
"HavePassed": null,
"HavePronoun": null,
"HaveTakeALook": null,
"Hedging": null,
"Henceforth": null,
"Hereby": null,
"Holidays": null,
"HomeInOn": null,
"HopHope": null,
"HowItLooksLike": null,
"HowTo": null,
"However": null,
"HumanBeings": null,
"HumanLife": null,
"HungerPang": null,
"HyphenateNumberDay": null,
"IAm": null,
"IAmAgreement": null,
"IDo": null,
"InAWhile": null,
"InAnyWay": null,
"InDetail": null,
"InMyHumbleOpinion": null,
"InMyOpinion": null,
"InNeedOf": null,
"InOfItself": null,
"InOnTheCards": null,
"InOneFellSwoop": null,
"InThe": null,
"InflectedVerbAfterTo": null,
"Insensitive": null,
"Insofar": null,
"Instead": null,
"InsteadOf": null,
"Insurmountable": null,
"Intact": null,
"InterestedIn": null,
"InvestIn": null,
"IsKnownFor": null,
"ItCan": null,
"ItLooksLikeThat": null,
"ItsContraction": null,
"ItsPossessive": null,
"Itself": null,
"IveGotTo": null,
"JawDropping": null,
"JetpackNames": null,
"JustDeserts": null,
"KindOf": null,
"KindRegards": null,
"Koreas": null,
"Laptop": null,
"LastButNotLeast": null,
"LastDitch": null,
"LeftRightHand": null,
"LessWorse": null,
"LetAlone": null,
"LetsConfusion": null,
"LikeAsIf": null,
"LikeThePlague": null,
"Likewise": null,
"LitotesDirectPositive": null,
"LongSentences": null,
"LookingForwardTo": null,
"LowHangingFruit": null,
"MakeDoWith": null,
"MakeItSeem": null,
"Malaysia": null,
"ManagerialReins": null,
"MassPlurals": null,
"MergeWords": null,
"MetaNames": null,
"MicrosoftNames": null,
"Middleware": null,
"MissingPreposition": null,
"MissingTo": null,
"Misspell": null,
"Misunderstand": null,
"Misunderstood": null,
"Misuse": null,
"Misused": null,
"MixedBag": null,
"ModalOf": null,
"Months": null,
"Monumentous": null,
"MootPoint": null,
"MostNumber": null,
"Multicore": null,
"Multimedia": null,
"MultipleSequentialPronouns": null,
"Multithreading": null,
"MyHouse": null,
"Myself": null,
"NailOnTheHead": null,
"NationalCapitals": null,
"NeedHelp": null,
"NerveRacking": null,
"NeverMind": null,
"NoFrenchSpaces": null,
"NoMatchFor": null,
"NoOxfordComma": null,
"Nobody": null,
"NominalWants": null,
"Nonetheless": null,
"NotIn": null,
"NotTo": null,
"NotablePlaces": null,
"Nothing": null,
"Notwithstanding": null,
"NounCountability": null,
"NounVerbConfusion": null,
"Nowhere": null,
"NumberSuffixCapitalization": null,
"OceansAndSeas": null,
"OfCourse": null,
"OffTheCuff": null,
"OhMyGod": null,
"OldWivesTale": null,
"OnFloor": null,
"OnSecondThought": null,
"OnTheSpurOfTheMoment": null,
"OnTopOf": null,
"OnceInAWhile": null,
"OnceOrTwice": null,
"OneAndTheSame": null,
"OpenCompounds": null,
"OpenTheLight": null,
"OperatingSystem": null,
"OughtToBe": null,
"OutOfDate": null,
"Overall": null,
"Overclocking": null,
"Overload": null,
"Overnight": null,
"OxfordComma": null,
"Oxymorons": null,
"PeaceOfMind": null,
"PhrasalVerbAsCompoundNoun": null,
"Piggyback": null,
"PiqueInterest": null,
"PocketCastsNames": null,
"PointsOfView": null,
"PortAuPrince": null,
"PortoNovo": null,
"PossessiveNoun": null,
"PossessiveYour": null,
"Postpone": null,
"PrayingMantis": null,
"ProgressiveNeedsBe": null,
"PronounContraction": null,
"PronounInflectionBe": null,
"PronounKnew": null,
"Proofread": null,
"ProperNouns": null,
"QuantifierNeedsOf": null,
"QuiteQuiet": null,
"QuoteSpacing": null,
"RapidFire": null,
"RealTrouper": null,
"Really": null,
"RedundantAdditiveAdverbs": null,
"RedundantIIRC": null,
"RedundantSuperlatives": null,
"Regardless": null,
"Regionalisms": null,
"RepeatedWords": null,
"RifeWith": null,
"RiseTheQuestion": null,
"RoadMap": null,
"RollerSkated": null,
"RulesOfThumb": null,
"SameAs": null,
"SaveToSafe": null,
"ScantilyClad": null,
"SemicolonApostrophe": null,
"SentenceCapitalization": false,
"ShootOneselfInTheFoot": null,
"SimpleGrammatical": null,
"SimplePastToPastParticiple": null,
"SinceDuration": null,
"SneakingSuspicion": null,
"SomeOfThe": null,
"SomeWithoutArticle": null,
"Somebody": null,
"SomebodyElses": null,
"Somehow": null,
"Someone": null,
"SomethingIs": null,
"SomewhatSomething": null,
"Somewhere": null,
"SoonerOrLater": null,
"SoughtAfter": null,
"Spaces": null,
"SpecialAttention": null,
"SpellCheck": null,
"SpelledNumbers": null,
"Starving": null,
"StateOfTheArt": null,
"StatuteOfLimitations": null,
"SufficeItToSay": null,
"SupposedTo": null,
"TakeItPersonally": null,
"TalkToYouLater": null,
"ThanksALot": null,
"ThatChallenged": null,
"ThatThan": null,
"ThatThis": null,
"ThatWhich": null,
"The": null,
"TheAnother": null,
"TheHowWhy": null,
"TheMy": null,
"ThenThan": null,
"Therefore": null,
"Thereupon": null,
"ThingThink": null,
"ThoughThought": null,
"ThoughtProcess": null,
"ThrowAway": null,
"ThrowRubbish": null,
"TickingTimeClock": null,
"ToAdverb": null,
"ToBeHonest": null,
"ToDoHyphen": null,
"ToGreatLengths": null,
"ToTheMannerBorn": null,
"ToTooIdioms": null,
"ToTwoToo": null,
"ToWorryAbout": null,
"TongueInCheek": null,
"TooTo": null,
"Touristic": null,
"Towards": null,
"TrialAndError": null,
"TumblrNames": null,
"TurnItOff": null,
"USUniversities": null,
"UnclosedQuotes": null,
"Underclock": null,
"UnitedOrganizations": null,
"Unless": null,
"UpdatePlaceNames": null,
"Upset": null,
"Upward": null,
"UseGenitive": null,
"VeryUnique": null,
"ViceVersa": null,
"WantBe": null,
"WasAloud": null,
"WaveFunction": null,
"WayTooAdjective": null,
"WellBeing": null,
"WellEducated": null,
"WellKept": null,
"Whereas": null,
"Whereupon": null,
"WhetYourAppetite": null,
"WholeEntire": null,
"WidelyAccepted": null,
"Widespread": null,
"WillContain": null,
"WinPrize": null,
"WordPressDotcom": null,
"Worldwide": null,
"WorseOrWorst": null,
"WorstCaseScenario": null,
"WouldNeverHave": null,
"WroughtIron": null
},
"userDictionary": [
"Mariama",
"csb320",
"frc",
"hea150",
"math163",
"pcb"
],
"dialect": 0,
"delay": -1,
"lintEnabled": true
}
+1841
View File
File diff suppressed because it is too large. Load diff
+10
View File
@@ -0,0 +1,10 @@
{
"id": "harper",
"name": "Harper",
"version": "0.70.0",
"minAppVersion": "1.7.7",
"description": "The Grammar Checker for Developers",
"author": "Elijah Potter",
"authorUrl": "https://elijahpotter.dev",
"isDesktopOnly": false
}
+792
View File
@@ -0,0 +1,792 @@
{
"elements": [
{
"id": "bfe542ff-dbbc-4dee-bc94-d80d2b8eecac",
"categoryId": "flowchart",
"description": "a simple flowchart with top to down direction",
"content": "flowchart TD\nStart --> Stop",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "4ec3d5f0-8110-413c-bd73-9fc5911ee1e1",
"categoryId": "flowchart",
"description": "a simple flowchart with left to right direction",
"content": "flowchart LR\nStart --> Stop",
"sortingOrder": 2,
"isPinned": false
},
{
"id": "7d3443a4-9f2a-4fae-91e7-31bf82b2a415",
"categoryId": "flowchart",
"description": "A node with round edges",
"content": "id1(Some text)",
"sortingOrder": 3,
"isPinned": false
},
{
"id": "b18c8f44-24d2-40d6-bf0f-ae524f13f622",
"categoryId": "flowchart",
"description": "A stadium-shaped node",
"content": "id1([Some text])",
"sortingOrder": 4,
"isPinned": false
},
{
"id": "aafe13ec-c06a-4059-8d96-96b5a369f2e9",
"categoryId": "flowchart",
"description": "A node in a cylindrical shape",
"content": "id1[(Database)]",
"sortingOrder": 5,
"isPinned": false
},
{
"id": "d64523be-23bd-469f-8dd6-5bb2613c2089",
"categoryId": "flowchart",
"description": "Circle",
"content": "id1((Some text))",
"sortingOrder": 6,
"isPinned": false
},
{
"id": "369729a8-17ba-4e4f-807e-f1964b7f703e",
"categoryId": "flowchart",
"description": "Rhombus",
"content": "id1{Some text}",
"sortingOrder": 7,
"isPinned": false
},
{
"id": "7cc20695-14cf-430b-a6bf-22ba9dfdc851",
"categoryId": "flowchart",
"description": "Hexagon",
"content": "id1{{Some text}}",
"sortingOrder": 8,
"isPinned": false
},
{
"id": "0601f4a6-83ac-4d0b-868a-b34884121268",
"categoryId": "flowchart",
"description": "Parallelogram skewed right",
"content": "id1[/Some text/]",
"sortingOrder": 9,
"isPinned": false
},
{
"id": "034af1fd-e99c-467c-ba2e-19b58f9885ea",
"categoryId": "flowchart",
"description": "Parallelogram skewed left",
"content": "id1[\\Some text\\]",
"sortingOrder": 10,
"isPinned": false
},
{
"id": "2e7fdfe3-bdeb-4063-9ba3-720667263783",
"categoryId": "flowchart",
"description": "Trapezoid",
"content": "A[/Some text\\]",
"sortingOrder": 11,
"isPinned": false
},
{
"id": "b31cc249-38b2-4724-8d26-90192dc5fc5d",
"categoryId": "flowchart",
"description": "Trapezoid upside down",
"content": "A[\\Some text/]",
"sortingOrder": 12,
"isPinned": false
},
{
"id": "4c678eda-82c3-411e-9c93-bb4d62cfbec2",
"categoryId": "flowchart",
"description": "Double circle node",
"content": "id1(((Some text)))",
"sortingOrder": 13,
"isPinned": false
},
{
"id": "098e3fec-2d21-460f-81e9-9a289df18eac",
"categoryId": "flowchart",
"description": "A link with arrow head",
"content": "A-->B",
"sortingOrder": 14,
"isPinned": false
},
{
"id": "a9cee0e5-146a-47de-858c-eab2a3a287d5",
"categoryId": "flowchart",
"description": "An open link",
"content": "A --- B",
"sortingOrder": 15,
"isPinned": false
},
{
"id": "9eaf1124-f874-4e35-8414-6aab9fe83a93",
"categoryId": "flowchart",
"description": "Text on links",
"content": "A-- This is the text! ---B",
"sortingOrder": 16,
"isPinned": false
},
{
"id": "9a830a40-09e1-4a8c-83cb-b625d22a19c6",
"categoryId": "flowchart",
"description": "A link with arrow head and text",
"content": "A-->|text|B",
"sortingOrder": 17,
"isPinned": false
},
{
"id": "c0f3c881-632b-4f6f-9d64-8a023938bda1",
"categoryId": "flowchart",
"description": "Dotted link",
"content": "A-.->B",
"sortingOrder": 18,
"isPinned": false
},
{
"id": "912e0592-8b18-4366-9c62-a5732300adaa",
"categoryId": "flowchart",
"description": "Thick link",
"content": "A ==> B",
"sortingOrder": 19,
"isPinned": false
},
{
"id": "42d25799-4c87-4a5f-a6ff-d2cccbebc116",
"categoryId": "flowchart",
"description": "Invisible link",
"content": "A ~~~ B",
"sortingOrder": 20,
"isPinned": false
},
{
"id": "09c34b00-29a8-4767-aa66-bc51b44cc58e",
"categoryId": "flowchart",
"description": "Link with circle edge",
"content": "A --o B",
"sortingOrder": 21,
"isPinned": false
},
{
"id": "e04549e6-b0cc-41ae-a737-3301b13afb72",
"categoryId": "flowchart",
"description": "Link with cross edge",
"content": "A --x B",
"sortingOrder": 22,
"isPinned": false
},
{
"id": "010853f8-06fe-41ca-aa11-8ed8db237639",
"categoryId": "flowchart",
"description": "Subgraph",
"content": "subgraph one\na1-->a2\nend",
"sortingOrder": 14,
"isPinned": false
},
{
"id": "48fa43c5-a5fa-4735-a9b0-4325802732b9",
"categoryId": "sequenceDiagram",
"description": "a simple sequence diagram",
"content": "sequenceDiagram\nAlice->>John: Hello John, how are you?\nJohn-->>Alice: Great!\nAlice-)John: See you later!",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "a5f0fa4f-546f-4218-b682-791144d37521",
"categoryId": "sequenceDiagram",
"description": "a simple sequence diagram with actors",
"content": "sequenceDiagram\nactor Alice\nactor John\nAlice->>John: Hello John, how are you?\nJohn-->>Alice: Great!\nAlice-)John: See you later!",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "d813cda2-811c-4fff-8934-6c706ad940b0",
"categoryId": "classDiagram",
"description": "sample class",
"content": "class Duck{\n +String beakColor\n +swim()\n +quack()\n }",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "bc9ec046-7257-4006-9b07-5c4c1c40c4ff",
"categoryId": "classDiagram",
"description": "sample class",
"content": "class BankAccount\n BankAccount : +String owner\n BankAccount : +Bigdecimal balance\n BankAccount : +deposit(amount)\n BankAccount : +withdrawal(amount)",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "3acffb26-c5d1-40c4-be93-289e9d26d6d4",
"categoryId": "classDiagram",
"description": "generic class",
"content": "class Square~Shape~{\n int id\n List~int~ position\n setPoints(List~int~ points)\n getPoints() List~int~\n }\n \n Square : -List~string~ messages\n Square : +setMessages(List~string~ messages)\n Square : +getMessages() List~string~",
"sortingOrder": 2,
"isPinned": false
},
{
"id": "d7ac61fc-b76a-4ba0-88d4-3ee913c6bf0a",
"categoryId": "classDiagram",
"description": "inheritance",
"content": "classA <|-- classB",
"sortingOrder": 3,
"isPinned": false
},
{
"id": "27c3c73f-3418-45be-a673-d6c77766feab",
"categoryId": "classDiagram",
"description": "composition",
"content": "classC *-- classD",
"sortingOrder": 4,
"isPinned": false
},
{
"id": "ea6cb6b7-7de8-4e81-8946-11c828bd295f",
"categoryId": "classDiagram",
"description": "aggregation",
"content": "classE o-- classF",
"sortingOrder": 5,
"isPinned": false
},
{
"id": "5ba2a0be-db08-47fb-bab8-a4bb97304aaf",
"categoryId": "classDiagram",
"description": "association",
"content": "classG <-- classH",
"sortingOrder": 6,
"isPinned": false
},
{
"id": "dc2f91af-1a93-424a-912f-0e441336fe62",
"categoryId": "classDiagram",
"description": "solid link",
"content": "classI -- classJ",
"sortingOrder": 7,
"isPinned": false
},
{
"id": "238d63b0-76d8-4e04-912d-82047cd12aec",
"categoryId": "classDiagram",
"description": "dependency",
"content": "classK <.. classL",
"sortingOrder": 8,
"isPinned": false
},
{
"id": "e5a5d2e4-d68a-4659-bc3f-07c41949fa47",
"categoryId": "classDiagram",
"description": "realization",
"content": "classM <|.. classN",
"sortingOrder": 9,
"isPinned": false
},
{
"id": "cd8ba389-684e-48cc-86d8-93124d115dbe",
"categoryId": "classDiagram",
"description": "dashed link",
"content": "classO .. classP",
"sortingOrder": 10,
"isPinned": false
},
{
"id": "00c92eef-8333-4d26-83c1-9f840daa3cbc",
"categoryId": "classDiagram",
"description": "two-way relation",
"content": "Animal <|--|> Zebra",
"sortingOrder": 11,
"isPinned": false
},
{
"id": "a2de3bf8-2086-4730-bc6a-6b41d2ae1b71",
"categoryId": "classDiagram",
"description": "sample class diagram",
"content": "classDiagram\n Animal <|-- Duck\n Animal <|-- Fish\n Animal <|-- Zebra\n Animal : +int age\n Animal : +String gender\n Animal: +isMammal()\n Animal: +mate()\n class Duck{\n +String beakColor\n +swim()\n +quack()\n }\n class Fish{\n -int sizeInFeet\n -canEat()\n }\n class Zebra{\n +bool is_wild\n +run()\n }",
"sortingOrder": 12,
"isPinned": false
},
{
"id": "2646c21e-ec7b-44bf-9ea1-f659dba00c2a",
"categoryId": "stateDiagram",
"description": "a sample state diagram",
"content": "stateDiagram-v2\n [*] --> Still\n Still --> [*]\n \n Still --> Moving\n Moving --> Still\n Moving --> Crash\n Crash --> [*]",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "98e205de-f10c-43d8-b721-da231355c338",
"categoryId": "stateDiagram",
"description": "a sample state diagram with left-to-right direction",
"content": "stateDiagram-v2\n direction LR\n [*] --> Still\n Still --> [*]\n \n Still --> Moving\n Moving --> Still\n Moving --> Crash\n Crash --> [*]",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "d5a6d50f-ec66-4084-bf2a-be465fe66222",
"categoryId": "stateDiagram",
"description": "node with description",
"content": "s2 : This is a state description",
"sortingOrder": 2,
"isPinned": false
},
{
"id": "811f21a8-942b-4c2d-b9ca-bd74c8cee4c9",
"categoryId": "stateDiagram",
"description": "a transition",
"content": "s1 --> s2",
"sortingOrder": 3,
"isPinned": false
},
{
"id": "a91684cc-d0d4-4188-afe5-caec61db72dc",
"categoryId": "stateDiagram",
"description": "a transition with label",
"content": "s1 --> s2: A transition",
"sortingOrder": 4,
"isPinned": false
},
{
"id": "b9344bb1-36f1-4d44-a863-926ba1a6cdcf",
"categoryId": "stateDiagram",
"description": "composite state",
"content": "\n [*] --> First\n state First {\n [*] --> second\n second --> [*]\n }",
"sortingOrder": 5,
"isPinned": false
},
{
"id": "7d1cab4d-69dc-4877-89ff-56eaa5d30cd7",
"categoryId": "stateDiagram",
"description": "diagram with choice",
"content": "stateDiagram-v2\n state if_state <<choice>>\n [*] --> IsPositive\n IsPositive --> if_state\n if_state --> False: if n < 0\n if_state --> True : if n >= 0",
"sortingOrder": 6,
"isPinned": false
},
{
"id": "8ccb8f81-5f4c-4642-9242-59eca0d26882",
"categoryId": "stateDiagram",
"description": "diagram with fork",
"content": "stateDiagram-v2\n state fork_state <<fork>>\n [*] --> fork_state\n fork_state --> State2\n fork_state --> State3\n \n state join_state <<join>>\n State2 --> join_state\n State3 --> join_state\n join_state --> State4\n State4 --> [*]",
"sortingOrder": 7,
"isPinned": false
},
{
"id": "d36206cc-194a-4b16-95db-5593b6f3921b",
"categoryId": "stateDiagram",
"description": "a diagram with concurrency",
"content": "stateDiagram-v2\n [*] --> Active\n \n state Active {\n [*] --> NumLockOff\n NumLockOff --> NumLockOn : EvNumLockPressed\n NumLockOn --> NumLockOff : EvNumLockPressed\n --\n [*] --> CapsLockOff\n CapsLockOff --> CapsLockOn : EvCapsLockPressed\n CapsLockOn --> CapsLockOff : EvCapsLockPressed\n --\n [*] --> ScrollLockOff\n ScrollLockOff --> ScrollLockOn : EvScrollLockPressed\n ScrollLockOn --> ScrollLockOff : EvScrollLockPressed\n }",
"sortingOrder": 8,
"isPinned": false
},
{
"id": "a31a97e3-1213-4aa7-af07-ca569ea31c5a",
"categoryId": "entityRelationshipDiagram",
"description": "a sample entity relationship diagram",
"content": "erDiagram\n CUSTOMER ||--o{ ORDER : places\n ORDER ||--|{ LINE-ITEM : contains\n CUSTOMER }|..|{ DELIVERY-ADDRESS : uses",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "628241e3-2d48-4135-9213-19b7afba6e15",
"categoryId": "entityRelationshipDiagram",
"description": "an entity",
"content": " CUSTOMER {\n string name\n string custNumber\n string sector\n }",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "05c269f8-2f48-4dc9-9941-f0afa374a8f4",
"categoryId": "entityRelationshipDiagram",
"description": "one-to-many relationship",
"content": "A ||--|{ B : label",
"sortingOrder": 2,
"isPinned": false
},
{
"id": "62b296c6-dd24-472a-b027-92e31f28b872",
"categoryId": "entityRelationshipDiagram",
"description": "many-to-many relationship",
"content": "A }|--|{ B : label",
"sortingOrder": 3,
"isPinned": false
},
{
"id": "2352d247-fcb4-4692-acfd-ada7a1574343",
"categoryId": "entityRelationshipDiagram",
"description": "one-to-one relationship",
"content": "A ||--|| B : label",
"sortingOrder": 4,
"isPinned": false
},
{
"id": "4f062eb5-2d43-40ee-9a47-2503b1a9b58f",
"categoryId": "entityRelationshipDiagram",
"description": "many-to-one relationship",
"content": "A }|--|| B : label",
"sortingOrder": 5,
"isPinned": false
},
{
"id": "cac20470-599e-4b77-b406-0ca10717c546",
"categoryId": "entityRelationshipDiagram",
"description": "zero/one-to-one relationship",
"content": "A |o--|| B : label",
"sortingOrder": 6,
"isPinned": false
},
{
"id": "d0a782f0-19a3-457c-bf59-42cc5ad1dd21",
"categoryId": "entityRelationshipDiagram",
"description": "one-to-one/zero relationship",
"content": "A ||--o| B : label",
"sortingOrder": 7,
"isPinned": false
},
{
"id": "5753a6c5-e0e1-46b0-8bcb-60f55ae47c30",
"categoryId": "entityRelationshipDiagram",
"description": "zero-or-more-to-one relationship",
"content": "A }o--|| B : label",
"sortingOrder": 8,
"isPinned": false
},
{
"id": "8afaf932-3d4b-4f17-b4f1-4ea4617087ff",
"categoryId": "entityRelationshipDiagram",
"description": "one-to-zero-or-more relationship",
"content": "A ||--o{ B : label",
"sortingOrder": 9,
"isPinned": false
},
{
"id": "892bddd6-a1e2-4b97-b859-d859ed51f865",
"categoryId": "entityRelationshipDiagram",
"description": "zero-or-more-to-many relationship",
"content": "A }o--|{ B : label",
"sortingOrder": 10,
"isPinned": false
},
{
"id": "df251019-eed6-4b96-b3a6-68b28b6cc728",
"categoryId": "entityRelationshipDiagram",
"description": "many-to-zero-or-more relationship",
"content": "A }|--o{ B : label",
"sortingOrder": 11,
"isPinned": false
},
{
"id": "7faedcc4-41b9-42a5-a537-9a730cae74b9",
"categoryId": "userJourneyDiagram",
"description": "a sample user journey diagram",
"content": "journey\n title My working day\n section Go to work\n Make tea: 5: Me\n Go upstairs: 3: Me\n Do work: 1: Me, Cat\n section Go home\n Go downstairs: 5: Me\n Sit down: 5: Me",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "b0939827-4771-48f6-a101-8cf696c9dfe0",
"categoryId": "userJourneyDiagram",
"description": "a step in user journey",
"content": " Step Title: 5: ActorName",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "23fb937e-e74a-4ea8-88f1-2cad09f8f419",
"categoryId": "ganttChart",
"description": "simple gantt chart",
"content": "gantt\n title A Gantt Diagram\n dateFormat YYYY-MM-DD\n section Section\n A task :a1, 2014-01-01, 30d\n Another task :after a1 , 20d\n section Another\n Task in sec :2014-01-12 , 12d\n another task : 24d",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "d132fded-e152-407a-85e9-1f5fac40c62c",
"categoryId": "ganttChart",
"description": "rich gantt chart",
"content": "gantt\n dateFormat YYYY-MM-DD\n title Adding GANTT diagram functionality to mermaid\n excludes weekends\n \n section A section\n Completed task :done, des1, 2014-01-06,2014-01-08\n Active task :active, des2, 2014-01-09, 3d\n Future task : des3, after des2, 5d\n Future task2 : des4, after des3, 5d\n \n section Critical tasks\n Completed task in the critical line :crit, done, 2014-01-06,24h\n Implement parser and jison :crit, done, after des1, 2d\n Create tests for parser :crit, active, 3d\n Future task in critical line :crit, 5d\n Create tests for renderer :2d\n Add to mermaid :1d\n Functionality added :milestone, 2014-01-25, 0d\n \n section Documentation\n Describe gantt syntax :active, a1, after des1, 3d\n Add gantt diagram to demo page :after a1 , 20h\n Add another diagram to demo page :doc1, after a1 , 48h\n \n section Last section\n Describe gantt syntax :after doc1, 3d\n Add gantt diagram to demo page :20h\n Add another diagram to demo page :48h",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "04524f69-c592-440a-a5cf-6ceb2d7b71ad",
"categoryId": "ganttChart",
"description": "milestones example",
"content": "gantt\n dateFormat HH:mm\n axisFormat %H:%M\n Initial milestone : milestone, m1, 17:49,2min\n taska2 : 10min\n taska3 : 5min\n Final milestone : milestone, m2, 18:14, 2min",
"sortingOrder": 2,
"isPinned": false
},
{
"id": "352efc49-6616-4673-a853-7b09068b2506",
"categoryId": "pieChart",
"description": "sample pie chart",
"content": "pie title /r/obsidianmd posts by type\n \"Graphs\" : 85\n \"Dashboards\" : 14\n \"Tips\" : 1",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "3852deff-37fb-4610-959b-cd56223857e3",
"categoryId": "pieChart",
"description": "sample pie chart with values shown in legend",
"content": "pie showData title /r/obsidianmd posts by type\n \"Graphs\" : 85\n \"Dashboards\" : 14\n \"Tips\" : 1",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "22e073df-aa8f-4b46-a53f-4a71dbc85a64",
"categoryId": "requirementDiagram",
"description": "sample requirements diagram",
"content": " requirementDiagram\n\n requirement test_req {\n id: 1\n text: the test text.\n risk: high\n verifymethod: test\n }\n \n element test_entity {\n type: simulation\n }\n \n test_entity - satisfies -> test_req",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "087887fd-81ff-41ec-8cce-b2afc24233e7",
"categoryId": "requirementDiagram",
"description": "sample requirements diagram",
"content": "element customElement {\n type: customType\n docref: customDocRef\n }",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "0bb066b3-3bfe-4bd4-819c-036d33572cb6",
"categoryId": "requirementDiagram",
"description": "a requirement with high risk",
"content": "functionalRequirement myReq {\n id: reqId\n text: someText\n risk: High\n verifymethod: analysis\n }",
"sortingOrder": 2,
"isPinned": false
},
{
"id": "e0e20062-37e6-472e-a809-221e74bead13",
"categoryId": "requirementDiagram",
"description": "sample requirements diagram",
"content": "interfaceRequirement myReq2 {\n id: reqId\n text: someText\n risk: Medium\n verifymethod: demonstration\n }",
"sortingOrder": 3,
"isPinned": false
},
{
"id": "d5aa981c-eb7c-40f6-b732-c179e3551f39",
"categoryId": "requirementDiagram",
"description": "sample requirements diagram",
"content": "designConstraint myReq3 {\n id: reqId\n text: someText\n risk: Low\n verifymethod: test\n }",
"sortingOrder": 4,
"isPinned": false
},
{
"id": "601ee63c-a36b-44e3-b318-cbe9b2f5e7e5",
"categoryId": "gitGraph",
"description": "simple git graph",
"content": "gitGraph\n commit\n commit\n branch develop\n checkout develop\n commit\n commit\n checkout main\n merge develop\n commit\n commit",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "f39aa029-cd89-408b-9460-7103a48e1f46",
"categoryId": "gitGraph",
"description": "tagged commit",
"content": "commit id: \"Normal\" tag: \"v1.0.0\"",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "ed5c0789-5d39-4fad-8c9b-881a9c7e3a8e",
"categoryId": "gitGraph",
"description": "reverse commit",
"content": "commit id: \"Reverse\" type: REVERSE",
"sortingOrder": 2,
"isPinned": false
},
{
"id": "06f2ce67-f772-4125-b89c-fb4e410c04c5",
"categoryId": "gitGraph",
"description": "highlighted commit",
"content": "commit id: \"Highlight\" type: HIGHLIGHT",
"sortingOrder": 3,
"isPinned": false
},
{
"id": "dd6ffbfe-032c-4029-9b17-866b670a17e1",
"categoryId": "gitGraph",
"description": "reverse commit",
"content": "commit id: \"Reverse\" type: REVERSE",
"sortingOrder": 4,
"isPinned": false
},
{
"id": "f6e2ceaa-62a0-4c0a-90b6-8436638692f1",
"categoryId": "gitGraph",
"description": "git graph with cherry-pick",
"content": "gitGraph\n commit id: \"ZERO\"\n branch develop\n commit id:\"A\"\n checkout main\n commit id:\"ONE\"\n checkout develop\n commit id:\"B\"\n checkout main\n commit id:\"TWO\"\n cherry-pick id:\"A\"\n commit id:\"THREE\"\n checkout develop\n commit id:\"C\"",
"sortingOrder": 5,
"isPinned": false
},
{
"id": "1c452b5a-a1aa-4c78-b2ab-39bc2c6c8a5a",
"categoryId": "mindmap",
"description": "a simple mindmap",
"content": "mindmap\n Root\n A\n B\n C",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "5a6ae54e-aecf-4be6-a28b-29a005499dac",
"categoryId": "mindmap",
"description": "square",
"content": "id[I am a square]",
"sortingOrder": 2,
"isPinned": false
},
{
"id": "3dbb4192-fb9a-4b63-a34b-84c1a0d5875b",
"categoryId": "mindmap",
"description": "rounded square",
"content": "id(I am a rounded square)",
"sortingOrder": 3,
"isPinned": false
},
{
"id": "b81aea60-fe22-4433-b54f-c982c0912474",
"categoryId": "mindmap",
"description": "circle",
"content": "id((I am a circle))",
"sortingOrder": 4,
"isPinned": false
},
{
"id": "8f5b7f2f-280b-494a-8d83-b93e6d50512d",
"categoryId": "mindmap",
"description": "bang",
"content": "id))I am a bang((",
"sortingOrder": 5,
"isPinned": false
},
{
"id": "c8c54417-28bc-4969-b013-d15ec7fe64d6",
"categoryId": "mindmap",
"description": "cloud",
"content": "id)I am a cloud(",
"sortingOrder": 6,
"isPinned": false
},
{
"id": "0a98de49-0e50-4bbf-8868-b19a5149eedd",
"categoryId": "mindmap",
"description": "hexagon",
"content": "id{{I am a hexagon}}",
"sortingOrder": 7,
"isPinned": false
},
{
"id": "53b70e8e-4348-43a2-8cb6-1c76eaeed965",
"categoryId": "mindmap",
"description": "default",
"content": "I am the default shape",
"sortingOrder": 8,
"isPinned": false
},
{
"id": "a73054de-d18e-4f53-88e2-5bfa18520b14",
"categoryId": "mindmap",
"description": "sample mindmap",
"content": "mindmap\n root((mindmap))\n Origins\n Long history\n Popularisation\n British popular psychology author Tony Buzan\n Research\n On effectiveness<br/>and features\n On Automatic creation\n Uses\n Creative techniques\n Strategic planning\n Argument mapping\n Tools\n Pen and paper\n Mermaid",
"sortingOrder": 9,
"isPinned": false
},
{
"id": "ea5ad7f3-ad47-44ab-a95c-d92baed40fee",
"categoryId": "timeline",
"description": "sample timeline",
"content": "timeline\n\t\ttitle History of Social Media Platform\n\t\t2002 : LinkedIn\n\t\t2004 : Facebook\n\t\t\t : Google\n\t\t2005 : Youtube\n\t\t2006 : Twitter",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "5fc4f693-5198-4940-8e23-82c2f65e0b82",
"categoryId": "timeline",
"description": "timeline with grouping",
"content": "timeline\n\t\ttitle Timeline of Industrial Revolution\n\t\tsection 17th-20th century\n\t\t\tIndustry 1.0 : Machinery, Water power, Steam <br>power\n\t\t\tIndustry 2.0 : Electricity, Internal combustion engine, Mass production\n\t\t\tIndustry 3.0 : Electronics, Computers, Automation\n\t\tsection 21st century\n\t\t\tIndustry 4.0 : Internet, Robotics, Internet of Things\n\t\t\tIndustry 5.0 : Artificial intelligence, Big data,3D printing",
"sortingOrder": 2,
"isPinned": false
},
{
"id": "a1294b24-9a02-4845-8708-f4ab8fbf93b5",
"categoryId": "timeline",
"description": "timeline with Forest theme. see the docs for additional themes",
"content": "%%{init: { 'logLevel': 'debug', 'theme': 'forest' } }%%\n\t\ttimeline\n\t\t\ttitle History of Social Media Platform\n\t\t\t 2002 : LinkedIn\n\t\t\t 2004 : Facebook : Google\n\t\t\t 2005 : Youtube\n\t\t\t 2006 : Twitter\n\t\t\t 2007 : Tumblr\n\t\t\t 2008 : Instagram\n\t\t\t 2010 : Pinterest",
"sortingOrder": 3,
"isPinned": false
},
{
"id": "aa6341b3-9863-4595-bdf1-7fa84ee17e7c",
"categoryId": "quadrantChart",
"description": "sample quadrant chart",
"content": "quadrantChart\n\t\ttitle Reach and engagement of campaigns\n\t\tx-axis Low Reach --> High Reach\n\t\ty-axis Low Engagement --> High Engagement\n\t\tquadrant-1 We should expand\n\t\tquadrant-2 Need to promote\n\t\tquadrant-3 Re-evaluate\n\t\tquadrant-4 May be improved\n\t\tCampaign A: [0.3, 0.6]\n\t\tCampaign B: [0.45, 0.23]\n\t\tCampaign C: [0.57, 0.69]\n\t\tCampaign D: [0.78, 0.34]\n\t\tCampaign E: [0.40, 0.34]\n\t\tCampaign F: [0.35, 0.78]",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "9639c00f-4eb2-45c3-a53c-9c6103290325",
"categoryId": "quadrantChart",
"description": "themed quadrant chart",
"content": "%%{init: {\"quadrantChart\": {\"chartWidth\": 400, \"chartHeight\": 400}, \"themeVariables\": {\"quadrant1TextFill\": \"#ff0000\"} }}%%\n\t\tquadrantChart\n\t\t x-axis Urgent --> Not Urgent\n\t\t y-axis Not Important --> \"Important ❤\"\n\t\t quadrant-1 Plan\n\t\t quadrant-2 Do\n\t\t quadrant-3 Delegate\n\t\t quadrant-4 Delete",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "0fa8be99-f00a-4fd8-9b2b-a982b4eeb8d1",
"categoryId": "c4Diagram",
"description": "sample C4 diagram (compatible with PlantUML)",
"content": "C4Context\n\t\ttitle System Context diagram for Internet Banking System\n\t\tEnterprise_Boundary(b0, \"BankBoundary0\") {\n\t\t Person(customerA, \"Banking Customer A\", \"A customer of the bank, with personal bank accounts.\")\n\t\t Person(customerB, \"Banking Customer B\")\n\t\t Person_Ext(customerC, \"Banking Customer C\", \"desc\")\n \n\t\t Person(customerD, \"Banking Customer D\", \"A customer of the bank, <br/> with personal bank accounts.\")\n \n\t\t System(SystemAA, \"Internet Banking System\", \"Allows customers to view information about their bank accounts, and make payments.\")\n \n\t\t Enterprise_Boundary(b1, \"BankBoundary\") {\n \n\t\t\tSystemDb_Ext(SystemE, \"Mainframe Banking System\", \"Stores all of the core banking information about customers, accounts, transactions, etc.\")\n \n\t\t\tSystem_Boundary(b2, \"BankBoundary2\") {\n\t\t\t System(SystemA, \"Banking System A\")\n\t\t\t System(SystemB, \"Banking System B\", \"A system of the bank, with personal bank accounts. next line.\")\n\t\t\t}\n \n\t\t\tSystem_Ext(SystemC, \"E-mail system\", \"The internal Microsoft Exchange e-mail system.\")\n\t\t\tSystemDb(SystemD, \"Banking System D Database\", \"A system of the bank, with personal bank accounts.\")\n \n\t\t\tBoundary(b3, \"BankBoundary3\", \"boundary\") {\n\t\t\t SystemQueue(SystemF, \"Banking System F Queue\", \"A system of the bank.\")\n\t\t\t SystemQueue_Ext(SystemG, \"Banking System G Queue\", \"A system of the bank, with personal bank accounts.\")\n\t\t\t}\n\t\t }\n\t\t}\n \n\t\tBiRel(customerA, SystemAA, \"Uses\")\n\t\tBiRel(SystemAA, SystemE, \"Uses\")\n\t\tRel(SystemAA, SystemC, \"Sends e-mails\", \"SMTP\")\n\t\tRel(SystemC, customerA, \"Sends e-mails to\")\n \n\t\tUpdateElementStyle(customerA, $fontColor=\"red\", $bgColor=\"grey\", $borderColor=\"red\")\n\t\tUpdateRelStyle(customerA, SystemAA, $textColor=\"blue\", $lineColor=\"blue\", $offsetX=\"5\")\n\t\tUpdateRelStyle(SystemAA, SystemE, $textColor=\"blue\", $lineColor=\"blue\", $offsetY=\"-10\")\n\t\tUpdateRelStyle(SystemAA, SystemC, $textColor=\"blue\", $lineColor=\"blue\", $offsetY=\"-40\", $offsetX=\"-50\")\n\t\tUpdateRelStyle(SystemC, customerA, $textColor=\"red\", $lineColor=\"red\", $offsetX=\"-50\", $offsetY=\"20\")\n \n\t\tUpdateLayoutConfig($c4ShapeInRow=\"3\", $c4BoundaryInRow=\"1\")",
"sortingOrder": 1,
"isPinned": false
},
{
"id": "647f7401-fc5b-47cf-be62-4c7a4fc65215",
"categoryId": "sankeyDiagram",
"description": "",
"content": "sankey-beta\n %% source,target,value\n Electricity grid,Over generation / exports,104.453\n Electricity grid,Heating and cooling - homes,113.726\n Electricity grid,H2 conversion,27.14",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "d82ed473-d56d-4c91-aebd-cb485e29ca99",
"categoryId": "xyChart",
"description": "a sample XYChart diagram",
"content": "xychart-beta\n title \"Sales Revenue\"\n x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]\n y-axis \"Revenue (in $)\" 4000 --> 11000\n bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]\n line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "f86fb3d9-f471-4959-aa8d-7690249a89af",
"categoryId": "packet",
"description": "a sample packet diagram",
"content": "packet-beta\ntitle UDP Packet\n0-15: \"Source Port\"\n16-31: \"Destination Port\"\n32-47: \"Length\"\n48-63: \"Checksum\"\n64-95: \"Data (variable length)\"\n",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "fb11b025-a75a-4ab0-9899-dbcdedc4e9e9",
"categoryId": "kanban",
"description": "a sample kanban diagram",
"content": "kanban\n Todo\n [Create Documentation]\n docs[Create Blog about the new diagram]\n [In progress]\n id6[Create renderer so that it works in all cases. We also add som extra text here for testing purposes. And some more just for the extra flare.]\n id9[Ready for deploy]\n id8[Design grammar]@{ assigned: 'knsv' }\n id10[Ready for test]\n id4[Create parsing tests]@{ ticket: MC-2038, assigned: 'K.Sveidqvist', priority: 'High' }\n id66[last item]@{ priority: 'Very Low', assigned: 'knsv' }\n id11[Done]\n id5[define getData]\n id2[Title of diagram is more than 100 chars when user duplicates diagram with 100 char]@{ ticket: MC-2036, priority: 'Very High'}\n id3[Update DB function]@{ ticket: MC-2037, assigned: knsv, priority: 'High' }\n\n id12[Can't reproduce]\n id3[Weird flickering in Firefox]",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "15472020-61fb-48cf-bcf5-7af237bc995a",
"categoryId": "block",
"description": "a sample block diagram",
"content": "block-beta\ncolumns 1\n db((\"DB\"))\n blockArrowId6<[\"&nbsp;&nbsp;&nbsp;\"]>(down)\n block:ID\n A\n B[\"A wide one in the middle\"]\n C\n end\n space\n D\n ID --> D\n C --> D\n style B fill:#969,stroke:#333,stroke-width:4px\n",
"sortingOrder": 0,
"isPinned": false
},
{
"id": "7d04139f-d34e-46cc-9311-e42de11881d4",
"categoryId": "architecture",
"description": "a sample architecture diagram",
"content": "architecture-beta\n group api(cloud)[API]\n\n service db(database)[Database] in api\n service disk1(disk)[Storage] in api\n service disk2(disk)[Storage] in api\n service server(server)[Server] in api\n\n db:L -- R:server\n disk1:T -- B:server\n disk2:T -- B:db\n",
"sortingOrder": 0,
"isPinned": false
}
],
"customCategories": [],
"selectedCategoryId": "stateDiagram",
"defaultCategorySortOrders": {},
"categoryModifications": {}
}
File diff suppressed because it is too large. Load diff
+11
View File
@@ -0,0 +1,11 @@
{
"id": "mermaid-tools",
"name": "Mermaid Tools",
"version": "1.3.0",
"minAppVersion": "1.4.0",
"description": "Improved Mermaid.js experience for Obsidian: visual toolbar with common elements & more",
"author": "dartungar",
"authorUrl": "https://dartungar.com",
"fundingUrl": "https://www.paypal.com/paypalme/dartungar",
"isDesktopOnly": false
}
+149
View File
@@ -0,0 +1,149 @@
.mermaid-toolbar-container, .mermaid-toolbar-container * {
max-width: 100%;
max-height: 100%;
}
.mermaid-toolbar-top-row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 8px;
}
.mermaid-toolbar-elements-container {
padding-top: 1rem;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.mermaid-toolbar-element {
font-size: var(--font-ui-small);
cursor: pointer;
padding: 2px 2px 2px 5px;
border-radius: 3px;
flex: 1 0 auto;
}
.mermaid-toolbar-element:hover {
background-color: var(--interactive-hover);
}
.mermaid-tools-element-category-header::before {
content: "▼ ";
font-size: 70%;
padding-bottom: 2px;
}
.mermaid-tools-element-category-header.collapsed::before {
content: "▶ ";
font-size: 70%;
padding-bottom: 2px;
}
.mermaid-tools-element-container {
padding-top: 6px;
border-bottom: var(--border-width) solid var(--color-base-35);
}
.mermaid-tools-edit-element-modal > div {
margin-bottom: 0.5rem;
}
.mermaid-tools-edit-element-modal label {
margin-right: 1rem;
}
/* Custom Category Management Styles */
.mermaid-tools-category-management {
margin-bottom: 2rem;
padding: 1rem;
border: 1px solid var(--color-base-25);
border-radius: 8px;
background-color: var(--color-base-00);
}
.mermaid-tools-category-management h3 {
margin-top: 1rem;
margin-bottom: 0.5rem;
color: var(--text-accent);
}
.mermaid-tools-category-management button.mod-cta {
margin-bottom: 1rem;
}
/* Edit Category Modal Styles */
.mermaid-tools-edit-category-modal {
min-width: 500px;
}
.mermaid-tools-edit-category-modal .setting-item {
padding: 8px 0;
border: none;
}
.mermaid-tools-edit-category-modal .setting-item-info {
flex-grow: 1;
margin-right: 12px;
}
.mermaid-tools-edit-category-modal .setting-item-name {
font-weight: 600;
color: var(--text-normal);
}
.mermaid-tools-edit-category-modal .setting-item-description {
color: var(--text-muted);
font-size: var(--font-ui-smaller);
}
.mermaid-tools-edit-category-modal input,
.mermaid-tools-edit-category-modal textarea {
width: 100%;
padding: 4px 8px;
border: 1px solid var(--color-base-30);
border-radius: 4px;
background-color: var(--color-base-00);
color: var(--text-normal);
}
.mermaid-tools-edit-category-modal input:focus,
.mermaid-tools-edit-category-modal textarea:focus {
border-color: var(--color-accent);
outline: none;
box-shadow: 0 0 0 2px var(--color-accent-2);
}
.modal-button-container {
display: flex;
justify-content: flex-end;
gap: 10px;
margin-top: 20px;
padding-top: 16px;
border-top: 1px solid var(--color-base-25);
}
.modal-button-container button {
padding: 6px 16px;
border: 1px solid var(--color-base-30);
border-radius: 4px;
background-color: var(--color-base-10);
color: var(--text-normal);
cursor: pointer;
font-size: var(--font-ui-small);
}
.modal-button-container button:hover {
background-color: var(--color-base-20);
}
.modal-button-container button.mod-cta {
background-color: var(--color-accent);
color: var(--text-on-accent);
border-color: var(--color-accent);
}
.modal-button-container button.mod-cta:hover {
background-color: var(--color-accent-hover);
}
+34
View File
@@ -0,0 +1,34 @@
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository (https://github.com/Vinzent03/obsidian-advanced-uri)
*/
var Ue=Object.create;var Z=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Ne=Object.getPrototypeOf,We=Object.prototype.hasOwnProperty;var Be=(s,n)=>()=>(n||s((n={exports:{}}).exports,n),n.exports),$e=(s,n)=>{for(var e in n)Z(s,e,{get:n[e],enumerable:!0})},ge=(s,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of He(n))!We.call(s,i)&&i!==e&&Z(s,i,{get:()=>n[i],enumerable:!(t=ze(n,i))||t.enumerable});return s};var Ke=(s,n,e)=>(e=s!=null?Ue(Ne(s)):{},ge(n||!s||!s.__esModule?Z(e,"default",{value:s,enumerable:!0}):e,s)),Ge=s=>ge(Z({},"__esModule",{value:!0}),s);var xe=Be((N,se)=>{(function(n,e){typeof N=="object"&&typeof se=="object"?se.exports=e():typeof define=="function"&&define.amd?define([],e):typeof N=="object"?N.feather=e():n.feather=e()})(typeof self!="undefined"?self:N,function(){return function(s){var n={};function e(t){if(n[t])return n[t].exports;var i=n[t]={i:t,l:!1,exports:{}};return s[t].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=s,e.c=n,e.d=function(t,i,o){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:o})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=0)}({"./dist/icons.json":function(s){s.exports={activity:'<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline>',airplay:'<path d="M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1"></path><polygon points="12 15 17 21 7 21 12 15"></polygon>',"alert-circle":'<circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line>',"alert-octagon":'<polygon points="7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"></polygon><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line>',"alert-triangle":'<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line>',"align-center":'<line x1="18" y1="10" x2="6" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="18" y1="18" x2="6" y2="18"></line>',"align-justify":'<line x1="21" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="21" y1="18" x2="3" y2="18"></line>',"align-left":'<line x1="17" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="17" y1="18" x2="3" y2="18"></line>',"align-right":'<line x1="21" y1="10" x2="7" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="21" y1="18" x2="7" y2="18"></line>',anchor:'<circle cx="12" cy="5" r="3"></circle><line x1="12" y1="22" x2="12" y2="8"></line><path d="M5 12H2a10 10 0 0 0 20 0h-3"></path>',aperture:'<circle cx="12" cy="12" r="10"></circle><line x1="14.31" y1="8" x2="20.05" y2="17.94"></line><line x1="9.69" y1="8" x2="21.17" y2="8"></line><line x1="7.38" y1="12" x2="13.12" y2="2.06"></line><line x1="9.69" y1="16" x2="3.95" y2="6.06"></line><line x1="14.31" y1="16" x2="2.83" y2="16"></line><line x1="16.62" y1="12" x2="10.88" y2="21.94"></line>',archive:'<polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line>',"arrow-down-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="8 12 12 16 16 12"></polyline><line x1="12" y1="8" x2="12" y2="16"></line>',"arrow-down-left":'<line x1="17" y1="7" x2="7" y2="17"></line><polyline points="17 17 7 17 7 7"></polyline>',"arrow-down-right":'<line x1="7" y1="7" x2="17" y2="17"></line><polyline points="17 7 17 17 7 17"></polyline>',"arrow-down":'<line x1="12" y1="5" x2="12" y2="19"></line><polyline points="19 12 12 19 5 12"></polyline>',"arrow-left-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="12 8 8 12 12 16"></polyline><line x1="16" y1="12" x2="8" y2="12"></line>',"arrow-left":'<line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline>',"arrow-right-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="12 16 16 12 12 8"></polyline><line x1="8" y1="12" x2="16" y2="12"></line>',"arrow-right":'<line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline>',"arrow-up-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="16 12 12 8 8 12"></polyline><line x1="12" y1="16" x2="12" y2="8"></line>',"arrow-up-left":'<line x1="17" y1="17" x2="7" y2="7"></line><polyline points="7 17 7 7 17 7"></polyline>',"arrow-up-right":'<line x1="7" y1="17" x2="17" y2="7"></line><polylineLine truncated
`:" ";return n.replaceRange(`${l}^${a}`,o),a}static shouldInsertAfter(n){if(n.type)return["blockquote","code","table","heading","comment","footnoteDefinition"].includes(n.type)}static getBlockId(n){let e=n.workspace.getActiveViewOfType(me.MarkdownView);if(e){let t=e.editor,i=e.file,o=this.getBlock(n,t,i);if(o)return this.getIdOfBlock(t,o)}}};var ve={openFileOnWrite:!0,openDailyInNewPane:!1,openFileOnWriteInNewPane:!1,openFileWithoutWriteInNewPane:!1,idField:"id",useUID:!1,addFilepathWhenUsingUID:!1,allowEval:!1,includeVaultName:!0,vaultParam:"name",linkFormats:[{name:"Markdown",format:"[{{name}}]({{uri}})"}]};var we=require("obsidian");function je(s){let n=s.internalPlugins.plugins["daily-notes"];if(n&&n.enabled)return!0}function Ze(...s){let n=[];for(let t=0,i=s.length;t<i;t++)n=n.concat(s[t].split("/"));let e=[];for(let t=0,i=n.length;t<i;t++){let o=n[t];!o||o==="."||e.push(o)}return n[0]===""&&e.unshift(""),e.join("/")}async function be(s,n){let{format:e,folder:t}=n.internalPlugins.getEnabledPluginById("daily-notes").options,i=s.format(e);return i.endsWith(".md")||(i+=".md"),(0,we.normalizePath)(Ze(t,i))}var v=require("obsidian");var Me=require("obsidian"),D=class extends Me.SuggestModal{constructor(e,t,i){super(e.app);this.withFormat=t;this.file=i;this.modes=[null,"overwrite","append","prepend"];this.plugin=e,this.setPlaceholder("Type your data to be written to the file or leave it empty to just open it")}getSuggestions(e){e==""&&(e=null);let t=[];for(let i of this.modes)if(!(i==="overwrite"&&!e)){let o;e?i?o=`Write "${e}" in ${i} mode`:o=`Write "${e}"`:i?o=`Open in ${i} mode`:o="Open",t.push({data:e,display:o,mode:i,func:()=>{this.file?this.plugin.tools.copyURI({filepath:this.file,data:e,mode:i},this.withFormat,this.app.vault.getFileByPath(this.file)):this.plugin.tools.copyURI({daily:"true",data:e,mode:i},this.withFormat,void 0)}})}return t}renderSuggestion(e,t){t.innerText=e.display}onChooseSuggestion(e,t){e.func()}};var Ie=require("obsidian"),R=class extends Ie.FuzzySuggestModal{constructor(e,t,i=!0){super(e.app);this.placeHolder=t;this.allowNoFile=i;this.plugin=e,this.setPlaceholder(this.placeHolder)}getItems(){let e=[];this.allowNoFile&&e.push({display:"<Don't specify a file>",source:void 0});let t=this.app.workspace.getActiveFile();return t&&e.push({display:"<Current file>",source:t.path}),[...e,...this.app.vault.getFiles().map(i=>({display:i.path,source:i.path}))]}getItemText(e){return e.display}onChooseItem(e,t){}};var Ae=require("obsidian");function re(s){return s.viewmode?{state:{mode:s.viewmode,source:s.viewmode=="source"}}:void 0}function z(s){return navigator.clipboard.writeText(s)}function J(s,n){var o;let e=(o=n.parent)==null?void 0:o.path,t=e==="/"?"":e,i=n.name;for(let a=1;a<100;a++){let l=W(i),r=t+(t==""?"":"/")+l+` ${a}.md`;if(!(s.vault.getAbstractFileByPath(r)!==null))return r}}function Fe(s,n){let e=new URL(s.vault.getResourcePath(n));return e.host="localhosthostlocal",e.protocol="file",e.search="",e.pathname=decodeURIComponent(e.pathname),e.toString().replace("/localhosthostlocal/","/")}function ce(s,n,e){var a,l;let t=s.metadataCache.getFileCache(n),i=t.sections,o=(a=t.headings)==null?void 0:a.find(r=>r.heading===e);if(o){let r=i.findIndex(u=>u.type==="heading"&&u.position.start.line===o.position.start.line),c=i.slice(r+1),d=c==null?void 0:c.findIndex(u=>u.type==="heading");return{lastLine:((l=c[(d!==-1?d:c.length)-1])!=null?l:i[r]).position.end.line+1,firstLine:i[r].position.end.line+1}}else new Ae.Notice("Can't find heading")}var U=class extends Error{constructor(e,t,i){super(e);this.name="KeyPathError",this.errKey=t,i&&(this.cause=i)}};function Ce(s){let{originalObject:n,key:e,data:t}=s;if(e.startsWith("[")&&e.endsWith("]")){let i=e.substring(1,e.length-1).split(","),o=n;for(let a=0;a<i.length;a++){let l=i[a],r;if(o instanceof Array){if(r=parseInt(l),Number.isNaN(r)&&(r=o.find(p=>p==l)),r===void 0)throw new U(`Failed to resolve or convert "${l}" to a valid array index.`,l);r=Math.min(r,o.length),r=Math.max(r,-1)}if(a==i.length-1){o instanceof Array?r===-1?o.unshift(t):o[r]=t:o[l]=t;return}let d=!Number.isNaN(parseInt(i[a+1]))?[]:{};try{o instanceof Array?r>=o.length?(o.push(d),o=d):r===-1?(o.unshift(d),o=d):o=o[Math.max(r,0)]:o[l]===void 0?(o[l]=d,o=d):o=o[l]}catch(p){throw new U(`Failed to resolve "${l}" as a valid object key`,l,p)}}}else n[e]=t}function Pe(s){let{obj:n,key:e}=s;if(e.startsWith("[")&&e.endsWith("]")){let t=e.substring(1,e.length-1).split(","),i=n;for(let o of t)if(i instanceof Array){let a=parseInt(o);Number.isNaN(a)?i=i.find(l=>l==o):i=i[a]}else if(i&&typeof i=="object")i=i[o];else return;return i}else return n?n[e]:void 0}var $=class{constructor(n){this.plugin=n;this.app=this.plugin.app}get tools(){return this.plugin.tools}handlePluginManagement(n){if(n["enable-plugin"]){let e=n["enable-plugin"];e in this.app.plugins.manifests&&!this.app.plugins.getPlugin(e)?(this.app.plugins.enablePluginAndSave(e),new v.Notice(`Enabled ${e}`)):this.app.internalPlugins.plug Line truncated
${r.message}`):new v.Notice("Failed to update frontmatter, check console for more details")}});return}z(Pe({obj:i,key:e}))}handleWorkspace(n){let e=this.app.internalPlugins.getEnabledPluginById("workspaces");if(!e)new v.Notice("Workspaces plugin is not enabled"),this.plugin.failure(n);else{if(n.saveworkspace=="true"){let t=e.activeWorkspace;e.saveWorkspace(t),new v.Notice(`Saved current workspace to ${t}`)}n.clipboard&&n.clipboard!="false"?this.tools.copyURI({workspace:e.activeWorkspace}):n.workspace!=null&&e.loadWorkspace(n.workspace),this.plugin.success(n)}}async handleCommand(n){if(n.filepath)if(n.mode){if(n.mode=="new"){let t=this.app.metadataCache.getFirstLinkpathDest(n.filepath,"/");t instanceof v.TFile&&(n.filepath=J(this.app,t))}await this.plugin.open({file:n.filepath,mode:"source",parameters:n});let e=this.app.workspace.getActiveViewOfType(v.MarkdownView);if(e){let t=e.editor,i=t.getValue();if(n.mode==="append"){t.setValue(i+`
`);let o=t.lineCount();t.setCursor({ch:0,line:o})}else n.mode==="prepend"?(t.setValue(`
`+i),t.setCursor({ch:0,line:0})):n.mode==="overwrite"&&t.setValue("")}}else n.line!=null||n.column!=null||n.offset!=null?(await this.plugin.open({file:n.filepath,mode:"source",parameters:n}),await this.plugin.setCursorInLine(n)):await this.plugin.open({file:n.filepath,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n});else(n.openmode||n.viewmode)&&await this.plugin.open({parameters:n});if(n.commandid)this.app.commands.executeCommandById(n.commandid);else if(n.commandname){let e=this.app.commands.commands;for(let t in e)if(e[t].name===n.commandname){e[t].callback?await e[t].callback():e[t].checkCallback(!1);break}}if(n.confirm&&n.confirm!="false"){await new Promise(t=>setTimeout(t,750));let e=document.querySelector(".mod-cta:not([style*='display: none'])");e.click instanceof Function&&e.click()}this.plugin.success(n)}async handleEval(n){if(n.filepath)if(n.mode){if(n.mode=="new"){let t=this.app.metadataCache.getFirstLinkpathDest(n.filepath,"/");t instanceof v.TFile&&(n.filepath=J(this.app,t))}await this.plugin.open({file:n.filepath,mode:"source",parameters:n});let e=this.app.workspace.getActiveViewOfType(v.MarkdownView);if(e){let t=e.editor,i=t.getValue();if(n.mode==="append"){t.setValue(i+`
`);let o=t.lineCount();t.setCursor({ch:0,line:o})}else n.mode==="prepend"?(t.setValue(`
`+i),t.setCursor({ch:0,line:0})):n.mode==="overwrite"&&t.setValue("")}}else n.line!=null||n.column!=null||n.offset!=null?(await this.plugin.open({file:n.filepath,mode:"source",parameters:n}),await this.plugin.setCursorInLine(n)):await this.plugin.open({file:n.filepath,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n});this.plugin.settings.allowEval?((0,eval)(n.eval),this.plugin.success(n)):(new v.Notice("Eval is not allowed. Please enable it in the settings."),this.plugin.failure(n))}async handleDoesFileExist(n){let e=await this.app.vault.adapter.exists(n.filepath);z((e?1:0).toString()),this.plugin.success(n)}async handleSearchAndReplace(n){let e;if(n.filepath){let t=this.app.vault.getAbstractFileByPath(n.filepath);t instanceof v.TFile&&(e=t)}else e=this.app.workspace.getActiveFile();if(e){let t=await this.app.vault.read(e);if(n.searchregex)try{let[,,i,o]=n.searchregex.match(/(\/?)(.+)\1([a-z]*)/i),a=new RegExp(i,o);t=t.replace(a,n.replace),this.plugin.success(n)}catch(i){new v.Notice(`Can't parse ${n.searchregex} as RegEx`),this.plugin.failure(n)}else t=t.replaceAll(n.search,n.replace),this.plugin.success(n);await this.plugin.writeAndOpenFile(e.path,t,n)}else new v.Notice("Cannot find file"),this.plugin.failure(n)}async handleSearch(n){n.filepath&&await this.plugin.open({file:n.filepath,parameters:n});let e=this.app.workspace.getActiveViewOfType(v.FileView);e.currentMode.showSearch();let t=e.currentMode.search;t.searchInputEl.value=n.search,t.searchInputEl.dispatchEvent(new Event("input"))}async handleWrite(n,e=!1){var i;let t;if(n.filepath?t=this.app.vault.getAbstractFileByPath(n.filepath):t=this.app.workspace.getActiveFile(),n.filepath||t){let o,a=(i=n.filepath)!=null?i:t.path;n.mode==="overwrite"?(o=await this.plugin.writeAndOpenFile(a,n.data,n),this.plugin.success(n)):n.mode==="prepend"?(t instanceof v.TFile?o=await this.plugin.prepend(t,n):o=await this.plugin.prepend(a,n),this.plugin.success(n)):n.mode==="append"?(t instanceof v.TFile?o=await this.plugin.append(t,n):o=await this.plugin.append(a,n),this.plugin.success(n)):n.mode==="new"?t instanceof v.TFile?(o=await this.plugin.writeAndOpenFile(J(this.app,t),n.data,n),this.plugin.hookSuccess(n,o)):(o=await this.plugin.writeAndOpenFile(a,n.data,n),this.plugin.hookSuccess(n,o)):!e&&t instanceof v.TFile?(new v.Notice("File already exists"),this.plugin.openExistingFileAndSetCursor(t.path,n),this.plugin.failure(n)):(o=await this.plugin.writeAndOpenFile(a,n.data,n),this.plugin.success(n)),n.uid&&this.tools.writeUIDToFile(o,n.uid)}else new v.Notice("Cannot find file"),this.plugin.failure(n)}async handleOpen(n){if(n.heading!=null){await this.plugin.open({file:n.filepath+"#"+n.heading,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n});let e=this.app.workspace.getActiveViewOfType(v.MarkdownView);if(!e)return;let i=this.app.metadataCache.getFileCache(e.file).headings.find(o=>o.heading===n.heading);e.editor.focus(),e.editor.setCursor({line:i.position.start.line+1,ch:0})}else if(n.block!=null){await this.plugin.open({file:n.filepath+"#^"+n.block,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n});let e=this.app.workspace.getActiveViewOfType(v.MarkdownView);if(!e)return;let i=this.app.metadataCache.getFileCache(e.file).blocks[n.block.toLowerCase()];e.editor.focus(),i&&e.editor.setCursor({line:i.position.start.line,ch:0})}else await this.plugin.open({file:n.filepath,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n}),(n.line!=null||n.column!=null||n.offset!=null)&&await this.plugin.setCursorInLine(n);if(n.mode!=null&&await this.plugin.setCursor(n),n.uid){let e=this.app.workspace.getActiveViewOfType(v.MarkdownView);this.tools.writeUIDToFile(e.file,n.uid)}this.plugin.success(n)}async handleOpenBlock(n){let e=this.tools.getFileFromBlockID(n.block);e&&await this.plugin.chooseHandler({...n,filepath:e.path},!1)}handleCopyFileURI(n,e,t){let i=this.app.workspace.getActiveViewOfType(v.FileView);if(!(!i&&!t)){if(t=t!=null?t:i.file,i instanceof v.MarkdownView){let o=i.editor.getCursor(),a=this.app.metadataCache.getFileCache(i.file);if(a.headings){for(let l of a.headings)if(l.position.start.line<=o.line&&l.position.end.line>=o.line){this.tools.copyURI({filepath:i.file.path,heading:l.heading},e,t);return}}if(a.blocks)for(let l of Object.keys(a.blocks)){let r=a.blocks[l];if(r.position.start.line<=o.line&&r.position.end.line>=o.line){this.tools.copyURI({filepath:i.file.path,block:r.id},e,t);return}}}if(n){let o=t!=null?t:this.app.workspace.getActiveFile();if(!o){new v.Notice("No file opened");return}this.tools.copyURI({filepath:o.path},e,t)}else{let o=new R(this.plugin,"Choose a file",!1);o.open(),o.onChooseItem=(a,l)=>{new D(this.plugin,e,a.source).open()}}}}handleOpenSettings(n){if(this.app.setting.containerEl.parentElement===null&&this.app.setting.open(),n.settingid=="plugin-browser"?(this.app.setting.openTabById("community-plugins"),this.app.setting.activeTab.containerEl.find(".mod-cta"). Line truncated
`),l=`${this.plugin.settings.idField}:`;if(o)a.unshift("---"),a.unshift(`${l} ${e}`),a.unshift("---");else{let d=a.findIndex(p=>p.startsWith(l));d!=-1?a[d]=`${l} ${e}`:a.splice(1,0,`${l} ${e}`)}let r=a.join(`
`);return await this.app.vault.modify(n,r),e}async getUIDFromFile(n){var i;let e=(i=this.app.metadataCache.getFileCache(n))!=null?i:await new Promise(o=>{let a=this.app.metadataCache.on("changed",l=>{if(l.path==n.path){let r=this.app.metadataCache.getFileCache(n);this.app.metadataCache.offref(a),o(r)}})}),t=(0,C.parseFrontMatterEntry)(e.frontmatter,this.plugin.settings.idField);if(t!=null)return t instanceof Array?t[0]:t}async generateURI(n){var a;let e="obsidian://adv-uri",t="",i=this.app.vault.getAbstractFileByPath(n.filepath);this.settings.includeVaultName&&(t+="?vault=",this.settings.vaultParam=="id"&&this.app.appId?t+=encodeURIComponent(this.app.appId):t+=encodeURIComponent(this.app.vault.getName())),this.settings.useUID&&i instanceof C.TFile&&i.extension=="md"&&(this.settings.addFilepathWhenUsingUID||(n.filepath=void 0),n.uid=(a=await this.getUIDFromFile(i))!=null?a:await this.writeUIDToFile(i,pe()));let o=Object.keys(n).filter(l=>n[l]).sort((l,r)=>{let c=["filepath","filename","uid","daily"],d=["data","eval"];return c.includes(l)?-1:c.includes(r)||d.includes(l)?1:d.includes(r)?-1:0});for(let l of o)n[l]!=null&&(t+=t?"&":"?",t+=`${l}=${encodeURIComponent(n[l])}`);return t.endsWith("%20")&&(t+="&"),e+t}async copyURI(n,e=!1,t=void 0){var o,a;let i=await this.generateURI(n);if(e){let l=this.settings.linkFormats;if(l.length==0){new C.Notice("No link formats defined in the settings");return}let r;if(l.length==1)r=l[0];else{let d=l.map(h=>h.name),p=await new ne(this.plugin,{options:d,onlySelection:!0,placeholder:"Select link format"}).openAndGetResult();if(!p){new C.Notice("No link format selected");return}r=l.find(h=>h.name==p)}let c=r.format.replace(/\{\{uri\}\}/g,i).replace(/\{\{path\}\}/g,t==null?void 0:t.path).replace(/\{\{folder\}\}/g,(o=t==null?void 0:t.parent)==null?void 0:o.path).replace(/\{\{name\}\}/g,t==null?void 0:t.basename).replace(/\{\{vaultName\}\}/g,this.app.vault.getName()).replace(/\{\{vaultId\}\}/g,this.app.appId);if(t&&c.match(/\{\{uid\}\}/g)){let d=(a=await this.getUIDFromFile(t))!=null?a:t.basename;c=c.replace(/\{\{uid\}\}/g,d)}if(t&&c.match(/\{\{alias\}\}/g)){let d=(0,C.parseFrontMatterAliases)(this.app.metadataCache.getFileCache(t).frontmatter),p=d?d[0]:t==null?void 0:t.basename;c=c.replace(/\{\{alias\}\}/g,p)}await z(c),new C.Notice(`Advanced URI in format "${r.name}" copied to your clipboard`);return}await z(i),new C.Notice("Advanced URI copied to your clipboard")}getFileFromUID(n){var i;let e=this.app.vault.getMarkdownFiles(),t=this.settings.idField;for(let o of e){let a=(0,C.parseFrontMatterEntry)((i=this.app.metadataCache.getFileCache(o))==null?void 0:i.frontmatter,t);if(a instanceof Array){if(a.contains(n))return o}else if(a==n)return o}}getFileFromBlockID(n){var t,i;let e=this.app.vault.getMarkdownFiles();n=n.toLowerCase();for(let o of e)if(((i=(t=this.app.metadataCache.getFileCache(o))==null?void 0:t.blocks)==null?void 0:i[n])!=null)return o}};var oe=require("obsidian"),ie=class extends oe.FuzzySuggestModal{constructor(e){super(e.app);this.plugin=e,this.setPlaceholder("Choose a workspace")}getItems(){let e=this.app.internalPlugins.getEnabledPluginById("workspaces");if(!e)new oe.Notice("Workspaces plugin is not enabled");else return Object.keys(e.workspaces)}getItemText(e){return e}onChooseItem(e,t){this.plugin.tools.copyURI({workspace:e})}};var ae=class extends w.Plugin{constructor(){super(...arguments);this.handlers=new $(this);this.tools=new K(this)}async onload(){await this.loadSettings(),this.addSettingTab(new _(this.app,this)),this.addCommand({id:"copy-uri-current-file",name:"Copy URI for file with options",callback:()=>this.handlers.handleCopyFileURI(!1,!1)}),this.addCommand({id:"copy-uri-current-file-simple",name:"Copy URI for current file",callback:()=>this.handlers.handleCopyFileURI(!0,!1)}),this.addCommand({id:"copy-uri-current-file-with-format",name:"Copy formatted URI for file with options ",callback:()=>this.handlers.handleCopyFileURI(!1,!0)}),this.addCommand({id:"copy-uri-current-file-simple-with-format",name:"Copy formatted URI for current file",callback:()=>this.handlers.handleCopyFileURI(!0,!0)}),this.addCommand({id:"copy-uri-daily",name:"Copy URI for daily note",callback:()=>new D(this,!1).open()}),this.addCommand({id:"copy-uri-search-and-replace",name:"Copy URI for search and replace",callback:()=>{let e=new R(this,"Used file for search and replace");e.open(),e.onChooseItem=t=>{let i=new q(this);i.open(),i.onChooseSuggestion=o=>{new X(this,o,t==null?void 0:t.source).open()}}}}),this.addCommand({id:"copy-uri-command",name:"Copy URI for command",callback:()=>{let e=new R(this,"Select a file to be opened before executing the command");e.open(),e.onChooseItem=t=>{new Q(this,t==null?void 0:t.source).open()}}}),this.addCommand({id:"copy-uri-block",name:"Copy URI for current block",checkCallback:e=>{let t=this.app.workspace.getActiveViewOfType(w.MarkdownView);if(e)return t!=null;let i=B.getBlockId(this.app);i&&this.tools.copyURI({filepath:t.file.path,block:i},! Line truncated
`),d;if(t.heading){let p=ce(this.app,e,t.heading);if(d=p==null?void 0:p.lastLine,d===void 0)return;p.firstLine==p.lastLine&&t.separator&&(t.separator=`
`+t.separator)}else t.line?d=Number(t.line):d=c.length;d=Math.max(1,d),c[d-1]=((a=c[d-1])!=null?a:"")+((l=t.separator)!=null?l:`
`)+t.data,o=c.join(`
`)}else i=e,o=t.data;return this.writeAndOpenFile(i,o,t)}async prepend(e,t){var a,l,r;let i,o;if(e instanceof w.TFile){i=e.path;let c=await this.app.vault.read(e),d=this.app.metadataCache.getFileCache(e),p=c.split(`
`),h;if(t.heading){if(h=(a=ce(this.app,e,t.heading))==null?void 0:a.firstLine,h===void 0)return;h+=1}else t.line?h=Number(t.line):d.frontmatterPosition?h=d.frontmatterPosition.end.line+2:h=1;h=Math.max(1,h),p[h-1]=`${t.data}${(l=t.separator)!=null?l:`
`}${(r=p[h-1])!=null?r:""}`,o=p.join(`
`)}else i=e,o=t.data;return this.writeAndOpenFile(i,o,t)}async writeAndOpenFile(e,t,i){let o=this.app.vault.getAbstractFileByPath(e);if(o instanceof w.TFile)await this.app.vault.modify(o,t);else{let a=e.split("/"),l=a.slice(0,a.length-1).join("/");a.length>1&&!(this.app.vault.getAbstractFileByPath(l)instanceof w.TFolder)&&await this.app.vault.createFolder(l),/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/.test(t)?await this.app.vault.createBinary(e,(0,w.base64ToArrayBuffer)(t)):await this.app.vault.create(e,t)}return this.openExistingFileAndSetCursor(e,i),this.app.vault.getAbstractFileByPath(e)}async openExistingFileAndSetCursor(e,t){t.openmode!="silent"&&this.settings.openFileOnWrite&&(await this.open({file:e,setting:this.settings.openFileOnWriteInNewPane,parameters:t}),t.line!=null||t.column!=null||t.offset!=null?await this.setCursorInLine(t):t.mode!=null&&await this.setCursor(t))}async open({file:e,setting:t,parameters:i,supportPopover:o,mode:a}){var r;let l;if(i.openmode=="popover"&&(o==null||o)){let c=this.app.plugins.plugins["obsidian-hover-editor"];c||(new w.Notice("Cannot find Hover Editor plugin. Please file an issue."),this.failure(i)),await new Promise(d=>{l=c.spawnPopover(void 0,()=>{this.app.workspace.setActiveLeaf(l,{focus:!0}),d()})})}else{let c=t;if(i.newpane!==void 0&&(c=i.newpane=="true"),i.openmode!==void 0&&(i.openmode=="true"||i.openmode=="false"?c=i.openmode=="true":i.openmode=="popover"?c=!1:w.Platform.isMobile&&i.openmode=="window"||(c=i.openmode)),c=="silent")return;if(w.Platform.isMobileApp&&c=="window"&&(c=!0),e!=null){let d=!1;isBoolean(c)&&this.app.workspace.iterateAllLeaves(p=>{var h;if(((h=p.view.file)==null?void 0:h.path)===i.filepath){if(d&&p.width==0)return;d=!0,this.app.workspace.setActiveLeaf(p,{focus:!0}),l=p}})}l||(l=this.app.workspace.getLeaf(c),this.app.workspace.setActiveLeaf(l,{focus:!0}))}if(e instanceof w.TFile?await l.openFile(e):e!=null&&await this.app.workspace.openLinkText(e,"/",!1,a!=null?{state:{mode:a}}:re(i)),l.view instanceof w.MarkdownView){let c=l.getViewState();a!=null?c.state.mode=a:c.state={...c.state,...(r=re(i))==null?void 0:r.state},await l.setViewState(c)}return l}async setCursor(e){let t=this.app.workspace.getActiveViewOfType(w.MarkdownView);if(!t)return;let i=e.mode,o=t.editor,a=t.leaf.getViewState();if(a.state.mode="source",i==="append"){let l=o.lastLine(),r=o.getLine(l).length;await t.leaf.setViewState(a,{focus:!0}),o.setCursor({ch:r,line:l}),t.editor.scrollIntoView({from:{line:l,ch:r},to:{line:l,ch:r}},!0)}else i==="prepend"&&(await t.leaf.setViewState(a,{focus:!0}),o.setCursor({ch:0,line:0}),t.editor.scrollIntoView({from:{line:0,ch:0},to:{line:0,ch:0}},!0));await new Promise(l=>setTimeout(l,10)),e.viewmode=="preview"&&(a.state.mode="preview",await t.leaf.setViewState(a))}async setCursorInLine(e){let t=this.app.workspace.getActiveViewOfType(w.MarkdownView);if(!t)return;let i=t.leaf.getViewState(),o=e.line!=null?Number(e.line):void 0,a=e.column?Number(e.column):void 0;i.state.mode="source",await t.leaf.setViewState(i);let l,r;if(e.offset!=null){let c=t.editor.offsetToPos(Number(e.offset));l=c.line,r=c.ch}else{l=o!=null?Math.min(o-1,t.editor.lineCount()-1):t.editor.getCursor().line;let c=t.editor.getLine(l).length-1;r=Math.min(a-1,c)}t.editor.focus(),t.editor.setCursor({line:l,ch:r}),t.editor.scrollIntoView({from:{line:l,ch:r},to:{line:l,ch:r}},!0),await new Promise(c=>setTimeout(c,10)),e.viewmode=="preview"&&(i.state.mode="preview",await t.leaf.setViewState(i))}async loadSettings(){this.settings=Object.assign(ve,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}};
//! All of these methods are taken from https://www.npmjs.com/package/obsidian-daily-notes-interface.
/*! Bundled license information:
feather-icons/dist/feather.js:
(*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*)
*/
/* nosourcemap */
+11
View File
@@ -0,0 +1,11 @@
{
"id": "obsidian-advanced-uri",
"name": "Advanced URI",
"description": "Advanced modes for Obsidian URI",
"isDesktopOnly": false,
"js": "main.js",
"fundingUrl": "https://ko-fi.com/vinzent",
"version": "1.46.0",
"author": "Vinzent",
"authorUrl": "https://github.com/Vinzent03"
}
+881
View File
@@ -0,0 +1,881 @@
{
"copyLinkToElemenetAnchorTo100": false,
"copyFrameLinkByName": false,
"disableDoubleClickTextEditing": false,
"phoneFooterSafeAreaPadding": false,
"folder": "Excalidraw",
"cropFolder": "",
"annotateFolder": "",
"embedUseExcalidrawFolder": false,
"templateFilePath": "Excalidraw/Template.excalidraw",
"scriptFolderPath": "Excalidraw/Scripts",
"fontAssetsPath": "Excalidraw/CJK Fonts",
"loadChineseFonts": false,
"loadJapaneseFonts": false,
"loadKoreanFonts": false,
"compress": true,
"decompressForMDView": false,
"onceOffCompressFlagReset": true,
"onceOffGPTVersionReset": true,
"autosave": true,
"autosaveIntervalDesktop": 60000,
"autosaveIntervalMobile": 30000,
"drawingFilenamePrefix": "Drawing ",
"drawingEmbedPrefixWithFilename": true,
"drawingFilnameEmbedPostfix": " ",
"drawingFilenameDateTime": "YYYY-MM-DD HH.mm.ss",
"useExcalidrawExtension": true,
"cropSuffix": "",
"cropPrefix": "cropped_",
"annotateSuffix": "",
"annotatePrefix": "annotated_",
"annotatePreserveSize": false,
"displaySVGInPreview": false,
"previewImageType": "SVG",
"renderingConcurrency": 3,
"allowImageCache": true,
"allowImageCacheInScene": true,
"displayExportedImageIfAvailable": false,
"previewMatchObsidianTheme": false,
"width": "400",
"height": "",
"overrideObsidianFontSize": false,
"dynamicStyling": "colorful",
"isLeftHanded": false,
"desktopUIMode": "tray",
"tabletUIMode": "compact",
"phoneUIMode": "mobile",
"iframeMatchExcalidrawTheme": true,
"matchTheme": false,
"matchThemeAlways": false,
"matchThemeTrigger": false,
"defaultMode": "normal",
"defaultPenMode": "never",
"penModeDoubleTapEraser": true,
"penModeSingleFingerPanning": true,
"penModeCrosshairVisible": true,
"panWithRightMouseButton": false,
"renderImageInMarkdownReadingMode": false,
"renderImageInHoverPreviewForMDNotes": false,
"renderImageInMarkdownToPDF": false,
"allowPinchZoom": false,
"allowWheelZoom": false,
"zoomToFitOnOpen": true,
"zoomToFitOnResize": false,
"zoomToFitMaxLevel": 2,
"zoomStep": 0.05,
"zoomMin": 0.1,
"zoomMax": 30,
"linkPrefix": "📍",
"urlPrefix": "🌐",
"parseTODO": false,
"todo": "☐",
"done": "🗹",
"hoverPreviewWithoutCTRL": false,
"linkOpacity": 1,
"openInAdjacentPane": true,
"showSecondOrderLinks": true,
"focusOnFileTab": true,
"openInMainWorkspace": true,
"showLinkBrackets": false,
"syncElementLinkWithText": false,
"allowCtrlClick": true,
"forceWrap": false,
"pageTransclusionCharLimit": 200,
"wordWrappingDefault": 0,
"removeTransclusionQuoteSigns": true,
"iframelyAllowed": true,
"pngExportScale": 1,
"exportWithTheme": true,
"exportWithBackground": true,
"exportPaddingSVG": 10,
"exportEmbedScene": false,
"keepInSync": false,
"autoexportSVG": false,
"autoexportPNG": false,
"autoExportLightAndDark": false,
"autoexportExcalidraw": false,
"embedType": "excalidraw",
"embedMarkdownCommentLinks": true,
"embedWikiLink": true,
"syncExcalidraw": false,
"experimentalFileType": false,
"experimentalFileTag": "✏️",
"experimentalLivePreview": true,
"fadeOutExcalidrawMarkup": false,
"loadPropertySuggestions": false,
"experimentalEnableFourthFont": false,
"experimantalFourthFont": "Virgil",
"addDummyTextElement": false,
"zoteroCompatibility": false,
"fieldSuggester": true,
"compatibilityMode": false,
"drawingOpenCount": 0,
"library": "deprecated",
"library2": {
"type": "excalidrawlib",
"version": 2,
"source": "https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/2.22.3",
"libraryItems": [
{
"id": "5jZQ4wlXwrDTITvKzlVgB",
"status": "unpublished",
"elements": [
{
"id": "ArjRS5F4K9qG3ESlI0wxN",
"type": "line",
"x": -198.13502768915123,
"y": 116.13781424421677,
"width": 540.334851645255,
"height": 414.90622152342127,
"angle": 0,
"strokeColor": "#f08c00",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a4",
"roundness": {
"type": 2
},
"seed": 1987023854,
"version": 296,
"versionNonce": 830307186,
"isDeleted": false,
"boundElements": [],
"updated": 1778802998020,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
373.68925435477666,
-129.55197288371284
],
[
540.334851645255,
-414.90622152342127
]
],
"startBinding": null,
"endBinding": null,
"startArrowhead": null,
"endArrowhead": null,
"polygon": false,
"hasTextLink": false
}
],
"created": 1778803003480
}
]
},
"imageElementNotice": true,
"mdSVGwidth": 500,
"mdSVGmaxHeight": 800,
"mdFont": "Virgil",
"mdFontColor": "Black",
"mdBorderColor": "Black",
"mdCSS": "",
"scriptEngineSettings": {},
"previousRelease": "2.22.3",
"showReleaseNotes": true,
"excalidrawMasteryPromoCollapsed": false,
"compareManifestToPluginVersion": true,
"showNewVersionNotification": true,
"latexBoilerplate": "\\color{blue}",
"latexPreambleLocation": "preamble.sty",
"taskboneEnabled": false,
"taskboneAPIkey": "",
"pinnedScripts": [],
"sidepanelTabs": [],
"customPens": [
{
"type": "default",
"freedrawOnly": false,
"strokeColor": "#000000",
"backgroundColor": "transparent",
"fillStyle": "hachure",
"strokeWidth": 0,
"roughness": 0,
"penOptions": {
"highlighter": false,
"constantPressure": false,
"hasOutline": false,
"outlineWidth": 1,
"options": {
"thinning": 0.6,
"smoothing": 0.5,
"streamline": 0.5,
"easing": "easeOutSine",
"start": {
"cap": true,
"taper": 0,
"easing": "linear"
},
"end": {
"cap": true,
"taper": 0,
"easing": "linear"
}
}
}
},
{
"type": "highlighter",
"freedrawOnly": true,
"strokeColor": "#FFC47C",
"backgroundColor": "#FFC47C",
"fillStyle": "solid",
"strokeWidth": 2,
"roughness": null,
"penOptions": {
"highlighter": true,
"constantPressure": true,
"hasOutline": true,
"outlineWidth": 4,
"options": {
"thinning": 1,
"smoothing": 0.5,
"streamline": 0.5,
"easing": "linear",
"start": {
"taper": 0,
"cap": true,
"easing": "linear"
},
"end": {
"taper": 0,
"cap": true,
"easing": "linear"
}
}
}
},
{
"type": "finetip",
"freedrawOnly": false,
"strokeColor": "#3E6F8D",
"backgroundColor": "transparent",
"fillStyle": "hachure",
"strokeWidth": 0.5,
"roughness": 0,
"penOptions": {
"highlighter": false,
"hasOutline": false,
"outlineWidth": 1,
"constantPressure": true,
"options": {
"smoothing": 0.4,
"thinning": -0.5,
"streamline": 0.4,
"easing": "linear",
"start": {
"taper": 5,
"cap": false,
"easing": "linear"
},
"end": {
"taper": 5,
"cap": false,
"easing": "linear"
}
}
}
},
{
"type": "fountain",
"freedrawOnly": false,
"strokeColor": "#000000",
"backgroundColor": "transparent",
"fillStyle": "hachure",
"strokeWidth": 2,
"roughness": 0,
"penOptions": {
"highlighter": false,
"constantPressure": false,
"hasOutline": false,
"outlineWidth": 1,
"options": {
"smoothing": 0.2,
"thinning": 0.6,
"streamline": 0.2,
"easing": "easeInOutSine",
"start": {
"taper": 150,
"cap": true,
"easing": "linear"
},
"end": {
"taper": 1,
"cap": true,
"easing": "linear"
}
}
}
},
{
"type": "marker",
"freedrawOnly": true,
"strokeColor": "#B83E3E",
"backgroundColor": "#FF7C7C",
"fillStyle": "dashed",
"strokeWidth": 2,
"roughness": 3,
"penOptions": {
"highlighter": false,
"constantPressure": true,
"hasOutline": true,
"outlineWidth": 4,
"options": {
"thinning": 1,
"smoothing": 0.5,
"streamline": 0.5,
"easing": "linear",
"start": {
"taper": 0,
"cap": true,
"easing": "linear"
},
"end": {
"taper": 0,
"cap": true,
"easing": "linear"
}
}
}
},
{
"type": "thick-thin",
"freedrawOnly": true,
"strokeColor": "#CECDCC",
"backgroundColor": "transparent",
"fillStyle": "hachure",
"strokeWidth": 0,
"roughness": null,
"penOptions": {
"highlighter": true,
"constantPressure": true,
"hasOutline": false,
"outlineWidth": 1,
"options": {
"thinning": 1,
"smoothing": 0.5,
"streamline": 0.5,
"easing": "linear",
"start": {
"taper": 0,
"cap": true,
"easing": "linear"
},
"end": {
"cap": true,
"taper": true,
"easing": "linear"
}
}
}
},
{
"type": "thin-thick-thin",
"freedrawOnly": true,
"strokeColor": "#CECDCC",
"backgroundColor": "transparent",
"fillStyle": "hachure",
"strokeWidth": 0,
"roughness": null,
"penOptions": {
"highlighter": true,
"constantPressure": true,
"hasOutline": false,
"outlineWidth": 1,
"options": {
"thinning": 1,
"smoothing": 0.5,
"streamline": 0.5,
"easing": "linear",
"start": {
"cap": true,
"taper": true,
"easing": "linear"
},
"end": {
"cap": true,
"taper": true,
"easing": "linear"
}
}
}
},
{
"type": "default",
"freedrawOnly": false,
"strokeColor": "#000000",
"backgroundColor": "transparent",
"fillStyle": "hachure",
"strokeWidth": 0,
"roughness": 0,
"penOptions": {
"highlighter": false,
"constantPressure": false,
"hasOutline": false,
"outlineWidth": 1,
"options": {
"thinning": 0.6,
"smoothing": 0.5,
"streamline": 0.5,
"easing": "easeOutSine",
"start": {
"cap": true,
"taper": 0,
"easing": "linear"
},
"end": {
"cap": true,
"taper": 0,
"easing": "linear"
}
}
}
},
{
"type": "default",
"freedrawOnly": false,
"strokeColor": "#000000",
"backgroundColor": "transparent",
"fillStyle": "hachure",
"strokeWidth": 0,
"roughness": 0,
"penOptions": {
"highlighter": false,
"constantPressure": false,
"hasOutline": false,
"outlineWidth": 1,
"options": {
"thinning": 0.6,
"smoothing": 0.5,
"streamline": 0.5,
"easing": "easeOutSine",
"start": {
"cap": true,
"taper": 0,
"easing": "linear"
},
"end": {
"cap": true,
"taper": 0,
"easing": "linear"
}
}
}
},
{
"type": "default",
"freedrawOnly": false,
"strokeColor": "#000000",
"backgroundColor": "transparent",
"fillStyle": "hachure",
"strokeWidth": 0,
"roughness": 0,
"penOptions": {
"highlighter": false,
"constantPressure": false,
"hasOutline": false,
"outlineWidth": 1,
"options": {
"thinning": 0.6,
"smoothing": 0.5,
"streamline": 0.5,
"easing": "easeOutSine",
"start": {
"cap": true,
"taper": 0,
"easing": "linear"
},
"end": {
"cap": true,
"taper": 0,
"easing": "linear"
}
}
}
}
],
"numberOfCustomPens": 0,
"pdfScale": 4,
"pdfBorderBox": true,
"pdfFrame": false,
"pdfGapSize": 20,
"pdfGroupPages": false,
"pdfLockAfterImport": true,
"pdfNumColumns": 1,
"pdfNumRows": 1,
"pdfDirection": "right",
"pdfImportScale": 0.3,
"gridSettings": {
"DYNAMIC_COLOR": true,
"COLOR": "#000000",
"OPACITY": 50,
"GRID_DIRECTION": {
"horizontal": true,
"vertical": true
}
},
"laserSettings": {
"DECAY_LENGTH": 50,
"DECAY_TIME": 1000,
"COLOR": "#ff0000"
},
"embeddableMarkdownDefaults": {
"useObsidianDefaults": false,
"backgroundMatchCanvas": false,
"backgroundMatchElement": true,
"backgroundColor": "#fff",
"backgroundOpacity": 60,
"borderMatchElement": true,
"borderColor": "#fff",
"borderOpacity": 0,
"filenameVisible": false
},
"markdownNodeOneClickEditing": false,
"canvasImmersiveEmbed": true,
"startupScriptPath": "",
"aiEnabled": true,
"openAIAPIToken": "",
"openAIDefaultTextModel": "gpt-5-mini",
"openAIDefaultTextModelMaxTokens": 4096,
"openAIDefaultVisionModel": "gpt-5-mini",
"openAIDefaultImageGenerationModel": "gpt-image-1",
"openAIURL": "https://api.openai.com/v1/chat/completions",
"openAIImageGenerationURL": "https://api.openai.com/v1/images/generations",
"openAIImageEditsURL": "https://api.openai.com/v1/images/edits",
"openAIImageVariationURL": "https://api.openai.com/v1/images/variations",
"modifierKeyConfig": {
"Mac": {
"LocalFileDragAction": {
"defaultAction": "image-import",
"rules": [
{
"shift": false,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "image-import"
},
{
"shift": true,
"ctrl_cmd": false,
"alt_opt": true,
"meta_ctrl": false,
"result": "link"
},
{
"shift": true,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "image-url"
},
{
"shift": false,
"ctrl_cmd": false,
"alt_opt": true,
"meta_ctrl": false,
"result": "embeddable"
}
]
},
"WebBrowserDragAction": {
"defaultAction": "image-url",
"rules": [
{
"shift": false,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "image-url"
},
{
"shift": true,
"ctrl_cmd": false,
"alt_opt": true,
"meta_ctrl": false,
"result": "link"
},
{
"shift": false,
"ctrl_cmd": false,
"alt_opt": true,
"meta_ctrl": false,
"result": "embeddable"
},
{
"shift": true,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "image-import"
}
]
},
"InternalDragAction": {
"defaultAction": "link",
"rules": [
{
"shift": false,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "link"
},
{
"shift": false,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": true,
"result": "embeddable"
},
{
"shift": true,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "image"
},
{
"shift": true,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": true,
"result": "image-fullsize"
}
]
},
"LinkClickAction": {
"defaultAction": "new-tab",
"rules": [
{
"shift": true,
"ctrl_cmd": true,
"alt_opt": false,
"meta_ctrl": false,
"result": "active-pane"
},
{
"shift": false,
"ctrl_cmd": true,
"alt_opt": false,
"meta_ctrl": false,
"result": "new-tab"
},
{
"shift": false,
"ctrl_cmd": true,
"alt_opt": true,
"meta_ctrl": false,
"result": "new-pane"
},
{
"shift": true,
"ctrl_cmd": true,
"alt_opt": true,
"meta_ctrl": false,
"result": "popout-window"
},
{
"shift": false,
"ctrl_cmd": true,
"alt_opt": false,
"meta_ctrl": true,
"result": "md-properties"
}
]
}
},
"Win": {
"LocalFileDragAction": {
"defaultAction": "image-import",
"rules": [
{
"shift": false,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "image-import"
},
{
"shift": false,
"ctrl_cmd": true,
"alt_opt": false,
"meta_ctrl": false,
"result": "link"
},
{
"shift": true,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "image-url"
},
{
"shift": true,
"ctrl_cmd": true,
"alt_opt": false,
"meta_ctrl": false,
"result": "embeddable"
}
]
},
"WebBrowserDragAction": {
"defaultAction": "image-url",
"rules": [
{
"shift": false,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "image-url"
},
{
"shift": false,
"ctrl_cmd": true,
"alt_opt": false,
"meta_ctrl": false,
"result": "link"
},
{
"shift": true,
"ctrl_cmd": true,
"alt_opt": false,
"meta_ctrl": false,
"result": "embeddable"
},
{
"shift": true,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "image-import"
}
]
},
"InternalDragAction": {
"defaultAction": "link",
"rules": [
{
"shift": false,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "link"
},
{
"shift": true,
"ctrl_cmd": true,
"alt_opt": false,
"meta_ctrl": false,
"result": "embeddable"
},
{
"shift": true,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "image"
},
{
"shift": false,
"ctrl_cmd": true,
"alt_opt": true,
"meta_ctrl": false,
"result": "image-fullsize"
}
]
},
"LinkClickAction": {
"defaultAction": "new-tab",
"rules": [
{
"shift": false,
"ctrl_cmd": false,
"alt_opt": false,
"meta_ctrl": false,
"result": "active-pane"
},
{
"shift": false,
"ctrl_cmd": true,
"alt_opt": false,
"meta_ctrl": false,
"result": "new-tab"
},
{
"shift": false,
"ctrl_cmd": true,
"alt_opt": true,
"meta_ctrl": false,
"result": "new-pane"
},
{
"shift": true,
"ctrl_cmd": true,
"alt_opt": true,
"meta_ctrl": false,
"result": "popout-window"
},
{
"shift": false,
"ctrl_cmd": true,
"alt_opt": false,
"meta_ctrl": true,
"result": "md-properties"
}
]
}
}
},
"slidingPanesSupport": false,
"areaZoomLimit": 1,
"longPressDesktop": 500,
"longPressMobile": 500,
"doubleClickLinkOpenViewMode": true,
"isDebugMode": false,
"rank": "Bronze",
"modifierKeyOverrides": [
{
"modifiers": [
"Mod"
],
"key": "Enter"
},
{
"modifiers": [
"Mod"
],
"key": "k"
},
{
"modifiers": [
"Mod"
],
"key": "G"
}
],
"showSplashscreen": false,
"pdfSettings": {
"pageSize": "A4",
"pageOrientation": "portrait",
"fitToPage": 1,
"paperColor": "white",
"customPaperColor": "#ffffff",
"alignment": "center",
"margin": "normal"
},
"disableContextMenu": false
}
+10
View File
@@ -0,0 +1,10 @@
"use strict";var obsidian_module=require("obsidian"),view=require("@codemirror/view"),commands=require("@codemirror/commands"),lr=require("@lezer/lr"),language=require("@codemirror/language"),state=require("@codemirror/state");;const INITIAL_TIMESTAMP=Date.now();var LZString=function(){var r=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",e={};function t(r,o){if(!e[r]){e[r]={};for(var n=0;n<r.length;n++)e[r][r.charAt(n)]=n}return e[r][o]}var i={compressToBase64:function(r){if(null==r)return"";var n=i._compress(r,6,function(r){return o.charAt(r)});switch(n.length%4){default:case 0:return n;case 1:return n+"===";case 2:return n+"==";case 3:return n+"="}},decompressFromBase64:function(r){return null==r?"":""==r?null:i._decompress(r.length,32,function(n){return t(o,r.charAt(n))})},compressToUTF16:function(o){return null==o?"":i._compress(o,15,function(o){return r(o+32)})+" "},decompressFromUTF16:function(r){return null==r?"":""==r?null:i._decompress(r.length,16384,function(o){return r.charCodeAt(o)-32})},compressToUint8Array:function(r){for(var o=i.compress(r),n=new Uint8Array(2*o.length),e=0,t=o.length;e<t;e++){var s=o.charCodeAt(e);n[2*e]=s>>>8,n[2*e+1]=s%256}return n},decompressFromUint8Array:function(o){if(null==o)return i.decompress(o);for(var n=new Array(o.length/2),e=0,t=n.length;e<t;e++)n[e]=256*o[2*e]+o[2*e+1];var s=[];return n.forEach(function(o){s.push(r(o))}),i.decompress(s.join(""))},compressToEncodedURIComponent:function(r){return null==r?"":i._compress(r,6,function(r){return n.charAt(r)})},decompressFromEncodedURIComponent:function(r){return null==r?"":""==r?null:(r=r.replace(/ /g,"+"),i._decompress(r.length,32,function(o){return t(n,r.charAt(o))}))},compress:function(o){return i._compress(o,16,function(o){return r(o)})},_compress:function(r,o,n){if(null==r)return"";var e,t,i,s={},u={},a="",p="",c="",l=2,f=3,h=2,d=[],m=0,v=0;for(i=0;i<r.length;i+=1)if(a=r.charAt(i),Object.prototype.hasOwnProperty.call(s,a)||(s[a]=f++,u[a]=!0),p=c+a,Object.prototype.hasOwnProperty.call(s,p))c=p;else{if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++),s[p]=f++,c=String(a)}if(""!==c){if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++)}for(t=2,e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==o-1){d.push(n(m));break}v++}return d.join("")},decompress:function(r){return null==r?"":""==r?null:i._decompress(r.length,32768,function(o){return r.charCodeAt(o)})},_decompress:function(o,n,e){var t,i,s,u,a,p,c,l=[],f=4,h=4,d=3,m="",v=[],g={val:e(0),position:n,index:1};for(t=0;t<3;t+=1)l[t]=t;for(s=0,a=Math.pow(2,2),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;switch(s){case 0:for(s=0,a=Math.pow(2,8),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 1:for(s=0,a=Math.pow(2,16),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 2:return""}for(l[3]=c,i=c,v.push(c);;){if(g.index>o)return"";for(s=0,a=Math.pow(2,d),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;switch(c=s){case 0:for(s=0,a=Math.pow(2,8),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;l[h++]=r(s),c=h-1,f--;break;case 1:for(s=0,a=Math.pow(2,16),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;l[h++]=r(s),c=h-1,f--;break;case 2:return v.join("")}if(0==f&&(f=Math.pow(2,d),d++),l[c])m=l[c];else{if(c!==h)return null;m=i+i.charAt(0)}v.push(m),l[h++]=i+m.charAt(0),i=m,0==--f&&(f=Math.pow(2,d),d++)}}};return i}();"function"==typeof define&&define.amd?define(function(){return LZString}):"undefined"!=typeof module&&null!=module?module.exports=LZString:"undefined"!=typeof angular&&null!=angular&&Line truncated
let REACT_PACKAGES = `!function(){var e,t;e=this,t=function(e){function M(e){return null!==e&&"object"==typeof e&&"function"==typeof(e=te&&e[te]||e["@@iterator"])?e:null}function t(e,t,n){this.props=e,this.context=t,this.refs=oe,this.updater=n||ne}function n(){}function r(e,t,n){this.props=e,this.context=t,this.refs=oe,this.updater=n||ne}function o(e,t,n){var r,o={},u=null,a=null;if(null!=t)for(r in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(u=""+t.key),t)ae.call(t,r)&&!ie.hasOwnProperty(r)&&(o[r]=t[r]);var i=arguments.length-2;if(1===i)o.children=n;else if(1<i){for(var l=Array(i),c=0;c<i;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in i=e.defaultProps)void 0===o[r]&&(o[r]=i[r]);return{$$typeof:g,type:e,key:u,ref:a,props:o,_owner:w.current}}function D(e,t){return{$$typeof:g,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function c(e){return"object"==typeof e&&null!==e&&e.$$typeof===g}function U(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}function f(e,t){return"object"==typeof e&&null!==e&&null!=e.key?U(""+e.key):t.toString(36)}function s(e,t,n,r,o){var u=!1;if(null===(e="undefined"!==(i=typeof e)&&"boolean"!==i?e:null))u=!0;else switch(i){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case g:case H:u=!0}}if(u)return o=o(u=e),e=""===r?"."+f(u,0):r,ue(o)?(n="",s(o,t,n=null!=e?e.replace(le,"$&/")+"/":n,"",function(e){return e})):null!=o&&(c(o)&&(o=D(o,n+(!o.key||u&&u.key===o.key?"":(""+o.key).replace(le,"$&/")+"/")+e)),t.push(o)),1;if(u=0,r=""===r?".":r+":",ue(e))for(var a=0;a<e.length;a++){var i,l=r+f(i=e[a],a);u+=s(i,t,n,l,o)}else if("function"==typeof(l=M(e)))for(e=l.call(e),a=0;!(i=e.next()).done;)u+=s(i=i.value,t,n,l=r+f(i,a++),o);else if("object"===i)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return u}function u(e,t,n){var r;return null==e||(r=0,s(e,e=[],"","",function(e){return t.call(n,e,r++)})),e}function V(t){var e;if(-1===t._status&&((e=(e=t._result)()).then(function(e){0!==t._status&&-1!==t._status||(t._status=1,t._result=e)},function(e){0!==t._status&&-1!==t._status||(t._status=2,t._result=e)}),-1===t._status)&&(t._status=0,t._result=e),1===t._status)return t._result.default;throw t._result}function a(e,t){var n=e.length;for(e.push(t);0<n;){var r=n-1>>>1,o=e[r];if(!(0<p(o,t)))break;e[r]=t,e[n]=o,n=r}}function i(e){return 0===e.length?null:e[0]}function l(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;for(var r=0,o=e.length,u=o>>>1;r<u;){var a=2*(r+1)-1,i=e[a],l=a+1,c=e[l];if(p(i,n)<0)r=l<o&&p(c,i)<0?(e[r]=c,e[l]=n,l):(e[r]=i,e[a]=n,a);else{if(!(l<o&&p(c,n)<0))break;e[r]=c,e[l]=n,r=l}}}return t}function p(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}function y(e){for(var t=i(E);null!==t;){if(null===t.callback)l(E);else{if(!(t.startTime<=e))break;l(E),t.sortIndex=t.expirationTime,a(C,t)}t=i(E)}}function d(e){var t;j=!1,y(e),I||(null!==i(C)?(I=!0,m(b)):null!==(t=i(E))&&_(d,t.startTime-e))}function b(e,t){I=!1,j&&(j=!1,se(L),L=-1),$=!0;var n=P;try{for(y(t),R=i(C);null!==R&&(!(R.expirationTime>t)||e&&!q());){var r,o=R.callback;"function"==typeof o?(R.callback=null,P=R.priorityLevel,r=o(R.expirationTime<=t),t=v(),"function"==typeof r?R.callback=r:R===i(C)&&l(C),y(t)):l(C),R=i(C)}var u,a=null!==R||(null!==(u=i(E))&&_(d,u.startTime-t),!1);return a}finally{R=null,P=n,$=!1}}function q(){return!(v()-de<ye)}function m(e){O=e,T||(T=!0,be())}function _(e,t){L=fe(function(){e(v())},t)}function A(e){throw Error("act(...) is not supported in production builds of React.")}var N,h,B,v,z,g=Symbol.for("react.element"),H=Symbol.for("react.portal"),W=Symbol.for("react.fragment"),Y=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),J=Symbol.for("react.provider"),K=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),Z=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),te=Symbol.iterator,ne={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){},enqueueReplaceState:function(e,t,n,r){},enqueueSetState:function(e,t,n,r){}},re=Object.assign,oe={},k=(t.prototype.isReactComponent={},t.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},t.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},n.prototype=t.prototype,r.prototype=new n),ue=(k.constructor=r,re(k,t.prototype),k.isPureReactComponent=!0,Array.isArray),ae=Object.prototype.hasOwnProperty,w={current:null},ie={key:!0,ref:!0,__self:!0,__source:!0},le=/\\/+/g,S={current:null},x={transition:null},C=(v="object"==typeof performance&&"function"==typeof p Line truncated
const unpackExcalidraw = () => LZString.decompressFromBase64("BTCCBoFMEoF4D4DeAiA9gIwFaQMYBdlZY8BPAB0lQDMACSADzNQCc8BnAMg7S1wKNIVqNALaoAJgFcANpAD8YqbIB0DJqzaxIwZpACOkgJa7gyXQEN8yaOF0Hj2s5Et4AtONQjrt/UZNOXAHpMNnpXZkkAOzxDEUhraAAuZCoo/ENUSMJickpacUgqQ0jILgKikuVzEXE5cuLtAG0Aq3AWtw8vNot8YNDwqJi45ABdKCSebCsBXOE1FnY5eY1lAFF6HHNpQ3FmcwB3ABlDdC0dXwdTHoIbOz9Ha/dPbzvL9r6wiOjY+Ogk0DWGy2Oz2RxOZwBACVnPhwFCYXgACIAeQAsnDlNCXMoQvRIYMftAAL7QYBsSDSKjgYCQcB4cCGOBIXR4STMSI0SKwRAAJgAzAAWRLAcxw2xMxDMZTMMC3ZTiMDgRDlcwyPDCpnSaQkgDcADdzMwaABNWAygCMAFYBQKedAdbI8DQANKwRpjAASbpGOtSkXSmRoABVgIzEIYqKGADwAdgAbAAOaAstmRACE5t9LGAjrosAADHTYM7lLJIgBzPAACx1OugiFzoC0AGo8PB4JmI9HnY1QCNoHhYKAdRTyeHI2nQ/BYB7e/3k5BWey0/mR0Pm+aiV3IAIF0v05uiX6AxyAFKyyWL1M0c08mMCuM8qNDrigZ+3+8JmNEhuLmiD5BpBwcBBXAGNIjAsD0HAc0AE5wAQ8AeQQ5CUMLaDzWA6RwHLFD6RjJDwDjQjUIFcAAC8EMkWwkMwcAMJEcB4Pg8BUHAMimIQvkEMtGCCO4vloKpcB9hgujELIhN2K4yDRWQ+kYMYxDkMkhCWLk8A9BQwjzWw6SVJIkCjPAajkO4+idL0sjeMIjiAGtCMY4iEPNJTCOkqTIO4jTqJgiDEOAziYI48zdKM3jzLIgjkOg+SXKU1DUPM3jkOiizkLYSz3Ns8BPPUwiFJ5QtpMI8zcpQljUvAYCpJ5LTCPg6DiJ5ZDkOYRDEPNOjaXAGzkN46CYMLSrqI45zWsIsgcu43CyPEbTkOc4TMDo7i9FFbj6U2wjTJgzLUIIzyYqCuCjMEwiSC4jb9KC4juLjbiJsUxCCI65CpOIjSYOAqsYPasjMMgniXLI+DgOQ0SyKe7jzQc7SyphxjatsqTzPmyCxpk/rDGe3qoDhy0qXoJDxGuvliaQtjRKoWlmuJ5DIlgyGENFUTWuRmM4cihCpv6hCBTSrScfR29yqmjDrsBnKJvNUK9SIwyJsCzzzUG81hKMiaUs65ryqIhL+YQqhIns37cPN8BzF1ysELjUV2N43jzXMWlzL5gGyO4jiBWw5CqGJsjDVsxr2NEmCcapWGjPNeaoZ04mYcLGypPNerwZg3D4NFOOkIgx7lIV9jcKMqTfZgsuOqU2l+LxwnyrMxD/J5SrC+yxKiPEgzdcI9rWvm5GFsugvnKQracrxmMCJbuMFK+kqBULOODJEy3goVgy8vX6PRXRmLRVekeeVFRiqvcszaeM9zXqQwsG8Q2CIL9/NoKdiCCLwDjzX+pCWKoS0HJUnyeqRlrLlQ5iZaSNpo6GEol1aS5paSeR6oxGykdzSZVer9U+qFeIxnggRHAvEAaWgwSBc0kEeQLzxuWegnNKYgQcnGVAyBlBsDINsPApg2jQGUCIcwZAwAIFAHIMghpyQAEloiKj5HGJI5p7RUGzI2AsUACw6jfHgUskAKzVnUc2ZspJQAAFIeRyA9IkZ0PCyCSDYFWGkzZiBzmJDgTIbAnTIlgAmIqlpfRpBiIGAACoqWkg4VwMlgCuesKZ2TADwHITAiQADqhioAMmJMefxHJMCxIZOASI9YuyGDTMQLROiqwFK4AALVicoHAVZDQAGEJCQFAJwxk0AuDkRqXUxpzTWmhlcPIjpHBDCuFcA6P8O49A5MZFmGUhgHEADUaT2kMFGTRZZKw1nrMo6Z9JZnbiIMiAAPscpssATnHMiFwEMoA/gLNgMsu5qjhyjkgOOYAaZzx3OgOgCwdkdS/idE2QsO5Rk8jmcAHU+ZnylA4OePZ4x7TQFAPoqArhYAQq7MYnkRB8y/P+TqB5PIiSkqJNEjkhgjx+IyByRJNI6RpMQIomU0L1l1iBTQJs2SQmuGQgcyMGi9zXmHG4Vw5KrzshoPmal/pMk0GmRAGAnLBwAh6cwJpBR+kwCJROLpeBoCnMgBuIgAJNnVmFVKvAEynSGCHLU+pGq+mcONfInUFKaDVMZHIUZloHpFWbLE1wlpLTNzjFGKM5p8XNjjCGmRiQ8CypPJ6i8Hq/V8iKs+UAr4oyWhjIKAUSb5VdLuZefcNAQ1hqzTm9NRUi20poE8qJkqORvljZaGRchzSJBJTgaQ5g2BsFEA2Bo/TS3YqjPmU5oB4DVkMGwUpWyBxVmYKgfYnJIDrshOYCskBVjMFXTKAABpIg02xxA0CYGwQw8qAAkiBQBEhoMUGgHgcCSDiNEGgwhzVVhoEe1sVZ52Lote6lt/4gMLu2CUSRJQZQQAzDBcA+KiTQe0OOwVkbp2zsg6WBobBl2rvXSULdO7yx7oPdmE9kQz07BoGhzkH70CQCNPex9z6OT3rnVB/DRJXAMbfR+7ReAj32g9dxvDMHIhwcVGE8hKHdDsMsOh1JBrEC9igCMWAkRQCxMg2KHVuY7XujA+WiTBQXEiCvdoQsEAcZ2jpCBqsXBNEWc8NZ4AhYNnaK2bkvkNhzO4Hc6gckDKJO/tyfI8AAANZQVBV0iFDHSXDv7XA0lcHc1sTniT8IoJEBUpbxO4cU/2nA2hws+erMl4DEW7lEjYNsMrwTiApcq+U9TSqtM6b0/Ogz9pcyDhM0V4DbmrMhZUyE5DNhYvxc8DkyAGXiT6AvNigQkHLXplXNipzxSKtlOnZJyAbBdspfwxtjMNr/wteA2wTYkRxEFG+JsaQioot2r21s1wEnbs7oe8Jwwz3FSDJsFyEjXLdPcZsOYbTm7weykhco+kO5rUcq7JEZQJR6CcOeeYDHDBsc2BBXkw7AAhf5xTcdobJ84Oypz0ceBKBT+UmRIB0+UGeyQkAmcc5gBSi724HHo55054nDPWfHMgNORkfOZVbjwCxwR8iy3XjB6ACH+m6s3pY9u3dzWPsWuV1KsHLSeuZSVcSLXzBjglDYGFnZf5DC6uAJEGQ0giAwHe7hy3wB7RvMQC7rUAguCxOuzxm3G5+t/ibOFhoKy4sJaJaH5QludfkcVKicw1ZeHmHoIqQcSe0NsA3HIfXVYE3vjkPmBNp2ShBvkcoPAqA/gSvLWDvAunGREkbwAZTwMwYo5YfeG45N9xrkBe/94rJ54kjfTzd+RAAOSH8oob4GJNUH7XgeXkRZRwiJC4yIbiIj4GzPWereBM8A+/YKgpkZ8ymuy9WIjG7SO7v3Ye0woBX2oHfZ+p0IgbEnR6k9RIAaBM96NnA3Fv0Sh6MGhrBTNrxzRikzU2tp1Gh8wRg5AUCylnwM05Awc7E7lEgZsEtgAqxWF2Eb1FR3Q/hEgRBVArNSBSU+0B0h0/18dtFxAh0RBEAD8j9JAT8ZR6QmwQAJRlFBlIUDQjRQDhADVUUtAnMNwECpVH1SQ/hEA2BJAKAZQAtcN5csdiBqsoM2shwiRyMnRC8h9hsF19DvMykzC/w6lDBpBdhtErDwMA9tQ0NYMFccYIJRRmB6wWUcw/xBxVwdQ8B9F7dgUk9bDGg8AxgdxmBmxsCtkndnc5BzBEgYApcNsX9n1dN2paRRQ7l3UWxyFzB9FSVRsPMlVGUwxcwuQ3wCwuBJcC82sS9INEgCDgBb1TcG98c+twAM8s8RBigwtWsyloBXARjyC+Fc9bM/gndzQRloiuUSkmABEbAdwAB9Z3AYrHDEWw1hMfH3ZDYnX9VZSMSAJzXAu0TRaxWxZ3WHOxWkVI6sZsdHS433aQMcZRG439dsTMB4mxOxHom4hrAHGzOEP4PJF4mkE4qE2UZvIkN5f8ZQR4sE4kErZTYJOkW/T5WJDjNxHdMrYQcpPIzQ7Q6USAJTJrOog1HUDTSALrdXXrc3S7O1PYiTWw8Abkg4+kPonkwYxY7YkHdospLLVLdLUoj1QwW42APAnovwpIEgubcgthDhJLGgvJYkSEsrCfAfZ3S2CU3zZgWAZAAAHSyHrEaH8NZNNzyUtkjydFQAtOQAR1CJUTtVXDwGfHMC4DWWFKxycyJSiM5Wjz0Px0aEMESOIBSNDLbGuRGWD1QAcUCLySjDhXMFnVTIcQBH1O0FmOzwWLyS+yh3LIC3KJb2vFQCPE323wvGCKkLoGvwg2A1sJRQxNBJWXqzuz+yey2HcPLRlRJJiBwBoE1KoPNxVW9HCQkObMNE5DbLuRBKePyQZEF0UPIQzQECc2DxuMxOePXTsX2VhMGzGDtWB2UMiEGSjEMFaO7PXPhLPO2OYP7UHRoGizoCx04O4N4NcT7wEMb3g3GA0K0IV10OAycJcN0CaKMKcy0AQsLzUUXKNFdNoFXJryOwcQ2V428OkwV38Joib2ZSUQdzUTDIMQjKTxgtcMiBjLjLTPeN+kHGSLNXwwkK7BFBL2yOgGnHyQ9Q4qkxk2Ivaibx1DdNdVsHjMPBqPG2NICNYiCPIpiMLB9KJX9JzQkzorgtDNRWotzGR1w10u0TnCLAWQBLayd0iGfDwC4BzNgAaKj1gFQA4BADWW0y7USHxWOViWnHMDkB5B8qWMMAEpcy0o4DTGESlCPJgGyPlCCzG1C1vJxnMFcBxnak11ktJRxKa3EvAAIw+UaHEodO4xIpsDDyO3WWwoI2CMaJUWh1XFsp0qA1gu0VDMiHDIG1oravortMvNgEqLsLSK7GYACq4FQGfGcqdGRxpLpO0GYFcFFFQGWsKsJwL04rwvDwBPwyd12ptyjBnXgAFEfML3gGOtkRotaucPosRKazE3A1AAGqQrB2izz0mM+2Line truncated
let {react, reactDOM } = new Function(`${REACT_PACKAGES}; return {react: React, reactDOM: ReactDOM};`)();
let excalidrawLib = {};
const loadMathjaxToSVG = () => new Function(`${LZString.decompressFromBase64("G4QwTgBAsiAuAWArEAPAKgewMoDUDiAvAGYCuAdgMawCWGZAFLAJQDeARCQM4CmEnsYalTYBuUJG4EOZACbci1MtxlsAhAVgBPAA7cMRCAHMANhgBGIY2njVOAfhPnL12wC5pchUpXqtu/RAA7ooyGIF2wbJh7uSeispqGjp6Bo4Wxg6m6TGy8vE+Sf4GPMZEdiVEriwAvgA0AIoENbVgTdUiAPJmiNxUAHRxSgAKYBi6YFr0YLVsAPqz3JxQGDIkxtxstSygxiTcrqoADNVMLX04AKIASlgAkh0AcgTAGNQyEIdnlzf3T2wAzH0AEzA0TiCBoNq1MhtTrdXqwAZ5YajcaTMgzeaLZardabbaWPYHY6nMh9Ea0QQ0ABeygAMrZYM9Xu9DmJwBAMMRyFRaAxWKRKDQ6BBYPRWAhbH1qLBuABbTgEADaAF1apLONLZQrlSrqmBuLASGAyKK+tpRrAMH5uEqsJo5WYMMYtdwwHAMGAVdyhXzxQTIEzPpINa6FSIDUaTSwlChYK5Bby6P7I8ayATdvtbbAANQ5tWhJSuWAAPm4fXWZEMCGqtbqiIt1utyT6IBkMh9SYY3AarBebw+BCH9QAZCP6I1EQARC4AMQAggBVOloIZXe7rtAATSY7MgrVDMvlmsr1fgIlCLDAAFpr9VAjZ1lMSwRDmP6gAeQ/azhKr3mwRPRlTRd1TE1RRsTUjwVPpOG0YwhG4KYcwARlqT4WGg1wewtSlgNceoTlqbh6wApsbT6A05QwYBJETYUGGYAMIBDSCwxPbgqwQC8MBYbhb3vR8kO4F83xHb9jyVbgVTDdQNF3ETXzHCSYLghCKGE2oUKYUiZwXZdV3XDpNy3AgAFZ1WqcURDJCkgJpelGQIDA9wgahahAAhuDHcssTjTiZE4AAfIL6GoTsGMYYjWDA01wq6Hp+h4WARnI5IOiIEKWHmRsrXmVxVWqRR+BASgUggecwHdTQx3ov1YGilhERyy0MHmLzqhCurkwa7gBU9ehwXqNzTT6hKETIq0KPgEBOA6QIyFStFND6ChLGMege3qJgx0YJV6m9W0Dp02pqCivq6m6xjGuoIh6DYK7EhtAJvJHMg1mMOS+oQUZAggJQ/rQZILiqga2AAYWMWbOBY/zZBhnY9ggNgcywARFEMTamBzNg3JhshrQgEAIAoOh+DAEgqE9TlIHe4xjDYXcrogep/VDUmyHJymrQPIrztOBtWptAg6eMIcvLscb+goA04GEphXAnSbm10LzlZtaFuD+7aiMVV7fNmRHFi6nlIqY8FJAe02+TYIdnoMe1HWdMdHadF0j3dHmGi85SpLVVo2VuicmFilnVvWxhdyD2AxzYd7HTdW3CnKxFTwQEPDTTGNuDjBNreTGLM/AmORzAF9U84s9dqZftWVODMiRL2A/zzAs6H2VRYDrEQfrCf6tYhYHQbATa7DYKXYDx/7CY9kAzHWPo2HcV3nVdT3qdsafJ8GZRF50uFEsRHelrdSY0ExBYlhWNYNi2I3iSItA+gACVKmR1jABl+GZAc2XBMWrqRxYMzJChcoymlFnJJurZtDwU0IwSCHkwCGBIHKTisBOBMBChqfURdTQgE2uqU45Zcoq3LAaQwjI3QRXqmAtMEEpRthkFFQWeEtAnRIULFs5AKFUNaIApioYqI0SQswOonC0q6D6DNWQ6xOBTgwBQVB6CaE9T7ByLaPcwCaGAQNcErROAINsKcSEYA+ixjFLuVQT9CzcBEKY8xOdLHqNpgQJ+RswwiCDmSGR79FgKKUWgsgYpmAZ3Af9Wsa1YAUHgEAyQfFh7FlrF4daOiBA6LQGOaxAx267UaGY2KO0Rz1HDvTKYOkUn0x0UHb68BfosT6G6UYYBay9z+gDCAINmn3XBqVAA5JPLw7xfEfwgEQamoRAnoMZuI9WLZJnKOCao66fUrx4IgLXQcQ5XqbRFh9AWbERn+MUYskJTBVqy1lPzcRVlbKASpNQWkMgv7MHsS/N+H8XkEGMK5CgsIJ5Ii8NwE+Ex4EUAvtia+eI76Eg7iSWoFBKKGm0fOIgspWiIqOVcZF1BFizk9D/VkCLpEfO4Ni9GeKCUCLoeBDpqU5S2CQvQEBE4WgSm0SwVmzjqhRJiUAxEkZtHKSRekkaJUyoBHpYyuwArkUrQQJxegzL878jWeEpC9Q2UnHOby2JyrfRqLVfQkeYimAK1lSVCYwqDSWsRLYXp9MLAUAANZ2BgAgAAUqgPoDrjBOudX0VF6KlWAJpaNVlYAdICyRbahWJqdLarqIiwVmgg3UOpcxSQHSulg3dfAL1KAIApsZj3OpfdyFyo0MRS6KqgEAuPqiU+8CGpzEvjiG++J75HCIoiOUcAkCoEJR8VykhpiNHPjCCgPc+h9oQMgFATRaJgE4HybC5xrh3EeLUI5y7XAdJKa/WRboXm1AWUE+MgCtphrNLOgdKASVHuXTkqZwTCE623aS8lghKVgD3Q+vxX7cWcHxdMFNabf1kjA2it0HlOCaEoHSDAbY90fVrMHVyJAoTaChEQWEqgM1DR9iOA2RtgpBQIxoqQj07bJACCvYwLsHRuzXh6MdRHm7SRaK+Lxd1tqhxKWtMprzo6x3jmYRONGihmjTvAMJWcLF5wNaq0OJcy4aArJXBA1ch2HHrvfJuLd8ynvbgcLutZS31I6UDXQOaR7cDHhPKeBNJ6z3nuWJebB6MsZ5k5wmO8ZB7zqK0fWfR5iyxkCbJT/NmKNCtkppO9sID0d9l52ePMVQ8foKoPj6zYCuWmBOggAmI7MFqFyVUWidHjJHiIQaLItleRCvxa8EASy6ayVMEWji4zinObYkQTAMDmi4LEsxRsdK6qAZCBJzSknVEqcYNJHKwBZLMbYvJXXCnvlKRtMgFTFCpMwndNATA2kQkacPWsocMB1EhCF+YcFwuVWqpFrs51exHYnCFIE4twAoPPRxLisnquDQ5AV180I1YyfsR+Mg9i8xMFUCtkcaARosRClMDHrRnsgBWqQiinB1LlkExtHsnwTunDAEqNAh1qcqlArl1adAomY6CjjvHXCpGE8QjtrG+963ImBY20FUVW2QtxLfBucKe0VgwBgZ1JBsOIh4NocAcsOjaAYoqZX3B1hUA11r2cow5QAGluCaG17BXXCIDd8kt1wN0tuybqc8CANYsAnec3U8VU+6nSbaE0Op515vLd9uD+z9TOdVeyDnusdTFwUDR5kLHkMfQOhDDQL8LA6mrgXCgB0S46n5xDCGBcB4U5vdzXhFQHTrkYQ1CZ5zAQ3NPQiGZhgIBsU2DmEPgl2jBgS6QLttXRvXMqatCHGQbBo/m/j/FtQHSdqq+H2cuqQNJey8V7YEqfMmxES5/z4X7f14VR77TxnrPTRFA7DeJ79wgRwBkE2GMBitnFNvavZ9h6cBLBJ3U+nzPR4LAaUMgG/GQT3U7MtdpAeWzLGEQDmTgZ0csB/E0e6PNAtVwZGHMC6docEcKUNGoNvFVImTvdZAFaGagQwBgAFGWbgOWMKOZXQAWCpYgwxJiFTSWavREYPC3SORvFnAFQwQ0eaRaYXLQejNgs1AqPUZmDac2DRFoWoabdodJXREecEGEVmSQ04TDMkCxayVQEgHJJQEQXQ7rZxZibDIwo2WoXDQQ4QhaEFLQKcRYGWagTXAaBqbQU4DsIgPoI2EQdnaUTgdnegGQJgOwPwo2AgCgegVUU9WoVQbSVwDvcI3aKI2Fb5MIs1WwxpeON0FPXaNAJUbQb0IgBNSbJieJJpT0ObBbJbHREgLJIw9bccVoSDPBIpMxEnegPbebA7KpT7WpepcsGolpXBcJAXIFJwoDRgGfCmOfIcagOwAhGoBWZoE7ebYg2InsDEEAFxCAEgWobQMQerQ4X7XaTyI4XccEXDQBbaT7EAMcTZc47ZfaFUHyeYlvMAOSBfLvODJ2BmSTcqUcccRoEpK0NGQQKsXrNfAArPPoF/PkWAvpW4UAywAcJEkUNgPpfguAVlPpXGXojACAV3d3DZWFc5PpU4baGYDmGgd6DYDDEWd444ryd4zLVQDvEgLBIKUWcWbQEKbvLgp6fvCAbQWOR6XwMU7woI2wUInkuwTad43UBFZUg6WoI4pIqQ7kiIo6b0DaHk7CFUkgEQXXHgZiXDQxHkwIqqXHYI0I7w3aFCcWPwmTdIpUQ4b0O2dfUvcvLqT070nPPPAvC4IpOUkIu0+BEgJUIgQM+nb7V0jTIHWqWCT0SxPoRAV4BgTYRmcWREYvP0qcHGGYHMffEMy4McCMhUpUAsjfcvenKsqMh0qM+gGM8sw/C4enCIts2svoA/UMj48cbDfUggbQPoBQYwYNfVD/a9ds/sisrskAuQFADKLGD8EkHI+cwszfIc9U70NAegQ8+IkebwxI7SFoXsusos+nc8s1BWWI7QTUjyBNSrNQ0HSADsLQ3onI+AAgALfQqxeAYwuxP8gCpxXrO6YC8bHlOAPlJiTDGbWoszeopqDleALJYC1o+gbDALLbEcccno8I/osgQ7IOHks7IwsYq7dZEiZmEgIBEHC2RQyEeImEFCGyD8P7U5QHM8GyBHYosga8FCb0bigHJUMgDLcELkQg1QpijkcKVmE7DyAgagcwgwkAECkQTyNSwCg4xUTSgIxEGaOaRwsQ+BTBXaDAJUTgb0ZuWyiouC2JKopoMYuogYxbNCnRJ4kcVQTS7C1oNS/C7oiOBfEisiu6YY8tC7ZpGi8JG7REBPJPFPVStfKPN+FKkANfMPbgCPDNUOas1s5gGVAqWAPUNfHgxUTgNff3QPYwNfH3CYGItfMkqcz3RUDNeSiQVUxoDiz8MS9BXi7ieoBHI6YS0S5BHijk0OcsarC4EAPlGcyKVZUOWI3qO87VSyNfB3MAdq5ZRivRSjeI3qkQfqyagHZMvikanMJgMaLine truncated
const PLUGIN_LANGUAGES = {"ru": "B4Xg3gwg8gcgagUQEoBUD6BVJAZNKpoBiAktggFwBEghCCB8IIKIggAiCAMIILwggHCCBCIIDIgABO4HYQWoEYQFoDYQQKwgHCfwG8s2XoCYQXoG4QWoC4QZqu6tA0iCBOEF6AREGYHVlADQYYALWIAFNBCxIEMdCTJVABCDNAgiCA/CDMGrRKzDy8nBIagMIggJIg7Eam5rwIwADGAIYANgCWACYATlkA7lb2Ti5Ibh5EpBQ0YhF80XGJyWaqaZm5hSXllg4YAELYxADKABJoE3AA4s5TCBAA0lRQAEYAzoV5WQB2vA4Arpv52wAW5LyA+CC07P4avLH+nMyMEkqAEiDs9LyAWRANEFaIxOOxGGE2Pp/nN5vxjjB5gBaFLqJRWBAAWRGCAAIniAIJjBBoBxIKAOZAoYgICZUahKWgGN7hZRvFjscISQA8IHp/gDVLypJwwpicfiiSS0G5sISaYg0LYoFAsVRADggAW+72EEKh0mUelE0P57M4nO5fIFQp5IrCvEALCC0XgARgADG6AKS8WicVi0fxcCQ6f1RGIJCSAZhBnTytTrmLx6LRVG9mFZKe40MQsYT5qSJlAsBBGoA8EE4GkYekigHEQCRgiRiHrZfLFMpWYgwCYoQnYXATCBIRwoKiAYhBU/6lEHeE9GOxApwrBgHESUPmB0OqIAUEADnFigVDIgnQoNyN4rGYYh5U4dqkA8iAvcdhDTsKwQZZrDuLfuDhzDyi3SElDrLQzwTc9VHYat2BkCdmWUOtA3YXhT0AXBALyvaJHTvXhAjrCRXneCdn0XGBiTIfA3xWVZZnXX8qAAsJgITQ8wmPdh71YGRYgdbQAj4VD0KDSxeGrUVhD0HC8IItgwi4bhF1/KAVzXH8/2oCs504H1hCPKRkN4NDL2vbDcM+aSiJfSwMxgNBCQmNAEAADQgHtiDxJBCQAdSoMsKyrPgtGeWd/Fif1nnSZt+jbSx8HmeYyDQLElMaW48I0VRADkQWsDVtMQHViXhPjEdhYyvJs+lbUoESxLIigAawKAB7UoDlfWBEFQNAYCgVc8AIJyXPGdyvKoQAsEFoVggLBPVwkiARmFtcsCpUYxQVjTCavqpqWuUcqWwGXg8QGPIDgAcza+BqQc5zXOG7z/0+EQWCEcIDTRe0ACoADoAFNen2spdrRCTvoAWwKV83HlUkYAQe66AEHjIgnQwRLraIxAujrPAaNBVgQBAnCcv9vr+yLKt4EAAD5eFJ/6otKL7waxq6vFJNwHDlYtrpJ376Yp6naaZgpeAACn8MJbTeEqdz4fxeGwRrTu2H6AEcAEorDxKBPJgbAoEJPE0HGEYPKQABNKhAFoQYFAlBLTdWECDfRiJDzWYUxPlFFQVq6IWyYqgZ8k2dMqRspzJhpJEurhslCVhnzy0rSIQviCRWViDKOjR+tG1PQAkEAMkt85LQBMEDuQAEEBQwBUEEAbBBAAwQUPMwjrtP1siAFVJBx49LJP/OnCMM6zpIc4x/TC8AIhBq9GkdAEoQavy4r0aJ/r/OULLyua4bqwUA8zsIGwDA8UafPU0nGt0YbHe9/7Q/j8SqAuxlFZ3D/U/3iUEC7f8IUHU46MfTmgkDxDQ4JALQloAA4KoUtA7ygHFBKZBCAoCmPHY+RskrH3omlTKUFIhCiZG8UEE0OBGCKiVOBCD8yczslMb8BMYD0U0MwAQehZp8HmmfOIu0Ub/FrLnZg9ArCEHGE4bMuZe5+UiKtFGPJCqPFCpoWgcilBGhYKwf0MhBBPQvFIdivAA4A0GLDTyWYbImLjgnGgtBEYtDPGEVG0Cwrj14NQEs1Bq6bhruqXgJZRo1ysBYjsMdTHdhGAyGxSM+AozIQo5xBci4l3LhPCugBEEAboAMhBq6BNjsEwkHdiCKm7lYhGUT7GqNiSFeJvBJ7TzntXHxS8V5rxLD4vxATLBBJsg4SkhZ0CeQ7NreGkS7ExPkVUzQLiSwT1Gj4QA1CD5wroAOhB57qmoIAehBfH+OyZ03J5jY7FNJNiXEeIIm2INLBKBcSQIJLcR4rxDStk130khJQXCEwqBCOCJQ+gjBOjiLaVgC5dmmOCRYsJDkJSnOsbY5GDijD8LHgk9eSTeApPSfXLJLyzTMHPnwT5oCuS/MdJoWIgLgVdPbp3SxRyoVnLKWMpxkyElTxnqs3gTTV7rzads7FbyP5yV2l8olqN/lkpFDk0F3TekYH6YMnWkKTn0tGfC8ZijngJOmbMhZyzVkbKedXPlZ9BUEu+cSsV5LKHxVJPrNY2DPjpSynomQbQiFMgAYKYUQKEy5XyoVBsJUFpIU+CAsB+p9EeU8mLYQEg5A6OEL6Z86sETkgQHAWkUbRaBEhP4HkvpGCa0sMfcipI2ajh4hBSIqjjQaNoFooQxpJAGnYBBEwftNoNWakcQQvAti7AKPsI4TA2AtvYPENMlhoAOHNg5MgWJX7Gw7OsGgoRAgzTsQAbQ3f4fwehVBxAALoHqwveat6j/QeptCKZgoswiFqnTOu6bdxgwGXepWga7wGRAAIRbp3Xu7h54cWf1iEek9gJRRXKqbAywHYJhXRfdRfAs7sSv3IAAA3Gp+8NMg/27v3cwMDN5T1qIgZer17xdrCFiMYOs2lAXMC+rwAAJGAHIWRNg/RyB3HAot1YAF8ADUB9iBrHA6u9dHB7z/v3UhAA5KdIojUTgAAcQByaY6x9jnGcjTGIMgvjQmRNieI7wCT4CpPTnw8+Xgcnao/SyOpr66HYOdgQ0uvqKH511HmBSJcDJzOxAMJhBTSnVPqd4L+7d1nCPHtM2esjzpPXko+bwajtHGD0akIx9sbnOqIc8wgOdC7CRQwCx+9dkQ7NFAcxFqLMmtBEewgl2t5GUtUZo3RkQDGvq5fg/ljzyGiuobqIQDy87yvYfYbZgAZiUUGP06t4YA7F8DLWL1Javd6jrGWsvnl665/r6ACtDeK6N8bpIRMOCpNC99U27FyYyPkFTKmfoFDm1kBbS3osraayRmtG3ARbcoyodLXXhA9b6+519hWzvoG6kgHM2BJuVb4Mtgjf3DQA8gZtijqWweZe69lg7cHodIf6nDhyNQoBICoPnI0oJAEOmDLoHHQO8e7X8IAMRApASChwNmHp2RvoChniS2NAYu8EAMgg0zi4VwRE6N4e4gOg8658PbE7ScC+Xe/XFgqGsFSA2ifn6BoBYhzDAaFuu8VmeUWwP1fa9iHF2loWsrIZANcslr9A4i8x0+NZEbRjbnX8FbUy8K/MDo9vCN8KMzph0cAguO9sWIemdThFQeuPI7Zgl4HCVEXRUuTmZ7wbUs4kwqAioHQGWbaAOmZ4wMQIE4Q+kjOoyC2XhKrkcigHhARRS3jTjIJQnweQcRkHbevdZirck4P4W8hbsxp/QHCZwsBu8oG8xgeij1jQvRHTIFvKgy9/CQqeeWkD2/ZXYleE3iUrfvLbeYBMoNaqdp2j2hPo7k+HausuQg/uAqkQ/+BeqQn+7eSeE6NghSyAEwPYtkBI9Q3glA1uIEtcSyqSJYMuT+qgmueWpupW0K24wgeuKc/oTwlk0Al0nULkSARsyGZa/4eEUs4IZBAY3Cvs5gmI1OSAeAFstk8whIHYTCzQqgQWqYwkds2aIgQWmEEgachULCB23cXYl2yUYwUAdqKBAefATskyoQPEd+co3eGG1u3AmEq0jAPIsQYhCsWQKAP0jkYs542aJUdYwkAAOh4QABAnSNSgxgAHD8ZgB1T8aUy8BeEAAwJQGQgR36wRdU36osBwyIdU6s8R6szmlgr8yAxs0MjkdOQEDoU42aeuIYdaho4gIe2A9hjhVgouz8ZAdkMMPUdIO+tAeCdi38v8Bo80i0NmzoqigQrwGgfOlgxIfS10g0bkkaPke0DM9RNgaAmhtOlAKxOEyYgOiKDYzANwgA6CCCKzRhjAiUY9pzY/RvYHSCayA6JNr6Kq67ZE5AZIRNQZBfQqZKYqbbD1HIBLErFMJKCiiMDErzTDFPAbGqBbGXzNC9oDj7GHERDHGpiyC8DnGXGAzXFB5VGWYPHg4MYIivHvGfHfGWBIB/EDheavz0hrEDiGjM7Hgwjs7kphDwn0BHGuqnFyBokUyYkNrYn3FpZq4a7XyEgzqYIpQ4JOoGjBCcStr+BMgsicA+xRCfAGDIjkI8hWDwalZvhMKPDPAclgQJjbGSCQyUhxx+6UAliiCxogRISxgUEWbQR0nBhSD+hGAcgjpc56BmliI5iWnWmfACB2m8AOnPhOn1q3F6K3hWDxzdTdi9S+6NAVy1phqvTOlYm6I4nzGVR375LUr/4Wmkh2RZj+knyP7Co/JwSekcDenHB4iEAu7MBu5KmRnB5SY/HwY+5YiLDIbuhuijiPg27PS2iZbrZs7JbXo3Htn6JAb9nei+j8D+BJh/w46dkIDdmLB2RUgdwyjyjEBQAMiiABj660C+j+ix4GhEKQisBY7noTnA4JiZl3ExkxTYhp6laPqTBkTFmyqPyEiICJyOp4J8C4qigSwJ4h5OjTi/yZxpwAKgkjEJiO4DrO6izmS4oQThDBYyAAiihaTBAsCLSMDCSig6ChC8DpytqqK8ACDngSDRDCSiTOj0nMAMUSCFqrip406fkOSkTSiEh/lwGAUoHAWCpgUBgMDqLOr1E2SeRFZm6NDEGQgbGiFQhVo5kDDCLEBIBPxkmMLoYABQtwuBkY7At5VeRi4GKFg6+keFzo0Yz00FCaOgseTFvIvAAA1dIUQgAN38CsAcjipArgbBThq3hMapKmV14fD3iRhiEJqhBGDmXRBt7MBc7sBITyw2XO4TSAJ+Sz7TiMSMCXmhhjKT4rlmbKCCCxDaCs7WEvClFKBsQZRqCQT6BlR0Ujq3hXhfSGWGUAA8A6AAbrwNsAAC4ACeOQi2lA41f041yIfQp0Bw5AGQP0Bw81RQAA3K/kUKdCdMiONY1CpuQO6CpsANLine truncated
const PLUGIN_VERSION="2.22.3";function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(i){if("default"!==i){var a=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,Object.freeze(t)}var obsidian_module__namespace=_interopNamespace(obsidian_module),React__default=_interopDefaultLegacy(React),React__namespace=_interopNamespace(React);let random$3=e=>crypto.getRandomValues(new Uint8Array(e)),customRandom=(e,t,i)=>{let a=(2<<Math.log(e.length-1)/Math.LN2)-1,n=-~(1.6*a*t/e.length);return(r=t)=>{let s="";for(;;){let t=i(n),o=n;for(;o--;)if(s+=e[t[o]&a]||"",s.length===r)return s}}},customAlphabet=(e,t=21)=>customRandom(e,t,random$3),nanoid$1=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),"");const durationTreshold=0;function setDebugging(e){DEBUGGING=!1}let DEBUGGING=!1;const log$2=console.log.bind(window.console),debug=(e,t,...i)=>{console.log(t,...i)};class CustomMutationObserver{originalCallback;observer;name;constructor(e,t){this.originalCallback=e,this.observer=null,this.name=t}observe(e,t){this.observer=new MutationObserver(async(e,t)=>{const i=performance.now();await this.originalCallback(e,t);const a=performance.now()-i;a>durationTreshold&&console.log(`Excalidraw ${this.name} MutationObserver callback took ${a}ms to execute`,t)}),this.observer.observe(e,t)}disconnect(){this.observer&&(this.observer.disconnect(),this.observer=null)}}class ErrorHandler{static instance;errorLog=[];errorNoticeTimeout=1e4;maxLogEntries=100;constructor(){}static getInstance(){return ErrorHandler.instance||(ErrorHandler.instance=new ErrorHandler),ErrorHandler.instance}handleError(e,t,i=!0,a){const n="string"==typeof e?new Error(e):e;if(console.error(`[Excalidraw Error] in ${t}:`,n),this.errorLog.push({error:n,context:t,timestamp:Date.now()}),this.errorLog.length>this.maxLogEntries&&(this.errorLog=this.errorLog.slice(this.errorLog.length-this.maxLogEntries)),i){const e=this.formatErrorForUser(n,t);new obsidian_module.Notice(e,a||this.errorNoticeTimeout)}}safeEval(e,t,i,a){try{return i.eval.call(i,e)}catch(e){if(this.handleError(e,`SafeEval in ${t}`),void 0!==a)return a;throw e}}wrapWithTryCatch(e,t,i){try{return e()}catch(e){if(this.handleError(e,t),void 0!==i)return i;throw e}}formatErrorForUser(e,t){let i=e.message;return i.includes("Cannot read properties of undefined")?i="A required object was not available. This might be due to a plugin loading issue.":i.includes("is not a function")?i="A required function was not available. This might be due to a plugin version mismatch.":i.length>100&&(i=i.substring(0,100)+"..."),`Excalidraw Error: ${i} (in ${t})`}getErrorLog(){return[...this.errorLog]}clearErrorLog(){this.errorLog=[]}}const errorHandler=ErrorHandler.getInstance();let EXCALIDRAW_PLUGIN=null;const setExcalidrawPlugin=e=>{EXCALIDRAW_PLUGIN=e},THEME={LIGHT:"light",DARK:"dark"},MD_EXCALIDRAW="# Excalidraw Data",MD_TEXTELEMENTS="## Text Elements",MD_ELEMENTLINKS="## Element Links",MD_EMBEDFILES="## Embedded Files",MD_DRAWING="## Drawing",MD_EX_SECTIONS=[MD_EXCALIDRAW,MD_TEXTELEMENTS,MD_ELEMENTLINKS,MD_EMBEDFILES,MD_DRAWING],ERROR_IFRAME_CONVERSION_CANCELED="iframe conversion canceled",LOCALE=localStorage.getItem("language")?.toLowerCase()||"en",CJK_FONTS="CJK Fonts",obsidianToExcalidrawMap={en:"en-US",af:"af-ZA",am:"am-ET",ar:"ar-SA",eu:"eu-ES",be:"be-BY",bg:"bg-BG",bn:"bn-BD",ca:"ca-ES",cs:"cs-CZ",da:"da-DK",de:"de-DE",el:"el-GR",eo:"eo-EO",es:"es-ES",fa:"fa-IR","fi-fi":"fi-FI",fr:"fr-FR",gl:"gl-ES",he:"he-IL",hi:"hi-IN",hu:"hu-HU",id:"id-ID",it:"it-IT",ja:"ja-JP",ko:"ko-KR",lv:"lv-LV",ml:"ml-IN",ms:"ms-MY",nl:"nl-NL",no:"nb-NO",oc:"oc-FR",pl:"pl-PL",pt:"pt-PT","pt-BR":"pt-BR",ro:"ro-RO",ru:"ru-RU",sr:"sr-RS",se:"sv-SE",sk:"sk-SK",sq:"sq-AL",ta:"ta-IN",te:"te-IN",th:"th-TH",tr:"tr-TR",uk:"uk-UA",ur:"ur-PK",vi:"vi-VN",zh:"zh-CN","zh-tw":"zh-TW"};let{sceneCoordsToViewportCoords:sceneCoordsToViewportCoords,viewportCoordsToSceneCoords:viewportCoordsToSceneCoords,intersectElementWithLine:intersectElementWithLine,getCommonBoundingBox:getCommonBoundingBox,getMaximumGroups:getMaximumGroups,measureText:measureText,getLineHeight:getLineHeight,wrapText:wrapText,getFontString:getFontString,getBoundTextMaxWidth:getBoundTextMaxWidth,exportToSvg:exportToSvg,exportToBlob:exportToBlob,mutateElement:mutateElement,restoreElements:restoreElements,mermaidToExcalidraw:mermaidToExcalidraw,getFontFamilyString:getFontFamilyString,getContainerElement:getContainerElement,refreshTextDimensions:refreshTextDimensions,getCSSFontDefinition:getCSSFontDefinition,loadSceneFonts:loadSceneFonts,loadMermaid:loadMermaid,syncInvalidIndices:syncInvalidIndices,getDefaultColorPalette:getDefaultColorPalette}=excalidrawLib;function updatLine truncated
/* nosourcemap */
@@ -0,0 +1,12 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.22.3",
"minAppVersion": "1.5.7",
"description": "Sketch Your Mind. An Obsidian plugin to edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
"author": "Zsolt Viczian",
"authorUrl": "https://excalidraw-obsidian.online",
"fundingUrl": "https://ko-fi.com/zsolt",
"helpUrl": "https://github.com/zsviczian/obsidian-excalidraw-plugin#readme",
"isDesktopOnly": false
}
@@ -0,0 +1 @@
@font-face{font-family:Assistant;font-weight:400;src:url(https://unpkg.com/@zsviczian/excalidraw@0.17.6-2/dist/excalidraw-assets/Assistant-Regular.woff2) format("woff2");style:normal;display:swap}@font-face{font-family:Assistant;font-weight:500;src:url(https://unpkg.com/@zsviczian/excalidraw@0.17.6-2/dist/excalidraw-assets/Assistant-Medium.woff2) format("woff2");style:normal;display:swap}@font-face{font-family:Assistant;font-weight:600;src:url(https://unpkg.com/@zsviczian/excalidraw@0.17.6-2/dist/excalidraw-assets/Assistant-SemiBold.woff2) format("woff2");style:normal;display:swap}@font-face{font-family:Assistant;font-weight:700;src:url(https://unpkg.com/@zsviczian/excalidraw@0.17.6-2/dist/excalidraw-assets/Assistant-Bold.woff2) format("woff2");style:normal;display:swap}.excalidraw .ToolIcon{align-items:center;border-radius:var(--border-radius-lg);cursor:pointer;display:inline-flex;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-user-select:none;user-select:none}.excalidraw .ToolIcon__hidden{display:none!important}.excalidraw .ToolIcon.fillable .ToolIcon_type_checkbox:checked+.ToolIcon__icon,.excalidraw .ToolIcon.fillable .ToolIcon_type_radio:checked+.ToolIcon__icon{--icon-fill-color:var(--color-on-primary-container)}.excalidraw .ToolIcon.fillable .ToolIcon_type_checkbox:checked+.ToolIcon__icon svg,.excalidraw .ToolIcon.fillable .ToolIcon_type_radio:checked+.ToolIcon__icon svg{fill:var(--icon-fill-color)}.excalidraw .ToolIcon .ToolIcon_type_checkbox:checked+.ToolIcon__icon,.excalidraw .ToolIcon .ToolIcon_type_radio:checked+.ToolIcon__icon{background:var(--color-surface-primary-container);--keybinding-color:var(--color-on-primary-container);--icon-fill-color:var(--color-on-primary-container)}.excalidraw .ToolIcon .ToolIcon_type_checkbox:checked+.ToolIcon__icon svg,.excalidraw .ToolIcon .ToolIcon_type_radio:checked+.ToolIcon__icon svg{color:var(--color-on-primary-container)}.excalidraw .ToolIcon .ToolIcon__keybinding{bottom:4px;right:4px}.excalidraw .ToolIcon .ToolIcon__icon:hover{background:var(--button-hover-bg)}.excalidraw .ToolIcon .ToolIcon__icon:active{background:var(--button-hover-bg);border:1px solid var(--button-active-border)}.excalidraw .ToolIcon .ToolIcon__icon:active svg{color:var(--color-on-primary-container)}.excalidraw .ToolIcon .ToolIcon__icon[aria-disabled=true]{background:initial;border:none}.excalidraw .ToolIcon .ToolIcon__icon[aria-disabled=true] svg{color:var(--color-disabled)}.excalidraw .ToolIcon--plain{background-color:transparent}.excalidraw .ToolIcon--plain .ToolIcon__icon{height:2rem;width:2rem}.excalidraw .ToolIcon_type_checkbox,.excalidraw .ToolIcon_type_radio{opacity:0;pointer-events:none;position:absolute}.excalidraw .ToolIcon__icon{align-items:center;border-radius:var(--border-radius-lg);box-sizing:border-box;color:var(--icon-fill-color);display:flex;height:var(--default-button-size);justify-content:center;width:var(--default-button-size)}.excalidraw .ToolIcon__icon+.ToolIcon__label{margin-inline-start:0}.excalidraw .ToolIcon__icon svg{color:var(--icon-fill-color);height:var(--default-icon-size);position:relative;width:var(--default-icon-size)}.excalidraw .ToolIcon__label{align-items:center;color:var(--icon-fill-color);display:flex;font-family:var(--ui-font);margin:0 .8em;text-overflow:ellipsis}.excalidraw .ToolIcon__label .Spinner{margin-left:.6em}.excalidraw .ToolIcon_size_small .ToolIcon__icon{font-size:.8em;height:2rem;width:2rem}.excalidraw .Modal .ToolIcon_type_button,.excalidraw .ToolIcon_type_button{background-color:initial;border:none;font-size:inherit;margin:0;padding:0}.excalidraw .Modal .ToolIcon_type_button:focus-visible,.excalidraw .ToolIcon_type_button:focus-visible{box-shadow:0 0 0 2px var(--focus-highlight-color)}.excalidraw .Modal .ToolIcon_type_button.ToolIcon--selected,.excalidraw .ToolIcon_type_button.ToolIcon--selected{background-color:var(--button-gray-2)}.excalidraw .Modal .ToolIcon_type_button.ToolIcon--selected:active,.excalidraw .Modal .ToolIcon_type_button:active,.excalidraw .ToolIcon_type_button.ToolIcon--selected:active,.excalidraw .ToolIcon_type_button:active{background-color:var(--button-gray-3)}.excalidraw .Modal .ToolIcon_type_button:disabled,.excalidraw .ToolIcon_type_button:disabled{cursor:default}.excalidraw .Modal .ToolIcon_type_button:disabled:active,.excalidraw .Modal .ToolIcon_type_button:disabled:focus-visible,.excalidraw .Modal .ToolIcon_type_button:disabled:hover,.excalidraw .ToolIcon_type_button:disabled:active,.excalidraw .ToolIcon_type_button:disabled:focus-visible,.excalidraw .ToolIcon_type_button:disabled:hover{background-color:initial;border:none;box-shadow:none}.excalidraw .Modal .ToolIcon_type_button:disabled svg,.excalidraw .ToolIcon_type_button:disabled svg{color:var(--color-disabled)}.excalidraw .Modal .ToolIcon_type_button--show,.excalidraw .ToolIcon_type_button--show{visibility:visible}.excalidraw .Modal .ToolIcon_type_button--hide,.excalidraw .ToolIcon_type_button--hide{display:none!important}.excalLine truncated
+17
View File
@@ -0,0 +1,17 @@
{
"calendarSources": [
{
"type": "local",
"color": "#8f79fb",
"directory": "Calendar"
}
],
"defaultCalendar": 0,
"recursiveLocal": false,
"firstDay": 0,
"initialView": {
"desktop": "dayGridMonth",
"mobile": "timeGrid3Days"
},
"timeFormat24h": false
}
File diff suppressed because it is too large. Load diff
+10
View File
@@ -0,0 +1,10 @@
{
"id": "obsidian-full-calendar",
"name": "Full Calendar",
"version": "0.8.0",
"minAppVersion": "0.12.0",
"description": "Obsidian integration with Full Calendar (fullcalendar.io)",
"author": "Davis Haupt",
"authorUrl": "https://davi.sh",
"isDesktopOnly": false
}
File diff suppressed because it is too large. Load diff
+415
View File
@@ -0,0 +1,415 @@
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository (https://github.com/denolehov/obsidian-git)
*/
var hF=Object.create;var uc=Object.defineProperty;var pF=Object.getOwnPropertyDescriptor;var mF=Object.getOwnPropertyNames;var gF=Object.getPrototypeOf,vF=Object.prototype.hasOwnProperty;var a_=t=>{throw TypeError(t)};var wF=(t,e,r)=>e in t?uc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var _F=(t,e)=>()=>(t&&(e=t(t=0)),e);var H=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),bF=(t,e)=>{for(var r in e)uc(t,r,{get:e[r],enumerable:!0})},o_=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of mF(e))!vF.call(t,n)&&n!==r&&uc(t,n,{get:()=>e[n],enumerable:!(i=pF(e,n))||i.enumerable});return t};var Ht=(t,e,r)=>(r=t!=null?hF(gF(t)):{},o_(e||!t||!t.__esModule?uc(r,"default",{value:t,enumerable:!0}):r,t)),yF=t=>o_(uc({},"__esModule",{value:!0}),t);var Ve=(t,e,r)=>wF(t,typeof e!="symbol"?e+"":e,r),Bp=(t,e,r)=>e.has(t)||a_("Cannot "+r);var R=(t,e,r)=>(Bp(t,e,"read from private field"),r?r.call(t):e.get(t)),pe=(t,e,r)=>e.has(t)?a_("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),we=(t,e,r,i)=>(Bp(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Me=(t,e,r)=>(Bp(t,e,"access private method"),r);var u_=H(vf=>{"use strict";m();vf.byteLength=EF;vf.toByteArray=kF;vf.fromByteArray=TF;var on=[],mi=[],xF=typeof Uint8Array!="undefined"?Uint8Array:Array,Hp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Js=0,l_=Hp.length;Js<l_;++Js)on[Js]=Hp[Js],mi[Hp.charCodeAt(Js)]=Js;var Js,l_;mi[45]=62;mi[95]=63;function c_(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function EF(t){var e=c_(t),r=e[0],i=e[1];return(r+i)*3/4-i}function SF(t,e,r){return(e+r)*3/4-r}function kF(t){var e,r=c_(t),i=r[0],n=r[1],s=new xF(SF(t,i,n)),a=0,o=n>0?i-4:i,l;for(l=0;l<o;l+=4)e=mi[t.charCodeAt(l)]<<18|mi[t.charCodeAt(l+1)]<<12|mi[t.charCodeAt(l+2)]<<6|mi[t.charCodeAt(l+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=mi[t.charCodeAt(l)]<<2|mi[t.charCodeAt(l+1)]>>4,s[a++]=e&255),n===1&&(e=mi[t.charCodeAt(l)]<<10|mi[t.charCodeAt(l+1)]<<4|mi[t.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function AF(t){return on[t>>18&63]+on[t>>12&63]+on[t>>6&63]+on[t&63]}function CF(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(AF(i));return n.join("")}function TF(t){for(var e,r=t.length,i=r%3,n=[],s=16383,a=0,o=r-i;a<o;a+=s)n.push(CF(t,a,a+s>o?o:a+s));return i===1?(e=t[r-1],n.push(on[e>>2]+on[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(on[e>>10]+on[e>>4&63]+on[e<<2&63]+"=")),n.join("")}});var f_=H(Up=>{m();Up.read=function(t,e,r,i,n){var s,a,o=n*8-i-1,l=(1<<o)-1,c=l>>1,u=-7,f=r?n-1:0,d=r?-1:1,h=t[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=o;u>0;s=s*256+t[e+f],f+=d,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=a*256+t[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-c}return(h?-1:1)*a*Math.pow(2,s-i)};Up.write=function(t,e,r,i,n,s){var a,o,l,c=s*8-n-1,u=(1<<c)-1,f=u>>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,p=i?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(a++,l/=2),a+f>=u?(o=0,a=u):a+f>=1?(o=(e*l-1)*Math.pow(2,n),a=a+f):(o=e*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;t[r+h]=o&255,h+=p,o/=256,n-=8);for(a=a<<n|o,c+=n;c>0;t[r+h]=a&255,h+=p,a/=256,c-=8);t[r+h-p]|=g*128}});var Zp=H(So=>{"use strict";m();var Gp=u_(),xo=f_(),d_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;So.Buffer=F;So.SlowBuffer=MF;So.INSPECT_MAX_BYTES=50;var wf=2147483647;So.kMaxLength=wf;F.TYPED_ARRAY_SUPPORT=PF();!F.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function PF(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(F.prototype,"parent",{enumerable:!0,get:function(){if(F.isBuffer(this))return this.buffer}});Object.defineProperty(F.prototype,"offset",{enumerable:!0,get:function(){if(F.isBuffer(this))return this.byteOffset}});function jn(t){if(t>wf)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,F.prototype),e}function F(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Wp(t)}return g_(t,e,r)}F.poolSize=8192;function g_(t,e,r){if(typeof t=="string")return $F(t,e);if(ArrayBuffer.isView(t))return FF(t);if(t==null)throw new TypeError("Line truncated
If you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.
Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};ue.code="InternalError";var zo=class t extends Ce{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};zo.code="UnsafeFilepathError";var _i=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};function pd(t,e){return-(t<e)||+(t>e)}function kE(t,e){return pd(t.path,e.path)}function AE(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}var gn=2**32;function tE(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}function Wo(t){let[e,r]=tE(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=tE(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%gn,ctimeNanoseconds:r%gn,mtimeSeconds:i%gn,mtimeNanoseconds:n%gn,dev:t.dev%gn,ino:t.ino%gn,mode:AE(t.mode%gn),uid:t.uid%gn,gid:t.gid%gn,size:t.size>-1?t.size%gn:0}}function fL(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var lg=null;async function wn(t){return lg===null&&(lg=await hL()),lg?CE(t):dL(t)}function dL(t){return new SE().update(t).digest("hex")}async function CE(t){let e=await crypto.subtle.digest("SHA-1",t);return fL(e)}async function hL(){try{return await CE(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(t){}return!1}function pL(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function mL(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var bg=class t{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new ue("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new ue("Index file is empty (.git/index)");let r=new t,i=new _i(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new ue(`Invalid dircache magic file number: ${n}`);let s=await wn(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new ue(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let o=i.readUInt32BE();if(o!==2)throw new ue(`Unsupported dircache version: ${o}`);let l=i.readUInt32BE(),c=0;for(;!i.eof()&&c<l;){let u={};u.ctimeSeconds=i.readUInt32BE(),u.ctimeNanoseconds=i.readUInt32BE(),u.mtimeSeconds=i.readUInt32BE(),u.mtimeNanoseconds=i.readUInt32BE(),u.dev=i.readUInt32BE(),u.ino=i.readUInt32BE(),u.mode=i.readUInt32BE(),u.uid=i.readUInt32BE(),u.gid=i.readUInt32BE(),u.size=i.readUInt32BE(),u.oid=i.slice(20).toString("hex");let f=i.readUInt16BE();u.flags=pL(f);let d=e.indexOf(0,i.tell()+1)-i.tell();if(d<1)throw new ue(`Got a path length of: ${d}`);if(u.path=i.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new zo(u.path);let h=8-(i.tell()-12)%8;for(h===0&&(h=8);h--;){let p=i.readUInt8();if(p!==0)throw new ue(`Expected 1-8 null characters but got '${p}' after ${u.path}`);if(i.eof())throw new ue("Unexpected end of file")}u.stages=[],r._addEntry(u),c++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(kE)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid:i,stage:n=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid Line truncated
`)}static async _entryToBuffer(e){let r=Buffer.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=Buffer.alloc(i),s=new _i(n),a=Wo(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(mL(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=Buffer.alloc(12),r=new _i(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let o of this.entries)if(i.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&i.push(t._entryToBuffer(l));i=await Promise.all(i);let n=Buffer.concat(i),s=Buffer.concat([e,n]),a=await wn(s);return Buffer.concat([s,Buffer.from(a,"hex")])}};function nd(t,e,r=!0,i=!0){let n=Wo(t),s=Wo(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}var cg=null,ug=Symbol("IndexCache");function gL(){return{map:new Map,stats:new Map}}async function vL(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await bg.from(n);r.map.set(e,s),r.stats.set(e,i)}async function wL(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:nd(i,n)}var ft=class{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[ug]||(i[ug]=gL());let a=`${r}/index`;cg===null&&(cg=new Mc({maxPending:1/0}));let o,l=[];return await cg.acquire(a,async()=>{let c=i[ug];await wL(e,a,c)&&await vL(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!n)throw new Oc(l);if(o=await s(u),u._dirty){let f=await u.toObject();await e.write(a,f),c.stats.set(a,await e.lstat(a)),u._dirty=!1}}),o}};function sd(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function ha(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function TE(t){let e=new Map,r=function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:sd(n),metadata:{},children:[]};e.set(n,s),s.parent=r(ha(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},i=function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:sd(n),metadata:s,parent:r(ha(n)),children:[]};a.parent&&a.parent.children.push(a),e.set(n,a)}return e.get(n)};r(".");for(let n of t)i(n.path,n);return e}function _L(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var yg=class{constructor({fs:e,gitdir:r,cache:i}){this.treePromise=ft.acquire({fs:e,gitdir:r,cache:i},async function(s){return TE(s.entries)});let n=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}}}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(a=>a.fullpath);return s.sort(pd),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Wo(i.metadata);e._type=i.type==="tree"?"tree":_L(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}},md=Symbol("GitWalkSymbol");function _a(){let t=Object.create(null);return Object.defineProperty(t,md,{value:function({fs:e,gitdir:r,cache:i}){return new yg({fs:e,gitdir:r,cache:i})}}),Object.freeze(t),t}var He=class t extends Ce{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};He.code="NotFoundError";var yr=class t extends Ce{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};yr.code="ObjectTypeError";var As=class t extends Ce{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};As.code="InvalidOidError";var Lc=class t extends Ce{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
[remote "${e}"]
fetch = +refs/heads/*:refs/remotes/origin/*
`),this.code=this.name=t.code,this.data={remote:e}}};Lc.code="NoRefspecError";var ad=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
`).map(i=>{if(/^\s*#/.test(i))return{line:i,comment:!0};let n=i.indexOf(" ");if(i.startsWith("^")){let s=i.slice(1);return this.refs.set(r+"^{}",s),{line:i,ref:r,peeled:s}}else{let s=i.slice(0,n);return r=i.slice(n+1),this.refs.set(r,s),{line:i,ref:r,oid:s}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
`)+`
`}},od=class t{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=n==="*";if(l!==(a==="*"))throw new ue("Invalid refspec");return new t({remotePath:i,localPath:s,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},xg=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(od.from(i));return new t(r)}add(e){let r=od.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function bL(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(r<i)||+(r>i);return n===0?t.endsWith("^{}")?1:-1:n}function yL(t,e){let r="",i=0,n=-1,s=0,a="\0";for(let o=0;o<=t.length;++o){if(o<t.length)a=t[o];else{if(a==="/")break;a="/"}if(a==="/"){if(!(n===o-1||s===1))if(s===2){if(r.length<2||i!==2||r.at(-1)!=="."||r.at(-2)!=="."){if(r.length>2){let l=r.lastIndexOf("/");l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}else if(r.length!==0){r="",i=0,n=o,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,o):r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a==="."&&s!==-1?++s:s=-1}return r}function xL(t){if(!t.length)return".";let e=t[0]==="/",r=t.at(-1)==="/";return t=yL(t,!e),t.length?(r&&(t+="/"),e?`/${t}`:t):e?"/":r?"./":"."}function O(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let i=t[r];i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":xL(e)}var EL=t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},Ic=t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},rE={core:{filemode:Ic,bare:Ic,logallrefupdates:Ic,symlinks:Ic,ignorecase:Ic,bigFileThreshold:EL}},SL=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,kL=/^[A-Za-z0-9-.]+$/,AL=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,CL=/^[A-Za-z][A-Za-z-]*$/,TL=/^(.*?)( *[#;].*)$/,PL=t=>{let e=SL.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},RL=t=>{let e=AL.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=$L(i),s=FL(n);return[r,s]}return null},$L=t=>{let e=TL.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return iE(r)&&iE(i)?`${r}${i}`:r},iE=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,FL=t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",a=r==="\\"&&n[i+1]==='"';return s||a?e:e+r},""),nE=t=>t!=null?t.toLowerCase():null,Eg=(t,e,r)=>[nE(t),e,nE(r)].filter(i=>i!=null).join("."),sE=t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:Eg(r,n,i),sectionPath:Eg(r,n,null),isSection:!!r}},IL=(t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),Sg=class t{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(`
`).map(n=>{let s=null,a=null,o=n.trim(),l=PL(o),c=l!=null;if(c)[r,i]=l;else{let f=RL(o);f!=null&&([s,a]=f)}let u=Eg(r,i,s);return{line:n,isSection:c,section:r,subsection:i,name:s,value:a,path:u}}):[]}static from(e){return new t(e)}async get(e,r=!1){let i=sE(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:o})=>{let l=rE[s]&&rE[s][a];return l?l(o):o});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:a,path:o,sectionPath:l,isSection:c}=sE(e),u=IL(this.parsedConfig,f=>f.path===o);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:n,subsection:s,name:a,value:r,modified:!0,path:o};if(kL.test(n)&&CL.test(a))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:n,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:a=!1})=>a?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(`
`)}},dt=class{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Sg.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}},rd=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],ML=["config","description","index","shallow","commondir"],fg;async function Ss(t,e){return fg===void 0&&(fg=new Mc),fg.acquire(t,e)}var W=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let v of n.values())if(!v.match(/[0-9a-f]{40}/))throw new As(v);let u=await dt.get({fs:e,gitdir:r});if(!o){if(o=await u.getall(`remote.${i}.fetch`),o.length===0)throw new Lc(i);o.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let f=xg.from(o),d=new Map;if(c){let v=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:v.map(_=>`refs/tags/${_}`)})}if(a){for(let v of n.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:v})){let _=n.get(v);d.set(v,_)}}let h=f.translate([...n.keys()]);for(let[v,_]of h){let b=n.get(v);d.set(_,b)}let p=f.translate([...s.keys()]);for(let[v,_]of p){let b=s.get(v),S=f.translateOne(b);S&&d.set(_,`ref: ${S}`)}let g=[];if(l){for(let v of f.localNamespaces()){let _=(await t.listRefs({fs:e,gitdir:r,filepath:v})).map(b=>`${v}/${b}`);for(let b of _)d.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[v,_]of d)await Ss(v,async()=>e.write(O(r,v),`${_.trim()}
`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new As(n);await Ss(i,async()=>e.write(O(r,i),`${n.trim()}
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await Ss(i,async()=>e.write(O(r,i),`ref: ${n.trim()}
`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return t.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(o=>e.rm(O(r,o))));let n=await Ss("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=ad.from(n),a=s.refs.size;for(let o of i)s.refs.has(o)&&s.delete(o);s.refs.size<a&&(n=s.toString(),await Ss("packed-refs",async()=>e.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),t.resolve({fs:e,gitdir:r,ref:i,depth:n});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let s=await t.packedRefs({fs:e,gitdir:r}),a=rd(i).filter(o=>!ML.includes(o));for(let o of a){let l=await Ss(o,async()=>await e.read(`${r}/${o}`,{encoding:"utf8"})||s.get(o));if(l)return t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:n})}throw new He(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await t.expand({fs:e,gitdir:r,ref:i}),!0}catch(n){return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await t.packedRefs({fs:e,gitdir:r}),s=rd(i);for(let a of s)if(await Ss(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new He(i)}static async expandAgainstMap({ref:e,map:r}){let i=rd(e);for(let n of i)if(await r.has(n))return n;throw new He(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=rd(e);for(let a of s){let o=n.get(a);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:a,depth:i,map:n})}throw new He(e)}static async packedRefs({fs:e,gitdir:r}){let i=await Ss("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return ad.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=t.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(a=>a.replace(`${r}/${i}/`,""))}catch(a){s=[]}for(let a of(await n).keys())a.startsWith(i)&&(a=a.replace(i+"/",""),s.includes(a)||s.push(a));return s.sort(bL),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};function DL(t,e){return pd(aE(t),aE(e))}function aE(t){return t.mode==="040000"?t.path+"/":t.path}function PE(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t}`)}function OL(t){let e=[],r=0;for(;r<t.length;){let i=t.indexOf(32,r);if(i===-1)throw new ue(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let n=t.indexOf(0,r);if(n===-1)throw new ue(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let s=t.slice(r,i).toString("utf8");s==="40000"&&(s="040000");let a=PE(s),o=t.slice(i+1,n).toString("utf8");if(o.includes("\\")||o.includes("/"))throw new zo(o);let l=t.slice(n+1,n+21).toString("hex");r=n+21,e.push({mode:s,path:o,oid:l,type:a})}return e}function LL(t){if(typeof t=="number"&&(t=t.toString(8)),t.match(/^0?4.*/))return"040000";if(t.match(/^1006.*/))return"100644";if(t.match(/^1007.*/))return"100755";if(t.match(/^120.*/))return"120000";if(t.match(/^160.*/))return"160000";throw new ue(`Could not understand file mode: ${t}`)}function NL(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=LL(t.mode),t.type||(t.type=PE(t.mode)),t}var Ir=class t{constructor(e){if(Buffer.isBuffer(e))this._entries=OL(e);else if(Array.isArray(e))this._entries=e.map(NL);else throw new ue("invalid type passed to GitTree constructor");this._entries.sort(kE)}static from(e){return new t(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
`)}toObject(){let e=[...this._entries];return e.sort(DL),Buffer.concat(e.map(r=>{let i=Buffer.from(r.mode.replace(/^0/,"")),n=Buffer.from(" "),s=Buffer.from(r.path,"utf8"),a=Buffer.from([0]),o=Buffer.from(r.oid,"hex");return Buffer.concat([i,n,s,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Cs=class{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let o=0;o<n;o++)a[o]=i.charCodeAt(o);return a.set(r,n),a}static unwrap(e){let r=e.indexOf(32),i=e.indexOf(0),n=e.slice(0,r).toString("utf8"),s=e.slice(r+1,i).toString("utf8"),a=e.length-(i+1);if(parseInt(s)!==a)throw new ue(`Length mismatch: expected ${s} bytes but got ${a} instead.`);return{type:n,object:Buffer.from(e.slice(i+1))}}};async function RE({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`,n=await t.read(`${e}/${i}`);return n?{object:n,format:"deflated",source:i}:null}function BL(t,e){let r=new _i(t),i=oE(r);if(i!==e.byteLength)throw new ue(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=oE(r),s,a=cE(r,e);if(a.byteLength===n)s=a;else{s=Buffer.alloc(n);let o=new _i(s);for(o.copy(a);!r.eof();)o.copy(cE(r,e));let l=o.tell();if(n!==l)throw new ue(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${l} bytes`)}return s}function oE(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}function lE(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}function cE(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=lE(t,r&n,4),o=lE(t,(r&s)>>4,3);return o===0&&(o=65536),e.slice(a,a+o)}else return t.slice(r)}function HL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function $E(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:HL(t)}var ld=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=$E(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>UL(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function UL(t){return t.reduce((e,r)=>e+r.length,0)}async function GL(t,e){let r=new ld(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new ue(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new ue(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let a=r.tell(),{type:o,length:l,ofs:c,reference:u}=await jL(r),f=new Fg.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new ue(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new ue("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await e({data:f.result,type:o,num:s,offset:a,end:h,reference:u,ofs:c})}}}}async function jL(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let a=4;do e=await t.byte(),i|=(e&127)<<a,a+=7;while(e&128)}let n,s;if(r===6){let a=0;n=0;let o=[];do e=await t.byte(),n|=(e&127)<<a,a+=7,o.push(e);while(e&128);s=Buffer.fro Line truncated
`,t}function cd(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:JL(n)}}function JL(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),eN(i)}function eN(t){return t===0?t:-t}var Kr=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new ue("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object}
type ${e.type}
tag ${e.tag}
tagger ${kg(e.tagger)}
${e.message}
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(`
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
`+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.tagger&&(i.tagger=cd(i.tagger)),i.committer&&(i.committer=cd(i.committer)),i}withoutSignature(){let e=Xn(this._tag);return e.indexOf(`
-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Xn(e)}payload(){return this.withoutSignature()+`
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=Xn(s);let a=n+s;return t.from(a)}};function hg(t){return t.trim().split(`
`).map(e=>" "+e).join(`
`)+`
`}function tN(t){return t.split(`
`).map(e=>e.replace(/^ /,"")).join(`
`)}var Mr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new ue("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=t.justHeaders(e),n=t.justMessage(e),s=Xn(i+`
gpgsig`+hg(r)+`
`+n);return new t(s)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Xn(e.slice(e.indexOf(`
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
`))}parseHeaders(){let e=t.justHeaders(this._commit).split(`
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
`+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.author&&(i.author=cd(i.author)),i.committer&&(i.committer=cd(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
`:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
`,e.parent){if(e.parent.length===void 0)throw new ue("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s}
`}let i=e.author;r+=`author ${kg(i)}
`;let n=e.committer||e.author;return r+=`committer ${kg(n)}
`,e.gpgsig&&(r+="gpgsig"+hg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+`
`+Xn(e.message)}render(){return this._commit}withoutSignature(){let e=Xn(this._commit);if(e.indexOf(`
gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(`
gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
`)+28);return Xn(r+`
`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return tN(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=t.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=Xn(a);let l=t.justHeaders(e._commit)+`
gpgsig`+hg(a)+`
`+s;return t.from(l)}};async function Ko({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Ir.from([]),oid:i};let{type:n,object:s}=await Je({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Kr.from(s).parse().object,Ko({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=Mr.from(s).parse().tree,Ko({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new yr(i,n,"tree");return{tree:Ir.from(s),oid:i}}var Ag=class{constructor({fs:e,gitdir:r,ref:i,cache:n}){this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let a=new Map,o;try{o=await W.resolve({fs:e,gitdir:r,ref:i})}catch(c){c instanceof He&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Ko({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",a.set(".",l),a})();let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,o=a.get(r);if(!o)throw new Error(`No obj for ${r}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:c,object:u}=await Je({fs:i,cache:n,gitdir:s,oid:l});if(c!==o.type)throw new yr(l,c,o.type);let f=Ir.from(u);for(let d of f)a.set(O(r,d.path),d);return f.entries().map(d=>O(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=AE(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,o=r.get(e._fullpath).oid,{type:l,object:c}=await Je({fs:i,cache:n,gitdir:s,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};function Zr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,md,{value:function({fs:r,gitdir:i,cache:n}){return new Ag({fs:r,gitdir:i,ref:t,cache:n})}}),Object.freeze(e),e}var Cg=class{constructor({fs:e,dir:r,gitdir:i,cache:n}){this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.config=null;let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(O(n,r));return s===null?null:s.map(a=>O(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Wo(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await r.readlink(`${i}/${e._fullpath}`);else{let o=await(await this._getGitConfig(r,n)).get("core.autocrlf");s=await r.read(`${i}/${e._fullpath}`,{autocrlf:o})}e._actualSize=s.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(s)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await ft.acquire({fs:i,gitdir:n,cache:s},async function(o){let l=o.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||nd(c,l,f,d)){let h=await e.content();h===void 0?a=void 0:(a=await wn(Cs.wrap({type:"blob",object:h})),l&&a===l.oid&&(!f||c.mode===l.mode)&&nd(c,l,f,d)&&o.insert({filepath:e._fullpath,stats:c,oid:a}))}else a=l.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await dt.get({fs:e,gitdir:r}),this.config)}};function tl(){let t=Object.create(null);return Object.defineProperty(t,md,{value:function({fs:e,dir:r,gitdir:i,cache:n}){return new Cg({fs:e,dir:r,gitdir:i,cache:n})}}),Object.freeze(t),t}function rN(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}var ME=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Tg=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){th Line truncated
`),i=new TextEncoder().encode(i)}catch(n){}return typeof i!="string"&&(i=Buffer.from(i)),i}catch(i){return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch(n){await this.mkdir(ha(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=ha(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(pd),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return Buffer.isBuffer(i)?i:Buffer.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function T(t,e){if(e===void 0)throw new Fr(t)}function aN(t){return t.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(t)}async function ee({fsp:t,dotgit:e}){T("fsp",t),T("dotgit",e);let r=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return r.isDirectory()?e:r.isFile()?t._readFile(e,"utf8").then(i=>i.trimRight().substr(8)).then(i=>aN(i)?i:O(ha(e),i)):e}async function ud(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}async function DE({fs:t,dir:e,gitdir:r=O(e,".git"),commit:i="HEAD",cache:n={}}){try{T("fs",t),T("dir",e),T("gitdir",r);let s=new Q(t),a=[Zr({ref:i}),tl(),_a()],o=[],l=await ee({fsp:s,dotgit:r});await ft.acquire({fs:s,gitdir:l,cache:n},async function(u){o=u.unmergedPaths});let c=await Ps({fs:s,cache:n,dir:e,gitdir:l,trees:a,map:async function(u,[f,d,h]){let p=!await ud(d,h),g=o.includes(u),v=!await ud(h,f);if(p||g)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(v)return!1;throw new Qc(u)}});await ft.acquire({fs:s,gitdir:l,cache:n},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let d=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,d,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var Rs=class{static async isIgnored({fs:e,dir:r,gitdir:i=O(r,".git"),filepath:n}){if(sd(n)===".git")return!0;if(n===".")return!1;let s="",a=O(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let o=[{gitignore:O(r,".gitignore"),filepath:n}],l=n.split("/").filter(Boolean);for(let u=1;u<l.length;u++){let f=l.slice(0,u).join("/"),d=l.slice(u).join("/");o.push({gitignore:O(r,f,".gitignore"),filepath:d})}let c=!1;for(let u of o){let f;try{f=await e.read(u.gitignore,"utf8")}catch(p){if(p.code==="NOENT")continue}let d=cL().add(s);d.add(f);let h=ha(u.filepath);if(h!=="."&&d.ignores(h))return!0;c?c=!d.test(u.filepath).unignored:c=d.test(u.filepath).ignored}return c}};async function oN({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new ue("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${n.slice(0,2)}/${n.slice(2)}`,a=`${e}/${s}`;await t.exists(a)||await t.write(a,r)}var pg=null;async function OE(t){return pg===null&&(pg=cN()),pg?lN(t):Fg.deflate(t)}async function lN(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}function cN(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(t){return!1}}async function Dr({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:a=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=Cs.wrap({type:r,object:i})),s=await wn(i),i=Buffer.from(await OE(i))),a||await oN({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}function LE(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function NE({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,cache:n={},force:s=!1,parallel:a=!0}){try{T("fs",t),T("dir",e),T("gitdir",r),T("filepath",i);let o=new Q(t),l=await ee({fsp:o,dotgit:r});await ft.acquire({fs:o,gitdir:l,cache:n},async c=>{let f=await(await dt.get({fs:o,gitdir:l})).get("core.autocrlf");return Rg({dir:e,gitdir:l,fs:o,filepath:i,index:c,force:s,parallel:a,autocrlf:f})})}catch(o){throw o.caller="git.add",o}}async function Rg({dir:t,gitdir:e,fs:r,filepath:i,in Line truncated
`,author:l,committer:c,signingKey:u})}async function jE({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{T("fs",t),T("gitdir",i),T("oid",s),T("note",a),u&&T("onSign",e);let d=new Q(t),h=await $s({fs:d,gitdir:i,author:l});if(!h)throw new Zt("author");let p=await ga({fs:d,gitdir:i,author:h,committer:c});if(!p)throw new Zt("committer");let g=await ee({fsp:d,dotgit:i});return await uN({fs:d,cache:f,onSign:e,gitdir:g,ref:n,oid:s,note:a,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}var fN=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function tu(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!fN.test(t)&&(!!e||t.includes("/"))}async function VE({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!tu(r,!0))throw new Gi(r,Dc.clean(r));let s=await dt.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Ui("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await dt.save({fs:t,gitdir:e,config:s})}async function zE({fs:t,dir:e,gitdir:r=O(e,".git"),remote:i,url:n,force:s=!1}){try{T("fs",t),T("gitdir",r),T("remote",i),T("url",n);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await VE({fs:a,gitdir:o,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}async function dN({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await W.exists({fs:t,gitdir:i,ref:n}))throw new Ui("tag",n);let f=await W.resolve({fs:t,gitdir:i,ref:l||"HEAD"}),{type:d}=await Je({fs:t,cache:e,gitdir:i,oid:f}),h=Kr.from({object:f,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:o});c&&(h=await Kr.sign(h,r,c));let p=await Dr({fs:t,gitdir:i,type:"tag",object:h.toObject()});await W.writeRef({fs:t,gitdir:i,ref:n,value:p})}async function WE({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{T("fs",t),T("gitdir",i),T("ref",n),c&&T("onSign",e);let d=new Q(t),h=await ee({fsp:d,dotgit:i}),p=await $s({fs:d,gitdir:h,author:s});if(!p)throw new Zt("tagger");return await dN({fs:d,cache:f,onSign:e,gitdir:h,ref:n,tagger:p,message:a,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function hN({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!tu(r,!0))throw new Gi(r,Dc.clean(r));let a=`refs/heads/${r}`;if(!s&&await W.exists({fs:t,gitdir:e,ref:a}))throw new Ui("branch",r,!1);let o;try{o=await W.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch(l){}o&&await W.writeRef({fs:t,gitdir:e,ref:a,value:o}),n&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function qE({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{T("fs",t),T("gitdir",r),T("ref",i);let o=new Q(t),l=await ee({fsp:o,dotgit:r});return await hN({fs:o,gitdir:l,ref:i,object:n,checkout:s,force:a})}catch(o){throw o.caller="git.branch",o}}var YE=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Mg({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,nonBlocking:p=!1,batchSize:g=100}){let v;if(i)try{v=await W.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch(b){v="0000000000000000000000000000000000000000"}let _;try{_=await W.resolve({fs:t,gitdir:s,ref:o})}catch(b){if(o==="HEAD")throw b;let S=`${a}/${o}`;if(_=await W.resolve({fs:t,gitdir:s,ref:S}),h){let k=await dt.get({fs:t,gitdir:s});await k.set(`branch.${o}.remote`,a),await k.set(`branch.${o}.merge`,`refs/heads/${o}`),await dt.save({fs:t,gitdir:s,config:k})}await W.writeRef({fs:t,gitdir:s,ref:`refs/heads/${o}`,value:_})}if(!c){let b;try{b=await pN({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:o,force:d,filepaths:l})}catch(w){throw w instanceof He&&w.data.what===_?new jc(o,_):w}let S=b.filter(([w])=>w==="conflict").map(([w,x])=>x);if(S.length>0)throw new Hc(S);let k=b.filter(([w])=>w==="error").map(([w,x])=>x);if(k.length>0)throw new ue(k.join(", "));if(f){i&&await i({previousHead:v,newHead:_,type:l!=null&&l.length>0?"file":"branch"});return}let E=0,A=b.length;if(await ft.acquire({fs:t,gitdir:s,cache:e},async function(w){await Promise.all(b.filter(([x])=>x==="delete"||x==="delete-index").map(async function([x,y]){let C=`${n}/${y}`;x==="delete"&&await t.rm(C),w.delete({filepath:y}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}))}),await ft.acquire({fs:t,gitdir:s,cache:e},async function(w){for(let[x,y]of b)if(x==="rmdir"||x==="rmdir-index"){let C=`${n}/${y}`;try{x==="rmdir"&&await t.rmdir(C),w.delete({filepath:y}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}catch(P){if(P.code==="ENOTEMP Line truncated
`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)}
`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${i}
`);return{cleanMerge:h,mergedText:d}}async function XE({fs:t,cache:e,dir:r,gitdir:i=O(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=Zr({ref:s}),g=Zr({ref:a}),v=Zr({ref:o}),_=[],b=[],S=[],k=[],E=await Ps({fs:t,cache:e,dir:r,gitdir:i,trees:[p,g,v],map:async function(A,[w,x,y]){let C=sd(A),P=await ud(w,x),L=await ud(y,x);switch(`${P}-${L}`){case"false-false":return{mode:await x.mode(),path:C,oid:await x.oid(),type:await x.type()};case"false-true":return!y&&await w.type()==="tree"?{mode:await w.mode(),path:C,oid:await w.oid(),type:await w.type()}:y?{mode:await y.mode(),path:C,oid:await y.oid(),type:await y.type()}:void 0;case"true-false":return!w&&await y.type()==="tree"?{mode:await y.mode(),path:C,oid:await y.oid(),type:await y.type()}:w?{mode:await w.mode(),path:C,oid:await w.oid(),type:await w.type()}:void 0;case"true-true":{if(w&&y&&await w.type()==="tree"&&await y.type()==="tree")return{mode:await w.mode(),path:C,oid:await w.oid(),type:"tree"};if(w&&y&&await w.type()==="blob"&&await y.type()==="blob")return wN({fs:t,gitdir:i,path:C,ours:w,base:x,theirs:y,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async N=>{if(N.cleanMerge)d||n.insert({filepath:A,oid:N.mergeResult.oid,stage:0});else if(_.push(A),b.push(A),!d){let B="";x&&await x.type()==="blob"&&(B=await x.oid());let ge=await w.oid(),Le=await y.oid();n.delete({filepath:A}),B&&n.insert({filepath:A,oid:B,stage:1}),n.insert({filepath:A,oid:ge,stage:2}),n.insert({filepath:A,oid:Le,stage:3})}return N.mergeResult});if(x&&!w&&y&&await x.type()==="blob"&&await y.type()==="blob"){if(_.push(A),S.push(A),!d){let N=await x.oid(),B=await y.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:N,stage:1}),n.insert({filepath:A,oid:B,stage:3})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:C}}if(x&&w&&!y&&await x.type()==="blob"&&await w.type()==="blob"){if(_.push(A),k.push(A),!d){let N=await x.oid(),B=await w.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:N,stage:1}),n.insert({filepath:A,oid:B,stage:2})}return{mode:await w.mode(),oid:await w.oid(),type:"blob",path:C}}if(x&&!w&&!y&&(await x.type()==="blob"||await x.type()==="tree"))return;throw new Yo}}},reduce:_.length!==0&&(!r||d)?void 0:async(A,w)=>{let x=w.filter(Boolean);if(A&&!(A&&A.type==="tree"&&x.length===0&&A.path!==".")){if(x.length>0||A.path==="."&&x.length===0){let C=new Ir(x).toObject(),P=await Dr({fs:t,gitdir:i,type:"tree",object:C,dryRun:f});A.oid=P}return A}}});return _.length!==0?(r&&!d&&await Ps({fs:t,cache:e,dir:r,gitdir:i,trees:[Zr({ref:E.oid})],map:async function(A,[w]){let x=`${r}/${A}`;if(await w.type()==="blob"){let y=await w.mode(),C=new TextDecoder().decode(await w.content());await t.write(x,C,{mode:y})}return!0}}),new pa(_,b,S,k)):E.oid}async function wN({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:o,baseName:l,dryRun:c,mergeDriver:u=vN}){let f="blob",d="100755",h="",p="";n&&await n.type()==="blob"&&(d=await n.mode(),h=await n.oid(),p=Buffer.from(await n.content()).toString("utf8"));let g=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};if(await i.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};let v=Buffer.from(await i.content()).toString("utf8"),_=Buffer.from(await s.content()).toString("utf8"),{mergedText:b,cleanMerge:S}=await u({branches:[l,a,o],contents:[p,v,_],path:r}),k=await Dr({fs:t,gitdir:e,type:"blob",object:Buffer.from(b,"utf8"),dryRun:c});return{cleanMerge:S,mergeResult:{mode:g,path:r,oid:k,type:f}}}var _N={stage:_a,workdir:tl},gg;async function Qo(t,e){return gg===void 0&&(gg=new Mc),gg.acquire(t,e)}async function bN(t,e,r,i,n=null){let s=O(r,i),a=await t.lstat(s);if(!a)throw new He(s);if(a.isDirectory())throw new ue(`${s}: file expected, but found directory`);let o=n?await RE({fs:t,gitdir:e,oid:n}):void 0,l=o?n:void 0;return o||await Qo({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(LE):await t.read(s);if(c===null)throw new He(s);l=await Dr({fs:t,gitdir:e,type:"blob",object:c})}),l}async function yN({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(n));s.oid=await nu({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await bN(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(i.map(n))}async function mE({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(h=>typeof h=="string"?_N[h]():h),a=[],u=await Ps({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:async(h,[p,g])=>{if(!(h==="."||await Rs.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)& Line truncated
`).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){fa===null&&(fa=new Mc);let n=O(r,"shallow");if(i.size>0){let s=[...i].join(`
`)+`
`;await fa.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await fa.acquire(n,async function(){await e.rm(n)})}};async function kN({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}async function AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(O(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let o=`${r}/objects/pack/${a}`,l=await Ig({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(l.error)throw new ue(l.error);if(l.offsets.has(i))return!0}return!1}async function xE({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=o=>Je({fs:t,cache:e,gitdir:r,oid:o}),a=await kN({fs:t,gitdir:r,oid:i});return a||(a=await AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}function CN(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}function JE(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}var gd={name:"isomorphic-git",version:"1.37.4",agent:"git/isomorphic-git@1.37.4"},Vo=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function TN(t){let e=t.indexOf("\r"),r=t.indexOf(`
`);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}function eS(t){let e=new Vo,r="";return(async()=>(await su(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=TN(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}var dd=class{static demux(e){let r=ot.streamReader(e),i=new Vo,n=new Vo,s=new Vo,a=async function(){let o=await r();if(o===null)return a();if(o===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(o[0]){case 1:{n.write(o.slice(1));break}case 2:{s.write(o.slice(1));break}case 3:{let l=o.slice(1);s.write(l),i.end(),s.end(),n.destroy(new Error(l.toString("utf8")));return}default:i.write(o)}a()};return a(),{packetlines:i,packfile:n,progress:s}}};async function PN(t){let{packetlines:e,packfile:r,progress:i}=dd.demux(t),n=[],s=[],a=[],o=!1,l=!1;return new Promise((c,u)=>{su(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new As(h)),n.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new As(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");a.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))})})}function RN({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(ot.encode(`want ${c}${l}
`)),l="";for(let c of i)o.push(ot.encode(`shallow ${c}
`));n!==null&&o.push(ot.encode(`deepen ${n}
`)),s!==null&&o.push(ot.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
`));for(let c of a)o.push(ot.encode(`deepen-not ${c}
`));o.push(ot.flush());for(let c of r)o.push(ot.encode(`have ${c}
`));return o.push(ot.encode(`done
`)),o}async function Og({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:v=[],relative:_=!1,tags:b=!1,singleBranch:S=!1,headers:k={},prune:E=!1,pruneTags:A=!1}){let w=c||await Is({fs:t,gitdir:l,test:!0}),x=await dt.get({fs:t,gitdir:l}),y=f||w&&await x.get(`branch.${w}.remote`)||"origin",C=d||await x.get(`remote.${y}.url`);if(typeof C=="undefined")throw new Fr("remote OR url");let P=u||w&&await x.get(`branch.${w}.merge`)||c||"HEAD";h===void 0&&(h=await x.get("http.corsProxy"));let L=el.getRemoteHelperFor({url:C}),N=await L.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:C,headers:k,protocolVersion:1}),B=N.auth,ge=N.refs;if(ge.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!N.capabilities.has("shallow"))throw new ks("shallow","depth");if(g!==null&&!N.capabilities.has("deepen-since"))throw new ks("deepen-since","since");if(v.length>0&&!N.capabilities.has("deepen-not"))throw new ks("deepen-not","exclude");if(_===!0&&!N.capabilities.has("deepen-relative"))throw new ks("deepen-relative","relative");let{oid:Le,fullref:ke}=W.resolveAgainstMap({ref:P,map:ge});for(let D of ge.keys())D===ke||D==="HEAD"||D.startsWith("refs/heads/")||b&&D.startsWith("refs/tags/")||ge.delete(D);let ne=JE([...N.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${gd.agent}`]);_&&ne.push("deepen-relative");let Ee=S?[Le]:ge.values(),_e=S?[w]:await W.listRefs({fs:t,gitdir:l,filepath:"refs"}),z=[];for(let D of _e)try{D=await W.expand({fs:t,gitdir:l,ref:D});let M=await W.resolve({fs:t,gitdir:l,ref:D});await xE({fs:t,cache:e,gitdir:l,oid:M})&&z.push(M)}catch(M){}z=[...new Set(z)];let X=await va.read({fs:t,gitdir:l}),V=N.capabilities.has("shallow")?[...X]:[],Ne=RN({capabilities:ne,wants:Ee,haves:z,shallows:V,depth:p,since:g,exclude:v}),gr=Buffer.from(await fd(Ne)),Nt=await L.connect({http:r,onProgress:i,corsProxy:h,service:"git-upload-pack",url:C,auth:B,body:[gr],headers:k}),Fe=await PN(Nt.body);Nt.headers&&(Fe.headers=Nt.headers);for(let D of Fe.shallows)if(!X.has(D))try{let{object:M}=await Je({fs:t,cache:e,gitdir:l,oid:D}),ae=new Mr(M),Te=await Promise.all(ae.headers().parent.map(Tr=>xE({fs:t,cache:e,gitdir:l,oid:Tr})));Te.length===0||Te.every(Tr=>Tr)||X.add(D)}catch(M){X.add(D)}for(let D of Fe.unshallows)X.delete(D);if(await va.write({fs:t,gitdir:l,oids:X}),S){let D=new Map([[ke,Le]]),M=new Map,ae=10,Te=ke;for(;ae--;){let vo=N.symrefs.get(Te);if(vo===void 0)break;M.set(Te,vo),Te=vo}let Bt=ge.get(Te);Bt&&D.set(Te,Bt);let{pruned:Tr}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:D,symrefs:M,tags:b,prune:E});E&&(Fe.pruned=Tr)}else{let{pruned:D}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:ge,symrefs:N.symrefs,tags:b,prune:E,pruneTags:A});E&&(Fe.pruned=D)}if(Fe.HEAD=N.symrefs.get("HEAD"),Fe.HEAD===void 0){let{oid:D}=W.resolveAgainstMap({ref:"HEAD",map:ge});for(let[M,ae]of ge.entries())if(M!=="HEAD"&&ae===D){Fe.HEAD=M;break}}let Pt=ke.startsWith("refs/tags")?"tag":"branch";if(Fe.FETCH_HEAD={oid:Le,description:`${Pt} '${da(ke)}' of ${C}`},i||n){let D=eS(Fe.progress);su(D,async M=>{if(n&&await n(M),i){let ae=M.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);ae&&await i({phase:ae[1].trim(),loaded:parseInt(ae[2],10),total:parseInt(ae[3],10)})}})}let Rt=Buffer.from(await fd(Fe.packfile));if(Nt.body.error)throw Nt.body.error;let Ye=Rt.slice(-20).toString("hex"),J={defaultBranch:Fe.HEAD,fetchHead:Fe.FETCH_HEAD.oid,fetchHeadDescription:Fe.FETCH_HEAD.description};if(Fe.headers&&(J.headers=Fe.headers),E&&(J.pruned=Fe.pruned),Ye!==""&&!CN(Rt)){J.packfile=`objects/pack/pack-${Ye}.pack`;let D=O(l,J.packfile);await t.write(D,Rt);let M=Te=>Je({fs:t,cache:e,gitdir:l,oid:Te}),ae=await Nc.fromPack({pack:Rt,getExternalRefDelta:M,onProgress:i});await t.write(D.replace(/\.pack$/,".idx"),await ae.toBuffer())}return J}async function tS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:O(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core]
repositoryformatversion = 0
filemode = false
bare = ${e}
`+(e?"":` logallrefupdates = true
`)+` symlinks = false
ignorecase = true
`),await t.write(i+"/HEAD",`ref: refs/heads/${n}
`)}async function $N({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:g,since:v,exclude:_,relative:b,singleBranch:S,noCheckout:k,noTags:E,headers:A,nonBlocking:w,batchSize:x=100}){try{if(await tS({fs:t,gitdir:u}),await VE({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let P=await dt.get({fs:t,gitdir:u});await P.set("http.corsProxy",d),await dt.save({fs:t,gitdir:u,config:P})}let{defaultBranch:y,fetchHead:C}=await Og({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:g,since:v,exclude:_,relative:b,singleBranch:S,headers:A,tags:!E});if(C===null)return;h=h||y,h=h.replace("refs/heads/",""),await Mg({fs:t,cache:e,onProgress:i,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:k,nonBlocking:w,batchSize:x})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function rS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:c=O(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:g=void 0,exclude:v=[],relative:_=!1,singleBranch:b=!1,noCheckout:S=!1,noTags:k=!1,headers:E={},cache:A={},nonBlocking:w=!1,batchSize:x=100}){try{T("fs",t),T("http",e),T("gitdir",c),S||T("dir",l),T("url",u);let y=new Q(t),C=await ee({fsp:y,dotgit:c});return await $N({fs:y,cache:A,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:C,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:g,exclude:v,relative:_,singleBranch:b,noCheckout:S,noTags:k,headers:E,nonBlocking:w,batchSize:x})}catch(y){throw y.caller="git.clone",y}}async function iS({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:p={}}){try{T("fs",t),l||T("message",n),o&&T("onSign",e);let g=new Q(t),v=await ee({fsp:g,dotgit:i});return await ru({fs:g,cache:p,onSign:e,gitdir:v,message:n,author:s,committer:a,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(g){throw g.caller="git.commit",g}}async function nS({fs:t,dir:e,gitdir:r=O(e,".git"),fullname:i=!1,test:n=!1}){try{T("fs",t),T("gitdir",r);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await Is({fs:s,gitdir:a,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}async function FN({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await W.exists({fs:t,gitdir:e,ref:r}))throw new He(r);let n=await W.expand({fs:t,gitdir:e,ref:r}),s=await Is({fs:t,gitdir:e,fullname:!0});if(n===s){let l=await W.resolve({fs:t,gitdir:e,ref:n});await W.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await W.deleteRef({fs:t,gitdir:e,ref:n});let a=da(r),o=await dt.get({fs:t,gitdir:e});await o.deleteSection("branch",a),await dt.save({fs:t,gitdir:e,config:o})}async function sS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{T("fs",t),T("ref",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});return await FN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}async function aS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{T("fs",t),T("ref",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});await W.deleteRef({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}async function IN({fs:t,gitdir:e,remote:r}){let i=await dt.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await dt.save({fs:t,gitdir:e,config:i})}async function oS({fs:t,dir:e,gitdir:r=O(e,".git"),remote:i}){try{T("fs",t),T("remote",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});return await IN({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}async function MN({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await W.deleteRef({fs:t,gitdir:e,ref:r})}async function lS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{T("fs",t),T("ref",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});return await MN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}async function DN({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}async function ON({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(O(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await Ig({fs:t,cache:e,filename:l,getExternalRefDelta:n});if(c.error)throw new ue(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}async function LN({fs:t,cache:e,gitdir:r,oid:i}){let n=o=>Je({fs:t,cache:e,gitdir:r,oid:o}),s=await DN({fs:t,gitdir:r,oid:i}),a=await ON({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let o of a)s.indexOf(o)===-1&&s.push(o);if(s.length===1)return s[0];throw s.length>1?new Bc("oids",i,s):new He(`an object matching "${i}"`)}async function cS({fs:t,dir:e,gitdir: Line truncated
`)),i.push(ot.encode(`agent=${gd.agent}
`)),(r||e||t)&&i.push(ot.delim()),r&&i.push(ot.encode("peel")),e&&i.push(ot.encode("symrefs")),t&&i.push(ot.encode(`ref-prefix ${t}`)),i.push(ot.flush()),i}async function DS({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{T("http",t),T("url",s);let d=await Jo.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(d.protocolVersion===1)return yS(d,c,u,f);let h=await zN({prefix:c,symrefs:u,peelTags:f}),p=await Jo.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,body:h});return VN(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function OS({fs:t,dir:e,gitdir:r=O(e,".git")}){try{T("fs",t),T("gitdir",r);let i=new Q(t),n=await ee({fsp:i,dotgit:r});return W.listTags({fs:i,gitdir:n})}catch(i){throw i.caller="git.listTags",i}}function WN(t,e){return t.committer.timestamp-e.committer.timestamp}var qN="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function EE({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===qN)return;let s=i,a,o=await Ko({fs:t,cache:e,gitdir:r,oid:i}),l=o.tree;return n===o.oid?a=o.path:(a=await LS({fs:t,cache:e,gitdir:r,tree:l,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}async function LS({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:o=""}){let l=i.entries().map(function(c){let u;return c.oid===n?(u=O(o,c.path),a.push(u)):c.type==="tree"&&(u=Je({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return LS({fs:t,cache:e,gitdir:r,tree:Ir.from(f),fileId:n,oid:s,filepaths:a,parentPath:O(o,c.path)})})),u});return await Promise.all(l),a}async function YN({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:o,follow:l}){let c=typeof a=="undefined"?void 0:Math.floor(a.valueOf()/1e3),u=[],f=await va.read({fs:t,gitdir:r}),d=await W.resolve({fs:t,gitdir:r,ref:n}),h=[await vn({fs:t,cache:e,gitdir:r,oid:d})],p,g,v;function _(b){v&&i&&u.push(b)}for(;h.length>0;){let b=h.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(i){let S;try{S=await iu({fs:t,cache:e,gitdir:r,oid:b.commit.tree,filepath:i}),g&&p!==S&&u.push(g),p=S,g=b,v=!0}catch(k){if(k instanceof He){let E=l&&p;if(E&&(E=await EE({fs:t,cache:e,gitdir:r,oid:b.commit.tree,fileId:p}),E))if(Array.isArray(E)){if(g){let A=await EE({fs:t,cache:e,gitdir:r,oid:g.commit.tree,fileId:p});if(Array.isArray(A))if(E=E.filter(w=>A.indexOf(w)===-1),E.length===1)E=E[0],i=E,g&&u.push(g);else{E=!1,g&&u.push(g);break}}}else i=E,g&&u.push(g);if(!E){if(v&&p&&(u.push(g),!o))break;if(!o&&!l)throw k}g=b,v=!1}else throw k}}else u.push(b);if(s!==void 0&&u.length===s){_(b);break}if(!f.has(b.oid))for(let S of b.commit.parent){let k=await vn({fs:t,cache:e,gitdir:r,oid:S});h.map(E=>E.oid).includes(k.oid)||h.push(k)}h.length===0&&_(b),h.sort((S,k)=>WN(S.commit,k.commit))}return u}async function NS({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:o,follow:l,cache:c={}}){try{T("fs",t),T("gitdir",r),T("ref",n);let u=new Q(t),f=await ee({fsp:u,dotgit:r});return await YN({fs:u,cache:c,gitdir:f,filepath:i,ref:n,depth:s,since:a,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function BS({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:g={},mergeDriver:v,allowUnrelatedHistories:_=!1}){try{T("fs",t),p&&T("onSign",e);let b=new Q(t),S=await ee({fsp:b,dotgit:i}),k=await $s({fs:b,gitdir:S,author:d});if(!k&&(!o||!a))throw new Zt("author");let E=await ga({fs:b,gitdir:S,author:k,committer:h});if(!E&&(!o||!a))throw new Zt("committer");return await fS({fs:b,cache:g,dir:r,gitdir:S,ours:n,theirs:s,fastForward:a,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:k,committer:E,signingKey:p,onSign:e,mergeDriver:v,allowUnrelatedHistories:_})}catch(b){throw b.caller="git.merge",b}}var XN={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function HS({fs:t,cache:e,dir:r,gitdir:i=O(r,".git"),oids:n}){let s=new SE,a=[];function o(u,f){let d=Buffer.from(u,f);a.push(d),s.update(d)}async function l({stype:u,object:f}){let d=XN[u],h=f.length,p=h>15?128:0,g=h&15;h=h>>>4;let v=(p|d|g).toString(16);for(o(v,"hex");p;)p=h>127?128:0,v=p|h&127,o($g(2,v),"hex"),h=h>>>7;o(Buffer.from(await OE(f)))}o("PACK"),o("00000002","hex"),o($g(8,n.length),"hex");for(let u of n){let{type:f,object:d}=await Je({fs:t,cache:e,gitdir:i,oid:u});await l({write:o,object:d,stype:f})}let c=s.digest();return a.push(c),a}async function ZN({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await HS({fs:t,cache:e,gitdir:r,oids:i}),a=Buffer.from(await fd(s)),l=`pack-${a.slice(-20).toString("hex")}.pack`;return n?(await t.write(O(r,`objects/pack/${l}`),a),{filename:l}):{fil Line truncated
`),n=await i();let s=r.toString("utf8").split(`
`);if(n=s.shift(),!n.startsWith("unpack "))throw new ma('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let a of s){if(a.trim()==="")continue;let o=a.slice(0,2),l=a.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:o==="ok",error:f}}return e}async function JN({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(ot.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i}
`)),i="";return r.push(ot.flush()),r}async function eB({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:_={}}){let b=u||await Is({fs:t,gitdir:c});if(typeof b=="undefined")throw new Fr("ref");let S=await dt.get({fs:t,gitdir:c});d=d||await S.get(`branch.${b}.pushRemote`)||await S.get("remote.pushDefault")||await S.get(`branch.${b}.remote`)||"origin";let k=h||await S.get(`remote.${d}.pushurl`)||await S.get(`remote.${d}.url`);if(typeof k=="undefined")throw new Fr("remote OR url");let E=f||await S.get(`branch.${b}.merge`);if(typeof k=="undefined")throw new Fr("remoteRef");v===void 0&&(v=await S.get("http.corsProxy"));let A=await W.expand({fs:t,gitdir:c,ref:b}),w=g?"0000000000000000000000000000000000000000":await W.resolve({fs:t,gitdir:c,ref:A}),x=el.getRemoteHelperFor({url:k}),y=await x.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:v,service:"git-receive-pack",url:k,headers:_,protocolVersion:1}),C=y.auth,P;if(!E)P=A;else try{P=await W.expandAgainstMap({ref:E,map:y.refs})}catch(X){if(X instanceof He)P=E.startsWith("refs/")?E:`refs/heads/${E}`;else throw X}let L=y.refs.get(P)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:k,localRef:{ref:g?"(delete)":A,oid:w},remoteRef:{ref:P,oid:L}}))throw new Zo;let N=!y.capabilities.has("no-thin"),B=new Set;if(!g){let X=[...y.refs.values()],V=new Set;if(L!=="0000000000000000000000000000000000000000"){let Ne=await Lg({fs:t,cache:e,gitdir:c,oids:[w,L]});for(let gr of Ne)X.push(gr);N&&(V=await _g({fs:t,cache:e,gitdir:c,oids:Ne}))}if(!X.includes(w)){let Ne=await KN({fs:t,cache:e,gitdir:c,start:[w],finish:X});B=await _g({fs:t,cache:e,gitdir:c,oids:Ne})}if(N){try{let Ne=await W.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:gr}=await W.resolveAgainstMap({ref:Ne.replace(`refs/remotes/${d}/`,""),fullref:Ne,map:y.refs}),Nt=[gr];for(let Fe of await _g({fs:t,cache:e,gitdir:c,oids:Nt}))V.add(Fe)}catch(Ne){}for(let Ne of V)B.delete(Ne)}if(w===L&&(p=!0),!p){if(A.startsWith("refs/tags")&&L!=="0000000000000000000000000000000000000000")throw new Xo("tag-exists");if(w!=="0000000000000000000000000000000000000000"&&L!=="0000000000000000000000000000000000000000"&&!await AS({fs:t,cache:e,gitdir:c,oid:w,ancestor:L,depth:-1}))throw new Xo("not-fast-forward")}}let ge=JE([...y.capabilities],["report-status","side-band-64k",`agent=${gd.agent}`]),Le=await JN({capabilities:ge,triplets:[{oldoid:L,oid:w,fullRef:P}]}),ke=g?[]:await HS({fs:t,cache:e,gitdir:c,oids:[...B]}),ne=await x.connect({http:r,onProgress:i,corsProxy:v,service:"git-receive-pack",url:k,auth:C,headers:_,body:[...Le,...ke]}),{packfile:Ee,progress:_e}=await dd.demux(ne.body);if(n){let X=eS(_e);su(X,async V=>{await n(V)})}let z=await QN(Ee);if(ne.headers&&(z.headers=ne.headers),d&&z.ok&&z.refs[P].ok&&!A.startsWith("refs/tags")){let X=`refs/remotes/${d}/${P.replace("refs/heads","")}`;g?await W.deleteRef({fs:t,gitdir:c,ref:X}):await W.writeRef({fs:t,gitdir:c,ref:X,value:w})}if(z.ok&&Object.values(z.refs).every(X=>X.ok))return z;{let X=Object.entries(z.refs).filter(([V,Ne])=>!Ne.ok).map(([V,Ne])=>`
- ${V}: ${Ne.error}`).join("");throw new Wc(X,z)}}async function jS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,dir:l,gitdir:c=O(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:_={},cache:b={}}){try{T("fs",t),T("http",e),T("gitdir",c);let S=new Q(t),k=await ee({fsp:S,dotgit:c});return await eB({fs:S,cache:b,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,gitdir:k,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:g,corsProxy:v,headers:_})}catch(S){throw S.caller="git.push",S}}async function VS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await Je({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Kr.from(s).parse().object,VS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new yr(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}async function zS({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await iu({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await VS({fs:t,cache:e,gitdir:r,oid:i})}async function WS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,filepath:n,cache:s={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await zS({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}async function Ng({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await vn({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readCommit",s}}async function tB({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await W.resolve({gitdir:r,fs:t,ref:i}),{blob:a}=await zS({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}async function qS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{T("fs",t),T("gitdir",r),T("ref",i),T("oid",n);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await tB({fs:a,cache:s,gitdir:o,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}async function YS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:o={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let l=new Q(t),c=await ee({fsp:l,dotgit:r});s!==void 0&&(i=await iu({fs:l,cache:o,gitdir:c,oid:i,filepath:s}));let f=await Je({fs:l,cache:o,gitdir:c,oid:i,format:n==="parsed"?"content":n});if(f.oid=i,n==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Mr.from(f.object).parse();break;case"tree":f.object=Ir.from(f.object).entries();break;case"blob":a?f.object=f.object.toString(a):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=Kr.from(f.object).parse();break;default:throw new yr(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(l){throw l.caller="git.readObject",l}}async function rB({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await Je({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new yr(i,n,"tag");let a=Kr.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}async function XS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await rB({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readTag",s}}async function ZS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await rl({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}async function KS({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("filepath",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});await ft.acquire({fs:s,gitdir:a,cache:n},async function(o){o.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}async function iB({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l}){let c;try{c=await W.resolve({gitdir:i,fs:t,ref:n})}catch(p){if(!(p instanceof He))throw p}let f=(await rl({fs:t,cache:e,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await nu({fs:t,gitdir:i,tree:f});return await ru({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
`,author:a,committer:o,signingKey:l})}async function QS({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l,cache:c={}}){try{T("fs",t),T("gitdir",i),T("oid",s);let u=new Q(t),f=await ee({fsp:u,dotgit:i}),d=await $s({fs:u,gitdir:f,author:a});if(!d)throw new Zt("author");let h=await ga({fs:u,gitdir:f,author:d,committer:o});if(!h)throw new Zt("committer");return await iB({fs:u,cache:c,onSign:e,gitdir:f,ref:n,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function nB({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!tu(i,!0))throw new Gi(i,Dc.clean(i));if(!tu(r,!0))throw new Gi(r,Dc.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await W.exists({fs:t,gitdir:e,ref:a}))throw new Ui("branch",i,!1);let l=await W.resolve({fs:t,gitdir:e,ref:s,depth:1});await W.writeRef({fs:t,gitdir:e,ref:a,value:l}),await W.deleteRef({fs:t,gitdir:e,ref:s});let u=await Is({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function JS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{T("fs",t),T("gitdir",r),T("ref",i),T("oldref",n);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await nB({fs:a,gitdir:o,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}async function ek({gitdir:t,type:e,object:r}){return wn(Cs.wrap({type:e,object:r}))}async function tk({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,ref:n,cache:s={}}){try{T("fs",t),T("gitdir",r),T("filepath",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r}),l,c;try{l=await W.resolve({fs:a,gitdir:o,ref:n||"HEAD"})}catch(d){if(n)throw d}if(l)try{l=await iu({fs:a,cache:s,gitdir:o,oid:l,filepath:i})}catch(d){l=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await a.read(O(e,i));f&&(c=await ek({gitdir:o,type:"blob",object:f}),l===c&&(u=await a.lstat(O(e,i)))),await ft.acquire({fs:a,gitdir:o,cache:s},async function(d){d.delete({filepath:i}),l&&d.insert({filepath:i,stats:u,oid:l})})}catch(a){throw a.caller="git.reset",a}}async function rk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,depth:n}){try{T("fs",t),T("gitdir",r),T("ref",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await W.resolve({fs:s,gitdir:a,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}async function ik({fs:t,dir:e,gitdir:r=O(e,".git"),path:i,value:n,append:s=!1}){try{T("fs",t),T("gitdir",r),T("path",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r}),l=await dt.get({fs:a,gitdir:o});s?await l.append(i,n):await l.set(i,n),await dt.save({fs:a,gitdir:o,config:l})}catch(a){throw a.caller="git.setConfig",a}}async function nk({fs:t,gitdir:e,commit:r}){let i=Mr.from(r).toObject();return await Dr({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}var hd=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${o} ${i}
`}static getStashReflogEntry(e,r=!1){return e.split(`
`).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}},wa=class t{constructor({fs:e,dir:r,gitdir:i=O(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return O(this.gitdir,t.refStash)}get refLogsStashPath(){return O(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await $s({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Zt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return nk({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new Gi(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?vn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return W.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=hd.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await Qo({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return hd.getStashReflogEntry(r,e)}};async function sk({fs:t,dir:e,gitdir:r,message:i=""}){let n=new wa({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Is({fs:t,gitdir:r,fullname:!1}),a=await W.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await Ng({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,f=Zr({ref:"HEAD"}),d=await mE({fs:t,dir:e,gitdir:r,treePair:[Zr({ref:"HEAD"}),"stage"]});if(d){let v=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(v),u=d,f=_a()}let h=await mE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let v=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(v),u=h}if(!u||!d&&!h)throw new He("changes, nothing to stash");let p=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${l}`;return{stashCommit:await n.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:n}}async function sB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:o}=await sk({fs:t,dir:e,gitdir:r,message:i});return await o.writeStashRef(n),await o.writeStashReflogEntry({stashCommit:n,message:s}),await Dg({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}async function aB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await sk({fs:t,dir:e,gitdir:r,message:i});return n}async function ak({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new wa({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let o=0;o<a.length-1;o++){let c=(await vn({fs:t,cache:{},gitdir:r,oid:a[o+1]})).commit.message.startsWith("stash-Index");await ZE({fs:t,dir:e,gitdir:r,stashCommit:a[o+1],parentCommit:a[o],wasStaged:c})}}async function ok({fs:t,dir:e,gitdir:r,refIdx:i=0}){let n=new wa({fs:t,dir:e,gitdir:r});if(!(await n.readStashCommit(i)).commit)return;let a=n.refStashPath;await Qo(a,async()=>{await t.exists(a)&&await t.rm(a)});let o=await n.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(i,1);let l=n.refLogsStashPath;await Qo({reflogEntries:o,stashReflogPath:l,stashMgr:n},async()=>{if(o.length){await t.write(l,o.reverse().join(`
`)+`
`,"utf8");let c=o[o.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(l)})}async function oB({fs:t,dir:e,gitdir:r}){return new wa({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function lB({fs:t,dir:e,gitdir:r}){let i=new wa({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await Qo(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function cB({fs:t,dir:e,gitdir:r,refIdx:i=0}){await ak({fs:t,dir:e,gitdir:r,refIdx:i}),await ok({fs:t,dir:e,gitdir:r,refIdx:i})}async function lk({fs:t,dir:e,gitdir:r=O(e,".git"),op:i="push",message:n="",refIdx:s=0}){T("fs",t),T("dir",e),T("gitdir",r),T("op",i);let a={push:sB,apply:ak,drop:ok,list:oB,clear:lB,pop:cB,create:aB},o=["apply","drop","pop"];try{let l=new Q(t),c=await ee({fsp:l,dotgit:r});["refs","logs","logs/refs"].map(d=>O(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=a[i];if(f){if(o.includes(i)&&s<0)throw new Gi(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(l){throw l.caller="git.stash",l}}async function ck({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("filepath",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});if(await Rs.isIgnored({fs:s,gitdir:a,dir:e,filepath:i}))return"ignored";let l=await uB({fs:s,cache:n,gitdir:a}),c=await uk({fs:s,cache:n,gitdir:a,tree:l,path:i}),u=await ft.acquire({fs:s,gitdir:a,cache:n},async function(v){for(let _ of v)if(_.path===i)return _;return null}),f=await s.lstat(O(e,i)),d=c!==null,h=u!==null,p=f!==null,g=async()=>{if(h&&!nd(u,f))return u.oid;{let v=await s.read(O(e,i)),_=await ek({gitdir:a,type:"blob",object:v});return h&&u.oid===_&&f.size!==-1&&ft.acquire({fs:s,gitdir:a,cache:n},async function(b){b.insert({filepath:i,stats:f,oid:_})}),_}};if(!d&&!p&&!h)return"absent";if(!d&&!p&&h)return"*absent";if(!d&&p&&!h)return"*added";if(!d&&p&&h)return await g()===u.oid?"added":"*added";if(d&&!p&&!h)return"deleted";if(d&&!p&&h)return c===u.oid,"*deleted";if(d&&p&&!h)return await g()===c?"*undeleted":"*undeletemodified";if(d&&p&&h){let v=await g();return v===c?v===u.oid?"unmodified":"*unmodified":v===u.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}async function uk({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let a of i)if(a.path===s){if(n.length===0)return a.oid;let{type:o,object:l}=await Je({fs:t,cache:e,gitdir:r,oid:a.oid});if(o==="tree"){let c=Ir.from(l);return uk({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(o==="blob")throw new yr(a.oid,o,"blob",n.join("/"))}return null}async function uB({fs:t,cache:e,gitdir:r}){let i;try{i=await W.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof He)return[]}let{tree:n}=await rl({fs:t,cache:e,gitdir:r,oid:i});return n}async function fk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:o=!1}){try{T("fs",t),T("gitdir",r),T("ref",i);let l=new Q(t),c=await ee({fsp:l,dotgit:r});return await Ps({fs:l,cache:a,dir:e,gitdir:c,trees:[Zr({ref:i}),tl(),_a()],map:async function(u,[f,d,h]){if(!f&&!h&&d&&!o&&await Rs.isIgnored({fs:l,dir:e,filepath:u})||!n.some(w=>YE(u,w)))return null;if(s&&!s(u))return;let[p,g,v]=await Promise.all([f&&f.type(),d&&d.type(),h&&h.type()]),_=[p,g,v].includes("blob");if((p==="tree"||p==="special")&&!_)return;if(p==="commit")return null;if((g==="tree"||g==="special")&&!_)return;if(v==="commit")return null;if((v==="tree"||v==="special")&&!_)return;let b=p==="blob"?await f.oid():void 0,S=v==="blob"?await h.oid():void 0,k;p!=="blob"&&g==="blob"&&v!=="blob"?k="42":g==="blob"&&(k=await d.oid());let E=[void 0,b,k,S],A=E.map(w=>E.indexOf(w));return A.shift(),[u,...A]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function dk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,object:n,force:s=!1}){try{T("fs",t),T("gitdir",r),T("ref",i);let a=new Q(t);if(i===void 0)throw new Fr("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let o=await ee({fsp:a,dotgit:r}),l=await W.resolve({fs:a,gitdir:o,ref:n||"HEAD"});if(!s&&await W.exists({fs:a,gitdir:o,ref:i}))throw new Ui("tag",i);await W.writeRef({fs:a,gitdir:o,ref:i,value:l})}catch(a){throw a.caller="git.tag",a}}async function hk({fs:t,dir:e,gitdir:r=O(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:o,remove:l,force:c}){try{T("fs",t),T("gitdir",r),T("filepath",n);let u=new Q(t),f=await ee({fsp:u,dotgit:r});if(l)return await ft.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!c){let p=await u.lstat(O(e,n));if(p){if(p.isDirectory())throw new Ts("directory");return}}h.has({filepath:n})&&h.delete({filepath:n})});let d;if(!s){if(d=await u.lstat(O(e,n)),!d)throw new He(`file at "${n}" on disk and "remove" not set`);if(d.isDirectory())throw new Ts("directory")}return await ft.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!o&&!h.has({filepath:n}))throw new He(`filLine truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kB(t,e){if(t){if(typeof t=="string")return Nk(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Nk(t,e)}}function Nk(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function AB(t,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(t)))){var r=[],i=!0,n=!1,s=void 0;try{for(var a=t[Symbol.iterator](),o;!(i=(o=a.next()).done)&&(r.push(o.value),!(e&&r.length===e));i=!0);}catch(l){n=!0,s=l}finally{try{!i&&a.return!=null&&a.return()}finally{if(n)throw s}}return r}}function CB(t){if(Array.isArray(t))return t}var Hk=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,Uk=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,Gk=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,jk=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,Vk=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,zk=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,Wk=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function lu(t,e){return t.indexOf(e)>-1}function TB(t,e,r){var i=t/255,n=e/255,s=r/255,a=Math.max(i,n,s),o=Math.min(i,n,s),l=a-o,c=(a+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=function(){switch(a){case i:return(n-s)/l%6;case n:return(s-i)/l+2;default:return(i-n)/l+4}}();return[f*60,u*100,c*100]}function PB(t,e,r){var i=t/60,n=e/100,s=r/100,a=(1-Math.abs(2*s-1))*n,o=a*(1-Math.abs(i%2-1)),l=s-a/2,c=function(){return i<1?[a,o,0]:i<2?[o,a,0]:i<3?[0,a,o]:i<4?[0,o,a]:i<5?[o,0,a]:[a,0,o]}(),u=xr(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var RB=function(){function t(e){var r=xr(e,4),i=r[0],n=r[1],s=r[2],a=r[3];xB(this,t),this.values=[Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),a==null?1:Math.max(Math.min(parseFloat(a),255),0)]}return EB(t,[{key:"toRgbString",value:function(){var r=xr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return a===1?"rgb(".concat(i,", ").concat(n,", ").concat(s,")"):"rgba(".concat(i,", ").concat(n,", ").concat(s,", ").concat(a,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),i=xr(r,4),n=i[0],s=i[1],a=i[2],o=i[3];return o===1?"hsl(".concat(n,", ").concat(s,"%, ").concat(a,"%)"):"hsla(".concat(n,", ").concat(s,"%, ").concat(a,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=xr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return i=Number(i).toString(16).padStart(2,"0"),n=Number(n).toString(16).padStart(2,"0"),s=Number(s).toString(16).padStart(2,"0"),a=a<1?parseInt(a*255,10).toString(16).padStart(2,"0"):"","#".concat(i).concat(n).concat(s).concat(a)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=xr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3],o=TB(i,n,s),l=xr(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,a]}}]),t}();function ol(t){var e=xr(t,4),r=e[0],i=e[1],n=e[2],s=e[3];return new RB([r,i,n,s])}function tv(t){var e=xr(t,3),r=e[0],i=e[1],n=e[2];return ol([r,i,n,1])}function Cd(t){var e=xr(t,4),r=e[0],i=e[1],n=e[2],s=e[3],a=PB(r,i,n),o=xr(a,3),l=o[0],c=o[1],u=o[2];return ol([l,c,u,s])}function qk(t){var e=xr(t,3),r=e[0],i=e[1],n=e[2];return Cd([r,i,n,1])}function $B(t){var e=Hk.exec(t)||Uk.exec(t),r=xr(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=parseInt(i.length<2?i.repeat(2):i,16),n=parseInt(n.length<2?n.repeat(2):n,16),s=parseInt(s.length<2?s.repeat(2):s,16),a=a&&(parseInt(a.length<2?a.repeat(2):a,16)/255).toPrecision(1)||1,ol([i,n,s,a])}function FB(t){var e=Gk.exec(t)||Vk.exec(t)||jk.exec(t)||zk.exec(t),r=xr(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=lu(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),n=lu(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),s=lu(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),a=a===void 0?1:parseFloat(a)/(lu(a,"%")?100:1),ol([i,n,s,a])}function IB(t){var e=Wk.exec(t),r=xr(e,6),i=r[1],n=r[2],s=r[3],a=r[4],o=r[5];return n=n||"deg",i=(0,yB.default)(parseFloat(i),n,"deg"),s=parseFloat(s),a=parseFloat(a),o=o===void 0?1:parseFloat(o)/(lu(o,"%")?100:1),Cd([i,s,a,o])}function Yk(t){return Ok.default[t]?tv(Ok.default[t]):Hk.test(t)||Uk.test(t)?$B(t):Gk.test(t)||Vk.test(t)||jk.test(t)||zk.test(t)?FB(t):Wk.test(t)?IB(t):null}var MB={fromString:Yk,fromRgb:tv,fromRgba:ol,fromHsl:qk,fromHsla:Cd};Zn.default=MB});var oA=H((n9,aA)=>{m();aA.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=n+1,l=[],c=[],u,f,d=function(){n>=s&&(u=r,f=n,r=i,i=u,n=s,s=f,a=!0,o=n+1)},h=function(g,v,_,b,S){return{startX:g,startY:v,endX:_,endY:b,r:S}},p=function(g,v,_){var b,S,k,E,A;for(v>_?b=l[g-1+o]:b=l[g+1+o],A=k=Math.max(v Line truncated
`});Ee=!1,z=ne.length}function Fe(Pt,Rt){var Ye="="+V,J=Pt.indexOf(Ye,Rt),D=c(Pt.substring(Pt.indexOf("=",Rt)+1,J)).split(" ");return X=D[0],V=D[D.length-1],J+Ye.length-1}for(y&&(y=y.split(" "),X=y[0],V=y[1]),_e=0;_e<C;_e++)B==P?u(X,x,_e)?(--_e,Ne(),B=L):x.charAt(_e)==`
`?Nt(Ee):ke+=x.charAt(_e):B==L?(_e+=X.length-1,Le=t.tags[x.charAt(_e+1)],ge=Le?x.charAt(_e+1):"_v",ge=="="?(_e=Fe(x,_e),B=P):(Le&&_e++,B=N),Ee=_e):u(V,x,_e)?(ne.push({tag:ge,n:c(ke),otag:X,ctag:V,i:ge=="/"?Ee-X.length:_e+V.length}),ke="",_e+=V.length-1,B=P,ge=="{"&&(V=="}}"?_e++:l(ne[ne.length-1]))):ke+=x.charAt(_e);return Nt(Ee,!0),ne};function l(w){w.n.substr(w.n.length-1)==="}"&&(w.n=w.n.substring(0,w.n.length-1))}function c(w){return w.trim?w.trim():w.replace(/^\s*|\s*$/g,"")}function u(w,x,y){if(x.charAt(y)!=w.charAt(0))return!1;for(var C=1,P=w.length;C<P;C++)if(x.charAt(y+C)!=w.charAt(C))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(w,x,y,C){var P=[],L=null,N=null,B=null;for(N=y[y.length-1];w.length>0;){if(B=w.shift(),N&&N.tag=="<"&&!(B.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[B.tag]<=t.tags.$||h(B,C))y.push(B),B.nodes=d(w,B.tag,y,C);else if(B.tag=="/"){if(y.length===0)throw new Error("Closing tag without opener: /"+B.n);if(L=y.pop(),B.n!=L.n&&!p(B.n,L.n,C))throw new Error("Nesting error: "+L.n+" vs. "+B.n);return L.end=B.i,P}else B.tag==`
`&&(B.last=w.length==0||w[0].tag==`
`);P.push(B)}if(y.length>0)throw new Error("missing closing tag: "+y.pop().n);return P}function h(w,x){for(var y=0,C=x.length;y<C;y++)if(x[y].o==w.n)return w.tag="#",!0}function p(w,x,y){for(var C=0,P=y.length;C<P;C++)if(y[C].c==w&&y[C].o==x)return!0}function g(w){var x=[];for(var y in w)x.push('"'+b(y)+'": function(c,p,t,i) {'+w[y]+"}");return"{ "+x.join(",")+" }"}function v(w){var x=[];for(var y in w.partials)x.push('"'+b(y)+'":{name:"'+b(w.partials[y].name)+'", '+v(w.partials[y])+"}");return"partials: {"+x.join(",")+"}, subs: "+g(w.subs)}t.stringify=function(w,x,y){return"{code: function (c,p,i) { "+t.wrapMain(w.code)+" },"+v(w)+"}"};var _=0;t.generate=function(w,x,y){_=0;var C={code:"",subs:{},partials:{}};return t.walk(w,C),y.asString?this.stringify(C,x,y):this.makeTemplate(C,x,y)},t.wrapMain=function(w){return'var t=this;t.b(i=i||"");'+w+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(w,x,y){var C=this.makePartials(w);return C.code=new Function("c","p","i",this.wrapMain(w.code)),new this.template(C,x,this,y)},t.makePartials=function(w){var x,y={subs:{},partials:w.partials,name:w.name};for(x in y.partials)y.partials[x]=this.makePartials(y.partials[x]);for(x in w.subs)y.subs[x]=new Function("c","p","t","i",w.subs[x]);return y};function b(w){return w.replace(s,"\\\\").replace(r,'\\"').replace(i,"\\n").replace(n,"\\r").replace(a,"\\u2028").replace(o,"\\u2029")}function S(w){return~w.indexOf(".")?"d":"f"}function k(w,x){var y="<"+(x.prefix||""),C=y+w.n+_++;return x.partials[C]={name:w.n,partials:{}},x.code+='t.b(t.rp("'+b(C)+'",c,p,"'+(w.indent||"")+'"));',C}t.codegen={"#":function(w,x){x.code+="if(t.s(t."+S(w.n)+'("'+b(w.n)+'",c,p,1),c,p,0,'+w.i+","+w.end+',"'+w.otag+" "+w.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(w.nodes,x),x.code+="});c.pop();}"},"^":function(w,x){x.code+="if(!t.s(t."+S(w.n)+'("'+b(w.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(w.nodes,x),x.code+="};"},">":k,"<":function(w,x){var y={partials:{},code:"",subs:{},inPartial:!0};t.walk(w.nodes,y);var C=x.partials[k(w,x)];C.subs=y.subs,C.partials=y.partials},$:function(w,x){var y={subs:{},code:"",partials:x.partials,prefix:w.n};t.walk(w.nodes,y),x.subs[w.n]=y.code,x.inPartial||(x.code+='t.sub("'+b(w.n)+'",c,p,i);')},"\n":function(w,x){x.code+=A('"\\n"'+(w.last?"":" + i"))},_v:function(w,x){x.code+="t.b(t.v(t."+S(w.n)+'("'+b(w.n)+'",c,p,0)));'},_t:function(w,x){x.code+=A('"'+b(w.text)+'"')},"{":E,"&":E};function E(w,x){x.code+="t.b(t.t(t."+S(w.n)+'("'+b(w.n)+'",c,p,0)));'}function A(w){return"t.b("+w+");"}t.walk=function(w,x){for(var y,C=0,P=w.length;C<P;C++)y=t.codegen[w[C].tag],y&&y(w[C],x);return x},t.parse=function(w,x,y){return y=y||{},d(w,"",[],y.sectionTags||[])},t.cache={},t.cacheKey=function(w,x){return[w,!!x.asString,!!x.disableLambda,x.delimiters,!!x.modelGet].join("||")},t.compile=function(w,x){x=x||{};var y=t.cacheKey(w,x),C=this.cache[y];if(C){var P=C.partials;for(var L in P)delete P[L].instance;return C}return C=this.generate(this.parse(this.scan(w,x.delimiters),w,x),w,x),this.cache[y]=C}})(typeof Mw!="undefined"?Mw:Hogan)});var UP=H(Dw=>{m();var z5={};(function(t){t.Template=function(d,h,p,g){d=d||{},this.r=d.code||this.r,this.c=p,this.options=g||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,g){return this.ri([h],p||{},g)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],g=h[p.name];if(p.instance&&p.base==g)return p.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[d].base=g,p.subs){h.stackText||(h.stackText={});for(key in p.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);g=r(g,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=g,g},rp:function(d,h,p,g){var v=this.ep(d,p);return v?v.ri(h,p,g):""},rs:function(d,h,p){var g=d[d.length-1];if(!f(g)){p(d,h,this);return}for(var v=0;v<g.length;v++)d.push(g[v]),p(d,h,this),d.pop()},s:function(d,h,p,g,v,_,b){var S;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,p,g,v,_,b)),S=!!d,!g&&S&&h&&h.push(typeof d=="object"?d:h[h.length-1]),S)},d:function(d,h,p,g){var v,_=d.split("."),b=this.f(_[0],h,p,g),S=this.options.modelGet,k=null;if(d==="."&&f(h[h.length-2]))b=h[h.length-1];else for(var E=1;E<_.length;E++)v=e(_[E],b,S),v!==void 0?(k=b,b=v):b="";return g&&!b?!1:(!g&&typeof b=="function"&&(h.push(k),b=this.mv(b,h,p),h.pop()),b)},f:function(d,h,p,g){for(var v=!1,_=null,b=!1,S=this.options.modelGet,k=h.length-1;k>=0;k--)if(_=h[k],v=e(d,_,S),v!==void 0){b=!0;break}return b?(!g&&typeof v=="function"&&(v=this.mv(v,h,p)),v):g?!1:""},ls:function(d,h,p,g,v,_){var b=this.options.delimiters;return this.options.delimiters=_,this.b(this.ct(c(d.call(h,v,p)),h,g)),this.options.delimiters=b,!1},ct:functio Line truncated
PROMPT="$1"
TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT"
cleanup() {
rm -f "$TEMP_FILE" "$TEMP_FILE.response"
}
trap cleanup EXIT
echo "$PROMPT" > "$TEMP_FILE"
while [ ! -e "$TEMP_FILE.response" ]; do
if [ ! -e "$TEMP_FILE" ]; then
echo "Trigger file got removed: Abort" >&2
exit 1
fi
sleep 0.1
done
RESPONSE=$(cat "$TEMP_FILE.response")
echo "$RESPONSE"
`,Sk=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];m();m();m();var _n=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=b=>{if(b=this.postProcess(b,i),n){setTimeout(function(){n(b)},0);return}else return b},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,_=()=>{for(let b=Math.max(g,-c);b<=Math.min(v,c);b+=2){let S,k=h[b-1],E=h[b+1];k&&(h[b-1]=void 0);let A=!1;if(E){let x=E.oldPos-b;A=E&&0<=x&&x<o}let w=k&&k.oldPos+1<l;if(!A&&!w){h[b]=void 0;continue}if(!w||A&&k.oldPos<E.oldPos?S=this.addToPath(E,!0,!1,0,i):S=this.addToPath(k,!1,!0,1,i),p=this.extractCommon(S,r,e,b,i),S.oldPos+1>=l&&p+1>=o)return a(this.buildValues(S.lastComponent,r,e))||!0;h[b]=S,S.oldPos+1>=l&&(v=Math.min(v,b-1)),p+1>=o&&(g=Math.max(g,b+1))}c++};if(n)(function b(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);_()||b()},0)})();else for(;c<=u&&Date.now()<=d;){let b=_();if(b)return b}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1<a&&l+1<o&&this.equals(i[l+1],r[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,r,i){return i.comparator?i.comparator(e,r):e===r||!!i.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){let r=[];for(let i=0;i<e.length;i++)e[i]&&r.push(e[i]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,i){let n=[],s;for(;e;)n.push(e),s=e.previousComponent,delete e.previousComponent,e=s;n.reverse();let a=n.length,o=0,l=0,c=0;for(;o<a;o++){let u=n[o];if(u.removed)u.value=this.join(i.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=r.slice(l,l+u.count);f=f.map(function(d,h){let p=i[c+h];return p.length>d.length?p:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return n}};m();var Gg=class extends _n{},kk=new Gg;function jg(t,e,r){return kk.diff(t,e,r)}m();m();function Vg(t,e){let r;for(r=0;r<t.length&&r<e.length;r++)if(t[r]!=e[r])return t.slice(0,r);return t.slice(0,r)}function zg(t,e){let r;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(r=0;r<t.length&&r<e.length;r++)if(t[t.length-(r+1)]!=e[e.length-(r+1)])return t.slice(-r);return t.slice(-r)}function xd(t,e,r){if(t.slice(0,e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(e)}; this is Line truncated
`))&&(e=e.trim()),(!i.newlineIsToken||!r.includes(`
`))&&(r=r.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(e.endsWith(`
`)&&(e=e.slice(0,-1)),r.endsWith(`
`)&&(r=r.slice(0,-1))),super.equals(e,r,i)}},gB=new Kg;function Qg(t,e,r){return gB.diff(t,e,r)}function vB(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
`));let r=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let n=0;n<i.length;n++){let s=i[n];n%2&&!e.newlineIsToken?r[r.length-1]+=s:r.push(s)}return r}m();var Tk={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Jg(t,e,r,i,n,s,a){let o;a?typeof a=="function"?o={callback:a}:o=a:o={},typeof o.context=="undefined"&&(o.context=4);let l=o.context;if(o.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(o.callback){let{callback:u}=o;Qg(r,i,Object.assign(Object.assign({},o),{callback:f=>{let d=c(f);u(d)}}))}else return c(Qg(r,i,o));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(b){return b.map(function(S){return" "+S})}let d=[],h=0,p=0,g=[],v=1,_=1;for(let b=0;b<u.length;b++){let S=u[b],k=S.lines||wB(S.value);if(S.lines=k,S.added||S.removed){if(!h){let E=u[b-1];h=v,p=_,E&&(g=l>0?f(E.lines.slice(-l)):[],h-=g.length,p-=g.length)}for(let E of k)g.push((S.added?"+":"-")+E);S.added?_+=k.length:v+=k.length}else{if(h)if(k.length<=l*2&&b<u.length-2)for(let E of f(k))g.push(E);else{let E=Math.min(k.length,l);for(let w of f(k.slice(0,E)))g.push(w);let A={oldStart:h,oldLines:v-h+E,newStart:p,newLines:_-p+E,lines:g};d.push(A),h=0,p=0,g=[]}v+=k.length,_+=k.length}}for(let b of d)for(let S=0;S<b.lines.length;S++)b.lines[S].endsWith(`
`)?b.lines[S]=b.lines[S].slice(0,-1):(b.lines.splice(S+1,0,"\\ No newline at end of file"),S++);return{oldFileName:t,newFileName:e,oldHeader:n,newHeader:s,hunks:d}}}function Ad(t,e){if(e||(e=Tk),Array.isArray(t)){if(t.length>1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(i=>Ad(i,e)).join(`
`)}let r=[];e.includeIndex&&t.oldFileName==t.newFileName&&r.push("Index: "+t.oldFileName),e.includeUnderline&&r.push("==================================================================="),e.includeFileHeaders&&(r.push("--- "+t.oldFileName+(typeof t.oldHeader=="undefined"?"":" "+t.oldHeader)),r.push("+++ "+t.newFileName+(typeof t.newHeader=="undefined"?"":" "+t.newHeader)));for(let i=0;i<t.hunks.length;i++){let n=t.hunks[i];n.oldLines===0&&(n.oldStart-=1),n.newLines===0&&(n.newStart-=1),r.push("@@ -"+n.oldStart+","+n.oldLines+" +"+n.newStart+","+n.newLines+" @@");for(let s of n.lines)r.push(s)}return r.join(`
`)+`
`}function Pk(t,e,r,i,n,s,a){if(typeof a=="function"&&(a={callback:a}),a!=null&&a.callback){let{callback:o}=a;Jg(t,e,r,i,n,s,Object.assign(Object.assign({},a),{callback:l=>{o(l?Ad(l,a.headerOptions):void 0)}}))}else{let o=Jg(t,e,r,i,n,s,a);return o?Ad(o,a==null?void 0:a.headerOptions):void 0}}function ou(t,e,r,i,n,s){return Pk(t,t,e,r,i,n,s)}function wB(t){let e=t.endsWith(`
`),r=t.split(`
`).map(i=>i+`
`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var re=Ht(Bg(),1),xa=require("obsidian");m();function Rk(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var al=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};m();var $k=require("obsidian"),bB={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},et=class extends $k.SuggestModal{constructor(e,r){if(super(e.app),this.config={...bB,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let i=this.containerEl.querySelector(".prompt-input-container");i.addClass("git-obscure-prompt"),i.setAttr("git-is-obscured","true");let n=i==null?void 0:i.createDiv({cls:"search-input-clear-button"});n.style.marginRight="32px",n.id="git-show-password",n.addEventListener("click",()=>{i.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",i.setAttr("git-is-obscured","false")):(this.inputEl.type="password",i.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>window.setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,r){this.config.obscure?r.hide():r.setText(e)}onChooseSuggestion(e,r){if(this.resolve){let i;this.config.allowEmpty&&e===" "?i="":e==="..."?i=void 0:i=e,this.resolve(i)}}};m();var Zk=Ht(Xk(),1),Kk=require("child_process"),Kn=require("obsidian");function Td(t){throw new Error(`Unexpected object: ${t}`)}function cu(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var rv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function ji(t,e){let r;if(e){if(e.button===0||e.button===1){let i=Kn.Keymap.isModEvent(e);r=t.workspace.getLeaf(i)}}else r=t.workspace.getLeaf(!1);return r}function bn(t,e,r,i,n){if(e.button==2){let s=t.vault.getAbstractFileByPath(r);if(s!=null){let a=new Kn.Menu;t.workspace.trigger("file-menu",a,s,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}else{let a=new Kn.Menu;t.workspace.trigger("obsidian-git:menu",a,r,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}}}function Os(t){throw new Error("Impossible branch: "+t)}function iv(t){return`rgb(${t.r},${t.g},${t.b})`}function Qk(t){var s;let e=(s=Zk.fromString(t))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[r,i,n]=e;return{r,g:i,b:n}}function Jk(t){return t.diff(Kn.moment.unix(0),"seconds")}function eA(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function uu(t,e){return new Proxy(t,{get(r,i){return i==="length"?Math.min(e,r.length):r[i]}})}function tA(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function rA(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),i=t.substring(e,t.length);return r+i}function nv(t,e,r){return t<=e&&e<=r}function Qn(t){let[e,...r]=t.split("/");return[e,r.length===0?void 0:r.join("/")]}function yn(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function iA(t){return t===1?"1 minute":`${t} minutes`}function DB(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function ll(t){if(t.endsWith(".md"))return!1;let e=DB(t);return Sk.includes(e)}function sv(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function cl(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof Kn.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(i){return!0}}function nA({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function ul(t,e,r,i){let n=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:n,linktext:i})}function fu(t,e,r={}){return new Promise((i,n)=>{let s=(0,Kk.spawn)(t,e,r),a="",o="";s.stdout.on("data",l=>{a+=l.toString()}),s.stderr.on("data",l=>{o+=l.toString()}),s.on("error",l=>{i({error:new Error(l.message),stdout:a,stderr:a,code:1})}),s.on("close",l=>{i({stdout:a,stderr:o,code:l!=null?l:1,error:void 0})})})}m();var sA=require("os"),Pd=require("obsidian"),fl=class{constructor(e){this.plugin=e,this.app=e.app}getRelativeVaultPath(e){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,r=!0){return r&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}unload(){}_getTreeStructure(e,r=0){let i=[];for(e=[...e];e.length>0;){let n=e.first(),s=n.path.substring(r);if(s.contains("/")){let a=s.substring(0,s.indexOf("/")) Line truncated
`):n="Too many files to list",e=e+`
Affected files:
`+n}return e}};m();var Ls=require("obsidian"),Rd=class{constructor(e,r){this.plugin=r;this.promises={};this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(e,r){var i;if(this.maybeLog("Read: "+e+JSON.stringify(r)),r=="utf8"||r.encoding=="utf8"){let n=this.vault.getAbstractFileByPath(e);return n instanceof Ls.TFile?(this.maybeLog("Reuse"),this.vault.read(n)):this.adapter.read(e)}else{if(e.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(i=this.index)!=null?i:this.adapter.readBinary(e);let n=this.vault.getAbstractFileByPath(e);return n instanceof Ls.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(n)):this.adapter.readBinary(e)}}async writeFile(e,r){if(this.maybeLog("Write: "+e),typeof r=="string"){let i=this.vault.getAbstractFileByPath(e);return i instanceof Ls.TFile?this.vault.modify(i,r):this.adapter.write(e,r)}else if(e.endsWith(this.gitDir+"/index"))this.index=r,this.indexmtime=Date.now();else{let i=this.vault.getAbstractFileByPath(e);return i instanceof Ls.TFile?this.vault.modifyBinary(i,r):this.adapter.writeBinary(e,r)}}async readdir(e){e==="."&&(e="/");let r=await this.adapter.list(e),i=[...r.files,...r.folders],n;return e!=="/"?n=i.map(s=>(0,Ls.normalizePath)(s.substring(e.length))):n=i,n}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,r){var i,n;return this.adapter.rmdir(e,(n=(i=r==null?void 0:r.options)==null?void 0:i.recursive)!=null?n:!1)}async stat(e){if(e.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let i=await this.adapter.stat(e);if(i==null)throw{code:"ENOENT"};return this.indexctime=i.ctime,this.indexmtime=i.mtime,{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof Ls.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let i=await this.adapter.stat(e);if(i)return{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:i.type==="folder"?"directory":i.type,isFile:()=>i.type==="file",isDirectory:()=>i.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};var fA=Ht(uA(),1),Vi=class extends fl{constructor(r){super(r);this.FILE=0;this.HEAD=1;this.WORKDIR=2;this.STAGE=3;this.status_mapping={"000":" ","003":"AD","020":"??","022":"A ","023":"AM",100:"D ",101:" D",103:"MD",110:"DA",111:" ",113:"MM",120:"DA",121:" M",122:"M ",123:"MM"};this.noticeLength=999999;this.fs=new Rd(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var r,i;return{username:(r=this.plugin.localStorage.getUsername())!=null?r:void 0,password:(i=this.plugin.localStorage.getPassword())!=null?i:void 0}},onAuthFailure:async()=>{new xa.Notice("Authentication failed. Please try with different credentials");let r=await new et(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let i=await new et(this.plugin,{placeholder:"Specify your password/personal access token",obscure:!0}).openAndGetResult();if(i)return this.plugin.localStorage.setUsername(r),this.plugin.localStorage.setPassword(i),{username:r,password:i}}return{cancel:!0}},http:{async request({url:r,method:i,headers:n,body:s}){let a;s&&(a=await BB(s));let o=await(0,xa.requestUrl)({url:r,method:i,headers:n,body:a,throw:!1});return{url:r,method:i,headers:o.headers,body:NB(o.arrayBuffer),statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(r){try{let i=await Line truncated
`);return{message:l[0],author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(`
`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(c=>({path:c.path,status:c.type,vaultPath:this.getRelativeVaultPath(c.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}async updateUpstreamBranch(r){let[i,n]=Qn(r),s=await this.branchInfo();await this.wrapFS(re.default.push({...this.getRepo(),remote:i,remoteRef:n})),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${n}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,i){return this.walkDifference({walkers:[re.default.TREE({ref:r}),re.default.TREE({ref:i})]})}async walkDifference({walkers:r,dir:i}){return await this.wrapFS(re.default.walk({...this.getRepo(),trees:r,map:async function(s,[a,o]){if(!rv(s,i))return null;if(await(a==null?void 0:a.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(a==null?void 0:a.oid()),c=await(o==null?void 0:o.oid()),u="equal";if(l!==c&&(u="M"),l===void 0&&(u="A"),c===void 0&&(u="D"),l===void 0&&c===void 0&&(console.log("Something weird happened:"),console.log(a),console.log(o)),u!=="equal")return{path:s,type:u}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[re.default.TREE({ref:"HEAD"}),re.default.STAGE()],dir:r})).map(n=>({vaultPath:this.getRelativeVaultPath(n.path),path:n.path}))}async getUnstagedFiles(r="."){let i,n=window.setTimeout(()=>{i=new xa.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),a=await this.wrapFS(re.default.walk({...s,trees:[re.default.WORKDIR(),re.default.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await re.default.isIgnored({...s,filepath:o})||!rv(o,r))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),d=[u,f].includes("blob");if((u==="tree"||u==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?h?p!==h?{path:o,type:"M"}:null:{path:o,type:"A"}:{path:o,type:"D"}}}));return window.clearTimeout(n),i==null||i.hide(),a}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async getDiffString(r,i=!1,n){let s=this.getRelativeVaultPath(r),a=async(c,[u])=>{if(r==c){let f=await u.oid();return(await re.default.readBlob({...this.getRepo(),oid:f})).blob}};if(n){let c=await(0,re.readBlob)({...this.getRepo(),filepath:r,oid:n}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof re.default.Errors.NotFoundError))throw h}),u=await re.default.readCommit({...this.getRepo(),oid:n}),f=await(0,re.readBlob)({...this.getRepo(),filepath:r,oid:u.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof re.default.Errors.NotFoundError))throw h});return ou(s,f!=null?f:"",c!=null?c:"")}let o=(await re.default.walk({...this.getRepo(),trees:[re.default.STAGE()],map:a})).first(),l=new TextDecoder().decode(o);if(i){let c=await this.resolveRef("HEAD").then(f=>(0,re.readBlob)({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof re.default.Errors.NotFoundError))throw f});return ou(s,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(s)?c=await this.app.vault.adapter.read(s):c="",ou(s,l,c)}}async getLastCommitTime(){let r=this.getRepo(),i=await this.resolveRef("HEAD"),s=(await re.default.readCommit({...r,oid:i})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(r){let i=this.status_mapping[`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`];return{index:i[0]=="?"?"U":i[0],workingDir:i[1]=="?"?"U":i[1],path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),i=await this.getConfig("user.email");if(!r||!i)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,i=!0){if(!this.plugin.settings.disablePopups)return new xa.Notice(r,i?this.noticeLength:void 0)}};async function*NB(t){yield new Uint8Array(t)}async function BB(t){let e=new ReadableStream({async start(i){for await(let n of t)i.enqueue(n);i.close()}});return await new Response(e).arrayBuffer()}m();var o2=Ht(Id(),1),ei=Ht(require("fs/promises"),1),Jn=require("obsidian"),ze=Ht(require("path"),1),yu=require("path");m();var jd=Ht(vA(),1);m();var ov=new WeakMap;function gl(...t){let e=new String(t);return ov.set(e,t),e}function yi(t){return t instanceof String&&ov.has(t)}function vl(t){var e;return(e=ov.get(t))!=null?e:[]}var Ud=Ht(Id(),1),qC=require("child_process");var $T=Ht(cv(),1),GT=require("node:path");m();function*wA(t,e){let r=e==="global";for(let i of t)i.isGlobal===r&&(yield i)}var nH=new Set(["--add","--edit","--remove-section","--rename-section","--replace-all","--unset","--unset-all","-e"]),sH=new Set(["--get","--get-all" Line truncated
`){return t.split(r).reduce((i,n)=>{let s=e?n.trim():n;return s&&i.push(s),i},[])}function Fv(t,e){return vu(t,!0).map(r=>e(r))}function Iv(t){return(0,jd.exists)(t,jd.FOLDER)}function Si(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function cC(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function Vd(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function xn(t){return Array.isArray(t)?t:[t]}function uC(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function El(t){return xn(t).map(e=>e instanceof String?e:String(e))}function Xe(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function pu(t,e){let r=[];for(let i=0,n=t.length;i<n;i++)r.push(e,t[i]);return r}function mu(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}function fC(t,e){let r={};return e.forEach(i=>{t[i]!==void 0&&(r[i]=t[i])}),r}function gv(t=0){return new Promise(e=>setTimeout(e,t))}function vv(t){if(t!==!1)return t}var bl,Ta,wu,zd=q({"src/lib/utils/util.ts"(){"use strict";Mv(),bl="\0",Ta=()=>{},wu=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ar(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function wv(t,e){let r=yi(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function Wd(t){return!!t&&wu(t)==="[object Object]"}function dC(t){return typeof t=="function"}var _u,hC,pt,Bd,qd,Mv=q({"src/lib/utils/argument-filters.ts"(){"use strict";zd(),_u=t=>Array.isArray(t),hC=t=>typeof t=="number",pt=t=>typeof t=="string"||yi(t),Bd=t=>pt(t)||Array.isArray(t)&&t.every(pt),qd=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),_v,NH=q({"src/lib/utils/exit-codes.ts"(){"use strict";_v=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(_v||{})}}),Hd,BH=q({"src/lib/utils/git-output-streams.ts"(){"use strict";Hd=class pC{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new pC(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function HH(){throw new Error("LineParser:useMatches not implemented")}var ve,Ns,UH=q({"src/lib/utils/line-parser.ts"(){"use strict";ve=class{constructor(t,e){this.matches=[],this.useMatches=HH,this.parse=(r,i)=>(this.resetMatches(),this._regExp.every((n,s)=>this.addMatch(n,s,r(s)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let i=r&&t.exec(r);return i&&this.pushMatch(e,i),!!i}pushMatch(t,e){this.matches.push(...e.slice(1))}},Ns=class extends ve{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function mC(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...gC},...t.filter(i=>typeof i=="object"&&i));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var gC,GH=q({"src/lib/utils/simple-git-options.ts"(){"use strict";gC={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Dv(t,e=[]){return Wd(t)?Object.keys(t).reduce((r,i)=>{let n=t[i];if(yi(n))r.push(n);else if(wv(n,["boolean"]))r.push(i+"="+n);else if(Array.isArray(n))for(let s of n)wv(s,["string","number"])||r.push(i+"="+s);else r.push(i);return r},e):e}function Er(t,e=0,r=!1){let i=[];for(let n=0,s=e<0?t.length:e;n<s;n++)"string|number".includes(typeof t[n])&&i.push(String(t[n]));return Dv(Ov(t),i),r||i.push(...jH(t)),i}function jH(t){let e=typeof Ca(t)=="function";return El(ar(Ca(t,e?1:0),_u,[]))}function Ov(t){let e=dC(Ca(t));return ar(Ca(t,e?1:0),Wd)}function it(t,e=!0){let r=nC(Ca(t));return e||sC(r)?r:void 0}var VH=q({"src/lib/utils/task-options.ts"(){"use strict";Mv(),zd()}});function bv(t,e){return t(e.stdOut,e.stdErr)}function Br(t,e,r,i=!0){return xn(r).forEach(n=>{for(let s=vu(n,i),a=0,o=s.length;a<o;a++){let l=(c=0)=>{if(!(a+c>=o))return s[a+c]};e.some(({parse:c})=>c(l,t))}}),t}var zH=q({"src/lib/utils/task-parser.ts"(){"use strict";zd()}}),vC={};xt(vC,{ExitCodes:()=>_v,GitOutputStreams:()=>Hd,LineParser:()=>ve,NOOP:()=>Ta,NULL:()=>bl,RemoteLineParser:()=>Ns,append:()=>Si,appendTaskOptions:()=>Dv,asArray:()=>xn,asCamelCase:()=>uC,asFunction:()=>nC,asNumber:()=>Xe,asStringArray:()=>El,bufferToString:()=>mu,callTaskParser:()=>bv,createInstanceConfig:()=>mC,delay:()=>gv,filterArray:()=>_u,filterFunction:()=>dC,filterHasLength:()=>qd,filterNumber:()=>hC,filterPlainObject:()=>Wd,filterPrimitives:()=>wv,filterString:()=>pt,filterStringOrStringArray:()=>Bd,filterType:()=>ar,first:()=>oC,folderExists:()=>Iv,forEachLineWithContent:()=>Fv,getTrailingOptions:()=>Er,including:()=>cC,isUserFunction:()=>sC,last:()=>Ca,objectToString:()=>wu,orVoid:()=>vv,parseStringResponse:()=>Br,pick:()=>fC,prefixedArray:()=>pu,remove:()=>Vd,splitOn:()=>aC,toLinesWithContent:()=>vu,trailingFunctionArgument:()=>it,trailingOptionsArg Line truncated
`)){let l=aC(a,`
`);o=l[0],a=l[1]}yield{file:s,key:o,value:a}}}var MC,s3=q({"src/lib/responses/ConfigList.ts"(){"use strict";fe(),MC=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((t,e)=>Object.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=Ca(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let i=this.addFile(t);Object.hasOwn(i,e)?Array.isArray(i[e])?i[e].push(r):i[e]=[i[e],r]:i[e]=r,this._all=void 0}}}});function uv(t,e){return typeof t=="string"&&Object.hasOwn(Ev,t)?t:e}function a3(t,e,r,i){let n=["config",`--${i}`];return r&&n.push("--add"),n.push(t,e),{commands:n,format:"utf-8",parser(s){return s}}}function o3(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(i){return i3(i,t)}}}function l3(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return r3(r)}}}function c3(){return{addConfig(t,e,...r){return this._runTask(a3(t,e,r[0]===!0,uv(r[1],"local")),it(arguments))},getConfig(t,e){return this._runTask(o3(t,uv(e,void 0)),it(arguments))},listConfig(...t){return this._runTask(l3(uv(t[0],void 0)),it(arguments))}}}var Ev,DC=q({"src/lib/tasks/config.ts"(){"use strict";s3(),fe(),Ev=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Ev||{})}});function u3(t){return OC.has(t)}var fv,OC,LC=q({"src/lib/tasks/diff-name-status.ts"(){"use strict";fv=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(fv||{}),OC=new Set(Object.values(fv))}});function f3(...t){return new BC().param(...t)}function d3(t){let e=new Set,r={};return Fv(t,i=>{let[n,s,a]=i.split(bl);e.add(n),(r[n]=r[n]||[]).push({line:Xe(s),path:n,preview:a})}),{paths:e,results:r}}function h3(){return{grep(t){let e=it(arguments),r=Er(arguments);for(let n of NC)if(r.includes(n))return this._runTask(Lr(`git.grep: use of "${n}" is not supported.`),e);typeof t=="string"&&(t=f3().param(t));let i=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:i,format:"utf-8",parser(n){return d3(n)}},e)}}}var NC,hu,kA,BC,HC=q({"src/lib/tasks/grep.ts"(){"use strict";fe(),_t(),NC=["-h"],hu=Symbol("grepQuery"),BC=class{constructor(){this[kA]=[]}*[(kA=hu,Symbol.iterator)](){for(let t of this[hu])yield t}and(...t){return t.length&&this[hu].push("--and","(",...pu(t,"-e"),")"),this}param(...t){return this[hu].push(...pu(t,"-e")),this}}}}),UC={};xt(UC,{ResetMode:()=>Od,getResetMode:()=>m3,resetTask:()=>p3});function p3(t,e){let r=["reset"];return GC(t)&&r.push(`--${t}`),r.push(...e),Sr(r)}function m3(t){if(GC(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function GC(t){return typeof t=="string"&&jC.includes(t)}var Od,jC,VC=q({"src/lib/tasks/reset.ts"(){"use strict";fe(),_t(),Od=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Od||{}),jC=El(Object.values(Od))}});function g3(){return(0,Ud.default)("simple-git")}function AA(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(i,...n)=>{t(i,...n),r(i,...n)}:t:(i,...n)=>{t(`%s ${i}`,e,...n),r&&r(i,...n)}}function v3(t,e,{namespace:r}){if(typeof t=="string")return t;let i=e&&e.namespace||"";return i.startsWith(r)?i.substr(r.length+1):i||r}function Gv(t,e,r,i=g3()){let n=t&&`[${t}]`||"",s=[],a=typeof e=="string"?i.extend(e):e,o=v3(ar(e,pt),a,i);return c(r);function l(u,f){return Si(s,Gv(t,o.replace(/^[^:]+/,u),f,i))}function c(u){let f=u&&`[${u}]`||"",d=a&&AA(a,f)||Ta,h=AA(i,`${n} ${f}`,d);return Object.assign(a?d:h,{label:t,sibling:l,info:h,step:c})}}var zC=q({"src/lib/git-logger.ts"(){"use strict";fe(),Ud.default.formatters.L=t=>String(qd(t)?t.length:"-"),Ud.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):wu(t)}}),WC,w3=q({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Bs(),zC(),WC=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let i=t.getName(r.commands[0]),n=Gv(this.logLabel,i);return{task:r,logger:n,name:i}}push(r){let i=this.createProgress(r);return i.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,i),i}fatal(r){for(let[i,{logger:n}]of Array.from(this._queue.entries()))i===r.task?(n.info("Failed %o",r),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(i);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(r){this.withProgress(r)&&this._queue.delete(r)}attempt(r){let i=this.withProgress(r);if(!i)throw new Nr(void 0,"TasksPendingQueue: attempt called for an unknown task");return i.lo Line truncated
`).map(h6).filter(Boolean);e||r.sort(function(n,s){let a=n.split("."),o=s.split(".");if(a.length===1||o.length===1)return d6(Dd(a[0]),Dd(o[0]));for(let l=0,c=Math.max(a.length,o.length);l<c;l++){let u=e2(Dd(a[l]),Dd(o[l]));if(u)return u}return 0});let i=e?r[0]:[...r].reverse().find(n=>n.indexOf(".")>=0);return new KA(r,i)}}}),r2={};xt(r2,{addAnnotatedTagTask:()=>v6,addTagTask:()=>g6,tagListTask:()=>m6});function m6(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return t2(r,e)}}}function g6(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function v6(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var w6=q({"src/lib/tasks/tag.ts"(){"use strict";p6()}}),_6=OH({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(y3(),wt(YC)),{SimpleGitApi:i}=(y8(),wt(PT)),{Scheduler:n}=(x8(),wt(RT)),{adhocExecTask:s,configurationErrorTask:a}=(_t(),wt(xv)),{asArray:o,filterArray:l,filterPrimitives:c,filterString:u,filterStringOrStringArray:f,filterType:d,getTrailingOptions:h,trailingFunctionArgument:p,trailingOptionsArgument:g}=(fe(),wt(vC)),{applyPatchTask:v}=(S8(),wt(IT)),{branchTask:_,branchLocalTask:b,deleteBranchesTask:S,deleteBranchTask:k}=(D8(),wt(HT)),{checkIgnoreTask:E}=(B8(),wt(VT)),{checkIsRepoTask:A}=(yC(),wt(wC)),{cleanWithOptionsTask:w,isCleanOptionsArray:x}=(FC(),wt(RC)),{diffSummaryTask:y}=(Xv(),wt(oT)),{fetchTask:C}=(V8(),wt(WT)),{moveTask:P}=(Y8(),wt(YT)),{pullTask:L}=(Z8(),wt(XT)),{pushTagsTask:N}=(xT(),wt(yT)),{addRemoteTask:B,getRemotesTask:ge,listRemotesTask:Le,remoteTask:ke,removeRemoteTask:ne}=(s6(),wt(KT)),{getResetMode:Ee,resetTask:_e}=(VC(),wt(UC)),{stashListTask:z}=(o6(),wt(QT)),{addSubModuleTask:X,initSubModuleTask:V,subModuleTask:Ne,updateSubModuleTask:gr}=(f6(),wt(JT)),{addAnnotatedTagTask:Nt,addTagTask:Fe,tagListTask:Pt}=(w6(),wt(r2)),{straightThroughBufferTask:Rt,straightThroughStringTask:Ye}=(_t(),wt(xv));function J(D,M){this._plugins=M,this._executor=new r(D.baseDir,new n(D.maxConcurrentProcesses),M),this._trimmed=D.trimmed}(J.prototype=Object.create(i.prototype)).constructor=J,J.prototype.customBinary=function(D){return this._plugins.reconfigure("binary",D),this},J.prototype.env=function(D,M){return arguments.length===1&&typeof D=="object"?this._executor.env=D:(this._executor.env=this._executor.env||{})[D]=M,this},J.prototype.stashList=function(D){return this._runTask(z(g(arguments)||{},l(D)&&D||[]),p(arguments))},J.prototype.mv=function(D,M){return this._runTask(P(D,M),p(arguments))},J.prototype.checkoutLatestTag=function(D){var M=this;return this.pull(function(){M.tags(function(ae,Te){M.checkout(Te.latest,D)})})},J.prototype.pull=function(D,M,ae,Te){return this._runTask(L(d(D,u),d(M,u),h(arguments)),p(arguments))},J.prototype.fetch=function(D,M){return this._runTask(C(d(D,u),d(M,u),h(arguments)),p(arguments))},J.prototype.silent=function(D){return this._runTask(s(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},J.prototype.tags=function(D,M){return this._runTask(Pt(h(arguments)),p(arguments))},J.prototype.rebase=function(){return this._runTask(Ye(["rebase",...h(arguments)]),p(arguments))},J.prototype.reset=function(D){return this._runTask(_e(Ee(D),h(arguments)),p(arguments))},J.prototype.revert=function(D){let M=p(arguments);return typeof D!="string"?this._runTask(a("Commit must be a string"),M):this._runTask(Ye(["revert",...h(arguments,0,!0),D]),M)},J.prototype.addTag=function(D){let M=typeof D=="string"?Fe(D):a("Git.addTag requires a tag name");return this._runTask(M,p(arguments))},J.prototype.addAnnotatedTag=function(D,M){return this._runTask(Nt(D,M),p(arguments))},J.prototype.deleteLocalBranch=function(D,M,ae){return this._runTask(k(D,typeof M=="boolean"?M:!1),p(arguments))},J.prototype.deleteLocalBranches=function(D,M,ae){return this._runTask(S(D,typeof M=="boolean"?M:!1),p(arguments))},J.prototype.branch=function(D,M){return this._runTask(_(h(arguments)),p(arguments))},J.prototype.branchLocal=function(D){return this._runTask(b(),p(arguments))},J.prototype.raw=function(D){let M=!Array.isArray(D),ae=[].slice.call(M?arguments:D,0);for(let Bt=0;Bt<ae.length&&M;Bt++)if(!c(ae[Bt])){ae.splice(Bt,ae.length-Bt);break}ae.push(...h(arguments,0,!0));var Te=p(arguments);return ae.length?this._runTask(Ye(ae,this._trimmed),Te):this._runTask(a("Raw: must supply one or more command to execute"),Te)},J.prototype.submoduleAdd=function(D,M,ae){return this._runTask(X(D,M),p(arguments))},J.prototype.submoduleUpdate=function(D,M){return this._runTask(gr(h(arguments,!0)),p(arguments))},J.prototype.submoduleInit=function(D,M){return this._runTask(V(h(arguments,!0)),p(arguments))},J.prototype.subModule=function(D,M){return this._runTask(Ne(h(arguments)),p(arguments))},J.prototype.listRemote=function(){return this._runTask(Le(h(arguments)),p(arguments))},J.prototype.addRe Line truncated
`).some(l=>l.contains(n))||await ei.appendFile(r,n+`
`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=await this.git.status(i!=null?["--",i]:[]);this.plugin.setPluginState({gitAction:0});let s=n.files.map(a=>{let o=this.formatPath(a);return{path:o.path,from:o.from,index:a.index==="?"?"U":a.index,workingDir:a.working_dir==="?"?"U":a.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:s,changed:s.filter(a=>a.workingDir!==" "),staged:s.filter(a=>a.index!==" "&&a.index!="U"),conflicted:n.conflicted.map(a=>this.formatPath({path:a}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let i=this.getRelativeRepoPath(r),s=["-C",ze.dirname(i),"rev-parse","HEAD"],a=this.git.raw(s);return a.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await a).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((i,n,s,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");n.on("data",c=>{o+=c.toString("utf8")}),n.on("end",()=>{let u=o.split(`
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+yu.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},i=>this.plugin.displayError(i))})}formatPath(r){function i(n){if(n!=null)return n.startsWith('"')&&n.endsWith('"')?n.substring(1,n.length-1):n}return r.from!=null?{from:i(r.from),path:i(r.path)}:{path:i(r.path)}}async blame(r,i,n){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let s=await this.getSubmoduleOfFile(r),a=s?["-C",s.submodule]:[],o=s?s.relativeFilepath:r;a.push("blame","--porcelain"),n&&a.push("-w");let l=`-C${_d}`;switch(i){case"inactive":break;case"same-commit":a.push("-C",l);break;case"all-commits":a.push("-C","-C",l);break;default:Os(i)}a.push("--",o);let c=await this.git.raw(a);return B6(c)}async isTracked(r){let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("ls-files","--",s),this.git.raw(n).then(a=>a.trim()!=="")}async commitAll({message:r}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let n=await this.getSubmodulePaths();for(let s of n)await this.git.cwd({path:s,root:!1}).add("-A"),await this.git.cwd({path:s,root:!1}).commit(await this.formatCommitMessage(r))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let i=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),i.summary.changes}async commit({message:r,amend:i}){this.plugin.setPluginState({gitAction:4});let n=(await this.git.commit(await this.formatCommitMessage(r),i?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),n}async stage(r,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.git.add(["--",r]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.add(r!=null?r:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(r!=null?["--",r]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(r,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.git.reset(["--",r]),this.plugin.setPluginState({gitAction:0})}async discard(r){this.plugin.setPluginState({gitAction:3}),await this.isTracked(r)&&await this.git.checkout(["--",r]),this.plugin.setPluginState({gitAction:0})}async applyPatch(r){let i=ze.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(i,r),await this.git.applyPatch(i,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(i)}async getUntrackedPaths(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=[];i!=null&&n.push("--",i);let s=await this.git.clean(Aa.RECURSIVE+Aa.DRY_RUN,n);return this.plugin.setPluginState({gitAction:0}),s.paths}async hashObject(r){r=this.getRelativeRepoPath(r);let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("hash-object","--",s),this.git.raw(n)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo(),i=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let n=await this.git.revparse([r.tracking]);if(i!==n){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,n]),await this.unstageAll({})}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`)}this.app.workspace.trigger("obsidian-git:head-change");let s=await this.git.revparse([r.current]);return(await this.git.diff([`${i}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let a=aw Line truncated
`):[]}async removeRemote(r){await this.git.removeRemote(r)}async updateUpstreamBranch(r){try{await this.git.branch(["--set-upstream-to",r])}catch(i){try{await this.git.branch(["--set-upstream",r])}catch(n){let[s,a]=Qn(r),o=await this.branchInfo();await this.git.push(["--set-upstream",s,`${o.current}:${a}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,i=!1,n){return i?await this.git.diff(["--cached","--",r]):n?await this.git.show([`${n}`,"--",r]):await this.git.diff(["--",r])}async diff(r,i,n){return await this.git.diff([`${i}..${n}`,"--",r])}async rawCommand(r){let i=r.split(" ");return await this.git.raw(i[0],...i.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(ze.dirname(r)))return;let i=await this.git.raw(["-C",ze.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(i=i.trim(),(await this.git.raw(["-C",ze.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(ze.normalize(r)),o=ze.relative(i,a);return{submodule:i,relativeFilepath:o}}async getLastCommitTime(){try{let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}catch(r){if(r instanceof Nr){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),i=await fu(r||"git",["--version"],{});if(i.error)if(Jn.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${bd}) of Git for Windows.`);let n=await fu(bd,["--version"]);if(n.error)return console.error(n.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(i.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof Nr){let i=String(r.message);if(i.contains("Could not resolve host")||i.contains("Unable to resolve host")||i.contains("Unable to open connection")||i.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||i.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||i.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new al(i)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(i){let n=i instanceof Error?i.message:String(i);return this.plugin.displayError(`Error checking LFS status: ${n}`),!1}}},l2={hash:"000000",isZeroCommit:!0,summary:""};function B6(t){let r=t.replace(`\r
`,`
`).split(`
`),i={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},n=1;for(let s=0;s<r.length;){if(s2(r[s])){let a=r[s].split(" "),o=H6(a,n,i);for(s++;s2(r[s]);s++){let l=r[s].split(" ");U6(l,i,n)}G6(i.commits.get(o)),n+=1}else if(!(r[s]===""&&s===r.length-1))throw Error(`Expected non-whitespace line or EOF, but found: ${r[s]}`);s++}return i}function H6(t,e,r){let i=t[0];if(r.hashPerLine.push(i),r.originalFileLineNrPerLine.push(parseInt(t[1])),r.finalFileLineNrPerLine.push(parseInt(t[2])),t.length>=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return i}function U6(t,e,r){let i=t[0],n=t.slice(1).join(" "),s=e.hashPerLine[r],a=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(i){case"summary":a.summary=n;break;case"author":a.author.name=n;break;case"author-mail":a.author.email=a2(n);break;case"author-time":a.author.epochSeconds=parseInt(n);break;case"author-tz":a.author.tz=n;break;case"committer":a.committer.name=n;break;case"committer-mail":a.committer.email=a2(n);break;case"committer-time":a.committer.epochSeconds=parseInt(n);break;case"committer-tz":a.committer.tz=n;break;case"previous":a.previous.commitHash=n;break;case"filename":a.previous.filename=n;break}e.commits.set(s,a)}function G6(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);Jv(t.author)&&(t.author=void 0),Jv(t.committer)&&(t.committer=void 0),Jv(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function Jv(t){return!t||Object.keys(t).length===0}function s2(t){return t.length>0&&t[0].trim()===t[0]}function a2(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}m();var M2=require("@codemirror/state");m();var ew=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},es=new ew;m();var Jd=require("@codemirror/state"),c2=Ht(tw(),1);function u2(t,e,r){if(!(t===void 0||e===void 0||r===void 0))return`head${t}-obj${e}-path${r}`}var f2=Jd.StateEffect.define();function d2(t,e,r){return r.update({effects:f2.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var Sl=Jd.StateField.define({create:t=>{},update:(t,e)=>{for(let r of e.effects)if(r.is(f2))return r.value;return j6(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function eh(t){var s;let e=c2.sha256.create();if(!t)return e;let{la:r,key:i,lineOffsetsFromUnsavedChanges:n}=t;e.update(r==="untracked"?"t":"f"),e.update(i);for(let[a,o]of(s=n.entries())!=null?s:[])e.update([a,o]);return e}var xu={get:void 0,save:void 0};function h2(t,e){xu.get=t,xu.save=e}function th(t){var e,r;return(r=(e=Eu(t.coloringMaxAge))==null?void 0:e.asDays())!=null?r:Eu(ht.lineAuthor.coloringMaxAge).asDays()}function j6(t,e){if(e)return t.changes.empty||t.changes.iterChanges((r,i,n,s)=>{var p;let a=t.startState.doc,{newDoc:o}=t,l=a.lineAt(r).number,c=a.lineAt(i).number,u=o.lineAt(n).number,f=o.lineAt(s).number,d=c-l+1,h=f-u+1;for(let g=u;g<=f;g++){let v=(p=e.lineOffsetsFromUnsavedChanges.get(g))!=null?p:0,_=f===g,b=h-d;_&&(v+=b),e.lineOffsetsFromUnsavedChanges.set(g,v)}}),e}m();function p2(){kl=void 0,rw=[],rh=0,nh.clear(),sh.clear(),Al.clear()}var kl,ih=()=>kl;function m2(t,e){var n;let r=e.length;if(r<((n=kl==null?void 0:kl.length)!=null?n:0))return;kl={gutter:t,length:r,text:e};let i=jt.plugin.localStorage.getGutterSpacingFallbackLength();r!==i&&jt.plugin.localStorage.setGutterSpacingFallbackLength(r)}var rw=[],V6=15,rh=0;function g2(t){rw[rh]=t,rh=(rh+1)%V6}function v2(){return eA(rw)}var nh=new Map,sh=new Map,Al=new Set;m();var $2=require("@codemirror/state"),F2=require("@codemirror/view");m();var aw=require("@codemirror/view"),A2=Ht(tw(),1),Cl=require("obsidian");m();m();var ah={x:-10,y:-10};function w2(){ah.x===-10&&window.addEventListener("mousedown",t=>{ah.x=t.clientX,ah.y=t.clientY})}function _2(){for(let t of Al)if(z6(t,ah))return t}function z6(t,e){let{x:r,y:i,width:n,height:s}=t.getBoundingClientRect();return r<=e.x&&e.x<=r+n&&i<=e.y&&e.y<=i+s}var b2="data-commit";function y2(t,e,r){if(e.hasFocus())return;let i=_2();if(!i)return;let n=q6(i);n&&(!n.isZeroCommit&&!n.isWaitingGutter&&W6(n,t),iw("showCommitHash",t),iw("authorDisplay",t),iw("dateTimeFormatOptions",t))}function W6(t,e){e.addItem(r=>r.setTitle("Copy commit hash").setIcon(" Line truncated
If turned on, do auto ${n} every ${iA(i.settings.autoSaveInterval)} after stopping file edits.
This also prevents auto ${n} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(f=>f.setValue(i.settings.autoBackupAfterFileChange).onChange(async d=>{i.settings.autoBackupAfterFileChange=d,this.refreshDisplayWithDelay(),await i.saveSettings(),i.automaticsManager.reload("commit")})),this.mayDisableSetting(a,i.settings.setLastSaveToLastCommit),a=new U.Setting(r).setName(`Auto ${n} after latest commit`).setDesc(`If turned on, sets last auto ${n} timestamp to the latest commit timestamp. This reduces the frequency of auto ${n} when doing manual commits.`).addToggle(f=>f.setValue(i.settings.setLastSaveToLastCommit).onChange(async d=>{i.settings.setLastSaveToLastCommit=d,await i.saveSettings(),i.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(a,i.settings.autoBackupAfterFileChange),a=new U.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPushInterval"}),f.setPlaceholder(String(ht.autoPushInterval)),f.onChange(async d=>{d!==""?i.settings.autoPushInterval=Number(d):i.settings.autoPushInterval=ht.autoPushInterval,await i.saveSettings(),i.automaticsManager.reload("push")})}),this.mayDisableSetting(a,!i.settings.differentIntervalCommitAndPush),new U.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPullInterval"}),f.setPlaceholder(String(ht.autoPullInterval)),f.onChange(async d=>{d!==""?i.settings.autoPullInterval=Number(d):i.settings.autoPullInterval=ht.autoPullInterval,await i.saveSettings(),i.automaticsManager.reload("pull")})}),new U.Setting(r).setName(`Auto ${n} only staged files`).setDesc(`If turned on, only staged files are committed on ${n}. If turned off, all changed files are committed.`).addToggle(f=>f.setValue(i.settings.autoCommitOnlyStaged).onChange(async d=>{i.settings.autoCommitOnlyStaged=d,await i.saveSettings()})),new U.Setting(r).setName(`Specify custom commit message on auto ${n}`).setDesc("You will get a pop up to specify your message.").addToggle(f=>f.setValue(i.settings.customMessageOnAutoBackup).onChange(async d=>{i.settings.customMessageOnAutoBackup=d,await i.saveSettings(),this.refreshDisplayWithDelay()})),a=new U.Setting(r).setName(`Commit message on auto ${n}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(f=>{f.setPlaceholder(ht.autoCommitMessage).onChange(async d=>{d===""?i.settings.autoCommitMessage=ht.autoCommitMessage:i.settings.autoCommitMessage=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(a,i.settings.customMessageOnAutoBackup),new U.Setting(r).setName("Commit message").setHeading();let c=new U.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message). Leave empty to require manual input on each commit.");c.addTextArea(f=>{c.addButton(d=>{d.setIcon("reset").setTooltip(`Set to default: "${ht.commitMessage}"`).onClick(()=>{f.setValue(ht.commitMessage),f.onChanged()})}),f.setValue(i.settings.commitMessage),f.onChange(async d=>{i.settings.commitMessage=d,await i.saveSettings()})}),U.Platform.isDesktopApp&&new U.Setting(r).setName("Commit message script").setDesc("A script that is run using 'sh -c' to generate the commit message. May be used to generate commit messages using AI tools. Available placeholders: {{hostname}}, {{date}}.").addText(f=>{f.onChange(async d=>{d===""?i.settings.commitMessageScript=ht.commitMessageScript:i.settings.commitMessageScript=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"commitMessageScript"})});let u=new U.Setting(r).setName("{{date}} placeholder format").addMomentFormat(f=>f.setDefaultFormat(i.settings.commitDateFormat).setValue(i.settings.commitDateFormat).onChange(async d=>{i.settings.commitDateFormat=d,await i.saveSettings()}));u.descEl.createSpan({text:` Specify custom date format. E.g. "${Ug}. See `}),u.descEl.createEl("a",{text:"Moment.js documentation",href:O2,attr:{target:"_blank"}}),u.descEl.createSpan({text:" for more formats."}),new U.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device. Defaults to the OS hostname if not set on desktop.").addText(f=>{var d;return f.setValue((d=i.localStorage.getHostname())!=null?d:"").onChange(h=>{i.localStorage.setHostname(h)})}),new U.Setting(r).setName("Preview commit message").addButton(f=>f.se Line truncated
`)),c.onChange(u=>{i.localStorage.setEnvVars(u.split(`
`))})}),i.gitManager instanceof Se&&new U.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(i.localStorage.getPATHPaths().join(`
`)),c.onChange(u=>{i.localStorage.setPATHPaths(u.split(`
`))})}),i.gitManager instanceof Se&&new U.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(c=>{c.setButtonText("Reload"),c.setCta(),c.onClick(async()=>{await i.gitManager.setGitInstance()})}),new U.Setting(r).setName("Custom base path (Git repository path)").setDesc(`
Sets the relative path to the vault from which the Git binary should be executed.
Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows.
`).addText(c=>{c.setValue(i.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{i.settings.basePath=u,await i.saveSettings(),i.gitManager.updateBasePath(u||"").catch(f=>i.displayError(f))})}),new U.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(i.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{i.settings.gitDir=u,await i.saveSettings()})}),new U.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(i.localStorage.getPluginDisabled()).onChange(u=>{i.localStorage.setPluginDisabled(u),u?i.unloadPlugin():i.init({fromReload:!0}).catch(f=>i.displayError(f)),new U.Notice("Obsidian must be restarted for the changes to take affect.")})),new U.Setting(r).setName("Support").setHeading(),new U.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{var f;let u=(f=c.buttonEl.parentElement)==null?void 0:f.createEl("a",{href:"https://ko-fi.com/F1F195IQ5",attr:{target:"_blank"}});u&&(u.createEl("img",{attr:{height:"36",style:"border:0px;height:36px;",src:"https://cdn.ko-fi.com/cdn/kofi3.png?v=3",border:"0",alt:"Buy Me a Coffee at ko-fi.com"}}),c.buttonEl.remove())});let o=r.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new U.Notice("Debug information copied to clipboard. May contain sensitive information!")},U.Platform.isDesktopApp){let c=r.createDiv();c.setAttr("align","center"),c.setText(`Debugging and logging:
You can always see the logs of this and every other plugin by opening the console with`);let u=r.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),U.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,i){i&&(r.setDisabled(i),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,i){this.settings.lineAuthor[r]=i,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new U.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.createEl("a",{href:s5,text:"Feature guide and quick examples",attr:{target:"_blank"}}),r.descEl.createEl("br"),r.descEl.createSpan({text:" The commit hash, author name and authoring date can all be individually toggled."}),r.descEl.createEl("br"),r.descEl.createSpan({text:"Hide everything, to only show the age-colored sidebar."}),r.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(n=>{this.configureLineAuthorShowStatus(n),this.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let i=new U.Setting(this.containerEl).setName("Follow movement and copies across files and commits").addDropdown(l=>{l.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),l.setValue(this.settings.lineAuthor.followMovement),l.onChange(c=>this.lineAuthorSettingHandler("followMovement",c))});if(i.descEl.createSpan({text:"By default (deactivated), each line only shows the newest commit where it was changed."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"same commit"}),i.descEl.createSpan({text:", cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"all commits"}),i.descEl.createSpan({text:", cut-copy-paste-ing text inbetween multiple commits will be detected."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"It uses "}),i.descEl.createEl("a",{href:"https://git-scm.com/docs/git-blame",text:"git-blame",attr:{target:"_blank"}}),i.descEl.createSpan({text:` and for matches (at least ${_d} characters) within the same (or all) commit(s), `}),i.descEl.createEl("em",{text:"the originating"}),i.descEl.createSpan({text:" commit's information is shown."}),new U.Setting(this.containerEl).setName("Show commit hash").addToggle(l=>{l.setValue(this.settings.lineAuthor.showCommitHash),l.onChange(c=>this.lineAuthorSettingHandler("showCommitHash",c))}),new U.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(l=>{let c={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};l.addOptions(c),l.setValue(this.settings.lineAuthor.authorDisplay),l.onChange(async u=>this.lineAuthorSettingHandler("authorDisplay",u))}),new U.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(l=>{let c={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeFormatOptions),l.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",u),this.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let l=new U.Setting(this.containerEl);l.setName("Custom authoring date format").addText(c=>{c.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),c.setPlaceholder("YYYY-MM-DD HH:mm"),c.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",u),this.setCustomDateTimeDescription(l.descEl,u)})}),this.setCustomDateTimeDescription(l.descEl,this.settings.lineAuthor.dateTimeFormatCustomString)}let n=new U.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(l=>{let c={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeTimezone),l.onChange(async u=>this.lineAuthorSettingHandler("dateTimeTimezone",u))});n.d Line truncated
Either your local time-zone (default),
the author's time-zone during commit creation or
`}),n.descEl.createEl("a",{text:"UTC\xB100:00",href:"https://en.wikipedia.org/wiki/UTC%C2%B100:00"}),n.descEl.createSpan({text:"."});let s=new U.Setting(this.containerEl).setName("Oldest age in coloring");this.setOldestAgeDescription(s.descEl,this.settings.lineAuthor.coloringMaxAge),s.addText(l=>{l.setPlaceholder("1y"),l.setValue(this.settings.lineAuthor.coloringMaxAge),l.onChange(async c=>{let f=Eu(c)!==void 0;this.setOldestAgeDescription(s.descEl,c),f&&(await this.lineAuthorSettingHandler("coloringMaxAge",c),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest");let a=new U.Setting(this.containerEl).setName("Text color").addText(l=>{l.setValue(this.settings.lineAuthor.textColorCss),l.onChange(async c=>{await this.lineAuthorSettingHandler("textColorCss",c)})});a.descEl.empty(),a.descEl.createSpan({text:"The CSS color of the gutter text."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"It is highly recommended to use "}),a.descEl.createEl("a",{text:"CSS variables",href:"https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties"}),a.descEl.createSpan({text:" defined by themes (e.g. "}),a.descEl.createEl("pre",{text:"var(--text-muted)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:" or "}),a.descEl.createEl("pre",{text:"var(--text-on-accent)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:"), because they automatically adapt to theme changes."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"See: "}),a.descEl.createEl("a",{text:"List of available CSS variables in Obsidian",href:"https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css"});let o=new U.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(l=>{l.setValue(this.settings.lineAuthor.ignoreWhitespace),l.onChange(c=>this.lineAuthorSettingHandler("ignoreWhitespace",c))});o.descEl.empty(),o.descEl.createSpan({text:"Whitespace and newlines are interpreted as part of the document and in changes by default (hence not ignored). This makes the last line being shown as 'changed' when a new subsequent line is added, even if the previously last line's text is the same."}),o.descEl.createEl("br"),o.descEl.createSpan({text:"If you don't care about purely-whitespace changes (e.g. list nesting / quote indentation changes), then activating this will provide more meaningful change detection."})}}createColorSetting(r){let i=new U.Setting(this.containerEl).setName("").addText(n=>{let s=uw(r,this.settings.lineAuthor),a=uw(r,ht.lineAuthor);n.setPlaceholder(iv(a)),n.setValue(iv(s)),n.onChange(async o=>{let l=Qk(o);if(l!==void 0){let c=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,i),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,uw(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let i=this.lineAuthorColorSettings.get(r);if(i){let n=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";i.nameEl.setText(`Color for ${n} commits`)}}refreshColorSettingsDesc(r,i){let n=this.lineAuthorColorSettings.get(r);n&&this.colorSettingPreviewDesc(n.descEl,r,this.settings.lineAuthor,i!==void 0)}colorSettingPreviewDesc(r,i,n,s){r.empty(),r.createSpan({text:"Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: "});let a=s?lh(i,n):"rgba(127,127,127,0.3)",o=U.moment.unix(U.moment.now()/1e3).format("YYYY-MM-DD"),l=s?`abcdef Author Name ${o}`:"invalid color";r.createEl("div",{text:l,attr:{class:"line-author-settings-preview",style:`background-color: ${a}; width: 30ch;`}})}setCustomDateTimeDescription(r,i){r.empty(),r.createEl("a",{text:"Format string",href:O2}),r.createSpan({text:" to display the authoring date."}),r.createEl("br");let n=(0,U.moment)().format(i);r.createSpan({text:`Currently: ${n}`})}setOldestAgeDescription(r,i){let n=Eu(i),s=n!==void 0?`${n.asDays()} days`:"invalid!";r.empty(),r.createSpan({text:`The oldest age in the line author coloring. Everything older will have the same color.
Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsProperty:r,text:i}){let n=this.plugin.settings[r];ht[r]!==n&&(typeof n=="string"||typeof n=="number"||typeof n=="boolean"?i.setValue(String(n)):i.setValue(JSON.stringify(n)))}refreshDisplayWithDelay(r=80){window.setTimeout(()=>this.display(),r)}};function uw(t,e){return t==="oldest"?e.colorOld:e.colorNew}function Eu(t){let e=U.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}m();var ti=require("obsidian");var fh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}display(){this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){switch((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,ti.setIcon)(this.conflictEl,"alert-circle"),this.conflictEl.ariaLabel="You have merge conflicts. Resolve them and commit afterwards.",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.style.marginRight=""),this.plugin.localStorage.getPausedAutomatics()?((0,ti.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.plugin.state.gitAction){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,ti.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,ti.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,ti.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,ti.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,ti.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,ti.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var i;let e=this.lastCommitTimestamp,r=this.plugin.state.offlineMode;if(e){let n=(0,ti.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${r?"Offline: ":""}Last Commit: ${n}`,((i=this.unPushedCommits)!=null?i:0)>0&&(this.statusBarEl.ariaLabel+=`
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,ti.setIcon)(this.iconEl,"globe"):(0,ti.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};m();var hh=require("obsidian"),dh=class extends hh.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let i=(0,hh.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${i}: ${r}`,`${r}: ${i}`]}renderSuggestion(r,i){i.innerText=r}onChooseSuggestion(r,i){this.resolve&&this.resolve(r)}};m();var L2=require("obsidian"),Su=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,i;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((i=this.plugin.localStorage.getLastAutoPush())!=null?i:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}startAutoCommitAndSync(e){let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,L2.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let i=this.diff(this.plugin.settings.autoSaveInterval,r);if(i>0)return this.startAutoCommitAndSync(i),!1}}let e=this.plugin.settings.autoCommitOnlyStaged;return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,onlyStaged:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,onlyStaged:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var r;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCom Line truncated
`)}static newName(){let e=V2[j2]||1;return V2[j2]=e+1,fw+e.toString(36)}static mount(e,r,i){let n=e[dw],s=i&&i.nonce;n?s&&n.setNonce(s):n=new hw(e,s),n.mount(Array.isArray(r)?r:[r],e)}},z2=new Map,hw=class{constructor(e,r){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=z2.get(i);if(s)return e[dw]=s;this.sheet=new n.CSSStyleSheet,z2.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[dw]=this}mount(e,r){let i=this.sheet,n=0,s=0;for(let a=0;a<e.length;a++){let o=e[a],l=this.modules.indexOf(o);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),i)for(let c=0;c<o.rules.length;c++)i.insertRule(o.rules[c],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=o.rules.length,s++}}if(i)r.adoptedStyleSheets.indexOf(this.sheet)<0&&(r.adoptedStyleSheets=[this.sheet,...r.adoptedStyleSheets]);else{let a="";for(let l=0;l<this.modules.length;l++)a+=this.modules[l].getRules()+`
`;this.styleTag.textContent=a;let o=r.head||r;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var cP=require("@codemirror/language"),a5=require("@lezer/highlight"),Et=class t{constructor(e,r,i,n){this.fromA=e,this.toA=r,this.fromB=i,this.toB=n}offset(e,r=e){return new t(this.fromA+e,this.toA+e,this.fromB+r,this.toB+r)}};function $a(t,e,r,i,n,s){if(t==i)return[];let a=yw(t,e,r,i,n,s),o=xw(t,e+a,r,i,n+a,s);e+=a,r-=o,n+=a,s-=o;let l=r-e,c=s-n;if(!l||!c)return[new Et(e,r,n,s)];if(l>c){let f=t.slice(e,r).indexOf(i.slice(n,s));if(f>-1)return[new Et(e,e+f,n,n),new Et(e+f+c,r,s,s)]}else if(c>l){let f=i.slice(n,s).indexOf(t.slice(e,r));if(f>-1)return[new Et(e,e,n,n+f),new Et(r,r,n+f+l,s)]}if(l==1||c==1)return[new Et(e,r,n,s)];let u=fP(t,e,r,i,n,s);if(u){let[f,d,h]=u;return $a(t,e,f,i,n,d).concat($a(t,f+h,r,i,d+h,s))}return o5(t,e,r,i,n,s)}var Au=1e9,Cu=0,bw=!1;function o5(t,e,r,i,n,s){let a=r-e,o=s-n;if(Au<1e9&&Math.min(a,o)>Au*16||Cu>0&&Date.now()>Cu)return Math.min(a,o)>Au*64?[new Et(e,r,n,s)]:W2(t,e,r,i,n,s);let l=Math.ceil((a+o)/2);pw.reset(l),mw.reset(l);let c=(h,p)=>t.charCodeAt(e+h)==i.charCodeAt(n+p),u=(h,p)=>t.charCodeAt(r-h-1)==i.charCodeAt(s-p-1),f=(a-o)%2!=0?mw:null,d=f?null:pw;for(let h=0;h<l;h++){if(h>Au||Cu>0&&!(h&63)&&Date.now()>Cu)return W2(t,e,r,i,n,s);let p=pw.advance(h,a,o,l,f,!1,c)||mw.advance(h,a,o,l,d,!0,u);if(p)return l5(t,e,r,e+p[0],i,n,s,n+p[1])}return[new Et(e,r,n,s)]}var yh=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,r,i,n,s,a,o){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=n+l,u=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,f=u-l;for(;u<r&&f<i&&o(u,f);)u++,f++;if(this.vec[c]=u,u>r)this.end+=2;else if(f>i)this.start+=2;else if(s){let d=n+(r-i)-l;if(d>=0&&d<this.len&&s.vec[d]!=-1)if(a){let h=s.vec[d];if(h>=r-u)return[h,n+h-d]}else{let h=r-s.vec[d];if(u>=h)return[u,f]}}}return null}},pw=new yh,mw=new yh;function l5(t,e,r,i,n,s,a,o){let l=!1;return!Rl(t,i)&&++i==r&&(l=!0),!Rl(n,o)&&++o==a&&(l=!0),l?[new Et(e,r,s,a)]:$a(t,e,i,n,s,o).concat($a(t,i,r,n,o,a))}function uP(t,e){let r=1,i=Math.min(t,e);for(;r<i;)r=r<<1;return r}function yw(t,e,r,i,n,s){if(e==r||e==s||t.charCodeAt(e)!=i.charCodeAt(n))return 0;let a=uP(r-e,s-n);for(let o=e,l=n;;){let c=o+a,u=l+a;if(c>r||u>s||t.slice(o,c)!=i.slice(l,u)){if(a==1)return o-e-(Rl(t,o)?0:1);a=a>>1}else{if(c==r||u==s)return c-e;o=c,l=u}}}function xw(t,e,r,i,n,s){if(e==r||n==s||t.charCodeAt(r-1)!=i.charCodeAt(s-1))return 0;let a=uP(r-e,s-n);for(let o=r,l=s;;){let c=o-a,u=l-a;if(c<e||u<n||t.slice(c,o)!=i.slice(u,l)){if(a==1)return r-o-(Rl(t,o)?0:1);a=a>>1}else{if(c==e||u==n)return r-c;o=c,l=u}}}function gw(t,e,r,i,n,s,a,o){let l=i.slice(n,s),c=null;for(;;){if(c||a<o)return c;for(let u=e+a;;){Rl(t,u)||u++;let f=u+a;if(Rl(t,f)||(f+=f==u+1?1:-1),f>=r)break;let d=t.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=yw(t,f,r,i,n+h+d.length,s),g=xw(t,e,u,i,n,n+h),v=d.length+p+g;(!c||c[2]<v)&&(c=[u-g,n+h-g,v])}u=f}if(o<0)return c;a=a>>1}}function fP(t,e,r,i,n,s){let a=r-e,o=s-n;if(a<o){let l=fP(i,n,s,t,e,r);return l&&[l[1],l[0],l[2]]}return a<4||o*2<a?null:gw(t,e,r,i,n,s,Math.floor(a/4),-1)}function W2(t,e,r,i,n,s){bw=!0;let a=r-e,o=s-n,l;if(a<o){let d=gw(i,n,s,t,e,r,Math.floor(a/6),50);l=d&&[d[1],d[0],d[2]]}else l=gw(t,e,r,i,n,s,Math.floor(o/6),50);if(!l)return[new Et(e,r,n,s)];let[c,u,f]=l;return $a(t,e,c,i,n,u).concat($a(t,c+f,r,i,u+f,s))}function dP(t,e){for(let r=1;r<t.length;r++){let i=t[r-1],n=t[r];i.toA>n.fromA-e&&i.toB>n.fromB-e&&(t[r-1]=new Et(i.fromA,n.toA,i.fromB,n.toB),t.splice(r--,1))}}function c5(t,e,r){for(;;){dP(r,1);let i=!1;for(let n=0;n<r.length;n++){let s=r[n],a,o;(a=yw(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new Et(s.fromA+a,s.toA,s.fromB+a,s.toB)),(o=xw(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new Et(s.fromA,s.toA-o,s.fromB,s.toB-o));let l=s.toA-s.fromA,c=s.toB-s.fromB;if(l&&c)continue;let u=s.fromA-(n?r[n-1].toA:0),f=(n<r.length-1?r[n+1].fromA:t.length)-s.toA;if(!u||!f)continue;let d=l?t.slice(s.fromA,s.toA):e.slice(s.fromB,s.toB);u<=d.length&&t.slice(s.fromA-u,s.fromA)==d.slice(d.length-u)?(r[n]=new Et(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),i=!0):f<=d.length&&t.slice(s.toA,s.toA+f)==d.slice(0,f)&&(r[n]=new Et(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),i=!0)}if(!i)break}return r}function u5(t,e,r){for(let i=0,n=0;n<t.length;n++){let s=t[n],a=s.toA-s.fromA,o=s.toB-s.fromB;if(a&&o||a>3||o>3){let l=n==t.length-1?e.length:t[n+1].fromA,c=s.fromA-i,u=l-s.toA,f=Y2(e,s.fromA,c),d=q2(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!a||!o)&&h&&p){let g=Math.max(a,o),[v,_,b]=a?[e,s.fromA,s.toA]:[r,s.fromB,s.toB];g>h&&e.slice(f,s.fromA)==v.slice(b-h,b)?(s=t[n]=new Et(f,f+a,s.fromB-h,s.toB-h),f=s.fromA,d=q2(e,s.toA,l-s.toA)):g>p&&e.slice(s.toA,d)==v.slice(_,_+p)&&(s=t[n]=new Et(d-a,d,s.fromB+p,s.toB+p),d=s. Line truncated
`),s=e.split(`
`);for(let a of r){let{oldStart:o,oldLines:l,newStart:c,newLines:u}=a,f=Vt.createHunk(o,l,c,u);if(a.oldLines>0){for(let d=o;d<o+l;d++)f.removed.lines.push(n[d-1]);o+l>n.length&&n.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(a.newLines>0){for(let d=c;d<c+u;d++)f.added.lines.push(s[d-1]);c+u>s.length&&s.last()!=""&&(f.added.no_nl_at_eof=!0)}i.push(f)}return i}function Aw(t,e,r){let i=e.lineAt(t.fromA).number,n=t.fromA==t.toA?0:Sh(e,t.endA)-i+1,s=r.lineAt(t.fromB).number,a=t.fromB==t.toB?0:Sh(r,t.endB)-s+1,o={oldStart:i,oldLines:n,newStart:s,newLines:a};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var EP={scanLimit:1e3,timeout:200};function A5(t,e,r,i){let n=Sw.Text.of(t.split(`
`)),s=Sw.Text.of(e.split(`
`)),a=r&&i?ts.updateB(r,n,s,i,EP):ts.build(n,s,EP),o=[];for(let l=0;l<a.length;l++){let c=a[l],u=Aw(c,n,s);o.push(u)}return{hunks:kw(t,e,o),chunks:a}}function SP(t,e,r,i){return A5(t,e,r,i)}var Fl=require("obsidian");function Sh(t,e){let r=t.lineAt(e);return!(r.text.length==0&&r.number==t.lines)?r.number:r.number-1}var Wi=class{static hasHunksData(e){let r=e.field(Hr,!1);return!!r&&!r.isDirty}static getHunks(e,r){let i=e.field(Hr);return i?r?i.stagedHunks:i.hunks:[]}static getHunkAtPos(e,r,i){if(!e.field(Hr))return;let s=e.doc.lineAt(r).number,a=this.getHunks(e,i);return Vt.findHunk(s,a)[0]}static getCursorHunk(e,r){if(!e.field(Hr))return;let n=e.selection.main.head;return this.getHunkAtPos(e,n,r)}static getHunk(e,r,i){if(i!=null)return this.getHunkAtPos(e,i,r);if(e.selection.main.empty)return this.getCursorHunk(e,r);let n=e.selection.main.from,s=e.selection.main.to,a=e.doc.lineAt(n).number,o=Sh(e.doc,s),l=this.getHunks(e,r),c=Vt.createPartialHunk(l,a,o);if(!c)return;let u=e.field(Hr);if(r){let f=a,d=o;for(let h of u.hunks)a>h.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));c.added.lines=u.compareText.split(`
`).slice(f-1,d),u.compareTextHead?c.removed.lines=u.compareTextHead.split(`
`).slice(c.removed.start-1,c.removed.start-1+c.removed.count):c.removed.lines=[]}else c.added.lines=e.doc.toString().split(`
`).slice(a-1,o),o===e.doc.lines&&!e.doc.toString().endsWith(`
`)&&(c.added.no_nl_at_eof=!0),c.removed.lines=u.compareText.split(`
`).slice(c.removed.start-1,c.removed.start-1+c.removed.count),c.removed.start+c.removed.count-1===u.compareText.split(`
`).length&&!u.compareText.endsWith(`
`)&&(c.removed.no_nl_at_eof=!0);return c}},Hr=$l.StateField.define({create:t=>{},update:(t,e)=>{let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},i=!1;for(let n of e.effects)n.is(Il)&&(r.compareText=n.value.compareText,r.compareTextHead=n.value.compareTextHead,i=(t==null?void 0:t.compareText)!==n.value.compareText,i&&(r.chunks=void 0)),n.is(Pu)&&kP(r,n.value,e.state);if(r.compareText!==void 0){if(i||e.docChanged){r.isDirty=!0;let n=C5(e,r.compareText,r.chunks,r.maxDiffTimeMs);n&&kP(r,n,e.state)}}else r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;return r}});function kP(t,e,r){var n,s;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let i=r.field(Fl.editorInfoField).file;(s=(n=jt.plugin)==null?void 0:n.editorIntegration.signsFeature.changeStatusBar)==null||s.display(t.hunks,i)}var Cw=$l.StateField.define({create:()=>({debouncer:(0,Fl.debounce)(t=>{let{state:e,compareText:r,previousChunks:i,changeDesc:n}=t,s=AP(e,r,i,n);e.field(Fl.editorEditorField).dispatch({effects:Pu.of(s)})},1e3,!0),maxDiffTimeMs:0}),update:(t,e)=>{var r;for(let i of e.effects)if(i.is(Pu))return t.changeDesc=void 0,t;return!t.changeDesc&&e.changes?t.changeDesc=e.changes:t.changeDesc=(r=t.changeDesc)==null?void 0:r.composeDesc(e.changes),t}});function AP(t,e,r,i){let n=t.doc.toString(),s=performance.now(),{hunks:a,chunks:o}=SP(e,n,r,i),l=performance.now()-s;return{hunks:a,chunks:o,diffDuration:l}}function C5(t,e,r,i){let n=t.state,s=Math.abs(t.changes.length-t.changes.newLength),a=n.field(Cw);if(s>1e3||i>16)a.debouncer({state:n,compareText:e,previousChunks:r,changeDesc:a.changeDesc});else return a.changeDesc=void 0,AP(n,e,r,t.changes)}var Il=$l.StateEffect.define(),Pu=$l.StateEffect.define();function CP(t,e){return e.update({effects:Il.of(t)})}m();m();m();var nt;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(nt||(nt={}));var TP={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},PP={LINES:"lines",WORDS:"words",NONE:"none"},RP={WORD:"word",CHAR:"char"},Ia;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(Ia||(Ia={}));m();var T5=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],P5=RegExp("["+T5.join("\\")+"]","g");function $P(t){return t.replace(P5,"\\$&")}function Tw(t){return t&&t.replace(/\\/g,"/")}function FP(t){let e,r,i,n=0;for(e=0,i=t.length;e<i;e++)r=t.charCodeAt(e),n=(n<<5)-n+r,n|=0;return n}function kh(t){let e=t.length,r=-1/0;for(let i=0;i<e;i++)r=Math.max(r,t[i]);return r}function IP(t,e){let r=t.split(".");return r.length>1?r[r.length-1]:e}function MP(t,e){return e.reduce((r,i)=>r||t.startsWith(i),!1)}var DP=["a/","b/","i/","w/","c/","o/"];function Hs(t,e,r){let i=r!==void 0?[...DP,r]:DP,n=e?new RegExp(`^${$P(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=n.exec(t)||[],a=i.find(l=>s.indexOf(l)===0);return(a?s.slice(a.length):s).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function R5(t,e){return Hs(t,"---",e)}function $5(t,e){return Hs(t,"+++",e)}function OP(t,e={}){let r=[],i=null,n=null,s=null,a=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,_=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,S=/^rename from "?(.+)"?/,k=/^rename to "?(.+)"?/,E=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,w=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,x=/^Binary files (.*) and (.*) differ/,y=/^GIT binary patch/,C=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,P=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,L=/^new file mode (\d{6})/,N=/^deleted file mode (\d{6}),(\d{6})/,B=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,`
`).split(`
`);function ge(){n!==null&&i!==null&&(i.blocks.push(n),n=null)}function Le(){i!==null&&(!i.oldName&&l!==null&&(i.oldName=l),!i.newName&&c!==null&&(i.newName=c),i.newName&&(r.push(i),i=null)),l=null,c=null}function ke(){ge(),Le(),i={blocks:[],deletedLines:0,addedLines:0}}function ne(z){ge();let X;i!==null&&((X=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(z))?(i.isCombined=!1,s=parseInt(X[1],10),o=parseInt(X[2],10)):(X=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(z))?(i.isCombined=!0,s=parseInt(X[1],10),a=parseInt(X[2],10),o=parseInt(X[3],10)):(z.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,o=0,i.isCombined=!1)),n={lines:[],oldStartLine:s,oldStartLine2:a,newStartLine:o,header:z}}function Ee(z){if(i===null||n===null||s===null||o===null)return;let X={content:z},V=i.isCombined?["+ "," +","++"]:["+"],Ne=i.isCombined?["- "," -","--"]:["-"];MP(z,V)?(i.addedLines++,X.type=nt.INSERT,X.oldNumber=void 0,X.newNumber=o++):MP(z,Ne)?(i.deletedLines++,X.type=nt.DELETE,X.oldNumber=s++,X.newNumber=void 0):(X.type=nt.CONTEXT,X.oldNumber=s++,X.newNumber=o++),n.lines.push(X)}function _e(z,X){let V=X;for(;V<B.length-3;){if(z.startsWith("diff"))return!1;if(B[V].startsWith(u)&&B[V+1].startsWith(f)&&B[V+2].startsWith(d))return!0;V++}return!1}return B.forEach((z,X)=>{if(!z||z.startsWith("*"))return;let V,Ne=B[X-1],gr=B[X+1],Nt=B[X+2];if(z.startsWith("diff --git")||z.startsWith("diff --combined")){if(ke(),(V=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(z))&&(l=Hs(V[1],void 0,e.dstPrefix),c=Hs(V[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isGitDiff=!0;return}if(z.startsWith("Binary files")&&!(i!=null&&i.isGitDiff)){if(ke(),(V=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(z))&&(l=Hs(V[1],void 0,e.dstPrefix),c=Hs(V[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isBinary=!0;return}if((!i||!i.isGitDiff&&i&&z.startsWith(u)&&gr.startsWith(f)&&Nt.startsWith(d))&&ke(),i!=null&&i.isTooBig)return;if(i&&(typeof e.diffMaxChanges=="number"&&i.addedLines+i.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&z.length>e.diffMaxLineLength)){i.isTooBig=!0,i.addedLines=0,i.deletedLines=0,i.blocks=[],n=null;let Pt=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";ne(Pt);return}if(z.startsWith(u)&&gr.startsWith(f)||z.startsWith(f)&&Ne.startsWith(u)){if(i&&!i.oldName&&z.startsWith("--- ")&&(V=R5(z,e.srcPrefix))){i.oldName=V,i.language=IP(i.oldName,i.language);return}if(i&&!i.newName&&z.startsWith("+++ ")&&(V=$5(z,e.dstPrefix))){i.newName=V,i.language=IP(i.newName,i.language);return}}if(i&&(z.startsWith(d)||i.isGitDiff&&i.oldName&&i.newName&&!n)){ne(z);return}if(n&&(z.startsWith("+")||z.startsWith("-")||z.startsWith(" "))){Ee(z);return}let Fe=!_e(z,X);if(i===null)throw new Error("Where is my file !!!");(V=h.exec(z))?i.oldMode=V[1]:(V=p.exec(z))?i.newMode=V[1]:(V=g.exec(z))?(i.deletedFileMode=V[1],i.isDeleted=!0):(V=v.exec(z))?(i.newFileMode=V[1],i.isNew=!0):(V=_.exec(z))?(Fe&&(i.oldName=V[1]),i.isCopy=!0):(V=b.exec(z))?(Fe&&(i.newName=V[1]),i.isCopy=!0):(V=S.exec(z))?(Fe&&(i.oldName=V[1]),i.isRename=!0):(V=k.exec(z))?(Fe&&(i.newName=V[1]),i.isRename=!0):(V=x.exec(z))?(i.isBinary=!0,i.oldName=Hs(V[1],void 0,e.srcPrefix),i.newName=Hs(V[2],void 0,e.dstPrefix),ne("Binary file")):y.test(z)?(i.isBinary=!0,ne(z)):(V=E.exec(z))?i.unchangedPercentage=parseInt(V[1],10):(V=A.exec(z))?i.changedPercentage=parseInt(V[1],10):(V=w.exec(z))?(i.checksumBefore=V[1],i.checksumAfter=V[2],V[3]&&(i.mode=V[3])):(V=C.exec(z))?(i.checksumBefore=[V[2],V[3]],i.checksumAfter=V[1]):(V=P.exec(z))?(i.oldMode=[V[2],V[3]],i.newMode=V[1]):(V=L.exec(z))?(i.newFileMode=V[1],i.isNew=!0):(V=N.exec(z))&&(i.deletedFileMode=V[1],i.isDeleted=!0)}),ge(),Le(),r}m();m();m();function I5(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],i;for(i=0;i<=e.length;i++)r[i]=[i];let n;for(n=0;n<=t.length;n++)r[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?r[i][n]=r[i-1][n-1]:r[i][n]=Math.min(r[i-1][n-1]+1,Math.min(r[i][n-1]+1,r[i-1][n]+1));return r[e.length][t.length]}function Ml(t){return(e,r)=>{let i=t(e).trim(),n=t(r).trim();return I5(i,n)/(i.length+n.length)}}function Dl(t){function e(i,n,s=new Map){let a=1/0,o;for(let l=0;l<i.length;++l)for(let c=0;c<n.length;++c){let u=JSON.stringify([i[l],n[c]]),f;s.has(u)&&(f=s.get(u))||(f=t(i[l],n[c]),s.set(u,f)),f<a&&(a=f,o={indexA:l,indexB:c,score:a})}return o}function r(i,n,s=0,a=new Map){let o=e(i,n,a);if(!o||i.length+n.length<3)return[[i,n]];let l=i.slice(0,o.indexA),c=n.slice(0,o.indexB),u=[i[o.indexA]],f=[n[o.indexB]],d=o.indexA+1,h=o.indexB+1,p=i.slice(d),g=n.slice(h),v=r(l,c,s+1,a),_=r(u,f,s+1,a),b=r(p,g,s+1,a),S=_;return(o.indexA>0||o.indexB>0)&&(S=v.concat(S)),(i.length>d||n.length>h)&&(S=S.concat(b)),S}return r}var Qt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO: Line truncated
`);return this.hoganUtils.render(NP,"wrapper",{colorScheme:Ll(this.config.colorScheme),filesNumber:e.length,files:r})}};m();var Fw=Object.assign(Object.assign({},Ma),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Ru="generic",BP="line-by-line",H5="icon",U5="tag",$u=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Fw),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
`);return this.hoganUtils.render(Ru,"wrapper",{colorScheme:Ll(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(BP,"file-diff"),n=this.hoganUtils.template(Ru,"file-path"),s=this.hoganUtils.template(H5,"file"),a=this.hoganUtils.template(U5,Bl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Da(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(Ru,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Qt})}generateFileHtml(e){let r=Dl(Ml(i=>ki(i.content,e.isCombined).content));return e.blocks.map(i=>{let n=this.hoganUtils.render(Ru,"block-header",{CSSLineClass:Qt,blockHeader:e.isTooBig?i.header:Us(i.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);n+=u,n+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ki(l.content,e.isCombined);n+=this.generateSingleLineHtml(e,{type:Qt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,a,o);n+=l,n+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).join(`
`)}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==nt.INSERT&&n.length||a.type===nt.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===nt.CONTEXT?r.push([[a],[],[]]):a.type===nt.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===nt.INSERT&&i.length>0?n.push(a):a.type===nt.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=kh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}processChangedLines(e,r,i,n){let s={right:"",left:""},a=Math.max(i.length,n.length);for(let o=0;o<a;o++){let l=i[o],c=n[o],u=l!==void 0&&c!==void 0?Ah(l.content,c.content,r,this.config):void 0,f=l!==void 0&&l.oldNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.oldLine.prefix,content:u.oldLine.content,type:Qt.DELETE_CHANGES}:Object.assign(Object.assign({},ki(l.content,r)),{type:Ol(l.type)})),{oldNumber:l.oldNumber,newNumber:l.newNumber}):void 0,d=c!==void 0&&c.newNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.newLine.prefix,content:u.newLine.content,type:Qt.INSERT_CHANGES}:Object.assign(Object.assign({},ki(c.content,r)),{type:Ol(c.type)})),{oldNumber:c.oldNumber,newNumber:c.newNumber}):void 0,{left:h,right:p}=this.generateLineHtml(e,f,d);s.left+=h,s.right+=p}return s}generateLineHtml(e,r,i){return{left:this.generateSingleLineHtml(e,r),right:this.generateSingleLineHtml(e,i)}}generateSingleLineHtml(e,r){if(r===void 0)return"";let i=this.hoganUtils.render(BP,"numbers",{oldNumber:r.oldNumber||"",newNumber:r.newNumber||""});return this.hoganUtils.render(Ru,"line",{type:r.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:r.prefix===" "?"&nbsp;":r.prefix,content:r.content,lineNumber:i,line:r,file:e})}};m();var Iw=Object.assign(Object.assign({},Ma),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Fu="generic",G5="side-by-side",j5="icon",V5="tag",Iu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Iw),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
`);return this.hoganUtils.render(Fu,"wrapper",{colorScheme:Ll(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(G5,"file-diff"),n=this.hoganUtils.template(Fu,"file-path"),s=this.hoganUtils.template(j5,"file"),a=this.hoganUtils.template(V5,Bl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Da(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Fu,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Qt})}}generateFileHtml(e){let r=Dl(Ml(i=>ki(i.content,e.isCombined).content));return e.blocks.map(i=>{let n={left:this.makeHeaderHtml(i.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);n.left+=u,n.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ki(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:Qt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:Qt.CONTEXT,prefix:c,content:u,number:l.newNumber});n.left+=f,n.right+=d});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,a,o);n.left+=l,n.right+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).reduce((i,n)=>({left:i.left+n.left,right:i.right+n.right}),{left:"",right:""})}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==nt.INSERT&&n.length||a.type===nt.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===nt.CONTEXT?r.push([[a],[],[]]):a.type===nt.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===nt.INSERT&&i.length>0?n.push(a):a.type===nt.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=kh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}makeHeaderHtml(e,r){return this.hoganUtils.render(Fu,"block-header",{CSSLineClass:Qt,blockHeader:r!=null&&r.isTooBig?e:Us(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,r,i){let n={right:"",left:""},s=Math.max(r.length,i.length);for(let a=0;a<s;a++){let o=r[a],l=i[a],c=o!==void 0&&l!==void 0?Ah(o.content,l.content,e,this.config):void 0,u=o!==void 0&&o.oldNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.oldLine.prefix,content:c.oldLine.content,type:Qt.DELETE_CHANGES}:Object.assign(Object.assign({},ki(o.content,e)),{type:Ol(o.type)})),{number:o.oldNumber}):void 0,f=l!==void 0&&l.newNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.newLine.prefix,content:c.newLine.content,type:Qt.INSERT_CHANGES}:Object.assign(Object.assign({},ki(l.content,e)),{type:Ol(l.type)})),{number:l.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(u,f);n.left+=d,n.right+=h}return n}generateLineHtml(e,r){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(r)}}generateSingleHtml(e){let r="d2h-code-side-linenumber",i="d2h-code-side-line";return this.hoganUtils.render(Fu,"line",{type:(e==null?void 0:e.type)||`${Qt.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?r:`${r} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?i:`${i} d2h-code-side-emptyplaceholder`,prefix:(e==null?void 0:e.prefix)===" "?"&nbsp;":e==null?void 0:e.prefix,content:e==null?void 0:e.content,lineNumber:e==null?void 0:e.number})}};m();var Lw=Ht(Ow());m();var St=Ht(Ow()),bt={};bt["file-summary-line"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<li class="d2h-file-list-line">'),i.b(`
`+r),i.b(' <span class="d2h-file-name-wrapper">'),i.b(`
`+r),i.b(i.rp("<fileIcon0",t,e," ")),i.b(' <a href="#'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-name">'),i.b(i.v(i.f("fileName",t,e,0))),i.b("</a>"),i.b(`
`+r),i.b(' <span class="d2h-file-stats">'),i.b(`
`+r),i.b(' <span class="d2h-lines-added">'),i.b(i.v(i.f("addedLines",t,e,0))),i.b("</span>"),i.b(`
`+r),i.b(' <span class="d2h-lines-deleted">'),i.b(i.v(i.f("deletedLines",t,e,0))),i.b("</span>"),i.b(`
`+r),i.b(" </span>"),i.b(`
`+r),i.b(" </span>"),i.b(`
`+r),i.b("</li>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});bt["file-summary-wrapper"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-file-list-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
`+r),i.b(' <div class="d2h-file-list-header">'),i.b(`
`+r),i.b(' <span class="d2h-file-list-title">Files changed ('),i.b(i.v(i.f("filesNumber",t,e,0))),i.b(")</span>"),i.b(`
`+r),i.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),i.b(`
`+r),i.b(' <a class="d2h-file-switch d2h-show">show</a>'),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(' <ol class="d2h-file-list">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("files",t,e,0))),i.b(`
`+r),i.b(" </ol>"),i.b(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["generic-block-header"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
`+r),i.b(' <td class="'),i.b(i.v(i.f("lineClass",t,e,0))),i.b(" "),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('"></td>'),i.b(`
`+r),i.b(' <td class="'),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('">'),i.b(`
`+r),i.b(' <div class="'),i.b(i.v(i.f("contentClass",t,e,0))),i.b('">'),i.s(i.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(a.t(a.f("blockHeader",n,s,0)))}),t.pop()),i.s(i.f("blockHeader",t,e,1),t,e,1,0,0,"")||i.b("&nbsp;"),i.b("</div>"),i.b(`
`+r),i.b(" </td>"),i.b(`
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});bt["generic-empty-diff"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
`+r),i.b(' <td class="'),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('">'),i.b(`
`+r),i.b(' <div class="'),i.b(i.v(i.f("contentClass",t,e,0))),i.b('">'),i.b(`
`+r),i.b(" File without changes"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(" </td>"),i.b(`
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});bt["generic-file-path"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-file-name-wrapper">'),i.b(`
`+r),i.b(i.rp("<fileIcon0",t,e," ")),i.b(' <span class="d2h-file-name">'),i.b(i.v(i.f("fileDiffName",t,e,0))),i.b("</span>"),i.b(`
`+r),i.b(i.rp("<fileTag1",t,e," ")),i.b("</span>"),i.b(`
`+r),i.b('<label class="d2h-file-collapse">'),i.b(`
`+r),i.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),i.b(`
`+r),i.b(" Viewed"),i.b(`
`+r),i.b("</label>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});bt["generic-line"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
`+r),i.b(' <td class="'),i.b(i.v(i.f("lineClass",t,e,0))),i.b(" "),i.b(i.v(i.f("type",t,e,0))),i.b('">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("lineNumber",t,e,0))),i.b(`
`+r),i.b(" </td>"),i.b(`
`+r),i.b(' <td class="'),i.b(i.v(i.f("type",t,e,0))),i.b('">'),i.b(`
`+r),i.b(' <div class="'),i.b(i.v(i.f("contentClass",t,e,0))),i.b('">'),i.b(`
`+r),i.s(i.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' <span class="d2h-code-line-prefix">'),a.b(a.t(a.f("prefix",n,s,0))),a.b("</span>"),a.b(`
`+r)}),t.pop()),i.s(i.f("prefix",t,e,1),t,e,1,0,0,"")||(i.b(' <span class="d2h-code-line-prefix">&nbsp;</span>'),i.b(`
`+r)),i.s(i.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' <span class="d2h-code-line-ctn">'),a.b(a.t(a.f("content",n,s,0))),a.b("</span>"),a.b(`
`+r)}),t.pop()),i.s(i.f("content",t,e,1),t,e,1,0,0,"")||(i.b(' <span class="d2h-code-line-ctn"><br></span>'),i.b(`
`+r)),i.b(" </div>"),i.b(`
`+r),i.b(" </td>"),i.b(`
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});bt["generic-wrapper"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("content",t,e,0))),i.b(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["icon-file-added"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),i.b(`
`+r),i.b(' width="14">'),i.b(`
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file-changed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),i.b(`
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file-deleted"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),i.b(`
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file-renamed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),i.b(`
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
`+r),i.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),i.b(`
`+r),i.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["line-by-line-file-diff"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
`+r),i.b(' <div class="d2h-file-header">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(' <div class="d2h-file-diff">'),i.b(`
`+r),i.b(' <div class="d2h-code-wrapper">'),i.b(`
`+r),i.b(' <table class="d2h-diff-table">'),i.b(`
`+r),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("diffs",t,e,0))),i.b(`
`+r),i.b(" </tbody>"),i.b(`
`+r),i.b(" </table>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["line-by-line-numbers"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="line-num1">'),i.b(i.v(i.f("oldNumber",t,e,0))),i.b("</div>"),i.b(`
`+r),i.b('<div class="line-num2">'),i.b(i.v(i.f("newNumber",t,e,0))),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["side-by-side-file-diff"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
`+r),i.b(' <div class="d2h-file-header">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(' <div class="d2h-files-diff">'),i.b(`
`+r),i.b(' <div class="d2h-file-side-diff">'),i.b(`
`+r),i.b(' <div class="d2h-code-wrapper">'),i.b(`
`+r),i.b(' <table class="d2h-diff-table">'),i.b(`
`+r),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.d("diffs.left",t,e,0))),i.b(`
`+r),i.b(" </tbody>"),i.b(`
`+r),i.b(" </table>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(' <div class="d2h-file-side-diff">'),i.b(`
`+r),i.b(' <div class="d2h-code-wrapper">'),i.b(`
`+r),i.b(' <table class="d2h-diff-table">'),i.b(`
`+r),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.d("diffs.right",t,e,0))),i.b(`
`+r),i.b(" </tbody>"),i.b(`
`+r),i.b(" </table>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["tag-file-added"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),i.fl()},partials:{},subs:{}});bt["tag-file-changed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),i.fl()},partials:{},subs:{}});bt["tag-file-deleted"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),i.fl()},partials:{},subs:{}});bt["tag-file-renamed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),i.fl()},partials:{},subs:{}});var Mu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let i=Object.entries(r).reduce((n,[s,a])=>{let o=Lw.compile(a,{asString:!1});return Object.assign(Object.assign({},n),{[s]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},bt),e),i)}static compile(e){return Lw.compile(e,{asString:!1})}render(e,r,i,n,s){let a=this.templateKey(e,r);try{return this.preCompiledTemplates[a].render(i,n,s)}catch(o){throw new Error(`Could not find template to render '${a}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var W5=Object.assign(Object.assign(Object.assign({},Fw),Iw),{outputFormat:TP.LINE_BY_LINE,drawFileList:!0});function Ph(t,e={}){let r=Object.assign(Object.assign({},W5),e),i=typeof t=="string"?OP(t,r):t,n=new Mu(r),{colorScheme:s}=r,a={colorScheme:s},o=r.drawFileList?new Ch(n,a).render(i):"",l=r.outputFormat==="side-by-side"?new Iu(n,r).render(i):new $u(n,r).render(i);return o+l}var qP=Ht(zP(),1);var Oa=require("obsidian"),Nw=Du.StateEffect.define();function Gs(t,e){let r=t.state,i=r.field($h),n=r.field(Hr),s=r.doc.lineAt(e!=null?e:r.selection.main.head).number,a=Vt.findHunk(s,n==null?void 0:n.hunks)[0];if(!a)return;let o=r.doc.line(Math.max(1,a.added.start)).from,l=i.has(o);return r.field(Oa.editorEditorField).dispatch({effects:Nw.of({pos:o,add:!l})})}var $h=Du.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let i of e.effects)i.is(Nw)&&(i.value.add?t.add(i.value.pos):t.delete(i.value.pos));for(let i of t)r.add(e.changes.mapPos(i));return r}}),YP=Du.StateField.define({create:t=>WP(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is(Il)||r.is(Nw))?WP(e.state):t},provide:t=>Rh.showTooltip.computeN([t],e=>e.field(t))}),XP=Rh.EditorView.baseTheme({".cm-tooltip.git-diff-tooltip":{"z-index":"var(--layer-popover)",backgroundColor:"var(--background-primary-alt)",border:"var(--border-width) solid var(--background-primary-alt)",borderRadius:"var(--radius-s)"},".cm-tooltip.git-diff-tooltip .tooltip-toolbar":{display:"flex",padding:"var(--size-2-1)"}});function WP(t){let e=t.field(Hr);return e?[...t.field($h)].map(i=>{let n=t.doc.lineAt(i),s=Vt.findHunk(n.number,e.hunks)[0];if(s)return{pos:i,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>q5(s,t,i)}}).filter(i=>i!==void 0):[]}function q5(t,e,r){var g,v;let i=Vt.createPatch("file",[t],"10064",!1).join(`
`)+`
`,n=Ph(i,{colorScheme:qP.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(n,"text/html").querySelector(".d2h-file-diff"),a=activeDocument.createDiv(),o=activeDocument.createDiv();o.addClass("tooltip-toolbar");let l=(_,b)=>{let S=activeDocument.createDiv();return(0,Oa.setIcon)(S,_),S.setAttr("aria-label",b),S.addClass("clickable-icon"),S},c=l("x","Close hunk"),u=l("plus","Stage hunk"),f=l("undo","Reset hunk");o.appendChild(c),o.appendChild(u),o.appendChild(f),a.appendChild(o),a.appendChild(s),a.addClass("git-diff-tooltip","git-diff");let d=e.field(Oa.editorEditorField);c.onclick=()=>{Gs(d,r)},u.onclick=()=>{let _=jt.plugin;_&&(_.promiseQueue.addTask(()=>_.hunkActions.stageHunk(r)),Gs(d,r))},f.onclick=()=>{let _=jt.plugin;_&&(_.hunkActions.resetHunk(r),Gs(d,r))};let h=(v=(g=jt.plugin)==null?void 0:g.app.workspace.getActiveViewOfType(Oa.MarkdownView))==null?void 0:v.scope,p=h==null?void 0:h.register(null,"Escape",(_,b)=>{Gs(d,r)});return{dom:a,destroy:()=>{p&&(h==null||h.unregister(p))},update:_=>{r=_.changes.mapPos(r)}}}function ZP(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(r)||await e.vault.adapter.write(r,"");let i=await e.vault.adapter.read(r),s=await new mh(e,i).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(r,s),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(Kt.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:Kt.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(bi.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:bi.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;{let n=t.gitManager.getRelativeRepoPath(i.path,!0);t.tools.openDiff({aFile:n,aRef:""})}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:i})=>{if(i)return N2(r,i,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:i})=>{if(i)return B2(i,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.addFileToGitignore(i.path,i instanceof qi.TFolder).catch(n=>t.displayError(n))}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:i})})}),t.addCommand({id:"commit-staged",name:"Commit staged",checkCallback:function(r){if(r)return!1;t.promiseQueue.addTask(async()=>t.commit({fromAuto:!1,requestCustomMessage:!1}))}}),qi.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:i})})}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",checkCallback:function(r){return r?!1:t.pr Line truncated
- ${s.map(o=>o.vaultPath).join(`
- `)}
Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(il,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(i=>{i.getDisplayText()!=""&&il.startsWith(i.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(il,"/",!0)}openDiff({aFile:e,bFile:r,aRef:i,bRef:n,event:s}){var l,c;let a=this.plugin.settings.diffStyle;Hl.Platform.isMobileApp&&(a="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:i,bRef:n};a=="split"?(l=ji(this.plugin.app,s))==null||l.setViewState({type:Ms.type,active:!0,state:o}):a=="git_unified"&&((c=ji(this.plugin.app,s))==null||c.setViewState({type:Ds.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof Se))return;let i=await new et(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();i!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let n=new Hl.Notice(`Running '${i}'...`,999999);try{let s=await e.rawCommand(i);s?(n.setMessage(s),window.setTimeout(()=>n.hide(),5e3)):n.hide()}catch(s){throw n.hide(),s}})}};m();var Ih=require("obsidian");var La=class extends Ih.ItemView{constructor(r,i){super(r);this.plugin=i;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return Ds.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();return i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3)),`Diff: ${i}`}return Ds.name}getIcon(){return Ds.icon}async setState(r,i){this.state=r,Ih.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let i=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let n=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!i){if(this.plugin.gitManager instanceof Se&&await this.plugin.gitManager.isTracked(this.state.bFile))i=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(`
`);else if(await this.app.vault.adapter.exists(n)){let s=await this.app.vault.adapter.read(n);i=[...`--- /dev/null
+++ ${this.state.bFile}
@@ -0,0 +1,${s.split(`
`).length} @@`.split(`
`),...s.split(`
`).map(o=>`+${o}`)].join(`
`)}}if(i){let s=this.parser.parseFromString(Ph(i),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(s)}else{let s=this.contentEl.createDiv({cls:"obsidian-git-center"});s.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),s.createEl("br"),s.createSpan({text:"File not found: "+this.state.bFile})}}finally{this.gettingDiff=!1}}}};m();var rs=require("obsidian");var Gl=require("@codemirror/commands");var Mh=require("@codemirror/search"),Ul=require("@codemirror/state"),Ci=require("@codemirror/view");var Na=class extends rs.ItemView{constructor(r,i){super(r);this.plugin=i;this.refreshing=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",n=>{this.state.bRef==null&&n.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(n,s)=>{this.state.bRef==null&&(n.path===this.state.bFile||s===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,rs.debounce)(n=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),n).catch(a=>this.plugin.displayError(a)))},1e3,!1)}getViewType(){return Ms.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3));let n;return this.state.bRef==null?n=" (Working Tree)":this.state.bRef==""?n=" (Index)":n="("+this.state.bRef.substring(0,7)+")",`Diff: ${i} ${n}`}return Ms.name}getIcon(){return Ms.icon}async setState(r,i){this.state=r,rs.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,i),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,i){try{return await this.plugin.gitManager.show(r,i,!1)}catch(n){if(n instanceof Nr&&(n.message.includes("does not exist")||n.message.includes("unknown revision or path")||n.message.includes("exists on disk, but not in")||n.message.includes("fatal: bad object")))return n.message.includes("fatal: bad object")&&this.plugin.displayError(n.message),"";throw n}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let i=await this.app.vault.adapter.read(this.state.bFile);if(i!=r.state.doc.toString()){let n=r.state.update({changes:{from:0,to:r.state.doc.length,insert:i},annotations:[Ul.Transaction.remote.of(!0)]});r.dispatch(n)}this.refreshing=!1}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.a,i=this.mergeView.b;this.refreshing=!0;let n=await this.gitShow(this.state.aRef,this.state.aFile),s;if(this.state.bRef!=null&&(s=await this.gitShow(this.state.bRef,this.state.bFile)),n!=r.state.doc.toString()){let a=r.state.update({changes:{from:0,to:r.state.doc.length,insert:n}});r.dispatch(a)}if(s!=null&&s!=i.state.doc.toString()){let a=i.state.update({changes:{from:0,to:i.state.doc.length,insert:s}});i.dispatch(a)}this.refreshing=!1}renderButtons(){let r=activeDocument.createDiv(),i=r.createDiv();if(i.addClass("clickable-icon"),i.setAttr("aria-label",this.state.bRef==null?"Stage hunk":"Unstage hunk"),(0,rs.setIcon)(i,this.state.bRef==null?"plus":"minus"),i.onmousedown=async n=>{var h;let s=this.mergeView.b,a=this.mergeView.a,o=Ew(s.state),l=(h=r.parentElement)==null?void 0:h.indexOf(r),c=o.chunks[l],u=Aw(c,a.state.doc,s.state.doc),f=kw(this.mergeView.a.state.doc.toString(),this.mergeView.b.state.doc.toString(),[u])[0],d=Vt.createPatch(this.state.bFile,[f],"100644",this.state.bRef!=null).join(`
`)+`
`;await this.plugin.gitManager.applyPatch(d),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let n=r.createDiv();n.addClass("clickable-icon"),n.setAttr("aria-label","Reset hunk"),(0,rs.setIcon)(n,"undo"),n.onmousedown=s=>{var f;let a=this.mergeView.a,o=this.mergeView.b,l=Ew(o.state),c=(f=r.parentElement)==null?void 0:f.indexOf(r),u=l.chunks[c];if(u){let d=u.fromA,h=u.toA,p=u.fromB,g=u.toB,v=a.state.sliceDoc(d,Math.max(d,h-1));d!=h&&g<=o.state.doc.length&&(v+=a.state.lineBreak),o.dispatch({changes:{from:p,to:Math.min(o.state.doc.length,g),insert:v},userEvent:"revert"})}}}return r.onmousedown=n=>{n.preventDefault(),n.stopPropagation()},r}async createMergeView(){var r,i,n;if((r=this.state)!=null&&r.aFile&&((i=this.state)!=null&&i.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(n=this.mergeView)==null||n.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let a=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let g=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(g)?o=await this.app.vault.adapter.read(g):o=""}let l=[(0,Ci.lineNumbers)(),(0,Mh.highlightSelectionMatches)(),(0,Ci.drawSelection)(),Ci.keymap.of([...Gl.standardKeymap,Gl.indentWithTab]),(0,Gl.history)(),(0,Mh.search)(),Ci.EditorView.lineWrapping],c=this,u=Ci.ViewPlugin.define(g=>({update(v){if(v.docChanged&&!v.transactions.some(_=>_.annotation(Ul.Transaction.remote))){let _=g.state.doc.toString();c.fileSaveDebouncer(_)}}})),f={doc:a,extensions:[...l,Ci.EditorView.editable.of(!1),Ul.EditorState.readOnly.of(!0)]},d=[...l];this.bIsEditable?d.push(u):d.push(Ci.EditorView.editable.of(!1),Ul.EditorState.readOnly.of(!0));let h={doc:o,extensions:d};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let p=this.plugin.gitManager instanceof Se&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new Eh({b:h,a:f,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:p?()=>this.renderButtons():void 0,revertControls:p?"a-to-b":void 0,diffConfig:{scanLimit:this.bIsEditable?1e3:1e4},parent:s}),this.refreshing=!1}}};m();var U$=require("obsidian");m();m();m();var KP="5";var QP,JP,eR;typeof window!="undefined"&&((eR=(JP=(QP=window.__svelte)!=null?QP:window.__svelte={}).v)!=null?eR:JP.v=new Set).add(KP);m();m();m();var jl="[",Ba="[!",Bw="[?",Ha="]",is={};var Ze=Symbol(),Ti=Symbol("filename"),tR=Symbol("hmr"),Dh="http://www.w3.org/1999/xhtml";m();m();m();m();var Oh=!0;m();var I=!1;m();var ns=Array.isArray,rR=Array.prototype.indexOf,Yi=Array.prototype.includes,Vl=Array.from,Hw=Object.keys,or=Object.defineProperty,Ur=Object.getOwnPropertyDescriptor,Uw=Object.getOwnPropertyDescriptors,Gw=Object.prototype,iR=Array.prototype,zl=Object.getPrototypeOf,jw=Object.isExtensible;function Vw(t){return typeof t=="function"}var lr=()=>{};function Lh(t){for(var e=0;e<t.length;e++)t[e]()}function Nh(){var t,e,r=new Promise((i,n)=>{t=i,e=n});return{promise:r,resolve:t,reject:e}}m();m();var Jt=Symbol("$state"),Lu=Symbol("legacy props"),sR=Symbol(""),Bh=Symbol("proxy path"),zw=Symbol("hmr anchor"),ri=new class extends Error{constructor(){super(...arguments);Ve(this,"name","StaleReactionError");Ve(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},nR,Ww=!!((nR=globalThis.document)!=null&&nR.contentType)&&globalThis.document.contentType.includes("xml");var Wl=3,Pi=8;m();m();function aR(t){if(I){let e=new Error(`invariant_violation
An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app \u2014 please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${t}"
https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function Hh(t){if(I){let e=new Error(`lifecycle_outside_component
\`${t}(...)\` can only be used during component initialisation
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function lR(){if(I){let t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function qw(){if(I){let t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function cR(){if(I){let t=new Error(`derived_references_self
A derived value cannot reference itself recursively
https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function Yw(t,e,r){if(I){let i=new Error(`each_key_duplicate
${r?`Keyed each block has duplicate key \`${r}\` at indexes ${t} and ${e}`:`Keyed each block has duplicate key at indexes ${t} and ${e}`}
https://svelte.dev/e/each_key_duplicate`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function uR(t,e,r){if(I){let i=new Error(`each_key_volatile
Keyed each block has key that is not idempotent \u2014 the key for item at index ${t} was \`${e}\` but is now \`${r}\`. Keys must be the same each time for a given item
https://svelte.dev/e/each_key_volatile`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_volatile")}function fR(t){if(I){let e=new Error(`effect_in_teardown
\`${t}\` cannot be used inside an effect cleanup function
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function dR(){if(I){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function hR(t){if(I){let e=new Error(`effect_orphan
\`${t}\` can only be used inside an effect (e.g. during component initialisation)
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function pR(){if(I){let t=new Error(`effect_update_depth_exceeded
Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function mR(){if(I){let t=new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function gR(t){if(I){let e=new Error(`props_invalid_value
Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function vR(t){if(I){let e=new Error(`rune_outside_svelte
The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function wR(){if(I){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function _R(){if(I){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function bR(){if(I){let t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function yR(){if(I){let t=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}m();m();m();var Sn="font-weight: bold",kn="font-weight: normal";function xR(t){I?console.warn(`%c[svelte] await_reactivity_loss
%cDetected reactivity loss when reading \`${t}\`. This happens when state is read in an async function after an earlier \`await\`
https://svelte.dev/e/await_reactivity_loss`,Sn,kn):console.warn("https://svelte.dev/e/await_reactivity_loss")}function ER(t,e){I?console.warn(`%c[svelte] await_waterfall
%cAn async derived, \`${t}\` (${e}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app
https://svelte.dev/e/await_waterfall`,Sn,kn):console.warn("https://svelte.dev/e/await_waterfall")}function SR(){I?console.warn(`%c[svelte] derived_inert
%cReading a derived belonging to a now-destroyed effect may result in stale values
https://svelte.dev/e/derived_inert`,Sn,kn):console.warn("https://svelte.dev/e/derived_inert")}function kR(t,e,r){I?console.warn(`%c[svelte] hydration_attribute_changed
%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value
https://svelte.dev/e/hydration_attribute_changed`,Sn,kn):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Ua(t){I?console.warn(`%c[svelte] hydration_mismatch
%c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
https://svelte.dev/e/hydration_mismatch`,Sn,kn):console.warn("https://svelte.dev/e/hydration_mismatch")}function AR(){I?console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
https://svelte.dev/e/lifecycle_double_unmount`,Sn,kn):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Uh(t){I?console.warn(`%c[svelte] state_proxy_equality_mismatch
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results
https://svelte.dev/e/state_proxy_equality_mismatch`,Sn,kn):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function CR(){I?console.warn(`%c[svelte] state_proxy_unmount
%cTried to unmount a state proxy, rather than a component
https://svelte.dev/e/state_proxy_unmount`,Sn,kn):console.warn("https://svelte.dev/e/state_proxy_unmount")}function TR(){I?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",Sn,kn):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function PR(t){I?console.warn(`%c[svelte] transition_slide_display
%cThe \`slide\` transition does not work correctly for elements with \`display: ${t}\`
https://svelte.dev/e/transition_slide_display`,Sn,kn):console.warn("https://svelte.dev/e/transition_slide_display")}var ie=!1;function Ft(t){ie=t}var me;function Ue(t){if(t===null)throw Ua(),is;return me=t}function cr(){return Ue(tr(me))}function G(t){if(ie){if(tr(me)!==null)throw Ua(),is;me=t}}function Ga(t=1){if(ie){for(var e=t,r=me;e--;)r=tr(r);me=r}}function An(t=!0){for(var e=0,r=me;;){if(r.nodeType===Pi){var i=r.data;if(i===Ha){if(e===0)return r;e-=1}else(i===jl||i===Ba||i[0]==="["&&!isNaN(Number(i.slice(1))))&&(e+=1)}var n=tr(r);t&&r.remove(),r=n}}function Nu(t){if(!t||t.nodeType!==Pi)throw Ua(),is;return t.data}m();m();m();m();function Gh(t){return t===this.v}function Xw(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function jh(t){return!Xw(t,this.v)}m();var kt=!1,ss=!1,Xi=!1;m();m();m();var Bu=null;function ur(t,e){return t.label=e,zh(t.v,e),t}function zh(t,e){var r;return(r=t==null?void 0:t[Bh])==null||r.call(t,e),t}m();function Ki(t){let e=new Error,r=Y5();return r.length===0?null:(r.unshift(`
`),or(e,"stack",{value:r.join(`
`)}),or(e,"name",{value:t}),e)}function Y5(){let t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=t,!e)return[];let r=e.split(`
`),i=[];for(let n=0;n<r.length;n++){let s=r[n],a=s.replaceAll("\\","/");if(s.trim()!=="Error"){if(s.includes("validate_each_keys"))return[];a.includes("svelte/src/internal")||a.includes("node_modules/.vite")||i.push(s)}}return i}function $R(t,e){if(!I)throw new Error("invariant(...) was not guarded by if (DEV)");t||aR(e)}m();var ye=null;function as(t){ye=t}var Cn=null;function ql(t){Cn=t}var Qi=null;function Wh(t){Qi=t}function lt(t,e=!1,r){ye={p:ye,i:!1,c:null,e:null,s:t,x:null,r:Z,l:ss&&!e?{s:null,u:null,$:[]}:null},I&&(ye.function=r,Qi=r)}function ct(t){var n;var e=ye,r=e.e;if(r!==null){e.e=null;for(var i of r)Zw(i)}return t!==void 0&&(e.x=t),e.i=!0,ye=e.p,I&&(Qi=(n=ye==null?void 0:ye.function)!=null?n:null),t!=null?t:{}}function Tn(){return!ss||ye!==null&&ye.l===null}m();m();var ja=[];function FR(){var t=ja;ja=[],Lh(t)}function It(t){if(ja.length===0&&!Va){var e=ja;queueMicrotask(()=>{e===ja&&FR()})}ja.push(t)}function IR(){for(;ja.length>0;)FR()}m();var Kw=new WeakMap;function qh(t){var e=Z;if(e===null)return oe.f|=8388608,t;if(I&&t instanceof Error&&!Kw.has(t)&&Kw.set(t,X5(t,e)),!(e.f&32768)&&!(e.f&4))throw I&&!e.parent&&t instanceof Error&&MR(t),t;Ri(t,e)}function Ri(t,e){for(;e!==null;){if(e.f&128){if(!(e.f&32768))throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw I&&t instanceof Error&&MR(t),t}function X5(t,e){var a,o,l;let r=Ur(t,"message");if(!(r&&!r.configurable)){for(var i=Uu?" ":" ",n=`
${i}in ${((a=e.fn)==null?void 0:a.name)||"<unknown>"}`,s=e.ctx;s!==null;)n+=`
${i}in ${(o=s.function)==null?void 0:o[Ti].split("/").pop()}`,s=s.p;return{message:t.message+`
${n}
`,stack:(l=t.stack)==null?void 0:l.split(`
`).filter(c=>!c.includes("svelte/src/internal")).join(`
`)}}}function MR(t){let e=Kw.get(t);e&&(or(t,"message",{value:e.message}),or(t,"stack",{value:e.stack}))}m();m();var Z5=-7169;function Ge(t,e){t.f=t.f&Z5|e}function Yl(t){t.f&512||t.deps===null?Ge(t,1024):Ge(t,4096)}function DR(t){if(t!==null)for(let e of t)!(e.f&2)||!(e.f&65536)||(e.f^=65536,DR(e.deps))}function Yh(t,e,r){t.f&2048?e.add(t):t.f&4096&&r.add(t),DR(t.deps),Ge(t,1024)}m();m();m();var OR=!1,Xh=!1,UZ=Symbol();function Qw(t){var e=Xh;try{return Xh=!1,[t(),Xh]}finally{Xh=e}}m();var Pn=new Set,le=null,ju=null,Ct=null,e0=null,Va=!1,Jw=!1,qa=null,Gu=null,LR=0,J5=I?new Set:null,e4=1,Zl,Kl,Ya,ls,Rn,Vu,Gr,zu,Vs,cs,$n,Ql,Jl,zs,yt,Zh,BR,Kh,t0,Qh,HR,Jh=class Jh{constructor(){pe(this,yt);Ve(this,"id",e4++);Ve(this,"current",new Map);Ve(this,"previous",new Map);pe(this,Zl,new Set);pe(this,Kl,new Set);pe(this,Ya,new Set);pe(this,ls,new Map);pe(this,Rn,new Map);pe(this,Vu,null);pe(this,Gr,[]);pe(this,zu,[]);pe(this,Vs,new Set);pe(this,cs,new Set);pe(this,$n,new Map);pe(this,Ql,new Set);Ve(this,"is_fork",!1);pe(this,Jl,!1);pe(this,zs,new Set)}skip_effect(e){R(this,$n).has(e)||R(this,$n).set(e,{d:[],m:[]}),R(this,Ql).delete(e)}unskip_effect(e,r=i=>this.schedule(i)){var i=R(this,$n).get(e);if(i){R(this,$n).delete(e);for(var n of i.d)Ge(n,2048),r(n);for(n of i.m)Ge(n,4096),r(n)}R(this,Ql).add(e)}capture(e,r,i=!1){e.v!==Ze&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[r,i]),Ct==null||Ct.set(e,r)),this.is_fork||(e.v=r)}activate(){le=this}deactivate(){le=null,Ct=null}flush(){var e=I?new Set:null;try{Jw=!0,le=this,Me(this,yt,Kh).call(this)}finally{if(LR=0,e0=null,qa=null,Gu=null,Jw=!1,le=null,Ct=null,us.clear(),I)for(let r of e)r.updated=null}}discard(){for(let e of R(this,Kl))e(this);R(this,Kl).clear(),R(this,Ya).clear(),Pn.delete(this)}register_created_effect(e){R(this,zu).push(e)}increment(e,r){var n,s;let i=(n=R(this,ls).get(r))!=null?n:0;if(R(this,ls).set(r,i+1),e){let a=(s=R(this,Rn).get(r))!=null?s:0;R(this,Rn).set(r,a+1)}}decrement(e,r,i){var s,a;let n=(s=R(this,ls).get(r))!=null?s:0;if(n===1?R(this,ls).delete(r):R(this,ls).set(r,n-1),e){let o=(a=R(this,Rn).get(r))!=null?a:0;o===1?R(this,Rn).delete(r):R(this,Rn).set(r,o-1)}R(this,Jl)||i||(we(this,Jl,!0),It(()=>{we(this,Jl,!1),this.flush()}))}transfer_effects(e,r){for(let i of e)R(this,Vs).add(i);for(let i of r)R(this,cs).add(i);e.clear(),r.clear()}oncommit(e){R(this,Zl).add(e)}ondiscard(e){R(this,Kl).add(e)}on_fork_commit(e){R(this,Ya).add(e)}run_fork_commit_callbacks(){for(let e of R(this,Ya))e(this);R(this,Ya).clear()}settled(){var e;return((e=R(this,Vu))!=null?e:we(this,Vu,Nh())).promise}static ensure(){if(le===null){let e=le=new Jh;Jw||(Pn.add(le),Va||It(()=>{le===e&&e.flush()}))}return le}apply(){if(!kt||!this.is_fork&&Pn.size===1){Ct=null;return}Ct=new Map;for(let[i,[n]]of this.current)Ct.set(i,n);for(let i of Pn)if(!(i===this||i.is_fork)){var e=!1,r=!1;if(i.id<this.id)for(let[n,[,s]]of i.current)s||(e||(e=this.current.has(n)),r||(r=!this.current.has(n)));if(e&&r)R(this,zs).add(i);else for(let[n,s]of i.previous)Ct.has(n)||Ct.set(n,s)}}schedule(e){var n;if(e0=e,(n=e.b)!=null&&n.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var r=e;r.parent!==null;){r=r.parent;var i=r.f;if(qa!==null&&r===Z&&(kt||(oe===null||!(oe.f&2))&&!OR))return;if(i&96){if(!(i&1024))return;r.f^=1024}}R(this,Gr).push(r)}};Zl=new WeakMap,Kl=new WeakMap,Ya=new WeakMap,ls=new WeakMap,Rn=new WeakMap,Vu=new WeakMap,Gr=new WeakMap,zu=new WeakMap,Vs=new WeakMap,cs=new WeakMap,$n=new WeakMap,Ql=new WeakMap,Jl=new WeakMap,zs=new WeakMap,yt=new WeakSet,Zh=function(){return this.is_fork||R(this,Rn).size>0},BR=function(){for(let i of R(this,zs))for(let n of R(i,Rn).keys()){for(var e=!1,r=n;r.parent!==null;){if(R(this,$n).has(r)){e=!0;break}r=r.parent}if(!e)return!0}return!1},Kh=function(){var o,l;if(LR++>1e3&&(Pn.delete(this),t4()),!Me(this,yt,Zh).call(this)){for(let c of R(this,Vs))R(this,cs).delete(c),Ge(c,2048),this.schedule(c);for(let c of R(this,cs))Ge(c,4096),this.schedule(c)}let e=R(this,Gr);we(this,Gr,[]),this.apply();var r=qa=[],i=[],n=Gu=[];for(let c of e)try{Me(this,yt,t0).call(this,c,r,i)}catch(u){throw jR(c),u}if(le=null,n.length>0){var s=Jh.ensure();for(let c of n)s.schedule(c)}if(qa=null,Gu=null,Me(this,yt,Zh).call(this)||Me(this,yt,BR).call(this)){Me(this,yt,Qh).call(this,i),Me(this,yt,Qh).call(this,r);for(let[c,u]of R(this,$n))GR(c,u)}else{R(this,ls).size===0&&Pn.delete(this),R(this,Vs).clear(),R(this,cs).clear();for(let c of R(this,Zl))c(this);R(this,Zl).clear(),ju=this,NR(i),NR(r),ju=null,(o=R(this,Vu))==null||o.resolve()}var a=le;if(R(this,Gr).length>0){let c=a!=null?a:a=this;R(c,Gr).push(...R(this,Gr).filter(u=>!R(c,Gr).includes(u)))}if(a!==null){if(Pn.add(a),I)for(let c of this.current.keys())J5.add(c);Me(l=a,yt,Kh).call(l)}kt&&!Pn.has(this)&&Me(this,yt,HR).call(this)},t0=function(e,r,i){e.f^=1024;for(var n=e.first;n!==null;){var s=n.f,a=(s&96)!==0,o=a&&(s&1024)!==0,l=o||(s&8192)!==0||R(this,$n).has(n);if(!l&&n.fn!== Line truncated
`).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==is&&console.warn("Failed to hydrate: ",o),e.recover===!1&&mR(),cp(),sc(r),Ft(!1),Xs(t,e)}finally{Ft(i),Ue(n)}}var vp=new Map;function S$(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:o}){cp();var l=void 0,c=c$(()=>{var u=r!=null?r:e.appendChild(Lt());l0(u,{pending:()=>{}},h=>{lt({});var p=ye;if(s&&(p.c=s),n&&(i.$$events=n),ie&&Nn(h,null),wp=a,l=t(h,i)||{},wp=!0,ie&&(Z.nodes.end=me,me===null||me.nodeType!==Pi||me.data!==Ha))throw Ua(),is;ct()},o);var f=new Set,d=h=>{for(var p=0;p<h.length;p++){var g=h[p];if(!f.has(g)){f.add(g);var v=E$(g);for(let S of[e,document]){var _=vp.get(S);_===void 0&&(_=new Map,vp.set(S,_));var b=_.get(g);b===void 0?(S.addEventListener(g,gp,{passive:v}),_.set(g,1)):_.set(g,b+1)}}}};return d(Vl(E0)),mp.add(d),()=>{var v;for(var h of f)for(let _ of[e,document]){var p=vp.get(_),g=p.get(h);--g==0?(_.removeEventListener(h,gp),p.delete(h),p.size===0&&vp.delete(_)):p.set(h,g)}mp.delete(d),u!==r&&((v=u.parentNode)==null||v.removeChild(u))}});return C0.set(l,c),l}var C0=new WeakMap;function ds(t,e){let r=C0.get(t);return r?(C0.delete(t),r(e)):(I&&(Jt in t?CR():AR()),Promise.resolve())}m();m();m();var rn,Bn,di,lo,tf,rf,_p,hs=class{constructor(e,r=!0){Ve(this,"anchor");pe(this,rn,new Map);pe(this,Bn,new Map);pe(this,di,new Map);pe(this,lo,new Set);pe(this,tf,!0);pe(this,rf,e=>{if(R(this,rn).has(e)){var r=R(this,rn).get(e),i=R(this,Bn).get(r);if(i)ef(i),R(this,lo).delete(r);else{var n=R(this,di).get(r);n&&(R(this,Bn).set(r,n.effect),R(this,di).delete(r),I&&(n.fragment.lastChild[zw]=this.anchor),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(let[s,a]of R(this,rn)){if(R(this,rn).delete(s),s===e)break;let o=R(this,di).get(a);o&&(mt(o.effect),R(this,di).delete(a))}for(let[s,a]of R(this,Bn)){if(s===r||R(this,lo).has(s))continue;let o=()=>{if(Array.from(R(this,rn).values()).includes(s)){var c=document.createDocumentFragment();rc(a,c),c.append(Lt()),R(this,di).set(s,{effect:a,fragment:c})}else mt(a);R(this,lo).delete(s),R(this,Bn).delete(s)};R(this,tf)||!i?(R(this,lo).add(s),Mn(a,o,!1)):o()}}});pe(this,_p,e=>{R(this,rn).delete(e);let r=Array.from(R(this,rn).values());for(let[i,n]of R(this,di))r.includes(i)||(mt(n.effect),R(this,di).delete(i))});this.anchor=e,we(this,tf,r)}ensure(e,r){var i=le,n=up();if(r&&!R(this,Bn).has(e)&&!R(this,di).has(e))if(n){var s=document.createDocumentFragment(),a=Lt();s.append(a),R(this,di).set(e,{effect:qt(()=>r(a)),fragment:s})}else R(this,Bn).set(e,qt(()=>r(this.anchor)));if(R(this,rn).set(i,e),n){for(let[o,l]of R(this,Bn))o===e?i.unskip_effect(l):i.skip_effect(l);for(let[o,l]of R(this,di))o===e?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit(R(this,rf)),i.ondiscard(R(this,_p))}else ie&&(this.anchor=me),R(this,rf).call(this,i)}};rn=new WeakMap,Bn=new WeakMap,di=new WeakMap,lo=new WeakMap,tf=new WeakMap,rf=new WeakMap,_p=new WeakMap;if(I){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;vR(e)},set:i=>{r=i}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function co(t){ye===null&&Hh("onMount"),ss&&ye.l!==null?y4(ye).m.push(t):mr(()=>{let e=We(t);if(typeof e=="function")return e})}function y4(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}m();m();var C$=new Map;function T$(t,e){var r=C$.get(t);r||(r=new Set,C$.set(t,r)),r.add(e)}m();m();m();m();m();m();m();m();m();function Re(t,e,r=!1){var i;ie&&(i=me,cr());var n=new hs(t),s=r?65536:0;function a(o,l){if(ie){var c=Nu(i);if(o!==parseInt(c.substring(1))){var u=An();Ue(u),n.anchor=u,Ft(!1),n.ensure(o,l),Ft(!0);return}}n.ensure(o,l)}oi(()=>{var o=!1;e((l,c=0)=>{o=!0,a(c,l)}),o||a(-1,null)},s)}m();var $ie=Symbol("NaN");m();m();function hi(t,e){return e}function T4(t,e,r){var f;for(var i=[],n=e.length,s,a=e.length,o=0;o<n;o++){let d=e[o];Mn(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;P0(t,Vl(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=i.length===0&&r!==null;if(l){var c=r,u=c.parentNode;sc(u),u.append(c),t.items.clear()}P0(t,e,!l)}else s={pending:new Set(e),done:new Set},((f=t.outrogroups)!=null?f:t.outrogroups=new Set).add(s)}function P0(t,e,r=!0){var i;if(t.pending.size>0){i=new Set;for(let a of t.pending.values())for(let o of a)i.add(t.items.get(o).e)}for(var n=0;n<e.length;n++){var s=e[n];if(i!=null&&i.has(s)){s.f|=33554432;let a=document.createDocumentFragment();rc(s,a)}else mt(e[n],r)}}var ac;function pi(t,e,r,i,n,s=null){var a=t,o=new Map,l=(e&4)!==0;if(l){var c=t;a=ie?Ue(sr(c)):c.appendChild(Lt())}ie&&cr();var u=null,f=to(()=>{var S=r();return ns(S)?S:S==null?[]:Vl(S)});I&&ur(f,"{#each ...}");var d,h=new Map,p=!0;function g(S){b.effect.f&16384||(b.pending.delete(S),b.fallback=u,P4(b,d,a,e,i),u!==null&&(d.length===0?u.f&33554432?(u.f^=33554432,sf(u,null,a)):ef(u):Mn(u Line truncated
\r\f\xA0\v\uFEFF`];function D$(t,e,r){var i=t==null?"":""+t;if(e&&(i=i?i+" "+e:e),r){for(var n of Object.keys(r))if(r[n])i=i?i+" "+n:n;else if(i.length)for(var s=n.length,a=0;(a=i.indexOf(n,a))>=0;){var o=a+s;(a===0||M$.includes(i[a-1]))&&(o===i.length||M$.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}m();function gt(t,e,r,i,n,s){var a=t.__className;if(ie||a!==r||a===void 0){var o=D$(r,i,s);(!ie||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t.__className=r}else if(s&&n!==s)for(var l in s){var c=!!s[l];(n==null||c!==!!n[l])&&t.classList.toggle(l,c)}return s}m();m();var z4=Symbol("class"),W4=Symbol("style"),q4=Symbol("is custom element"),Y4=Symbol("is html"),X4=Ww?"link":"LINK";function xe(t,e,r,i){var n=Z4(t);if(ie&&(n[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===X4)){i||Q4(t,e,r!=null?r:"");return}n[e]!==(n[e]=r)&&(e==="loading"&&(t[sR]=r),r==null?t.removeAttribute(e):typeof r!="string"&&K4(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function Z4(t){var e;return(e=t.__attributes)!=null?e:t.__attributes={[q4]:t.nodeName.includes("-"),[Y4]:t.namespaceURI===Dh}}var O$=new Map;function K4(t){var e=t.getAttribute("is")||t.nodeName,r=O$.get(e);if(r)return r;O$.set(e,r=[]);for(var i,n=t,s=Element.prototype;s!==n;){i=Uw(n);for(var a in i)i[a].set&&r.push(a);n=zl(n)}return r}function Q4(t,e,r){var i;I&&(e==="srcset"&&J4(t,r)||$0((i=t.getAttribute(e))!=null?i:"",r)||kR(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function $0(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function L$(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function J4(t,e){var r=L$(t.srcset),i=L$(e);return i.length===r.length&&i.every(([n,s],a)=>s===r[a][1]&&($0(r[a][0],n)||$0(n,r[a][0])))}m();m();m();function M0(t,e,r=e){var i=new WeakSet;_0(t,"input",async n=>{I&&t.type==="checkbox"&&qw();var s=n?t.defaultValue:t.value;if(s=F0(t)?I0(s):s,r(s),le!==null&&i.add(le),await pp(),s!==(s=e())){var a=t.selectionStart,o=t.selectionEnd,l=t.value.length;if(t.value=s!=null?s:"",o!==null){var c=t.value.length;a===o&&o===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=a,t.selectionEnd=Math.min(o,c))}}}),(ie&&t.defaultValue!==t.value||We(e)==null&&t.value)&&(r(F0(t)?I0(t.value):t.value),le!==null&&i.add(le)),nr(()=>{I&&t.type==="checkbox"&&qw();var n=e();if(t===document.activeElement){var s=kt?ju:le;if(i.has(s))return}F0(t)&&n===I0(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n!=null?n:"")})}function F0(t){var e=t.type;return e==="number"||e==="range"}function I0(t){return t===""?null:+t}m();m();m();m();m();function B$(t,e){return t===e||(t==null?void 0:t[Jt])===e}function at(t={},e,r,i){var n=ye.r,s=Z;return qr(()=>{var a,o;return nr(()=>{a=o,o=(i==null?void 0:i())||[],We(()=>{t!==r(...o)&&(e(t,...o),a&&B$(r(...a),t)&&e(null,...a))})}),()=>{let l=s;for(;l!==n&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{o&&B$(r(...o),t)&&e(null,...o)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}m();m();m();m();m();m();function Di(t,e,r,i){var S,k;var n=!ss||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=i,l=!0,c=()=>(l&&(l=!1,o=a?We(i):i),o);let u;if(s){var f=Jt in t||Lu in t;u=(k=(S=Ur(t,e))==null?void 0:S.set)!=null?k:f&&e in t?E=>t[e]=E:void 0}var d,h=!1;s?[d,h]=Qw(()=>t[e]):d=t[e],d===void 0&&i!==void 0&&(d=c(),u&&(n&&gR(e),u(d)));var p;if(n?p=()=>{var E=t[e];return E===void 0?c():(l=!0,E)}:p=()=>{var E=t[e];return E!==void 0&&(o=void 0),E===void 0?o:E},n&&!(r&4))return p;if(u){var g=t.$$legacy;return function(E,A){return arguments.length>0?((!n||!A||g||h)&&u(A?p():E),E):p()}}var v=!1,_=(r&1?eo:to)(()=>(v=!1,p()));I&&(_.label=e),s&&$(_);var b=Z;return function(E,A){if(arguments.length>0){let w=A?$(_):n&&s?Qe(E):E;return se(_,w),v=!0,o!==void 0&&(o=w),E}return li&&v||b.f&16384?_.v:$(_)}}m();m();m();function H$(t){return new O0(t)}var ps,Oi,O0=class{constructor(e){pe(this,ps);pe(this,Oi);var s,a;var r=new Map,i=(o,l)=>{var c=za(l,!1,!1);return r.set(o,c),c};let n=new Proxy({...e.props||{},$$events:{}},{get(o,l){var c;return $((c=r.get(l))!=null?c:i(l,Reflect.get(o,l)))},has(o,l){var c;return l===Lu?!0:($((c=r.get(l))!=null?c:i(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return se((u=r.get(l))!=null?u:i(l,c),c),Reflect.set(o,l,c)}});we(this,Oi,(e.hydrate?T0:Xs)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover,transformError:e.transformError})),!kt&&(!((a=e==null?void 0:e.props)!=null&&a.$$host)||e.sync===!1)&&Za(),we(this,ps,n.$$events);for(let o of Object.keys(R(this,Oi)))o==="$set"||o==="$destroy"||o==="$on"||or(this,o,{get(){return R(this,Oi)[o]},set(l){R(this,Oi)[o]=l},enumerable:!0});R(this,Oi).$set=o=>{Object.assign(n,o)},R(this,Oi).$destroy=()=>{ds(R(this,Oi))}}$set(e){R(this,Oi).$set(e)}$on(e,r){R(this,ps)[e]=R(this,ps)[e]||[] Line truncated
`:""}${(x=e.log.author)==null?void 0:x.name}
${(0,B0.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)}
${e.log.message}`}]),de("click",u,()=>se(n,!$(n))),ce(t,o),ct()}Tt(["click"]);var PU=he('<div class="tree-item nav-folder mod-root"></div>'),RU=he('<main class="git-view"><div class="nav-header"><div class="nav-buttons-container"><div id="layoutChange" class="clickable-icon nav-action-button" aria-label="Change Layout"></div> <div id="refresh" data-icon="refresh-cw" aria-label="Refresh"></div></div></div> <div class="nav-files-container" style="position: relative;"><!> <div id="sentinel"></div> <div style="margin-bottom:40px"></div></div></main>'),$U={hash:"svelte-12n6twc",code:""};function G0(t,e){lt(e,!0),an(t,$U);let r=Di(e,"plugin",15),i=Oe(!1),n=Qe([]),s=Oe(void 0),a=Oe(Qe(r().settings.treeStructure)),o;mr(()=>{o&&o.empty()}),co(()=>{e.view.registerEvent(e.view.app.workspace.on("obsidian-git:head-change",()=>void c().catch(console.error)))}),mr(()=>{n.forEach(k=>(0,U0.setIcon)(k,k.getAttr("data-icon")))}),co(()=>{let k=new IntersectionObserver(A=>{A[0].isIntersecting&&!$(i)&&u().catch(console.error)}),E=activeDocument.querySelector("#sentinel");return E&&k.observe(E),()=>{k.disconnect()}}),c().catch(console.error);function l(){c().catch(console.error)}function c(){return uo(this,void 0,void 0,function*(){var k;if(!r().gitReady){se(s,void 0);return}se(i,!0);let E=r().gitManager instanceof Se,A;((k=$(s)===null||$(s)===void 0?void 0:$(s).length)!==null&&k!==void 0?k:0)==0?A=E?50:10:A=$(s).length,se(s,yield r().gitManager.log(void 0,!1,A),!0),se(i,!1)})}function u(){return uo(this,void 0,void 0,function*(){var k;if(!r().gitReady||$(s)===void 0)return;se(i,!0);let A=r().gitManager instanceof Se?50:10,w=yield r().gitManager.log(void 0,!1,A,(k=$(s).last())===null||k===void 0?void 0:k.hash);$(s).push(...w.slice(1)),se(i,!1)})}var f=RU(),d=j(f),h=j(d),p=j(h);at(p,k=>n[0]=k,()=>n==null?void 0:n[0]);var g=te(p,2);let v;at(g,k=>n[1]=k,()=>n==null?void 0:n[1]),G(h),G(d);var _=te(d,2),b=j(_);{var S=k=>{var E=PU();pi(E,21,()=>$(s),hi,(A,w)=>{H0(A,{get view(){return e.view},get showTree(){return $(a)},get log(){return $(w)},get plugin(){return r()}})}),G(E),ce(k,E)};Re(b,k=>{$(s)&&k(S)})}Ga(4),G(_),G(f),Be(()=>{xe(p,"data-icon",$(a)?"list":"folder"),v=gt(g,1,"clickable-icon nav-action-button",null,v,{loading:$(i)})}),de("click",p,()=>{se(a,!$(a)),(0,U0.setIcon)(n[0],$(a)?"list":"folder"),r(r().settings.treeStructure=$(a),!0),r().saveSettings()}),de("click",g,l),ce(t,f),ct()}Tt(["click"]);var lf=class extends U$.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return bi.type}getDisplayText(){return bi.name}getIcon(){return bi.icon}onClose(){return this._view&&ds(this._view),super.onClose()}reload(){this._view&&ds(this._view),this._view=Xs(G0,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};m();var G$=require("obsidian"),Ep=class extends G$.FuzzySuggestModal{constructor(r,i){super(r.app);this.branches=i;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,i){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};m();var z$=require("obsidian");m();var po=require("obsidian");m();var cf=require("obsidian");m();var j$=require("obsidian");var oc=class extends j$.Modal{constructor({app:r,path:i,filesToDeleteCount:n,filesToDiscardCount:s}){super(r);this.resolve=null;this.path=i,this.deleteCount=n,this.discardCount=s}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:i,titleEl:n}=this,s="";this.path!=""&&(r>1?s=`files in "${this.path}"`:s=`"${this.path}"`),n.setText(`${this.discardCount==0?"Delete":"Discard"} ${s}`),this.deleteCount>0&&i.createEl("p").setText(`Are you sure you want to DELETE the ${cu(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&i.createEl("p").setText(`Are you sure you want to discard ALL changes in ${cu(this.discardCount,"tracked file")}?`);let a=i.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${cu(r,"file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("delete"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("delete"),this.close()})}if(this.discardCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`Discard all ${cu(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("discard"),this.close()})}let o=a.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>(this.resolve&&this.resol Line truncated
`);n.removed.lines.length>0&&!n.removed.no_nl_at_eof&&(c+=`
`),i.replaceRange(c,i.offsetToPos(o),i.offsetToPos(l)),i.setSelection(i.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,i=Wi.getHunk(r.state,!1,e),n=!1;if(i||(i=Wi.getHunk(r.state,!0,e),n=!0),!i)return;let s=r.state.field(W$.editorInfoField).file.path,a=Vt.createPatch(s,[i],"100644",n).join(`
`)+`
`;await this.gitManager.applyPatch(a),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=Wi.getHunks(r.state,!1),s=i.getCursor().line+1,a=Vt.findNearestHunk(s,n,e,!0);if(a==null)return;let o=n[a];if(o){let l=o.added.start-1;i.setCursor(l,0),i.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};m();m();var mo=require("obsidian");var Cp=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof mo.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),h2(()=>this.plg.settings.lineAuthor,e=>{this.plg.settings.lineAuthor=e,this.plg.saveSettings()})}conditionallyActivateBySettings(){this.plg.settings.lineAuthor.show&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;E2(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new ch(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),console.log(this.plg.manifest.name+": Enabled line authoring.")}catch(e){console.warn("Git: Error while loading line authoring feature.",e),this.deactivateFeature()}}deactivateFeature(){var e;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.lineAuthorInfoProvider)==null||e.destroy(),this.lineAuthorInfoProvider=void 0,console.log(this.plg.manifest.name+": Disabled line authoring.")}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&mo.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Se?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(D2),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.gutterContextMenuEvent=this.createGutterContextMenuHandler(),this.fileOpenEvent=this.createFileOpenEvent(),this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileModificationEvent=this.createVaultFileModificationHandler(),this.headChangeEvent=this.createHeadChangeEvent(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),w2(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.headChangeEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.gutterContextMenuEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.vault.offref(this.fileModificationEvent),this.plg.app.workspace.offref(this.headChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var r;return void((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e).catch(console.error))})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var i;return e instanceof mo.TFile&&((i=this.lineAuthorInfoProvider)==null?void 0:i.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof mo.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createHeadChangeEvent(){return this.plg.app.workspace.on("obsidian-git:head-change",()=>{this.refreshLineAuthorViews()})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",y2)}};m();var lc=require("obsidian");m();m();var go=require("@codemirror/state"),Pp=require("@codemirror/view");var Tp=class extends Pp.GutterMarker{constructor(r,i){super();this.type=r;this.staged=i}toDOM(r){let i=activeDocument.createElement("div");return i.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&i.setText("~"),i}},V0=go.StateField.define({create:()=>go.RangeSet.empty,update:(t,e)=>{let r=e.state.field(Hr,!1);if(!r)ret Line truncated
`+s),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,i,n,s){if(!this.gitReady||!this.settings.showFileMenu||!i)return;let a;if(typeof i=="string"?a=i:a=i.path,n=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof be.TFile?await this.stageFile(i):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof be.TFile?await this.unstageFile(i):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(a,i instanceof be.TFolder).catch(c=>this.displayError(c))})})),n=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.addFileToGitignore(a,i instanceof be.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;s==="obsidian-git:menu"&&o instanceof be.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(a)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(J$.join(o.getBasePath(),a))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,i;this.gitReady=!1,this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(i=this.statusBar)==null||i.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let n of this.intervalsToClear)window.clearInterval(n);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=Rk(ht,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return be.Platform.isDesktopApp}async init({fromReload:r=!1}){var i;if(this.settings.showStatusBar&&!this.statusBar){let n=this.addStatusBarItem();this.statusBar=new fh(n,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return(s=this.statusBar)==null?void 0:s.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Se(this),await this.gitManager.setGitInstance()):this.gitManager=new Vi(this);let n=await this.gitManager.checkRequirements(),s=this.localStorage.getPausedAutomatics();switch(n){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new be.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":if(this.gitReady=!0,this.setPluginState({gitAction:0}),be.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let a=this.addStatusBarItem();this.branchBar=new kp(a,this),this.intervalsToClear.push(window.setInterval(()=>{var o;return void((o=this.branchBar)==null?void 0:o.display().catch(console.error))},6e4))}await((i=this.branchBar)==null?void 0:i.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!s&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),s||await this.automaticsManager.init(),s&&new be.Notice("Automatic routines are currently paused.");break;default:this.log("Something weird happened. The 'checkRequirements' result is "+n)}}catch(n){this.displayError(n),console.error(n)}}async createNewRepo(){try{await this.gitManager.init(),new be.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let i=await new et(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(i){let n="Vault Root",s=await new et(this,{options:this.gitManager instanceof Vi?[n]:[],placeholder Line truncated
# Additional Instructions
I strongly recommend to use "Source mode" for viewing the conflicted files. For simple conflicts, in each file listed above replace every occurrence of the following text blocks with the desired text.
\`\`\`diff
<<<<<<< HEAD
File changes in local repository
=======
File changes in remote repository
>>>>>>> origin/main
\`\`\``]),await this.tools.writeAndOpenFile(i==null?void 0:i.join(`
`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new et(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(n){let s=await this.gitManager.getRemoteUrl(n),o=await new et(this,{initialValue:s,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(n,sv(o)),n}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),i;r.length===0&&(i=await this.editRemotes(),i==null&&(r=await this.gitManager.getRemotes()));let n=new et(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),s=i!=null?i:await n.openAndGetResult();if(s){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(s);let a=await this.gitManager.getRemoteBranches(s),l=await new et(this,{options:a,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(s+"/")?l:`${s}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new et(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();n&&await this.gitManager.removeRemote(n)}onActiveLeafChange(r){var a,o;let i=r==null?void 0:r.view;if(!(i!=null&&i.getState().file)&&!(i instanceof La||i instanceof Na))return;let n=this.app.workspace.getLeavesOfType(Kt.type).first(),s=this.app.workspace.getLeavesOfType(bi.type).first();if((a=n==null?void 0:n.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||a.removeClass("is-active"),(o=s==null?void 0:s.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof La||(r==null?void 0:r.view)instanceof Na){let c=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let u;n&&r.view.state.aRef=="HEAD"?u=n.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${c}"]`):n&&r.view.state.aRef==""?u=n.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${c}"]`):s&&(u=s.view.containerEl.querySelector(`div.tree-item-self[data-path='${c}']`)),u==null||u.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(r,i=4*1e3){var n;(n=this.statusBar)==null||n.displayMessage(r.toLowerCase(),i),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new be.Notice(r,5*1e3),this.log(r)}displayError(r,i=10*1e3){var s;if(r instanceof Q$.Errors.UserCanceledError){new be.Notice("Aborted");return}let n;r instanceof Error?n=r:n=new Error(String(r)),this.setPluginState({gitAction:0}),this.settings.showErrorNotices&&new be.Notice(n.message,i),console.error(`${this.manifest.id}:`,n.stack),(s=this.statusBar)==null||s.displayMessage(n.message.toLowerCase(),i)}log(...r){console.log(`${this.manifest.id}:`,...r)}};
/*! Bundled license information:
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
crc-32/crc32.js:
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
isomorphic-git/index.cjs:
(*!
* This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
* SPDX-License-Identifier: LGPL-3.0-or-later
* Copyright (c) James Prevett and other ZenFS contributors.
*)
js-sha256/src/sha256.js:
(**
* [js-sha256]{@link https://github.com/emn178/js-sha256}
*
* @version 0.9.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*)
*/
/* nosourcemap */
+10
View File
@@ -0,0 +1,10 @@
{
"author": "Vinzent",
"authorUrl": "https://github.com/Vinzent03",
"id": "obsidian-git",
"name": "Git",
"description": "Integrate Git version control with automatic backup and other advanced features.",
"isDesktopOnly": false,
"fundingUrl": "https://ko-fi.com/vinzent",
"version": "2.38.3"
}
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
PROMPT="$1"
TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT"
cleanup() {
rm -f "$TEMP_FILE" "$TEMP_FILE.response"
}
trap cleanup EXIT
echo "$PROMPT" > "$TEMP_FILE"
while [ ! -e "$TEMP_FILE.response" ]; do
if [ ! -e "$TEMP_FILE" ]; then
echo "Trigger file got removed: Abort" >&2
exit 1
fi
sleep 0.1
done
RESPONSE=$(cat "$TEMP_FILE.response")
echo "$RESPONSE"
+705
View File
@@ -0,0 +1,705 @@
@keyframes loading {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.workspace-leaf-content[data-type="git-view"] .button-border {
border: 2px solid var(--interactive-accent);
border-radius: var(--radius-s);
}
.workspace-leaf-content[data-type="git-view"] .view-content {
padding-left: 0;
padding-top: 0;
padding-right: 0;
}
.workspace-leaf-content[data-type="git-history-view"] .view-content {
padding-left: 0;
padding-top: 0;
padding-right: 0;
}
.loading {
overflow: hidden;
}
.loading > svg {
animation: 2s linear infinite loading;
transform-origin: 50% 50%;
display: inline-block;
}
.obsidian-git-center {
margin: auto;
text-align: center;
width: 50%;
}
.obsidian-git-textarea {
display: block;
margin-left: auto;
margin-right: auto;
}
.obsidian-git-disabled {
opacity: 0.5;
}
.obsidian-git-center-button {
display: block;
margin: 20px auto;
}
.tooltip.mod-left {
overflow-wrap: break-word;
}
.tooltip.mod-right {
overflow-wrap: break-word;
}
/* Limits the scrollbar to the view body */
.git-view {
display: flex;
flex-direction: column;
position: relative;
height: 100%;
}
/* Re-enable wrapping of nav buttns to prevent overflow on smaller screens #*/
.workspace-drawer .git-view .nav-buttons-container {
flex-wrap: wrap;
}
.git-tools {
display: flex;
margin-left: auto;
}
.git-tools .type {
padding-left: var(--size-2-1);
display: flex;
align-items: center;
justify-content: center;
width: 11px;
}
.git-tools .type[data-type="M"] {
color: orange;
}
.git-tools .type[data-type="D"] {
color: red;
}
.git-tools .buttons {
display: flex;
}
.git-tools .buttons > * {
padding: 0;
height: auto;
}
.workspace-leaf-content[data-type="git-view"] .tree-item-self,
.workspace-leaf-content[data-type="git-history-view"] .tree-item-self {
align-items: center;
}
.workspace-leaf-content[data-type="git-view"]
.tree-item-self:hover
.clickable-icon,
.workspace-leaf-content[data-type="git-history-view"]
.tree-item-self:hover
.clickable-icon {
color: var(--icon-color-hover);
}
/* Highlight an item as active if it's diff is currently opened */
.is-active .git-tools .buttons > * {
color: var(--nav-item-color-active);
}
.git-author {
color: var(--text-accent);
}
.git-date {
color: var(--text-accent);
}
.git-ref {
color: var(--text-accent);
}
/* ====== diff2html ======
The following styles are adapted from the obsidian-version-history plugin by
@kometenstaub https://github.com/kometenstaub/obsidian-version-history-diff/blob/main/src/styles.scss
which itself is adapted from the diff2html library with the following original license:
https://github.com/rtfpessoa/diff2html/blob/master/LICENSE.md
Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
.theme-dark,
.theme-light {
--git-delete-bg: #ff475040;
--git-delete-hl: #96050a75;
--git-insert-bg: #68d36840;
--git-insert-hl: #23c02350;
--git-change-bg: #ffd55840;
--git-selected: #3572b0;
--git-delete: #cc3333;
--git-insert: #399839;
--git-change: #d0b44c;
--git-move: #3572b0;
}
.git-diff {
.d2h-d-none {
display: none;
}
.d2h-wrapper {
text-align: left;
border-radius: 0.25em;
overflow: auto;
}
.d2h-file-header.d2h-file-header {
background-color: var(--background-secondary);
border-bottom: 1px solid var(--background-modifier-border);
font-family:
Source Sans Pro,
Helvetica Neue,
Helvetica,
Arial,
sans-serif;
height: 35px;
padding: 5px 10px;
}
.d2h-file-header,
.d2h-file-stats {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.d2h-file-header {
display: none;
}
.d2h-file-stats {
font-size: 14px;
margin-left: auto;
}
.d2h-lines-added {
border: 1px solid var(--color-green);
border-radius: 5px 0 0 5px;
color: var(--color-green);
padding: 2px;
text-align: right;
vertical-align: middle;
}
.d2h-lines-deleted {
border: 1px solid var(--color-red);
border-radius: 0 5px 5px 0;
color: var(--color-red);
margin-left: 1px;
padding: 2px;
text-align: left;
vertical-align: middle;
}
.d2h-file-name-wrapper {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 15px;
width: 100%;
}
.d2h-file-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--text-normal);
font-size: var(--h5-size);
}
.d2h-file-wrapper {
border: 1px solid var(--background-secondary-alt);
border-radius: 3px;
margin-bottom: 1em;
max-height: 100%;
}
.d2h-file-collapse {
-webkit-box-pack: end;
-ms-flex-pack: end;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
border: 1px solid var(--background-secondary-alt);
border-radius: 3px;
cursor: pointer;
display: none;
font-size: 12px;
justify-content: flex-end;
padding: 4px 8px;
}
.d2h-file-collapse.d2h-selected {
background-color: var(--git-selected);
}
.d2h-file-collapse-input {
margin: 0 4px 0 0;
}
.d2h-diff-table {
border-collapse: collapse;
font-family: var(--font-monospace);
font-size: var(--code-size);
width: 100%;
}
.d2h-files-diff {
width: 100%;
}
.d2h-file-diff {
/*
overflow-y: scroll;
*/
border-radius: 5px;
font-size: var(--font-text-size);
line-height: var(--line-height-normal);
}
.d2h-file-side-diff {
display: inline-block;
margin-bottom: -8px;
margin-right: -4px;
overflow-x: scroll;
overflow-y: hidden;
width: 50%;
}
.d2h-code-line {
padding-left: 6em;
padding-right: 1.5em;
}
.d2h-code-line,
.d2h-code-side-line {
display: inline-block;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 100%;
}
.d2h-code-side-line {
/* needed to be changed */
padding-left: 0.5em;
padding-right: 0.5em;
}
.d2h-code-line-ctn {
word-wrap: normal;
background: none;
display: inline-block;
padding: 0;
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
vertical-align: middle;
width: 100%;
/* only works for line-by-line */
white-space: pre-wrap;
}
.d2h-code-line del,
.d2h-code-side-line del {
background-color: var(--git-delete-hl);
color: var(--text-normal);
}
.d2h-code-line del,
.d2h-code-line ins,
.d2h-code-side-line del,
.d2h-code-side-line ins {
border-radius: 0.2em;
display: inline-block;
margin-top: -1px;
text-decoration: none;
vertical-align: middle;
}
.d2h-code-line ins,
.d2h-code-side-line ins {
background-color: var(--git-insert-hl);
text-align: left;
}
.d2h-code-line-prefix {
word-wrap: normal;
background: none;
display: inline;
padding: 0;
white-space: pre;
}
.line-num1 {
float: left;
}
.line-num1,
.line-num2 {
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
/*
padding: 0 0.5em;
*/
text-overflow: ellipsis;
width: 2.5em;
padding-left: 0;
}
.line-num2 {
float: right;
}
.d2h-code-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-faint);
cursor: pointer;
display: inline-block;
position: absolute;
text-align: right;
width: 5.5em;
}
.d2h-code-linenumber:after {
content: "\200b";
}
.d2h-code-side-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-faint);
cursor: pointer;
overflow: hidden;
padding: 0 0.5em;
text-align: right;
text-overflow: ellipsis;
width: 4em;
/* needed to be changed */
display: table-cell;
position: relative;
}
.d2h-code-side-linenumber:after {
content: "\200b";
}
.d2h-code-side-emptyplaceholder,
.d2h-emptyplaceholder {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
}
.d2h-code-line-prefix,
.d2h-code-linenumber,
.d2h-code-side-linenumber,
.d2h-emptyplaceholder {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.d2h-code-linenumber,
.d2h-code-side-linenumber {
direction: rtl;
}
.d2h-del {
background-color: var(--git-delete-bg);
border-color: var(--git-delete-hl);
}
.d2h-ins {
background-color: var(--git-insert-bg);
border-color: var(--git-insert-hl);
}
.d2h-info {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
color: var(--text-faint);
}
.d2h-del,
.d2h-ins,
.d2h-file-diff .d2h-change {
color: var(--text-normal);
}
.d2h-file-diff .d2h-del.d2h-change {
background-color: var(--git-change-bg);
}
.d2h-file-diff .d2h-ins.d2h-change {
background-color: var(--git-insert-bg);
}
.d2h-file-list-wrapper {
a {
text-decoration: none;
cursor: default;
-webkit-user-drag: none;
}
svg {
display: none;
}
}
.d2h-file-list-header {
text-align: left;
}
.d2h-file-list-title {
display: none;
}
.d2h-file-list-line {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
text-align: left;
}
.d2h-file-list {
}
.d2h-file-list > li {
border-bottom: 1px solid var(--background-modifier-border);
margin: 0;
padding: 5px 10px;
}
.d2h-file-list > li:last-child {
border-bottom: none;
}
.d2h-file-switch {
cursor: pointer;
display: none;
font-size: 10px;
}
.d2h-icon {
fill: currentColor;
margin-right: 10px;
vertical-align: middle;
}
.d2h-deleted {
color: var(--git-delete);
}
.d2h-added {
color: var(--git-insert);
}
.d2h-changed {
color: var(--git-change);
}
.d2h-moved {
color: var(--git-move);
}
.d2h-tag {
background-color: var(--background-secondary);
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 10px;
margin-left: 5px;
padding: 0 2px;
}
.d2h-deleted-tag {
border: 1px solid var(--git-delete);
}
.d2h-added-tag {
border: 1px solid var(--git-insert);
}
.d2h-changed-tag {
border: 1px solid var(--git-change);
}
.d2h-moved-tag {
border: 1px solid var(--git-move);
}
/* needed for line-by-line*/
.d2h-diff-tbody {
position: relative;
}
/* My additions */
.cm-merge-revert {
width: 4em;
}
/* Ensure that merge revert markers are positioned correctly */
.cm-merge-revert > * {
position: absolute;
background-color: var(--background-secondary);
display: flex;
}
}
/* ====================== Line Authoring Information ====================== */
.cm-gutterElement.obs-git-blame-gutter {
/* Add background color to spacing inbetween and around the gutter for better aesthetics */
border-width: 0px 2px 0.2px;
border-style: solid;
border-color: var(--background-secondary);
background-color: var(--background-secondary);
}
.cm-gutterElement.obs-git-blame-gutter > div,
.line-author-settings-preview {
/* delegate text color to settings */
color: var(--obs-git-gutter-text);
font-family: monospace;
height: 100%; /* ensure, that age-based background color occupies entire parent */
text-align: right;
padding: 0px 6px;
white-space: pre; /* Keep spaces and do not collapse them. */
}
@media (max-width: 800px) {
/* hide git blame gutter not to superpose text */
.cm-gutterElement.obs-git-blame-gutter {
display: none;
}
}
.git-unified-diff-view,
.git-split-diff-view .cm-deletedLine .cm-changedText {
background-color: #ee443330;
}
.git-unified-diff-view,
.git-split-diff-view .cm-insertedLine .cm-changedText {
background-color: #22bb2230;
}
.git-obscure-prompt[git-is-obscured="true"] #git-show-password:after {
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-eye"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></svg>');
}
.git-obscure-prompt[git-is-obscured="false"] #git-show-password:after {
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-eye-off"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"></path><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"></path><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"></path><path d="m2 2 20 20"></path></svg>');
}
/* Override styling of Codemirror merge view "collapsed lines" indicator */
.git-split-diff-view .ͼ2 .cm-collapsedLines {
background: var(--interactive-normal);
border-radius: var(--radius-m);
color: var(--text-accent);
font-size: var(--font-small);
padding: var(--size-4-1) var(--size-4-1);
}
.git-split-diff-view .ͼ2 .cm-collapsedLines:hover {
background: var(--interactive-hover);
color: var(--text-accent-hover);
}
.git-signs-gutter {
.cm-gutterElement {
display: grid;
/* Needed to align the sign properly for different line heigts. Such as
* when having a heading or list item.
*/
padding-top: 0 !important;
}
}
.git-gutter-marker:hover {
border-radius: 2px;
}
.git-gutter-marker.git-add {
background-color: var(--color-green);
justify-self: center;
height: inherit;
width: 0.2rem;
}
.git-gutter-marker.git-change {
background-color: var(--color-yellow);
justify-self: center;
height: inherit;
width: 0.2rem;
}
.git-gutter-marker.git-changedelete {
color: var(--color-yellow);
font-weight: var(--font-bold);
font-size: 1rem;
justify-self: center;
height: inherit;
}
.git-gutter-marker.git-delete {
background-color: var(--color-red);
height: 0.2rem;
width: 0.8rem;
align-self: end;
}
.git-gutter-marker.git-topdelete {
background-color: var(--color-red);
height: 0.2rem;
width: 0.8rem;
align-self: start;
}
div:hover > .git-gutter-marker.git-change {
width: 0.6rem;
}
div:hover > .git-gutter-marker.git-add {
width: 0.6rem;
}
div:hover > .git-gutter-marker.git-delete {
height: 0.6rem;
}
div:hover > .git-gutter-marker.git-topdelete {
height: 0.6rem;
}
div:hover > .git-gutter-marker.git-changedelete {
font-weight: var(--font-bold);
}
.git-gutter-marker.staged {
opacity: 0.5;
}
/* Prevent shifting of the editor when git signs gutter is the only gutter present */
.cm-gutters.cm-gutters-before:has(> .git-signs-gutter:only-child) {
margin-inline-end: 0;
.git-signs-gutter {
margin-inline-start: -1rem;
}
}
.git-changes-status-bar-colored {
.git-add {
color: var(--color-green);
}
.git-change {
color: var(--color-yellow);
}
.git-delete {
color: var(--color-red);
}
}
.git-changes-status-bar .git-add {
margin-right: 0.3em;
}
.git-changes-status-bar .git-change {
margin-right: 0.3em;
}
File diff suppressed because it is too large. Load diff
+10
View File
@@ -0,0 +1,10 @@
{
"id": "obsidian-image-toolkit",
"name": "Image Toolkit",
"version": "1.4.3",
"minAppVersion": "1.8.7",
"description": "Click images to preview with zoom, move, rotate, flip, invert, and copy.",
"author": "Xiangru",
"authorUrl": "https://github.com/sissilab",
"isDesktopOnly": true
}
+319
View File
@@ -0,0 +1,319 @@
body {
--layer-image-toolkit-popup: 1024;
--layer-image-toolkit-player: 1025;
--layer-image-toolkit-notice: 1026;
}
.notice-container {
z-index: var(--layer-image-toolkit-notice);
}
.oit li::before {
margin-left: 0;
}
.image-toolkit-img-invert {
filter: invert(1) hue-rotate(180deg);
mix-blend-mode: screen;
}
.oit-normal {
position: fixed;
font-size: 0;
line-height: 0;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, .6);
z-index: var(--layer-image-toolkit-popup);
display: none;
}
.oit-pin {
position: fixed;
font-size: 0;
line-height: 0;
z-index: var(--layer-image-toolkit-popup);
display: none;
}
.oit .oit-img-container {
position: fixed;
top: 0;
pointer-events: none;
}
.oit .oit-img-container .oit-img-view {
max-height: none;
pointer-events: auto;
}
.oit-pin .oit-img-container .oit-img-view {
position: fixed;
pointer-events: auto;
box-shadow: 0 0 5px;
}
.oit-pin .oit-img-container .oit-img-view:hover {
box-shadow: 0 0 6px #55acc6;
}
.oit .img-default-background {
background-position: 0 0, 5px 5px !important;
background-size: 10px 10px !important;
background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%), linear-gradient(45deg, #eee 25%, #fff 25%, #fff 75%, #eee 75%, #eee 100%) !important;
}
.oit .oit-img-container .oit-img-view:hover {
cursor: pointer;
}
.oit-normal .img-close {
position: absolute;
width: 32px;
height: 32px;
top: 0;
right: 0;
cursor: pointer;
}
.oit .oit-img-tip {
position: absolute;
top: 50%;
left: 50%;
font-size: 12px;
line-height: 20px;
height: 20px;
width: 50px;
text-align: center;
color: #fff;
border-radius: 10px;
background-color: rgba(0, 0, 0, .4);
pointer-events: none;
z-index: 1;
}
/*region img-player*/
.oit .img-player {
display: none;
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
cursor: none;
background-color: #000;
text-align: center;
cursor: pointer;
}
.oit .img-player > img {
display: inline;
float: none;
padding: 0;
max-height: none;
transform: none;
cursor: pointer;
}
/*endregion*/
.oit-normal .oit-img-footer {
position: absolute;
text-align: center;
bottom: 5px;
left: 0;
right: 0;
}
/*region oit-img-title*/
.oit-normal .oit-img-footer .oit-img-title {
font-size: 12px;
line-height: 1;
display: inline-block;
max-width: 90%;
white-space: nowrap;
text-overflow: ellipsis;
margin: 5px;
opacity: .8;
color: #fff;
/* filter: alpha(opacity=80) */
}
.oit-normal .oit-img-footer .oit-img-title:hover {
/* opacity: 1; */
color: #fff;
font-size: 15px;
background-color: rgba(0, 0, 0, .3);
border-radius: 8px;
line-height: 1.5;
/* filter: alpha(opacity=100) */
}
/*endregion*/
/*region toolbar*/
.oit-normal .oit-img-footer .oit-img-toolbar {
width: 385px;
height: 30px;
margin: 0 auto 5px;
padding: 3px 0;
}
.oit-normal .oit-img-footer .oit-img-toolbar:hover {
background-color: rgba(0, 0, 0, .3);
border-radius: 12px;
}
.oit-normal .oit-img-footer .oit-img-toolbar > li {
float: left;
width: 25px;
height: 25px;
margin: 0 5px;
padding: 0;
line-height: 0;
border: none;
cursor: pointer;
overflow: hidden;
}
.oit-normal .oit-img-footer .oit-img-toolbar > li:hover {
animation: bounce .5s cubic-bezier(0.51, 0.23, 0.02, 0.96)
}
@keyframes bounce {
0% {
transform: scale(1, 1);
}
50% {
transform: scale(0.85, 1.1) translateY(-5px);
}
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_zoom_to_100::before,
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_zoom_in::before,
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_zoom_out::before,
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_full_screen::before,
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_refresh::before,
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_rotate_left::before,
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_rotate_right::before,
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_scale_x::before,
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_scale_y::before,
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_invert_color::before,
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_copy::before {
font-size: 0;
line-height: 0;
display: block;
width: 25px;
height: 25px;
color: transparent;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARMAAAAZCAYAAAASRcpqAAAAAXNSR0IArs4c6QAADgJJREFUeF7tXHnQftUc/3z+YJC9KVuWsZOlIiopTYakZZpIJSUiS6JkLKGFYkJJRJsKpUVEhYpItiZFUtknJGQXmRHzMZ/H97xz3vuce++5z3ufX696z8wz77zPc+75nnPu93zO57ucQ6yUlRlYmYGVGRhhBjhCG7e7JiQd2Bw0yanv2iZmqc/f7iZ8ZcBznwFJDwPwopKgWt3uBBNJ6wJYH8DjADwFwFMBfAPAtwB8H8B5JP+01JFKenkM5EEA/HH73wXwVZJnLrV9Pz+WjACCAwp9WpvkNX19lfR8AGcU6h1U89IkPQHAzgAeCuCxANYGcHl8rgZwLckL+/rR97uk7QA8EYDl+bO63weAryd5JG/qa6f0u6S7A9gwPhvE399Gu1cBuIbkZ2dp+9Z8RtKTALwXwNFj6W3L/J1BcoexxirpwwBe0dHegSQP6pPXCiaS3gng9QDuFI3cEkDyNAB3iO9+AsCL4JQ+QS2T4oX1RgB+CW3FC+RTNQttVchogImB7mjLJemFVlUkPSMqvgqA58ClE0wkPQDA3gBeA+DOPYLeRtLvb6EEmB4DYE+Sx0o6DID7sQvJH6eKku4N4H0AXtwj45cA3k3SilhdJG0D4HAA3gm7yknWv3yzkvQQAF+JTWb3aqGroGK8048BeGCI22EegCLJG5F15swxACVrz93erKnHkhTzvVnfNBbBRJJ32MckJQfwNQCXkLxFkoHk6fFJ1P4Ukrv0CWso90cBJIXwznqld6TYnbzjPh7ARrEr+tFjSe55a8vIwMRAMvNLzZUi2mkFE0meDyuRWYjLFwGcDMC7uYt3ei+0TQBsH999Mhbjb/x/1u+JHElelAaTBQWStHEsdLNRl8sCLK+L/+8K4MkAzCaeHd+ZnW5V814kHQrgzVH3gmC3Zrp/ie/uB8AsNYGt5e9L0mzIY/D3CUx6lbumT2PUkeTxfwLAPRrtjQoojYVvUUsClKw9sw6z7XHBRNKXAGwO4DsAduui7vFyzUruD2Avkh+qeTmNSZnslKXnJHkHPhHAC+L3k0hW7UjzkpEtSitzYhaDXmoDSMxsvECKYNIAEpt/R3TteJK82K0cW8Zi3Z3kFX1gImnXAI7VAFwK4F1dpoYkA/tbwiw1M+szmb3DubjtI0ka7IpF0rYBOjar/2GAIXnqMgaTNLap8fTNS816CSBNjMT/psU/M6A0gMSs2jo4HphIsgPGVO0sks8bMNBfAVjLNjZJ+1JaS24m1E60JO+C3o1dvDhMgW8VGTmYmBIOpZ3N+tkCmQKTYIHfBrDe0F0o6+cvALwMgM1T7z5TzASAfWM2PZKiHkryX33vvwF0Bh+Dy1SRdC6A5wL4Msln9rUbi+eOAVbJP2Wb/kfLlJkkJuW/kzkO/9Ig87dtXhobo30lZqi5327WzSzpQmJ8rWAC4PyMjeZdvS5t8Au7STj2TCfvZqZBckKPa0o4aq8AcAHJRH9LSmUaa8ZjJvMRkq/MK0nybvqGMGkW7VySPHk2q0y51yP55xbF7ZTRA0K1MjYleXFqqxZQ2upJWofk95p9k7Rv+C+qTYnGfL4HwH4A/gjggy1g8nYABycgGeqbagDKtiQ/1+iD37HZ1w8AbE0ymUw1qpWbZ67/VgD2Bdkxv2zMnEwPrJ8LgF01wJ5KTSAxK20JAlQBiqTjAbw01tKCDvcwk9TLkl/QQDQBpRxMXh0KVxVVKCh+msh1SwsjdpvEfK4kuU5HG6Vd+i4RSfAuuiPJ01vApFNGD5hUyWiR2+kYqwWcTDHvA8CsxL6Q7Ul+ehblzDz1Zhre7ZvMJDU703uP92rH8JEAfhbs1KaJgcDzeW2YQq8l+YEZx5BAfkGpbw9gIin3Ky74XzoiiieSfEnbHAfwO6DRVhZFJLPIo58xG2pjLlNgkhBrK5LnhTKYJWzZfHGS7LE2Xd01/SbpheGEajVDJB0B4HUlVhLyOpFd0gkAPFknkNyjZVF3yuhT5hoZHS/LgLIWSTuOFxVJZmQ/r/XAz+ofCEXbtNDHRMVLYFLacezwbvVr5O1Lulc40K0XG5I0CBpM7L+xE9VmsE3gIpsszFViqM2f0hiKzCQcoeeUlL5nE0k0f0H3+/SkRfdGYyaSdgSQ5n+RI7cDTNytnUie1tO/Equ7iaQDIZPSAJK9epjLFJjYTHEEZbVkL0tyRMcx/wmDsYCgWemlHpCBiXMRHJF5P8l9WgaTIgivJjkJqUraCcCjsvrJ5kxfnZpCl5IcqnYcv5XmZlGKLhnN7g2SMYuizfJMAMqNNfkrmRLYCW7HcFvZg+QJkuzY7gr/7kfSIeKqIsmOeOe/2Fl6XLzbxBKrHefxnPvl/rWVs0k6D2ahxFydHRGVqR20axAZcP8VwDYkHb0cXJpO7sENxAMRnrcJ4vyuKV9UD5jYnLQZPpX/lZ7r81U2gMQ+mjWHgkkxnuw4cwYm3nltm9luc77APjlr6YtJt4QjE8C0zf0CcNTs1qtCxqxKsiqek2SfUQ7Oi8TmeQRZvkupa5eRnJgrNUXSm6z4AI4iabPHG4WB3xvAIBNHkv12rblHhVwI1/1MluPRm2BVGFNyaDp/ZjtHwGrG3QC0UZhJxkqcuLkJyb+3yGnrYpGd1IBJE0i8kWXrrtrMsfPVWa5mJk5Qm5QcTBoDcj6Dw8ETypTZY87+s/9lqlSyhhVmMlSLl0H9EtCXgH0eXc3kjNX8TA7eEZlJAqXjSDrvZlHpYSau25ZmMGm3jZlIWgOA/SM3OlG0IbYrD2XKzEme/81JXhTK4QQ1JxctQqT4zenVtqXckEOkKU28dReSZPprX8dUJCcAqdZnsj9JJ0CVAKtTRp+2ZT6TVhl9bSz19x7GcDXJ3y9VxtjPZyZoiZksmJxjyw29aTIT61Ep78Xsuy0fZjkxEyfA2QdZnLcKMCkmkfYxE0lmlmaYpWJ/inFg0RGKsEamwCTZt5M8/FDo3SIU63j5AnWMMK29uxPPcNRPQODwn/MKSgs91XEuygYk/5lX6kJ2SfcMu81RoPVJ2qE5WEaXMtfKmMeCSG1KsoPaTuS2cg5Jm5hVJRjjml3p/n7XQ44DtMx7co6XfCbFzaNqAFGpr4+3MZ9JyssprqUKMCmmElSAycTl0OdTaaxZA/QUmPhMhr3wj5jBG24q5nMfl5O0B79Ywp5PeSank7THeqFIemS0Yyehw4z5b0lZO1P3+2T0gEmVjI7x2ae0RilsKembAK7vi+Y0FKUUZbl4SC5In6kxBjWPELDNZIftS9Ec2/4bk7x5CIBkAFvli7itRHMkHRIJe53mSsdcOulw/+bvqwxMLDgL795A0gfLqkpQHdfduS+c2FgsW5B0Zl1naTzTezp3VcgovKhR8kyyvqe8kJNJ9h26awPvFPL078V5k/QcAJ8H4IXuBe+FP6hkfe7KM5kpjyUSIg1UzllxmsIXBnVuFVYeA5hjHaZo1vkkt2gDhY6hFdMzVimYxECSvXZ9hMlalStzuvnRaqeVJOexOJfAxebTYaVdK1jGqdnBr3/7FDPJ//TpyDxlNDNWaxPSOjJgFzJqc4WMU8LO4Wh1anfNgyQf47dJdBpJh+DbQCe98856pYcbi70rA3YmsJLkXAsz2MGHSft0ZOzfRwQTH5+wlWCf5dTx/x4zx8ETuxCmolHZc10n3Jdu5uQTKyllw6bF7qsGrvK5m0i7dz6KzaHktHLnvAueS3LrmpckKTl8Xd2A5U/z1LBPsTrW7pKy8P4A4OEknRPQWeYhY95ncxpg4oQvH/F3MtignT0DrptJ+vBea5HkA3WTRDNnQZP0NQe9JTYTn5N6cCkfIjWQnc1xKr0THS/pbfx/TNmmc4pmeIH4kOCyK5nDfLSzOZKc4+PjFC6rN65iSGZfaS4OJ+lwfLFIcgjd/se2Mi6YWEqAhhf8szoEG0Rsn10oyZmHPopdvbtFwpoH3nWfiamzj60bTNIx/J+Go+jXfZo1towcTOZxari5u8VC96lqJwXaHHFor+h8jvfmqJqTBn35kMtGJH3auLM0Lm3y5Uq+E6V18UryQVCnezsnZMip4b85i5nkWR0K7ysQ0n0rrjbqUf6+uRj6e2bmTz06xJnZfFiSr5jwsQoX3zszuTeog5n8juR9h/Y/1U/+tSF9LkZzOl6soyf++NYt//VCNlP5YeFQV6Kkx5P0SdWqEhf3uG2fPJ4oZ9zV4Vj3RSkNu3GozDTOPhqfJO0tY8nIXuRc7jMpUeUw97xTJVPFC9EOXe/0KdPRZ3h8gMtszsXAY0f2kAObzVvgDCYe50KadYCaI3/J0V59CLFxn4kzNb04EiNyn31vi/uQMqyXPZDE4vaJaI9l9PtMJPk0d8oo9+bptefs2OZtf76aIjGZ3vVQqjB3MBnaqyyXZGbHYZfMBqBMpVUP7W/LpOaXES2S0dgVRr9pLWMIU7uxJJ+afUfPGG8A4FybQ/Lkw9p5CSZkM8d5Dl1l3jeteXE6Z2VZmjbNiZHki6k+nu53GZNNSbIT1qe7E9vMxZt1HkwyXdFR+6qn6i07MAmkth3tHBXfVZkuNpp5kIUX58Xu8JlPH1df5DykAwFaUzI6KKZtzfxId1Fcx8nNKp+IJJud6V7WdEerTUD7m/w5ZggbaZuTiPLYSe7U/EcHY5znHbBmWO6/d15HMZZt1KZjzuw4NYOcyx2wcWbH/i1/DLKXjnEHcxqPpOSIH7JUXHdvkkfN7XZ6Sb4iwMlSy+7eiaEzVQCzldvplzqJK88vyxmIzXJI35yRPbn0fW5gMqQ3K3VXZmBlBv7/Z+C/kQ6WkguncSQAAAAASUVORK5CYII=);
background-repeat: no-repeat
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_zoom_to_100::before {
content: 'Zoom to Actual Size';
background-position: 0 0
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_zoom_in::before {
content: 'Zoom In';
background-position: -25px 0
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_zoom_out::before {
content: 'Zoom Out';
background-position: -50px 0
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_full_screen::before {
content: 'Full Screen';
background-position: -75px 0
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_refresh::before {
content: 'Refresh';
background-position: -100px 0
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_rotate_left::before {
content: 'Rotate Left';
background-position: -125px 0
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_rotate_right::before {
content: 'Rotate Right';
background-position: -150px 0
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_scale_x::before {
content: 'Scale x';
background-position: -175px 0
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_scale_y::before {
content: 'Scale y';
background-position: -200px 0
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_invert_color::before {
content: 'Invert color';
background-position: -225px 0
}
.oit-normal .oit-img-footer .oit-img-toolbar .toolbar_copy::before {
content: 'Copy';
background-position: -250px 0
}
/*endregion*/
/*region gallery-navbar*/
.oit-normal .oit-img-footer .gallery-navbar {
position: relative;
flex: 0 0 auto;
overflow: hidden;
max-width: 100%;
max-height: 100%;
width: 100%;
height: 60px;
margin-top: 20px;
background-color: rgba(0, 0, 0, .1);
}
.oit-normal .oit-img-footer .gallery-navbar:hover {
background-color: rgba(0, 0, 0, .8);
}
.oit-normal .oit-img-footer .gallery-navbar .gallery-list {
display: flex;
transform: translateX(0px);
cursor: pointer;
}
.oit-normal .oit-img-footer .gallery-navbar .gallery-list .gallery-active {
opacity: 1;
}
.oit-normal .oit-img-footer .gallery-navbar .gallery-list .img-border-active {
margin-top: 1px;
border-width: 1px;
border-style: solid;
border-color: red;
}
.oit-normal .oit-img-footer .gallery-navbar .gallery-list > li {
width: 48px;
height: 58px;
opacity: .3;
color: transparent;
margin: 2px 1px;
padding: 0;
border-radius: 0;
/* transition: all 100ms linear; */
}
.oit-normal .oit-img-footer .gallery-navbar .gallery-list img {
width: 46px;
height: 56px;
}
/*endregion*/
+505
View File
@@ -0,0 +1,505 @@
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var nr=Object.defineProperty,qa=Object.defineProperties,ja=Object.getOwnPropertyDescriptor,Za=Object.getOwnPropertyDescriptors,Xa=Object.getOwnPropertyNames,qi=Object.getOwnPropertySymbols;var ji=Object.prototype.hasOwnProperty,Wa=Object.prototype.propertyIsEnumerable;var pn=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t);var un=(t,e,r)=>e in t?nr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oe=(t,e)=>{for(var r in e||(e={}))ji.call(e,r)&&un(t,r,e[r]);if(qi)for(var r of qi(e))Wa.call(e,r)&&un(t,r,e[r]);return t},ye=(t,e)=>qa(t,Za(e));var Va=(t,e)=>{for(var r in e)nr(t,r,{get:e[r],enumerable:!0})},Ia=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Xa(e))!ji.call(t,i)&&i!==r&&nr(t,i,{get:()=>e[i],enumerable:!(n=ja(e,i))||n.enumerable});return t};var Ma=t=>Ia(nr({},"__esModule",{value:!0}),t);var Zi=(t,e,r)=>(un(t,typeof e!="symbol"?e+"":e,r),r);var v=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())}),Ga=function(t,e){this[0]=t,this[1]=e};var Xi=t=>{var e=t[pn("asyncIterator")],r=!1,n,i={};return e==null?(e=t[pn("iterator")](),n=s=>i[s]=o=>e[s](o)):(e=e.call(t),n=s=>i[s]=o=>{if(r){if(r=!1,s==="throw")throw o;return o}return r=!0,{done:!1,value:new Ga(new Promise(a=>{var l=e[s](o);if(!(l instanceof Object))throw TypeError("Object expected");a(l)}),1)}}),i[pn("iterator")]=()=>i,n("next"),"throw"in e?n("throw"):i.throw=s=>{throw s},"return"in e&&n("return"),i};var au={};Va(au,{default:()=>on});module.exports=Ma(au);var er=require("@codemirror/state"),ge=require("obsidian");var te=require("obsidian");var Ba=class extends Error{constructor(e){super(e[0].message);Zi(this,"issues");this.name="ValiError",this.issues=e}},cu=Symbol("brand");function Da(t){return typeof t=="function"?t():t}function at(t,e){return Array.isArray(t)?[void 0,t]:[t,e]}function ir(t,e,r){return{typed:t,output:e,issues:r}}function za(t,e,r){if(!t||typeof t=="object"&&!Array.isArray(t)){let[s,o]=at(e,r);return[t,s,o]}let[n,i]=at(t,e);return[void 0,n,i]}function La(t,e){return{reason:t==null?void 0:t.reason,validation:e.validation,origin:(t==null?void 0:t.origin)||"value",message:e.message,input:e.input,requirement:e==null?void 0:e.requirement,path:e.path,abortEarly:t==null?void 0:t.abortEarly,abortPipeEarly:t==null?void 0:t.abortPipeEarly,skipPipe:t==null?void 0:t.skipPipe}}function Ua(t,e){return{reason:e,origin:t==null?void 0:t.origin,abortEarly:t==null?void 0:t.abortEarly,abortPipeEarly:t==null?void 0:t.abortPipeEarly,skipPipe:t==null?void 0:t.skipPipe}}function _t(t,e,r,n,i){let s,o=t;if(e!=null&&e.length&&!(r!=null&&r.skipPipe))for(let a of e){let l=a._parse(o);if(l.issues){s=s||Ua(r,n);for(let c of l.issues){let p=La(s,c);i?i.push(p):i=[p]}if(s.abortEarly||s.abortPipeEarly)break}else o=l.output}return ir(!0,o,i)}function lt(t,e,r,n,i,s){return{typed:!1,output:i,issues:[{reason:e,validation:r,origin:(t==null?void 0:t.origin)||"value",message:Da(n),input:i,issues:s,abortEarly:t==null?void 0:t.abortEarly,abortPipeEarly:t==null?void 0:t.abortPipeEarly,skipPipe:t==null?void 0:t.skipPipe}]}}function Na(t){return typeof t.default=="function"?t.default():t.default}function Wi(t,e,r){let[n="Invalid type",i]=at(e,r);return{type:"instance",async:!1,class:t,message:n,pipe:i,_parse(s,o){return s instanceof this.class?_t(s,this.pipe,o,"instance"):lt(o,"type","instance",this.message,s)}}}function Vi(t,e){let[r="Invalid type",n]=at(t,e);return{type:"number",async:!1,message:r,pipe:n,_parse(i,s){return typeof i!="number"||isNaN(i)?lt(s,"type","number",this.message,i):_t(i,this.pipe,s,"number")}}}function Ii(t,e,r,n){let[i,s="Invalid type",o]=za(e,r,n),a;return{type:"object",async:!1,entries:t,rest:i,message:s,pipe:o,_parse(l,c){if(!l||typeof l!="object")return lt(c,"type","object",this.message,l);a=a||Object.entries(this.entries);let p=!0,u,d={};for(let[O,h]of a){let f=l[O],g=h._parse(f,c);if(g.issues){let b={type:"object",input:l,key:O,value:f};for(let y of g.issues)y.path?y.path.unshift(b):y.path=[b],u==null||u.push(y);if(u||(u=g.issues),c!=null&&c.abortEarly){p=!1;break}}g.typed||(p=!1),(g.output!==void 0||O in l)&&(d[O]=g.output)}if(this.rest&&!(c!=null&&c.abortEarly&&u)){for(let O in l)if(!(O in this.entries)){let h=l[O],f=this.rest._parse(h,c);if(f.issues){let g={type:"object",input:l,key:O,value:h};for(let b of f.issues)b.path?b.path.unshift(g):b.path=[g],u==null||u.push(b);if(u||(u=f.issues),c!=null&&c.abortEarly){p=!1;break}}f.typed||(p=!1),d[O]=f.output}}return p?_t(d,this.pipe,c,"object",u):ir(!1,d,u)}}}function ct(t,e){return{type:"optional",async:!1,wrapped:t,default:e,_parse(r,n){if(r===void 0){let i=Na(this);if(i===void 0)return ir(!0,r);r=i}return this.wrapped._parse(r,n)}}}function Xe(t,e){let[r="Invalid type",n]=at(t,e);return{type:"string",async:!1,message:r,pipe:n,_parse(i,s){return typeof i!="string"?lt(s,"type","string",this.message,i):_t(i,this.pLine truncated
Erroring snippet:
${lr(s)}`}})}catch(i){throw`Invalid snippet format: ${i}`}return n=pr(n),n})}function Li(t){return v(this,null,function*(){let e;try{e=yield import(t)}catch(r){throw`failed to import module ${t}`}if(!("default"in e))throw`No default export provided for module ${t}`;return e.default})}var cl=Ii({trigger:On([Xe(),Wi(RegExp)]),replacement:On([Xe(),Mi(t=>typeof t=="function")]),options:Xe(),flags:ct(Xe(),""),priority:ct(Vi(),0),description:ct(Xe(),"no description provided"),triggerKey:ct(Xe(),""),language:ct(Xe())});function pl(t){if(!Array.isArray(t))throw"Expected snippets to be an array";return t.flat().map(e=>{try{return Gi(cl,e)}catch(r){throw`Value does not resemble snippet.
Erroring snippet:
${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr.fromSource(t.options,t.language),o,a,l=gn(t.triggerKey);if(s.regex||t.trigger instanceof RegExp){let c,p=t.flags;t.trigger instanceof RegExp?(c=t.trigger.source,p=`${t.trigger.flags}${p}`):c=t.trigger,p=Ol(p),c=Ui(c,e),a=Ni(c),c=`(?:${c})$`,o=new RegExp(c,p),s.regex=!0;let u={trigger:o,replacement:r,options:s,priority:n,description:i,excludedEnvironments:a,triggerKey:l};return new or(u)}else{let c=t.trigger;c=Ui(c,e),a=Ni(c),typeof r=="string"&&r.includes(fn)&&(s.visual=!0);let p={trigger:c,replacement:r,options:s,priority:n,description:i,excludedEnvironments:a,triggerKey:l};return s.visual?new sr(p):new ar(p)}}function Ol(t){let e=["i","m","s","u","v"];return Array.from(new Set(t.split(""))).filter(r=>e.includes(r)).join("")}function Ui(t,e){for(let[r,n]of Object.entries(e))t=t.replaceAll(r,n);return t}function Ni(t){let e=[];return mn.hasOwnProperty(t)&&e.push(...mn[t]),e}function gn(t){return t.split(/ (?!$)/).map(e=>hl(e)).join(" ")}function hl(t){let e=t.split(/-(?!$)/),r=e[e.length-1];r==="Space"&&(r=" ");let n,i,s,o;for(let a=0;a<e.length-1;++a){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Fi.Platform.isMacOS?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(r="Alt-"+r),i&&(r="Ctrl-"+r),o&&(r="Meta-"+r),s&&(r="Shift-"+r),r}var dl=(t,e)=>{let r=t.keys(),n=e.keys(),i=[];for(let s of r)e.has(s)||i.push(s);for(let s of n)t.has(s)||i.push(s);return new Set(i)},fl=(t,e)=>{let r=t.keys(),n=[];for(let i of r)e.has(i)&&n.push(i);return new Set(n)},Hi,ml=((Hi=Set.prototype)==null?void 0:Hi.difference)&&((t,e)=>t.difference(e)),Ki,gl=((Ki=Set.prototype)==null?void 0:Ki.intersection)&&((t,e)=>t.intersection(e)),bn=ml||dl,ur=gl||fl;function bl(t,e){let r=t.parent,n=0;for(;r&&!r.isRoot()&&n<100;){if(r.path===e.path)return!0;r=r.parent,n++}return!1}function Or(t,e,r){let n=t.app.vault.getAbstractFileByPath(e);return n instanceof te.TFolder&&bl(r,n)}var yn=(0,te.debounce)(t=>v(void 0,null,function*(){(t.settings.loadSnippetVariablesFromFile||t.settings.loadSnippetsFromFile)&&(yield t.processSettings(!1,!0))}),500,!0),es=(t,e)=>v(void 0,null,function*(){e instanceof te.TFile&&(t.settings.loadSnippetVariablesFromFile&&e.path===t.settings.snippetVariablesFileLocation||t.settings.loadSnippetsFromFile&&e.path===t.settings.snippetsFileLocation||Or(t,t.settings.snippetVariablesFileLocation,e)||Or(t,t.settings.snippetsFileLocation,e))&&yn(t)}),ts=(t,e)=>{e instanceof te.TFile&&(t.settings.loadSnippetVariablesFromFile&&Or(t,t.settings.snippetVariablesFileLocation,e)||t.settings.loadSnippetsFromFile&&Or(t,t.settings.snippetsFileLocation,e))&&yn(t)},rs=(t,e)=>{if(!(e instanceof te.TFile))return;let r=t.app.vault.getAbstractFileByPath(t.settings.snippetVariablesFileLocation),n=t.app.vault.getAbstractFileByPath(t.settings.snippetsFileLocation);(t.settings.loadSnippetVariablesFromFile&&r instanceof te.TFolder&&e.path.contains(r.path)||t.settings.loadSnippetsFromFile&&n instanceof te.TFolder&&e.path.contains(n.path))&&yn(t)};function*ns(t){if(t instanceof te.TFile)yield t;else if(t instanceof te.TFolder)for(let e of t.children)yield*Xi(ns(e))}function Ji(t,e){let r=t.getAbstractFileByPath(e);if(!r)return console.warn(`Could not find file or folder at path ${e}`),new Set;let n=ns(r);return new Set(n)}function is(t){let e=t.settings.loadSnippetVariablesFromFile?Ji(t.app.vault,t.settings.snippetVariablesFileLocation):new Set,r=t.settings.loadSnippetsFromFile?Ji(t.app.vault,t.settings.snippetsFileLocation):new Set,n=bn(e,r),i=bn(r,e),s=ur(e,r);return{definitelyVariableFiles:n,definitelySnippetFiles:i,snippetOrVariableFiles:s}}function ss(t,e){return v(this,null,function*(){let r={};for(let n of e.definitelyVariableFiles){let i=yield t.app.vault.cachedRead(n);try{Object.assign(r,yield ze(i))}catch(s){new te.Notice(`Failed to parse variable file ${n.name}: ${s}`),console.error(`Failed to parse variable file ${n.name}: ${s}`),e.definitelyVariableFiles.delete(n)}}return r})}function os(t,e){return v(this,null,function*(){let r={};for(let n of e.snippetOrVariableFiles){let i=yield t.app.vault.cachedRead(n);try{Object.assign(r,yield ze(i)),e.definitelyVariableFiles.add(n)}catch(s){e.definitelySnippetFiles.add(n)}e.snippetOrVariableFiles.delete(n)}return r})}function as(t,e,r){return v(this,null,function*(){let n=[];for(let i of e.definitelySnippetFiles){let s=yield t.app.vault.cachedRead(i);try{n.push(...yield ut(s,r))}catch(o){new te.Notice(`Failed to parse snippet file ${i.name}: ${o}`),console.error(`Failed to parse snippet file ${i.name}: ${o}`),e.definitelySnippetFiles.delete(i)}}return pr(n)})}var ls=`export default [
// Math mode
{trigger: "mk", replacement: "$$0$", options: "tA"},
{trigger: "dm", replacement: "$$\\n\\t$0\\n$$", options: "tAw"},
{trigger: /(?<=\\S.*)dm/, replacement: "\\n$$\\n\\t$0\\n$$", options: "tAw", priority: 1},
{trigger: /([^\\\\])beg/, replacement: "[[0]]\\\\begin{$0}\\n\\t$1\\n\\\\end{$0}", options: "MA"},
{trigger: /([^\\\\])beg/, replacement: "[[0]]\\\\begin{$0} $1 \\\\end{$0}", options: "nA"},
// Dashes
// {trigger: "--", replacement: "\u2013", options: "tA"},
// {trigger: "\u2013-", replacement: "\u2014", options: "tA"},
// {trigger: "\u2014-", replacement: "---", options: "tA"},
// Greek letters
{trigger: "@a", replacement: "\\\\alpha", options: "mA"},
{trigger: "@b", replacement: "\\\\beta", options: "mA"},
{trigger: "@g", replacement: "\\\\gamma", options: "mA"},
{trigger: "@G", replacement: "\\\\Gamma", options: "mA"},
{trigger: "@d", replacement: "\\\\delta", options: "mA"},
{trigger: "@D", replacement: "\\\\Delta", options: "mA"},
{trigger: "@e", replacement: "\\\\epsilon", options: "mA"},
{trigger: ":e", replacement: "\\\\varepsilon", options: "mA"},
{trigger: "@z", replacement: "\\\\zeta", options: "mA"},
{trigger: "@t", replacement: "\\\\theta", options: "mA"},
{trigger: "@T", replacement: "\\\\Theta", options: "mA"},
{trigger: ":t", replacement: "\\\\vartheta", options: "mA"},
{trigger: "@i", replacement: "\\\\iota", options: "mA"},
{trigger: "@k", replacement: "\\\\kappa", options: "mA"},
{trigger: "@l", replacement: "\\\\lambda", options: "mA"},
{trigger: "@L", replacement: "\\\\Lambda", options: "mA"},
{trigger: "@s", replacement: "\\\\sigma", options: "mA"},
{trigger: "@S", replacement: "\\\\Sigma", options: "mA"},
{trigger: "@u", replacement: "\\\\upsilon", options: "mA"},
{trigger: "@U", replacement: "\\\\Upsilon", options: "mA"},
{trigger: "@o", replacement: "\\\\omega", options: "mA"},
{trigger: "@O", replacement: "\\\\Omega", options: "mA"},
{trigger: "ome", replacement: "\\\\omega", options: "mA"},
{trigger: "Ome", replacement: "\\\\Omega", options: "mA"},
// Text environment
{trigger: "text", replacement: "\\\\text{$0}$1", options: "mA"},
{trigger: "\\"", replacement: "\\\\text{$0}$1", options: "mA"},
// Basic operations
{trigger: "sr", replacement: "^{2}", options: "mA"},
{trigger: "cb", replacement: "^{3}", options: "mA"},
{trigger: "rd", replacement: "^{$0}$1", options: "mA"},
{trigger: "_", replacement: "_{$0}$1", options: "mA"},
{trigger: "sts", replacement: "_\\\\text{$0}", options: "mA"},
{trigger: "sq", replacement: "\\\\sqrt{ $0 }$1", options: "mA"},
{trigger: "//", replacement: "\\\\frac{$0}{$1}$2", options: "mA"},
{trigger: "ee", replacement: "e^{ $0 }$1", options: "mA"},
{trigger: "invs", replacement: "^{-1}", options: "mA"},
{trigger: /([^\\\\])(exp|log|ln)/, replacement: "[[0]]\\\\[[1]]", options: "rmA"},
{trigger: "conj", replacement: "^{*}", options: "mA"},
{trigger: "Re", replacement: "\\\\mathrm{Re}", options: "mA"},
{trigger: "Im", replacement: "\\\\mathrm{Im}", options: "mA"},
{trigger: "bf", replacement: "\\\\mathbf{$0}", options: "mA"},
{trigger: "rm", replacement: "\\\\mathrm{$0}$1", options: "mA"},
// Linear algebra
{trigger: /([^\\\\])(det)/, replacement: "[[0]]\\\\[[1]]", options: "rmA"},
{trigger: "trace", replacement: "\\\\mathrm{Tr}", options: "mA"},
// More operations
{trigger: "([a-zA-Z])hat", replacement: "\\\\hat{[[0]]}", options: "rmA"},
{trigger: "([a-zA-Z])bar", replacement: "\\\\bar{[[0]]}", options: "rmA"},
{trigger: "([a-zA-Z])dot", replacement: "\\\\dot{[[0]]}", options: "rmA", priority: -1},
{trigger: "([a-zA-Z])ddot", replacement: "\\\\ddot{[[0]]}", options: "rmA", priority: 1},
{trigger: "([a-zA-Z])tilde", replacement: "\\\\tilde{[[0]]}", options: "rmA"},
{trigger: "([a-zA-Z])und", replacement: "\\\\underline{[[0]]}", options: "rmA"},
{trigger: "([a-zA-Z])vec", replacement: "\\\\vec{[[0]]}", options: "rmA"},
{trigger: "([a-zA-Z]),\\\\.", replacement: "\\\\mathbf{[[0]]}", options: "rmA"},
{trigger: "([a-zA-Z])\\\\.,", replacement: "\\\\mathbf{[[0]]}", options: "rmA"},
{trigger: "\\\\\\\\(\${GREEK}),\\\\.", replacement: "\\\\boldsymbol{\\\\[[0]]}", options: "rmA"},
{trigger: "\\\\\\\\(\${GREEK})\\\\.,", replacement: "\\\\boldsymbol{\\\\[[0]]}", options: "rmA"},
{trigger: "hat", replacement: "\\\\hat{$0}$1", options: "mA"},
{trigger: "bar", replacement: "\\\\bar{$0}$1", options: "mA"},
{trigger: "dot", replacement: "\\\\dot{$0}$1", options: "mA", priority: -1},
{trigger: "ddot", replacement: "\\\\ddot{$0}$1", options: "mA"},
{trigger: "cdot", replacement: "\\\\cdot", options: "mA"},
{trigger: "tilde", replacement: "\\\\tilde{$0}$1", options: "mA"},
{trigger: "und", replacement: "\\\\underline{$0}$1", options: "mA"},
{trigger: "vec", replacement: "\\\\vec{$0}$1", options: "mA"},
{
trigger: "pmod",
replacement: "\\\\pmod{\${0:n}}$1",
options: "mA",
description: "Parenthesized modulo (\\\\pmod{n})",
},
// Auto letter subscript
//
// x3 -> x_{3}, \\alpha3 -> \\alpha_{3}
{
trigger: "(\\\\\\\\\${GREEK}|[A-Za-z])(\\\\d)",
replacement: "[[0]]_{[[1]]}",
options: "rmA",
priority: -1,
},
// x_{3}4 -> x_{34}, \\alpha_{3}4 -> \\alpha_{34}
{
trigger: "(\\\\\\\\\${GREEK}|[A-Za-z])_{(\\\\d+)}(\\\\d)",
replacement: "[[0]]_{[[1]][[2]]}",
options: "rmA",
priority: -1,
},
// \\dot{x}3 -> \\dot{x}_{3}, \\dot{\\alpha}3 -> \\dot{\\alpha}_{3}
{
trigger: "\\\\\\\\(\${ACCENT})\\\\{(\\\\\\\\\${GREEK}|[A-Za-z])\\\\}(\\\\d)",
replacement: "\\\\[[0]]{[[1]]}_{[[2]]}",
options: "rmA",
priority: -1,
},
// \\dot{x}_{3}4 -> \\dot{x}_{34}
{
trigger: "\\\\\\\\(\${ACCENT})\\\\{(\\\\\\\\\${GREEK}|[A-Za-z])\\\\}_\\\\{(\\\\d+)\\\\}(\\\\d)",
replacement: "\\\\[[0]]{[[1]]}_{[[2]][[3]]}",
options: "rmA",
priority: -1,
},
// \\dot{\\vec{a}}3 -> \\dot{\\vec{a}}_{3}
{
trigger: "\\\\\\\\(\${ACCENT})\\\\{\\\\\\\\(\${ACCENT})\\\\{(\\\\\\\\\${GREEK}|[A-Za-z])\\\\}\\\\}(\\\\d)",
replacement: "\\\\[[0]]{\\\\[[1]]{[[2]]}}_{[[3]]}",
options: "rmA",
priority: -1,
},
// \\dot{\\vec{a}}_{3}4 -> \\dot{\\vec{a}}_{34}
{
trigger: "\\\\\\\\(\${ACCENT})\\\\{\\\\\\\\(\${ACCENT})\\\\{(\\\\\\\\\${GREEK}|[A-Za-z])\\\\}\\\\}_\\\\{(\\\\d+)\\\\}(\\\\d)",
replacement: "\\\\[[0]]{\\\\[[1]]{[[2]]}}_{[[3]][[4]]}",
options: "rmA",
priority: -1,
},
{trigger: "xnn", replacement: "x_{n}", options: "mA"},
{trigger: "\\\\xii", replacement: "x_{i}", options: "mA", priority: 1},
{trigger: "xjj", replacement: "x_{j}", options: "mA"},
{trigger: "xp1", replacement: "x_{n+1}", options: "mA"},
{trigger: "ynn", replacement: "y_{n}", options: "mA"},
{trigger: "yii", replacement: "y_{i}", options: "mA"},
{trigger: "yjj", replacement: "y_{j}", options: "mA"},
// Symbols
{trigger: "ooo", replacement: "\\\\infty", options: "mA"},
{trigger: "sum", replacement: "\\\\sum", options: "mA"},
{trigger: "prod", replacement: "\\\\prod", options: "mA"},
{trigger: "\\\\sum", replacement: "\\\\sum_{\${0:i}=\${1:1}}^{\${2:N}} $3", options: "m"},
{trigger: "\\\\prod", replacement: "\\\\prod_{\${0:i}=\${1:1}}^{\${2:N}} $3", options: "m"},
{trigger: "lim", replacement: "\\\\lim_{ \${0:n} \\\\to \${1:\\\\infty} } $2", options: "mA"},
{trigger: "+-", replacement: "\\\\pm", options: "mA"},
{trigger: "-+", replacement: "\\\\mp", options: "mA"},
{trigger: "...", replacement: "\\\\dots", options: "mA"},
{trigger: "nabl", replacement: "\\\\nabla", options: "mA"},
// The operator nabla is also called del, but using "del" as a trigger conflicts with the greek letter delta.
// {trigger: "del", replacement: "\\\\nabla", options: "mA"},
{trigger: "xx", replacement: "\\\\times", options: "mA"},
{trigger: "**", replacement: "\\\\cdot", options: "mA"},
{trigger: "para", replacement: "\\\\parallel", options: "mA"},
{trigger: "===", replacement: "\\\\equiv", options: "mA"},
{trigger: "!=", replacement: "\\\\neq", options: "mA"},
{trigger: ">=", replacement: "\\\\geq", options: "mA"},
{trigger: "<=", replacement: "\\\\leq", options: "mA"},
{trigger: ">>", replacement: "\\\\gg", options: "mA"},
{trigger: "<<", replacement: "\\\\ll", options: "mA"},
{trigger: "simm", replacement: "\\\\sim", options: "mA"},
{trigger: "sim=", replacement: "\\\\simeq", options: "mA"},
{trigger: "prop", replacement: "\\\\propto", options: "mA"},
{trigger: "<->", replacement: "\\\\leftrightarrow ", options: "mA"},
{trigger: "->", replacement: "\\\\to", options: "mA"},
{trigger: "!>", replacement: "\\\\mapsto", options: "mA"},
{trigger: "=>", replacement: "\\\\implies", options: "mA"},
{trigger: "=<", replacement: "\\\\impliedby", options: "mA"},
{trigger: "and", replacement: "\\\\cap", options: "mA"},
{trigger: "orr", replacement: "\\\\cup", options: "mA"},
{trigger: "inn", replacement: "\\\\in", options: "mA"},
{trigger: "notin", replacement: "\\\\not\\\\in", options: "mA"},
{trigger: "\\\\\\\\\\\\", replacement: "\\\\setminus", options: "mA"},
{trigger: "sub=", replacement: "\\\\subseteq", options: "mA"},
{trigger: "sup=", replacement: "\\\\supseteq", options: "mA"},
{trigger: "eset", replacement: "\\\\emptyset", options: "mA"},
{trigger: "set", replacement: "\\\\{ $0 \\\\}$1", options: "mA"},
{trigger: "e\\\\xi sts", replacement: "\\\\exists", options: "mA", priority: 1},
{trigger: "LL", replacement: "\\\\mathcal{L}", options: "mA"},
{trigger: "HH", replacement: "\\\\mathcal{H}", options: "mA"},
{trigger: "CC", replacement: "\\\\mathbb{C}", options: "mA"},
{trigger: "RR", replacement: "\\\\mathbb{R}", options: "mA"},
{trigger: "ZZ", replacement: "\\\\mathbb{Z}", options: "mA"},
{trigger: "NN", replacement: "\\\\mathbb{N}", options: "mA"},
// Handle spaces and backslashes
// Snippet variables can be used as shortcuts when writing snippets.
// For example, \${GREEK} below is shorthand for "alpha|beta|gamma|Gamma|delta|..."
// You can edit snippet variables under the Advanced snippet settings section.
{trigger: "([^\\\\\\\\])(\${GREEK})", replacement: "[[0]]\\\\[[1]]", options: "rmA", description: "Add backslash before Greek letters"},
{trigger: "([^\\\\\\\\])(\${SYMBOL})", replacement: "[[0]]\\\\[[1]]", options: "rmA", description: "Add backslash before symbols"},
// Insert space after Greek letters and symbols
{trigger: "\\\\\\\\(\${GREEK}|\${SYMBOL}|\${MORE_SYMBOLS})([A-Za-z])", replacement: "\\\\[[0]] [[1]]", options: "rmA"},
{trigger: "\\\\\\\\(\${GREEK}|\${SYMBOL}) sr", replacement: "\\\\[[0]]^{2}", options: "rmA"},
{trigger: "\\\\\\\\(\${GREEK}|\${SYMBOL}) cb", replacement: "\\\\[[0]]^{3}", options: "rmA"},
{trigger: "\\\\\\\\(\${GREEK}|\${SYMBOL}) rd", replacement: "\\\\[[0]]^{$0}$1", options: "rmA"},
{trigger: "\\\\\\\\(\${GREEK}) hat", replacement: "\\\\hat{\\\\[[0]]}", options: "rmA"},
{trigger: "\\\\\\\\(\${GREEK}) dot", replacement: "\\\\dot{\\\\[[0]]}", options: "rmA"},
{trigger: "\\\\\\\\(\${GREEK}) bar", replacement: "\\\\bar{\\\\[[0]]}", options: "rmA"},
{trigger: "\\\\\\\\(\${GREEK}) vec", replacement: "\\\\vec{\\\\[[0]]}", options: "rmA"},
{trigger: "\\\\\\\\(\${GREEK}) tilde", replacement: "\\\\tilde{\\\\[[0]]}", options: "rmA"},
{trigger: "\\\\\\\\(\${GREEK}) und", replacement: "\\\\underline{\\\\[[0]]}", options: "rmA"},
// Derivatives and integrals
{trigger: "par", replacement: "\\\\frac{ \\\\partial \${0:y} }{ \\\\partial \${1:x} } $2", options: "m"},
{trigger: /pa([A-Za-z])([A-Za-z])/, replacement: "\\\\frac{ \\\\partial [[0]] }{ \\\\partial [[1]] } ", options: "rm"},
{trigger: "ddt", replacement: "\\\\frac{d}{dt} ", options: "mA"},
{trigger: /([^\\\\])int/, replacement: "[[0]]\\\\int", options: "mA", priority: -1},
{trigger: "\\\\int", replacement: "\\\\int $0 \\\\, d\${1:x} $2", options: "m"},
{trigger: "dint", replacement: "\\\\int_{\${0:0}}^{\${1:1}} $2 \\\\, d\${3:x} $4", options: "mA"},
{trigger: "oint", replacement: "\\\\oint", options: "mA"},
{trigger: "iint", replacement: "\\\\iint", options: "mA"},
{trigger: "iiint", replacement: "\\\\iiint", options: "mA"},
{trigger: "oinf", replacement: "\\\\int_{0}^{\\\\infty} $0 \\\\, d\${1:x} $2", options: "mA"},
{trigger: "infi", replacement: "\\\\int_{-\\\\infty}^{\\\\infty} $0 \\\\, d\${1:x} $2", options: "mA"},
// Trigonometry
{trigger: /([^\\\\])(arcsin|sin|arccos|cos|arctan|tan|csc|sec|cot)/, replacement: "[[0]]\\\\[[1]]", options: "rmA", description: "Add backslash before trig funcs"},
{trigger: /\\\\(arcsin|sin|arccos|cos|arctan|tan|csc|sec|cot)([A-Za-gi-z])/,
replacement: "\\\\[[0]] [[1]]", options: "rmA",
description: "Add space after trig funcs. Skips letter h to allow sinh, cosh, etc."},
{trigger: /\\\\(sinh|cosh|tanh|coth)([A-Za-z])/,
replacement: "\\\\[[0]] [[1]]", options: "rmA",
description: "Add space after hyperbolic trig funcs"},
{
trigger: /(arccsc|arcsec|arccot)/,
replacement: "\\\\operatorname{[[0]]}$0",
options: "mA",
description: "Inverse trig functions, Are not built-in MathJax functions",
priority: 1,
},
// Visual operations
{trigger: "U", replacement: "\\\\underbrace{ \${VISUAL} }_{ $0 }", options: "mA"},
{trigger: "O", replacement: "\\\\overbrace{ \${VISUAL} }^{ $0 }", options: "mA"},
{trigger: "B", replacement: "\\\\underset{ $0 }{ \${VISUAL} }", options: "mA"},
{trigger: "C", replacement: "\\\\cancel{ \${VISUAL} }", options: "mA"},
{trigger: "K", replacement: "\\\\cancelto{ $0 }{ \${VISUAL} }", options: "mA"},
{trigger: "S", replacement: "\\\\sqrt{ \${VISUAL} }", options: "mA"},
// Physics
{trigger: "kbt", replacement: "k_{B}T", options: "mA"},
{trigger: "msun", replacement: "M_{\\\\odot}", options: "mA"},
// Quantum mechanics
{trigger: "dag", replacement: "^{\\\\dagger}", options: "mA"},
{trigger: "o+", replacement: "\\\\oplus ", options: "mA"},
{trigger: "ox", replacement: "\\\\otimes ", options: "mA"},
{trigger: "bra", replacement: "\\\\bra{$0} $1", options: "mA"},
{trigger: "ket", replacement: "\\\\ket{$0} $1", options: "mA"},
{trigger: "brk", replacement: "\\\\braket{ $0 | $1 } $2", options: "mA"},
{trigger: "outer", replacement: "\\\\ket{\${0:\\\\psi}} \\\\bra{\${0:\\\\psi}} $1", options: "mA"},
// Chemistry
{trigger: "pu", replacement: "\\\\pu{ $0 }", options: "mA"},
{trigger: "cee", replacement: "\\\\ce{ $0 }", options: "mA"},
{trigger: "he4", replacement: "{}^{4}_{2}He ", options: "mA"},
{trigger: "he3", replacement: "{}^{3}_{2}He ", options: "mA"},
{trigger: "iso", replacement: "{}^{\${0:4}}_{\${1:2}}\${2:He}", options: "mA"},
// Environments
// Here the regex syntax [pbBvV]mat is used to match pmat, bmat, Bmat, vmat, Vmat
{
trigger: /([pbBvV]mat)/,
replacement: "\\\\begin{[[0]]rix}\\n$0\\n\\\\end{[[0]]rix}",
options: "rMA",
description: "Matrix environments with new lines",
},
{
trigger: /(matrix|cases|align|array)/,
replacement: "\\\\begin{[[0]]}\\n$0\\n\\\\end{[[0]]}",
options: "rMA",
description: "Miscellaneous environments with new lines",
},
{
trigger: /([pbBvV]mat)/,
replacement: "\\\\begin{[[0]]rix}$0\\\\end{[[0]]rix}",
options: "rnA",
},
{
trigger: /(matrix|cases|align|array)/,
replacement: "\\\\begin{[[0]]}$0\\\\end{[[0]]}",
options: "rnA",
},
// Brackets
{trigger: "avg", replacement: "\\\\langle $0 \\\\rangle $1", options: "mA"},
{trigger: "norm", replacement: "\\\\lvert $0 \\\\rvert $1", options: "mA", priority: 1},
{trigger: "Norm", replacement: "\\\\lVert $0 \\\\rVert $1", options: "mA", priority: 1},
{trigger: "ceil", replacement: "\\\\lceil $0 \\\\rceil $1", options: "mA"},
{trigger: "floor", replacement: "\\\\lfloor $0 \\\\rfloor $1", options: "mA"},
// For the modulo operator, see the section "More operations" above
{trigger: "mod", replacement: "|$0|$1", options: "mA"},
{trigger: "(", replacement: "(\${VISUAL})", options: "mA"},
{trigger: "[", replacement: "[\${VISUAL}]", options: "mA"},
{trigger: "{", replacement: "{\${VISUAL}}", options: "mA"},
{trigger: "(", replacement: "($0)$1", options: "mA"},
{trigger: "{", replacement: "{$0}$1", options: "mA"},
{trigger: "[", replacement: "[$0]$1", options: "mA"},
{trigger: "lr(", replacement: "\\\\left( $0 \\\\right) $1", options: "mA"},
{trigger: "lr{", replacement: "\\\\left\\\\{ $0 \\\\right\\\\} $1", options: "mA"},
{trigger: "lr[", replacement: "\\\\left[ $0 \\\\right] $1", options: "mA"},
{trigger: "lr|", replacement: "\\\\left| $0 \\\\right| $1", options: "mA"},
{trigger: "lra", replacement: "\\\\left< $0 \\\\right> $1", options: "mA"},
// Misc
// Automatically convert standalone letters in text to math (except a, A, I).
// (Un-comment to enable)
// {trigger: /([^'])\\b([B-HJ-Zb-z])\\b([\\n\\s.,?!:'])/, replacement: "[[0]]$[[1]]$[[2]]", options: "tA"},
// Automatically convert Greek letters in text to math.
// {trigger: "(\${GREEK})([\\\\n\\\\s.,?!:'])", replacement: "$\\\\[[0]]$[[1]]", options: "rtAw"},
// Automatically convert text of the form "x=2" and "x=n+1" to math.
// {trigger: /([A-Za-z]=\\d+)([\\n\\s.,?!:'])/, replacement: "$[[0]]$[[1]]", options: "rtAw"},
// {trigger: /([A-Za-z]=[A-Za-z][+-]\\d+)([\\n\\s.,?!:'])/, replacement: "$[[0]]$[[1]]", options: "tAw"},
// Snippet replacements can have placeholders.
{trigger: "tayl", replacement: "\${0:f}(\${1:x} + \${2:h}) = \${0:f}(\${1:x}) + \${0:f}'(\${1:x})\${2:h} + \${0:f}''(\${1:x}) \\\\frac{\${2:h}^{2}}{2!} + \\\\dots$3", options: "mA", description: "Taylor expansion"},
// Snippet replacements can also be JavaScript functions.
// See the documentation for more information.
{trigger: /iden(\\d)/, replacement: (match) => {
const n = match[1];
let arr = [];
for (let j = 0; j < n; j++) {
arr[j] = [];
for (let i = 0; i < n; i++) {
arr[j][i] = (i === j) ? 1 : 0;
}
}
let output = arr.map(el => el.join(" & ")).join(" \\\\\\\\\\n");
output = \`\\\\begin{pmatrix}\\n\${output}\\n\\\\end{pmatrix}\`;
return output;
}, options: "mA", description: "N x N identity matrix"},
{
trigger: /(?<=(?:\\n|^)[ \\t]*>*)(?<marker>\\d+[.)]|[-*+])(?<whitespace>[ \\t]+)(?<text>.*)dm/,
replacement: (m) => {
const { whitespace, text, marker } = m.groups;
const firstLine = marker + whitespace + text;
const indent = " ".repeat(marker.length) + whitespace;
return \`\${firstLine}\\n\${indent}$$\\n\${indent}\\t$0\\n\${indent}$$\`;
},
options: "rtA",
priority: 2,
description: "Display math when in a list"
},
]
`;var At=ls;var cs=`export default {
"\${GREEK}": "(?:alpha|beta|gamma|Gamma|delta|Delta|epsilon|varepsilon|zeta|eta|theta|vartheta|Theta|iota|kappa|lambda|Lambda|mu|nu|xi|omicron|pi|rho|varrho|sigma|Sigma|tau|upsilon|Upsilon|phi|varphi|Phi|chi|psi|omega|Omega)",
"\${SYMBOL}": "(?:parallel|perp|partial|nabla|hbar|ell|infty|oplus|ominus|otimes|oslash|square|star|dagger|vee|wedge|subseteq|subset|supseteq|supset|emptyset|exists|nexists|forall|implies|impliedby|iff|setminus|neg|lor|land|bigcup|bigcap|cdot|times|simeq|approx)",
"\${MORE_SYMBOLS}": "(?:leq|geq|neq|gg|ll|equiv|sim|propto|rightarrow|leftarrow|Rightarrow|Leftarrow|leftrightarrow|to|mapsto|cap|cup|in|sum|prod|exp|ln|log|det|dots|vdots|ddots|pm|mp|int|iint|iiint|oint)",
"\${ACCENT}": "(?:dot|ddot|hat|bar|tilde|vec|underline|overline|mathbf|mathcal|mathrm|mathbb)",
}
`;var ps=cs;var W={snippets:At,snippetVariables:ps,snippetsEnabled:!0,snippetsTrigger:"Tab",snippetNextTabstopTrigger:"Tab",snippetPreviousTabstopTrigger:"Shift-Tab",suppressSnippetTriggerOnIME:!0,suppressIMEWarning:!1,removeSnippetWhitespace:!0,autoDelete$:!0,loadSnippetsFromFile:!1,loadSnippetVariablesFromFile:!1,snippetsFileLocation:"",snippetVariablesFileLocation:"",concealEnabled:!1,concealRevealTimeout:0,colorPairedBracketsEnabled:!0,highlightCursorBracketsEnabled:!0,mathPreviewEnabled:!0,mathPreviewPositionIsAbove:!0,mathPreviewCursor:"\u25B6",mathPreviewBracketHighlighting:!1,autofractionEnabled:!0,autofractionSymbol:"\\frac",autofractionBreakingChars:"+-= ",matrixShortcutsEnabled:!0,taboutEnabled:!0,taboutTrigger:"Tab",autoEnlargeBrackets:!0,wordDelimiters:"., +-\\n :;!?\\/{}[]()=~$'\"|`<>*^%#@&",autofractionExcludedEnvs:`[
["^{", "}"],
["\\\\pu{", "}"]
]`,matrixShortcutsEnvNames:"pmatrix, cases, align, gather, bmatrix, Bmatrix, vmatrix, Vmatrix, array, matrix",taboutClosingSymbols:"), ], \\rbrack, \\}, \\rbrace, \\rangle, \\rvert, \\rVert, \\rfloor, \\rceil, \\urcorner, }",autoEnlargeBracketsTriggers:"sum, int, frac, prod, bigcup, bigcap",forceMathLanguages:"math",snippetDebug:"off",vimEnabled:!1,vimSelectMode:"<C-g>",vimVisualMode:"<C-g>",vimMatrixEnter:"o"};function qt(t,e){function r(i){return i.replace(/\s/g,"").split(",")}function n(i){let s=[];try{s=JSON.parse(i).map(function(a){return{openSymbol:a[0],closeSymbol:a[1]}})}catch(o){console.error(o)}return s}return ye(oe({},e),{snippets:t,autofractionExcludedEnvs:n(e.autofractionExcludedEnvs),matrixShortcutsEnvNames:r(e.matrixShortcutsEnvNames),taboutClosingSymbols:new Set(r(e.taboutClosingSymbols)),autoEnlargeBracketsTriggers:r(e.autoEnlargeBracketsTriggers).map(i=>/[A-Za-z]+/.test(i)?`\\${i}`:i),forceMathLanguages:r(e.forceMathLanguages)})}var Ur=require("@codemirror/state"),gi=require("@codemirror/view"),w=require("obsidian");var As=require("obsidian");var V="top",U="bottom",D="right",M="left",hr="auto",We=[V,U,D,M],_e="start",Le="end",us="clippingParents",dr="viewport",Ot="popper",Os="reference",xn=We.reduce(function(t,e){return t.concat([e+"-"+_e,e+"-"+Le])},[]),fr=[].concat(We,[hr]).reduce(function(t,e){return t.concat([e,e+"-"+_e,e+"-"+Le])},[]),Ql="beforeRead",Sl="read",$l="afterRead",vl="beforeMain",Tl="main",wl="afterMain",kl="beforeWrite",Pl="write",El="afterWrite",hs=[Ql,Sl,$l,vl,Tl,wl,kl,Pl,El];function F(t){return t?(t.nodeName||"").toLowerCase():null}function G(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Te(t){var e=G(t).Element;return t instanceof e||t instanceof Element}function N(t){var e=G(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function ht(t){if(typeof ShadowRoot=="undefined")return!1;var e=G(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function _l(t){var e=t.state;Object.keys(e.elements).forEach(function(r){var n=e.styles[r]||{},i=e.attributes[r]||{},s=e.elements[r];!N(s)||!F(s)||(Object.assign(s.style,n),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function Cl(t){var e=t.state,r={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,r.popper),e.styles=r,e.elements.arrow&&Object.assign(e.elements.arrow.style,r.arrow),function(){Object.keys(e.elements).forEach(function(n){var i=e.elements[n],s=e.attributes[n]||{},o=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:r[n]),a=o.reduce(function(l,c){return l[c]="",l},{});!N(i)||!F(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}var ds={name:"applyStyles",enabled:!0,phase:"write",fn:_l,effect:Cl,requires:["computeStyles"]};function Y(t){return t.split("-")[0]}var xe=Math.max,Ue=Math.min,Ce=Math.round;function Oe(t,e){e===void 0&&(e=!1);var r=t.getBoundingClientRect(),n=1,i=1;if(N(t)&&e){var s=t.offsetHeight,o=t.offsetWidth;o>0&&(n=Ce(r.width)/o||1),s>0&&(i=Ce(r.height)/s||1)}return{width:r.width/n,height:r.height/i,top:r.top/i,right:r.right/n,bottom:r.bottom/i,left:r.left/n,x:r.left/n,y:r.top/i}}function Ne(t){var e=Oe(t),r=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-r)<=1&&(r=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:r,height:n}}function jt(t,e){var r=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(r&&ht(r)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function re(t){return G(t).getComputedStyle(t)}function Qn(t){return["table","td","th"].indexOf(F(t))>=0}function K(t){return((Te(t)?t.ownerDocument:t.document)||window.document).documentElement}function Re(t){return F(t)==="html"?t:t.assignedSlot||t.parentNode||(ht(t)?t.host:null)||K(t)}function fs(t){return!N(t)||re(t).position==="fixed"?null:t.offsetParent}function Rl(t){var e=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,r=navigator.userAgent.indexOf("Trident")!==-1;if(r&&N(t)){var n=re(t);if(n.position==="fixed")return null}var i=Re(t);for(ht(i)&&(i=i.host);N(i)&&["html","body"].indexOf(F(i))<0;){var s=re(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Qe(t){for(var e=G(t),r=fs(t);r&&Qn(r)&&re(r).position==="static";)r=fs(r);return r&&(F(r)==="html"||F(r)==="body"&&re(r).position==="static")?e:r||Rl(t)||e}function Fe(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Ye(t,e,r){return xe(t,Ue(e,r))}function ms(t,e,r){var n=Ye(t,e,r);return n>r?r:n}function Zt(){return{top:0,right:0,bottom:0,left:0}}function Xt(t){return Object.assign({},Zt(),t)}functio Line truncated
\${}
} catch (\${error}) {
\${}
}`,{label:"try",detail:"/ catch block",type:"keyword"}),(0,ee.snippetCompletion)("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),(0,ee.snippetCompletion)(`if (\${}) {
\${}
} else {
\${}
}`,{label:"if",detail:"/ else block",type:"keyword"}),(0,ee.snippetCompletion)(`class \${name} {
constructor(\${params}) {
\${}
}
}`,{label:"class",detail:"definition",type:"keyword"}),(0,ee.snippetCompletion)('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),(0,ee.snippetCompletion)('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Js=new vr,no=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Dt(t){return(e,r)=>{let n=e.node.getChild("VariableDefinition");return n&&r(n,t),!0}}var Xc=["FunctionDeclaration"],Wc={FunctionDeclaration:Dt("function"),ClassDeclaration:Dt("class"),ClassExpression:()=>!0,EnumDeclaration:Dt("constant"),TypeAliasDeclaration:Dt("type"),NamespaceDeclaration:Dt("namespace"),VariableDefinition(t,e){t.matchContext(Xc)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function io(t,e){let r=Js.get(e);if(r)return r;let n=[],i=!0;function s(o,a){let l=t.sliceString(o.from,o.to);n.push({label:l,type:a})}return e.cursor(z.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let a=Wc[o.name];if(a&&a(o,s)||no.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of io(t,o.node))n.push(a);return!1}}),Js.set(e,n),n}var eo=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,so=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Vc(t){let e=(0,B.syntaxTree)(t.state).resolveInner(t.pos,-1);if(so.indexOf(e.name)>-1)return null;let r=e.to-e.from<20&&eo.test(t.state.sliceDoc(e.from,e.to));if(!r&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)no.has(i.name)&&(n=n.concat(io(t.state.doc,i)));return{options:n,from:r?e.from:t.pos,validFor:eo}}var rt=B.LRLanguage.define({parser:Ks.configure({props:[B.indentNodeProp.add({IfStatement:(0,B.continuedIndent)({except:/^\s*({|else\b)/}),TryStatement:(0,B.continuedIndent)({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:B.flatIndent,SwitchBody:t=>{let e=t.textAfter,r=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(r?0:n?1:2)*t.unit},Block:(0,B.delimitedIndent)({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":(0,B.continuedIndent)({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),B.foldNodeProp.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":B.foldInside,BlockComment(t){return{from:t.from+2,to:t.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Ic=rt.configure({dialect:"ts"}),Mc=rt.configure({dialect:"jsx"}),Gc=rt.configure({dialect:"jsx ts"}),Bc="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(t=>({label:t,type:"keyword"}));function oo(t={}){let e=t.jsx?t.typescript?Gc:Mc:t.typescript?Ic:rt;return new B.LanguageSupport(e,[rt.data.of({autocomplete:(0,ee.ifNotIn)(so,(0,ee.completeFromList)(Zc.concat(Bc)))}),rt.data.of({autocomplete:Vc}),t.jsx?zc:[]])}function to(t,e,r=t.length){if(!e)return"";let n=e.getChild("JSXIdentifier");return n?t.sliceString(n.from,Math.min(n.to,r)):""}var Dc=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),zc=ro.EditorView.inputHandler.of((t,e,r,n)=>{if((Dc?t.composing:t.compositionStarted)||t.state.readOnly||e!=r||n!=">"&&n!="/"||!rt.isActiveAt(t.state,e,-1))return!1;let{state:i}=t,s=i.changeByRange(o=>{var a,l,c;let{head:p}=o,u=(0,B.syntaxTree)(i).resolveInner(p,-1),d;if(u.name=="JSXStartTag"&&(u=u.parent),n==">"&&u.name=="JSXFragmentTag")return{range:Cr.EditorSelection.cursor(p+1),changes:{from:p,insert:"><>"}};if(n==">"&&u.name=="JSXIdentifier"){if(((l=(a=u.parent)===null||a===void 0?void 0:a.lastChild)===null||l===void 0?void 0:l.name)!="JSXEndTag"&&(d=to(i.doc,u.parent,p)))return{range:Cr.EditorSelection.cursor(p+1),changes:{from:p,insert:`></${d}>`}}}else if(n=="/"&&u.name=="JSXFragmentTag"){let O=u.parent,h=O==null?void 0:O.parent;if(O.from==p-1&&((c=h.lastChild)===null||c===void 0?void 0:c.name)!="JSXEndTag"&&(d=to(i.doc,h==null?void 0:h.firstChild,p))){let f=`/${d}>`;return{range:Cr.EditorSelection.cursor(p+f.length),changes:{from:p,insert:f}}}}return{range:o}});return s.changes.empty?!1:(t.dispatch(s,{userEvent:"input.type",scrollIntoView:!0}),!0)});var we=require("@codemirror/language"),Me=require("@codemirror/commands"),Ar=require("@codemirror/autocomplete"),qr=require("@codemirror/search"),po=require("@codemirror/lint");var ao=require("@codemirror/view"),Rr=require("@codemirror/language"),_=require("@lezer Line truncated
["${t}", "}"]`)}
]`;var ri="formatting_formatting-math_formatting-math-begin_keyword_math",Yc="formatting_formatting-math_formatting-math-end_keyword_math_math-",$o="formatting_formatting-math_formatting-math-begin_keyword_math_math-block",Hc="formatting_formatting-math_formatting-math-end_keyword_math_math-",Zr=new Set([ri,$o]),Xr=new Set([Yc,Hc]),So="HyperMD-codeblock_HyperMD-codeblock-begin_HyperMD-codeblock-begin-bg_HyperMD-codeblock-bg",ti="HyperMD-codeblock_HyperMD-codeblock-bg_HyperMD-codeblock-end_HyperMD-codeblock-end-bg",ii=ni.ViewPlugin.fromClass(class{constructor(e){this.codeblockLanguage=null;this.shouldUpdate=!1;this.updateFromView(e)}init(e){return this.shouldUpdate&&(this.updateFromView(e),this.shouldUpdate=!1),this}update(e){(e.docChanged||e.selectionSet||e.viewportChanged)&&(this.shouldUpdate=!0)}updateFromView(e){var u;let r=e.state,n=r.selection;this.view=e,this.state=r,this.pos=n.main.to,this.ranges=Array.from(n.ranges).reverse(),this.mode=new pt,this.boundsCache=new Map,this.innerBoundsCache=new Map,this.codeblockLanguage=null;let i=ep(r),s=(u=i==null?void 0:i.codeblockLanguage)!=null?u:null,o=s!==null,a=X(r),l=o&&a.forceMathLanguages.contains(s);this.mode.codeMath=l,this.mode.code=o&&!l?s:!1,o&&this.mode.code!==!1&&(this.codeblockLanguage=s,this.boundsCache.set(this.pos,i));let c=nt(e),p=l||c.inMathBound(r,this.pos);if(p!==!0&&p!==null){let d=p.mode===0;this.mode.blockMath=!d,this.mode.inlineMath=d,this.boundsCache.set(this.pos,p)}if(p){let d=this.inTextEnvironment();d==="text"?this.mode.textEnv=!0:d==="none"&&(this.mode.inlineMath=!1,this.mode.blockMath=!1,this.mode.codeMath=!1)}this.mode.text=!o&&!p}isWithinEnvironment(e,r){if(!this.mode.inMath())return null;let n=this.getInnerBounds();if(!n)return null;let{inner_start:i,inner_end:s}=n,o=this.state.sliceDoc(i,s);e-=i,Array.isArray(r)||(r=[r]);e:for(let a of r){let l=a.openSymbol.slice(-1),c=xt(l),p,u;["{","[","("].contains(l)&&a.closeSymbol===c?(p=a.openSymbol.length-1,u=l):(p=0,u=a.openSymbol);let d=o.lastIndexOf(a.openSymbol,e-1);for(;d!=-1;){let O=J(o,d+p,u,a.closeSymbol,!1);if(O===-1)continue e;if(O>=e&&e>=d+a.openSymbol.length)return ye(oe({},a),{inner_start:d+a.openSymbol.length+i,inner_end:O+i,outer_start:d+i,outer_end:O+a.closeSymbol.length+i});if(d<=0)continue e;d=o.lastIndexOf(a.openSymbol,d-1)}}return null}inTextEnvironment(){let e=this.isWithinEnvironment(this.pos,Qo);if(!e)return null;let r=e.openSymbol.slice(1,-1);return ei.includes(r)?"none":"text"}getBounds(e=this.pos){let r=this.boundsCache.get(e);if(r!==void 0)return r;let n;return this.mode.codeMath?n=Jc(this.state,e):n=nt(this.view).inMathBound(this.state,e),this.boundsCache.set(e,n),n}getInnerBounds(e=this.pos){let r,n=this.innerBoundsCache.get(e);return n!==void 0?n:(this.mode.codeMath?r=this.getBounds(e):r=Kc(this.view),this.innerBoundsCache.set(e,r),r)}}),I=t=>{let e=t.plugin(ii);if(!e)throw new Error("Context plugin not found, something went wrong with the plugin initialization");return e.init(t)};var Kc=(t,e)=>{e||(e=t.state.selection.main.to);let r=nt(t).inMathBound(t.state,e);if(!r)return null;let n=t.state.sliceDoc(r.inner_start,r.inner_end);n=n.replaceAll("\\$","\\R");let i=n.lastIndexOf("$",e-1),s=n.indexOf("$",e);return i===-1||s===-1?r:{inner_start:i+1,inner_end:s,outer_start:i,outer_end:s+1}},Jc=(t,e=t.selection.main.from)=>{let r=vo(t,e);if(!r)return null;let{begin:n,end:i}=r;return{inner_start:n.to,inner_end:i.from,outer_start:n.from,outer_end:i.to}},vo=(t,e=t.selection.main.from)=>{let n=(0,Wr.syntaxTree)(t).cursor();if(n.childBefore(e),!n.name.contains("codeblock")||n.name===So&&e<=n.to||n.name===ti)return null;do if(n.name===So)break;while(n.prev());let i=n.node;if(!i)return null;n.childAfter(e);do if(n.name===ti)break;while(n.next());let s=n.node;return!s||s.name!==ti?null:{begin:i,end:s}},ep=t=>{let e=t.selection.ranges[0].from,r=vo(t,e);if(!r)return null;let{begin:n,end:i}=r,s=t.sliceDoc(n.from,n.to).replace(/`+|~+/g,"");return{inner_start:n.to,inner_end:i.from,outer_start:n.from,outer_end:i.to,codeblockLanguage:s}},si=ni.ViewPlugin.fromClass(class{constructor(e){this.mathBounds=[];this.equations=null;this.shouldUpdate=!1;this.inMathBound=(e,r)=>{var o,a;let n=this.mathBounds;if(r<=((o=n[0])==null?void 0:o.outer_start)||r>=((a=n[n.length-1])==null?void 0:a.outer_end))return this.getEquationBounds(e,r);let i=0,s=n.length-1;for(;i<=s;){let l=i+s>>1,c=n[l];if(r<c.outer_start)s=l-1;else if(r>=c.outer_end)i=l+1;else{if(r<=c.inner_start||r>=c.inner_end)break;return c}}return this.getEquationBounds(e,r)};this.computeEquationBounds=(e,r)=>{r===void 0&&(r=e.selection.main.to);let i=(0,Wr.syntaxTree)(e).cursor();if(i.childBefore(r),i.node.firstChild&&i.name!=="Document"){let l=r;for(;e.sliceDoc(l,l+1)===`
`&&l>0;)l-=1;i.moveTo(l,-1)}if(!(i.name.contains("math")&&!i.name.startsWith("hashtag_hashtag-end_meta_tag"))||Xr.has(i.name)&&r>=i.to)return null;do if(Zr.has(i.name))break;while(i.prev());let s=i.node;if(!s)return null;i.childAfter(r);do if(Xr.has(i.name))break;while(i.next());let o=i.node;return o?s.to>r&&s.from<r&&s.name===$o?{inner_start:r,inner_end:r,outer_start:s.from,outer_end:s.to,mode:0}:o.from<r||s.to>r?null:{inner_start:s.to,inner_end:o.from,outer_start:s.from,outer_end:o.to,mode:s.name===ri?0:1}:null};this.addMathBound=e=>{if(this.mathBounds.length===0)this.mathBounds.push(e);else if(e.outer_end<=this.mathBounds[0].outer_start)this.mathBounds.unshift(e);else if(e.outer_start>=this.mathBounds[this.mathBounds.length-1].outer_end)this.mathBounds.push(e);else{let r=0,n=this.mathBounds.length-1;for(;r<=n;){let i=r+n>>1;e.outer_start<this.mathBounds[i].outer_start?n=i-1:r=i+1}this.mathBounds.splice(r,0,e)}return e};this.updateMathBounds(e)}init(e){return this.shouldUpdate&&(this.equations=null,this.updateMathBounds(e),this.shouldUpdate=!1),this}update(e){(e.docChanged||e.viewportChanged)&&(this.shouldUpdate=!0)}updateMathBounds(e){var s,o,a;let r=(0,Wr.syntaxTree)(e.state),n=[];e.visibleRanges.forEach(({from:l,to:c},p)=>{n.push([]),r.iterate({from:l,to:c,enter:u=>{(Zr.has(u.name)&&u.to<c||Xr.has(u.name)&&u.from>l)&&n[p].push(u.node)}})});let i=[];for(let l of n){if(Xr.has((s=l[0])==null?void 0:s.name)){let p=this.computeEquationBounds(e.state,l[0].from);p&&i.push(p)}let c=Zr.has((o=l[0])==null?void 0:o.name)?0:1;for(let p=c;p<l.length-1;p+=2){let u=l[p],d=l[p+1];i.push({inner_start:u.to,inner_end:d.from,outer_start:u.from,outer_end:d.to,mode:u.name===ri?0:1})}if(Zr.has((a=l[l.length-1])==null?void 0:a.name)){let p=l[l.length-1],u=this.computeEquationBounds(e.state,p.to);u&&i.push(u)}}this.mathBounds=i.filter((l,c)=>{if(c===0)return!0;let p=i[c-1];return!(p.outer_start===l.outer_start&&p.outer_end===l.outer_end)})}getEquationBounds(e,r){r||(r=e.selection.main.to);let n=this.computeEquationBounds(e,r);return n?(this.addMathBound(n),n):null}getEquations(e){return this.equations?this.equations:(this.equations=new Map(this.mathBounds.map(r=>[r.inner_start,e.sliceDoc(r.inner_start,r.inner_end)])),this.equations)}}),nt=t=>{let e=t.plugin(si);if(!e)throw new Error("MathBoundsPlugin not found, something went wrong with the plugin initialization");return e.init(t)};var To=require("@codemirror/view");var Ut=class{constructor(e,r,n,i){this.from=e,this.to=r,this.insert=n,this.keyPressed=i}getTabstops(e,r){let n=[];for(let i=r;i<r+this.insert.length;i++){if(e.charAt(i)!=="$")continue;let s=parseInt(e.charAt(i+1)),o=i,a=o+2,l="";if(isNaN(s)){if(e.charAt(i+1)!=="{")continue;let p=J(e,i+1,"{","}",!1,r+this.insert.length),u=e.slice(i,p+1);if(!u.includes(":"))continue;let d=u.indexOf(":");if(s=parseInt(u.slice(2,d)),isNaN(s)||p===-1)continue;l=e.slice(i+d+1,p),a=p+1,i=p}let c={number:s,from:o,to:a,replacement:l};n.push(c)}return n}toChangeSpec(){return this}};var Vr=require("@codemirror/language"),wo=require("@codemirror/state"),oi=To.ViewPlugin.fromClass(class{constructor(){this.snippetQueue=[]}clearSnippetQueue(){this.snippetQueue=[]}QueueSnippets(t){this.snippetQueue=this.snippetQueue.concat(t)}get snippetQueueValue(){return this.snippetQueue.map(t=>new Ut(t.from,t.to,t.insert,t.keyPressed))}});function Ir(t){let e=t.plugin(oi);if(!e)throw new Error("SnippetQueue plugin not found, something went wrong with the plugin initialization");return e}function qe(t,e,r,n,i){let s=new Ut(e,r,tp(t.state,e,r,n),i);Ir(t).QueueSnippets([s])}var tp=(t,e,r,n)=>{let o=t.doc.lineAt(r).text.match(/^(>*)(\s*)/);if(!o)return n;let a=o[1],l=o[2],c=(0,wo.countColumn)(l,t.tabSize),p=(0,Vr.getIndentUnit)(t),u=c%p;return n=n.replace(/\n(\t*)/g,(d,O)=>{let h=O.length*p+c-(O.length&&u),f=(0,Vr.indentString)(t,h);return`
`+a+f}),n};function Qt(t){Ir(t).clearSnippetQueue()}var Kt=require("@codemirror/state");var Yt=require("@codemirror/state"),Ro=require("@codemirror/commands");var Mr=require("@codemirror/view"),Nt=require("@codemirror/state"),ko=Nt.StateEffect.define(),Po=Nt.StateEffect.define(),St=Nt.StateField.define({create(){return{index:0,tabstopGroups:[],color:0}},update(t,e){let r=t.tabstopGroups,n=t.color;r.forEach(s=>s.map(e.changes));for(let s of e.effects)s.is(ko)?r.splice(t.index,1,...s.value):s.is(Po)&&(r=[],n=0);let i=t.index;return e.selection&&(i=rp(r,e.selection),r.length<=1||i>=r.length-1?(r=[],i=0,n=0):r[0].hideFromEditor()),{index:i,tabstopGroups:r,color:n}},provide:t=>Mr.EditorView.decorations.of(e=>{let r=e.state.field(t).tabstopGroups,n=[];for(let i of r)i.hidden||n.push(...i.getRanges());return Mr.Decoration.set(n,!0)})});function rp(t,e){for(let r=0;r<t.length;r++)if(t[r].containsSelection(e))return r;return t.length}function Gr(t){return{effects:[ko.of(t)]}}function Br(t){t.dispatch({effects:[Po.of(null)]})}var np=3;function Eo(t){return t.state.field(St).color++%np}var Ft=Yt.StateEffect.define(),$t=Yt.StateEffect.define(),_o=Yt.StateEffect.define(),Co=Yt.StateEffect.define(),Ao=Ro.invertedEffects.of(t=>{let e=[];for(let r of t.effects)r.is(Ft)?e.push(_o.of(r.value)):r.is(_o)?e.push(Ft.of(r.value)):r.is($t)?e.push(Co.of(null)):r.is(Co)&&e.push($t.of(null));return e}),qo=t=>{let e=t.transactions.find(n=>n.isUserEvent("undo")),r=t.transactions.find(n=>n.isUserEvent("redo"));for(let n of t.transactions)for(let i of n.effects)i.is(Ft)&&r&&t.view.dispatch({effects:Gr(i.value).effects});e&&Br(t.view)};var Xo=require("@codemirror/commands");var Ht=require("@codemirror/state"),vt=require("@codemirror/view");var jo="latex-suite-snippet-placeholder";function ip(t,e,r){let n=`${jo} ${jo}-${r}`;return vt.Decoration.mark({inclusive:!0,color:r,class:n}).range(t,e)}var ai=class{constructor(e,r){let n=e.map(i=>ip(i.from,i.to,r));this.decos=vt.Decoration.set(n,!0),this.color=r,this.hidden=!1}select(e,r,n){let i=this.toEditorSelection(),s=r?Zo(i):i;e.dispatch({selection:s,effects:n?$t.of(null):void 0}),yt(),this.hideFromEditor()}toSelectionRanges(){let e=[],r=this.decos.iter();for(;r.value!=null;)e.push(Ht.EditorSelection.range(r.from,r.to)),r.next();return e}toEditorSelection(e=!1){let r=Ht.EditorSelection.create(this.toSelectionRanges());return e&&(r=Zo(r)),r}containsSelection(e){function r(s,o){for(let a of o)if(a.from<=s.from&&a.to>=s.to)return!0;return!1}let n=this.toSelectionRanges(),i=!0;for(let s of e.ranges)if(!r(s,n)){i=!1;break}return i}hideFromEditor(){this.hidden=!0}map(e){this.decos=this.decos.map(e)}getRanges(){let e=[],r=this.decos.iter();for(;r.value!=null;)r.from!=r.to?e.push(r.value.range(r.from,r.to)):e.push(op(r.from,r.to)),r.next();return e}};function li(t,e){let r={};for(let s of t){let o=String(s.number);r[o]?r[o].push(s):r[o]=[s]}let n=[],i=Object.keys(r);i.sort((s,o)=>parseInt(s)-parseInt(o));for(let s of i){let o=new ai(r[s],e);n.push(o)}return n}function Zo(t){let e=t.ranges.map(r=>Ht.EditorSelection.range(r.to,r.to));return Ht.EditorSelection.create(e)}var sp=vt.Decoration.widget({widget:new class extends vt.WidgetType{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}});function op(t,e){return sp.range(t,e)}function Ge(t){let e=Ir(t).snippetQueueValue;if(e.length===0)return!1;let r=t.state.doc.length,n=ap(t,e),i=t.state.selection.map(n,1),s=n.apply(t.state.doc).toString(),o=lp(s,e,r),a={changes:n,selection:i};return o.length===0?(t.dispatch(a),Qt(t),!0):(cp(t,o,a,s.length),Qt(t),!0)}function ap(t,e){let r=t.state.doc,n=r.length,i=[];for(let l of e)if(l.keyPressed&&l.keyPressed.length===1){let c=t.state.doc.sliceString(l.to-1,l.to),p=l.to===0?0:l.to-1;i.push({from:p,to:l.to,insert:c+l.keyPressed})}i.length>0&&t.dispatch({changes:i,annotations:Xo.isolateHistory.of("full")});let s=Kt.ChangeSet.of(i,n).invert(r),o=Kt.ChangeSet.of(e,n);return s.compose(o)}function lp(t,e,r){let n=Kt.ChangeSet.of(e,r),s=e.map(a=>a.from).map(a=>n.mapPos(a)),o=[];for(let a=0;a<e.length;a++)o.push(...e[a].getTabstops(t,s[a]));return o}function cp(t,e,r,n){let i=Kt.ChangeSet.of(e.map(d=>({from:d.from,to:d.to,insert:d.replacement})),n),s=Eo(t),o=li(e,s);o.forEach(d=>d.map(i));let a=li(e,s);a.forEach(d=>d.map(i));let l=Gr(o).effects,u={selection:o[0].toEditorSelection(),effects:$t.of(null),sequential:!0};t.dispatch({effects:[...l,Ft.of(a)],changes:r.changes.compose(i),selection:r.selection},u)}function ci(t,e){let r=t.state.field(St).tabstopGroups,n=t.state.field(St).index;function i(o,a){let l=r[o];if(!l)return!1;let c=t.state.selection,p=l.toEditorSelection();return l.containsSelection(c)&&(p=l.toEditorSelection(!0)),c.eq(p)?i(o+a,a):(t.dispatch({selection:p}),yt(),!0)}let s=e?-1:1;return i(n+s,s)}var pi=t=>{let e=[],r=0;for(;r<t.length;){let n=t[r];if(/\s/.test(n)){r++;continue}let{token:i,nextIndex:s}=pp(t,r);e.push(i),r=s}return e},pp=(t,e)=>{s Line truncated
`;)n++;return{token:{start:e,end:n,text:t.slice(e,n)},nextIndex:n}},Op=(t,e)=>{let r=t.length,n=e+1,i=t[n];if(/[A-Za-z]/.test(i))do n++;while(n<r&&/[A-Za-z]/.test(t[n]));else n++;return{token:{start:e,end:n,text:t.slice(e,n)},nextIndex:n}},hp=(t,e)=>{let r=e+1;return{token:{start:e,end:r,text:t.slice(e,r)},nextIndex:r}};var dp=new Set(["\\left","\\bigl","\\Bigl","\\biggl","\\Biggl"]),fp=new Set(["\\right","\\bigr","\\Bigr","\\biggr","\\Biggr"]),mp=new Set(["(",")","[","]","\\lbrack","\\rbrack","\\{","\\}","\\lbrace","\\rbrace","<",">","\\langle","\\rangle","\\lt","\\gt","|","\\vert","\\lvert","\\rvert","\\|","\\Vert","\\lVert","\\rVert","\\lfloor","\\rfloor","\\lceil","\\rceil","\\ulcorner","\\urcorner","/","\\\\","\\backslash","\\uparrow","\\downarrow","\\Uparrow","\\Downarrow","."]),ui={"(":")","[":"]","{":"}","\\lbrack":"\\rbrack","\\lbrace":"\\rbrace","\\langle":"\\rangle","\\lvert":"\\rvert","\\lVert":"\\rVert","\\lfloor":"\\rfloor","\\lceil":"\\rceil","\\ulcorner":"\\urcorner","<":">"},gp=t=>dp.has(t.text),Wo=t=>fp.has(t.text),Oi=t=>mp.has(t.text),bp=(t,e)=>e.has(t.text),yp=(t,e,r)=>{let n=t[e];if(e>0){let i=t[e-1];if(Wo(i)&&Oi(n))return!0;if(gp(i)&&Oi(n))return!1}return bp(n,r)},xp=(t,e)=>{let r=t[e];if(!Wo(r))return!1;if(e+1>=t.length)return!0;let n=t[e+1];return!Oi(n)},hi=(t,e)=>{var b;if(!e.mode.inMath())return!1;let r=e.getBounds();if(!r)return!1;let{inner_start:n,inner_end:i,outer_end:s,outer_start:o}=r;if(s<=e.pos)return!1;let a=t.state.doc,l=t.state.selection.main.to,c=l-n,p=a.sliceString(n,i),u=pi(p),d=X(t).taboutClosingSymbols,O=u.findIndex(y=>y.end>c),h=O===-1?u.length:O;for(let y=h;y<u.length;y++){if(yp(u,y,d))return ke(t,n+u[y].end),!0;if(xp(u,y))return console.warn("[tabout] Found right command without following delimiter:",u[y].text,"at index",n+u[y].start),ke(t,n+u[y].end),!0}if(!(a.sliceString(l,i).trim().length===0))return!1;if(e.mode.inlineMath||e.mode.codeMath)ke(t,s);else{let y=a.lineAt(s),x=[],S=((b=a.lineAt(o).text.match(/^\s*/))==null?void 0:b[0])||"";if(y.number===a.lines)x.push({changes:{from:y.to,to:y.to,insert:`
`+S},selection:{anchor:y.to+1+S.length}});else{let m=a.lineAt(y.to+1);m.text.trim()===""?x.push({changes:{from:m.from,to:m.to,insert:S},selection:{anchor:y.to+1+S.length}}):x.push({selection:{anchor:y.to+1}})}let Q=a.lineAt(l);Q.text.trimEnd()!==Q.text&&x.push({changes:{from:Q.from,to:Q.to,insert:Q.text.trimEnd()}}),t.dispatch(...x)}return!0},Vo=(t,e)=>{let r=pi(e),n=X(t).taboutClosingSymbols,i=[],s=ur(new Set(Object.values(ui)),n),o=new Set(Object.keys(ui).filter(a=>s.has(ui[a])));for(let a=0;a<r.length;a++){let l=r[a];if(s.has(l.text)){if(i.length===0)return l.end;i.pop()}else o.has(l.text)&&i.push(l.text)}return null},Io=(t,e)=>{let r=t.state.selection.main;if(!r.empty)return!1;let n=r.from,i=zt(t,n);return i===e&&[")","]","}"].includes(i)};var Qp=t=>{var s;let e=I(t),n=t.state.doc.lineAt(e.pos).text.match(new RegExp("(?<=\\\\begin{[^]]*}|\\\\\\\\|^)(\\s|\\&)+")),i=(s=n==null?void 0:n[0].trimStart())!=null?s:"";return e.mode.blockMath?(qe(t,e.pos,e.pos,` \\\\
${i}$0`),Ge(t)):t.dispatch(t.state.replaceSelection(` \\\\ ${i}`)),!0},Sp=(t,e)=>{let r=I(t);if(r.mode.blockMath){let n=t.state.doc,i=n.lineAt(r.pos).number+1,s=n.line(i);ke(t,s.to)}else r.mode.inlineMath&&ke(t,e.outer_end);return!0},$p=t=>t.state.selection.main.empty?(t.dispatch(t.state.replaceSelection(" & ")),!0):!1,Dr=t=>e=>{let r=I(e);if(!r.mode.strictlyInMath())return!1;let i=X(e).matrixShortcutsEnvNames.map(o=>({openSymbol:"\\begin{"+o+"}",closeSymbol:"\\end{"+o+"}"})),s=r.isWithinEnvironment(r.pos,i);return s?t(e,s):!1},vp=t=>{let e=I(t),r=t.state.doc.lineAt(e.pos),n=r.text.slice(e.pos-r.from),i=Vo(t,n);return i!==null?(ke(t,e.pos+i),!0):!1},zr=Dr(Qp),Mo=Dr(Sp),Go=Dr($p),Bo=Dr(vp);var zo=require("@codemirror/commands");function Tp(t){let r=I(t).getBounds();if(!r)return!1;let{inner_start:n,inner_end:i}=r,s="\\boxed{"+t.state.sliceDoc(n,i)+"}",o=t.state.sliceDoc(n-2,n)==="$$"&&t.state.sliceDoc(i,i+2)==="$$";o&&(s=`
`+s+`
`);let a=t.state.selection.main.to;jr(t,n,i,s),ke(t,a+7+(o?1:0))}function wp(){return{id:"latex-suite-box-equation",name:"Box current equation",editorCheckCallback:(t,e)=>{let r=e.cm,i=I(r).mode.inMath();if(t)return i;i&&Tp(r)}}}function kp(){return{id:"latex-suite-select-equation",name:"Select current equation",editorCheckCallback:(t,e)=>{let r=e.cm,n=I(r),i=n.mode.inMath();if(t)return i;if(!i)return;let s=n.getBounds();if(!s)return!1;let{inner_start:o,inner_end:a}=s,l=r.state.doc.toString();l.charAt(o)===`
`&&o++,l.charAt(a-1)===`
`&&a--,fo(r,o,a)}}}function Pp(t){return{id:"latex-suite-enable-all-features",name:"Enable all features",callback:()=>v(this,null,function*(){t.settings.snippetsEnabled=!0,t.settings.autofractionEnabled=!0,t.settings.matrixShortcutsEnabled=!0,t.settings.taboutEnabled=!0,t.settings.autoEnlargeBrackets=!0,yield t.saveSettings()})}}function Ep(t){return{id:"latex-suite-disable-all-features",name:"Disable all features",callback:()=>v(this,null,function*(){t.settings.snippetsEnabled=!1,t.settings.autofractionEnabled=!1,t.settings.matrixShortcutsEnabled=!1,t.settings.taboutEnabled=!1,t.settings.autoEnlargeBrackets=!1,yield t.saveSettings()})}}function _p(t){return{id:"latex-suite-toggle-all-features",name:"Toggle all features",callback:()=>v(this,null,function*(){let e=t.settings.snippetsEnabled||t.settings.autofractionEnabled||t.settings.matrixShortcutsEnabled||t.settings.taboutEnabled||t.settings.autoEnlargeBrackets;t.settings.snippetsEnabled=!e,t.settings.autofractionEnabled=!e,t.settings.matrixShortcutsEnabled=!e,t.settings.taboutEnabled=!e,t.settings.autoEnlargeBrackets=!e,yield t.saveSettings()})}}function Cp(t){return{id:"latex-suite-toggle-conceal",name:"Toggle conceal",callback:()=>v(this,null,function*(){t.settings.concealEnabled=!t.settings.concealEnabled,yield t.saveSettings()})}}var Lo=t=>[wp(),kp(),Pp(t),Ep(t),Cp(t),_p(t)];function di(t){return{id:"latex-suite-vim-select-mode",defineType:"defineAction",type:"action",action:e=>{var i;let r=(i=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:i.Vim;if(!r)return;let n=e.listSelections();r.enterInsertMode(e),e.setSelections(n)},key:t.vimSelectMode,context:"visual"}}function fi(t){return{id:"latex-suite-vim-visual-mode",defineType:"defineAction",type:"action",action:e=>{var i;if(!e.somethingSelected())return;let r=e.listSelections(),n=(i=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:i.Vim;n&&(n.exitInsertMode(e),e.setSelections(r))},key:t.vimVisualMode,context:"insert"}}function mi(t){return{id:"latex-suite-vim-special-enter",defineType:"defineAction",type:"action",action:e=>{var a;let r=(a=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:a.Vim;if(!r)return;let n=e.getCursor().line,i=e.getLine(n);e.setCursor({line:n,ch:i.length+1});let s=Do.EditorView.findFromDOM(e.getWrapperElement());if(!s)return;if(zr(s)){r.enterInsertMode(e);return}(0,zo.insertNewlineAndIndent)({state:e.cm6.state,dispatch:l=>{let c=e.cm6;if(c.state.readOnly)return;let p="input.type.compose";if(e.curOp&&!e.curOp.lastChange&&(p="input.type.compose.start"),Array.isArray(l.annotations))try{l.annotations.forEach(u=>{u.value==="input"&&(u.value=p)})}catch(u){console.error(u)}else l.userEvent=p;c.dispatch(l)}})||console.error("Failed to insert newline and indent latex-suite-insert-newline-and-indent"),r.enterInsertMode(e)},key:t.vimMatrixEnter,context:"normal"}}function Lr(t){return[di(t),fi(t),mi(t)]}var Nr=class extends w.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}hide(){var e;(e=this.snippetsEditor)==null||e.destroy()}addHeading(e,r,n="math"){let s=new w.Setting(e).setName(r).setHeading().settingEl,o=s.createDiv();(0,w.setIcon)(o,n),o.addClass("latex-suite-settings-icon"),s.prepend(o)}display(){let{containerEl:e}=this;e.empty(),this.displaySnippetSettings(),this.displayConcealSettings(),this.displayColorHighlightBracketsSettings(),this.displayPopupPreviewSettings(),this.displayAutofractionSettings(),this.displayMatrixShortcutsSettings(),this.displayTaboutSettings(),this.displayAutoEnlargeBracketsSettings(),this.displayAdvancedSnippetSettings()}displaySnippetSettings(){let e=this.containerEl;this.addHeading(e,"Snippets","ballpen"),new w.Setting(e).setName("Enabled").setDesc("Whether snippets are enabled.").addToggle(a=>a.setValue(this.plugin.settings.snippetsEnabled).onChange(l=>v(this,null,function*(){this.plugin.settings.snippetsEnabled=l,yield this.plugin.saveSettings()})));let r=new w.Setting(e).setName("Snippets").setDesc('Enter snippets here. Remember to add a comma after each snippet, and escape all backslashes with an extra \\. Lines starting with "//" will be treated as comments and ignored.').setClass("snippets-text-area");this.createSnippetsEditor(r),new w.Setting(e).setName("Load snippets from file or folder").setDesc("Whether to load snippets from a specified file, or from all files within a folder (instead of from the plugin settings).").addToggle(a=>a.setValue(this.plugin.settings.loadSnippetsFromFile).onChange(l=>v(this,null,function*(){this.plugin.settings.loadSnippetsFromFile=l,r.settingEl.toggleClass("hidden",l),this.snippetsFileLocEl!=null&&this.snippetsFileLocEl.toggleClass("hidden",!l),yield this.plugin.saveSettings()})));let n=new DocumentFragment;n.createDiv({},a=>{a.innerHTML=`
The file or folder to load snippets from. The file or folder must be within your vault, and not within a hidden folder (such as <code>.obsidian/</code>).`});let i=new w.Setting(e).setName("Snippets file or folder location").setDesc(n),s;i.addSearch(a=>{a.setPlaceholder(W.snippetsFileLocation).setValue(this.plugin.settings.snippetsFileLocation).onChange((0,w.debounce)(l=>v(this,null,function*(){this.plugin.settings.snippetsFileLocation=l,yield this.plugin.saveSettings(!0)}),500,!0)),s=a.inputEl,s.addClass("latex-suite-location-input-el"),new It(this.app,s)}),this.snippetsFileLocEl=i.settingEl;let o=this.plugin.settings.loadSnippetsFromFile;r.settingEl.toggleClass("hidden",o),this.snippetsFileLocEl.toggleClass("hidden",!o),this.createTriggerSetting(e,"non-auto snippets","snippetsTrigger"),this.createTriggerSetting(e,"next tabstop","snippetNextTabstopTrigger"),this.createTriggerSetting(e,"previous tabstop","snippetPreviousTabstopTrigger")}displayConcealSettings(){let e=this.containerEl;this.addHeading(e,"Conceal","math-integral-x");let r=new DocumentFragment;r.createDiv({},i=>i.setText("Make equations more readable by hiding LaTeX syntax and instead displaying it in a pretty format.")),r.createDiv({},i=>i.innerHTML=`
e.g. <code>\\dot{x}^{2} + \\dot{y}^{2}</code> will display as \u1E8B\xB2 + \u1E8F\xB2, and <code>\\sqrt{ 1-\\beta^{2} }</code> will display as \u221A{ 1-\u03B2\xB2 }.
`),r.createDiv({},i=>i.setText("LaTeX beneath the cursor will be revealed.")),r.createEl("br"),r.createDiv({},i=>i.setText("Disabled by default to not confuse new users. However, I recommend turning this on once you are comfortable with the plugin!")),new w.Setting(e).setName("Enabled").setDesc(r).addToggle(i=>i.setValue(this.plugin.settings.concealEnabled).onChange(s=>v(this,null,function*(){this.plugin.settings.concealEnabled=s,yield this.plugin.saveSettings()})));let n=new DocumentFragment;n.createDiv({},i=>i.setText("How long to delay the reveal of LaTeX for, in milliseconds, when the cursor moves over LaTeX. Defaults to 0 (LaTeX under the cursor is revealed immediately).")),n.createEl("br"),n.createDiv({},i=>i.setText("Can be set to a positive number, e.g. 300, to delay the reveal of LaTeX, making it much easier to navigate equations using arrow keys.")),n.createEl("br"),n.createDiv({},i=>i.setText("Must be an integer \u2265 0.")),new w.Setting(e).setName("Reveal delay (ms)").setDesc(n).addText(i=>i.setPlaceholder(String(W.concealRevealTimeout)).setValue(String(this.plugin.settings.concealRevealTimeout)).onChange(s=>{/^\d+$/.test(s)&&(this.plugin.settings.concealRevealTimeout=Number(s),this.plugin.saveSettings())}))}displayColorHighlightBracketsSettings(){let e=this.containerEl;this.addHeading(e,"Highlight and color brackets","parentheses"),new w.Setting(e).setName("Color paired brackets").setDesc("Whether to colorize matching brackets.").addToggle(r=>r.setValue(this.plugin.settings.colorPairedBracketsEnabled).onChange(n=>v(this,null,function*(){this.plugin.settings.colorPairedBracketsEnabled=n,yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Highlight matching bracket beneath cursor").setDesc("When the cursor is adjacent to a bracket, highlight the matching bracket.").addToggle(r=>r.setValue(this.plugin.settings.highlightCursorBracketsEnabled).onChange(n=>v(this,null,function*(){this.plugin.settings.highlightCursorBracketsEnabled=n,yield this.plugin.saveSettings()})))}displayPopupPreviewSettings(){let e=this.containerEl;this.addHeading(e,"Math popup preview","superscript");let r=document.createDocumentFragment(),n=document.createElement("div");n.setText("When inside an equation, show a popup preview window of the rendered math.");let i=document.createElement("br"),s=document.createElement("div");s.setText("The popup preview will be shown for all inline math equations, as well as for block math equations in Source mode."),r.append(n,i,s);let o=new w.Setting(e).setName("Enabled").setDesc(r),a=new w.Setting(e).setName("Position").setDesc("Where to display the popup preview relative to the equation source.").addDropdown(u=>u.addOption("Above","Above").addOption("Below","Below").setValue(this.plugin.settings.mathPreviewPositionIsAbove?"Above":"Below").onChange(d=>v(this,null,function*(){this.plugin.settings.mathPreviewPositionIsAbove=d==="Above",yield this.plugin.saveSettings()}))),l=new w.Setting(e).setName("Cursor symbol").setDesc(`The symbol to use as the cursor in the popup preview such as ${W.mathPreviewCursor}. Leave it blank to turn it off.`).addText(u=>{u.setPlaceholder(W.mathPreviewCursor).setValue(this.plugin.settings.mathPreviewCursor).onChange(O=>v(this,null,function*(){this.plugin.settings.mathPreviewCursor=O,yield this.plugin.saveSettings()}));let d=e.createEl("datalist",{attr:{id:"math-preview-cursor-list"}});return["\u25B6","\u2503","|","\\_","{\\mid}","{\\triangle}"].forEach(O=>d.createEl("option",{value:O})),u.inputEl.setAttribute("list","math-preview-cursor-list"),u}),c=new w.Setting(e).setName("Highlight brackets in preview").setDesc("Whether to highlight the area within the nearest pair of brackets around the cursor in the popup preview.").addToggle(u=>u.setValue(this.plugin.settings.mathPreviewBracketHighlighting).onChange(d=>v(this,null,function*(){this.plugin.settings.mathPreviewBracketHighlighting=d,yield this.plugin.saveSettings()}))),p=[a,l,c];p.forEach(u=>u.settingEl.toggleClass("hidden",!this.plugin.settings.mathPreviewEnabled)),o.addToggle(u=>u.setValue(this.plugin.settings.mathPreviewEnabled).onChange(d=>v(this,null,function*(){this.plugin.settings.mathPreviewEnabled=d,p.forEach(O=>O.settingEl.toggleClass("hidden",!d)),yield this.plugin.saveSettings()})))}displayAutofractionSettings(){let e=this.containerEl;this.addHeading(e,"Auto-fraction","math-x-divide-y-2"),new w.Setting(e).setName("Enabled").setDesc("Whether auto-fraction is enabled.").addToggle(r=>r.setValue(this.plugin.settings.autofractionEnabled).onChange(n=>v(this,null,function*(){this.plugin.settings.autofractionEnabled=n,yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Fraction symbol").setDesc("The fraction symbol to use in the replacement. e.g. \\frac, \\dfrac, \\tfrac").addText(r=>{r.setPlaceholder(W.autofractionSymbol).setValue(this.plugin.settings.autofractionSymbol).onChange(i=>v(this,null,function*(){this.plugin.settings.autofractionSymbol=i,yield this.plugin.saveSettings()})) Line truncated
The file or folder to load snippet variables from. The file or folder must be within your vault, and not within a hidden folder (such as <code>.obsidian/</code>).`});let i=new w.Setting(e).setName("Snippet variables file or folder location").setDesc(n);i.addSearch(O=>{O.setPlaceholder(W.snippetVariablesFileLocation).setValue(this.plugin.settings.snippetVariablesFileLocation).onChange((0,w.debounce)(f=>v(this,null,function*(){this.plugin.settings.snippetVariablesFileLocation=f,yield this.plugin.saveSettings(!0)}),500,!0));let h=O.inputEl;h.addClass("latex-suite-location-input-el"),new It(this.app,h)}),this.snippetVariablesFileLocEl=i.settingEl;let s=this.plugin.settings.loadSnippetVariablesFromFile;r.settingEl.toggleClass("hidden",s),this.snippetVariablesFileLocEl.toggleClass("hidden",!s),new w.Setting(e).setName("Word delimiters").setDesc('Symbols that will be treated as word delimiters, for use with the "w" snippet option.').addText(O=>O.setPlaceholder(W.wordDelimiters).setValue(this.plugin.settings.wordDelimiters).onChange(h=>v(this,null,function*(){this.plugin.settings.wordDelimiters=h,yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Remove trailing whitespaces in snippets in inline math").setDesc("Whether to remove trailing whitespaces when expanding snippets at the end of inline math blocks.").addToggle(O=>O.setValue(this.plugin.settings.removeSnippetWhitespace).onChange(h=>v(this,null,function*(){this.plugin.settings.removeSnippetWhitespace=h,yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Remove closing $ when backspacing inside blank inline math").setDesc("Whether to also remove the closing $ when you delete the opening $ symbol inside blank inline math.").addToggle(O=>O.setValue(this.plugin.settings.autoDelete$).onChange(h=>v(this,null,function*(){this.plugin.settings.autoDelete$=h,yield this.plugin.saveSettings()})));let o=new w.Setting(e).setName("Don't trigger snippets when IME is active").setDesc("Whether to suppress snippets triggering when an IME is active."),a=new w.Setting(e).setName("Suppress IME warning").setDesc("Whether a warning is shown on startup if `Don't trigger snippets when IME is active` is enabled. Disable that setting if you are aware of the IME limitations. Currently only ios and android touch/swipe keyboards like gboard have support for IME. See https://github.com/artisticat1/obsidian-latex-suite/blob/main/DOCS.md#IME-keyboards for more info.").addToggle(O=>O.setValue(this.plugin.settings.suppressIMEWarning).onChange(h=>v(this,null,function*(){this.plugin.settings.suppressIMEWarning=h,yield this.plugin.saveSettings()})));a.settingEl.toggleClass("hidden",!(this.plugin.settings.suppressSnippetTriggerOnIME&&Yr())),o.addToggle(O=>O.setValue(this.plugin.settings.suppressSnippetTriggerOnIME).onChange(h=>v(this,null,function*(){this.plugin.settings.suppressSnippetTriggerOnIME=h,a.settingEl.toggleClass("hidden",!(h&&Yr())),yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Code languages to interpret as math mode").setDesc("Codeblock languages where the whole code block should be treated like a math block, separated by commas.").addText(O=>O.setPlaceholder(W.forceMathLanguages).setValue(this.plugin.settings.forceMathLanguages).onChange(h=>v(this,null,function*(){this.plugin.settings.forceMathLanguages=h,yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Snippet debug mode").setDesc('Set the level of debug information to log about snippet expansion. Set to "info" or "verbose" to help identify issues with snippet syntax or why a snippet is not expanding. Verbose mode will log most information to the developer console on debug level.').addDropdown(O=>O.addOption("off","Off").addOption("info","Info").addOption("verbose","Verbose").setValue(this.plugin.settings.snippetDebug).onChange(h=>v(this,null,function*(){this.plugin.settings.snippetDebug=h,yield this.plugin.saveSettings()})));let l=new w.Setting(e).setName("Vim key bindings").setDesc("turn on/off vim keybindings. Note vim needs to be enabled in obsidian itself."),c=[],p=new w.Setting(e).setName("Vim: Switch from visual mode to select mode").setDesc(`maps the key to switch from visual mode to select mode.
Keymap must be a vim keymap and can't contain any spaces. Use empty string to disable this feature.
(select mode=insert keybindings)`).addText(O=>O.setPlaceholder(W.vimSelectMode).setValue(this.plugin.settings.vimSelectMode).onChange(h=>v(this,null,function*(){var y;let f=this.plugin.settings.vimSelectMode;this.plugin.settings.vimSelectMode=h,yield this.plugin.saveSettings();let g=(y=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:y.Vim;if(!g)return;let b=di(this.plugin.settings);g[b.defineType](b.id,b.action),g.mapCommand(b.key,b.type,b.id,{},{context:b.context}),g.unmap(f,b.context)})));c.push(p);let u=new w.Setting(e).setName("Vim: Switch from select mode to visual mode").setDesc(`maps the key to switch from select mode to visual mode.
must be a vim keymap and can't contain any spaces. Example <C-g><C-A-i> = Ctrl-g + Ctrl-Alt-i.
Please check the vim keybinding first on another command like w before reporting it. Some keybindings like shift don't work due to the original vim plugin. Use empty string to disable this feature.
(select mode=insert keybindings)`).addText(O=>{O.setPlaceholder(W.vimVisualMode).setValue(this.plugin.settings.vimVisualMode).onChange(h=>v(this,null,function*(){var y;let f=this.plugin.settings.vimVisualMode;this.plugin.settings.vimVisualMode=h,yield this.plugin.saveSettings();let g=fi(this.plugin.settings),b=(y=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:y.Vim;b&&(b[g.defineType](g.id,g.action),b.mapCommand(g.key,g.type,g.id,{},{context:g.context}),b.unmap(f,g.context))}))});c.push(u);let d=new w.Setting(e).setName("Vim: run matrix enter").setDesc(`maps the key to the action of inserting a new line below while appending \\\\ to the current line in a matrix environment.
Use empty string to disable this feature.`).addText(O=>{O.setPlaceholder(W.vimMatrixEnter).setValue(this.plugin.settings.vimMatrixEnter).onChange(h=>v(this,null,function*(){var y;let f=this.plugin.settings.vimMatrixEnter;this.plugin.settings.vimMatrixEnter=h,yield this.plugin.saveSettings();let g=(y=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:y.Vim;if(!g)return;g.unmap(f,"normal");let b=mi(this.plugin.settings);g[b.defineType](b.id,b.action),g.mapCommand(b.key,b.type,b.id,{},{context:b.context}),g.unmap(f,b.context)}))});c.push(d),l.addToggle(O=>{let h=this.plugin.settings.vimEnabled&&(app==null?void 0:app.isVimEnabled());c.forEach(f=>f.settingEl.toggleClass("hidden",!h)),O.setValue(this.plugin.settings.vimEnabled&&(app==null?void 0:app.isVimEnabled())).onChange(f=>v(this,null,function*(){var b;this.plugin.settings.vimEnabled=f,yield this.plugin.saveSettings(),c.forEach(y=>y.settingEl.toggleClass("hidden",!f));let g=(b=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:b.Vim;if(g)for(let y of Lr(this.plugin.settings))g.unmap(y.key,y.context)}))})}createSnippetsEditor(e){let r=e.controlEl.createDiv("snippets-editor-wrapper"),n=e.controlEl.createDiv("snippets-footer"),i=n.createDiv("snippets-editor-validity"),s=new w.ExtraButtonComponent(i);s.setIcon("checkmark").extraSettingsEl.addClass("snippets-editor-validity-indicator");let o=i.createDiv("snippets-editor-validity-text");o.addClass("setting-item-description"),o.style.padding="0";function a(O){s.setIcon(O?"checkmark":"cross"),s.extraSettingsEl.removeClass(O?"invalid":"valid"),s.extraSettingsEl.addClass(O?"valid":"invalid"),o.setText(O?"Saved":"Invalid syntax. Changes not saved")}let l=uo,c=gi.EditorView.updateListener.of(O=>v(this,null,function*(){if(O.docChanged){let h=O.state.doc.toString(),f=!0,g;try{g=yield ze(this.plugin.settings.snippetVariables),yield ut(h,g)}catch(b){f=!1}if(a(f),!f)return;this.plugin.settings.snippets=h,yield this.plugin.saveSettings()}}));l.push(c),this.snippetsEditor=Rp(this.plugin.settings.snippets,l),r.appendChild(this.snippetsEditor.dom);let p=n.createDiv("snippets-editor-buttons");new w.ButtonComponent(p).setIcon("switch").setTooltip("Reset to default snippets").onClick(()=>v(this,null,function*(){new Fr(this.plugin.app,"Are you sure? This will delete any custom snippets you have written.",O=>O.setButtonText("Reset to default snippets").setWarning(),()=>v(this,null,function*(){this.snippetsEditor.setState(Ur.EditorState.create({doc:At,extensions:l})),a(!0),this.plugin.settings.snippets=At,yield this.plugin.saveSettings()})).open()})),new w.ButtonComponent(p).setIcon("trash").setTooltip("Remove all snippets").onClick(()=>v(this,null,function*(){new Fr(this.plugin.app,"Are you sure? This will delete any custom snippets you have written.",O=>O.setButtonText("Remove all snippets").setWarning(),()=>v(this,null,function*(){let O=`[
]`;this.snippetsEditor.setState(Ur.EditorState.create({doc:O,extensions:l})),a(!0),this.plugin.settings.snippets=O,yield this.plugin.saveSettings()})).open()}))}createTriggerSetting(e,r,n){return new w.Setting(e).setName(`Key trigger for ${r}`).setDesc(Ap(r)).addText(i=>i.setValue(this.plugin.settings[n]).setPlaceholder(W[n]).onChange(s=>v(this,null,function*(){gn(s),this.plugin.settings[n]=s,yield this.plugin.saveSettings()})))}},Fr=class extends w.Modal{constructor(e,r,n,i){super(e),this.contentEl.addClass("latex-suite-confirmation-modal"),this.contentEl.createEl("p",{text:r}),new w.Setting(this.contentEl).addButton(s=>{n(s),s.onClick(()=>v(this,null,function*(){yield i(),this.close()}))}).addButton(s=>s.setButtonText("Cancel").onClick(()=>this.close()))}};function Rp(t,e){return new gi.EditorView({state:Ur.EditorState.create({doc:t,extensions:e})})}function Yr(){return w.Platform.isMobileApp}function Ap(t){let e=new DocumentFragment,r=e.createDiv();return r.innerHTML=`What key to press to trigger ${t}. Should follow codemirror keymap syntax such as "Ctrl-k Ctrl-a". For more info see <a href="https://codemirror.net/docs/ref/#view.KeyBinding">codemirror keymap documentation</a>.`,e}var Uo={math:`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-math" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M19 5h-7l-4 14l-3 -6h-2"></path>
<path d="M14 13l6 6"></path>
<path d="M14 19l6 -6"></path>
</svg>`,"math-x-divide-y-2":`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-math-x-divide-y-2" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M3 21l18 -18"></path>
<path d="M15 14l3 4.5"></path>
<path d="M21 14l-4.5 7"></path>
<path d="M3 4l6 6"></path>
<path d="M3 10l6 -6"></path>
</svg>`,parentheses:`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-parentheses" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M7 4a12.25 12.25 0 0 0 0 16"></path>
<path d="M17 4a12.25 12.25 0 0 1 0 16"></path>
</svg>`,"math-function":`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-math-function" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M3 19a2 2 0 0 0 2 2c2 0 2 -4 3 -9s1 -9 3 -9a2 2 0 0 1 2 2"></path>
<path d="M5 12h6"></path>
<path d="M15 12l6 6"></path>
<path d="M15 18l6 -6"></path>
</svg>`,"math-integral-x":`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-math-integral-x" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M3 19a2 2 0 0 0 2 2c2 0 2 -4 3 -9s1 -9 3 -9a2 2 0 0 1 2 2"></path>
<path d="M14 12l6 6"></path>
<path d="M14 18l6 -6"></path>
</svg>`,"brackets-contain":`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brackets-contain" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M7 4h-4v16h4"></path>
<path d="M17 4h4v16h-4"></path>
<path d="M8 16h.01"></path>
<path d="M12 16h.01"></path>
<path d="M16 16h.01"></path>
</svg>`,"code-dots":`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-code-dots" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M15 12h.01"></path>
<path d="M12 12h.01"></path>
<path d="M9 12h.01"></path>
<path d="M6 19a2 2 0 0 1 -2 -2v-4l-1 -1l1 -1v-4a2 2 0 0 1 2 -2"></path>
<path d="M18 19a2 2 0 0 0 2 -2v-4l1 -1l-1 -1v-4a2 2 0 0 0 -2 -2"></path>
</svg>`,ballpen:`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-ballpen" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M14 6l7 7l-4 4"></path>
<path d="M5.828 18.172a2.828 2.828 0 0 0 4 0l10.586 -10.586a2 2 0 0 0 0 -2.829l-1.171 -1.171a2 2 0 0 0 -2.829 0l-10.586 10.586a2.828 2.828 0 0 0 0 4z"></path>
<path d="M4 20l1.768 -1.768"></path>
</svg>`,superscript:`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-superscript" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M5 7l8 10m-8 0l8 -10"></path>
<path d="M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2"></path>
</svg>`,tabout:`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 10.583 10.583">
<g style="fill:none;stroke:currentColor;stroke-width:3.22892904;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none">
<path d="M14.818 22.164h-.688c-1.52 0-3.983-1.82-3.983-4.066V-.612c0-2.245 2.462-4.065 3.983-4.065h.688" style="stroke-width:3.22892904;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(6.566 2.931) scale(.24373)"/>
<path d="M5.605 22.16h.662c1.462 0 3.88-1.906 3.88-4.258v-1.065M5.605-4.674h.662c1.462 0 3.88 1.907 3.88 4.259V.65" style="stroke-width:3.22892904;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(6.566 2.931) scale(.24373)"/>
</g>
<g style="fill:none;stroke:currentColor;stroke-width:3.22892904;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none">
<path d="M0 0h24v24H0Z" style="fill:none;stroke:none;stroke-width:3.22892904;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(2.662 4.719) scale(.24373)" stroke="none"/>
<path d="M-9.136 8.694v5.17a1 1 0 0 0 1 1h23.658a1 1 0 0 0 1-1v-5.17" style="stroke-width:3.22892904;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(2.662 4.719) scale(.24373)"/>
</g>
</svg>
`};var nn=require("@codemirror/view");var me=require("@codemirror/view"),it=require("@codemirror/state");var Hr=require("obsidian");function H(...t){return t}var bi=class extends me.WidgetType{constructor(r,n,i){super();this.symbol=r;this.className=n||"",this.elementType=i||"span"}eq(r){return r.symbol==this.symbol&&r.className===this.className&&r.elementType===this.elementType}toDOM(){let r=document.createElement(this.elementType);return r.className="cm-math "+this.className,r.textContent=this.symbol,r}ignoreEvent(){return!1}},yi=class extends me.WidgetType{constructor(r){super();this.symbol=r}eq(r){return r.symbol==this.symbol}toDOM(){let r=document.createElement("span");return r.className="cm-math",r.textContent=this.symbol,r}ignoreEvent(){return!1}};function qp(t,e,r){if(e.length!==r.length)return!1;for(let n=0;n<e.length;++n){let i=t.changes.mapPos(e[n].start,1),s=t.changes.mapPos(e[n].end,-1);if(!(i==r[n].start&&s==r[n].end))return!1}return!0}function jp(t,e){let r="apart";for(let n of t.ranges)for(let i of e){let s=Math.max(n.from,i.start),o=Math.min(n.to,i.end);if(s===o&&(s===i.start||s===i.end)){r="edge";continue}if(s<=o)return"within"}return r}function Zp(t,e,r,n){return r||e==="apart"?"conceal":e==="within"||!n||!t||t==="within"?"reveal":"delay"}function No(t){let e=[];for(let r of t)if(r.enable)for(let n of r.spec)if(n.start===n.end)e.push(me.Decoration.widget({widget:new yi(n.text),block:!1}).range(n.start,n.end));else{let i=n.text==="";e.push(me.Decoration.replace({widget:new bi(n.text,n.class,n.elementType),inclusiveStart:i,inclusiveEnd:!1,block:!1}).range(n.start,n.end))}return me.Decoration.set(e,!0)}function Fo(t){let e=t.filter(i=>i.enable).flatMap(i=>i.spec).sort((i,s)=>i.start-s.start),r=new class extends it.RangeValue{},n=new it.RangeSetBuilder;for(let i=0;i<e.length;i++)e[i].text===""?i+1!=e.length&&e[i].end==e[i+1].start?(n.add(e[i].start,e[i+1].end,r),i++):n.add(e[i].start,e[i].end+1,r):n.add(e[i].start,e[i].end,r);return n.finish()}var Yo=me.ViewPlugin.fromClass(class{constructor(t){this.delayedRevealCallback=(t,e)=>{var r;for(let n of t)n.enable=!1;this.decorations=No(this.concealments),this.atomicRanges=Fo(this.concealments),e.dispatch(),(r=e==null?void 0:e.cm)==null||r.signal("vim-command-done")};this.concealments=[],this.decorations=me.Decoration.none,this.atomicRanges=it.RangeSet.empty;let e=X(t).concealRevealTimeout;this.delayEnabled=e>0,this.cached_equations={},this.concealSpecs=[],this.delayedReveal=(0,Hr.debounce)(this.delayedRevealCallback,e,!0),this.update({view:t,state:t.state,docChanged:!0})}update(t){if(t.docChanged||t.viewportChanged||t.selectionSet)if(this.delayedReveal.cancel(),!t.docChanged&&!t.viewportChanged)this.updateFromConcealSpecs(this.concealSpecs,t);else{let{specs:e,cached_equations:r}=Ho(t.view,this.cached_equations);this.cached_equations=r,this.concealSpecs=e,this.updateFromConcealSpecs(e,t)}}updateFromConcealSpecs(t,e){var o,a;let r=e.state.selection,n=(a=(o=e.view.plugin(Hr.livePreviewState))==null?void 0:o.mousedown)!=null?a:!1,i=[],s=[];for(let l of t){let c=jp(r,l),p=this.concealments.find(O=>qp(e,O.spec,l)),u=Zp(p==null?void 0:p.cursorPosType,c,n,this.delayEnabled),d={spec:l,cursorPosType:c,enable:u!=="reveal"};u==="delay"&&s.push(d),i.push(d)}s.length>0&&this.delayedReveal(s,e.view),this.concealments=i,this.decorations=No(this.concealments),this.atomicRanges=Fo(this.concealments)}},{decorations:t=>t.decorations,provide:t=>me.EditorView.atomicRanges.of(e=>{var r,n;return(n=(r=e.plugin(t))==null?void 0:r.atomicRanges)!=null?n:it.RangeSet.empty})});var Ko={aleph:"\u2135",amalg:"\u2A3F",And:"&",angle:"\u2220",approx:"\u2248",approxeq:"\u224A",ast:"\u2217",asymp:"\u224D",backepsilon:"\u220D",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",backslash:"\u2216",barwedge:"\u22BC",Bbbk:"k",because:"\u2235",beth:"\u2136",between:"\u226C",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",blacklozenge:"\u29EB",blacksquare:"\u25FC",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",bot:"\u22A5",bowtie:"\u22C8",Box:"\u25FB",boxdot:"\u22A1",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",bullet:"\u2219",bumpeq:"\u224F",Bumpeq:"\u224E",Cap:"\u22D2",cap:"\u2229",cdot:"\u22C5",cdotp:"\u22C5",cdots:"\u22EF",celsius:"\u2103",centerdot:"\u22C5",checkmark:"\u2713",circ:"\u2218",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",circledR:"\xAE",circledS:"\u24C8",clubsuit:"\u2663",complement:"\u2201",cong:"\u2245",coprod:"\u2210",copyright:"\xA9",cp:"\xD7",cross:"\xD7",crossproduct:"\xD7",Cup:"\u22D3",cup:"\u222A",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",da Line truncated
`),o=r[0][0]===`
`?" ":"",a=r.index+r[0].length-1,l=n+1;e.push(H({start:s,end:a,text:o},{start:a,end:a+1,text:"(",class:"cm-bracket"},{start:n,end:n+1,text:")",class:"cm-bracket"},{start:n+1,end:n+1,text:"/",class:"cm-bracket"},{start:l,end:l+1,text:"(",class:"cm-bracket"},{start:i,end:i+1,text:")",class:"cm-bracket"}))}return e}function Up(t){let e="\\\\operatorname{([A-Za-z]+)}",r=new RegExp(e,"g"),n=[...t.matchAll(r)],i=[];for(let s of n){let o=s[1],a=s.index,l=a+s[0].length;i.push(H({start:a,end:l,text:o,class:"cm-concealed-mathrm cm-variable-2"}))}return i}function Ho(t,e){let r=nt(t).getEquations(t.state),n={};for(let s of r.values()){if(s in e){n[s]=e[s];continue}let o=[...Tt(s,"\\^","",ra),...Tt(s,"_","",na),...Tt(s,"\\\\frac","",ta),...Wp(s,Qi,Xp),...aa(s,!0,Qi),...aa(s,!1,Qi),...st(s,"hat","\u0302"),...st(s,"dot","\u0307"),...st(s,"ddot","\u0308"),...st(s,"overline","\u0304"),...st(s,"bar","\u0304"),...st(s,"tilde","\u0303"),...st(s,"vec","\u20D7"),...Tt(s,"\\\\","",ia,"cm-bracket"),...Bp(s,"\\\\mathcal{","}",oa),...Ip(s,xi),...Vp(s,sa),...Mp(s),...Dp(s),...zp(s),...Lp(s),...Gp(s,ea),...Up(s)];n[s]=o}e=n;let i=[];for(let[s,o]of r.entries())for(let a of n[o])i.push(a.map(l=>ye(oe({},l),{start:l.start+s,end:l.end+s})));return{specs:i,cached_equations:e}}function Si(t,e){return t.includes(e)}function ca(t,e){return e in t}var ua=["\\big","\\Big","\\bigg","\\Bigg","\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\left","\\right"],Oa=["{","}"],Kr={"(":")","[":"]","\\{":"\\}","\\langle":"\\rangle","\\lvert":"\\rvert","\\lVert":"\\rVert","\\lceil":"\\rceil","\\lfloor":"\\rfloor"},Np=[...ua,...Object.keys(Kr),...Object.values(Kr)],Fp=[...Np.map(wt).sort((t,e)=>t.length-e.length),...Oa.map(wt)].join("|"),pa=new RegExp(Fp,"g"),Yp=Object.fromEntries(Object.entries(Kr).map(([t,e])=>[e,t])),Jr=t=>{let e=X(t);if(!e.autoEnlargeBrackets)return;let n=I(t).getBounds();if(!n)return!1;let{inner_start:i,inner_end:s}=n,o=t.state.sliceDoc(i,s),a="\\left",l="\\right",c=[],p,u=null;pa.lastIndex=0;let d=0,O=[d];for(;(p=pa.exec(o))!==null;){let h=p[0],f=p.index;if(Si(ua,h)){u=f+h.length;continue}else if(Si(Oa,h)){h==="{"?O.push(++d):O.length>1&&O.pop();continue}else if(ca(Kr,h)){u===null||/\S/.test(o.slice(u,f))?c.push({index:f,match:h,level:O[O.length-1]}):u!==null&&c.push({match:h,ignore:!0,level:O[O.length-1]}),u=null;continue}let g=u!==null&&!/\S/.test(o.slice(u,f));u=null;let b=Yp[h];for(let y=c.length-1;y>=0;y--){let x=c[y];if(x.match===b&&("ignore"in x||g)){c.splice(y,1);break}if("ignore"in x||x.level!==O[O.length-1]||x.match!==b)continue;let S=x.index,Q=x.match,m=S+Q.length,T=p.index,C=o.slice(m,T);if(!e.autoEnlargeBracketsTriggers.some(k=>C.contains(k)))break;qe(t,i+S,i+m,a+Q+" "),qe(t,i+T,i+T+h.length," "+l+h),c.splice(y,1);break}}Ge(t)};var ha=require("obsidian"),en=null,$i=(t,e,r,n)=>{let i=!1;for(let o of e.ranges)Hp(t,e,r,o,n).shouldAutoEnlargeBrackets&&(i=!0);let s=Ge(t);return i&&Jr(t),s},Hp=(t,e,r,n,i)=>{var d;let s=X(t),{from:o,to:a}=n,l=t.state.sliceDoc(o,a),c=t.state.sliceDoc(0,a),p=(d=r.key)!=null?d:"";if(r.key&&r.key.length!==1)return{success:!1,shouldAutoEnlargeBrackets:!1};let u=c+p;for(let O=0;O<r.snippets.length;O++){let h=r.snippets[O];if(!Kp(h.options,e.mode))continue;let f=h.process(u,n,l);if(f===null)continue;let g=!1;for(let m of h.excludedEnvironments)e.isWithinEnvironment(a,m)&&(g=!0);if(g)continue;let b=f.triggerPos;if(h.options.onWordBoundary&&!Jp(t.state,b,a,s.wordDelimiters))continue;let y=f.replacement;e.mode.inlineMath&&s.removeSnippetWhitespace&&(y=eu(y,e));let x=b,S=h.options.automatic&&h.type!=="visual"?p:void 0;qe(t,x,a,y,S);let Q=s.autoEnlargeBracketsTriggers.some(m=>y.contains(m));if(i==="info"||i==="verbose"){let m=h.trigger.toString(),T=h.triggerKey?`<li>Trigger key: ${new Option(h.triggerKey).innerHTML}
</li>`:"",C=h.description,E=`Latex Suite: <br><ul><li>Description: ${new Option(C).innerHTML}
</li><li>Parsed trigger: <code>${new Option(m).innerHTML}</code>
</li>`+T+`<li>Replacement: <code>${new Option(y).innerHTML}</code>
</li><li>Auto-enlarge brackets: ${Q}
</li></ul>`,k=new DocumentFragment,P=k.createDiv();P.innerHTML=E,en==null||en.hide(),en=new ha.Notice(k,5e3),console.info(P.textContent)}return i==="verbose"&&console.debug({snippets_unexpanded:r.snippets.slice(0,O).map(m=>({description:m.description,trigger:m.trigger,options:m.options,replacement:m.replacement})),current_mode:e.mode,updatedLine:u}),{success:!0,shouldAutoEnlargeBrackets:Q}}return{success:!1,shouldAutoEnlargeBrackets:!1}},Kp=(t,e)=>{if((t.mode.inlineMath&&e.inlineMath||t.mode.blockMath&&e.blockMath||(t.mode.inlineMath||t.mode.blockMath)&&e.codeMath)&&!e.textEnv||e.inMath()&&e.textEnv&&t.mode.text||t.mode.text&&e.text||t.mode.code===e.code&&e.code!==!1||t.mode.code===!0&&e.code!==!1)return!0},Jp=(t,e,r,n)=>{let i=t.sliceDoc(e-1,e),s=t.sliceDoc(r,r+1);return n=n.replace("\\n",`
`),n.contains(i)&&n.contains(s)},eu=(t,e)=>{let r=0;if(t.endsWith(" "))r=-1;else{let n=t.slice(-3),i=n.slice(-1);n.slice(0,2)===" $"&&!isNaN(parseInt(i))&&(r=-3)}return r!=0&&(r===-1?t=t.trimEnd():r===-3&&(t=t.slice(0,-3)+t.slice(-2))),t};var da=(t,e)=>{for(let n of e.ranges)tu(t,e,n);let r=Ge(t);return r&&Jr(t),r},tu=(t,e,r)=>{let n=X(t),{from:i,to:s}=r;for(let O of n.autofractionExcludedEnvs)if(e.isWithinEnvironment(s,O))return!1;let o=e.getBounds();if(!o)return!1;let a=o.inner_start,l=t.state.sliceDoc(0,s),c=a;if(i!=s)c=i;else{let O="alpha|beta|gamma|Gamma|delta|Delta|epsilon|varepsilon|zeta|eta|theta|Theta|iota|kappa|lambda|Lambda|mu|nu|omicron|xi|Xi|pi|Pi|rho|sigma|Sigma|tau|upsilon|Upsilon|varphi|phi|Phi|chi|psi|Psi|omega|Omega",h=new RegExp("("+O+") ([^ ])","g");l=l.replace(h,"$1#$2");for(let f=l.length-1;f>=a;f--){let g=l.charAt(f);if([")","]","}"].contains(g)){let b=g,y=Lt(b),x=J(l,f,y,b,!0);if(x===-1)return!1;if(f=x,f<a){c=a;break}}if(` $([{
`.concat(n.autofractionBreakingChars).contains(g)){c=f+1;break}}}if(c===s)return!1;let p=t.state.sliceDoc(c,s);p.at(0)==="("&&p.at(-1)===")"&&J(p,0,"(",")",!1)===p.length-1&&(p=p.slice(1,-1));let u=p===""?`${n.autofractionSymbol}{$0}{$1}$2`:`${n.autofractionSymbol}{${p}}{$0}$1`,d=i!=s?void 0:"/";return qe(t,c,s,u,d),!0};var rn=require("@codemirror/view"),kt=require("@codemirror/state"),Pt=require("obsidian");var fa=require("@codemirror/language"),vi=kt.StateEffect.define(),tn=kt.StateField.define({create:()=>[],update(t,e){for(let r of e.effects)if(r.is(vi))return r.value;return t},provide:t=>rn.showTooltip.computeN([t],e=>e.field(t).map(r=>r.tooltip))}),ru=(t,e,r,n)=>{let i=(l,c,p,u,d)=>{let O=0;for(let h=c;h>=0&&h<l.length;h+=d)if(l[h]===p&&O++,l[h]===u){if(O===0)return h;O--}return-1},s=t[e]===n?e-1:e,o=i(t,s,n,r,-1),a=i(t,e,r,n,1);return{left:o,right:a}};function ma(t){if(!(t.docChanged||t.selectionSet))return;let r=X(t.state),n=I(t.view),i=nu(t.state,n);if(!i){t.state.field(tn).length>0&&t.view.dispatch({effects:[vi.of([])]});return}let s=t.state.sliceDoc(i.inner_start,i.inner_end),o=n.pos,l=(0,fa.syntaxTree)(t.state).cursor();l.moveTo(o,-1);let c;l.name==="math_tag"&&l.from<o&&l.to>=o?c=l.from:c=o;let p=c-i.inner_start,u,d=s.replaceAll(/\\[\\{}]/g,"\\R"),{left:O,right:h}=r.mathPreviewBracketHighlighting?ru(d,p,"{","}"):{left:-1,right:-1};if(h!==-1&&O!==-1){let x=Math.max(O+1,p);u=s.slice(0,O+1)+"\\style{background-color: var(--latex-suite-math-preview-highlight);}{"+s.slice(O+1,x)+r.mathPreviewCursor+s.slice(x,h)+"}"+s.slice(h)}else u=s.slice(0,p)+r.mathPreviewCursor+s.slice(p);let f=t.state.field(tn);if(f.length===1&&f[0].equation===u&&f[0].bounds.inner_start===i.inner_start&&f[0].bounds.inner_end===i.inner_end)return;let g=r.mathPreviewPositionIsAbove,b=()=>{var S;let x=document.createElement("div");if(x.addClass("cm-tooltip-cursor"),x.addClass(g?"cm-tooltip-above":"cm-tooltip-below"),n.mode.blockMath){let Q=(S=t.state.doc.lineAt(i.inner_start).text.match(/^ {0,3}(>+)/))==null?void 0:S[1].length;if(Q){let m=new RegExp(`^ {0,3}>{${Q}}`,"gm");m.test(s)&&(u=u.replaceAll(m,""))}}try{let Q=(0,Pt.renderMath)(u,n.mode.blockMath||n.mode.codeMath),m=Q.querySelector('[style*="background-color: var(--latex-suite-math-preview-highlight)"]');m==null||m.addClass("latex-suite-math-preview-highlight"),m==null||m.style.removeProperty("background-color"),x.appendChild(Q),(0,Pt.finishRenderMath)()}catch(Q){console.error("Error rendering math in tooltip:",Q),x.textContent=s}return{dom:x}},y=[];if(n.mode.blockMath||n.mode.codeMath)y=[{pos:g?i.inner_start:i.inner_end,above:g,strictSide:!0,arrow:!0,create:b}];else if(n.mode.inlineMath&&g)y=[{pos:i.inner_start,above:!0,strictSide:!0,arrow:!0,create:b}];else if(n.mode.inlineMath&&!g){let x=kt.EditorSelection.range(i.inner_end,i.inner_end);y=[{pos:Math.max(i.inner_start,t.view.moveToLineBoundary(x,!1).anchor),above:!1,strictSide:!0,arrow:!0,create:b}]}t.view.dispatch({effects:[vi.of(y.map(x=>({equation:u,bounds:i,pos:x.pos,tooltip:x})))]})}function nu(t,e){if(!e.mode.inMath())return null;let r=t.field(Pt.editorLivePreviewField);if(e.mode.blockMath&&r)return null;let n=e.getBounds();return!n||t.sliceDoc(n.inner_start,n.inner_end).trim()===""?null:n}var ga=rn.EditorView.baseTheme({".cm-tooltip.cm-tooltip-cursor":{backgroundColor:"var(--background-secondary)",color:"var(--text-normal)",border:"1px solid var(--background-modifier-border-hover)",padding:"4px 6px",borderRadius:"6px","& .cm-tooltip-arrow:before":{borderTopColor:"var(--background-modifier-border-hover)",borderBottomColor:"var(--background-modifier-border-hover)"},"& .cm-tooltip-arrow:after":{borderTopColor:"var(--background-secondary)",borderBottomColor:"var(--background-secondary)"},"& p":{margin:"0px"},"& mjx-container":{padding:"2px !important"}}});var ba=t=>{X(t.state).mathPreviewEnabled&&ma(t),qo(t)},sn=nn.ViewPlugin.fromClass(class{constructor(){this.lastKeyboardEvent=null}onKeydown(t,e){if(t.key=="Unidentified"||t.key=="Process"||t.key=="Dead"){this.lastKeyboardEvent=t;return}else this.lastKeyboardEvent=null;(xa(t.key,t.ctrlKey||t.metaKey,Jn(e,t),e)||(0,nn.runScopeHandlers)(e,t,"latex-suite"))&&t.preventDefault()}},{eventHandlers:{keydown(t,e){e.plugin(sn).onKeydown(t,e)}}}),ya=(t,e,r,n)=>{var s;let i=(s=t.plugin(sn))==null?void 0:s.lastKeyboardEvent;return n==="\0\0"?!0:n.length==1&&i&&(n===" "&&(n="Tab"),xa(n,i.ctrlKey||i.metaKey,Jn(t,i),t))?(mo(t),!0):!1},xa=(t,e,r,n)=>{if(t.length>1)return!1;let i=X(n),s=I(n);if(!i.snippetsEnabled||i.suppressSnippetTriggerOnIME&&r||e)return!1;let o=i.snippets.filter(a=>a.options.automatic);try{if($i(n,s,{snippets:o,key:t},i.snippetDebug))return!0}catch(a){Qt(n),console.error(a)}return!1};function Qa(t){let e=[];t.autoDelete$&&e.push({key:"Backspace",run:function(a){if(!X(a).autoDelete$)return!1;let l=I(a);if(!l.mode.strictlyInMath())return!1;let c=zt(a,l.pos),p=zt(a,l.pos-1);return c==="$"&&p==="$"?(jr(a,l.pos-1,l.pos+1,""),Br(a),!0):!1}});let r=new Set(t.snippets.map(o= Line truncated
/* nosourcemap */
+11
View File
@@ -0,0 +1,11 @@
{
"id": "obsidian-latex-suite",
"name": "Latex Suite",
"version": "1.11.5",
"minAppVersion": "1.0.0",
"description": "Make typesetting LaTeX math as fast as handwriting through snippets, text expansion, and editor enhancements",
"author": "artisticat",
"authorUrl": "https://github.com/artisticat1",
"fundingUrl": "https://ko-fi.com/artisticat",
"isDesktopOnly": false
}
+264
View File
@@ -0,0 +1,264 @@
/* Settings panel */
.setting-item.hidden {
display: none;
}
.setting-item.setting-item-heading .latex-suite-settings-icon {
margin-right: var(--size-4-2);
display: inline-flex;
}
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) {
border-bottom: 1px solid var(--background-modifier-border);
}
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) + .setting-item {
border-top: none;
}
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) ~ .setting-item:not(.setting-item-heading), .latex-suite-snippet-variables-setting + .setting-item-control {
width: calc(100% - 26px);
margin-left: 26px;
}
.latex-suite-snippet-variables-setting .setting-item-control {
height: 120px;
}
.latex-suite-snippet-variables-setting .setting-item-control textarea {
width: 100%;
height: 100%;
}
.snippets-text-area, .latex-suite-snippet-variables-setting {
display: inline-block;
}
.snippets-text-area .setting-item-info, .latex-suite-snippet-variables-setting .setting-item-info {
margin-bottom: 0.75rem;
}
.snippets-text-area .setting-item-control {
flex-direction: column;
align-items: flex-end;
}
.snippets-editor-wrapper {
width: 100%;
margin-bottom: 0.75rem;
}
.snippets-editor-wrapper .cm-editor {
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
font-size: var(--font-inputs);
height: 20em;
outline: none !important;
text-align: left;
}
.snippets-editor-wrapper .cm-line, .snippets-editor-wrapper .cm-lineNumbers {
font-family: var(--font-monospace);
}
.snippets-footer {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.snippets-editor-validity {
display: flex;
align-items: center;
}
.snippets-editor-validity-indicator {
color: white;
display: inline-block;
border-radius: 1em;
margin-right: 10px;
cursor: default;
visibility: hidden;
}
.snippets-editor-validity-indicator svg {
width: 16px !important;
height: 16px !important;
}
.snippets-editor-validity-indicator:hover {
color: white;
}
.snippets-editor-validity-indicator.valid {
background-color: var(--color-green);
visibility: visible;
}
.snippets-editor-validity-indicator.invalid {
background-color: var(--color-red);
visibility: visible;
}
.snippets-editor-buttons {
display: flex;
flex-direction: row;
}
.latex-suite-confirmation-modal .setting-item {
border: none;
}
.search-input-container input.latex-suite-location-input-el {
width: initial;
}
/*
Snippet color classes.
*/
/* These extra selectors enforce their color on all children, because CodeMirror does weird nesting of spans when
nesting multiple decorations. */
.latex-suite-snippet-placeholder {
border-radius: 2px;
background-color: var(--placeholder-bg);
outline: var(--placeholder-outline) solid 1px;
}
.latex-suite-snippet-placeholder-0, span.latex-suite-snippet-placeholder-0 span {
--placeholder-bg: #87cefa2e;
--placeholder-outline: #87cefa6e;
}
.theme-dark .latex-suite-snippet-placeholder-0, span.latex-suite-snippet-placeholder-0 span {
--placeholder-outline: #87cefa43;
}
.latex-suite-snippet-placeholder-1, span.latex-suite-snippet-placeholder-1 span {
--placeholder-bg: #ffa50033;
--placeholder-outline: #ffa5006b;
}
.theme-dark .latex-suite-snippet-placeholder-1, span.latex-suite-snippet-placeholder-1 span {
--placeholder-outline: #ffa5004d;
}
.latex-suite-snippet-placeholder-2, span.latex-suite-snippet-placeholder-2 span {
--placeholder-bg: #00ff0022;
--placeholder-outline: #00ff0060;
}
.theme-dark .latex-suite-snippet-placeholder-2, span.latex-suite-snippet-placeholder-2 span {
--placeholder-outline: #00ff003d;
}
/* Conceal */
span.cm-math.cm-concealed-bold {
font-weight: bold;
}
span.cm-math.cm-concealed-underline {
text-decoration: underline;
}
span.cm-math.cm-concealed-mathrm, sub.cm-math.cm-concealed-mathrm {
font-style: normal;
}
/* Conceal superscripts without changing line height */
sup.cm-math {
line-height: 0;
}
sup.cm-math, sub.cm-math {
font-style: italic;
}
/* Inline math tooltip styling */
.theme-light .cm-tooltip.cm-tooltip-cursor {
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.028), 0px 3.4px 6.7px rgba(0, 0, 0, .042), 0px 5px 20px rgba(0, 0, 0, .07);
}
.theme-dark .cm-tooltip.cm-tooltip-cursor {
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1),
0px 3.4px 6.7px rgba(0, 0, 0, 0.15),
0px 0px 30px rgba(0, 0, 0, 0.27);
}
/* CM6 puts the top of the tooltip higher than what's viewable (negative top value),
so to compensate for this, we align the content to the bottom of the tooltip container,
and limit the height.
*/
.cm-tooltip.cm-tooltip-cursor.cm-tooltip-above {
display: flex;
}
.cm-tooltip.cm-tooltip-cursor.cm-tooltip-above > .MathJax {
overflow-y: auto;
max-height: 70%;
display: inline-block;
align-self: flex-end;
}
.cm-tooltip.cm-tooltip-cursor.cm-tooltip-below > .MathJax {
overflow-y: auto;
max-height: 90%;
}
/* Highlight brackets */
.theme-light .latex-suite-highlighted-bracket, .theme-light .latex-suite-highlighted-bracket [class^="latex-suite-color-bracket-"] {
background-color: hsl(var(--accent-h), var(--accent-s), 40%, 0.3);
}
.theme-dark .latex-suite-highlighted-bracket, .theme-dark .latex-suite-highlighted-bracket [class^="latex-suite-color-bracket-"] {
background-color: hsl(var(--accent-h), var(--accent-s), 70%, 0.6);
}
/* Color matching brackets */
.theme-light .latex-suite-color-bracket-0, .theme-light .latex-suite-color-bracket-0 .cm-bracket {
color: #527aff;
}
.theme-dark .latex-suite-color-bracket-0, .theme-dark .latex-suite-color-bracket-0 .cm-bracket {
color: #47b8ff;
}
.theme-light .latex-suite-color-bracket-1, .theme-light .latex-suite-color-bracket-1 .cm-bracket {
color: #ff50b7;
}
.theme-dark .latex-suite-color-bracket-1, .theme-dark .latex-suite-color-bracket-1 .cm-bracket {
color: #ff55cd;
}
.theme-light .latex-suite-color-bracket-2, .theme-light .latex-suite-color-bracket-2 .cm-bracket {
color: #69ba00;
}
.theme-dark .latex-suite-color-bracket-2, .theme-dark .latex-suite-color-bracket-2 .cm-bracket {
color: #73ff63;
}
/* .latex-suite-color-bracket-3 {
color: #8de15c;
} */
.latex-suite-math-preview-highlight {
background-color: var(--text-selection);
}
.cm-snippetFieldPosition {
vertical-align: text-top;
width: 0;
height: 1.15em;
display: inline-block;
margin: 0 -0.7px -.7em;
border-left: 1.4px dotted #888;
}
+171
View File
@@ -0,0 +1,171 @@
{
"remoteType": "",
"useCustomRequestHandler": false,
"couchDB_URI": "",
"couchDB_USER": "",
"couchDB_PASSWORD": "",
"couchDB_DBNAME": "",
"liveSync": false,
"syncOnSave": true,
"syncOnStart": false,
"savingDelay": 200,
"lessInformationInLog": false,
"gcDelay": 0,
"versionUpFlash": "",
"minimumChunkSize": 20,
"longLineThreshold": 250,
"showVerboseLog": false,
"suspendFileWatching": false,
"trashInsteadDelete": true,
"periodicReplication": false,
"periodicReplicationInterval": 60,
"syncOnFileOpen": false,
"encrypt": false,
"passphrase": "",
"usePathObfuscation": false,
"doNotDeleteFolder": false,
"resolveConflictsByNewerFile": false,
"batchSave": false,
"batchSaveMinimumDelay": 5,
"batchSaveMaximumDelay": 60,
"deviceAndVaultName": "",
"usePluginSettings": false,
"showOwnPlugins": false,
"showStatusOnEditor": true,
"showStatusOnStatusbar": true,
"showOnlyIconsOnEditor": false,
"hideFileWarningNotice": false,
"networkWarningStyle": "",
"usePluginSync": false,
"autoSweepPlugins": false,
"autoSweepPluginsPeriodic": false,
"notifyPluginOrSettingUpdated": false,
"checkIntegrityOnSave": false,
"batch_size": 25,
"batches_limit": 25,
"useHistory": true,
"disableRequestURI": true,
"skipOlderFilesOnSync": true,
"checkConflictOnlyOnOpen": false,
"showMergeDialogOnlyOnActive": false,
"syncInternalFiles": false,
"syncInternalFilesBeforeReplication": false,
"syncInternalFilesIgnorePatterns": "\\/node_modules\\/, \\/\\.git\\/, \\/obsidian-livesync\\/",
"syncInternalFilesTargetPatterns": "",
"syncInternalFilesInterval": 60,
"additionalSuffixOfDatabaseName": "5f524b0a96e7ead5",
"ignoreVersionCheck": false,
"lastReadUpdates": 0,
"deleteMetadataOfDeletedFiles": false,
"syncIgnoreRegEx": "",
"syncOnlyRegEx": "",
"customChunkSize": 50,
"readChunksOnline": true,
"watchInternalFileChanges": true,
"automaticallyDeleteMetadataOfDeletedFiles": 0,
"disableMarkdownAutoMerge": false,
"writeDocumentsIfConflicted": false,
"useDynamicIterationCount": false,
"syncAfterMerge": false,
"configPassphraseStore": "",
"encryptedPassphrase": "",
"encryptedCouchDBConnection": "%$M4KRzyh0b1UfuWGwPdnUEMFMq0x2hm3lXtw/sOuSP1gy3nfVRxz1XXIBCkqLAf62Awc1fjuk2u7fn+0DbwBZy3L8KA68x/kFm0p398tpP7u6dVuF8PuYdv5HhfW3nAmXwOymd94oShLtZwkfQAmTCumwQ5P7LGk/VI5gsQzIkIgdzSUyVx6vK6bBSLDYZ2pk8VsWTzEZvFB3C2/obuvduDiWC2GuxQupvNY77mvFWNdqs5sZif/r+AExdjh2fmqA8tkJN4kNp0lCQw70WiSMdaCRrUMzrD2LkorBFaK+o+UeY+jZFdI4K9HMgODAbSX69D5u8cS6QrTniepMqVn2bTAKS92gv3PktDYHr+2ppxz8Ljw5075FqbS2ybqZwFMI48yxgbk/ezqS5Q49yLK3PW4v83uY8ZcDjxSDSEcC05JT2sH5yhSvtKfc6qVBMs+nCPxPrLn1uj3qM0mogXjcWsfmQBxk2dh5FBlzbCK6ZXS+Uoeb2bWzz59vK/lp772pp0x0n09W40C+Nj38n0sPBsu/kjw+VQ1R1zrPM1fWb9aerFVq94mKhVR5WmXgPPZ/6Ntec2V/aPsBvyzPdLMyQFe+dK8xJDA1dEIulk2Oaf/CmvcfuzLFy9sjBhFIoMGOn/jM8io0aqyTm/TlBdJpSXvevB4J1dbb3sDt1c33VJ/P5deZExE3SB85nJBSD5XlvHH3kzpu3hgc",
"permitEmptyPassphrase": false,
"remoteConfigurations": {
"legacy-couchdb": {
"id": "legacy-couchdb",
"name": "CouchDB Remote",
"uri": "%$M4KRzyh0b1UfuWGwPdnUEMFMq0x2hm3lXtw/sOuSP1jb423WxB0GYwPstn2Chd0f+M/MWMuZ+esJN539iCUyrQEEQodw2PHv8TCkIduLWVHji59cS7WQZy3lJZ8Ymif/N56D2jBGDgc855DylU7vWBM1y+idLevytdkzcKa1oIX6Oiaa+sb9LgO9JhmAo988yjljczS6Vp+wYqZh9jdTIimbL2k=",
"isEncrypted": true
}
},
"activeConfigurationId": "legacy-couchdb",
"useIndexedDBAdapter": true,
"useTimeouts": false,
"writeLogToTheFile": false,
"doNotPaceReplication": false,
"hashCacheMaxCount": 300,
"hashCacheMaxAmount": 50,
"concurrencyOfReadChunksOnline": 30,
"minimumIntervalOfReadChunksOnline": 25,
"hashAlg": "xxhash64",
"suspendParseReplicationResult": false,
"doNotSuspendOnFetching": false,
"useIgnoreFiles": false,
"ignoreFiles": ".gitignore",
"syncOnEditorSave": false,
"pluginSyncExtendedSetting": {},
"syncMaxSizeInMB": 50,
"settingSyncFile": "",
"writeCredentialsForSettingSync": false,
"notifyAllSettingSyncFile": false,
"isConfigured": true,
"settingVersion": 10,
"enableCompression": false,
"accessKey": "",
"bucket": "",
"endpoint": "",
"region": "",
"secretKey": "",
"useEden": false,
"maxChunksInEden": 10,
"maxTotalLengthInEden": 1024,
"maxAgeInEden": 10,
"disableCheckingConfigMismatch": false,
"displayLanguage": "def",
"enableChunkSplitterV2": false,
"disableWorkerForGeneratingChunks": false,
"processSmallFilesInUIThread": false,
"notifyThresholdOfRemoteStorageSize": 0,
"usePluginSyncV2": true,
"usePluginEtc": false,
"handleFilenameCaseSensitive": false,
"doNotUseFixedRevisionForChunks": false,
"showLongerLogInsideEditor": false,
"sendChunksBulk": false,
"sendChunksBulkMaxSize": 1,
"useSegmenter": false,
"useAdvancedMode": false,
"usePowerUserMode": false,
"useEdgeCaseMode": false,
"enableDebugTools": false,
"suppressNotifyHiddenFilesChange": false,
"syncMinimumInterval": 2000,
"P2P_Enabled": false,
"P2P_AutoAccepting": 0,
"P2P_AppID": "self-hosted-livesync",
"P2P_roomID": "",
"P2P_passphrase": "",
"P2P_relays": "wss://exp-relay.vrtmrz.net/",
"P2P_AutoBroadcast": false,
"P2P_AutoStart": false,
"P2P_AutoSyncPeers": "",
"P2P_AutoWatchPeers": "",
"P2P_SyncOnReplication": "",
"P2P_RebuildFrom": "",
"P2P_AutoAcceptingPeers": "",
"P2P_AutoDenyingPeers": "",
"P2P_IsHeadless": false,
"P2P_DevicePeerName": "",
"P2P_turnServers": "",
"P2P_turnUsername": "",
"P2P_turnCredential": "",
"doctorProcessedVersion": "0.25.27",
"bucketCustomHeaders": "",
"couchDB_CustomHeaders": "",
"useJWT": false,
"jwtAlgorithm": "",
"jwtKey": "",
"jwtKid": "",
"jwtSub": "",
"jwtExpDuration": 5,
"useRequestAPI": false,
"bucketPrefix": "",
"chunkSplitterVersion": "v3-rabin-karp",
"E2EEAlgorithm": "v2",
"processSizeMismatchedFiles": false,
"forcePathStyle": true,
"syncInternalFileOverwritePatterns": "",
"useOnlyLocalChunk": false,
"maxMTimeForReflectEvents": 0
}
+19
View File
@@ -0,0 +1,19 @@
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD AND TERSER
if you want to view the source, please visit the github repository of this plugin
*/
"use strict";function Logger(message,level,key3){_logger(message,level,key3)}function __logger(message,baseLevel,flagsOrKey,key3){let level=baseLevel;"string"==typeof flagsOrKey?key3=flagsOrKey:void 0!==flagsOrKey&&(level|=flagsOrKey);_logger(message,level,key3)}function info(message,flagsOrKey,key3){__logger(message,LEVEL_INFO,flagsOrKey,key3)}function isMetaEntry(entry){return"children"in entry}function statusDisplay(status){return status?"EXPERIMENTAL"==status?" (Experimental)":"ALPHA"==status?" (Alpha)":"BETA"==status?" (Beta)":` (${status})`:""}function confName(key3,alt=""){var _a8,_b5;return key3 in configurationNames?`${null==(_a8=configurationNames[key3])?void 0:_a8.name}${statusDisplay(null==(_b5=configurationNames[key3])?void 0:_b5.status)}`:`${alt||""}`}function isValidLength(len){return len>=1&&len<=5}function encodeObjectAsArray(obj){if(Array.isArray(obj))return ARRAY_MARKER+encodeAnyArray(obj,!0);const objArray=[...Object.entries(obj)].flat();return OBJECT_MARKER+encodeAnyArray(objArray,!0)}function decodeObjectFromArray(str){if(str[0]==ARRAY_MARKER)return decodeAnyArray(str.substring(1));if(str[0]==OBJECT_MARKER){const arr=decodeAnyArray(str.substring(1)),entries2=[];for(let i2=0;i2<arr.length;i2+=2){const key3=arr[i2],value=arr[i2+1];entries2.push([key3,value])}return Object.fromEntries(entries2)}return JSON.parse(str)}function encodeAnyArray(obj,safer=!1){return obj.map(v2=>{if(void 0===v2)return"u";if(null===v2)return"n";if(!1===v2)return"f";if(!0===v2)return"t";if("number"==typeof v2){const isFloat=!Number.isInteger(v2),b36=v2.toString(36),strNum=v2.toString(),expression=isFloat||b36.length>strNum.length?"n":"N",encodedStr="N"==expression?b36:strNum,len=encodedStr.length.toString(36),lenLen2=len.length;if(!isValidLength(lenLen2))throw new Error("Number length exceeds maximum encodable length of 5 in base36.");return prefixMapNumber[expression][lenLen2]+len+encodedStr}let str,prefix;if("string"==typeof v2){str=v2;prefix="s"}else{prefix="o";const objectStr=JSON.stringify(v2),containUndefined=-1!==Object.values(v2).indexOf(void 0);if(!safer||containUndefined){const objectEncoded=encodeObjectAsArray(v2);str=containUndefined||objectEncoded.length<objectStr.length?objectEncoded:objectStr}else str=objectStr}const length=str.length.toString(36),lenLen=length.length;if(!isValidLength(lenLen))throw new Error("String/Object length exceeds maximum encodable length of 5 in base36.");return prefixMapObject[prefix][lenLen]+length+str}).join("")}function isDecodeMapConstantKey(key3){return key3 in decodeMapConstant}function isDecodePrefixMapNumberKey(key3){return key3 in decodePrefixMapNumber}function isDecodePrefixMapObjectKey(key3){return key3 in decodePrefixMapObject}function decodeAnyArray(str){const result=[];let i2=0;for(;i2<str.length;){const char=str[i2];i2++;if(isDecodeMapConstantKey(char))result.push(decodeMapConstant[char]);else if(isDecodePrefixMapNumberKey(char)){const{prefix,len}=decodePrefixMapNumber[char],lenStr=str.substring(i2,i2+len);i2+=len;const lenNum=parseInt(lenStr,36),value=str.substring(i2,i2+lenNum);i2+=lenNum;"N"==prefix?result.push(parseInt(value,36)):result.push(parseFloat(value))}else{if(!isDecodePrefixMapObjectKey(char))throw new Error(`Invalid encoding at position ${i2-1}: unexpected character '${char}'`);{const{prefix,len}=decodePrefixMapObject[char],lenStr=str.substring(i2,i2+len);i2+=len;const lenNum=parseInt(lenStr,36),value=str.substring(i2,i2+lenNum);i2+=lenNum;"s"==prefix?result.push(value):result.push(decodeObjectFromArray(value))}}}return result}function extractObject(template,obj){const ret={...template};for(const key3 in ret)ret[key3]=obj[key3];return ret}function isObjectDifferent(a2,b3,ignoreUndefined=!1){if(typeof a2!=typeof b3)return!0;if("object"==typeof a2){if(null===a2||null===b3)return a2!==b3;const keys3=[...new Set([...Object.keys(a2),...Object.keys(b3)])];return ignoreUndefined?keys3.map(key3=>void 0!==(null==a2?void 0:a2[key3])&&void 0!==(null==b3?void 0:b3[key3])&&isObjectDifferent(null==a2?void 0:a2[key3],null==b3?void 0:b3[key3])).some(e3=>1==e3):keys3.map(key3=>isObjectDifferent(key3 in a2?a2[key3]:SYMBOL_A,key3 in b3?b3[key3]:SYMBOL_B)).some(e3=>1==e3)}return a2!==b3}function reactiveSource(initialValue){return _reactive({initialValue})}function reactive(expression,initialValue){return _reactive({expression,initialValue})}function resetTopologicalSortCacheFor(ids){ids.forEach(id=>topologicalSortCache.delete(id));topologicalSortCache.forEach((value,key3)=>{ids.includes(key3)||topologicalSortCache.delete(key3)})}function topologicalSort(startNode){if(topologicalSortCache.has(startNode.id)){const ref=topologicalSortCache.get(startNode.id);if(ref){const result2=ref.map(e3=>e3.instance.deref()).filter(e3=>e3);if(result2.length===ref.length)return result2}}const visited=new Set,sorted=[],recursionStack=new Set;(function visit(node){if(!visited.has(node)){if(recursionStack.has(node))throw new Error("Circular dependency detected!");visited.add(node);Line truncated
/*! Bundled license information:
octagonal-wheels/dist/encoding/encodeobject.js:
(* istanbul ignore if -- @preserve *)
@noble/secp256k1/index.js:
(*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
octagonal-wheels/dist/encryption/hkdf.js:
(* istanbul ignore if -- @preserve *)
(* istanbul ignore next -- @preserve *)
*/__export(event_streams_exports,{EventStreamSerde:()=>EventStreamSerde});init_event_streams=__esm({"node_modules/@smithy/core/dist-es/submodules/event-streams/index.js"(){init_EventStreamSerde()}});require_events=__commonJS({"node_modules/events/events.js"(exports,module2){"use strict";function ProcessEmitWarning(warning){console&&console.warn&&console.warn(warning)}function EventEmitter2(){EventEmitter2.init.call(this)}function checkListener(listener){if("function"!=typeof listener)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof listener)}function _getMaxListeners(that){return void 0===that._maxListeners?EventEmitter2.defaultMaxListeners:that._maxListeners}function _addListener(target,type,listener,prepend){var m3,events,existing,w2;checkListener(listener);if(void 0===(events=target._events)){events=target._events=Object.create(null);target._eventsCount=0}else{if(void 0!==events.newListener){target.emit("newListener",type,listener.listener?listener.listener:listener);events=target._events}existing=events[type]}if(void 0===existing){existing=events[type]=listener;++target._eventsCount}else{"function"==typeof existing?existing=events[type]=prepend?[listener,existing]:[existing,listener]:prepend?existing.unshift(listener):existing.push(listener);if((m3=_getMaxListeners(target))>0&&existing.length>m3&&!existing.warned){existing.warned=!0;(w2=new Error("Possible EventEmitter memory leak detected. "+existing.length+" "+String(type)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning";w2.emitter=target;w2.type=type;w2.count=existing.length;ProcessEmitWarning(w2)}}return target}function onceWrapper(){if(!this.fired){this.target.removeListener(this.type,this.wrapFn);this.fired=!0;return 0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}}function _onceWrap(target,type,listener){var state2={fired:!1,wrapFn:void 0,target,type,listener},wrapped=onceWrapper.bind(state2);wrapped.listener=listener;state2.wrapFn=wrapped;return wrapped}function _listeners2(target,type,unwrap2){var evlistener,events=target._events;return void 0===events||void 0===(evlistener=events[type])?[]:"function"==typeof evlistener?unwrap2?[evlistener.listener||evlistener]:[evlistener]:unwrap2?unwrapListeners(evlistener):arrayClone(evlistener,evlistener.length)}function listenerCount2(type){var evlistener,events=this._events;if(void 0!==events){if("function"==typeof(evlistener=events[type]))return 1;if(void 0!==evlistener)return evlistener.length}return 0}function arrayClone(arr,n3){var i2,copy=new Array(n3);for(i2=0;i2<n3;++i2)copy[i2]=arr[i2];return copy}function spliceOne(list,index6){for(;index6+1<list.length;index6++)list[index6]=list[index6+1];list.pop()}function unwrapListeners(arr){var i2,ret=new Array(arr.length);for(i2=0;i2<ret.length;++i2)ret[i2]=arr[i2].listener||arr[i2];return ret}function addErrorHandlerIfEventEmitter(emitter,handler,flags2){"function"==typeof emitter.on&&eventTargetAgnosticAddListener(emitter,"error",handler,flags2)}function eventTargetAgnosticAddListener(emitter,name,listener,flags2){if("function"==typeof emitter.on)flags2.once?emitter.once(name,listener):emitter.on(name,listener);else{if("function"!=typeof emitter.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof emitter);emitter.addEventListener(name,function wrapListener(arg){flags2.once&&emitter.removeEventListener(name,wrapListener);listener(arg)})}}var ReflectOwnKeys,NumberIsNaN,defaultMaxListeners,R2="object"==typeof Reflect?Reflect:null,ReflectApply=R2&&"function"==typeof R2.apply?R2.apply:function ReflectApply2(target,receiver,args){return Function.prototype.apply.call(target,receiver,args)};ReflectOwnKeys=R2&&"function"==typeof R2.ownKeys?R2.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys2(target){return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target))}:function ReflectOwnKeys2(target){return Object.getOwnPropertyNames(target)};NumberIsNaN=Number.isNaN||function NumberIsNaN2(value){return value!=value};module2.exports=EventEmitter2;module2.exports.once=function once3(emitter,name){return new Promise(function(resolve,reject){function errorListener(err3){emitter.removeListener(name,resolver2);reject(err3)}function resolver2(){"function"==typeof emitter.removeListener&&emitter.removeListener("error",errorListener);resolve([].slice.call(arguments))}eventTargetAgnosticAddListener(emitter,name,resolver2,{once:!0});"error"!==name&&addErrorHandlerIfEventEmitter(emitter,errorListener,{once:!0})})};EventEmitter2.EventEmitter=EventEmitter2;EventEmitter2.prototype._events=void 0;EventEmitter2.prototype._eventsCount=0;EventEmitter2.prototype._maxListeners=void 0;defaultMaxListeners=10;Object.defineProperty(EventEmitter2,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(arg){if("numLine truncated
/* nosourcemap */
+10
View File
@@ -0,0 +1,10 @@
{
"id": "obsidian-livesync",
"name": "Self-hosted LiveSync",
"version": "0.25.57",
"minAppVersion": "0.9.12",
"description": "Community implementation of self-hosted livesync. Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.",
"author": "vorotamoroz",
"authorUrl": "https://github.com/vrtmrz",
"isDesktopOnly": false
}
+487
View File
@@ -0,0 +1,487 @@
.ls-dialog .added {
color: var(--text-on-accent);
background-color: var(--text-accent);
}
.ls-dialog .normal {
color: var(--text-normal);
}
.ls-dialog .deleted {
color: var(--text-on-accent);
background-color: var(--text-muted);
}
.conflict-dev-name {
display: inline-block;
min-width: 5em;
}
.op-scrollable {
overflow-y: scroll;
/* min-height: 280px; */
max-height: 280px;
user-select: text;
-webkit-user-select: text;
}
.op-pre {
white-space: pre-wrap;
}
.op-warn {
border: 1px solid salmon;
padding: 2px;
border-radius: 4px;
}
.op-warn::before {
content: "Warning";
font-weight: bold;
color: salmon;
position: relative;
display: block;
}
.op-warn-info {
border: 1px solid rgb(255, 209, 81);
padding: 2px;
border-radius: 4px;
}
.op-warn-info::before {
content: "Notice";
font-weight: bold;
color: rgb(255, 209, 81);
position: relative;
display: block;
}
.syncstatusbar {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
.tcenter {
text-align: center;
}
.sls-plugins-wrap {
display: flex;
flex-grow: 1;
max-height: 50vh;
overflow-y: scroll;
}
.sls-remote-list .setting-item-description {
white-space: normal;
overflow-wrap: anywhere;
word-break: break-word;
}
.sls-plugins-tbl {
border: 1px solid var(--background-modifier-border);
width: 100%;
max-height: 80%;
}
.divider th {
border-top: 1px solid var(--background-modifier-border);
}
.sls-header-button {
margin-left: 2em;
}
.sls-hidden {
display: none;
}
:root {
--sls-log-text: "";
}
.sls-troubleshoot-preview {
max-width: max-content;
}
.sls-troubleshoot-preview img {
max-width: 100%;
}
.sls-setting-tab {
display: none;
}
div.sls-setting-menu-btn {
color: var(--text-normal);
background-color: var(--background-secondary-alt);
border-radius: 8px;
padding: 6px 10px;
cursor: pointer;
margin-right: 2px;
font-family: "Inter", sans-serif;
outline: none;
user-select: none;
flex-grow: 1;
text-align: center;
flex-shrink: 1;
}
.sls-setting-label.selected {
/* order: 1; */
flex-grow: 1;
/* width: 100%; */
}
.sls-setting-tab:hover~div.sls-setting-menu-btn,
.sls-setting-label.selected .sls-setting-tab:checked~div.sls-setting-menu-btn {
background-color: var(--interactive-accent);
color: var(--text-on-accent);
}
.sls-setting-menu-wrapper {
display: flex;
flex-direction: column;
flex-grow: 1;
position: sticky;
top: 0;
backdrop-filter: blur(15px);
padding: 4px;
border-radius: 10px;
z-index: 10;
}
.sls-setting-menu {
display: flex;
flex-direction: row;
overflow-x: auto;
}
body {
--sls-col-transparent: transparent;
--sls-col-warn: rgba(var(--background-modifier-error-rgb), 0.1);
--sls-col-warn-stripe1: var(--sls-col-transparent);
--sls-col-warn-stripe2: var(--sls-col-warn);
}
.sls-setting-menu-buttons {
border: 1px solid var(--sls-col-warn);
padding: 2px;
margin: 1px;
border-radius: 4px;
background-image: linear-gradient(-45deg,
var(--sls-col-warn-stripe1) 25%, var(--sls-col-warn-stripe2) 25%, var(--sls-col-warn-stripe2) 50%,
var(--sls-col-warn-stripe1) 50%, var(--sls-col-warn-stripe1) 75%, var(--sls-col-warn-stripe2) 75%, var(--sls-col-warn-stripe2));
background-size: 30px 30px;
display: flex;
flex-direction: row;
justify-content: flex-end;
padding: 0.5em 0.25em;
justify-content: center;
align-items: center;
/* transition: background-position 1s; */
animation: sls-scroll-warn 1s linear 0s infinite;
}
@keyframes sls-scroll-warn {
0% {
background-position: 0 0;
}
100% {
background-position: 30px 0;
}
}
.sls-setting-menu-buttons label {
margin-right: auto;
flex-grow: 1;
color: var(--text-warning);
}
.sls-setting-label {
flex-grow: 1;
display: inline-flex;
justify-content: center;
}
.setting-collapsed {
display: none;
}
.sls-plugins-tbl-buttons {
text-align: right;
}
.sls-plugins-tbl-buttons button {
flex-grow: 0;
padding: 6px 10px;
}
.sls-plugins-tbl-device-head {
background-color: var(--background-secondary-alt);
color: var(--text-accent);
}
.op-flex {
display: flex;
}
.op-flex input {
display: inline-flex;
flex-grow: 1;
margin-bottom: 8px;
}
.op-info {
display: inline-flex;
flex-grow: 1;
border-bottom: 1px solid var(--background-modifier-border);
width: 100%;
margin-bottom: 4px;
padding-bottom: 4px;
}
.history-added {
color: var(--text-on-accent);
background-color: var(--text-accent);
}
.history-normal {
color: var(--text-normal);
}
.history-deleted {
color: var(--text-on-accent);
background-color: var(--text-muted);
text-decoration: line-through;
}
.ob-btn-config-fix label {
margin-right: 40px;
}
.ob-btn-config-info {
border: 1px solid salmon;
padding: 2px;
margin: 1px;
border-radius: 4px;
}
.ob-btn-config-head {
padding: 2px;
margin: 1px;
border-radius: 4px;
}
.isWizard .wizardHidden {
display: none;
}
.sls-setting:not(.isWizard) .wizardOnly {
display: none;
}
.sls-item-dirty::before {
content: "✏";
}
.sls-item-dirty-help::after {
content: " ❓";
}
.sls-item-invalid-value {
background-color: rgba(var(--background-modifier-error-rgb), 0.3) !important;
}
.sls-setting-disabled input[type=text],
.sls-setting-disabled input[type=number],
.sls-setting-disabled input[type=password] {
filter: brightness(80%);
color: var(--text-muted);
}
.sls-setting-hidden {
display: none;
}
.sls-setting-obsolete {
background-image: linear-gradient(-45deg,
var(--sls-col-warn-stripe1) 25%, var(--sls-col-warn-stripe2) 25%, var(--sls-col-warn-stripe2) 50%,
var(--sls-col-warn-stripe1) 50%, var(--sls-col-warn-stripe1) 75%, var(--sls-col-warn-stripe2) 75%, var(--sls-col-warn-stripe2));
background-image: linear-gradient(-45deg,
transparent 25%, rgba(var(--background-secondary), 0.1) 25%, rgba(var(--background-secondary), 0.1) 50%, transparent 50%, transparent 75%, rgba(var(--background-secondary), 0.1) 75%, rgba(var(--background-secondary), 0.1));
background-size: 60px 60px;
}
.password-input>.setting-item-control>input {
-webkit-text-security: disc;
}
span.ls-mark-cr::after {
user-select: none;
content: "↲";
color: var(--text-muted);
font-size: 0.8em;
}
.deleted span.ls-mark-cr::after {
color: var(--text-on-accent);
}
.ls-imgdiff-wrap {
display: flex;
justify-content: center;
align-items: center;
}
.ls-imgdiff-wrap .overlay {
position: relative;
}
.ls-imgdiff-wrap .overlay .img-base {
position: relative;
top: 0;
left: 0;
}
.ls-imgdiff-wrap .overlay .img-overlay {
-webkit-filter: invert(100%) opacity(50%);
filter: invert(100%) opacity(50%);
position: absolute;
top: 0;
left: 0;
animation: ls-blink-diff 0.5s cubic-bezier(0.4, 0, 1, 1) infinite alternate;
}
@keyframes ls-blink-diff {
0% {
opacity: 0;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.livesync-status {
user-select: none;
pointer-events: none;
height: auto;
min-height: 1em;
position: absolute;
background-color: transparent;
width: 100%;
padding: 10px;
padding-right: 16px;
top: var(--header-height);
z-index: calc(var(--layer-cover) + 1);
font-variant-numeric: tabular-nums;
tab-size: 4;
text-align: right;
white-space: pre-wrap;
display: inline-block;
color: var(--text-normal);
font-size: 80%;
}
div.workspace-leaf-content[data-type=bases] .livesync-status {
top: calc(var(--bases-header-height) + var(--header-height));
padding: 5px;
padding-right: 18px;
}
.is-mobile div.workspace-leaf-content[data-type=bases] .livesync-status {
top: calc(var(--bases-header-height) + var(--view-header-height));
padding: 6px;
padding-right: 18px;
}
.livesync-status div {
opacity: 0.6;
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
.livesync-status .livesync-status-loghistory {
text-align: left;
opacity: 0.4;
}
.livesync-status div.livesync-status-messagearea:empty {
display: none;
}
.livesync-status div.livesync-status-messagearea:not(:empty) {
opacity: 0.6;
color: var(--text-on-accent);
border: 1px solid var(--background-modifier-error);
background-color: rgba(var(--background-modifier-error-rgb), 0.2);
-webkit-filter: unset;
filter: unset;
width: fit-content;
margin-left: auto;
}
.menu-setting-poweruser-disabled .sls-setting-poweruser {
display: none;
}
.menu-setting-advanced-disabled .sls-setting-advanced {
display: none;
}
.menu-setting-edgecase-disabled .sls-setting-edgecase {
display: none;
}
.sls-setting-panel-title {
position: sticky;
font-size: medium;
top: 2.5em;
background-color: var(--background-secondary-alt);
border-radius: 10px;
padding: 0.5em 1.0em;
}
.active-pane .sls-setting-panel-title {
border: 1px solid var(--interactive-accent);
}
.sls-dialogue-note-wrapper {
display: flex;
justify-content: flex-end;
align-items: center;
}
.sls-dialogue-note-countdown {
font-size: 0.8em;
}
.sls-qr {
display: flex;
justify-content: center;
align-items: center;
max-width: max-content;
}
.sls-keypair pre {
max-width: 100%;
overflow-x: auto;
white-space: pre-wrap;
word-break: break-all;
}
+417
View File
@@ -0,0 +1,417 @@
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// node_modules/parse-ms/index.js
var require_parse_ms = __commonJS({
"node_modules/parse-ms/index.js"(exports, module2) {
"use strict";
module2.exports = (milliseconds) => {
if (typeof milliseconds !== "number") {
throw new TypeError("Expected a number");
}
const roundTowardsZero = milliseconds > 0 ? Math.floor : Math.ceil;
return {
days: roundTowardsZero(milliseconds / 864e5),
hours: roundTowardsZero(milliseconds / 36e5) % 24,
minutes: roundTowardsZero(milliseconds / 6e4) % 60,
seconds: roundTowardsZero(milliseconds / 1e3) % 60,
milliseconds: roundTowardsZero(milliseconds) % 1e3,
microseconds: roundTowardsZero(milliseconds * 1e3) % 1e3,
nanoseconds: roundTowardsZero(milliseconds * 1e6) % 1e3
};
};
}
});
// node_modules/pretty-ms/index.js
var require_pretty_ms = __commonJS({
"node_modules/pretty-ms/index.js"(exports, module2) {
"use strict";
var parseMilliseconds = require_parse_ms();
var pluralize = (word, count) => count === 1 ? word : `${word}s`;
var SECOND_ROUNDING_EPSILON = 1e-7;
module2.exports = (milliseconds, options = {}) => {
if (!Number.isFinite(milliseconds)) {
throw new TypeError("Expected a finite number");
}
if (options.colonNotation) {
options.compact = false;
options.formatSubMilliseconds = false;
options.separateMilliseconds = false;
options.verbose = false;
}
if (options.compact) {
options.secondsDecimalDigits = 0;
options.millisecondsDecimalDigits = 0;
}
const result = [];
const floorDecimals = (value, decimalDigits) => {
const flooredInterimValue = Math.floor(value * 10 ** decimalDigits + SECOND_ROUNDING_EPSILON);
const flooredValue = Math.round(flooredInterimValue) / 10 ** decimalDigits;
return flooredValue.toFixed(decimalDigits);
};
const add = (value, long, short, valueString) => {
if ((result.length === 0 || !options.colonNotation) && value === 0 && !(options.colonNotation && short === "m")) {
return;
}
valueString = (valueString || value || "0").toString();
let prefix;
let suffix;
if (options.colonNotation) {
prefix = result.length > 0 ? ":" : "";
suffix = "";
const wholeDigits = valueString.includes(".") ? valueString.split(".")[0].length : valueString.length;
const minLength = result.length > 0 ? 2 : 1;
valueString = "0".repeat(Math.max(0, minLength - wholeDigits)) + valueString;
} else {
prefix = "";
suffix = options.verbose ? " " + pluralize(long, value) : short;
}
result.push(prefix + valueString + suffix);
};
const parsed = parseMilliseconds(milliseconds);
add(Math.trunc(parsed.days / 365), "year", "y");
add(parsed.days % 365, "day", "d");
add(parsed.hours, "hour", "h");
add(parsed.minutes, "minute", "m");
if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3) {
add(parsed.seconds, "second", "s");
if (options.formatSubMilliseconds) {
add(parsed.milliseconds, "millisecond", "ms");
add(parsed.microseconds, "microsecond", "\xB5s");
add(parsed.nanoseconds, "nanosecond", "ns");
} else {
const millisecondsAndBelow = parsed.milliseconds + parsed.microseconds / 1e3 + parsed.nanoseconds / 1e6;
const millisecondsDecimalDigits = typeof options.millisecondsDecimalDigits === "number" ? options.millisecondsDecimalDigits : 0;
const roundedMiliseconds = millisecondsAndBelow >= 1 ? Math.round(millisecondsAndBelow) : Math.ceil(millisecondsAndBelow);
const millisecondsString = millisecondsDecimalDigits ? millisecondsAndBelow.toFixed(millisecondsDecimalDigits) : roundedMiliseconds;
add(
Number.parseFloat(millisecondsString, 10),
"millisecond",
"ms",
millisecondsString
);
}
} else {
const seconds = milliseconds / 1e3 % 60;
const secondsDecimalDigits = typeof options.secondsDecimalDigits === "number" ? options.secondsDecimalDigits : 1;
const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
const secondsString = options.keepDecimalsOnWholeSeconds ? secondsFixed : secondsFixed.replace(/\.0+$/, "");
add(Number.parseFloat(secondsString, 10), "second", "s", secondsString);
}
if (result.length === 0) {
return "0" + (options.verbose ? " milliseconds" : "ms");
}
if (options.compact) {
return result[0];
}
if (typeof options.unitCount === "number") {
const separator = options.colonNotation ? "" : " ";
return result.slice(0, Math.max(options.unitCount, 1)).join(separator);
}
return options.colonNotation ? result.join("") : result.join(" ");
};
}
});
// src/main.ts
var main_exports = {};
__export(main_exports, {
default: () => ReadingTime
});
module.exports = __toCommonJS(main_exports);
var import_obsidian2 = require("obsidian");
// src/settings.ts
var import_obsidian = require("obsidian");
var RT_DEFAULT_SETTINGS = {
readingSpeed: 200,
format: "default",
appendText: "read"
};
var ReadingTimeSettingsTab = class extends import_obsidian.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
const { containerEl } = this;
containerEl.empty();
new import_obsidian.Setting(containerEl).setName("Reading speed").setDesc("Words per minute used for reading speed (default: 200).").addText((text) => {
text.setPlaceholder("Example: 200").setValue(this.plugin.settings.readingSpeed.toString()).onChange((value) => __async(this, null, function* () {
this.plugin.settings.readingSpeed = parseInt(value.trim());
yield this.plugin.saveSettings().then(this.plugin.calculateReadingTime);
}));
});
new import_obsidian.Setting(this.containerEl).setName("Format").setDesc("Choose the output format").addDropdown(
(dropdown) => dropdown.addOption("default", "Default (10 min)").addOption("compact", "Compact (10m)").addOption("simple", "Simple (10m 4s)").addOption("verbose", "Verbose (10 minutes 4 seconds)").addOption("digital", "Colon Notation (10:04)").setValue(this.plugin.settings.format).onChange((value) => __async(this, null, function* () {
this.plugin.settings.format = value;
yield this.plugin.saveSettings().then(this.plugin.calculateReadingTime);
}))
);
new import_obsidian.Setting(this.containerEl).setName("Append Text").setDesc("Append 'read' to formatted string.").addText(
(text) => text.setValue(this.plugin.settings.appendText).onChange((value) => __async(this, null, function* () {
this.plugin.settings.appendText = value.trim();
yield this.plugin.saveSettings().then(this.plugin.calculateReadingTime);
}))
);
}
};
// src/lib/reading-time/index.ts
function codeIsInRanges(number, arrayOfRanges) {
return arrayOfRanges.some(
([lowerBound, upperBound]) => lowerBound <= number && number <= upperBound
);
}
var isCJK = (c) => {
const charCode = c.charCodeAt(0);
return codeIsInRanges(charCode, [
// Hiragana (Katakana not included on purpose,
// context: https://github.com/ngryman/reading-time/pull/35#issuecomment-853364526)
// If you think Katakana should be included and have solid reasons, improvement is welcomed
[12352, 12447],
// CJK Unified ideographs
[19968, 40959],
// Hangul
[44032, 55203],
// CJK extensions
[131072, 191456]
]);
};
var isAnsiWordBound = (c) => {
return " \n\r ".includes(c);
};
var isPunctuation = (c) => {
const charCode = c.charCodeAt(0);
return codeIsInRanges(charCode, [
[33, 47],
[58, 64],
[91, 96],
[123, 126],
// CJK Symbols and Punctuation
[12288, 12351],
// Full-width ASCII punctuation variants
[65280, 65519]
]);
};
function countWords(text, options = {}) {
let words = 0, start = 0, end = text.length - 1;
const { wordBound: isWordBound = isAnsiWordBound } = options;
while (isWordBound(text[start]))
start++;
while (isWordBound(text[end]))
end--;
const normalizedText = `${text}
`;
for (let i = start; i <= end; i++) {
if (isCJK(normalizedText[i]) || !isWordBound(normalizedText[i]) && (isWordBound(normalizedText[i + 1]) || isCJK(normalizedText[i + 1]))) {
words++;
}
if (isCJK(normalizedText[i])) {
while (i <= end && (isPunctuation(normalizedText[i + 1]) || isWordBound(normalizedText[i + 1]))) {
i++;
}
}
}
return { total: words };
}
function readingTimeWithCount(words, options = {}) {
const { wordsPerMinute = 200 } = options;
const minutes = words.total / wordsPerMinute;
const time = Math.round(minutes * 60 * 1e3);
const displayed = Math.ceil(parseFloat(minutes.toFixed(2)));
return {
minutes: displayed,
time
};
}
function readingTime(text, options = {}) {
const words = countWords(text, options);
return __spreadProps(__spreadValues({}, readingTimeWithCount(words, options)), {
words
});
}
// src/helpers.ts
var import_pretty_ms = __toESM(require_pretty_ms());
function readingTimeText(text, plugin) {
const result = readingTime(text, {
wordsPerMinute: plugin.settings.readingSpeed
});
let options = {
secondsDecimalDigits: 0
};
switch (plugin.settings.format) {
case "simple":
break;
case "compact":
if (result.time > 36e5) {
options = __spreadProps(__spreadValues({}, options), { unitCount: 2 });
} else {
options = __spreadProps(__spreadValues({}, options), { compact: true });
}
break;
case "verbose":
options = __spreadProps(__spreadValues({}, options), { verbose: true });
break;
case "digital":
options = __spreadProps(__spreadValues({}, options), { colonNotation: true });
break;
case "default":
return plugin.settings.appendText ? `${result.minutes} min read` : `${result.minutes} min`;
}
const output = (0, import_pretty_ms.default)(result.time, options);
return plugin.settings.appendText ? `${output} ${plugin.settings.appendText}` : output;
}
// src/main.ts
var ReadingTime = class extends import_obsidian2.Plugin {
constructor() {
super(...arguments);
this.calculateReadingTime = () => {
const mdView = this.app.workspace.getActiveViewOfType(import_obsidian2.MarkdownView);
if (mdView && mdView.getViewData()) {
const result = readingTimeText(mdView.getViewData(), this);
this.statusBar.setText(`${result}`);
} else {
this.statusBar.setText("0 min read");
}
};
}
onload() {
return __async(this, null, function* () {
yield this.loadSettings();
this.statusBar = this.addStatusBarItem();
this.statusBar.setText("");
this.addSettingTab(new ReadingTimeSettingsTab(this.app, this));
this.addCommand({
id: "reading-time-editor-command",
name: "Selected Text",
editorCallback: (editor, view) => {
new ReadingTimeModal(this.app, editor, this).open();
}
});
this.registerEvent(
this.app.workspace.on("layout-change", this.calculateReadingTime)
);
this.registerEvent(
this.app.workspace.on("file-open", this.calculateReadingTime)
);
this.registerEvent(
this.app.workspace.on(
"editor-change",
(0, import_obsidian2.debounce)(this.calculateReadingTime, 1e3)
)
);
});
}
loadSettings() {
return __async(this, null, function* () {
this.settings = Object.assign(
{},
RT_DEFAULT_SETTINGS,
yield this.loadData()
);
});
}
saveSettings() {
return __async(this, null, function* () {
yield this.saveData(this.settings);
});
}
};
var ReadingTimeModal = class extends import_obsidian2.Modal {
constructor(app, editor, plugin) {
super(app);
this.editor = editor;
this.plugin = plugin;
}
onOpen() {
const { contentEl, titleEl } = this;
titleEl.setText("Reading Time of Selected Text");
const stats = readingTimeText(this.editor.getSelection(), this.plugin);
contentEl.setText(`${stats} (at ${this.plugin.settings.readingSpeed} wpm)`);
}
onClose() {
const { contentEl } = this;
contentEl.empty();
}
};
/*!
* reading-time
* Copyright (c) Nicolas Gryman <ngryman@gmail.com>
* MIT Licensed
*/
/* nosourcemap */
+10
View File
@@ -0,0 +1,10 @@
{
"id": "obsidian-reading-time",
"name": "Reading Time",
"description": "Add the current note's reading time to Obsidian's status bar.",
"version": "1.1.2",
"minAppVersion": "0.12.17",
"isDesktopOnly": false,
"author": "avr",
"authorUrl": "https://github.com/avr"
}
@@ -0,0 +1,868 @@
'use strict';
var obsidian = require('obsidian');
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
var Formatter = /** @class */ (function () {
function Formatter() {
}
return Formatter;
}());
/**
* {@link DecimalUnitFormatter} provides an implementation of {@link Formatter}
* that outputs a integers in a standard decimal format with grouped thousands.
*/
var DecimalUnitFormatter = /** @class */ (function (_super) {
__extends(DecimalUnitFormatter, _super);
/**
* @param unit the unit of the value being formatted.
* @constructor
*/
function DecimalUnitFormatter(unit) {
var _this = _super.call(this) || this;
_this.unit = unit;
_this.numberFormat = Intl.NumberFormat('en-US', { style: 'decimal' });
return _this;
}
DecimalUnitFormatter.prototype.format = function (value) {
return "".concat(this.numberFormat.format(value), " ").concat(this.unit);
};
return DecimalUnitFormatter;
}(Formatter));
/**
* {@link ScalingUnitFormatter}
*/
var ScalingUnitFormatter = /** @class */ (function (_super) {
__extends(ScalingUnitFormatter, _super);
/**
* @param numberFormat An instance of {@link Intl.NumberFormat} to use to
* format the scaled value.
*/
function ScalingUnitFormatter(numberFormat) {
var _this = _super.call(this) || this;
_this.numberFormat = numberFormat;
return _this;
}
ScalingUnitFormatter.prototype.format = function (value) {
var _a = this.scale(value), scaledValue = _a[0], scaledUnit = _a[1];
return "".concat(this.numberFormat.format(scaledValue), " ").concat(scaledUnit);
};
return ScalingUnitFormatter;
}(Formatter));
/**
* {@link BytesFormatter} formats values that represent a size in bytes as a
* value in bytes, kilobytes, megabytes, gigabytes, etc.
*/
var BytesFormatter = /** @class */ (function (_super) {
__extends(BytesFormatter, _super);
function BytesFormatter() {
return _super.call(this, Intl.NumberFormat('en-US', {
style: 'decimal',
minimumFractionDigits: 2,
maximumFractionDigits: 2
})) || this;
}
BytesFormatter.prototype.scale = function (value) {
var units = ["bytes", "KB", "MB", "GB", "TB", "PB"];
while (value > 1024 && units.length > 0) {
value = value / 1024;
units.shift();
}
return [value, units[0]];
};
return BytesFormatter;
}(ScalingUnitFormatter));
var VaultMetrics = /** @class */ (function (_super) {
__extends(VaultMetrics, _super);
function VaultMetrics() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.files = 0;
_this.notes = 0;
_this.attachments = 0;
_this.size = 0;
_this.links = 0;
_this.words = 0;
return _this;
}
VaultMetrics.prototype.reset = function () {
this.files = 0;
this.notes = 0;
this.attachments = 0;
this.size = 0;
this.links = 0;
this.words = 0;
};
VaultMetrics.prototype.dec = function (metrics) {
this.files -= (metrics === null || metrics === void 0 ? void 0 : metrics.files) || 0;
this.notes -= (metrics === null || metrics === void 0 ? void 0 : metrics.notes) || 0;
this.attachments -= (metrics === null || metrics === void 0 ? void 0 : metrics.attachments) || 0;
this.size -= (metrics === null || metrics === void 0 ? void 0 : metrics.size) || 0;
this.links -= (metrics === null || metrics === void 0 ? void 0 : metrics.links) || 0;
this.words -= (metrics === null || metrics === void 0 ? void 0 : metrics.words) || 0;
this.trigger("updated");
};
VaultMetrics.prototype.inc = function (metrics) {
this.files += (metrics === null || metrics === void 0 ? void 0 : metrics.files) || 0;
this.notes += (metrics === null || metrics === void 0 ? void 0 : metrics.notes) || 0;
this.attachments += (metrics === null || metrics === void 0 ? void 0 : metrics.attachments) || 0;
this.size += (metrics === null || metrics === void 0 ? void 0 : metrics.size) || 0;
this.links += (metrics === null || metrics === void 0 ? void 0 : metrics.links) || 0;
this.words += (metrics === null || metrics === void 0 ? void 0 : metrics.words) || 0;
this.trigger("updated");
};
VaultMetrics.prototype.on = function (name, callback, ctx) {
return _super.prototype.on.call(this, "updated", callback, ctx);
};
return VaultMetrics;
}(obsidian.Events));
/**
* The {@link UnitTokenizer} is a constant tokenizer that always returns an
* empty list.
*/
var UnitTokenizer = /** @class */ (function () {
function UnitTokenizer() {
}
UnitTokenizer.prototype.tokenize = function (_) {
return [];
};
return UnitTokenizer;
}());
/**
* {@link MarkdownTokenizer} understands how to tokenize markdown text into word
* tokens.
*/
var MarkdownTokenizer = /** @class */ (function () {
function MarkdownTokenizer() {
}
MarkdownTokenizer.prototype.isNonWord = function (token) {
var NON_WORDS = /^\W+$/;
return !!NON_WORDS.exec(token);
};
MarkdownTokenizer.prototype.isNumber = function (token) {
var NUMBER = /^\d+(\.\d+)?$/;
return !!NUMBER.exec(token);
};
MarkdownTokenizer.prototype.isCodeBlockHeader = function (token) {
var CODE_BLOCK_HEADER = /^```\w+$/;
return !!CODE_BLOCK_HEADER.exec(token);
};
MarkdownTokenizer.prototype.stripHighlights = function (token) {
var STRIP_HIGHLIGHTS = /^(==)?(.*?)(==)?$/;
return STRIP_HIGHLIGHTS.exec(token)[2];
};
MarkdownTokenizer.prototype.stripFormatting = function (token) {
var STRIP_FORMATTING = /^(_+|\*+)?(.*?)(_+|\*+)?$/;
return STRIP_FORMATTING.exec(token)[2];
};
MarkdownTokenizer.prototype.stripPunctuation = function (token) {
var STRIP_PUNCTUATION = /^(`|\.|:|"|,|!|\?)?(.*?)(`|\.|:|"|,|!|\?)?$/;
return STRIP_PUNCTUATION.exec(token)[2];
};
MarkdownTokenizer.prototype.stripWikiLinks = function (token) {
var STRIP_WIKI_LINKS = /^(\[\[)?(.*?)(\]\])?$/;
return STRIP_WIKI_LINKS.exec(token)[2];
};
MarkdownTokenizer.prototype.stripAll = function (token) {
if (token === "") {
return token;
}
var isFixedPoint = false;
while (!isFixedPoint) {
var prev = token;
token = [token].
map(this.stripHighlights).
map(this.stripFormatting).
map(this.stripPunctuation).
map(this.stripWikiLinks)[0];
isFixedPoint = isFixedPoint || prev === token;
}
return token;
};
MarkdownTokenizer.prototype.tokenize = function (content) {
var _this = this;
if (content.trim() === "") {
return [];
}
else {
var WORD_BOUNDARY = /[ \n\r\t\"\|,\(\)\[\]/]+/;
var words = content.
split(WORD_BOUNDARY).
filter(function (token) { return !_this.isNonWord(token); }).
filter(function (token) { return !_this.isNumber(token); }).
filter(function (token) { return !_this.isCodeBlockHeader(token); }).
map(function (token) { return _this.stripAll(token); }).
filter(function (token) { return token.length > 0; });
return words;
}
};
return MarkdownTokenizer;
}());
var UNIT_TOKENIZER = new UnitTokenizer();
var MARKDOWN_TOKENIZER = new MarkdownTokenizer();
var FileType;
(function (FileType) {
FileType[FileType["Unknown"] = 0] = "Unknown";
FileType[FileType["Note"] = 1] = "Note";
FileType[FileType["Attachment"] = 2] = "Attachment";
})(FileType || (FileType = {}));
var VaultMetricsCollector = /** @class */ (function () {
function VaultMetricsCollector(owner) {
this.data = new Map();
this.backlog = new Array();
this.vaultMetrics = new VaultMetrics();
this.owner = owner;
}
VaultMetricsCollector.prototype.setVault = function (vault) {
this.vault = vault;
return this;
};
VaultMetricsCollector.prototype.setMetadataCache = function (metadataCache) {
this.metadataCache = metadataCache;
return this;
};
VaultMetricsCollector.prototype.setVaultMetrics = function (vaultMetrics) {
this.vaultMetrics = vaultMetrics;
return this;
};
VaultMetricsCollector.prototype.start = function () {
var _this = this;
var _a;
this.owner.registerEvent(this.vault.on("create", function (file) { _this.onfilecreated(file); }));
this.owner.registerEvent(this.vault.on("modify", function (file) { _this.onfilemodified(file); }));
this.owner.registerEvent(this.vault.on("delete", function (file) { _this.onfiledeleted(file); }));
this.owner.registerEvent(this.vault.on("rename", function (file, oldPath) { _this.onfilerenamed(file, oldPath); }));
this.owner.registerEvent(this.metadataCache.on("resolve", function (file) { _this.onfilemodified(file); }));
this.owner.registerEvent(this.metadataCache.on("changed", function (file) { _this.onfilemodified(file); }));
this.data.clear();
this.backlog = new Array();
(_a = this.vaultMetrics) === null || _a === void 0 ? void 0 : _a.reset();
this.vault.getFiles().forEach(function (file) {
if (!(file instanceof obsidian.TFolder)) {
_this.push(file);
}
});
this.owner.registerInterval(+setInterval(function () { _this.processBacklog(); }, 2000));
return this;
};
VaultMetricsCollector.prototype.push = function (fileOrPath) {
if (fileOrPath instanceof obsidian.TFolder) {
return;
}
var path = (fileOrPath instanceof obsidian.TFile) ? fileOrPath.path : fileOrPath;
if (!this.backlog.contains(path)) {
this.backlog.push(path);
}
};
VaultMetricsCollector.prototype.processBacklog = function () {
return __awaiter(this, void 0, void 0, function () {
var path, file, metrics;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!(this.backlog.length > 0)) return [3 /*break*/, 2];
path = this.backlog.shift();
file = this.vault.getAbstractFileByPath(path);
return [4 /*yield*/, this.collect(file)];
case 1:
metrics = _a.sent();
this.update(path, metrics);
return [3 /*break*/, 0];
case 2: return [2 /*return*/];
}
});
});
};
VaultMetricsCollector.prototype.onfilecreated = function (file) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
// console.log(`onfilecreated(${file?.path})`);
this.push(file);
return [2 /*return*/];
});
});
};
VaultMetricsCollector.prototype.onfilemodified = function (file) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
// console.log(`onfilemodified(${file?.path})`)
this.push(file);
return [2 /*return*/];
});
});
};
VaultMetricsCollector.prototype.onfiledeleted = function (file) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
// console.log(`onfiledeleted(${file?.path})`)
this.push(file);
return [2 /*return*/];
});
});
};
VaultMetricsCollector.prototype.onfilerenamed = function (file, oldPath) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
// console.log(`onfilerenamed(${file?.path})`)
this.push(file);
this.push(oldPath);
return [2 /*return*/];
});
});
};
VaultMetricsCollector.prototype.getFileType = function (file) {
var _a;
if (((_a = file.extension) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "md") {
return FileType.Note;
}
else {
return FileType.Attachment;
}
};
VaultMetricsCollector.prototype.collect = function (file) {
return __awaiter(this, void 0, void 0, function () {
var metadata;
return __generator(this, function (_a) {
try {
metadata = this.metadataCache.getFileCache(file);
}
catch (e) {
// getFileCache indicates that it should return either an instance
// of CachedMetadata or null. The conditions under which a null
// is returned are unspecified. Empirically, if the file does not
// exist, e.g. it's been deleted or renamed then getFileCache will
// throw an exception instead of returning null.
metadata = null;
}
if (metadata == null) {
return [2 /*return*/, Promise.resolve(null)];
}
switch (this.getFileType(file)) {
case FileType.Note:
return [2 /*return*/, new NoteMetricsCollector(this.vault).collect(file, metadata)];
case FileType.Attachment:
return [2 /*return*/, new FileMetricsCollector().collect(file, metadata)];
}
return [2 /*return*/];
});
});
};
VaultMetricsCollector.prototype.update = function (fileOrPath, metrics) {
var _a, _b;
var key = (fileOrPath instanceof obsidian.TFile) ? fileOrPath.path : fileOrPath;
// Remove the existing values for the passed file if present, update the
// raw values, then add the values for the passed file to the totals.
(_a = this.vaultMetrics) === null || _a === void 0 ? void 0 : _a.dec(this.data.get(key));
if (metrics == null) {
this.data.delete(key);
}
else {
this.data.set(key, metrics);
}
(_b = this.vaultMetrics) === null || _b === void 0 ? void 0 : _b.inc(metrics);
};
return VaultMetricsCollector;
}());
var NoteMetricsCollector = /** @class */ (function () {
function NoteMetricsCollector(vault) {
this.vault = vault;
}
NoteMetricsCollector.prototype.collect = function (file, metadata) {
var _a, _b;
return __awaiter(this, void 0, void 0, function () {
var metrics, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
metrics = new VaultMetrics();
metrics.files = 1;
metrics.notes = 1;
metrics.attachments = 0;
metrics.size = (_a = file.stat) === null || _a === void 0 ? void 0 : _a.size;
metrics.links = ((_b = metadata === null || metadata === void 0 ? void 0 : metadata.links) === null || _b === void 0 ? void 0 : _b.length) || 0;
metrics.words = 0;
_c = metrics;
return [4 /*yield*/, this.vault.cachedRead(file).then(function (content) {
var _a;
return (_a = metadata.sections) === null || _a === void 0 ? void 0 : _a.map(function (section) {
var _a, _b, _c, _d;
var sectionType = section.type;
var startOffset = (_b = (_a = section.position) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.offset;
var endOffset = (_d = (_c = section.position) === null || _c === void 0 ? void 0 : _c.end) === null || _d === void 0 ? void 0 : _d.offset;
var tokenizer = NoteMetricsCollector.TOKENIZERS.get(sectionType);
if (!tokenizer) {
console.log("".concat(file.path, ": no tokenizer, section.type=").concat(section.type));
return 0;
}
else {
var tokens = tokenizer.tokenize(content.substring(startOffset, endOffset));
return tokens.length;
}
}).reduce(function (a, b) { return a + b; }, 0);
}).catch(function (e) {
console.log("".concat(file.path, " ").concat(e));
return 0;
})];
case 1:
_c.words = _d.sent();
return [2 /*return*/, metrics];
}
});
});
};
NoteMetricsCollector.TOKENIZERS = new Map([
["paragraph", MARKDOWN_TOKENIZER],
["heading", MARKDOWN_TOKENIZER],
["list", MARKDOWN_TOKENIZER],
["table", UNIT_TOKENIZER],
["yaml", UNIT_TOKENIZER],
["code", UNIT_TOKENIZER],
["blockquote", MARKDOWN_TOKENIZER],
["math", UNIT_TOKENIZER],
["thematicBreak", UNIT_TOKENIZER],
["html", UNIT_TOKENIZER],
["text", UNIT_TOKENIZER],
["element", UNIT_TOKENIZER],
["footnoteDefinition", UNIT_TOKENIZER],
["definition", UNIT_TOKENIZER],
["callout", MARKDOWN_TOKENIZER],
]);
return NoteMetricsCollector;
}());
var FileMetricsCollector = /** @class */ (function () {
function FileMetricsCollector() {
}
FileMetricsCollector.prototype.collect = function (file, metadata) {
var _a;
return __awaiter(this, void 0, void 0, function () {
var metrics;
return __generator(this, function (_b) {
metrics = new VaultMetrics();
metrics.files = 1;
metrics.notes = 0;
metrics.attachments = 1;
metrics.size = (_a = file.stat) === null || _a === void 0 ? void 0 : _a.size;
metrics.links = 0;
metrics.words = 0;
return [2 /*return*/, metrics];
});
});
};
return FileMetricsCollector;
}());
var StatisticsPluginSettingTab = /** @class */ (function (_super) {
__extends(StatisticsPluginSettingTab, _super);
function StatisticsPluginSettingTab(app, plugin) {
var _this = _super.call(this, app, plugin) || this;
_this.plugin = plugin;
return _this;
}
StatisticsPluginSettingTab.prototype.display = function () {
var _this = this;
var containerEl = this.containerEl;
containerEl.empty();
new obsidian.Setting(containerEl)
.setName("Show individual items")
.setDesc("Whether to show multiple items at once or cycle them with a click")
.addToggle(function (value) {
value
.setValue(_this.plugin.settings.displayIndividualItems)
.onChange(function (value) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.plugin.settings.displayIndividualItems = value;
this.display();
return [4 /*yield*/, this.plugin.saveSettings()];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); });
});
if (!this.plugin.settings.displayIndividualItems) {
return;
}
new obsidian.Setting(containerEl)
.setName("Show notes")
.addToggle(function (value) {
value
.setValue(_this.plugin.settings.showNotes)
.onChange(function (value) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.plugin.settings.showNotes = value;
return [4 /*yield*/, this.plugin.saveSettings()];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); });
});
new obsidian.Setting(containerEl)
.setName("Show attachments")
.addToggle(function (value) {
value
.setValue(_this.plugin.settings.showAttachments)
.onChange(function (value) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.plugin.settings.showAttachments = value;
return [4 /*yield*/, this.plugin.saveSettings()];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); });
});
new obsidian.Setting(containerEl)
.setName("Show files")
.addToggle(function (value) {
value
.setValue(_this.plugin.settings.showFiles)
.onChange(function (value) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.plugin.settings.showFiles = value;
return [4 /*yield*/, this.plugin.saveSettings()];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); });
});
new obsidian.Setting(containerEl)
.setName("Show links")
.addToggle(function (value) {
value
.setValue(_this.plugin.settings.showLinks)
.onChange(function (value) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.plugin.settings.showLinks = value;
return [4 /*yield*/, this.plugin.saveSettings()];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); });
});
new obsidian.Setting(containerEl)
.setName("Show words")
.addToggle(function (value) {
value
.setValue(_this.plugin.settings.showWords)
.onChange(function (value) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.plugin.settings.showWords = value;
return [4 /*yield*/, this.plugin.saveSettings()];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); });
});
new obsidian.Setting(containerEl)
.setName("Show size")
.addToggle(function (value) {
value
.setValue(_this.plugin.settings.showSize)
.onChange(function (value) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.plugin.settings.showSize = value;
return [4 /*yield*/, this.plugin.saveSettings()];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); });
});
};
return StatisticsPluginSettingTab;
}(obsidian.PluginSettingTab));
var DEFAULT_SETTINGS = {
displayIndividualItems: false,
showNotes: false,
showAttachments: false,
showFiles: false,
showLinks: false,
showWords: false,
showSize: false,
};
var StatisticsPlugin = /** @class */ (function (_super) {
__extends(StatisticsPlugin, _super);
function StatisticsPlugin() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.statusBarItem = null;
return _this;
}
StatisticsPlugin.prototype.onload = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
console.log('Loading vault-statistics Plugin');
return [4 /*yield*/, this.loadSettings()];
case 1:
_a.sent();
this.vaultMetrics = new VaultMetrics();
this.vaultMetricsCollector = new VaultMetricsCollector(this).
setVault(this.app.vault).
setMetadataCache(this.app.metadataCache).
setVaultMetrics(this.vaultMetrics).
start();
this.statusBarItem = new StatisticsStatusBarItem(this, this.addStatusBarItem()).
setVaultMetrics(this.vaultMetrics);
this.addSettingTab(new StatisticsPluginSettingTab(this.app, this));
return [2 /*return*/];
}
});
});
};
StatisticsPlugin.prototype.loadSettings = function () {
return __awaiter(this, void 0, void 0, function () {
var _a, _b, _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
_a = this;
_c = (_b = Object).assign;
_d = [{}, DEFAULT_SETTINGS];
return [4 /*yield*/, this.loadData()];
case 1:
_a.settings = _c.apply(_b, _d.concat([_e.sent()]));
return [2 /*return*/];
}
});
});
};
StatisticsPlugin.prototype.saveSettings = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.saveData(this.settings)];
case 1:
_a.sent();
this.statusBarItem.refresh();
return [2 /*return*/];
}
});
});
};
return StatisticsPlugin;
}(obsidian.Plugin));
/**
* {@link StatisticView} is responsible for maintaining the DOM representation
* of a given statistic.
*/
var StatisticView = /** @class */ (function () {
/**
* Constructor.
*
* @param containerEl The parent element for the view.
*/
function StatisticView(containerEl) {
this.containerEl = containerEl.createSpan({ cls: ["obsidian-vault-statistics--item"] });
this.setActive(false);
}
/**
* Sets the name of the statistic.
*/
StatisticView.prototype.setStatisticName = function (name) {
this.containerEl.addClass("obsidian-vault-statistics--item-".concat(name));
return this;
};
/**
* Sets the formatter to use to produce the content of the view.
*/
StatisticView.prototype.setFormatter = function (formatter) {
this.formatter = formatter;
return this;
};
/**
* Updates the view with the desired active status.
*
* Active views have the CSS class `obsidian-vault-statistics--item-active`
* applied, inactive views have the CSS class
* `obsidian-vault-statistics--item-inactive` applied. These classes are
* mutually exclusive.
*/
StatisticView.prototype.setActive = function (isActive) {
this.containerEl.removeClass("obsidian-vault-statistics--item--active");
this.containerEl.removeClass("obsidian-vault-statistics--item--inactive");
if (isActive) {
this.containerEl.addClass("obsidian-vault-statistics--item--active");
}
else {
this.containerEl.addClass("obsidian-vault-statistics--item--inactive");
}
return this;
};
/**
* Refreshes the content of the view with content from the passed {@link
* Statistics}.
*/
StatisticView.prototype.refresh = function (s) {
this.containerEl.setText(this.formatter(s));
};
/**
* Returns the text content of the view.
*/
StatisticView.prototype.getText = function () {
return this.containerEl.getText();
};
return StatisticView;
}());
var StatisticsStatusBarItem = /** @class */ (function () {
function StatisticsStatusBarItem(owner, statusBarItem) {
var _this = this;
// index of the currently displayed stat.
this.displayedStatisticIndex = 0;
this.statisticViews = [];
this.refreshSoon = obsidian.debounce(function () { _this.refresh(); }, 2000, false);
this.owner = owner;
this.statusBarItem = statusBarItem;
this.statisticViews.push(new StatisticView(this.statusBarItem).
setStatisticName("notes").
setFormatter(function (s) { return new DecimalUnitFormatter("notes").format(s.notes); }));
this.statisticViews.push(new StatisticView(this.statusBarItem).
setStatisticName("attachments").
setFormatter(function (s) { return new DecimalUnitFormatter("attachments").format(s.attachments); }));
this.statisticViews.push(new StatisticView(this.statusBarItem).
setStatisticName("files").
setFormatter(function (s) { return new DecimalUnitFormatter("files").format(s.files); }));
this.statisticViews.push(new StatisticView(this.statusBarItem).
setStatisticName("links").
setFormatter(function (s) { return new DecimalUnitFormatter("links").format(s.links); }));
this.statisticViews.push(new StatisticView(this.statusBarItem).
setStatisticName("words").
setFormatter(function (s) { return new DecimalUnitFormatter("words").format(s.words); }));
this.statisticViews.push(new StatisticView(this.statusBarItem).
setStatisticName("size").
setFormatter(function (s) { return new BytesFormatter().format(s.size); }));
this.statusBarItem.onClickEvent(function () { _this.onclick(); });
}
StatisticsStatusBarItem.prototype.setVaultMetrics = function (vaultMetrics) {
var _a;
this.vaultMetrics = vaultMetrics;
this.owner.registerEvent((_a = this.vaultMetrics) === null || _a === void 0 ? void 0 : _a.on("updated", this.refreshSoon));
this.refreshSoon();
return this;
};
StatisticsStatusBarItem.prototype.refresh = function () {
var _this = this;
if (this.owner.settings.displayIndividualItems) {
this.statisticViews[0].setActive(this.owner.settings.showNotes).refresh(this.vaultMetrics);
this.statisticViews[1].setActive(this.owner.settings.showAttachments).refresh(this.vaultMetrics);
this.statisticViews[2].setActive(this.owner.settings.showFiles).refresh(this.vaultMetrics);
this.statisticViews[3].setActive(this.owner.settings.showLinks).refresh(this.vaultMetrics);
this.statisticViews[4].setActive(this.owner.settings.showWords).refresh(this.vaultMetrics);
this.statisticViews[5].setActive(this.owner.settings.showSize).refresh(this.vaultMetrics);
}
else {
this.statisticViews.forEach(function (view, i) {
view.setActive(_this.displayedStatisticIndex == i).refresh(_this.vaultMetrics);
});
}
this.statusBarItem.title = this.statisticViews.map(function (view) { return view.getText(); }).join("\n");
};
StatisticsStatusBarItem.prototype.onclick = function () {
if (!this.owner.settings.displayIndividualItems) {
this.displayedStatisticIndex = (this.displayedStatisticIndex + 1) % this.statisticViews.length;
}
this.refresh();
};
return StatisticsStatusBarItem;
}());
module.exports = StatisticsPlugin;
/* nosourcemap */
@@ -0,0 +1,9 @@
{
"id": "obsidian-vault-statistics-plugin",
"name": "Vault Statistics",
"version": "0.1.3",
"minAppVersion": "0.11.0",
"description": "Status bar item with vault statistics such as number of notes, files, attachments, and links.",
"author": "Bryan Kyle",
"isDesktopOnly": false
}
@@ -0,0 +1,9 @@
.obsidian-vault-statistics--item {
margin-left: 0.75em;
}
.obsidian-vault-statistics--item--inactive {
display: none;
}
.obsidian-vault-statistics--item--active {}
+165
View File
@@ -0,0 +1,165 @@
var Bt=Object.defineProperty;var rr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var ar=Object.prototype.hasOwnProperty;var lr=(s,e,t)=>e in s?Bt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var _n=(s,e)=>{for(var t in e)Bt(s,t,{get:e[t],enumerable:!0})},cr=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of or(e))!ar.call(s,i)&&i!==t&&Bt(s,i,{get:()=>e[i],enumerable:!(n=rr(e,i))||n.enumerable});return s};var ur=s=>cr(Bt({},"__esModule",{value:!0}),s);var Se=(s,e,t)=>(lr(s,typeof e!="symbol"?e+"":e,t),t);var Io={};_n(Io,{default:()=>Ps});module.exports=ur(Io);var I=require("obsidian");var B=typeof queueMicrotask=="function"?queueMicrotask:(s=>e=>s.then(e))(Promise.resolve());function Fe(s,e){return new $s(s,e)}var $s=class{constructor(e,t){this.reap=e,this.sched=t,this._flags=0,this.q=new Set,this._run=()=>{this._flags&=-3,this.flush()},this.flush=()=>{if(this._flags&1)return;let{q:n}=this;if(n.size){this._flags|=1;try{this.reap(n)}finally{this._flags&=-2,!n.size||this._flags&2||this._sched()}}}}isRunning(){return!!(this._flags&1)}isEmpty(){return!this.q.size}add(e){this.q.size||this._flags&3||this._sched(),this.q.add(e)}delete(e){this.q.delete(e)}has(e){return this.q.has(e)}_sched(){this._flags|=2,(this.sched||B)(this._run)}};var fr=Array.isArray;function tt(s,e,t){return s.set(e,t),t}function K(s){return typeof s=="function"}var Bs=(()=>{function s(e){return Object.setPrototypeOf(e,new.target.prototype)}return s.prototype=Function.prototype,s})(),Ie=Reflect.apply,Ds=(()=>{function s(){}return s.prototype=function*(){}.constructor.prototype.prototype,s})();function Bn(s){return s.bind(null,"next")}function Dn(s){return s.bind(null,"throw",void 0)}function st(){}function Fs(s,e,t){return{op:s,val:e,err:t}}var qt=Object.freeze(Fs("cancel"));function jn(s){return Fs("next",s)}function Rn(s){return Fs("throw",void 0,s)}function Ks(s){return s===qt}function Ut(s){return s?s.op==="next":!1}function Pe(s){return s?s.op==="throw":!1}function js(s){return Pe(s)&&s.val===void 0}function xe(s){return s.val=null,s.err}function qn(s){if(Ut(s))return s.val;s.op,nt(st,e=>{throw e},s)}function nt(s,e,t){Pe(t)?e(xe(t)):Ks(t)?e(new Ft("Job canceled")):s(t.val)}function Fn(s,e){s.result()||nt(s.return.bind(s),s.throw.bind(s),e)}var Ft=class extends Error{},U=he();function P(s){let e=U;return U=s,e}var Dt=[];function he(s,e){if(Dt&&Dt.length){let t=Dt.pop();return t.job=s,t.cell=e,t}return{job:s,cell:e}}function Rs(s){s.job=s.cell=null,Dt.push(s)}var Ke=new WeakMap,Kn=s=>{Promise.reject(s)},Vs=he(),xn=new WeakMap,Vn=Fe(s=>{for(let e of s)s.delete(e),e.doPull()},B);function Pn(){return Jt(0,void 0,void 0)}function hr(s){for(;s.v;)Vt(s,s.n);s.u=void 0,Vt(s,s)}function dr(s,e){++s.v,Jt(e,s.n,s)}function pr(s,e){++s.v,Jt(e,s,s.p)}function mr(s,e){return++s.v,wr(s,Jt(e,s,s.p))}function gr(s){return!s||s.v===0}function Un(s){return s?s.v:0}function yr(s){if(Un(s))return Vt(s,s.p)}var qs=class{constructor(){this.n=this,this.p=this,this.v=void 0,this.u=void 0}},Kt;function Jt(s,e,t){let n=Kt;return n?(Kt=n.n,n.n=e||n,n.p=t||n):(n=new qs,e&&(n.n=e),t&&(n.p=t)),n.v=s,n.n.p=n,n.p.n=n,n}function Vt(s,e){--s.v;var t=e.v,n=e.u;return e.n&&(e.n.p=e.p),e.p&&(e.p.n=e.n),e.u=e.v=e.p=void 0,e.n=Kt,Kt=e,n&&n(),t}function wr(s,e){let t=e.u||(e.u=()=>{t&&(t===e.u&&Vt(s,e),t=s=e=void 0)});return t}function Me(){var e;let s=U.job||((e=U.cell)==null?void 0:e.getJob());if(s)return s;throw new Error("No job is currently active")}function br(s){return e=>{U.job.must(s.release(e))}}function Mn(s,e){for(;Un(e);)try{yr(e)(s)}catch(t){it.asyncThrow(t)}e&&hr(e)}var ie=new Set,_e=class{constructor(){this.end=()=>{let e=this._done||(this._done=qt),t=this._cbs;if(!t&&!js(e))return;let n=ie.size,i=P(Vs);if(n||ie.add(null),t&&t.u&&(t.u=Mn(e,t.u)),ie.add(this),n){P(i);return}ie.delete(null);for(let r of ie)r._cbs&&(r._cbs=Mn(r._done,r._cbs)),ie.delete(r),js(r._done)&&r.throw(xe(r._done));P(i)},this._done=void 0,this._cbs=void 0}static create(e,t){let n=new _e;return(e||t)&&(n.must((e||(e=Me())).release(t||n.end)),xn.set(n,e)),n}do(e){return dr(this._chain(),e),this}onError(e){return this.do(t=>{Pe(t)&&e(xe(t))})}onValue(e){return this.do(t=>{Ut(t)&&e(t.val)})}onCancel(e){return this.do(t=>{Ks(t)&&e()})}result(){var e;return this._done||((e=U.cell)==null?void 0:e.recalcWhen(this,br))||void 0}get[Symbol.toStringTag](){return"Job"}restart(){if(!this._done&&ie.size){let e=ie;ie=new Set,this.end(),ie=e}else this._end(qt);return this._done=void 0,jt.delete(this),this}_end(e){if(this._done)throw new Error("Job already ended");return this!==fe&&(this._done=e),this.end(),this}throw(e){return this._done?((xn.get(this)||fe).asyncThrow(e),this):this._end(Rn(e))}return(e){return this._end(jn(e))}then(e,t){return Rt(this).then(e,t)}catch(e){return Rt(this).catch(e)}finally(e){return Rt(this).finally(e)}*[Symbol.iterator](){return this._done?qn(this._done):yield e=>{this.do(t=>nt(Bn(e),Dn(e),t))}}start(e,t){if(!e)returLine truncated
details.ophidian-settings-group > div {
margin-left: var(--font-ui-medium);
}
summary.ophidian-settings-group {
display: flex;
}
summary.ophidian-settings-group > div.setting-item-heading:first-child {
width: 100%;
}
summary.ophidian-settings-group > div.setting-item-heading:first-child .setting-item-description {
margin-left: var(--font-ui-medium);
}
details.ophidian-settings-group > summary.ophidian-settings-group > div.setting-item-heading:first-child .setting-item-name::before {
content: "\u25B8";
display: inline-flex;
width: var(--font-ui-medium);
}
details.ophidian-settings-group[open] > summary.ophidian-settings-group > div.setting-item-heading:first-child .setting-item-name::before {
content: "\u25BE";
}`;var Pa=$r(s=>s.createEl("style",{text:jr}));var Rr=`.ophidian-dialog .dialog-text {
margin-bottom: 0.75em;
}
.ophidian-dialog.mod-confirmation input[type=text]:invalid, .ophidian-dialog.mod-confirmation input[type=text]:invalid:enabled:focus, .ophidian-dialog.mod-confirmation input[type=text][aria-invalid=true], .ophidian-dialog.mod-confirmation input[type=text][aria-invalid=true]:enabled:focus {
border-color: var(--text-error);
background-color: var(--background-modifier-error);
}`,zt=class extends De.Modal{constructor(){super(ui),this.buttonContainerEl=this.modalEl.createDiv("modal-button-container"),this.styleEl=this.modalEl.createEl("style",{text:Rr}),this.textContentEl=this.contentEl.createDiv("dialog-text"),this.okButton=this.buttonContainerEl.createEl("button",{cls:"mod-cta",text:i18next.t("dialogue.button-continue")},s=>{s.addEventListener("click",async e=>{var t;await((t=this.onOK)==null?void 0:t.call(this,e))||this.close()})}),this.isOpened=!1,this.containerEl.addClass("mod-confirmation"),this.containerEl.addClass("ophidian-dialog")}onOK(s){return!1}open(){this.isOpened||super.open(),this.isOpened=!0}close(){this.isOpened&&super.close(),this.isOpened=!1}setOk(s){this.okButton.textContent=s}addButton(s,e,t,n){return this.buttonContainerEl.createEl("button",{cls:s,text:e},n).addEventListener("click",async i=>{await t(i)||this.close()}),this}addCancelButton(s){return this.addButton("",i18next.t("dialogue.button-cancel"),()=>(this.close(),s&&s()))}setContent(s){return String.isString(s)?this.textContentEl.setText(s):this.textContentEl.appendChild(s),this}setTitle(s){return this.titleEl.setText(s),this}setup(s){return s&&s(this),this}},Xt=class extends zt{constructor(){super(...arguments),this.value=!1}onOK(s){this.value=!0}confirm(){this.addCancelButton();let{resolve:s,promise:e}=ci();return this.onClose=()=>s(this.value),this.open(),e}},hi=class extends zt{constructor(){super(...arguments),this.value=!1,this.setting=this.contentEl.createDiv("is-mobile"),this.inputEl=this.setting.createEl("input",{type:"text"},s=>{s.addEventListener("keypress",async e=>{var t;e.key==="Enter"&&!e.isComposing&&(await((t=this.onOK)==null?void 0:t.call(this,e))||this.close())})})}onOK(s){let{value:e}=this.inputEl;if(!this.isValid(e))return this.handleInvalidEntry(e),!0;this.value=this.inputEl.value}isValid(s){return!0}handleInvalidEntry(s){}setPlaceholder(s){return s?this.inputEl.placeholder=s:this.inputEl.removeAttribute("placeholder"),this}setValue(s){return this.inputEl.value=s,this}setPattern(s){return this.inputEl.pattern=s,this.setValidator(e=>new RegExp(`^${s}$`).test(e))}setValidator(s){return this.isValid=s,this.inputEl.oninput=()=>this.inputEl.setAttribute("aria-invalid",""+!s(this.inputEl.value)),this}onInvalidEntry(s){return this.handleInvalidEntry=s,this}prompt(){this.addCancelButton();let{resolve:s,promise:e}=ci();return this.onClose=()=>s(this.value),this.open(),this.inputEl.select(),this.inputEl.focus(),e}};var en=class extends zt{constructor(t){super();Se(this,"progressEl",this.contentEl.createEl("progress",{value:0,attr:{style:"width: 100%",max:100}}));Se(this,"counterEl",this.contentEl.createDiv({text:"0%"}));this.okButton.detach(),this.addCancelButton(),this.onClose=t}setProgress(t){this.counterEl.textContent=`${t}%`,this.progressEl.value=t}},ct=class{constructor(e,t){Se(this,"aborted",!1);this.progress=new en(()=>this.aborted=!0).setTitle(e).setContent(t),this.progress.open()}async forEach(e,t){try{if(this.aborted)return;let n=0,i=e.length,r=0,o=0;for(let a of e){if(await t(a,n++,e,this),this.aborted)return;if(r+=100,r>i){let l=r%i,c=(r-l)/i;this.progress.setProgress(o+=c),r=l}}return o<100&&this.progress.setProgress(100),this}finally{this.progress.onClose=()=>null,this.progress.close()}}set title(e){this.progress.setTitle(e)}set message(e){this.progress.setContent(e)}};var Le=require("obsidian");var qr=/^#[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]+$/,A=class{constructor(e){let t=this.tag=A.toTag(e),n=this.canonical=t.toLowerCase(),i=this.canonical_prefix=n+"/";this.name=t.slice(1),this.matches=function(r){return r=r.toLowerCase(),r==n||r.startsWith(i)}}toString(){return this.tag}static isTag(e){return qr.test(e)}static toTag(e){for(;e.startsWith("##");)e=e.slice(1);return e.startsWith("#")?e:"#"+e}static toName(e){return this.toTag(e).slice(1)}static canonical(e){return A.toTag(e).toLowerCase()}},Zt=class{constructor(e,t){let n=Object.assign(Object.create(null),{[e.tag]:t.tag,[e.name]:t.name});this.inString=function(i,r=0){return i.slice(0,r)+t.tag+i.slice(r+e.tag.length)},this.inArray=(i,r,o)=>i.map((a,l)=>{if(r&&l&1||!a||typeof a!="string")return a;if(o){if(!a.startsWith("#")||!A.isTag(a))return a}else if(/[ ,\n]/.test(a))return this.inArray(a.split(/([, \n]+)/),!0).join("");if(n[a])return n[a];let c=a.toLowerCase();return n[c]?n[a]=n[c]:c.startsWith(e.canonical_prefix)?n[a]=n[c]=this.inString(a):("#"+c).startsWith(e.canonical_prefix)?n[a]=n[c]=this.inString("#"+a).slice(1):n[a]=n[c]=a}),this.willMergeTags=function(i){if(e.canonical===t.canonical)return;let r=new Set(i.map(o=>o.toLowerCase()));for(let o of i.filter(e.matches)){let a=this.inString(o);if(r.has(a.toLowerCase()))return[new A(o),new A(a)]}}}};var Ln=require("obsidian");var es=Symbol.for("yaml.alias"),ts=Symbol.for("yaml.document"),Q=Symbol.for("yaml.map"),tn=Symbol.for("yaml.pair"),J=Symbol.for("yaml.scalar"),pe=Symbol.for("yaml.seq"),R=Symbol.for("yaml.node.type"),H=s=>!!s&&typeof s=="objeLine truncated
`)}};_.defaultYaml={explicit:!1,version:"1.2"};_.defaultTags={"!!":"tag:yaml.org,2002:"};function ss(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function sn(s){let e=new Set;return X(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function nn(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function pi(s,e){let t=[],n=new Map,i=null;return{onAnchor(r){t.push(r),i||(i=sn(s));let o=nn(e,i);return i.add(o),o},setAnchors(){for(let r of t){let o=n.get(r);if(typeof o=="object"&&o.anchor&&(E(o.node)||T(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}var me=class extends ke{constructor(e){super(es),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return X(e,{Node:(n,i)=>{if(i===this)return X.BREAK;i.anchor===this.source&&(t=i)}}),t}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(!a||a.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ns(i,o,n)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){let i=`*${this.source}`;if(e){if(ss(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function ns(s,e,t){if(H(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(T(e)){let n=0;for(let i of e.items){let r=ns(s,i,t);r>n&&(n=r)}return n}else if(O(e)){let n=ns(s,e.key,t),i=ns(s,e.value,t);return Math.max(n,i)}return 1}function j(s,e,t){if(Array.isArray(s))return s.map((n,i)=>j(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!di(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!(t&&t.keep)?Number(s):s}var is=s=>!s||typeof s!="function"&&typeof s!="object",v=class extends ke{constructor(e){super(J),this.value=e}toJSON(e,t){return t&&t.keep?this.value:j(this.value,e,t)}toString(){return String(this.value)}};v.BLOCK_FOLDED="BLOCK_FOLDED";v.BLOCK_LITERAL="BLOCK_LITERAL";v.PLAIN="PLAIN";v.QUOTE_DOUBLE="QUOTE_DOUBLE";v.QUOTE_SINGLE="QUOTE_SINGLE";var Ur="tag:yaml.org,2002:";function Jr(s,e,t){if(e){let n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)||n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify&&n.identify(s)&&!n.format)}function ge(s,e,t){var n,i;if(Je(s)&&(s=s.contents),C(s))return s;if(O(s)){let d=(i=(n=t.schema[Q]).createNode)===null||i===void 0?void 0:i.call(n,t.schema,null,t);return d.items.push(s),d}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt=="function"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:r,onAnchor:o,onTagObj:a,schema:l,sourceObjects:c}=t,u;if(r&&s&&typeof s=="object"){if(u=c.get(s),u)return u.anchor||(u.anchor=o(s)),new me(u.anchor);u={anchor:null,node:null},c.set(s,u)}e&&e.startsWith("!!")&&(e=Ur+e.slice(2));let f=Jr(s,e,l.tags);if(!f){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let d=new v(s);return u&&(u.node=d),d}f=s instanceof Map?l[Q]:Symbol.iterator in Object(s)?l[pe]:l[Q]}a&&(a(f),delete t.onTagObj);let h=f!=null&&f.createNode?f.createNode(t.schema,s,t):new v(s);return e&&(h.tag=e),u&&(u.node=h),h}function ft(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return ge(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var Ge=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,ye=class extends ke{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>C(n)||O(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Ge(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(T(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,ft(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,! Line truncated
`)?`
`+oe(t,e):(s.endsWith(" ")?"":" ")+t;var rn="flow",rs="block",ht="quoted";function dt(s,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return s;let l=Math.max(1+r,1+i-e.length);if(s.length<=l)return s;let c=[],u={},f=i-e.length;typeof n=="number"&&(n>i-Math.max(2,r)?c.push(0):f=i-n);let h,d,g=!1,p=-1,m=-1,y=-1;t===rs&&(p=gi(s,p),p!==-1&&(f=p+l));for(let k;k=s[p+=1];){if(t===ht&&k==="\\"){switch(m=p,s[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}y=p}if(k===`
`)t===rs&&(p=gi(s,p)),f=p+l,h=void 0;else{if(k===" "&&d&&d!==" "&&d!==`
`&&d!==" "){let w=s[p+1];w&&w!==" "&&w!==`
`&&w!==" "&&(h=p)}if(p>=f)if(h)c.push(h),f=h+l,h=void 0;else if(t===ht){for(;d===" "||d===" ";)d=k,k=s[p+=1],g=!0;let w=p>y+1?p-2:m-1;if(u[w])return s;c.push(w),u[w]=!0,f=w+l,h=void 0}else g=!0}d=k}if(g&&a&&a(),c.length===0)return s;o&&o();let b=s.slice(0,c[0]);for(let k=0;k<c.length;++k){let w=c[k],S=c[k+1]||s.length;w===0?b=`
${e}${s.slice(0,S)}`:(t===ht&&u[w]&&(b+=`${s[w]}\\`),b+=`
${e}${s.slice(w+1,S)}`)}return b}function gi(s,e){let t=s[e+1];for(;t===" "||t===" ";){do t=s[e+=1];while(t&&t!==`
`);t=s[e+1]}return e}var as=s=>({indentAtStart:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),ls=s=>/^(%|---|\.\.\.)/m.test(s);function Wr(s,e,t){if(!e||e<0)return!1;let n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;r<i;++r)if(s[r]===`
`){if(r-o>n)return!0;if(o=r+1,i-o<=n)return!1}return!0}function pt(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(ls(s)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let u=t.substr(l+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]==='"'||t.length<i)l+=1;else{for(o+=t.slice(a,l)+`
`;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=`
`,l+=2;o+=r,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,n?o:dt(o,r,ht,as(e))}function on(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
`)||/[ \t]\n|\n[ \t]/.test(s))return pt(s,e);let t=e.indent||(ls(s)?" ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
${t}`)+"'";return e.implicitKey?n:dt(n,t,rn,as(e))}function mt(s,e){let{singleQuote:t}=e.options,n;if(t===!1)n=pt;else{let i=s.includes('"'),r=s.includes("'");i&&!r?n=on:r&&!i?n=pt:n=t?on:pt}return n(s,e)}function os({comment:s,type:e,value:t},n,i,r){let{blockQuote:o,commentString:a,lineWidth:l}=n.options;if(!o||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return mt(t,n);let c=n.indent||(n.forceBlockIndent||ls(t)?" ":""),u=o==="literal"?!0:o==="folded"||e===v.BLOCK_FOLDED?!1:e===v.BLOCK_LITERAL?!0:!Wr(t,l,c.length);if(!t)return u?`|
`:`>
`;let f,h;for(h=t.length;h>0;--h){let N=t[h-1];if(N!==`
`&&N!==" "&&N!==" ")break}let d=t.substring(h),g=d.indexOf(`
`);g===-1?f="-":t===d||g!==d.length-1?(f="+",r&&r()):f="",d&&(t=t.slice(0,-d.length),d[d.length-1]===`
`&&(d=d.slice(0,-1)),d=d.replace(/\n+(?!\n|$)/g,`$&${c}`));let p=!1,m,y=-1;for(m=0;m<t.length;++m){let N=t[m];if(N===" ")p=!0;else if(N===`
`)y=m;else break}let b=t.substring(0,y<m?y+1:m);b&&(t=t.substring(b.length),b=b.replace(/\n+/g,`$&${c}`));let w=(u?"|":">")+(p?c?"2":"1":"")+f;if(s&&(w+=" "+a(s.replace(/ ?[\r\n]+/g," ")),i&&i()),u)return t=t.replace(/\n+/g,`$&${c}`),`${w}
${c}${b}${t}${d}`;t=t.replace(/\n+/g,`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);let S=dt(`${b}${t}${d}`,c,rs,as(n));return`${w}
${c}${S}`}function Gr(s,e,t,n){let{type:i,value:r}=s,{actualString:o,implicitKey:a,indent:l,inFlow:c}=e;if(a&&/[\n[\]{},]/.test(r)||c&&/[[\]{},]/.test(r))return mt(r,e);if(!r||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||c||r.indexOf(`
`)===-1?mt(r,e):os(s,e,t,n);if(!a&&!c&&i!==v.PLAIN&&r.indexOf(`
`)!==-1)return os(s,e,t,n);if(l===""&&ls(r))return e.forceBlockIndent=!0,os(s,e,t,n);let u=r.replace(/\n+/g,`$&
${l}`);if(o){let f=g=>{var p;return g.default&&g.tag!=="tag:yaml.org,2002:str"&&((p=g.test)===null||p===void 0?void 0:p.test(u))},{compat:h,tags:d}=e.doc.schema;if(d.some(f)||h!=null&&h.some(f))return mt(r,e)}return a?u:dt(u,l,rn,as(e))}function we(s,e,t,n){let{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==v.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=v.QUOTE_DOUBLE);let l=u=>{switch(u){case v.BLOCK_FOLDED:case v.BLOCK_LITERAL:return i||r?mt(o.value,e):os(o,e,t,n);case v.QUOTE_DOUBLE:return pt(o.value,e);case v.QUOTE_SINGLE:return on(o.value,e);case v.PLAIN:return Gr(o,e,t,n);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=e.options,h=i&&u||f;if(c=l(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function cs(s,e){let t=Object.assign({blockQuote:!0,commentString:mi,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Yr(s,e){if(e.tag){let i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)||i[0]}let t,n;if(E(e)){n=e.value;let i=s.filter(r=>r.identify&&r.identify(n));t=i.find(r=>r.format===e.format)||i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){let i=n&&n.constructor?n.constructor.name:typeof n;throw new Error(`Tag not resolved for ${i} value`)}return t}function Qr(s,e,{anchors:t,doc:n}){if(!n.directives)return"";let i=[],r=(E(s)||T(s))&&s.anchor;r&&ss(r)&&(t.add(r),i.push(`&${r}`));let o=s.tag||(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function ee(s,e,t,n){var i;if(O(s))return s.toString(e,t,n);if(H(s)){if(e.doc.directives)return s.toString(e);if(!((i=e.resolvedAliases)===null||i===void 0)&&i.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let r,o=C(s)?s:e.doc.createNode(s,{onTagObj:c=>r=c});r||(r=Yr(e.doc.schema.tags,o));let a=Qr(o,r,e);a.length>0&&(e.indentAtStart=(e.indentAtStart||0)+a.length+1);let l=typeof r.stringify=="function"?r.stringify(o,e,t,n):E(o)?we(o,e,t,n):o.toString(e,t,n);return a?E(o)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a}
${e.indent}${l}`:l}function yi({key:s,value:e},t,n,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=t,h=C(s)&&s.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(T(s)){let N="With simple keys, collection cannot be used as a key value";throw new Error(N)}}let d=!f&&(!s||h&&e==null&&!t.inFlow||T(s)||(E(s)?s.type===v.BLOCK_FOLDED||s.type===v.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!d&&(f||!r),indent:a+l});let g=!1,p=!1,m=ee(s,t,()=>g=!0,()=>p=!0);if(!d&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(t.inFlow){if(r||e==null)return g&&n&&n(),d?`? ${m}`:m}else if(r&&!f||e==null&&d)return m=`? ${m}`,h&&!g?m+=Z(m,t.indent,c(h)):p&&i&&i(),m;g&&(h=null),d?(h&&(m+=Z(m,t.indent,c(h))),m=`? ${m}
${a}:`):(m=`${m}:`,h&&(m+=Z(m,t.indent,c(h))));let y="",b=null;if(C(e)){if(e.spaceBefore&&(y=`
`),e.commentBefore){let N=c(e.commentBefore);y+=`
${oe(N,t.indent)}`}b=e.comment}else e&&typeof e=="object"&&(e=o.createNode(e));t.implicitKey=!1,!d&&!h&&E(e)&&(t.indentAtStart=m.length+1),p=!1,!u&&l.length>=2&&!t.inFlow&&!d&&z(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substr(2));let k=!1,w=ee(e,t,()=>k=!0,()=>p=!0),S=" ";return y||h?S=w===""&&!t.inFlow?y:`${y}
${t.indent}`:!d&&T(e)?(!(w[0]==="["||w[0]==="{")||w.includes(`
`))&&(S=`
${t.indent}`):(w===""||w[0]===`
`)&&(S=""),m+=S+w,t.inFlow?k&&n&&n():b&&!k?m+=Z(m,t.indent,c(b)):p&&i&&i(),m}function an(s,e){(s==="debug"||s==="warn")&&(typeof process!="undefined"&&process.emitWarning?process.emitWarning(e):console.warn(e))}var wi="<<";function us(s,e,{key:t,value:n}){if(s&&s.doc.schema.merge&&Hr(t))if(n=H(n)?n.resolve(s.doc):n,z(n))for(let i of n.items)ln(s,e,i);else if(Array.isArray(n))for(let i of n)ln(s,e,i);else ln(s,e,n);else{let i=j(t,"",s);if(e instanceof Map)e.set(i,j(n,i,s));else if(e instanceof Set)e.add(i);else{let r=zr(t,i,s),o=j(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}var Hr=s=>s===wi||E(s)&&s.value===wi&&(!s.type||s.type===v.PLAIN);function ln(s,e,t){let n=s&&H(t)?t.resolve(s.doc):t;if(!V(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,s,Map);for(let[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function zr(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(C(s)&&t&&t.doc){let n=cs(t.doc,{});n.anchors=new Set;for(let r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),an(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Ye(s,e,t){let n=ge(s,void 0,t),i=ge(e,void 0,t);return new L(n,i)}var L=class{constructor(e,t=null){Object.defineProperty(this,R,{value:tn}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return C(t)&&(t=t.clone(e)),C(n)&&(n=n.clone(e)),new L(t,n)}toJSON(e,t){let n=t&&t.mapAsMap?new Map:{};return us(t,n,this)}toString(e,t,n){return e&&e.doc?yi(this,e,t,n):JSON.stringify(this)}};var gt={intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,uniqueKeys:!0,version:"1.2"};function hs(s,e,t){var n;return(((n=e.inFlow)!==null&&n!==void 0?n:s.flow)?Zr:Xr)(s,e,t)}function Xr({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,u=Object.assign({},t,{indent:r,type:null}),f=!1,h=[];for(let g=0;g<e.length;++g){let p=e[g],m=null;if(C(p))!f&&p.spaceBefore&&h.push(""),fs(t,h,p.commentBefore,f),p.comment&&(m=p.comment);else if(O(p)){let b=C(p.key)?p.key:null;b&&(!f&&b.spaceBefore&&h.push(""),fs(t,h,b.commentBefore,f))}f=!1;let y=ee(p,u,()=>m=null,()=>f=!0);m&&(y+=Z(y,r,c(m))),f&&m&&(f=!1),h.push(n+y)}let d;if(h.length===0)d=i.start+i.end;else{d=h[0];for(let g=1;g<h.length;++g){let p=h[g];d+=p?`
${l}${p}`:`
`}}return s?(d+=`
`+oe(c(s),l),a&&a()):f&&o&&o(),d}function Zr({comment:s,items:e},t,{flowChars:n,itemIndent:i,onComment:r}){let{indent:o,indentStep:a,options:{commentString:l}}=t;i+=a;let c=Object.assign({},t,{indent:i,inFlow:!0,type:null}),u=!1,f=0,h=[];for(let m=0;m<e.length;++m){let y=e[m],b=null;if(C(y))y.spaceBefore&&h.push(""),fs(t,h,y.commentBefore,!1),y.comment&&(b=y.comment);else if(O(y)){let w=C(y.key)?y.key:null;w&&(w.spaceBefore&&h.push(""),fs(t,h,w.commentBefore,!1),w.comment&&(u=!0));let S=C(y.value)?y.value:null;S?(S.comment&&(b=S.comment),S.commentBefore&&(u=!0)):y.value==null&&w&&w.comment&&(b=w.comment)}b&&(u=!0);let k=ee(y,c,()=>b=null);m<e.length-1&&(k+=","),b&&(k+=Z(k,i,l(b))),!u&&(h.length>f||k.includes(`
`))&&(u=!0),h.push(k),f=h.length}let d,{start:g,end:p}=n;if(h.length===0)d=g+p;else if(u||(u=h.reduce((y,b)=>y+b.length+2,2)>ye.maxFlowStringSingleLineLength),u){d=g;for(let m of h)d+=m?`
${a}${o}${m}`:`
`;d+=`
${o}${p}`}else d=`${g} ${h.join(" ")} ${p}`;return s&&(d+=Z(d,l(s),o),r&&r()),d}function fs({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let r=oe(e(n),s);t.push(r.trimStart())}}function Ee(s,e){let t=E(e)?e.value:e;for(let n of s)if(O(n)&&(n.key===e||n.key===t||E(n.key)&&n.key.value===t))return n}var x=class extends ye{constructor(e){super(Q,e),this.items=[]}static get tagName(){return"tag:yaml.org,2002:map"}add(e,t){let n;O(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new L(e,e.value):n=new L(e.key,e.value);let i=Ee(this.items,n.key),r=this.schema&&this.schema.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);E(i.value)&&is(n.value)?i.value.value=n.value:i.value=n.value}else if(r){let o=this.items.findIndex(a=>r(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=Ee(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Ee(this.items,e),i=n&&n.value;return!t&&E(i)?i.value:i}has(e){return!!Ee(this.items,e)}set(e,t){this.add(new L(e,t),!0)}toJSON(e,t,n){let i=n?new n:t&&t.mapAsMap?new Map:{};t&&t.onCreate&&t.onCreate(i);for(let r of this.items)us(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!O(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),hs(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};function eo(s,e,t){let{keepUndefined:n,replacer:i}=t,r=new x(s),o=(a,l)=>{if(typeof i=="function")l=i.call(e,a,l);else if(Array.isArray(i)&&!i.includes(a))return;(l!==void 0||n)&&r.items.push(Ye(a,l,t))};if(e instanceof Map)for(let[a,l]of e)o(a,l);else if(e&&typeof e=="object")for(let a of Object.keys(e))o(a,e[a]);return typeof s.sortMapEntries=="function"&&r.items.sort(s.sortMapEntries),r}var te={collection:"map",createNode:eo,default:!0,nodeClass:x,tag:"tag:yaml.org,2002:map",resolve(s,e){return V(s)||e("Expected a mapping for this tag"),s}};var q=class extends ye{constructor(e){super(pe,e),this.items=[]}static get tagName(){return"tag:yaml.org,2002:seq"}add(e){this.items.push(e)}delete(e){let t=ds(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=ds(e);if(typeof n!="number")return;let i=this.items[n];return!t&&E(i)?i.value:i}has(e){let t=ds(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=ds(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];E(i)&&is(t)?i.value=t:this.items[n]=t}toJSON(e,t){let n=[];t&&t.onCreate&&t.onCreate(n);let i=0;for(let r of this.items)n.push(j(r,String(i++),t));return n}toString(e,t,n){return e?hs(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}};function ds(s){let e=E(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function to(s,e,t){let{replacer:n}=t,i=new q(s);if(e&&Symbol.iterator in Object(e)){let r=0;for(let o of e){if(typeof n=="function"){let a=e instanceof Set?o:String(r++);o=n.call(e,a,o)}i.items.push(ge(o,void 0,t))}}return i}var se={collection:"seq",createNode:to,default:!0,nodeClass:q,tag:"tag:yaml.org,2002:seq",resolve(s,e){return z(s)||e("Expected a sequence for this tag"),s}};var Oe={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),we(s,e,t,n)}};var Re={identify:s=>s==null,createNode:()=>new v(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new v(null),stringify:({source:s},e)=>s&&Re.test.test(s)?s:e.options.nullStr};var yt={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new v(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&yt.test.test(s)){let n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function $({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}var ps={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$},ms={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let Line truncated
`:" ")}return we({comment:s,type:e,value:a},n,i,r)}};function un(s,e){if(z(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!O(n)){if(V(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new L(new v(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
${i.key.commentBefore}`:n.commentBefore),n.comment){let r=i.value||i.key;r.comment=r.comment?`${n.comment}
${r.comment}`:n.comment}n=i}s.items[t]=O(n)?n:new L(n)}}else e("Expected a sequence for this tag");return s}function fn(s,e,t){let{replacer:n}=t,i=new q(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected { key: value } tuple: ${o}`)}else a=o;i.items.push(Ye(a,l,t))}return i}var bt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:un,createNode:fn};var Ne=class extends q{constructor(){super(),this.add=x.prototype.add.bind(this),this.delete=x.prototype.delete.bind(this),this.get=x.prototype.get.bind(this),this.has=x.prototype.has.bind(this),this.set=x.prototype.set.bind(this),this.tag=Ne.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t&&t.onCreate&&t.onCreate(n);for(let i of this.items){let r,o;if(O(i)?(r=j(i.key,"",t),o=j(i.value,r,t)):r=j(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}};Ne.tag="tag:yaml.org,2002:omap";var vt={collection:"seq",identify:s=>s instanceof Map,nodeClass:Ne,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=un(s,e),n=[];for(let{key:i}of t.items)E(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ne,t)},createNode(s,e,t){let n=fn(s,e,t),i=new Ne;return i.items=n.items,i}};function Ei({value:s,source:e},t){return e&&(s?hn:dn).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var hn={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new v(!0),stringify:Ei},dn={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new v(!1),stringify:Ei};var Oi={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$},Ni={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():$(s)}},Ci={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new v(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:$};var St=s=>typeof s=="bigint"||Number.isInteger(s);function ks(s,e,t,{intAsBigInt:n}){let i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return i==="-"?BigInt(-1)*o:o}let r=parseInt(s,t);return i==="-"?-1*r:r}function pn(s,e,t){let{value:n}=s;if(St(n)){let i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return $(s)}var Ti={identify:St,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>ks(s,2,2,t),stringify:s=>pn(s,2,"0b")},Ai={identify:St,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>ks(s,1,8,t),stringify:s=>pn(s,8,"0")},Li={identify:St,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>ks(s,0,10,t),stringify:$},Ii={identify:St,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>ks(s,2,16,t),stringify:s=>pn(s,16,"0x")};var Ce=class extends x{constructor(e){super(e),this.tag=Ce.tag}add(e){let t;O(e)?t=e:typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new L(e.key,null):t=new L(e,null),Ee(this.items,t.key)||this.items.push(t)}get(e,t){let n=Ee(this.items,e);return!t&&O(n)?E(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Ee(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new L(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}};Ce.tag="tag:yaml.org,2002:set";var kt={collection:"map",identify:s=>s instanceof Set,nodeClass:Ce,default:!1,tag:"tag:yaml.org,2002:set",resolve(s,e){if(V(s)){if(s.hasAllNullValues(!0))return Object.assign(new Ce,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s},createNode(s,e,t){let{replacer:n}=t, Line truncated
`)+`
`}function He(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){let o=n[i],a=He(s,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let r=n.get(i),o=He(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let r=He(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(let[i,r]of Object.entries(n)){let o=He(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}var ae=class{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,R,{value:ts});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let r=Object.assign({},gt,n);this.options=r;let{version:o}=r;n!=null&&n.directives?(this.directives=n.directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new _({version:o}),this.setSchema(o,n),e===void 0?this.contents=null:this.contents=this.createNode(e,i,n)}clone(){let e=Object.create(ae.prototype,{[R]:{value:ts}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=C(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ze(this.contents)&&this.contents.add(e)}addIn(e,t){ze(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=sn(this);e.anchor=!t||n.has(t)?nn(t||"a",n):t}return new me(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){let m=b=>typeof b=="number"||b instanceof String||b instanceof Number,y=t.filter(m).map(String);y.length>0&&(t=t.concat(y)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:u}=n||{},{onAnchor:f,setAnchors:h,sourceObjects:d}=pi(this,o||"a"),g={aliasDuplicateObjects:r!=null?r:!0,keepUndefined:l!=null?l:!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:d},p=ge(e,u,g);return a&&T(p)&&(p.flow=!0),h(),p}createPair(e,t,n={}){let i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new L(i,r)}delete(e){return ze(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ge(e)?this.contents==null?!1:(this.contents=null,!0):ze(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return T(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Ge(e)?!t&&E(this.contents)?this.contents.value:this.contents:T(this.contents)?this.contents.getIn(e,t):void 0}has(e){return T(this.contents)?this.contents.has(e):!1}hasIn(e){return Ge(e)?this.contents!==void 0:T(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=ft(this.schema,[e],t):ze(this.contents)&&this.contents.set(e,t)}setIn(e,t){Ge(e)?this.contents=t:this.contents==null?this.contents=ft(this.schema,Array.from(e),t):ze(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new _({version:"1.1"}),n={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":this.directives?this.directives.yaml.version="1.2":this.directives=new _({version:"1.2"}),n={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new qe(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100,stringify:ee},l=j(this.contents,t||"",a);if(typeof r=="function")for(let{count:c,res:u}of a.anchors.values())r(u,c);return typeof o=="function"?He(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return $i(this,e)}};function ze(s){if(T(s))return!0;throw new Error("Expected a YAML collection as document contents")}var Et=class extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}},W=class extends Et{constructor(e,t,n){super("YAMLParseError",e,t,n)}},Ot=class extends Et{constructor(e,t,n){super("YAMLWarning",e,t,n)}},yn=(s,e) Line truncated
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l&&l.line===n&&l.col>i&&(a=Math.min(l.col-i,80-r));let c=" ".repeat(r)+"^".repeat(a);t.message+=`:
${o}
${c}
`}};function le(s,{flow:e,indicator:t,next:n,offset:i,onError:r,startOnNewline:o}){let a=!1,l=o,c=o,u="",f="",h=!1,d=!1,g=null,p=null,m=null,y=null,b=null;for(let S of s)switch(d&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&r(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d=!1),S.type){case"space":!e&&l&&t!=="doc-start"&&S.source[0]===" "&&r(S,"TAB_AS_INDENT","Tabs are not allowed as indentation"),c=!0;break;case"comment":{c||r(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let N=S.source.substring(1)||" ";u?u+=f+N:u=N,f="",l=!1;break}case"newline":l?u?u+=S.source:a=!0:f+=S.source,l=!0,h=!0,c=!0;break;case"anchor":g&&r(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),g=S,b===null&&(b=S.offset),l=!1,c=!1,d=!0;break;case"tag":{p&&r(S,"MULTIPLE_TAGS","A node can have at most one tag"),p=S,b===null&&(b=S.offset),l=!1,c=!1,d=!0;break}case t:(g||p)&&r(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),y&&r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${e||"collection"}`),y=S,l=!1,c=!1;break;case"comma":if(e){m&&r(S,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),m=S,l=!1,c=!1;break}default:r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),l=!1,c=!1}let k=s[s.length-1],w=k?k.offset+k.source.length:i;return d&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&r(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),{comma:m,found:y,spaceBefore:a,comment:u,hasNewline:h,anchor:g,tag:p,end:w,start:b!=null?b:w}}function Te(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
`))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(Te(e.key)||Te(e.value))return!0}return!1;default:return!0}}function Nt(s,e,t){if((e==null?void 0:e.type)==="flow-collection"){let n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&Te(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Cs(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let i=typeof n=="function"?n:(r,o)=>r===o||E(r)&&E(o)&&r.value===o.value&&!(r.value==="<<"&&s.schema.merge);return e.some(r=>i(r.key,t))}var Bi="All mapping items must start at the same column";function Di({composeNode:s,composeEmptyNode:e},t,n,i){var r;let o=new x(t.schema);t.atRoot&&(t.atRoot=!1);let a=n.offset;for(let l of n.items){let{start:c,key:u,sep:f,value:h}=l,d=le(c,{indicator:"explicit-key-ind",next:u||(f==null?void 0:f[0]),offset:a,onError:i,startOnNewline:!0}),g=!d.found;if(g){if(u&&(u.type==="block-seq"?i(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==n.indent&&i(a,"BAD_INDENT",Bi)),!d.anchor&&!d.tag&&!f){d.comment&&(o.comment?o.comment+=`
`+d.comment:o.comment=d.comment);continue}}else((r=d.found)===null||r===void 0?void 0:r.indent)!==n.indent&&i(a,"BAD_INDENT",Bi);g&&Te(u)&&i(u,"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line");let p=d.end,m=u?s(t,u,d,i):e(t,p,c,null,d,i);t.schema.compat&&Nt(n.indent,u,i),Cs(t,o.items,m)&&i(p,"DUPLICATE_KEY","Map keys must be unique");let y=le(f||[],{indicator:"map-value-ind",next:h,offset:m.range[2],onError:i,startOnNewline:!u||u.type==="block-scalar"});if(a=y.end,y.found){g&&((h==null?void 0:h.type)==="block-map"&&!y.hasNewline&&i(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&d.start<y.found.offset-1024&&i(m.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let b=h?s(t,h,y,i):e(t,a,f,null,y,i);t.schema.compat&&Nt(n.indent,h,i),a=b.range[2];let k=new L(m,b);t.options.keepSourceTokens&&(k.srcToken=l),o.items.push(k)}else{g&&i(m.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),y.comment&&(m.comment?m.comment+=`
`+y.comment:m.comment=y.comment);let b=new L(m);t.options.keepSourceTokens&&(b.srcToken=l),o.items.push(b)}}return o.range=[n.offset,a,a],o}function ji({composeNode:s,composeEmptyNode:e},t,n,i){let r=new q(t.schema);t.atRoot&&(t.atRoot=!1);let o=n.offset;for(let{start:a,value:l}of n.items){let c=le(a,{indicator:"seq-item-ind",next:l,offset:o,onError:i,startOnNewline:!0});if(o=c.end,!c.found)if(c.anchor||c.tag||l)l&&l.type==="block-seq"?i(o,"BAD_INDENT","All sequence items must start at the same column"):i(o,"MISSING_CHAR","Sequence item without - indicator");else{c.comment&&(r.comment=c.comment);continue}let u=l?s(t,l,c,i):e(t,o,a,null,c,i);t.schema.compat&&Nt(n.indent,l,i),o=u.range[2],r.items.push(u)}return r.range=[n.offset,o,o],r}function ce(s,e,t,n){let i="";if(s){let r=!1,o="";for(let a of s){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=l.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=l),r=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}var wn="Block collections are not allowed within flow collections",bn=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Ri({composeNode:s,composeEmptyNode:e},t,n,i){let r=n.start.source==="{",o=r?"flow map":"flow sequence",a=r?new x(t.schema):new q(t.schema);a.flow=!0;let l=t.atRoot;l&&(t.atRoot=!1);let c=n.offset+n.start.source.length;for(let g=0;g<n.items.length;++g){let p=n.items[g],{start:m,key:y,sep:b,value:k}=p,w=le(m,{flow:o,indicator:"explicit-key-ind",next:y||(b==null?void 0:b[0]),offset:c,onError:i,startOnNewline:!1});if(!w.found){if(!w.anchor&&!w.tag&&!b&&!k){g===0&&w.comma?i(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`):g<n.items.length-1&&i(w.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${o}`),w.comment&&(a.comment?a.comment+=`
`+w.comment:a.comment=w.comment),c=w.end;continue}!r&&t.options.strict&&Te(y)&&i(y,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)w.comma&&i(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`);else if(w.comma||i(w.start,"MISSING_CHAR",`Missing , between ${o} items`),w.comment){let S="";e:for(let N of m)switch(N.type){case"comma":case"space":break;case"comment":S=N.source.substring(1);break e;default:break e}if(S){let N=a.items[a.items.length-1];O(N)&&(N=N.value||N.key),N.comment?N.comment+=`
`+S:N.comment=S,w.comment=w.comment.substring(S.length+1)}}if(!r&&!b&&!w.found){let S=k?s(t,k,w,i):e(t,w.end,b,null,w,i);a.items.push(S),c=S.range[2],bn(k)&&i(S.range,"BLOCK_IN_FLOW",wn)}else{let S=w.end,N=y?s(t,y,w,i):e(t,S,m,null,w,i);bn(y)&&i(N.range,"BLOCK_IN_FLOW",wn);let F=le(b||[],{flow:o,indicator:"map-value-ind",next:k,offset:N.range[2],onError:i,startOnNewline:!1});if(F.found){if(!r&&!w.found&&t.options.strict){if(b)for(let ne of b){if(ne===F.found)break;if(ne.type==="newline"){i(ne,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}w.start<F.found.offset-1024&&i(F.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source&&k.source[0]===":"?i(k,"MISSING_CHAR",`Missing space after : in ${o}`):i(F.start,"MISSING_CHAR",`Missing , or : between ${o} items`));let et=k?s(t,k,F,i):F.found?e(t,F.end,b,null,F,i):null;et?bn(k)&&i(et.range,"BLOCK_IN_FLOW",wn):F.comment&&(N.comment?N.comment+=`
`+F.comment:N.comment=F.comment);let Ms=new L(N,et);if(t.options.keepSourceTokens&&(Ms.srcToken=p),r){let ne=a;Cs(t,ne.items,N)&&i(S,"DUPLICATE_KEY","Map keys must be unique"),ne.items.push(Ms)}else{let ne=new x(t.schema);ne.flow=!0,ne.items.push(Ms),a.items.push(ne)}c=et?et.range[2]:F.end}}let u=r?"}":"]",[f,...h]=n.end,d=c;if(f&&f.source===u)d=f.offset+f.source.length;else{let g=o[0].toUpperCase()+o.substring(1),p=l?`${g} must end with a ${u}`:`${g} in block collection must be sufficiently indented and end with a ${u}`;i(c,l?"MISSING_CHAR":"BAD_INDENT",p),f&&f.source.length!==1&&h.unshift(f)}if(h.length>0){let g=ce(h,d,t.options.strict,i);g.comment&&(a.comment?a.comment+=`
`+g.comment:a.comment=g.comment),a.range=[n.offset,d,g.offset]}else a.range=[n.offset,d,d];return a}function qi(s,e,t,n,i){let r;switch(t.type){case"block-map":{r=Di(s,e,t,i);break}case"block-seq":{r=ji(s,e,t,i);break}case"flow-collection":{r=Ri(s,e,t,i);break}}if(!n)return r;let o=e.directives.tagName(n.source,h=>i(n,"TAG_RESOLVE_FAILED",h));if(!o)return r;let a=r.constructor;if(o==="!"||o===a.tagName)return r.tag=a.tagName,r;let l=V(r)?"map":"seq",c=e.schema.tags.find(h=>h.collection===l&&h.tag===o);if(!c){let h=e.schema.knownTags[o];if(h&&h.collection===l)e.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else return i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),r.tag=o,r}let u=c.resolve(r,h=>i(n,"TAG_RESOLVE_FAILED",h),e.options),f=C(u)?u:new v(u);return f.range=r.range,f.tag=o,c!=null&&c.format&&(f.format=c.format),f}function Ts(s,e,t){let n=s.offset,i=ro(s,e,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let r=i.mode===">"?v.BLOCK_FOLDED:v.BLOCK_LITERAL,o=s.source?oo(s.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(!s.source||a===0){let p=i.chomp==="+"?`
`.repeat(Math.max(0,o.length-1)):"",m=n+i.length;return s.source&&(m+=s.source.length),{value:p,type:r,comment:i.comment,range:[n,m,m]}}let l=s.indent+i.indent,c=s.offset+i.length,u=0;for(let p=0;p<a;++p){let[m,y]=o[p];if(y===""||y==="\r")i.indent===0&&m.length>l&&(l=m.length);else{if(m.length<l){let b="Block scalars with more-indented leading empty lines must use an explicit indentation indicator";t(c+m.length,"MISSING_CHAR",b)}i.indent===0&&(l=m.length),u=p;break}c+=m.length+y.length+1}let f="",h="",d=!1;for(let p=0;p<u;++p)f+=o[p][0].slice(l)+`
`;for(let p=u;p<a;++p){let[m,y]=o[p];c+=m.length+y.length+1;let b=y[y.length-1]==="\r";if(b&&(y=y.slice(0,-1)),y&&m.length<l){let w=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;t(c-y.length-(b?2:1),"BAD_INDENT",w),m=""}r===v.BLOCK_LITERAL?(f+=h+m.slice(l)+y,h=`
`):m.length>l||y[0]===" "?(h===" "?h=`
`:!d&&h===`
`&&(h=`
`),f+=h+m.slice(l)+y,h=`
`,d=!0):y===""?h===`
`?f+=`
`:h=`
`:(f+=h+y,h=" ",d=!1)}switch(i.chomp){case"-":break;case"+":for(let p=a;p<o.length;++p)f+=`
`+o[p][0].slice(l);f[f.length-1]!==`
`&&(f+=`
`);break;default:f+=`
`}let g=n+i.length+s.source.length;return{value:f,type:r,comment:i.comment,range:[n,g,g]}}function ro({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],r=i[0],o=0,a="",l=-1;for(let h=1;h<i.length;++h){let d=i[h];if(!a&&(d==="-"||d==="+"))a=d;else{let g=Number(d);!o&&g?o=g:l===-1&&(l=s+h)}}l!==-1&&n(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,u="",f=i.length;for(let h=1;h<e.length;++h){let d=e[h];switch(d.type){case"space":c=!0;case"newline":f+=d.source.length;break;case"comment":t&&!c&&n(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=d.source.length,u=d.source.substring(1);break;case"error":n(d,"UNEXPECTED_TOKEN",d.message),f+=d.source.length;break;default:{let g=`Unexpected token in block scalar header: ${d.type}`;n(d,"UNEXPECTED_TOKEN",g);let p=d.source;p&&typeof p=="string"&&(f+=p.length)}}}return{mode:r,indent:o,chomp:a,comment:u,length:f}}function oo(s){let e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),r=[n&&n[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function As(s,e,t){let{offset:n,type:i,source:r,end:o}=s,a,l,c=(h,d,g)=>t(n+h,d,g);switch(i){case"scalar":a=v.PLAIN,l=ao(r,c);break;case"single-quoted-scalar":a=v.QUOTE_SINGLE,l=lo(r,c);break;case"double-quoted-scalar":a=v.QUOTE_DOUBLE,l=co(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+r.length,n+r.length]}}let u=n+r.length,f=ce(o,u,e,t);return{value:l,type:a,comment:f.comment,range:[n,u,f.offset]}}function ao(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Fi(s)}function lo(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),Fi(s.slice(1,-1)).replace(/''/g,"'")}function Fi(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
`,"sy")}catch(l){e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(s);if(!n)return s;let i=n[1],r=" ",o=e.lastIndex;for(t.lastIndex=o;n=t.exec(s);)n[1]===""?r===`
`?i+=r:r=`
`:(i+=r+n[1],r=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,n=a.exec(s),i+r+(n&&n[1]||"")}function co(s,e){let t="";for(let n=1;n<s.length-1;++n){let i=s[n];if(!(i==="\r"&&s[n+1]===`
`))if(i===`
`){let{fold:r,offset:o}=uo(s,n);t+=r,n=o}else if(i==="\\"){let r=s[++n],o=fo[r];if(o)t+=o;else if(r===`
`)for(r=s[n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="\r"&&s[n+1]===`
`)for(r=s[++n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="x"||r==="u"||r==="U"){let a={x:2,u:4,U:8}[r];t+=ho(s,n+1,a,e),n+=a}else{let a=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(i===" "||i===" "){let r=n,o=s[n+1];for(;o===" "||o===" ";)o=s[++n+1];o!==`
`&&!(o==="\r"&&s[n+2]===`
`)&&(t+=n>r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function uo(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`
`||n==="\r")&&!(n==="\r"&&s[e+2]!==`
`);)n===`
`&&(t+=`
`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}var fo={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ho(s,e,t,n){let i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}function vn(s,e,t,n){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?Ts(e,s.options.strict,n):As(e,s.options.strict,n),l=t?s.directives.tagName(t.source,f=>n(t,"TAG_RESOLVE_FAILED",f)):null,c=t&&l?po(s.schema,i,l,t,n):e.type==="scalar"?mo(s,i,e,n):s.schema[J],u;try{let f=c.resolve(i,h=>n(t||e,"TAG_RESOLVE_FAILED",h),s.options);u=E(f)?f:new v(f)}catch(f){let h=f instanceof Error?f.message:String(f);n(t||e,"TAG_RESOLVE_FAILED",h),u=new v(i)}return u.range=a,u.source=i,r&&(u.type=r),l&&(u.tag=l),c.format&&(u.format=c.format),o&&(u.comment=o),u}function po(s,e,t,n,i){var r;if(t==="!")return s[J];let o=[];for(let l of s.tags)if(!l.collection&&l.tag===t)if(l.default&&l.test)o.push(l);else return l;for(let l of o)if(!((r=l.test)===null||r===void 0)&&r.test(e))return l;let a=s.knownTags[t];return a&&!a.collection?(s.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[J])}function mo({directives:s,schema:e},t,n,i){let r=e.tags.find(o=>{var a;return o.default&&((a=o.test)===null||a===void 0?void 0:a.test(t))})||e[J];if(e.compat){let o=e.compat.find(a=>{var l;return a.default&&((l=a.test)===null||l===void 0?void 0:l.test(t))})||e[J];if(r.tag!==o.tag){let a=s.tagString(r.tag),l=s.tagString(o.tag),c=`Value may be parsed as either ${a} or ${l}`;i(n,"TAG_RESOLVE_FAILED",c,!0)}}return r}function Ki(s,e,t){if(e){t===null&&(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++n];(i==null?void 0:i.type)==="space";)s+=i.source.length,i=e[++n];break}}return s}var go={composeNode:Sn,composeEmptyNode:kn};function Sn(s,e,t,n){let{spaceBefore:i,comment:r,anchor:o,tag:a}=t,l;switch(e.type){case"alias":l=yo(s,e,n),(o||a)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=vn(s,e,a,n),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=qi(go,s,e,a,n),o&&(l.anchor=o.source.substring(1));break;default:throw console.log(e),new Error(`Unsupporten token type: ${e.type}`)}return o&&l.anchor===""&&n(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&(l.spaceBefore=!0),r&&(e.type==="scalar"&&e.source===""?l.comment=r:l.commentBefore=r),s.options.keepSourceTokens&&(l.srcToken=e),l}function kn(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:a},l){let c={type:"scalar",offset:Ki(e,t,n),indent:-1,source:""},u=vn(s,c,a,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),r&&(u.comment=r),u}function yo({options:s},{offset:e,source:t,end:n},i){let r=new me(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string");let o=e+t.length,a=ce(n,o,s.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}function Vi(s,e,{offset:t,start:n,value:i,end:r},o){let a=Object.assign({directives:e},s),l=new ae(void 0,a),c={atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=le(n,{indicator:"doc-start",next:i||(r==null?void 0:r[0]),offset:t,onError:o,startOnNewline:!0});u.found&&(l.directives.marker=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?Sn(c,i,u,o):kn(c,u.end,n,null,u,o);let f=l.contents.range[2],h=ce(r,f,!1,o);return h.comment&&(l.comment=h.comment),l.range=[t,f,h.offset],l}function Ct(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Ui(s){var e;let t="",n=!1,i=!1;for(let r=0;r<s.length;++r){let o=s[r];switch(o[0]){case"#":t+=(t===""?"":i?`
`:`
`)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":((e=s[r+1])===null||e===void 0?void 0:e[0])!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}var Tt=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,i,r)=>{let o=Ct(t);r?this.warnings.push(new Ot(o,n,i)):this.errors.push(new W(o,n,i))},this.directives=new _({version:e.version||gt.version}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:i}=Ui(this.prelude);if(n){let r=e.contents;if(t)e.comment=e.comment?`${e.comment}
${n}`:n;else if(i||e.directives.marker||!r)e.commentBefore=n;else if(T(r)&&!r.flow&&r.items.length>0){let o=r.items[0];O(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${n}
${a}`:n}else{let o=r.commentBefore;r.commentBefore=o?`${n}
${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Ui(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{let r=Ct(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Vi(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.marker&&this.onError(e,"MISSING_CHAR","Missing directives-end indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new W(Ct(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new W(Ct(e),"UNEXPECTED_TOKEN",n));break}let t=ce(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new W(Ct(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({directives:this.directives},this.options),i=new ae(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}};var _t={};_n(_t,{BOM:()=>At,DOCUMENT:()=>Lt,FLOW_END:()=>It,SCALAR:()=>Xe,createScalarToken:()=>Wi,isCollection:()=>vo,isScalar:()=>So,prettyToken:()=>ko,resolveAsScalar:()=>Ji,setScalarValue:()=>Gi,stringify:()=>Qi,tokenType:()=>Nn,visit:()=>Ae});function Ji(s,e=!0,t){if(s){let n=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(a,r,o);else throw new W([a,a+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return As(s,e,n);case"block-scalar":return Ts(s,e,n)}}return null}function Wi(s,e){var t;let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:o=-1,type:a="PLAIN"}=e,l=we({type:a,value:s},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=(t=e.end)!==null&&t!==void 0?t:[{type:"newline",offset:-1,indent:i,source:`
`}];switch(l[0]){case"|":case">":{let u=l.indexOf(`
`),f=l.substring(0,u),h=l.substring(u+1)+`
`,d=[{type:"block-scalar-header",offset:o,indent:i,source:f}];return Yi(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
`}),{type:"block-scalar",offset:o,indent:i,props:d,source:h}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:l,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:l,end:c};default:return{type:"scalar",offset:o,indent:i,source:l,end:c}}}function Gi(s,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,a="indent"in s?s.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=we({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":wo(s,l);break;case'"':En(s,l,"double-quoted-scalar");break;case"'":En(s,l,"single-quoted-scalar");break;default:En(s,l,"scalar")}}function wo(s,e){let t=e.indexOf(`
`),n=e.substring(0,t),i=e.substring(t+1)+`
`;if(s.type==="block-scalar"){let r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=n,s.source=i}else{let{offset:r}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:n}];Yi(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
`});for(let l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:i})}}function Yi(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function En(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let n=s.props.slice(1),i=e.length;s.props[0].type==="block-scalar-header"&&(i-=s.props[0].source.length);for(let r of n)r.offset+=i;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`
`};delete s.items,Object.assign(s,{type:t,source:e,end:[i]});break}default:{let n="indent"in s?s.indent:-1,i="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:n,source:e,end:i})}}}var Qi=s=>"type"in s?Is(s):Ls(s);function Is(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=Is(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=Ls(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=Ls(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=Ls(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function Ls({start:s,key:e,sep:t,value:n}){let i="";for(let r of s)i+=r.source;if(e&&(i+=Is(e)),t)for(let r of t)i+=r.source;return n&&(i+=Is(n)),i}var On=Symbol("break visit"),bo=Symbol("skip children"),Hi=Symbol("remove item");function Ae(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),zi(Object.freeze([]),s,e)}Ae.BREAK=On;Ae.SKIP=bo;Ae.REMOVE=Hi;Ae.itemAtPath=(s,e)=>{let t=s;for(let[n,i]of e){let r=t&&t[n];if(r&&"items"in r)t=r.items[i];else return}return t};Ae.parentCollection=(s,e)=>{let t=Ae.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],i=t&&t[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function zi(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(let i of["key","value"]){let r=e[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=zi(Object.freeze(s.concat([[i,o]])),r.items[o],t);if(typeof a=="number")o=a-1;else{if(a===On)return On;a===Hi&&(r.items.splice(o,1),o-=1)}}typeof n=="function"&&i==="key"&&(n=n(e,s))}}return typeof n=="function"?n(e,s):n}var At="\uFEFF",Lt="",It="",Xe="",vo=s=>!!s&&"items"in s,So=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function ko(s){switch(s){case At:return"<BOM>";case Lt:return"<DOC>";case It:return"<FLOW_END>";case Xe:return"<SCALAR>";default:return JSON.stringify(s)}}function Nn(s){switch(s){case At:return"byte-order-mark";case Lt:return"doc-mode";case It:return"flow-error-end";case Xe:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
`:case`\r
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function G(s){switch(s){case void 0:case" ":case`
`:case"\r":case" ":return!0;default:return!1}}var Xi="0123456789ABCDEFabcdef".split(""),Eo="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""),Zi=",[]{}".split(""),Oo=` ,[]{}
\r `.split(""),Cn=s=>!s||Oo.includes(s),xt=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){e&&(this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null),this.atEnd=!t;let n=this.next||"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
`?!0:t==="\r"?this.buffer[e+1]===`
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let i=this.buffer[n+e+1];if(i===`
`||!i&&!this.atEnd)return e+n+1}return t===`
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&G(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===At&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");if(n!==-1){let r=e[n-1];(r===" "||r===" ")&&(t=n-1)}for(;;){let r=e[t-1];if(r===" "||r===" ")t-=1;else break}let i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield Lt,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if(t==="---"&&G(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"doc";if(t==="..."&&G(this.charAt(3)))return yield*this.pushCount(3),"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!G(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&G(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Cn),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),t=yield*this.pushSpaces(!0),e>0&&(this.indentValue=n=t);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&G(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield It,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Cn),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||G(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),i=n.indexOf(`
`,this.pos);if(i!==-1){for(;i!==-1;){let r=this.continueScalar(i+1);if(r===-1)break;i=n.indexOf(`
`,r)}i!==-1&&(t=i-(n[i-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>G(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`
`:e=i,t=0;break;case"\r":{let r=this.buffer[i+1];if(!r&&!this.atEnd)return this.setNext("block-scalar");if(r===`
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext+=this.blockScalarIndent;do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}if(!this.blockScalarKeep)do{let i=e-1,r=this.buffer[i];for(r==="\r"&&(r=this.buffer[--i]);r===" "||r===" ";)r=this.buffer[--i];if(r===`
`&&i>=this.pos)e=i;else break}while(!0);return yield Xe,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let r=this.buffer[n+1];if(G(r)||e&&r===",")break;t=n}else if(G(i)){let r=this.buffer[n+1];if(i==="\r"&&(r===`
`?(n+=1,i=`
`,r=this.buffer[n+1]):t=n),r==="#"||e&&Zi.includes(r))break;if(i===`
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&Zi.includes(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Xe,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Cn))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case":":case"?":case"-":if(G(this.charAt(1)))return this.flowLevel===0?this.indentNext=this.indentValue+1:this.flowKey&&(this.flowKey=!1),(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!G(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Eo.includes(t))t=this.buffer[++e];else if(t==="%"&&Xi.includes(this.buffer[e+1])&&Xi.includes(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};var Pt=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}};function ue(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Tn(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return!0}return!1}function tr(s){switch(s==null?void 0:s.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function _s(s){switch(s.type){case"document":return s.start;case"block-map":{let e=s.items[s.items.length-1];return e.sep||e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function Mt(s){var e;if(s.length===0)return[];let t=s.length;e:for(;--t>=0;)switch(s[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((e=s[++t])===null||e===void 0?void 0:e.type)==="space";);return s.splice(t,s.length)}function er(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!ue(e.start,"explicit-key-ind")&&!ue(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,tr(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var $t=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new xt,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Nn(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e||this.stack.pop();if(t)if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&er(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!ue(i.start,"explicit-key-ind");return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&!Tn(i.start)&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}), Line truncated
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){var t;let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2],r=(t=i==null?void 0:i.value)===null||t===void 0?void 0:t.end;if(Array.isArray(r)){Array.prototype.push.apply(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent&&(n.sep||Tn(n.start));switch(this.type){case"anchor":case"tag":i||n.value?(e.items.push({start:[this.sourceToken]}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!ue(n.start,"explicit-key-ind")?n.start.push(this.sourceToken):i||n.value?e.items.push({start:[this.sourceToken]}):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(!n.sep)Object.assign(n,{key:null,sep:[this.sourceToken]});else if(n.value||i&&!ue(n.start,"explicit-key-ind"))e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ue(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else if(ue(n.start,"explicit-key-ind")&&tr(n.key)&&!ue(n.sep,"newline")){let r=Mt(n.start),o=n.key,a=n.sep;a.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:o,sep:a}]})}else n.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);i||n.value?(e.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(r):(Object.assign(n,{key:r,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){i&&r.type!=="block-seq"&&ue(n.start,"explicit-key-ind")&&e.items.push({start:[]}),this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var t;let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2],r=(t=i==null?void 0:i.value)===null||t===void 0?void 0:t.end;if(Array.isArray(r)){Array.prototype.push.apply(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||ue(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n&&n.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=_s(n),r=Mt(i);er(e);let o=e Line truncated
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=_s(e),n=Mt(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;let t=_s(e),n=Mt(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function No(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Pt||null,prettyErrors:e}}function An(s,e={}){let{lineCounter:t,prettyErrors:n}=No(e),i=new $t(t==null?void 0:t.addNewLine),r=new Tt(e),o=null;for(let a of r.compose(i.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new W(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(yn(s,t)),o.warnings.forEach(yn(s,t))),o}var xs=class{constructor(e,t,n,i){this.app=e,this.filename=t,this.basename=t.split("/").pop(),this.tagPositions=n,this.hasFrontMatter=!!i}async renamed(e){let t=this.app.vault.getAbstractFileByPath(this.filename),n=await this.app.vault.read(t),i=n;for(let{position:{start:r,end:o},tag:a}of this.tagPositions){if(i.slice(r.offset,o.offset)!==a){let l=`File ${this.filename} has changed; skipping`;new Ln.Notice(l),console.error(l),console.debug(i.slice(r.offset,o.offset),a);return}i=e.inString(i,r.offset)}if(this.hasFrontMatter&&(i=this.replaceInFrontMatter(i,e)),i!==n)return await this.app.vault.modify(t,i),!0}replaceInFrontMatter(e,t){let[n,i]=e.split(/^---\r?$\n?/m,2);if(n.trim()!==""||!i.trim()||!i.endsWith(`
`))return e;let r=An(i,{keepSourceTokens:!0});if(r.errors.length){let u=`YAML issue with ${this.filename}: ${r.errors[0]}`;console.error(u),new Ln.Notice(u+"; skipping frontmatter");return}let o=!1,a=r.toJSON();function l(u,f,h=!1){_t.setScalarValue(u.srcToken,f,{afterKey:h}),o=!0,u.value=f}function c(u,f){let h=r.get(u,!0);if(!h)return;let d=a[u];if(!(!d||!d.length))if(typeof d=="string"){let g=d.split(f?/(^\s+|\s*,\s*|\s+$)/:/([\s,]+)/),p=t.inArray(g,!0,f).join("");d!=p&&l(h,p,!0)}else Array.isArray(d)&&t.inArray(d,!1,f).forEach((g,p)=>{d[p]!==g&&l(h.get(p,!0),g)})}for(let{key:{value:u}}of r.contents.items)/^tags?$/i.test(u)?c(u,!1):/^alias(es)?$/i.test(u)&&c(u,!0);return o?e.replace(i,_t.stringify(r.contents.srcToken)):e}};async function sr(s,e,t=e){let n=await Ao(e,t);if(n===!1)return;if(!n||n===e)return new Le.Notice("Unchanged or empty tag: No changes made.");let i=new A(e),r=new A(n),o=new Zt(i,r),a=o.willMergeTags(To(s).reverse());if(a&&await Lo(a,i,r))return;let c=await In(s,i);if(!c)return;let u=new ct(`Renaming to #${n}/*`,"Processing files..."),f=0;return await u.forEach(c,async h=>{u.message="Processing "+h.basename,await h.renamed(o)&&f++}),new Le.Notice(`Operation ${u.aborted?"cancelled":"complete"}: ${f} file(s) updated`)}function To(s){return Object.keys(s.metadataCache.getTags())}async function In(s,e){let t=[],n=new ct(`Searching for ${e}/*`,"Matching files...");if(await n.forEach(s.metadataCache.getCachedFiles(),i=>{let{frontmatter:r,tags:o}=s.metadataCache.getCache(i)||{};o=(o||[]).filter(c=>c.tag&&e.matches(c.tag)).reverse();let a=((0,Le.parseFrontMatterTags)(r)||[]).filter(e.matches),l=((0,Le.parseFrontMatterAliases)(r)||[]).filter(A.isTag).filter(e.matches);(o.length||a.length||l.length)&&t.push(new xs(s,i,o,a.length+l.length))}),!n.aborted)return t}async function Ao(s,e=s){return await new hi().setTitle(`Renaming #${s} (and any sub-tags)`).setContent(`Enter new name (must be a valid Obsidian tag name):
`).setPattern("[^\u2000-\u206F\u2E00-\u2E7F'!\"#$%&\\(\\)*+,.:;<=>?@^`\\{\\|\\}~\\[\\]\\\\\\s]+").onInvalidEntry(t=>new Le.Notice(`"${t}" is not a valid Obsidian tag name`)).setValue(e).prompt()}async function Lo([s,e],t,n){return!await new Xt().setTitle("WARNING: No Undo!").setContent(activeWindow.createEl("p",void 0,i=>{i.innerHTML=`Renaming <code>${t}</code> to <code>${n}</code> will merge ${s.canonical===t.canonical?"these tags":`multiple tags
into existing tags (such as <code>${s}</code>
merging with <code>${e}</code>)`}.<br><br>
This <b>cannot</b> be undone. Do you wish to proceed?`})).setup(i=>i.okButton.addClass("mod-warning")).confirm()}var nr="tag-wrangler:tag-pane";function ve(s,e,t,n,i){return s.on(e,t,n,i),()=>s.off(e,t,n,i)}var Ps=class extends I.Plugin{constructor(){super(...arguments);Se(this,"use",fi.plugin(this));Se(this,"pageAliases",new Map);Se(this,"tagPages",new Map)}tagPage(t){return Array.from(this.tagPages.get(A.canonical(t))||"")[0]}openTagPage(t,n,i){let r={eState:n?{rename:"all"}:{focus:!0},...n?{state:{mode:"source"}}:{}};return this.app.workspace.getLeaf(i).openFile(t,r)}async createTagPage(t,n){var a;let r={tag:new A(t).canonical,file:void 0};app.workspace.trigger("tag-page:will-create",r);let o=r.file&&await r.file;if(!o){let l=new A(t).name.split("/").join(" "),c=this.app.fileManager.getNewFileParent(((a=this.app.workspace.getActiveFile())==null?void 0:a.path)||""),u=this.app.vault.getAvailablePath(c.getParentPrefix()+l,"md");o=await this.app.vault.create(u,["---",`Aliases: [ ${JSON.stringify(A.toTag(t))} ]`,"---",""].join(`
`))}r.file=o,await this.openTagPage(o,!0,n),app.workspace.trigger("tag-page:did-create",r)}onload(){this.registerEvent(app.workspace.on("editor-menu",(r,o)=>{let a=o.getClickableTokenAt(o.getCursor());(a==null?void 0:a.type)==="tag"&&this.setupMenu(r,a.text)})),this.register(ve(document,"contextmenu",".tag-pane-tag",this.onMenu.bind(this),{capture:!0})),this.app.workspace.registerHoverLinkSource(nr,{display:"Tags View",defaultMod:!0}),this.addChild(new Ze(this,{hoverSource:nr,selector:".tag-pane-tag",container:".tag-container",toTag(r){var o;return(o=r.find(".tag-pane-tag-text, tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text"))==null?void 0:o.textContent}})),this.addChild(new Ze(this,{hoverSource:"preview",selector:'a.tag[href^="#"]',container:".markdown-preview-view, .markdown-embed, .workspace-leaf-content",toTag(r){return r.getAttribute("href")}})),this.addChild(new Ze(this,{hoverSource:"preview",selector:'.metadata-property[data-property-key="tags"] .multi-select-pill',container:".metadata-properties",mergeMenu:!0,toTag(r){return r.textContent}})),this.addChild(new Ze(this,{hoverSource:"editor",selector:"span.cm-hashtag",container:".markdown-source-view",toTag(r){let o=r.textContent;if(!r.matches(".cm-formatting"))for(let a=r.previousElementSibling;a!=null&&a.matches("span.cm-hashtag:not(.cm-formatting)");a=a.previousElementSibling)o=a.textContent+o;for(let a=r.nextElementSibling;a!=null&&a.matches("span.cm-hashtag:not(.cm-formatting)");a=a.nextElementSibling)o+=a.textContent;return o}})),this.register(ve(document,"pointerdown",".tag-pane-tag",(r,o)=>{o.draggable="true"},{capture:!0})),this.register(ve(document,"dragstart",".tag-pane-tag",(r,o)=>{var c;let a=(c=o.find(".tag-pane-tag-text, tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text"))==null?void 0:c.textContent;r.dataTransfer.setData("text/plain","#"+a),app.dragManager.onDragStart(r,{source:"tag-wrangler",type:"text",title:a,icon:"hashtag"}),window.addEventListener("dragend",l,!0),window.addEventListener("drop",l,!0);function l(){app.dragManager.draggable=null,window.removeEventListener("dragend",l,!0),window.removeEventListener("drop",l,!0)}},{capture:!1}));let t=(r,o,a=app.dragManager.draggable,l)=>{var f;if((a==null?void 0:a.source)!=="tag-wrangler"||r.defaultPrevented)return;let c=(f=o.find(".tag-pane-tag-text, tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text"))==null?void 0:f.textContent,u=c+"/"+A.toName(a.title).split("/").pop();A.canonical(c)!==A.canonical(a.title)&&(r.dataTransfer.dropEffect="move",r.preventDefault(),l?this.rename(A.toName(a.title),u):(app.dragManager.updateHover(o,"is-being-dragged-over"),app.dragManager.setAction(`Rename to ${u}`)))};this.register(ve(document.body,"dragover",".tag-pane-tag.tree-item-self",t,{capture:!0})),this.register(ve(document.body,"dragenter",".tag-pane-tag.tree-item-self",t,{capture:!0})),this.registerDomEvent(window,"drop",r=>{var l;let o=(l=r.target)==null?void 0:l.matchParent(".tag-pane-tag.tree-item-self",r.currentTarget);if(!o)return;let a=app.dragManager.draggable;a&&!r.defaultPrevented&&t(r,o,a,!0)},{capture:!0});let n=this.app.metadataCache,i=this;this.register(lt(n,{getTags(r){return function(){let a=r.call(this),l=new Set(Object.keys(a).map(c=>c.toLowerCase()));for(let c of i.tagPages.keys())l.has(c)||(a[i.tagPages.get(c).tag]=0);return a}}})),this.app.workspace.onLayoutReady(()=>{n.getCachedFiles().forEach(r=>{var a,l;let o=(a=n.getCache(r))==null?void 0:a.frontmatter;o&&((l=(0,I.parseFrontMatterAliases)(o))!=null&&l.filter(A.isTag))&&this.updatePage(this.app.vault.getAbstractFileByPath(r),o)}),this.registerEvent(n.on("changed",(r,o,a)=>this.updatePage(r,a==null?void 0:a.frontmatter))),this.registerEvent(this.app.vault.on("delete",r=>this.updatePage(r))),app.workspace.getLeavesOfType("tag").forEach(r=>{var o,a;(a=(o=r==null?void 0:r.view)==null?void 0:o.requestUpdateTags)==null||a.call(o)})})}updatePage(t,n){var r;let i=((r=(0,I.parseFrontMatterAliases)(n))==null?void 0:r.filter(A.isTag))||[];if(this.pageAliases.has(t)){let o=new Set(i||[]);for(let a of this.pageAliases.get(t)){if(o.has(a))continue;let l=A.canonical(a),c=this.tagPages.get(l);c&&(c.delete(t),c.size||this.tagPages.delete(l))}i.length||this.pageAliases.delete(t)}if(i.length){this.pageAliases.set(t,i);for(let o of i){let a=A.canonical(o);if(this.tagPages.has(a))this.tagPages.get(a).add(t);else{let l=new Set([t]);l.tag=A.toTag(o),this.tagPages.set(a,l)}}}}onMenu(t,n){let i=ir(t),r=n.find(".tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text").textContent,o=n.parentElement.parentElement.find(".collapse-icon");if(this.setupMenu(i,r,o),o){let u=function(f){var h;for(let d of(h=c.children)!=null?h:c.vChildren.children)d.setCollapsed(f)},a=r.split("/").slice(0,-1).join("/"),l=this.leafView(n.matchParent(".workspace-leaf")),c=a?l.tagDoms["#"+a.toLowerCase()]:l.root;i.addItem(be("tag-hierarchy","vertical-three-dots","Collapse tags at this level",()=>u(!0))).addItem(be("tag-hierarchy","expand-vertically","Expand Line truncated
/* nosourcemap */
+11
View File
@@ -0,0 +1,11 @@
{
"id": "tag-wrangler",
"name": "Tag Wrangler",
"author": "PJ Eby",
"authorUrl": "https://github.com/pjeby",
"version": "0.6.4",
"minAppVersion": "1.5.8",
"description": "Rename, merge, toggle, and search tags from the tags view",
"fundingUrl": "https://dirtsimple.org/tips/tag-wrangler",
"isDesktopOnly": false
}