Skip to content

Instantly share code, notes, and snippets.

@Saifadin

Saifadin/error.js

Created Feb 6, 2019
Embed
What would you like to do?
(window.webpackJsonp = window.webpackJsonp || []).push([[5], {
1271: function(t, e, r) {
(function(t) {
var r, n, o, i;
function a(t) {
return (a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
return typeof t
}
: function(t) {
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
}
)(t)
}
/*!
* Fuse.js v3.3.1 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
/*!
* Fuse.js v3.3.1 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
i = function() {
return function(t) {
var e = {};
function r(n) {
if (e[n])
return e[n].exports;
var o = e[n] = {
i: n,
l: !1,
exports: {}
};
return t[n].call(o.exports, o, o.exports, r),
o.l = !0,
o.exports
}
return r.m = t,
r.c = e,
r.i = function(t) {
return t
}
,
r.d = function(t, e, n) {
r.o(t, e) || Object.defineProperty(t, e, {
configurable: !1,
enumerable: !0,
get: n
})
}
,
r.n = function(t) {
var e = t && t.__esModule ? function() {
return t.default
}
: function() {
return t
}
;
return r.d(e, "a", e),
e
}
,
r.o = function(t, e) {
return Object.prototype.hasOwnProperty.call(t, e)
}
,
r.p = "",
r(r.s = 8)
}([function(t, e, r) {
"use strict";
t.exports = function(t) {
return Array.isArray ? Array.isArray(t) : "[object Array]" === Object.prototype.toString.call(t)
}
}
, function(t, e, r) {
"use strict";
var n = function() {
function t(t, e) {
for (var r = 0; r < e.length; r++) {
var n = e[r];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(t, n.key, n)
}
}
return function(e, r, n) {
return r && t(e.prototype, r),
n && t(e, n),
e
}
}();
var o = r(5)
, i = r(7)
, a = r(4)
, s = function() {
function t(e, r) {
var n = r.location
, o = void 0 === n ? 0 : n
, i = r.distance
, s = void 0 === i ? 100 : i
, c = r.threshold
, h = void 0 === c ? .6 : c
, l = r.maxPatternLength
, u = void 0 === l ? 32 : l
, f = r.isCaseSensitive
, v = void 0 !== f && f
, p = r.tokenSeparator
, d = void 0 === p ? / +/g : p
, g = r.findAllMatches
, y = void 0 !== g && g
, m = r.minMatchCharLength
, k = void 0 === m ? 1 : m;
!function(t, e) {
if (!(t instanceof e))
throw new TypeError("Cannot call a class as a function")
}(this, t),
this.options = {
location: o,
distance: s,
threshold: h,
maxPatternLength: u,
isCaseSensitive: v,
tokenSeparator: d,
findAllMatches: y,
minMatchCharLength: k
},
this.pattern = this.options.isCaseSensitive ? e : e.toLowerCase(),
this.pattern.length <= u && (this.patternAlphabet = a(this.pattern))
}
return n(t, [{
key: "search",
value: function(t) {
if (this.options.isCaseSensitive || (t = t.toLowerCase()),
this.pattern === t)
return {
isMatch: !0,
score: 0,
matchedIndices: [[0, t.length - 1]]
};
var e = this.options
, r = e.maxPatternLength
, n = e.tokenSeparator;
if (this.pattern.length > r)
return o(t, this.pattern, n);
var a = this.options
, s = a.location
, c = a.distance
, h = a.threshold
, l = a.findAllMatches
, u = a.minMatchCharLength;
return i(t, this.pattern, this.patternAlphabet, {
location: s,
distance: c,
threshold: h,
findAllMatches: l,
minMatchCharLength: u
})
}
}]),
t
}();
t.exports = s
}
, function(t, e, r) {
"use strict";
var n = r(0);
t.exports = function(t, e) {
return function t(e, r, o) {
if (r) {
var i = r.indexOf(".")
, a = r
, s = null;
-1 !== i && (a = r.slice(0, i),
s = r.slice(i + 1));
var c = e[a];
if (null != c)
if (s || "string" != typeof c && "number" != typeof c)
if (n(c))
for (var h = 0, l = c.length; h < l; h += 1)
t(c[h], s, o);
else
s && t(c, s, o);
else
o.push(c.toString())
} else
o.push(e);
return o
}(t, e, [])
}
}
, function(t, e, r) {
"use strict";
t.exports = function() {
for (var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, r = [], n = -1, o = -1, i = 0, a = t.length; i < a; i += 1) {
var s = t[i];
s && -1 === n ? n = i : s || -1 === n || ((o = i - 1) - n + 1 >= e && r.push([n, o]),
n = -1)
}
return t[i - 1] && i - n >= e && r.push([n, i - 1]),
r
}
}
, function(t, e, r) {
"use strict";
t.exports = function(t) {
for (var e = {}, r = t.length, n = 0; n < r; n += 1)
e[t.charAt(n)] = 0;
for (var o = 0; o < r; o += 1)
e[t.charAt(o)] |= 1 << r - o - 1;
return e
}
}
, function(t, e, r) {
"use strict";
var n = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;
t.exports = function(t, e) {
var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : / +/g
, o = new RegExp(e.replace(n, "\\$&").replace(r, "|"))
, i = t.match(o)
, a = !!i
, s = [];
if (a)
for (var c = 0, h = i.length; c < h; c += 1) {
var l = i[c];
s.push([t.indexOf(l), l.length - 1])
}
return {
score: a ? .5 : 1,
isMatch: a,
matchedIndices: s
}
}
}
, function(t, e, r) {
"use strict";
t.exports = function(t, e) {
var r = e.errors
, n = void 0 === r ? 0 : r
, o = e.currentLocation
, i = void 0 === o ? 0 : o
, a = e.expectedLocation
, s = void 0 === a ? 0 : a
, c = e.distance
, h = void 0 === c ? 100 : c
, l = n / t.length
, u = Math.abs(s - i);
return h ? l + u / h : u ? 1 : l
}
}
, function(t, e, r) {
"use strict";
var n = r(6)
, o = r(3);
t.exports = function(t, e, r, i) {
for (var a = i.location, s = void 0 === a ? 0 : a, c = i.distance, h = void 0 === c ? 100 : c, l = i.threshold, u = void 0 === l ? .6 : l, f = i.findAllMatches, v = void 0 !== f && f, p = i.minMatchCharLength, d = void 0 === p ? 1 : p, g = s, y = t.length, m = u, k = t.indexOf(e, g), S = e.length, x = [], b = 0; b < y; b += 1)
x[b] = 0;
if (-1 !== k) {
var M = n(e, {
errors: 0,
currentLocation: k,
expectedLocation: g,
distance: h
});
if (m = Math.min(M, m),
-1 !== (k = t.lastIndexOf(e, g + S))) {
var w = n(e, {
errors: 0,
currentLocation: k,
expectedLocation: g,
distance: h
});
m = Math.min(w, m)
}
}
k = -1;
for (var _ = [], L = 1, A = S + y, C = 1 << S - 1, I = 0; I < S; I += 1) {
for (var O = 0, P = A; O < P; ) {
n(e, {
errors: I,
currentLocation: g + P,
expectedLocation: g,
distance: h
}) <= m ? O = P : A = P,
P = Math.floor((A - O) / 2 + O)
}
A = P;
var j = Math.max(1, g - P + 1)
, z = v ? y : Math.min(g + P, y) + S
, F = Array(z + 2);
F[z + 1] = (1 << I) - 1;
for (var T = z; T >= j; T -= 1) {
var E = T - 1
, J = r[t.charAt(E)];
if (J && (x[E] = 1),
F[T] = (F[T + 1] << 1 | 1) & J,
0 !== I && (F[T] |= (_[T + 1] | _[T]) << 1 | 1 | _[T + 1]),
F[T] & C && (L = n(e, {
errors: I,
currentLocation: E,
expectedLocation: g,
distance: h
})) <= m) {
if (m = L,
(k = E) <= g)
break;
j = Math.max(1, 2 * g - k)
}
}
if (n(e, {
errors: I + 1,
currentLocation: g,
expectedLocation: g,
distance: h
}) > m)
break;
_ = F
}
return {
isMatch: k >= 0,
score: 0 === L ? .001 : L,
matchedIndices: o(x, d)
}
}
}
, function(t, e, r) {
"use strict";
var n = "function" == typeof Symbol && "symbol" === n(Symbol.iterator) ? function(t) {
return n(t)
}
: function(t) {
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : n(t)
}
, o = function() {
function t(t, e) {
for (var r = 0; r < e.length; r++) {
var n = e[r];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(t, n.key, n)
}
}
return function(e, r, n) {
return r && t(e.prototype, r),
n && t(e, n),
e
}
}();
var i = r(1)
, a = r(2)
, s = r(0)
, c = function() {
function t(e, r) {
var n = r.location
, o = void 0 === n ? 0 : n
, i = r.distance
, s = void 0 === i ? 100 : i
, c = r.threshold
, h = void 0 === c ? .6 : c
, l = r.maxPatternLength
, u = void 0 === l ? 32 : l
, f = r.caseSensitive
, v = void 0 !== f && f
, p = r.tokenSeparator
, d = void 0 === p ? / +/g : p
, g = r.findAllMatches
, y = void 0 !== g && g
, m = r.minMatchCharLength
, k = void 0 === m ? 1 : m
, S = r.id
, x = void 0 === S ? null : S
, b = r.keys
, M = void 0 === b ? [] : b
, w = r.shouldSort
, _ = void 0 === w || w
, L = r.getFn
, A = void 0 === L ? a : L
, C = r.sortFn
, I = void 0 === C ? function(t, e) {
return t.score - e.score
}
: C
, O = r.tokenize
, P = void 0 !== O && O
, j = r.matchAllTokens
, z = void 0 !== j && j
, F = r.includeMatches
, T = void 0 !== F && F
, E = r.includeScore
, J = void 0 !== E && E
, K = r.verbose
, $ = void 0 !== K && K;
!function(t, e) {
if (!(t instanceof e))
throw new TypeError("Cannot call a class as a function")
}(this, t),
this.options = {
location: o,
distance: s,
threshold: h,
maxPatternLength: u,
isCaseSensitive: v,
tokenSeparator: d,
findAllMatches: y,
minMatchCharLength: k,
id: x,
keys: M,
includeMatches: T,
includeScore: J,
shouldSort: _,
getFn: A,
sortFn: I,
verbose: $,
tokenize: P,
matchAllTokens: z
},
this.setCollection(e)
}
return o(t, [{
key: "setCollection",
value: function(t) {
return this.list = t,
t
}
}, {
key: "search",
value: function(t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {
limit: !1
};
this._log('---------\nSearch pattern: "' + t + '"');
var r = this._prepareSearchers(t)
, n = r.tokenSearchers
, o = r.fullSearcher
, i = this._search(n, o)
, a = i.weights
, s = i.results;
return this._computeScore(a, s),
this.options.shouldSort && this._sort(s),
e.limit && "number" == typeof e.limit && (s = s.slice(0, e.limit)),
this._format(s)
}
}, {
key: "_prepareSearchers",
value: function() {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ""
, e = [];
if (this.options.tokenize)
for (var r = t.split(this.options.tokenSeparator), n = 0, o = r.length; n < o; n += 1)
e.push(new i(r[n],this.options));
return {
tokenSearchers: e,
fullSearcher: new i(t,this.options)
}
}
}, {
key: "_search",
value: function() {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []
, e = arguments[1]
, r = this.list
, n = {}
, o = [];
if ("string" == typeof r[0]) {
for (var i = 0, a = r.length; i < a; i += 1)
this._analyze({
key: "",
value: r[i],
record: i,
index: i
}, {
resultMap: n,
results: o,
tokenSearchers: t,
fullSearcher: e
});
return {
weights: null,
results: o
}
}
for (var s = {}, c = 0, h = r.length; c < h; c += 1)
for (var l = r[c], u = 0, f = this.options.keys.length; u < f; u += 1) {
var v = this.options.keys[u];
if ("string" != typeof v) {
if (s[v.name] = {
weight: 1 - v.weight || 1
},
v.weight <= 0 || v.weight > 1)
throw new Error("Key weight has to be > 0 and <= 1");
v = v.name
} else
s[v] = {
weight: 1
};
this._analyze({
key: v,
value: this.options.getFn(l, v),
record: l,
index: c
}, {
resultMap: n,
results: o,
tokenSearchers: t,
fullSearcher: e
})
}
return {
weights: s,
results: o
}
}
}, {
key: "_analyze",
value: function(t, e) {
var r = t.key
, n = t.arrayIndex
, o = void 0 === n ? -1 : n
, i = t.value
, a = t.record
, c = t.index
, h = e.tokenSearchers
, l = void 0 === h ? [] : h
, u = e.fullSearcher
, f = void 0 === u ? [] : u
, v = e.resultMap
, p = void 0 === v ? {} : v
, d = e.results
, g = void 0 === d ? [] : d;
if (null != i) {
var y = !1
, m = -1
, k = 0;
if ("string" == typeof i) {
this._log("\nKey: " + ("" === r ? "-" : r));
var S = f.search(i);
if (this._log('Full text: "' + i + '", score: ' + S.score),
this.options.tokenize) {
for (var x = i.split(this.options.tokenSeparator), b = [], M = 0; M < l.length; M += 1) {
var w = l[M];
this._log('\nPattern: "' + w.pattern + '"');
for (var _ = !1, L = 0; L < x.length; L += 1) {
var A = x[L]
, C = w.search(A)
, I = {};
C.isMatch ? (I[A] = C.score,
y = !0,
_ = !0,
b.push(C.score)) : (I[A] = 1,
this.options.matchAllTokens || b.push(1)),
this._log('Token: "' + A + '", score: ' + I[A])
}
_ && (k += 1)
}
m = b[0];
for (var O = b.length, P = 1; P < O; P += 1)
m += b[P];
m /= O,
this._log("Token score average:", m)
}
var j = S.score;
m > -1 && (j = (j + m) / 2),
this._log("Score average:", j);
var z = !this.options.tokenize || !this.options.matchAllTokens || k >= l.length;
if (this._log("\nCheck Matches: " + z),
(y || S.isMatch) && z) {
var F = p[c];
F ? F.output.push({
key: r,
arrayIndex: o,
value: i,
score: j,
matchedIndices: S.matchedIndices
}) : (p[c] = {
item: a,
output: [{
key: r,
arrayIndex: o,
value: i,
score: j,
matchedIndices: S.matchedIndices
}]
},
g.push(p[c]))
}
} else if (s(i))
for (var T = 0, E = i.length; T < E; T += 1)
this._analyze({
key: r,
arrayIndex: T,
value: i[T],
record: a,
index: c
}, {
resultMap: p,
results: g,
tokenSearchers: l,
fullSearcher: f
})
}
}
}, {
key: "_computeScore",
value: function(t, e) {
this._log("\n\nComputing score:\n");
for (var r = 0, n = e.length; r < n; r += 1) {
for (var o = e[r].output, i = o.length, a = 1, s = 1, c = 0; c < i; c += 1) {
var h = t ? t[o[c].key].weight : 1
, l = (1 === h ? o[c].score : o[c].score || .001) * h;
1 !== h ? s = Math.min(s, l) : (o[c].nScore = l,
a *= l)
}
e[r].score = 1 === s ? a : s,
this._log(e[r])
}
}
}, {
key: "_sort",
value: function(t) {
this._log("\n\nSorting...."),
t.sort(this.options.sortFn)
}
}, {
key: "_format",
value: function(t) {
var e = [];
if (this.options.verbose) {
var r = [];
this._log("\n\nOutput:\n\n", JSON.stringify(t, function(t, e) {
if ("object" === (void 0 === e ? "undefined" : n(e)) && null !== e) {
if (-1 !== r.indexOf(e))
return;
r.push(e)
}
return e
})),
r = null
}
var o = [];
this.options.includeMatches && o.push(function(t, e) {
var r = t.output;
e.matches = [];
for (var n = 0, o = r.length; n < o; n += 1) {
var i = r[n];
if (0 !== i.matchedIndices.length) {
var a = {
indices: i.matchedIndices,
value: i.value
};
i.key && (a.key = i.key),
i.hasOwnProperty("arrayIndex") && i.arrayIndex > -1 && (a.arrayIndex = i.arrayIndex),
e.matches.push(a)
}
}
}),
this.options.includeScore && o.push(function(t, e) {
e.score = t.score
});
for (var i = 0, a = t.length; i < a; i += 1) {
var s = t[i];
if (this.options.id && (s.item = this.options.getFn(s.item, this.options.id)[0]),
o.length) {
for (var c = {
item: s.item
}, h = 0, l = o.length; h < l; h += 1)
o[h](s, c);
e.push(c)
} else
e.push(s.item)
}
return e
}
}, {
key: "_log",
value: function() {
var t;
this.options.verbose && (t = console).log.apply(t, arguments)
}
}]),
t
}();
t.exports = c
}
])
}
,
"object" === a(e) && "object" === a(t) ? t.exports = i() : (n = [],
void 0 === (o = "function" == typeof (r = i) ? r.apply(e, n) : r) || (t.exports = o))
}
).call(this, r(123)(t))
}
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment