flickr-sdk
Version:
Almost certainly the best Flickr API client in the world for node and the browser
1,739 lines (1,725 loc) • 88.5 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// node_modules/min-is/index.js
var require_min_is = __commonJS({
"node_modules/min-is/index.js"(exports) {
var is = exports;
var obj = Object.prototype;
global = global || {};
var navigator = global.navigator;
is.browser = function() {
if (!is.wechatApp()) {
if (navigator && global.window == global) {
return true;
}
}
return false;
};
is.h5 = function() {
if (is.browser() && navigator.geolocation) {
return true;
}
return false;
};
is.mobile = function() {
if (is.browser() && /mobile/i.test(navigator.userAgent)) {
return true;
}
return false;
};
is.wechatApp = function() {
if ("object" == typeof wx) {
if (wx && is.fn(wx.createVideoContext)) {
return true;
}
}
return false;
};
function _class(val) {
var name = obj.toString.call(val);
return name.substring(8, name.length - 1).toLowerCase();
}
function _type(val) {
return typeof val;
}
function owns(owner, key) {
return obj.hasOwnProperty.call(owner, key);
}
is._class = _class;
is._type = _type;
is.owns = owns;
is.nan = function(val) {
return val !== val;
};
is.bool = function(val) {
return "boolean" == _class(val);
};
is.infinite = function(val) {
return val == Infinity || val == -Infinity;
};
is.number = function(num) {
return !isNaN(num) && "number" == _class(num);
};
is.iod = function(val) {
if (is.number(val) && !is.infinite(val)) {
return true;
}
return false;
};
is.decimal = function(val) {
if (is.iod(val)) {
return 0 != val % 1;
}
return false;
};
is.integer = function(val) {
if (is.iod(val)) {
return 0 == val % 1;
}
return false;
};
is.oof = function(val) {
if (val) {
var tp = _type(val);
return "object" == tp || "function" == tp;
}
return false;
};
is.object = function(obj2) {
return is.oof(obj2) && "function" != _class(obj2);
};
is.hash = is.plainObject = function(hash) {
if (hash) {
if ("object" == _class(hash)) {
if (hash.nodeType || hash.setInterval) {
return false;
}
return true;
}
}
return false;
};
is.undef = function(val) {
return "undefined" == _type(val);
};
is.fn = function(fn) {
return "function" == _class(fn);
};
is.string = function(str) {
return "string" == _class(str);
};
is.nos = function(val) {
return is.iod(val) || is.string(val);
};
is.array = function(arr) {
return "array" == _class(arr);
};
is.arraylike = function(arr) {
if (!is.window(arr) && is.object(arr)) {
var len = arr.length;
if (is.integer(len) && len >= 0) {
return true;
}
}
return false;
};
is.window = function(val) {
if (val && val.window == val) {
return true;
}
return false;
};
is.empty = function(val) {
if (is.string(val) || is.arraylike(val)) {
return 0 === val.length;
}
if (is.hash(val)) {
for (var key in val) {
if (owns(val, key)) {
return false;
}
}
}
return true;
};
is.element = function(elem) {
if (elem && 1 === elem.nodeType) {
return true;
}
return false;
};
is.regexp = function(val) {
return "regexp" == _class(val);
};
}
});
// node_modules/cou/index.js
var require_cou = __commonJS({
"node_modules/cou/index.js"(exports) {
var is = require_min_is();
var slice = [].slice;
var _ = exports;
_.is = is;
_.extend = _.assign = extend;
_.each = each;
_.map = function(arr, fn) {
var ret = [];
each(arr, function(item, i, arr2) {
ret[i] = fn(item, i, arr2);
});
return ret;
};
_.filter = function(arr, fn) {
var ret = [];
each(arr, function(item, i, arr2) {
var val = fn(item, i, arr2);
if (val)
ret.push(item);
});
return ret;
};
_.some = function(arr, fn) {
return -1 != findIndex(arr, fn);
};
_.every = function(arr, fn) {
return -1 == findIndex(arr, negate(fn));
};
_.reduce = reduce;
_.findIndex = findIndex;
_.find = function(arr, fn) {
var index = _.findIndex(arr, fn);
if (-1 != index) {
return arr[index];
}
};
_.indexOf = indexOf;
_.includes = function(val, sub) {
return -1 != indexOf(val, sub);
};
_.toArray = toArray;
_.slice = function(arr, start, end) {
var ret = [];
var len = getLength(arr);
if (len >= 0) {
start = start || 0;
if (0 !== end) {
end = end || len;
}
if (!is.fn(arr.slice)) {
arr = toArray(arr);
}
ret = arr.slice(start, end);
}
return ret;
};
_.negate = negate;
_.forIn = forIn;
_.keys = keys;
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
_.trim = function(str) {
if (null == str)
return "";
return ("" + str).replace(rtrim, "");
};
_.noop = function() {
};
_.len = getLength;
function getLength(arr) {
if (null != arr)
return arr.length;
}
function each(arr, fn) {
var len = getLength(arr);
if (len && is.fn(fn)) {
for (var i = 0; i < len; i++) {
if (false === fn(arr[i], i, arr))
break;
}
}
return arr;
}
function findIndex(arr, fn) {
var ret = -1;
each(arr, function(item, i, arr2) {
if (fn(item, i, arr2)) {
ret = i;
return false;
}
});
return ret;
}
function toArray(arr) {
var ret = [];
each(arr, function(item) {
ret.push(item);
});
return ret;
}
function extend(target) {
if (target) {
var sources = slice.call(arguments, 1);
each(sources, function(src) {
forIn(src, function(val, key) {
if (!is.undef(val)) {
target[key] = val;
}
});
});
}
return target;
}
function negate(fn) {
return function() {
return !fn.apply(this, arguments);
};
}
function indexOf(val, sub) {
if (is.string(val))
return val.indexOf(sub);
return findIndex(val, function(item) {
return sub === item;
});
}
function reduce(arr, fn, prev) {
each(arr, function(item, i) {
prev = fn(prev, item, i, arr);
});
return prev;
}
function forIn(hash, fn) {
if (hash) {
for (var key in hash) {
if (is.owns(hash, key)) {
if (false === fn(hash[key], key, hash))
break;
}
}
}
return hash;
}
function keys(hash) {
var ret = [];
forIn(hash, function(val, key) {
ret.push(key);
});
return ret;
}
}
});
// node_modules/min-util/src/lang.js
var require_lang = __commonJS({
"node_modules/min-util/src/lang.js"(exports, module) {
module.exports = function(_) {
var is = _.is;
_.isString = is.string;
_.isArray = is.array;
_.isArrayLike = is.arraylike;
_.isBoolean = is.bool;
_.isElement = is.element;
_.isEmpty = is.empty;
_.isFunction = is.fn;
_.isInteger = is.integer;
_.isNaN = is.nan;
_.isNumber = is.number;
_.isObject = is.object;
_.isPlainObject = is.plainObject;
_.isRegExp = is.regexp;
_.isString = is.string;
_.isUndefined = is.undef;
};
}
});
// node_modules/min-util/src/util.js
var require_util = __commonJS({
"node_modules/min-util/src/util.js"(exports, module) {
module.exports = function(_) {
var is = _.is;
_.now = function() {
return +/* @__PURE__ */ new Date();
};
_.constant = function(val) {
return function() {
return val;
};
};
_.identity = function(val) {
return val;
};
_.random = function(min, max) {
return min + Math.floor(Math.random() * (max - min + 1));
};
_.mixin = function(dst, src, opt) {
var keys = _.functions(src);
if (dst) {
if (is.fn(dst)) {
opt = opt || {};
var proto = dst.prototype;
_.each(keys, function(key) {
var fn = src[key];
proto[key] = function() {
var me = this;
var args = [me.__value];
args.push.apply(args, arguments);
var ret = fn.apply(me, args);
if (me.__chain) {
me.__value = ret;
return me;
}
return ret;
};
});
} else {
_.each(keys, function(key) {
dst[key] = src[key];
});
}
}
return dst;
};
_.chain = function(val) {
var ret = _(val);
ret.__chain = true;
return ret;
};
_.value = function() {
this.__chain = false;
return this.__value;
};
var uniqueId = 0;
_.uniqueId = function(prefix) {
uniqueId++;
return _.toString(prefix) + uniqueId;
};
};
}
});
// node_modules/min-util/src/array.js
var require_array = __commonJS({
"node_modules/min-util/src/array.js"(exports, module) {
module.exports = function(_) {
var each = _.forEach = _.each;
var includes = _.includes;
var is = _.is;
var proto = Array.prototype;
_.reject = function(arr, fn) {
return _.filter(arr, function(val, i, arr2) {
return !fn(val, i, arr2);
});
};
_.without = function(arr) {
var other = _.slice(arguments, 1);
return _.difference(arr, other);
};
_.difference = function(arr, other) {
var ret = [];
_.each(arr, function(val) {
if (!includes(other, val)) {
ret.push(val);
}
});
return ret;
};
_.pluck = function(arr, key) {
return _.map(arr, function(item) {
if (item)
return item[key];
});
};
_.nth = function(arr, n) {
n = getRealIndex(n, arr);
n = n || 0;
var ret;
if (_.isString(arr)) {
ret = arr.charAt(n);
} else {
ret = arr[n];
}
return ret;
};
_.first = function(arr) {
if (arr)
return _.nth(arr, 0);
};
_.last = function(arr) {
var len = _.len(arr);
if (len) {
return _.nth(arr, len - 1);
}
};
_.asyncMap = function(arr, fn, cb) {
var ret = [];
var count = 0;
var hasDone, hasStart;
each(arr, function(arg, i) {
hasStart = true;
fn(arg, function(err, val) {
if (hasDone)
return;
count++;
if (err) {
hasDone = true;
return cb(err);
}
ret[i] = val;
if (count == arr.length) {
hasDone = true;
cb(null, ret);
}
});
});
if (!hasStart)
cb(null);
};
_.uniq = function(arr) {
return _.uniqBy(arr);
};
_.uniqBy = function(arr, fn) {
var ret = [];
var pool = [];
if (!is.fn(fn)) {
fn = null;
}
each(arr, function(item) {
var val = item;
if (fn) {
val = fn(item);
}
if (!includes(pool, val)) {
pool.push(val);
ret.push(item);
}
});
return ret;
};
_.flatten = function(arrs) {
var ret = [];
each(arrs, function(arr) {
if (is.arraylike(arr)) {
each(arr, function(item) {
ret.push(item);
});
} else
ret.push(arr);
});
return ret;
};
_.union = function() {
return _.uniq(_.flatten(arguments));
};
_.sampleSize = function(arr, n) {
var ret = _.toArray(arr);
var len = ret.length;
var need = Math.min(n || 1, len);
for (var i = 0; i < len; i++) {
var rand = _.random(i, len - 1);
var tmp = ret[rand];
ret[rand] = ret[i];
ret[i] = tmp;
}
ret.length = need;
return ret;
};
_.sample = function(arr) {
return _.first(_.sampleSize(arr, 1));
};
_.shuffle = function(arr) {
return _.sampleSize(arr, Infinity);
};
_.compact = function(arr) {
return _.filter(arr, _.identity);
};
_.rest = function(arr) {
return _.slice(arr, 1);
};
_.invoke = function() {
var args = arguments;
var arr = args[0];
var fn = args[1];
var isFunc = is.fn(fn);
args = _.slice(args, 2);
return _.map(arr, function(item) {
if (isFunc) {
return fn.apply(item, args);
}
if (null != item) {
var method = item[fn];
if (is.fn(method)) {
return method.apply(item, args);
}
}
});
};
_.partition = function(arr, fn) {
var hash = _.groupBy(arr, function(val, i, arr2) {
var ret = fn(val, i, arr2);
if (ret)
return 1;
return 2;
});
return [hash[1] || [], hash[2] || []];
};
_.groupBy = function(arr, fn) {
var hash = {};
_.each(arr, function(val, i, arr2) {
var ret = fn(val, i, arr2);
hash[ret] = hash[ret] || [];
hash[ret].push(val);
});
return hash;
};
_.range = function() {
var args = arguments;
if (args.length < 2) {
return _.range(args[1], args[0]);
}
var start = args[0] || 0;
var last = args[1] || 0;
var step = args[2];
if (!is.number(step)) {
step = 1;
}
var count = last - start;
if (0 != step) {
count = count / step;
}
var ret = [];
var val = start;
for (var i = 0; i < count; i++) {
ret.push(val);
val += step;
}
return ret;
};
_.pullAt = function(arr) {
var indexes = _.slice(arguments, 1);
return mutateDifference(arr, indexes);
};
_.remove = function(arr, fn) {
var len = _.len(arr) || 0;
var indexes = [];
while (len--) {
if (fn(arr[len], len, arr)) {
indexes.push(len);
}
}
return mutateDifference(arr, indexes);
};
_.fill = function(arr, val, start, end) {
var size = _.size(arr);
start = getRealIndex(start, arr) || 0;
end = getRealIndex(end, arr) || size;
for (var i = start; i < end; i++) {
arr[i] = val;
}
return arr;
};
_.size = function(val) {
var size = 0;
if (val) {
var len = val.length;
if (_.isInteger(len) && len >= 0) {
size = len;
} else if (_.isObject(val)) {
size = _.keys(val).length;
}
}
return size;
};
function getRealIndex(index, arr) {
var size = _.size(arr);
if (index < 0) {
index += size;
}
if (index < 0) {
index = 0;
}
if (index > size) {
index = size;
}
return index || 0;
}
function mutateDifference(arr, indexes) {
var ret = [];
var len = _.len(indexes);
if (len) {
indexes = indexes.sort(function(a, b) {
return a - b;
});
while (len--) {
var index = indexes[len];
ret.push(proto.splice.call(arr, index, 1)[0]);
}
}
ret.reverse();
return ret;
}
};
}
});
// node_modules/min-util/src/object.js
var require_object = __commonJS({
"node_modules/min-util/src/object.js"(exports, module) {
module.exports = function(_) {
var is = _.is;
var forIn = _.forIn;
_.only = function(obj, keys) {
obj = obj || {};
if (is.string(keys))
keys = keys.split(/ +/);
return _.reduce(keys, function(ret, key) {
if (null != obj[key])
ret[key] = obj[key];
return ret;
}, {});
};
_.values = function(obj) {
return _.map(_.keys(obj), function(key) {
return obj[key];
});
};
_.pick = function(obj, fn) {
if (!is.fn(fn)) {
return _.pick(obj, function(val, key) {
return key == fn;
});
}
var ret = {};
forIn(obj, function(val, key, obj2) {
if (fn(val, key, obj2)) {
ret[key] = val;
}
});
return ret;
};
_.functions = function(obj) {
return _.keys(_.pick(obj, function(val) {
return is.fn(val);
}));
};
_.mapKeys = function(obj, fn) {
var ret = {};
forIn(obj, function(val, key, obj2) {
var newKey = fn(val, key, obj2);
ret[newKey] = val;
});
return ret;
};
_.mapObject = _.mapValues = function(obj, fn) {
var ret = {};
forIn(obj, function(val, key, obj2) {
ret[key] = fn(val, key, obj2);
});
return ret;
};
_.get = function(obj, path) {
path = toPath(path);
if (path.length) {
var flag = _.every(path, function(key) {
if (null != obj) {
obj = obj[key];
return true;
}
});
if (flag)
return obj;
}
};
_.has = function(obj, path) {
path = toPath(path);
if (path.length) {
var flag = _.every(path, function(key) {
if (null != obj && is.owns(obj, key)) {
obj = obj[key];
return true;
}
});
if (flag)
return true;
}
return false;
};
_.set = function(obj, path, val) {
path = toPath(path);
var cur = obj;
_.every(path, function(key, i) {
if (is.oof(cur)) {
if (i + 1 == path.length) {
cur[key] = val;
} else {
var item = cur[key];
if (null == item) {
var item = {};
if (~~key == key) {
item = [];
}
}
cur = cur[key] = item;
return true;
}
}
});
return obj;
};
_.create = /* @__PURE__ */ function() {
function Object2() {
}
return function(proto, property) {
if ("object" != typeof proto) {
proto = null;
}
Object2.prototype = proto;
return _.extend(new Object2(), property);
};
}();
_.defaults = function() {
var args = arguments;
var target = args[0];
var sources = _.slice(args, 1);
if (target) {
_.each(sources, function(src) {
_.mapObject(src, function(val, key) {
if (is.undef(target[key])) {
target[key] = val;
}
});
});
}
return target;
};
_.isMatch = function(obj, src) {
var ret = true;
obj = obj || {};
forIn(src, function(val, key) {
if (val !== obj[key]) {
ret = false;
return false;
}
});
return ret;
};
_.toPlainObject = function(val) {
var ret = {};
forIn(val, function(val2, key) {
ret[key] = val2;
});
return ret;
};
_.invert = function(obj) {
var ret = {};
forIn(obj, function(val, key) {
ret[val] = key;
});
return ret;
};
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
var reEscapeChar = /\\(\\)?/g;
function toPath(val) {
if (is.array(val))
return val;
var ret = [];
_.toString(val).replace(rePropName, function(match, number, quote, string) {
var item = number || match;
if (quote) {
item = string.replace(reEscapeChar, "$1");
}
ret.push(item);
});
return ret;
}
};
}
});
// node_modules/min-util/src/cache.js
var require_cache = __commonJS({
"node_modules/min-util/src/cache.js"(exports, module) {
var cou = require_cou();
var is = cou.is;
module.exports = Cache;
function Cache() {
this.data = {};
}
var proto = Cache.prototype;
proto.has = function(key) {
return is.owns(this.data, key);
};
proto.get = function(key) {
return this.data[key];
};
proto.set = function(key, val) {
this.data[key] = val;
};
proto["delete"] = function(key) {
delete this.data[key];
};
}
});
// node_modules/min-util/src/function.js
var require_function = __commonJS({
"node_modules/min-util/src/function.js"(exports, module) {
module.exports = function(_) {
var is = _.is;
var slice = _.slice;
_.bind = function(fn, ctx) {
if (is.string(ctx)) {
var obj = fn;
fn = obj[ctx];
ctx = obj;
}
if (!is.fn(fn))
return fn;
var args = slice(arguments, 2);
ctx = ctx || this;
return function() {
return fn.apply(ctx, _.flatten([args, arguments]));
};
};
_.inherits = function(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = _.create(superCtor.prototype, {
constructor: ctor
});
};
_.delay = function(fn, wait) {
var args = _.slice(arguments, 2);
return setTimeout(function() {
fn.apply(this, args);
}, wait);
};
_.before = function(n, fn) {
return function() {
if (n > 1) {
n--;
return fn.apply(this, arguments);
}
};
};
_.once = function(fn) {
return _.before(2, fn);
};
_.after = function(n, fn) {
return function() {
if (n > 1) {
n--;
} else {
return fn.apply(this, arguments);
}
};
};
_.throttle = function(fn, wait, opt) {
wait = wait || 0;
opt = _.extend({
leading: true,
trailing: true,
maxWait: wait
}, opt);
return _.debounce(fn, wait, opt);
};
_.debounce = function(fn, wait, opt) {
wait = wait || 0;
opt = _.extend({
leading: false,
trailing: true
}, opt);
var maxWait = opt.maxWait;
var lastExec = 0;
var lastCall = 0;
var now = _.now();
var timer;
if (!opt.leading) {
lastExec = now;
}
function ifIsCD() {
if (now - lastExec > wait)
return false;
if (maxWait && now - lastCall > maxWait)
return false;
return true;
}
function exec(fn2, ctx, args) {
lastExec = _.now();
return fn2.apply(ctx, args);
}
function cancel() {
if (timer) {
clearTimeout(timer);
timer = null;
}
}
function debounced() {
now = _.now();
var isCD = ifIsCD();
lastCall = now;
var me = this;
var args = arguments;
cancel();
if (!isCD) {
exec(fn, me, args);
} else {
if (opt.trailing) {
timer = _.delay(function() {
exec(fn, me, args);
}, wait);
}
}
}
debounced.cancel = cancel;
return debounced;
};
function memoize(fn) {
var cache = new memoize.Cache();
function memoized() {
var args = arguments;
var key = args[0];
if (!cache.has(key)) {
var ret = fn.apply(this, args);
cache.set(key, ret);
}
return cache.get(key);
}
memoized.cache = cache;
return memoized;
}
memoize.Cache = require_cache();
_.memoize = memoize;
_.wrap = function(val, fn) {
return function() {
var args = [val];
args.push.apply(args, arguments);
return fn.apply(this, args);
};
};
_.curry = function(fn) {
var len = fn.length;
return setter([]);
function setter(args) {
return function() {
var arr = args.concat(_.slice(arguments));
if (arr.length >= len) {
arr.length = len;
return fn.apply(this, arr);
}
return setter(arr);
};
}
};
};
}
});
// node_modules/min-util/src/string.js
var require_string = __commonJS({
"node_modules/min-util/src/string.js"(exports, module) {
module.exports = function(_) {
_.tostr = _.toString = tostr;
var indexOf = _.indexOf;
_.split = function(str, separator, limit) {
str = tostr(str);
return str.split(separator, limit);
};
_.capitalize = function(str) {
str = tostr(str);
return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase();
};
_.upperFirst = function(str) {
str = tostr(str);
return str.charAt(0).toUpperCase() + str.substr(1);
};
_.lowerFirst = function(str) {
str = tostr(str);
return str.charAt(0).toLowerCase() + str.substr(1);
};
_.camelCase = function(str) {
str = tostr(str);
var arr = str.split(/[^\w]|_+/);
arr = _.map(arr, function(val) {
return _.capitalize(val);
});
return _.lowerFirst(arr.join(""));
};
_.startsWith = function(str, val) {
return 0 == indexOf(str, val);
};
_.endsWith = function(str, val) {
val += "";
return val == _.slice(str, _.len(str) - _.len(val));
};
_.toLower = _.lower = function(str) {
return tostr(str).toLowerCase();
};
_.toUpper = _.upper = function(str) {
return tostr(str).toUpperCase();
};
_.repeat = function(str, count) {
return _.map(_.range(count), function() {
return str;
}).join("");
};
_.padStart = function(str, len, chars) {
str = tostr(str);
len = len || 0;
var delta = len - str.length;
return getPadStr(chars, delta) + str;
};
_.padEnd = function(str, len, chars) {
str = tostr(str);
len = len || 0;
var delta = len - str.length;
return str + getPadStr(chars, delta);
};
var htmlEscapes = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
};
_.escape = function(str) {
return tostr(str).replace(/[&<>"']/g, function(item) {
return htmlEscapes[item] || item;
});
};
_.template = function(str) {
var arr = ['with(data) {var ret = ""'];
_.each(_.split(str, "<%"), function(x, i) {
var two = x.split("%>");
if (two[1]) {
genJS(_.trim(two[0]));
return filter(two[1]);
}
filter(two[0]);
});
arr.push("return ret}");
var func = new Function("data", arr.join("\n"));
var internalData = {
_
};
var ret = function(data) {
return func(_.extend({}, internalData, data));
};
return ret;
function genJS(jsstr) {
var first = _.first(jsstr);
if (first === "=" || first === "-") {
var text = _.slice(jsstr, 1);
if (first === "-") {
text = "_.escape(" + text + ")";
}
arr.push("ret += " + text);
} else {
arr.push(jsstr);
}
}
function filter(html) {
arr.push('ret += "' + html.replace(/('|"|\\)/g, "\\$1").replace(/\r/g, "\\r").replace(/\n/g, "\\n") + '"');
}
};
function getPadStr(chars, len) {
chars = tostr(chars) || " ";
var count = Math.floor(len / chars.length) + 1;
return _.repeat(chars, count).slice(0, len);
}
function tostr(str) {
if (str || 0 == str)
return str + "";
return "";
}
};
}
});
// node_modules/min-util/src/math.js
var require_math = __commonJS({
"node_modules/min-util/src/math.js"(exports, module) {
module.exports = function(_) {
_.sum = function(arr) {
return _.reduce(arr, function(sum, val) {
return sum + val;
}, 0);
};
_.max = function(arr, fn) {
var index = -1;
var data = -Infinity;
fn = fn || _.identity;
_.each(arr, function(val, i) {
val = fn(val);
if (val > data) {
data = val;
index = i;
}
});
if (index > -1) {
return arr[index];
}
return data;
};
_.min = function(arr, fn) {
var index = -1;
var data = Infinity;
fn = fn || _.identity;
_.each(arr, function(val, i) {
val = fn(val);
if (val < data) {
data = val;
index = i;
}
});
if (index > -1) {
return arr[index];
}
return data;
};
};
}
});
// node_modules/min-util/src/index.js
var require_src = __commonJS({
"node_modules/min-util/src/index.js"(exports, module) {
var cou = require_cou();
module.exports = cou.extend(_, cou);
require_lang()(_);
require_util()(_);
require_array()(_);
require_object()(_);
require_function()(_);
require_string()(_);
require_math()(_);
_.mixin(_, _);
function _(val) {
if (!(this instanceof _))
return new _(val);
this.__value = val;
this.__chain = false;
}
}
});
// node_modules/min-util/index.js
var require_min_util = __commonJS({
"node_modules/min-util/index.js"(exports, module) {
module.exports = require_src();
}
});
// node_modules/min-qs/index.js
var require_min_qs = __commonJS({
"node_modules/min-qs/index.js"(exports) {
var _ = require_min_util();
var is = _.is;
var defaultOption = {
sep: "&",
eq: "=",
encode: encodeURIComponent,
decode: decodeURIComponent,
keepRaw: false,
sort: null,
ignoreValues: [void 0]
};
exports.parse = function(qs, sep, eq, opt) {
qs += "";
opt = getOpt(sep, eq, opt);
var decode = opt.decode;
qs = qs.split(opt.sep);
return _.reduce(qs, function(ret, arr) {
arr = arr.split(opt.eq);
if (2 == arr.length) {
var k = arr[0];
var v = arr[1];
if (!opt.keepRaw) {
try {
k = decode(k);
v = decode(v);
} catch (ignore) {
}
}
ret[k] = v;
}
return ret;
}, {});
};
exports.stringify = function(obj, sep, eq, opt) {
opt = getOpt(sep, eq, opt);
var keys = _.keys(obj);
var sort = opt.sort;
if (sort) {
if (is.fn(sort)) {
keys.sort(sort);
} else {
keys.sort();
}
}
var encode = opt.encode;
var arr = [];
_.each(keys, function(key) {
var val = obj[key];
if (!_.includes(opt.ignoreValues, val)) {
if (is.nan(val) || null == val) {
val = "";
}
if (!opt.keepRaw) {
key = encode(key);
val = encode(val);
}
arr.push(key + opt.eq + val);
}
});
return arr.join(opt.sep);
};
function getOpt(sep, eq, opt) {
opt = _.find(arguments, function(val) {
return is.object(val);
});
sep = is.nos(sep) ? sep : void 0;
eq = is.nos(eq) ? eq : void 0;
opt = _.extend({}, defaultOption, opt, { sep, eq });
return opt;
}
}
});
// node_modules/@rgrove/parse-xml/dist/browser.js
var require_browser = __commonJS({
"node_modules/@rgrove/parse-xml/dist/browser.js"(exports, module) {
"use strict";
var __defProp2 = Object.defineProperty;
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
var __getOwnPropNames2 = Object.getOwnPropertyNames;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp2(target, name, { get: all[name], enumerable: true });
};
var __copyProps2 = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames2(from))
if (!__hasOwnProp2.call(to, key) && key !== except)
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
var src_exports = {};
__export(src_exports, {
XmlCdata: () => XmlCdata,
XmlComment: () => XmlComment,
XmlDeclaration: () => XmlDeclaration,
XmlDocument: () => XmlDocument,
XmlDocumentType: () => XmlDocumentType,
XmlElement: () => XmlElement2,
XmlError: () => XmlError,
XmlNode: () => XmlNode2,
XmlProcessingInstruction: () => XmlProcessingInstruction,
XmlText: () => XmlText2,
parseXml: () => parseXml2
});
module.exports = __toCommonJS(src_exports);
var emptyString = "";
var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
var StringScanner = class {
constructor(string) {
this.k = this.u(string, true);
this.d = 0;
this.length = string.length;
this.l = this.k !== this.length;
this.h = string;
if (this.l) {
let charsToBytes = [];
for (let byteIndex = 0, charIndex = 0; charIndex < this.k; ++charIndex) {
charsToBytes[charIndex] = byteIndex;
byteIndex += string.codePointAt(byteIndex) > 65535 ? 2 : 1;
}
this.A = charsToBytes;
}
}
/**
* Whether the current character index is at the end of the input string.
*/
get B() {
return this.d >= this.k;
}
// -- Protected Methods ------------------------------------------------------
/**
* Returns the number of characters in the given string, which may differ from
* the byte length if the string contains multibyte characters.
*/
u(string, multiByteSafe = this.l) {
return multiByteSafe ? string.replace(surrogatePair, "_").length : string.length;
}
// -- Public Methods ---------------------------------------------------------
/**
* Advances the scanner by the given number of characters, stopping if the end
* of the string is reached.
*/
p(count = 1) {
this.d = Math.min(this.k, this.d + count);
}
/**
* Returns the byte index of the given character index in the string. The two
* may differ in strings that contain multibyte characters.
*/
f(charIndex = this.d) {
var _a;
return this.l ? (_a = this.A[charIndex]) != null ? _a : Infinity : charIndex;
}
/**
* Consumes and returns the given number of characters if possible, advancing
* the scanner and stopping if the end of the string is reached.
*
* If no characters could be consumed, an empty string will be returned.
*/
G(charCount = 1) {
let chars = this.m(charCount);
this.p(charCount);
return chars;
}
/**
* Consumes and returns the given number of bytes if possible, advancing the
* scanner and stopping if the end of the string is reached.
*
* It's up to the caller to ensure that the given byte count doesn't split a
* multibyte character.
*
* If no bytes could be consumed, an empty string will be returned.
*/
v(byteCount) {
let byteIndex = this.f();
let result = this.h.slice(byteIndex, byteIndex + byteCount);
this.p(this.u(result));
return result;
}
/**
* Consumes and returns all characters for which the given function returns
* `true`, stopping when `false` is returned or the end of the input is
* reached.
*/
w(fn) {
let { length, l: multiByteMode, h: string } = this;
let startByteIndex = this.f();
let endByteIndex = startByteIndex;
if (multiByteMode) {
while (endByteIndex < length) {
let char = string[endByteIndex];
let isSurrogatePair = char >= "\uD800" && char <= "\uDBFF";
if (isSurrogatePair) {
char += string[endByteIndex + 1];
}
if (!fn(char)) {
break;
}
endByteIndex += isSurrogatePair ? 2 : 1;
}
} else {
while (endByteIndex < length && fn(string[endByteIndex])) {
++endByteIndex;
}
}
return this.v(endByteIndex - startByteIndex);
}
/**
* Consumes the given string if it exists at the current character index, and
* advances the scanner.
*
* If the given string doesn't exist at the current character index, an empty
* string will be returned and the scanner will not be advanced.
*/
b(stringToConsume) {
let { length } = stringToConsume;
let byteIndex = this.f();
if (stringToConsume === this.h.slice(byteIndex, byteIndex + length)) {
this.p(length === 1 ? 1 : this.u(stringToConsume));
return stringToConsume;
}
return emptyString;
}
/**
* Consumes characters until the given global regex is matched, advancing the
* scanner up to (but not beyond) the beginning of the match. If the regex
* doesn't match, nothing will be consumed.
*
* Returns the consumed string, or an empty string if nothing was consumed.
*/
x(regex) {
let matchByteIndex = this.h.slice(this.f()).search(regex);
return matchByteIndex > 0 ? this.v(matchByteIndex) : emptyString;
}
/**
* Consumes characters until the given string is found, advancing the scanner
* up to (but not beyond) that point. If the string is never found, nothing
* will be consumed.
*
* Returns the consumed string, or an empty string if nothing was consumed.
*/
s(searchString) {
let byteIndex = this.f();
let matchByteIndex = this.h.indexOf(searchString, byteIndex);
return matchByteIndex > 0 ? this.v(matchByteIndex - byteIndex) : emptyString;
}
/**
* Returns the given number of characters starting at the current character
* index, without advancing the scanner and without exceeding the end of the
* input string.
*/
m(count = 1) {
let { d: charIndex, h: string } = this;
return this.l ? string.slice(this.f(charIndex), this.f(charIndex + count)) : string.slice(charIndex, charIndex + count);
}
/**
* Resets the scanner position to the given character _index_, or to the start
* of the input string if no index is given.
*
* If _index_ is negative, the scanner position will be moved backward by that
* many characters, stopping if the beginning of the string is reached.
*/
n(index = 0) {
this.d = index >= 0 ? Math.min(this.k, index) : Math.max(0, this.d + index);
}
};
var attValueCharDoubleQuote = /["&<]/;
var attValueCharSingleQuote = /['&<]/;
var attValueNormalizedWhitespace = /\r\n|[\n\r\t]/g;
var endCharData = /<|&|]]>/;
var predefinedEntities = Object.freeze(Object.assign(/* @__PURE__ */ Object.create(null), {
amp: "&",
apos: "'",
gt: ">",
lt: "<",
quot: '"'
}));
function isNameChar(char) {
let cp = char.codePointAt(0);
return cp >= 97 && cp <= 122 || cp >= 65 && cp <= 90 || cp >= 48 && cp <= 57 || cp === 45 || cp === 46 || cp === 183 || cp >= 768 && cp <= 879 || cp === 8255 || cp === 8256 || isNameStartChar(char, cp);
}
function isNameStartChar(char, cp = char.codePointAt(0)) {
return cp >= 97 && cp <= 122 || cp >= 65 && cp <= 90 || cp === 58 || cp === 95 || cp >= 192 && cp <= 214 || cp >= 216 && cp <= 246 || cp >= 248 && cp <= 767 || cp >= 880 && cp <= 893 || cp >= 895 && cp <= 8191 || cp === 8204 || cp === 8205 || cp >= 8304 && cp <= 8591 || cp >= 11264 && cp <= 12271 || cp >= 12289 && cp <= 55295 || cp >= 63744 && cp <= 64975 || cp >= 65008 && cp <= 65533 || cp >= 65536 && cp <= 983039;
}
function isReferenceChar(char) {
return char === "#" || isNameChar(char);
}
function isWhitespace(char) {
let cp = char.codePointAt(0);
return cp === 32 || cp === 9 || cp === 10 || cp === 13;
}
function isXmlCodePoint(cp) {
return cp >= 32 && cp <= 55295 || cp === 10 || cp === 9 || cp === 13 || cp >= 57344 && cp <= 65533 || cp >= 65536 && cp <= 1114111;
}
var _XmlNode = class _XmlNode2 {
constructor() {
this.parent = null;
this.start = -1;
this.end = -1;
}
/**
* Document that contains this node, or `null` if this node is not associated
* with a document.
*/
get document() {
var _a, _b;
return (_b = (_a = this.parent) == null ? void 0 : _a.document) != null ? _b : null;
}
/**
* Whether this node is the root node of the document (also known as the
* document element).
*/
get isRootNode() {
return this.parent !== null && this.parent === this.document && this.type === _XmlNode2.TYPE_ELEMENT;
}
/**
* Whether whitespace should be preserved in the content of this element and
* its children.
*
* This is influenced by the value of the special `xml:space` attribute, and
* will be `true` for any node whose `xml:space` attribute is set to
* "preserve". If a node has no such attribute, it will inherit the value of
* the nearest ancestor that does (if any).
*
* @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-white-space
*/
get preserveWhitespace() {
var _a;
return !!((_a = this.parent) == null ? void 0 : _a.preserveWhitespace);
}
/**
* Type of this node.
*
* The value of this property is a string that matches one of the static
* `TYPE_*` properties on the `XmlNode` class (e.g. `TYPE_ELEMENT`,
* `TYPE_TEXT`, etc.).
*
* The `XmlNode` class itself is a base class and doesn't have its own type
* name.
*/
get type() {
return "";
}
/**
* Returns a JSON-serializable object representing this node, minus properties
* that could result in circular references.
*/
toJSON() {
let json = {
type: this.type
};
if (this.isRootNode) {
json.isRootNode = true;
}
if (this.preserveWhitespace) {
json.preserveWhitespace = true;
}
if (this.start !== -1) {
json.start = this.start;
json.end = this.end;
}
return json;
}
};
_XmlNode.TYPE_CDATA = "cdata";
_XmlNode.TYPE_COMMENT = "comment";
_XmlNode.TYPE_DOCUMENT = "document";
_XmlNode.TYPE_DOCUMENT_TYPE = "doctype";
_XmlNode.TYPE_ELEMENT = "element";
_XmlNode.TYPE_PROCESSING_INSTRUCTION = "pi";
_XmlNode.TYPE_TEXT = "text";
_XmlNode.TYPE_XML_DECLARATION = "xmldecl";
var XmlNode2 = _XmlNode;
var XmlText2 = class extends XmlNode2 {
constructor(text = "") {
super();
this.text = text;
}
get type() {
return XmlNode2.TYPE_TEXT;
}
toJSON() {
return Object.assign(XmlNode2.prototype.toJSON.call(this), {
text: this.text
});
}
};
var XmlCdata = class extends XmlText2 {
get type() {
return XmlNode2.TYPE_CDATA;
}
};
var XmlComment = class extends XmlNode2 {
constructor(content = "") {
super();
this.content = content;
}
get type() {
return XmlNode2.TYPE_COMMENT;
}
toJSON() {
return Object.assign(XmlNode2.prototype.toJSON.call(this), {
content: this.content
});
}
};
var XmlDeclaration = class extends XmlNode2 {
constructor(version, encoding, standalone) {
super();
this.version = version;
this.encoding = encoding != null ? encoding : null;
this.standalone = standalone != null ? standalone : null;
}
get type() {
return XmlNode2.TYPE_XML_DECLARATION;
}
toJSON() {
let json = XmlNode2.prototype.toJSON.call(this);
json.version = this.version;
for (let key of ["encoding", "standalone"]) {
if (this[key] !== null) {
json[key] = this[key];
}
}
return json;
}
};
var XmlElement2 = class _XmlElement extends XmlNode2 {
constructor(name, attributes = /* @__PURE__ */ Object.create(null), children = []) {
super();
this.name = name;
this.attributes = attributes;
this.children = children;
}
/**
* Whether this element is empty (meaning it has no children).
*/
get isEmpty() {
return this.children.length === 0;
}
get preserveWhitespace() {
let node = this;
while (node instanceof _XmlElement) {
if ("xml:space" in node.attributes) {
return node.attributes["xml:space"] === "preserve";
}
node = node.parent;
}
return false;
}
/**
* Text content of this element and all its descendants.
*/
get text() {
return this.children.map((child) => "text" in child ? child.text : "").join("");
}
get type() {
return XmlNode2.TYPE_ELEMENT;
}
toJSON() {
return Object.assign(XmlNode2.prototype.toJSON.call(this), {
name: this.name,
attributes: this.attributes,
children: this.children.map((child) => child.toJSON())
});
}
};
var XmlDocument = class extends XmlNode2 {
constructor(children = []) {
super();
this.children = children;
}
get document() {
return this;
}
/**
* Root element of this document, or `null` if this document is empty.
*/
get root() {
for (let child of this.children) {
if (child instanceof XmlElement2) {
return child;
}
}
return null;
}
/**
* Text content of this document and all its descendants.
*/
get text() {
return this.children.map((child) => "text" in child ? child.text : "").join("");
}
get type() {
return XmlNode2.TYPE_DOCUMENT;
}
toJSON() {
return Object.assign(XmlNode2.prototype.toJSON.call(this), {
children: t