gentiq 0.7.21 → 0.7.23

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.
@@ -1,18 +1,18 @@
1
1
  import { jsx as e, jsxs as n, Fragment as Ne } from "react/jsx-runtime";
2
2
  import * as Z from "react";
3
- import { useState as C, useMemo as j, useEffect as $, useRef as ee, useCallback as J, useLayoutEffect as Ge } from "react";
4
- import { QueryClient as We, QueryClientProvider as Xe, useQueryClient as he, useQuery as Je, useInfiniteQuery as Ye } from "@tanstack/react-query";
5
- import { I18nextProvider as Ze, useTranslation as ie } from "react-i18next";
3
+ import { useState as C, useMemo as j, useEffect as $, useRef as ee, useCallback as J, useLayoutEffect as Ve } from "react";
4
+ import { QueryClient as We, QueryClientProvider as Xe, useQueryClient as pe, useQuery as Je, useInfiniteQuery as Ye } from "@tanstack/react-query";
5
+ import { I18nextProvider as Ze, useTranslation as le } from "react-i18next";
6
6
  import { Trans as Xa, Translation as Ja, useTranslation as Ya, withTranslation as Za } from "react-i18next";
7
- import { g as et, u as T, d as tt, C as ze, T as at, a as te, b as Re, j as fe, G as rt, c as oe, e as p, f as qe, h as Fe, i as Oe, k as je, B as Y, l as $e, m as me, D as Be, n as nt, o as Ue, L as Q, I as G, S as be, p as ve, q as xe, r as ye, s as ue, t as st, v as Se, w as ot, x as it, y as lt, z as ce, A as ct, E as dt, F as ut, H as mt, J as ht, K as pt } from "./checkbox-eHCIm0ql.js";
8
- import { M as tr, N as ar, P as rr, O as nr, R as sr, Q as or, U as ir, V as lr, W as cr, X as dr, Y as ur, Z as mr, _ as hr } from "./checkbox-eHCIm0ql.js";
7
+ import { g as et, u as T, d as tt, C as ze, T as at, a as te, b as Re, j as fe, G as rt, c as ie, e as p, f as qe, h as Fe, i as Oe, k as je, B as Y, l as $e, m as he, D as Be, n as nt, o as Ue, L as Q, I as V, S as be, p as ve, q as xe, r as ye, s as me, t as st, v as Se, w as ot, x as it, y as lt, z as de, A as ct, E as dt, F as ut, H as mt, J as ht, K as pt } from "./checkbox-iAFtpOFJ.js";
8
+ import { M as tr, N as ar, P as rr, O as nr, R as sr, Q as or, U as ir, V as lr, W as cr, X as dr, Y as ur, Z as mr, _ as hr } from "./checkbox-iAFtpOFJ.js";
9
9
  import { Loader2Icon as gt, OctagonXIcon as ft, TriangleAlertIcon as bt, InfoIcon as vt, CircleCheckIcon as xt, XIcon as yt, PanelLeftIcon as wt, Layers as Pe, User as Nt, ShieldCheck as kt, Settings as we, Smartphone as Ct, Lock as _t, Save as St, Sun as Pt, Moon as Mt, Monitor as Tt, Zap as Me, Globe as It, Coins as Dt, LogOut as Et, CirclePlus as Lt, Plus as At, Search as zt, Check as Rt, X as qt, Pin as Te, MoreVertical as Ft, PinOff as Ot, Share2 as jt, Pencil as $t, Trash as Bt } from "lucide-react";
10
10
  import { useTheme as Ut } from "next-themes";
11
11
  import { Toaster as Kt, toast as X } from "sonner";
12
12
  import { useChat as Ht } from "@ai-sdk/react";
13
13
  import { DefaultChatTransport as Qt } from "ai";
14
- import { useLocation as Ke, useNavigate as ke, Navigate as Vt, useParams as Gt } from "react-router-dom";
15
- import { nanoid as de } from "nanoid";
14
+ import { useLocation as Ke, useNavigate as ke, Navigate as Gt, useParams as Vt } from "react-router-dom";
15
+ import { nanoid as ue } from "nanoid";
16
16
  import { Slot as Wt } from "@radix-ui/react-slot";
17
17
  import { cva as Xt } from "class-variance-authority";
18
18
  import "@radix-ui/react-separator";
@@ -216,9 +216,9 @@ function Ce() {
216
216
  return [i, c];
217
217
  }
218
218
  function Zt({ onFinish: r } = {}) {
219
- const { t } = ie(["chat", "errors"]), o = he(), d = T.getConfig(), i = d.app?.cacheNamespace || "gentiq", [c, m] = Ce(), [g, u] = C(() => de()), w = ee(/* @__PURE__ */ new Set());
219
+ const { t } = le(["chat", "errors"]), o = pe(), d = T.getConfig(), i = d.app?.cacheNamespace || "gentiq", [c, m] = Ce(), [g, u] = C(() => ue()), w = ee(/* @__PURE__ */ new Set());
220
220
  $(() => {
221
- c === "/" ? u(de()) : g && c !== `/${g}` && u(de());
221
+ c === "/" ? u(ue()) : g && c !== `/${g}` && u(ue());
222
222
  }, [c]);
223
223
  const b = j(() => c === "/" ? g : c.replace(/^\//, ""), [c, g]), v = J((f) => (w.current.add(f), f), []), l = J(() => {
224
224
  w.current.forEach((f) => URL.revokeObjectURL(f)), w.current.clear();
@@ -236,7 +236,7 @@ function Zt({ onFinish: r } = {}) {
236
236
  const f = await T.getThreadMessages(b);
237
237
  return !f.items || !Array.isArray(f.items) ? [] : Promise.all(
238
238
  f.items.map(async (s) => {
239
- const x = typeof s.content == "string" ? s.content : s.content?.text || JSON.stringify(s.content), A = [...Array.isArray(s.parts) && s.parts.length > 0 ? s.parts : [{ type: "text", text: x }]].sort((N, R) => N.type === "file" && R.type !== "file" ? -1 : N.type !== "file" && R.type === "file" ? 1 : 0), V = await Promise.all(
239
+ const x = typeof s.content == "string" ? s.content : s.content?.text || JSON.stringify(s.content), A = [...Array.isArray(s.parts) && s.parts.length > 0 ? s.parts : [{ type: "text", text: x }]].sort((N, R) => N.type === "file" && R.type !== "file" ? -1 : N.type !== "file" && R.type === "file" ? 1 : 0), G = await Promise.all(
240
240
  A.map(async (N) => {
241
241
  if (N.type === "file" && N.object_name && !N.url)
242
242
  try {
@@ -249,9 +249,9 @@ function Zt({ onFinish: r } = {}) {
249
249
  })
250
250
  );
251
251
  return {
252
- id: s.id || de(),
252
+ id: s.id || ue(),
253
253
  role: s.role,
254
- parts: V,
254
+ parts: G,
255
255
  metadata: { feedback: s.feedback }
256
256
  };
257
257
  })
@@ -267,7 +267,7 @@ function Zt({ onFinish: r } = {}) {
267
267
  Object.entries(D).forEach(([R, W]) => {
268
268
  x.set(R, W);
269
269
  }), x.set("X-Thread-Id", b);
270
- const A = d.api?.basePath || "/api", V = typeof f == "string" && !f.startsWith("http") ? `${A}${f.startsWith("/") ? f : "/" + f}` : f, N = await fetch(V, { ...s, headers: x });
270
+ const A = d.api?.basePath || "/api", G = typeof f == "string" && !f.startsWith("http") ? `${A}${f.startsWith("/") ? f : "/" + f}` : f, N = await fetch(G, { ...s, headers: x });
271
271
  if (!N.ok) {
272
272
  const R = await N.json().catch(() => ({}));
273
273
  if (R.error && (R.error.code || R.error.message))
@@ -315,12 +315,12 @@ function Zt({ onFinish: r } = {}) {
315
315
  if (!(!D && (!s || s.length === 0)) && !(h === "loading-history" || h === "streaming" || h === "submitted")) {
316
316
  if (y.stop(), x) {
317
317
  m(`/${b}`);
318
- const A = D || t("attach_file"), V = A.length > 30 ? A.slice(0, 30) + "..." : A;
318
+ const A = D || t("attach_file"), G = A.length > 30 ? A.slice(0, 30) + "..." : A;
319
319
  o.setQueryData([i, "conversations"], (N) => {
320
- const R = { id: `/${b}`, firstMessage: V, timestamp: Date.now() };
320
+ const R = { id: `/${b}`, firstMessage: G, timestamp: Date.now() };
321
321
  return N && Array.isArray(N.pages) ? {
322
322
  ...N,
323
- pages: N.pages.map((W, le) => le === 0 ? {
323
+ pages: N.pages.map((W, ce) => ce === 0 ? {
324
324
  ...W,
325
325
  threads: [R, ...W.threads || []]
326
326
  } : W)
@@ -332,8 +332,8 @@ function Zt({ onFinish: r } = {}) {
332
332
  await y.sendMessage({ text: D, files: s });
333
333
  } catch (A) {
334
334
  console.error("Failed to send message:", A);
335
- const V = oe(A, t);
336
- I(new Error(V)), E("error");
335
+ const G = ie(A, t);
336
+ I(new Error(G)), E("error");
337
337
  }
338
338
  }
339
339
  }, [y, m, c, b, t, o, h, i]), U = J(() => {
@@ -341,7 +341,7 @@ function Zt({ onFinish: r } = {}) {
341
341
  }, [y.stop, o, i]), K = j(() => {
342
342
  if (z) return z;
343
343
  if (y.error) {
344
- const f = oe(y.error, t);
344
+ const f = ie(y.error, t);
345
345
  return new Error(f);
346
346
  }
347
347
  return null;
@@ -360,8 +360,8 @@ function Zt({ onFinish: r } = {}) {
360
360
  }), [y, L, U, H, K, h, q, c]);
361
361
  }
362
362
  function ea({ classNames: r = {}, disclaimer: t }) {
363
- const { t: o, i18n: d } = ie(["chat", "translation"]), i = Zt(), { messages: c, status: m, regenerate: g, error: u, clearError: w, stop: b, isLoadingHistory: v, conversationId: l, sendMessage: S } = i, { MessageList: _, PromptInput: q, disclaimer: O } = te(), P = t ?? O, y = d.exists("chat:disclaimer") ? o("chat:disclaimer") : null, h = typeof P == "string" ? o(P) : P ?? y, [E, z] = C(null), I = ee(m);
364
- Ge(() => {
363
+ const { t: o, i18n: d } = le(["chat", "translation"]), i = Zt(), { messages: c, status: m, regenerate: g, error: u, clearError: w, stop: b, isLoadingHistory: v, conversationId: l, sendMessage: S } = i, { MessageList: _, PromptInput: q, disclaimer: O } = te(), P = t ?? O, y = d.exists("chat:disclaimer") ? o("chat:disclaimer") : null, h = typeof P == "string" ? o(P) : P ?? y, [E, z] = C(null), I = ee(m);
364
+ Ve(() => {
365
365
  u && w();
366
366
  }, [l, w, u]);
367
367
  const H = c[c.length - 1], B = H?.role === "assistant" && (m === "ready" || H.parts.some((L) => L.type === "data-chat-finished"));
@@ -432,6 +432,9 @@ const ta = ({
432
432
  composer: i ?? u.composer,
433
433
  theme: c ?? u.theme,
434
434
  disclaimer: m ?? u.disclaimer,
435
+ app: u.app,
436
+ i18n: u.i18n,
437
+ settings: u.settings,
435
438
  children: /* @__PURE__ */ e(ea, { ...g })
436
439
  }
437
440
  );
@@ -805,17 +808,17 @@ function Le({
805
808
  ] })) : b;
806
809
  }
807
810
  function ka({ trigger: r }) {
808
- const { t, i18n: o } = ie(["settings", "translation"]), { app: d, settings: i } = te(), { theme: c, setTheme: m, accent: g, setAccent: u, radius: w, setRadius: b } = $e(), [v, l] = C(null), [S, _] = C(!1), q = ee(null), O = j(() => [
811
+ const { t, i18n: o } = le(["settings", "translation"]), { app: d, settings: i } = te(), { theme: c, setTheme: m, accent: g, setAccent: u, radius: w, setRadius: b } = $e(), [v, l] = C(null), [S, _] = C(!1), q = ee(null), O = j(() => [
809
812
  { id: "general", label: t("sections.general", "General"), icon: Pe },
810
813
  { id: "profile", label: t("sections.profile", "Profile"), icon: Nt },
811
814
  { id: "account", label: t("sections.account", "Account"), icon: kt }
812
815
  ].filter((k) => {
813
816
  const M = i?.sections?.[k.id];
814
817
  return (M?.mode ?? (M?.enabled === !1 ? "hidden" : "editable")) !== "hidden";
815
- }), [t, i]), [P, y] = C(O[0]?.id || "general"), h = J((a, k) => {
816
- const M = i?.sections?.[a]?.fields;
817
- return M && M[k] || "editable";
818
- }, [i]), [E, z] = C(""), [I, H] = C(""), [B, F] = C(""), [L, U] = C(""), K = j(() => d?.userMetadataFields?.filter((a) => a.showInProfile) || [], [d?.userMetadataFields]), [f, s] = C({}), [x, D] = C(!1), A = o.language === "fa", V = A ? "text-right" : "text-left", N = J(async () => {
818
+ }), [t, i]), [P, y] = C(O[0]?.id || "general"), h = J((a, k, M = "editable") => {
819
+ const se = i?.sections?.[a]?.fields;
820
+ return se && se[k] || M;
821
+ }, [i]), [E, z] = C(""), [I, H] = C(""), [B, F] = C(""), [L, U] = C(""), K = j(() => d?.userMetadataFields?.filter((a) => a.showInProfile) || [], [d?.userMetadataFields]), [f, s] = C({}), [x, D] = C(!1), A = o.language === "fa", G = A ? "text-right" : "text-left", N = J(async () => {
819
822
  try {
820
823
  const a = await T.getMe();
821
824
  l(a), z(a.name || ""), H(a.surname || ""), F(a.phone || "");
@@ -824,7 +827,7 @@ function ka({ trigger: r }) {
824
827
  k[M.key] = a.metadata?.[M.key] ?? M.defaultValue ?? "";
825
828
  }), s(k);
826
829
  } catch (a) {
827
- console.error("Failed to fetch user:", a), X.error(oe(a, t));
830
+ console.error("Failed to fetch user:", a), X.error(ie(a, t));
828
831
  }
829
832
  }, [t, K]);
830
833
  $(() => {
@@ -837,7 +840,7 @@ function ka({ trigger: r }) {
837
840
  const a = { ...f };
838
841
  let k = !1;
839
842
  K.forEach((M) => {
840
- M.condition && !me(M.condition, f) && a[M.key] !== void 0 && (delete a[M.key], k = !0);
843
+ M.condition && !he(M.condition, f) && a[M.key] !== void 0 && (delete a[M.key], k = !0);
841
844
  }), k && s(a);
842
845
  }, [f, K]);
843
846
  const R = async () => {
@@ -846,13 +849,13 @@ function ka({ trigger: r }) {
846
849
  const a = { name: E, surname: I, phone: B, metadata: f };
847
850
  L && (a.password = L), await T.updateMe(a), X.success(t("profile.success", "Profile updated successfully")), U(""), N();
848
851
  } catch (a) {
849
- X.error(oe(a, t));
852
+ X.error(ie(a, t));
850
853
  } finally {
851
854
  D(!1);
852
855
  }
853
856
  }, W = () => {
854
857
  window.confirm(t("account.logout_confirm", "Are you sure you want to logout?")) && (T.clearToken(), window.location.reload());
855
- }, le = (a) => {
858
+ }, ce = (a) => {
856
859
  o.changeLanguage(a);
857
860
  }, ae = v ? Math.max(0, Math.min(100, v.balance.tokens / (v.balance.token_limit || 1) * 100)) : 0, ne = v ? Math.max(0, Math.min(100, v.balance.requests / (v.balance.request_limit || 1) * 100)) : 0;
858
861
  return /* @__PURE__ */ n(Be, { open: S, onOpenChange: _, children: [
@@ -902,26 +905,26 @@ function ka({ trigger: r }) {
902
905
  h("profile", "name") !== "hidden" && /* @__PURE__ */ n("div", { className: p("flex flex-col gap-3", h("profile", "name") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
903
906
  /* @__PURE__ */ e(Q, { htmlFor: "name", className: "px-1", children: t("profile.name", "First Name") }),
904
907
  /* @__PURE__ */ e(
905
- G,
908
+ V,
906
909
  {
907
910
  id: "name",
908
911
  value: E,
909
912
  onChange: (a) => z(a.target.value),
910
913
  disabled: h("profile", "name") === "faded",
911
- className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", V)
914
+ className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", G)
912
915
  }
913
916
  )
914
917
  ] }),
915
918
  h("profile", "surname") !== "hidden" && /* @__PURE__ */ n("div", { className: p("flex flex-col gap-3", h("profile", "surname") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
916
919
  /* @__PURE__ */ e(Q, { htmlFor: "surname", className: "px-1", children: t("profile.surname", "Last Name") }),
917
920
  /* @__PURE__ */ e(
918
- G,
921
+ V,
919
922
  {
920
923
  id: "surname",
921
924
  value: I,
922
925
  onChange: (a) => H(a.target.value),
923
926
  disabled: h("profile", "surname") === "faded",
924
- className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", V)
927
+ className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", G)
925
928
  }
926
929
  )
927
930
  ] })
@@ -931,13 +934,13 @@ function ka({ trigger: r }) {
931
934
  /* @__PURE__ */ n("div", { className: "relative", children: [
932
935
  /* @__PURE__ */ e(Ct, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground start-3" }),
933
936
  /* @__PURE__ */ e(
934
- G,
937
+ V,
935
938
  {
936
939
  id: "phone",
937
940
  value: B,
938
941
  onChange: (a) => F(a.target.value),
939
942
  disabled: h("profile", "phone") === "faded",
940
- className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary ps-10 pe-3", V),
943
+ className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary ps-10 pe-3", G),
941
944
  dir: "ltr"
942
945
  }
943
946
  )
@@ -948,7 +951,7 @@ function ka({ trigger: r }) {
948
951
  /* @__PURE__ */ n("div", { className: "relative", children: [
949
952
  /* @__PURE__ */ e(_t, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground start-3" }),
950
953
  /* @__PURE__ */ e(
951
- G,
954
+ V,
952
955
  {
953
956
  id: "pass",
954
957
  type: "password",
@@ -956,15 +959,15 @@ function ka({ trigger: r }) {
956
959
  onChange: (a) => U(a.target.value),
957
960
  disabled: h("profile", "password") === "faded",
958
961
  placeholder: t("profile.password_placeholder", "Leave empty to keep current"),
959
- className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary ps-10 pe-3", V),
962
+ className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary ps-10 pe-3", G),
960
963
  dir: "ltr"
961
964
  }
962
965
  )
963
966
  ] })
964
967
  ] }),
965
968
  K.map((a) => {
966
- const k = a.mode || h("profile", a.key);
967
- return k === "hidden" || !me(a.condition, f) ? null : /* @__PURE__ */ n("div", { className: p("flex flex-col gap-3 animate-in fade-in slide-in-from-top-1 duration-200", k === "faded" && "opacity-50 pointer-events-none select-none"), children: [
969
+ const k = h("profile", a.key, a.mode || "editable");
970
+ return k === "hidden" || !he(a.condition, f) ? null : /* @__PURE__ */ n("div", { className: p("flex flex-col gap-3 animate-in fade-in slide-in-from-top-1 duration-200", k === "faded" && "opacity-50 pointer-events-none select-none"), children: [
968
971
  /* @__PURE__ */ e(Q, { htmlFor: `profile-${a.key}`, className: "px-1", children: t(a.label) }),
969
972
  a.type === "select" ? /* @__PURE__ */ n(
970
973
  be,
@@ -975,7 +978,7 @@ function ka({ trigger: r }) {
975
978
  dir: A ? "rtl" : "ltr",
976
979
  children: [
977
980
  /* @__PURE__ */ e(ve, { className: "bg-muted/30 border-border/50 rounded-xl focus:ring-primary h-11", children: /* @__PURE__ */ e(xe, { placeholder: t(a.placeholder || "profile.select_placeholder") }) }),
978
- /* @__PURE__ */ e(ye, { className: "rounded-xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: a.options?.map((M) => /* @__PURE__ */ e(ue, { value: String(M.value), className: "rounded-lg focus:bg-primary/10", children: t(M.label) }, String(M.value))) })
981
+ /* @__PURE__ */ e(ye, { className: "rounded-xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: a.options?.map((M) => /* @__PURE__ */ e(me, { value: String(M.value), className: "rounded-lg focus:bg-primary/10", children: t(M.label) }, String(M.value))) })
979
982
  ]
980
983
  }
981
984
  ) : a.type === "checkbox" ? /* @__PURE__ */ n("div", { className: "flex items-center gap-3 px-1 py-1", children: [
@@ -992,7 +995,7 @@ function ka({ trigger: r }) {
992
995
  ),
993
996
  /* @__PURE__ */ e(Q, { htmlFor: `profile-${a.key}`, className: "text-sm font-medium text-muted-foreground cursor-pointer", children: t(a.placeholder || a.label) })
994
997
  ] }) : /* @__PURE__ */ e(
995
- G,
998
+ V,
996
999
  {
997
1000
  id: `profile-${a.key}`,
998
1001
  type: a.type,
@@ -1000,7 +1003,7 @@ function ka({ trigger: r }) {
1000
1003
  disabled: k === "faded",
1001
1004
  onChange: (M) => s({ ...f, [a.key]: M.target.value }),
1002
1005
  placeholder: t(a.placeholder || ""),
1003
- className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", V)
1006
+ className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", G)
1004
1007
  }
1005
1008
  )
1006
1009
  ] }, a.key);
@@ -1151,17 +1154,17 @@ function ka({ trigger: r }) {
1151
1154
  be,
1152
1155
  {
1153
1156
  value: o.language,
1154
- onValueChange: le,
1157
+ onValueChange: ce,
1155
1158
  disabled: h("general", "language") === "faded",
1156
1159
  dir: A ? "rtl" : "ltr",
1157
1160
  children: [
1158
1161
  /* @__PURE__ */ e(ve, { className: "w-full bg-muted/50 rounded-2xl border-border/40 h-11 focus:ring-primary/20", children: /* @__PURE__ */ e(xe, { placeholder: t("general.language_placeholder", "Select language") }) }),
1159
1162
  /* @__PURE__ */ n(ye, { className: "rounded-2xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: [
1160
- /* @__PURE__ */ e(ue, { value: "en", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
1163
+ /* @__PURE__ */ e(me, { value: "en", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
1161
1164
  /* @__PURE__ */ e("span", { className: "text-xs font-bold text-muted-foreground mr-1", children: "EN" }),
1162
1165
  t("general.languages.en", "English")
1163
1166
  ] }) }),
1164
- /* @__PURE__ */ e(ue, { value: "fa", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
1167
+ /* @__PURE__ */ e(me, { value: "fa", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
1165
1168
  /* @__PURE__ */ e("span", { className: "text-xs font-bold text-muted-foreground mr-1", children: "FA" }),
1166
1169
  t("general.languages.fa", "Persian")
1167
1170
  ] }) })
@@ -1256,7 +1259,7 @@ function ka({ trigger: r }) {
1256
1259
  ] });
1257
1260
  }
1258
1261
  function Qe({ hideActions: r = !1 }) {
1259
- const [, t] = Ce(), { t: o } = ie(["sidebar", "chat"]), { history: d, app: i } = te(), { theme: c } = $e(), m = !r && (d?.enabled ?? !0), [g, u] = C("light");
1262
+ const [, t] = Ce(), { t: o } = le(["sidebar", "chat"]), { history: d, app: i } = te(), { theme: c } = $e(), m = !r && (d?.enabled ?? !0), [g, u] = C("light");
1260
1263
  $(() => {
1261
1264
  if (c === "system") {
1262
1265
  const v = window.matchMedia("(prefers-color-scheme: dark)").matches;
@@ -1342,13 +1345,13 @@ async function _a(r, t, o, d) {
1342
1345
  }
1343
1346
  }
1344
1347
  function Sa({ side: r = "left" }) {
1345
- const { t, i18n: o } = ie(["sidebar", "translation"]), {
1348
+ const { t, i18n: o } = le(["sidebar", "translation"]), {
1346
1349
  data: d,
1347
1350
  fetchNextPage: i,
1348
1351
  hasNextPage: c,
1349
1352
  isFetchingNextPage: m,
1350
1353
  isLoading: g
1351
- } = Ca(), { history: u, app: w } = te(), b = w?.basePath || "/", v = u?.enabled ?? !1, l = d?.pages.flatMap((a) => a.threads) ?? [], [S, _] = Ce(), q = he(), O = ee(null), P = J(
1354
+ } = Ca(), { history: u, app: w } = te(), b = w?.basePath || "/", v = u?.enabled ?? !1, l = d?.pages.flatMap((a) => a.threads) ?? [], [S, _] = Ce(), q = pe(), O = ee(null), P = J(
1352
1355
  (a) => {
1353
1356
  O.current && (O.current.disconnect(), O.current = null), a && c && !m && (O.current = new IntersectionObserver(
1354
1357
  (k) => {
@@ -1371,7 +1374,7 @@ function Sa({ side: r = "left" }) {
1371
1374
  } catch {
1372
1375
  X.error(t("pin_failed"));
1373
1376
  }
1374
- }, V = async (a) => {
1377
+ }, G = async (a) => {
1375
1378
  try {
1376
1379
  const k = await T.shareThread(a.id.replace(/^\//, "")), M = `${window.location.origin}${k.url}`;
1377
1380
  navigator.clipboard.writeText(M), X.success(t("share_success"), {
@@ -1391,7 +1394,7 @@ function Sa({ side: r = "left" }) {
1391
1394
  } catch {
1392
1395
  X.error(t("rename_failed"));
1393
1396
  }
1394
- }, le = (a) => {
1397
+ }, ce = (a) => {
1395
1398
  H(a), z(!0);
1396
1399
  }, ae = () => {
1397
1400
  I && (_a(I.id, q, _, S), z(!1), H(null), X.success(t("chat_deleted_success")));
@@ -1429,7 +1432,7 @@ function Sa({ side: r = "left" }) {
1429
1432
  v && /* @__PURE__ */ e(Ie, { className: "group-data-[collapsible=icon]:hidden mb-6 px-2", children: /* @__PURE__ */ n("div", { className: "relative group/search", children: [
1430
1433
  /* @__PURE__ */ e(zt, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 opacity-40 group-focus-within/search:opacity-70 transition-opacity" }),
1431
1434
  /* @__PURE__ */ e(
1432
- G,
1435
+ V,
1433
1436
  {
1434
1437
  placeholder: t("search_conversations"),
1435
1438
  value: B,
@@ -1441,16 +1444,16 @@ function Sa({ side: r = "left" }) {
1441
1444
  v && /* @__PURE__ */ n(Ie, { className: "group-data-[collapsible=icon]:hidden", children: [
1442
1445
  /* @__PURE__ */ n(De, { children: [
1443
1446
  D.map((a, k) => {
1444
- const M = L === a.id, pe = Se(a.firstMessage ?? ""), Ve = pe === "rtl";
1447
+ const M = L === a.id, se = Se(a.firstMessage ?? ""), Ge = se === "rtl";
1445
1448
  return /* @__PURE__ */ e(Ee, { className: "group/sidebar-menu-item relative", children: M ? /* @__PURE__ */ n("div", { className: "flex items-center gap-1 px-2 py-1.5 w-full", children: [
1446
1449
  /* @__PURE__ */ e(
1447
- G,
1450
+ V,
1448
1451
  {
1449
1452
  ref: s,
1450
1453
  value: K,
1451
- onChange: (se) => f(se.target.value),
1452
- onKeyDown: (se) => {
1453
- se.key === "Enter" && W(), se.key === "Escape" && R();
1454
+ onChange: (oe) => f(oe.target.value),
1455
+ onKeyDown: (oe) => {
1456
+ oe.key === "Enter" && W(), oe.key === "Escape" && R();
1454
1457
  },
1455
1458
  className: "h-8 py-0 px-2 text-sm",
1456
1459
  dir: Se(K)
@@ -1471,9 +1474,9 @@ function Sa({ side: r = "left" }) {
1471
1474
  "a",
1472
1475
  {
1473
1476
  href: fe(b, a.id),
1474
- onClick: (se) => x(se, a.id),
1475
- dir: pe,
1476
- className: p("flex flex-col gap-0.5 w-full overflow-hidden", Ve ? "items-end" : "items-start"),
1477
+ onClick: (oe) => x(oe, a.id),
1478
+ dir: se,
1479
+ className: p("flex flex-col gap-0.5 w-full overflow-hidden", Ge ? "items-end" : "items-start"),
1477
1480
  children: [
1478
1481
  /* @__PURE__ */ e("span", { className: p("truncate w-full font-medium text-[0.9375rem]", o.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"), children: a.firstMessage }),
1479
1482
  /* @__PURE__ */ e("div", { className: p("text-[10px] opacity-40 w-full", o.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"), children: ne(a.timestamp) })
@@ -1503,23 +1506,23 @@ function Sa({ side: r = "left" }) {
1503
1506
  align: "end",
1504
1507
  className: "min-w-[120px] p-1",
1505
1508
  children: [
1506
- u?.showPin !== !1 && /* @__PURE__ */ n(ce, { onSelect: () => A(a), className: "cursor-pointer flex items-center gap-2", children: [
1509
+ u?.showPin !== !1 && /* @__PURE__ */ n(de, { onSelect: () => A(a), className: "cursor-pointer flex items-center gap-2", children: [
1507
1510
  a.pinned ? /* @__PURE__ */ e(Ot, { className: "size-4" }) : /* @__PURE__ */ e(Te, { className: "size-4" }),
1508
1511
  /* @__PURE__ */ e("span", { children: a.pinned ? t("unpin_conversation") : t("pin_conversation") })
1509
1512
  ] }),
1510
- u?.showShare !== !1 && /* @__PURE__ */ n(ce, { onSelect: () => V(a), className: "cursor-pointer flex items-center gap-2", children: [
1513
+ u?.showShare !== !1 && /* @__PURE__ */ n(de, { onSelect: () => G(a), className: "cursor-pointer flex items-center gap-2", children: [
1511
1514
  /* @__PURE__ */ e(jt, { className: "size-4" }),
1512
1515
  /* @__PURE__ */ e("span", { children: t("share_conversation") })
1513
1516
  ] }),
1514
- (u?.showRename ?? !1) && /* @__PURE__ */ n(ce, { onSelect: () => N(a), className: "cursor-pointer flex items-center gap-2", children: [
1517
+ (u?.showRename ?? !1) && /* @__PURE__ */ n(de, { onSelect: () => N(a), className: "cursor-pointer flex items-center gap-2", children: [
1515
1518
  /* @__PURE__ */ e($t, { className: "size-4" }),
1516
1519
  /* @__PURE__ */ e("span", { children: t("rename_conversation") })
1517
1520
  ] }),
1518
1521
  (u?.showDelete ?? !1) && /* @__PURE__ */ n(
1519
- ce,
1522
+ de,
1520
1523
  {
1521
1524
  className: "text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer flex items-center gap-2",
1522
- onSelect: () => le(a),
1525
+ onSelect: () => ce(a),
1523
1526
  children: [
1524
1527
  /* @__PURE__ */ e(Bt, { className: "size-4" }),
1525
1528
  /* @__PURE__ */ e("span", { children: t("delete_conversation") })
@@ -1600,7 +1603,7 @@ function Ka({ sidebar: r, header: t, components: o, classNames: d, disclaimer: i
1600
1603
  ] });
1601
1604
  }
1602
1605
  function Ha({ children: r }) {
1603
- const [t, o] = C(null), d = Ke(), i = ke(), c = he();
1606
+ const [t, o] = C(null), d = Ke(), i = ke(), c = pe();
1604
1607
  return $(() => {
1605
1608
  (async () => {
1606
1609
  const g = new URLSearchParams(d.search), u = g.get("token");
@@ -1624,10 +1627,10 @@ function Ha({ children: r }) {
1624
1627
  console.error("Token validation failed:", b), b.status === 401 ? (T.clearToken(), c.clear(), o(!1)) : o(!0);
1625
1628
  }
1626
1629
  })();
1627
- }, [d.search, i, d.pathname, c]), t === null ? /* @__PURE__ */ e("div", { className: "flex h-screen w-full items-center justify-center", children: /* @__PURE__ */ e("div", { className: "size-8 rounded-full border-4 border-primary border-t-transparent animate-spin" }) }) : t ? /* @__PURE__ */ e(Ne, { children: r }) : /* @__PURE__ */ e(Vt, { to: "/login", replace: !0 });
1630
+ }, [d.search, i, d.pathname, c]), t === null ? /* @__PURE__ */ e("div", { className: "flex h-screen w-full items-center justify-center", children: /* @__PURE__ */ e("div", { className: "size-8 rounded-full border-4 border-primary border-t-transparent animate-spin" }) }) : t ? /* @__PURE__ */ e(Ne, { children: r }) : /* @__PURE__ */ e(Gt, { to: "/login", replace: !0 });
1628
1631
  }
1629
1632
  function Qa() {
1630
- const { t: r, i18n: t } = ie(["login", "translation"]), { app: o } = te(), d = t.dir() === "rtl", i = d ? "text-right" : "text-left", c = ke(), m = he(), [g, u] = C("login"), [w, b] = C(""), [v, l] = C(""), [S, _] = C(""), [q, O] = C(""), [P, y] = C(""), [h, E] = C(""), z = j(() => o?.userMetadataFields?.filter((s) => s.showInSignup) || [], [o?.userMetadataFields]), [I, H] = C(() => {
1633
+ const { t: r, i18n: t } = le(["login", "translation"]), { app: o } = te(), d = t.dir() === "rtl", i = d ? "text-right" : "text-left", c = ke(), m = pe(), [g, u] = C("login"), [w, b] = C(""), [v, l] = C(""), [S, _] = C(""), [q, O] = C(""), [P, y] = C(""), [h, E] = C(""), z = j(() => o?.userMetadataFields?.filter((s) => s.showInSignup) || [], [o?.userMetadataFields]), [I, H] = C(() => {
1631
1634
  const s = {};
1632
1635
  return z.forEach((x) => {
1633
1636
  x.defaultValue !== void 0 && (s[x.key] = x.defaultValue);
@@ -1637,7 +1640,7 @@ function Qa() {
1637
1640
  const s = { ...I };
1638
1641
  let x = !1;
1639
1642
  z.forEach((D) => {
1640
- D.condition && !me(D.condition, I) && s[D.key] !== void 0 && (delete s[D.key], x = !0);
1643
+ D.condition && !he(D.condition, I) && s[D.key] !== void 0 && (delete s[D.key], x = !0);
1641
1644
  }), x && H(s);
1642
1645
  }, [I, z]);
1643
1646
  const [B, F] = C(""), [L, U] = C(!1), K = async (s) => {
@@ -1645,7 +1648,7 @@ function Qa() {
1645
1648
  try {
1646
1649
  await T.login(w, v), m.clear(), c("/");
1647
1650
  } catch (x) {
1648
- F(oe(x, r));
1651
+ F(ie(x, r));
1649
1652
  } finally {
1650
1653
  U(!1);
1651
1654
  }
@@ -1654,7 +1657,7 @@ function Qa() {
1654
1657
  try {
1655
1658
  await T.register(S, q, P, h, I), m.clear(), c("/");
1656
1659
  } catch (x) {
1657
- F(oe(x, r));
1660
+ F(ie(x, r));
1658
1661
  } finally {
1659
1662
  U(!1);
1660
1663
  }
@@ -1689,7 +1692,7 @@ function Qa() {
1689
1692
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1690
1693
  /* @__PURE__ */ e(Q, { htmlFor: "login-phone", children: r("phone", "Phone") }),
1691
1694
  /* @__PURE__ */ e(
1692
- G,
1695
+ V,
1693
1696
  {
1694
1697
  id: "login-phone",
1695
1698
  type: "tel",
@@ -1705,7 +1708,7 @@ function Qa() {
1705
1708
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1706
1709
  /* @__PURE__ */ e(Q, { htmlFor: "login-pass", children: r("password", "Password") }),
1707
1710
  /* @__PURE__ */ e(
1708
- G,
1711
+ V,
1709
1712
  {
1710
1713
  id: "login-pass",
1711
1714
  type: "password",
@@ -1733,7 +1736,7 @@ function Qa() {
1733
1736
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1734
1737
  /* @__PURE__ */ e(Q, { htmlFor: "reg-phone", children: r("phone", "Phone") }),
1735
1738
  /* @__PURE__ */ e(
1736
- G,
1739
+ V,
1737
1740
  {
1738
1741
  id: "reg-phone",
1739
1742
  type: "tel",
@@ -1749,7 +1752,7 @@ function Qa() {
1749
1752
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1750
1753
  /* @__PURE__ */ e(Q, { htmlFor: "reg-pass", children: r("password", "Password") }),
1751
1754
  /* @__PURE__ */ e(
1752
- G,
1755
+ V,
1753
1756
  {
1754
1757
  id: "reg-pass",
1755
1758
  type: "password",
@@ -1766,7 +1769,7 @@ function Qa() {
1766
1769
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1767
1770
  /* @__PURE__ */ e(Q, { htmlFor: "reg-name", children: r("name", "Name") }),
1768
1771
  /* @__PURE__ */ e(
1769
- G,
1772
+ V,
1770
1773
  {
1771
1774
  id: "reg-name",
1772
1775
  type: "text",
@@ -1781,7 +1784,7 @@ function Qa() {
1781
1784
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1782
1785
  /* @__PURE__ */ e(Q, { htmlFor: "reg-surname", children: r("surname", "Surname") }),
1783
1786
  /* @__PURE__ */ e(
1784
- G,
1787
+ V,
1785
1788
  {
1786
1789
  id: "reg-surname",
1787
1790
  type: "text",
@@ -1794,7 +1797,7 @@ function Qa() {
1794
1797
  )
1795
1798
  ] })
1796
1799
  ] }),
1797
- z.map((s) => me(s.condition, I) ? /* @__PURE__ */ n("div", { className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200", children: [
1800
+ z.map((s) => he(s.condition, I) ? /* @__PURE__ */ n("div", { className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200", children: [
1798
1801
  /* @__PURE__ */ e(Q, { htmlFor: `signup-${s.key}`, children: r(s.label) }),
1799
1802
  s.type === "select" ? /* @__PURE__ */ n(
1800
1803
  be,
@@ -1805,7 +1808,7 @@ function Qa() {
1805
1808
  dir: d ? "rtl" : "ltr",
1806
1809
  children: [
1807
1810
  /* @__PURE__ */ e(ve, { className: p("bg-background", i), children: /* @__PURE__ */ e(xe, { placeholder: r(s.placeholder || "select_placeholder") }) }),
1808
- /* @__PURE__ */ e(ye, { className: "rounded-xl", children: s.options?.map((x) => /* @__PURE__ */ e(ue, { value: String(x.value), children: r(x.label) }, String(x.value))) })
1811
+ /* @__PURE__ */ e(ye, { className: "rounded-xl", children: s.options?.map((x) => /* @__PURE__ */ e(me, { value: String(x.value), children: r(x.label) }, String(x.value))) })
1809
1812
  ]
1810
1813
  }
1811
1814
  ) : s.type === "checkbox" ? /* @__PURE__ */ n("div", { className: "flex items-center gap-2 py-2", children: [
@@ -1820,7 +1823,7 @@ function Qa() {
1820
1823
  ),
1821
1824
  /* @__PURE__ */ e("label", { htmlFor: `signup-${s.key}`, className: "text-sm text-muted-foreground cursor-pointer select-none", children: r(s.placeholder || s.label) })
1822
1825
  ] }) : /* @__PURE__ */ e(
1823
- G,
1826
+ V,
1824
1827
  {
1825
1828
  id: `signup-${s.key}`,
1826
1829
  type: s.type,
@@ -1846,7 +1849,7 @@ function Qa() {
1846
1849
  ] }) });
1847
1850
  }
1848
1851
  function Pa() {
1849
- const { shareId: r } = Gt(), [t, o] = C(null), [d, i] = C(!0), [c, m] = C(null), { MessageList: g } = te(), u = ee(/* @__PURE__ */ new Set());
1852
+ const { shareId: r } = Vt(), [t, o] = C(null), [d, i] = C(!0), [c, m] = C(null), { MessageList: g } = te(), u = ee(/* @__PURE__ */ new Set());
1850
1853
  return $(() => () => {
1851
1854
  u.current.forEach((w) => URL.revokeObjectURL(w)), u.current.clear();
1852
1855
  }, []), $(() => {
@@ -1902,7 +1905,7 @@ function Pa() {
1902
1905
  ) })
1903
1906
  ] });
1904
1907
  }
1905
- function Va() {
1908
+ function Ga() {
1906
1909
  return /* @__PURE__ */ e(Pa, {});
1907
1910
  }
1908
1911
  export {
@@ -1919,7 +1922,7 @@ export {
1919
1922
  be as Select,
1920
1923
  ye as SelectContent,
1921
1924
  or as SelectGroup,
1922
- ue as SelectItem,
1925
+ me as SelectItem,
1923
1926
  ir as SelectLabel,
1924
1927
  lr as SelectScrollDownButton,
1925
1928
  cr as SelectScrollUpButton,
@@ -1927,7 +1930,7 @@ export {
1927
1930
  ve as SelectTrigger,
1928
1931
  xe as SelectValue,
1929
1932
  ka as SettingsDialog,
1930
- Va as SharedChatView,
1933
+ Ga as SharedChatView,
1931
1934
  fa as SidebarProvider,
1932
1935
  ur as TextPart,
1933
1936
  mr as ToolPart,
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "provenance": true
11
11
  },
12
12
  "description": "React UI library for the Gentiq AI framework.",
13
- "version": "0.7.21",
13
+ "version": "0.7.23",
14
14
  "type": "module",
15
15
  "files": [
16
16
  "dist"