@sinequa/atomic 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,22 +52,23 @@ var f = {
52
52
  kind: "saml",
53
53
  provider: e
54
54
  }),
55
- bearer: (e) => ({
55
+ bearer: (e, t) => ({
56
56
  kind: "bearer",
57
- token: e
57
+ token: e,
58
+ ...t?.sessionCookie === void 0 ? {} : { sessionCookie: t.sessionCookie }
58
59
  }),
59
60
  unknown: () => ({ kind: "unknown" })
60
61
  };
61
- function ee(e) {
62
+ function p(e) {
62
63
  return e.authMode?.kind === "bearer" ? e.authMode.token : e.bearerToken;
63
64
  }
64
- function te(e) {
65
+ function ee(e) {
65
66
  return e.authMode?.kind === "oauth" ? e.authMode.provider : e.autoOAuthProvider;
66
67
  }
67
- function ne(e) {
68
+ function te(e) {
68
69
  return e.authMode?.kind === "saml" ? e.authMode.provider : e.autoSAMLProvider;
69
70
  }
70
- function re(e) {
71
+ function ne(e) {
71
72
  switch (e?.kind) {
72
73
  case "sso":
73
74
  case "oauth":
@@ -76,23 +77,23 @@ function re(e) {
76
77
  default: return !1;
77
78
  }
78
79
  }
79
- function ie(e, t) {
80
+ function re(e, t) {
80
81
  let { useCredentials: n, useSSO: r, useSAML: i } = e;
81
82
  return i && t.autoSAMLProvider ? f.saml(t.autoSAMLProvider) : n && r ? f.unknown() : n ? f.credentials() : r ? f.sso() : t.authMode ?? f.unknown();
82
83
  }
83
84
  //#endregion
84
85
  //#region src/configurations/global.config.ts
85
- var p = {
86
+ var m = {
86
87
  loginPath: "/login",
87
88
  createRoutes: !1,
88
89
  authMode: f.unknown()
89
90
  };
90
- Object.defineProperties(p, {
91
+ Object.defineProperties(m, {
91
92
  useCredentials: {
92
93
  enumerable: !1,
93
94
  configurable: !0,
94
95
  get() {
95
- let e = p.authMode?.kind;
96
+ let e = m.authMode?.kind;
96
97
  return e === "credentials" || e === "unknown";
97
98
  }
98
99
  },
@@ -100,7 +101,7 @@ Object.defineProperties(p, {
100
101
  enumerable: !1,
101
102
  configurable: !0,
102
103
  get() {
103
- let e = p.authMode?.kind;
104
+ let e = m.authMode?.kind;
104
105
  return e === "sso" || e === "unknown";
105
106
  }
106
107
  },
@@ -108,20 +109,20 @@ Object.defineProperties(p, {
108
109
  enumerable: !1,
109
110
  configurable: !0,
110
111
  get() {
111
- return p.authMode?.kind === "saml";
112
+ return m.authMode?.kind === "saml";
112
113
  }
113
114
  }
114
115
  });
115
- function ae(e) {
116
- oe(p, e);
116
+ function ie(e) {
117
+ ae(m, e);
117
118
  }
118
- function oe(e, t) {
119
+ function ae(e, t) {
119
120
  let { useCredentials: n, useSSO: r, useSAML: i, authMode: a, ...o } = t;
120
121
  if (Object.assign(e, o), a !== void 0) {
121
122
  e.authMode = a;
122
123
  return;
123
124
  }
124
- (n !== void 0 || r !== void 0 || i !== void 0) && (e.authMode = ie({
125
+ (n !== void 0 || r !== void 0 || i !== void 0) && (e.authMode = re({
125
126
  useCredentials: n,
126
127
  useSSO: r,
127
128
  useSAML: i
@@ -129,7 +130,7 @@ function oe(e, t) {
129
130
  }
130
131
  //#endregion
131
132
  //#region src/configurations/auth-options.ts
132
- var se = {
133
+ var oe = {
133
134
  get debug() {
134
135
  return o;
135
136
  },
@@ -145,7 +146,7 @@ var se = {
145
146
  };
146
147
  //#endregion
147
148
  //#region src/polyfills/storage.ts
148
- function ce() {
149
+ function se() {
149
150
  let e = {};
150
151
  return {
151
152
  getItem: (t) => e[t] ?? null,
@@ -157,20 +158,20 @@ function ce() {
157
158
  }
158
159
  };
159
160
  }
160
- var le = {
161
- session: ce(),
162
- local: ce()
161
+ var ce = {
162
+ session: se(),
163
+ local: se()
163
164
  };
164
- function ue(e, t) {
165
+ function le(e, t) {
165
166
  if (t) return t;
166
- let n = (typeof window > "u" ? void 0 : e === "session" ? window.sessionStorage : window.localStorage) ?? le[e];
167
+ let n = (typeof window > "u" ? void 0 : e === "session" ? window.sessionStorage : window.localStorage) ?? ce[e];
167
168
  return {
168
169
  get: (e) => n.getItem(e),
169
170
  set: (e, t) => n.setItem(e, t),
170
171
  remove: (e) => n.removeItem(e)
171
172
  };
172
173
  }
173
- var m = new class {
174
+ var ue = new class {
174
175
  client = null;
175
176
  initialize(e) {
176
177
  this.client = e;
@@ -187,7 +188,7 @@ var m = new class {
187
188
  }
188
189
  }();
189
190
  function de(e) {
190
- m.initialize(e);
191
+ ue.initialize(e);
191
192
  }
192
193
  //#endregion
193
194
  //#region src/client/http-adapter.ts
@@ -213,10 +214,10 @@ function fe(e) {
213
214
  //#endregion
214
215
  //#region src/client/atomic-context.ts
215
216
  function pe() {
216
- return m.isInitialized() ? fe(m.getClient()) : void 0;
217
+ return ue.isInitialized() ? fe(ue.getClient()) : void 0;
217
218
  }
218
219
  var h = {
219
- config: p,
220
+ config: m,
220
221
  events: t,
221
222
  storagePrefix: "",
222
223
  resolveHttpAdapter: pe
@@ -231,7 +232,7 @@ function me(t) {
231
232
  };
232
233
  }
233
234
  function g(e) {
234
- return e.config.auth?.logger ?? se;
235
+ return e.config.auth?.logger ?? oe;
235
236
  }
236
237
  function he(e) {
237
238
  return e.config.auth?.fetch ?? ((e, t) => fetch(e, t));
@@ -240,13 +241,13 @@ function ge(e) {
240
241
  return e.config.auth?.credentials ?? "include";
241
242
  }
242
243
  function _(e, t) {
243
- return ue(t, e.config.auth?.storage?.[t]);
244
+ return le(t, e.config.auth?.storage?.[t]);
244
245
  }
245
246
  function v(e, t) {
246
247
  return `${e.storagePrefix}${t}`;
247
248
  }
248
249
  function y(e, t) {
249
- oe(e.config, t);
250
+ ae(e.config, t);
250
251
  }
251
252
  //#endregion
252
253
  //#region src/authentication/events/emit-authenticated-event.ts
@@ -282,7 +283,7 @@ var x = (e) => e.config.auth?.timeoutMs ?? 1e4, S = {
282
283
  function T(e, t) {
283
284
  let n = w(e), r = new Headers(t);
284
285
  r.append("Sinequa-Force-Camel-Case", "true"), r.append("accept", "application/json"), n && r.append("Sinequa-csrf-token", n);
285
- let { userOverride: i, userOverrideActive: a } = e.config, o = ee(e.config);
286
+ let { userOverride: i, userOverrideActive: a } = e.config, o = p(e.config);
286
287
  return o && !e.resolveHttpAdapter() && r.append("Authorization", `Bearer ${o}`), i && a && (r.append("sinequa-override-user", i.username), r.append("sinequa-override-domain", i.domain)), r;
287
288
  }
288
289
  function ye(e) {
@@ -500,14 +501,14 @@ async function je(e, { kind: t, provider: n }) {
500
501
  //#endregion
501
502
  //#region src/authentication/providers/oauth-authentication.ts
502
503
  var Me = async (e) => {
503
- let t = te(e.config);
504
+ let t = ee(e.config);
504
505
  if (!t) throw Error("No OAuth provider configured: set `authMode: AuthMode.oauth(provider)`, or the `autoOAuthProvider` key.");
505
506
  return je(e, {
506
507
  kind: "oauth",
507
508
  provider: t
508
509
  });
509
510
  }, Ne = () => Me(h), Pe = async (e) => {
510
- let t = ne(e.config);
511
+ let t = te(e.config);
511
512
  if (!t) throw Error("No SAML provider configured: set `authMode: AuthMode.saml(provider)`, or the `autoSAMLProvider` key.");
512
513
  return je(e, {
513
514
  kind: "saml",
@@ -579,7 +580,7 @@ function Ue(e) {
579
580
  }
580
581
  //#endregion
581
582
  //#region src/authentication/tokens/get-jwt-token.ts
582
- async function We(e, t) {
583
+ async function We(e, t, n) {
583
584
  if (t) {
584
585
  let { username: n, password: r } = t;
585
586
  return qe(e, {
@@ -589,17 +590,17 @@ async function We(e, t) {
589
590
  password: r
590
591
  }, !0, "Failed to get JWT");
591
592
  }
592
- if (!ee(e.config)) throw Error("A bearer token is required for credential-less authentication: set `authMode: AuthMode.bearer(token)`, or the legacy `bearerToken` key.");
593
+ if (!p(e.config)) throw Error("A bearer token is required for credential-less authentication: set `authMode: AuthMode.bearer(token)`, or the legacy `bearerToken` key.");
593
594
  return qe(e, {
594
595
  action: "get",
595
596
  tokenInCookie: !0
596
- }, !1, "Failed to get JWT without credentials");
597
+ }, !1, "Failed to get JWT without credentials", n?.recoverable);
597
598
  }
598
599
  async function Ge(e) {
599
600
  return We(h, e);
600
601
  }
601
602
  var Ke = Ge;
602
- async function qe(e, t, n, r) {
603
+ async function qe(e, t, n, r, i = !1) {
603
604
  try {
604
605
  let { signal: r } = F(x(e)), i = await P(e, "api/v1/security.webtoken", t, {
605
606
  signal: r,
@@ -608,7 +609,7 @@ async function qe(e, t, n, r) {
608
609
  });
609
610
  return i?.csrfToken ? (k(e, i.csrfToken), i.csrfToken) : null;
610
611
  } catch (t) {
611
- throw g(e).error(r, t), t;
612
+ throw g(e)[i ? "debug" : "error"](r, t), t;
612
613
  }
613
614
  }
614
615
  //#endregion
@@ -635,9 +636,9 @@ var Je = (e) => ({
635
636
  signal: t,
636
637
  redirect: "manual",
637
638
  noRecovery: !0
638
- }), g(e).info("Server auto-authenticated the user (OIDC)"), !0;
639
+ }), g(e).info("Protected endpoint accepted the request"), !0;
639
640
  } catch (t) {
640
- return g(e).debug("Auto-authentication probe failed — not auto-authenticated", t), !1;
641
+ return g(e).debug("Protected-endpoint probe failed — not authenticated", t), !1;
641
642
  }
642
643
  }, nt = () => tt(h), rt = (e) => e.resolveHttpAdapter() ? f.sso() : Xe(e) ? f.credentials() : f.sso(), it = (e, t) => {
643
644
  if (_(e, "session").remove(v(e, C)), t.kind === "unknown") {
@@ -654,7 +655,7 @@ var Je = (e) => ({
654
655
  });
655
656
  }
656
657
  let n = e.config.authMode ?? f.unknown();
657
- if (n.kind === "bearer") return lt(e);
658
+ if (n.kind === "bearer") return lt(e, n);
658
659
  if (await Be(e)) return g(e).info("User already authenticated (existing session)"), it(e, n);
659
660
  switch (n.kind) {
660
661
  case "credentials": return b(e, !1), !1;
@@ -689,13 +690,15 @@ async function ct(e, t) {
689
690
  }
690
691
  return b(e, !0), !0;
691
692
  }
692
- async function lt(e) {
693
- try {
694
- if (g(e).info("Attempting authentication using bearer token"), await We(e)) return b(e, !0), !0;
693
+ async function lt(e, t) {
694
+ if (g(e).info("Attempting authentication using bearer token"), !p(e.config)) throw b(e, !1), Error("Bearer mode requires a token: set `authMode: AuthMode.bearer(token)`, or the legacy `bearerToken` key.");
695
+ if (t.sessionCookie !== !1) try {
696
+ if (await We(e, void 0, { recoverable: !0 })) return g(e).info("Bearer token exchanged for a server session"), b(e, !0), !0;
695
697
  } catch (t) {
696
- throw g(e).error("Bearer authentication failed", t), b(e, !1), t;
698
+ g(e).info("The server refused to exchange the bearer token for a session — continuing with the token alone. Requests this library issues stay authenticated, but what the browser loads by itself (document previews and their sub-resources, thumbnails, /xdownload links) cannot be. Allow the `webtoken` JSON method for this access token to get a session cookie, or set `AuthMode.bearer(token, { sessionCookie: false })` to stop asking.", t);
697
699
  }
698
- return b(e, !1), !1;
700
+ if (!await tt(e)) throw b(e, !1), Error("The server refused the configured bearer token: it may be expired or revoked, or its JSON method rules may not allow the probe endpoint (see `auth.probeEndpoint`).");
701
+ return Qe(e, !0), b(e, !0), !0;
699
702
  }
700
703
  //#endregion
701
704
  //#region src/authentication/tokens/delete-web-token-cookie.ts
@@ -1489,7 +1492,7 @@ async function jn(e, t, n, r = h) {
1489
1492
  queryIntentData: n
1490
1493
  });
1491
1494
  i.aggregations.forEach((e) => {
1492
- e.$hasMore = !1, !e.isDistribution && !e.isTree && e.items && (e.$hasMore = e.items.length === An), e.isTree && e.items && J(e);
1495
+ e.$hasMore = !1, !e.isDistribution && !e.isTree && e.items && (e.$hasMore = e.items.length === An), e.isTree && e.items && Nn(e);
1493
1496
  }), i.records?.map((e) => Object.assign(e, {
1494
1497
  value: e.title,
1495
1498
  type: "default"
@@ -1515,7 +1518,7 @@ async function Mn(e, t, n, r = h) {
1515
1518
  let o = await P(r, "api/v1/multi", a);
1516
1519
  o.results.forEach((e) => {
1517
1520
  e.aggregations.forEach((e) => {
1518
- e.$hasMore = !1, !e.isDistribution && !e.isTree && e.items && (e.$hasMore = e.items.length === An), e.isTree && J(e);
1521
+ e.$hasMore = !1, !e.isDistribution && !e.isTree && e.items && (e.$hasMore = e.items.length === An), e.isTree && Nn(e);
1519
1522
  });
1520
1523
  }), o.results.forEach((e) => {
1521
1524
  e.records?.map((e) => Object.assign(e, {
@@ -1529,19 +1532,19 @@ async function Mn(e, t, n, r = h) {
1529
1532
  }));
1530
1533
  return Promise.resolve(s);
1531
1534
  }
1532
- function J(e, t = "", n = 0) {
1535
+ function Nn(e, t = "", n = 0) {
1533
1536
  let r = [];
1534
1537
  return e.items && e.items.forEach((e) => {
1535
1538
  let i = t ? `${t}/${e.value}` : e.value, a = n + 1;
1536
1539
  r.push({
1537
1540
  path: i,
1538
1541
  level: a
1539
- }), e.$path = i, e.$level = a, e.hasChildren ? r = r.concat(J(e, i, a)) : e.hasChildren = !1;
1542
+ }), e.$path = i, e.$level = a, e.hasChildren ? r = r.concat(Nn(e, i, a)) : e.hasChildren = !1;
1540
1543
  }), r;
1541
1544
  }
1542
1545
  //#endregion
1543
1546
  //#region src/web-api/v1/fetch-query-export.ts
1544
- async function Nn({ model: e, appName: t, query: n, article: r }, i = h) {
1547
+ async function Pn({ model: e, appName: t, query: n, article: r }, i = h) {
1545
1548
  let { webservice: a, format: o, maxcount: s, exportedColumns: c, export: l } = e, u = {
1546
1549
  app: t,
1547
1550
  webservice: a,
@@ -1559,17 +1562,17 @@ async function Nn({ model: e, appName: t, query: n, article: r }, i = h) {
1559
1562
  }
1560
1563
  //#endregion
1561
1564
  //#region src/web-api/v1/fetch-query-intent.ts
1562
- async function Pn(e, t = h) {
1565
+ async function Fn(e, t = h) {
1563
1566
  return (await P(t, "api/v1/queryintent", { query: e }))?.intents;
1564
1567
  }
1565
1568
  //#endregion
1566
1569
  //#region src/web-api/v1/fetch-security-principal.ts
1567
- function Fn(e, t, n = h) {
1570
+ function In(e, t, n = h) {
1568
1571
  return P(n, "api/v1/security.principal", e, { signal: t });
1569
1572
  }
1570
1573
  //#endregion
1571
1574
  //#region src/web-api/v1/fetch-similar-documents.ts
1572
- async function In(e, t, n, r = h) {
1575
+ async function Ln(e, t, n, r = h) {
1573
1576
  return (await P(r, "api/v1/similardocuments", {
1574
1577
  sourceDocumentId: e,
1575
1578
  query: { name: t }
@@ -1577,7 +1580,7 @@ async function In(e, t, n, r = h) {
1577
1580
  }
1578
1581
  //#endregion
1579
1582
  //#region src/web-api/v1/fetch-sponsored-links.ts
1580
- async function Ln(e, t, n = h) {
1583
+ async function Rn(e, t, n = h) {
1581
1584
  return (await P(n, "api/v1/query.links", {
1582
1585
  webservice: e,
1583
1586
  query: t
@@ -1588,9 +1591,9 @@ async function Ln(e, t, n = h) {
1588
1591
  }
1589
1592
  //#endregion
1590
1593
  //#region src/utils/to-sql.ts
1591
- function Rn(e, t) {
1594
+ function zn(e, t) {
1592
1595
  if (typeof e == "number") return `${e}`;
1593
- if (qt(e)) return t ? `'${zn(e)}'` : zn(e);
1596
+ if (qt(e)) return t ? `'${Bn(e)}'` : Bn(e);
1594
1597
  if (typeof e == "boolean") return e ? "true" : "false";
1595
1598
  if (e === null) return "null";
1596
1599
  if (Array.isArray(e)) {
@@ -1601,7 +1604,7 @@ function Rn(e, t) {
1601
1604
  }
1602
1605
  return t ? `'${e}'` : e;
1603
1606
  }
1604
- function zn(e) {
1607
+ function Bn(e) {
1605
1608
  if (!e) return "";
1606
1609
  try {
1607
1610
  return Xt(e) === 0 ? new Intl.DateTimeFormat("en-CA", {
@@ -1620,7 +1623,7 @@ function zn(e) {
1620
1623
  }
1621
1624
  //#endregion
1622
1625
  //#region src/web-api/v1/fetch-suggest.ts
1623
- async function Bn(e, t, n, r, i, a = h) {
1626
+ async function Vn(e, t, n, r, i, a = h) {
1624
1627
  let { app: o } = a.config, s = {
1625
1628
  app: o || "",
1626
1629
  suggestQuery: e,
@@ -1635,7 +1638,7 @@ async function Bn(e, t, n, r, i, a = h) {
1635
1638
  throw console.error("Error fetching suggestions:", e), e;
1636
1639
  }
1637
1640
  }
1638
- async function Vn(e, t, n, r, i = h) {
1641
+ async function Hn(e, t, n, r, i = h) {
1639
1642
  let { app: a } = i.config;
1640
1643
  return (await P(i, "api/v1/suggestquery", {
1641
1644
  app: a || "",
@@ -1645,7 +1648,7 @@ async function Vn(e, t, n, r, i = h) {
1645
1648
  kinds: r
1646
1649
  })).suggests;
1647
1650
  }
1648
- async function Hn(e, t, n, r = h) {
1651
+ async function Un(e, t, n, r = h) {
1649
1652
  if (!t) return Promise.resolve([]);
1650
1653
  let { app: i } = r.config, a = await P(r, "api/v1/suggestfield", {
1651
1654
  app: i || "",
@@ -1654,12 +1657,12 @@ async function Hn(e, t, n, r = h) {
1654
1657
  query: n
1655
1658
  });
1656
1659
  return a.suggests.forEach((e) => {
1657
- e.display = Rn(e.display);
1660
+ e.display = zn(e.display);
1658
1661
  }), a.suggests;
1659
1662
  }
1660
1663
  //#endregion
1661
1664
  //#region src/web-api/v1/fetch-text-chunk.ts
1662
- async function Un(e, t, n, r, i, a, o = h) {
1665
+ async function Wn(e, t, n, r, i, a, o = h) {
1663
1666
  return P(o, "api/v1/doc.textchunks", {
1664
1667
  id: e,
1665
1668
  textChunks: t,
@@ -1671,14 +1674,14 @@ async function Un(e, t, n, r, i, a, o = h) {
1671
1674
  }
1672
1675
  //#endregion
1673
1676
  //#region src/web-api/v1/fetch-user-settings.ts
1674
- async function Wn(e = h) {
1677
+ async function Gn(e = h) {
1675
1678
  let { app: t } = e.config;
1676
1679
  return I(e, "api/v1/usersettings", new URLSearchParams({
1677
1680
  app: t || "",
1678
1681
  action: "load"
1679
1682
  }));
1680
1683
  }
1681
- async function Gn(e, t, n = h) {
1684
+ async function Kn(e, t, n = h) {
1682
1685
  let r = {
1683
1686
  action: "save",
1684
1687
  userSettings: e,
@@ -1686,7 +1689,7 @@ async function Gn(e, t, n = h) {
1686
1689
  };
1687
1690
  return K(r), P(n, "api/v1/usersettings", r);
1688
1691
  }
1689
- async function Kn(e, t, n = h) {
1692
+ async function qn(e, t, n = h) {
1690
1693
  let r = {
1691
1694
  action: "patch",
1692
1695
  userSettings: e,
@@ -1694,12 +1697,12 @@ async function Kn(e, t, n = h) {
1694
1697
  };
1695
1698
  return K(r), P(n, "api/v1/usersettings", r);
1696
1699
  }
1697
- async function qn(e = h) {
1698
- return Gn({}, { type: "UserSettings_Reset" }, e);
1700
+ async function Jn(e = h) {
1701
+ return Kn({}, { type: "UserSettings_Reset" }, e);
1699
1702
  }
1700
1703
  //#endregion
1701
1704
  //#region src/web-api/v2/fetch-change-password.ts
1702
- async function Jn(e, t, n = h) {
1705
+ async function Yn(e, t, n = h) {
1703
1706
  return P(n, "api/v2/security/password/change", {
1704
1707
  newPassword: e,
1705
1708
  currentPassword: t
@@ -1707,39 +1710,39 @@ async function Jn(e, t, n = h) {
1707
1710
  }
1708
1711
  //#endregion
1709
1712
  //#region src/web-api/v2/fetch-document-upload-container.ts
1710
- var Y = "api/v2/document-upload/container";
1711
- function Yn(e) {
1713
+ var J = "api/v2/document-upload/container";
1714
+ function Xn(e) {
1712
1715
  let t = new URLSearchParams();
1713
1716
  return e.page !== void 0 && t.set("page", String(e.page)), e.pageSize !== void 0 && t.set("pageSize", String(e.pageSize)), t;
1714
1717
  }
1715
- function Xn(e = {}, t = h) {
1716
- return I(t, Y, Yn(e));
1717
- }
1718
- function Zn(e, t = h) {
1719
- return I(t, `${Y}/${encodeURIComponent(e)}`);
1718
+ function Zn(e = {}, t = h) {
1719
+ return I(t, J, Xn(e));
1720
1720
  }
1721
1721
  function Qn(e, t = h) {
1722
- return P(t, Y, e);
1722
+ return I(t, `${J}/${encodeURIComponent(e)}`);
1723
+ }
1724
+ function $n(e, t = h) {
1725
+ return P(t, J, e);
1723
1726
  }
1724
- function $n(e, t, n = h) {
1725
- return z(n, `${Y}/${encodeURIComponent(e)}`, t);
1727
+ function er(e, t, n = h) {
1728
+ return z(n, `${J}/${encodeURIComponent(e)}`, t);
1726
1729
  }
1727
- async function er(e, t = h) {
1730
+ async function tr(e, t = h) {
1728
1731
  let n = (await L(t, "api/v2/document-upload/containers", void 0, { body: { containerIds: e } }))?.failed ?? [], r = new Set(n.map((e) => e.containerId));
1729
1732
  return {
1730
1733
  succeeded: e.filter((e) => !r.has(e)),
1731
1734
  failed: n
1732
1735
  };
1733
1736
  }
1734
- function tr(e, t = {}, n = h) {
1735
- return I(n, `${Y}/${encodeURIComponent(e)}/documents`, Yn(t));
1737
+ function nr(e, t = {}, n = h) {
1738
+ return I(n, `${J}/${encodeURIComponent(e)}/documents`, Xn(t));
1736
1739
  }
1737
- function nr(e, t, n = h) {
1738
- return L(n, `${Y}/${encodeURIComponent(e)}/documents`, void 0, { body: { fileIds: t } });
1740
+ function rr(e, t, n = h) {
1741
+ return L(n, `${J}/${encodeURIComponent(e)}/documents`, void 0, { body: { fileIds: t } });
1739
1742
  }
1740
1743
  //#endregion
1741
1744
  //#region src/web-api/v2/fetch-forgot-password.ts
1742
- async function rr(e, t = h) {
1745
+ async function ir(e, t = h) {
1743
1746
  return P(t, "api/v2/security/password/ask-reset-email", {
1744
1747
  changePasswordRedirectUrl: `${window.location.origin}/login?mode=changepassword`,
1745
1748
  userName: e
@@ -1747,106 +1750,106 @@ async function rr(e, t = h) {
1747
1750
  }
1748
1751
  //#endregion
1749
1752
  //#region src/web-api/v2/fetch-user-profile.ts
1750
- async function ir(e, t = h) {
1753
+ async function ar(e, t = h) {
1751
1754
  return await I(t, `api/v2/user-profile/${e}`);
1752
1755
  }
1753
- async function ar(e, t = h) {
1756
+ async function or(e, t = h) {
1754
1757
  return await P(t, "api/v2/user-profile", e);
1755
1758
  }
1756
- async function or(e, t, n, r = h) {
1759
+ async function sr(e, t, n, r = h) {
1757
1760
  return await R(r, `api/v2/user-profile/${e.data?.id}/${t}/${n}`, e);
1758
1761
  }
1759
- async function sr(e, t, n, r = h) {
1762
+ async function cr(e, t, n, r = h) {
1760
1763
  return (await L(r, `api/v2/user-profile/${e.data?.id}/${t}/${n}`)).success === !0;
1761
1764
  }
1762
1765
  //#endregion
1763
1766
  //#region src/web-api/v2/fetch-version.ts
1764
- async function cr(e = h) {
1767
+ async function lr(e = h) {
1765
1768
  return await I(e, "api/v2/version");
1766
1769
  }
1767
1770
  //#endregion
1768
1771
  //#region src/client/create-api.ts
1769
- var X = (e, t) => (...n) => {
1772
+ var Y = (e, t) => (...n) => {
1770
1773
  let r = Array(Math.max(0, e.length - n.length)).fill(void 0);
1771
1774
  return e(...n, ...r, t);
1772
1775
  };
1773
- function lr(e) {
1776
+ function ur(e) {
1774
1777
  return {
1775
1778
  app: {
1776
- get: X(Ct, e),
1777
- preLogin: X(wt, e)
1779
+ get: Y(Ct, e),
1780
+ preLogin: Y(wt, e)
1778
1781
  },
1779
1782
  principal: {
1780
- get: X(Tn, e),
1781
- list: X(En, e),
1782
- userid: X(Dn, e),
1783
- userids: X(On, e),
1784
- search: X(Fn, e)
1783
+ get: Y(Tn, e),
1784
+ list: Y(En, e),
1785
+ userid: Y(Dn, e),
1786
+ userids: Y(On, e),
1787
+ search: Y(In, e)
1785
1788
  },
1786
1789
  query: {
1787
- search: X(jn, e),
1788
- bulk: X(Mn, e),
1789
- intent: X(Pn, e),
1790
- export: X(Nn, e),
1791
- aggregate: X(dn, e),
1792
- sponsoredLinks: X(Ln, e),
1793
- similarDocuments: X(In, e)
1790
+ search: Y(jn, e),
1791
+ bulk: Y(Mn, e),
1792
+ intent: Y(Fn, e),
1793
+ export: Y(Pn, e),
1794
+ aggregate: Y(dn, e),
1795
+ sponsoredLinks: Y(Rn, e),
1796
+ similarDocuments: Y(Ln, e)
1794
1797
  },
1795
1798
  suggest: {
1796
- get: X(Bn, e),
1797
- query: X(Vn, e),
1798
- field: X(Hn, e)
1799
+ get: Y(Vn, e),
1800
+ query: Y(Hn, e),
1801
+ field: Y(Un, e)
1799
1802
  },
1800
1803
  preview: {
1801
- get: X(Cn, e),
1802
- textChunks: X(Un, e)
1804
+ get: Y(Cn, e),
1805
+ textChunks: Y(Wn, e)
1803
1806
  },
1804
1807
  labels: {
1805
- get: X(hn, e),
1806
- rights: X(q.getUserRights, e),
1807
- add: X(q.add, e),
1808
- remove: X(q.remove, e),
1809
- rename: X(q.rename, e),
1810
- delete: X(q.delete, e),
1811
- bulkAdd: X(q.bulkAdd, e),
1812
- bulkRemove: X(q.bulkRemove, e)
1808
+ get: Y(hn, e),
1809
+ rights: Y(q.getUserRights, e),
1810
+ add: Y(q.add, e),
1811
+ remove: Y(q.remove, e),
1812
+ rename: Y(q.rename, e),
1813
+ delete: Y(q.delete, e),
1814
+ bulkAdd: Y(q.bulkAdd, e),
1815
+ bulkRemove: Y(q.bulkRemove, e)
1813
1816
  },
1814
1817
  dataset: {
1815
- get: X(fn, e),
1816
- getMany: X(pn, e),
1817
- list: X(mn, e)
1818
+ get: Y(fn, e),
1819
+ getMany: Y(pn, e),
1820
+ list: Y(mn, e)
1818
1821
  },
1819
1822
  userSettings: {
1820
- get: X(Wn, e),
1821
- save: X(Gn, e),
1822
- patch: X(Kn, e),
1823
- reset: X(qn, e)
1823
+ get: Y(Gn, e),
1824
+ save: Y(Kn, e),
1825
+ patch: Y(qn, e),
1826
+ reset: Y(Jn, e)
1824
1827
  },
1825
1828
  userProfile: {
1826
- get: X(ir, e),
1827
- create: X(ar, e),
1828
- patch: X(or, e),
1829
- deleteProperty: X(sr, e)
1829
+ get: Y(ar, e),
1830
+ create: Y(or, e),
1831
+ patch: Y(sr, e),
1832
+ deleteProperty: Y(cr, e)
1830
1833
  },
1831
1834
  containers: {
1832
- list: X(Xn, e),
1833
- get: X(Zn, e),
1834
- create: X(Qn, e),
1835
- update: X($n, e),
1836
- delete: X(er, e),
1837
- listDocuments: X(tr, e),
1838
- deleteDocuments: X(nr, e)
1835
+ list: Y(Zn, e),
1836
+ get: Y(Qn, e),
1837
+ create: Y($n, e),
1838
+ update: Y(er, e),
1839
+ delete: Y(tr, e),
1840
+ listDocuments: Y(nr, e),
1841
+ deleteDocuments: Y(rr, e)
1839
1842
  },
1840
1843
  password: {
1841
- change: X(Jn, e),
1842
- sendResetEmail: X(rr, e)
1844
+ change: Y(Yn, e),
1845
+ sendResetEmail: Y(ir, e)
1843
1846
  },
1844
- version: X(cr, e)
1847
+ version: Y(lr, e)
1845
1848
  };
1846
1849
  }
1847
1850
  //#endregion
1848
1851
  //#region src/client/create-atomic-client.ts
1849
- function ur(e) {
1852
+ function dr(e) {
1850
1853
  return {
1851
1854
  config: e.config,
1852
1855
  storagePrefix: e.storagePrefix,
@@ -1870,29 +1873,29 @@ function ur(e) {
1870
1873
  patch: (t, n, r) => R(e, t, n, r),
1871
1874
  del: (t, n, r) => L(e, t, n, r)
1872
1875
  },
1873
- api: lr(e),
1876
+ api: ur(e),
1874
1877
  context: e
1875
1878
  };
1876
1879
  }
1877
- function dr(e) {
1880
+ function fr(e) {
1878
1881
  let { httpAdapter: t, storagePrefix: n, ...r } = e, i = me({
1879
1882
  config: {},
1880
1883
  storagePrefix: n,
1881
1884
  httpAdapter: t
1882
1885
  });
1883
- return y(i, r), ur(i);
1886
+ return y(i, r), dr(i);
1884
1887
  }
1885
- var fr = ur(h);
1886
- function pr() {
1887
- return fr;
1888
+ var pr = dr(h);
1889
+ function mr() {
1890
+ return pr;
1888
1891
  }
1889
1892
  //#endregion
1890
1893
  //#region src/utils/aggregations.ts
1891
- var mr = /.*:\(?([><=\d\-.AND ]+)\)?/;
1892
- function hr(e, t) {
1894
+ var hr = /.*:\(?([><=\d\-.AND ]+)\)?/;
1895
+ function gr(e, t) {
1893
1896
  return !e?.items || e?.items?.length === 0 ? [] : e.items.reduce((n, r) => {
1894
1897
  if (!r.value || r.value === "") return n;
1895
- let i = gr(r, e.column);
1898
+ let i = _r(r, e.column);
1896
1899
  return n.push({
1897
1900
  operator: i.operator,
1898
1901
  value: i.value,
@@ -1903,8 +1906,8 @@ function hr(e, t) {
1903
1906
  }), n;
1904
1907
  }, []);
1905
1908
  }
1906
- function gr(e, t) {
1907
- let n = t, r = e.value.match(mr);
1909
+ function _r(e, t) {
1910
+ let n = t, r = e.value.match(hr);
1908
1911
  if (r?.[1]) {
1909
1912
  let t = (r?.[1].split(" AND ")).map((t) => ({
1910
1913
  field: n,
@@ -1932,26 +1935,26 @@ function gr(e, t) {
1932
1935
  display: e.display
1933
1936
  };
1934
1937
  }
1935
- function _r(e, t, n) {
1938
+ function vr(e, t, n) {
1936
1939
  return e.valuesAreExpressions ? t.display === n.display : t.value === n.value;
1937
1940
  }
1938
- function vr(e) {
1939
- return e.items &&= e.items.map((e) => vr(e)), e.items?.some((e) => e.$selected || e.$opened) && (e.$opened = !0), e;
1941
+ function yr(e) {
1942
+ return e.items &&= e.items.map((e) => yr(e)), e.items?.some((e) => e.$selected || e.$opened) && (e.$opened = !0), e;
1940
1943
  }
1941
- function yr(e, t) {
1944
+ function br(e, t) {
1942
1945
  let n = [];
1943
1946
  if (e.length > 0) {
1944
1947
  let r = /* @__PURE__ */ new Map(), i = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").normalize("NFD").replace(/[\u0300-\u036f]/g, ""), a = RegExp(`\\b${i}`, "i");
1945
1948
  e.forEach((e) => {
1946
1949
  if (e.display.length > 1) {
1947
1950
  let i = e.display.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), o = a.exec(i);
1948
- br(n, r, "/", e.display, +(e.frequency || 0), 1, (o?.index || 0) + t.length);
1951
+ xr(n, r, "/", e.display, +(e.frequency || 0), 1, (o?.index || 0) + t.length);
1949
1952
  }
1950
1953
  });
1951
1954
  }
1952
1955
  return n;
1953
1956
  }
1954
- function br(e, t, n, r, i, a, o) {
1957
+ function xr(e, t, n, r, i, a, o) {
1955
1958
  let s = r.indexOf("/", n.length), c = r.substring(0, s + 1), l = t.get(c);
1956
1959
  if (!l) {
1957
1960
  let u = c.replace(/^\/|\/$/g, "");
@@ -1965,11 +1968,11 @@ function br(e, t, n, r, i, a, o) {
1965
1968
  $path: u
1966
1969
  }, t.set(c, l), e.push(l);
1967
1970
  }
1968
- c.length < r.length && (l.hasChildren = !0, br(l.items, t, c, r, i, a + 1, o));
1971
+ c.length < r.length && (l.hasChildren = !0, xr(l.items, t, c, r, i, a + 1, o));
1969
1972
  }
1970
1973
  //#endregion
1971
1974
  //#region src/utils/bisect.ts
1972
- function xr(e, t) {
1975
+ function Sr(e, t) {
1973
1976
  return e.reduce((e, n) => (t(n) ? e.true.push(n) : e.false.push(n), e), {
1974
1977
  true: [],
1975
1978
  false: []
@@ -1977,34 +1980,34 @@ function xr(e, t) {
1977
1980
  }
1978
1981
  //#endregion
1979
1982
  //#region src/utils/concepts.ts
1980
- var Sr = /(([+-])?\(([^)]+)\))|(([+-])?\[([^\]]+)\])|(([+-])?"([^"]+)")|(([+-])?\/([^/]+)\/)|(([+-])?(\S+))/g, Cr = 2, wr = 3, Tr = 5, Er = 6, Dr = 8, Or = 9, kr = 11, Ar = 12, jr = 14, Mr = 15;
1981
- function Z(e) {
1983
+ var Cr = /(([+-])?\(([^)]+)\))|(([+-])?\[([^\]]+)\])|(([+-])?"([^"]+)")|(([+-])?\/([^/]+)\/)|(([+-])?(\S+))/g, wr = 2, Tr = 3, Er = 5, Dr = 6, Or = 8, kr = 9, Ar = 11, jr = 12, Mr = 14, Nr = 15;
1984
+ function X(e) {
1982
1985
  if (!e) return [];
1983
- let t = [], n = e.matchAll(Sr);
1984
- for (let e of n) e[wr] ? t.push({
1986
+ let t = [], n = e.matchAll(Cr);
1987
+ for (let e of n) e[Tr] ? t.push({
1985
1988
  type: "group",
1986
- value: e[wr],
1987
- op: e[Cr]
1988
- }) : e[Er] ? t.push({
1989
+ value: e[Tr],
1990
+ op: e[wr]
1991
+ }) : e[Dr] ? t.push({
1989
1992
  type: "adjacent",
1990
- value: e[Er],
1991
- op: e[Tr]
1992
- }) : e[Or] ? t.push({
1993
+ value: e[Dr],
1994
+ op: e[Er]
1995
+ }) : e[kr] ? t.push({
1993
1996
  type: "exact",
1994
- value: e[Or],
1995
- op: e[Dr]
1996
- }) : e[Ar] ? t.push({
1997
+ value: e[kr],
1998
+ op: e[Or]
1999
+ }) : e[jr] ? t.push({
1997
2000
  type: "regex",
1998
- value: e[Ar],
1999
- op: e[kr]
2000
- }) : e[Mr] && t.push({
2001
+ value: e[jr],
2002
+ op: e[Ar]
2003
+ }) : e[Nr] && t.push({
2001
2004
  type: "token",
2002
- value: e[Mr],
2003
- op: e[jr]
2005
+ value: e[Nr],
2006
+ op: e[Mr]
2004
2007
  });
2005
2008
  return t;
2006
2009
  }
2007
- function Q(e) {
2010
+ function Z(e) {
2008
2011
  return e.map((e) => {
2009
2012
  let t = e.op || "";
2010
2013
  switch (e.type) {
@@ -2017,32 +2020,32 @@ function Q(e) {
2017
2020
  }
2018
2021
  }).join(" ");
2019
2022
  }
2020
- function Nr(e, t, n) {
2021
- let r = Z(e);
2023
+ function Pr(e, t, n) {
2024
+ let r = X(e);
2022
2025
  for (let e of t) r.push({
2023
2026
  type: "adjacent",
2024
2027
  value: e,
2025
2028
  op: n
2026
2029
  });
2027
- return Q(r);
2028
- }
2029
- function Pr(e, t) {
2030
- let n = Z(t), r = n.findIndex((t) => t.value === e);
2031
- return r === -1 ? t : (n.splice(r, 1), Q(n));
2030
+ return Z(r);
2032
2031
  }
2033
- function Fr(e) {
2034
- return Q(Z(e).filter((e) => e.type !== "adjacent"));
2032
+ function Fr(e, t) {
2033
+ let n = X(t), r = n.findIndex((t) => t.value === e);
2034
+ return r === -1 ? t : (n.splice(r, 1), Z(n));
2035
2035
  }
2036
2036
  function Ir(e) {
2037
- return Z(e).filter((e) => e.type === "adjacent").map((e) => e.value);
2037
+ return Z(X(e).filter((e) => e.type !== "adjacent"));
2038
+ }
2039
+ function Lr(e) {
2040
+ return X(e).filter((e) => e.type === "adjacent").map((e) => e.value);
2038
2041
  }
2039
2042
  //#endregion
2040
2043
  //#region src/utils/date.ts
2041
- function Lr(e, t, n) {
2042
- let r = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset: i, unit: a, isFuture: o } = Rr(t, n);
2044
+ function Rr(e, t, n) {
2045
+ let r = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset: i, unit: a, isFuture: o } = zr(t, n);
2043
2046
  return r.format(i * (o ? 1 : -1), a);
2044
2047
  }
2045
- function Rr(e, t) {
2048
+ function zr(e, t) {
2046
2049
  let n = new Date(e), r = t ? new Date(t) : /* @__PURE__ */ new Date(), i = Math.abs(r.getTime() - n.getTime());
2047
2050
  return {
2048
2051
  offset: Math.floor(i / (1e3 * 60 * 60 * 24)),
@@ -2052,13 +2055,13 @@ function Rr(e, t) {
2052
2055
  }
2053
2056
  //#endregion
2054
2057
  //#region src/utils/is-not-input-event.ts
2055
- function zr(e) {
2058
+ function Br(e) {
2056
2059
  let t = e.target;
2057
2060
  return t && t.nodeName !== "INPUT" && t.nodeName !== "TEXTAREA";
2058
2061
  }
2059
2062
  //#endregion
2060
2063
  //#region src/utils/notification.ts
2061
- function Br(e) {
2064
+ function Q(e) {
2062
2065
  let t = new CustomEvent("notification", {
2063
2066
  bubbles: !0,
2064
2067
  cancelable: !1,
@@ -2068,28 +2071,28 @@ function Br(e) {
2068
2071
  }
2069
2072
  var Vr = {
2070
2073
  success: (e, t) => {
2071
- Br({
2074
+ Q({
2072
2075
  type: "success",
2073
2076
  message: e,
2074
2077
  options: t
2075
2078
  });
2076
2079
  },
2077
2080
  info: (e, t) => {
2078
- Br({
2081
+ Q({
2079
2082
  type: "info",
2080
2083
  message: e,
2081
2084
  options: t
2082
2085
  });
2083
2086
  },
2084
2087
  warning: (e, t) => {
2085
- Br({
2088
+ Q({
2086
2089
  type: "warning",
2087
2090
  message: e,
2088
2091
  options: t
2089
2092
  });
2090
2093
  },
2091
2094
  error: (e, t) => {
2092
- Br({
2095
+ Q({
2093
2096
  type: "error",
2094
2097
  message: e,
2095
2098
  options: t
@@ -2195,4 +2198,4 @@ function Qr(e, t) {
2195
2198
  ].filter((e) => e !== void 0).join("/");
2196
2199
  }
2197
2200
  //#endregion
2198
- export { Ln as $, r as $n, Ct as $t, pr as A, j as An, Yt as At, Zn as B, _e as Bn, U as Bt, mr as C, Fe as Cn, on as Ct, yr as D, Oe as Dn, Gt as Dt, gr as E, ke as En, Zt as Et, or as F, O as Fn, Ht as Ft, qn as G, p as Gn, V as Gt, Xn as H, m as Hn, Nt as Ht, rr as I, D as In, Ut as It, Gn as J, re as Jn, At as Jt, Wn as K, ae as Kn, B as Kt, Qn as L, ye as Ln, W as Lt, ar as M, A as Mn, Jt as Mt, sr as N, xe as Nn, $t as Nt, hr as O, P as On, Kt as Ot, ir as P, be as Pn, Wt as Pt, Vn as Q, ne as Qn, Et as Qt, nr as R, T as Rn, Vt as Rt, xr as S, Ie as Sn, an as St, vr as T, F as Tn, Xt as Tt, $n as U, de as Un, Mt as Ut, tr as V, fe as Vn, Pt as Vt, Jn as W, oe as Wn, H as Wt, Bn as X, ee as Xn, Ot as Xt, Un as Y, ie as Yn, kt as Yt, Hn as Z, te as Zn, Dt as Zt, Ir as _, Ue as _n, mn as _t, qr as a, R as an, n as ar, Mn as at, Fr as b, Le as bn, un as bt, Yr as c, yt as cn, Tn as ct, $ as d, pt as dn, On as dt, wt as en, d as er, In as et, Vr as f, dt as fn, Cn as ft, Nr as g, Ge as gn, fn as gt, Lr as h, Ke as hn, q as ht, Wr as i, xt as in, c as ir, J as it, cr as j, Se as jn, G as jt, dr as k, we as kn, qt as kt, Kr as l, _t as ln, En as lt, Rr as m, nt as mn, hn as mt, Xr as n, St as nn, l as nr, Pn as nt, Jr as o, bt as on, jn as ot, zr as p, st as pn, wn as pt, Kn as q, f as qn, jt as qt, Gr as r, z as rn, s as rr, Nn as rt, Hr as s, L as sn, kn as st, Qr as t, Tt as tn, o as tr, Fn as tt, Ur as u, ht as un, Dn as ut, Z as v, He as vn, pn as vt, _r as w, Ne as wn, Qt as wt, Q as x, I as xn, K as xt, Pr as y, ze as yn, dn as yt, er as z, ve as zn, Rt as zt };
2201
+ export { Rn as $, r as $n, Ct as $t, mr as A, j as An, Yt as At, Qn as B, _e as Bn, U as Bt, hr as C, Fe as Cn, on as Ct, br as D, Oe as Dn, Gt as Dt, _r as E, ke as En, Zt as Et, sr as F, O as Fn, Ht as Ft, Jn as G, m as Gn, V as Gt, Zn as H, ue as Hn, Nt as Ht, ir as I, D as In, Ut as It, Kn as J, ne as Jn, At as Jt, Gn as K, ie as Kn, B as Kt, $n as L, ye as Ln, W as Lt, or as M, A as Mn, Jt as Mt, cr as N, xe as Nn, $t as Nt, gr as O, P as On, Kt as Ot, ar as P, be as Pn, Wt as Pt, Hn as Q, te as Qn, Et as Qt, rr as R, T as Rn, Vt as Rt, Sr as S, Ie as Sn, an as St, yr as T, F as Tn, Xt as Tt, er as U, de as Un, Mt as Ut, nr as V, fe as Vn, Pt as Vt, Yn as W, ae as Wn, H as Wt, Vn as X, p as Xn, Ot as Xt, Wn as Y, re as Yn, kt as Yt, Un as Z, ee as Zn, Dt as Zt, Lr as _, Ue as _n, mn as _t, qr as a, R as an, n as ar, Mn as at, Ir as b, Le as bn, un as bt, Yr as c, yt as cn, Tn as ct, $ as d, pt as dn, On as dt, wt as en, d as er, Ln as et, Vr as f, dt as fn, Cn as ft, Pr as g, Ge as gn, fn as gt, Rr as h, Ke as hn, q as ht, Wr as i, xt as in, c as ir, Nn as it, lr as j, Se as jn, G as jt, fr as k, we as kn, qt as kt, Kr as l, _t as ln, En as lt, zr as m, nt as mn, hn as mt, Xr as n, St as nn, l as nr, Fn as nt, Jr as o, bt as on, jn as ot, Br as p, st as pn, wn as pt, qn as q, f as qn, jt as qt, Gr as r, z as rn, s as rr, Pn as rt, Hr as s, L as sn, kn as st, Qr as t, Tt as tn, o as tr, In as tt, Ur as u, ht as un, Dn as ut, X as v, He as vn, pn as vt, vr as w, Ne as wn, Qt as wt, Z as x, I as xn, K as xt, Fr as y, ze as yn, dn as yt, tr as z, ve as zn, Rt as zt };