@gentiq/ui 1.0.0-alpha.2 → 1.0.0-alpha.4

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.
package/dist/index.es.js CHANGED
@@ -1,40 +1,40 @@
1
1
  "use client";
2
2
  import { jsx as e, jsxs as s, Fragment as fe } from "react/jsx-runtime";
3
- import * as V from "react";
4
- import { useRef as Ee, useState as N, useEffect as F, createElement as _t, useContext as Xe, useMemo as O, useLayoutEffect as Tt, forwardRef as It, useCallback as Le, memo as qt, useId as Oe, createContext as Lt, useSyncExternalStore as Pt, Suspense as Mt } from "react";
5
- import { useMessage as Et, useOptionsStore as zt, useServerConfig as Rt, createOptionsStore as Ye, Message as Ze, useGentiqTranslation as _, References as ze, useTheme as ie, useGentiqLanguage as ee, useGentiqOptions as K, useThreadSelection as Je, ThreadSelectionProvider as et, useThread as At, Thread as tt, GentiqRuntimeProvider as Ft, useLoginCodeExchange as Dt, useAuthSession as Ot, useGentiqApi as Re, useGentiqQueryClient as at, getLocalizedErrorMessage as se, useGentiqKeys as $t, useGentiqEntitlement as Ut, ThreadList as j, ThreadRename as ye, useThreadListItem as Ae, useGentiqStatus as jt } from "@gentiq/react";
6
- import { Slot as Bt } from "@radix-ui/react-slot";
7
- import { cva as Gt } from "class-variance-authority";
8
- import { QuoteIcon as Ht, Loader2Icon as Vt, OctagonXIcon as Kt, TriangleAlertIcon as Qt, InfoIcon as Wt, CircleCheckIcon as Xt, PanelLeftIcon as Yt, User as Zt, Palette as Jt, ShieldCheck as ea, Settings as Pe, AtSign as ta, Mail as aa, Smartphone as na, Lock as ra, Save as sa, Coins as ia, Infinity as oa, Zap as la, LogOut as ca, SquarePen as nt, Check as da, X as ua, MoreVertical as ma, PinOff as ha, Pin as rt, Share2 as ga, Link2Off as pa, Pencil as fa, Trash as ba, Search as va } from "lucide-react";
9
- import { E as st, u as oe, R as xa, U as $e, r as it, m as ya, a as Na, S as wa, b as Sa, P as ka, c as y, d as te, C as Ca, e as _a, L, I as D, B as $, f as we, g as Se, h as ke, i as Ce, j as _e, k as Ta, l as ot, T as lt, n as Ia, o as qa, p as La, q as Pa, s as Ma, t as ct, v as dt, w as ut, x as mt, y as Ue, z as Ea, A as ht, D as za, F as Ra, G as gt, H as Aa, J as pt, K as Fa, M as Da, N as Oa, O as $a, Q as Ua, V as ja, W as Ba, X as Ga, Y as Ha, Z as he } from "./shared-BNCHeyvj.js";
10
- import { _ as kr, $ as Cr, a0 as _r, a1 as Tr, a2 as Ir, a3 as qr, a4 as Lr, a5 as Pr, a6 as Mr, a7 as Er, a8 as zr, a9 as Rr, aa as Ar, ab as Fr, ac as Dr, ad as Or, ae as $r, af as Ur, ag as jr, ah as Br, ai as Gr, aj as Hr } from "./shared-BNCHeyvj.js";
11
- import { Toaster as Va, toast as P } from "sonner";
12
- import { getToolName as ft, isToolUIPart as bt } from "ai";
13
- import { createPortal as Ka } from "react-dom";
14
- import { textOrKey as Qa, evaluateCondition as Te, getAvailableLanguages as Wa, getLanguageNativeName as Xa, isGentiqError as Ya, withAttachmentUrls as Za, toGentiqMessages as Ja } from "@gentiq/core";
15
- function en() {
16
- const t = Ee(null), [a, n] = N(0);
17
- return F(() => {
3
+ import * as Q from "react";
4
+ import { useRef as Ae, useState as S, useEffect as R, createElement as Ct, useContext as We, useMemo as O, useLayoutEffect as _t, forwardRef as Tt, useCallback as Le, memo as It, useId as Fe, createContext as qt, useSyncExternalStore as Lt, Suspense as Mt } from "react";
5
+ import { useMessage as Pt, useOptionsStore as At, useServerConfig as Et, createOptionsStore as Xe, Message as Ye, useGentiqTranslation as q, References as Ee, useTheme as se, useGentiqLanguage as J, useGentiqOptions as H, useThreadSelection as Ze, ThreadSelectionProvider as Je, useThread as zt, Thread as et, GentiqRuntimeProvider as Rt, useLoginCodeExchange as Dt, useAuthSession as Ft, useGentiqApi as ze, useGentiqQueryClient as tt, getLocalizedErrorMessage as re, useGentiqKeys as Ot, useGentiqEntitlement as $t, ThreadList as G, ThreadRename as ye, useThreadListItem as Re, useGentiqStatus as Ut } from "@gentiq/react";
6
+ import { Slot as jt } from "@radix-ui/react-slot";
7
+ import { cva as Bt } from "class-variance-authority";
8
+ import { QuoteIcon as Gt, Loader2Icon as Ht, OctagonXIcon as Vt, TriangleAlertIcon as Kt, InfoIcon as Qt, CircleCheckIcon as Wt, PanelLeftIcon as Xt, User as Yt, Palette as Zt, ShieldCheck as Jt, Settings as Me, AtSign as ea, Mail as ta, Smartphone as aa, Lock as na, Save as ra, Coins as sa, Infinity as ia, Zap as oa, LogOut as la, SquarePen as at, Check as ca, X as da, MoreVertical as ua, PinOff as ma, Pin as nt, Share2 as ha, Link2Off as ga, Pencil as pa, Trash as fa, Search as ba } from "lucide-react";
9
+ import { E as rt, u as ie, R as va, U as Oe, r as st, m as xa, a as ya, S as Na, b as wa, P as Sa, c as x, d as ee, C as ka, e as Ca, L as A, I as F, B as $, f as we, g as Se, h as ke, i as Ce, j as _e, k as _a, l as it, T as ot, n as Ta, o as Ia, p as qa, q as La, s as Ma, t as lt, v as ct, w as dt, x as ut, y as $e, z as Pa, A as mt, D as Aa, F as Ea, G as ht, H as za, J as gt, K as Ra, M as Da, N as Fa, O as Oa, Q as $a, V as Ua, W as ja, X as Ba, Y as Ga, Z as he } from "./shared-MFlvTavE.js";
10
+ import { _ as Cr, $ as _r, a0 as Tr, a1 as Ir, a2 as qr, a3 as Lr, a4 as Mr, a5 as Pr, a6 as Ar, a7 as Er, a8 as zr, a9 as Rr, aa as Dr, ab as Fr, ac as Or, ad as $r, ae as Ur, af as jr, ag as Br, ah as Gr, ai as Hr, aj as Vr } from "./shared-MFlvTavE.js";
11
+ import { Toaster as Ha, toast as E } from "sonner";
12
+ import { getToolName as pt, isToolUIPart as ft } from "ai";
13
+ import { createPortal as Va } from "react-dom";
14
+ import { textOrKey as Ka, evaluateCondition as Te, getAvailableLanguages as Qa, getLanguageNativeName as Wa, isGentiqError as Xa, withAttachmentUrls as Ya, toGentiqMessages as Za } from "@gentiq/core";
15
+ function Ja() {
16
+ const t = Ae(null), [a, n] = S(0);
17
+ return R(() => {
18
18
  const r = t.current;
19
19
  if (!r) return;
20
- const o = () => {
20
+ const i = () => {
21
21
  const m = r.offsetHeight;
22
22
  n((u) => Math.abs(u - m) < 1 ? u : m);
23
23
  };
24
- o();
25
- const i = typeof ResizeObserver > "u" ? null : new ResizeObserver(o);
26
- return i?.observe(r), () => i?.disconnect();
24
+ i();
25
+ const o = typeof ResizeObserver > "u" ? null : new ResizeObserver(i);
26
+ return o?.observe(r), () => o?.disconnect();
27
27
  }, []), [t, a];
28
28
  }
29
- const je = (t) => {
29
+ const Ue = (t) => {
30
30
  if (!t || typeof t != "object") return null;
31
31
  const a = Object.values(t).filter((n) => ["string", "number", "boolean"].includes(typeof n)).slice(0, 3).map(String);
32
32
  return a.length > 0 ? a.join(" · ") : null;
33
33
  };
34
- function tn(t) {
35
- return typeof t.output == "string" ? t.output : je(t.output) ?? je(t.input) ?? ft(t);
34
+ function en(t) {
35
+ return typeof t.output == "string" ? t.output : Ue(t.output) ?? Ue(t.input) ?? pt(t);
36
36
  }
37
- function an({
37
+ function tn({
38
38
  part: t,
39
39
  index: a,
40
40
  component: n
@@ -43,24 +43,24 @@ function an({
43
43
  return (
44
44
  // resetKeys: a streamed part can be malformed for a token and valid on the next. Without it
45
45
  // the boundary would latch for good, since the part's key never changes.
46
- /* @__PURE__ */ e(st, { resetKeys: [t], children: bt(t) || t.type === "file" ? /* @__PURE__ */ e(nn, { part: t, index: a, children: r }) : r })
46
+ /* @__PURE__ */ e(rt, { resetKeys: [t], children: ft(t) || t.type === "file" ? /* @__PURE__ */ e(an, { part: t, index: a, children: r }) : r })
47
47
  );
48
48
  }
49
- function nn({
49
+ function an({
50
50
  part: t,
51
51
  index: a,
52
52
  children: n
53
53
  }) {
54
- const r = Et((u) => u.message), { referenceAdapters: o } = oe(), i = { messageId: r.id, partIndex: a, role: r.role, data: t };
54
+ const r = Pt((u) => u.message), { referenceAdapters: i } = ie(), o = { messageId: r.id, partIndex: a, role: r.role, data: t };
55
55
  let m;
56
- if (bt(t)) {
57
- const u = ft(t), g = {
58
- ...i,
56
+ if (ft(t)) {
57
+ const u = pt(t), g = {
58
+ ...o,
59
59
  kind: "tool",
60
60
  sourceId: `${r.id}-${a}-tool`,
61
61
  label: u,
62
- excerpt: tn(t)
63
- }, c = o?.[u]?.({ part: t, message: r, toolName: u }) || {};
62
+ excerpt: en(t)
63
+ }, c = i?.[u]?.({ part: t, message: r, toolName: u }) || {};
64
64
  m = {
65
65
  ...g,
66
66
  ...c,
@@ -72,7 +72,7 @@ function nn({
72
72
  };
73
73
  } else if (t.type === "file")
74
74
  m = {
75
- ...i,
75
+ ...o,
76
76
  kind: "file",
77
77
  sourceId: `${r.id}-${a}-file`,
78
78
  label: t.filename || t.mediaType,
@@ -80,170 +80,176 @@ function nn({
80
80
  };
81
81
  else
82
82
  return n;
83
- return /* @__PURE__ */ e(xa, { reference: m, children: n });
83
+ return /* @__PURE__ */ e(va, { reference: m, children: n });
84
84
  }
85
- const Be = /* @__PURE__ */ new WeakMap();
86
- function rn(t) {
87
- let a = Be.get(t);
85
+ const je = /* @__PURE__ */ new WeakMap();
86
+ function nn(t) {
87
+ let a = je.get(t);
88
88
  if (!a) {
89
89
  const n = t;
90
- a = ({ part: o, index: i }) => _t(an, { part: o, index: i, component: n }), Be.set(t, a);
90
+ a = ({ part: i, index: o }) => Ct(tn, { part: i, index: o, component: n }), je.set(t, a);
91
91
  }
92
92
  return a;
93
93
  }
94
- function vt(t) {
94
+ function bt(t) {
95
95
  const a = {};
96
96
  for (const [n, r] of Object.entries(t))
97
- a[n] = r && rn(r);
97
+ a[n] = r && nn(r);
98
98
  return a;
99
99
  }
100
- const sn = Ye(it({}, null));
101
- function Fe({
100
+ const rn = Xe(st({}, null));
101
+ function De({
102
102
  components: t,
103
103
  children: a,
104
104
  history: n,
105
105
  welcome: r,
106
- threadActions: o,
107
- composer: i,
106
+ threadActions: i,
107
+ composer: o,
108
108
  disclaimer: m,
109
109
  settings: u
110
110
  }) {
111
- const g = Xe($e) ?? sn, c = zt(g, (T) => T.configured), h = oe(), p = Rt(), f = O(
112
- () => it(
113
- ya(c, {
111
+ const g = We(Oe) ?? rn, c = At(g, (k) => k.configured), h = ie(), p = Et(), f = O(
112
+ () => st(
113
+ xa(c, {
114
114
  history: n,
115
115
  welcome: r,
116
- threadActions: o,
117
- composer: i,
116
+ threadActions: i,
117
+ composer: o,
118
118
  disclaimer: m,
119
119
  settings: u
120
120
  }),
121
121
  p
122
122
  ),
123
- [c, p, n, r, o, i, m, u]
124
- ), [v] = N(() => Ye(f));
125
- Tt(() => v.setState(f), [v, f]);
126
- const b = O(() => Na(h, t), [h, t]), k = O(() => vt(b.parts), [b.parts]);
127
- return /* @__PURE__ */ e(wa.Provider, { value: b, children: /* @__PURE__ */ e($e.Provider, { value: v, children: /* @__PURE__ */ e(Ze.PartsProvider, { components: k, children: a }) }) });
123
+ [c, p, n, r, i, o, m, u]
124
+ ), [b] = S(() => Xe(f));
125
+ _t(() => b.setState(f), [b, f]);
126
+ const _ = O(() => ya(h, t), [h, t]), v = O(() => bt(_.parts), [_.parts]);
127
+ return /* @__PURE__ */ e(Na.Provider, { value: _, children: /* @__PURE__ */ e(Oe.Provider, { value: b, children: /* @__PURE__ */ e(Ye.PartsProvider, { components: v, children: a }) }) });
128
128
  }
129
- const on = {
129
+ const sn = {
130
130
  top: "max(0.5rem, calc(var(--gentiq-selection-top) - 2.625rem))",
131
131
  left: "calc(var(--gentiq-selection-left) + var(--gentiq-selection-width) / 2)"
132
132
  };
133
- function ln() {
134
- const { t } = _(["chat"]), a = Sa();
135
- return a ? Ka(
133
+ function on() {
134
+ const { t } = q(["chat"]), a = wa();
135
+ return a ? Va(
136
136
  /* @__PURE__ */ e(
137
- ze.SelectionQuote,
137
+ Ee.SelectionQuote,
138
138
  {
139
- style: on,
139
+ style: sn,
140
140
  className: "fixed z-50 flex size-9 -translate-x-1/2 items-center justify-center rounded-lg bg-background text-foreground shadow-lg ring-1 ring-border/60 transition hover:bg-muted",
141
141
  "aria-label": t("reference_selection"),
142
142
  title: t("reference_selection"),
143
- children: /* @__PURE__ */ e(Ht, { className: "size-4" })
143
+ children: /* @__PURE__ */ e(Gt, { className: "size-4" })
144
144
  }
145
145
  ),
146
146
  a
147
147
  ) : null;
148
148
  }
149
- function cn(t, a) {
149
+ function ln(t, a) {
150
150
  if (typeof t != "object" || t === null) return t || void 0;
151
151
  const n = a.split("-")[0];
152
152
  return t[a] || t[n] || t.en || Object.values(t)[0];
153
153
  }
154
- function dn({
154
+ function cn({
155
155
  accent: t,
156
156
  radius: a,
157
- fontFamily: n
157
+ fontFamily: n,
158
+ userBubbleAccent: r
158
159
  }) {
159
- const r = {};
160
- if (t && (r["--gentiq-primary"] = t), a && (r["--gentiq-radius"] = a), n) {
160
+ const i = {};
161
+ if (t && (i["--gentiq-primary"] = t), r && (i["--gentiq-bubble"] = "var(--gentiq-primary)", i["--gentiq-bubble-foreground"] = "var(--gentiq-primary-foreground)"), a && (i["--gentiq-radius"] = a), n) {
161
162
  const o = n.includes(" ") && !/^['"]/.test(n) ? `"${n}"` : n;
162
- r["--gentiq-font-family"] = `${o}, var(--gentiq-font-script)`;
163
+ i["--gentiq-font-family"] = `${o}, var(--gentiq-font-script)`;
163
164
  }
164
- return r;
165
+ return i;
165
166
  }
166
- const Q = It(function({ className: a, style: n, children: r, ...o }, i) {
167
- const { resolvedTheme: m, accent: u, radius: g } = ie(), { language: c, dir: h } = ee(), p = K((b) => b.theme.typography?.fontFamily), [f, v] = N(null);
167
+ const W = Tt(function({ className: a, style: n, children: r, ...i }, o) {
168
+ const { resolvedTheme: m, accent: u, radius: g } = se(), { language: c, dir: h } = J(), p = H((v) => v.theme.typography?.fontFamily), f = H((v) => v.theme.userBubbleAccent), [b, _] = S(null);
168
169
  return /* @__PURE__ */ s(
169
170
  "div",
170
171
  {
171
- ref: i,
172
- ...o,
173
- className: y("gentiq", m, a),
172
+ ref: o,
173
+ ...i,
174
+ className: x("gentiq", m, a),
174
175
  lang: c,
175
176
  dir: h,
176
177
  style: {
177
- ...dn({ accent: u, radius: g, fontFamily: cn(p, c) }),
178
+ ...cn({
179
+ accent: u,
180
+ radius: g,
181
+ fontFamily: ln(p, c),
182
+ userBubbleAccent: f
183
+ }),
178
184
  ...n
179
185
  },
180
186
  children: [
181
- /* @__PURE__ */ e(ka.Provider, { value: f, children: r }),
182
- /* @__PURE__ */ e("div", { ref: v, "data-gentiq-portal": "", className: "contents" })
187
+ /* @__PURE__ */ e(Sa.Provider, { value: b, children: r }),
188
+ /* @__PURE__ */ e("div", { ref: _, "data-gentiq-portal": "", className: "contents" })
183
189
  ]
184
190
  }
185
191
  );
186
192
  });
187
- function un({ classNames: t = {} }) {
188
- const { t: a, i18n: n } = _(["chat"]), { threadId: r, messages: o, status: i, send: m, addToolOutput: u } = At(), g = Le((E) => {
189
- m({ text: E });
190
- }, [m]), { MessageList: c, PromptInput: h, WelcomeScreen: p } = oe(), f = te((E) => E.composer), v = te((E) => E.disclaimer), b = K((E) => E.app.cacheNamespace), k = n.exists("chat:disclaimer") ? a("chat:disclaimer") : null, T = typeof v == "string" ? Qa(v, a, n, ["chat"]) : v ?? k, w = o[o.length - 1], M = w?.role === "assistant" && (i === "ready" || w.parts.some((E) => E.type === "data-chat-finished")), I = i === "error", B = r === null && o.length === 0 && i !== "submitted", W = O(() => qt(h), [h]), [ae, G] = en(), X = O(
191
- () => G ? { "--gentiq-composer-inset": `${G}px` } : void 0,
192
- [G]
193
+ function dn({ classNames: t = {} }) {
194
+ const { t: a, i18n: n } = q(["chat"]), { threadId: r, messages: i, status: o, send: m, addToolOutput: u } = zt(), g = Le((z) => {
195
+ m({ text: z });
196
+ }, [m]), { MessageList: c, PromptInput: h, WelcomeScreen: p } = ie(), f = ee((z) => z.composer), b = ee((z) => z.disclaimer), _ = H((z) => z.app.cacheNamespace), v = n.exists("chat:disclaimer") ? a("chat:disclaimer") : null, k = typeof b == "string" ? Ka(b, a, n, ["chat"]) : b ?? v, I = i[i.length - 1], y = I?.role === "assistant" && (o === "ready" || I.parts.some((z) => z.type === "data-chat-finished")), U = o === "error", D = r === null && i.length === 0 && o !== "submitted", T = O(() => It(h), [h]), [te, V] = Ja(), X = O(
197
+ () => V ? { "--gentiq-composer-inset": `${V}px` } : void 0,
198
+ [V]
193
199
  );
194
200
  return /* @__PURE__ */ s(
195
- ze.Root,
201
+ Ee.Root,
196
202
  {
197
203
  enabled: f?.references?.enabled ?? !0,
198
204
  maxItems: f?.references?.maxItems,
199
205
  maxExcerptLength: f?.references?.maxExcerptLength,
200
206
  children: [
201
207
  /* @__PURE__ */ e(
202
- Ca,
208
+ ka,
203
209
  {
204
- message: w,
205
- disabled: !M || i !== "ready",
206
- cacheNamespace: b,
210
+ message: I,
211
+ disabled: !y || o !== "ready",
212
+ cacheNamespace: _,
207
213
  onAnswer: u,
208
214
  children: /* @__PURE__ */ s(
209
- tt.Root,
215
+ et.Root,
210
216
  {
211
- className: y(
217
+ className: x(
212
218
  "relative flex flex-col h-full overflow-hidden bg-background",
213
219
  t.container
214
220
  ),
215
221
  style: X,
216
222
  children: [
217
- !B && /* @__PURE__ */ e(st, { children: /* @__PURE__ */ e(c, { className: y("flex-1", t.messageList) }) }),
223
+ !D && /* @__PURE__ */ e(rt, { children: /* @__PURE__ */ e(c, { className: x("flex-1", t.messageList) }) }),
218
224
  /* @__PURE__ */ s("div", { className: "absolute inset-0 z-10 pointer-events-none flex flex-col", children: [
219
- /* @__PURE__ */ e("div", { className: "grow basis-0 shrink-0 min-h-0 flex flex-col items-center justify-end px-4 pb-6 md:pb-8", children: B && /* @__PURE__ */ e(p, { onSuggestionClick: g }) }),
220
- /* @__PURE__ */ s("div", { ref: ae, className: "shrink-0 flex flex-col items-stretch", children: [
225
+ /* @__PURE__ */ e("div", { className: "grow basis-0 shrink-0 min-h-0 flex flex-col items-center justify-end px-4 pb-6 md:pb-8", children: D && /* @__PURE__ */ e(p, { onSuggestionClick: g }) }),
226
+ /* @__PURE__ */ s("div", { ref: te, className: "shrink-0 flex flex-col items-stretch", children: [
221
227
  /* @__PURE__ */ e(
222
- W,
228
+ T,
223
229
  {
224
230
  onSend: m,
225
- status: i,
226
- isErrorVisible: I,
231
+ status: o,
232
+ isErrorVisible: U,
227
233
  threadId: r,
228
- newChat: B,
229
- className: y(
234
+ newChat: D,
235
+ className: x(
230
236
  "pointer-events-auto",
231
237
  t.inputArea,
232
- T && "pb-0 md:pb-0"
238
+ k && "pb-0 md:pb-0"
233
239
  )
234
240
  }
235
241
  ),
236
- T && /* @__PURE__ */ s("div", { className: "relative py-1 px-4 flex justify-center items-center pointer-events-auto", children: [
242
+ k && /* @__PURE__ */ s("div", { className: "relative py-1 px-4 flex justify-center items-center pointer-events-auto", children: [
237
243
  /* @__PURE__ */ e("div", { className: "absolute inset-0 bg-background pointer-events-none -z-10" }),
238
- /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground select-none text-center leading-tight", children: T })
244
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground select-none text-center leading-tight", children: k })
239
245
  ] })
240
246
  ] }),
241
247
  /* @__PURE__ */ e(
242
248
  "div",
243
249
  {
244
- className: y(
250
+ className: x(
245
251
  "basis-0 shrink-0 transition-[flex-grow] duration-500 ease-in-out",
246
- B ? "grow" : "grow-0"
252
+ D ? "grow" : "grow-0"
247
253
  )
248
254
  }
249
255
  )
@@ -253,34 +259,34 @@ function un({ classNames: t = {} }) {
253
259
  )
254
260
  }
255
261
  ),
256
- /* @__PURE__ */ e(ln, {})
262
+ /* @__PURE__ */ e(on, {})
257
263
  ]
258
264
  }
259
265
  );
260
266
  }
261
- const mn = ({
267
+ const un = ({
262
268
  threadId: t,
263
269
  onThreadChange: a,
264
270
  components: n,
265
271
  welcome: r,
266
- threadActions: o,
267
- composer: i,
272
+ threadActions: i,
273
+ composer: o,
268
274
  disclaimer: m,
269
275
  ...u
270
276
  }) => {
271
- const g = Je(), c = /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(
272
- Fe,
277
+ const g = Ze(), c = /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(
278
+ De,
273
279
  {
274
280
  components: n,
275
281
  welcome: r,
276
- threadActions: o,
277
- composer: i,
282
+ threadActions: i,
283
+ composer: o,
278
284
  disclaimer: m,
279
- children: /* @__PURE__ */ e(un, { ...u })
285
+ children: /* @__PURE__ */ e(dn, { ...u })
280
286
  }
281
287
  ) });
282
288
  return g && t === void 0 && a === void 0 ? c : /* @__PURE__ */ e(
283
- et,
289
+ Je,
284
290
  {
285
291
  threadId: t,
286
292
  onThreadChange: a,
@@ -289,20 +295,20 @@ const mn = ({
289
295
  }
290
296
  );
291
297
  };
292
- function hn() {
293
- return /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e("div", { className: "min-h-dvh bg-background" }) });
298
+ function mn() {
299
+ return /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e("div", { className: "min-h-dvh bg-background" }) });
294
300
  }
295
- const gn = ({ theme: t = "system", ...a }) => /* @__PURE__ */ e(
296
- Va,
301
+ const hn = ({ theme: t = "system", ...a }) => /* @__PURE__ */ e(
302
+ Ha,
297
303
  {
298
304
  theme: t,
299
305
  className: "toaster group",
300
306
  icons: {
301
- success: /* @__PURE__ */ e(Xt, { className: "size-4" }),
302
- info: /* @__PURE__ */ e(Wt, { className: "size-4" }),
303
- warning: /* @__PURE__ */ e(Qt, { className: "size-4" }),
304
- error: /* @__PURE__ */ e(Kt, { className: "size-4" }),
305
- loading: /* @__PURE__ */ e(Vt, { className: "size-4 animate-spin" })
307
+ success: /* @__PURE__ */ e(Wt, { className: "size-4" }),
308
+ info: /* @__PURE__ */ e(Qt, { className: "size-4" }),
309
+ warning: /* @__PURE__ */ e(Kt, { className: "size-4" }),
310
+ error: /* @__PURE__ */ e(Vt, { className: "size-4" }),
311
+ loading: /* @__PURE__ */ e(Ht, { className: "size-4 animate-spin" })
306
312
  },
307
313
  style: {
308
314
  "--normal-bg": "var(--gentiq-popover)",
@@ -314,67 +320,67 @@ const gn = ({ theme: t = "system", ...a }) => /* @__PURE__ */ e(
314
320
  ...a
315
321
  }
316
322
  );
317
- function pn() {
318
- const { resolvedTheme: t } = ie();
319
- return /* @__PURE__ */ e(gn, { richColors: !0, theme: t });
323
+ function gn() {
324
+ const { resolvedTheme: t } = se();
325
+ return /* @__PURE__ */ e(hn, { richColors: !0, theme: t });
320
326
  }
321
- const fn = vt(_a), bn = ({ message: t }) => {
322
- P.error(t);
327
+ const pn = bt(Ca), fn = ({ message: t }) => {
328
+ E.error(t);
323
329
  };
324
- function vn({
330
+ function bn({
325
331
  toaster: t = !0,
326
332
  fallback: a,
327
- onConfigUnavailable: n = bn,
333
+ onConfigUnavailable: n = fn,
328
334
  children: r,
329
- ...o
335
+ ...i
330
336
  }) {
331
337
  return /* @__PURE__ */ e(
332
- Ft,
338
+ Rt,
333
339
  {
334
- ...o,
335
- fallback: a ?? /* @__PURE__ */ e(hn, {}),
340
+ ...i,
341
+ fallback: a ?? /* @__PURE__ */ e(mn, {}),
336
342
  onConfigUnavailable: n,
337
- overlay: t && /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(pn, {}) }),
338
- children: /* @__PURE__ */ e(Ze.PartsProvider, { components: fn, children: r })
343
+ overlay: t && /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(gn, {}) }),
344
+ children: /* @__PURE__ */ e(Ye.PartsProvider, { components: pn, children: r })
339
345
  }
340
346
  );
341
347
  }
342
- function xn() {
343
- const { language: t, dir: a } = ee(), { resolvedTheme: n } = ie(), r = K((i) => i.app.name), o = K((i) => i.app.favicon);
344
- return F(() => {
345
- const i = document.documentElement, m = { lang: i.lang, dir: i.dir };
346
- return i.lang = t, i.dir = a, () => {
347
- i.lang = m.lang, i.dir = m.dir;
348
+ function vn() {
349
+ const { language: t, dir: a } = J(), { resolvedTheme: n } = se(), r = H((o) => o.app.name), i = H((o) => o.app.favicon);
350
+ return R(() => {
351
+ const o = document.documentElement, m = { lang: o.lang, dir: o.dir };
352
+ return o.lang = t, o.dir = a, () => {
353
+ o.lang = m.lang, o.dir = m.dir;
348
354
  };
349
- }, [t, a]), F(() => {
350
- const i = document.documentElement, m = i.style.colorScheme, u = i.classList.contains(n);
351
- return i.classList.add(n), i.style.colorScheme = n, () => {
352
- u || i.classList.remove(n), i.style.colorScheme = m;
355
+ }, [t, a]), R(() => {
356
+ const o = document.documentElement, m = o.style.colorScheme, u = o.classList.contains(n);
357
+ return o.classList.add(n), o.style.colorScheme = n, () => {
358
+ u || o.classList.remove(n), o.style.colorScheme = m;
353
359
  };
354
- }, [n]), F(() => {
360
+ }, [n]), R(() => {
355
361
  if (!r) return;
356
- const i = document.title;
362
+ const o = document.title;
357
363
  return document.title = r, () => {
358
- document.title = i;
364
+ document.title = o;
359
365
  };
360
- }, [r]), F(() => {
361
- if (!o) return;
362
- const i = document.querySelector("link[rel~='icon']"), m = i ?? Object.assign(document.createElement("link"), { rel: "icon" }), u = m.getAttribute("href");
363
- return m.href = o, i || document.head.appendChild(m), () => {
364
- i ? u === null ? m.removeAttribute("href") : m.setAttribute("href", u) : m.remove();
366
+ }, [r]), R(() => {
367
+ if (!i) return;
368
+ const o = document.querySelector("link[rel~='icon']"), m = o ?? Object.assign(document.createElement("link"), { rel: "icon" }), u = m.getAttribute("href");
369
+ return m.href = i, o || document.head.appendChild(m), () => {
370
+ o ? u === null ? m.removeAttribute("href") : m.setAttribute("href", u) : m.remove();
365
371
  };
366
- }, [o]), null;
372
+ }, [i]), null;
367
373
  }
368
- function yn({ children: t, fallback: a, loginCode: n, onLoginCodeUsed: r }) {
369
- const o = Dt(), [i, m] = N(
374
+ function xn({ children: t, fallback: a, loginCode: n, onLoginCodeUsed: r }) {
375
+ const i = Dt(), [o, m] = S(
370
376
  () => n ? "pending" : "idle"
371
377
  );
372
- F(() => {
378
+ R(() => {
373
379
  if (!n) return;
374
380
  let c = !1;
375
381
  return m("pending"), (async () => {
376
382
  try {
377
- await o(n);
383
+ await i(n);
378
384
  } catch (h) {
379
385
  if (c) return;
380
386
  console.error("Could not sign in with the login code:", h), m("failed");
@@ -385,68 +391,68 @@ function yn({ children: t, fallback: a, loginCode: n, onLoginCodeUsed: r }) {
385
391
  c = !0;
386
392
  };
387
393
  }, [n]);
388
- const u = Ot({ enabled: i === "idle" }), g = i === "failed" ? "handoff_failed" : i === "idle" && (u === "signed_out" || u === "session_expired") ? u : null;
389
- return g ? /* @__PURE__ */ e(fe, { children: typeof a == "function" ? a(g) : a }) : i === "pending" || u === "checking" ? /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e("div", { className: "flex h-screen w-full items-center justify-center bg-background", children: /* @__PURE__ */ e("div", { className: "size-8 rounded-full border-4 border-primary border-t-transparent animate-spin" }) }) }) : /* @__PURE__ */ e(fe, { children: t });
394
+ const u = Ft({ enabled: o === "idle" }), g = o === "failed" ? "handoff_failed" : o === "idle" && (u === "signed_out" || u === "session_expired") ? u : null;
395
+ return g ? /* @__PURE__ */ e(fe, { children: typeof a == "function" ? a(g) : a }) : o === "pending" || u === "checking" ? /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e("div", { className: "flex h-screen w-full items-center justify-center bg-background", children: /* @__PURE__ */ e("div", { className: "size-8 rounded-full border-4 border-primary border-t-transparent animate-spin" }) }) }) : /* @__PURE__ */ e(fe, { children: t });
390
396
  }
391
- const Ge = (t) => t.replace(/[^0-9]/g, "");
392
- function Nn(t) {
393
- return /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(wn, { ...t }) });
397
+ const Be = (t) => t.replace(/[^0-9]/g, "");
398
+ function yn(t) {
399
+ return /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(Nn, { ...t }) });
394
400
  }
395
- function wn({ onSignedIn: t, reason: a }) {
396
- const { t: n } = _(["login"]), r = K((d) => d.app), o = Re(), i = ee().dir === "rtl", m = at(), [u, g] = N("login"), c = !!r?.disableSignup, h = !!r?.disableAuthPage, p = O(
401
+ function Nn({ onSignedIn: t, reason: a }) {
402
+ const { t: n } = q(["login"]), r = H((d) => d.app), i = ze(), o = J().dir === "rtl", m = tt(), [u, g] = S("login"), c = !!r?.disableSignup, h = !!r?.disableAuthPage, p = O(
397
403
  () => r?.loginFields ?? ["username"],
398
404
  [r?.loginFields]
399
405
  ), f = {
400
406
  username: { labelKey: "username", labelDefault: "Username", inputType: "text" },
401
407
  email: { labelKey: "email", labelDefault: "Email", inputType: "email" },
402
408
  phone: { labelKey: "phone", labelDefault: "Phone", inputType: "tel" }
403
- }, v = p.map((d) => n(f[d].labelKey, f[d].labelDefault)).join(" / "), b = p.length === 1 ? f[p[0]].inputType : "text", k = p.length === 1 && p[0] === "phone", T = (d) => k ? Ge(d) : d, [w, M] = N(""), [I, B] = N(""), [W, ae] = N({}), G = (d, x) => ae((R) => ({ ...R, [d]: x })), [X, E] = N(""), [le, ve] = N(""), [ce, xe] = N(""), H = O(
409
+ }, b = p.map((d) => n(f[d].labelKey, f[d].labelDefault)).join(" / "), _ = p.length === 1 ? f[p[0]].inputType : "text", v = p.length === 1 && p[0] === "phone", k = (d) => v ? Be(d) : d, [I, y] = S(""), [U, D] = S(""), [T, te] = S({}), V = (d, N) => te((P) => ({ ...P, [d]: N })), [X, z] = S(""), [oe, ve] = S(""), [le, ce] = S(""), Y = O(
404
410
  () => r?.userMetadataFields?.filter((d) => d.showInSignup) || [],
405
411
  [r?.userMetadataFields]
406
- ), [z, U] = N(() => {
412
+ ), [L, M] = S(() => {
407
413
  const d = {};
408
- return H.forEach((x) => {
409
- x.defaultValue !== void 0 && (d[x.key] = x.defaultValue);
414
+ return Y.forEach((N) => {
415
+ N.defaultValue !== void 0 && (d[N.key] = N.defaultValue);
410
416
  }), d;
411
417
  });
412
- F(() => {
413
- const d = { ...z };
414
- let x = !1;
415
- H.forEach((R) => {
416
- R.condition && !Te(R.condition, z) && d[R.key] !== void 0 && (delete d[R.key], x = !0);
417
- }), x && U(d);
418
- }, [z, H]);
419
- const [q, A] = N(""), [Y, Z] = N(!1);
420
- F(() => {
418
+ R(() => {
419
+ const d = { ...L };
420
+ let N = !1;
421
+ Y.forEach((P) => {
422
+ P.condition && !Te(P.condition, L) && d[P.key] !== void 0 && (delete d[P.key], N = !0);
423
+ }), N && M(d);
424
+ }, [L, Y]);
425
+ const [j, B] = S(""), [Z, K] = S(!1);
426
+ R(() => {
421
427
  c && u === "register" && g("login");
422
428
  }, [c, u]);
423
429
  const de = async (d) => {
424
- d.preventDefault(), A(""), Z(!0);
430
+ d.preventDefault(), B(""), K(!0);
425
431
  try {
426
- await o.login(w, I), m.clear(), t();
427
- } catch (x) {
428
- A(se(x, n));
432
+ await i.login(I, U), m.clear(), t();
433
+ } catch (N) {
434
+ B(re(N, n));
429
435
  } finally {
430
- Z(!1);
436
+ K(!1);
431
437
  }
432
- }, ue = async (d) => {
433
- d.preventDefault(), A("");
434
- const x = {};
435
- for (const R of p) {
436
- const J = W[R]?.trim();
437
- J && (x[R] = J);
438
+ }, Ie = async (d) => {
439
+ d.preventDefault(), B("");
440
+ const N = {};
441
+ for (const P of p) {
442
+ const l = T[P]?.trim();
443
+ l && (N[P] = l);
438
444
  }
439
- if (Object.keys(x).length === 0) {
440
- A(n("at_least_one_login_field", "Please provide at least one login field."));
445
+ if (Object.keys(N).length === 0) {
446
+ B(n("at_least_one_login_field", "Please provide at least one login field."));
441
447
  return;
442
448
  }
443
- Z(!0);
449
+ K(!0);
444
450
  try {
445
- await o.register(x, X, le, ce, z), m.clear(), t();
446
- } catch (R) {
447
- A(se(R, n));
451
+ await i.register(N, X, oe, le, L), m.clear(), t();
452
+ } catch (P) {
453
+ B(re(P, n));
448
454
  } finally {
449
- Z(!1);
455
+ K(!1);
450
456
  }
451
457
  };
452
458
  if (h) {
@@ -455,7 +461,7 @@ function wn({ onSignedIn: t, reason: a }) {
455
461
  "div",
456
462
  {
457
463
  className: "min-h-screen bg-background flex items-center justify-center p-4",
458
- dir: i ? "rtl" : "ltr",
464
+ dir: o ? "rtl" : "ltr",
459
465
  children: /* @__PURE__ */ s("div", { className: "w-full max-w-lg bg-card border border-border rounded-xl shadow-lg p-8 text-center space-y-4", children: [
460
466
  /* @__PURE__ */ e("h1", { className: "text-2xl font-bold", children: r?.name }),
461
467
  /* @__PURE__ */ e("p", { className: "text-muted-foreground", children: d ? n("handoff_failed_title", "This sign-in link has expired or was already used.") : n("auth_page_disabled_title", "The sign-in page is currently disabled.") }),
@@ -468,7 +474,7 @@ function wn({ onSignedIn: t, reason: a }) {
468
474
  "div",
469
475
  {
470
476
  className: "min-h-screen bg-background flex flex-col items-center justify-center p-4",
471
- dir: i ? "rtl" : "ltr",
477
+ dir: o ? "rtl" : "ltr",
472
478
  children: /* @__PURE__ */ s("div", { className: "w-full max-w-md bg-card border border-border rounded-xl shadow-lg p-6", children: [
473
479
  /* @__PURE__ */ e("div", { className: "text-center mb-6", children: /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground", children: r?.name }) }),
474
480
  /* @__PURE__ */ s("div", { className: "flex bg-muted p-1 rounded-lg mb-6", children: [
@@ -477,7 +483,7 @@ function wn({ onSignedIn: t, reason: a }) {
477
483
  {
478
484
  type: "button",
479
485
  onClick: () => {
480
- g("login"), A("");
486
+ g("login"), B("");
481
487
  },
482
488
  className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${u === "login" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
483
489
  children: n("login_tab", "Login")
@@ -488,7 +494,7 @@ function wn({ onSignedIn: t, reason: a }) {
488
494
  {
489
495
  type: "button",
490
496
  onClick: () => {
491
- g("register"), A("");
497
+ g("register"), B("");
492
498
  },
493
499
  className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${u === "register" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
494
500
  children: n("signup_tab", "Sign Up")
@@ -497,30 +503,30 @@ function wn({ onSignedIn: t, reason: a }) {
497
503
  ] }),
498
504
  u === "login" && /* @__PURE__ */ s("form", { onSubmit: de, className: "space-y-4", children: [
499
505
  /* @__PURE__ */ s("div", { className: "space-y-3", children: [
500
- /* @__PURE__ */ e(L, { htmlFor: "login-identity", children: v }),
506
+ /* @__PURE__ */ e(A, { htmlFor: "login-identity", children: b }),
501
507
  /* @__PURE__ */ e(
502
- D,
508
+ F,
503
509
  {
504
510
  id: "login-identity",
505
- type: b,
506
- value: w,
507
- onChange: (d) => M(T(d.target.value)),
511
+ type: _,
512
+ value: I,
513
+ onChange: (d) => y(k(d.target.value)),
508
514
  required: !0,
509
515
  className: "text-start",
510
- placeholder: v,
516
+ placeholder: b,
511
517
  dir: "ltr"
512
518
  }
513
519
  )
514
520
  ] }),
515
521
  /* @__PURE__ */ s("div", { className: "space-y-3", children: [
516
- /* @__PURE__ */ e(L, { htmlFor: "login-pass", children: n("password", "Password") }),
522
+ /* @__PURE__ */ e(A, { htmlFor: "login-pass", children: n("password", "Password") }),
517
523
  /* @__PURE__ */ e(
518
- D,
524
+ F,
519
525
  {
520
526
  id: "login-pass",
521
527
  type: "password",
522
- value: I,
523
- onChange: (d) => B(d.target.value),
528
+ value: U,
529
+ onChange: (d) => D(d.target.value),
524
530
  required: !0,
525
531
  className: "text-start",
526
532
  placeholder: "••••••••",
@@ -528,38 +534,38 @@ function wn({ onSignedIn: t, reason: a }) {
528
534
  }
529
535
  )
530
536
  ] }),
531
- q && /* @__PURE__ */ e("div", { role: "alert", className: "text-sm text-destructive", children: q }),
532
- /* @__PURE__ */ e($, { type: "submit", disabled: Y, className: "w-full font-semibold", children: Y ? n("logging_in", "Logging in...") : n("login_button", "Login") })
537
+ j && /* @__PURE__ */ e("div", { role: "alert", className: "text-sm text-destructive", children: j }),
538
+ /* @__PURE__ */ e($, { type: "submit", disabled: Z, className: "w-full font-semibold", children: Z ? n("logging_in", "Logging in...") : n("login_button", "Login") })
533
539
  ] }),
534
- !c && u === "register" && /* @__PURE__ */ s("form", { onSubmit: ue, className: "space-y-4", children: [
540
+ !c && u === "register" && /* @__PURE__ */ s("form", { onSubmit: Ie, className: "space-y-4", children: [
535
541
  p.map((d) => {
536
- const x = f[d], R = n(x.labelKey, x.labelDefault), J = (l) => d === "phone" ? Ge(l) : l;
542
+ const N = f[d], P = n(N.labelKey, N.labelDefault), l = (C) => d === "phone" ? Be(C) : C;
537
543
  return /* @__PURE__ */ s("div", { className: "space-y-3", children: [
538
- /* @__PURE__ */ e(L, { htmlFor: `reg-${d}`, children: R }),
544
+ /* @__PURE__ */ e(A, { htmlFor: `reg-${d}`, children: P }),
539
545
  /* @__PURE__ */ e(
540
- D,
546
+ F,
541
547
  {
542
548
  id: `reg-${d}`,
543
- type: x.inputType,
544
- value: W[d] ?? "",
545
- onChange: (l) => G(d, J(l.target.value)),
549
+ type: N.inputType,
550
+ value: T[d] ?? "",
551
+ onChange: (C) => V(d, l(C.target.value)),
546
552
  required: p.length === 1,
547
553
  className: "text-start",
548
- placeholder: n(`${x.labelKey}_placeholder`, x.labelDefault),
554
+ placeholder: n(`${N.labelKey}_placeholder`, N.labelDefault),
549
555
  dir: "ltr"
550
556
  }
551
557
  )
552
558
  ] }, d);
553
559
  }),
554
560
  /* @__PURE__ */ s("div", { className: "space-y-3", children: [
555
- /* @__PURE__ */ e(L, { htmlFor: "reg-pass", children: n("password", "Password") }),
561
+ /* @__PURE__ */ e(A, { htmlFor: "reg-pass", children: n("password", "Password") }),
556
562
  /* @__PURE__ */ e(
557
- D,
563
+ F,
558
564
  {
559
565
  id: "reg-pass",
560
566
  type: "password",
561
567
  value: X,
562
- onChange: (d) => E(d.target.value),
568
+ onChange: (d) => z(d.target.value),
563
569
  required: !0,
564
570
  className: "text-start",
565
571
  placeholder: "••••••••",
@@ -569,13 +575,13 @@ function wn({ onSignedIn: t, reason: a }) {
569
575
  ] }),
570
576
  /* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-4", children: [
571
577
  /* @__PURE__ */ s("div", { className: "space-y-3", children: [
572
- /* @__PURE__ */ e(L, { htmlFor: "reg-name", children: n("name", "Name") }),
578
+ /* @__PURE__ */ e(A, { htmlFor: "reg-name", children: n("name", "Name") }),
573
579
  /* @__PURE__ */ e(
574
- D,
580
+ F,
575
581
  {
576
582
  id: "reg-name",
577
583
  type: "text",
578
- value: le,
584
+ value: oe,
579
585
  onChange: (d) => ve(d.target.value),
580
586
  required: !0,
581
587
  className: "text-start",
@@ -584,14 +590,14 @@ function wn({ onSignedIn: t, reason: a }) {
584
590
  )
585
591
  ] }),
586
592
  /* @__PURE__ */ s("div", { className: "space-y-3", children: [
587
- /* @__PURE__ */ e(L, { htmlFor: "reg-surname", children: n("surname", "Surname") }),
593
+ /* @__PURE__ */ e(A, { htmlFor: "reg-surname", children: n("surname", "Surname") }),
588
594
  /* @__PURE__ */ e(
589
- D,
595
+ F,
590
596
  {
591
597
  id: "reg-surname",
592
598
  type: "text",
593
- value: ce,
594
- onChange: (d) => xe(d.target.value),
599
+ value: le,
600
+ onChange: (d) => ce(d.target.value),
595
601
  required: !0,
596
602
  className: "text-start",
597
603
  placeholder: n("surname_placeholder", "Last Name")
@@ -599,31 +605,31 @@ function wn({ onSignedIn: t, reason: a }) {
599
605
  )
600
606
  ] })
601
607
  ] }),
602
- H.map((d) => Te(d.condition, z) ? /* @__PURE__ */ s(
608
+ Y.map((d) => Te(d.condition, L) ? /* @__PURE__ */ s(
603
609
  "div",
604
610
  {
605
611
  className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200",
606
612
  children: [
607
- /* @__PURE__ */ e(L, { htmlFor: `signup-${d.key}`, children: n(d.label) }),
613
+ /* @__PURE__ */ e(A, { htmlFor: `signup-${d.key}`, children: n(d.label) }),
608
614
  d.type === "select" ? /* @__PURE__ */ s(
609
615
  we,
610
616
  {
611
- value: String(z[d.key] || ""),
612
- onValueChange: (x) => U({ ...z, [d.key]: x }),
617
+ value: String(L[d.key] || ""),
618
+ onValueChange: (N) => M({ ...L, [d.key]: N }),
613
619
  required: d.required,
614
- dir: i ? "rtl" : "ltr",
620
+ dir: o ? "rtl" : "ltr",
615
621
  children: [
616
622
  /* @__PURE__ */ e(Se, { className: "bg-background text-start", children: /* @__PURE__ */ e(ke, { placeholder: n(d.placeholder || "select_placeholder") }) }),
617
- /* @__PURE__ */ e(Ce, { className: "rounded-xl", children: d.options?.map((x) => /* @__PURE__ */ e(_e, { value: String(x.value), children: n(x.label) }, String(x.value))) })
623
+ /* @__PURE__ */ e(Ce, { className: "rounded-xl", children: d.options?.map((N) => /* @__PURE__ */ e(_e, { value: String(N.value), children: n(N.label) }, String(N.value))) })
618
624
  ]
619
625
  }
620
626
  ) : d.type === "checkbox" ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 py-2", children: [
621
627
  /* @__PURE__ */ e(
622
- Ta,
628
+ _a,
623
629
  {
624
630
  id: `signup-${d.key}`,
625
- checked: !!z[d.key],
626
- onCheckedChange: (x) => U({ ...z, [d.key]: !!x }),
631
+ checked: !!L[d.key],
632
+ onCheckedChange: (N) => M({ ...L, [d.key]: !!N }),
627
633
  required: d.required
628
634
  }
629
635
  ),
@@ -636,12 +642,12 @@ function wn({ onSignedIn: t, reason: a }) {
636
642
  }
637
643
  )
638
644
  ] }) : /* @__PURE__ */ e(
639
- D,
645
+ F,
640
646
  {
641
647
  id: `signup-${d.key}`,
642
648
  type: d.type,
643
- value: z[d.key] || "",
644
- onChange: (x) => U({ ...z, [d.key]: x.target.value }),
649
+ value: L[d.key] || "",
650
+ onChange: (N) => M({ ...L, [d.key]: N.target.value }),
645
651
  required: d.required,
646
652
  className: "text-start",
647
653
  placeholder: n(d.placeholder || "")
@@ -651,92 +657,92 @@ function wn({ onSignedIn: t, reason: a }) {
651
657
  },
652
658
  d.key
653
659
  ) : null),
654
- q && /* @__PURE__ */ e("div", { role: "alert", className: "text-sm text-destructive", children: q }),
655
- /* @__PURE__ */ e($, { type: "submit", disabled: Y, className: "w-full font-semibold", children: Y ? n("signing_up", "Signing up...") : n("signup_button", "Sign Up") })
660
+ j && /* @__PURE__ */ e("div", { role: "alert", className: "text-sm text-destructive", children: j }),
661
+ /* @__PURE__ */ e($, { type: "submit", disabled: Z, className: "w-full font-semibold", children: Z ? n("signing_up", "Signing up...") : n("signup_button", "Sign Up") })
656
662
  ] })
657
663
  ] })
658
664
  }
659
665
  );
660
666
  }
661
- const Sn = "sidebar_state", kn = 3600 * 24 * 7, Cn = "19rem", _n = "18rem", Tn = "3rem", In = "b", xt = V.createContext(null);
667
+ const wn = "sidebar_state", Sn = 3600 * 24 * 7, kn = "19rem", Cn = "18rem", _n = "3rem", Tn = "b", vt = Q.createContext(null);
662
668
  function be() {
663
- const t = V.useContext(xt);
669
+ const t = Q.useContext(vt);
664
670
  if (!t)
665
671
  throw new Error("useSidebar must be used within a SidebarProvider.");
666
672
  return t;
667
673
  }
668
- function qn({
674
+ function In({
669
675
  defaultOpen: t = !0,
670
676
  open: a,
671
677
  onOpenChange: n,
672
678
  className: r,
673
- style: o,
674
- children: i,
679
+ style: i,
680
+ children: o,
675
681
  ...m
676
682
  }) {
677
- const u = ot(), [g, c] = V.useState(!1), [h, p] = V.useState(t), f = a ?? h, v = V.useCallback(
678
- (w) => {
679
- const M = typeof w == "function" ? w(f) : w;
680
- n ? n(M) : p(M), document.cookie = `${Sn}=${M}; path=/; max-age=${kn}`;
683
+ const u = it(), [g, c] = Q.useState(!1), [h, p] = Q.useState(t), f = a ?? h, b = Q.useCallback(
684
+ (I) => {
685
+ const y = typeof I == "function" ? I(f) : I;
686
+ n ? n(y) : p(y), document.cookie = `${wn}=${y}; path=/; max-age=${Sn}`;
681
687
  },
682
688
  [n, f]
683
- ), b = V.useCallback(() => {
684
- u ? c((w) => !w) : v((w) => !w);
685
- }, [u, v, c]);
686
- V.useEffect(() => {
687
- const w = (M) => {
688
- M.key === In && (M.metaKey || M.ctrlKey) && (M.preventDefault(), b());
689
+ ), _ = Q.useCallback(() => {
690
+ u ? c((I) => !I) : b((I) => !I);
691
+ }, [u, b, c]);
692
+ Q.useEffect(() => {
693
+ const I = (y) => {
694
+ y.key === Tn && (y.metaKey || y.ctrlKey) && (y.preventDefault(), _());
689
695
  };
690
- return window.addEventListener("keydown", w), () => {
691
- window.removeEventListener("keydown", w);
696
+ return window.addEventListener("keydown", I), () => {
697
+ window.removeEventListener("keydown", I);
692
698
  };
693
- }, [b]);
694
- const k = f ? "expanded" : "collapsed", T = V.useMemo(
699
+ }, [_]);
700
+ const v = f ? "expanded" : "collapsed", k = Q.useMemo(
695
701
  () => ({
696
- state: k,
702
+ state: v,
697
703
  open: f,
698
- setOpen: v,
704
+ setOpen: b,
699
705
  isMobile: u,
700
706
  openMobile: g,
701
707
  setOpenMobile: c,
702
- toggleSidebar: b
708
+ toggleSidebar: _
703
709
  }),
704
- [k, f, v, u, g, c, b]
710
+ [v, f, b, u, g, c, _]
705
711
  );
706
- return /* @__PURE__ */ e(xt.Provider, { value: T, children: /* @__PURE__ */ e(lt, { delayDuration: 0, children: /* @__PURE__ */ e(
712
+ return /* @__PURE__ */ e(vt.Provider, { value: k, children: /* @__PURE__ */ e(ot, { delayDuration: 0, children: /* @__PURE__ */ e(
707
713
  "div",
708
714
  {
709
715
  "data-slot": "sidebar-wrapper",
710
716
  style: {
711
- "--gentiq-sidebar-width": Cn,
712
- "--gentiq-sidebar-width-icon": Tn,
713
- ...o
717
+ "--gentiq-sidebar-width": kn,
718
+ "--gentiq-sidebar-width-icon": _n,
719
+ ...i
714
720
  },
715
- className: y("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", r),
721
+ className: x("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", r),
716
722
  ...m,
717
- children: i
723
+ children: o
718
724
  }
719
725
  ) }) });
720
726
  }
721
- function Ln({
727
+ function qn({
722
728
  side: t = "start",
723
729
  variant: a = "sidebar",
724
730
  collapsible: n = "offcanvas",
725
731
  className: r,
726
- children: o,
727
- ...i
732
+ children: i,
733
+ ...o
728
734
  }) {
729
- const { isMobile: m, state: u, openMobile: g, setOpenMobile: c } = be(), { t: h } = _("sidebar");
735
+ const { isMobile: m, state: u, openMobile: g, setOpenMobile: c } = be(), { t: h } = q("sidebar");
730
736
  return n === "none" ? /* @__PURE__ */ e(
731
737
  "div",
732
738
  {
733
739
  "data-slot": "sidebar",
734
- className: y("bg-sidebar text-sidebar-foreground flex h-full w-(--gentiq-sidebar-width) flex-col", r),
735
- ...i,
736
- children: o
740
+ className: x("bg-sidebar text-sidebar-foreground flex h-full w-(--gentiq-sidebar-width) flex-col", r),
741
+ ...o,
742
+ children: i
737
743
  }
738
- ) : m ? /* @__PURE__ */ e(Ia, { open: g, onOpenChange: c, ...i, children: /* @__PURE__ */ s(
739
- qa,
744
+ ) : m ? /* @__PURE__ */ e(Ta, { open: g, onOpenChange: c, ...o, children: /* @__PURE__ */ s(
745
+ Ia,
740
746
  {
741
747
  onOpenAutoFocus: (p) => p.preventDefault(),
742
748
  "data-sidebar": "sidebar",
@@ -744,15 +750,15 @@ function Ln({
744
750
  "data-mobile": "true",
745
751
  className: "bg-sidebar text-sidebar-foreground w-(--gentiq-sidebar-width) p-0 [&>button]:hidden",
746
752
  style: {
747
- "--gentiq-sidebar-width": _n
753
+ "--gentiq-sidebar-width": Cn
748
754
  },
749
755
  side: t,
750
756
  children: [
751
- /* @__PURE__ */ s(La, { className: "sr-only", children: [
752
- /* @__PURE__ */ e(Pa, { children: h("title") }),
757
+ /* @__PURE__ */ s(qa, { className: "sr-only", children: [
758
+ /* @__PURE__ */ e(La, { children: h("title") }),
753
759
  /* @__PURE__ */ e(Ma, { children: h("mobile_description") })
754
760
  ] }),
755
- /* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: o })
761
+ /* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: i })
756
762
  ]
757
763
  }
758
764
  ) }) : /* @__PURE__ */ s(
@@ -769,7 +775,7 @@ function Ln({
769
775
  "div",
770
776
  {
771
777
  "data-slot": "sidebar-gap",
772
- className: y(
778
+ className: x(
773
779
  "relative w-(--gentiq-sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
774
780
  "group-data-[collapsible=offcanvas]:w-0",
775
781
  a === "floating" || a === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--gentiq-sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--gentiq-sidebar-width-icon)"
@@ -780,21 +786,21 @@ function Ln({
780
786
  "div",
781
787
  {
782
788
  "data-slot": "sidebar-container",
783
- className: y(
789
+ className: x(
784
790
  "fixed inset-y-0 z-10 hidden h-svh w-(--gentiq-sidebar-width) transition-[inset-inline-start,inset-inline-end,width] duration-200 ease-linear md:flex",
785
791
  t === "start" ? "start-0 group-data-[collapsible=offcanvas]:start-[calc(var(--gentiq-sidebar-width)*-1)]" : "end-0 group-data-[collapsible=offcanvas]:end-[calc(var(--gentiq-sidebar-width)*-1)]",
786
792
  // Adjust the padding for floating and inset variants.
787
793
  a === "floating" || a === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--gentiq-sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--gentiq-sidebar-width-icon) group-data-[side=start]:border-e group-data-[side=end]:border-s",
788
794
  r
789
795
  ),
790
- ...i,
796
+ ...o,
791
797
  children: /* @__PURE__ */ e(
792
798
  "div",
793
799
  {
794
800
  "data-sidebar": "sidebar",
795
801
  "data-slot": "sidebar-inner",
796
802
  className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
797
- children: o
803
+ children: i
798
804
  }
799
805
  )
800
806
  }
@@ -803,8 +809,8 @@ function Ln({
803
809
  }
804
810
  );
805
811
  }
806
- function Pn({ className: t, onClick: a, ...n }) {
807
- const { toggleSidebar: r } = be(), { t: o } = _("sidebar");
812
+ function Ln({ className: t, onClick: a, ...n }) {
813
+ const { toggleSidebar: r } = be(), { t: i } = q("sidebar");
808
814
  return /* @__PURE__ */ s(
809
815
  $,
810
816
  {
@@ -812,14 +818,14 @@ function Pn({ className: t, onClick: a, ...n }) {
812
818
  "data-slot": "sidebar-trigger",
813
819
  variant: "ghost",
814
820
  size: "icon",
815
- className: y("size-7", t),
816
- onClick: (i) => {
817
- a?.(i), r();
821
+ className: x("size-7", t),
822
+ onClick: (o) => {
823
+ a?.(o), r();
818
824
  },
819
825
  ...n,
820
826
  children: [
821
- /* @__PURE__ */ e(Yt, {}),
822
- /* @__PURE__ */ e("span", { className: "sr-only", children: o("toggle") })
827
+ /* @__PURE__ */ e(Xt, {}),
828
+ /* @__PURE__ */ e("span", { className: "sr-only", children: i("toggle") })
823
829
  ]
824
830
  }
825
831
  );
@@ -830,7 +836,7 @@ function Mn({ className: t, ...a }) {
830
836
  {
831
837
  "data-slot": "sidebar-content",
832
838
  "data-sidebar": "content",
833
- className: y(
839
+ className: x(
834
840
  "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
835
841
  t
836
842
  ),
@@ -838,51 +844,51 @@ function Mn({ className: t, ...a }) {
838
844
  }
839
845
  );
840
846
  }
841
- function En({ className: t, ...a }) {
847
+ function Pn({ className: t, ...a }) {
842
848
  return /* @__PURE__ */ e(
843
849
  "div",
844
850
  {
845
851
  "data-slot": "sidebar-group",
846
852
  "data-sidebar": "group",
847
- className: y("relative flex w-full min-w-0 flex-col p-2", t),
853
+ className: x("relative flex w-full min-w-0 flex-col p-2", t),
848
854
  ...a
849
855
  }
850
856
  );
851
857
  }
852
- function He({ className: t, ...a }) {
858
+ function Ge({ className: t, ...a }) {
853
859
  return /* @__PURE__ */ e(
854
860
  "div",
855
861
  {
856
862
  "data-slot": "sidebar-group-content",
857
863
  "data-sidebar": "group-content",
858
- className: y("w-full text-sm", t),
864
+ className: x("w-full text-sm", t),
859
865
  ...a
860
866
  }
861
867
  );
862
868
  }
863
- function yt({ className: t, ...a }) {
869
+ function xt({ className: t, ...a }) {
864
870
  return /* @__PURE__ */ e(
865
871
  "ul",
866
872
  {
867
873
  "data-slot": "sidebar-menu",
868
874
  "data-sidebar": "menu",
869
- className: y("flex w-full min-w-0 flex-col gap-1", t),
875
+ className: x("flex w-full min-w-0 flex-col gap-1", t),
870
876
  ...a
871
877
  }
872
878
  );
873
879
  }
874
- function Nt({ className: t, ...a }) {
880
+ function yt({ className: t, ...a }) {
875
881
  return /* @__PURE__ */ e(
876
882
  "li",
877
883
  {
878
884
  "data-slot": "sidebar-menu-item",
879
885
  "data-sidebar": "menu-item",
880
- className: y("group/menu-item relative", t),
886
+ className: x("group/menu-item relative", t),
881
887
  ...a
882
888
  }
883
889
  );
884
890
  }
885
- const zn = Gt(
891
+ const An = Bt(
886
892
  "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-start text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
887
893
  {
888
894
  variants: {
@@ -902,43 +908,43 @@ const zn = Gt(
902
908
  }
903
909
  }
904
910
  );
905
- function wt({
911
+ function Nt({
906
912
  asChild: t = !1,
907
913
  isActive: a = !1,
908
914
  variant: n = "default",
909
915
  size: r = "default",
910
- tooltip: o,
911
- className: i,
916
+ tooltip: i,
917
+ className: o,
912
918
  ...m
913
919
  }) {
914
- const u = t ? Bt : "button", { isMobile: g, state: c } = be(), h = /* @__PURE__ */ e(
920
+ const u = t ? jt : "button", { isMobile: g, state: c } = be(), h = /* @__PURE__ */ e(
915
921
  u,
916
922
  {
917
923
  "data-slot": "sidebar-menu-button",
918
924
  "data-sidebar": "menu-button",
919
925
  "data-size": r,
920
926
  "data-active": a,
921
- className: y(zn({ variant: n, size: r }), i),
927
+ className: x(An({ variant: n, size: r }), o),
922
928
  ...m
923
929
  }
924
930
  );
925
- return o ? (typeof o == "string" && (o = {
926
- children: o
927
- }), /* @__PURE__ */ s(ct, { children: [
928
- /* @__PURE__ */ e(dt, { asChild: !0, children: h }),
929
- /* @__PURE__ */ e(ut, { side: "right", align: "center", hidden: c !== "collapsed" || g, ...o })
931
+ return i ? (typeof i == "string" && (i = {
932
+ children: i
933
+ }), /* @__PURE__ */ s(lt, { children: [
934
+ /* @__PURE__ */ e(ct, { asChild: !0, children: h }),
935
+ /* @__PURE__ */ e(dt, { side: "right", align: "center", hidden: c !== "collapsed" || g, ...i })
930
936
  ] })) : h;
931
937
  }
932
- function St({
938
+ function wt({
933
939
  label: t,
934
940
  detail: a,
935
941
  meter: n,
936
942
  remaining: r,
937
- amount: o,
938
- resetsAt: i,
943
+ amount: i,
944
+ resetsAt: o,
939
945
  action: m
940
946
  }) {
941
- const { t: u, i18n: g } = _(["quota"]), c = Ra(r, o);
947
+ const { t: u, i18n: g } = q(["quota"]), c = Ea(r, i);
942
948
  return /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
943
949
  /* @__PURE__ */ s("div", { className: "flex items-baseline justify-between gap-3 text-sm", children: [
944
950
  /* @__PURE__ */ s("span", { className: "font-medium text-foreground/80", children: [
@@ -948,10 +954,10 @@ function St({
948
954
  ] }),
949
955
  /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
950
956
  /* @__PURE__ */ s("span", { className: "font-semibold tabular-nums text-foreground", children: [
951
- Ue(n, r, g.language),
957
+ $e(n, r, g.language),
952
958
  /* @__PURE__ */ s("span", { className: "text-muted-foreground font-normal", children: [
953
959
  " / ",
954
- Ue(n, o, g.language)
960
+ $e(n, i, g.language)
955
961
  ] })
956
962
  ] }),
957
963
  m
@@ -963,44 +969,44 @@ function St({
963
969
  className: "h-2 w-full bg-muted/50 rounded-full overflow-hidden",
964
970
  role: "meter",
965
971
  "aria-valuemin": 0,
966
- "aria-valuemax": o,
972
+ "aria-valuemax": i,
967
973
  "aria-valuenow": r,
968
974
  "aria-label": typeof t == "string" ? t : void 0,
969
975
  children: /* @__PURE__ */ e(
970
976
  "div",
971
977
  {
972
- className: y("h-full rounded-full transition-all duration-700", Ea(c)),
978
+ className: x("h-full rounded-full transition-all duration-700", Pa(c)),
973
979
  style: { width: `${c}%` }
974
980
  }
975
981
  )
976
982
  }
977
983
  ),
978
- i && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: u("quota:resets_at", { datetime: ht(i, g.language) }) })
984
+ o && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: u("quota:resets_at", { datetime: mt(o, g.language) }) })
979
985
  ] });
980
986
  }
981
- function Rn({ windows: t, className: a, renderAction: n }) {
982
- const { t: r } = _(["quota"]);
983
- return /* @__PURE__ */ e("div", { className: y("space-y-4", a), children: t.map((o) => /* @__PURE__ */ e(
984
- St,
987
+ function En({ windows: t, className: a, renderAction: n }) {
988
+ const { t: r } = q(["quota"]);
989
+ return /* @__PURE__ */ e("div", { className: x("space-y-4", a), children: t.map((i) => /* @__PURE__ */ e(
990
+ wt,
985
991
  {
986
- label: mt(r, o.meter),
987
- detail: za(r, o),
988
- meter: o.meter,
989
- remaining: o.remaining,
990
- amount: o.amount,
991
- resetsAt: o.resets_at,
992
- action: n?.(o)
992
+ label: ut(r, i.meter),
993
+ detail: Aa(r, i),
994
+ meter: i.meter,
995
+ remaining: i.remaining,
996
+ amount: i.amount,
997
+ resetsAt: i.resets_at,
998
+ action: n?.(i)
993
999
  },
994
- o.key
1000
+ i.key
995
1001
  )) });
996
1002
  }
997
- function An({ credits: t, action: a }) {
998
- const { t: n } = _(["quota"]);
1003
+ function zn({ credits: t, action: a }) {
1004
+ const { t: n } = q(["quota"]);
999
1005
  return /* @__PURE__ */ e(
1000
- St,
1006
+ wt,
1001
1007
  {
1002
1008
  label: n("quota:credits"),
1003
- detail: n("quota:credits_unit", { meter: mt(n, t.meter) }),
1009
+ detail: n("quota:credits_unit", { meter: ut(n, t.meter) }),
1004
1010
  meter: t.meter,
1005
1011
  remaining: t.remaining,
1006
1012
  amount: t.granted,
@@ -1008,139 +1014,160 @@ function An({ credits: t, action: a }) {
1008
1014
  }
1009
1015
  );
1010
1016
  }
1011
- const Fn = ["system", "light", "dark"], Ve = "h-11 w-full rounded-xl border-border/50 bg-muted/30 text-base", Ke = "rounded-xl border-border/40 bg-background shadow-xl", Qe = "rounded-lg py-2 text-base focus:bg-primary/10";
1012
- function Dn() {
1013
- const { t, i18n: a } = _("settings"), n = K((b) => b.app), { theme: r, setTheme: o, locked: i } = ie(), { language: m, setLanguage: u, locked: g, dir: c } = ee(), h = Oe(), p = Oe(), f = Wa(a, n?.languages), v = f.find((b) => b === m) ?? m.split("-")[0];
1017
+ const Rn = ["system", "light", "dark"], He = "h-11 w-full rounded-xl border-border/50 bg-muted/30 text-base", Ve = "rounded-xl border-border/40 bg-background shadow-xl", Ke = "rounded-lg py-2 text-base focus:bg-primary/10";
1018
+ function Dn({
1019
+ sectionMode: t = "editable",
1020
+ themeMode: a = "editable",
1021
+ languageMode: n = "editable"
1022
+ } = {}) {
1023
+ const { t: r, i18n: i } = q("settings"), o = H((T) => T.app), { theme: m, setTheme: u, locked: g } = se(), { language: c, setLanguage: h, locked: p, dir: f } = J(), b = Fe(), _ = Fe(), v = Qa(i, o?.languages), k = v.find((T) => T === c) ?? c.split("-")[0], I = !g && a !== "hidden", y = !p && n !== "hidden", U = t === "faded" || a === "faded", D = t === "faded" || n === "faded";
1014
1024
  return /* @__PURE__ */ s("div", { className: "grid gap-6", children: [
1015
- !i && /* @__PURE__ */ s("div", { className: "flex flex-col gap-3", children: [
1016
- /* @__PURE__ */ e(L, { htmlFor: h, className: "px-1", children: t("general.theme") }),
1017
- /* @__PURE__ */ s(
1018
- we,
1019
- {
1020
- value: r,
1021
- onValueChange: (b) => o(b),
1022
- dir: c,
1023
- children: [
1024
- /* @__PURE__ */ e(Se, { id: h, className: Ve, children: /* @__PURE__ */ e(ke, {}) }),
1025
- /* @__PURE__ */ e(Ce, { className: Ke, children: Fn.map((b) => /* @__PURE__ */ e(_e, { value: b, className: Qe, children: t(`general.themes.${b}`) }, b)) })
1026
- ]
1027
- }
1028
- )
1029
- ] }),
1030
- !g && /* @__PURE__ */ s("div", { className: "flex flex-col gap-3", children: [
1031
- /* @__PURE__ */ e(L, { htmlFor: p, className: "px-1", children: t("general.language") }),
1032
- /* @__PURE__ */ s(we, { value: v, onValueChange: u, dir: c, children: [
1033
- /* @__PURE__ */ e(Se, { id: p, className: Ve, children: /* @__PURE__ */ e(ke, {}) }),
1034
- /* @__PURE__ */ e(Ce, { className: Ke, children: f.map((b) => /* @__PURE__ */ e(_e, { value: b, lang: b, className: Qe, children: Xa(b) }, b)) })
1035
- ] })
1036
- ] })
1025
+ I && /* @__PURE__ */ s(
1026
+ "div",
1027
+ {
1028
+ className: `flex flex-col gap-3 ${U ? "opacity-60 pointer-events-none" : ""}`,
1029
+ children: [
1030
+ /* @__PURE__ */ e(A, { htmlFor: b, className: "px-1", children: r("general.theme") }),
1031
+ /* @__PURE__ */ s(
1032
+ we,
1033
+ {
1034
+ value: m,
1035
+ onValueChange: (T) => u(T),
1036
+ dir: f,
1037
+ disabled: U,
1038
+ children: [
1039
+ /* @__PURE__ */ e(Se, { id: b, className: He, children: /* @__PURE__ */ e(ke, {}) }),
1040
+ /* @__PURE__ */ e(Ce, { className: Ve, children: Rn.map((T) => /* @__PURE__ */ e(_e, { value: T, className: Ke, children: r(`general.themes.${T}`) }, T)) })
1041
+ ]
1042
+ }
1043
+ )
1044
+ ]
1045
+ }
1046
+ ),
1047
+ y && /* @__PURE__ */ s(
1048
+ "div",
1049
+ {
1050
+ className: `flex flex-col gap-3 ${D ? "opacity-60 pointer-events-none" : ""}`,
1051
+ children: [
1052
+ /* @__PURE__ */ e(A, { htmlFor: _, className: "px-1", children: r("general.language") }),
1053
+ /* @__PURE__ */ s(we, { value: k, onValueChange: h, dir: f, disabled: D, children: [
1054
+ /* @__PURE__ */ e(Se, { id: _, className: He, children: /* @__PURE__ */ e(ke, {}) }),
1055
+ /* @__PURE__ */ e(Ce, { className: Ve, children: v.map((T) => /* @__PURE__ */ e(_e, { value: T, lang: T, className: Ke, children: Wa(T) }, T)) })
1056
+ ] })
1057
+ ]
1058
+ }
1059
+ )
1037
1060
  ] });
1038
1061
  }
1039
- function On({ trigger: t }) {
1040
- const { t: a, i18n: n } = _(["settings"]), r = K((l) => l.app), o = te((l) => l.settings), i = Re(), m = at(), u = $t(), [g, c] = N(!1), { data: h, refetch: p } = Ut({
1062
+ function Fn({ trigger: t }) {
1063
+ const { t: a, i18n: n } = q(["settings"]), r = H((l) => l.app), i = ee((l) => l.settings), o = ze(), m = tt(), u = Ot(), [g, c] = S(!1), { data: h, refetch: p } = $t({
1041
1064
  enabled: g
1042
- }), f = Ee(null), { locked: v } = ie(), { locked: b } = ee(), k = !v || !b, T = O(() => [
1043
- { id: "profile", label: a("sections.profile", "Profile"), icon: Zt },
1044
- { id: "general", label: a("sections.general"), icon: Jt },
1045
- { id: "account", label: a("sections.account", "Account"), icon: ea }
1065
+ }), f = Ae(null), { locked: b } = se(), { locked: _ } = J(), v = O(() => [
1066
+ { id: "profile", label: a("sections.profile", "Profile"), icon: Yt },
1067
+ { id: "general", label: a("sections.general"), icon: Zt },
1068
+ { id: "account", label: a("sections.account", "Account"), icon: Jt }
1046
1069
  ].filter((C) => {
1047
- if (C.id === "general") return k;
1048
- const S = o?.sections?.[C.id];
1049
- return (S?.mode ?? (S?.enabled === !1 ? "hidden" : "editable")) !== "hidden";
1050
- }), [a, o, k]), [w, M] = N(T[0]?.id || "profile"), I = Le(
1051
- (l, C, S = "editable") => {
1052
- const me = o?.sections?.[l]?.fields;
1053
- return me && me[C] || S;
1070
+ const w = i?.sections?.[C.id];
1071
+ if ((w?.mode ?? (w?.enabled === !1 ? "hidden" : "editable")) === "hidden") return !1;
1072
+ if (C.id === "general") {
1073
+ const me = w?.fields?.theme ?? "editable", xe = w?.fields?.language ?? "editable";
1074
+ return !b && me !== "hidden" || !_ && xe !== "hidden";
1075
+ }
1076
+ return !0;
1077
+ }), [a, i, b, _]), [k, I] = S(v[0]?.id || "profile"), y = Le(
1078
+ (l, C, w = "editable") => {
1079
+ const ue = i?.sections?.[l]?.fields;
1080
+ return ue && ue[C] || w;
1054
1081
  },
1055
- [o]
1056
- ), [B, W] = N(""), [ae, G] = N(""), [X, E] = N(""), [le, ve] = N(""), [ce, xe] = N(""), [H, z] = N(""), U = O(
1082
+ [i]
1083
+ ), [U, D] = S(""), [T, te] = S(""), [V, X] = S(""), [z, oe] = S(""), [ve, le] = S(""), [ce, Y] = S(""), L = O(
1057
1084
  () => r?.userMetadataFields?.filter((l) => l.showInProfile) || [],
1058
1085
  [r?.userMetadataFields]
1059
- ), [q, A] = N({}), [Y, Z] = N(!1), de = ee().dir === "rtl", ue = Le(async () => {
1086
+ ), [M, j] = S({}), [B, Z] = S(!1), K = J().dir === "rtl", de = Le(async () => {
1060
1087
  try {
1061
1088
  p();
1062
- const l = await i.getMe();
1063
- W(l.name || ""), G(l.surname || ""), E(l.username || ""), ve(l.email || ""), xe(l.phone || "");
1089
+ const l = await o.getMe();
1090
+ D(l.name || ""), te(l.surname || ""), X(l.username || ""), oe(l.email || ""), le(l.phone || "");
1064
1091
  const C = {};
1065
- U.forEach((S) => {
1066
- C[S.key] = l.metadata?.[S.key] ?? S.defaultValue ?? "";
1067
- }), A(C);
1092
+ L.forEach((w) => {
1093
+ C[w.key] = l.metadata?.[w.key] ?? w.defaultValue ?? "";
1094
+ }), j(C);
1068
1095
  } catch (l) {
1069
- console.error("Failed to fetch user:", l), P.error(se(l, a));
1096
+ console.error("Failed to fetch user:", l), E.error(re(l, a));
1070
1097
  }
1071
- }, [a, U, i, p]);
1072
- F(() => {
1098
+ }, [a, L, o, p]);
1099
+ R(() => {
1073
1100
  if (!g) {
1074
1101
  f.current = null;
1075
1102
  return;
1076
1103
  }
1077
- (f.current === null || w === "account") && ue(), f.current = w;
1078
- }, [g, w, ue]), F(() => {
1079
- const l = { ...q };
1104
+ (f.current === null || k === "account") && de(), f.current = k;
1105
+ }, [g, k, de]), R(() => {
1106
+ const l = { ...M };
1080
1107
  let C = !1;
1081
- U.forEach((S) => {
1082
- S.condition && !Te(S.condition, q) && l[S.key] !== void 0 && (delete l[S.key], C = !0);
1083
- }), C && A(l);
1084
- }, [q, U]);
1085
- const d = async () => {
1108
+ L.forEach((w) => {
1109
+ w.condition && !Te(w.condition, M) && l[w.key] !== void 0 && (delete l[w.key], C = !0);
1110
+ }), C && j(l);
1111
+ }, [M, L]);
1112
+ const Ie = async () => {
1086
1113
  Z(!0);
1087
1114
  try {
1088
1115
  const l = {
1089
- name: B,
1090
- surname: ae,
1091
- username: X || void 0,
1092
- email: le || void 0,
1093
- phone: ce || void 0,
1094
- metadata: q
1116
+ name: U,
1117
+ surname: T,
1118
+ username: V || void 0,
1119
+ email: z || void 0,
1120
+ phone: ve || void 0,
1121
+ metadata: M
1095
1122
  };
1096
- H && (l.password = H);
1097
- const C = await i.updateMe(l);
1098
- m.setQueryData(u.currentUser(), C), P.success(a("profile.success", "Profile updated successfully")), z(""), ue();
1123
+ ce && (l.password = ce);
1124
+ const C = await o.updateMe(l);
1125
+ m.setQueryData(u.currentUser(), C), E.success(a("profile.success", "Profile updated successfully")), Y(""), de();
1099
1126
  } catch (l) {
1100
- P.error(se(l, a));
1127
+ E.error(re(l, a));
1101
1128
  } finally {
1102
1129
  Z(!1);
1103
1130
  }
1104
- }, x = async () => {
1131
+ }, d = async () => {
1105
1132
  if (window.confirm(a("account.logout_confirm", "Are you sure you want to logout?")))
1106
1133
  try {
1107
- await i.logout(), window.location.reload();
1134
+ await o.logout(), window.location.reload();
1108
1135
  } catch (l) {
1109
- P.error(se(l, a));
1136
+ E.error(re(l, a));
1110
1137
  }
1111
- }, J = o?.sections?.account?.fields?.usage ?? "editable";
1112
- return /* @__PURE__ */ s(gt, { open: g, onOpenChange: c, children: [
1113
- /* @__PURE__ */ e(Aa, { asChild: !0, children: t || /* @__PURE__ */ e($, { variant: "ghost", size: "icon", className: "rounded-full", children: /* @__PURE__ */ e(Pe, { className: "h-5 w-5" }) }) }),
1138
+ }, P = i?.sections?.account?.fields?.usage ?? "editable";
1139
+ return /* @__PURE__ */ s(ht, { open: g, onOpenChange: c, children: [
1140
+ /* @__PURE__ */ e(za, { asChild: !0, children: t || /* @__PURE__ */ e($, { variant: "ghost", size: "icon", className: "rounded-full", children: /* @__PURE__ */ e(Me, { className: "h-5 w-5" }) }) }),
1114
1141
  /* @__PURE__ */ e(
1115
- pt,
1142
+ gt,
1116
1143
  {
1117
- dir: de ? "rtl" : "ltr",
1118
- className: y(
1144
+ dir: K ? "rtl" : "ltr",
1145
+ className: x(
1119
1146
  "w-full sm:w-[95vw] sm:max-w-[700px] p-0 gap-0 overflow-hidden rounded-t-2xl sm:rounded-3xl border-none shadow-lg bg-background h-[90vh] sm:h-[min(750px,90vh)]",
1120
- de && "rtl"
1147
+ K && "rtl"
1121
1148
  ),
1122
1149
  children: /* @__PURE__ */ s("div", { className: "flex flex-col h-full w-full min-h-0 overflow-hidden", children: [
1123
1150
  /* @__PURE__ */ s("div", { className: "w-full bg-muted/20 sm:bg-muted/30 border-b border-border/40 pt-12 sm:pt-6 flex flex-col shrink-0", children: [
1124
1151
  /* @__PURE__ */ e("div", { className: "flex items-center justify-between px-4 sm:px-6 mb-2 sm:mb-4", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
1125
- /* @__PURE__ */ e("div", { className: "bg-primary/10 p-1.5 rounded-lg", children: /* @__PURE__ */ e(Pe, { className: "h-5 w-5 text-primary" }) }),
1152
+ /* @__PURE__ */ e("div", { className: "bg-primary/10 p-1.5 rounded-lg", children: /* @__PURE__ */ e(Me, { className: "h-5 w-5 text-primary" }) }),
1126
1153
  /* @__PURE__ */ e("span", { className: "font-bold text-lg", children: a("title", "Settings") })
1127
1154
  ] }) }),
1128
- /* @__PURE__ */ e("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ e("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children: T.map((l) => /* @__PURE__ */ s(
1155
+ /* @__PURE__ */ e("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ e("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children: v.map((l) => /* @__PURE__ */ s(
1129
1156
  "button",
1130
1157
  {
1131
- onClick: () => M(l.id),
1132
- className: y(
1158
+ onClick: () => I(l.id),
1159
+ className: x(
1133
1160
  "flex items-center gap-1.5 sm:gap-2 pb-2 sm:pb-3 pt-1 px-2 sm:px-1 text-sm sm:text-base font-medium transition-all border-b-2 whitespace-nowrap shrink-0",
1134
- w === l.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
1135
- l.id !== "general" && o?.sections?.[l.id]?.mode === "faded" && "opacity-50 pointer-events-none select-none"
1161
+ k === l.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
1162
+ l.id !== "general" && i?.sections?.[l.id]?.mode === "faded" && "opacity-50 pointer-events-none select-none"
1136
1163
  ),
1137
1164
  children: [
1138
1165
  /* @__PURE__ */ e(
1139
1166
  l.icon,
1140
1167
  {
1141
- className: y(
1168
+ className: x(
1142
1169
  "h-3.5 w-3.5 sm:h-4 sm:w-4 transition-transform",
1143
- w === l.id && "scale-110"
1170
+ k === l.id && "scale-110"
1144
1171
  )
1145
1172
  }
1146
1173
  ),
@@ -1151,30 +1178,30 @@ function On({ trigger: t }) {
1151
1178
  )) }) })
1152
1179
  ] }),
1153
1180
  /* @__PURE__ */ e("div", { className: "flex-1 relative min-h-0 h-full bg-background", children: /* @__PURE__ */ s("div", { className: "absolute inset-0 overflow-y-auto p-5 sm:p-8 pt-12 sm:pt-12 custom-scrollbar", children: [
1154
- w === "profile" && /* @__PURE__ */ s("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1181
+ k === "profile" && /* @__PURE__ */ s("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1155
1182
  /* @__PURE__ */ s("div", { children: [
1156
1183
  /* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: a("profile.title", "Profile Information") }),
1157
1184
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a("profile.subtitle", "Update your personal details below.") })
1158
1185
  ] }),
1159
1186
  /* @__PURE__ */ s("div", { className: "grid gap-6", children: [
1160
1187
  /* @__PURE__ */ s("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
1161
- I("profile", "name") !== "hidden" && /* @__PURE__ */ s(
1188
+ y("profile", "name") !== "hidden" && /* @__PURE__ */ s(
1162
1189
  "div",
1163
1190
  {
1164
- className: y(
1191
+ className: x(
1165
1192
  "flex flex-col gap-3",
1166
- I("profile", "name") === "faded" && "opacity-50 pointer-events-none select-none"
1193
+ y("profile", "name") === "faded" && "opacity-50 pointer-events-none select-none"
1167
1194
  ),
1168
1195
  children: [
1169
- /* @__PURE__ */ e(L, { htmlFor: "name", className: "px-1", children: a("profile.name", "First Name") }),
1196
+ /* @__PURE__ */ e(A, { htmlFor: "name", className: "px-1", children: a("profile.name", "First Name") }),
1170
1197
  /* @__PURE__ */ e(
1171
- D,
1198
+ F,
1172
1199
  {
1173
1200
  id: "name",
1174
- value: B,
1175
- onChange: (l) => W(l.target.value),
1176
- disabled: I("profile", "name") === "faded",
1177
- className: y(
1201
+ value: U,
1202
+ onChange: (l) => D(l.target.value),
1203
+ disabled: y("profile", "name") === "faded",
1204
+ className: x(
1178
1205
  "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
1179
1206
  "text-start"
1180
1207
  )
@@ -1183,23 +1210,23 @@ function On({ trigger: t }) {
1183
1210
  ]
1184
1211
  }
1185
1212
  ),
1186
- I("profile", "surname") !== "hidden" && /* @__PURE__ */ s(
1213
+ y("profile", "surname") !== "hidden" && /* @__PURE__ */ s(
1187
1214
  "div",
1188
1215
  {
1189
- className: y(
1216
+ className: x(
1190
1217
  "flex flex-col gap-3",
1191
- I("profile", "surname") === "faded" && "opacity-50 pointer-events-none select-none"
1218
+ y("profile", "surname") === "faded" && "opacity-50 pointer-events-none select-none"
1192
1219
  ),
1193
1220
  children: [
1194
- /* @__PURE__ */ e(L, { htmlFor: "surname", className: "px-1", children: a("profile.surname", "Last Name") }),
1221
+ /* @__PURE__ */ e(A, { htmlFor: "surname", className: "px-1", children: a("profile.surname", "Last Name") }),
1195
1222
  /* @__PURE__ */ e(
1196
- D,
1223
+ F,
1197
1224
  {
1198
1225
  id: "surname",
1199
- value: ae,
1200
- onChange: (l) => G(l.target.value),
1201
- disabled: I("profile", "surname") === "faded",
1202
- className: y(
1226
+ value: T,
1227
+ onChange: (l) => te(l.target.value),
1228
+ disabled: y("profile", "surname") === "faded",
1229
+ className: x(
1203
1230
  "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
1204
1231
  "text-start"
1205
1232
  )
@@ -1210,32 +1237,32 @@ function On({ trigger: t }) {
1210
1237
  )
1211
1238
  ] }),
1212
1239
  [
1213
- { key: "username", icon: ta, value: X, set: E },
1214
- { key: "email", icon: aa, value: le, set: ve },
1215
- { key: "phone", icon: na, value: ce, set: xe }
1216
- ].map(({ key: l, icon: C, value: S, set: me }) => {
1217
- const Ie = I("profile", l);
1218
- return Ie === "hidden" ? null : /* @__PURE__ */ s(
1240
+ { key: "username", icon: ea, value: V, set: X },
1241
+ { key: "email", icon: ta, value: z, set: oe },
1242
+ { key: "phone", icon: aa, value: ve, set: le }
1243
+ ].map(({ key: l, icon: C, value: w, set: ue }) => {
1244
+ const me = y("profile", l);
1245
+ return me === "hidden" ? null : /* @__PURE__ */ s(
1219
1246
  "div",
1220
1247
  {
1221
- className: y(
1248
+ className: x(
1222
1249
  "flex flex-col gap-3",
1223
- Ie === "faded" && "opacity-50 pointer-events-none select-none"
1250
+ me === "faded" && "opacity-50 pointer-events-none select-none"
1224
1251
  ),
1225
1252
  children: [
1226
- /* @__PURE__ */ e(L, { htmlFor: l, className: "px-1 text-start", children: a(`profile.${l}`) }),
1253
+ /* @__PURE__ */ e(A, { htmlFor: l, className: "px-1 text-start", children: a(`profile.${l}`) }),
1227
1254
  /* @__PURE__ */ s("div", { className: "relative", children: [
1228
1255
  /* @__PURE__ */ e(C, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground start-3" }),
1229
1256
  /* @__PURE__ */ e(
1230
- D,
1257
+ F,
1231
1258
  {
1232
1259
  id: l,
1233
1260
  type: l === "email" ? "email" : "text",
1234
- value: S,
1235
- onChange: (De) => me(
1236
- l === "phone" ? De.target.value.replace(/[^0-9]/g, "") : De.target.value
1261
+ value: w,
1262
+ onChange: (xe) => ue(
1263
+ l === "phone" ? xe.target.value.replace(/[^0-9]/g, "") : xe.target.value
1237
1264
  ),
1238
- disabled: Ie === "faded",
1265
+ disabled: me === "faded",
1239
1266
  className: "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary ps-10 pe-3 text-start",
1240
1267
  dir: "ltr"
1241
1268
  }
@@ -1246,25 +1273,25 @@ function On({ trigger: t }) {
1246
1273
  l
1247
1274
  );
1248
1275
  }),
1249
- I("profile", "password") !== "hidden" && /* @__PURE__ */ s(
1276
+ y("profile", "password") !== "hidden" && /* @__PURE__ */ s(
1250
1277
  "div",
1251
1278
  {
1252
- className: y(
1279
+ className: x(
1253
1280
  "flex flex-col gap-3",
1254
- I("profile", "password") === "faded" && "opacity-50 pointer-events-none select-none"
1281
+ y("profile", "password") === "faded" && "opacity-50 pointer-events-none select-none"
1255
1282
  ),
1256
1283
  children: [
1257
- /* @__PURE__ */ e(L, { htmlFor: "pass", className: "px-1 text-start", children: a("profile.password", "New Password") }),
1284
+ /* @__PURE__ */ e(A, { htmlFor: "pass", className: "px-1 text-start", children: a("profile.password", "New Password") }),
1258
1285
  /* @__PURE__ */ s("div", { className: "relative", children: [
1259
- /* @__PURE__ */ e(ra, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground start-3" }),
1286
+ /* @__PURE__ */ e(na, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground start-3" }),
1260
1287
  /* @__PURE__ */ e(
1261
- D,
1288
+ F,
1262
1289
  {
1263
1290
  id: "pass",
1264
1291
  type: "password",
1265
- value: H,
1266
- onChange: (l) => z(l.target.value),
1267
- disabled: I("profile", "password") === "faded",
1292
+ value: ce,
1293
+ onChange: (l) => Y(l.target.value),
1294
+ disabled: y("profile", "password") === "faded",
1268
1295
  placeholder: a(
1269
1296
  "profile.password_placeholder",
1270
1297
  "Leave empty to keep current"
@@ -1277,24 +1304,24 @@ function On({ trigger: t }) {
1277
1304
  ]
1278
1305
  }
1279
1306
  ),
1280
- U.map((l) => {
1281
- const C = I("profile", l.key, l.mode || "editable");
1282
- return C === "hidden" || !Te(l.condition, q) ? null : /* @__PURE__ */ s(
1307
+ L.map((l) => {
1308
+ const C = y("profile", l.key, l.mode || "editable");
1309
+ return C === "hidden" || !Te(l.condition, M) ? null : /* @__PURE__ */ s(
1283
1310
  "div",
1284
1311
  {
1285
- className: y(
1312
+ className: x(
1286
1313
  "flex flex-col gap-3 animate-in fade-in slide-in-from-top-1 duration-200",
1287
1314
  C === "faded" && "opacity-50 pointer-events-none select-none"
1288
1315
  ),
1289
1316
  children: [
1290
- /* @__PURE__ */ e(L, { htmlFor: `profile-${l.key}`, className: "px-1", children: a(l.label) }),
1317
+ /* @__PURE__ */ e(A, { htmlFor: `profile-${l.key}`, className: "px-1", children: a(l.label) }),
1291
1318
  l.type === "select" ? /* @__PURE__ */ s(
1292
1319
  we,
1293
1320
  {
1294
- value: String(q[l.key] || ""),
1295
- onValueChange: (S) => A({ ...q, [l.key]: S }),
1321
+ value: String(M[l.key] || ""),
1322
+ onValueChange: (w) => j({ ...M, [l.key]: w }),
1296
1323
  disabled: C === "faded",
1297
- dir: de ? "rtl" : "ltr",
1324
+ dir: K ? "rtl" : "ltr",
1298
1325
  children: [
1299
1326
  /* @__PURE__ */ e(Se, { className: "bg-muted/30 border-border/50 rounded-xl focus:ring-primary h-11", children: /* @__PURE__ */ e(
1300
1327
  ke,
@@ -1302,14 +1329,14 @@ function On({ trigger: t }) {
1302
1329
  placeholder: a(l.placeholder || "profile.select_placeholder")
1303
1330
  }
1304
1331
  ) }),
1305
- /* @__PURE__ */ e(Ce, { className: "rounded-xl border-border/40 shadow-xl bg-background", children: l.options?.map((S) => /* @__PURE__ */ e(
1332
+ /* @__PURE__ */ e(Ce, { className: "rounded-xl border-border/40 shadow-xl bg-background", children: l.options?.map((w) => /* @__PURE__ */ e(
1306
1333
  _e,
1307
1334
  {
1308
- value: String(S.value),
1335
+ value: String(w.value),
1309
1336
  className: "rounded-lg focus:bg-primary/10",
1310
- children: a(S.label)
1337
+ children: a(w.label)
1311
1338
  },
1312
- String(S.value)
1339
+ String(w.value)
1313
1340
  )) })
1314
1341
  ]
1315
1342
  }
@@ -1319,14 +1346,14 @@ function On({ trigger: t }) {
1319
1346
  {
1320
1347
  id: `profile-${l.key}`,
1321
1348
  type: "checkbox",
1322
- checked: !!q[l.key],
1349
+ checked: !!M[l.key],
1323
1350
  disabled: C === "faded",
1324
- onChange: (S) => A({ ...q, [l.key]: S.target.checked }),
1351
+ onChange: (w) => j({ ...M, [l.key]: w.target.checked }),
1325
1352
  className: "h-5 w-5 rounded-md border-border/50 bg-muted/30 text-primary focus:ring-primary transition-all cursor-pointer"
1326
1353
  }
1327
1354
  ),
1328
1355
  /* @__PURE__ */ e(
1329
- L,
1356
+ A,
1330
1357
  {
1331
1358
  htmlFor: `profile-${l.key}`,
1332
1359
  className: "text-sm font-medium text-muted-foreground cursor-pointer",
@@ -1334,15 +1361,15 @@ function On({ trigger: t }) {
1334
1361
  }
1335
1362
  )
1336
1363
  ] }) : /* @__PURE__ */ e(
1337
- D,
1364
+ F,
1338
1365
  {
1339
1366
  id: `profile-${l.key}`,
1340
1367
  type: l.type,
1341
- value: q[l.key] || "",
1368
+ value: M[l.key] || "",
1342
1369
  disabled: C === "faded",
1343
- onChange: (S) => A({ ...q, [l.key]: S.target.value }),
1370
+ onChange: (w) => j({ ...M, [l.key]: w.target.value }),
1344
1371
  placeholder: a(l.placeholder || ""),
1345
- className: y(
1372
+ className: x(
1346
1373
  "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
1347
1374
  "text-start"
1348
1375
  )
@@ -1356,52 +1383,59 @@ function On({ trigger: t }) {
1356
1383
  /* @__PURE__ */ e("div", { className: "pt-4 flex justify-center", children: /* @__PURE__ */ s(
1357
1384
  $,
1358
1385
  {
1359
- onClick: d,
1360
- disabled: Y,
1386
+ onClick: Ie,
1387
+ disabled: B,
1361
1388
  className: "w-full sm:w-auto px-8 rounded-xl gap-2 font-semibold h-11 transition-all active:scale-[0.98]",
1362
1389
  children: [
1363
- /* @__PURE__ */ e(sa, { className: "h-4 w-4" }),
1364
- Y ? a("profile.saving", "Saving...") : a("profile.save", "Save Changes")
1390
+ /* @__PURE__ */ e(ra, { className: "h-4 w-4" }),
1391
+ B ? a("profile.saving", "Saving...") : a("profile.save", "Save Changes")
1365
1392
  ]
1366
1393
  }
1367
1394
  ) })
1368
1395
  ] })
1369
1396
  ] }),
1370
- w === "general" && /* @__PURE__ */ s("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1397
+ k === "general" && /* @__PURE__ */ s("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1371
1398
  /* @__PURE__ */ s("div", { children: [
1372
1399
  /* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: a("general.title") }),
1373
1400
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a("general.subtitle") })
1374
1401
  ] }),
1375
- /* @__PURE__ */ e(Dn, {})
1402
+ /* @__PURE__ */ e(
1403
+ Dn,
1404
+ {
1405
+ sectionMode: i?.sections?.general?.mode ?? "editable",
1406
+ themeMode: y("general", "theme"),
1407
+ languageMode: y("general", "language")
1408
+ }
1409
+ )
1376
1410
  ] }),
1377
- w === "account" && /* @__PURE__ */ s("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1411
+ k === "account" && /* @__PURE__ */ s("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1378
1412
  /* @__PURE__ */ s("div", { children: [
1379
1413
  /* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: a("account.title", "Account & Usage") }),
1380
1414
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a("account.subtitle", "Monitor your quotas and manage your session.") })
1381
1415
  ] }),
1382
1416
  /* @__PURE__ */ s("div", { className: "space-y-6", children: [
1383
- J !== "hidden" && h && /* @__PURE__ */ s(
1417
+ P !== "hidden" && h && /* @__PURE__ */ s(
1384
1418
  "div",
1385
1419
  {
1386
- className: y(
1420
+ className: x(
1387
1421
  "p-6 bg-muted/30 rounded-3xl border border-border/40 space-y-5",
1388
- J === "faded" && "opacity-50"
1422
+ P === "faded" && "opacity-50"
1389
1423
  ),
1390
1424
  children: [
1391
1425
  /* @__PURE__ */ s("div", { className: "flex items-start justify-between gap-3", children: [
1392
- /* @__PURE__ */ s(L, { className: "text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2", children: [
1393
- h.kind === "credits" ? /* @__PURE__ */ e(ia, { className: "h-4 w-4" }) : h.kind === "unlimited" ? /* @__PURE__ */ e(oa, { className: "h-4 w-4" }) : /* @__PURE__ */ e(la, { className: "h-4 w-4" }),
1426
+ /* @__PURE__ */ s(A, { className: "text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2", children: [
1427
+ h.kind === "credits" ? /* @__PURE__ */ e(sa, { className: "h-4 w-4" }) : h.kind === "unlimited" ? /* @__PURE__ */ e(ia, { className: "h-4 w-4" }) : /* @__PURE__ */ e(oa, { className: "h-4 w-4" }),
1394
1428
  a("account.usage", "Your usage")
1395
1429
  ] }),
1396
1430
  /* @__PURE__ */ s("div", { className: "text-end", children: [
1397
1431
  /* @__PURE__ */ e("p", { className: "text-sm font-semibold text-foreground", children: h.kind === "credits" ? a("account.on_credits", "Credits") : h.kind === "unlimited" ? a("account.unlimited", "No usage limits") : h.plan?.name ?? a("account.custom_plan", "Custom plan") }),
1398
1432
  h.ends_at && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a("account.plan_until", {
1399
- datetime: ht(h.ends_at, n.language)
1433
+ datetime: mt(h.ends_at, n.language)
1400
1434
  }) })
1401
1435
  ] })
1402
1436
  ] }),
1403
- h.kind === "plan" && (h.windows.length > 0 ? /* @__PURE__ */ e(Rn, { windows: h.windows }) : /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a("account.unlimited", "No usage limits") })),
1404
- h.kind === "credits" && h.credits && /* @__PURE__ */ e(An, { credits: h.credits }),
1437
+ h.kind === "plan" && (h.windows.length > 0 ? /* @__PURE__ */ e(En, { windows: h.windows }) : /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a("account.unlimited", "No usage limits") })),
1438
+ h.kind === "credits" && h.credits && /* @__PURE__ */ e(zn, { credits: h.credits }),
1405
1439
  h.kind === "unlimited" && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a(
1406
1440
  "account.unlimited_help",
1407
1441
  "You can use the assistant as much as you like."
@@ -1409,20 +1443,20 @@ function On({ trigger: t }) {
1409
1443
  ]
1410
1444
  }
1411
1445
  ),
1412
- /* @__PURE__ */ e("div", { className: "pt-2 flex flex-col gap-3", children: I("account", "logout") !== "hidden" && /* @__PURE__ */ s(
1446
+ /* @__PURE__ */ e("div", { className: "pt-2 flex flex-col gap-3", children: y("account", "logout") !== "hidden" && /* @__PURE__ */ s(
1413
1447
  $,
1414
1448
  {
1415
1449
  variant: "destructive",
1416
1450
  onClick: () => {
1417
- x();
1451
+ d();
1418
1452
  },
1419
- disabled: I("account", "logout") === "faded",
1420
- className: y(
1453
+ disabled: y("account", "logout") === "faded",
1454
+ className: x(
1421
1455
  "rounded-2xl gap-2 font-bold h-12 transition-all active:scale-[0.98]",
1422
- I("account", "logout") === "faded" && "opacity-50 pointer-events-none"
1456
+ y("account", "logout") === "faded" && "opacity-50 pointer-events-none"
1423
1457
  ),
1424
1458
  children: [
1425
- /* @__PURE__ */ e(ca, { className: "h-4 w-4" }),
1459
+ /* @__PURE__ */ e(la, { className: "h-4 w-4" }),
1426
1460
  a("account.logout", "Logout from Account")
1427
1461
  ]
1428
1462
  }
@@ -1439,40 +1473,40 @@ function On({ trigger: t }) {
1439
1473
  )
1440
1474
  ] });
1441
1475
  }
1442
- function kt({ hideActions: t = !1 }) {
1443
- const a = Je(), { t: n } = _(["sidebar", "settings"]), r = K((k) => k.app), o = te((k) => k.history), i = te((k) => k.headerActionsEnabled), { HeaderActions: m, headerActions: u, UsageMeter: g } = oe(), c = O(
1476
+ function St({ hideActions: t = !1 }) {
1477
+ const a = Ze(), { t: n } = q(["sidebar", "settings"]), r = H((v) => v.app), i = ee((v) => v.history), o = ee((v) => v.headerActionsEnabled), { HeaderActions: m, headerActions: u, UsageMeter: g } = ie(), c = O(
1444
1478
  () => (u ?? []).filter(
1445
- (k) => i?.[k.id] ?? k.defaultEnabled ?? !0
1479
+ (v) => o?.[v.id] ?? v.defaultEnabled ?? !0
1446
1480
  ),
1447
- [u, i]
1448
- ), h = ot(), { resolvedTheme: p } = ie(), f = !t && (o?.enabled ?? !0), v = O(() => r?.logo ? typeof r.logo == "string" ? r.logo : p === "dark" ? r.logo.dark : r.logo.light : Fa, [r?.logo, p]), b = r?.name || "Gentiq";
1481
+ [u, o]
1482
+ ), h = it(), { resolvedTheme: p } = se(), f = !t && (i?.enabled ?? !0), b = O(() => r?.logo ? typeof r.logo == "string" ? r.logo : p === "dark" ? r.logo.dark : r.logo.light : Ra, [r?.logo, p]), _ = r?.name || "Gentiq";
1449
1483
  return /* @__PURE__ */ s("header", { className: "relative flex items-center justify-between px-3 md:px-4 h-14 sticky top-0 z-40 w-full bg-background border-b border-border/30 transition-all duration-300", children: [
1450
1484
  /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 md:gap-2 min-w-[36px] md:min-w-[80px]", children: [
1451
- f && /* @__PURE__ */ e(Pn, { className: "hover:bg-accent/60 transition-all duration-200 active:scale-95 rounded-lg size-9" }),
1452
- !t && /* @__PURE__ */ s(ct, { children: [
1453
- /* @__PURE__ */ e(dt, { asChild: !0, children: /* @__PURE__ */ e(
1485
+ f && /* @__PURE__ */ e(Ln, { className: "hover:bg-accent/60 transition-all duration-200 active:scale-95 rounded-lg size-9" }),
1486
+ !t && /* @__PURE__ */ s(lt, { children: [
1487
+ /* @__PURE__ */ e(ct, { asChild: !0, children: /* @__PURE__ */ e(
1454
1488
  "button",
1455
1489
  {
1456
1490
  type: "button",
1457
- className: y(
1491
+ className: x(
1458
1492
  "flex items-center justify-center size-9 rounded-lg hover:bg-accent/60 transition-all duration-200 active:scale-95 text-muted-foreground hover:text-primary",
1459
1493
  f && "md:hidden"
1460
1494
  ),
1461
1495
  onClick: () => a?.selectThread(null),
1462
1496
  "aria-label": n("new_chat"),
1463
- children: /* @__PURE__ */ e(nt, { className: "size-5" })
1497
+ children: /* @__PURE__ */ e(at, { className: "size-5" })
1464
1498
  }
1465
1499
  ) }),
1466
- /* @__PURE__ */ e(ut, { side: "bottom", className: "text-xs", children: n("new_chat") })
1500
+ /* @__PURE__ */ e(dt, { side: "bottom", className: "text-xs", children: n("new_chat") })
1467
1501
  ] })
1468
1502
  ] }),
1469
- /* @__PURE__ */ e("div", { className: "absolute inset-0 m-auto size-fit", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2.5 select-none animate-in fade-in zoom-in-95 duration-500", children: /* @__PURE__ */ e("img", { src: v, alt: b, className: "size-8 object-contain" }) }) }),
1503
+ /* @__PURE__ */ e("div", { className: "absolute inset-0 m-auto size-fit", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2.5 select-none animate-in fade-in zoom-in-95 duration-500", children: /* @__PURE__ */ e("img", { src: b, alt: _, className: "size-8 object-contain" }) }) }),
1470
1504
  /* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 min-w-[36px] md:min-w-[80px] justify-end", children: !t && /* @__PURE__ */ s(fe, { children: [
1471
1505
  m && /* @__PURE__ */ e(m, { isMobile: h }),
1472
- c.map(({ id: k, component: T }) => /* @__PURE__ */ e(T, { isMobile: h }, k)),
1506
+ c.map(({ id: v, component: k }) => /* @__PURE__ */ e(k, { isMobile: h }, v)),
1473
1507
  r?.showUsageBar && /* @__PURE__ */ e(g, { details: r.showUsageDetails ?? !0, isMobile: h }),
1474
1508
  r?.showSettings !== !1 && /* @__PURE__ */ e(
1475
- On,
1509
+ Fn,
1476
1510
  {
1477
1511
  trigger: /* @__PURE__ */ e(
1478
1512
  "button",
@@ -1480,7 +1514,7 @@ function kt({ hideActions: t = !1 }) {
1480
1514
  type: "button",
1481
1515
  "aria-label": n("settings:title"),
1482
1516
  className: "flex items-center justify-center size-9 rounded-lg hover:bg-accent/60 transition-all duration-200 active:scale-95 text-muted-foreground hover:text-primary",
1483
- children: /* @__PURE__ */ e(Pe, { className: "size-5" })
1517
+ children: /* @__PURE__ */ e(Me, { className: "size-5" })
1484
1518
  }
1485
1519
  )
1486
1520
  }
@@ -1488,66 +1522,66 @@ function kt({ hideActions: t = !1 }) {
1488
1522
  ] }) })
1489
1523
  ] });
1490
1524
  }
1491
- function $n(t) {
1492
- return /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(Un, { ...t }) });
1525
+ function On(t) {
1526
+ return /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e($n, { ...t }) });
1493
1527
  }
1494
- function Un({ shareId: t }) {
1495
- const [a, n] = N(
1528
+ function $n({ shareId: t }) {
1529
+ const [a, n] = S(
1496
1530
  null
1497
- ), [r, o] = N(!0), [i, m] = N(null), { t: u } = _(["chat", "errors"]), { MessageList: g } = oe(), c = Re(), h = Ee(/* @__PURE__ */ new Set());
1498
- return F(() => () => {
1531
+ ), [r, i] = S(!0), [o, m] = S(null), { t: u } = q(["chat", "errors"]), { MessageList: g } = ie(), c = ze(), h = Ae(/* @__PURE__ */ new Set());
1532
+ return R(() => () => {
1499
1533
  h.current.forEach((p) => URL.revokeObjectURL(p)), h.current.clear();
1500
- }, []), F(() => {
1534
+ }, []), R(() => {
1501
1535
  if (!t) return;
1502
1536
  let p = !1;
1503
1537
  return (async () => {
1504
1538
  try {
1505
- o(!0);
1506
- const v = await c.getSharedThread(t), b = await Za(
1507
- Ja(v.items),
1508
- async (k) => {
1539
+ i(!0);
1540
+ const b = await c.getSharedThread(t), _ = await Ya(
1541
+ Za(b.items),
1542
+ async (v) => {
1509
1543
  try {
1510
- const T = await c.getPublicAttachmentBlobUrl(t, k);
1511
- return h.current.add(T), T;
1512
- } catch (T) {
1513
- return console.error("Failed to resolve shared attachment:", k, T), "";
1544
+ const k = await c.getPublicAttachmentBlobUrl(t, v);
1545
+ return h.current.add(k), k;
1546
+ } catch (k) {
1547
+ return console.error("Failed to resolve shared attachment:", v, k), "";
1514
1548
  }
1515
1549
  }
1516
1550
  );
1517
- p || n({ id: v.id, messages: b });
1518
- } catch (v) {
1551
+ p || n({ id: b.id, messages: _ });
1552
+ } catch (b) {
1519
1553
  if (p) return;
1520
- console.error("Failed to fetch shared chat:", v), m(v);
1554
+ console.error("Failed to fetch shared chat:", b), m(b);
1521
1555
  } finally {
1522
- p || o(!1);
1556
+ p || i(!1);
1523
1557
  }
1524
1558
  })(), () => {
1525
1559
  p = !0;
1526
1560
  };
1527
1561
  }, [t, c]), r ? /* @__PURE__ */ e("div", { className: "flex h-dvh items-center justify-center bg-background", children: /* @__PURE__ */ e(Da, {}) }) : a ? /* @__PURE__ */ s("div", { className: "relative flex flex-col h-dvh overflow-hidden bg-background", children: [
1528
- /* @__PURE__ */ e(kt, { hideActions: !0 }),
1529
- /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ e(ze.Root, { readonly: !0, children: /* @__PURE__ */ e(tt.Root, { messages: a.messages, className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ e(g, { className: "pb-8" }) }) }) })
1562
+ /* @__PURE__ */ e(St, { hideActions: !0 }),
1563
+ /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ e(Ee.Root, { readonly: !0, children: /* @__PURE__ */ e(et.Root, { messages: a.messages, className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ e(g, { className: "pb-8" }) }) }) })
1530
1564
  ] }) : /* @__PURE__ */ s("div", { className: "flex h-dvh flex-col items-center justify-center p-4 text-center bg-background", children: [
1531
1565
  /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-destructive mb-2 font-display", children: u("shared_not_found_title") }),
1532
- /* @__PURE__ */ e("p", { className: "text-muted-foreground max-w-md", children: Ya(i) ? se(i, u) : u("shared_not_found_description") })
1566
+ /* @__PURE__ */ e("p", { className: "text-muted-foreground max-w-md", children: Xa(o) ? re(o, u) : u("shared_not_found_description") })
1533
1567
  ] });
1534
1568
  }
1535
- function jn() {
1536
- const { t } = _("sidebar"), { isMobile: a, setOpenMobile: n } = be();
1537
- return /* @__PURE__ */ e(yt, { className: "mt-2 mb-6 px-2 group-data-[collapsible=icon]:px-0", children: /* @__PURE__ */ e(Nt, { className: "group-data-[collapsible=icon]:flex group-data-[collapsible=icon]:justify-center", children: /* @__PURE__ */ e(
1538
- wt,
1569
+ function Un() {
1570
+ const { t } = q("sidebar"), { isMobile: a, setOpenMobile: n } = be();
1571
+ return /* @__PURE__ */ e(xt, { className: "mt-2 mb-6 px-2 group-data-[collapsible=icon]:px-0", children: /* @__PURE__ */ e(yt, { className: "group-data-[collapsible=icon]:flex group-data-[collapsible=icon]:justify-center", children: /* @__PURE__ */ e(
1572
+ Nt,
1539
1573
  {
1540
1574
  asChild: !0,
1541
1575
  tooltip: t("tooltip_new_conversation"),
1542
1576
  className: "h-10 rounded-xl bg-surface border border-border/60 shadow-sm shadow-foreground/[0.03] text-foreground/85 hover:bg-surface hover:border-border hover:text-foreground active:bg-surface transition-[width,height,padding,border-color,color] duration-200 group-data-[collapsible=icon]:mx-auto group/new-chat",
1543
1577
  children: /* @__PURE__ */ s(
1544
- j.New,
1578
+ G.New,
1545
1579
  {
1546
1580
  onOpen: () => a && n(!1),
1547
1581
  className: "flex items-center gap-2.5 px-3 group-data-[collapsible=icon]:justify-center",
1548
1582
  children: [
1549
1583
  /* @__PURE__ */ e(
1550
- nt,
1584
+ at,
1551
1585
  {
1552
1586
  "aria-hidden": !0,
1553
1587
  className: "size-4! shrink-0 text-muted-foreground transition-colors group-hover/new-chat:text-foreground"
@@ -1560,9 +1594,9 @@ function jn() {
1560
1594
  }
1561
1595
  ) }) });
1562
1596
  }
1563
- function Bn() {
1564
- const { t } = _("sidebar");
1565
- return /* @__PURE__ */ e(j.LoadMore, { className: "group/more min-h-4 w-full", children: /* @__PURE__ */ s(
1597
+ function jn() {
1598
+ const { t } = q("sidebar");
1599
+ return /* @__PURE__ */ e(G.LoadMore, { className: "group/more min-h-4 w-full", children: /* @__PURE__ */ s(
1566
1600
  "div",
1567
1601
  {
1568
1602
  role: "status",
@@ -1580,13 +1614,13 @@ function Bn() {
1580
1614
  }
1581
1615
  ) });
1582
1616
  }
1583
- function Gn() {
1584
- const { t } = _("sidebar");
1617
+ function Bn() {
1618
+ const { t } = q("sidebar");
1585
1619
  return /* @__PURE__ */ s(
1586
1620
  ye.Root,
1587
1621
  {
1588
- onRenamed: () => P.success(t("rename_success")),
1589
- onRenameFailed: () => P.error(t("rename_failed")),
1622
+ onRenamed: () => E.success(t("rename_success")),
1623
+ onRenameFailed: () => E.error(t("rename_failed")),
1590
1624
  className: "flex items-center gap-1 px-2 py-1.5 w-full",
1591
1625
  children: [
1592
1626
  /* @__PURE__ */ e(
@@ -1604,7 +1638,7 @@ function Gn() {
1604
1638
  variant: "ghost",
1605
1639
  "aria-label": t("save"),
1606
1640
  className: "size-8 shrink-0 text-primary hover:bg-primary/10",
1607
- children: /* @__PURE__ */ e(da, { "aria-hidden": !0, className: "size-4" })
1641
+ children: /* @__PURE__ */ e(ca, { "aria-hidden": !0, className: "size-4" })
1608
1642
  }
1609
1643
  ) }),
1610
1644
  /* @__PURE__ */ e(ye.Cancel, { asChild: !0, children: /* @__PURE__ */ e(
@@ -1615,99 +1649,99 @@ function Gn() {
1615
1649
  variant: "ghost",
1616
1650
  "aria-label": t("cancel"),
1617
1651
  className: "size-8 shrink-0 text-destructive hover:bg-destructive/10",
1618
- children: /* @__PURE__ */ e(ua, { "aria-hidden": !0, className: "size-4" })
1652
+ children: /* @__PURE__ */ e(da, { "aria-hidden": !0, className: "size-4" })
1619
1653
  }
1620
1654
  ) })
1621
1655
  ]
1622
1656
  }
1623
1657
  );
1624
1658
  }
1625
- function Hn({ open: t, onOpenChange: a }) {
1626
- const { t: n } = _(["sidebar", "errors"]), { remove: r } = Ae(), o = async () => {
1659
+ function Gn({ open: t, onOpenChange: a }) {
1660
+ const { t: n } = q(["sidebar", "errors"]), { remove: r } = Re(), i = async () => {
1627
1661
  a(!1);
1628
1662
  try {
1629
1663
  await r();
1630
1664
  } catch {
1631
- P.error(n("errors:thread_delete_failed"));
1665
+ E.error(n("errors:thread_delete_failed"));
1632
1666
  return;
1633
1667
  }
1634
- P.success(n("chat_deleted_success"));
1668
+ E.success(n("chat_deleted_success"));
1635
1669
  };
1636
- return /* @__PURE__ */ e(gt, { open: t, onOpenChange: a, children: /* @__PURE__ */ s(pt, { children: [
1637
- /* @__PURE__ */ s(Oa, { children: [
1638
- /* @__PURE__ */ e($a, { children: n("delete_confirm_title") }),
1639
- /* @__PURE__ */ e(Ua, { children: n("delete_confirm_description") })
1670
+ return /* @__PURE__ */ e(ht, { open: t, onOpenChange: a, children: /* @__PURE__ */ s(gt, { children: [
1671
+ /* @__PURE__ */ s(Fa, { children: [
1672
+ /* @__PURE__ */ e(Oa, { children: n("delete_confirm_title") }),
1673
+ /* @__PURE__ */ e($a, { children: n("delete_confirm_description") })
1640
1674
  ] }),
1641
- /* @__PURE__ */ s(ja, { children: [
1675
+ /* @__PURE__ */ s(Ua, { children: [
1642
1676
  /* @__PURE__ */ e($, { variant: "outline", onClick: () => a(!1), children: n("cancel") }),
1643
1677
  /* @__PURE__ */ e($, { variant: "destructive", onClick: () => {
1644
- o();
1678
+ i();
1645
1679
  }, autoFocus: !0, children: n("delete") })
1646
1680
  ] })
1647
1681
  ] }) });
1648
1682
  }
1649
- const Ct = Lt({
1683
+ const kt = qt({
1650
1684
  pin: !0,
1651
1685
  share: !0,
1652
1686
  rename: !0,
1653
1687
  delete: !0
1654
1688
  }), ge = "cursor-pointer flex items-center gap-2";
1655
- function Vn() {
1656
- const { t } = _("sidebar"), { dir: a } = ee(), n = Xe(Ct), { thread: r, setPinned: o, share: i, unshare: m, startRenaming: u } = Ae(), [g, c] = N(!1);
1689
+ function Hn() {
1690
+ const { t } = q("sidebar"), { dir: a } = J(), n = We(kt), { thread: r, setPinned: i, share: o, unshare: m, startRenaming: u } = Re(), [g, c] = S(!1);
1657
1691
  if (!n.pin && !n.share && !n.rename && !n.delete) return null;
1658
1692
  const h = async () => {
1659
1693
  try {
1660
- await o(!r.pinned), P.success(r.pinned ? t("unpinned_success") : t("pinned_success"));
1694
+ await i(!r.pinned), E.success(r.pinned ? t("unpinned_success") : t("pinned_success"));
1661
1695
  } catch {
1662
- P.error(t("pin_failed"));
1696
+ E.error(t("pin_failed"));
1663
1697
  }
1664
1698
  }, p = async () => {
1665
1699
  try {
1666
- const v = await i();
1667
- await navigator.clipboard.writeText(`${window.location.origin}${v}`), P.success(t("share_success"), { description: t("share_description") });
1700
+ const b = await o();
1701
+ await navigator.clipboard.writeText(`${window.location.origin}${b}`), E.success(t("share_success"), { description: t("share_description") });
1668
1702
  } catch {
1669
- P.error(t("share_failed"));
1703
+ E.error(t("share_failed"));
1670
1704
  }
1671
1705
  }, f = async () => {
1672
1706
  try {
1673
- await m(), P.success(t("unshare_success"));
1707
+ await m(), E.success(t("unshare_success"));
1674
1708
  } catch {
1675
- P.error(t("unshare_failed"));
1709
+ E.error(t("unshare_failed"));
1676
1710
  }
1677
1711
  };
1678
1712
  return /* @__PURE__ */ s(fe, { children: [
1679
- /* @__PURE__ */ s(Ba, { dir: a, children: [
1680
- /* @__PURE__ */ e(Ga, { asChild: !0, children: /* @__PURE__ */ e(
1713
+ /* @__PURE__ */ s(ja, { dir: a, children: [
1714
+ /* @__PURE__ */ e(Ba, { asChild: !0, children: /* @__PURE__ */ e(
1681
1715
  $,
1682
1716
  {
1683
1717
  variant: "ghost",
1684
1718
  size: "icon",
1685
1719
  "aria-label": t("thread_actions", { title: r.title ?? t("new_conversation") }),
1686
1720
  className: "size-7 rounded-full opacity-100 md:opacity-0 md:group-hover/sidebar-menu-item:opacity-100 md:group-focus-within/sidebar-menu-item:opacity-100 focus-visible:opacity-100 hover:bg-accent hover:text-accent-foreground data-[state=open]:opacity-100 transition-all",
1687
- children: /* @__PURE__ */ e(ma, { "aria-hidden": !0, className: "size-3.5" })
1721
+ children: /* @__PURE__ */ e(ua, { "aria-hidden": !0, className: "size-3.5" })
1688
1722
  }
1689
1723
  ) }),
1690
- /* @__PURE__ */ s(Ha, { align: "end", className: "min-w-[120px] p-1", children: [
1724
+ /* @__PURE__ */ s(Ga, { align: "end", className: "min-w-[120px] p-1", children: [
1691
1725
  n.pin && /* @__PURE__ */ s(he, { onSelect: () => {
1692
1726
  h();
1693
1727
  }, className: ge, children: [
1694
- r.pinned ? /* @__PURE__ */ e(ha, { "aria-hidden": !0, className: "size-4" }) : /* @__PURE__ */ e(rt, { "aria-hidden": !0, className: "size-4" }),
1728
+ r.pinned ? /* @__PURE__ */ e(ma, { "aria-hidden": !0, className: "size-4" }) : /* @__PURE__ */ e(nt, { "aria-hidden": !0, className: "size-4" }),
1695
1729
  /* @__PURE__ */ e("span", { children: r.pinned ? t("unpin_conversation") : t("pin_conversation") })
1696
1730
  ] }),
1697
1731
  n.share && /* @__PURE__ */ s(he, { onSelect: () => {
1698
1732
  p();
1699
1733
  }, className: ge, children: [
1700
- /* @__PURE__ */ e(ga, { "aria-hidden": !0, className: "size-4" }),
1734
+ /* @__PURE__ */ e(ha, { "aria-hidden": !0, className: "size-4" }),
1701
1735
  /* @__PURE__ */ e("span", { children: t("share_conversation") })
1702
1736
  ] }),
1703
1737
  n.share && r.shared && /* @__PURE__ */ s(he, { onSelect: () => {
1704
1738
  f();
1705
1739
  }, className: ge, children: [
1706
- /* @__PURE__ */ e(pa, { "aria-hidden": !0, className: "size-4" }),
1740
+ /* @__PURE__ */ e(ga, { "aria-hidden": !0, className: "size-4" }),
1707
1741
  /* @__PURE__ */ e("span", { children: t("stop_sharing") })
1708
1742
  ] }),
1709
1743
  n.rename && /* @__PURE__ */ s(he, { onSelect: u, className: ge, children: [
1710
- /* @__PURE__ */ e(fa, { "aria-hidden": !0, className: "size-4" }),
1744
+ /* @__PURE__ */ e(pa, { "aria-hidden": !0, className: "size-4" }),
1711
1745
  /* @__PURE__ */ e("span", { children: t("rename_conversation") })
1712
1746
  ] }),
1713
1747
  n.delete && /* @__PURE__ */ s(
@@ -1716,38 +1750,38 @@ function Vn() {
1716
1750
  onSelect: () => c(!0),
1717
1751
  className: `${ge} text-destructive focus:text-destructive focus:bg-destructive/10`,
1718
1752
  children: [
1719
- /* @__PURE__ */ e(ba, { "aria-hidden": !0, className: "size-4" }),
1753
+ /* @__PURE__ */ e(fa, { "aria-hidden": !0, className: "size-4" }),
1720
1754
  /* @__PURE__ */ e("span", { children: t("delete_conversation") })
1721
1755
  ]
1722
1756
  }
1723
1757
  )
1724
1758
  ] })
1725
1759
  ] }),
1726
- n.delete && /* @__PURE__ */ e(Hn, { open: g, onOpenChange: c })
1760
+ n.delete && /* @__PURE__ */ e(Gn, { open: g, onOpenChange: c })
1727
1761
  ] });
1728
1762
  }
1729
- function Kn() {
1730
- const { t } = _("sidebar"), { isMobile: a, setOpenMobile: n } = be(), { thread: r, isRenaming: o } = Ae();
1731
- return /* @__PURE__ */ e(j.Item, { asChild: !0, children: /* @__PURE__ */ e(Nt, { className: "group/sidebar-menu-item relative", children: o ? /* @__PURE__ */ e(Gn, {}) : /* @__PURE__ */ s(fe, { children: [
1763
+ function Vn() {
1764
+ const { t } = q("sidebar"), { isMobile: a, setOpenMobile: n } = be(), { thread: r, isRenaming: i } = Re();
1765
+ return /* @__PURE__ */ e(G.Item, { asChild: !0, children: /* @__PURE__ */ e(yt, { className: "group/sidebar-menu-item relative", children: i ? /* @__PURE__ */ e(Bn, {}) : /* @__PURE__ */ s(fe, { children: [
1732
1766
  /* @__PURE__ */ e(
1733
- wt,
1767
+ Nt,
1734
1768
  {
1735
1769
  asChild: !0,
1736
1770
  className: "h-auto py-2.5 px-3 opacity-70 hover:opacity-100 aria-[current=page]:bg-accent aria-[current=page]:opacity-100 aria-busy:thread-streaming",
1737
1771
  children: /* @__PURE__ */ s(
1738
- j.ItemTrigger,
1772
+ G.ItemTrigger,
1739
1773
  {
1740
1774
  onOpen: () => a && n(!1),
1741
1775
  className: "flex flex-col items-start gap-0.5 w-full overflow-hidden pe-16",
1742
1776
  children: [
1743
1777
  /* @__PURE__ */ e(
1744
- j.ItemTitle,
1778
+ G.ItemTitle,
1745
1779
  {
1746
1780
  fallback: t("new_conversation"),
1747
1781
  className: "truncate w-full text-start font-medium text-sm"
1748
1782
  }
1749
1783
  ),
1750
- /* @__PURE__ */ e(j.ItemTime, { className: "w-full text-start text-xs opacity-60" })
1784
+ /* @__PURE__ */ e(G.ItemTime, { className: "w-full text-start text-xs opacity-60" })
1751
1785
  ]
1752
1786
  }
1753
1787
  )
@@ -1755,25 +1789,25 @@ function Kn() {
1755
1789
  ),
1756
1790
  /* @__PURE__ */ s("div", { className: "absolute top-1/2 -translate-y-1/2 end-1.5 flex items-center gap-1 z-10", children: [
1757
1791
  r.pinned && /* @__PURE__ */ s("span", { className: "md:absolute md:inset-0 md:m-auto md:size-3.5 md:group-hover/sidebar-menu-item:opacity-0 md:group-focus-within/sidebar-menu-item:opacity-0 transition-opacity pointer-events-none", children: [
1758
- /* @__PURE__ */ e(rt, { "aria-hidden": !0, className: "size-3.5 text-primary opacity-70" }),
1792
+ /* @__PURE__ */ e(nt, { "aria-hidden": !0, className: "size-3.5 text-primary opacity-70" }),
1759
1793
  /* @__PURE__ */ e("span", { className: "sr-only", children: t("pinned") })
1760
1794
  ] }),
1761
- /* @__PURE__ */ e(Vn, {})
1795
+ /* @__PURE__ */ e(Hn, {})
1762
1796
  ] })
1763
1797
  ] }) }) });
1764
1798
  }
1765
- function Qn() {
1766
- const { t } = _("sidebar");
1799
+ function Kn() {
1800
+ const { t } = q("sidebar");
1767
1801
  return /* @__PURE__ */ s("div", { className: "relative group/search", children: [
1768
1802
  /* @__PURE__ */ e(
1769
- va,
1803
+ ba,
1770
1804
  {
1771
1805
  "aria-hidden": !0,
1772
1806
  className: "absolute start-3 top-1/2 -translate-y-1/2 size-4 opacity-40 group-focus-within/search:opacity-70 transition-opacity"
1773
1807
  }
1774
1808
  ),
1775
1809
  /* @__PURE__ */ e(
1776
- j.Search,
1810
+ G.Search,
1777
1811
  {
1778
1812
  "aria-label": t("search_conversations"),
1779
1813
  placeholder: t("search_conversations"),
@@ -1782,36 +1816,36 @@ function Qn() {
1782
1816
  )
1783
1817
  ] });
1784
1818
  }
1785
- function Wn({ side: t = "start" }) {
1786
- const { t: a } = _("sidebar"), n = te((g) => g.history), { showPin: r, showShare: o, showRename: i, showDelete: m } = n, u = O(
1787
- () => ({ pin: r, share: o, rename: i, delete: m }),
1788
- [r, o, i, m]
1819
+ function Qn({ side: t = "start" }) {
1820
+ const { t: a } = q("sidebar"), n = ee((g) => g.history), { showPin: r, showShare: i, showRename: o, showDelete: m } = n, u = O(
1821
+ () => ({ pin: r, share: i, rename: o, delete: m }),
1822
+ [r, i, o, m]
1789
1823
  );
1790
- return /* @__PURE__ */ e(lt, { children: /* @__PURE__ */ e(Ln, { collapsible: "icon", side: t, children: /* @__PURE__ */ e(Mn, { className: "custom-scrollbar", children: /* @__PURE__ */ s(En, { children: [
1791
- /* @__PURE__ */ e(jn, {}),
1792
- n.enabled && /* @__PURE__ */ s(j.Root, { className: "group-data-[collapsible=icon]:hidden", children: [
1793
- /* @__PURE__ */ e(He, { className: "mb-6 px-2", children: /* @__PURE__ */ e(Qn, {}) }),
1794
- /* @__PURE__ */ s(He, { children: [
1795
- /* @__PURE__ */ e(yt, { children: /* @__PURE__ */ e(Ct.Provider, { value: u, children: /* @__PURE__ */ e(j.Items, { component: Kn }) }) }),
1796
- /* @__PURE__ */ e(j.Empty, { className: "px-4 py-8 text-center text-sm opacity-60", children: a("no_conversations") }),
1797
- /* @__PURE__ */ e(Bn, {})
1824
+ return /* @__PURE__ */ e(ot, { children: /* @__PURE__ */ e(qn, { collapsible: "icon", side: t, children: /* @__PURE__ */ e(Mn, { className: "custom-scrollbar", children: /* @__PURE__ */ s(Pn, { children: [
1825
+ /* @__PURE__ */ e(Un, {}),
1826
+ n.enabled && /* @__PURE__ */ s(G.Root, { className: "group-data-[collapsible=icon]:hidden", children: [
1827
+ /* @__PURE__ */ e(Ge, { className: "mb-6 px-2", children: /* @__PURE__ */ e(Kn, {}) }),
1828
+ /* @__PURE__ */ s(Ge, { children: [
1829
+ /* @__PURE__ */ e(xt, { children: /* @__PURE__ */ e(kt.Provider, { value: u, children: /* @__PURE__ */ e(G.Items, { component: Vn }) }) }),
1830
+ /* @__PURE__ */ e(G.Empty, { className: "px-4 py-8 text-center text-sm opacity-60", children: a("no_conversations") }),
1831
+ /* @__PURE__ */ e(jn, {})
1798
1832
  ] })
1799
1833
  ] })
1800
1834
  ] }) }) }) });
1801
1835
  }
1802
- function Xn({ components: t, disclaimer: a, welcome: n, ...r }) {
1803
- return /* @__PURE__ */ e(Fe, { components: t, disclaimer: a, welcome: n, children: /* @__PURE__ */ e(Yn, { ...r }) });
1836
+ function Wn({ components: t, disclaimer: a, welcome: n, ...r }) {
1837
+ return /* @__PURE__ */ e(De, { components: t, disclaimer: a, welcome: n, children: /* @__PURE__ */ e(Xn, { ...r }) });
1804
1838
  }
1805
- function Yn({
1839
+ function Xn({
1806
1840
  threadId: t,
1807
1841
  onThreadChange: a,
1808
1842
  getThreadHref: n,
1809
1843
  getShareHref: r,
1810
- sidebar: o,
1811
- header: i,
1844
+ sidebar: i,
1845
+ header: o,
1812
1846
  classNames: m
1813
1847
  }) {
1814
- const u = te((f) => f.history.enabled), { MaintenanceBanner: g, MaintenanceScreen: c } = oe(), h = jt(), p = h.isUnderMaintenance && h.status ? {
1848
+ const u = ee((f) => f.history.enabled), { MaintenanceBanner: g, MaintenanceScreen: c } = ie(), h = Ut(), p = h.isUnderMaintenance && h.status ? {
1815
1849
  status: h.status,
1816
1850
  title: h.title,
1817
1851
  message: h.message,
@@ -1819,65 +1853,65 @@ function Yn({
1819
1853
  blocksChat: h.blocksChat,
1820
1854
  refresh: h.refresh
1821
1855
  } : null;
1822
- return p && h.display === "fullscreen" && c ? /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(c, { ...p }) }) : /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(
1823
- et,
1856
+ return p && h.display === "fullscreen" && c ? /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(c, { ...p }) }) : /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(
1857
+ Je,
1824
1858
  {
1825
1859
  threadId: t,
1826
1860
  onThreadChange: a,
1827
1861
  getThreadHref: n,
1828
1862
  getShareHref: r,
1829
- children: /* @__PURE__ */ s(qn, { defaultOpen: u, className: "bg-background", children: [
1830
- o !== void 0 ? o : u ? /* @__PURE__ */ e(Wn, {}) : null,
1863
+ children: /* @__PURE__ */ s(In, { defaultOpen: u, className: "bg-background", children: [
1864
+ i !== void 0 ? i : u ? /* @__PURE__ */ e(Qn, {}) : null,
1831
1865
  /* @__PURE__ */ s("div", { className: "flex flex-col flex-1 h-dvh overflow-hidden relative", children: [
1832
- i !== void 0 ? i : /* @__PURE__ */ e(kt, {}),
1866
+ o !== void 0 ? o : /* @__PURE__ */ e(St, {}),
1833
1867
  p && g && /* @__PURE__ */ e(g, { ...p }),
1834
- /* @__PURE__ */ e("div", { className: "flex flex-col relative w-full flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ e(mn, { classNames: m }) })
1868
+ /* @__PURE__ */ e("div", { className: "flex flex-col relative w-full flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ e(un, { classNames: m }) })
1835
1869
  ] })
1836
1870
  ] })
1837
1871
  }
1838
1872
  ) });
1839
1873
  }
1840
1874
  const pe = /* @__PURE__ */ new Set();
1841
- let ne = null;
1842
- function Me() {
1875
+ let ae = null;
1876
+ function Pe() {
1843
1877
  for (const t of pe) t();
1844
1878
  }
1845
- function Zn(t) {
1846
- return pe.size === 0 && window.addEventListener("popstate", Me), pe.add(t), () => {
1847
- pe.delete(t), pe.size === 0 && window.removeEventListener("popstate", Me);
1879
+ function Yn(t) {
1880
+ return pe.size === 0 && window.addEventListener("popstate", Pe), pe.add(t), () => {
1881
+ pe.delete(t), pe.size === 0 && window.removeEventListener("popstate", Pe);
1848
1882
  };
1849
1883
  }
1850
- function Jn() {
1884
+ function Zn() {
1851
1885
  const { pathname: t, search: a, hash: n } = window.location, r = window.history.state;
1852
- return (ne?.pathname !== t || ne.search !== a || ne.hash !== n || ne.state !== r) && (ne = { pathname: t, search: a, hash: n, state: r }), ne;
1886
+ return (ae?.pathname !== t || ae.search !== a || ae.hash !== n || ae.state !== r) && (ae = { pathname: t, search: a, hash: n, state: r }), ae;
1853
1887
  }
1854
- const er = () => null;
1855
- function tr() {
1856
- return Pt(Zn, Jn, er);
1888
+ const Jn = () => null;
1889
+ function er() {
1890
+ return Lt(Yn, Zn, Jn);
1857
1891
  }
1858
1892
  function Ne(t, { replace: a = !1, state: n = null } = {}) {
1859
- a ? window.history.replaceState(n, "", t) : window.history.pushState(n, "", t), Me();
1893
+ a ? window.history.replaceState(n, "", t) : window.history.pushState(n, "", t), Pe();
1860
1894
  }
1861
- const ar = {
1895
+ const tr = {
1862
1896
  chat: "/chat",
1863
1897
  login: "/login",
1864
1898
  shared: "/shared",
1865
1899
  admin: "/admin"
1866
1900
  };
1867
- function re(t) {
1901
+ function ne(t) {
1868
1902
  const a = t.replace(/^\/+|\/+$/g, "");
1869
1903
  return a ? `/${a}` : "";
1870
1904
  }
1871
- function nr(t, a = {}) {
1872
- const n = re(t), r = { ...ar, ...a };
1905
+ function ar(t, a = {}) {
1906
+ const n = ne(t), r = { ...tr, ...a };
1873
1907
  return {
1874
- chat: n + re(r.chat),
1875
- login: n + re(r.login),
1876
- shared: n + re(r.shared),
1877
- admin: n + re(r.admin)
1908
+ chat: n + ne(r.chat),
1909
+ login: n + ne(r.login),
1910
+ shared: n + ne(r.shared),
1911
+ admin: n + ne(r.admin)
1878
1912
  };
1879
1913
  }
1880
- function We(t, a) {
1914
+ function Qe(t, a) {
1881
1915
  if (t !== a && !t.startsWith(`${a}/`)) return;
1882
1916
  const n = t.slice(a.length).replace(/^\/+|\/+$/g, "");
1883
1917
  if (!n) return null;
@@ -1888,23 +1922,23 @@ function We(t, a) {
1888
1922
  return;
1889
1923
  }
1890
1924
  }
1891
- function rr(t, a) {
1892
- const n = re(t);
1925
+ function nr(t, a) {
1926
+ const n = ne(t);
1893
1927
  if (n === a.admin || n.startsWith(`${a.admin}/`)) return { name: "admin" };
1894
1928
  if (n === a.login) return { name: "login" };
1895
- const r = We(n, a.shared);
1896
- return r ? { name: "shared", shareId: r } : { name: "chat", threadId: We(n, a.chat) ?? null };
1929
+ const r = Qe(n, a.shared);
1930
+ return r ? { name: "shared", shareId: r } : { name: "chat", threadId: Qe(n, a.chat) ?? null };
1897
1931
  }
1898
1932
  function qe(t, a) {
1899
1933
  return t === null ? a.chat || "/" : `${a.chat}/${encodeURIComponent(t)}`;
1900
1934
  }
1901
- function Nr({
1935
+ function wr({
1902
1936
  url: t,
1903
1937
  api: a,
1904
1938
  basePath: n = "/",
1905
1939
  paths: r,
1906
- admin: o,
1907
- components: i,
1940
+ admin: i,
1941
+ components: o,
1908
1942
  history: m,
1909
1943
  welcome: u,
1910
1944
  threadActions: g,
@@ -1913,35 +1947,35 @@ function Nr({
1913
1947
  settings: p,
1914
1948
  ...f
1915
1949
  }) {
1916
- const v = tr();
1917
- return v ? /* @__PURE__ */ s(vn, { ...f, api: { ...a, basePath: t }, children: [
1918
- /* @__PURE__ */ e(xn, {}),
1950
+ const b = er();
1951
+ return b ? /* @__PURE__ */ s(bn, { ...f, api: { ...a, basePath: t }, children: [
1952
+ /* @__PURE__ */ e(vn, {}),
1919
1953
  /* @__PURE__ */ e(
1920
- Fe,
1954
+ De,
1921
1955
  {
1922
- components: i,
1956
+ components: o,
1923
1957
  history: m,
1924
1958
  welcome: u,
1925
1959
  threadActions: g,
1926
1960
  composer: c,
1927
1961
  disclaimer: h,
1928
1962
  settings: p,
1929
- children: /* @__PURE__ */ e(sr, { location: v, paths: nr(n, r), admin: o })
1963
+ children: /* @__PURE__ */ e(rr, { location: b, paths: ar(n, r), admin: i })
1930
1964
  }
1931
1965
  )
1932
1966
  ] }) : null;
1933
1967
  }
1934
- function sr({ location: t, paths: a, admin: n }) {
1935
- const r = rr(t.pathname, a), o = qe(null, a);
1968
+ function rr({ location: t, paths: a, admin: n }) {
1969
+ const r = nr(t.pathname, a), i = qe(null, a);
1936
1970
  if (r.name === "admin" && n) return /* @__PURE__ */ e(Mt, { fallback: null, children: n });
1937
1971
  if (r.name === "login") {
1938
- const { reason: c, from: h } = lr(t.state);
1939
- return /* @__PURE__ */ e(Nn, { reason: c, onSignedIn: () => Ne(h ?? o, { replace: !0 }) });
1972
+ const { reason: c, from: h } = or(t.state);
1973
+ return /* @__PURE__ */ e(yn, { reason: c, onSignedIn: () => Ne(h ?? i, { replace: !0 }) });
1940
1974
  }
1941
- if (r.name === "shared") return /* @__PURE__ */ e($n, { shareId: r.shareId });
1942
- const i = r.name === "chat" ? r.threadId : null, m = new URLSearchParams(t.search), u = m.get("code");
1975
+ if (r.name === "shared") return /* @__PURE__ */ e(On, { shareId: r.shareId });
1976
+ const o = r.name === "chat" ? r.threadId : null, m = new URLSearchParams(t.search), u = m.get("code");
1943
1977
  return /* @__PURE__ */ e(
1944
- yn,
1978
+ xn,
1945
1979
  {
1946
1980
  loginCode: u,
1947
1981
  onLoginCodeUsed: () => {
@@ -1949,11 +1983,11 @@ function sr({ location: t, paths: a, admin: n }) {
1949
1983
  const c = m.toString();
1950
1984
  Ne(t.pathname + (c ? `?${c}` : "") + t.hash, { replace: !0 });
1951
1985
  },
1952
- fallback: (c) => /* @__PURE__ */ e(cr, { to: a.login, reason: c, from: t.pathname + t.search }),
1986
+ fallback: (c) => /* @__PURE__ */ e(lr, { to: a.login, reason: c, from: t.pathname + t.search }),
1953
1987
  children: /* @__PURE__ */ e(
1954
- Xn,
1988
+ Wn,
1955
1989
  {
1956
- threadId: i,
1990
+ threadId: o,
1957
1991
  onThreadChange: (c) => Ne(qe(c, a)),
1958
1992
  getThreadHref: (c) => qe(c, a),
1959
1993
  getShareHref: (c) => `${a.shared}/${encodeURIComponent(c)}`
@@ -1962,71 +1996,71 @@ function sr({ location: t, paths: a, admin: n }) {
1962
1996
  }
1963
1997
  );
1964
1998
  }
1965
- const ir = [
1999
+ const sr = [
1966
2000
  "signed_out",
1967
2001
  "session_expired",
1968
2002
  "handoff_failed"
1969
2003
  ];
1970
- function or(t) {
1971
- return typeof t == "string" && ir.includes(t);
2004
+ function ir(t) {
2005
+ return typeof t == "string" && sr.includes(t);
1972
2006
  }
1973
- function lr(t) {
2007
+ function or(t) {
1974
2008
  if (typeof t != "object" || t === null) return {};
1975
2009
  const { reason: a, from: n } = t;
1976
2010
  return {
1977
- reason: or(a) ? a : void 0,
2011
+ reason: ir(a) ? a : void 0,
1978
2012
  // Only a path on this site: a full URL here would make the sign-in page an open redirect.
1979
2013
  from: typeof n == "string" && n.startsWith("/") && !n.startsWith("//") ? n : void 0
1980
2014
  };
1981
2015
  }
1982
- function cr({ to: t, reason: a, from: n }) {
1983
- return F(() => {
2016
+ function lr({ to: t, reason: a, from: n }) {
2017
+ return R(() => {
1984
2018
  Ne(t, { replace: !0, state: { reason: a, from: n } });
1985
2019
  }, [t, a, n]), null;
1986
2020
  }
1987
2021
  export {
1988
- Wn as AppSidebar,
1989
- mn as Chat,
1990
- kr as ChatError,
1991
- Xn as ChatLayout,
1992
- Cr as ChoiceQuestionDock,
1993
- _r as ChoiceQuestionPart,
1994
- Ca as ChoiceQuestionProvider,
1995
- An as CreditsBar,
1996
- xn as DocumentSync,
1997
- Tr as FilePart,
1998
- Ir as FollowUpSuggestions,
1999
- Nr as GentiqChatApp,
2000
- vn as GentiqProvider,
2001
- Q as GentiqRoot,
2002
- Fe as GentiqUI,
2003
- qr as MaintenanceBanner,
2004
- Lr as MaintenanceScreen,
2022
+ Qn as AppSidebar,
2023
+ un as Chat,
2024
+ Cr as ChatError,
2025
+ Wn as ChatLayout,
2026
+ _r as ChoiceQuestionDock,
2027
+ Tr as ChoiceQuestionPart,
2028
+ ka as ChoiceQuestionProvider,
2029
+ zn as CreditsBar,
2030
+ vn as DocumentSync,
2031
+ Ir as FilePart,
2032
+ qr as FollowUpSuggestions,
2033
+ wr as GentiqChatApp,
2034
+ bn as GentiqProvider,
2035
+ W as GentiqRoot,
2036
+ De as GentiqUI,
2037
+ Lr as MaintenanceBanner,
2038
+ Mr as MaintenanceScreen,
2005
2039
  Pr as MessageActions,
2006
- Mr as MessageList,
2040
+ Ar as MessageList,
2007
2041
  Er as PromptInputArea,
2008
2042
  zr as PromptInputButton,
2009
- St as QuotaBar,
2010
- Rn as QuotaWindows,
2043
+ wt as QuotaBar,
2044
+ En as QuotaWindows,
2011
2045
  Rr as ReasoningPart,
2012
- Ar as ReferencePart,
2013
- xa as Referenceable,
2014
- yn as RequireAuth,
2015
- On as SettingsDialog,
2016
- $n as SharedChatView,
2017
- qn as SidebarProvider,
2046
+ Dr as ReferencePart,
2047
+ va as Referenceable,
2048
+ xn as RequireAuth,
2049
+ Fn as SettingsDialog,
2050
+ On as SharedChatView,
2051
+ In as SidebarProvider,
2018
2052
  Fr as Suggestion,
2019
- Dr as Suggestions,
2020
- Or as TextPart,
2021
- $r as ToolPart,
2022
- ct as Tooltip,
2023
- ut as TooltipContent,
2024
- dt as TooltipTrigger,
2025
- Ur as UsageMeter,
2026
- Nn as UserLoginPage,
2027
- jr as WelcomeScreen,
2028
- Br as useChoiceQuestion,
2029
- te as useGentiqUIOptions,
2030
- Gr as useSmoothStreamingConfig,
2031
- Hr as useSmoothText
2053
+ Or as Suggestions,
2054
+ $r as TextPart,
2055
+ Ur as ToolPart,
2056
+ lt as Tooltip,
2057
+ dt as TooltipContent,
2058
+ ct as TooltipTrigger,
2059
+ jr as UsageMeter,
2060
+ yn as UserLoginPage,
2061
+ Br as WelcomeScreen,
2062
+ Gr as useChoiceQuestion,
2063
+ ee as useGentiqUIOptions,
2064
+ Hr as useSmoothStreamingConfig,
2065
+ Vr as useSmoothText
2032
2066
  };