wisemapping-frontend/libraries/underscore-min.js

14 lines
18 KiB
JavaScript
Raw Normal View History

2021-07-16 16:41:58 +02:00
// Underscore.js 1.6.0
// http://underscorejs.org
// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
2021-10-05 02:05:34 +02:00
(function () {
const n = this; const t = n._; const r = {}; const e = Array.prototype; const u = Object.prototype; const i = Function.prototype; const a = e.push; const o = e.slice; const c = e.concat; const l = u.toString; const f = u.hasOwnProperty; const s = e.forEach; const p = e.map; const h = e.reduce; const v = e.reduceRight; const g = e.filter; const d = e.every; const m = e.some; const y = e.indexOf; const b = e.lastIndexOf; const x = Array.isArray; const w = Object.keys; const _ = i.bind; var j = function (n) { return n instanceof j ? n : this instanceof j ? void (this._wrapped = n) : new j(n); }; typeof exports !== 'undefined' ? (typeof module !== 'undefined' && module.exports && (exports = module.exports = j), exports._ = j) : n._ = j, j.VERSION = '1.6.0'; const A = j.each = j.forEach = function (n, t, e) { if (n == null) return n; if (s && n.forEach === s)n.forEach(t, e); else if (n.length === +n.length) { for (var u = 0, i = n.length; i > u; u++) if (t.call(e, n[u], u, n) === r) return; } else for (var a = j.keys(n), u = 0, i = a.length; i > u; u++) if (t.call(e, n[a[u]], a[u], n) === r) return; return n; }; j.map = j.collect = function (n, t, r) { const e = []; return n == null ? e : p && n.map === p ? n.map(t, r) : (A(n, (n, u, i) => { e.push(t.call(r, n, u, i)); }), e); }; const O = 'Reduce of empty array with no initial value'; j.reduce = j.foldl = j.inject = function (n, t, r, e) { let u = arguments.length > 2; if (n == null && (n = []), h && n.reduce === h) return e && (t = j.bind(t, e)), u ? n.reduce(t, r) : n.reduce(t); if (A(n, (n, i, a) => { u ? r = t.call(e, r, n, i, a) : (r = n, u = !0); }), !u) throw new TypeError(O); return r; }, j.reduceRight = j.foldr = function (n, t, r, e) { let u = arguments.length > 2; if (n == null && (n = []), v && n.reduceRight === v) return e && (t = j.bind(t, e)), u ? n.reduceRight(t, r) : n.reduceRight(t); let i = n.length; if (i !== +i) { var a = j.keys(n); i = a.length; } if (A(n, (o, c, l) => { c = a ? a[--i] : --i, u ? r = t.call(e, r, n[c], c, l) : (r = n[c], u = !0); }), !u) throw new TypeError(O); return r; }, j.find = j.detect = function (n, t, r) { let e; return k(n, (n, u, i) => (t.call(r, n, u, i) ? (e = n, !0) : void 0)), e; }, j.filter = j.select = function (n, t, r) { const e = []; return n == null ? e : g && n.filter === g ? n.filter(t, r) : (A(n, (n, u, i) => { t.call(r, n, u, i) && e.push(n); }), e); }, j.reject = function (n, t, r) { return j.filter(n, (n, e, u) => !t.call(r, n, e, u), r); }, j.every = j.all = function (n, t, e) { t || (t = j.identity); let u = !0; return n == null ? u : d && n.every === d ? n.every(t, e) : (A(n, (n, i, a) => ((u = u && t.call(e, n, i, a)) ? void 0 : r)), !!u); }; var k = j.some = j.any = function (n, t, e) { t || (t = j.identity); let u = !1; return n == null ? u : m && n.some === m ? n.some(t, e) : (A(n, (n, i, a) => (u || (u = t.call(e, n, i, a)) ? r : void 0)), !!u); }; j.contains = j.include = function (n, t) { return n == null ? !1 : y && n.indexOf === y ? n.indexOf(t) != -1 : k(n, (n) => n === t); }, j.invoke = function (n, t) { const r = o.call(arguments, 2); const e = j.isFunction(t); return j.map(n, (n) => (e ? t : n[t]).apply(n, r)); }, j.pluck = function (n, t) { return j.map(n, j.property(t)); }, j.where = function (n, t) { return j.filter(n, j.matches(t)); }, j.findWhere = function (n, t) { return j.find(n, j.matches(t)); }, j.max = function (n, t, r) { if (!t && j.isArray(n) && n[0] === +n[0] && n.length < 65535) return Math.max.apply(Math, n); let e = -1 / 0; let u = -1 / 0; return A(n, (n, i, a) => { const o = t ? t.call(r, n, i, a) : n; o > u && (e = n, u = o); }), e; }, j.min = function (n, t, r) { if (!t && j.isArray(n) && n[0] === +n[0] && n.length < 65535) return Math.min.apply(Math, n); let e = 1 / 0; let u = 1 / 0; return A(n, (n, i, a) => { const o = t ? t.call(r, n, i, a) : n; u > o && (e = n, u = o); }), e; }, j.shuffle = function (n) { let t; let r = 0; const e = []; return A(n, (n) => { t = j.random(r++), e[r - 1] = e[t], e[t] = n; }), e; }, j.sample = function (n, t, r) { return t == null || r ?
escape: {
'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#x27;',
},
}; T.unescape = j.invert(T.escape); const I = { escape: new RegExp(`[${j.keys(T.escape).join('')}]`, 'g'), unescape: new RegExp(`(${j.keys(T.unescape).join('|')})`, 'g') }; j.each(['escape', 'unescape'], (n) => { j[n] = function (t) { return t == null ? '' : (`${t}`).replace(I[n], (t) => T[n][t]); }; }), j.result = function (n, t) { if (n == null) return void 0; const r = n[t]; return j.isFunction(r) ? r.call(n) : r; }, j.mixin = function (n) { A(j.functions(n), (t) => { const r = j[t] = n[t]; j.prototype[t] = function () { const n = [this._wrapped]; return a.apply(n, arguments), z.call(this, r.apply(j, n)); }; }); }; let N = 0; j.uniqueId = function (n) { const t = `${++N}`; return n ? n + t : t; }, j.templateSettings = { evaluate: /<%([\s\S]+?)%>/g, interpolate: /<%=([\s\S]+?)%>/g, escape: /<%-([\s\S]+?)%>/g }; const q = /(.)^/; const B = {
"'": "'", '\\': '\\', '\r': 'r', '\n': 'n', ' ': 't', '\u2028': 'u2028', '\u2029': 'u2029',
}; const D = /\\|'|\r|\n|\t|\u2028|\u2029/g; j.template = function (n, t, r) { let e; r = j.defaults({}, r, j.templateSettings); const u = new RegExp(`${[(r.escape || q).source, (r.interpolate || q).source, (r.evaluate || q).source].join('|')}|$`, 'g'); let i = 0; let a = "__p+='"; n.replace(u, (t, r, e, u, o) => (a += n.slice(i, o).replace(D, (n) => `\\${B[n]}`), r && (a += `'+\n((__t=(${r}))==null?'':_.escape(__t))+\n'`), e && (a += `'+\n((__t=(${e}))==null?'':__t)+\n'`), u && (a += `';\n${u}\n__p+='`), i = o + t.length, t)), a += "';\n", r.variable || (a = `with(obj||{}){\n${a}}\n`), a = `${"var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n"}${a}return __p;\n`; try { e = new Function(r.variable || 'obj', '_', a); } catch (o) { throw o.source = a, o; } if (t) return e(t, j); const c = function (n) { return e.call(this, n, j); }; return c.source = `function(${r.variable || 'obj'}){\n${a}}`, c; }, j.chain = function (n) { return j(n).chain(); }; var z = function (n) { return this._chain ? j(n).chain() : n; }; j.mixin(j), A(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], (n) => { const t = e[n]; j.prototype[n] = function () { const r = this._wrapped; return t.apply(r, arguments), n != 'shift' && n != 'splice' || r.length !== 0 || delete r[0], z.call(this, r); }; }), A(['concat', 'join', 'slice'], (n) => { const t = e[n]; j.prototype[n] = function () { return z.call(this, t.apply(this._wrapped, arguments)); }; }), j.extend(j.prototype, { chain() { return this._chain = !0, this; }, value() { return this._wrapped; } }), typeof define === 'function' && define.amd && define('underscore', [], () => j);
}).call(this);