@zelloptt/react-native-zello-sdk 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -2
- package/lib/commonjs/docs/assets/highlight.css +71 -0
- package/lib/commonjs/docs/assets/icons.js +20 -0
- package/lib/commonjs/docs/assets/icons.js.map +1 -0
- package/lib/commonjs/docs/assets/icons.svg +1 -0
- package/lib/commonjs/docs/assets/main.js +1475 -0
- package/lib/commonjs/docs/assets/main.js.map +1 -0
- package/lib/commonjs/docs/assets/navigation.js +4 -0
- package/lib/commonjs/docs/assets/navigation.js.map +1 -0
- package/lib/commonjs/docs/assets/search.js +4 -0
- package/lib/commonjs/docs/assets/search.js.map +1 -0
- package/lib/commonjs/docs/assets/style.css +1448 -0
- package/lib/commonjs/docs/classes/sdk.Zello.html +158 -0
- package/lib/commonjs/docs/classes/types.ZelloAlertMessage.html +15 -0
- package/lib/commonjs/docs/classes/types.ZelloChannel.html +17 -0
- package/lib/commonjs/docs/classes/types.ZelloChannelUser.html +4 -0
- package/lib/commonjs/docs/classes/types.ZelloHistoryAlertMessage.html +17 -0
- package/lib/commonjs/docs/classes/types.ZelloHistoryImageMessage.html +16 -0
- package/lib/commonjs/docs/classes/types.ZelloHistoryLocationMessage.html +23 -0
- package/lib/commonjs/docs/classes/types.ZelloHistoryTextMessage.html +17 -0
- package/lib/commonjs/docs/classes/types.ZelloHistoryVoiceMessage.html +18 -0
- package/lib/commonjs/docs/classes/types.ZelloImageMessage.html +16 -0
- package/lib/commonjs/docs/classes/types.ZelloIncomingEmergency.html +13 -0
- package/lib/commonjs/docs/classes/types.ZelloIncomingVoiceMessage.html +12 -0
- package/lib/commonjs/docs/classes/types.ZelloLocationMessage.html +20 -0
- package/lib/commonjs/docs/classes/types.ZelloOutgoingEmergency.html +9 -0
- package/lib/commonjs/docs/classes/types.ZelloOutgoingVoiceMessage.html +14 -0
- package/lib/commonjs/docs/classes/types.ZelloRecentEntry.html +14 -0
- package/lib/commonjs/docs/classes/types.ZelloTextMessage.html +14 -0
- package/lib/commonjs/docs/classes/types.ZelloUser.html +20 -0
- package/lib/commonjs/docs/enums/events.ZelloEvent.html +124 -0
- package/lib/commonjs/docs/enums/types.ZelloAccountStatus.html +7 -0
- package/lib/commonjs/docs/enums/types.ZelloChannelAlertLevel.html +7 -0
- package/lib/commonjs/docs/enums/types.ZelloChannelConnectionStatus.html +5 -0
- package/lib/commonjs/docs/enums/types.ZelloConnectionError.html +5 -0
- package/lib/commonjs/docs/enums/types.ZelloConnectionState.html +6 -0
- package/lib/commonjs/docs/enums/types.ZelloContactType.html +4 -0
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageError.html +4 -0
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageState.html +7 -0
- package/lib/commonjs/docs/enums/types.ZelloRecentEntryType.html +7 -0
- package/lib/commonjs/docs/enums/types.ZelloUserStatus.html +11 -0
- package/lib/commonjs/docs/index.html +80 -0
- package/lib/commonjs/docs/media/CONTRIBUTING.md +107 -0
- package/lib/commonjs/docs/modules/events.html +2 -0
- package/lib/commonjs/docs/modules/index.html +36 -0
- package/lib/commonjs/docs/modules/sdk.html +2 -0
- package/lib/commonjs/docs/modules/types.html +34 -0
- package/lib/commonjs/docs/types/types.ZelloChannelOptions.html +14 -0
- package/lib/commonjs/docs/types/types.ZelloConfig.html +8 -0
- package/lib/commonjs/docs/types/types.ZelloContact.html +7 -0
- package/lib/commonjs/docs/types/types.ZelloCredentials.html +6 -0
- package/lib/commonjs/docs/types/types.ZelloHistoryMessage.html +9 -0
- package/lib/commonjs/docs/types/types.ZelloMessage.html +7 -0
- package/lib/module/docs/assets/highlight.css +71 -0
- package/lib/module/docs/assets/icons.js +20 -0
- package/lib/module/docs/assets/icons.js.map +1 -0
- package/lib/module/docs/assets/icons.svg +1 -0
- package/lib/module/docs/assets/main.js +1475 -0
- package/lib/module/docs/assets/main.js.map +1 -0
- package/lib/module/docs/assets/navigation.js +4 -0
- package/lib/module/docs/assets/navigation.js.map +1 -0
- package/lib/module/docs/assets/search.js +4 -0
- package/lib/module/docs/assets/search.js.map +1 -0
- package/lib/module/docs/assets/style.css +1448 -0
- package/lib/module/docs/classes/sdk.Zello.html +158 -0
- package/lib/module/docs/classes/types.ZelloAlertMessage.html +15 -0
- package/lib/module/docs/classes/types.ZelloChannel.html +17 -0
- package/lib/module/docs/classes/types.ZelloChannelUser.html +4 -0
- package/lib/module/docs/classes/types.ZelloHistoryAlertMessage.html +17 -0
- package/lib/module/docs/classes/types.ZelloHistoryImageMessage.html +16 -0
- package/lib/module/docs/classes/types.ZelloHistoryLocationMessage.html +23 -0
- package/lib/module/docs/classes/types.ZelloHistoryTextMessage.html +17 -0
- package/lib/module/docs/classes/types.ZelloHistoryVoiceMessage.html +18 -0
- package/lib/module/docs/classes/types.ZelloImageMessage.html +16 -0
- package/lib/module/docs/classes/types.ZelloIncomingEmergency.html +13 -0
- package/lib/module/docs/classes/types.ZelloIncomingVoiceMessage.html +12 -0
- package/lib/module/docs/classes/types.ZelloLocationMessage.html +20 -0
- package/lib/module/docs/classes/types.ZelloOutgoingEmergency.html +9 -0
- package/lib/module/docs/classes/types.ZelloOutgoingVoiceMessage.html +14 -0
- package/lib/module/docs/classes/types.ZelloRecentEntry.html +14 -0
- package/lib/module/docs/classes/types.ZelloTextMessage.html +14 -0
- package/lib/module/docs/classes/types.ZelloUser.html +20 -0
- package/lib/module/docs/enums/events.ZelloEvent.html +124 -0
- package/lib/module/docs/enums/types.ZelloAccountStatus.html +7 -0
- package/lib/module/docs/enums/types.ZelloChannelAlertLevel.html +7 -0
- package/lib/module/docs/enums/types.ZelloChannelConnectionStatus.html +5 -0
- package/lib/module/docs/enums/types.ZelloConnectionError.html +5 -0
- package/lib/module/docs/enums/types.ZelloConnectionState.html +6 -0
- package/lib/module/docs/enums/types.ZelloContactType.html +4 -0
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageError.html +4 -0
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageState.html +7 -0
- package/lib/module/docs/enums/types.ZelloRecentEntryType.html +7 -0
- package/lib/module/docs/enums/types.ZelloUserStatus.html +11 -0
- package/lib/module/docs/index.html +80 -0
- package/lib/module/docs/media/CONTRIBUTING.md +107 -0
- package/lib/module/docs/modules/events.html +2 -0
- package/lib/module/docs/modules/index.html +36 -0
- package/lib/module/docs/modules/sdk.html +2 -0
- package/lib/module/docs/modules/types.html +34 -0
- package/lib/module/docs/types/types.ZelloChannelOptions.html +14 -0
- package/lib/module/docs/types/types.ZelloConfig.html +8 -0
- package/lib/module/docs/types/types.ZelloContact.html +7 -0
- package/lib/module/docs/types/types.ZelloCredentials.html +6 -0
- package/lib/module/docs/types/types.ZelloHistoryMessage.html +9 -0
- package/lib/module/docs/types/types.ZelloMessage.html +7 -0
- package/package.json +4 -2
- package/react-native-zello-sdk.podspec +1 -1
|
@@ -0,0 +1,1475 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
4
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
5
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
6
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
7
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
8
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
9
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
10
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
12
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
window.translations = {
|
|
16
|
+
"copy": "Copy",
|
|
17
|
+
"copied": "Copied!",
|
|
18
|
+
"normally_hidden": "This member is normally hidden due to your filter settings."
|
|
19
|
+
};
|
|
20
|
+
"use strict";
|
|
21
|
+
(() => {
|
|
22
|
+
var Pe = Object.create;
|
|
23
|
+
var ie = Object.defineProperty;
|
|
24
|
+
var Oe = Object.getOwnPropertyDescriptor;
|
|
25
|
+
var _e = Object.getOwnPropertyNames;
|
|
26
|
+
var Re = Object.getPrototypeOf,
|
|
27
|
+
Me = Object.prototype.hasOwnProperty;
|
|
28
|
+
var Fe = (t, e) => () => (e || t((e = {
|
|
29
|
+
exports: {}
|
|
30
|
+
}).exports, e), e.exports);
|
|
31
|
+
var De = (t, e, n, r) => {
|
|
32
|
+
if (e && typeof e == "object" || typeof e == "function") for (let i of _e(e)) !Me.call(t, i) && i !== n && ie(t, i, {
|
|
33
|
+
get: () => e[i],
|
|
34
|
+
enumerable: !(r = Oe(e, i)) || r.enumerable
|
|
35
|
+
});
|
|
36
|
+
return t;
|
|
37
|
+
};
|
|
38
|
+
var Ae = (t, e, n) => (n = t != null ? Pe(Re(t)) : {}, De(e || !t || !t.__esModule ? ie(n, "default", {
|
|
39
|
+
value: t,
|
|
40
|
+
enumerable: !0
|
|
41
|
+
}) : n, t));
|
|
42
|
+
var ue = Fe((ae, le) => {
|
|
43
|
+
(function () {
|
|
44
|
+
var t = function (e) {
|
|
45
|
+
var n = new t.Builder();
|
|
46
|
+
return n.pipeline.add(t.trimmer, t.stopWordFilter, t.stemmer), n.searchPipeline.add(t.stemmer), e.call(n, n), n.build();
|
|
47
|
+
};
|
|
48
|
+
t.version = "2.3.9";
|
|
49
|
+
t.utils = {}, t.utils.warn = function (e) {
|
|
50
|
+
return function (n) {
|
|
51
|
+
e.console && console.warn && console.warn(n);
|
|
52
|
+
};
|
|
53
|
+
}(this), t.utils.asString = function (e) {
|
|
54
|
+
return e == null ? "" : e.toString();
|
|
55
|
+
}, t.utils.clone = function (e) {
|
|
56
|
+
if (e == null) return e;
|
|
57
|
+
for (var n = Object.create(null), r = Object.keys(e), i = 0; i < r.length; i++) {
|
|
58
|
+
var s = r[i],
|
|
59
|
+
o = e[s];
|
|
60
|
+
if (Array.isArray(o)) {
|
|
61
|
+
n[s] = o.slice();
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (typeof o == "string" || typeof o == "number" || typeof o == "boolean") {
|
|
65
|
+
n[s] = o;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
throw new TypeError("clone is not deep and does not support nested objects");
|
|
69
|
+
}
|
|
70
|
+
return n;
|
|
71
|
+
}, t.FieldRef = function (e, n, r) {
|
|
72
|
+
this.docRef = e, this.fieldName = n, this._stringValue = r;
|
|
73
|
+
}, t.FieldRef.joiner = "/", t.FieldRef.fromString = function (e) {
|
|
74
|
+
var n = e.indexOf(t.FieldRef.joiner);
|
|
75
|
+
if (n === -1) throw "malformed field ref string";
|
|
76
|
+
var r = e.slice(0, n),
|
|
77
|
+
i = e.slice(n + 1);
|
|
78
|
+
return new t.FieldRef(i, r, e);
|
|
79
|
+
}, t.FieldRef.prototype.toString = function () {
|
|
80
|
+
return this._stringValue == null && (this._stringValue = this.fieldName + t.FieldRef.joiner + this.docRef), this._stringValue;
|
|
81
|
+
};
|
|
82
|
+
t.Set = function (e) {
|
|
83
|
+
if (this.elements = Object.create(null), e) {
|
|
84
|
+
this.length = e.length;
|
|
85
|
+
for (var n = 0; n < this.length; n++) this.elements[e[n]] = !0;
|
|
86
|
+
} else this.length = 0;
|
|
87
|
+
}, t.Set.complete = {
|
|
88
|
+
intersect: function (e) {
|
|
89
|
+
return e;
|
|
90
|
+
},
|
|
91
|
+
union: function () {
|
|
92
|
+
return this;
|
|
93
|
+
},
|
|
94
|
+
contains: function () {
|
|
95
|
+
return !0;
|
|
96
|
+
}
|
|
97
|
+
}, t.Set.empty = {
|
|
98
|
+
intersect: function () {
|
|
99
|
+
return this;
|
|
100
|
+
},
|
|
101
|
+
union: function (e) {
|
|
102
|
+
return e;
|
|
103
|
+
},
|
|
104
|
+
contains: function () {
|
|
105
|
+
return !1;
|
|
106
|
+
}
|
|
107
|
+
}, t.Set.prototype.contains = function (e) {
|
|
108
|
+
return !!this.elements[e];
|
|
109
|
+
}, t.Set.prototype.intersect = function (e) {
|
|
110
|
+
var n,
|
|
111
|
+
r,
|
|
112
|
+
i,
|
|
113
|
+
s = [];
|
|
114
|
+
if (e === t.Set.complete) return this;
|
|
115
|
+
if (e === t.Set.empty) return e;
|
|
116
|
+
this.length < e.length ? (n = this, r = e) : (n = e, r = this), i = Object.keys(n.elements);
|
|
117
|
+
for (var o = 0; o < i.length; o++) {
|
|
118
|
+
var a = i[o];
|
|
119
|
+
a in r.elements && s.push(a);
|
|
120
|
+
}
|
|
121
|
+
return new t.Set(s);
|
|
122
|
+
}, t.Set.prototype.union = function (e) {
|
|
123
|
+
return e === t.Set.complete ? t.Set.complete : e === t.Set.empty ? this : new t.Set(Object.keys(this.elements).concat(Object.keys(e.elements)));
|
|
124
|
+
}, t.idf = function (e, n) {
|
|
125
|
+
var r = 0;
|
|
126
|
+
for (var i in e) i != "_index" && (r += Object.keys(e[i]).length);
|
|
127
|
+
var s = (n - r + .5) / (r + .5);
|
|
128
|
+
return Math.log(1 + Math.abs(s));
|
|
129
|
+
}, t.Token = function (e, n) {
|
|
130
|
+
this.str = e || "", this.metadata = n || {};
|
|
131
|
+
}, t.Token.prototype.toString = function () {
|
|
132
|
+
return this.str;
|
|
133
|
+
}, t.Token.prototype.update = function (e) {
|
|
134
|
+
return this.str = e(this.str, this.metadata), this;
|
|
135
|
+
}, t.Token.prototype.clone = function (e) {
|
|
136
|
+
return e = e || function (n) {
|
|
137
|
+
return n;
|
|
138
|
+
}, new t.Token(e(this.str, this.metadata), this.metadata);
|
|
139
|
+
};
|
|
140
|
+
t.tokenizer = function (e, n) {
|
|
141
|
+
if (e == null || e == null) return [];
|
|
142
|
+
if (Array.isArray(e)) return e.map(function (m) {
|
|
143
|
+
return new t.Token(t.utils.asString(m).toLowerCase(), t.utils.clone(n));
|
|
144
|
+
});
|
|
145
|
+
for (var r = e.toString().toLowerCase(), i = r.length, s = [], o = 0, a = 0; o <= i; o++) {
|
|
146
|
+
var l = r.charAt(o),
|
|
147
|
+
u = o - a;
|
|
148
|
+
if (l.match(t.tokenizer.separator) || o == i) {
|
|
149
|
+
if (u > 0) {
|
|
150
|
+
var d = t.utils.clone(n) || {};
|
|
151
|
+
d.position = [a, u], d.index = s.length, s.push(new t.Token(r.slice(a, o), d));
|
|
152
|
+
}
|
|
153
|
+
a = o + 1;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return s;
|
|
157
|
+
}, t.tokenizer.separator = /[\s\-]+/;
|
|
158
|
+
t.Pipeline = function () {
|
|
159
|
+
this._stack = [];
|
|
160
|
+
}, t.Pipeline.registeredFunctions = Object.create(null), t.Pipeline.registerFunction = function (e, n) {
|
|
161
|
+
n in this.registeredFunctions && t.utils.warn("Overwriting existing registered function: " + n), e.label = n, t.Pipeline.registeredFunctions[e.label] = e;
|
|
162
|
+
}, t.Pipeline.warnIfFunctionNotRegistered = function (e) {
|
|
163
|
+
var n = e.label && e.label in this.registeredFunctions;
|
|
164
|
+
n || t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index.
|
|
165
|
+
`, e);
|
|
166
|
+
}, t.Pipeline.load = function (e) {
|
|
167
|
+
var n = new t.Pipeline();
|
|
168
|
+
return e.forEach(function (r) {
|
|
169
|
+
var i = t.Pipeline.registeredFunctions[r];
|
|
170
|
+
if (i) n.add(i);else throw new Error("Cannot load unregistered function: " + r);
|
|
171
|
+
}), n;
|
|
172
|
+
}, t.Pipeline.prototype.add = function () {
|
|
173
|
+
var e = Array.prototype.slice.call(arguments);
|
|
174
|
+
e.forEach(function (n) {
|
|
175
|
+
t.Pipeline.warnIfFunctionNotRegistered(n), this._stack.push(n);
|
|
176
|
+
}, this);
|
|
177
|
+
}, t.Pipeline.prototype.after = function (e, n) {
|
|
178
|
+
t.Pipeline.warnIfFunctionNotRegistered(n);
|
|
179
|
+
var r = this._stack.indexOf(e);
|
|
180
|
+
if (r == -1) throw new Error("Cannot find existingFn");
|
|
181
|
+
r = r + 1, this._stack.splice(r, 0, n);
|
|
182
|
+
}, t.Pipeline.prototype.before = function (e, n) {
|
|
183
|
+
t.Pipeline.warnIfFunctionNotRegistered(n);
|
|
184
|
+
var r = this._stack.indexOf(e);
|
|
185
|
+
if (r == -1) throw new Error("Cannot find existingFn");
|
|
186
|
+
this._stack.splice(r, 0, n);
|
|
187
|
+
}, t.Pipeline.prototype.remove = function (e) {
|
|
188
|
+
var n = this._stack.indexOf(e);
|
|
189
|
+
n != -1 && this._stack.splice(n, 1);
|
|
190
|
+
}, t.Pipeline.prototype.run = function (e) {
|
|
191
|
+
for (var n = this._stack.length, r = 0; r < n; r++) {
|
|
192
|
+
for (var i = this._stack[r], s = [], o = 0; o < e.length; o++) {
|
|
193
|
+
var a = i(e[o], o, e);
|
|
194
|
+
if (!(a == null || a === "")) if (Array.isArray(a)) for (var l = 0; l < a.length; l++) s.push(a[l]);else s.push(a);
|
|
195
|
+
}
|
|
196
|
+
e = s;
|
|
197
|
+
}
|
|
198
|
+
return e;
|
|
199
|
+
}, t.Pipeline.prototype.runString = function (e, n) {
|
|
200
|
+
var r = new t.Token(e, n);
|
|
201
|
+
return this.run([r]).map(function (i) {
|
|
202
|
+
return i.toString();
|
|
203
|
+
});
|
|
204
|
+
}, t.Pipeline.prototype.reset = function () {
|
|
205
|
+
this._stack = [];
|
|
206
|
+
}, t.Pipeline.prototype.toJSON = function () {
|
|
207
|
+
return this._stack.map(function (e) {
|
|
208
|
+
return t.Pipeline.warnIfFunctionNotRegistered(e), e.label;
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
t.Vector = function (e) {
|
|
212
|
+
this._magnitude = 0, this.elements = e || [];
|
|
213
|
+
}, t.Vector.prototype.positionForIndex = function (e) {
|
|
214
|
+
if (this.elements.length == 0) return 0;
|
|
215
|
+
for (var n = 0, r = this.elements.length / 2, i = r - n, s = Math.floor(i / 2), o = this.elements[s * 2]; i > 1 && (o < e && (n = s), o > e && (r = s), o != e);) i = r - n, s = n + Math.floor(i / 2), o = this.elements[s * 2];
|
|
216
|
+
if (o == e || o > e) return s * 2;
|
|
217
|
+
if (o < e) return (s + 1) * 2;
|
|
218
|
+
}, t.Vector.prototype.insert = function (e, n) {
|
|
219
|
+
this.upsert(e, n, function () {
|
|
220
|
+
throw "duplicate index";
|
|
221
|
+
});
|
|
222
|
+
}, t.Vector.prototype.upsert = function (e, n, r) {
|
|
223
|
+
this._magnitude = 0;
|
|
224
|
+
var i = this.positionForIndex(e);
|
|
225
|
+
this.elements[i] == e ? this.elements[i + 1] = r(this.elements[i + 1], n) : this.elements.splice(i, 0, e, n);
|
|
226
|
+
}, t.Vector.prototype.magnitude = function () {
|
|
227
|
+
if (this._magnitude) return this._magnitude;
|
|
228
|
+
for (var e = 0, n = this.elements.length, r = 1; r < n; r += 2) {
|
|
229
|
+
var i = this.elements[r];
|
|
230
|
+
e += i * i;
|
|
231
|
+
}
|
|
232
|
+
return this._magnitude = Math.sqrt(e);
|
|
233
|
+
}, t.Vector.prototype.dot = function (e) {
|
|
234
|
+
for (var n = 0, r = this.elements, i = e.elements, s = r.length, o = i.length, a = 0, l = 0, u = 0, d = 0; u < s && d < o;) a = r[u], l = i[d], a < l ? u += 2 : a > l ? d += 2 : a == l && (n += r[u + 1] * i[d + 1], u += 2, d += 2);
|
|
235
|
+
return n;
|
|
236
|
+
}, t.Vector.prototype.similarity = function (e) {
|
|
237
|
+
return this.dot(e) / this.magnitude() || 0;
|
|
238
|
+
}, t.Vector.prototype.toArray = function () {
|
|
239
|
+
for (var e = new Array(this.elements.length / 2), n = 1, r = 0; n < this.elements.length; n += 2, r++) e[r] = this.elements[n];
|
|
240
|
+
return e;
|
|
241
|
+
}, t.Vector.prototype.toJSON = function () {
|
|
242
|
+
return this.elements;
|
|
243
|
+
};
|
|
244
|
+
t.stemmer = function () {
|
|
245
|
+
var e = {
|
|
246
|
+
ational: "ate",
|
|
247
|
+
tional: "tion",
|
|
248
|
+
enci: "ence",
|
|
249
|
+
anci: "ance",
|
|
250
|
+
izer: "ize",
|
|
251
|
+
bli: "ble",
|
|
252
|
+
alli: "al",
|
|
253
|
+
entli: "ent",
|
|
254
|
+
eli: "e",
|
|
255
|
+
ousli: "ous",
|
|
256
|
+
ization: "ize",
|
|
257
|
+
ation: "ate",
|
|
258
|
+
ator: "ate",
|
|
259
|
+
alism: "al",
|
|
260
|
+
iveness: "ive",
|
|
261
|
+
fulness: "ful",
|
|
262
|
+
ousness: "ous",
|
|
263
|
+
aliti: "al",
|
|
264
|
+
iviti: "ive",
|
|
265
|
+
biliti: "ble",
|
|
266
|
+
logi: "log"
|
|
267
|
+
},
|
|
268
|
+
n = {
|
|
269
|
+
icate: "ic",
|
|
270
|
+
ative: "",
|
|
271
|
+
alize: "al",
|
|
272
|
+
iciti: "ic",
|
|
273
|
+
ical: "ic",
|
|
274
|
+
ful: "",
|
|
275
|
+
ness: ""
|
|
276
|
+
},
|
|
277
|
+
r = "[^aeiou]",
|
|
278
|
+
i = "[aeiouy]",
|
|
279
|
+
s = r + "[^aeiouy]*",
|
|
280
|
+
o = i + "[aeiou]*",
|
|
281
|
+
a = "^(" + s + ")?" + o + s,
|
|
282
|
+
l = "^(" + s + ")?" + o + s + "(" + o + ")?$",
|
|
283
|
+
u = "^(" + s + ")?" + o + s + o + s,
|
|
284
|
+
d = "^(" + s + ")?" + i,
|
|
285
|
+
m = new RegExp(a),
|
|
286
|
+
p = new RegExp(u),
|
|
287
|
+
b = new RegExp(l),
|
|
288
|
+
g = new RegExp(d),
|
|
289
|
+
L = /^(.+?)(ss|i)es$/,
|
|
290
|
+
f = /^(.+?)([^s])s$/,
|
|
291
|
+
y = /^(.+?)eed$/,
|
|
292
|
+
S = /^(.+?)(ed|ing)$/,
|
|
293
|
+
w = /.$/,
|
|
294
|
+
k = /(at|bl|iz)$/,
|
|
295
|
+
_ = new RegExp("([^aeiouylsz])\\1$"),
|
|
296
|
+
B = new RegExp("^" + s + i + "[^aeiouwxy]$"),
|
|
297
|
+
A = /^(.+?[^aeiou])y$/,
|
|
298
|
+
j = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,
|
|
299
|
+
q = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,
|
|
300
|
+
V = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,
|
|
301
|
+
$ = /^(.+?)(s|t)(ion)$/,
|
|
302
|
+
C = /^(.+?)e$/,
|
|
303
|
+
z = /ll$/,
|
|
304
|
+
W = new RegExp("^" + s + i + "[^aeiouwxy]$"),
|
|
305
|
+
H = function (c) {
|
|
306
|
+
var v, P, T, h, x, O, M;
|
|
307
|
+
if (c.length < 3) return c;
|
|
308
|
+
if (T = c.substr(0, 1), T == "y" && (c = T.toUpperCase() + c.substr(1)), h = L, x = f, h.test(c) ? c = c.replace(h, "$1$2") : x.test(c) && (c = c.replace(x, "$1$2")), h = y, x = S, h.test(c)) {
|
|
309
|
+
var E = h.exec(c);
|
|
310
|
+
h = m, h.test(E[1]) && (h = w, c = c.replace(h, ""));
|
|
311
|
+
} else if (x.test(c)) {
|
|
312
|
+
var E = x.exec(c);
|
|
313
|
+
v = E[1], x = g, x.test(v) && (c = v, x = k, O = _, M = B, x.test(c) ? c = c + "e" : O.test(c) ? (h = w, c = c.replace(h, "")) : M.test(c) && (c = c + "e"));
|
|
314
|
+
}
|
|
315
|
+
if (h = A, h.test(c)) {
|
|
316
|
+
var E = h.exec(c);
|
|
317
|
+
v = E[1], c = v + "i";
|
|
318
|
+
}
|
|
319
|
+
if (h = j, h.test(c)) {
|
|
320
|
+
var E = h.exec(c);
|
|
321
|
+
v = E[1], P = E[2], h = m, h.test(v) && (c = v + e[P]);
|
|
322
|
+
}
|
|
323
|
+
if (h = q, h.test(c)) {
|
|
324
|
+
var E = h.exec(c);
|
|
325
|
+
v = E[1], P = E[2], h = m, h.test(v) && (c = v + n[P]);
|
|
326
|
+
}
|
|
327
|
+
if (h = V, x = $, h.test(c)) {
|
|
328
|
+
var E = h.exec(c);
|
|
329
|
+
v = E[1], h = p, h.test(v) && (c = v);
|
|
330
|
+
} else if (x.test(c)) {
|
|
331
|
+
var E = x.exec(c);
|
|
332
|
+
v = E[1] + E[2], x = p, x.test(v) && (c = v);
|
|
333
|
+
}
|
|
334
|
+
if (h = C, h.test(c)) {
|
|
335
|
+
var E = h.exec(c);
|
|
336
|
+
v = E[1], h = p, x = b, O = W, (h.test(v) || x.test(v) && !O.test(v)) && (c = v);
|
|
337
|
+
}
|
|
338
|
+
return h = z, x = p, h.test(c) && x.test(c) && (h = w, c = c.replace(h, "")), T == "y" && (c = T.toLowerCase() + c.substr(1)), c;
|
|
339
|
+
};
|
|
340
|
+
return function (R) {
|
|
341
|
+
return R.update(H);
|
|
342
|
+
};
|
|
343
|
+
}(), t.Pipeline.registerFunction(t.stemmer, "stemmer");
|
|
344
|
+
t.generateStopWordFilter = function (e) {
|
|
345
|
+
var n = e.reduce(function (r, i) {
|
|
346
|
+
return r[i] = i, r;
|
|
347
|
+
}, {});
|
|
348
|
+
return function (r) {
|
|
349
|
+
if (r && n[r.toString()] !== r.toString()) return r;
|
|
350
|
+
};
|
|
351
|
+
}, t.stopWordFilter = t.generateStopWordFilter(["a", "able", "about", "across", "after", "all", "almost", "also", "am", "among", "an", "and", "any", "are", "as", "at", "be", "because", "been", "but", "by", "can", "cannot", "could", "dear", "did", "do", "does", "either", "else", "ever", "every", "for", "from", "get", "got", "had", "has", "have", "he", "her", "hers", "him", "his", "how", "however", "i", "if", "in", "into", "is", "it", "its", "just", "least", "let", "like", "likely", "may", "me", "might", "most", "must", "my", "neither", "no", "nor", "not", "of", "off", "often", "on", "only", "or", "other", "our", "own", "rather", "said", "say", "says", "she", "should", "since", "so", "some", "than", "that", "the", "their", "them", "then", "there", "these", "they", "this", "tis", "to", "too", "twas", "us", "wants", "was", "we", "were", "what", "when", "where", "which", "while", "who", "whom", "why", "will", "with", "would", "yet", "you", "your"]), t.Pipeline.registerFunction(t.stopWordFilter, "stopWordFilter");
|
|
352
|
+
t.trimmer = function (e) {
|
|
353
|
+
return e.update(function (n) {
|
|
354
|
+
return n.replace(/^\W+/, "").replace(/\W+$/, "");
|
|
355
|
+
});
|
|
356
|
+
}, t.Pipeline.registerFunction(t.trimmer, "trimmer");
|
|
357
|
+
t.TokenSet = function () {
|
|
358
|
+
this.final = !1, this.edges = {}, this.id = t.TokenSet._nextId, t.TokenSet._nextId += 1;
|
|
359
|
+
}, t.TokenSet._nextId = 1, t.TokenSet.fromArray = function (e) {
|
|
360
|
+
for (var n = new t.TokenSet.Builder(), r = 0, i = e.length; r < i; r++) n.insert(e[r]);
|
|
361
|
+
return n.finish(), n.root;
|
|
362
|
+
}, t.TokenSet.fromClause = function (e) {
|
|
363
|
+
return "editDistance" in e ? t.TokenSet.fromFuzzyString(e.term, e.editDistance) : t.TokenSet.fromString(e.term);
|
|
364
|
+
}, t.TokenSet.fromFuzzyString = function (e, n) {
|
|
365
|
+
for (var r = new t.TokenSet(), i = [{
|
|
366
|
+
node: r,
|
|
367
|
+
editsRemaining: n,
|
|
368
|
+
str: e
|
|
369
|
+
}]; i.length;) {
|
|
370
|
+
var s = i.pop();
|
|
371
|
+
if (s.str.length > 0) {
|
|
372
|
+
var o = s.str.charAt(0),
|
|
373
|
+
a;
|
|
374
|
+
o in s.node.edges ? a = s.node.edges[o] : (a = new t.TokenSet(), s.node.edges[o] = a), s.str.length == 1 && (a.final = !0), i.push({
|
|
375
|
+
node: a,
|
|
376
|
+
editsRemaining: s.editsRemaining,
|
|
377
|
+
str: s.str.slice(1)
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
if (s.editsRemaining != 0) {
|
|
381
|
+
if ("*" in s.node.edges) var l = s.node.edges["*"];else {
|
|
382
|
+
var l = new t.TokenSet();
|
|
383
|
+
s.node.edges["*"] = l;
|
|
384
|
+
}
|
|
385
|
+
if (s.str.length == 0 && (l.final = !0), i.push({
|
|
386
|
+
node: l,
|
|
387
|
+
editsRemaining: s.editsRemaining - 1,
|
|
388
|
+
str: s.str
|
|
389
|
+
}), s.str.length > 1 && i.push({
|
|
390
|
+
node: s.node,
|
|
391
|
+
editsRemaining: s.editsRemaining - 1,
|
|
392
|
+
str: s.str.slice(1)
|
|
393
|
+
}), s.str.length == 1 && (s.node.final = !0), s.str.length >= 1) {
|
|
394
|
+
if ("*" in s.node.edges) var u = s.node.edges["*"];else {
|
|
395
|
+
var u = new t.TokenSet();
|
|
396
|
+
s.node.edges["*"] = u;
|
|
397
|
+
}
|
|
398
|
+
s.str.length == 1 && (u.final = !0), i.push({
|
|
399
|
+
node: u,
|
|
400
|
+
editsRemaining: s.editsRemaining - 1,
|
|
401
|
+
str: s.str.slice(1)
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
if (s.str.length > 1) {
|
|
405
|
+
var d = s.str.charAt(0),
|
|
406
|
+
m = s.str.charAt(1),
|
|
407
|
+
p;
|
|
408
|
+
m in s.node.edges ? p = s.node.edges[m] : (p = new t.TokenSet(), s.node.edges[m] = p), s.str.length == 1 && (p.final = !0), i.push({
|
|
409
|
+
node: p,
|
|
410
|
+
editsRemaining: s.editsRemaining - 1,
|
|
411
|
+
str: d + s.str.slice(2)
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return r;
|
|
417
|
+
}, t.TokenSet.fromString = function (e) {
|
|
418
|
+
for (var n = new t.TokenSet(), r = n, i = 0, s = e.length; i < s; i++) {
|
|
419
|
+
var o = e[i],
|
|
420
|
+
a = i == s - 1;
|
|
421
|
+
if (o == "*") n.edges[o] = n, n.final = a;else {
|
|
422
|
+
var l = new t.TokenSet();
|
|
423
|
+
l.final = a, n.edges[o] = l, n = l;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return r;
|
|
427
|
+
}, t.TokenSet.prototype.toArray = function () {
|
|
428
|
+
for (var e = [], n = [{
|
|
429
|
+
prefix: "",
|
|
430
|
+
node: this
|
|
431
|
+
}]; n.length;) {
|
|
432
|
+
var r = n.pop(),
|
|
433
|
+
i = Object.keys(r.node.edges),
|
|
434
|
+
s = i.length;
|
|
435
|
+
r.node.final && (r.prefix.charAt(0), e.push(r.prefix));
|
|
436
|
+
for (var o = 0; o < s; o++) {
|
|
437
|
+
var a = i[o];
|
|
438
|
+
n.push({
|
|
439
|
+
prefix: r.prefix.concat(a),
|
|
440
|
+
node: r.node.edges[a]
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return e;
|
|
445
|
+
}, t.TokenSet.prototype.toString = function () {
|
|
446
|
+
if (this._str) return this._str;
|
|
447
|
+
for (var e = this.final ? "1" : "0", n = Object.keys(this.edges).sort(), r = n.length, i = 0; i < r; i++) {
|
|
448
|
+
var s = n[i],
|
|
449
|
+
o = this.edges[s];
|
|
450
|
+
e = e + s + o.id;
|
|
451
|
+
}
|
|
452
|
+
return e;
|
|
453
|
+
}, t.TokenSet.prototype.intersect = function (e) {
|
|
454
|
+
for (var n = new t.TokenSet(), r = void 0, i = [{
|
|
455
|
+
qNode: e,
|
|
456
|
+
output: n,
|
|
457
|
+
node: this
|
|
458
|
+
}]; i.length;) {
|
|
459
|
+
r = i.pop();
|
|
460
|
+
for (var s = Object.keys(r.qNode.edges), o = s.length, a = Object.keys(r.node.edges), l = a.length, u = 0; u < o; u++) for (var d = s[u], m = 0; m < l; m++) {
|
|
461
|
+
var p = a[m];
|
|
462
|
+
if (p == d || d == "*") {
|
|
463
|
+
var b = r.node.edges[p],
|
|
464
|
+
g = r.qNode.edges[d],
|
|
465
|
+
L = b.final && g.final,
|
|
466
|
+
f = void 0;
|
|
467
|
+
p in r.output.edges ? (f = r.output.edges[p], f.final = f.final || L) : (f = new t.TokenSet(), f.final = L, r.output.edges[p] = f), i.push({
|
|
468
|
+
qNode: g,
|
|
469
|
+
output: f,
|
|
470
|
+
node: b
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
return n;
|
|
476
|
+
}, t.TokenSet.Builder = function () {
|
|
477
|
+
this.previousWord = "", this.root = new t.TokenSet(), this.uncheckedNodes = [], this.minimizedNodes = {};
|
|
478
|
+
}, t.TokenSet.Builder.prototype.insert = function (e) {
|
|
479
|
+
var n,
|
|
480
|
+
r = 0;
|
|
481
|
+
if (e < this.previousWord) throw new Error("Out of order word insertion");
|
|
482
|
+
for (var i = 0; i < e.length && i < this.previousWord.length && e[i] == this.previousWord[i]; i++) r++;
|
|
483
|
+
this.minimize(r), this.uncheckedNodes.length == 0 ? n = this.root : n = this.uncheckedNodes[this.uncheckedNodes.length - 1].child;
|
|
484
|
+
for (var i = r; i < e.length; i++) {
|
|
485
|
+
var s = new t.TokenSet(),
|
|
486
|
+
o = e[i];
|
|
487
|
+
n.edges[o] = s, this.uncheckedNodes.push({
|
|
488
|
+
parent: n,
|
|
489
|
+
char: o,
|
|
490
|
+
child: s
|
|
491
|
+
}), n = s;
|
|
492
|
+
}
|
|
493
|
+
n.final = !0, this.previousWord = e;
|
|
494
|
+
}, t.TokenSet.Builder.prototype.finish = function () {
|
|
495
|
+
this.minimize(0);
|
|
496
|
+
}, t.TokenSet.Builder.prototype.minimize = function (e) {
|
|
497
|
+
for (var n = this.uncheckedNodes.length - 1; n >= e; n--) {
|
|
498
|
+
var r = this.uncheckedNodes[n],
|
|
499
|
+
i = r.child.toString();
|
|
500
|
+
i in this.minimizedNodes ? r.parent.edges[r.char] = this.minimizedNodes[i] : (r.child._str = i, this.minimizedNodes[i] = r.child), this.uncheckedNodes.pop();
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
t.Index = function (e) {
|
|
504
|
+
this.invertedIndex = e.invertedIndex, this.fieldVectors = e.fieldVectors, this.tokenSet = e.tokenSet, this.fields = e.fields, this.pipeline = e.pipeline;
|
|
505
|
+
}, t.Index.prototype.search = function (e) {
|
|
506
|
+
return this.query(function (n) {
|
|
507
|
+
var r = new t.QueryParser(e, n);
|
|
508
|
+
r.parse();
|
|
509
|
+
});
|
|
510
|
+
}, t.Index.prototype.query = function (e) {
|
|
511
|
+
for (var n = new t.Query(this.fields), r = Object.create(null), i = Object.create(null), s = Object.create(null), o = Object.create(null), a = Object.create(null), l = 0; l < this.fields.length; l++) i[this.fields[l]] = new t.Vector();
|
|
512
|
+
e.call(n, n);
|
|
513
|
+
for (var l = 0; l < n.clauses.length; l++) {
|
|
514
|
+
var u = n.clauses[l],
|
|
515
|
+
d = null,
|
|
516
|
+
m = t.Set.empty;
|
|
517
|
+
u.usePipeline ? d = this.pipeline.runString(u.term, {
|
|
518
|
+
fields: u.fields
|
|
519
|
+
}) : d = [u.term];
|
|
520
|
+
for (var p = 0; p < d.length; p++) {
|
|
521
|
+
var b = d[p];
|
|
522
|
+
u.term = b;
|
|
523
|
+
var g = t.TokenSet.fromClause(u),
|
|
524
|
+
L = this.tokenSet.intersect(g).toArray();
|
|
525
|
+
if (L.length === 0 && u.presence === t.Query.presence.REQUIRED) {
|
|
526
|
+
for (var f = 0; f < u.fields.length; f++) {
|
|
527
|
+
var y = u.fields[f];
|
|
528
|
+
o[y] = t.Set.empty;
|
|
529
|
+
}
|
|
530
|
+
break;
|
|
531
|
+
}
|
|
532
|
+
for (var S = 0; S < L.length; S++) for (var w = L[S], k = this.invertedIndex[w], _ = k._index, f = 0; f < u.fields.length; f++) {
|
|
533
|
+
var y = u.fields[f],
|
|
534
|
+
B = k[y],
|
|
535
|
+
A = Object.keys(B),
|
|
536
|
+
j = w + "/" + y,
|
|
537
|
+
q = new t.Set(A);
|
|
538
|
+
if (u.presence == t.Query.presence.REQUIRED && (m = m.union(q), o[y] === void 0 && (o[y] = t.Set.complete)), u.presence == t.Query.presence.PROHIBITED) {
|
|
539
|
+
a[y] === void 0 && (a[y] = t.Set.empty), a[y] = a[y].union(q);
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
if (i[y].upsert(_, u.boost, function (Ie, Ce) {
|
|
543
|
+
return Ie + Ce;
|
|
544
|
+
}), !s[j]) {
|
|
545
|
+
for (var V = 0; V < A.length; V++) {
|
|
546
|
+
var $ = A[V],
|
|
547
|
+
C = new t.FieldRef($, y),
|
|
548
|
+
z = B[$],
|
|
549
|
+
W;
|
|
550
|
+
(W = r[C]) === void 0 ? r[C] = new t.MatchData(w, y, z) : W.add(w, y, z);
|
|
551
|
+
}
|
|
552
|
+
s[j] = !0;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
if (u.presence === t.Query.presence.REQUIRED) for (var f = 0; f < u.fields.length; f++) {
|
|
557
|
+
var y = u.fields[f];
|
|
558
|
+
o[y] = o[y].intersect(m);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
for (var H = t.Set.complete, R = t.Set.empty, l = 0; l < this.fields.length; l++) {
|
|
562
|
+
var y = this.fields[l];
|
|
563
|
+
o[y] && (H = H.intersect(o[y])), a[y] && (R = R.union(a[y]));
|
|
564
|
+
}
|
|
565
|
+
var c = Object.keys(r),
|
|
566
|
+
v = [],
|
|
567
|
+
P = Object.create(null);
|
|
568
|
+
if (n.isNegated()) {
|
|
569
|
+
c = Object.keys(this.fieldVectors);
|
|
570
|
+
for (var l = 0; l < c.length; l++) {
|
|
571
|
+
var C = c[l],
|
|
572
|
+
T = t.FieldRef.fromString(C);
|
|
573
|
+
r[C] = new t.MatchData();
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
for (var l = 0; l < c.length; l++) {
|
|
577
|
+
var T = t.FieldRef.fromString(c[l]),
|
|
578
|
+
h = T.docRef;
|
|
579
|
+
if (H.contains(h) && !R.contains(h)) {
|
|
580
|
+
var x = this.fieldVectors[T],
|
|
581
|
+
O = i[T.fieldName].similarity(x),
|
|
582
|
+
M;
|
|
583
|
+
if ((M = P[h]) !== void 0) M.score += O, M.matchData.combine(r[T]);else {
|
|
584
|
+
var E = {
|
|
585
|
+
ref: h,
|
|
586
|
+
score: O,
|
|
587
|
+
matchData: r[T]
|
|
588
|
+
};
|
|
589
|
+
P[h] = E, v.push(E);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return v.sort(function (ke, Qe) {
|
|
594
|
+
return Qe.score - ke.score;
|
|
595
|
+
});
|
|
596
|
+
}, t.Index.prototype.toJSON = function () {
|
|
597
|
+
var e = Object.keys(this.invertedIndex).sort().map(function (r) {
|
|
598
|
+
return [r, this.invertedIndex[r]];
|
|
599
|
+
}, this),
|
|
600
|
+
n = Object.keys(this.fieldVectors).map(function (r) {
|
|
601
|
+
return [r, this.fieldVectors[r].toJSON()];
|
|
602
|
+
}, this);
|
|
603
|
+
return {
|
|
604
|
+
version: t.version,
|
|
605
|
+
fields: this.fields,
|
|
606
|
+
fieldVectors: n,
|
|
607
|
+
invertedIndex: e,
|
|
608
|
+
pipeline: this.pipeline.toJSON()
|
|
609
|
+
};
|
|
610
|
+
}, t.Index.load = function (e) {
|
|
611
|
+
var n = {},
|
|
612
|
+
r = {},
|
|
613
|
+
i = e.fieldVectors,
|
|
614
|
+
s = Object.create(null),
|
|
615
|
+
o = e.invertedIndex,
|
|
616
|
+
a = new t.TokenSet.Builder(),
|
|
617
|
+
l = t.Pipeline.load(e.pipeline);
|
|
618
|
+
e.version != t.version && t.utils.warn("Version mismatch when loading serialised index. Current version of lunr '" + t.version + "' does not match serialized index '" + e.version + "'");
|
|
619
|
+
for (var u = 0; u < i.length; u++) {
|
|
620
|
+
var d = i[u],
|
|
621
|
+
m = d[0],
|
|
622
|
+
p = d[1];
|
|
623
|
+
r[m] = new t.Vector(p);
|
|
624
|
+
}
|
|
625
|
+
for (var u = 0; u < o.length; u++) {
|
|
626
|
+
var d = o[u],
|
|
627
|
+
b = d[0],
|
|
628
|
+
g = d[1];
|
|
629
|
+
a.insert(b), s[b] = g;
|
|
630
|
+
}
|
|
631
|
+
return a.finish(), n.fields = e.fields, n.fieldVectors = r, n.invertedIndex = s, n.tokenSet = a.root, n.pipeline = l, new t.Index(n);
|
|
632
|
+
};
|
|
633
|
+
t.Builder = function () {
|
|
634
|
+
this._ref = "id", this._fields = Object.create(null), this._documents = Object.create(null), this.invertedIndex = Object.create(null), this.fieldTermFrequencies = {}, this.fieldLengths = {}, this.tokenizer = t.tokenizer, this.pipeline = new t.Pipeline(), this.searchPipeline = new t.Pipeline(), this.documentCount = 0, this._b = .75, this._k1 = 1.2, this.termIndex = 0, this.metadataWhitelist = [];
|
|
635
|
+
}, t.Builder.prototype.ref = function (e) {
|
|
636
|
+
this._ref = e;
|
|
637
|
+
}, t.Builder.prototype.field = function (e, n) {
|
|
638
|
+
if (/\//.test(e)) throw new RangeError("Field '" + e + "' contains illegal character '/'");
|
|
639
|
+
this._fields[e] = n || {};
|
|
640
|
+
}, t.Builder.prototype.b = function (e) {
|
|
641
|
+
e < 0 ? this._b = 0 : e > 1 ? this._b = 1 : this._b = e;
|
|
642
|
+
}, t.Builder.prototype.k1 = function (e) {
|
|
643
|
+
this._k1 = e;
|
|
644
|
+
}, t.Builder.prototype.add = function (e, n) {
|
|
645
|
+
var r = e[this._ref],
|
|
646
|
+
i = Object.keys(this._fields);
|
|
647
|
+
this._documents[r] = n || {}, this.documentCount += 1;
|
|
648
|
+
for (var s = 0; s < i.length; s++) {
|
|
649
|
+
var o = i[s],
|
|
650
|
+
a = this._fields[o].extractor,
|
|
651
|
+
l = a ? a(e) : e[o],
|
|
652
|
+
u = this.tokenizer(l, {
|
|
653
|
+
fields: [o]
|
|
654
|
+
}),
|
|
655
|
+
d = this.pipeline.run(u),
|
|
656
|
+
m = new t.FieldRef(r, o),
|
|
657
|
+
p = Object.create(null);
|
|
658
|
+
this.fieldTermFrequencies[m] = p, this.fieldLengths[m] = 0, this.fieldLengths[m] += d.length;
|
|
659
|
+
for (var b = 0; b < d.length; b++) {
|
|
660
|
+
var g = d[b];
|
|
661
|
+
if (p[g] == null && (p[g] = 0), p[g] += 1, this.invertedIndex[g] == null) {
|
|
662
|
+
var L = Object.create(null);
|
|
663
|
+
L._index = this.termIndex, this.termIndex += 1;
|
|
664
|
+
for (var f = 0; f < i.length; f++) L[i[f]] = Object.create(null);
|
|
665
|
+
this.invertedIndex[g] = L;
|
|
666
|
+
}
|
|
667
|
+
this.invertedIndex[g][o][r] == null && (this.invertedIndex[g][o][r] = Object.create(null));
|
|
668
|
+
for (var y = 0; y < this.metadataWhitelist.length; y++) {
|
|
669
|
+
var S = this.metadataWhitelist[y],
|
|
670
|
+
w = g.metadata[S];
|
|
671
|
+
this.invertedIndex[g][o][r][S] == null && (this.invertedIndex[g][o][r][S] = []), this.invertedIndex[g][o][r][S].push(w);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}, t.Builder.prototype.calculateAverageFieldLengths = function () {
|
|
676
|
+
for (var e = Object.keys(this.fieldLengths), n = e.length, r = {}, i = {}, s = 0; s < n; s++) {
|
|
677
|
+
var o = t.FieldRef.fromString(e[s]),
|
|
678
|
+
a = o.fieldName;
|
|
679
|
+
i[a] || (i[a] = 0), i[a] += 1, r[a] || (r[a] = 0), r[a] += this.fieldLengths[o];
|
|
680
|
+
}
|
|
681
|
+
for (var l = Object.keys(this._fields), s = 0; s < l.length; s++) {
|
|
682
|
+
var u = l[s];
|
|
683
|
+
r[u] = r[u] / i[u];
|
|
684
|
+
}
|
|
685
|
+
this.averageFieldLength = r;
|
|
686
|
+
}, t.Builder.prototype.createFieldVectors = function () {
|
|
687
|
+
for (var e = {}, n = Object.keys(this.fieldTermFrequencies), r = n.length, i = Object.create(null), s = 0; s < r; s++) {
|
|
688
|
+
for (var o = t.FieldRef.fromString(n[s]), a = o.fieldName, l = this.fieldLengths[o], u = new t.Vector(), d = this.fieldTermFrequencies[o], m = Object.keys(d), p = m.length, b = this._fields[a].boost || 1, g = this._documents[o.docRef].boost || 1, L = 0; L < p; L++) {
|
|
689
|
+
var f = m[L],
|
|
690
|
+
y = d[f],
|
|
691
|
+
S = this.invertedIndex[f]._index,
|
|
692
|
+
w,
|
|
693
|
+
k,
|
|
694
|
+
_;
|
|
695
|
+
i[f] === void 0 ? (w = t.idf(this.invertedIndex[f], this.documentCount), i[f] = w) : w = i[f], k = w * ((this._k1 + 1) * y) / (this._k1 * (1 - this._b + this._b * (l / this.averageFieldLength[a])) + y), k *= b, k *= g, _ = Math.round(k * 1e3) / 1e3, u.insert(S, _);
|
|
696
|
+
}
|
|
697
|
+
e[o] = u;
|
|
698
|
+
}
|
|
699
|
+
this.fieldVectors = e;
|
|
700
|
+
}, t.Builder.prototype.createTokenSet = function () {
|
|
701
|
+
this.tokenSet = t.TokenSet.fromArray(Object.keys(this.invertedIndex).sort());
|
|
702
|
+
}, t.Builder.prototype.build = function () {
|
|
703
|
+
return this.calculateAverageFieldLengths(), this.createFieldVectors(), this.createTokenSet(), new t.Index({
|
|
704
|
+
invertedIndex: this.invertedIndex,
|
|
705
|
+
fieldVectors: this.fieldVectors,
|
|
706
|
+
tokenSet: this.tokenSet,
|
|
707
|
+
fields: Object.keys(this._fields),
|
|
708
|
+
pipeline: this.searchPipeline
|
|
709
|
+
});
|
|
710
|
+
}, t.Builder.prototype.use = function (e) {
|
|
711
|
+
var n = Array.prototype.slice.call(arguments, 1);
|
|
712
|
+
n.unshift(this), e.apply(this, n);
|
|
713
|
+
}, t.MatchData = function (e, n, r) {
|
|
714
|
+
for (var i = Object.create(null), s = Object.keys(r || {}), o = 0; o < s.length; o++) {
|
|
715
|
+
var a = s[o];
|
|
716
|
+
i[a] = r[a].slice();
|
|
717
|
+
}
|
|
718
|
+
this.metadata = Object.create(null), e !== void 0 && (this.metadata[e] = Object.create(null), this.metadata[e][n] = i);
|
|
719
|
+
}, t.MatchData.prototype.combine = function (e) {
|
|
720
|
+
for (var n = Object.keys(e.metadata), r = 0; r < n.length; r++) {
|
|
721
|
+
var i = n[r],
|
|
722
|
+
s = Object.keys(e.metadata[i]);
|
|
723
|
+
this.metadata[i] == null && (this.metadata[i] = Object.create(null));
|
|
724
|
+
for (var o = 0; o < s.length; o++) {
|
|
725
|
+
var a = s[o],
|
|
726
|
+
l = Object.keys(e.metadata[i][a]);
|
|
727
|
+
this.metadata[i][a] == null && (this.metadata[i][a] = Object.create(null));
|
|
728
|
+
for (var u = 0; u < l.length; u++) {
|
|
729
|
+
var d = l[u];
|
|
730
|
+
this.metadata[i][a][d] == null ? this.metadata[i][a][d] = e.metadata[i][a][d] : this.metadata[i][a][d] = this.metadata[i][a][d].concat(e.metadata[i][a][d]);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}, t.MatchData.prototype.add = function (e, n, r) {
|
|
735
|
+
if (!(e in this.metadata)) {
|
|
736
|
+
this.metadata[e] = Object.create(null), this.metadata[e][n] = r;
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
if (!(n in this.metadata[e])) {
|
|
740
|
+
this.metadata[e][n] = r;
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
for (var i = Object.keys(r), s = 0; s < i.length; s++) {
|
|
744
|
+
var o = i[s];
|
|
745
|
+
o in this.metadata[e][n] ? this.metadata[e][n][o] = this.metadata[e][n][o].concat(r[o]) : this.metadata[e][n][o] = r[o];
|
|
746
|
+
}
|
|
747
|
+
}, t.Query = function (e) {
|
|
748
|
+
this.clauses = [], this.allFields = e;
|
|
749
|
+
}, t.Query.wildcard = new String("*"), t.Query.wildcard.NONE = 0, t.Query.wildcard.LEADING = 1, t.Query.wildcard.TRAILING = 2, t.Query.presence = {
|
|
750
|
+
OPTIONAL: 1,
|
|
751
|
+
REQUIRED: 2,
|
|
752
|
+
PROHIBITED: 3
|
|
753
|
+
}, t.Query.prototype.clause = function (e) {
|
|
754
|
+
return "fields" in e || (e.fields = this.allFields), "boost" in e || (e.boost = 1), "usePipeline" in e || (e.usePipeline = !0), "wildcard" in e || (e.wildcard = t.Query.wildcard.NONE), e.wildcard & t.Query.wildcard.LEADING && e.term.charAt(0) != t.Query.wildcard && (e.term = "*" + e.term), e.wildcard & t.Query.wildcard.TRAILING && e.term.slice(-1) != t.Query.wildcard && (e.term = "" + e.term + "*"), "presence" in e || (e.presence = t.Query.presence.OPTIONAL), this.clauses.push(e), this;
|
|
755
|
+
}, t.Query.prototype.isNegated = function () {
|
|
756
|
+
for (var e = 0; e < this.clauses.length; e++) if (this.clauses[e].presence != t.Query.presence.PROHIBITED) return !1;
|
|
757
|
+
return !0;
|
|
758
|
+
}, t.Query.prototype.term = function (e, n) {
|
|
759
|
+
if (Array.isArray(e)) return e.forEach(function (i) {
|
|
760
|
+
this.term(i, t.utils.clone(n));
|
|
761
|
+
}, this), this;
|
|
762
|
+
var r = n || {};
|
|
763
|
+
return r.term = e.toString(), this.clause(r), this;
|
|
764
|
+
}, t.QueryParseError = function (e, n, r) {
|
|
765
|
+
this.name = "QueryParseError", this.message = e, this.start = n, this.end = r;
|
|
766
|
+
}, t.QueryParseError.prototype = new Error(), t.QueryLexer = function (e) {
|
|
767
|
+
this.lexemes = [], this.str = e, this.length = e.length, this.pos = 0, this.start = 0, this.escapeCharPositions = [];
|
|
768
|
+
}, t.QueryLexer.prototype.run = function () {
|
|
769
|
+
for (var e = t.QueryLexer.lexText; e;) e = e(this);
|
|
770
|
+
}, t.QueryLexer.prototype.sliceString = function () {
|
|
771
|
+
for (var e = [], n = this.start, r = this.pos, i = 0; i < this.escapeCharPositions.length; i++) r = this.escapeCharPositions[i], e.push(this.str.slice(n, r)), n = r + 1;
|
|
772
|
+
return e.push(this.str.slice(n, this.pos)), this.escapeCharPositions.length = 0, e.join("");
|
|
773
|
+
}, t.QueryLexer.prototype.emit = function (e) {
|
|
774
|
+
this.lexemes.push({
|
|
775
|
+
type: e,
|
|
776
|
+
str: this.sliceString(),
|
|
777
|
+
start: this.start,
|
|
778
|
+
end: this.pos
|
|
779
|
+
}), this.start = this.pos;
|
|
780
|
+
}, t.QueryLexer.prototype.escapeCharacter = function () {
|
|
781
|
+
this.escapeCharPositions.push(this.pos - 1), this.pos += 1;
|
|
782
|
+
}, t.QueryLexer.prototype.next = function () {
|
|
783
|
+
if (this.pos >= this.length) return t.QueryLexer.EOS;
|
|
784
|
+
var e = this.str.charAt(this.pos);
|
|
785
|
+
return this.pos += 1, e;
|
|
786
|
+
}, t.QueryLexer.prototype.width = function () {
|
|
787
|
+
return this.pos - this.start;
|
|
788
|
+
}, t.QueryLexer.prototype.ignore = function () {
|
|
789
|
+
this.start == this.pos && (this.pos += 1), this.start = this.pos;
|
|
790
|
+
}, t.QueryLexer.prototype.backup = function () {
|
|
791
|
+
this.pos -= 1;
|
|
792
|
+
}, t.QueryLexer.prototype.acceptDigitRun = function () {
|
|
793
|
+
var e, n;
|
|
794
|
+
do e = this.next(), n = e.charCodeAt(0); while (n > 47 && n < 58);
|
|
795
|
+
e != t.QueryLexer.EOS && this.backup();
|
|
796
|
+
}, t.QueryLexer.prototype.more = function () {
|
|
797
|
+
return this.pos < this.length;
|
|
798
|
+
}, t.QueryLexer.EOS = "EOS", t.QueryLexer.FIELD = "FIELD", t.QueryLexer.TERM = "TERM", t.QueryLexer.EDIT_DISTANCE = "EDIT_DISTANCE", t.QueryLexer.BOOST = "BOOST", t.QueryLexer.PRESENCE = "PRESENCE", t.QueryLexer.lexField = function (e) {
|
|
799
|
+
return e.backup(), e.emit(t.QueryLexer.FIELD), e.ignore(), t.QueryLexer.lexText;
|
|
800
|
+
}, t.QueryLexer.lexTerm = function (e) {
|
|
801
|
+
if (e.width() > 1 && (e.backup(), e.emit(t.QueryLexer.TERM)), e.ignore(), e.more()) return t.QueryLexer.lexText;
|
|
802
|
+
}, t.QueryLexer.lexEditDistance = function (e) {
|
|
803
|
+
return e.ignore(), e.acceptDigitRun(), e.emit(t.QueryLexer.EDIT_DISTANCE), t.QueryLexer.lexText;
|
|
804
|
+
}, t.QueryLexer.lexBoost = function (e) {
|
|
805
|
+
return e.ignore(), e.acceptDigitRun(), e.emit(t.QueryLexer.BOOST), t.QueryLexer.lexText;
|
|
806
|
+
}, t.QueryLexer.lexEOS = function (e) {
|
|
807
|
+
e.width() > 0 && e.emit(t.QueryLexer.TERM);
|
|
808
|
+
}, t.QueryLexer.termSeparator = t.tokenizer.separator, t.QueryLexer.lexText = function (e) {
|
|
809
|
+
for (;;) {
|
|
810
|
+
var n = e.next();
|
|
811
|
+
if (n == t.QueryLexer.EOS) return t.QueryLexer.lexEOS;
|
|
812
|
+
if (n.charCodeAt(0) == 92) {
|
|
813
|
+
e.escapeCharacter();
|
|
814
|
+
continue;
|
|
815
|
+
}
|
|
816
|
+
if (n == ":") return t.QueryLexer.lexField;
|
|
817
|
+
if (n == "~") return e.backup(), e.width() > 0 && e.emit(t.QueryLexer.TERM), t.QueryLexer.lexEditDistance;
|
|
818
|
+
if (n == "^") return e.backup(), e.width() > 0 && e.emit(t.QueryLexer.TERM), t.QueryLexer.lexBoost;
|
|
819
|
+
if (n == "+" && e.width() === 1 || n == "-" && e.width() === 1) return e.emit(t.QueryLexer.PRESENCE), t.QueryLexer.lexText;
|
|
820
|
+
if (n.match(t.QueryLexer.termSeparator)) return t.QueryLexer.lexTerm;
|
|
821
|
+
}
|
|
822
|
+
}, t.QueryParser = function (e, n) {
|
|
823
|
+
this.lexer = new t.QueryLexer(e), this.query = n, this.currentClause = {}, this.lexemeIdx = 0;
|
|
824
|
+
}, t.QueryParser.prototype.parse = function () {
|
|
825
|
+
this.lexer.run(), this.lexemes = this.lexer.lexemes;
|
|
826
|
+
for (var e = t.QueryParser.parseClause; e;) e = e(this);
|
|
827
|
+
return this.query;
|
|
828
|
+
}, t.QueryParser.prototype.peekLexeme = function () {
|
|
829
|
+
return this.lexemes[this.lexemeIdx];
|
|
830
|
+
}, t.QueryParser.prototype.consumeLexeme = function () {
|
|
831
|
+
var e = this.peekLexeme();
|
|
832
|
+
return this.lexemeIdx += 1, e;
|
|
833
|
+
}, t.QueryParser.prototype.nextClause = function () {
|
|
834
|
+
var e = this.currentClause;
|
|
835
|
+
this.query.clause(e), this.currentClause = {};
|
|
836
|
+
}, t.QueryParser.parseClause = function (e) {
|
|
837
|
+
var n = e.peekLexeme();
|
|
838
|
+
if (n != null) switch (n.type) {
|
|
839
|
+
case t.QueryLexer.PRESENCE:
|
|
840
|
+
return t.QueryParser.parsePresence;
|
|
841
|
+
case t.QueryLexer.FIELD:
|
|
842
|
+
return t.QueryParser.parseField;
|
|
843
|
+
case t.QueryLexer.TERM:
|
|
844
|
+
return t.QueryParser.parseTerm;
|
|
845
|
+
default:
|
|
846
|
+
var r = "expected either a field or a term, found " + n.type;
|
|
847
|
+
throw n.str.length >= 1 && (r += " with value '" + n.str + "'"), new t.QueryParseError(r, n.start, n.end);
|
|
848
|
+
}
|
|
849
|
+
}, t.QueryParser.parsePresence = function (e) {
|
|
850
|
+
var n = e.consumeLexeme();
|
|
851
|
+
if (n != null) {
|
|
852
|
+
switch (n.str) {
|
|
853
|
+
case "-":
|
|
854
|
+
e.currentClause.presence = t.Query.presence.PROHIBITED;
|
|
855
|
+
break;
|
|
856
|
+
case "+":
|
|
857
|
+
e.currentClause.presence = t.Query.presence.REQUIRED;
|
|
858
|
+
break;
|
|
859
|
+
default:
|
|
860
|
+
var r = "unrecognised presence operator'" + n.str + "'";
|
|
861
|
+
throw new t.QueryParseError(r, n.start, n.end);
|
|
862
|
+
}
|
|
863
|
+
var i = e.peekLexeme();
|
|
864
|
+
if (i == null) {
|
|
865
|
+
var r = "expecting term or field, found nothing";
|
|
866
|
+
throw new t.QueryParseError(r, n.start, n.end);
|
|
867
|
+
}
|
|
868
|
+
switch (i.type) {
|
|
869
|
+
case t.QueryLexer.FIELD:
|
|
870
|
+
return t.QueryParser.parseField;
|
|
871
|
+
case t.QueryLexer.TERM:
|
|
872
|
+
return t.QueryParser.parseTerm;
|
|
873
|
+
default:
|
|
874
|
+
var r = "expecting term or field, found '" + i.type + "'";
|
|
875
|
+
throw new t.QueryParseError(r, i.start, i.end);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}, t.QueryParser.parseField = function (e) {
|
|
879
|
+
var n = e.consumeLexeme();
|
|
880
|
+
if (n != null) {
|
|
881
|
+
if (e.query.allFields.indexOf(n.str) == -1) {
|
|
882
|
+
var r = e.query.allFields.map(function (o) {
|
|
883
|
+
return "'" + o + "'";
|
|
884
|
+
}).join(", "),
|
|
885
|
+
i = "unrecognised field '" + n.str + "', possible fields: " + r;
|
|
886
|
+
throw new t.QueryParseError(i, n.start, n.end);
|
|
887
|
+
}
|
|
888
|
+
e.currentClause.fields = [n.str];
|
|
889
|
+
var s = e.peekLexeme();
|
|
890
|
+
if (s == null) {
|
|
891
|
+
var i = "expecting term, found nothing";
|
|
892
|
+
throw new t.QueryParseError(i, n.start, n.end);
|
|
893
|
+
}
|
|
894
|
+
switch (s.type) {
|
|
895
|
+
case t.QueryLexer.TERM:
|
|
896
|
+
return t.QueryParser.parseTerm;
|
|
897
|
+
default:
|
|
898
|
+
var i = "expecting term, found '" + s.type + "'";
|
|
899
|
+
throw new t.QueryParseError(i, s.start, s.end);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}, t.QueryParser.parseTerm = function (e) {
|
|
903
|
+
var n = e.consumeLexeme();
|
|
904
|
+
if (n != null) {
|
|
905
|
+
e.currentClause.term = n.str.toLowerCase(), n.str.indexOf("*") != -1 && (e.currentClause.usePipeline = !1);
|
|
906
|
+
var r = e.peekLexeme();
|
|
907
|
+
if (r == null) {
|
|
908
|
+
e.nextClause();
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
switch (r.type) {
|
|
912
|
+
case t.QueryLexer.TERM:
|
|
913
|
+
return e.nextClause(), t.QueryParser.parseTerm;
|
|
914
|
+
case t.QueryLexer.FIELD:
|
|
915
|
+
return e.nextClause(), t.QueryParser.parseField;
|
|
916
|
+
case t.QueryLexer.EDIT_DISTANCE:
|
|
917
|
+
return t.QueryParser.parseEditDistance;
|
|
918
|
+
case t.QueryLexer.BOOST:
|
|
919
|
+
return t.QueryParser.parseBoost;
|
|
920
|
+
case t.QueryLexer.PRESENCE:
|
|
921
|
+
return e.nextClause(), t.QueryParser.parsePresence;
|
|
922
|
+
default:
|
|
923
|
+
var i = "Unexpected lexeme type '" + r.type + "'";
|
|
924
|
+
throw new t.QueryParseError(i, r.start, r.end);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
}, t.QueryParser.parseEditDistance = function (e) {
|
|
928
|
+
var n = e.consumeLexeme();
|
|
929
|
+
if (n != null) {
|
|
930
|
+
var r = parseInt(n.str, 10);
|
|
931
|
+
if (isNaN(r)) {
|
|
932
|
+
var i = "edit distance must be numeric";
|
|
933
|
+
throw new t.QueryParseError(i, n.start, n.end);
|
|
934
|
+
}
|
|
935
|
+
e.currentClause.editDistance = r;
|
|
936
|
+
var s = e.peekLexeme();
|
|
937
|
+
if (s == null) {
|
|
938
|
+
e.nextClause();
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
switch (s.type) {
|
|
942
|
+
case t.QueryLexer.TERM:
|
|
943
|
+
return e.nextClause(), t.QueryParser.parseTerm;
|
|
944
|
+
case t.QueryLexer.FIELD:
|
|
945
|
+
return e.nextClause(), t.QueryParser.parseField;
|
|
946
|
+
case t.QueryLexer.EDIT_DISTANCE:
|
|
947
|
+
return t.QueryParser.parseEditDistance;
|
|
948
|
+
case t.QueryLexer.BOOST:
|
|
949
|
+
return t.QueryParser.parseBoost;
|
|
950
|
+
case t.QueryLexer.PRESENCE:
|
|
951
|
+
return e.nextClause(), t.QueryParser.parsePresence;
|
|
952
|
+
default:
|
|
953
|
+
var i = "Unexpected lexeme type '" + s.type + "'";
|
|
954
|
+
throw new t.QueryParseError(i, s.start, s.end);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}, t.QueryParser.parseBoost = function (e) {
|
|
958
|
+
var n = e.consumeLexeme();
|
|
959
|
+
if (n != null) {
|
|
960
|
+
var r = parseInt(n.str, 10);
|
|
961
|
+
if (isNaN(r)) {
|
|
962
|
+
var i = "boost must be numeric";
|
|
963
|
+
throw new t.QueryParseError(i, n.start, n.end);
|
|
964
|
+
}
|
|
965
|
+
e.currentClause.boost = r;
|
|
966
|
+
var s = e.peekLexeme();
|
|
967
|
+
if (s == null) {
|
|
968
|
+
e.nextClause();
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
switch (s.type) {
|
|
972
|
+
case t.QueryLexer.TERM:
|
|
973
|
+
return e.nextClause(), t.QueryParser.parseTerm;
|
|
974
|
+
case t.QueryLexer.FIELD:
|
|
975
|
+
return e.nextClause(), t.QueryParser.parseField;
|
|
976
|
+
case t.QueryLexer.EDIT_DISTANCE:
|
|
977
|
+
return t.QueryParser.parseEditDistance;
|
|
978
|
+
case t.QueryLexer.BOOST:
|
|
979
|
+
return t.QueryParser.parseBoost;
|
|
980
|
+
case t.QueryLexer.PRESENCE:
|
|
981
|
+
return e.nextClause(), t.QueryParser.parsePresence;
|
|
982
|
+
default:
|
|
983
|
+
var i = "Unexpected lexeme type '" + s.type + "'";
|
|
984
|
+
throw new t.QueryParseError(i, s.start, s.end);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
}, function (e, n) {
|
|
988
|
+
typeof define == "function" && define.amd ? define(n) : typeof ae == "object" ? le.exports = n() : e.lunr = n();
|
|
989
|
+
}(this, function () {
|
|
990
|
+
return t;
|
|
991
|
+
});
|
|
992
|
+
})();
|
|
993
|
+
});
|
|
994
|
+
var se = [];
|
|
995
|
+
function G(t, e) {
|
|
996
|
+
se.push({
|
|
997
|
+
selector: e,
|
|
998
|
+
constructor: t
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
var U = /*#__PURE__*/function () {
|
|
1002
|
+
function U() {
|
|
1003
|
+
_classCallCheck(this, U);
|
|
1004
|
+
this.alwaysVisibleMember = null;
|
|
1005
|
+
this.createComponents(document.body), this.ensureFocusedElementVisible(), this.listenForCodeCopies(), window.addEventListener("hashchange", () => this.ensureFocusedElementVisible()), document.body.style.display || (this.ensureFocusedElementVisible(), this.updateIndexVisibility(), this.scrollToHash());
|
|
1006
|
+
}
|
|
1007
|
+
return _createClass(U, [{
|
|
1008
|
+
key: "createComponents",
|
|
1009
|
+
value: function createComponents(e) {
|
|
1010
|
+
se.forEach(n => {
|
|
1011
|
+
e.querySelectorAll(n.selector).forEach(r => {
|
|
1012
|
+
r.dataset.hasInstance || (new n.constructor({
|
|
1013
|
+
el: r,
|
|
1014
|
+
app: this
|
|
1015
|
+
}), r.dataset.hasInstance = String(!0));
|
|
1016
|
+
});
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
}, {
|
|
1020
|
+
key: "filterChanged",
|
|
1021
|
+
value: function filterChanged() {
|
|
1022
|
+
this.ensureFocusedElementVisible();
|
|
1023
|
+
}
|
|
1024
|
+
}, {
|
|
1025
|
+
key: "showPage",
|
|
1026
|
+
value: function showPage() {
|
|
1027
|
+
document.body.style.display && (document.body.style.removeProperty("display"), this.ensureFocusedElementVisible(), this.updateIndexVisibility(), this.scrollToHash());
|
|
1028
|
+
}
|
|
1029
|
+
}, {
|
|
1030
|
+
key: "scrollToHash",
|
|
1031
|
+
value: function scrollToHash() {
|
|
1032
|
+
if (location.hash) {
|
|
1033
|
+
let e = document.getElementById(location.hash.substring(1));
|
|
1034
|
+
if (!e) return;
|
|
1035
|
+
e.scrollIntoView({
|
|
1036
|
+
behavior: "instant",
|
|
1037
|
+
block: "start"
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}, {
|
|
1042
|
+
key: "ensureActivePageVisible",
|
|
1043
|
+
value: function ensureActivePageVisible() {
|
|
1044
|
+
let e = document.querySelector(".tsd-navigation .current"),
|
|
1045
|
+
n = e?.parentElement;
|
|
1046
|
+
for (; n && !n.classList.contains(".tsd-navigation");) n instanceof HTMLDetailsElement && (n.open = !0), n = n.parentElement;
|
|
1047
|
+
if (e && !Ve(e)) {
|
|
1048
|
+
let r = e.getBoundingClientRect().top - document.documentElement.clientHeight / 4;
|
|
1049
|
+
document.querySelector(".site-menu").scrollTop = r, document.querySelector(".col-sidebar").scrollTop = r;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
}, {
|
|
1053
|
+
key: "updateIndexVisibility",
|
|
1054
|
+
value: function updateIndexVisibility() {
|
|
1055
|
+
let e = document.querySelector(".tsd-index-content"),
|
|
1056
|
+
n = e?.open;
|
|
1057
|
+
e && (e.open = !0), document.querySelectorAll(".tsd-index-section").forEach(r => {
|
|
1058
|
+
r.style.display = "block";
|
|
1059
|
+
let i = Array.from(r.querySelectorAll(".tsd-index-link")).every(s => s.offsetParent == null);
|
|
1060
|
+
r.style.display = i ? "none" : "block";
|
|
1061
|
+
}), e && (e.open = n);
|
|
1062
|
+
}
|
|
1063
|
+
}, {
|
|
1064
|
+
key: "ensureFocusedElementVisible",
|
|
1065
|
+
value: function ensureFocusedElementVisible() {
|
|
1066
|
+
if (this.alwaysVisibleMember && (this.alwaysVisibleMember.classList.remove("always-visible"), this.alwaysVisibleMember.firstElementChild.remove(), this.alwaysVisibleMember = null), !location.hash) return;
|
|
1067
|
+
let e = document.getElementById(location.hash.substring(1));
|
|
1068
|
+
if (!e) return;
|
|
1069
|
+
let n = e.parentElement;
|
|
1070
|
+
for (; n && n.tagName !== "SECTION";) n = n.parentElement;
|
|
1071
|
+
if (!n) return;
|
|
1072
|
+
let r = n.offsetParent == null,
|
|
1073
|
+
i = n;
|
|
1074
|
+
for (; i !== document.body;) i instanceof HTMLDetailsElement && (i.open = !0), i = i.parentElement;
|
|
1075
|
+
if (n.offsetParent == null) {
|
|
1076
|
+
this.alwaysVisibleMember = n, n.classList.add("always-visible");
|
|
1077
|
+
let s = document.createElement("p");
|
|
1078
|
+
s.classList.add("warning"), s.textContent = window.translations.normally_hidden, n.prepend(s);
|
|
1079
|
+
}
|
|
1080
|
+
r && e.scrollIntoView();
|
|
1081
|
+
}
|
|
1082
|
+
}, {
|
|
1083
|
+
key: "listenForCodeCopies",
|
|
1084
|
+
value: function listenForCodeCopies() {
|
|
1085
|
+
document.querySelectorAll("pre > button").forEach(e => {
|
|
1086
|
+
let n;
|
|
1087
|
+
e.addEventListener("click", () => {
|
|
1088
|
+
e.previousElementSibling instanceof HTMLElement && navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()), e.textContent = window.translations.copied, e.classList.add("visible"), clearTimeout(n), n = setTimeout(() => {
|
|
1089
|
+
e.classList.remove("visible"), n = setTimeout(() => {
|
|
1090
|
+
e.textContent = window.translations.copy;
|
|
1091
|
+
}, 100);
|
|
1092
|
+
}, 1e3);
|
|
1093
|
+
});
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
}]);
|
|
1097
|
+
}();
|
|
1098
|
+
function Ve(t) {
|
|
1099
|
+
let e = t.getBoundingClientRect(),
|
|
1100
|
+
n = Math.max(document.documentElement.clientHeight, window.innerHeight);
|
|
1101
|
+
return !(e.bottom < 0 || e.top - n >= 0);
|
|
1102
|
+
}
|
|
1103
|
+
var oe = (t, e = 100) => {
|
|
1104
|
+
let n;
|
|
1105
|
+
return () => {
|
|
1106
|
+
clearTimeout(n), n = setTimeout(() => t(), e);
|
|
1107
|
+
};
|
|
1108
|
+
};
|
|
1109
|
+
var pe = Ae(ue());
|
|
1110
|
+
async function ce(t, e) {
|
|
1111
|
+
if (!window.searchData) return;
|
|
1112
|
+
let n = await fetch(window.searchData),
|
|
1113
|
+
r = new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),
|
|
1114
|
+
i = await new Response(r).json();
|
|
1115
|
+
t.data = i, t.index = pe.Index.load(i.index), e.classList.remove("loading"), e.classList.add("ready");
|
|
1116
|
+
}
|
|
1117
|
+
function fe() {
|
|
1118
|
+
let t = document.getElementById("tsd-search");
|
|
1119
|
+
if (!t) return;
|
|
1120
|
+
let e = {
|
|
1121
|
+
base: t.dataset.base + "/"
|
|
1122
|
+
},
|
|
1123
|
+
n = document.getElementById("tsd-search-script");
|
|
1124
|
+
t.classList.add("loading"), n && (n.addEventListener("error", () => {
|
|
1125
|
+
t.classList.remove("loading"), t.classList.add("failure");
|
|
1126
|
+
}), n.addEventListener("load", () => {
|
|
1127
|
+
ce(e, t);
|
|
1128
|
+
}), ce(e, t));
|
|
1129
|
+
let r = document.querySelector("#tsd-search input"),
|
|
1130
|
+
i = document.querySelector("#tsd-search .results");
|
|
1131
|
+
if (!r || !i) throw new Error("The input field or the result list wrapper was not found");
|
|
1132
|
+
i.addEventListener("mouseup", () => {
|
|
1133
|
+
te(t);
|
|
1134
|
+
}), r.addEventListener("focus", () => t.classList.add("has-focus")), He(t, i, r, e);
|
|
1135
|
+
}
|
|
1136
|
+
function He(t, e, n, r) {
|
|
1137
|
+
n.addEventListener("input", oe(() => {
|
|
1138
|
+
Ne(t, e, n, r);
|
|
1139
|
+
}, 200)), n.addEventListener("keydown", i => {
|
|
1140
|
+
i.key == "Enter" ? Be(e, t) : i.key == "ArrowUp" ? (de(e, n, -1), i.preventDefault()) : i.key === "ArrowDown" && (de(e, n, 1), i.preventDefault());
|
|
1141
|
+
}), document.body.addEventListener("keypress", i => {
|
|
1142
|
+
i.altKey || i.ctrlKey || i.metaKey || !n.matches(":focus") && i.key === "/" && (i.preventDefault(), n.focus());
|
|
1143
|
+
}), document.body.addEventListener("keyup", i => {
|
|
1144
|
+
t.classList.contains("has-focus") && (i.key === "Escape" || !e.matches(":focus-within") && !n.matches(":focus")) && (n.blur(), te(t));
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
function te(t) {
|
|
1148
|
+
t.classList.remove("has-focus");
|
|
1149
|
+
}
|
|
1150
|
+
function Ne(t, e, n, r) {
|
|
1151
|
+
if (!r.index || !r.data) return;
|
|
1152
|
+
e.textContent = "";
|
|
1153
|
+
let i = n.value.trim(),
|
|
1154
|
+
s;
|
|
1155
|
+
if (i) {
|
|
1156
|
+
let o = i.split(" ").map(a => a.length ? `*${a}*` : "").join(" ");
|
|
1157
|
+
s = r.index.search(o);
|
|
1158
|
+
} else s = [];
|
|
1159
|
+
for (let o = 0; o < s.length; o++) {
|
|
1160
|
+
let a = s[o],
|
|
1161
|
+
l = r.data.rows[Number(a.ref)],
|
|
1162
|
+
u = 1;
|
|
1163
|
+
l.name.toLowerCase().startsWith(i.toLowerCase()) && (u *= 1 + 1 / (1 + Math.abs(l.name.length - i.length))), a.score *= u;
|
|
1164
|
+
}
|
|
1165
|
+
if (s.length === 0) {
|
|
1166
|
+
let o = document.createElement("li");
|
|
1167
|
+
o.classList.add("no-results");
|
|
1168
|
+
let a = document.createElement("span");
|
|
1169
|
+
a.textContent = "No results found", o.appendChild(a), e.appendChild(o);
|
|
1170
|
+
}
|
|
1171
|
+
s.sort((o, a) => a.score - o.score);
|
|
1172
|
+
for (let o = 0, a = Math.min(10, s.length); o < a; o++) {
|
|
1173
|
+
let l = r.data.rows[Number(s[o].ref)],
|
|
1174
|
+
u = `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" class="tsd-kind-icon"><use href="#icon-${l.kind}"></use></svg>`,
|
|
1175
|
+
d = he(l.name, i);
|
|
1176
|
+
globalThis.DEBUG_SEARCH_WEIGHTS && (d += ` (score: ${s[o].score.toFixed(2)})`), l.parent && (d = `<span class="parent">
|
|
1177
|
+
${he(l.parent, i)}.</span>${d}`);
|
|
1178
|
+
let m = document.createElement("li");
|
|
1179
|
+
m.classList.value = l.classes ?? "";
|
|
1180
|
+
let p = document.createElement("a");
|
|
1181
|
+
p.href = r.base + l.url, p.innerHTML = u + d, m.append(p), p.addEventListener("focus", () => {
|
|
1182
|
+
e.querySelector(".current")?.classList.remove("current"), m.classList.add("current");
|
|
1183
|
+
}), e.appendChild(m);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
function de(t, e, n) {
|
|
1187
|
+
let r = t.querySelector(".current");
|
|
1188
|
+
if (!r) r = t.querySelector(n == 1 ? "li:first-child" : "li:last-child"), r && r.classList.add("current");else {
|
|
1189
|
+
let i = r;
|
|
1190
|
+
if (n === 1) do i = i.nextElementSibling ?? void 0; while (i instanceof HTMLElement && i.offsetParent == null);else do i = i.previousElementSibling ?? void 0; while (i instanceof HTMLElement && i.offsetParent == null);
|
|
1191
|
+
i ? (r.classList.remove("current"), i.classList.add("current")) : n === -1 && (r.classList.remove("current"), e.focus());
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
function Be(t, e) {
|
|
1195
|
+
let n = t.querySelector(".current");
|
|
1196
|
+
if (n || (n = t.querySelector("li:first-child")), n) {
|
|
1197
|
+
let r = n.querySelector("a");
|
|
1198
|
+
r && (window.location.href = r.href), te(e);
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
function he(t, e) {
|
|
1202
|
+
if (e === "") return t;
|
|
1203
|
+
let n = t.toLocaleLowerCase(),
|
|
1204
|
+
r = e.toLocaleLowerCase(),
|
|
1205
|
+
i = [],
|
|
1206
|
+
s = 0,
|
|
1207
|
+
o = n.indexOf(r);
|
|
1208
|
+
for (; o != -1;) i.push(ee(t.substring(s, o)), `<b>${ee(t.substring(o, o + r.length))}</b>`), s = o + r.length, o = n.indexOf(r, s);
|
|
1209
|
+
return i.push(ee(t.substring(s))), i.join("");
|
|
1210
|
+
}
|
|
1211
|
+
var je = {
|
|
1212
|
+
"&": "&",
|
|
1213
|
+
"<": "<",
|
|
1214
|
+
">": ">",
|
|
1215
|
+
"'": "'",
|
|
1216
|
+
'"': """
|
|
1217
|
+
};
|
|
1218
|
+
function ee(t) {
|
|
1219
|
+
return t.replace(/[&<>"'"]/g, e => je[e]);
|
|
1220
|
+
}
|
|
1221
|
+
var I = /*#__PURE__*/_createClass(function I(e) {
|
|
1222
|
+
_classCallCheck(this, I);
|
|
1223
|
+
this.el = e.el, this.app = e.app;
|
|
1224
|
+
});
|
|
1225
|
+
var F = "mousedown",
|
|
1226
|
+
ye = "mousemove",
|
|
1227
|
+
N = "mouseup",
|
|
1228
|
+
J = {
|
|
1229
|
+
x: 0,
|
|
1230
|
+
y: 0
|
|
1231
|
+
},
|
|
1232
|
+
me = !1,
|
|
1233
|
+
ne = !1,
|
|
1234
|
+
qe = !1,
|
|
1235
|
+
D = !1,
|
|
1236
|
+
ve = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
1237
|
+
document.documentElement.classList.add(ve ? "is-mobile" : "not-mobile");
|
|
1238
|
+
ve && "ontouchstart" in document.documentElement && (qe = !0, F = "touchstart", ye = "touchmove", N = "touchend");
|
|
1239
|
+
document.addEventListener(F, t => {
|
|
1240
|
+
ne = !0, D = !1;
|
|
1241
|
+
let e = F == "touchstart" ? t.targetTouches[0] : t;
|
|
1242
|
+
J.y = e.pageY || 0, J.x = e.pageX || 0;
|
|
1243
|
+
});
|
|
1244
|
+
document.addEventListener(ye, t => {
|
|
1245
|
+
if (ne && !D) {
|
|
1246
|
+
let e = F == "touchstart" ? t.targetTouches[0] : t,
|
|
1247
|
+
n = J.x - (e.pageX || 0),
|
|
1248
|
+
r = J.y - (e.pageY || 0);
|
|
1249
|
+
D = Math.sqrt(n * n + r * r) > 10;
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
document.addEventListener(N, () => {
|
|
1253
|
+
ne = !1;
|
|
1254
|
+
});
|
|
1255
|
+
document.addEventListener("click", t => {
|
|
1256
|
+
me && (t.preventDefault(), t.stopImmediatePropagation(), me = !1);
|
|
1257
|
+
});
|
|
1258
|
+
var X = /*#__PURE__*/function (_I) {
|
|
1259
|
+
function X(e) {
|
|
1260
|
+
var _this;
|
|
1261
|
+
_classCallCheck(this, X);
|
|
1262
|
+
_this = _callSuper(this, X, [e]), _this.className = _this.el.dataset.toggle || "", _this.el.addEventListener(N, n => _this.onPointerUp(n)), _this.el.addEventListener("click", n => n.preventDefault()), document.addEventListener(F, n => _this.onDocumentPointerDown(n)), document.addEventListener(N, n => _this.onDocumentPointerUp(n));
|
|
1263
|
+
return _this;
|
|
1264
|
+
}
|
|
1265
|
+
_inherits(X, _I);
|
|
1266
|
+
return _createClass(X, [{
|
|
1267
|
+
key: "setActive",
|
|
1268
|
+
value: function setActive(e) {
|
|
1269
|
+
if (this.active == e) return;
|
|
1270
|
+
this.active = e, document.documentElement.classList.toggle("has-" + this.className, e), this.el.classList.toggle("active", e);
|
|
1271
|
+
let n = (this.active ? "to-has-" : "from-has-") + this.className;
|
|
1272
|
+
document.documentElement.classList.add(n), setTimeout(() => document.documentElement.classList.remove(n), 500);
|
|
1273
|
+
}
|
|
1274
|
+
}, {
|
|
1275
|
+
key: "onPointerUp",
|
|
1276
|
+
value: function onPointerUp(e) {
|
|
1277
|
+
D || (this.setActive(!0), e.preventDefault());
|
|
1278
|
+
}
|
|
1279
|
+
}, {
|
|
1280
|
+
key: "onDocumentPointerDown",
|
|
1281
|
+
value: function onDocumentPointerDown(e) {
|
|
1282
|
+
if (this.active) {
|
|
1283
|
+
if (e.target.closest(".col-sidebar, .tsd-filter-group")) return;
|
|
1284
|
+
this.setActive(!1);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}, {
|
|
1288
|
+
key: "onDocumentPointerUp",
|
|
1289
|
+
value: function onDocumentPointerUp(e) {
|
|
1290
|
+
if (!D && this.active && e.target.closest(".col-sidebar")) {
|
|
1291
|
+
let n = e.target.closest("a");
|
|
1292
|
+
if (n) {
|
|
1293
|
+
let r = window.location.href;
|
|
1294
|
+
r.indexOf("#") != -1 && (r = r.substring(0, r.indexOf("#"))), n.href.substring(0, r.length) == r && setTimeout(() => this.setActive(!1), 250);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
}]);
|
|
1299
|
+
}(I);
|
|
1300
|
+
var re;
|
|
1301
|
+
try {
|
|
1302
|
+
re = localStorage;
|
|
1303
|
+
} catch {
|
|
1304
|
+
re = {
|
|
1305
|
+
getItem() {
|
|
1306
|
+
return null;
|
|
1307
|
+
},
|
|
1308
|
+
setItem() {}
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
var Q = re;
|
|
1312
|
+
var ge = document.head.appendChild(document.createElement("style"));
|
|
1313
|
+
ge.dataset.for = "filters";
|
|
1314
|
+
var Y = /*#__PURE__*/function (_I2) {
|
|
1315
|
+
function Y(e) {
|
|
1316
|
+
var _this2;
|
|
1317
|
+
_classCallCheck(this, Y);
|
|
1318
|
+
_this2 = _callSuper(this, Y, [e]), _this2.key = `filter-${_this2.el.name}`, _this2.value = _this2.el.checked, _this2.el.addEventListener("change", () => {
|
|
1319
|
+
_this2.setLocalStorage(_this2.el.checked);
|
|
1320
|
+
}), _this2.setLocalStorage(_this2.fromLocalStorage()), ge.innerHTML += `html:not(.${_this2.key}) .tsd-is-${_this2.el.name} { display: none; }
|
|
1321
|
+
`, _this2.app.updateIndexVisibility();
|
|
1322
|
+
return _this2;
|
|
1323
|
+
}
|
|
1324
|
+
_inherits(Y, _I2);
|
|
1325
|
+
return _createClass(Y, [{
|
|
1326
|
+
key: "fromLocalStorage",
|
|
1327
|
+
value: function fromLocalStorage() {
|
|
1328
|
+
let e = Q.getItem(this.key);
|
|
1329
|
+
return e ? e === "true" : this.el.checked;
|
|
1330
|
+
}
|
|
1331
|
+
}, {
|
|
1332
|
+
key: "setLocalStorage",
|
|
1333
|
+
value: function setLocalStorage(e) {
|
|
1334
|
+
Q.setItem(this.key, e.toString()), this.value = e, this.handleValueChange();
|
|
1335
|
+
}
|
|
1336
|
+
}, {
|
|
1337
|
+
key: "handleValueChange",
|
|
1338
|
+
value: function handleValueChange() {
|
|
1339
|
+
this.el.checked = this.value, document.documentElement.classList.toggle(this.key, this.value), this.app.filterChanged(), this.app.updateIndexVisibility();
|
|
1340
|
+
}
|
|
1341
|
+
}]);
|
|
1342
|
+
}(I);
|
|
1343
|
+
var Z = /*#__PURE__*/function (_I3) {
|
|
1344
|
+
function Z(e) {
|
|
1345
|
+
var _this3;
|
|
1346
|
+
_classCallCheck(this, Z);
|
|
1347
|
+
_this3 = _callSuper(this, Z, [e]), _this3.summary = _this3.el.querySelector(".tsd-accordion-summary"), _this3.icon = _this3.summary.querySelector("svg"), _this3.key = `tsd-accordion-${_this3.summary.dataset.key ?? _this3.summary.textContent.trim().replace(/\s+/g, "-").toLowerCase()}`;
|
|
1348
|
+
let n = Q.getItem(_this3.key);
|
|
1349
|
+
_this3.el.open = n ? n === "true" : _this3.el.open, _this3.el.addEventListener("toggle", () => _this3.update());
|
|
1350
|
+
let r = _this3.summary.querySelector("a");
|
|
1351
|
+
r && r.addEventListener("click", () => {
|
|
1352
|
+
location.assign(r.href);
|
|
1353
|
+
}), _this3.update();
|
|
1354
|
+
return _this3;
|
|
1355
|
+
}
|
|
1356
|
+
_inherits(Z, _I3);
|
|
1357
|
+
return _createClass(Z, [{
|
|
1358
|
+
key: "update",
|
|
1359
|
+
value: function update() {
|
|
1360
|
+
this.icon.style.transform = `rotate(${this.el.open ? 0 : -90}deg)`, Q.setItem(this.key, this.el.open.toString());
|
|
1361
|
+
}
|
|
1362
|
+
}]);
|
|
1363
|
+
}(I);
|
|
1364
|
+
function Ee(t) {
|
|
1365
|
+
let e = Q.getItem("tsd-theme") || "os";
|
|
1366
|
+
t.value = e, xe(e), t.addEventListener("change", () => {
|
|
1367
|
+
Q.setItem("tsd-theme", t.value), xe(t.value);
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
function xe(t) {
|
|
1371
|
+
document.documentElement.dataset.theme = t;
|
|
1372
|
+
}
|
|
1373
|
+
var K;
|
|
1374
|
+
function we() {
|
|
1375
|
+
let t = document.getElementById("tsd-nav-script");
|
|
1376
|
+
t && (t.addEventListener("load", Le), Le());
|
|
1377
|
+
}
|
|
1378
|
+
async function Le() {
|
|
1379
|
+
let t = document.getElementById("tsd-nav-container");
|
|
1380
|
+
if (!t || !window.navigationData) return;
|
|
1381
|
+
let n = await (await fetch(window.navigationData)).arrayBuffer(),
|
|
1382
|
+
r = new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),
|
|
1383
|
+
i = await new Response(r).json();
|
|
1384
|
+
K = t.dataset.base, K.endsWith("/") || (K += "/"), t.innerHTML = "";
|
|
1385
|
+
for (let s of i) Se(s, t, []);
|
|
1386
|
+
window.app.createComponents(t), window.app.showPage(), window.app.ensureActivePageVisible();
|
|
1387
|
+
}
|
|
1388
|
+
function Se(t, e, n) {
|
|
1389
|
+
let r = e.appendChild(document.createElement("li"));
|
|
1390
|
+
if (t.children) {
|
|
1391
|
+
let i = [...n, t.text],
|
|
1392
|
+
s = r.appendChild(document.createElement("details"));
|
|
1393
|
+
s.className = t.class ? `${t.class} tsd-accordion` : "tsd-accordion";
|
|
1394
|
+
let o = s.appendChild(document.createElement("summary"));
|
|
1395
|
+
o.className = "tsd-accordion-summary", o.dataset.key = i.join("$"), o.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="#icon-chevronDown"></use></svg>', be(t, o);
|
|
1396
|
+
let a = s.appendChild(document.createElement("div"));
|
|
1397
|
+
a.className = "tsd-accordion-details";
|
|
1398
|
+
let l = a.appendChild(document.createElement("ul"));
|
|
1399
|
+
l.className = "tsd-nested-navigation";
|
|
1400
|
+
for (let u of t.children) Se(u, l, i);
|
|
1401
|
+
} else be(t, r, t.class);
|
|
1402
|
+
}
|
|
1403
|
+
function be(t, e, n) {
|
|
1404
|
+
if (t.path) {
|
|
1405
|
+
let r = e.appendChild(document.createElement("a"));
|
|
1406
|
+
r.href = K + t.path, n && (r.className = n), location.pathname === r.pathname && r.classList.add("current"), t.kind && (r.innerHTML = `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" class="tsd-kind-icon"><use href="#icon-${t.kind}"></use></svg>`), r.appendChild(document.createElement("span")).textContent = t.text;
|
|
1407
|
+
} else e.appendChild(document.createElement("span")).textContent = t.text;
|
|
1408
|
+
}
|
|
1409
|
+
G(X, "a[data-toggle]");
|
|
1410
|
+
G(Z, ".tsd-accordion");
|
|
1411
|
+
G(Y, ".tsd-filter-item input[type=checkbox]");
|
|
1412
|
+
var Te = document.getElementById("tsd-theme");
|
|
1413
|
+
Te && Ee(Te);
|
|
1414
|
+
var $e = new U();
|
|
1415
|
+
Object.defineProperty(window, "app", {
|
|
1416
|
+
value: $e
|
|
1417
|
+
});
|
|
1418
|
+
fe();
|
|
1419
|
+
we();
|
|
1420
|
+
})();
|
|
1421
|
+
/*! Bundled license information:
|
|
1422
|
+
|
|
1423
|
+
lunr/lunr.js:
|
|
1424
|
+
(**
|
|
1425
|
+
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9
|
|
1426
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1427
|
+
* @license MIT
|
|
1428
|
+
*)
|
|
1429
|
+
(*!
|
|
1430
|
+
* lunr.utils
|
|
1431
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1432
|
+
*)
|
|
1433
|
+
(*!
|
|
1434
|
+
* lunr.Set
|
|
1435
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1436
|
+
*)
|
|
1437
|
+
(*!
|
|
1438
|
+
* lunr.tokenizer
|
|
1439
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1440
|
+
*)
|
|
1441
|
+
(*!
|
|
1442
|
+
* lunr.Pipeline
|
|
1443
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1444
|
+
*)
|
|
1445
|
+
(*!
|
|
1446
|
+
* lunr.Vector
|
|
1447
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1448
|
+
*)
|
|
1449
|
+
(*!
|
|
1450
|
+
* lunr.stemmer
|
|
1451
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1452
|
+
* Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
|
|
1453
|
+
*)
|
|
1454
|
+
(*!
|
|
1455
|
+
* lunr.stopWordFilter
|
|
1456
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1457
|
+
*)
|
|
1458
|
+
(*!
|
|
1459
|
+
* lunr.trimmer
|
|
1460
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1461
|
+
*)
|
|
1462
|
+
(*!
|
|
1463
|
+
* lunr.TokenSet
|
|
1464
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1465
|
+
*)
|
|
1466
|
+
(*!
|
|
1467
|
+
* lunr.Index
|
|
1468
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1469
|
+
*)
|
|
1470
|
+
(*!
|
|
1471
|
+
* lunr.Builder
|
|
1472
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
1473
|
+
*)
|
|
1474
|
+
*/
|
|
1475
|
+
//# sourceMappingURL=main.js.map
|