/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __esm = (fn3, res) => function __init() {
return fn3 && (res = (0, fn3[__getOwnPropNames(fn3)[0]])(fn3 = 0)), res;
};
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
// src/types/plugin-settings_0_5_0.ts
var DEFAULT_PLUGIN_SETTINGS_0_5_0;
var init_plugin_settings_0_5_0 = __esm({
"src/types/plugin-settings_0_5_0.ts"() {
DEFAULT_PLUGIN_SETTINGS_0_5_0 = {
settingsVersion: "0.5.0",
onboardingTips: {
welcomeTipRead: false,
strokeLimitTipRead: false,
lastVersionTipRead: ""
},
gettingStartedExpanded: true,
customAttachmentFolders: false,
noteAttachmentFolderLocation: "obsidian",
notelessAttachmentFolderLocation: "obsidian",
writingSubfolder: "Ink/Writing",
drawingSubfolder: "Ink/Drawing",
debugLoggingEnabled: false,
dominantHand: "right",
writingEnabled: true,
writingStrokeLimit: 200,
writingBufferLines: 3,
writingLineHeight: 150,
writingDynamicStrokeThickness: true,
writingSmoothing: false,
writingLinesWhenLocked: true,
writingBackgroundWhenLocked: true,
drawingEnabled: true,
drawingGridEnabledByDefault: true,
drawingFrameWhenLocked: false,
drawingBackgroundWhenLocked: false
};
}
});
// src/types/types-map.ts
var DEFAULT_SETTINGS;
var init_types_map = __esm({
"src/types/types-map.ts"() {
init_plugin_settings_0_5_0();
DEFAULT_SETTINGS = DEFAULT_PLUGIN_SETTINGS_0_5_0;
}
});
// src/types/plugin-settings.ts
var init_plugin_settings = __esm({
"src/types/plugin-settings.ts"() {
init_types_map();
}
});
// src/components/dom-components/modals/confirmation-modal/confirmation-modal.ts
var import_obsidian2, ConfirmationModal;
var init_confirmation_modal = __esm({
"src/components/dom-components/modals/confirmation-modal/confirmation-modal.ts"() {
import_obsidian2 = require("obsidian");
ConfirmationModal = class extends import_obsidian2.Modal {
constructor(options) {
super(options.plugin.app);
this.title = "Confirmation";
this.message = "Are you sure?";
this.cancelLabel = "Cancel";
this.cancelAction = () => {
};
this.confirmLabel = "Yes";
this.title = options.title || this.title;
this.message = options.message || this.message;
this.cancelLabel = options.cancelLabel || this.cancelLabel;
this.confirmLabel = options.confirmLabel || this.confirmLabel;
this.cancelAction = options.cancelAction || this.cancelAction;
this.confirmAction = options.confirmAction;
}
onOpen() {
const { titleEl, contentEl } = this;
titleEl.setText(this.title);
contentEl.createEl("p", { text: this.message });
new import_obsidian2.Setting(contentEl).addButton((cancelBtn) => {
cancelBtn.setClass("uo_button");
cancelBtn.setButtonText(this.cancelLabel);
cancelBtn.onClick(() => {
this.close();
this.cancelAction();
});
}).addButton((confirmBtn) => {
confirmBtn.setClass("uo_button");
confirmBtn.setWarning();
confirmBtn.setButtonText(this.confirmLabel);
confirmBtn.onClick(() => {
this.close();
this.confirmAction();
});
});
}
onClose() {
const { titleEl, contentEl } = this;
titleEl.empty();
contentEl.empty();
}
};
}
});
// src/components/dom-components/notice-components.scss
var init_ = __esm({
"src/components/dom-components/notice-components.scss"() {
}
});
// src/components/dom-components/notice-components.ts
function createNoticeTemplate(noticeNumber, noticeTotal) {
const noticeBody = activeDocument.createDocumentFragment();
const scrollAreaEl = noticeBody.createDiv("ddc_ink_notice-scroll");
createNoticeLabel(scrollAreaEl, noticeNumber, noticeTotal);
const footerEl = noticeBody.createDiv("ddc_ink_notice-footer");
return {
noticeBody,
scrollAreaEl,
footerEl
};
}
function launchPersistentNotice(noticeBody) {
const notice = new import_obsidian3.Notice(noticeBody, 0);
notice.noticeEl.classList.add("ddc_ink_notice");
wireNoticePointerHandling(notice.noticeEl);
return notice;
}
function wireNoticePointerHandling(noticeContentEl) {
noticeContentEl.querySelector(".ddc_ink_notice-scroll")?.addEventListener("click", (event) => {
event.stopPropagation();
});
noticeContentEl.querySelector(".ddc_ink_notice-footer")?.addEventListener("click", (event) => {
if (event.target instanceof HTMLElement && event.target.closest("a, button")) {
return;
}
event.stopPropagation();
});
}
function createNoticeLabel(noticeParent, noticeNumber, noticeTotal) {
const labelEl = noticeParent.createEl("p");
let labelText = `Ink plugin`;
labelEl.setText(labelText);
labelEl.classList.add("ddc_ink_notice-label");
return labelEl;
}
function createNoticeInlineQuote(parentEl, text) {
return parentEl.createEl("q", {
cls: "ddc_ink_notice-inline-quote",
text
});
}
function createNoticeCtaBar(footerEl, props) {
let primaryBtnEl = null;
let tertiaryBtnEl = null;
const footerLinkEls = [];
const links = props.footerLinks ?? (props.footerLink ? [props.footerLink] : []);
if (links.length > 0) {
const footerLinksEl = footerEl.createDiv("ddc_ink_notice-footer-links");
for (const link of links) {
const footerLinkEl = footerLinksEl.createEl("a");
footerLinkEl.setAttribute("href", link.href);
footerLinkEl.setText(link.label);
footerLinkEl.onClickEvent((event) => event.stopPropagation());
footerLinkEls.push(footerLinkEl);
}
}
const ctaBarEl = footerEl.createDiv("ddc_ink_notice-cta-bar");
if (props.primaryLabel) {
primaryBtnEl = ctaBarEl.createEl("button");
primaryBtnEl.setText(props.primaryLabel);
primaryBtnEl.classList.add("ddc_ink_primary-btn");
}
if (props.tertiaryLabel) {
tertiaryBtnEl = ctaBarEl.createEl("button");
tertiaryBtnEl.setText(props.tertiaryLabel);
tertiaryBtnEl.classList.add("ddc_ink_tertiary-btn");
}
return {
ctaBarEl,
primaryBtnEl,
tertiaryBtnEl,
footerLinkEls
};
}
var import_obsidian3;
var init_notice_components = __esm({
"src/components/dom-components/notice-components.ts"() {
init_();
import_obsidian3 = require("obsidian");
}
});
// node_modules/semver/internal/constants.js
var require_constants = __commonJS({
"node_modules/semver/internal/constants.js"(exports, module2) {
"use strict";
var SEMVER_SPEC_VERSION = "2.0.0";
var MAX_LENGTH = 256;
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
var MAX_SAFE_COMPONENT_LENGTH = 16;
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
var RELEASE_TYPES = [
"major",
"premajor",
"minor",
"preminor",
"patch",
"prepatch",
"prerelease"
];
module2.exports = {
MAX_LENGTH,
MAX_SAFE_COMPONENT_LENGTH,
MAX_SAFE_BUILD_LENGTH,
MAX_SAFE_INTEGER,
RELEASE_TYPES,
SEMVER_SPEC_VERSION,
FLAG_INCLUDE_PRERELEASE: 1,
FLAG_LOOSE: 2
};
}
});
// node_modules/semver/internal/debug.js
var require_debug = __commonJS({
"node_modules/semver/internal/debug.js"(exports, module2) {
"use strict";
var debug2 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
};
module2.exports = debug2;
}
});
// node_modules/semver/internal/re.js
var require_re = __commonJS({
"node_modules/semver/internal/re.js"(exports, module2) {
"use strict";
var {
MAX_SAFE_COMPONENT_LENGTH,
MAX_SAFE_BUILD_LENGTH,
MAX_LENGTH
} = require_constants();
var debug2 = require_debug();
exports = module2.exports = {};
var re2 = exports.re = [];
var safeRe = exports.safeRe = [];
var src = exports.src = [];
var safeSrc = exports.safeSrc = [];
var t3 = exports.t = {};
var R2 = 0;
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
var safeRegexReplacements = [
["\\s", 1],
["\\d", MAX_LENGTH],
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
];
var makeSafeRegex = (value) => {
for (const [token, max3] of safeRegexReplacements) {
value = value.split(`${token}*`).join(`${token}{0,${max3}}`).split(`${token}+`).join(`${token}{1,${max3}}`);
}
return value;
};
var createToken = (name, value, isGlobal) => {
const safe = makeSafeRegex(value);
const index3 = R2++;
debug2(name, index3, value);
t3[name] = index3;
src[index3] = value;
safeSrc[index3] = safe;
re2[index3] = new RegExp(value, isGlobal ? "g" : void 0);
safeRe[index3] = new RegExp(safe, isGlobal ? "g" : void 0);
};
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
createToken("MAINVERSION", `(${src[t3.NUMERICIDENTIFIER]})\\.(${src[t3.NUMERICIDENTIFIER]})\\.(${src[t3.NUMERICIDENTIFIER]})`);
createToken("MAINVERSIONLOOSE", `(${src[t3.NUMERICIDENTIFIERLOOSE]})\\.(${src[t3.NUMERICIDENTIFIERLOOSE]})\\.(${src[t3.NUMERICIDENTIFIERLOOSE]})`);
createToken("PRERELEASEIDENTIFIER", `(?:${src[t3.NONNUMERICIDENTIFIER]}|${src[t3.NUMERICIDENTIFIER]})`);
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t3.NONNUMERICIDENTIFIER]}|${src[t3.NUMERICIDENTIFIERLOOSE]})`);
createToken("PRERELEASE", `(?:-(${src[t3.PRERELEASEIDENTIFIER]}(?:\\.${src[t3.PRERELEASEIDENTIFIER]})*))`);
createToken("PRERELEASELOOSE", `(?:-?(${src[t3.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t3.PRERELEASEIDENTIFIERLOOSE]})*))`);
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
createToken("BUILD", `(?:\\+(${src[t3.BUILDIDENTIFIER]}(?:\\.${src[t3.BUILDIDENTIFIER]})*))`);
createToken("FULLPLAIN", `v?${src[t3.MAINVERSION]}${src[t3.PRERELEASE]}?${src[t3.BUILD]}?`);
createToken("FULL", `^${src[t3.FULLPLAIN]}$`);
createToken("LOOSEPLAIN", `[v=\\s]*${src[t3.MAINVERSIONLOOSE]}${src[t3.PRERELEASELOOSE]}?${src[t3.BUILD]}?`);
createToken("LOOSE", `^${src[t3.LOOSEPLAIN]}$`);
createToken("GTLT", "((?:<|>)?=?)");
createToken("XRANGEIDENTIFIERLOOSE", `${src[t3.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
createToken("XRANGEIDENTIFIER", `${src[t3.NUMERICIDENTIFIER]}|x|X|\\*`);
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t3.XRANGEIDENTIFIER]})(?:\\.(${src[t3.XRANGEIDENTIFIER]})(?:\\.(${src[t3.XRANGEIDENTIFIER]})(?:${src[t3.PRERELEASE]})?${src[t3.BUILD]}?)?)?`);
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t3.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t3.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t3.XRANGEIDENTIFIERLOOSE]})(?:${src[t3.PRERELEASELOOSE]})?${src[t3.BUILD]}?)?)?`);
createToken("XRANGE", `^${src[t3.GTLT]}\\s*${src[t3.XRANGEPLAIN]}$`);
createToken("XRANGELOOSE", `^${src[t3.GTLT]}\\s*${src[t3.XRANGEPLAINLOOSE]}$`);
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
createToken("COERCE", `${src[t3.COERCEPLAIN]}(?:$|[^\\d])`);
createToken("COERCEFULL", src[t3.COERCEPLAIN] + `(?:${src[t3.PRERELEASE]})?(?:${src[t3.BUILD]})?(?:$|[^\\d])`);
createToken("COERCERTL", src[t3.COERCE], true);
createToken("COERCERTLFULL", src[t3.COERCEFULL], true);
createToken("LONETILDE", "(?:~>?)");
createToken("TILDETRIM", `(\\s*)${src[t3.LONETILDE]}\\s+`, true);
exports.tildeTrimReplace = "$1~";
createToken("TILDE", `^${src[t3.LONETILDE]}${src[t3.XRANGEPLAIN]}$`);
createToken("TILDELOOSE", `^${src[t3.LONETILDE]}${src[t3.XRANGEPLAINLOOSE]}$`);
createToken("LONECARET", "(?:\\^)");
createToken("CARETTRIM", `(\\s*)${src[t3.LONECARET]}\\s+`, true);
exports.caretTrimReplace = "$1^";
createToken("CARET", `^${src[t3.LONECARET]}${src[t3.XRANGEPLAIN]}$`);
createToken("CARETLOOSE", `^${src[t3.LONECARET]}${src[t3.XRANGEPLAINLOOSE]}$`);
createToken("COMPARATORLOOSE", `^${src[t3.GTLT]}\\s*(${src[t3.LOOSEPLAIN]})$|^$`);
createToken("COMPARATOR", `^${src[t3.GTLT]}\\s*(${src[t3.FULLPLAIN]})$|^$`);
createToken("COMPARATORTRIM", `(\\s*)${src[t3.GTLT]}\\s*(${src[t3.LOOSEPLAIN]}|${src[t3.XRANGEPLAIN]})`, true);
exports.comparatorTrimReplace = "$1$2$3";
createToken("HYPHENRANGE", `^\\s*(${src[t3.XRANGEPLAIN]})\\s+-\\s+(${src[t3.XRANGEPLAIN]})\\s*$`);
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t3.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t3.XRANGEPLAINLOOSE]})\\s*$`);
createToken("STAR", "(<|>)?=?\\s*\\*");
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
}
});
// node_modules/semver/internal/parse-options.js
var require_parse_options = __commonJS({
"node_modules/semver/internal/parse-options.js"(exports, module2) {
"use strict";
var looseOption = Object.freeze({ loose: true });
var emptyOpts = Object.freeze({});
var parseOptions = (options) => {
if (!options) {
return emptyOpts;
}
if (typeof options !== "object") {
return looseOption;
}
return options;
};
module2.exports = parseOptions;
}
});
// node_modules/semver/internal/identifiers.js
var require_identifiers = __commonJS({
"node_modules/semver/internal/identifiers.js"(exports, module2) {
"use strict";
var numeric = /^[0-9]+$/;
var compareIdentifiers = (a2, b2) => {
if (typeof a2 === "number" && typeof b2 === "number") {
return a2 === b2 ? 0 : a2 < b2 ? -1 : 1;
}
const anum = numeric.test(a2);
const bnum = numeric.test(b2);
if (anum && bnum) {
a2 = +a2;
b2 = +b2;
}
return a2 === b2 ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a2 < b2 ? -1 : 1;
};
var rcompareIdentifiers = (a2, b2) => compareIdentifiers(b2, a2);
module2.exports = {
compareIdentifiers,
rcompareIdentifiers
};
}
});
// node_modules/semver/classes/semver.js
var require_semver = __commonJS({
"node_modules/semver/classes/semver.js"(exports, module2) {
"use strict";
var debug2 = require_debug();
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
var { safeRe: re2, t: t3 } = require_re();
var parseOptions = require_parse_options();
var { compareIdentifiers } = require_identifiers();
var SemVer = class {
constructor(version2, options) {
options = parseOptions(options);
if (version2 instanceof SemVer) {
if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
return version2;
} else {
version2 = version2.version;
}
} else if (typeof version2 !== "string") {
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`);
}
if (version2.length > MAX_LENGTH) {
throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
}
debug2("SemVer", version2, options);
this.options = options;
this.loose = !!options.loose;
this.includePrerelease = !!options.includePrerelease;
const m2 = version2.trim().match(options.loose ? re2[t3.LOOSE] : re2[t3.FULL]);
if (!m2) {
throw new TypeError(`Invalid Version: ${version2}`);
}
this.raw = version2;
this.major = +m2[1];
this.minor = +m2[2];
this.patch = +m2[3];
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
throw new TypeError("Invalid major version");
}
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
throw new TypeError("Invalid minor version");
}
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
throw new TypeError("Invalid patch version");
}
if (!m2[4]) {
this.prerelease = [];
} else {
this.prerelease = m2[4].split(".").map((id) => {
if (/^[0-9]+$/.test(id)) {
const num = +id;
if (num >= 0 && num < MAX_SAFE_INTEGER) {
return num;
}
}
return id;
});
}
this.build = m2[5] ? m2[5].split(".") : [];
this.format();
}
format() {
this.version = `${this.major}.${this.minor}.${this.patch}`;
if (this.prerelease.length) {
this.version += `-${this.prerelease.join(".")}`;
}
return this.version;
}
toString() {
return this.version;
}
compare(other) {
debug2("SemVer.compare", this.version, this.options, other);
if (!(other instanceof SemVer)) {
if (typeof other === "string" && other === this.version) {
return 0;
}
other = new SemVer(other, this.options);
}
if (other.version === this.version) {
return 0;
}
return this.compareMain(other) || this.comparePre(other);
}
compareMain(other) {
if (!(other instanceof SemVer)) {
other = new SemVer(other, this.options);
}
if (this.major < other.major) {
return -1;
}
if (this.major > other.major) {
return 1;
}
if (this.minor < other.minor) {
return -1;
}
if (this.minor > other.minor) {
return 1;
}
if (this.patch < other.patch) {
return -1;
}
if (this.patch > other.patch) {
return 1;
}
return 0;
}
comparePre(other) {
if (!(other instanceof SemVer)) {
other = new SemVer(other, this.options);
}
if (this.prerelease.length && !other.prerelease.length) {
return -1;
} else if (!this.prerelease.length && other.prerelease.length) {
return 1;
} else if (!this.prerelease.length && !other.prerelease.length) {
return 0;
}
let i2 = 0;
do {
const a2 = this.prerelease[i2];
const b2 = other.prerelease[i2];
debug2("prerelease compare", i2, a2, b2);
if (a2 === void 0 && b2 === void 0) {
return 0;
} else if (b2 === void 0) {
return 1;
} else if (a2 === void 0) {
return -1;
} else if (a2 === b2) {
continue;
} else {
return compareIdentifiers(a2, b2);
}
} while (++i2);
}
compareBuild(other) {
if (!(other instanceof SemVer)) {
other = new SemVer(other, this.options);
}
let i2 = 0;
do {
const a2 = this.build[i2];
const b2 = other.build[i2];
debug2("build compare", i2, a2, b2);
if (a2 === void 0 && b2 === void 0) {
return 0;
} else if (b2 === void 0) {
return 1;
} else if (a2 === void 0) {
return -1;
} else if (a2 === b2) {
continue;
} else {
return compareIdentifiers(a2, b2);
}
} while (++i2);
}
inc(release, identifier, identifierBase) {
if (release.startsWith("pre")) {
if (!identifier && identifierBase === false) {
throw new Error("invalid increment argument: identifier is empty");
}
if (identifier) {
const match = `-${identifier}`.match(this.options.loose ? re2[t3.PRERELEASELOOSE] : re2[t3.PRERELEASE]);
if (!match || match[1] !== identifier) {
throw new Error(`invalid identifier: ${identifier}`);
}
}
}
switch (release) {
case "premajor":
this.prerelease.length = 0;
this.patch = 0;
this.minor = 0;
this.major++;
this.inc("pre", identifier, identifierBase);
break;
case "preminor":
this.prerelease.length = 0;
this.patch = 0;
this.minor++;
this.inc("pre", identifier, identifierBase);
break;
case "prepatch":
this.prerelease.length = 0;
this.inc("patch", identifier, identifierBase);
this.inc("pre", identifier, identifierBase);
break;
case "prerelease":
if (this.prerelease.length === 0) {
this.inc("patch", identifier, identifierBase);
}
this.inc("pre", identifier, identifierBase);
break;
case "release":
if (this.prerelease.length === 0) {
throw new Error(`version ${this.raw} is not a prerelease`);
}
this.prerelease.length = 0;
break;
case "major":
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
this.major++;
}
this.minor = 0;
this.patch = 0;
this.prerelease = [];
break;
case "minor":
if (this.patch !== 0 || this.prerelease.length === 0) {
this.minor++;
}
this.patch = 0;
this.prerelease = [];
break;
case "patch":
if (this.prerelease.length === 0) {
this.patch++;
}
this.prerelease = [];
break;
case "pre": {
const base = Number(identifierBase) ? 1 : 0;
if (this.prerelease.length === 0) {
this.prerelease = [base];
} else {
let i2 = this.prerelease.length;
while (--i2 >= 0) {
if (typeof this.prerelease[i2] === "number") {
this.prerelease[i2]++;
i2 = -2;
}
}
if (i2 === -1) {
if (identifier === this.prerelease.join(".") && identifierBase === false) {
throw new Error("invalid increment argument: identifier already exists");
}
this.prerelease.push(base);
}
}
if (identifier) {
let prerelease = [identifier, base];
if (identifierBase === false) {
prerelease = [identifier];
}
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
if (isNaN(this.prerelease[1])) {
this.prerelease = prerelease;
}
} else {
this.prerelease = prerelease;
}
}
break;
}
default:
throw new Error(`invalid increment argument: ${release}`);
}
this.raw = this.format();
if (this.build.length) {
this.raw += `+${this.build.join(".")}`;
}
return this;
}
};
module2.exports = SemVer;
}
});
// node_modules/semver/functions/parse.js
var require_parse = __commonJS({
"node_modules/semver/functions/parse.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var parse2 = (version2, options, throwErrors = false) => {
if (version2 instanceof SemVer) {
return version2;
}
try {
return new SemVer(version2, options);
} catch (er) {
if (!throwErrors) {
return null;
}
throw er;
}
};
module2.exports = parse2;
}
});
// node_modules/semver/functions/valid.js
var require_valid = __commonJS({
"node_modules/semver/functions/valid.js"(exports, module2) {
"use strict";
var parse2 = require_parse();
var valid2 = (version2, options) => {
const v2 = parse2(version2, options);
return v2 ? v2.version : null;
};
module2.exports = valid2;
}
});
// node_modules/semver/functions/clean.js
var require_clean = __commonJS({
"node_modules/semver/functions/clean.js"(exports, module2) {
"use strict";
var parse2 = require_parse();
var clean = (version2, options) => {
const s2 = parse2(version2.trim().replace(/^[=v]+/, ""), options);
return s2 ? s2.version : null;
};
module2.exports = clean;
}
});
// node_modules/semver/functions/inc.js
var require_inc = __commonJS({
"node_modules/semver/functions/inc.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var inc = (version2, release, options, identifier, identifierBase) => {
if (typeof options === "string") {
identifierBase = identifier;
identifier = options;
options = void 0;
}
try {
return new SemVer(version2 instanceof SemVer ? version2.version : version2, options).inc(release, identifier, identifierBase).version;
} catch (er) {
return null;
}
};
module2.exports = inc;
}
});
// node_modules/semver/functions/diff.js
var require_diff = __commonJS({
"node_modules/semver/functions/diff.js"(exports, module2) {
"use strict";
var parse2 = require_parse();
var diff = (version1, version2) => {
const v1 = parse2(version1, null, true);
const v2 = parse2(version2, null, true);
const comparison = v1.compare(v2);
if (comparison === 0) {
return null;
}
const v1Higher = comparison > 0;
const highVersion = v1Higher ? v1 : v2;
const lowVersion = v1Higher ? v2 : v1;
const highHasPre = !!highVersion.prerelease.length;
const lowHasPre = !!lowVersion.prerelease.length;
if (lowHasPre && !highHasPre) {
if (!lowVersion.patch && !lowVersion.minor) {
return "major";
}
if (lowVersion.compareMain(highVersion) === 0) {
if (lowVersion.minor && !lowVersion.patch) {
return "minor";
}
return "patch";
}
}
const prefix = highHasPre ? "pre" : "";
if (v1.major !== v2.major) {
return prefix + "major";
}
if (v1.minor !== v2.minor) {
return prefix + "minor";
}
if (v1.patch !== v2.patch) {
return prefix + "patch";
}
return "prerelease";
};
module2.exports = diff;
}
});
// node_modules/semver/functions/major.js
var require_major = __commonJS({
"node_modules/semver/functions/major.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var major = (a2, loose) => new SemVer(a2, loose).major;
module2.exports = major;
}
});
// node_modules/semver/functions/minor.js
var require_minor = __commonJS({
"node_modules/semver/functions/minor.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var minor = (a2, loose) => new SemVer(a2, loose).minor;
module2.exports = minor;
}
});
// node_modules/semver/functions/patch.js
var require_patch = __commonJS({
"node_modules/semver/functions/patch.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var patch = (a2, loose) => new SemVer(a2, loose).patch;
module2.exports = patch;
}
});
// node_modules/semver/functions/prerelease.js
var require_prerelease = __commonJS({
"node_modules/semver/functions/prerelease.js"(exports, module2) {
"use strict";
var parse2 = require_parse();
var prerelease = (version2, options) => {
const parsed = parse2(version2, options);
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
};
module2.exports = prerelease;
}
});
// node_modules/semver/functions/compare.js
var require_compare = __commonJS({
"node_modules/semver/functions/compare.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var compare = (a2, b2, loose) => new SemVer(a2, loose).compare(new SemVer(b2, loose));
module2.exports = compare;
}
});
// node_modules/semver/functions/rcompare.js
var require_rcompare = __commonJS({
"node_modules/semver/functions/rcompare.js"(exports, module2) {
"use strict";
var compare = require_compare();
var rcompare = (a2, b2, loose) => compare(b2, a2, loose);
module2.exports = rcompare;
}
});
// node_modules/semver/functions/compare-loose.js
var require_compare_loose = __commonJS({
"node_modules/semver/functions/compare-loose.js"(exports, module2) {
"use strict";
var compare = require_compare();
var compareLoose = (a2, b2) => compare(a2, b2, true);
module2.exports = compareLoose;
}
});
// node_modules/semver/functions/compare-build.js
var require_compare_build = __commonJS({
"node_modules/semver/functions/compare-build.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var compareBuild = (a2, b2, loose) => {
const versionA = new SemVer(a2, loose);
const versionB = new SemVer(b2, loose);
return versionA.compare(versionB) || versionA.compareBuild(versionB);
};
module2.exports = compareBuild;
}
});
// node_modules/semver/functions/sort.js
var require_sort = __commonJS({
"node_modules/semver/functions/sort.js"(exports, module2) {
"use strict";
var compareBuild = require_compare_build();
var sort = (list, loose) => list.sort((a2, b2) => compareBuild(a2, b2, loose));
module2.exports = sort;
}
});
// node_modules/semver/functions/rsort.js
var require_rsort = __commonJS({
"node_modules/semver/functions/rsort.js"(exports, module2) {
"use strict";
var compareBuild = require_compare_build();
var rsort = (list, loose) => list.sort((a2, b2) => compareBuild(b2, a2, loose));
module2.exports = rsort;
}
});
// node_modules/semver/functions/gt.js
var require_gt = __commonJS({
"node_modules/semver/functions/gt.js"(exports, module2) {
"use strict";
var compare = require_compare();
var gt2 = (a2, b2, loose) => compare(a2, b2, loose) > 0;
module2.exports = gt2;
}
});
// node_modules/semver/functions/lt.js
var require_lt = __commonJS({
"node_modules/semver/functions/lt.js"(exports, module2) {
"use strict";
var compare = require_compare();
var lt = (a2, b2, loose) => compare(a2, b2, loose) < 0;
module2.exports = lt;
}
});
// node_modules/semver/functions/eq.js
var require_eq = __commonJS({
"node_modules/semver/functions/eq.js"(exports, module2) {
"use strict";
var compare = require_compare();
var eq = (a2, b2, loose) => compare(a2, b2, loose) === 0;
module2.exports = eq;
}
});
// node_modules/semver/functions/neq.js
var require_neq = __commonJS({
"node_modules/semver/functions/neq.js"(exports, module2) {
"use strict";
var compare = require_compare();
var neq = (a2, b2, loose) => compare(a2, b2, loose) !== 0;
module2.exports = neq;
}
});
// node_modules/semver/functions/gte.js
var require_gte = __commonJS({
"node_modules/semver/functions/gte.js"(exports, module2) {
"use strict";
var compare = require_compare();
var gte = (a2, b2, loose) => compare(a2, b2, loose) >= 0;
module2.exports = gte;
}
});
// node_modules/semver/functions/lte.js
var require_lte = __commonJS({
"node_modules/semver/functions/lte.js"(exports, module2) {
"use strict";
var compare = require_compare();
var lte = (a2, b2, loose) => compare(a2, b2, loose) <= 0;
module2.exports = lte;
}
});
// node_modules/semver/functions/cmp.js
var require_cmp = __commonJS({
"node_modules/semver/functions/cmp.js"(exports, module2) {
"use strict";
var eq = require_eq();
var neq = require_neq();
var gt2 = require_gt();
var gte = require_gte();
var lt = require_lt();
var lte = require_lte();
var cmp = (a2, op, b2, loose) => {
switch (op) {
case "===":
if (typeof a2 === "object") {
a2 = a2.version;
}
if (typeof b2 === "object") {
b2 = b2.version;
}
return a2 === b2;
case "!==":
if (typeof a2 === "object") {
a2 = a2.version;
}
if (typeof b2 === "object") {
b2 = b2.version;
}
return a2 !== b2;
case "":
case "=":
case "==":
return eq(a2, b2, loose);
case "!=":
return neq(a2, b2, loose);
case ">":
return gt2(a2, b2, loose);
case ">=":
return gte(a2, b2, loose);
case "<":
return lt(a2, b2, loose);
case "<=":
return lte(a2, b2, loose);
default:
throw new TypeError(`Invalid operator: ${op}`);
}
};
module2.exports = cmp;
}
});
// node_modules/semver/functions/coerce.js
var require_coerce = __commonJS({
"node_modules/semver/functions/coerce.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var parse2 = require_parse();
var { safeRe: re2, t: t3 } = require_re();
var coerce = (version2, options) => {
if (version2 instanceof SemVer) {
return version2;
}
if (typeof version2 === "number") {
version2 = String(version2);
}
if (typeof version2 !== "string") {
return null;
}
options = options || {};
let match = null;
if (!options.rtl) {
match = version2.match(options.includePrerelease ? re2[t3.COERCEFULL] : re2[t3.COERCE]);
} else {
const coerceRtlRegex = options.includePrerelease ? re2[t3.COERCERTLFULL] : re2[t3.COERCERTL];
let next;
while ((next = coerceRtlRegex.exec(version2)) && (!match || match.index + match[0].length !== version2.length)) {
if (!match || next.index + next[0].length !== match.index + match[0].length) {
match = next;
}
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
}
coerceRtlRegex.lastIndex = -1;
}
if (match === null) {
return null;
}
const major = match[2];
const minor = match[3] || "0";
const patch = match[4] || "0";
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
return parse2(`${major}.${minor}.${patch}${prerelease}${build}`, options);
};
module2.exports = coerce;
}
});
// node_modules/semver/internal/lrucache.js
var require_lrucache = __commonJS({
"node_modules/semver/internal/lrucache.js"(exports, module2) {
"use strict";
var LRUCache = class {
constructor() {
this.max = 1e3;
this.map = /* @__PURE__ */ new Map();
}
get(key) {
const value = this.map.get(key);
if (value === void 0) {
return void 0;
} else {
this.map.delete(key);
this.map.set(key, value);
return value;
}
}
delete(key) {
return this.map.delete(key);
}
set(key, value) {
const deleted = this.delete(key);
if (!deleted && value !== void 0) {
if (this.map.size >= this.max) {
const firstKey = this.map.keys().next().value;
this.delete(firstKey);
}
this.map.set(key, value);
}
return this;
}
};
module2.exports = LRUCache;
}
});
// node_modules/semver/classes/range.js
var require_range = __commonJS({
"node_modules/semver/classes/range.js"(exports, module2) {
"use strict";
var SPACE_CHARACTERS = /\s+/g;
var Range3 = class {
constructor(range, options) {
options = parseOptions(options);
if (range instanceof Range3) {
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
return range;
} else {
return new Range3(range.raw, options);
}
}
if (range instanceof Comparator) {
this.raw = range.value;
this.set = [[range]];
this.formatted = void 0;
return this;
}
this.options = options;
this.loose = !!options.loose;
this.includePrerelease = !!options.includePrerelease;
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
this.set = this.raw.split("||").map((r2) => this.parseRange(r2.trim())).filter((c2) => c2.length);
if (!this.set.length) {
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
}
if (this.set.length > 1) {
const first = this.set[0];
this.set = this.set.filter((c2) => !isNullSet(c2[0]));
if (this.set.length === 0) {
this.set = [first];
} else if (this.set.length > 1) {
for (const c2 of this.set) {
if (c2.length === 1 && isAny(c2[0])) {
this.set = [c2];
break;
}
}
}
}
this.formatted = void 0;
}
get range() {
if (this.formatted === void 0) {
this.formatted = "";
for (let i2 = 0; i2 < this.set.length; i2++) {
if (i2 > 0) {
this.formatted += "||";
}
const comps = this.set[i2];
for (let k2 = 0; k2 < comps.length; k2++) {
if (k2 > 0) {
this.formatted += " ";
}
this.formatted += comps[k2].toString().trim();
}
}
}
return this.formatted;
}
format() {
return this.range;
}
toString() {
return this.range;
}
parseRange(range) {
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
const memoKey = memoOpts + ":" + range;
const cached = cache.get(memoKey);
if (cached) {
return cached;
}
const loose = this.options.loose;
const hr = loose ? re2[t3.HYPHENRANGELOOSE] : re2[t3.HYPHENRANGE];
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
debug2("hyphen replace", range);
range = range.replace(re2[t3.COMPARATORTRIM], comparatorTrimReplace);
debug2("comparator trim", range);
range = range.replace(re2[t3.TILDETRIM], tildeTrimReplace);
debug2("tilde trim", range);
range = range.replace(re2[t3.CARETTRIM], caretTrimReplace);
debug2("caret trim", range);
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
if (loose) {
rangeList = rangeList.filter((comp) => {
debug2("loose invalid filter", comp, this.options);
return !!comp.match(re2[t3.COMPARATORLOOSE]);
});
}
debug2("range list", rangeList);
const rangeMap = /* @__PURE__ */ new Map();
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
for (const comp of comparators) {
if (isNullSet(comp)) {
return [comp];
}
rangeMap.set(comp.value, comp);
}
if (rangeMap.size > 1 && rangeMap.has("")) {
rangeMap.delete("");
}
const result = [...rangeMap.values()];
cache.set(memoKey, result);
return result;
}
intersects(range, options) {
if (!(range instanceof Range3)) {
throw new TypeError("a Range is required");
}
return this.set.some((thisComparators) => {
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
return rangeComparators.every((rangeComparator) => {
return thisComparator.intersects(rangeComparator, options);
});
});
});
});
}
test(version2) {
if (!version2) {
return false;
}
if (typeof version2 === "string") {
try {
version2 = new SemVer(version2, this.options);
} catch (er) {
return false;
}
}
for (let i2 = 0; i2 < this.set.length; i2++) {
if (testSet(this.set[i2], version2, this.options)) {
return true;
}
}
return false;
}
};
module2.exports = Range3;
var LRU = require_lrucache();
var cache = new LRU();
var parseOptions = require_parse_options();
var Comparator = require_comparator();
var debug2 = require_debug();
var SemVer = require_semver();
var {
safeRe: re2,
t: t3,
comparatorTrimReplace,
tildeTrimReplace,
caretTrimReplace
} = require_re();
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
var isNullSet = (c2) => c2.value === "<0.0.0-0";
var isAny = (c2) => c2.value === "";
var isSatisfiable = (comparators, options) => {
let result = true;
const remainingComparators = comparators.slice();
let testComparator = remainingComparators.pop();
while (result && remainingComparators.length) {
result = remainingComparators.every((otherComparator) => {
return testComparator.intersects(otherComparator, options);
});
testComparator = remainingComparators.pop();
}
return result;
};
var parseComparator = (comp, options) => {
comp = comp.replace(re2[t3.BUILD], "");
debug2("comp", comp, options);
comp = replaceCarets(comp, options);
debug2("caret", comp);
comp = replaceTildes(comp, options);
debug2("tildes", comp);
comp = replaceXRanges(comp, options);
debug2("xrange", comp);
comp = replaceStars(comp, options);
debug2("stars", comp);
return comp;
};
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
var replaceTildes = (comp, options) => {
return comp.trim().split(/\s+/).map((c2) => replaceTilde(c2, options)).join(" ");
};
var replaceTilde = (comp, options) => {
const r2 = options.loose ? re2[t3.TILDELOOSE] : re2[t3.TILDE];
return comp.replace(r2, (_2, M2, m2, p2, pr) => {
debug2("tilde", comp, _2, M2, m2, p2, pr);
let ret;
if (isX(M2)) {
ret = "";
} else if (isX(m2)) {
ret = `>=${M2}.0.0 <${+M2 + 1}.0.0-0`;
} else if (isX(p2)) {
ret = `>=${M2}.${m2}.0 <${M2}.${+m2 + 1}.0-0`;
} else if (pr) {
debug2("replaceTilde pr", pr);
ret = `>=${M2}.${m2}.${p2}-${pr} <${M2}.${+m2 + 1}.0-0`;
} else {
ret = `>=${M2}.${m2}.${p2} <${M2}.${+m2 + 1}.0-0`;
}
debug2("tilde return", ret);
return ret;
});
};
var replaceCarets = (comp, options) => {
return comp.trim().split(/\s+/).map((c2) => replaceCaret(c2, options)).join(" ");
};
var replaceCaret = (comp, options) => {
debug2("caret", comp, options);
const r2 = options.loose ? re2[t3.CARETLOOSE] : re2[t3.CARET];
const z = options.includePrerelease ? "-0" : "";
return comp.replace(r2, (_2, M2, m2, p2, pr) => {
debug2("caret", comp, _2, M2, m2, p2, pr);
let ret;
if (isX(M2)) {
ret = "";
} else if (isX(m2)) {
ret = `>=${M2}.0.0${z} <${+M2 + 1}.0.0-0`;
} else if (isX(p2)) {
if (M2 === "0") {
ret = `>=${M2}.${m2}.0${z} <${M2}.${+m2 + 1}.0-0`;
} else {
ret = `>=${M2}.${m2}.0${z} <${+M2 + 1}.0.0-0`;
}
} else if (pr) {
debug2("replaceCaret pr", pr);
if (M2 === "0") {
if (m2 === "0") {
ret = `>=${M2}.${m2}.${p2}-${pr} <${M2}.${m2}.${+p2 + 1}-0`;
} else {
ret = `>=${M2}.${m2}.${p2}-${pr} <${M2}.${+m2 + 1}.0-0`;
}
} else {
ret = `>=${M2}.${m2}.${p2}-${pr} <${+M2 + 1}.0.0-0`;
}
} else {
debug2("no pr");
if (M2 === "0") {
if (m2 === "0") {
ret = `>=${M2}.${m2}.${p2}${z} <${M2}.${m2}.${+p2 + 1}-0`;
} else {
ret = `>=${M2}.${m2}.${p2}${z} <${M2}.${+m2 + 1}.0-0`;
}
} else {
ret = `>=${M2}.${m2}.${p2} <${+M2 + 1}.0.0-0`;
}
}
debug2("caret return", ret);
return ret;
});
};
var replaceXRanges = (comp, options) => {
debug2("replaceXRanges", comp, options);
return comp.split(/\s+/).map((c2) => replaceXRange(c2, options)).join(" ");
};
var replaceXRange = (comp, options) => {
comp = comp.trim();
const r2 = options.loose ? re2[t3.XRANGELOOSE] : re2[t3.XRANGE];
return comp.replace(r2, (ret, gtlt, M2, m2, p2, pr) => {
debug2("xRange", comp, ret, gtlt, M2, m2, p2, pr);
const xM = isX(M2);
const xm = xM || isX(m2);
const xp = xm || isX(p2);
const anyX = xp;
if (gtlt === "=" && anyX) {
gtlt = "";
}
pr = options.includePrerelease ? "-0" : "";
if (xM) {
if (gtlt === ">" || gtlt === "<") {
ret = "<0.0.0-0";
} else {
ret = "*";
}
} else if (gtlt && anyX) {
if (xm) {
m2 = 0;
}
p2 = 0;
if (gtlt === ">") {
gtlt = ">=";
if (xm) {
M2 = +M2 + 1;
m2 = 0;
p2 = 0;
} else {
m2 = +m2 + 1;
p2 = 0;
}
} else if (gtlt === "<=") {
gtlt = "<";
if (xm) {
M2 = +M2 + 1;
} else {
m2 = +m2 + 1;
}
}
if (gtlt === "<") {
pr = "-0";
}
ret = `${gtlt + M2}.${m2}.${p2}${pr}`;
} else if (xm) {
ret = `>=${M2}.0.0${pr} <${+M2 + 1}.0.0-0`;
} else if (xp) {
ret = `>=${M2}.${m2}.0${pr} <${M2}.${+m2 + 1}.0-0`;
}
debug2("xRange return", ret);
return ret;
});
};
var replaceStars = (comp, options) => {
debug2("replaceStars", comp, options);
return comp.trim().replace(re2[t3.STAR], "");
};
var replaceGTE0 = (comp, options) => {
debug2("replaceGTE0", comp, options);
return comp.trim().replace(re2[options.includePrerelease ? t3.GTE0PRE : t3.GTE0], "");
};
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
if (isX(fM)) {
from = "";
} else if (isX(fm)) {
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
} else if (isX(fp)) {
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
} else if (fpr) {
from = `>=${from}`;
} else {
from = `>=${from}${incPr ? "-0" : ""}`;
}
if (isX(tM)) {
to = "";
} else if (isX(tm)) {
to = `<${+tM + 1}.0.0-0`;
} else if (isX(tp)) {
to = `<${tM}.${+tm + 1}.0-0`;
} else if (tpr) {
to = `<=${tM}.${tm}.${tp}-${tpr}`;
} else if (incPr) {
to = `<${tM}.${tm}.${+tp + 1}-0`;
} else {
to = `<=${to}`;
}
return `${from} ${to}`.trim();
};
var testSet = (set, version2, options) => {
for (let i2 = 0; i2 < set.length; i2++) {
if (!set[i2].test(version2)) {
return false;
}
}
if (version2.prerelease.length && !options.includePrerelease) {
for (let i2 = 0; i2 < set.length; i2++) {
debug2(set[i2].semver);
if (set[i2].semver === Comparator.ANY) {
continue;
}
if (set[i2].semver.prerelease.length > 0) {
const allowed = set[i2].semver;
if (allowed.major === version2.major && allowed.minor === version2.minor && allowed.patch === version2.patch) {
return true;
}
}
}
return false;
}
return true;
};
}
});
// node_modules/semver/classes/comparator.js
var require_comparator = __commonJS({
"node_modules/semver/classes/comparator.js"(exports, module2) {
"use strict";
var ANY = Symbol("SemVer ANY");
var Comparator = class {
static get ANY() {
return ANY;
}
constructor(comp, options) {
options = parseOptions(options);
if (comp instanceof Comparator) {
if (comp.loose === !!options.loose) {
return comp;
} else {
comp = comp.value;
}
}
comp = comp.trim().split(/\s+/).join(" ");
debug2("comparator", comp, options);
this.options = options;
this.loose = !!options.loose;
this.parse(comp);
if (this.semver === ANY) {
this.value = "";
} else {
this.value = this.operator + this.semver.version;
}
debug2("comp", this);
}
parse(comp) {
const r2 = this.options.loose ? re2[t3.COMPARATORLOOSE] : re2[t3.COMPARATOR];
const m2 = comp.match(r2);
if (!m2) {
throw new TypeError(`Invalid comparator: ${comp}`);
}
this.operator = m2[1] !== void 0 ? m2[1] : "";
if (this.operator === "=") {
this.operator = "";
}
if (!m2[2]) {
this.semver = ANY;
} else {
this.semver = new SemVer(m2[2], this.options.loose);
}
}
toString() {
return this.value;
}
test(version2) {
debug2("Comparator.test", version2, this.options.loose);
if (this.semver === ANY || version2 === ANY) {
return true;
}
if (typeof version2 === "string") {
try {
version2 = new SemVer(version2, this.options);
} catch (er) {
return false;
}
}
return cmp(version2, this.operator, this.semver, this.options);
}
intersects(comp, options) {
if (!(comp instanceof Comparator)) {
throw new TypeError("a Comparator is required");
}
if (this.operator === "") {
if (this.value === "") {
return true;
}
return new Range3(comp.value, options).test(this.value);
} else if (comp.operator === "") {
if (comp.value === "") {
return true;
}
return new Range3(this.value, options).test(comp.semver);
}
options = parseOptions(options);
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
return false;
}
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
return false;
}
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
return true;
}
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
return true;
}
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
return true;
}
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
return true;
}
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
return true;
}
return false;
}
};
module2.exports = Comparator;
var parseOptions = require_parse_options();
var { safeRe: re2, t: t3 } = require_re();
var cmp = require_cmp();
var debug2 = require_debug();
var SemVer = require_semver();
var Range3 = require_range();
}
});
// node_modules/semver/functions/satisfies.js
var require_satisfies = __commonJS({
"node_modules/semver/functions/satisfies.js"(exports, module2) {
"use strict";
var Range3 = require_range();
var satisfies = (version2, range, options) => {
try {
range = new Range3(range, options);
} catch (er) {
return false;
}
return range.test(version2);
};
module2.exports = satisfies;
}
});
// node_modules/semver/ranges/to-comparators.js
var require_to_comparators = __commonJS({
"node_modules/semver/ranges/to-comparators.js"(exports, module2) {
"use strict";
var Range3 = require_range();
var toComparators = (range, options) => new Range3(range, options).set.map((comp) => comp.map((c2) => c2.value).join(" ").trim().split(" "));
module2.exports = toComparators;
}
});
// node_modules/semver/ranges/max-satisfying.js
var require_max_satisfying = __commonJS({
"node_modules/semver/ranges/max-satisfying.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var Range3 = require_range();
var maxSatisfying = (versions, range, options) => {
let max3 = null;
let maxSV = null;
let rangeObj = null;
try {
rangeObj = new Range3(range, options);
} catch (er) {
return null;
}
versions.forEach((v2) => {
if (rangeObj.test(v2)) {
if (!max3 || maxSV.compare(v2) === -1) {
max3 = v2;
maxSV = new SemVer(max3, options);
}
}
});
return max3;
};
module2.exports = maxSatisfying;
}
});
// node_modules/semver/ranges/min-satisfying.js
var require_min_satisfying = __commonJS({
"node_modules/semver/ranges/min-satisfying.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var Range3 = require_range();
var minSatisfying = (versions, range, options) => {
let min4 = null;
let minSV = null;
let rangeObj = null;
try {
rangeObj = new Range3(range, options);
} catch (er) {
return null;
}
versions.forEach((v2) => {
if (rangeObj.test(v2)) {
if (!min4 || minSV.compare(v2) === 1) {
min4 = v2;
minSV = new SemVer(min4, options);
}
}
});
return min4;
};
module2.exports = minSatisfying;
}
});
// node_modules/semver/ranges/min-version.js
var require_min_version = __commonJS({
"node_modules/semver/ranges/min-version.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var Range3 = require_range();
var gt2 = require_gt();
var minVersion = (range, loose) => {
range = new Range3(range, loose);
let minver = new SemVer("0.0.0");
if (range.test(minver)) {
return minver;
}
minver = new SemVer("0.0.0-0");
if (range.test(minver)) {
return minver;
}
minver = null;
for (let i2 = 0; i2 < range.set.length; ++i2) {
const comparators = range.set[i2];
let setMin = null;
comparators.forEach((comparator) => {
const compver = new SemVer(comparator.semver.version);
switch (comparator.operator) {
case ">":
if (compver.prerelease.length === 0) {
compver.patch++;
} else {
compver.prerelease.push(0);
}
compver.raw = compver.format();
case "":
case ">=":
if (!setMin || gt2(compver, setMin)) {
setMin = compver;
}
break;
case "<":
case "<=":
break;
default:
throw new Error(`Unexpected operation: ${comparator.operator}`);
}
});
if (setMin && (!minver || gt2(minver, setMin))) {
minver = setMin;
}
}
if (minver && range.test(minver)) {
return minver;
}
return null;
};
module2.exports = minVersion;
}
});
// node_modules/semver/ranges/valid.js
var require_valid2 = __commonJS({
"node_modules/semver/ranges/valid.js"(exports, module2) {
"use strict";
var Range3 = require_range();
var validRange = (range, options) => {
try {
return new Range3(range, options).range || "*";
} catch (er) {
return null;
}
};
module2.exports = validRange;
}
});
// node_modules/semver/ranges/outside.js
var require_outside = __commonJS({
"node_modules/semver/ranges/outside.js"(exports, module2) {
"use strict";
var SemVer = require_semver();
var Comparator = require_comparator();
var { ANY } = Comparator;
var Range3 = require_range();
var satisfies = require_satisfies();
var gt2 = require_gt();
var lt = require_lt();
var lte = require_lte();
var gte = require_gte();
var outside = (version2, range, hilo, options) => {
version2 = new SemVer(version2, options);
range = new Range3(range, options);
let gtfn, ltefn, ltfn, comp, ecomp;
switch (hilo) {
case ">":
gtfn = gt2;
ltefn = lte;
ltfn = lt;
comp = ">";
ecomp = ">=";
break;
case "<":
gtfn = lt;
ltefn = gte;
ltfn = gt2;
comp = "<";
ecomp = "<=";
break;
default:
throw new TypeError('Must provide a hilo val of "<" or ">"');
}
if (satisfies(version2, range, options)) {
return false;
}
for (let i2 = 0; i2 < range.set.length; ++i2) {
const comparators = range.set[i2];
let high = null;
let low = null;
comparators.forEach((comparator) => {
if (comparator.semver === ANY) {
comparator = new Comparator(">=0.0.0");
}
high = high || comparator;
low = low || comparator;
if (gtfn(comparator.semver, high.semver, options)) {
high = comparator;
} else if (ltfn(comparator.semver, low.semver, options)) {
low = comparator;
}
});
if (high.operator === comp || high.operator === ecomp) {
return false;
}
if ((!low.operator || low.operator === comp) && ltefn(version2, low.semver)) {
return false;
} else if (low.operator === ecomp && ltfn(version2, low.semver)) {
return false;
}
}
return true;
};
module2.exports = outside;
}
});
// node_modules/semver/ranges/gtr.js
var require_gtr = __commonJS({
"node_modules/semver/ranges/gtr.js"(exports, module2) {
"use strict";
var outside = require_outside();
var gtr = (version2, range, options) => outside(version2, range, ">", options);
module2.exports = gtr;
}
});
// node_modules/semver/ranges/ltr.js
var require_ltr = __commonJS({
"node_modules/semver/ranges/ltr.js"(exports, module2) {
"use strict";
var outside = require_outside();
var ltr = (version2, range, options) => outside(version2, range, "<", options);
module2.exports = ltr;
}
});
// node_modules/semver/ranges/intersects.js
var require_intersects = __commonJS({
"node_modules/semver/ranges/intersects.js"(exports, module2) {
"use strict";
var Range3 = require_range();
var intersects = (r1, r2, options) => {
r1 = new Range3(r1, options);
r2 = new Range3(r2, options);
return r1.intersects(r2, options);
};
module2.exports = intersects;
}
});
// node_modules/semver/ranges/simplify.js
var require_simplify = __commonJS({
"node_modules/semver/ranges/simplify.js"(exports, module2) {
"use strict";
var satisfies = require_satisfies();
var compare = require_compare();
module2.exports = (versions, range, options) => {
const set = [];
let first = null;
let prev = null;
const v2 = versions.sort((a2, b2) => compare(a2, b2, options));
for (const version2 of v2) {
const included = satisfies(version2, range, options);
if (included) {
prev = version2;
if (!first) {
first = version2;
}
} else {
if (prev) {
set.push([first, prev]);
}
prev = null;
first = null;
}
}
if (first) {
set.push([first, null]);
}
const ranges = [];
for (const [min4, max3] of set) {
if (min4 === max3) {
ranges.push(min4);
} else if (!max3 && min4 === v2[0]) {
ranges.push("*");
} else if (!max3) {
ranges.push(`>=${min4}`);
} else if (min4 === v2[0]) {
ranges.push(`<=${max3}`);
} else {
ranges.push(`${min4} - ${max3}`);
}
}
const simplified = ranges.join(" || ");
const original = typeof range.raw === "string" ? range.raw : String(range);
return simplified.length < original.length ? simplified : range;
};
}
});
// node_modules/semver/ranges/subset.js
var require_subset = __commonJS({
"node_modules/semver/ranges/subset.js"(exports, module2) {
"use strict";
var Range3 = require_range();
var Comparator = require_comparator();
var { ANY } = Comparator;
var satisfies = require_satisfies();
var compare = require_compare();
var subset = (sub, dom, options = {}) => {
if (sub === dom) {
return true;
}
sub = new Range3(sub, options);
dom = new Range3(dom, options);
let sawNonNull = false;
OUTER:
for (const simpleSub of sub.set) {
for (const simpleDom of dom.set) {
const isSub = simpleSubset(simpleSub, simpleDom, options);
sawNonNull = sawNonNull || isSub !== null;
if (isSub) {
continue OUTER;
}
}
if (sawNonNull) {
return false;
}
}
return true;
};
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
var minimumVersion = [new Comparator(">=0.0.0")];
var simpleSubset = (sub, dom, options) => {
if (sub === dom) {
return true;
}
if (sub.length === 1 && sub[0].semver === ANY) {
if (dom.length === 1 && dom[0].semver === ANY) {
return true;
} else if (options.includePrerelease) {
sub = minimumVersionWithPreRelease;
} else {
sub = minimumVersion;
}
}
if (dom.length === 1 && dom[0].semver === ANY) {
if (options.includePrerelease) {
return true;
} else {
dom = minimumVersion;
}
}
const eqSet = /* @__PURE__ */ new Set();
let gt2, lt;
for (const c2 of sub) {
if (c2.operator === ">" || c2.operator === ">=") {
gt2 = higherGT(gt2, c2, options);
} else if (c2.operator === "<" || c2.operator === "<=") {
lt = lowerLT(lt, c2, options);
} else {
eqSet.add(c2.semver);
}
}
if (eqSet.size > 1) {
return null;
}
let gtltComp;
if (gt2 && lt) {
gtltComp = compare(gt2.semver, lt.semver, options);
if (gtltComp > 0) {
return null;
} else if (gtltComp === 0 && (gt2.operator !== ">=" || lt.operator !== "<=")) {
return null;
}
}
for (const eq of eqSet) {
if (gt2 && !satisfies(eq, String(gt2), options)) {
return null;
}
if (lt && !satisfies(eq, String(lt), options)) {
return null;
}
for (const c2 of dom) {
if (!satisfies(eq, String(c2), options)) {
return false;
}
}
return true;
}
let higher, lower;
let hasDomLT, hasDomGT;
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
let needDomGTPre = gt2 && !options.includePrerelease && gt2.semver.prerelease.length ? gt2.semver : false;
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
needDomLTPre = false;
}
for (const c2 of dom) {
hasDomGT = hasDomGT || c2.operator === ">" || c2.operator === ">=";
hasDomLT = hasDomLT || c2.operator === "<" || c2.operator === "<=";
if (gt2) {
if (needDomGTPre) {
if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomGTPre.major && c2.semver.minor === needDomGTPre.minor && c2.semver.patch === needDomGTPre.patch) {
needDomGTPre = false;
}
}
if (c2.operator === ">" || c2.operator === ">=") {
higher = higherGT(gt2, c2, options);
if (higher === c2 && higher !== gt2) {
return false;
}
} else if (gt2.operator === ">=" && !satisfies(gt2.semver, String(c2), options)) {
return false;
}
}
if (lt) {
if (needDomLTPre) {
if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomLTPre.major && c2.semver.minor === needDomLTPre.minor && c2.semver.patch === needDomLTPre.patch) {
needDomLTPre = false;
}
}
if (c2.operator === "<" || c2.operator === "<=") {
lower = lowerLT(lt, c2, options);
if (lower === c2 && lower !== lt) {
return false;
}
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c2), options)) {
return false;
}
}
if (!c2.operator && (lt || gt2) && gtltComp !== 0) {
return false;
}
}
if (gt2 && hasDomLT && !lt && gtltComp !== 0) {
return false;
}
if (lt && hasDomGT && !gt2 && gtltComp !== 0) {
return false;
}
if (needDomGTPre || needDomLTPre) {
return false;
}
return true;
};
var higherGT = (a2, b2, options) => {
if (!a2) {
return b2;
}
const comp = compare(a2.semver, b2.semver, options);
return comp > 0 ? a2 : comp < 0 ? b2 : b2.operator === ">" && a2.operator === ">=" ? b2 : a2;
};
var lowerLT = (a2, b2, options) => {
if (!a2) {
return b2;
}
const comp = compare(a2.semver, b2.semver, options);
return comp < 0 ? a2 : comp > 0 ? b2 : b2.operator === "<" && a2.operator === "<=" ? b2 : a2;
};
module2.exports = subset;
}
});
// node_modules/semver/index.js
var require_semver2 = __commonJS({
"node_modules/semver/index.js"(exports, module2) {
"use strict";
var internalRe = require_re();
var constants = require_constants();
var SemVer = require_semver();
var identifiers = require_identifiers();
var parse2 = require_parse();
var valid2 = require_valid();
var clean = require_clean();
var inc = require_inc();
var diff = require_diff();
var major = require_major();
var minor = require_minor();
var patch = require_patch();
var prerelease = require_prerelease();
var compare = require_compare();
var rcompare = require_rcompare();
var compareLoose = require_compare_loose();
var compareBuild = require_compare_build();
var sort = require_sort();
var rsort = require_rsort();
var gt2 = require_gt();
var lt = require_lt();
var eq = require_eq();
var neq = require_neq();
var gte = require_gte();
var lte = require_lte();
var cmp = require_cmp();
var coerce = require_coerce();
var Comparator = require_comparator();
var Range3 = require_range();
var satisfies = require_satisfies();
var toComparators = require_to_comparators();
var maxSatisfying = require_max_satisfying();
var minSatisfying = require_min_satisfying();
var minVersion = require_min_version();
var validRange = require_valid2();
var outside = require_outside();
var gtr = require_gtr();
var ltr = require_ltr();
var intersects = require_intersects();
var simplifyRange = require_simplify();
var subset = require_subset();
module2.exports = {
parse: parse2,
valid: valid2,
clean,
inc,
diff,
major,
minor,
patch,
prerelease,
compare,
rcompare,
compareLoose,
compareBuild,
sort,
rsort,
gt: gt2,
lt,
eq,
neq,
gte,
lte,
cmp,
coerce,
Comparator,
Range: Range3,
satisfies,
toComparators,
maxSatisfying,
minSatisfying,
minVersion,
validRange,
outside,
gtr,
ltr,
intersects,
simplifyRange,
subset,
SemVer,
re: internalRe.re,
src: internalRe.src,
tokens: internalRe.t,
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
RELEASE_TYPES: constants.RELEASE_TYPES,
compareIdentifiers: identifiers.compareIdentifiers,
rcompareIdentifiers: identifiers.rcompareIdentifiers
};
}
});
// node_modules/jotai/esm/vanilla.mjs
function atom(read2, write2) {
const key = `atom${++keyCount}`;
const config = {
toString() {
return (import_meta.env ? import_meta.env.MODE : void 0) !== "production" && this.debugLabel ? key + ":" + this.debugLabel : key;
}
};
if (typeof read2 === "function") {
config.read = read2;
} else {
config.init = read2;
config.read = defaultRead;
config.write = defaultWrite;
}
if (write2) {
config.write = write2;
}
return config;
}
function defaultRead(get) {
return get(this);
}
function defaultWrite(get, set, arg) {
return set(this, typeof arg === "function" ? arg(get(this)) : arg);
}
var import_meta, keyCount, isSelfAtom, hasInitialValue, isActuallyWritableAtom, CONTINUE_PROMISE, PENDING, FULFILLED, REJECTED, isContinuablePromise, continuablePromiseMap, createContinuablePromise, isPromiseLike, isAtomStateInitialized, returnAtomValue, getPendingContinuablePromise, addPendingContinuablePromiseToDependency, addDependency, createPending, addPendingAtom, addPendingDependent, getPendingDependents, addPendingFunction, flushPending, buildStore, createStore, defaultStore, getDefaultStore;
var init_vanilla = __esm({
"node_modules/jotai/esm/vanilla.mjs"() {
import_meta = {};
keyCount = 0;
isSelfAtom = (atom3, a2) => atom3.unstable_is ? atom3.unstable_is(a2) : a2 === atom3;
hasInitialValue = (atom3) => "init" in atom3;
isActuallyWritableAtom = (atom3) => !!atom3.write;
CONTINUE_PROMISE = Symbol((import_meta.env ? import_meta.env.MODE : void 0) !== "production" ? "CONTINUE_PROMISE" : "");
PENDING = "pending";
FULFILLED = "fulfilled";
REJECTED = "rejected";
isContinuablePromise = (promise) => typeof promise === "object" && promise !== null && CONTINUE_PROMISE in promise;
continuablePromiseMap = /* @__PURE__ */ new WeakMap();
createContinuablePromise = (promise, abort, complete) => {
if (!continuablePromiseMap.has(promise)) {
let continuePromise;
const p2 = new Promise((resolve, reject) => {
let curr = promise;
const onFulfilled = (me) => (v2) => {
if (curr === me) {
p2.status = FULFILLED;
p2.value = v2;
resolve(v2);
complete();
}
};
const onRejected = (me) => (e2) => {
if (curr === me) {
p2.status = REJECTED;
p2.reason = e2;
reject(e2);
complete();
}
};
promise.then(onFulfilled(promise), onRejected(promise));
continuePromise = (nextPromise, nextAbort) => {
if (nextPromise) {
continuablePromiseMap.set(nextPromise, p2);
curr = nextPromise;
nextPromise.then(onFulfilled(nextPromise), onRejected(nextPromise));
abort();
abort = nextAbort;
}
};
});
p2.status = PENDING;
p2[CONTINUE_PROMISE] = continuePromise;
continuablePromiseMap.set(promise, p2);
}
return continuablePromiseMap.get(promise);
};
isPromiseLike = (x2) => typeof (x2 == null ? void 0 : x2.then) === "function";
isAtomStateInitialized = (atomState) => "v" in atomState || "e" in atomState;
returnAtomValue = (atomState) => {
if ("e" in atomState) {
throw atomState.e;
}
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production" && !("v" in atomState)) {
throw new Error("[Bug] atom state is not initialized");
}
return atomState.v;
};
getPendingContinuablePromise = (atomState) => {
const value = atomState.v;
if (isContinuablePromise(value) && value.status === PENDING) {
return value;
}
return null;
};
addPendingContinuablePromiseToDependency = (atom3, promise, dependencyAtomState) => {
if (!dependencyAtomState.p.has(atom3)) {
dependencyAtomState.p.add(atom3);
promise.then(() => {
dependencyAtomState.p.delete(atom3);
}, () => {
dependencyAtomState.p.delete(atom3);
});
}
};
addDependency = (pending, atom3, atomState, a2, aState) => {
var _a;
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production" && a2 === atom3) {
throw new Error("[Bug] atom cannot depend on itself");
}
atomState.d.set(a2, aState.n);
const continuablePromise = getPendingContinuablePromise(atomState);
if (continuablePromise) {
addPendingContinuablePromiseToDependency(atom3, continuablePromise, aState);
}
(_a = aState.m) == null ? void 0 : _a.t.add(atom3);
if (pending) {
addPendingDependent(pending, a2, atom3);
}
};
createPending = () => [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), /* @__PURE__ */ new Set()];
addPendingAtom = (pending, atom3, atomState) => {
if (!pending[0].has(atom3)) {
pending[0].set(atom3, /* @__PURE__ */ new Set());
}
pending[1].set(atom3, atomState);
};
addPendingDependent = (pending, atom3, dependent) => {
const dependents = pending[0].get(atom3);
if (dependents) {
dependents.add(dependent);
}
};
getPendingDependents = (pending, atom3) => pending[0].get(atom3);
addPendingFunction = (pending, fn3) => {
pending[2].add(fn3);
};
flushPending = (pending) => {
while (pending[1].size || pending[2].size) {
pending[0].clear();
const atomStates = new Set(pending[1].values());
pending[1].clear();
const functions = new Set(pending[2]);
pending[2].clear();
atomStates.forEach((atomState) => {
var _a;
return (_a = atomState.m) == null ? void 0 : _a.l.forEach((l2) => l2());
});
functions.forEach((fn3) => fn3());
}
};
buildStore = (getAtomState) => {
let debugMountedAtoms;
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
debugMountedAtoms = /* @__PURE__ */ new Set();
}
const setAtomStateValueOrPromise = (atom3, atomState, valueOrPromise, abortPromise = () => {
}, completePromise = () => {
}) => {
const hasPrevValue = "v" in atomState;
const prevValue = atomState.v;
const pendingPromise = getPendingContinuablePromise(atomState);
if (isPromiseLike(valueOrPromise)) {
if (pendingPromise) {
if (pendingPromise !== valueOrPromise) {
pendingPromise[CONTINUE_PROMISE](valueOrPromise, abortPromise);
++atomState.n;
}
} else {
const continuablePromise = createContinuablePromise(valueOrPromise, abortPromise, completePromise);
if (continuablePromise.status === PENDING) {
for (const a2 of atomState.d.keys()) {
addPendingContinuablePromiseToDependency(atom3, continuablePromise, getAtomState(a2, atomState));
}
}
atomState.v = continuablePromise;
delete atomState.e;
}
} else {
if (pendingPromise) {
pendingPromise[CONTINUE_PROMISE](Promise.resolve(valueOrPromise), abortPromise);
}
atomState.v = valueOrPromise;
delete atomState.e;
}
if (!hasPrevValue || !Object.is(prevValue, atomState.v)) {
++atomState.n;
}
};
const readAtomState = (pending, atom3, atomState, force) => {
if (!(force == null ? void 0 : force(atom3)) && isAtomStateInitialized(atomState)) {
if (atomState.m) {
return atomState;
}
if (Array.from(atomState.d).every(([a2, n2]) => readAtomState(pending, a2, getAtomState(a2, atomState), force).n === n2)) {
return atomState;
}
}
atomState.d.clear();
let isSync = true;
const getter = (a2) => {
if (isSelfAtom(atom3, a2)) {
const aState2 = getAtomState(a2, atomState);
if (!isAtomStateInitialized(aState2)) {
if (hasInitialValue(a2)) {
setAtomStateValueOrPromise(a2, aState2, a2.init);
} else {
throw new Error("no atom init");
}
}
return returnAtomValue(aState2);
}
const aState = readAtomState(pending, a2, getAtomState(a2, atomState), force);
if (isSync) {
addDependency(pending, atom3, atomState, a2, aState);
} else {
const pending2 = createPending();
addDependency(pending2, atom3, atomState, a2, aState);
mountDependencies(pending2, atom3, atomState);
flushPending(pending2);
}
return returnAtomValue(aState);
};
let controller;
let setSelf;
const options = {
get signal() {
if (!controller) {
controller = new AbortController();
}
return controller.signal;
},
get setSelf() {
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production" && !isActuallyWritableAtom(atom3)) {
console.warn("setSelf function cannot be used with read-only atom");
}
if (!setSelf && isActuallyWritableAtom(atom3)) {
setSelf = (...args) => {
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production" && isSync) {
console.warn("setSelf function cannot be called in sync");
}
if (!isSync) {
return writeAtom(atom3, ...args);
}
};
}
return setSelf;
}
};
try {
const valueOrPromise = atom3.read(getter, options);
setAtomStateValueOrPromise(atom3, atomState, valueOrPromise, () => controller == null ? void 0 : controller.abort(), () => {
if (atomState.m) {
const pending2 = createPending();
mountDependencies(pending2, atom3, atomState);
flushPending(pending2);
}
});
return atomState;
} catch (error2) {
delete atomState.v;
atomState.e = error2;
++atomState.n;
return atomState;
} finally {
isSync = false;
}
};
const readAtom = (atom3) => returnAtomValue(readAtomState(void 0, atom3, getAtomState(atom3)));
const getDependents = (pending, atom3, atomState) => {
var _a, _b;
const dependents = /* @__PURE__ */ new Map();
for (const a2 of ((_a = atomState.m) == null ? void 0 : _a.t) || []) {
dependents.set(a2, getAtomState(a2, atomState));
}
for (const atomWithPendingContinuablePromise of atomState.p) {
dependents.set(atomWithPendingContinuablePromise, getAtomState(atomWithPendingContinuablePromise, atomState));
}
(_b = getPendingDependents(pending, atom3)) == null ? void 0 : _b.forEach((dependent) => {
dependents.set(dependent, getAtomState(dependent, atomState));
});
return dependents;
};
const recomputeDependents = (pending, atom3, atomState) => {
const topsortedAtoms = [];
const markedAtoms = /* @__PURE__ */ new Set();
const visit = (a2, aState) => {
if (markedAtoms.has(a2)) {
return;
}
markedAtoms.add(a2);
for (const [d2, s2] of getDependents(pending, a2, aState)) {
if (a2 !== d2) {
visit(d2, s2);
}
}
topsortedAtoms.push([a2, aState, aState.n]);
};
visit(atom3, atomState);
const changedAtoms = /* @__PURE__ */ new Set([atom3]);
const isMarked = (a2) => markedAtoms.has(a2);
for (let i2 = topsortedAtoms.length - 1; i2 >= 0; --i2) {
const [a2, aState, prevEpochNumber] = topsortedAtoms[i2];
let hasChangedDeps = false;
for (const dep of aState.d.keys()) {
if (dep !== a2 && changedAtoms.has(dep)) {
hasChangedDeps = true;
break;
}
}
if (hasChangedDeps) {
readAtomState(pending, a2, aState, isMarked);
mountDependencies(pending, a2, aState);
if (prevEpochNumber !== aState.n) {
addPendingAtom(pending, a2, aState);
changedAtoms.add(a2);
}
}
markedAtoms.delete(a2);
}
};
const writeAtomState = (pending, atom3, atomState, ...args) => {
const getter = (a2) => returnAtomValue(readAtomState(pending, a2, getAtomState(a2, atomState)));
const setter = (a2, ...args2) => {
const aState = getAtomState(a2, atomState);
let r2;
if (isSelfAtom(atom3, a2)) {
if (!hasInitialValue(a2)) {
throw new Error("atom not writable");
}
const hasPrevValue = "v" in aState;
const prevValue = aState.v;
const v2 = args2[0];
setAtomStateValueOrPromise(a2, aState, v2);
mountDependencies(pending, a2, aState);
if (!hasPrevValue || !Object.is(prevValue, aState.v)) {
addPendingAtom(pending, a2, aState);
recomputeDependents(pending, a2, aState);
}
} else {
r2 = writeAtomState(pending, a2, aState, ...args2);
}
flushPending(pending);
return r2;
};
const result = atom3.write(getter, setter, ...args);
return result;
};
const writeAtom = (atom3, ...args) => {
const pending = createPending();
const result = writeAtomState(pending, atom3, getAtomState(atom3), ...args);
flushPending(pending);
return result;
};
const mountDependencies = (pending, atom3, atomState) => {
if (atomState.m && !getPendingContinuablePromise(atomState)) {
for (const a2 of atomState.d.keys()) {
if (!atomState.m.d.has(a2)) {
const aMounted = mountAtom(pending, a2, getAtomState(a2, atomState));
aMounted.t.add(atom3);
atomState.m.d.add(a2);
}
}
for (const a2 of atomState.m.d || []) {
if (!atomState.d.has(a2)) {
atomState.m.d.delete(a2);
const aMounted = unmountAtom(pending, a2, getAtomState(a2, atomState));
aMounted == null ? void 0 : aMounted.t.delete(atom3);
}
}
}
};
const mountAtom = (pending, atom3, atomState) => {
if (!atomState.m) {
readAtomState(pending, atom3, atomState);
for (const a2 of atomState.d.keys()) {
const aMounted = mountAtom(pending, a2, getAtomState(a2, atomState));
aMounted.t.add(atom3);
}
atomState.m = {
l: /* @__PURE__ */ new Set(),
d: new Set(atomState.d.keys()),
t: /* @__PURE__ */ new Set()
};
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
debugMountedAtoms.add(atom3);
}
if (isActuallyWritableAtom(atom3) && atom3.onMount) {
const mounted = atomState.m;
const { onMount: onMount2 } = atom3;
addPendingFunction(pending, () => {
const onUnmount = onMount2((...args) => writeAtomState(pending, atom3, atomState, ...args));
if (onUnmount) {
mounted.u = onUnmount;
}
});
}
}
return atomState.m;
};
const unmountAtom = (pending, atom3, atomState) => {
if (atomState.m && !atomState.m.l.size && !Array.from(atomState.m.t).some((a2) => {
var _a;
return (_a = getAtomState(a2, atomState).m) == null ? void 0 : _a.d.has(atom3);
})) {
const onUnmount = atomState.m.u;
if (onUnmount) {
addPendingFunction(pending, onUnmount);
}
delete atomState.m;
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
debugMountedAtoms.delete(atom3);
}
for (const a2 of atomState.d.keys()) {
const aMounted = unmountAtom(pending, a2, getAtomState(a2, atomState));
aMounted == null ? void 0 : aMounted.t.delete(atom3);
}
const pendingPromise = getPendingContinuablePromise(atomState);
if (pendingPromise) {
pendingPromise[CONTINUE_PROMISE](void 0, () => {
});
}
return void 0;
}
return atomState.m;
};
const subscribeAtom = (atom3, listener) => {
const pending = createPending();
const atomState = getAtomState(atom3);
const mounted = mountAtom(pending, atom3, atomState);
flushPending(pending);
const listeners = mounted.l;
listeners.add(listener);
return () => {
listeners.delete(listener);
const pending2 = createPending();
unmountAtom(pending2, atom3, atomState);
flushPending(pending2);
};
};
const unstable_derive = (fn3) => buildStore(...fn3(getAtomState));
const store = {
get: readAtom,
set: writeAtom,
sub: subscribeAtom,
unstable_derive
};
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
const devStore = {
dev4_get_internal_weak_map: () => ({
get: (atom3) => {
const atomState = getAtomState(atom3);
if (atomState.n === 0) {
return void 0;
}
return atomState;
}
}),
dev4_get_mounted_atoms: () => debugMountedAtoms,
dev4_restore_atoms: (values) => {
const pending = createPending();
for (const [atom3, value] of values) {
if (hasInitialValue(atom3)) {
const atomState = getAtomState(atom3);
const hasPrevValue = "v" in atomState;
const prevValue = atomState.v;
setAtomStateValueOrPromise(atom3, atomState, value);
mountDependencies(pending, atom3, atomState);
if (!hasPrevValue || !Object.is(prevValue, atomState.v)) {
addPendingAtom(pending, atom3, atomState);
recomputeDependents(pending, atom3, atomState);
}
}
}
flushPending(pending);
}
};
Object.assign(store, devStore);
}
return store;
};
createStore = () => {
const atomStateMap = /* @__PURE__ */ new WeakMap();
const getAtomState = (atom3) => {
let atomState = atomStateMap.get(atom3);
if (!atomState) {
atomState = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 };
atomStateMap.set(atom3, atomState);
}
return atomState;
};
return buildStore(getAtomState);
};
getDefaultStore = () => {
if (!defaultStore) {
defaultStore = createStore();
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
globalThis.__JOTAI_DEFAULT_STORE__ || (globalThis.__JOTAI_DEFAULT_STORE__ = defaultStore);
if (globalThis.__JOTAI_DEFAULT_STORE__ !== defaultStore) {
console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044");
}
}
}
return defaultStore;
};
}
});
// node_modules/react/cjs/react.production.min.js
var require_react_production_min = __commonJS({
"node_modules/react/cjs/react.production.min.js"(exports) {
"use strict";
var l2 = Symbol.for("react.element");
var n2 = Symbol.for("react.portal");
var p2 = Symbol.for("react.fragment");
var q = Symbol.for("react.strict_mode");
var r2 = Symbol.for("react.profiler");
var t3 = Symbol.for("react.provider");
var u2 = Symbol.for("react.context");
var v2 = Symbol.for("react.forward_ref");
var w2 = Symbol.for("react.suspense");
var x2 = Symbol.for("react.memo");
var y2 = Symbol.for("react.lazy");
var z = Symbol.iterator;
function A2(a2) {
if (a2 === null || typeof a2 !== "object")
return null;
a2 = z && a2[z] || a2["@@iterator"];
return typeof a2 === "function" ? a2 : null;
}
var B = { isMounted: function() {
return false;
}, enqueueForceUpdate: function() {
}, enqueueReplaceState: function() {
}, enqueueSetState: function() {
} };
var C2 = Object.assign;
var D2 = {};
function E2(a2, b2, e2) {
this.props = a2;
this.context = b2;
this.refs = D2;
this.updater = e2 || B;
}
E2.prototype.isReactComponent = {};
E2.prototype.setState = function(a2, b2) {
if (typeof a2 !== "object" && typeof a2 !== "function" && a2 != null)
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, a2, b2, "setState");
};
E2.prototype.forceUpdate = function(a2) {
this.updater.enqueueForceUpdate(this, a2, "forceUpdate");
};
function F2() {
}
F2.prototype = E2.prototype;
function G(a2, b2, e2) {
this.props = a2;
this.context = b2;
this.refs = D2;
this.updater = e2 || B;
}
var H = G.prototype = new F2();
H.constructor = G;
C2(H, E2.prototype);
H.isPureReactComponent = true;
var I2 = Array.isArray;
var J = Object.prototype.hasOwnProperty;
var K = { current: null };
var L2 = { key: true, ref: true, __self: true, __source: true };
function M2(a2, b2, e2) {
var d2, c2 = {}, k2 = null, h2 = null;
if (b2 != null)
for (d2 in b2.ref !== void 0 && (h2 = b2.ref), b2.key !== void 0 && (k2 = "" + b2.key), b2)
J.call(b2, d2) && !L2.hasOwnProperty(d2) && (c2[d2] = b2[d2]);
var g2 = arguments.length - 2;
if (g2 === 1)
c2.children = e2;
else if (1 < g2) {
for (var f2 = Array(g2), m2 = 0; m2 < g2; m2++)
f2[m2] = arguments[m2 + 2];
c2.children = f2;
}
if (a2 && a2.defaultProps)
for (d2 in g2 = a2.defaultProps, g2)
c2[d2] === void 0 && (c2[d2] = g2[d2]);
return { $$typeof: l2, type: a2, key: k2, ref: h2, props: c2, _owner: K.current };
}
function N2(a2, b2) {
return { $$typeof: l2, type: a2.type, key: b2, ref: a2.ref, props: a2.props, _owner: a2._owner };
}
function O2(a2) {
return typeof a2 === "object" && a2 !== null && a2.$$typeof === l2;
}
function escape(a2) {
var b2 = { "=": "=0", ":": "=2" };
return "$" + a2.replace(/[=:]/g, function(a3) {
return b2[a3];
});
}
var P2 = /\/+/g;
function Q(a2, b2) {
return typeof a2 === "object" && a2 !== null && a2.key != null ? escape("" + a2.key) : b2.toString(36);
}
function R2(a2, b2, e2, d2, c2) {
var k2 = typeof a2;
if (k2 === "undefined" || k2 === "boolean")
a2 = null;
var h2 = false;
if (a2 === null)
h2 = true;
else
switch (k2) {
case "string":
case "number":
h2 = true;
break;
case "object":
switch (a2.$$typeof) {
case l2:
case n2:
h2 = true;
}
}
if (h2)
return h2 = a2, c2 = c2(h2), a2 = d2 === "" ? "." + Q(h2, 0) : d2, I2(c2) ? (e2 = "", a2 != null && (e2 = a2.replace(P2, "$&/") + "/"), R2(c2, b2, e2, "", function(a3) {
return a3;
})) : c2 != null && (O2(c2) && (c2 = N2(c2, e2 + (!c2.key || h2 && h2.key === c2.key ? "" : ("" + c2.key).replace(P2, "$&/") + "/") + a2)), b2.push(c2)), 1;
h2 = 0;
d2 = d2 === "" ? "." : d2 + ":";
if (I2(a2))
for (var g2 = 0; g2 < a2.length; g2++) {
k2 = a2[g2];
var f2 = d2 + Q(k2, g2);
h2 += R2(k2, b2, e2, f2, c2);
}
else if (f2 = A2(a2), typeof f2 === "function")
for (a2 = f2.call(a2), g2 = 0; !(k2 = a2.next()).done; )
k2 = k2.value, f2 = d2 + Q(k2, g2++), h2 += R2(k2, b2, e2, f2, c2);
else if (k2 === "object")
throw b2 = String(a2), Error("Objects are not valid as a React child (found: " + (b2 === "[object Object]" ? "object with keys {" + Object.keys(a2).join(", ") + "}" : b2) + "). If you meant to render a collection of children, use an array instead.");
return h2;
}
function S2(a2, b2, e2) {
if (a2 == null)
return a2;
var d2 = [], c2 = 0;
R2(a2, d2, "", "", function(a3) {
return b2.call(e2, a3, c2++);
});
return d2;
}
function T2(a2) {
if (a2._status === -1) {
var b2 = a2._result;
b2 = b2();
b2.then(function(b3) {
if (a2._status === 0 || a2._status === -1)
a2._status = 1, a2._result = b3;
}, function(b3) {
if (a2._status === 0 || a2._status === -1)
a2._status = 2, a2._result = b3;
});
a2._status === -1 && (a2._status = 0, a2._result = b2);
}
if (a2._status === 1)
return a2._result.default;
throw a2._result;
}
var U = { current: null };
var V = { transition: null };
var W = { ReactCurrentDispatcher: U, ReactCurrentBatchConfig: V, ReactCurrentOwner: K };
exports.Children = { map: S2, forEach: function(a2, b2, e2) {
S2(a2, function() {
b2.apply(this, arguments);
}, e2);
}, count: function(a2) {
var b2 = 0;
S2(a2, function() {
b2++;
});
return b2;
}, toArray: function(a2) {
return S2(a2, function(a3) {
return a3;
}) || [];
}, only: function(a2) {
if (!O2(a2))
throw Error("React.Children.only expected to receive a single React element child.");
return a2;
} };
exports.Component = E2;
exports.Fragment = p2;
exports.Profiler = r2;
exports.PureComponent = G;
exports.StrictMode = q;
exports.Suspense = w2;
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W;
exports.cloneElement = function(a2, b2, e2) {
if (a2 === null || a2 === void 0)
throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a2 + ".");
var d2 = C2({}, a2.props), c2 = a2.key, k2 = a2.ref, h2 = a2._owner;
if (b2 != null) {
b2.ref !== void 0 && (k2 = b2.ref, h2 = K.current);
b2.key !== void 0 && (c2 = "" + b2.key);
if (a2.type && a2.type.defaultProps)
var g2 = a2.type.defaultProps;
for (f2 in b2)
J.call(b2, f2) && !L2.hasOwnProperty(f2) && (d2[f2] = b2[f2] === void 0 && g2 !== void 0 ? g2[f2] : b2[f2]);
}
var f2 = arguments.length - 2;
if (f2 === 1)
d2.children = e2;
else if (1 < f2) {
g2 = Array(f2);
for (var m2 = 0; m2 < f2; m2++)
g2[m2] = arguments[m2 + 2];
d2.children = g2;
}
return { $$typeof: l2, type: a2.type, key: c2, ref: k2, props: d2, _owner: h2 };
};
exports.createContext = function(a2) {
a2 = { $$typeof: u2, _currentValue: a2, _currentValue2: a2, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null };
a2.Provider = { $$typeof: t3, _context: a2 };
return a2.Consumer = a2;
};
exports.createElement = M2;
exports.createFactory = function(a2) {
var b2 = M2.bind(null, a2);
b2.type = a2;
return b2;
};
exports.createRef = function() {
return { current: null };
};
exports.forwardRef = function(a2) {
return { $$typeof: v2, render: a2 };
};
exports.isValidElement = O2;
exports.lazy = function(a2) {
return { $$typeof: y2, _payload: { _status: -1, _result: a2 }, _init: T2 };
};
exports.memo = function(a2, b2) {
return { $$typeof: x2, type: a2, compare: b2 === void 0 ? null : b2 };
};
exports.startTransition = function(a2) {
var b2 = V.transition;
V.transition = {};
try {
a2();
} finally {
V.transition = b2;
}
};
exports.unstable_act = function() {
throw Error("act(...) is not supported in production builds of React.");
};
exports.useCallback = function(a2, b2) {
return U.current.useCallback(a2, b2);
};
exports.useContext = function(a2) {
return U.current.useContext(a2);
};
exports.useDebugValue = function() {
};
exports.useDeferredValue = function(a2) {
return U.current.useDeferredValue(a2);
};
exports.useEffect = function(a2, b2) {
return U.current.useEffect(a2, b2);
};
exports.useId = function() {
return U.current.useId();
};
exports.useImperativeHandle = function(a2, b2, e2) {
return U.current.useImperativeHandle(a2, b2, e2);
};
exports.useInsertionEffect = function(a2, b2) {
return U.current.useInsertionEffect(a2, b2);
};
exports.useLayoutEffect = function(a2, b2) {
return U.current.useLayoutEffect(a2, b2);
};
exports.useMemo = function(a2, b2) {
return U.current.useMemo(a2, b2);
};
exports.useReducer = function(a2, b2, e2) {
return U.current.useReducer(a2, b2, e2);
};
exports.useRef = function(a2) {
return U.current.useRef(a2);
};
exports.useState = function(a2) {
return U.current.useState(a2);
};
exports.useSyncExternalStore = function(a2, b2, e2) {
return U.current.useSyncExternalStore(a2, b2, e2);
};
exports.useTransition = function() {
return U.current.useTransition();
};
exports.version = "18.2.0";
}
});
// node_modules/react/index.js
var require_react = __commonJS({
"node_modules/react/index.js"(exports, module2) {
"use strict";
if (true) {
module2.exports = require_react_production_min();
} else {
module2.exports = null;
}
}
});
// node_modules/jotai/esm/react.mjs
function useAtomValue(atom3, options) {
const store = useStore(options);
const [[valueFromReducer, storeFromReducer, atomFromReducer], rerender] = (0, import_react.useReducer)((prev) => {
const nextValue = store.get(atom3);
if (Object.is(prev[0], nextValue) && prev[1] === store && prev[2] === atom3) {
return prev;
}
return [nextValue, store, atom3];
}, void 0, () => [store.get(atom3), store, atom3]);
let value = valueFromReducer;
if (storeFromReducer !== store || atomFromReducer !== atom3) {
rerender();
value = store.get(atom3);
}
const delay = options == null ? void 0 : options.delay;
(0, import_react.useEffect)(() => {
const unsub = store.sub(atom3, () => {
if (typeof delay === "number") {
setTimeout(rerender, delay);
return;
}
rerender();
});
rerender();
return unsub;
}, [store, atom3, delay]);
(0, import_react.useDebugValue)(value);
return isPromiseLike2(value) ? use(value) : value;
}
function useSetAtom(atom3, options) {
const store = useStore(options);
const setAtom = (0, import_react.useCallback)((...args) => {
if ((import_meta2.env ? import_meta2.env.MODE : void 0) !== "production" && !("write" in atom3)) {
throw new Error("not writable atom");
}
return store.set(atom3, ...args);
}, [store, atom3]);
return setAtom;
}
var import_react, import_meta2, StoreContext, useStore, Provider, isPromiseLike2, use;
var init_react = __esm({
"node_modules/jotai/esm/react.mjs"() {
import_react = __toESM(require_react(), 1);
init_vanilla();
import_meta2 = {};
"use client";
StoreContext = (0, import_react.createContext)(void 0);
useStore = (options) => {
const store = (0, import_react.useContext)(StoreContext);
return (options == null ? void 0 : options.store) || store || getDefaultStore();
};
Provider = ({
children,
store
}) => {
const storeRef = (0, import_react.useRef)();
if (!store && !storeRef.current) {
storeRef.current = createStore();
}
return (0, import_react.createElement)(StoreContext.Provider, {
value: store || storeRef.current
}, children);
};
isPromiseLike2 = (x2) => typeof (x2 == null ? void 0 : x2.then) === "function";
use = import_react.default.use || ((promise) => {
if (promise.status === "pending") {
throw promise;
} else if (promise.status === "fulfilled") {
return promise.value;
} else if (promise.status === "rejected") {
throw promise.reason;
} else {
promise.status = "pending";
promise.then((v2) => {
promise.status = "fulfilled";
promise.value = v2;
}, (e2) => {
promise.status = "rejected";
promise.reason = e2;
});
throw promise;
}
});
}
});
// node_modules/jotai/esm/index.mjs
var init_esm = __esm({
"node_modules/jotai/esm/index.mjs"() {
init_vanilla();
init_react();
}
});
// src/stores/dominant-hand-store.ts
function setDominantHand(value) {
dominantHandStore.set(dominantHandAtom, value);
}
function useDominantHand() {
return useAtomValue(dominantHandAtom, { store: dominantHandStore });
}
var dominantHandAtom, dominantHandStore;
var init_dominant_hand_store = __esm({
"src/stores/dominant-hand-store.ts"() {
init_esm();
dominantHandAtom = atom("right");
dominantHandStore = getDefaultStore();
}
});
// manifest.json
var manifest_default;
var init_manifest = __esm({
"manifest.json"() {
manifest_default = {
id: "ink",
name: "Ink",
author: "Dale de Silva",
description: "Hand write or draw directly between paragraphs in your notes using a digital pen, stylus, or Apple pencil. Useful for handwriting, sketches, scribbles, or even math equations and scientific notation. Runs on the tldraw framework and drawing provides an infinite canvas.",
version: "0.5.6",
minAppVersion: "1.8.7",
authorUrl: "https://designdebt.club",
fundingUrl: "https://ko-fi.com/daledesilva",
isDesktopOnly: false
};
}
});
// src/constants.ts
var PLUGIN_VERSION, TLDRAW_VERSION, INK_CANVAS_FORMAT_VERSION, INK_EMBED_BASE_URL, LOCAL_STORAGE_PREFIX, WRITE_FILE_V1_EXT, DRAW_FILE_V1_EXT, WRITE_EMBED_KEY, DRAW_EMBED_KEY, MENUBAR_HEIGHT_PX, WRITE_SHORT_DELAY_MS, WRITE_LONG_DELAY_MS, DRAW_SHORT_DELAY_MS, DRAW_LONG_DELAY_MS, WRITING_PAGE_WIDTH, WRITING_LINE_HEIGHT, WRITING_MIN_PAGE_HEIGHT, DRAWING_INITIAL_WIDTH, DRAWING_INITIAL_ASPECT_RATIO, DRAWING_INITIAL_HEIGHT;
var init_constants = __esm({
"src/constants.ts"() {
init_manifest();
PLUGIN_VERSION = manifest_default.version;
TLDRAW_VERSION = "2.4.3";
INK_CANVAS_FORMAT_VERSION = "0.5.0";
INK_EMBED_BASE_URL = "https://youtu.be/2arL1jh8ihA";
LOCAL_STORAGE_PREFIX = "au_ink_";
WRITE_FILE_V1_EXT = "writing";
DRAW_FILE_V1_EXT = "drawing";
WRITE_EMBED_KEY = "handwritten-ink";
DRAW_EMBED_KEY = "handdrawn-ink";
MENUBAR_HEIGHT_PX = 100;
WRITE_SHORT_DELAY_MS = 500;
WRITE_LONG_DELAY_MS = 2e3;
DRAW_SHORT_DELAY_MS = 500;
DRAW_LONG_DELAY_MS = 2e3;
WRITING_PAGE_WIDTH = 2e3;
WRITING_LINE_HEIGHT = 150;
WRITING_MIN_PAGE_HEIGHT = WRITING_LINE_HEIGHT * 2.5;
DRAWING_INITIAL_WIDTH = 500;
DRAWING_INITIAL_ASPECT_RATIO = 1;
DRAWING_INITIAL_HEIGHT = Math.round(DRAWING_INITIAL_WIDTH * DRAWING_INITIAL_ASPECT_RATIO);
}
});
// src/stores/global-store.ts
function setGlobals(globals) {
const store = getDefaultStore();
store.set(globalsAtom, globals);
}
function getGlobals() {
const store = getDefaultStore();
const globals = store.get(globalsAtom);
if (!globals) {
throw new Error(`Project Browser plugin globals isn't available yet`);
}
return globals;
}
var globalsAtom;
var init_global_store = __esm({
"src/stores/global-store.ts"() {
init_esm();
globalsAtom = atom();
}
});
// src/logic/utils/log-to-vault.ts
function getTodayDateString() {
const now = new Date();
const yyyy = now.getFullYear();
const mm = String(now.getMonth() + 1).padStart(2, "0");
const dd = String(now.getDate()).padStart(2, "0");
return `${yyyy}-${mm}-${dd}`;
}
function getTimestamp() {
const now = new Date();
const hh = String(now.getHours()).padStart(2, "0");
const min4 = String(now.getMinutes()).padStart(2, "0");
const ss = String(now.getSeconds()).padStart(2, "0");
const ms = String(now.getMilliseconds()).padStart(3, "0");
return `${hh}:${min4}:${ss}.${ms}`;
}
function logToVault(message) {
if (!getGlobals().plugin.settings.debugLoggingEnabled)
return;
const filename = `ink-debug_${getTodayDateString()}.md`;
const line = `[${getTimestamp()}] ${message}
`;
void getGlobals().plugin.app.vault.adapter.append(filename, line);
}
var init_log_to_vault = __esm({
"src/logic/utils/log-to-vault.ts"() {
init_global_store();
}
});
// src/components/formats/current/utils/ink-file-storage-engine.ts
function getInkFileStorageEngine(fileData) {
return fileData.inkCanvas != null ? "ink-canvas" : "tldraw";
}
function isInkCanvasFile(fileData) {
return getInkFileStorageEngine(fileData) === "ink-canvas";
}
var init_ink_file_storage_engine = __esm({
"src/components/formats/current/utils/ink-file-storage-engine.ts"() {
}
});
// src/defaults/empty-drawing-embed.svg
var empty_drawing_embed_default;
var init_empty_drawing_embed = __esm({
"src/defaults/empty-drawing-embed.svg"() {
empty_drawing_embed_default = '';
}
});
// src/components/formats/current/utils/build-file-data.ts
var buildInkCanvasDrawingFileData, buildInkCanvasWritingFileData;
var init_build_file_data = __esm({
"src/components/formats/current/utils/build-file-data.ts"() {
init_constants();
buildInkCanvasDrawingFileData = (props) => {
return {
meta: {
pluginVersion: PLUGIN_VERSION,
tldrawVersion: "",
fileType: "inkDrawing"
},
tldraw: {},
inkCanvas: props.inkCanvasSnapshot,
svgString: props.svgString
};
};
buildInkCanvasWritingFileData = (props) => {
return {
meta: {
pluginVersion: PLUGIN_VERSION,
tldrawVersion: "",
fileType: "inkWriting"
},
tldraw: {},
inkCanvas: props.inkCanvasSnapshot,
svgString: props.svgString
};
};
}
});
// node_modules/@xmldom/xmldom/lib/conventions.js
var require_conventions = __commonJS({
"node_modules/@xmldom/xmldom/lib/conventions.js"(exports) {
"use strict";
function find(list, predicate, ac) {
if (ac === void 0) {
ac = Array.prototype;
}
if (list && typeof ac.find === "function") {
return ac.find.call(list, predicate);
}
for (var i2 = 0; i2 < list.length; i2++) {
if (Object.prototype.hasOwnProperty.call(list, i2)) {
var item = list[i2];
if (predicate.call(void 0, item, i2, list)) {
return item;
}
}
}
}
function freeze(object2, oc) {
if (oc === void 0) {
oc = Object;
}
return oc && typeof oc.freeze === "function" ? oc.freeze(object2) : object2;
}
function assign(target, source) {
if (target === null || typeof target !== "object") {
throw new TypeError("target is not an object");
}
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
return target;
}
var MIME_TYPE = freeze({
HTML: "text/html",
isHTML: function(value) {
return value === MIME_TYPE.HTML;
},
XML_APPLICATION: "application/xml",
XML_TEXT: "text/xml",
XML_XHTML_APPLICATION: "application/xhtml+xml",
XML_SVG_IMAGE: "image/svg+xml"
});
var NAMESPACE = freeze({
HTML: "http://www.w3.org/1999/xhtml",
isHTML: function(uri) {
return uri === NAMESPACE.HTML;
},
SVG: "http://www.w3.org/2000/svg",
XML: "http://www.w3.org/XML/1998/namespace",
XMLNS: "http://www.w3.org/2000/xmlns/"
});
exports.assign = assign;
exports.find = find;
exports.freeze = freeze;
exports.MIME_TYPE = MIME_TYPE;
exports.NAMESPACE = NAMESPACE;
}
});
// node_modules/@xmldom/xmldom/lib/dom.js
var require_dom = __commonJS({
"node_modules/@xmldom/xmldom/lib/dom.js"(exports) {
var conventions = require_conventions();
var find = conventions.find;
var NAMESPACE = conventions.NAMESPACE;
function notEmptyString(input) {
return input !== "";
}
function splitOnASCIIWhitespace(input) {
return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [];
}
function orderedSetReducer(current, element) {
if (!current.hasOwnProperty(element)) {
current[element] = true;
}
return current;
}
function toOrderedSet(input) {
if (!input)
return [];
var list = splitOnASCIIWhitespace(input);
return Object.keys(list.reduce(orderedSetReducer, {}));
}
function arrayIncludes(list) {
return function(element) {
return list && list.indexOf(element) !== -1;
};
}
function copy(src, dest) {
for (var p2 in src) {
if (Object.prototype.hasOwnProperty.call(src, p2)) {
dest[p2] = src[p2];
}
}
}
function _extends(Class, Super) {
var pt = Class.prototype;
if (!(pt instanceof Super)) {
let t4 = function() {
};
var t3 = t4;
;
t4.prototype = Super.prototype;
t4 = new t4();
copy(pt, t4);
Class.prototype = pt = t4;
}
if (pt.constructor != Class) {
if (typeof Class != "function") {
console.error("unknown Class:" + Class);
}
pt.constructor = Class;
}
}
var NodeType = {};
var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;
var TEXT_NODE = NodeType.TEXT_NODE = 3;
var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;
var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;
var ENTITY_NODE = NodeType.ENTITY_NODE = 6;
var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;
var COMMENT_NODE = NodeType.COMMENT_NODE = 8;
var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;
var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
var ExceptionCode = {};
var ExceptionMessage = {};
var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1);
var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2);
var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3);
var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4);
var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5);
var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6);
var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7);
var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8);
var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9);
var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10);
var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11);
var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12);
var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13);
var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14);
var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15);
function DOMException2(code2, message) {
if (message instanceof Error) {
var error2 = message;
} else {
error2 = this;
Error.call(this, ExceptionMessage[code2]);
this.message = ExceptionMessage[code2];
if (Error.captureStackTrace)
Error.captureStackTrace(this, DOMException2);
}
error2.code = code2;
if (message)
this.message = this.message + ": " + message;
return error2;
}
DOMException2.prototype = Error.prototype;
copy(ExceptionCode, DOMException2);
function NodeList() {
}
NodeList.prototype = {
length: 0,
item: function(index3) {
return index3 >= 0 && index3 < this.length ? this[index3] : null;
},
toString: function(isHTML, nodeFilter, options) {
var requireWellFormed = !!options && !!options.requireWellFormed;
for (var buf = [], i2 = 0; i2 < this.length; i2++) {
serializeToString(this[i2], buf, isHTML, nodeFilter, null, requireWellFormed);
}
return buf.join("");
},
filter: function(predicate) {
return Array.prototype.filter.call(this, predicate);
},
indexOf: function(item) {
return Array.prototype.indexOf.call(this, item);
}
};
function LiveNodeList(node, refresh) {
this._node = node;
this._refresh = refresh;
_updateLiveList(this);
}
function _updateLiveList(list) {
var inc = list._node._inc || list._node.ownerDocument._inc;
if (list._inc !== inc) {
var ls = list._refresh(list._node);
__set__(list, "length", ls.length);
if (!list.$$length || ls.length < list.$$length) {
for (var i2 = ls.length; i2 in list; i2++) {
if (Object.prototype.hasOwnProperty.call(list, i2)) {
delete list[i2];
}
}
}
copy(ls, list);
list._inc = inc;
}
}
LiveNodeList.prototype.item = function(i2) {
_updateLiveList(this);
return this[i2] || null;
};
_extends(LiveNodeList, NodeList);
function NamedNodeMap() {
}
function _findNodeIndex(list, node) {
var i2 = list.length;
while (i2--) {
if (list[i2] === node) {
return i2;
}
}
}
function _addNamedNode(el, list, newAttr, oldAttr) {
if (oldAttr) {
list[_findNodeIndex(list, oldAttr)] = newAttr;
} else {
list[list.length++] = newAttr;
}
if (el) {
newAttr.ownerElement = el;
var doc = el.ownerDocument;
if (doc) {
oldAttr && _onRemoveAttribute(doc, el, oldAttr);
_onAddAttribute(doc, el, newAttr);
}
}
}
function _removeNamedNode(el, list, attr) {
var i2 = _findNodeIndex(list, attr);
if (i2 >= 0) {
var lastIndex = list.length - 1;
while (i2 < lastIndex) {
list[i2] = list[++i2];
}
list.length = lastIndex;
if (el) {
var doc = el.ownerDocument;
if (doc) {
_onRemoveAttribute(doc, el, attr);
attr.ownerElement = null;
}
}
} else {
throw new DOMException2(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr));
}
}
NamedNodeMap.prototype = {
length: 0,
item: NodeList.prototype.item,
getNamedItem: function(key) {
var i2 = this.length;
while (i2--) {
var attr = this[i2];
if (attr.nodeName == key) {
return attr;
}
}
},
setNamedItem: function(attr) {
var el = attr.ownerElement;
if (el && el != this._ownerElement) {
throw new DOMException2(INUSE_ATTRIBUTE_ERR);
}
var oldAttr = this.getNamedItem(attr.nodeName);
_addNamedNode(this._ownerElement, this, attr, oldAttr);
return oldAttr;
},
setNamedItemNS: function(attr) {
var el = attr.ownerElement, oldAttr;
if (el && el != this._ownerElement) {
throw new DOMException2(INUSE_ATTRIBUTE_ERR);
}
oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
_addNamedNode(this._ownerElement, this, attr, oldAttr);
return oldAttr;
},
removeNamedItem: function(key) {
var attr = this.getNamedItem(key);
_removeNamedNode(this._ownerElement, this, attr);
return attr;
},
removeNamedItemNS: function(namespaceURI, localName) {
var attr = this.getNamedItemNS(namespaceURI, localName);
_removeNamedNode(this._ownerElement, this, attr);
return attr;
},
getNamedItemNS: function(namespaceURI, localName) {
var i2 = this.length;
while (i2--) {
var node = this[i2];
if (node.localName == localName && node.namespaceURI == namespaceURI) {
return node;
}
}
return null;
}
};
function DOMImplementation() {
}
DOMImplementation.prototype = {
hasFeature: function(feature, version2) {
return true;
},
createDocument: function(namespaceURI, qualifiedName, doctype) {
var doc = new Document();
doc.implementation = this;
doc.childNodes = new NodeList();
doc.doctype = doctype || null;
if (doctype) {
doc.appendChild(doctype);
}
if (qualifiedName) {
var root = doc.createElementNS(namespaceURI, qualifiedName);
doc.appendChild(root);
}
return doc;
},
createDocumentType: function(qualifiedName, publicId, systemId) {
var node = new DocumentType();
node.name = qualifiedName;
node.nodeName = qualifiedName;
node.publicId = publicId || "";
node.systemId = systemId || "";
return node;
}
};
function Node2() {
}
Node2.prototype = {
firstChild: null,
lastChild: null,
previousSibling: null,
nextSibling: null,
attributes: null,
parentNode: null,
childNodes: null,
ownerDocument: null,
nodeValue: null,
namespaceURI: null,
prefix: null,
localName: null,
insertBefore: function(newChild, refChild) {
return _insertBefore(this, newChild, refChild);
},
replaceChild: function(newChild, oldChild) {
_insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
if (oldChild) {
this.removeChild(oldChild);
}
},
removeChild: function(oldChild) {
return _removeChild(this, oldChild);
},
appendChild: function(newChild) {
return this.insertBefore(newChild, null);
},
hasChildNodes: function() {
return this.firstChild != null;
},
cloneNode: function(deep) {
return cloneNode(this.ownerDocument || this, this, deep);
},
normalize: function() {
walkDOM(this, null, {
enter: function(node) {
var child = node.firstChild;
while (child) {
var next = child.nextSibling;
if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
node.removeChild(next);
child.appendData(next.data);
} else {
child = next;
}
}
return true;
}
});
},
isSupported: function(feature, version2) {
return this.ownerDocument.implementation.hasFeature(feature, version2);
},
hasAttributes: function() {
return this.attributes.length > 0;
},
lookupPrefix: function(namespaceURI) {
var el = this;
while (el) {
var map = el._nsMap;
if (map) {
for (var n2 in map) {
if (Object.prototype.hasOwnProperty.call(map, n2) && map[n2] === namespaceURI) {
return n2;
}
}
}
el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
}
return null;
},
lookupNamespaceURI: function(prefix) {
var el = this;
while (el) {
var map = el._nsMap;
if (map) {
if (Object.prototype.hasOwnProperty.call(map, prefix)) {
return map[prefix];
}
}
el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
}
return null;
},
isDefaultNamespace: function(namespaceURI) {
var prefix = this.lookupPrefix(namespaceURI);
return prefix == null;
}
};
function _xmlEncoder(c2) {
return c2 == "<" && "<" || c2 == ">" && ">" || c2 == "&" && "&" || c2 == '"' && """ || "" + c2.charCodeAt() + ";";
}
copy(NodeType, Node2);
copy(NodeType, Node2.prototype);
function _visitNode(node, callback) {
return walkDOM(node, null, { enter: function(n2) {
return callback(n2) ? walkDOM.STOP : true;
} }) === walkDOM.STOP;
}
function walkDOM(node, context, callbacks) {
var stack2 = [{ node, context, phase: walkDOM.ENTER }];
while (stack2.length > 0) {
var frame3 = stack2.pop();
if (frame3.phase === walkDOM.ENTER) {
var childContext = callbacks.enter(frame3.node, frame3.context);
if (childContext === walkDOM.STOP) {
return walkDOM.STOP;
}
stack2.push({ node: frame3.node, context: childContext, phase: walkDOM.EXIT });
if (childContext === null || childContext === void 0) {
continue;
}
var child = frame3.node.lastChild;
while (child) {
stack2.push({ node: child, context: childContext, phase: walkDOM.ENTER });
child = child.previousSibling;
}
} else {
if (callbacks.exit) {
callbacks.exit(frame3.node, frame3.context);
}
}
}
}
walkDOM.STOP = Symbol("walkDOM.STOP");
walkDOM.ENTER = 0;
walkDOM.EXIT = 1;
function Document() {
this.ownerDocument = this;
}
function _onAddAttribute(doc, el, newAttr) {
doc && doc._inc++;
var ns = newAttr.namespaceURI;
if (ns === NAMESPACE.XMLNS) {
el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value;
}
}
function _onRemoveAttribute(doc, el, newAttr, remove2) {
doc && doc._inc++;
var ns = newAttr.namespaceURI;
if (ns === NAMESPACE.XMLNS) {
delete el._nsMap[newAttr.prefix ? newAttr.localName : ""];
}
}
function _onUpdateChild(doc, el, newChild) {
if (doc && doc._inc) {
doc._inc++;
var cs = el.childNodes;
if (newChild) {
cs[cs.length++] = newChild;
} else {
var child = el.firstChild;
var i2 = 0;
while (child) {
cs[i2++] = child;
child = child.nextSibling;
}
cs.length = i2;
delete cs[cs.length];
}
}
}
function _removeChild(parentNode, child) {
var previous = child.previousSibling;
var next = child.nextSibling;
if (previous) {
previous.nextSibling = next;
} else {
parentNode.firstChild = next;
}
if (next) {
next.previousSibling = previous;
} else {
parentNode.lastChild = previous;
}
child.parentNode = null;
child.previousSibling = null;
child.nextSibling = null;
_onUpdateChild(parentNode.ownerDocument, parentNode);
return child;
}
function hasValidParentNodeType(node) {
return node && (node.nodeType === Node2.DOCUMENT_NODE || node.nodeType === Node2.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node2.ELEMENT_NODE);
}
function hasInsertableNodeType(node) {
return node && (isElementNode(node) || isTextNode(node) || isDocTypeNode(node) || node.nodeType === Node2.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node2.COMMENT_NODE || node.nodeType === Node2.PROCESSING_INSTRUCTION_NODE);
}
function isDocTypeNode(node) {
return node && node.nodeType === Node2.DOCUMENT_TYPE_NODE;
}
function isElementNode(node) {
return node && node.nodeType === Node2.ELEMENT_NODE;
}
function isTextNode(node) {
return node && node.nodeType === Node2.TEXT_NODE;
}
function isElementInsertionPossible(doc, child) {
var parentChildNodes = doc.childNodes || [];
if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) {
return false;
}
var docTypeNode = find(parentChildNodes, isDocTypeNode);
return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
}
function isElementReplacementPossible(doc, child) {
var parentChildNodes = doc.childNodes || [];
function hasElementChildThatIsNotChild(node) {
return isElementNode(node) && node !== child;
}
if (find(parentChildNodes, hasElementChildThatIsNotChild)) {
return false;
}
var docTypeNode = find(parentChildNodes, isDocTypeNode);
return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
}
function assertPreInsertionValidity1to5(parent, node, child) {
if (!hasValidParentNodeType(parent)) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType);
}
if (child && child.parentNode !== parent) {
throw new DOMException2(NOT_FOUND_ERR, "child not in parent");
}
if (!hasInsertableNodeType(node) || isDocTypeNode(node) && parent.nodeType !== Node2.DOCUMENT_NODE) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType);
}
}
function assertPreInsertionValidityInDocument(parent, node, child) {
var parentChildNodes = parent.childNodes || [];
var nodeChildNodes = node.childNodes || [];
if (node.nodeType === Node2.DOCUMENT_FRAGMENT_NODE) {
var nodeChildElements = nodeChildNodes.filter(isElementNode);
if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
}
if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
}
}
if (isElementNode(node)) {
if (!isElementInsertionPossible(parent, child)) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
}
}
if (isDocTypeNode(node)) {
if (find(parentChildNodes, isDocTypeNode)) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
}
var parentElementChild = find(parentChildNodes, isElementNode);
if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
}
if (!child && parentElementChild) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
}
}
}
function assertPreReplacementValidityInDocument(parent, node, child) {
var parentChildNodes = parent.childNodes || [];
var nodeChildNodes = node.childNodes || [];
if (node.nodeType === Node2.DOCUMENT_FRAGMENT_NODE) {
var nodeChildElements = nodeChildNodes.filter(isElementNode);
if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
}
if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
}
}
if (isElementNode(node)) {
if (!isElementReplacementPossible(parent, child)) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
}
}
if (isDocTypeNode(node)) {
let hasDoctypeChildThatIsNotChild2 = function(node2) {
return isDocTypeNode(node2) && node2 !== child;
};
var hasDoctypeChildThatIsNotChild = hasDoctypeChildThatIsNotChild2;
if (find(parentChildNodes, hasDoctypeChildThatIsNotChild2)) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
}
var parentElementChild = find(parentChildNodes, isElementNode);
if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
throw new DOMException2(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
}
}
}
function _insertBefore(parent, node, child, _inDocumentAssertion) {
assertPreInsertionValidity1to5(parent, node, child);
if (parent.nodeType === Node2.DOCUMENT_NODE) {
(_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);
}
var cp = node.parentNode;
if (cp) {
cp.removeChild(node);
}
if (node.nodeType === DOCUMENT_FRAGMENT_NODE) {
var newFirst = node.firstChild;
if (newFirst == null) {
return node;
}
var newLast = node.lastChild;
} else {
newFirst = newLast = node;
}
var pre = child ? child.previousSibling : parent.lastChild;
newFirst.previousSibling = pre;
newLast.nextSibling = child;
if (pre) {
pre.nextSibling = newFirst;
} else {
parent.firstChild = newFirst;
}
if (child == null) {
parent.lastChild = newLast;
} else {
child.previousSibling = newLast;
}
do {
newFirst.parentNode = parent;
var targetDoc = parent.ownerDocument || parent;
_updateOwnerDocument(newFirst, targetDoc);
} while (newFirst !== newLast && (newFirst = newFirst.nextSibling));
_onUpdateChild(parent.ownerDocument || parent, parent);
if (node.nodeType == DOCUMENT_FRAGMENT_NODE) {
node.firstChild = node.lastChild = null;
}
return node;
}
function _updateOwnerDocument(node, newOwnerDocument) {
if (node.ownerDocument === newOwnerDocument) {
return;
}
node.ownerDocument = newOwnerDocument;
if (node.nodeType === ELEMENT_NODE && node.attributes) {
for (var i2 = 0; i2 < node.attributes.length; i2++) {
var attr = node.attributes.item(i2);
if (attr) {
attr.ownerDocument = newOwnerDocument;
}
}
}
var child = node.firstChild;
while (child) {
_updateOwnerDocument(child, newOwnerDocument);
child = child.nextSibling;
}
}
function _appendSingleChild(parentNode, newChild) {
if (newChild.parentNode) {
newChild.parentNode.removeChild(newChild);
}
newChild.parentNode = parentNode;
newChild.previousSibling = parentNode.lastChild;
newChild.nextSibling = null;
if (newChild.previousSibling) {
newChild.previousSibling.nextSibling = newChild;
} else {
parentNode.firstChild = newChild;
}
parentNode.lastChild = newChild;
_onUpdateChild(parentNode.ownerDocument, parentNode, newChild);
var targetDoc = parentNode.ownerDocument || parentNode;
_updateOwnerDocument(newChild, targetDoc);
return newChild;
}
Document.prototype = {
nodeName: "#document",
nodeType: DOCUMENT_NODE,
doctype: null,
documentElement: null,
_inc: 1,
insertBefore: function(newChild, refChild) {
if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
var child = newChild.firstChild;
while (child) {
var next = child.nextSibling;
this.insertBefore(child, refChild);
child = next;
}
return newChild;
}
_insertBefore(this, newChild, refChild);
_updateOwnerDocument(newChild, this);
if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {
this.documentElement = newChild;
}
return newChild;
},
removeChild: function(oldChild) {
if (this.documentElement == oldChild) {
this.documentElement = null;
}
return _removeChild(this, oldChild);
},
replaceChild: function(newChild, oldChild) {
_insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
_updateOwnerDocument(newChild, this);
if (oldChild) {
this.removeChild(oldChild);
}
if (isElementNode(newChild)) {
this.documentElement = newChild;
}
},
importNode: function(importedNode, deep) {
return importNode(this, importedNode, deep);
},
getElementById: function(id) {
var rtv = null;
_visitNode(this.documentElement, function(node) {
if (node.nodeType == ELEMENT_NODE) {
if (node.getAttribute("id") == id) {
rtv = node;
return true;
}
}
});
return rtv;
},
getElementsByClassName: function(classNames49) {
var classNamesSet = toOrderedSet(classNames49);
return new LiveNodeList(this, function(base) {
var ls = [];
if (classNamesSet.length > 0) {
_visitNode(base.documentElement, function(node) {
if (node !== base && node.nodeType === ELEMENT_NODE) {
var nodeClassNames = node.getAttribute("class");
if (nodeClassNames) {
var matches = classNames49 === nodeClassNames;
if (!matches) {
var nodeClassNamesSet = toOrderedSet(nodeClassNames);
matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));
}
if (matches) {
ls.push(node);
}
}
}
});
}
return ls;
});
},
createElement: function(tagName) {
var node = new Element2();
node.ownerDocument = this;
node.nodeName = tagName;
node.tagName = tagName;
node.localName = tagName;
node.childNodes = new NodeList();
var attrs = node.attributes = new NamedNodeMap();
attrs._ownerElement = node;
return node;
},
createDocumentFragment: function() {
var node = new DocumentFragment();
node.ownerDocument = this;
node.childNodes = new NodeList();
return node;
},
createTextNode: function(data) {
var node = new Text();
node.ownerDocument = this;
node.appendData(data);
return node;
},
createComment: function(data) {
var node = new Comment();
node.ownerDocument = this;
node.appendData(data);
return node;
},
createCDATASection: function(data) {
if (data.indexOf("]]>") !== -1) {
throw new DOMException2(INVALID_CHARACTER_ERR, 'data contains "]]>"');
}
var node = new CDATASection();
node.ownerDocument = this;
node.appendData(data);
return node;
},
createProcessingInstruction: function(target, data) {
var node = new ProcessingInstruction();
node.ownerDocument = this;
node.tagName = node.nodeName = node.target = target;
node.nodeValue = node.data = data;
return node;
},
createAttribute: function(name) {
var node = new Attr();
node.ownerDocument = this;
node.name = name;
node.nodeName = name;
node.localName = name;
node.specified = true;
return node;
},
createEntityReference: function(name) {
var node = new EntityReference();
node.ownerDocument = this;
node.nodeName = name;
return node;
},
createElementNS: function(namespaceURI, qualifiedName) {
var node = new Element2();
var pl = qualifiedName.split(":");
var attrs = node.attributes = new NamedNodeMap();
node.childNodes = new NodeList();
node.ownerDocument = this;
node.nodeName = qualifiedName;
node.tagName = qualifiedName;
node.namespaceURI = namespaceURI;
if (pl.length == 2) {
node.prefix = pl[0];
node.localName = pl[1];
} else {
node.localName = qualifiedName;
}
attrs._ownerElement = node;
return node;
},
createAttributeNS: function(namespaceURI, qualifiedName) {
var node = new Attr();
var pl = qualifiedName.split(":");
node.ownerDocument = this;
node.nodeName = qualifiedName;
node.name = qualifiedName;
node.namespaceURI = namespaceURI;
node.specified = true;
if (pl.length == 2) {
node.prefix = pl[0];
node.localName = pl[1];
} else {
node.localName = qualifiedName;
}
return node;
}
};
_extends(Document, Node2);
function Element2() {
this._nsMap = {};
}
Element2.prototype = {
nodeType: ELEMENT_NODE,
hasAttribute: function(name) {
return this.getAttributeNode(name) != null;
},
getAttribute: function(name) {
var attr = this.getAttributeNode(name);
return attr && attr.value || "";
},
getAttributeNode: function(name) {
return this.attributes.getNamedItem(name);
},
setAttribute: function(name, value) {
var attr = this.ownerDocument.createAttribute(name);
attr.value = attr.nodeValue = "" + value;
this.setAttributeNode(attr);
},
removeAttribute: function(name) {
var attr = this.getAttributeNode(name);
attr && this.removeAttributeNode(attr);
},
appendChild: function(newChild) {
if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
return this.insertBefore(newChild, null);
} else {
return _appendSingleChild(this, newChild);
}
},
setAttributeNode: function(newAttr) {
return this.attributes.setNamedItem(newAttr);
},
setAttributeNodeNS: function(newAttr) {
return this.attributes.setNamedItemNS(newAttr);
},
removeAttributeNode: function(oldAttr) {
return this.attributes.removeNamedItem(oldAttr.nodeName);
},
removeAttributeNS: function(namespaceURI, localName) {
var old = this.getAttributeNodeNS(namespaceURI, localName);
old && this.removeAttributeNode(old);
},
hasAttributeNS: function(namespaceURI, localName) {
return this.getAttributeNodeNS(namespaceURI, localName) != null;
},
getAttributeNS: function(namespaceURI, localName) {
var attr = this.getAttributeNodeNS(namespaceURI, localName);
return attr && attr.value || "";
},
setAttributeNS: function(namespaceURI, qualifiedName, value) {
var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
attr.value = attr.nodeValue = "" + value;
this.setAttributeNode(attr);
},
getAttributeNodeNS: function(namespaceURI, localName) {
return this.attributes.getNamedItemNS(namespaceURI, localName);
},
getElementsByTagName: function(tagName) {
return new LiveNodeList(this, function(base) {
var ls = [];
_visitNode(base, function(node) {
if (node !== base && node.nodeType == ELEMENT_NODE && (tagName === "*" || node.tagName == tagName)) {
ls.push(node);
}
});
return ls;
});
},
getElementsByTagNameNS: function(namespaceURI, localName) {
return new LiveNodeList(this, function(base) {
var ls = [];
_visitNode(base, function(node) {
if (node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === "*" || node.namespaceURI === namespaceURI) && (localName === "*" || node.localName == localName)) {
ls.push(node);
}
});
return ls;
});
}
};
Document.prototype.getElementsByTagName = Element2.prototype.getElementsByTagName;
Document.prototype.getElementsByTagNameNS = Element2.prototype.getElementsByTagNameNS;
_extends(Element2, Node2);
function Attr() {
}
Attr.prototype.nodeType = ATTRIBUTE_NODE;
_extends(Attr, Node2);
function CharacterData() {
}
CharacterData.prototype = {
data: "",
substringData: function(offset5, count3) {
return this.data.substring(offset5, offset5 + count3);
},
appendData: function(text) {
text = this.data + text;
this.nodeValue = this.data = text;
this.length = text.length;
},
insertData: function(offset5, text) {
this.replaceData(offset5, 0, text);
},
appendChild: function(newChild) {
throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);
},
deleteData: function(offset5, count3) {
this.replaceData(offset5, count3, "");
},
replaceData: function(offset5, count3, text) {
var start2 = this.data.substring(0, offset5);
var end2 = this.data.substring(offset5 + count3);
text = start2 + text + end2;
this.nodeValue = this.data = text;
this.length = text.length;
}
};
_extends(CharacterData, Node2);
function Text() {
}
Text.prototype = {
nodeName: "#text",
nodeType: TEXT_NODE,
splitText: function(offset5) {
var text = this.data;
var newText = text.substring(offset5);
text = text.substring(0, offset5);
this.data = this.nodeValue = text;
this.length = text.length;
var newNode = this.ownerDocument.createTextNode(newText);
if (this.parentNode) {
this.parentNode.insertBefore(newNode, this.nextSibling);
}
return newNode;
}
};
_extends(Text, CharacterData);
function Comment() {
}
Comment.prototype = {
nodeName: "#comment",
nodeType: COMMENT_NODE
};
_extends(Comment, CharacterData);
function CDATASection() {
}
CDATASection.prototype = {
nodeName: "#cdata-section",
nodeType: CDATA_SECTION_NODE
};
_extends(CDATASection, CharacterData);
function DocumentType() {
}
DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
_extends(DocumentType, Node2);
function Notation() {
}
Notation.prototype.nodeType = NOTATION_NODE;
_extends(Notation, Node2);
function Entity() {
}
Entity.prototype.nodeType = ENTITY_NODE;
_extends(Entity, Node2);
function EntityReference() {
}
EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
_extends(EntityReference, Node2);
function DocumentFragment() {
}
DocumentFragment.prototype.nodeName = "#document-fragment";
DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
_extends(DocumentFragment, Node2);
function ProcessingInstruction() {
}
ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
_extends(ProcessingInstruction, Node2);
function XMLSerializer3() {
}
XMLSerializer3.prototype.serializeToString = function(node, isHtml, nodeFilter, options) {
return nodeSerializeToString.call(node, isHtml, nodeFilter, options);
};
Node2.prototype.toString = nodeSerializeToString;
function nodeSerializeToString(isHtml, nodeFilter, options) {
var requireWellFormed = !!options && !!options.requireWellFormed;
var buf = [];
var refNode = this.nodeType == 9 && this.documentElement || this;
var prefix = refNode.prefix;
var uri = refNode.namespaceURI;
if (uri && prefix == null) {
var prefix = refNode.lookupPrefix(uri);
if (prefix == null) {
var visibleNamespaces = [
{ namespace: uri, prefix: null }
];
}
}
serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces, requireWellFormed);
return buf.join("");
}
function needNamespaceDefine(node, isHTML, visibleNamespaces) {
var prefix = node.prefix || "";
var uri = node.namespaceURI;
if (!uri) {
return false;
}
if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {
return false;
}
var i2 = visibleNamespaces.length;
while (i2--) {
var ns = visibleNamespaces[i2];
if (ns.prefix === prefix) {
return ns.namespace !== uri;
}
}
return true;
}
function addSerializedAttribute(buf, qualifiedName, value) {
buf.push(" ", qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
}
function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces, requireWellFormed) {
if (!visibleNamespaces) {
visibleNamespaces = [];
}
walkDOM(node, { ns: visibleNamespaces, isHTML }, {
enter: function(n2, ctx) {
var ns = ctx.ns;
var html = ctx.isHTML;
if (nodeFilter) {
n2 = nodeFilter(n2);
if (n2) {
if (typeof n2 == "string") {
buf.push(n2);
return null;
}
} else {
return null;
}
}
switch (n2.nodeType) {
case ELEMENT_NODE:
var attrs = n2.attributes;
var len = attrs.length;
var nodeName = n2.tagName;
html = NAMESPACE.isHTML(n2.namespaceURI) || html;
var prefixedNodeName = nodeName;
if (!html && !n2.prefix && n2.namespaceURI) {
var defaultNS;
for (var ai = 0; ai < attrs.length; ai++) {
if (attrs.item(ai).name === "xmlns") {
defaultNS = attrs.item(ai).value;
break;
}
}
if (!defaultNS) {
for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
var nsEntry = ns[nsi];
if (nsEntry.prefix === "" && nsEntry.namespace === n2.namespaceURI) {
defaultNS = nsEntry.namespace;
break;
}
}
}
if (defaultNS !== n2.namespaceURI) {
for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
var nsEntry = ns[nsi];
if (nsEntry.namespace === n2.namespaceURI) {
if (nsEntry.prefix) {
prefixedNodeName = nsEntry.prefix + ":" + nodeName;
}
break;
}
}
}
}
buf.push("<", prefixedNodeName);
var childNs = ns.slice();
for (var i2 = 0; i2 < len; i2++) {
var attr = attrs.item(i2);
if (attr.prefix == "xmlns") {
childNs.push({ prefix: attr.localName, namespace: attr.value });
} else if (attr.nodeName == "xmlns") {
childNs.push({ prefix: "", namespace: attr.value });
}
}
for (var i2 = 0; i2 < len; i2++) {
var attr = attrs.item(i2);
if (needNamespaceDefine(attr, html, childNs)) {
var attrPrefix = attr.prefix || "";
var uri = attr.namespaceURI;
addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", uri);
childNs.push({ prefix: attrPrefix, namespace: uri });
}
var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
if (filteredAttr) {
if (typeof filteredAttr === "string") {
buf.push(filteredAttr);
} else {
addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
}
}
}
if (nodeName === prefixedNodeName && needNamespaceDefine(n2, html, childNs)) {
var nodePrefix = n2.prefix || "";
var uri = n2.namespaceURI;
addSerializedAttribute(buf, nodePrefix ? "xmlns:" + nodePrefix : "xmlns", uri);
childNs.push({ prefix: nodePrefix, namespace: uri });
}
var child = n2.firstChild;
if (child || html && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
buf.push(">");
if (html && /^script$/i.test(nodeName)) {
while (child) {
if (child.data) {
buf.push(child.data);
} else {
serializeToString(child, buf, html, nodeFilter, childNs.slice(), requireWellFormed);
}
child = child.nextSibling;
}
buf.push("", nodeName, ">");
return null;
}
return { ns: childNs, isHTML: html, tag: prefixedNodeName };
} else {
buf.push("/>");
return null;
}
case DOCUMENT_NODE:
case DOCUMENT_FRAGMENT_NODE:
return { ns: ns.slice(), isHTML: html, tag: null };
case ATTRIBUTE_NODE:
addSerializedAttribute(buf, n2.name, n2.value);
return null;
case TEXT_NODE:
buf.push(n2.data.replace(/[<&>]/g, _xmlEncoder));
return null;
case CDATA_SECTION_NODE:
if (requireWellFormed && n2.data.indexOf("]]>") !== -1) {
throw new DOMException2(INVALID_STATE_ERR, 'The CDATASection data contains "]]>"');
}
buf.push("/g, "]]]]>"), "]]>");
return null;
case COMMENT_NODE:
if (requireWellFormed && n2.data.indexOf("-->") !== -1) {
throw new DOMException2(INVALID_STATE_ERR, 'The comment node data contains "-->"');
}
buf.push("");
return null;
case DOCUMENT_TYPE_NODE:
if (requireWellFormed) {
if (n2.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n2.publicId)) {
throw new DOMException2(INVALID_STATE_ERR, "DocumentType publicId is not a valid PubidLiteral");
}
if (n2.systemId && !/^("[^"]*"|'[^']*')$/.test(n2.systemId)) {
throw new DOMException2(INVALID_STATE_ERR, "DocumentType systemId is not a valid SystemLiteral");
}
if (n2.internalSubset && n2.internalSubset.indexOf("]>") !== -1) {
throw new DOMException2(INVALID_STATE_ERR, 'DocumentType internalSubset contains "]>"');
}
}
var pubid = n2.publicId;
var sysid = n2.systemId;
buf.push("");
} else if (sysid && sysid != ".") {
buf.push(" SYSTEM ", sysid, ">");
} else {
var sub = n2.internalSubset;
if (sub) {
buf.push(" [", sub, "]");
}
buf.push(">");
}
return null;
case PROCESSING_INSTRUCTION_NODE:
if (requireWellFormed && n2.data.indexOf("?>") !== -1) {
throw new DOMException2(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
}
buf.push("", n2.target, " ", n2.data, "?>");
return null;
case ENTITY_REFERENCE_NODE:
buf.push("&", n2.nodeName, ";");
return null;
default:
buf.push("??", n2.nodeName);
return null;
}
},
exit: function(n2, childCtx) {
if (childCtx && childCtx.tag) {
buf.push("", childCtx.tag, ">");
}
}
});
}
function importNode(doc, node, deep) {
var destRoot;
walkDOM(node, null, {
enter: function(srcNode, destParent) {
var destNode = srcNode.cloneNode(false);
destNode.ownerDocument = doc;
destNode.parentNode = null;
if (destParent === null) {
destRoot = destNode;
} else {
destParent.appendChild(destNode);
}
var shouldDeep = srcNode.nodeType === ATTRIBUTE_NODE || deep;
return shouldDeep ? destNode : null;
}
});
return destRoot;
}
function cloneNode(doc, node, deep) {
var destRoot;
walkDOM(node, null, {
enter: function(srcNode, destParent) {
var destNode = new srcNode.constructor();
for (var n2 in srcNode) {
if (Object.prototype.hasOwnProperty.call(srcNode, n2)) {
var v2 = srcNode[n2];
if (typeof v2 != "object") {
if (v2 != destNode[n2]) {
destNode[n2] = v2;
}
}
}
}
if (srcNode.childNodes) {
destNode.childNodes = new NodeList();
}
destNode.ownerDocument = doc;
var shouldDeep = deep;
switch (destNode.nodeType) {
case ELEMENT_NODE:
var attrs = srcNode.attributes;
var attrs2 = destNode.attributes = new NamedNodeMap();
var len = attrs.length;
attrs2._ownerElement = destNode;
for (var i2 = 0; i2 < len; i2++) {
destNode.setAttributeNode(cloneNode(doc, attrs.item(i2), true));
}
break;
case ATTRIBUTE_NODE:
shouldDeep = true;
}
if (destParent !== null) {
destParent.appendChild(destNode);
} else {
destRoot = destNode;
}
return shouldDeep ? destNode : null;
}
});
return destRoot;
}
function __set__(object2, key, value) {
object2[key] = value;
}
try {
if (Object.defineProperty) {
Object.defineProperty(LiveNodeList.prototype, "length", {
get: function() {
_updateLiveList(this);
return this.$$length;
}
});
Object.defineProperty(Node2.prototype, "textContent", {
get: function() {
if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
var buf = [];
walkDOM(this, null, {
enter: function(n2) {
if (n2.nodeType === ELEMENT_NODE || n2.nodeType === DOCUMENT_FRAGMENT_NODE) {
return true;
}
if (n2.nodeType === PROCESSING_INSTRUCTION_NODE || n2.nodeType === COMMENT_NODE) {
return null;
}
buf.push(n2.nodeValue);
}
});
return buf.join("");
}
return this.nodeValue;
},
set: function(data) {
switch (this.nodeType) {
case ELEMENT_NODE:
case DOCUMENT_FRAGMENT_NODE:
while (this.firstChild) {
this.removeChild(this.firstChild);
}
if (data || String(data)) {
this.appendChild(this.ownerDocument.createTextNode(data));
}
break;
default:
this.data = data;
this.value = data;
this.nodeValue = data;
}
}
});
__set__ = function(object2, key, value) {
object2["$$" + key] = value;
};
}
} catch (e2) {
}
exports.DocumentType = DocumentType;
exports.DOMException = DOMException2;
exports.DOMImplementation = DOMImplementation;
exports.Element = Element2;
exports.Node = Node2;
exports.NodeList = NodeList;
exports.walkDOM = walkDOM;
exports.XMLSerializer = XMLSerializer3;
}
});
// node_modules/@xmldom/xmldom/lib/entities.js
var require_entities = __commonJS({
"node_modules/@xmldom/xmldom/lib/entities.js"(exports) {
"use strict";
var freeze = require_conventions().freeze;
exports.XML_ENTITIES = freeze({
amp: "&",
apos: "'",
gt: ">",
lt: "<",
quot: '"'
});
exports.HTML_ENTITIES = freeze({
Aacute: "\xC1",
aacute: "\xE1",
Abreve: "\u0102",
abreve: "\u0103",
ac: "\u223E",
acd: "\u223F",
acE: "\u223E\u0333",
Acirc: "\xC2",
acirc: "\xE2",
acute: "\xB4",
Acy: "\u0410",
acy: "\u0430",
AElig: "\xC6",
aelig: "\xE6",
af: "\u2061",
Afr: "\u{1D504}",
afr: "\u{1D51E}",
Agrave: "\xC0",
agrave: "\xE0",
alefsym: "\u2135",
aleph: "\u2135",
Alpha: "\u0391",
alpha: "\u03B1",
Amacr: "\u0100",
amacr: "\u0101",
amalg: "\u2A3F",
AMP: "&",
amp: "&",
And: "\u2A53",
and: "\u2227",
andand: "\u2A55",
andd: "\u2A5C",
andslope: "\u2A58",
andv: "\u2A5A",
ang: "\u2220",
ange: "\u29A4",
angle: "\u2220",
angmsd: "\u2221",
angmsdaa: "\u29A8",
angmsdab: "\u29A9",
angmsdac: "\u29AA",
angmsdad: "\u29AB",
angmsdae: "\u29AC",
angmsdaf: "\u29AD",
angmsdag: "\u29AE",
angmsdah: "\u29AF",
angrt: "\u221F",
angrtvb: "\u22BE",
angrtvbd: "\u299D",
angsph: "\u2222",
angst: "\xC5",
angzarr: "\u237C",
Aogon: "\u0104",
aogon: "\u0105",
Aopf: "\u{1D538}",
aopf: "\u{1D552}",
ap: "\u2248",
apacir: "\u2A6F",
apE: "\u2A70",
ape: "\u224A",
apid: "\u224B",
apos: "'",
ApplyFunction: "\u2061",
approx: "\u2248",
approxeq: "\u224A",
Aring: "\xC5",
aring: "\xE5",
Ascr: "\u{1D49C}",
ascr: "\u{1D4B6}",
Assign: "\u2254",
ast: "*",
asymp: "\u2248",
asympeq: "\u224D",
Atilde: "\xC3",
atilde: "\xE3",
Auml: "\xC4",
auml: "\xE4",
awconint: "\u2233",
awint: "\u2A11",
backcong: "\u224C",
backepsilon: "\u03F6",
backprime: "\u2035",
backsim: "\u223D",
backsimeq: "\u22CD",
Backslash: "\u2216",
Barv: "\u2AE7",
barvee: "\u22BD",
Barwed: "\u2306",
barwed: "\u2305",
barwedge: "\u2305",
bbrk: "\u23B5",
bbrktbrk: "\u23B6",
bcong: "\u224C",
Bcy: "\u0411",
bcy: "\u0431",
bdquo: "\u201E",
becaus: "\u2235",
Because: "\u2235",
because: "\u2235",
bemptyv: "\u29B0",
bepsi: "\u03F6",
bernou: "\u212C",
Bernoullis: "\u212C",
Beta: "\u0392",
beta: "\u03B2",
beth: "\u2136",
between: "\u226C",
Bfr: "\u{1D505}",
bfr: "\u{1D51F}",
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",
bkarow: "\u290D",
blacklozenge: "\u29EB",
blacksquare: "\u25AA",
blacktriangle: "\u25B4",
blacktriangledown: "\u25BE",
blacktriangleleft: "\u25C2",
blacktriangleright: "\u25B8",
blank: "\u2423",
blk12: "\u2592",
blk14: "\u2591",
blk34: "\u2593",
block: "\u2588",
bne: "=\u20E5",
bnequiv: "\u2261\u20E5",
bNot: "\u2AED",
bnot: "\u2310",
Bopf: "\u{1D539}",
bopf: "\u{1D553}",
bot: "\u22A5",
bottom: "\u22A5",
bowtie: "\u22C8",
boxbox: "\u29C9",
boxDL: "\u2557",
boxDl: "\u2556",
boxdL: "\u2555",
boxdl: "\u2510",
boxDR: "\u2554",
boxDr: "\u2553",
boxdR: "\u2552",
boxdr: "\u250C",
boxH: "\u2550",
boxh: "\u2500",
boxHD: "\u2566",
boxHd: "\u2564",
boxhD: "\u2565",
boxhd: "\u252C",
boxHU: "\u2569",
boxHu: "\u2567",
boxhU: "\u2568",
boxhu: "\u2534",
boxminus: "\u229F",
boxplus: "\u229E",
boxtimes: "\u22A0",
boxUL: "\u255D",
boxUl: "\u255C",
boxuL: "\u255B",
boxul: "\u2518",
boxUR: "\u255A",
boxUr: "\u2559",
boxuR: "\u2558",
boxur: "\u2514",
boxV: "\u2551",
boxv: "\u2502",
boxVH: "\u256C",
boxVh: "\u256B",
boxvH: "\u256A",
boxvh: "\u253C",
boxVL: "\u2563",
boxVl: "\u2562",
boxvL: "\u2561",
boxvl: "\u2524",
boxVR: "\u2560",
boxVr: "\u255F",
boxvR: "\u255E",
boxvr: "\u251C",
bprime: "\u2035",
Breve: "\u02D8",
breve: "\u02D8",
brvbar: "\xA6",
Bscr: "\u212C",
bscr: "\u{1D4B7}",
bsemi: "\u204F",
bsim: "\u223D",
bsime: "\u22CD",
bsol: "\\",
bsolb: "\u29C5",
bsolhsub: "\u27C8",
bull: "\u2022",
bullet: "\u2022",
bump: "\u224E",
bumpE: "\u2AAE",
bumpe: "\u224F",
Bumpeq: "\u224E",
bumpeq: "\u224F",
Cacute: "\u0106",
cacute: "\u0107",
Cap: "\u22D2",
cap: "\u2229",
capand: "\u2A44",
capbrcup: "\u2A49",
capcap: "\u2A4B",
capcup: "\u2A47",
capdot: "\u2A40",
CapitalDifferentialD: "\u2145",
caps: "\u2229\uFE00",
caret: "\u2041",
caron: "\u02C7",
Cayleys: "\u212D",
ccaps: "\u2A4D",
Ccaron: "\u010C",
ccaron: "\u010D",
Ccedil: "\xC7",
ccedil: "\xE7",
Ccirc: "\u0108",
ccirc: "\u0109",
Cconint: "\u2230",
ccups: "\u2A4C",
ccupssm: "\u2A50",
Cdot: "\u010A",
cdot: "\u010B",
cedil: "\xB8",
Cedilla: "\xB8",
cemptyv: "\u29B2",
cent: "\xA2",
CenterDot: "\xB7",
centerdot: "\xB7",
Cfr: "\u212D",
cfr: "\u{1D520}",
CHcy: "\u0427",
chcy: "\u0447",
check: "\u2713",
checkmark: "\u2713",
Chi: "\u03A7",
chi: "\u03C7",
cir: "\u25CB",
circ: "\u02C6",
circeq: "\u2257",
circlearrowleft: "\u21BA",
circlearrowright: "\u21BB",
circledast: "\u229B",
circledcirc: "\u229A",
circleddash: "\u229D",
CircleDot: "\u2299",
circledR: "\xAE",
circledS: "\u24C8",
CircleMinus: "\u2296",
CirclePlus: "\u2295",
CircleTimes: "\u2297",
cirE: "\u29C3",
cire: "\u2257",
cirfnint: "\u2A10",
cirmid: "\u2AEF",
cirscir: "\u29C2",
ClockwiseContourIntegral: "\u2232",
CloseCurlyDoubleQuote: "\u201D",
CloseCurlyQuote: "\u2019",
clubs: "\u2663",
clubsuit: "\u2663",
Colon: "\u2237",
colon: ":",
Colone: "\u2A74",
colone: "\u2254",
coloneq: "\u2254",
comma: ",",
commat: "@",
comp: "\u2201",
compfn: "\u2218",
complement: "\u2201",
complexes: "\u2102",
cong: "\u2245",
congdot: "\u2A6D",
Congruent: "\u2261",
Conint: "\u222F",
conint: "\u222E",
ContourIntegral: "\u222E",
Copf: "\u2102",
copf: "\u{1D554}",
coprod: "\u2210",
Coproduct: "\u2210",
COPY: "\xA9",
copy: "\xA9",
copysr: "\u2117",
CounterClockwiseContourIntegral: "\u2233",
crarr: "\u21B5",
Cross: "\u2A2F",
cross: "\u2717",
Cscr: "\u{1D49E}",
cscr: "\u{1D4B8}",
csub: "\u2ACF",
csube: "\u2AD1",
csup: "\u2AD0",
csupe: "\u2AD2",
ctdot: "\u22EF",
cudarrl: "\u2938",
cudarrr: "\u2935",
cuepr: "\u22DE",
cuesc: "\u22DF",
cularr: "\u21B6",
cularrp: "\u293D",
Cup: "\u22D3",
cup: "\u222A",
cupbrcap: "\u2A48",
CupCap: "\u224D",
cupcap: "\u2A46",
cupcup: "\u2A4A",
cupdot: "\u228D",
cupor: "\u2A45",
cups: "\u222A\uFE00",
curarr: "\u21B7",
curarrm: "\u293C",
curlyeqprec: "\u22DE",
curlyeqsucc: "\u22DF",
curlyvee: "\u22CE",
curlywedge: "\u22CF",
curren: "\xA4",
curvearrowleft: "\u21B6",
curvearrowright: "\u21B7",
cuvee: "\u22CE",
cuwed: "\u22CF",
cwconint: "\u2232",
cwint: "\u2231",
cylcty: "\u232D",
Dagger: "\u2021",
dagger: "\u2020",
daleth: "\u2138",
Darr: "\u21A1",
dArr: "\u21D3",
darr: "\u2193",
dash: "\u2010",
Dashv: "\u2AE4",
dashv: "\u22A3",
dbkarow: "\u290F",
dblac: "\u02DD",
Dcaron: "\u010E",
dcaron: "\u010F",
Dcy: "\u0414",
dcy: "\u0434",
DD: "\u2145",
dd: "\u2146",
ddagger: "\u2021",
ddarr: "\u21CA",
DDotrahd: "\u2911",
ddotseq: "\u2A77",
deg: "\xB0",
Del: "\u2207",
Delta: "\u0394",
delta: "\u03B4",
demptyv: "\u29B1",
dfisht: "\u297F",
Dfr: "\u{1D507}",
dfr: "\u{1D521}",
dHar: "\u2965",
dharl: "\u21C3",
dharr: "\u21C2",
DiacriticalAcute: "\xB4",
DiacriticalDot: "\u02D9",
DiacriticalDoubleAcute: "\u02DD",
DiacriticalGrave: "`",
DiacriticalTilde: "\u02DC",
diam: "\u22C4",
Diamond: "\u22C4",
diamond: "\u22C4",
diamondsuit: "\u2666",
diams: "\u2666",
die: "\xA8",
DifferentialD: "\u2146",
digamma: "\u03DD",
disin: "\u22F2",
div: "\xF7",
divide: "\xF7",
divideontimes: "\u22C7",
divonx: "\u22C7",
DJcy: "\u0402",
djcy: "\u0452",
dlcorn: "\u231E",
dlcrop: "\u230D",
dollar: "$",
Dopf: "\u{1D53B}",
dopf: "\u{1D555}",
Dot: "\xA8",
dot: "\u02D9",
DotDot: "\u20DC",
doteq: "\u2250",
doteqdot: "\u2251",
DotEqual: "\u2250",
dotminus: "\u2238",
dotplus: "\u2214",
dotsquare: "\u22A1",
doublebarwedge: "\u2306",
DoubleContourIntegral: "\u222F",
DoubleDot: "\xA8",
DoubleDownArrow: "\u21D3",
DoubleLeftArrow: "\u21D0",
DoubleLeftRightArrow: "\u21D4",
DoubleLeftTee: "\u2AE4",
DoubleLongLeftArrow: "\u27F8",
DoubleLongLeftRightArrow: "\u27FA",
DoubleLongRightArrow: "\u27F9",
DoubleRightArrow: "\u21D2",
DoubleRightTee: "\u22A8",
DoubleUpArrow: "\u21D1",
DoubleUpDownArrow: "\u21D5",
DoubleVerticalBar: "\u2225",
DownArrow: "\u2193",
Downarrow: "\u21D3",
downarrow: "\u2193",
DownArrowBar: "\u2913",
DownArrowUpArrow: "\u21F5",
DownBreve: "\u0311",
downdownarrows: "\u21CA",
downharpoonleft: "\u21C3",
downharpoonright: "\u21C2",
DownLeftRightVector: "\u2950",
DownLeftTeeVector: "\u295E",
DownLeftVector: "\u21BD",
DownLeftVectorBar: "\u2956",
DownRightTeeVector: "\u295F",
DownRightVector: "\u21C1",
DownRightVectorBar: "\u2957",
DownTee: "\u22A4",
DownTeeArrow: "\u21A7",
drbkarow: "\u2910",
drcorn: "\u231F",
drcrop: "\u230C",
Dscr: "\u{1D49F}",
dscr: "\u{1D4B9}",
DScy: "\u0405",
dscy: "\u0455",
dsol: "\u29F6",
Dstrok: "\u0110",
dstrok: "\u0111",
dtdot: "\u22F1",
dtri: "\u25BF",
dtrif: "\u25BE",
duarr: "\u21F5",
duhar: "\u296F",
dwangle: "\u29A6",
DZcy: "\u040F",
dzcy: "\u045F",
dzigrarr: "\u27FF",
Eacute: "\xC9",
eacute: "\xE9",
easter: "\u2A6E",
Ecaron: "\u011A",
ecaron: "\u011B",
ecir: "\u2256",
Ecirc: "\xCA",
ecirc: "\xEA",
ecolon: "\u2255",
Ecy: "\u042D",
ecy: "\u044D",
eDDot: "\u2A77",
Edot: "\u0116",
eDot: "\u2251",
edot: "\u0117",
ee: "\u2147",
efDot: "\u2252",
Efr: "\u{1D508}",
efr: "\u{1D522}",
eg: "\u2A9A",
Egrave: "\xC8",
egrave: "\xE8",
egs: "\u2A96",
egsdot: "\u2A98",
el: "\u2A99",
Element: "\u2208",
elinters: "\u23E7",
ell: "\u2113",
els: "\u2A95",
elsdot: "\u2A97",
Emacr: "\u0112",
emacr: "\u0113",
empty: "\u2205",
emptyset: "\u2205",
EmptySmallSquare: "\u25FB",
emptyv: "\u2205",
EmptyVerySmallSquare: "\u25AB",
emsp: "\u2003",
emsp13: "\u2004",
emsp14: "\u2005",
ENG: "\u014A",
eng: "\u014B",
ensp: "\u2002",
Eogon: "\u0118",
eogon: "\u0119",
Eopf: "\u{1D53C}",
eopf: "\u{1D556}",
epar: "\u22D5",
eparsl: "\u29E3",
eplus: "\u2A71",
epsi: "\u03B5",
Epsilon: "\u0395",
epsilon: "\u03B5",
epsiv: "\u03F5",
eqcirc: "\u2256",
eqcolon: "\u2255",
eqsim: "\u2242",
eqslantgtr: "\u2A96",
eqslantless: "\u2A95",
Equal: "\u2A75",
equals: "=",
EqualTilde: "\u2242",
equest: "\u225F",
Equilibrium: "\u21CC",
equiv: "\u2261",
equivDD: "\u2A78",
eqvparsl: "\u29E5",
erarr: "\u2971",
erDot: "\u2253",
Escr: "\u2130",
escr: "\u212F",
esdot: "\u2250",
Esim: "\u2A73",
esim: "\u2242",
Eta: "\u0397",
eta: "\u03B7",
ETH: "\xD0",
eth: "\xF0",
Euml: "\xCB",
euml: "\xEB",
euro: "\u20AC",
excl: "!",
exist: "\u2203",
Exists: "\u2203",
expectation: "\u2130",
ExponentialE: "\u2147",
exponentiale: "\u2147",
fallingdotseq: "\u2252",
Fcy: "\u0424",
fcy: "\u0444",
female: "\u2640",
ffilig: "\uFB03",
fflig: "\uFB00",
ffllig: "\uFB04",
Ffr: "\u{1D509}",
ffr: "\u{1D523}",
filig: "\uFB01",
FilledSmallSquare: "\u25FC",
FilledVerySmallSquare: "\u25AA",
fjlig: "fj",
flat: "\u266D",
fllig: "\uFB02",
fltns: "\u25B1",
fnof: "\u0192",
Fopf: "\u{1D53D}",
fopf: "\u{1D557}",
ForAll: "\u2200",
forall: "\u2200",
fork: "\u22D4",
forkv: "\u2AD9",
Fouriertrf: "\u2131",
fpartint: "\u2A0D",
frac12: "\xBD",
frac13: "\u2153",
frac14: "\xBC",
frac15: "\u2155",
frac16: "\u2159",
frac18: "\u215B",
frac23: "\u2154",
frac25: "\u2156",
frac34: "\xBE",
frac35: "\u2157",
frac38: "\u215C",
frac45: "\u2158",
frac56: "\u215A",
frac58: "\u215D",
frac78: "\u215E",
frasl: "\u2044",
frown: "\u2322",
Fscr: "\u2131",
fscr: "\u{1D4BB}",
gacute: "\u01F5",
Gamma: "\u0393",
gamma: "\u03B3",
Gammad: "\u03DC",
gammad: "\u03DD",
gap: "\u2A86",
Gbreve: "\u011E",
gbreve: "\u011F",
Gcedil: "\u0122",
Gcirc: "\u011C",
gcirc: "\u011D",
Gcy: "\u0413",
gcy: "\u0433",
Gdot: "\u0120",
gdot: "\u0121",
gE: "\u2267",
ge: "\u2265",
gEl: "\u2A8C",
gel: "\u22DB",
geq: "\u2265",
geqq: "\u2267",
geqslant: "\u2A7E",
ges: "\u2A7E",
gescc: "\u2AA9",
gesdot: "\u2A80",
gesdoto: "\u2A82",
gesdotol: "\u2A84",
gesl: "\u22DB\uFE00",
gesles: "\u2A94",
Gfr: "\u{1D50A}",
gfr: "\u{1D524}",
Gg: "\u22D9",
gg: "\u226B",
ggg: "\u22D9",
gimel: "\u2137",
GJcy: "\u0403",
gjcy: "\u0453",
gl: "\u2277",
gla: "\u2AA5",
glE: "\u2A92",
glj: "\u2AA4",
gnap: "\u2A8A",
gnapprox: "\u2A8A",
gnE: "\u2269",
gne: "\u2A88",
gneq: "\u2A88",
gneqq: "\u2269",
gnsim: "\u22E7",
Gopf: "\u{1D53E}",
gopf: "\u{1D558}",
grave: "`",
GreaterEqual: "\u2265",
GreaterEqualLess: "\u22DB",
GreaterFullEqual: "\u2267",
GreaterGreater: "\u2AA2",
GreaterLess: "\u2277",
GreaterSlantEqual: "\u2A7E",
GreaterTilde: "\u2273",
Gscr: "\u{1D4A2}",
gscr: "\u210A",
gsim: "\u2273",
gsime: "\u2A8E",
gsiml: "\u2A90",
Gt: "\u226B",
GT: ">",
gt: ">",
gtcc: "\u2AA7",
gtcir: "\u2A7A",
gtdot: "\u22D7",
gtlPar: "\u2995",
gtquest: "\u2A7C",
gtrapprox: "\u2A86",
gtrarr: "\u2978",
gtrdot: "\u22D7",
gtreqless: "\u22DB",
gtreqqless: "\u2A8C",
gtrless: "\u2277",
gtrsim: "\u2273",
gvertneqq: "\u2269\uFE00",
gvnE: "\u2269\uFE00",
Hacek: "\u02C7",
hairsp: "\u200A",
half: "\xBD",
hamilt: "\u210B",
HARDcy: "\u042A",
hardcy: "\u044A",
hArr: "\u21D4",
harr: "\u2194",
harrcir: "\u2948",
harrw: "\u21AD",
Hat: "^",
hbar: "\u210F",
Hcirc: "\u0124",
hcirc: "\u0125",
hearts: "\u2665",
heartsuit: "\u2665",
hellip: "\u2026",
hercon: "\u22B9",
Hfr: "\u210C",
hfr: "\u{1D525}",
HilbertSpace: "\u210B",
hksearow: "\u2925",
hkswarow: "\u2926",
hoarr: "\u21FF",
homtht: "\u223B",
hookleftarrow: "\u21A9",
hookrightarrow: "\u21AA",
Hopf: "\u210D",
hopf: "\u{1D559}",
horbar: "\u2015",
HorizontalLine: "\u2500",
Hscr: "\u210B",
hscr: "\u{1D4BD}",
hslash: "\u210F",
Hstrok: "\u0126",
hstrok: "\u0127",
HumpDownHump: "\u224E",
HumpEqual: "\u224F",
hybull: "\u2043",
hyphen: "\u2010",
Iacute: "\xCD",
iacute: "\xED",
ic: "\u2063",
Icirc: "\xCE",
icirc: "\xEE",
Icy: "\u0418",
icy: "\u0438",
Idot: "\u0130",
IEcy: "\u0415",
iecy: "\u0435",
iexcl: "\xA1",
iff: "\u21D4",
Ifr: "\u2111",
ifr: "\u{1D526}",
Igrave: "\xCC",
igrave: "\xEC",
ii: "\u2148",
iiiint: "\u2A0C",
iiint: "\u222D",
iinfin: "\u29DC",
iiota: "\u2129",
IJlig: "\u0132",
ijlig: "\u0133",
Im: "\u2111",
Imacr: "\u012A",
imacr: "\u012B",
image: "\u2111",
ImaginaryI: "\u2148",
imagline: "\u2110",
imagpart: "\u2111",
imath: "\u0131",
imof: "\u22B7",
imped: "\u01B5",
Implies: "\u21D2",
in: "\u2208",
incare: "\u2105",
infin: "\u221E",
infintie: "\u29DD",
inodot: "\u0131",
Int: "\u222C",
int: "\u222B",
intcal: "\u22BA",
integers: "\u2124",
Integral: "\u222B",
intercal: "\u22BA",
Intersection: "\u22C2",
intlarhk: "\u2A17",
intprod: "\u2A3C",
InvisibleComma: "\u2063",
InvisibleTimes: "\u2062",
IOcy: "\u0401",
iocy: "\u0451",
Iogon: "\u012E",
iogon: "\u012F",
Iopf: "\u{1D540}",
iopf: "\u{1D55A}",
Iota: "\u0399",
iota: "\u03B9",
iprod: "\u2A3C",
iquest: "\xBF",
Iscr: "\u2110",
iscr: "\u{1D4BE}",
isin: "\u2208",
isindot: "\u22F5",
isinE: "\u22F9",
isins: "\u22F4",
isinsv: "\u22F3",
isinv: "\u2208",
it: "\u2062",
Itilde: "\u0128",
itilde: "\u0129",
Iukcy: "\u0406",
iukcy: "\u0456",
Iuml: "\xCF",
iuml: "\xEF",
Jcirc: "\u0134",
jcirc: "\u0135",
Jcy: "\u0419",
jcy: "\u0439",
Jfr: "\u{1D50D}",
jfr: "\u{1D527}",
jmath: "\u0237",
Jopf: "\u{1D541}",
jopf: "\u{1D55B}",
Jscr: "\u{1D4A5}",
jscr: "\u{1D4BF}",
Jsercy: "\u0408",
jsercy: "\u0458",
Jukcy: "\u0404",
jukcy: "\u0454",
Kappa: "\u039A",
kappa: "\u03BA",
kappav: "\u03F0",
Kcedil: "\u0136",
kcedil: "\u0137",
Kcy: "\u041A",
kcy: "\u043A",
Kfr: "\u{1D50E}",
kfr: "\u{1D528}",
kgreen: "\u0138",
KHcy: "\u0425",
khcy: "\u0445",
KJcy: "\u040C",
kjcy: "\u045C",
Kopf: "\u{1D542}",
kopf: "\u{1D55C}",
Kscr: "\u{1D4A6}",
kscr: "\u{1D4C0}",
lAarr: "\u21DA",
Lacute: "\u0139",
lacute: "\u013A",
laemptyv: "\u29B4",
lagran: "\u2112",
Lambda: "\u039B",
lambda: "\u03BB",
Lang: "\u27EA",
lang: "\u27E8",
langd: "\u2991",
langle: "\u27E8",
lap: "\u2A85",
Laplacetrf: "\u2112",
laquo: "\xAB",
Larr: "\u219E",
lArr: "\u21D0",
larr: "\u2190",
larrb: "\u21E4",
larrbfs: "\u291F",
larrfs: "\u291D",
larrhk: "\u21A9",
larrlp: "\u21AB",
larrpl: "\u2939",
larrsim: "\u2973",
larrtl: "\u21A2",
lat: "\u2AAB",
lAtail: "\u291B",
latail: "\u2919",
late: "\u2AAD",
lates: "\u2AAD\uFE00",
lBarr: "\u290E",
lbarr: "\u290C",
lbbrk: "\u2772",
lbrace: "{",
lbrack: "[",
lbrke: "\u298B",
lbrksld: "\u298F",
lbrkslu: "\u298D",
Lcaron: "\u013D",
lcaron: "\u013E",
Lcedil: "\u013B",
lcedil: "\u013C",
lceil: "\u2308",
lcub: "{",
Lcy: "\u041B",
lcy: "\u043B",
ldca: "\u2936",
ldquo: "\u201C",
ldquor: "\u201E",
ldrdhar: "\u2967",
ldrushar: "\u294B",
ldsh: "\u21B2",
lE: "\u2266",
le: "\u2264",
LeftAngleBracket: "\u27E8",
LeftArrow: "\u2190",
Leftarrow: "\u21D0",
leftarrow: "\u2190",
LeftArrowBar: "\u21E4",
LeftArrowRightArrow: "\u21C6",
leftarrowtail: "\u21A2",
LeftCeiling: "\u2308",
LeftDoubleBracket: "\u27E6",
LeftDownTeeVector: "\u2961",
LeftDownVector: "\u21C3",
LeftDownVectorBar: "\u2959",
LeftFloor: "\u230A",
leftharpoondown: "\u21BD",
leftharpoonup: "\u21BC",
leftleftarrows: "\u21C7",
LeftRightArrow: "\u2194",
Leftrightarrow: "\u21D4",
leftrightarrow: "\u2194",
leftrightarrows: "\u21C6",
leftrightharpoons: "\u21CB",
leftrightsquigarrow: "\u21AD",
LeftRightVector: "\u294E",
LeftTee: "\u22A3",
LeftTeeArrow: "\u21A4",
LeftTeeVector: "\u295A",
leftthreetimes: "\u22CB",
LeftTriangle: "\u22B2",
LeftTriangleBar: "\u29CF",
LeftTriangleEqual: "\u22B4",
LeftUpDownVector: "\u2951",
LeftUpTeeVector: "\u2960",
LeftUpVector: "\u21BF",
LeftUpVectorBar: "\u2958",
LeftVector: "\u21BC",
LeftVectorBar: "\u2952",
lEg: "\u2A8B",
leg: "\u22DA",
leq: "\u2264",
leqq: "\u2266",
leqslant: "\u2A7D",
les: "\u2A7D",
lescc: "\u2AA8",
lesdot: "\u2A7F",
lesdoto: "\u2A81",
lesdotor: "\u2A83",
lesg: "\u22DA\uFE00",
lesges: "\u2A93",
lessapprox: "\u2A85",
lessdot: "\u22D6",
lesseqgtr: "\u22DA",
lesseqqgtr: "\u2A8B",
LessEqualGreater: "\u22DA",
LessFullEqual: "\u2266",
LessGreater: "\u2276",
lessgtr: "\u2276",
LessLess: "\u2AA1",
lesssim: "\u2272",
LessSlantEqual: "\u2A7D",
LessTilde: "\u2272",
lfisht: "\u297C",
lfloor: "\u230A",
Lfr: "\u{1D50F}",
lfr: "\u{1D529}",
lg: "\u2276",
lgE: "\u2A91",
lHar: "\u2962",
lhard: "\u21BD",
lharu: "\u21BC",
lharul: "\u296A",
lhblk: "\u2584",
LJcy: "\u0409",
ljcy: "\u0459",
Ll: "\u22D8",
ll: "\u226A",
llarr: "\u21C7",
llcorner: "\u231E",
Lleftarrow: "\u21DA",
llhard: "\u296B",
lltri: "\u25FA",
Lmidot: "\u013F",
lmidot: "\u0140",
lmoust: "\u23B0",
lmoustache: "\u23B0",
lnap: "\u2A89",
lnapprox: "\u2A89",
lnE: "\u2268",
lne: "\u2A87",
lneq: "\u2A87",
lneqq: "\u2268",
lnsim: "\u22E6",
loang: "\u27EC",
loarr: "\u21FD",
lobrk: "\u27E6",
LongLeftArrow: "\u27F5",
Longleftarrow: "\u27F8",
longleftarrow: "\u27F5",
LongLeftRightArrow: "\u27F7",
Longleftrightarrow: "\u27FA",
longleftrightarrow: "\u27F7",
longmapsto: "\u27FC",
LongRightArrow: "\u27F6",
Longrightarrow: "\u27F9",
longrightarrow: "\u27F6",
looparrowleft: "\u21AB",
looparrowright: "\u21AC",
lopar: "\u2985",
Lopf: "\u{1D543}",
lopf: "\u{1D55D}",
loplus: "\u2A2D",
lotimes: "\u2A34",
lowast: "\u2217",
lowbar: "_",
LowerLeftArrow: "\u2199",
LowerRightArrow: "\u2198",
loz: "\u25CA",
lozenge: "\u25CA",
lozf: "\u29EB",
lpar: "(",
lparlt: "\u2993",
lrarr: "\u21C6",
lrcorner: "\u231F",
lrhar: "\u21CB",
lrhard: "\u296D",
lrm: "\u200E",
lrtri: "\u22BF",
lsaquo: "\u2039",
Lscr: "\u2112",
lscr: "\u{1D4C1}",
Lsh: "\u21B0",
lsh: "\u21B0",
lsim: "\u2272",
lsime: "\u2A8D",
lsimg: "\u2A8F",
lsqb: "[",
lsquo: "\u2018",
lsquor: "\u201A",
Lstrok: "\u0141",
lstrok: "\u0142",
Lt: "\u226A",
LT: "<",
lt: "<",
ltcc: "\u2AA6",
ltcir: "\u2A79",
ltdot: "\u22D6",
lthree: "\u22CB",
ltimes: "\u22C9",
ltlarr: "\u2976",
ltquest: "\u2A7B",
ltri: "\u25C3",
ltrie: "\u22B4",
ltrif: "\u25C2",
ltrPar: "\u2996",
lurdshar: "\u294A",
luruhar: "\u2966",
lvertneqq: "\u2268\uFE00",
lvnE: "\u2268\uFE00",
macr: "\xAF",
male: "\u2642",
malt: "\u2720",
maltese: "\u2720",
Map: "\u2905",
map: "\u21A6",
mapsto: "\u21A6",
mapstodown: "\u21A7",
mapstoleft: "\u21A4",
mapstoup: "\u21A5",
marker: "\u25AE",
mcomma: "\u2A29",
Mcy: "\u041C",
mcy: "\u043C",
mdash: "\u2014",
mDDot: "\u223A",
measuredangle: "\u2221",
MediumSpace: "\u205F",
Mellintrf: "\u2133",
Mfr: "\u{1D510}",
mfr: "\u{1D52A}",
mho: "\u2127",
micro: "\xB5",
mid: "\u2223",
midast: "*",
midcir: "\u2AF0",
middot: "\xB7",
minus: "\u2212",
minusb: "\u229F",
minusd: "\u2238",
minusdu: "\u2A2A",
MinusPlus: "\u2213",
mlcp: "\u2ADB",
mldr: "\u2026",
mnplus: "\u2213",
models: "\u22A7",
Mopf: "\u{1D544}",
mopf: "\u{1D55E}",
mp: "\u2213",
Mscr: "\u2133",
mscr: "\u{1D4C2}",
mstpos: "\u223E",
Mu: "\u039C",
mu: "\u03BC",
multimap: "\u22B8",
mumap: "\u22B8",
nabla: "\u2207",
Nacute: "\u0143",
nacute: "\u0144",
nang: "\u2220\u20D2",
nap: "\u2249",
napE: "\u2A70\u0338",
napid: "\u224B\u0338",
napos: "\u0149",
napprox: "\u2249",
natur: "\u266E",
natural: "\u266E",
naturals: "\u2115",
nbsp: "\xA0",
nbump: "\u224E\u0338",
nbumpe: "\u224F\u0338",
ncap: "\u2A43",
Ncaron: "\u0147",
ncaron: "\u0148",
Ncedil: "\u0145",
ncedil: "\u0146",
ncong: "\u2247",
ncongdot: "\u2A6D\u0338",
ncup: "\u2A42",
Ncy: "\u041D",
ncy: "\u043D",
ndash: "\u2013",
ne: "\u2260",
nearhk: "\u2924",
neArr: "\u21D7",
nearr: "\u2197",
nearrow: "\u2197",
nedot: "\u2250\u0338",
NegativeMediumSpace: "\u200B",
NegativeThickSpace: "\u200B",
NegativeThinSpace: "\u200B",
NegativeVeryThinSpace: "\u200B",
nequiv: "\u2262",
nesear: "\u2928",
nesim: "\u2242\u0338",
NestedGreaterGreater: "\u226B",
NestedLessLess: "\u226A",
NewLine: "\n",
nexist: "\u2204",
nexists: "\u2204",
Nfr: "\u{1D511}",
nfr: "\u{1D52B}",
ngE: "\u2267\u0338",
nge: "\u2271",
ngeq: "\u2271",
ngeqq: "\u2267\u0338",
ngeqslant: "\u2A7E\u0338",
nges: "\u2A7E\u0338",
nGg: "\u22D9\u0338",
ngsim: "\u2275",
nGt: "\u226B\u20D2",
ngt: "\u226F",
ngtr: "\u226F",
nGtv: "\u226B\u0338",
nhArr: "\u21CE",
nharr: "\u21AE",
nhpar: "\u2AF2",
ni: "\u220B",
nis: "\u22FC",
nisd: "\u22FA",
niv: "\u220B",
NJcy: "\u040A",
njcy: "\u045A",
nlArr: "\u21CD",
nlarr: "\u219A",
nldr: "\u2025",
nlE: "\u2266\u0338",
nle: "\u2270",
nLeftarrow: "\u21CD",
nleftarrow: "\u219A",
nLeftrightarrow: "\u21CE",
nleftrightarrow: "\u21AE",
nleq: "\u2270",
nleqq: "\u2266\u0338",
nleqslant: "\u2A7D\u0338",
nles: "\u2A7D\u0338",
nless: "\u226E",
nLl: "\u22D8\u0338",
nlsim: "\u2274",
nLt: "\u226A\u20D2",
nlt: "\u226E",
nltri: "\u22EA",
nltrie: "\u22EC",
nLtv: "\u226A\u0338",
nmid: "\u2224",
NoBreak: "\u2060",
NonBreakingSpace: "\xA0",
Nopf: "\u2115",
nopf: "\u{1D55F}",
Not: "\u2AEC",
not: "\xAC",
NotCongruent: "\u2262",
NotCupCap: "\u226D",
NotDoubleVerticalBar: "\u2226",
NotElement: "\u2209",
NotEqual: "\u2260",
NotEqualTilde: "\u2242\u0338",
NotExists: "\u2204",
NotGreater: "\u226F",
NotGreaterEqual: "\u2271",
NotGreaterFullEqual: "\u2267\u0338",
NotGreaterGreater: "\u226B\u0338",
NotGreaterLess: "\u2279",
NotGreaterSlantEqual: "\u2A7E\u0338",
NotGreaterTilde: "\u2275",
NotHumpDownHump: "\u224E\u0338",
NotHumpEqual: "\u224F\u0338",
notin: "\u2209",
notindot: "\u22F5\u0338",
notinE: "\u22F9\u0338",
notinva: "\u2209",
notinvb: "\u22F7",
notinvc: "\u22F6",
NotLeftTriangle: "\u22EA",
NotLeftTriangleBar: "\u29CF\u0338",
NotLeftTriangleEqual: "\u22EC",
NotLess: "\u226E",
NotLessEqual: "\u2270",
NotLessGreater: "\u2278",
NotLessLess: "\u226A\u0338",
NotLessSlantEqual: "\u2A7D\u0338",
NotLessTilde: "\u2274",
NotNestedGreaterGreater: "\u2AA2\u0338",
NotNestedLessLess: "\u2AA1\u0338",
notni: "\u220C",
notniva: "\u220C",
notnivb: "\u22FE",
notnivc: "\u22FD",
NotPrecedes: "\u2280",
NotPrecedesEqual: "\u2AAF\u0338",
NotPrecedesSlantEqual: "\u22E0",
NotReverseElement: "\u220C",
NotRightTriangle: "\u22EB",
NotRightTriangleBar: "\u29D0\u0338",
NotRightTriangleEqual: "\u22ED",
NotSquareSubset: "\u228F\u0338",
NotSquareSubsetEqual: "\u22E2",
NotSquareSuperset: "\u2290\u0338",
NotSquareSupersetEqual: "\u22E3",
NotSubset: "\u2282\u20D2",
NotSubsetEqual: "\u2288",
NotSucceeds: "\u2281",
NotSucceedsEqual: "\u2AB0\u0338",
NotSucceedsSlantEqual: "\u22E1",
NotSucceedsTilde: "\u227F\u0338",
NotSuperset: "\u2283\u20D2",
NotSupersetEqual: "\u2289",
NotTilde: "\u2241",
NotTildeEqual: "\u2244",
NotTildeFullEqual: "\u2247",
NotTildeTilde: "\u2249",
NotVerticalBar: "\u2224",
npar: "\u2226",
nparallel: "\u2226",
nparsl: "\u2AFD\u20E5",
npart: "\u2202\u0338",
npolint: "\u2A14",
npr: "\u2280",
nprcue: "\u22E0",
npre: "\u2AAF\u0338",
nprec: "\u2280",
npreceq: "\u2AAF\u0338",
nrArr: "\u21CF",
nrarr: "\u219B",
nrarrc: "\u2933\u0338",
nrarrw: "\u219D\u0338",
nRightarrow: "\u21CF",
nrightarrow: "\u219B",
nrtri: "\u22EB",
nrtrie: "\u22ED",
nsc: "\u2281",
nsccue: "\u22E1",
nsce: "\u2AB0\u0338",
Nscr: "\u{1D4A9}",
nscr: "\u{1D4C3}",
nshortmid: "\u2224",
nshortparallel: "\u2226",
nsim: "\u2241",
nsime: "\u2244",
nsimeq: "\u2244",
nsmid: "\u2224",
nspar: "\u2226",
nsqsube: "\u22E2",
nsqsupe: "\u22E3",
nsub: "\u2284",
nsubE: "\u2AC5\u0338",
nsube: "\u2288",
nsubset: "\u2282\u20D2",
nsubseteq: "\u2288",
nsubseteqq: "\u2AC5\u0338",
nsucc: "\u2281",
nsucceq: "\u2AB0\u0338",
nsup: "\u2285",
nsupE: "\u2AC6\u0338",
nsupe: "\u2289",
nsupset: "\u2283\u20D2",
nsupseteq: "\u2289",
nsupseteqq: "\u2AC6\u0338",
ntgl: "\u2279",
Ntilde: "\xD1",
ntilde: "\xF1",
ntlg: "\u2278",
ntriangleleft: "\u22EA",
ntrianglelefteq: "\u22EC",
ntriangleright: "\u22EB",
ntrianglerighteq: "\u22ED",
Nu: "\u039D",
nu: "\u03BD",
num: "#",
numero: "\u2116",
numsp: "\u2007",
nvap: "\u224D\u20D2",
nVDash: "\u22AF",
nVdash: "\u22AE",
nvDash: "\u22AD",
nvdash: "\u22AC",
nvge: "\u2265\u20D2",
nvgt: ">\u20D2",
nvHarr: "\u2904",
nvinfin: "\u29DE",
nvlArr: "\u2902",
nvle: "\u2264\u20D2",
nvlt: "<\u20D2",
nvltrie: "\u22B4\u20D2",
nvrArr: "\u2903",
nvrtrie: "\u22B5\u20D2",
nvsim: "\u223C\u20D2",
nwarhk: "\u2923",
nwArr: "\u21D6",
nwarr: "\u2196",
nwarrow: "\u2196",
nwnear: "\u2927",
Oacute: "\xD3",
oacute: "\xF3",
oast: "\u229B",
ocir: "\u229A",
Ocirc: "\xD4",
ocirc: "\xF4",
Ocy: "\u041E",
ocy: "\u043E",
odash: "\u229D",
Odblac: "\u0150",
odblac: "\u0151",
odiv: "\u2A38",
odot: "\u2299",
odsold: "\u29BC",
OElig: "\u0152",
oelig: "\u0153",
ofcir: "\u29BF",
Ofr: "\u{1D512}",
ofr: "\u{1D52C}",
ogon: "\u02DB",
Ograve: "\xD2",
ograve: "\xF2",
ogt: "\u29C1",
ohbar: "\u29B5",
ohm: "\u03A9",
oint: "\u222E",
olarr: "\u21BA",
olcir: "\u29BE",
olcross: "\u29BB",
oline: "\u203E",
olt: "\u29C0",
Omacr: "\u014C",
omacr: "\u014D",
Omega: "\u03A9",
omega: "\u03C9",
Omicron: "\u039F",
omicron: "\u03BF",
omid: "\u29B6",
ominus: "\u2296",
Oopf: "\u{1D546}",
oopf: "\u{1D560}",
opar: "\u29B7",
OpenCurlyDoubleQuote: "\u201C",
OpenCurlyQuote: "\u2018",
operp: "\u29B9",
oplus: "\u2295",
Or: "\u2A54",
or: "\u2228",
orarr: "\u21BB",
ord: "\u2A5D",
order: "\u2134",
orderof: "\u2134",
ordf: "\xAA",
ordm: "\xBA",
origof: "\u22B6",
oror: "\u2A56",
orslope: "\u2A57",
orv: "\u2A5B",
oS: "\u24C8",
Oscr: "\u{1D4AA}",
oscr: "\u2134",
Oslash: "\xD8",
oslash: "\xF8",
osol: "\u2298",
Otilde: "\xD5",
otilde: "\xF5",
Otimes: "\u2A37",
otimes: "\u2297",
otimesas: "\u2A36",
Ouml: "\xD6",
ouml: "\xF6",
ovbar: "\u233D",
OverBar: "\u203E",
OverBrace: "\u23DE",
OverBracket: "\u23B4",
OverParenthesis: "\u23DC",
par: "\u2225",
para: "\xB6",
parallel: "\u2225",
parsim: "\u2AF3",
parsl: "\u2AFD",
part: "\u2202",
PartialD: "\u2202",
Pcy: "\u041F",
pcy: "\u043F",
percnt: "%",
period: ".",
permil: "\u2030",
perp: "\u22A5",
pertenk: "\u2031",
Pfr: "\u{1D513}",
pfr: "\u{1D52D}",
Phi: "\u03A6",
phi: "\u03C6",
phiv: "\u03D5",
phmmat: "\u2133",
phone: "\u260E",
Pi: "\u03A0",
pi: "\u03C0",
pitchfork: "\u22D4",
piv: "\u03D6",
planck: "\u210F",
planckh: "\u210E",
plankv: "\u210F",
plus: "+",
plusacir: "\u2A23",
plusb: "\u229E",
pluscir: "\u2A22",
plusdo: "\u2214",
plusdu: "\u2A25",
pluse: "\u2A72",
PlusMinus: "\xB1",
plusmn: "\xB1",
plussim: "\u2A26",
plustwo: "\u2A27",
pm: "\xB1",
Poincareplane: "\u210C",
pointint: "\u2A15",
Popf: "\u2119",
popf: "\u{1D561}",
pound: "\xA3",
Pr: "\u2ABB",
pr: "\u227A",
prap: "\u2AB7",
prcue: "\u227C",
prE: "\u2AB3",
pre: "\u2AAF",
prec: "\u227A",
precapprox: "\u2AB7",
preccurlyeq: "\u227C",
Precedes: "\u227A",
PrecedesEqual: "\u2AAF",
PrecedesSlantEqual: "\u227C",
PrecedesTilde: "\u227E",
preceq: "\u2AAF",
precnapprox: "\u2AB9",
precneqq: "\u2AB5",
precnsim: "\u22E8",
precsim: "\u227E",
Prime: "\u2033",
prime: "\u2032",
primes: "\u2119",
prnap: "\u2AB9",
prnE: "\u2AB5",
prnsim: "\u22E8",
prod: "\u220F",
Product: "\u220F",
profalar: "\u232E",
profline: "\u2312",
profsurf: "\u2313",
prop: "\u221D",
Proportion: "\u2237",
Proportional: "\u221D",
propto: "\u221D",
prsim: "\u227E",
prurel: "\u22B0",
Pscr: "\u{1D4AB}",
pscr: "\u{1D4C5}",
Psi: "\u03A8",
psi: "\u03C8",
puncsp: "\u2008",
Qfr: "\u{1D514}",
qfr: "\u{1D52E}",
qint: "\u2A0C",
Qopf: "\u211A",
qopf: "\u{1D562}",
qprime: "\u2057",
Qscr: "\u{1D4AC}",
qscr: "\u{1D4C6}",
quaternions: "\u210D",
quatint: "\u2A16",
quest: "?",
questeq: "\u225F",
QUOT: '"',
quot: '"',
rAarr: "\u21DB",
race: "\u223D\u0331",
Racute: "\u0154",
racute: "\u0155",
radic: "\u221A",
raemptyv: "\u29B3",
Rang: "\u27EB",
rang: "\u27E9",
rangd: "\u2992",
range: "\u29A5",
rangle: "\u27E9",
raquo: "\xBB",
Rarr: "\u21A0",
rArr: "\u21D2",
rarr: "\u2192",
rarrap: "\u2975",
rarrb: "\u21E5",
rarrbfs: "\u2920",
rarrc: "\u2933",
rarrfs: "\u291E",
rarrhk: "\u21AA",
rarrlp: "\u21AC",
rarrpl: "\u2945",
rarrsim: "\u2974",
Rarrtl: "\u2916",
rarrtl: "\u21A3",
rarrw: "\u219D",
rAtail: "\u291C",
ratail: "\u291A",
ratio: "\u2236",
rationals: "\u211A",
RBarr: "\u2910",
rBarr: "\u290F",
rbarr: "\u290D",
rbbrk: "\u2773",
rbrace: "}",
rbrack: "]",
rbrke: "\u298C",
rbrksld: "\u298E",
rbrkslu: "\u2990",
Rcaron: "\u0158",
rcaron: "\u0159",
Rcedil: "\u0156",
rcedil: "\u0157",
rceil: "\u2309",
rcub: "}",
Rcy: "\u0420",
rcy: "\u0440",
rdca: "\u2937",
rdldhar: "\u2969",
rdquo: "\u201D",
rdquor: "\u201D",
rdsh: "\u21B3",
Re: "\u211C",
real: "\u211C",
realine: "\u211B",
realpart: "\u211C",
reals: "\u211D",
rect: "\u25AD",
REG: "\xAE",
reg: "\xAE",
ReverseElement: "\u220B",
ReverseEquilibrium: "\u21CB",
ReverseUpEquilibrium: "\u296F",
rfisht: "\u297D",
rfloor: "\u230B",
Rfr: "\u211C",
rfr: "\u{1D52F}",
rHar: "\u2964",
rhard: "\u21C1",
rharu: "\u21C0",
rharul: "\u296C",
Rho: "\u03A1",
rho: "\u03C1",
rhov: "\u03F1",
RightAngleBracket: "\u27E9",
RightArrow: "\u2192",
Rightarrow: "\u21D2",
rightarrow: "\u2192",
RightArrowBar: "\u21E5",
RightArrowLeftArrow: "\u21C4",
rightarrowtail: "\u21A3",
RightCeiling: "\u2309",
RightDoubleBracket: "\u27E7",
RightDownTeeVector: "\u295D",
RightDownVector: "\u21C2",
RightDownVectorBar: "\u2955",
RightFloor: "\u230B",
rightharpoondown: "\u21C1",
rightharpoonup: "\u21C0",
rightleftarrows: "\u21C4",
rightleftharpoons: "\u21CC",
rightrightarrows: "\u21C9",
rightsquigarrow: "\u219D",
RightTee: "\u22A2",
RightTeeArrow: "\u21A6",
RightTeeVector: "\u295B",
rightthreetimes: "\u22CC",
RightTriangle: "\u22B3",
RightTriangleBar: "\u29D0",
RightTriangleEqual: "\u22B5",
RightUpDownVector: "\u294F",
RightUpTeeVector: "\u295C",
RightUpVector: "\u21BE",
RightUpVectorBar: "\u2954",
RightVector: "\u21C0",
RightVectorBar: "\u2953",
ring: "\u02DA",
risingdotseq: "\u2253",
rlarr: "\u21C4",
rlhar: "\u21CC",
rlm: "\u200F",
rmoust: "\u23B1",
rmoustache: "\u23B1",
rnmid: "\u2AEE",
roang: "\u27ED",
roarr: "\u21FE",
robrk: "\u27E7",
ropar: "\u2986",
Ropf: "\u211D",
ropf: "\u{1D563}",
roplus: "\u2A2E",
rotimes: "\u2A35",
RoundImplies: "\u2970",
rpar: ")",
rpargt: "\u2994",
rppolint: "\u2A12",
rrarr: "\u21C9",
Rrightarrow: "\u21DB",
rsaquo: "\u203A",
Rscr: "\u211B",
rscr: "\u{1D4C7}",
Rsh: "\u21B1",
rsh: "\u21B1",
rsqb: "]",
rsquo: "\u2019",
rsquor: "\u2019",
rthree: "\u22CC",
rtimes: "\u22CA",
rtri: "\u25B9",
rtrie: "\u22B5",
rtrif: "\u25B8",
rtriltri: "\u29CE",
RuleDelayed: "\u29F4",
ruluhar: "\u2968",
rx: "\u211E",
Sacute: "\u015A",
sacute: "\u015B",
sbquo: "\u201A",
Sc: "\u2ABC",
sc: "\u227B",
scap: "\u2AB8",
Scaron: "\u0160",
scaron: "\u0161",
sccue: "\u227D",
scE: "\u2AB4",
sce: "\u2AB0",
Scedil: "\u015E",
scedil: "\u015F",
Scirc: "\u015C",
scirc: "\u015D",
scnap: "\u2ABA",
scnE: "\u2AB6",
scnsim: "\u22E9",
scpolint: "\u2A13",
scsim: "\u227F",
Scy: "\u0421",
scy: "\u0441",
sdot: "\u22C5",
sdotb: "\u22A1",
sdote: "\u2A66",
searhk: "\u2925",
seArr: "\u21D8",
searr: "\u2198",
searrow: "\u2198",
sect: "\xA7",
semi: ";",
seswar: "\u2929",
setminus: "\u2216",
setmn: "\u2216",
sext: "\u2736",
Sfr: "\u{1D516}",
sfr: "\u{1D530}",
sfrown: "\u2322",
sharp: "\u266F",
SHCHcy: "\u0429",
shchcy: "\u0449",
SHcy: "\u0428",
shcy: "\u0448",
ShortDownArrow: "\u2193",
ShortLeftArrow: "\u2190",
shortmid: "\u2223",
shortparallel: "\u2225",
ShortRightArrow: "\u2192",
ShortUpArrow: "\u2191",
shy: "\xAD",
Sigma: "\u03A3",
sigma: "\u03C3",
sigmaf: "\u03C2",
sigmav: "\u03C2",
sim: "\u223C",
simdot: "\u2A6A",
sime: "\u2243",
simeq: "\u2243",
simg: "\u2A9E",
simgE: "\u2AA0",
siml: "\u2A9D",
simlE: "\u2A9F",
simne: "\u2246",
simplus: "\u2A24",
simrarr: "\u2972",
slarr: "\u2190",
SmallCircle: "\u2218",
smallsetminus: "\u2216",
smashp: "\u2A33",
smeparsl: "\u29E4",
smid: "\u2223",
smile: "\u2323",
smt: "\u2AAA",
smte: "\u2AAC",
smtes: "\u2AAC\uFE00",
SOFTcy: "\u042C",
softcy: "\u044C",
sol: "/",
solb: "\u29C4",
solbar: "\u233F",
Sopf: "\u{1D54A}",
sopf: "\u{1D564}",
spades: "\u2660",
spadesuit: "\u2660",
spar: "\u2225",
sqcap: "\u2293",
sqcaps: "\u2293\uFE00",
sqcup: "\u2294",
sqcups: "\u2294\uFE00",
Sqrt: "\u221A",
sqsub: "\u228F",
sqsube: "\u2291",
sqsubset: "\u228F",
sqsubseteq: "\u2291",
sqsup: "\u2290",
sqsupe: "\u2292",
sqsupset: "\u2290",
sqsupseteq: "\u2292",
squ: "\u25A1",
Square: "\u25A1",
square: "\u25A1",
SquareIntersection: "\u2293",
SquareSubset: "\u228F",
SquareSubsetEqual: "\u2291",
SquareSuperset: "\u2290",
SquareSupersetEqual: "\u2292",
SquareUnion: "\u2294",
squarf: "\u25AA",
squf: "\u25AA",
srarr: "\u2192",
Sscr: "\u{1D4AE}",
sscr: "\u{1D4C8}",
ssetmn: "\u2216",
ssmile: "\u2323",
sstarf: "\u22C6",
Star: "\u22C6",
star: "\u2606",
starf: "\u2605",
straightepsilon: "\u03F5",
straightphi: "\u03D5",
strns: "\xAF",
Sub: "\u22D0",
sub: "\u2282",
subdot: "\u2ABD",
subE: "\u2AC5",
sube: "\u2286",
subedot: "\u2AC3",
submult: "\u2AC1",
subnE: "\u2ACB",
subne: "\u228A",
subplus: "\u2ABF",
subrarr: "\u2979",
Subset: "\u22D0",
subset: "\u2282",
subseteq: "\u2286",
subseteqq: "\u2AC5",
SubsetEqual: "\u2286",
subsetneq: "\u228A",
subsetneqq: "\u2ACB",
subsim: "\u2AC7",
subsub: "\u2AD5",
subsup: "\u2AD3",
succ: "\u227B",
succapprox: "\u2AB8",
succcurlyeq: "\u227D",
Succeeds: "\u227B",
SucceedsEqual: "\u2AB0",
SucceedsSlantEqual: "\u227D",
SucceedsTilde: "\u227F",
succeq: "\u2AB0",
succnapprox: "\u2ABA",
succneqq: "\u2AB6",
succnsim: "\u22E9",
succsim: "\u227F",
SuchThat: "\u220B",
Sum: "\u2211",
sum: "\u2211",
sung: "\u266A",
Sup: "\u22D1",
sup: "\u2283",
sup1: "\xB9",
sup2: "\xB2",
sup3: "\xB3",
supdot: "\u2ABE",
supdsub: "\u2AD8",
supE: "\u2AC6",
supe: "\u2287",
supedot: "\u2AC4",
Superset: "\u2283",
SupersetEqual: "\u2287",
suphsol: "\u27C9",
suphsub: "\u2AD7",
suplarr: "\u297B",
supmult: "\u2AC2",
supnE: "\u2ACC",
supne: "\u228B",
supplus: "\u2AC0",
Supset: "\u22D1",
supset: "\u2283",
supseteq: "\u2287",
supseteqq: "\u2AC6",
supsetneq: "\u228B",
supsetneqq: "\u2ACC",
supsim: "\u2AC8",
supsub: "\u2AD4",
supsup: "\u2AD6",
swarhk: "\u2926",
swArr: "\u21D9",
swarr: "\u2199",
swarrow: "\u2199",
swnwar: "\u292A",
szlig: "\xDF",
Tab: " ",
target: "\u2316",
Tau: "\u03A4",
tau: "\u03C4",
tbrk: "\u23B4",
Tcaron: "\u0164",
tcaron: "\u0165",
Tcedil: "\u0162",
tcedil: "\u0163",
Tcy: "\u0422",
tcy: "\u0442",
tdot: "\u20DB",
telrec: "\u2315",
Tfr: "\u{1D517}",
tfr: "\u{1D531}",
there4: "\u2234",
Therefore: "\u2234",
therefore: "\u2234",
Theta: "\u0398",
theta: "\u03B8",
thetasym: "\u03D1",
thetav: "\u03D1",
thickapprox: "\u2248",
thicksim: "\u223C",
ThickSpace: "\u205F\u200A",
thinsp: "\u2009",
ThinSpace: "\u2009",
thkap: "\u2248",
thksim: "\u223C",
THORN: "\xDE",
thorn: "\xFE",
Tilde: "\u223C",
tilde: "\u02DC",
TildeEqual: "\u2243",
TildeFullEqual: "\u2245",
TildeTilde: "\u2248",
times: "\xD7",
timesb: "\u22A0",
timesbar: "\u2A31",
timesd: "\u2A30",
tint: "\u222D",
toea: "\u2928",
top: "\u22A4",
topbot: "\u2336",
topcir: "\u2AF1",
Topf: "\u{1D54B}",
topf: "\u{1D565}",
topfork: "\u2ADA",
tosa: "\u2929",
tprime: "\u2034",
TRADE: "\u2122",
trade: "\u2122",
triangle: "\u25B5",
triangledown: "\u25BF",
triangleleft: "\u25C3",
trianglelefteq: "\u22B4",
triangleq: "\u225C",
triangleright: "\u25B9",
trianglerighteq: "\u22B5",
tridot: "\u25EC",
trie: "\u225C",
triminus: "\u2A3A",
TripleDot: "\u20DB",
triplus: "\u2A39",
trisb: "\u29CD",
tritime: "\u2A3B",
trpezium: "\u23E2",
Tscr: "\u{1D4AF}",
tscr: "\u{1D4C9}",
TScy: "\u0426",
tscy: "\u0446",
TSHcy: "\u040B",
tshcy: "\u045B",
Tstrok: "\u0166",
tstrok: "\u0167",
twixt: "\u226C",
twoheadleftarrow: "\u219E",
twoheadrightarrow: "\u21A0",
Uacute: "\xDA",
uacute: "\xFA",
Uarr: "\u219F",
uArr: "\u21D1",
uarr: "\u2191",
Uarrocir: "\u2949",
Ubrcy: "\u040E",
ubrcy: "\u045E",
Ubreve: "\u016C",
ubreve: "\u016D",
Ucirc: "\xDB",
ucirc: "\xFB",
Ucy: "\u0423",
ucy: "\u0443",
udarr: "\u21C5",
Udblac: "\u0170",
udblac: "\u0171",
udhar: "\u296E",
ufisht: "\u297E",
Ufr: "\u{1D518}",
ufr: "\u{1D532}",
Ugrave: "\xD9",
ugrave: "\xF9",
uHar: "\u2963",
uharl: "\u21BF",
uharr: "\u21BE",
uhblk: "\u2580",
ulcorn: "\u231C",
ulcorner: "\u231C",
ulcrop: "\u230F",
ultri: "\u25F8",
Umacr: "\u016A",
umacr: "\u016B",
uml: "\xA8",
UnderBar: "_",
UnderBrace: "\u23DF",
UnderBracket: "\u23B5",
UnderParenthesis: "\u23DD",
Union: "\u22C3",
UnionPlus: "\u228E",
Uogon: "\u0172",
uogon: "\u0173",
Uopf: "\u{1D54C}",
uopf: "\u{1D566}",
UpArrow: "\u2191",
Uparrow: "\u21D1",
uparrow: "\u2191",
UpArrowBar: "\u2912",
UpArrowDownArrow: "\u21C5",
UpDownArrow: "\u2195",
Updownarrow: "\u21D5",
updownarrow: "\u2195",
UpEquilibrium: "\u296E",
upharpoonleft: "\u21BF",
upharpoonright: "\u21BE",
uplus: "\u228E",
UpperLeftArrow: "\u2196",
UpperRightArrow: "\u2197",
Upsi: "\u03D2",
upsi: "\u03C5",
upsih: "\u03D2",
Upsilon: "\u03A5",
upsilon: "\u03C5",
UpTee: "\u22A5",
UpTeeArrow: "\u21A5",
upuparrows: "\u21C8",
urcorn: "\u231D",
urcorner: "\u231D",
urcrop: "\u230E",
Uring: "\u016E",
uring: "\u016F",
urtri: "\u25F9",
Uscr: "\u{1D4B0}",
uscr: "\u{1D4CA}",
utdot: "\u22F0",
Utilde: "\u0168",
utilde: "\u0169",
utri: "\u25B5",
utrif: "\u25B4",
uuarr: "\u21C8",
Uuml: "\xDC",
uuml: "\xFC",
uwangle: "\u29A7",
vangrt: "\u299C",
varepsilon: "\u03F5",
varkappa: "\u03F0",
varnothing: "\u2205",
varphi: "\u03D5",
varpi: "\u03D6",
varpropto: "\u221D",
vArr: "\u21D5",
varr: "\u2195",
varrho: "\u03F1",
varsigma: "\u03C2",
varsubsetneq: "\u228A\uFE00",
varsubsetneqq: "\u2ACB\uFE00",
varsupsetneq: "\u228B\uFE00",
varsupsetneqq: "\u2ACC\uFE00",
vartheta: "\u03D1",
vartriangleleft: "\u22B2",
vartriangleright: "\u22B3",
Vbar: "\u2AEB",
vBar: "\u2AE8",
vBarv: "\u2AE9",
Vcy: "\u0412",
vcy: "\u0432",
VDash: "\u22AB",
Vdash: "\u22A9",
vDash: "\u22A8",
vdash: "\u22A2",
Vdashl: "\u2AE6",
Vee: "\u22C1",
vee: "\u2228",
veebar: "\u22BB",
veeeq: "\u225A",
vellip: "\u22EE",
Verbar: "\u2016",
verbar: "|",
Vert: "\u2016",
vert: "|",
VerticalBar: "\u2223",
VerticalLine: "|",
VerticalSeparator: "\u2758",
VerticalTilde: "\u2240",
VeryThinSpace: "\u200A",
Vfr: "\u{1D519}",
vfr: "\u{1D533}",
vltri: "\u22B2",
vnsub: "\u2282\u20D2",
vnsup: "\u2283\u20D2",
Vopf: "\u{1D54D}",
vopf: "\u{1D567}",
vprop: "\u221D",
vrtri: "\u22B3",
Vscr: "\u{1D4B1}",
vscr: "\u{1D4CB}",
vsubnE: "\u2ACB\uFE00",
vsubne: "\u228A\uFE00",
vsupnE: "\u2ACC\uFE00",
vsupne: "\u228B\uFE00",
Vvdash: "\u22AA",
vzigzag: "\u299A",
Wcirc: "\u0174",
wcirc: "\u0175",
wedbar: "\u2A5F",
Wedge: "\u22C0",
wedge: "\u2227",
wedgeq: "\u2259",
weierp: "\u2118",
Wfr: "\u{1D51A}",
wfr: "\u{1D534}",
Wopf: "\u{1D54E}",
wopf: "\u{1D568}",
wp: "\u2118",
wr: "\u2240",
wreath: "\u2240",
Wscr: "\u{1D4B2}",
wscr: "\u{1D4CC}",
xcap: "\u22C2",
xcirc: "\u25EF",
xcup: "\u22C3",
xdtri: "\u25BD",
Xfr: "\u{1D51B}",
xfr: "\u{1D535}",
xhArr: "\u27FA",
xharr: "\u27F7",
Xi: "\u039E",
xi: "\u03BE",
xlArr: "\u27F8",
xlarr: "\u27F5",
xmap: "\u27FC",
xnis: "\u22FB",
xodot: "\u2A00",
Xopf: "\u{1D54F}",
xopf: "\u{1D569}",
xoplus: "\u2A01",
xotime: "\u2A02",
xrArr: "\u27F9",
xrarr: "\u27F6",
Xscr: "\u{1D4B3}",
xscr: "\u{1D4CD}",
xsqcup: "\u2A06",
xuplus: "\u2A04",
xutri: "\u25B3",
xvee: "\u22C1",
xwedge: "\u22C0",
Yacute: "\xDD",
yacute: "\xFD",
YAcy: "\u042F",
yacy: "\u044F",
Ycirc: "\u0176",
ycirc: "\u0177",
Ycy: "\u042B",
ycy: "\u044B",
yen: "\xA5",
Yfr: "\u{1D51C}",
yfr: "\u{1D536}",
YIcy: "\u0407",
yicy: "\u0457",
Yopf: "\u{1D550}",
yopf: "\u{1D56A}",
Yscr: "\u{1D4B4}",
yscr: "\u{1D4CE}",
YUcy: "\u042E",
yucy: "\u044E",
Yuml: "\u0178",
yuml: "\xFF",
Zacute: "\u0179",
zacute: "\u017A",
Zcaron: "\u017D",
zcaron: "\u017E",
Zcy: "\u0417",
zcy: "\u0437",
Zdot: "\u017B",
zdot: "\u017C",
zeetrf: "\u2128",
ZeroWidthSpace: "\u200B",
Zeta: "\u0396",
zeta: "\u03B6",
Zfr: "\u2128",
zfr: "\u{1D537}",
ZHcy: "\u0416",
zhcy: "\u0436",
zigrarr: "\u21DD",
Zopf: "\u2124",
zopf: "\u{1D56B}",
Zscr: "\u{1D4B5}",
zscr: "\u{1D4CF}",
zwj: "\u200D",
zwnj: "\u200C"
});
exports.entityMap = exports.HTML_ENTITIES;
}
});
// node_modules/@xmldom/xmldom/lib/sax.js
var require_sax = __commonJS({
"node_modules/@xmldom/xmldom/lib/sax.js"(exports) {
var NAMESPACE = require_conventions().NAMESPACE;
var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$");
var S_TAG = 0;
var S_ATTR = 1;
var S_ATTR_SPACE = 2;
var S_EQ = 3;
var S_ATTR_NOQUOT_VALUE = 4;
var S_ATTR_END = 5;
var S_TAG_SPACE = 6;
var S_TAG_CLOSE = 7;
function ParseError(message, locator) {
this.message = message;
this.locator = locator;
if (Error.captureStackTrace)
Error.captureStackTrace(this, ParseError);
}
ParseError.prototype = new Error();
ParseError.prototype.name = ParseError.name;
function XMLReader() {
}
XMLReader.prototype = {
parse: function(source, defaultNSMap, entityMap) {
var domBuilder = this.domBuilder;
domBuilder.startDocument();
_copy(defaultNSMap, defaultNSMap = {});
parse2(source, defaultNSMap, entityMap, domBuilder, this.errorHandler);
domBuilder.endDocument();
}
};
function parse2(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {
function fixedFromCharCode(code2) {
if (code2 > 65535) {
code2 -= 65536;
var surrogate1 = 55296 + (code2 >> 10), surrogate2 = 56320 + (code2 & 1023);
return String.fromCharCode(surrogate1, surrogate2);
} else {
return String.fromCharCode(code2);
}
}
function entityReplacer(a3) {
var k2 = a3.slice(1, -1);
if (Object.hasOwnProperty.call(entityMap, k2)) {
return entityMap[k2];
} else if (k2.charAt(0) === "#") {
return fixedFromCharCode(parseInt(k2.substr(1).replace("x", "0x")));
} else {
errorHandler.error("entity not found:" + a3);
return a3;
}
}
function appendText(end3) {
if (end3 > start2) {
var xt = source.substring(start2, end3).replace(/?\w+;/g, entityReplacer);
locator && position(start2);
domBuilder.characters(xt, 0, end3 - start2);
start2 = end3;
}
}
function position(p2, m2) {
while (p2 >= lineEnd && (m2 = linePattern.exec(source))) {
lineStart = m2.index;
lineEnd = lineStart + m2[0].length;
locator.lineNumber++;
}
locator.columnNumber = p2 - lineStart + 1;
}
var lineStart = 0;
var lineEnd = 0;
var linePattern = /.*(?:\r\n?|\n)|.*$/g;
var locator = domBuilder.locator;
var parseStack = [{ currentNSMap: defaultNSMapCopy }];
var closeMap = {};
var start2 = 0;
while (true) {
try {
var tagStart = source.indexOf("<", start2);
if (tagStart < 0) {
if (!source.substr(start2).match(/^\s*$/)) {
var doc = domBuilder.doc;
var text = doc.createTextNode(source.substr(start2));
doc.appendChild(text);
domBuilder.currentElement = text;
}
return;
}
if (tagStart > start2) {
appendText(tagStart);
}
switch (source.charAt(tagStart + 1)) {
case "/":
var end2 = source.indexOf(">", tagStart + 3);
var tagName = source.substring(tagStart + 2, end2).replace(/[ \t\n\r]+$/g, "");
var config = parseStack.pop();
if (end2 < 0) {
tagName = source.substring(tagStart + 2).replace(/[\s<].*/, "");
errorHandler.error("end tag name: " + tagName + " is not complete:" + config.tagName);
end2 = tagStart + 1 + tagName.length;
} else if (tagName.match(/\s)) {
tagName = tagName.replace(/[\s<].*/, "");
errorHandler.error("end tag name: " + tagName + " maybe not complete");
end2 = tagStart + 1 + tagName.length;
}
var localNSMap = config.localNSMap;
var endMatch = config.tagName == tagName;
var endIgnoreCaseMach = endMatch || config.tagName && config.tagName.toLowerCase() == tagName.toLowerCase();
if (endIgnoreCaseMach) {
domBuilder.endElement(config.uri, config.localName, tagName);
if (localNSMap) {
for (var prefix in localNSMap) {
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
domBuilder.endPrefixMapping(prefix);
}
}
}
if (!endMatch) {
errorHandler.fatalError("end tag name: " + tagName + " is not match the current start tagName:" + config.tagName);
}
} else {
parseStack.push(config);
}
end2++;
break;
case "?":
locator && position(tagStart);
end2 = parseInstruction(source, tagStart, domBuilder);
break;
case "!":
locator && position(tagStart);
end2 = parseDCC(source, tagStart, domBuilder, errorHandler);
break;
default:
locator && position(tagStart);
var el = new ElementAttributes();
var currentNSMap = parseStack[parseStack.length - 1].currentNSMap;
var end2 = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler);
var len = el.length;
if (!el.closed && fixSelfClosed(source, end2, el.tagName, closeMap)) {
el.closed = true;
if (!entityMap.nbsp) {
errorHandler.warning("unclosed xml attribute");
}
}
if (locator && len) {
var locator2 = copyLocator(locator, {});
for (var i2 = 0; i2 < len; i2++) {
var a2 = el[i2];
position(a2.offset);
a2.locator = copyLocator(locator, {});
}
domBuilder.locator = locator2;
if (appendElement(el, domBuilder, currentNSMap)) {
parseStack.push(el);
}
domBuilder.locator = locator;
} else {
if (appendElement(el, domBuilder, currentNSMap)) {
parseStack.push(el);
}
}
if (NAMESPACE.isHTML(el.uri) && !el.closed) {
end2 = parseHtmlSpecialContent(source, end2, el.tagName, entityReplacer, domBuilder);
} else {
end2++;
}
}
} catch (e2) {
if (e2 instanceof ParseError) {
throw e2;
}
errorHandler.error("element parse error: " + e2);
end2 = -1;
}
if (end2 > start2) {
start2 = end2;
} else {
appendText(Math.max(tagStart, start2) + 1);
}
}
}
function copyLocator(f2, t3) {
t3.lineNumber = f2.lineNumber;
t3.columnNumber = f2.columnNumber;
return t3;
}
function parseElementStartPart(source, start2, el, currentNSMap, entityReplacer, errorHandler) {
function addAttribute(qname, value2, startIndex) {
if (el.attributeNames.hasOwnProperty(qname)) {
errorHandler.fatalError("Attribute " + qname + " redefined");
}
el.addValue(qname, value2.replace(/[\t\n\r]/g, " ").replace(/?\w+;/g, entityReplacer), startIndex);
}
var attrName;
var value;
var p2 = ++start2;
var s2 = S_TAG;
while (true) {
var c2 = source.charAt(p2);
switch (c2) {
case "=":
if (s2 === S_ATTR) {
attrName = source.slice(start2, p2);
s2 = S_EQ;
} else if (s2 === S_ATTR_SPACE) {
s2 = S_EQ;
} else {
throw new Error("attribute equal must after attrName");
}
break;
case "'":
case '"':
if (s2 === S_EQ || s2 === S_ATTR) {
if (s2 === S_ATTR) {
errorHandler.warning('attribute value must after "="');
attrName = source.slice(start2, p2);
}
start2 = p2 + 1;
p2 = source.indexOf(c2, start2);
if (p2 > 0) {
value = source.slice(start2, p2);
addAttribute(attrName, value, start2 - 1);
s2 = S_ATTR_END;
} else {
throw new Error("attribute value no end '" + c2 + "' match");
}
} else if (s2 == S_ATTR_NOQUOT_VALUE) {
value = source.slice(start2, p2);
addAttribute(attrName, value, start2);
errorHandler.warning('attribute "' + attrName + '" missed start quot(' + c2 + ")!!");
start2 = p2 + 1;
s2 = S_ATTR_END;
} else {
throw new Error('attribute value must after "="');
}
break;
case "/":
switch (s2) {
case S_TAG:
el.setTagName(source.slice(start2, p2));
case S_ATTR_END:
case S_TAG_SPACE:
case S_TAG_CLOSE:
s2 = S_TAG_CLOSE;
el.closed = true;
case S_ATTR_NOQUOT_VALUE:
case S_ATTR:
break;
case S_ATTR_SPACE:
el.closed = true;
break;
default:
throw new Error("attribute invalid close char('/')");
}
break;
case "":
errorHandler.error("unexpected end of input");
if (s2 == S_TAG) {
el.setTagName(source.slice(start2, p2));
}
return p2;
case ">":
switch (s2) {
case S_TAG:
el.setTagName(source.slice(start2, p2));
case S_ATTR_END:
case S_TAG_SPACE:
case S_TAG_CLOSE:
break;
case S_ATTR_NOQUOT_VALUE:
case S_ATTR:
value = source.slice(start2, p2);
if (value.slice(-1) === "/") {
el.closed = true;
value = value.slice(0, -1);
}
case S_ATTR_SPACE:
if (s2 === S_ATTR_SPACE) {
value = attrName;
}
if (s2 == S_ATTR_NOQUOT_VALUE) {
errorHandler.warning('attribute "' + value + '" missed quot(")!');
addAttribute(attrName, value, start2);
} else {
if (!NAMESPACE.isHTML(currentNSMap[""]) || !value.match(/^(?:disabled|checked|selected)$/i)) {
errorHandler.warning('attribute "' + value + '" missed value!! "' + value + '" instead!!');
}
addAttribute(value, value, start2);
}
break;
case S_EQ:
throw new Error("attribute value missed!!");
}
return p2;
case "\x80":
c2 = " ";
default:
if (c2 <= " ") {
switch (s2) {
case S_TAG:
el.setTagName(source.slice(start2, p2));
s2 = S_TAG_SPACE;
break;
case S_ATTR:
attrName = source.slice(start2, p2);
s2 = S_ATTR_SPACE;
break;
case S_ATTR_NOQUOT_VALUE:
var value = source.slice(start2, p2);
errorHandler.warning('attribute "' + value + '" missed quot(")!!');
addAttribute(attrName, value, start2);
case S_ATTR_END:
s2 = S_TAG_SPACE;
break;
}
} else {
switch (s2) {
case S_ATTR_SPACE:
var tagName = el.tagName;
if (!NAMESPACE.isHTML(currentNSMap[""]) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
errorHandler.warning('attribute "' + attrName + '" missed value!! "' + attrName + '" instead2!!');
}
addAttribute(attrName, attrName, start2);
start2 = p2;
s2 = S_ATTR;
break;
case S_ATTR_END:
errorHandler.warning('attribute space is required"' + attrName + '"!!');
case S_TAG_SPACE:
s2 = S_ATTR;
start2 = p2;
break;
case S_EQ:
s2 = S_ATTR_NOQUOT_VALUE;
start2 = p2;
break;
case S_TAG_CLOSE:
throw new Error("elements closed character '/' and '>' must be connected to");
}
}
}
p2++;
}
}
function appendElement(el, domBuilder, currentNSMap) {
var tagName = el.tagName;
var localNSMap = null;
var i2 = el.length;
while (i2--) {
var a2 = el[i2];
var qName = a2.qName;
var value = a2.value;
var nsp = qName.indexOf(":");
if (nsp > 0) {
var prefix = a2.prefix = qName.slice(0, nsp);
var localName = qName.slice(nsp + 1);
var nsPrefix = prefix === "xmlns" && localName;
} else {
localName = qName;
prefix = null;
nsPrefix = qName === "xmlns" && "";
}
a2.localName = localName;
if (nsPrefix !== false) {
if (localNSMap == null) {
localNSMap = {};
_copy(currentNSMap, currentNSMap = {});
}
currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
a2.uri = NAMESPACE.XMLNS;
domBuilder.startPrefixMapping(nsPrefix, value);
}
}
var i2 = el.length;
while (i2--) {
a2 = el[i2];
var prefix = a2.prefix;
if (prefix) {
if (prefix === "xml") {
a2.uri = NAMESPACE.XML;
}
if (prefix !== "xmlns") {
a2.uri = currentNSMap[prefix || ""];
}
}
}
var nsp = tagName.indexOf(":");
if (nsp > 0) {
prefix = el.prefix = tagName.slice(0, nsp);
localName = el.localName = tagName.slice(nsp + 1);
} else {
prefix = null;
localName = el.localName = tagName;
}
var ns = el.uri = currentNSMap[prefix || ""];
domBuilder.startElement(ns, localName, tagName, el);
if (el.closed) {
domBuilder.endElement(ns, localName, tagName);
if (localNSMap) {
for (prefix in localNSMap) {
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
domBuilder.endPrefixMapping(prefix);
}
}
}
} else {
el.currentNSMap = currentNSMap;
el.localNSMap = localNSMap;
return true;
}
}
function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {
if (/^(?:script|textarea)$/i.test(tagName)) {
var elEndStart = source.indexOf("" + tagName + ">", elStartEnd);
var text = source.substring(elStartEnd + 1, elEndStart);
if (/[&<]/.test(text)) {
if (/^script$/i.test(tagName)) {
domBuilder.characters(text, 0, text.length);
return elEndStart;
}
text = text.replace(/?\w+;/g, entityReplacer);
domBuilder.characters(text, 0, text.length);
return elEndStart;
}
}
return elStartEnd + 1;
}
function fixSelfClosed(source, elStartEnd, tagName, closeMap) {
var pos = closeMap[tagName];
if (pos == null) {
pos = source.lastIndexOf("" + tagName + ">");
if (pos < elStartEnd) {
pos = source.lastIndexOf("" + tagName);
}
closeMap[tagName] = pos;
}
return pos < elStartEnd;
}
function _copy(source, target) {
for (var n2 in source) {
if (Object.prototype.hasOwnProperty.call(source, n2)) {
target[n2] = source[n2];
}
}
}
function parseDCC(source, start2, domBuilder, errorHandler) {
var next = source.charAt(start2 + 2);
switch (next) {
case "-":
if (source.charAt(start2 + 3) === "-") {
var end2 = source.indexOf("-->", start2 + 4);
if (end2 > start2) {
domBuilder.comment(source, start2 + 4, end2 - start2 - 4);
return end2 + 3;
} else {
errorHandler.error("Unclosed comment");
return -1;
}
} else {
return -1;
}
default:
if (source.substr(start2 + 3, 6) == "CDATA[") {
var end2 = source.indexOf("]]>", start2 + 9);
domBuilder.startCDATA();
domBuilder.characters(source, start2 + 9, end2 - start2 - 9);
domBuilder.endCDATA();
return end2 + 3;
}
var matchs = split(source, start2);
var len = matchs.length;
if (len > 1 && /!doctype/i.test(matchs[0][0])) {
var name = matchs[1][0];
var pubid = false;
var sysid = false;
if (len > 3) {
if (/^public$/i.test(matchs[2][0])) {
pubid = matchs[3][0];
sysid = len > 4 && matchs[4][0];
} else if (/^system$/i.test(matchs[2][0])) {
sysid = matchs[3][0];
}
}
var lastMatch = matchs[len - 1];
domBuilder.startDTD(name, pubid, sysid);
domBuilder.endDTD();
return lastMatch.index + lastMatch[0].length;
}
}
return -1;
}
function parseInstruction(source, start2, domBuilder) {
var end2 = source.indexOf("?>", start2);
if (end2) {
var match = source.substring(start2, end2).match(/^<\?(\S*)\s*([\s\S]*?)$/);
if (match) {
var len = match[0].length;
domBuilder.processingInstruction(match[1], match[2]);
return end2 + 2;
} else {
return -1;
}
}
return -1;
}
function ElementAttributes() {
this.attributeNames = {};
}
ElementAttributes.prototype = {
setTagName: function(tagName) {
if (!tagNamePattern.test(tagName)) {
throw new Error("invalid tagName:" + tagName);
}
this.tagName = tagName;
},
addValue: function(qName, value, offset5) {
if (!tagNamePattern.test(qName)) {
throw new Error("invalid attribute:" + qName);
}
this.attributeNames[qName] = this.length;
this[this.length++] = { qName, value, offset: offset5 };
},
length: 0,
getLocalName: function(i2) {
return this[i2].localName;
},
getLocator: function(i2) {
return this[i2].locator;
},
getQName: function(i2) {
return this[i2].qName;
},
getURI: function(i2) {
return this[i2].uri;
},
getValue: function(i2) {
return this[i2].value;
}
};
function split(source, start2) {
var match;
var buf = [];
var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
reg.lastIndex = start2;
reg.exec(source);
while (match = reg.exec(source)) {
buf.push(match);
if (match[1])
return buf;
}
}
exports.XMLReader = XMLReader;
exports.ParseError = ParseError;
}
});
// node_modules/@xmldom/xmldom/lib/dom-parser.js
var require_dom_parser = __commonJS({
"node_modules/@xmldom/xmldom/lib/dom-parser.js"(exports) {
var conventions = require_conventions();
var dom = require_dom();
var entities = require_entities();
var sax = require_sax();
var DOMImplementation = dom.DOMImplementation;
var NAMESPACE = conventions.NAMESPACE;
var ParseError = sax.ParseError;
var XMLReader = sax.XMLReader;
function normalizeLineEndings(input) {
return input.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028]/g, "\n");
}
function DOMParser4(options) {
this.options = options || { locator: {} };
}
DOMParser4.prototype.parseFromString = function(source, mimeType) {
var options = this.options;
var sax2 = new XMLReader();
var domBuilder = options.domBuilder || new DOMHandler();
var errorHandler = options.errorHandler;
var locator = options.locator;
var defaultNSMap = options.xmlns || {};
var isHTML = /\/x?html?$/.test(mimeType);
var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
if (locator) {
domBuilder.setDocumentLocator(locator);
}
sax2.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator);
sax2.domBuilder = options.domBuilder || domBuilder;
if (isHTML) {
defaultNSMap[""] = NAMESPACE.HTML;
}
defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
var normalize = options.normalizeLineEndings || normalizeLineEndings;
if (source && typeof source === "string") {
sax2.parse(normalize(source), defaultNSMap, entityMap);
} else {
sax2.errorHandler.error("invalid doc source");
}
return domBuilder.doc;
};
function buildErrorHandler(errorImpl, domBuilder, locator) {
if (!errorImpl) {
if (domBuilder instanceof DOMHandler) {
return domBuilder;
}
errorImpl = domBuilder;
}
var errorHandler = {};
var isCallback = errorImpl instanceof Function;
locator = locator || {};
function build(key) {
var fn3 = errorImpl[key];
if (!fn3 && isCallback) {
fn3 = errorImpl.length == 2 ? function(msg2) {
errorImpl(key, msg2);
} : errorImpl;
}
errorHandler[key] = fn3 && function(msg2) {
fn3("[xmldom " + key + "] " + msg2 + _locator(locator));
} || function() {
};
}
build("warning");
build("error");
build("fatalError");
return errorHandler;
}
function DOMHandler() {
this.cdata = false;
}
function position(locator, node) {
node.lineNumber = locator.lineNumber;
node.columnNumber = locator.columnNumber;
}
DOMHandler.prototype = {
startDocument: function() {
this.doc = new DOMImplementation().createDocument(null, null, null);
if (this.locator) {
this.doc.documentURI = this.locator.systemId;
}
},
startElement: function(namespaceURI, localName, qName, attrs) {
var doc = this.doc;
var el = doc.createElementNS(namespaceURI, qName || localName);
var len = attrs.length;
appendElement(this, el);
this.currentElement = el;
this.locator && position(this.locator, el);
for (var i2 = 0; i2 < len; i2++) {
var namespaceURI = attrs.getURI(i2);
var value = attrs.getValue(i2);
var qName = attrs.getQName(i2);
var attr = doc.createAttributeNS(namespaceURI, qName);
this.locator && position(attrs.getLocator(i2), attr);
attr.value = attr.nodeValue = value;
el.setAttributeNode(attr);
}
},
endElement: function(namespaceURI, localName, qName) {
var current = this.currentElement;
var tagName = current.tagName;
this.currentElement = current.parentNode;
},
startPrefixMapping: function(prefix, uri) {
},
endPrefixMapping: function(prefix) {
},
processingInstruction: function(target, data) {
var ins = this.doc.createProcessingInstruction(target, data);
this.locator && position(this.locator, ins);
appendElement(this, ins);
},
ignorableWhitespace: function(ch, start2, length) {
},
characters: function(chars, start2, length) {
chars = _toString.apply(this, arguments);
if (chars) {
if (this.cdata) {
var charNode = this.doc.createCDATASection(chars);
} else {
var charNode = this.doc.createTextNode(chars);
}
if (this.currentElement) {
this.currentElement.appendChild(charNode);
} else if (/^\s*$/.test(chars)) {
this.doc.appendChild(charNode);
}
this.locator && position(this.locator, charNode);
}
},
skippedEntity: function(name) {
},
endDocument: function() {
this.doc.normalize();
},
setDocumentLocator: function(locator) {
if (this.locator = locator) {
locator.lineNumber = 0;
}
},
comment: function(chars, start2, length) {
chars = _toString.apply(this, arguments);
var comm = this.doc.createComment(chars);
this.locator && position(this.locator, comm);
appendElement(this, comm);
},
startCDATA: function() {
this.cdata = true;
},
endCDATA: function() {
this.cdata = false;
},
startDTD: function(name, publicId, systemId) {
var impl = this.doc.implementation;
if (impl && impl.createDocumentType) {
var dt = impl.createDocumentType(name, publicId, systemId);
this.locator && position(this.locator, dt);
appendElement(this, dt);
this.doc.doctype = dt;
}
},
warning: function(error2) {
console.warn("[xmldom warning] " + error2, _locator(this.locator));
},
error: function(error2) {
console.error("[xmldom error] " + error2, _locator(this.locator));
},
fatalError: function(error2) {
throw new ParseError(error2, this.locator);
}
};
function _locator(l2) {
if (l2) {
return "\n@" + (l2.systemId || "") + "#[line:" + l2.lineNumber + ",col:" + l2.columnNumber + "]";
}
}
function _toString(chars, start2, length) {
if (typeof chars == "string") {
return chars.substr(start2, length);
} else {
if (chars.length >= start2 + length || start2) {
return new java.lang.String(chars, start2, length) + "";
}
return chars;
}
}
"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(key) {
DOMHandler.prototype[key] = function() {
return null;
};
});
function appendElement(hander, node) {
if (!hander.currentElement) {
hander.doc.appendChild(node);
} else {
hander.currentElement.appendChild(node);
}
}
exports.__DOMHandler = DOMHandler;
exports.normalizeLineEndings = normalizeLineEndings;
exports.DOMParser = DOMParser4;
}
});
// node_modules/@xmldom/xmldom/lib/index.js
var require_lib = __commonJS({
"node_modules/@xmldom/xmldom/lib/index.js"(exports) {
var dom = require_dom();
exports.DOMImplementation = dom.DOMImplementation;
exports.XMLSerializer = dom.XMLSerializer;
exports.DOMParser = require_dom_parser().DOMParser;
}
});
// node_modules/xml-parser-xo/dist/cjs/index.js
var require_cjs = __commonJS({
"node_modules/xml-parser-xo/dist/cjs/index.js"(exports, module2) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParsingError = void 0;
var ParsingError = class extends Error {
constructor(message, cause) {
super(message);
this.cause = cause;
}
};
exports.ParsingError = ParsingError;
var parsingState;
function nextChild() {
return element(false) || text() || comment() || cdata() || processingInstruction(false);
}
function nextRootChild() {
match(/\s*/);
return element(true) || comment() || doctype() || processingInstruction(false);
}
function parseDocument() {
const declaration = processingInstruction(true);
const children = [];
let documentRootNode;
let child = nextRootChild();
while (child) {
if (child.node.type === "Element") {
if (documentRootNode) {
throw new Error("Found multiple root nodes");
}
documentRootNode = child.node;
}
if (!child.excluded) {
children.push(child.node);
}
child = nextRootChild();
}
if (!documentRootNode) {
throw new ParsingError("Failed to parse XML", "Root Element not found");
}
if (parsingState.xml.length !== 0) {
throw new ParsingError("Failed to parse XML", "Not Well-Formed XML");
}
return {
declaration: declaration ? declaration.node : null,
root: documentRootNode,
children
};
}
function processingInstruction(matchDeclaration) {
const m2 = matchDeclaration ? match(/^<\?(xml(-stylesheet)?)\s*/) : match(/^<\?([\w-:.]+)\s*/);
if (!m2)
return;
const node = {
name: m2[1],
type: "ProcessingInstruction",
attributes: {}
};
while (!(eos() || is("?>"))) {
const attr = attribute();
if (attr) {
node.attributes[attr.name] = attr.value;
} else {
return;
}
}
match(/\?>/);
return {
excluded: matchDeclaration ? false : parsingState.options.filter(node) === false,
node
};
}
function element(matchRoot) {
const m2 = match(/^<([^?!>\s]+)\s*/);
if (!m2)
return;
const node = {
type: "Element",
name: m2[1],
attributes: {},
children: []
};
const excluded = matchRoot ? false : parsingState.options.filter(node) === false;
while (!(eos() || is(">") || is("?>") || is("/>"))) {
const attr = attribute();
if (attr) {
node.attributes[attr.name] = attr.value;
} else {
return;
}
}
if (match(/^\s*\/>/)) {
node.children = null;
return {
excluded,
node
};
}
match(/\??>/);
let child = nextChild();
while (child) {
if (!child.excluded) {
node.children.push(child.node);
}
child = nextChild();
}
if (parsingState.options.strictMode) {
const closingTag = `${node.name}>`;
if (parsingState.xml.startsWith(closingTag)) {
parsingState.xml = parsingState.xml.slice(closingTag.length);
} else {
throw new ParsingError("Failed to parse XML", `Closing tag not matching "${closingTag}"`);
}
} else {
match(/^<\/[\w-:.\u00C0-\u00FF]+\s*>/);
}
return {
excluded,
node
};
}
function doctype() {
const m2 = match(/^]*>/) || match(/^]*>/) || match(/^/) || match(/^/);
if (m2) {
const node = {
type: "DocumentType",
content: m2[0]
};
return {
excluded: parsingState.options.filter(node) === false,
node
};
}
}
function cdata() {
if (parsingState.xml.startsWith("");
if (endPositionStart > -1) {
const endPositionFinish = endPositionStart + 3;
const node = {
type: "CDATA",
content: parsingState.xml.substring(0, endPositionFinish)
};
parsingState.xml = parsingState.xml.slice(endPositionFinish);
return {
excluded: parsingState.options.filter(node) === false,
node
};
}
}
}
function comment() {
const m2 = match(/^/);
if (m2) {
const node = {
type: "Comment",
content: m2[0]
};
return {
excluded: parsingState.options.filter(node) === false,
node
};
}
}
function text() {
const m2 = match(/^([^<]+)/);
if (m2) {
const node = {
type: "Text",
content: m2[1]
};
return {
excluded: parsingState.options.filter(node) === false,
node
};
}
}
function attribute() {
const m2 = match(/([^=]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)\s*/);
if (m2) {
return {
name: m2[1].trim(),
value: stripQuotes(m2[2].trim())
};
}
}
function stripQuotes(val) {
return val.replace(/^['"]|['"]$/g, "");
}
function match(re2) {
const m2 = parsingState.xml.match(re2);
if (m2) {
parsingState.xml = parsingState.xml.slice(m2[0].length);
return m2;
}
}
function eos() {
return parsingState.xml.length === 0;
}
function is(prefix) {
return parsingState.xml.indexOf(prefix) === 0;
}
function parseXml(xml, options = {}) {
xml = xml.trim();
const filter2 = options.filter || (() => true);
parsingState = {
xml,
options: Object.assign(Object.assign({}, options), { filter: filter2, strictMode: options.strictMode === true })
};
return parseDocument();
}
if (typeof module2 !== "undefined" && typeof exports === "object") {
module2.exports = parseXml;
}
exports.default = parseXml;
}
});
// node_modules/xml-formatter/dist/cjs/index.js
var require_cjs2 = __commonJS({
"node_modules/xml-formatter/dist/cjs/index.js"(exports, module2) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var xml_parser_xo_1 = __importDefault2(require_cjs());
function newLine(state) {
if (!state.options.indentation && !state.options.lineSeparator)
return;
state.content += state.options.lineSeparator;
let i2;
for (i2 = 0; i2 < state.level; i2++) {
state.content += state.options.indentation;
}
}
function indent(state) {
state.content = state.content.replace(/ +$/, "");
let i2;
for (i2 = 0; i2 < state.level; i2++) {
state.content += state.options.indentation;
}
}
function appendContent(state, content) {
state.content += content;
}
function processNode(node, state, preserveSpace) {
if (typeof node.content === "string") {
processContent(node.content, state, preserveSpace);
} else if (node.type === "Element") {
processElementNode(node, state, preserveSpace);
} else if (node.type === "ProcessingInstruction") {
processProcessingIntruction(node, state);
} else {
throw new Error("Unknown node type: " + node.type);
}
}
function processContent(content, state, preserveSpace) {
if (!preserveSpace) {
const trimmedContent = content.trim();
if (state.options.lineSeparator) {
content = trimmedContent;
} else if (trimmedContent.length === 0) {
content = trimmedContent;
}
}
if (content.length > 0) {
if (!preserveSpace && state.content.length > 0) {
newLine(state);
}
appendContent(state, content);
}
}
function isPathMatchingIgnoredPaths(path, ignoredPaths) {
const fullPath = "/" + path.join("/");
const pathLastPart = path[path.length - 1];
return ignoredPaths.includes(pathLastPart) || ignoredPaths.includes(fullPath);
}
function processElementNode(node, state, preserveSpace) {
state.path.push(node.name);
if (!preserveSpace && state.content.length > 0) {
newLine(state);
}
appendContent(state, "<" + node.name);
processAttributes(state, node.attributes);
if (node.children === null || state.options.forceSelfClosingEmptyTag && node.children.length === 0) {
const selfClosingNodeClosingTag = state.options.whiteSpaceAtEndOfSelfclosingTag ? " />" : "/>";
appendContent(state, selfClosingNodeClosingTag);
} else if (node.children.length === 0) {
appendContent(state, ">" + node.name + ">");
} else {
const nodeChildren = node.children;
appendContent(state, ">");
state.level++;
let nodePreserveSpace = node.attributes["xml:space"] === "preserve" || preserveSpace;
let ignoredPath = false;
if (!nodePreserveSpace && state.options.ignoredPaths) {
ignoredPath = isPathMatchingIgnoredPaths(state.path, state.options.ignoredPaths);
nodePreserveSpace = ignoredPath;
}
if (!nodePreserveSpace && state.options.collapseContent) {
let containsTextNodes = false;
let containsTextNodesWithLineBreaks = false;
let containsNonTextNodes = false;
nodeChildren.forEach(function(child, index3) {
if (child.type === "Text") {
if (child.content.includes("\n")) {
containsTextNodesWithLineBreaks = true;
child.content = child.content.trim();
} else if ((index3 === 0 || index3 === nodeChildren.length - 1) && !preserveSpace) {
if (child.content.trim().length === 0) {
child.content = "";
}
}
if (child.content.trim().length > 0 || nodeChildren.length === 1) {
containsTextNodes = true;
}
} else if (child.type === "CDATA") {
containsTextNodes = true;
} else {
containsNonTextNodes = true;
}
});
if (containsTextNodes && (!containsNonTextNodes || !containsTextNodesWithLineBreaks)) {
nodePreserveSpace = true;
}
}
nodeChildren.forEach(function(child) {
processNode(child, state, preserveSpace || nodePreserveSpace);
});
state.level--;
if (!preserveSpace && !nodePreserveSpace) {
newLine(state);
}
if (ignoredPath) {
indent(state);
}
appendContent(state, "" + node.name + ">");
}
state.path.pop();
}
function processAttributes(state, attributes) {
Object.keys(attributes).forEach(function(attr) {
const escaped = attributes[attr].replace(/"/g, """);
appendContent(state, " " + attr + '="' + escaped + '"');
});
}
function processProcessingIntruction(node, state) {
if (state.content.length > 0) {
newLine(state);
}
appendContent(state, "" + node.name);
processAttributes(state, node.attributes);
appendContent(state, "?>");
}
function formatXml(xml, options = {}) {
options.indentation = "indentation" in options ? options.indentation : " ";
options.collapseContent = options.collapseContent === true;
options.lineSeparator = "lineSeparator" in options ? options.lineSeparator : "\r\n";
options.whiteSpaceAtEndOfSelfclosingTag = options.whiteSpaceAtEndOfSelfclosingTag === true;
options.throwOnFailure = options.throwOnFailure !== false;
try {
const parsedXml = (0, xml_parser_xo_1.default)(xml, { filter: options.filter, strictMode: options.strictMode });
const state = { content: "", level: 0, options, path: [] };
if (parsedXml.declaration) {
processProcessingIntruction(parsedXml.declaration, state);
}
parsedXml.children.forEach(function(child) {
processNode(child, state, false);
});
if (!options.lineSeparator) {
return state.content;
}
return state.content.replace(/\r\n/g, "\n").replace(/\n/g, options.lineSeparator);
} catch (err) {
if (options.throwOnFailure) {
throw err;
}
return xml;
}
}
formatXml.minify = (xml, options = {}) => {
return formatXml(xml, Object.assign(Object.assign({}, options), { indentation: "", lineSeparator: "" }));
};
if (typeof module2 !== "undefined" && typeof exports === "object") {
module2.exports = formatXml;
}
exports.default = formatXml;
}
});
// src/components/formats/current/utils/buildFileStr.ts
function buildInkCanvasFileStr(pageData) {
let fileStr = pageData.svgString || "";
const parser = new import_xmldom.DOMParser();
const doc = parser.parseFromString(fileStr, "image/svg+xml");
const svgElement = doc.documentElement;
const existingMetadata = svgElement.getElementsByTagName("metadata");
while (existingMetadata.length > 0) {
existingMetadata[0].parentNode?.removeChild(existingMetadata[0]);
}
const metadataElement = doc.createElement("metadata");
const inkMetaElement = doc.createElement("ink");
inkMetaElement.setAttribute("plugin-version", String(pageData.meta.pluginVersion));
inkMetaElement.setAttribute("file-type", pageData.meta.fileType);
metadataElement.appendChild(inkMetaElement);
const inkCanvasElement = doc.createElement("ink-canvas");
inkCanvasElement.setAttribute("version", INK_CANVAS_FORMAT_VERSION);
inkCanvasElement.textContent = JSON.stringify(pageData.inkCanvas, null, 2);
metadataElement.appendChild(inkCanvasElement);
svgElement.appendChild(metadataElement);
const serializedSvg = new import_xmldom.XMLSerializer().serializeToString(svgElement);
return (0, import_xml_formatter.default)(serializedSvg, {
indentation: " ",
lineSeparator: "\n"
});
}
function buildTldrawFileStr(pageData) {
let fileStr = pageData.svgString || "";
const parser = new import_xmldom.DOMParser();
const doc = parser.parseFromString(fileStr, "image/svg+xml");
const svgElement = doc.documentElement;
const tldrawJson = pageData.tldraw;
const existingMetadata = svgElement.getElementsByTagName("metadata");
while (existingMetadata.length > 0) {
existingMetadata[0].parentNode?.removeChild(existingMetadata[0]);
}
const metadataElement = doc.createElement("metadata");
const inkMetaElement = doc.createElement("ink");
inkMetaElement.setAttribute("plugin-version", String(pageData.meta.pluginVersion));
inkMetaElement.setAttribute("file-type", pageData.meta.fileType);
if (pageData.meta.writingLineHeight !== void 0) {
inkMetaElement.setAttribute("writing-line-height", String(pageData.meta.writingLineHeight));
}
metadataElement.appendChild(inkMetaElement);
const settingsElement = doc.createElement("tldraw");
settingsElement.setAttribute("version", String(TLDRAW_VERSION));
settingsElement.textContent = JSON.stringify(tldrawJson, null, 2);
metadataElement.appendChild(settingsElement);
svgElement.appendChild(metadataElement);
const serializedSvg = new import_xmldom.XMLSerializer().serializeToString(svgElement);
return (0, import_xml_formatter.default)(serializedSvg, {
indentation: " ",
lineSeparator: "\n"
});
}
var import_xmldom, import_xml_formatter, buildFileStr;
var init_buildFileStr = __esm({
"src/components/formats/current/utils/buildFileStr.ts"() {
init_constants();
import_xmldom = __toESM(require_lib());
import_xml_formatter = __toESM(require_cjs2());
init_ink_file_storage_engine();
buildFileStr = (pageData) => {
if (isInkCanvasFile(pageData))
return buildInkCanvasFileStr(pageData);
return buildTldrawFileStr(pageData);
};
}
});
// src/types/embed-settings.ts
function formatEmbedAspectRatio(aspectRatio) {
return aspectRatio.toFixed(3);
}
function buildNewDrawingEmbedSettings() {
const aspectRatio = DEFAULT_EMBED_SETTINGS.embedDisplay.aspectRatio;
return {
...DEFAULT_EMBED_SETTINGS,
embedDisplay: { ...DEFAULT_EMBED_SETTINGS.embedDisplay },
viewBox: {
x: 0,
y: 0,
width: WRITING_PAGE_WIDTH,
height: WRITING_PAGE_WIDTH / aspectRatio
}
};
}
function isWritingAlignedDrawingEmbed(settings) {
return settings.viewBox.width === WRITING_PAGE_WIDTH;
}
var DEFAULT_EMBED_SETTINGS;
var init_embed_settings = __esm({
"src/types/embed-settings.ts"() {
init_constants();
DEFAULT_EMBED_SETTINGS = {
embedDisplay: {
width: 500,
aspectRatio: 16 / 9
},
viewBox: {
x: 0,
y: 0,
width: 500,
height: 281
}
};
}
});
// src/components/formats/current/utils/build-embeds.ts
function buildDrawingEmbedLine(filepath, options) {
const s2 = options?.embedSettings ?? (options?.writingAlignedViewBox ? buildNewDrawingEmbedSettings() : DEFAULT_EMBED_SETTINGS);
const params = new URLSearchParams({
width: String(s2.embedDisplay.width),
aspectRatio: formatEmbedAspectRatio(s2.embedDisplay.aspectRatio),
viewBoxX: String(s2.viewBox.x),
viewBoxY: String(s2.viewBox.y),
viewBoxW: String(s2.viewBox.width),
viewBoxH: String(s2.viewBox.height)
});
if (options?.pendingPaste)
params.append("pendingPaste", "true");
const url = `${INK_EMBED_BASE_URL}?type=inkDrawing&${params.toString()}`;
return `  [Edit Drawing](${url})`;
}
function buildWritingEmbedLine(filepath, options) {
const params = new URLSearchParams();
if (options?.aspectRatio != null && Number.isFinite(options.aspectRatio) && options.aspectRatio > 0) {
params.append("aspectRatio", formatEmbedAspectRatio(options.aspectRatio));
}
if (options?.pendingPaste)
params.append("pendingPaste", "true");
const query = params.toString();
const url = query ? `${INK_EMBED_BASE_URL}?type=inkWriting&${query}` : `${INK_EMBED_BASE_URL}?type=inkWriting`;
return `  [Edit Writing](${url})`;
}
var buildDrawingEmbed, buildWritingEmbed;
var init_build_embeds = __esm({
"src/components/formats/current/utils/build-embeds.ts"() {
init_constants();
init_embed_settings();
buildDrawingEmbed = (filepath, options) => {
const line = buildDrawingEmbedLine(filepath, options);
return `
${line}
`;
};
buildWritingEmbed = (filepath, options) => {
const line = buildWritingEmbedLine(filepath, options);
return `
${line}
`;
};
}
});
// src/components/formats/current/utils/parse-settings-from-url.ts
function parseSettingsFromUrl(urlAndEmbedSettings) {
let infoUrl = urlAndEmbedSettings;
let embedSettings = structuredClone(DEFAULT_EMBED_SETTINGS);
let isPendingPaste = false;
const questionMarkIndex = urlAndEmbedSettings.indexOf("?");
if (questionMarkIndex !== -1) {
infoUrl = urlAndEmbedSettings.substring(0, questionMarkIndex);
const embedSettingsStr = urlAndEmbedSettings.substring(questionMarkIndex + 1);
const urlParams = embedSettingsStr.split("&").reduce((acc, pair) => {
const [key, value] = pair.split("=");
if (key && value) {
acc[key] = decodeURIComponent(value);
}
return acc;
}, {});
if (urlParams.width) {
embedSettings.embedDisplay.width = parseFloat(urlParams.width);
}
if (urlParams.aspectRatio) {
embedSettings.embedDisplay.aspectRatio = parseFloat(urlParams.aspectRatio);
}
if (urlParams.viewBoxX) {
embedSettings.viewBox.x = parseFloat(urlParams.viewBoxX);
}
if (urlParams.viewBoxY) {
embedSettings.viewBox.y = parseFloat(urlParams.viewBoxY);
}
if (urlParams.viewBoxW) {
embedSettings.viewBox.width = parseFloat(urlParams.viewBoxW);
} else if (urlParams.viewBoxWidth) {
embedSettings.viewBox.width = parseFloat(urlParams.viewBoxWidth);
}
if (urlParams.viewBoxH) {
embedSettings.viewBox.height = parseFloat(urlParams.viewBoxH);
} else if (urlParams.viewBoxHeight) {
embedSettings.viewBox.height = parseFloat(urlParams.viewBoxHeight);
}
if (urlParams.pendingPaste === "true") {
isPendingPaste = true;
}
}
return { infoUrl, embedSettings, isPendingPaste };
}
var init_parse_settings_from_url = __esm({
"src/components/formats/current/utils/parse-settings-from-url.ts"() {
init_embed_settings();
}
});
// node_modules/perfect-freehand/dist/esm/index.mjs
function i(e2, t3, n2, r2 = (e3) => e3) {
return e2 * r2(0.5 - t3 * (0.5 - n2));
}
function o(e2, t3, n2) {
let r2 = a(1, t3 / n2);
return a(1, e2 + (a(1, 1 - r2) - e2) * (r2 * 0.275));
}
function s(e2) {
return [-e2[0], -e2[1]];
}
function c(e2, t3) {
return [e2[0] + t3[0], e2[1] + t3[1]];
}
function l(e2, t3, n2) {
return e2[0] = t3[0] + n2[0], e2[1] = t3[1] + n2[1], e2;
}
function u(e2, t3) {
return [e2[0] - t3[0], e2[1] - t3[1]];
}
function d(e2, t3, n2) {
return e2[0] = t3[0] - n2[0], e2[1] = t3[1] - n2[1], e2;
}
function f(e2, t3) {
return [e2[0] * t3, e2[1] * t3];
}
function p(e2, t3, n2) {
return e2[0] = t3[0] * n2, e2[1] = t3[1] * n2, e2;
}
function m(e2, t3) {
return [e2[0] / t3, e2[1] / t3];
}
function h(e2) {
return [e2[1], -e2[0]];
}
function g(e2, t3) {
let n2 = t3[0];
return e2[0] = t3[1], e2[1] = -n2, e2;
}
function ee(e2, t3) {
return e2[0] * t3[0] + e2[1] * t3[1];
}
function _(e2, t3) {
return e2[0] === t3[0] && e2[1] === t3[1];
}
function v(e2) {
return Math.hypot(e2[0], e2[1]);
}
function y(e2, t3) {
let n2 = e2[0] - t3[0], r2 = e2[1] - t3[1];
return n2 * n2 + r2 * r2;
}
function b(e2) {
return m(e2, v(e2));
}
function x(e2, t3) {
return Math.hypot(e2[1] - t3[1], e2[0] - t3[0]);
}
function S(e2, t3, n2) {
let r2 = Math.sin(n2), i2 = Math.cos(n2), a2 = e2[0] - t3[0], o2 = e2[1] - t3[1], s2 = a2 * i2 - o2 * r2, c2 = a2 * r2 + o2 * i2;
return [s2 + t3[0], c2 + t3[1]];
}
function C(e2, t3, n2, r2) {
let i2 = Math.sin(r2), a2 = Math.cos(r2), o2 = t3[0] - n2[0], s2 = t3[1] - n2[1], c2 = o2 * a2 - s2 * i2, l2 = o2 * i2 + s2 * a2;
return e2[0] = c2 + n2[0], e2[1] = l2 + n2[1], e2;
}
function w(e2, t3, n2) {
return c(e2, f(u(t3, e2), n2));
}
function te(e2, t3, n2, r2) {
let i2 = n2[0] - t3[0], a2 = n2[1] - t3[1];
return e2[0] = t3[0] + i2 * r2, e2[1] = t3[1] + a2 * r2, e2;
}
function T(e2, t3, n2) {
return c(e2, f(t3, n2));
}
function k(e2, n2) {
let r2 = T(e2, b(h(u(e2, c(e2, [1, 1])))), -n2), i2 = [], a2 = 1 / 13;
for (let n3 = a2; n3 <= 1; n3 += a2)
i2.push(S(r2, e2, t * 2 * n3));
return i2;
}
function A(e2, n2, r2) {
let i2 = [], a2 = 1 / r2;
for (let r3 = a2; r3 <= 1; r3 += a2)
i2.push(S(n2, e2, t * r3));
return i2;
}
function j(e2, t3, n2) {
let r2 = u(t3, n2), i2 = f(r2, 0.5), a2 = f(r2, 0.51);
return [u(e2, i2), u(e2, a2), c(e2, a2), c(e2, i2)];
}
function M(e2, n2, r2, i2) {
let a2 = [], o2 = T(e2, n2, r2), s2 = 1 / i2;
for (let n3 = s2; n3 < 1; n3 += s2)
a2.push(S(o2, e2, t * 3 * n3));
return a2;
}
function ne(e2, t3, n2) {
return [c(e2, f(t3, n2)), c(e2, f(t3, n2 * 0.99)), u(e2, f(t3, n2 * 0.99)), u(e2, f(t3, n2))];
}
function N(e2, t3, n2) {
return e2 === false || e2 === void 0 ? 0 : e2 === true ? Math.max(t3, n2) : e2;
}
function re(e2, t3, n2) {
return e2.slice(0, 10).reduce((e3, r2) => {
let i2 = r2.pressure;
return t3 && (i2 = o(e3, r2.distance, n2)), (e3 + i2) / 2;
}, e2[0].pressure);
}
function P(e2, n2 = {}) {
let { size: r2 = 16, smoothing: a2 = 0.5, thinning: f2 = 0.5, simulatePressure: m2 = true, easing: _2 = (e3) => e3, start: v2 = {}, end: b2 = {}, last: x2 = false } = n2, { cap: S2 = true, easing: w2 = (e3) => e3 * (2 - e3) } = v2, { cap: T2 = true, easing: P2 = (e3) => --e3 * e3 * e3 + 1 } = b2;
if (e2.length === 0 || r2 <= 0)
return [];
let F2 = e2[e2.length - 1].runningLength, I2 = N(v2.taper, r2, F2), L2 = N(b2.taper, r2, F2), R2 = (r2 * a2) ** 2, z = [], B = [], V = re(e2, m2, r2), H = i(r2, f2, e2[e2.length - 1].pressure, _2), U, W = e2[0].vector, G = e2[0].point, K = G, q = G, J = K, Y = false;
for (let n3 = 0; n3 < e2.length; n3++) {
let { pressure: a3 } = e2[n3], { point: s2, vector: h2, distance: v3, runningLength: b3 } = e2[n3], x3 = n3 === e2.length - 1;
if (!x3 && F2 - b3 < 3)
continue;
f2 ? (m2 && (a3 = o(V, v3, r2)), H = i(r2, f2, a3, _2)) : H = r2 / 2, U === void 0 && (U = H);
let S3 = b3 < I2 ? w2(b3 / I2) : 1, T3 = F2 - b3 < L2 ? P2((F2 - b3) / L2) : 1;
H = Math.max(0.01, H * Math.min(S3, T3));
let k2 = (x3 ? e2[n3] : e2[n3 + 1]).vector, A2 = x3 ? 1 : ee(h2, k2), j2 = ee(h2, W) < 0 && !Y, M2 = A2 !== null && A2 < 0;
if (j2 || M2) {
g(E, W), p(E, E, H);
for (let e3 = 0; e3 <= 1; e3 += 0.07692307692307693)
d(D, s2, E), C(D, D, s2, t * e3), q = [D[0], D[1]], z.push(q), l(O, s2, E), C(O, O, s2, t * -e3), J = [O[0], O[1]], B.push(J);
G = q, K = J, M2 && (Y = true);
continue;
}
if (Y = false, x3) {
g(E, h2), p(E, E, H), z.push(u(s2, E)), B.push(c(s2, E));
continue;
}
te(E, k2, h2, A2), g(E, E), p(E, E, H), d(D, s2, E), q = [D[0], D[1]], (n3 <= 1 || y(G, q) > R2) && (z.push(q), G = q), l(O, s2, E), J = [O[0], O[1]], (n3 <= 1 || y(K, J) > R2) && (B.push(J), K = J), V = a3, W = h2;
}
let X = [e2[0].point[0], e2[0].point[1]], Z = e2.length > 1 ? [e2[e2.length - 1].point[0], e2[e2.length - 1].point[1]] : c(e2[0].point, [1, 1]), Q = [], $ = [];
if (e2.length === 1) {
if (!(I2 || L2) || x2)
return k(X, U || H);
} else {
I2 || L2 && e2.length === 1 || (S2 ? Q.push(...A(X, B[0], 13)) : Q.push(...j(X, z[0], B[0])));
let t3 = h(s(e2[e2.length - 1].vector));
L2 || I2 && e2.length === 1 ? $.push(Z) : T2 ? $.push(...M(Z, t3, H, 29)) : $.push(...ne(Z, t3, H));
}
return z.concat($, B.reverse(), Q);
}
function I(e2) {
return e2 != null && e2 >= 0;
}
function L(e2, t3 = {}) {
let { streamline: i2 = 0.5, size: a2 = 16, last: o2 = false } = t3;
if (e2.length === 0)
return [];
let s2 = 0.15 + (1 - i2) * 0.85, l2 = Array.isArray(e2[0]) ? e2 : e2.map(({ x: e3, y: t4, pressure: r2 = n }) => [e3, t4, r2]);
if (l2.length === 2) {
let e3 = l2[1];
l2 = l2.slice(0, -1);
for (let t4 = 1; t4 < 5; t4++)
l2.push(w(l2[0], e3, t4 / 4));
}
l2.length === 1 && (l2 = [...l2, [...c(l2[0], r), ...l2[0].slice(2)]]);
let u2 = [{ point: [l2[0][0], l2[0][1]], pressure: I(l2[0][2]) ? l2[0][2] : 0.25, vector: [...r], distance: 0, runningLength: 0 }], f2 = false, p2 = 0, m2 = u2[0], h2 = l2.length - 1;
for (let e3 = 1; e3 < l2.length; e3++) {
let t4 = o2 && e3 === h2 ? [l2[e3][0], l2[e3][1]] : w(m2.point, l2[e3], s2);
if (_(m2.point, t4))
continue;
let r2 = x(t4, m2.point);
if (p2 += r2, e3 < h2 && !f2) {
if (p2 < a2)
continue;
f2 = true;
}
d(F, m2.point, t4), m2 = { point: t4, pressure: I(l2[e3][2]) ? l2[e3][2] : n, vector: b(F), distance: r2, runningLength: p2 }, u2.push(m2);
}
return u2[0].vector = u2[1]?.vector || [0, 0], u2;
}
function R(e2, t3 = {}) {
return P(L(e2, t3), t3);
}
var e, t, n, r, a, E, D, O, F;
var init_esm2 = __esm({
"node_modules/perfect-freehand/dist/esm/index.mjs"() {
({ PI: e } = Math);
t = e + 1e-4;
n = 0.5;
r = [1, 1];
({ min: a } = Math);
E = [0, 0];
D = [0, 0];
O = [0, 0];
F = [0, 0];
}
});
// src/default-content-colours.ts
var DEFAULT_CONTENT_COLOUR_PRIMARY_STROKE, DEFAULT_CONTENT_COLOUR_WRITING_LINE, INK_SVG_STROKE_PATH_CLASS, INK_SVG_WRITING_LINE_CLASS;
var init_default_content_colours = __esm({
"src/default-content-colours.ts"() {
DEFAULT_CONTENT_COLOUR_PRIMARY_STROKE = "#000000";
DEFAULT_CONTENT_COLOUR_WRITING_LINE = "#888888";
INK_SVG_STROKE_PATH_CLASS = "ink-type-stroke ink-color-primary";
INK_SVG_WRITING_LINE_CLASS = "ink-type-writing-line ink-color-writing-line";
}
});
// src/ink-canvas/utils/svg-path-from-stroke.ts
function getSvgPathFromStroke(points, closed = true) {
const len = points.length;
if (len < 4)
return "";
let a2 = points[0];
let b2 = points[1];
const c2 = points[2];
let result = `M${a2[0].toFixed(2)},${a2[1].toFixed(2)} Q${b2[0].toFixed(2)},${b2[1].toFixed(2)} ${average(b2[0], c2[0]).toFixed(2)},${average(b2[1], c2[1]).toFixed(2)} T`;
for (let i2 = 2, max3 = len - 1; i2 < max3; i2++) {
a2 = points[i2];
b2 = points[i2 + 1];
result += `${average(a2[0], b2[0]).toFixed(2)},${average(a2[1], b2[1]).toFixed(2)} `;
}
if (closed)
result += "Z";
return result;
}
function average(a2, b2) {
return (a2 + b2) / 2;
}
var init_svg_path_from_stroke = __esm({
"src/ink-canvas/utils/svg-path-from-stroke.ts"() {
}
});
// src/ink-canvas/stroke-easing.ts
function penStrokePressureEasing(t3) {
return t3 * 0.65 + Math.sin(t3 * Math.PI / 2) * 0.35;
}
function identityStrokePressureEasing(t3) {
return t3;
}
function inkStrokeUsesPenEasing(style) {
if (style.inputKind === "pen")
return true;
if (style.inputKind === "mouse")
return false;
return !style.simulatePressure;
}
var init_stroke_easing = __esm({
"src/ink-canvas/stroke-easing.ts"() {
}
});
// src/ink-canvas/camera.ts
function clampZoom(zoom) {
return Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, zoom));
}
function zoomAtPoint(camera, anchorScreenX, anchorScreenY, direction) {
const factor = direction > 0 ? ZOOM_FACTOR : 1 / ZOOM_FACTOR;
const newZoom = clampZoom(camera.zoom * factor);
const zoomDelta = 1 / newZoom - 1 / camera.zoom;
return {
x: camera.x + anchorScreenX * zoomDelta,
y: camera.y + anchorScreenY * zoomDelta,
zoom: newZoom
};
}
function panByScreenDelta(camera, deltaScreenX, deltaScreenY) {
return {
x: camera.x + deltaScreenX / camera.zoom,
y: camera.y + deltaScreenY / camera.zoom,
zoom: camera.zoom
};
}
function screenToPage(camera, containerRect, screenX, screenY) {
return {
x: (screenX - containerRect.left) / camera.zoom - camera.x,
y: (screenY - containerRect.top) / camera.zoom - camera.y
};
}
function fitBoundsToViewport(viewportWidth, viewportHeight, bounds, padding = 16) {
if (bounds.width <= 0 || bounds.height <= 0) {
return { x: 0, y: 0, zoom: 0.3 };
}
const zoom = clampZoom(Math.min((viewportWidth - padding * 2) / bounds.width, (viewportHeight - padding * 2) / bounds.height, 1));
const boundsCenterX = bounds.x + bounds.width / 2;
const boundsCenterY = bounds.y + bounds.height / 2;
return {
x: viewportWidth / (2 * zoom) - boundsCenterX,
y: viewportHeight / (2 * zoom) - boundsCenterY,
zoom
};
}
function embedViewBoxFromCamera(camera, viewportWidth, viewportHeight) {
const zoom = camera.zoom > 0 ? camera.zoom : MIN_ZOOM;
return {
x: -camera.x,
y: -camera.y,
width: viewportWidth / zoom,
height: viewportHeight / zoom
};
}
function adjustCameraToPreservePagePointAtScreenTargets(camera, oldContainerRect, anchorScreenX, anchorScreenY, newContainerRect, targetScreenX, targetScreenY) {
const pageX = (anchorScreenX - oldContainerRect.left) / camera.zoom - camera.x;
const pageY = (anchorScreenY - oldContainerRect.top) / camera.zoom - camera.y;
return {
x: (targetScreenX - newContainerRect.left) / camera.zoom - pageX,
y: (targetScreenY - newContainerRect.top) / camera.zoom - pageY,
zoom: camera.zoom
};
}
function adjustCameraToPreserveViewportCenter(camera, oldContainerRect, newContainerRect) {
const anchorScreenX = oldContainerRect.left + oldContainerRect.width / 2;
const anchorScreenY = oldContainerRect.top + oldContainerRect.height / 2;
const targetScreenX = newContainerRect.left + newContainerRect.width / 2;
const targetScreenY = newContainerRect.top + newContainerRect.height / 2;
return adjustCameraToPreservePagePointAtScreenTargets(camera, oldContainerRect, anchorScreenX, anchorScreenY, newContainerRect, targetScreenX, targetScreenY);
}
function getRightDragZoomDelta(startX, startY, clientX, clientY) {
const deltaY = startY - clientY;
const deltaX = clientX - startX;
return deltaX + deltaY;
}
var MIN_ZOOM, MAX_ZOOM, ZOOM_FACTOR;
var init_camera = __esm({
"src/ink-canvas/camera.ts"() {
MIN_ZOOM = 0.1;
MAX_ZOOM = 5;
ZOOM_FACTOR = 1.08;
}
});
// src/ink-canvas/constants/erase-tool.ts
var ERASER_HIT_RADIUS_REFERENCE, ERASER_RING_SAMPLE_COUNT, ERASER_SWEEP_SAMPLE_SPACING_REFERENCE, INK_STROKE_PENDING_ERASE_CLASS, INK_STROKE_PENDING_ERASE_ANIMATION_MS;
var init_erase_tool = __esm({
"src/ink-canvas/constants/erase-tool.ts"() {
ERASER_HIT_RADIUS_REFERENCE = 15;
ERASER_RING_SAMPLE_COUNT = 8;
ERASER_SWEEP_SAMPLE_SPACING_REFERENCE = 8;
INK_STROKE_PENDING_ERASE_CLASS = "ink-stroke--pending-erase";
INK_STROKE_PENDING_ERASE_ANIMATION_MS = 1e3;
}
});
// src/ink-canvas/stroke-zoom-scale.ts
function clampCaptureZoom(zoom) {
return clampZoom(zoom);
}
function captureZoomLerpT(captureZoom, zoomRef = INK_STROKE_ZOOM_REFERENCE, zoomMin = INK_STROKE_ZOOM_MIN) {
const z = clampCaptureZoom(captureZoom);
if (z >= zoomRef)
return 0;
const t3 = (1 / z - 1) / (1 / zoomMin - 1);
return Math.min(1, Math.max(0, t3));
}
function metricForCaptureZoom(referenceValue, zoomOutTarget, captureZoom, zoomRef = INK_STROKE_ZOOM_REFERENCE) {
const z = clampCaptureZoom(captureZoom);
if (z < zoomRef) {
const t3 = captureZoomLerpT(z, zoomRef, INK_STROKE_ZOOM_MIN);
return referenceValue + t3 * (zoomOutTarget - referenceValue);
}
return referenceValue * (zoomRef / z);
}
function numericForCaptureZoom(referenceValue, captureZoom, treatAs, zoomRef = INK_STROKE_ZOOM_REFERENCE) {
const target = STREAMLINE_SMOOTHING_ZOOM_OUT_TARGET[treatAs];
const value = metricForCaptureZoom(referenceValue, target, captureZoom, zoomRef);
return Math.min(1, Math.max(0, value));
}
function screenConstantMetricForCameraZoom(referenceValue, cameraZoom, zoomRef = INK_STROKE_ZOOM_REFERENCE) {
const z = clampCaptureZoom(cameraZoom);
const zoomOutTarget = referenceValue * (zoomRef / INK_STROKE_ZOOM_MIN);
return metricForCaptureZoom(referenceValue, zoomOutTarget, z, zoomRef) * z;
}
function eraserHitRadiusScreenPx(cameraZoom) {
return screenConstantMetricForCameraZoom(ERASER_HIT_RADIUS_REFERENCE, cameraZoom);
}
function eraserSweepSpacingScreenPx(cameraZoom) {
return screenConstantMetricForCameraZoom(ERASER_SWEEP_SAMPLE_SPACING_REFERENCE, cameraZoom);
}
var INK_STROKE_ZOOM_REFERENCE, INK_STROKE_ZOOM_MIN, STREAMLINE_SMOOTHING_ZOOM_OUT_TARGET;
var init_stroke_zoom_scale = __esm({
"src/ink-canvas/stroke-zoom-scale.ts"() {
init_camera();
init_erase_tool();
INK_STROKE_ZOOM_REFERENCE = 1;
INK_STROKE_ZOOM_MIN = 0.1;
STREAMLINE_SMOOTHING_ZOOM_OUT_TARGET = {
pen: 0.2,
mouse: 0.65
};
}
});
// src/ink-canvas/types.ts
function toStrokeOptions(style) {
const easing = inkStrokeUsesPenEasing(style) ? penStrokePressureEasing : identityStrokePressureEasing;
return {
size: style.size,
thinning: style.thinning,
smoothing: style.smoothing,
streamline: style.streamline,
simulatePressure: style.simulatePressure,
easing,
last: true,
start: { cap: true, taper: 0 },
end: { cap: true, taper: 0 },
captureZoom: style.captureZoom ?? INK_STROKE_ZOOM_REFERENCE
};
}
var DEFAULT_STROKE_STYLE;
var init_types = __esm({
"src/ink-canvas/types.ts"() {
init_stroke_easing();
init_stroke_zoom_scale();
DEFAULT_STROKE_STYLE = {
size: 8,
thinning: 0.5,
smoothing: 0.5,
streamline: 0.5,
simulatePressure: true,
color: "currentColor"
};
}
});
// src/ink-canvas/svg-export.ts
function renderStrokesToSvg(strokes, snapshotJson, padding = 16) {
if (strokes.length === 0) {
return buildSvgString("", "0 0 1 1", snapshotJson);
}
const bounds = computeStrokesBounds(strokes);
const viewBox = [
bounds.minX - padding,
bounds.minY - padding,
bounds.width + padding * 2,
bounds.height + padding * 2
].join(" ");
let pathsMarkup = "";
for (const stroke of strokes) {
const outlinePoints = R(stroke.points, toStrokeOptions(stroke.style));
const d2 = getSvgPathFromStroke(outlinePoints);
pathsMarkup += buildStrokePathMarkup(d2, stroke.offset.x, stroke.offset.y);
}
return buildSvgString(pathsMarkup, viewBox, snapshotJson);
}
function renderWritingStrokesToSvg(strokes, snapshot, pageWidth, padding = 0) {
const lineHeight = snapshot.writingLineHeight ?? WRITING_LINE_HEIGHT;
let height = WRITING_MIN_PAGE_HEIGHT;
if (strokes.length > 0) {
const bounds = computeStrokesBounds(strokes);
const numFilledLines = Math.ceil((bounds.maxY + padding) / lineHeight);
height = Math.max((numFilledLines + 0.5) * lineHeight, WRITING_MIN_PAGE_HEIGHT);
}
const margin = pageWidth * 0.05;
let guideMarkup = "";
const lineCount = Math.floor(height / lineHeight);
for (let i2 = 1; i2 <= lineCount; i2++) {
const y2 = i2 * lineHeight;
guideMarkup += `
`;
}
let pathsMarkup = "";
for (const stroke of strokes) {
const outlinePoints = R(stroke.points, toStrokeOptions(stroke.style));
const d2 = getSvgPathFromStroke(outlinePoints);
pathsMarkup += buildStrokePathMarkup(d2, stroke.offset.x, stroke.offset.y);
}
const viewBox = `0 0 ${pageWidth} ${height}`;
return buildSvgString(guideMarkup + pathsMarkup, viewBox, snapshot);
}
function buildStrokePathMarkup(d2, offsetX, offsetY) {
const pathAttrs = `d="${d2}" fill="${DEFAULT_CONTENT_COLOUR_PRIMARY_STROKE}" class="${INK_SVG_STROKE_PATH_CLASS}"`;
const hasOffset = offsetX !== 0 || offsetY !== 0;
if (hasOffset) {
return `
`;
}
return `
`;
}
function buildSvgString(pathsMarkup, viewBox, snapshotJson) {
const metadataJson = JSON.stringify(snapshotJson);
return [
``
].join("\n");
}
function escapeXml(str) {
return str.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """);
}
function computeStrokesBounds(strokes) {
let minX = Infinity;
let minY = Infinity;
let maxX = -Infinity;
let maxY = -Infinity;
for (const stroke of strokes) {
const outlinePoints = R(stroke.points, toStrokeOptions(stroke.style));
for (const [px, py] of outlinePoints) {
const x2 = px + stroke.offset.x;
const y2 = py + stroke.offset.y;
if (x2 < minX)
minX = x2;
if (y2 < minY)
minY = y2;
if (x2 > maxX)
maxX = x2;
if (y2 > maxY)
maxY = y2;
}
}
return {
minX,
minY,
maxX,
maxY,
width: maxX - minX,
height: maxY - minY
};
}
var init_svg_export = __esm({
"src/ink-canvas/svg-export.ts"() {
init_esm2();
init_default_content_colours();
init_constants();
init_svg_path_from_stroke();
init_types();
}
});
// src/logic/utils/extractInkJsonFromSvg.ts
function sniffInkSvgFileType(svgString) {
const trimmedStart = svgString.trimStart();
if (!trimmedStart.startsWith("<"))
return null;
const hasInkMarker = /]/i.test(svgString) || /]/i.test(svgString) || /]/i.test(svgString);
if (!hasInkMarker)
return null;
const isWriting = /file-type\s*=\s*["']inkWriting["']/i.test(svgString);
const isDrawing = /file-type\s*=\s*["']inkDrawing["']/i.test(svgString);
if (isWriting && !isDrawing)
return "inkWriting";
if (isDrawing && !isWriting)
return "inkDrawing";
if (!isWriting && !isDrawing && /]/i.test(svgString)) {
return "inkDrawing";
}
return null;
}
function extractInkJsonFromSvg(svgString) {
try {
const parser = new import_xmldom2.DOMParser();
const doc = parser.parseFromString(svgString, "image/svg+xml");
const parseError = doc.getElementsByTagName("parsererror");
if (parseError.length > 0) {
console.warn("Failed to parse SVG as XML");
return null;
}
const metadataElements = doc.getElementsByTagName("metadata");
if (metadataElements.length === 0) {
console.warn("No metadata element found in SVG");
return null;
}
const metadataElement = metadataElements[0];
const inkCanvasElements = metadataElement.getElementsByTagName("ink-canvas");
if (inkCanvasElements.length > 0) {
return extractInkCanvasFormat(metadataElement, inkCanvasElements[0], svgString);
}
return extractTldrawFormat(metadataElement, svgString);
} catch (error2) {
console.error("Error extracting ink metadata JSON:", error2);
return null;
}
}
function extractInkCanvasFormat(metadataElement, inkCanvasElement, svgString) {
const jsonText = inkCanvasElement.textContent?.trim();
if (!jsonText) {
console.warn("No JSON content in element");
return null;
}
const inkCanvasSnapshot = JSON.parse(jsonText);
const inkElements = metadataElement.getElementsByTagName("ink");
let fileTypeText;
if (inkElements.length > 0) {
fileTypeText = inkElements[0].getAttribute("file-type") || void 0;
}
if (!fileTypeText)
fileTypeText = "inkDrawing";
const pluginVersionAttr = inkElements.length > 0 ? inkElements[0].getAttribute("plugin-version") || "" : "";
return {
meta: {
pluginVersion: pluginVersionAttr,
tldrawVersion: "",
fileType: fileTypeText
},
tldraw: {},
inkCanvas: inkCanvasSnapshot,
svgString
};
}
function extractTldrawFormat(metadataElement, svgString) {
const inkElements = metadataElement.getElementsByTagName("ink");
let fileTypeText;
if (inkElements.length > 0) {
fileTypeText = inkElements[0].getAttribute("file-type") || void 0;
}
if (!fileTypeText) {
console.warn("No filetype found in metadata");
return null;
}
if (fileTypeText !== "inkDrawing" && fileTypeText !== "inkWriting") {
console.warn("Unsupported or missing filetype in metadata");
return null;
}
const tldrawElements = metadataElement.getElementsByTagName("tldraw");
if (tldrawElements.length === 0) {
console.warn("No tldraw element found in metadata");
return null;
}
const settingsElement = tldrawElements[0];
const jsonText = settingsElement.textContent?.trim();
if (!jsonText) {
console.warn("No JSON content found in metadata settings element");
return null;
}
const tldrawSnapshot = JSON.parse(jsonText);
const pluginVersionAttr = inkElements.length > 0 ? inkElements[0].getAttribute("plugin-version") || void 0 : void 0;
const tldrawVersionAttr = settingsElement.getAttribute("version") || void 0;
const writingLineHeightAttr = inkElements.length > 0 ? inkElements[0].getAttribute("writing-line-height") : null;
const writingLineHeightParsed = writingLineHeightAttr ? parseInt(writingLineHeightAttr, 10) : void 0;
const writingLineHeight = writingLineHeightParsed !== void 0 && !isNaN(writingLineHeightParsed) ? writingLineHeightParsed : void 0;
return {
meta: {
pluginVersion: pluginVersionAttr || "",
tldrawVersion: tldrawVersionAttr || "",
fileType: fileTypeText,
writingLineHeight
},
tldraw: tldrawSnapshot,
svgString
};
}
var import_xmldom2;
var init_extractInkJsonFromSvg = __esm({
"src/logic/utils/extractInkJsonFromSvg.ts"() {
import_xmldom2 = __toESM(require_lib());
}
});
// src/ink-canvas/migrate-from-tldraw.ts
function getTldrawStoreForMigration(tldrawSnapshot) {
const topLevel = tldrawSnapshot.store;
if (topLevel)
return topLevel;
const nested = tldrawSnapshot.document?.store;
if (nested)
return nested;
return void 0;
}
function readGridEnabledFromTldrawSession(tldrawSnapshot) {
return tldrawSnapshot.session?.isGridMode !== false;
}
function migrateFromTldraw(tldrawSnapshot) {
const snapshot = {
version: 1,
strokes: [],
gridEnabled: readGridEnabledFromTldrawSession(tldrawSnapshot)
};
const store = getTldrawStoreForMigration(tldrawSnapshot);
if (!store)
return snapshot;
const captureZoom = readCameraZoomFromStore(store);
for (const key of Object.keys(store)) {
const record = store[key];
const isDrawShape = record.typeName === "shape" && record.type === "draw";
if (!isDrawShape)
continue;
const drawRecord = record;
const stroke = convertDrawShape(drawRecord, captureZoom);
if (stroke)
snapshot.strokes.push(stroke);
}
return snapshot;
}
function migrateWritingFromTldraw(tldrawSnapshot, fallbackLineHeight = WRITING_LINE_HEIGHT) {
const snapshot = {
version: 1,
strokes: [],
gridEnabled: false,
writingLineHeight: fallbackLineHeight
};
const store = getTldrawStoreForMigration(tldrawSnapshot);
if (!store)
return snapshot;
let writingLineHeight = fallbackLineHeight;
const documentRecord = store["document:document"];
if (documentRecord) {
const meta = documentRecord.meta;
if (meta && typeof meta.writingLineHeight === "number" && meta.writingLineHeight > 0) {
writingLineHeight = meta.writingLineHeight;
}
}
const captureZoom = readCameraZoomFromStore(store);
for (const key of Object.keys(store)) {
const record = store[key];
const isDrawShape = record.typeName === "shape" && record.type === "draw";
if (!isDrawShape)
continue;
const drawRecord = record;
const stroke = convertDrawShape(drawRecord, captureZoom);
if (stroke)
snapshot.strokes.push(stroke);
}
snapshot.writingLineHeight = writingLineHeight;
return snapshot;
}
function readCameraZoomFromStore(store) {
for (const key of Object.keys(store)) {
const record = store[key];
if (record.typeName !== "camera")
continue;
const cam = record;
return cam.z ?? 1;
}
return 1;
}
function convertDrawShape(shape, captureZoom) {
const allPoints = [];
for (const segment of shape.props.segments) {
for (const pt of segment.points) {
allPoints.push([pt.x, pt.y, pt.z ?? 0.5]);
}
}
if (allPoints.length === 0)
return null;
const style = mapTldrawStyle(shape.props, captureZoom);
return {
id: shape.id,
points: allPoints,
style,
offset: { x: shape.x, y: shape.y }
};
}
function mapTldrawStyle(props, _captureZoom) {
const basePx = TLDRAW_SIZE_TO_PX[props.size] ?? TLDRAW_SIZE_TO_PX["m"];
const effectiveSize = 1 + basePx * 1.5;
return buildTldrawMigrationStrokeStyle(props, effectiveSize);
}
function buildTldrawMigrationStrokeStyle(props, effectiveSize) {
return {
...DEFAULT_STROKE_STYLE,
size: effectiveSize,
color: "currentColor",
simulatePressure: !props.isPen,
inputKind: props.isPen ? "pen" : "mouse",
captureZoom: INK_STROKE_ZOOM_REFERENCE
};
}
var TLDRAW_SIZE_TO_PX;
var init_migrate_from_tldraw = __esm({
"src/ink-canvas/migrate-from-tldraw.ts"() {
init_constants();
init_types();
init_stroke_zoom_scale();
TLDRAW_SIZE_TO_PX = {
s: 2,
m: 3.5,
l: 5,
xl: 10
};
}
});
// src/logic/utils/ink-file-has-strokes.ts
function getInkStrokesFromSvg(svgString) {
const inkFileData = extractInkJsonFromSvg(svgString);
if (!inkFileData)
return [];
if (isInkCanvasFile(inkFileData) && inkFileData.inkCanvas) {
return inkFileData.inkCanvas.strokes ?? [];
}
const migrated = migrateFromTldraw(inkFileData.tldraw);
return migrated.strokes ?? [];
}
function inkFileHasStrokes(svgString) {
return getInkStrokesFromSvg(svgString).length > 0;
}
function showLockedChrome(settingEnabled, hasStrokes) {
return settingEnabled || hasStrokes === false;
}
var init_ink_file_has_strokes = __esm({
"src/logic/utils/ink-file-has-strokes.ts"() {
init_ink_file_storage_engine();
init_extractInkJsonFromSvg();
init_migrate_from_tldraw();
}
});
// src/logic/utils/build-drawing-embed-settings-from-file.ts
function cloneDefaultEmbedSettings() {
return {
...DEFAULT_EMBED_SETTINGS,
embedDisplay: { ...DEFAULT_EMBED_SETTINGS.embedDisplay },
viewBox: { ...DEFAULT_EMBED_SETTINGS.viewBox }
};
}
function buildEmbedSettingsWithFittedViewBox(strokes) {
const embedDisplay = { ...DEFAULT_EMBED_SETTINGS.embedDisplay };
const viewportWidth = embedDisplay.width;
const viewportHeight = viewportWidth / embedDisplay.aspectRatio;
const bounds = computeStrokesBounds(strokes);
const camera = fitBoundsToViewport(viewportWidth, viewportHeight, {
x: bounds.minX,
y: bounds.minY,
width: bounds.width,
height: bounds.height
}, EMBED_FIT_PADDING_PX);
return {
...DEFAULT_EMBED_SETTINGS,
embedDisplay,
viewBox: embedViewBoxFromCamera(camera, viewportWidth, viewportHeight)
};
}
function buildDrawingEmbedSettingsFromStrokes(strokes) {
if (strokes.length === 0)
return null;
const bounds = computeStrokesBounds(strokes);
if (!Number.isFinite(bounds.width) || !Number.isFinite(bounds.height) || bounds.width <= 0 || bounds.height <= 0) {
return null;
}
return buildEmbedSettingsWithFittedViewBox(strokes);
}
async function buildDrawingEmbedSettingsFromFile(plugin, file) {
try {
const svgString = await plugin.app.vault.read(file);
const strokes = getInkStrokesFromSvg(svgString);
return buildDrawingEmbedSettingsFromStrokes(strokes) ?? cloneDefaultEmbedSettings();
} catch {
return cloneDefaultEmbedSettings();
}
}
var EMBED_FIT_PADDING_PX;
var init_build_drawing_embed_settings_from_file = __esm({
"src/logic/utils/build-drawing-embed-settings-from-file.ts"() {
init_svg_export();
init_camera();
init_ink_file_has_strokes();
init_embed_settings();
EMBED_FIT_PADDING_PX = 16;
}
});
// src/logic/utils/writing-embed-aspect-ratio.ts
function parseSvgViewBoxAspectRatio(svgString) {
const viewBoxMatch = svgString.match(/