blob: 79ca0d7e3504ddf831258e0ffebc73f8b86edc4a [file] [log] [blame]
// @bun
var __create = Object.create;
var __getProtoOf = Object.getPrototypeOf;
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __toESM = (mod, isNodeMode, target) => {
target = mod != null ? __create(__getProtoOf(mod)) : {};
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
for (let key of __getOwnPropNames(mod))
if (!__hasOwnProp.call(to, key))
__defProp(to, key, {
get: () => mod[key],
enumerable: true
});
return to;
};
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
var __require = import.meta.require;
// node_modules/docopt/docopt.js
var require_docopt = __commonJS((exports, module) => {
(function() {
var Argument, BranchPattern, Command, Dict, DocoptExit, DocoptLanguageError, Either, LeafPattern, OneOrMore, Option, Optional, OptionsShortcut, Pattern, Required, Tokens, any, docopt, enumerate, extras, formal_usage, parse_argv, parse_atom, parse_defaults, parse_expr, parse_long, parse_pattern, parse_section, parse_seq, parse_shorts, print, transform, zip, indexOf = [].indexOf || function(item) {
for (var i = 0, l = this.length;i < l; i++) {
if (i in this && this[i] === item)
return i;
}
return -1;
}, slice = [].slice, 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;
print = function() {
return console.log([].join.call(arguments, " "));
};
enumerate = function(array) {
var i, item, j, len, results;
i = 0;
results = [];
for (j = 0, len = array.length;j < len; j++) {
item = array[j];
results.push([i++, item]);
}
return results;
};
any = function(array) {
return indexOf.call(array, true) >= 0;
};
zip = function() {
var args, arr, i, j, length, lengthArray, ref, results;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
lengthArray = function() {
var j2, len, results2;
results2 = [];
for (j2 = 0, len = args.length;j2 < len; j2++) {
arr = args[j2];
results2.push(arr.length);
}
return results2;
}();
length = Math.min.apply(Math, lengthArray);
results = [];
for (i = j = 0, ref = length;0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
results.push(function() {
var len, q, results1;
results1 = [];
for (q = 0, len = args.length;q < len; q++) {
arr = args[q];
results1.push(arr[i]);
}
return results1;
}());
}
return results;
};
String.prototype.partition = function(separator) {
var parts, self2;
self2 = this;
if (self2.indexOf(separator) >= 0) {
parts = self2.split(separator);
return [parts[0], separator, parts.slice(1).join(separator)];
} else {
return [String(self2), "", ""];
}
};
String.prototype.startsWith = function(searchString, position) {
position = position || 0;
return this.lastIndexOf(searchString, position) === position;
};
String.prototype.endsWith = function(searchString, position) {
var lastIndex, subjectString;
subjectString = this.toString();
if (position === undefined || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
lastIndex = subjectString.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
String.prototype._split = function() {
return this.trim().split(/\s+/).filter(function(i) {
return i !== "";
});
};
String.prototype.isUpper = function() {
return /^[A-Z]+$/g.exec(this);
};
Number.isInteger = Number.isInteger || function(value) {
return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
};
DocoptLanguageError = function(superClass) {
extend(DocoptLanguageError2, superClass);
function DocoptLanguageError2(message) {
this.message = message;
DocoptLanguageError2.__super__.constructor.call(this, this.message);
}
return DocoptLanguageError2;
}(Error);
DocoptExit = function(superClass) {
extend(DocoptExit2, superClass);
function DocoptExit2(message) {
this.message = message;
DocoptExit2.__super__.constructor.call(this, this.message);
}
return DocoptExit2;
}(Error);
Pattern = function(superClass) {
extend(Pattern2, superClass);
function Pattern2() {
return Pattern2.__super__.constructor.apply(this, arguments);
}
Pattern2.prototype.fix = function() {
this.fix_identities();
this.fix_repeating_arguments();
return this;
};
Pattern2.prototype.fix_identities = function(uniq) {
var c, flat, i, j, k, len, len1, q, ref, ref1, ref2;
if (uniq == null) {
uniq = null;
}
if (!this.hasOwnProperty("children")) {
return this;
}
if (uniq === null) {
ref = [{}, this.flat()], uniq = ref[0], flat = ref[1];
for (j = 0, len = flat.length;j < len; j++) {
k = flat[j];
uniq[k] = k;
}
}
ref1 = enumerate(this.children);
for (q = 0, len1 = ref1.length;q < len1; q++) {
ref2 = ref1[q], i = ref2[0], c = ref2[1];
if (!c.hasOwnProperty("children")) {
console.assert(uniq.hasOwnProperty(c));
this.children[i] = uniq[c];
} else {
c.fix_identities(uniq);
}
}
return this;
};
Pattern2.prototype.fix_repeating_arguments = function() {
"Fix elements that should accumulate/increment values.";
var c, child, counts, e, either, j, len, len1, len2, mycase, q, r, ref;
either = function() {
var j2, len3, ref2, results;
ref2 = transform(this).children;
results = [];
for (j2 = 0, len3 = ref2.length;j2 < len3; j2++) {
child = ref2[j2];
results.push(child.children);
}
return results;
}.call(this);
for (j = 0, len = either.length;j < len; j++) {
mycase = either[j];
counts = {};
for (q = 0, len1 = mycase.length;q < len1; q++) {
c = mycase[q];
counts[c] = (counts[c] ? counts[c] : 0) + 1;
}
ref = function() {
var len22, results, u;
results = [];
for (u = 0, len22 = mycase.length;u < len22; u++) {
child = mycase[u];
if (counts[child] > 1) {
results.push(child);
}
}
return results;
}();
for (r = 0, len2 = ref.length;r < len2; r++) {
e = ref[r];
if (e.constructor === Argument || e.constructor === Option && e.argcount) {
if (e.value === null) {
e.value = [];
} else if (e.value.constructor !== Array) {
e.value = e.value._split();
}
}
if (e.constructor === Command || e.constructor === Option && e.argcount === 0) {
e.value = 0;
}
}
}
return this;
};
return Pattern2;
}(Object);
transform = function(pattern) {
"Expand pattern into an (almost) equivalent one, but with single Either.\n\nExample: ((-a | -b) (-c | -d)) => (-a -c | -a -d | -b -c | -b -d)\nQuirks: [-a] => (-a), (-a...) => (-a -a)\n";
var c, child, children2, e, groups, index, j, len, parents, ref, result, t;
result = [];
groups = [[pattern]];
while (groups.length) {
children2 = groups.shift();
parents = [Required, Optional, OptionsShortcut, Either, OneOrMore];
if (any(function() {
var j2, len2, results;
results = [];
for (j2 = 0, len2 = parents.length;j2 < len2; j2++) {
t = parents[j2];
results.push(indexOf.call(children2.map(function(c2) {
return c2.constructor;
}), t) >= 0);
}
return results;
}())) {
child = function() {
var j2, len2, ref2, results;
results = [];
for (j2 = 0, len2 = children2.length;j2 < len2; j2++) {
c = children2[j2];
if (ref2 = c.constructor, indexOf.call(parents, ref2) >= 0) {
results.push(c);
}
}
return results;
}()[0];
index = children2.indexOf(child);
if (index >= 0) {
children2.splice(index, 1);
}
if (child.constructor === Either) {
ref = child.children;
for (j = 0, len = ref.length;j < len; j++) {
c = ref[j];
groups.push([c].concat(children2));
}
} else if (child.constructor === OneOrMore) {
groups.push(child.children.concat(child.children).concat(children2));
} else {
groups.push(child.children.concat(children2));
}
} else {
result.push(children2);
}
}
return new Either(function() {
var len1, q, results;
results = [];
for (q = 0, len1 = result.length;q < len1; q++) {
e = result[q];
results.push(new Required(e));
}
return results;
}());
};
LeafPattern = function(superClass) {
"Leaf/terminal node of a pattern tree.";
extend(LeafPattern2, superClass);
function LeafPattern2(name1, value1) {
this.name = name1;
this.value = value1 != null ? value1 : null;
}
LeafPattern2.prototype.toString = function() {
return this.constructor.name + "(" + this.name + ", " + this.value + ")";
};
LeafPattern2.prototype.flat = function(types) {
var ref;
if (types == null) {
types = [];
}
types = types instanceof Array ? types : [types];
if (!types.length || (ref = this.constructor, indexOf.call(types, ref) >= 0)) {
return [this];
} else {
return [];
}
};
LeafPattern2.prototype.match = function(left, collected) {
var a, increment, left_, match, pos, ref, same_name;
if (collected == null) {
collected = null;
}
if (collected === null) {
collected = [];
}
ref = this.singleMatch(left), pos = ref[0], match = ref[1];
if (match === null) {
return [false, left, collected];
}
left_ = left.slice(0, pos).concat(left.slice(pos + 1));
same_name = function() {
var j, len, results;
results = [];
for (j = 0, len = collected.length;j < len; j++) {
a = collected[j];
if (a.name === this.name) {
results.push(a);
}
}
return results;
}.call(this);
if (Number.isInteger(this.value) || this.value instanceof Array) {
if (Number.isInteger(this.value)) {
increment = 1;
} else {
increment = typeof match.value === "string" ? [match.value] : match.value;
}
if (!same_name.length) {
match.value = increment;
return [true, left_, collected.concat(match)];
}
if (Number.isInteger(this.value)) {
same_name[0].value += increment;
} else {
same_name[0].value = [].concat(same_name[0].value, increment);
}
return [true, left_, collected];
}
return [true, left_, collected.concat(match)];
};
return LeafPattern2;
}(Pattern);
BranchPattern = function(superClass) {
"Branch/inner node of a pattern tree.";
extend(BranchPattern2, superClass);
function BranchPattern2(children2) {
this.children = children2 instanceof Array ? children2 : [children2];
}
BranchPattern2.prototype.toString = function() {
var a;
return this.constructor.name + "(" + function() {
var j, len, ref, results;
ref = this.children;
results = [];
for (j = 0, len = ref.length;j < len; j++) {
a = ref[j];
results.push(a);
}
return results;
}.call(this).join(", ") + ")";
};
BranchPattern2.prototype.flat = function(types) {
var child, ref;
if (types == null) {
types = [];
}
types = types instanceof Array ? types : [types];
if (ref = this.constructor, indexOf.call(types, ref) >= 0) {
return [this];
}
return function() {
var j, len, ref1, results;
ref1 = this.children;
results = [];
for (j = 0, len = ref1.length;j < len; j++) {
child = ref1[j];
if (child instanceof Pattern) {
results.push(child.flat(types));
}
}
return results;
}.call(this).reduce(function(pv, cv) {
return [].concat(pv, cv);
}, []);
};
return BranchPattern2;
}(Pattern);
Argument = function(superClass) {
extend(Argument2, superClass);
function Argument2() {
return Argument2.__super__.constructor.apply(this, arguments);
}
Argument2.prototype.singleMatch = function(left) {
var j, len, n, pattern, ref, ref1;
ref = enumerate(left);
for (j = 0, len = ref.length;j < len; j++) {
ref1 = ref[j], n = ref1[0], pattern = ref1[1];
if (pattern.constructor === Argument2) {
return [n, new Argument2(this.name, pattern.value)];
}
}
return [null, null];
};
Argument2.parse = function(source) {
var name, value;
name = /(<\S*?>)/ig.exec(source)[1];
value = /\[default:\s+(.*)\]/ig.exec(source);
return new Argument2(name, value ? value[1] : null);
};
return Argument2;
}(LeafPattern);
Command = function(superClass) {
extend(Command2, superClass);
function Command2(name1, value1) {
this.name = name1;
this.value = value1 != null ? value1 : false;
}
Command2.prototype.singleMatch = function(left) {
var j, len, n, pattern, ref, ref1;
ref = enumerate(left);
for (j = 0, len = ref.length;j < len; j++) {
ref1 = ref[j], n = ref1[0], pattern = ref1[1];
if (pattern.constructor === Argument) {
if (pattern.value === this.name) {
return [n, new Command2(this.name, true)];
} else {
break;
}
}
}
return [null, null];
};
return Command2;
}(Argument);
Option = function(superClass) {
extend(Option2, superClass);
function Option2(short1, long1, argcount1, value) {
var ref;
this.short = short1 != null ? short1 : null;
this.long = long1 != null ? long1 : null;
this.argcount = argcount1 != null ? argcount1 : 0;
if (value == null) {
value = false;
}
console.assert((ref = this.argcount) === 0 || ref === 1);
this.value = value === false && this.argcount > 0 ? null : value;
this.name = this.long || this.short;
}
Option2.prototype.toString = function() {
return "Option(" + this.short + ", " + this.long + ", " + this.argcount + ", " + this.value + ")";
};
Option2.parse = function(option_description) {
var _, argcount, description, j, len, long, matched, options, ref, ref1, ref2, s, short, value;
ref = [null, null, 0, false], short = ref[0], long = ref[1], argcount = ref[2], value = ref[3];
ref1 = option_description.trim().partition(" "), options = ref1[0], _ = ref1[1], description = ref1[2];
options = options.replace(/,|=/g, " ");
ref2 = options._split();
for (j = 0, len = ref2.length;j < len; j++) {
s = ref2[j];
if (s.startsWith("--")) {
long = s;
} else if (s.startsWith("-")) {
short = s;
} else {
argcount = 1;
}
}
if (argcount > 0) {
matched = /\[default:\s+(.*)\]/ig.exec(description);
value = matched ? matched[1] : null;
}
return new Option2(short, long, argcount, value);
};
Option2.prototype.singleMatch = function(left) {
var j, len, n, pattern, ref, ref1;
ref = enumerate(left);
for (j = 0, len = ref.length;j < len; j++) {
ref1 = ref[j], n = ref1[0], pattern = ref1[1];
if (this.name === pattern.name) {
return [n, pattern];
}
}
return [null, null];
};
return Option2;
}(LeafPattern);
Required = function(superClass) {
extend(Required2, superClass);
function Required2() {
return Required2.__super__.constructor.apply(this, arguments);
}
Required2.prototype.match = function(left, collected) {
var c, j, l, len, matched, p, ref, ref1;
if (collected == null) {
collected = null;
}
if (collected === null) {
collected = [];
}
l = left;
c = collected;
ref = this.children;
for (j = 0, len = ref.length;j < len; j++) {
p = ref[j];
ref1 = p.match(l, c), matched = ref1[0], l = ref1[1], c = ref1[2];
if (!matched) {
return [false, left, collected];
}
}
return [true, l, c];
};
return Required2;
}(BranchPattern);
Optional = function(superClass) {
extend(Optional2, superClass);
function Optional2() {
return Optional2.__super__.constructor.apply(this, arguments);
}
Optional2.prototype.match = function(left, collected) {
var j, len, m, p, ref, ref1;
if (collected == null) {
collected = null;
}
if (collected === null) {
collected = [];
}
ref = this.children;
for (j = 0, len = ref.length;j < len; j++) {
p = ref[j];
ref1 = p.match(left, collected), m = ref1[0], left = ref1[1], collected = ref1[2];
}
return [true, left, collected];
};
return Optional2;
}(BranchPattern);
OptionsShortcut = function(superClass) {
"Marker/placeholder for [options] shortcut.";
extend(OptionsShortcut2, superClass);
function OptionsShortcut2() {
return OptionsShortcut2.__super__.constructor.apply(this, arguments);
}
return OptionsShortcut2;
}(Optional);
OneOrMore = function(superClass) {
extend(OneOrMore2, superClass);
function OneOrMore2() {
return OneOrMore2.__super__.constructor.apply(this, arguments);
}
OneOrMore2.prototype.match = function(left, collected) {
var c, l, l_, matched, ref, times;
if (collected == null) {
collected = null;
}
console.assert(this.children.length === 1);
if (collected === null) {
collected = [];
}
l = left;
c = collected;
l_ = [];
matched = true;
times = 0;
while (matched) {
ref = this.children[0].match(l, c), matched = ref[0], l = ref[1], c = ref[2];
times += matched ? 1 : 0;
if (l_.join(", ") === l.join(", ")) {
break;
}
l_ = l;
}
if (times >= 1) {
return [true, l, c];
}
return [false, left, collected];
};
return OneOrMore2;
}(BranchPattern);
Either = function(superClass) {
extend(Either2, superClass);
function Either2() {
return Either2.__super__.constructor.apply(this, arguments);
}
Either2.prototype.match = function(left, collected) {
var j, len, outcome, outcomes, p, ref;
if (collected == null) {
collected = null;
}
if (collected === null) {
collected = [];
}
outcomes = [];
ref = this.children;
for (j = 0, len = ref.length;j < len; j++) {
p = ref[j];
outcome = p.match(left, collected);
if (outcome[0]) {
outcomes.push(outcome);
}
}
if (outcomes.length > 0) {
outcomes.sort(function(a, b) {
if (a[1].length > b[1].length) {
return 1;
} else if (a[1].length < b[1].length) {
return -1;
} else {
return 0;
}
});
return outcomes[0];
}
return [false, left, collected];
};
return Either2;
}(BranchPattern);
Tokens = function(superClass) {
extend(Tokens2, superClass);
function Tokens2(source, error) {
var stream;
this.error = error != null ? error : DocoptExit;
stream = source.constructor === String ? source._split() : source;
this.push.apply(this, stream);
}
Tokens2.prototype.move = function() {
if (this.length) {
return [].shift.apply(this);
} else {
return null;
}
};
Tokens2.prototype.current = function() {
if (this.length) {
return this[0];
} else {
return null;
}
};
Tokens2.from_pattern = function(source) {
var s;
source = source.replace(/([\[\]\(\)\|]|\.\.\.)/g, " $1 ");
source = function() {
var j, len, ref, results;
ref = source.split(/\s+|(\S*<.*?>)/);
results = [];
for (j = 0, len = ref.length;j < len; j++) {
s = ref[j];
if (s) {
results.push(s);
}
}
return results;
}();
return new Tokens2(source, DocoptLanguageError);
};
return Tokens2;
}(Array);
parse_section = function(name, source) {
var matches, s;
matches = source.match(new RegExp(`^([^
]*` + name + `[^
]*
?(?:[ ].*?(?:
|$))*)`, "igm"));
if (matches) {
return function() {
var j, len, results;
results = [];
for (j = 0, len = matches.length;j < len; j++) {
s = matches[j];
results.push(s.trim());
}
return results;
}();
}
return [];
};
parse_shorts = function(tokens, options) {
"shorts ::= '-' ( chars )* [ [ ' ' ] chars ] ;";
var left, o, parsed, ref, ref1, short, similar, token, value;
token = tokens.move();
console.assert(token.startsWith("-") && !token.startsWith("--"));
left = token.replace(/^-+/g, "");
parsed = [];
while (left !== "") {
ref = ["-" + left[0], left.slice(1)], short = ref[0], left = ref[1];
similar = function() {
var j, len, results;
results = [];
for (j = 0, len = options.length;j < len; j++) {
o = options[j];
if (o.short === short) {
results.push(o);
}
}
return results;
}();
if (similar.length > 1) {
throw new tokens.error(short + " is specified ambiguously " + similar.length + " times");
} else if (similar.length < 1) {
o = new Option(short, null, 0);
options.push(o);
if (tokens.error === DocoptExit) {
o = new Option(short, null, 0, true);
}
} else {
o = new Option(short, similar[0].long, similar[0].argcount, similar[0].value);
value = null;
if (o.argcount !== 0) {
if (left === "") {
if ((ref1 = tokens.current()) === null || ref1 === "--") {
throw new tokens.error(short + " requires argument");
}
value = tokens.move();
} else {
value = left;
left = "";
}
}
if (tokens.error === DocoptExit) {
o.value = value !== null ? value : true;
}
}
parsed.push(o);
}
return parsed;
};
parse_long = function(tokens, options) {
"long ::= '--' chars [ ( ' ' | '=' ) chars ] ;";
var argcount, eq, long, longs, o, ref, ref1, similar, value;
ref = tokens.move().partition("="), long = ref[0], eq = ref[1], value = ref[2];
console.assert(long.startsWith("--"));
if (eq === value && value === "") {
value = null;
}
similar = function() {
var j, len, results;
results = [];
for (j = 0, len = options.length;j < len; j++) {
o = options[j];
if (o.long === long) {
results.push(o);
}
}
return results;
}();
if (tokens.error === DocoptExit && similar.length === 0) {
similar = function() {
var j, len, results;
results = [];
for (j = 0, len = options.length;j < len; j++) {
o = options[j];
if (o.long && o.long.startsWith(long)) {
results.push(o);
}
}
return results;
}();
}
if (similar.length > 1) {
longs = function() {
var j, len, results;
results = [];
for (j = 0, len = similar.length;j < len; j++) {
o = similar[j];
results.push(o.long);
}
return results;
}().join(", ");
throw new tokens.error(long + " is not a unique prefix: " + longs + "?");
} else if (similar.length < 1) {
argcount = eq === "=" ? 1 : 0;
o = new Option(null, long, argcount);
options.push(o);
if (tokens.error === DocoptExit) {
o = new Option(null, long, argcount, argcount > 0 ? value : true);
}
} else {
o = new Option(similar[0].short, similar[0].long, similar[0].argcount, similar[0].value);
if (o.argcount === 0) {
if (value !== null) {
throw new tokens.error(o.long + " must not have an argument");
}
} else {
if (value === null) {
if ((ref1 = tokens.current()) === null || ref1 === "--") {
throw new tokens.error(o.long + " requires argument");
}
value = tokens.move();
}
}
if (tokens.error === DocoptExit) {
o.value = value !== null ? value : true;
}
}
return [o];
};
parse_pattern = function(source, options) {
var result, tokens;
tokens = Tokens.from_pattern(source);
result = parse_expr(tokens, options);
if (tokens.current() !== null) {
throw new tokens.error("unexpected ending: " + tokens.join(" "));
}
return new Required(result);
};
parse_expr = function(tokens, options) {
"expr ::= seq ( '|' seq )* ;";
var result, seq;
seq = parse_seq(tokens, options);
if (tokens.current() !== "|") {
return seq;
}
result = seq.length > 1 ? [new Required(seq)] : seq;
while (tokens.current() === "|") {
tokens.move();
seq = parse_seq(tokens, options);
result = result.concat(seq.length > 1 ? [new Required(seq)] : seq);
}
if (result.length > 1) {
return [new Either(result)];
} else {
return result;
}
};
parse_seq = function(tokens, options) {
"seq ::= ( atom [ '...' ] )* ;";
var atom, ref, result;
result = [];
while ((ref = tokens.current()) !== null && ref !== "]" && ref !== ")" && ref !== "|") {
atom = parse_atom(tokens, options);
if (tokens.current() === "...") {
atom = [new OneOrMore(atom)];
tokens.move();
}
result = result.concat(atom);
}
return result;
};
parse_atom = function(tokens, options) {
"atom ::= '(' expr ')' | '[' expr ']' | 'options'\n| long | shorts | argument | command ;";
var matching, patternType, ref, result, token;
token = tokens.current();
result = [];
if (indexOf.call("([", token) >= 0) {
tokens.move();
ref = {
"(": [")", Required],
"[": ["]", Optional]
}[token], matching = ref[0], patternType = ref[1];
result = new patternType(parse_expr(tokens, options));
if (tokens.move() !== matching) {
throw new tokens.error("Unmatched '" + token + "'");
}
return [result];
} else if (token === "options") {
tokens.move();
return [new OptionsShortcut];
} else if (token.startsWith("--") && token !== "--") {
return parse_long(tokens, options);
} else if (token.startsWith("-") && (token !== "-" && token !== "--")) {
return parse_shorts(tokens, options);
} else if (token.startsWith("<") && token.endsWith(">") || token.isUpper()) {
return [new Argument(tokens.move())];
} else {
return [new Command(tokens.move())];
}
};
parse_argv = function(tokens, options, options_first) {
var parsed, v;
if (options_first == null) {
options_first = false;
}
parsed = [];
while (tokens.current() !== null) {
if (tokens.current() === "--") {
return parsed.concat(function() {
var j, len, results;
results = [];
for (j = 0, len = tokens.length;j < len; j++) {
v = tokens[j];
results.push(new Argument(null, v));
}
return results;
}());
} else if (tokens.current().startsWith("--")) {
parsed = parsed.concat(parse_long(tokens, options));
} else if (tokens.current().startsWith("-") && tokens.current() !== "-") {
parsed = parsed.concat(parse_shorts(tokens, options));
} else if (options_first) {
return parsed.concat(function() {
var j, len, results;
results = [];
for (j = 0, len = tokens.length;j < len; j++) {
v = tokens[j];
results.push(new Argument(null, v));
}
return results;
}());
} else {
parsed.push(new Argument(null, tokens.move()));
}
}
return parsed;
};
parse_defaults = function(doc) {
var _, defaults, even, j, len, odd, options, ref, ref1, s, s1, s2, split, v;
defaults = [];
ref = parse_section("options:", doc);
for (j = 0, len = ref.length;j < len; j++) {
s = ref[j];
ref1 = s.partition(":"), _ = ref1[0], _ = ref1[1], s = ref1[2];
split = (`
` + s).split(new RegExp("\\n[ \\t]*(-\\S+?)")).slice(1);
odd = function() {
var len1, q, results;
results = [];
for (q = 0, len1 = split.length;q < len1; q += 2) {
v = split[q];
results.push(v);
}
return results;
}();
even = function() {
var len1, q, ref2, results;
ref2 = split.slice(1);
results = [];
for (q = 0, len1 = ref2.length;q < len1; q += 2) {
v = ref2[q];
results.push(v);
}
return results;
}();
split = function() {
var len1, q, ref2, ref3, results;
ref2 = zip(odd, even);
results = [];
for (q = 0, len1 = ref2.length;q < len1; q++) {
ref3 = ref2[q], s1 = ref3[0], s2 = ref3[1];
results.push(s1 + s2);
}
return results;
}();
options = function() {
var len1, q, results;
results = [];
for (q = 0, len1 = split.length;q < len1; q++) {
s = split[q];
if (s.startsWith("-")) {
results.push(Option.parse(s));
}
}
return results;
}();
defaults.push.apply(defaults, options);
}
return defaults;
};
formal_usage = function(section) {
var _, pu, ref, s;
ref = section.partition(":"), _ = ref[0], _ = ref[1], section = ref[2];
pu = section._split();
return "( " + function() {
var j, len, ref1, results;
ref1 = pu.slice(1);
results = [];
for (j = 0, len = ref1.length;j < len; j++) {
s = ref1[j];
results.push(s === pu[0] ? ") | (" : s);
}
return results;
}().join(" ") + " )";
};
extras = function(help, version, options, doc) {
var o;
if (help && any(function() {
var j, len, ref, results;
results = [];
for (j = 0, len = options.length;j < len; j++) {
o = options[j];
results.push(((ref = o.name) === "--help" || ref === "-h") && o.value);
}
return results;
}())) {
return doc.replace(/^\s*|\s*$/, "");
}
if (version && any(function() {
var j, len, results;
results = [];
for (j = 0, len = options.length;j < len; j++) {
o = options[j];
results.push(o.name === "--version" && o.value);
}
return results;
}())) {
return version;
}
return "";
};
Dict = function(superClass) {
extend(Dict2, superClass);
function Dict2(pairs) {
var j, key, len, ref, value;
for (j = 0, len = pairs.length;j < len; j++) {
ref = pairs[j], key = ref[0], value = ref[1];
this[key] = value;
}
}
Dict2.prototype.toObject = function() {
var dict, j, len, name, ref;
dict = {};
ref = Object.keys(this).sort();
for (j = 0, len = ref.length;j < len; j++) {
name = ref[j];
dict[name] = this[name];
}
return dict;
};
return Dict2;
}(Object);
docopt = function(doc, kwargs) {
var a, allowedargs, arg, argv, collected, doc_options, e, exit, help, i, j, left, len, matched, name, options, options_first, options_shortcut, output, pattern, pattern_options, pattern_options_strings, ref, ref1, usage_sections, version;
if (kwargs == null) {
kwargs = {};
}
allowedargs = ["argv", "name", "help", "version", "options_first", "exit"];
for (arg in kwargs) {
if (indexOf.call(allowedargs, arg) < 0) {
throw new Error("unrecognized argument to docopt: ");
}
}
argv = kwargs.argv === undefined ? process.argv.slice(2) : kwargs.argv;
name = kwargs.name === undefined ? null : kwargs.name;
help = kwargs.help === undefined ? true : kwargs.help;
version = kwargs.version === undefined ? null : kwargs.version;
options_first = kwargs.options_first === undefined ? false : kwargs.options_first;
exit = kwargs.exit === undefined ? true : kwargs.exit;
try {
usage_sections = parse_section("usage:", doc);
if (usage_sections.length === 0) {
throw new DocoptLanguageError('"usage:" (case-insensitive) not found.');
}
if (usage_sections.length > 1) {
throw new DocoptLanguageError('More than one "usage:" (case-insensitive).');
}
DocoptExit.usage = usage_sections[0];
options = parse_defaults(doc);
pattern = parse_pattern(formal_usage(DocoptExit.usage), options);
argv = parse_argv(new Tokens(argv), options, options_first);
pattern_options = pattern.flat(Option);
ref = pattern.flat(OptionsShortcut);
for (j = 0, len = ref.length;j < len; j++) {
options_shortcut = ref[j];
doc_options = parse_defaults(doc);
pattern_options_strings = function() {
var len1, q, results;
results = [];
for (q = 0, len1 = pattern_options.length;q < len1; q++) {
i = pattern_options[q];
results.push(i.toString());
}
return results;
}();
options_shortcut.children = doc_options.filter(function(item) {
var ref12;
return ref12 = item.toString(), indexOf.call(pattern_options_strings, ref12) < 0;
});
}
output = extras(help, version, argv, doc);
if (output) {
if (exit) {
print(output);
process.exit();
} else {
throw new Error(output);
}
}
ref1 = pattern.fix().match(argv), matched = ref1[0], left = ref1[1], collected = ref1[2];
if (matched && left.length === 0) {
return new Dict(function() {
var len1, q, ref2, results;
ref2 = [].concat(pattern.flat(), collected);
results = [];
for (q = 0, len1 = ref2.length;q < len1; q++) {
a = ref2[q];
results.push([a.name, a.value]);
}
return results;
}()).toObject();
}
throw new DocoptExit(DocoptExit.usage);
} catch (_error) {
e = _error;
if (!exit) {
throw e;
} else {
if (e.message) {
print(e.message);
}
return process.exit(1);
}
}
};
module.exports = {
docopt,
DocoptLanguageError,
DocoptExit,
Option,
Argument,
Command,
Required,
OptionsShortcut,
Either,
Optional,
Pattern,
OneOrMore,
Tokens,
Dict,
transform,
formal_usage,
parse_section,
parse_defaults,
parse_pattern,
parse_long,
parse_shorts,
parse_argv
};
}).call(exports);
});
// node_modules/xml2js/lib/defaults.js
var require_defaults = __commonJS((exports) => {
(function() {
exports.defaults = {
"0.1": {
explicitCharkey: false,
trim: true,
normalize: true,
normalizeTags: false,
attrkey: "@",
charkey: "#",
explicitArray: false,
ignoreAttrs: false,
mergeAttrs: false,
explicitRoot: false,
validator: null,
xmlns: false,
explicitChildren: false,
childkey: "@@",
charsAsChildren: false,
includeWhiteChars: false,
async: false,
strict: true,
attrNameProcessors: null,
attrValueProcessors: null,
tagNameProcessors: null,
valueProcessors: null,
emptyTag: ""
},
"0.2": {
explicitCharkey: false,
trim: false,
normalize: false,
normalizeTags: false,
attrkey: "$",
charkey: "_",
explicitArray: true,
ignoreAttrs: false,
mergeAttrs: false,
explicitRoot: true,
validator: null,
xmlns: false,
explicitChildren: false,
preserveChildrenOrder: false,
childkey: "$$",
charsAsChildren: false,
includeWhiteChars: false,
async: false,
strict: true,
attrNameProcessors: null,
attrValueProcessors: null,
tagNameProcessors: null,
valueProcessors: null,
rootName: "root",
xmldec: {
version: "1.0",
encoding: "UTF-8",
standalone: true
},
doctype: null,
renderOpts: {
pretty: true,
indent: " ",
newline: `
`
},
headless: false,
chunkSize: 1e4,
emptyTag: "",
cdata: false
}
};
}).call(exports);
});
// node_modules/xmlbuilder/lib/Utility.js
var require_Utility = __commonJS((exports, module) => {
(function() {
var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject, slice = [].slice, hasProp = {}.hasOwnProperty;
assign = function() {
var i, key, len, source, sources, target;
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(val2) {
return !!val2 && Object.prototype.toString.call(val2) === "[object Function]";
};
isObject = function(val2) {
var ref;
return !!val2 && ((ref = typeof val2) === "function" || ref === "object");
};
isArray = function(val2) {
if (isFunction(Array.isArray)) {
return Array.isArray(val2);
} else {
return Object.prototype.toString.call(val2) === "[object Array]";
}
};
isEmpty = function(val2) {
var key;
if (isArray(val2)) {
return !val2.length;
} else {
for (key in val2) {
if (!hasProp.call(val2, key))
continue;
return false;
}
return true;
}
};
isPlainObject = function(val2) {
var ctor, proto;
return isObject(val2) && (proto = Object.getPrototypeOf(val2)) && (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;
}
};
exports.assign = assign;
exports.isFunction = isFunction;
exports.isObject = isObject;
exports.isArray = isArray;
exports.isEmpty = isEmpty;
exports.isPlainObject = isPlainObject;
exports.getValue = getValue;
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDOMImplementation.js
var require_XMLDOMImplementation = __commonJS((exports, module) => {
(function() {
var XMLDOMImplementation;
module.exports = XMLDOMImplementation = function() {
function XMLDOMImplementation2() {}
XMLDOMImplementation2.prototype.hasFeature = function(feature, version) {
return true;
};
XMLDOMImplementation2.prototype.createDocumentType = function(qualifiedName, publicId, systemId) {
throw new Error("This DOM method is not implemented.");
};
XMLDOMImplementation2.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) {
throw new Error("This DOM method is not implemented.");
};
XMLDOMImplementation2.prototype.createHTMLDocument = function(title) {
throw new Error("This DOM method is not implemented.");
};
XMLDOMImplementation2.prototype.getFeature = function(feature, version) {
throw new Error("This DOM method is not implemented.");
};
return XMLDOMImplementation2;
}();
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js
var require_XMLDOMErrorHandler = __commonJS((exports, module) => {
(function() {
var XMLDOMErrorHandler;
module.exports = XMLDOMErrorHandler = function() {
function XMLDOMErrorHandler2() {}
XMLDOMErrorHandler2.prototype.handleError = function(error) {
throw new Error(error);
};
return XMLDOMErrorHandler2;
}();
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDOMStringList.js
var require_XMLDOMStringList = __commonJS((exports, module) => {
(function() {
var XMLDOMStringList;
module.exports = XMLDOMStringList = function() {
function XMLDOMStringList2(arr) {
this.arr = arr || [];
}
Object.defineProperty(XMLDOMStringList2.prototype, "length", {
get: function() {
return this.arr.length;
}
});
XMLDOMStringList2.prototype.item = function(index) {
return this.arr[index] || null;
};
XMLDOMStringList2.prototype.contains = function(str) {
return this.arr.indexOf(str) !== -1;
};
return XMLDOMStringList2;
}();
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDOMConfiguration.js
var require_XMLDOMConfiguration = __commonJS((exports, module) => {
(function() {
var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList;
XMLDOMErrorHandler = require_XMLDOMErrorHandler();
XMLDOMStringList = require_XMLDOMStringList();
module.exports = XMLDOMConfiguration = function() {
function XMLDOMConfiguration2() {
var clonedSelf;
this.defaultParams = {
"canonical-form": false,
"cdata-sections": false,
comments: false,
"datatype-normalization": false,
"element-content-whitespace": true,
entities: true,
"error-handler": new XMLDOMErrorHandler,
infoset: true,
"validate-if-schema": false,
namespaces: true,
"namespace-declarations": true,
"normalize-characters": false,
"schema-location": "",
"schema-type": "",
"split-cdata-sections": true,
validate: false,
"well-formed": true
};
this.params = clonedSelf = Object.create(this.defaultParams);
}
Object.defineProperty(XMLDOMConfiguration2.prototype, "parameterNames", {
get: function() {
return new XMLDOMStringList(Object.keys(this.defaultParams));
}
});
XMLDOMConfiguration2.prototype.getParameter = function(name) {
if (this.params.hasOwnProperty(name)) {
return this.params[name];
} else {
return null;
}
};
XMLDOMConfiguration2.prototype.canSetParameter = function(name, value) {
return true;
};
XMLDOMConfiguration2.prototype.setParameter = function(name, value) {
if (value != null) {
return this.params[name] = value;
} else {
return delete this.params[name];
}
};
return XMLDOMConfiguration2;
}();
}).call(exports);
});
// node_modules/xmlbuilder/lib/NodeType.js
var require_NodeType = __commonJS((exports, module) => {
(function() {
module.exports = {
Element: 1,
Attribute: 2,
Text: 3,
CData: 4,
EntityReference: 5,
EntityDeclaration: 6,
ProcessingInstruction: 7,
Comment: 8,
Document: 9,
DocType: 10,
DocumentFragment: 11,
NotationDeclaration: 12,
Declaration: 201,
Raw: 202,
AttributeDeclaration: 203,
ElementDeclaration: 204,
Dummy: 205
};
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLAttribute.js
var require_XMLAttribute = __commonJS((exports, module) => {
(function() {
var NodeType, XMLAttribute, XMLNode;
NodeType = require_NodeType();
XMLNode = require_XMLNode();
module.exports = XMLAttribute = function() {
function XMLAttribute2(parent, name, value) {
this.parent = parent;
if (this.parent) {
this.options = this.parent.options;
this.stringify = this.parent.stringify;
}
if (name == null) {
throw new Error("Missing attribute name. " + this.debugInfo(name));
}
this.name = this.stringify.name(name);
this.value = this.stringify.attValue(value);
this.type = NodeType.Attribute;
this.isId = false;
this.schemaTypeInfo = null;
}
Object.defineProperty(XMLAttribute2.prototype, "nodeType", {
get: function() {
return this.type;
}
});
Object.defineProperty(XMLAttribute2.prototype, "ownerElement", {
get: function() {
return this.parent;
}
});
Object.defineProperty(XMLAttribute2.prototype, "textContent", {
get: function() {
return this.value;
},
set: function(value) {
return this.value = value || "";
}
});
Object.defineProperty(XMLAttribute2.prototype, "namespaceURI", {
get: function() {
return "";
}
});
Object.defineProperty(XMLAttribute2.prototype, "prefix", {
get: function() {
return "";
}
});
Object.defineProperty(XMLAttribute2.prototype, "localName", {
get: function() {
return this.name;
}
});
Object.defineProperty(XMLAttribute2.prototype, "specified", {
get: function() {
return true;
}
});
XMLAttribute2.prototype.clone = function() {
return Object.create(this);
};
XMLAttribute2.prototype.toString = function(options) {
return this.options.writer.attribute(this, this.options.writer.filterOptions(options));
};
XMLAttribute2.prototype.debugInfo = function(name) {
name = name || this.name;
if (name == null) {
return "parent: <" + this.parent.name + ">";
} else {
return "attribute: {" + name + "}, parent: <" + this.parent.name + ">";
}
};
XMLAttribute2.prototype.isEqualNode = function(node) {
if (node.namespaceURI !== this.namespaceURI) {
return false;
}
if (node.prefix !== this.prefix) {
return false;
}
if (node.localName !== this.localName) {
return false;
}
if (node.value !== this.value) {
return false;
}
return true;
};
return XMLAttribute2;
}();
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLNamedNodeMap.js
var require_XMLNamedNodeMap = __commonJS((exports, module) => {
(function() {
var XMLNamedNodeMap;
module.exports = XMLNamedNodeMap = function() {
function XMLNamedNodeMap2(nodes) {
this.nodes = nodes;
}
Object.defineProperty(XMLNamedNodeMap2.prototype, "length", {
get: function() {
return Object.keys(this.nodes).length || 0;
}
});
XMLNamedNodeMap2.prototype.clone = function() {
return this.nodes = null;
};
XMLNamedNodeMap2.prototype.getNamedItem = function(name) {
return this.nodes[name];
};
XMLNamedNodeMap2.prototype.setNamedItem = function(node) {
var oldNode;
oldNode = this.nodes[node.nodeName];
this.nodes[node.nodeName] = node;
return oldNode || null;
};
XMLNamedNodeMap2.prototype.removeNamedItem = function(name) {
var oldNode;
oldNode = this.nodes[name];
delete this.nodes[name];
return oldNode || null;
};
XMLNamedNodeMap2.prototype.item = function(index) {
return this.nodes[Object.keys(this.nodes)[index]] || null;
};
XMLNamedNodeMap2.prototype.getNamedItemNS = function(namespaceURI, localName) {
throw new Error("This DOM method is not implemented.");
};
XMLNamedNodeMap2.prototype.setNamedItemNS = function(node) {
throw new Error("This DOM method is not implemented.");
};
XMLNamedNodeMap2.prototype.removeNamedItemNS = function(namespaceURI, localName) {
throw new Error("This DOM method is not implemented.");
};
return XMLNamedNodeMap2;
}();
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLElement.js
var require_XMLElement = __commonJS((exports, module) => {
(function() {
var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, 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();
NodeType = require_NodeType();
XMLAttribute = require_XMLAttribute();
XMLNamedNodeMap = require_XMLNamedNodeMap();
module.exports = XMLElement = function(superClass) {
extend(XMLElement2, superClass);
function XMLElement2(parent, name, attributes) {
var child, j, len, ref1;
XMLElement2.__super__.constructor.call(this, parent);
if (name == null) {
throw new Error("Missing element name. " + this.debugInfo());
}
this.name = this.stringify.name(name);
this.type = NodeType.Element;
this.attribs = {};
this.schemaTypeInfo = null;
if (attributes != null) {
this.attribute(attributes);
}
if (parent.type === NodeType.Document) {
this.isRoot = true;
this.documentObject = parent;
parent.rootObject = this;
if (parent.children) {
ref1 = parent.children;
for (j = 0, len = ref1.length;j < len; j++) {
child = ref1[j];
if (child.type === NodeType.DocType) {
child.name = this.name;
break;
}
}
}
}
}
Object.defineProperty(XMLElement2.prototype, "tagName", {
get: function() {
return this.name;
}
});
Object.defineProperty(XMLElement2.prototype, "namespaceURI", {
get: function() {
return "";
}
});
Object.defineProperty(XMLElement2.prototype, "prefix", {
get: function() {
return "";
}
});
Object.defineProperty(XMLElement2.prototype, "localName", {
get: function() {
return this.name;
}
});
Object.defineProperty(XMLElement2.prototype, "id", {
get: function() {
throw new Error("This DOM method is not implemented." + this.debugInfo());
}
});
Object.defineProperty(XMLElement2.prototype, "className", {
get: function() {
throw new Error("This DOM method is not implemented." + this.debugInfo());
}
});
Object.defineProperty(XMLElement2.prototype, "classList", {
get: function() {
throw new Error("This DOM method is not implemented." + this.debugInfo());
}
});
Object.defineProperty(XMLElement2.prototype, "attributes", {
get: function() {
if (!this.attributeMap || !this.attributeMap.nodes) {
this.attributeMap = new XMLNamedNodeMap(this.attribs);
}
return this.attributeMap;
}
});
XMLElement2.prototype.clone = function() {
var att, attName, clonedSelf, ref1;
clonedSelf = Object.create(this);
if (clonedSelf.isRoot) {
clonedSelf.documentObject = null;
}
clonedSelf.attribs = {};
ref1 = this.attribs;
for (attName in ref1) {
if (!hasProp.call(ref1, attName))
continue;
att = ref1[attName];
clonedSelf.attribs[attName] = att.clone();
}
clonedSelf.children = [];
this.children.forEach(function(child) {
var clonedChild;
clonedChild = child.clone();
clonedChild.parent = clonedSelf;
return clonedSelf.children.push(clonedChild);
});
return clonedSelf;
};
XMLElement2.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.keepNullAttributes && value == null) {
this.attribs[name] = new XMLAttribute(this, name, "");
} else if (value != null) {
this.attribs[name] = new XMLAttribute(this, name, value);
}
}
return this;
};
XMLElement2.prototype.removeAttribute = function(name) {
var attName, j, len;
if (name == null) {
throw new Error("Missing attribute name. " + this.debugInfo());
}
name = getValue(name);
if (Array.isArray(name)) {
for (j = 0, len = name.length;j < len; j++) {
attName = name[j];
delete this.attribs[attName];
}
} else {
delete this.attribs[name];
}
return this;
};
XMLElement2.prototype.toString = function(options) {
return this.options.writer.element(this, this.options.writer.filterOptions(options));
};
XMLElement2.prototype.att = function(name, value) {
return this.attribute(name, value);
};
XMLElement2.prototype.a = function(name, value) {
return this.attribute(name, value);
};
XMLElement2.prototype.getAttribute = function(name) {
if (this.attribs.hasOwnProperty(name)) {
return this.attribs[name].value;
} else {
return null;
}
};
XMLElement2.prototype.setAttribute = function(name, value) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.getAttributeNode = function(name) {
if (this.attribs.hasOwnProperty(name)) {
return this.attribs[name];
} else {
return null;
}
};
XMLElement2.prototype.setAttributeNode = function(newAttr) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.removeAttributeNode = function(oldAttr) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.getElementsByTagName = function(name) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.getAttributeNS = function(namespaceURI, localName) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.setAttributeNS = function(namespaceURI, qualifiedName, value) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.removeAttributeNS = function(namespaceURI, localName) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.getAttributeNodeNS = function(namespaceURI, localName) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.setAttributeNodeNS = function(newAttr) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.hasAttribute = function(name) {
return this.attribs.hasOwnProperty(name);
};
XMLElement2.prototype.hasAttributeNS = function(namespaceURI, localName) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.setIdAttribute = function(name, isId) {
if (this.attribs.hasOwnProperty(name)) {
return this.attribs[name].isId;
} else {
return isId;
}
};
XMLElement2.prototype.setIdAttributeNS = function(namespaceURI, localName, isId) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.setIdAttributeNode = function(idAttr, isId) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.getElementsByTagName = function(tagname) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.getElementsByClassName = function(classNames) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLElement2.prototype.isEqualNode = function(node) {
var i, j, ref1;
if (!XMLElement2.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
return false;
}
if (node.namespaceURI !== this.namespaceURI) {
return false;
}
if (node.prefix !== this.prefix) {
return false;
}
if (node.localName !== this.localName) {
return false;
}
if (node.attribs.length !== this.attribs.length) {
return false;
}
for (i = j = 0, ref1 = this.attribs.length - 1;0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) {
if (!this.attribs[i].isEqualNode(node.attribs[i])) {
return false;
}
}
return true;
};
return XMLElement2;
}(XMLNode);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLCharacterData.js
var require_XMLCharacterData = __commonJS((exports, module) => {
(function() {
var XMLCharacterData, 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 = XMLCharacterData = function(superClass) {
extend(XMLCharacterData2, superClass);
function XMLCharacterData2(parent) {
XMLCharacterData2.__super__.constructor.call(this, parent);
this.value = "";
}
Object.defineProperty(XMLCharacterData2.prototype, "data", {
get: function() {
return this.value;
},
set: function(value) {
return this.value = value || "";
}
});
Object.defineProperty(XMLCharacterData2.prototype, "length", {
get: function() {
return this.value.length;
}
});
Object.defineProperty(XMLCharacterData2.prototype, "textContent", {
get: function() {
return this.value;
},
set: function(value) {
return this.value = value || "";
}
});
XMLCharacterData2.prototype.clone = function() {
return Object.create(this);
};
XMLCharacterData2.prototype.substringData = function(offset, count) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLCharacterData2.prototype.appendData = function(arg) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLCharacterData2.prototype.insertData = function(offset, arg) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLCharacterData2.prototype.deleteData = function(offset, count) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLCharacterData2.prototype.replaceData = function(offset, count, arg) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLCharacterData2.prototype.isEqualNode = function(node) {
if (!XMLCharacterData2.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
return false;
}
if (node.data !== this.data) {
return false;
}
return true;
};
return XMLCharacterData2;
}(XMLNode);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLCData.js
var require_XMLCData = __commonJS((exports, module) => {
(function() {
var NodeType, XMLCData, XMLCharacterData, 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;
NodeType = require_NodeType();
XMLCharacterData = require_XMLCharacterData();
module.exports = XMLCData = function(superClass) {
extend(XMLCData2, superClass);
function XMLCData2(parent, text) {
XMLCData2.__super__.constructor.call(this, parent);
if (text == null) {
throw new Error("Missing CDATA text. " + this.debugInfo());
}
this.name = "#cdata-section";
this.type = NodeType.CData;
this.value = this.stringify.cdata(text);
}
XMLCData2.prototype.clone = function() {
return Object.create(this);
};
XMLCData2.prototype.toString = function(options) {
return this.options.writer.cdata(this, this.options.writer.filterOptions(options));
};
return XMLCData2;
}(XMLCharacterData);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLComment.js
var require_XMLComment = __commonJS((exports, module) => {
(function() {
var NodeType, XMLCharacterData, XMLComment, 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;
NodeType = require_NodeType();
XMLCharacterData = require_XMLCharacterData();
module.exports = XMLComment = function(superClass) {
extend(XMLComment2, superClass);
function XMLComment2(parent, text) {
XMLComment2.__super__.constructor.call(this, parent);
if (text == null) {
throw new Error("Missing comment text. " + this.debugInfo());
}
this.name = "#comment";
this.type = NodeType.Comment;
this.value = this.stringify.comment(text);
}
XMLComment2.prototype.clone = function() {
return Object.create(this);
};
XMLComment2.prototype.toString = function(options) {
return this.options.writer.comment(this, this.options.writer.filterOptions(options));
};
return XMLComment2;
}(XMLCharacterData);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDeclaration.js
var require_XMLDeclaration = __commonJS((exports, module) => {
(function() {
var NodeType, XMLDeclaration, 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();
NodeType = require_NodeType();
module.exports = XMLDeclaration = function(superClass) {
extend(XMLDeclaration2, superClass);
function XMLDeclaration2(parent, version, encoding, standalone) {
var ref;
XMLDeclaration2.__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.type = NodeType.Declaration;
this.version = this.stringify.xmlVersion(version);
if (encoding != null) {
this.encoding = this.stringify.xmlEncoding(encoding);
}
if (standalone != null) {
this.standalone = this.stringify.xmlStandalone(standalone);
}
}
XMLDeclaration2.prototype.toString = function(options) {
return this.options.writer.declaration(this, this.options.writer.filterOptions(options));
};
return XMLDeclaration2;
}(XMLNode);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDTDAttList.js
var require_XMLDTDAttList = __commonJS((exports, module) => {
(function() {
var NodeType, XMLDTDAttList, 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();
NodeType = require_NodeType();
module.exports = XMLDTDAttList = function(superClass) {
extend(XMLDTDAttList2, superClass);
function XMLDTDAttList2(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
XMLDTDAttList2.__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.name(elementName);
this.type = NodeType.AttributeDeclaration;
this.attributeName = this.stringify.name(attributeName);
this.attributeType = this.stringify.dtdAttType(attributeType);
if (defaultValue) {
this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
}
this.defaultValueType = defaultValueType;
}
XMLDTDAttList2.prototype.toString = function(options) {
return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options));
};
return XMLDTDAttList2;
}(XMLNode);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDTDEntity.js
var require_XMLDTDEntity = __commonJS((exports, module) => {
(function() {
var NodeType, XMLDTDEntity, 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();
NodeType = require_NodeType();
module.exports = XMLDTDEntity = function(superClass) {
extend(XMLDTDEntity2, superClass);
function XMLDTDEntity2(parent, pe, name, value) {
XMLDTDEntity2.__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.name(name);
this.type = NodeType.EntityDeclaration;
if (!isObject(value)) {
this.value = this.stringify.dtdEntityValue(value);
this.internal = true;
} 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));
}
this.internal = false;
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));
}
}
}
Object.defineProperty(XMLDTDEntity2.prototype, "publicId", {
get: function() {
return this.pubID;
}
});
Object.defineProperty(XMLDTDEntity2.prototype, "systemId", {
get: function() {
return this.sysID;
}
});
Object.defineProperty(XMLDTDEntity2.prototype, "notationName", {
get: function() {
return this.nData || null;
}
});
Object.defineProperty(XMLDTDEntity2.prototype, "inputEncoding", {
get: function() {
return null;
}
});
Object.defineProperty(XMLDTDEntity2.prototype, "xmlEncoding", {
get: function() {
return null;
}
});
Object.defineProperty(XMLDTDEntity2.prototype, "xmlVersion", {
get: function() {
return null;
}
});
XMLDTDEntity2.prototype.toString = function(options) {
return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options));
};
return XMLDTDEntity2;
}(XMLNode);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDTDElement.js
var require_XMLDTDElement = __commonJS((exports, module) => {
(function() {
var NodeType, XMLDTDElement, 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();
NodeType = require_NodeType();
module.exports = XMLDTDElement = function(superClass) {
extend(XMLDTDElement2, superClass);
function XMLDTDElement2(parent, name, value) {
XMLDTDElement2.__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.name(name);
this.type = NodeType.ElementDeclaration;
this.value = this.stringify.dtdElementValue(value);
}
XMLDTDElement2.prototype.toString = function(options) {
return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options));
};
return XMLDTDElement2;
}(XMLNode);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDTDNotation.js
var require_XMLDTDNotation = __commonJS((exports, module) => {
(function() {
var NodeType, XMLDTDNotation, 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();
NodeType = require_NodeType();
module.exports = XMLDTDNotation = function(superClass) {
extend(XMLDTDNotation2, superClass);
function XMLDTDNotation2(parent, name, value) {
XMLDTDNotation2.__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.name(name);
this.type = NodeType.NotationDeclaration;
if (value.pubID != null) {
this.pubID = this.stringify.dtdPubID(value.pubID);
}
if (value.sysID != null) {
this.sysID = this.stringify.dtdSysID(value.sysID);
}
}
Object.defineProperty(XMLDTDNotation2.prototype, "publicId", {
get: function() {
return this.pubID;
}
});
Object.defineProperty(XMLDTDNotation2.prototype, "systemId", {
get: function() {
return this.sysID;
}
});
XMLDTDNotation2.prototype.toString = function(options) {
return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options));
};
return XMLDTDNotation2;
}(XMLNode);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDocType.js
var require_XMLDocType = __commonJS((exports, module) => {
(function() {
var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, 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();
NodeType = require_NodeType();
XMLDTDAttList = require_XMLDTDAttList();
XMLDTDEntity = require_XMLDTDEntity();
XMLDTDElement = require_XMLDTDElement();
XMLDTDNotation = require_XMLDTDNotation();
XMLNamedNodeMap = require_XMLNamedNodeMap();
module.exports = XMLDocType = function(superClass) {
extend(XMLDocType2, superClass);
function XMLDocType2(parent, pubID, sysID) {
var child, i, len, ref, ref1, ref2;
XMLDocType2.__super__.constructor.call(this, parent);
this.type = NodeType.DocType;
if (parent.children) {
ref = parent.children;
for (i = 0, len = ref.length;i < len; i++) {
child = ref[i];
if (child.type === NodeType.Element) {
this.name = child.name;
break;
}
}
}
this.documentObject = parent;
if (isObject(pubID)) {
ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID;
}
if (sysID == null) {
ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1];
}
if (pubID != null) {
this.pubID = this.stringify.dtdPubID(pubID);
}
if (sysID != null) {
this.sysID = this.stringify.dtdSysID(sysID);
}
}
Object.defineProperty(XMLDocType2.prototype, "entities", {
get: function() {
var child, i, len, nodes, ref;
nodes = {};
ref = this.children;
for (i = 0, len = ref.length;i < len; i++) {
child = ref[i];
if (child.type === NodeType.EntityDeclaration && !child.pe) {
nodes[child.name] = child;
}
}
return new XMLNamedNodeMap(nodes);
}
});
Object.defineProperty(XMLDocType2.prototype, "notations", {
get: function() {
var child, i, len, nodes, ref;
nodes = {};
ref = this.children;
for (i = 0, len = ref.length;i < len; i++) {
child = ref[i];
if (child.type === NodeType.NotationDeclaration) {
nodes[child.name] = child;
}
}
return new XMLNamedNodeMap(nodes);
}
});
Object.defineProperty(XMLDocType2.prototype, "publicId", {
get: function() {
return this.pubID;
}
});
Object.defineProperty(XMLDocType2.prototype, "systemId", {
get: function() {
return this.sysID;
}
});
Object.defineProperty(XMLDocType2.prototype, "internalSubset", {
get: function() {
throw new Error("This DOM method is not implemented." + this.debugInfo());
}
});
XMLDocType2.prototype.element = function(name, value) {
var child;
child = new XMLDTDElement(this, name, value);
this.children.push(child);
return this;
};
XMLDocType2.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
var child;
child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
this.children.push(child);
return this;
};
XMLDocType2.prototype.entity = function(name, value) {
var child;
child = new XMLDTDEntity(this, false, name, value);
this.children.push(child);
return this;
};
XMLDocType2.prototype.pEntity = function(name, value) {
var child;
child = new XMLDTDEntity(this, true, name, value);
this.children.push(child);
return this;
};
XMLDocType2.prototype.notation = function(name, value) {
var child;
child = new XMLDTDNotation(this, name, value);
this.children.push(child);
return this;
};
XMLDocType2.prototype.toString = function(options) {
return this.options.writer.docType(this, this.options.writer.filterOptions(options));
};
XMLDocType2.prototype.ele = function(name, value) {
return this.element(name, value);
};
XMLDocType2.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
};
XMLDocType2.prototype.ent = function(name, value) {
return this.entity(name, value);
};
XMLDocType2.prototype.pent = function(name, value) {
return this.pEntity(name, value);
};
XMLDocType2.prototype.not = function(name, value) {
return this.notation(name, value);
};
XMLDocType2.prototype.up = function() {
return this.root() || this.documentObject;
};
XMLDocType2.prototype.isEqualNode = function(node) {
if (!XMLDocType2.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
return false;
}
if (node.name !== this.name) {
return false;
}
if (node.publicId !== this.publicId) {
return false;
}
if (node.systemId !== this.systemId) {
return false;
}
return true;
};
return XMLDocType2;
}(XMLNode);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLRaw.js
var require_XMLRaw = __commonJS((exports, module) => {
(function() {
var NodeType, XMLNode, XMLRaw, 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;
NodeType = require_NodeType();
XMLNode = require_XMLNode();
module.exports = XMLRaw = function(superClass) {
extend(XMLRaw2, superClass);
function XMLRaw2(parent, text) {
XMLRaw2.__super__.constructor.call(this, parent);
if (text == null) {
throw new Error("Missing raw text. " + this.debugInfo());
}
this.type = NodeType.Raw;
this.value = this.stringify.raw(text);
}
XMLRaw2.prototype.clone = function() {
return Object.create(this);
};
XMLRaw2.prototype.toString = function(options) {
return this.options.writer.raw(this, this.options.writer.filterOptions(options));
};
return XMLRaw2;
}(XMLNode);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLText.js
var require_XMLText = __commonJS((exports, module) => {
(function() {
var NodeType, XMLCharacterData, XMLText, 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;
NodeType = require_NodeType();
XMLCharacterData = require_XMLCharacterData();
module.exports = XMLText = function(superClass) {
extend(XMLText2, superClass);
function XMLText2(parent, text) {
XMLText2.__super__.constructor.call(this, parent);
if (text == null) {
throw new Error("Missing element text. " + this.debugInfo());
}
this.name = "#text";
this.type = NodeType.Text;
this.value = this.stringify.text(text);
}
Object.defineProperty(XMLText2.prototype, "isElementContentWhitespace", {
get: function() {
throw new Error("This DOM method is not implemented." + this.debugInfo());
}
});
Object.defineProperty(XMLText2.prototype, "wholeText", {
get: function() {
var next, prev, str;
str = "";
prev = this.previousSibling;
while (prev) {
str = prev.data + str;
prev = prev.previousSibling;
}
str += this.data;
next = this.nextSibling;
while (next) {
str = str + next.data;
next = next.nextSibling;
}
return str;
}
});
XMLText2.prototype.clone = function() {
return Object.create(this);
};
XMLText2.prototype.toString = function(options) {
return this.options.writer.text(this, this.options.writer.filterOptions(options));
};
XMLText2.prototype.splitText = function(offset) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLText2.prototype.replaceWholeText = function(content) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
return XMLText2;
}(XMLCharacterData);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLProcessingInstruction.js
var require_XMLProcessingInstruction = __commonJS((exports, module) => {
(function() {
var NodeType, XMLCharacterData, XMLProcessingInstruction, 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;
NodeType = require_NodeType();
XMLCharacterData = require_XMLCharacterData();
module.exports = XMLProcessingInstruction = function(superClass) {
extend(XMLProcessingInstruction2, superClass);
function XMLProcessingInstruction2(parent, target, value) {
XMLProcessingInstruction2.__super__.constructor.call(this, parent);
if (target == null) {
throw new Error("Missing instruction target. " + this.debugInfo());
}
this.type = NodeType.ProcessingInstruction;
this.target = this.stringify.insTarget(target);
this.name = this.target;
if (value) {
this.value = this.stringify.insValue(value);
}
}
XMLProcessingInstruction2.prototype.clone = function() {
return Object.create(this);
};
XMLProcessingInstruction2.prototype.toString = function(options) {
return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));
};
XMLProcessingInstruction2.prototype.isEqualNode = function(node) {
if (!XMLProcessingInstruction2.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
return false;
}
if (node.target !== this.target) {
return false;
}
return true;
};
return XMLProcessingInstruction2;
}(XMLCharacterData);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDummy.js
var require_XMLDummy = __commonJS((exports, module) => {
(function() {
var NodeType, XMLDummy, 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();
NodeType = require_NodeType();
module.exports = XMLDummy = function(superClass) {
extend(XMLDummy2, superClass);
function XMLDummy2(parent) {
XMLDummy2.__super__.constructor.call(this, parent);
this.type = NodeType.Dummy;
}
XMLDummy2.prototype.clone = function() {
return Object.create(this);
};
XMLDummy2.prototype.toString = function(options) {
return "";
};
return XMLDummy2;
}(XMLNode);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLNodeList.js
var require_XMLNodeList = __commonJS((exports, module) => {
(function() {
var XMLNodeList;
module.exports = XMLNodeList = function() {
function XMLNodeList2(nodes) {
this.nodes = nodes;
}
Object.defineProperty(XMLNodeList2.prototype, "length", {
get: function() {
return this.nodes.length || 0;
}
});
XMLNodeList2.prototype.clone = function() {
return this.nodes = null;
};
XMLNodeList2.prototype.item = function(index) {
return this.nodes[index] || null;
};
return XMLNodeList2;
}();
}).call(exports);
});
// node_modules/xmlbuilder/lib/DocumentPosition.js
var require_DocumentPosition = __commonJS((exports, module) => {
(function() {
module.exports = {
Disconnected: 1,
Preceding: 2,
Following: 4,
Contains: 8,
ContainedBy: 16,
ImplementationSpecific: 32
};
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLNode.js
var require_XMLNode = __commonJS((exports, module) => {
(function() {
var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1, hasProp = {}.hasOwnProperty;
ref1 = require_Utility(), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
XMLElement = null;
XMLCData = null;
XMLComment = null;
XMLDeclaration = null;
XMLDocType = null;
XMLRaw = null;
XMLText = null;
XMLProcessingInstruction = null;
XMLDummy = null;
NodeType = null;
XMLNodeList = null;
XMLNamedNodeMap = null;
DocumentPosition = null;
module.exports = XMLNode = function() {
function XMLNode2(parent1) {
this.parent = parent1;
if (this.parent) {
this.options = this.parent.options;
this.stringify = this.parent.stringify;
}
this.value = null;
this.children = [];
this.baseURI = null;
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();
NodeType = require_NodeType();
XMLNodeList = require_XMLNodeList();
XMLNamedNodeMap = require_XMLNamedNodeMap();
DocumentPosition = require_DocumentPosition();
}
}
Object.defineProperty(XMLNode2.prototype, "nodeName", {
get: function() {
return this.name;
}
});
Object.defineProperty(XMLNode2.prototype, "nodeType", {
get: function() {
return this.type;
}
});
Object.defineProperty(XMLNode2.prototype, "nodeValue", {
get: function() {
return this.value;
}
});
Object.defineProperty(XMLNode2.prototype, "parentNode", {
get: function() {
return this.parent;
}
});
Object.defineProperty(XMLNode2.prototype, "childNodes", {
get: function() {
if (!this.childNodeList || !this.childNodeList.nodes) {
this.childNodeList = new XMLNodeList(this.children);
}
return this.childNodeList;
}
});
Object.defineProperty(XMLNode2.prototype, "firstChild", {
get: function() {
return this.children[0] || null;
}
});
Object.defineProperty(XMLNode2.prototype, "lastChild", {
get: function() {
return this.children[this.children.length - 1] || null;
}
});
Object.defineProperty(XMLNode2.prototype, "previousSibling", {
get: function() {
var i;
i = this.parent.children.indexOf(this);
return this.parent.children[i - 1] || null;
}
});
Object.defineProperty(XMLNode2.prototype, "nextSibling", {
get: function() {
var i;
i = this.parent.children.indexOf(this);
return this.parent.children[i + 1] || null;
}
});
Object.defineProperty(XMLNode2.prototype, "ownerDocument", {
get: function() {
return this.document() || null;
}
});
Object.defineProperty(XMLNode2.prototype, "textContent", {
get: function() {
var child, j, len, ref2, str;
if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
str = "";
ref2 = this.children;
for (j = 0, len = ref2.length;j < len; j++) {
child = ref2[j];
if (child.textContent) {
str += child.textContent;
}
}
return str;
} else {
return null;
}
},
set: function(value) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
}
});
XMLNode2.prototype.setParent = function(parent) {
var child, j, len, ref2, results;
this.parent = parent;
if (parent) {
this.options = parent.options;
this.stringify = parent.stringify;
}
ref2 = this.children;
results = [];
for (j = 0, len = ref2.length;j < len; j++) {
child = ref2[j];
results.push(child.setParent(this));
}
return results;
};
XMLNode2.prototype.element = function(name, attributes, text) {
var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val2;
lastChild = null;
if (attributes === null && text == null) {
ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
}
if (attributes == null) {
attributes = {};
}
attributes = getValue(attributes);
if (!isObject(attributes)) {
ref3 = [attributes, text], text = ref3[0], attributes = ref3[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;
val2 = name[key];
if (isFunction(val2)) {
val2 = val2.apply();
}
if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val2);
} else if (!this.options.separateArrayItems && Array.isArray(val2) && isEmpty(val2)) {
lastChild = this.dummy();
} else if (isObject(val2) && isEmpty(val2)) {
lastChild = this.element(key);
} else if (!this.options.keepNullNodes && val2 == null) {
lastChild = this.dummy();
} else if (!this.options.separateArrayItems && Array.isArray(val2)) {
for (k = 0, len1 = val2.length;k < len1; k++) {
item = val2[k];
childNode = {};
childNode[key] = item;
lastChild = this.element(childNode);
}
} else if (isObject(val2)) {
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
lastChild = this.element(val2);
} else {
lastChild = this.element(key);
lastChild.element(val2);
}
} else {
lastChild = this.element(key, val2);
}
}
} else if (!this.options.keepNullNodes && text === null) {
lastChild = this.dummy();
} else {
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
lastChild = this.text(text);
} else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
lastChild = this.cdata(text);
} else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
lastChild = this.comment(text);
} else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
lastChild = this.raw(text);
} else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
} else {
lastChild = this.node(name, attributes, text);
}
}
if (lastChild == null) {
throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
}
return lastChild;
};
XMLNode2.prototype.insertBefore = function(name, attributes, text) {
var child, i, newChild, refChild, removed;
if (name != null ? name.type : undefined) {
newChild = name;
refChild = attributes;
newChild.setParent(this);
if (refChild) {
i = children.indexOf(refChild);
removed = children.splice(i);
children.push(newChild);
Array.prototype.push.apply(children, removed);
} else {
children.push(newChild);
}
return newChild;
} else {
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);
Array.prototype.push.apply(this.parent.children, removed);
return child;
}
};
XMLNode2.prototype.insertAfter = function(name, attributes, text) {
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);
Array.prototype.push.apply(this.parent.children, removed);
return child;
};
XMLNode2.prototype.remove = function() {
var i, ref2;
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(ref2 = []));
return this.parent;
};
XMLNode2.prototype.node = function(name, attributes, text) {
var child, ref2;
if (name != null) {
name = getValue(name);
}
attributes || (attributes = {});
attributes = getValue(attributes);
if (!isObject(attributes)) {
ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
}
child = new XMLElement(this, name, attributes);
if (text != null) {
child.text(text);
}
this.children.push(child);
return child;
};
XMLNode2.prototype.text = function(value) {
var child;
if (isObject(value)) {
this.element(value);
}
child = new XMLText(this, value);
this.children.push(child);
return this;
};
XMLNode2.prototype.cdata = function(value) {
var child;
child = new XMLCData(this, value);
this.children.push(child);
return this;
};
XMLNode2.prototype.comment = function(value) {
var child;
child = new XMLComment(this, value);
this.children.push(child);
return this;
};
XMLNode2.prototype.commentBefore = function(value) {
var child, i, removed;
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i);
child = this.parent.comment(value);
Array.prototype.push.apply(this.parent.children, removed);
return this;
};
XMLNode2.prototype.commentAfter = function(value) {
var child, i, removed;
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i + 1);
child = this.parent.comment(value);
Array.prototype.push.apply(this.parent.children, removed);
return this;
};
XMLNode2.prototype.raw = function(value) {
var child;
child = new XMLRaw(this, value);
this.children.push(child);
return this;
};
XMLNode2.prototype.dummy = function() {
var child;
child = new XMLDummy(this);
return child;
};
XMLNode2.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;
};
XMLNode2.prototype.instructionBefore = function(target, value) {
var child, i, removed;
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i);
child = this.parent.instruction(target, value);
Array.prototype.push.apply(this.parent.children, removed);
return this;
};
XMLNode2.prototype.instructionAfter = function(target, value) {
var child, i, removed;
i = this.parent.children.indexOf(this);
removed = this.parent.children.splice(i + 1);
child = this.parent.instruction(target, value);
Array.prototype.push.apply(this.parent.children, removed);
return this;
};
XMLNode2.prototype.declaration = function(version, encoding, standalone) {
var doc, xmldec;
doc = this.document();
xmldec = new XMLDeclaration(doc, version, encoding, standalone);
if (doc.children.length === 0) {
doc.children.unshift(xmldec);
} else if (doc.children[0].type === NodeType.Declaration) {
doc.children[0] = xmldec;
} else {
doc.children.unshift(xmldec);
}
return doc.root() || doc;
};
XMLNode2.prototype.dtd = function(pubID, sysID) {
var child, doc, doctype, i, j, k, len, len1, ref2, ref3;
doc = this.document();
doctype = new XMLDocType(doc, pubID, sysID);
ref2 = doc.children;
for (i = j = 0, len = ref2.length;j < len; i = ++j) {
child = ref2[i];
if (child.type === NodeType.DocType) {
doc.children[i] = doctype;
return doctype;
}
}
ref3 = doc.children;
for (i = k = 0, len1 = ref3.length;k < len1; i = ++k) {
child = ref3[i];
if (child.isRoot) {
doc.children.splice(i, 0, doctype);
return doctype;
}
}
doc.children.push(doctype);
return doctype;
};
XMLNode2.prototype.up = function() {
if (this.isRoot) {
throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
}
return this.parent;
};
XMLNode2.prototype.root = function() {
var node;
node = this;
while (node) {
if (node.type === NodeType.Document) {
return node.rootObject;
} else if (node.isRoot) {
return node;
} else {
node = node.parent;
}
}
};
XMLNode2.prototype.document = function() {
var node;
node = this;
while (node) {
if (node.type === NodeType.Document) {
return node;
} else {
node = node.parent;
}
}
};
XMLNode2.prototype.end = function(options) {
return this.document().end(options);
};
XMLNode2.prototype.prev = function() {
var i;
i = this.parent.children.indexOf(this);
if (i < 1) {
throw new Error("Already at the first node. " + this.debugInfo());
}
return this.parent.children[i - 1];
};
XMLNode2.prototype.next = function() {
var i;
i = this.parent.children.indexOf(this);
if (i === -1 || i === this.parent.children.length - 1) {
throw new Error("Already at the last node. " + this.debugInfo());
}
return this.parent.children[i + 1];
};
XMLNode2.prototype.importDocument = function(doc) {
var clonedRoot;
clonedRoot = doc.root().clone();
clonedRoot.parent = this;
clonedRoot.isRoot = false;
this.children.push(clonedRoot);
return this;
};
XMLNode2.prototype.debugInfo = function(name) {
var ref2, ref3;
name = name || this.name;
if (name == null && !((ref2 = this.parent) != null ? ref2.name : undefined)) {
return "";
} else if (name == null) {
return "parent: <" + this.parent.name + ">";
} else if (!((ref3 = this.parent) != null ? ref3.name : undefined)) {
return "node: <" + name + ">";
} else {
return "node: <" + name + ">, parent: <" + this.parent.name + ">";
}
};
XMLNode2.prototype.ele = function(name, attributes, text) {
return this.element(name, attributes, text);
};
XMLNode2.prototype.nod = function(name, attributes, text) {
return this.node(name, attributes, text);
};
XMLNode2.prototype.txt = function(value) {
return this.text(value);
};
XMLNode2.prototype.dat = function(value) {
return this.cdata(value);
};
XMLNode2.prototype.com = function(value) {
return this.comment(value);
};
XMLNode2.prototype.ins = function(target, value) {
return this.instruction(target, value);
};
XMLNode2.prototype.doc = function() {
return this.document();
};
XMLNode2.prototype.dec = function(version, encoding, standalone) {
return this.declaration(version, encoding, standalone);
};
XMLNode2.prototype.e = function(name, attributes, text) {
return this.element(name, attributes, text);
};
XMLNode2.prototype.n = function(name, attributes, text) {
return this.node(name, attributes, text);
};
XMLNode2.prototype.t = function(value) {
return this.text(value);
};
XMLNode2.prototype.d = function(value) {
return this.cdata(value);
};
XMLNode2.prototype.c = function(value) {
return this.comment(value);
};
XMLNode2.prototype.r = function(value) {
return this.raw(value);
};
XMLNode2.prototype.i = function(target, value) {
return this.instruction(target, value);
};
XMLNode2.prototype.u = function() {
return this.up();
};
XMLNode2.prototype.importXMLBuilder = function(doc) {
return this.importDocument(doc);
};
XMLNode2.prototype.replaceChild = function(newChild, oldChild) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.removeChild = function(oldChild) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.appendChild = function(newChild) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.hasChildNodes = function() {
return this.children.length !== 0;
};
XMLNode2.prototype.cloneNode = function(deep) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.normalize = function() {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.isSupported = function(feature, version) {
return true;
};
XMLNode2.prototype.hasAttributes = function() {
return this.attribs.length !== 0;
};
XMLNode2.prototype.compareDocumentPosition = function(other) {
var ref, res;
ref = this;
if (ref === other) {
return 0;
} else if (this.document() !== other.document()) {
res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific;
if (Math.random() < 0.5) {
res |= DocumentPosition.Preceding;
} else {
res |= DocumentPosition.Following;
}
return res;
} else if (ref.isAncestor(other)) {
return DocumentPosition.Contains | DocumentPosition.Preceding;
} else if (ref.isDescendant(other)) {
return DocumentPosition.Contains | DocumentPosition.Following;
} else if (ref.isPreceding(other)) {
return DocumentPosition.Preceding;
} else {
return DocumentPosition.Following;
}
};
XMLNode2.prototype.isSameNode = function(other) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.lookupPrefix = function(namespaceURI) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.isDefaultNamespace = function(namespaceURI) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.lookupNamespaceURI = function(prefix) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.isEqualNode = function(node) {
var i, j, ref2;
if (node.nodeType !== this.nodeType) {
return false;
}
if (node.children.length !== this.children.length) {
return false;
}
for (i = j = 0, ref2 = this.children.length - 1;0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) {
if (!this.children[i].isEqualNode(node.children[i])) {
return false;
}
}
return true;
};
XMLNode2.prototype.getFeature = function(feature, version) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.setUserData = function(key, data, handler) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.getUserData = function(key) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLNode2.prototype.contains = function(other) {
if (!other) {
return false;
}
return other === this || this.isDescendant(other);
};
XMLNode2.prototype.isDescendant = function(node) {
var child, isDescendantChild, j, len, ref2;
ref2 = this.children;
for (j = 0, len = ref2.length;j < len; j++) {
child = ref2[j];
if (node === child) {
return true;
}
isDescendantChild = child.isDescendant(node);
if (isDescendantChild) {
return true;
}
}
return false;
};
XMLNode2.prototype.isAncestor = function(node) {
return node.isDescendant(this);
};
XMLNode2.prototype.isPreceding = function(node) {
var nodePos, thisPos;
nodePos = this.treePosition(node);
thisPos = this.treePosition(this);
if (nodePos === -1 || thisPos === -1) {
return false;
} else {
return nodePos < thisPos;
}
};
XMLNode2.prototype.isFollowing = function(node) {
var nodePos, thisPos;
nodePos = this.treePosition(node);
thisPos = this.treePosition(this);
if (nodePos === -1 || thisPos === -1) {
return false;
} else {
return nodePos > thisPos;
}
};
XMLNode2.prototype.treePosition = function(node) {
var found, pos;
pos = 0;
found = false;
this.foreachTreeNode(this.document(), function(childNode) {
pos++;
if (!found && childNode === node) {
return found = true;
}
});
if (found) {
return pos;
} else {
return -1;
}
};
XMLNode2.prototype.foreachTreeNode = function(node, func) {
var child, j, len, ref2, res;
node || (node = this.document());
ref2 = node.children;
for (j = 0, len = ref2.length;j < len; j++) {
child = ref2[j];
if (res = func(child)) {
return res;
} else {
res = this.foreachTreeNode(child, func);
if (res) {
return res;
}
}
}
};
return XMLNode2;
}();
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLStringifier.js
var require_XMLStringifier = __commonJS((exports, module) => {
(function() {
var XMLStringifier, bind = function(fn, me) {
return function() {
return fn.apply(me, arguments);
};
}, hasProp = {}.hasOwnProperty;
module.exports = XMLStringifier = function() {
function XMLStringifier2(options) {
this.assertLegalName = bind(this.assertLegalName, this);
this.assertLegalChar = bind(this.assertLegalChar, this);
var key, ref, value;
options || (options = {});
this.options = options;
if (!this.options.version) {
this.options.version = "1.0";
}
ref = options.stringify || {};
for (key in ref) {
if (!hasProp.call(ref, key))
continue;
value = ref[key];
this[key] = value;
}
}
XMLStringifier2.prototype.name = function(val2) {
if (this.options.noValidation) {
return val2;
}
return this.assertLegalName("" + val2 || "");
};
XMLStringifier2.prototype.text = function(val2) {
if (this.options.noValidation) {
return val2;
}
return this.assertLegalChar(this.textEscape("" + val2 || ""));
};
XMLStringifier2.prototype.cdata = function(val2) {
if (this.options.noValidation) {
return val2;
}
val2 = "" + val2 || "";
val2 = val2.replace("]]>", "]]]]><![CDATA[>");
return this.assertLegalChar(val2);
};
XMLStringifier2.prototype.comment = function(val2) {
if (this.options.noValidation) {
return val2;
}
val2 = "" + val2 || "";
if (val2.match(/--/)) {
throw new Error("Comment text cannot contain double-hypen: " + val2);
}
return this.assertLegalChar(val2);
};
XMLStringifier2.prototype.raw = function(val2) {
if (this.options.noValidation) {
return val2;
}
return "" + val2 || "";
};
XMLStringifier2.prototype.attValue = function(val2) {
if (this.options.noValidation) {
return val2;
}
return this.assertLegalChar(this.attEscape(val2 = "" + val2 || ""));
};
XMLStringifier2.prototype.insTarget = function(val2) {
if (this.options.noValidation) {
return val2;
}
return this.assertLegalChar("" + val2 || "");
};
XMLStringifier2.prototype.insValue = function(val2) {
if (this.options.noValidation) {
return val2;
}
val2 = "" + val2 || "";
if (val2.match(/\?>/)) {
throw new Error("Invalid processing instruction value: " + val2);
}
return this.assertLegalChar(val2);
};
XMLStringifier2.prototype.xmlVersion = function(val2) {
if (this.options.noValidation) {
return val2;
}
val2 = "" + val2 || "";
if (!val2.match(/1\.[0-9]+/)) {
throw new Error("Invalid version number: " + val2);
}
return val2;
};
XMLStringifier2.prototype.xmlEncoding = function(val2) {
if (this.options.noValidation) {
return val2;
}
val2 = "" + val2 || "";
if (!val2.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) {
throw new Error("Invalid encoding: " + val2);
}
return this.assertLegalChar(val2);
};
XMLStringifier2.prototype.xmlStandalone = function(val2) {
if (this.options.noValidation) {
return val2;
}
if (val2) {
return "yes";
} else {
return "no";
}
};
XMLStringifier2.prototype.dtdPubID = function(val2) {
if (this.options.noValidation) {
return val2;
}
return this.assertLegalChar("" + val2 || "");
};
XMLStringifier2.prototype.dtdSysID = function(val2) {
if (this.options.noValidation) {
return val2;
}
return this.assertLegalChar("" + val2 || "");
};
XMLStringifier2.prototype.dtdElementValue = function(val2) {
if (this.options.noValidation) {
return val2;
}
return this.assertLegalChar("" + val2 || "");
};
XMLStringifier2.prototype.dtdAttType = function(val2) {
if (this.options.noValidation) {
return val2;
}
return this.assertLegalChar("" + val2 || "");
};
XMLStringifier2.prototype.dtdAttDefault = function(val2) {
if (this.options.noValidation) {
return val2;
}
return this.assertLegalChar("" + val2 || "");
};
XMLStringifier2.prototype.dtdEntityValue = function(val2) {
if (this.options.noValidation) {
return val2;
}
return this.assertLegalChar("" + val2 || "");
};
XMLStringifier2.prototype.dtdNData = function(val2) {
if (this.options.noValidation) {
return val2;
}
return this.assertLegalChar("" + val2 || "");
};
XMLStringifier2.prototype.convertAttKey = "@";
XMLStringifier2.prototype.convertPIKey = "?";
XMLStringifier2.prototype.convertTextKey = "#text";
XMLStringifier2.prototype.convertCDataKey = "#cdata";
XMLStringifier2.prototype.convertCommentKey = "#comment";
XMLStringifier2.prototype.convertRawKey = "#raw";
XMLStringifier2.prototype.assertLegalChar = function(str) {
var regex, res;
if (this.options.noValidation) {
return str;
}
regex = "";
if (this.options.version === "1.0") {
regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
if (res = str.match(regex)) {
throw new Error("Invalid character in string: " + str + " at index " + res.index);
}
} else if (this.options.version === "1.1") {
regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
if (res = str.match(regex)) {
throw new Error("Invalid character in string: " + str + " at index " + res.index);
}
}
return str;
};
XMLStringifier2.prototype.assertLegalName = function(str) {
var regex;
if (this.options.noValidation) {
return str;
}
this.assertLegalChar(str);
regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/;
if (!str.match(regex)) {
throw new Error("Invalid character in name");
}
return str;
};
XMLStringifier2.prototype.textEscape = function(str) {
var ampregex;
if (this.options.noValidation) {
return str;
}
ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
return str.replace(ampregex, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\r/g, "&#xD;");
};
XMLStringifier2.prototype.attEscape = function(str) {
var ampregex;
if (this.options.noValidation) {
return str;
}
ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
return str.replace(ampregex, "&amp;").replace(/</g, "&lt;").replace(/"/g, "&quot;").replace(/\t/g, "&#x9;").replace(/\n/g, "&#xA;").replace(/\r/g, "&#xD;");
};
return XMLStringifier2;
}();
}).call(exports);
});
// node_modules/xmlbuilder/lib/WriterState.js
var require_WriterState = __commonJS((exports, module) => {
(function() {
module.exports = {
None: 0,
OpenTag: 1,
InsideTag: 2,
CloseTag: 3
};
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLWriterBase.js
var require_XMLWriterBase = __commonJS((exports, module) => {
(function() {
var NodeType, WriterState, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLText, XMLWriterBase, assign, hasProp = {}.hasOwnProperty;
assign = require_Utility().assign;
NodeType = require_NodeType();
XMLDeclaration = require_XMLDeclaration();
XMLDocType = require_XMLDocType();
XMLCData = require_XMLCData();
XMLComment = require_XMLComment();
XMLElement = require_XMLElement();
XMLRaw = require_XMLRaw();
XMLText = require_XMLText();
XMLProcessingInstruction = require_XMLProcessingInstruction();
XMLDummy = require_XMLDummy();
XMLDTDAttList = require_XMLDTDAttList();
XMLDTDElement = require_XMLDTDElement();
XMLDTDEntity = require_XMLDTDEntity();
XMLDTDNotation = require_XMLDTDNotation();
WriterState = require_WriterState();
module.exports = XMLWriterBase = function() {
function XMLWriterBase2(options) {
var key, ref, value;
options || (options = {});
this.options = options;
ref = options.writer || {};
for (key in ref) {
if (!hasProp.call(ref, key))
continue;
value = ref[key];
this["_" + key] = this[key];
this[key] = value;
}
}
XMLWriterBase2.prototype.filterOptions = function(options) {
var filteredOptions, ref, ref1, ref2, ref3, ref4, ref5, ref6;
options || (options = {});
options = assign({}, this.options, options);
filteredOptions = {
writer: this
};
filteredOptions.pretty = options.pretty || false;
filteredOptions.allowEmpty = options.allowEmpty || false;
filteredOptions.indent = (ref = options.indent) != null ? ref : " ";
filteredOptions.newline = (ref1 = options.newline) != null ? ref1 : `
`;
filteredOptions.offset = (ref2 = options.offset) != null ? ref2 : 0;
filteredOptions.dontPrettyTextNodes = (ref3 = (ref4 = options.dontPrettyTextNodes) != null ? ref4 : options.dontprettytextnodes) != null ? ref3 : 0;
filteredOptions.spaceBeforeSlash = (ref5 = (ref6 = options.spaceBeforeSlash) != null ? ref6 : options.spacebeforeslash) != null ? ref5 : "";
if (filteredOptions.spaceBeforeSlash === true) {
filteredOptions.spaceBeforeSlash = " ";
}
filteredOptions.suppressPrettyCount = 0;
filteredOptions.user = {};
filteredOptions.state = WriterState.None;
return filteredOptions;
};
XMLWriterBase2.prototype.indent = function(node, options, level) {
var indentLevel;
if (!options.pretty || options.suppressPrettyCount) {
return "";
} else if (options.pretty) {
indentLevel = (level || 0) + options.offset + 1;
if (indentLevel > 0) {
return new Array(indentLevel).join(options.indent);
}
}
return "";
};
XMLWriterBase2.prototype.endline = function(node, options, level) {
if (!options.pretty || options.suppressPrettyCount) {
return "";
} else {
return options.newline;
}
};
XMLWriterBase2.prototype.attribute = function(att, options, level) {
var r;
this.openAttribute(att, options, level);
r = " " + att.name + '="' + att.value + '"';
this.closeAttribute(att, options, level);
return r;
};
XMLWriterBase2.prototype.cdata = function(node, options, level) {
var r;
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r = this.indent(node, options, level) + "<![CDATA[";
options.state = WriterState.InsideTag;
r += node.value;
options.state = WriterState.CloseTag;
r += "]]>" + this.endline(node, options, level);
options.state = WriterState.None;
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.comment = function(node, options, level) {
var r;
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r = this.indent(node, options, level) + "<!-- ";
options.state = WriterState.InsideTag;
r += node.value;
options.state = WriterState.CloseTag;
r += " -->" + this.endline(node, options, level);
options.state = WriterState.None;
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.declaration = function(node, options, level) {
var r;
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r = this.indent(node, options, level) + "<?xml";
options.state = WriterState.InsideTag;
r += ' version="' + node.version + '"';
if (node.encoding != null) {
r += ' encoding="' + node.encoding + '"';
}
if (node.standalone != null) {
r += ' standalone="' + node.standalone + '"';
}
options.state = WriterState.CloseTag;
r += options.spaceBeforeSlash + "?>";
r += this.endline(node, options, level);
options.state = WriterState.None;
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.docType = function(node, options, level) {
var child, i, len, r, ref;
level || (level = 0);
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r = this.indent(node, options, level);
r += "<!DOCTYPE " + node.root().name;
if (node.pubID && node.sysID) {
r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
} else if (node.sysID) {
r += ' SYSTEM "' + node.sysID + '"';
}
if (node.children.length > 0) {
r += " [";
r += this.endline(node, options, level);
options.state = WriterState.InsideTag;
ref = node.children;
for (i = 0, len = ref.length;i < len; i++) {
child = ref[i];
r += this.writeChildNode(child, options, level + 1);
}
options.state = WriterState.CloseTag;
r += "]";
}
options.state = WriterState.CloseTag;
r += options.spaceBeforeSlash + ">";
r += this.endline(node, options, level);
options.state = WriterState.None;
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.element = function(node, options, level) {
var att, child, childNodeCount, firstChildNode, i, j, len, len1, name, prettySuppressed, r, ref, ref1, ref2;
level || (level = 0);
prettySuppressed = false;
r = "";
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r += this.indent(node, options, level) + "<" + node.name;
ref = node.attribs;
for (name in ref) {
if (!hasProp.call(ref, name))
continue;
att = ref[name];
r += this.attribute(att, options, level);
}
childNodeCount = node.children.length;
firstChildNode = childNodeCount === 0 ? null : node.children[0];
if (childNodeCount === 0 || node.children.every(function(e) {
return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === "";
})) {
if (options.allowEmpty) {
r += ">";
options.state = WriterState.CloseTag;
r += "</" + node.name + ">" + this.endline(node, options, level);
} else {
options.state = WriterState.CloseTag;
r += options.spaceBeforeSlash + "/>" + this.endline(node, options, level);
}
} else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && firstChildNode.value != null) {
r += ">";
options.state = WriterState.InsideTag;
options.suppressPrettyCount++;
prettySuppressed = true;
r += this.writeChildNode(firstChildNode, options, level + 1);
options.suppressPrettyCount--;
prettySuppressed = false;
options.state = WriterState.CloseTag;
r += "</" + node.name + ">" + this.endline(node, options, level);
} else {
if (options.dontPrettyTextNodes) {
ref1 = node.children;
for (i = 0, len = ref1.length;i < len; i++) {
child = ref1[i];
if ((child.type === NodeType.Text || child.type === NodeType.Raw) && child.value != null) {
options.suppressPrettyCount++;
prettySuppressed = true;
break;
}
}
}
r += ">" + this.endline(node, options, level);
options.state = WriterState.InsideTag;
ref2 = node.children;
for (j = 0, len1 = ref2.length;j < len1; j++) {
child = ref2[j];
r += this.writeChildNode(child, options, level + 1);
}
options.state = WriterState.CloseTag;
r += this.indent(node, options, level) + "</" + node.name + ">";
if (prettySuppressed) {
options.suppressPrettyCount--;
}
r += this.endline(node, options, level);
options.state = WriterState.None;
}
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.writeChildNode = function(node, options, level) {
switch (node.type) {
case NodeType.CData:
return this.cdata(node, options, level);
case NodeType.Comment:
return this.comment(node, options, level);
case NodeType.Element:
return this.element(node, options, level);
case NodeType.Raw:
return this.raw(node, options, level);
case NodeType.Text:
return this.text(node, options, level);
case NodeType.ProcessingInstruction:
return this.processingInstruction(node, options, level);
case NodeType.Dummy:
return "";
case NodeType.Declaration:
return this.declaration(node, options, level);
case NodeType.DocType:
return this.docType(node, options, level);
case NodeType.AttributeDeclaration:
return this.dtdAttList(node, options, level);
case NodeType.ElementDeclaration:
return this.dtdElement(node, options, level);
case NodeType.EntityDeclaration:
return this.dtdEntity(node, options, level);
case NodeType.NotationDeclaration:
return this.dtdNotation(node, options, level);
default:
throw new Error("Unknown XML node type: " + node.constructor.name);
}
};
XMLWriterBase2.prototype.processingInstruction = function(node, options, level) {
var r;
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r = this.indent(node, options, level) + "<?";
options.state = WriterState.InsideTag;
r += node.target;
if (node.value) {
r += " " + node.value;
}
options.state = WriterState.CloseTag;
r += options.spaceBeforeSlash + "?>";
r += this.endline(node, options, level);
options.state = WriterState.None;
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.raw = function(node, options, level) {
var r;
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r = this.indent(node, options, level);
options.state = WriterState.InsideTag;
r += node.value;
options.state = WriterState.CloseTag;
r += this.endline(node, options, level);
options.state = WriterState.None;
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.text = function(node, options, level) {
var r;
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r = this.indent(node, options, level);
options.state = WriterState.InsideTag;
r += node.value;
options.state = WriterState.CloseTag;
r += this.endline(node, options, level);
options.state = WriterState.None;
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.dtdAttList = function(node, options, level) {
var r;
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r = this.indent(node, options, level) + "<!ATTLIST";
options.state = WriterState.InsideTag;
r += " " + node.elementName + " " + node.attributeName + " " + node.attributeType;
if (node.defaultValueType !== "#DEFAULT") {
r += " " + node.defaultValueType;
}
if (node.defaultValue) {
r += ' "' + node.defaultValue + '"';
}
options.state = WriterState.CloseTag;
r += options.spaceBeforeSlash + ">" + this.endline(node, options, level);
options.state = WriterState.None;
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.dtdElement = function(node, options, level) {
var r;
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r = this.indent(node, options, level) + "<!ELEMENT";
options.state = WriterState.InsideTag;
r += " " + node.name + " " + node.value;
options.state = WriterState.CloseTag;
r += options.spaceBeforeSlash + ">" + this.endline(node, options, level);
options.state = WriterState.None;
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.dtdEntity = function(node, options, level) {
var r;
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r = this.indent(node, options, level) + "<!ENTITY";
options.state = WriterState.InsideTag;
if (node.pe) {
r += " %";
}
r += " " + node.name;
if (node.value) {
r += ' "' + node.value + '"';
} else {
if (node.pubID && node.sysID) {
r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
} else if (node.sysID) {
r += ' SYSTEM "' + node.sysID + '"';
}
if (node.nData) {
r += " NDATA " + node.nData;
}
}
options.state = WriterState.CloseTag;
r += options.spaceBeforeSlash + ">" + this.endline(node, options, level);
options.state = WriterState.None;
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.dtdNotation = function(node, options, level) {
var r;
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
r = this.indent(node, options, level) + "<!NOTATION";
options.state = WriterState.InsideTag;
r += " " + node.name;
if (node.pubID && node.sysID) {
r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
} else if (node.pubID) {
r += ' PUBLIC "' + node.pubID + '"';
} else if (node.sysID) {
r += ' SYSTEM "' + node.sysID + '"';
}
options.state = WriterState.CloseTag;
r += options.spaceBeforeSlash + ">" + this.endline(node, options, level);
options.state = WriterState.None;
this.closeNode(node, options, level);
return r;
};
XMLWriterBase2.prototype.openNode = function(node, options, level) {};
XMLWriterBase2.prototype.closeNode = function(node, options, level) {};
XMLWriterBase2.prototype.openAttribute = function(att, options, level) {};
XMLWriterBase2.prototype.closeAttribute = function(att, options, level) {};
return XMLWriterBase2;
}();
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLStringWriter.js
var require_XMLStringWriter = __commonJS((exports, module) => {
(function() {
var XMLStringWriter, XMLWriterBase, 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;
XMLWriterBase = require_XMLWriterBase();
module.exports = XMLStringWriter = function(superClass) {
extend(XMLStringWriter2, superClass);
function XMLStringWriter2(options) {
XMLStringWriter2.__super__.constructor.call(this, options);
}
XMLStringWriter2.prototype.document = function(doc, options) {
var child, i, len, r, ref;
options = this.filterOptions(options);
r = "";
ref = doc.children;
for (i = 0, len = ref.length;i < len; i++) {
child = ref[i];
r += this.writeChildNode(child, options, 0);
}
if (options.pretty && r.slice(-options.newline.length) === options.newline) {
r = r.slice(0, -options.newline.length);
}
return r;
};
return XMLStringWriter2;
}(XMLWriterBase);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDocument.js
var require_XMLDocument = __commonJS((exports, module) => {
(function() {
var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject, 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;
isPlainObject = require_Utility().isPlainObject;
XMLDOMImplementation = require_XMLDOMImplementation();
XMLDOMConfiguration = require_XMLDOMConfiguration();
XMLNode = require_XMLNode();
NodeType = require_NodeType();
XMLStringifier = require_XMLStringifier();
XMLStringWriter = require_XMLStringWriter();
module.exports = XMLDocument = function(superClass) {
extend(XMLDocument2, superClass);
function XMLDocument2(options) {
XMLDocument2.__super__.constructor.call(this, null);
this.name = "#document";
this.type = NodeType.Document;
this.documentURI = null;
this.domConfig = new XMLDOMConfiguration;
options || (options = {});
if (!options.writer) {
options.writer = new XMLStringWriter;
}
this.options = options;
this.stringify = new XMLStringifier(options);
}
Object.defineProperty(XMLDocument2.prototype, "implementation", {
value: new XMLDOMImplementation
});
Object.defineProperty(XMLDocument2.prototype, "doctype", {
get: function() {
var child, i, len, ref;
ref = this.children;
for (i = 0, len = ref.length;i < len; i++) {
child = ref[i];
if (child.type === NodeType.DocType) {
return child;
}
}
return null;
}
});
Object.defineProperty(XMLDocument2.prototype, "documentElement", {
get: function() {
return this.rootObject || null;
}
});
Object.defineProperty(XMLDocument2.prototype, "inputEncoding", {
get: function() {
return null;
}
});
Object.defineProperty(XMLDocument2.prototype, "strictErrorChecking", {
get: function() {
return false;
}
});
Object.defineProperty(XMLDocument2.prototype, "xmlEncoding", {
get: function() {
if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
return this.children[0].encoding;
} else {
return null;
}
}
});
Object.defineProperty(XMLDocument2.prototype, "xmlStandalone", {
get: function() {
if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
return this.children[0].standalone === "yes";
} else {
return false;
}
}
});
Object.defineProperty(XMLDocument2.prototype, "xmlVersion", {
get: function() {
if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
return this.children[0].version;
} else {
return "1.0";
}
}
});
Object.defineProperty(XMLDocument2.prototype, "URL", {
get: function() {
return this.documentURI;
}
});
Object.defineProperty(XMLDocument2.prototype, "origin", {
get: function() {
return null;
}
});
Object.defineProperty(XMLDocument2.prototype, "compatMode", {
get: function() {
return null;
}
});
Object.defineProperty(XMLDocument2.prototype, "characterSet", {
get: function() {
return null;
}
});
Object.defineProperty(XMLDocument2.prototype, "contentType", {
get: function() {
return null;
}
});
XMLDocument2.prototype.end = function(writer) {
var writerOptions;
writerOptions = {};
if (!writer) {
writer = this.options.writer;
} else if (isPlainObject(writer)) {
writerOptions = writer;
writer = this.options.writer;
}
return writer.document(this, writer.filterOptions(writerOptions));
};
XMLDocument2.prototype.toString = function(options) {
return this.options.writer.document(this, this.options.writer.filterOptions(options));
};
XMLDocument2.prototype.createElement = function(tagName) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createDocumentFragment = function() {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createTextNode = function(data) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createComment = function(data) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createCDATASection = function(data) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createProcessingInstruction = function(target, data) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createAttribute = function(name) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createEntityReference = function(name) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.getElementsByTagName = function(tagname) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.importNode = function(importedNode, deep) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createElementNS = function(namespaceURI, qualifiedName) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createAttributeNS = function(namespaceURI, qualifiedName) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.getElementById = function(elementId) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.adoptNode = function(source) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.normalizeDocument = function() {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.renameNode = function(node, namespaceURI, qualifiedName) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.getElementsByClassName = function(classNames) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createEvent = function(eventInterface) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createRange = function() {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createNodeIterator = function(root, whatToShow, filter) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLDocument2.prototype.createTreeWalker = function(root, whatToShow, filter) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
return XMLDocument2;
}(XMLNode);
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLDocumentCB.js
var require_XMLDocumentCB = __commonJS((exports, module) => {
(function() {
var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref, hasProp = {}.hasOwnProperty;
ref = require_Utility(), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue;
NodeType = require_NodeType();
XMLDocument = require_XMLDocument();
XMLElement = require_XMLElement();
XMLCData = require_XMLCData();
XMLComment = require_XMLComment();
XMLRaw = require_XMLRaw();
XMLText = require_XMLText();
XMLProcessingInstruction = require_XMLProcessingInstruction();
XMLDeclaration = require_XMLDeclaration();
XMLDocType = require_XMLDocType();
XMLDTDAttList = require_XMLDTDAttList();
XMLDTDEntity = require_XMLDTDEntity();
XMLDTDElement = require_XMLDTDElement();
XMLDTDNotation = require_XMLDTDNotation();
XMLAttribute = require_XMLAttribute();
XMLStringifier = require_XMLStringifier();
XMLStringWriter = require_XMLStringWriter();
WriterState = require_WriterState();
module.exports = XMLDocumentCB = function() {
function XMLDocumentCB2(options, onData, onEnd) {
var writerOptions;
this.name = "?xml";
this.type = NodeType.Document;
options || (options = {});
writerOptions = {};
if (!options.writer) {
options.writer = new XMLStringWriter;
} else if (isPlainObject(options.writer)) {
writerOptions = options.writer;
options.writer = new XMLStringWriter;
}
this.options = options;
this.writer = options.writer;
this.writerOptions = this.writer.filterOptions(writerOptions);
this.stringify = new XMLStringifier(options);
this.onDataCallback = onData || function() {};
this.onEndCallback = onEnd || function() {};
this.currentNode = null;
this.currentLevel = -1;
this.openTags = {};
this.documentStarted = false;
this.documentCompleted = false;
this.root = null;
}
XMLDocumentCB2.prototype.createChildNode = function(node) {
var att, attName, attributes, child, i, len, ref1, ref2;
switch (node.type) {
case NodeType.CData:
this.cdata(node.value);
break;
case NodeType.Comment:
this.comment(node.value);
break;
case NodeType.Element:
attributes = {};
ref1 = node.attribs;
for (attName in ref1) {
if (!hasProp.call(ref1, attName))
continue;
att = ref1[attName];
attributes[attName] = att.value;
}
this.node(node.name, attributes);
break;
case NodeType.Dummy:
this.dummy();
break;
case NodeType.Raw:
this.raw(node.value);
break;
case NodeType.Text:
this.text(node.value);
break;
case NodeType.ProcessingInstruction:
this.instruction(node.target, node.value);
break;
default:
throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name);
}
ref2 = node.children;
for (i = 0, len = ref2.length;i < len; i++) {
child = ref2[i];
this.createChildNode(child);
if (child.type === NodeType.Element) {
this.up();
}
}
return this;
};
XMLDocumentCB2.prototype.dummy = function() {
return this;
};
XMLDocumentCB2.prototype.node = function(name, attributes, text) {
var ref1;
if (name == null) {
throw new Error("Missing node name.");
}
if (this.root && this.currentLevel === -1) {
throw new Error("Document can only have one root node. " + this.debugInfo(name));
}
this.openCurrent();
name = getValue(name);
if (attributes == null) {
attributes = {};
}
attributes = getValue(attributes);
if (!isObject(attributes)) {
ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
}
this.currentNode = new XMLElement(this, name, attributes);
this.currentNode.children = false;
this.currentLevel++;
this.openTags[this.currentLevel] = this.currentNode;
if (text != null) {
this.text(text);
}
return this;
};
XMLDocumentCB2.prototype.element = function(name, attributes, text) {
var child, i, len, oldValidationFlag, ref1, root;
if (this.currentNode && this.currentNode.type === NodeType.DocType) {
this.dtdElement.apply(this, arguments);
} else {
if (Array.isArray(name) || isObject(name) || isFunction(name)) {
oldValidationFlag = this.options.noValidation;
this.options.noValidation = true;
root = new XMLDocument(this.options).element("TEMP_ROOT");
root.element(name);
this.options.noValidation = oldValidationFlag;
ref1 = root.children;
for (i = 0, len = ref1.length;i < len; i++) {
child = ref1[i];
this.createChildNode(child);
if (child.type === NodeType.Element) {
this.up();
}
}
} else {
this.node(name, attributes, text);
}
}
return this;
};
XMLDocumentCB2.prototype.attribute = function(name, value) {
var attName, attValue;
if (!this.currentNode || this.currentNode.children) {
throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name));
}
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.keepNullAttributes && value == null) {
this.currentNode.attribs[name] = new XMLAttribute(this, name, "");
} else if (value != null) {
this.currentNode.attribs[name] = new XMLAttribute(this, name, value);
}
}
return this;
};
XMLDocumentCB2.prototype.text = function(value) {
var node;
this.openCurrent();
node = new XMLText(this, value);
this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
return this;
};
XMLDocumentCB2.prototype.cdata = function(value) {
var node;
this.openCurrent();
node = new XMLCData(this, value);
this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
return this;
};
XMLDocumentCB2.prototype.comment = function(value) {
var node;
this.openCurrent();
node = new XMLComment(this, value);
this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
return this;
};
XMLDocumentCB2.prototype.raw = function(value) {
var node;
this.openCurrent();
node = new XMLRaw(this, value);
this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
return this;
};
XMLDocumentCB2.prototype.instruction = function(target, value) {
var i, insTarget, insValue, len, node;
this.openCurrent();
if (target != null) {
target = getValue(target);
}
if (value != null) {
value = getValue(value);
}
if (Array.isArray(target)) {
for (i = 0, len = target.length;i < len; i++) {
insTarget = target[i];
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();
}
node = new XMLProcessingInstruction(this, target, value);
this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
}
return this;
};
XMLDocumentCB2.prototype.declaration = function(version, encoding, standalone) {
var node;
this.openCurrent();
if (this.documentStarted) {
throw new Error("declaration() must be the first node.");
}
node = new XMLDeclaration(this, version, encoding, standalone);
this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
return this;
};
XMLDocumentCB2.prototype.doctype = function(root, pubID, sysID) {
this.openCurrent();
if (root == null) {
throw new Error("Missing root node name.");
}
if (this.root) {
throw new Error("dtd() must come before the root node.");
}
this.currentNode = new XMLDocType(this, pubID, sysID);
this.currentNode.rootNodeName = root;
this.currentNode.children = false;
this.currentLevel++;
this.openTags[this.currentLevel] = this.currentNode;
return this;
};
XMLDocumentCB2.prototype.dtdElement = function(name, value) {
var node;
this.openCurrent();
node = new XMLDTDElement(this, name, value);
this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
return this;
};
XMLDocumentCB2.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
var node;
this.openCurrent();
node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
return this;
};
XMLDocumentCB2.prototype.entity = function(name, value) {
var node;
this.openCurrent();
node = new XMLDTDEntity(this, false, name, value);
this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
return this;
};
XMLDocumentCB2.prototype.pEntity = function(name, value) {
var node;
this.openCurrent();
node = new XMLDTDEntity(this, true, name, value);
this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
return this;
};
XMLDocumentCB2.prototype.notation = function(name, value) {
var node;
this.openCurrent();
node = new XMLDTDNotation(this, name, value);
this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
return this;
};
XMLDocumentCB2.prototype.up = function() {
if (this.currentLevel < 0) {
throw new Error("The document node has no parent.");
}
if (this.currentNode) {
if (this.currentNode.children) {
this.closeNode(this.currentNode);
} else {
this.openNode(this.currentNode);
}
this.currentNode = null;
} else {
this.closeNode(this.openTags[this.currentLevel]);
}
delete this.openTags[this.currentLevel];
this.currentLevel--;
return this;
};
XMLDocumentCB2.prototype.end = function() {
while (this.currentLevel >= 0) {
this.up();
}
return this.onEnd();
};
XMLDocumentCB2.prototype.openCurrent = function() {
if (this.currentNode) {
this.currentNode.children = true;
return this.openNode(this.currentNode);
}
};
XMLDocumentCB2.prototype.openNode = function(node) {
var att, chunk, name, ref1;
if (!node.isOpen) {
if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) {
this.root = node;
}
chunk = "";
if (node.type === NodeType.Element) {
this.writerOptions.state = WriterState.OpenTag;
chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + "<" + node.name;
ref1 = node.attribs;
for (name in ref1) {
if (!hasProp.call(ref1, name))
continue;
att = ref1[name];
chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel);
}
chunk += (node.children ? ">" : "/>") + this.writer.endline(node, this.writerOptions, this.currentLevel);
this.writerOptions.state = WriterState.InsideTag;
} else {
this.writerOptions.state = WriterState.OpenTag;
chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + "<!DOCTYPE " + node.rootNodeName;
if (node.pubID && node.sysID) {
chunk += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
} else if (node.sysID) {
chunk += ' SYSTEM "' + node.sysID + '"';
}
if (node.children) {
chunk += " [";
this.writerOptions.state = WriterState.InsideTag;
} else {
this.writerOptions.state = WriterState.CloseTag;
chunk += ">";
}
chunk += this.writer.endline(node, this.writerOptions, this.currentLevel);
}
this.onData(chunk, this.currentLevel);
return node.isOpen = true;
}
};
XMLDocumentCB2.prototype.closeNode = function(node) {
var chunk;
if (!node.isClosed) {
chunk = "";
this.writerOptions.state = WriterState.CloseTag;
if (node.type === NodeType.Element) {
chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + "</" + node.name + ">" + this.writer.endline(node, this.writerOptions, this.currentLevel);
} else {
chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + "]>" + this.writer.endline(node, this.writerOptions, this.currentLevel);
}
this.writerOptions.state = WriterState.None;
this.onData(chunk, this.currentLevel);
return node.isClosed = true;
}
};
XMLDocumentCB2.prototype.onData = function(chunk, level) {
this.documentStarted = true;
return this.onDataCallback(chunk, level + 1);
};
XMLDocumentCB2.prototype.onEnd = function() {
this.documentCompleted = true;
return this.onEndCallback();
};
XMLDocumentCB2.prototype.debugInfo = function(name) {
if (name == null) {
return "";
} else {
return "node: <" + name + ">";
}
};
XMLDocumentCB2.prototype.ele = function() {
return this.element.apply(this, arguments);
};
XMLDocumentCB2.prototype.nod = function(name, attributes, text) {
return this.node(name, attributes, text);
};
XMLDocumentCB2.prototype.txt = function(value) {
return this.text(value);
};
XMLDocumentCB2.prototype.dat = function(value) {
return this.cdata(value);
};
XMLDocumentCB2.prototype.com = function(value) {
return this.comment(value);
};
XMLDocumentCB2.prototype.ins = function(target, value) {
return this.instruction(target, value);
};
XMLDocumentCB2.prototype.dec = function(version, encoding, standalone) {
return this.declaration(version, encoding, standalone);
};
XMLDocumentCB2.prototype.dtd = function(root, pubID, sysID) {
return this.doctype(root, pubID, sysID);
};
XMLDocumentCB2.prototype.e = function(name, attributes, text) {
return this.element(name, attributes, text);
};
XMLDocumentCB2.prototype.n = function(name, attributes, text) {
return this.node(name, attributes, text);
};
XMLDocumentCB2.prototype.t = function(value) {
return this.text(value);
};
XMLDocumentCB2.prototype.d = function(value) {
return this.cdata(value);
};
XMLDocumentCB2.prototype.c = function(value) {
return this.comment(value);
};
XMLDocumentCB2.prototype.r = function(value) {
return this.raw(value);
};
XMLDocumentCB2.prototype.i = function(target, value) {
return this.instruction(target, value);
};
XMLDocumentCB2.prototype.att = function() {
if (this.currentNode && this.currentNode.type === NodeType.DocType) {
return this.attList.apply(this, arguments);
} else {
return this.attribute.apply(this, arguments);
}
};
XMLDocumentCB2.prototype.a = function() {
if (this.currentNode && this.currentNode.type === NodeType.DocType) {
return this.attList.apply(this, arguments);
} else {
return this.attribute.apply(this, arguments);
}
};
XMLDocumentCB2.prototype.ent = function(name, value) {
return this.entity(name, value);
};
XMLDocumentCB2.prototype.pent = function(name, value) {
return this.pEntity(name, value);
};
XMLDocumentCB2.prototype.not = function(name, value) {
return this.notation(name, value);
};
return XMLDocumentCB2;
}();
}).call(exports);
});
// node_modules/xmlbuilder/lib/XMLStreamWriter.js
var require_XMLStreamWriter = __commonJS((exports, module) => {
(function() {
var NodeType, WriterState, XMLStreamWriter, XMLWriterBase, 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;
NodeType = require_NodeType();
XMLWriterBase = require_XMLWriterBase();
WriterState = require_WriterState();
module.exports = XMLStreamWriter = function(superClass) {
extend(XMLStreamWriter2, superClass);
function XMLStreamWriter2(stream, options) {
this.stream = stream;
XMLStreamWriter2.__super__.constructor.call(this, options);
}
XMLStreamWriter2.prototype.endline = function(node, options, level) {
if (node.isLastRootNode && options.state === WriterState.CloseTag) {
return "";
} else {
return XMLStreamWriter2.__super__.endline.call(this, node, options, level);
}
};
XMLStreamWriter2.prototype.document = function(doc, options) {
var child, i, j, k, len, len1, ref, ref1, results;
ref = doc.children;
for (i = j = 0, len = ref.length;j < len; i = ++j) {
child = ref[i];
child.isLastRootNode = i === doc.children.length - 1;
}
options = this.filterOptions(options);
ref1 = doc.children;
results = [];
for (k = 0, len1 = ref1.length;k < len1; k++) {
child = ref1[k];
results.push(this.writeChildNode(child, options, 0));
}
return results;
};
XMLStreamWriter2.prototype.attribute = function(att, options, level) {
return this.stream.write(XMLStreamWriter2.__super__.attribute.call(this, att, options, level));
};
XMLStreamWriter2.prototype.cdata = function(node, options, level) {
return this.stream.write(XMLStreamWriter2.__super__.cdata.call(this, node, options, level));
};
XMLStreamWriter2.prototype.comment = function(node, options, level) {
return this.stream.write(XMLStreamWriter2.__super__.comment.call(this, node, options, level));
};
XMLStreamWriter2.prototype.declaration = function(node, options, level) {
return this.stream.write(XMLStreamWriter2.__super__.declaration.call(this, node, options, level));
};
XMLStreamWriter2.prototype.docType = function(node, options, level) {
var child, j, len, ref;
level || (level = 0);
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
this.stream.write(this.indent(node, options, level));
this.stream.write("<!DOCTYPE " + node.root().name);
if (node.pubID && node.sysID) {
this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
} else if (node.sysID) {
this.stream.write(' SYSTEM "' + node.sysID + '"');
}
if (node.children.length > 0) {
this.stream.write(" [");
this.stream.write(this.endline(node, options, level));
options.state = WriterState.InsideTag;
ref = node.children;
for (j = 0, len = ref.length;j < len; j++) {
child = ref[j];
this.writeChildNode(child, options, level + 1);
}
options.state = WriterState.CloseTag;
this.stream.write("]");
}
options.state = WriterState.CloseTag;
this.stream.write(options.spaceBeforeSlash + ">");
this.stream.write(this.endline(node, options, level));
options.state = WriterState.None;
return this.closeNode(node, options, level);
};
XMLStreamWriter2.prototype.element = function(node, options, level) {
var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1;
level || (level = 0);
this.openNode(node, options, level);
options.state = WriterState.OpenTag;
this.stream.write(this.indent(node, options, level) + "<" + node.name);
ref = node.attribs;
for (name in ref) {
if (!hasProp.call(ref, name))
continue;
att = ref[name];
this.attribute(att, options, level);
}
childNodeCount = node.children.length;
firstChildNode = childNodeCount === 0 ? null : node.children[0];
if (childNodeCount === 0 || node.children.every(function(e) {
return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === "";
})) {
if (options.allowEmpty) {
this.stream.write(">");
options.state = WriterState.CloseTag;
this.stream.write("</" + node.name + ">");
} else {
options.state = WriterState.CloseTag;
this.stream.write(options.spaceBeforeSlash + "/>");
}
} else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && firstChildNode.value != null) {
this.stream.write(">");
options.state = WriterState.InsideTag;
options.suppressPrettyCount++;
prettySuppressed = true;
this.writeChildNode(firstChildNode, options, level + 1);
options.suppressPrettyCount--;
prettySuppressed = false;
options.state = WriterState.CloseTag;
this.stream.write("</" + node.name + ">");
} else {
this.stream.write(">" + this.endline(node, options, level));
options.state = WriterState.InsideTag;
ref1 = node.children;
for (j = 0, len = ref1.length;j < len; j++) {
child = ref1[j];
this.writeChildNode(child, options, level + 1);
}
options.state = WriterState.CloseTag;
this.stream.write(this.indent(node, options, level) + "</" + node.name + ">");
}
this.stream.write(this.endline(node, options, level));
options.state = WriterState.None;
return this.closeNode(node, options, level);
};
XMLStreamWriter2.prototype.processingInstruction = function(node, options, level) {
return this.stream.write(XMLStreamWriter2.__super__.processingInstruction.call(this, node, options, level));
};
XMLStreamWriter2.prototype.raw = function(node, options, level) {
return this.stream.write(XMLStreamWriter2.__super__.raw.call(this, node, options, level));
};
XMLStreamWriter2.prototype.text = function(node, options, level) {
return this.stream.write(XMLStreamWriter2.__super__.text.call(this, node, options, level));
};
XMLStreamWriter2.prototype.dtdAttList = function(node, options, level) {
return this.stream.write(XMLStreamWriter2.__super__.dtdAttList.call(this, node, options, level));
};
XMLStreamWriter2.prototype.dtdElement = function(node, options, level) {
return this.stream.write(XMLStreamWriter2.__super__.dtdElement.call(this, node, options, level));
};
XMLStreamWriter2.prototype.dtdEntity = function(node, options, level) {
return this.stream.write(XMLStreamWriter2.__super__.dtdEntity.call(this, node, options, level));
};
XMLStreamWriter2.prototype.dtdNotation = function(node, options, level) {
return this.stream.write(XMLStreamWriter2.__super__.dtdNotation.call(this, node, options, level));
};
return XMLStreamWriter2;
}(XMLWriterBase);
}).call(exports);
});
// node_modules/xmlbuilder/lib/index.js
var require_lib = __commonJS((exports, module) => {
(function() {
var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
ref = require_Utility(), assign = ref.assign, isFunction = ref.isFunction;
XMLDOMImplementation = require_XMLDOMImplementation();
XMLDocument = require_XMLDocument();
XMLDocumentCB = require_XMLDocumentCB();
XMLStringWriter = require_XMLStringWriter();
XMLStreamWriter = require_XMLStreamWriter();
NodeType = require_NodeType();
WriterState = require_WriterState();
exports.create = function(name, xmldec, doctype, options) {
var doc, root;
if (name == null) {
throw new Error("Root element needs a name.");
}
options = assign({}, xmldec, doctype, options);
doc = new XMLDocument(options);
root = doc.element(name);
if (!options.headless) {
doc.declaration(options);
if (options.pubID != null || options.sysID != null) {
doc.dtd(options);
}
}
return root;
};
exports.begin = function(options, onData, onEnd) {
var ref1;
if (isFunction(options)) {
ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
options = {};
}
if (onData) {
return new XMLDocumentCB(options, onData, onEnd);
} else {
return new XMLDocument(options);
}
};
exports.stringWriter = function(options) {
return new XMLStringWriter(options);
};
exports.streamWriter = function(stream, options) {
return new XMLStreamWriter(stream, options);
};
exports.implementation = new XMLDOMImplementation;
exports.nodeType = NodeType;
exports.writerState = WriterState;
}).call(exports);
});
// node_modules/xml2js/lib/builder.js
var require_builder = __commonJS((exports) => {
(function() {
var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA, hasProp = {}.hasOwnProperty;
builder = require_lib();
defaults = require_defaults().defaults;
requiresCDATA = function(entry) {
return typeof entry === "string" && (entry.indexOf("&") >= 0 || entry.indexOf(">") >= 0 || entry.indexOf("<") >= 0);
};
wrapCDATA = function(entry) {
return "<![CDATA[" + escapeCDATA(entry) + "]]>";
};
escapeCDATA = function(entry) {
return entry.replace("]]>", "]]]]><![CDATA[>");
};
exports.Builder = function() {
function Builder(opts) {
var key, ref, value;
this.options = {};
ref = defaults["0.2"];
for (key in ref) {
if (!hasProp.call(ref, key))
continue;
value = ref[key];
this.options[key] = value;
}
for (key in opts) {
if (!hasProp.call(opts, key))
continue;
value = opts[key];
this.options[key] = value;
}
}
Builder.prototype.buildObject = function(rootObj) {
var attrkey, charkey, render, rootElement, rootName;
attrkey = this.options.attrkey;
charkey = this.options.charkey;
if (Object.keys(rootObj).length === 1 && this.options.rootName === defaults["0.2"].rootName) {
rootName = Object.keys(rootObj)[0];
rootObj = rootObj[rootName];
} else {
rootName = this.options.rootName;
}
render = function(_this) {
return function(element, obj) {
var attr, child, entry, index, key, value;
if (typeof obj !== "object") {
if (_this.options.cdata && requiresCDATA(obj)) {
element.raw(wrapCDATA(obj));
} else {
element.txt(obj);
}
} else if (Array.isArray(obj)) {
for (index in obj) {
if (!hasProp.call(obj, index))
continue;
child = obj[index];
for (key in child) {
entry = child[key];
element = render(element.ele(key), entry).up();
}
}
} else {
for (key in obj) {
if (!hasProp.call(obj, key))
continue;
child = obj[key];
if (key === attrkey) {
if (typeof child === "object") {
for (attr in child) {
value = child[attr];
element = element.att(attr, value);
}
}
} else if (key === charkey) {
if (_this.options.cdata && requiresCDATA(child)) {
element = element.raw(wrapCDATA(child));
} else {
element = element.txt(child);
}
} else if (Array.isArray(child)) {
for (index in child) {
if (!hasProp.call(child, index))
continue;
entry = child[index];
if (typeof entry === "string") {
if (_this.options.cdata && requiresCDATA(entry)) {
element = element.ele(key).raw(wrapCDATA(entry)).up();
} else {
element = element.ele(key, entry).up();
}
} else {
element = render(element.ele(key), entry).up();
}
}
} else if (typeof child === "object") {
element = render(element.ele(key), child).up();
} else {
if (typeof child === "string" && _this.options.cdata && requiresCDATA(child)) {
element = element.ele(key).raw(wrapCDATA(child)).up();
} else {
if (child == null) {
child = "";
}
element = element.ele(key, child.toString()).up();
}
}
}
}
return element;
};
}(this);
rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {
headless: this.options.headless,
allowSurrogateChars: this.options.allowSurrogateChars
});
return render(rootElement, rootObj).end(this.options.renderOpts);
};
return Builder;
}();
}).call(exports);
});
// node_modules/sax/lib/sax.js
var require_sax = __commonJS((exports) => {
(function(sax) {
sax.parser = function(strict, opt) {
return new SAXParser(strict, opt);
};
sax.SAXParser = SAXParser;
sax.SAXStream = SAXStream;
sax.createStream = createStream;
sax.MAX_BUFFER_LENGTH = 64 * 1024;
var buffers = [
"comment",
"sgmlDecl",
"textNode",
"tagName",
"doctype",
"procInstName",
"procInstBody",
"entity",
"attribName",
"attribValue",
"cdata",
"script"
];
sax.EVENTS = [
"text",
"processinginstruction",
"sgmldeclaration",
"doctype",
"comment",
"opentagstart",
"attribute",
"opentag",
"closetag",
"opencdata",
"cdata",
"closecdata",
"error",
"end",
"ready",
"script",
"opennamespace",
"closenamespace"
];
function SAXParser(strict, opt) {
if (!(this instanceof SAXParser)) {
return new SAXParser(strict, opt);
}
var parser = this;
clearBuffers(parser);
parser.q = parser.c = "";
parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH;
parser.opt = opt || {};
parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags;
parser.looseCase = parser.opt.lowercase ? "toLowerCase" : "toUpperCase";
parser.tags = [];
parser.closed = parser.closedRoot = parser.sawRoot = false;
parser.tag = parser.error = null;
parser.strict = !!strict;
parser.noscript = !!(strict || parser.opt.noscript);
parser.state = S.BEGIN;
parser.strictEntities = parser.opt.strictEntities;
parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES);
parser.attribList = [];
if (parser.opt.xmlns) {
parser.ns = Object.create(rootNS);
}
if (parser.opt.unquotedAttributeValues === undefined) {
parser.opt.unquotedAttributeValues = !strict;
}
parser.trackPosition = parser.opt.position !== false;
if (parser.trackPosition) {
parser.position = parser.line = parser.column = 0;
}
emit(parser, "onready");
}
if (!Object.create) {
Object.create = function(o) {
function F() {}
F.prototype = o;
var newf = new F;
return newf;
};
}
if (!Object.keys) {
Object.keys = function(o) {
var a = [];
for (var i in o)
if (o.hasOwnProperty(i))
a.push(i);
return a;
};
}
function checkBufferLength(parser) {
var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10);
var maxActual = 0;
for (var i = 0, l = buffers.length;i < l; i++) {
var len = parser[buffers[i]].length;
if (len > maxAllowed) {
switch (buffers[i]) {
case "textNode":
closeText(parser);
break;
case "cdata":
emitNode(parser, "oncdata", parser.cdata);
parser.cdata = "";
break;
case "script":
emitNode(parser, "onscript", parser.script);
parser.script = "";
break;
default:
error(parser, "Max buffer length exceeded: " + buffers[i]);
}
}
maxActual = Math.max(maxActual, len);
}
var m = sax.MAX_BUFFER_LENGTH - maxActual;
parser.bufferCheckPosition = m + parser.position;
}
function clearBuffers(parser) {
for (var i = 0, l = buffers.length;i < l; i++) {
parser[buffers[i]] = "";
}
}
function flushBuffers(parser) {
closeText(parser);
if (parser.cdata !== "") {
emitNode(parser, "oncdata", parser.cdata);
parser.cdata = "";
}
if (parser.script !== "") {
emitNode(parser, "onscript", parser.script);
parser.script = "";
}
}
SAXParser.prototype = {
end: function() {
end(this);
},
write,
resume: function() {
this.error = null;
return this;
},
close: function() {
return this.write(null);
},
flush: function() {
flushBuffers(this);
}
};
var Stream;
try {
Stream = __require("stream").Stream;
} catch (ex) {
Stream = function() {};
}
if (!Stream)
Stream = function() {};
var streamWraps = sax.EVENTS.filter(function(ev) {
return ev !== "error" && ev !== "end";
});
function createStream(strict, opt) {
return new SAXStream(strict, opt);
}
function SAXStream(strict, opt) {
if (!(this instanceof SAXStream)) {
return new SAXStream(strict, opt);
}
Stream.apply(this);
this._parser = new SAXParser(strict, opt);
this.writable = true;
this.readable = true;
var me = this;
this._parser.onend = function() {
me.emit("end");
};
this._parser.onerror = function(er) {
me.emit("error", er);
me._parser.error = null;
};
this._decoder = null;
streamWraps.forEach(function(ev) {
Object.defineProperty(me, "on" + ev, {
get: function() {
return me._parser["on" + ev];
},
set: function(h) {
if (!h) {
me.removeAllListeners(ev);
me._parser["on" + ev] = h;
return h;
}
me.on(ev, h);
},
enumerable: true,
configurable: false
});
});
}
SAXStream.prototype = Object.create(Stream.prototype, {
constructor: {
value: SAXStream
}
});
SAXStream.prototype.write = function(data) {
if (typeof Buffer === "function" && typeof Buffer.isBuffer === "function" && Buffer.isBuffer(data)) {
if (!this._decoder) {
var SD = __require("string_decoder").StringDecoder;
this._decoder = new SD("utf8");
}
data = this._decoder.write(data);
}
this._parser.write(data.toString());
this.emit("data", data);
return true;
};
SAXStream.prototype.end = function(chunk) {
if (chunk && chunk.length) {
this.write(chunk);
}
this._parser.end();
return true;
};
SAXStream.prototype.on = function(ev, handler) {
var me = this;
if (!me._parser["on" + ev] && streamWraps.indexOf(ev) !== -1) {
me._parser["on" + ev] = function() {
var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
args.splice(0, 0, ev);
me.emit.apply(me, args);
};
}
return Stream.prototype.on.call(me, ev, handler);
};
var CDATA = "[CDATA[";
var DOCTYPE = "DOCTYPE";
var XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
var XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE };
var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
function isWhitespace(c) {
return c === " " || c === `
` || c === "\r" || c === "\t";
}
function isQuote(c) {
return c === '"' || c === "'";
}
function isAttribEnd(c) {
return c === ">" || isWhitespace(c);
}
function isMatch(regex, c) {
return regex.test(c);
}
function notMatch(regex, c) {
return !isMatch(regex, c);
}
var S = 0;
sax.STATE = {
BEGIN: S++,
BEGIN_WHITESPACE: S++,
TEXT: S++,
TEXT_ENTITY: S++,
OPEN_WAKA: S++,
SGML_DECL: S++,
SGML_DECL_QUOTED: S++,
DOCTYPE: S++,
DOCTYPE_QUOTED: S++,
DOCTYPE_DTD: S++,
DOCTYPE_DTD_QUOTED: S++,
COMMENT_STARTING: S++,
COMMENT: S++,
COMMENT_ENDING: S++,
COMMENT_ENDED: S++,
CDATA: S++,
CDATA_ENDING: S++,
CDATA_ENDING_2: S++,
PROC_INST: S++,
PROC_INST_BODY: S++,
PROC_INST_ENDING: S++,
OPEN_TAG: S++,
OPEN_TAG_SLASH: S++,
ATTRIB: S++,
ATTRIB_NAME: S++,
ATTRIB_NAME_SAW_WHITE: S++,
ATTRIB_VALUE: S++,
ATTRIB_VALUE_QUOTED: S++,
ATTRIB_VALUE_CLOSED: S++,
ATTRIB_VALUE_UNQUOTED: S++,
ATTRIB_VALUE_ENTITY_Q: S++,
ATTRIB_VALUE_ENTITY_U: S++,
CLOSE_TAG: S++,
CLOSE_TAG_SAW_WHITE: S++,
SCRIPT: S++,
SCRIPT_ENDING: S++
};
sax.XML_ENTITIES = {
amp: "&",
gt: ">",
lt: "<",
quot: '"',
apos: "'"
};
sax.ENTITIES = {
amp: "&",
gt: ">",
lt: "<",
quot: '"',
apos: "'",
AElig: 198,
Aacute: 193,
Acirc: 194,
Agrave: 192,
Aring: 197,
Atilde: 195,
Auml: 196,
Ccedil: 199,
ETH: 208,
Eacute: 201,
Ecirc: 202,
Egrave: 200,
Euml: 203,
Iacute: 205,
Icirc: 206,
Igrave: 204,
Iuml: 207,
Ntilde: 209,
Oacute: 211,
Ocirc: 212,
Ograve: 210,
Oslash: 216,
Otilde: 213,
Ouml: 214,
THORN: 222,
Uacute: 218,
Ucirc: 219,
Ugrave: 217,
Uuml: 220,
Yacute: 221,
aacute: 225,
acirc: 226,
aelig: 230,
agrave: 224,
aring: 229,
atilde: 227,
auml: 228,
ccedil: 231,
eacute: 233,
ecirc: 234,
egrave: 232,
eth: 240,
euml: 235,
iacute: 237,
icirc: 238,
igrave: 236,
iuml: 239,
ntilde: 241,
oacute: 243,
ocirc: 244,
ograve: 242,
oslash: 248,
otilde: 245,
ouml: 246,
szlig: 223,
thorn: 254,
uacute: 250,
ucirc: 251,
ugrave: 249,
uuml: 252,
yacute: 253,
yuml: 255,
copy: 169,
reg: 174,
nbsp: 160,
iexcl: 161,
cent: 162,
pound: 163,
curren: 164,
yen: 165,
brvbar: 166,
sect: 167,
uml: 168,
ordf: 170,
laquo: 171,
not: 172,
shy: 173,
macr: 175,
deg: 176,
plusmn: 177,
sup1: 185,
sup2: 178,
sup3: 179,
acute: 180,
micro: 181,
para: 182,
middot: 183,
cedil: 184,
ordm: 186,
raquo: 187,
frac14: 188,
frac12: 189,
frac34: 190,
iquest: 191,
times: 215,
divide: 247,
OElig: 338,
oelig: 339,
Scaron: 352,
scaron: 353,
Yuml: 376,
fnof: 402,
circ: 710,
tilde: 732,
Alpha: 913,
Beta: 914,
Gamma: 915,
Delta: 916,
Epsilon: 917,
Zeta: 918,
Eta: 919,
Theta: 920,
Iota: 921,
Kappa: 922,
Lambda: 923,
Mu: 924,
Nu: 925,
Xi: 926,
Omicron: 927,
Pi: 928,
Rho: 929,
Sigma: 931,
Tau: 932,
Upsilon: 933,
Phi: 934,
Chi: 935,
Psi: 936,
Omega: 937,
alpha: 945,
beta: 946,
gamma: 947,
delta: 948,
epsilon: 949,
zeta: 950,
eta: 951,
theta: 952,
iota: 953,
kappa: 954,
lambda: 955,
mu: 956,
nu: 957,
xi: 958,
omicron: 959,
pi: 960,
rho: 961,
sigmaf: 962,
sigma: 963,
tau: 964,
upsilon: 965,
phi: 966,
chi: 967,
psi: 968,
omega: 969,
thetasym: 977,
upsih: 978,
piv: 982,
ensp: 8194,
emsp: 8195,
thinsp: 8201,
zwnj: 8204,
zwj: 8205,
lrm: 8206,
rlm: 8207,
ndash: 8211,
mdash: 8212,
lsquo: 8216,
rsquo: 8217,
sbquo: 8218,
ldquo: 8220,
rdquo: 8221,
bdquo: 8222,
dagger: 8224,
Dagger: 8225,
bull: 8226,
hellip: 8230,
permil: 8240,
prime: 8242,
Prime: 8243,
lsaquo: 8249,
rsaquo: 8250,
oline: 8254,
frasl: 8260,
euro: 8364,
image: 8465,
weierp: 8472,
real: 8476,
trade: 8482,
alefsym: 8501,
larr: 8592,
uarr: 8593,
rarr: 8594,
darr: 8595,
harr: 8596,
crarr: 8629,
lArr: 8656,
uArr: 8657,
rArr: 8658,
dArr: 8659,
hArr: 8660,
forall: 8704,
part: 8706,
exist: 8707,
empty: 8709,
nabla: 8711,
isin: 8712,
notin: 8713,
ni: 8715,
prod: 8719,
sum: 8721,
minus: 8722,
lowast: 8727,
radic: 8730,
prop: 8733,
infin: 8734,
ang: 8736,
and: 8743,
or: 8744,
cap: 8745,
cup: 8746,
int: 8747,
there4: 8756,
sim: 8764,
cong: 8773,
asymp: 8776,
ne: 8800,
equiv: 8801,
le: 8804,
ge: 8805,
sub: 8834,
sup: 8835,
nsub: 8836,
sube: 8838,
supe: 8839,
oplus: 8853,
otimes: 8855,
perp: 8869,
sdot: 8901,
lceil: 8968,
rceil: 8969,
lfloor: 8970,
rfloor: 8971,
lang: 9001,
rang: 9002,
loz: 9674,
spades: 9824,
clubs: 9827,
hearts: 9829,
diams: 9830
};
Object.keys(sax.ENTITIES).forEach(function(key) {
var e = sax.ENTITIES[key];
var s2 = typeof e === "number" ? String.fromCharCode(e) : e;
sax.ENTITIES[key] = s2;
});
for (var s in sax.STATE) {
sax.STATE[sax.STATE[s]] = s;
}
S = sax.STATE;
function emit(parser, event, data) {
parser[event] && parser[event](data);
}
function emitNode(parser, nodeType, data) {
if (parser.textNode)
closeText(parser);
emit(parser, nodeType, data);
}
function closeText(parser) {
parser.textNode = textopts(parser.opt, parser.textNode);
if (parser.textNode)
emit(parser, "ontext", parser.textNode);
parser.textNode = "";
}
function textopts(opt, text) {
if (opt.trim)
text = text.trim();
if (opt.normalize)
text = text.replace(/\s+/g, " ");
return text;
}
function error(parser, er) {
closeText(parser);
if (parser.trackPosition) {
er += `
Line: ` + parser.line + `
Column: ` + parser.column + `
Char: ` + parser.c;
}
er = new Error(er);
parser.error = er;
emit(parser, "onerror", er);
return parser;
}
function end(parser) {
if (parser.sawRoot && !parser.closedRoot)
strictFail(parser, "Unclosed root tag");
if (parser.state !== S.BEGIN && parser.state !== S.BEGIN_WHITESPACE && parser.state !== S.TEXT) {
error(parser, "Unexpected end");
}
closeText(parser);
parser.c = "";
parser.closed = true;
emit(parser, "onend");
SAXParser.call(parser, parser.strict, parser.opt);
return parser;
}
function strictFail(parser, message) {
if (typeof parser !== "object" || !(parser instanceof SAXParser)) {
throw new Error("bad call to strictFail");
}
if (parser.strict) {
error(parser, message);
}
}
function newTag(parser) {
if (!parser.strict)
parser.tagName = parser.tagName[parser.looseCase]();
var parent = parser.tags[parser.tags.length - 1] || parser;
var tag = parser.tag = { name: parser.tagName, attributes: {} };
if (parser.opt.xmlns) {
tag.ns = parent.ns;
}
parser.attribList.length = 0;
emitNode(parser, "onopentagstart", tag);
}
function qname(name, attribute) {
var i = name.indexOf(":");
var qualName = i < 0 ? ["", name] : name.split(":");
var prefix = qualName[0];
var local = qualName[1];
if (attribute && name === "xmlns") {
prefix = "xmlns";
local = "";
}
return { prefix, local };
}
function attrib(parser) {
if (!parser.strict) {
parser.attribName = parser.attribName[parser.looseCase]();
}
if (parser.attribList.indexOf(parser.attribName) !== -1 || parser.tag.attributes.hasOwnProperty(parser.attribName)) {
parser.attribName = parser.attribValue = "";
return;
}
if (parser.opt.xmlns) {
var qn = qname(parser.attribName, true);
var prefix = qn.prefix;
var local = qn.local;
if (prefix === "xmlns") {
if (local === "xml" && parser.attribValue !== XML_NAMESPACE) {
strictFail(parser, "xml: prefix must be bound to " + XML_NAMESPACE + `
` + "Actual: " + parser.attribValue);
} else if (local === "xmlns" && parser.attribValue !== XMLNS_NAMESPACE) {
strictFail(parser, "xmlns: prefix must be bound to " + XMLNS_NAMESPACE + `
` + "Actual: " + parser.attribValue);
} else {
var tag = parser.tag;
var parent = parser.tags[parser.tags.length - 1] || parser;
if (tag.ns === parent.ns) {
tag.ns = Object.create(parent.ns);
}
tag.ns[local] = parser.attribValue;
}
}
parser.attribList.push([parser.attribName, parser.attribValue]);
} else {
parser.tag.attributes[parser.attribName] = parser.attribValue;
emitNode(parser, "onattribute", {
name: parser.attribName,
value: parser.attribValue
});
}
parser.attribName = parser.attribValue = "";
}
function openTag(parser, selfClosing) {
if (parser.opt.xmlns) {
var tag = parser.tag;
var qn = qname(parser.tagName);
tag.prefix = qn.prefix;
tag.local = qn.local;
tag.uri = tag.ns[qn.prefix] || "";
if (tag.prefix && !tag.uri) {
strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(parser.tagName));
tag.uri = qn.prefix;
}
var parent = parser.tags[parser.tags.length - 1] || parser;
if (tag.ns && parent.ns !== tag.ns) {
Object.keys(tag.ns).forEach(function(p) {
emitNode(parser, "onopennamespace", {
prefix: p,
uri: tag.ns[p]
});
});
}
for (var i = 0, l = parser.attribList.length;i < l; i++) {
var nv = parser.attribList[i];
var name = nv[0];
var value = nv[1];
var qualName = qname(name, true);
var prefix = qualName.prefix;
var local = qualName.local;
var uri = prefix === "" ? "" : tag.ns[prefix] || "";
var a = {
name,
value,
prefix,
local,
uri
};
if (prefix && prefix !== "xmlns" && !uri) {
strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(prefix));
a.uri = prefix;
}
parser.tag.attributes[name] = a;
emitNode(parser, "onattribute", a);
}
parser.attribList.length = 0;
}
parser.tag.isSelfClosing = !!selfClosing;
parser.sawRoot = true;
parser.tags.push(parser.tag);
emitNode(parser, "onopentag", parser.tag);
if (!selfClosing) {
if (!parser.noscript && parser.tagName.toLowerCase() === "script") {
parser.state = S.SCRIPT;
} else {
parser.state = S.TEXT;
}
parser.tag = null;
parser.tagName = "";
}
parser.attribName = parser.attribValue = "";
parser.attribList.length = 0;
}
function closeTag(parser) {
if (!parser.tagName) {
strictFail(parser, "Weird empty close tag.");
parser.textNode += "</>";
parser.state = S.TEXT;
return;
}
if (parser.script) {
if (parser.tagName !== "script") {
parser.script += "</" + parser.tagName + ">";
parser.tagName = "";
parser.state = S.SCRIPT;
return;
}
emitNode(parser, "onscript", parser.script);
parser.script = "";
}
var t = parser.tags.length;
var tagName = parser.tagName;
if (!parser.strict) {
tagName = tagName[parser.looseCase]();
}
var closeTo = tagName;
while (t--) {
var close = parser.tags[t];
if (close.name !== closeTo) {
strictFail(parser, "Unexpected close tag");
} else {
break;
}
}
if (t < 0) {
strictFail(parser, "Unmatched closing tag: " + parser.tagName);
parser.textNode += "</" + parser.tagName + ">";
parser.state = S.TEXT;
return;
}
parser.tagName = tagName;
var s2 = parser.tags.length;
while (s2-- > t) {
var tag = parser.tag = parser.tags.pop();
parser.tagName = parser.tag.name;
emitNode(parser, "onclosetag", parser.tagName);
var x = {};
for (var i in tag.ns) {
x[i] = tag.ns[i];
}
var parent = parser.tags[parser.tags.length - 1] || parser;
if (parser.opt.xmlns && tag.ns !== parent.ns) {
Object.keys(tag.ns).forEach(function(p) {
var n = tag.ns[p];
emitNode(parser, "onclosenamespace", { prefix: p, uri: n });
});
}
}
if (t === 0)
parser.closedRoot = true;
parser.tagName = parser.attribValue = parser.attribName = "";
parser.attribList.length = 0;
parser.state = S.TEXT;
}
function parseEntity(parser) {
var entity = parser.entity;
var entityLC = entity.toLowerCase();
var num;
var numStr = "";
if (parser.ENTITIES[entity]) {
return parser.ENTITIES[entity];
}
if (parser.ENTITIES[entityLC]) {
return parser.ENTITIES[entityLC];
}
entity = entityLC;
if (entity.charAt(0) === "#") {
if (entity.charAt(1) === "x") {
entity = entity.slice(2);
num = parseInt(entity, 16);
numStr = num.toString(16);
} else {
entity = entity.slice(1);
num = parseInt(entity, 10);
numStr = num.toString(10);
}
}
entity = entity.replace(/^0+/, "");
if (isNaN(num) || numStr.toLowerCase() !== entity) {
strictFail(parser, "Invalid character entity");
return "&" + parser.entity + ";";
}
return String.fromCodePoint(num);
}
function beginWhiteSpace(parser, c) {
if (c === "<") {
parser.state = S.OPEN_WAKA;
parser.startTagPosition = parser.position;
} else if (!isWhitespace(c)) {
strictFail(parser, "Non-whitespace before first tag.");
parser.textNode = c;
parser.state = S.TEXT;
}
}
function charAt(chunk, i) {
var result = "";
if (i < chunk.length) {
result = chunk.charAt(i);
}
return result;
}
function write(chunk) {
var parser = this;
if (this.error) {
throw this.error;
}
if (parser.closed) {
return error(parser, "Cannot write after close. Assign an onready handler.");
}
if (chunk === null) {
return end(parser);
}
if (typeof chunk === "object") {
chunk = chunk.toString();
}
var i = 0;
var c = "";
while (true) {
c = charAt(chunk, i++);
parser.c = c;
if (!c) {
break;
}
if (parser.trackPosition) {
parser.position++;
if (c === `
`) {
parser.line++;
parser.column = 0;
} else {
parser.column++;
}
}
switch (parser.state) {
case S.BEGIN:
parser.state = S.BEGIN_WHITESPACE;
if (c === "\uFEFF") {
continue;
}
beginWhiteSpace(parser, c);
continue;
case S.BEGIN_WHITESPACE:
beginWhiteSpace(parser, c);
continue;
case S.TEXT:
if (parser.sawRoot && !parser.closedRoot) {
var starti = i - 1;
while (c && c !== "<" && c !== "&") {
c = charAt(chunk, i++);
if (c && parser.trackPosition) {
parser.position++;
if (c === `
`) {
parser.line++;
parser.column = 0;
} else {
parser.column++;
}
}
}
parser.textNode += chunk.substring(starti, i - 1);
}
if (c === "<" && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {
parser.state = S.OPEN_WAKA;
parser.startTagPosition = parser.position;
} else {
if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) {
strictFail(parser, "Text data outside of root node.");
}
if (c === "&") {
parser.state = S.TEXT_ENTITY;
} else {
parser.textNode += c;
}
}
continue;
case S.SCRIPT:
if (c === "<") {
parser.state = S.SCRIPT_ENDING;
} else {
parser.script += c;
}
continue;
case S.SCRIPT_ENDING:
if (c === "/") {
parser.state = S.CLOSE_TAG;
} else {
parser.script += "<" + c;
parser.state = S.SCRIPT;
}
continue;
case S.OPEN_WAKA:
if (c === "!") {
parser.state = S.SGML_DECL;
parser.sgmlDecl = "";
} else if (isWhitespace(c)) {} else if (isMatch(nameStart, c)) {
parser.state = S.OPEN_TAG;
parser.tagName = c;
} else if (c === "/") {
parser.state = S.CLOSE_TAG;
parser.tagName = "";
} else if (c === "?") {
parser.state = S.PROC_INST;
parser.procInstName = parser.procInstBody = "";
} else {
strictFail(parser, "Unencoded <");
if (parser.startTagPosition + 1 < parser.position) {
var pad = parser.position - parser.startTagPosition;
c = new Array(pad).join(" ") + c;
}
parser.textNode += "<" + c;
parser.state = S.TEXT;
}
continue;
case S.SGML_DECL:
if (parser.sgmlDecl + c === "--") {
parser.state = S.COMMENT;
parser.comment = "";
parser.sgmlDecl = "";
continue;
}
if (parser.doctype && parser.doctype !== true && parser.sgmlDecl) {
parser.state = S.DOCTYPE_DTD;
parser.doctype += "<!" + parser.sgmlDecl + c;
parser.sgmlDecl = "";
} else if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
emitNode(parser, "onopencdata");
parser.state = S.CDATA;
parser.sgmlDecl = "";
parser.cdata = "";
} else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
parser.state = S.DOCTYPE;
if (parser.doctype || parser.sawRoot) {
strictFail(parser, "Inappropriately located doctype declaration");
}
parser.doctype = "";
parser.sgmlDecl = "";
} else if (c === ">") {
emitNode(parser, "onsgmldeclaration", parser.sgmlDecl);
parser.sgmlDecl = "";
parser.state = S.TEXT;
} else if (isQuote(c)) {
parser.state = S.SGML_DECL_QUOTED;
parser.sgmlDecl += c;
} else {
parser.sgmlDecl += c;
}
continue;
case S.SGML_DECL_QUOTED:
if (c === parser.q) {
parser.state = S.SGML_DECL;
parser.q = "";
}
parser.sgmlDecl += c;
continue;
case S.DOCTYPE:
if (c === ">") {
parser.state = S.TEXT;
emitNode(parser, "ondoctype", parser.doctype);
parser.doctype = true;
} else {
parser.doctype += c;
if (c === "[") {
parser.state = S.DOCTYPE_DTD;
} else if (isQuote(c)) {
parser.state = S.DOCTYPE_QUOTED;
parser.q = c;
}
}
continue;
case S.DOCTYPE_QUOTED:
parser.doctype += c;
if (c === parser.q) {
parser.q = "";
parser.state = S.DOCTYPE;
}
continue;
case S.DOCTYPE_DTD:
if (c === "]") {
parser.doctype += c;
parser.state = S.DOCTYPE;
} else if (c === "<") {
parser.state = S.OPEN_WAKA;
parser.startTagPosition = parser.position;
} else if (isQuote(c)) {
parser.doctype += c;
parser.state = S.DOCTYPE_DTD_QUOTED;
parser.q = c;
} else {
parser.doctype += c;
}
continue;
case S.DOCTYPE_DTD_QUOTED:
parser.doctype += c;
if (c === parser.q) {
parser.state = S.DOCTYPE_DTD;
parser.q = "";
}
continue;
case S.COMMENT:
if (c === "-") {
parser.state = S.COMMENT_ENDING;
} else {
parser.comment += c;
}
continue;
case S.COMMENT_ENDING:
if (c === "-") {
parser.state = S.COMMENT_ENDED;
parser.comment = textopts(parser.opt, parser.comment);
if (parser.comment) {
emitNode(parser, "oncomment", parser.comment);
}
parser.comment = "";
} else {
parser.comment += "-" + c;
parser.state = S.COMMENT;
}
continue;
case S.COMMENT_ENDED:
if (c !== ">") {
strictFail(parser, "Malformed comment");
parser.comment += "--" + c;
parser.state = S.COMMENT;
} else if (parser.doctype && parser.doctype !== true) {
parser.state = S.DOCTYPE_DTD;
} else {
parser.state = S.TEXT;
}
continue;
case S.CDATA:
if (c === "]") {
parser.state = S.CDATA_ENDING;
} else {
parser.cdata += c;
}
continue;
case S.CDATA_ENDING:
if (c === "]") {
parser.state = S.CDATA_ENDING_2;
} else {
parser.cdata += "]" + c;
parser.state = S.CDATA;
}
continue;
case S.CDATA_ENDING_2:
if (c === ">") {
if (parser.cdata) {
emitNode(parser, "oncdata", parser.cdata);
}
emitNode(parser, "onclosecdata");
parser.cdata = "";
parser.state = S.TEXT;
} else if (c === "]") {
parser.cdata += "]";
} else {
parser.cdata += "]]" + c;
parser.state = S.CDATA;
}
continue;
case S.PROC_INST:
if (c === "?") {
parser.state = S.PROC_INST_ENDING;
} else if (isWhitespace(c)) {
parser.state = S.PROC_INST_BODY;
} else {
parser.procInstName += c;
}
continue;
case S.PROC_INST_BODY:
if (!parser.procInstBody && isWhitespace(c)) {
continue;
} else if (c === "?") {
parser.state = S.PROC_INST_ENDING;
} else {
parser.procInstBody += c;
}
continue;
case S.PROC_INST_ENDING:
if (c === ">") {
emitNode(parser, "onprocessinginstruction", {
name: parser.procInstName,
body: parser.procInstBody
});
parser.procInstName = parser.procInstBody = "";
parser.state = S.TEXT;
} else {
parser.procInstBody += "?" + c;
parser.state = S.PROC_INST_BODY;
}
continue;
case S.OPEN_TAG:
if (isMatch(nameBody, c)) {
parser.tagName += c;
} else {
newTag(parser);
if (c === ">") {
openTag(parser);
} else if (c === "/") {
parser.state = S.OPEN_TAG_SLASH;
} else {
if (!isWhitespace(c)) {
strictFail(parser, "Invalid character in tag name");
}
parser.state = S.ATTRIB;
}
}
continue;
case S.OPEN_TAG_SLASH:
if (c === ">") {
openTag(parser, true);
closeTag(parser);
} else {
strictFail(parser, "Forward-slash in opening tag not followed by >");
parser.state = S.ATTRIB;
}
continue;
case S.ATTRIB:
if (isWhitespace(c)) {
continue;
} else if (c === ">") {
openTag(parser);
} else if (c === "/") {
parser.state = S.OPEN_TAG_SLASH;
} else if (isMatch(nameStart, c)) {
parser.attribName = c;
parser.attribValue = "";
parser.state = S.ATTRIB_NAME;
} else {
strictFail(parser, "Invalid attribute name");
}
continue;
case S.ATTRIB_NAME:
if (c === "=") {
parser.state = S.ATTRIB_VALUE;
} else if (c === ">") {
strictFail(parser, "Attribute without value");
parser.attribValue = parser.attribName;
attrib(parser);
openTag(parser);
} else if (isWhitespace(c)) {
parser.state = S.ATTRIB_NAME_SAW_WHITE;
} else if (isMatch(nameBody, c)) {
parser.attribName += c;
} else {
strictFail(parser, "Invalid attribute name");
}
continue;
case S.ATTRIB_NAME_SAW_WHITE:
if (c === "=") {
parser.state = S.ATTRIB_VALUE;
} else if (isWhitespace(c)) {
continue;
} else {
strictFail(parser, "Attribute without value");
parser.tag.attributes[parser.attribName] = "";
parser.attribValue = "";
emitNode(parser, "onattribute", {
name: parser.attribName,
value: ""
});
parser.attribName = "";
if (c === ">") {
openTag(parser);
} else if (isMatch(nameStart, c)) {
parser.attribName = c;
parser.state = S.ATTRIB_NAME;
} else {
strictFail(parser, "Invalid attribute name");
parser.state = S.ATTRIB;
}
}
continue;
case S.ATTRIB_VALUE:
if (isWhitespace(c)) {
continue;
} else if (isQuote(c)) {
parser.q = c;
parser.state = S.ATTRIB_VALUE_QUOTED;
} else {
if (!parser.opt.unquotedAttributeValues) {
error(parser, "Unquoted attribute value");
}
parser.state = S.ATTRIB_VALUE_UNQUOTED;
parser.attribValue = c;
}
continue;
case S.ATTRIB_VALUE_QUOTED:
if (c !== parser.q) {
if (c === "&") {
parser.state = S.ATTRIB_VALUE_ENTITY_Q;
} else {
parser.attribValue += c;
}
continue;
}
attrib(parser);
parser.q = "";
parser.state = S.ATTRIB_VALUE_CLOSED;
continue;
case S.ATTRIB_VALUE_CLOSED:
if (isWhitespace(c)) {
parser.state = S.ATTRIB;
} else if (c === ">") {
openTag(parser);
} else if (c === "/") {
parser.state = S.OPEN_TAG_SLASH;
} else if (isMatch(nameStart, c)) {
strictFail(parser, "No whitespace between attributes");
parser.attribName = c;
parser.attribValue = "";
parser.state = S.ATTRIB_NAME;
} else {
strictFail(parser, "Invalid attribute name");
}
continue;
case S.ATTRIB_VALUE_UNQUOTED:
if (!isAttribEnd(c)) {
if (c === "&") {
parser.state = S.ATTRIB_VALUE_ENTITY_U;
} else {
parser.attribValue += c;
}
continue;
}
attrib(parser);
if (c === ">") {
openTag(parser);
} else {
parser.state = S.ATTRIB;
}
continue;
case S.CLOSE_TAG:
if (!parser.tagName) {
if (isWhitespace(c)) {
continue;
} else if (notMatch(nameStart, c)) {
if (parser.script) {
parser.script += "</" + c;
parser.state = S.SCRIPT;
} else {
strictFail(parser, "Invalid tagname in closing tag.");
}
} else {
parser.tagName = c;
}
} else if (c === ">") {
closeTag(parser);
} else if (isMatch(nameBody, c)) {
parser.tagName += c;
} else if (parser.script) {
parser.script += "</" + parser.tagName;
parser.tagName = "";
parser.state = S.SCRIPT;
} else {
if (!isWhitespace(c)) {
strictFail(parser, "Invalid tagname in closing tag");
}
parser.state = S.CLOSE_TAG_SAW_WHITE;
}
continue;
case S.CLOSE_TAG_SAW_WHITE:
if (isWhitespace(c)) {
continue;
}
if (c === ">") {
closeTag(parser);
} else {
strictFail(parser, "Invalid characters in closing tag");
}
continue;
case S.TEXT_ENTITY:
case S.ATTRIB_VALUE_ENTITY_Q:
case S.ATTRIB_VALUE_ENTITY_U:
var returnState;
var buffer;
switch (parser.state) {
case S.TEXT_ENTITY:
returnState = S.TEXT;
buffer = "textNode";
break;
case S.ATTRIB_VALUE_ENTITY_Q:
returnState = S.ATTRIB_VALUE_QUOTED;
buffer = "attribValue";
break;
case S.ATTRIB_VALUE_ENTITY_U:
returnState = S.ATTRIB_VALUE_UNQUOTED;
buffer = "attribValue";
break;
}
if (c === ";") {
var parsedEntity = parseEntity(parser);
if (parser.opt.unparsedEntities && !Object.values(sax.XML_ENTITIES).includes(parsedEntity)) {
parser.entity = "";
parser.state = returnState;
parser.write(parsedEntity);
} else {
parser[buffer] += parsedEntity;
parser.entity = "";
parser.state = returnState;
}
} else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
parser.entity += c;
} else {
strictFail(parser, "Invalid character in entity name");
parser[buffer] += "&" + parser.entity + c;
parser.entity = "";
parser.state = returnState;
}
continue;
default: {
throw new Error(parser, "Unknown state: " + parser.state);
}
}
}
if (parser.position >= parser.bufferCheckPosition) {
checkBufferLength(parser);
}
return parser;
}
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
if (!String.fromCodePoint) {
(function() {
var stringFromCharCode = String.fromCharCode;
var floor = Math.floor;
var fromCodePoint = function() {
var MAX_SIZE = 16384;
var codeUnits = [];
var highSurrogate;
var lowSurrogate;
var index = -1;
var length = arguments.length;
if (!length) {
return "";
}
var result = "";
while (++index < length) {
var codePoint = Number(arguments[index]);
if (!isFinite(codePoint) || codePoint < 0 || codePoint > 1114111 || floor(codePoint) !== codePoint) {
throw RangeError("Invalid code point: " + codePoint);
}
if (codePoint <= 65535) {
codeUnits.push(codePoint);
} else {
codePoint -= 65536;
highSurrogate = (codePoint >> 10) + 55296;
lowSurrogate = codePoint % 1024 + 56320;
codeUnits.push(highSurrogate, lowSurrogate);
}
if (index + 1 === length || codeUnits.length > MAX_SIZE) {
result += stringFromCharCode.apply(null, codeUnits);
codeUnits.length = 0;
}
}
return result;
};
if (Object.defineProperty) {
Object.defineProperty(String, "fromCodePoint", {
value: fromCodePoint,
configurable: true,
writable: true
});
} else {
String.fromCodePoint = fromCodePoint;
}
})();
}
})(typeof exports === "undefined" ? exports.sax = {} : exports);
});
// node_modules/xml2js/lib/bom.js
var require_bom = __commonJS((exports) => {
(function() {
exports.stripBOM = function(str) {
if (str[0] === "\uFEFF") {
return str.substring(1);
} else {
return str;
}
};
}).call(exports);
});
// node_modules/xml2js/lib/processors.js
var require_processors = __commonJS((exports) => {
(function() {
var prefixMatch;
prefixMatch = new RegExp(/(?!xmlns)^.*:/);
exports.normalize = function(str) {
return str.toLowerCase();
};
exports.firstCharLowerCase = function(str) {
return str.charAt(0).toLowerCase() + str.slice(1);
};
exports.stripPrefix = function(str) {
return str.replace(prefixMatch, "");
};
exports.parseNumbers = function(str) {
if (!isNaN(str)) {
str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);
}
return str;
};
exports.parseBooleans = function(str) {
if (/^(?:true|false)$/i.test(str)) {
str = str.toLowerCase() === "true";
}
return str;
};
}).call(exports);
});
// node_modules/xml2js/lib/parser.js
var require_parser = __commonJS((exports) => {
(function() {
var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate2, bind = function(fn, me) {
return function() {
return fn.apply(me, arguments);
};
}, 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;
sax = require_sax();
events = __require("events");
bom = require_bom();
processors = require_processors();
setImmediate2 = __require("timers").setImmediate;
defaults = require_defaults().defaults;
isEmpty = function(thing) {
return typeof thing === "object" && thing != null && Object.keys(thing).length === 0;
};
processItem = function(processors2, item, key) {
var i, len, process2;
for (i = 0, len = processors2.length;i < len; i++) {
process2 = processors2[i];
item = process2(item, key);
}
return item;
};
exports.Parser = function(superClass) {
extend(Parser, superClass);
function Parser(opts) {
this.parseStringPromise = bind(this.parseStringPromise, this);
this.parseString = bind(this.parseString, this);
this.reset = bind(this.reset, this);
this.assignOrPush = bind(this.assignOrPush, this);
this.processAsync = bind(this.processAsync, this);
var key, ref, value;
if (!(this instanceof exports.Parser)) {
return new exports.Parser(opts);
}
this.options = {};
ref = defaults["0.2"];
for (key in ref) {
if (!hasProp.call(ref, key))
continue;
value = ref[key];
this.options[key] = value;
}
for (key in opts) {
if (!hasProp.call(opts, key))
continue;
value = opts[key];
this.options[key] = value;
}
if (this.options.xmlns) {
this.options.xmlnskey = this.options.attrkey + "ns";
}
if (this.options.normalizeTags) {
if (!this.options.tagNameProcessors) {
this.options.tagNameProcessors = [];
}
this.options.tagNameProcessors.unshift(processors.normalize);
}
this.reset();
}
Parser.prototype.processAsync = function() {
var chunk, err;
try {
if (this.remaining.length <= this.options.chunkSize) {
chunk = this.remaining;
this.remaining = "";
this.saxParser = this.saxParser.write(chunk);
return this.saxParser.close();
} else {
chunk = this.remaining.substr(0, this.options.chunkSize);
this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length);
this.saxParser = this.saxParser.write(chunk);
return setImmediate2(this.processAsync);
}
} catch (error1) {
err = error1;
if (!this.saxParser.errThrown) {
this.saxParser.errThrown = true;
return this.emit(err);
}
}
};
Parser.prototype.assignOrPush = function(obj, key, newValue) {
if (!(key in obj)) {
if (!this.options.explicitArray) {
return obj[key] = newValue;
} else {
return obj[key] = [newValue];
}
} else {
if (!(obj[key] instanceof Array)) {
obj[key] = [obj[key]];
}
return obj[key].push(newValue);
}
};
Parser.prototype.reset = function() {
var attrkey, charkey, ontext, stack;
this.removeAllListeners();
this.saxParser = sax.parser(this.options.strict, {
trim: false,
normalize: false,
xmlns: this.options.xmlns
});
this.saxParser.errThrown = false;
this.saxParser.onerror = function(_this) {
return function(error) {
_this.saxParser.resume();
if (!_this.saxParser.errThrown) {
_this.saxParser.errThrown = true;
return _this.emit("error", error);
}
};
}(this);
this.saxParser.onend = function(_this) {
return function() {
if (!_this.saxParser.ended) {
_this.saxParser.ended = true;
return _this.emit("end", _this.resultObject);
}
};
}(this);
this.saxParser.ended = false;
this.EXPLICIT_CHARKEY = this.options.explicitCharkey;
this.resultObject = null;
stack = [];
attrkey = this.options.attrkey;
charkey = this.options.charkey;
this.saxParser.onopentag = function(_this) {
return function(node) {
var key, newValue, obj, processedKey, ref;
obj = Object.create(null);
obj[charkey] = "";
if (!_this.options.ignoreAttrs) {
ref = node.attributes;
for (key in ref) {
if (!hasProp.call(ref, key))
continue;
if (!(attrkey in obj) && !_this.options.mergeAttrs) {
obj[attrkey] = Object.create(null);
}
newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
if (_this.options.mergeAttrs) {
_this.assignOrPush(obj, processedKey, newValue);
} else {
obj[attrkey][processedKey] = newValue;
}
}
}
obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name;
if (_this.options.xmlns) {
obj[_this.options.xmlnskey] = {
uri: node.uri,
local: node.local
};
}
return stack.push(obj);
};
}(this);
this.saxParser.onclosetag = function(_this) {
return function() {
var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;
obj = stack.pop();
nodeName = obj["#name"];
if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) {
delete obj["#name"];
}
if (obj.cdata === true) {
cdata = obj.cdata;
delete obj.cdata;
}
s = stack[stack.length - 1];
if (obj[charkey].match(/^\s*$/) && !cdata) {
emptyStr = obj[charkey];
delete obj[charkey];
} else {
if (_this.options.trim) {
obj[charkey] = obj[charkey].trim();
}
if (_this.options.normalize) {
obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim();
}
obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey];
if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
obj = obj[charkey];
}
}
if (isEmpty(obj)) {
if (typeof _this.options.emptyTag === "function") {
obj = _this.options.emptyTag();
} else {
obj = _this.options.emptyTag !== "" ? _this.options.emptyTag : emptyStr;
}
}
if (_this.options.validator != null) {
xpath = "/" + function() {
var i, len, results;
results = [];
for (i = 0, len = stack.length;i < len; i++) {
node = stack[i];
results.push(node["#name"]);
}
return results;
}().concat(nodeName).join("/");
(function() {
var err;
try {
return obj = _this.options.validator(xpath, s && s[nodeName], obj);
} catch (error1) {
err = error1;
return _this.emit("error", err);
}
})();
}
if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === "object") {
if (!_this.options.preserveChildrenOrder) {
node = Object.create(null);
if (_this.options.attrkey in obj) {
node[_this.options.attrkey] = obj[_this.options.attrkey];
delete obj[_this.options.attrkey];
}
if (!_this.options.charsAsChildren && _this.options.charkey in obj) {
node[_this.options.charkey] = obj[_this.options.charkey];
delete obj[_this.options.charkey];
}
if (Object.getOwnPropertyNames(obj).length > 0) {
node[_this.options.childkey] = obj;
}
obj = node;
} else if (s) {
s[_this.options.childkey] = s[_this.options.childkey] || [];
objClone = Object.create(null);
for (key in obj) {
if (!hasProp.call(obj, key))
continue;
objClone[key] = obj[key];
}
s[_this.options.childkey].push(objClone);
delete obj["#name"];
if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
obj = obj[charkey];
}
}
}
if (stack.length > 0) {
return _this.assignOrPush(s, nodeName, obj);
} else {
if (_this.options.explicitRoot) {
old = obj;
obj = Object.create(null);
obj[nodeName] = old;
}
_this.resultObject = obj;
_this.saxParser.ended = true;
return _this.emit("end", _this.resultObject);
}
};
}(this);
ontext = function(_this) {
return function(text) {
var charChild, s;
s = stack[stack.length - 1];
if (s) {
s[charkey] += text;
if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, "").trim() !== "")) {
s[_this.options.childkey] = s[_this.options.childkey] || [];
charChild = {
"#name": "__text__"
};
charChild[charkey] = text;
if (_this.options.normalize) {
charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim();
}
s[_this.options.childkey].push(charChild);
}
return s;
}
};
}(this);
this.saxParser.ontext = ontext;
return this.saxParser.oncdata = function(_this) {
return function(text) {
var s;
s = ontext(text);
if (s) {
return s.cdata = true;
}
};
}(this);
};
Parser.prototype.parseString = function(str, cb) {
var err;
if (cb != null && typeof cb === "function") {
this.on("end", function(result) {
this.reset();
return cb(null, result);
});
this.on("error", function(err2) {
this.reset();
return cb(err2);
});
}
try {
str = str.toString();
if (str.trim() === "") {
this.emit("end", null);
return true;
}
str = bom.stripBOM(str);
if (this.options.async) {
this.remaining = str;
setImmediate2(this.processAsync);
return this.saxParser;
}
return this.saxParser.write(str).close();
} catch (error1) {
err = error1;
if (!(this.saxParser.errThrown || this.saxParser.ended)) {
this.emit("error", err);
return this.saxParser.errThrown = true;
} else if (this.saxParser.ended) {
throw err;
}
}
};
Parser.prototype.parseStringPromise = function(str) {
return new Promise(function(_this) {
return function(resolve, reject) {
return _this.parseString(str, function(err, value) {
if (err) {
return reject(err);
} else {
return resolve(value);
}
});
};
}(this));
};
return Parser;
}(events);
exports.parseString = function(str, a, b) {
var cb, options, parser;
if (b != null) {
if (typeof b === "function") {
cb = b;
}
if (typeof a === "object") {
options = a;
}
} else {
if (typeof a === "function") {
cb = a;
}
options = {};
}
parser = new exports.Parser(options);
return parser.parseString(str, cb);
};
exports.parseStringPromise = function(str, a) {
var options, parser;
if (typeof a === "object") {
options = a;
}
parser = new exports.Parser(options);
return parser.parseStringPromise(str);
};
}).call(exports);
});
// node_modules/xml2js/lib/xml2js.js
var require_xml2js = __commonJS((exports) => {
(function() {
var builder, defaults, parser, processors, 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;
defaults = require_defaults();
builder = require_builder();
parser = require_parser();
processors = require_processors();
exports.defaults = defaults.defaults;
exports.processors = processors;
exports.ValidationError = function(superClass) {
extend(ValidationError, superClass);
function ValidationError(message) {
this.message = message;
}
return ValidationError;
}(Error);
exports.Builder = builder.Builder;
exports.Parser = parser.Parser;
exports.parseString = parser.parseString;
exports.parseStringPromise = parser.parseStringPromise;
}).call(exports);
});
// node_modules/readable-stream/lib/internal/streams/buffer_list.js
var require_buffer_list = __commonJS((exports, module) => {
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread(target) {
for (var i = 1;i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0;i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor)
descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null)
return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object")
return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
var _require = __require("buffer");
var Buffer2 = _require.Buffer;
var _require2 = __require("util");
var inspect = _require2.inspect;
var custom = inspect && inspect.custom || "inspect";
function copyBuffer(src, target, offset) {
Buffer2.prototype.copy.call(src, target, offset);
}
module.exports = /* @__PURE__ */ function() {
function BufferList() {
_classCallCheck(this, BufferList);
this.head = null;
this.tail = null;
this.length = 0;
}
_createClass(BufferList, [{
key: "push",
value: function push(v) {
var entry = {
data: v,
next: null
};
if (this.length > 0)
this.tail.next = entry;
else
this.head = entry;
this.tail = entry;
++this.length;
}
}, {
key: "unshift",
value: function unshift(v) {
var entry = {
data: v,
next: this.head
};
if (this.length === 0)
this.tail = entry;
this.head = entry;
++this.length;
}
}, {
key: "shift",
value: function shift() {
if (this.length === 0)
return;
var ret = this.head.data;
if (this.length === 1)
this.head = this.tail = null;
else
this.head = this.head.next;
--this.length;
return ret;
}
}, {
key: "clear",
value: function clear() {
this.head = this.tail = null;
this.length = 0;
}
}, {
key: "join",
value: function join(s) {
if (this.length === 0)
return "";
var p = this.head;
var ret = "" + p.data;
while (p = p.next)
ret += s + p.data;
return ret;
}
}, {
key: "concat",
value: function concat(n) {
if (this.length === 0)
return Buffer2.alloc(0);
var ret = Buffer2.allocUnsafe(n >>> 0);
var p = this.head;
var i = 0;
while (p) {
copyBuffer(p.data, ret, i);
i += p.data.length;
p = p.next;
}
return ret;
}
}, {
key: "consume",
value: function consume(n, hasStrings) {
var ret;
if (n < this.head.data.length) {
ret = this.head.data.slice(0, n);
this.head.data = this.head.data.slice(n);
} else if (n === this.head.data.length) {
ret = this.shift();
} else {
ret = hasStrings ? this._getString(n) : this._getBuffer(n);
}
return ret;
}
}, {
key: "first",
value: function first() {
return this.head.data;
}
}, {
key: "_getString",
value: function _getString(n) {
var p = this.head;
var c = 1;
var ret = p.data;
n -= ret.length;
while (p = p.next) {
var str = p.data;
var nb = n > str.length ? str.length : n;
if (nb === str.length)
ret += str;
else
ret += str.slice(0, n);
n -= nb;
if (n === 0) {
if (nb === str.length) {
++c;
if (p.next)
this.head = p.next;
else
this.head = this.tail = null;
} else {
this.head = p;
p.data = str.slice(nb);
}
break;
}
++c;
}
this.length -= c;
return ret;
}
}, {
key: "_getBuffer",
value: function _getBuffer(n) {
var ret = Buffer2.allocUnsafe(n);
var p = this.head;
var c = 1;
p.data.copy(ret);
n -= p.data.length;
while (p = p.next) {
var buf = p.data;
var nb = n > buf.length ? buf.length : n;
buf.copy(ret, ret.length - n, 0, nb);
n -= nb;
if (n === 0) {
if (nb === buf.length) {
++c;
if (p.next)
this.head = p.next;
else
this.head = this.tail = null;
} else {
this.head = p;
p.data = buf.slice(nb);
}
break;
}
++c;
}
this.length -= c;
return ret;
}
}, {
key: custom,
value: function value(_, options) {
return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
depth: 0,
customInspect: false
}));
}
}]);
return BufferList;
}();
});
// node_modules/readable-stream/lib/internal/streams/destroy.js
var require_destroy = __commonJS((exports, module) => {
function destroy(err, cb) {
var _this = this;
var readableDestroyed = this._readableState && this._readableState.destroyed;
var writableDestroyed = this._writableState && this._writableState.destroyed;
if (readableDestroyed || writableDestroyed) {
if (cb) {
cb(err);
} else if (err) {
if (!this._writableState) {
process.nextTick(emitErrorNT, this, err);
} else if (!this._writableState.errorEmitted) {
this._writableState.errorEmitted = true;
process.nextTick(emitErrorNT, this, err);
}
}
return this;
}
if (this._readableState) {
this._readableState.destroyed = true;
}
if (this._writableState) {
this._writableState.destroyed = true;
}
this._destroy(err || null, function(err2) {
if (!cb && err2) {
if (!_this._writableState) {
process.nextTick(emitErrorAndCloseNT, _this, err2);
} else if (!_this._writableState.errorEmitted) {
_this._writableState.errorEmitted = true;
process.nextTick(emitErrorAndCloseNT, _this, err2);
} else {
process.nextTick(emitCloseNT, _this);
}
} else if (cb) {
process.nextTick(emitCloseNT, _this);
cb(err2);
} else {
process.nextTick(emitCloseNT, _this);
}
});
return this;
}
function emitErrorAndCloseNT(self2, err) {
emitErrorNT(self2, err);
emitCloseNT(self2);
}
function emitCloseNT(self2) {
if (self2._writableState && !self2._writableState.emitClose)
return;
if (self2._readableState && !self2._readableState.emitClose)
return;
self2.emit("close");
}
function undestroy() {
if (this._readableState) {
this._readableState.destroyed = false;
this._readableState.reading = false;
this._readableState.ended = false;
this._readableState.endEmitted = false;
}
if (this._writableState) {
this._writableState.destroyed = false;
this._writableState.ended = false;
this._writableState.ending = false;
this._writableState.finalCalled = false;
this._writableState.prefinished = false;
this._writableState.finished = false;
this._writableState.errorEmitted = false;
}
}
function emitErrorNT(self2, err) {
self2.emit("error", err);
}
function errorOrDestroy(stream, err) {
var rState = stream._readableState;
var wState = stream._writableState;
if (rState && rState.autoDestroy || wState && wState.autoDestroy)
stream.destroy(err);
else
stream.emit("error", err);
}
module.exports = {
destroy,
undestroy,
errorOrDestroy
};
});
// node_modules/readable-stream/errors.js
var require_errors = __commonJS((exports, module) => {
var codes = {};
function createErrorType(code, message, Base) {
if (!Base) {
Base = Error;
}
function getMessage(arg1, arg2, arg3) {
if (typeof message === "string") {
return message;
} else {
return message(arg1, arg2, arg3);
}
}
class NodeError extends Base {
constructor(arg1, arg2, arg3) {
super(getMessage(arg1, arg2, arg3));
}
}
NodeError.prototype.name = Base.name;
NodeError.prototype.code = code;
codes[code] = NodeError;
}
function oneOf(expected, thing) {
if (Array.isArray(expected)) {
const len = expected.length;
expected = expected.map((i) => String(i));
if (len > 2) {
return `one of ${thing} ${expected.slice(0, len - 1).join(", ")}, or ` + expected[len - 1];
} else if (len === 2) {
return `one of ${thing} ${expected[0]} or ${expected[1]}`;
} else {
return `of ${thing} ${expected[0]}`;
}
} else {
return `of ${thing} ${String(expected)}`;
}
}
function startsWith(str, search, pos) {
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
}
function endsWith(str, search, this_len) {
if (this_len === undefined || this_len > str.length) {
this_len = str.length;
}
return str.substring(this_len - search.length, this_len) === search;
}
function includes(str, search, start) {
if (typeof start !== "number") {
start = 0;
}
if (start + search.length > str.length) {
return false;
} else {
return str.indexOf(search, start) !== -1;
}
}
createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) {
return 'The value "' + value + '" is invalid for option "' + name + '"';
}, TypeError);
createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) {
let determiner;
if (typeof expected === "string" && startsWith(expected, "not ")) {
determiner = "must not be";
expected = expected.replace(/^not /, "");
} else {
determiner = "must be";
}
let msg;
if (endsWith(name, " argument")) {
msg = `The ${name} ${determiner} ${oneOf(expected, "type")}`;
} else {
const type = includes(name, ".") ? "property" : "argument";
msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, "type")}`;
}
msg += `. Received type ${typeof actual}`;
return msg;
}, TypeError);
createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");
createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) {
return "The " + name + " method is not implemented";
});
createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");
createErrorType("ERR_STREAM_DESTROYED", function(name) {
return "Cannot call " + name + " after a stream was destroyed";
});
createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");
createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");
createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {
return "Unknown encoding: " + arg;
}, TypeError);
createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
exports.codes = codes;
});
// node_modules/readable-stream/lib/internal/streams/state.js
var require_state = __commonJS((exports, module) => {
var ERR_INVALID_OPT_VALUE = require_errors().codes.ERR_INVALID_OPT_VALUE;
function highWaterMarkFrom(options, isDuplex, duplexKey) {
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
}
function getHighWaterMark(state, options, duplexKey, isDuplex) {
var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
if (hwm != null) {
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
var name = isDuplex ? duplexKey : "highWaterMark";
throw new ERR_INVALID_OPT_VALUE(name, hwm);
}
return Math.floor(hwm);
}
return state.objectMode ? 16 : 16 * 1024;
}
module.exports = {
getHighWaterMark
};
});
// node_modules/inherits/inherits_browser.js
var require_inherits_browser = __commonJS((exports, module) => {
if (typeof Object.create === "function") {
module.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
}
};
} else {
module.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
var TempCtor = function() {};
TempCtor.prototype = superCtor.prototype;
ctor.prototype = new TempCtor;
ctor.prototype.constructor = ctor;
}
};
}
});
// node_modules/inherits/inherits.js
var require_inherits = __commonJS((exports, module) => {
try {
util = __require("util");
if (typeof util.inherits !== "function")
throw "";
module.exports = util.inherits;
} catch (e) {
module.exports = require_inherits_browser();
}
var util;
});
// node_modules/util-deprecate/node.js
var require_node = __commonJS((exports, module) => {
module.exports = __require("util").deprecate;
});
// node_modules/readable-stream/lib/_stream_writable.js
var require__stream_writable = __commonJS((exports, module) => {
module.exports = Writable;
function CorkedRequest(state) {
var _this = this;
this.next = null;
this.entry = null;
this.finish = function() {
onCorkedFinish(_this, state);
};
}
var Duplex;
Writable.WritableState = WritableState;
var internalUtil = {
deprecate: require_node()
};
var Stream = __require("stream");
var Buffer2 = __require("buffer").Buffer;
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {};
function _uint8ArrayToBuffer(chunk) {
return Buffer2.from(chunk);
}
function _isUint8Array(obj) {
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
}
var destroyImpl = require_destroy();
var _require = require_state();
var getHighWaterMark = _require.getHighWaterMark;
var _require$codes = require_errors().codes;
var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;
var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;
var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;
var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
var errorOrDestroy = destroyImpl.errorOrDestroy;
require_inherits()(Writable, Stream);
function nop() {}
function WritableState(options, stream, isDuplex) {
Duplex = Duplex || require__stream_duplex();
options = options || {};
if (typeof isDuplex !== "boolean")
isDuplex = stream instanceof Duplex;
this.objectMode = !!options.objectMode;
if (isDuplex)
this.objectMode = this.objectMode || !!options.writableObjectMode;
this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);
this.finalCalled = false;
this.needDrain = false;
this.ending = false;
this.ended = false;
this.finished = false;
this.destroyed = false;
var noDecode = options.decodeStrings === false;
this.decodeStrings = !noDecode;
this.defaultEncoding = options.defaultEncoding || "utf8";
this.length = 0;
this.writing = false;
this.corked = 0;
this.sync = true;
this.bufferProcessing = false;
this.onwrite = function(er) {
onwrite(stream, er);
};
this.writecb = null;
this.writelen = 0;
this.bufferedRequest = null;
this.lastBufferedRequest = null;
this.pendingcb = 0;
this.prefinished = false;
this.errorEmitted = false;
this.emitClose = options.emitClose !== false;
this.autoDestroy = !!options.autoDestroy;
this.bufferedRequestCount = 0;
this.corkedRequestsFree = new CorkedRequest(this);
}
WritableState.prototype.getBuffer = function getBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function() {
try {
Object.defineProperty(WritableState.prototype, "buffer", {
get: internalUtil.deprecate(function writableStateBufferGetter() {
return this.getBuffer();
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer " + "instead.", "DEP0003")
});
} catch (_) {}
})();
var realHasInstance;
if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
realHasInstance = Function.prototype[Symbol.hasInstance];
Object.defineProperty(Writable, Symbol.hasInstance, {
value: function value(object) {
if (realHasInstance.call(this, object))
return true;
if (this !== Writable)
return false;
return object && object._writableState instanceof WritableState;
}
});
} else {
realHasInstance = function realHasInstance(object) {
return object instanceof this;
};
}
function Writable(options) {
Duplex = Duplex || require__stream_duplex();
var isDuplex = this instanceof Duplex;
if (!isDuplex && !realHasInstance.call(Writable, this))
return new Writable(options);
this._writableState = new WritableState(options, this, isDuplex);
this.writable = true;
if (options) {
if (typeof options.write === "function")
this._write = options.write;
if (typeof options.writev === "function")
this._writev = options.writev;
if (typeof options.destroy === "function")
this._destroy = options.destroy;
if (typeof options.final === "function")
this._final = options.final;
}
Stream.call(this);
}
Writable.prototype.pipe = function() {
errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE);
};
function writeAfterEnd(stream, cb) {
var er = new ERR_STREAM_WRITE_AFTER_END;
errorOrDestroy(stream, er);
process.nextTick(cb, er);
}
function validChunk(stream, state, chunk, cb) {
var er;
if (chunk === null) {
er = new ERR_STREAM_NULL_VALUES;
} else if (typeof chunk !== "string" && !state.objectMode) {
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
}
if (er) {
errorOrDestroy(stream, er);
process.nextTick(cb, er);
return false;
}
return true;
}
Writable.prototype.write = function(chunk, encoding, cb) {
var state = this._writableState;
var ret = false;
var isBuf = !state.objectMode && _isUint8Array(chunk);
if (isBuf && !Buffer2.isBuffer(chunk)) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (typeof encoding === "function") {
cb = encoding;
encoding = null;
}
if (isBuf)
encoding = "buffer";
else if (!encoding)
encoding = state.defaultEncoding;
if (typeof cb !== "function")
cb = nop;
if (state.ending)
writeAfterEnd(this, cb);
else if (isBuf || validChunk(this, state, chunk, cb)) {
state.pendingcb++;
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
}
return ret;
};
Writable.prototype.cork = function() {
this._writableState.corked++;
};
Writable.prototype.uncork = function() {
var state = this._writableState;
if (state.corked) {
state.corked--;
if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest)
clearBuffer(this, state);
}
};
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
if (typeof encoding === "string")
encoding = encoding.toLowerCase();
if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))
throw new ERR_UNKNOWN_ENCODING(encoding);
this._writableState.defaultEncoding = encoding;
return this;
};
Object.defineProperty(Writable.prototype, "writableBuffer", {
enumerable: false,
get: function get() {
return this._writableState && this._writableState.getBuffer();
}
});
function decodeChunk(state, chunk, encoding) {
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
chunk = Buffer2.from(chunk, encoding);
}
return chunk;
}
Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
enumerable: false,
get: function get() {
return this._writableState.highWaterMark;
}
});
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
if (!isBuf) {
var newChunk = decodeChunk(state, chunk, encoding);
if (chunk !== newChunk) {
isBuf = true;
encoding = "buffer";
chunk = newChunk;
}
}
var len = state.objectMode ? 1 : chunk.length;
state.length += len;
var ret = state.length < state.highWaterMark;
if (!ret)
state.needDrain = true;
if (state.writing || state.corked) {
var last = state.lastBufferedRequest;
state.lastBufferedRequest = {
chunk,
encoding,
isBuf,
callback: cb,
next: null
};
if (last) {
last.next = state.lastBufferedRequest;
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
state.bufferedRequestCount += 1;
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
}
return ret;
}
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
state.writelen = len;
state.writecb = cb;
state.writing = true;
state.sync = true;
if (state.destroyed)
state.onwrite(new ERR_STREAM_DESTROYED("write"));
else if (writev)
stream._writev(chunk, state.onwrite);
else
stream._write(chunk, encoding, state.onwrite);
state.sync = false;
}
function onwriteError(stream, state, sync, er, cb) {
--state.pendingcb;
if (sync) {
process.nextTick(cb, er);
process.nextTick(finishMaybe, stream, state);
stream._writableState.errorEmitted = true;
errorOrDestroy(stream, er);
} else {
cb(er);
stream._writableState.errorEmitted = true;
errorOrDestroy(stream, er);
finishMaybe(stream, state);
}
}
function onwriteStateUpdate(state) {
state.writing = false;
state.writecb = null;
state.length -= state.writelen;
state.writelen = 0;
}
function onwrite(stream, er) {
var state = stream._writableState;
var sync = state.sync;
var cb = state.writecb;
if (typeof cb !== "function")
throw new ERR_MULTIPLE_CALLBACK;
onwriteStateUpdate(state);
if (er)
onwriteError(stream, state, sync, er, cb);
else {
var finished = needFinish(state) || stream.destroyed;
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
clearBuffer(stream, state);
}
if (sync) {
process.nextTick(afterWrite, stream, state, finished, cb);
} else {
afterWrite(stream, state, finished, cb);
}
}
}
function afterWrite(stream, state, finished, cb) {
if (!finished)
onwriteDrain(stream, state);
state.pendingcb--;
cb();
finishMaybe(stream, state);
}
function onwriteDrain(stream, state) {
if (state.length === 0 && state.needDrain) {
state.needDrain = false;
stream.emit("drain");
}
}
function clearBuffer(stream, state) {
state.bufferProcessing = true;
var entry = state.bufferedRequest;
if (stream._writev && entry && entry.next) {
var l = state.bufferedRequestCount;
var buffer = new Array(l);
var holder = state.corkedRequestsFree;
holder.entry = entry;
var count = 0;
var allBuffers = true;
while (entry) {
buffer[count] = entry;
if (!entry.isBuf)
allBuffers = false;
entry = entry.next;
count += 1;
}
buffer.allBuffers = allBuffers;
doWrite(stream, state, true, state.length, buffer, "", holder.finish);
state.pendingcb++;
state.lastBufferedRequest = null;
if (holder.next) {
state.corkedRequestsFree = holder.next;
holder.next = null;
} else {
state.corkedRequestsFree = new CorkedRequest(state);
}
state.bufferedRequestCount = 0;
} else {
while (entry) {
var chunk = entry.chunk;
var encoding = entry.encoding;
var cb = entry.callback;
var len = state.objectMode ? 1 : chunk.length;
doWrite(stream, state, false, len, chunk, encoding, cb);
entry = entry.next;
state.bufferedRequestCount--;
if (state.writing) {
break;
}
}
if (entry === null)
state.lastBufferedRequest = null;
}
state.bufferedRequest = entry;
state.bufferProcessing = false;
}
Writable.prototype._write = function(chunk, encoding, cb) {
cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));
};
Writable.prototype._writev = null;
Writable.prototype.end = function(chunk, encoding, cb) {
var state = this._writableState;
if (typeof chunk === "function") {
cb = chunk;
chunk = null;
encoding = null;
} else if (typeof encoding === "function") {
cb = encoding;
encoding = null;
}
if (chunk !== null && chunk !== undefined)
this.write(chunk, encoding);
if (state.corked) {
state.corked = 1;
this.uncork();
}
if (!state.ending)
endWritable(this, state, cb);
return this;
};
Object.defineProperty(Writable.prototype, "writableLength", {
enumerable: false,
get: function get() {
return this._writableState.length;
}
});
function needFinish(state) {
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
}
function callFinal(stream, state) {
stream._final(function(err) {
state.pendingcb--;
if (err) {
errorOrDestroy(stream, err);
}
state.prefinished = true;
stream.emit("prefinish");
finishMaybe(stream, state);
});
}
function prefinish(stream, state) {
if (!state.prefinished && !state.finalCalled) {
if (typeof stream._final === "function" && !state.destroyed) {
state.pendingcb++;
state.finalCalled = true;
process.nextTick(callFinal, stream, state);
} else {
state.prefinished = true;
stream.emit("prefinish");
}
}
}
function finishMaybe(stream, state) {
var need = needFinish(state);
if (need) {
prefinish(stream, state);
if (state.pendingcb === 0) {
state.finished = true;
stream.emit("finish");
if (state.autoDestroy) {
var rState = stream._readableState;
if (!rState || rState.autoDestroy && rState.endEmitted) {
stream.destroy();
}
}
}
}
return need;
}
function endWritable(stream, state, cb) {
state.ending = true;
finishMaybe(stream, state);
if (cb) {
if (state.finished)
process.nextTick(cb);
else
stream.once("finish", cb);
}
state.ended = true;
stream.writable = false;
}
function onCorkedFinish(corkReq, state, err) {
var entry = corkReq.entry;
corkReq.entry = null;
while (entry) {
var cb = entry.callback;
state.pendingcb--;
cb(err);
entry = entry.next;
}
state.corkedRequestsFree.next = corkReq;
}
Object.defineProperty(Writable.prototype, "destroyed", {
enumerable: false,
get: function get() {
if (this._writableState === undefined) {
return false;
}
return this._writableState.destroyed;
},
set: function set(value) {
if (!this._writableState) {
return;
}
this._writableState.destroyed = value;
}
});
Writable.prototype.destroy = destroyImpl.destroy;
Writable.prototype._undestroy = destroyImpl.undestroy;
Writable.prototype._destroy = function(err, cb) {
cb(err);
};
});
// node_modules/readable-stream/lib/_stream_duplex.js
var require__stream_duplex = __commonJS((exports, module) => {
var objectKeys = Object.keys || function(obj) {
var keys2 = [];
for (var key in obj)
keys2.push(key);
return keys2;
};
module.exports = Duplex;
var Readable = require__stream_readable();
var Writable = require__stream_writable();
require_inherits()(Duplex, Readable);
{
keys = objectKeys(Writable.prototype);
for (v = 0;v < keys.length; v++) {
method = keys[v];
if (!Duplex.prototype[method])
Duplex.prototype[method] = Writable.prototype[method];
}
}
var keys;
var method;
var v;
function Duplex(options) {
if (!(this instanceof Duplex))
return new Duplex(options);
Readable.call(this, options);
Writable.call(this, options);
this.allowHalfOpen = true;
if (options) {
if (options.readable === false)
this.readable = false;
if (options.writable === false)
this.writable = false;
if (options.allowHalfOpen === false) {
this.allowHalfOpen = false;
this.once("end", onend);
}
}
}
Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
enumerable: false,
get: function get() {
return this._writableState.highWaterMark;
}
});
Object.defineProperty(Duplex.prototype, "writableBuffer", {
enumerable: false,
get: function get() {
return this._writableState && this._writableState.getBuffer();
}
});
Object.defineProperty(Duplex.prototype, "writableLength", {
enumerable: false,
get: function get() {
return this._writableState.length;
}
});
function onend() {
if (this._writableState.ended)
return;
process.nextTick(onEndNT, this);
}
function onEndNT(self2) {
self2.end();
}
Object.defineProperty(Duplex.prototype, "destroyed", {
enumerable: false,
get: function get() {
if (this._readableState === undefined || this._writableState === undefined) {
return false;
}
return this._readableState.destroyed && this._writableState.destroyed;
},
set: function set(value) {
if (this._readableState === undefined || this._writableState === undefined) {
return;
}
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
});
});
// node_modules/safe-buffer/index.js
var require_safe_buffer = __commonJS((exports, module) => {
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
var buffer = __require("buffer");
var Buffer2 = buffer.Buffer;
function copyProps(src, dst) {
for (var key in src) {
dst[key] = src[key];
}
}
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
module.exports = buffer;
} else {
copyProps(buffer, exports);
exports.Buffer = SafeBuffer;
}
function SafeBuffer(arg, encodingOrOffset, length) {
return Buffer2(arg, encodingOrOffset, length);
}
SafeBuffer.prototype = Object.create(Buffer2.prototype);
copyProps(Buffer2, SafeBuffer);
SafeBuffer.from = function(arg, encodingOrOffset, length) {
if (typeof arg === "number") {
throw new TypeError("Argument must not be a number");
}
return Buffer2(arg, encodingOrOffset, length);
};
SafeBuffer.alloc = function(size, fill, encoding) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
var buf = Buffer2(size);
if (fill !== undefined) {
if (typeof encoding === "string") {
buf.fill(fill, encoding);
} else {
buf.fill(fill);
}
} else {
buf.fill(0);
}
return buf;
};
SafeBuffer.allocUnsafe = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return Buffer2(size);
};
SafeBuffer.allocUnsafeSlow = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return buffer.SlowBuffer(size);
};
});
// node_modules/string_decoder/lib/string_decoder.js
var require_string_decoder = __commonJS((exports) => {
var Buffer2 = require_safe_buffer().Buffer;
var isEncoding = Buffer2.isEncoding || function(encoding) {
encoding = "" + encoding;
switch (encoding && encoding.toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "binary":
case "base64":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
case "raw":
return true;
default:
return false;
}
};
function _normalizeEncoding(enc) {
if (!enc)
return "utf8";
var retried;
while (true) {
switch (enc) {
case "utf8":
case "utf-8":
return "utf8";
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return "utf16le";
case "latin1":
case "binary":
return "latin1";
case "base64":
case "ascii":
case "hex":
return enc;
default:
if (retried)
return;
enc = ("" + enc).toLowerCase();
retried = true;
}
}
}
function normalizeEncoding(enc) {
var nenc = _normalizeEncoding(enc);
if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc)))
throw new Error("Unknown encoding: " + enc);
return nenc || enc;
}
exports.StringDecoder = StringDecoder;
function StringDecoder(encoding) {
this.encoding = normalizeEncoding(encoding);
var nb;
switch (this.encoding) {
case "utf16le":
this.text = utf16Text;
this.end = utf16End;
nb = 4;
break;
case "utf8":
this.fillLast = utf8FillLast;
nb = 4;
break;
case "base64":
this.text = base64Text;
this.end = base64End;
nb = 3;
break;
default:
this.write = simpleWrite;
this.end = simpleEnd;
return;
}
this.lastNeed = 0;
this.lastTotal = 0;
this.lastChar = Buffer2.allocUnsafe(nb);
}
StringDecoder.prototype.write = function(buf) {
if (buf.length === 0)
return "";
var r;
var i;
if (this.lastNeed) {
r = this.fillLast(buf);
if (r === undefined)
return "";
i = this.lastNeed;
this.lastNeed = 0;
} else {
i = 0;
}
if (i < buf.length)
return r ? r + this.text(buf, i) : this.text(buf, i);
return r || "";
};
StringDecoder.prototype.end = utf8End;
StringDecoder.prototype.text = utf8Text;
StringDecoder.prototype.fillLast = function(buf) {
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
this.lastNeed -= buf.length;
};
function utf8CheckByte(byte) {
if (byte <= 127)
return 0;
else if (byte >> 5 === 6)
return 2;
else if (byte >> 4 === 14)
return 3;
else if (byte >> 3 === 30)
return 4;
return byte >> 6 === 2 ? -1 : -2;
}
function utf8CheckIncomplete(self2, buf, i) {
var j = buf.length - 1;
if (j < i)
return 0;
var nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0)
self2.lastNeed = nb - 1;
return nb;
}
if (--j < i || nb === -2)
return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0)
self2.lastNeed = nb - 2;
return nb;
}
if (--j < i || nb === -2)
return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0) {
if (nb === 2)
nb = 0;
else
self2.lastNeed = nb - 3;
}
return nb;
}
return 0;
}
function utf8CheckExtraBytes(self2, buf, p) {
if ((buf[0] & 192) !== 128) {
self2.lastNeed = 0;
return "\uFFFD";
}
if (self2.lastNeed > 1 && buf.length > 1) {
if ((buf[1] & 192) !== 128) {
self2.lastNeed = 1;
return "\uFFFD";
}
if (self2.lastNeed > 2 && buf.length > 2) {
if ((buf[2] & 192) !== 128) {
self2.lastNeed = 2;
return "\uFFFD";
}
}
}
}
function utf8FillLast(buf) {
var p = this.lastTotal - this.lastNeed;
var r = utf8CheckExtraBytes(this, buf, p);
if (r !== undefined)
return r;
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, p, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, p, 0, buf.length);
this.lastNeed -= buf.length;
}
function utf8Text(buf, i) {
var total = utf8CheckIncomplete(this, buf, i);
if (!this.lastNeed)
return buf.toString("utf8", i);
this.lastTotal = total;
var end = buf.length - (total - this.lastNeed);
buf.copy(this.lastChar, 0, end);
return buf.toString("utf8", i, end);
}
function utf8End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed)
return r + "\uFFFD";
return r;
}
function utf16Text(buf, i) {
if ((buf.length - i) % 2 === 0) {
var r = buf.toString("utf16le", i);
if (r) {
var c = r.charCodeAt(r.length - 1);
if (c >= 55296 && c <= 56319) {
this.lastNeed = 2;
this.lastTotal = 4;
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
return r.slice(0, -1);
}
}
return r;
}
this.lastNeed = 1;
this.lastTotal = 2;
this.lastChar[0] = buf[buf.length - 1];
return buf.toString("utf16le", i, buf.length - 1);
}
function utf16End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed) {
var end = this.lastTotal - this.lastNeed;
return r + this.lastChar.toString("utf16le", 0, end);
}
return r;
}
function base64Text(buf, i) {
var n = (buf.length - i) % 3;
if (n === 0)
return buf.toString("base64", i);
this.lastNeed = 3 - n;
this.lastTotal = 3;
if (n === 1) {
this.lastChar[0] = buf[buf.length - 1];
} else {
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
}
return buf.toString("base64", i, buf.length - n);
}
function base64End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed)
return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
return r;
}
function simpleWrite(buf) {
return buf.toString(this.encoding);
}
function simpleEnd(buf) {
return buf && buf.length ? this.write(buf) : "";
}
});
// node_modules/readable-stream/lib/internal/streams/end-of-stream.js
var require_end_of_stream = __commonJS((exports, module) => {
var ERR_STREAM_PREMATURE_CLOSE = require_errors().codes.ERR_STREAM_PREMATURE_CLOSE;
function once2(callback) {
var called = false;
return function() {
if (called)
return;
called = true;
for (var _len = arguments.length, args = new Array(_len), _key = 0;_key < _len; _key++) {
args[_key] = arguments[_key];
}
callback.apply(this, args);
};
}
function noop() {}
function isRequest(stream) {
return stream.setHeader && typeof stream.abort === "function";
}
function eos(stream, opts, callback) {
if (typeof opts === "function")
return eos(stream, null, opts);
if (!opts)
opts = {};
callback = once2(callback || noop);
var readable = opts.readable || opts.readable !== false && stream.readable;
var writable = opts.writable || opts.writable !== false && stream.writable;
var onlegacyfinish = function onlegacyfinish() {
if (!stream.writable)
onfinish();
};
var writableEnded = stream._writableState && stream._writableState.finished;
var onfinish = function onfinish() {
writable = false;
writableEnded = true;
if (!readable)
callback.call(stream);
};
var readableEnded = stream._readableState && stream._readableState.endEmitted;
var onend = function onend() {
readable = false;
readableEnded = true;
if (!writable)
callback.call(stream);
};
var onerror = function onerror(err) {
callback.call(stream, err);
};
var onclose = function onclose() {
var err;
if (readable && !readableEnded) {
if (!stream._readableState || !stream._readableState.ended)
err = new ERR_STREAM_PREMATURE_CLOSE;
return callback.call(stream, err);
}
if (writable && !writableEnded) {
if (!stream._writableState || !stream._writableState.ended)
err = new ERR_STREAM_PREMATURE_CLOSE;
return callback.call(stream, err);
}
};
var onrequest = function onrequest() {
stream.req.on("finish", onfinish);
};
if (isRequest(stream)) {
stream.on("complete", onfinish);
stream.on("abort", onclose);
if (stream.req)
onrequest();
else
stream.on("request", onrequest);
} else if (writable && !stream._writableState) {
stream.on("end", onlegacyfinish);
stream.on("close", onlegacyfinish);
}
stream.on("end", onend);
stream.on("finish", onfinish);
if (opts.error !== false)
stream.on("error", onerror);
stream.on("close", onclose);
return function() {
stream.removeListener("complete", onfinish);
stream.removeListener("abort", onclose);
stream.removeListener("request", onrequest);
if (stream.req)
stream.req.removeListener("finish", onfinish);
stream.removeListener("end", onlegacyfinish);
stream.removeListener("close", onlegacyfinish);
stream.removeListener("finish", onfinish);
stream.removeListener("end", onend);
stream.removeListener("error", onerror);
stream.removeListener("close", onclose);
};
}
module.exports = eos;
});
// node_modules/readable-stream/lib/internal/streams/async_iterator.js
var require_async_iterator = __commonJS((exports, module) => {
var _Object$setPrototypeO;
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null)
return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object")
return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
var finished = require_end_of_stream();
var kLastResolve = Symbol("lastResolve");
var kLastReject = Symbol("lastReject");
var kError = Symbol("error");
var kEnded = Symbol("ended");
var kLastPromise = Symbol("lastPromise");
var kHandlePromise = Symbol("handlePromise");
var kStream = Symbol("stream");
function createIterResult(value, done) {
return {
value,
done
};
}
function readAndResolve(iter) {
var resolve = iter[kLastResolve];
if (resolve !== null) {
var data = iter[kStream].read();
if (data !== null) {
iter[kLastPromise] = null;
iter[kLastResolve] = null;
iter[kLastReject] = null;
resolve(createIterResult(data, false));
}
}
}
function onReadable(iter) {
process.nextTick(readAndResolve, iter);
}
function wrapForNext(lastPromise, iter) {
return function(resolve, reject2) {
lastPromise.then(function() {
if (iter[kEnded]) {
resolve(createIterResult(undefined, true));
return;
}
iter[kHandlePromise](resolve, reject2);
}, reject2);
};
}
var AsyncIteratorPrototype = Object.getPrototypeOf(function() {});
var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
get stream() {
return this[kStream];
},
next: function next() {
var _this = this;
var error = this[kError];
if (error !== null) {
return Promise.reject(error);
}
if (this[kEnded]) {
return Promise.resolve(createIterResult(undefined, true));
}
if (this[kStream].destroyed) {
return new Promise(function(resolve, reject2) {
process.nextTick(function() {
if (_this[kError]) {
reject2(_this[kError]);
} else {
resolve(createIterResult(undefined, true));
}
});
});
}
var lastPromise = this[kLastPromise];
var promise;
if (lastPromise) {
promise = new Promise(wrapForNext(lastPromise, this));
} else {
var data = this[kStream].read();
if (data !== null) {
return Promise.resolve(createIterResult(data, false));
}
promise = new Promise(this[kHandlePromise]);
}
this[kLastPromise] = promise;
return promise;
}
}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() {
return this;
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
var _this2 = this;
return new Promise(function(resolve, reject2) {
_this2[kStream].destroy(null, function(err) {
if (err) {
reject2(err);
return;
}
resolve(createIterResult(undefined, true));
});
});
}), _Object$setPrototypeO), AsyncIteratorPrototype);
var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
var _Object$create;
var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
value: stream,
writable: true
}), _defineProperty(_Object$create, kLastResolve, {
value: null,
writable: true
}), _defineProperty(_Object$create, kLastReject, {
value: null,
writable: true
}), _defineProperty(_Object$create, kError, {
value: null,
writable: true
}), _defineProperty(_Object$create, kEnded, {
value: stream._readableState.endEmitted,
writable: true
}), _defineProperty(_Object$create, kHandlePromise, {
value: function value(resolve, reject2) {
var data = iterator[kStream].read();
if (data) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
resolve(createIterResult(data, false));
} else {
iterator[kLastResolve] = resolve;
iterator[kLastReject] = reject2;
}
},
writable: true
}), _Object$create));
iterator[kLastPromise] = null;
finished(stream, function(err) {
if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
var reject2 = iterator[kLastReject];
if (reject2 !== null) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
reject2(err);
}
iterator[kError] = err;
return;
}
var resolve = iterator[kLastResolve];
if (resolve !== null) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
resolve(createIterResult(undefined, true));
}
iterator[kEnded] = true;
});
stream.on("readable", onReadable.bind(null, iterator));
return iterator;
};
module.exports = createReadableStreamAsyncIterator;
});
// node_modules/readable-stream/lib/internal/streams/from.js
var require_from = __commonJS((exports, module) => {
function asyncGeneratorStep(gen, resolve, reject2, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject2(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self2 = this, args = arguments;
return new Promise(function(resolve, reject2) {
var gen = fn.apply(self2, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject2, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject2, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread(target) {
for (var i = 1;i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null)
return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object")
return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
var ERR_INVALID_ARG_TYPE = require_errors().codes.ERR_INVALID_ARG_TYPE;
function from(Readable, iterable, opts) {
var iterator;
if (iterable && typeof iterable.next === "function") {
iterator = iterable;
} else if (iterable && iterable[Symbol.asyncIterator])
iterator = iterable[Symbol.asyncIterator]();
else if (iterable && iterable[Symbol.iterator])
iterator = iterable[Symbol.iterator]();
else
throw new ERR_INVALID_ARG_TYPE("iterable", ["Iterable"], iterable);
var readable = new Readable(_objectSpread({
objectMode: true
}, opts));
var reading = false;
readable._read = function() {
if (!reading) {
reading = true;
next();
}
};
function next() {
return _next2.apply(this, arguments);
}
function _next2() {
_next2 = _asyncToGenerator(function* () {
try {
var _yield$iterator$next = yield iterator.next(), value = _yield$iterator$next.value, done = _yield$iterator$next.done;
if (done) {
readable.push(null);
} else if (readable.push(yield value)) {
next();
} else {
reading = false;
}
} catch (err) {
readable.destroy(err);
}
});
return _next2.apply(this, arguments);
}
return readable;
}
module.exports = from;
});
// node_modules/readable-stream/lib/_stream_readable.js
var require__stream_readable = __commonJS((exports, module) => {
module.exports = Readable;
var Duplex;
Readable.ReadableState = ReadableState;
var EE = __require("events").EventEmitter;
var EElistenerCount = function EElistenerCount(emitter, type) {
return emitter.listeners(type).length;
};
var Stream = __require("stream");
var Buffer2 = __require("buffer").Buffer;
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {};
function _uint8ArrayToBuffer(chunk) {
return Buffer2.from(chunk);
}
function _isUint8Array(obj) {
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
}
var debugUtil = __require("util");
var debug;
if (debugUtil && debugUtil.debuglog) {
debug = debugUtil.debuglog("stream");
} else {
debug = function debug() {};
}
var BufferList = require_buffer_list();
var destroyImpl = require_destroy();
var _require = require_state();
var getHighWaterMark = _require.getHighWaterMark;
var _require$codes = require_errors().codes;
var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;
var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
var StringDecoder;
var createReadableStreamAsyncIterator;
var from;
require_inherits()(Readable, Stream);
var errorOrDestroy = destroyImpl.errorOrDestroy;
var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
function prependListener(emitter, event, fn) {
if (typeof emitter.prependListener === "function")
return emitter.prependListener(event, fn);
if (!emitter._events || !emitter._events[event])
emitter.on(event, fn);
else if (Array.isArray(emitter._events[event]))
emitter._events[event].unshift(fn);
else
emitter._events[event] = [fn, emitter._events[event]];
}
function ReadableState(options, stream, isDuplex) {
Duplex = Duplex || require__stream_duplex();
options = options || {};
if (typeof isDuplex !== "boolean")
isDuplex = stream instanceof Duplex;
this.objectMode = !!options.objectMode;
if (isDuplex)
this.objectMode = this.objectMode || !!options.readableObjectMode;
this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);
this.buffer = new BufferList;
this.length = 0;
this.pipes = null;
this.pipesCount = 0;
this.flowing = null;
this.ended = false;
this.endEmitted = false;
this.reading = false;
this.sync = true;
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
this.resumeScheduled = false;
this.paused = true;
this.emitClose = options.emitClose !== false;
this.autoDestroy = !!options.autoDestroy;
this.destroyed = false;
this.defaultEncoding = options.defaultEncoding || "utf8";
this.awaitDrain = 0;
this.readingMore = false;
this.decoder = null;
this.encoding = null;
if (options.encoding) {
if (!StringDecoder)
StringDecoder = require_string_decoder().StringDecoder;
this.decoder = new StringDecoder(options.encoding);
this.encoding = options.encoding;
}
}
function Readable(options) {
Duplex = Duplex || require__stream_duplex();
if (!(this instanceof Readable))
return new Readable(options);
var isDuplex = this instanceof Duplex;
this._readableState = new ReadableState(options, this, isDuplex);
this.readable = true;
if (options) {
if (typeof options.read === "function")
this._read = options.read;
if (typeof options.destroy === "function")
this._destroy = options.destroy;
}
Stream.call(this);
}
Object.defineProperty(Readable.prototype, "destroyed", {
enumerable: false,
get: function get() {
if (this._readableState === undefined) {
return false;
}
return this._readableState.destroyed;
},
set: function set(value) {
if (!this._readableState) {
return;
}
this._readableState.destroyed = value;
}
});
Readable.prototype.destroy = destroyImpl.destroy;
Readable.prototype._undestroy = destroyImpl.undestroy;
Readable.prototype._destroy = function(err, cb) {
cb(err);
};
Readable.prototype.push = function(chunk, encoding) {
var state = this._readableState;
var skipChunkCheck;
if (!state.objectMode) {
if (typeof chunk === "string") {
encoding = encoding || state.defaultEncoding;
if (encoding !== state.encoding) {
chunk = Buffer2.from(chunk, encoding);
encoding = "";
}
skipChunkCheck = true;
}
} else {
skipChunkCheck = true;
}
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
};
Readable.prototype.unshift = function(chunk) {
return readableAddChunk(this, chunk, null, true, false);
};
function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
debug("readableAddChunk", chunk);
var state = stream._readableState;
if (chunk === null) {
state.reading = false;
onEofChunk(stream, state);
} else {
var er;
if (!skipChunkCheck)
er = chunkInvalid(state, chunk);
if (er) {
errorOrDestroy(stream, er);
} else if (state.objectMode || chunk && chunk.length > 0) {
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (addToFront) {
if (state.endEmitted)
errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT);
else
addChunk(stream, state, chunk, true);
} else if (state.ended) {
errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF);
} else if (state.destroyed) {
return false;
} else {
state.reading = false;
if (state.decoder && !encoding) {
chunk = state.decoder.write(chunk);
if (state.objectMode || chunk.length !== 0)
addChunk(stream, state, chunk, false);
else
maybeReadMore(stream, state);
} else {
addChunk(stream, state, chunk, false);
}
}
} else if (!addToFront) {
state.reading = false;
maybeReadMore(stream, state);
}
}
return !state.ended && (state.length < state.highWaterMark || state.length === 0);
}
function addChunk(stream, state, chunk, addToFront) {
if (state.flowing && state.length === 0 && !state.sync) {
state.awaitDrain = 0;
stream.emit("data", chunk);
} else {
state.length += state.objectMode ? 1 : chunk.length;
if (addToFront)
state.buffer.unshift(chunk);
else
state.buffer.push(chunk);
if (state.needReadable)
emitReadable(stream);
}
maybeReadMore(stream, state);
}
function chunkInvalid(state, chunk) {
var er;
if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== undefined && !state.objectMode) {
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
}
return er;
}
Readable.prototype.isPaused = function() {
return this._readableState.flowing === false;
};
Readable.prototype.setEncoding = function(enc) {
if (!StringDecoder)
StringDecoder = require_string_decoder().StringDecoder;
var decoder = new StringDecoder(enc);
this._readableState.decoder = decoder;
this._readableState.encoding = this._readableState.decoder.encoding;
var p = this._readableState.buffer.head;
var content = "";
while (p !== null) {
content += decoder.write(p.data);
p = p.next;
}
this._readableState.buffer.clear();
if (content !== "")
this._readableState.buffer.push(content);
this._readableState.length = content.length;
return this;
};
var MAX_HWM = 1073741824;
function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
n--;
n |= n >>> 1;
n |= n >>> 2;
n |= n >>> 4;
n |= n >>> 8;
n |= n >>> 16;
n++;
}
return n;
}
function howMuchToRead(n, state) {
if (n <= 0 || state.length === 0 && state.ended)
return 0;
if (state.objectMode)
return 1;
if (n !== n) {
if (state.flowing && state.length)
return state.buffer.head.data.length;
else
return state.length;
}
if (n > state.highWaterMark)
state.highWaterMark = computeNewHighWaterMark(n);
if (n <= state.length)
return n;
if (!state.ended) {
state.needReadable = true;
return 0;
}
return state.length;
}
Readable.prototype.read = function(n) {
debug("read", n);
n = parseInt(n, 10);
var state = this._readableState;
var nOrig = n;
if (n !== 0)
state.emittedReadable = false;
if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
debug("read: emitReadable", state.length, state.ended);
if (state.length === 0 && state.ended)
endReadable(this);
else
emitReadable(this);
return null;
}
n = howMuchToRead(n, state);
if (n === 0 && state.ended) {
if (state.length === 0)
endReadable(this);
return null;
}
var doRead = state.needReadable;
debug("need readable", doRead);
if (state.length === 0 || state.length - n < state.highWaterMark) {
doRead = true;
debug("length less than watermark", doRead);
}
if (state.ended || state.reading) {
doRead = false;
debug("reading or ended", doRead);
} else if (doRead) {
debug("do read");
state.reading = true;
state.sync = true;
if (state.length === 0)
state.needReadable = true;
this._read(state.highWaterMark);
state.sync = false;
if (!state.reading)
n = howMuchToRead(nOrig, state);
}
var ret;
if (n > 0)
ret = fromList(n, state);
else
ret = null;
if (ret === null) {
state.needReadable = state.length <= state.highWaterMark;
n = 0;
} else {
state.length -= n;
state.awaitDrain = 0;
}
if (state.length === 0) {
if (!state.ended)
state.needReadable = true;
if (nOrig !== n && state.ended)
endReadable(this);
}
if (ret !== null)
this.emit("data", ret);
return ret;
};
function onEofChunk(stream, state) {
debug("onEofChunk");
if (state.ended)
return;
if (state.decoder) {
var chunk = state.decoder.end();
if (chunk && chunk.length) {
state.buffer.push(chunk);
state.length += state.objectMode ? 1 : chunk.length;
}
}
state.ended = true;
if (state.sync) {
emitReadable(stream);
} else {
state.needReadable = false;
if (!state.emittedReadable) {
state.emittedReadable = true;
emitReadable_(stream);
}
}
}
function emitReadable(stream) {
var state = stream._readableState;
debug("emitReadable", state.needReadable, state.emittedReadable);
state.needReadable = false;
if (!state.emittedReadable) {
debug("emitReadable", state.flowing);
state.emittedReadable = true;
process.nextTick(emitReadable_, stream);
}
}
function emitReadable_(stream) {
var state = stream._readableState;
debug("emitReadable_", state.destroyed, state.length, state.ended);
if (!state.destroyed && (state.length || state.ended)) {
stream.emit("readable");
state.emittedReadable = false;
}
state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
flow(stream);
}
function maybeReadMore(stream, state) {
if (!state.readingMore) {
state.readingMore = true;
process.nextTick(maybeReadMore_, stream, state);
}
}
function maybeReadMore_(stream, state) {
while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
var len = state.length;
debug("maybeReadMore read 0");
stream.read(0);
if (len === state.length)
break;
}
state.readingMore = false;
}
Readable.prototype._read = function(n) {
errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));
};
Readable.prototype.pipe = function(dest, pipeOpts) {
var src = this;
var state = this._readableState;
switch (state.pipesCount) {
case 0:
state.pipes = dest;
break;
case 1:
state.pipes = [state.pipes, dest];
break;
default:
state.pipes.push(dest);
break;
}
state.pipesCount += 1;
debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
var endFn = doEnd ? onend : unpipe;
if (state.endEmitted)
process.nextTick(endFn);
else
src.once("end", endFn);
dest.on("unpipe", onunpipe);
function onunpipe(readable, unpipeInfo) {
debug("onunpipe");
if (readable === src) {
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
unpipeInfo.hasUnpiped = true;
cleanup();
}
}
}
function onend() {
debug("onend");
dest.end();
}
var ondrain = pipeOnDrain(src);
dest.on("drain", ondrain);
var cleanedUp = false;
function cleanup() {
debug("cleanup");
dest.removeListener("close", onclose);
dest.removeListener("finish", onfinish);
dest.removeListener("drain", ondrain);
dest.removeListener("error", onerror);
dest.removeListener("unpipe", onunpipe);
src.removeListener("end", onend);
src.removeListener("end", unpipe);
src.removeListener("data", ondata);
cleanedUp = true;
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))
ondrain();
}
src.on("data", ondata);
function ondata(chunk) {
debug("ondata");
var ret = dest.write(chunk);
debug("dest.write", ret);
if (ret === false) {
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
debug("false write response, pause", state.awaitDrain);
state.awaitDrain++;
}
src.pause();
}
}
function onerror(er) {
debug("onerror", er);
unpipe();
dest.removeListener("error", onerror);
if (EElistenerCount(dest, "error") === 0)
errorOrDestroy(dest, er);
}
prependListener(dest, "error", onerror);
function onclose() {
dest.removeListener("finish", onfinish);
unpipe();
}
dest.once("close", onclose);
function onfinish() {
debug("onfinish");
dest.removeListener("close", onclose);
unpipe();
}
dest.once("finish", onfinish);
function unpipe() {
debug("unpipe");
src.unpipe(dest);
}
dest.emit("pipe", src);
if (!state.flowing) {
debug("pipe resume");
src.resume();
}
return dest;
};
function pipeOnDrain(src) {
return function pipeOnDrainFunctionResult() {
var state = src._readableState;
debug("pipeOnDrain", state.awaitDrain);
if (state.awaitDrain)
state.awaitDrain--;
if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
state.flowing = true;
flow(src);
}
};
}
Readable.prototype.unpipe = function(dest) {
var state = this._readableState;
var unpipeInfo = {
hasUnpiped: false
};
if (state.pipesCount === 0)
return this;
if (state.pipesCount === 1) {
if (dest && dest !== state.pipes)
return this;
if (!dest)
dest = state.pipes;
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
if (dest)
dest.emit("unpipe", this, unpipeInfo);
return this;
}
if (!dest) {
var dests = state.pipes;
var len = state.pipesCount;
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
for (var i = 0;i < len; i++)
dests[i].emit("unpipe", this, {
hasUnpiped: false
});
return this;
}
var index = indexOf(state.pipes, dest);
if (index === -1)
return this;
state.pipes.splice(index, 1);
state.pipesCount -= 1;
if (state.pipesCount === 1)
state.pipes = state.pipes[0];
dest.emit("unpipe", this, unpipeInfo);
return this;
};
Readable.prototype.on = function(ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
var state = this._readableState;
if (ev === "data") {
state.readableListening = this.listenerCount("readable") > 0;
if (state.flowing !== false)
this.resume();
} else if (ev === "readable") {
if (!state.endEmitted && !state.readableListening) {
state.readableListening = state.needReadable = true;
state.flowing = false;
state.emittedReadable = false;
debug("on readable", state.length, state.reading);
if (state.length) {
emitReadable(this);
} else if (!state.reading) {
process.nextTick(nReadingNextTick, this);
}
}
}
return res;
};
Readable.prototype.addListener = Readable.prototype.on;
Readable.prototype.removeListener = function(ev, fn) {
var res = Stream.prototype.removeListener.call(this, ev, fn);
if (ev === "readable") {
process.nextTick(updateReadableListening, this);
}
return res;
};
Readable.prototype.removeAllListeners = function(ev) {
var res = Stream.prototype.removeAllListeners.apply(this, arguments);
if (ev === "readable" || ev === undefined) {
process.nextTick(updateReadableListening, this);
}
return res;
};
function updateReadableListening(self2) {
var state = self2._readableState;
state.readableListening = self2.listenerCount("readable") > 0;
if (state.resumeScheduled && !state.paused) {
state.flowing = true;
} else if (self2.listenerCount("data") > 0) {
self2.resume();
}
}
function nReadingNextTick(self2) {
debug("readable nexttick read 0");
self2.read(0);
}
Readable.prototype.resume = function() {
var state = this._readableState;
if (!state.flowing) {
debug("resume");
state.flowing = !state.readableListening;
resume(this, state);
}
state.paused = false;
return this;
};
function resume(stream, state) {
if (!state.resumeScheduled) {
state.resumeScheduled = true;
process.nextTick(resume_, stream, state);
}
}
function resume_(stream, state) {
debug("resume", state.reading);
if (!state.reading) {
stream.read(0);
}
state.resumeScheduled = false;
stream.emit("resume");
flow(stream);
if (state.flowing && !state.reading)
stream.read(0);
}
Readable.prototype.pause = function() {
debug("call pause flowing=%j", this._readableState.flowing);
if (this._readableState.flowing !== false) {
debug("pause");
this._readableState.flowing = false;
this.emit("pause");
}
this._readableState.paused = true;
return this;
};
function flow(stream) {
var state = stream._readableState;
debug("flow", state.flowing);
while (state.flowing && stream.read() !== null)
;
}
Readable.prototype.wrap = function(stream) {
var _this = this;
var state = this._readableState;
var paused = false;
stream.on("end", function() {
debug("wrapped end");
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
if (chunk && chunk.length)
_this.push(chunk);
}
_this.push(null);
});
stream.on("data", function(chunk) {
debug("wrapped data");
if (state.decoder)
chunk = state.decoder.write(chunk);
if (state.objectMode && (chunk === null || chunk === undefined))
return;
else if (!state.objectMode && (!chunk || !chunk.length))
return;
var ret = _this.push(chunk);
if (!ret) {
paused = true;
stream.pause();
}
});
for (var i in stream) {
if (this[i] === undefined && typeof stream[i] === "function") {
this[i] = function methodWrap(method) {
return function methodWrapReturnFunction() {
return stream[method].apply(stream, arguments);
};
}(i);
}
}
for (var n = 0;n < kProxyEvents.length; n++) {
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
}
this._read = function(n2) {
debug("wrapped _read", n2);
if (paused) {
paused = false;
stream.resume();
}
};
return this;
};
if (typeof Symbol === "function") {
Readable.prototype[Symbol.asyncIterator] = function() {
if (createReadableStreamAsyncIterator === undefined) {
createReadableStreamAsyncIterator = require_async_iterator();
}
return createReadableStreamAsyncIterator(this);
};
}
Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
enumerable: false,
get: function get() {
return this._readableState.highWaterMark;
}
});
Object.defineProperty(Readable.prototype, "readableBuffer", {
enumerable: false,
get: function get() {
return this._readableState && this._readableState.buffer;
}
});
Object.defineProperty(Readable.prototype, "readableFlowing", {
enumerable: false,
get: function get() {
return this._readableState.flowing;
},
set: function set(state) {
if (this._readableState) {
this._readableState.flowing = state;
}
}
});
Readable._fromList = fromList;
Object.defineProperty(Readable.prototype, "readableLength", {
enumerable: false,
get: function get() {
return this._readableState.length;
}
});
function fromList(n, state) {
if (state.length === 0)
return null;
var ret;
if (state.objectMode)
ret = state.buffer.shift();
else if (!n || n >= state.length) {
if (state.decoder)
ret = state.buffer.join("");
else if (state.buffer.length === 1)
ret = state.buffer.first();
else
ret = state.buffer.concat(state.length);
state.buffer.clear();
} else {
ret = state.buffer.consume(n, state.decoder);
}
return ret;
}
function endReadable(stream) {
var state = stream._readableState;
debug("endReadable", state.endEmitted);
if (!state.endEmitted) {
state.ended = true;
process.nextTick(endReadableNT, state, stream);
}
}
function endReadableNT(state, stream) {
debug("endReadableNT", state.endEmitted, state.length);
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit("end");
if (state.autoDestroy) {
var wState = stream._writableState;
if (!wState || wState.autoDestroy && wState.finished) {
stream.destroy();
}
}
}
}
if (typeof Symbol === "function") {
Readable.from = function(iterable, opts) {
if (from === undefined) {
from = require_from();
}
return from(Readable, iterable, opts);
};
}
function indexOf(xs, x) {
for (var i = 0, l = xs.length;i < l; i++) {
if (xs[i] === x)
return i;
}
return -1;
}
});
// node_modules/readable-stream/lib/_stream_transform.js
var require__stream_transform = __commonJS((exports, module) => {
module.exports = Transform;
var _require$codes = require_errors().codes;
var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING;
var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
var Duplex = require__stream_duplex();
require_inherits()(Transform, Duplex);
function afterTransform(er, data) {
var ts = this._transformState;
ts.transforming = false;
var cb = ts.writecb;
if (cb === null) {
return this.emit("error", new ERR_MULTIPLE_CALLBACK);
}
ts.writechunk = null;
ts.writecb = null;
if (data != null)
this.push(data);
cb(er);
var rs = this._readableState;
rs.reading = false;
if (rs.needReadable || rs.length < rs.highWaterMark) {
this._read(rs.highWaterMark);
}
}
function Transform(options) {
if (!(this instanceof Transform))
return new Transform(options);
Duplex.call(this, options);
this._transformState = {
afterTransform: afterTransform.bind(this),
needTransform: false,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: null
};
this._readableState.needReadable = true;
this._readableState.sync = false;
if (options) {
if (typeof options.transform === "function")
this._transform = options.transform;
if (typeof options.flush === "function")
this._flush = options.flush;
}
this.on("prefinish", prefinish);
}
function prefinish() {
var _this = this;
if (typeof this._flush === "function" && !this._readableState.destroyed) {
this._flush(function(er, data) {
done(_this, er, data);
});
} else {
done(this, null, null);
}
}
Transform.prototype.push = function(chunk, encoding) {
this._transformState.needTransform = false;
return Duplex.prototype.push.call(this, chunk, encoding);
};
Transform.prototype._transform = function(chunk, encoding, cb) {
cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
};
Transform.prototype._write = function(chunk, encoding, cb) {
var ts = this._transformState;
ts.writecb = cb;
ts.writechunk = chunk;
ts.writeencoding = encoding;
if (!ts.transforming) {
var rs = this._readableState;
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
this._read(rs.highWaterMark);
}
};
Transform.prototype._read = function(n) {
var ts = this._transformState;
if (ts.writechunk !== null && !ts.transforming) {
ts.transforming = true;
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
ts.needTransform = true;
}
};
Transform.prototype._destroy = function(err, cb) {
Duplex.prototype._destroy.call(this, err, function(err2) {
cb(err2);
});
};
function done(stream, er, data) {
if (er)
return stream.emit("error", er);
if (data != null)
stream.push(data);
if (stream._writableState.length)
throw new ERR_TRANSFORM_WITH_LENGTH_0;
if (stream._transformState.transforming)
throw new ERR_TRANSFORM_ALREADY_TRANSFORMING;
return stream.push(null);
}
});
// node_modules/readable-stream/lib/_stream_passthrough.js
var require__stream_passthrough = __commonJS((exports, module) => {
module.exports = PassThrough;
var Transform = require__stream_transform();
require_inherits()(PassThrough, Transform);
function PassThrough(options) {
if (!(this instanceof PassThrough))
return new PassThrough(options);
Transform.call(this, options);
}
PassThrough.prototype._transform = function(chunk, encoding, cb) {
cb(null, chunk);
};
});
// node_modules/readable-stream/lib/internal/streams/pipeline.js
var require_pipeline = __commonJS((exports, module) => {
var eos;
function once2(callback) {
var called = false;
return function() {
if (called)
return;
called = true;
callback.apply(undefined, arguments);
};
}
var _require$codes = require_errors().codes;
var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
function noop(err) {
if (err)
throw err;
}
function isRequest(stream) {
return stream.setHeader && typeof stream.abort === "function";
}
function destroyer(stream, reading, writing, callback) {
callback = once2(callback);
var closed = false;
stream.on("close", function() {
closed = true;
});
if (eos === undefined)
eos = require_end_of_stream();
eos(stream, {
readable: reading,
writable: writing
}, function(err) {
if (err)
return callback(err);
closed = true;
callback();
});
var destroyed = false;
return function(err) {
if (closed)
return;
if (destroyed)
return;
destroyed = true;
if (isRequest(stream))
return stream.abort();
if (typeof stream.destroy === "function")
return stream.destroy();
callback(err || new ERR_STREAM_DESTROYED("pipe"));
};
}
function call(fn) {
fn();
}
function pipe(from, to) {
return from.pipe(to);
}
function popCallback(streams) {
if (!streams.length)
return noop;
if (typeof streams[streams.length - 1] !== "function")
return noop;
return streams.pop();
}
function pipeline() {
for (var _len = arguments.length, streams = new Array(_len), _key = 0;_key < _len; _key++) {
streams[_key] = arguments[_key];
}
var callback = popCallback(streams);
if (Array.isArray(streams[0]))
streams = streams[0];
if (streams.length < 2) {
throw new ERR_MISSING_ARGS("streams");
}
var error;
var destroys = streams.map(function(stream, i) {
var reading = i < streams.length - 1;
var writing = i > 0;
return destroyer(stream, reading, writing, function(err) {
if (!error)
error = err;
if (err)
destroys.forEach(call);
if (reading)
return;
destroys.forEach(call);
callback(error);
});
});
return streams.reduce(pipe);
}
module.exports = pipeline;
});
// node_modules/readable-stream/readable.js
var require_readable = __commonJS((exports, module) => {
var Stream = __require("stream");
if (process.env.READABLE_STREAM === "disable" && Stream) {
module.exports = Stream.Readable;
Object.assign(module.exports, Stream);
module.exports.Stream = Stream;
} else {
exports = module.exports = require__stream_readable();
exports.Stream = Stream || exports;
exports.Readable = exports;
exports.Writable = require__stream_writable();
exports.Duplex = require__stream_duplex();
exports.Transform = require__stream_transform();
exports.PassThrough = require__stream_passthrough();
exports.finished = require_end_of_stream();
exports.pipeline = require_pipeline();
}
});
// node_modules/block-stream2/index.js
var require_block_stream2 = __commonJS((exports, module) => {
var { Transform } = require_readable();
class Block extends Transform {
constructor(size, opts = {}) {
super(opts);
if (typeof size === "object") {
opts = size;
size = opts.size;
}
this.size = size || 512;
const { nopad, zeroPadding = true } = opts;
if (nopad)
this._zeroPadding = false;
else
this._zeroPadding = !!zeroPadding;
this._buffered = [];
this._bufferedBytes = 0;
}
_transform(buf, enc, next) {
this._bufferedBytes += buf.length;
this._buffered.push(buf);
while (this._bufferedBytes >= this.size) {
this._bufferedBytes -= this.size;
const blockBufs = [];
let blockBufsBytes = 0;
while (blockBufsBytes < this.size) {
const b = this._buffered.shift();
if (blockBufsBytes + b.length <= this.size) {
blockBufs.push(b);
blockBufsBytes += b.length;
} else {
const neededSize = this.size - blockBufsBytes;
blockBufs.push(b.slice(0, neededSize));
blockBufsBytes += neededSize;
this._buffered.unshift(b.slice(neededSize));
}
}
this.push(Buffer.concat(blockBufs, this.size));
}
next();
}
_flush() {
if (this._bufferedBytes && this._zeroPadding) {
const zeroes = Buffer.alloc(this.size - this._bufferedBytes);
this._buffered.push(zeroes);
this.push(Buffer.concat(this._buffered));
this._buffered = null;
} else if (this._bufferedBytes) {
this.push(Buffer.concat(this._buffered));
this._buffered = null;
}
this.push(null);
}
}
module.exports = Block;
});
// node_modules/browser-or-node/lib/index.js
var require_lib2 = __commonJS((exports) => {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
var isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
var isWebWorker = (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope";
var isJsDom = typeof window !== "undefined" && window.name === "nodejs" || typeof navigator !== "undefined" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
var isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
exports.isBrowser = isBrowser;
exports.isWebWorker = isWebWorker;
exports.isNode = isNode;
exports.isJsDom = isJsDom;
exports.isDeno = isDeno;
});
// node_modules/lodash/lodash.js
var require_lodash = __commonJS((exports, module) => {
(function() {
var undefined2;
var VERSION = "4.17.21";
var LARGE_ARRAY_SIZE = 200;
var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
var HASH_UNDEFINED = "__lodash_hash_undefined__";
var MAX_MEMOIZE_SIZE = 500;
var PLACEHOLDER = "__lodash_placeholder__";
var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
var HOT_COUNT = 800, HOT_SPAN = 16;
var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, NAN = 0 / 0;
var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
var wrapFlags = [
["ary", WRAP_ARY_FLAG],
["bind", WRAP_BIND_FLAG],
["bindKey", WRAP_BIND_KEY_FLAG],
["curry", WRAP_CURRY_FLAG],
["curryRight", WRAP_CURRY_RIGHT_FLAG],
["flip", WRAP_FLIP_FLAG],
["partial", WRAP_PARTIAL_FLAG],
["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
["rearg", WRAP_REARG_FLAG]
];
var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]";
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
var reTrimStart = /^\s+/;
var reWhitespace = /\s/;
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
var reEscapeChar = /\\(\\)?/g;
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
var reFlags = /\w*$/;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var reIsOctal = /^0o[0-7]+$/i;
var reIsUint = /^(?:0|[1-9]\d*)$/;
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
var reNoMatch = /($^)/;
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
var reApos = RegExp(rsApos, "g");
var reComboMark = RegExp(rsCombo, "g");
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
var reUnicodeWord = RegExp([
rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
rsUpper + "+" + rsOptContrUpper,
rsOrdUpper,
rsOrdLower,
rsDigits,
rsEmoji
].join("|"), "g");
var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
var contextProps = [
"Array",
"Buffer",
"DataView",
"Date",
"Error",
"Float32Array",
"Float64Array",
"Function",
"Int8Array",
"Int16Array",
"Int32Array",
"Map",
"Math",
"Object",
"Promise",
"RegExp",
"Set",
"String",
"Symbol",
"TypeError",
"Uint8Array",
"Uint8ClampedArray",
"Uint16Array",
"Uint32Array",
"WeakMap",
"_",
"clearTimeout",
"isFinite",
"parseInt",
"setTimeout"
];
var templateCounter = -1;
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
var deburredLetters = {
"\xC0": "A",
"\xC1": "A",
"\xC2": "A",
"\xC3": "A",
"\xC4": "A",
"\xC5": "A",
"\xE0": "a",
"\xE1": "a",
"\xE2": "a",
"\xE3": "a",
"\xE4": "a",
"\xE5": "a",
"\xC7": "C",
"\xE7": "c",
"\xD0": "D",
"\xF0": "d",
"\xC8": "E",
"\xC9": "E",
"\xCA": "E",
"\xCB": "E",
"\xE8": "e",
"\xE9": "e",
"\xEA": "e",
"\xEB": "e",
"\xCC": "I",
"\xCD": "I",
"\xCE": "I",
"\xCF": "I",
"\xEC": "i",
"\xED": "i",
"\xEE": "i",
"\xEF": "i",
"\xD1": "N",
"\xF1": "n",
"\xD2": "O",
"\xD3": "O",
"\xD4": "O",
"\xD5": "O",
"\xD6": "O",
"\xD8": "O",
"\xF2": "o",
"\xF3": "o",
"\xF4": "o",
"\xF5": "o",
"\xF6": "o",
"\xF8": "o",
"\xD9": "U",
"\xDA": "U",
"\xDB": "U",
"\xDC": "U",
"\xF9": "u",
"\xFA": "u",
"\xFB": "u",
"\xFC": "u",
"\xDD": "Y",
"\xFD": "y",
"\xFF": "y",
"\xC6": "Ae",
"\xE6": "ae",
"\xDE": "Th",
"\xFE": "th",
"\xDF": "ss",
"\u0100": "A",
"\u0102": "A",
"\u0104": "A",
"\u0101": "a",
"\u0103": "a",
"\u0105": "a",
"\u0106": "C",
"\u0108": "C",
"\u010A": "C",
"\u010C": "C",
"\u0107": "c",
"\u0109": "c",
"\u010B": "c",
"\u010D": "c",
"\u010E": "D",
"\u0110": "D",
"\u010F": "d",
"\u0111": "d",
"\u0112": "E",
"\u0114": "E",
"\u0116": "E",
"\u0118": "E",
"\u011A": "E",
"\u0113": "e",
"\u0115": "e",
"\u0117": "e",
"\u0119": "e",
"\u011B": "e",
"\u011C": "G",
"\u011E": "G",
"\u0120": "G",
"\u0122": "G",
"\u011D": "g",
"\u011F": "g",
"\u0121": "g",
"\u0123": "g",
"\u0124": "H",
"\u0126": "H",
"\u0125": "h",
"\u0127": "h",
"\u0128": "I",
"\u012A": "I",
"\u012C": "I",
"\u012E": "I",
"\u0130": "I",
"\u0129": "i",
"\u012B": "i",
"\u012D": "i",
"\u012F": "i",
"\u0131": "i",
"\u0134": "J",
"\u0135": "j",
"\u0136": "K",
"\u0137": "k",
"\u0138": "k",
"\u0139": "L",
"\u013B": "L",
"\u013D": "L",
"\u013F": "L",
"\u0141": "L",
"\u013A": "l",
"\u013C": "l",
"\u013E": "l",
"\u0140": "l",
"\u0142": "l",
"\u0143": "N",
"\u0145": "N",
"\u0147": "N",
"\u014A": "N",
"\u0144": "n",
"\u0146": "n",
"\u0148": "n",
"\u014B": "n",
"\u014C": "O",
"\u014E": "O",
"\u0150": "O",
"\u014D": "o",
"\u014F": "o",
"\u0151": "o",
"\u0154": "R",
"\u0156": "R",
"\u0158": "R",
"\u0155": "r",
"\u0157": "r",
"\u0159": "r",
"\u015A": "S",
"\u015C": "S",
"\u015E": "S",
"\u0160": "S",
"\u015B": "s",
"\u015D": "s",
"\u015F": "s",
"\u0161": "s",
"\u0162": "T",
"\u0164": "T",
"\u0166": "T",
"\u0163": "t",
"\u0165": "t",
"\u0167": "t",
"\u0168": "U",
"\u016A": "U",
"\u016C": "U",
"\u016E": "U",
"\u0170": "U",
"\u0172": "U",
"\u0169": "u",
"\u016B": "u",
"\u016D": "u",
"\u016F": "u",
"\u0171": "u",
"\u0173": "u",
"\u0174": "W",
"\u0175": "w",
"\u0176": "Y",
"\u0177": "y",
"\u0178": "Y",
"\u0179": "Z",
"\u017B": "Z",
"\u017D": "Z",
"\u017A": "z",
"\u017C": "z",
"\u017E": "z",
"\u0132": "IJ",
"\u0133": "ij",
"\u0152": "Oe",
"\u0153": "oe",
"\u0149": "'n",
"\u017F": "s"
};
var htmlEscapes = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;"
};
var htmlUnescapes = {
"&amp;": "&",
"&lt;": "<",
"&gt;": ">",
"&quot;": '"',
"&#39;": "'"
};
var stringEscapes = {
"\\": "\\",
"'": "'",
"\n": "n",
"\r": "r",
"\u2028": "u2028",
"\u2029": "u2029"
};
var freeParseFloat = parseFloat, freeParseInt = parseInt;
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal || freeSelf || Function("return this")();
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
var moduleExports = freeModule && freeModule.exports === freeExports;
var freeProcess = moduleExports && freeGlobal.process;
var nodeUtil = function() {
try {
var types = freeModule && freeModule.require && freeModule.require("util").types;
if (types) {
return types;
}
return freeProcess && freeProcess.binding && freeProcess.binding("util");
} catch (e) {}
}();
var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
function apply(func, thisArg, args) {
switch (args.length) {
case 0:
return func.call(thisArg);
case 1:
return func.call(thisArg, args[0]);
case 2:
return func.call(thisArg, args[0], args[1]);
case 3:
return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1, length = array == null ? 0 : array.length;
while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
}
function arrayEach(array, iteratee) {
var index = -1, length = array == null ? 0 : array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
function arrayEachRight(array, iteratee) {
var length = array == null ? 0 : array.length;
while (length--) {
if (iteratee(array[length], length, array) === false) {
break;
}
}
return array;
}
function arrayEvery(array, predicate) {
var index = -1, length = array == null ? 0 : array.length;
while (++index < length) {
if (!predicate(array[index], index, array)) {
return false;
}
}
return true;
}
function arrayFilter(array, predicate) {
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
}
function arrayIncludesWith(array, value, comparator) {
var index = -1, length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
function arrayMap(array, iteratee) {
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
function arrayPush(array, values) {
var index = -1, length = values.length, offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1, length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
}
return accumulator;
}
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
var length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[--length];
}
while (length--) {
accumulator = iteratee(accumulator, array[length], length, array);
}
return accumulator;
}
function arraySome(array, predicate) {
var index = -1, length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
var asciiSize = baseProperty("length");
function asciiToArray(string) {
return string.split("");
}
function asciiWords(string) {
return string.match(reAsciiWord) || [];
}
function baseFindKey(collection, predicate, eachFunc) {
var result;
eachFunc(collection, function(value, key, collection2) {
if (predicate(value, key, collection2)) {
result = key;
return false;
}
});
return result;
}
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
while (fromRight ? index-- : ++index < length) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
function baseIndexOf(array, value, fromIndex) {
return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
}
function baseIndexOfWith(array, value, fromIndex, comparator) {
var index = fromIndex - 1, length = array.length;
while (++index < length) {
if (comparator(array[index], value)) {
return index;
}
}
return -1;
}
function baseIsNaN(value) {
return value !== value;
}
function baseMean(array, iteratee) {
var length = array == null ? 0 : array.length;
return length ? baseSum(array, iteratee) / length : NAN;
}
function baseProperty(key) {
return function(object) {
return object == null ? undefined2 : object[key];
};
}
function basePropertyOf(object) {
return function(key) {
return object == null ? undefined2 : object[key];
};
}
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
eachFunc(collection, function(value, index, collection2) {
accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
});
return accumulator;
}
function baseSortBy(array, comparer) {
var length = array.length;
array.sort(comparer);
while (length--) {
array[length] = array[length].value;
}
return array;
}
function baseSum(array, iteratee) {
var result, index = -1, length = array.length;
while (++index < length) {
var current = iteratee(array[index]);
if (current !== undefined2) {
result = result === undefined2 ? current : result + current;
}
}
return result;
}
function baseTimes(n, iteratee) {
var index = -1, result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
function baseToPairs(object, props) {
return arrayMap(props, function(key) {
return [key, object[key]];
});
}
function baseTrim(string) {
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
}
function baseUnary(func) {
return function(value) {
return func(value);
};
}
function baseValues(object, props) {
return arrayMap(props, function(key) {
return object[key];
});
}
function cacheHas(cache, key) {
return cache.has(key);
}
function charsStartIndex(strSymbols, chrSymbols) {
var index = -1, length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
function countHolders(array, placeholder) {
var length = array.length, result = 0;
while (length--) {
if (array[length] === placeholder) {
++result;
}
}
return result;
}
var deburrLetter = basePropertyOf(deburredLetters);
var escapeHtmlChar = basePropertyOf(htmlEscapes);
function escapeStringChar(chr) {
return "\\" + stringEscapes[chr];
}
function getValue(object, key) {
return object == null ? undefined2 : object[key];
}
function hasUnicode(string) {
return reHasUnicode.test(string);
}
function hasUnicodeWord(string) {
return reHasUnicodeWord.test(string);
}
function iteratorToArray(iterator) {
var data, result = [];
while (!(data = iterator.next()).done) {
result.push(data.value);
}
return result;
}
function mapToArray(map2) {
var index = -1, result = Array(map2.size);
map2.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
function replaceHolders(array, placeholder) {
var index = -1, length = array.length, resIndex = 0, result = [];
while (++index < length) {
var value = array[index];
if (value === placeholder || value === PLACEHOLDER) {
array[index] = PLACEHOLDER;
result[resIndex++] = index;
}
}
return result;
}
function setToArray(set) {
var index = -1, result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
function setToPairs(set) {
var index = -1, result = Array(set.size);
set.forEach(function(value) {
result[++index] = [value, value];
});
return result;
}
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1, length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
function strictLastIndexOf(array, value, fromIndex) {
var index = fromIndex + 1;
while (index--) {
if (array[index] === value) {
return index;
}
}
return index;
}
function stringSize(string) {
return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
}
function stringToArray(string) {
return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
}
function trimmedEndIndex(string) {
var index = string.length;
while (index-- && reWhitespace.test(string.charAt(index))) {}
return index;
}
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
function unicodeSize(string) {
var result = reUnicode.lastIndex = 0;
while (reUnicode.test(string)) {
++result;
}
return result;
}
function unicodeToArray(string) {
return string.match(reUnicode) || [];
}
function unicodeWords(string) {
return string.match(reUnicodeWord) || [];
}
var runInContext = function runInContext(context) {
context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
var { Array: Array2, Date: Date2, Error: Error2, Function: Function2, Math: Math2, Object: Object2, RegExp: RegExp2, String: String2, TypeError: TypeError2 } = context;
var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
var coreJsData = context["__core-js_shared__"];
var funcToString = funcProto.toString;
var hasOwnProperty = objectProto.hasOwnProperty;
var idCounter = 0;
var maskSrcKey = function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
return uid ? "Symbol(src)_1." + uid : "";
}();
var nativeObjectToString = objectProto.toString;
var objectCtorString = funcToString.call(Object2);
var oldDash = root._;
var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
var defineProperty = function() {
try {
var func = getNative(Object2, "defineProperty");
func({}, "", {});
return func;
} catch (e) {}
}();
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
var { ceil: nativeCeil, floor: nativeFloor } = Math2, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
var metaMap = WeakMap2 && new WeakMap2;
var realNames = {};
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap2);
var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
function lodash(value) {
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
if (value instanceof LodashWrapper) {
return value;
}
if (hasOwnProperty.call(value, "__wrapped__")) {
return wrapperClone(value);
}
}
return new LodashWrapper(value);
}
var baseCreate = function() {
function object() {}
return function(proto) {
if (!isObject(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
object.prototype = proto;
var result2 = new object;
object.prototype = undefined2;
return result2;
};
}();
function baseLodash() {}
function LodashWrapper(value, chainAll) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__chain__ = !!chainAll;
this.__index__ = 0;
this.__values__ = undefined2;
}
lodash.templateSettings = {
escape: reEscape,
evaluate: reEvaluate,
interpolate: reInterpolate,
variable: "",
imports: {
_: lodash
}
};
lodash.prototype = baseLodash.prototype;
lodash.prototype.constructor = lodash;
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;
function LazyWrapper(value) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__dir__ = 1;
this.__filtered__ = false;
this.__iteratees__ = [];
this.__takeCount__ = MAX_ARRAY_LENGTH;
this.__views__ = [];
}
function lazyClone() {
var result2 = new LazyWrapper(this.__wrapped__);
result2.__actions__ = copyArray(this.__actions__);
result2.__dir__ = this.__dir__;
result2.__filtered__ = this.__filtered__;
result2.__iteratees__ = copyArray(this.__iteratees__);
result2.__takeCount__ = this.__takeCount__;
result2.__views__ = copyArray(this.__views__);
return result2;
}
function lazyReverse() {
if (this.__filtered__) {
var result2 = new LazyWrapper(this);
result2.__dir__ = -1;
result2.__filtered__ = true;
} else {
result2 = this.clone();
result2.__dir__ *= -1;
}
return result2;
}
function lazyValue() {
var array = this.__wrapped__.value(), dir2 = this.__dir__, isArr = isArray(array), isRight = dir2 < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__);
if (!isArr || !isRight && arrLength == length && takeCount == length) {
return baseWrapperValue(array, this.__actions__);
}
var result2 = [];
outer:
while (length-- && resIndex < takeCount) {
index += dir2;
var iterIndex = -1, value = array[index];
while (++iterIndex < iterLength) {
var data = iteratees[iterIndex], iteratee2 = data.iteratee, type = data.type, computed = iteratee2(value);
if (type == LAZY_MAP_FLAG) {
value = computed;
} else if (!computed) {
if (type == LAZY_FILTER_FLAG) {
continue outer;
} else {
break outer;
}
}
}
result2[resIndex++] = value;
}
return result2;
}
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;
function Hash(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
this.size = 0;
}
function hashDelete(key) {
var result2 = this.has(key) && delete this.__data__[key];
this.size -= result2 ? 1 : 0;
return result2;
}
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result2 = data[key];
return result2 === HASH_UNDEFINED ? undefined2 : result2;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined2;
}
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== undefined2 : hasOwnProperty.call(data, key);
}
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value;
return this;
}
Hash.prototype.clear = hashClear;
Hash.prototype["delete"] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
function ListCache(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
function listCacheDelete(key) {
var data = this.__data__, index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
function listCacheGet(key) {
var data = this.__data__, index = assocIndexOf(data, key);
return index < 0 ? undefined2 : data[index][1];
}
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
function listCacheSet(key, value) {
var data = this.__data__, index = assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype["delete"] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
function MapCache(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
function mapCacheClear() {
this.size = 0;
this.__data__ = {
hash: new Hash,
map: new (Map || ListCache),
string: new Hash
};
}
function mapCacheDelete(key) {
var result2 = getMapData(this, key)["delete"](key);
this.size -= result2 ? 1 : 0;
return result2;
}
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
function mapCacheSet(key, value) {
var data = getMapData(this, key), size2 = data.size;
data.set(key, value);
this.size += data.size == size2 ? 0 : 1;
return this;
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype["delete"] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
function SetCache(values2) {
var index = -1, length = values2 == null ? 0 : values2.length;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values2[index]);
}
}
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
function setCacheHas(value) {
return this.__data__.has(value);
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
function stackClear() {
this.__data__ = new ListCache;
this.size = 0;
}
function stackDelete(key) {
var data = this.__data__, result2 = data["delete"](key);
this.size = data.size;
return result2;
}
function stackGet(key) {
return this.__data__.get(key);
}
function stackHas(key) {
return this.__data__.has(key);
}
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
Stack.prototype.clear = stackClear;
Stack.prototype["delete"] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
function arrayLikeKeys(value, inherited) {
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
result2.push(key);
}
}
return result2;
}
function arraySample(array) {
var length = array.length;
return length ? array[baseRandom(0, length - 1)] : undefined2;
}
function arraySampleSize(array, n) {
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
}
function arrayShuffle(array) {
return shuffleSelf(copyArray(array));
}
function assignMergeValue(object, key, value) {
if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) {
baseAssignValue(object, key, value);
}
}
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) {
baseAssignValue(object, key, value);
}
}
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
function baseAggregator(collection, setter, iteratee2, accumulator) {
baseEach(collection, function(value, key, collection2) {
setter(accumulator, value, iteratee2(value), collection2);
});
return accumulator;
}
function baseAssign(object, source) {
return object && copyObject(source, keys(source), object);
}
function baseAssignIn(object, source) {
return object && copyObject(source, keysIn(source), object);
}
function baseAssignValue(object, key, value) {
if (key == "__proto__" && defineProperty) {
defineProperty(object, key, {
configurable: true,
enumerable: true,
value,
writable: true
});
} else {
object[key] = value;
}
}
function baseAt(object, paths) {
var index = -1, length = paths.length, result2 = Array2(length), skip = object == null;
while (++index < length) {
result2[index] = skip ? undefined2 : get(object, paths[index]);
}
return result2;
}
function baseClamp(number, lower, upper) {
if (number === number) {
if (upper !== undefined2) {
number = number <= upper ? number : upper;
}
if (lower !== undefined2) {
number = number >= lower ? number : lower;
}
}
return number;
}
function baseClone(value, bitmask, customizer, key, object, stack) {
var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
if (customizer) {
result2 = object ? customizer(value, key, object, stack) : customizer(value);
}
if (result2 !== undefined2) {
return result2;
}
if (!isObject(value)) {
return value;
}
var isArr = isArray(value);
if (isArr) {
result2 = initCloneArray(value);
if (!isDeep) {
return copyArray(value, result2);
}
} else {
var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (tag == objectTag || tag == argsTag || isFunc && !object) {
result2 = isFlat || isFunc ? {} : initCloneObject(value);
if (!isDeep) {
return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
}
result2 = initCloneByTag(value, tag, isDeep);
}
}
stack || (stack = new Stack);
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result2);
if (isSet(value)) {
value.forEach(function(subValue) {
result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
});
} else if (isMap(value)) {
value.forEach(function(subValue, key2) {
result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
});
}
var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
var props = isArr ? undefined2 : keysFunc(value);
arrayEach(props || value, function(subValue, key2) {
if (props) {
key2 = subValue;
subValue = value[key2];
}
assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
});
return result2;
}
function baseConforms(source) {
var props = keys(source);
return function(object) {
return baseConformsTo(object, source, props);
};
}
function baseConformsTo(object, source, props) {
var length = props.length;
if (object == null) {
return !length;
}
object = Object2(object);
while (length--) {
var key = props[length], predicate = source[key], value = object[key];
if (value === undefined2 && !(key in object) || !predicate(value)) {
return false;
}
}
return true;
}
function baseDelay(func, wait, args) {
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
return setTimeout2(function() {
func.apply(undefined2, args);
}, wait);
}
function baseDifference(array, values2, iteratee2, comparator) {
var index = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length;
if (!length) {
return result2;
}
if (iteratee2) {
values2 = arrayMap(values2, baseUnary(iteratee2));
}
if (comparator) {
includes2 = arrayIncludesWith;
isCommon = false;
} else if (values2.length >= LARGE_ARRAY_SIZE) {
includes2 = cacheHas;
isCommon = false;
values2 = new SetCache(values2);
}
outer:
while (++index < length) {
var value = array[index], computed = iteratee2 == null ? value : iteratee2(value);
value = comparator || value !== 0 ? value : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values2[valuesIndex] === computed) {
continue outer;
}
}
result2.push(value);
} else if (!includes2(values2, computed, comparator)) {
result2.push(value);
}
}
return result2;
}
var baseEach = createBaseEach(baseForOwn);
var baseEachRight = createBaseEach(baseForOwnRight, true);
function baseEvery(collection, predicate) {
var result2 = true;
baseEach(collection, function(value, index, collection2) {
result2 = !!predicate(value, index, collection2);
return result2;
});
return result2;
}
function baseExtremum(array, iteratee2, comparator) {
var index = -1, length = array.length;
while (++index < length) {
var value = array[index], current = iteratee2(value);
if (current != null && (computed === undefined2 ? current === current && !isSymbol(current) : comparator(current, computed))) {
var computed = current, result2 = value;
}
}
return result2;
}
function baseFill(array, value, start, end) {
var length = array.length;
start = toInteger(start);
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end = end === undefined2 || end > length ? length : toInteger(end);
if (end < 0) {
end += length;
}
end = start > end ? 0 : toLength(end);
while (start < end) {
array[start++] = value;
}
return array;
}
function baseFilter(collection, predicate) {
var result2 = [];
baseEach(collection, function(value, index, collection2) {
if (predicate(value, index, collection2)) {
result2.push(value);
}
});
return result2;
}
function baseFlatten(array, depth, predicate, isStrict, result2) {
var index = -1, length = array.length;
predicate || (predicate = isFlattenable);
result2 || (result2 = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
baseFlatten(value, depth - 1, predicate, isStrict, result2);
} else {
arrayPush(result2, value);
}
} else if (!isStrict) {
result2[result2.length] = value;
}
}
return result2;
}
var baseFor = createBaseFor();
var baseForRight = createBaseFor(true);
function baseForOwn(object, iteratee2) {
return object && baseFor(object, iteratee2, keys);
}
function baseForOwnRight(object, iteratee2) {
return object && baseForRight(object, iteratee2, keys);
}
function baseFunctions(object, props) {
return arrayFilter(props, function(key) {
return isFunction(object[key]);
});
}
function baseGet(object, path) {
path = castPath(path, object);
var index = 0, length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return index && index == length ? object : undefined2;
}
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result2 = keysFunc(object);
return isArray(object) ? result2 : arrayPush(result2, symbolsFunc(object));
}
function baseGetTag(value) {
if (value == null) {
return value === undefined2 ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object2(value) ? getRawTag(value) : objectToString(value);
}
function baseGt(value, other) {
return value > other;
}
function baseHas(object, key) {
return object != null && hasOwnProperty.call(object, key);
}
function baseHasIn(object, key) {
return object != null && key in Object2(object);
}
function baseInRange(number, start, end) {
return number >= nativeMin(start, end) && number < nativeMax(start, end);
}
function baseIntersection(arrays, iteratee2, comparator) {
var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
while (othIndex--) {
var array = arrays[othIndex];
if (othIndex && iteratee2) {
array = arrayMap(array, baseUnary(iteratee2));
}
maxLength = nativeMin(array.length, maxLength);
caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2;
}
array = arrays[0];
var index = -1, seen = caches[0];
outer:
while (++index < length && result2.length < maxLength) {
var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
value = comparator || value !== 0 ? value : 0;
if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) {
othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
continue outer;
}
}
if (seen) {
seen.push(computed);
}
result2.push(value);
}
}
return result2;
}
function baseInverter(object, setter, iteratee2, accumulator) {
baseForOwn(object, function(value, key, object2) {
setter(accumulator, iteratee2(value), key, object2);
});
return accumulator;
}
function baseInvoke(object, path, args) {
path = castPath(path, object);
object = parent(object, path);
var func = object == null ? object : object[toKey(last(path))];
return func == null ? undefined2 : apply(func, object, args);
}
function baseIsArguments(value) {
return isObjectLike(value) && baseGetTag(value) == argsTag;
}
function baseIsArrayBuffer(value) {
return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
}
function baseIsDate(value) {
return isObjectLike(value) && baseGetTag(value) == dateTag;
}
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
if (isSameTag && isBuffer(object)) {
if (!isBuffer(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
function baseIsMap(value) {
return isObjectLike(value) && getTag(value) == mapTag;
}
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length, length = index, noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object2(object);
while (index--) {
var data = matchData[index];
if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0], objValue = object[key], srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined2 && !(key in object)) {
return false;
}
} else {
var stack = new Stack;
if (customizer) {
var result2 = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) {
return false;
}
}
}
return true;
}
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
function baseIsRegExp(value) {
return isObjectLike(value) && baseGetTag(value) == regexpTag;
}
function baseIsSet(value) {
return isObjectLike(value) && getTag(value) == setTag;
}
function baseIsTypedArray(value) {
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}
function baseIteratee(value) {
if (typeof value == "function") {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == "object") {
return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
}
return property(value);
}
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result2 = [];
for (var key in Object2(object)) {
if (hasOwnProperty.call(object, key) && key != "constructor") {
result2.push(key);
}
}
return result2;
}
function baseKeysIn(object) {
if (!isObject(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object), result2 = [];
for (var key in object) {
if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
result2.push(key);
}
}
return result2;
}
function baseLt(value, other) {
return value < other;
}
function baseMap(collection, iteratee2) {
var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
baseEach(collection, function(value, key, collection2) {
result2[++index] = iteratee2(value, key, collection2);
});
return result2;
}
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || baseIsMatch(object, source, matchData);
};
}
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function(object) {
var objValue = get(object, path);
return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
};
}
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
baseFor(source, function(srcValue, key) {
stack || (stack = new Stack);
if (isObject(srcValue)) {
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
} else {
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
if (newValue === undefined2) {
newValue = srcValue;
}
assignMergeValue(object, key, newValue);
}
}, keysIn);
}
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
var isCommon = newValue === undefined2;
if (isCommon) {
var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray(objValue)) {
newValue = objValue;
} else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
} else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
} else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
} else {
newValue = [];
}
} else if (isPlainObject(srcValue) || isArguments(srcValue)) {
newValue = objValue;
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
} else if (!isObject(objValue) || isFunction(objValue)) {
newValue = initCloneObject(srcValue);
}
} else {
isCommon = false;
}
}
if (isCommon) {
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack["delete"](srcValue);
}
assignMergeValue(object, key, newValue);
}
function baseNth(array, n) {
var length = array.length;
if (!length) {
return;
}
n += n < 0 ? length : 0;
return isIndex(n, length) ? array[n] : undefined2;
}
function baseOrderBy(collection, iteratees, orders) {
if (iteratees.length) {
iteratees = arrayMap(iteratees, function(iteratee2) {
if (isArray(iteratee2)) {
return function(value) {
return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
};
}
return iteratee2;
});
} else {
iteratees = [identity];
}
var index = -1;
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
var result2 = baseMap(collection, function(value, key, collection2) {
var criteria = arrayMap(iteratees, function(iteratee2) {
return iteratee2(value);
});
return { criteria, index: ++index, value };
});
return baseSortBy(result2, function(object, other) {
return compareMultiple(object, other, orders);
});
}
function basePick(object, paths) {
return basePickBy(object, paths, function(value, path) {
return hasIn(object, path);
});
}
function basePickBy(object, paths, predicate) {
var index = -1, length = paths.length, result2 = {};
while (++index < length) {
var path = paths[index], value = baseGet(object, path);
if (predicate(value, path)) {
baseSet(result2, castPath(path, object), value);
}
}
return result2;
}
function basePropertyDeep(path) {
return function(object) {
return baseGet(object, path);
};
}
function basePullAll(array, values2, iteratee2, comparator) {
var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array;
if (array === values2) {
values2 = copyArray(values2);
}
if (iteratee2) {
seen = arrayMap(array, baseUnary(iteratee2));
}
while (++index < length) {
var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
if (seen !== array) {
splice.call(seen, fromIndex, 1);
}
splice.call(array, fromIndex, 1);
}
}
return array;
}
function basePullAt(array, indexes) {
var length = array ? indexes.length : 0, lastIndex = length - 1;
while (length--) {
var index = indexes[length];
if (length == lastIndex || index !== previous) {
var previous = index;
if (isIndex(index)) {
splice.call(array, index, 1);
} else {
baseUnset(array, index);
}
}
}
return array;
}
function baseRandom(lower, upper) {
return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
}
function baseRange(start, end, step, fromRight) {
var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length);
while (length--) {
result2[fromRight ? length : ++index] = start;
start += step;
}
return result2;
}
function baseRepeat(string, n) {
var result2 = "";
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
return result2;
}
do {
if (n % 2) {
result2 += string;
}
n = nativeFloor(n / 2);
if (n) {
string += string;
}
} while (n);
return result2;
}
function baseRest(func, start) {
return setToString(overRest(func, start, identity), func + "");
}
function baseSample(collection) {
return arraySample(values(collection));
}
function baseSampleSize(collection, n) {
var array = values(collection);
return shuffleSelf(array, baseClamp(n, 0, array.length));
}
function baseSet(object, path, value, customizer) {
if (!isObject(object)) {
return object;
}
path = castPath(path, object);
var index = -1, length = path.length, lastIndex = length - 1, nested = object;
while (nested != null && ++index < length) {
var key = toKey(path[index]), newValue = value;
if (key === "__proto__" || key === "constructor" || key === "prototype") {
return object;
}
if (index != lastIndex) {
var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined2;
if (newValue === undefined2) {
newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
}
}
assignValue(nested, key, newValue);
nested = nested[key];
}
return object;
}
var baseSetData = !metaMap ? identity : function(func, data) {
metaMap.set(func, data);
return func;
};
var baseSetToString = !defineProperty ? identity : function(func, string) {
return defineProperty(func, "toString", {
configurable: true,
enumerable: false,
value: constant(string),
writable: true
});
};
function baseShuffle(collection) {
return shuffleSelf(values(collection));
}
function baseSlice(array, start, end) {
var index = -1, length = array.length;
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : end - start >>> 0;
start >>>= 0;
var result2 = Array2(length);
while (++index < length) {
result2[index] = array[index + start];
}
return result2;
}
function baseSome(collection, predicate) {
var result2;
baseEach(collection, function(value, index, collection2) {
result2 = predicate(value, index, collection2);
return !result2;
});
return !!result2;
}
function baseSortedIndex(array, value, retHighest) {
var low = 0, high = array == null ? low : array.length;
if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
while (low < high) {
var mid = low + high >>> 1, computed = array[mid];
if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
low = mid + 1;
} else {
high = mid;
}
}
return high;
}
return baseSortedIndexBy(array, value, identity, retHighest);
}
function baseSortedIndexBy(array, value, iteratee2, retHighest) {
var low = 0, high = array == null ? 0 : array.length;
if (high === 0) {
return 0;
}
value = iteratee2(value);
var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined2;
while (low < high) {
var mid = nativeFloor((low + high) / 2), computed = iteratee2(array[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
if (valIsNaN) {
var setLow = retHighest || othIsReflexive;
} else if (valIsUndefined) {
setLow = othIsReflexive && (retHighest || othIsDefined);
} else if (valIsNull) {
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
} else if (valIsSymbol) {
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
} else if (othIsNull || othIsSymbol) {
setLow = false;
} else {
setLow = retHighest ? computed <= value : computed < value;
}
if (setLow) {
low = mid + 1;
} else {
high = mid;
}
}
return nativeMin(high, MAX_ARRAY_INDEX);
}
function baseSortedUniq(array, iteratee2) {
var index = -1, length = array.length, resIndex = 0, result2 = [];
while (++index < length) {
var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
if (!index || !eq(computed, seen)) {
var seen = computed;
result2[resIndex++] = value === 0 ? 0 : value;
}
}
return result2;
}
function baseToNumber(value) {
if (typeof value == "number") {
return value;
}
if (isSymbol(value)) {
return NAN;
}
return +value;
}
function baseToString(value) {
if (typeof value == "string") {
return value;
}
if (isArray(value)) {
return arrayMap(value, baseToString) + "";
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : "";
}
var result2 = value + "";
return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
}
function baseUniq(array, iteratee2, comparator) {
var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2;
if (comparator) {
isCommon = false;
includes2 = arrayIncludesWith;
} else if (length >= LARGE_ARRAY_SIZE) {
var set2 = iteratee2 ? null : createSet(array);
if (set2) {
return setToArray(set2);
}
isCommon = false;
includes2 = cacheHas;
seen = new SetCache;
} else {
seen = iteratee2 ? [] : result2;
}
outer:
while (++index < length) {
var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
value = comparator || value !== 0 ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee2) {
seen.push(computed);
}
result2.push(value);
} else if (!includes2(seen, computed, comparator)) {
if (seen !== result2) {
seen.push(computed);
}
result2.push(value);
}
}
return result2;
}
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last(path))];
}
function baseUpdate(object, path, updater, customizer) {
return baseSet(object, path, updater(baseGet(object, path)), customizer);
}
function baseWhile(array, predicate, isDrop, fromRight) {
var length = array.length, index = fromRight ? length : -1;
while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {}
return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
}
function baseWrapperValue(value, actions) {
var result2 = value;
if (result2 instanceof LazyWrapper) {
result2 = result2.value();
}
return arrayReduce(actions, function(result3, action) {
return action.func.apply(action.thisArg, arrayPush([result3], action.args));
}, result2);
}
function baseXor(arrays, iteratee2, comparator) {
var length = arrays.length;
if (length < 2) {
return length ? baseUniq(arrays[0]) : [];
}
var index = -1, result2 = Array2(length);
while (++index < length) {
var array = arrays[index], othIndex = -1;
while (++othIndex < length) {
if (othIndex != index) {
result2[index] = baseDifference(result2[index] || array, arrays[othIndex], iteratee2, comparator);
}
}
}
return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
}
function baseZipObject(props, values2, assignFunc) {
var index = -1, length = props.length, valsLength = values2.length, result2 = {};
while (++index < length) {
var value = index < valsLength ? values2[index] : undefined2;
assignFunc(result2, props[index], value);
}
return result2;
}
function castArrayLikeObject(value) {
return isArrayLikeObject(value) ? value : [];
}
function castFunction(value) {
return typeof value == "function" ? value : identity;
}
function castPath(value, object) {
if (isArray(value)) {
return value;
}
return isKey(value, object) ? [value] : stringToPath(toString(value));
}
var castRest = baseRest;
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined2 ? length : end;
return !start && end >= length ? array : baseSlice(array, start, end);
}
var clearTimeout2 = ctxClearTimeout || function(id) {
return root.clearTimeout(id);
};
function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
buffer.copy(result2);
return result2;
}
function cloneArrayBuffer(arrayBuffer) {
var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
new Uint8Array(result2).set(new Uint8Array(arrayBuffer));
return result2;
}
function cloneDataView(dataView, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
function cloneRegExp(regexp) {
var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
result2.lastIndex = regexp.lastIndex;
return result2;
}
function cloneSymbol(symbol) {
return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {};
}
function cloneTypedArray(typedArray, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
function compareAscending(value, other) {
if (value !== other) {
var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
return 1;
}
if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
return -1;
}
}
return 0;
}
function compareMultiple(object, other, orders) {
var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
while (++index < length) {
var result2 = compareAscending(objCriteria[index], othCriteria[index]);
if (result2) {
if (index >= ordersLength) {
return result2;
}
var order = orders[index];
return result2 * (order == "desc" ? -1 : 1);
}
}
return object.index - other.index;
}
function composeArgs(args, partials, holders, isCurried) {
var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried;
while (++leftIndex < leftLength) {
result2[leftIndex] = partials[leftIndex];
}
while (++argsIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result2[holders[argsIndex]] = args[argsIndex];
}
}
while (rangeLength--) {
result2[leftIndex++] = args[argsIndex++];
}
return result2;
}
function composeArgsRight(args, partials, holders, isCurried) {
var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried;
while (++argsIndex < rangeLength) {
result2[argsIndex] = args[argsIndex];
}
var offset = argsIndex;
while (++rightIndex < rightLength) {
result2[offset + rightIndex] = partials[rightIndex];
}
while (++holdersIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result2[offset + holders[holdersIndex]] = args[argsIndex++];
}
}
return result2;
}
function copyArray(source, array) {
var index = -1, length = source.length;
array || (array = Array2(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
function copyObject(source, props, object, customizer) {
var isNew = !object;
object || (object = {});
var index = -1, length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
if (newValue === undefined2) {
newValue = source[key];
}
if (isNew) {
baseAssignValue(object, key, newValue);
} else {
assignValue(object, key, newValue);
}
}
return object;
}
function copySymbols(source, object) {
return copyObject(source, getSymbols(source), object);
}
function copySymbolsIn(source, object) {
return copyObject(source, getSymbolsIn(source), object);
}
function createAggregator(setter, initializer) {
return function(collection, iteratee2) {
var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
};
}
function createAssigner(assigner) {
return baseRest(function(object, sources) {
var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined2 : customizer;
length = 1;
}
object = Object2(object);
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, index, customizer);
}
}
return object;
});
}
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee2) {
if (collection == null) {
return collection;
}
if (!isArrayLike2(collection)) {
return eachFunc(collection, iteratee2);
}
var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection);
while (fromRight ? index-- : ++index < length) {
if (iteratee2(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
function createBaseFor(fromRight) {
return function(object, iteratee2, keysFunc) {
var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee2(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
function createBind(func, bitmask, thisArg) {
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
function wrapper() {
var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
return fn.apply(isBind ? thisArg : this, arguments);
}
return wrapper;
}
function createCaseFirst(methodName) {
return function(string) {
string = toString(string);
var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
var chr = strSymbols ? strSymbols[0] : string.charAt(0);
var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
return chr[methodName]() + trailing;
};
}
function createCompounder(callback) {
return function(string) {
return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
};
}
function createCtor(Ctor) {
return function() {
var args = arguments;
switch (args.length) {
case 0:
return new Ctor;
case 1:
return new Ctor(args[0]);
case 2:
return new Ctor(args[0], args[1]);
case 3:
return new Ctor(args[0], args[1], args[2]);
case 4:
return new Ctor(args[0], args[1], args[2], args[3]);
case 5:
return new Ctor(args[0], args[1], args[2], args[3], args[4]);
case 6:
return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7:
return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
}
var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
return isObject(result2) ? result2 : thisBinding;
};
}
function createCurry(func, bitmask, arity) {
var Ctor = createCtor(func);
function wrapper() {
var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper);
while (index--) {
args[index] = arguments[index];
}
var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
length -= holders.length;
if (length < arity) {
return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, undefined2, args, holders, undefined2, undefined2, arity - length);
}
var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
return apply(fn, this, args);
}
return wrapper;
}
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object2(collection);
if (!isArrayLike2(collection)) {
var iteratee2 = getIteratee(predicate, 3);
collection = keys(collection);
predicate = function(key) {
return iteratee2(iterable[key], key, iterable);
};
}
var index = findIndexFunc(collection, predicate, fromIndex);
return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
};
}
function createFlow(fromRight) {
return flatRest(function(funcs) {
var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
if (fromRight) {
funcs.reverse();
}
while (index--) {
var func = funcs[index];
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
if (prereq && !wrapper && getFuncName(func) == "wrapper") {
var wrapper = new LodashWrapper([], true);
}
}
index = wrapper ? index : length;
while (++index < length) {
func = funcs[index];
var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
} else {
wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
}
}
return function() {
var args = arguments, value = args[0];
if (wrapper && args.length == 1 && isArray(value)) {
return wrapper.plant(value).value();
}
var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
while (++index2 < length) {
result2 = funcs[index2].call(this, result2);
}
return result2;
};
});
}
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func);
function wrapper() {
var length = arguments.length, args = Array2(length), index = length;
while (index--) {
args[index] = arguments[index];
}
if (isCurried) {
var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
}
if (partials) {
args = composeArgs(args, partials, holders, isCurried);
}
if (partialsRight) {
args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
}
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary2, arity - length);
}
var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
length = args.length;
if (argPos) {
args = reorder(args, argPos);
} else if (isFlip && length > 1) {
args.reverse();
}
if (isAry && ary2 < length) {
args.length = ary2;
}
if (this && this !== root && this instanceof wrapper) {
fn = Ctor || createCtor(fn);
}
return fn.apply(thisBinding, args);
}
return wrapper;
}
function createInverter(setter, toIteratee) {
return function(object, iteratee2) {
return baseInverter(object, setter, toIteratee(iteratee2), {});
};
}
function createMathOperation(operator, defaultValue) {
return function(value, other) {
var result2;
if (value === undefined2 && other === undefined2) {
return defaultValue;
}
if (value !== undefined2) {
result2 = value;
}
if (other !== undefined2) {
if (result2 === undefined2) {
return other;
}
if (typeof value == "string" || typeof other == "string") {
value = baseToString(value);
other = baseToString(other);
} else {
value = baseToNumber(value);
other = baseToNumber(other);
}
result2 = operator(value, other);
}
return result2;
};
}
function createOver(arrayFunc) {
return flatRest(function(iteratees) {
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
return baseRest(function(args) {
var thisArg = this;
return arrayFunc(iteratees, function(iteratee2) {
return apply(iteratee2, thisArg, args);
});
});
});
}
function createPadding(length, chars) {
chars = chars === undefined2 ? " " : baseToString(chars);
var charsLength = chars.length;
if (charsLength < 2) {
return charsLength ? baseRepeat(chars, length) : chars;
}
var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length);
}
function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
while (++leftIndex < leftLength) {
args[leftIndex] = partials[leftIndex];
}
while (argsLength--) {
args[leftIndex++] = arguments[++argsIndex];
}
return apply(fn, isBind ? thisArg : this, args);
}
return wrapper;
}
function createRange(fromRight) {
return function(start, end, step) {
if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
end = step = undefined2;
}
start = toFinite(start);
if (end === undefined2) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
step = step === undefined2 ? start < end ? 1 : -1 : toFinite(step);
return baseRange(start, end, step, fromRight);
};
}
function createRelationalOperation(operator) {
return function(value, other) {
if (!(typeof value == "string" && typeof other == "string")) {
value = toNumber(value);
other = toNumber(other);
}
return operator(value, other);
};
}
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
}
var newData = [
func,
bitmask,
thisArg,
newPartials,
newHolders,
newPartialsRight,
newHoldersRight,
argPos,
ary2,
arity
];
var result2 = wrapFunc.apply(undefined2, newData);
if (isLaziable(func)) {
setData(result2, newData);
}
result2.placeholder = placeholder;
return setWrapToString(result2, func, bitmask);
}
function createRound(methodName) {
var func = Math2[methodName];
return function(number, precision) {
number = toNumber(number);
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
if (precision && nativeIsFinite(number)) {
var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
pair = (toString(value) + "e").split("e");
return +(pair[0] + "e" + (+pair[1] - precision));
}
return func(number);
};
}
var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function(values2) {
return new Set(values2);
};
function createToPairs(keysFunc) {
return function(object) {
var tag = getTag(object);
if (tag == mapTag) {
return mapToArray(object);
}
if (tag == setTag) {
return setToPairs(object);
}
return baseToPairs(object, keysFunc(object));
};
}
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
if (!isBindKey && typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
var length = partials ? partials.length : 0;
if (!length) {
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
partials = holders = undefined2;
}
ary2 = ary2 === undefined2 ? ary2 : nativeMax(toInteger(ary2), 0);
arity = arity === undefined2 ? arity : toInteger(arity);
length -= holders ? holders.length : 0;
if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
var partialsRight = partials, holdersRight = holders;
partials = holders = undefined2;
}
var data = isBindKey ? undefined2 : getData(func);
var newData = [
func,
bitmask,
thisArg,
partials,
holders,
partialsRight,
holdersRight,
argPos,
ary2,
arity
];
if (data) {
mergeData(newData, data);
}
func = newData[0];
bitmask = newData[1];
thisArg = newData[2];
partials = newData[3];
holders = newData[4];
arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0);
if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
}
if (!bitmask || bitmask == WRAP_BIND_FLAG) {
var result2 = createBind(func, bitmask, thisArg);
} else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
result2 = createCurry(func, bitmask, arity);
} else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
result2 = createPartial(func, bitmask, thisArg, partials);
} else {
result2 = createHybrid.apply(undefined2, newData);
}
var setter = data ? baseSetData : setData;
return setWrapToString(setter(result2, newData), func, bitmask);
}
function customDefaultsAssignIn(objValue, srcValue, key, object) {
if (objValue === undefined2 || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key)) {
return srcValue;
}
return objValue;
}
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) {
stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
stack["delete"](srcValue);
}
return objValue;
}
function customOmitClone(value) {
return isPlainObject(value) ? undefined2 : value;
}
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
var arrStacked = stack.get(array);
var othStacked = stack.get(other);
if (arrStacked && othStacked) {
return arrStacked == other && othStacked == array;
}
var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache : undefined2;
stack.set(array, other);
stack.set(other, array);
while (++index < arrLength) {
var arrValue = array[index], othValue = other[index];
if (customizer) {
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined2) {
if (compared) {
continue;
}
result2 = false;
break;
}
if (seen) {
if (!arraySome(other, function(othValue2, othIndex) {
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result2 = false;
break;
}
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
result2 = false;
break;
}
}
stack["delete"](array);
stack["delete"](other);
return result2;
}
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
return object == other + "";
case mapTag:
var convert = mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG;
stack.set(object, other);
var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack["delete"](object);
return result2;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
var objStacked = stack.get(object);
var othStacked = stack.get(other);
if (objStacked && othStacked) {
return objStacked == other && othStacked == object;
}
var result2 = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key], othValue = other[key];
if (customizer) {
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
}
if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
result2 = false;
break;
}
skipCtor || (skipCtor = key == "constructor");
}
if (result2 && !skipCtor) {
var objCtor = object.constructor, othCtor = other.constructor;
if (objCtor != othCtor && (("constructor" in object) && ("constructor" in other)) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
result2 = false;
}
}
stack["delete"](object);
stack["delete"](other);
return result2;
}
function flatRest(func) {
return setToString(overRest(func, undefined2, flatten), func + "");
}
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols);
}
function getAllKeysIn(object) {
return baseGetAllKeys(object, keysIn, getSymbolsIn);
}
var getData = !metaMap ? noop : function(func) {
return metaMap.get(func);
};
function getFuncName(func) {
var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty.call(realNames, result2) ? array.length : 0;
while (length--) {
var data = array[length], otherFunc = data.func;
if (otherFunc == null || otherFunc == func) {
return data.name;
}
}
return result2;
}
function getHolder(func) {
var object = hasOwnProperty.call(lodash, "placeholder") ? lodash : func;
return object.placeholder;
}
function getIteratee() {
var result2 = lodash.iteratee || iteratee;
result2 = result2 === iteratee ? baseIteratee : result2;
return arguments.length ? result2(arguments[0], arguments[1]) : result2;
}
function getMapData(map3, key) {
var data = map3.__data__;
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
function getMatchData(object) {
var result2 = keys(object), length = result2.length;
while (length--) {
var key = result2[length], value = object[key];
result2[length] = [key, value, isStrictComparable(value)];
}
return result2;
}
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined2;
}
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
try {
value[symToStringTag] = undefined2;
var unmasked = true;
} catch (e) {}
var result2 = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result2;
}
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
if (object == null) {
return [];
}
object = Object2(object);
return arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
var result2 = [];
while (object) {
arrayPush(result2, getSymbols(object));
object = getPrototype(object);
}
return result2;
};
var getTag = baseGetTag;
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set) != setTag || WeakMap2 && getTag(new WeakMap2) != weakMapTag) {
getTag = function(value) {
var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
if (ctorString) {
switch (ctorString) {
case dataViewCtorString:
return dataViewTag;
case mapCtorString:
return mapTag;
case promiseCtorString:
return promiseTag;
case setCtorString:
return setTag;
case weakMapCtorString:
return weakMapTag;
}
}
return result2;
};
}
function getView(start, end, transforms) {
var index = -1, length = transforms.length;
while (++index < length) {
var data = transforms[index], size2 = data.size;
switch (data.type) {
case "drop":
start += size2;
break;
case "dropRight":
end -= size2;
break;
case "take":
end = nativeMin(end, start + size2);
break;
case "takeRight":
start = nativeMax(start, end - size2);
break;
}
}
return { start, end };
}
function getWrapDetails(source) {
var match = source.match(reWrapDetails);
return match ? match[1].split(reSplitDetails) : [];
}
function hasPath(object, path, hasFunc) {
path = castPath(path, object);
var index = -1, length = path.length, result2 = false;
while (++index < length) {
var key = toKey(path[index]);
if (!(result2 = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result2 || ++index != length) {
return result2;
}
length = object == null ? 0 : object.length;
return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
}
function initCloneArray(array) {
var length = array.length, result2 = new array.constructor(length);
if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
result2.index = array.index;
result2.input = array.input;
}
return result2;
}
function initCloneObject(object) {
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
}
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
return cloneArrayBuffer(object);
case boolTag:
case dateTag:
return new Ctor(+object);
case dataViewTag:
return cloneDataView(object, isDeep);
case float32Tag:
case float64Tag:
case int8Tag:
case int16Tag:
case int32Tag:
case uint8Tag:
case uint8ClampedTag:
case uint16Tag:
case uint32Tag:
return cloneTypedArray(object, isDeep);
case mapTag:
return new Ctor;
case numberTag:
case stringTag:
return new Ctor(object);
case regexpTag:
return cloneRegExp(object);
case setTag:
return new Ctor;
case symbolTag:
return cloneSymbol(object);
}
}
function insertWrapDetails(source, details) {
var length = details.length;
if (!length) {
return source;
}
var lastIndex = length - 1;
details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
details = details.join(length > 2 ? ", " : " ");
return source.replace(reWrapComment, `{
/* [wrapped with ` + details + `] */
`);
}
function isFlattenable(value) {
return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
}
function isIndex(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
}
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == "number" ? isArrayLike2(object) && isIndex(index, object.length) : type == "string" && (index in object)) {
return eq(object[index], value);
}
return false;
}
function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
}
function isKeyable(value) {
var type = typeof value;
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
}
function isLaziable(func) {
var funcName = getFuncName(func), other = lodash[funcName];
if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
return false;
}
if (func === other) {
return true;
}
var data = getData(other);
return !!data && func === data[0];
}
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
var isMaskable = coreJsData ? isFunction : stubFalse;
function isPrototype(value) {
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
return value === proto;
}
function isStrictComparable(value) {
return value === value && !isObject(value);
}
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return object[key] === srcValue && (srcValue !== undefined2 || (key in Object2(object)));
};
}
function memoizeCapped(func) {
var result2 = memoize(func, function(key) {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key;
});
var cache = result2.cache;
return result2;
}
function mergeData(data, source) {
var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
if (!(isCommon || isCombo)) {
return data;
}
if (srcBitmask & WRAP_BIND_FLAG) {
data[2] = source[2];
newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
}
var value = source[3];
if (value) {
var partials = data[3];
data[3] = partials ? composeArgs(partials, value, source[4]) : value;
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
}
value = source[5];
if (value) {
partials = data[5];
data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
}
value = source[7];
if (value) {
data[7] = value;
}
if (srcBitmask & WRAP_ARY_FLAG) {
data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
}
if (data[9] == null) {
data[9] = source[9];
}
data[0] = source[0];
data[1] = newBitmask;
return data;
}
function nativeKeysIn(object) {
var result2 = [];
if (object != null) {
for (var key in Object2(object)) {
result2.push(key);
}
}
return result2;
}
function objectToString(value) {
return nativeObjectToString.call(value);
}
function overRest(func, start, transform2) {
start = nativeMax(start === undefined2 ? func.length - 1 : start, 0);
return function() {
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array2(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array2(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = transform2(array);
return apply(func, this, otherArgs);
};
}
function parent(object, path) {
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
}
function reorder(array, indexes) {
var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array);
while (length--) {
var index = indexes[length];
array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2;
}
return array;
}
function safeGet(object, key) {
if (key === "constructor" && typeof object[key] === "function") {
return;
}
if (key == "__proto__") {
return;
}
return object[key];
}
var setData = shortOut(baseSetData);
var setTimeout2 = ctxSetTimeout || function(func, wait) {
return root.setTimeout(func, wait);
};
var setToString = shortOut(baseSetToString);
function setWrapToString(wrapper, reference, bitmask) {
var source = reference + "";
return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
}
function shortOut(func) {
var count = 0, lastCalled = 0;
return function() {
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count = 0;
}
return func.apply(undefined2, arguments);
};
}
function shuffleSelf(array, size2) {
var index = -1, length = array.length, lastIndex = length - 1;
size2 = size2 === undefined2 ? length : size2;
while (++index < size2) {
var rand = baseRandom(index, lastIndex), value = array[rand];
array[rand] = array[index];
array[index] = value;
}
array.length = size2;
return array;
}
var stringToPath = memoizeCapped(function(string) {
var result2 = [];
if (string.charCodeAt(0) === 46) {
result2.push("");
}
string.replace(rePropName, function(match, number, quote, subString) {
result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
});
return result2;
});
function toKey(value) {
if (typeof value == "string" || isSymbol(value)) {
return value;
}
var result2 = value + "";
return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
}
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return func + "";
} catch (e) {}
}
return "";
}
function updateWrapDetails(details, bitmask) {
arrayEach(wrapFlags, function(pair) {
var value = "_." + pair[0];
if (bitmask & pair[1] && !arrayIncludes(details, value)) {
details.push(value);
}
});
return details.sort();
}
function wrapperClone(wrapper) {
if (wrapper instanceof LazyWrapper) {
return wrapper.clone();
}
var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
result2.__actions__ = copyArray(wrapper.__actions__);
result2.__index__ = wrapper.__index__;
result2.__values__ = wrapper.__values__;
return result2;
}
function chunk(array, size2, guard) {
if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) {
size2 = 1;
} else {
size2 = nativeMax(toInteger(size2), 0);
}
var length = array == null ? 0 : array.length;
if (!length || size2 < 1) {
return [];
}
var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2));
while (index < length) {
result2[resIndex++] = baseSlice(array, index, index += size2);
}
return result2;
}
function compact(array) {
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = [];
while (++index < length) {
var value = array[index];
if (value) {
result2[resIndex++] = value;
}
}
return result2;
}
function concat2() {
var length = arguments.length;
if (!length) {
return [];
}
var args = Array2(length - 1), array = arguments[0], index = length;
while (index--) {
args[index - 1] = arguments[index];
}
return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
}
var difference = baseRest(function(array, values2) {
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
});
var differenceBy = baseRest(function(array, values2) {
var iteratee2 = last(values2);
if (isArrayLikeObject(iteratee2)) {
iteratee2 = undefined2;
}
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
});
var differenceWith = baseRest(function(array, values2) {
var comparator = last(values2);
if (isArrayLikeObject(comparator)) {
comparator = undefined2;
}
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
});
function drop(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = guard || n === undefined2 ? 1 : toInteger(n);
return baseSlice(array, n < 0 ? 0 : n, length);
}
function dropRight(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = guard || n === undefined2 ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, 0, n < 0 ? 0 : n);
}
function dropRightWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : [];
}
function dropWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : [];
}
function fill(array, value, start, end) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
start = 0;
end = length;
}
return baseFill(array, value, start, end);
}
function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseFindIndex(array, getIteratee(predicate, 3), index);
}
function findLastIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = length - 1;
if (fromIndex !== undefined2) {
index = toInteger(fromIndex);
index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
}
return baseFindIndex(array, getIteratee(predicate, 3), index, true);
}
function flatten(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, 1) : [];
}
function flattenDeep(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, INFINITY) : [];
}
function flattenDepth(array, depth) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
depth = depth === undefined2 ? 1 : toInteger(depth);
return baseFlatten(array, depth);
}
function fromPairs(pairs) {
var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
while (++index < length) {
var pair = pairs[index];
result2[pair[0]] = pair[1];
}
return result2;
}
function head(array) {
return array && array.length ? array[0] : undefined2;
}
function indexOf(array, value, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseIndexOf(array, value, index);
}
function initial(array) {
var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 0, -1) : [];
}
var intersection = baseRest(function(arrays) {
var mapped = arrayMap(arrays, castArrayLikeObject);
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
});
var intersectionBy = baseRest(function(arrays) {
var iteratee2 = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
if (iteratee2 === last(mapped)) {
iteratee2 = undefined2;
} else {
mapped.pop();
}
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
});
var intersectionWith = baseRest(function(arrays) {
var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
comparator = typeof comparator == "function" ? comparator : undefined2;
if (comparator) {
mapped.pop();
}
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
});
function join(array, separator) {
return array == null ? "" : nativeJoin.call(array, separator);
}
function last(array) {
var length = array == null ? 0 : array.length;
return length ? array[length - 1] : undefined2;
}
function lastIndexOf(array, value, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = length;
if (fromIndex !== undefined2) {
index = toInteger(fromIndex);
index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
}
return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
}
function nth(array, n) {
return array && array.length ? baseNth(array, toInteger(n)) : undefined2;
}
var pull = baseRest(pullAll);
function pullAll(array, values2) {
return array && array.length && values2 && values2.length ? basePullAll(array, values2) : array;
}
function pullAllBy(array, values2, iteratee2) {
return array && array.length && values2 && values2.length ? basePullAll(array, values2, getIteratee(iteratee2, 2)) : array;
}
function pullAllWith(array, values2, comparator) {
return array && array.length && values2 && values2.length ? basePullAll(array, values2, undefined2, comparator) : array;
}
var pullAt = flatRest(function(array, indexes) {
var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes);
basePullAt(array, arrayMap(indexes, function(index) {
return isIndex(index, length) ? +index : index;
}).sort(compareAscending));
return result2;
});
function remove(array, predicate) {
var result2 = [];
if (!(array && array.length)) {
return result2;
}
var index = -1, indexes = [], length = array.length;
predicate = getIteratee(predicate, 3);
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result2.push(value);
indexes.push(index);
}
}
basePullAt(array, indexes);
return result2;
}
function reverse(array) {
return array == null ? array : nativeReverse.call(array);
}
function slice(array, start, end) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
start = 0;
end = length;
} else {
start = start == null ? 0 : toInteger(start);
end = end === undefined2 ? length : toInteger(end);
}
return baseSlice(array, start, end);
}
function sortedIndex(array, value) {
return baseSortedIndex(array, value);
}
function sortedIndexBy(array, value, iteratee2) {
return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2));
}
function sortedIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value);
if (index < length && eq(array[index], value)) {
return index;
}
}
return -1;
}
function sortedLastIndex(array, value) {
return baseSortedIndex(array, value, true);
}
function sortedLastIndexBy(array, value, iteratee2) {
return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2), true);
}
function sortedLastIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value, true) - 1;
if (eq(array[index], value)) {
return index;
}
}
return -1;
}
function sortedUniq(array) {
return array && array.length ? baseSortedUniq(array) : [];
}
function sortedUniqBy(array, iteratee2) {
return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : [];
}
function tail(array) {
var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 1, length) : [];
}
function take(array, n, guard) {
if (!(array && array.length)) {
return [];
}
n = guard || n === undefined2 ? 1 : toInteger(n);
return baseSlice(array, 0, n < 0 ? 0 : n);
}
function takeRight(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = guard || n === undefined2 ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, n < 0 ? 0 : n, length);
}
function takeRightWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : [];
}
function takeWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : [];
}
var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
var unionBy = baseRest(function(arrays) {
var iteratee2 = last(arrays);
if (isArrayLikeObject(iteratee2)) {
iteratee2 = undefined2;
}
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
});
var unionWith = baseRest(function(arrays) {
var comparator = last(arrays);
comparator = typeof comparator == "function" ? comparator : undefined2;
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
});
function uniq(array) {
return array && array.length ? baseUniq(array) : [];
}
function uniqBy(array, iteratee2) {
return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : [];
}
function uniqWith(array, comparator) {
comparator = typeof comparator == "function" ? comparator : undefined2;
return array && array.length ? baseUniq(array, undefined2, comparator) : [];
}
function unzip(array) {
if (!(array && array.length)) {
return [];
}
var length = 0;
array = arrayFilter(array, function(group) {
if (isArrayLikeObject(group)) {
length = nativeMax(group.length, length);
return true;
}
});
return baseTimes(length, function(index) {
return arrayMap(array, baseProperty(index));
});
}
function unzipWith(array, iteratee2) {
if (!(array && array.length)) {
return [];
}
var result2 = unzip(array);
if (iteratee2 == null) {
return result2;
}
return arrayMap(result2, function(group) {
return apply(iteratee2, undefined2, group);
});
}
var without = baseRest(function(array, values2) {
return isArrayLikeObject(array) ? baseDifference(array, values2) : [];
});
var xor = baseRest(function(arrays) {
return baseXor(arrayFilter(arrays, isArrayLikeObject));
});
var xorBy = baseRest(function(arrays) {
var iteratee2 = last(arrays);
if (isArrayLikeObject(iteratee2)) {
iteratee2 = undefined2;
}
return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
});
var xorWith = baseRest(function(arrays) {
var comparator = last(arrays);
comparator = typeof comparator == "function" ? comparator : undefined2;
return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator);
});
var zip = baseRest(unzip);
function zipObject(props, values2) {
return baseZipObject(props || [], values2 || [], assignValue);
}
function zipObjectDeep(props, values2) {
return baseZipObject(props || [], values2 || [], baseSet);
}
var zipWith = baseRest(function(arrays) {
var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2;
iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
return unzipWith(arrays, iteratee2);
});
function chain(value) {
var result2 = lodash(value);
result2.__chain__ = true;
return result2;
}
function tap(value, interceptor) {
interceptor(value);
return value;
}
function thru(value, interceptor) {
return interceptor(value);
}
var wrapperAt = flatRest(function(paths) {
var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
return baseAt(object, paths);
};
if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
return this.thru(interceptor);
}
value = value.slice(start, +start + (length ? 1 : 0));
value.__actions__.push({
func: thru,
args: [interceptor],
thisArg: undefined2
});
return new LodashWrapper(value, this.__chain__).thru(function(array) {
if (length && !array.length) {
array.push(undefined2);
}
return array;
});
});
function wrapperChain() {
return chain(this);
}
function wrapperCommit() {
return new LodashWrapper(this.value(), this.__chain__);
}
function wrapperNext() {
if (this.__values__ === undefined2) {
this.__values__ = toArray(this.value());
}
var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
return { done, value };
}
function wrapperToIterator() {
return this;
}
function wrapperPlant(value) {
var result2, parent2 = this;
while (parent2 instanceof baseLodash) {
var clone2 = wrapperClone(parent2);
clone2.__index__ = 0;
clone2.__values__ = undefined2;
if (result2) {
previous.__wrapped__ = clone2;
} else {
result2 = clone2;
}
var previous = clone2;
parent2 = parent2.__wrapped__;
}
previous.__wrapped__ = value;
return result2;
}
function wrapperReverse() {
var value = this.__wrapped__;
if (value instanceof LazyWrapper) {
var wrapped = value;
if (this.__actions__.length) {
wrapped = new LazyWrapper(this);
}
wrapped = wrapped.reverse();
wrapped.__actions__.push({
func: thru,
args: [reverse],
thisArg: undefined2
});
return new LodashWrapper(wrapped, this.__chain__);
}
return this.thru(reverse);
}
function wrapperValue() {
return baseWrapperValue(this.__wrapped__, this.__actions__);
}
var countBy = createAggregator(function(result2, value, key) {
if (hasOwnProperty.call(result2, key)) {
++result2[key];
} else {
baseAssignValue(result2, key, 1);
}
});
function every2(collection, predicate, guard) {
var func = isArray(collection) ? arrayEvery : baseEvery;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined2;
}
return func(collection, getIteratee(predicate, 3));
}
function filter2(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, getIteratee(predicate, 3));
}
var find = createFind(findIndex);
var findLast = createFind(findLastIndex);
function flatMap(collection, iteratee2) {
return baseFlatten(map2(collection, iteratee2), 1);
}
function flatMapDeep(collection, iteratee2) {
return baseFlatten(map2(collection, iteratee2), INFINITY);
}
function flatMapDepth(collection, iteratee2, depth) {
depth = depth === undefined2 ? 1 : toInteger(depth);
return baseFlatten(map2(collection, iteratee2), depth);
}
function forEach(collection, iteratee2) {
var func = isArray(collection) ? arrayEach : baseEach;
return func(collection, getIteratee(iteratee2, 3));
}
function forEachRight(collection, iteratee2) {
var func = isArray(collection) ? arrayEachRight : baseEachRight;
return func(collection, getIteratee(iteratee2, 3));
}
var groupBy = createAggregator(function(result2, value, key) {
if (hasOwnProperty.call(result2, key)) {
result2[key].push(value);
} else {
baseAssignValue(result2, key, [value]);
}
});
function includes(collection, value, fromIndex, guard) {
collection = isArrayLike2(collection) ? collection : values(collection);
fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
var length = collection.length;
if (fromIndex < 0) {
fromIndex = nativeMax(length + fromIndex, 0);
}
return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
}
var invokeMap = baseRest(function(collection, path, args) {
var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
baseEach(collection, function(value) {
result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
});
return result2;
});
var keyBy = createAggregator(function(result2, value, key) {
baseAssignValue(result2, key, value);
});
function map2(collection, iteratee2) {
var func = isArray(collection) ? arrayMap : baseMap;
return func(collection, getIteratee(iteratee2, 3));
}
function orderBy(collection, iteratees, orders, guard) {
if (collection == null) {
return [];
}
if (!isArray(iteratees)) {
iteratees = iteratees == null ? [] : [iteratees];
}
orders = guard ? undefined2 : orders;
if (!isArray(orders)) {
orders = orders == null ? [] : [orders];
}
return baseOrderBy(collection, iteratees, orders);
}
var partition = createAggregator(function(result2, value, key) {
result2[key ? 0 : 1].push(value);
}, function() {
return [[], []];
});
function reduce2(collection, iteratee2, accumulator) {
var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
}
function reduceRight(collection, iteratee2, accumulator) {
var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
}
function reject2(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, negate(getIteratee(predicate, 3)));
}
function sample(collection) {
var func = isArray(collection) ? arraySample : baseSample;
return func(collection);
}
function sampleSize(collection, n, guard) {
if (guard ? isIterateeCall(collection, n, guard) : n === undefined2) {
n = 1;
} else {
n = toInteger(n);
}
var func = isArray(collection) ? arraySampleSize : baseSampleSize;
return func(collection, n);
}
function shuffle(collection) {
var func = isArray(collection) ? arrayShuffle : baseShuffle;
return func(collection);
}
function size(collection) {
if (collection == null) {
return 0;
}
if (isArrayLike2(collection)) {
return isString(collection) ? stringSize(collection) : collection.length;
}
var tag = getTag(collection);
if (tag == mapTag || tag == setTag) {
return collection.size;
}
return baseKeys(collection).length;
}
function some2(collection, predicate, guard) {
var func = isArray(collection) ? arraySome : baseSome;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined2;
}
return func(collection, getIteratee(predicate, 3));
}
var sortBy2 = baseRest(function(collection, iteratees) {
if (collection == null) {
return [];
}
var length = iteratees.length;
if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
iteratees = [];
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
iteratees = [iteratees[0]];
}
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
});
var now = ctxNow || function() {
return root.Date.now();
};
function after(n, func) {
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n < 1) {
return func.apply(this, arguments);
}
};
}
function ary(func, n, guard) {
n = guard ? undefined2 : n;
n = func && n == null ? func.length : n;
return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n);
}
function before(n, func) {
var result2;
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n > 0) {
result2 = func.apply(this, arguments);
}
if (n <= 1) {
func = undefined2;
}
return result2;
};
}
var bind = baseRest(function(func, thisArg, partials) {
var bitmask = WRAP_BIND_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bind));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(func, bitmask, thisArg, partials, holders);
});
var bindKey = baseRest(function(object, key, partials) {
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(key, bitmask, object, partials, holders);
});
function curry(func, arity, guard) {
arity = guard ? undefined2 : arity;
var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
result2.placeholder = curry.placeholder;
return result2;
}
function curryRight(func, arity, guard) {
arity = guard ? undefined2 : arity;
var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
result2.placeholder = curryRight.placeholder;
return result2;
}
function debounce(func, wait, options) {
var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject(options)) {
leading = !!options.leading;
maxing = "maxWait" in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs, thisArg = lastThis;
lastArgs = lastThis = undefined2;
lastInvokeTime = time;
result2 = func.apply(thisArg, args);
return result2;
}
function leadingEdge(time) {
lastInvokeTime = time;
timerId = setTimeout2(timerExpired, wait);
return leading ? invokeFunc(time) : result2;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
timerId = setTimeout2(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = undefined2;
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = undefined2;
return result2;
}
function cancel() {
if (timerId !== undefined2) {
clearTimeout2(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined2;
}
function flush() {
return timerId === undefined2 ? result2 : trailingEdge(now());
}
function debounced() {
var time = now(), isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === undefined2) {
return leadingEdge(lastCallTime);
}
if (maxing) {
clearTimeout2(timerId);
timerId = setTimeout2(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === undefined2) {
timerId = setTimeout2(timerExpired, wait);
}
return result2;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
var defer = baseRest(function(func, args) {
return baseDelay(func, 1, args);
});
var delay = baseRest(function(func, wait, args) {
return baseDelay(func, toNumber(wait) || 0, args);
});
function flip(func) {
return createWrap(func, WRAP_FLIP_FLAG);
}
function memoize(func, resolver) {
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result2 = func.apply(this, args);
memoized.cache = cache.set(key, result2) || cache;
return result2;
};
memoized.cache = new (memoize.Cache || MapCache);
return memoized;
}
memoize.Cache = MapCache;
function negate(predicate) {
if (typeof predicate != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
return function() {
var args = arguments;
switch (args.length) {
case 0:
return !predicate.call(this);
case 1:
return !predicate.call(this, args[0]);
case 2:
return !predicate.call(this, args[0], args[1]);
case 3:
return !predicate.call(this, args[0], args[1], args[2]);
}
return !predicate.apply(this, args);
};
}
function once2(func) {
return before(2, func);
}
var overArgs = castRest(function(func, transforms) {
transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
var funcsLength = transforms.length;
return baseRest(function(args) {
var index = -1, length = nativeMin(args.length, funcsLength);
while (++index < length) {
args[index] = transforms[index].call(this, args[index]);
}
return apply(func, this, args);
});
});
var partial = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partial));
return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
});
var partialRight = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partialRight));
return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
});
var rearg = flatRest(function(func, indexes) {
return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
});
function rest(func, start) {
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
start = start === undefined2 ? start : toInteger(start);
return baseRest(func, start);
}
function spread(func, start) {
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
start = start == null ? 0 : nativeMax(toInteger(start), 0);
return baseRest(function(args) {
var array = args[start], otherArgs = castSlice(args, 0, start);
if (array) {
arrayPush(otherArgs, array);
}
return apply(func, this, otherArgs);
});
}
function throttle(func, wait, options) {
var leading = true, trailing = true;
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = "leading" in options ? !!options.leading : leading;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
leading,
maxWait: wait,
trailing
});
}
function unary(func) {
return ary(func, 1);
}
function wrap2(value, wrapper) {
return partial(castFunction(wrapper), value);
}
function castArray() {
if (!arguments.length) {
return [];
}
var value = arguments[0];
return isArray(value) ? value : [value];
}
function clone(value) {
return baseClone(value, CLONE_SYMBOLS_FLAG);
}
function cloneWith(value, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
}
function cloneDeep(value) {
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
}
function cloneDeepWith(value, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
}
function conformsTo(object, source) {
return source == null || baseConformsTo(object, source, keys(source));
}
function eq(value, other) {
return value === other || value !== value && other !== other;
}
var gt = createRelationalOperation(baseGt);
var gte = createRelationalOperation(function(value, other) {
return value >= other;
});
var isArguments = baseIsArguments(function() {
return arguments;
}()) ? baseIsArguments : function(value) {
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
};
var isArray = Array2.isArray;
var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
function isArrayLike2(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike2(value);
}
function isBoolean(value) {
return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
}
var isBuffer = nativeIsBuffer || stubFalse;
var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
function isElement(value) {
return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
}
function isEmpty(value) {
if (value == null) {
return true;
}
if (isArrayLike2(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
return !value.length;
}
var tag = getTag(value);
if (tag == mapTag || tag == setTag) {
return !value.size;
}
if (isPrototype(value)) {
return !baseKeys(value).length;
}
for (var key in value) {
if (hasOwnProperty.call(value, key)) {
return false;
}
}
return true;
}
function isEqual(value, other) {
return baseIsEqual(value, other);
}
function isEqualWith(value, other, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
var result2 = customizer ? customizer(value, other) : undefined2;
return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2;
}
function isError(value) {
if (!isObjectLike(value)) {
return false;
}
var tag = baseGetTag(value);
return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
}
function isFinite2(value) {
return typeof value == "number" && nativeIsFinite(value);
}
function isFunction(value) {
if (!isObject(value)) {
return false;
}
var tag = baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
function isInteger(value) {
return typeof value == "number" && value == toInteger(value);
}
function isLength(value) {
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
function isObject(value) {
var type = typeof value;
return value != null && (type == "object" || type == "function");
}
function isObjectLike(value) {
return value != null && typeof value == "object";
}
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
function isMatch(object, source) {
return object === source || baseIsMatch(object, source, getMatchData(source));
}
function isMatchWith(object, source, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return baseIsMatch(object, source, getMatchData(source), customizer);
}
function isNaN2(value) {
return isNumber(value) && value != +value;
}
function isNative(value) {
if (isMaskable(value)) {
throw new Error2(CORE_ERROR_TEXT);
}
return baseIsNative(value);
}
function isNull(value) {
return value === null;
}
function isNil(value) {
return value == null;
}
function isNumber(value) {
return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
}
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
}
var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
function isSafeInteger(value) {
return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
}
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
function isString(value) {
return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
}
function isSymbol(value) {
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
}
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
function isUndefined(value) {
return value === undefined2;
}
function isWeakMap(value) {
return isObjectLike(value) && getTag(value) == weakMapTag;
}
function isWeakSet(value) {
return isObjectLike(value) && baseGetTag(value) == weakSetTag;
}
var lt = createRelationalOperation(baseLt);
var lte = createRelationalOperation(function(value, other) {
return value <= other;
});
function toArray(value) {
if (!value) {
return [];
}
if (isArrayLike2(value)) {
return isString(value) ? stringToArray(value) : copyArray(value);
}
if (symIterator && value[symIterator]) {
return iteratorToArray(value[symIterator]());
}
var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
return func(value);
}
function toFinite(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber(value);
if (value === INFINITY || value === -INFINITY) {
var sign = value < 0 ? -1 : 1;
return sign * MAX_INTEGER;
}
return value === value ? value : 0;
}
function toInteger(value) {
var result2 = toFinite(value), remainder = result2 % 1;
return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
}
function toLength(value) {
return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
}
function toNumber(value) {
if (typeof value == "number") {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
value = isObject(other) ? other + "" : other;
}
if (typeof value != "string") {
return value === 0 ? value : +value;
}
value = baseTrim(value);
var isBinary = reIsBinary.test(value);
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
}
function toPlainObject(value) {
return copyObject(value, keysIn(value));
}
function toSafeInteger(value) {
return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
}
function toString(value) {
return value == null ? "" : baseToString(value);
}
var assign = createAssigner(function(object, source) {
if (isPrototype(source) || isArrayLike2(source)) {
copyObject(source, keys(source), object);
return;
}
for (var key in source) {
if (hasOwnProperty.call(source, key)) {
assignValue(object, key, source[key]);
}
}
});
var assignIn = createAssigner(function(object, source) {
copyObject(source, keysIn(source), object);
});
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keysIn(source), object, customizer);
});
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keys(source), object, customizer);
});
var at = flatRest(baseAt);
function create(prototype, properties) {
var result2 = baseCreate(prototype);
return properties == null ? result2 : baseAssign(result2, properties);
}
var defaults = baseRest(function(object, sources) {
object = Object2(object);
var index = -1;
var length = sources.length;
var guard = length > 2 ? sources[2] : undefined2;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
length = 1;
}
while (++index < length) {
var source = sources[index];
var props = keysIn(source);
var propsIndex = -1;
var propsLength = props.length;
while (++propsIndex < propsLength) {
var key = props[propsIndex];
var value = object[key];
if (value === undefined2 || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) {
object[key] = source[key];
}
}
}
return object;
});
var defaultsDeep = baseRest(function(args) {
args.push(undefined2, customDefaultsMerge);
return apply(mergeWith, undefined2, args);
});
function findKey(object, predicate) {
return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
}
function findLastKey(object, predicate) {
return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
}
function forIn(object, iteratee2) {
return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
}
function forInRight(object, iteratee2) {
return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
}
function forOwn(object, iteratee2) {
return object && baseForOwn(object, getIteratee(iteratee2, 3));
}
function forOwnRight(object, iteratee2) {
return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
}
function functions(object) {
return object == null ? [] : baseFunctions(object, keys(object));
}
function functionsIn(object) {
return object == null ? [] : baseFunctions(object, keysIn(object));
}
function get(object, path, defaultValue) {
var result2 = object == null ? undefined2 : baseGet(object, path);
return result2 === undefined2 ? defaultValue : result2;
}
function has(object, path) {
return object != null && hasPath(object, path, baseHas);
}
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}
var invert = createInverter(function(result2, value, key) {
if (value != null && typeof value.toString != "function") {
value = nativeObjectToString.call(value);
}
result2[value] = key;
}, constant(identity));
var invertBy = createInverter(function(result2, value, key) {
if (value != null && typeof value.toString != "function") {
value = nativeObjectToString.call(value);
}
if (hasOwnProperty.call(result2, value)) {
result2[value].push(key);
} else {
result2[value] = [key];
}
}, getIteratee);
var invoke = baseRest(baseInvoke);
function keys(object) {
return isArrayLike2(object) ? arrayLikeKeys(object) : baseKeys(object);
}
function keysIn(object) {
return isArrayLike2(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}
function mapKeys(object, iteratee2) {
var result2 = {};
iteratee2 = getIteratee(iteratee2, 3);
baseForOwn(object, function(value, key, object2) {
baseAssignValue(result2, iteratee2(value, key, object2), value);
});
return result2;
}
function mapValues(object, iteratee2) {
var result2 = {};
iteratee2 = getIteratee(iteratee2, 3);
baseForOwn(object, function(value, key, object2) {
baseAssignValue(result2, key, iteratee2(value, key, object2));
});
return result2;
}
var merge = createAssigner(function(object, source, srcIndex) {
baseMerge(object, source, srcIndex);
});
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
});
var omit = flatRest(function(object, paths) {
var result2 = {};
if (object == null) {
return result2;
}
var isDeep = false;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result2);
if (isDeep) {
result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length;
while (length--) {
baseUnset(result2, paths[length]);
}
return result2;
});
function omitBy(object, predicate) {
return pickBy(object, negate(getIteratee(predicate)));
}
var pick = flatRest(function(object, paths) {
return object == null ? {} : basePick(object, paths);
});
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = getIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
function result(object, path, defaultValue) {
path = castPath(path, object);
var index = -1, length = path.length;
if (!length) {
length = 1;
object = undefined2;
}
while (++index < length) {
var value = object == null ? undefined2 : object[toKey(path[index])];
if (value === undefined2) {
index = length;
value = defaultValue;
}
object = isFunction(value) ? value.call(object) : value;
}
return object;
}
function set(object, path, value) {
return object == null ? object : baseSet(object, path, value);
}
function setWith(object, path, value, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return object == null ? object : baseSet(object, path, value, customizer);
}
var toPairs = createToPairs(keys);
var toPairsIn = createToPairs(keysIn);
function transform(object, iteratee2, accumulator) {
var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
iteratee2 = getIteratee(iteratee2, 4);
if (accumulator == null) {
var Ctor = object && object.constructor;
if (isArrLike) {
accumulator = isArr ? new Ctor : [];
} else if (isObject(object)) {
accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
} else {
accumulator = {};
}
}
(isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
return iteratee2(accumulator, value, index, object2);
});
return accumulator;
}
function unset(object, path) {
return object == null ? true : baseUnset(object, path);
}
function update(object, path, updater) {
return object == null ? object : baseUpdate(object, path, castFunction(updater));
}
function updateWith(object, path, updater, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
}
function values(object) {
return object == null ? [] : baseValues(object, keys(object));
}
function valuesIn(object) {
return object == null ? [] : baseValues(object, keysIn(object));
}
function clamp(number, lower, upper) {
if (upper === undefined2) {
upper = lower;
lower = undefined2;
}
if (upper !== undefined2) {
upper = toNumber(upper);
upper = upper === upper ? upper : 0;
}
if (lower !== undefined2) {
lower = toNumber(lower);
lower = lower === lower ? lower : 0;
}
return baseClamp(toNumber(number), lower, upper);
}
function inRange(number, start, end) {
start = toFinite(start);
if (end === undefined2) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
number = toNumber(number);
return baseInRange(number, start, end);
}
function random(lower, upper, floating) {
if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
upper = floating = undefined2;
}
if (floating === undefined2) {
if (typeof upper == "boolean") {
floating = upper;
upper = undefined2;
} else if (typeof lower == "boolean") {
floating = lower;
lower = undefined2;
}
}
if (lower === undefined2 && upper === undefined2) {
lower = 0;
upper = 1;
} else {
lower = toFinite(lower);
if (upper === undefined2) {
upper = lower;
lower = 0;
} else {
upper = toFinite(upper);
}
}
if (lower > upper) {
var temp = lower;
lower = upper;
upper = temp;
}
if (floating || lower % 1 || upper % 1) {
var rand = nativeRandom();
return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
}
return baseRandom(lower, upper);
}
var camelCase = createCompounder(function(result2, word, index) {
word = word.toLowerCase();
return result2 + (index ? capitalize(word) : word);
});
function capitalize(string) {
return upperFirst(toString(string).toLowerCase());
}
function deburr(string) {
string = toString(string);
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
}
function endsWith(string, target, position) {
string = toString(string);
target = baseToString(target);
var length = string.length;
position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length);
var end = position;
position -= target.length;
return position >= 0 && string.slice(position, end) == target;
}
function escape(string) {
string = toString(string);
return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
}
function escapeRegExp(string) {
string = toString(string);
return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
}
var kebabCase = createCompounder(function(result2, word, index) {
return result2 + (index ? "-" : "") + word.toLowerCase();
});
var lowerCase = createCompounder(function(result2, word, index) {
return result2 + (index ? " " : "") + word.toLowerCase();
});
var lowerFirst = createCaseFirst("toLowerCase");
function pad(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
if (!length || strLength >= length) {
return string;
}
var mid = (length - strLength) / 2;
return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
}
function padEnd(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
}
function padStart(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
}
function parseInt2(string, radix, guard) {
if (guard || radix == null) {
radix = 0;
} else if (radix) {
radix = +radix;
}
return nativeParseInt(toString(string).replace(reTrimStart, ""), radix || 0);
}
function repeat(string, n, guard) {
if (guard ? isIterateeCall(string, n, guard) : n === undefined2) {
n = 1;
} else {
n = toInteger(n);
}
return baseRepeat(toString(string), n);
}
function replace() {
var args = arguments, string = toString(args[0]);
return args.length < 3 ? string : string.replace(args[1], args[2]);
}
var snakeCase = createCompounder(function(result2, word, index) {
return result2 + (index ? "_" : "") + word.toLowerCase();
});
function split(string, separator, limit) {
if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
separator = limit = undefined2;
}
limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
if (!limit) {
return [];
}
string = toString(string);
if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
separator = baseToString(separator);
if (!separator && hasUnicode(string)) {
return castSlice(stringToArray(string), 0, limit);
}
}
return string.split(separator, limit);
}
var startCase = createCompounder(function(result2, word, index) {
return result2 + (index ? " " : "") + upperFirst(word);
});
function startsWith(string, target, position) {
string = toString(string);
position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
target = baseToString(target);
return string.slice(position, position + target.length) == target;
}
function template(string, options, guard) {
var settings = lodash.templateSettings;
if (guard && isIterateeCall(string, options, guard)) {
options = undefined2;
}
string = toString(string);
options = assignInWith({}, options, settings, customDefaultsAssignIn);
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
var reDelimiters = RegExp2((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + `
`;
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
interpolateValue || (interpolateValue = esTemplateValue);
source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
if (escapeValue) {
isEscaping = true;
source += `' +
__e(` + escapeValue + `) +
'`;
}
if (evaluateValue) {
isEvaluating = true;
source += `';
` + evaluateValue + `;
__p += '`;
}
if (interpolateValue) {
source += `' +
((__t = (` + interpolateValue + `)) == null ? '' : __t) +
'`;
}
index = offset + match.length;
return match;
});
source += `';
`;
var variable = hasOwnProperty.call(options, "variable") && options.variable;
if (!variable) {
source = `with (obj) {
` + source + `
}
`;
} else if (reForbiddenIdentifierChars.test(variable)) {
throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
}
source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
source = "function(" + (variable || "obj") + `) {
` + (variable ? "" : `obj || (obj = {});
`) + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? `, __j = Array.prototype.join;
` + `function print() { __p += __j.call(arguments, '') }
` : `;
`) + source + `return __p
}`;
var result2 = attempt(function() {
return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
});
result2.source = source;
if (isError(result2)) {
throw result2;
}
return result2;
}
function toLower(value) {
return toString(value).toLowerCase();
}
function toUpper(value) {
return toString(value).toUpperCase();
}
function trim(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined2)) {
return baseTrim(string);
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
return castSlice(strSymbols, start, end).join("");
}
function trimEnd(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined2)) {
return string.slice(0, trimmedEndIndex(string) + 1);
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
return castSlice(strSymbols, 0, end).join("");
}
function trimStart(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined2)) {
return string.replace(reTrimStart, "");
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
return castSlice(strSymbols, start).join("");
}
function truncate(string, options) {
var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
if (isObject(options)) {
var separator = "separator" in options ? options.separator : separator;
length = "length" in options ? toInteger(options.length) : length;
omission = "omission" in options ? baseToString(options.omission) : omission;
}
string = toString(string);
var strLength = string.length;
if (hasUnicode(string)) {
var strSymbols = stringToArray(string);
strLength = strSymbols.length;
}
if (length >= strLength) {
return string;
}
var end = length - stringSize(omission);
if (end < 1) {
return omission;
}
var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
if (separator === undefined2) {
return result2 + omission;
}
if (strSymbols) {
end += result2.length - end;
}
if (isRegExp(separator)) {
if (string.slice(end).search(separator)) {
var match, substring = result2;
if (!separator.global) {
separator = RegExp2(separator.source, toString(reFlags.exec(separator)) + "g");
}
separator.lastIndex = 0;
while (match = separator.exec(substring)) {
var newEnd = match.index;
}
result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
}
} else if (string.indexOf(baseToString(separator), end) != end) {
var index = result2.lastIndexOf(separator);
if (index > -1) {
result2 = result2.slice(0, index);
}
}
return result2 + omission;
}
function unescape(string) {
string = toString(string);
return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
}
var upperCase = createCompounder(function(result2, word, index) {
return result2 + (index ? " " : "") + word.toUpperCase();
});
var upperFirst = createCaseFirst("toUpperCase");
function words(string, pattern, guard) {
string = toString(string);
pattern = guard ? undefined2 : pattern;
if (pattern === undefined2) {
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
}
return string.match(pattern) || [];
}
var attempt = baseRest(function(func, args) {
try {
return apply(func, undefined2, args);
} catch (e) {
return isError(e) ? e : new Error2(e);
}
});
var bindAll = flatRest(function(object, methodNames) {
arrayEach(methodNames, function(key) {
key = toKey(key);
baseAssignValue(object, key, bind(object[key], object));
});
return object;
});
function cond(pairs) {
var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
pairs = !length ? [] : arrayMap(pairs, function(pair) {
if (typeof pair[1] != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
return [toIteratee(pair[0]), pair[1]];
});
return baseRest(function(args) {
var index = -1;
while (++index < length) {
var pair = pairs[index];
if (apply(pair[0], this, args)) {
return apply(pair[1], this, args);
}
}
});
}
function conforms(source) {
return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
}
function constant(value) {
return function() {
return value;
};
}
function defaultTo(value, defaultValue) {
return value == null || value !== value ? defaultValue : value;
}
var flow = createFlow();
var flowRight = createFlow(true);
function identity(value) {
return value;
}
function iteratee(func) {
return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
}
function matches(source) {
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
}
function matchesProperty(path, srcValue) {
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
}
var method = baseRest(function(path, args) {
return function(object) {
return baseInvoke(object, path, args);
};
});
var methodOf = baseRest(function(object, args) {
return function(path) {
return baseInvoke(object, path, args);
};
});
function mixin(object, source, options) {
var props = keys(source), methodNames = baseFunctions(source, props);
if (options == null && !(isObject(source) && (methodNames.length || !props.length))) {
options = source;
source = object;
object = this;
methodNames = baseFunctions(source, keys(source));
}
var chain2 = !(isObject(options) && ("chain" in options)) || !!options.chain, isFunc = isFunction(object);
arrayEach(methodNames, function(methodName) {
var func = source[methodName];
object[methodName] = func;
if (isFunc) {
object.prototype[methodName] = function() {
var chainAll = this.__chain__;
if (chain2 || chainAll) {
var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
actions.push({ func, args: arguments, thisArg: object });
result2.__chain__ = chainAll;
return result2;
}
return func.apply(object, arrayPush([this.value()], arguments));
};
}
});
return object;
}
function noConflict() {
if (root._ === this) {
root._ = oldDash;
}
return this;
}
function noop() {}
function nthArg(n) {
n = toInteger(n);
return baseRest(function(args) {
return baseNth(args, n);
});
}
var over = createOver(arrayMap);
var overEvery = createOver(arrayEvery);
var overSome = createOver(arraySome);
function property(path) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
}
function propertyOf(object) {
return function(path) {
return object == null ? undefined2 : baseGet(object, path);
};
}
var range = createRange();
var rangeRight = createRange(true);
function stubArray() {
return [];
}
function stubFalse() {
return false;
}
function stubObject() {
return {};
}
function stubString() {
return "";
}
function stubTrue() {
return true;
}
function times(n, iteratee2) {
n = toInteger(n);
if (n < 1 || n > MAX_SAFE_INTEGER) {
return [];
}
var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH);
iteratee2 = getIteratee(iteratee2);
n -= MAX_ARRAY_LENGTH;
var result2 = baseTimes(length, iteratee2);
while (++index < n) {
iteratee2(index);
}
return result2;
}
function toPath(value) {
if (isArray(value)) {
return arrayMap(value, toKey);
}
return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
}
function uniqueId(prefix) {
var id = ++idCounter;
return toString(prefix) + id;
}
var add = createMathOperation(function(augend, addend) {
return augend + addend;
}, 0);
var ceil = createRound("ceil");
var divide = createMathOperation(function(dividend, divisor) {
return dividend / divisor;
}, 1);
var floor = createRound("floor");
function max(array) {
return array && array.length ? baseExtremum(array, identity, baseGt) : undefined2;
}
function maxBy(array, iteratee2) {
return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined2;
}
function mean(array) {
return baseMean(array, identity);
}
function meanBy(array, iteratee2) {
return baseMean(array, getIteratee(iteratee2, 2));
}
function min(array) {
return array && array.length ? baseExtremum(array, identity, baseLt) : undefined2;
}
function minBy(array, iteratee2) {
return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2;
}
var multiply = createMathOperation(function(multiplier, multiplicand) {
return multiplier * multiplicand;
}, 1);
var round = createRound("round");
var subtract = createMathOperation(function(minuend, subtrahend) {
return minuend - subtrahend;
}, 0);
function sum(array) {
return array && array.length ? baseSum(array, identity) : 0;
}
function sumBy(array, iteratee2) {
return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0;
}
lodash.after = after;
lodash.ary = ary;
lodash.assign = assign;
lodash.assignIn = assignIn;
lodash.assignInWith = assignInWith;
lodash.assignWith = assignWith;
lodash.at = at;
lodash.before = before;
lodash.bind = bind;
lodash.bindAll = bindAll;
lodash.bindKey = bindKey;
lodash.castArray = castArray;
lodash.chain = chain;
lodash.chunk = chunk;
lodash.compact = compact;
lodash.concat = concat2;
lodash.cond = cond;
lodash.conforms = conforms;
lodash.constant = constant;
lodash.countBy = countBy;
lodash.create = create;
lodash.curry = curry;
lodash.curryRight = curryRight;
lodash.debounce = debounce;
lodash.defaults = defaults;
lodash.defaultsDeep = defaultsDeep;
lodash.defer = defer;
lodash.delay = delay;
lodash.difference = difference;
lodash.differenceBy = differenceBy;
lodash.differenceWith = differenceWith;
lodash.drop = drop;
lodash.dropRight = dropRight;
lodash.dropRightWhile = dropRightWhile;
lodash.dropWhile = dropWhile;
lodash.fill = fill;
lodash.filter = filter2;
lodash.flatMap = flatMap;
lodash.flatMapDeep = flatMapDeep;
lodash.flatMapDepth = flatMapDepth;
lodash.flatten = flatten;
lodash.flattenDeep = flattenDeep;
lodash.flattenDepth = flattenDepth;
lodash.flip = flip;
lodash.flow = flow;
lodash.flowRight = flowRight;
lodash.fromPairs = fromPairs;
lodash.functions = functions;
lodash.functionsIn = functionsIn;
lodash.groupBy = groupBy;
lodash.initial = initial;
lodash.intersection = intersection;
lodash.intersectionBy = intersectionBy;
lodash.intersectionWith = intersectionWith;
lodash.invert = invert;
lodash.invertBy = invertBy;
lodash.invokeMap = invokeMap;
lodash.iteratee = iteratee;
lodash.keyBy = keyBy;
lodash.keys = keys;
lodash.keysIn = keysIn;
lodash.map = map2;
lodash.mapKeys = mapKeys;
lodash.mapValues = mapValues;
lodash.matches = matches;
lodash.matchesProperty = matchesProperty;
lodash.memoize = memoize;
lodash.merge = merge;
lodash.mergeWith = mergeWith;
lodash.method = method;
lodash.methodOf = methodOf;
lodash.mixin = mixin;
lodash.negate = negate;
lodash.nthArg = nthArg;
lodash.omit = omit;
lodash.omitBy = omitBy;
lodash.once = once2;
lodash.orderBy = orderBy;
lodash.over = over;
lodash.overArgs = overArgs;
lodash.overEvery = overEvery;
lodash.overSome = overSome;
lodash.partial = partial;
lodash.partialRight = partialRight;
lodash.partition = partition;
lodash.pick = pick;
lodash.pickBy = pickBy;
lodash.property = property;
lodash.propertyOf = propertyOf;
lodash.pull = pull;
lodash.pullAll = pullAll;
lodash.pullAllBy = pullAllBy;
lodash.pullAllWith = pullAllWith;
lodash.pullAt = pullAt;
lodash.range = range;
lodash.rangeRight = rangeRight;
lodash.rearg = rearg;
lodash.reject = reject2;
lodash.remove = remove;
lodash.rest = rest;
lodash.reverse = reverse;
lodash.sampleSize = sampleSize;
lodash.set = set;
lodash.setWith = setWith;
lodash.shuffle = shuffle;
lodash.slice = slice;
lodash.sortBy = sortBy2;
lodash.sortedUniq = sortedUniq;
lodash.sortedUniqBy = sortedUniqBy;
lodash.split = split;
lodash.spread = spread;
lodash.tail = tail;
lodash.take = take;
lodash.takeRight = takeRight;
lodash.takeRightWhile = takeRightWhile;
lodash.takeWhile = takeWhile;
lodash.tap = tap;
lodash.throttle = throttle;
lodash.thru = thru;
lodash.toArray = toArray;
lodash.toPairs = toPairs;
lodash.toPairsIn = toPairsIn;
lodash.toPath = toPath;
lodash.toPlainObject = toPlainObject;
lodash.transform = transform;
lodash.unary = unary;
lodash.union = union;
lodash.unionBy = unionBy;
lodash.unionWith = unionWith;
lodash.uniq = uniq;
lodash.uniqBy = uniqBy;
lodash.uniqWith = uniqWith;
lodash.unset = unset;
lodash.unzip = unzip;
lodash.unzipWith = unzipWith;
lodash.update = update;
lodash.updateWith = updateWith;
lodash.values = values;
lodash.valuesIn = valuesIn;
lodash.without = without;
lodash.words = words;
lodash.wrap = wrap2;
lodash.xor = xor;
lodash.xorBy = xorBy;
lodash.xorWith = xorWith;
lodash.zip = zip;
lodash.zipObject = zipObject;
lodash.zipObjectDeep = zipObjectDeep;
lodash.zipWith = zipWith;
lodash.entries = toPairs;
lodash.entriesIn = toPairsIn;
lodash.extend = assignIn;
lodash.extendWith = assignInWith;
mixin(lodash, lodash);
lodash.add = add;
lodash.attempt = attempt;
lodash.camelCase = camelCase;
lodash.capitalize = capitalize;
lodash.ceil = ceil;
lodash.clamp = clamp;
lodash.clone = clone;
lodash.cloneDeep = cloneDeep;
lodash.cloneDeepWith = cloneDeepWith;
lodash.cloneWith = cloneWith;
lodash.conformsTo = conformsTo;
lodash.deburr = deburr;
lodash.defaultTo = defaultTo;
lodash.divide = divide;
lodash.endsWith = endsWith;
lodash.eq = eq;
lodash.escape = escape;
lodash.escapeRegExp = escapeRegExp;
lodash.every = every2;
lodash.find = find;
lodash.findIndex = findIndex;
lodash.findKey = findKey;
lodash.findLast = findLast;
lodash.findLastIndex = findLastIndex;
lodash.findLastKey = findLastKey;
lodash.floor = floor;
lodash.forEach = forEach;
lodash.forEachRight = forEachRight;
lodash.forIn = forIn;
lodash.forInRight = forInRight;
lodash.forOwn = forOwn;
lodash.forOwnRight = forOwnRight;
lodash.get = get;
lodash.gt = gt;
lodash.gte = gte;
lodash.has = has;
lodash.hasIn = hasIn;
lodash.head = head;
lodash.identity = identity;
lodash.includes = includes;
lodash.indexOf = indexOf;
lodash.inRange = inRange;
lodash.invoke = invoke;
lodash.isArguments = isArguments;
lodash.isArray = isArray;
lodash.isArrayBuffer = isArrayBuffer;
lodash.isArrayLike = isArrayLike2;
lodash.isArrayLikeObject = isArrayLikeObject;
lodash.isBoolean = isBoolean;
lodash.isBuffer = isBuffer;
lodash.isDate = isDate;
lodash.isElement = isElement;
lodash.isEmpty = isEmpty;
lodash.isEqual = isEqual;
lodash.isEqualWith = isEqualWith;
lodash.isError = isError;
lodash.isFinite = isFinite2;
lodash.isFunction = isFunction;
lodash.isInteger = isInteger;
lodash.isLength = isLength;
lodash.isMap = isMap;
lodash.isMatch = isMatch;
lodash.isMatchWith = isMatchWith;
lodash.isNaN = isNaN2;
lodash.isNative = isNative;
lodash.isNil = isNil;
lodash.isNull = isNull;
lodash.isNumber = isNumber;
lodash.isObject = isObject;
lodash.isObjectLike = isObjectLike;
lodash.isPlainObject = isPlainObject;
lodash.isRegExp = isRegExp;
lodash.isSafeInteger = isSafeInteger;
lodash.isSet = isSet;
lodash.isString = isString;
lodash.isSymbol = isSymbol;
lodash.isTypedArray = isTypedArray;
lodash.isUndefined = isUndefined;
lodash.isWeakMap = isWeakMap;
lodash.isWeakSet = isWeakSet;
lodash.join = join;
lodash.kebabCase = kebabCase;
lodash.last = last;
lodash.lastIndexOf = lastIndexOf;
lodash.lowerCase = lowerCase;
lodash.lowerFirst = lowerFirst;
lodash.lt = lt;
lodash.lte = lte;
lodash.max = max;
lodash.maxBy = maxBy;
lodash.mean = mean;
lodash.meanBy = meanBy;
lodash.min = min;
lodash.minBy = minBy;
lodash.stubArray = stubArray;
lodash.stubFalse = stubFalse;
lodash.stubObject = stubObject;
lodash.stubString = stubString;
lodash.stubTrue = stubTrue;
lodash.multiply = multiply;
lodash.nth = nth;
lodash.noConflict = noConflict;
lodash.noop = noop;
lodash.now = now;
lodash.pad = pad;
lodash.padEnd = padEnd;
lodash.padStart = padStart;
lodash.parseInt = parseInt2;
lodash.random = random;
lodash.reduce = reduce2;
lodash.reduceRight = reduceRight;
lodash.repeat = repeat;
lodash.replace = replace;
lodash.result = result;
lodash.round = round;
lodash.runInContext = runInContext;
lodash.sample = sample;
lodash.size = size;
lodash.snakeCase = snakeCase;
lodash.some = some2;
lodash.sortedIndex = sortedIndex;
lodash.sortedIndexBy = sortedIndexBy;
lodash.sortedIndexOf = sortedIndexOf;
lodash.sortedLastIndex = sortedLastIndex;
lodash.sortedLastIndexBy = sortedLastIndexBy;
lodash.sortedLastIndexOf = sortedLastIndexOf;
lodash.startCase = startCase;
lodash.startsWith = startsWith;
lodash.subtract = subtract;
lodash.sum = sum;
lodash.sumBy = sumBy;
lodash.template = template;
lodash.times = times;
lodash.toFinite = toFinite;
lodash.toInteger = toInteger;
lodash.toLength = toLength;
lodash.toLower = toLower;
lodash.toNumber = toNumber;
lodash.toSafeInteger = toSafeInteger;
lodash.toString = toString;
lodash.toUpper = toUpper;
lodash.trim = trim;
lodash.trimEnd = trimEnd;
lodash.trimStart = trimStart;
lodash.truncate = truncate;
lodash.unescape = unescape;
lodash.uniqueId = uniqueId;
lodash.upperCase = upperCase;
lodash.upperFirst = upperFirst;
lodash.each = forEach;
lodash.eachRight = forEachRight;
lodash.first = head;
mixin(lodash, function() {
var source = {};
baseForOwn(lodash, function(func, methodName) {
if (!hasOwnProperty.call(lodash.prototype, methodName)) {
source[methodName] = func;
}
});
return source;
}(), { chain: false });
lodash.VERSION = VERSION;
arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
lodash[methodName].placeholder = lodash;
});
arrayEach(["drop", "take"], function(methodName, index) {
LazyWrapper.prototype[methodName] = function(n) {
n = n === undefined2 ? 1 : nativeMax(toInteger(n), 0);
var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
if (result2.__filtered__) {
result2.__takeCount__ = nativeMin(n, result2.__takeCount__);
} else {
result2.__views__.push({
size: nativeMin(n, MAX_ARRAY_LENGTH),
type: methodName + (result2.__dir__ < 0 ? "Right" : "")
});
}
return result2;
};
LazyWrapper.prototype[methodName + "Right"] = function(n) {
return this.reverse()[methodName](n).reverse();
};
});
arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
LazyWrapper.prototype[methodName] = function(iteratee2) {
var result2 = this.clone();
result2.__iteratees__.push({
iteratee: getIteratee(iteratee2, 3),
type
});
result2.__filtered__ = result2.__filtered__ || isFilter;
return result2;
};
});
arrayEach(["head", "last"], function(methodName, index) {
var takeName = "take" + (index ? "Right" : "");
LazyWrapper.prototype[methodName] = function() {
return this[takeName](1).value()[0];
};
});
arrayEach(["initial", "tail"], function(methodName, index) {
var dropName = "drop" + (index ? "" : "Right");
LazyWrapper.prototype[methodName] = function() {
return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
};
});
LazyWrapper.prototype.compact = function() {
return this.filter(identity);
};
LazyWrapper.prototype.find = function(predicate) {
return this.filter(predicate).head();
};
LazyWrapper.prototype.findLast = function(predicate) {
return this.reverse().find(predicate);
};
LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
if (typeof path == "function") {
return new LazyWrapper(this);
}
return this.map(function(value) {
return baseInvoke(value, path, args);
});
});
LazyWrapper.prototype.reject = function(predicate) {
return this.filter(negate(getIteratee(predicate)));
};
LazyWrapper.prototype.slice = function(start, end) {
start = toInteger(start);
var result2 = this;
if (result2.__filtered__ && (start > 0 || end < 0)) {
return new LazyWrapper(result2);
}
if (start < 0) {
result2 = result2.takeRight(-start);
} else if (start) {
result2 = result2.drop(start);
}
if (end !== undefined2) {
end = toInteger(end);
result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start);
}
return result2;
};
LazyWrapper.prototype.takeRightWhile = function(predicate) {
return this.reverse().takeWhile(predicate).reverse();
};
LazyWrapper.prototype.toArray = function() {
return this.take(MAX_ARRAY_LENGTH);
};
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
if (!lodashFunc) {
return;
}
lodash.prototype[methodName] = function() {
var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray(value);
var interceptor = function(value2) {
var result3 = lodashFunc.apply(lodash, arrayPush([value2], args));
return isTaker && chainAll ? result3[0] : result3;
};
if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
isLazy = useLazy = false;
}
var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
if (!retUnwrapped && useLazy) {
value = onlyLazy ? value : new LazyWrapper(this);
var result2 = func.apply(value, args);
result2.__actions__.push({ func: thru, args: [interceptor], thisArg: undefined2 });
return new LodashWrapper(result2, chainAll);
}
if (isUnwrapped && onlyLazy) {
return func.apply(this, args);
}
result2 = this.thru(interceptor);
return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
};
});
arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
lodash.prototype[methodName] = function() {
var args = arguments;
if (retUnwrapped && !this.__chain__) {
var value = this.value();
return func.apply(isArray(value) ? value : [], args);
}
return this[chainName](function(value2) {
return func.apply(isArray(value2) ? value2 : [], args);
});
};
});
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (lodashFunc) {
var key = lodashFunc.name + "";
if (!hasOwnProperty.call(realNames, key)) {
realNames[key] = [];
}
realNames[key].push({ name: methodName, func: lodashFunc });
}
});
realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
name: "wrapper",
func: undefined2
}];
LazyWrapper.prototype.clone = lazyClone;
LazyWrapper.prototype.reverse = lazyReverse;
LazyWrapper.prototype.value = lazyValue;
lodash.prototype.at = wrapperAt;
lodash.prototype.chain = wrapperChain;
lodash.prototype.commit = wrapperCommit;
lodash.prototype.next = wrapperNext;
lodash.prototype.plant = wrapperPlant;
lodash.prototype.reverse = wrapperReverse;
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
lodash.prototype.first = lodash.prototype.head;
if (symIterator) {
lodash.prototype[symIterator] = wrapperToIterator;
}
return lodash;
};
var _ = runInContext();
if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
root._ = _;
define(function() {
return _;
});
} else if (freeModule) {
(freeModule.exports = _)._ = _;
freeExports._ = _;
} else {
root._ = _;
}
}).call(exports);
});
// node_modules/strict-uri-encode/index.js
var require_strict_uri_encode = __commonJS((exports, module) => {
module.exports = (str) => encodeURIComponent(str).replace(/[!'()*]/g, (x) => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
});
// node_modules/decode-uri-component/index.js
var require_decode_uri_component = __commonJS((exports, module) => {
var token = "%[a-f0-9]{2}";
var singleMatcher = new RegExp("(" + token + ")|([^%]+?)", "gi");
var multiMatcher = new RegExp("(" + token + ")+", "gi");
function decodeComponents(components, split) {
try {
return [decodeURIComponent(components.join(""))];
} catch (err) {}
if (components.length === 1) {
return components;
}
split = split || 1;
var left = components.slice(0, split);
var right = components.slice(split);
return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
}
function decode(input) {
try {
return decodeURIComponent(input);
} catch (err) {
var tokens = input.match(singleMatcher) || [];
for (var i = 1;i < tokens.length; i++) {
input = decodeComponents(tokens, i).join("");
tokens = input.match(singleMatcher) || [];
}
return input;
}
}
function customDecodeURIComponent(input) {
var replaceMap = {
"%FE%FF": "\uFFFD\uFFFD",
"%FF%FE": "\uFFFD\uFFFD"
};
var match = multiMatcher.exec(input);
while (match) {
try {
replaceMap[match[0]] = decodeURIComponent(match[0]);
} catch (err) {
var result = decode(match[0]);
if (result !== match[0]) {
replaceMap[match[0]] = result;
}
}
match = multiMatcher.exec(input);
}
replaceMap["%C2"] = "\uFFFD";
var entries = Object.keys(replaceMap);
for (var i = 0;i < entries.length; i++) {
var key = entries[i];
input = input.replace(new RegExp(key, "g"), replaceMap[key]);
}
return input;
}
module.exports = function(encodedURI) {
if (typeof encodedURI !== "string") {
throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof encodedURI + "`");
}
try {
encodedURI = encodedURI.replace(/\+/g, " ");
return decodeURIComponent(encodedURI);
} catch (err) {
return customDecodeURIComponent(encodedURI);
}
};
});
// node_modules/split-on-first/index.js
var require_split_on_first = __commonJS((exports, module) => {
module.exports = (string, separator) => {
if (!(typeof string === "string" && typeof separator === "string")) {
throw new TypeError("Expected the arguments to be of type `string`");
}
if (separator === "") {
return [string];
}
const separatorIndex = string.indexOf(separator);
if (separatorIndex === -1) {
return [string];
}
return [
string.slice(0, separatorIndex),
string.slice(separatorIndex + separator.length)
];
};
});
// node_modules/filter-obj/index.js
var require_filter_obj = __commonJS((exports, module) => {
module.exports = function(obj, predicate) {
var ret = {};
var keys = Object.keys(obj);
var isArr = Array.isArray(predicate);
for (var i = 0;i < keys.length; i++) {
var key = keys[i];
var val2 = obj[key];
if (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val2, obj)) {
ret[key] = val2;
}
}
return ret;
};
});
// node_modules/fast-xml-parser/src/util.js
var require_util = __commonJS((exports) => {
var nameStartChar = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*";
var regexName = new RegExp("^" + nameRegexp + "$");
var getAllMatches = function(string, regex) {
const matches = [];
let match = regex.exec(string);
while (match) {
const allmatches = [];
allmatches.startIndex = regex.lastIndex - match[0].length;
const len = match.length;
for (let index = 0;index < len; index++) {
allmatches.push(match[index]);
}
matches.push(allmatches);
match = regex.exec(string);
}
return matches;
};
var isName = function(string) {
const match = regexName.exec(string);
return !(match === null || typeof match === "undefined");
};
exports.isExist = function(v) {
return typeof v !== "undefined";
};
exports.isEmptyObject = function(obj) {
return Object.keys(obj).length === 0;
};
exports.merge = function(target, a, arrayMode) {
if (a) {
const keys = Object.keys(a);
const len = keys.length;
for (let i = 0;i < len; i++) {
if (arrayMode === "strict") {
target[keys[i]] = [a[keys[i]]];
} else {
target[keys[i]] = a[keys[i]];
}
}
}
};
exports.getValue = function(v) {
if (exports.isExist(v)) {
return v;
} else {
return "";
}
};
exports.isName = isName;
exports.getAllMatches = getAllMatches;
exports.nameRegexp = nameRegexp;
});
// node_modules/fast-xml-parser/src/validator.js
var require_validator = __commonJS((exports) => {
var util = require_util();
var defaultOptions = {
allowBooleanAttributes: false,
unpairedTags: []
};
exports.validate = function(xmlData, options) {
options = Object.assign({}, defaultOptions, options);
const tags = [];
let tagFound = false;
let reachedRoot = false;
if (xmlData[0] === "\uFEFF") {
xmlData = xmlData.substr(1);
}
for (let i = 0;i < xmlData.length; i++) {
if (xmlData[i] === "<" && xmlData[i + 1] === "?") {
i += 2;
i = readPI(xmlData, i);
if (i.err)
return i;
} else if (xmlData[i] === "<") {
let tagStartPos = i;
i++;
if (xmlData[i] === "!") {
i = readCommentAndCDATA(xmlData, i);
continue;
} else {
let closingTag = false;
if (xmlData[i] === "/") {
closingTag = true;
i++;
}
let tagName = "";
for (;i < xmlData.length && xmlData[i] !== ">" && xmlData[i] !== " " && xmlData[i] !== "\t" && xmlData[i] !== `
` && xmlData[i] !== "\r"; i++) {
tagName += xmlData[i];
}
tagName = tagName.trim();
if (tagName[tagName.length - 1] === "/") {
tagName = tagName.substring(0, tagName.length - 1);
i--;
}
if (!validateTagName(tagName)) {
let msg;
if (tagName.trim().length === 0) {
msg = "Invalid space after '<'.";
} else {
msg = "Tag '" + tagName + "' is an invalid name.";
}
return getErrorObject("InvalidTag", msg, getLineNumberForPosition(xmlData, i));
}
const result = readAttributeStr(xmlData, i);
if (result === false) {
return getErrorObject("InvalidAttr", "Attributes for '" + tagName + "' have open quote.", getLineNumberForPosition(xmlData, i));
}
let attrStr = result.value;
i = result.index;
if (attrStr[attrStr.length - 1] === "/") {
const attrStrStart = i - attrStr.length;
attrStr = attrStr.substring(0, attrStr.length - 1);
const isValid = validateAttributeString(attrStr, options);
if (isValid === true) {
tagFound = true;
} else {
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));
}
} else if (closingTag) {
if (!result.tagClosed) {
return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
} else if (attrStr.trim().length > 0) {
return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
} else if (tags.length === 0) {
return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
} else {
const otg = tags.pop();
if (tagName !== otg.tagName) {
let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
return getErrorObject("InvalidTag", "Expected closing tag '" + otg.tagName + "' (opened in line " + openPos.line + ", col " + openPos.col + ") instead of closing tag '" + tagName + "'.", getLineNumberForPosition(xmlData, tagStartPos));
}
if (tags.length == 0) {
reachedRoot = true;
}
}
} else {
const isValid = validateAttributeString(attrStr, options);
if (isValid !== true) {
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));
}
if (reachedRoot === true) {
return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(xmlData, i));
} else if (options.unpairedTags.indexOf(tagName) !== -1) {} else {
tags.push({ tagName, tagStartPos });
}
tagFound = true;
}
for (i++;i < xmlData.length; i++) {
if (xmlData[i] === "<") {
if (xmlData[i + 1] === "!") {
i++;
i = readCommentAndCDATA(xmlData, i);
continue;
} else if (xmlData[i + 1] === "?") {
i = readPI(xmlData, ++i);
if (i.err)
return i;
} else {
break;
}
} else if (xmlData[i] === "&") {
const afterAmp = validateAmpersand(xmlData, i);
if (afterAmp == -1)
return getErrorObject("InvalidChar", "char '&' is not expected.", getLineNumberForPosition(xmlData, i));
i = afterAmp;
} else {
if (reachedRoot === true && !isWhiteSpace(xmlData[i])) {
return getErrorObject("InvalidXml", "Extra text at the end", getLineNumberForPosition(xmlData, i));
}
}
}
if (xmlData[i] === "<") {
i--;
}
}
} else {
if (isWhiteSpace(xmlData[i])) {
continue;
}
return getErrorObject("InvalidChar", "char '" + xmlData[i] + "' is not expected.", getLineNumberForPosition(xmlData, i));
}
}
if (!tagFound) {
return getErrorObject("InvalidXml", "Start tag expected.", 1);
} else if (tags.length == 1) {
return getErrorObject("InvalidTag", "Unclosed tag '" + tags[0].tagName + "'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
} else if (tags.length > 0) {
return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((t) => t.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
}
return true;
};
function isWhiteSpace(char) {
return char === " " || char === "\t" || char === `
` || char === "\r";
}
function readPI(xmlData, i) {
const start = i;
for (;i < xmlData.length; i++) {
if (xmlData[i] == "?" || xmlData[i] == " ") {
const tagname = xmlData.substr(start, i - start);
if (i > 5 && tagname === "xml") {
return getErrorObject("InvalidXml", "XML declaration allowed only at the start of the document.", getLineNumberForPosition(xmlData, i));
} else if (xmlData[i] == "?" && xmlData[i + 1] == ">") {
i++;
break;
} else {
continue;
}
}
}
return i;
}
function readCommentAndCDATA(xmlData, i) {
if (xmlData.length > i + 5 && xmlData[i + 1] === "-" && xmlData[i + 2] === "-") {
for (i += 3;i < xmlData.length; i++) {
if (xmlData[i] === "-" && xmlData[i + 1] === "-" && xmlData[i + 2] === ">") {
i += 2;
break;
}
}
} else if (xmlData.length > i + 8 && xmlData[i + 1] === "D" && xmlData[i + 2] === "O" && xmlData[i + 3] === "C" && xmlData[i + 4] === "T" && xmlData[i + 5] === "Y" && xmlData[i + 6] === "P" && xmlData[i + 7] === "E") {
let angleBracketsCount = 1;
for (i += 8;i < xmlData.length; i++) {
if (xmlData[i] === "<") {
angleBracketsCount++;
} else if (xmlData[i] === ">") {
angleBracketsCount--;
if (angleBracketsCount === 0) {
break;
}
}
}
} else if (xmlData.length > i + 9 && xmlData[i + 1] === "[" && xmlData[i + 2] === "C" && xmlData[i + 3] === "D" && xmlData[i + 4] === "A" && xmlData[i + 5] === "T" && xmlData[i + 6] === "A" && xmlData[i + 7] === "[") {
for (i += 8;i < xmlData.length; i++) {
if (xmlData[i] === "]" && xmlData[i + 1] === "]" && xmlData[i + 2] === ">") {
i += 2;
break;
}
}
}
return i;
}
var doubleQuote = '"';
var singleQuote = "'";
function readAttributeStr(xmlData, i) {
let attrStr = "";
let startChar = "";
let tagClosed = false;
for (;i < xmlData.length; i++) {
if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
if (startChar === "") {
startChar = xmlData[i];
} else if (startChar !== xmlData[i]) {} else {
startChar = "";
}
} else if (xmlData[i] === ">") {
if (startChar === "") {
tagClosed = true;
break;
}
}
attrStr += xmlData[i];
}
if (startChar !== "") {
return false;
}
return {
value: attrStr,
index: i,
tagClosed
};
}
var validAttrStrRegxp = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
function validateAttributeString(attrStr, options) {
const matches = util.getAllMatches(attrStr, validAttrStrRegxp);
const attrNames = {};
for (let i = 0;i < matches.length; i++) {
if (matches[i][1].length === 0) {
return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' has no space in starting.", getPositionFromMatch(matches[i]));
} else if (matches[i][3] !== undefined && matches[i][4] === undefined) {
return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' is without value.", getPositionFromMatch(matches[i]));
} else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {
return getErrorObject("InvalidAttr", "boolean attribute '" + matches[i][2] + "' is not allowed.", getPositionFromMatch(matches[i]));
}
const attrName = matches[i][2];
if (!validateAttrName(attrName)) {
return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches[i]));
}
if (!attrNames.hasOwnProperty(attrName)) {
attrNames[attrName] = 1;
} else {
return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches[i]));
}
}
return true;
}
function validateNumberAmpersand(xmlData, i) {
let re = /\d/;
if (xmlData[i] === "x") {
i++;
re = /[\da-fA-F]/;
}
for (;i < xmlData.length; i++) {
if (xmlData[i] === ";")
return i;
if (!xmlData[i].match(re))
break;
}
return -1;
}
function validateAmpersand(xmlData, i) {
i++;
if (xmlData[i] === ";")
return -1;
if (xmlData[i] === "#") {
i++;
return validateNumberAmpersand(xmlData, i);
}
let count = 0;
for (;i < xmlData.length; i++, count++) {
if (xmlData[i].match(/\w/) && count < 20)
continue;
if (xmlData[i] === ";")
break;
return -1;
}
return i;
}
function getErrorObject(code, message, lineNumber) {
return {
err: {
code,
msg: message,
line: lineNumber.line || lineNumber,
col: lineNumber.col
}
};
}
function validateAttrName(attrName) {
return util.isName(attrName);
}
function validateTagName(tagname) {
return util.isName(tagname);
}
function getLineNumberForPosition(xmlData, index) {
const lines = xmlData.substring(0, index).split(/\r?\n/);
return {
line: lines.length,
col: lines[lines.length - 1].length + 1
};
}
function getPositionFromMatch(match) {
return match.startIndex + match[1].length;
}
});
// node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
var require_OptionsBuilder = __commonJS((exports) => {
var defaultOptions = {
preserveOrder: false,
attributeNamePrefix: "@_",
attributesGroupName: false,
textNodeName: "#text",
ignoreAttributes: true,
removeNSPrefix: false,
allowBooleanAttributes: false,
parseTagValue: true,
parseAttributeValue: false,
trimValues: true,
cdataPropName: false,
numberParseOptions: {
hex: true,
leadingZeros: true,
eNotation: true
},
tagValueProcessor: function(tagName, val2) {
return val2;
},
attributeValueProcessor: function(attrName, val2) {
return val2;
},
stopNodes: [],
alwaysCreateTextNode: false,
isArray: () => false,
commentPropName: false,
unpairedTags: [],
processEntities: true,
htmlEntities: false,
ignoreDeclaration: false,
ignorePiTags: false,
transformTagName: false,
transformAttributeName: false,
updateTag: function(tagName, jPath, attrs) {
return tagName;
}
};
var buildOptions = function(options) {
return Object.assign({}, defaultOptions, options);
};
exports.buildOptions = buildOptions;
exports.defaultOptions = defaultOptions;
});
// node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
var require_xmlNode = __commonJS((exports, module) => {
class XmlNode {
constructor(tagname) {
this.tagname = tagname;
this.child = [];
this[":@"] = {};
}
add(key, val2) {
if (key === "__proto__")
key = "#__proto__";
this.child.push({ [key]: val2 });
}
addChild(node) {
if (node.tagname === "__proto__")
node.tagname = "#__proto__";
if (node[":@"] && Object.keys(node[":@"]).length > 0) {
this.child.push({ [node.tagname]: node.child, [":@"]: node[":@"] });
} else {
this.child.push({ [node.tagname]: node.child });
}
}
}
module.exports = XmlNode;
});
// node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
var require_DocTypeReader = __commonJS((exports, module) => {
var util = require_util();
function readDocType(xmlData, i) {
const entities = {};
if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") {
i = i + 9;
let angleBracketsCount = 1;
let hasBody = false, comment = false;
let exp = "";
for (;i < xmlData.length; i++) {
if (xmlData[i] === "<" && !comment) {
if (hasBody && isEntity(xmlData, i)) {
i += 7;
[entityName, val, i] = readEntityExp(xmlData, i + 1);
if (val.indexOf("&") === -1)
entities[validateEntityName(entityName)] = {
regx: RegExp(`&${entityName};`, "g"),
val
};
} else if (hasBody && isElement(xmlData, i))
i += 8;
else if (hasBody && isAttlist(xmlData, i))
i += 8;
else if (hasBody && isNotation(xmlData, i))
i += 9;
else if (isComment)
comment = true;
else
throw new Error("Invalid DOCTYPE");
angleBracketsCount++;
exp = "";
} else if (xmlData[i] === ">") {
if (comment) {
if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") {
comment = false;
angleBracketsCount--;
}
} else {
angleBracketsCount--;
}
if (angleBracketsCount === 0) {
break;
}
} else if (xmlData[i] === "[") {
hasBody = true;
} else {
exp += xmlData[i];
}
}
if (angleBracketsCount !== 0) {
throw new Error(`Unclosed DOCTYPE`);
}
} else {
throw new Error(`Invalid Tag instead of DOCTYPE`);
}
return { entities, i };
}
function readEntityExp(xmlData, i) {
let entityName2 = "";
for (;i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"'); i++) {
entityName2 += xmlData[i];
}
entityName2 = entityName2.trim();
if (entityName2.indexOf(" ") !== -1)
throw new Error("External entites are not supported");
const startChar = xmlData[i++];
let val2 = "";
for (;i < xmlData.length && xmlData[i] !== startChar; i++) {
val2 += xmlData[i];
}
return [entityName2, val2, i];
}
function isComment(xmlData, i) {
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-")
return true;
return false;
}
function isEntity(xmlData, i) {
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "N" && xmlData[i + 4] === "T" && xmlData[i + 5] === "I" && xmlData[i + 6] === "T" && xmlData[i + 7] === "Y")
return true;
return false;
}
function isElement(xmlData, i) {
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "L" && xmlData[i + 4] === "E" && xmlData[i + 5] === "M" && xmlData[i + 6] === "E" && xmlData[i + 7] === "N" && xmlData[i + 8] === "T")
return true;
return false;
}
function isAttlist(xmlData, i) {
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "A" && xmlData[i + 3] === "T" && xmlData[i + 4] === "T" && xmlData[i + 5] === "L" && xmlData[i + 6] === "I" && xmlData[i + 7] === "S" && xmlData[i + 8] === "T")
return true;
return false;
}
function isNotation(xmlData, i) {
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "N" && xmlData[i + 3] === "O" && xmlData[i + 4] === "T" && xmlData[i + 5] === "A" && xmlData[i + 6] === "T" && xmlData[i + 7] === "I" && xmlData[i + 8] === "O" && xmlData[i + 9] === "N")
return true;
return false;
}
function validateEntityName(name) {
if (util.isName(name))
return name;
else
throw new Error(`Invalid entity name ${name}`);
}
module.exports = readDocType;
});
// node_modules/strnum/strnum.js
var require_strnum = __commonJS((exports, module) => {
var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
var numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
if (!Number.parseInt && window.parseInt) {
Number.parseInt = window.parseInt;
}
if (!Number.parseFloat && window.parseFloat) {
Number.parseFloat = window.parseFloat;
}
var consider = {
hex: true,
leadingZeros: true,
decimalPoint: ".",
eNotation: true
};
function toNumber(str, options = {}) {
options = Object.assign({}, consider, options);
if (!str || typeof str !== "string")
return str;
let trimmedStr = str.trim();
if (options.skipLike !== undefined && options.skipLike.test(trimmedStr))
return str;
else if (options.hex && hexRegex.test(trimmedStr)) {
return Number.parseInt(trimmedStr, 16);
} else {
const match = numRegex.exec(trimmedStr);
if (match) {
const sign = match[1];
const leadingZeros = match[2];
let numTrimmedByZeros = trimZeros(match[3]);
const eNotation = match[4] || match[6];
if (!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".")
return str;
else if (!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".")
return str;
else {
const num = Number(trimmedStr);
const numStr = "" + num;
if (numStr.search(/[eE]/) !== -1) {
if (options.eNotation)
return num;
else
return str;
} else if (eNotation) {
if (options.eNotation)
return num;
else
return str;
} else if (trimmedStr.indexOf(".") !== -1) {
if (numStr === "0" && numTrimmedByZeros === "")
return num;
else if (numStr === numTrimmedByZeros)
return num;
else if (sign && numStr === "-" + numTrimmedByZeros)
return num;
else
return str;
}
if (leadingZeros) {
if (numTrimmedByZeros === numStr)
return num;
else if (sign + numTrimmedByZeros === numStr)
return num;
else
return str;
}
if (trimmedStr === numStr)
return num;
else if (trimmedStr === sign + numStr)
return num;
return str;
}
} else {
return str;
}
}
}
function trimZeros(numStr) {
if (numStr && numStr.indexOf(".") !== -1) {
numStr = numStr.replace(/0+$/, "");
if (numStr === ".")
numStr = "0";
else if (numStr[0] === ".")
numStr = "0" + numStr;
else if (numStr[numStr.length - 1] === ".")
numStr = numStr.substr(0, numStr.length - 1);
return numStr;
}
return numStr;
}
module.exports = toNumber;
});
// node_modules/fast-xml-parser/src/ignoreAttributes.js
var require_ignoreAttributes = __commonJS((exports, module) => {
function getIgnoreAttributesFn(ignoreAttributes) {
if (typeof ignoreAttributes === "function") {
return ignoreAttributes;
}
if (Array.isArray(ignoreAttributes)) {
return (attrName) => {
for (const pattern of ignoreAttributes) {
if (typeof pattern === "string" && attrName === pattern) {
return true;
}
if (pattern instanceof RegExp && pattern.test(attrName)) {
return true;
}
}
};
}
return () => false;
}
module.exports = getIgnoreAttributesFn;
});
// node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
var require_OrderedObjParser = __commonJS((exports, module) => {
var util = require_util();
var xmlNode = require_xmlNode();
var readDocType = require_DocTypeReader();
var toNumber = require_strnum();
var getIgnoreAttributesFn = require_ignoreAttributes();
class OrderedObjParser {
constructor(options) {
this.options = options;
this.currentNode = null;
this.tagsNodeStack = [];
this.docTypeEntities = {};
this.lastEntities = {
apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
quot: { regex: /&(quot|#34|#x22);/g, val: '"' }
};
this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" };
this.htmlEntities = {
space: { regex: /&(nbsp|#160);/g, val: " " },
cent: { regex: /&(cent|#162);/g, val: "\xA2" },
pound: { regex: /&(pound|#163);/g, val: "\xA3" },
yen: { regex: /&(yen|#165);/g, val: "\xA5" },
euro: { regex: /&(euro|#8364);/g, val: "\u20AC" },
copyright: { regex: /&(copy|#169);/g, val: "\xA9" },
reg: { regex: /&(reg|#174);/g, val: "\xAE" },
inr: { regex: /&(inr|#8377);/g, val: "\u20B9" },
num_dec: { regex: /&#([0-9]{1,7});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 10)) },
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 16)) }
};
this.addExternalEntities = addExternalEntities;
this.parseXml = parseXml;
this.parseTextData = parseTextData;
this.resolveNameSpace = resolveNameSpace;
this.buildAttributesMap = buildAttributesMap;
this.isItStopNode = isItStopNode;
this.replaceEntitiesValue = replaceEntitiesValue;
this.readStopNodeData = readStopNodeData;
this.saveTextToParentTag = saveTextToParentTag;
this.addChild = addChild;
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
}
}
function addExternalEntities(externalEntities) {
const entKeys = Object.keys(externalEntities);
for (let i = 0;i < entKeys.length; i++) {
const ent = entKeys[i];
this.lastEntities[ent] = {
regex: new RegExp("&" + ent + ";", "g"),
val: externalEntities[ent]
};
}
}
function parseTextData(val2, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
if (val2 !== undefined) {
if (this.options.trimValues && !dontTrim) {
val2 = val2.trim();
}
if (val2.length > 0) {
if (!escapeEntities)
val2 = this.replaceEntitiesValue(val2);
const newval = this.options.tagValueProcessor(tagName, val2, jPath, hasAttributes, isLeafNode);
if (newval === null || newval === undefined) {
return val2;
} else if (typeof newval !== typeof val2 || newval !== val2) {
return newval;
} else if (this.options.trimValues) {
return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions);
} else {
const trimmedVal = val2.trim();
if (trimmedVal === val2) {
return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions);
} else {
return val2;
}
}
}
}
}
function resolveNameSpace(tagname) {
if (this.options.removeNSPrefix) {
const tags = tagname.split(":");
const prefix = tagname.charAt(0) === "/" ? "/" : "";
if (tags[0] === "xmlns") {
return "";
}
if (tags.length === 2) {
tagname = prefix + tags[1];
}
}
return tagname;
}
var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
function buildAttributesMap(attrStr, jPath, tagName) {
if (this.options.ignoreAttributes !== true && typeof attrStr === "string") {
const matches = util.getAllMatches(attrStr, attrsRegx);
const len = matches.length;
const attrs = {};
for (let i = 0;i < len; i++) {
const attrName = this.resolveNameSpace(matches[i][1]);
if (this.ignoreAttributesFn(attrName, jPath)) {
continue;
}
let oldVal = matches[i][4];
let aName = this.options.attributeNamePrefix + attrName;
if (attrName.length) {
if (this.options.transformAttributeName) {
aName = this.options.transformAttributeName(aName);
}
if (aName === "__proto__")
aName = "#__proto__";
if (oldVal !== undefined) {
if (this.options.trimValues) {
oldVal = oldVal.trim();
}
oldVal = this.replaceEntitiesValue(oldVal);
const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
if (newVal === null || newVal === undefined) {
attrs[aName] = oldVal;
} else if (typeof newVal !== typeof oldVal || newVal !== oldVal) {
attrs[aName] = newVal;
} else {
attrs[aName] = parseValue(oldVal, this.options.parseAttributeValue, this.options.numberParseOptions);
}
} else if (this.options.allowBooleanAttributes) {
attrs[aName] = true;
}
}
}
if (!Object.keys(attrs).length) {
return;
}
if (this.options.attributesGroupName) {
const attrCollection = {};
attrCollection[this.options.attributesGroupName] = attrs;
return attrCollection;
}
return attrs;
}
}
var parseXml = function(xmlData) {
xmlData = xmlData.replace(/\r\n?/g, `
`);
const xmlObj = new xmlNode("!xml");
let currentNode = xmlObj;
let textData = "";
let jPath = "";
for (let i = 0;i < xmlData.length; i++) {
const ch = xmlData[i];
if (ch === "<") {
if (xmlData[i + 1] === "/") {
const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.");
let tagName = xmlData.substring(i + 2, closeIndex).trim();
if (this.options.removeNSPrefix) {
const colonIndex = tagName.indexOf(":");
if (colonIndex !== -1) {
tagName = tagName.substr(colonIndex + 1);
}
}
if (this.options.transformTagName) {
tagName = this.options.transformTagName(tagName);
}
if (currentNode) {
textData = this.saveTextToParentTag(textData, currentNode, jPath);
}
const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1);
if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) {
throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
}
let propIndex = 0;
if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) {
propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1);
this.tagsNodeStack.pop();
} else {
propIndex = jPath.lastIndexOf(".");
}
jPath = jPath.substring(0, propIndex);
currentNode = this.tagsNodeStack.pop();
textData = "";
i = closeIndex;
} else if (xmlData[i + 1] === "?") {
let tagData = readTagExp(xmlData, i, false, "?>");
if (!tagData)
throw new Error("Pi Tag is not closed.");
textData = this.saveTextToParentTag(textData, currentNode, jPath);
if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) {} else {
const childNode = new xmlNode(tagData.tagName);
childNode.add(this.options.textNodeName, "");
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
}
this.addChild(currentNode, childNode, jPath);
}
i = tagData.closeIndex + 1;
} else if (xmlData.substr(i + 1, 3) === "!--") {
const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed.");
if (this.options.commentPropName) {
const comment = xmlData.substring(i + 4, endIndex - 2);
textData = this.saveTextToParentTag(textData, currentNode, jPath);
currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]);
}
i = endIndex;
} else if (xmlData.substr(i + 1, 2) === "!D") {
const result = readDocType(xmlData, i);
this.docTypeEntities = result.entities;
i = result.i;
} else if (xmlData.substr(i + 1, 2) === "![") {
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
const tagExp = xmlData.substring(i + 9, closeIndex);
textData = this.saveTextToParentTag(textData, currentNode, jPath);
let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
if (val2 == undefined)
val2 = "";
if (this.options.cdataPropName) {
currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
} else {
currentNode.add(this.options.textNodeName, val2);
}
i = closeIndex + 2;
} else {
let result = readTagExp(xmlData, i, this.options.removeNSPrefix);
let tagName = result.tagName;
const rawTagName = result.rawTagName;
let tagExp = result.tagExp;
let attrExpPresent = result.attrExpPresent;
let closeIndex = result.closeIndex;
if (this.options.transformTagName) {
tagName = this.options.transformTagName(tagName);
}
if (currentNode && textData) {
if (currentNode.tagname !== "!xml") {
textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
}
}
const lastTag = currentNode;
if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) {
currentNode = this.tagsNodeStack.pop();
jPath = jPath.substring(0, jPath.lastIndexOf("."));
}
if (tagName !== xmlObj.tagname) {
jPath += jPath ? "." + tagName : tagName;
}
if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
let tagContent = "";
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
if (tagName[tagName.length - 1] === "/") {
tagName = tagName.substr(0, tagName.length - 1);
jPath = jPath.substr(0, jPath.length - 1);
tagExp = tagName;
} else {
tagExp = tagExp.substr(0, tagExp.length - 1);
}
i = result.closeIndex;
} else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
i = result.closeIndex;
} else {
const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
if (!result2)
throw new Error(`Unexpected end of ${rawTagName}`);
i = result2.i;
tagContent = result2.tagContent;
}
const childNode = new xmlNode(tagName);
if (tagName !== tagExp && attrExpPresent) {
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
}
if (tagContent) {
tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
}
jPath = jPath.substr(0, jPath.lastIndexOf("."));
childNode.add(this.options.textNodeName, tagContent);
this.addChild(currentNode, childNode, jPath);
} else {
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
if (tagName[tagName.length - 1] === "/") {
tagName = tagName.substr(0, tagName.length - 1);
jPath = jPath.substr(0, jPath.length - 1);
tagExp = tagName;
} else {
tagExp = tagExp.substr(0, tagExp.length - 1);
}
if (this.options.transformTagName) {
tagName = this.options.transformTagName(tagName);
}
const childNode = new xmlNode(tagName);
if (tagName !== tagExp && attrExpPresent) {
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
}
this.addChild(currentNode, childNode, jPath);
jPath = jPath.substr(0, jPath.lastIndexOf("."));
} else {
const childNode = new xmlNode(tagName);
this.tagsNodeStack.push(currentNode);
if (tagName !== tagExp && attrExpPresent) {
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
}
this.addChild(currentNode, childNode, jPath);
currentNode = childNode;
}
textData = "";
i = closeIndex;
}
}
} else {
textData += xmlData[i];
}
}
return xmlObj.child;
};
function addChild(currentNode, childNode, jPath) {
const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
if (result === false) {} else if (typeof result === "string") {
childNode.tagname = result;
currentNode.addChild(childNode);
} else {
currentNode.addChild(childNode);
}
}
var replaceEntitiesValue = function(val2) {
if (this.options.processEntities) {
for (let entityName2 in this.docTypeEntities) {
const entity = this.docTypeEntities[entityName2];
val2 = val2.replace(entity.regx, entity.val);
}
for (let entityName2 in this.lastEntities) {
const entity = this.lastEntities[entityName2];
val2 = val2.replace(entity.regex, entity.val);
}
if (this.options.htmlEntities) {
for (let entityName2 in this.htmlEntities) {
const entity = this.htmlEntities[entityName2];
val2 = val2.replace(entity.regex, entity.val);
}
}
val2 = val2.replace(this.ampEntity.regex, this.ampEntity.val);
}
return val2;
};
function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
if (textData) {
if (isLeafNode === undefined)
isLeafNode = Object.keys(currentNode.child).length === 0;
textData = this.parseTextData(textData, currentNode.tagname, jPath, false, currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false, isLeafNode);
if (textData !== undefined && textData !== "")
currentNode.add(this.options.textNodeName, textData);
textData = "";
}
return textData;
}
function isItStopNode(stopNodes, jPath, currentTagName) {
const allNodesExp = "*." + currentTagName;
for (const stopNodePath in stopNodes) {
const stopNodeExp = stopNodes[stopNodePath];
if (allNodesExp === stopNodeExp || jPath === stopNodeExp)
return true;
}
return false;
}
function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
let attrBoundary;
let tagExp = "";
for (let index = i;index < xmlData.length; index++) {
let ch = xmlData[index];
if (attrBoundary) {
if (ch === attrBoundary)
attrBoundary = "";
} else if (ch === '"' || ch === "'") {
attrBoundary = ch;
} else if (ch === closingChar[0]) {
if (closingChar[1]) {
if (xmlData[index + 1] === closingChar[1]) {
return {
data: tagExp,
index
};
}
} else {
return {
data: tagExp,
index
};
}
} else if (ch === "\t") {
ch = " ";
}
tagExp += ch;
}
}
function findClosingIndex(xmlData, str, i, errMsg) {
const closingIndex = xmlData.indexOf(str, i);
if (closingIndex === -1) {
throw new Error(errMsg);
} else {
return closingIndex + str.length - 1;
}
}
function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
if (!result)
return;
let tagExp = result.data;
const closeIndex = result.index;
const separatorIndex = tagExp.search(/\s/);
let tagName = tagExp;
let attrExpPresent = true;
if (separatorIndex !== -1) {
tagName = tagExp.substring(0, separatorIndex);
tagExp = tagExp.substring(separatorIndex + 1).trimStart();
}
const rawTagName = tagName;
if (removeNSPrefix) {
const colonIndex = tagName.indexOf(":");
if (colonIndex !== -1) {
tagName = tagName.substr(colonIndex + 1);
attrExpPresent = tagName !== result.data.substr(colonIndex + 1);
}
}
return {
tagName,
tagExp,
closeIndex,
attrExpPresent,
rawTagName
};
}
function readStopNodeData(xmlData, tagName, i) {
const startIndex = i;
let openTagCount = 1;
for (;i < xmlData.length; i++) {
if (xmlData[i] === "<") {
if (xmlData[i + 1] === "/") {
const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`);
let closeTagName = xmlData.substring(i + 2, closeIndex).trim();
if (closeTagName === tagName) {
openTagCount--;
if (openTagCount === 0) {
return {
tagContent: xmlData.substring(startIndex, i),
i: closeIndex
};
}
}
i = closeIndex;
} else if (xmlData[i + 1] === "?") {
const closeIndex = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed.");
i = closeIndex;
} else if (xmlData.substr(i + 1, 3) === "!--") {
const closeIndex = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed.");
i = closeIndex;
} else if (xmlData.substr(i + 1, 2) === "![") {
const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
i = closeIndex;
} else {
const tagData = readTagExp(xmlData, i, ">");
if (tagData) {
const openTagName = tagData && tagData.tagName;
if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") {
openTagCount++;
}
i = tagData.closeIndex;
}
}
}
}
}
function parseValue(val2, shouldParse, options) {
if (shouldParse && typeof val2 === "string") {
const newval = val2.trim();
if (newval === "true")
return true;
else if (newval === "false")
return false;
else
return toNumber(val2, options);
} else {
if (util.isExist(val2)) {
return val2;
} else {
return "";
}
}
}
module.exports = OrderedObjParser;
});
// node_modules/fast-xml-parser/src/xmlparser/node2json.js
var require_node2json = __commonJS((exports) => {
function prettify(node, options) {
return compress(node, options);
}
function compress(arr, options, jPath) {
let text;
const compressedObj = {};
for (let i = 0;i < arr.length; i++) {
const tagObj = arr[i];
const property = propName(tagObj);
let newJpath = "";
if (jPath === undefined)
newJpath = property;
else
newJpath = jPath + "." + property;
if (property === options.textNodeName) {
if (text === undefined)
text = tagObj[property];
else
text += "" + tagObj[property];
} else if (property === undefined) {
continue;
} else if (tagObj[property]) {
let val2 = compress(tagObj[property], options, newJpath);
const isLeaf = isLeafTag(val2, options);
if (tagObj[":@"]) {
assignAttributes(val2, tagObj[":@"], newJpath, options);
} else if (Object.keys(val2).length === 1 && val2[options.textNodeName] !== undefined && !options.alwaysCreateTextNode) {
val2 = val2[options.textNodeName];
} else if (Object.keys(val2).length === 0) {
if (options.alwaysCreateTextNode)
val2[options.textNodeName] = "";
else
val2 = "";
}
if (compressedObj[property] !== undefined && compressedObj.hasOwnProperty(property)) {
if (!Array.isArray(compressedObj[property])) {
compressedObj[property] = [compressedObj[property]];
}
compressedObj[property].push(val2);
} else {
if (options.isArray(property, newJpath, isLeaf)) {
compressedObj[property] = [val2];
} else {
compressedObj[property] = val2;
}
}
}
}
if (typeof text === "string") {
if (text.length > 0)
compressedObj[options.textNodeName] = text;
} else if (text !== undefined)
compressedObj[options.textNodeName] = text;
return compressedObj;
}
function propName(obj) {
const keys = Object.keys(obj);
for (let i = 0;i < keys.length; i++) {
const key = keys[i];
if (key !== ":@")
return key;
}
}
function assignAttributes(obj, attrMap, jpath, options) {
if (attrMap) {
const keys = Object.keys(attrMap);
const len = keys.length;
for (let i = 0;i < len; i++) {
const atrrName = keys[i];
if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
obj[atrrName] = [attrMap[atrrName]];
} else {
obj[atrrName] = attrMap[atrrName];
}
}
}
}
function isLeafTag(obj, options) {
const { textNodeName } = options;
const propCount = Object.keys(obj).length;
if (propCount === 0) {
return true;
}
if (propCount === 1 && (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)) {
return true;
}
return false;
}
exports.prettify = prettify;
});
// node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
var require_XMLParser = __commonJS((exports, module) => {
var { buildOptions } = require_OptionsBuilder();
var OrderedObjParser = require_OrderedObjParser();
var { prettify } = require_node2json();
var validator = require_validator();
class XMLParser {
constructor(options) {
this.externalEntities = {};
this.options = buildOptions(options);
}
parse(xmlData, validationOption) {
if (typeof xmlData === "string") {} else if (xmlData.toString) {
xmlData = xmlData.toString();
} else {
throw new Error("XML data is accepted in String or Bytes[] form.");
}
if (validationOption) {
if (validationOption === true)
validationOption = {};
const result = validator.validate(xmlData, validationOption);
if (result !== true) {
throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`);
}
}
const orderedObjParser = new OrderedObjParser(this.options);
orderedObjParser.addExternalEntities(this.externalEntities);
const orderedResult = orderedObjParser.parseXml(xmlData);
if (this.options.preserveOrder || orderedResult === undefined)
return orderedResult;
else
return prettify(orderedResult, this.options);
}
addEntity(key, value) {
if (value.indexOf("&") !== -1) {
throw new Error("Entity value can't have '&'");
} else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) {
throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
} else if (value === "&") {
throw new Error("An entity with value '&' is not permitted");
} else {
this.externalEntities[key] = value;
}
}
}
module.exports = XMLParser;
});
// node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js
var require_orderedJs2Xml = __commonJS((exports, module) => {
var EOL = `
`;
function toXml(jArray, options) {
let indentation = "";
if (options.format && options.indentBy.length > 0) {
indentation = EOL;
}
return arrToStr(jArray, options, "", indentation);
}
function arrToStr(arr, options, jPath, indentation) {
let xmlStr = "";
let isPreviousElementTag = false;
for (let i = 0;i < arr.length; i++) {
const tagObj = arr[i];
const tagName = propName(tagObj);
if (tagName === undefined)
continue;
let newJPath = "";
if (jPath.length === 0)
newJPath = tagName;
else
newJPath = `${jPath}.${tagName}`;
if (tagName === options.textNodeName) {
let tagText = tagObj[tagName];
if (!isStopNode(newJPath, options)) {
tagText = options.tagValueProcessor(tagName, tagText);
tagText = replaceEntitiesValue(tagText, options);
}
if (isPreviousElementTag) {
xmlStr += indentation;
}
xmlStr += tagText;
isPreviousElementTag = false;
continue;
} else if (tagName === options.cdataPropName) {
if (isPreviousElementTag) {
xmlStr += indentation;
}
xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;
isPreviousElementTag = false;
continue;
} else if (tagName === options.commentPropName) {
xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`;
isPreviousElementTag = true;
continue;
} else if (tagName[0] === "?") {
const attStr2 = attr_to_str(tagObj[":@"], options);
const tempInd = tagName === "?xml" ? "" : indentation;
let piTextNodeName = tagObj[tagName][0][options.textNodeName];
piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : "";
xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr2}?>`;
isPreviousElementTag = true;
continue;
}
let newIdentation = indentation;
if (newIdentation !== "") {
newIdentation += options.indentBy;
}
const attStr = attr_to_str(tagObj[":@"], options);
const tagStart = indentation + `<${tagName}${attStr}`;
const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);
if (options.unpairedTags.indexOf(tagName) !== -1) {
if (options.suppressUnpairedNode)
xmlStr += tagStart + ">";
else
xmlStr += tagStart + "/>";
} else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {
xmlStr += tagStart + "/>";
} else if (tagValue && tagValue.endsWith(">")) {
xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>`;
} else {
xmlStr += tagStart + ">";
if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("</"))) {
xmlStr += indentation + options.indentBy + tagValue + indentation;
} else {
xmlStr += tagValue;
}
xmlStr += `</${tagName}>`;
}
isPreviousElementTag = true;
}
return xmlStr;
}
function propName(obj) {
const keys = Object.keys(obj);
for (let i = 0;i < keys.length; i++) {
const key = keys[i];
if (!obj.hasOwnProperty(key))
continue;
if (key !== ":@")
return key;
}
}
function attr_to_str(attrMap, options) {
let attrStr = "";
if (attrMap && !options.ignoreAttributes) {
for (let attr in attrMap) {
if (!attrMap.hasOwnProperty(attr))
continue;
let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
attrVal = replaceEntitiesValue(attrVal, options);
if (attrVal === true && options.suppressBooleanAttributes) {
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;
} else {
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`;
}
}
}
return attrStr;
}
function isStopNode(jPath, options) {
jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
let tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
for (let index in options.stopNodes) {
if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName)
return true;
}
return false;
}
function replaceEntitiesValue(textValue, options) {
if (textValue && textValue.length > 0 && options.processEntities) {
for (let i = 0;i < options.entities.length; i++) {
const entity = options.entities[i];
textValue = textValue.replace(entity.regex, entity.val);
}
}
return textValue;
}
module.exports = toXml;
});
// node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js
var require_json2xml = __commonJS((exports, module) => {
var buildFromOrderedJs = require_orderedJs2Xml();
var getIgnoreAttributesFn = require_ignoreAttributes();
var defaultOptions = {
attributeNamePrefix: "@_",
attributesGroupName: false,
textNodeName: "#text",
ignoreAttributes: true,
cdataPropName: false,
format: false,
indentBy: " ",
suppressEmptyNode: false,
suppressUnpairedNode: true,
suppressBooleanAttributes: true,
tagValueProcessor: function(key, a) {
return a;
},
attributeValueProcessor: function(attrName, a) {
return a;
},
preserveOrder: false,
commentPropName: false,
unpairedTags: [],
entities: [
{ regex: new RegExp("&", "g"), val: "&amp;" },
{ regex: new RegExp(">", "g"), val: "&gt;" },
{ regex: new RegExp("<", "g"), val: "&lt;" },
{ regex: new RegExp("'", "g"), val: "&apos;" },
{ regex: new RegExp('"', "g"), val: "&quot;" }
],
processEntities: true,
stopNodes: [],
oneListGroup: false
};
function Builder(options) {
this.options = Object.assign({}, defaultOptions, options);
if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
this.isAttribute = function() {
return false;
};
} else {
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
this.attrPrefixLen = this.options.attributeNamePrefix.length;
this.isAttribute = isAttribute;
}
this.processTextOrObjNode = processTextOrObjNode;
if (this.options.format) {
this.indentate = indentate;
this.tagEndChar = `>
`;
this.newLine = `
`;
} else {
this.indentate = function() {
return "";
};
this.tagEndChar = ">";
this.newLine = "";
}
}
Builder.prototype.build = function(jObj) {
if (this.options.preserveOrder) {
return buildFromOrderedJs(jObj, this.options);
} else {
if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {
jObj = {
[this.options.arrayNodeName]: jObj
};
}
return this.j2x(jObj, 0, []).val;
}
};
Builder.prototype.j2x = function(jObj, level, ajPath) {
let attrStr = "";
let val2 = "";
const jPath = ajPath.join(".");
for (let key in jObj) {
if (!Object.prototype.hasOwnProperty.call(jObj, key))
continue;
if (typeof jObj[key] === "undefined") {
if (this.isAttribute(key)) {
val2 += "";
}
} else if (jObj[key] === null) {
if (this.isAttribute(key)) {
val2 += "";
} else if (key[0] === "?") {
val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar;
} else {
val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
}
} else if (jObj[key] instanceof Date) {
val2 += this.buildTextValNode(jObj[key], key, "", level);
} else if (typeof jObj[key] !== "object") {
const attr = this.isAttribute(key);
if (attr && !this.ignoreAttributesFn(attr, jPath)) {
attrStr += this.buildAttrPairStr(attr, "" + jObj[key]);
} else if (!attr) {
if (key === this.options.textNodeName) {
let newval = this.options.tagValueProcessor(key, "" + jObj[key]);
val2 += this.replaceEntitiesValue(newval);
} else {
val2 += this.buildTextValNode(jObj[key], key, "", level);
}
}
} else if (Array.isArray(jObj[key])) {
const arrLen = jObj[key].length;
let listTagVal = "";
let listTagAttr = "";
for (let j = 0;j < arrLen; j++) {
const item = jObj[key][j];
if (typeof item === "undefined") {} else if (item === null) {
if (key[0] === "?")
val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar;
else
val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
} else if (typeof item === "object") {
if (this.options.oneListGroup) {
const result = this.j2x(item, level + 1, ajPath.concat(key));
listTagVal += result.val;
if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
listTagAttr += result.attrStr;
}
} else {
listTagVal += this.processTextOrObjNode(item, key, level, ajPath);
}
} else {
if (this.options.oneListGroup) {
let textValue = this.options.tagValueProcessor(key, item);
textValue = this.replaceEntitiesValue(textValue);
listTagVal += textValue;
} else {
listTagVal += this.buildTextValNode(item, key, "", level);
}
}
}
if (this.options.oneListGroup) {
listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);
}
val2 += listTagVal;
} else {
if (this.options.attributesGroupName && key === this.options.attributesGroupName) {
const Ks = Object.keys(jObj[key]);
const L = Ks.length;
for (let j = 0;j < L; j++) {
attrStr += this.buildAttrPairStr(Ks[j], "" + jObj[key][Ks[j]]);
}
} else {
val2 += this.processTextOrObjNode(jObj[key], key, level, ajPath);
}
}
}
return { attrStr, val: val2 };
};
Builder.prototype.buildAttrPairStr = function(attrName, val2) {
val2 = this.options.attributeValueProcessor(attrName, "" + val2);
val2 = this.replaceEntitiesValue(val2);
if (this.options.suppressBooleanAttributes && val2 === "true") {
return " " + attrName;
} else
return " " + attrName + '="' + val2 + '"';
};
function processTextOrObjNode(object, key, level, ajPath) {
const result = this.j2x(object, level + 1, ajPath.concat(key));
if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {
return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
} else {
return this.buildObjectNode(result.val, key, result.attrStr, level);
}
}
Builder.prototype.buildObjectNode = function(val2, key, attrStr, level) {
if (val2 === "") {
if (key[0] === "?")
return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
else {
return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar;
}
} else {
let tagEndExp = "</" + key + this.tagEndChar;
let piClosingChar = "";
if (key[0] === "?") {
piClosingChar = "?";
tagEndExp = "";
}
if ((attrStr || attrStr === "") && val2.indexOf("<") === -1) {
return this.indentate(level) + "<" + key + attrStr + piClosingChar + ">" + val2 + tagEndExp;
} else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
return this.indentate(level) + `<!--${val2}-->` + this.newLine;
} else {
return this.indentate(level) + "<" + key + attrStr + piClosingChar + this.tagEndChar + val2 + this.indentate(level) + tagEndExp;
}
}
};
Builder.prototype.closeTag = function(key) {
let closeTag = "";
if (this.options.unpairedTags.indexOf(key) !== -1) {
if (!this.options.suppressUnpairedNode)
closeTag = "/";
} else if (this.options.suppressEmptyNode) {
closeTag = "/";
} else {
closeTag = `></${key}`;
}
return closeTag;
};
Builder.prototype.buildTextValNode = function(val2, key, attrStr, level) {
if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {
return this.indentate(level) + `<![CDATA[${val2}]]>` + this.newLine;
} else if (this.options.commentPropName !== false && key === this.options.commentPropName) {
return this.indentate(level) + `<!--${val2}-->` + this.newLine;
} else if (key[0] === "?") {
return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
} else {
let textValue = this.options.tagValueProcessor(key, val2);
textValue = this.replaceEntitiesValue(textValue);
if (textValue === "") {
return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar;
} else {
return this.indentate(level) + "<" + key + attrStr + ">" + textValue + "</" + key + this.tagEndChar;
}
}
};
Builder.prototype.replaceEntitiesValue = function(textValue) {
if (textValue && textValue.length > 0 && this.options.processEntities) {
for (let i = 0;i < this.options.entities.length; i++) {
const entity = this.options.entities[i];
textValue = textValue.replace(entity.regex, entity.val);
}
}
return textValue;
};
function indentate(level) {
return this.options.indentBy.repeat(level);
}
function isAttribute(name) {
if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {
return name.substr(this.attrPrefixLen);
} else {
return false;
}
}
module.exports = Builder;
});
// node_modules/fast-xml-parser/src/fxp.js
var require_fxp = __commonJS((exports, module) => {
var validator = require_validator();
var XMLParser = require_XMLParser();
var XMLBuilder = require_json2xml();
module.exports = {
XMLParser,
XMLValidator: validator,
XMLBuilder
};
});
// node_modules/ipaddr.js/lib/ipaddr.js
var require_ipaddr = __commonJS((exports, module) => {
(function(root) {
const ipv4Part = "(0?\\d+|0x[a-f0-9]+)";
const ipv4Regexes = {
fourOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, "i"),
threeOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, "i"),
twoOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}$`, "i"),
longValue: new RegExp(`^${ipv4Part}$`, "i")
};
const octalRegex = new RegExp(`^0[0-7]+$`, "i");
const hexRegex = new RegExp(`^0x[a-f0-9]+$`, "i");
const zoneIndex = "%[0-9a-z]{1,}";
const ipv6Part = "(?:[0-9a-f]+::?)+";
const ipv6Regexes = {
zoneIndex: new RegExp(zoneIndex, "i"),
native: new RegExp(`^(::)?(${ipv6Part})?([0-9a-f]+)?(::)?(${zoneIndex})?$`, "i"),
deprecatedTransitional: new RegExp(`^(?:::)(${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?)$`, "i"),
transitional: new RegExp(`^((?:${ipv6Part})|(?:::)(?:${ipv6Part})?)${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?$`, "i")
};
function expandIPv6(string, parts) {
if (string.indexOf("::") !== string.lastIndexOf("::")) {
return null;
}
let colonCount = 0;
let lastColon = -1;
let zoneId = (string.match(ipv6Regexes.zoneIndex) || [])[0];
let replacement, replacementCount;
if (zoneId) {
zoneId = zoneId.substring(1);
string = string.replace(/%.+$/, "");
}
while ((lastColon = string.indexOf(":", lastColon + 1)) >= 0) {
colonCount++;
}
if (string.substr(0, 2) === "::") {
colonCount--;
}
if (string.substr(-2, 2) === "::") {
colonCount--;
}
if (colonCount > parts) {
return null;
}
replacementCount = parts - colonCount;
replacement = ":";
while (replacementCount--) {
replacement += "0:";
}
string = string.replace("::", replacement);
if (string[0] === ":") {
string = string.slice(1);
}
if (string[string.length - 1] === ":") {
string = string.slice(0, -1);
}
parts = function() {
const ref = string.split(":");
const results = [];
for (let i = 0;i < ref.length; i++) {
results.push(parseInt(ref[i], 16));
}
return results;
}();
return {
parts,
zoneId
};
}
function matchCIDR(first, second, partSize, cidrBits) {
if (first.length !== second.length) {
throw new Error("ipaddr: cannot match CIDR for objects with different lengths");
}
let part = 0;
let shift;
while (cidrBits > 0) {
shift = partSize - cidrBits;
if (shift < 0) {
shift = 0;
}
if (first[part] >> shift !== second[part] >> shift) {
return false;
}
cidrBits -= partSize;
part += 1;
}
return true;
}
function parseIntAuto(string) {
if (hexRegex.test(string)) {
return parseInt(string, 16);
}
if (string[0] === "0" && !isNaN(parseInt(string[1], 10))) {
if (octalRegex.test(string)) {
return parseInt(string, 8);
}
throw new Error(`ipaddr: cannot parse ${string} as octal`);
}
return parseInt(string, 10);
}
function padPart(part, length) {
while (part.length < length) {
part = `0${part}`;
}
return part;
}
const ipaddr = {};
ipaddr.IPv4 = function() {
function IPv4(octets) {
if (octets.length !== 4) {
throw new Error("ipaddr: ipv4 octet count should be 4");
}
let i, octet;
for (i = 0;i < octets.length; i++) {
octet = octets[i];
if (!(0 <= octet && octet <= 255)) {
throw new Error("ipaddr: ipv4 octet should fit in 8 bits");
}
}
this.octets = octets;
}
IPv4.prototype.SpecialRanges = {
unspecified: [[new IPv4([0, 0, 0, 0]), 8]],
broadcast: [[new IPv4([255, 255, 255, 255]), 32]],
multicast: [[new IPv4([224, 0, 0, 0]), 4]],
linkLocal: [[new IPv4([169, 254, 0, 0]), 16]],
loopback: [[new IPv4([127, 0, 0, 0]), 8]],
carrierGradeNat: [[new IPv4([100, 64, 0, 0]), 10]],
private: [
[new IPv4([10, 0, 0, 0]), 8],
[new IPv4([172, 16, 0, 0]), 12],
[new IPv4([192, 168, 0, 0]), 16]
],
reserved: [
[new IPv4([192, 0, 0, 0]), 24],
[new IPv4([192, 0, 2, 0]), 24],
[new IPv4([192, 88, 99, 0]), 24],
[new IPv4([198, 18, 0, 0]), 15],
[new IPv4([198, 51, 100, 0]), 24],
[new IPv4([203, 0, 113, 0]), 24],
[new IPv4([240, 0, 0, 0]), 4]
],
as112: [
[new IPv4([192, 175, 48, 0]), 24],
[new IPv4([192, 31, 196, 0]), 24]
],
amt: [
[new IPv4([192, 52, 193, 0]), 24]
]
};
IPv4.prototype.kind = function() {
return "ipv4";
};
IPv4.prototype.match = function(other, cidrRange) {
let ref;
if (cidrRange === undefined) {
ref = other;
other = ref[0];
cidrRange = ref[1];
}
if (other.kind() !== "ipv4") {
throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");
}
return matchCIDR(this.octets, other.octets, 8, cidrRange);
};
IPv4.prototype.prefixLengthFromSubnetMask = function() {
let cidr = 0;
let stop = false;
const zerotable = {
0: 8,
128: 7,
192: 6,
224: 5,
240: 4,
248: 3,
252: 2,
254: 1,
255: 0
};
let i, octet, zeros;
for (i = 3;i >= 0; i -= 1) {
octet = this.octets[i];
if (octet in zerotable) {
zeros = zerotable[octet];
if (stop && zeros !== 0) {
return null;
}
if (zeros !== 8) {
stop = true;
}
cidr += zeros;
} else {
return null;
}
}
return 32 - cidr;
};
IPv4.prototype.range = function() {
return ipaddr.subnetMatch(this, this.SpecialRanges);
};
IPv4.prototype.toByteArray = function() {
return this.octets.slice(0);
};
IPv4.prototype.toIPv4MappedAddress = function() {
return ipaddr.IPv6.parse(`::ffff:${this.toString()}`);
};
IPv4.prototype.toNormalizedString = function() {
return this.toString();
};
IPv4.prototype.toString = function() {
return this.octets.join(".");
};
return IPv4;
}();
ipaddr.IPv4.broadcastAddressFromCIDR = function(string) {
try {
const cidr = this.parseCIDR(string);
const ipInterfaceOctets = cidr[0].toByteArray();
const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
const octets = [];
let i = 0;
while (i < 4) {
octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255);
i++;
}
return new this(octets);
} catch (e) {
throw new Error("ipaddr: the address does not have IPv4 CIDR format");
}
};
ipaddr.IPv4.isIPv4 = function(string) {
return this.parser(string) !== null;
};
ipaddr.IPv4.isValid = function(string) {
try {
new this(this.parser(string));
return true;
} catch (e) {
return false;
}
};
ipaddr.IPv4.isValidCIDR = function(string) {
try {
this.parseCIDR(string);
return true;
} catch (e) {
return false;
}
};
ipaddr.IPv4.isValidFourPartDecimal = function(string) {
if (ipaddr.IPv4.isValid(string) && string.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)) {
return true;
} else {
return false;
}
};
ipaddr.IPv4.networkAddressFromCIDR = function(string) {
let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;
try {
cidr = this.parseCIDR(string);
ipInterfaceOctets = cidr[0].toByteArray();
subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
octets = [];
i = 0;
while (i < 4) {
octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10));
i++;
}
return new this(octets);
} catch (e) {
throw new Error("ipaddr: the address does not have IPv4 CIDR format");
}
};
ipaddr.IPv4.parse = function(string) {
const parts = this.parser(string);
if (parts === null) {
throw new Error("ipaddr: string is not formatted like an IPv4 Address");
}
return new this(parts);
};
ipaddr.IPv4.parseCIDR = function(string) {
let match;
if (match = string.match(/^(.+)\/(\d+)$/)) {
const maskLength = parseInt(match[2]);
if (maskLength >= 0 && maskLength <= 32) {
const parsed = [this.parse(match[1]), maskLength];
Object.defineProperty(parsed, "toString", {
value: function() {
return this.join("/");
}
});
return parsed;
}
}
throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range");
};
ipaddr.IPv4.parser = function(string) {
let match, part, value;
if (match = string.match(ipv4Regexes.fourOctet)) {
return function() {
const ref = match.slice(1, 6);
const results = [];
for (let i = 0;i < ref.length; i++) {
part = ref[i];
results.push(parseIntAuto(part));
}
return results;
}();
} else if (match = string.match(ipv4Regexes.longValue)) {
value = parseIntAuto(match[1]);
if (value > 4294967295 || value < 0) {
throw new Error("ipaddr: address outside defined range");
}
return function() {
const results = [];
let shift;
for (shift = 0;shift <= 24; shift += 8) {
results.push(value >> shift & 255);
}
return results;
}().reverse();
} else if (match = string.match(ipv4Regexes.twoOctet)) {
return function() {
const ref = match.slice(1, 4);
const results = [];
value = parseIntAuto(ref[1]);
if (value > 16777215 || value < 0) {
throw new Error("ipaddr: address outside defined range");
}
results.push(parseIntAuto(ref[0]));
results.push(value >> 16 & 255);
results.push(value >> 8 & 255);
results.push(value & 255);
return results;
}();
} else if (match = string.match(ipv4Regexes.threeOctet)) {
return function() {
const ref = match.slice(1, 5);
const results = [];
value = parseIntAuto(ref[2]);
if (value > 65535 || value < 0) {
throw new Error("ipaddr: address outside defined range");
}
results.push(parseIntAuto(ref[0]));
results.push(parseIntAuto(ref[1]));
results.push(value >> 8 & 255);
results.push(value & 255);
return results;
}();
} else {
return null;
}
};
ipaddr.IPv4.subnetMaskFromPrefixLength = function(prefix) {
prefix = parseInt(prefix);
if (prefix < 0 || prefix > 32) {
throw new Error("ipaddr: invalid IPv4 prefix length");
}
const octets = [0, 0, 0, 0];
let j = 0;
const filledOctetCount = Math.floor(prefix / 8);
while (j < filledOctetCount) {
octets[j] = 255;
j++;
}
if (filledOctetCount < 4) {
octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - prefix % 8;
}
return new this(octets);
};
ipaddr.IPv6 = function() {
function IPv6(parts, zoneId) {
let i, part;
if (parts.length === 16) {
this.parts = [];
for (i = 0;i <= 14; i += 2) {
this.parts.push(parts[i] << 8 | parts[i + 1]);
}
} else if (parts.length === 8) {
this.parts = parts;
} else {
throw new Error("ipaddr: ipv6 part count should be 8 or 16");
}
for (i = 0;i < this.parts.length; i++) {
part = this.parts[i];
if (!(0 <= part && part <= 65535)) {
throw new Error("ipaddr: ipv6 part should fit in 16 bits");
}
}
if (zoneId) {
this.zoneId = zoneId;
}
}
IPv6.prototype.SpecialRanges = {
unspecified: [new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128],
linkLocal: [new IPv6([65152, 0, 0, 0, 0, 0, 0, 0]), 10],
multicast: [new IPv6([65280, 0, 0, 0, 0, 0, 0, 0]), 8],
loopback: [new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128],
uniqueLocal: [new IPv6([64512, 0, 0, 0, 0, 0, 0, 0]), 7],
ipv4Mapped: [new IPv6([0, 0, 0, 0, 0, 65535, 0, 0]), 96],
discard: [new IPv6([256, 0, 0, 0, 0, 0, 0, 0]), 64],
rfc6145: [new IPv6([0, 0, 0, 0, 65535, 0, 0, 0]), 96],
rfc6052: [new IPv6([100, 65435, 0, 0, 0, 0, 0, 0]), 96],
"6to4": [new IPv6([8194, 0, 0, 0, 0, 0, 0, 0]), 16],
teredo: [new IPv6([8193, 0, 0, 0, 0, 0, 0, 0]), 32],
benchmarking: [new IPv6([8193, 2, 0, 0, 0, 0, 0, 0]), 48],
amt: [new IPv6([8193, 3, 0, 0, 0, 0, 0, 0]), 32],
as112v6: [
[new IPv6([8193, 4, 274, 0, 0, 0, 0, 0]), 48],
[new IPv6([9760, 79, 32768, 0, 0, 0, 0, 0]), 48]
],
deprecated: [new IPv6([8193, 16, 0, 0, 0, 0, 0, 0]), 28],
orchid2: [new IPv6([8193, 32, 0, 0, 0, 0, 0, 0]), 28],
droneRemoteIdProtocolEntityTags: [new IPv6([8193, 48, 0, 0, 0, 0, 0, 0]), 28],
reserved: [
[new IPv6([8193, 0, 0, 0, 0, 0, 0, 0]), 23],
[new IPv6([8193, 3512, 0, 0, 0, 0, 0, 0]), 32]
]
};
IPv6.prototype.isIPv4MappedAddress = function() {
return this.range() === "ipv4Mapped";
};
IPv6.prototype.kind = function() {
return "ipv6";
};
IPv6.prototype.match = function(other, cidrRange) {
let ref;
if (cidrRange === undefined) {
ref = other;
other = ref[0];
cidrRange = ref[1];
}
if (other.kind() !== "ipv6") {
throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");
}
return matchCIDR(this.parts, other.parts, 16, cidrRange);
};
IPv6.prototype.prefixLengthFromSubnetMask = function() {
let cidr = 0;
let stop = false;
const zerotable = {
0: 16,
32768: 15,
49152: 14,
57344: 13,
61440: 12,
63488: 11,
64512: 10,
65024: 9,
65280: 8,
65408: 7,
65472: 6,
65504: 5,
65520: 4,
65528: 3,
65532: 2,
65534: 1,
65535: 0
};
let part, zeros;
for (let i = 7;i >= 0; i -= 1) {
part = this.parts[i];
if (part in zerotable) {
zeros = zerotable[part];
if (stop && zeros !== 0) {
return null;
}
if (zeros !== 16) {
stop = true;
}
cidr += zeros;
} else {
return null;
}
}
return 128 - cidr;
};
IPv6.prototype.range = function() {
return ipaddr.subnetMatch(this, this.SpecialRanges);
};
IPv6.prototype.toByteArray = function() {
let part;
const bytes = [];
const ref = this.parts;
for (let i = 0;i < ref.length; i++) {
part = ref[i];
bytes.push(part >> 8);
bytes.push(part & 255);
}
return bytes;
};
IPv6.prototype.toFixedLengthString = function() {
const addr = function() {
const results = [];
for (let i = 0;i < this.parts.length; i++) {
results.push(padPart(this.parts[i].toString(16), 4));
}
return results;
}.call(this).join(":");
let suffix = "";
if (this.zoneId) {
suffix = `%${this.zoneId}`;
}
return addr + suffix;
};
IPv6.prototype.toIPv4Address = function() {
if (!this.isIPv4MappedAddress()) {
throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");
}
const ref = this.parts.slice(-2);
const high = ref[0];
const low = ref[1];
return new ipaddr.IPv4([high >> 8, high & 255, low >> 8, low & 255]);
};
IPv6.prototype.toNormalizedString = function() {
const addr = function() {
const results = [];
for (let i = 0;i < this.parts.length; i++) {
results.push(this.parts[i].toString(16));
}
return results;
}.call(this).join(":");
let suffix = "";
if (this.zoneId) {
suffix = `%${this.zoneId}`;
}
return addr + suffix;
};
IPv6.prototype.toRFC5952String = function() {
const regex = /((^|:)(0(:|$)){2,})/g;
const string = this.toNormalizedString();
let bestMatchIndex = 0;
let bestMatchLength = -1;
let match;
while (match = regex.exec(string)) {
if (match[0].length > bestMatchLength) {
bestMatchIndex = match.index;
bestMatchLength = match[0].length;
}
}
if (bestMatchLength < 0) {
return string;
}
return `${string.substring(0, bestMatchIndex)}::${string.substring(bestMatchIndex + bestMatchLength)}`;
};
IPv6.prototype.toString = function() {
return this.toRFC5952String();
};
return IPv6;
}();
ipaddr.IPv6.broadcastAddressFromCIDR = function(string) {
try {
const cidr = this.parseCIDR(string);
const ipInterfaceOctets = cidr[0].toByteArray();
const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
const octets = [];
let i = 0;
while (i < 16) {
octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255);
i++;
}
return new this(octets);
} catch (e) {
throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);
}
};
ipaddr.IPv6.isIPv6 = function(string) {
return this.parser(string) !== null;
};
ipaddr.IPv6.isValid = function(string) {
if (typeof string === "string" && string.indexOf(":") === -1) {
return false;
}
try {
const addr = this.parser(string);
new this(addr.parts, addr.zoneId);
return true;
} catch (e) {
return false;
}
};
ipaddr.IPv6.isValidCIDR = function(string) {
if (typeof string === "string" && string.indexOf(":") === -1) {
return false;
}
try {
this.parseCIDR(string);
return true;
} catch (e) {
return false;
}
};
ipaddr.IPv6.networkAddressFromCIDR = function(string) {
let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;
try {
cidr = this.parseCIDR(string);
ipInterfaceOctets = cidr[0].toByteArray();
subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
octets = [];
i = 0;
while (i < 16) {
octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10));
i++;
}
return new this(octets);
} catch (e) {
throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);
}
};
ipaddr.IPv6.parse = function(string) {
const addr = this.parser(string);
if (addr.parts === null) {
throw new Error("ipaddr: string is not formatted like an IPv6 Address");
}
return new this(addr.parts, addr.zoneId);
};
ipaddr.IPv6.parseCIDR = function(string) {
let maskLength, match, parsed;
if (match = string.match(/^(.+)\/(\d+)$/)) {
maskLength = parseInt(match[2]);
if (maskLength >= 0 && maskLength <= 128) {
parsed = [this.parse(match[1]), maskLength];
Object.defineProperty(parsed, "toString", {
value: function() {
return this.join("/");
}
});
return parsed;
}
}
throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range");
};
ipaddr.IPv6.parser = function(string) {
let addr, i, match, octet, octets, zoneId;
if (match = string.match(ipv6Regexes.deprecatedTransitional)) {
return this.parser(`::ffff:${match[1]}`);
}
if (ipv6Regexes.native.test(string)) {
return expandIPv6(string, 8);
}
if (match = string.match(ipv6Regexes.transitional)) {
zoneId = match[6] || "";
addr = match[1];
if (!match[1].endsWith("::")) {
addr = addr.slice(0, -1);
}
addr = expandIPv6(addr + zoneId, 6);
if (addr.parts) {
octets = [
parseInt(match[2]),
parseInt(match[3]),
parseInt(match[4]),
parseInt(match[5])
];
for (i = 0;i < octets.length; i++) {
octet = octets[i];
if (!(0 <= octet && octet <= 255)) {
return null;
}
}
addr.parts.push(octets[0] << 8 | octets[1]);
addr.parts.push(octets[2] << 8 | octets[3]);
return {
parts: addr.parts,
zoneId: addr.zoneId
};
}
}
return null;
};
ipaddr.IPv6.subnetMaskFromPrefixLength = function(prefix) {
prefix = parseInt(prefix);
if (prefix < 0 || prefix > 128) {
throw new Error("ipaddr: invalid IPv6 prefix length");
}
const octets = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let j = 0;
const filledOctetCount = Math.floor(prefix / 8);
while (j < filledOctetCount) {
octets[j] = 255;
j++;
}
if (filledOctetCount < 16) {
octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - prefix % 8;
}
return new this(octets);
};
ipaddr.fromByteArray = function(bytes) {
const length = bytes.length;
if (length === 4) {
return new ipaddr.IPv4(bytes);
} else if (length === 16) {
return new ipaddr.IPv6(bytes);
} else {
throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address");
}
};
ipaddr.isValid = function(string) {
return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string);
};
ipaddr.isValidCIDR = function(string) {
return ipaddr.IPv6.isValidCIDR(string) || ipaddr.IPv4.isValidCIDR(string);
};
ipaddr.parse = function(string) {
if (ipaddr.IPv6.isValid(string)) {
return ipaddr.IPv6.parse(string);
} else if (ipaddr.IPv4.isValid(string)) {
return ipaddr.IPv4.parse(string);
} else {
throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format");
}
};
ipaddr.parseCIDR = function(string) {
try {
return ipaddr.IPv6.parseCIDR(string);
} catch (e) {
try {
return ipaddr.IPv4.parseCIDR(string);
} catch (e2) {
throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format");
}
}
};
ipaddr.process = function(string) {
const addr = this.parse(string);
if (addr.kind() === "ipv6" && addr.isIPv4MappedAddress()) {
return addr.toIPv4Address();
} else {
return addr;
}
};
ipaddr.subnetMatch = function(address, rangeList, defaultName) {
let i, rangeName, rangeSubnets, subnet;
if (defaultName === undefined || defaultName === null) {
defaultName = "unicast";
}
for (rangeName in rangeList) {
if (Object.prototype.hasOwnProperty.call(rangeList, rangeName)) {
rangeSubnets = rangeList[rangeName];
if (rangeSubnets[0] && !(rangeSubnets[0] instanceof Array)) {
rangeSubnets = [rangeSubnets];
}
for (i = 0;i < rangeSubnets.length; i++) {
subnet = rangeSubnets[i];
if (address.kind() === subnet[0].kind() && address.match.apply(address, subnet)) {
return rangeName;
}
}
}
}
return defaultName;
};
if (typeof module !== "undefined" && module.exports) {
module.exports = ipaddr;
} else {
root.ipaddr = ipaddr;
}
})(exports);
});
// node_modules/mime-db/db.json
var require_db = __commonJS((exports, module) => {
module.exports = {
"application/1d-interleaved-parityfec": {
source: "iana"
},
"application/3gpdash-qoe-report+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/3gpp-ims+xml": {
source: "iana",
compressible: true
},
"application/3gpphal+json": {
source: "iana",
compressible: true
},
"application/3gpphalforms+json": {
source: "iana",
compressible: true
},
"application/a2l": {
source: "iana"
},
"application/ace+cbor": {
source: "iana"
},
"application/activemessage": {
source: "iana"
},
"application/activity+json": {
source: "iana",
compressible: true
},
"application/alto-costmap+json": {
source: "iana",
compressible: true
},
"application/alto-costmapfilter+json": {
source: "iana",
compressible: true
},
"application/alto-directory+json": {
source: "iana",
compressible: true
},
"application/alto-endpointcost+json": {
source: "iana",
compressible: true
},
"application/alto-endpointcostparams+json": {
source: "iana",
compressible: true
},
"application/alto-endpointprop+json": {
source: "iana",
compressible: true
},
"application/alto-endpointpropparams+json": {
source: "iana",
compressible: true
},
"application/alto-error+json": {
source: "iana",
compressible: true
},
"application/alto-networkmap+json": {
source: "iana",
compressible: true
},
"application/alto-networkmapfilter+json": {
source: "iana",
compressible: true
},
"application/alto-updatestreamcontrol+json": {
source: "iana",
compressible: true
},
"application/alto-updatestreamparams+json": {
source: "iana",
compressible: true
},
"application/aml": {
source: "iana"
},
"application/andrew-inset": {
source: "iana",
extensions: ["ez"]
},
"application/applefile": {
source: "iana"
},
"application/applixware": {
source: "apache",
extensions: ["aw"]
},
"application/at+jwt": {
source: "iana"
},
"application/atf": {
source: "iana"
},
"application/atfx": {
source: "iana"
},
"application/atom+xml": {
source: "iana",
compressible: true,
extensions: ["atom"]
},
"application/atomcat+xml": {
source: "iana",
compressible: true,
extensions: ["atomcat"]
},
"application/atomdeleted+xml": {
source: "iana",
compressible: true,
extensions: ["atomdeleted"]
},
"application/atomicmail": {
source: "iana"
},
"application/atomsvc+xml": {
source: "iana",
compressible: true,
extensions: ["atomsvc"]
},
"application/atsc-dwd+xml": {
source: "iana",
compressible: true,
extensions: ["dwd"]
},
"application/atsc-dynamic-event-message": {
source: "iana"
},
"application/atsc-held+xml": {
source: "iana",
compressible: true,
extensions: ["held"]
},
"application/atsc-rdt+json": {
source: "iana",
compressible: true
},
"application/atsc-rsat+xml": {
source: "iana",
compressible: true,
extensions: ["rsat"]
},
"application/atxml": {
source: "iana"
},
"application/auth-policy+xml": {
source: "iana",
compressible: true
},
"application/bacnet-xdd+zip": {
source: "iana",
compressible: false
},
"application/batch-smtp": {
source: "iana"
},
"application/bdoc": {
compressible: false,
extensions: ["bdoc"]
},
"application/beep+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/calendar+json": {
source: "iana",
compressible: true
},
"application/calendar+xml": {
source: "iana",
compressible: true,
extensions: ["xcs"]
},
"application/call-completion": {
source: "iana"
},
"application/cals-1840": {
source: "iana"
},
"application/captive+json": {
source: "iana",
compressible: true
},
"application/cbor": {
source: "iana"
},
"application/cbor-seq": {
source: "iana"
},
"application/cccex": {
source: "iana"
},
"application/ccmp+xml": {
source: "iana",
compressible: true
},
"application/ccxml+xml": {
source: "iana",
compressible: true,
extensions: ["ccxml"]
},
"application/cdfx+xml": {
source: "iana",
compressible: true,
extensions: ["cdfx"]
},
"application/cdmi-capability": {
source: "iana",
extensions: ["cdmia"]
},
"application/cdmi-container": {
source: "iana",
extensions: ["cdmic"]
},
"application/cdmi-domain": {
source: "iana",
extensions: ["cdmid"]
},
"application/cdmi-object": {
source: "iana",
extensions: ["cdmio"]
},
"application/cdmi-queue": {
source: "iana",
extensions: ["cdmiq"]
},
"application/cdni": {
source: "iana"
},
"application/cea": {
source: "iana"
},
"application/cea-2018+xml": {
source: "iana",
compressible: true
},
"application/cellml+xml": {
source: "iana",
compressible: true
},
"application/cfw": {
source: "iana"
},
"application/city+json": {
source: "iana",
compressible: true
},
"application/clr": {
source: "iana"
},
"application/clue+xml": {
source: "iana",
compressible: true
},
"application/clue_info+xml": {
source: "iana",
compressible: true
},
"application/cms": {
source: "iana"
},
"application/cnrp+xml": {
source: "iana",
compressible: true
},
"application/coap-group+json": {
source: "iana",
compressible: true
},
"application/coap-payload": {
source: "iana"
},
"application/commonground": {
source: "iana"
},
"application/conference-info+xml": {
source: "iana",
compressible: true
},
"application/cose": {
source: "iana"
},
"application/cose-key": {
source: "iana"
},
"application/cose-key-set": {
source: "iana"
},
"application/cpl+xml": {
source: "iana",
compressible: true,
extensions: ["cpl"]
},
"application/csrattrs": {
source: "iana"
},
"application/csta+xml": {
source: "iana",
compressible: true
},
"application/cstadata+xml": {
source: "iana",
compressible: true
},
"application/csvm+json": {
source: "iana",
compressible: true
},
"application/cu-seeme": {
source: "apache",
extensions: ["cu"]
},
"application/cwt": {
source: "iana"
},
"application/cybercash": {
source: "iana"
},
"application/dart": {
compressible: true
},
"application/dash+xml": {
source: "iana",
compressible: true,
extensions: ["mpd"]
},
"application/dash-patch+xml": {
source: "iana",
compressible: true,
extensions: ["mpp"]
},
"application/dashdelta": {
source: "iana"
},
"application/davmount+xml": {
source: "iana",
compressible: true,
extensions: ["davmount"]
},
"application/dca-rft": {
source: "iana"
},
"application/dcd": {
source: "iana"
},
"application/dec-dx": {
source: "iana"
},
"application/dialog-info+xml": {
source: "iana",
compressible: true
},
"application/dicom": {
source: "iana"
},
"application/dicom+json": {
source: "iana",
compressible: true
},
"application/dicom+xml": {
source: "iana",
compressible: true
},
"application/dii": {
source: "iana"
},
"application/dit": {
source: "iana"
},
"application/dns": {
source: "iana"
},
"application/dns+json": {
source: "iana",
compressible: true
},
"application/dns-message": {
source: "iana"
},
"application/docbook+xml": {
source: "apache",
compressible: true,
extensions: ["dbk"]
},
"application/dots+cbor": {
source: "iana"
},
"application/dskpp+xml": {
source: "iana",
compressible: true
},
"application/dssc+der": {
source: "iana",
extensions: ["dssc"]
},
"application/dssc+xml": {
source: "iana",
compressible: true,
extensions: ["xdssc"]
},
"application/dvcs": {
source: "iana"
},
"application/ecmascript": {
source: "iana",
compressible: true,
extensions: ["es", "ecma"]
},
"application/edi-consent": {
source: "iana"
},
"application/edi-x12": {
source: "iana",
compressible: false
},
"application/edifact": {
source: "iana",
compressible: false
},
"application/efi": {
source: "iana"
},
"application/elm+json": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/elm+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.cap+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/emergencycalldata.comment+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.control+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.deviceinfo+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.ecall.msd": {
source: "iana"
},
"application/emergencycalldata.providerinfo+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.serviceinfo+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.subscriberinfo+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.veds+xml": {
source: "iana",
compressible: true
},
"application/emma+xml": {
source: "iana",
compressible: true,
extensions: ["emma"]
},
"application/emotionml+xml": {
source: "iana",
compressible: true,
extensions: ["emotionml"]
},
"application/encaprtp": {
source: "iana"
},
"application/epp+xml": {
source: "iana",
compressible: true
},
"application/epub+zip": {
source: "iana",
compressible: false,
extensions: ["epub"]
},
"application/eshop": {
source: "iana"
},
"application/exi": {
source: "iana",
extensions: ["exi"]
},
"application/expect-ct-report+json": {
source: "iana",
compressible: true
},
"application/express": {
source: "iana",
extensions: ["exp"]
},
"application/fastinfoset": {
source: "iana"
},
"application/fastsoap": {
source: "iana"
},
"application/fdt+xml": {
source: "iana",
compressible: true,
extensions: ["fdt"]
},
"application/fhir+json": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/fhir+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/fido.trusted-apps+json": {
compressible: true
},
"application/fits": {
source: "iana"
},
"application/flexfec": {
source: "iana"
},
"application/font-sfnt": {
source: "iana"
},
"application/font-tdpfr": {
source: "iana",
extensions: ["pfr"]
},
"application/font-woff": {
source: "iana",
compressible: false
},
"application/framework-attributes+xml": {
source: "iana",
compressible: true
},
"application/geo+json": {
source: "iana",
compressible: true,
extensions: ["geojson"]
},
"application/geo+json-seq": {
source: "iana"
},
"application/geopackage+sqlite3": {
source: "iana"
},
"application/geoxacml+xml": {
source: "iana",
compressible: true
},
"application/gltf-buffer": {
source: "iana"
},
"application/gml+xml": {
source: "iana",
compressible: true,
extensions: ["gml"]
},
"application/gpx+xml": {
source: "apache",
compressible: true,
extensions: ["gpx"]
},
"application/gxf": {
source: "apache",
extensions: ["gxf"]
},
"application/gzip": {
source: "iana",
compressible: false,
extensions: ["gz"]
},
"application/h224": {
source: "iana"
},
"application/held+xml": {
source: "iana",
compressible: true
},
"application/hjson": {
extensions: ["hjson"]
},
"application/http": {
source: "iana"
},
"application/hyperstudio": {
source: "iana",
extensions: ["stk"]
},
"application/ibe-key-request+xml": {
source: "iana",
compressible: true
},
"application/ibe-pkg-reply+xml": {
source: "iana",
compressible: true
},
"application/ibe-pp-data": {
source: "iana"
},
"application/iges": {
source: "iana"
},
"application/im-iscomposing+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/index": {
source: "iana"
},
"application/index.cmd": {
source: "iana"
},
"application/index.obj": {
source: "iana"
},
"application/index.response": {
source: "iana"
},
"application/index.vnd": {
source: "iana"
},
"application/inkml+xml": {
source: "iana",
compressible: true,
extensions: ["ink", "inkml"]
},
"application/iotp": {
source: "iana"
},
"application/ipfix": {
source: "iana",
extensions: ["ipfix"]
},
"application/ipp": {
source: "iana"
},
"application/isup": {
source: "iana"
},
"application/its+xml": {
source: "iana",
compressible: true,
extensions: ["its"]
},
"application/java-archive": {
source: "apache",
compressible: false,
extensions: ["jar", "war", "ear"]
},
"application/java-serialized-object": {
source: "apache",
compressible: false,
extensions: ["ser"]
},
"application/java-vm": {
source: "apache",
compressible: false,
extensions: ["class"]
},
"application/javascript": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["js", "mjs"]
},
"application/jf2feed+json": {
source: "iana",
compressible: true
},
"application/jose": {
source: "iana"
},
"application/jose+json": {
source: "iana",
compressible: true
},
"application/jrd+json": {
source: "iana",
compressible: true
},
"application/jscalendar+json": {
source: "iana",
compressible: true
},
"application/json": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["json", "map"]
},
"application/json-patch+json": {
source: "iana",
compressible: true
},
"application/json-seq": {
source: "iana"
},
"application/json5": {
extensions: ["json5"]
},
"application/jsonml+json": {
source: "apache",
compressible: true,
extensions: ["jsonml"]
},
"application/jwk+json": {
source: "iana",
compressible: true
},
"application/jwk-set+json": {
source: "iana",
compressible: true
},
"application/jwt": {
source: "iana"
},
"application/kpml-request+xml": {
source: "iana",
compressible: true
},
"application/kpml-response+xml": {
source: "iana",
compressible: true
},
"application/ld+json": {
source: "iana",
compressible: true,
extensions: ["jsonld"]
},
"application/lgr+xml": {
source: "iana",
compressible: true,
extensions: ["lgr"]
},
"application/link-format": {
source: "iana"
},
"application/load-control+xml": {
source: "iana",
compressible: true
},
"application/lost+xml": {
source: "iana",
compressible: true,
extensions: ["lostxml"]
},
"application/lostsync+xml": {
source: "iana",
compressible: true
},
"application/lpf+zip": {
source: "iana",
compressible: false
},
"application/lxf": {
source: "iana"
},
"application/mac-binhex40": {
source: "iana",
extensions: ["hqx"]
},
"application/mac-compactpro": {
source: "apache",
extensions: ["cpt"]
},
"application/macwriteii": {
source: "iana"
},
"application/mads+xml": {
source: "iana",
compressible: true,
extensions: ["mads"]
},
"application/manifest+json": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["webmanifest"]
},
"application/marc": {
source: "iana",
extensions: ["mrc"]
},
"application/marcxml+xml": {
source: "iana",
compressible: true,
extensions: ["mrcx"]
},
"application/mathematica": {
source: "iana",
extensions: ["ma", "nb", "mb"]
},
"application/mathml+xml": {
source: "iana",
compressible: true,
extensions: ["mathml"]
},
"application/mathml-content+xml": {
source: "iana",
compressible: true
},
"application/mathml-presentation+xml": {
source: "iana",
compressible: true
},
"application/mbms-associated-procedure-description+xml": {
source: "iana",
compressible: true
},
"application/mbms-deregister+xml": {
source: "iana",
compressible: true
},
"application/mbms-envelope+xml": {
source: "iana",
compressible: true
},
"application/mbms-msk+xml": {
source: "iana",
compressible: true
},
"application/mbms-msk-response+xml": {
source: "iana",
compressible: true
},
"application/mbms-protection-description+xml": {
source: "iana",
compressible: true
},
"application/mbms-reception-report+xml": {
source: "iana",
compressible: true
},
"application/mbms-register+xml": {
source: "iana",
compressible: true
},
"application/mbms-register-response+xml": {
source: "iana",
compressible: true
},
"application/mbms-schedule+xml": {
source: "iana",
compressible: true
},
"application/mbms-user-service-description+xml": {
source: "iana",
compressible: true
},
"application/mbox": {
source: "iana",
extensions: ["mbox"]
},
"application/media-policy-dataset+xml": {
source: "iana",
compressible: true,
extensions: ["mpf"]
},
"application/media_control+xml": {
source: "iana",
compressible: true
},
"application/mediaservercontrol+xml": {
source: "iana",
compressible: true,
extensions: ["mscml"]
},
"application/merge-patch+json": {
source: "iana",
compressible: true
},
"application/metalink+xml": {
source: "apache",
compressible: true,
extensions: ["metalink"]
},
"application/metalink4+xml": {
source: "iana",
compressible: true,
extensions: ["meta4"]
},
"application/mets+xml": {
source: "iana",
compressible: true,
extensions: ["mets"]
},
"application/mf4": {
source: "iana"
},
"application/mikey": {
source: "iana"
},
"application/mipc": {
source: "iana"
},
"application/missing-blocks+cbor-seq": {
source: "iana"
},
"application/mmt-aei+xml": {
source: "iana",
compressible: true,
extensions: ["maei"]
},
"application/mmt-usd+xml": {
source: "iana",
compressible: true,
extensions: ["musd"]
},
"application/mods+xml": {
source: "iana",
compressible: true,
extensions: ["mods"]
},
"application/moss-keys": {
source: "iana"
},
"application/moss-signature": {
source: "iana"
},
"application/mosskey-data": {
source: "iana"
},
"application/mosskey-request": {
source: "iana"
},
"application/mp21": {
source: "iana",
extensions: ["m21", "mp21"]
},
"application/mp4": {
source: "iana",
extensions: ["mp4s", "m4p"]
},
"application/mpeg4-generic": {
source: "iana"
},
"application/mpeg4-iod": {
source: "iana"
},
"application/mpeg4-iod-xmt": {
source: "iana"
},
"application/mrb-consumer+xml": {
source: "iana",
compressible: true
},
"application/mrb-publish+xml": {
source: "iana",
compressible: true
},
"application/msc-ivr+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/msc-mixer+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/msword": {
source: "iana",
compressible: false,
extensions: ["doc", "dot"]
},
"application/mud+json": {
source: "iana",
compressible: true
},
"application/multipart-core": {
source: "iana"
},
"application/mxf": {
source: "iana",
extensions: ["mxf"]
},
"application/n-quads": {
source: "iana",
extensions: ["nq"]
},
"application/n-triples": {
source: "iana",
extensions: ["nt"]
},
"application/nasdata": {
source: "iana"
},
"application/news-checkgroups": {
source: "iana",
charset: "US-ASCII"
},
"application/news-groupinfo": {
source: "iana",
charset: "US-ASCII"
},
"application/news-transmission": {
source: "iana"
},
"application/nlsml+xml": {
source: "iana",
compressible: true
},
"application/node": {
source: "iana",
extensions: ["cjs"]
},
"application/nss": {
source: "iana"
},
"application/oauth-authz-req+jwt": {
source: "iana"
},
"application/oblivious-dns-message": {
source: "iana"
},
"application/ocsp-request": {
source: "iana"
},
"application/ocsp-response": {
source: "iana"
},
"application/octet-stream": {
source: "iana",
compressible: false,
extensions: ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"]
},
"application/oda": {
source: "iana",
extensions: ["oda"]
},
"application/odm+xml": {
source: "iana",
compressible: true
},
"application/odx": {
source: "iana"
},
"application/oebps-package+xml": {
source: "iana",
compressible: true,
extensions: ["opf"]
},
"application/ogg": {
source: "iana",
compressible: false,
extensions: ["ogx"]
},
"application/omdoc+xml": {
source: "apache",
compressible: true,
extensions: ["omdoc"]
},
"application/onenote": {
source: "apache",
extensions: ["onetoc", "onetoc2", "onetmp", "onepkg"]
},
"application/opc-nodeset+xml": {
source: "iana",
compressible: true
},
"application/oscore": {
source: "iana"
},
"application/oxps": {
source: "iana",
extensions: ["oxps"]
},
"application/p21": {
source: "iana"
},
"application/p21+zip": {
source: "iana",
compressible: false
},
"application/p2p-overlay+xml": {
source: "iana",
compressible: true,
extensions: ["relo"]
},
"application/parityfec": {
source: "iana"
},
"application/passport": {
source: "iana"
},
"application/patch-ops-error+xml": {
source: "iana",
compressible: true,
extensions: ["xer"]
},
"application/pdf": {
source: "iana",
compressible: false,
extensions: ["pdf"]
},
"application/pdx": {
source: "iana"
},
"application/pem-certificate-chain": {
source: "iana"
},
"application/pgp-encrypted": {
source: "iana",
compressible: false,
extensions: ["pgp"]
},
"application/pgp-keys": {
source: "iana",
extensions: ["asc"]
},
"application/pgp-signature": {
source: "iana",
extensions: ["asc", "sig"]
},
"application/pics-rules": {
source: "apache",
extensions: ["prf"]
},
"application/pidf+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/pidf-diff+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/pkcs10": {
source: "iana",
extensions: ["p10"]
},
"application/pkcs12": {
source: "iana"
},
"application/pkcs7-mime": {
source: "iana",
extensions: ["p7m", "p7c"]
},
"application/pkcs7-signature": {
source: "iana",
extensions: ["p7s"]
},
"application/pkcs8": {
source: "iana",
extensions: ["p8"]
},
"application/pkcs8-encrypted": {
source: "iana"
},
"application/pkix-attr-cert": {
source: "iana",
extensions: ["ac"]
},
"application/pkix-cert": {
source: "iana",
extensions: ["cer"]
},
"application/pkix-crl": {
source: "iana",
extensions: ["crl"]
},
"application/pkix-pkipath": {
source: "iana",
extensions: ["pkipath"]
},
"application/pkixcmp": {
source: "iana",
extensions: ["pki"]
},
"application/pls+xml": {
source: "iana",
compressible: true,
extensions: ["pls"]
},
"application/poc-settings+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/postscript": {
source: "iana",
compressible: true,
extensions: ["ai", "eps", "ps"]
},
"application/ppsp-tracker+json": {
source: "iana",
compressible: true
},
"application/problem+json": {
source: "iana",
compressible: true
},
"application/problem+xml": {
source: "iana",
compressible: true
},
"application/provenance+xml": {
source: "iana",
compressible: true,
extensions: ["provx"]
},
"application/prs.alvestrand.titrax-sheet": {
source: "iana"
},
"application/prs.cww": {
source: "iana",
extensions: ["cww"]
},
"application/prs.cyn": {
source: "iana",
charset: "7-BIT"
},
"application/prs.hpub+zip": {
source: "iana",
compressible: false
},
"application/prs.nprend": {
source: "iana"
},
"application/prs.plucker": {
source: "iana"
},
"application/prs.rdf-xml-crypt": {
source: "iana"
},
"application/prs.xsf+xml": {
source: "iana",
compressible: true
},
"application/pskc+xml": {
source: "iana",
compressible: true,
extensions: ["pskcxml"]
},
"application/pvd+json": {
source: "iana",
compressible: true
},
"application/qsig": {
source: "iana"
},
"application/raml+yaml": {
compressible: true,
extensions: ["raml"]
},
"application/raptorfec": {
source: "iana"
},
"application/rdap+json": {
source: "iana",
compressible: true
},
"application/rdf+xml": {
source: "iana",
compressible: true,
extensions: ["rdf", "owl"]
},
"application/reginfo+xml": {
source: "iana",
compressible: true,
extensions: ["rif"]
},
"application/relax-ng-compact-syntax": {
source: "iana",
extensions: ["rnc"]
},
"application/remote-printing": {
source: "iana"
},
"application/reputon+json": {
source: "iana",
compressible: true
},
"application/resource-lists+xml": {
source: "iana",
compressible: true,
extensions: ["rl"]
},
"application/resource-lists-diff+xml": {
source: "iana",
compressible: true,
extensions: ["rld"]
},
"application/rfc+xml": {
source: "iana",
compressible: true
},
"application/riscos": {
source: "iana"
},
"application/rlmi+xml": {
source: "iana",
compressible: true
},
"application/rls-services+xml": {
source: "iana",
compressible: true,
extensions: ["rs"]
},
"application/route-apd+xml": {
source: "iana",
compressible: true,
extensions: ["rapd"]
},
"application/route-s-tsid+xml": {
source: "iana",
compressible: true,
extensions: ["sls"]
},
"application/route-usd+xml": {
source: "iana",
compressible: true,
extensions: ["rusd"]
},
"application/rpki-ghostbusters": {
source: "iana",
extensions: ["gbr"]
},
"application/rpki-manifest": {
source: "iana",
extensions: ["mft"]
},
"application/rpki-publication": {
source: "iana"
},
"application/rpki-roa": {
source: "iana",
extensions: ["roa"]
},
"application/rpki-updown": {
source: "iana"
},
"application/rsd+xml": {
source: "apache",
compressible: true,
extensions: ["rsd"]
},
"application/rss+xml": {
source: "apache",
compressible: true,
extensions: ["rss"]
},
"application/rtf": {
source: "iana",
compressible: true,
extensions: ["rtf"]
},
"application/rtploopback": {
source: "iana"
},
"application/rtx": {
source: "iana"
},
"application/samlassertion+xml": {
source: "iana",
compressible: true
},
"application/samlmetadata+xml": {
source: "iana",
compressible: true
},
"application/sarif+json": {
source: "iana",
compressible: true
},
"application/sarif-external-properties+json": {
source: "iana",
compressible: true
},
"application/sbe": {
source: "iana"
},
"application/sbml+xml": {
source: "iana",
compressible: true,
extensions: ["sbml"]
},
"application/scaip+xml": {
source: "iana",
compressible: true
},
"application/scim+json": {
source: "iana",
compressible: true
},
"application/scvp-cv-request": {
source: "iana",
extensions: ["scq"]
},
"application/scvp-cv-response": {
source: "iana",
extensions: ["scs"]
},
"application/scvp-vp-request": {
source: "iana",
extensions: ["spq"]
},
"application/scvp-vp-response": {
source: "iana",
extensions: ["spp"]
},
"application/sdp": {
source: "iana",
extensions: ["sdp"]
},
"application/secevent+jwt": {
source: "iana"
},
"application/senml+cbor": {
source: "iana"
},
"application/senml+json": {
source: "iana",
compressible: true
},
"application/senml+xml": {
source: "iana",
compressible: true,
extensions: ["senmlx"]
},
"application/senml-etch+cbor": {
source: "iana"
},
"application/senml-etch+json": {
source: "iana",
compressible: true
},
"application/senml-exi": {
source: "iana"
},
"application/sensml+cbor": {
source: "iana"
},
"application/sensml+json": {
source: "iana",
compressible: true
},
"application/sensml+xml": {
source: "iana",
compressible: true,
extensions: ["sensmlx"]
},
"application/sensml-exi": {
source: "iana"
},
"application/sep+xml": {
source: "iana",
compressible: true
},
"application/sep-exi": {
source: "iana"
},
"application/session-info": {
source: "iana"
},
"application/set-payment": {
source: "iana"
},
"application/set-payment-initiation": {
source: "iana",
extensions: ["setpay"]
},
"application/set-registration": {
source: "iana"
},
"application/set-registration-initiation": {
source: "iana",
extensions: ["setreg"]
},
"application/sgml": {
source: "iana"
},
"application/sgml-open-catalog": {
source: "iana"
},
"application/shf+xml": {
source: "iana",
compressible: true,
extensions: ["shf"]
},
"application/sieve": {
source: "iana",
extensions: ["siv", "sieve"]
},
"application/simple-filter+xml": {
source: "iana",
compressible: true
},
"application/simple-message-summary": {
source: "iana"
},
"application/simplesymbolcontainer": {
source: "iana"
},
"application/sipc": {
source: "iana"
},
"application/slate": {
source: "iana"
},
"application/smil": {
source: "iana"
},
"application/smil+xml": {
source: "iana",
compressible: true,
extensions: ["smi", "smil"]
},
"application/smpte336m": {
source: "iana"
},
"application/soap+fastinfoset": {
source: "iana"
},
"application/soap+xml": {
source: "iana",
compressible: true
},
"application/sparql-query": {
source: "iana",
extensions: ["rq"]
},
"application/sparql-results+xml": {
source: "iana",
compressible: true,
extensions: ["srx"]
},
"application/spdx+json": {
source: "iana",
compressible: true
},
"application/spirits-event+xml": {
source: "iana",
compressible: true
},
"application/sql": {
source: "iana"
},
"application/srgs": {
source: "iana",
extensions: ["gram"]
},
"application/srgs+xml": {
source: "iana",
compressible: true,
extensions: ["grxml"]
},
"application/sru+xml": {
source: "iana",
compressible: true,
extensions: ["sru"]
},
"application/ssdl+xml": {
source: "apache",
compressible: true,
extensions: ["ssdl"]
},
"application/ssml+xml": {
source: "iana",
compressible: true,
extensions: ["ssml"]
},
"application/stix+json": {
source: "iana",
compressible: true
},
"application/swid+xml": {
source: "iana",
compressible: true,
extensions: ["swidtag"]
},
"application/tamp-apex-update": {
source: "iana"
},
"application/tamp-apex-update-confirm": {
source: "iana"
},
"application/tamp-community-update": {
source: "iana"
},
"application/tamp-community-update-confirm": {
source: "iana"
},
"application/tamp-error": {
source: "iana"
},
"application/tamp-sequence-adjust": {
source: "iana"
},
"application/tamp-sequence-adjust-confirm": {
source: "iana"
},
"application/tamp-status-query": {
source: "iana"
},
"application/tamp-status-response": {
source: "iana"
},
"application/tamp-update": {
source: "iana"
},
"application/tamp-update-confirm": {
source: "iana"
},
"application/tar": {
compressible: true
},
"application/taxii+json": {
source: "iana",
compressible: true
},
"application/td+json": {
source: "iana",
compressible: true
},
"application/tei+xml": {
source: "iana",
compressible: true,
extensions: ["tei", "teicorpus"]
},
"application/tetra_isi": {
source: "iana"
},
"application/thraud+xml": {
source: "iana",
compressible: true,
extensions: ["tfi"]
},
"application/timestamp-query": {
source: "iana"
},
"application/timestamp-reply": {
source: "iana"
},
"application/timestamped-data": {
source: "iana",
extensions: ["tsd"]
},
"application/tlsrpt+gzip": {
source: "iana"
},
"application/tlsrpt+json": {
source: "iana",
compressible: true
},
"application/tnauthlist": {
source: "iana"
},
"application/token-introspection+jwt": {
source: "iana"
},
"application/toml": {
compressible: true,
extensions: ["toml"]
},
"application/trickle-ice-sdpfrag": {
source: "iana"
},
"application/trig": {
source: "iana",
extensions: ["trig"]
},
"application/ttml+xml": {
source: "iana",
compressible: true,
extensions: ["ttml"]
},
"application/tve-trigger": {
source: "iana"
},
"application/tzif": {
source: "iana"
},
"application/tzif-leap": {
source: "iana"
},
"application/ubjson": {
compressible: false,
extensions: ["ubj"]
},
"application/ulpfec": {
source: "iana"
},
"application/urc-grpsheet+xml": {
source: "iana",
compressible: true
},
"application/urc-ressheet+xml": {
source: "iana",
compressible: true,
extensions: ["rsheet"]
},
"application/urc-targetdesc+xml": {
source: "iana",
compressible: true,
extensions: ["td"]
},
"application/urc-uisocketdesc+xml": {
source: "iana",
compressible: true
},
"application/vcard+json": {
source: "iana",
compressible: true
},
"application/vcard+xml": {
source: "iana",
compressible: true
},
"application/vemmi": {
source: "iana"
},
"application/vividence.scriptfile": {
source: "apache"
},
"application/vnd.1000minds.decision-model+xml": {
source: "iana",
compressible: true,
extensions: ["1km"]
},
"application/vnd.3gpp-prose+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp-prose-pc3ch+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp-v2x-local-service-information": {
source: "iana"
},
"application/vnd.3gpp.5gnas": {
source: "iana"
},
"application/vnd.3gpp.access-transfer-events+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.bsf+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.gmop+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.gtpc": {
source: "iana"
},
"application/vnd.3gpp.interworking-data": {
source: "iana"
},
"application/vnd.3gpp.lpp": {
source: "iana"
},
"application/vnd.3gpp.mc-signalling-ear": {
source: "iana"
},
"application/vnd.3gpp.mcdata-affiliation-command+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcdata-info+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcdata-payload": {
source: "iana"
},
"application/vnd.3gpp.mcdata-service-config+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcdata-signalling": {
source: "iana"
},
"application/vnd.3gpp.mcdata-ue-config+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcdata-user-profile+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcptt-affiliation-command+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcptt-floor-request+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcptt-info+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcptt-location-info+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcptt-mbms-usage-info+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcptt-service-config+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcptt-signed+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcptt-ue-config+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcptt-ue-init-config+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcptt-user-profile+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcvideo-affiliation-command+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcvideo-affiliation-info+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcvideo-info+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcvideo-location-info+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcvideo-mbms-usage-info+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcvideo-service-config+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcvideo-transmission-request+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcvideo-ue-config+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mcvideo-user-profile+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.mid-call+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.ngap": {
source: "iana"
},
"application/vnd.3gpp.pfcp": {
source: "iana"
},
"application/vnd.3gpp.pic-bw-large": {
source: "iana",
extensions: ["plb"]
},
"application/vnd.3gpp.pic-bw-small": {
source: "iana",
extensions: ["psb"]
},
"application/vnd.3gpp.pic-bw-var": {
source: "iana",
extensions: ["pvb"]
},
"application/vnd.3gpp.s1ap": {
source: "iana"
},
"application/vnd.3gpp.sms": {
source: "iana"
},
"application/vnd.3gpp.sms+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.srvcc-ext+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.srvcc-info+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.state-and-event-info+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp.ussd+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp2.bcmcsinfo+xml": {
source: "iana",
compressible: true
},
"application/vnd.3gpp2.sms": {
source: "iana"
},
"application/vnd.3gpp2.tcap": {
source: "iana",
extensions: ["tcap"]
},
"application/vnd.3lightssoftware.imagescal": {
source: "iana"
},
"application/vnd.3m.post-it-notes": {
source: "iana",
extensions: ["pwn"]
},
"application/vnd.accpac.simply.aso": {
source: "iana",
extensions: ["aso"]
},
"application/vnd.accpac.simply.imp": {
source: "iana",
extensions: ["imp"]
},
"application/vnd.acucobol": {
source: "iana",
extensions: ["acu"]
},
"application/vnd.acucorp": {
source: "iana",
extensions: ["atc", "acutc"]
},
"application/vnd.adobe.air-application-installer-package+zip": {
source: "apache",
compressible: false,
extensions: ["air"]
},
"application/vnd.adobe.flash.movie": {
source: "iana"
},
"application/vnd.adobe.formscentral.fcdt": {
source: "iana",
extensions: ["fcdt"]
},
"application/vnd.adobe.fxp": {
source: "iana",
extensions: ["fxp", "fxpl"]
},
"application/vnd.adobe.partial-upload": {
source: "iana"
},
"application/vnd.adobe.xdp+xml": {
source: "iana",
compressible: true,
extensions: ["xdp"]
},
"application/vnd.adobe.xfdf": {
source: "iana",
extensions: ["xfdf"]
},
"application/vnd.aether.imp": {
source: "iana"
},
"application/vnd.afpc.afplinedata": {
source: "iana"
},
"application/vnd.afpc.afplinedata-pagedef": {
source: "iana"
},
"application/vnd.afpc.cmoca-cmresource": {
source: "iana"
},
"application/vnd.afpc.foca-charset": {
source: "iana"
},
"application/vnd.afpc.foca-codedfont": {
source: "iana"
},
"application/vnd.afpc.foca-codepage": {
source: "iana"
},
"application/vnd.afpc.modca": {
source: "iana"
},
"application/vnd.afpc.modca-cmtable": {
source: "iana"
},
"application/vnd.afpc.modca-formdef": {
source: "iana"
},
"application/vnd.afpc.modca-mediummap": {
source: "iana"
},
"application/vnd.afpc.modca-objectcontainer": {
source: "iana"
},
"application/vnd.afpc.modca-overlay": {
source: "iana"
},
"application/vnd.afpc.modca-pagesegment": {
source: "iana"
},
"application/vnd.age": {
source: "iana",
extensions: ["age"]
},
"application/vnd.ah-barcode": {
source: "iana"
},
"application/vnd.ahead.space": {
source: "iana",
extensions: ["ahead"]
},
"application/vnd.airzip.filesecure.azf": {
source: "iana",
extensions: ["azf"]
},
"application/vnd.airzip.filesecure.azs": {
source: "iana",
extensions: ["azs"]
},
"application/vnd.amadeus+json": {
source: "iana",
compressible: true
},
"application/vnd.amazon.ebook": {
source: "apache",
extensions: ["azw"]
},
"application/vnd.amazon.mobi8-ebook": {
source: "iana"
},
"application/vnd.americandynamics.acc": {
source: "iana",
extensions: ["acc"]
},
"application/vnd.amiga.ami": {
source: "iana",
extensions: ["ami"]
},
"application/vnd.amundsen.maze+xml": {
source: "iana",
compressible: true
},
"application/vnd.android.ota": {
source: "iana"
},
"application/vnd.android.package-archive": {
source: "apache",
compressible: false,
extensions: ["apk"]
},
"application/vnd.anki": {
source: "iana"
},
"application/vnd.anser-web-certificate-issue-initiation": {
source: "iana",
extensions: ["cii"]
},
"application/vnd.anser-web-funds-transfer-initiation": {
source: "apache",
extensions: ["fti"]
},
"application/vnd.antix.game-component": {
source: "iana",
extensions: ["atx"]
},
"application/vnd.apache.arrow.file": {
source: "iana"
},
"application/vnd.apache.arrow.stream": {
source: "iana"
},
"application/vnd.apache.thrift.binary": {
source: "iana"
},
"application/vnd.apache.thrift.compact": {
source: "iana"
},
"application/vnd.apache.thrift.json": {
source: "iana"
},
"application/vnd.api+json": {
source: "iana",
compressible: true
},
"application/vnd.aplextor.warrp+json": {
source: "iana",
compressible: true
},
"application/vnd.apothekende.reservation+json": {
source: "iana",
compressible: true
},
"application/vnd.apple.installer+xml": {
source: "iana",
compressible: true,
extensions: ["mpkg"]
},
"application/vnd.apple.keynote": {
source: "iana",
extensions: ["key"]
},
"application/vnd.apple.mpegurl": {
source: "iana",
extensions: ["m3u8"]
},
"application/vnd.apple.numbers": {
source: "iana",
extensions: ["numbers"]
},
"application/vnd.apple.pages": {
source: "iana",
extensions: ["pages"]
},
"application/vnd.apple.pkpass": {
compressible: false,
extensions: ["pkpass"]
},
"application/vnd.arastra.swi": {
source: "iana"
},
"application/vnd.aristanetworks.swi": {
source: "iana",
extensions: ["swi"]
},
"application/vnd.artisan+json": {
source: "iana",
compressible: true
},
"application/vnd.artsquare": {
source: "iana"
},
"application/vnd.astraea-software.iota": {
source: "iana",
extensions: ["iota"]
},
"application/vnd.audiograph": {
source: "iana",
extensions: ["aep"]
},
"application/vnd.autopackage": {
source: "iana"
},
"application/vnd.avalon+json": {
source: "iana",
compressible: true
},
"application/vnd.avistar+xml": {
source: "iana",
compressible: true
},
"application/vnd.balsamiq.bmml+xml": {
source: "iana",
compressible: true,
extensions: ["bmml"]
},
"application/vnd.balsamiq.bmpr": {
source: "iana"
},
"application/vnd.banana-accounting": {
source: "iana"
},
"application/vnd.bbf.usp.error": {
source: "iana"
},
"application/vnd.bbf.usp.msg": {
source: "iana"
},
"application/vnd.bbf.usp.msg+json": {
source: "iana",
compressible: true
},
"application/vnd.bekitzur-stech+json": {
source: "iana",
compressible: true
},
"application/vnd.bint.med-content": {
source: "iana"
},
"application/vnd.biopax.rdf+xml": {
source: "iana",
compressible: true
},
"application/vnd.blink-idb-value-wrapper": {
source: "iana"
},
"application/vnd.blueice.multipass": {
source: "iana",
extensions: ["mpm"]
},
"application/vnd.bluetooth.ep.oob": {
source: "iana"
},
"application/vnd.bluetooth.le.oob": {
source: "iana"
},
"application/vnd.bmi": {
source: "iana",
extensions: ["bmi"]
},
"application/vnd.bpf": {
source: "iana"
},
"application/vnd.bpf3": {
source: "iana"
},
"application/vnd.businessobjects": {
source: "iana",
extensions: ["rep"]
},
"application/vnd.byu.uapi+json": {
source: "iana",
compressible: true
},
"application/vnd.cab-jscript": {
source: "iana"
},
"application/vnd.canon-cpdl": {
source: "iana"
},
"application/vnd.canon-lips": {
source: "iana"
},
"application/vnd.capasystems-pg+json": {
source: "iana",
compressible: true
},
"application/vnd.cendio.thinlinc.clientconf": {
source: "iana"
},
"application/vnd.century-systems.tcp_stream": {
source: "iana"
},
"application/vnd.chemdraw+xml": {
source: "iana",
compressible: true,
extensions: ["cdxml"]
},
"application/vnd.chess-pgn": {
source: "iana"
},
"application/vnd.chipnuts.karaoke-mmd": {
source: "iana",
extensions: ["mmd"]
},
"application/vnd.ciedi": {
source: "iana"
},
"application/vnd.cinderella": {
source: "iana",
extensions: ["cdy"]
},
"application/vnd.cirpack.isdn-ext": {
source: "iana"
},
"application/vnd.citationstyles.style+xml": {
source: "iana",
compressible: true,
extensions: ["csl"]
},
"application/vnd.claymore": {
source: "iana",
extensions: ["cla"]
},
"application/vnd.cloanto.rp9": {
source: "iana",
extensions: ["rp9"]
},
"application/vnd.clonk.c4group": {
source: "iana",
extensions: ["c4g", "c4d", "c4f", "c4p", "c4u"]
},
"application/vnd.cluetrust.cartomobile-config": {
source: "iana",
extensions: ["c11amc"]
},
"application/vnd.cluetrust.cartomobile-config-pkg": {
source: "iana",
extensions: ["c11amz"]
},
"application/vnd.coffeescript": {
source: "iana"
},
"application/vnd.collabio.xodocuments.document": {
source: "iana"
},
"application/vnd.collabio.xodocuments.document-template": {
source: "iana"
},
"application/vnd.collabio.xodocuments.presentation": {
source: "iana"
},
"application/vnd.collabio.xodocuments.presentation-template": {
source: "iana"
},
"application/vnd.collabio.xodocuments.spreadsheet": {
source: "iana"
},
"application/vnd.collabio.xodocuments.spreadsheet-template": {
source: "iana"
},
"application/vnd.collection+json": {
source: "iana",
compressible: true
},
"application/vnd.collection.doc+json": {
source: "iana",
compressible: true
},
"application/vnd.collection.next+json": {
source: "iana",
compressible: true
},
"application/vnd.comicbook+zip": {
source: "iana",
compressible: false
},
"application/vnd.comicbook-rar": {
source: "iana"
},
"application/vnd.commerce-battelle": {
source: "iana"
},
"application/vnd.commonspace": {
source: "iana",
extensions: ["csp"]
},
"application/vnd.contact.cmsg": {
source: "iana",
extensions: ["cdbcmsg"]
},
"application/vnd.coreos.ignition+json": {
source: "iana",
compressible: true
},
"application/vnd.cosmocaller": {
source: "iana",
extensions: ["cmc"]
},
"application/vnd.crick.clicker": {
source: "iana",
extensions: ["clkx"]
},
"application/vnd.crick.clicker.keyboard": {
source: "iana",
extensions: ["clkk"]
},
"application/vnd.crick.clicker.palette": {
source: "iana",
extensions: ["clkp"]
},
"application/vnd.crick.clicker.template": {
source: "iana",
extensions: ["clkt"]
},
"application/vnd.crick.clicker.wordbank": {
source: "iana",
extensions: ["clkw"]
},
"application/vnd.criticaltools.wbs+xml": {
source: "iana",
compressible: true,
extensions: ["wbs"]
},
"application/vnd.cryptii.pipe+json": {
source: "iana",
compressible: true
},
"application/vnd.crypto-shade-file": {
source: "iana"
},
"application/vnd.cryptomator.encrypted": {
source: "iana"
},
"application/vnd.cryptomator.vault": {
source: "iana"
},
"application/vnd.ctc-posml": {
source: "iana",
extensions: ["pml"]
},
"application/vnd.ctct.ws+xml": {
source: "iana",
compressible: true
},
"application/vnd.cups-pdf": {
source: "iana"
},
"application/vnd.cups-postscript": {
source: "iana"
},
"application/vnd.cups-ppd": {
source: "iana",
extensions: ["ppd"]
},
"application/vnd.cups-raster": {
source: "iana"
},
"application/vnd.cups-raw": {
source: "iana"
},
"application/vnd.curl": {
source: "iana"
},
"application/vnd.curl.car": {
source: "apache",
extensions: ["car"]
},
"application/vnd.curl.pcurl": {
source: "apache",
extensions: ["pcurl"]
},
"application/vnd.cyan.dean.root+xml": {
source: "iana",
compressible: true
},
"application/vnd.cybank": {
source: "iana"
},
"application/vnd.cyclonedx+json": {
source: "iana",
compressible: true
},
"application/vnd.cyclonedx+xml": {
source: "iana",
compressible: true
},
"application/vnd.d2l.coursepackage1p0+zip": {
source: "iana",
compressible: false
},
"application/vnd.d3m-dataset": {
source: "iana"
},
"application/vnd.d3m-problem": {
source: "iana"
},
"application/vnd.dart": {
source: "iana",
compressible: true,
extensions: ["dart"]
},
"application/vnd.data-vision.rdz": {
source: "iana",
extensions: ["rdz"]
},
"application/vnd.datapackage+json": {
source: "iana",
compressible: true
},
"application/vnd.dataresource+json": {
source: "iana",
compressible: true
},
"application/vnd.dbf": {
source: "iana",
extensions: ["dbf"]
},
"application/vnd.debian.binary-package": {
source: "iana"
},
"application/vnd.dece.data": {
source: "iana",
extensions: ["uvf", "uvvf", "uvd", "uvvd"]
},
"application/vnd.dece.ttml+xml": {
source: "iana",
compressible: true,
extensions: ["uvt", "uvvt"]
},
"application/vnd.dece.unspecified": {
source: "iana",
extensions: ["uvx", "uvvx"]
},
"application/vnd.dece.zip": {
source: "iana",
extensions: ["uvz", "uvvz"]
},
"application/vnd.denovo.fcselayout-link": {
source: "iana",
extensions: ["fe_launch"]
},
"application/vnd.desmume.movie": {
source: "iana"
},
"application/vnd.dir-bi.plate-dl-nosuffix": {
source: "iana"
},
"application/vnd.dm.delegation+xml": {
source: "iana",
compressible: true
},
"application/vnd.dna": {
source: "iana",
extensions: ["dna"]
},
"application/vnd.document+json": {
source: "iana",
compressible: true
},
"application/vnd.dolby.mlp": {
source: "apache",
extensions: ["mlp"]
},
"application/vnd.dolby.mobile.1": {
source: "iana"
},
"application/vnd.dolby.mobile.2": {
source: "iana"
},
"application/vnd.doremir.scorecloud-binary-document": {
source: "iana"
},
"application/vnd.dpgraph": {
source: "iana",
extensions: ["dpg"]
},
"application/vnd.dreamfactory": {
source: "iana",
extensions: ["dfac"]
},
"application/vnd.drive+json": {
source: "iana",
compressible: true
},
"application/vnd.ds-keypoint": {
source: "apache",
extensions: ["kpxx"]
},
"application/vnd.dtg.local": {
source: "iana"
},
"application/vnd.dtg.local.flash": {
source: "iana"
},
"application/vnd.dtg.local.html": {
source: "iana"
},
"application/vnd.dvb.ait": {
source: "iana",
extensions: ["ait"]
},
"application/vnd.dvb.dvbisl+xml": {
source: "iana",
compressible: true
},
"application/vnd.dvb.dvbj": {
source: "iana"
},
"application/vnd.dvb.esgcontainer": {
source: "iana"
},
"application/vnd.dvb.ipdcdftnotifaccess": {
source: "iana"
},
"application/vnd.dvb.ipdcesgaccess": {
source: "iana"
},
"application/vnd.dvb.ipdcesgaccess2": {
source: "iana"
},
"application/vnd.dvb.ipdcesgpdd": {
source: "iana"
},
"application/vnd.dvb.ipdcroaming": {
source: "iana"
},
"application/vnd.dvb.iptv.alfec-base": {
source: "iana"
},
"application/vnd.dvb.iptv.alfec-enhancement": {
source: "iana"
},
"application/vnd.dvb.notif-aggregate-root+xml": {
source: "iana",
compressible: true
},
"application/vnd.dvb.notif-container+xml": {
source: "iana",
compressible: true
},
"application/vnd.dvb.notif-generic+xml": {
source: "iana",
compressible: true
},
"application/vnd.dvb.notif-ia-msglist+xml": {
source: "iana",
compressible: true
},
"application/vnd.dvb.notif-ia-registration-request+xml": {
source: "iana",
compressible: true
},
"application/vnd.dvb.notif-ia-registration-response+xml": {
source: "iana",
compressible: true
},
"application/vnd.dvb.notif-init+xml": {
source: "iana",
compressible: true
},
"application/vnd.dvb.pfr": {
source: "iana"
},
"application/vnd.dvb.service": {
source: "iana",
extensions: ["svc"]
},
"application/vnd.dxr": {
source: "iana"
},
"application/vnd.dynageo": {
source: "iana",
extensions: ["geo"]
},
"application/vnd.dzr": {
source: "iana"
},
"application/vnd.easykaraoke.cdgdownload": {
source: "iana"
},
"application/vnd.ecdis-update": {
source: "iana"
},
"application/vnd.ecip.rlp": {
source: "iana"
},
"application/vnd.eclipse.ditto+json": {
source: "iana",
compressible: true
},
"application/vnd.ecowin.chart": {
source: "iana",
extensions: ["mag"]
},
"application/vnd.ecowin.filerequest": {
source: "iana"
},
"application/vnd.ecowin.fileupdate": {
source: "iana"
},
"application/vnd.ecowin.series": {
source: "iana"
},
"application/vnd.ecowin.seriesrequest": {
source: "iana"
},
"application/vnd.ecowin.seriesupdate": {
source: "iana"
},
"application/vnd.efi.img": {
source: "iana"
},
"application/vnd.efi.iso": {
source: "iana"
},
"application/vnd.emclient.accessrequest+xml": {
source: "iana",
compressible: true
},
"application/vnd.enliven": {
source: "iana",
extensions: ["nml"]
},
"application/vnd.enphase.envoy": {
source: "iana"
},
"application/vnd.eprints.data+xml": {
source: "iana",
compressible: true
},
"application/vnd.epson.esf": {
source: "iana",
extensions: ["esf"]
},
"application/vnd.epson.msf": {
source: "iana",
extensions: ["msf"]
},
"application/vnd.epson.quickanime": {
source: "iana",
extensions: ["qam"]
},
"application/vnd.epson.salt": {
source: "iana",
extensions: ["slt"]
},
"application/vnd.epson.ssf": {
source: "iana",
extensions: ["ssf"]
},
"application/vnd.ericsson.quickcall": {
source: "iana"
},
"application/vnd.espass-espass+zip": {
source: "iana",
compressible: false
},
"application/vnd.eszigno3+xml": {
source: "iana",
compressible: true,
extensions: ["es3", "et3"]
},
"application/vnd.etsi.aoc+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.asic-e+zip": {
source: "iana",
compressible: false
},
"application/vnd.etsi.asic-s+zip": {
source: "iana",
compressible: false
},
"application/vnd.etsi.cug+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.iptvcommand+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.iptvdiscovery+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.iptvprofile+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.iptvsad-bc+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.iptvsad-cod+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.iptvsad-npvr+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.iptvservice+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.iptvsync+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.iptvueprofile+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.mcid+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.mheg5": {
source: "iana"
},
"application/vnd.etsi.overload-control-policy-dataset+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.pstn+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.sci+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.simservs+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.timestamp-token": {
source: "iana"
},
"application/vnd.etsi.tsl+xml": {
source: "iana",
compressible: true
},
"application/vnd.etsi.tsl.der": {
source: "iana"
},
"application/vnd.eu.kasparian.car+json": {
source: "iana",
compressible: true
},
"application/vnd.eudora.data": {
source: "iana"
},
"application/vnd.evolv.ecig.profile": {
source: "iana"
},
"application/vnd.evolv.ecig.settings": {
source: "iana"
},
"application/vnd.evolv.ecig.theme": {
source: "iana"
},
"application/vnd.exstream-empower+zip": {
source: "iana",
compressible: false
},
"application/vnd.exstream-package": {
source: "iana"
},
"application/vnd.ezpix-album": {
source: "iana",
extensions: ["ez2"]
},
"application/vnd.ezpix-package": {
source: "iana",
extensions: ["ez3"]
},
"application/vnd.f-secure.mobile": {
source: "iana"
},
"application/vnd.familysearch.gedcom+zip": {
source: "iana",
compressible: false
},
"application/vnd.fastcopy-disk-image": {
source: "iana"
},
"application/vnd.fdf": {
source: "iana",
extensions: ["fdf"]
},
"application/vnd.fdsn.mseed": {
source: "iana",
extensions: ["mseed"]
},
"application/vnd.fdsn.seed": {
source: "iana",
extensions: ["seed", "dataless"]
},
"application/vnd.ffsns": {
source: "iana"
},
"application/vnd.ficlab.flb+zip": {
source: "iana",
compressible: false
},
"application/vnd.filmit.zfc": {
source: "iana"
},
"application/vnd.fints": {
source: "iana"
},
"application/vnd.firemonkeys.cloudcell": {
source: "iana"
},
"application/vnd.flographit": {
source: "iana",
extensions: ["gph"]
},
"application/vnd.fluxtime.clip": {
source: "iana",
extensions: ["ftc"]
},
"application/vnd.font-fontforge-sfd": {
source: "iana"
},
"application/vnd.framemaker": {
source: "iana",
extensions: ["fm", "frame", "maker", "book"]
},
"application/vnd.frogans.fnc": {
source: "iana",
extensions: ["fnc"]
},
"application/vnd.frogans.ltf": {
source: "iana",
extensions: ["ltf"]
},
"application/vnd.fsc.weblaunch": {
source: "iana",
extensions: ["fsc"]
},
"application/vnd.fujifilm.fb.docuworks": {
source: "iana"
},
"application/vnd.fujifilm.fb.docuworks.binder": {
source: "iana"
},
"application/vnd.fujifilm.fb.docuworks.container": {
source: "iana"
},
"application/vnd.fujifilm.fb.jfi+xml": {
source: "iana",
compressible: true
},
"application/vnd.fujitsu.oasys": {
source: "iana",
extensions: ["oas"]
},
"application/vnd.fujitsu.oasys2": {
source: "iana",
extensions: ["oa2"]
},
"application/vnd.fujitsu.oasys3": {
source: "iana",
extensions: ["oa3"]
},
"application/vnd.fujitsu.oasysgp": {
source: "iana",
extensions: ["fg5"]
},
"application/vnd.fujitsu.oasysprs": {
source: "iana",
extensions: ["bh2"]
},
"application/vnd.fujixerox.art-ex": {
source: "iana"
},
"application/vnd.fujixerox.art4": {
source: "iana"
},
"application/vnd.fujixerox.ddd": {
source: "iana",
extensions: ["ddd"]
},
"application/vnd.fujixerox.docuworks": {
source: "iana",
extensions: ["xdw"]
},
"application/vnd.fujixerox.docuworks.binder": {
source: "iana",
extensions: ["xbd"]
},
"application/vnd.fujixerox.docuworks.container": {
source: "iana"
},
"application/vnd.fujixerox.hbpl": {
source: "iana"
},
"application/vnd.fut-misnet": {
source: "iana"
},
"application/vnd.futoin+cbor": {
source: "iana"
},
"application/vnd.futoin+json": {
source: "iana",
compressible: true
},
"application/vnd.fuzzysheet": {
source: "iana",
extensions: ["fzs"]
},
"application/vnd.genomatix.tuxedo": {
source: "iana",
extensions: ["txd"]
},
"application/vnd.gentics.grd+json": {
source: "iana",
compressible: true
},
"application/vnd.geo+json": {
source: "iana",
compressible: true
},
"application/vnd.geocube+xml": {
source: "iana",
compressible: true
},
"application/vnd.geogebra.file": {
source: "iana",
extensions: ["ggb"]
},
"application/vnd.geogebra.slides": {
source: "iana"
},
"application/vnd.geogebra.tool": {
source: "iana",
extensions: ["ggt"]
},
"application/vnd.geometry-explorer": {
source: "iana",
extensions: ["gex", "gre"]
},
"application/vnd.geonext": {
source: "iana",
extensions: ["gxt"]
},
"application/vnd.geoplan": {
source: "iana",
extensions: ["g2w"]
},
"application/vnd.geospace": {
source: "iana",
extensions: ["g3w"]
},
"application/vnd.gerber": {
source: "iana"
},
"application/vnd.globalplatform.card-content-mgt": {
source: "iana"
},
"application/vnd.globalplatform.card-content-mgt-response": {
source: "iana"
},
"application/vnd.gmx": {
source: "iana",
extensions: ["gmx"]
},
"application/vnd.google-apps.document": {
compressible: false,
extensions: ["gdoc"]
},
"application/vnd.google-apps.presentation": {
compressible: false,
extensions: ["gslides"]
},
"application/vnd.google-apps.spreadsheet": {
compressible: false,
extensions: ["gsheet"]
},
"application/vnd.google-earth.kml+xml": {
source: "iana",
compressible: true,
extensions: ["kml"]
},
"application/vnd.google-earth.kmz": {
source: "iana",
compressible: false,
extensions: ["kmz"]
},
"application/vnd.gov.sk.e-form+xml": {
source: "iana",
compressible: true
},
"application/vnd.gov.sk.e-form+zip": {
source: "iana",
compressible: false
},
"application/vnd.gov.sk.xmldatacontainer+xml": {
source: "iana",
compressible: true
},
"application/vnd.grafeq": {
source: "iana",
extensions: ["gqf", "gqs"]
},
"application/vnd.gridmp": {
source: "iana"
},
"application/vnd.groove-account": {
source: "iana",
extensions: ["gac"]
},
"application/vnd.groove-help": {
source: "iana",
extensions: ["ghf"]
},
"application/vnd.groove-identity-message": {
source: "iana",
extensions: ["gim"]
},
"application/vnd.groove-injector": {
source: "iana",
extensions: ["grv"]
},
"application/vnd.groove-tool-message": {
source: "iana",
extensions: ["gtm"]
},
"application/vnd.groove-tool-template": {
source: "iana",
extensions: ["tpl"]
},
"application/vnd.groove-vcard": {
source: "iana",
extensions: ["vcg"]
},
"application/vnd.hal+json": {
source: "iana",
compressible: true
},
"application/vnd.hal+xml": {
source: "iana",
compressible: true,
extensions: ["hal"]
},
"application/vnd.handheld-entertainment+xml": {
source: "iana",
compressible: true,
extensions: ["zmm"]
},
"application/vnd.hbci": {
source: "iana",
extensions: ["hbci"]
},
"application/vnd.hc+json": {
source: "iana",
compressible: true
},
"application/vnd.hcl-bireports": {
source: "iana"
},
"application/vnd.hdt": {
source: "iana"
},
"application/vnd.heroku+json": {
source: "iana",
compressible: true
},
"application/vnd.hhe.lesson-player": {
source: "iana",
extensions: ["les"]
},
"application/vnd.hl7cda+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/vnd.hl7v2+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/vnd.hp-hpgl": {
source: "iana",
extensions: ["hpgl"]
},
"application/vnd.hp-hpid": {
source: "iana",
extensions: ["hpid"]
},
"application/vnd.hp-hps": {
source: "iana",
extensions: ["hps"]
},
"application/vnd.hp-jlyt": {
source: "iana",
extensions: ["jlt"]
},
"application/vnd.hp-pcl": {
source: "iana",
extensions: ["pcl"]
},
"application/vnd.hp-pclxl": {
source: "iana",
extensions: ["pclxl"]
},
"application/vnd.httphone": {
source: "iana"
},
"application/vnd.hydrostatix.sof-data": {
source: "iana",
extensions: ["sfd-hdstx"]
},
"application/vnd.hyper+json": {
source: "iana",
compressible: true
},
"application/vnd.hyper-item+json": {
source: "iana",
compressible: true
},
"application/vnd.hyperdrive+json": {
source: "iana",
compressible: true
},
"application/vnd.hzn-3d-crossword": {
source: "iana"
},
"application/vnd.ibm.afplinedata": {
source: "iana"
},
"application/vnd.ibm.electronic-media": {
source: "iana"
},
"application/vnd.ibm.minipay": {
source: "iana",
extensions: ["mpy"]
},
"application/vnd.ibm.modcap": {
source: "iana",
extensions: ["afp", "listafp", "list3820"]
},
"application/vnd.ibm.rights-management": {
source: "iana",
extensions: ["irm"]
},
"application/vnd.ibm.secure-container": {
source: "iana",
extensions: ["sc"]
},
"application/vnd.iccprofile": {
source: "iana",
extensions: ["icc", "icm"]
},
"application/vnd.ieee.1905": {
source: "iana"
},
"application/vnd.igloader": {
source: "iana",
extensions: ["igl"]
},
"application/vnd.imagemeter.folder+zip": {
source: "iana",
compressible: false
},
"application/vnd.imagemeter.image+zip": {
source: "iana",
compressible: false
},
"application/vnd.immervision-ivp": {
source: "iana",
extensions: ["ivp"]
},
"application/vnd.immervision-ivu": {
source: "iana",
extensions: ["ivu"]
},
"application/vnd.ims.imsccv1p1": {
source: "iana"
},
"application/vnd.ims.imsccv1p2": {
source: "iana"
},
"application/vnd.ims.imsccv1p3": {
source: "iana"
},
"application/vnd.ims.lis.v2.result+json": {
source: "iana",
compressible: true
},
"application/vnd.ims.lti.v2.toolconsumerprofile+json": {
source: "iana",
compressible: true
},
"application/vnd.ims.lti.v2.toolproxy+json": {
source: "iana",
compressible: true
},
"application/vnd.ims.lti.v2.toolproxy.id+json": {
source: "iana",
compressible: true
},
"application/vnd.ims.lti.v2.toolsettings+json": {
source: "iana",
compressible: true
},
"application/vnd.ims.lti.v2.toolsettings.simple+json": {
source: "iana",
compressible: true
},
"application/vnd.informedcontrol.rms+xml": {
source: "iana",
compressible: true
},
"application/vnd.informix-visionary": {
source: "iana"
},
"application/vnd.infotech.project": {
source: "iana"
},
"application/vnd.infotech.project+xml": {
source: "iana",
compressible: true
},
"application/vnd.innopath.wamp.notification": {
source: "iana"
},
"application/vnd.insors.igm": {
source: "iana",
extensions: ["igm"]
},
"application/vnd.intercon.formnet": {
source: "iana",
extensions: ["xpw", "xpx"]
},
"application/vnd.intergeo": {
source: "iana",
extensions: ["i2g"]
},
"application/vnd.intertrust.digibox": {
source: "iana"
},
"application/vnd.intertrust.nncp": {
source: "iana"
},
"application/vnd.intu.qbo": {
source: "iana",
extensions: ["qbo"]
},
"application/vnd.intu.qfx": {
source: "iana",
extensions: ["qfx"]
},
"application/vnd.iptc.g2.catalogitem+xml": {
source: "iana",
compressible: true
},
"application/vnd.iptc.g2.conceptitem+xml": {
source: "iana",
compressible: true
},
"application/vnd.iptc.g2.knowledgeitem+xml": {
source: "iana",
compressible: true
},
"application/vnd.iptc.g2.newsitem+xml": {
source: "iana",
compressible: true
},
"application/vnd.iptc.g2.newsmessage+xml": {
source: "iana",
compressible: true
},
"application/vnd.iptc.g2.packageitem+xml": {
source: "iana",
compressible: true
},
"application/vnd.iptc.g2.planningitem+xml": {
source: "iana",
compressible: true
},
"application/vnd.ipunplugged.rcprofile": {
source: "iana",
extensions: ["rcprofile"]
},
"application/vnd.irepository.package+xml": {
source: "iana",
compressible: true,
extensions: ["irp"]
},
"application/vnd.is-xpr": {
source: "iana",
extensions: ["xpr"]
},
"application/vnd.isac.fcs": {
source: "iana",
extensions: ["fcs"]
},
"application/vnd.iso11783-10+zip": {
source: "iana",
compressible: false
},
"application/vnd.jam": {
source: "iana",
extensions: ["jam"]
},
"application/vnd.japannet-directory-service": {
source: "iana"
},
"application/vnd.japannet-jpnstore-wakeup": {
source: "iana"
},
"application/vnd.japannet-payment-wakeup": {
source: "iana"
},
"application/vnd.japannet-registration": {
source: "iana"
},
"application/vnd.japannet-registration-wakeup": {
source: "iana"
},
"application/vnd.japannet-setstore-wakeup": {
source: "iana"
},
"application/vnd.japannet-verification": {
source: "iana"
},
"application/vnd.japannet-verification-wakeup": {
source: "iana"
},
"application/vnd.jcp.javame.midlet-rms": {
source: "iana",
extensions: ["rms"]
},
"application/vnd.jisp": {
source: "iana",
extensions: ["jisp"]
},
"application/vnd.joost.joda-archive": {
source: "iana",
extensions: ["joda"]
},
"application/vnd.jsk.isdn-ngn": {
source: "iana"
},
"application/vnd.kahootz": {
source: "iana",
extensions: ["ktz", "ktr"]
},
"application/vnd.kde.karbon": {
source: "iana",
extensions: ["karbon"]
},
"application/vnd.kde.kchart": {
source: "iana",
extensions: ["chrt"]
},
"application/vnd.kde.kformula": {
source: "iana",
extensions: ["kfo"]
},
"application/vnd.kde.kivio": {
source: "iana",
extensions: ["flw"]
},
"application/vnd.kde.kontour": {
source: "iana",
extensions: ["kon"]
},
"application/vnd.kde.kpresenter": {
source: "iana",
extensions: ["kpr", "kpt"]
},
"application/vnd.kde.kspread": {
source: "iana",
extensions: ["ksp"]
},
"application/vnd.kde.kword": {
source: "iana",
extensions: ["kwd", "kwt"]
},
"application/vnd.kenameaapp": {
source: "iana",
extensions: ["htke"]
},
"application/vnd.kidspiration": {
source: "iana",
extensions: ["kia"]
},
"application/vnd.kinar": {
source: "iana",
extensions: ["kne", "knp"]
},
"application/vnd.koan": {
source: "iana",
extensions: ["skp", "skd", "skt", "skm"]
},
"application/vnd.kodak-descriptor": {
source: "iana",
extensions: ["sse"]
},
"application/vnd.las": {
source: "iana"
},
"application/vnd.las.las+json": {
source: "iana",
compressible: true
},
"application/vnd.las.las+xml": {
source: "iana",
compressible: true,
extensions: ["lasxml"]
},
"application/vnd.laszip": {
source: "iana"
},
"application/vnd.leap+json": {
source: "iana",
compressible: true
},
"application/vnd.liberty-request+xml": {
source: "iana",
compressible: true
},
"application/vnd.llamagraphics.life-balance.desktop": {
source: "iana",
extensions: ["lbd"]
},
"application/vnd.llamagraphics.life-balance.exchange+xml": {
source: "iana",
compressible: true,
extensions: ["lbe"]
},
"application/vnd.logipipe.circuit+zip": {
source: "iana",
compressible: false
},
"application/vnd.loom": {
source: "iana"
},
"application/vnd.lotus-1-2-3": {
source: "iana",
extensions: ["123"]
},
"application/vnd.lotus-approach": {
source: "iana",
extensions: ["apr"]
},
"application/vnd.lotus-freelance": {
source: "iana",
extensions: ["pre"]
},
"application/vnd.lotus-notes": {
source: "iana",
extensions: ["nsf"]
},
"application/vnd.lotus-organizer": {
source: "iana",
extensions: ["org"]
},
"application/vnd.lotus-screencam": {
source: "iana",
extensions: ["scm"]
},
"application/vnd.lotus-wordpro": {
source: "iana",
extensions: ["lwp"]
},
"application/vnd.macports.portpkg": {
source: "iana",
extensions: ["portpkg"]
},
"application/vnd.mapbox-vector-tile": {
source: "iana",
extensions: ["mvt"]
},
"application/vnd.marlin.drm.actiontoken+xml": {
source: "iana",
compressible: true
},
"application/vnd.marlin.drm.conftoken+xml": {
source: "iana",
compressible: true
},
"application/vnd.marlin.drm.license+xml": {
source: "iana",
compressible: true
},
"application/vnd.marlin.drm.mdcf": {
source: "iana"
},
"application/vnd.mason+json": {
source: "iana",
compressible: true
},
"application/vnd.maxar.archive.3tz+zip": {
source: "iana",
compressible: false
},
"application/vnd.maxmind.maxmind-db": {
source: "iana"
},
"application/vnd.mcd": {
source: "iana",
extensions: ["mcd"]
},
"application/vnd.medcalcdata": {
source: "iana",
extensions: ["mc1"]
},
"application/vnd.mediastation.cdkey": {
source: "iana",
extensions: ["cdkey"]
},
"application/vnd.meridian-slingshot": {
source: "iana"
},
"application/vnd.mfer": {
source: "iana",
extensions: ["mwf"]
},
"application/vnd.mfmp": {
source: "iana",
extensions: ["mfm"]
},
"application/vnd.micro+json": {
source: "iana",
compressible: true
},
"application/vnd.micrografx.flo": {
source: "iana",
extensions: ["flo"]
},
"application/vnd.micrografx.igx": {
source: "iana",
extensions: ["igx"]
},
"application/vnd.microsoft.portable-executable": {
source: "iana"
},
"application/vnd.microsoft.windows.thumbnail-cache": {
source: "iana"
},
"application/vnd.miele+json": {
source: "iana",
compressible: true
},
"application/vnd.mif": {
source: "iana",
extensions: ["mif"]
},
"application/vnd.minisoft-hp3000-save": {
source: "iana"
},
"application/vnd.mitsubishi.misty-guard.trustweb": {
source: "iana"
},
"application/vnd.mobius.daf": {
source: "iana",
extensions: ["daf"]
},
"application/vnd.mobius.dis": {
source: "iana",
extensions: ["dis"]
},
"application/vnd.mobius.mbk": {
source: "iana",
extensions: ["mbk"]
},
"application/vnd.mobius.mqy": {
source: "iana",
extensions: ["mqy"]
},
"application/vnd.mobius.msl": {
source: "iana",
extensions: ["msl"]
},
"application/vnd.mobius.plc": {
source: "iana",
extensions: ["plc"]
},
"application/vnd.mobius.txf": {
source: "iana",
extensions: ["txf"]
},
"application/vnd.mophun.application": {
source: "iana",
extensions: ["mpn"]
},
"application/vnd.mophun.certificate": {
source: "iana",
extensions: ["mpc"]
},
"application/vnd.motorola.flexsuite": {
source: "iana"
},
"application/vnd.motorola.flexsuite.adsi": {
source: "iana"
},
"application/vnd.motorola.flexsuite.fis": {
source: "iana"
},
"application/vnd.motorola.flexsuite.gotap": {
source: "iana"
},
"application/vnd.motorola.flexsuite.kmr": {
source: "iana"
},
"application/vnd.motorola.flexsuite.ttc": {
source: "iana"
},
"application/vnd.motorola.flexsuite.wem": {
source: "iana"
},
"application/vnd.motorola.iprm": {
source: "iana"
},
"application/vnd.mozilla.xul+xml": {
source: "iana",
compressible: true,
extensions: ["xul"]
},
"application/vnd.ms-3mfdocument": {
source: "iana"
},
"application/vnd.ms-artgalry": {
source: "iana",
extensions: ["cil"]
},
"application/vnd.ms-asf": {
source: "iana"
},
"application/vnd.ms-cab-compressed": {
source: "iana",
extensions: ["cab"]
},
"application/vnd.ms-color.iccprofile": {
source: "apache"
},
"application/vnd.ms-excel": {
source: "iana",
compressible: false,
extensions: ["xls", "xlm", "xla", "xlc", "xlt", "xlw"]
},
"application/vnd.ms-excel.addin.macroenabled.12": {
source: "iana",
extensions: ["xlam"]
},
"application/vnd.ms-excel.sheet.binary.macroenabled.12": {
source: "iana",
extensions: ["xlsb"]
},
"application/vnd.ms-excel.sheet.macroenabled.12": {
source: "iana",
extensions: ["xlsm"]
},
"application/vnd.ms-excel.template.macroenabled.12": {
source: "iana",
extensions: ["xltm"]
},
"application/vnd.ms-fontobject": {
source: "iana",
compressible: true,
extensions: ["eot"]
},
"application/vnd.ms-htmlhelp": {
source: "iana",
extensions: ["chm"]
},
"application/vnd.ms-ims": {
source: "iana",
extensions: ["ims"]
},
"application/vnd.ms-lrm": {
source: "iana",
extensions: ["lrm"]
},
"application/vnd.ms-office.activex+xml": {
source: "iana",
compressible: true
},
"application/vnd.ms-officetheme": {
source: "iana",
extensions: ["thmx"]
},
"application/vnd.ms-opentype": {
source: "apache",
compressible: true
},
"application/vnd.ms-outlook": {
compressible: false,
extensions: ["msg"]
},
"application/vnd.ms-package.obfuscated-opentype": {
source: "apache"
},
"application/vnd.ms-pki.seccat": {
source: "apache",
extensions: ["cat"]
},
"application/vnd.ms-pki.stl": {
source: "apache",
extensions: ["stl"]
},
"application/vnd.ms-playready.initiator+xml": {
source: "iana",
compressible: true
},
"application/vnd.ms-powerpoint": {
source: "iana",
compressible: false,
extensions: ["ppt", "pps", "pot"]
},
"application/vnd.ms-powerpoint.addin.macroenabled.12": {
source: "iana",
extensions: ["ppam"]
},
"application/vnd.ms-powerpoint.presentation.macroenabled.12": {
source: "iana",
extensions: ["pptm"]
},
"application/vnd.ms-powerpoint.slide.macroenabled.12": {
source: "iana",
extensions: ["sldm"]
},
"application/vnd.ms-powerpoint.slideshow.macroenabled.12": {
source: "iana",
extensions: ["ppsm"]
},
"application/vnd.ms-powerpoint.template.macroenabled.12": {
source: "iana",
extensions: ["potm"]
},
"application/vnd.ms-printdevicecapabilities+xml": {
source: "iana",
compressible: true
},
"application/vnd.ms-printing.printticket+xml": {
source: "apache",
compressible: true
},
"application/vnd.ms-printschematicket+xml": {
source: "iana",
compressible: true
},
"application/vnd.ms-project": {
source: "iana",
extensions: ["mpp", "mpt"]
},
"application/vnd.ms-tnef": {
source: "iana"
},
"application/vnd.ms-windows.devicepairing": {
source: "iana"
},
"application/vnd.ms-windows.nwprinting.oob": {
source: "iana"
},
"application/vnd.ms-windows.printerpairing": {
source: "iana"
},
"application/vnd.ms-windows.wsd.oob": {
source: "iana"
},
"application/vnd.ms-wmdrm.lic-chlg-req": {
source: "iana"
},
"application/vnd.ms-wmdrm.lic-resp": {
source: "iana"
},
"application/vnd.ms-wmdrm.meter-chlg-req": {
source: "iana"
},
"application/vnd.ms-wmdrm.meter-resp": {
source: "iana"
},
"application/vnd.ms-word.document.macroenabled.12": {
source: "iana",
extensions: ["docm"]
},
"application/vnd.ms-word.template.macroenabled.12": {
source: "iana",
extensions: ["dotm"]
},
"application/vnd.ms-works": {
source: "iana",
extensions: ["wps", "wks", "wcm", "wdb"]
},
"application/vnd.ms-wpl": {
source: "iana",
extensions: ["wpl"]
},
"application/vnd.ms-xpsdocument": {
source: "iana",
compressible: false,
extensions: ["xps"]
},
"application/vnd.msa-disk-image": {
source: "iana"
},
"application/vnd.mseq": {
source: "iana",
extensions: ["mseq"]
},
"application/vnd.msign": {
source: "iana"
},
"application/vnd.multiad.creator": {
source: "iana"
},
"application/vnd.multiad.creator.cif": {
source: "iana"
},
"application/vnd.music-niff": {
source: "iana"
},
"application/vnd.musician": {
source: "iana",
extensions: ["mus"]
},
"application/vnd.muvee.style": {
source: "iana",
extensions: ["msty"]
},
"application/vnd.mynfc": {
source: "iana",
extensions: ["taglet"]
},
"application/vnd.nacamar.ybrid+json": {
source: "iana",
compressible: true
},
"application/vnd.ncd.control": {
source: "iana"
},
"application/vnd.ncd.reference": {
source: "iana"
},
"application/vnd.nearst.inv+json": {
source: "iana",
compressible: true
},
"application/vnd.nebumind.line": {
source: "iana"
},
"application/vnd.nervana": {
source: "iana"
},
"application/vnd.netfpx": {
source: "iana"
},
"application/vnd.neurolanguage.nlu": {
source: "iana",
extensions: ["nlu"]
},
"application/vnd.nimn": {
source: "iana"
},
"application/vnd.nintendo.nitro.rom": {
source: "iana"
},
"application/vnd.nintendo.snes.rom": {
source: "iana"
},
"application/vnd.nitf": {
source: "iana",
extensions: ["ntf", "nitf"]
},
"application/vnd.noblenet-directory": {
source: "iana",
extensions: ["nnd"]
},
"application/vnd.noblenet-sealer": {
source: "iana",
extensions: ["nns"]
},
"application/vnd.noblenet-web": {
source: "iana",
extensions: ["nnw"]
},
"application/vnd.nokia.catalogs": {
source: "iana"
},
"application/vnd.nokia.conml+wbxml": {
source: "iana"
},
"application/vnd.nokia.conml+xml": {
source: "iana",
compressible: true
},
"application/vnd.nokia.iptv.config+xml": {
source: "iana",
compressible: true
},
"application/vnd.nokia.isds-radio-presets": {
source: "iana"
},
"application/vnd.nokia.landmark+wbxml": {
source: "iana"
},
"application/vnd.nokia.landmark+xml": {
source: "iana",
compressible: true
},
"application/vnd.nokia.landmarkcollection+xml": {
source: "iana",
compressible: true
},
"application/vnd.nokia.n-gage.ac+xml": {
source: "iana",
compressible: true,
extensions: ["ac"]
},
"application/vnd.nokia.n-gage.data": {
source: "iana",
extensions: ["ngdat"]
},
"application/vnd.nokia.n-gage.symbian.install": {
source: "iana",
extensions: ["n-gage"]
},
"application/vnd.nokia.ncd": {
source: "iana"
},
"application/vnd.nokia.pcd+wbxml": {
source: "iana"
},
"application/vnd.nokia.pcd+xml": {
source: "iana",
compressible: true
},
"application/vnd.nokia.radio-preset": {
source: "iana",
extensions: ["rpst"]
},
"application/vnd.nokia.radio-presets": {
source: "iana",
extensions: ["rpss"]
},
"application/vnd.novadigm.edm": {
source: "iana",
extensions: ["edm"]
},
"application/vnd.novadigm.edx": {
source: "iana",
extensions: ["edx"]
},
"application/vnd.novadigm.ext": {
source: "iana",
extensions: ["ext"]
},
"application/vnd.ntt-local.content-share": {
source: "iana"
},
"application/vnd.ntt-local.file-transfer": {
source: "iana"
},
"application/vnd.ntt-local.ogw_remote-access": {
source: "iana"
},
"application/vnd.ntt-local.sip-ta_remote": {
source: "iana"
},
"application/vnd.ntt-local.sip-ta_tcp_stream": {
source: "iana"
},
"application/vnd.oasis.opendocument.chart": {
source: "iana",
extensions: ["odc"]
},
"application/vnd.oasis.opendocument.chart-template": {
source: "iana",
extensions: ["otc"]
},
"application/vnd.oasis.opendocument.database": {
source: "iana",
extensions: ["odb"]
},
"application/vnd.oasis.opendocument.formula": {
source: "iana",
extensions: ["odf"]
},
"application/vnd.oasis.opendocument.formula-template": {
source: "iana",
extensions: ["odft"]
},
"application/vnd.oasis.opendocument.graphics": {
source: "iana",
compressible: false,
extensions: ["odg"]
},
"application/vnd.oasis.opendocument.graphics-template": {
source: "iana",
extensions: ["otg"]
},
"application/vnd.oasis.opendocument.image": {
source: "iana",
extensions: ["odi"]
},
"application/vnd.oasis.opendocument.image-template": {
source: "iana",
extensions: ["oti"]
},
"application/vnd.oasis.opendocument.presentation": {
source: "iana",
compressible: false,
extensions: ["odp"]
},
"application/vnd.oasis.opendocument.presentation-template": {
source: "iana",
extensions: ["otp"]
},
"application/vnd.oasis.opendocument.spreadsheet": {
source: "iana",
compressible: false,
extensions: ["ods"]
},
"application/vnd.oasis.opendocument.spreadsheet-template": {
source: "iana",
extensions: ["ots"]
},
"application/vnd.oasis.opendocument.text": {
source: "iana",
compressible: false,
extensions: ["odt"]
},
"application/vnd.oasis.opendocument.text-master": {
source: "iana",
extensions: ["odm"]
},
"application/vnd.oasis.opendocument.text-template": {
source: "iana",
extensions: ["ott"]
},
"application/vnd.oasis.opendocument.text-web": {
source: "iana",
extensions: ["oth"]
},
"application/vnd.obn": {
source: "iana"
},
"application/vnd.ocf+cbor": {
source: "iana"
},
"application/vnd.oci.image.manifest.v1+json": {
source: "iana",
compressible: true
},
"application/vnd.oftn.l10n+json": {
source: "iana",
compressible: true
},
"application/vnd.oipf.contentaccessdownload+xml": {
source: "iana",
compressible: true
},
"application/vnd.oipf.contentaccessstreaming+xml": {
source: "iana",
compressible: true
},
"application/vnd.oipf.cspg-hexbinary": {
source: "iana"
},
"application/vnd.oipf.dae.svg+xml": {
source: "iana",
compressible: true
},
"application/vnd.oipf.dae.xhtml+xml": {
source: "iana",
compressible: true
},
"application/vnd.oipf.mippvcontrolmessage+xml": {
source: "iana",
compressible: true
},
"application/vnd.oipf.pae.gem": {
source: "iana"
},
"application/vnd.oipf.spdiscovery+xml": {
source: "iana",
compressible: true
},
"application/vnd.oipf.spdlist+xml": {
source: "iana",
compressible: true
},
"application/vnd.oipf.ueprofile+xml": {
source: "iana",
compressible: true
},
"application/vnd.oipf.userprofile+xml": {
source: "iana",
compressible: true
},
"application/vnd.olpc-sugar": {
source: "iana",
extensions: ["xo"]
},
"application/vnd.oma-scws-config": {
source: "iana"
},
"application/vnd.oma-scws-http-request": {
source: "iana"
},
"application/vnd.oma-scws-http-response": {
source: "iana"
},
"application/vnd.oma.bcast.associated-procedure-parameter+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.bcast.drm-trigger+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.bcast.imd+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.bcast.ltkm": {
source: "iana"
},
"application/vnd.oma.bcast.notification+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.bcast.provisioningtrigger": {
source: "iana"
},
"application/vnd.oma.bcast.sgboot": {
source: "iana"
},
"application/vnd.oma.bcast.sgdd+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.bcast.sgdu": {
source: "iana"
},
"application/vnd.oma.bcast.simple-symbol-container": {
source: "iana"
},
"application/vnd.oma.bcast.smartcard-trigger+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.bcast.sprov+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.bcast.stkm": {
source: "iana"
},
"application/vnd.oma.cab-address-book+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.cab-feature-handler+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.cab-pcc+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.cab-subs-invite+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.cab-user-prefs+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.dcd": {
source: "iana"
},
"application/vnd.oma.dcdc": {
source: "iana"
},
"application/vnd.oma.dd2+xml": {
source: "iana",
compressible: true,
extensions: ["dd2"]
},
"application/vnd.oma.drm.risd+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.group-usage-list+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.lwm2m+cbor": {
source: "iana"
},
"application/vnd.oma.lwm2m+json": {
source: "iana",
compressible: true
},
"application/vnd.oma.lwm2m+tlv": {
source: "iana"
},
"application/vnd.oma.pal+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.poc.detailed-progress-report+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.poc.final-report+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.poc.groups+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.poc.invocation-descriptor+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.poc.optimized-progress-report+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.push": {
source: "iana"
},
"application/vnd.oma.scidm.messages+xml": {
source: "iana",
compressible: true
},
"application/vnd.oma.xcap-directory+xml": {
source: "iana",
compressible: true
},
"application/vnd.omads-email+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/vnd.omads-file+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/vnd.omads-folder+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/vnd.omaloc-supl-init": {
source: "iana"
},
"application/vnd.onepager": {
source: "iana"
},
"application/vnd.onepagertamp": {
source: "iana"
},
"application/vnd.onepagertamx": {
source: "iana"
},
"application/vnd.onepagertat": {
source: "iana"
},
"application/vnd.onepagertatp": {
source: "iana"
},
"application/vnd.onepagertatx": {
source: "iana"
},
"application/vnd.openblox.game+xml": {
source: "iana",
compressible: true,
extensions: ["obgx"]
},
"application/vnd.openblox.game-binary": {
source: "iana"
},
"application/vnd.openeye.oeb": {
source: "iana"
},
"application/vnd.openofficeorg.extension": {
source: "apache",
extensions: ["oxt"]
},
"application/vnd.openstreetmap.data+xml": {
source: "iana",
compressible: true,
extensions: ["osm"]
},
"application/vnd.opentimestamps.ots": {
source: "iana"
},
"application/vnd.openxmlformats-officedocument.custom-properties+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.customxmlproperties+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.drawing+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.drawingml.chart+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.extended-properties+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.comments+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.presentation": {
source: "iana",
compressible: false,
extensions: ["pptx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.slide": {
source: "iana",
extensions: ["sldx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.slide+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.slideshow": {
source: "iana",
extensions: ["ppsx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.tags+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.template": {
source: "iana",
extensions: ["potx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
source: "iana",
compressible: false,
extensions: ["xlsx"]
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.template": {
source: "iana",
extensions: ["xltx"]
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.theme+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.themeoverride+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.vmldrawing": {
source: "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
source: "iana",
compressible: false,
extensions: ["docx"]
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.template": {
source: "iana",
extensions: ["dotx"]
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-package.core-properties+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml": {
source: "iana",
compressible: true
},
"application/vnd.openxmlformats-package.relationships+xml": {
source: "iana",
compressible: true
},
"application/vnd.oracle.resource+json": {
source: "iana",
compressible: true
},
"application/vnd.orange.indata": {
source: "iana"
},
"application/vnd.osa.netdeploy": {
source: "iana"
},
"application/vnd.osgeo.mapguide.package": {
source: "iana",
extensions: ["mgp"]
},
"application/vnd.osgi.bundle": {
source: "iana"
},
"application/vnd.osgi.dp": {
source: "iana",
extensions: ["dp"]
},
"application/vnd.osgi.subsystem": {
source: "iana",
extensions: ["esa"]
},
"application/vnd.otps.ct-kip+xml": {
source: "iana",
compressible: true
},
"application/vnd.oxli.countgraph": {
source: "iana"
},
"application/vnd.pagerduty+json": {
source: "iana",
compressible: true
},
"application/vnd.palm": {
source: "iana",
extensions: ["pdb", "pqa", "oprc"]
},
"application/vnd.panoply": {
source: "iana"
},
"application/vnd.paos.xml": {
source: "iana"
},
"application/vnd.patentdive": {
source: "iana"
},
"application/vnd.patientecommsdoc": {
source: "iana"
},
"application/vnd.pawaafile": {
source: "iana",
extensions: ["paw"]
},
"application/vnd.pcos": {
source: "iana"
},
"application/vnd.pg.format": {
source: "iana",
extensions: ["str"]
},
"application/vnd.pg.osasli": {
source: "iana",
extensions: ["ei6"]
},
"application/vnd.piaccess.application-licence": {
source: "iana"
},
"application/vnd.picsel": {
source: "iana",
extensions: ["efif"]
},
"application/vnd.pmi.widget": {
source: "iana",
extensions: ["wg"]
},
"application/vnd.poc.group-advertisement+xml": {
source: "iana",
compressible: true
},
"application/vnd.pocketlearn": {
source: "iana",
extensions: ["plf"]
},
"application/vnd.powerbuilder6": {
source: "iana",
extensions: ["pbd"]
},
"application/vnd.powerbuilder6-s": {
source: "iana"
},
"application/vnd.powerbuilder7": {
source: "iana"
},
"application/vnd.powerbuilder7-s": {
source: "iana"
},
"application/vnd.powerbuilder75": {
source: "iana"
},
"application/vnd.powerbuilder75-s": {
source: "iana"
},
"application/vnd.preminet": {
source: "iana"
},
"application/vnd.previewsystems.box": {
source: "iana",
extensions: ["box"]
},
"application/vnd.proteus.magazine": {
source: "iana",
extensions: ["mgz"]
},
"application/vnd.psfs": {
source: "iana"
},
"application/vnd.publishare-delta-tree": {
source: "iana",
extensions: ["qps"]
},
"application/vnd.pvi.ptid1": {
source: "iana",
extensions: ["ptid"]
},
"application/vnd.pwg-multiplexed": {
source: "iana"
},
"application/vnd.pwg-xhtml-print+xml": {
source: "iana",
compressible: true
},
"application/vnd.qualcomm.brew-app-res": {
source: "iana"
},
"application/vnd.quarantainenet": {
source: "iana"
},
"application/vnd.quark.quarkxpress": {
source: "iana",
extensions: ["qxd", "qxt", "qwd", "qwt", "qxl", "qxb"]
},
"application/vnd.quobject-quoxdocument": {
source: "iana"
},
"application/vnd.radisys.moml+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-audit+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-audit-conf+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-audit-conn+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-audit-dialog+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-audit-stream+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-conf+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-dialog+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-dialog-base+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-dialog-fax-detect+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-dialog-fax-sendrecv+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-dialog-group+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-dialog-speech+xml": {
source: "iana",
compressible: true
},
"application/vnd.radisys.msml-dialog-transform+xml": {
source: "iana",
compressible: true
},
"application/vnd.rainstor.data": {
source: "iana"
},
"application/vnd.rapid": {
source: "iana"
},
"application/vnd.rar": {
source: "iana",
extensions: ["rar"]
},
"application/vnd.realvnc.bed": {
source: "iana",
extensions: ["bed"]
},
"application/vnd.recordare.musicxml": {
source: "iana",
extensions: ["mxl"]
},
"application/vnd.recordare.musicxml+xml": {
source: "iana",
compressible: true,
extensions: ["musicxml"]
},
"application/vnd.renlearn.rlprint": {
source: "iana"
},
"application/vnd.resilient.logic": {
source: "iana"
},
"application/vnd.restful+json": {
source: "iana",
compressible: true
},
"application/vnd.rig.cryptonote": {
source: "iana",
extensions: ["cryptonote"]
},
"application/vnd.rim.cod": {
source: "apache",
extensions: ["cod"]
},
"application/vnd.rn-realmedia": {
source: "apache",
extensions: ["rm"]
},
"application/vnd.rn-realmedia-vbr": {
source: "apache",
extensions: ["rmvb"]
},
"application/vnd.route66.link66+xml": {
source: "iana",
compressible: true,
extensions: ["link66"]
},
"application/vnd.rs-274x": {
source: "iana"
},
"application/vnd.ruckus.download": {
source: "iana"
},
"application/vnd.s3sms": {
source: "iana"
},
"application/vnd.sailingtracker.track": {
source: "iana",
extensions: ["st"]
},
"application/vnd.sar": {
source: "iana"
},
"application/vnd.sbm.cid": {
source: "iana"
},
"application/vnd.sbm.mid2": {
source: "iana"
},
"application/vnd.scribus": {
source: "iana"
},
"application/vnd.sealed.3df": {
source: "iana"
},
"application/vnd.sealed.csf": {
source: "iana"
},
"application/vnd.sealed.doc": {
source: "iana"
},
"application/vnd.sealed.eml": {
source: "iana"
},
"application/vnd.sealed.mht": {
source: "iana"
},
"application/vnd.sealed.net": {
source: "iana"
},
"application/vnd.sealed.ppt": {
source: "iana"
},
"application/vnd.sealed.tiff": {
source: "iana"
},
"application/vnd.sealed.xls": {
source: "iana"
},
"application/vnd.sealedmedia.softseal.html": {
source: "iana"
},
"application/vnd.sealedmedia.softseal.pdf": {
source: "iana"
},
"application/vnd.seemail": {
source: "iana",
extensions: ["see"]
},
"application/vnd.seis+json": {
source: "iana",
compressible: true
},
"application/vnd.sema": {
source: "iana",
extensions: ["sema"]
},
"application/vnd.semd": {
source: "iana",
extensions: ["semd"]
},
"application/vnd.semf": {
source: "iana",
extensions: ["semf"]
},
"application/vnd.shade-save-file": {
source: "iana"
},
"application/vnd.shana.informed.formdata": {
source: "iana",
extensions: ["ifm"]
},
"application/vnd.shana.informed.formtemplate": {
source: "iana",
extensions: ["itp"]
},
"application/vnd.shana.informed.interchange": {
source: "iana",
extensions: ["iif"]
},
"application/vnd.shana.informed.package": {
source: "iana",
extensions: ["ipk"]
},
"application/vnd.shootproof+json": {
source: "iana",
compressible: true
},
"application/vnd.shopkick+json": {
source: "iana",
compressible: true
},
"application/vnd.shp": {
source: "iana"
},
"application/vnd.shx": {
source: "iana"
},
"application/vnd.sigrok.session": {
source: "iana"
},
"application/vnd.simtech-mindmapper": {
source: "iana",
extensions: ["twd", "twds"]
},
"application/vnd.siren+json": {
source: "iana",
compressible: true
},
"application/vnd.smaf": {
source: "iana",
extensions: ["mmf"]
},
"application/vnd.smart.notebook": {
source: "iana"
},
"application/vnd.smart.teacher": {
source: "iana",
extensions: ["teacher"]
},
"application/vnd.snesdev-page-table": {
source: "iana"
},
"application/vnd.software602.filler.form+xml": {
source: "iana",
compressible: true,
extensions: ["fo"]
},
"application/vnd.software602.filler.form-xml-zip": {
source: "iana"
},
"application/vnd.solent.sdkm+xml": {
source: "iana",
compressible: true,
extensions: ["sdkm", "sdkd"]
},
"application/vnd.spotfire.dxp": {
source: "iana",
extensions: ["dxp"]
},
"application/vnd.spotfire.sfs": {
source: "iana",
extensions: ["sfs"]
},
"application/vnd.sqlite3": {
source: "iana"
},
"application/vnd.sss-cod": {
source: "iana"
},
"application/vnd.sss-dtf": {
source: "iana"
},
"application/vnd.sss-ntf": {
source: "iana"
},
"application/vnd.stardivision.calc": {
source: "apache",
extensions: ["sdc"]
},
"application/vnd.stardivision.draw": {
source: "apache",
extensions: ["sda"]
},
"application/vnd.stardivision.impress": {
source: "apache",
extensions: ["sdd"]
},
"application/vnd.stardivision.math": {
source: "apache",
extensions: ["smf"]
},
"application/vnd.stardivision.writer": {
source: "apache",
extensions: ["sdw", "vor"]
},
"application/vnd.stardivision.writer-global": {
source: "apache",
extensions: ["sgl"]
},
"application/vnd.stepmania.package": {
source: "iana",
extensions: ["smzip"]
},
"application/vnd.stepmania.stepchart": {
source: "iana",
extensions: ["sm"]
},
"application/vnd.street-stream": {
source: "iana"
},
"application/vnd.sun.wadl+xml": {
source: "iana",
compressible: true,
extensions: ["wadl"]
},
"application/vnd.sun.xml.calc": {
source: "apache",
extensions: ["sxc"]
},
"application/vnd.sun.xml.calc.template": {
source: "apache",
extensions: ["stc"]
},
"application/vnd.sun.xml.draw": {
source: "apache",
extensions: ["sxd"]
},
"application/vnd.sun.xml.draw.template": {
source: "apache",
extensions: ["std"]
},
"application/vnd.sun.xml.impress": {
source: "apache",
extensions: ["sxi"]
},
"application/vnd.sun.xml.impress.template": {
source: "apache",
extensions: ["sti"]
},
"application/vnd.sun.xml.math": {
source: "apache",
extensions: ["sxm"]
},
"application/vnd.sun.xml.writer": {
source: "apache",
extensions: ["sxw"]
},
"application/vnd.sun.xml.writer.global": {
source: "apache",
extensions: ["sxg"]
},
"application/vnd.sun.xml.writer.template": {
source: "apache",
extensions: ["stw"]
},
"application/vnd.sus-calendar": {
source: "iana",
extensions: ["sus", "susp"]
},
"application/vnd.svd": {
source: "iana",
extensions: ["svd"]
},
"application/vnd.swiftview-ics": {
source: "iana"
},
"application/vnd.sycle+xml": {
source: "iana",
compressible: true
},
"application/vnd.syft+json": {
source: "iana",
compressible: true
},
"application/vnd.symbian.install": {
source: "apache",
extensions: ["sis", "sisx"]
},
"application/vnd.syncml+xml": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["xsm"]
},
"application/vnd.syncml.dm+wbxml": {
source: "iana",
charset: "UTF-8",
extensions: ["bdm"]
},
"application/vnd.syncml.dm+xml": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["xdm"]
},
"application/vnd.syncml.dm.notification": {
source: "iana"
},
"application/vnd.syncml.dmddf+wbxml": {
source: "iana"
},
"application/vnd.syncml.dmddf+xml": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["ddf"]
},
"application/vnd.syncml.dmtnds+wbxml": {
source: "iana"
},
"application/vnd.syncml.dmtnds+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/vnd.syncml.ds.notification": {
source: "iana"
},
"application/vnd.tableschema+json": {
source: "iana",
compressible: true
},
"application/vnd.tao.intent-module-archive": {
source: "iana",
extensions: ["tao"]
},
"application/vnd.tcpdump.pcap": {
source: "iana",
extensions: ["pcap", "cap", "dmp"]
},
"application/vnd.think-cell.ppttc+json": {
source: "iana",
compressible: true
},
"application/vnd.tmd.mediaflex.api+xml": {
source: "iana",
compressible: true
},
"application/vnd.tml": {
source: "iana"
},
"application/vnd.tmobile-livetv": {
source: "iana",
extensions: ["tmo"]
},
"application/vnd.tri.onesource": {
source: "iana"
},
"application/vnd.trid.tpt": {
source: "iana",
extensions: ["tpt"]
},
"application/vnd.triscape.mxs": {
source: "iana",
extensions: ["mxs"]
},
"application/vnd.trueapp": {
source: "iana",
extensions: ["tra"]
},
"application/vnd.truedoc": {
source: "iana"
},
"application/vnd.ubisoft.webplayer": {
source: "iana"
},
"application/vnd.ufdl": {
source: "iana",
extensions: ["ufd", "ufdl"]
},
"application/vnd.uiq.theme": {
source: "iana",
extensions: ["utz"]
},
"application/vnd.umajin": {
source: "iana",
extensions: ["umj"]
},
"application/vnd.unity": {
source: "iana",
extensions: ["unityweb"]
},
"application/vnd.uoml+xml": {
source: "iana",
compressible: true,
extensions: ["uoml"]
},
"application/vnd.uplanet.alert": {
source: "iana"
},
"application/vnd.uplanet.alert-wbxml": {
source: "iana"
},
"application/vnd.uplanet.bearer-choice": {
source: "iana"
},
"application/vnd.uplanet.bearer-choice-wbxml": {
source: "iana"
},
"application/vnd.uplanet.cacheop": {
source: "iana"
},
"application/vnd.uplanet.cacheop-wbxml": {
source: "iana"
},
"application/vnd.uplanet.channel": {
source: "iana"
},
"application/vnd.uplanet.channel-wbxml": {
source: "iana"
},
"application/vnd.uplanet.list": {
source: "iana"
},
"application/vnd.uplanet.list-wbxml": {
source: "iana"
},
"application/vnd.uplanet.listcmd": {
source: "iana"
},
"application/vnd.uplanet.listcmd-wbxml": {
source: "iana"
},
"application/vnd.uplanet.signal": {
source: "iana"
},
"application/vnd.uri-map": {
source: "iana"
},
"application/vnd.valve.source.material": {
source: "iana"
},
"application/vnd.vcx": {
source: "iana",
extensions: ["vcx"]
},
"application/vnd.vd-study": {
source: "iana"
},
"application/vnd.vectorworks": {
source: "iana"
},
"application/vnd.vel+json": {
source: "iana",
compressible: true
},
"application/vnd.verimatrix.vcas": {
source: "iana"
},
"application/vnd.veritone.aion+json": {
source: "iana",
compressible: true
},
"application/vnd.veryant.thin": {
source: "iana"
},
"application/vnd.ves.encrypted": {
source: "iana"
},
"application/vnd.vidsoft.vidconference": {
source: "iana"
},
"application/vnd.visio": {
source: "iana",
extensions: ["vsd", "vst", "vss", "vsw"]
},
"application/vnd.visionary": {
source: "iana",
extensions: ["vis"]
},
"application/vnd.vividence.scriptfile": {
source: "iana"
},
"application/vnd.vsf": {
source: "iana",
extensions: ["vsf"]
},
"application/vnd.wap.sic": {
source: "iana"
},
"application/vnd.wap.slc": {
source: "iana"
},
"application/vnd.wap.wbxml": {
source: "iana",
charset: "UTF-8",
extensions: ["wbxml"]
},
"application/vnd.wap.wmlc": {
source: "iana",
extensions: ["wmlc"]
},
"application/vnd.wap.wmlscriptc": {
source: "iana",
extensions: ["wmlsc"]
},
"application/vnd.webturbo": {
source: "iana",
extensions: ["wtb"]
},
"application/vnd.wfa.dpp": {
source: "iana"
},
"application/vnd.wfa.p2p": {
source: "iana"
},
"application/vnd.wfa.wsc": {
source: "iana"
},
"application/vnd.windows.devicepairing": {
source: "iana"
},
"application/vnd.wmc": {
source: "iana"
},
"application/vnd.wmf.bootstrap": {
source: "iana"
},
"application/vnd.wolfram.mathematica": {
source: "iana"
},
"application/vnd.wolfram.mathematica.package": {
source: "iana"
},
"application/vnd.wolfram.player": {
source: "iana",
extensions: ["nbp"]
},
"application/vnd.wordperfect": {
source: "iana",
extensions: ["wpd"]
},
"application/vnd.wqd": {
source: "iana",
extensions: ["wqd"]
},
"application/vnd.wrq-hp3000-labelled": {
source: "iana"
},
"application/vnd.wt.stf": {
source: "iana",
extensions: ["stf"]
},
"application/vnd.wv.csp+wbxml": {
source: "iana"
},
"application/vnd.wv.csp+xml": {
source: "iana",
compressible: true
},
"application/vnd.wv.ssp+xml": {
source: "iana",
compressible: true
},
"application/vnd.xacml+json": {
source: "iana",
compressible: true
},
"application/vnd.xara": {
source: "iana",
extensions: ["xar"]
},
"application/vnd.xfdl": {
source: "iana",
extensions: ["xfdl"]
},
"application/vnd.xfdl.webform": {
source: "iana"
},
"application/vnd.xmi+xml": {
source: "iana",
compressible: true
},
"application/vnd.xmpie.cpkg": {
source: "iana"
},
"application/vnd.xmpie.dpkg": {
source: "iana"
},
"application/vnd.xmpie.plan": {
source: "iana"
},
"application/vnd.xmpie.ppkg": {
source: "iana"
},
"application/vnd.xmpie.xlim": {
source: "iana"
},
"application/vnd.yamaha.hv-dic": {
source: "iana",
extensions: ["hvd"]
},
"application/vnd.yamaha.hv-script": {
source: "iana",
extensions: ["hvs"]
},
"application/vnd.yamaha.hv-voice": {
source: "iana",
extensions: ["hvp"]
},
"application/vnd.yamaha.openscoreformat": {
source: "iana",
extensions: ["osf"]
},
"application/vnd.yamaha.openscoreformat.osfpvg+xml": {
source: "iana",
compressible: true,
extensions: ["osfpvg"]
},
"application/vnd.yamaha.remote-setup": {
source: "iana"
},
"application/vnd.yamaha.smaf-audio": {
source: "iana",
extensions: ["saf"]
},
"application/vnd.yamaha.smaf-phrase": {
source: "iana",
extensions: ["spf"]
},
"application/vnd.yamaha.through-ngn": {
source: "iana"
},
"application/vnd.yamaha.tunnel-udpencap": {
source: "iana"
},
"application/vnd.yaoweme": {
source: "iana"
},
"application/vnd.yellowriver-custom-menu": {
source: "iana",
extensions: ["cmp"]
},
"application/vnd.youtube.yt": {
source: "iana"
},
"application/vnd.zul": {
source: "iana",
extensions: ["zir", "zirz"]
},
"application/vnd.zzazz.deck+xml": {
source: "iana",
compressible: true,
extensions: ["zaz"]
},
"application/voicexml+xml": {
source: "iana",
compressible: true,
extensions: ["vxml"]
},
"application/voucher-cms+json": {
source: "iana",
compressible: true
},
"application/vq-rtcpxr": {
source: "iana"
},
"application/wasm": {
source: "iana",
compressible: true,
extensions: ["wasm"]
},
"application/watcherinfo+xml": {
source: "iana",
compressible: true,
extensions: ["wif"]
},
"application/webpush-options+json": {
source: "iana",
compressible: true
},
"application/whoispp-query": {
source: "iana"
},
"application/whoispp-response": {
source: "iana"
},
"application/widget": {
source: "iana",
extensions: ["wgt"]
},
"application/winhlp": {
source: "apache",
extensions: ["hlp"]
},
"application/wita": {
source: "iana"
},
"application/wordperfect5.1": {
source: "iana"
},
"application/wsdl+xml": {
source: "iana",
compressible: true,
extensions: ["wsdl"]
},
"application/wspolicy+xml": {
source: "iana",
compressible: true,
extensions: ["wspolicy"]
},
"application/x-7z-compressed": {
source: "apache",
compressible: false,
extensions: ["7z"]
},
"application/x-abiword": {
source: "apache",
extensions: ["abw"]
},
"application/x-ace-compressed": {
source: "apache",
extensions: ["ace"]
},
"application/x-amf": {
source: "apache"
},
"application/x-apple-diskimage": {
source: "apache",
extensions: ["dmg"]
},
"application/x-arj": {
compressible: false,
extensions: ["arj"]
},
"application/x-authorware-bin": {
source: "apache",
extensions: ["aab", "x32", "u32", "vox"]
},
"application/x-authorware-map": {
source: "apache",
extensions: ["aam"]
},
"application/x-authorware-seg": {
source: "apache",
extensions: ["aas"]
},
"application/x-bcpio": {
source: "apache",
extensions: ["bcpio"]
},
"application/x-bdoc": {
compressible: false,
extensions: ["bdoc"]
},
"application/x-bittorrent": {
source: "apache",
extensions: ["torrent"]
},
"application/x-blorb": {
source: "apache",
extensions: ["blb", "blorb"]
},
"application/x-bzip": {
source: "apache",
compressible: false,
extensions: ["bz"]
},
"application/x-bzip2": {
source: "apache",
compressible: false,
extensions: ["bz2", "boz"]
},
"application/x-cbr": {
source: "apache",
extensions: ["cbr", "cba", "cbt", "cbz", "cb7"]
},
"application/x-cdlink": {
source: "apache",
extensions: ["vcd"]
},
"application/x-cfs-compressed": {
source: "apache",
extensions: ["cfs"]
},
"application/x-chat": {
source: "apache",
extensions: ["chat"]
},
"application/x-chess-pgn": {
source: "apache",
extensions: ["pgn"]
},
"application/x-chrome-extension": {
extensions: ["crx"]
},
"application/x-cocoa": {
source: "nginx",
extensions: ["cco"]
},
"application/x-compress": {
source: "apache"
},
"application/x-conference": {
source: "apache",
extensions: ["nsc"]
},
"application/x-cpio": {
source: "apache",
extensions: ["cpio"]
},
"application/x-csh": {
source: "apache",
extensions: ["csh"]
},
"application/x-deb": {
compressible: false
},
"application/x-debian-package": {
source: "apache",
extensions: ["deb", "udeb"]
},
"application/x-dgc-compressed": {
source: "apache",
extensions: ["dgc"]
},
"application/x-director": {
source: "apache",
extensions: ["dir", "dcr", "dxr", "cst", "cct", "cxt", "w3d", "fgd", "swa"]
},
"application/x-doom": {
source: "apache",
extensions: ["wad"]
},
"application/x-dtbncx+xml": {
source: "apache",
compressible: true,
extensions: ["ncx"]
},
"application/x-dtbook+xml": {
source: "apache",
compressible: true,
extensions: ["dtb"]
},
"application/x-dtbresource+xml": {
source: "apache",
compressible: true,
extensions: ["res"]
},
"application/x-dvi": {
source: "apache",
compressible: false,
extensions: ["dvi"]
},
"application/x-envoy": {
source: "apache",
extensions: ["evy"]
},
"application/x-eva": {
source: "apache",
extensions: ["eva"]
},
"application/x-font-bdf": {
source: "apache",
extensions: ["bdf"]
},
"application/x-font-dos": {
source: "apache"
},
"application/x-font-framemaker": {
source: "apache"
},
"application/x-font-ghostscript": {
source: "apache",
extensions: ["gsf"]
},
"application/x-font-libgrx": {
source: "apache"
},
"application/x-font-linux-psf": {
source: "apache",
extensions: ["psf"]
},
"application/x-font-pcf": {
source: "apache",
extensions: ["pcf"]
},
"application/x-font-snf": {
source: "apache",
extensions: ["snf"]
},
"application/x-font-speedo": {
source: "apache"
},
"application/x-font-sunos-news": {
source: "apache"
},
"application/x-font-type1": {
source: "apache",
extensions: ["pfa", "pfb", "pfm", "afm"]
},
"application/x-font-vfont": {
source: "apache"
},
"application/x-freearc": {
source: "apache",
extensions: ["arc"]
},
"application/x-futuresplash": {
source: "apache",
extensions: ["spl"]
},
"application/x-gca-compressed": {
source: "apache",
extensions: ["gca"]
},
"application/x-glulx": {
source: "apache",
extensions: ["ulx"]
},
"application/x-gnumeric": {
source: "apache",
extensions: ["gnumeric"]
},
"application/x-gramps-xml": {
source: "apache",
extensions: ["gramps"]
},
"application/x-gtar": {
source: "apache",
extensions: ["gtar"]
},
"application/x-gzip": {
source: "apache"
},
"application/x-hdf": {
source: "apache",
extensions: ["hdf"]
},
"application/x-httpd-php": {
compressible: true,
extensions: ["php"]
},
"application/x-install-instructions": {
source: "apache",
extensions: ["install"]
},
"application/x-iso9660-image": {
source: "apache",
extensions: ["iso"]
},
"application/x-iwork-keynote-sffkey": {
extensions: ["key"]
},
"application/x-iwork-numbers-sffnumbers": {
extensions: ["numbers"]
},
"application/x-iwork-pages-sffpages": {
extensions: ["pages"]
},
"application/x-java-archive-diff": {
source: "nginx",
extensions: ["jardiff"]
},
"application/x-java-jnlp-file": {
source: "apache",
compressible: false,
extensions: ["jnlp"]
},
"application/x-javascript": {
compressible: true
},
"application/x-keepass2": {
extensions: ["kdbx"]
},
"application/x-latex": {
source: "apache",
compressible: false,
extensions: ["latex"]
},
"application/x-lua-bytecode": {
extensions: ["luac"]
},
"application/x-lzh-compressed": {
source: "apache",
extensions: ["lzh", "lha"]
},
"application/x-makeself": {
source: "nginx",
extensions: ["run"]
},
"application/x-mie": {
source: "apache",
extensions: ["mie"]
},
"application/x-mobipocket-ebook": {
source: "apache",
extensions: ["prc", "mobi"]
},
"application/x-mpegurl": {
compressible: false
},
"application/x-ms-application": {
source: "apache",
extensions: ["application"]
},
"application/x-ms-shortcut": {
source: "apache",
extensions: ["lnk"]
},
"application/x-ms-wmd": {
source: "apache",
extensions: ["wmd"]
},
"application/x-ms-wmz": {
source: "apache",
extensions: ["wmz"]
},
"application/x-ms-xbap": {
source: "apache",
extensions: ["xbap"]
},
"application/x-msaccess": {
source: "apache",
extensions: ["mdb"]
},
"application/x-msbinder": {
source: "apache",
extensions: ["obd"]
},
"application/x-mscardfile": {
source: "apache",
extensions: ["crd"]
},
"application/x-msclip": {
source: "apache",
extensions: ["clp"]
},
"application/x-msdos-program": {
extensions: ["exe"]
},
"application/x-msdownload": {
source: "apache",
extensions: ["exe", "dll", "com", "bat", "msi"]
},
"application/x-msmediaview": {
source: "apache",
extensions: ["mvb", "m13", "m14"]
},
"application/x-msmetafile": {
source: "apache",
extensions: ["wmf", "wmz", "emf", "emz"]
},
"application/x-msmoney": {
source: "apache",
extensions: ["mny"]
},
"application/x-mspublisher": {
source: "apache",
extensions: ["pub"]
},
"application/x-msschedule": {
source: "apache",
extensions: ["scd"]
},
"application/x-msterminal": {
source: "apache",
extensions: ["trm"]
},
"application/x-mswrite": {
source: "apache",
extensions: ["wri"]
},
"application/x-netcdf": {
source: "apache",
extensions: ["nc", "cdf"]
},
"application/x-ns-proxy-autoconfig": {
compressible: true,
extensions: ["pac"]
},
"application/x-nzb": {
source: "apache",
extensions: ["nzb"]
},
"application/x-perl": {
source: "nginx",
extensions: ["pl", "pm"]
},
"application/x-pilot": {
source: "nginx",
extensions: ["prc", "pdb"]
},
"application/x-pkcs12": {
source: "apache",
compressible: false,
extensions: ["p12", "pfx"]
},
"application/x-pkcs7-certificates": {
source: "apache",
extensions: ["p7b", "spc"]
},
"application/x-pkcs7-certreqresp": {
source: "apache",
extensions: ["p7r"]
},
"application/x-pki-message": {
source: "iana"
},
"application/x-rar-compressed": {
source: "apache",
compressible: false,
extensions: ["rar"]
},
"application/x-redhat-package-manager": {
source: "nginx",
extensions: ["rpm"]
},
"application/x-research-info-systems": {
source: "apache",
extensions: ["ris"]
},
"application/x-sea": {
source: "nginx",
extensions: ["sea"]
},
"application/x-sh": {
source: "apache",
compressible: true,
extensions: ["sh"]
},
"application/x-shar": {
source: "apache",
extensions: ["shar"]
},
"application/x-shockwave-flash": {
source: "apache",
compressible: false,
extensions: ["swf"]
},
"application/x-silverlight-app": {
source: "apache",
extensions: ["xap"]
},
"application/x-sql": {
source: "apache",
extensions: ["sql"]
},
"application/x-stuffit": {
source: "apache",
compressible: false,
extensions: ["sit"]
},
"application/x-stuffitx": {
source: "apache",
extensions: ["sitx"]
},
"application/x-subrip": {
source: "apache",
extensions: ["srt"]
},
"application/x-sv4cpio": {
source: "apache",
extensions: ["sv4cpio"]
},
"application/x-sv4crc": {
source: "apache",
extensions: ["sv4crc"]
},
"application/x-t3vm-image": {
source: "apache",
extensions: ["t3"]
},
"application/x-tads": {
source: "apache",
extensions: ["gam"]
},
"application/x-tar": {
source: "apache",
compressible: true,
extensions: ["tar"]
},
"application/x-tcl": {
source: "apache",
extensions: ["tcl", "tk"]
},
"application/x-tex": {
source: "apache",
extensions: ["tex"]
},
"application/x-tex-tfm": {
source: "apache",
extensions: ["tfm"]
},
"application/x-texinfo": {
source: "apache",
extensions: ["texinfo", "texi"]
},
"application/x-tgif": {
source: "apache",
extensions: ["obj"]
},
"application/x-ustar": {
source: "apache",
extensions: ["ustar"]
},
"application/x-virtualbox-hdd": {
compressible: true,
extensions: ["hdd"]
},
"application/x-virtualbox-ova": {
compressible: true,
extensions: ["ova"]
},
"application/x-virtualbox-ovf": {
compressible: true,
extensions: ["ovf"]
},
"application/x-virtualbox-vbox": {
compressible: true,
extensions: ["vbox"]
},
"application/x-virtualbox-vbox-extpack": {
compressible: false,
extensions: ["vbox-extpack"]
},
"application/x-virtualbox-vdi": {
compressible: true,
extensions: ["vdi"]
},
"application/x-virtualbox-vhd": {
compressible: true,
extensions: ["vhd"]
},
"application/x-virtualbox-vmdk": {
compressible: true,
extensions: ["vmdk"]
},
"application/x-wais-source": {
source: "apache",
extensions: ["src"]
},
"application/x-web-app-manifest+json": {
compressible: true,
extensions: ["webapp"]
},
"application/x-www-form-urlencoded": {
source: "iana",
compressible: true
},
"application/x-x509-ca-cert": {
source: "iana",
extensions: ["der", "crt", "pem"]
},
"application/x-x509-ca-ra-cert": {
source: "iana"
},
"application/x-x509-next-ca-cert": {
source: "iana"
},
"application/x-xfig": {
source: "apache",
extensions: ["fig"]
},
"application/x-xliff+xml": {
source: "apache",
compressible: true,
extensions: ["xlf"]
},
"application/x-xpinstall": {
source: "apache",
compressible: false,
extensions: ["xpi"]
},
"application/x-xz": {
source: "apache",
extensions: ["xz"]
},
"application/x-zmachine": {
source: "apache",
extensions: ["z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8"]
},
"application/x400-bp": {
source: "iana"
},
"application/xacml+xml": {
source: "iana",
compressible: true
},
"application/xaml+xml": {
source: "apache",
compressible: true,
extensions: ["xaml"]
},
"application/xcap-att+xml": {
source: "iana",
compressible: true,
extensions: ["xav"]
},
"application/xcap-caps+xml": {
source: "iana",
compressible: true,
extensions: ["xca"]
},
"application/xcap-diff+xml": {
source: "iana",
compressible: true,
extensions: ["xdf"]
},
"application/xcap-el+xml": {
source: "iana",
compressible: true,
extensions: ["xel"]
},
"application/xcap-error+xml": {
source: "iana",
compressible: true
},
"application/xcap-ns+xml": {
source: "iana",
compressible: true,
extensions: ["xns"]
},
"application/xcon-conference-info+xml": {
source: "iana",
compressible: true
},
"application/xcon-conference-info-diff+xml": {
source: "iana",
compressible: true
},
"application/xenc+xml": {
source: "iana",
compressible: true,
extensions: ["xenc"]
},
"application/xhtml+xml": {
source: "iana",
compressible: true,
extensions: ["xhtml", "xht"]
},
"application/xhtml-voice+xml": {
source: "apache",
compressible: true
},
"application/xliff+xml": {
source: "iana",
compressible: true,
extensions: ["xlf"]
},
"application/xml": {
source: "iana",
compressible: true,
extensions: ["xml", "xsl", "xsd", "rng"]
},
"application/xml-dtd": {
source: "iana",
compressible: true,
extensions: ["dtd"]
},
"application/xml-external-parsed-entity": {
source: "iana"
},
"application/xml-patch+xml": {
source: "iana",
compressible: true
},
"application/xmpp+xml": {
source: "iana",
compressible: true
},
"application/xop+xml": {
source: "iana",
compressible: true,
extensions: ["xop"]
},
"application/xproc+xml": {
source: "apache",
compressible: true,
extensions: ["xpl"]
},
"application/xslt+xml": {
source: "iana",
compressible: true,
extensions: ["xsl", "xslt"]
},
"application/xspf+xml": {
source: "apache",
compressible: true,
extensions: ["xspf"]
},
"application/xv+xml": {
source: "iana",
compressible: true,
extensions: ["mxml", "xhvml", "xvml", "xvm"]
},
"application/yang": {
source: "iana",
extensions: ["yang"]
},
"application/yang-data+json": {
source: "iana",
compressible: true
},
"application/yang-data+xml": {
source: "iana",
compressible: true
},
"application/yang-patch+json": {
source: "iana",
compressible: true
},
"application/yang-patch+xml": {
source: "iana",
compressible: true
},
"application/yin+xml": {
source: "iana",
compressible: true,
extensions: ["yin"]
},
"application/zip": {
source: "iana",
compressible: false,
extensions: ["zip"]
},
"application/zlib": {
source: "iana"
},
"application/zstd": {
source: "iana"
},
"audio/1d-interleaved-parityfec": {
source: "iana"
},
"audio/32kadpcm": {
source: "iana"
},
"audio/3gpp": {
source: "iana",
compressible: false,
extensions: ["3gpp"]
},
"audio/3gpp2": {
source: "iana"
},
"audio/aac": {
source: "iana"
},
"audio/ac3": {
source: "iana"
},
"audio/adpcm": {
source: "apache",
extensions: ["adp"]
},
"audio/amr": {
source: "iana",
extensions: ["amr"]
},
"audio/amr-wb": {
source: "iana"
},
"audio/amr-wb+": {
source: "iana"
},
"audio/aptx": {
source: "iana"
},
"audio/asc": {
source: "iana"
},
"audio/atrac-advanced-lossless": {
source: "iana"
},
"audio/atrac-x": {
source: "iana"
},
"audio/atrac3": {
source: "iana"
},
"audio/basic": {
source: "iana",
compressible: false,
extensions: ["au", "snd"]
},
"audio/bv16": {
source: "iana"
},
"audio/bv32": {
source: "iana"
},
"audio/clearmode": {
source: "iana"
},
"audio/cn": {
source: "iana"
},
"audio/dat12": {
source: "iana"
},
"audio/dls": {
source: "iana"
},
"audio/dsr-es201108": {
source: "iana"
},
"audio/dsr-es202050": {
source: "iana"
},
"audio/dsr-es202211": {
source: "iana"
},
"audio/dsr-es202212": {
source: "iana"
},
"audio/dv": {
source: "iana"
},
"audio/dvi4": {
source: "iana"
},
"audio/eac3": {
source: "iana"
},
"audio/encaprtp": {
source: "iana"
},
"audio/evrc": {
source: "iana"
},
"audio/evrc-qcp": {
source: "iana"
},
"audio/evrc0": {
source: "iana"
},
"audio/evrc1": {
source: "iana"
},
"audio/evrcb": {
source: "iana"
},
"audio/evrcb0": {
source: "iana"
},
"audio/evrcb1": {
source: "iana"
},
"audio/evrcnw": {
source: "iana"
},
"audio/evrcnw0": {
source: "iana"
},
"audio/evrcnw1": {
source: "iana"
},
"audio/evrcwb": {
source: "iana"
},
"audio/evrcwb0": {
source: "iana"
},
"audio/evrcwb1": {
source: "iana"
},
"audio/evs": {
source: "iana"
},
"audio/flexfec": {
source: "iana"
},
"audio/fwdred": {
source: "iana"
},
"audio/g711-0": {
source: "iana"
},
"audio/g719": {
source: "iana"
},
"audio/g722": {
source: "iana"
},
"audio/g7221": {
source: "iana"
},
"audio/g723": {
source: "iana"
},
"audio/g726-16": {
source: "iana"
},
"audio/g726-24": {
source: "iana"
},
"audio/g726-32": {
source: "iana"
},
"audio/g726-40": {
source: "iana"
},
"audio/g728": {
source: "iana"
},
"audio/g729": {
source: "iana"
},
"audio/g7291": {
source: "iana"
},
"audio/g729d": {
source: "iana"
},
"audio/g729e": {
source: "iana"
},
"audio/gsm": {
source: "iana"
},
"audio/gsm-efr": {
source: "iana"
},
"audio/gsm-hr-08": {
source: "iana"
},
"audio/ilbc": {
source: "iana"
},
"audio/ip-mr_v2.5": {
source: "iana"
},
"audio/isac": {
source: "apache"
},
"audio/l16": {
source: "iana"
},
"audio/l20": {
source: "iana"
},
"audio/l24": {
source: "iana",
compressible: false
},
"audio/l8": {
source: "iana"
},
"audio/lpc": {
source: "iana"
},
"audio/melp": {
source: "iana"
},
"audio/melp1200": {
source: "iana"
},
"audio/melp2400": {
source: "iana"
},
"audio/melp600": {
source: "iana"
},
"audio/mhas": {
source: "iana"
},
"audio/midi": {
source: "apache",
extensions: ["mid", "midi", "kar", "rmi"]
},
"audio/mobile-xmf": {
source: "iana",
extensions: ["mxmf"]
},
"audio/mp3": {
compressible: false,
extensions: ["mp3"]
},
"audio/mp4": {
source: "iana",
compressible: false,
extensions: ["m4a", "mp4a"]
},
"audio/mp4a-latm": {
source: "iana"
},
"audio/mpa": {
source: "iana"
},
"audio/mpa-robust": {
source: "iana"
},
"audio/mpeg": {
source: "iana",
compressible: false,
extensions: ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"]
},
"audio/mpeg4-generic": {
source: "iana"
},
"audio/musepack": {
source: "apache"
},
"audio/ogg": {
source: "iana",
compressible: false,
extensions: ["oga", "ogg", "spx", "opus"]
},
"audio/opus": {
source: "iana"
},
"audio/parityfec": {
source: "iana"
},
"audio/pcma": {
source: "iana"
},
"audio/pcma-wb": {
source: "iana"
},
"audio/pcmu": {
source: "iana"
},
"audio/pcmu-wb": {
source: "iana"
},
"audio/prs.sid": {
source: "iana"
},
"audio/qcelp": {
source: "iana"
},
"audio/raptorfec": {
source: "iana"
},
"audio/red": {
source: "iana"
},
"audio/rtp-enc-aescm128": {
source: "iana"
},
"audio/rtp-midi": {
source: "iana"
},
"audio/rtploopback": {
source: "iana"
},
"audio/rtx": {
source: "iana"
},
"audio/s3m": {
source: "apache",
extensions: ["s3m"]
},
"audio/scip": {
source: "iana"
},
"audio/silk": {
source: "apache",
extensions: ["sil"]
},
"audio/smv": {
source: "iana"
},
"audio/smv-qcp": {
source: "iana"
},
"audio/smv0": {
source: "iana"
},
"audio/sofa": {
source: "iana"
},
"audio/sp-midi": {
source: "iana"
},
"audio/speex": {
source: "iana"
},
"audio/t140c": {
source: "iana"
},
"audio/t38": {
source: "iana"
},
"audio/telephone-event": {
source: "iana"
},
"audio/tetra_acelp": {
source: "iana"
},
"audio/tetra_acelp_bb": {
source: "iana"
},
"audio/tone": {
source: "iana"
},
"audio/tsvcis": {
source: "iana"
},
"audio/uemclip": {
source: "iana"
},
"audio/ulpfec": {
source: "iana"
},
"audio/usac": {
source: "iana"
},
"audio/vdvi": {
source: "iana"
},
"audio/vmr-wb": {
source: "iana"
},
"audio/vnd.3gpp.iufp": {
source: "iana"
},
"audio/vnd.4sb": {
source: "iana"
},
"audio/vnd.audiokoz": {
source: "iana"
},
"audio/vnd.celp": {
source: "iana"
},
"audio/vnd.cisco.nse": {
source: "iana"
},
"audio/vnd.cmles.radio-events": {
source: "iana"
},
"audio/vnd.cns.anp1": {
source: "iana"
},
"audio/vnd.cns.inf1": {
source: "iana"
},
"audio/vnd.dece.audio": {
source: "iana",
extensions: ["uva", "uvva"]
},
"audio/vnd.digital-winds": {
source: "iana",
extensions: ["eol"]
},
"audio/vnd.dlna.adts": {
source: "iana"
},
"audio/vnd.dolby.heaac.1": {
source: "iana"
},
"audio/vnd.dolby.heaac.2": {
source: "iana"
},
"audio/vnd.dolby.mlp": {
source: "iana"
},
"audio/vnd.dolby.mps": {
source: "iana"
},
"audio/vnd.dolby.pl2": {
source: "iana"
},
"audio/vnd.dolby.pl2x": {
source: "iana"
},
"audio/vnd.dolby.pl2z": {
source: "iana"
},
"audio/vnd.dolby.pulse.1": {
source: "iana"
},
"audio/vnd.dra": {
source: "iana",
extensions: ["dra"]
},
"audio/vnd.dts": {
source: "iana",
extensions: ["dts"]
},
"audio/vnd.dts.hd": {
source: "iana",
extensions: ["dtshd"]
},
"audio/vnd.dts.uhd": {
source: "iana"
},
"audio/vnd.dvb.file": {
source: "iana"
},
"audio/vnd.everad.plj": {
source: "iana"
},
"audio/vnd.hns.audio": {
source: "iana"
},
"audio/vnd.lucent.voice": {
source: "iana",
extensions: ["lvp"]
},
"audio/vnd.ms-playready.media.pya": {
source: "iana",
extensions: ["pya"]
},
"audio/vnd.nokia.mobile-xmf": {
source: "iana"
},
"audio/vnd.nortel.vbk": {
source: "iana"
},
"audio/vnd.nuera.ecelp4800": {
source: "iana",
extensions: ["ecelp4800"]
},
"audio/vnd.nuera.ecelp7470": {
source: "iana",
extensions: ["ecelp7470"]
},
"audio/vnd.nuera.ecelp9600": {
source: "iana",
extensions: ["ecelp9600"]
},
"audio/vnd.octel.sbc": {
source: "iana"
},
"audio/vnd.presonus.multitrack": {
source: "iana"
},
"audio/vnd.qcelp": {
source: "iana"
},
"audio/vnd.rhetorex.32kadpcm": {
source: "iana"
},
"audio/vnd.rip": {
source: "iana",
extensions: ["rip"]
},
"audio/vnd.rn-realaudio": {
compressible: false
},
"audio/vnd.sealedmedia.softseal.mpeg": {
source: "iana"
},
"audio/vnd.vmx.cvsd": {
source: "iana"
},
"audio/vnd.wave": {
compressible: false
},
"audio/vorbis": {
source: "iana",
compressible: false
},
"audio/vorbis-config": {
source: "iana"
},
"audio/wav": {
compressible: false,
extensions: ["wav"]
},
"audio/wave": {
compressible: false,
extensions: ["wav"]
},
"audio/webm": {
source: "apache",
compressible: false,
extensions: ["weba"]
},
"audio/x-aac": {
source: "apache",
compressible: false,
extensions: ["aac"]
},
"audio/x-aiff": {
source: "apache",
extensions: ["aif", "aiff", "aifc"]
},
"audio/x-caf": {
source: "apache",
compressible: false,
extensions: ["caf"]
},
"audio/x-flac": {
source: "apache",
extensions: ["flac"]
},
"audio/x-m4a": {
source: "nginx",
extensions: ["m4a"]
},
"audio/x-matroska": {
source: "apache",
extensions: ["mka"]
},
"audio/x-mpegurl": {
source: "apache",
extensions: ["m3u"]
},
"audio/x-ms-wax": {
source: "apache",
extensions: ["wax"]
},
"audio/x-ms-wma": {
source: "apache",
extensions: ["wma"]
},
"audio/x-pn-realaudio": {
source: "apache",
extensions: ["ram", "ra"]
},
"audio/x-pn-realaudio-plugin": {
source: "apache",
extensions: ["rmp"]
},
"audio/x-realaudio": {
source: "nginx",
extensions: ["ra"]
},
"audio/x-tta": {
source: "apache"
},
"audio/x-wav": {
source: "apache",
extensions: ["wav"]
},
"audio/xm": {
source: "apache",
extensions: ["xm"]
},
"chemical/x-cdx": {
source: "apache",
extensions: ["cdx"]
},
"chemical/x-cif": {
source: "apache",
extensions: ["cif"]
},
"chemical/x-cmdf": {
source: "apache",
extensions: ["cmdf"]
},
"chemical/x-cml": {
source: "apache",
extensions: ["cml"]
},
"chemical/x-csml": {
source: "apache",
extensions: ["csml"]
},
"chemical/x-pdb": {
source: "apache"
},
"chemical/x-xyz": {
source: "apache",
extensions: ["xyz"]
},
"font/collection": {
source: "iana",
extensions: ["ttc"]
},
"font/otf": {
source: "iana",
compressible: true,
extensions: ["otf"]
},
"font/sfnt": {
source: "iana"
},
"font/ttf": {
source: "iana",
compressible: true,
extensions: ["ttf"]
},
"font/woff": {
source: "iana",
extensions: ["woff"]
},
"font/woff2": {
source: "iana",
extensions: ["woff2"]
},
"image/aces": {
source: "iana",
extensions: ["exr"]
},
"image/apng": {
compressible: false,
extensions: ["apng"]
},
"image/avci": {
source: "iana",
extensions: ["avci"]
},
"image/avcs": {
source: "iana",
extensions: ["avcs"]
},
"image/avif": {
source: "iana",
compressible: false,
extensions: ["avif"]
},
"image/bmp": {
source: "iana",
compressible: true,
extensions: ["bmp"]
},
"image/cgm": {
source: "iana",
extensions: ["cgm"]
},
"image/dicom-rle": {
source: "iana",
extensions: ["drle"]
},
"image/emf": {
source: "iana",
extensions: ["emf"]
},
"image/fits": {
source: "iana",
extensions: ["fits"]
},
"image/g3fax": {
source: "iana",
extensions: ["g3"]
},
"image/gif": {
source: "iana",
compressible: false,
extensions: ["gif"]
},
"image/heic": {
source: "iana",
extensions: ["heic"]
},
"image/heic-sequence": {
source: "iana",
extensions: ["heics"]
},
"image/heif": {
source: "iana",
extensions: ["heif"]
},
"image/heif-sequence": {
source: "iana",
extensions: ["heifs"]
},
"image/hej2k": {
source: "iana",
extensions: ["hej2"]
},
"image/hsj2": {
source: "iana",
extensions: ["hsj2"]
},
"image/ief": {
source: "iana",
extensions: ["ief"]
},
"image/jls": {
source: "iana",
extensions: ["jls"]
},
"image/jp2": {
source: "iana",
compressible: false,
extensions: ["jp2", "jpg2"]
},
"image/jpeg": {
source: "iana",
compressible: false,
extensions: ["jpeg", "jpg", "jpe"]
},
"image/jph": {
source: "iana",
extensions: ["jph"]
},
"image/jphc": {
source: "iana",
extensions: ["jhc"]
},
"image/jpm": {
source: "iana",
compressible: false,
extensions: ["jpm"]
},
"image/jpx": {
source: "iana",
compressible: false,
extensions: ["jpx", "jpf"]
},
"image/jxr": {
source: "iana",
extensions: ["jxr"]
},
"image/jxra": {
source: "iana",
extensions: ["jxra"]
},
"image/jxrs": {
source: "iana",
extensions: ["jxrs"]
},
"image/jxs": {
source: "iana",
extensions: ["jxs"]
},
"image/jxsc": {
source: "iana",
extensions: ["jxsc"]
},
"image/jxsi": {
source: "iana",
extensions: ["jxsi"]
},
"image/jxss": {
source: "iana",
extensions: ["jxss"]
},
"image/ktx": {
source: "iana",
extensions: ["ktx"]
},
"image/ktx2": {
source: "iana",
extensions: ["ktx2"]
},
"image/naplps": {
source: "iana"
},
"image/pjpeg": {
compressible: false
},
"image/png": {
source: "iana",
compressible: false,
extensions: ["png"]
},
"image/prs.btif": {
source: "iana",
extensions: ["btif"]
},
"image/prs.pti": {
source: "iana",
extensions: ["pti"]
},
"image/pwg-raster": {
source: "iana"
},
"image/sgi": {
source: "apache",
extensions: ["sgi"]
},
"image/svg+xml": {
source: "iana",
compressible: true,
extensions: ["svg", "svgz"]
},
"image/t38": {
source: "iana",
extensions: ["t38"]
},
"image/tiff": {
source: "iana",
compressible: false,
extensions: ["tif", "tiff"]
},
"image/tiff-fx": {
source: "iana",
extensions: ["tfx"]
},
"image/vnd.adobe.photoshop": {
source: "iana",
compressible: true,
extensions: ["psd"]
},
"image/vnd.airzip.accelerator.azv": {
source: "iana",
extensions: ["azv"]
},
"image/vnd.cns.inf2": {
source: "iana"
},
"image/vnd.dece.graphic": {
source: "iana",
extensions: ["uvi", "uvvi", "uvg", "uvvg"]
},
"image/vnd.djvu": {
source: "iana",
extensions: ["djvu", "djv"]
},
"image/vnd.dvb.subtitle": {
source: "iana",
extensions: ["sub"]
},
"image/vnd.dwg": {
source: "iana",
extensions: ["dwg"]
},
"image/vnd.dxf": {
source: "iana",
extensions: ["dxf"]
},
"image/vnd.fastbidsheet": {
source: "iana",
extensions: ["fbs"]
},
"image/vnd.fpx": {
source: "iana",
extensions: ["fpx"]
},
"image/vnd.fst": {
source: "iana",
extensions: ["fst"]
},
"image/vnd.fujixerox.edmics-mmr": {
source: "iana",
extensions: ["mmr"]
},
"image/vnd.fujixerox.edmics-rlc": {
source: "iana",
extensions: ["rlc"]
},
"image/vnd.globalgraphics.pgb": {
source: "iana"
},
"image/vnd.microsoft.icon": {
source: "iana",
compressible: true,
extensions: ["ico"]
},
"image/vnd.mix": {
source: "iana"
},
"image/vnd.mozilla.apng": {
source: "iana"
},
"image/vnd.ms-dds": {
compressible: true,
extensions: ["dds"]
},
"image/vnd.ms-modi": {
source: "iana",
extensions: ["mdi"]
},
"image/vnd.ms-photo": {
source: "apache",
extensions: ["wdp"]
},
"image/vnd.net-fpx": {
source: "iana",
extensions: ["npx"]
},
"image/vnd.pco.b16": {
source: "iana",
extensions: ["b16"]
},
"image/vnd.radiance": {
source: "iana"
},
"image/vnd.sealed.png": {
source: "iana"
},
"image/vnd.sealedmedia.softseal.gif": {
source: "iana"
},
"image/vnd.sealedmedia.softseal.jpg": {
source: "iana"
},
"image/vnd.svf": {
source: "iana"
},
"image/vnd.tencent.tap": {
source: "iana",
extensions: ["tap"]
},
"image/vnd.valve.source.texture": {
source: "iana",
extensions: ["vtf"]
},
"image/vnd.wap.wbmp": {
source: "iana",
extensions: ["wbmp"]
},
"image/vnd.xiff": {
source: "iana",
extensions: ["xif"]
},
"image/vnd.zbrush.pcx": {
source: "iana",
extensions: ["pcx"]
},
"image/webp": {
source: "apache",
extensions: ["webp"]
},
"image/wmf": {
source: "iana",
extensions: ["wmf"]
},
"image/x-3ds": {
source: "apache",
extensions: ["3ds"]
},
"image/x-cmu-raster": {
source: "apache",
extensions: ["ras"]
},
"image/x-cmx": {
source: "apache",
extensions: ["cmx"]
},
"image/x-freehand": {
source: "apache",
extensions: ["fh", "fhc", "fh4", "fh5", "fh7"]
},
"image/x-icon": {
source: "apache",
compressible: true,
extensions: ["ico"]
},
"image/x-jng": {
source: "nginx",
extensions: ["jng"]
},
"image/x-mrsid-image": {
source: "apache",
extensions: ["sid"]
},
"image/x-ms-bmp": {
source: "nginx",
compressible: true,
extensions: ["bmp"]
},
"image/x-pcx": {
source: "apache",
extensions: ["pcx"]
},
"image/x-pict": {
source: "apache",
extensions: ["pic", "pct"]
},
"image/x-portable-anymap": {
source: "apache",
extensions: ["pnm"]
},
"image/x-portable-bitmap": {
source: "apache",
extensions: ["pbm"]
},
"image/x-portable-graymap": {
source: "apache",
extensions: ["pgm"]
},
"image/x-portable-pixmap": {
source: "apache",
extensions: ["ppm"]
},
"image/x-rgb": {
source: "apache",
extensions: ["rgb"]
},
"image/x-tga": {
source: "apache",
extensions: ["tga"]
},
"image/x-xbitmap": {
source: "apache",
extensions: ["xbm"]
},
"image/x-xcf": {
compressible: false
},
"image/x-xpixmap": {
source: "apache",
extensions: ["xpm"]
},
"image/x-xwindowdump": {
source: "apache",
extensions: ["xwd"]
},
"message/cpim": {
source: "iana"
},
"message/delivery-status": {
source: "iana"
},
"message/disposition-notification": {
source: "iana",
extensions: [
"disposition-notification"
]
},
"message/external-body": {
source: "iana"
},
"message/feedback-report": {
source: "iana"
},
"message/global": {
source: "iana",
extensions: ["u8msg"]
},
"message/global-delivery-status": {
source: "iana",
extensions: ["u8dsn"]
},
"message/global-disposition-notification": {
source: "iana",
extensions: ["u8mdn"]
},
"message/global-headers": {
source: "iana",
extensions: ["u8hdr"]
},
"message/http": {
source: "iana",
compressible: false
},
"message/imdn+xml": {
source: "iana",
compressible: true
},
"message/news": {
source: "iana"
},
"message/partial": {
source: "iana",
compressible: false
},
"message/rfc822": {
source: "iana",
compressible: true,
extensions: ["eml", "mime"]
},
"message/s-http": {
source: "iana"
},
"message/sip": {
source: "iana"
},
"message/sipfrag": {
source: "iana"
},
"message/tracking-status": {
source: "iana"
},
"message/vnd.si.simp": {
source: "iana"
},
"message/vnd.wfa.wsc": {
source: "iana",
extensions: ["wsc"]
},
"model/3mf": {
source: "iana",
extensions: ["3mf"]
},
"model/e57": {
source: "iana"
},
"model/gltf+json": {
source: "iana",
compressible: true,
extensions: ["gltf"]
},
"model/gltf-binary": {
source: "iana",
compressible: true,
extensions: ["glb"]
},
"model/iges": {
source: "iana",
compressible: false,
extensions: ["igs", "iges"]
},
"model/mesh": {
source: "iana",
compressible: false,
extensions: ["msh", "mesh", "silo"]
},
"model/mtl": {
source: "iana",
extensions: ["mtl"]
},
"model/obj": {
source: "iana",
extensions: ["obj"]
},
"model/step": {
source: "iana"
},
"model/step+xml": {
source: "iana",
compressible: true,
extensions: ["stpx"]
},
"model/step+zip": {
source: "iana",
compressible: false,
extensions: ["stpz"]
},
"model/step-xml+zip": {
source: "iana",
compressible: false,
extensions: ["stpxz"]
},
"model/stl": {
source: "iana",
extensions: ["stl"]
},
"model/vnd.collada+xml": {
source: "iana",
compressible: true,
extensions: ["dae"]
},
"model/vnd.dwf": {
source: "iana",
extensions: ["dwf"]
},
"model/vnd.flatland.3dml": {
source: "iana"
},
"model/vnd.gdl": {
source: "iana",
extensions: ["gdl"]
},
"model/vnd.gs-gdl": {
source: "apache"
},
"model/vnd.gs.gdl": {
source: "iana"
},
"model/vnd.gtw": {
source: "iana",
extensions: ["gtw"]
},
"model/vnd.moml+xml": {
source: "iana",
compressible: true
},
"model/vnd.mts": {
source: "iana",
extensions: ["mts"]
},
"model/vnd.opengex": {
source: "iana",
extensions: ["ogex"]
},
"model/vnd.parasolid.transmit.binary": {
source: "iana",
extensions: ["x_b"]
},
"model/vnd.parasolid.transmit.text": {
source: "iana",
extensions: ["x_t"]
},
"model/vnd.pytha.pyox": {
source: "iana"
},
"model/vnd.rosette.annotated-data-model": {
source: "iana"
},
"model/vnd.sap.vds": {
source: "iana",
extensions: ["vds"]
},
"model/vnd.usdz+zip": {
source: "iana",
compressible: false,
extensions: ["usdz"]
},
"model/vnd.valve.source.compiled-map": {
source: "iana",
extensions: ["bsp"]
},
"model/vnd.vtu": {
source: "iana",
extensions: ["vtu"]
},
"model/vrml": {
source: "iana",
compressible: false,
extensions: ["wrl", "vrml"]
},
"model/x3d+binary": {
source: "apache",
compressible: false,
extensions: ["x3db", "x3dbz"]
},
"model/x3d+fastinfoset": {
source: "iana",
extensions: ["x3db"]
},
"model/x3d+vrml": {
source: "apache",
compressible: false,
extensions: ["x3dv", "x3dvz"]
},
"model/x3d+xml": {
source: "iana",
compressible: true,
extensions: ["x3d", "x3dz"]
},
"model/x3d-vrml": {
source: "iana",
extensions: ["x3dv"]
},
"multipart/alternative": {
source: "iana",
compressible: false
},
"multipart/appledouble": {
source: "iana"
},
"multipart/byteranges": {
source: "iana"
},
"multipart/digest": {
source: "iana"
},
"multipart/encrypted": {
source: "iana",
compressible: false
},
"multipart/form-data": {
source: "iana",
compressible: false
},
"multipart/header-set": {
source: "iana"
},
"multipart/mixed": {
source: "iana"
},
"multipart/multilingual": {
source: "iana"
},
"multipart/parallel": {
source: "iana"
},
"multipart/related": {
source: "iana",
compressible: false
},
"multipart/report": {
source: "iana"
},
"multipart/signed": {
source: "iana",
compressible: false
},
"multipart/vnd.bint.med-plus": {
source: "iana"
},
"multipart/voice-message": {
source: "iana"
},
"multipart/x-mixed-replace": {
source: "iana"
},
"text/1d-interleaved-parityfec": {
source: "iana"
},
"text/cache-manifest": {
source: "iana",
compressible: true,
extensions: ["appcache", "manifest"]
},
"text/calendar": {
source: "iana",
extensions: ["ics", "ifb"]
},
"text/calender": {
compressible: true
},
"text/cmd": {
compressible: true
},
"text/coffeescript": {
extensions: ["coffee", "litcoffee"]
},
"text/cql": {
source: "iana"
},
"text/cql-expression": {
source: "iana"
},
"text/cql-identifier": {
source: "iana"
},
"text/css": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["css"]
},
"text/csv": {
source: "iana",
compressible: true,
extensions: ["csv"]
},
"text/csv-schema": {
source: "iana"
},
"text/directory": {
source: "iana"
},
"text/dns": {
source: "iana"
},
"text/ecmascript": {
source: "iana"
},
"text/encaprtp": {
source: "iana"
},
"text/enriched": {
source: "iana"
},
"text/fhirpath": {
source: "iana"
},
"text/flexfec": {
source: "iana"
},
"text/fwdred": {
source: "iana"
},
"text/gff3": {
source: "iana"
},
"text/grammar-ref-list": {
source: "iana"
},
"text/html": {
source: "iana",
compressible: true,
extensions: ["html", "htm", "shtml"]
},
"text/jade": {
extensions: ["jade"]
},
"text/javascript": {
source: "iana",
compressible: true
},
"text/jcr-cnd": {
source: "iana"
},
"text/jsx": {
compressible: true,
extensions: ["jsx"]
},
"text/less": {
compressible: true,
extensions: ["less"]
},
"text/markdown": {
source: "iana",
compressible: true,
extensions: ["markdown", "md"]
},
"text/mathml": {
source: "nginx",
extensions: ["mml"]
},
"text/mdx": {
compressible: true,
extensions: ["mdx"]
},
"text/mizar": {
source: "iana"
},
"text/n3": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["n3"]
},
"text/parameters": {
source: "iana",
charset: "UTF-8"
},
"text/parityfec": {
source: "iana"
},
"text/plain": {
source: "iana",
compressible: true,
extensions: ["txt", "text", "conf", "def", "list", "log", "in", "ini"]
},
"text/provenance-notation": {
source: "iana",
charset: "UTF-8"
},
"text/prs.fallenstein.rst": {
source: "iana"
},
"text/prs.lines.tag": {
source: "iana",
extensions: ["dsc"]
},
"text/prs.prop.logic": {
source: "iana"
},
"text/raptorfec": {
source: "iana"
},
"text/red": {
source: "iana"
},
"text/rfc822-headers": {
source: "iana"
},
"text/richtext": {
source: "iana",
compressible: true,
extensions: ["rtx"]
},
"text/rtf": {
source: "iana",
compressible: true,
extensions: ["rtf"]
},
"text/rtp-enc-aescm128": {
source: "iana"
},
"text/rtploopback": {
source: "iana"
},
"text/rtx": {
source: "iana"
},
"text/sgml": {
source: "iana",
extensions: ["sgml", "sgm"]
},
"text/shaclc": {
source: "iana"
},
"text/shex": {
source: "iana",
extensions: ["shex"]
},
"text/slim": {
extensions: ["slim", "slm"]
},
"text/spdx": {
source: "iana",
extensions: ["spdx"]
},
"text/strings": {
source: "iana"
},
"text/stylus": {
extensions: ["stylus", "styl"]
},
"text/t140": {
source: "iana"
},
"text/tab-separated-values": {
source: "iana",
compressible: true,
extensions: ["tsv"]
},
"text/troff": {
source: "iana",
extensions: ["t", "tr", "roff", "man", "me", "ms"]
},
"text/turtle": {
source: "iana",
charset: "UTF-8",
extensions: ["ttl"]
},
"text/ulpfec": {
source: "iana"
},
"text/uri-list": {
source: "iana",
compressible: true,
extensions: ["uri", "uris", "urls"]
},
"text/vcard": {
source: "iana",
compressible: true,
extensions: ["vcard"]
},
"text/vnd.a": {
source: "iana"
},
"text/vnd.abc": {
source: "iana"
},
"text/vnd.ascii-art": {
source: "iana"
},
"text/vnd.curl": {
source: "iana",
extensions: ["curl"]
},
"text/vnd.curl.dcurl": {
source: "apache",
extensions: ["dcurl"]
},
"text/vnd.curl.mcurl": {
source: "apache",
extensions: ["mcurl"]
},
"text/vnd.curl.scurl": {
source: "apache",
extensions: ["scurl"]
},
"text/vnd.debian.copyright": {
source: "iana",
charset: "UTF-8"
},
"text/vnd.dmclientscript": {
source: "iana"
},
"text/vnd.dvb.subtitle": {
source: "iana",
extensions: ["sub"]
},
"text/vnd.esmertec.theme-descriptor": {
source: "iana",
charset: "UTF-8"
},
"text/vnd.familysearch.gedcom": {
source: "iana",
extensions: ["ged"]
},
"text/vnd.ficlab.flt": {
source: "iana"
},
"text/vnd.fly": {
source: "iana",
extensions: ["fly"]
},
"text/vnd.fmi.flexstor": {
source: "iana",
extensions: ["flx"]
},
"text/vnd.gml": {
source: "iana"
},
"text/vnd.graphviz": {
source: "iana",
extensions: ["gv"]
},
"text/vnd.hans": {
source: "iana"
},
"text/vnd.hgl": {
source: "iana"
},
"text/vnd.in3d.3dml": {
source: "iana",
extensions: ["3dml"]
},
"text/vnd.in3d.spot": {
source: "iana",
extensions: ["spot"]
},
"text/vnd.iptc.newsml": {
source: "iana"
},
"text/vnd.iptc.nitf": {
source: "iana"
},
"text/vnd.latex-z": {
source: "iana"
},
"text/vnd.motorola.reflex": {
source: "iana"
},
"text/vnd.ms-mediapackage": {
source: "iana"
},
"text/vnd.net2phone.commcenter.command": {
source: "iana"
},
"text/vnd.radisys.msml-basic-layout": {
source: "iana"
},
"text/vnd.senx.warpscript": {
source: "iana"
},
"text/vnd.si.uricatalogue": {
source: "iana"
},
"text/vnd.sosi": {
source: "iana"
},
"text/vnd.sun.j2me.app-descriptor": {
source: "iana",
charset: "UTF-8",
extensions: ["jad"]
},
"text/vnd.trolltech.linguist": {
source: "iana",
charset: "UTF-8"
},
"text/vnd.wap.si": {
source: "iana"
},
"text/vnd.wap.sl": {
source: "iana"
},
"text/vnd.wap.wml": {
source: "iana",
extensions: ["wml"]
},
"text/vnd.wap.wmlscript": {
source: "iana",
extensions: ["wmls"]
},
"text/vtt": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["vtt"]
},
"text/x-asm": {
source: "apache",
extensions: ["s", "asm"]
},
"text/x-c": {
source: "apache",
extensions: ["c", "cc", "cxx", "cpp", "h", "hh", "dic"]
},
"text/x-component": {
source: "nginx",
extensions: ["htc"]
},
"text/x-fortran": {
source: "apache",
extensions: ["f", "for", "f77", "f90"]
},
"text/x-gwt-rpc": {
compressible: true
},
"text/x-handlebars-template": {
extensions: ["hbs"]
},
"text/x-java-source": {
source: "apache",
extensions: ["java"]
},
"text/x-jquery-tmpl": {
compressible: true
},
"text/x-lua": {
extensions: ["lua"]
},
"text/x-markdown": {
compressible: true,
extensions: ["mkd"]
},
"text/x-nfo": {
source: "apache",
extensions: ["nfo"]
},
"text/x-opml": {
source: "apache",
extensions: ["opml"]
},
"text/x-org": {
compressible: true,
extensions: ["org"]
},
"text/x-pascal": {
source: "apache",
extensions: ["p", "pas"]
},
"text/x-processing": {
compressible: true,
extensions: ["pde"]
},
"text/x-sass": {
extensions: ["sass"]
},
"text/x-scss": {
extensions: ["scss"]
},
"text/x-setext": {
source: "apache",
extensions: ["etx"]
},
"text/x-sfv": {
source: "apache",
extensions: ["sfv"]
},
"text/x-suse-ymp": {
compressible: true,
extensions: ["ymp"]
},
"text/x-uuencode": {
source: "apache",
extensions: ["uu"]
},
"text/x-vcalendar": {
source: "apache",
extensions: ["vcs"]
},
"text/x-vcard": {
source: "apache",
extensions: ["vcf"]
},
"text/xml": {
source: "iana",
compressible: true,
extensions: ["xml"]
},
"text/xml-external-parsed-entity": {
source: "iana"
},
"text/yaml": {
compressible: true,
extensions: ["yaml", "yml"]
},
"video/1d-interleaved-parityfec": {
source: "iana"
},
"video/3gpp": {
source: "iana",
extensions: ["3gp", "3gpp"]
},
"video/3gpp-tt": {
source: "iana"
},
"video/3gpp2": {
source: "iana",
extensions: ["3g2"]
},
"video/av1": {
source: "iana"
},
"video/bmpeg": {
source: "iana"
},
"video/bt656": {
source: "iana"
},
"video/celb": {
source: "iana"
},
"video/dv": {
source: "iana"
},
"video/encaprtp": {
source: "iana"
},
"video/ffv1": {
source: "iana"
},
"video/flexfec": {
source: "iana"
},
"video/h261": {
source: "iana",
extensions: ["h261"]
},
"video/h263": {
source: "iana",
extensions: ["h263"]
},
"video/h263-1998": {
source: "iana"
},
"video/h263-2000": {
source: "iana"
},
"video/h264": {
source: "iana",
extensions: ["h264"]
},
"video/h264-rcdo": {
source: "iana"
},
"video/h264-svc": {
source: "iana"
},
"video/h265": {
source: "iana"
},
"video/iso.segment": {
source: "iana",
extensions: ["m4s"]
},
"video/jpeg": {
source: "iana",
extensions: ["jpgv"]
},
"video/jpeg2000": {
source: "iana"
},
"video/jpm": {
source: "apache",
extensions: ["jpm", "jpgm"]
},
"video/jxsv": {
source: "iana"
},
"video/mj2": {
source: "iana",
extensions: ["mj2", "mjp2"]
},
"video/mp1s": {
source: "iana"
},
"video/mp2p": {
source: "iana"
},
"video/mp2t": {
source: "iana",
extensions: ["ts"]
},
"video/mp4": {
source: "iana",
compressible: false,
extensions: ["mp4", "mp4v", "mpg4"]
},
"video/mp4v-es": {
source: "iana"
},
"video/mpeg": {
source: "iana",
compressible: false,
extensions: ["mpeg", "mpg", "mpe", "m1v", "m2v"]
},
"video/mpeg4-generic": {
source: "iana"
},
"video/mpv": {
source: "iana"
},
"video/nv": {
source: "iana"
},
"video/ogg": {
source: "iana",
compressible: false,
extensions: ["ogv"]
},
"video/parityfec": {
source: "iana"
},
"video/pointer": {
source: "iana"
},
"video/quicktime": {
source: "iana",
compressible: false,
extensions: ["qt", "mov"]
},
"video/raptorfec": {
source: "iana"
},
"video/raw": {
source: "iana"
},
"video/rtp-enc-aescm128": {
source: "iana"
},
"video/rtploopback": {
source: "iana"
},
"video/rtx": {
source: "iana"
},
"video/scip": {
source: "iana"
},
"video/smpte291": {
source: "iana"
},
"video/smpte292m": {
source: "iana"
},
"video/ulpfec": {
source: "iana"
},
"video/vc1": {
source: "iana"
},
"video/vc2": {
source: "iana"
},
"video/vnd.cctv": {
source: "iana"
},
"video/vnd.dece.hd": {
source: "iana",
extensions: ["uvh", "uvvh"]
},
"video/vnd.dece.mobile": {
source: "iana",
extensions: ["uvm", "uvvm"]
},
"video/vnd.dece.mp4": {
source: "iana"
},
"video/vnd.dece.pd": {
source: "iana",
extensions: ["uvp", "uvvp"]
},
"video/vnd.dece.sd": {
source: "iana",
extensions: ["uvs", "uvvs"]
},
"video/vnd.dece.video": {
source: "iana",
extensions: ["uvv", "uvvv"]
},
"video/vnd.directv.mpeg": {
source: "iana"
},
"video/vnd.directv.mpeg-tts": {
source: "iana"
},
"video/vnd.dlna.mpeg-tts": {
source: "iana"
},
"video/vnd.dvb.file": {
source: "iana",
extensions: ["dvb"]
},
"video/vnd.fvt": {
source: "iana",
extensions: ["fvt"]
},
"video/vnd.hns.video": {
source: "iana"
},
"video/vnd.iptvforum.1dparityfec-1010": {
source: "iana"
},
"video/vnd.iptvforum.1dparityfec-2005": {
source: "iana"
},
"video/vnd.iptvforum.2dparityfec-1010": {
source: "iana"
},
"video/vnd.iptvforum.2dparityfec-2005": {
source: "iana"
},
"video/vnd.iptvforum.ttsavc": {
source: "iana"
},
"video/vnd.iptvforum.ttsmpeg2": {
source: "iana"
},
"video/vnd.motorola.video": {
source: "iana"
},
"video/vnd.motorola.videop": {
source: "iana"
},
"video/vnd.mpegurl": {
source: "iana",
extensions: ["mxu", "m4u"]
},
"video/vnd.ms-playready.media.pyv": {
source: "iana",
extensions: ["pyv"]
},
"video/vnd.nokia.interleaved-multimedia": {
source: "iana"
},
"video/vnd.nokia.mp4vr": {
source: "iana"
},
"video/vnd.nokia.videovoip": {
source: "iana"
},
"video/vnd.objectvideo": {
source: "iana"
},
"video/vnd.radgamettools.bink": {
source: "iana"
},
"video/vnd.radgamettools.smacker": {
source: "iana"
},
"video/vnd.sealed.mpeg1": {
source: "iana"
},
"video/vnd.sealed.mpeg4": {
source: "iana"
},
"video/vnd.sealed.swf": {
source: "iana"
},
"video/vnd.sealedmedia.softseal.mov": {
source: "iana"
},
"video/vnd.uvvu.mp4": {
source: "iana",
extensions: ["uvu", "uvvu"]
},
"video/vnd.vivo": {
source: "iana",
extensions: ["viv"]
},
"video/vnd.youtube.yt": {
source: "iana"
},
"video/vp8": {
source: "iana"
},
"video/vp9": {
source: "iana"
},
"video/webm": {
source: "apache",
compressible: false,
extensions: ["webm"]
},
"video/x-f4v": {
source: "apache",
extensions: ["f4v"]
},
"video/x-fli": {
source: "apache",
extensions: ["fli"]
},
"video/x-flv": {
source: "apache",
compressible: false,
extensions: ["flv"]
},
"video/x-m4v": {
source: "apache",
extensions: ["m4v"]
},
"video/x-matroska": {
source: "apache",
compressible: false,
extensions: ["mkv", "mk3d", "mks"]
},
"video/x-mng": {
source: "apache",
extensions: ["mng"]
},
"video/x-ms-asf": {
source: "apache",
extensions: ["asf", "asx"]
},
"video/x-ms-vob": {
source: "apache",
extensions: ["vob"]
},
"video/x-ms-wm": {
source: "apache",
extensions: ["wm"]
},
"video/x-ms-wmv": {
source: "apache",
compressible: false,
extensions: ["wmv"]
},
"video/x-ms-wmx": {
source: "apache",
extensions: ["wmx"]
},
"video/x-ms-wvx": {
source: "apache",
extensions: ["wvx"]
},
"video/x-msvideo": {
source: "apache",
extensions: ["avi"]
},
"video/x-sgi-movie": {
source: "apache",
extensions: ["movie"]
},
"video/x-smv": {
source: "apache",
extensions: ["smv"]
},
"x-conference/x-cooltalk": {
source: "apache",
extensions: ["ice"]
},
"x-shader/x-fragment": {
compressible: true
},
"x-shader/x-vertex": {
compressible: true
}
};
});
// node_modules/mime-db/index.js
var require_mime_db = __commonJS((exports, module) => {
/*!
* mime-db
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015-2022 Douglas Christopher Wilson
* MIT Licensed
*/
module.exports = require_db();
});
// node_modules/eventemitter3/index.js
var require_eventemitter3 = __commonJS((exports, module) => {
var has = Object.prototype.hasOwnProperty;
var prefix = "~";
function Events() {}
if (Object.create) {
Events.prototype = Object.create(null);
if (!new Events().__proto__)
prefix = false;
}
function EE(fn, context, once2) {
this.fn = fn;
this.context = context;
this.once = once2 || false;
}
function addListener(emitter, event, fn, context, once2) {
if (typeof fn !== "function") {
throw new TypeError("The listener must be a function");
}
var listener = new EE(fn, context || emitter, once2), evt = prefix ? prefix + event : event;
if (!emitter._events[evt])
emitter._events[evt] = listener, emitter._eventsCount++;
else if (!emitter._events[evt].fn)
emitter._events[evt].push(listener);
else
emitter._events[evt] = [emitter._events[evt], listener];
return emitter;
}
function clearEvent(emitter, evt) {
if (--emitter._eventsCount === 0)
emitter._events = new Events;
else
delete emitter._events[evt];
}
function EventEmitter() {
this._events = new Events;
this._eventsCount = 0;
}
EventEmitter.prototype.eventNames = function eventNames() {
var names = [], events, name;
if (this._eventsCount === 0)
return names;
for (name in events = this._events) {
if (has.call(events, name))
names.push(prefix ? name.slice(1) : name);
}
if (Object.getOwnPropertySymbols) {
return names.concat(Object.getOwnPropertySymbols(events));
}
return names;
};
EventEmitter.prototype.listeners = function listeners(event) {
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
if (!handlers)
return [];
if (handlers.fn)
return [handlers.fn];
for (var i = 0, l = handlers.length, ee = new Array(l);i < l; i++) {
ee[i] = handlers[i].fn;
}
return ee;
};
EventEmitter.prototype.listenerCount = function listenerCount(event) {
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
if (!listeners)
return 0;
if (listeners.fn)
return 1;
return listeners.length;
};
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
var evt = prefix ? prefix + event : event;
if (!this._events[evt])
return false;
var listeners = this._events[evt], len = arguments.length, args, i;
if (listeners.fn) {
if (listeners.once)
this.removeListener(event, listeners.fn, undefined, true);
switch (len) {
case 1:
return listeners.fn.call(listeners.context), true;
case 2:
return listeners.fn.call(listeners.context, a1), true;
case 3:
return listeners.fn.call(listeners.context, a1, a2), true;
case 4:
return listeners.fn.call(listeners.context, a1, a2, a3), true;
case 5:
return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
case 6:
return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
}
for (i = 1, args = new Array(len - 1);i < len; i++) {
args[i - 1] = arguments[i];
}
listeners.fn.apply(listeners.context, args);
} else {
var length = listeners.length, j;
for (i = 0;i < length; i++) {
if (listeners[i].once)
this.removeListener(event, listeners[i].fn, undefined, true);
switch (len) {
case 1:
listeners[i].fn.call(listeners[i].context);
break;
case 2:
listeners[i].fn.call(listeners[i].context, a1);
break;
case 3:
listeners[i].fn.call(listeners[i].context, a1, a2);
break;
case 4:
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
break;
default:
if (!args)
for (j = 1, args = new Array(len - 1);j < len; j++) {
args[j - 1] = arguments[j];
}
listeners[i].fn.apply(listeners[i].context, args);
}
}
}
return true;
};
EventEmitter.prototype.on = function on(event, fn, context) {
return addListener(this, event, fn, context, false);
};
EventEmitter.prototype.once = function once(event, fn, context) {
return addListener(this, event, fn, context, true);
};
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once2) {
var evt = prefix ? prefix + event : event;
if (!this._events[evt])
return this;
if (!fn) {
clearEvent(this, evt);
return this;
}
var listeners = this._events[evt];
if (listeners.fn) {
if (listeners.fn === fn && (!once2 || listeners.once) && (!context || listeners.context === context)) {
clearEvent(this, evt);
}
} else {
for (var i = 0, events = [], length = listeners.length;i < length; i++) {
if (listeners[i].fn !== fn || once2 && !listeners[i].once || context && listeners[i].context !== context) {
events.push(listeners[i]);
}
}
if (events.length)
this._events[evt] = events.length === 1 ? events[0] : events;
else
clearEvent(this, evt);
}
return this;
};
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
var evt;
if (event) {
evt = prefix ? prefix + event : event;
if (this._events[evt])
clearEvent(this, evt);
} else {
this._events = new Events;
this._eventsCount = 0;
}
return this;
};
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
EventEmitter.prefixed = prefix;
EventEmitter.EventEmitter = EventEmitter;
if (typeof module !== "undefined") {
module.exports = EventEmitter;
}
});
// node_modules/stream-json/utils/Utf8Stream.js
var require_Utf8Stream = __commonJS((exports, module) => {
var { Transform } = __require("stream");
var { StringDecoder } = __require("string_decoder");
class Utf8Stream extends Transform {
constructor(options) {
super(Object.assign({}, options, { writableObjectMode: false }));
this._buffer = "";
}
_transform(chunk, encoding, callback) {
if (typeof chunk == "string") {
this._transform = this._transformString;
} else {
this._stringDecoder = new StringDecoder;
this._transform = this._transformBuffer;
}
this._transform(chunk, encoding, callback);
}
_transformBuffer(chunk, _3, callback) {
this._buffer += this._stringDecoder.write(chunk);
this._processBuffer(callback);
}
_transformString(chunk, _3, callback) {
this._buffer += chunk.toString();
this._processBuffer(callback);
}
_processBuffer(callback) {
if (this._buffer) {
this.push(this._buffer, "utf8");
this._buffer = "";
}
callback(null);
}
_flushInput() {
if (this._stringDecoder) {
this._buffer += this._stringDecoder.end();
}
}
_flush(callback) {
this._flushInput();
this._processBuffer(callback);
}
}
module.exports = Utf8Stream;
});
// node_modules/stream-json/jsonl/Parser.js
var require_Parser = __commonJS((exports, module) => {
var Utf8Stream = require_Utf8Stream();
class JsonlParser extends Utf8Stream {
static make(options) {
return new JsonlParser(options);
}
static checkedParse(input, reviver, errorIndicator) {
try {
return JSON.parse(input, reviver);
} catch (error) {
if (typeof errorIndicator == "function")
return errorIndicator(error);
}
return errorIndicator;
}
constructor(options) {
super(Object.assign({}, options, { readableObjectMode: true }));
this._rest = "";
this._counter = 0;
this._reviver = options && options.reviver;
this._errorIndicator = options && options.errorIndicator;
if (options && options.checkErrors) {
this._processBuffer = this._checked_processBuffer;
this._flush = this._checked_flush;
}
if (options && "errorIndicator" in options) {
this._processBuffer = this._suppressed_processBuffer;
this._flush = this._suppressed_flush;
}
}
_processBuffer(callback) {
const lines = this._buffer.split(`
`);
this._rest += lines[0];
if (lines.length > 1) {
this._rest && this.push({ key: this._counter++, value: JSON.parse(this._rest, this._reviver) });
this._rest = lines.pop();
for (let i = 1;i < lines.length; ++i) {
lines[i] && this.push({ key: this._counter++, value: JSON.parse(lines[i], this._reviver) });
}
}
this._buffer = "";
callback(null);
}
_flush(callback) {
super._flush((error) => {
if (error)
return callback(error);
if (this._rest) {
this.push({ key: this._counter++, value: JSON.parse(this._rest, this._reviver) });
this._rest = "";
}
callback(null);
});
}
_suppressed_processBuffer(callback) {
const lines = this._buffer.split(`
`);
this._rest += lines[0];
if (lines.length > 1) {
if (this._rest) {
const value = JsonlParser.checkedParse(this._rest, this._reviver, this._errorIndicator);
value !== undefined && this.push({ key: this._counter++, value });
}
this._rest = lines.pop();
for (let i = 1;i < lines.length; ++i) {
if (!lines[i])
continue;
const value = JsonlParser.checkedParse(lines[i], this._reviver, this._errorIndicator);
value !== undefined && this.push({ key: this._counter++, value });
}
}
this._buffer = "";
callback(null);
}
_suppressed_flush(callback) {
super._flush((error) => {
if (error)
return callback(error);
if (this._rest) {
const value = JsonlParser.checkedParse(this._rest, this._reviver, this._errorIndicator);
value !== undefined && this.push({ key: this._counter++, value });
this._rest = "";
}
callback(null);
});
}
_checked_processBuffer(callback) {
const lines = this._buffer.split(`
`);
this._rest += lines[0];
if (lines.length > 1) {
try {
this._rest && this.push({ key: this._counter++, value: JSON.parse(this._rest, this._reviver) });
this._rest = lines.pop();
for (let i = 1;i < lines.length; ++i) {
lines[i] && this.push({ key: this._counter++, value: JSON.parse(lines[i], this._reviver) });
}
} catch (cbErr) {
this._buffer = "";
callback(cbErr);
return;
}
}
this._buffer = "";
callback(null);
}
_checked_flush(callback) {
super._flush((error) => {
if (error)
return callback(error);
if (this._rest) {
try {
this.push({ key: this._counter++, value: JSON.parse(this._rest, this._reviver) });
} catch (cbErr) {
this._rest = "";
callback(cbErr);
return;
}
this._rest = "";
}
callback(null);
});
}
}
JsonlParser.parser = JsonlParser.make;
JsonlParser.make.Constructor = JsonlParser;
module.exports = JsonlParser;
});
// node_modules/through2/through2.js
var require_through2 = __commonJS((exports, module) => {
var { Transform } = require_readable();
function inherits(fn, sup) {
fn.super_ = sup;
fn.prototype = Object.create(sup.prototype, {
constructor: { value: fn, enumerable: false, writable: true, configurable: true }
});
}
function through2(construct) {
return (options, transform, flush) => {
if (typeof options === "function") {
flush = transform;
transform = options;
options = {};
}
if (typeof transform !== "function") {
transform = (chunk, enc, cb) => cb(null, chunk);
}
if (typeof flush !== "function") {
flush = null;
}
return construct(options, transform, flush);
};
}
var make = through2((options, transform, flush) => {
const t2 = new Transform(options);
t2._transform = transform;
if (flush) {
t2._flush = flush;
}
return t2;
});
var ctor = through2((options, transform, flush) => {
function Through2(override) {
if (!(this instanceof Through2)) {
return new Through2(override);
}
this.options = Object.assign({}, options, override);
Transform.call(this, this.options);
this._transform = transform;
if (flush) {
this._flush = flush;
}
}
inherits(Through2, Transform);
return Through2;
});
var obj = through2(function(options, transform, flush) {
const t2 = new Transform(Object.assign({ objectMode: true, highWaterMark: 16 }, options));
t2._transform = transform;
if (flush) {
t2._flush = flush;
}
return t2;
});
module.exports = make;
module.exports.ctor = ctor;
module.exports.obj = obj;
});
// src/upload.ts
var {Glob } = globalThis.Bun;
// src/lib/utils.ts
var import_docopt = __toESM(require_docopt(), 1);
function parseDocopt() {
const doc = `Synchronize file from a local path to upload or delete static contents from user's minio bucket.
Usage:
upload.ts [<path>] [--clean] [--verbose] [--batchsize=1]
`;
return import_docopt.docopt(doc);
}
function logError(message) {
console.error(message);
return 1;
}
function parseResults(results, counter) {
for (let i = 0;i < results.length; i++) {
switch (results[i]) {
case "completed" /* COMPLETED */:
counter.completed++;
break;
case "error" /* ERROR */:
counter.errors++;
break;
case "skipped" /* SKIPPED */:
counter.skipped++;
break;
}
}
return counter;
}
function getEnv(key) {
const result = process.env[key] || null;
if (result === null) {
logError(`required ${key} environment variable is not set!`);
process.exit(1);
}
return result;
}
async function toBuffer(stream) {
const list = [];
const reader = stream.getReader();
while (true) {
const { value, done } = await reader.read();
if (value)
list.push(value);
if (done)
break;
}
return Buffer.concat(list);
}
function extractUrlParts(urlString) {
try {
const url = new URL(urlString);
const protocol = url.protocol;
const host = url.hostname;
const port = url.port || (protocol === "https:" ? "443" : "80");
const protocolWithoutColon = protocol.replace(":", "");
return {
protocol: protocolWithoutColon,
host,
port: Number(port)
};
} catch (error) {
logError(`Invalid URL: ${error}`);
return null;
}
}
// node_modules/minio/dist/esm/minio.mjs
var import_xml2js2 = __toESM(require_xml2js(), 1);
import * as Stream from "stream";
// node_modules/minio/dist/esm/errors.mjs
class ExtendableError extends Error {
constructor(message, opt) {
super(message, opt);
this.name = this.constructor.name;
}
}
class AnonymousRequestError extends ExtendableError {
}
class InvalidArgumentError extends ExtendableError {
}
class InvalidEndpointError extends ExtendableError {
}
class InvalidBucketNameError extends ExtendableError {
}
class InvalidObjectNameError extends ExtendableError {
}
class AccessKeyRequiredError extends ExtendableError {
}
class SecretKeyRequiredError extends ExtendableError {
}
class ExpiresParamError extends ExtendableError {
}
class InvalidDateError extends ExtendableError {
}
class InvalidPrefixError extends ExtendableError {
}
class InvalidBucketPolicyError extends ExtendableError {
}
class InvalidXMLError extends ExtendableError {
}
class S3Error extends ExtendableError {
}
class IsValidBucketNameError extends ExtendableError {
}
// node_modules/minio/dist/esm/internal/callbackify.mjs
function callbackify(fn) {
return function() {
const args = [...arguments];
const callback = args.pop();
if (typeof callback === "function") {
return fn.apply(this, args).then((result) => callback(null, result), (err) => callback(err));
}
return fn.apply(this, arguments);
};
}
// node_modules/minio/dist/esm/internal/client.mjs
import * as crypto3 from "crypto";
import * as fs2 from "fs";
import * as http from "http";
import * as https from "https";
import * as path from "path";
import * as stream4 from "stream";
// node_modules/async/dist/async.mjs
function initialParams(fn) {
return function(...args) {
var callback = args.pop();
return fn.call(this, args, callback);
};
}
var hasQueueMicrotask = typeof queueMicrotask === "function" && queueMicrotask;
var hasSetImmediate = typeof setImmediate === "function" && setImmediate;
var hasNextTick = typeof process === "object" && typeof process.nextTick === "function";
function fallback(fn) {
setTimeout(fn, 0);
}
function wrap(defer) {
return (fn, ...args) => defer(() => fn(...args));
}
var _defer$1;
if (hasQueueMicrotask) {
_defer$1 = queueMicrotask;
} else if (hasSetImmediate) {
_defer$1 = setImmediate;
} else if (hasNextTick) {
_defer$1 = process.nextTick;
} else {
_defer$1 = fallback;
}
var setImmediate$1 = wrap(_defer$1);
function asyncify(func) {
if (isAsync(func)) {
return function(...args) {
const callback = args.pop();
const promise = func.apply(this, args);
return handlePromise(promise, callback);
};
}
return initialParams(function(args, callback) {
var result;
try {
result = func.apply(this, args);
} catch (e) {
return callback(e);
}
if (result && typeof result.then === "function") {
return handlePromise(result, callback);
} else {
callback(null, result);
}
});
}
function handlePromise(promise, callback) {
return promise.then((value) => {
invokeCallback(callback, null, value);
}, (err) => {
invokeCallback(callback, err && (err instanceof Error || err.message) ? err : new Error(err));
});
}
function invokeCallback(callback, error, value) {
try {
callback(error, value);
} catch (err) {
setImmediate$1((e) => {
throw e;
}, err);
}
}
function isAsync(fn) {
return fn[Symbol.toStringTag] === "AsyncFunction";
}
function isAsyncGenerator(fn) {
return fn[Symbol.toStringTag] === "AsyncGenerator";
}
function isAsyncIterable(obj) {
return typeof obj[Symbol.asyncIterator] === "function";
}
function wrapAsync(asyncFn) {
if (typeof asyncFn !== "function")
throw new Error("expected a function");
return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn;
}
function awaitify(asyncFn, arity) {
if (!arity)
arity = asyncFn.length;
if (!arity)
throw new Error("arity is undefined");
function awaitable(...args) {
if (typeof args[arity - 1] === "function") {
return asyncFn.apply(this, args);
}
return new Promise((resolve, reject) => {
args[arity - 1] = (err, ...cbArgs) => {
if (err)
return reject(err);
resolve(cbArgs.length > 1 ? cbArgs : cbArgs[0]);
};
asyncFn.apply(this, args);
});
}
return awaitable;
}
function applyEach$1(eachfn) {
return function applyEach(fns, ...callArgs) {
const go = awaitify(function(callback) {
var that = this;
return eachfn(fns, (fn, cb) => {
wrapAsync(fn).apply(that, callArgs.concat(cb));
}, callback);
});
return go;
};
}
function _asyncMap(eachfn, arr, iteratee, callback) {
arr = arr || [];
var results = [];
var counter = 0;
var _iteratee = wrapAsync(iteratee);
return eachfn(arr, (value, _, iterCb) => {
var index = counter++;
_iteratee(value, (err, v) => {
results[index] = v;
iterCb(err);
});
}, (err) => {
callback(err, results);
});
}
function isArrayLike(value) {
return value && typeof value.length === "number" && value.length >= 0 && value.length % 1 === 0;
}
var breakLoop = {};
function once(fn) {
function wrapper(...args) {
if (fn === null)
return;
var callFn = fn;
fn = null;
callFn.apply(this, args);
}
Object.assign(wrapper, fn);
return wrapper;
}
function getIterator(coll) {
return coll[Symbol.iterator] && coll[Symbol.iterator]();
}
function createArrayIterator(coll) {
var i = -1;
var len = coll.length;
return function next() {
return ++i < len ? { value: coll[i], key: i } : null;
};
}
function createES2015Iterator(iterator) {
var i = -1;
return function next() {
var item = iterator.next();
if (item.done)
return null;
i++;
return { value: item.value, key: i };
};
}
function createObjectIterator(obj) {
var okeys = obj ? Object.keys(obj) : [];
var i = -1;
var len = okeys.length;
return function next() {
var key = okeys[++i];
if (key === "__proto__") {
return next();
}
return i < len ? { value: obj[key], key } : null;
};
}
function createIterator(coll) {
if (isArrayLike(coll)) {
return createArrayIterator(coll);
}
var iterator = getIterator(coll);
return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll);
}
function onlyOnce(fn) {
return function(...args) {
if (fn === null)
throw new Error("Callback was already called.");
var callFn = fn;
fn = null;
callFn.apply(this, args);
};
}
function asyncEachOfLimit(generator, limit, iteratee, callback) {
let done = false;
let canceled = false;
let awaiting = false;
let running = 0;
let idx = 0;
function replenish() {
if (running >= limit || awaiting || done)
return;
awaiting = true;
generator.next().then(({ value, done: iterDone }) => {
if (canceled || done)
return;
awaiting = false;
if (iterDone) {
done = true;
if (running <= 0) {
callback(null);
}
return;
}
running++;
iteratee(value, idx, iterateeCallback);
idx++;
replenish();
}).catch(handleError);
}
function iterateeCallback(err, result) {
running -= 1;
if (canceled)
return;
if (err)
return handleError(err);
if (err === false) {
done = true;
canceled = true;
return;
}
if (result === breakLoop || done && running <= 0) {
done = true;
return callback(null);
}
replenish();
}
function handleError(err) {
if (canceled)
return;
awaiting = false;
done = true;
callback(err);
}
replenish();
}
var eachOfLimit$2 = (limit) => {
return (obj, iteratee, callback) => {
callback = once(callback);
if (limit <= 0) {
throw new RangeError("concurrency limit cannot be less than 1");
}
if (!obj) {
return callback(null);
}
if (isAsyncGenerator(obj)) {
return asyncEachOfLimit(obj, limit, iteratee, callback);
}
if (isAsyncIterable(obj)) {
return asyncEachOfLimit(obj[Symbol.asyncIterator](), limit, iteratee, callback);
}
var nextElem = createIterator(obj);
var done = false;
var canceled = false;
var running = 0;
var looping = false;
function iterateeCallback(err, value) {
if (canceled)
return;
running -= 1;
if (err) {
done = true;
callback(err);
} else if (err === false) {
done = true;
canceled = true;
} else if (value === breakLoop || done && running <= 0) {
done = true;
return callback(null);
} else if (!looping) {
replenish();
}
}
function replenish() {
looping = true;
while (running < limit && !done) {
var elem = nextElem();
if (elem === null) {
done = true;
if (running <= 0) {
callback(null);
}
return;
}
running += 1;
iteratee(elem.value, elem.key, onlyOnce(iterateeCallback));
}
looping = false;
}
replenish();
};
};
function eachOfLimit(coll, limit, iteratee, callback) {
return eachOfLimit$2(limit)(coll, wrapAsync(iteratee), callback);
}
var eachOfLimit$1 = awaitify(eachOfLimit, 4);
function eachOfArrayLike(coll, iteratee, callback) {
callback = once(callback);
var index = 0, completed = 0, { length } = coll, canceled = false;
if (length === 0) {
callback(null);
}
function iteratorCallback(err, value) {
if (err === false) {
canceled = true;
}
if (canceled === true)
return;
if (err) {
callback(err);
} else if (++completed === length || value === breakLoop) {
callback(null);
}
}
for (;index < length; index++) {
iteratee(coll[index], index, onlyOnce(iteratorCallback));
}
}
function eachOfGeneric(coll, iteratee, callback) {
return eachOfLimit$1(coll, Infinity, iteratee, callback);
}
function eachOf(coll, iteratee, callback) {
var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric;
return eachOfImplementation(coll, wrapAsync(iteratee), callback);
}
var eachOf$1 = awaitify(eachOf, 3);
function map(coll, iteratee, callback) {
return _asyncMap(eachOf$1, coll, iteratee, callback);
}
var map$1 = awaitify(map, 3);
var applyEach = applyEach$1(map$1);
function eachOfSeries(coll, iteratee, callback) {
return eachOfLimit$1(coll, 1, iteratee, callback);
}
var eachOfSeries$1 = awaitify(eachOfSeries, 3);
function mapSeries(coll, iteratee, callback) {
return _asyncMap(eachOfSeries$1, coll, iteratee, callback);
}
var mapSeries$1 = awaitify(mapSeries, 3);
var applyEachSeries = applyEach$1(mapSeries$1);
var PROMISE_SYMBOL = Symbol("promiseCallback");
function reduce(coll, memo, iteratee, callback) {
callback = once(callback);
var _iteratee = wrapAsync(iteratee);
return eachOfSeries$1(coll, (x, i, iterCb) => {
_iteratee(memo, x, (err, v) => {
memo = v;
iterCb(err);
});
}, (err) => callback(err, memo));
}
var reduce$1 = awaitify(reduce, 4);
function mapLimit(coll, limit, iteratee, callback) {
return _asyncMap(eachOfLimit$2(limit), coll, iteratee, callback);
}
var mapLimit$1 = awaitify(mapLimit, 4);
function concatLimit(coll, limit, iteratee, callback) {
var _iteratee = wrapAsync(iteratee);
return mapLimit$1(coll, limit, (val2, iterCb) => {
_iteratee(val2, (err, ...args) => {
if (err)
return iterCb(err);
return iterCb(err, args);
});
}, (err, mapResults) => {
var result = [];
for (var i = 0;i < mapResults.length; i++) {
if (mapResults[i]) {
result = result.concat(...mapResults[i]);
}
}
return callback(err, result);
});
}
var concatLimit$1 = awaitify(concatLimit, 4);
function concat(coll, iteratee, callback) {
return concatLimit$1(coll, Infinity, iteratee, callback);
}
var concat$1 = awaitify(concat, 3);
function concatSeries(coll, iteratee, callback) {
return concatLimit$1(coll, 1, iteratee, callback);
}
var concatSeries$1 = awaitify(concatSeries, 3);
function _createTester(check, getResult) {
return (eachfn, arr, _iteratee, cb) => {
var testPassed = false;
var testResult;
const iteratee = wrapAsync(_iteratee);
eachfn(arr, (value, _, callback) => {
iteratee(value, (err, result) => {
if (err || err === false)
return callback(err);
if (check(result) && !testResult) {
testPassed = true;
testResult = getResult(true, value);
return callback(null, breakLoop);
}
callback();
});
}, (err) => {
if (err)
return cb(err);
cb(null, testPassed ? testResult : getResult(false));
});
};
}
function detect(coll, iteratee, callback) {
return _createTester((bool) => bool, (res, item) => item)(eachOf$1, coll, iteratee, callback);
}
var detect$1 = awaitify(detect, 3);
function detectLimit(coll, limit, iteratee, callback) {
return _createTester((bool) => bool, (res, item) => item)(eachOfLimit$2(limit), coll, iteratee, callback);
}
var detectLimit$1 = awaitify(detectLimit, 4);
function detectSeries(coll, iteratee, callback) {
return _createTester((bool) => bool, (res, item) => item)(eachOfLimit$2(1), coll, iteratee, callback);
}
var detectSeries$1 = awaitify(detectSeries, 3);
function consoleFunc(name) {
return (fn, ...args) => wrapAsync(fn)(...args, (err, ...resultArgs) => {
if (typeof console === "object") {
if (err) {
if (console.error) {
console.error(err);
}
} else if (console[name]) {
resultArgs.forEach((x) => console[name](x));
}
}
});
}
var dir = consoleFunc("dir");
function doWhilst(iteratee, test, callback) {
callback = onlyOnce(callback);
var _fn = wrapAsync(iteratee);
var _test = wrapAsync(test);
var results;
function next(err, ...args) {
if (err)
return callback(err);
if (err === false)
return;
results = args;
_test(...args, check);
}
function check(err, truth) {
if (err)
return callback(err);
if (err === false)
return;
if (!truth)
return callback(null, ...results);
_fn(next);
}
return check(null, true);
}
var doWhilst$1 = awaitify(doWhilst, 3);
function _withoutIndex(iteratee) {
return (value, index, callback) => iteratee(value, callback);
}
function eachLimit$2(coll, iteratee, callback) {
return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback);
}
var each = awaitify(eachLimit$2, 3);
function eachLimit(coll, limit, iteratee, callback) {
return eachOfLimit$2(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);
}
var eachLimit$1 = awaitify(eachLimit, 4);
function eachSeries(coll, iteratee, callback) {
return eachLimit$1(coll, 1, iteratee, callback);
}
var eachSeries$1 = awaitify(eachSeries, 3);
function ensureAsync(fn) {
if (isAsync(fn))
return fn;
return function(...args) {
var callback = args.pop();
var sync = true;
args.push((...innerArgs) => {
if (sync) {
setImmediate$1(() => callback(...innerArgs));
} else {
callback(...innerArgs);
}
});
fn.apply(this, args);
sync = false;
};
}
function every(coll, iteratee, callback) {
return _createTester((bool) => !bool, (res) => !res)(eachOf$1, coll, iteratee, callback);
}
var every$1 = awaitify(every, 3);
function everyLimit(coll, limit, iteratee, callback) {
return _createTester((bool) => !bool, (res) => !res)(eachOfLimit$2(limit), coll, iteratee, callback);
}
var everyLimit$1 = awaitify(everyLimit, 4);
function everySeries(coll, iteratee, callback) {
return _createTester((bool) => !bool, (res) => !res)(eachOfSeries$1, coll, iteratee, callback);
}
var everySeries$1 = awaitify(everySeries, 3);
function filterArray(eachfn, arr, iteratee, callback) {
var truthValues = new Array(arr.length);
eachfn(arr, (x, index, iterCb) => {
iteratee(x, (err, v) => {
truthValues[index] = !!v;
iterCb(err);
});
}, (err) => {
if (err)
return callback(err);
var results = [];
for (var i = 0;i < arr.length; i++) {
if (truthValues[i])
results.push(arr[i]);
}
callback(null, results);
});
}
function filterGeneric(eachfn, coll, iteratee, callback) {
var results = [];
eachfn(coll, (x, index, iterCb) => {
iteratee(x, (err, v) => {
if (err)
return iterCb(err);
if (v) {
results.push({ index, value: x });
}
iterCb(err);
});
}, (err) => {
if (err)
return callback(err);
callback(null, results.sort((a, b) => a.index - b.index).map((v) => v.value));
});
}
function _filter(eachfn, coll, iteratee, callback) {
var filter = isArrayLike(coll) ? filterArray : filterGeneric;
return filter(eachfn, coll, wrapAsync(iteratee), callback);
}
function filter(coll, iteratee, callback) {
return _filter(eachOf$1, coll, iteratee, callback);
}
var filter$1 = awaitify(filter, 3);
function filterLimit(coll, limit, iteratee, callback) {
return _filter(eachOfLimit$2(limit), coll, iteratee, callback);
}
var filterLimit$1 = awaitify(filterLimit, 4);
function filterSeries(coll, iteratee, callback) {
return _filter(eachOfSeries$1, coll, iteratee, callback);
}
var filterSeries$1 = awaitify(filterSeries, 3);
function forever(fn, errback) {
var done = onlyOnce(errback);
var task = wrapAsync(ensureAsync(fn));
function next(err) {
if (err)
return done(err);
if (err === false)
return;
task(next);
}
return next();
}
var forever$1 = awaitify(forever, 2);
function groupByLimit(coll, limit, iteratee, callback) {
var _iteratee = wrapAsync(iteratee);
return mapLimit$1(coll, limit, (val2, iterCb) => {
_iteratee(val2, (err, key) => {
if (err)
return iterCb(err);
return iterCb(err, { key, val: val2 });
});
}, (err, mapResults) => {
var result = {};
var { hasOwnProperty } = Object.prototype;
for (var i = 0;i < mapResults.length; i++) {
if (mapResults[i]) {
var { key } = mapResults[i];
var { val: val2 } = mapResults[i];
if (hasOwnProperty.call(result, key)) {
result[key].push(val2);
} else {
result[key] = [val2];
}
}
}
return callback(err, result);
});
}
var groupByLimit$1 = awaitify(groupByLimit, 4);
var log = consoleFunc("log");
function mapValuesLimit(obj, limit, iteratee, callback) {
callback = once(callback);
var newObj = {};
var _iteratee = wrapAsync(iteratee);
return eachOfLimit$2(limit)(obj, (val2, key, next) => {
_iteratee(val2, key, (err, result) => {
if (err)
return next(err);
newObj[key] = result;
next(err);
});
}, (err) => callback(err, newObj));
}
var mapValuesLimit$1 = awaitify(mapValuesLimit, 4);
var _defer;
if (hasNextTick) {
_defer = process.nextTick;
} else if (hasSetImmediate) {
_defer = setImmediate;
} else {
_defer = fallback;
}
var nextTick = wrap(_defer);
var _parallel = awaitify((eachfn, tasks, callback) => {
var results = isArrayLike(tasks) ? [] : {};
eachfn(tasks, (task, key, taskCb) => {
wrapAsync(task)((err, ...result) => {
if (result.length < 2) {
[result] = result;
}
results[key] = result;
taskCb(err);
});
}, (err) => callback(err, results));
}, 3);
function race(tasks, callback) {
callback = once(callback);
if (!Array.isArray(tasks))
return callback(new TypeError("First argument to race must be an array of functions"));
if (!tasks.length)
return callback();
for (var i = 0, l = tasks.length;i < l; i++) {
wrapAsync(tasks[i])(callback);
}
}
var race$1 = awaitify(race, 2);
function reject$2(eachfn, arr, _iteratee, callback) {
const iteratee = wrapAsync(_iteratee);
return _filter(eachfn, arr, (value, cb) => {
iteratee(value, (err, v) => {
cb(err, !v);
});
}, callback);
}
function reject(coll, iteratee, callback) {
return reject$2(eachOf$1, coll, iteratee, callback);
}
var reject$1 = awaitify(reject, 3);
function rejectLimit(coll, limit, iteratee, callback) {
return reject$2(eachOfLimit$2(limit), coll, iteratee, callback);
}
var rejectLimit$1 = awaitify(rejectLimit, 4);
function rejectSeries(coll, iteratee, callback) {
return reject$2(eachOfSeries$1, coll, iteratee, callback);
}
var rejectSeries$1 = awaitify(rejectSeries, 3);
function some(coll, iteratee, callback) {
return _createTester(Boolean, (res) => res)(eachOf$1, coll, iteratee, callback);
}
var some$1 = awaitify(some, 3);
function someLimit(coll, limit, iteratee, callback) {
return _createTester(Boolean, (res) => res)(eachOfLimit$2(limit), coll, iteratee, callback);
}
var someLimit$1 = awaitify(someLimit, 4);
function someSeries(coll, iteratee, callback) {
return _createTester(Boolean, (res) => res)(eachOfSeries$1, coll, iteratee, callback);
}
var someSeries$1 = awaitify(someSeries, 3);
function sortBy(coll, iteratee, callback) {
var _iteratee = wrapAsync(iteratee);
return map$1(coll, (x, iterCb) => {
_iteratee(x, (err, criteria) => {
if (err)
return iterCb(err);
iterCb(err, { value: x, criteria });
});
}, (err, results) => {
if (err)
return callback(err);
callback(null, results.sort(comparator).map((v) => v.value));
});
function comparator(left, right) {
var a = left.criteria, b = right.criteria;
return a < b ? -1 : a > b ? 1 : 0;
}
}
var sortBy$1 = awaitify(sortBy, 3);
function tryEach(tasks, callback) {
var error = null;
var result;
return eachSeries$1(tasks, (task, taskCb) => {
wrapAsync(task)((err, ...args) => {
if (err === false)
return taskCb(err);
if (args.length < 2) {
[result] = args;
} else {
result = args;
}
error = err;
taskCb(err ? null : {});
});
}, () => callback(error, result));
}
var tryEach$1 = awaitify(tryEach);
function whilst(test, iteratee, callback) {
callback = onlyOnce(callback);
var _fn = wrapAsync(iteratee);
var _test = wrapAsync(test);
var results = [];
function next(err, ...rest) {
if (err)
return callback(err);
results = rest;
if (err === false)
return;
_test(check);
}
function check(err, truth) {
if (err)
return callback(err);
if (err === false)
return;
if (!truth)
return callback(null, ...results);
_fn(next);
}
return _test(check);
}
var whilst$1 = awaitify(whilst, 3);
function waterfall(tasks, callback) {
callback = once(callback);
if (!Array.isArray(tasks))
return callback(new Error("First argument to waterfall must be an array of functions"));
if (!tasks.length)
return callback();
var taskIndex = 0;
function nextTask(args) {
var task = wrapAsync(tasks[taskIndex++]);
task(...args, onlyOnce(next));
}
function next(err, ...args) {
if (err === false)
return;
if (err || taskIndex === tasks.length) {
return callback(err, ...args);
}
nextTask(args);
}
nextTask([]);
}
var waterfall$1 = awaitify(waterfall);
// node_modules/minio/dist/esm/internal/client.mjs
var import_block_stream2 = __toESM(require_block_stream2(), 1);
var import_browser_or_node = __toESM(require_lib2(), 1);
var import_lodash2 = __toESM(require_lodash(), 1);
// node_modules/query-string/index.js
var strictUriEncode = require_strict_uri_encode();
var decodeComponent = require_decode_uri_component();
var splitOnFirst = require_split_on_first();
var filterObject = require_filter_obj();
var isNullOrUndefined = (value) => value === null || value === undefined;
var encodeFragmentIdentifier = Symbol("encodeFragmentIdentifier");
function encoderForArrayFormat(options) {
switch (options.arrayFormat) {
case "index":
return (key) => (result, value) => {
const index = result.length;
if (value === undefined || options.skipNull && value === null || options.skipEmptyString && value === "") {
return result;
}
if (value === null) {
return [...result, [encode(key, options), "[", index, "]"].join("")];
}
return [
...result,
[encode(key, options), "[", encode(index, options), "]=", encode(value, options)].join("")
];
};
case "bracket":
return (key) => (result, value) => {
if (value === undefined || options.skipNull && value === null || options.skipEmptyString && value === "") {
return result;
}
if (value === null) {
return [...result, [encode(key, options), "[]"].join("")];
}
return [...result, [encode(key, options), "[]=", encode(value, options)].join("")];
};
case "colon-list-separator":
return (key) => (result, value) => {
if (value === undefined || options.skipNull && value === null || options.skipEmptyString && value === "") {
return result;
}
if (value === null) {
return [...result, [encode(key, options), ":list="].join("")];
}
return [...result, [encode(key, options), ":list=", encode(value, options)].join("")];
};
case "comma":
case "separator":
case "bracket-separator": {
const keyValueSep = options.arrayFormat === "bracket-separator" ? "[]=" : "=";
return (key) => (result, value) => {
if (value === undefined || options.skipNull && value === null || options.skipEmptyString && value === "") {
return result;
}
value = value === null ? "" : value;
if (result.length === 0) {
return [[encode(key, options), keyValueSep, encode(value, options)].join("")];
}
return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
};
}
default:
return (key) => (result, value) => {
if (value === undefined || options.skipNull && value === null || options.skipEmptyString && value === "") {
return result;
}
if (value === null) {
return [...result, encode(key, options)];
}
return [...result, [encode(key, options), "=", encode(value, options)].join("")];
};
}
}
function validateArrayFormatSeparator(value) {
if (typeof value !== "string" || value.length !== 1) {
throw new TypeError("arrayFormatSeparator must be single character string");
}
}
function encode(value, options) {
if (options.encode) {
return options.strict ? strictUriEncode(value) : encodeURIComponent(value);
}
return value;
}
var $stringify = (object, options) => {
if (!object) {
return "";
}
options = Object.assign({
encode: true,
strict: true,
arrayFormat: "none",
arrayFormatSeparator: ","
}, options);
validateArrayFormatSeparator(options.arrayFormatSeparator);
const shouldFilter = (key) => options.skipNull && isNullOrUndefined(object[key]) || options.skipEmptyString && object[key] === "";
const formatter = encoderForArrayFormat(options);
const objectCopy = {};
for (const key of Object.keys(object)) {
if (!shouldFilter(key)) {
objectCopy[key] = object[key];
}
}
const keys = Object.keys(objectCopy);
if (options.sort !== false) {
keys.sort(options.sort);
}
return keys.map((key) => {
const value = object[key];
if (value === undefined) {
return "";
}
if (value === null) {
return encode(key, options);
}
if (Array.isArray(value)) {
if (value.length === 0 && options.arrayFormat === "bracket-separator") {
return encode(key, options) + "[]";
}
return value.reduce(formatter(key), []).join("&");
}
return encode(key, options) + "=" + encode(value, options);
}).filter((x) => x.length > 0).join("&");
};
// node_modules/minio/dist/esm/internal/client.mjs
var import_xml2js = __toESM(require_xml2js(), 1);
// node_modules/minio/dist/esm/Credentials.mjs
class Credentials {
constructor({
accessKey,
secretKey,
sessionToken
}) {
this.accessKey = accessKey;
this.secretKey = secretKey;
this.sessionToken = sessionToken;
}
setAccessKey(accessKey) {
this.accessKey = accessKey;
}
getAccessKey() {
return this.accessKey;
}
setSecretKey(secretKey) {
this.secretKey = secretKey;
}
getSecretKey() {
return this.secretKey;
}
setSessionToken(sessionToken) {
this.sessionToken = sessionToken;
}
getSessionToken() {
return this.sessionToken;
}
get() {
return this;
}
}
// node_modules/minio/dist/esm/CredentialProvider.mjs
class CredentialProvider {
constructor({
accessKey,
secretKey,
sessionToken
}) {
this.credentials = new Credentials({
accessKey,
secretKey,
sessionToken
});
}
async getCredentials() {
return this.credentials.get();
}
setCredentials(credentials) {
if (credentials instanceof Credentials) {
this.credentials = credentials;
} else {
throw new Error("Unable to set Credentials. it should be an instance of Credentials class");
}
}
setAccessKey(accessKey) {
this.credentials.setAccessKey(accessKey);
}
getAccessKey() {
return this.credentials.getAccessKey();
}
setSecretKey(secretKey) {
this.credentials.setSecretKey(secretKey);
}
getSecretKey() {
return this.credentials.getSecretKey();
}
setSessionToken(sessionToken) {
this.credentials.setSessionToken(sessionToken);
}
getSessionToken() {
return this.credentials.getSessionToken();
}
}
// node_modules/minio/dist/esm/internal/helper.mjs
var import_fast_xml_parser = __toESM(require_fxp(), 1);
var import_ipaddr = __toESM(require_ipaddr(), 1);
var import_lodash = __toESM(require_lodash(), 1);
import * as crypto from "crypto";
import * as stream2 from "stream";
// node_modules/mime-types/index.js
/*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
var db = require_mime_db();
var extname = __require("path").extname;
var $extensions = Object.create(null);
var $lookup = lookup;
var $types = Object.create(null);
populateMaps($extensions, $types);
function lookup(path) {
if (!path || typeof path !== "string") {
return false;
}
var extension = extname("x." + path).toLowerCase().substr(1);
if (!extension) {
return false;
}
return $types[extension] || false;
}
function populateMaps(extensions, types) {
var preference = ["nginx", "apache", undefined, "iana"];
Object.keys(db).forEach(function forEachMimeType(type) {
var mime = db[type];
var exts = mime.extensions;
if (!exts || !exts.length) {
return;
}
extensions[type] = exts;
for (var i = 0;i < exts.length; i++) {
var extension = exts[i];
if (types[extension]) {
var from = preference.indexOf(db[types[extension]].source);
var to = preference.indexOf(mime.source);
if (types[extension] !== "application/octet-stream" && (from > to || from === to && types[extension].substr(0, 12) === "application/")) {
continue;
}
}
types[extension] = type;
}
});
}
// node_modules/minio/dist/esm/internal/async.mjs
import * as fs from "fs";
import * as stream from "stream";
import { promisify } from "util";
import { promises } from "fs";
var streamPromise = {
pipeline: promisify(stream.pipeline)
};
var fstat2 = promisify(fs.fstat);
// node_modules/minio/dist/esm/internal/type.mjs
var ENCRYPTION_TYPES = /* @__PURE__ */ function(ENCRYPTION_TYPES2) {
ENCRYPTION_TYPES2["SSEC"] = "SSE-C";
ENCRYPTION_TYPES2["KMS"] = "KMS";
return ENCRYPTION_TYPES2;
}({});
var RETENTION_MODES = /* @__PURE__ */ function(RETENTION_MODES2) {
RETENTION_MODES2["GOVERNANCE"] = "GOVERNANCE";
RETENTION_MODES2["COMPLIANCE"] = "COMPLIANCE";
return RETENTION_MODES2;
}({});
var RETENTION_VALIDITY_UNITS = /* @__PURE__ */ function(RETENTION_VALIDITY_UNITS2) {
RETENTION_VALIDITY_UNITS2["DAYS"] = "Days";
RETENTION_VALIDITY_UNITS2["YEARS"] = "Years";
return RETENTION_VALIDITY_UNITS2;
}({});
var LEGAL_HOLD_STATUS = /* @__PURE__ */ function(LEGAL_HOLD_STATUS2) {
LEGAL_HOLD_STATUS2["ENABLED"] = "ON";
LEGAL_HOLD_STATUS2["DISABLED"] = "OFF";
return LEGAL_HOLD_STATUS2;
}({});
// node_modules/minio/dist/esm/internal/helper.mjs
var MetaDataHeaderPrefix = "x-amz-meta-";
function hashBinary(buf, enableSHA256) {
let sha256sum = "";
if (enableSHA256) {
sha256sum = crypto.createHash("sha256").update(buf).digest("hex");
}
const md5sum = crypto.createHash("md5").update(buf).digest("base64");
return {
md5sum,
sha256sum
};
}
var encodeAsHex = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;
function uriEscape(uriStr) {
return encodeURIComponent(uriStr).replace(/[!'()*]/g, encodeAsHex);
}
function uriResourceEscape(string) {
return uriEscape(string).replace(/%2F/g, "/");
}
function getScope(region, date, serviceName = "s3") {
return `${makeDateShort(date)}/${region}/${serviceName}/aws4_request`;
}
function isAmazonEndpoint(endpoint) {
return endpoint === "s3.amazonaws.com" || endpoint === "s3.cn-north-1.amazonaws.com.cn";
}
function isVirtualHostStyle(endpoint, protocol, bucket, pathStyle) {
if (protocol === "https:" && bucket.includes(".")) {
return false;
}
return isAmazonEndpoint(endpoint) || !pathStyle;
}
function isValidIP(ip) {
return import_ipaddr.default.isValid(ip);
}
function isValidEndpoint(endpoint) {
return isValidDomain(endpoint) || isValidIP(endpoint);
}
function isValidDomain(host) {
if (!isString(host)) {
return false;
}
if (host.length === 0 || host.length > 255) {
return false;
}
if (host[0] === "-" || host.slice(-1) === "-") {
return false;
}
if (host[0] === "_" || host.slice(-1) === "_") {
return false;
}
if (host[0] === ".") {
return false;
}
const nonAlphaNumerics = "`~!@#$%^&*()+={}[]|\\\"';:><?/";
for (const char of nonAlphaNumerics) {
if (host.includes(char)) {
return false;
}
}
return true;
}
function probeContentType(path) {
let contentType = $lookup(path);
if (!contentType) {
contentType = "application/octet-stream";
}
return contentType;
}
function isValidPort(port) {
if (!isNumber(port)) {
return false;
}
return 0 <= port && port <= 65535;
}
function isValidBucketName(bucket) {
if (!isString(bucket)) {
return false;
}
if (bucket.length < 3 || bucket.length > 63) {
return false;
}
if (bucket.includes("..")) {
return false;
}
if (/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/.test(bucket)) {
return false;
}
if (/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/.test(bucket)) {
return true;
}
return false;
}
function isValidObjectName(objectName) {
if (!isValidPrefix(objectName)) {
return false;
}
return objectName.length !== 0;
}
function isValidPrefix(prefix) {
if (!isString(prefix)) {
return false;
}
if (prefix.length > 1024) {
return false;
}
return true;
}
function isNumber(arg) {
return typeof arg === "number";
}
function isFunction(arg) {
return typeof arg === "function";
}
function isString(arg) {
return typeof arg === "string";
}
function isObject(arg) {
return typeof arg === "object" && arg !== null;
}
function isReadableStream(arg) {
return isObject(arg) && isFunction(arg._read);
}
function isBoolean(arg) {
return typeof arg === "boolean";
}
function isEmpty(o) {
return import_lodash.default.isEmpty(o);
}
function isEmptyObject(o) {
return Object.values(o).filter((x) => x !== undefined).length !== 0;
}
function isDefined(o) {
return o !== null && o !== undefined;
}
function makeDateLong(date) {
date = date || new Date;
const s = date.toISOString();
return s.slice(0, 4) + s.slice(5, 7) + s.slice(8, 13) + s.slice(14, 16) + s.slice(17, 19) + "Z";
}
function makeDateShort(date) {
date = date || new Date;
const s = date.toISOString();
return s.slice(0, 4) + s.slice(5, 7) + s.slice(8, 10);
}
function pipesetup(...streams) {
return streams.reduce((src, dst) => {
src.on("error", (err) => dst.emit("error", err));
return src.pipe(dst);
});
}
function readableStream(data) {
const s = new stream2.Readable;
s._read = () => {};
s.push(data);
s.push(null);
return s;
}
function insertContentType(metaData, filePath) {
for (const key in metaData) {
if (key.toLowerCase() === "content-type") {
return metaData;
}
}
return {
...metaData,
"content-type": probeContentType(filePath)
};
}
function prependXAMZMeta(metaData) {
if (!metaData) {
return {};
}
return import_lodash.default.mapKeys(metaData, (value, key) => {
if (isAmzHeader(key) || isSupportedHeader(key) || isStorageClassHeader(key)) {
return key;
}
return MetaDataHeaderPrefix + key;
});
}
function isAmzHeader(key) {
const temp = key.toLowerCase();
return temp.startsWith(MetaDataHeaderPrefix) || temp === "x-amz-acl" || temp.startsWith("x-amz-server-side-encryption-") || temp === "x-amz-server-side-encryption";
}
function isSupportedHeader(key) {
const supported_headers = ["content-type", "cache-control", "content-encoding", "content-disposition", "content-language", "x-amz-website-redirect-location"];
return supported_headers.includes(key.toLowerCase());
}
function isStorageClassHeader(key) {
return key.toLowerCase() === "x-amz-storage-class";
}
function extractMetadata(headers) {
return import_lodash.default.mapKeys(import_lodash.default.pickBy(headers, (value, key) => isSupportedHeader(key) || isStorageClassHeader(key) || isAmzHeader(key)), (value, key) => {
const lower = key.toLowerCase();
if (lower.startsWith(MetaDataHeaderPrefix)) {
return lower.slice(MetaDataHeaderPrefix.length);
}
return key;
});
}
function getVersionId(headers = {}) {
return headers["x-amz-version-id"] || null;
}
function getSourceVersionId(headers = {}) {
return headers["x-amz-copy-source-version-id"] || null;
}
function sanitizeETag(etag = "") {
const replaceChars = {
'"': "",
"&quot;": "",
"&#34;": "",
"&QUOT;": "",
"&#x00022": ""
};
return etag.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g, (m) => replaceChars[m]);
}
function toMd5(payload) {
return crypto.createHash("md5").update(Buffer.from(payload)).digest().toString("base64");
}
function toSha256(payload) {
return crypto.createHash("sha256").update(payload).digest("hex");
}
function toArray(param) {
if (!Array.isArray(param)) {
return [param];
}
return param;
}
function sanitizeObjectKey(objectName) {
const asStrName = (objectName ? objectName.toString() : "").replace(/\+/g, " ");
return decodeURIComponent(asStrName);
}
function sanitizeSize(size) {
return size ? Number.parseInt(size) : undefined;
}
var PART_CONSTRAINTS = {
ABS_MIN_PART_SIZE: 1024 * 1024 * 5,
MIN_PART_SIZE: 1024 * 1024 * 16,
MAX_PARTS_COUNT: 1e4,
MAX_PART_SIZE: 1024 * 1024 * 1024 * 5,
MAX_SINGLE_PUT_OBJECT_SIZE: 1024 * 1024 * 1024 * 5,
MAX_MULTIPART_PUT_OBJECT_SIZE: 1024 * 1024 * 1024 * 1024 * 5
};
var GENERIC_SSE_HEADER = "X-Amz-Server-Side-Encryption";
var ENCRYPTION_HEADERS = {
sseGenericHeader: GENERIC_SSE_HEADER,
sseKmsKeyID: GENERIC_SSE_HEADER + "-Aws-Kms-Key-Id"
};
function getEncryptionHeaders(encConfig) {
const encType = encConfig.type;
if (!isEmpty(encType)) {
if (encType === ENCRYPTION_TYPES.SSEC) {
return {
[ENCRYPTION_HEADERS.sseGenericHeader]: "AES256"
};
} else if (encType === ENCRYPTION_TYPES.KMS) {
return {
[ENCRYPTION_HEADERS.sseGenericHeader]: encConfig.SSEAlgorithm,
[ENCRYPTION_HEADERS.sseKmsKeyID]: encConfig.KMSMasterKeyID
};
}
}
return {};
}
function partsRequired(size) {
const maxPartSize = PART_CONSTRAINTS.MAX_MULTIPART_PUT_OBJECT_SIZE / (PART_CONSTRAINTS.MAX_PARTS_COUNT - 1);
let requiredPartSize = size / maxPartSize;
if (size % maxPartSize > 0) {
requiredPartSize++;
}
requiredPartSize = Math.trunc(requiredPartSize);
return requiredPartSize;
}
function calculateEvenSplits(size, objInfo) {
if (size === 0) {
return null;
}
const reqParts = partsRequired(size);
const startIndexParts = [];
const endIndexParts = [];
let start = objInfo.Start;
if (isEmpty(start) || start === -1) {
start = 0;
}
const divisorValue = Math.trunc(size / reqParts);
const reminderValue = size % reqParts;
let nextStart = start;
for (let i = 0;i < reqParts; i++) {
let curPartSize = divisorValue;
if (i < reminderValue) {
curPartSize++;
}
const currentStart = nextStart;
const currentEnd = currentStart + curPartSize - 1;
nextStart = currentEnd + 1;
startIndexParts.push(currentStart);
endIndexParts.push(currentEnd);
}
return {
startIndex: startIndexParts,
endIndex: endIndexParts,
objInfo
};
}
var fxp = new import_fast_xml_parser.XMLParser;
function parseXml(xml) {
const result = fxp.parse(xml);
if (result.Error) {
throw result.Error;
}
return result;
}
async function getContentLength(s) {
if (typeof s === "string" || Buffer.isBuffer(s)) {
return s.length;
}
const filePath = s.path;
if (filePath && typeof filePath === "string") {
const stat = await promises.lstat(filePath);
return stat.size;
}
const fd = s.fd;
if (fd && typeof fd === "number") {
const stat = await fstat2(fd);
return stat.size;
}
return null;
}
// node_modules/minio/dist/esm/helpers.mjs
var DEFAULT_REGION = "us-east-1";
var PRESIGN_EXPIRY_DAYS_MAX = 24 * 60 * 60 * 7;
class CopySourceOptions {
constructor({
Bucket,
Object: Object2,
VersionID = "",
MatchETag = "",
NoMatchETag = "",
MatchModifiedSince = null,
MatchUnmodifiedSince = null,
MatchRange = false,
Start = 0,
End = 0,
Encryption = undefined
}) {
this.Bucket = Bucket;
this.Object = Object2;
this.VersionID = VersionID;
this.MatchETag = MatchETag;
this.NoMatchETag = NoMatchETag;
this.MatchModifiedSince = MatchModifiedSince;
this.MatchUnmodifiedSince = MatchUnmodifiedSince;
this.MatchRange = MatchRange;
this.Start = Start;
this.End = End;
this.Encryption = Encryption;
}
validate() {
if (!isValidBucketName(this.Bucket)) {
throw new InvalidBucketNameError("Invalid Source bucket name: " + this.Bucket);
}
if (!isValidObjectName(this.Object)) {
throw new InvalidObjectNameError(`Invalid Source object name: ${this.Object}`);
}
if (this.MatchRange && this.Start !== -1 && this.End !== -1 && this.Start > this.End || this.Start < 0) {
throw new InvalidObjectNameError("Source start must be non-negative, and start must be at most end.");
} else if (this.MatchRange && !isNumber(this.Start) || !isNumber(this.End)) {
throw new InvalidObjectNameError("MatchRange is specified. But Invalid Start and End values are specified.");
}
return true;
}
getHeaders() {
const headerOptions = {};
headerOptions["x-amz-copy-source"] = encodeURI(this.Bucket + "/" + this.Object);
if (!isEmpty(this.VersionID)) {
headerOptions["x-amz-copy-source"] = `${encodeURI(this.Bucket + "/" + this.Object)}?versionId=${this.VersionID}`;
}
if (!isEmpty(this.MatchETag)) {
headerOptions["x-amz-copy-source-if-match"] = this.MatchETag;
}
if (!isEmpty(this.NoMatchETag)) {
headerOptions["x-amz-copy-source-if-none-match"] = this.NoMatchETag;
}
if (!isEmpty(this.MatchModifiedSince)) {
headerOptions["x-amz-copy-source-if-modified-since"] = this.MatchModifiedSince;
}
if (!isEmpty(this.MatchUnmodifiedSince)) {
headerOptions["x-amz-copy-source-if-unmodified-since"] = this.MatchUnmodifiedSince;
}
return headerOptions;
}
}
class CopyDestinationOptions {
constructor({
Bucket,
Object: Object2,
Encryption,
UserMetadata,
UserTags,
LegalHold,
RetainUntilDate,
Mode,
MetadataDirective
}) {
this.Bucket = Bucket;
this.Object = Object2;
this.Encryption = Encryption ?? undefined;
this.UserMetadata = UserMetadata;
this.UserTags = UserTags;
this.LegalHold = LegalHold;
this.Mode = Mode;
this.RetainUntilDate = RetainUntilDate;
this.MetadataDirective = MetadataDirective;
}
getHeaders() {
const replaceDirective = "REPLACE";
const headerOptions = {};
const userTags = this.UserTags;
if (!isEmpty(userTags)) {
headerOptions["X-Amz-Tagging-Directive"] = replaceDirective;
headerOptions["X-Amz-Tagging"] = isObject(userTags) ? $stringify(userTags) : isString(userTags) ? userTags : "";
}
if (this.Mode) {
headerOptions["X-Amz-Object-Lock-Mode"] = this.Mode;
}
if (this.RetainUntilDate) {
headerOptions["X-Amz-Object-Lock-Retain-Until-Date"] = this.RetainUntilDate;
}
if (this.LegalHold) {
headerOptions["X-Amz-Object-Lock-Legal-Hold"] = this.LegalHold;
}
if (this.UserMetadata) {
for (const [key, value] of Object.entries(this.UserMetadata)) {
headerOptions[`X-Amz-Meta-${key}`] = value.toString();
}
}
if (this.MetadataDirective) {
headerOptions[`X-Amz-Metadata-Directive`] = this.MetadataDirective;
}
if (this.Encryption) {
const encryptionHeaders = getEncryptionHeaders(this.Encryption);
for (const [key, value] of Object.entries(encryptionHeaders)) {
headerOptions[key] = value;
}
}
return headerOptions;
}
validate() {
if (!isValidBucketName(this.Bucket)) {
throw new InvalidBucketNameError("Invalid Destination bucket name: " + this.Bucket);
}
if (!isValidObjectName(this.Object)) {
throw new InvalidObjectNameError(`Invalid Destination object name: ${this.Object}`);
}
if (!isEmpty(this.UserMetadata) && !isObject(this.UserMetadata)) {
throw new InvalidObjectNameError(`Destination UserMetadata should be an object with key value pairs`);
}
if (!isEmpty(this.Mode) && ![RETENTION_MODES.GOVERNANCE, RETENTION_MODES.COMPLIANCE].includes(this.Mode)) {
throw new InvalidObjectNameError(`Invalid Mode specified for destination object it should be one of [GOVERNANCE,COMPLIANCE]`);
}
if (this.Encryption !== undefined && isEmptyObject(this.Encryption)) {
throw new InvalidObjectNameError(`Invalid Encryption configuration for destination object `);
}
return true;
}
}
class SelectResults {
constructor({
records,
response,
stats,
progress
}) {
this.records = records;
this.response = response;
this.stats = stats;
this.progress = progress;
}
setStats(stats) {
this.stats = stats;
}
getStats() {
return this.stats;
}
setProgress(progress) {
this.progress = progress;
}
getProgress() {
return this.progress;
}
setResponse(response) {
this.response = response;
}
getResponse() {
return this.response;
}
setRecords(records) {
this.records = records;
}
getRecords() {
return this.records;
}
}
// node_modules/minio/dist/esm/signing.mjs
import * as crypto2 from "crypto";
var signV4Algorithm = "AWS4-HMAC-SHA256";
function getCanonicalRequest(method, path, headers, signedHeaders, hashedPayload) {
if (!isString(method)) {
throw new TypeError('method should be of type "string"');
}
if (!isString(path)) {
throw new TypeError('path should be of type "string"');
}
if (!isObject(headers)) {
throw new TypeError('headers should be of type "object"');
}
if (!Array.isArray(signedHeaders)) {
throw new TypeError('signedHeaders should be of type "array"');
}
if (!isString(hashedPayload)) {
throw new TypeError('hashedPayload should be of type "string"');
}
const headersArray = signedHeaders.reduce((acc, i) => {
const val2 = `${headers[i]}`.replace(/ +/g, " ");
acc.push(`${i.toLowerCase()}:${val2}`);
return acc;
}, []);
const requestResource = path.split("?")[0];
let requestQuery = path.split("?")[1];
if (!requestQuery) {
requestQuery = "";
}
if (requestQuery) {
requestQuery = requestQuery.split("&").sort().map((element) => !element.includes("=") ? element + "=" : element).join("&");
}
return [method.toUpperCase(), requestResource, requestQuery, headersArray.join(`
`) + `
`, signedHeaders.join(";").toLowerCase(), hashedPayload].join(`
`);
}
function getCredential(accessKey, region, requestDate, serviceName = "s3") {
if (!isString(accessKey)) {
throw new TypeError('accessKey should be of type "string"');
}
if (!isString(region)) {
throw new TypeError('region should be of type "string"');
}
if (!isObject(requestDate)) {
throw new TypeError('requestDate should be of type "object"');
}
return `${accessKey}/${getScope(region, requestDate, serviceName)}`;
}
function getSignedHeaders(headers) {
if (!isObject(headers)) {
throw new TypeError('request should be of type "object"');
}
const ignoredHeaders = ["authorization", "content-length", "content-type", "user-agent"];
return Object.keys(headers).filter((header) => !ignoredHeaders.includes(header)).sort();
}
function getSigningKey(date, region, secretKey, serviceName = "s3") {
if (!isObject(date)) {
throw new TypeError('date should be of type "object"');
}
if (!isString(region)) {
throw new TypeError('region should be of type "string"');
}
if (!isString(secretKey)) {
throw new TypeError('secretKey should be of type "string"');
}
const dateLine = makeDateShort(date);
const hmac1 = crypto2.createHmac("sha256", "AWS4" + secretKey).update(dateLine).digest(), hmac2 = crypto2.createHmac("sha256", hmac1).update(region).digest(), hmac3 = crypto2.createHmac("sha256", hmac2).update(serviceName).digest();
return crypto2.createHmac("sha256", hmac3).update("aws4_request").digest();
}
function getStringToSign(canonicalRequest, requestDate, region, serviceName = "s3") {
if (!isString(canonicalRequest)) {
throw new TypeError('canonicalRequest should be of type "string"');
}
if (!isObject(requestDate)) {
throw new TypeError('requestDate should be of type "object"');
}
if (!isString(region)) {
throw new TypeError('region should be of type "string"');
}
const hash = crypto2.createHash("sha256").update(canonicalRequest).digest("hex");
const scope = getScope(region, requestDate, serviceName);
const stringToSign = [signV4Algorithm, makeDateLong(requestDate), scope, hash];
return stringToSign.join(`
`);
}
function postPresignSignatureV4(region, date, secretKey, policyBase64) {
if (!isString(region)) {
throw new TypeError('region should be of type "string"');
}
if (!isObject(date)) {
throw new TypeError('date should be of type "object"');
}
if (!isString(secretKey)) {
throw new TypeError('secretKey should be of type "string"');
}
if (!isString(policyBase64)) {
throw new TypeError('policyBase64 should be of type "string"');
}
const signingKey = getSigningKey(date, region, secretKey);
return crypto2.createHmac("sha256", signingKey).update(policyBase64).digest("hex").toLowerCase();
}
function signV4(request, accessKey, secretKey, region, requestDate, sha256sum, serviceName = "s3") {
if (!isObject(request)) {
throw new TypeError('request should be of type "object"');
}
if (!isString(accessKey)) {
throw new TypeError('accessKey should be of type "string"');
}
if (!isString(secretKey)) {
throw new TypeError('secretKey should be of type "string"');
}
if (!isString(region)) {
throw new TypeError('region should be of type "string"');
}
if (!accessKey) {
throw new AccessKeyRequiredError("accessKey is required for signing");
}
if (!secretKey) {
throw new SecretKeyRequiredError("secretKey is required for signing");
}
const signedHeaders = getSignedHeaders(request.headers);
const canonicalRequest = getCanonicalRequest(request.method, request.path, request.headers, signedHeaders, sha256sum);
const serviceIdentifier = serviceName || "s3";
const stringToSign = getStringToSign(canonicalRequest, requestDate, region, serviceIdentifier);
const signingKey = getSigningKey(requestDate, region, secretKey, serviceIdentifier);
const credential = getCredential(accessKey, region, requestDate, serviceIdentifier);
const signature = crypto2.createHmac("sha256", signingKey).update(stringToSign).digest("hex").toLowerCase();
return `${signV4Algorithm} Credential=${credential}, SignedHeaders=${signedHeaders.join(";").toLowerCase()}, Signature=${signature}`;
}
function presignSignatureV4(request, accessKey, secretKey, sessionToken, region, requestDate, expires) {
if (!isObject(request)) {
throw new TypeError('request should be of type "object"');
}
if (!isString(accessKey)) {
throw new TypeError('accessKey should be of type "string"');
}
if (!isString(secretKey)) {
throw new TypeError('secretKey should be of type "string"');
}
if (!isString(region)) {
throw new TypeError('region should be of type "string"');
}
if (!accessKey) {
throw new AccessKeyRequiredError("accessKey is required for presigning");
}
if (!secretKey) {
throw new SecretKeyRequiredError("secretKey is required for presigning");
}
if (expires && !isNumber(expires)) {
throw new TypeError('expires should be of type "number"');
}
if (expires && expires < 1) {
throw new ExpiresParamError("expires param cannot be less than 1 seconds");
}
if (expires && expires > PRESIGN_EXPIRY_DAYS_MAX) {
throw new ExpiresParamError("expires param cannot be greater than 7 days");
}
const iso8601Date = makeDateLong(requestDate);
const signedHeaders = getSignedHeaders(request.headers);
const credential = getCredential(accessKey, region, requestDate);
const hashedPayload = "UNSIGNED-PAYLOAD";
const requestQuery = [];
requestQuery.push(`X-Amz-Algorithm=${signV4Algorithm}`);
requestQuery.push(`X-Amz-Credential=${uriEscape(credential)}`);
requestQuery.push(`X-Amz-Date=${iso8601Date}`);
requestQuery.push(`X-Amz-Expires=${expires}`);
requestQuery.push(`X-Amz-SignedHeaders=${uriEscape(signedHeaders.join(";").toLowerCase())}`);
if (sessionToken) {
requestQuery.push(`X-Amz-Security-Token=${uriEscape(sessionToken)}`);
}
const resource = request.path.split("?")[0];
let query = request.path.split("?")[1];
if (query) {
query = query + "&" + requestQuery.join("&");
} else {
query = requestQuery.join("&");
}
const path = resource + "?" + query;
const canonicalRequest = getCanonicalRequest(request.method, path, request.headers, signedHeaders, hashedPayload);
const stringToSign = getStringToSign(canonicalRequest, requestDate, region);
const signingKey = getSigningKey(requestDate, region, secretKey);
const signature = crypto2.createHmac("sha256", signingKey).update(stringToSign).digest("hex").toLowerCase();
return request.protocol + "//" + request.headers.host + path + `&X-Amz-Signature=${signature}`;
}
// node_modules/minio/dist/esm/internal/copy-conditions.mjs
class CopyConditions {
modified = "";
unmodified = "";
matchETag = "";
matchETagExcept = "";
setModified(date) {
if (!(date instanceof Date)) {
throw new TypeError("date must be of type Date");
}
this.modified = date.toUTCString();
}
setUnmodified(date) {
if (!(date instanceof Date)) {
throw new TypeError("date must be of type Date");
}
this.unmodified = date.toUTCString();
}
setMatchETag(etag) {
this.matchETag = etag;
}
setMatchETagExcept(etag) {
this.matchETagExcept = etag;
}
}
// node_modules/minio/dist/esm/internal/extensions.mjs
import * as stream3 from "stream";
// node_modules/minio/dist/esm/internal/response.mjs
async function readAsBuffer(res) {
return new Promise((resolve, reject2) => {
const body = [];
res.on("data", (chunk) => body.push(chunk)).on("error", (e) => reject2(e)).on("end", () => resolve(Buffer.concat(body)));
});
}
async function readAsString(res) {
const body = await readAsBuffer(res);
return body.toString();
}
async function drainResponse(res) {
return new Promise((resolve, reject2) => {
res.on("data", () => {}).on("error", (e) => reject2(e)).on("end", () => resolve());
});
}
// node_modules/buffer-crc32/dist/index.mjs
function getDefaultExportFromCjs(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
}
var CRC_TABLE = new Int32Array([
0,
1996959894,
3993919788,
2567524794,
124634137,
1886057615,
3915621685,
2657392035,
249268274,
2044508324,
3772115230,
2547177864,
162941995,
2125561021,
3887607047,
2428444049,
498536548,
1789927666,
4089016648,
2227061214,
450548861,
1843258603,
4107580753,
2211677639,
325883990,
1684777152,
4251122042,
2321926636,
335633487,
1661365465,
4195302755,
2366115317,
997073096,
1281953886,
3579855332,
2724688242,
1006888145,
1258607687,
3524101629,
2768942443,
901097722,
1119000684,
3686517206,
2898065728,
853044451,
1172266101,
3705015759,
2882616665,
651767980,
1373503546,
3369554304,
3218104598,
565507253,
1454621731,
3485111705,
3099436303,
671266974,
1594198024,
3322730930,
2970347812,
795835527,
1483230225,
3244367275,
3060149565,
1994146192,
31158534,
2563907772,
4023717930,
1907459465,
112637215,
2680153253,
3904427059,
2013776290,
251722036,
2517215374,
3775830040,
2137656763,
141376813,
2439277719,
3865271297,
1802195444,
476864866,
2238001368,
4066508878,
1812370925,
453092731,
2181625025,
4111451223,
1706088902,
314042704,
2344532202,
4240017532,
1658658271,
366619977,
2362670323,
4224994405,
1303535960,
984961486,
2747007092,
3569037538,
1256170817,
1037604311,
2765210733,
3554079995,
1131014506,
879679996,
2909243462,
3663771856,
1141124467,
855842277,
2852801631,
3708648649,
1342533948,
654459306,
3188396048,
3373015174,
1466479909,
544179635,
3110523913,
3462522015,
1591671054,
702138776,
2966460450,
3352799412,
1504918807,
783551873,
3082640443,
3233442989,
3988292384,
2596254646,
62317068,
1957810842,
3939845945,
2647816111,
81470997,
1943803523,
3814918930,
2489596804,
225274430,
2053790376,
3826175755,
2466906013,
167816743,
2097651377,
4027552580,
2265490386,
503444072,
1762050814,
4150417245,
2154129355,
426522225,
1852507879,
4275313526,
2312317920,
282753626,
1742555852,
4189708143,
2394877945,
397917763,
1622183637,
3604390888,
2714866558,
953729732,
1340076626,
3518719985,
2797360999,
1068828381,
1219638859,
3624741850,
2936675148,
906185462,
1090812512,
3747672003,
2825379669,
829329135,
1181335161,
3412177804,
3160834842,
628085408,
1382605366,
3423369109,
3138078467,
570562233,
1426400815,
3317316542,
2998733608,
733239954,
1555261956,
3268935591,
3050360625,
752459403,
1541320221,
2607071920,
3965973030,
1969922972,
40735498,
2617837225,
3943577151,
1913087877,
83908371,
2512341634,
3803740692,
2075208622,
213261112,
2463272603,
3855990285,
2094854071,
198958881,
2262029012,
4057260610,
1759359992,
534414190,
2176718541,
4139329115,
1873836001,
414664567,
2282248934,
4279200368,
1711684554,
285281116,
2405801727,
4167216745,
1634467795,
376229701,
2685067896,
3608007406,
1308918612,
956543938,
2808555105,
3495958263,
1231636301,
1047427035,
2932959818,
3654703836,
1088359270,
936918000,
2847714899,
3736837829,
1202900863,
817233897,
3183342108,
3401237130,
1404277552,
615818150,
3134207493,
3453421203,
1423857449,
601450431,
3009837614,
3294710456,
1567103746,
711928724,
3020668471,
3272380065,
1510334235,
755167117
]);
function ensureBuffer(input) {
if (Buffer.isBuffer(input)) {
return input;
}
if (typeof input === "number") {
return Buffer.alloc(input);
} else if (typeof input === "string") {
return Buffer.from(input);
} else {
throw new Error("input must be buffer, number, or string, received " + typeof input);
}
}
function bufferizeInt(num) {
const tmp = ensureBuffer(4);
tmp.writeInt32BE(num, 0);
return tmp;
}
function _crc32(buf, previous) {
buf = ensureBuffer(buf);
if (Buffer.isBuffer(previous)) {
previous = previous.readUInt32BE(0);
}
let crc = ~~previous ^ -1;
for (var n = 0;n < buf.length; n++) {
crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
}
return crc ^ -1;
}
function crc32() {
return bufferizeInt(_crc32.apply(null, arguments));
}
crc32.signed = function() {
return _crc32.apply(null, arguments);
};
crc32.unsigned = function() {
return _crc32.apply(null, arguments) >>> 0;
};
var bufferCrc32 = crc32;
var index = /* @__PURE__ */ getDefaultExportFromCjs(bufferCrc32);
// node_modules/minio/dist/esm/internal/xml-parser.mjs
var import_fast_xml_parser2 = __toESM(require_fxp(), 1);
function parseBucketRegion(xml) {
return parseXml(xml).LocationConstraint;
}
var fxp2 = new import_fast_xml_parser2.XMLParser;
function parseError(xml, headerInfo) {
let xmlErr = {};
const xmlObj = fxp2.parse(xml);
if (xmlObj.Error) {
xmlErr = xmlObj.Error;
}
const e = new S3Error;
Object.entries(xmlErr).forEach(([key, value]) => {
e[key.toLowerCase()] = value;
});
Object.entries(headerInfo).forEach(([key, value]) => {
e[key] = value;
});
return e;
}
async function parseResponseError(response) {
const statusCode = response.statusCode;
let code, message;
if (statusCode === 301) {
code = "MovedPermanently";
message = "Moved Permanently";
} else if (statusCode === 307) {
code = "TemporaryRedirect";
message = "Are you using the correct endpoint URL?";
} else if (statusCode === 403) {
code = "AccessDenied";
message = "Valid and authorized credentials required";
} else if (statusCode === 404) {
code = "NotFound";
message = "Not Found";
} else if (statusCode === 405) {
code = "MethodNotAllowed";
message = "Method Not Allowed";
} else if (statusCode === 501) {
code = "MethodNotAllowed";
message = "Method Not Allowed";
} else {
code = "UnknownError";
message = `${statusCode}`;
}
const headerInfo = {};
headerInfo.amzRequestid = response.headers["x-amz-request-id"];
headerInfo.amzId2 = response.headers["x-amz-id-2"];
headerInfo.amzBucketRegion = response.headers["x-amz-bucket-region"];
const xmlString = await readAsString(response);
if (xmlString) {
throw parseError(xmlString, headerInfo);
}
const e = new S3Error(message, {
cause: headerInfo
});
e.code = code;
Object.entries(headerInfo).forEach(([key, value]) => {
e[key] = value;
});
throw e;
}
function parseListObjectsV2WithMetadata(xml) {
const result = {
objects: [],
isTruncated: false,
nextContinuationToken: ""
};
let xmlobj = parseXml(xml);
if (!xmlobj.ListBucketResult) {
throw new InvalidXMLError('Missing tag: "ListBucketResult"');
}
xmlobj = xmlobj.ListBucketResult;
if (xmlobj.IsTruncated) {
result.isTruncated = xmlobj.IsTruncated;
}
if (xmlobj.NextContinuationToken) {
result.nextContinuationToken = xmlobj.NextContinuationToken;
}
if (xmlobj.Contents) {
toArray(xmlobj.Contents).forEach((content) => {
const name = sanitizeObjectKey(content.Key);
const lastModified = new Date(content.LastModified);
const etag = sanitizeETag(content.ETag);
const size = content.Size;
let metadata;
if (content.UserMetadata != null) {
metadata = toArray(content.UserMetadata)[0];
} else {
metadata = null;
}
result.objects.push({
name,
lastModified,
etag,
size,
metadata
});
});
}
if (xmlobj.CommonPrefixes) {
toArray(xmlobj.CommonPrefixes).forEach((commonPrefix) => {
result.objects.push({
prefix: sanitizeObjectKey(toArray(commonPrefix.Prefix)[0]),
size: 0
});
});
}
return result;
}
function parseListParts(xml) {
let xmlobj = parseXml(xml);
const result = {
isTruncated: false,
parts: [],
marker: 0
};
if (!xmlobj.ListPartsResult) {
throw new InvalidXMLError('Missing tag: "ListPartsResult"');
}
xmlobj = xmlobj.ListPartsResult;
if (xmlobj.IsTruncated) {
result.isTruncated = xmlobj.IsTruncated;
}
if (xmlobj.NextPartNumberMarker) {
result.marker = toArray(xmlobj.NextPartNumberMarker)[0] || "";
}
if (xmlobj.Part) {
toArray(xmlobj.Part).forEach((p) => {
const part = parseInt(toArray(p.PartNumber)[0], 10);
const lastModified = new Date(p.LastModified);
const etag = p.ETag.replace(/^"/g, "").replace(/"$/g, "").replace(/^&quot;/g, "").replace(/&quot;$/g, "").replace(/^&#34;/g, "").replace(/&#34;$/g, "");
result.parts.push({
part,
lastModified,
etag,
size: parseInt(p.Size, 10)
});
});
}
return result;
}
function parseListBucket(xml) {
let result = [];
const parsedXmlRes = parseXml(xml);
if (!parsedXmlRes.ListAllMyBucketsResult) {
throw new InvalidXMLError('Missing tag: "ListAllMyBucketsResult"');
}
const {
ListAllMyBucketsResult: {
Buckets = {}
} = {}
} = parsedXmlRes;
if (Buckets.Bucket) {
result = toArray(Buckets.Bucket).map((bucket = {}) => {
const {
Name: bucketName,
CreationDate
} = bucket;
const creationDate = new Date(CreationDate);
return {
name: bucketName,
creationDate
};
});
}
return result;
}
function parseInitiateMultipart(xml) {
let xmlobj = parseXml(xml);
if (!xmlobj.InitiateMultipartUploadResult) {
throw new InvalidXMLError('Missing tag: "InitiateMultipartUploadResult"');
}
xmlobj = xmlobj.InitiateMultipartUploadResult;
if (xmlobj.UploadId) {
return xmlobj.UploadId;
}
throw new InvalidXMLError('Missing tag: "UploadId"');
}
function parseReplicationConfig(xml) {
const xmlObj = parseXml(xml);
const {
Role,
Rule
} = xmlObj.ReplicationConfiguration;
return {
ReplicationConfiguration: {
role: Role,
rules: toArray(Rule)
}
};
}
function parseObjectLegalHoldConfig(xml) {
const xmlObj = parseXml(xml);
return xmlObj.LegalHold;
}
function parseTagging(xml) {
const xmlObj = parseXml(xml);
let result = [];
if (xmlObj.Tagging && xmlObj.Tagging.TagSet && xmlObj.Tagging.TagSet.Tag) {
const tagResult = xmlObj.Tagging.TagSet.Tag;
if (isObject(tagResult)) {
result.push(tagResult);
} else {
result = tagResult;
}
}
return result;
}
function parseCompleteMultipart(xml) {
const xmlobj = parseXml(xml).CompleteMultipartUploadResult;
if (xmlobj.Location) {
const location = toArray(xmlobj.Location)[0];
const bucket = toArray(xmlobj.Bucket)[0];
const key = xmlobj.Key;
const etag = xmlobj.ETag.replace(/^"/g, "").replace(/"$/g, "").replace(/^&quot;/g, "").replace(/&quot;$/g, "").replace(/^&#34;/g, "").replace(/&#34;$/g, "");
return {
location,
bucket,
key,
etag
};
}
if (xmlobj.Code && xmlobj.Message) {
const errCode = toArray(xmlobj.Code)[0];
const errMessage = toArray(xmlobj.Message)[0];
return {
errCode,
errMessage
};
}
}
function parseListMultipart(xml) {
const result = {
prefixes: [],
uploads: [],
isTruncated: false,
nextKeyMarker: "",
nextUploadIdMarker: ""
};
let xmlobj = parseXml(xml);
if (!xmlobj.ListMultipartUploadsResult) {
throw new InvalidXMLError('Missing tag: "ListMultipartUploadsResult"');
}
xmlobj = xmlobj.ListMultipartUploadsResult;
if (xmlobj.IsTruncated) {
result.isTruncated = xmlobj.IsTruncated;
}
if (xmlobj.NextKeyMarker) {
result.nextKeyMarker = xmlobj.NextKeyMarker;
}
if (xmlobj.NextUploadIdMarker) {
result.nextUploadIdMarker = xmlobj.nextUploadIdMarker || "";
}
if (xmlobj.CommonPrefixes) {
toArray(xmlobj.CommonPrefixes).forEach((prefix) => {
result.prefixes.push({
prefix: sanitizeObjectKey(toArray(prefix.Prefix)[0])
});
});
}
if (xmlobj.Upload) {
toArray(xmlobj.Upload).forEach((upload) => {
const key = upload.Key;
const uploadId = upload.UploadId;
const initiator = {
id: upload.Initiator.ID,
displayName: upload.Initiator.DisplayName
};
const owner = {
id: upload.Owner.ID,
displayName: upload.Owner.DisplayName
};
const storageClass = upload.StorageClass;
const initiated = new Date(upload.Initiated);
result.uploads.push({
key,
uploadId,
initiator,
owner,
storageClass,
initiated
});
});
}
return result;
}
function parseObjectLockConfig(xml) {
const xmlObj = parseXml(xml);
let lockConfigResult = {};
if (xmlObj.ObjectLockConfiguration) {
lockConfigResult = {
objectLockEnabled: xmlObj.ObjectLockConfiguration.ObjectLockEnabled
};
let retentionResp;
if (xmlObj.ObjectLockConfiguration && xmlObj.ObjectLockConfiguration.Rule && xmlObj.ObjectLockConfiguration.Rule.DefaultRetention) {
retentionResp = xmlObj.ObjectLockConfiguration.Rule.DefaultRetention || {};
lockConfigResult.mode = retentionResp.Mode;
}
if (retentionResp) {
const isUnitYears = retentionResp.Years;
if (isUnitYears) {
lockConfigResult.validity = isUnitYears;
lockConfigResult.unit = RETENTION_VALIDITY_UNITS.YEARS;
} else {
lockConfigResult.validity = retentionResp.Days;
lockConfigResult.unit = RETENTION_VALIDITY_UNITS.DAYS;
}
}
}
return lockConfigResult;
}
function parseBucketVersioningConfig(xml) {
const xmlObj = parseXml(xml);
return xmlObj.VersioningConfiguration;
}
function extractHeaderType(stream3) {
const headerNameLen = Buffer.from(stream3.read(1)).readUInt8();
const headerNameWithSeparator = Buffer.from(stream3.read(headerNameLen)).toString();
const splitBySeparator = (headerNameWithSeparator || "").split(":");
return splitBySeparator.length >= 1 ? splitBySeparator[1] : "";
}
function extractHeaderValue(stream3) {
const bodyLen = Buffer.from(stream3.read(2)).readUInt16BE();
return Buffer.from(stream3.read(bodyLen)).toString();
}
function parseSelectObjectContentResponse(res) {
const selectResults = new SelectResults({});
const responseStream = readableStream(res);
while (responseStream._readableState.length) {
let msgCrcAccumulator;
const totalByteLengthBuffer = Buffer.from(responseStream.read(4));
msgCrcAccumulator = index(totalByteLengthBuffer);
const headerBytesBuffer = Buffer.from(responseStream.read(4));
msgCrcAccumulator = index(headerBytesBuffer, msgCrcAccumulator);
const calculatedPreludeCrc = msgCrcAccumulator.readInt32BE();
const preludeCrcBuffer = Buffer.from(responseStream.read(4));
msgCrcAccumulator = index(preludeCrcBuffer, msgCrcAccumulator);
const totalMsgLength = totalByteLengthBuffer.readInt32BE();
const headerLength = headerBytesBuffer.readInt32BE();
const preludeCrcByteValue = preludeCrcBuffer.readInt32BE();
if (preludeCrcByteValue !== calculatedPreludeCrc) {
throw new Error(`Header Checksum Mismatch, Prelude CRC of ${preludeCrcByteValue} does not equal expected CRC of ${calculatedPreludeCrc}`);
}
const headers = {};
if (headerLength > 0) {
const headerBytes = Buffer.from(responseStream.read(headerLength));
msgCrcAccumulator = index(headerBytes, msgCrcAccumulator);
const headerReaderStream = readableStream(headerBytes);
while (headerReaderStream._readableState.length) {
const headerTypeName = extractHeaderType(headerReaderStream);
headerReaderStream.read(1);
if (headerTypeName) {
headers[headerTypeName] = extractHeaderValue(headerReaderStream);
}
}
}
let payloadStream;
const payLoadLength = totalMsgLength - headerLength - 16;
if (payLoadLength > 0) {
const payLoadBuffer = Buffer.from(responseStream.read(payLoadLength));
msgCrcAccumulator = index(payLoadBuffer, msgCrcAccumulator);
const messageCrcByteValue = Buffer.from(responseStream.read(4)).readInt32BE();
const calculatedCrc = msgCrcAccumulator.readInt32BE();
if (messageCrcByteValue !== calculatedCrc) {
throw new Error(`Message Checksum Mismatch, Message CRC of ${messageCrcByteValue} does not equal expected CRC of ${calculatedCrc}`);
}
payloadStream = readableStream(payLoadBuffer);
}
const messageType = headers["message-type"];
switch (messageType) {
case "error": {
const errorMessage = headers["error-code"] + ':"' + headers["error-message"] + '"';
throw new Error(errorMessage);
}
case "event": {
const contentType = headers["content-type"];
const eventType = headers["event-type"];
switch (eventType) {
case "End": {
selectResults.setResponse(res);
return selectResults;
}
case "Records": {
var _payloadStream;
const readData = (_payloadStream = payloadStream) === null || _payloadStream === undefined ? undefined : _payloadStream.read(payLoadLength);
selectResults.setRecords(readData);
break;
}
case "Progress":
{
switch (contentType) {
case "text/xml": {
var _payloadStream2;
const progressData = (_payloadStream2 = payloadStream) === null || _payloadStream2 === undefined ? undefined : _payloadStream2.read(payLoadLength);
selectResults.setProgress(progressData.toString());
break;
}
default: {
const errorMessage = `Unexpected content-type ${contentType} sent for event-type Progress`;
throw new Error(errorMessage);
}
}
}
break;
case "Stats":
{
switch (contentType) {
case "text/xml": {
var _payloadStream3;
const statsData = (_payloadStream3 = payloadStream) === null || _payloadStream3 === undefined ? undefined : _payloadStream3.read(payLoadLength);
selectResults.setStats(statsData.toString());
break;
}
default: {
const errorMessage = `Unexpected content-type ${contentType} sent for event-type Stats`;
throw new Error(errorMessage);
}
}
}
break;
default: {
const warningMessage = `Un implemented event detected ${messageType}.`;
console.warn(warningMessage);
}
}
}
}
}
}
function parseLifecycleConfig(xml) {
const xmlObj = parseXml(xml);
return xmlObj.LifecycleConfiguration;
}
function parseBucketEncryptionConfig(xml) {
return parseXml(xml);
}
function parseObjectRetentionConfig(xml) {
const xmlObj = parseXml(xml);
const retentionConfig = xmlObj.Retention;
return {
mode: retentionConfig.Mode,
retainUntilDate: retentionConfig.RetainUntilDate
};
}
function removeObjectsParser(xml) {
const xmlObj = parseXml(xml);
if (xmlObj.DeleteResult && xmlObj.DeleteResult.Error) {
return toArray(xmlObj.DeleteResult.Error);
}
return [];
}
function parseCopyObject(xml) {
const result = {
etag: "",
lastModified: ""
};
let xmlobj = parseXml(xml);
if (!xmlobj.CopyObjectResult) {
throw new InvalidXMLError('Missing tag: "CopyObjectResult"');
}
xmlobj = xmlobj.CopyObjectResult;
if (xmlobj.ETag) {
result.etag = xmlobj.ETag.replace(/^"/g, "").replace(/"$/g, "").replace(/^&quot;/g, "").replace(/&quot;$/g, "").replace(/^&#34;/g, "").replace(/&#34;$/g, "");
}
if (xmlobj.LastModified) {
result.lastModified = new Date(xmlobj.LastModified);
}
return result;
}
function uploadPartParser(xml) {
const xmlObj = parseXml(xml);
const respEl = xmlObj.CopyPartResult;
return respEl;
}
// node_modules/minio/dist/esm/internal/extensions.mjs
class Extensions {
constructor(client) {
this.client = client;
}
listObjectsV2WithMetadata(bucketName, prefix, recursive, startAfter) {
if (prefix === undefined) {
prefix = "";
}
if (recursive === undefined) {
recursive = false;
}
if (startAfter === undefined) {
startAfter = "";
}
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidPrefix(prefix)) {
throw new InvalidPrefixError(`Invalid prefix : ${prefix}`);
}
if (!isString(prefix)) {
throw new TypeError('prefix should be of type "string"');
}
if (!isBoolean(recursive)) {
throw new TypeError('recursive should be of type "boolean"');
}
if (!isString(startAfter)) {
throw new TypeError('startAfter should be of type "string"');
}
const delimiter = recursive ? "" : "/";
return stream3.Readable.from(this.listObjectsV2WithMetadataGen(bucketName, prefix, delimiter, startAfter), {
objectMode: true
});
}
async* listObjectsV2WithMetadataGen(bucketName, prefix, delimiter, startAfter) {
let ended = false;
let continuationToken = "";
do {
const result = await this.listObjectsV2WithMetadataQuery(bucketName, prefix, continuationToken, delimiter, startAfter);
ended = !result.isTruncated;
continuationToken = result.nextContinuationToken;
for (const obj of result.objects) {
yield obj;
}
} while (!ended);
}
async listObjectsV2WithMetadataQuery(bucketName, prefix, continuationToken, delimiter, startAfter) {
const queries = [];
queries.push(`list-type=2`);
queries.push(`encoding-type=url`);
queries.push(`prefix=${uriEscape(prefix)}`);
queries.push(`delimiter=${uriEscape(delimiter)}`);
queries.push(`metadata=true`);
if (continuationToken) {
continuationToken = uriEscape(continuationToken);
queries.push(`continuation-token=${continuationToken}`);
}
if (startAfter) {
startAfter = uriEscape(startAfter);
queries.push(`start-after=${startAfter}`);
}
queries.push(`max-keys=1000`);
queries.sort();
let query = "";
if (queries.length > 0) {
query = `${queries.join("&")}`;
}
const method = "GET";
const res = await this.client.makeRequestAsync({
method,
bucketName,
query
});
return parseListObjectsV2WithMetadata(await readAsString(res));
}
}
// node_modules/minio/dist/esm/internal/join-host-port.mjs
function joinHostPort(host, port) {
if (port === undefined) {
return host;
}
if (host.includes(":")) {
return `[${host}]:${port.toString()}`;
}
return `${host}:${port.toString()}`;
}
// node_modules/minio/dist/esm/internal/post-policy.mjs
class PostPolicy {
policy = {
conditions: []
};
formData = {};
setExpires(date) {
if (!date) {
throw new InvalidDateError("Invalid date: cannot be null");
}
this.policy.expiration = date.toISOString();
}
setKey(objectName) {
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name : ${objectName}`);
}
this.policy.conditions.push(["eq", "$key", objectName]);
this.formData.key = objectName;
}
setKeyStartsWith(prefix) {
if (!isValidPrefix(prefix)) {
throw new InvalidPrefixError(`Invalid prefix : ${prefix}`);
}
this.policy.conditions.push(["starts-with", "$key", prefix]);
this.formData.key = prefix;
}
setBucket(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError(`Invalid bucket name : ${bucketName}`);
}
this.policy.conditions.push(["eq", "$bucket", bucketName]);
this.formData.bucket = bucketName;
}
setContentType(type) {
if (!type) {
throw new Error("content-type cannot be null");
}
this.policy.conditions.push(["eq", "$Content-Type", type]);
this.formData["Content-Type"] = type;
}
setContentTypeStartsWith(prefix) {
if (!prefix) {
throw new Error("content-type cannot be null");
}
this.policy.conditions.push(["starts-with", "$Content-Type", prefix]);
this.formData["Content-Type"] = prefix;
}
setContentDisposition(value) {
if (!value) {
throw new Error("content-disposition cannot be null");
}
this.policy.conditions.push(["eq", "$Content-Disposition", value]);
this.formData["Content-Disposition"] = value;
}
setContentLengthRange(min, max) {
if (min > max) {
throw new Error("min cannot be more than max");
}
if (min < 0) {
throw new Error("min should be > 0");
}
if (max < 0) {
throw new Error("max should be > 0");
}
this.policy.conditions.push(["content-length-range", min, max]);
}
setUserMetaData(metaData) {
if (!isObject(metaData)) {
throw new TypeError('metadata should be of type "object"');
}
Object.entries(metaData).forEach(([key, value]) => {
const amzMetaDataKey = `x-amz-meta-${key}`;
this.policy.conditions.push(["eq", `$${amzMetaDataKey}`, value]);
this.formData[amzMetaDataKey] = value.toString();
});
}
}
// node_modules/minio/dist/esm/internal/request.mjs
import { pipeline as pipeline2 } from "stream";
async function request(transport, opt, body = null) {
return new Promise((resolve, reject2) => {
const requestObj = transport.request(opt, (resp) => {
resolve(resp);
});
if (!body || Buffer.isBuffer(body) || typeof body === "string") {
requestObj.on("error", (e) => {
reject2(e);
}).end(body);
return;
}
pipeline2(body, requestObj, (err) => {
if (err) {
reject2(err);
}
});
});
}
// node_modules/minio/dist/esm/internal/s3-endpoints.mjs
var awsS3Endpoint = {
"us-east-1": "s3.amazonaws.com",
"us-east-2": "s3-us-east-2.amazonaws.com",
"us-west-1": "s3-us-west-1.amazonaws.com",
"us-west-2": "s3-us-west-2.amazonaws.com",
"ca-central-1": "s3.ca-central-1.amazonaws.com",
"eu-west-1": "s3-eu-west-1.amazonaws.com",
"eu-west-2": "s3-eu-west-2.amazonaws.com",
"sa-east-1": "s3-sa-east-1.amazonaws.com",
"eu-central-1": "s3-eu-central-1.amazonaws.com",
"ap-south-1": "s3-ap-south-1.amazonaws.com",
"ap-southeast-1": "s3-ap-southeast-1.amazonaws.com",
"ap-southeast-2": "s3-ap-southeast-2.amazonaws.com",
"ap-northeast-1": "s3-ap-northeast-1.amazonaws.com",
"cn-north-1": "s3.cn-north-1.amazonaws.com.cn",
"ap-east-1": "s3.ap-east-1.amazonaws.com",
"eu-north-1": "s3.eu-north-1.amazonaws.com"
};
function getS3Endpoint(region) {
if (!isString(region)) {
throw new TypeError(`Invalid region: ${region}`);
}
const endpoint = awsS3Endpoint[region];
if (endpoint) {
return endpoint;
}
return "s3.amazonaws.com";
}
// node_modules/minio/dist/esm/internal/client.mjs
var xml = new import_xml2js.default.Builder({
renderOpts: {
pretty: false
},
headless: true
});
var Package = {
version: "8.0.1"
};
var requestOptionProperties = ["agent", "ca", "cert", "ciphers", "clientCertEngine", "crl", "dhparam", "ecdhCurve", "family", "honorCipherOrder", "key", "passphrase", "pfx", "rejectUnauthorized", "secureOptions", "secureProtocol", "servername", "sessionIdContext"];
class TypedClient {
partSize = 64 * 1024 * 1024;
maximumPartSize = 5 * 1024 * 1024 * 1024;
maxObjectSize = 5 * 1024 * 1024 * 1024 * 1024;
constructor(params) {
if (params.secure !== undefined) {
throw new Error('"secure" option deprecated, "useSSL" should be used instead');
}
if (params.useSSL === undefined) {
params.useSSL = true;
}
if (!params.port) {
params.port = 0;
}
if (!isValidEndpoint(params.endPoint)) {
throw new InvalidEndpointError(`Invalid endPoint : ${params.endPoint}`);
}
if (!isValidPort(params.port)) {
throw new InvalidArgumentError(`Invalid port : ${params.port}`);
}
if (!isBoolean(params.useSSL)) {
throw new InvalidArgumentError(`Invalid useSSL flag type : ${params.useSSL}, expected to be of type "boolean"`);
}
if (params.region) {
if (!isString(params.region)) {
throw new InvalidArgumentError(`Invalid region : ${params.region}`);
}
}
const host = params.endPoint.toLowerCase();
let port = params.port;
let protocol;
let transport;
let transportAgent;
if (params.useSSL) {
transport = https;
protocol = "https:";
port = port || 443;
transportAgent = https.globalAgent;
} else {
transport = http;
protocol = "http:";
port = port || 80;
transportAgent = http.globalAgent;
}
if (params.transport) {
if (!isObject(params.transport)) {
throw new InvalidArgumentError(`Invalid transport type : ${params.transport}, expected to be type "object"`);
}
transport = params.transport;
}
if (params.transportAgent) {
if (!isObject(params.transportAgent)) {
throw new InvalidArgumentError(`Invalid transportAgent type: ${params.transportAgent}, expected to be type "object"`);
}
transportAgent = params.transportAgent;
}
const libraryComments = `(${process.platform}; ${process.arch})`;
const libraryAgent = `MinIO ${libraryComments} minio-js/${Package.version}`;
this.transport = transport;
this.transportAgent = transportAgent;
this.host = host;
this.port = port;
this.protocol = protocol;
this.userAgent = `${libraryAgent}`;
if (params.pathStyle === undefined) {
this.pathStyle = true;
} else {
this.pathStyle = params.pathStyle;
}
this.accessKey = params.accessKey ?? "";
this.secretKey = params.secretKey ?? "";
this.sessionToken = params.sessionToken;
this.anonymous = !this.accessKey || !this.secretKey;
if (params.credentialsProvider) {
this.credentialsProvider = params.credentialsProvider;
}
this.regionMap = {};
if (params.region) {
this.region = params.region;
}
if (params.partSize) {
this.partSize = params.partSize;
this.overRidePartSize = true;
}
if (this.partSize < 5 * 1024 * 1024) {
throw new InvalidArgumentError(`Part size should be greater than 5MB`);
}
if (this.partSize > 5 * 1024 * 1024 * 1024) {
throw new InvalidArgumentError(`Part size should be less than 5GB`);
}
this.enableSHA256 = !this.anonymous && !params.useSSL;
this.s3AccelerateEndpoint = params.s3AccelerateEndpoint || undefined;
this.reqOptions = {};
this.clientExtensions = new Extensions(this);
}
get extensions() {
return this.clientExtensions;
}
setS3TransferAccelerate(endPoint) {
this.s3AccelerateEndpoint = endPoint;
}
setRequestOptions(options) {
if (!isObject(options)) {
throw new TypeError('request options should be of type "object"');
}
this.reqOptions = import_lodash2.default.pick(options, requestOptionProperties);
}
getAccelerateEndPointIfSet(bucketName, objectName) {
if (!isEmpty(this.s3AccelerateEndpoint) && !isEmpty(bucketName) && !isEmpty(objectName)) {
if (bucketName.includes(".")) {
throw new Error(`Transfer Acceleration is not supported for non compliant bucket:${bucketName}`);
}
return this.s3AccelerateEndpoint;
}
return false;
}
setAppInfo(appName, appVersion) {
if (!isString(appName)) {
throw new TypeError(`Invalid appName: ${appName}`);
}
if (appName.trim() === "") {
throw new InvalidArgumentError("Input appName cannot be empty.");
}
if (!isString(appVersion)) {
throw new TypeError(`Invalid appVersion: ${appVersion}`);
}
if (appVersion.trim() === "") {
throw new InvalidArgumentError("Input appVersion cannot be empty.");
}
this.userAgent = `${this.userAgent} ${appName}/${appVersion}`;
}
getRequestOptions(opts) {
const method = opts.method;
const region = opts.region;
const bucketName = opts.bucketName;
let objectName = opts.objectName;
const headers = opts.headers;
const query = opts.query;
let reqOptions = {
method,
headers: {},
protocol: this.protocol,
agent: this.transportAgent
};
let virtualHostStyle;
if (bucketName) {
virtualHostStyle = isVirtualHostStyle(this.host, this.protocol, bucketName, this.pathStyle);
}
let path2 = "/";
let host = this.host;
let port;
if (this.port) {
port = this.port;
}
if (objectName) {
objectName = uriResourceEscape(objectName);
}
if (isAmazonEndpoint(host)) {
const accelerateEndPoint = this.getAccelerateEndPointIfSet(bucketName, objectName);
if (accelerateEndPoint) {
host = `${accelerateEndPoint}`;
} else {
host = getS3Endpoint(region);
}
}
if (virtualHostStyle && !opts.pathStyle) {
if (bucketName) {
host = `${bucketName}.${host}`;
}
if (objectName) {
path2 = `/${objectName}`;
}
} else {
if (bucketName) {
path2 = `/${bucketName}`;
}
if (objectName) {
path2 = `/${bucketName}/${objectName}`;
}
}
if (query) {
path2 += `?${query}`;
}
reqOptions.headers.host = host;
if (reqOptions.protocol === "http:" && port !== 80 || reqOptions.protocol === "https:" && port !== 443) {
reqOptions.headers.host = joinHostPort(host, port);
}
reqOptions.headers["user-agent"] = this.userAgent;
if (headers) {
for (const [k, v] of Object.entries(headers)) {
reqOptions.headers[k.toLowerCase()] = v;
}
}
reqOptions = Object.assign({}, this.reqOptions, reqOptions);
return {
...reqOptions,
headers: import_lodash2.default.mapValues(import_lodash2.default.pickBy(reqOptions.headers, isDefined), (v) => v.toString()),
host,
port,
path: path2
};
}
async setCredentialsProvider(credentialsProvider) {
if (!(credentialsProvider instanceof CredentialProvider)) {
throw new Error("Unable to get credentials. Expected instance of CredentialProvider");
}
this.credentialsProvider = credentialsProvider;
await this.checkAndRefreshCreds();
}
async checkAndRefreshCreds() {
if (this.credentialsProvider) {
try {
const credentialsConf = await this.credentialsProvider.getCredentials();
this.accessKey = credentialsConf.getAccessKey();
this.secretKey = credentialsConf.getSecretKey();
this.sessionToken = credentialsConf.getSessionToken();
} catch (e) {
throw new Error(`Unable to get credentials: ${e}`, {
cause: e
});
}
}
}
logHTTP(reqOptions, response, err) {
if (!this.logStream) {
return;
}
if (!isObject(reqOptions)) {
throw new TypeError('reqOptions should be of type "object"');
}
if (response && !isReadableStream(response)) {
throw new TypeError('response should be of type "Stream"');
}
if (err && !(err instanceof Error)) {
throw new TypeError('err should be of type "Error"');
}
const logStream = this.logStream;
const logHeaders = (headers) => {
Object.entries(headers).forEach(([k, v]) => {
if (k == "authorization") {
if (isString(v)) {
const redactor = new RegExp("Signature=([0-9a-f]+)");
v = v.replace(redactor, "Signature=**REDACTED**");
}
}
logStream.write(`${k}: ${v}
`);
});
logStream.write(`
`);
};
logStream.write(`REQUEST: ${reqOptions.method} ${reqOptions.path}
`);
logHeaders(reqOptions.headers);
if (response) {
this.logStream.write(`RESPONSE: ${response.statusCode}
`);
logHeaders(response.headers);
}
if (err) {
logStream.write(`ERROR BODY:
`);
const errJSON = JSON.stringify(err, null, "\t");
logStream.write(`${errJSON}
`);
}
}
traceOn(stream5) {
if (!stream5) {
stream5 = process.stdout;
}
this.logStream = stream5;
}
traceOff() {
this.logStream = undefined;
}
async makeRequestAsync(options, payload = "", expectedCodes = [200], region = "") {
if (!isObject(options)) {
throw new TypeError('options should be of type "object"');
}
if (!isString(payload) && !isObject(payload)) {
throw new TypeError('payload should be of type "string" or "Buffer"');
}
expectedCodes.forEach((statusCode) => {
if (!isNumber(statusCode)) {
throw new TypeError('statusCode should be of type "number"');
}
});
if (!isString(region)) {
throw new TypeError('region should be of type "string"');
}
if (!options.headers) {
options.headers = {};
}
if (options.method === "POST" || options.method === "PUT" || options.method === "DELETE") {
options.headers["content-length"] = payload.length.toString();
}
const sha256sum = this.enableSHA256 ? toSha256(payload) : "";
return this.makeRequestStreamAsync(options, payload, sha256sum, expectedCodes, region);
}
async makeRequestAsyncOmit(options, payload = "", statusCodes = [200], region = "") {
const res = await this.makeRequestAsync(options, payload, statusCodes, region);
await drainResponse(res);
return res;
}
async makeRequestStreamAsync(options, body, sha256sum, statusCodes, region) {
if (!isObject(options)) {
throw new TypeError('options should be of type "object"');
}
if (!(Buffer.isBuffer(body) || typeof body === "string" || isReadableStream(body))) {
throw new InvalidArgumentError(`stream should be a Buffer, string or readable Stream, got ${typeof body} instead`);
}
if (!isString(sha256sum)) {
throw new TypeError('sha256sum should be of type "string"');
}
statusCodes.forEach((statusCode) => {
if (!isNumber(statusCode)) {
throw new TypeError('statusCode should be of type "number"');
}
});
if (!isString(region)) {
throw new TypeError('region should be of type "string"');
}
if (!this.enableSHA256 && sha256sum.length !== 0) {
throw new InvalidArgumentError(`sha256sum expected to be empty for anonymous or https requests`);
}
if (this.enableSHA256 && sha256sum.length !== 64) {
throw new InvalidArgumentError(`Invalid sha256sum : ${sha256sum}`);
}
await this.checkAndRefreshCreds();
region = region || await this.getBucketRegionAsync(options.bucketName);
const reqOptions = this.getRequestOptions({
...options,
region
});
if (!this.anonymous) {
if (!this.enableSHA256) {
sha256sum = "UNSIGNED-PAYLOAD";
}
const date = new Date;
reqOptions.headers["x-amz-date"] = makeDateLong(date);
reqOptions.headers["x-amz-content-sha256"] = sha256sum;
if (this.sessionToken) {
reqOptions.headers["x-amz-security-token"] = this.sessionToken;
}
reqOptions.headers.authorization = signV4(reqOptions, this.accessKey, this.secretKey, region, date, sha256sum);
}
const response = await request(this.transport, reqOptions, body);
if (!response.statusCode) {
throw new Error("BUG: response doesn't have a statusCode");
}
if (!statusCodes.includes(response.statusCode)) {
delete this.regionMap[options.bucketName];
const err = await parseResponseError(response);
this.logHTTP(reqOptions, response, err);
throw err;
}
this.logHTTP(reqOptions, response);
return response;
}
async getBucketRegionAsync(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError(`Invalid bucket name : ${bucketName}`);
}
if (this.region) {
return this.region;
}
const cached = this.regionMap[bucketName];
if (cached) {
return cached;
}
const extractRegionAsync = async (response) => {
const body = await readAsString(response);
const region2 = parseBucketRegion(body) || DEFAULT_REGION;
this.regionMap[bucketName] = region2;
return region2;
};
const method = "GET";
const query = "location";
const pathStyle = this.pathStyle && !import_browser_or_node.isBrowser;
let region;
try {
const res2 = await this.makeRequestAsync({
method,
bucketName,
query,
pathStyle
}, "", [200], DEFAULT_REGION);
return extractRegionAsync(res2);
} catch (e) {
if (!(e.name === "AuthorizationHeaderMalformed")) {
throw e;
}
region = e.Region;
if (!region) {
throw e;
}
}
const res = await this.makeRequestAsync({
method,
bucketName,
query,
pathStyle
}, "", [200], region);
return await extractRegionAsync(res);
}
makeRequest(options, payload = "", expectedCodes = [200], region = "", returnResponse, cb) {
let prom;
if (returnResponse) {
prom = this.makeRequestAsync(options, payload, expectedCodes, region);
} else {
prom = this.makeRequestAsyncOmit(options, payload, expectedCodes, region);
}
prom.then((result) => cb(null, result), (err) => {
cb(err);
});
}
makeRequestStream(options, stream5, sha256sum, statusCodes, region, returnResponse, cb) {
const executor = async () => {
const res = await this.makeRequestStreamAsync(options, stream5, sha256sum, statusCodes, region);
if (!returnResponse) {
await drainResponse(res);
}
return res;
};
executor().then((result) => cb(null, result), (err) => cb(err));
}
getBucketRegion(bucketName, cb) {
return this.getBucketRegionAsync(bucketName).then((result) => cb(null, result), (err) => cb(err));
}
async makeBucket(bucketName, region = "", makeOpts = {}) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (isObject(region)) {
makeOpts = region;
region = "";
}
if (!isString(region)) {
throw new TypeError('region should be of type "string"');
}
if (!isObject(makeOpts)) {
throw new TypeError('makeOpts should be of type "object"');
}
let payload = "";
if (region && this.region) {
if (region !== this.region) {
throw new InvalidArgumentError(`Configured region ${this.region}, requested ${region}`);
}
}
if (region && region !== DEFAULT_REGION) {
payload = xml.buildObject({
CreateBucketConfiguration: {
$: {
xmlns: "http://s3.amazonaws.com/doc/2006-03-01/"
},
LocationConstraint: region
}
});
}
const method = "PUT";
const headers = {};
if (makeOpts.ObjectLocking) {
headers["x-amz-bucket-object-lock-enabled"] = true;
}
const finalRegion = this.region || region || DEFAULT_REGION;
const requestOpt = {
method,
bucketName,
headers
};
try {
await this.makeRequestAsyncOmit(requestOpt, payload, [200], finalRegion);
} catch (err) {
if (region === "" || region === DEFAULT_REGION) {
if (err instanceof S3Error) {
const errCode = err.code;
const errRegion = err.region;
if (errCode === "AuthorizationHeaderMalformed" && errRegion !== "") {
await this.makeRequestAsyncOmit(requestOpt, payload, [200], errCode);
}
}
}
throw err;
}
}
async bucketExists(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
const method = "HEAD";
try {
await this.makeRequestAsyncOmit({
method,
bucketName
});
} catch (err) {
if (err.code === "NoSuchBucket" || err.code === "NotFound") {
return false;
}
throw err;
}
return true;
}
async removeBucket(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
const method = "DELETE";
await this.makeRequestAsyncOmit({
method,
bucketName
}, "", [204]);
delete this.regionMap[bucketName];
}
async getObject(bucketName, objectName, getOpts = {}) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
return this.getPartialObject(bucketName, objectName, 0, 0, getOpts);
}
async getPartialObject(bucketName, objectName, offset, length = 0, getOpts = {}) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (!isNumber(offset)) {
throw new TypeError('offset should be of type "number"');
}
if (!isNumber(length)) {
throw new TypeError('length should be of type "number"');
}
let range = "";
if (offset || length) {
if (offset) {
range = `bytes=${+offset}-`;
} else {
range = "bytes=0-";
offset = 0;
}
if (length) {
range += `${+length + offset - 1}`;
}
}
const sseHeaders = {
...getOpts.SSECustomerAlgorithm && {
"X-Amz-Server-Side-Encryption-Customer-Algorithm": getOpts.SSECustomerAlgorithm
},
...getOpts.SSECustomerKey && {
"X-Amz-Server-Side-Encryption-Customer-Key": getOpts.SSECustomerKey
},
...getOpts.SSECustomerKeyMD5 && {
"X-Amz-Server-Side-Encryption-Customer-Key-MD5": getOpts.SSECustomerKeyMD5
}
};
const headers = {
...prependXAMZMeta(sseHeaders),
...range !== "" && {
range
}
};
const expectedStatusCodes = [200];
if (range) {
expectedStatusCodes.push(206);
}
const method = "GET";
const query = $stringify(getOpts);
return await this.makeRequestAsync({
method,
bucketName,
objectName,
headers,
query
}, "", expectedStatusCodes);
}
async fGetObject(bucketName, objectName, filePath, getOpts = {}) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (!isString(filePath)) {
throw new TypeError('filePath should be of type "string"');
}
const downloadToTmpFile = async () => {
let partFileStream;
const objStat = await this.statObject(bucketName, objectName, getOpts);
const partFile2 = `${filePath}.${objStat.etag}.part.minio`;
await promises.mkdir(path.dirname(filePath), {
recursive: true
});
let offset = 0;
try {
const stats2 = await promises.stat(partFile2);
if (objStat.size === stats2.size) {
return partFile2;
}
offset = stats2.size;
partFileStream = fs2.createWriteStream(partFile2, {
flags: "a"
});
} catch (e) {
if (e instanceof Error && e.code === "ENOENT") {
partFileStream = fs2.createWriteStream(partFile2, {
flags: "w"
});
} else {
throw e;
}
}
const downloadStream = await this.getPartialObject(bucketName, objectName, offset, 0, getOpts);
await streamPromise.pipeline(downloadStream, partFileStream);
const stats = await promises.stat(partFile2);
if (stats.size === objStat.size) {
return partFile2;
}
throw new Error("Size mismatch between downloaded file and the object");
};
const partFile = await downloadToTmpFile();
await promises.rename(partFile, filePath);
}
async statObject(bucketName, objectName, statOpts = {}) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (!isObject(statOpts)) {
throw new InvalidArgumentError('statOpts should be of type "object"');
}
const query = $stringify(statOpts);
const method = "HEAD";
const res = await this.makeRequestAsyncOmit({
method,
bucketName,
objectName,
query
});
return {
size: parseInt(res.headers["content-length"]),
metaData: extractMetadata(res.headers),
lastModified: new Date(res.headers["last-modified"]),
versionId: getVersionId(res.headers),
etag: sanitizeETag(res.headers.etag)
};
}
async removeObject(bucketName, objectName, removeOpts) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (removeOpts && !isObject(removeOpts)) {
throw new InvalidArgumentError('removeOpts should be of type "object"');
}
const method = "DELETE";
const headers = {};
if (removeOpts !== null && removeOpts !== undefined && removeOpts.governanceBypass) {
headers["X-Amz-Bypass-Governance-Retention"] = true;
}
if (removeOpts !== null && removeOpts !== undefined && removeOpts.forceDelete) {
headers["x-minio-force-delete"] = true;
}
const queryParams = {};
if (removeOpts !== null && removeOpts !== undefined && removeOpts.versionId) {
queryParams.versionId = `${removeOpts.versionId}`;
}
const query = $stringify(queryParams);
await this.makeRequestAsyncOmit({
method,
bucketName,
objectName,
headers,
query
}, "", [200, 204]);
}
listIncompleteUploads(bucket, prefix, recursive) {
if (prefix === undefined) {
prefix = "";
}
if (recursive === undefined) {
recursive = false;
}
if (!isValidBucketName(bucket)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucket);
}
if (!isValidPrefix(prefix)) {
throw new InvalidPrefixError(`Invalid prefix : ${prefix}`);
}
if (!isBoolean(recursive)) {
throw new TypeError('recursive should be of type "boolean"');
}
const delimiter = recursive ? "" : "/";
let keyMarker = "";
let uploadIdMarker = "";
const uploads = [];
let ended = false;
const readStream = new stream4.Readable({
objectMode: true
});
readStream._read = () => {
if (uploads.length) {
return readStream.push(uploads.shift());
}
if (ended) {
return readStream.push(null);
}
this.listIncompleteUploadsQuery(bucket, prefix, keyMarker, uploadIdMarker, delimiter).then((result) => {
result.prefixes.forEach((prefix2) => uploads.push(prefix2));
eachSeries$1(result.uploads, (upload, cb) => {
this.listParts(bucket, upload.key, upload.uploadId).then((parts) => {
upload.size = parts.reduce((acc, item) => acc + item.size, 0);
uploads.push(upload);
cb();
}, (err) => cb(err));
}, (err) => {
if (err) {
readStream.emit("error", err);
return;
}
if (result.isTruncated) {
keyMarker = result.nextKeyMarker;
uploadIdMarker = result.nextUploadIdMarker;
} else {
ended = true;
}
readStream._read();
});
}, (e) => {
readStream.emit("error", e);
});
};
return readStream;
}
async listIncompleteUploadsQuery(bucketName, prefix, keyMarker, uploadIdMarker, delimiter) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isString(prefix)) {
throw new TypeError('prefix should be of type "string"');
}
if (!isString(keyMarker)) {
throw new TypeError('keyMarker should be of type "string"');
}
if (!isString(uploadIdMarker)) {
throw new TypeError('uploadIdMarker should be of type "string"');
}
if (!isString(delimiter)) {
throw new TypeError('delimiter should be of type "string"');
}
const queries = [];
queries.push(`prefix=${uriEscape(prefix)}`);
queries.push(`delimiter=${uriEscape(delimiter)}`);
if (keyMarker) {
queries.push(`key-marker=${uriEscape(keyMarker)}`);
}
if (uploadIdMarker) {
queries.push(`upload-id-marker=${uploadIdMarker}`);
}
const maxUploads = 1000;
queries.push(`max-uploads=${maxUploads}`);
queries.sort();
queries.unshift("uploads");
let query = "";
if (queries.length > 0) {
query = `${queries.join("&")}`;
}
const method = "GET";
const res = await this.makeRequestAsync({
method,
bucketName,
query
});
const body = await readAsString(res);
return parseListMultipart(body);
}
async initiateNewMultipartUpload(bucketName, objectName, headers) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (!isObject(headers)) {
throw new InvalidObjectNameError('contentType should be of type "object"');
}
const method = "POST";
const query = "uploads";
const res = await this.makeRequestAsync({
method,
bucketName,
objectName,
query,
headers
});
const body = await readAsBuffer(res);
return parseInitiateMultipart(body.toString());
}
async abortMultipartUpload(bucketName, objectName, uploadId) {
const method = "DELETE";
const query = `uploadId=${uploadId}`;
const requestOptions = {
method,
bucketName,
objectName,
query
};
await this.makeRequestAsyncOmit(requestOptions, "", [204]);
}
async findUploadId(bucketName, objectName) {
var _latestUpload;
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
let latestUpload;
let keyMarker = "";
let uploadIdMarker = "";
for (;; ) {
const result = await this.listIncompleteUploadsQuery(bucketName, objectName, keyMarker, uploadIdMarker, "");
for (const upload of result.uploads) {
if (upload.key === objectName) {
if (!latestUpload || upload.initiated.getTime() > latestUpload.initiated.getTime()) {
latestUpload = upload;
}
}
}
if (result.isTruncated) {
keyMarker = result.nextKeyMarker;
uploadIdMarker = result.nextUploadIdMarker;
continue;
}
break;
}
return (_latestUpload = latestUpload) === null || _latestUpload === undefined ? undefined : _latestUpload.uploadId;
}
async completeMultipartUpload(bucketName, objectName, uploadId, etags) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (!isString(uploadId)) {
throw new TypeError('uploadId should be of type "string"');
}
if (!isObject(etags)) {
throw new TypeError('etags should be of type "Array"');
}
if (!uploadId) {
throw new InvalidArgumentError("uploadId cannot be empty");
}
const method = "POST";
const query = `uploadId=${uriEscape(uploadId)}`;
const builder = new import_xml2js.default.Builder;
const payload = builder.buildObject({
CompleteMultipartUpload: {
$: {
xmlns: "http://s3.amazonaws.com/doc/2006-03-01/"
},
Part: etags.map((etag) => {
return {
PartNumber: etag.part,
ETag: etag.etag
};
})
}
});
const res = await this.makeRequestAsync({
method,
bucketName,
objectName,
query
}, payload);
const body = await readAsBuffer(res);
const result = parseCompleteMultipart(body.toString());
if (!result) {
throw new Error("BUG: failed to parse server response");
}
if (result.errCode) {
throw new S3Error(result.errMessage);
}
return {
etag: result.etag,
versionId: getVersionId(res.headers)
};
}
async listParts(bucketName, objectName, uploadId) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (!isString(uploadId)) {
throw new TypeError('uploadId should be of type "string"');
}
if (!uploadId) {
throw new InvalidArgumentError("uploadId cannot be empty");
}
const parts = [];
let marker = 0;
let result;
do {
result = await this.listPartsQuery(bucketName, objectName, uploadId, marker);
marker = result.marker;
parts.push(...result.parts);
} while (result.isTruncated);
return parts;
}
async listPartsQuery(bucketName, objectName, uploadId, marker) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (!isString(uploadId)) {
throw new TypeError('uploadId should be of type "string"');
}
if (!isNumber(marker)) {
throw new TypeError('marker should be of type "number"');
}
if (!uploadId) {
throw new InvalidArgumentError("uploadId cannot be empty");
}
let query = `uploadId=${uriEscape(uploadId)}`;
if (marker) {
query += `&part-number-marker=${marker}`;
}
const method = "GET";
const res = await this.makeRequestAsync({
method,
bucketName,
objectName,
query
});
return parseListParts(await readAsString(res));
}
async listBuckets() {
const method = "GET";
const regionConf = this.region || DEFAULT_REGION;
const httpRes = await this.makeRequestAsync({
method
}, "", [200], regionConf);
const xmlResult = await readAsString(httpRes);
return parseListBucket(xmlResult);
}
calculatePartSize(size) {
if (!isNumber(size)) {
throw new TypeError('size should be of type "number"');
}
if (size > this.maxObjectSize) {
throw new TypeError(`size should not be more than ${this.maxObjectSize}`);
}
if (this.overRidePartSize) {
return this.partSize;
}
let partSize = this.partSize;
for (;; ) {
if (partSize * 1e4 > size) {
return partSize;
}
partSize += 16 * 1024 * 1024;
}
}
async fPutObject(bucketName, objectName, filePath, metaData = {}) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (!isString(filePath)) {
throw new TypeError('filePath should be of type "string"');
}
if (!isObject(metaData)) {
throw new TypeError('metaData should be of type "object"');
}
metaData = insertContentType(metaData, filePath);
const stat = await promises.lstat(filePath);
await this.putObject(bucketName, objectName, fs2.createReadStream(filePath), stat.size, metaData);
}
async putObject(bucketName, objectName, stream5, size, metaData) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (isObject(size)) {
metaData = size;
}
const headers = prependXAMZMeta(metaData);
if (typeof stream5 === "string" || stream5 instanceof Buffer) {
size = stream5.length;
stream5 = readableStream(stream5);
} else if (!isReadableStream(stream5)) {
throw new TypeError('third argument should be of type "stream.Readable" or "Buffer" or "string"');
}
if (isNumber(size) && size < 0) {
throw new InvalidArgumentError(`size cannot be negative, given size: ${size}`);
}
if (!isNumber(size)) {
size = this.maxObjectSize;
}
if (size === undefined) {
const statSize = await getContentLength(stream5);
if (statSize !== null) {
size = statSize;
}
}
if (!isNumber(size)) {
size = this.maxObjectSize;
}
const partSize = this.calculatePartSize(size);
if (typeof stream5 === "string" || Buffer.isBuffer(stream5) || size <= partSize) {
const buf = isReadableStream(stream5) ? await readAsBuffer(stream5) : Buffer.from(stream5);
return this.uploadBuffer(bucketName, objectName, headers, buf);
}
return this.uploadStream(bucketName, objectName, headers, stream5, partSize);
}
async uploadBuffer(bucketName, objectName, headers, buf) {
const {
md5sum,
sha256sum
} = hashBinary(buf, this.enableSHA256);
headers["Content-Length"] = buf.length;
if (!this.enableSHA256) {
headers["Content-MD5"] = md5sum;
}
const res = await this.makeRequestStreamAsync({
method: "PUT",
bucketName,
objectName,
headers
}, buf, sha256sum, [200], "");
await drainResponse(res);
return {
etag: sanitizeETag(res.headers.etag),
versionId: getVersionId(res.headers)
};
}
async uploadStream(bucketName, objectName, headers, body, partSize) {
const oldParts = {};
const eTags = [];
const previousUploadId = await this.findUploadId(bucketName, objectName);
let uploadId;
if (!previousUploadId) {
uploadId = await this.initiateNewMultipartUpload(bucketName, objectName, headers);
} else {
uploadId = previousUploadId;
const oldTags = await this.listParts(bucketName, objectName, previousUploadId);
oldTags.forEach((e) => {
oldTags[e.part] = e;
});
}
const chunkier = new import_block_stream2.default({
size: partSize,
zeroPadding: false
});
const [_3, o] = await Promise.all([new Promise((resolve, reject2) => {
body.pipe(chunkier).on("error", reject2);
chunkier.on("end", resolve).on("error", reject2);
}), (async () => {
let partNumber = 1;
for await (const chunk of chunkier) {
const md5 = crypto3.createHash("md5").update(chunk).digest();
const oldPart = oldParts[partNumber];
if (oldPart) {
if (oldPart.etag === md5.toString("hex")) {
eTags.push({
part: partNumber,
etag: oldPart.etag
});
partNumber++;
continue;
}
}
partNumber++;
const options = {
method: "PUT",
query: $stringify({
partNumber,
uploadId
}),
headers: {
"Content-Length": chunk.length,
"Content-MD5": md5.toString("base64")
},
bucketName,
objectName
};
const response = await this.makeRequestAsyncOmit(options, chunk);
let etag = response.headers.etag;
if (etag) {
etag = etag.replace(/^"/, "").replace(/"$/, "");
} else {
etag = "";
}
eTags.push({
part: partNumber,
etag
});
}
return await this.completeMultipartUpload(bucketName, objectName, uploadId, eTags);
})()]);
return o;
}
async removeBucketReplication(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
const method = "DELETE";
const query = "replication";
await this.makeRequestAsyncOmit({
method,
bucketName,
query
}, "", [200, 204], "");
}
async setBucketReplication(bucketName, replicationConfig) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isObject(replicationConfig)) {
throw new InvalidArgumentError('replicationConfig should be of type "object"');
} else {
if (import_lodash2.default.isEmpty(replicationConfig.role)) {
throw new InvalidArgumentError("Role cannot be empty");
} else if (replicationConfig.role && !isString(replicationConfig.role)) {
throw new InvalidArgumentError("Invalid value for role", replicationConfig.role);
}
if (import_lodash2.default.isEmpty(replicationConfig.rules)) {
throw new InvalidArgumentError("Minimum one replication rule must be specified");
}
}
const method = "PUT";
const query = "replication";
const headers = {};
const replicationParamsConfig = {
ReplicationConfiguration: {
Role: replicationConfig.role,
Rule: replicationConfig.rules
}
};
const builder = new import_xml2js.default.Builder({
renderOpts: {
pretty: false
},
headless: true
});
const payload = builder.buildObject(replicationParamsConfig);
headers["Content-MD5"] = toMd5(payload);
await this.makeRequestAsyncOmit({
method,
bucketName,
query,
headers
}, payload);
}
async getBucketReplication(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
const method = "GET";
const query = "replication";
const httpRes = await this.makeRequestAsync({
method,
bucketName,
query
}, "", [200, 204]);
const xmlResult = await readAsString(httpRes);
return parseReplicationConfig(xmlResult);
}
async getObjectLegalHold(bucketName, objectName, getOpts) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (getOpts) {
if (!isObject(getOpts)) {
throw new TypeError('getOpts should be of type "Object"');
} else if (Object.keys(getOpts).length > 0 && getOpts.versionId && !isString(getOpts.versionId)) {
throw new TypeError("versionId should be of type string.:", getOpts.versionId);
}
}
const method = "GET";
let query = "legal-hold";
if (getOpts !== null && getOpts !== undefined && getOpts.versionId) {
query += `&versionId=${getOpts.versionId}`;
}
const httpRes = await this.makeRequestAsync({
method,
bucketName,
objectName,
query
}, "", [200]);
const strRes = await readAsString(httpRes);
return parseObjectLegalHoldConfig(strRes);
}
async setObjectLegalHold(bucketName, objectName, setOpts = {
status: LEGAL_HOLD_STATUS.ENABLED
}) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (!isObject(setOpts)) {
throw new TypeError('setOpts should be of type "Object"');
} else {
if (![LEGAL_HOLD_STATUS.ENABLED, LEGAL_HOLD_STATUS.DISABLED].includes(setOpts === null || setOpts === undefined ? undefined : setOpts.status)) {
throw new TypeError("Invalid status: " + setOpts.status);
}
if (setOpts.versionId && !setOpts.versionId.length) {
throw new TypeError("versionId should be of type string.:" + setOpts.versionId);
}
}
const method = "PUT";
let query = "legal-hold";
if (setOpts.versionId) {
query += `&versionId=${setOpts.versionId}`;
}
const config = {
Status: setOpts.status
};
const builder = new import_xml2js.default.Builder({
rootName: "LegalHold",
renderOpts: {
pretty: false
},
headless: true
});
const payload = builder.buildObject(config);
const headers = {};
headers["Content-MD5"] = toMd5(payload);
await this.makeRequestAsyncOmit({
method,
bucketName,
objectName,
query,
headers
}, payload);
}
async getBucketTagging(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
}
const method = "GET";
const query = "tagging";
const requestOptions = {
method,
bucketName,
query
};
const response = await this.makeRequestAsync(requestOptions);
const body = await readAsString(response);
return parseTagging(body);
}
async getObjectTagging(bucketName, objectName, getOpts = {}) {
const method = "GET";
let query = "tagging";
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidBucketNameError("Invalid object name: " + objectName);
}
if (!isObject(getOpts)) {
throw new InvalidArgumentError('getOpts should be of type "object"');
}
if (getOpts && getOpts.versionId) {
query = `${query}&versionId=${getOpts.versionId}`;
}
const requestOptions = {
method,
bucketName,
query
};
if (objectName) {
requestOptions["objectName"] = objectName;
}
const response = await this.makeRequestAsync(requestOptions);
const body = await readAsString(response);
return parseTagging(body);
}
async setBucketPolicy(bucketName, policy) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
}
if (!isString(policy)) {
throw new InvalidBucketPolicyError(`Invalid bucket policy: ${policy} - must be "string"`);
}
const query = "policy";
let method = "DELETE";
if (policy) {
method = "PUT";
}
await this.makeRequestAsyncOmit({
method,
bucketName,
query
}, policy, [204], "");
}
async getBucketPolicy(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
}
const method = "GET";
const query = "policy";
const res = await this.makeRequestAsync({
method,
bucketName,
query
});
return await readAsString(res);
}
async putObjectRetention(bucketName, objectName, retentionOpts = {}) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (!isObject(retentionOpts)) {
throw new InvalidArgumentError('retentionOpts should be of type "object"');
} else {
if (retentionOpts.governanceBypass && !isBoolean(retentionOpts.governanceBypass)) {
throw new InvalidArgumentError(`Invalid value for governanceBypass: ${retentionOpts.governanceBypass}`);
}
if (retentionOpts.mode && ![RETENTION_MODES.COMPLIANCE, RETENTION_MODES.GOVERNANCE].includes(retentionOpts.mode)) {
throw new InvalidArgumentError(`Invalid object retention mode: ${retentionOpts.mode}`);
}
if (retentionOpts.retainUntilDate && !isString(retentionOpts.retainUntilDate)) {
throw new InvalidArgumentError(`Invalid value for retainUntilDate: ${retentionOpts.retainUntilDate}`);
}
if (retentionOpts.versionId && !isString(retentionOpts.versionId)) {
throw new InvalidArgumentError(`Invalid value for versionId: ${retentionOpts.versionId}`);
}
}
const method = "PUT";
let query = "retention";
const headers = {};
if (retentionOpts.governanceBypass) {
headers["X-Amz-Bypass-Governance-Retention"] = true;
}
const builder = new import_xml2js.default.Builder({
rootName: "Retention",
renderOpts: {
pretty: false
},
headless: true
});
const params = {};
if (retentionOpts.mode) {
params.Mode = retentionOpts.mode;
}
if (retentionOpts.retainUntilDate) {
params.RetainUntilDate = retentionOpts.retainUntilDate;
}
if (retentionOpts.versionId) {
query += `&versionId=${retentionOpts.versionId}`;
}
const payload = builder.buildObject(params);
headers["Content-MD5"] = toMd5(payload);
await this.makeRequestAsyncOmit({
method,
bucketName,
objectName,
query,
headers
}, payload, [200, 204]);
}
async getObjectLockConfig(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
const method = "GET";
const query = "object-lock";
const httpRes = await this.makeRequestAsync({
method,
bucketName,
query
});
const xmlResult = await readAsString(httpRes);
return parseObjectLockConfig(xmlResult);
}
async setObjectLockConfig(bucketName, lockConfigOpts) {
const retentionModes = [RETENTION_MODES.COMPLIANCE, RETENTION_MODES.GOVERNANCE];
const validUnits = [RETENTION_VALIDITY_UNITS.DAYS, RETENTION_VALIDITY_UNITS.YEARS];
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (lockConfigOpts.mode && !retentionModes.includes(lockConfigOpts.mode)) {
throw new TypeError(`lockConfigOpts.mode should be one of ${retentionModes}`);
}
if (lockConfigOpts.unit && !validUnits.includes(lockConfigOpts.unit)) {
throw new TypeError(`lockConfigOpts.unit should be one of ${validUnits}`);
}
if (lockConfigOpts.validity && !isNumber(lockConfigOpts.validity)) {
throw new TypeError(`lockConfigOpts.validity should be a number`);
}
const method = "PUT";
const query = "object-lock";
const config = {
ObjectLockEnabled: "Enabled"
};
const configKeys = Object.keys(lockConfigOpts);
const isAllKeysSet = ["unit", "mode", "validity"].every((lck) => configKeys.includes(lck));
if (configKeys.length > 0) {
if (!isAllKeysSet) {
throw new TypeError(`lockConfigOpts.mode,lockConfigOpts.unit,lockConfigOpts.validity all the properties should be specified.`);
} else {
config.Rule = {
DefaultRetention: {}
};
if (lockConfigOpts.mode) {
config.Rule.DefaultRetention.Mode = lockConfigOpts.mode;
}
if (lockConfigOpts.unit === RETENTION_VALIDITY_UNITS.DAYS) {
config.Rule.DefaultRetention.Days = lockConfigOpts.validity;
} else if (lockConfigOpts.unit === RETENTION_VALIDITY_UNITS.YEARS) {
config.Rule.DefaultRetention.Years = lockConfigOpts.validity;
}
}
}
const builder = new import_xml2js.default.Builder({
rootName: "ObjectLockConfiguration",
renderOpts: {
pretty: false
},
headless: true
});
const payload = builder.buildObject(config);
const headers = {};
headers["Content-MD5"] = toMd5(payload);
await this.makeRequestAsyncOmit({
method,
bucketName,
query,
headers
}, payload);
}
async getBucketVersioning(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
const method = "GET";
const query = "versioning";
const httpRes = await this.makeRequestAsync({
method,
bucketName,
query
});
const xmlResult = await readAsString(httpRes);
return await parseBucketVersioningConfig(xmlResult);
}
async setBucketVersioning(bucketName, versionConfig) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!Object.keys(versionConfig).length) {
throw new InvalidArgumentError('versionConfig should be of type "object"');
}
const method = "PUT";
const query = "versioning";
const builder = new import_xml2js.default.Builder({
rootName: "VersioningConfiguration",
renderOpts: {
pretty: false
},
headless: true
});
const payload = builder.buildObject(versionConfig);
await this.makeRequestAsyncOmit({
method,
bucketName,
query
}, payload);
}
async setTagging(taggingParams) {
const {
bucketName,
objectName,
tags,
putOpts
} = taggingParams;
const method = "PUT";
let query = "tagging";
if (putOpts && putOpts !== null && putOpts !== undefined && putOpts.versionId) {
query = `${query}&versionId=${putOpts.versionId}`;
}
const tagsList = [];
for (const [key, value] of Object.entries(tags)) {
tagsList.push({
Key: key,
Value: value
});
}
const taggingConfig = {
Tagging: {
TagSet: {
Tag: tagsList
}
}
};
const headers = {};
const builder = new import_xml2js.default.Builder({
headless: true,
renderOpts: {
pretty: false
}
});
const payloadBuf = Buffer.from(builder.buildObject(taggingConfig));
const requestOptions = {
method,
bucketName,
query,
headers,
...objectName && {
objectName
}
};
headers["Content-MD5"] = toMd5(payloadBuf);
await this.makeRequestAsyncOmit(requestOptions, payloadBuf);
}
async removeTagging({
bucketName,
objectName,
removeOpts
}) {
const method = "DELETE";
let query = "tagging";
if (removeOpts && Object.keys(removeOpts).length && removeOpts.versionId) {
query = `${query}&versionId=${removeOpts.versionId}`;
}
const requestOptions = {
method,
bucketName,
objectName,
query
};
if (objectName) {
requestOptions["objectName"] = objectName;
}
await this.makeRequestAsync(requestOptions, "", [200, 204]);
}
async setBucketTagging(bucketName, tags) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isObject(tags)) {
throw new InvalidArgumentError('tags should be of type "object"');
}
if (Object.keys(tags).length > 10) {
throw new InvalidArgumentError('maximum tags allowed is 10"');
}
await this.setTagging({
bucketName,
tags
});
}
async removeBucketTagging(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
await this.removeTagging({
bucketName
});
}
async setObjectTagging(bucketName, objectName, tags, putOpts) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidBucketNameError("Invalid object name: " + objectName);
}
if (!isObject(tags)) {
throw new InvalidArgumentError('tags should be of type "object"');
}
if (Object.keys(tags).length > 10) {
throw new InvalidArgumentError('Maximum tags allowed is 10"');
}
await this.setTagging({
bucketName,
objectName,
tags,
putOpts
});
}
async removeObjectTagging(bucketName, objectName, removeOpts) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidBucketNameError("Invalid object name: " + objectName);
}
if (removeOpts && Object.keys(removeOpts).length && !isObject(removeOpts)) {
throw new InvalidArgumentError('removeOpts should be of type "object"');
}
await this.removeTagging({
bucketName,
objectName,
removeOpts
});
}
async selectObjectContent(bucketName, objectName, selectOpts) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (!import_lodash2.default.isEmpty(selectOpts)) {
if (!isString(selectOpts.expression)) {
throw new TypeError('sqlExpression should be of type "string"');
}
if (!import_lodash2.default.isEmpty(selectOpts.inputSerialization)) {
if (!isObject(selectOpts.inputSerialization)) {
throw new TypeError('inputSerialization should be of type "object"');
}
} else {
throw new TypeError("inputSerialization is required");
}
if (!import_lodash2.default.isEmpty(selectOpts.outputSerialization)) {
if (!isObject(selectOpts.outputSerialization)) {
throw new TypeError('outputSerialization should be of type "object"');
}
} else {
throw new TypeError("outputSerialization is required");
}
} else {
throw new TypeError("valid select configuration is required");
}
const method = "POST";
const query = `select&select-type=2`;
const config = [{
Expression: selectOpts.expression
}, {
ExpressionType: selectOpts.expressionType || "SQL"
}, {
InputSerialization: [selectOpts.inputSerialization]
}, {
OutputSerialization: [selectOpts.outputSerialization]
}];
if (selectOpts.requestProgress) {
config.push({
RequestProgress: selectOpts === null || selectOpts === undefined ? undefined : selectOpts.requestProgress
});
}
if (selectOpts.scanRange) {
config.push({
ScanRange: selectOpts.scanRange
});
}
const builder = new import_xml2js.default.Builder({
rootName: "SelectObjectContentRequest",
renderOpts: {
pretty: false
},
headless: true
});
const payload = builder.buildObject(config);
const res = await this.makeRequestAsync({
method,
bucketName,
objectName,
query
}, payload);
const body = await readAsBuffer(res);
return parseSelectObjectContentResponse(body);
}
async applyBucketLifecycle(bucketName, policyConfig) {
const method = "PUT";
const query = "lifecycle";
const headers = {};
const builder = new import_xml2js.default.Builder({
rootName: "LifecycleConfiguration",
headless: true,
renderOpts: {
pretty: false
}
});
const payload = builder.buildObject(policyConfig);
headers["Content-MD5"] = toMd5(payload);
await this.makeRequestAsyncOmit({
method,
bucketName,
query,
headers
}, payload);
}
async removeBucketLifecycle(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
const method = "DELETE";
const query = "lifecycle";
await this.makeRequestAsyncOmit({
method,
bucketName,
query
}, "", [204]);
}
async setBucketLifecycle(bucketName, lifeCycleConfig) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (import_lodash2.default.isEmpty(lifeCycleConfig)) {
await this.removeBucketLifecycle(bucketName);
} else {
await this.applyBucketLifecycle(bucketName, lifeCycleConfig);
}
}
async getBucketLifecycle(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
const method = "GET";
const query = "lifecycle";
const res = await this.makeRequestAsync({
method,
bucketName,
query
});
const body = await readAsString(res);
return parseLifecycleConfig(body);
}
async setBucketEncryption(bucketName, encryptionConfig) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!import_lodash2.default.isEmpty(encryptionConfig) && encryptionConfig.Rule.length > 1) {
throw new InvalidArgumentError("Invalid Rule length. Only one rule is allowed.: " + encryptionConfig.Rule);
}
let encryptionObj = encryptionConfig;
if (import_lodash2.default.isEmpty(encryptionConfig)) {
encryptionObj = {
Rule: [{
ApplyServerSideEncryptionByDefault: {
SSEAlgorithm: "AES256"
}
}]
};
}
const method = "PUT";
const query = "encryption";
const builder = new import_xml2js.default.Builder({
rootName: "ServerSideEncryptionConfiguration",
renderOpts: {
pretty: false
},
headless: true
});
const payload = builder.buildObject(encryptionObj);
const headers = {};
headers["Content-MD5"] = toMd5(payload);
await this.makeRequestAsyncOmit({
method,
bucketName,
query,
headers
}, payload);
}
async getBucketEncryption(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
const method = "GET";
const query = "encryption";
const res = await this.makeRequestAsync({
method,
bucketName,
query
});
const body = await readAsString(res);
return parseBucketEncryptionConfig(body);
}
async removeBucketEncryption(bucketName) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
const method = "DELETE";
const query = "encryption";
await this.makeRequestAsyncOmit({
method,
bucketName,
query
}, "", [204]);
}
async getObjectRetention(bucketName, objectName, getOpts) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (getOpts && !isObject(getOpts)) {
throw new InvalidArgumentError('getOpts should be of type "object"');
} else if (getOpts !== null && getOpts !== undefined && getOpts.versionId && !isString(getOpts.versionId)) {
throw new InvalidArgumentError('versionId should be of type "string"');
}
const method = "GET";
let query = "retention";
if (getOpts !== null && getOpts !== undefined && getOpts.versionId) {
query += `&versionId=${getOpts.versionId}`;
}
const res = await this.makeRequestAsync({
method,
bucketName,
objectName,
query
});
const body = await readAsString(res);
return parseObjectRetentionConfig(body);
}
async removeObjects(bucketName, objectsList) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!Array.isArray(objectsList)) {
throw new InvalidArgumentError("objectsList should be a list");
}
const runDeleteObjects = async (batch) => {
const delObjects = batch.map((value) => {
return isObject(value) ? {
Key: value.name,
VersionId: value.versionId
} : {
Key: value
};
});
const remObjects = {
Delete: {
Quiet: true,
Object: delObjects
}
};
const payload = Buffer.from(new import_xml2js.default.Builder({
headless: true
}).buildObject(remObjects));
const headers = {
"Content-MD5": toMd5(payload)
};
const res = await this.makeRequestAsync({
method: "POST",
bucketName,
query: "delete",
headers
}, payload);
const body = await readAsString(res);
return removeObjectsParser(body);
};
const maxEntries = 1000;
const batches = [];
for (let i = 0;i < objectsList.length; i += maxEntries) {
batches.push(objectsList.slice(i, i + maxEntries));
}
const batchResults = await Promise.all(batches.map(runDeleteObjects));
return batchResults.flat();
}
async removeIncompleteUpload(bucketName, objectName) {
if (!isValidBucketName(bucketName)) {
throw new IsValidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
const removeUploadId = await this.findUploadId(bucketName, objectName);
const method = "DELETE";
const query = `uploadId=${removeUploadId}`;
await this.makeRequestAsyncOmit({
method,
bucketName,
objectName,
query
}, "", [204]);
}
async copyObjectV1(targetBucketName, targetObjectName, sourceBucketNameAndObjectName, conditions) {
if (typeof conditions == "function") {
conditions = null;
}
if (!isValidBucketName(targetBucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + targetBucketName);
}
if (!isValidObjectName(targetObjectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${targetObjectName}`);
}
if (!isString(sourceBucketNameAndObjectName)) {
throw new TypeError('sourceBucketNameAndObjectName should be of type "string"');
}
if (sourceBucketNameAndObjectName === "") {
throw new InvalidPrefixError(`Empty source prefix`);
}
if (conditions != null && !(conditions instanceof CopyConditions)) {
throw new TypeError('conditions should be of type "CopyConditions"');
}
const headers = {};
headers["x-amz-copy-source"] = uriResourceEscape(sourceBucketNameAndObjectName);
if (conditions) {
if (conditions.modified !== "") {
headers["x-amz-copy-source-if-modified-since"] = conditions.modified;
}
if (conditions.unmodified !== "") {
headers["x-amz-copy-source-if-unmodified-since"] = conditions.unmodified;
}
if (conditions.matchETag !== "") {
headers["x-amz-copy-source-if-match"] = conditions.matchETag;
}
if (conditions.matchETagExcept !== "") {
headers["x-amz-copy-source-if-none-match"] = conditions.matchETagExcept;
}
}
const method = "PUT";
const res = await this.makeRequestAsync({
method,
bucketName: targetBucketName,
objectName: targetObjectName,
headers
});
const body = await readAsString(res);
return parseCopyObject(body);
}
async copyObjectV2(sourceConfig, destConfig) {
if (!(sourceConfig instanceof CopySourceOptions)) {
throw new InvalidArgumentError("sourceConfig should of type CopySourceOptions ");
}
if (!(destConfig instanceof CopyDestinationOptions)) {
throw new InvalidArgumentError("destConfig should of type CopyDestinationOptions ");
}
if (!destConfig.validate()) {
return Promise.reject();
}
if (!destConfig.validate()) {
return Promise.reject();
}
const headers = Object.assign({}, sourceConfig.getHeaders(), destConfig.getHeaders());
const bucketName = destConfig.Bucket;
const objectName = destConfig.Object;
const method = "PUT";
const res = await this.makeRequestAsync({
method,
bucketName,
objectName,
headers
});
const body = await readAsString(res);
const copyRes = parseCopyObject(body);
const resHeaders = res.headers;
const sizeHeaderValue = resHeaders && resHeaders["content-length"];
const size = typeof sizeHeaderValue === "number" ? sizeHeaderValue : undefined;
return {
Bucket: destConfig.Bucket,
Key: destConfig.Object,
LastModified: copyRes.lastModified,
MetaData: extractMetadata(resHeaders),
VersionId: getVersionId(resHeaders),
SourceVersionId: getSourceVersionId(resHeaders),
Etag: sanitizeETag(resHeaders.etag),
Size: size
};
}
async copyObject(...allArgs) {
if (typeof allArgs[0] === "string") {
const [targetBucketName, targetObjectName, sourceBucketNameAndObjectName, conditions] = allArgs;
return await this.copyObjectV1(targetBucketName, targetObjectName, sourceBucketNameAndObjectName, conditions);
}
const [source, dest] = allArgs;
return await this.copyObjectV2(source, dest);
}
async uploadPart(partConfig) {
const {
bucketName,
objectName,
uploadID,
partNumber,
headers
} = partConfig;
const method = "PUT";
const query = `uploadId=${uploadID}&partNumber=${partNumber}`;
const requestOptions = {
method,
bucketName,
objectName,
query,
headers
};
const res = await this.makeRequestAsync(requestOptions);
const body = await readAsString(res);
const partRes = uploadPartParser(body);
return {
etag: sanitizeETag(partRes.ETag),
key: objectName,
part: partNumber
};
}
async composeObject(destObjConfig, sourceObjList) {
const sourceFilesLength = sourceObjList.length;
if (!Array.isArray(sourceObjList)) {
throw new InvalidArgumentError("sourceConfig should an array of CopySourceOptions ");
}
if (!(destObjConfig instanceof CopyDestinationOptions)) {
throw new InvalidArgumentError("destConfig should of type CopyDestinationOptions ");
}
if (sourceFilesLength < 1 || sourceFilesLength > PART_CONSTRAINTS.MAX_PARTS_COUNT) {
throw new InvalidArgumentError(`"There must be as least one and up to ${PART_CONSTRAINTS.MAX_PARTS_COUNT} source objects.`);
}
for (let i = 0;i < sourceFilesLength; i++) {
const sObj = sourceObjList[i];
if (!sObj.validate()) {
return false;
}
}
if (!destObjConfig.validate()) {
return false;
}
const getStatOptions = (srcConfig) => {
let statOpts = {};
if (!import_lodash2.default.isEmpty(srcConfig.VersionID)) {
statOpts = {
versionId: srcConfig.VersionID
};
}
return statOpts;
};
const srcObjectSizes = [];
let totalSize = 0;
let totalParts = 0;
const sourceObjStats = sourceObjList.map((srcItem) => this.statObject(srcItem.Bucket, srcItem.Object, getStatOptions(srcItem)));
const srcObjectInfos = await Promise.all(sourceObjStats);
const validatedStats = srcObjectInfos.map((resItemStat, index2) => {
const srcConfig = sourceObjList[index2];
let srcCopySize = resItemStat.size;
if (srcConfig && srcConfig.MatchRange) {
const srcStart = srcConfig.Start;
const srcEnd = srcConfig.End;
if (srcEnd >= srcCopySize || srcStart < 0) {
throw new InvalidArgumentError(`CopySrcOptions ${index2} has invalid segment-to-copy [${srcStart}, ${srcEnd}] (size is ${srcCopySize})`);
}
srcCopySize = srcEnd - srcStart + 1;
}
if (srcCopySize < PART_CONSTRAINTS.ABS_MIN_PART_SIZE && index2 < sourceFilesLength - 1) {
throw new InvalidArgumentError(`CopySrcOptions ${index2} is too small (${srcCopySize}) and it is not the last part.`);
}
totalSize += srcCopySize;
if (totalSize > PART_CONSTRAINTS.MAX_MULTIPART_PUT_OBJECT_SIZE) {
throw new InvalidArgumentError(`Cannot compose an object of size ${totalSize} (> 5TiB)`);
}
srcObjectSizes[index2] = srcCopySize;
totalParts += partsRequired(srcCopySize);
if (totalParts > PART_CONSTRAINTS.MAX_PARTS_COUNT) {
throw new InvalidArgumentError(`Your proposed compose object requires more than ${PART_CONSTRAINTS.MAX_PARTS_COUNT} parts`);
}
return resItemStat;
});
if (totalParts === 1 && totalSize <= PART_CONSTRAINTS.MAX_PART_SIZE || totalSize === 0) {
return await this.copyObject(sourceObjList[0], destObjConfig);
}
for (let i = 0;i < sourceFilesLength; i++) {
sourceObjList[i].MatchETag = validatedStats[i].etag;
}
const splitPartSizeList = validatedStats.map((resItemStat, idx) => {
return calculateEvenSplits(srcObjectSizes[idx], sourceObjList[idx]);
});
const getUploadPartConfigList = (uploadId2) => {
const uploadPartConfigList = [];
splitPartSizeList.forEach((splitSize, splitIndex) => {
if (splitSize) {
const {
startIndex: startIdx,
endIndex: endIdx,
objInfo: objConfig
} = splitSize;
const partIndex = splitIndex + 1;
const totalUploads = Array.from(startIdx);
const headers = sourceObjList[splitIndex].getHeaders();
totalUploads.forEach((splitStart, upldCtrIdx) => {
const splitEnd = endIdx[upldCtrIdx];
const sourceObj = `${objConfig.Bucket}/${objConfig.Object}`;
headers["x-amz-copy-source"] = `${sourceObj}`;
headers["x-amz-copy-source-range"] = `bytes=${splitStart}-${splitEnd}`;
const uploadPartConfig = {
bucketName: destObjConfig.Bucket,
objectName: destObjConfig.Object,
uploadID: uploadId2,
partNumber: partIndex,
headers,
sourceObj
};
uploadPartConfigList.push(uploadPartConfig);
});
}
});
return uploadPartConfigList;
};
const uploadAllParts = async (uploadList) => {
const partUploads = uploadList.map(async (item) => {
return this.uploadPart(item);
});
return await Promise.all(partUploads);
};
const performUploadParts = async (uploadId2) => {
const uploadList = getUploadPartConfigList(uploadId2);
const partsRes = await uploadAllParts(uploadList);
return partsRes.map((partCopy) => ({
etag: partCopy.etag,
part: partCopy.part
}));
};
const newUploadHeaders = destObjConfig.getHeaders();
const uploadId = await this.initiateNewMultipartUpload(destObjConfig.Bucket, destObjConfig.Object, newUploadHeaders);
try {
const partsDone = await performUploadParts(uploadId);
return await this.completeMultipartUpload(destObjConfig.Bucket, destObjConfig.Object, uploadId, partsDone);
} catch (err) {
return await this.abortMultipartUpload(destObjConfig.Bucket, destObjConfig.Object, uploadId);
}
}
async presignedUrl(method, bucketName, objectName, expires, reqParams, requestDate) {
var _requestDate;
if (this.anonymous) {
throw new AnonymousRequestError(`Presigned ${method} url cannot be generated for anonymous requests`);
}
if (requestDate === undefined && isFunction(reqParams)) {
requestDate = new Date;
}
if (reqParams === undefined && isFunction(expires)) {
reqParams = {};
requestDate = new Date;
}
if (expires && typeof expires === "function") {
expires = PRESIGN_EXPIRY_DAYS_MAX;
reqParams = {};
requestDate = new Date;
}
if (!requestDate) {
requestDate = new Date;
}
if (expires && typeof expires !== "number") {
throw new TypeError('expires should be of type "number"');
}
if (reqParams && typeof reqParams !== "object") {
throw new TypeError('reqParams should be of type "object"');
}
if (requestDate && !(requestDate instanceof Date) || requestDate && isNaN((_requestDate = requestDate) === null || _requestDate === undefined ? undefined : _requestDate.getTime())) {
throw new TypeError('requestDate should be of type "Date" and valid');
}
const query = reqParams ? $stringify(reqParams) : undefined;
try {
const region = await this.getBucketRegionAsync(bucketName);
await this.checkAndRefreshCreds();
const reqOptions = this.getRequestOptions({
method,
region,
bucketName,
objectName,
query
});
return presignSignatureV4(reqOptions, this.accessKey, this.secretKey, this.sessionToken, region, requestDate, expires);
} catch (err) {
throw new InvalidArgumentError(`Unable to get bucket region for ${bucketName}.`);
}
}
async presignedGetObject(bucketName, objectName, expires, respHeaders, requestDate) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (expires && isFunction(expires)) {
expires = PRESIGN_EXPIRY_DAYS_MAX;
respHeaders = {};
requestDate = new Date;
}
if (!expires) {
expires = PRESIGN_EXPIRY_DAYS_MAX;
}
if (isFunction(respHeaders)) {
respHeaders = {};
requestDate = new Date;
}
const validRespHeaders = ["response-content-type", "response-content-language", "response-expires", "response-cache-control", "response-content-disposition", "response-content-encoding"];
validRespHeaders.forEach((header) => {
if (respHeaders !== undefined && respHeaders[header] !== undefined && !isString(respHeaders[header])) {
throw new TypeError(`response header ${header} should be of type "string"`);
}
});
return this.presignedUrl("GET", bucketName, objectName, expires, respHeaders, requestDate);
}
async presignedPutObject(bucketName, objectName, expires) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
}
if (!isValidObjectName(objectName)) {
throw new InvalidObjectNameError(`Invalid object name: ${objectName}`);
}
if (expires && isFunction(expires)) {
expires = PRESIGN_EXPIRY_DAYS_MAX;
}
return this.presignedUrl("PUT", bucketName, objectName, expires);
}
newPostPolicy() {
return new PostPolicy;
}
async presignedPostPolicy(postPolicy) {
if (this.anonymous) {
throw new AnonymousRequestError("Presigned POST policy cannot be generated for anonymous requests");
}
if (!isObject(postPolicy)) {
throw new TypeError('postPolicy should be of type "object"');
}
const bucketName = postPolicy.formData.bucket;
try {
const region = await this.getBucketRegionAsync(bucketName);
const date = new Date;
const dateStr = makeDateLong(date);
await this.checkAndRefreshCreds();
if (!postPolicy.policy.expiration) {
const expires = new Date;
expires.setSeconds(24 * 60 * 60 * 7);
postPolicy.setExpires(expires);
}
postPolicy.policy.conditions.push(["eq", "$x-amz-date", dateStr]);
postPolicy.formData["x-amz-date"] = dateStr;
postPolicy.policy.conditions.push(["eq", "$x-amz-algorithm", "AWS4-HMAC-SHA256"]);
postPolicy.formData["x-amz-algorithm"] = "AWS4-HMAC-SHA256";
postPolicy.policy.conditions.push(["eq", "$x-amz-credential", this.accessKey + "/" + getScope(region, date)]);
postPolicy.formData["x-amz-credential"] = this.accessKey + "/" + getScope(region, date);
if (this.sessionToken) {
postPolicy.policy.conditions.push(["eq", "$x-amz-security-token", this.sessionToken]);
postPolicy.formData["x-amz-security-token"] = this.sessionToken;
}
const policyBase64 = Buffer.from(JSON.stringify(postPolicy.policy)).toString("base64");
postPolicy.formData.policy = policyBase64;
postPolicy.formData["x-amz-signature"] = postPresignSignatureV4(region, date, this.secretKey, policyBase64);
const opts = {
region,
bucketName,
method: "POST"
};
const reqOptions = this.getRequestOptions(opts);
const portStr = this.port == 80 || this.port === 443 ? "" : `:${this.port.toString()}`;
const urlStr = `${reqOptions.protocol}//${reqOptions.host}${portStr}${reqOptions.path}`;
return {
postURL: urlStr,
formData: postPolicy.formData
};
} catch (er) {
throw new InvalidArgumentError(`Unable to get bucket region for ${bucketName}.`);
}
}
}
// node_modules/eventemitter3/index.mjs
var import__ = __toESM(require_eventemitter3(), 1);
// node_modules/minio/dist/esm/notification.mjs
var import_Parser = __toESM(require_Parser(), 1);
class TargetConfig {
setId(id) {
this.Id = id;
}
addEvent(newevent) {
if (!this.Event) {
this.Event = [];
}
this.Event.push(newevent);
}
addFilterSuffix(suffix) {
if (!this.Filter) {
this.Filter = {
S3Key: {
FilterRule: []
}
};
}
this.Filter.S3Key.FilterRule.push({
Name: "suffix",
Value: suffix
});
}
addFilterPrefix(prefix) {
if (!this.Filter) {
this.Filter = {
S3Key: {
FilterRule: []
}
};
}
this.Filter.S3Key.FilterRule.push({
Name: "prefix",
Value: prefix
});
}
}
class TopicConfig extends TargetConfig {
constructor(arn) {
super();
this.Topic = arn;
}
}
class QueueConfig extends TargetConfig {
constructor(arn) {
super();
this.Queue = arn;
}
}
class CloudFunctionConfig extends TargetConfig {
constructor(arn) {
super();
this.CloudFunction = arn;
}
}
class NotificationConfig {
add(target) {
let instance;
if (target instanceof TopicConfig) {
instance = this.TopicConfiguration ?? (this.TopicConfiguration = []);
}
if (target instanceof QueueConfig) {
instance = this.QueueConfiguration ?? (this.QueueConfiguration = []);
}
if (target instanceof CloudFunctionConfig) {
instance = this.CloudFunctionConfiguration ?? (this.CloudFunctionConfiguration = []);
}
if (instance) {
instance.push(target);
}
}
}
class NotificationPoller extends import__.default {
constructor(client, bucketName, prefix, suffix, events) {
super();
this.client = client;
this.bucketName = bucketName;
this.prefix = prefix;
this.suffix = suffix;
this.events = events;
this.ending = false;
}
start() {
this.ending = false;
process.nextTick(() => {
this.checkForChanges();
});
}
stop() {
this.ending = true;
}
checkForChanges() {
if (this.ending) {
return;
}
const method = "GET";
const queries = [];
if (this.prefix) {
const prefix = uriEscape(this.prefix);
queries.push(`prefix=${prefix}`);
}
if (this.suffix) {
const suffix = uriEscape(this.suffix);
queries.push(`suffix=${suffix}`);
}
if (this.events) {
this.events.forEach((s3event) => queries.push("events=" + uriEscape(s3event)));
}
queries.sort();
let query = "";
if (queries.length > 0) {
query = `${queries.join("&")}`;
}
const region = this.client.region || DEFAULT_REGION;
this.client.makeRequestAsync({
method,
bucketName: this.bucketName,
query
}, "", [200], region).then((response) => {
const asm = import_Parser.default.make();
pipesetup(response, asm).on("data", (data) => {
let records = data.value.Records;
if (!records) {
records = [];
}
records.forEach((record) => {
this.emit("notification", record);
});
if (this.ending) {
response === null || response === undefined || response.destroy();
}
}).on("error", (e) => this.emit("error", e)).on("end", () => {
process.nextTick(() => {
this.checkForChanges();
});
});
}, (e) => {
return this.emit("error", e);
});
}
}
// node_modules/minio/dist/esm/promisify.mjs
function promisify2(fn) {
return function() {
let callback = arguments[arguments.length - 1];
if (typeof callback === "function") {
return fn.apply(this, arguments);
}
let args = [...arguments];
return new Promise((resolve, reject2) => {
args.push((err, value) => {
if (err) {
return reject2(err);
}
resolve(value);
});
fn.apply(this, args);
});
};
}
// node_modules/minio/dist/esm/transformers.mjs
var import_through2 = __toESM(require_through2(), 1);
// node_modules/minio/dist/esm/xml-parsers.mjs
var import_fast_xml_parser3 = __toESM(require_fxp(), 1);
var fxpWithoutNumParser = new import_fast_xml_parser3.XMLParser({
numberParseOptions: {
skipLike: /./
}
});
function parseBucketNotification(xml2) {
var result = {
TopicConfiguration: [],
QueueConfiguration: [],
CloudFunctionConfiguration: []
};
var genEvents = function(events) {
var result2 = [];
if (events) {
toArray(events).forEach((s3event) => {
result2.push(s3event);
});
}
return result2;
};
var genFilterRules = function(filters) {
var result2 = [];
if (filters) {
filters = toArray(filters);
if (filters[0].S3Key) {
filters[0].S3Key = toArray(filters[0].S3Key);
if (filters[0].S3Key[0].FilterRule) {
toArray(filters[0].S3Key[0].FilterRule).forEach((rule) => {
var Name = toArray(rule.Name)[0];
var Value = toArray(rule.Value)[0];
result2.push({
Name,
Value
});
});
}
}
}
return result2;
};
var xmlobj = parseXml(xml2);
xmlobj = xmlobj.NotificationConfiguration;
if (xmlobj.TopicConfiguration) {
toArray(xmlobj.TopicConfiguration).forEach((config) => {
var Id = toArray(config.Id)[0];
var Topic = toArray(config.Topic)[0];
var Event = genEvents(config.Event);
var Filter = genFilterRules(config.Filter);
result.TopicConfiguration.push({
Id,
Topic,
Event,
Filter
});
});
}
if (xmlobj.QueueConfiguration) {
toArray(xmlobj.QueueConfiguration).forEach((config) => {
var Id = toArray(config.Id)[0];
var Queue = toArray(config.Queue)[0];
var Event = genEvents(config.Event);
var Filter = genFilterRules(config.Filter);
result.QueueConfiguration.push({
Id,
Queue,
Event,
Filter
});
});
}
if (xmlobj.CloudFunctionConfiguration) {
toArray(xmlobj.CloudFunctionConfiguration).forEach((config) => {
var Id = toArray(config.Id)[0];
var CloudFunction = toArray(config.CloudFunction)[0];
var Event = genEvents(config.Event);
var Filter = genFilterRules(config.Filter);
result.CloudFunctionConfiguration.push({
Id,
CloudFunction,
Event,
Filter
});
});
}
return result;
}
var formatObjInfo = (content, opts = {}) => {
let {
Key,
LastModified,
ETag,
Size,
VersionId,
IsLatest
} = content;
if (!isObject(opts)) {
opts = {};
}
const name = sanitizeObjectKey(toArray(Key)[0]);
const lastModified = new Date(toArray(LastModified)[0]);
const etag = sanitizeETag(toArray(ETag)[0]);
const size = sanitizeSize(Size);
return {
name,
lastModified,
etag,
size,
versionId: VersionId,
isLatest: IsLatest,
isDeleteMarker: opts.IsDeleteMarker ? opts.IsDeleteMarker : false
};
};
function parseListObjects(xml2) {
var result = {
objects: [],
isTruncated: false
};
let isTruncated = false;
let nextMarker, nextVersionKeyMarker;
const xmlobj = fxpWithoutNumParser.parse(xml2);
const parseCommonPrefixesEntity = (responseEntity) => {
if (responseEntity) {
toArray(responseEntity).forEach((commonPrefix) => {
result.objects.push({
prefix: sanitizeObjectKey(toArray(commonPrefix.Prefix)[0]),
size: 0
});
});
}
};
const listBucketResult = xmlobj.ListBucketResult;
const listVersionsResult = xmlobj.ListVersionsResult;
if (listBucketResult) {
if (listBucketResult.IsTruncated) {
isTruncated = listBucketResult.IsTruncated;
}
if (listBucketResult.Contents) {
toArray(listBucketResult.Contents).forEach((content) => {
const name = sanitizeObjectKey(toArray(content.Key)[0]);
const lastModified = new Date(toArray(content.LastModified)[0]);
const etag = sanitizeETag(toArray(content.ETag)[0]);
const size = sanitizeSize(content.Size);
result.objects.push({
name,
lastModified,
etag,
size
});
});
}
if (listBucketResult.NextMarker) {
nextMarker = listBucketResult.NextMarker;
} else if (isTruncated && result.objects.length > 0) {
nextMarker = result.objects[result.objects.length - 1].name;
}
parseCommonPrefixesEntity(listBucketResult.CommonPrefixes);
}
if (listVersionsResult) {
if (listVersionsResult.IsTruncated) {
isTruncated = listVersionsResult.IsTruncated;
}
if (listVersionsResult.Version) {
toArray(listVersionsResult.Version).forEach((content) => {
result.objects.push(formatObjInfo(content));
});
}
if (listVersionsResult.DeleteMarker) {
toArray(listVersionsResult.DeleteMarker).forEach((content) => {
result.objects.push(formatObjInfo(content, {
IsDeleteMarker: true
}));
});
}
if (listVersionsResult.NextKeyMarker) {
nextVersionKeyMarker = listVersionsResult.NextKeyMarker;
}
if (listVersionsResult.NextVersionIdMarker) {
result.versionIdMarker = listVersionsResult.NextVersionIdMarker;
}
parseCommonPrefixesEntity(listVersionsResult.CommonPrefixes);
}
result.isTruncated = isTruncated;
if (isTruncated) {
result.nextMarker = nextVersionKeyMarker || nextMarker;
}
return result;
}
function parseListObjectsV2(xml2) {
var result = {
objects: [],
isTruncated: false
};
var xmlobj = parseXml(xml2);
if (!xmlobj.ListBucketResult) {
throw new InvalidXMLError('Missing tag: "ListBucketResult"');
}
xmlobj = xmlobj.ListBucketResult;
if (xmlobj.IsTruncated) {
result.isTruncated = xmlobj.IsTruncated;
}
if (xmlobj.NextContinuationToken) {
result.nextContinuationToken = xmlobj.NextContinuationToken;
}
if (xmlobj.Contents) {
toArray(xmlobj.Contents).forEach((content) => {
var name = sanitizeObjectKey(toArray(content.Key)[0]);
var lastModified = new Date(content.LastModified);
var etag = sanitizeETag(content.ETag);
var size = content.Size;
result.objects.push({
name,
lastModified,
etag,
size
});
});
}
if (xmlobj.CommonPrefixes) {
toArray(xmlobj.CommonPrefixes).forEach((commonPrefix) => {
result.objects.push({
prefix: sanitizeObjectKey(toArray(commonPrefix.Prefix)[0]),
size: 0
});
});
}
return result;
}
// node_modules/minio/dist/esm/transformers.mjs
function getConcater(parser, emitError) {
var objectMode = false;
var bufs = [];
if (parser && !isFunction(parser)) {
throw new TypeError('parser should be of type "function"');
}
if (parser) {
objectMode = true;
}
return import_through2.default({
objectMode
}, function(chunk, enc, cb) {
bufs.push(chunk);
cb();
}, function(cb) {
if (emitError) {
cb(parser(Buffer.concat(bufs).toString()));
this.push(null);
return;
}
if (bufs.length) {
if (parser) {
this.push(parser(Buffer.concat(bufs).toString()));
} else {
this.push(Buffer.concat(bufs));
}
}
cb();
});
}
function getListObjectsTransformer() {
return getConcater(parseListObjects);
}
function getListObjectsV2Transformer() {
return getConcater(parseListObjectsV2);
}
function getBucketNotificationTransformer() {
return getConcater(parseBucketNotification);
}
// node_modules/minio/dist/esm/minio.mjs
class Client extends TypedClient {
listObjectsQuery(bucketName, prefix, marker, listQueryOpts = {}) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isString(prefix)) {
throw new TypeError('prefix should be of type "string"');
}
if (!isString(marker)) {
throw new TypeError('marker should be of type "string"');
}
let {
Delimiter,
MaxKeys,
IncludeVersion
} = listQueryOpts;
if (!isObject(listQueryOpts)) {
throw new TypeError('listQueryOpts should be of type "object"');
}
if (!isString(Delimiter)) {
throw new TypeError('Delimiter should be of type "string"');
}
if (!isNumber(MaxKeys)) {
throw new TypeError('MaxKeys should be of type "number"');
}
const queries = [];
queries.push(`prefix=${uriEscape(prefix)}`);
queries.push(`delimiter=${uriEscape(Delimiter)}`);
queries.push(`encoding-type=url`);
if (IncludeVersion) {
queries.push(`versions`);
}
if (marker) {
marker = uriEscape(marker);
if (IncludeVersion) {
queries.push(`key-marker=${marker}`);
} else {
queries.push(`marker=${marker}`);
}
}
if (MaxKeys) {
if (MaxKeys >= 1000) {
MaxKeys = 1000;
}
queries.push(`max-keys=${MaxKeys}`);
}
queries.sort();
var query = "";
if (queries.length > 0) {
query = `${queries.join("&")}`;
}
var method = "GET";
var transformer = getListObjectsTransformer();
this.makeRequest({
method,
bucketName,
query
}, "", [200], "", true, (e, response) => {
if (e) {
return transformer.emit("error", e);
}
pipesetup(response, transformer);
});
return transformer;
}
listObjects(bucketName, prefix, recursive, listOpts = {}) {
if (prefix === undefined) {
prefix = "";
}
if (recursive === undefined) {
recursive = false;
}
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidPrefix(prefix)) {
throw new InvalidPrefixError(`Invalid prefix : ${prefix}`);
}
if (!isString(prefix)) {
throw new TypeError('prefix should be of type "string"');
}
if (!isBoolean(recursive)) {
throw new TypeError('recursive should be of type "boolean"');
}
if (!isObject(listOpts)) {
throw new TypeError('listOpts should be of type "object"');
}
var marker = "";
const listQueryOpts = {
Delimiter: recursive ? "" : "/",
MaxKeys: 1000,
IncludeVersion: listOpts.IncludeVersion
};
var objects = [];
var ended = false;
var readStream = Stream.Readable({
objectMode: true
});
readStream._read = () => {
if (objects.length) {
readStream.push(objects.shift());
return;
}
if (ended) {
return readStream.push(null);
}
this.listObjectsQuery(bucketName, prefix, marker, listQueryOpts).on("error", (e) => readStream.emit("error", e)).on("data", (result) => {
if (result.isTruncated) {
marker = result.nextMarker || result.versionIdMarker;
} else {
ended = true;
}
objects = result.objects;
readStream._read();
});
};
return readStream;
}
listObjectsV2Query(bucketName, prefix, continuationToken, delimiter, maxKeys, startAfter) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isString(prefix)) {
throw new TypeError('prefix should be of type "string"');
}
if (!isString(continuationToken)) {
throw new TypeError('continuationToken should be of type "string"');
}
if (!isString(delimiter)) {
throw new TypeError('delimiter should be of type "string"');
}
if (!isNumber(maxKeys)) {
throw new TypeError('maxKeys should be of type "number"');
}
if (!isString(startAfter)) {
throw new TypeError('startAfter should be of type "string"');
}
var queries = [];
queries.push(`list-type=2`);
queries.push(`encoding-type=url`);
queries.push(`prefix=${uriEscape(prefix)}`);
queries.push(`delimiter=${uriEscape(delimiter)}`);
if (continuationToken) {
continuationToken = uriEscape(continuationToken);
queries.push(`continuation-token=${continuationToken}`);
}
if (startAfter) {
startAfter = uriEscape(startAfter);
queries.push(`start-after=${startAfter}`);
}
if (maxKeys) {
if (maxKeys >= 1000) {
maxKeys = 1000;
}
queries.push(`max-keys=${maxKeys}`);
}
queries.sort();
var query = "";
if (queries.length > 0) {
query = `${queries.join("&")}`;
}
var method = "GET";
var transformer = getListObjectsV2Transformer();
this.makeRequest({
method,
bucketName,
query
}, "", [200], "", true, (e, response) => {
if (e) {
return transformer.emit("error", e);
}
pipesetup(response, transformer);
});
return transformer;
}
listObjectsV2(bucketName, prefix, recursive, startAfter) {
if (prefix === undefined) {
prefix = "";
}
if (recursive === undefined) {
recursive = false;
}
if (startAfter === undefined) {
startAfter = "";
}
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isValidPrefix(prefix)) {
throw new InvalidPrefixError(`Invalid prefix : ${prefix}`);
}
if (!isString(prefix)) {
throw new TypeError('prefix should be of type "string"');
}
if (!isBoolean(recursive)) {
throw new TypeError('recursive should be of type "boolean"');
}
if (!isString(startAfter)) {
throw new TypeError('startAfter should be of type "string"');
}
var delimiter = recursive ? "" : "/";
var continuationToken = "";
var objects = [];
var ended = false;
var readStream = Stream.Readable({
objectMode: true
});
readStream._read = () => {
if (objects.length) {
readStream.push(objects.shift());
return;
}
if (ended) {
return readStream.push(null);
}
this.listObjectsV2Query(bucketName, prefix, continuationToken, delimiter, 1000, startAfter).on("error", (e) => readStream.emit("error", e)).on("data", (result) => {
if (result.isTruncated) {
continuationToken = result.nextContinuationToken;
} else {
ended = true;
}
objects = result.objects;
readStream._read();
});
};
return readStream;
}
setBucketNotification(bucketName, config, cb) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isObject(config)) {
throw new TypeError('notification config should be of type "Object"');
}
if (!isFunction(cb)) {
throw new TypeError('callback should be of type "function"');
}
var method = "PUT";
var query = "notification";
var builder = new import_xml2js2.default.Builder({
rootName: "NotificationConfiguration",
renderOpts: {
pretty: false
},
headless: true
});
var payload = builder.buildObject(config);
this.makeRequest({
method,
bucketName,
query
}, payload, [200], "", false, cb);
}
removeAllBucketNotification(bucketName, cb) {
this.setBucketNotification(bucketName, new NotificationConfig, cb);
}
getBucketNotification(bucketName, cb) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError("Invalid bucket name: " + bucketName);
}
if (!isFunction(cb)) {
throw new TypeError('callback should be of type "function"');
}
var method = "GET";
var query = "notification";
this.makeRequest({
method,
bucketName,
query
}, "", [200], "", true, (e, response) => {
if (e) {
return cb(e);
}
var transformer = getBucketNotificationTransformer();
var bucketNotification;
pipesetup(response, transformer).on("data", (result) => bucketNotification = result).on("error", (e2) => cb(e2)).on("end", () => cb(null, bucketNotification));
});
}
listenBucketNotification(bucketName, prefix, suffix, events) {
if (!isValidBucketName(bucketName)) {
throw new InvalidBucketNameError(`Invalid bucket name: ${bucketName}`);
}
if (!isString(prefix)) {
throw new TypeError("prefix must be of type string");
}
if (!isString(suffix)) {
throw new TypeError("suffix must be of type string");
}
if (!Array.isArray(events)) {
throw new TypeError("events must be of type Array");
}
let listener = new NotificationPoller(this, bucketName, prefix, suffix, events);
listener.start();
return listener;
}
}
Client.prototype.getBucketNotification = promisify2(Client.prototype.getBucketNotification);
Client.prototype.setBucketNotification = promisify2(Client.prototype.setBucketNotification);
Client.prototype.removeAllBucketNotification = promisify2(Client.prototype.removeAllBucketNotification);
Client.prototype.makeBucket = callbackify(Client.prototype.makeBucket);
Client.prototype.bucketExists = callbackify(Client.prototype.bucketExists);
Client.prototype.removeBucket = callbackify(Client.prototype.removeBucket);
Client.prototype.listBuckets = callbackify(Client.prototype.listBuckets);
Client.prototype.getObject = callbackify(Client.prototype.getObject);
Client.prototype.fGetObject = callbackify(Client.prototype.fGetObject);
Client.prototype.getPartialObject = callbackify(Client.prototype.getPartialObject);
Client.prototype.statObject = callbackify(Client.prototype.statObject);
Client.prototype.putObjectRetention = callbackify(Client.prototype.putObjectRetention);
Client.prototype.putObject = callbackify(Client.prototype.putObject);
Client.prototype.fPutObject = callbackify(Client.prototype.fPutObject);
Client.prototype.removeObject = callbackify(Client.prototype.removeObject);
Client.prototype.removeBucketReplication = callbackify(Client.prototype.removeBucketReplication);
Client.prototype.setBucketReplication = callbackify(Client.prototype.setBucketReplication);
Client.prototype.getBucketReplication = callbackify(Client.prototype.getBucketReplication);
Client.prototype.getObjectLegalHold = callbackify(Client.prototype.getObjectLegalHold);
Client.prototype.setObjectLegalHold = callbackify(Client.prototype.setObjectLegalHold);
Client.prototype.setObjectLockConfig = callbackify(Client.prototype.setObjectLockConfig);
Client.prototype.getObjectLockConfig = callbackify(Client.prototype.getObjectLockConfig);
Client.prototype.getBucketPolicy = callbackify(Client.prototype.getBucketPolicy);
Client.prototype.setBucketPolicy = callbackify(Client.prototype.setBucketPolicy);
Client.prototype.getBucketTagging = callbackify(Client.prototype.getBucketTagging);
Client.prototype.getObjectTagging = callbackify(Client.prototype.getObjectTagging);
Client.prototype.setBucketTagging = callbackify(Client.prototype.setBucketTagging);
Client.prototype.removeBucketTagging = callbackify(Client.prototype.removeBucketTagging);
Client.prototype.setObjectTagging = callbackify(Client.prototype.setObjectTagging);
Client.prototype.removeObjectTagging = callbackify(Client.prototype.removeObjectTagging);
Client.prototype.getBucketVersioning = callbackify(Client.prototype.getBucketVersioning);
Client.prototype.setBucketVersioning = callbackify(Client.prototype.setBucketVersioning);
Client.prototype.selectObjectContent = callbackify(Client.prototype.selectObjectContent);
Client.prototype.setBucketLifecycle = callbackify(Client.prototype.setBucketLifecycle);
Client.prototype.getBucketLifecycle = callbackify(Client.prototype.getBucketLifecycle);
Client.prototype.removeBucketLifecycle = callbackify(Client.prototype.removeBucketLifecycle);
Client.prototype.setBucketEncryption = callbackify(Client.prototype.setBucketEncryption);
Client.prototype.getBucketEncryption = callbackify(Client.prototype.getBucketEncryption);
Client.prototype.removeBucketEncryption = callbackify(Client.prototype.removeBucketEncryption);
Client.prototype.getObjectRetention = callbackify(Client.prototype.getObjectRetention);
Client.prototype.removeObjects = callbackify(Client.prototype.removeObjects);
Client.prototype.removeIncompleteUpload = callbackify(Client.prototype.removeIncompleteUpload);
Client.prototype.copyObject = callbackify(Client.prototype.copyObject);
Client.prototype.composeObject = callbackify(Client.prototype.composeObject);
Client.prototype.presignedUrl = callbackify(Client.prototype.presignedUrl);
Client.prototype.presignedGetObject = callbackify(Client.prototype.presignedGetObject);
Client.prototype.presignedPutObject = callbackify(Client.prototype.presignedPutObject);
Client.prototype.presignedPostPolicy = callbackify(Client.prototype.presignedPostPolicy);
// src/lib/minio.ts
class MinioUtils {
minioClient;
bucket;
programOptions;
constructor(clientOptions, programOptions, bucket) {
this.minioClient = new Client(clientOptions);
this.programOptions = programOptions;
this.bucket = bucket;
}
async cleanBucket() {
try {
const objectsStream = this.minioClient.listObjectsV2(this.bucket, "", true);
const objectNames = [];
for await (const obj of objectsStream) {
objectNames.push(obj.name);
}
if (objectNames.length > 0) {
await this.minioClient.removeObjects(this.bucket, objectNames);
if (this.programOptions["--verbose"])
console.log(`${objectNames.length} objects removed from bucket ${this.bucket}.`);
} else {
if (this.programOptions["--verbose"])
console.log(`No objects found in bucket ${this.bucket}.`);
}
} catch (err) {
console.error(`Failed to clean bucket ${this.bucket}:`, err);
throw err;
}
}
async uploadContent(file, fileAddr) {
let maxTries = 5;
let result = "error" /* ERROR */;
let shouldContinue = true;
do {
const fileToUpload = Bun.file(file);
const data = await toBuffer(fileToUpload.stream());
let mimeType = fileToUpload.type;
if (mimeType.indexOf(";") > -1) {
mimeType = mimeType.substring(0, mimeType.indexOf(";"));
}
const metadata = {
"Content-Type": mimeType
};
try {
await this.minioClient.putObject(this.bucket, fileAddr, data, fileToUpload.size, metadata);
if (this.programOptions["--verbose"])
console.log(`Upload ${fileAddr}: OK
`);
result = "completed" /* COMPLETED */;
shouldContinue = false;
} catch (error) {
result = "error" /* ERROR */;
if (error.code == "ConnectionClosed") {
if (this.programOptions["--verbose"])
console.log(`Upload ${fileAddr}: KO: retry ${maxTries}
`);
maxTries--;
Bun.sleep(25 * maxTries);
} else {
shouldContinue = false;
console.log(`Upload ${fileAddr}: KO: retry ${maxTries}
`);
}
}
} while (shouldContinue && maxTries > 0);
return result;
}
async deleteContent(fileAddr) {
try {
const exists = await this.existsContent(fileAddr);
if (exists !== "exists" /* EXISTS */) {
if (exists === "doesntExist" /* DOESNT_EXISTS */)
return "skipped" /* SKIPPED */;
return exists;
}
await this.minioClient.removeObject(this.bucket, fileAddr, { forceDelete: true });
if (this.programOptions["--verbose"])
process.stdout.write(`Delete ${fileAddr}: OK
`);
return "completed" /* COMPLETED */;
} catch (err) {
if (this.programOptions["--verbose"])
process.stdout.write(`Delete ${fileAddr}: KO
`);
return "error" /* ERROR */;
}
}
async existsContent(fileAddr) {
try {
await this.minioClient.statObject(this.bucket, fileAddr);
return "exists" /* EXISTS */;
} catch (e) {
if (e instanceof S3Error) {
if (e.code == "NotFound") {
if (this.programOptions["--verbose"])
process.stdout.write(`Delete ${fileAddr}: SKIPPED (file doesn't exists).
`);
return "doesntExist" /* DOESNT_EXISTS */;
}
return "error" /* ERROR */;
} else {
return "error" /* ERROR */;
}
}
}
}
// src/upload.ts
var fs3 = __require("fs/promises");
var { performance } = __require("perf_hooks");
var s3ApiUrl = getEnv("S3_API_URL");
var s3UrlParts = extractUrlParts(s3ApiUrl);
if (s3UrlParts == null || s3UrlParts == undefined) {
console.error(`Invalid S3 Api Url ${s3ApiUrl}`);
process.exit(1);
}
var s3Host = s3UrlParts.host;
var s3Port = s3UrlParts.port;
var s3UseSsl = s3UrlParts.protocol.indexOf("https") > -1;
var s3AccessKey = getEnv("S3_ACCESS_KEY");
var s3Bucket = getEnv("S3_BUCKET_STATIC");
var s3SecretKey = getEnv("S3_SECRET_KEY");
var programOptions = parseDocopt();
var minioUtils = new MinioUtils({
endPoint: s3Host,
port: s3Port,
useSSL: s3UseSsl,
accessKey: s3AccessKey,
secretKey: s3SecretKey
}, programOptions, s3Bucket);
main().then((res) => {
process.exit(res);
});
async function main() {
const startTime = performance.now();
const path2 = programOptions["<path>"];
const batchSize = programOptions["--batchsize"];
let promiseBatch = [];
const counter = {
files: 0,
skipped: 0,
completed: 0,
errors: 0
};
if (programOptions["--clean"]) {
await minioUtils.cleanBucket();
}
if (path2 === null || path2 === undefined) {
if (programOptions["--verbose"]) {
console.log("Path is not set");
}
return 0;
}
const pathFoundAsDir = await fs3.exists(path2);
if (!pathFoundAsDir) {
console.error(`ERROR: ${path2} is not a directory`);
return;
}
const glob = new Glob(`${path2}/**/*`);
for await (const file of glob.scan({ onlyFiles: true })) {
let fileAddr = file.substring(path2.length + 1);
if (fileAddr.startsWith("/")) {
fileAddr = fileAddr.substring(1);
}
const promise = (async () => {
counter.files++;
const fileItem = Bun.file(file);
if (fileItem.size > 0) {
return await minioUtils.uploadContent(file, fileAddr);
} else {
console.log(`Skipped empty file ${file}`);
return await new Promise((resolve) => {
resolve("skipped" /* SKIPPED */);
});
}
})();
promiseBatch.push(promise);
if (promiseBatch.length === batchSize) {
const results = await Promise.all(promiseBatch);
parseResults(results, counter);
promiseBatch = [];
}
}
if (promiseBatch.length > 0) {
const results = await Promise.all(promiseBatch);
parseResults(results, counter);
}
const endTime = performance.now();
const executionTime = endTime - startTime;
console.log(`==================| UPLOAD RESULTS |==================`);
console.log(`| FILES : ${counter.files}`);
console.log(`| COMPLETED : ${counter.completed}`);
console.log(`| ERRORS : ${counter.errors}`);
console.log(`| SKIPPED : ${counter.skipped}`);
console.log(`| EXEC. TIME : ${executionTime.toFixed(2)} ms`);
console.log("======================================================");
return 0;
}
export {
main
};