@sinequa/atomic 0.0.61

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 (298) hide show
  1. package/README.md +18 -0
  2. package/dist/atomic.js +860 -0
  3. package/dist/atomic.umd.cjs +1 -0
  4. package/dist/auth/auth.d.ts +39 -0
  5. package/dist/auth/auth.d.ts.map +1 -0
  6. package/dist/auth/index.d.ts +2 -0
  7. package/dist/auth/index.d.ts.map +1 -0
  8. package/dist/configurations/global.config.d.ts +35 -0
  9. package/dist/configurations/global.config.d.ts.map +1 -0
  10. package/dist/configurations/index.d.ts +2 -0
  11. package/dist/configurations/index.d.ts.map +1 -0
  12. package/dist/helpers/column-resolver.d.ts +10 -0
  13. package/dist/helpers/column-resolver.d.ts.map +1 -0
  14. package/dist/helpers/column-resolver.test.d.ts +2 -0
  15. package/dist/helpers/column-resolver.test.d.ts.map +1 -0
  16. package/dist/helpers/index.d.ts +5 -0
  17. package/dist/helpers/index.d.ts.map +1 -0
  18. package/dist/helpers/metadata.d.ts +13 -0
  19. package/dist/helpers/metadata.d.ts.map +1 -0
  20. package/dist/helpers/ts-helper.d.ts +8 -0
  21. package/dist/helpers/ts-helper.d.ts.map +1 -0
  22. package/dist/helpers/utils.d.ts +21 -0
  23. package/dist/helpers/utils.d.ts.map +1 -0
  24. package/dist/helpers/utils.test.d.ts +2 -0
  25. package/dist/helpers/utils.test.d.ts.map +1 -0
  26. package/dist/index.d.ts +7 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/types/aggregations/Aggregation.d.ts +38 -0
  29. package/dist/types/aggregations/Aggregation.d.ts.map +1 -0
  30. package/dist/types/aggregations/AggregationItem.d.ts +30 -0
  31. package/dist/types/aggregations/AggregationItem.d.ts.map +1 -0
  32. package/dist/types/aggregations/AggregationOptions.d.ts +14 -0
  33. package/dist/types/aggregations/AggregationOptions.d.ts.map +1 -0
  34. package/dist/types/aggregations/ListAggregation.d.ts +6 -0
  35. package/dist/types/aggregations/ListAggregation.d.ts.map +1 -0
  36. package/dist/types/aggregations/TreeAggregation.d.ts +13 -0
  37. package/dist/types/aggregations/TreeAggregation.d.ts.map +1 -0
  38. package/dist/types/aggregations/TreeAggregationNode.d.ts +27 -0
  39. package/dist/types/aggregations/TreeAggregationNode.d.ts.map +1 -0
  40. package/dist/types/aggregations/index.d.ts +7 -0
  41. package/dist/types/aggregations/index.d.ts.map +1 -0
  42. package/dist/types/api-endpoints.d.ts +4 -0
  43. package/dist/types/api-endpoints.d.ts.map +1 -0
  44. package/dist/types/audit/AuditEvent.d.ts +15 -0
  45. package/dist/types/audit/AuditEvent.d.ts.map +1 -0
  46. package/dist/types/audit/AuditEventType.d.ts +114 -0
  47. package/dist/types/audit/AuditEventType.d.ts.map +1 -0
  48. package/dist/types/audit/AuditRecord.d.ts +9 -0
  49. package/dist/types/audit/AuditRecord.d.ts.map +1 -0
  50. package/dist/types/audit/index.d.ts +5 -0
  51. package/dist/types/audit/index.d.ts.map +1 -0
  52. package/dist/types/chunks/index.d.ts +3 -0
  53. package/dist/types/chunks/index.d.ts.map +1 -0
  54. package/dist/types/chunks/text-chunk.d.ts +11 -0
  55. package/dist/types/chunks/text-chunk.d.ts.map +1 -0
  56. package/dist/types/chunks/text-location.d.ts +7 -0
  57. package/dist/types/chunks/text-location.d.ts.map +1 -0
  58. package/dist/types/config/CCAggregation.d.ts +47 -0
  59. package/dist/types/config/CCAggregation.d.ts.map +1 -0
  60. package/dist/types/config/CCApp.d.ts +87 -0
  61. package/dist/types/config/CCApp.d.ts.map +1 -0
  62. package/dist/types/config/CCAppPreLogin.d.ts +9 -0
  63. package/dist/types/config/CCAppPreLogin.d.ts.map +1 -0
  64. package/dist/types/config/CCAppRefresh.d.ts +10 -0
  65. package/dist/types/config/CCAppRefresh.d.ts.map +1 -0
  66. package/dist/types/config/CCAutocomplete.d.ts +32 -0
  67. package/dist/types/config/CCAutocomplete.d.ts.map +1 -0
  68. package/dist/types/config/CCColumn.d.ts +15 -0
  69. package/dist/types/config/CCColumn.d.ts.map +1 -0
  70. package/dist/types/config/CCColumnInfo.d.ts +38 -0
  71. package/dist/types/config/CCColumnInfo.d.ts.map +1 -0
  72. package/dist/types/config/CCColumnsInfo.d.ts +8 -0
  73. package/dist/types/config/CCColumnsInfo.d.ts.map +1 -0
  74. package/dist/types/config/CCConfig.d.ts +15 -0
  75. package/dist/types/config/CCConfig.d.ts.map +1 -0
  76. package/dist/types/config/CCIndex.d.ts +16 -0
  77. package/dist/types/config/CCIndex.d.ts.map +1 -0
  78. package/dist/types/config/CCLabels.d.ts +43 -0
  79. package/dist/types/config/CCLabels.d.ts.map +1 -0
  80. package/dist/types/config/CCList.d.ts +16 -0
  81. package/dist/types/config/CCList.d.ts.map +1 -0
  82. package/dist/types/config/CCListItem.d.ts +14 -0
  83. package/dist/types/config/CCListItem.d.ts.map +1 -0
  84. package/dist/types/config/CCQuery.d.ts +34 -0
  85. package/dist/types/config/CCQuery.d.ts.map +1 -0
  86. package/dist/types/config/CCRFM.d.ts +11 -0
  87. package/dist/types/config/CCRFM.d.ts.map +1 -0
  88. package/dist/types/config/CCRFMAction.d.ts +12 -0
  89. package/dist/types/config/CCRFMAction.d.ts.map +1 -0
  90. package/dist/types/config/CCScope.d.ts +28 -0
  91. package/dist/types/config/CCScope.d.ts.map +1 -0
  92. package/dist/types/config/CCSortingChoice.d.ts +32 -0
  93. package/dist/types/config/CCSortingChoice.d.ts.map +1 -0
  94. package/dist/types/config/CCTab.d.ts +35 -0
  95. package/dist/types/config/CCTab.d.ts.map +1 -0
  96. package/dist/types/config/CCTabSearch.d.ts +46 -0
  97. package/dist/types/config/CCTabSearch.d.ts.map +1 -0
  98. package/dist/types/config/CCWebService.d.ts +10 -0
  99. package/dist/types/config/CCWebService.d.ts.map +1 -0
  100. package/dist/types/config/EngineType.d.ts +22 -0
  101. package/dist/types/config/EngineType.d.ts.map +1 -0
  102. package/dist/types/config/EngineTypeModifier.d.ts +24 -0
  103. package/dist/types/config/EngineTypeModifier.d.ts.map +1 -0
  104. package/dist/types/config/ExportDialogModel.d.ts +13 -0
  105. package/dist/types/config/ExportDialogModel.d.ts.map +1 -0
  106. package/dist/types/config/ExportOutputFormat.d.ts +10 -0
  107. package/dist/types/config/ExportOutputFormat.d.ts.map +1 -0
  108. package/dist/types/config/ExportSourceType.d.ts +10 -0
  109. package/dist/types/config/ExportSourceType.d.ts.map +1 -0
  110. package/dist/types/config/QueryPrecision.d.ts +14 -0
  111. package/dist/types/config/QueryPrecision.d.ts.map +1 -0
  112. package/dist/types/config/QueryStrategy.d.ts +18 -0
  113. package/dist/types/config/QueryStrategy.d.ts.map +1 -0
  114. package/dist/types/config/SpellingCorrectionMode.d.ts +28 -0
  115. package/dist/types/config/SpellingCorrectionMode.d.ts.map +1 -0
  116. package/dist/types/config/index.d.ts +34 -0
  117. package/dist/types/config/index.d.ts.map +1 -0
  118. package/dist/types/credentials.d.ts +5 -0
  119. package/dist/types/credentials.d.ts.map +1 -0
  120. package/dist/types/filters/BetweenFilter.d.ts +7 -0
  121. package/dist/types/filters/BetweenFilter.d.ts.map +1 -0
  122. package/dist/types/filters/ExprFilter.d.ts +6 -0
  123. package/dist/types/filters/ExprFilter.d.ts.map +1 -0
  124. package/dist/types/filters/Filter.d.ts +10 -0
  125. package/dist/types/filters/Filter.d.ts.map +1 -0
  126. package/dist/types/filters/InFilter.d.ts +6 -0
  127. package/dist/types/filters/InFilter.d.ts.map +1 -0
  128. package/dist/types/filters/NotNullFilter.d.ts +5 -0
  129. package/dist/types/filters/NotNullFilter.d.ts.map +1 -0
  130. package/dist/types/filters/NullFilter.d.ts +5 -0
  131. package/dist/types/filters/NullFilter.d.ts.map +1 -0
  132. package/dist/types/filters/SimpleFilter.d.ts +5 -0
  133. package/dist/types/filters/SimpleFilter.d.ts.map +1 -0
  134. package/dist/types/filters/index.d.ts +9 -0
  135. package/dist/types/filters/index.d.ts.map +1 -0
  136. package/dist/types/filters/legacy-filters.d.ts +13 -0
  137. package/dist/types/filters/legacy-filters.d.ts.map +1 -0
  138. package/dist/types/index.d.ts +16 -0
  139. package/dist/types/index.d.ts.map +1 -0
  140. package/dist/types/interfaces/Open.d.ts +14 -0
  141. package/dist/types/interfaces/Open.d.ts.map +1 -0
  142. package/dist/types/interfaces/Query.d.ts +136 -0
  143. package/dist/types/interfaces/Query.d.ts.map +1 -0
  144. package/dist/types/interfaces/Select.d.ts +15 -0
  145. package/dist/types/interfaces/Select.d.ts.map +1 -0
  146. package/dist/types/interfaces/index.d.ts +4 -0
  147. package/dist/types/interfaces/index.d.ts.map +1 -0
  148. package/dist/types/interfaces/json.d.ts +7 -0
  149. package/dist/types/interfaces/json.d.ts.map +1 -0
  150. package/dist/types/labels/label-rights.d.ts +5 -0
  151. package/dist/types/labels/label-rights.d.ts.map +1 -0
  152. package/dist/types/link-results/index.d.ts +3 -0
  153. package/dist/types/link-results/index.d.ts.map +1 -0
  154. package/dist/types/link-results/link-results.d.ts +12 -0
  155. package/dist/types/link-results/link-results.d.ts.map +1 -0
  156. package/dist/types/link-results/links-results.d.ts +9 -0
  157. package/dist/types/link-results/links-results.d.ts.map +1 -0
  158. package/dist/types/preview/CategoryHighlightData.d.ts +12 -0
  159. package/dist/types/preview/CategoryHighlightData.d.ts.map +1 -0
  160. package/dist/types/preview/CustomHighlights.d.ts +8 -0
  161. package/dist/types/preview/CustomHighlights.d.ts.map +1 -0
  162. package/dist/types/preview/HighlightDataPerCategory.d.ts +6 -0
  163. package/dist/types/preview/HighlightDataPerCategory.d.ts.map +1 -0
  164. package/dist/types/preview/HighlightDataPerLocation.d.ts +11 -0
  165. package/dist/types/preview/HighlightDataPerLocation.d.ts.map +1 -0
  166. package/dist/types/preview/HighlightValue.d.ts +10 -0
  167. package/dist/types/preview/HighlightValue.d.ts.map +1 -0
  168. package/dist/types/preview/Location.d.ts +8 -0
  169. package/dist/types/preview/Location.d.ts.map +1 -0
  170. package/dist/types/preview/PreviewData.d.ts +15 -0
  171. package/dist/types/preview/PreviewData.d.ts.map +1 -0
  172. package/dist/types/preview/index.d.ts +8 -0
  173. package/dist/types/preview/index.d.ts.map +1 -0
  174. package/dist/types/principal/Principal.d.ts +29 -0
  175. package/dist/types/principal/Principal.d.ts.map +1 -0
  176. package/dist/types/principal/PrincipalChangedEvent.d.ts +11 -0
  177. package/dist/types/principal/PrincipalChangedEvent.d.ts.map +1 -0
  178. package/dist/types/principal/PrincipalEvent.d.ts +7 -0
  179. package/dist/types/principal/PrincipalEvent.d.ts.map +1 -0
  180. package/dist/types/principal/PrincipalParams.d.ts +8 -0
  181. package/dist/types/principal/PrincipalParams.d.ts.map +1 -0
  182. package/dist/types/principal/PrincipalUserIdsParams.d.ts +6 -0
  183. package/dist/types/principal/PrincipalUserIdsParams.d.ts.map +1 -0
  184. package/dist/types/principal/PrincipalUserInfo.d.ts +11 -0
  185. package/dist/types/principal/PrincipalUserInfo.d.ts.map +1 -0
  186. package/dist/types/principal/index.d.ts +7 -0
  187. package/dist/types/principal/index.d.ts.map +1 -0
  188. package/dist/types/search/AccessListPrincipal.d.ts +17 -0
  189. package/dist/types/search/AccessListPrincipal.d.ts.map +1 -0
  190. package/dist/types/search/AccessLists.d.ts +9 -0
  191. package/dist/types/search/AccessLists.d.ts.map +1 -0
  192. package/dist/types/search/Answer.d.ts +16 -0
  193. package/dist/types/search/Answer.d.ts.map +1 -0
  194. package/dist/types/search/Article.d.ts +194 -0
  195. package/dist/types/search/Article.d.ts.map +1 -0
  196. package/dist/types/search/Attributes.d.ts +17 -0
  197. package/dist/types/search/Attributes.d.ts.map +1 -0
  198. package/dist/types/search/DidYouMean.d.ts +10 -0
  199. package/dist/types/search/DidYouMean.d.ts.map +1 -0
  200. package/dist/types/search/DidYouMeanItem.d.ts +17 -0
  201. package/dist/types/search/DidYouMeanItem.d.ts.map +1 -0
  202. package/dist/types/search/DidYouMeanKind.d.ts +8 -0
  203. package/dist/types/search/DidYouMeanKind.d.ts.map +1 -0
  204. package/dist/types/search/DocumentAccessLists.d.ts +10 -0
  205. package/dist/types/search/DocumentAccessLists.d.ts.map +1 -0
  206. package/dist/types/search/EntityItem.d.ts +26 -0
  207. package/dist/types/search/EntityItem.d.ts.map +1 -0
  208. package/dist/types/search/MatchLocationsPerPartname.d.ts +8 -0
  209. package/dist/types/search/MatchLocationsPerPartname.d.ts.map +1 -0
  210. package/dist/types/search/MatchingPassage.d.ts +11 -0
  211. package/dist/types/search/MatchingPassage.d.ts.map +1 -0
  212. package/dist/types/search/PartnameMatchLocations.d.ts +8 -0
  213. package/dist/types/search/PartnameMatchLocations.d.ts.map +1 -0
  214. package/dist/types/search/Passage.d.ts +8 -0
  215. package/dist/types/search/Passage.d.ts.map +1 -0
  216. package/dist/types/search/QueryAnalysis.d.ts +11 -0
  217. package/dist/types/search/QueryAnalysis.d.ts.map +1 -0
  218. package/dist/types/search/QueryAnalysisElement.d.ts +24 -0
  219. package/dist/types/search/QueryAnalysisElement.d.ts.map +1 -0
  220. package/dist/types/search/QueryIntent.d.ts +15 -0
  221. package/dist/types/search/QueryIntent.d.ts.map +1 -0
  222. package/dist/types/search/QueryIntentAction.d.ts +11 -0
  223. package/dist/types/search/QueryIntentAction.d.ts.map +1 -0
  224. package/dist/types/search/QueryIntentData.d.ts +27 -0
  225. package/dist/types/search/QueryIntentData.d.ts.map +1 -0
  226. package/dist/types/search/QueryIntentDatasets.d.ts +13 -0
  227. package/dist/types/search/QueryIntentDatasets.d.ts.map +1 -0
  228. package/dist/types/search/QueryIntentEntity.d.ts +12 -0
  229. package/dist/types/search/QueryIntentEntity.d.ts.map +1 -0
  230. package/dist/types/search/QueryIntentWord.d.ts +12 -0
  231. package/dist/types/search/QueryIntentWord.d.ts.map +1 -0
  232. package/dist/types/search/RFMActionDisplay.d.ts +16 -0
  233. package/dist/types/search/RFMActionDisplay.d.ts.map +1 -0
  234. package/dist/types/search/RFMData.d.ts +10 -0
  235. package/dist/types/search/RFMData.d.ts.map +1 -0
  236. package/dist/types/search/RFMDisplay.d.ts +18 -0
  237. package/dist/types/search/RFMDisplay.d.ts.map +1 -0
  238. package/dist/types/search/RelevantExtract.d.ts +11 -0
  239. package/dist/types/search/RelevantExtract.d.ts.map +1 -0
  240. package/dist/types/search/Result.d.ts +43 -0
  241. package/dist/types/search/Result.d.ts.map +1 -0
  242. package/dist/types/search/Tab.d.ts +25 -0
  243. package/dist/types/search/Tab.d.ts.map +1 -0
  244. package/dist/types/search/TermPresence.d.ts +11 -0
  245. package/dist/types/search/TermPresence.d.ts.map +1 -0
  246. package/dist/types/search/TopPassage.d.ts +13 -0
  247. package/dist/types/search/TopPassage.d.ts.map +1 -0
  248. package/dist/types/search/index.d.ts +32 -0
  249. package/dist/types/search/index.d.ts.map +1 -0
  250. package/dist/types/suggest/suggestion.d.ts +11 -0
  251. package/dist/types/suggest/suggestion.d.ts.map +1 -0
  252. package/dist/types/user-settings/user-settings.d.ts +14 -0
  253. package/dist/types/user-settings/user-settings.d.ts.map +1 -0
  254. package/dist/utils/aggregations.d.ts +51 -0
  255. package/dist/utils/aggregations.d.ts.map +1 -0
  256. package/dist/utils/array/bisect.d.ts +17 -0
  257. package/dist/utils/array/bisect.d.ts.map +1 -0
  258. package/dist/utils/concepts.d.ts +72 -0
  259. package/dist/utils/concepts.d.ts.map +1 -0
  260. package/dist/utils/date.d.ts +31 -0
  261. package/dist/utils/date.d.ts.map +1 -0
  262. package/dist/utils/index.d.ts +7 -0
  263. package/dist/utils/index.d.ts.map +1 -0
  264. package/dist/utils/query-params.d.ts +72 -0
  265. package/dist/utils/query-params.d.ts.map +1 -0
  266. package/dist/utils/syslang.d.ts +27 -0
  267. package/dist/utils/syslang.d.ts.map +1 -0
  268. package/dist/web-api/fetch-aggregation.d.ts +11 -0
  269. package/dist/web-api/fetch-aggregation.d.ts.map +1 -0
  270. package/dist/web-api/fetch-app.d.ts +17 -0
  271. package/dist/web-api/fetch-app.d.ts.map +1 -0
  272. package/dist/web-api/fetch-audit.d.ts +33 -0
  273. package/dist/web-api/fetch-audit.d.ts.map +1 -0
  274. package/dist/web-api/fetch-dataset.d.ts +43 -0
  275. package/dist/web-api/fetch-dataset.d.ts.map +1 -0
  276. package/dist/web-api/fetch-labels.d.ts +95 -0
  277. package/dist/web-api/fetch-labels.d.ts.map +1 -0
  278. package/dist/web-api/fetch-preview.d.ts +17 -0
  279. package/dist/web-api/fetch-preview.d.ts.map +1 -0
  280. package/dist/web-api/fetch-principal.d.ts +13 -0
  281. package/dist/web-api/fetch-principal.d.ts.map +1 -0
  282. package/dist/web-api/fetch-query.d.ts +27 -0
  283. package/dist/web-api/fetch-query.d.ts.map +1 -0
  284. package/dist/web-api/fetch-sponsored-links.d.ts +14 -0
  285. package/dist/web-api/fetch-sponsored-links.d.ts.map +1 -0
  286. package/dist/web-api/fetch-suggest.d.ts +55 -0
  287. package/dist/web-api/fetch-suggest.d.ts.map +1 -0
  288. package/dist/web-api/fetch-text-chunk.d.ts +16 -0
  289. package/dist/web-api/fetch-text-chunk.d.ts.map +1 -0
  290. package/dist/web-api/fetch-user-settings.d.ts +28 -0
  291. package/dist/web-api/fetch-user-settings.d.ts.map +1 -0
  292. package/dist/web-api/helpers.d.ts +35 -0
  293. package/dist/web-api/helpers.d.ts.map +1 -0
  294. package/dist/web-api/helpers.test.d.ts +2 -0
  295. package/dist/web-api/helpers.test.d.ts.map +1 -0
  296. package/dist/web-api/index.d.ts +14 -0
  297. package/dist/web-api/index.d.ts.map +1 -0
  298. package/package.json +41 -0
package/dist/atomic.js ADDED
@@ -0,0 +1,860 @@
1
+ let l = { apiPath: "api/v1", loginPath: "/login", backendUrl: window.location.origin };
2
+ function L(e) {
3
+ l = { ...l, ...e };
4
+ }
5
+ function Q(e) {
6
+ const t = D(), n = new Headers(e);
7
+ n.append("Sinequa-Force-Camel-Case", "true"), n.append("accept", "application/json"), n.append("Sinequa-csrf-token", t);
8
+ const { userOverride: r, userOverrideActive: o } = l;
9
+ return r && o && (n.append("sinequa-override-user", r.username), n.append("sinequa-override-domain", r.domain)), n;
10
+ }
11
+ async function S(e) {
12
+ var n;
13
+ if (e.status === 401)
14
+ throw l.userOverrideActive ? (l.userOverrideActive = !1, new Error("Unauthorized... User override failed.")) : await ((n = e.body) == null ? void 0 : n.getReader().read().then(({ done: o, value: s }) => {
15
+ if (o)
16
+ return e;
17
+ const i = JSON.parse(new TextDecoder().decode(s));
18
+ return i.status = 401, i;
19
+ }));
20
+ if (e.status === 500 || e.status !== 200)
21
+ throw e;
22
+ const t = e.headers.get("sinequa-jwt-refresh");
23
+ return t !== null && v(t), await e.json();
24
+ }
25
+ async function u(e, t, n) {
26
+ const r = Q(n == null ? void 0 : n.headers), { app: o, backendUrl: s, apiPath: i } = l, a = {
27
+ app: o,
28
+ ...t,
29
+ locale: t.locale || navigator.language,
30
+ noUserOverride: !0,
31
+ noAutoAuthentication: !0
32
+ }, c = await fetch(
33
+ `${s}/${i}/${e}`,
34
+ {
35
+ method: "POST",
36
+ headers: r,
37
+ body: JSON.stringify(a)
38
+ }
39
+ );
40
+ return S(c);
41
+ }
42
+ async function h(e, t, n) {
43
+ const r = Q(n == null ? void 0 : n.headers), { backendUrl: o, apiPath: s } = l, i = t ? `?${new URLSearchParams(t)}` : void 0, a = await fetch(
44
+ `${o}/${s}/${e}${i}`,
45
+ {
46
+ method: "GET",
47
+ headers: r
48
+ }
49
+ );
50
+ return S(a);
51
+ }
52
+ const A = 11;
53
+ async function we(e, t, n) {
54
+ var i;
55
+ const o = await u("query", {
56
+ query: e,
57
+ $auditRecord: t,
58
+ queryIntentData: n
59
+ });
60
+ o.aggregations.forEach((a) => {
61
+ a.$hasMore = !1, !a.isDistribution && !a.isTree && a.items && (a.$hasMore = a.items.length === A), a.isTree && a.items && x(a);
62
+ }), (i = o.records) == null || i.map((a) => Object.assign(a, { value: a.title, type: "default" }));
63
+ const s = { ...o, nextPage: o.page < Math.ceil(o.rowCount / o.pageSize) ? o.page + 1 : void 0, previousPage: o.page > 1 ? o.page - 1 : void 0 };
64
+ return Promise.resolve(s);
65
+ }
66
+ async function Ce(e, t, n) {
67
+ const { app: r = "" } = l, o = {
68
+ methods: [],
69
+ mode: t,
70
+ propagateErrors: !0,
71
+ $auditRecord: { auditEvents: [n] }
72
+ };
73
+ for (const a of e)
74
+ o.methods.push({
75
+ method: "query",
76
+ app: r,
77
+ query: a
78
+ });
79
+ const s = await u("multi", o);
80
+ s.results.forEach((a) => {
81
+ a.aggregations.forEach((c) => {
82
+ c.$hasMore = !1, !c.isDistribution && !c.isTree && c.items && (c.$hasMore = c.items.length === A), c.isTree && x(c);
83
+ });
84
+ }), s.results.forEach((a) => {
85
+ var c;
86
+ return (c = a.records) == null ? void 0 : c.map((d) => Object.assign(d, { value: d.title, type: "default" }));
87
+ });
88
+ const i = s.results.map((a) => ({ ...a, nextPage: a.page < Math.ceil(a.rowCount / a.pageSize) ? a.page + 1 : void 0, previousPage: a.page > 1 ? a.page - 1 : void 0 }));
89
+ return Promise.resolve(i);
90
+ }
91
+ function x(e, t = "", n = 0) {
92
+ let r = [];
93
+ return e.items && e.items.forEach((o) => {
94
+ let s = t ? `${t}/${o.value}` : o.value, i = n + 1;
95
+ r.push({ path: s, level: i }), o.$path = s, o.$level = i, o.hasChildren && (r = r.concat(x(o, s, i)));
96
+ }), r;
97
+ }
98
+ async function Re(e, t) {
99
+ const n = `${window.location.origin}${window.location.pathname}`, r = { name: t == null ? void 0 : t.name, text: t == null ? void 0 : t.text };
100
+ return u("preview", {
101
+ action: "get",
102
+ id: e,
103
+ query: r,
104
+ browserUrl: n
105
+ });
106
+ }
107
+ async function be(e) {
108
+ const t = new Headers();
109
+ t.append("content-type", "text");
110
+ const n = await fetch(
111
+ e,
112
+ {
113
+ method: "GET",
114
+ headers: t
115
+ }
116
+ );
117
+ S(n);
118
+ }
119
+ async function Le() {
120
+ const e = new URLSearchParams({
121
+ action: "get",
122
+ noAutoAuthentication: "true"
123
+ });
124
+ return h("principal", e);
125
+ }
126
+ async function xe() {
127
+ const { app: e } = l, t = new URLSearchParams({ app: e || "" });
128
+ return h("app", t);
129
+ }
130
+ async function j() {
131
+ const { app: e } = l, t = new URLSearchParams({
132
+ app: e || "",
133
+ preLogin: "true"
134
+ });
135
+ return h("app", t);
136
+ }
137
+ function Pe() {
138
+ let { backendUrl: e, app: t } = l;
139
+ if (e || (e = window.location.origin), !t) {
140
+ const n = window.location.pathname.match(/\/app(?:-debug)?\/([^\/#]+)/);
141
+ n && (t = n[1]);
142
+ }
143
+ return L({
144
+ ...l,
145
+ backendUrl: e,
146
+ app: t
147
+ }), j().then((n) => {
148
+ const { autoOAuthProvider: r, autoSAMLProvider: o } = l, s = !r && !n.autoOAuthProvider && !o && !n.autoSAMLProvider;
149
+ L({
150
+ ...l,
151
+ autoOAuthProvider: r || n.autoOAuthProvider,
152
+ autoSAMLProvider: o || n.autoSAMLProvider,
153
+ useCredentialsOrSSO: s
154
+ }), console.log("Application initialized", n);
155
+ }).catch((n) => {
156
+ throw console.error("Error initializing application", n), n;
157
+ });
158
+ }
159
+ async function De(e, t, n) {
160
+ var f;
161
+ const r = ((f = e.items) == null ? void 0 : f.length) || 0, o = 10, s = {
162
+ query: { ...t, action: "aggregate", aggregations: { [e.name]: { skip: r, count: o } } },
163
+ $auditRecord: { auditEvents: [n] }
164
+ }, i = await u("query", s), a = await S(i), { aggregations: c } = a, d = c[0];
165
+ return d.$hasMore = d.items.length > o, d.items = [...e.items, ...d.items], Promise.resolve(d);
166
+ }
167
+ function ve(e, t, n) {
168
+ var s, i, a, c;
169
+ if (!e || !t) return;
170
+ if (n) {
171
+ const d = Object.keys(t.queries).find((C) => C === (n == null ? void 0 : n.toLowerCase()));
172
+ let f;
173
+ d && (f = t.queries[d]);
174
+ const w = (i = ((s = f == null ? void 0 : f.columnsInfo) == null ? void 0 : s.columns) || []) == null ? void 0 : i.find((C) => {
175
+ var U, O;
176
+ return (O = (U = C.aliases) == null ? void 0 : U.split(",")) == null ? void 0 : O.includes(e);
177
+ });
178
+ if (w) return w.name;
179
+ }
180
+ const r = (c = (a = t.indexes) == null ? void 0 : a._) == null ? void 0 : c.columns, o = Object.entries(r).find((d) => {
181
+ var f;
182
+ return (f = d[1].aliases) == null ? void 0 : f.includes(e);
183
+ });
184
+ if (o) return o[0];
185
+ }
186
+ function ye(e, t) {
187
+ const n = e[t];
188
+ return n === void 0 ? [] : Array.isArray(n) ? n.map((r) => typeof r == "string" ? { display: r } : r) : [{ display: n }];
189
+ }
190
+ function p(e) {
191
+ return e !== null && typeof e == "object";
192
+ }
193
+ function z(e) {
194
+ return p(e) && Object.prototype.toString.call(e) === "[object ArrayBuffer]";
195
+ }
196
+ function H(e) {
197
+ return p(e) && Object.prototype.toString.call(e) === "[object Blob]";
198
+ }
199
+ function J(e) {
200
+ return typeof e == "string";
201
+ }
202
+ function Ue(e) {
203
+ return (p(e) || Array.isArray(e)) && !z(e) && !H(e) && !J(e);
204
+ }
205
+ function X(e = !0) {
206
+ let t = Date.now();
207
+ return (e ? "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" : "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx").replace(/[xy]/g, (r) => {
208
+ const o = (t + Math.random() * 16) % 16 | 0;
209
+ return t = Math.floor(t / 16), (r === "x" ? o : o & 3 | 8).toString(16);
210
+ });
211
+ }
212
+ function Oe(e) {
213
+ if (!e)
214
+ return "``";
215
+ if (e = String(e), e.search(/[\\`]/) === -1)
216
+ return "`" + e + "`";
217
+ const t = ["`"];
218
+ for (let n = 0, r = e.length; n < r; n++) {
219
+ const o = e[n];
220
+ (o === "\\" || o === "`") && t.push("\\"), t.push(o);
221
+ }
222
+ return t.push("`"), t.join("");
223
+ }
224
+ function $e(e) {
225
+ return crypto.subtle.digest("SHA-512", new TextEncoder().encode(e)).then((t) => Array.prototype.map.call(new Uint8Array(t), (n) => ("00" + n.toString(16)).slice(-2)).join(""));
226
+ }
227
+ var _ = /* @__PURE__ */ ((e) => (e.None = "None", e.Search_FirstPage = "Search_FirstPage", e.Search_Text = "Search_Text", e.Search_Refine = "Search_Refine", e.Search_Select_Item = "Search_Select_Item", e.Search_Select_Custom = "Search_Select_Custom", e.Search_Select_Concept = "Search_Select_Concept", e.Search_Select_Correction = "Search_Select_Correction", e.Search_GotoPage = "Search_GotoPage", e.Search_GotoTab = "Search_GotoTab", e.Search_DisplayResult = "Search_DisplayResult", e.Search_RemoveResult = "Search_RemoveResult", e.Search_RemoveAdvanced = "Search_RemoveAdvanced", e.Search_SavedQuery = "Search_SavedQuery", e.Search_WebService = "Search_WebService", e.Search_DidYouMean_Original = "Search_DidYouMean_Original", e.Search_DidYouMean_Correction = "Search_DidYouMean_Correction", e.Search_ExportCSV = "Search_ExportCSV", e.Search_SavedQuery_ExportCSV = "Search_SavedQuery_ExportCSV", e.Search_Selection_ExportCSV = "Search_Selection_ExportCSV", e.Search_AlertQuery = "Search_AlertQuery", e.Search_Select_AnalyticsItem = "Search_Select_AnalyticsItem", e.Search_Sort = "Search_Sort", e.Search_Exit_Logout = "Search_Exit_Logout", e.Search_Timeline_Usage = "Search_Timeline_Usage", e.Search_AutoComplete = "Search_Autocomplete", e.Search_Login_Success = "Login_Success_Form", e.Search_QueryIntent_Detected = "Search_QueryIntent_Detected", e.SavedQuery_Add = "SavedQuery_Add", e.SavedQuery_Delete = "SavedQuery_Delete", e.SavedQuery_DeleteAll = "SavedQuery_DeleteAll", e.SavedQuery_Rename = "SavedQuery_Rename", e.Alert_Edit = "Alert_Edit", e.Alert_Delete = "Alert_Delete", e.Alert_DeleteAll = "Alert_DeleteAll", e.Link_Display = "Link_Display", e.Link_Click = "Link_Click", e.Basket_Add = "Basket_Add", e.Basket_Delete = "Basket_Delete", e.Basket_DeleteAll = "Basket_DeleteAll", e.Basket_Rename = "Basket_Rename", e.Basket_AddDoc = "Basket_AddDoc", e.Basket_RemoveDoc = "Basket_RemoveDoc", e.Basket_Open = "Basket_Open", e.Basket_ExportCSV = "Basket_ExportCSV", e.Label_Add = "Label_Add", e.Label_Delete = "Label_Delete", e.Label_Rename = "Label_Rename", e.Label_Open = "Label_Open", e.Label_AddDoc = "Label_AddDoc", e.Label_RemoveDoc = "Label_RemoveDoc", e.Label_ExportCSV = "Label_ExportCSV", e.Label_Menu_ExportCSV = "Label_Menu_ExportCSV", e.Rating_Set = "Rating_Set", e.Rating_Delete = "Rating_Delete", e.Doc_Preview = "Doc_Preview", e.Doc_CacheHtml = "Doc_CacheHtml", e.Doc_CachePdf = "Doc_CachePdf", e.Doc_CacheOriginal = "Doc_CacheOriginal", e.Doc_Url1 = "Doc_Url1", e.Doc_Url2 = "Doc_Url2", e.Preview_Close = "Preview_Close", e.Click_ResultLink = "Click_ResultLink", e.Click_ResultLink1 = "Click_ResultLink1", e.Click_ResultLink2 = "Click_ResultLink2", e.Click_ResultLink3 = "Click_ResultLink3", e.Click_ResultLink4 = "Click_ResultLink4", e.Click_ResultLink5 = "Click_ResultLink5", e.Click_ResultLink6 = "Click_ResultLink6", e.Click_ResultLink7 = "Click_ResultLink7", e.Click_ResultLink8 = "Click_ResultLink8", e.Click_ResultLink9 = "Click_ResultLink9", e.Click_ResultLink10 = "Click_ResultLink10", e.Click_PreviewLink1 = "Click_PreviewLink1", e.Click_PreviewLink2 = "Click_PreviewLink2", e.Click_PreviewLink3 = "Click_PreviewLink3", e.Click_PreviewLink4 = "Click_PreviewLink4", e.Click_PreviewLink5 = "Click_PreviewLink5", e.Click_PreviewLink6 = "Click_PreviewLink6", e.Click_PreviewLink7 = "Click_PreviewLink7", e.Click_PreviewLink8 = "Click_PreviewLink8", e.Click_PreviewLink9 = "Click_PreviewLink9", e.Click_PreviewLink10 = "Click_PreviewLink10", e.RFM_ClickSet = "RFM_ClickSet", e.RFM_ClickReset = "RFM_ClickReset", e.RFM_Like = "RFM_Like", e.RFM_LikeReset = "RFM_LikeReset", e.RFM_Dislike = "RFM_Dislike", e.RFM_Important = "RFM_Important", e.RFM_ImportantReset = "RFM_ImportantReset", e.RFM_Ban = "RFM_Ban", e.Navigation_Exit = "Navigation_Exit", e.Navigation_Return = "Navigation_Return", e.Navigation_Route = "Navigation_Route", e.Answer_Display = "Answer_Display", e.Answer_Click = "Answer_Click", e.Answer_Result = "Answer_Result", e.Answer_Liked = "Answer_Liked", e.Answer_Disliked = "Answer_Disliked", e.Answer_Liked_Cancelled = "Answer_Liked_Cancelled", e.Answer_Disliked_Cancelled = "Answer_Disliked_Cancelled", e.TopPassages_Display = "TopPassages_Display", e.TopPassages_Click = "TopPassages_Click", e.UserSettings_Reset = "UserSettings_Reset", e))(_ || {});
228
+ const Me = "1.0";
229
+ let R, N;
230
+ function P(e) {
231
+ let t = q(e.$auditRecord);
232
+ t && (W(t), Y(t)), e.$auditRecord = t;
233
+ }
234
+ function q(e) {
235
+ if (!e)
236
+ return;
237
+ let t;
238
+ if (Array.isArray(e))
239
+ t = e;
240
+ else if (p(e)) {
241
+ const n = e;
242
+ if (n.auditEvents || n.mlAuditEvents)
243
+ return n;
244
+ t = [e];
245
+ }
246
+ return { auditEvents: t };
247
+ }
248
+ function W(e) {
249
+ var n;
250
+ const t = K();
251
+ return (n = e.auditEvents) == null || n.forEach((r) => {
252
+ r.detail || (r.detail = {}), r.detail.sessionid = t;
253
+ }), e;
254
+ }
255
+ function Y(e) {
256
+ var n;
257
+ const t = decodeURIComponent(window.location.href);
258
+ return (n = e == null ? void 0 : e.auditEvents) == null || n.forEach((r) => {
259
+ r.detail || (r.detail = {}), r.detail.url = t;
260
+ }), e;
261
+ }
262
+ function K() {
263
+ return (!R || Z()) && (R = X()), N = /* @__PURE__ */ new Date(), R;
264
+ }
265
+ function Z() {
266
+ return (/* @__PURE__ */ new Date()).getTime() - N.getTime() > 10 * 60 * 1e3;
267
+ }
268
+ async function E(e) {
269
+ const t = {
270
+ event: _.None,
271
+ $auditRecord: e
272
+ };
273
+ return P(t), u("audit.notify", t);
274
+ }
275
+ const Fe = { notify: E };
276
+ async function Ie() {
277
+ const { app: e } = l, t = new URLSearchParams({
278
+ app: e || "",
279
+ action: "load"
280
+ });
281
+ return h("usersettings", t);
282
+ }
283
+ async function T(e, t) {
284
+ const n = {
285
+ action: "save",
286
+ userSettings: e,
287
+ $auditRecord: { auditEvents: [t] }
288
+ };
289
+ return P(n), u("usersettings", n);
290
+ }
291
+ async function Be(e, t) {
292
+ const r = {
293
+ action: "patch",
294
+ userSettings: e,
295
+ $auditRecord: t ? { auditEvents: [t] } : void 0
296
+ };
297
+ return P(r), u("usersettings", r);
298
+ }
299
+ async function Qe() {
300
+ return T({}, { type: "UserSettings_Reset" });
301
+ }
302
+ async function Ae(e, t, n, r, o) {
303
+ const { app: s } = l;
304
+ return (await u("search.suggest", {
305
+ app: s || "",
306
+ suggestQuery: e,
307
+ text: t,
308
+ filter: n,
309
+ kinds: r,
310
+ showSource: o
311
+ })).suggests;
312
+ }
313
+ async function Ne(e, t, n, r) {
314
+ const { app: o } = l;
315
+ return (await u("suggestquery", {
316
+ app: o || "",
317
+ suggestQuery: e,
318
+ text: t,
319
+ query: n,
320
+ kinds: r
321
+ })).suggests;
322
+ }
323
+ async function Ge(e, t) {
324
+ if (!t) return Promise.resolve([]);
325
+ const { app: n } = l;
326
+ return (await u("suggestfield", {
327
+ app: n || "",
328
+ text: e,
329
+ action: "suggests",
330
+ fields: t
331
+ })).suggests;
332
+ }
333
+ async function Ve(e, t) {
334
+ var o;
335
+ const r = await u("query.links", {
336
+ webservice: e,
337
+ query: t
338
+ });
339
+ return (o = r == null ? void 0 : r.links) == null ? void 0 : o.map((s) => ({ ...s, query: t }));
340
+ }
341
+ async function je(e, t, n, r, o, s) {
342
+ return u("doc.textchunks", {
343
+ id: e,
344
+ textChunks: t,
345
+ highlights: n,
346
+ query: r,
347
+ leftSentencesCount: o,
348
+ rightSentencesCount: s
349
+ });
350
+ }
351
+ async function ze(e, t, n = {}) {
352
+ const r = `search.dataset/${e}/${t}`, s = (await u(r, { parameters: n })).datasets[t];
353
+ if ("errorCode" in s && "errorMessage" in s)
354
+ throw new Error(s.errorMessage);
355
+ return s;
356
+ }
357
+ async function He(e, t) {
358
+ const n = `search.dataset/${e}`, { parameters: r = {}, datasets: o = [] } = t;
359
+ return (await u(n, { parameters: r, datasets: o })).datasets;
360
+ }
361
+ async function Je(e) {
362
+ return await h(`search.dataset/${e}`);
363
+ }
364
+ async function Xe(e, t = !0, n) {
365
+ return (await u("labels", {
366
+ action: "list",
367
+ q: e,
368
+ public: t,
369
+ locale: n,
370
+ localize: !1
371
+ })).labels;
372
+ }
373
+ async function ee() {
374
+ const { app: e = "" } = l, t = new URLSearchParams({
375
+ app: e,
376
+ action: "getUserRights"
377
+ });
378
+ return h("labels", t);
379
+ }
380
+ async function te(e, t, n = !0) {
381
+ const r = {
382
+ action: "add",
383
+ labels: e,
384
+ ids: t,
385
+ public: n,
386
+ $auditRecord: {
387
+ auditEvents: [
388
+ {
389
+ type: _.Label_AddDoc,
390
+ detail: {
391
+ public: n,
392
+ label: e ? e.toString() : null,
393
+ doccount: t ? t.length : 0
394
+ }
395
+ }
396
+ ],
397
+ mlAuditEvents: [
398
+ {
399
+ actionType: "addToLabel",
400
+ documentIds: t
401
+ }
402
+ ]
403
+ }
404
+ };
405
+ return u("labels", r);
406
+ }
407
+ async function ne(e, t, n = !0) {
408
+ const r = {
409
+ action: "remove",
410
+ labels: e,
411
+ ids: t,
412
+ public: n,
413
+ $auditRecord: {
414
+ auditEvents: [
415
+ {
416
+ type: _.Label_RemoveDoc,
417
+ detail: {
418
+ public: n,
419
+ label: e ? e.toString() : null,
420
+ doccount: t ? t.length : 0
421
+ }
422
+ }
423
+ ],
424
+ mlAuditEvents: [
425
+ {
426
+ actionType: "removeFromLabel",
427
+ documentIds: t
428
+ }
429
+ ]
430
+ }
431
+ };
432
+ return u("labels", r);
433
+ }
434
+ async function re(e, t, n = !0) {
435
+ const r = {
436
+ action: "rename",
437
+ labels: e,
438
+ newLabel: t,
439
+ public: n,
440
+ auditEvents: {
441
+ type: _.Label_Rename,
442
+ detail: {
443
+ public: n,
444
+ oldlabel: e ? e.toString() : null,
445
+ label: t
446
+ }
447
+ }
448
+ };
449
+ return u("labels", r);
450
+ }
451
+ async function oe(e, t = !0) {
452
+ const n = {
453
+ action: "delete",
454
+ labels: e,
455
+ public: t,
456
+ auditEvents: {
457
+ type: _.Label_Delete,
458
+ detail: {
459
+ public: t,
460
+ label: e ? e.toString() : null
461
+ }
462
+ }
463
+ };
464
+ return u("labels", n);
465
+ }
466
+ async function se(e, t, n = !0) {
467
+ const r = {
468
+ action: "bulkAdd",
469
+ labels: e,
470
+ query: t,
471
+ public: n,
472
+ auditEvents: {
473
+ type: _.Label_Add,
474
+ detail: {
475
+ public: n,
476
+ label: e ? e.toString() : null,
477
+ query: t !== null ? t.name : null
478
+ }
479
+ }
480
+ };
481
+ return u("labels", r);
482
+ }
483
+ async function ae(e, t, n = !0) {
484
+ const r = {
485
+ action: "bulkRemove",
486
+ labels: e,
487
+ query: t,
488
+ public: n,
489
+ auditEvents: {
490
+ type: _.Label_Delete,
491
+ detail: {
492
+ public: n,
493
+ label: e ? e.toString() : null,
494
+ query: t !== null ? t.name : null
495
+ }
496
+ }
497
+ };
498
+ return u("labels", r);
499
+ }
500
+ const qe = {
501
+ getUserRights: ee,
502
+ add: te,
503
+ remove: ne,
504
+ rename: re,
505
+ delete: oe,
506
+ bulkAdd: se,
507
+ bulkRemove: ae
508
+ };
509
+ function g(e) {
510
+ const t = new CustomEvent(
511
+ "authenticated",
512
+ {
513
+ bubbles: !0,
514
+ cancelable: !1,
515
+ detail: { authenticated: e }
516
+ }
517
+ );
518
+ dispatchEvent(t);
519
+ }
520
+ async function ie() {
521
+ const { autoOAuthProvider: e } = l, t = {
522
+ action: "getcode",
523
+ provider: e,
524
+ tokenInCookie: !0,
525
+ originalUrl: window.location.href
526
+ }, n = await u("security.oauth", t);
527
+ n.redirectUrl && (window.location.href = n.redirectUrl);
528
+ }
529
+ async function ce() {
530
+ const { autoSAMLProvider: e } = l, t = {
531
+ action: "getresponse",
532
+ provider: e,
533
+ tokenInCookie: !0,
534
+ originalUrl: window.location.href
535
+ }, n = await u("security.saml", t);
536
+ n.redirectUrl && (window.location.href = n.redirectUrl);
537
+ }
538
+ const le = async (e) => {
539
+ const { username: t, password: n } = e || {}, o = await u("webToken", {
540
+ action: "get",
541
+ tokenInCookie: !0,
542
+ user: t,
543
+ password: n,
544
+ noUserOverride: !0,
545
+ noAutoAuthentication: !0
546
+ });
547
+ return o.csrfToken ? (v(o.csrfToken), !0) : !1;
548
+ }, ue = async () => {
549
+ const e = new URLSearchParams({
550
+ action: "deleteWebTokenCookie",
551
+ noUserOverride: "true",
552
+ noAutoAuthentication: "true"
553
+ });
554
+ return h("challenge", e);
555
+ }, D = () => localStorage.getItem("csrfToken") || "", v = (e) => localStorage.setItem("csrfToken", e), We = async (e) => {
556
+ const { useSSO: t } = l;
557
+ if (D() || t)
558
+ return g(!0), !0;
559
+ const { username: n, password: r } = e || {};
560
+ let o;
561
+ return n && r ? (L({ useCredentials: !0 }), o = await le(e)) : o = await de(), g(o), o;
562
+ }, Ye = async () => {
563
+ const { useCredentials: e, userOverrideActive: t } = l;
564
+ localStorage.removeItem("csrfToken"), e && !t ? (await ue()).methodresult === "ok" ? g(!1) : console.error("logout failed") : g(!1);
565
+ }, Ke = () => !!D(), de = async () => {
566
+ const { backendUrl: e, apiPath: t, autoOAuthProvider: n, autoSAMLProvider: r } = l, s = await (await fetch(`${e}/${t}/challenge?action=getCsrfToken&suppressErrors=true`)).json();
567
+ if (s != null && s.csrfToken)
568
+ return v(s.csrfToken), !0;
569
+ if (n)
570
+ await ie();
571
+ else if (r)
572
+ await ce();
573
+ else
574
+ throw new Error("No CSRF token found and no autoOauthProvider nor autoSAMLProvider are specified");
575
+ return !1;
576
+ };
577
+ function Ze(e, t) {
578
+ var o;
579
+ return !(e != null && e.items) || ((o = e == null ? void 0 : e.items) == null ? void 0 : o.length) === 0 ? [] : e.items.reduce((s, i) => {
580
+ if (!i.value || i.value === "") return s;
581
+ const a = fe(i, e.column);
582
+ return s.push({
583
+ operator: a.operator,
584
+ value: a.value,
585
+ display: i.display || a.display,
586
+ filters: a.filters,
587
+ disabled: i.count === 0,
588
+ hidden: i.count === 0 && e.isDistribution ? !t : !1
589
+ }), s;
590
+ }, []);
591
+ }
592
+ function fe(e, t) {
593
+ const n = t, r = e.value.match(/.*\:\(?([><=\d\-\.AND ]+)\)?/);
594
+ if (r != null && r[1]) {
595
+ const s = (r == null ? void 0 : r[1].split(" AND ")).map((i) => {
596
+ const a = i.indexOf(">=") !== -1 ? "gte" : "lt";
597
+ let c = i.substring(i.indexOf(" ") + 1);
598
+ return { field: n, operator: a, value: c, display: e.display || e.value };
599
+ });
600
+ if (s.length === 2)
601
+ return { field: n, operator: "and", filters: s, value: e.value, display: s[0].display || s[0].value };
602
+ if (s.length === 1)
603
+ return { ...s[0], field: n };
604
+ throw new Error("Failed to parse distribution expression");
605
+ }
606
+ return { field: n, operator: "eq", value: e.value, display: e.display };
607
+ }
608
+ function Ee(e, t, n) {
609
+ return e.valuesAreExpressions ? t.display === n.display : t.value === n.value;
610
+ }
611
+ function Te(e, t) {
612
+ const n = [];
613
+ if (e.length > 0) {
614
+ const r = /* @__PURE__ */ new Map(), o = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = new RegExp("\\b" + o, "i");
615
+ e.forEach((i) => {
616
+ if (i.display.length > 1) {
617
+ const a = s.exec(i.display);
618
+ G(n, r, "/", i.display, +(i.frequency || 0), 1, ((a == null ? void 0 : a.index) || 0) + t.length);
619
+ }
620
+ });
621
+ }
622
+ return n;
623
+ }
624
+ function G(e, t, n, r, o, s, i) {
625
+ const a = r.indexOf("/", n.length), c = r.substring(0, a + 1);
626
+ let d = t.get(c);
627
+ if (!d) {
628
+ const f = c.replace(/^\/|\/$/g, "");
629
+ d = {
630
+ value: r.substring(n.length, a),
631
+ count: o,
632
+ items: [],
633
+ hasChildren: !1,
634
+ $level: s,
635
+ $opened: i >= c.length,
636
+ $path: f
637
+ }, t.set(c, d), e.push(d);
638
+ }
639
+ c.length < r.length && (d.hasChildren = !0, G(d.items, t, c, r, o, s + 1, i));
640
+ }
641
+ function et(e, t) {
642
+ return e.reduce((n, r) => (t(r) ? n.true.push(r) : n.false.push(r), n), { true: [], false: [] });
643
+ }
644
+ const _e = /(([\+\-])?\(([^\)]+)\))|(([\+\-])?\[([^\]]+)\])|(([\+\-])?\"([^\"]+)\")|(([\+\-])?\/([^\/]+)\/)|(([\+\-])?(\S+))/g, he = 2, $ = 3, ke = 5, M = 6, ge = 8, F = 9, Se = 11, I = 12, pe = 14, B = 15;
645
+ function m(e) {
646
+ if (!e) return [];
647
+ const t = [], n = e.matchAll(_e);
648
+ for (let r of n)
649
+ r[$] ? t.push({ type: "group", value: r[$], op: r[he] }) : r[M] ? t.push({ type: "adjacent", value: r[M], op: r[ke] }) : r[F] ? t.push({ type: "exact", value: r[F], op: r[ge] }) : r[I] ? t.push({ type: "regex", value: r[I], op: r[Se] }) : r[B] && t.push({ type: "token", value: r[B], op: r[pe] });
650
+ return t;
651
+ }
652
+ function y(e) {
653
+ return e.map((t) => {
654
+ const n = t.op || "";
655
+ switch (t.type) {
656
+ case "group":
657
+ return `${n}(${t.value})`;
658
+ case "adjacent":
659
+ return `${n}[${t.value}]`;
660
+ case "exact":
661
+ return `${n}"${t.value}"`;
662
+ case "regex":
663
+ return `${n}/${t.value}/`;
664
+ case "token":
665
+ return `${n}${t.value}`;
666
+ }
667
+ }).join(" ");
668
+ }
669
+ function tt(e, t, n) {
670
+ let r = m(e);
671
+ for (let o of t)
672
+ r.push({ type: "adjacent", value: o, op: n });
673
+ return y(r);
674
+ }
675
+ function nt(e, t) {
676
+ const n = m(t), r = n.findIndex((o) => o.value === e);
677
+ return r !== -1 ? (n.splice(r, 1), t = y(n)) : t;
678
+ }
679
+ function rt(e) {
680
+ const t = m(e).filter((n) => n.type !== "adjacent");
681
+ return y(t);
682
+ }
683
+ function ot(e) {
684
+ return m(e).filter((t) => t.type === "adjacent").map((t) => t.value);
685
+ }
686
+ function st(e, t, n) {
687
+ const r = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset: o, unit: s, isFuture: i } = me(t, n);
688
+ return r.format(o * (i ? 1 : -1), s);
689
+ }
690
+ function me(e, t) {
691
+ const n = new Date(e), r = t ? new Date(t) : /* @__PURE__ */ new Date(), o = Math.abs(r.getTime() - n.getTime());
692
+ return {
693
+ offset: Math.floor(o / (1e3 * 60 * 60 * 24)),
694
+ unit: "day",
695
+ isFuture: n > r
696
+ };
697
+ }
698
+ function at(e) {
699
+ if (e === void 0) return;
700
+ const { q: t, f: n, p: r, s: o, t: s, ...i } = k(e), [a] = e.split("?");
701
+ return {
702
+ path: a,
703
+ text: t,
704
+ filters: n ? V(n) : void 0,
705
+ page: r ? parseInt(r, 10) : void 0,
706
+ sort: o,
707
+ tab: s,
708
+ ...i
709
+ };
710
+ }
711
+ function it(e) {
712
+ if (e === void 0) return [];
713
+ const { f: t } = k(e);
714
+ return V(t);
715
+ }
716
+ function V(e) {
717
+ const t = decodeURIComponent(e);
718
+ return JSON.parse(t ?? "[]");
719
+ }
720
+ function k(e) {
721
+ const t = e.split("?")[1];
722
+ if (t === void 0) return {};
723
+ const n = new URLSearchParams(t);
724
+ return Object.fromEntries(n);
725
+ }
726
+ function ct(e) {
727
+ const { q: t = "" } = k(e);
728
+ return t;
729
+ }
730
+ function lt(e) {
731
+ const { id: t } = k(e);
732
+ return decodeURIComponent(t);
733
+ }
734
+ function ut(e) {
735
+ const { p: t = "0" } = k(e);
736
+ return parseInt(t, 10);
737
+ }
738
+ function dt(e) {
739
+ const { t } = k(e);
740
+ return t;
741
+ }
742
+ function ft(e, t) {
743
+ if (!e)
744
+ return e;
745
+ let n = 0;
746
+ const r = e.length;
747
+ let o = 0;
748
+ if (e[o] === "[") {
749
+ for (; o < r && /[0-9]/.test(e[o]); )
750
+ o++;
751
+ e[o] === "]" && (n = o + 1);
752
+ }
753
+ const s = b(e, n, !1);
754
+ if (!s)
755
+ return e;
756
+ const i = t.charCodeAt(0), a = t.charCodeAt(1);
757
+ let c = s;
758
+ for (; c; )
759
+ if (i === c.lang1 && a === c.lang2) {
760
+ const f = b(e, c.end + 4, !0);
761
+ return e.substring(f.start, f.end);
762
+ } else
763
+ c = b(e, c.end + 4, !1);
764
+ const d = e.substring(s.start, s.end);
765
+ return d || e;
766
+ }
767
+ function b(e, t, n) {
768
+ for (let r = t, o = e.length - 3; r < o; r++)
769
+ if (e[r] === "[" && e[r + 3] === "]")
770
+ return {
771
+ start: t,
772
+ end: r,
773
+ lang1: e.charCodeAt(r + 1),
774
+ lang2: e.charCodeAt(r + 2)
775
+ };
776
+ if (n)
777
+ return {
778
+ start: t,
779
+ end: e.length,
780
+ lang1: -1,
781
+ lang2: -1
782
+ };
783
+ }
784
+ export {
785
+ Fe as Audit,
786
+ _ as AuditEventType,
787
+ Me as MINIMUM_COMPATIBLE_SERVER_API_VERSION,
788
+ P as addAuditAdditionalInfo,
789
+ tt as addConcepts,
790
+ W as addSessionId,
791
+ Y as addUrl,
792
+ Ee as aggregationItemStrictCompare,
793
+ Pe as appInitializerFn,
794
+ et as bisect,
795
+ x as buildPathsAndLevels,
796
+ Q as createHeaders,
797
+ Qe as deleteUserSettings,
798
+ ue as deleteWebTokenCookie,
799
+ Oe as escapeExpr,
800
+ De as fetchAggregation,
801
+ xe as fetchApp,
802
+ j as fetchAppPreLogin,
803
+ Ce as fetchBulkQuery,
804
+ ze as fetchDataset,
805
+ Je as fetchDatasetList,
806
+ He as fetchDatasets,
807
+ Xe as fetchLabels,
808
+ Re as fetchPreview,
809
+ be as fetchPreviewUrl,
810
+ Le as fetchPrincipal,
811
+ we as fetchQuery,
812
+ Ve as fetchSponsoredLinks,
813
+ Ae as fetchSuggest,
814
+ Ge as fetchSuggestField,
815
+ Ne as fetchSuggestQuery,
816
+ je as fetchTextChunks,
817
+ Ie as fetchUserSettings,
818
+ h as get,
819
+ ot as getConcepts,
820
+ V as getFiltersFromURI,
821
+ it as getFiltersFromUrl,
822
+ lt as getIdFromUrl,
823
+ le as getJWToken,
824
+ ye as getMetadata,
825
+ me as getOffsetFromDates,
826
+ ut as getQueryPageFromUrl,
827
+ at as getQueryParamsFromUrl,
828
+ dt as getQueryTabFromUrl,
829
+ ct as getQueryTextFromUrl,
830
+ st as getRelativeDate,
831
+ D as getToken,
832
+ l as globalConfig,
833
+ X as guid,
834
+ S as handleResponse,
835
+ z as isArrayBuffer,
836
+ Ke as isAuthenticated,
837
+ H as isBlob,
838
+ Ue as isJsonable,
839
+ p as isObject,
840
+ J as isString,
841
+ qe as labels,
842
+ We as login,
843
+ Ye as logout,
844
+ m as parseText,
845
+ fe as parseValueAndOperatorFromItem,
846
+ Be as patchUserSettings,
847
+ u as post,
848
+ k as queryParamsFromUrl,
849
+ nt as removeConcept,
850
+ rt as removeConcepts,
851
+ ve as resolveToColumnName,
852
+ y as rewriteText,
853
+ T as saveUserSettings,
854
+ L as setGlobalConfig,
855
+ v as setToken,
856
+ $e as sha512,
857
+ Te as suggestionsToTreeAggregationNodes,
858
+ ft as sysLang,
859
+ Ze as translateAggregationToDateOptions
860
+ };