@infinilabs/discover 0.0.16 → 0.0.18
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/dist/{common-CelpNJ_P.cjs → common-DFB-Krii.cjs} +6 -6
- package/dist/{common-6ueRhcZj.js → common-JxI0fO97.js} +273 -268
- package/dist/{components-BZTcWo0D.js → components-BtZfYCUr.js} +216 -148
- package/dist/{components-DzA4fVqH.cjs → components-w0oW3GpQ.cjs} +46 -44
- package/dist/{filter_label-DALDJinr.js → filter_label-BOgCXkdp.js} +2 -2
- package/dist/{filter_label-306D4xEc.cjs → filter_label-BVGFM735.cjs} +1 -1
- package/dist/{filter_operators-B5A15sKd.cjs → filter_operators-C_4il2ok.cjs} +1 -1
- package/dist/{filter_operators-DuazgKuH.js → filter_operators-f_RipGT3.js} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +4 -4
- package/dist/public-BfModHE8.cjs +3 -0
- package/dist/public-seOSIZPc.js +1772 -0
- package/dist/{query_bar_top_row-DaHCNARQ.js → query_bar_top_row-D5J6N5L2.js} +2 -2
- package/dist/{query_bar_top_row-hkYli4mo.cjs → query_bar_top_row-DigJljNX.cjs} +1 -1
- package/dist/{query_bar_top_row-Dzd1EBWC.js → query_bar_top_row-Dp4-frN1.js} +5 -5
- package/dist/query_bar_top_row-GViVxtYa.cjs +1 -0
- package/dist/{query_string_input-o_vEPSg2.js → query_string_input-BP2qq9Lf.js} +3 -3
- package/dist/{query_string_input-jELi9JGI.cjs → query_string_input-DpPUCiXF.cjs} +1 -1
- package/dist/query_string_input-DvXZHDE9.cjs +1 -0
- package/dist/{query_string_input-B6lvPXEY.js → query_string_input-uI_z3PwX.js} +1 -1
- package/dist/{search_bar-aRdyo2C0.cjs → search_bar-BcYGmNoo.cjs} +1 -1
- package/dist/{search_bar-Ho9D93zT.js → search_bar-DZMeLETx.js} +6 -6
- package/package.json +1 -1
- package/dist/public-BWdftR10.cjs +0 -3
- package/dist/public-kDgoH8_s.js +0 -1781
- package/dist/query_bar_top_row-DFBab9DF.cjs +0 -1
- package/dist/query_string_input-wee-LHxT.cjs +0 -1
|
@@ -0,0 +1,1772 @@
|
|
|
1
|
+
import { n as __esmMin, o as __toESM } from "./chunk-D-4zIDrl.js";
|
|
2
|
+
import { f as withKibana, p as toMountPoint, r as getUiSettings, s as require_query_string } from "./services-C8UxrSbr.js";
|
|
3
|
+
import { t as require_lodash } from "./lodash-Gv_ptthU.js";
|
|
4
|
+
import { a as ILLEGAL_CHARACTERS_VISIBLE, i as ILLEGAL_CHARACTERS_KEY, l as IndexPatternMissingIndices, n as CONTAINS_SPACES_KEY, o as isDefault, r as ILLEGAL_CHARACTERS, s as getFromSavedObject, t as validateIndexPattern } from "./lib-Cdf3LT56.js";
|
|
5
|
+
import { A as formatHitProvider, B as nodeTypes, C as intervalOptions, D as COMPARE_ALL_OPTIONS, E as uniqFilters, F as baseFormatters, G as isQueryStringFilter, H as toElasticsearchQuery, I as FieldFormat, K as FilterStateStore, L as KBN_FIELD_TYPES, M as isFilterable, N as isNestedField, O as compareFilters, R as FIELD_FORMAT_IDS, T as getTime, V as fromKueryExpression, W as FILTERS, X as isFilterPinned, _ as isValidEsInterval, _t as buildFilter, a as termsAggFilter, at as isScriptedRangeFilter, b as InvalidEsIntervalFormatError, bt as init_moment, c as isType, ct as getPhraseFilterValue, d as propFilter, f as Ipv4Address, g as isValidInterval, h as parseInterval, ht as isExistsFilter, i as parentPipelineType, it as isRangeFilter, j as flattenHitWrapper, l as CidrMask, lt as isPhraseFilter, m as toAbsoluteDates, mt as isGeoBoundingBoxFilter, n as tabifyGetColumns, o as isNumberType, ot as isPhrasesFilter, p as getFormatWithAggs, pt as isGeoPolygonFilter, r as siblingPipelineType, rt as isMissingFilter, s as isStringType, st as getPhraseFilterField, t as tabifyAggResponse, tt as isMatchAllFilter, u as isDateHistogramBucketAggConfig, ut as isScriptedPhraseFilter, v as dateHistogramInterval, vt as UI_SETTINGS, w as calculateBounds, x as InvalidEsCalendarIntervalError, xt as moment_default, y as parseEsInterval } from "./common-JxI0fO97.js";
|
|
6
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
7
|
+
import { theme } from "antd";
|
|
8
|
+
import { EuiButton, EuiCallOut, EuiCodeBlock, EuiFlexGroup, EuiFlexItem, EuiSpacer } from "@elastic/eui";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import dateMath from "@elastic/datemath";
|
|
11
|
+
function __extends(d, B) {
|
|
12
|
+
if (typeof B != "function" && B !== null) throw TypeError("Class extends value " + String(B) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, B);
|
|
14
|
+
function V() {
|
|
15
|
+
this.constructor = d;
|
|
16
|
+
}
|
|
17
|
+
d.prototype = B === null ? Object.create(B) : (V.prototype = B.prototype, new V());
|
|
18
|
+
}
|
|
19
|
+
function __values(d) {
|
|
20
|
+
var B = typeof Symbol == "function" && Symbol.iterator, V = B && d[B], H = 0;
|
|
21
|
+
if (V) return V.call(d);
|
|
22
|
+
if (d && typeof d.length == "number") return { next: function() {
|
|
23
|
+
return d && H >= d.length && (d = void 0), {
|
|
24
|
+
value: d && d[H++],
|
|
25
|
+
done: !d
|
|
26
|
+
};
|
|
27
|
+
} };
|
|
28
|
+
throw TypeError(B ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
29
|
+
}
|
|
30
|
+
function __read(d, B) {
|
|
31
|
+
var V = typeof Symbol == "function" && d[Symbol.iterator];
|
|
32
|
+
if (!V) return d;
|
|
33
|
+
var H = V.call(d), U, W = [], G;
|
|
34
|
+
try {
|
|
35
|
+
for (; (B === void 0 || B-- > 0) && !(U = H.next()).done;) W.push(U.value);
|
|
36
|
+
} catch (d) {
|
|
37
|
+
G = { error: d };
|
|
38
|
+
} finally {
|
|
39
|
+
try {
|
|
40
|
+
U && !U.done && (V = H.return) && V.call(H);
|
|
41
|
+
} finally {
|
|
42
|
+
if (G) throw G.error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return W;
|
|
46
|
+
}
|
|
47
|
+
function __spreadArray(d, B, V) {
|
|
48
|
+
if (V || arguments.length === 2) for (var H = 0, U = B.length, W; H < U; H++) (W || !(H in B)) && (W ||= Array.prototype.slice.call(B, 0, H), W[H] = B[H]);
|
|
49
|
+
return d.concat(W || Array.prototype.slice.call(B));
|
|
50
|
+
}
|
|
51
|
+
var extendStatics, init_tslib_es6 = __esmMin((() => {
|
|
52
|
+
extendStatics = function(d, B) {
|
|
53
|
+
return extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, B) {
|
|
54
|
+
d.__proto__ = B;
|
|
55
|
+
} || function(d, B) {
|
|
56
|
+
for (var V in B) Object.prototype.hasOwnProperty.call(B, V) && (d[V] = B[V]);
|
|
57
|
+
}, extendStatics(d, B);
|
|
58
|
+
};
|
|
59
|
+
}));
|
|
60
|
+
function isFunction(d) {
|
|
61
|
+
return typeof d == "function";
|
|
62
|
+
}
|
|
63
|
+
function createErrorClass(d) {
|
|
64
|
+
var B = d(function(d) {
|
|
65
|
+
Error.call(d), d.stack = (/* @__PURE__ */ Error()).stack;
|
|
66
|
+
});
|
|
67
|
+
return B.prototype = Object.create(Error.prototype), B.prototype.constructor = B, B;
|
|
68
|
+
}
|
|
69
|
+
var UnsubscriptionError = createErrorClass(function(d) {
|
|
70
|
+
return function(B) {
|
|
71
|
+
d(this), this.message = B ? B.length + " errors occurred during unsubscription:\n" + B.map(function(d, B) {
|
|
72
|
+
return B + 1 + ") " + d.toString();
|
|
73
|
+
}).join("\n ") : "", this.name = "UnsubscriptionError", this.errors = B;
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
function arrRemove(d, B) {
|
|
77
|
+
if (d) {
|
|
78
|
+
var V = d.indexOf(B);
|
|
79
|
+
0 <= V && d.splice(V, 1);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
init_tslib_es6();
|
|
83
|
+
var Subscription = function() {
|
|
84
|
+
function d(d) {
|
|
85
|
+
this.initialTeardown = d, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
86
|
+
}
|
|
87
|
+
return d.prototype.unsubscribe = function() {
|
|
88
|
+
var d, B, V, H, U;
|
|
89
|
+
if (!this.closed) {
|
|
90
|
+
this.closed = !0;
|
|
91
|
+
var W = this._parentage;
|
|
92
|
+
if (W) if (this._parentage = null, Array.isArray(W)) try {
|
|
93
|
+
for (var G = __values(W), K = G.next(); !K.done; K = G.next()) K.value.remove(this);
|
|
94
|
+
} catch (B) {
|
|
95
|
+
d = { error: B };
|
|
96
|
+
} finally {
|
|
97
|
+
try {
|
|
98
|
+
K && !K.done && (B = G.return) && B.call(G);
|
|
99
|
+
} finally {
|
|
100
|
+
if (d) throw d.error;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else W.remove(this);
|
|
104
|
+
var q = this.initialTeardown;
|
|
105
|
+
if (isFunction(q)) try {
|
|
106
|
+
q();
|
|
107
|
+
} catch (d) {
|
|
108
|
+
U = d instanceof UnsubscriptionError ? d.errors : [d];
|
|
109
|
+
}
|
|
110
|
+
var J = this._finalizers;
|
|
111
|
+
if (J) {
|
|
112
|
+
this._finalizers = null;
|
|
113
|
+
try {
|
|
114
|
+
for (var Y = __values(J), X = Y.next(); !X.done; X = Y.next()) {
|
|
115
|
+
var Z = X.value;
|
|
116
|
+
try {
|
|
117
|
+
execFinalizer(Z);
|
|
118
|
+
} catch (d) {
|
|
119
|
+
U ??= [], d instanceof UnsubscriptionError ? U = __spreadArray(__spreadArray([], __read(U)), __read(d.errors)) : U.push(d);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
} catch (d) {
|
|
123
|
+
V = { error: d };
|
|
124
|
+
} finally {
|
|
125
|
+
try {
|
|
126
|
+
X && !X.done && (H = Y.return) && H.call(Y);
|
|
127
|
+
} finally {
|
|
128
|
+
if (V) throw V.error;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (U) throw new UnsubscriptionError(U);
|
|
133
|
+
}
|
|
134
|
+
}, d.prototype.add = function(B) {
|
|
135
|
+
if (B && B !== this) if (this.closed) execFinalizer(B);
|
|
136
|
+
else {
|
|
137
|
+
if (B instanceof d) {
|
|
138
|
+
if (B.closed || B._hasParent(this)) return;
|
|
139
|
+
B._addParent(this);
|
|
140
|
+
}
|
|
141
|
+
(this._finalizers = this._finalizers ?? []).push(B);
|
|
142
|
+
}
|
|
143
|
+
}, d.prototype._hasParent = function(d) {
|
|
144
|
+
var B = this._parentage;
|
|
145
|
+
return B === d || Array.isArray(B) && B.includes(d);
|
|
146
|
+
}, d.prototype._addParent = function(d) {
|
|
147
|
+
var B = this._parentage;
|
|
148
|
+
this._parentage = Array.isArray(B) ? (B.push(d), B) : B ? [B, d] : d;
|
|
149
|
+
}, d.prototype._removeParent = function(d) {
|
|
150
|
+
var B = this._parentage;
|
|
151
|
+
B === d ? this._parentage = null : Array.isArray(B) && arrRemove(B, d);
|
|
152
|
+
}, d.prototype.remove = function(B) {
|
|
153
|
+
var V = this._finalizers;
|
|
154
|
+
V && arrRemove(V, B), B instanceof d && B._removeParent(this);
|
|
155
|
+
}, d.EMPTY = (function() {
|
|
156
|
+
var B = new d();
|
|
157
|
+
return B.closed = !0, B;
|
|
158
|
+
})(), d;
|
|
159
|
+
}(), EMPTY_SUBSCRIPTION = Subscription.EMPTY;
|
|
160
|
+
function isSubscription(d) {
|
|
161
|
+
return d instanceof Subscription || d && "closed" in d && isFunction(d.remove) && isFunction(d.add) && isFunction(d.unsubscribe);
|
|
162
|
+
}
|
|
163
|
+
function execFinalizer(d) {
|
|
164
|
+
isFunction(d) ? d() : d.unsubscribe();
|
|
165
|
+
}
|
|
166
|
+
var config = {
|
|
167
|
+
onUnhandledError: null,
|
|
168
|
+
onStoppedNotification: null,
|
|
169
|
+
Promise: void 0,
|
|
170
|
+
useDeprecatedSynchronousErrorHandling: !1,
|
|
171
|
+
useDeprecatedNextContext: !1
|
|
172
|
+
};
|
|
173
|
+
init_tslib_es6();
|
|
174
|
+
var timeoutProvider = {
|
|
175
|
+
setTimeout: function(d, B) {
|
|
176
|
+
var V = [...arguments].slice(2), H = timeoutProvider.delegate;
|
|
177
|
+
return H?.setTimeout ? H.setTimeout.apply(H, __spreadArray([d, B], __read(V))) : setTimeout.apply(void 0, __spreadArray([d, B], __read(V)));
|
|
178
|
+
},
|
|
179
|
+
clearTimeout: function(d) {
|
|
180
|
+
return (timeoutProvider.delegate?.clearTimeout || clearTimeout)(d);
|
|
181
|
+
},
|
|
182
|
+
delegate: void 0
|
|
183
|
+
};
|
|
184
|
+
function reportUnhandledError(d) {
|
|
185
|
+
timeoutProvider.setTimeout(function() {
|
|
186
|
+
var B = config.onUnhandledError;
|
|
187
|
+
if (B) B(d);
|
|
188
|
+
else throw d;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function noop$3() {}
|
|
192
|
+
var COMPLETE_NOTIFICATION = (function() {
|
|
193
|
+
return createNotification("C", void 0, void 0);
|
|
194
|
+
})();
|
|
195
|
+
function errorNotification(d) {
|
|
196
|
+
return createNotification("E", void 0, d);
|
|
197
|
+
}
|
|
198
|
+
function nextNotification(d) {
|
|
199
|
+
return createNotification("N", d, void 0);
|
|
200
|
+
}
|
|
201
|
+
function createNotification(d, B, V) {
|
|
202
|
+
return {
|
|
203
|
+
kind: d,
|
|
204
|
+
value: B,
|
|
205
|
+
error: V
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
var context = null;
|
|
209
|
+
function errorContext(d) {
|
|
210
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
211
|
+
var B = !context;
|
|
212
|
+
if (B && (context = {
|
|
213
|
+
errorThrown: !1,
|
|
214
|
+
error: null
|
|
215
|
+
}), d(), B) {
|
|
216
|
+
var V = context, H = V.errorThrown, U = V.error;
|
|
217
|
+
if (context = null, H) throw U;
|
|
218
|
+
}
|
|
219
|
+
} else d();
|
|
220
|
+
}
|
|
221
|
+
function captureError(d) {
|
|
222
|
+
config.useDeprecatedSynchronousErrorHandling && context && (context.errorThrown = !0, context.error = d);
|
|
223
|
+
}
|
|
224
|
+
init_tslib_es6();
|
|
225
|
+
var Subscriber = function(d) {
|
|
226
|
+
__extends(B, d);
|
|
227
|
+
function B(B) {
|
|
228
|
+
var V = d.call(this) || this;
|
|
229
|
+
return V.isStopped = !1, B ? (V.destination = B, isSubscription(B) && B.add(V)) : V.destination = EMPTY_OBSERVER, V;
|
|
230
|
+
}
|
|
231
|
+
return B.create = function(d, B, V) {
|
|
232
|
+
return new SafeSubscriber(d, B, V);
|
|
233
|
+
}, B.prototype.next = function(d) {
|
|
234
|
+
this.isStopped ? handleStoppedNotification(nextNotification(d), this) : this._next(d);
|
|
235
|
+
}, B.prototype.error = function(d) {
|
|
236
|
+
this.isStopped ? handleStoppedNotification(errorNotification(d), this) : (this.isStopped = !0, this._error(d));
|
|
237
|
+
}, B.prototype.complete = function() {
|
|
238
|
+
this.isStopped ? handleStoppedNotification(COMPLETE_NOTIFICATION, this) : (this.isStopped = !0, this._complete());
|
|
239
|
+
}, B.prototype.unsubscribe = function() {
|
|
240
|
+
this.closed || (this.isStopped = !0, d.prototype.unsubscribe.call(this), this.destination = null);
|
|
241
|
+
}, B.prototype._next = function(d) {
|
|
242
|
+
this.destination.next(d);
|
|
243
|
+
}, B.prototype._error = function(d) {
|
|
244
|
+
try {
|
|
245
|
+
this.destination.error(d);
|
|
246
|
+
} finally {
|
|
247
|
+
this.unsubscribe();
|
|
248
|
+
}
|
|
249
|
+
}, B.prototype._complete = function() {
|
|
250
|
+
try {
|
|
251
|
+
this.destination.complete();
|
|
252
|
+
} finally {
|
|
253
|
+
this.unsubscribe();
|
|
254
|
+
}
|
|
255
|
+
}, B;
|
|
256
|
+
}(Subscription), _bind = Function.prototype.bind;
|
|
257
|
+
function bind(d, B) {
|
|
258
|
+
return _bind.call(d, B);
|
|
259
|
+
}
|
|
260
|
+
var ConsumerObserver = function() {
|
|
261
|
+
function d(d) {
|
|
262
|
+
this.partialObserver = d;
|
|
263
|
+
}
|
|
264
|
+
return d.prototype.next = function(d) {
|
|
265
|
+
var B = this.partialObserver;
|
|
266
|
+
if (B.next) try {
|
|
267
|
+
B.next(d);
|
|
268
|
+
} catch (d) {
|
|
269
|
+
handleUnhandledError(d);
|
|
270
|
+
}
|
|
271
|
+
}, d.prototype.error = function(d) {
|
|
272
|
+
var B = this.partialObserver;
|
|
273
|
+
if (B.error) try {
|
|
274
|
+
B.error(d);
|
|
275
|
+
} catch (d) {
|
|
276
|
+
handleUnhandledError(d);
|
|
277
|
+
}
|
|
278
|
+
else handleUnhandledError(d);
|
|
279
|
+
}, d.prototype.complete = function() {
|
|
280
|
+
var d = this.partialObserver;
|
|
281
|
+
if (d.complete) try {
|
|
282
|
+
d.complete();
|
|
283
|
+
} catch (d) {
|
|
284
|
+
handleUnhandledError(d);
|
|
285
|
+
}
|
|
286
|
+
}, d;
|
|
287
|
+
}(), SafeSubscriber = function(d) {
|
|
288
|
+
__extends(B, d);
|
|
289
|
+
function B(B, V, H) {
|
|
290
|
+
var U = d.call(this) || this, W;
|
|
291
|
+
if (isFunction(B) || !B) W = {
|
|
292
|
+
next: B ?? void 0,
|
|
293
|
+
error: V ?? void 0,
|
|
294
|
+
complete: H ?? void 0
|
|
295
|
+
};
|
|
296
|
+
else {
|
|
297
|
+
var G;
|
|
298
|
+
U && config.useDeprecatedNextContext ? (G = Object.create(B), G.unsubscribe = function() {
|
|
299
|
+
return U.unsubscribe();
|
|
300
|
+
}, W = {
|
|
301
|
+
next: B.next && bind(B.next, G),
|
|
302
|
+
error: B.error && bind(B.error, G),
|
|
303
|
+
complete: B.complete && bind(B.complete, G)
|
|
304
|
+
}) : W = B;
|
|
305
|
+
}
|
|
306
|
+
return U.destination = new ConsumerObserver(W), U;
|
|
307
|
+
}
|
|
308
|
+
return B;
|
|
309
|
+
}(Subscriber);
|
|
310
|
+
function handleUnhandledError(d) {
|
|
311
|
+
config.useDeprecatedSynchronousErrorHandling ? captureError(d) : reportUnhandledError(d);
|
|
312
|
+
}
|
|
313
|
+
function defaultErrorHandler(d) {
|
|
314
|
+
throw d;
|
|
315
|
+
}
|
|
316
|
+
function handleStoppedNotification(d, B) {
|
|
317
|
+
var V = config.onStoppedNotification;
|
|
318
|
+
V && timeoutProvider.setTimeout(function() {
|
|
319
|
+
return V(d, B);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
var EMPTY_OBSERVER = {
|
|
323
|
+
closed: !0,
|
|
324
|
+
next: noop$3,
|
|
325
|
+
error: defaultErrorHandler,
|
|
326
|
+
complete: noop$3
|
|
327
|
+
}, observable = (function() {
|
|
328
|
+
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
329
|
+
})();
|
|
330
|
+
function identity$1(d) {
|
|
331
|
+
return d;
|
|
332
|
+
}
|
|
333
|
+
function pipeFromArray(d) {
|
|
334
|
+
return d.length === 0 ? identity$1 : d.length === 1 ? d[0] : function(B) {
|
|
335
|
+
return d.reduce(function(d, B) {
|
|
336
|
+
return B(d);
|
|
337
|
+
}, B);
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
var Observable = function() {
|
|
341
|
+
function d(d) {
|
|
342
|
+
d && (this._subscribe = d);
|
|
343
|
+
}
|
|
344
|
+
return d.prototype.lift = function(B) {
|
|
345
|
+
var V = new d();
|
|
346
|
+
return V.source = this, V.operator = B, V;
|
|
347
|
+
}, d.prototype.subscribe = function(d, B, V) {
|
|
348
|
+
var H = this, U = isSubscriber(d) ? d : new SafeSubscriber(d, B, V);
|
|
349
|
+
return errorContext(function() {
|
|
350
|
+
var d = H, B = d.operator, V = d.source;
|
|
351
|
+
U.add(B ? B.call(U, V) : V ? H._subscribe(U) : H._trySubscribe(U));
|
|
352
|
+
}), U;
|
|
353
|
+
}, d.prototype._trySubscribe = function(d) {
|
|
354
|
+
try {
|
|
355
|
+
return this._subscribe(d);
|
|
356
|
+
} catch (B) {
|
|
357
|
+
d.error(B);
|
|
358
|
+
}
|
|
359
|
+
}, d.prototype.forEach = function(d, B) {
|
|
360
|
+
var V = this;
|
|
361
|
+
return B = getPromiseCtor(B), new B(function(B, H) {
|
|
362
|
+
var U = new SafeSubscriber({
|
|
363
|
+
next: function(B) {
|
|
364
|
+
try {
|
|
365
|
+
d(B);
|
|
366
|
+
} catch (d) {
|
|
367
|
+
H(d), U.unsubscribe();
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
error: H,
|
|
371
|
+
complete: B
|
|
372
|
+
});
|
|
373
|
+
V.subscribe(U);
|
|
374
|
+
});
|
|
375
|
+
}, d.prototype._subscribe = function(d) {
|
|
376
|
+
return this.source?.subscribe(d);
|
|
377
|
+
}, d.prototype[observable] = function() {
|
|
378
|
+
return this;
|
|
379
|
+
}, d.prototype.pipe = function() {
|
|
380
|
+
return pipeFromArray([...arguments])(this);
|
|
381
|
+
}, d.prototype.toPromise = function(d) {
|
|
382
|
+
var B = this;
|
|
383
|
+
return d = getPromiseCtor(d), new d(function(d, V) {
|
|
384
|
+
var H;
|
|
385
|
+
B.subscribe(function(d) {
|
|
386
|
+
return H = d;
|
|
387
|
+
}, function(d) {
|
|
388
|
+
return V(d);
|
|
389
|
+
}, function() {
|
|
390
|
+
return d(H);
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
}, d.create = function(B) {
|
|
394
|
+
return new d(B);
|
|
395
|
+
}, d;
|
|
396
|
+
}();
|
|
397
|
+
function getPromiseCtor(d) {
|
|
398
|
+
return d ?? config.Promise ?? Promise;
|
|
399
|
+
}
|
|
400
|
+
function isObserver(d) {
|
|
401
|
+
return d && isFunction(d.next) && isFunction(d.error) && isFunction(d.complete);
|
|
402
|
+
}
|
|
403
|
+
function isSubscriber(d) {
|
|
404
|
+
return d && d instanceof Subscriber || isObserver(d) && isSubscription(d);
|
|
405
|
+
}
|
|
406
|
+
function hasLift(d) {
|
|
407
|
+
return isFunction(d?.lift);
|
|
408
|
+
}
|
|
409
|
+
function operate(d) {
|
|
410
|
+
return function(B) {
|
|
411
|
+
if (hasLift(B)) return B.lift(function(B) {
|
|
412
|
+
try {
|
|
413
|
+
return d(B, this);
|
|
414
|
+
} catch (d) {
|
|
415
|
+
this.error(d);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
throw TypeError("Unable to lift unknown Observable type");
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
init_tslib_es6();
|
|
422
|
+
function createOperatorSubscriber(d, B, V, H, U) {
|
|
423
|
+
return new OperatorSubscriber(d, B, V, H, U);
|
|
424
|
+
}
|
|
425
|
+
var OperatorSubscriber = function(d) {
|
|
426
|
+
__extends(B, d);
|
|
427
|
+
function B(B, V, H, U, W, G) {
|
|
428
|
+
var K = d.call(this, B) || this;
|
|
429
|
+
return K.onFinalize = W, K.shouldUnsubscribe = G, K._next = V ? function(d) {
|
|
430
|
+
try {
|
|
431
|
+
V(d);
|
|
432
|
+
} catch (d) {
|
|
433
|
+
B.error(d);
|
|
434
|
+
}
|
|
435
|
+
} : d.prototype._next, K._error = U ? function(d) {
|
|
436
|
+
try {
|
|
437
|
+
U(d);
|
|
438
|
+
} catch (d) {
|
|
439
|
+
B.error(d);
|
|
440
|
+
} finally {
|
|
441
|
+
this.unsubscribe();
|
|
442
|
+
}
|
|
443
|
+
} : d.prototype._error, K._complete = H ? function() {
|
|
444
|
+
try {
|
|
445
|
+
H();
|
|
446
|
+
} catch (d) {
|
|
447
|
+
B.error(d);
|
|
448
|
+
} finally {
|
|
449
|
+
this.unsubscribe();
|
|
450
|
+
}
|
|
451
|
+
} : d.prototype._complete, K;
|
|
452
|
+
}
|
|
453
|
+
return B.prototype.unsubscribe = function() {
|
|
454
|
+
var B;
|
|
455
|
+
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
456
|
+
var V = this.closed;
|
|
457
|
+
d.prototype.unsubscribe.call(this), !V && ((B = this.onFinalize) == null || B.call(this));
|
|
458
|
+
}
|
|
459
|
+
}, B;
|
|
460
|
+
}(Subscriber), ObjectUnsubscribedError = createErrorClass(function(d) {
|
|
461
|
+
return function() {
|
|
462
|
+
d(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
463
|
+
};
|
|
464
|
+
});
|
|
465
|
+
init_tslib_es6();
|
|
466
|
+
var Subject = function(d) {
|
|
467
|
+
__extends(B, d);
|
|
468
|
+
function B() {
|
|
469
|
+
var B = d.call(this) || this;
|
|
470
|
+
return B.closed = !1, B.currentObservers = null, B.observers = [], B.isStopped = !1, B.hasError = !1, B.thrownError = null, B;
|
|
471
|
+
}
|
|
472
|
+
return B.prototype.lift = function(d) {
|
|
473
|
+
var B = new AnonymousSubject(this, this);
|
|
474
|
+
return B.operator = d, B;
|
|
475
|
+
}, B.prototype._throwIfClosed = function() {
|
|
476
|
+
if (this.closed) throw new ObjectUnsubscribedError();
|
|
477
|
+
}, B.prototype.next = function(d) {
|
|
478
|
+
var B = this;
|
|
479
|
+
errorContext(function() {
|
|
480
|
+
var V, H;
|
|
481
|
+
if (B._throwIfClosed(), !B.isStopped) {
|
|
482
|
+
B.currentObservers ||= Array.from(B.observers);
|
|
483
|
+
try {
|
|
484
|
+
for (var U = __values(B.currentObservers), W = U.next(); !W.done; W = U.next()) W.value.next(d);
|
|
485
|
+
} catch (d) {
|
|
486
|
+
V = { error: d };
|
|
487
|
+
} finally {
|
|
488
|
+
try {
|
|
489
|
+
W && !W.done && (H = U.return) && H.call(U);
|
|
490
|
+
} finally {
|
|
491
|
+
if (V) throw V.error;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
}, B.prototype.error = function(d) {
|
|
497
|
+
var B = this;
|
|
498
|
+
errorContext(function() {
|
|
499
|
+
if (B._throwIfClosed(), !B.isStopped) {
|
|
500
|
+
B.hasError = B.isStopped = !0, B.thrownError = d;
|
|
501
|
+
for (var V = B.observers; V.length;) V.shift().error(d);
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
}, B.prototype.complete = function() {
|
|
505
|
+
var d = this;
|
|
506
|
+
errorContext(function() {
|
|
507
|
+
if (d._throwIfClosed(), !d.isStopped) {
|
|
508
|
+
d.isStopped = !0;
|
|
509
|
+
for (var B = d.observers; B.length;) B.shift().complete();
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
}, B.prototype.unsubscribe = function() {
|
|
513
|
+
this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
|
|
514
|
+
}, Object.defineProperty(B.prototype, "observed", {
|
|
515
|
+
get: function() {
|
|
516
|
+
return this.observers?.length > 0;
|
|
517
|
+
},
|
|
518
|
+
enumerable: !1,
|
|
519
|
+
configurable: !0
|
|
520
|
+
}), B.prototype._trySubscribe = function(B) {
|
|
521
|
+
return this._throwIfClosed(), d.prototype._trySubscribe.call(this, B);
|
|
522
|
+
}, B.prototype._subscribe = function(d) {
|
|
523
|
+
return this._throwIfClosed(), this._checkFinalizedStatuses(d), this._innerSubscribe(d);
|
|
524
|
+
}, B.prototype._innerSubscribe = function(d) {
|
|
525
|
+
var B = this, V = this, H = V.hasError, U = V.isStopped, W = V.observers;
|
|
526
|
+
return H || U ? EMPTY_SUBSCRIPTION : (this.currentObservers = null, W.push(d), new Subscription(function() {
|
|
527
|
+
B.currentObservers = null, arrRemove(W, d);
|
|
528
|
+
}));
|
|
529
|
+
}, B.prototype._checkFinalizedStatuses = function(d) {
|
|
530
|
+
var B = this, V = B.hasError, H = B.thrownError, U = B.isStopped;
|
|
531
|
+
V ? d.error(H) : U && d.complete();
|
|
532
|
+
}, B.prototype.asObservable = function() {
|
|
533
|
+
var d = new Observable();
|
|
534
|
+
return d.source = this, d;
|
|
535
|
+
}, B.create = function(d, B) {
|
|
536
|
+
return new AnonymousSubject(d, B);
|
|
537
|
+
}, B;
|
|
538
|
+
}(Observable), AnonymousSubject = function(d) {
|
|
539
|
+
__extends(B, d);
|
|
540
|
+
function B(B, V) {
|
|
541
|
+
var H = d.call(this) || this;
|
|
542
|
+
return H.destination = B, H.source = V, H;
|
|
543
|
+
}
|
|
544
|
+
return B.prototype.next = function(d) {
|
|
545
|
+
var B, V;
|
|
546
|
+
(V = (B = this.destination)?.next) == null || V.call(B, d);
|
|
547
|
+
}, B.prototype.error = function(d) {
|
|
548
|
+
var B, V;
|
|
549
|
+
(V = (B = this.destination)?.error) == null || V.call(B, d);
|
|
550
|
+
}, B.prototype.complete = function() {
|
|
551
|
+
var d, B;
|
|
552
|
+
(B = (d = this.destination)?.complete) == null || B.call(d);
|
|
553
|
+
}, B.prototype._subscribe = function(d) {
|
|
554
|
+
return this.source?.subscribe(d) ?? EMPTY_SUBSCRIPTION;
|
|
555
|
+
}, B;
|
|
556
|
+
}(Subject);
|
|
557
|
+
init_tslib_es6();
|
|
558
|
+
var BehaviorSubject = function(d) {
|
|
559
|
+
__extends(B, d);
|
|
560
|
+
function B(B) {
|
|
561
|
+
var V = d.call(this) || this;
|
|
562
|
+
return V._value = B, V;
|
|
563
|
+
}
|
|
564
|
+
return Object.defineProperty(B.prototype, "value", {
|
|
565
|
+
get: function() {
|
|
566
|
+
return this.getValue();
|
|
567
|
+
},
|
|
568
|
+
enumerable: !1,
|
|
569
|
+
configurable: !0
|
|
570
|
+
}), B.prototype._subscribe = function(B) {
|
|
571
|
+
var V = d.prototype._subscribe.call(this, B);
|
|
572
|
+
return !V.closed && B.next(this._value), V;
|
|
573
|
+
}, B.prototype.getValue = function() {
|
|
574
|
+
var d = this, B = d.hasError, V = d.thrownError, H = d._value;
|
|
575
|
+
if (B) throw V;
|
|
576
|
+
return this._throwIfClosed(), H;
|
|
577
|
+
}, B.prototype.next = function(B) {
|
|
578
|
+
d.prototype.next.call(this, this._value = B);
|
|
579
|
+
}, B;
|
|
580
|
+
}(Subject);
|
|
581
|
+
function map(d, B) {
|
|
582
|
+
return operate(function(V, H) {
|
|
583
|
+
var U = 0;
|
|
584
|
+
V.subscribe(createOperatorSubscriber(H, function(V) {
|
|
585
|
+
H.next(d.call(B, V, U++));
|
|
586
|
+
}));
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
let QuerySuggestionTypes = /* @__PURE__ */ function(d) {
|
|
590
|
+
return d.Field = "field", d.Value = "value", d.Operator = "operator", d.Conjunction = "conjunction", d.RecentSearch = "recentSearch", d;
|
|
591
|
+
}({});
|
|
592
|
+
var import_lodash$30 = require_lodash();
|
|
593
|
+
function resolver(d, B, V, H) {
|
|
594
|
+
return [
|
|
595
|
+
Math.floor(Date.now() / 1e3 / 60),
|
|
596
|
+
V,
|
|
597
|
+
d,
|
|
598
|
+
B.name,
|
|
599
|
+
JSON.stringify(H)
|
|
600
|
+
].join("|");
|
|
601
|
+
}
|
|
602
|
+
const getEmptyValueSuggestions = (() => Promise.resolve([])), setupValueSuggestionProvider = (d) => {
|
|
603
|
+
let B = (0, import_lodash$30.memoize)((B, V, H, U = [], W) => {
|
|
604
|
+
let { onSuggestions: G } = d;
|
|
605
|
+
return G(B, {
|
|
606
|
+
size: 0,
|
|
607
|
+
query: { bool: { filter: U } },
|
|
608
|
+
aggs: { suggestions: { terms: {
|
|
609
|
+
field: V.name,
|
|
610
|
+
include: H + ".*",
|
|
611
|
+
execution_hint: "map",
|
|
612
|
+
shard_size: 10
|
|
613
|
+
} } }
|
|
614
|
+
}).then((d) => {
|
|
615
|
+
let B = [], V = d?.aggregations?.suggestions;
|
|
616
|
+
return V?.buckets && Array.isArray(V.buckets) && V.buckets.forEach((d) => {
|
|
617
|
+
B.push(d.key);
|
|
618
|
+
}), B;
|
|
619
|
+
});
|
|
620
|
+
}, resolver);
|
|
621
|
+
return async ({ indexPattern: d, field: V, query: H, boolFilter: U, signal: W }) => {
|
|
622
|
+
let { title: G } = d;
|
|
623
|
+
return V.type === "boolean" ? [!0, !1] : !V.aggregatable || V.type !== "string" ? [] : await B(G, V, H, U, W);
|
|
624
|
+
};
|
|
625
|
+
};
|
|
626
|
+
var import_lodash$29 = require_lodash();
|
|
627
|
+
function escapeQuotes(d) {
|
|
628
|
+
return d.replace(/[\\"]/g, "\\$&");
|
|
629
|
+
}
|
|
630
|
+
const escapeKuery = (0, import_lodash$29.flow)(escapeSpecialCharacters, escapeAndOr, escapeNot, escapeWhitespace);
|
|
631
|
+
function escapeSpecialCharacters(d) {
|
|
632
|
+
return d.replace(/[\\():<>"*]/g, "\\$&");
|
|
633
|
+
}
|
|
634
|
+
function escapeAndOr(d) {
|
|
635
|
+
return d.replace(/(\s+)(and|or)(\s+)/gi, "$1\\$2$3");
|
|
636
|
+
}
|
|
637
|
+
function escapeNot(d) {
|
|
638
|
+
return d.replace(/not(\s+)/gi, "\\$&");
|
|
639
|
+
}
|
|
640
|
+
function escapeWhitespace(d) {
|
|
641
|
+
return d.replace(/\t/g, "\\t").replace(/\r/g, "\\r").replace(/\n/g, "\\n");
|
|
642
|
+
}
|
|
643
|
+
var import_lodash$28 = require_lodash();
|
|
644
|
+
function sortPrefixFirst(d, B, V) {
|
|
645
|
+
if (!B) return d;
|
|
646
|
+
let H = ("" + B).toLowerCase(), U = (0, import_lodash$28.partition)(d, (d) => ("" + (V ? d[V] : d)).toLowerCase().startsWith(H));
|
|
647
|
+
return [...U[0], ...U[1]];
|
|
648
|
+
}
|
|
649
|
+
function getRequestInspectorStats(d) {
|
|
650
|
+
let B = {}, V = d.getField("index");
|
|
651
|
+
return V && (B.indexPattern = {
|
|
652
|
+
label: "Index pattern",
|
|
653
|
+
value: V.title,
|
|
654
|
+
description: "The index pattern that connected to the Elasticsearch indices."
|
|
655
|
+
}, B.indexPatternId = {
|
|
656
|
+
label: "Index pattern ID",
|
|
657
|
+
value: V.id,
|
|
658
|
+
description: "The ID in the .kibana index."
|
|
659
|
+
}), B;
|
|
660
|
+
}
|
|
661
|
+
function getResponseInspectorStats(d, B) {
|
|
662
|
+
let V = B?.history && B.history[B.history.length - 1], H = {};
|
|
663
|
+
return d && d.took && (H.queryTime = {
|
|
664
|
+
label: "Query time",
|
|
665
|
+
value: `${d.took}ms`,
|
|
666
|
+
description: "The time it took to process the query. Does not include the time to send the request or parse it in the browser."
|
|
667
|
+
}), d && d.hits && (H.hitsTotal = {
|
|
668
|
+
label: "Hits (total)",
|
|
669
|
+
value: `${d.hits.total}`,
|
|
670
|
+
description: "The number of documents that match the query."
|
|
671
|
+
}, H.hits = {
|
|
672
|
+
label: "Hits",
|
|
673
|
+
value: `${d.hits.hits.length}`,
|
|
674
|
+
description: "The number of documents returned by the query."
|
|
675
|
+
}), V && (V.ms === 0 || V.ms) && (H.requestTime = {
|
|
676
|
+
label: "Request time",
|
|
677
|
+
value: `${V.ms}ms`,
|
|
678
|
+
description: "The time of the request from the browser to Elasticsearch and back. Does not include the time the requested waited in the queue."
|
|
679
|
+
}), H;
|
|
680
|
+
}
|
|
681
|
+
var import_lodash$27 = require_lodash(), indexPatternsUtils = { isFilterable }, getDescription$1 = (d) => /* @__PURE__ */ jsxs("p", { children: ["Filter results that contain ", /* @__PURE__ */ jsx("span", {
|
|
682
|
+
className: "kbnSuggestionItem__callout",
|
|
683
|
+
children: d.name
|
|
684
|
+
})] }), keywordComparator = (d, B) => {
|
|
685
|
+
let V = ["raw", "keyword"];
|
|
686
|
+
return V.map((B) => `${d.name}.${B}`).includes(B.name) ? 1 : V.map((d) => `${B.name}.${d}`).includes(d.name) ? -1 : d.name.localeCompare(B.name);
|
|
687
|
+
};
|
|
688
|
+
const setupGetFieldSuggestions = (d) => ({ indexPatterns: d }, { start: B, end: V, prefix: H, suffix: U, nestedPath: W = "" }) => {
|
|
689
|
+
let G = (0, import_lodash$27.flatten)(d.map((d) => d.fields.filter(indexPatternsUtils.isFilterable))), K = `${H}${U}`.trim().toLowerCase(), q = sortPrefixFirst(G.filter((d) => (!W || W && d.subType && d.subType.nested && d.subType.nested.path.includes(W)) && d.name.toLowerCase().includes(K)).sort(keywordComparator), K, "name").map((d) => {
|
|
690
|
+
let H = d.subType && d.subType.nested ? d.subType.nested.path.slice(W ? W.length + 1 : 0) : "", U = d.subType && d.subType.nested && H.length > 0 ? `${escapeKuery(H)}:{ ${escapeKuery(d.name.slice(d.subType.nested.path.length + 1))} }` : `${escapeKuery(d.name.slice(W ? W.length + 1 : 0))} `, G = getDescription$1(d), K = d.subType && d.subType.nested && H.length > 0 ? U.length - 2 : U.length;
|
|
691
|
+
return {
|
|
692
|
+
type: QuerySuggestionTypes.Field,
|
|
693
|
+
text: U,
|
|
694
|
+
description: G,
|
|
695
|
+
start: B,
|
|
696
|
+
end: V,
|
|
697
|
+
cursorIndex: K,
|
|
698
|
+
field: d
|
|
699
|
+
};
|
|
700
|
+
});
|
|
701
|
+
return Promise.resolve(q);
|
|
702
|
+
};
|
|
703
|
+
var import_lodash$26 = require_lodash(), wrapAsSuggestions = (d, B, V, H) => (H || []).filter((d) => d.toLowerCase().includes(V.toLowerCase())).map((V) => ({
|
|
704
|
+
type: QuerySuggestionTypes.Value,
|
|
705
|
+
text: `${V} `,
|
|
706
|
+
start: d,
|
|
707
|
+
end: B
|
|
708
|
+
}));
|
|
709
|
+
const setupGetValueSuggestions = (d) => {
|
|
710
|
+
let B = Promise.resolve(d.autocomplete);
|
|
711
|
+
return async ({ indexPatterns: d, boolFilter: V, useTimeRange: H, signal: U }, { start: W, end: G, prefix: K, suffix: q, fieldName: J, nestedPath: Y }) => {
|
|
712
|
+
let X = Y ? `${Y}.${J}` : J, Z = [];
|
|
713
|
+
d.forEach((d) => {
|
|
714
|
+
d.fields.filter((d) => d.name === X).forEach((B) => Z.push([d, B]));
|
|
715
|
+
});
|
|
716
|
+
let Q = `${K}${q}`.trim(), { getValueSuggestions: $ } = await B;
|
|
717
|
+
return (0, import_lodash$26.flatten)(await Promise.all(Z.map(([d, B]) => $({
|
|
718
|
+
indexPattern: d,
|
|
719
|
+
field: B,
|
|
720
|
+
query: Q,
|
|
721
|
+
boolFilter: V,
|
|
722
|
+
useTimeRange: H,
|
|
723
|
+
signal: U
|
|
724
|
+
}).then((d) => {
|
|
725
|
+
let B = d?.map((d) => typeof d == "string" ? `"${escapeQuotes(d)}"` : `${d}`);
|
|
726
|
+
return wrapAsSuggestions(W, G, Q, B);
|
|
727
|
+
}))));
|
|
728
|
+
};
|
|
729
|
+
};
|
|
730
|
+
var import_lodash$25 = require_lodash(), equalsText = "equals", lessThanOrEqualToText = "less than or equal to", greaterThanOrEqualToText = "greater than or equal to", lessThanText = "less than", greaterThanText = "greater than", existsText = "exists", operators = {
|
|
731
|
+
":": {
|
|
732
|
+
description: `${/* @__PURE__ */ jsx("span", {
|
|
733
|
+
className: "kbnSuggestionItem__callout",
|
|
734
|
+
children: equalsText
|
|
735
|
+
})} some value`,
|
|
736
|
+
fieldTypes: [
|
|
737
|
+
"string",
|
|
738
|
+
"number",
|
|
739
|
+
"number_range",
|
|
740
|
+
"date",
|
|
741
|
+
"date_range",
|
|
742
|
+
"ip",
|
|
743
|
+
"ip_range",
|
|
744
|
+
"geo_point",
|
|
745
|
+
"geo_shape",
|
|
746
|
+
"boolean"
|
|
747
|
+
]
|
|
748
|
+
},
|
|
749
|
+
"<=": {
|
|
750
|
+
description: `is ${/* @__PURE__ */ jsx("span", {
|
|
751
|
+
className: "kbnSuggestionItem__callout",
|
|
752
|
+
children: lessThanOrEqualToText
|
|
753
|
+
})} some value`,
|
|
754
|
+
fieldTypes: [
|
|
755
|
+
"number",
|
|
756
|
+
"number_range",
|
|
757
|
+
"date",
|
|
758
|
+
"date_range",
|
|
759
|
+
"ip",
|
|
760
|
+
"ip_range"
|
|
761
|
+
]
|
|
762
|
+
},
|
|
763
|
+
">=": {
|
|
764
|
+
description: `is ${/* @__PURE__ */ jsx("span", {
|
|
765
|
+
className: "kbnSuggestionItem__callout",
|
|
766
|
+
children: greaterThanOrEqualToText
|
|
767
|
+
})} some value`,
|
|
768
|
+
fieldTypes: [
|
|
769
|
+
"number",
|
|
770
|
+
"number_range",
|
|
771
|
+
"date",
|
|
772
|
+
"date_range",
|
|
773
|
+
"ip",
|
|
774
|
+
"ip_range"
|
|
775
|
+
]
|
|
776
|
+
},
|
|
777
|
+
"<": {
|
|
778
|
+
description: `is ${/* @__PURE__ */ jsx("span", {
|
|
779
|
+
className: "kbnSuggestionItem__callout",
|
|
780
|
+
children: lessThanText
|
|
781
|
+
})} some value`,
|
|
782
|
+
fieldTypes: [
|
|
783
|
+
"number",
|
|
784
|
+
"number_range",
|
|
785
|
+
"date",
|
|
786
|
+
"date_range",
|
|
787
|
+
"ip",
|
|
788
|
+
"ip_range"
|
|
789
|
+
]
|
|
790
|
+
},
|
|
791
|
+
">": {
|
|
792
|
+
description: `is ${/* @__PURE__ */ jsx("span", {
|
|
793
|
+
className: "kbnSuggestionItem__callout",
|
|
794
|
+
children: greaterThanText
|
|
795
|
+
})} some value`,
|
|
796
|
+
fieldTypes: [
|
|
797
|
+
"number",
|
|
798
|
+
"number_range",
|
|
799
|
+
"date",
|
|
800
|
+
"date_range",
|
|
801
|
+
"ip",
|
|
802
|
+
"ip_range"
|
|
803
|
+
]
|
|
804
|
+
},
|
|
805
|
+
": *": {
|
|
806
|
+
description: `${/* @__PURE__ */ jsx("span", {
|
|
807
|
+
className: "kbnSuggestionItem__callout",
|
|
808
|
+
children: existsText
|
|
809
|
+
})} in any form`,
|
|
810
|
+
fieldTypes: void 0
|
|
811
|
+
}
|
|
812
|
+
}, getOperatorByName = (d) => operators[d], getDescription = (d) => /* @__PURE__ */ jsx("p", { children: getOperatorByName(d).description });
|
|
813
|
+
const setupGetOperatorSuggestions = () => ({ indexPatterns: d }, { end: B, fieldName: V, nestedPath: H }) => {
|
|
814
|
+
let U = (0, import_lodash$25.flatten)(d.map((d) => d.fields.slice())), W = H ? `${H}.${V}` : V, G = U.filter((d) => d.name === W).map((d) => Object.keys(operators).filter((B) => {
|
|
815
|
+
let { fieldTypes: V } = getOperatorByName(B);
|
|
816
|
+
return !V || V.includes(d.type);
|
|
817
|
+
}).map((d) => ({
|
|
818
|
+
type: QuerySuggestionTypes.Operator,
|
|
819
|
+
text: d + " ",
|
|
820
|
+
description: getDescription(d),
|
|
821
|
+
start: B,
|
|
822
|
+
end: B
|
|
823
|
+
})));
|
|
824
|
+
return Promise.resolve((0, import_lodash$25.flatten)(G));
|
|
825
|
+
};
|
|
826
|
+
var conjunctions = {
|
|
827
|
+
and: /* @__PURE__ */ jsxs("p", { children: [
|
|
828
|
+
"Requires ",
|
|
829
|
+
/* @__PURE__ */ jsx("span", {
|
|
830
|
+
className: "kbnSuggestionItem__callout",
|
|
831
|
+
children: "both arguments"
|
|
832
|
+
}),
|
|
833
|
+
" to be true"
|
|
834
|
+
] }),
|
|
835
|
+
or: /* @__PURE__ */ jsxs("p", { children: [
|
|
836
|
+
"Requires ",
|
|
837
|
+
/* @__PURE__ */ jsx("span", {
|
|
838
|
+
className: "kbnSuggestionItem__callout",
|
|
839
|
+
children: "one or more arguments"
|
|
840
|
+
}),
|
|
841
|
+
" to be true"
|
|
842
|
+
] })
|
|
843
|
+
};
|
|
844
|
+
const setupGetConjunctionSuggestions = (d) => (d, { text: B, end: V }) => {
|
|
845
|
+
let H = [];
|
|
846
|
+
return B.endsWith(" ") && (H = Object.keys(conjunctions).map((d) => ({
|
|
847
|
+
type: QuerySuggestionTypes.Conjunction,
|
|
848
|
+
text: `${d} `,
|
|
849
|
+
description: conjunctions[d],
|
|
850
|
+
start: V,
|
|
851
|
+
end: V
|
|
852
|
+
}))), Promise.resolve(H);
|
|
853
|
+
};
|
|
854
|
+
var import_lodash$24 = require_lodash(), esKuery = {
|
|
855
|
+
nodeTypes,
|
|
856
|
+
fromKueryExpression,
|
|
857
|
+
toElasticsearchQuery
|
|
858
|
+
}, cursorSymbol = "@kuery-cursor@", dedup = (d) => (0, import_lodash$24.uniqBy)(d, ({ type: d, text: B, start: V, end: H }) => [
|
|
859
|
+
d,
|
|
860
|
+
B,
|
|
861
|
+
V,
|
|
862
|
+
H
|
|
863
|
+
].join("|"));
|
|
864
|
+
const setupKqlQuerySuggestionProvider = (d) => {
|
|
865
|
+
let B = {
|
|
866
|
+
field: setupGetFieldSuggestions(d),
|
|
867
|
+
value: setupGetValueSuggestions(d),
|
|
868
|
+
operator: setupGetOperatorSuggestions(d),
|
|
869
|
+
conjunction: setupGetConjunctionSuggestions(d)
|
|
870
|
+
}, V = (d, V) => {
|
|
871
|
+
try {
|
|
872
|
+
let H = esKuery.fromKueryExpression(d, {
|
|
873
|
+
cursorSymbol,
|
|
874
|
+
parseCursor: !0
|
|
875
|
+
});
|
|
876
|
+
return H.suggestionTypes.map((d) => B[d](V, H));
|
|
877
|
+
} catch {
|
|
878
|
+
return [];
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
return (d) => {
|
|
882
|
+
let { query: B, selectionStart: H, selectionEnd: U } = d, W = `${B.substr(0, H)}${cursorSymbol}${B.substr(U)}`;
|
|
883
|
+
return Promise.all(V(W, d)).then((d) => dedup((0, import_lodash$24.flatten)(d)));
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
var AutocompleteService = class {
|
|
887
|
+
autocompleteConfig;
|
|
888
|
+
constructor(d) {
|
|
889
|
+
this.autocompleteConfig = d;
|
|
890
|
+
}
|
|
891
|
+
querySuggestionProviders = /* @__PURE__ */ new Map();
|
|
892
|
+
getValueSuggestions;
|
|
893
|
+
addQuerySuggestionProvider = (d, B) => {
|
|
894
|
+
d && B && this.autocompleteConfig.querySuggestions.enabled && this.querySuggestionProviders.set(d, B);
|
|
895
|
+
};
|
|
896
|
+
getQuerySuggestions = (d) => {
|
|
897
|
+
let { language: B } = d, V = this.querySuggestionProviders.get(B);
|
|
898
|
+
if (V) return V(d);
|
|
899
|
+
};
|
|
900
|
+
hasQuerySuggestions = (d) => this.querySuggestionProviders.has(d);
|
|
901
|
+
setup(d) {
|
|
902
|
+
return this.getValueSuggestions = this.autocompleteConfig.valueSuggestions.enabled && d.onSuggestions ? setupValueSuggestionProvider(d) : getEmptyValueSuggestions, this.autocompleteConfig.querySuggestions.enabled && this.querySuggestionProviders.set("kuery", setupKqlQuerySuggestionProvider(d)), {
|
|
903
|
+
addQuerySuggestionProvider: this.addQuerySuggestionProvider,
|
|
904
|
+
getQuerySuggestions: this.getQuerySuggestions
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
start() {
|
|
908
|
+
return {
|
|
909
|
+
getQuerySuggestions: this.getQuerySuggestions,
|
|
910
|
+
hasQuerySuggestions: this.hasQuerySuggestions,
|
|
911
|
+
getValueSuggestions: this.getValueSuggestions
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
clearProviders() {
|
|
915
|
+
this.querySuggestionProviders.clear();
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
const sortFilters = ({ $state: d }, { $state: B }) => d.store === B.store ? 0 : d.store === FilterStateStore.GLOBAL_STATE && B.store !== FilterStateStore.GLOBAL_STATE ? -1 : 1, mapSpatialFilter = (d) => {
|
|
919
|
+
if (d.meta && d.meta.key && d.meta.alias && d.meta.type === FILTERS.SPATIAL_FILTER) return {
|
|
920
|
+
key: d.meta.key,
|
|
921
|
+
type: d.meta.type,
|
|
922
|
+
value: ""
|
|
923
|
+
};
|
|
924
|
+
throw d;
|
|
925
|
+
}, mapMatchAll = (d) => {
|
|
926
|
+
if (isMatchAllFilter(d)) return {
|
|
927
|
+
type: FILTERS.MATCH_ALL,
|
|
928
|
+
key: d.meta.field,
|
|
929
|
+
value: d.meta.formattedValue || "all"
|
|
930
|
+
};
|
|
931
|
+
throw d;
|
|
932
|
+
};
|
|
933
|
+
var import_lodash$23 = require_lodash(), getScriptedPhraseValue = (d) => (0, import_lodash$23.get)(d, [
|
|
934
|
+
"script",
|
|
935
|
+
"script",
|
|
936
|
+
"params",
|
|
937
|
+
"value"
|
|
938
|
+
]), getFormattedValueFn$3 = (d) => (B) => B ? B.convert(d) : d, getParams$3 = (d) => {
|
|
939
|
+
let B = getScriptedPhraseValue(d), V = B ? d.meta.field || "" : getPhraseFilterField(d), H = B || getPhraseFilterValue(d);
|
|
940
|
+
return {
|
|
941
|
+
key: V,
|
|
942
|
+
params: { query: H },
|
|
943
|
+
type: FILTERS.PHRASE,
|
|
944
|
+
value: getFormattedValueFn$3(H)
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
const isMapPhraseFilter = (d) => isPhraseFilter(d) || isScriptedPhraseFilter(d), mapPhrase = (d) => {
|
|
948
|
+
if (!isMapPhraseFilter(d)) throw d;
|
|
949
|
+
return getParams$3(d);
|
|
950
|
+
}, mapPhrases = (d) => {
|
|
951
|
+
if (!isPhrasesFilter(d)) throw d;
|
|
952
|
+
let { type: B, key: V, value: H, params: U } = d.meta;
|
|
953
|
+
return {
|
|
954
|
+
type: B,
|
|
955
|
+
key: V,
|
|
956
|
+
value: H,
|
|
957
|
+
params: U
|
|
958
|
+
};
|
|
959
|
+
};
|
|
960
|
+
var import_lodash$22 = require_lodash(), getFormattedValueFn$2 = (d, B) => (V) => {
|
|
961
|
+
let H = `${d} to ${B}`;
|
|
962
|
+
if (V) {
|
|
963
|
+
let U = V.getConverterFor("text");
|
|
964
|
+
H = `${U(d)} to ${U(B)}`;
|
|
965
|
+
}
|
|
966
|
+
return H;
|
|
967
|
+
}, getFirstRangeKey = (d) => d.range && Object.keys(d.range)[0], getRangeByKey = (d, B) => (0, import_lodash$22.get)(d, ["range", B]);
|
|
968
|
+
function getParams$2(d) {
|
|
969
|
+
let B = isScriptedRangeFilter(d), V = (B ? d.meta.field : getFirstRangeKey(d)) || "", H = B ? (0, import_lodash$22.get)(d, "script.script.params") : getRangeByKey(d, V), U = (0, import_lodash$22.hasIn)(H, "gte") ? H.gte : H.gt;
|
|
970
|
+
U ??= -Infinity;
|
|
971
|
+
let W = (0, import_lodash$22.hasIn)(H, "lte") ? H.lte : H.lt;
|
|
972
|
+
W ??= Infinity;
|
|
973
|
+
let G = getFormattedValueFn$2(U, W);
|
|
974
|
+
return {
|
|
975
|
+
type: FILTERS.RANGE,
|
|
976
|
+
key: V,
|
|
977
|
+
value: G,
|
|
978
|
+
params: H
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
const isMapRangeFilter = (d) => isRangeFilter(d) || isScriptedRangeFilter(d), mapRange = (d) => {
|
|
982
|
+
if (!isMapRangeFilter(d)) throw d;
|
|
983
|
+
return getParams$2(d);
|
|
984
|
+
};
|
|
985
|
+
var import_lodash$21 = require_lodash();
|
|
986
|
+
const mapExists = (d) => {
|
|
987
|
+
if (isExistsFilter(d)) return {
|
|
988
|
+
type: FILTERS.EXISTS,
|
|
989
|
+
value: FILTERS.EXISTS,
|
|
990
|
+
key: (0, import_lodash$21.get)(d, "exists.field")
|
|
991
|
+
};
|
|
992
|
+
throw d;
|
|
993
|
+
}, mapMissing = (d) => {
|
|
994
|
+
if (isMissingFilter(d)) return {
|
|
995
|
+
type: FILTERS.MISSING,
|
|
996
|
+
value: FILTERS.MISSING,
|
|
997
|
+
key: d.missing.field
|
|
998
|
+
};
|
|
999
|
+
throw d;
|
|
1000
|
+
}, mapQueryString = (d) => {
|
|
1001
|
+
if (isQueryStringFilter(d)) return {
|
|
1002
|
+
type: FILTERS.QUERY_STRING,
|
|
1003
|
+
key: "query",
|
|
1004
|
+
value: d.query.query_string.query
|
|
1005
|
+
};
|
|
1006
|
+
throw d;
|
|
1007
|
+
};
|
|
1008
|
+
var getFormattedValueFn$1 = (d) => (B) => {
|
|
1009
|
+
let V = B ? {
|
|
1010
|
+
topLeft: B.convert(d.top_left),
|
|
1011
|
+
bottomRight: B.convert(d.bottom_right)
|
|
1012
|
+
} : {
|
|
1013
|
+
topLeft: JSON.stringify(d.top_left),
|
|
1014
|
+
bottomRight: JSON.stringify(d.bottom_right)
|
|
1015
|
+
};
|
|
1016
|
+
return V.topLeft + " to " + V.bottomRight;
|
|
1017
|
+
}, getParams$1 = (d) => {
|
|
1018
|
+
let B = Object.keys(d.geo_bounding_box).filter((d) => d !== "ignore_unmapped")[0], V = d.geo_bounding_box[B];
|
|
1019
|
+
return {
|
|
1020
|
+
key: B,
|
|
1021
|
+
params: V,
|
|
1022
|
+
type: FILTERS.GEO_BOUNDING_BOX,
|
|
1023
|
+
value: getFormattedValueFn$1(V)
|
|
1024
|
+
};
|
|
1025
|
+
};
|
|
1026
|
+
const mapGeoBoundingBox = (d) => {
|
|
1027
|
+
if (!isGeoBoundingBoxFilter(d)) throw d;
|
|
1028
|
+
return getParams$1(d);
|
|
1029
|
+
};
|
|
1030
|
+
var POINTS_SEPARATOR = ", ", getFormattedValueFn = (d) => (B) => d.map((d) => B ? B.convert(d) : JSON.stringify(d)).join(POINTS_SEPARATOR);
|
|
1031
|
+
function getParams(d) {
|
|
1032
|
+
let B = Object.keys(d.geo_polygon).filter((d) => d !== "ignore_unmapped")[0], V = d.geo_polygon[B];
|
|
1033
|
+
return {
|
|
1034
|
+
key: B,
|
|
1035
|
+
params: V,
|
|
1036
|
+
type: FILTERS.GEO_POLYGON,
|
|
1037
|
+
value: getFormattedValueFn(V.points || [])
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
function mapGeoPolygon(d) {
|
|
1041
|
+
if (!isGeoPolygonFilter(d)) throw d;
|
|
1042
|
+
return getParams(d);
|
|
1043
|
+
}
|
|
1044
|
+
var import_lodash$20 = require_lodash();
|
|
1045
|
+
const mapDefault = (d) => {
|
|
1046
|
+
let B = /(^\$|meta)/, V = (0, import_lodash$20.find)((0, import_lodash$20.keys)(d), (d) => !d.match(B));
|
|
1047
|
+
if (V) return {
|
|
1048
|
+
type: FILTERS.CUSTOM,
|
|
1049
|
+
key: V,
|
|
1050
|
+
value: JSON.stringify((0, import_lodash$20.get)(d, V, {}))
|
|
1051
|
+
};
|
|
1052
|
+
throw d;
|
|
1053
|
+
};
|
|
1054
|
+
var noop$2 = () => {
|
|
1055
|
+
throw Error("No mappings have been found for filter.");
|
|
1056
|
+
};
|
|
1057
|
+
const generateMappingChain = (d, B = noop$2) => (V) => {
|
|
1058
|
+
try {
|
|
1059
|
+
return d(V);
|
|
1060
|
+
} catch (d) {
|
|
1061
|
+
if (d === V) return B(V);
|
|
1062
|
+
throw d;
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
var import_lodash$19 = require_lodash();
|
|
1066
|
+
function mapFilter(d) {
|
|
1067
|
+
let B = [
|
|
1068
|
+
mapSpatialFilter,
|
|
1069
|
+
mapMatchAll,
|
|
1070
|
+
mapRange,
|
|
1071
|
+
mapPhrase,
|
|
1072
|
+
mapPhrases,
|
|
1073
|
+
mapExists,
|
|
1074
|
+
mapMissing,
|
|
1075
|
+
mapQueryString,
|
|
1076
|
+
mapGeoBoundingBox,
|
|
1077
|
+
mapGeoPolygon,
|
|
1078
|
+
mapDefault
|
|
1079
|
+
], V = (0, import_lodash$19.reduceRight)(B, (d, B) => generateMappingChain(B, d), () => {
|
|
1080
|
+
throw Error("No mappings have been found for filter.");
|
|
1081
|
+
})(d);
|
|
1082
|
+
return d.meta = d.meta || {}, d.meta.type = V.type, d.meta.key = V.key, d.meta.value = V.value, d.meta.params = V.params, d.meta.disabled = !!d.meta.disabled, d.meta.negate = !!d.meta.negate, d.meta.alias = d.meta.alias || null, d;
|
|
1083
|
+
}
|
|
1084
|
+
var import_lodash$18 = require_lodash();
|
|
1085
|
+
const mapAndFlattenFilters = (d) => (0, import_lodash$18.compact)((0, import_lodash$18.flatten)(d)).map((d) => mapFilter(d));
|
|
1086
|
+
var import_lodash$17 = require_lodash(), isEnabled = (d) => d && d.meta && !d.meta.disabled;
|
|
1087
|
+
const onlyDisabledFiltersChanged = (d, B) => {
|
|
1088
|
+
let V = (0, import_lodash$17.filter)(d || [], isEnabled);
|
|
1089
|
+
return compareFilters((0, import_lodash$17.filter)(B || [], isEnabled), V, COMPARE_ALL_OPTIONS);
|
|
1090
|
+
};
|
|
1091
|
+
var import_lodash$16 = /* @__PURE__ */ __toESM(require_lodash(), 1), FilterManager = class d {
|
|
1092
|
+
filters = [];
|
|
1093
|
+
updated$ = new Subject();
|
|
1094
|
+
fetch$ = new Subject();
|
|
1095
|
+
uiSettings;
|
|
1096
|
+
constructor(d) {
|
|
1097
|
+
this.uiSettings = d;
|
|
1098
|
+
}
|
|
1099
|
+
mergeIncomingFilters(B) {
|
|
1100
|
+
let V = B.globalFilters, H = B.appFilters, U = [];
|
|
1101
|
+
return import_lodash$16.default.each(H, function(d, B) {
|
|
1102
|
+
let H = import_lodash$16.default.find(V, function(B) {
|
|
1103
|
+
return compareFilters(B, d);
|
|
1104
|
+
});
|
|
1105
|
+
if (!H) return U.push(d);
|
|
1106
|
+
import_lodash$16.default.assignIn(H.meta, d.meta);
|
|
1107
|
+
}), d.mergeFilters(U, V);
|
|
1108
|
+
}
|
|
1109
|
+
static mergeFilters(d, B) {
|
|
1110
|
+
return uniqFilters(d.reverse().concat(B.reverse())).reverse();
|
|
1111
|
+
}
|
|
1112
|
+
static partitionFilters(d) {
|
|
1113
|
+
let [B, V] = import_lodash$16.default.partition(d, isFilterPinned);
|
|
1114
|
+
return {
|
|
1115
|
+
globalFilters: B,
|
|
1116
|
+
appFilters: V
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
handleStateUpdate(d) {
|
|
1120
|
+
d.sort(sortFilters);
|
|
1121
|
+
let B = !compareFilters(this.filters, d, COMPARE_ALL_OPTIONS), V = onlyDisabledFiltersChanged(d, this.filters);
|
|
1122
|
+
this.filters = d, B && (this.updated$.next(), V || this.fetch$.next());
|
|
1123
|
+
}
|
|
1124
|
+
getFilters() {
|
|
1125
|
+
return import_lodash$16.default.cloneDeep(this.filters);
|
|
1126
|
+
}
|
|
1127
|
+
getAppFilters() {
|
|
1128
|
+
let { appFilters: d } = this.getPartitionedFilters();
|
|
1129
|
+
return d;
|
|
1130
|
+
}
|
|
1131
|
+
getGlobalFilters() {
|
|
1132
|
+
let { globalFilters: d } = this.getPartitionedFilters();
|
|
1133
|
+
return d;
|
|
1134
|
+
}
|
|
1135
|
+
getPartitionedFilters() {
|
|
1136
|
+
return d.partitionFilters(this.getFilters());
|
|
1137
|
+
}
|
|
1138
|
+
getUpdates$() {
|
|
1139
|
+
return this.updated$.asObservable();
|
|
1140
|
+
}
|
|
1141
|
+
getFetches$() {
|
|
1142
|
+
return this.fetch$.asObservable();
|
|
1143
|
+
}
|
|
1144
|
+
addFilters(B, V = !0) {
|
|
1145
|
+
if (Array.isArray(B) || (B = [B]), B.length === 0) return;
|
|
1146
|
+
let H = V ? FilterStateStore.GLOBAL_STATE : FilterStateStore.APP_STATE;
|
|
1147
|
+
d.setFiltersStore(B, H);
|
|
1148
|
+
let U = mapAndFlattenFilters(B), W = d.partitionFilters(U), G = this.getPartitionedFilters();
|
|
1149
|
+
G.appFilters.push(...W.appFilters), G.globalFilters.push(...W.globalFilters);
|
|
1150
|
+
let K = this.mergeIncomingFilters(G);
|
|
1151
|
+
this.handleStateUpdate(K);
|
|
1152
|
+
}
|
|
1153
|
+
setFilters(B, V = !0) {
|
|
1154
|
+
let H = V ? FilterStateStore.GLOBAL_STATE : FilterStateStore.APP_STATE;
|
|
1155
|
+
d.setFiltersStore(B, H);
|
|
1156
|
+
let U = mapAndFlattenFilters(B), W = d.partitionFilters(U), G = this.mergeIncomingFilters(W);
|
|
1157
|
+
this.handleStateUpdate(G);
|
|
1158
|
+
}
|
|
1159
|
+
setGlobalFilters(B) {
|
|
1160
|
+
B = mapAndFlattenFilters(B), d.setFiltersStore(B, FilterStateStore.GLOBAL_STATE, !0);
|
|
1161
|
+
let { appFilters: V } = this.getPartitionedFilters(), H = this.mergeIncomingFilters({
|
|
1162
|
+
appFilters: V,
|
|
1163
|
+
globalFilters: B
|
|
1164
|
+
});
|
|
1165
|
+
this.handleStateUpdate(H);
|
|
1166
|
+
}
|
|
1167
|
+
setAppFilters(B) {
|
|
1168
|
+
B = mapAndFlattenFilters(B), d.setFiltersStore(B, FilterStateStore.APP_STATE, !0);
|
|
1169
|
+
let { globalFilters: V } = this.getPartitionedFilters(), H = this.mergeIncomingFilters({
|
|
1170
|
+
globalFilters: V,
|
|
1171
|
+
appFilters: B
|
|
1172
|
+
});
|
|
1173
|
+
this.handleStateUpdate(H);
|
|
1174
|
+
}
|
|
1175
|
+
removeFilter(d) {
|
|
1176
|
+
let B = import_lodash$16.default.findIndex(this.filters, (B) => import_lodash$16.default.isEqual(B.meta, d.meta) && import_lodash$16.default.isEqual(B.query, d.query));
|
|
1177
|
+
if (B >= 0) {
|
|
1178
|
+
let d = import_lodash$16.default.cloneDeep(this.filters);
|
|
1179
|
+
d.splice(B, 1), this.handleStateUpdate(d);
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
removeAll() {
|
|
1183
|
+
this.setFilters([]);
|
|
1184
|
+
}
|
|
1185
|
+
static setFiltersStore(d, B, V = !1) {
|
|
1186
|
+
import_lodash$16.default.map(d, (d) => {
|
|
1187
|
+
(V || d.$state === void 0) && (d.$state = { store: B });
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
}, import_lodash$15 = /* @__PURE__ */ __toESM(require_lodash(), 1), valueOf = function(d) {
|
|
1191
|
+
if (d) return d.valueOf();
|
|
1192
|
+
};
|
|
1193
|
+
function areRefreshIntervalsDifferent(d, B) {
|
|
1194
|
+
if (import_lodash$15.default.isObject(d) && import_lodash$15.default.isObject(B)) {
|
|
1195
|
+
if (valueOf(d.value) !== valueOf(B.value) || valueOf(d.pause) !== valueOf(B.pause)) return !0;
|
|
1196
|
+
} else return !import_lodash$15.default.isEqual(d, B);
|
|
1197
|
+
return !1;
|
|
1198
|
+
}
|
|
1199
|
+
function areTimeRangesDifferent(d, B) {
|
|
1200
|
+
if (d && B && import_lodash$15.default.isObject(d) && import_lodash$15.default.isObject(B)) {
|
|
1201
|
+
if (valueOf(d.to) !== valueOf(B.to) || valueOf(d.from) !== valueOf(B.from)) return !0;
|
|
1202
|
+
} else return !import_lodash$15.default.isEqual(d, B);
|
|
1203
|
+
return !1;
|
|
1204
|
+
}
|
|
1205
|
+
var import_query_string = require_query_string();
|
|
1206
|
+
function parseQueryString() {
|
|
1207
|
+
let d = window.location.href.split("?");
|
|
1208
|
+
return d.length <= 1 ? {} : (0, import_query_string.parse)(d[1], { sort: !1 });
|
|
1209
|
+
}
|
|
1210
|
+
function getForceNow() {
|
|
1211
|
+
let d = parseQueryString().forceNow;
|
|
1212
|
+
if (!d) return;
|
|
1213
|
+
let B = Date.parse(d);
|
|
1214
|
+
if (isNaN(B)) throw Error(`forceNow query parameter, ${d}, can't be parsed by Date.parse`);
|
|
1215
|
+
return new Date(B);
|
|
1216
|
+
}
|
|
1217
|
+
var import_lodash$14 = /* @__PURE__ */ __toESM(require_lodash(), 1);
|
|
1218
|
+
init_moment();
|
|
1219
|
+
var Timefilter = class {
|
|
1220
|
+
enabledUpdated$ = new BehaviorSubject(!1);
|
|
1221
|
+
timeUpdate$ = new Subject();
|
|
1222
|
+
refreshIntervalUpdate$ = new Subject();
|
|
1223
|
+
autoRefreshFetch$ = new Subject();
|
|
1224
|
+
fetch$ = new Subject();
|
|
1225
|
+
_time;
|
|
1226
|
+
_refreshInterval;
|
|
1227
|
+
_history;
|
|
1228
|
+
_isTimeRangeSelectorEnabled = !1;
|
|
1229
|
+
_isAutoRefreshSelectorEnabled = !1;
|
|
1230
|
+
_autoRefreshIntervalId = 0;
|
|
1231
|
+
timeDefaults;
|
|
1232
|
+
refreshIntervalDefaults;
|
|
1233
|
+
constructor(d, B) {
|
|
1234
|
+
this._history = B, this.timeDefaults = d.timeDefaults, this.refreshIntervalDefaults = d.refreshIntervalDefaults, this._time = d.timeDefaults, this.setRefreshInterval(d.refreshIntervalDefaults);
|
|
1235
|
+
}
|
|
1236
|
+
isTimeRangeSelectorEnabled() {
|
|
1237
|
+
return this._isTimeRangeSelectorEnabled;
|
|
1238
|
+
}
|
|
1239
|
+
isAutoRefreshSelectorEnabled() {
|
|
1240
|
+
return this._isAutoRefreshSelectorEnabled;
|
|
1241
|
+
}
|
|
1242
|
+
getEnabledUpdated$ = () => this.enabledUpdated$.asObservable();
|
|
1243
|
+
getTimeUpdate$ = () => this.timeUpdate$.asObservable();
|
|
1244
|
+
getRefreshIntervalUpdate$ = () => this.refreshIntervalUpdate$.asObservable();
|
|
1245
|
+
getAutoRefreshFetch$ = () => this.autoRefreshFetch$.asObservable();
|
|
1246
|
+
getFetch$ = () => this.fetch$.asObservable();
|
|
1247
|
+
getTime = () => {
|
|
1248
|
+
let { from: d, to: B } = this._time;
|
|
1249
|
+
return {
|
|
1250
|
+
...this._time,
|
|
1251
|
+
from: moment_default.isMoment(d) ? d.toISOString() : d,
|
|
1252
|
+
to: moment_default.isMoment(B) ? B.toISOString() : B
|
|
1253
|
+
};
|
|
1254
|
+
};
|
|
1255
|
+
setTime = (d) => {
|
|
1256
|
+
let B = Object.assign(this.getTime(), d);
|
|
1257
|
+
areTimeRangesDifferent(this.getTime(), B) && (this._time = {
|
|
1258
|
+
from: B.from,
|
|
1259
|
+
to: B.to
|
|
1260
|
+
}, this._history?.add?.(this._time), this.timeUpdate$.next(), this.fetch$.next());
|
|
1261
|
+
};
|
|
1262
|
+
getRefreshInterval = () => import_lodash$14.default.clone(this._refreshInterval);
|
|
1263
|
+
setRefreshInterval = (d) => {
|
|
1264
|
+
let B = this.getRefreshInterval(), V = {
|
|
1265
|
+
...B,
|
|
1266
|
+
...d
|
|
1267
|
+
};
|
|
1268
|
+
V.value <= 0 && (V.value = 0, V.pause = !0), this._refreshInterval = {
|
|
1269
|
+
value: V.value,
|
|
1270
|
+
pause: V.pause
|
|
1271
|
+
}, B && areRefreshIntervalsDifferent(B, V) && (this.refreshIntervalUpdate$.next(), !V.pause && V.value !== 0 && this.fetch$.next()), clearInterval(this._autoRefreshIntervalId), V.pause || (this._autoRefreshIntervalId = window.setInterval(() => this.autoRefreshFetch$.next(), V.value));
|
|
1272
|
+
};
|
|
1273
|
+
createFilter = (d, B) => getTime(d, B || this._time, { forceNow: this.getForceNow() });
|
|
1274
|
+
getBounds() {
|
|
1275
|
+
return this.calculateBounds(this._time);
|
|
1276
|
+
}
|
|
1277
|
+
calculateBounds(d) {
|
|
1278
|
+
return typeof calculateBounds != "function" && console.log(typeof calculateBounds, calculateBounds), calculateBounds(d, { forceNow: this.getForceNow() });
|
|
1279
|
+
}
|
|
1280
|
+
getActiveBounds() {
|
|
1281
|
+
if (this.isTimeRangeSelectorEnabled()) return this.getBounds();
|
|
1282
|
+
}
|
|
1283
|
+
enableTimeRangeSelector = () => {
|
|
1284
|
+
this._isTimeRangeSelectorEnabled = !0, this.enabledUpdated$.next(!0);
|
|
1285
|
+
};
|
|
1286
|
+
disableTimeRangeSelector = () => {
|
|
1287
|
+
this._isTimeRangeSelectorEnabled = !1, this.enabledUpdated$.next(!1);
|
|
1288
|
+
};
|
|
1289
|
+
enableAutoRefreshSelector = () => {
|
|
1290
|
+
this._isAutoRefreshSelectorEnabled = !0, this.enabledUpdated$.next(!0);
|
|
1291
|
+
};
|
|
1292
|
+
disableAutoRefreshSelector = () => {
|
|
1293
|
+
this._isAutoRefreshSelectorEnabled = !1, this.enabledUpdated$.next(!1);
|
|
1294
|
+
};
|
|
1295
|
+
getTimeDefaults() {
|
|
1296
|
+
return import_lodash$14.default.cloneDeep(this.timeDefaults);
|
|
1297
|
+
}
|
|
1298
|
+
getRefreshIntervalDefaults() {
|
|
1299
|
+
return import_lodash$14.default.cloneDeep(this.refreshIntervalDefaults);
|
|
1300
|
+
}
|
|
1301
|
+
getForceNow = () => getForceNow();
|
|
1302
|
+
}, import_lodash$13 = /* @__PURE__ */ __toESM(require_lodash(), 1), defaultIsDuplicate = (d, B) => import_lodash$13.default.isEqual(d, B), PersistedLog = class {
|
|
1303
|
+
name;
|
|
1304
|
+
maxLength;
|
|
1305
|
+
filterDuplicates;
|
|
1306
|
+
isDuplicate;
|
|
1307
|
+
storage;
|
|
1308
|
+
items;
|
|
1309
|
+
update$ = new BehaviorSubject(void 0);
|
|
1310
|
+
constructor(d, B = {}, V) {
|
|
1311
|
+
this.name = d, this.maxLength = typeof B.maxLength == "string" ? this.maxLength = parseInt(B.maxLength, 10) : B.maxLength, this.filterDuplicates = B.filterDuplicates || !1, this.isDuplicate = B.isDuplicate || defaultIsDuplicate, this.storage = V, this.items = this.storage.get(this.name) || [], this.maxLength !== void 0 && !isNaN(this.maxLength) && (this.items = import_lodash$13.default.take(this.items, this.maxLength));
|
|
1312
|
+
}
|
|
1313
|
+
add(d) {
|
|
1314
|
+
return d == null ? this.items : (this.filterDuplicates && import_lodash$13.default.remove(this.items, (B) => this.isDuplicate(B, d)), this.items.unshift(d), this.maxLength && !isNaN(this.maxLength) && (this.items = import_lodash$13.default.take(this.items, this.maxLength)), this.storage.set(this.name, this.items), this.update$.next(void 0), this.items);
|
|
1315
|
+
}
|
|
1316
|
+
get() {
|
|
1317
|
+
return import_lodash$13.default.cloneDeep(this.items);
|
|
1318
|
+
}
|
|
1319
|
+
get$() {
|
|
1320
|
+
return this.update$.pipe(map(() => this.get()));
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
init_moment();
|
|
1324
|
+
var TimeHistory = class {
|
|
1325
|
+
history;
|
|
1326
|
+
constructor(d) {
|
|
1327
|
+
this.history = new PersistedLog("infini.timepicker.timeHistory", {
|
|
1328
|
+
maxLength: 10,
|
|
1329
|
+
filterDuplicates: !0,
|
|
1330
|
+
isDuplicate: (d, B) => d.from === B.from && d.to === B.to
|
|
1331
|
+
}, d);
|
|
1332
|
+
}
|
|
1333
|
+
add(d) {
|
|
1334
|
+
if (!d || !d.from || !d.to) return;
|
|
1335
|
+
let B = {
|
|
1336
|
+
from: moment_default.isMoment(d.from) ? d.from.toISOString() : d.from,
|
|
1337
|
+
to: moment_default.isMoment(d.to) ? d.to.toISOString() : d.to
|
|
1338
|
+
};
|
|
1339
|
+
this.history.add(B);
|
|
1340
|
+
}
|
|
1341
|
+
get() {
|
|
1342
|
+
return this.history.get();
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
init_moment(), require_lodash(), require_lodash();
|
|
1346
|
+
var bannerId;
|
|
1347
|
+
const onRedirectNoIndexPattern = (d, B, V) => () => {
|
|
1348
|
+
let U = d.management.kibana.indexPatterns ? "/management/kibana/indexPatterns" : "/home", W;
|
|
1349
|
+
W && clearTimeout(W);
|
|
1350
|
+
let G = "To visualize and explore data in Kibana, you must create an index pattern to retrieve data from Elasticsearch.";
|
|
1351
|
+
return bannerId = V.banners.replace(bannerId, toMountPoint(/* @__PURE__ */ jsx(EuiCallOut, {
|
|
1352
|
+
color: "warning",
|
|
1353
|
+
iconType: "iInCircle",
|
|
1354
|
+
title: G
|
|
1355
|
+
}))), W = setTimeout(() => {
|
|
1356
|
+
V.banners.remove(bannerId), W = void 0;
|
|
1357
|
+
}, 15e3), U === "/home" ? B("home") : B("management", { path: `/kibana/indexPatterns?bannerMessage=${G}` }), new Promise(() => {});
|
|
1358
|
+
}, onUnsupportedTimePattern = (d, B) => ({ id: V, title: U, index: W }) => {
|
|
1359
|
+
let G = `Currently querying all indices matching ${W}. ${U} should be migrated to a wildcard-based index pattern.`;
|
|
1360
|
+
d.addWarning({
|
|
1361
|
+
title: "Support for time interval index patterns removed",
|
|
1362
|
+
text: toMountPoint(/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", { children: G }), /* @__PURE__ */ jsx(EuiFlexGroup, {
|
|
1363
|
+
justifyContent: "flexEnd",
|
|
1364
|
+
gutterSize: "s",
|
|
1365
|
+
children: /* @__PURE__ */ jsx(EuiFlexItem, {
|
|
1366
|
+
grow: !1,
|
|
1367
|
+
children: /* @__PURE__ */ jsx(EuiButton, {
|
|
1368
|
+
size: "s",
|
|
1369
|
+
onClick: () => B("management", { path: `/kibana/index_patterns/index_pattern/${V || ""}` }),
|
|
1370
|
+
children: "Edit index pattern"
|
|
1371
|
+
})
|
|
1372
|
+
})
|
|
1373
|
+
})] }))
|
|
1374
|
+
});
|
|
1375
|
+
};
|
|
1376
|
+
var API_BASE_URL = "/view/", IndexPatternsApiClient = class {
|
|
1377
|
+
http;
|
|
1378
|
+
constructor(d) {
|
|
1379
|
+
this.http = d;
|
|
1380
|
+
}
|
|
1381
|
+
_request(d, B) {
|
|
1382
|
+
return this.http.fetch(d, { query: B }).catch((d) => {
|
|
1383
|
+
throw d.body.statusCode === 404 && d.body.attributes?.code === "no_matching_indices" ? new IndexPatternMissingIndices(d.body.message) : Error(d.body.message || d.body.error || `${d.body.statusCode} Response`);
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
_getUrl(d) {
|
|
1387
|
+
return this.http.getServerBasePath() + API_BASE_URL + d.filter(Boolean).map(encodeURIComponent).join("/");
|
|
1388
|
+
}
|
|
1389
|
+
getFieldsForTimePattern(d = {}) {
|
|
1390
|
+
let { pattern: B, lookBack: V, metaFields: H } = d, U = this._getUrl(["_fields_for_time_pattern"]);
|
|
1391
|
+
return this._request(U, {
|
|
1392
|
+
pattern: B,
|
|
1393
|
+
look_back: V,
|
|
1394
|
+
meta_fields: H
|
|
1395
|
+
}).then((d) => d.fields);
|
|
1396
|
+
}
|
|
1397
|
+
getFieldsForWildcard(d = {}) {
|
|
1398
|
+
let { pattern: B, metaFields: V, type: H, params: U } = d, W, G;
|
|
1399
|
+
return W = this._getUrl(["_fields_for_wildcard"]), G = {
|
|
1400
|
+
pattern: B,
|
|
1401
|
+
meta_fields: V
|
|
1402
|
+
}, this._request(W, G).then((d) => d.fields);
|
|
1403
|
+
}
|
|
1404
|
+
}, import_lodash$10 = require_lodash(), simpleSavedObjectToSavedObject = (d) => ({
|
|
1405
|
+
version: d._version,
|
|
1406
|
+
...(0, import_lodash$10.omit)(d, "_version")
|
|
1407
|
+
}), SavedObjectsClientPublicToCommon = class {
|
|
1408
|
+
savedObjectClient;
|
|
1409
|
+
constructor(d) {
|
|
1410
|
+
this.savedObjectClient = d;
|
|
1411
|
+
}
|
|
1412
|
+
async find(d) {
|
|
1413
|
+
return (await this.savedObjectClient.find(d)).savedObjects.map(simpleSavedObjectToSavedObject);
|
|
1414
|
+
}
|
|
1415
|
+
async get(d, B) {
|
|
1416
|
+
return simpleSavedObjectToSavedObject(await this.savedObjectClient.get(d, B));
|
|
1417
|
+
}
|
|
1418
|
+
async update(d, B, V, H) {
|
|
1419
|
+
return simpleSavedObjectToSavedObject(await this.savedObjectClient.update(d, B, V, H));
|
|
1420
|
+
}
|
|
1421
|
+
async create(d, B, V) {
|
|
1422
|
+
return simpleSavedObjectToSavedObject(await this.savedObjectClient.create(d, B, V));
|
|
1423
|
+
}
|
|
1424
|
+
delete(d, B) {
|
|
1425
|
+
return this.savedObjectClient.delete(d, B);
|
|
1426
|
+
}
|
|
1427
|
+
}, import_lodash$9 = require_lodash(), getConfig = (d, B) => getUiSettings().get(d, B), DefaultFieldFormat = FieldFormat.from(import_lodash$9.identity);
|
|
1428
|
+
const deserializeFieldFormat = function(d) {
|
|
1429
|
+
return d ? getFormatWithAggs((d) => {
|
|
1430
|
+
let { id: B, params: V = {} } = d;
|
|
1431
|
+
if (B) {
|
|
1432
|
+
let d = this.getType(B);
|
|
1433
|
+
if (d) return new d(V, getConfig);
|
|
1434
|
+
}
|
|
1435
|
+
return new DefaultFieldFormat();
|
|
1436
|
+
})(d) : new DefaultFieldFormat();
|
|
1437
|
+
};
|
|
1438
|
+
function getTimezone() {
|
|
1439
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1440
|
+
}
|
|
1441
|
+
var import_lodash$8 = require_lodash();
|
|
1442
|
+
init_moment();
|
|
1443
|
+
var ISO_FORMAT = "YYYY-MM-DDTHH:mm:ss.SSSZ", tz = getTimezone(), DateFormat = class extends FieldFormat {
|
|
1444
|
+
static id = FIELD_FORMAT_IDS.DATE;
|
|
1445
|
+
static title = "Date";
|
|
1446
|
+
static fieldType = KBN_FIELD_TYPES.DATE;
|
|
1447
|
+
memoizedConverter = import_lodash$8.noop;
|
|
1448
|
+
memoizedPattern = "";
|
|
1449
|
+
timeZone = "";
|
|
1450
|
+
getParamDefaults() {
|
|
1451
|
+
return {
|
|
1452
|
+
pattern: this.getConfig("dateFormat") ?? ISO_FORMAT,
|
|
1453
|
+
timezone: this.getConfig("dateFormat:tz") ?? tz
|
|
1454
|
+
};
|
|
1455
|
+
}
|
|
1456
|
+
textConvert = (d) => {
|
|
1457
|
+
let B = this.param("pattern"), V = this.param("timezone"), H = this.timeZone !== V, U = this.memoizedPattern !== B;
|
|
1458
|
+
return (H || U) && (this.timeZone = V, this.memoizedPattern = B, this.memoizedConverter = (0, import_lodash$8.memoize)(function(d) {
|
|
1459
|
+
if (d == null) return "-";
|
|
1460
|
+
let H = moment_default(d).tz(V, !0);
|
|
1461
|
+
return H.isValid() ? H.format(B) : d;
|
|
1462
|
+
})), this.memoizedConverter(d);
|
|
1463
|
+
};
|
|
1464
|
+
}, import_lodash$7 = require_lodash();
|
|
1465
|
+
init_moment();
|
|
1466
|
+
function analysePatternForFract(d) {
|
|
1467
|
+
let B = d.match("S+"), V = B ? B[0] : "";
|
|
1468
|
+
return {
|
|
1469
|
+
length: V.length,
|
|
1470
|
+
patternNanos: V,
|
|
1471
|
+
pattern: d,
|
|
1472
|
+
patternEscaped: V ? d.replace(B, `[${B}]`) : ""
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
function formatWithNanos(d, B, V) {
|
|
1476
|
+
if (V.length <= 3) return d.format(V.pattern);
|
|
1477
|
+
{
|
|
1478
|
+
let H = d.format(V.patternEscaped), U = B.substr(20, B.length - 21).padEnd(9, "0").substr(0, V.patternNanos.length);
|
|
1479
|
+
return H.replace(V.patternNanos, U);
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
const baseFormattersPublic = [
|
|
1483
|
+
DateFormat,
|
|
1484
|
+
class extends FieldFormat {
|
|
1485
|
+
static id = FIELD_FORMAT_IDS.DATE_NANOS;
|
|
1486
|
+
static title = "Date nanos";
|
|
1487
|
+
static fieldType = KBN_FIELD_TYPES.DATE;
|
|
1488
|
+
memoizedConverter = import_lodash$7.noop;
|
|
1489
|
+
memoizedPattern = "";
|
|
1490
|
+
timeZone = "";
|
|
1491
|
+
getParamDefaults() {
|
|
1492
|
+
return {
|
|
1493
|
+
pattern: this.getConfig("dateNanosFormat"),
|
|
1494
|
+
fallbackPattern: this.getConfig("dateFormat"),
|
|
1495
|
+
timezone: this.getConfig("dateFormat:tz")
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
textConvert = (d) => {
|
|
1499
|
+
let B = this.param("pattern"), V = this.param("timezone"), H = analysePatternForFract(B), U = this.param("patternFallback"), W = this.timeZone !== V, G = this.memoizedPattern !== B;
|
|
1500
|
+
return (W || G) && (this.timeZone = V, this.memoizedPattern = B, this.memoizedConverter = (0, import_lodash$7.memoize)(function(d) {
|
|
1501
|
+
if (d == null) return "-";
|
|
1502
|
+
let B = moment_default(d);
|
|
1503
|
+
return typeof d != "string" && B.isValid() ? B.format(U) : B.isValid() ? formatWithNanos(B, d, H) : d;
|
|
1504
|
+
})), this.memoizedConverter(d);
|
|
1505
|
+
};
|
|
1506
|
+
},
|
|
1507
|
+
...baseFormatters
|
|
1508
|
+
];
|
|
1509
|
+
var Fallback$2 = () => /* @__PURE__ */ jsx("div", {}), LazySearchBar = React.lazy(() => import("./search_bar-DZMeLETx.js"));
|
|
1510
|
+
const SearchBar = withKibana((d) => /* @__PURE__ */ jsx(React.Suspense, {
|
|
1511
|
+
fallback: /* @__PURE__ */ jsx(Fallback$2, {}),
|
|
1512
|
+
children: /* @__PURE__ */ jsx(LazySearchBar, { ...d })
|
|
1513
|
+
})), useFilterManager = (d) => {
|
|
1514
|
+
let [B, V] = useState(d.filters || d.filterManager.getFilters());
|
|
1515
|
+
return useEffect(() => {
|
|
1516
|
+
let B = new Subscription();
|
|
1517
|
+
return B.add(d.filterManager.getUpdates$().subscribe({ next: () => {
|
|
1518
|
+
V(d.filterManager.getFilters());
|
|
1519
|
+
} })), () => {
|
|
1520
|
+
B.unsubscribe();
|
|
1521
|
+
};
|
|
1522
|
+
}, [d.filterManager]), { filters: B };
|
|
1523
|
+
}, useTimefilter = (d) => {
|
|
1524
|
+
let B = {
|
|
1525
|
+
from: d.dateRangeFrom || d.timefilter.getTime().from,
|
|
1526
|
+
to: d.dateRangeTo || d.timefilter.getTime().to
|
|
1527
|
+
}, V = {
|
|
1528
|
+
value: d.refreshInterval || d.timefilter.getRefreshInterval().value,
|
|
1529
|
+
pause: d.isRefreshPaused || d.timefilter.getRefreshInterval().pause
|
|
1530
|
+
}, [H, U] = useState(B), [W, G] = useState(V);
|
|
1531
|
+
return useEffect(() => {
|
|
1532
|
+
let B = new Subscription();
|
|
1533
|
+
return B.add(d.timefilter.getRefreshIntervalUpdate$().subscribe({ next: () => {
|
|
1534
|
+
G(d.timefilter.getRefreshInterval());
|
|
1535
|
+
} })), B.add(d.timefilter.getTimeUpdate$().subscribe({ next: () => {
|
|
1536
|
+
U(d.timefilter.getTime());
|
|
1537
|
+
} })), () => {
|
|
1538
|
+
B.unsubscribe();
|
|
1539
|
+
};
|
|
1540
|
+
}, [d.timefilter]), {
|
|
1541
|
+
refreshInterval: W,
|
|
1542
|
+
timeRange: H
|
|
1543
|
+
};
|
|
1544
|
+
}, useQueryStringManager = (d) => {
|
|
1545
|
+
let [B, V] = useState(d.query || d.queryStringManager.getQuery());
|
|
1546
|
+
return useEffect(() => {
|
|
1547
|
+
let B = new Subscription();
|
|
1548
|
+
return B.add(d.queryStringManager.getUpdates$().subscribe({ next: () => {
|
|
1549
|
+
V(d.queryStringManager.getQuery());
|
|
1550
|
+
} })), () => {
|
|
1551
|
+
B.unsubscribe();
|
|
1552
|
+
};
|
|
1553
|
+
}, [d.queryStringManager]), { query: B };
|
|
1554
|
+
};
|
|
1555
|
+
var import_lodash$6 = /* @__PURE__ */ __toESM(require_lodash(), 1), defaultFiltersUpdated = (d) => (B) => {
|
|
1556
|
+
d.filterManager.setFilters(B), d.onQuerySubmit && d.onQuerySubmit();
|
|
1557
|
+
}, defaultOnRefreshChange = (d) => {
|
|
1558
|
+
let B = d.timefilter;
|
|
1559
|
+
return (d) => {
|
|
1560
|
+
B.setRefreshInterval({
|
|
1561
|
+
value: d.refreshInterval,
|
|
1562
|
+
pause: d.isPaused
|
|
1563
|
+
});
|
|
1564
|
+
};
|
|
1565
|
+
}, defaultOnQuerySubmit = (d, B) => {
|
|
1566
|
+
if (!d.useDefaultBehaviors) return d.onQuerySubmit;
|
|
1567
|
+
let V = d.timefilter;
|
|
1568
|
+
return (H) => {
|
|
1569
|
+
!import_lodash$6.default.isEqual(V.getTime(), H.dateRange) || !import_lodash$6.default.isEqual(H.query, B) ? (V.setTime(H.dateRange), H.query ? d.queryString.setQuery(H.query) : d.queryString.clearQuery(), d.onQuerySubmit && d.onQuerySubmit({
|
|
1570
|
+
dateRange: H.dateRange,
|
|
1571
|
+
query: H.query || B
|
|
1572
|
+
}, !0)) : d.onQuerySubmit && d.onQuerySubmit({
|
|
1573
|
+
dateRange: V.getTime(),
|
|
1574
|
+
query: B
|
|
1575
|
+
}, !1);
|
|
1576
|
+
};
|
|
1577
|
+
}, overrideDefaultBehaviors = (d) => d.useDefaultBehaviors ? {} : d;
|
|
1578
|
+
function createSearchBar() {
|
|
1579
|
+
return (d) => {
|
|
1580
|
+
let { useDefaultBehaviors: B, indexPatterns: V } = d, H = useRef(d.onQuerySubmit), { filters: U } = useFilterManager({
|
|
1581
|
+
filters: d.filters,
|
|
1582
|
+
filterManager: d.filterManager
|
|
1583
|
+
}), { query: W } = useQueryStringManager({
|
|
1584
|
+
query: d.query,
|
|
1585
|
+
queryStringManager: d.queryStringManager
|
|
1586
|
+
}), { timeRange: G, refreshInterval: K } = useTimefilter({
|
|
1587
|
+
dateRangeFrom: d.dateRangeFrom,
|
|
1588
|
+
dateRangeTo: d.dateRangeTo,
|
|
1589
|
+
refreshInterval: d.refreshInterval,
|
|
1590
|
+
isRefreshPaused: d.isRefreshPaused,
|
|
1591
|
+
timefilter: d.timefilter
|
|
1592
|
+
});
|
|
1593
|
+
return useEffect(() => {
|
|
1594
|
+
!B || H.current;
|
|
1595
|
+
}, [
|
|
1596
|
+
W,
|
|
1597
|
+
G,
|
|
1598
|
+
B
|
|
1599
|
+
]), /* @__PURE__ */ jsx(SearchBar, {
|
|
1600
|
+
showAutoRefreshOnly: d.showAutoRefreshOnly,
|
|
1601
|
+
showDatePicker: d.showDatePicker,
|
|
1602
|
+
showFilterBar: d.showFilterBar,
|
|
1603
|
+
showQueryBar: d.showQueryBar,
|
|
1604
|
+
showQueryInput: d.showQueryInput,
|
|
1605
|
+
showSaveQuery: d.showSaveQuery,
|
|
1606
|
+
screenTitle: d.screenTitle,
|
|
1607
|
+
indexPatterns: d.indexPatterns,
|
|
1608
|
+
indicateNoData: d.indicateNoData,
|
|
1609
|
+
timeHistory: d.timefilter.history,
|
|
1610
|
+
dateRangeFrom: G.from,
|
|
1611
|
+
dateRangeTo: G.to,
|
|
1612
|
+
refreshInterval: K.value,
|
|
1613
|
+
isRefreshPaused: K.pause,
|
|
1614
|
+
filters: U,
|
|
1615
|
+
query: W,
|
|
1616
|
+
onFiltersUpdated: defaultFiltersUpdated(d),
|
|
1617
|
+
onRefreshChange: defaultOnRefreshChange(d),
|
|
1618
|
+
onQuerySubmit: defaultOnQuerySubmit(d, W),
|
|
1619
|
+
...overrideDefaultBehaviors(d),
|
|
1620
|
+
storage: d.storage,
|
|
1621
|
+
services: d.services,
|
|
1622
|
+
selectedIndexPattern: d.selectedIndexPattern,
|
|
1623
|
+
setIndexPattern: d.setIndexPattern,
|
|
1624
|
+
indices: d.indices,
|
|
1625
|
+
renderTimeField: d.renderTimeField,
|
|
1626
|
+
histogramData: d.histogramData,
|
|
1627
|
+
timefilterUpdateHandler: d.timefilterUpdateHandler,
|
|
1628
|
+
histogramOpts: d.histogramOpts,
|
|
1629
|
+
timeSetting: d.timeSetting,
|
|
1630
|
+
locale: d.locale,
|
|
1631
|
+
theme: d.theme
|
|
1632
|
+
});
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
var import_lodash$5 = /* @__PURE__ */ __toESM(require_lodash(), 1);
|
|
1636
|
+
function getExistingFilter(d, B, V) {
|
|
1637
|
+
return import_lodash$5.default.find(d, function(d) {
|
|
1638
|
+
if (d) {
|
|
1639
|
+
if (B === "_exists_" && isExistsFilter(d)) return d.exists.field === V;
|
|
1640
|
+
if (isPhraseFilter(d)) return getPhraseFilterField(d) === B && getPhraseFilterValue(d) === V;
|
|
1641
|
+
if (isScriptedPhraseFilter(d)) return d.meta.field === B && d.script.script.params.value === V;
|
|
1642
|
+
}
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
function updateExistingFilter(d, B) {
|
|
1646
|
+
d.meta.disabled = !1, d.meta.negate !== B && (d.meta.negate = !d.meta.negate);
|
|
1647
|
+
}
|
|
1648
|
+
function generateFilters(d, B, V, H, U) {
|
|
1649
|
+
V = Array.isArray(V) ? V : [V];
|
|
1650
|
+
let W = import_lodash$5.default.isObject(B) ? B : { name: B }, G = W.name, K = [], q = d.getAppFilters(), J = H === "-", Y;
|
|
1651
|
+
return import_lodash$5.default.each(V, function(d) {
|
|
1652
|
+
let B = getExistingFilter(q, G, d);
|
|
1653
|
+
if (B) updateExistingFilter(B, J), Y = B;
|
|
1654
|
+
else {
|
|
1655
|
+
let B = { id: U }, V = G === "_exists_" ? FILTERS.EXISTS : FILTERS.PHRASE, H = G === "_exists_" ? { name: d } : W, K = d == null;
|
|
1656
|
+
Y = buildFilter(B, H, K ? FILTERS.EXISTS : V, K ? !J : J, !1, d, null, FilterStateStore.APP_STATE);
|
|
1657
|
+
}
|
|
1658
|
+
K.push(Y);
|
|
1659
|
+
}), K;
|
|
1660
|
+
}
|
|
1661
|
+
var Fallback$1 = () => /* @__PURE__ */ jsx("div", {}), LazyFilterLabel = React.lazy(() => import("./filter_label-BOgCXkdp.js"));
|
|
1662
|
+
const FilterLabel = (d) => /* @__PURE__ */ jsx(React.Suspense, {
|
|
1663
|
+
fallback: /* @__PURE__ */ jsx(Fallback$1, {}),
|
|
1664
|
+
children: /* @__PURE__ */ jsx(LazyFilterLabel, { ...d })
|
|
1665
|
+
});
|
|
1666
|
+
React.lazy(() => import("./query_bar_top_row-Dp4-frN1.js")), withKibana(React.lazy(() => import("./query_string_input-BP2qq9Lf.js")));
|
|
1667
|
+
var { useToken } = theme, Fallback = () => /* @__PURE__ */ jsx("div", {}), LazySuggestionsComponent = React.lazy(() => import("./suggestions_component-D52Ar73h.js"));
|
|
1668
|
+
const SuggestionsComponent = (d) => {
|
|
1669
|
+
let { token: B } = useToken(), V = {
|
|
1670
|
+
border: 0,
|
|
1671
|
+
background: B.colorBgElevated,
|
|
1672
|
+
boxShadow: B.boxShadowSecondary,
|
|
1673
|
+
borderRadius: B.borderRadiusLG
|
|
1674
|
+
};
|
|
1675
|
+
return /* @__PURE__ */ jsx(React.Suspense, {
|
|
1676
|
+
fallback: /* @__PURE__ */ jsx(Fallback, {}),
|
|
1677
|
+
children: /* @__PURE__ */ jsx(LazySuggestionsComponent, {
|
|
1678
|
+
...d,
|
|
1679
|
+
style: V
|
|
1680
|
+
})
|
|
1681
|
+
});
|
|
1682
|
+
};
|
|
1683
|
+
function getQueryLog(d, B, V, H) {
|
|
1684
|
+
return new PersistedLog(`typeahead:${V}-${H}`, {
|
|
1685
|
+
maxLength: d.get(UI_SETTINGS.HISTORY_LIMIT),
|
|
1686
|
+
filterDuplicates: !0
|
|
1687
|
+
}, B);
|
|
1688
|
+
}
|
|
1689
|
+
var import_lodash$4 = /* @__PURE__ */ __toESM(require_lodash(), 1);
|
|
1690
|
+
function fromUser(d) {
|
|
1691
|
+
if (import_lodash$4.default.isEmpty(d)) return "";
|
|
1692
|
+
if (import_lodash$4.default.isObject(d)) return d;
|
|
1693
|
+
if (d ||= "", typeof d == "string") {
|
|
1694
|
+
let B = d.trim();
|
|
1695
|
+
if (B.length === 0) return "";
|
|
1696
|
+
if (B[0] === "{") try {
|
|
1697
|
+
return JSON.parse(B);
|
|
1698
|
+
} catch {
|
|
1699
|
+
return d;
|
|
1700
|
+
}
|
|
1701
|
+
else return d;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
var pairs = [
|
|
1705
|
+
"()",
|
|
1706
|
+
"[]",
|
|
1707
|
+
"{}",
|
|
1708
|
+
"''",
|
|
1709
|
+
"\"\""
|
|
1710
|
+
], openers = pairs.map((d) => d[0]), closers = pairs.map((d) => d[1]);
|
|
1711
|
+
function matchPairs({ value: d, selectionStart: B, selectionEnd: V, key: H, metaKey: U, updateQuery: W, preventDefault: G }) {
|
|
1712
|
+
shouldMoveCursorForward(H, d, B, V) ? (G(), W(d, B + 1, V + 1)) : shouldInsertMatchingCloser(H, d, B, V) ? (G(), W(d.substr(0, B) + H + d.substring(B, V) + closers[openers.indexOf(H)] + d.substr(V), B + 1, V + 1)) : shouldRemovePair(H, U, d, B, V) && (G(), W(d.substr(0, V - 1) + d.substr(V + 1), B - 1, V - 1));
|
|
1713
|
+
}
|
|
1714
|
+
function shouldMoveCursorForward(d, B, V, H) {
|
|
1715
|
+
return !closers.includes(d) || V !== H ? !1 : B.charAt(H) === d;
|
|
1716
|
+
}
|
|
1717
|
+
function shouldInsertMatchingCloser(d, B, V, H) {
|
|
1718
|
+
if (!openers.includes(d)) return !1;
|
|
1719
|
+
if (V !== H) return !0;
|
|
1720
|
+
let U = B.charAt(V - 1), W = B.charAt(V + 1);
|
|
1721
|
+
return U === "\\" ? !1 : !(["\"", "'"].includes(d) && (isAlphanumeric(U) || isAlphanumeric(W)));
|
|
1722
|
+
}
|
|
1723
|
+
function shouldRemovePair(d, B, V, H, U) {
|
|
1724
|
+
return d !== "Backspace" || B || H !== U ? !1 : pairs.includes(V.substr(U - 1, 2));
|
|
1725
|
+
}
|
|
1726
|
+
function isAlphanumeric(d = "") {
|
|
1727
|
+
return d.match(/[a-zA-Z0-9_]/);
|
|
1728
|
+
}
|
|
1729
|
+
function toUser(d) {
|
|
1730
|
+
return d == null ? "" : typeof d == "object" ? d.query_string ? toUser(d.query_string.query) : JSON.stringify(d) : "" + d;
|
|
1731
|
+
}
|
|
1732
|
+
require_lodash(), React.lazy(() => import("./shard_failure_open_modal_button-ziUHpSxf.js")), require_lodash(), require_lodash(), require_lodash(), React.lazy(() => import("./index_pattern_select-Ct7oi9xn.js"));
|
|
1733
|
+
const indexPatterns = {
|
|
1734
|
+
ILLEGAL_CHARACTERS_KEY,
|
|
1735
|
+
CONTAINS_SPACES_KEY,
|
|
1736
|
+
ILLEGAL_CHARACTERS_VISIBLE,
|
|
1737
|
+
ILLEGAL_CHARACTERS,
|
|
1738
|
+
isDefault,
|
|
1739
|
+
isFilterable,
|
|
1740
|
+
isNestedField,
|
|
1741
|
+
validate: validateIndexPattern,
|
|
1742
|
+
getFromSavedObject,
|
|
1743
|
+
flattenHitWrapper,
|
|
1744
|
+
formatHitProvider
|
|
1745
|
+
}, search = {
|
|
1746
|
+
aggs: {
|
|
1747
|
+
CidrMask,
|
|
1748
|
+
dateHistogramInterval,
|
|
1749
|
+
intervalOptions,
|
|
1750
|
+
InvalidEsCalendarIntervalError,
|
|
1751
|
+
InvalidEsIntervalFormatError,
|
|
1752
|
+
Ipv4Address,
|
|
1753
|
+
isDateHistogramBucketAggConfig,
|
|
1754
|
+
isNumberType,
|
|
1755
|
+
isStringType,
|
|
1756
|
+
isType,
|
|
1757
|
+
isValidEsInterval,
|
|
1758
|
+
isValidInterval,
|
|
1759
|
+
parentPipelineType,
|
|
1760
|
+
parseEsInterval,
|
|
1761
|
+
parseInterval,
|
|
1762
|
+
propFilter,
|
|
1763
|
+
siblingPipelineType,
|
|
1764
|
+
termsAggFilter,
|
|
1765
|
+
toAbsoluteDates
|
|
1766
|
+
},
|
|
1767
|
+
getRequestInspectorStats,
|
|
1768
|
+
getResponseInspectorStats,
|
|
1769
|
+
tabifyAggResponse,
|
|
1770
|
+
tabifyGetColumns
|
|
1771
|
+
};
|
|
1772
|
+
export { BehaviorSubject as C, Subscription as E, QuerySuggestionTypes as S, operate as T, onRedirectNoIndexPattern as _, fromUser as a, FilterManager as b, FilterLabel as c, baseFormattersPublic as d, getTimezone as f, onUnsupportedTimePattern as g, IndexPatternsApiClient as h, matchPairs as i, generateFilters as l, SavedObjectsClientPublicToCommon as m, search as n, getQueryLog as o, deserializeFieldFormat as p, toUser as r, SuggestionsComponent as s, indexPatterns as t, createSearchBar as u, TimeHistory as v, createOperatorSubscriber as w, AutocompleteService as x, Timefilter as y };
|