@sinequa/atomic 0.0.109 → 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 (96) hide show
  1. package/dist/atomic.js +388 -377
  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/v1/fetch-similar-documents.d.ts +11 -0
  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 +0 -13
  88. package/dist/web-api/fetch-similar-documents.d.ts.map +0 -1
  89. package/dist/web-api/fetch-sponsored-links.d.ts.map +0 -1
  90. package/dist/web-api/fetch-suggest.d.ts.map +0 -1
  91. package/dist/web-api/fetch-text-chunk.d.ts.map +0 -1
  92. package/dist/web-api/fetch-user-settings.d.ts.map +0 -1
  93. package/dist/web-api/helpers.d.ts +0 -145
  94. package/dist/web-api/helpers.d.ts.map +0 -1
  95. package/dist/web-api/helpers.test.d.ts.map +0 -1
  96. /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,32 +333,32 @@ 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
  });
@@ -376,14 +379,14 @@ function A(e) {
376
379
  function ke(e) {
377
380
  return A(e) && Object.prototype.toString.call(e) === "[object ArrayBuffer]";
378
381
  }
379
- function ge(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 gt(e) {
386
- return (A(e) || Array.isArray(e)) && !ke(e) && !ge(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 k = /* @__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))(k || {}), 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 g(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,76 +475,78 @@ async function g(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,
507
510
  credentials: "include",
508
- body: JSON.stringify(c)
511
+ body: JSON.stringify(c),
512
+ signal: r == null ? void 0 : r.signal
509
513
  }
510
514
  );
511
- return g(l, r == null ? void 0 : r.responseType);
512
- } catch (l) {
513
- 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;
514
518
  }
515
519
  }
516
- async function b(e, t, r) {
517
- const n = P(r == null ? void 0 : r.headers), { backendUrl: a, apiPath: o } = u, s = t ? `?${new URLSearchParams(t)}` : "", c = `${a}/${o}/${e}${s}`;
518
- 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}`);
519
523
  try {
520
- const i = await fetch(
524
+ const s = await fetch(
521
525
  c,
522
526
  {
523
527
  method: "GET",
524
528
  credentials: "include",
525
- headers: n
529
+ headers: n,
530
+ signal: r == null ? void 0 : r.signal
526
531
  }
527
532
  );
528
- return g(i, r == null ? void 0 : r.responseType);
529
- } catch (i) {
530
- 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;
531
536
  }
532
537
  }
533
- async function xt(e, t, r) {
534
- 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 = {
535
540
  app: a,
536
541
  ...t,
537
542
  locale: t.locale || navigator.language,
538
543
  noUserOverride: !0,
539
544
  noAutoAuthentication: !0
540
- }, i = `${o}/${s}/${e}`;
541
- p(`Making PUT request to: ${i}`);
545
+ }, s = `${o}/${e}`;
546
+ v(`Making PUT request to: ${s}`);
542
547
  try {
543
- const l = await fetch(
544
- i,
548
+ const i = await fetch(
549
+ s,
545
550
  {
546
551
  method: "PUT",
547
552
  headers: n,
@@ -549,16 +554,16 @@ async function xt(e, t, r) {
549
554
  body: JSON.stringify(c)
550
555
  }
551
556
  );
552
- return g(l, r == null ? void 0 : r.responseType);
553
- } catch (l) {
554
- 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;
555
560
  }
556
561
  }
557
562
  async function Pt(e, t, r) {
558
- const n = P(r == null ? void 0 : r.headers), { backendUrl: a, apiPath: o } = u, s = t ? `?${new URLSearchParams(t)}` : "", c = `${a}/${o}/${e}${s}`;
559
- 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}`);
560
565
  try {
561
- const i = await fetch(
566
+ const s = await fetch(
562
567
  c,
563
568
  {
564
569
  method: "DELETE",
@@ -566,23 +571,23 @@ async function Pt(e, t, r) {
566
571
  headers: n
567
572
  }
568
573
  );
569
- return g(i, r == null ? void 0 : r.responseType);
570
- } catch (i) {
571
- 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;
572
577
  }
573
578
  }
574
- async function Lt(e, t, r) {
575
- 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 = {
576
581
  app: a,
577
582
  ...t,
578
583
  locale: t.locale || navigator.language,
579
584
  noUserOverride: !0,
580
585
  noAutoAuthentication: !0
581
- }, i = `${o}/${s}/${e}`;
582
- p(`Making PATCH request to: ${i}`);
586
+ }, s = `${o}/${e}`;
587
+ v(`Making PATCH request to: ${s}`);
583
588
  try {
584
- const l = await fetch(
585
- i,
589
+ const i = await fetch(
590
+ s,
586
591
  {
587
592
  method: "PATCH",
588
593
  headers: n,
@@ -590,17 +595,17 @@ async function Lt(e, t, r) {
590
595
  body: JSON.stringify(c)
591
596
  }
592
597
  );
593
- return g(l, r == null ? void 0 : r.responseType);
594
- } catch (l) {
595
- 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;
596
601
  }
597
602
  }
598
- let q, ne;
599
- function L(e, t = !0) {
600
- let r = Oe(e.$auditRecord);
601
- 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;
602
607
  }
603
- function Oe(e) {
608
+ function Ue(e) {
604
609
  if (!e)
605
610
  return;
606
611
  let t;
@@ -614,56 +619,56 @@ function Oe(e) {
614
619
  }
615
620
  return { auditEvents: t };
616
621
  }
617
- function Ue(e) {
622
+ function $e(e) {
618
623
  var r;
619
- const t = ye();
624
+ const t = Ie();
620
625
  return (r = e.auditEvents) == null || r.forEach((n) => {
621
626
  n.detail || (n.detail = {}), n.detail.sessionid = t;
622
627
  }), e;
623
628
  }
624
- function $e(e) {
629
+ function ye(e) {
625
630
  var r;
626
631
  const t = typeof window < "u" ? decodeURIComponent(window.location.href) : "http://localhost";
627
632
  return (r = e == null ? void 0 : e.auditEvents) == null || r.forEach((n) => {
628
633
  n.detail || (n.detail = {}), n.detail.url = t;
629
634
  }), e;
630
635
  }
631
- function ye() {
632
- return (!q || Ie()) && (q = Ce()), ne = /* @__PURE__ */ new Date(), q;
633
- }
634
636
  function Ie() {
637
+ return (!F || De()) && (F = Ce()), ne = /* @__PURE__ */ new Date(), F;
638
+ }
639
+ function De() {
635
640
  return (/* @__PURE__ */ new Date()).getTime() - ne.getTime() > 10 * 60 * 1e3;
636
641
  }
637
- async function De(e, t = !0) {
642
+ async function Ae(e, t = !0) {
638
643
  const r = {
639
- event: k.None,
644
+ event: g.None,
640
645
  $auditRecord: e
641
646
  };
642
- return L(r, t), d("audit.notify", r);
647
+ return P(r, t), d("api/v1/audit.notify", r);
643
648
  }
644
- const Ot = { notify: De };
645
- async function Ut(e, t, r) {
649
+ const Ut = { notify: Ae };
650
+ async function $t(e, t, r) {
646
651
  var h;
647
652
  const n = ((h = e.items) == null ? void 0 : h.length) || 0, a = 10, o = {
648
653
  query: { ...t, action: "aggregate", aggregations: { [e.name]: { skip: n, count: a } } },
649
654
  $auditRecord: { auditEvents: [r] }
650
655
  };
651
- L(o);
652
- const s = await d("query", o), c = await g(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];
653
658
  return l.$hasMore = l.items.length > a, l.items = [...e.items, ...l.items], Promise.resolve(l);
654
659
  }
655
- async function $t() {
660
+ async function yt() {
656
661
  const { app: e } = u, t = new URLSearchParams({ app: e || "" });
657
- return b("app", t);
662
+ return k("api/v1/app", t);
658
663
  }
659
- async function Ae() {
664
+ async function Ne() {
660
665
  const { app: e } = u, t = new URLSearchParams({
661
666
  app: e || "",
662
667
  preLogin: "true"
663
668
  });
664
- return b("app", t);
669
+ return k("api/v1/app", t);
665
670
  }
666
- function yt() {
671
+ function It() {
667
672
  let { backendUrl: e, app: t } = u;
668
673
  if (typeof window < "u") {
669
674
  if (e || (e = window.location.origin), !t) {
@@ -672,15 +677,15 @@ function yt() {
672
677
  );
673
678
  r && (t = r[1]);
674
679
  }
675
- S({
680
+ m({
676
681
  ...u,
677
682
  backendUrl: e,
678
683
  app: t
679
684
  });
680
685
  }
681
- return Ae().then((r) => {
686
+ return Ne().then((r) => {
682
687
  const { autoOAuthProvider: n, autoSAMLProvider: a } = u, o = !n && !r.autoOAuthProvider && !a && !r.autoSAMLProvider;
683
- return S({
688
+ return m({
684
689
  ...u,
685
690
  autoOAuthProvider: n || r.autoOAuthProvider,
686
691
  autoSAMLProvider: a || r.autoSAMLProvider,
@@ -691,22 +696,22 @@ function yt() {
691
696
  throw console.error("atomic:fetchAppPreLogin error", r), r;
692
697
  });
693
698
  }
694
- async function It(e, t, r = {}) {
695
- const n = `search.dataset/${e}/${t}`, a = await d(n, { parameters: r }), o = t[0].toLowerCase() + t.slice(1), s = a.datasets[o];
696
- if ("errorCode" in s && "errorMessage" in s)
697
- throw new Error(s.errorMessage);
698
- 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;
699
704
  }
700
- async function Dt(e, t) {
701
- 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;
702
707
  return (await d(r, { parameters: n, datasets: a })).datasets;
703
708
  }
704
- async function At(e) {
705
- return await b(`search.dataset/${e}`);
709
+ async function Nt(e) {
710
+ return await k(`api/v1/search.dataset/${e}`);
706
711
  }
707
- async function Nt(e, t = !0, r) {
712
+ async function Bt(e, t = !0, r) {
708
713
  try {
709
- return (await d("labels", {
714
+ return (await d("api/v1/labels", {
710
715
  action: "list",
711
716
  q: e,
712
717
  public: t,
@@ -717,18 +722,18 @@ async function Nt(e, t = !0, r) {
717
722
  throw f("Error in fetchLabels", n), n;
718
723
  }
719
724
  }
720
- async function Ne() {
725
+ async function Be() {
721
726
  try {
722
727
  const { app: e = "" } = u, t = new URLSearchParams({
723
728
  app: e,
724
729
  action: "getUserRights"
725
730
  });
726
- return b("labels", t);
731
+ return k("api/v1/labels", t);
727
732
  } catch (e) {
728
733
  throw f("Error in getUserRights", e), e;
729
734
  }
730
735
  }
731
- async function Be(e, t, r = !0) {
736
+ async function Fe(e, t, r = !0) {
732
737
  try {
733
738
  const n = {
734
739
  action: "add",
@@ -738,7 +743,7 @@ async function Be(e, t, r = !0) {
738
743
  $auditRecord: {
739
744
  auditEvents: [
740
745
  {
741
- type: k.Label_AddDoc,
746
+ type: g.Label_AddDoc,
742
747
  detail: {
743
748
  public: r,
744
749
  label: e ? e.toString() : null,
@@ -754,7 +759,7 @@ async function Be(e, t, r = !0) {
754
759
  ]
755
760
  }
756
761
  };
757
- return d("labels", n);
762
+ return d("api/v1/labels", n);
758
763
  } catch (n) {
759
764
  throw f("Error in add", n), n;
760
765
  }
@@ -769,7 +774,7 @@ async function qe(e, t, r = !0) {
769
774
  $auditRecord: {
770
775
  auditEvents: [
771
776
  {
772
- type: k.Label_RemoveDoc,
777
+ type: g.Label_RemoveDoc,
773
778
  detail: {
774
779
  public: r,
775
780
  label: e ? e.toString() : null,
@@ -785,12 +790,12 @@ async function qe(e, t, r = !0) {
785
790
  ]
786
791
  }
787
792
  };
788
- return d("labels", n);
793
+ return d("api/v1/labels", n);
789
794
  } catch (n) {
790
795
  throw f("Error in remove", n), n;
791
796
  }
792
797
  }
793
- async function Fe(e, t, r = !0) {
798
+ async function Qe(e, t, r = !0) {
794
799
  try {
795
800
  const n = {
796
801
  action: "rename",
@@ -798,7 +803,7 @@ async function Fe(e, t, r = !0) {
798
803
  newLabel: t,
799
804
  public: r,
800
805
  auditEvents: {
801
- type: k.Label_Rename,
806
+ type: g.Label_Rename,
802
807
  detail: {
803
808
  public: r,
804
809
  oldlabel: e ? e.toString() : null,
@@ -806,31 +811,31 @@ async function Fe(e, t, r = !0) {
806
811
  }
807
812
  }
808
813
  };
809
- return d("labels", n);
814
+ return d("api/v1/labels", n);
810
815
  } catch (n) {
811
816
  throw f("Error in rename", n), n;
812
817
  }
813
818
  }
814
- async function Qe(e, t = !0) {
819
+ async function Ge(e, t = !0) {
815
820
  try {
816
821
  const r = {
817
822
  action: "delete",
818
823
  labels: e,
819
824
  public: t,
820
825
  auditEvents: {
821
- type: k.Label_Delete,
826
+ type: g.Label_Delete,
822
827
  detail: {
823
828
  public: t,
824
829
  label: e ? e.toString() : null
825
830
  }
826
831
  }
827
832
  };
828
- return d("labels", r);
833
+ return d("api/v1/labels", r);
829
834
  } catch (r) {
830
835
  throw f("Error in deleteLabels", r), r;
831
836
  }
832
837
  }
833
- async function Ge(e, t, r = !0) {
838
+ async function je(e, t, r = !0) {
834
839
  try {
835
840
  const n = {
836
841
  action: "bulkAdd",
@@ -838,7 +843,7 @@ async function Ge(e, t, r = !0) {
838
843
  query: t,
839
844
  public: r,
840
845
  auditEvents: {
841
- type: k.Label_Add,
846
+ type: g.Label_Add,
842
847
  detail: {
843
848
  public: r,
844
849
  label: e ? e.toString() : null,
@@ -846,12 +851,12 @@ async function Ge(e, t, r = !0) {
846
851
  }
847
852
  }
848
853
  };
849
- return d("labels", n);
854
+ return d("api/v1/labels", n);
850
855
  } catch (n) {
851
856
  throw f("Error in bulkAdd", n), n;
852
857
  }
853
858
  }
854
- async function je(e, t, r = !0) {
859
+ async function Ve(e, t, r = !0) {
855
860
  try {
856
861
  const n = {
857
862
  action: "bulkRemove",
@@ -859,7 +864,7 @@ async function je(e, t, r = !0) {
859
864
  query: t,
860
865
  public: r,
861
866
  auditEvents: {
862
- type: k.Label_Delete,
867
+ type: g.Label_Delete,
863
868
  detail: {
864
869
  public: r,
865
870
  label: e ? e.toString() : null,
@@ -867,36 +872,36 @@ async function je(e, t, r = !0) {
867
872
  }
868
873
  }
869
874
  };
870
- return d("labels", n);
875
+ return d("api/v1/labels", n);
871
876
  } catch (n) {
872
877
  throw f("Error in bulkRemove", n), n;
873
878
  }
874
879
  }
875
- const Bt = {
876
- getUserRights: Ne,
877
- add: Be,
880
+ const Ft = {
881
+ getUserRights: Be,
882
+ add: Fe,
878
883
  remove: qe,
879
- rename: Fe,
880
- delete: Qe,
881
- bulkAdd: Ge,
882
- bulkRemove: je
884
+ rename: Qe,
885
+ delete: Ge,
886
+ bulkAdd: je,
887
+ bulkRemove: Ve
883
888
  };
884
889
  async function qt(e, t) {
885
890
  if (typeof window > "u")
886
- return d("preview", {
891
+ return d("api/v1/preview", {
887
892
  action: "get",
888
893
  id: e,
889
894
  query: t
890
895
  });
891
896
  const r = `${window.location.origin}${window.location.pathname}`, n = { name: t == null ? void 0 : t.name, text: t == null ? void 0 : t.text };
892
- return d("preview", {
897
+ return d("api/v1/preview", {
893
898
  action: "get",
894
899
  id: e,
895
900
  query: n,
896
901
  browserUrl: r
897
902
  });
898
903
  }
899
- async function Ft(e) {
904
+ async function Qt(e) {
900
905
  const t = new Headers();
901
906
  t.append("content-type", "text");
902
907
  const r = await fetch(
@@ -906,76 +911,76 @@ async function Ft(e) {
906
911
  headers: t
907
912
  }
908
913
  );
909
- g(r);
914
+ b(r);
910
915
  }
911
- async function Ve() {
916
+ async function ze() {
912
917
  const e = new URLSearchParams({
913
918
  action: "get",
914
919
  noAutoAuthentication: "true"
915
920
  });
916
- return b("principal", e);
921
+ return k("api/v1/principal", e);
917
922
  }
918
923
  const ae = 11;
919
- async function Qt(e, t, r) {
920
- var s;
921
- const a = await d("query", {
924
+ async function Gt(e, t, r) {
925
+ var c;
926
+ const a = await d("api/v1/query", {
922
927
  query: e,
923
928
  $auditRecord: t,
924
929
  queryIntentData: r
925
930
  });
926
- a.aggregations.forEach((c) => {
927
- c.$hasMore = !1, !c.isDistribution && !c.isTree && c.items && (c.$hasMore = c.items.length === ae), c.isTree && c.items && j(c);
928
- }), (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" }));
929
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 };
930
935
  return Promise.resolve(o);
931
936
  }
932
- async function Gt(e, t, r) {
937
+ async function jt(e, t, r) {
933
938
  const { app: n = "" } = u, a = {
934
939
  methods: [],
935
940
  mode: t,
936
941
  propagateErrors: !0,
937
942
  $auditRecord: { auditEvents: [r] }
938
943
  };
939
- for (const c of e)
944
+ for (const s of e)
940
945
  a.methods.push({
941
946
  method: "query",
942
947
  app: n,
943
- query: c
948
+ query: s
944
949
  });
945
- const o = await d("multi", a);
946
- o.results.forEach((c) => {
947
- c.aggregations.forEach((i) => {
950
+ const o = await d("api/v1/multi", a);
951
+ o.results.forEach((s) => {
952
+ s.aggregations.forEach((i) => {
948
953
  i.$hasMore = !1, !i.isDistribution && !i.isTree && i.items && (i.$hasMore = i.items.length === ae), i.isTree && j(i);
949
954
  });
950
- }), o.results.forEach((c) => {
955
+ }), o.results.forEach((s) => {
951
956
  var i;
952
- 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" }));
953
958
  });
954
- 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 }));
955
- 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);
956
961
  }
957
962
  function j(e, t = "", r = 0) {
958
963
  let n = [];
959
964
  return e.items && e.items.forEach((a) => {
960
- let o = t ? `${t}/${a.value}` : a.value, s = r + 1;
961
- 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;
962
967
  }), n;
963
968
  }
964
- async function jt(e) {
965
- const r = await d("queryintent", {
969
+ async function Vt(e) {
970
+ const r = await d("api/v1/queryintent", {
966
971
  query: e
967
972
  });
968
973
  return r == null ? void 0 : r.intents;
969
974
  }
970
- async function Vt({ model: e, appName: t, query: r, article: n }) {
971
- 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 = {
972
977
  app: t,
973
978
  webservice: a,
974
979
  query: r,
975
980
  type: i,
976
981
  format: o,
977
- maxcount: s,
978
- exportedColumns: c,
982
+ maxcount: c,
983
+ exportedColumns: s,
979
984
  $auditRecord: {
980
985
  auditEvents: [{
981
986
  type: "Search_ExportCSV",
@@ -985,29 +990,30 @@ async function Vt({ model: e, appName: t, query: r, article: n }) {
985
990
  }]
986
991
  }
987
992
  };
988
- return L(l), await d("search.queryexport", l, { responseType: "blob" });
993
+ return P(l), await d("api/v1/search.queryexport", l, { responseType: "blob" });
989
994
  }
990
- async function Jt(e, t) {
991
- return await d(
992
- "similardocuments",
995
+ async function Jt(e, t, r) {
996
+ return (await d(
997
+ "api/v1/similardocuments",
993
998
  {
994
999
  sourceDocumentId: e,
995
1000
  query: {
996
1001
  name: t
997
1002
  }
998
- }
999
- );
1003
+ },
1004
+ { signal: r }
1005
+ )).data;
1000
1006
  }
1001
- async function zt(e, t) {
1007
+ async function Ht(e, t) {
1002
1008
  var a;
1003
- const n = await d("query.links", {
1009
+ const n = await d("api/v1/query.links", {
1004
1010
  webservice: e,
1005
1011
  query: t
1006
1012
  });
1007
1013
  return (a = n == null ? void 0 : n.links) == null ? void 0 : a.map((o) => ({ ...o, query: t }));
1008
1014
  }
1009
- async function Ht(e, t, r, n, a) {
1010
- const { app: o } = u, s = {
1015
+ async function Wt(e, t, r, n, a) {
1016
+ const { app: o } = u, c = {
1011
1017
  app: o || "",
1012
1018
  suggestQuery: e,
1013
1019
  text: t,
@@ -1016,14 +1022,14 @@ async function Ht(e, t, r, n, a) {
1016
1022
  showSource: a
1017
1023
  };
1018
1024
  try {
1019
- return (await d("search.suggest", s)).suggests;
1020
- } catch (c) {
1021
- 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;
1022
1028
  }
1023
1029
  }
1024
- async function Wt(e, t, r, n) {
1030
+ async function Xt(e, t, r, n) {
1025
1031
  const { app: a } = u;
1026
- return (await d("suggestquery", {
1032
+ return (await d("api/v1/suggestquery", {
1027
1033
  app: a || "",
1028
1034
  suggestQuery: e,
1029
1035
  text: t,
@@ -1031,18 +1037,18 @@ async function Wt(e, t, r, n) {
1031
1037
  kinds: n
1032
1038
  })).suggests;
1033
1039
  }
1034
- async function Xt(e, t) {
1040
+ async function Yt(e, t) {
1035
1041
  if (!t) return Promise.resolve([]);
1036
1042
  const { app: r } = u;
1037
- return (await d("suggestfield", {
1043
+ return (await d("api/v1/suggestfield", {
1038
1044
  app: r || "",
1039
1045
  text: e,
1040
1046
  action: "suggests",
1041
1047
  fields: t
1042
1048
  })).suggests;
1043
1049
  }
1044
- async function Yt(e, t, r, n, a, o) {
1045
- return d("doc.textchunks", {
1050
+ async function Kt(e, t, r, n, a, o) {
1051
+ return d("api/v1/doc.textchunks", {
1046
1052
  id: e,
1047
1053
  textChunks: t,
1048
1054
  highlights: r,
@@ -1051,12 +1057,12 @@ async function Yt(e, t, r, n, a, o) {
1051
1057
  rightSentencesCount: o
1052
1058
  });
1053
1059
  }
1054
- async function Kt() {
1060
+ async function Zt() {
1055
1061
  const { app: e } = u, t = new URLSearchParams({
1056
1062
  app: e || "",
1057
1063
  action: "load"
1058
1064
  });
1059
- return b("usersettings", t);
1065
+ return k("api/v1/usersettings", t);
1060
1066
  }
1061
1067
  async function Je(e, t) {
1062
1068
  const r = {
@@ -1064,19 +1070,22 @@ async function Je(e, t) {
1064
1070
  userSettings: e,
1065
1071
  $auditRecord: { auditEvents: [t] }
1066
1072
  };
1067
- return L(r), d("usersettings", r);
1073
+ return P(r), d("api/v1/usersettings", r);
1068
1074
  }
1069
- async function Zt(e, t) {
1075
+ async function Mt(e, t) {
1070
1076
  const n = {
1071
1077
  action: "patch",
1072
1078
  userSettings: e,
1073
1079
  $auditRecord: t ? { auditEvents: [t] } : void 0
1074
1080
  };
1075
- return L(n), d("usersettings", n);
1081
+ return P(n), d("api/v1/usersettings", n);
1076
1082
  }
1077
- async function Mt() {
1083
+ async function Et() {
1078
1084
  return Je({}, { type: "UserSettings_Reset" });
1079
1085
  }
1086
+ async function Tt() {
1087
+ return await k("api/v2/version");
1088
+ }
1080
1089
  function _(e) {
1081
1090
  const t = new CustomEvent(
1082
1091
  "authenticated",
@@ -1088,7 +1097,7 @@ function _(e) {
1088
1097
  );
1089
1098
  dispatchEvent(t);
1090
1099
  }
1091
- const ze = async () => {
1100
+ const He = async () => {
1092
1101
  const { autoOAuthProvider: e } = u;
1093
1102
  if (typeof window > "u")
1094
1103
  return d("security.oauth", {
@@ -1104,12 +1113,12 @@ const ze = async () => {
1104
1113
  originalUrl: window.location.href
1105
1114
  };
1106
1115
  try {
1107
- const r = await d("security.oauth", t);
1116
+ const r = await d("api/v1/security.oauth", t);
1108
1117
  return r.redirectUrl && (E("oauthRedirectUrl", r.redirectUrl), window.location.href = r.redirectUrl), r;
1109
1118
  } catch (r) {
1110
1119
  throw console.error("Failed to authenticate with OAuth", r), r;
1111
1120
  }
1112
- }, He = async () => {
1121
+ }, We = async () => {
1113
1122
  const { autoSAMLProvider: e } = u;
1114
1123
  if (typeof window > "u")
1115
1124
  return d("security.saml", {
@@ -1125,12 +1134,12 @@ const ze = async () => {
1125
1134
  originalUrl: window.location.href
1126
1135
  };
1127
1136
  try {
1128
- const r = await d("security.saml", t);
1137
+ const r = await d("api/v1/security.saml", t);
1129
1138
  return r.redirectUrl && (E("samlRedirectUrl", r.redirectUrl), window.location.href = r.redirectUrl), r;
1130
1139
  } catch (r) {
1131
1140
  throw console.error("Failed to authenticate with SAML", r), r;
1132
1141
  }
1133
- }, We = async (e) => {
1142
+ }, Xe = async (e) => {
1134
1143
  const { username: t, password: r } = e || {}, n = {
1135
1144
  action: "get",
1136
1145
  tokenInCookie: !0,
@@ -1140,180 +1149,182 @@ const ze = async () => {
1140
1149
  noAutoAuthentication: !0
1141
1150
  };
1142
1151
  try {
1143
- const a = await d("security.webtoken", n);
1152
+ const a = await d("api/v1/security.webtoken", n);
1144
1153
  return a.csrfToken ? (V(a.csrfToken), a.csrfToken) : null;
1145
1154
  } catch (a) {
1146
1155
  throw console.error("Failed to get JWT", a), a;
1147
1156
  }
1148
- }, Xe = async () => {
1157
+ }, Ye = async () => {
1149
1158
  const e = new URLSearchParams({
1150
1159
  action: "deleteWebTokenCookie",
1151
1160
  noUserOverride: "true",
1152
1161
  noAutoAuthentication: "true"
1153
1162
  });
1154
- return b("challenge", e);
1163
+ return k("challenge", e);
1155
1164
  }, $ = () => {
1156
- const e = F("csrfToken"), t = ce("sinequa-credentials");
1165
+ const e = q("csrfToken"), t = ce("sinequa-credentials");
1157
1166
  return t ? JSON.parse(t).data.csrfToken : e || null;
1158
- }, 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) => {
1159
1168
  if (e)
1160
- w("Attempting authentication using credentials"), S({ useCredentials: !0, useSSO: !1 });
1169
+ w("Attempting authentication using credentials"), m({ useCredentials: !0, useSSO: !1 });
1161
1170
  else
1162
1171
  try {
1163
- const s = F("oauthRedirectUrl"), c = F("samlRedirectUrl");
1172
+ const c = q("oauthRedirectUrl"), s = q("samlRedirectUrl");
1164
1173
  w("Attempting to retrieve CSRF token");
1165
- const i = await Ye();
1166
- if (p("CSRF token retrieval result", i ? "success" : "failed"), i === null) {
1167
- if (s || c)
1168
- return C("Redirection from provider failed after previous attempt"), x("oauthRedirectUrl"), x("samlRedirectUrl"), _(!1), !1;
1169
- const { autoOAuthProvider: l, autoSAMLProvider: h, useSAML: v } = u;
1170
- if (l && !v)
1171
- 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;
1172
1181
  if (h)
1173
- return w("Initiating SAML authentication flow"), await He(), C("SAML authentication flow did not redirect as expected"), _(!1), !1;
1174
- 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 });
1175
1184
  } else
1176
1185
  return x("oauthRedirectUrl"), x("samlRedirectUrl"), w("User authenticated via existing token"), _(!0), !0;
1177
- } catch (s) {
1178
- throw f("Unexpected error during authentication", s), _(!1), s;
1186
+ } catch (c) {
1187
+ throw f("Unexpected error during authentication", c), _(!1), c;
1179
1188
  }
1180
1189
  if (u.useCredentials && u.useSSO)
1181
1190
  try {
1182
- if (w("Checking if user is authenticated via SSO"), await Ve())
1183
- return w("User authenticated using SSO"), S({ useCredentials: !1, useSSO: !0 }), _(!0), !0;
1184
- } catch (s) {
1185
- if ((s == null ? void 0 : s.status) === 401)
1186
- return w("SSO authentication failed with 401, falling back to credentials"), S({ useCredentials: !0, useSSO: !1 }), !1;
1187
- 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;
1188
1197
  }
1189
1198
  const { useSSO: r } = u;
1190
1199
  if ($() !== null || r)
1191
- return w("user already authenticated", $()), S({ isRedirectUrl: !1 }), _(!0), !0;
1200
+ return w("user already authenticated", $()), m({ isRedirectUrl: !1 }), _(!0), !0;
1192
1201
  const { useCredentials: n } = u, { username: a, password: o } = e || {};
1193
1202
  if (n && !a && !o)
1194
1203
  return f("Credentials are required for authentication"), _(!1), !1;
1195
1204
  if (a && o)
1196
1205
  try {
1197
- return w("authentication using credentials..."), S({ useCredentials: !0, useSSO: !1 }), await We(e), _(!0), !0;
1198
- } catch (s) {
1199
- 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;
1200
1209
  }
1201
1210
  return _(!1), f("No authentication method available. Please provide credentials or configure OAuth/SAML."), !1;
1202
- }, Tt = async () => {
1211
+ }, tr = async () => {
1203
1212
  const { useCredentials: e, userOverrideActive: t } = u;
1204
- x("csrfToken"), le("sinequa-credentials"), e && !t ? (await Xe()).methodresult === "ok" ? _(!1) : console.error("logout failed") : _(!1);
1205
- }, er = () => !!$(), Ye = async () => {
1206
- 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;
1207
1216
  try {
1208
- const n = await (await fetch(`${e}/${t}/challenge?action=getCsrfToken&suppressErrors=true`)).json();
1209
- return n != null && n.csrfToken ? (V(n.csrfToken), n.csrfToken) : null;
1210
- } catch (r) {
1211
- 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;
1212
1221
  }
1213
1222
  };
1214
1223
  export {
1215
- m as ApiError,
1216
- Ot as Audit,
1217
- k as AuditEventType,
1218
- ve as DidYouMeanKind,
1219
- Re as EngineType,
1220
- pe as EngineTypeModifier,
1224
+ S as ApiError,
1225
+ Ut as Audit,
1226
+ g as AuditEventType,
1227
+ xe as DidYouMeanKind,
1228
+ ve as EngineType,
1229
+ Re as EngineTypeModifier,
1221
1230
  te as LogLevel,
1222
- Rt as MINIMUM_COMPATIBLE_SERVER_API_VERSION,
1223
- xe as RFMDisplay,
1231
+ vt as MINIMUM_COMPATIBLE_SERVER_API_VERSION,
1232
+ Le as RFMDisplay,
1224
1233
  Pe as ServerError,
1225
- Le as TimeoutError,
1234
+ Oe as TimeoutError,
1226
1235
  re as UnauthorizedError,
1227
- L as addAuditAdditionalInfo,
1228
- et as addConcepts,
1229
- Ue as addSessionId,
1230
- $e as addUrl,
1231
- Me as aggregationItemStrictCompare,
1232
- yt as appInitializerFn,
1233
- 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,
1234
1243
  j as buildPathsAndLevels,
1235
1244
  St as configureLogger,
1236
- P as createHeaders,
1237
- pt as createTimeoutController,
1238
- p as debug,
1245
+ L as createHeaders,
1246
+ Rt as createTimeoutController,
1247
+ v as debug,
1239
1248
  Pt as del,
1240
- Mt as deleteUserSettings,
1241
- Xe as deleteWebTokenCookie,
1249
+ Et as deleteUserSettings,
1250
+ Ye as deleteWebTokenCookie,
1242
1251
  f as error,
1243
- bt as escapeExpr,
1244
- Ut as fetchAggregation,
1245
- $t as fetchApp,
1246
- Ae as fetchAppPreLogin,
1247
- Gt as fetchBulkQuery,
1248
- It as fetchDataset,
1249
- At as fetchDatasetList,
1250
- Dt as fetchDatasets,
1251
- 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,
1252
1261
  qt as fetchPreview,
1253
- Ft as fetchPreviewUrl,
1254
- Ve as fetchPrincipal,
1255
- Qt as fetchQuery,
1256
- Vt as fetchQueryExport,
1257
- jt as fetchQueryIntent,
1262
+ Qt as fetchPreviewUrl,
1263
+ ze as fetchPrincipal,
1264
+ Gt as fetchQuery,
1265
+ zt as fetchQueryExport,
1266
+ Vt as fetchQueryIntent,
1258
1267
  Jt as fetchSimilarDocuments,
1259
- zt as fetchSponsoredLinks,
1260
- Ht as fetchSuggest,
1261
- Xt as fetchSuggestField,
1262
- Wt as fetchSuggestQuery,
1263
- Yt as fetchTextChunks,
1264
- Kt as fetchUserSettings,
1265
- b as get,
1266
- nt as getConcepts,
1267
- 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,
1268
1278
  ee as getFiltersFromURI,
1269
- it as getFiltersFromUrl,
1270
- _t as getHelpIndexUrl,
1271
- ut as getIdFromUrl,
1272
- We as getJWToken,
1279
+ lt as getFiltersFromUrl,
1280
+ wt as getHelpIndexUrl,
1281
+ dt as getIdFromUrl,
1282
+ Xe as getJWToken,
1273
1283
  kt as getMetadata,
1274
- me as getOffsetFromDates,
1275
- dt as getQueryPageFromUrl,
1276
- st as getQueryParamsFromUrl,
1277
- ft as getQueryTabFromUrl,
1278
- lt as getQueryTextFromUrl,
1279
- at as getRelativeDate,
1284
+ ge as getOffsetFromDates,
1285
+ ft as getQueryPageFromUrl,
1286
+ ct as getQueryParamsFromUrl,
1287
+ ht as getQueryTabFromUrl,
1288
+ ut as getQueryTextFromUrl,
1289
+ ot as getRelativeDate,
1280
1290
  $ as getToken,
1281
- ct as getUrlParamsFromQueryParams,
1291
+ it as getUrlParamsFromQueryParams,
1282
1292
  u as globalConfig,
1283
1293
  Ce as guid,
1284
- g as handleResponse,
1294
+ b as handleResponse,
1285
1295
  w as info,
1286
1296
  ke as isArrayBuffer,
1287
- er as isAuthenticated,
1288
- ge as isBlob,
1289
- gt as isJsonable,
1290
- ot as isNotInputEvent,
1297
+ rr as isAuthenticated,
1298
+ be as isBlob,
1299
+ bt as isJsonable,
1300
+ st as isNotInputEvent,
1291
1301
  A as isObject,
1292
- be as isString,
1293
- Bt as labels,
1294
- Et as login,
1295
- Tt as logout,
1296
- 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,
1297
1308
  I as parseText,
1298
1309
  ue as parseValueAndOperatorFromItem,
1299
- Lt as patch,
1300
- Zt as patchUserSettings,
1310
+ Ot as patch,
1311
+ Mt as patchUserSettings,
1301
1312
  d as post,
1302
- xt as put,
1303
- R as queryParamsFromUrl,
1304
- tt as removeConcept,
1305
- rt as removeConcepts,
1306
- mt as resolveToColumnName,
1313
+ Lt as put,
1314
+ C as queryParamsFromUrl,
1315
+ rt as removeConcept,
1316
+ nt as removeConcepts,
1317
+ gt as resolveToColumnName,
1307
1318
  G as rewriteText,
1308
1319
  Je as saveUserSettings,
1309
- S as setGlobalConfig,
1320
+ m as setGlobalConfig,
1310
1321
  V as setToken,
1311
1322
  Ct as sha512,
1312
- Ee as suggestionsToTreeAggregationNodes,
1313
- ht as sysLang,
1314
- Ze as translateAggregationToDateOptions,
1315
- ze as tryOAuthAuthentication,
1316
- He as trySAMLAuthentication,
1317
- C as warn,
1318
- 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
1319
1330
  };