chaite
Version:
core for chatgpt-plugin and karin-plugin-chatgpt
1,329 lines (1,305 loc) • 197 kB
JavaScript
import { a as __toCommonJS, i as __require, t as __commonJS } from "../../rolldown-runtime-DVriDoez.mjs";
import { n as index_all_exports, r as init_index_all, t as require_lop } from "../lop/index.mjs-BWbOMJZv.mjs";
import { t as require_promise } from "../bluebird/index.mjs-D4zFjek8.mjs";
import { s as require_base64_js } from "../@google/genai/index.mjs-BrdPnzXZ.mjs";
import { t as require_lib$2 } from "../jszip/index.mjs-DKtD_vT2.mjs";
import { n as require_dom, t as require_lib$3 } from "../@xmldom/xmldom/index.mjs-BARr5-gb.mjs";
import { t as require_dist } from "../dingbat-to-unicode/index.mjs-DjR5pQCM.mjs";
//#region node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/promises.js
var require_promises = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/promises.js": ((exports) => {
var _$19 = (init_index_all(), __toCommonJS(index_all_exports));
var bluebird = require_promise()();
exports.defer = defer;
exports.when = bluebird.resolve;
exports.resolve = bluebird.resolve;
exports.all = bluebird.all;
exports.props = bluebird.props;
exports.reject = bluebird.reject;
exports.promisify = bluebird.promisify;
exports.mapSeries = bluebird.mapSeries;
exports.attempt = bluebird.attempt;
exports.nfcall = function(func) {
var args = Array.prototype.slice.call(arguments, 1);
return bluebird.promisify(func).apply(null, args);
};
bluebird.prototype.fail = bluebird.prototype.caught;
bluebird.prototype.also = function(func) {
return this.then(function(value) {
var returnValue = _$19.extend({}, value, func(value));
return bluebird.props(returnValue);
});
};
function defer() {
var resolve;
var reject;
var promise = new bluebird.Promise(function(resolveArg, rejectArg) {
resolve = resolveArg;
reject = rejectArg;
});
return {
resolve,
reject,
promise
};
}
}) });
//#endregion
//#region node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/documents.js
var require_documents = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/documents.js": ((exports) => {
var _$18 = (init_index_all(), __toCommonJS(index_all_exports));
var types = exports.types = {
document: "document",
paragraph: "paragraph",
run: "run",
text: "text",
tab: "tab",
checkbox: "checkbox",
hyperlink: "hyperlink",
noteReference: "noteReference",
image: "image",
note: "note",
commentReference: "commentReference",
comment: "comment",
table: "table",
tableRow: "tableRow",
tableCell: "tableCell",
"break": "break",
bookmarkStart: "bookmarkStart"
};
function Document(children, options) {
options = options || {};
return {
type: types.document,
children,
notes: options.notes || new Notes({}),
comments: options.comments || []
};
}
function Paragraph(children, properties) {
properties = properties || {};
var indent = properties.indent || {};
return {
type: types.paragraph,
children,
styleId: properties.styleId || null,
styleName: properties.styleName || null,
numbering: properties.numbering || null,
alignment: properties.alignment || null,
indent: {
start: indent.start || null,
end: indent.end || null,
firstLine: indent.firstLine || null,
hanging: indent.hanging || null
}
};
}
function Run(children, properties) {
properties = properties || {};
return {
type: types.run,
children,
styleId: properties.styleId || null,
styleName: properties.styleName || null,
isBold: !!properties.isBold,
isUnderline: !!properties.isUnderline,
isItalic: !!properties.isItalic,
isStrikethrough: !!properties.isStrikethrough,
isAllCaps: !!properties.isAllCaps,
isSmallCaps: !!properties.isSmallCaps,
verticalAlignment: properties.verticalAlignment || verticalAlignment.baseline,
font: properties.font || null,
fontSize: properties.fontSize || null,
highlight: properties.highlight || null
};
}
var verticalAlignment = {
baseline: "baseline",
superscript: "superscript",
subscript: "subscript"
};
function Text(value) {
return {
type: types.text,
value
};
}
function Tab() {
return { type: types.tab };
}
function Checkbox(options) {
return {
type: types.checkbox,
checked: options.checked
};
}
function Hyperlink(children, options) {
return {
type: types.hyperlink,
children,
href: options.href,
anchor: options.anchor,
targetFrame: options.targetFrame
};
}
function NoteReference(options) {
return {
type: types.noteReference,
noteType: options.noteType,
noteId: options.noteId
};
}
function Notes(notes) {
this._notes = _$18.indexBy(notes, function(note) {
return noteKey(note.noteType, note.noteId);
});
}
Notes.prototype.resolve = function(reference) {
return this.findNoteByKey(noteKey(reference.noteType, reference.noteId));
};
Notes.prototype.findNoteByKey = function(key) {
return this._notes[key] || null;
};
function Note(options) {
return {
type: types.note,
noteType: options.noteType,
noteId: options.noteId,
body: options.body
};
}
function commentReference(options) {
return {
type: types.commentReference,
commentId: options.commentId
};
}
function comment(options) {
return {
type: types.comment,
commentId: options.commentId,
body: options.body,
authorName: options.authorName,
authorInitials: options.authorInitials
};
}
function noteKey(noteType, id) {
return noteType + "-" + id;
}
function Image(options) {
return {
type: types.image,
read: function(encoding) {
if (encoding) return options.readImage(encoding);
else return options.readImage().then(function(arrayBuffer) {
return Buffer.from(arrayBuffer);
});
},
readAsArrayBuffer: function() {
return options.readImage();
},
readAsBase64String: function() {
return options.readImage("base64");
},
readAsBuffer: function() {
return options.readImage().then(function(arrayBuffer) {
return Buffer.from(arrayBuffer);
});
},
altText: options.altText,
contentType: options.contentType
};
}
function Table(children, properties) {
properties = properties || {};
return {
type: types.table,
children,
styleId: properties.styleId || null,
styleName: properties.styleName || null
};
}
function TableRow(children, options) {
options = options || {};
return {
type: types.tableRow,
children,
isHeader: options.isHeader || false
};
}
function TableCell(children, options) {
options = options || {};
return {
type: types.tableCell,
children,
colSpan: options.colSpan == null ? 1 : options.colSpan,
rowSpan: options.rowSpan == null ? 1 : options.rowSpan
};
}
function Break(breakType) {
return {
type: types["break"],
breakType
};
}
function BookmarkStart(options) {
return {
type: types.bookmarkStart,
name: options.name
};
}
exports.document = exports.Document = Document;
exports.paragraph = exports.Paragraph = Paragraph;
exports.run = exports.Run = Run;
exports.text = exports.Text = Text;
exports.tab = exports.Tab = Tab;
exports.checkbox = exports.Checkbox = Checkbox;
exports.Hyperlink = Hyperlink;
exports.noteReference = exports.NoteReference = NoteReference;
exports.Notes = Notes;
exports.Note = Note;
exports.commentReference = commentReference;
exports.comment = comment;
exports.Image = Image;
exports.Table = Table;
exports.TableRow = TableRow;
exports.TableCell = TableCell;
exports.lineBreak = Break("line");
exports.pageBreak = Break("page");
exports.columnBreak = Break("column");
exports.BookmarkStart = BookmarkStart;
exports.verticalAlignment = verticalAlignment;
}) });
//#endregion
//#region node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/results.js
var require_results = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/results.js": ((exports) => {
var _$17 = (init_index_all(), __toCommonJS(index_all_exports));
exports.Result = Result$6;
exports.success = success;
exports.warning = warning$1;
exports.error = error;
function Result$6(value, messages) {
this.value = value;
this.messages = messages || [];
}
Result$6.prototype.map = function(func) {
return new Result$6(func(this.value), this.messages);
};
Result$6.prototype.flatMap = function(func) {
var funcResult = func(this.value);
return new Result$6(funcResult.value, combineMessages([this, funcResult]));
};
Result$6.prototype.flatMapThen = function(func) {
var that = this;
return func(this.value).then(function(otherResult) {
return new Result$6(otherResult.value, combineMessages([that, otherResult]));
});
};
Result$6.combine = function(results$2) {
return new Result$6(_$17.flatten(_$17.pluck(results$2, "value")), combineMessages(results$2));
};
function success(value) {
return new Result$6(value, []);
}
function warning$1(message) {
return {
type: "warning",
message
};
}
function error(exception) {
return {
type: "error",
message: exception.message,
error: exception
};
}
function combineMessages(results$2) {
var messages = [];
_$17.flatten(_$17.pluck(results$2, "messages"), true).forEach(function(message) {
if (!containsMessage(messages, message)) messages.push(message);
});
return messages;
}
function containsMessage(messages, message) {
return _$17.find(messages, isSameMessage.bind(null, message)) !== void 0;
}
function isSameMessage(first, second) {
return first.type === second.type && first.message === second.message;
}
}) });
//#endregion
//#region node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/zipfile.js
var require_zipfile = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/zipfile.js": ((exports) => {
var base64js = require_base64_js();
var JSZip = require_lib$2();
exports.openArrayBuffer = openArrayBuffer;
exports.splitPath = splitPath;
exports.joinPath = joinPath;
function openArrayBuffer(arrayBuffer) {
return JSZip.loadAsync(arrayBuffer).then(function(zipFile) {
function exists(name) {
return zipFile.file(name) !== null;
}
function read$2(name, encoding) {
return zipFile.file(name).async("uint8array").then(function(array) {
if (encoding === "base64") return base64js.fromByteArray(array);
else if (encoding) return new TextDecoder(encoding).decode(array);
else return array;
});
}
function write$1(name, contents) {
zipFile.file(name, contents);
}
function toArrayBuffer() {
return zipFile.generateAsync({ type: "arraybuffer" });
}
return {
exists,
read: read$2,
write: write$1,
toArrayBuffer
};
});
}
function splitPath(path) {
var lastIndex = path.lastIndexOf("/");
if (lastIndex === -1) return {
dirname: "",
basename: path
};
else return {
dirname: path.substring(0, lastIndex),
basename: path.substring(lastIndex + 1)
};
}
function joinPath() {
var nonEmptyPaths = Array.prototype.filter.call(arguments, function(path) {
return path;
});
var relevantPaths = [];
nonEmptyPaths.forEach(function(path) {
if (/^\//.test(path)) relevantPaths = [path];
else relevantPaths.push(path);
});
return relevantPaths.join("/");
}
}) });
//#endregion
//#region node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/xml/nodes.js
var require_nodes = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/xml/nodes.js": ((exports) => {
var _$16 = (init_index_all(), __toCommonJS(index_all_exports));
exports.Element = Element$2;
exports.element = function(name, attributes, children) {
return new Element$2(name, attributes, children);
};
exports.text = function(value) {
return {
type: "text",
value
};
};
var emptyElement = exports.emptyElement = {
first: function() {
return null;
},
firstOrEmpty: function() {
return emptyElement;
},
attributes: {},
children: []
};
function Element$2(name, attributes, children) {
this.type = "element";
this.name = name;
this.attributes = attributes || {};
this.children = children || [];
}
Element$2.prototype.first = function(name) {
return _$16.find(this.children, function(child) {
return child.name === name;
});
};
Element$2.prototype.firstOrEmpty = function(name) {
return this.first(name) || emptyElement;
};
Element$2.prototype.getElementsByTagName = function(name) {
return toElementList(_$16.filter(this.children, function(child) {
return child.name === name;
}));
};
Element$2.prototype.text = function() {
if (this.children.length === 0) return "";
else if (this.children.length !== 1 || this.children[0].type !== "text") throw new Error("Not implemented");
return this.children[0].value;
};
var elementListPrototype = { getElementsByTagName: function(name) {
return toElementList(_$16.flatten(this.map(function(element$2) {
return element$2.getElementsByTagName(name);
}, true)));
} };
function toElementList(array) {
return _$16.extend(array, elementListPrototype);
}
}) });
//#endregion
//#region node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/xml/xmldom.js
var require_xmldom = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/xml/xmldom.js": ((exports) => {
var xmldom$1 = require_lib$3();
var dom = require_dom();
function parseFromString(string) {
var error$1 = null;
var document = new xmldom$1.DOMParser({ errorHandler: function(level, message) {
error$1 = {
level,
message
};
} }).parseFromString(string);
if (error$1 === null) return document;
else throw new Error(error$1.level + ": " + error$1.message);
}
exports.parseFromString = parseFromString;
exports.Node = dom.Node;
}) });
//#endregion
//#region node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/xml/reader.js
var require_reader = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/mammoth@1.9.0/node_modules/mammoth/lib/xml/reader.js": ((exports) => {
var promises$7 = require_promises();
var _$15 = (init_index_all(), __toCommonJS(index_all_exports));
var xmldom = require_xmldom();
var nodes$1 = require_nodes();
var Element$1 = nodes$1.Element;
exports.readString = readString;
var Node = xmldom.Node;
function readString(xmlString, namespaceMap) {
namespaceMap = namespaceMap || {};
try {
var document = xmldom.parseFromString(xmlString, "text/xml");
} catch (error$1) {
return promises$7.reject(error$1);
}
if (document.documentElement.tagName === "parsererror") return promises$7.resolve(new Error(document.documentElement.textContent));
function convertNode(node) {
switch (node.nodeType) {
case Node.ELEMENT_NODE: return convertElement(node);
case Node.TEXT_NODE: return nodes$1.text(node.nodeValue);
}
}
function convertElement(element$2) {
var convertedName = convertName(element$2);
var convertedChildren = [];
_$15.forEach(element$2.childNodes, function(childNode) {
var convertedNode = convertNode(childNode);
if (convertedNode) convertedChildren.push(convertedNode);
});
var convertedAttributes = {};
_$15.forEach(element$2.attributes, function(attribute) {
convertedAttributes[convertName(attribute)] = attribute.value;
});
return new Element$1(convertedName, convertedAttributes, convertedChildren);
}
function convertName(node) {
if (node.namespaceURI) {
var mappedPrefix = namespaceMap[node.namespaceURI];
var prefix;
if (mappedPrefix) prefix = mappedPrefix + ":";
else prefix = "{" + node.namespaceURI + "}";
return prefix + node.localName;
} else return node.localName;
}
return promises$7.resolve(convertNode(document.documentElement));
}
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/Utility.js
var require_Utility = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/Utility.js": ((exports, module) => {
(function() {
var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject, slice = [].slice, hasProp = {}.hasOwnProperty;
assign = function() {
var i, key, len, source, sources, target = arguments[0];
sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
if (isFunction(Object.assign)) Object.assign.apply(null, arguments);
else for (i = 0, len = sources.length; i < len; i++) {
source = sources[i];
if (source != null) for (key in source) {
if (!hasProp.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
};
isFunction = function(val) {
return !!val && Object.prototype.toString.call(val) === "[object Function]";
};
isObject = function(val) {
var ref;
return !!val && ((ref = typeof val) === "function" || ref === "object");
};
isArray = function(val) {
if (isFunction(Array.isArray)) return Array.isArray(val);
else return Object.prototype.toString.call(val) === "[object Array]";
};
isEmpty = function(val) {
var key;
if (isArray(val)) return !val.length;
else {
for (key in val) {
if (!hasProp.call(val, key)) continue;
return false;
}
return true;
}
};
isPlainObject = function(val) {
var ctor, proto;
return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && typeof ctor === "function" && ctor instanceof ctor && Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object);
};
getValue = function(obj) {
if (isFunction(obj.valueOf)) return obj.valueOf();
else return obj;
};
module.exports.assign = assign;
module.exports.isFunction = isFunction;
module.exports.isObject = isObject;
module.exports.isArray = isArray;
module.exports.isEmpty = isEmpty;
module.exports.isPlainObject = isPlainObject;
module.exports.getValue = getValue;
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLAttribute.js
var require_XMLAttribute = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLAttribute.js": ((exports, module) => {
(function() {
module.exports = (function() {
function XMLAttribute(parent, name, value) {
this.options = parent.options;
this.stringify = parent.stringify;
this.parent = parent;
if (name == null) throw new Error("Missing attribute name. " + this.debugInfo(name));
if (value == null) throw new Error("Missing attribute value. " + this.debugInfo(name));
this.name = this.stringify.attName(name);
this.value = this.stringify.attValue(value);
}
XMLAttribute.prototype.clone = function() {
return Object.create(this);
};
XMLAttribute.prototype.toString = function(options) {
return this.options.writer.set(options).attribute(this);
};
XMLAttribute.prototype.debugInfo = function(name) {
name = name || this.name;
if (name == null) return "parent: <" + this.parent.name + ">";
else return "attribute: {" + name + "}, parent: <" + this.parent.name + ">";
};
return XMLAttribute;
})();
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLElement.js
var require_XMLElement = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLElement.js": ((exports, module) => {
(function() {
var XMLAttribute, XMLNode, getValue, isFunction, isObject, ref, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
ref = require_Utility(), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
XMLNode = require_XMLNode();
XMLAttribute = require_XMLAttribute();
module.exports = (function(superClass) {
extend(XMLElement, superClass);
function XMLElement(parent, name, attributes) {
XMLElement.__super__.constructor.call(this, parent);
if (name == null) throw new Error("Missing element name. " + this.debugInfo());
this.name = this.stringify.eleName(name);
this.attributes = {};
if (attributes != null) this.attribute(attributes);
if (parent.isDocument) {
this.isRoot = true;
this.documentObject = parent;
parent.rootObject = this;
}
}
XMLElement.prototype.clone = function() {
var att, attName, clonedSelf = Object.create(this), ref1;
if (clonedSelf.isRoot) clonedSelf.documentObject = null;
clonedSelf.attributes = {};
ref1 = this.attributes;
for (attName in ref1) {
if (!hasProp.call(ref1, attName)) continue;
att = ref1[attName];
clonedSelf.attributes[attName] = att.clone();
}
clonedSelf.children = [];
this.children.forEach(function(child) {
var clonedChild = child.clone();
clonedChild.parent = clonedSelf;
return clonedSelf.children.push(clonedChild);
});
return clonedSelf;
};
XMLElement.prototype.attribute = function(name, value) {
var attName, attValue;
if (name != null) name = getValue(name);
if (isObject(name)) for (attName in name) {
if (!hasProp.call(name, attName)) continue;
attValue = name[attName];
this.attribute(attName, attValue);
}
else {
if (isFunction(value)) value = value.apply();
if (!this.options.skipNullAttributes || value != null) this.attributes[name] = new XMLAttribute(this, name, value);
}
return this;
};
XMLElement.prototype.removeAttribute = function(name) {
var attName, i, len;
if (name == null) throw new Error("Missing attribute name. " + this.debugInfo());
name = getValue(name);
if (Array.isArray(name)) for (i = 0, len = name.length; i < len; i++) {
attName = name[i];
delete this.attributes[attName];
}
else delete this.attributes[name];
return this;
};
XMLElement.prototype.toString = function(options) {
return this.options.writer.set(options).element(this);
};
XMLElement.prototype.att = function(name, value) {
return this.attribute(name, value);
};
XMLElement.prototype.a = function(name, value) {
return this.attribute(name, value);
};
return XMLElement;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLCData.js
var require_XMLCData = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLCData.js": ((exports, module) => {
(function() {
var XMLNode, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
XMLNode = require_XMLNode();
module.exports = (function(superClass) {
extend(XMLCData, superClass);
function XMLCData(parent, text$1) {
XMLCData.__super__.constructor.call(this, parent);
if (text$1 == null) throw new Error("Missing CDATA text. " + this.debugInfo());
this.text = this.stringify.cdata(text$1);
}
XMLCData.prototype.clone = function() {
return Object.create(this);
};
XMLCData.prototype.toString = function(options) {
return this.options.writer.set(options).cdata(this);
};
return XMLCData;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLComment.js
var require_XMLComment = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLComment.js": ((exports, module) => {
(function() {
var XMLNode, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
XMLNode = require_XMLNode();
module.exports = (function(superClass) {
extend(XMLComment, superClass);
function XMLComment(parent, text$1) {
XMLComment.__super__.constructor.call(this, parent);
if (text$1 == null) throw new Error("Missing comment text. " + this.debugInfo());
this.text = this.stringify.comment(text$1);
}
XMLComment.prototype.clone = function() {
return Object.create(this);
};
XMLComment.prototype.toString = function(options) {
return this.options.writer.set(options).comment(this);
};
return XMLComment;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDeclaration.js
var require_XMLDeclaration = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDeclaration.js": ((exports, module) => {
(function() {
var XMLNode, isObject, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
isObject = require_Utility().isObject;
XMLNode = require_XMLNode();
module.exports = (function(superClass) {
extend(XMLDeclaration, superClass);
function XMLDeclaration(parent, version, encoding, standalone) {
var ref;
XMLDeclaration.__super__.constructor.call(this, parent);
if (isObject(version)) ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
if (!version) version = "1.0";
this.version = this.stringify.xmlVersion(version);
if (encoding != null) this.encoding = this.stringify.xmlEncoding(encoding);
if (standalone != null) this.standalone = this.stringify.xmlStandalone(standalone);
}
XMLDeclaration.prototype.toString = function(options) {
return this.options.writer.set(options).declaration(this);
};
return XMLDeclaration;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDTDAttList.js
var require_XMLDTDAttList = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDTDAttList.js": ((exports, module) => {
(function() {
var XMLNode, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
XMLNode = require_XMLNode();
module.exports = (function(superClass) {
extend(XMLDTDAttList, superClass);
function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
XMLDTDAttList.__super__.constructor.call(this, parent);
if (elementName == null) throw new Error("Missing DTD element name. " + this.debugInfo());
if (attributeName == null) throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName));
if (!attributeType) throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName));
if (!defaultValueType) throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName));
if (defaultValueType.indexOf("#") !== 0) defaultValueType = "#" + defaultValueType;
if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName));
if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName));
this.elementName = this.stringify.eleName(elementName);
this.attributeName = this.stringify.attName(attributeName);
this.attributeType = this.stringify.dtdAttType(attributeType);
this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
this.defaultValueType = defaultValueType;
}
XMLDTDAttList.prototype.toString = function(options) {
return this.options.writer.set(options).dtdAttList(this);
};
return XMLDTDAttList;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDTDEntity.js
var require_XMLDTDEntity = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDTDEntity.js": ((exports, module) => {
(function() {
var XMLNode, isObject, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
isObject = require_Utility().isObject;
XMLNode = require_XMLNode();
module.exports = (function(superClass) {
extend(XMLDTDEntity, superClass);
function XMLDTDEntity(parent, pe, name, value) {
XMLDTDEntity.__super__.constructor.call(this, parent);
if (name == null) throw new Error("Missing DTD entity name. " + this.debugInfo(name));
if (value == null) throw new Error("Missing DTD entity value. " + this.debugInfo(name));
this.pe = !!pe;
this.name = this.stringify.eleName(name);
if (!isObject(value)) this.value = this.stringify.dtdEntityValue(value);
else {
if (!value.pubID && !value.sysID) throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name));
if (value.pubID && !value.sysID) throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name));
if (value.pubID != null) this.pubID = this.stringify.dtdPubID(value.pubID);
if (value.sysID != null) this.sysID = this.stringify.dtdSysID(value.sysID);
if (value.nData != null) this.nData = this.stringify.dtdNData(value.nData);
if (this.pe && this.nData) throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name));
}
}
XMLDTDEntity.prototype.toString = function(options) {
return this.options.writer.set(options).dtdEntity(this);
};
return XMLDTDEntity;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDTDElement.js
var require_XMLDTDElement = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDTDElement.js": ((exports, module) => {
(function() {
var XMLNode, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
XMLNode = require_XMLNode();
module.exports = (function(superClass) {
extend(XMLDTDElement, superClass);
function XMLDTDElement(parent, name, value) {
XMLDTDElement.__super__.constructor.call(this, parent);
if (name == null) throw new Error("Missing DTD element name. " + this.debugInfo());
if (!value) value = "(#PCDATA)";
if (Array.isArray(value)) value = "(" + value.join(",") + ")";
this.name = this.stringify.eleName(name);
this.value = this.stringify.dtdElementValue(value);
}
XMLDTDElement.prototype.toString = function(options) {
return this.options.writer.set(options).dtdElement(this);
};
return XMLDTDElement;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDTDNotation.js
var require_XMLDTDNotation = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDTDNotation.js": ((exports, module) => {
(function() {
var XMLNode, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
XMLNode = require_XMLNode();
module.exports = (function(superClass) {
extend(XMLDTDNotation, superClass);
function XMLDTDNotation(parent, name, value) {
XMLDTDNotation.__super__.constructor.call(this, parent);
if (name == null) throw new Error("Missing DTD notation name. " + this.debugInfo(name));
if (!value.pubID && !value.sysID) throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
this.name = this.stringify.eleName(name);
if (value.pubID != null) this.pubID = this.stringify.dtdPubID(value.pubID);
if (value.sysID != null) this.sysID = this.stringify.dtdSysID(value.sysID);
}
XMLDTDNotation.prototype.toString = function(options) {
return this.options.writer.set(options).dtdNotation(this);
};
return XMLDTDNotation;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDocType.js
var require_XMLDocType = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDocType.js": ((exports, module) => {
(function() {
var XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLNode, isObject, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
isObject = require_Utility().isObject;
XMLNode = require_XMLNode();
XMLDTDAttList = require_XMLDTDAttList();
XMLDTDEntity = require_XMLDTDEntity();
XMLDTDElement = require_XMLDTDElement();
XMLDTDNotation = require_XMLDTDNotation();
module.exports = (function(superClass) {
extend(XMLDocType, superClass);
function XMLDocType(parent, pubID, sysID) {
var ref, ref1;
XMLDocType.__super__.constructor.call(this, parent);
this.name = "!DOCTYPE";
this.documentObject = parent;
if (isObject(pubID)) ref = pubID, pubID = ref.pubID, sysID = ref.sysID;
if (sysID == null) ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1];
if (pubID != null) this.pubID = this.stringify.dtdPubID(pubID);
if (sysID != null) this.sysID = this.stringify.dtdSysID(sysID);
}
XMLDocType.prototype.element = function(name, value) {
var child = new XMLDTDElement(this, name, value);
this.children.push(child);
return this;
};
XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
var child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
this.children.push(child);
return this;
};
XMLDocType.prototype.entity = function(name, value) {
var child = new XMLDTDEntity(this, false, name, value);
this.children.push(child);
return this;
};
XMLDocType.prototype.pEntity = function(name, value) {
var child = new XMLDTDEntity(this, true, name, value);
this.children.push(child);
return this;
};
XMLDocType.prototype.notation = function(name, value) {
var child = new XMLDTDNotation(this, name, value);
this.children.push(child);
return this;
};
XMLDocType.prototype.toString = function(options) {
return this.options.writer.set(options).docType(this);
};
XMLDocType.prototype.ele = function(name, value) {
return this.element(name, value);
};
XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
};
XMLDocType.prototype.ent = function(name, value) {
return this.entity(name, value);
};
XMLDocType.prototype.pent = function(name, value) {
return this.pEntity(name, value);
};
XMLDocType.prototype.not = function(name, value) {
return this.notation(name, value);
};
XMLDocType.prototype.up = function() {
return this.root() || this.documentObject;
};
return XMLDocType;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLRaw.js
var require_XMLRaw = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLRaw.js": ((exports, module) => {
(function() {
var XMLNode, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
XMLNode = require_XMLNode();
module.exports = (function(superClass) {
extend(XMLRaw, superClass);
function XMLRaw(parent, text$1) {
XMLRaw.__super__.constructor.call(this, parent);
if (text$1 == null) throw new Error("Missing raw text. " + this.debugInfo());
this.value = this.stringify.raw(text$1);
}
XMLRaw.prototype.clone = function() {
return Object.create(this);
};
XMLRaw.prototype.toString = function(options) {
return this.options.writer.set(options).raw(this);
};
return XMLRaw;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLText.js
var require_XMLText = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLText.js": ((exports, module) => {
(function() {
var XMLNode, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
XMLNode = require_XMLNode();
module.exports = (function(superClass) {
extend(XMLText, superClass);
function XMLText(parent, text$1) {
XMLText.__super__.constructor.call(this, parent);
if (text$1 == null) throw new Error("Missing element text. " + this.debugInfo());
this.value = this.stringify.eleText(text$1);
}
XMLText.prototype.clone = function() {
return Object.create(this);
};
XMLText.prototype.toString = function(options) {
return this.options.writer.set(options).text(this);
};
return XMLText;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLProcessingInstruction.js
var require_XMLProcessingInstruction = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLProcessingInstruction.js": ((exports, module) => {
(function() {
var XMLNode, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
XMLNode = require_XMLNode();
module.exports = (function(superClass) {
extend(XMLProcessingInstruction, superClass);
function XMLProcessingInstruction(parent, target, value) {
XMLProcessingInstruction.__super__.constructor.call(this, parent);
if (target == null) throw new Error("Missing instruction target. " + this.debugInfo());
this.target = this.stringify.insTarget(target);
if (value) this.value = this.stringify.insValue(value);
}
XMLProcessingInstruction.prototype.clone = function() {
return Object.create(this);
};
XMLProcessingInstruction.prototype.toString = function(options) {
return this.options.writer.set(options).processingInstruction(this);
};
return XMLProcessingInstruction;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDummy.js
var require_XMLDummy = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLDummy.js": ((exports, module) => {
(function() {
var XMLNode, extend = function(child, parent) {
for (var key in parent) if (hasProp.call(parent, key)) child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
}, hasProp = {}.hasOwnProperty;
XMLNode = require_XMLNode();
module.exports = (function(superClass) {
extend(XMLDummy, superClass);
function XMLDummy(parent) {
XMLDummy.__super__.constructor.call(this, parent);
this.isDummy = true;
}
XMLDummy.prototype.clone = function() {
return Object.create(this);
};
XMLDummy.prototype.toString = function(options) {
return "";
};
return XMLDummy;
})(XMLNode);
}).call(exports);
}) });
//#endregion
//#region node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLNode.js
var require_XMLNode = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/xmlbuilder@10.1.1/node_modules/xmlbuilder/lib/XMLNode.js": ((exports, module) => {
(function() {
var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref, hasProp = {}.hasOwnProperty;
ref = require_Utility(), isObject = ref.isObject, isFunction = ref.isFunction, isEmpty = ref.isEmpty, getValue = ref.getValue;
XMLElement = null;
XMLCData = null;
XMLComment = null;
XMLDeclaration = null;
XMLDocType = null;
XMLRaw = null;
XMLText = null;
XMLProcessingInstruction = null;
XMLDummy = null;
module.exports = (function() {
function XMLNode(parent) {
this.parent = parent;
if (this.parent) {
this.options = this.parent.options;
this.stringify = this.parent.stringify;
}
this.children = [];
if (!XMLElement) {
XMLElement = require_XMLElement();
XMLCData = require_XMLCData();
XMLComment = require_XMLComment();
XMLDeclaration = require_XMLDeclaration();
XMLDocType = require_XMLDocType();
XMLRaw = require_XMLRaw();
XMLText = require_XMLText();
XMLProcessingInstruction = require_XMLProcessingInstruction();
XMLDummy = require_XMLDummy();
}
}
XMLNode.prototype.element = function(name, attributes, text$1) {
var childNode, item, j, k, key, lastChild = null, len, len1, ref1, ref2, val;
if (attributes === null && text$1 == null) ref1 = [{}, null], attributes = ref1[0], text$1 = ref1[1];
if (attributes == null) attributes = {};
attributes = getValue(attributes);
if (!isObject(attributes)) ref2 = [attributes, text$1], text$1 = ref2[0], attributes = ref2[1];
if (name != null) name = getValue(name);
if (Array.isArray(name)) for (j = 0, len = name.length; j < len; j++) {
item = name[j];
lastChild = this.element(item);
}
else if (isFunction(name)) lastChild = this.element(name.apply());
else if (isObject(name)) for (key in name) {
if (!hasProp.call(name, key)) continue;
val = name[key];
if (isFunction(val)) val = val.apply();
if (isObject(val) && isEmpty(val)) val = null;
if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
else if (!this.options.separateArrayItems && Array.isArray(val)) for (k = 0, len1 = val.length; k < len1; k++) {
item = val[k];
childNode = {};
childNode[key] = item;
lastChild = this.element(childNode);
}
else if (isObject(val)) {
lastChild = this.element(key);
lastChild.element(val);
} else lastChild = this.element(key, val);
}
else if (this.options.skipNullNodes && text$1 === null) lastChild = this.dummy();
else if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) lastChild = this.text(text$1);
else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) lastChild = this.cdata(text$1);
else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) lastChild = this.comment(text$1);
else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) lastChild = this.raw(text$1);
else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text$1);
else lastChild = this.node(name, attributes, text$1);
if (lastChild == null) throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
return lastChild;
};
XMLNode.prototype.insertBefore = function(name, attributes, text$1) {
var child, i, removed;
if (this.isRoot) throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i);
child = this.parent.element(name, attributes, text$1);
Array.prototype.push.apply(this.parent.children, removed);
return child;
};
XMLNode.prototype.insertAfter = function(name, attributes, text$1) {
var child, i, removed;
if (this.isRoot) throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i + 1);
child = this.parent.element(name, attributes, text$1);
Array.prototype.push.apply(this.parent.children, removed);
return child;
};
XMLNode.prototype.remove = function() {
var i;
if (this.isRoot) throw new Error("Cannot remove the root element. " + this.debugInfo());
i = this.parent.children.indexOf(this);
[].splice.apply(this.parent.children, [i, i - i + 1].concat([]));
return this.parent;
};
XMLNode.prototype.node = function(name, attributes, text$1) {
var child, ref1;
if (name != null) name = getValue(name);
attributes || (attributes = {});
attributes = getValue(attributes);
if (!isObject(attributes)) ref1 = [attributes, text$1], text$1 = ref1[0], attributes = ref1[1];
child = new XMLElement(this, name, attributes);
if (text$1 != null) child.text(text$1);
this.children.push(child);
return child;
};
XMLNode.prototype.text = function(value) {
var child = new XMLText(this, value);
this.children.push(child);
return this;
};
XMLNode.prototype.cdata = function(value) {
var child = new XMLCData(this, value);
this.children.push(child);
return this;
};
XMLNode.prototype.comment = function(value) {
var child = new XMLComment(this, value);
this.children.push(child);
return this;
};
XMLNode.prototype.commentBefore = function(value) {
var i = this.parent.children.indexOf(this), removed = this.parent.children.splice(i);
this.parent.comment(value);
Array.prototype.push.apply(this.parent.children, removed);
return this;
};
XMLNode.prototype.commentAfter = function(value) {
var i = this.parent.children.indexOf(this), removed = this.parent.children.splice(i + 1);
this.parent.comment(value);
Array.prototype.push.apply(this.parent.children, removed);
return this;
};
XMLNode.prototype.raw = function(value) {
var child = new XMLRaw(this, value);
this.children.push(child);
return this;
};
XMLNode.prototype.dummy = function() {
var child = new XMLDummy(this);
this.children.push(child);
return child;
};
XMLNode.prototype.instruction = function(target, value) {
var insTarget, insValue, instruction, j, len;
if (target != null) target = getValue(target);
if (value != null) value = getValue(value);
if (Array.isArray(target)) for (j = 0, len = target.length; j < len; j++) {
insTarget = target[j];
this.instruction(insTarget);
}
else if (isObject(target)) for (insTarget in target) {
if (!hasProp.call(target, insTarget)) continue;
insValue = target[insTarget];
this.instruction(insTarget, insValue);
}
else {
if (isFunction(value)) value = value.apply();
instruction = new XMLProcessingInstruction(this, target, value);
this.children.push(instruction);
}
return this;
};
XMLNode.prototype.instructionBefore = function(target, value) {
var i = this.parent.children.indexOf(this), removed = this.parent.children.splice(i);