@sinequa/atomic 0.0.110 → 0.0.113

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 (95) hide show
  1. package/dist/atomic.js +375 -367
  2. package/dist/atomic.umd.cjs +1 -1
  3. package/dist/configurations/global.config.d.ts +0 -1
  4. package/dist/configurations/global.config.d.ts.map +1 -1
  5. package/dist/types/api-endpoints.d.ts +1 -1
  6. package/dist/types/api-endpoints.d.ts.map +1 -1
  7. package/dist/types/config/CCQuery.d.ts +1 -0
  8. package/dist/types/config/CCQuery.d.ts.map +1 -1
  9. package/dist/utils/aggregations.d.ts +7 -0
  10. package/dist/utils/aggregations.d.ts.map +1 -1
  11. package/dist/web-api/helpers/create-headers.d.ts +6 -0
  12. package/dist/web-api/helpers/create-headers.d.ts.map +1 -0
  13. package/dist/web-api/helpers/errors/api-error.d.ts +8 -0
  14. package/dist/web-api/helpers/errors/api-error.d.ts.map +1 -0
  15. package/dist/web-api/helpers/errors/server-error.d.ts +8 -0
  16. package/dist/web-api/helpers/errors/server-error.d.ts.map +1 -0
  17. package/dist/web-api/helpers/errors/timeout-error.d.ts +8 -0
  18. package/dist/web-api/helpers/errors/timeout-error.d.ts.map +1 -0
  19. package/dist/web-api/helpers/errors/unauthorized-error.d.ts +8 -0
  20. package/dist/web-api/helpers/errors/unauthorized-error.d.ts.map +1 -0
  21. package/dist/web-api/helpers/handle-response.d.ts +9 -0
  22. package/dist/web-api/helpers/handle-response.d.ts.map +1 -0
  23. package/dist/web-api/helpers/index.d.ts +15 -0
  24. package/dist/web-api/helpers/index.d.ts.map +1 -0
  25. package/dist/web-api/helpers/methods/del.d.ts +16 -0
  26. package/dist/web-api/helpers/methods/del.d.ts.map +1 -0
  27. package/dist/web-api/helpers/methods/get.d.ts +17 -0
  28. package/dist/web-api/helpers/methods/get.d.ts.map +1 -0
  29. package/dist/web-api/helpers/methods/patch.d.ts +16 -0
  30. package/dist/web-api/helpers/methods/patch.d.ts.map +1 -0
  31. package/dist/web-api/helpers/methods/post.d.ts +18 -0
  32. package/dist/web-api/helpers/methods/post.d.ts.map +1 -0
  33. package/dist/web-api/helpers/methods/put.d.ts +16 -0
  34. package/dist/web-api/helpers/methods/put.d.ts.map +1 -0
  35. package/dist/web-api/helpers/request-options.d.ts +18 -0
  36. package/dist/web-api/helpers/request-options.d.ts.map +1 -0
  37. package/dist/web-api/helpers/tests/helpers.test.d.ts.map +1 -0
  38. package/dist/web-api/helpers/utils/create-timeout-controller.d.ts +10 -0
  39. package/dist/web-api/helpers/utils/create-timeout-controller.d.ts.map +1 -0
  40. package/dist/web-api/helpers/utils/with-retry.d.ts +9 -0
  41. package/dist/web-api/helpers/utils/with-retry.d.ts.map +1 -0
  42. package/dist/web-api/index.d.ts +16 -15
  43. package/dist/web-api/index.d.ts.map +1 -1
  44. package/dist/web-api/{fetch-aggregation.d.ts → v1/fetch-aggregation.d.ts} +1 -1
  45. package/dist/web-api/v1/fetch-aggregation.d.ts.map +1 -0
  46. package/dist/web-api/{fetch-app.d.ts → v1/fetch-app.d.ts} +1 -1
  47. package/dist/web-api/v1/fetch-app.d.ts.map +1 -0
  48. package/dist/web-api/{fetch-audit.d.ts → v1/fetch-audit.d.ts} +1 -1
  49. package/dist/web-api/v1/fetch-audit.d.ts.map +1 -0
  50. package/dist/web-api/{fetch-dataset.d.ts → v1/fetch-dataset.d.ts} +1 -1
  51. package/dist/web-api/v1/fetch-dataset.d.ts.map +1 -0
  52. package/dist/web-api/{fetch-labels.d.ts → v1/fetch-labels.d.ts} +1 -1
  53. package/dist/web-api/v1/fetch-labels.d.ts.map +1 -0
  54. package/dist/web-api/{fetch-preview.d.ts → v1/fetch-preview.d.ts} +1 -1
  55. package/dist/web-api/v1/fetch-preview.d.ts.map +1 -0
  56. package/dist/web-api/{fetch-principal.d.ts → v1/fetch-principal.d.ts} +1 -1
  57. package/dist/web-api/v1/fetch-principal.d.ts.map +1 -0
  58. package/dist/web-api/{fetch-query-export.d.ts → v1/fetch-query-export.d.ts} +2 -2
  59. package/dist/web-api/v1/fetch-query-export.d.ts.map +1 -0
  60. package/dist/web-api/{fetch-query-intent.d.ts → v1/fetch-query-intent.d.ts} +1 -1
  61. package/dist/web-api/v1/fetch-query-intent.d.ts.map +1 -0
  62. package/dist/web-api/{fetch-query.d.ts → v1/fetch-query.d.ts} +1 -1
  63. package/dist/web-api/v1/fetch-query.d.ts.map +1 -0
  64. package/dist/web-api/{fetch-similar-documents.d.ts → v1/fetch-similar-documents.d.ts} +1 -1
  65. package/dist/web-api/v1/fetch-similar-documents.d.ts.map +1 -0
  66. package/dist/web-api/{fetch-sponsored-links.d.ts → v1/fetch-sponsored-links.d.ts} +1 -1
  67. package/dist/web-api/v1/fetch-sponsored-links.d.ts.map +1 -0
  68. package/dist/web-api/{fetch-suggest.d.ts → v1/fetch-suggest.d.ts} +1 -1
  69. package/dist/web-api/v1/fetch-suggest.d.ts.map +1 -0
  70. package/dist/web-api/{fetch-text-chunk.d.ts → v1/fetch-text-chunk.d.ts} +1 -1
  71. package/dist/web-api/v1/fetch-text-chunk.d.ts.map +1 -0
  72. package/dist/web-api/{fetch-user-settings.d.ts → v1/fetch-user-settings.d.ts} +1 -1
  73. package/dist/web-api/v1/fetch-user-settings.d.ts.map +1 -0
  74. package/dist/web-api/v2/fetch-version.d.ts +6 -0
  75. package/dist/web-api/v2/fetch-version.d.ts.map +1 -0
  76. package/package.json +1 -1
  77. package/dist/web-api/fetch-aggregation.d.ts.map +0 -1
  78. package/dist/web-api/fetch-app.d.ts.map +0 -1
  79. package/dist/web-api/fetch-audit.d.ts.map +0 -1
  80. package/dist/web-api/fetch-dataset.d.ts.map +0 -1
  81. package/dist/web-api/fetch-labels.d.ts.map +0 -1
  82. package/dist/web-api/fetch-preview.d.ts.map +0 -1
  83. package/dist/web-api/fetch-principal.d.ts.map +0 -1
  84. package/dist/web-api/fetch-query-export.d.ts.map +0 -1
  85. package/dist/web-api/fetch-query-intent.d.ts.map +0 -1
  86. package/dist/web-api/fetch-query.d.ts.map +0 -1
  87. package/dist/web-api/fetch-similar-documents.d.ts.map +0 -1
  88. package/dist/web-api/fetch-sponsored-links.d.ts.map +0 -1
  89. package/dist/web-api/fetch-suggest.d.ts.map +0 -1
  90. package/dist/web-api/fetch-text-chunk.d.ts.map +0 -1
  91. package/dist/web-api/fetch-user-settings.d.ts.map +0 -1
  92. package/dist/web-api/helpers.d.ts +0 -147
  93. package/dist/web-api/helpers.d.ts.map +0 -1
  94. package/dist/web-api/helpers.test.d.ts.map +0 -1
  95. /package/dist/web-api/{helpers.test.d.ts → helpers/tests/helpers.test.d.ts} +0 -0
package/dist/atomic.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var oe = Object.defineProperty;
2
2
  var se = (e, t, r) => t in e ? oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var H = (e, t, r) => se(e, typeof t != "symbol" ? t + "" : t, r);
4
- const u = { apiPath: "api/v1", loginPath: "/login", backendUrl: typeof window < "u" ? window.location.origin : "http://localhost", createRoutes: !1 };
5
- function S(e) {
4
+ const u = { loginPath: "/login", backendUrl: typeof window < "u" ? window.location.origin : "http://localhost", createRoutes: !1 };
5
+ function m(e) {
6
6
  Object.assign(u, e);
7
7
  }
8
8
  const y = {
@@ -20,7 +20,7 @@ const y = {
20
20
  this.store = {};
21
21
  }
22
22
  }, Q = y;
23
- function F(e) {
23
+ function q(e) {
24
24
  return typeof window > "u" || !window.localStorage ? y.getItem(e) : window.localStorage.getItem(e);
25
25
  }
26
26
  function E(e, t) {
@@ -38,28 +38,28 @@ function ie(e, t) {
38
38
  function le(e) {
39
39
  typeof window > "u" || !window.sessionStorage ? Q.removeItem(e) : window.sessionStorage.removeItem(e);
40
40
  }
41
- function Ze(e, t) {
41
+ function Me(e, t) {
42
42
  var a;
43
- return !(e != null && e.items) || ((a = e == null ? void 0 : e.items) == null ? void 0 : a.length) === 0 ? [] : e.items.reduce((o, s) => {
44
- if (!s.value || s.value === "") return o;
45
- const c = ue(s, e.column);
43
+ return !(e != null && e.items) || ((a = e == null ? void 0 : e.items) == null ? void 0 : a.length) === 0 ? [] : e.items.reduce((o, c) => {
44
+ if (!c.value || c.value === "") return o;
45
+ const s = ue(c, e.column);
46
46
  return o.push({
47
- operator: c.operator,
48
- value: c.value,
49
- display: s.display || c.display,
50
- filters: c.filters,
51
- disabled: s.count === 0,
52
- hidden: s.count === 0 && e.isDistribution ? !t : !1
47
+ operator: s.operator,
48
+ value: s.value,
49
+ display: c.display || s.display,
50
+ filters: s.filters,
51
+ disabled: c.count === 0,
52
+ hidden: c.count === 0 && e.isDistribution ? !t : !1
53
53
  }), o;
54
54
  }, []);
55
55
  }
56
56
  function ue(e, t) {
57
57
  const r = t, n = e.value.match(/.*\:\(?([><=\d\-\.AND ]+)\)?/);
58
58
  if (n != null && n[1]) {
59
- const o = (n == null ? void 0 : n[1].split(" AND ")).map((s) => {
60
- const c = s.indexOf(">=") !== -1 ? "gte" : "lt";
61
- let i = s.substring(s.indexOf(" ") + 1);
62
- return { field: r, operator: c, value: i, display: e.display || e.value };
59
+ const o = (n == null ? void 0 : n[1].split(" AND ")).map((c) => {
60
+ const s = c.indexOf(">=") !== -1 ? "gte" : "lt";
61
+ let i = c.substring(c.indexOf(" ") + 1);
62
+ return { field: r, operator: s, value: i, display: e.display || e.value };
63
63
  });
64
64
  if (o.length === 2)
65
65
  return { field: r, operator: "and", filters: o, value: e.value, display: o[0].display || o[0].value };
@@ -69,48 +69,51 @@ function ue(e, t) {
69
69
  }
70
70
  return { field: r, operator: "eq", value: e.value, display: e.display };
71
71
  }
72
- function Me(e, t, r) {
72
+ function Ee(e, t, r) {
73
73
  return e.valuesAreExpressions ? t.display === r.display : t.value === r.value;
74
74
  }
75
- function Ee(e, t) {
75
+ function de(e) {
76
+ return e.items && (e.items = e.items.map((t) => de(t))), e.items && e.items.some((t) => t.$selected || t.$opened) && (e.$opened = !0), e;
77
+ }
78
+ function Te(e, t) {
76
79
  const r = [];
77
80
  if (e.length > 0) {
78
- const n = /* @__PURE__ */ new Map(), a = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = new RegExp("\\b" + a, "i");
81
+ const n = /* @__PURE__ */ new Map(), o = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").normalize("NFD").replace(/[\u0300-\u036f]/g, ""), c = new RegExp("\\b" + o, "i");
79
82
  e.forEach((s) => {
80
83
  if (s.display.length > 1) {
81
- const c = o.exec(s.display);
82
- T(r, n, "/", s.display, +(s.frequency || 0), 1, ((c == null ? void 0 : c.index) || 0) + t.length);
84
+ const i = s.display.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), l = c.exec(i);
85
+ T(r, n, "/", s.display, +(s.frequency || 0), 1, ((l == null ? void 0 : l.index) || 0) + t.length);
83
86
  }
84
87
  });
85
88
  }
86
89
  return r;
87
90
  }
88
- function T(e, t, r, n, a, o, s) {
89
- const c = n.indexOf("/", r.length), i = n.substring(0, c + 1);
91
+ function T(e, t, r, n, a, o, c) {
92
+ const s = n.indexOf("/", r.length), i = n.substring(0, s + 1);
90
93
  let l = t.get(i);
91
94
  if (!l) {
92
95
  const h = i.replace(/^\/|\/$/g, "");
93
96
  l = {
94
- value: n.substring(r.length, c),
97
+ value: n.substring(r.length, s),
95
98
  count: a,
96
99
  items: [],
97
100
  hasChildren: !1,
98
101
  $level: o,
99
- $opened: s >= i.length,
102
+ $opened: c >= i.length,
100
103
  $path: h
101
104
  }, t.set(i, l), e.push(l);
102
105
  }
103
- i.length < n.length && (l.hasChildren = !0, T(l.items, t, i, n, a, o + 1, s));
106
+ i.length < n.length && (l.hasChildren = !0, T(l.items, t, i, n, a, o + 1, c));
104
107
  }
105
- function Te(e, t) {
108
+ function et(e, t) {
106
109
  return e.reduce((r, n) => (t(n) ? r.true.push(n) : r.false.push(n), r), { true: [], false: [] });
107
110
  }
108
- const de = /(([\+\-])?\(([^\)]+)\))|(([\+\-])?\[([^\]]+)\])|(([\+\-])?\"([^\"]+)\")|(([\+\-])?\/([^\/]+)\/)|(([\+\-])?(\S+))/g, fe = 2, W = 3, he = 5, X = 6, _e = 8, Y = 9, we = 11, K = 12, Se = 14, Z = 15;
111
+ const fe = /(([\+\-])?\(([^\)]+)\))|(([\+\-])?\[([^\]]+)\])|(([\+\-])?\"([^\"]+)\")|(([\+\-])?\/([^\/]+)\/)|(([\+\-])?(\S+))/g, he = 2, W = 3, _e = 5, X = 6, we = 8, Y = 9, me = 11, K = 12, Se = 14, Z = 15;
109
112
  function I(e) {
110
113
  if (!e) return [];
111
- const t = [], r = e.matchAll(de);
114
+ const t = [], r = e.matchAll(fe);
112
115
  for (let n of r)
113
- n[W] ? t.push({ type: "group", value: n[W], op: n[fe] }) : n[X] ? t.push({ type: "adjacent", value: n[X], op: n[he] }) : n[Y] ? t.push({ type: "exact", value: n[Y], op: n[_e] }) : n[K] ? t.push({ type: "regex", value: n[K], op: n[we] }) : n[Z] && t.push({ type: "token", value: n[Z], op: n[Se] });
116
+ n[W] ? t.push({ type: "group", value: n[W], op: n[he] }) : n[X] ? t.push({ type: "adjacent", value: n[X], op: n[_e] }) : n[Y] ? t.push({ type: "exact", value: n[Y], op: n[we] }) : n[K] ? t.push({ type: "regex", value: n[K], op: n[me] }) : n[Z] && t.push({ type: "token", value: n[Z], op: n[Se] });
114
117
  return t;
115
118
  }
116
119
  function G(e) {
@@ -130,28 +133,28 @@ function G(e) {
130
133
  }
131
134
  }).join(" ");
132
135
  }
133
- function et(e, t, r) {
136
+ function tt(e, t, r) {
134
137
  let n = I(e);
135
138
  for (let a of t)
136
139
  n.push({ type: "adjacent", value: a, op: r });
137
140
  return G(n);
138
141
  }
139
- function tt(e, t) {
142
+ function rt(e, t) {
140
143
  const r = I(t), n = r.findIndex((a) => a.value === e);
141
144
  return n !== -1 ? (r.splice(n, 1), t = G(r)) : t;
142
145
  }
143
- function rt(e) {
146
+ function nt(e) {
144
147
  const t = I(e).filter((r) => r.type !== "adjacent");
145
148
  return G(t);
146
149
  }
147
- function nt(e) {
150
+ function at(e) {
148
151
  return I(e).filter((t) => t.type === "adjacent").map((t) => t.value);
149
152
  }
150
- function at(e, t, r) {
151
- const n = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset: a, unit: o, isFuture: s } = me(t, r);
152
- return n.format(a * (s ? 1 : -1), o);
153
+ function ot(e, t, r) {
154
+ const n = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset: a, unit: o, isFuture: c } = ge(t, r);
155
+ return n.format(a * (c ? 1 : -1), o);
153
156
  }
154
- function me(e, t) {
157
+ function ge(e, t) {
155
158
  const r = new Date(e), n = t ? new Date(t) : /* @__PURE__ */ new Date(), a = Math.abs(n.getTime() - r.getTime());
156
159
  return {
157
160
  offset: Math.floor(a / (1e3 * 60 * 60 * 24)),
@@ -159,13 +162,13 @@ function me(e, t) {
159
162
  isFuture: r > n
160
163
  };
161
164
  }
162
- function ot(e) {
165
+ function st(e) {
163
166
  const t = e.target;
164
167
  return t && t.nodeName !== "INPUT" && t.nodeName !== "TEXTAREA";
165
168
  }
166
- function st(e) {
169
+ function ct(e) {
167
170
  if (e === void 0) return;
168
- const { q: t, f: r, p: n, s: a, t: o, n: s, b: c } = R(e), [i] = e.split("?");
171
+ const { q: t, f: r, p: n, s: a, t: o, n: c, b: s } = C(e), [i] = e.split("?");
169
172
  return {
170
173
  path: i,
171
174
  text: t,
@@ -173,20 +176,20 @@ function st(e) {
173
176
  page: n ? parseInt(n, 10) : void 0,
174
177
  sort: a,
175
178
  tab: o,
176
- name: s,
177
- basket: c
179
+ name: c,
180
+ basket: s
178
181
  };
179
182
  }
180
- function ct(e) {
183
+ function it(e) {
181
184
  if (!e) return "";
182
- const { text: t, filters: r, page: n, sort: a, tab: o, name: s, basket: c } = e, i = {};
183
- t && (i.q = t), r && (i.f = JSON.stringify(r)), n && (i.p = n.toString()), a && (i.s = a), o && (i.t = o), s && (i.n = s), c && (i.b = c);
185
+ const { text: t, filters: r, page: n, sort: a, tab: o, name: c, basket: s } = e, i = {};
186
+ t && (i.q = t), r && (i.f = JSON.stringify(r)), n && (i.p = n.toString()), a && (i.s = a), o && (i.t = o), c && (i.n = c), s && (i.b = s);
184
187
  const l = new URLSearchParams(i).toString();
185
188
  return l || "";
186
189
  }
187
- function it(e) {
190
+ function lt(e) {
188
191
  if (e === void 0) return [];
189
- const { f: t } = R(e);
192
+ const { f: t } = C(e);
190
193
  return ee(t);
191
194
  }
192
195
  function ee(e) {
@@ -197,29 +200,29 @@ function ee(e) {
197
200
  return console.error(`Error parsing filters from URI: ${e}`), [];
198
201
  }
199
202
  }
200
- function R(e) {
203
+ function C(e) {
201
204
  const t = e.split("?")[1];
202
205
  if (t === void 0) return {};
203
206
  const r = new URLSearchParams(t);
204
207
  return Object.fromEntries(r);
205
208
  }
206
- function lt(e) {
207
- const { q: t = "" } = R(e);
209
+ function ut(e) {
210
+ const { q: t = "" } = C(e);
208
211
  return t;
209
212
  }
210
- function ut(e) {
211
- const { id: t } = R(e);
213
+ function dt(e) {
214
+ const { id: t } = C(e);
212
215
  return decodeURIComponent(t);
213
216
  }
214
- function dt(e) {
215
- const { p: t = "0" } = R(e);
217
+ function ft(e) {
218
+ const { p: t = "0" } = C(e);
216
219
  return parseInt(t, 10);
217
220
  }
218
- function ft(e) {
219
- const { t } = R(e);
221
+ function ht(e) {
222
+ const { t } = C(e);
220
223
  return t;
221
224
  }
222
- function ht(e, t) {
225
+ function _t(e, t) {
223
226
  if (!e)
224
227
  return e;
225
228
  let r = 0;
@@ -233,10 +236,10 @@ function ht(e, t) {
233
236
  const o = B(e, r, !1);
234
237
  if (!o)
235
238
  return e;
236
- const s = t.charCodeAt(0), c = t.charCodeAt(1);
239
+ const c = t.charCodeAt(0), s = t.charCodeAt(1);
237
240
  let i = o;
238
241
  for (; i; )
239
- if (s === i.lang1 && c === i.lang2) {
242
+ if (c === i.lang1 && s === i.lang2) {
240
243
  const h = B(e, i.end + 4, !0);
241
244
  return e.substring(h.start, h.end);
242
245
  } else
@@ -261,9 +264,9 @@ function B(e, t, r) {
261
264
  lang2: -1
262
265
  };
263
266
  }
264
- function _t(e, t) {
265
- const { useLocale: r, useLocaleAsPrefix: n, indexFile: a, path: o, folder: s } = t, c = r ? `${e}/` : null, i = n ? `${e}.${a}` : a ?? "";
266
- return [o, s, `${c || ""}${i}`].filter((l) => l !== void 0).join("/");
267
+ function wt(e, t) {
268
+ const { useLocale: r, useLocaleAsPrefix: n, indexFile: a, path: o, folder: c } = t, s = r ? `${e}/` : null, i = n ? `${e}.${a}` : a ?? "";
269
+ return [o, c, `${s || ""}${i}`].filter((l) => l !== void 0).join("/");
267
270
  }
268
271
  function O(e) {
269
272
  const t = new CustomEvent("notification", {
@@ -273,7 +276,7 @@ function O(e) {
273
276
  });
274
277
  dispatchEvent(t);
275
278
  }
276
- const wt = {
279
+ const mt = {
277
280
  success: (e, t) => {
278
281
  O({
279
282
  type: "success",
@@ -330,38 +333,38 @@ function D(e, t, r) {
330
333
  break;
331
334
  }
332
335
  }
333
- function p(e, t) {
336
+ function v(e, t) {
334
337
  D(0, e, t);
335
338
  }
336
339
  function w(e, t) {
337
340
  D(1, e, t);
338
341
  }
339
- function C(e, t) {
342
+ function p(e, t) {
340
343
  D(2, e, t);
341
344
  }
342
345
  function f(e, t) {
343
346
  D(3, e, t);
344
347
  }
345
- function mt(e, t, r) {
346
- var o, s, c, i;
348
+ function gt(e, t, r) {
349
+ var o, c, s, i;
347
350
  if (!e || !t) return;
348
351
  if (r) {
349
352
  const l = Object.keys(t.queries).find((N) => N === (r == null ? void 0 : r.toLowerCase()));
350
353
  let h;
351
354
  l && (h = t.queries[l]);
352
- const v = (s = ((o = h == null ? void 0 : h.columnsInfo) == null ? void 0 : o.columns) || []) == null ? void 0 : s.find((N) => {
353
- var J, z;
354
- return (z = (J = N.aliases) == null ? void 0 : J.split(",")) == null ? void 0 : z.includes(e);
355
+ const R = (c = ((o = h == null ? void 0 : h.columnsInfo) == null ? void 0 : o.columns) || []) == null ? void 0 : c.find((N) => {
356
+ var z, J;
357
+ return (J = (z = N.aliases) == null ? void 0 : z.split(",")) == null ? void 0 : J.includes(e);
355
358
  });
356
- if (v) return v.name;
359
+ if (R) return R.name;
357
360
  }
358
- const n = (i = (c = t.indexes) == null ? void 0 : c._) == null ? void 0 : i.columns, a = Object.entries(n).find((l) => {
361
+ const n = (i = (s = t.indexes) == null ? void 0 : s._) == null ? void 0 : i.columns, a = Object.entries(n).find((l) => {
359
362
  var h;
360
363
  return (h = l[1].aliases) == null ? void 0 : h.includes(e);
361
364
  });
362
365
  if (a) return a[0];
363
366
  }
364
- function gt(e, t) {
367
+ function kt(e, t) {
365
368
  const r = e[t];
366
369
  return r === void 0 ? [] : Array.isArray(r) ? r.map((n) => {
367
370
  if (typeof n == "string")
@@ -373,17 +376,17 @@ function gt(e, t) {
373
376
  function A(e) {
374
377
  return e !== null && typeof e == "object";
375
378
  }
376
- function ge(e) {
379
+ function ke(e) {
377
380
  return A(e) && Object.prototype.toString.call(e) === "[object ArrayBuffer]";
378
381
  }
379
- function ke(e) {
382
+ function be(e) {
380
383
  return A(e) && Object.prototype.toString.call(e) === "[object Blob]";
381
384
  }
382
- function be(e) {
385
+ function pe(e) {
383
386
  return typeof e == "string";
384
387
  }
385
- function kt(e) {
386
- return (A(e) || Array.isArray(e)) && !ge(e) && !ke(e) && !be(e);
388
+ function bt(e) {
389
+ return (A(e) || Array.isArray(e)) && !ke(e) && !be(e) && !pe(e);
387
390
  }
388
391
  function Ce(e = !0) {
389
392
  let t = Date.now();
@@ -392,7 +395,7 @@ function Ce(e = !0) {
392
395
  return t = Math.floor(t / 16), (n === "x" ? a : a & 3 | 8).toString(16);
393
396
  });
394
397
  }
395
- function bt(e) {
398
+ function pt(e) {
396
399
  if (!e)
397
400
  return "``";
398
401
  if (e = String(e), e.search(/[\\`]/) === -1)
@@ -407,56 +410,56 @@ function bt(e) {
407
410
  function Ct(e) {
408
411
  return crypto.subtle.digest("SHA-512", new TextEncoder().encode(e)).then((t) => Array.prototype.map.call(new Uint8Array(t), (r) => ("00" + r.toString(16)).slice(-2)).join(""));
409
412
  }
410
- var g = /* @__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))(g || {}), Re = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.bool = 1] = "bool", e[e.date = 2] = "date", e[e.dateTime = 3] = "dateTime", e[e.time = 4] = "time", e[e.unsigned = 5] = "unsigned", e[e.integer = 6] = "integer", e[e.float = 7] = "float", e[e.double = 8] = "double", e[e.dates = 9] = "dates", e[e.dateTimes = 10] = "dateTimes", e[e.times = 11] = "times", e[e.varchar = 12] = "varchar", e[e.binary = 13] = "binary", e[e.string = 14] = "string", e[e.csv = 15] = "csv", e))(Re || {}), pe = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.a = 2053] = "a", e[e.c = 4] = "c", e[e.d = 8] = "d", e[e.e = 2068] = "e", e[e.i = 256] = "i", e[e.l = 2052] = "l", e[e.n = 8192] = "n", e[e.t = 524292] = "t", e[e.x = 8388608] = "x", e[e.z = 33554432] = "z", e[e.f_ordinal = 8192] = "f_ordinal", e[e.f_multidates = 8192] = "f_multidates", e[e.f_varchar = 33554432] = "f_varchar", e[e.f_binary = 33562624] = "f_binary", e[e.f_string = 33562888] = "f_string", e[e.f_csv = 42477853] = "f_csv", e[e.f_overridable = 33554696] = "f_overridable", e))(pe || {});
411
- const Rt = "1.0";
412
- var ve = /* @__PURE__ */ ((e) => (e[e.Original = 0] = "Original", e[e.Corrected = 1] = "Corrected", e))(ve || {}), xe = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.positiveRate = 1] = "positiveRate", e[e.mainlyPosRate = 2] = "mainlyPosRate", e[e.unrate = 4] = "unrate", e[e.mainlyNegRate = 8] = "mainlyNegRate", e[e.negativeRate = 16] = "negativeRate", e[e.all = 31] = "all", e[e.positiveOnly = 7] = "positiveOnly", e[e.negativeOnly = 28] = "negativeOnly", e[e.personalAll = 21] = "personalAll", e[e.personalPosOnly = 5] = "personalPosOnly", e[e.personalNegOnly = 20] = "personalNegOnly", e))(xe || {});
413
- class m extends Error {
413
+ var g = /* @__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))(g || {}), ve = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.bool = 1] = "bool", e[e.date = 2] = "date", e[e.dateTime = 3] = "dateTime", e[e.time = 4] = "time", e[e.unsigned = 5] = "unsigned", e[e.integer = 6] = "integer", e[e.float = 7] = "float", e[e.double = 8] = "double", e[e.dates = 9] = "dates", e[e.dateTimes = 10] = "dateTimes", e[e.times = 11] = "times", e[e.varchar = 12] = "varchar", e[e.binary = 13] = "binary", e[e.string = 14] = "string", e[e.csv = 15] = "csv", e))(ve || {}), Re = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.a = 2053] = "a", e[e.c = 4] = "c", e[e.d = 8] = "d", e[e.e = 2068] = "e", e[e.i = 256] = "i", e[e.l = 2052] = "l", e[e.n = 8192] = "n", e[e.t = 524292] = "t", e[e.x = 8388608] = "x", e[e.z = 33554432] = "z", e[e.f_ordinal = 8192] = "f_ordinal", e[e.f_multidates = 8192] = "f_multidates", e[e.f_varchar = 33554432] = "f_varchar", e[e.f_binary = 33562624] = "f_binary", e[e.f_string = 33562888] = "f_string", e[e.f_csv = 42477853] = "f_csv", e[e.f_overridable = 33554696] = "f_overridable", e))(Re || {});
414
+ const vt = "1.0";
415
+ var xe = /* @__PURE__ */ ((e) => (e[e.Original = 0] = "Original", e[e.Corrected = 1] = "Corrected", e))(xe || {}), Le = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.positiveRate = 1] = "positiveRate", e[e.mainlyPosRate = 2] = "mainlyPosRate", e[e.unrate = 4] = "unrate", e[e.mainlyNegRate = 8] = "mainlyNegRate", e[e.negativeRate = 16] = "negativeRate", e[e.all = 31] = "all", e[e.positiveOnly = 7] = "positiveOnly", e[e.negativeOnly = 28] = "negativeOnly", e[e.personalAll = 21] = "personalAll", e[e.personalPosOnly = 5] = "personalPosOnly", e[e.personalNegOnly = 20] = "personalNegOnly", e))(Le || {});
416
+ class S extends Error {
414
417
  constructor(r, n) {
415
418
  super(r);
416
419
  H(this, "status");
417
420
  this.name = "ApiError", this.status = n;
418
421
  }
419
422
  }
420
- class re extends m {
423
+ class re extends S {
421
424
  constructor(t = "Unauthorized access") {
422
425
  super(t, 401), this.name = "UnauthorizedError";
423
426
  }
424
427
  }
425
- class Pe extends m {
428
+ class Pe extends S {
426
429
  constructor(t = "Server error") {
427
430
  super(t, 500), this.name = "ServerError";
428
431
  }
429
432
  }
430
- class Le extends m {
433
+ class Oe extends S {
431
434
  constructor(t = "Request timed out") {
432
435
  super(t, 408), this.name = "TimeoutError";
433
436
  }
434
437
  }
435
- function pt(e) {
438
+ function Rt(e) {
436
439
  const t = new AbortController(), { signal: r } = t;
437
440
  return e && setTimeout(() => {
438
- r.aborted || t.abort(new Le(`Request timed out after ${e}ms`));
441
+ r.aborted || t.abort(new Oe(`Request timed out after ${e}ms`));
439
442
  }, e), { controller: t, signal: r };
440
443
  }
441
- async function vt(e, t = 0, r = 1e3) {
444
+ async function xt(e, t = 0, r = 1e3) {
442
445
  let n;
443
446
  for (let a = 0; a <= t; a++)
444
447
  try {
445
448
  return await e();
446
449
  } catch (o) {
447
- if (n = o, o instanceof m && o.status >= 400 && o.status < 500 && o.status !== 429 || o instanceof DOMException && o.name === "AbortError")
450
+ if (n = o, o instanceof S && o.status >= 400 && o.status < 500 && o.status !== 429 || o instanceof DOMException && o.name === "AbortError")
448
451
  throw o;
449
- a < t && (C(`Retrying request (${a + 1}/${t})`, { error: o }), await new Promise((s) => setTimeout(s, r)));
452
+ a < t && (p(`Retrying request (${a + 1}/${t})`, { error: o }), await new Promise((c) => setTimeout(c, r)));
450
453
  }
451
454
  throw n;
452
455
  }
453
- function P(e) {
456
+ function L(e) {
454
457
  const t = $(), r = new Headers(e);
455
458
  r.append("Sinequa-Force-Camel-Case", "true"), r.append("accept", "application/json"), t && r.append("Sinequa-csrf-token", t);
456
459
  const { userOverride: n, userOverrideActive: a, bearerToken: o } = u;
457
460
  return o && r.append("Authorization", `Bearer ${o}`), n && a && (r.append("sinequa-override-user", n.username), r.append("sinequa-override-domain", n.domain)), r;
458
461
  }
459
- async function k(e, t = "json") {
462
+ async function b(e, t = "json") {
460
463
  const r = e.headers.get("sinequa-jwt-refresh");
461
464
  if (r !== null && V(r), e.status === 200)
462
465
  switch (t) {
@@ -472,35 +475,35 @@ async function k(e, t = "json") {
472
475
  }
473
476
  if (e.status === 401) {
474
477
  if (u.userOverrideActive)
475
- throw u.userOverrideActive = !1, C("Unauthorized access attempt with user override", { endpoint: e.url }), new re("Unauthorized... User override failed.");
478
+ throw u.userOverrideActive = !1, p("Unauthorized access attempt with user override", { endpoint: e.url }), new re("Unauthorized... User override failed.");
476
479
  await M(e, 401);
477
480
  }
478
- throw e.status === 500 && (f("Server error occurred", { endpoint: e.url }), await M(e, 500)), C(`Unexpected response status: ${e.status}`, { endpoint: e.url }), new m(`Request failed with status ${e.status}`, e.status);
481
+ throw e.status === 500 && (f("Server error occurred", { endpoint: e.url }), await M(e, 500)), p(`Unexpected response status: ${e.status}`, { endpoint: e.url }), new S(`Request failed with status ${e.status}`, e.status);
479
482
  }
480
483
  async function M(e, t) {
481
484
  var r;
482
485
  try {
483
486
  const { done: n, value: a } = await ((r = e.body) == null ? void 0 : r.getReader().read()) || { done: !0, value: void 0 };
484
487
  if (n || !a)
485
- throw new m(`Request failed with status ${t}`, t);
488
+ throw new S(`Request failed with status ${t}`, t);
486
489
  const o = JSON.parse(new TextDecoder().decode(a));
487
490
  throw o.status = t, o;
488
491
  } catch (n) {
489
- throw n instanceof m ? n : t === 401 ? new re() : t === 500 ? new Pe() : new m(`Request failed with status ${t}`, t);
492
+ throw n instanceof S ? n : t === 401 ? new re() : t === 500 ? new Pe() : new S(`Request failed with status ${t}`, t);
490
493
  }
491
494
  }
492
495
  async function d(e, t, r) {
493
- const n = P(r == null ? void 0 : r.headers), { app: a, backendUrl: o, apiPath: s } = u, c = {
496
+ const n = L(r == null ? void 0 : r.headers), { app: a, backendUrl: o } = u, c = {
494
497
  app: a,
495
498
  ...t,
496
499
  locale: t.locale || navigator.language,
497
500
  noUserOverride: !0,
498
501
  noAutoAuthentication: !0
499
- }, i = `${o}/${s}/${e}`;
500
- p(`Making POST request to: ${i}`);
502
+ }, s = `${o}/${e}`;
503
+ v(`Making POST request to: ${s}`);
501
504
  try {
502
- const l = await fetch(
503
- i,
505
+ const i = await fetch(
506
+ s,
504
507
  {
505
508
  method: "POST",
506
509
  headers: n,
@@ -509,16 +512,16 @@ async function d(e, t, r) {
509
512
  signal: r == null ? void 0 : r.signal
510
513
  }
511
514
  );
512
- return k(l, r == null ? void 0 : r.responseType);
513
- } catch (l) {
514
- throw f("Error making POST request:", l), l;
515
+ return b(i, r == null ? void 0 : r.responseType);
516
+ } catch (i) {
517
+ throw f("Error making POST request:", i), i;
515
518
  }
516
519
  }
517
- async function b(e, t, r) {
518
- const n = P(r == null ? void 0 : r.headers), { backendUrl: a, apiPath: o } = u, s = t ? `?${new URLSearchParams(t)}` : "", c = `${a}/${o}/${e}${s}`;
519
- p(`Making GET request to: ${c}`);
520
+ async function k(e, t, r) {
521
+ const n = L(r == null ? void 0 : r.headers), { backendUrl: a } = u, o = t ? `?${new URLSearchParams(t)}` : "", c = `${a}/${e}${o}`;
522
+ v(`Making GET request to: ${c}`);
520
523
  try {
521
- const i = await fetch(
524
+ const s = await fetch(
522
525
  c,
523
526
  {
524
527
  method: "GET",
@@ -527,23 +530,23 @@ async function b(e, t, r) {
527
530
  signal: r == null ? void 0 : r.signal
528
531
  }
529
532
  );
530
- return k(i, r == null ? void 0 : r.responseType);
531
- } catch (i) {
532
- throw f("Error making GET request:", i), i;
533
+ return b(s, r == null ? void 0 : r.responseType);
534
+ } catch (s) {
535
+ throw f("Error making GET request:", s), s;
533
536
  }
534
537
  }
535
- async function xt(e, t, r) {
536
- const n = P(r == null ? void 0 : r.headers), { app: a, backendUrl: o, apiPath: s } = u, c = {
538
+ async function Lt(e, t, r) {
539
+ const n = L(r == null ? void 0 : r.headers), { app: a, backendUrl: o } = u, c = {
537
540
  app: a,
538
541
  ...t,
539
542
  locale: t.locale || navigator.language,
540
543
  noUserOverride: !0,
541
544
  noAutoAuthentication: !0
542
- }, i = `${o}/${s}/${e}`;
543
- p(`Making PUT request to: ${i}`);
545
+ }, s = `${o}/${e}`;
546
+ v(`Making PUT request to: ${s}`);
544
547
  try {
545
- const l = await fetch(
546
- i,
548
+ const i = await fetch(
549
+ s,
547
550
  {
548
551
  method: "PUT",
549
552
  headers: n,
@@ -551,16 +554,16 @@ async function xt(e, t, r) {
551
554
  body: JSON.stringify(c)
552
555
  }
553
556
  );
554
- return k(l, r == null ? void 0 : r.responseType);
555
- } catch (l) {
556
- throw f("Error making PUT request:", l), l;
557
+ return b(i, r == null ? void 0 : r.responseType);
558
+ } catch (i) {
559
+ throw f("Error making PUT request:", i), i;
557
560
  }
558
561
  }
559
562
  async function Pt(e, t, r) {
560
- const n = P(r == null ? void 0 : r.headers), { backendUrl: a, apiPath: o } = u, s = t ? `?${new URLSearchParams(t)}` : "", c = `${a}/${o}/${e}${s}`;
561
- p(`Making DELETE request to: ${c}`);
563
+ const n = L(r == null ? void 0 : r.headers), { backendUrl: a } = u, o = t ? `?${new URLSearchParams(t)}` : "", c = `${a}/${e}${o}`;
564
+ v(`Making DELETE request to: ${c}`);
562
565
  try {
563
- const i = await fetch(
566
+ const s = await fetch(
564
567
  c,
565
568
  {
566
569
  method: "DELETE",
@@ -568,23 +571,23 @@ async function Pt(e, t, r) {
568
571
  headers: n
569
572
  }
570
573
  );
571
- return k(i, r == null ? void 0 : r.responseType);
572
- } catch (i) {
573
- throw f("Error making DELETE request:", i), i;
574
+ return b(s, r == null ? void 0 : r.responseType);
575
+ } catch (s) {
576
+ throw f("Error making DELETE request:", s), s;
574
577
  }
575
578
  }
576
- async function Lt(e, t, r) {
577
- const n = P(r == null ? void 0 : r.headers), { app: a, backendUrl: o, apiPath: s } = u, c = {
579
+ async function Ot(e, t, r) {
580
+ const n = L(r == null ? void 0 : r.headers), { app: a, backendUrl: o } = u, c = {
578
581
  app: a,
579
582
  ...t,
580
583
  locale: t.locale || navigator.language,
581
584
  noUserOverride: !0,
582
585
  noAutoAuthentication: !0
583
- }, i = `${o}/${s}/${e}`;
584
- p(`Making PATCH request to: ${i}`);
586
+ }, s = `${o}/${e}`;
587
+ v(`Making PATCH request to: ${s}`);
585
588
  try {
586
- const l = await fetch(
587
- i,
589
+ const i = await fetch(
590
+ s,
588
591
  {
589
592
  method: "PATCH",
590
593
  headers: n,
@@ -592,17 +595,17 @@ async function Lt(e, t, r) {
592
595
  body: JSON.stringify(c)
593
596
  }
594
597
  );
595
- return k(l, r == null ? void 0 : r.responseType);
596
- } catch (l) {
597
- throw f("Error making PATCH request:", l), l;
598
+ return b(i, r == null ? void 0 : r.responseType);
599
+ } catch (i) {
600
+ throw f("Error making PATCH request:", i), i;
598
601
  }
599
602
  }
600
- let q, ne;
601
- function L(e, t = !0) {
602
- let r = Oe(e.$auditRecord);
603
- r && (Ue(r), t && $e(r)), e.$auditRecord = r;
603
+ let F, ne;
604
+ function P(e, t = !0) {
605
+ let r = Ue(e.$auditRecord);
606
+ r && ($e(r), t && ye(r)), e.$auditRecord = r;
604
607
  }
605
- function Oe(e) {
608
+ function Ue(e) {
606
609
  if (!e)
607
610
  return;
608
611
  let t;
@@ -616,56 +619,56 @@ function Oe(e) {
616
619
  }
617
620
  return { auditEvents: t };
618
621
  }
619
- function Ue(e) {
622
+ function $e(e) {
620
623
  var r;
621
- const t = ye();
624
+ const t = Ie();
622
625
  return (r = e.auditEvents) == null || r.forEach((n) => {
623
626
  n.detail || (n.detail = {}), n.detail.sessionid = t;
624
627
  }), e;
625
628
  }
626
- function $e(e) {
629
+ function ye(e) {
627
630
  var r;
628
631
  const t = typeof window < "u" ? decodeURIComponent(window.location.href) : "http://localhost";
629
632
  return (r = e == null ? void 0 : e.auditEvents) == null || r.forEach((n) => {
630
633
  n.detail || (n.detail = {}), n.detail.url = t;
631
634
  }), e;
632
635
  }
633
- function ye() {
634
- return (!q || Ie()) && (q = Ce()), ne = /* @__PURE__ */ new Date(), q;
635
- }
636
636
  function Ie() {
637
+ return (!F || De()) && (F = Ce()), ne = /* @__PURE__ */ new Date(), F;
638
+ }
639
+ function De() {
637
640
  return (/* @__PURE__ */ new Date()).getTime() - ne.getTime() > 10 * 60 * 1e3;
638
641
  }
639
- async function De(e, t = !0) {
642
+ async function Ae(e, t = !0) {
640
643
  const r = {
641
644
  event: g.None,
642
645
  $auditRecord: e
643
646
  };
644
- return L(r, t), d("audit.notify", r);
647
+ return P(r, t), d("api/v1/audit.notify", r);
645
648
  }
646
- const Ot = { notify: De };
647
- async function Ut(e, t, r) {
649
+ const Ut = { notify: Ae };
650
+ async function $t(e, t, r) {
648
651
  var h;
649
652
  const n = ((h = e.items) == null ? void 0 : h.length) || 0, a = 10, o = {
650
653
  query: { ...t, action: "aggregate", aggregations: { [e.name]: { skip: n, count: a } } },
651
654
  $auditRecord: { auditEvents: [r] }
652
655
  };
653
- L(o);
654
- const s = await d("query", o), c = await k(s), { aggregations: i } = c, l = i[0];
656
+ P(o);
657
+ const c = await d("api/v1/query", o), s = await b(c), { aggregations: i } = s, l = i[0];
655
658
  return l.$hasMore = l.items.length > a, l.items = [...e.items, ...l.items], Promise.resolve(l);
656
659
  }
657
- async function $t() {
660
+ async function yt() {
658
661
  const { app: e } = u, t = new URLSearchParams({ app: e || "" });
659
- return b("app", t);
662
+ return k("api/v1/app", t);
660
663
  }
661
- async function Ae() {
664
+ async function Ne() {
662
665
  const { app: e } = u, t = new URLSearchParams({
663
666
  app: e || "",
664
667
  preLogin: "true"
665
668
  });
666
- return b("app", t);
669
+ return k("api/v1/app", t);
667
670
  }
668
- function yt() {
671
+ function It() {
669
672
  let { backendUrl: e, app: t } = u;
670
673
  if (typeof window < "u") {
671
674
  if (e || (e = window.location.origin), !t) {
@@ -674,15 +677,15 @@ function yt() {
674
677
  );
675
678
  r && (t = r[1]);
676
679
  }
677
- S({
680
+ m({
678
681
  ...u,
679
682
  backendUrl: e,
680
683
  app: t
681
684
  });
682
685
  }
683
- return Ae().then((r) => {
686
+ return Ne().then((r) => {
684
687
  const { autoOAuthProvider: n, autoSAMLProvider: a } = u, o = !n && !r.autoOAuthProvider && !a && !r.autoSAMLProvider;
685
- return S({
688
+ return m({
686
689
  ...u,
687
690
  autoOAuthProvider: n || r.autoOAuthProvider,
688
691
  autoSAMLProvider: a || r.autoSAMLProvider,
@@ -693,22 +696,22 @@ function yt() {
693
696
  throw console.error("atomic:fetchAppPreLogin error", r), r;
694
697
  });
695
698
  }
696
- async function It(e, t, r = {}) {
697
- const n = `search.dataset/${e}/${t}`, a = await d(n, { parameters: r }), o = t[0].toLowerCase() + t.slice(1), s = a.datasets[o];
698
- if ("errorCode" in s && "errorMessage" in s)
699
- throw new Error(s.errorMessage);
700
- return s;
699
+ async function Dt(e, t, r = {}) {
700
+ const n = `api/v1/search.dataset/${e}/${t}`, a = await d(n, { parameters: r }), o = t[0].toLowerCase() + t.slice(1), c = a.datasets[o];
701
+ if ("errorCode" in c && "errorMessage" in c)
702
+ throw new Error(c.errorMessage);
703
+ return c;
701
704
  }
702
- async function Dt(e, t) {
703
- const r = `search.dataset/${e}`, { parameters: n = {}, datasets: a = [] } = t;
705
+ async function At(e, t) {
706
+ const r = `api/v1/search.dataset/${e}`, { parameters: n = {}, datasets: a = [] } = t;
704
707
  return (await d(r, { parameters: n, datasets: a })).datasets;
705
708
  }
706
- async function At(e) {
707
- return await b(`search.dataset/${e}`);
709
+ async function Nt(e) {
710
+ return await k(`api/v1/search.dataset/${e}`);
708
711
  }
709
- async function Nt(e, t = !0, r) {
712
+ async function Bt(e, t = !0, r) {
710
713
  try {
711
- return (await d("labels", {
714
+ return (await d("api/v1/labels", {
712
715
  action: "list",
713
716
  q: e,
714
717
  public: t,
@@ -719,18 +722,18 @@ async function Nt(e, t = !0, r) {
719
722
  throw f("Error in fetchLabels", n), n;
720
723
  }
721
724
  }
722
- async function Ne() {
725
+ async function Be() {
723
726
  try {
724
727
  const { app: e = "" } = u, t = new URLSearchParams({
725
728
  app: e,
726
729
  action: "getUserRights"
727
730
  });
728
- return b("labels", t);
731
+ return k("api/v1/labels", t);
729
732
  } catch (e) {
730
733
  throw f("Error in getUserRights", e), e;
731
734
  }
732
735
  }
733
- async function Be(e, t, r = !0) {
736
+ async function Fe(e, t, r = !0) {
734
737
  try {
735
738
  const n = {
736
739
  action: "add",
@@ -756,7 +759,7 @@ async function Be(e, t, r = !0) {
756
759
  ]
757
760
  }
758
761
  };
759
- return d("labels", n);
762
+ return d("api/v1/labels", n);
760
763
  } catch (n) {
761
764
  throw f("Error in add", n), n;
762
765
  }
@@ -787,12 +790,12 @@ async function qe(e, t, r = !0) {
787
790
  ]
788
791
  }
789
792
  };
790
- return d("labels", n);
793
+ return d("api/v1/labels", n);
791
794
  } catch (n) {
792
795
  throw f("Error in remove", n), n;
793
796
  }
794
797
  }
795
- async function Fe(e, t, r = !0) {
798
+ async function Qe(e, t, r = !0) {
796
799
  try {
797
800
  const n = {
798
801
  action: "rename",
@@ -808,12 +811,12 @@ async function Fe(e, t, r = !0) {
808
811
  }
809
812
  }
810
813
  };
811
- return d("labels", n);
814
+ return d("api/v1/labels", n);
812
815
  } catch (n) {
813
816
  throw f("Error in rename", n), n;
814
817
  }
815
818
  }
816
- async function Qe(e, t = !0) {
819
+ async function Ge(e, t = !0) {
817
820
  try {
818
821
  const r = {
819
822
  action: "delete",
@@ -827,12 +830,12 @@ async function Qe(e, t = !0) {
827
830
  }
828
831
  }
829
832
  };
830
- return d("labels", r);
833
+ return d("api/v1/labels", r);
831
834
  } catch (r) {
832
835
  throw f("Error in deleteLabels", r), r;
833
836
  }
834
837
  }
835
- async function Ge(e, t, r = !0) {
838
+ async function je(e, t, r = !0) {
836
839
  try {
837
840
  const n = {
838
841
  action: "bulkAdd",
@@ -848,12 +851,12 @@ async function Ge(e, t, r = !0) {
848
851
  }
849
852
  }
850
853
  };
851
- return d("labels", n);
854
+ return d("api/v1/labels", n);
852
855
  } catch (n) {
853
856
  throw f("Error in bulkAdd", n), n;
854
857
  }
855
858
  }
856
- async function je(e, t, r = !0) {
859
+ async function Ve(e, t, r = !0) {
857
860
  try {
858
861
  const n = {
859
862
  action: "bulkRemove",
@@ -869,36 +872,36 @@ async function je(e, t, r = !0) {
869
872
  }
870
873
  }
871
874
  };
872
- return d("labels", n);
875
+ return d("api/v1/labels", n);
873
876
  } catch (n) {
874
877
  throw f("Error in bulkRemove", n), n;
875
878
  }
876
879
  }
877
- const Bt = {
878
- getUserRights: Ne,
879
- add: Be,
880
+ const Ft = {
881
+ getUserRights: Be,
882
+ add: Fe,
880
883
  remove: qe,
881
- rename: Fe,
882
- delete: Qe,
883
- bulkAdd: Ge,
884
- bulkRemove: je
884
+ rename: Qe,
885
+ delete: Ge,
886
+ bulkAdd: je,
887
+ bulkRemove: Ve
885
888
  };
886
889
  async function qt(e, t) {
887
890
  if (typeof window > "u")
888
- return d("preview", {
891
+ return d("api/v1/preview", {
889
892
  action: "get",
890
893
  id: e,
891
894
  query: t
892
895
  });
893
896
  const r = `${window.location.origin}${window.location.pathname}`, n = { name: t == null ? void 0 : t.name, text: t == null ? void 0 : t.text };
894
- return d("preview", {
897
+ return d("api/v1/preview", {
895
898
  action: "get",
896
899
  id: e,
897
900
  query: n,
898
901
  browserUrl: r
899
902
  });
900
903
  }
901
- async function Ft(e) {
904
+ async function Qt(e) {
902
905
  const t = new Headers();
903
906
  t.append("content-type", "text");
904
907
  const r = await fetch(
@@ -908,76 +911,76 @@ async function Ft(e) {
908
911
  headers: t
909
912
  }
910
913
  );
911
- k(r);
914
+ b(r);
912
915
  }
913
- async function Ve() {
916
+ async function ze() {
914
917
  const e = new URLSearchParams({
915
918
  action: "get",
916
919
  noAutoAuthentication: "true"
917
920
  });
918
- return b("principal", e);
921
+ return k("api/v1/principal", e);
919
922
  }
920
923
  const ae = 11;
921
- async function Qt(e, t, r) {
922
- var s;
923
- const a = await d("query", {
924
+ async function Gt(e, t, r) {
925
+ var c;
926
+ const a = await d("api/v1/query", {
924
927
  query: e,
925
928
  $auditRecord: t,
926
929
  queryIntentData: r
927
930
  });
928
- a.aggregations.forEach((c) => {
929
- c.$hasMore = !1, !c.isDistribution && !c.isTree && c.items && (c.$hasMore = c.items.length === ae), c.isTree && c.items && j(c);
930
- }), (s = a.records) == null || s.map((c) => Object.assign(c, { value: c.title, type: "default" }));
931
+ a.aggregations.forEach((s) => {
932
+ s.$hasMore = !1, !s.isDistribution && !s.isTree && s.items && (s.$hasMore = s.items.length === ae), s.isTree && s.items && j(s);
933
+ }), (c = a.records) == null || c.map((s) => Object.assign(s, { value: s.title, type: "default" }));
931
934
  const o = { ...a, nextPage: a.page < Math.ceil(a.rowCount / a.pageSize) ? a.page + 1 : void 0, previousPage: a.page > 1 ? a.page - 1 : void 0 };
932
935
  return Promise.resolve(o);
933
936
  }
934
- async function Gt(e, t, r) {
937
+ async function jt(e, t, r) {
935
938
  const { app: n = "" } = u, a = {
936
939
  methods: [],
937
940
  mode: t,
938
941
  propagateErrors: !0,
939
942
  $auditRecord: { auditEvents: [r] }
940
943
  };
941
- for (const c of e)
944
+ for (const s of e)
942
945
  a.methods.push({
943
946
  method: "query",
944
947
  app: n,
945
- query: c
948
+ query: s
946
949
  });
947
- const o = await d("multi", a);
948
- o.results.forEach((c) => {
949
- c.aggregations.forEach((i) => {
950
+ const o = await d("api/v1/multi", a);
951
+ o.results.forEach((s) => {
952
+ s.aggregations.forEach((i) => {
950
953
  i.$hasMore = !1, !i.isDistribution && !i.isTree && i.items && (i.$hasMore = i.items.length === ae), i.isTree && j(i);
951
954
  });
952
- }), o.results.forEach((c) => {
955
+ }), o.results.forEach((s) => {
953
956
  var i;
954
- return (i = c.records) == null ? void 0 : i.map((l) => Object.assign(l, { value: l.title, type: "default" }));
957
+ return (i = s.records) == null ? void 0 : i.map((l) => Object.assign(l, { value: l.title, type: "default" }));
955
958
  });
956
- const s = o.results.map((c) => ({ ...c, nextPage: c.page < Math.ceil(c.rowCount / c.pageSize) ? c.page + 1 : void 0, previousPage: c.page > 1 ? c.page - 1 : void 0 }));
957
- return Promise.resolve(s);
959
+ const c = o.results.map((s) => ({ ...s, nextPage: s.page < Math.ceil(s.rowCount / s.pageSize) ? s.page + 1 : void 0, previousPage: s.page > 1 ? s.page - 1 : void 0 }));
960
+ return Promise.resolve(c);
958
961
  }
959
962
  function j(e, t = "", r = 0) {
960
963
  let n = [];
961
964
  return e.items && e.items.forEach((a) => {
962
- let o = t ? `${t}/${a.value}` : a.value, s = r + 1;
963
- n.push({ path: o, level: s }), a.$path = o, a.$level = s, a.hasChildren ? n = n.concat(j(a, o, s)) : a.hasChildren = !1;
965
+ let o = t ? `${t}/${a.value}` : a.value, c = r + 1;
966
+ n.push({ path: o, level: c }), a.$path = o, a.$level = c, a.hasChildren ? n = n.concat(j(a, o, c)) : a.hasChildren = !1;
964
967
  }), n;
965
968
  }
966
- async function jt(e) {
967
- const r = await d("queryintent", {
969
+ async function Vt(e) {
970
+ const r = await d("api/v1/queryintent", {
968
971
  query: e
969
972
  });
970
973
  return r == null ? void 0 : r.intents;
971
974
  }
972
- async function Vt({ model: e, appName: t, query: r, article: n }) {
973
- const { webservice: a, format: o, maxcount: s, exportedColumns: c, export: i } = e, l = {
975
+ async function zt({ model: e, appName: t, query: r, article: n }) {
976
+ const { webservice: a, format: o, maxcount: c, exportedColumns: s, export: i } = e, l = {
974
977
  app: t,
975
978
  webservice: a,
976
979
  query: r,
977
980
  type: i,
978
981
  format: o,
979
- maxcount: s,
980
- exportedColumns: c,
982
+ maxcount: c,
983
+ exportedColumns: s,
981
984
  $auditRecord: {
982
985
  auditEvents: [{
983
986
  type: "Search_ExportCSV",
@@ -987,11 +990,11 @@ async function Vt({ model: e, appName: t, query: r, article: n }) {
987
990
  }]
988
991
  }
989
992
  };
990
- return L(l), await d("search.queryexport", l, { responseType: "blob" });
993
+ return P(l), await d("api/v1/search.queryexport", l, { responseType: "blob" });
991
994
  }
992
995
  async function Jt(e, t, r) {
993
996
  return (await d(
994
- "similardocuments",
997
+ "api/v1/similardocuments",
995
998
  {
996
999
  sourceDocumentId: e,
997
1000
  query: {
@@ -1001,16 +1004,16 @@ async function Jt(e, t, r) {
1001
1004
  { signal: r }
1002
1005
  )).data;
1003
1006
  }
1004
- async function zt(e, t) {
1007
+ async function Ht(e, t) {
1005
1008
  var a;
1006
- const n = await d("query.links", {
1009
+ const n = await d("api/v1/query.links", {
1007
1010
  webservice: e,
1008
1011
  query: t
1009
1012
  });
1010
1013
  return (a = n == null ? void 0 : n.links) == null ? void 0 : a.map((o) => ({ ...o, query: t }));
1011
1014
  }
1012
- async function Ht(e, t, r, n, a) {
1013
- const { app: o } = u, s = {
1015
+ async function Wt(e, t, r, n, a) {
1016
+ const { app: o } = u, c = {
1014
1017
  app: o || "",
1015
1018
  suggestQuery: e,
1016
1019
  text: t,
@@ -1019,14 +1022,14 @@ async function Ht(e, t, r, n, a) {
1019
1022
  showSource: a
1020
1023
  };
1021
1024
  try {
1022
- return (await d("search.suggest", s)).suggests;
1023
- } catch (c) {
1024
- throw console.error("Error fetching suggestions:", c), c;
1025
+ return (await d("api/v1/search.suggest", c)).suggests;
1026
+ } catch (s) {
1027
+ throw console.error("Error fetching suggestions:", s), s;
1025
1028
  }
1026
1029
  }
1027
- async function Wt(e, t, r, n) {
1030
+ async function Xt(e, t, r, n) {
1028
1031
  const { app: a } = u;
1029
- return (await d("suggestquery", {
1032
+ return (await d("api/v1/suggestquery", {
1030
1033
  app: a || "",
1031
1034
  suggestQuery: e,
1032
1035
  text: t,
@@ -1034,18 +1037,18 @@ async function Wt(e, t, r, n) {
1034
1037
  kinds: n
1035
1038
  })).suggests;
1036
1039
  }
1037
- async function Xt(e, t) {
1040
+ async function Yt(e, t) {
1038
1041
  if (!t) return Promise.resolve([]);
1039
1042
  const { app: r } = u;
1040
- return (await d("suggestfield", {
1043
+ return (await d("api/v1/suggestfield", {
1041
1044
  app: r || "",
1042
1045
  text: e,
1043
1046
  action: "suggests",
1044
1047
  fields: t
1045
1048
  })).suggests;
1046
1049
  }
1047
- async function Yt(e, t, r, n, a, o) {
1048
- return d("doc.textchunks", {
1050
+ async function Kt(e, t, r, n, a, o) {
1051
+ return d("api/v1/doc.textchunks", {
1049
1052
  id: e,
1050
1053
  textChunks: t,
1051
1054
  highlights: r,
@@ -1054,12 +1057,12 @@ async function Yt(e, t, r, n, a, o) {
1054
1057
  rightSentencesCount: o
1055
1058
  });
1056
1059
  }
1057
- async function Kt() {
1060
+ async function Zt() {
1058
1061
  const { app: e } = u, t = new URLSearchParams({
1059
1062
  app: e || "",
1060
1063
  action: "load"
1061
1064
  });
1062
- return b("usersettings", t);
1065
+ return k("api/v1/usersettings", t);
1063
1066
  }
1064
1067
  async function Je(e, t) {
1065
1068
  const r = {
@@ -1067,19 +1070,22 @@ async function Je(e, t) {
1067
1070
  userSettings: e,
1068
1071
  $auditRecord: { auditEvents: [t] }
1069
1072
  };
1070
- return L(r), d("usersettings", r);
1073
+ return P(r), d("api/v1/usersettings", r);
1071
1074
  }
1072
- async function Zt(e, t) {
1075
+ async function Mt(e, t) {
1073
1076
  const n = {
1074
1077
  action: "patch",
1075
1078
  userSettings: e,
1076
1079
  $auditRecord: t ? { auditEvents: [t] } : void 0
1077
1080
  };
1078
- return L(n), d("usersettings", n);
1081
+ return P(n), d("api/v1/usersettings", n);
1079
1082
  }
1080
- async function Mt() {
1083
+ async function Et() {
1081
1084
  return Je({}, { type: "UserSettings_Reset" });
1082
1085
  }
1086
+ async function Tt() {
1087
+ return await k("api/v2/version");
1088
+ }
1083
1089
  function _(e) {
1084
1090
  const t = new CustomEvent(
1085
1091
  "authenticated",
@@ -1091,7 +1097,7 @@ function _(e) {
1091
1097
  );
1092
1098
  dispatchEvent(t);
1093
1099
  }
1094
- const ze = async () => {
1100
+ const He = async () => {
1095
1101
  const { autoOAuthProvider: e } = u;
1096
1102
  if (typeof window > "u")
1097
1103
  return d("security.oauth", {
@@ -1107,12 +1113,12 @@ const ze = async () => {
1107
1113
  originalUrl: window.location.href
1108
1114
  };
1109
1115
  try {
1110
- const r = await d("security.oauth", t);
1116
+ const r = await d("api/v1/security.oauth", t);
1111
1117
  return r.redirectUrl && (E("oauthRedirectUrl", r.redirectUrl), window.location.href = r.redirectUrl), r;
1112
1118
  } catch (r) {
1113
1119
  throw console.error("Failed to authenticate with OAuth", r), r;
1114
1120
  }
1115
- }, He = async () => {
1121
+ }, We = async () => {
1116
1122
  const { autoSAMLProvider: e } = u;
1117
1123
  if (typeof window > "u")
1118
1124
  return d("security.saml", {
@@ -1128,12 +1134,12 @@ const ze = async () => {
1128
1134
  originalUrl: window.location.href
1129
1135
  };
1130
1136
  try {
1131
- const r = await d("security.saml", t);
1137
+ const r = await d("api/v1/security.saml", t);
1132
1138
  return r.redirectUrl && (E("samlRedirectUrl", r.redirectUrl), window.location.href = r.redirectUrl), r;
1133
1139
  } catch (r) {
1134
1140
  throw console.error("Failed to authenticate with SAML", r), r;
1135
1141
  }
1136
- }, We = async (e) => {
1142
+ }, Xe = async (e) => {
1137
1143
  const { username: t, password: r } = e || {}, n = {
1138
1144
  action: "get",
1139
1145
  tokenInCookie: !0,
@@ -1143,180 +1149,182 @@ const ze = async () => {
1143
1149
  noAutoAuthentication: !0
1144
1150
  };
1145
1151
  try {
1146
- const a = await d("security.webtoken", n);
1152
+ const a = await d("api/v1/security.webtoken", n);
1147
1153
  return a.csrfToken ? (V(a.csrfToken), a.csrfToken) : null;
1148
1154
  } catch (a) {
1149
1155
  throw console.error("Failed to get JWT", a), a;
1150
1156
  }
1151
- }, Xe = async () => {
1157
+ }, Ye = async () => {
1152
1158
  const e = new URLSearchParams({
1153
1159
  action: "deleteWebTokenCookie",
1154
1160
  noUserOverride: "true",
1155
1161
  noAutoAuthentication: "true"
1156
1162
  });
1157
- return b("challenge", e);
1163
+ return k("challenge", e);
1158
1164
  }, $ = () => {
1159
- const e = F("csrfToken"), t = ce("sinequa-credentials");
1165
+ const e = q("csrfToken"), t = ce("sinequa-credentials");
1160
1166
  return t ? JSON.parse(t).data.csrfToken : e || null;
1161
- }, V = (e) => ie("sinequa-credentials", JSON.stringify({ data: { csrfToken: e } })), Et = async (e) => {
1167
+ }, V = (e) => ie("sinequa-credentials", JSON.stringify({ data: { csrfToken: e } })), er = async (e) => {
1162
1168
  if (e)
1163
- w("Attempting authentication using credentials"), S({ useCredentials: !0, useSSO: !1 });
1169
+ w("Attempting authentication using credentials"), m({ useCredentials: !0, useSSO: !1 });
1164
1170
  else
1165
1171
  try {
1166
- const s = F("oauthRedirectUrl"), c = F("samlRedirectUrl");
1172
+ const c = q("oauthRedirectUrl"), s = q("samlRedirectUrl");
1167
1173
  w("Attempting to retrieve CSRF token");
1168
- const i = await Ye();
1169
- if (p("CSRF token retrieval result", i ? "success" : "failed"), i === null) {
1170
- if (s || c)
1171
- return C("Redirection from provider failed after previous attempt"), x("oauthRedirectUrl"), x("samlRedirectUrl"), _(!1), !1;
1172
- const { autoOAuthProvider: l, autoSAMLProvider: h, useSAML: v } = u;
1173
- if (l && !v)
1174
- return w("Initiating OAuth authentication flow"), await ze(), C("OAuth authentication flow did not redirect as expected"), _(!1), !1;
1174
+ const i = await Ke();
1175
+ if (v("CSRF token retrieval result", i ? "success" : "failed"), i === null) {
1176
+ if (c || s)
1177
+ return p("Redirection from provider failed after previous attempt"), x("oauthRedirectUrl"), x("samlRedirectUrl"), _(!1), !1;
1178
+ const { autoOAuthProvider: l, autoSAMLProvider: h, useSAML: R } = u;
1179
+ if (l && !R)
1180
+ return w("Initiating OAuth authentication flow"), await He(), p("OAuth authentication flow did not redirect as expected"), _(!1), !1;
1175
1181
  if (h)
1176
- return w("Initiating SAML authentication flow"), await He(), C("SAML authentication flow did not redirect as expected"), _(!1), !1;
1177
- w("No direct authentication method available, will try SSO then credentials"), S({ useCredentials: !0, useSSO: !0 });
1182
+ return w("Initiating SAML authentication flow"), await We(), p("SAML authentication flow did not redirect as expected"), _(!1), !1;
1183
+ w("No direct authentication method available, will try SSO then credentials"), m({ useCredentials: !0, useSSO: !0 });
1178
1184
  } else
1179
1185
  return x("oauthRedirectUrl"), x("samlRedirectUrl"), w("User authenticated via existing token"), _(!0), !0;
1180
- } catch (s) {
1181
- throw f("Unexpected error during authentication", s), _(!1), s;
1186
+ } catch (c) {
1187
+ throw f("Unexpected error during authentication", c), _(!1), c;
1182
1188
  }
1183
1189
  if (u.useCredentials && u.useSSO)
1184
1190
  try {
1185
- if (w("Checking if user is authenticated via SSO"), await Ve())
1186
- return w("User authenticated using SSO"), S({ useCredentials: !1, useSSO: !0 }), _(!0), !0;
1187
- } catch (s) {
1188
- if ((s == null ? void 0 : s.status) === 401)
1189
- return w("SSO authentication failed with 401, falling back to credentials"), S({ useCredentials: !0, useSSO: !1 }), !1;
1190
- throw f("SSO authentication failed with unexpected error", s), _(!1), f;
1191
+ if (w("Checking if user is authenticated via SSO"), await ze())
1192
+ return w("User authenticated using SSO"), m({ useCredentials: !1, useSSO: !0 }), _(!0), !0;
1193
+ } catch (c) {
1194
+ if ((c == null ? void 0 : c.status) === 401)
1195
+ return w("SSO authentication failed with 401, falling back to credentials"), m({ useCredentials: !0, useSSO: !1 }), !1;
1196
+ throw f("SSO authentication failed with unexpected error", c), _(!1), f;
1191
1197
  }
1192
1198
  const { useSSO: r } = u;
1193
1199
  if ($() !== null || r)
1194
- return w("user already authenticated", $()), S({ isRedirectUrl: !1 }), _(!0), !0;
1200
+ return w("user already authenticated", $()), m({ isRedirectUrl: !1 }), _(!0), !0;
1195
1201
  const { useCredentials: n } = u, { username: a, password: o } = e || {};
1196
1202
  if (n && !a && !o)
1197
1203
  return f("Credentials are required for authentication"), _(!1), !1;
1198
1204
  if (a && o)
1199
1205
  try {
1200
- return w("authentication using credentials..."), S({ useCredentials: !0, useSSO: !1 }), await We(e), _(!0), !0;
1201
- } catch (s) {
1202
- throw _(!1), s;
1206
+ return w("authentication using credentials..."), m({ useCredentials: !0, useSSO: !1 }), await Xe(e), _(!0), !0;
1207
+ } catch (c) {
1208
+ throw _(!1), c;
1203
1209
  }
1204
1210
  return _(!1), f("No authentication method available. Please provide credentials or configure OAuth/SAML."), !1;
1205
- }, Tt = async () => {
1211
+ }, tr = async () => {
1206
1212
  const { useCredentials: e, userOverrideActive: t } = u;
1207
- x("csrfToken"), le("sinequa-credentials"), e && !t ? (await Xe()).methodresult === "ok" ? _(!1) : console.error("logout failed") : _(!1);
1208
- }, er = () => !!$(), Ye = async () => {
1209
- const { backendUrl: e, apiPath: t } = u;
1213
+ x("csrfToken"), le("sinequa-credentials"), e && !t ? (await Ye()).methodresult === "ok" ? _(!1) : console.error("logout failed") : _(!1);
1214
+ }, rr = () => !!$(), Ke = async () => {
1215
+ const { backendUrl: e } = u;
1210
1216
  try {
1211
- const n = await (await fetch(`${e}/${t}/challenge?action=getCsrfToken&suppressErrors=true`)).json();
1212
- return n != null && n.csrfToken ? (V(n.csrfToken), n.csrfToken) : null;
1213
- } catch (r) {
1214
- throw console.error("Failed to get CSRF token", r), r;
1217
+ const r = await (await fetch(`${e}/api/v1/challenge?action=getCsrfToken&suppressErrors=true`)).json();
1218
+ return r != null && r.csrfToken ? (V(r.csrfToken), r.csrfToken) : null;
1219
+ } catch (t) {
1220
+ throw console.error("Failed to get CSRF token", t), t;
1215
1221
  }
1216
1222
  };
1217
1223
  export {
1218
- m as ApiError,
1219
- Ot as Audit,
1224
+ S as ApiError,
1225
+ Ut as Audit,
1220
1226
  g as AuditEventType,
1221
- ve as DidYouMeanKind,
1222
- Re as EngineType,
1223
- pe as EngineTypeModifier,
1227
+ xe as DidYouMeanKind,
1228
+ ve as EngineType,
1229
+ Re as EngineTypeModifier,
1224
1230
  te as LogLevel,
1225
- Rt as MINIMUM_COMPATIBLE_SERVER_API_VERSION,
1226
- xe as RFMDisplay,
1231
+ vt as MINIMUM_COMPATIBLE_SERVER_API_VERSION,
1232
+ Le as RFMDisplay,
1227
1233
  Pe as ServerError,
1228
- Le as TimeoutError,
1234
+ Oe as TimeoutError,
1229
1235
  re as UnauthorizedError,
1230
- L as addAuditAdditionalInfo,
1231
- et as addConcepts,
1232
- Ue as addSessionId,
1233
- $e as addUrl,
1234
- Me as aggregationItemStrictCompare,
1235
- yt as appInitializerFn,
1236
- Te as bisect,
1236
+ P as addAuditAdditionalInfo,
1237
+ tt as addConcepts,
1238
+ $e as addSessionId,
1239
+ ye as addUrl,
1240
+ Ee as aggregationItemStrictCompare,
1241
+ It as appInitializerFn,
1242
+ et as bisect,
1237
1243
  j as buildPathsAndLevels,
1238
1244
  St as configureLogger,
1239
- P as createHeaders,
1240
- pt as createTimeoutController,
1241
- p as debug,
1245
+ L as createHeaders,
1246
+ Rt as createTimeoutController,
1247
+ v as debug,
1242
1248
  Pt as del,
1243
- Mt as deleteUserSettings,
1244
- Xe as deleteWebTokenCookie,
1249
+ Et as deleteUserSettings,
1250
+ Ye as deleteWebTokenCookie,
1245
1251
  f as error,
1246
- bt as escapeExpr,
1247
- Ut as fetchAggregation,
1248
- $t as fetchApp,
1249
- Ae as fetchAppPreLogin,
1250
- Gt as fetchBulkQuery,
1251
- It as fetchDataset,
1252
- At as fetchDatasetList,
1253
- Dt as fetchDatasets,
1254
- Nt as fetchLabels,
1252
+ pt as escapeExpr,
1253
+ $t as fetchAggregation,
1254
+ yt as fetchApp,
1255
+ Ne as fetchAppPreLogin,
1256
+ jt as fetchBulkQuery,
1257
+ Dt as fetchDataset,
1258
+ Nt as fetchDatasetList,
1259
+ At as fetchDatasets,
1260
+ Bt as fetchLabels,
1255
1261
  qt as fetchPreview,
1256
- Ft as fetchPreviewUrl,
1257
- Ve as fetchPrincipal,
1258
- Qt as fetchQuery,
1259
- Vt as fetchQueryExport,
1260
- jt as fetchQueryIntent,
1262
+ Qt as fetchPreviewUrl,
1263
+ ze as fetchPrincipal,
1264
+ Gt as fetchQuery,
1265
+ zt as fetchQueryExport,
1266
+ Vt as fetchQueryIntent,
1261
1267
  Jt as fetchSimilarDocuments,
1262
- zt as fetchSponsoredLinks,
1263
- Ht as fetchSuggest,
1264
- Xt as fetchSuggestField,
1265
- Wt as fetchSuggestQuery,
1266
- Yt as fetchTextChunks,
1267
- Kt as fetchUserSettings,
1268
- b as get,
1269
- nt as getConcepts,
1270
- Ye as getCsrfToken,
1268
+ Ht as fetchSponsoredLinks,
1269
+ Wt as fetchSuggest,
1270
+ Yt as fetchSuggestField,
1271
+ Xt as fetchSuggestQuery,
1272
+ Kt as fetchTextChunks,
1273
+ Zt as fetchUserSettings,
1274
+ Tt as fetchVersion,
1275
+ k as get,
1276
+ at as getConcepts,
1277
+ Ke as getCsrfToken,
1271
1278
  ee as getFiltersFromURI,
1272
- it as getFiltersFromUrl,
1273
- _t as getHelpIndexUrl,
1274
- ut as getIdFromUrl,
1275
- We as getJWToken,
1276
- gt as getMetadata,
1277
- me as getOffsetFromDates,
1278
- dt as getQueryPageFromUrl,
1279
- st as getQueryParamsFromUrl,
1280
- ft as getQueryTabFromUrl,
1281
- lt as getQueryTextFromUrl,
1282
- at as getRelativeDate,
1279
+ lt as getFiltersFromUrl,
1280
+ wt as getHelpIndexUrl,
1281
+ dt as getIdFromUrl,
1282
+ Xe as getJWToken,
1283
+ kt as getMetadata,
1284
+ ge as getOffsetFromDates,
1285
+ ft as getQueryPageFromUrl,
1286
+ ct as getQueryParamsFromUrl,
1287
+ ht as getQueryTabFromUrl,
1288
+ ut as getQueryTextFromUrl,
1289
+ ot as getRelativeDate,
1283
1290
  $ as getToken,
1284
- ct as getUrlParamsFromQueryParams,
1291
+ it as getUrlParamsFromQueryParams,
1285
1292
  u as globalConfig,
1286
1293
  Ce as guid,
1287
- k as handleResponse,
1294
+ b as handleResponse,
1288
1295
  w as info,
1289
- ge as isArrayBuffer,
1290
- er as isAuthenticated,
1291
- ke as isBlob,
1292
- kt as isJsonable,
1293
- ot as isNotInputEvent,
1296
+ ke as isArrayBuffer,
1297
+ rr as isAuthenticated,
1298
+ be as isBlob,
1299
+ bt as isJsonable,
1300
+ st as isNotInputEvent,
1294
1301
  A as isObject,
1295
- be as isString,
1296
- Bt as labels,
1297
- Et as login,
1298
- Tt as logout,
1299
- wt as notify,
1302
+ pe as isString,
1303
+ Ft as labels,
1304
+ er as login,
1305
+ tr as logout,
1306
+ mt as notify,
1307
+ de as openParentNodes,
1300
1308
  I as parseText,
1301
1309
  ue as parseValueAndOperatorFromItem,
1302
- Lt as patch,
1303
- Zt as patchUserSettings,
1310
+ Ot as patch,
1311
+ Mt as patchUserSettings,
1304
1312
  d as post,
1305
- xt as put,
1306
- R as queryParamsFromUrl,
1307
- tt as removeConcept,
1308
- rt as removeConcepts,
1309
- mt as resolveToColumnName,
1313
+ Lt as put,
1314
+ C as queryParamsFromUrl,
1315
+ rt as removeConcept,
1316
+ nt as removeConcepts,
1317
+ gt as resolveToColumnName,
1310
1318
  G as rewriteText,
1311
1319
  Je as saveUserSettings,
1312
- S as setGlobalConfig,
1320
+ m as setGlobalConfig,
1313
1321
  V as setToken,
1314
1322
  Ct as sha512,
1315
- Ee as suggestionsToTreeAggregationNodes,
1316
- ht as sysLang,
1317
- Ze as translateAggregationToDateOptions,
1318
- ze as tryOAuthAuthentication,
1319
- He as trySAMLAuthentication,
1320
- C as warn,
1321
- vt as withRetry
1323
+ Te as suggestionsToTreeAggregationNodes,
1324
+ _t as sysLang,
1325
+ Me as translateAggregationToDateOptions,
1326
+ He as tryOAuthAuthentication,
1327
+ We as trySAMLAuthentication,
1328
+ p as warn,
1329
+ xt as withRetry
1322
1330
  };