@infinilabs/discover 0.0.1

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.
Files changed (233) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +8 -0
  3. package/dist/abap-B988NUrV.js +122 -0
  4. package/dist/abap-obercqiY.cjs +1 -0
  5. package/dist/apex-B0_UGK1B.cjs +1 -0
  6. package/dist/apex-BlHPPQK-.js +168 -0
  7. package/dist/azcli-C7iyZFGk.js +53 -0
  8. package/dist/azcli-CEoytwx_.cjs +1 -0
  9. package/dist/bat-Buc0l0C3.js +123 -0
  10. package/dist/bat-D65OC-jj.cjs +1 -0
  11. package/dist/bicep-DvD_e5vW.cjs +2 -0
  12. package/dist/bicep-U66iJ-pV.js +219 -0
  13. package/dist/cameligo-C9Dwkdmm.js +189 -0
  14. package/dist/cameligo-DzMHfeEs.cjs +1 -0
  15. package/dist/chunk-BjqF3vbe.cjs +1 -0
  16. package/dist/chunk-CIp4IH9D.js +21 -0
  17. package/dist/classnames-BXjDNQ6Q.cjs +1 -0
  18. package/dist/classnames-eUba3oot.js +29 -0
  19. package/dist/clojure-BC7BzAFK.cjs +1 -0
  20. package/dist/clojure-DDWmWbSx.js +146 -0
  21. package/dist/coffee-7Sx2S8NH.js +260 -0
  22. package/dist/coffee-Ca9F0OWZ.cjs +1 -0
  23. package/dist/common-BeXEy5sz.cjs +18 -0
  24. package/dist/common-BlOHZJzI.js +64 -0
  25. package/dist/common-DuYIpe6b.cjs +1 -0
  26. package/dist/common-Tr1I-HCs.js +6725 -0
  27. package/dist/cpp-CHjqaSPQ.js +230 -0
  28. package/dist/cpp-DKy9h6xR.cjs +1 -0
  29. package/dist/createLucideIcon-239Z-2by.cjs +1 -0
  30. package/dist/createLucideIcon-BO6TDGE7.js +43 -0
  31. package/dist/csharp-CkbgT9vH.cjs +1 -0
  32. package/dist/csharp-jwStnVeK.js +260 -0
  33. package/dist/csp-C2qFd6iv.cjs +1 -0
  34. package/dist/csp-DkO8Np0h.js +46 -0
  35. package/dist/css-BFvwcljm.js +284 -0
  36. package/dist/css-DCKUCzD6.cjs +3 -0
  37. package/dist/cssMode-CU2AJQMM.js +1509 -0
  38. package/dist/cssMode-l7eR8WSG.cjs +4 -0
  39. package/dist/cypher-122TYSjJ.cjs +1 -0
  40. package/dist/cypher-DaQ7hFRL.js +212 -0
  41. package/dist/dart-D8p_2HKP.js +236 -0
  42. package/dist/dart-DshcPGU8.cjs +1 -0
  43. package/dist/dist-DCz_Qv0B.js +884 -0
  44. package/dist/dist-D_2dZQH5.cjs +11 -0
  45. package/dist/dockerfile-CL8dwZCe.cjs +1 -0
  46. package/dist/dockerfile-DKWOQrwp.js +191 -0
  47. package/dist/ecl-DP3PNWGB.js +226 -0
  48. package/dist/ecl-DVx2J_EE.cjs +1 -0
  49. package/dist/editor.api-CbUDOph7.js +70302 -0
  50. package/dist/editor.api-lY2thcaq.cjs +644 -0
  51. package/dist/elixir-Xgx_1krO.cjs +1 -0
  52. package/dist/elixir-e9tDp1p1.js +523 -0
  53. package/dist/filter_label-DRJC3vpe.js +58 -0
  54. package/dist/filter_label-DssaWGpx.cjs +1 -0
  55. package/dist/filter_operators-C-TaTcNc.js +70 -0
  56. package/dist/filter_operators-D0kyB-XI.cjs +1 -0
  57. package/dist/flow9-C9BjpX8h.js +176 -0
  58. package/dist/flow9-DR-EyjYV.cjs +1 -0
  59. package/dist/freemarker2-BTGUjvgA.cjs +3 -0
  60. package/dist/freemarker2-C6Iq5MB-.js +724 -0
  61. package/dist/fsharp-BWm_FISn.js +147 -0
  62. package/dist/fsharp-DaBEigN7.cjs +1 -0
  63. package/dist/go-Xyq33f0v.cjs +1 -0
  64. package/dist/go-cmqV0Vy_.js +165 -0
  65. package/dist/graphql-BkFHHVmI.js +174 -0
  66. package/dist/graphql-Cj7XAy25.cjs +1 -0
  67. package/dist/handlebars-B2b1q7PA.cjs +1 -0
  68. package/dist/handlebars-DGGN9u4Y.js +418 -0
  69. package/dist/hcl-5I-P7bYX.js +219 -0
  70. package/dist/hcl-C3dpBsgU.cjs +1 -0
  71. package/dist/html-RJa-j-qT.js +339 -0
  72. package/dist/html-qfcUzk8e.cjs +1 -0
  73. package/dist/htmlMode-CYIxo4hc.cjs +4 -0
  74. package/dist/htmlMode-DDZ48mdp.js +1520 -0
  75. package/dist/index.cjs +303 -0
  76. package/dist/index.d.ts +4 -0
  77. package/dist/index.js +72895 -0
  78. package/dist/index_pattern_select--iGeA3sP.js +93 -0
  79. package/dist/index_pattern_select-BeN5049F.cjs +1 -0
  80. package/dist/ini-ChENqKh8.cjs +1 -0
  81. package/dist/ini-DSIAxBZt.js +94 -0
  82. package/dist/java-DGeAxsRb.js +173 -0
  83. package/dist/java-LZ6g7weJ.cjs +1 -0
  84. package/dist/javascript-CN5gTHH2.js +19 -0
  85. package/dist/javascript-CZ97a-BN.cjs +1 -0
  86. package/dist/jsonMode-BZDeJMLL.cjs +10 -0
  87. package/dist/jsonMode-DraOl-ka.js +1885 -0
  88. package/dist/julia-BeebccKw.cjs +1 -0
  89. package/dist/julia-CU4CtsP4.js +414 -0
  90. package/dist/kotlin-B8NxXJ89.js +183 -0
  91. package/dist/kotlin-M82nl514.cjs +1 -0
  92. package/dist/less-B4Q3fV9Y.cjs +2 -0
  93. package/dist/less-DbeQQzer.js +242 -0
  94. package/dist/lexon-CXQaaecE.cjs +1 -0
  95. package/dist/lexon-Cw9JuAKc.js +185 -0
  96. package/dist/lib-C9j_E-l0.js +47 -0
  97. package/dist/lib-Chy_6VKj.cjs +1 -0
  98. package/dist/liquid-BYNEOJvX.cjs +1 -0
  99. package/dist/liquid-DvB-d2w7.js +205 -0
  100. package/dist/lodash-C_2NO1eK.cjs +35 -0
  101. package/dist/lodash-D-qGlPRW.js +3769 -0
  102. package/dist/lua-CnG8Tpu2.cjs +1 -0
  103. package/dist/lua-yl5NzA_S.js +200 -0
  104. package/dist/m3-CVcm-OIn.cjs +1 -0
  105. package/dist/m3-CdNAqvIX.js +193 -0
  106. package/dist/markdown-C1h-EuiT.js +262 -0
  107. package/dist/markdown-DrRHDVSU.cjs +1 -0
  108. package/dist/mdx-BbiOYPr2.cjs +1 -0
  109. package/dist/mdx-Fk8VTCUK.js +335 -0
  110. package/dist/mips-DIWpzGF0.js +128 -0
  111. package/dist/mips-D_p8UYQb.cjs +1 -0
  112. package/dist/monaco.contribution-BpuUCejv.cjs +1 -0
  113. package/dist/monaco.contribution-Cq4QrMn0.js +134 -0
  114. package/dist/msdax-BiazpDQ1.js +156 -0
  115. package/dist/msdax-xM1_j20x.cjs +1 -0
  116. package/dist/mysql-DMsJkSnA.cjs +1 -0
  117. package/dist/mysql-DphBFJlP.js +168 -0
  118. package/dist/objective-c-BG02Lrht.cjs +1 -0
  119. package/dist/objective-c-DWZ8Qpyc.js +144 -0
  120. package/dist/pascal-BcvlMOdu.js +176 -0
  121. package/dist/pascal-CnP2Fqes.cjs +1 -0
  122. package/dist/pascaligo-BzDEm-l_.cjs +1 -0
  123. package/dist/pascaligo-DHEp4kzh.js +201 -0
  124. package/dist/perl-USYKPHpO.js +316 -0
  125. package/dist/perl-nIxw-e4R.cjs +1 -0
  126. package/dist/pgsql-Buk6XzVf.cjs +1 -0
  127. package/dist/pgsql-DzPhAh9W.js +158 -0
  128. package/dist/php-B3sFYUqV.cjs +1 -0
  129. package/dist/php-PfpSTefE.js +471 -0
  130. package/dist/pla-CZtnfWl6.cjs +1 -0
  131. package/dist/pla-DrFOZwDB.js +146 -0
  132. package/dist/postiats-4OGxVVUT.js +504 -0
  133. package/dist/postiats-CgJZf83Q.cjs +1 -0
  134. package/dist/powerquery-D9gzk2Dq.cjs +1 -0
  135. package/dist/powerquery-_h9-HEnY.js +190 -0
  136. package/dist/powershell-CZHaQY6z.cjs +1 -0
  137. package/dist/powershell-nOzcY8gy.js +211 -0
  138. package/dist/protobuf-DAgxhnea.js +659 -0
  139. package/dist/protobuf-D_C8Guej.cjs +2 -0
  140. package/dist/public-1PveQco4.js +1756 -0
  141. package/dist/public-D1K7oN7t.cjs +3 -0
  142. package/dist/pug-quEtG4rz.cjs +1 -0
  143. package/dist/pug-raGZNmZ1.js +300 -0
  144. package/dist/python-C45c7K7W.js +260 -0
  145. package/dist/python-CQX8JcT4.cjs +1 -0
  146. package/dist/qsharp-C2jz5tuo.js +143 -0
  147. package/dist/qsharp-CX1SSV_j.cjs +1 -0
  148. package/dist/query_bar_top_row-3UclS1nm.cjs +1 -0
  149. package/dist/query_bar_top_row-CfV4Iu71.cjs +1 -0
  150. package/dist/query_bar_top_row-D6a48VTk.js +11 -0
  151. package/dist/query_bar_top_row-DonV1OzY.js +2930 -0
  152. package/dist/query_string_input-75waAcWy.js +9 -0
  153. package/dist/query_string_input-CHG9w1ze.cjs +1 -0
  154. package/dist/query_string_input-CyPZVKif.js +366 -0
  155. package/dist/query_string_input-SOULY6dl.cjs +1 -0
  156. package/dist/r-CXkPcYYf.js +189 -0
  157. package/dist/r-DpVDQTST.cjs +1 -0
  158. package/dist/razor-BnoJmj1k.js +525 -0
  159. package/dist/razor-DYx4yJJn.cjs +1 -0
  160. package/dist/redis-DsCuCZIT.cjs +1 -0
  161. package/dist/redis-giKZvbbg.js +123 -0
  162. package/dist/redshift-qKVxBsP_.js +158 -0
  163. package/dist/redshift-z5_aUfdC.cjs +1 -0
  164. package/dist/restructuredtext-D0n4pabr.js +287 -0
  165. package/dist/restructuredtext-DdXoKocW.cjs +1 -0
  166. package/dist/ruby-BNrBlpcw.js +527 -0
  167. package/dist/ruby-Dj0sNBey.cjs +1 -0
  168. package/dist/rust-D6mpPoli.js +178 -0
  169. package/dist/rust-DjkW1U4M.cjs +1 -0
  170. package/dist/sb-BCN0JcpS.cjs +1 -0
  171. package/dist/sb-DhS9GhXl.js +143 -0
  172. package/dist/scala-BqxBEpi8.js +551 -0
  173. package/dist/scala-CyXWhZaJ.cjs +1 -0
  174. package/dist/scheme-Bh4oGAk3.js +170 -0
  175. package/dist/scheme-Cs9G6QEE.cjs +1 -0
  176. package/dist/scss-Byf08jwC.js +417 -0
  177. package/dist/scss-Fl7taPuq.cjs +3 -0
  178. package/dist/search_bar-Caqi1NVo.js +1815 -0
  179. package/dist/search_bar-DyO_WsC5.cjs +1 -0
  180. package/dist/services-9wPHk1eh.js +2350 -0
  181. package/dist/services-BPC3fXx4.cjs +7 -0
  182. package/dist/shard_failure_open_modal_button-BYTThYch.js +199 -0
  183. package/dist/shard_failure_open_modal_button-Dx8ML4VE.cjs +2 -0
  184. package/dist/shell-Cw5yNfC4.cjs +1 -0
  185. package/dist/shell-UoRv_tpG.js +223 -0
  186. package/dist/solidity-B5t7Lkol.js +147 -0
  187. package/dist/solidity-BoAzg9X_.cjs +1 -0
  188. package/dist/sophia-BrXXWhvp.js +147 -0
  189. package/dist/sophia-L84Jz6Ow.cjs +1 -0
  190. package/dist/sparql-B8ZTY48u.js +124 -0
  191. package/dist/sparql-D6lnG7vO.cjs +1 -0
  192. package/dist/sql-D_74hUL-.js +171 -0
  193. package/dist/sql-VXdYzIyz.cjs +1 -0
  194. package/dist/src/App.d.ts +2 -0
  195. package/dist/src/components/ResultHeader/Info.d.ts +30 -0
  196. package/dist/src/components/ResultHeader/index.d.ts +13 -0
  197. package/dist/src/components/context.d.ts +82 -0
  198. package/dist/src/components/euiicons.d.ts +1 -0
  199. package/dist/src/components/index.d.ts +8 -0
  200. package/dist/src/main.d.ts +1 -0
  201. package/dist/src/utils/request.d.ts +1 -0
  202. package/dist/src/utils/utils.d.ts +1 -0
  203. package/dist/st-CxJLwAAK.cjs +1 -0
  204. package/dist/st-D8Rdx9Bz.js +476 -0
  205. package/dist/suggestions_component-BBHwbjYT.js +1243 -0
  206. package/dist/suggestions_component-CF4sehth.cjs +77 -0
  207. package/dist/swift-ZBC6wQdc.cjs +1 -0
  208. package/dist/swift-s19Ivx3X.js +213 -0
  209. package/dist/systemverilog-DoSgAb1I.cjs +1 -0
  210. package/dist/systemverilog-fA72PnKj.js +298 -0
  211. package/dist/tcl-B8QLbcxi.js +223 -0
  212. package/dist/tcl-IXmy-lJ0.cjs +1 -0
  213. package/dist/tsMode-BrPRpJvb.js +597 -0
  214. package/dist/tsMode-CNvH6xuC.cjs +11 -0
  215. package/dist/tsup.config.d.ts +2 -0
  216. package/dist/twig-CT2RXmm0.cjs +1 -0
  217. package/dist/twig-Dy7NkzKI.js +388 -0
  218. package/dist/typescript-BRKHcp4S.js +263 -0
  219. package/dist/typescript-Bbw9fxuo.cjs +1 -0
  220. package/dist/typescript-CQjO9XnF.js +3 -0
  221. package/dist/typescript-D6q4AO2z.cjs +1 -0
  222. package/dist/typespec-CkKpvaMv.cjs +1 -0
  223. package/dist/typespec-ndyv0mQx.js +234 -0
  224. package/dist/vb-DET0NIW-.js +260 -0
  225. package/dist/vb-R3Kcrzvd.cjs +1 -0
  226. package/dist/vite.config.d.ts +2 -0
  227. package/dist/wgsl-D5TeQchR.js +145 -0
  228. package/dist/wgsl-FTDBzylH.cjs +298 -0
  229. package/dist/xml-BZjE3dtf.js +136 -0
  230. package/dist/xml-CxbMIueA.cjs +1 -0
  231. package/dist/yaml-Di_6aXC4.js +229 -0
  232. package/dist/yaml-DvaGkWBl.cjs +1 -0
  233. package/package.json +98 -0
@@ -0,0 +1,1815 @@
1
+ import { o as __toESM } from "./chunk-CIp4IH9D.js";
2
+ import { n as require_jsx_runtime, t as require_lodash } from "./lodash-D-qGlPRW.js";
3
+ import { m as withKibana, p as useKibana, t as getIndexPatterns } from "./services-9wPHk1eh.js";
4
+ import { c as FilterLabel } from "./public-1PveQco4.js";
5
+ import { t as require_classnames } from "./classnames-eUba3oot.js";
6
+ import "./common-BlOHZJzI.js";
7
+ import "./lib-C9j_E-l0.js";
8
+ import { t as createLucideIcon } from "./createLucideIcon-BO6TDGE7.js";
9
+ import { t as QueryBarTopRow } from "./query_bar_top_row-DonV1OzY.js";
10
+ import { a as init_ResizeObserver_es, o as ListFilter, r as ResizeObserver_es_default, t as Ft } from "./dist-DCz_Qv0B.js";
11
+ import { $ as toggleFilterDisabled, Ct as moment_default, E as require_target, J as buildEmptyFilter, N as isFilterable, Q as pinFilter, St as init_moment, W as cleanFilter, X as enableFilter, Y as disableFilter, Z as isFilterPinned, et as toggleFilterNegated, f as Ipv4Address, it as getFilterParams, mt as getIndexPatternFromFilter, nt as unpinFilter, pt as getDisplayValueFromFilter, tt as toggleFilterPinned, vt as buildCustomFilter, yt as buildFilter } from "./common-Tr1I-HCs.js";
12
+ import { t as FILTER_OPERATORS } from "./filter_operators-C-TaTcNc.js";
13
+ import "./query_string_input-CyPZVKif.js";
14
+ import React, { Component, Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
15
+ import { Button, Checkbox, Divider, Empty, Input, Menu, Popover, Select, Space, Spin, Switch } from "antd";
16
+ import { EuiBadge, EuiComboBox, EuiFieldNumber, EuiFieldText, EuiFlexGroup, EuiFlexItem, EuiForm, EuiFormControlLayoutDelimited, EuiFormRow, EuiSelect, EuiSpacer, useInnerText } from "@elastic/eui";
17
+ import Icon, { BarsOutlined, CheckOutlined, CloseCircleOutlined, CloseOutlined, DownOutlined, FilterOutlined, LayoutOutlined, LeftOutlined, ReloadOutlined, RightOutlined, SortAscendingOutlined, TableOutlined, UpOutlined } from "@ant-design/icons";
18
+ var CircleMinus = createLucideIcon("circle-minus", [["circle", {
19
+ cx: "12",
20
+ cy: "12",
21
+ r: "10",
22
+ key: "1mglay"
23
+ }], ["path", {
24
+ d: "M8 12h8",
25
+ key: "1wcyev"
26
+ }]]), CirclePlus = createLucideIcon("circle-plus", [
27
+ ["circle", {
28
+ cx: "12",
29
+ cy: "12",
30
+ r: "10",
31
+ key: "1mglay"
32
+ }],
33
+ ["path", {
34
+ d: "M8 12h8",
35
+ key: "1wcyev"
36
+ }],
37
+ ["path", {
38
+ d: "M12 8v8",
39
+ key: "napkw2"
40
+ }]
41
+ ]), EyeOff = createLucideIcon("eye-off", [
42
+ ["path", {
43
+ d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
44
+ key: "ct8e1f"
45
+ }],
46
+ ["path", {
47
+ d: "M14.084 14.158a3 3 0 0 1-4.242-4.242",
48
+ key: "151rxh"
49
+ }],
50
+ ["path", {
51
+ d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
52
+ key: "13bj9a"
53
+ }],
54
+ ["path", {
55
+ d: "m2 2 20 20",
56
+ key: "1ooewy"
57
+ }]
58
+ ]), Eye = createLucideIcon("eye", [["path", {
59
+ d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
60
+ key: "1nclc0"
61
+ }], ["circle", {
62
+ cx: "12",
63
+ cy: "12",
64
+ r: "3",
65
+ key: "1v7zrd"
66
+ }]]), Pencil = createLucideIcon("pencil", [["path", {
67
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
68
+ key: "1a8usu"
69
+ }], ["path", {
70
+ d: "m15 5 4 4",
71
+ key: "1mk7zo"
72
+ }]]), PinOff = createLucideIcon("pin-off", [
73
+ ["path", {
74
+ d: "M12 17v5",
75
+ key: "bb1du9"
76
+ }],
77
+ ["path", {
78
+ d: "M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",
79
+ key: "znwnzq"
80
+ }],
81
+ ["path", {
82
+ d: "m2 2 20 20",
83
+ key: "1ooewy"
84
+ }],
85
+ ["path", {
86
+ d: "M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",
87
+ key: "c9qhm2"
88
+ }]
89
+ ]), Pin = createLucideIcon("pin", [["path", {
90
+ d: "M12 17v5",
91
+ key: "bb1du9"
92
+ }], ["path", {
93
+ d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",
94
+ key: "1nkz8b"
95
+ }]]), SquaresExclude = createLucideIcon("squares-exclude", [["path", {
96
+ d: "M16 12v2a2 2 0 0 1-2 2H9a1 1 0 0 0-1 1v3a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2h0",
97
+ key: "1mcohs"
98
+ }], ["path", {
99
+ d: "M4 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v3a1 1 0 0 1-1 1h-5a2 2 0 0 0-2 2v2",
100
+ key: "1r1efp"
101
+ }]]), Trash2 = createLucideIcon("trash-2", [
102
+ ["path", {
103
+ d: "M10 11v6",
104
+ key: "nco0om"
105
+ }],
106
+ ["path", {
107
+ d: "M14 11v6",
108
+ key: "outv1u"
109
+ }],
110
+ ["path", {
111
+ d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",
112
+ key: "miytrc"
113
+ }],
114
+ ["path", {
115
+ d: "M3 6h18",
116
+ key: "d0wm0j"
117
+ }],
118
+ ["path", {
119
+ d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",
120
+ key: "e791ji"
121
+ }]
122
+ ]);
123
+ init_ResizeObserver_es();
124
+ var import_lodash$10 = require_lodash(), import_classnames$2 = /* @__PURE__ */ __toESM(require_classnames(), 1), import_jsx_runtime = require_jsx_runtime();
125
+ function GenericComboBox(e) {
126
+ let { options: t, selectedOptions: n, getLabel: r, onChange: i, ...a } = e, o = t.map(r), s = o.map((e) => ({ label: e })), c = n.filter((e) => t.indexOf(e) !== -1).map((e) => s[t.indexOf(e)]);
127
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiComboBox, {
128
+ options: s,
129
+ selectedOptions: c,
130
+ onChange: (e) => {
131
+ i(e.map(({ label: e }) => t[o.indexOf(e)]));
132
+ },
133
+ sortMatchesBy: "startsWith",
134
+ ...a
135
+ });
136
+ }
137
+ var import_target = /* @__PURE__ */ __toESM(require_target(), 1);
138
+ function getFieldFromFilter(e, t) {
139
+ return t.fields.find((t) => t.name === e.meta.key);
140
+ }
141
+ function getOperatorFromFilter(e) {
142
+ return FILTER_OPERATORS.find((t) => e.meta.type === t.type && e.meta.negate === t.negate);
143
+ }
144
+ function getFilterableFields(e) {
145
+ return e.fields.filter(isFilterable);
146
+ }
147
+ function getOperatorOptions(e) {
148
+ return FILTER_OPERATORS.filter((t) => !t.fieldTypes || t.fieldTypes.includes(e.type));
149
+ }
150
+ function validateParams(e, t) {
151
+ switch (t) {
152
+ case "date":
153
+ let t = typeof e == "string" ? import_target.default.parse(e) : null;
154
+ return !!(typeof e == "string" && t && t.isValid());
155
+ case "ip": try {
156
+ return !!new Ipv4Address(e);
157
+ } catch {
158
+ return !1;
159
+ }
160
+ default: return !0;
161
+ }
162
+ }
163
+ function isFilterValid(e, t, n, r) {
164
+ if (!e || !t || !n) return !1;
165
+ switch (n.type) {
166
+ case "phrase": return validateParams(r, t.type);
167
+ case "phrases": return !Array.isArray(r) || !r.length ? !1 : r.every((e) => validateParams(e, t.type));
168
+ case "range": return typeof r == "object" ? (!r.from || validateParams(r.from, t.type)) && (!r.to || validateParams(r.to, t.type)) : !1;
169
+ case "exists": return !0;
170
+ default: throw Error(`Unknown operator type: ${n.type}`);
171
+ }
172
+ }
173
+ var PhraseSuggestorUI = class extends React.Component {
174
+ services = this.props.kibana.services;
175
+ abortController;
176
+ state = {
177
+ suggestions: [],
178
+ isLoading: !1
179
+ };
180
+ componentDidMount() {
181
+ this.updateSuggestions();
182
+ }
183
+ componentWillUnmount() {
184
+ this.abortController && this.abortController.abort();
185
+ }
186
+ isSuggestingValues() {
187
+ let { field: e } = this.props;
188
+ return e && e.aggregatable && e.type === "string";
189
+ }
190
+ onSearchChange = (e) => {
191
+ this.updateSuggestions(`${e}`);
192
+ };
193
+ updateSuggestions = (0, import_lodash$10.debounce)(async (e = "") => {
194
+ this.abortController && this.abortController.abort(), this.abortController = new AbortController();
195
+ let { indexPattern: t, field: n, dateRangeFrom: r, dateRangeTo: i, timeField: a } = this.props;
196
+ if (!n || !this.isSuggestingValues()) return;
197
+ this.setState({ isLoading: !0 });
198
+ let o = [];
199
+ r && i && a && o.push({ range: { [a]: {
200
+ gte: r,
201
+ lte: i
202
+ } } });
203
+ let s = await this.props.services.data.autocomplete.getValueSuggestions({
204
+ indexPattern: t,
205
+ field: n,
206
+ query: e,
207
+ boolFilter: o,
208
+ signal: this.abortController.signal
209
+ });
210
+ this.setState({
211
+ suggestions: s,
212
+ isLoading: !1
213
+ });
214
+ }, 500);
215
+ };
216
+ withKibana(PhraseSuggestorUI);
217
+ var import_lodash$9 = require_lodash();
218
+ const ValueInputType = class extends Component {
219
+ render() {
220
+ let e = this.props.value, t;
221
+ switch (this.props.type) {
222
+ case "string":
223
+ t = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFieldText, {
224
+ placeholder: this.props.placeholder,
225
+ value: e,
226
+ onChange: this.onChange,
227
+ controlOnly: this.props.controlOnly,
228
+ className: this.props.className
229
+ });
230
+ break;
231
+ case "number":
232
+ t = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFieldNumber, {
233
+ placeholder: this.props.placeholder,
234
+ value: typeof e == "string" ? parseFloat(e) : e,
235
+ onChange: this.onChange,
236
+ controlOnly: this.props.controlOnly,
237
+ className: this.props.className
238
+ });
239
+ break;
240
+ case "date":
241
+ t = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFieldText, {
242
+ placeholder: this.props.placeholder,
243
+ value: e,
244
+ onChange: this.onChange,
245
+ onBlur: this.onBlur,
246
+ isInvalid: !(0, import_lodash$9.isEmpty)(e) && !validateParams(e, this.props.type),
247
+ controlOnly: this.props.controlOnly,
248
+ className: this.props.className
249
+ });
250
+ break;
251
+ case "ip":
252
+ t = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFieldText, {
253
+ placeholder: this.props.placeholder,
254
+ value: e,
255
+ onChange: this.onChange,
256
+ isInvalid: !(0, import_lodash$9.isEmpty)(e) && !validateParams(e, this.props.type),
257
+ controlOnly: this.props.controlOnly,
258
+ className: this.props.className
259
+ });
260
+ break;
261
+ case "boolean":
262
+ t = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiSelect, {
263
+ options: [
264
+ {
265
+ value: void 0,
266
+ text: this.props.placeholder
267
+ },
268
+ {
269
+ value: "true",
270
+ text: "true"
271
+ },
272
+ {
273
+ value: "false",
274
+ text: "false"
275
+ }
276
+ ],
277
+ value: e,
278
+ onChange: this.onBoolChange,
279
+ className: this.props.className
280
+ });
281
+ break;
282
+ default: break;
283
+ }
284
+ return t;
285
+ }
286
+ onBoolChange = (e) => {
287
+ let t = e.target.value === "true";
288
+ this.props.onChange(t);
289
+ };
290
+ onChange = (e) => {
291
+ let t = e.target.value;
292
+ this.props.onChange(t);
293
+ };
294
+ onBlur = (e) => {
295
+ if (this.props.onBlur) {
296
+ let t = e.target.value;
297
+ this.props.onBlur(t);
298
+ }
299
+ };
300
+ };
301
+ var import_lodash$8 = require_lodash(), PhraseValueInputUI = class extends PhraseSuggestorUI {
302
+ render() {
303
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFormRow, {
304
+ label: "Value",
305
+ children: this.isSuggestingValues() ? this.renderWithSuggestions() : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ValueInputType, {
306
+ placeholder: "Enter a value",
307
+ value: this.props.value,
308
+ onChange: this.props.onChange,
309
+ type: this.props.field ? this.props.field.type : "string"
310
+ })
311
+ });
312
+ }
313
+ renderWithSuggestions() {
314
+ let e = Array.isArray(this.state.suggestions) ? this.state.suggestions : [], { value: t, intl: n, onChange: r } = this.props, i = String(t);
315
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StringComboBox$1, {
316
+ placeholder: "Select a value",
317
+ options: t ? (0, import_lodash$8.uniq)([i, ...e]) : e,
318
+ getLabel: (e) => e,
319
+ selectedOptions: t ? [i] : [],
320
+ onChange: ([e = ""]) => r(e),
321
+ onSearchChange: this.onSearchChange,
322
+ singleSelection: { asPlainText: !0 },
323
+ onCreateOption: r,
324
+ isClearable: !1,
325
+ "data-test-subj": "filterParamsComboBox phraseParamsComboxBox"
326
+ });
327
+ }
328
+ };
329
+ function StringComboBox$1(e) {
330
+ return GenericComboBox(e);
331
+ }
332
+ const PhraseValueInput = withKibana(PhraseValueInputUI);
333
+ var import_lodash$7 = require_lodash(), PhrasesValuesInputUI = class extends PhraseSuggestorUI {
334
+ render() {
335
+ let { suggestions: e } = this.state, { values: t, intl: n, onChange: r } = this.props;
336
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFormRow, {
337
+ label: "Values",
338
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StringComboBox, {
339
+ placeholder: "Select values",
340
+ options: t ? (0, import_lodash$7.uniq)([...t, ...e]) : e,
341
+ getLabel: (e) => e,
342
+ selectedOptions: t || [],
343
+ onSearchChange: this.onSearchChange,
344
+ onCreateOption: (e) => r([...t || [], e]),
345
+ onChange: r,
346
+ isClearable: !1,
347
+ "data-test-subj": "filterParamsComboBox phrasesParamsComboxBox"
348
+ })
349
+ });
350
+ }
351
+ };
352
+ function StringComboBox(e) {
353
+ return GenericComboBox(e);
354
+ }
355
+ const PhrasesValuesInput = withKibana(PhrasesValuesInputUI);
356
+ init_moment();
357
+ var import_lodash$6 = require_lodash();
358
+ function RangeValueInputUI(e) {
359
+ useKibana();
360
+ let t = e.field ? e.field.type : "string", n = (e) => {
361
+ if (typeof e != "string" && typeof e != "number") return e;
362
+ let t = moment_default(e).tz("Browser");
363
+ return t.isValid() ? t?.format("YYYY-MM-DDTHH:mm:ss.SSSZ") : e;
364
+ }, r = (t) => {
365
+ if (typeof t != "string" && typeof t != "number") throw Error("Range params must be a string or number");
366
+ e.onChange({
367
+ from: t,
368
+ to: (0, import_lodash$6.get)(e, "value.to")
369
+ });
370
+ }, a = (t) => {
371
+ if (typeof t != "string" && typeof t != "number") throw Error("Range params must be a string or number");
372
+ e.onChange({
373
+ from: (0, import_lodash$6.get)(e, "value.from"),
374
+ to: t
375
+ });
376
+ };
377
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFormControlLayoutDelimited, {
378
+ "aria-label": "Range",
379
+ startControl: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ValueInputType, {
380
+ controlOnly: !0,
381
+ type: t,
382
+ value: e.value ? e.value.from : void 0,
383
+ onChange: r,
384
+ onBlur: (e) => {
385
+ r(n(e));
386
+ },
387
+ placeholder: "Start of the range"
388
+ }),
389
+ endControl: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ValueInputType, {
390
+ controlOnly: !0,
391
+ type: t,
392
+ value: e.value ? e.value.to : void 0,
393
+ onChange: a,
394
+ onBlur: (e) => {
395
+ a(n(e));
396
+ },
397
+ placeholder: "End of the range"
398
+ })
399
+ }) });
400
+ }
401
+ const RangeValueInput = RangeValueInputUI;
402
+ var import_lodash$5 = require_lodash(), FilterEditorUI = class extends Component {
403
+ constructor(e) {
404
+ super(e), this.state = {
405
+ selectedIndexPattern: this.getIndexPatternFromFilter(),
406
+ selectedField: this.getFieldFromFilter(),
407
+ selectedOperator: this.getSelectedOperator(),
408
+ params: getFilterParams(e.filter),
409
+ useCustomLabel: e.filter.meta.alias !== null,
410
+ customLabel: e.filter.meta.alias,
411
+ queryDsl: JSON.stringify(cleanFilter(e.filter), null, 2),
412
+ isCustomEditorOpen: this.isUnknownFilterType()
413
+ };
414
+ }
415
+ render() {
416
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
417
+ className: "ant-popover-title !p-12px !uppercase !mb-0 !border-b-1px !border-b-solid !border-[var(--ant-color-border)] flex items-center justify-between",
418
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Edit filter" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
419
+ className: "h-auto px-0",
420
+ type: "link",
421
+ onClick: this.toggleCustomEditor,
422
+ children: this.state.isCustomEditorOpen ? "Edit filter values" : "Edit as Query DSL"
423
+ })]
424
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
425
+ className: "globalFilterItem__editorForm",
426
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EuiForm, { children: [
427
+ this.renderIndexPatternInput(),
428
+ this.state.isCustomEditorOpen ? this.renderCustomEditor() : this.renderRegularEditor(),
429
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiSpacer, { size: "m" }),
430
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
431
+ className: "flex items-center gap-8px",
432
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Switch, {
433
+ size: "small",
434
+ id: "filterEditorCustomLabelSwitch",
435
+ checked: this.state.useCustomLabel,
436
+ onChange: this.onCustomLabelSwitchChange
437
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Create custom label?" })]
438
+ }),
439
+ this.state.useCustomLabel && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiSpacer, { size: "m" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFormRow, {
440
+ label: "Custom label",
441
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFieldText, {
442
+ value: `${this.state.customLabel}`,
443
+ onChange: this.onCustomLabelChange
444
+ })
445
+ })] }),
446
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
447
+ className: "mt-16px text-right",
448
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
449
+ className: "w-80px",
450
+ size: "large",
451
+ type: "text",
452
+ onClick: this.props.onCancel,
453
+ children: "Cancel"
454
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
455
+ className: "w-80px",
456
+ size: "large",
457
+ type: "primary",
458
+ onClick: this.onSubmit,
459
+ disabled: !this.isFilterValid(),
460
+ children: "Save"
461
+ })]
462
+ })
463
+ ] })
464
+ })] });
465
+ }
466
+ renderIndexPatternInput() {
467
+ if (this.props.indexPatterns.length <= 1 && this.props.indexPatterns.find((e) => e === this.getIndexPatternFromFilter())) return "";
468
+ let { selectedIndexPattern: e } = this.state;
469
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFlexGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFormRow, {
470
+ label: "Index Pattern",
471
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IndexPatternComboBox, {
472
+ placeholder: "Select an index pattern",
473
+ options: this.props.indexPatterns,
474
+ selectedOptions: e ? [e] : [],
475
+ getLabel: (e) => e.title,
476
+ onChange: this.onIndexPatternChange,
477
+ singleSelection: { asPlainText: !0 },
478
+ isClearable: !1,
479
+ "data-test-subj": "filterIndexPatternsSelect"
480
+ })
481
+ }) }) });
482
+ }
483
+ renderRegularEditor() {
484
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
485
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EuiFlexGroup, {
486
+ responsive: !1,
487
+ gutterSize: "s",
488
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFlexItem, {
489
+ grow: 2,
490
+ children: this.renderFieldInput()
491
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFlexItem, {
492
+ grow: !1,
493
+ style: { flexBasis: 160 },
494
+ children: this.renderOperatorInput()
495
+ })]
496
+ }),
497
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiSpacer, { size: "s" }),
498
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
499
+ "data-test-subj": "filterParams",
500
+ children: this.renderParamsEditor()
501
+ })
502
+ ] });
503
+ }
504
+ renderFieldInput() {
505
+ let { selectedIndexPattern: e, selectedField: t } = this.state, n = e ? getFilterableFields(e) : [];
506
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFormRow, {
507
+ label: "Field",
508
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldComboBox, {
509
+ id: "fieldInput",
510
+ isDisabled: !e,
511
+ placeholder: "Select a field first",
512
+ options: n,
513
+ selectedOptions: t ? [t] : [],
514
+ getLabel: (e) => e.name,
515
+ onChange: this.onFieldChange,
516
+ singleSelection: { asPlainText: !0 },
517
+ isClearable: !1,
518
+ className: "globalFilterEditor__fieldInput",
519
+ "data-test-subj": "filterFieldSuggestionList"
520
+ })
521
+ });
522
+ }
523
+ renderOperatorInput() {
524
+ let { selectedField: e, selectedOperator: t } = this.state, n = e ? getOperatorOptions(e) : [];
525
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFormRow, {
526
+ label: "Operator",
527
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OperatorComboBox, {
528
+ isDisabled: !e,
529
+ placeholder: e ? "Select" : "Waiting",
530
+ options: n,
531
+ selectedOptions: t ? [t] : [],
532
+ getLabel: ({ message: e }) => e,
533
+ onChange: this.onOperatorChange,
534
+ singleSelection: { asPlainText: !0 },
535
+ isClearable: !1,
536
+ "data-test-subj": "filterOperatorList"
537
+ })
538
+ });
539
+ }
540
+ renderCustomEditor() {
541
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFormRow, {
542
+ label: "Query DSL",
543
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ft, {
544
+ value: this.state.queryDsl,
545
+ onChange: (e) => this.onQueryDslChange(e || ""),
546
+ language: "json",
547
+ width: "100%",
548
+ height: "250px"
549
+ })
550
+ });
551
+ }
552
+ renderParamsEditor() {
553
+ let e = this.state.selectedIndexPattern;
554
+ if (!e || !this.state.selectedOperator) return "";
555
+ switch (this.state.selectedOperator.type) {
556
+ case "exists": return "";
557
+ case "phrase": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PhraseValueInput, {
558
+ indexPattern: e,
559
+ field: this.state.selectedField,
560
+ value: this.state.params,
561
+ onChange: this.onParamsChange,
562
+ "data-test-subj": "phraseValueInput",
563
+ services: this.props.services,
564
+ dateRangeFrom: this.props.dateRangeFrom,
565
+ dateRangeTo: this.props.dateRangeTo,
566
+ timeField: this.props.timeField
567
+ });
568
+ case "phrases": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PhrasesValuesInput, {
569
+ indexPattern: e,
570
+ field: this.state.selectedField,
571
+ values: this.state.params,
572
+ onChange: this.onParamsChange,
573
+ services: this.props.services,
574
+ dateRangeFrom: this.props.dateRangeFrom,
575
+ dateRangeTo: this.props.dateRangeTo,
576
+ timeField: this.props.timeField
577
+ });
578
+ case "range": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RangeValueInput, {
579
+ field: this.state.selectedField,
580
+ value: this.state.params,
581
+ onChange: this.onParamsChange
582
+ });
583
+ }
584
+ }
585
+ toggleCustomEditor = () => {
586
+ let e = !this.state.isCustomEditorOpen;
587
+ this.setState({ isCustomEditorOpen: e });
588
+ };
589
+ isUnknownFilterType() {
590
+ let { type: e } = this.props.filter.meta;
591
+ return !!e && ![
592
+ "phrase",
593
+ "phrases",
594
+ "range",
595
+ "exists"
596
+ ].includes(e);
597
+ }
598
+ getIndexPatternFromFilter() {
599
+ return getIndexPatternFromFilter(this.props.filter, this.props.indexPatterns);
600
+ }
601
+ getFieldFromFilter() {
602
+ let e = this.getIndexPatternFromFilter();
603
+ return e && getFieldFromFilter(this.props.filter, e);
604
+ }
605
+ getSelectedOperator() {
606
+ return getOperatorFromFilter(this.props.filter);
607
+ }
608
+ isFilterValid() {
609
+ let { isCustomEditorOpen: e, queryDsl: t, selectedIndexPattern: n, selectedField: r, selectedOperator: i, params: a } = this.state;
610
+ if (e) try {
611
+ return !!JSON.parse(t);
612
+ } catch {
613
+ return !1;
614
+ }
615
+ return isFilterValid(n, r, i, a);
616
+ }
617
+ onIndexPatternChange = ([e]) => {
618
+ this.setState({
619
+ selectedIndexPattern: e,
620
+ selectedField: void 0,
621
+ selectedOperator: void 0,
622
+ params: void 0
623
+ });
624
+ };
625
+ onFieldChange = ([e]) => {
626
+ this.setState({
627
+ selectedField: e,
628
+ selectedOperator: void 0,
629
+ params: void 0
630
+ });
631
+ };
632
+ onOperatorChange = ([e]) => {
633
+ let t = (0, import_lodash$5.get)(this.state.selectedOperator, "type") === (0, import_lodash$5.get)(e, "type") ? this.state.params : void 0;
634
+ this.setState({
635
+ selectedOperator: e,
636
+ params: t
637
+ });
638
+ };
639
+ onCustomLabelSwitchChange = (e) => {
640
+ let t = e, n = e ? "" : null;
641
+ this.setState({
642
+ useCustomLabel: t,
643
+ customLabel: n
644
+ });
645
+ };
646
+ onCustomLabelChange = (e) => {
647
+ let t = e.target.value;
648
+ this.setState({ customLabel: t });
649
+ };
650
+ onParamsChange = (e) => {
651
+ this.setState({ params: e });
652
+ };
653
+ onQueryDslChange = (e) => {
654
+ this.setState({ queryDsl: e });
655
+ };
656
+ onSubmit = () => {
657
+ let { selectedIndexPattern: e, selectedField: t, selectedOperator: n, params: r, useCustomLabel: i, customLabel: a, isCustomEditorOpen: o, queryDsl: s } = this.state, { $state: c } = this.props.filter;
658
+ if (!c || !c.store) return;
659
+ let l = i ? a : null;
660
+ if (o) {
661
+ let { index: e, disabled: t, negate: n } = this.props.filter.meta, r = buildCustomFilter(e || this.props.indexPatterns[0].id, JSON.parse(s), t, n, l, c.store);
662
+ this.props.onSubmit(r);
663
+ } else if (e && t && n) {
664
+ let i = buildFilter(e, t, n.type, n.negate, this.props.filter.meta.disabled, r ?? "", l, c.store);
665
+ this.props.onSubmit(i);
666
+ }
667
+ };
668
+ };
669
+ function IndexPatternComboBox(e) {
670
+ return GenericComboBox(e);
671
+ }
672
+ function FieldComboBox(e) {
673
+ return GenericComboBox(e);
674
+ }
675
+ function OperatorComboBox(e) {
676
+ return GenericComboBox(e);
677
+ }
678
+ const FilterEditor = FilterEditorUI, FilterView = ({ filter: e, iconOnClick: t, onClick: n, valueLabel: r, errorMessage: i, filterLabelStatus: a, ...s }) => {
679
+ let [c, l] = useInnerText(), u = i || `Filter: ${l}. Select for more filter actions.`;
680
+ return isFilterPinned(e) && (u = `'Pinned', ${u}`), e.meta.disabled && (u = `'Disabled', ${u}`), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiBadge, {
681
+ title: u,
682
+ color: "hollow",
683
+ iconType: "cross",
684
+ iconSide: "right",
685
+ closeButtonProps: { tabIndex: -1 },
686
+ iconOnClick: t,
687
+ iconOnClickAriaLabel: "Delete",
688
+ onClick: n,
689
+ onClickAriaLabel: "Filter actions",
690
+ ...s,
691
+ className: "!p-6px !rounded-6px !border-[var(--ant-color-border)]",
692
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
693
+ ref: c,
694
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterLabel, {
695
+ filter: e,
696
+ valueLabel: r,
697
+ filterLabelStatus: a
698
+ })
699
+ })
700
+ });
701
+ };
702
+ var FILTER_ITEM_OK = "", FILTER_ITEM_WARNING = "warn", FILTER_ITEM_ERROR = "error";
703
+ function FilterItem(e) {
704
+ let [t, n] = useState(!1), [r, i] = useState(!1), [o, s] = useState(void 0), { id: c, filter: l, indexPatterns: u } = e;
705
+ useEffect(() => {
706
+ let t = e.filter.meta.index;
707
+ t ? getIndexPatterns().get(t).then((e) => {
708
+ s(!!e);
709
+ }).catch(() => {
710
+ s(!1);
711
+ }) : s(!0);
712
+ }, [e.filter.meta.index]);
713
+ function d(t) {
714
+ n(!1), e.onUpdate(t);
715
+ }
716
+ function f() {
717
+ let t = toggleFilterPinned(l);
718
+ e.onUpdate(t);
719
+ }
720
+ function p() {
721
+ let t = toggleFilterNegated(l);
722
+ e.onUpdate(t);
723
+ }
724
+ function h() {
725
+ let t = toggleFilterDisabled(l);
726
+ e.onUpdate(t);
727
+ }
728
+ function g(e) {
729
+ return e.status === FILTER_ITEM_OK;
730
+ }
731
+ function _(e) {
732
+ let { disabled: t } = l.meta;
733
+ return t || e.status === FILTER_ITEM_ERROR;
734
+ }
735
+ function v(t, n) {
736
+ return (0, import_classnames$2.default)("globalFilterItem", {
737
+ "globalFilterItem-isDisabled": _(n),
738
+ "globalFilterItem-isError": n.status === FILTER_ITEM_ERROR,
739
+ "globalFilterItem-isWarning": n.status === FILTER_ITEM_WARNING,
740
+ "globalFilterItem-isPinned": isFilterPinned(l),
741
+ "globalFilterItem-isExcluded": t
742
+ }, e.className);
743
+ }
744
+ function y(e) {
745
+ let t = l.meta.key ? `filter-key-${l.meta.key}` : "", n = l.meta.value ? `filter-value-${g(e) ? e.title : e.status}` : "", r = l.meta.negate ? "filter-negated" : "";
746
+ return `filter ${`filter-${_(e) ? "disabled" : "enabled"}`} ${t} ${n} ${`filter-${isFilterPinned(l) ? "pinned" : "unpinned"}`} ${r}`;
747
+ }
748
+ function b() {
749
+ return !e.indexPatterns.length || getIndexPatternFromFilter(l, u) ? !0 : u.map((e) => e.fields.map((e) => e.name)).reduce((e, t) => [...e, ...t], []).includes(l.meta?.key || "");
750
+ }
751
+ function x() {
752
+ let e = {
753
+ title: "",
754
+ message: "",
755
+ status: FILTER_ITEM_OK
756
+ };
757
+ if (o === !1) e.status = FILTER_ITEM_ERROR, e.title = "Error", e.message = "Index pattern not found";
758
+ else if (b()) try {
759
+ e.title = getDisplayValueFromFilter(l, u);
760
+ } catch (t) {
761
+ e.status = FILTER_ITEM_ERROR, e.title = "Error", e.message = t.message;
762
+ }
763
+ else e.status = FILTER_ITEM_WARNING, e.title = "Warning", e.message = "Field {filter.meta.key} does not exist in current view";
764
+ return e;
765
+ }
766
+ if (o === void 0) return null;
767
+ let S = x();
768
+ if (S.status === FILTER_ITEM_ERROR && !l.meta.disabled) return l.meta.disabled = !0, e.onUpdate(l), null;
769
+ let C = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterView, {
770
+ filter: l,
771
+ valueLabel: S.title,
772
+ filterLabelStatus: S.status,
773
+ errorMessage: S.message,
774
+ className: v(l.meta.negate, S),
775
+ iconOnClick: () => e.onRemove(),
776
+ onClick: () => {},
777
+ "data-test-subj": y(S)
778
+ }), { negate: E, disabled: D, index: k } = l.meta;
779
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Popover, {
780
+ classNames: { container: `!p-0 !overflow-hidden ${r ? "w-400px" : "w-256px"}` },
781
+ placement: "bottomLeft",
782
+ open: t,
783
+ onOpenChange: (e) => {
784
+ e || i(!1), n(e);
785
+ },
786
+ content: r ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterEditor, {
787
+ filter: l,
788
+ indexPatterns: u,
789
+ onSubmit: d,
790
+ onCancel: () => {
791
+ n(!1);
792
+ },
793
+ services: e.services
794
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu, {
795
+ className: "!border-0",
796
+ classNames: { item: "!m-0 !px-12px !w-full !rounded-0" },
797
+ mode: "vertical",
798
+ items: [
799
+ {
800
+ key: "pin",
801
+ label: isFilterPinned(l) ? "Unpin" : "Pin across all apps",
802
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pin, { className: "w-14px h-14px" }),
803
+ onClick: () => {
804
+ n(!1), f();
805
+ }
806
+ },
807
+ k && {
808
+ key: "edit",
809
+ label: "Edit filter",
810
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pencil, { className: "w-14px h-14px" }),
811
+ onClick: () => {
812
+ i(!0), f();
813
+ }
814
+ },
815
+ {
816
+ key: "include_exclude",
817
+ label: E ? "Include results" : "Exclude results",
818
+ icon: E ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CirclePlus, { className: "w-14px h-14px" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleMinus, { className: "w-14px h-14px" }),
819
+ onClick: () => {
820
+ n(!1), p();
821
+ }
822
+ },
823
+ {
824
+ key: "enable_disabled",
825
+ label: D ? "Re-enable" : "Temporarily disable",
826
+ icon: D ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Eye, { className: "w-14px h-14px" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EyeOff, { className: "w-14px h-14px" }),
827
+ onClick: () => {
828
+ n(!1), h();
829
+ }
830
+ },
831
+ {
832
+ key: "delete",
833
+ label: "Delete",
834
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "w-14px h-14px" }),
835
+ onClick: () => {
836
+ n(!1), e.onRemove();
837
+ }
838
+ }
839
+ ].filter((e) => !!e)
840
+ }),
841
+ title: null,
842
+ trigger: "click",
843
+ destroyOnHidden: !0,
844
+ arrow: !1,
845
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
846
+ className: "!p-0 !border-0 !outline-0 !shadow-none",
847
+ children: C
848
+ })
849
+ });
850
+ }
851
+ var import_classnames$1 = /* @__PURE__ */ __toESM(require_classnames(), 1);
852
+ function FilterBarUI(e) {
853
+ function t(t) {
854
+ e.onFiltersUpdated && e.onFiltersUpdated(t);
855
+ }
856
+ function n() {
857
+ return e.filters.map((t, n) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFlexItem, {
858
+ grow: !1,
859
+ className: "globalFilterBar__flexItem",
860
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterItem, {
861
+ id: `${n}`,
862
+ intl: e.intl,
863
+ filter: t,
864
+ onUpdate: (e) => i(n, e),
865
+ onRemove: () => r(n),
866
+ indexPatterns: e.indexPatterns,
867
+ services: e.services
868
+ })
869
+ }, n));
870
+ }
871
+ function r(n) {
872
+ let r = [...e.filters];
873
+ r.splice(n, 1), t(r);
874
+ }
875
+ function i(n, r) {
876
+ let i = [...e.filters];
877
+ i[n] = r, t(i);
878
+ }
879
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFlexGroup, {
880
+ className: "globalFilterGroup",
881
+ gutterSize: "none",
882
+ alignItems: "flexStart",
883
+ responsive: !1,
884
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFlexItem, {
885
+ className: "globalFilterGroup__filterFlexItem",
886
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EuiFlexGroup, {
887
+ className: (0, import_classnames$1.default)("globalFilterBar", e.className),
888
+ wrap: !0,
889
+ responsive: !1,
890
+ gutterSize: "xs",
891
+ alignItems: "center",
892
+ children: n()
893
+ })
894
+ })
895
+ });
896
+ }
897
+ const FilterBar = FilterBarUI;
898
+ var Loading_module_default = {
899
+ loading: "_loading_16hnu_1",
900
+ tips: "_tips_16hnu_13"
901
+ }, Loading_default = (e) => {
902
+ let { loading: t = !0, currentLocales: n } = e;
903
+ return t ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
904
+ className: Loading_module_default.loading,
905
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, { tip: n["dropdownlist.loading"] })
906
+ }) : null;
907
+ }, Error_module_default = {
908
+ error: "_error_1fev3_1",
909
+ tips: "_tips_1fev3_14"
910
+ }, Error_default = (e) => {
911
+ let { currentLocales: t, failed: n = !0 } = e;
912
+ return n ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
913
+ className: Error_module_default.error,
914
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { component: CloseCircleOutlined }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
915
+ className: Error_module_default.tips,
916
+ children: t["dropdownlist.loading.failed"]
917
+ })]
918
+ }) : null;
919
+ }, Empty_module_default = { empty: "_empty_1bf3s_1" }, Empty_default = (e) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
920
+ className: Empty_module_default.empty,
921
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, { image: Empty.PRESENTED_IMAGE_SIMPLE })
922
+ }), List_module_default = {
923
+ container: "_container_f1ixt_1",
924
+ group: "_group_f1ixt_5",
925
+ item: "_item_f1ixt_11",
926
+ selected: "_selected_f1ixt_21",
927
+ label: "_label_f1ixt_27",
928
+ icon: "_icon_f1ixt_32",
929
+ content: "_content_f1ixt_35",
930
+ search: "_search_f1ixt_40",
931
+ tools: "_tools_f1ixt_43",
932
+ result: "_result_f1ixt_49",
933
+ actions: "_actions_f1ixt_53",
934
+ listWrapper: "_listWrapper_f1ixt_76",
935
+ list: "_list_f1ixt_76",
936
+ tag: "_tag_f1ixt_103",
937
+ disabled: "_disabled_f1ixt_106",
938
+ footerWrapper: "_footerWrapper_f1ixt_110",
939
+ footer: "_footer_f1ixt_110",
940
+ pager: "_pager_f1ixt_122",
941
+ pageNum: "_pageNum_f1ixt_122",
942
+ filterPopover: "_filterPopover_f1ixt_137",
943
+ sorter: "_sorter_f1ixt_146",
944
+ title: "_title_f1ixt_149",
945
+ form: "_form_f1ixt_153",
946
+ filters: "_filters_f1ixt_163",
947
+ clear: "_clear_f1ixt_174",
948
+ options: "_options_f1ixt_185",
949
+ option: "_option_f1ixt_185"
950
+ }, import_lodash$4 = require_lodash(), List_default = (e) => {
951
+ let { visible: t, value: n, onChange: r, loading: i = !1, failed: a = !1, rowKey: o, renderItem: s, renderTag: c, renderEmptyList: l, onSearchChange: u, searchValue: d, sorterOptions: f, pagination: p, data: m, sorter: h, onSorterChange: g, filters: _, onFiltersChange: v, filterOptions: y, groups: b, onGroupsChange: x, groupOptions: S, currentLocales: C, showGroup: w, onShowGroupChange: T, isMultiple: E, extraData: D = [], searchPlaceholder: O, onRefresh: k, actions: A = [] } = e, [j, M] = useState([]), [N, P] = useState(!1), F = useRef(null), I = useCallback(() => {
952
+ setTimeout(() => {
953
+ T(!1), u();
954
+ }, 500);
955
+ }, [T, u]), z = (e) => {
956
+ if (!e.disabled) if (E) {
957
+ let t = (0, import_lodash$4.cloneDeep)(n) || [], i = t.findIndex((t) => t[o] === e[o]);
958
+ i === -1 ? t.push(e) : t.splice(i, 1), r(t);
959
+ } else r(e);
960
+ }, V = () => {
961
+ T(!w);
962
+ }, U = (e, t) => {
963
+ let n = [...b];
964
+ n[e]?.value === t.value ? n.splice(e, 1) : n[e] = {
965
+ key: t.key,
966
+ value: t.value
967
+ }, n.splice(e + 1, n.length), x(n);
968
+ }, W = (e) => {
969
+ u(e.trim());
970
+ }, G = (e, t) => {
971
+ let n = [...j];
972
+ n[t] = e, M(n);
973
+ }, K = (e, t, n) => {
974
+ let r = (0, import_lodash$4.cloneDeep)(_), i = r[e] || [], a = i.indexOf(t);
975
+ a === -1 ? n && i.push(t) : n || i.splice(a, 1), r[e] = i, v(r);
976
+ }, q = (e) => {
977
+ let t = (0, import_lodash$4.cloneDeep)(n || []);
978
+ m.forEach((n) => {
979
+ if (n.disabled) return;
980
+ let r = t.findIndex((e) => e[o] === n[o]);
981
+ r === -1 && e ? t.push(n) : r !== -1 && !e && t.splice(r, 1);
982
+ }), r(t);
983
+ };
984
+ useEffect(() => {
985
+ F.current && t && F.current.focus();
986
+ }, [t, F]), useEffect(() => {
987
+ t || I();
988
+ }, [t, I]), useEffect(() => {
989
+ M(h);
990
+ }, [h]);
991
+ let { currentPage: J, pageSize: Y, total: X, pages: Z } = p, Q = useMemo(() => b[0] === void 0 ? [] : S.find((e) => e.value === b[0].value)?.list || [], [S, b]), $ = useMemo(() => {
992
+ if (!E) return !1;
993
+ if (E) return n?.length === 0 ? !1 : m.every((e) => n.findIndex((t) => t[o] === e[o]) !== -1) ? !0 : m.some((e) => n.findIndex((t) => t[o] === e[o]) !== -1) ? "indeterminate" : !1;
994
+ }, [
995
+ E,
996
+ JSON.stringify(m),
997
+ JSON.stringify(n)
998
+ ]), Gt = (e, t) => !w || e.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
999
+ className: List_module_default.group,
1000
+ children: e.map((e) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1001
+ className: `${List_module_default.item} ${b[t]?.value === e.value ? List_module_default.selected : ""}`,
1002
+ onClick: () => U(t, e),
1003
+ title: e.label,
1004
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1005
+ className: List_module_default.label,
1006
+ children: e.label
1007
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
1008
+ component: RightOutlined,
1009
+ className: List_module_default.icon
1010
+ })]
1011
+ }, e.value))
1012
+ }), Kt = A.concat(k ? [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
1013
+ disabled: i,
1014
+ onClick: () => {
1015
+ i || k();
1016
+ },
1017
+ children: C["dropdownlist.refresh"]
1018
+ })] : []);
1019
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1020
+ className: `${List_module_default.container} css-var-r0`,
1021
+ children: [
1022
+ Gt(S, 0),
1023
+ Gt(Q, 1),
1024
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1025
+ className: List_module_default.content,
1026
+ children: [
1027
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, {
1028
+ ref: F,
1029
+ value: d,
1030
+ onChange: (e) => {
1031
+ if (!i) {
1032
+ let t = e.target.value;
1033
+ W(t);
1034
+ }
1035
+ },
1036
+ allowClear: !0,
1037
+ className: List_module_default.search,
1038
+ placeholder: O || C["dropdownlist.search.placeholder"]
1039
+ }),
1040
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1041
+ className: List_module_default.tools,
1042
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1043
+ className: List_module_default.result,
1044
+ children: [
1045
+ C["dropdownlist.result.found"],
1046
+ " ",
1047
+ p === !1 ? m.length : X,
1048
+ " ",
1049
+ C["dropdownlist.result.records"]
1050
+ ]
1051
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1052
+ className: List_module_default.actions,
1053
+ children: [
1054
+ f.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Popover, {
1055
+ open: N,
1056
+ onOpenChange: P,
1057
+ overlayClassName: List_module_default.filterPopover,
1058
+ placement: "bottom",
1059
+ trigger: "click",
1060
+ content: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1061
+ className: List_module_default.sorter,
1062
+ children: [
1063
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1064
+ className: List_module_default.title,
1065
+ children: C["dropdownlist.sort.by"]
1066
+ }),
1067
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1068
+ className: List_module_default.form,
1069
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select, {
1070
+ value: j[0],
1071
+ style: { width: "65%" },
1072
+ onChange: (e) => G(e, 0),
1073
+ children: f.map((e) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select.Option, {
1074
+ value: e.key,
1075
+ children: e.label
1076
+ }, e.key))
1077
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, {
1078
+ value: j[1],
1079
+ style: { width: "35%" },
1080
+ onChange: (e) => G(e, 1),
1081
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select.Option, {
1082
+ value: "desc",
1083
+ children: C["dropdownlist.sort.by.desc"]
1084
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select.Option, {
1085
+ value: "asc",
1086
+ children: C["dropdownlist.sort.by.asc"]
1087
+ })]
1088
+ })]
1089
+ }),
1090
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1091
+ className: List_module_default.actions,
1092
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1093
+ type: "link",
1094
+ onClick: () => {
1095
+ g([]), P(!1);
1096
+ },
1097
+ children: C["dropdownlist.sort.by.clear"]
1098
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1099
+ style: { width: 80 },
1100
+ type: "primary",
1101
+ onClick: () => {
1102
+ g(j), P(!1);
1103
+ },
1104
+ children: C["dropdownlist.apply"]
1105
+ })]
1106
+ })
1107
+ ]
1108
+ }),
1109
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
1110
+ style: { cursor: "pointer" },
1111
+ component: SortAscendingOutlined
1112
+ })
1113
+ }),
1114
+ y.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Popover, {
1115
+ overlayClassName: List_module_default.filterPopover,
1116
+ placement: "bottom",
1117
+ trigger: "click",
1118
+ content: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1119
+ className: List_module_default.filters,
1120
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1121
+ className: List_module_default.title,
1122
+ children: [C["dropdownlist.filters"], /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
1123
+ className: List_module_default.clear,
1124
+ component: ReloadOutlined,
1125
+ onClick: () => {
1126
+ v({});
1127
+ }
1128
+ })]
1129
+ }), y.map((e) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1130
+ className: List_module_default.content,
1131
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1132
+ className: List_module_default.label,
1133
+ children: e.label
1134
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1135
+ className: List_module_default.options,
1136
+ children: (e.list || []).map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1137
+ className: List_module_default.option,
1138
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox, {
1139
+ onChange: (n) => K(e.key, t.value, n.target.checked),
1140
+ checked: (_[e.key] || []).indexOf(t.value) !== -1,
1141
+ children: t.label || t.value
1142
+ }), t.count !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: t.count })]
1143
+ }, t.value))
1144
+ })]
1145
+ }, e.key))]
1146
+ }),
1147
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
1148
+ style: { cursor: "pointer" },
1149
+ component: FilterOutlined
1150
+ })
1151
+ }),
1152
+ S.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
1153
+ style: { cursor: "pointer" },
1154
+ component: LayoutOutlined,
1155
+ onClick: V
1156
+ }),
1157
+ E && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox, {
1158
+ indeterminate: $ === "indeterminate",
1159
+ onChange: (e) => q(e.target.checked),
1160
+ checked: $ === !0
1161
+ })
1162
+ ]
1163
+ })]
1164
+ }),
1165
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1166
+ className: List_module_default.listWrapper,
1167
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1168
+ className: List_module_default.list,
1169
+ style: { maxHeight: `${32 * (Y + D.length)}px` },
1170
+ children: i ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading_default, { currentLocales: C }) : a ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Error_default, { currentLocales: C }) : m.length === 0 && D.length === 0 ? l ? l() : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty_default, {}) : D.concat(m).map((e) => {
1171
+ let t = E ? (n || []).findIndex((t) => t[o] === e[o]) !== -1 : n?.[o] === e[o];
1172
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1173
+ className: `${List_module_default.item} ${t ? List_module_default.selected : ""} ${e.disabled ? List_module_default.disabled : ""}`,
1174
+ onClick: () => z(e),
1175
+ children: [
1176
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1177
+ className: List_module_default.label,
1178
+ children: s ? s(e) : e[o]
1179
+ }),
1180
+ c && !w ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1181
+ className: List_module_default.tag,
1182
+ children: s ? c(e) : e[o]
1183
+ }) : null,
1184
+ t && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { component: CheckOutlined })
1185
+ ]
1186
+ }, e[o]);
1187
+ })
1188
+ })
1189
+ }),
1190
+ p === !1 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1191
+ className: List_module_default.footerWrapper,
1192
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1193
+ className: List_module_default.footer,
1194
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1195
+ className: List_module_default.actions,
1196
+ children: Kt.map((e, t) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Fragment, { children: [e, t !== Kt.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Divider, { orientation: "vertical" })] }, t))
1197
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1198
+ className: List_module_default.pager,
1199
+ children: [
1200
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
1201
+ onClick: () => p.onChange(J - 1),
1202
+ component: LeftOutlined,
1203
+ className: `${List_module_default.icon} ${J <= 1 ? List_module_default.disabled : ""}`
1204
+ }),
1205
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1206
+ className: List_module_default.pageNum,
1207
+ children: [
1208
+ J,
1209
+ "/",
1210
+ Z
1211
+ ]
1212
+ }),
1213
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
1214
+ onClick: () => p.onChange(J + 1),
1215
+ component: RightOutlined,
1216
+ className: `${List_module_default.icon} ${J >= Z ? List_module_default.disabled : ""}`
1217
+ })
1218
+ ]
1219
+ })]
1220
+ })
1221
+ })
1222
+ ]
1223
+ })
1224
+ ]
1225
+ });
1226
+ }, import_lodash$3 = require_lodash(), AutoList_default = (e) => {
1227
+ let { visible: t, data: n = [], pagination: r, searchKey: i, searchValue: a, sorter: o, filters: s, groups: c } = e, [l, u] = useState(), d = (e) => {
1228
+ let { pages: t } = l;
1229
+ e < 0 || e > t || u({
1230
+ ...l,
1231
+ currentPage: e
1232
+ });
1233
+ }, f = useMemo(() => {
1234
+ let e = (0, import_lodash$3.cloneDeep)(n);
1235
+ i && a && (e = e.filter((e) => `${e[i] || ""}`.toLowerCase().indexOf(a.toLowerCase()) !== -1)), c.filter((e) => e.value !== void 0 && e.value !== "" && !!e.key).forEach((t) => {
1236
+ e = e.filter((e) => e.hasOwnProperty(t.key) ? e[t.key] === t.value : !0);
1237
+ });
1238
+ let t = Object.keys(s);
1239
+ if (t.length > 0 && t.filter((e) => (s[e] || []).length !== 0).forEach((t) => {
1240
+ e = e.filter((e) => s[t].indexOf(e[t]) !== -1);
1241
+ }), o.length >= 2 && o[0] && o[1]) {
1242
+ let t = o[0], n = o[1];
1243
+ e = e.sort((e, r) => typeof e[t] == "string" ? n === "desc" ? r[t].localeCompare(e[t]) : e[t].localeCompare(r[t]) : isNaN(e[t]) ? 0 : n === "desc" ? r[t] - e[t] : e[t] - r[t]);
1244
+ }
1245
+ return e;
1246
+ }, [
1247
+ JSON.stringify(n),
1248
+ i,
1249
+ a,
1250
+ JSON.stringify(o),
1251
+ JSON.stringify(s),
1252
+ JSON.stringify(c)
1253
+ ]);
1254
+ useEffect(() => {
1255
+ if (r === !1) {
1256
+ u(!1);
1257
+ return;
1258
+ }
1259
+ let e = f.length, t = r?.pageSize || 10;
1260
+ u({
1261
+ currentPage: e ? 1 : 0,
1262
+ pageSize: t,
1263
+ total: e,
1264
+ pages: Math.ceil(e / t)
1265
+ });
1266
+ }, [f, r]);
1267
+ let p = useMemo(() => {
1268
+ if (!l) return f;
1269
+ let { currentPage: e, pageSize: t } = l;
1270
+ return f.filter((n, r) => r >= (e - 1) * t && r < e * t);
1271
+ }, [f, l]);
1272
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(List_default, {
1273
+ ...e,
1274
+ visible: t,
1275
+ data: p,
1276
+ pagination: l === !1 ? !1 : {
1277
+ ...l,
1278
+ onChange: d
1279
+ }
1280
+ });
1281
+ }, CustomList_default = (e) => {
1282
+ let { visible: t, data: n = [], pagination: r = {} } = e, i = r.total || n.length, a = r.pageSize || 10;
1283
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(List_default, {
1284
+ ...e,
1285
+ visible: t,
1286
+ data: n,
1287
+ pagination: {
1288
+ ...r,
1289
+ pageSize: a,
1290
+ pages: Math.ceil(i / a)
1291
+ }
1292
+ });
1293
+ }, en_US_default = {
1294
+ "dropdownlist.search.placeholder": "Search...",
1295
+ "dropdownlist.result.found": "Found",
1296
+ "dropdownlist.result.records": "records",
1297
+ "dropdownlist.sort.by": "Sort By",
1298
+ "dropdownlist.sort.by.desc": "Desc",
1299
+ "dropdownlist.sort.by.asc": "Asc",
1300
+ "dropdownlist.sort.by.clear": "Clear sorting",
1301
+ "dropdownlist.filters": "Filters",
1302
+ "dropdownlist.apply": "Apply",
1303
+ "dropdownlist.loading": "Loading...",
1304
+ "dropdownlist.loading.failed": "Load failed",
1305
+ "dropdownlist.refresh": "Refresh"
1306
+ }, zh_CN_default = {
1307
+ "dropdownlist.search.placeholder": "搜索",
1308
+ "dropdownlist.result.found": "找到",
1309
+ "dropdownlist.result.records": "结果",
1310
+ "dropdownlist.sort.by": "排序",
1311
+ "dropdownlist.sort.by.desc": "降序",
1312
+ "dropdownlist.sort.by.asc": "升序",
1313
+ "dropdownlist.sort.by.clear": "清除排序",
1314
+ "dropdownlist.filters": "过滤",
1315
+ "dropdownlist.apply": "应用",
1316
+ "dropdownlist.loading": "加载中...",
1317
+ "dropdownlist.loading.failed": "加载失败",
1318
+ "dropdownlist.refresh": "刷新"
1319
+ }, locales_default = {
1320
+ "en-US": en_US_default,
1321
+ "zh-CN": zh_CN_default
1322
+ }, index_module_default$1 = {
1323
+ dropdownList: "_dropdownList_1nq1q_1",
1324
+ button: "_button_1nq1q_7",
1325
+ content: "_content_1nq1q_10",
1326
+ label: "_label_1nq1q_18",
1327
+ down: "_down_1nq1q_25",
1328
+ close: "_close_1nq1q_29",
1329
+ multipleItem: "_multipleItem_1nq1q_34",
1330
+ allowClear: "_allowClear_1nq1q_44",
1331
+ popover: "_popover_1nq1q_50"
1332
+ }, import_lodash$2 = require_lodash(), DropdownList_default = (e) => {
1333
+ let { className: t = "", popoverClassName: n = "", popoverPlacement: r = "bottomLeft", children: i, width: a = 300, dropdownWidth: o, locale: s = "en-US", allowClear: c = !1, mode: l = "", value: u, disabled: d = !1, onChange: f, placeholder: p = "", loading: m = !1, data: h = [], rowKey: g, renderItem: _, renderLabel: v, pagination: y, onSearchChange: b = () => {}, sorter: x = [], onSorterChange: S = () => {}, sorterOptions: C = [], filters: w = {}, onFiltersChange: T = () => {}, filterOptions: E = [], defaultGroupVisible: D = !1, groups: O = [], onGroupsChange: k = () => {}, groupOptions: A = [], onGroupVisibleChange: j = () => {}, autoAdjustOverflow: M = { adjustX: 1 }, getPopupContainer: N = (e) => e.parentNode, extraData: P = [], showListIcon: F = !0 } = e, [I, L] = useState(!1), [R, Ut] = useState(D), [Wt, z] = useState(), [B, V] = useState(), H = useRef(null), U = useMemo(() => l === "multiple" && (u === void 0 || Array.isArray(u)), [l, u]), W = (e) => {
1334
+ L(e);
1335
+ }, G = (e) => {
1336
+ f(e), U || L(!1);
1337
+ }, K = (e) => {
1338
+ z(e), b(e);
1339
+ }, q = (e) => {
1340
+ let t = (0, import_lodash$2.cloneDeep)(u) || [];
1341
+ t.splice(e, 1), f(t);
1342
+ }, J = () => {
1343
+ f(U ? [] : void 0);
1344
+ }, Y = () => {
1345
+ let t = {
1346
+ ...e,
1347
+ value: u,
1348
+ loading: m,
1349
+ data: h,
1350
+ onSearchChange: K,
1351
+ searchValue: Wt,
1352
+ sorter: x,
1353
+ onSorterChange: S,
1354
+ sorterOptions: C,
1355
+ filters: w,
1356
+ onFiltersChange: T,
1357
+ filterOptions: E,
1358
+ groups: O,
1359
+ onGroupsChange: k,
1360
+ groupOptions: A,
1361
+ visible: I,
1362
+ onChange: G,
1363
+ currentLocales: locales_default[s] || {},
1364
+ showGroup: R,
1365
+ onShowGroupChange: (e) => {
1366
+ Ut(e), j(e);
1367
+ },
1368
+ isMultiple: U
1369
+ };
1370
+ return !y || !y.currentPage || !y.total ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoList_default, { ...t }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomList_default, { ...t });
1371
+ }, X = (e) => v ? v(e) : _ ? _(e) : e[g], Z = () => {
1372
+ let e = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1373
+ style: { color: "#999" },
1374
+ children: p
1375
+ });
1376
+ return U ? u?.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: u.filter((e) => !!(e && e[g])).map((e, t) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1377
+ className: `${index_module_default$1.multipleItem} common-ui-dropdownlist-multiple-item`,
1378
+ children: [X(e), e.disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
1379
+ component: CloseOutlined,
1380
+ style: {
1381
+ marginLeft: 4,
1382
+ fontSize: 10
1383
+ },
1384
+ onClick: (e) => {
1385
+ e.stopPropagation(), q(t);
1386
+ }
1387
+ })]
1388
+ }, t)) }) : e : u && u[g] ? X(u) : e;
1389
+ };
1390
+ useEffect(() => {
1391
+ !o && isNaN(Number(a)) && H.current && V(H.current.offsetWidth);
1392
+ }, [
1393
+ o,
1394
+ a,
1395
+ H
1396
+ ]);
1397
+ let Q = o || a;
1398
+ isNaN(Number(Q)) ? B && (Q = `${B}px`) : Q = `${Q}px`, R && (Q = `calc(${Q} + ${120 * O.length || 120}px)`);
1399
+ let $ = Z();
1400
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1401
+ className: `${index_module_default$1.dropdownList} ${t}`,
1402
+ style: { width: a },
1403
+ ref: H,
1404
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Popover, {
1405
+ open: d ? !1 : I,
1406
+ onOpenChange: W,
1407
+ placement: r,
1408
+ content: Y(),
1409
+ trigger: "click",
1410
+ overlayClassName: `${index_module_default$1.popover} ${n}`,
1411
+ overlayStyle: {
1412
+ width: Q,
1413
+ maxHeight: 126 + (y?.pageSize || 10) * 32
1414
+ },
1415
+ autoAdjustOverflow: M,
1416
+ getPopupContainer: N,
1417
+ children: i || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1418
+ style: { width: "100%" },
1419
+ disabled: d,
1420
+ className: `${index_module_default$1.button} css-var-r0 common-ui-dropdownlist-select ${c ? index_module_default$1.allowClear : ""}`,
1421
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1422
+ className: index_module_default$1.content,
1423
+ children: [
1424
+ F && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BarsOutlined, { className: index_module_default$1.icon }),
1425
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1426
+ className: index_module_default$1.label,
1427
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: $ })
1428
+ }),
1429
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
1430
+ component: I ? UpOutlined : DownOutlined,
1431
+ className: index_module_default$1.down
1432
+ }),
1433
+ c && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
1434
+ onClick: (e) => {
1435
+ e.stopPropagation(), J();
1436
+ },
1437
+ theme: "filled",
1438
+ component: CloseCircleOutlined,
1439
+ className: index_module_default$1.close
1440
+ })
1441
+ ]
1442
+ })
1443
+ })
1444
+ })
1445
+ });
1446
+ }, index_module_default = {}, IndexPatternSelect_default = (e) => {
1447
+ let { selectedIndexPattern: t, onIndexPatternChange: n, indices: r = [] } = e, [i, a] = useState([]), [o, s] = useState({ type: ["index", "specialIndex"] }), c = useMemo(() => r?.map((e) => ({
1448
+ id: e,
1449
+ title: e,
1450
+ name: e,
1451
+ type: e.startsWith(".") ? "specialIndex" : "index"
1452
+ })) || [], [r]), l = useMemo(() => [{
1453
+ label: "Type",
1454
+ key: "type",
1455
+ list: [{
1456
+ label: "Index",
1457
+ value: "index"
1458
+ }, {
1459
+ label: "Special Index",
1460
+ value: "specialIndex"
1461
+ }]
1462
+ }], []);
1463
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownList_default, {
1464
+ className: index_module_default.indexPatternSelect,
1465
+ width: 282,
1466
+ value: {
1467
+ id: t.id,
1468
+ name: t.viewName || t.title,
1469
+ type: t.type
1470
+ },
1471
+ onChange: (e) => {
1472
+ n(e.id, e.type === "view" ? "view" : "index");
1473
+ },
1474
+ placeholder: "Please select",
1475
+ rowKey: "id",
1476
+ data: c,
1477
+ renderItem: (e) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableOutlined, { className: "mr-4px" }), e.name] }),
1478
+ renderLabel: (e) => e.name,
1479
+ renderEmptyList: () => null,
1480
+ searchKey: "name",
1481
+ sorter: i,
1482
+ onSorterChange: a,
1483
+ sorterOptions: [{
1484
+ label: "Name",
1485
+ key: "name"
1486
+ }],
1487
+ filters: o,
1488
+ onFiltersChange: s,
1489
+ filterOptions: l
1490
+ });
1491
+ };
1492
+ const FilterOptions = class extends Component {
1493
+ state = { isPopoverOpen: !1 };
1494
+ togglePopover = () => {
1495
+ this.setState((e) => ({ isPopoverOpen: !e.isPopoverOpen }));
1496
+ };
1497
+ closePopover = () => {
1498
+ this.setState({ isPopoverOpen: !1 });
1499
+ };
1500
+ render() {
1501
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Popover, {
1502
+ classNames: {
1503
+ container: "!p-0 !overflow-hidden",
1504
+ title: "!p-12px !uppercase !mb-0 !border-b-1px !border-b-solid !border-[var(--ant-color-border)]"
1505
+ },
1506
+ placement: "bottom",
1507
+ open: this.state.isPopoverOpen,
1508
+ onOpenChange: (e) => {
1509
+ this.setState({ isPopoverOpen: e });
1510
+ },
1511
+ content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu, {
1512
+ onClick: () => {},
1513
+ className: "!border-0",
1514
+ classNames: { item: "!m-0 !px-12px !w-full !rounded-0" },
1515
+ mode: "vertical",
1516
+ items: [
1517
+ {
1518
+ key: "enable",
1519
+ label: "Enable all",
1520
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Eye, { className: "w-14px h-14px" }),
1521
+ onClick: () => {
1522
+ this.closePopover(), this.props.onEnableAll();
1523
+ }
1524
+ },
1525
+ {
1526
+ key: "disable",
1527
+ label: "Disable all",
1528
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EyeOff, { className: "w-14px h-14px" }),
1529
+ onClick: () => {
1530
+ this.closePopover(), this.props.onDisableAll();
1531
+ }
1532
+ },
1533
+ {
1534
+ key: "pin",
1535
+ label: "Pin all",
1536
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pin, { className: "w-14px h-14px" }),
1537
+ onClick: () => {
1538
+ this.closePopover(), this.props.onPinAll();
1539
+ }
1540
+ },
1541
+ {
1542
+ key: "unpin",
1543
+ label: "Unpin all",
1544
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PinOff, { className: "w-14px h-14px" }),
1545
+ onClick: () => {
1546
+ this.closePopover(), this.props.onUnpinAll();
1547
+ }
1548
+ },
1549
+ {
1550
+ key: "invert_inclusion",
1551
+ label: "Invert inclusion",
1552
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SquaresExclude, { className: "w-14px h-14px" }),
1553
+ onClick: () => {
1554
+ this.closePopover(), this.props.onToggleAllNegated();
1555
+ }
1556
+ },
1557
+ {
1558
+ key: "invert_enabled_disabled",
1559
+ label: "Invert enabled/disabled",
1560
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Eye, { className: "w-14px h-14px" }),
1561
+ onClick: () => {
1562
+ this.closePopover(), this.props.onToggleAllDisabled();
1563
+ }
1564
+ },
1565
+ {
1566
+ key: "remove_all",
1567
+ label: "Remove all",
1568
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "w-14px h-14px" }),
1569
+ onClick: () => {
1570
+ this.closePopover(), this.props.onRemoveAll();
1571
+ }
1572
+ }
1573
+ ]
1574
+ }),
1575
+ title: "Change all filters",
1576
+ trigger: "click",
1577
+ destroyOnHidden: !0,
1578
+ arrow: !1,
1579
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListFilter, { className: "w-14px h-14px" }) })
1580
+ });
1581
+ }
1582
+ };
1583
+ function FilterActions(e) {
1584
+ let [t, n] = useState(!1);
1585
+ function r() {
1586
+ let [r] = e.indexPatterns, i = buildEmptyFilter(!0, r && r.id);
1587
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Popover, {
1588
+ classNames: {
1589
+ container: "!p-0 !overflow-hidden w-400px",
1590
+ title: "!p-12px !mb-0 !border-b-1px !border-b-solid !border-[var(--ant-color-border)]"
1591
+ },
1592
+ placement: "bottom",
1593
+ open: t,
1594
+ onOpenChange: n,
1595
+ content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterEditor, {
1596
+ filter: i,
1597
+ indexPatterns: e.indexPatterns,
1598
+ onSubmit: a,
1599
+ onCancel: () => n(!1),
1600
+ services: e.services,
1601
+ dateRangeFrom: e.dateRangeFrom,
1602
+ dateRangeTo: e.dateRangeTo,
1603
+ timeField: e.timeField
1604
+ }, JSON.stringify(i)),
1605
+ title: null,
1606
+ trigger: "click",
1607
+ destroyOnHidden: !0,
1608
+ arrow: !1,
1609
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CirclePlus, { className: "w-14px h-14px" }) })
1610
+ });
1611
+ }
1612
+ function i(t) {
1613
+ e.onFiltersUpdated && e.onFiltersUpdated(t);
1614
+ }
1615
+ function a(t) {
1616
+ n(!1), i([...e.filters, t]);
1617
+ }
1618
+ function o() {
1619
+ i(e.filters.map(enableFilter));
1620
+ }
1621
+ function s() {
1622
+ i(e.filters.map(disableFilter));
1623
+ }
1624
+ function c() {
1625
+ i(e.filters.map(pinFilter));
1626
+ }
1627
+ function l() {
1628
+ i(e.filters.map(unpinFilter));
1629
+ }
1630
+ function u() {
1631
+ i(e.filters.map(toggleFilterNegated));
1632
+ }
1633
+ function d() {
1634
+ i(e.filters.map(toggleFilterDisabled));
1635
+ }
1636
+ function f() {
1637
+ i([]);
1638
+ }
1639
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Space.Compact, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterOptions, {
1640
+ onEnableAll: o,
1641
+ onDisableAll: s,
1642
+ onPinAll: c,
1643
+ onUnpinAll: l,
1644
+ onToggleAllNegated: u,
1645
+ onToggleAllDisabled: d,
1646
+ onRemoveAll: f
1647
+ }), r()] });
1648
+ }
1649
+ var import_lodash = require_lodash(), import_classnames = /* @__PURE__ */ __toESM(require_classnames(), 1), import_lodash$1 = require_lodash(), search_bar_default = withKibana(class extends Component {
1650
+ static defaultProps = {
1651
+ showQueryBar: !0,
1652
+ showFilterBar: !0,
1653
+ showDatePicker: !0,
1654
+ showAutoRefreshOnly: !1
1655
+ };
1656
+ filterBarRef = null;
1657
+ filterBarWrapperRef = null;
1658
+ static getDerivedStateFromProps(e, t) {
1659
+ if ((0, import_lodash$1.isEqual)(t.currentProps, e)) return null;
1660
+ let n = null;
1661
+ e.query && e.query.query !== (0, import_lodash$1.get)(t, "currentProps.query.query") ? n = {
1662
+ query: e.query.query,
1663
+ language: e.query.language
1664
+ } : e.query && t.query && e.query.language !== t.query.language && (n = {
1665
+ query: "",
1666
+ language: e.query.language
1667
+ });
1668
+ let r = null;
1669
+ (e.dateRangeFrom !== (0, import_lodash$1.get)(t, "currentProps.dateRangeFrom") || e.dateRangeTo !== (0, import_lodash$1.get)(t, "currentProps.dateRangeTo")) && (r = {
1670
+ dateRangeFrom: e.dateRangeFrom,
1671
+ dateRangeTo: e.dateRangeTo
1672
+ });
1673
+ let i = { currentProps: e };
1674
+ return n && (i.query = n), r && (i.dateRangeFrom = r.dateRangeFrom, i.dateRangeTo = r.dateRangeTo), i;
1675
+ }
1676
+ state = {
1677
+ isFiltersVisible: !0,
1678
+ showSaveQueryModal: !1,
1679
+ showSaveNewQueryModal: !1,
1680
+ currentProps: this.props,
1681
+ query: this.props.query ? { ...this.props.query } : void 0,
1682
+ dateRangeFrom: (0, import_lodash$1.get)(this.props, "dateRangeFrom", "now-15m"),
1683
+ dateRangeTo: (0, import_lodash$1.get)(this.props, "dateRangeTo", "now")
1684
+ };
1685
+ isDirty = () => !this.props.showDatePicker && this.state.query && this.props.query ? this.state.query.query !== this.props.query.query : this.state.query && this.props.query && this.state.query.query !== this.props.query.query || this.state.dateRangeFrom !== this.props.dateRangeFrom || this.state.dateRangeTo !== this.props.dateRangeTo;
1686
+ shouldRenderQueryBar() {
1687
+ let e = this.props.showDatePicker || this.props.showAutoRefreshOnly, t = this.props.showQueryInput && this.props.indexPatterns && this.state.query;
1688
+ return this.props.showQueryBar && (e || t);
1689
+ }
1690
+ shouldRenderFilterBar() {
1691
+ return this.props.showFilterBar && this.props.filters && this.props.indexPatterns && (0, import_lodash.compact)(this.props.indexPatterns).length > 0;
1692
+ }
1693
+ setFilterBarHeight = () => {
1694
+ requestAnimationFrame(() => {
1695
+ let e = this.filterBarRef && this.state.isFiltersVisible && this.props.filters && this.props.filters.length > 0 ? this.filterBarRef.clientHeight : 0;
1696
+ this.filterBarWrapperRef && this.filterBarWrapperRef.setAttribute("style", `height: ${e}px`);
1697
+ });
1698
+ };
1699
+ ro = new ResizeObserver_es_default(this.setFilterBarHeight);
1700
+ onInitiateSave = () => {
1701
+ this.setState({ showSaveQueryModal: !0 });
1702
+ };
1703
+ onInitiateSaveNew = () => {
1704
+ this.setState({ showSaveNewQueryModal: !0 });
1705
+ };
1706
+ onQueryBarChange = (e) => {
1707
+ this.setState({
1708
+ query: e.query,
1709
+ dateRangeFrom: e.dateRange.from,
1710
+ dateRangeTo: e.dateRange.to
1711
+ }), this.props.onQueryChange && this.props.onQueryChange(e);
1712
+ };
1713
+ onQueryBarSubmit = (e) => {
1714
+ this.setState({
1715
+ query: e.query,
1716
+ dateRangeFrom: e.dateRange && e.dateRange.from || this.state.dateRangeFrom,
1717
+ dateRangeTo: e.dateRange && e.dateRange.to || this.state.dateRangeTo
1718
+ }, () => {
1719
+ this.props.onQuerySubmit && this.props.onQuerySubmit({
1720
+ query: this.state.query,
1721
+ dateRange: {
1722
+ from: this.state.dateRangeFrom,
1723
+ to: this.state.dateRangeTo
1724
+ }
1725
+ });
1726
+ });
1727
+ };
1728
+ componentDidMount() {
1729
+ this.filterBarRef && (this.setFilterBarHeight(), this.ro.observe(this.filterBarRef));
1730
+ }
1731
+ componentDidUpdate() {
1732
+ this.filterBarRef && (this.setFilterBarHeight(), this.ro.unobserve(this.filterBarRef));
1733
+ }
1734
+ render() {
1735
+ if (!this.props.selectedIndexPattern) return null;
1736
+ let e;
1737
+ this.shouldRenderQueryBar() && (e = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryBarTopRow, {
1738
+ timeHistory: this.props.timeHistory,
1739
+ query: this.state.query,
1740
+ screenTitle: this.props.screenTitle,
1741
+ onSubmit: this.onQueryBarSubmit,
1742
+ indexPatterns: this.props.indexPatterns,
1743
+ isLoading: this.props.isLoading,
1744
+ prepend: null,
1745
+ showDatePicker: this.props.showDatePicker,
1746
+ dateRangeFrom: this.state.dateRangeFrom,
1747
+ dateRangeTo: this.state.dateRangeTo,
1748
+ isRefreshPaused: this.props.isRefreshPaused,
1749
+ refreshInterval: this.props.refreshInterval,
1750
+ showAutoRefreshOnly: this.props.showAutoRefreshOnly,
1751
+ showQueryInput: this.props.showQueryInput,
1752
+ onRefresh: this.props.onRefresh,
1753
+ onRefreshChange: this.props.onRefreshChange,
1754
+ onChange: this.onQueryBarChange,
1755
+ isDirty: this.isDirty(),
1756
+ dataTestSubj: this.props.dataTestSubj,
1757
+ indicateNoData: this.props.indicateNoData,
1758
+ storage: this.props.storage,
1759
+ services: this.props.services,
1760
+ renderTimeField: this.props.renderTimeField,
1761
+ timefilterUpdateHandler: this.props.timefilterUpdateHandler,
1762
+ timeSetting: this.props.timeSetting
1763
+ }));
1764
+ let t;
1765
+ return this.shouldRenderFilterBar() && (t = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1766
+ id: "GlobalFilterGroup",
1767
+ ref: (e) => {
1768
+ this.filterBarWrapperRef = e;
1769
+ },
1770
+ className: (0, import_classnames.default)("globalFilterGroup__wrapper", { "globalFilterGroup__wrapper-isVisible": this.state.isFiltersVisible }),
1771
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1772
+ ref: (e) => {
1773
+ this.filterBarRef = e;
1774
+ },
1775
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterBar, {
1776
+ className: "globalFilterGroup__filterBar",
1777
+ filters: this.props.filters,
1778
+ onFiltersUpdated: this.props.onFiltersUpdated,
1779
+ indexPatterns: this.props.indexPatterns,
1780
+ dateRangeFrom: this.state.dateRangeFrom,
1781
+ dateRangeTo: this.state.dateRangeTo,
1782
+ timeField: this.props.timeSetting?.timeField,
1783
+ services: this.props.services
1784
+ })
1785
+ })
1786
+ })), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1787
+ className: "p-8px",
1788
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1789
+ className: "flex items-center gap-8px",
1790
+ children: [
1791
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IndexPatternSelect_default, {
1792
+ selectedIndexPattern: this.props.selectedIndexPattern,
1793
+ onIndexPatternChange: this.props.setIndexPattern,
1794
+ indices: this.props.indices
1795
+ }),
1796
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterActions, {
1797
+ className: "globalFilterGroup__filterBar",
1798
+ filters: this.props.filters,
1799
+ onFiltersUpdated: this.props.onFiltersUpdated,
1800
+ indexPatterns: this.props.indexPatterns,
1801
+ dateRangeFrom: this.state.dateRangeFrom,
1802
+ dateRangeTo: this.state.dateRangeTo,
1803
+ timeField: this.props.selectedIndexPattern.timeFieldName,
1804
+ services: this.props.services
1805
+ }),
1806
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1807
+ className: "flex-1",
1808
+ children: e
1809
+ })
1810
+ ]
1811
+ }), t]
1812
+ });
1813
+ }
1814
+ });
1815
+ export { search_bar_default as default };