@ezychat/web 0.1.67 → 0.1.68

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-lib/index.js CHANGED
@@ -1188,7 +1188,8 @@ var qa = {
1188
1188
  enterprise: "{{product}}",
1189
1189
  newInbox: "New inbox",
1190
1190
  sameInbox: "Same number",
1191
- noNumber: "No number linked"
1191
+ noNumber: "No number linked",
1192
+ service: "Background service"
1192
1193
  },
1193
1194
  tile: {
1194
1195
  chats: "chats",
@@ -1213,6 +1214,21 @@ var qa = {
1213
1214
  title: "No EzyChat Lite data on this PC",
1214
1215
  body: "EzyChat Lite was not found on this computer. Add the number with a QR scan instead."
1215
1216
  },
1217
+ protected: {
1218
+ title: "EzyChat Lite runs as a background service",
1219
+ ask: "Windows asks you once to allow it",
1220
+ moves: "Lite’s service stops. Its data moves to Lite’s own folder.",
1221
+ allow: "Allow and continue",
1222
+ allowAgain: "Try again",
1223
+ waitingTitle: "Waiting for Windows",
1224
+ waitingBody: "Choose Yes in the Windows window. If you do not see it, click the shield icon on the taskbar.",
1225
+ declined: "Windows did not allow it. Nothing changed.",
1226
+ failed: "Could not free EzyChat Lite’s data.",
1227
+ byHand: "Or do it in EzyChat Lite:",
1228
+ step1: "Open \"Status & Service…\" from the system tray.",
1229
+ step2: "Under \"Background service\", choose \"Remove service\".",
1230
+ step3: "Come back here and choose \"Try again\"."
1231
+ },
1216
1232
  check: {
1217
1233
  title: "Quick check",
1218
1234
  liteRunning: "Close EzyChat Lite first",
@@ -1329,6 +1345,7 @@ var qa = {
1329
1345
  bring: "Bring from EzyChat Lite",
1330
1346
  bringChats: "{{chats}} chats and customers",
1331
1347
  bringTeam: "{{n}} teammates, same passwords",
1348
+ bringAll: "Chats, customers and team",
1332
1349
  new: "Start new",
1333
1350
  newAccount: "Create a new admin",
1334
1351
  newQr: "Scan a QR to link WhatsApp",
@@ -2683,13 +2700,13 @@ var qa = {
2683
2700
  admin: qa,
2684
2701
  errors: Za
2685
2702
  }, to = /* #__PURE__ */ Object.assign({
2686
- "./locales/ms/admin.json": () => import("./chunks/admin-aoqHNFwk.js"),
2703
+ "./locales/ms/admin.json": () => import("./chunks/admin-IgFwxD1N.js"),
2687
2704
  "./locales/ms/app.json": () => import("./chunks/app-BXBt4xNx.js"),
2688
2705
  "./locales/ms/auth.json": () => import("./chunks/auth-CQo75iLg.js"),
2689
2706
  "./locales/ms/common.json": () => import("./chunks/common-0sL8O9KV.js"),
2690
2707
  "./locales/ms/errors.json": () => import("./chunks/errors-DHAXUg11.js"),
2691
2708
  "./locales/ms/inbox.json": () => import("./chunks/inbox-CYEiGkVa.js"),
2692
- "./locales/zh-CN/admin.json": () => import("./chunks/admin-8UHO2F19.js"),
2709
+ "./locales/zh-CN/admin.json": () => import("./chunks/admin-CMQ1Km5v.js"),
2693
2710
  "./locales/zh-CN/app.json": () => import("./chunks/app-Zoharwle.js"),
2694
2711
  "./locales/zh-CN/auth.json": () => import("./chunks/auth-Bc0bOKPN.js"),
2695
2712
  "./locales/zh-CN/common.json": () => import("./chunks/common-CIXHivlt.js"),
@@ -5122,8 +5139,8 @@ function Jl({ icon: e, tone: t, children: n }) {
5122
5139
  })]
5123
5140
  });
5124
5141
  }
5125
- function Yl({ number: e, mode: t }) {
5126
- let { t: n } = P("admin"), r = (e, t, n) => /* @__PURE__ */ R("div", {
5142
+ function Yl({ number: e, mode: t, service: n = !1 }) {
5143
+ let { t: r } = P("admin"), i = (e, t, n) => /* @__PURE__ */ R("div", {
5127
5144
  className: "flex min-w-0 flex-1 flex-col items-center gap-1 rounded-lg border bg-card p-3 text-center",
5128
5145
  children: [
5129
5146
  /* @__PURE__ */ L(Kl, { icon: e }),
@@ -5141,12 +5158,12 @@ function Yl({ number: e, mode: t }) {
5141
5158
  className: "flex min-w-0 items-center gap-2",
5142
5159
  "data-testid": "lite-figure",
5143
5160
  children: [
5144
- r(Ii, n("liteImport.fig.lite"), e ?? n("liteImport.fig.noNumber")),
5161
+ i(Ii, r("liteImport.fig.lite"), n ? r("liteImport.fig.service") : e ?? r("liteImport.fig.noNumber")),
5145
5162
  /* @__PURE__ */ L(Cn, {
5146
5163
  className: "size-5 shrink-0 text-primary",
5147
5164
  "aria-hidden": !0
5148
5165
  }),
5149
- r(Ln, n("liteImport.fig.enterprise"), n(t === "merge" ? "liteImport.fig.newInbox" : "liteImport.fig.sameInbox"))
5166
+ i(Ln, r("liteImport.fig.enterprise"), r(t === "merge" ? "liteImport.fig.newInbox" : "liteImport.fig.sameInbox"))
5150
5167
  ]
5151
5168
  });
5152
5169
  }
@@ -25348,7 +25365,93 @@ function gA() {
25348
25365
  let { t: e } = P("admin");
25349
25366
  return e("liteImport.actionFailed");
25350
25367
  }
25351
- function _A({ state: e, onContinue: t, cancel: n }) {
25368
+ function _A({ state: e, bridge: t, act: n, busy: r, mode: i, cancel: a }) {
25369
+ let { t: o } = P("admin"), s = gA(), c = e.unlock, l = c === "declined" || c === "failed";
25370
+ return /* @__PURE__ */ R(X, {
25371
+ "data-testid": "lite-protected",
25372
+ "data-unlock": c,
25373
+ children: [/* @__PURE__ */ L(Z, { children: /* @__PURE__ */ L(Q, {
25374
+ className: "text-lg",
25375
+ children: o("liteImport.protected.title")
25376
+ }) }), /* @__PURE__ */ R($, {
25377
+ className: "flex flex-col gap-4",
25378
+ children: [
25379
+ /* @__PURE__ */ L(Yl, {
25380
+ number: null,
25381
+ service: !0,
25382
+ mode: i
25383
+ }),
25384
+ c === "declined" && /* @__PURE__ */ L(q, {
25385
+ tone: "warning",
25386
+ children: o("liteImport.protected.declined")
25387
+ }),
25388
+ c === "failed" && /* @__PURE__ */ L(q, {
25389
+ tone: "danger",
25390
+ children: o("liteImport.protected.failed")
25391
+ }),
25392
+ c === "waiting" ? /* @__PURE__ */ R("div", {
25393
+ className: "flex min-w-0 items-start gap-3 rounded-lg border p-3",
25394
+ role: "status",
25395
+ children: [/* @__PURE__ */ L(Fr, {
25396
+ className: "mt-0.5 size-5 shrink-0 animate-spin text-primary",
25397
+ "aria-hidden": !0
25398
+ }), /* @__PURE__ */ R("span", {
25399
+ className: "flex min-w-0 flex-col",
25400
+ children: [/* @__PURE__ */ L("span", {
25401
+ className: "font-medium",
25402
+ children: o("liteImport.protected.waitingTitle")
25403
+ }), /* @__PURE__ */ L("span", {
25404
+ className: "text-sm break-words text-muted-foreground",
25405
+ children: o("liteImport.protected.waitingBody")
25406
+ })]
25407
+ })]
25408
+ }) : /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ R("ul", {
25409
+ className: "flex flex-col gap-1",
25410
+ children: [
25411
+ /* @__PURE__ */ L(Jl, {
25412
+ icon: Ar,
25413
+ tone: "text-primary",
25414
+ children: o("liteImport.protected.ask")
25415
+ }),
25416
+ /* @__PURE__ */ L(Jl, {
25417
+ icon: ki,
25418
+ tone: "text-primary",
25419
+ children: o("liteImport.protected.moves")
25420
+ }),
25421
+ /* @__PURE__ */ L(Jl, {
25422
+ icon: Ni,
25423
+ tone: "text-success",
25424
+ children: o("liteImport.found.kept")
25425
+ })
25426
+ ]
25427
+ }), /* @__PURE__ */ R("div", {
25428
+ className: "flex flex-wrap gap-2",
25429
+ children: [/* @__PURE__ */ R(W, {
25430
+ size: "touch",
25431
+ disabled: r,
25432
+ onClick: () => void n(() => t.unlock(), s),
25433
+ children: [/* @__PURE__ */ L(Ni, { "aria-hidden": !0 }), o(l ? "liteImport.protected.allowAgain" : "liteImport.protected.allow")]
25434
+ }), a]
25435
+ })] }),
25436
+ l && /* @__PURE__ */ R("div", {
25437
+ className: "flex flex-col gap-2 rounded-lg border p-3 text-sm",
25438
+ children: [/* @__PURE__ */ L("span", {
25439
+ className: "font-medium",
25440
+ children: o("liteImport.protected.byHand")
25441
+ }), /* @__PURE__ */ R("ol", {
25442
+ className: "flex list-decimal flex-col gap-1 pl-5",
25443
+ children: [
25444
+ /* @__PURE__ */ L("li", { children: o("liteImport.protected.step1") }),
25445
+ /* @__PURE__ */ L("li", { children: o("liteImport.protected.step2") }),
25446
+ /* @__PURE__ */ L("li", { children: o("liteImport.protected.step3") })
25447
+ ]
25448
+ })]
25449
+ })
25450
+ ]
25451
+ })]
25452
+ });
25453
+ }
25454
+ function vA({ state: e, onContinue: t, cancel: n }) {
25352
25455
  let { t: r } = P("admin"), i = e.lite;
25353
25456
  if (!i) return null;
25354
25457
  let a = e.mode === "merge", o = i.aiAgents[0]?.name ?? "–";
@@ -25420,7 +25523,7 @@ function _A({ state: e, onContinue: t, cancel: n }) {
25420
25523
  })]
25421
25524
  });
25422
25525
  }
25423
- function vA({ state: e, bridge: t, act: n, busy: r, continueLabel: i, onContinue: a }) {
25526
+ function yA({ state: e, bridge: t, act: n, busy: r, continueLabel: i, onContinue: a }) {
25424
25527
  let { t: o } = P("admin"), s = gA(), c = (t) => e.issues.includes(t), l = /* @__PURE__ */ L(W, {
25425
25528
  variant: "outline",
25426
25529
  size: "touch",
@@ -25510,7 +25613,7 @@ function vA({ state: e, bridge: t, act: n, busy: r, continueLabel: i, onContinue
25510
25613
  })]
25511
25614
  });
25512
25615
  }
25513
- function yA(e, t) {
25616
+ function bA(e, t) {
25514
25617
  return e.map((e) => {
25515
25618
  let n = t.find((t) => t.username.toLowerCase() === e.username.toLowerCase());
25516
25619
  return n ? {
@@ -25526,8 +25629,8 @@ function yA(e, t) {
25526
25629
  };
25527
25630
  });
25528
25631
  }
25529
- function bA({ state: e, bridge: t, act: n, busy: r, people: i }) {
25530
- let { t: a } = P("admin"), o = gA(), s = e.lite, [c, l] = g(() => yA(s.users, i)), u = (e, t) => l((n) => n.map((n) => n.liteUserId === e ? {
25632
+ function xA({ state: e, bridge: t, act: n, busy: r, people: i }) {
25633
+ let { t: a } = P("admin"), o = gA(), s = e.lite, [c, l] = g(() => bA(s.users, i)), u = (e, t) => l((n) => n.map((n) => n.liteUserId === e ? {
25531
25634
  ...n,
25532
25635
  ...t
25533
25636
  } : n));
@@ -25743,7 +25846,7 @@ function bA({ state: e, bridge: t, act: n, busy: r, people: i }) {
25743
25846
  ]
25744
25847
  });
25745
25848
  }
25746
- function xA({ state: e }) {
25849
+ function SA({ state: e }) {
25747
25850
  let { t } = P("admin");
25748
25851
  return /* @__PURE__ */ R(X, {
25749
25852
  "data-testid": "lite-running",
@@ -25766,19 +25869,19 @@ function xA({ state: e }) {
25766
25869
  })]
25767
25870
  });
25768
25871
  }
25769
- var SA = [
25872
+ var CA = [
25770
25873
  "own_server_stop",
25771
25874
  "summary_failed",
25772
25875
  "no_lite_data"
25773
25876
  ];
25774
- function CA(e) {
25775
- return `liteImport.fail.codes.${SA.includes(e) ? e : "other"}`;
25877
+ function wA(e) {
25878
+ return `liteImport.fail.codes.${CA.includes(e) ? e : "other"}`;
25776
25879
  }
25777
- async function wA(e) {
25880
+ async function TA(e) {
25778
25881
  let t = await e.reset();
25779
25882
  return t.phase === "idle" ? e.scan() : t;
25780
25883
  }
25781
- function TA({ state: e, bridge: t, act: n, busy: r, onRetry: i, extra: a }) {
25884
+ function EA({ state: e, bridge: t, act: n, busy: r, onRetry: i, extra: a }) {
25782
25885
  let { t: o } = P("admin"), s = gA();
25783
25886
  return /* @__PURE__ */ R(X, {
25784
25887
  "data-testid": "lite-failed",
@@ -25788,7 +25891,7 @@ function TA({ state: e, bridge: t, act: n, busy: r, onRetry: i, extra: a }) {
25788
25891
  className: "size-5 text-danger",
25789
25892
  "aria-hidden": !0
25790
25893
  }), o("liteImport.fail.title")]
25791
- }), e.failure && /* @__PURE__ */ L(nb, { children: o(CA(e.failure)) })] }), /* @__PURE__ */ R($, {
25894
+ }), e.failure && /* @__PURE__ */ L(nb, { children: o(wA(e.failure)) })] }), /* @__PURE__ */ R($, {
25792
25895
  className: "flex flex-col gap-4",
25793
25896
  children: [
25794
25897
  /* @__PURE__ */ L("ul", {
@@ -25806,7 +25909,7 @@ function TA({ state: e, bridge: t, act: n, busy: r, onRetry: i, extra: a }) {
25806
25909
  /* @__PURE__ */ L(W, {
25807
25910
  size: "touch",
25808
25911
  disabled: r,
25809
- onClick: () => void n(() => wA(t), s).then((e) => {
25912
+ onClick: () => void n(() => TA(t), s).then((e) => {
25810
25913
  e && i?.();
25811
25914
  }),
25812
25915
  children: o("liteImport.fail.retry")
@@ -25826,7 +25929,7 @@ function TA({ state: e, bridge: t, act: n, busy: r, onRetry: i, extra: a }) {
25826
25929
  })]
25827
25930
  });
25828
25931
  }
25829
- function EA() {
25932
+ function DA() {
25830
25933
  let { t: e } = P("admin");
25831
25934
  return /* @__PURE__ */ R("div", {
25832
25935
  className: "flex min-w-0 flex-col gap-3 rounded-lg border p-3 sm:flex-row sm:items-center",
@@ -25848,7 +25951,7 @@ function EA() {
25848
25951
  ]
25849
25952
  });
25850
25953
  }
25851
- function DA({ state: e }) {
25954
+ function OA({ state: e }) {
25852
25955
  let { t } = P("admin"), n = e.result, r = e.mode === "merge";
25853
25956
  return /* @__PURE__ */ R(X, {
25854
25957
  "data-testid": "lite-done",
@@ -25906,16 +26009,16 @@ function DA({ state: e }) {
25906
26009
  children: t("liteImport.done.toInboxes")
25907
26010
  })
25908
26011
  })]
25909
- }) : /* @__PURE__ */ L(EA, {})
26012
+ }) : /* @__PURE__ */ L(DA, {})
25910
26013
  ]
25911
26014
  })]
25912
26015
  });
25913
26016
  }
25914
26017
  // src/lite-import/LiteImportPage.tsx
25915
- function OA(e, t) {
26018
+ function kA(e, t) {
25916
26019
  return e === "running" ? "running" : e === "done" ? "done" : e === "failed" ? "running" : e === "blocked" && t === "review" ? "checks" : t;
25917
26020
  }
25918
- function kA({ merge: e, at: t, done: n }) {
26021
+ function AA({ merge: e, at: t, done: n }) {
25919
26022
  let { t: r } = P("admin"), i = e ? [
25920
26023
  "found",
25921
26024
  "checks",
@@ -25944,7 +26047,7 @@ function kA({ merge: e, at: t, done: n }) {
25944
26047
  }, e))
25945
26048
  });
25946
26049
  }
25947
- function AA() {
26050
+ function jA() {
25948
26051
  let { t: e } = P("admin");
25949
26052
  return /* @__PURE__ */ L(X, {
25950
26053
  "data-testid": "lite-desktop-only",
@@ -25982,7 +26085,7 @@ function AA() {
25982
26085
  })
25983
26086
  });
25984
26087
  }
25985
- function jA() {
26088
+ function MA() {
25986
26089
  let { t: e } = P("admin");
25987
26090
  return /* @__PURE__ */ L(X, {
25988
26091
  "data-testid": "lite-none",
@@ -26011,7 +26114,7 @@ function jA() {
26011
26114
  })
26012
26115
  });
26013
26116
  }
26014
- function MA({ bridge: e }) {
26117
+ function NA({ bridge: e }) {
26015
26118
  let { t } = P("admin"), { state: n, error: r, busy: i, act: a } = Wl(e), o = js(), [s, c] = g("found");
26016
26119
  if (r) return /* @__PURE__ */ L(q, {
26017
26120
  tone: "danger",
@@ -26021,8 +26124,7 @@ function MA({ bridge: e }) {
26021
26124
  className: "size-5 animate-spin text-muted-foreground",
26022
26125
  "aria-label": t("liteImport.scanning")
26023
26126
  });
26024
- if (n.phase === "none" || !n.lite) return /* @__PURE__ */ L(jA, {});
26025
- let l = n.mode === "merge", u = OA(n.phase, s), d = (o.data ?? []).filter((e) => !e.disabled && e.kind !== "ai"), f = /* @__PURE__ */ L(W, {
26127
+ let l = /* @__PURE__ */ L(W, {
26026
26128
  asChild: !0,
26027
26129
  variant: "outline",
26028
26130
  size: "touch",
@@ -26030,48 +26132,64 @@ function MA({ bridge: e }) {
26030
26132
  to: "/admin/inboxes",
26031
26133
  children: t("liteImport.cancel")
26032
26134
  })
26033
- }), p = {
26135
+ }), u = {
26034
26136
  state: n,
26035
26137
  bridge: e,
26036
26138
  act: a,
26037
26139
  busy: i
26038
- }, m = t("liteImport.actionFailed");
26140
+ };
26141
+ if (n.phase === "protected") return /* @__PURE__ */ R("div", {
26142
+ className: "flex min-w-0 flex-col gap-5",
26143
+ "data-testid": "lite-wizard",
26144
+ "data-phase": "protected",
26145
+ children: [/* @__PURE__ */ L(AA, {
26146
+ merge: !0,
26147
+ at: "found",
26148
+ done: !1
26149
+ }), /* @__PURE__ */ L(_A, {
26150
+ ...u,
26151
+ mode: "merge",
26152
+ cancel: l
26153
+ })]
26154
+ });
26155
+ if (n.phase === "none" || !n.lite) return /* @__PURE__ */ L(MA, {});
26156
+ let d = n.mode === "merge", f = kA(n.phase, s), p = (o.data ?? []).filter((e) => !e.disabled && e.kind !== "ai"), m = t("liteImport.actionFailed");
26039
26157
  return /* @__PURE__ */ R("div", {
26040
26158
  className: "flex min-w-0 flex-col gap-5",
26041
26159
  "data-testid": "lite-wizard",
26042
26160
  "data-phase": n.phase,
26043
26161
  children: [
26044
- /* @__PURE__ */ L(kA, {
26045
- merge: l,
26046
- at: u,
26162
+ /* @__PURE__ */ L(AA, {
26163
+ merge: d,
26164
+ at: f,
26047
26165
  done: n.phase === "done"
26048
26166
  }),
26049
- u === "found" && /* @__PURE__ */ L(_A, {
26167
+ f === "found" && /* @__PURE__ */ L(vA, {
26050
26168
  state: n,
26051
26169
  onContinue: () => c("checks"),
26052
- cancel: f
26170
+ cancel: l
26053
26171
  }),
26054
- u === "checks" && /* @__PURE__ */ L(vA, {
26055
- ...p,
26172
+ f === "checks" && /* @__PURE__ */ L(yA, {
26173
+ ...u,
26056
26174
  continueLabel: t("liteImport.check.continue"),
26057
- onContinue: () => l ? c("review") : void a(() => e.start({ team: [] }), m)
26175
+ onContinue: () => d ? c("review") : void a(() => e.start({ team: [] }), m)
26058
26176
  }),
26059
- u === "review" && (o.isPending ? /* @__PURE__ */ L(Fr, {
26177
+ f === "review" && (o.isPending ? /* @__PURE__ */ L(Fr, {
26060
26178
  className: "size-5 animate-spin text-muted-foreground",
26061
26179
  "aria-hidden": !0
26062
- }) : /* @__PURE__ */ L(bA, {
26063
- ...p,
26064
- people: d
26180
+ }) : /* @__PURE__ */ L(xA, {
26181
+ ...u,
26182
+ people: p
26065
26183
  })),
26066
- u === "running" && (n.phase === "failed" ? /* @__PURE__ */ L(TA, {
26067
- ...p,
26184
+ f === "running" && (n.phase === "failed" ? /* @__PURE__ */ L(EA, {
26185
+ ...u,
26068
26186
  onRetry: () => c("found")
26069
- }) : /* @__PURE__ */ L(xA, { state: n })),
26070
- u === "done" && /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L(DA, { state: n }), /* @__PURE__ */ L(vD, {})] })
26187
+ }) : /* @__PURE__ */ L(SA, { state: n })),
26188
+ f === "done" && /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L(OA, { state: n }), /* @__PURE__ */ L(vD, {})] })
26071
26189
  ]
26072
26190
  });
26073
26191
  }
26074
- function NA() {
26192
+ function PA() {
26075
26193
  let { t: e } = P("admin"), t = Hl();
26076
26194
  return /* @__PURE__ */ R("div", {
26077
26195
  className: "flex w-full min-w-0 flex-col gap-5",
@@ -26088,12 +26206,12 @@ function NA() {
26088
26206
  title: e("liteImport.pageTitle"),
26089
26207
  className: "pb-0"
26090
26208
  }),
26091
- t ? /* @__PURE__ */ L(MA, { bridge: t }) : /* @__PURE__ */ L(AA, {})
26209
+ t ? /* @__PURE__ */ L(NA, { bridge: t }) : /* @__PURE__ */ L(jA, {})
26092
26210
  ]
26093
26211
  });
26094
26212
  }
26095
26213
  // src/admin/AdminLayout.tsx
26096
- var PA = [
26214
+ var FA = [
26097
26215
  {
26098
26216
  to: "reports",
26099
26217
  labelKey: "nav.reports",
@@ -26145,31 +26263,31 @@ var PA = [
26145
26263
  icon: Si
26146
26264
  }
26147
26265
  ];
26148
- function FA(e) {
26149
- return PA.filter((t) => t.to !== (e ? "whatsapp" : "inboxes"));
26266
+ function IA(e) {
26267
+ return FA.filter((t) => t.to !== (e ? "whatsapp" : "inboxes"));
26150
26268
  }
26151
- function IA() {
26269
+ function LA() {
26152
26270
  let e = zs();
26153
26271
  return {
26154
26272
  multiInbox: (e.data?.maxInboxes ?? 1) > 1,
26155
26273
  isPending: e.isPending
26156
26274
  };
26157
26275
  }
26158
- function LA() {
26159
- let { multiInbox: e } = IA();
26276
+ function RA() {
26277
+ let { multiInbox: e } = LA();
26160
26278
  return e ? /* @__PURE__ */ L(k, {
26161
26279
  to: "/admin/inboxes",
26162
26280
  replace: !0
26163
26281
  }) : /* @__PURE__ */ L(hA, {});
26164
26282
  }
26165
- function RA() {
26166
- let { multiInbox: e, isPending: t } = IA();
26283
+ function zA() {
26284
+ let { multiInbox: e, isPending: t } = LA();
26167
26285
  return t ? /* @__PURE__ */ L(Ix, { rows: 2 }) : e ? /* @__PURE__ */ L(TD, {}) : /* @__PURE__ */ L(k, {
26168
26286
  to: "/admin/whatsapp",
26169
26287
  replace: !0
26170
26288
  });
26171
26289
  }
26172
- function zA() {
26290
+ function BA() {
26173
26291
  let e = xy();
26174
26292
  if (e.isPending) return /* @__PURE__ */ L(Ix, { rows: 2 });
26175
26293
  let t = e.data;
@@ -26183,14 +26301,14 @@ function zA() {
26183
26301
  replace: !0
26184
26302
  });
26185
26303
  }
26186
- function BA() {
26304
+ function VA() {
26187
26305
  let { agentId: e = "" } = j();
26188
26306
  return /^[1-9]\d{0,9}$/.test(e) ? /* @__PURE__ */ L(yw, {}) : /* @__PURE__ */ L(k, {
26189
26307
  to: "/admin/members",
26190
26308
  replace: !0
26191
26309
  });
26192
26310
  }
26193
- function VA(e) {
26311
+ function HA(e) {
26194
26312
  return e.flatMap((e) => (e.adminNav ?? []).map((t) => ({
26195
26313
  key: `${e.name}:${t.path}`,
26196
26314
  href: Eu(e.name, t.path, !0),
@@ -26199,13 +26317,13 @@ function VA(e) {
26199
26317
  useBadge: t.useBadge
26200
26318
  })));
26201
26319
  }
26202
- function HA(e, t) {
26320
+ function UA(e, t) {
26203
26321
  for (let n of e) for (let e of n.routes ?? []) if (e.admin && e.section && ne({
26204
26322
  path: Eu(n.name, e.path, !0),
26205
26323
  end: !0
26206
26324
  }, t)) return e.section;
26207
26325
  }
26208
- function UA({ useBadge: e }) {
26326
+ function WA({ useBadge: e }) {
26209
26327
  let t = Mu(), n = e();
26210
26328
  if (!n) return null;
26211
26329
  let r = typeof n.count == "number" && n.count > 0 ? n.count : 0;
@@ -26228,14 +26346,14 @@ function UA({ useBadge: e }) {
26228
26346
  })]
26229
26347
  });
26230
26348
  }
26231
- function WA({ useBadge: e }) {
26349
+ function GA({ useBadge: e }) {
26232
26350
  return e ? /* @__PURE__ */ L(mu, {
26233
26351
  fallback: null,
26234
- children: /* @__PURE__ */ L(UA, { useBadge: e })
26352
+ children: /* @__PURE__ */ L(WA, { useBadge: e })
26235
26353
  }) : null;
26236
26354
  }
26237
- var GA = ({ isActive: e }) => U("flex min-h-11 items-center gap-3 rounded-md px-3 text-sm font-medium transition-colors md:min-h-9", "outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", e ? "bg-primary/10 text-primary" : "text-muted-foreground hover:bg-accent hover:text-foreground");
26238
- function KA() {
26355
+ var KA = ({ isActive: e }) => U("flex min-h-11 items-center gap-3 rounded-md px-3 text-sm font-medium transition-colors md:min-h-9", "outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", e ? "bg-primary/10 text-primary" : "text-muted-foreground hover:bg-accent hover:text-foreground");
26356
+ function qA() {
26239
26357
  let { pathname: e } = re();
26240
26358
  return u(() => {
26241
26359
  vo({
@@ -26248,17 +26366,17 @@ function KA() {
26248
26366
  replace: !0
26249
26367
  });
26250
26368
  }
26251
- function qA({ onNavigate: e, className: t }) {
26252
- let { t: n } = P("admin"), r = Mu(), i = Au(), a = VA(i), { multiInbox: o } = IA(), s = HA(i, re().pathname);
26369
+ function JA({ onNavigate: e, className: t }) {
26370
+ let { t: n } = P("admin"), r = Mu(), i = Au(), a = HA(i), { multiInbox: o } = LA(), s = UA(i, re().pathname);
26253
26371
  return /* @__PURE__ */ L("nav", {
26254
26372
  "aria-label": n("nav.label"),
26255
26373
  className: t,
26256
26374
  children: /* @__PURE__ */ R("ul", {
26257
26375
  className: "flex flex-col gap-1",
26258
- children: [FA(o).map((t) => /* @__PURE__ */ L("li", { children: /* @__PURE__ */ R(O, {
26376
+ children: [IA(o).map((t) => /* @__PURE__ */ L("li", { children: /* @__PURE__ */ R(O, {
26259
26377
  to: `/admin/${t.to}`,
26260
26378
  onClick: e,
26261
- className: ({ isActive: e }) => GA({ isActive: e || s === t.to }),
26379
+ className: ({ isActive: e }) => KA({ isActive: e || s === t.to }),
26262
26380
  children: [/* @__PURE__ */ L(t.icon, {
26263
26381
  className: "size-4 shrink-0",
26264
26382
  "aria-hidden": !0
@@ -26266,20 +26384,20 @@ function qA({ onNavigate: e, className: t }) {
26266
26384
  }) }, t.to)), a.map((t) => /* @__PURE__ */ L("li", { children: /* @__PURE__ */ R(O, {
26267
26385
  to: t.href,
26268
26386
  onClick: e,
26269
- className: GA,
26387
+ className: KA,
26270
26388
  children: [
26271
26389
  /* @__PURE__ */ L(t.icon, {
26272
26390
  className: "size-4 shrink-0",
26273
26391
  "aria-hidden": !0
26274
26392
  }),
26275
26393
  r(t.labelKey),
26276
- /* @__PURE__ */ L(WA, { useBadge: t.useBadge })
26394
+ /* @__PURE__ */ L(GA, { useBadge: t.useBadge })
26277
26395
  ]
26278
26396
  }) }, t.key))]
26279
26397
  })
26280
26398
  });
26281
26399
  }
26282
- function JA({ version: e, onNavigate: t }) {
26400
+ function YA({ version: e, onNavigate: t }) {
26283
26401
  let { logout: n } = Sl(), { t: r } = P("admin"), [i, a] = g(!1);
26284
26402
  async function o() {
26285
26403
  a(!0);
@@ -26319,7 +26437,7 @@ function JA({ version: e, onNavigate: t }) {
26319
26437
  ]
26320
26438
  });
26321
26439
  }
26322
- function YA({ version: e, onNavigate: t }) {
26440
+ function XA({ version: e, onNavigate: t }) {
26323
26441
  let { t: n } = P("admin");
26324
26442
  return /* @__PURE__ */ R("div", {
26325
26443
  className: "flex min-h-0 flex-1 flex-col overflow-y-auto",
@@ -26338,19 +26456,19 @@ function YA({ version: e, onNavigate: t }) {
26338
26456
  })
26339
26457
  })
26340
26458
  }),
26341
- /* @__PURE__ */ L(qA, {
26459
+ /* @__PURE__ */ L(JA, {
26342
26460
  className: "flex-1 p-2",
26343
26461
  onNavigate: t
26344
26462
  }),
26345
- /* @__PURE__ */ L(JA, {
26463
+ /* @__PURE__ */ L(YA, {
26346
26464
  version: e,
26347
26465
  onNavigate: t
26348
26466
  })
26349
26467
  ]
26350
26468
  });
26351
26469
  }
26352
- function XA() {
26353
- let { user: e, isLoading: t } = Sl(), n = re(), [r, i] = g(!1), a = eb(), { t: o } = P(["admin", "common"]), s = Au(), c = Mu(), { multiInbox: l } = IA();
26470
+ function ZA() {
26471
+ let { user: e, isLoading: t } = Sl(), n = re(), [r, i] = g(!1), a = eb(), { t: o } = P(["admin", "common"]), s = Au(), c = Mu(), { multiInbox: l } = LA();
26354
26472
  if (t) return /* @__PURE__ */ R("div", {
26355
26473
  role: "status",
26356
26474
  className: "flex min-h-dvh items-center justify-center bg-background text-muted-foreground",
@@ -26366,7 +26484,7 @@ function XA() {
26366
26484
  to: "/",
26367
26485
  replace: !0
26368
26486
  });
26369
- let u = HA(s, n.pathname), d = FA(l).find((e) => n.pathname.includes(`/admin/${e.to}`) || u === e.to), f = d ? void 0 : VA(s).find((e) => n.pathname === e.href || n.pathname.startsWith(`${e.href}/`)), p = d ? o(d.labelKey) : f ? c(f.labelKey) : void 0;
26487
+ let u = UA(s, n.pathname), d = IA(l).find((e) => n.pathname.includes(`/admin/${e.to}`) || u === e.to), f = d ? void 0 : HA(s).find((e) => n.pathname === e.href || n.pathname.startsWith(`${e.href}/`)), p = d ? o(d.labelKey) : f ? c(f.labelKey) : void 0;
26370
26488
  return /* @__PURE__ */ R("div", {
26371
26489
  className: "safe-x flex min-h-dvh flex-col bg-background text-foreground md:flex-row",
26372
26490
  children: [
@@ -26407,7 +26525,7 @@ function XA() {
26407
26525
  children: [/* @__PURE__ */ R(Uy, {
26408
26526
  className: "border-b",
26409
26527
  children: [/* @__PURE__ */ L(Gy, { children: o("title") }), /* @__PURE__ */ L(Ky, { children: o("common:appName") })]
26410
- }), /* @__PURE__ */ L(YA, {
26528
+ }), /* @__PURE__ */ L(XA, {
26411
26529
  version: a ?? void 0,
26412
26530
  onNavigate: () => i(!1)
26413
26531
  })]
@@ -26436,7 +26554,7 @@ function XA() {
26436
26554
  className: "mt-3 w-full"
26437
26555
  })
26438
26556
  ]
26439
- }), /* @__PURE__ */ L(YA, { version: a ?? void 0 })]
26557
+ }), /* @__PURE__ */ L(XA, { version: a ?? void 0 })]
26440
26558
  })
26441
26559
  }),
26442
26560
  /* @__PURE__ */ R("main", {
@@ -26465,7 +26583,7 @@ function XA() {
26465
26583
  }),
26466
26584
  /* @__PURE__ */ L(A, {
26467
26585
  path: "members/ai",
26468
- element: /* @__PURE__ */ L(zA, {})
26586
+ element: /* @__PURE__ */ L(BA, {})
26469
26587
  }),
26470
26588
  /* @__PURE__ */ L(A, {
26471
26589
  path: "members/ai/new",
@@ -26473,7 +26591,7 @@ function XA() {
26473
26591
  }),
26474
26592
  /* @__PURE__ */ L(A, {
26475
26593
  path: "members/ai/:agentId",
26476
- element: /* @__PURE__ */ L(BA, {})
26594
+ element: /* @__PURE__ */ L(VA, {})
26477
26595
  }),
26478
26596
  /* @__PURE__ */ L(A, {
26479
26597
  path: "quick-replies",
@@ -26489,15 +26607,15 @@ function XA() {
26489
26607
  }),
26490
26608
  /* @__PURE__ */ L(A, {
26491
26609
  path: "whatsapp",
26492
- element: /* @__PURE__ */ L(LA, {})
26610
+ element: /* @__PURE__ */ L(RA, {})
26493
26611
  }),
26494
26612
  /* @__PURE__ */ L(A, {
26495
26613
  path: "inboxes",
26496
- element: /* @__PURE__ */ L(RA, {})
26614
+ element: /* @__PURE__ */ L(zA, {})
26497
26615
  }),
26498
26616
  /* @__PURE__ */ L(A, {
26499
26617
  path: "inboxes/lite",
26500
- element: /* @__PURE__ */ L(mu, { children: /* @__PURE__ */ L(NA, {}) })
26618
+ element: /* @__PURE__ */ L(mu, { children: /* @__PURE__ */ L(PA, {}) })
26501
26619
  }),
26502
26620
  /* @__PURE__ */ L(A, {
26503
26621
  path: "tunnel",
@@ -26514,7 +26632,7 @@ function XA() {
26514
26632
  Pu(s, !0),
26515
26633
  /* @__PURE__ */ L(A, {
26516
26634
  path: "*",
26517
- element: /* @__PURE__ */ L(KA, {})
26635
+ element: /* @__PURE__ */ L(qA, {})
26518
26636
  })
26519
26637
  ] })
26520
26638
  })]
@@ -26523,7 +26641,7 @@ function XA() {
26523
26641
  });
26524
26642
  }
26525
26643
  // src/i18n/LanguageSelect.tsx
26526
- function ZA({ className: e }) {
26644
+ function QA({ className: e }) {
26527
26645
  let { t } = P(), { locale: n, changeLocale: r } = pO();
26528
26646
  return /* @__PURE__ */ R(ob, {
26529
26647
  value: n,
@@ -26547,7 +26665,7 @@ function ZA({ className: e }) {
26547
26665
  });
26548
26666
  }
26549
26667
  // src/auth/AuthShell.tsx
26550
- function QA({ className: e = "size-10" }) {
26668
+ function $A({ className: e = "size-10" }) {
26551
26669
  return /* @__PURE__ */ L("img", {
26552
26670
  src: "/icon-192.png",
26553
26671
  alt: "",
@@ -26555,7 +26673,7 @@ function QA({ className: e = "size-10" }) {
26555
26673
  className: U("select-none rounded-lg", e)
26556
26674
  });
26557
26675
  }
26558
- function $A({ title: e, subtitle: t, children: n, wide: r = !1, illustration: i, languageSelect: a = !0 }) {
26676
+ function ej({ title: e, subtitle: t, children: n, wide: r = !1, illustration: i, languageSelect: a = !0 }) {
26559
26677
  let { t: o } = P(["common", "app"]), s = eb(), c = _l(), l = pl(c);
26560
26678
  return /* @__PURE__ */ L("div", {
26561
26679
  className: "safe-x safe-top safe-bottom relative min-h-dvh bg-background text-foreground",
@@ -26566,11 +26684,11 @@ function $A({ title: e, subtitle: t, children: n, wide: r = !1, illustration: i,
26566
26684
  children: [
26567
26685
  a && /* @__PURE__ */ L("div", {
26568
26686
  className: "mb-2 flex justify-end sm:absolute sm:top-4 sm:right-4 sm:mb-0",
26569
- children: /* @__PURE__ */ L(ZA, {})
26687
+ children: /* @__PURE__ */ L(QA, {})
26570
26688
  }),
26571
26689
  /* @__PURE__ */ R("div", {
26572
26690
  className: "mb-4 flex items-center justify-center gap-2",
26573
- children: [/* @__PURE__ */ L(QA, { className: "size-8 rounded-lg" }), /* @__PURE__ */ L("span", {
26691
+ children: [/* @__PURE__ */ L($A, { className: "size-8 rounded-lg" }), /* @__PURE__ */ L("span", {
26574
26692
  className: "text-sm font-semibold tracking-tight",
26575
26693
  children: o("appName")
26576
26694
  })]
@@ -26618,7 +26736,7 @@ function $A({ title: e, subtitle: t, children: n, wide: r = !1, illustration: i,
26618
26736
  })
26619
26737
  });
26620
26738
  }
26621
- function ej({ label: t, hint: n, error: r, className: i, id: a, ...o }) {
26739
+ function tj({ label: t, hint: n, error: r, className: i, id: a, ...o }) {
26622
26740
  let { t: s } = P("auth"), c = e.useId(), l = a ?? c, u = r ? `${l}-error` : n ? `${l}-hint` : void 0, d = o.type === "password", [f, p] = e.useState(!1);
26623
26741
  return /* @__PURE__ */ R("div", {
26624
26742
  className: U("flex flex-col gap-1.5", i),
@@ -26659,13 +26777,13 @@ function ej({ label: t, hint: n, error: r, className: i, id: a, ...o }) {
26659
26777
  ]
26660
26778
  });
26661
26779
  }
26662
- function tj() {
26780
+ function nj() {
26663
26781
  return /* @__PURE__ */ L(Fr, {
26664
26782
  className: "animate-spin",
26665
26783
  "aria-hidden": "true"
26666
26784
  });
26667
26785
  }
26668
- function nj({ label: e }) {
26786
+ function rj({ label: e }) {
26669
26787
  let { t } = P();
26670
26788
  return /* @__PURE__ */ L("div", {
26671
26789
  role: "status",
@@ -26679,15 +26797,15 @@ function nj({ label: e }) {
26679
26797
  });
26680
26798
  }
26681
26799
  // src/auth/ChangePasswordPage.tsx
26682
- function rj() {
26800
+ function ij() {
26683
26801
  let { t: e } = P(["auth", "common"]), t = ie(), { user: n, isLoading: r, logout: i } = Sl(), a = os(), [o, s] = g(""), [c, l] = g(""), [u, d] = g(""), [f, p] = g(!1);
26684
- if (r) return /* @__PURE__ */ L(nj, {});
26802
+ if (r) return /* @__PURE__ */ L(rj, {});
26685
26803
  if (!n) return /* @__PURE__ */ L(k, {
26686
26804
  to: "/login",
26687
26805
  replace: !0
26688
26806
  });
26689
26807
  let m = n.mustChangePassword, h = (f || c.length > 0) && c.length < 8, _ = (f || u.length > 0) && c !== u, v = c.length > 0 && c === o, y = o.length > 0 && c.length >= 8 && c === u && !v;
26690
- return /* @__PURE__ */ L($A, {
26808
+ return /* @__PURE__ */ L(ej, {
26691
26809
  title: e(m ? "changePassword.titleForced" : "changePassword.title"),
26692
26810
  subtitle: m ? e("changePassword.welcome", { name: n.displayName }) : n.displayName,
26693
26811
  children: /* @__PURE__ */ R("form", {
@@ -26704,7 +26822,7 @@ function rj() {
26704
26822
  tone: "danger",
26705
26823
  children: V(a.error)
26706
26824
  }),
26707
- /* @__PURE__ */ L(ej, {
26825
+ /* @__PURE__ */ L(tj, {
26708
26826
  label: e("changePassword.current"),
26709
26827
  type: "password",
26710
26828
  autoComplete: "current-password",
@@ -26712,7 +26830,7 @@ function rj() {
26712
26830
  onChange: (e) => s(e.target.value),
26713
26831
  error: f && !o ? e("changePassword.required") : void 0
26714
26832
  }),
26715
- /* @__PURE__ */ L(ej, {
26833
+ /* @__PURE__ */ L(tj, {
26716
26834
  label: e("changePassword.new"),
26717
26835
  type: "password",
26718
26836
  autoComplete: "new-password",
@@ -26721,7 +26839,7 @@ function rj() {
26721
26839
  hint: e("changePassword.minLength"),
26722
26840
  error: h ? e("changePassword.minLength") : v ? e("changePassword.sameAsOld") : void 0
26723
26841
  }),
26724
- /* @__PURE__ */ L(ej, {
26842
+ /* @__PURE__ */ L(tj, {
26725
26843
  label: e("changePassword.confirm"),
26726
26844
  type: "password",
26727
26845
  autoComplete: "new-password",
@@ -26735,7 +26853,7 @@ function rj() {
26735
26853
  className: "w-full",
26736
26854
  "aria-busy": a.isPending || void 0,
26737
26855
  disabled: a.isPending,
26738
- children: [a.isPending ? /* @__PURE__ */ L(tj, {}) : /* @__PURE__ */ L(Ar, { "aria-hidden": "true" }), e("changePassword.submit")]
26856
+ children: [a.isPending ? /* @__PURE__ */ L(nj, {}) : /* @__PURE__ */ L(Ar, { "aria-hidden": "true" }), e("changePassword.submit")]
26739
26857
  }),
26740
26858
  /* @__PURE__ */ R("div", {
26741
26859
  className: "flex justify-between gap-2",
@@ -26759,19 +26877,19 @@ function rj() {
26759
26877
  });
26760
26878
  }
26761
26879
  // src/auth/LoginPage.tsx
26762
- function ij(e) {
26880
+ function aj(e) {
26763
26881
  let t = e?.from;
26764
26882
  return typeof t == "string" && t.startsWith("/") && !t.startsWith("//") ? t : "/";
26765
26883
  }
26766
- function aj() {
26884
+ function oj() {
26767
26885
  let { t: e } = P("auth"), t = ie(), n = re(), r = $o(), i = es(), a = ns(), [o, s] = g(""), [c, l] = g(""), [u, d] = g(!1);
26768
26886
  return i.data?.needsSetup ? /* @__PURE__ */ L(k, {
26769
26887
  to: "/setup",
26770
26888
  replace: !0
26771
26889
  }) : r.data && !a.isPending ? /* @__PURE__ */ L(k, {
26772
- to: r.data.mustChangePassword ? "/change-password" : ij(n.state),
26890
+ to: r.data.mustChangePassword ? "/change-password" : aj(n.state),
26773
26891
  replace: !0
26774
- }) : /* @__PURE__ */ L($A, {
26892
+ }) : /* @__PURE__ */ L(ej, {
26775
26893
  title: e("login.title"),
26776
26894
  subtitle: e("login.subtitle"),
26777
26895
  children: /* @__PURE__ */ R("form", {
@@ -26780,7 +26898,7 @@ function aj() {
26780
26898
  username: o.trim(),
26781
26899
  password: c
26782
26900
  }, { onSuccess: (e) => {
26783
- e?.mustChangePassword ? t("/change-password", { replace: !0 }) : t(ij(n.state), { replace: !0 });
26901
+ e?.mustChangePassword ? t("/change-password", { replace: !0 }) : t(aj(n.state), { replace: !0 });
26784
26902
  } });
26785
26903
  },
26786
26904
  className: "flex flex-col gap-4",
@@ -26790,7 +26908,7 @@ function aj() {
26790
26908
  tone: "danger",
26791
26909
  children: V(a.error)
26792
26910
  }),
26793
- /* @__PURE__ */ L(ej, {
26911
+ /* @__PURE__ */ L(tj, {
26794
26912
  label: e("login.username"),
26795
26913
  name: "username",
26796
26914
  autoComplete: "username",
@@ -26802,7 +26920,7 @@ function aj() {
26802
26920
  onChange: (e) => s(e.target.value),
26803
26921
  error: u && !o.trim() ? e("login.usernameRequired") : void 0
26804
26922
  }),
26805
- /* @__PURE__ */ L(ej, {
26923
+ /* @__PURE__ */ L(tj, {
26806
26924
  label: e("login.passLabel"),
26807
26925
  name: "password",
26808
26926
  type: "password",
@@ -26818,7 +26936,7 @@ function aj() {
26818
26936
  className: "w-full",
26819
26937
  "aria-busy": a.isPending || void 0,
26820
26938
  disabled: a.isPending,
26821
- children: [a.isPending ? /* @__PURE__ */ L(tj, {}) : /* @__PURE__ */ L(zr, { "aria-hidden": "true" }), e("login.submit")]
26939
+ children: [a.isPending ? /* @__PURE__ */ L(nj, {}) : /* @__PURE__ */ L(zr, { "aria-hidden": "true" }), e("login.submit")]
26822
26940
  }),
26823
26941
  /* @__PURE__ */ L("p", {
26824
26942
  className: "text-center text-sm text-muted-foreground",
@@ -26829,7 +26947,7 @@ function aj() {
26829
26947
  });
26830
26948
  }
26831
26949
  // src/auth/OAuthConsentPage.tsx
26832
- function oj() {
26950
+ function sj() {
26833
26951
  let { t: e } = P("auth");
26834
26952
  return (t) => {
26835
26953
  if (t instanceof fo) {
@@ -26840,10 +26958,10 @@ function oj() {
26840
26958
  return V(t);
26841
26959
  };
26842
26960
  }
26843
- function sj() {
26844
- let { t: e } = P("auth"), { search: t } = re(), n = t.startsWith("?") ? t.slice(1) : t, r = tc(n), i = nc(), a = oj(), [o, s] = g(null);
26845
- if (r.isPending) return /* @__PURE__ */ L(nj, {});
26846
- if (r.isError) return /* @__PURE__ */ L($A, {
26961
+ function cj() {
26962
+ let { t: e } = P("auth"), { search: t } = re(), n = t.startsWith("?") ? t.slice(1) : t, r = tc(n), i = nc(), a = sj(), [o, s] = g(null);
26963
+ if (r.isPending) return /* @__PURE__ */ L(rj, {});
26964
+ if (r.isError) return /* @__PURE__ */ L(ej, {
26847
26965
  title: e("oauth.errorTitle"),
26848
26966
  children: /* @__PURE__ */ R("div", {
26849
26967
  className: "flex flex-col gap-4",
@@ -26869,7 +26987,7 @@ function sj() {
26869
26987
  approve: e
26870
26988
  }, { onSuccess: ({ redirectTo: e }) => window.location.assign(e) });
26871
26989
  };
26872
- return /* @__PURE__ */ L($A, {
26990
+ return /* @__PURE__ */ L(ej, {
26873
26991
  title: e("oauth.title", { name: u }),
26874
26992
  subtitle: e("oauth.subtitle"),
26875
26993
  children: /* @__PURE__ */ R("div", {
@@ -26923,13 +27041,13 @@ function sj() {
26923
27041
  size: "touch",
26924
27042
  disabled: d,
26925
27043
  onClick: () => f(!1),
26926
- children: [d && o === !1 && /* @__PURE__ */ L(tj, {}), e("oauth.deny")]
27044
+ children: [d && o === !1 && /* @__PURE__ */ L(nj, {}), e("oauth.deny")]
26927
27045
  }), /* @__PURE__ */ R(W, {
26928
27046
  type: "button",
26929
27047
  size: "touch",
26930
27048
  disabled: d,
26931
27049
  onClick: () => f(!0),
26932
- children: [d && o === !0 && /* @__PURE__ */ L(tj, {}), e("oauth.approve")]
27050
+ children: [d && o === !0 && /* @__PURE__ */ L(nj, {}), e("oauth.approve")]
26933
27051
  })]
26934
27052
  })
26935
27053
  ]
@@ -26937,15 +27055,15 @@ function sj() {
26937
27055
  });
26938
27056
  }
26939
27057
  // src/auth/RequireAuth.tsx
26940
- function cj({ admin: e = !1, children: t }) {
27058
+ function lj({ admin: e = !1, children: t }) {
26941
27059
  let n = re(), r = es(), { user: i, isLoading: a, error: o } = Sl();
26942
- if (r.isPending || a) return /* @__PURE__ */ L(nj, {});
27060
+ if (r.isPending || a) return /* @__PURE__ */ L(rj, {});
26943
27061
  if (r.data?.needsSetup) return /* @__PURE__ */ L(k, {
26944
27062
  to: "/setup",
26945
27063
  replace: !0
26946
27064
  });
26947
27065
  if (!i) {
26948
- if (o) return /* @__PURE__ */ L(lj, { message: V(o) });
27066
+ if (o) return /* @__PURE__ */ L(uj, { message: V(o) });
26949
27067
  let e = n.pathname + n.search;
26950
27068
  return /* @__PURE__ */ L(k, {
26951
27069
  to: "/login",
@@ -26961,7 +27079,7 @@ function cj({ admin: e = !1, children: t }) {
26961
27079
  replace: !0
26962
27080
  }) : /* @__PURE__ */ L(I, { children: t ?? /* @__PURE__ */ L(ee, {}) });
26963
27081
  }
26964
- function lj({ message: e }) {
27082
+ function uj({ message: e }) {
26965
27083
  let { t } = P(["auth", "common"]);
26966
27084
  return /* @__PURE__ */ L("div", {
26967
27085
  className: "safe-x flex min-h-dvh items-center justify-center bg-background px-4",
@@ -26981,7 +27099,7 @@ function lj({ message: e }) {
26981
27099
  });
26982
27100
  }
26983
27101
  // src/components/app/FeatureRequestAction.tsx
26984
- function uj({ placement: e = "button" }) {
27102
+ function dj({ placement: e = "button" }) {
26985
27103
  let { t, i18n: n } = P("app"), r = eb(), { feedback: i } = _l(), a = /* @__PURE__ */ R("a", {
26986
27104
  href: i(n.language, r),
26987
27105
  target: "_blank",
@@ -27011,22 +27129,22 @@ function uj({ placement: e = "button" }) {
27011
27129
  });
27012
27130
  }
27013
27131
  // src/lib/share-app.ts
27014
- var dj = el;
27015
- function fj(e) {
27132
+ var fj = el;
27133
+ function pj(e) {
27016
27134
  return {
27017
27135
  linkedin: `https://www.linkedin.com/sharing/share-offsite/?${new URLSearchParams({ url: e })}`,
27018
27136
  facebook: `https://www.facebook.com/sharer/sharer.php?${new URLSearchParams({ u: e })}`
27019
27137
  };
27020
27138
  }
27021
- fj(dj);
27022
- function pj(e, t = dj) {
27139
+ pj(fj);
27140
+ function mj(e, t = fj) {
27023
27141
  return [e.trim(), t].filter(Boolean).join("\n\n");
27024
27142
  }
27025
- async function mj(e) {
27143
+ async function hj(e) {
27026
27144
  if (!navigator.clipboard?.writeText) throw Error("Clipboard unavailable");
27027
27145
  await navigator.clipboard.writeText(e);
27028
27146
  }
27029
- async function hj(e, t = dj) {
27147
+ async function gj(e, t = fj) {
27030
27148
  if (typeof navigator.share == "function") try {
27031
27149
  return await navigator.share({
27032
27150
  title: "EzyChat Lite",
@@ -27036,9 +27154,9 @@ async function hj(e, t = dj) {
27036
27154
  } catch (e) {
27037
27155
  if (typeof e == "object" && e && "name" in e && e.name === "AbortError") return "cancelled";
27038
27156
  }
27039
- return await mj(pj(e, t)), "copied";
27157
+ return await hj(mj(e, t)), "copied";
27040
27158
  }
27041
- async function gj() {
27159
+ async function _j() {
27042
27160
  let e = new Image();
27043
27161
  await new Promise((t, n) => {
27044
27162
  e.onload = () => t(), e.onerror = () => n(/* @__PURE__ */ Error("Share image unavailable")), e.src = "/share-app.svg";
@@ -27061,18 +27179,18 @@ async function gj() {
27061
27179
  }
27062
27180
  }
27063
27181
  // src/components/app/ShareAppAction.tsx
27064
- var _j = [{
27182
+ var vj = [{
27065
27183
  id: "linkedin",
27066
27184
  name: "LinkedIn"
27067
27185
  }, {
27068
27186
  id: "facebook",
27069
27187
  name: "Facebook"
27070
- }], vj = "Instagram";
27071
- function yj({ open: e, onOpenChange: t }) {
27072
- let { t: n } = P(["app", "common"]), r = d(), i = ml(_l()), a = fj(i), [o, s] = g(null), c = o ?? n("share.caption"), [l, u] = g(null), [f, p] = g(!1);
27188
+ }], yj = "Instagram";
27189
+ function bj({ open: e, onOpenChange: t }) {
27190
+ let { t: n } = P(["app", "common"]), r = d(), i = ml(_l()), a = pj(i), [o, s] = g(null), c = o ?? n("share.caption"), [l, u] = g(null), [f, p] = g(!1);
27073
27191
  async function m(e, t) {
27074
27192
  try {
27075
- await mj(e), u(t);
27193
+ await hj(e), u(t);
27076
27194
  } catch {
27077
27195
  u("copyUnavailable");
27078
27196
  }
@@ -27080,7 +27198,7 @@ function yj({ open: e, onOpenChange: t }) {
27080
27198
  async function h() {
27081
27199
  u(null), p(!0);
27082
27200
  try {
27083
- await hj(c, i) === "copied" && u("messageCopied");
27201
+ await gj(c, i) === "copied" && u("messageCopied");
27084
27202
  } catch {
27085
27203
  u("shareUnavailable");
27086
27204
  } finally {
@@ -27090,7 +27208,7 @@ function yj({ open: e, onOpenChange: t }) {
27090
27208
  async function _() {
27091
27209
  u(null), p(!0);
27092
27210
  try {
27093
- await gj(), u("imageStarted");
27211
+ await _j(), u("imageStarted");
27094
27212
  } catch {
27095
27213
  u("imageFailed");
27096
27214
  } finally {
@@ -27129,7 +27247,7 @@ function yj({ open: e, onOpenChange: t }) {
27129
27247
  variant: "outline",
27130
27248
  size: "touch",
27131
27249
  className: "w-full",
27132
- onClick: () => void m(pj(c, i), "messageCopied"),
27250
+ onClick: () => void m(mj(c, i), "messageCopied"),
27133
27251
  children: [
27134
27252
  /* @__PURE__ */ L(fr, { "aria-hidden": "true" }),
27135
27253
  " ",
@@ -27180,7 +27298,7 @@ function yj({ open: e, onOpenChange: t }) {
27180
27298
  }),
27181
27299
  /* @__PURE__ */ L("div", {
27182
27300
  className: "grid grid-cols-1 gap-2 sm:grid-cols-2",
27183
- children: _j.map((e) => /* @__PURE__ */ L(W, {
27301
+ children: vj.map((e) => /* @__PURE__ */ L(W, {
27184
27302
  asChild: !0,
27185
27303
  variant: "outline",
27186
27304
  size: "touch",
@@ -27207,7 +27325,7 @@ function yj({ open: e, onOpenChange: t }) {
27207
27325
  children: [
27208
27326
  /* @__PURE__ */ L("p", {
27209
27327
  className: "text-sm font-medium",
27210
- children: vj
27328
+ children: yj
27211
27329
  }),
27212
27330
  /* @__PURE__ */ L("p", {
27213
27331
  className: "text-sm text-muted-foreground",
@@ -27254,15 +27372,15 @@ function yj({ open: e, onOpenChange: t }) {
27254
27372
  });
27255
27373
  }
27256
27374
  // src/auth/UserMenu.tsx
27257
- var bj = {
27375
+ var xj = {
27258
27376
  en: "EN",
27259
27377
  ms: "BM",
27260
27378
  "zh-CN": "中文"
27261
27379
  };
27262
- function xj(e, t) {
27263
- return bj[e] ?? t;
27380
+ function Sj(e, t) {
27381
+ return xj[e] ?? t;
27264
27382
  }
27265
- function Sj({ labelId: e, label: t, value: n, onValueChange: r, options: i }) {
27383
+ function Cj({ labelId: e, label: t, value: n, onValueChange: r, options: i }) {
27266
27384
  return /* @__PURE__ */ R("div", {
27267
27385
  className: "flex items-center justify-between gap-2",
27268
27386
  children: [/* @__PURE__ */ L("span", {
@@ -27288,7 +27406,7 @@ function Sj({ labelId: e, label: t, value: n, onValueChange: r, options: i }) {
27288
27406
  })]
27289
27407
  });
27290
27408
  }
27291
- function Cj({ className: e, align: t = "end" }) {
27409
+ function wj({ className: e, align: t = "end" }) {
27292
27410
  let { user: n, isAdmin: r, logout: i } = Sl(), a = eb(), { theme: o, setTheme: s } = yO(), { t: c } = P(), { locale: l, changeLocale: u } = pO(), [d, f] = g(!1), [p, m] = g(!1), h = _l(), _ = pl(h);
27293
27411
  return n ? /* @__PURE__ */ R(I, { children: [
27294
27412
  /* @__PURE__ */ R(Fb, { children: [/* @__PURE__ */ L(Lb, {
@@ -27331,7 +27449,7 @@ function Cj({ className: e, align: t = "end" }) {
27331
27449
  /* @__PURE__ */ L(Gb, {}),
27332
27450
  /* @__PURE__ */ R("div", {
27333
27451
  className: "flex flex-col gap-1 px-2 py-1.5",
27334
- children: [/* @__PURE__ */ L(Sj, {
27452
+ children: [/* @__PURE__ */ L(Cj, {
27335
27453
  labelId: "account-appearance-label",
27336
27454
  label: c("theme.label"),
27337
27455
  value: o,
@@ -27347,7 +27465,7 @@ function Cj({ className: e, align: t = "end" }) {
27347
27465
  })
27348
27466
  };
27349
27467
  })
27350
- }), /* @__PURE__ */ L(Sj, {
27468
+ }), /* @__PURE__ */ L(Cj, {
27351
27469
  labelId: "account-language-label",
27352
27470
  label: c("language.label"),
27353
27471
  value: l,
@@ -27358,7 +27476,7 @@ function Cj({ className: e, align: t = "end" }) {
27358
27476
  lang: e.code,
27359
27477
  content: /* @__PURE__ */ L("span", {
27360
27478
  "aria-hidden": "true",
27361
- children: xj(e.code, e.nativeName)
27479
+ children: Sj(e.code, e.nativeName)
27362
27480
  })
27363
27481
  }))
27364
27482
  })]
@@ -27409,7 +27527,7 @@ function Cj({ className: e, align: t = "end" }) {
27409
27527
  onSelect: () => m(!0),
27410
27528
  children: [/* @__PURE__ */ L(ji, { "aria-hidden": "true" }), c("account.share")]
27411
27529
  }),
27412
- /* @__PURE__ */ L(uj, { placement: "menu" }),
27530
+ /* @__PURE__ */ L(dj, { placement: "menu" }),
27413
27531
  _ && /* @__PURE__ */ L(Bb, {
27414
27532
  asChild: !0,
27415
27533
  className: "min-h-11",
@@ -27441,21 +27559,21 @@ function Cj({ className: e, align: t = "end" }) {
27441
27559
  onOpenChange: f,
27442
27560
  version: a ?? void 0
27443
27561
  }),
27444
- /* @__PURE__ */ L(yj, {
27562
+ /* @__PURE__ */ L(bj, {
27445
27563
  open: p,
27446
27564
  onOpenChange: m
27447
27565
  })
27448
27566
  ] }) : null;
27449
27567
  }
27450
27568
  // src/components/ui/command.tsx
27451
- function wj({ className: e, ...t }) {
27569
+ function Tj({ className: e, ...t }) {
27452
27570
  return /* @__PURE__ */ L(Ia, {
27453
27571
  "data-slot": "command",
27454
27572
  className: F("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground", e),
27455
27573
  ...t
27456
27574
  });
27457
27575
  }
27458
- function Tj({ title: e = "Command Palette", description: t = "Search for a command to run...", children: n, className: r, showCloseButton: i = !0, ...a }) {
27576
+ function Ej({ title: e = "Command Palette", description: t = "Search for a command to run...", children: n, className: r, showCloseButton: i = !0, ...a }) {
27459
27577
  return /* @__PURE__ */ R(Oc, {
27460
27578
  ...a,
27461
27579
  children: [/* @__PURE__ */ R(Pc, {
@@ -27464,14 +27582,14 @@ function Tj({ title: e = "Command Palette", description: t = "Search for a comma
27464
27582
  }), /* @__PURE__ */ L(Nc, {
27465
27583
  className: F("overflow-hidden p-0", r),
27466
27584
  showCloseButton: i,
27467
- children: /* @__PURE__ */ L(wj, {
27585
+ children: /* @__PURE__ */ L(Tj, {
27468
27586
  className: "**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",
27469
27587
  children: n
27470
27588
  })
27471
27589
  })]
27472
27590
  });
27473
27591
  }
27474
- function Ej({ className: e, ...t }) {
27592
+ function Dj({ className: e, ...t }) {
27475
27593
  return /* @__PURE__ */ R("div", {
27476
27594
  "data-slot": "command-input-wrapper",
27477
27595
  className: "flex h-9 items-center gap-2 border-b px-3",
@@ -27482,42 +27600,42 @@ function Ej({ className: e, ...t }) {
27482
27600
  })]
27483
27601
  });
27484
27602
  }
27485
- function Dj({ className: e, ...t }) {
27603
+ function Oj({ className: e, ...t }) {
27486
27604
  return /* @__PURE__ */ L(Ia.List, {
27487
27605
  "data-slot": "command-list",
27488
27606
  className: F("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", e),
27489
27607
  ...t
27490
27608
  });
27491
27609
  }
27492
- function Oj({ ...e }) {
27610
+ function kj({ ...e }) {
27493
27611
  return /* @__PURE__ */ L(Ia.Empty, {
27494
27612
  "data-slot": "command-empty",
27495
27613
  className: "py-6 text-center text-sm",
27496
27614
  ...e
27497
27615
  });
27498
27616
  }
27499
- function kj({ className: e, ...t }) {
27617
+ function Aj({ className: e, ...t }) {
27500
27618
  return /* @__PURE__ */ L(Ia.Group, {
27501
27619
  "data-slot": "command-group",
27502
27620
  className: F("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground", e),
27503
27621
  ...t
27504
27622
  });
27505
27623
  }
27506
- function Aj({ className: e, ...t }) {
27624
+ function jj({ className: e, ...t }) {
27507
27625
  return /* @__PURE__ */ L(Ia.Separator, {
27508
27626
  "data-slot": "command-separator",
27509
27627
  className: F("-mx-1 h-px bg-border", e),
27510
27628
  ...t
27511
27629
  });
27512
27630
  }
27513
- function jj({ className: e, ...t }) {
27631
+ function Mj({ className: e, ...t }) {
27514
27632
  return /* @__PURE__ */ L(Ia.Item, {
27515
27633
  "data-slot": "command-item",
27516
27634
  className: F("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", e),
27517
27635
  ...t
27518
27636
  });
27519
27637
  }
27520
- function Mj({ className: e, ...t }) {
27638
+ function Nj({ className: e, ...t }) {
27521
27639
  return /* @__PURE__ */ L("span", {
27522
27640
  "data-slot": "command-shortcut",
27523
27641
  className: F("ml-auto text-xs tracking-widest text-muted-foreground", e),
@@ -27525,7 +27643,7 @@ function Mj({ className: e, ...t }) {
27525
27643
  });
27526
27644
  }
27527
27645
  // src/inbox/ChatFilters.tsx
27528
- var Nj = [
27646
+ var Pj = [
27529
27647
  {
27530
27648
  key: "me",
27531
27649
  labelKey: "filters.mine"
@@ -27538,16 +27656,16 @@ var Nj = [
27538
27656
  key: "any",
27539
27657
  labelKey: "filters.all"
27540
27658
  }
27541
- ], Pj = 300, Fj = "all";
27542
- function Ij({ value: e, onChange: t, visible: n }) {
27659
+ ], Fj = 300, Ij = "all";
27660
+ function Lj({ value: e, onChange: t, visible: n }) {
27543
27661
  let { t: r } = P("inbox");
27544
27662
  if (n.length < 2) return null;
27545
- let i = e.inbox != null && n.some((t) => t.id === e.inbox) ? String(e.inbox) : Fj;
27663
+ let i = e.inbox != null && n.some((t) => t.id === e.inbox) ? String(e.inbox) : Ij;
27546
27664
  return /* @__PURE__ */ R(ob, {
27547
27665
  value: i,
27548
27666
  onValueChange: (n) => t({
27549
27667
  ...e,
27550
- inbox: n === Fj ? void 0 : Number(n)
27668
+ inbox: n === Ij ? void 0 : Number(n)
27551
27669
  }),
27552
27670
  children: [/* @__PURE__ */ L(lb, {
27553
27671
  "aria-label": r("inboxFilter.label"),
@@ -27557,7 +27675,7 @@ function Ij({ value: e, onChange: t, visible: n }) {
27557
27675
  }), /* @__PURE__ */ R(ub, {
27558
27676
  position: "popper",
27559
27677
  children: [/* @__PURE__ */ L(fb, {
27560
- value: Fj,
27678
+ value: Ij,
27561
27679
  className: "min-h-11 md:min-h-8",
27562
27680
  children: r("inboxFilter.all", { total: n.length })
27563
27681
  }), n.map((e) => {
@@ -27574,21 +27692,21 @@ function Ij({ value: e, onChange: t, visible: n }) {
27574
27692
  })]
27575
27693
  });
27576
27694
  }
27577
- function Lj({ onPick: e }) {
27695
+ function Rj({ onPick: e }) {
27578
27696
  let { t } = P("inbox"), [n, r] = g(""), i = Ds(n.trim());
27579
- return /* @__PURE__ */ R(wj, {
27697
+ return /* @__PURE__ */ R(Tj, {
27580
27698
  shouldFilter: !1,
27581
27699
  className: "bg-popover",
27582
- children: [/* @__PURE__ */ L(Ej, {
27700
+ children: [/* @__PURE__ */ L(Dj, {
27583
27701
  value: n,
27584
27702
  onValueChange: r,
27585
27703
  placeholder: t("filters.tagSearch"),
27586
27704
  maxLength: 30,
27587
27705
  className: "text-base md:text-sm"
27588
- }), /* @__PURE__ */ R(Dj, {
27706
+ }), /* @__PURE__ */ R(Oj, {
27589
27707
  label: t("filters.tagLabel"),
27590
27708
  className: "max-h-60 overscroll-contain",
27591
- children: [i.data && /* @__PURE__ */ L(Oj, { children: t("filters.tagEmpty") }), i.data?.map((t) => /* @__PURE__ */ L(jj, {
27709
+ children: [i.data && /* @__PURE__ */ L(kj, { children: t("filters.tagEmpty") }), i.data?.map((t) => /* @__PURE__ */ L(Mj, {
27592
27710
  value: t,
27593
27711
  onSelect: () => e(t),
27594
27712
  className: "min-h-11 cursor-pointer md:min-h-8",
@@ -27600,7 +27718,7 @@ function Lj({ onPick: e }) {
27600
27718
  })]
27601
27719
  });
27602
27720
  }
27603
- function Rj({ value: e, onChange: t, inboxes: n = [] }) {
27721
+ function zj({ value: e, onChange: t, inboxes: n = [] }) {
27604
27722
  let { t: r } = P("inbox"), [i, a] = g(e.q ?? ""), o = h({
27605
27723
  value: e,
27606
27724
  onChange: t
@@ -27615,7 +27733,7 @@ function Rj({ value: e, onChange: t, inboxes: n = [] }) {
27615
27733
  ...e,
27616
27734
  q: n
27617
27735
  });
27618
- }, Pj);
27736
+ }, Fj);
27619
27737
  return () => clearTimeout(e);
27620
27738
  }, [i]);
27621
27739
  let s = e.status ?? "open", [c, l] = g(!1), d = U("size-4", e.tag && "max-sm:hidden");
@@ -27628,7 +27746,7 @@ function Rj({ value: e, onChange: t, inboxes: n = [] }) {
27628
27746
  label: r("filters.searchLabel"),
27629
27747
  placeholder: r("filters.searchPlaceholder")
27630
27748
  }),
27631
- /* @__PURE__ */ L(Ij, {
27749
+ /* @__PURE__ */ L(Lj, {
27632
27750
  value: e,
27633
27751
  onChange: t,
27634
27752
  visible: n
@@ -27642,7 +27760,7 @@ function Rj({ value: e, onChange: t, inboxes: n = [] }) {
27642
27760
  children: /* @__PURE__ */ L(Ww, {
27643
27761
  "aria-label": r("filters.assignment"),
27644
27762
  className: "h-11! w-full",
27645
- children: Nj.map((e) => /* @__PURE__ */ L(Gw, {
27763
+ children: Pj.map((e) => /* @__PURE__ */ L(Gw, {
27646
27764
  value: e.key,
27647
27765
  className: "min-w-0",
27648
27766
  children: /* @__PURE__ */ L("span", {
@@ -27707,7 +27825,7 @@ function Rj({ value: e, onChange: t, inboxes: n = [] }) {
27707
27825
  }), /* @__PURE__ */ L(yx, {
27708
27826
  align: "end",
27709
27827
  className: "w-64 max-w-[calc(100vw-2rem)] p-0",
27710
- children: /* @__PURE__ */ L(Lj, { onPick: (n) => {
27828
+ children: /* @__PURE__ */ L(Rj, { onPick: (n) => {
27711
27829
  l(!1), t({
27712
27830
  ...e,
27713
27831
  tag: n
@@ -27732,27 +27850,27 @@ function Rj({ value: e, onChange: t, inboxes: n = [] }) {
27732
27850
  });
27733
27851
  }
27734
27852
  // src/inbox/GettingStartedCard.tsx
27735
- var zj = "ezychat.getting-started-hidden";
27736
- function Bj() {
27853
+ var Bj = "ezychat.getting-started-hidden";
27854
+ function Vj() {
27737
27855
  try {
27738
- return localStorage.getItem(zj) === "1";
27856
+ return localStorage.getItem(Bj) === "1";
27739
27857
  } catch {
27740
27858
  return !1;
27741
27859
  }
27742
27860
  }
27743
- function Vj({ className: e }) {
27744
- let t = $o(), [n, r] = g(Bj);
27745
- return n || t.data?.role !== "admin" ? null : /* @__PURE__ */ L(Hj, {
27861
+ function Hj({ className: e }) {
27862
+ let t = $o(), [n, r] = g(Vj);
27863
+ return n || t.data?.role !== "admin" ? null : /* @__PURE__ */ L(Uj, {
27746
27864
  className: e,
27747
27865
  onHide: () => {
27748
27866
  r(!0);
27749
27867
  try {
27750
- localStorage.setItem(zj, "1");
27868
+ localStorage.setItem(Bj, "1");
27751
27869
  } catch {}
27752
27870
  }
27753
27871
  });
27754
27872
  }
27755
- function Hj({ className: e, onHide: t }) {
27873
+ function Uj({ className: e, onHide: t }) {
27756
27874
  let { t: n } = P("inbox"), r = uy(), i = js(), a = Ws(), o = Xs(), s = d();
27757
27875
  if (!r.data || !i.data || !a.data || !o.data) return null;
27758
27876
  let c = i.data.filter((e) => e.kind !== "ai" && !e.disabled), l = a.data.state === "running" || o.data.hasTunnelToken || !!o.data.namedTunnelHostname, u = [
@@ -27839,17 +27957,17 @@ function Hj({ className: e, onHide: t }) {
27839
27957
  });
27840
27958
  }
27841
27959
  // src/inbox/useVisibleInboxes.ts
27842
- var Uj = [];
27843
- function Wj() {
27960
+ var Wj = [];
27961
+ function Gj() {
27844
27962
  let { data: e } = zs(), t = e?.inboxes;
27845
- return m(() => t ? t.filter((e) => !e.removed) : Uj, [t]);
27963
+ return m(() => t ? t.filter((e) => !e.removed) : Wj, [t]);
27846
27964
  }
27847
- function Gj() {
27848
- let { data: e } = zs(), t = e?.inboxes, n = m(() => (t ?? Uj).filter((e) => !e.removed).length > 1 ? new Map((t ?? Uj).map((e) => [e.id, e])) : null, [t]);
27965
+ function Kj() {
27966
+ let { data: e } = zs(), t = e?.inboxes, n = m(() => (t ?? Wj).filter((e) => !e.removed).length > 1 ? new Map((t ?? Wj).map((e) => [e.id, e])) : null, [t]);
27849
27967
  return s((e) => n?.get(e), [n]);
27850
27968
  }
27851
27969
  // src/inbox/ChatList.tsx
27852
- var Kj = o(ew), qj = {
27970
+ var qj = o(ew), Jj = {
27853
27971
  me: {
27854
27972
  titleKey: "chatList.empty.me.title",
27855
27973
  descriptionKey: "chatList.empty.me.description"
@@ -27863,7 +27981,7 @@ var Kj = o(ew), qj = {
27863
27981
  descriptionKey: "chatList.empty.any.description"
27864
27982
  }
27865
27983
  };
27866
- function Jj() {
27984
+ function Yj() {
27867
27985
  return /* @__PURE__ */ R("div", {
27868
27986
  className: "flex min-h-16 items-center gap-3 px-3 py-2.5",
27869
27987
  children: [/* @__PURE__ */ L(ix, { className: "size-12 shrink-0 rounded-full" }), /* @__PURE__ */ R("div", {
@@ -27875,8 +27993,8 @@ function Jj() {
27875
27993
  })]
27876
27994
  });
27877
27995
  }
27878
- function Yj({ filters: e, activeJid: t, directory: n, onResetFilters: r }) {
27879
- let { t: i } = P(["inbox", "common"]), a = ss(e), o = Gj(), s = rD(), c = nD(), l = h(null), { hasNextPage: d, isFetchingNextPage: f, fetchNextPage: p } = a, g = m(() => {
27996
+ function Xj({ filters: e, activeJid: t, directory: n, onResetFilters: r }) {
27997
+ let { t: i } = P(["inbox", "common"]), a = ss(e), o = Kj(), s = rD(), c = nD(), l = h(null), { hasNextPage: d, isFetchingNextPage: f, fetchNextPage: p } = a, g = m(() => {
27880
27998
  let e = /* @__PURE__ */ new Set(), t = [];
27881
27999
  for (let n of a.data?.pages ?? []) for (let r of n.chats) e.has(r.jid) || (e.add(r.jid), t.push(r));
27882
28000
  return t;
@@ -27896,7 +28014,7 @@ function Yj({ filters: e, activeJid: t, directory: n, onResetFilters: r }) {
27896
28014
  className: "min-h-0 flex-1 overflow-hidden",
27897
28015
  role: "status",
27898
28016
  "aria-label": i("chatList.loading"),
27899
- children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */ L(Jj, {}, t))
28017
+ children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */ L(Yj, {}, t))
27900
28018
  });
27901
28019
  if (a.isError) return /* @__PURE__ */ L("div", {
27902
28020
  className: "p-3",
@@ -27913,7 +28031,7 @@ function Yj({ filters: e, activeJid: t, directory: n, onResetFilters: r }) {
27913
28031
  })
27914
28032
  });
27915
28033
  if (g.length === 0) {
27916
- let t = qj[e.assigned], n = e.q ? {
28034
+ let t = Jj[e.assigned], n = e.q ? {
27917
28035
  title: i("common:status.noResults"),
27918
28036
  description: i("chatList.empty.search", { query: e.q })
27919
28037
  } : e.tag ? {
@@ -27936,7 +28054,7 @@ function Yj({ filters: e, activeJid: t, directory: n, onResetFilters: r }) {
27936
28054
  size: "touch",
27937
28055
  onClick: r,
27938
28056
  children: i("chatList.showAllOpen")
27939
- }) : /* @__PURE__ */ L(Vj, { className: "mt-2 md:hidden" })
28057
+ }) : /* @__PURE__ */ L(Hj, { className: "mt-2 md:hidden" })
27940
28058
  });
27941
28059
  }
27942
28060
  return /* @__PURE__ */ R("div", {
@@ -27944,7 +28062,7 @@ function Yj({ filters: e, activeJid: t, directory: n, onResetFilters: r }) {
27944
28062
  children: [
27945
28063
  /* @__PURE__ */ L("ul", {
27946
28064
  className: "divide-y divide-border/60",
27947
- children: g.map((e) => /* @__PURE__ */ L("li", { children: /* @__PURE__ */ L(Kj, {
28065
+ children: g.map((e) => /* @__PURE__ */ L("li", { children: /* @__PURE__ */ L(qj, {
27948
28066
  chat: e,
27949
28067
  active: e.jid === t,
27950
28068
  assigneeName: n.nameOf(e.assignedTo, { youLabel: !0 }),
@@ -27978,15 +28096,15 @@ function Yj({ filters: e, activeJid: t, directory: n, onResetFilters: r }) {
27978
28096
  });
27979
28097
  }
27980
28098
  // src/inbox/QuickReplyPicker.tsx
27981
- function Xj(e, t) {
28099
+ function Zj(e, t) {
27982
28100
  let n = t.trim().toLowerCase();
27983
28101
  return e.filter((e) => e.shortcut.toLowerCase().startsWith(n)).sort((e, t) => e.shortcut.localeCompare(t.shortcut));
27984
28102
  }
27985
- function Zj({ replies: e, query: t, activeIndex: n, onPick: r, onHover: i }) {
27986
- let { t: a } = P("inbox"), o = Xj(e, t), s = h(null), c = o[Math.min(n, o.length - 1)];
28103
+ function Qj({ replies: e, query: t, activeIndex: n, onPick: r, onHover: i }) {
28104
+ let { t: a } = P("inbox"), o = Zj(e, t), s = h(null), c = o[Math.min(n, o.length - 1)];
27987
28105
  return u(() => {
27988
28106
  (s.current?.querySelector(`[data-index="${n}"]`))?.scrollIntoView?.({ block: "nearest" });
27989
- }, [n]), /* @__PURE__ */ R(wj, {
28107
+ }, [n]), /* @__PURE__ */ R(Tj, {
27990
28108
  shouldFilter: !1,
27991
28109
  value: c ? String(c.id) : "",
27992
28110
  onValueChange: (e) => {
@@ -28003,11 +28121,11 @@ function Zj({ replies: e, query: t, activeIndex: n, onPick: r, onHover: i }) {
28003
28121
  }), o.length === 0 ? /* @__PURE__ */ L("p", {
28004
28122
  className: "px-3 py-3 text-sm text-muted-foreground",
28005
28123
  children: a("quickReplies.noMatch", { query: t })
28006
- }) : /* @__PURE__ */ L(Dj, {
28124
+ }) : /* @__PURE__ */ L(Oj, {
28007
28125
  ref: s,
28008
28126
  label: a("quickReplies.title"),
28009
28127
  className: "max-h-60 overscroll-contain p-1",
28010
- children: o.map((e, t) => /* @__PURE__ */ R(jj, {
28128
+ children: o.map((e, t) => /* @__PURE__ */ R(Mj, {
28011
28129
  value: String(e.id),
28012
28130
  "data-index": t,
28013
28131
  onSelect: () => r(e),
@@ -28024,27 +28142,27 @@ function Zj({ replies: e, query: t, activeIndex: n, onPick: r, onHover: i }) {
28024
28142
  })]
28025
28143
  });
28026
28144
  }
28027
- function Qj(e, t) {
28145
+ function $j(e, t) {
28028
28146
  let n = e.slice(0, t), r = /(^|\s)@([^\s@]{0,40})$/u.exec(n);
28029
28147
  return r ? {
28030
28148
  start: n.length - r[2].length - 1,
28031
28149
  query: r[2]
28032
28150
  } : null;
28033
28151
  }
28034
- function $j(e) {
28152
+ function eM(e) {
28035
28153
  return e.name?.trim() || e.username?.trim() || (e.phone ? `+${e.phone}` : e.jid.split("@")[0]);
28036
28154
  }
28037
- function eM(e, t) {
28155
+ function tM(e, t) {
28038
28156
  let n = t.trim().toLowerCase().replace(/^\+/, ""), r = (e) => e.name || e.username ? 0 : 1;
28039
28157
  return e.filter((e) => !e.isMe).filter((e) => !n || [
28040
28158
  ...(e.name ?? "").toLowerCase().split(/\s+/),
28041
28159
  (e.name ?? "").toLowerCase(),
28042
28160
  (e.username ?? "").toLowerCase(),
28043
28161
  e.phone ?? ""
28044
- ].some((e) => e?.startsWith(n))).sort((e, t) => r(e) - r(t) || $j(e).localeCompare($j(t), void 0, {}));
28162
+ ].some((e) => e?.startsWith(n))).sort((e, t) => r(e) - r(t) || eM(e).localeCompare(eM(t), void 0, {}));
28045
28163
  }
28046
- function tM(e, t, n, r) {
28047
- let i = $j(r), a = `@${i} `, o = e.slice(n).replace(/^\S*/, "").replace(/^ /, "");
28164
+ function nM(e, t, n, r) {
28165
+ let i = eM(r), a = `@${i} `, o = e.slice(n).replace(/^\S*/, "").replace(/^ /, "");
28048
28166
  return {
28049
28167
  text: e.slice(0, t) + a + o,
28050
28168
  caret: t + a.length,
@@ -28054,11 +28172,11 @@ function tM(e, t, n, r) {
28054
28172
  }
28055
28173
  };
28056
28174
  }
28057
- var nM = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
28058
- function rM(e, t) {
28175
+ var rM = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
28176
+ function iM(e, t) {
28059
28177
  let n = e, r = [];
28060
28178
  for (let e of [...t].sort((e, t) => t.label.length - e.label.length)) {
28061
- let t = new RegExp(String.raw`(^|[^\p{L}\p{N}_])@${nM(e.label)}(?![\p{L}\p{N}_])`, "gu"), i = e.jid.split("@")[0].split(":")[0], a = !1;
28179
+ let t = new RegExp(String.raw`(^|[^\p{L}\p{N}_])@${rM(e.label)}(?![\p{L}\p{N}_])`, "gu"), i = e.jid.split("@")[0].split(":")[0], a = !1;
28062
28180
  n = n.replace(t, (e, t) => (a = !0, `${t}@${i}`)), a && !r.includes(e.jid) && r.length < 50 && r.push(e.jid);
28063
28181
  }
28064
28182
  return {
@@ -28067,11 +28185,11 @@ function rM(e, t) {
28067
28185
  };
28068
28186
  }
28069
28187
  // src/inbox/MentionPicker.tsx
28070
- function iM({ members: e, error: t, query: n, activeIndex: r, onPick: i, onHover: a }) {
28188
+ function aM({ members: e, error: t, query: n, activeIndex: r, onPick: i, onHover: a }) {
28071
28189
  let { t: o } = P("inbox"), s = h(null), c = e ?? [], l = c[Math.min(r, c.length - 1)], d = null;
28072
28190
  return t ? d = o("mentions.error") : e == null ? d = o("mentions.loading") : c.length === 0 && (d = o("mentions.noMatch", { query: n })), u(() => {
28073
28191
  (s.current?.querySelector(`[data-index="${r}"]`))?.scrollIntoView?.({ block: "nearest" });
28074
- }, [r]), /* @__PURE__ */ R(wj, {
28192
+ }, [r]), /* @__PURE__ */ R(Tj, {
28075
28193
  shouldFilter: !1,
28076
28194
  value: l?.jid ?? "",
28077
28195
  onValueChange: (e) => {
@@ -28089,13 +28207,13 @@ function iM({ members: e, error: t, query: n, activeIndex: r, onPick: i, onHover
28089
28207
  }), d ? /* @__PURE__ */ L("p", {
28090
28208
  className: U("px-3 py-3 text-sm", t ? "text-destructive" : "text-muted-foreground"),
28091
28209
  children: d
28092
- }) : /* @__PURE__ */ L(Dj, {
28210
+ }) : /* @__PURE__ */ L(Oj, {
28093
28211
  ref: s,
28094
28212
  label: o("mentions.title"),
28095
28213
  className: "max-h-60 overscroll-contain p-1",
28096
28214
  children: c.map((e, t) => {
28097
- let n = $j(e), r = !!(e.name || e.username), a = r ? n.split(/\s+/).slice(0, 2).map((e) => e[0]?.toUpperCase() ?? "").join("") : "@";
28098
- return /* @__PURE__ */ R(jj, {
28215
+ let n = eM(e), r = !!(e.name || e.username), a = r ? n.split(/\s+/).slice(0, 2).map((e) => e[0]?.toUpperCase() ?? "").join("") : "@";
28216
+ return /* @__PURE__ */ R(Mj, {
28099
28217
  value: e.jid,
28100
28218
  "data-index": t,
28101
28219
  onSelect: () => i(e),
@@ -28128,7 +28246,7 @@ function iM({ members: e, error: t, query: n, activeIndex: r, onPick: i, onHover
28128
28246
  });
28129
28247
  }
28130
28248
  // src/inbox/ReplySuggestions.tsx
28131
- function aM({ strip: e, isAdmin: t, onPick: n, onRetry: r, onClose: i }) {
28249
+ function oM({ strip: e, isAdmin: t, onPick: n, onRetry: r, onClose: i }) {
28132
28250
  let { t: a } = P("inbox");
28133
28251
  return /* @__PURE__ */ R("div", {
28134
28252
  className: "mb-1.5 flex min-w-0 items-start gap-1.5",
@@ -28177,8 +28295,8 @@ function aM({ strip: e, isAdmin: t, onPick: n, onRetry: r, onClose: i }) {
28177
28295
  children: e.label
28178
28296
  })]
28179
28297
  }, t)),
28180
- e.phase === "ready" && e.result.handoffRule && /* @__PURE__ */ L(oM, { children: a("composer.suggest.handoff", { rule: e.result.handoffRule }) }),
28181
- e.phase === "ready" && !e.result.handoffRule && (e.result.noAnswer || e.result.suggestions.length === 0) && /* @__PURE__ */ R(oM, { children: [a("composer.suggest.noAnswer"), t && /* @__PURE__ */ R(I, { children: [" ", /* @__PURE__ */ L(D, {
28298
+ e.phase === "ready" && e.result.handoffRule && /* @__PURE__ */ L(sM, { children: a("composer.suggest.handoff", { rule: e.result.handoffRule }) }),
28299
+ e.phase === "ready" && !e.result.handoffRule && (e.result.noAnswer || e.result.suggestions.length === 0) && /* @__PURE__ */ R(sM, { children: [a("composer.suggest.noAnswer"), t && /* @__PURE__ */ R(I, { children: [" ", /* @__PURE__ */ L(D, {
28182
28300
  to: "/admin/members/ai",
28183
28301
  className: "font-medium text-primary underline",
28184
28302
  children: a("composer.suggest.addContext")
@@ -28195,7 +28313,7 @@ function aM({ strip: e, isAdmin: t, onPick: n, onRetry: r, onClose: i }) {
28195
28313
  })]
28196
28314
  });
28197
28315
  }
28198
- function oM({ children: e }) {
28316
+ function sM({ children: e }) {
28199
28317
  return /* @__PURE__ */ R("p", {
28200
28318
  role: "status",
28201
28319
  className: "flex min-h-9 min-w-0 items-center gap-2 rounded-full bg-muted px-3 py-1.5 text-sm text-muted-foreground pointer-coarse:min-h-11",
@@ -28210,19 +28328,19 @@ function oM({ children: e }) {
28210
28328
  });
28211
28329
  }
28212
28330
  // src/inbox/EmojiPicker.tsx
28213
- var sM = [
28331
+ var cM = [
28214
28332
  "All",
28215
28333
  "Faces",
28216
28334
  "Gestures",
28217
28335
  "Hearts",
28218
28336
  "Work"
28219
- ], cM = {
28337
+ ], lM = {
28220
28338
  All: "emoji.category.all",
28221
28339
  Faces: "emoji.category.faces",
28222
28340
  Gestures: "emoji.category.gestures",
28223
28341
  Hearts: "emoji.category.hearts",
28224
28342
  Work: "emoji.category.work"
28225
- }, lM = [
28343
+ }, uM = [
28226
28344
  [
28227
28345
  "😀",
28228
28346
  "grinningFace",
@@ -28533,9 +28651,9 @@ var sM = [
28533
28651
  "Work",
28534
28652
  "hot"
28535
28653
  ]
28536
- ], uM = (e) => Qa.emoji.names[e];
28537
- function dM({ disabled: e, onOpen: t, onPick: n }) {
28538
- let { t: r } = P("inbox"), [i, a] = g(!1), [o, s] = g(""), [c, l] = g("All"), u = h(!1), f = d(), p = o.trim().toLowerCase(), m = lM.filter(([e, t, n, i = ""]) => p ? `${e} ${uM(t)} ${r(`emoji.names.${t}`)} ${i}`.toLowerCase().includes(p) : c === "All" || c === n);
28654
+ ], dM = (e) => Qa.emoji.names[e];
28655
+ function fM({ disabled: e, onOpen: t, onPick: n }) {
28656
+ let { t: r } = P("inbox"), [i, a] = g(!1), [o, s] = g(""), [c, l] = g("All"), u = h(!1), f = d(), p = o.trim().toLowerCase(), m = uM.filter(([e, t, n, i = ""]) => p ? `${e} ${dM(t)} ${r(`emoji.names.${t}`)} ${i}`.toLowerCase().includes(p) : c === "All" || c === n);
28539
28657
  return /* @__PURE__ */ R(_x, {
28540
28658
  open: i,
28541
28659
  onOpenChange: (e) => {
@@ -28581,7 +28699,7 @@ function dM({ disabled: e, onOpen: t, onPick: n }) {
28581
28699
  className: "flex shrink-0 flex-wrap gap-1",
28582
28700
  role: "group",
28583
28701
  "aria-label": r("emoji.categories"),
28584
- children: sM.map((e) => /* @__PURE__ */ L(W, {
28702
+ children: cM.map((e) => /* @__PURE__ */ L(W, {
28585
28703
  variant: c === e && !p ? "secondary" : "ghost",
28586
28704
  size: "sm",
28587
28705
  className: "min-h-11 px-2",
@@ -28589,7 +28707,7 @@ function dM({ disabled: e, onOpen: t, onPick: n }) {
28589
28707
  onClick: () => {
28590
28708
  l(e), s("");
28591
28709
  },
28592
- children: r(cM[e])
28710
+ children: r(lM[e])
28593
28711
  }, e))
28594
28712
  }),
28595
28713
  /* @__PURE__ */ L("div", {
@@ -28632,21 +28750,21 @@ function dM({ disabled: e, onOpen: t, onPick: n }) {
28632
28750
  });
28633
28751
  }
28634
28752
  // src/lib/voice-recorder.ts
28635
- var fM = 1e4;
28636
- function pM() {
28753
+ var pM = 1e4;
28754
+ function mM() {
28637
28755
  return typeof window > "u" ? "unsupported" : window.isSecureContext ? !navigator.mediaDevices?.getUserMedia || typeof AudioContext > "u" ? "unsupported" : "ok" : "insecure";
28638
28756
  }
28639
- var mM = class extends Error {
28757
+ var hM = class extends Error {
28640
28758
  reason;
28641
28759
  constructor(e) {
28642
28760
  super(e), this.reason = e;
28643
28761
  }
28644
28762
  };
28645
- function hM(e) {
28763
+ function gM(e) {
28646
28764
  let t = e?.name;
28647
- return t === "NotAllowedError" || t === "SecurityError" ? new mM("blocked") : t === "NotFoundError" || t === "OverconstrainedError" ? new mM("no-microphone") : new mM("failed");
28765
+ return t === "NotAllowedError" || t === "SecurityError" ? new hM("blocked") : t === "NotFoundError" || t === "OverconstrainedError" ? new hM("no-microphone") : new hM("failed");
28648
28766
  }
28649
- async function gM() {
28767
+ async function _M() {
28650
28768
  let e = new AudioContext(), t;
28651
28769
  try {
28652
28770
  t = await navigator.mediaDevices.getUserMedia({ audio: {
@@ -28656,7 +28774,7 @@ async function gM() {
28656
28774
  autoGainControl: !0
28657
28775
  } });
28658
28776
  } catch (t) {
28659
- throw e.close().catch(() => {}), hM(t);
28777
+ throw e.close().catch(() => {}), gM(t);
28660
28778
  }
28661
28779
  let n = () => {
28662
28780
  for (let e of t.getTracks()) e.stop();
@@ -28694,7 +28812,7 @@ async function gM() {
28694
28812
  async stop() {
28695
28813
  if (p) throw Error("Recording already ended");
28696
28814
  p = !0, d().catch((e) => l(e instanceof Error ? e : /* @__PURE__ */ Error("Recording failed to stop")));
28697
- let e = setTimeout(() => l(/* @__PURE__ */ Error("Recording did not finish")), fM);
28815
+ let e = setTimeout(() => l(/* @__PURE__ */ Error("Recording did not finish")), pM);
28698
28816
  try {
28699
28817
  return await u;
28700
28818
  } finally {
@@ -28706,18 +28824,18 @@ async function gM() {
28706
28824
  }
28707
28825
  };
28708
28826
  } catch (e) {
28709
- throw n(), e instanceof mM ? e : new mM("failed");
28827
+ throw n(), e instanceof hM ? e : new hM("failed");
28710
28828
  }
28711
28829
  }
28712
28830
  // src/inbox/VoiceNote.tsx
28713
- var _M = 48, vM = 48, yM = 100, bM = (e) => `${Math.floor(e / 60)}:${String(Math.floor(e % 60)).padStart(2, "0")}`;
28714
- function xM(e, t) {
28831
+ var vM = 48, yM = 48, bM = 100, xM = (e) => `${Math.floor(e / 60)}:${String(Math.floor(e % 60)).padStart(2, "0")}`;
28832
+ function SM(e, t) {
28715
28833
  return e.length ? Array.from({ length: t }, (n, r) => {
28716
28834
  let i = Math.floor(r * e.length / t), a = Math.max(i + 1, Math.floor((r + 1) * e.length / t));
28717
28835
  return Math.max(...e.slice(i, a));
28718
28836
  }) : Array.from({ length: t }, () => 0);
28719
28837
  }
28720
- function SM(e) {
28838
+ function CM(e) {
28721
28839
  let [t, n] = g("idle"), [r, i] = g(0), [a, o] = g([]), [c, l] = g(null), [d, f] = g(!1), [p, m] = g(!1), _ = h(null), v = h([]), y = h(0), b = h(null), x = h(0), S = () => {
28722
28840
  b.current && clearInterval(b.current), b.current = null;
28723
28841
  }, C = s(async () => {
@@ -28736,7 +28854,7 @@ function SM(e) {
28736
28854
  blob: r,
28737
28855
  url: URL.createObjectURL(r),
28738
28856
  seconds: i,
28739
- bars: xM(v.current, vM)
28857
+ bars: SM(v.current, yM)
28740
28858
  };
28741
28859
  }, []), w = s((e) => {
28742
28860
  l(e), n("review");
@@ -28748,9 +28866,9 @@ function SM(e) {
28748
28866
  n("starting");
28749
28867
  let t;
28750
28868
  try {
28751
- t = await gM();
28869
+ t = await _M();
28752
28870
  } catch (t) {
28753
- e === x.current && n(t instanceof mM ? t.reason : "failed");
28871
+ e === x.current && n(t instanceof hM ? t.reason : "failed");
28754
28872
  return;
28755
28873
  }
28756
28874
  e === x.current ? (_.current = t, v.current = [], y.current = Date.now(), i(0), o([]), n("recording"), b.current = setInterval(() => {
@@ -28759,7 +28877,7 @@ function SM(e) {
28759
28877
  v.current.push(e.level()), o(v.current.slice(-48));
28760
28878
  let t = (Date.now() - y.current) / 1e3;
28761
28879
  i(Math.floor(t)), t >= 300 && T();
28762
- }, yM)) : t.cancel();
28880
+ }, bM)) : t.cancel();
28763
28881
  }, [T]), D = s(() => {
28764
28882
  x.current++, S(), _.current?.cancel(), _.current = null, l(null), m(!1), n("idle");
28765
28883
  }, []), O = s(async (t) => {
@@ -28790,7 +28908,7 @@ function SM(e) {
28790
28908
  }, [c]), {
28791
28909
  phase: t,
28792
28910
  seconds: r,
28793
- liveBars: [...Array.from({ length: _M - a.length }, () => 0), ...a],
28911
+ liveBars: [...Array.from({ length: vM - a.length }, () => 0), ...a],
28794
28912
  review: c,
28795
28913
  sending: d,
28796
28914
  sendFailed: p,
@@ -28802,7 +28920,7 @@ function SM(e) {
28802
28920
  dismiss: () => n("idle")
28803
28921
  };
28804
28922
  }
28805
- function CM({ values: e, className: t, played: n }) {
28923
+ function wM({ values: e, className: t, played: n }) {
28806
28924
  return /* @__PURE__ */ L("span", {
28807
28925
  className: "flex h-8 min-w-0 flex-1 items-center justify-between gap-px overflow-hidden",
28808
28926
  "aria-hidden": "true",
@@ -28812,7 +28930,7 @@ function CM({ values: e, className: t, played: n }) {
28812
28930
  }, i))
28813
28931
  });
28814
28932
  }
28815
- function wM({ voice: e }) {
28933
+ function TM({ voice: e }) {
28816
28934
  let { t } = P("inbox"), n = t("composer.voice.failed");
28817
28935
  return e.phase === "lost" ? n = t("composer.voice.lost") : e.phase === "blocked" ? n = /* @__PURE__ */ R(I, { children: [
28818
28936
  /* @__PURE__ */ L("strong", { children: t("composer.voice.blockedTitle") }),
@@ -28846,7 +28964,7 @@ function wM({ voice: e }) {
28846
28964
  ]
28847
28965
  });
28848
28966
  }
28849
- function TM({ onClick: e }) {
28967
+ function EM({ onClick: e }) {
28850
28968
  let { t } = P("inbox");
28851
28969
  return /* @__PURE__ */ L(W, {
28852
28970
  variant: "ghost",
@@ -28861,7 +28979,7 @@ function TM({ onClick: e }) {
28861
28979
  })
28862
28980
  });
28863
28981
  }
28864
- function EM({ onClick: e, disabled: t }) {
28982
+ function DM({ onClick: e, disabled: t }) {
28865
28983
  let { t: n } = P("inbox");
28866
28984
  return /* @__PURE__ */ L(W, {
28867
28985
  size: "icon-touch",
@@ -28876,13 +28994,13 @@ function EM({ onClick: e, disabled: t }) {
28876
28994
  })
28877
28995
  });
28878
28996
  }
28879
- function DM({ voice: e, review: t }) {
28880
- let { t: n } = P("inbox"), r = h(null), [i, a] = g(!1), [o, s] = g(0), [c] = g(() => document.createElement("audio").canPlayType("audio/ogg; codecs=opus") !== ""), l = i ? `${bM(o)} / ${bM(t.seconds)}` : bM(t.seconds);
28997
+ function OM({ voice: e, review: t }) {
28998
+ let { t: n } = P("inbox"), r = h(null), [i, a] = g(!1), [o, s] = g(0), [c] = g(() => document.createElement("audio").canPlayType("audio/ogg; codecs=opus") !== ""), l = i ? `${xM(o)} / ${xM(t.seconds)}` : xM(t.seconds);
28881
28999
  return /* @__PURE__ */ R("div", {
28882
29000
  className: "flex items-center gap-1.5",
28883
29001
  "data-testid": "voice-review",
28884
29002
  children: [
28885
- /* @__PURE__ */ L(TM, { onClick: e.discard }),
29003
+ /* @__PURE__ */ L(EM, { onClick: e.discard }),
28886
29004
  /* @__PURE__ */ R("div", {
28887
29005
  className: "flex h-11 min-w-0 flex-1 items-center gap-2.5 rounded-full bg-muted py-1 pr-3.5 pl-1",
28888
29006
  children: [
@@ -28898,7 +29016,7 @@ function DM({ voice: e, review: t }) {
28898
29016
  className: "size-9 shrink-0 rounded-full",
28899
29017
  children: L(i ? ai : di, { "aria-hidden": "true" })
28900
29018
  }),
28901
- /* @__PURE__ */ L(CM, {
29019
+ /* @__PURE__ */ L(wM, {
28902
29020
  values: t.bars,
28903
29021
  className: "bg-muted-foreground/50",
28904
29022
  played: i ? o / t.seconds : void 0
@@ -28925,37 +29043,37 @@ function DM({ voice: e, review: t }) {
28925
29043
  })
28926
29044
  ]
28927
29045
  }),
28928
- /* @__PURE__ */ L(EM, {
29046
+ /* @__PURE__ */ L(DM, {
28929
29047
  disabled: e.sending,
28930
29048
  onClick: () => void e.sendReviewed()
28931
29049
  })
28932
29050
  ]
28933
29051
  });
28934
29052
  }
28935
- function OM({ voice: e }) {
29053
+ function kM({ voice: e }) {
28936
29054
  let { t } = P("inbox");
28937
29055
  return /* @__PURE__ */ R("div", {
28938
29056
  className: "flex items-center gap-1.5",
28939
29057
  "data-testid": "voice-recording",
28940
29058
  children: [
28941
- /* @__PURE__ */ L(TM, { onClick: e.discard }),
29059
+ /* @__PURE__ */ L(EM, { onClick: e.discard }),
28942
29060
  /* @__PURE__ */ L("span", {
28943
29061
  className: "size-2.5 shrink-0 animate-pulse rounded-full bg-destructive motion-reduce:animate-none",
28944
29062
  "aria-hidden": "true"
28945
29063
  }),
28946
29064
  /* @__PURE__ */ L("span", {
28947
29065
  role: "timer",
28948
- "aria-label": t("composer.voice.recordingTime", { time: bM(e.seconds) }),
29066
+ "aria-label": t("composer.voice.recordingTime", { time: xM(e.seconds) }),
28949
29067
  className: "w-11 shrink-0 text-sm font-semibold tabular-nums",
28950
- children: bM(e.seconds)
29068
+ children: xM(e.seconds)
28951
29069
  }),
28952
- /* @__PURE__ */ L(CM, {
29070
+ /* @__PURE__ */ L(wM, {
28953
29071
  values: e.liveBars,
28954
29072
  className: "bg-destructive/70"
28955
29073
  }),
28956
29074
  /* @__PURE__ */ L("span", {
28957
29075
  className: "hidden shrink-0 text-xs text-muted-foreground sm:inline",
28958
- children: t("composer.voice.maxLength", { time: bM(300) })
29076
+ children: t("composer.voice.maxLength", { time: xM(300) })
28959
29077
  }),
28960
29078
  /* @__PURE__ */ R(W, {
28961
29079
  variant: "outline",
@@ -28968,26 +29086,26 @@ function OM({ voice: e }) {
28968
29086
  "aria-hidden": "true"
28969
29087
  }), t("composer.voice.review")]
28970
29088
  }),
28971
- /* @__PURE__ */ L(EM, {
29089
+ /* @__PURE__ */ L(DM, {
28972
29090
  disabled: e.sending,
28973
29091
  onClick: () => void e.sendNow()
28974
29092
  })
28975
29093
  ]
28976
29094
  });
28977
29095
  }
28978
- function kM({ voice: e }) {
29096
+ function AM({ voice: e }) {
28979
29097
  return [
28980
29098
  "blocked",
28981
29099
  "no-microphone",
28982
29100
  "failed",
28983
29101
  "lost"
28984
- ].includes(e.phase) ? /* @__PURE__ */ L(wM, { voice: e }) : e.phase === "review" && e.review ? /* @__PURE__ */ L(DM, {
29102
+ ].includes(e.phase) ? /* @__PURE__ */ L(TM, { voice: e }) : e.phase === "review" && e.review ? /* @__PURE__ */ L(OM, {
28985
29103
  voice: e,
28986
29104
  review: e.review
28987
- }) : /* @__PURE__ */ L(OM, { voice: e });
29105
+ }) : /* @__PURE__ */ L(kM, { voice: e });
28988
29106
  }
28989
29107
  // src/inbox/FixEnglish.tsx
28990
- function AM(e, t, n) {
29108
+ function jM(e, t, n) {
28991
29109
  if (t === n) return e;
28992
29110
  let r = 0;
28993
29111
  for (; r < t.length && r < n.length && t[r] === n[r];) r++;
@@ -29000,7 +29118,7 @@ function AM(e, t, n) {
29000
29118
  end: e.end + o
29001
29119
  }] : []);
29002
29120
  }
29003
- function jM(e, t, n) {
29121
+ function MM(e, t, n) {
29004
29122
  let r = e;
29005
29123
  for (let e of [...t].sort((e, t) => t.start - e.start)) {
29006
29124
  let t = n ?? e.replacement;
@@ -29008,7 +29126,7 @@ function jM(e, t, n) {
29008
29126
  }
29009
29127
  return r;
29010
29128
  }
29011
- function MM(e) {
29129
+ function NM(e) {
29012
29130
  let [t, n] = g(null);
29013
29131
  return u(() => {
29014
29132
  if (!e || t) return;
@@ -29018,9 +29136,9 @@ function MM(e) {
29018
29136
  };
29019
29137
  }, [e, t]), t;
29020
29138
  }
29021
- var NM = /* @__PURE__ */ new Map();
29022
- function PM(e, { jid: t, status: n, chatName: r, teamWords: i, disabled: a }) {
29023
- let o = n?.spelling === "on" && !a, s = n?.grammar === "on" && !a && !!t, c = MM(o && e.trim() !== ""), l = m(() => {
29139
+ var PM = /* @__PURE__ */ new Map();
29140
+ function FM(e, { jid: t, status: n, chatName: r, teamWords: i, disabled: a }) {
29141
+ let o = n?.spelling === "on" && !a, s = n?.grammar === "on" && !a && !!t, c = NM(o && e.trim() !== ""), l = m(() => {
29024
29142
  let e = new Set(i);
29025
29143
  for (let t of r.toLowerCase().match(/\p{L}+/gu) ?? []) e.add(t);
29026
29144
  return e;
@@ -29032,18 +29150,18 @@ function PM(e, { jid: t, status: n, chatName: r, teamWords: i, disabled: a }) {
29032
29150
  ]), [, f] = g(0);
29033
29151
  u(() => {
29034
29152
  if (!c) return;
29035
- let e = d.find((e) => !e.shortForm && !NM.has(e.word.toLowerCase()));
29153
+ let e = d.find((e) => !e.shortForm && !PM.has(e.word.toLowerCase()));
29036
29154
  if (!e) return;
29037
29155
  let t = setTimeout(() => {
29038
29156
  let t = e.word.toLowerCase();
29039
- NM.set(t, ok(t, c.suggest(t), c)), f((e) => e + 1);
29157
+ PM.set(t, ok(t, c.suggest(t), c)), f((e) => e + 1);
29040
29158
  }, 0);
29041
29159
  return () => clearTimeout(t);
29042
29160
  });
29043
29161
  let [_, v] = g([]), [y, b] = g("idle"), x = h(e);
29044
29162
  p(() => {
29045
29163
  let t = x.current;
29046
- x.current = e, v((n) => AM(n, t, e));
29164
+ x.current = e, v((n) => jM(n, t, e));
29047
29165
  }, [e]), u(() => {
29048
29166
  if (!s || !e.trim()) {
29049
29167
  v([]), b("idle");
@@ -29078,7 +29196,7 @@ function PM(e, { jid: t, status: n, chatName: r, teamWords: i, disabled: a }) {
29078
29196
  }, [e]);
29079
29197
  let w = (e) => `${e.kind}:${e.original}`, T = m(() => {
29080
29198
  let e = d.map((e) => {
29081
- let t = e.shortForm ? [] : NM.get(e.word.toLowerCase()), n = fk(e, t ?? []);
29199
+ let t = e.shortForm ? [] : PM.get(e.word.toLowerCase()), n = fk(e, t ?? []);
29082
29200
  return {
29083
29201
  id: `s${e.start}:${e.word}`,
29084
29202
  kind: "spelling",
@@ -29095,7 +29213,7 @@ function PM(e, { jid: t, status: n, chatName: r, teamWords: i, disabled: a }) {
29095
29213
  d,
29096
29214
  _,
29097
29215
  S,
29098
- NM.size
29216
+ PM.size
29099
29217
  ]);
29100
29218
  return {
29101
29219
  issues: T,
@@ -29106,7 +29224,7 @@ function PM(e, { jid: t, status: n, chatName: r, teamWords: i, disabled: a }) {
29106
29224
  }
29107
29225
  };
29108
29226
  }
29109
- var FM = a(function({ text: e, issues: t, activeId: n }, r) {
29227
+ var IM = a(function({ text: e, issues: t, activeId: n }, r) {
29110
29228
  if (!t.length) return null;
29111
29229
  let i = [], a = 0;
29112
29230
  for (let r of t) {
@@ -29127,7 +29245,7 @@ var FM = a(function({ text: e, issues: t, activeId: n }, r) {
29127
29245
  children: i
29128
29246
  });
29129
29247
  });
29130
- function IM({ issue: e, position: t, touch: n, onPick: r, onIgnore: i, onAddWord: a, onClose: o, onHover: s }) {
29248
+ function LM({ issue: e, position: t, touch: n, onPick: r, onIgnore: i, onAddWord: a, onClose: o, onHover: s }) {
29131
29249
  let { t: c } = P("inbox"), l = e.kind === "spelling" && !e.pending && e.suggestions.length === 0, u = c("composer.fixEnglish.grammar");
29132
29250
  l ? u = c("composer.fixEnglish.unknown") : e.kind === "spelling" && (u = c("composer.fixEnglish.spelling"));
29133
29251
  let d = U(n && "min-h-11"), f = h(null), [m, _] = g(t.left);
@@ -29203,7 +29321,7 @@ function IM({ issue: e, position: t, touch: n, onPick: r, onIgnore: i, onAddWord
29203
29321
  })]
29204
29322
  });
29205
29323
  }
29206
- function LM({ count: e, marks: t, grammarStatus: n, grammar: r, touch: i, undo: a, onFixAll: o, onUndo: s }) {
29324
+ function RM({ count: e, marks: t, grammarStatus: n, grammar: r, touch: i, undo: a, onFixAll: o, onUndo: s }) {
29207
29325
  let { t: c } = P("inbox");
29208
29326
  if (a) return /* @__PURE__ */ R("span", {
29209
29327
  role: "status",
@@ -29270,30 +29388,30 @@ function LM({ count: e, marks: t, grammarStatus: n, grammar: r, touch: i, undo:
29270
29388
  }), u] });
29271
29389
  }
29272
29390
  // src/inbox/Composer.tsx
29273
- var RM = 2e3, zM = 500, BM = 160, VM = 5e3, HM = /* @__PURE__ */ new Set();
29274
- function UM(e, t) {
29391
+ var zM = 2e3, BM = 500, VM = 160, HM = 5e3, UM = /* @__PURE__ */ new Set();
29392
+ function WM(e, t) {
29275
29393
  if (!e || !t.startsWith(e.for)) return "";
29276
29394
  let n = e.for + e.text;
29277
29395
  return n.length > t.length && n.startsWith(t) ? n.slice(t.length) : "";
29278
29396
  }
29279
- function WM() {
29397
+ function GM() {
29280
29398
  try {
29281
29399
  return typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches;
29282
29400
  } catch {
29283
29401
  return !1;
29284
29402
  }
29285
29403
  }
29286
- function GM(e) {
29404
+ function KM(e) {
29287
29405
  let t = /^\/(\S*)$/.exec(e);
29288
29406
  return t ? t[1] ?? "" : null;
29289
29407
  }
29290
- function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping: i, confirmSend: a, disabled: o = !1, placeholder: s, replyTo: c = null, onCancelReply: l, aiSuggest: m = null, askEzy: _ = null, fixEnglish: v = null, mentions: y = null, ref: b }) {
29408
+ function qM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping: i, confirmSend: a, disabled: o = !1, placeholder: s, replyTo: c = null, onCancelReply: l, aiSuggest: m = null, askEzy: _ = null, fixEnglish: v = null, mentions: y = null, ref: b }) {
29291
29409
  let { t: x } = P("inbox"), { openPanel: S } = Yy(), [C, w] = g(""), [T, E] = g(0), [D, O] = g(!1), [k, ee] = g([]), [A, te] = g(0), [ne, re] = g(null), [ie, j] = g(!1), [ae, oe] = g(!1), [se, ce] = g([]), M = h([]), le = (e) => {
29292
29410
  M.current = e, ce(e);
29293
29411
  }, ue = h(null), de = h(null), fe = h(null), pe = h(null), me = h(0), he = h({
29294
29412
  start: 0,
29295
29413
  end: 0
29296
- }), ge = h(null), _e = d(), ve = d(), [ye] = g(WM), [be] = g(pM), xe = SM(async (e, t) => !r || o || !await Ct() ? !1 : (await r(e, t), !0));
29414
+ }), ge = h(null), _e = d(), ve = d(), [ye] = g(GM), [be] = g(mM), xe = CM(async (e, t) => !r || o || !await Ct() ? !1 : (await r(e, t), !0));
29297
29415
  function Se(e) {
29298
29416
  if (o || e.length === 0) return;
29299
29417
  let { accepted: t, rejected: n } = Eb(e, M.current.length);
@@ -29305,11 +29423,11 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29305
29423
  t.length && le([...M.current, ...t]), ue.current?.focus();
29306
29424
  }
29307
29425
  f(b, () => ({ addFiles: Se }));
29308
- let Ce = m?.state ?? "off", we = m?.chatJid ?? null, [Te, Ee] = g(null), [De, Oe] = g(null), [ke, Ae] = g(null), je = h(null), Me = h(null), [Ne, Pe] = g(0), Fe = h(null), Ie = h(null), Le = UM(ke, C), Re = v?.status, ze = Re?.spelling === "on", Be = PM(C, {
29426
+ let Ce = m?.state ?? "off", we = m?.chatJid ?? null, [Te, Ee] = g(null), [De, Oe] = g(null), [ke, Ae] = g(null), je = h(null), Me = h(null), [Ne, Pe] = g(0), Fe = h(null), Ie = h(null), Le = WM(ke, C), Re = v?.status, ze = Re?.spelling === "on", Be = FM(C, {
29309
29427
  jid: v?.chatJid ?? null,
29310
29428
  status: Re,
29311
29429
  chatName: v?.chatName ?? "",
29312
- teamWords: v?.teamWords ?? HM,
29430
+ teamWords: v?.teamWords ?? UM,
29313
29431
  disabled: o
29314
29432
  }), Ve = h(null), [He, Ue] = g(null), We = h(!1), Ge = h(null), [Ke, qe] = g(null), Je = He ? Be.issues.find((e) => e.id === He.id) : void 0;
29315
29433
  function Ye(e, t) {
@@ -29330,7 +29448,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29330
29448
  }, 250);
29331
29449
  }
29332
29450
  function Qe(e, t) {
29333
- ge.current = e.start + t.length, Ue(null), w(jM(C, [e], t));
29451
+ ge.current = e.start + t.length, Ue(null), w(MM(C, [e], t));
29334
29452
  }
29335
29453
  function $e(e) {
29336
29454
  Ue(null), v?.onAddWord(e.original).catch((e) => z.error(V(e)));
@@ -29338,7 +29456,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29338
29456
  function et() {
29339
29457
  let e = Be.fixable.length;
29340
29458
  if (!e) return;
29341
- let t = jM(C, Be.fixable);
29459
+ let t = MM(C, Be.fixable);
29342
29460
  ge.current = t.length, Ue(null), qe({
29343
29461
  before: C,
29344
29462
  after: t,
@@ -29354,7 +29472,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29354
29472
  qe(null);
29355
29473
  return;
29356
29474
  }
29357
- let e = setTimeout(() => qe(null), VM);
29475
+ let e = setTimeout(() => qe(null), HM);
29358
29476
  return () => clearTimeout(e);
29359
29477
  }, [Ke, C]), u(() => {
29360
29478
  He && !Je && Ue(null);
@@ -29421,14 +29539,14 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29421
29539
  jid: we,
29422
29540
  cancel: e
29423
29541
  }, RO(we, t, e.signal).then(({ completion: n }) => {
29424
- !e.signal.aborted && n && Ae((e) => e && UM(e, ue.current?.value ?? t) ? e : {
29542
+ !e.signal.aborted && n && Ae((e) => e && WM(e, ue.current?.value ?? t) ? e : {
29425
29543
  for: t,
29426
29544
  text: n
29427
29545
  });
29428
29546
  }).catch(() => void 0).finally(() => {
29429
29547
  Me.current?.cancel === e && (Me.current = null, Pe((e) => e + 1));
29430
29548
  });
29431
- }, zM);
29549
+ }, BM);
29432
29550
  return () => clearTimeout(r);
29433
29551
  }, [
29434
29552
  C,
@@ -29440,7 +29558,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29440
29558
  ]), u(() => () => Me.current?.cancel.abort(), []), u(() => {
29441
29559
  Ae(null), Fe.current = null;
29442
29560
  }, [we]);
29443
- let ut = ie ? "" : GM(C), dt = ut == null ? [] : Xj(e, ut), ft = ut != null && !D && e.length > 0, pt = y && !ft ? Qj(C, A) : null, mt = !!pt && ne !== pt.start, ht = pt && mt && y?.members ? eM(y.members, pt.query) : [], gt = ft || mt, _t = y?.onOpen;
29561
+ let ut = ie ? "" : KM(C), dt = ut == null ? [] : Zj(e, ut), ft = ut != null && !D && e.length > 0, pt = y && !ft ? $j(C, A) : null, mt = !!pt && ne !== pt.start, ht = pt && mt && y?.members ? tM(y.members, pt.query) : [], gt = ft || mt, _t = y?.onOpen;
29444
29562
  u(() => {
29445
29563
  mt && _t?.();
29446
29564
  }, [mt, _t]), u(() => {
@@ -29456,7 +29574,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29456
29574
  if (!e) return;
29457
29575
  e.style.height = "auto";
29458
29576
  let t = getComputedStyle(e), n = parseFloat(t.borderTopWidth) + parseFloat(t.borderBottomWidth), r = Ie.current?.scrollHeight ?? 0, i = Math.max(e.scrollHeight, r) + (Number.isFinite(n) ? n : 0);
29459
- e.style.height = `${Math.min(i, BM)}px`, e.style.overflowY = i > BM ? "auto" : "hidden";
29577
+ e.style.height = `${Math.min(i, VM)}px`, e.style.overflowY = i > VM ? "auto" : "hidden";
29460
29578
  }
29461
29579
  if (t(), ge.current != null && (e.focus(), e.setSelectionRange(ge.current, ge.current), ge.current = null), typeof ResizeObserver > "u") return;
29462
29580
  let n = e.clientWidth, r = new ResizeObserver(() => {
@@ -29469,7 +29587,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29469
29587
  r === C ? (ue.current?.focus(), ue.current?.setSelectionRange(i, i)) : ge.current = i, w(r), j(!1), O(!1), kt(r);
29470
29588
  }
29471
29589
  function bt(e) {
29472
- let t = ie && GM(C) == null && C.trim() ? `${C}\n${e.body}` : e.body;
29590
+ let t = ie && KM(C) == null && C.trim() ? `${C}\n${e.body}` : e.body;
29473
29591
  w(t), j(!1), O(!0), requestAnimationFrame(() => {
29474
29592
  let e = ue.current;
29475
29593
  e && (e.focus(), e.setSelectionRange(t.length, t.length));
@@ -29477,7 +29595,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29477
29595
  }
29478
29596
  function xt(e) {
29479
29597
  if (!pt) return;
29480
- let t = tM(C, pt.start, A, e);
29598
+ let t = nM(C, pt.start, A, e);
29481
29599
  w(t.text), te(t.caret), ge.current = t.caret, ee((e) => e.some((e) => e.jid === t.tag.jid && e.label === t.tag.label) || e.length >= 50 ? e : [...e, t.tag]), kt(t.text);
29482
29600
  }
29483
29601
  async function Ct() {
@@ -29494,7 +29612,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29494
29612
  oe(!0);
29495
29613
  try {
29496
29614
  if (!await Ct()) return;
29497
- let n = y && k.length && se.length === 0 ? rM(e, k) : null;
29615
+ let n = y && k.length && se.length === 0 ? iM(e, k) : null;
29498
29616
  se.length > 0 ? Tt(se, e) : n?.mentions.length ? t(n.text, n.mentions, e) : t(e), ee([]), re(null), le([]), w(""), Ae(null), qe(null), nt(), j(!1), O(!1);
29499
29617
  } finally {
29500
29618
  oe(!1), ue.current?.focus();
@@ -29520,12 +29638,12 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29520
29638
  }
29521
29639
  function Ot(e) {
29522
29640
  let t = e.target.value;
29523
- w(t), te(e.target.selectionStart ?? t.length), t || ee([]), j(!1), GM(t) ?? O(!1), kt(t);
29641
+ w(t), te(e.target.selectionStart ?? t.length), t || ee([]), j(!1), KM(t) ?? O(!1), kt(t);
29524
29642
  }
29525
29643
  function kt(e) {
29526
29644
  if (i && e.length > 0) {
29527
29645
  let e = Date.now();
29528
- e - me.current >= RM && (me.current = e, i());
29646
+ e - me.current >= zM && (me.current = e, i());
29529
29647
  }
29530
29648
  }
29531
29649
  function At(e) {
@@ -29599,7 +29717,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29599
29717
  });
29600
29718
  return xe.phase === "idle" ? /* @__PURE__ */ R(I, { children: [
29601
29719
  Pt,
29602
- se.length > 0 && /* @__PURE__ */ L(JM, {
29720
+ se.length > 0 && /* @__PURE__ */ L(YM, {
29603
29721
  files: se,
29604
29722
  onRemove: (e) => le(se.filter((t, n) => n !== e)),
29605
29723
  onClear: () => le([])
@@ -29612,7 +29730,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29612
29730
  "aria-hidden": "true"
29613
29731
  }), x("composer.voice.insecure")]
29614
29732
  }),
29615
- Te && /* @__PURE__ */ L(aM, {
29733
+ Te && /* @__PURE__ */ L(oM, {
29616
29734
  strip: Te,
29617
29735
  isAdmin: !!m?.isAdmin,
29618
29736
  onPick: at,
@@ -29693,7 +29811,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29693
29811
  "aria-hidden": "true"
29694
29812
  })
29695
29813
  }),
29696
- /* @__PURE__ */ L(dM, {
29814
+ /* @__PURE__ */ L(fM, {
29697
29815
  disabled: o,
29698
29816
  onOpen: () => {
29699
29817
  let e = ue.current;
@@ -29739,13 +29857,13 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29739
29857
  spellCheck: !ze,
29740
29858
  className: "composer-input field-sizing-fixed min-h-11 w-full min-w-0 resize-none rounded-2xl bg-surface px-3.5 py-2.5 text-base leading-6 md:text-base"
29741
29859
  }),
29742
- /* @__PURE__ */ L(FM, {
29860
+ /* @__PURE__ */ L(IM, {
29743
29861
  ref: Ve,
29744
29862
  text: C,
29745
29863
  issues: Be.issues,
29746
29864
  activeId: He?.id ?? null
29747
29865
  }),
29748
- Je && He && /* @__PURE__ */ L(IM, {
29866
+ Je && He && /* @__PURE__ */ L(LM, {
29749
29867
  issue: Je,
29750
29868
  position: He,
29751
29869
  touch: ye,
@@ -29869,7 +29987,7 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29869
29987
  className: "text-xs text-muted-foreground",
29870
29988
  "data-testid": "completion-hint",
29871
29989
  children: x("composer.suggest.tabHint")
29872
- }), ze && Re && C.trim() !== "" && /* @__PURE__ */ L(LM, {
29990
+ }), ze && Re && C.trim() !== "" && /* @__PURE__ */ L(RM, {
29873
29991
  count: Be.fixable.length,
29874
29992
  marks: Be.issues.length,
29875
29993
  grammarStatus: Be.grammarStatus,
@@ -29893,14 +30011,14 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29893
30011
  (fe.current?.contains(e.target) || pe.current?.contains(e.target)) && e.preventDefault();
29894
30012
  },
29895
30013
  className: "w-(--radix-popover-trigger-width) max-w-[calc(100vw-1rem)] overflow-hidden p-0",
29896
- children: pt && mt ? /* @__PURE__ */ L(iM, {
30014
+ children: pt && mt ? /* @__PURE__ */ L(aM, {
29897
30015
  members: y?.members ? ht : null,
29898
30016
  error: !!y?.error,
29899
30017
  query: pt.query,
29900
30018
  activeIndex: T,
29901
30019
  onPick: xt,
29902
30020
  onHover: E
29903
- }) : /* @__PURE__ */ L(Zj, {
30021
+ }) : /* @__PURE__ */ L(Qj, {
29904
30022
  replies: e,
29905
30023
  query: ut ?? "",
29906
30024
  activeIndex: T,
@@ -29910,9 +30028,9 @@ function KM({ quickReplies: e, onSend: t, onAttach: n, onVoiceNote: r, onTyping:
29910
30028
  })
29911
30029
  ]
29912
30030
  })
29913
- ] }) : /* @__PURE__ */ R(I, { children: [Pt, /* @__PURE__ */ L(kM, { voice: xe })] });
30031
+ ] }) : /* @__PURE__ */ R(I, { children: [Pt, /* @__PURE__ */ L(AM, { voice: xe })] });
29914
30032
  }
29915
- function qM({ file: e }) {
30033
+ function JM({ file: e }) {
29916
30034
  let [t, n] = g(null);
29917
30035
  return u(() => {
29918
30036
  if (!e.type.startsWith("image/") || typeof URL.createObjectURL != "function") return;
@@ -29931,7 +30049,7 @@ function qM({ file: e }) {
29931
30049
  })
29932
30050
  });
29933
30051
  }
29934
- function JM({ files: e, onRemove: t, onClear: n }) {
30052
+ function YM({ files: e, onRemove: t, onClear: n }) {
29935
30053
  let { t: r } = P("inbox");
29936
30054
  return /* @__PURE__ */ R("div", {
29937
30055
  className: "mb-1.5 rounded-lg border bg-muted/50 p-1.5",
@@ -29956,7 +30074,7 @@ function JM({ files: e, onRemove: t, onClear: n }) {
29956
30074
  children: e.map((e, n) => /* @__PURE__ */ R("li", {
29957
30075
  className: "flex min-w-0 items-center gap-2 rounded-md bg-surface p-1 pr-0.5",
29958
30076
  children: [
29959
- /* @__PURE__ */ L(qM, { file: e }),
30077
+ /* @__PURE__ */ L(JM, { file: e }),
29960
30078
  /* @__PURE__ */ R("span", {
29961
30079
  className: "min-w-0 flex-1",
29962
30080
  children: [/* @__PURE__ */ L("span", {
@@ -29983,7 +30101,7 @@ function JM({ files: e, onRemove: t, onClear: n }) {
29983
30101
  });
29984
30102
  }
29985
30103
  // src/inbox/PanelHeader.tsx
29986
- function YM({ icon: e, title: t, description: n, action: r, closeLabel: i, onClose: a }) {
30104
+ function XM({ icon: e, title: t, description: n, action: r, closeLabel: i, onClose: a }) {
29987
30105
  return /* @__PURE__ */ R("div", {
29988
30106
  className: "border-b pb-2.5 pl-4 pr-1.5 pt-1",
29989
30107
  children: [/* @__PURE__ */ R("div", {
@@ -30013,7 +30131,7 @@ function YM({ icon: e, title: t, description: n, action: r, closeLabel: i, onClo
30013
30131
  });
30014
30132
  }
30015
30133
  // src/inbox/TagInput.tsx
30016
- function XM({ value: e, onChange: t, suggestions: n = [], onQueryChange: r, id: i, ...a }) {
30134
+ function ZM({ value: e, onChange: t, suggestions: n = [], onQueryChange: r, id: i, ...a }) {
30017
30135
  let { t: o } = P(["inbox", "common"]), s = d(), [c, l] = g(""), [u, f] = g(!1), p = e.length >= Ue, m = new Set(e.map((e) => rn(e))), h = rn(c), _ = n.filter((e) => !m.has(rn(e)) && rn(e).startsWith(h)).slice(0, 8), v = u && !p && _.length > 0;
30018
30136
  function y(e) {
30019
30137
  l(e), r?.(ln(e));
@@ -30116,13 +30234,13 @@ function XM({ value: e, onChange: t, suggestions: n = [], onQueryChange: r, id:
30116
30234
  });
30117
30235
  }
30118
30236
  // src/inbox/CustomerPanel.tsx
30119
- var ZM = [
30237
+ var QM = [
30120
30238
  "name",
30121
30239
  "company",
30122
30240
  "email",
30123
30241
  "otherPhone",
30124
30242
  "address"
30125
- ], QM = [
30243
+ ], $M = [
30126
30244
  {
30127
30245
  key: "name",
30128
30246
  type: "text"
@@ -30144,10 +30262,10 @@ var ZM = [
30144
30262
  type: "area"
30145
30263
  }
30146
30264
  ];
30147
- function $M(e) {
30148
- return ZM.some((t) => !!e[t]?.trim()) || e.tags.length > 0;
30149
- }
30150
30265
  function eN(e) {
30266
+ return QM.some((t) => !!e[t]?.trim()) || e.tags.length > 0;
30267
+ }
30268
+ function tN(e) {
30151
30269
  return {
30152
30270
  name: e.name ?? "",
30153
30271
  company: e.company ?? "",
@@ -30157,44 +30275,44 @@ function eN(e) {
30157
30275
  tags: [...e.tags]
30158
30276
  };
30159
30277
  }
30160
- function tN(e, t) {
30278
+ function nN(e, t) {
30161
30279
  return e.length === t.length && e.every((e, n) => e === t[n]);
30162
30280
  }
30163
- function nN(e, t) {
30164
- return ZM.every((n) => e[n].trim() === t[n].trim()) && tN(e.tags, t.tags);
30281
+ function rN(e, t) {
30282
+ return QM.every((n) => e[n].trim() === t[n].trim()) && nN(e.tags, t.tags);
30165
30283
  }
30166
- function rN(e, t, n) {
30284
+ function iN(e, t, n) {
30167
30285
  let r = {
30168
30286
  ...n,
30169
- tags: tN(e.tags, t.tags) ? n.tags : e.tags
30287
+ tags: nN(e.tags, t.tags) ? n.tags : e.tags
30170
30288
  };
30171
- for (let n of ZM) e[n].trim() !== t[n].trim() && (r[n] = e[n]);
30289
+ for (let n of QM) e[n].trim() !== t[n].trim() && (r[n] = e[n]);
30172
30290
  return r;
30173
30291
  }
30174
- function iN(e) {
30292
+ function aN(e) {
30175
30293
  let t = e.lastIndexOf("@");
30176
30294
  return t < 1 || /[?#%&\s\p{Cc}]/u.test(e) ? null : `mailto:${encodeURIComponent(e.slice(0, t))}@${e.slice(t + 1)}`;
30177
30295
  }
30178
- function aN(e, t) {
30296
+ function oN(e, t) {
30179
30297
  return /^\+?[\d\s()-]+$/.test(e) || !!t && e.replace(/\D/g, "") === t;
30180
30298
  }
30181
- function oN(e, t) {
30299
+ function sN(e, t) {
30182
30300
  let n = e?.trim() ?? "";
30183
- return n && !aN(n, t) ? n : "";
30301
+ return n && !oN(n, t) ? n : "";
30184
30302
  }
30185
- function sN(e, t, n) {
30303
+ function cN(e, t, n) {
30186
30304
  let r = t ?? n?.phone;
30187
30305
  return [
30188
30306
  e,
30189
30307
  n?.pushName ?? null,
30190
30308
  n?.savedName ?? null
30191
- ].map((e) => oN(e, r)).find((e) => !!e) || null;
30309
+ ].map((e) => sN(e, r)).find((e) => !!e) || null;
30192
30310
  }
30193
- function cN(e, t, n) {
30194
- let r = oN(e, t), i = [r && r !== n ? r : null, t ? `+${t}` : null].filter((e) => !!e);
30311
+ function lN(e, t, n) {
30312
+ let r = sN(e, t), i = [r && r !== n ? r : null, t ? `+${t}` : null].filter((e) => !!e);
30195
30313
  return i.length ? i.join(" · ") : null;
30196
30314
  }
30197
- function lN({ facts: e }) {
30315
+ function uN({ facts: e }) {
30198
30316
  let { t } = P("inbox"), n = d(), r = [];
30199
30317
  if (e.pushName && r.push({
30200
30318
  key: "push",
@@ -30258,14 +30376,14 @@ function lN({ facts: e }) {
30258
30376
  })]
30259
30377
  });
30260
30378
  }
30261
- function uN({ profile: e, whatsappName: t, whatsappPhone: n, whatsapp: r, directory: i }) {
30262
- let { t: a } = P("inbox"), o = e.name?.trim() || null, s = o ? null : sN(t, n, r), c = r ? null : cN(t, n, o), l = e.updatedBy != null && i?.me != null && e.updatedBy === i.me.id, u = i?.nameOf(e.updatedBy) ?? null, d = [];
30379
+ function dN({ profile: e, whatsappName: t, whatsappPhone: n, whatsapp: r, directory: i }) {
30380
+ let { t: a } = P("inbox"), o = e.name?.trim() || null, s = o ? null : cN(t, n, r), c = r ? null : lN(t, n, o), l = e.updatedBy != null && i?.me != null && e.updatedBy === i.me.id, u = i?.nameOf(e.updatedBy) ?? null, d = [];
30263
30381
  if (e.company && d.push({
30264
30382
  key: "company",
30265
30383
  label: a("customer.company"),
30266
30384
  value: e.company
30267
30385
  }), e.email) {
30268
- let t = iN(e.email);
30386
+ let t = aN(e.email);
30269
30387
  d.push({
30270
30388
  key: "email",
30271
30389
  label: a("customer.email"),
@@ -30346,11 +30464,11 @@ function uN({ profile: e, whatsappName: t, whatsappPhone: n, whatsapp: r, direct
30346
30464
  when: jl(e.updatedAt)
30347
30465
  }) : a("customer.updated", { when: jl(e.updatedAt) })
30348
30466
  }),
30349
- r && /* @__PURE__ */ L(lN, { facts: r })
30467
+ r && /* @__PURE__ */ L(uN, { facts: r })
30350
30468
  ]
30351
30469
  });
30352
30470
  }
30353
- function dN(e, t) {
30471
+ function fN(e, t) {
30354
30472
  let n = {};
30355
30473
  for (let r of e) {
30356
30474
  let e = r.path[0];
@@ -30360,11 +30478,11 @@ function dN(e, t) {
30360
30478
  }
30361
30479
  return n;
30362
30480
  }
30363
- function fN({ jid: e, snapshot: t, latest: n, whatsappName: r, whatsappPhone: i, whatsapp: a, directory: o, onDone: s, escapeRef: c, guardRef: l }) {
30364
- let { t: u } = P("inbox"), f = d(), m = h(null), [_] = g(() => eN(t)), [v] = g(() => _.name ? _ : {
30481
+ function pN({ jid: e, snapshot: t, latest: n, whatsappName: r, whatsappPhone: i, whatsapp: a, directory: o, onDone: s, escapeRef: c, guardRef: l }) {
30482
+ let { t: u } = P("inbox"), f = d(), m = h(null), [_] = g(() => tN(t)), [v] = g(() => _.name ? _ : {
30365
30483
  ..._,
30366
- name: sN(r, i, a) ?? ""
30367
- }), [y, b] = g(v), x = cN(r, i, t.name?.trim() || null), [S, C] = g({}), [w, T] = g(""), [E, D] = g(null), O = Ds(w), k = Es(e), ee = !nN(y, v);
30484
+ name: cN(r, i, a) ?? ""
30485
+ }), [y, b] = g(v), x = lN(r, i, t.name?.trim() || null), [S, C] = g({}), [w, T] = g(""), [E, D] = g(null), O = Ds(w), k = Es(e), ee = !rN(y, v);
30368
30486
  function A(e) {
30369
30487
  ee ? D(() => e) : e();
30370
30488
  }
@@ -30392,11 +30510,11 @@ function fN({ jid: e, snapshot: t, latest: n, whatsappName: r, whatsappPhone: i,
30392
30510
  let t = ln(w), r = t && y.tags.length < Ue && !y.tags.some((e) => rn(e) === rn(t)) ? {
30393
30511
  ...y,
30394
30512
  tags: [...y.tags, t]
30395
- } : y, i = at.safeParse(rN(r, _, eN(n)));
30513
+ } : y, i = at.safeParse(iN(r, _, tN(n)));
30396
30514
  i.success ? (C({}), k.mutate(i.data, {
30397
30515
  onSuccess: s,
30398
30516
  onError: (e) => z.error(u("customer.saveFailed"), { description: V(e) })
30399
- })) : C(dN(i.error.issues, u));
30517
+ })) : C(fN(i.error.issues, u));
30400
30518
  }
30401
30519
  function se(e) {
30402
30520
  e.key === "Enter" && (e.ctrlKey || e.metaKey) ? (e.preventDefault(), m.current?.requestSubmit()) : e.key === "Escape" && !e.defaultPrevented && (e.preventDefault(), te());
@@ -30416,7 +30534,7 @@ function fN({ jid: e, snapshot: t, latest: n, whatsappName: r, whatsappPhone: i,
30416
30534
  className: "rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground",
30417
30535
  children: ie ? u("customer.changedWhileEditingYou") : j ? u("customer.changedWhileEditing", { name: j }) : u("customer.changedWhileEditingUnknown")
30418
30536
  }),
30419
- QM.map(({ key: e, type: t }) => {
30537
+ $M.map(({ key: e, type: t }) => {
30420
30538
  let n = `${f}-${e}`, r = `${n}-error`, a = {
30421
30539
  id: n,
30422
30540
  value: y[e],
@@ -30462,7 +30580,7 @@ function fN({ jid: e, snapshot: t, latest: n, whatsappName: r, whatsappPhone: i,
30462
30580
  htmlFor: `${f}-tags`,
30463
30581
  children: u("customer.tags")
30464
30582
  }),
30465
- /* @__PURE__ */ L(XM, {
30583
+ /* @__PURE__ */ L(ZM, {
30466
30584
  id: `${f}-tags`,
30467
30585
  value: y.tags,
30468
30586
  onChange: (e) => {
@@ -30486,7 +30604,7 @@ function fN({ jid: e, snapshot: t, latest: n, whatsappName: r, whatsappPhone: i,
30486
30604
  })
30487
30605
  ]
30488
30606
  }),
30489
- a ? /* @__PURE__ */ L(lN, { facts: a }) : x && /* @__PURE__ */ L("p", {
30607
+ a ? /* @__PURE__ */ L(uN, { facts: a }) : x && /* @__PURE__ */ L("p", {
30490
30608
  className: "text-xs text-muted-foreground [overflow-wrap:anywhere]",
30491
30609
  children: u("customer.whatsappName", { name: x })
30492
30610
  })
@@ -30533,9 +30651,9 @@ function fN({ jid: e, snapshot: t, latest: n, whatsappName: r, whatsappPhone: i,
30533
30651
  ]
30534
30652
  });
30535
30653
  }
30536
- function pN({ jid: e, directory: t, onClose: n, title: r, description: i, escapeRef: a, guardRef: o }) {
30537
- let { t: s } = P(["inbox", "common"]), c = Ts(e), [l, u] = g(null), d = c.data, f = () => o.current ? o.current(n) : n(), p = !l && !c.isError && d && $M(d.profile) ? d : null;
30538
- return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L(YM, {
30654
+ function mN({ jid: e, directory: t, onClose: n, title: r, description: i, escapeRef: a, guardRef: o }) {
30655
+ let { t: s } = P(["inbox", "common"]), c = Ts(e), [l, u] = g(null), d = c.data, f = () => o.current ? o.current(n) : n(), p = !l && !c.isError && d && eN(d.profile) ? d : null;
30656
+ return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L(XM, {
30539
30657
  icon: /* @__PURE__ */ L(ta, {
30540
30658
  className: "size-4 shrink-0 text-muted-foreground",
30541
30659
  "aria-hidden": "true"
@@ -30551,7 +30669,7 @@ function pN({ jid: e, directory: t, onClose: n, title: r, description: i, escape
30551
30669
  className: "shrink-0 text-muted-foreground",
30552
30670
  children: [/* @__PURE__ */ L(ci, { "aria-hidden": "true" }), s("customer.edit")]
30553
30671
  })
30554
- }), l ? /* @__PURE__ */ L(fN, {
30672
+ }), l ? /* @__PURE__ */ L(pN, {
30555
30673
  jid: e,
30556
30674
  snapshot: l,
30557
30675
  latest: d?.profile ?? l,
@@ -30587,7 +30705,7 @@ function pN({ jid: e, directory: t, onClose: n, title: r, description: i, escape
30587
30705
  }), s("common:actions.tryAgain")]
30588
30706
  }),
30589
30707
  children: V(c.error)
30590
- }) : $M(d.profile) ? /* @__PURE__ */ L(uN, {
30708
+ }) : eN(d.profile) ? /* @__PURE__ */ L(dN, {
30591
30709
  profile: d.profile,
30592
30710
  whatsappName: d.whatsappName,
30593
30711
  whatsappPhone: d.whatsappPhone ?? null,
@@ -30613,19 +30731,19 @@ function pN({ jid: e, directory: t, onClose: n, title: r, description: i, escape
30613
30731
  children: [/* @__PURE__ */ L(mi, { "aria-hidden": "true" }), s("customer.addDetails")]
30614
30732
  })
30615
30733
  ]
30616
- }), d.whatsapp ? /* @__PURE__ */ L(lN, { facts: d.whatsapp }) : cN(d.whatsappName, d.whatsappPhone, null) && /* @__PURE__ */ L("p", {
30734
+ }), d.whatsapp ? /* @__PURE__ */ L(uN, { facts: d.whatsapp }) : lN(d.whatsappName, d.whatsappPhone, null) && /* @__PURE__ */ L("p", {
30617
30735
  className: "text-xs text-muted-foreground [overflow-wrap:anywhere]",
30618
- children: s("customer.whatsappName", { name: cN(d.whatsappName, d.whatsappPhone, null) })
30736
+ children: s("customer.whatsappName", { name: lN(d.whatsappName, d.whatsappPhone, null) })
30619
30737
  })]
30620
30738
  })
30621
30739
  })] });
30622
30740
  }
30623
- function mN({ open: e, onClose: t, guardRef: n, ...r }) {
30741
+ function hN({ open: e, onClose: t, guardRef: n, ...r }) {
30624
30742
  let { t: i } = P("inbox"), a = Dc("(min-width: 1024px)"), o = h(null), s = h(null), c = n ?? s, l = h(null);
30625
30743
  return a ? e ? /* @__PURE__ */ L("aside", {
30626
30744
  "aria-label": i("customer.title"),
30627
30745
  className: "flex w-80 shrink-0 flex-col border-l bg-surface",
30628
- children: /* @__PURE__ */ L(pN, {
30746
+ children: /* @__PURE__ */ L(mN, {
30629
30747
  ...r,
30630
30748
  onClose: t,
30631
30749
  escapeRef: o,
@@ -30649,7 +30767,7 @@ function mN({ open: e, onClose: t, guardRef: n, ...r }) {
30649
30767
  onEscapeKeyDown: (e) => {
30650
30768
  o.current?.() && e.preventDefault();
30651
30769
  },
30652
- children: /* @__PURE__ */ L(pN, {
30770
+ children: /* @__PURE__ */ L(mN, {
30653
30771
  ...r,
30654
30772
  onClose: t,
30655
30773
  escapeRef: o,
@@ -30669,11 +30787,11 @@ function mN({ open: e, onClose: t, guardRef: n, ...r }) {
30669
30787
  });
30670
30788
  }
30671
30789
  // src/inbox/GroupAiRow.tsx
30672
- var hN = (e) => !!(e?.enabled && e.agentAnswersGroups);
30673
- function gN({ jid: e, isAdmin: t }) {
30790
+ var gN = (e) => !!(e?.enabled && e.agentAnswersGroups);
30791
+ function _N({ jid: e, isAdmin: t }) {
30674
30792
  let { t: n } = P("inbox"), r = d(), i = d(), a = gc(e), o = _c(), s = a.data;
30675
30793
  if (!s) return null;
30676
- let c = hN(s), l = s.agentName ?? "", u = s.agentId === null ? n("aiGroups.info.noAgent") : s.agentEnabled ? s.agentAnswersGroups ? c && s.paused ? n("aiGroups.info.paused") : n("aiGroups.info.hint", { name: l }) : n("aiGroups.info.agentOff", { name: l }) : n("aiGroups.info.agentDisabled", { name: l });
30794
+ let c = gN(s), l = s.agentName ?? "", u = s.agentId === null ? n("aiGroups.info.noAgent") : s.agentEnabled ? s.agentAnswersGroups ? c && s.paused ? n("aiGroups.info.paused") : n("aiGroups.info.hint", { name: l }) : n("aiGroups.info.agentOff", { name: l }) : n("aiGroups.info.agentDisabled", { name: l });
30677
30795
  return /* @__PURE__ */ R("section", {
30678
30796
  className: "mx-4 mt-2 rounded-lg border bg-muted/40 px-3 py-2",
30679
30797
  "aria-labelledby": r,
@@ -30729,9 +30847,9 @@ function gN({ jid: e, isAdmin: t }) {
30729
30847
  ]
30730
30848
  });
30731
30849
  }
30732
- function _N({ ai: e }) {
30850
+ function vN({ ai: e }) {
30733
30851
  let { t } = P("inbox");
30734
- return !e || !hN(e) ? null : /* @__PURE__ */ R(G, {
30852
+ return !e || !gN(e) ? null : /* @__PURE__ */ R(G, {
30735
30853
  variant: "outline",
30736
30854
  className: U("min-w-0 shrink gap-1 font-normal", e.paused ? "border-warning/40 text-warning" : "border-primary/30 text-primary"),
30737
30855
  "data-testid": "group-ai-badge",
@@ -30745,9 +30863,9 @@ function _N({ ai: e }) {
30745
30863
  });
30746
30864
  }
30747
30865
  // src/inbox/ConversationHeader.tsx
30748
- var vN = "none";
30749
- function yN({ chat: e, directory: t, onBack: n, onAssign: r, onToggleStatus: i, notesOpen: a, notesCount: o, onToggleNotes: s, showCustomer: c, customerOpen: l, onToggleCustomer: u, onOpenInfo: d, memberCount: f = null, inbox: p, groupAi: m = null, busy: h }) {
30750
- let { t: g } = P("inbox"), _ = kC(e, g), v = e.type === "group" ? f == null ? g("chatListItem.group") : g("header.groupMembers", { count: f }) : hC(e) ?? g("header.phoneHidden"), y = e.status === "resolved", b = e.type === "group" && hN(m) ? /* @__PURE__ */ L(_N, { ai: m }) : null, x = [...t.assignableFor(e.inboxId, { direct: e.type === "dm" })];
30866
+ var yN = "none";
30867
+ function bN({ chat: e, directory: t, onBack: n, onAssign: r, onToggleStatus: i, notesOpen: a, notesCount: o, onToggleNotes: s, showCustomer: c, customerOpen: l, onToggleCustomer: u, onOpenInfo: d, memberCount: f = null, inbox: p, groupAi: m = null, busy: h }) {
30868
+ let { t: g } = P("inbox"), _ = kC(e, g), v = e.type === "group" ? f == null ? g("chatListItem.group") : g("header.groupMembers", { count: f }) : hC(e) ?? g("header.phoneHidden"), y = e.status === "resolved", b = e.type === "group" && gN(m) ? /* @__PURE__ */ L(vN, { ai: m }) : null, x = [...t.assignableFor(e.inboxId, { direct: e.type === "dm" })];
30751
30869
  if (e.assignedTo != null && !x.some((t) => t.id === e.assignedTo)) {
30752
30870
  let n = t.byId.get(e.assignedTo);
30753
30871
  x.push(n ?? {
@@ -30819,9 +30937,9 @@ function yN({ chat: e, directory: t, onBack: n, onAssign: r, onToggleStatus: i,
30819
30937
  className: "flex w-full items-center gap-2 px-1 @2xl:w-auto @2xl:px-0",
30820
30938
  children: [
30821
30939
  /* @__PURE__ */ R(ob, {
30822
- value: e.assignedTo == null ? vN : String(e.assignedTo),
30940
+ value: e.assignedTo == null ? yN : String(e.assignedTo),
30823
30941
  disabled: h,
30824
- onValueChange: (e) => r(e === vN ? null : Number(e)),
30942
+ onValueChange: (e) => r(e === yN ? null : Number(e)),
30825
30943
  children: [/* @__PURE__ */ L(lb, {
30826
30944
  id: `assign-${e.jid}`,
30827
30945
  "aria-label": g("header.assignedTo"),
@@ -30832,7 +30950,7 @@ function yN({ chat: e, directory: t, onBack: n, onAssign: r, onToggleStatus: i,
30832
30950
  position: "popper",
30833
30951
  align: "end",
30834
30952
  children: [/* @__PURE__ */ L(fb, {
30835
- value: vN,
30953
+ value: yN,
30836
30954
  className: "min-h-11 md:min-h-8",
30837
30955
  children: g("header.unassigned")
30838
30956
  }), x.map((e) => /* @__PURE__ */ L(fb, {
@@ -30895,7 +31013,7 @@ function yN({ chat: e, directory: t, onBack: n, onAssign: r, onToggleStatus: i,
30895
31013
  });
30896
31014
  }
30897
31015
  // src/inbox/EventItem.tsx
30898
- function bN(e) {
31016
+ function xN(e) {
30899
31017
  for (let t of [
30900
31018
  "assignedTo",
30901
31019
  "to",
@@ -30907,11 +31025,11 @@ function bN(e) {
30907
31025
  }
30908
31026
  return null;
30909
31027
  }
30910
- function xN(e, t) {
31028
+ function SN(e, t) {
30911
31029
  let n = e.actorId == null ? N.t("inbox:events.system") : t.nameOf(e.actorId, { youLabel: !0 }) ?? N.t("inbox:events.someone"), r = pS(e.payload.handoff) ? fS(e.payload.handoff) : null;
30912
31030
  switch (e.type) {
30913
31031
  case "assigned": {
30914
- let i = bN(e.payload);
31032
+ let i = xN(e.payload);
30915
31033
  if (r && i != null && i !== e.actorId) return N.t("inbox:events.handedTo", {
30916
31034
  actor: n,
30917
31035
  assignee: t.nameOf(i, { youLabel: !0 }) ?? N.t("inbox:events.someoneLower"),
@@ -30968,9 +31086,9 @@ function xN(e, t) {
30968
31086
  }
30969
31087
  }
30970
31088
  }
30971
- function SN({ event: e, directory: t }) {
31089
+ function CN({ event: e, directory: t }) {
30972
31090
  P();
30973
- let n = xN(e, t);
31091
+ let n = SN(e, t);
30974
31092
  return n ? /* @__PURE__ */ L("div", {
30975
31093
  className: "flex justify-center px-3 py-1",
30976
31094
  children: /* @__PURE__ */ R("span", {
@@ -30983,7 +31101,7 @@ function SN({ event: e, directory: t }) {
30983
31101
  })
30984
31102
  }) : null;
30985
31103
  }
30986
- function CN({ note: e, directory: t }) {
31104
+ function wN({ note: e, directory: t }) {
30987
31105
  let { t: n } = P("inbox");
30988
31106
  return /* @__PURE__ */ L("div", {
30989
31107
  className: "flex justify-center px-3 py-1",
@@ -31018,7 +31136,7 @@ function CN({ note: e, directory: t }) {
31018
31136
  });
31019
31137
  }
31020
31138
  // src/lib/clipboard.ts
31021
- async function wN(e) {
31139
+ async function TN(e) {
31022
31140
  if (window.isSecureContext && navigator.clipboard?.writeText) {
31023
31141
  await navigator.clipboard.writeText(e);
31024
31142
  return;
@@ -31032,10 +31150,10 @@ async function wN(e) {
31032
31150
  t.remove(), n?.focus?.();
31033
31151
  }
31034
31152
  }
31035
- function TN() {
31153
+ function EN() {
31036
31154
  return typeof window < "u" && window.isSecureContext && typeof ClipboardItem < "u" && typeof navigator.clipboard?.write == "function";
31037
31155
  }
31038
- async function EN(e) {
31156
+ async function DN(e) {
31039
31157
  if (e.type === "image/png") return e;
31040
31158
  let t = await createImageBitmap(e);
31041
31159
  try {
@@ -31048,15 +31166,15 @@ async function EN(e) {
31048
31166
  t.close();
31049
31167
  }
31050
31168
  }
31051
- async function DN(e) {
31169
+ async function ON(e) {
31052
31170
  let t = fetch(e, { credentials: "same-origin" }).then(async (e) => {
31053
31171
  if (!e.ok) throw Error(`Image download failed (${e.status})`);
31054
- return EN(await e.blob());
31172
+ return DN(await e.blob());
31055
31173
  });
31056
31174
  await navigator.clipboard.write([new ClipboardItem({ "image/png": t })]);
31057
31175
  }
31058
31176
  // src/inbox/MediaView.tsx
31059
- var ON = {
31177
+ var kN = {
31060
31178
  "image/jpeg": "jpg",
31061
31179
  "image/png": "png",
31062
31180
  "image/webp": "webp",
@@ -31067,19 +31185,19 @@ var ON = {
31067
31185
  "audio/mp4": "m4a",
31068
31186
  "application/pdf": "pdf"
31069
31187
  };
31070
- function kN(e) {
31188
+ function AN(e) {
31071
31189
  if (e.mediaName) return e.mediaName;
31072
- let t = (e.mediaMime ?? "").split(";")[0]?.trim() ?? "", n = ON[t] ?? t.split("/")[1]?.replace(/[^a-z0-9]/gi, "") ?? "", r = e.id.replace(/[^a-z0-9]/gi, "").slice(-8) || "file", i = n ? `.${n}` : "";
31190
+ let t = (e.mediaMime ?? "").split(";")[0]?.trim() ?? "", n = kN[t] ?? t.split("/")[1]?.replace(/[^a-z0-9]/gi, "") ?? "", r = e.id.replace(/[^a-z0-9]/gi, "").slice(-8) || "file", i = n ? `.${n}` : "";
31073
31191
  return `whatsapp-${e.type}-${r}${i}`;
31074
31192
  }
31075
- function AN(e, t) {
31193
+ function jN(e, t) {
31076
31194
  return (n) => Ab(n.dataTransfer, {
31077
31195
  url: t,
31078
- name: kN(e),
31196
+ name: AN(e),
31079
31197
  mime: e.mediaMime ?? null
31080
31198
  });
31081
31199
  }
31082
- function jN() {
31200
+ function MN() {
31083
31201
  let e = T();
31084
31202
  return S({
31085
31203
  mutationFn: (e) => B(`/media/${encodeURIComponent(e)}/redownload`, { method: "POST" }),
@@ -31088,11 +31206,11 @@ function jN() {
31088
31206
  }
31089
31207
  });
31090
31208
  }
31091
- function MN({ src: e, alt: t, open: n, onOpenChange: r, downloadName: i }) {
31092
- let { t: a } = P(["inbox", "common"]), [o] = g(TN);
31209
+ function NN({ src: e, alt: t, open: n, onOpenChange: r, downloadName: i }) {
31210
+ let { t: a } = P(["inbox", "common"]), [o] = g(EN);
31093
31211
  async function s() {
31094
31212
  try {
31095
- await DN(e), z.success(a("message.copy.imageDone"));
31213
+ await ON(e), z.success(a("message.copy.imageDone"));
31096
31214
  } catch {
31097
31215
  z.error(a("message.copy.imageFailed"));
31098
31216
  }
@@ -31160,8 +31278,8 @@ function MN({ src: e, alt: t, open: n, onOpenChange: r, downloadName: i }) {
31160
31278
  })
31161
31279
  });
31162
31280
  }
31163
- function NN({ message: e, onLoad: t }) {
31164
- let { t: n } = P(["inbox", "common"]), [r, i] = g(!1), a = jN(), o = e.mediaName ?? n(`media.types.${e.type}`), s = e.mediaStatus === "pending" && !e.id.startsWith("local-"), c = s && (e.type === "image" || e.type === "sticker"), { mutate: l, isIdle: d } = a;
31281
+ function PN({ message: e, onLoad: t }) {
31282
+ let { t: n } = P(["inbox", "common"]), [r, i] = g(!1), a = MN(), o = e.mediaName ?? n(`media.types.${e.type}`), s = e.mediaStatus === "pending" && !e.id.startsWith("local-"), c = s && (e.type === "image" || e.type === "sticker"), { mutate: l, isIdle: d } = a;
31165
31283
  if (u(() => {
31166
31284
  c && d && l(e.id);
31167
31285
  }, [
@@ -31230,13 +31348,13 @@ function NN({ message: e, onLoad: t }) {
31230
31348
  alt: e.body ?? e.mediaName ?? n("media.imageAlt"),
31231
31349
  loading: "lazy",
31232
31350
  onLoad: t,
31233
- onDragStart: AN(e, f),
31351
+ onDragStart: jN(e, f),
31234
31352
  className: e.type === "sticker" ? "size-32 object-contain" : "max-h-72 w-full max-w-full object-cover sm:max-w-xs"
31235
31353
  })
31236
- }), /* @__PURE__ */ L(MN, {
31354
+ }), /* @__PURE__ */ L(NN, {
31237
31355
  src: f,
31238
31356
  alt: e.body ?? n("media.imageAlt"),
31239
- downloadName: kN(e),
31357
+ downloadName: AN(e),
31240
31358
  open: r,
31241
31359
  onOpenChange: i
31242
31360
  })] });
@@ -31257,7 +31375,7 @@ function NN({ message: e, onLoad: t }) {
31257
31375
  default: return /* @__PURE__ */ R("a", {
31258
31376
  href: f,
31259
31377
  download: e.mediaName ?? !0,
31260
- onDragStart: AN(e, f),
31378
+ onDragStart: jN(e, f),
31261
31379
  className: "flex min-h-14 max-w-full items-center gap-3 rounded-lg border bg-muted/60 px-3 py-2 hover:bg-muted",
31262
31380
  children: [/* @__PURE__ */ L(br, {
31263
31381
  className: "size-8 shrink-0 text-muted-foreground",
@@ -31276,13 +31394,13 @@ function NN({ message: e, onLoad: t }) {
31276
31394
  }
31277
31395
  }
31278
31396
  // src/inbox/SafetyMessage.tsx
31279
- function PN(e) {
31397
+ function FN(e) {
31280
31398
  return !e.fromMe && !!e.safety && e.safety.status !== "safe";
31281
31399
  }
31282
- function FN(e) {
31400
+ function IN(e) {
31283
31401
  return e.rules.filter((e) => e !== "firstFile").slice(0, 2);
31284
31402
  }
31285
- function IN({ safety: e, hasFile: t }) {
31403
+ function LN({ safety: e, hasFile: t }) {
31286
31404
  let { t: n } = P("inbox"), r = e.level === "high";
31287
31405
  return /* @__PURE__ */ R("div", {
31288
31406
  role: "note",
@@ -31299,9 +31417,9 @@ function IN({ safety: e, hasFile: t }) {
31299
31417
  className: "font-semibold",
31300
31418
  children: n(r ? t ? "safety.title.highFile" : "safety.title.highText" : t ? "safety.title.warningFile" : "safety.title.warningText")
31301
31419
  }),
31302
- FN(e).length > 0 && /* @__PURE__ */ L("ul", {
31420
+ IN(e).length > 0 && /* @__PURE__ */ L("ul", {
31303
31421
  className: "mt-0.5 list-disc pl-4 text-muted-foreground",
31304
- children: FN(e).map((e) => /* @__PURE__ */ L("li", { children: n(`safety.rule.${e}`) }, e))
31422
+ children: IN(e).map((e) => /* @__PURE__ */ L("li", { children: n(`safety.rule.${e}`) }, e))
31305
31423
  }),
31306
31424
  e.aiReason && /* @__PURE__ */ R("p", {
31307
31425
  className: "mt-1 flex gap-1 text-muted-foreground",
@@ -31317,7 +31435,7 @@ function IN({ safety: e, hasFile: t }) {
31317
31435
  })]
31318
31436
  });
31319
31437
  }
31320
- async function LN(e, t) {
31438
+ async function RN(e, t) {
31321
31439
  let n = await fetch(`/api/media/${encodeURIComponent(e)}`, { credentials: "same-origin" });
31322
31440
  if (n.status === 403) return "locked";
31323
31441
  if (!n.ok) throw Error(`HTTP ${n.status}`);
@@ -31330,7 +31448,7 @@ async function LN(e, t) {
31330
31448
  }
31331
31449
  return "ok";
31332
31450
  }
31333
- function RN({ message: e, safety: t }) {
31451
+ function zN({ message: e, safety: t }) {
31334
31452
  let { t: n } = P(["inbox", "common"]), { user: r } = Sl(), i = r?.role === "admin", [a, o] = g(!1), [s, c] = g(!1), l = e.mediaName ?? n("media.document"), u = t.level === "high";
31335
31453
  if (t.deletedBy !== null) return /* @__PURE__ */ R("p", {
31336
31454
  "data-testid": "safety-file-deleted",
@@ -31343,7 +31461,7 @@ function RN({ message: e, safety: t }) {
31343
31461
  let d = t.locked && !i, f = async () => {
31344
31462
  c(!0);
31345
31463
  try {
31346
- let t = await LN(e.id, l);
31464
+ let t = await RN(e.id, l);
31347
31465
  o(!1), t === "locked" && z.error(n("safety.file.lockedToast"));
31348
31466
  } catch (e) {
31349
31467
  z.error(V(e));
@@ -31417,7 +31535,7 @@ function RN({ message: e, safety: t }) {
31417
31535
  })
31418
31536
  })] });
31419
31537
  }
31420
- function zN({ jid: e }) {
31538
+ function BN({ jid: e }) {
31421
31539
  let { t } = P("inbox"), { user: n } = Sl(), { data: r } = $T(e), i = nE();
31422
31540
  if (!r?.enabled || !r.blocked && !r.scam && !r.maybeHacked) return null;
31423
31541
  let a = n?.role === "admin";
@@ -31438,7 +31556,7 @@ function zN({ jid: e }) {
31438
31556
  size: "sm",
31439
31557
  variant: "outline",
31440
31558
  className: "pointer-coarse:min-h-11",
31441
- onClick: () => wN(t("safety.bar.warnText")).then(() => z.success(t("safety.bar.copied")), () => z.error(t("safety.bar.copyFailed"))),
31559
+ onClick: () => TN(t("safety.bar.warnText")).then(() => z.success(t("safety.bar.copied")), () => z.error(t("safety.bar.copyFailed"))),
31442
31560
  children: [/* @__PURE__ */ L(fr, { "aria-hidden": !0 }), t("safety.bar.copyWarning")]
31443
31561
  })
31444
31562
  ]
@@ -31472,7 +31590,7 @@ function zN({ jid: e }) {
31472
31590
  ]
31473
31591
  });
31474
31592
  }
31475
- function BN(e) {
31593
+ function VN(e) {
31476
31594
  let t = /* @__PURE__ */ new Map();
31477
31595
  for (let n of [...e].sort((e, t) => e.at - t.at)) {
31478
31596
  let e = t.get(n.emoji) ?? {
@@ -31483,13 +31601,13 @@ function BN(e) {
31483
31601
  }
31484
31602
  return [...t.values()].sort((e, t) => t.reactions.length - e.reactions.length || e.reactions[0].at - t.reactions[0].at);
31485
31603
  }
31486
- function VN(e, t, n, r) {
31604
+ function HN(e, t, n, r) {
31487
31605
  return e.fromMe && r === "" ? t("message.reactions.fromYou") : e.fromMe && r ? t("message.reactions.fromTeammate", { name: r }) : e.fromMe ? t("message.reactions.fromPhone") : e.senderName || n || (e.senderJid ? mC(e.senderJid) : "") || t("chatListItem.unknownContact");
31488
31606
  }
31489
- function HN({ reactions: e, out: t, contactName: n, teamName: r, onRemoveMine: i }) {
31607
+ function UN({ reactions: e, out: t, contactName: n, teamName: r, onRemoveMine: i }) {
31490
31608
  let { t: a } = P("inbox");
31491
31609
  if (!e.length) return null;
31492
- let o = BN(e), s = a("message.reactions.label", { list: o.map((e) => `${e.emoji} ${e.reactions.length}`).join(", ") });
31610
+ let o = VN(e), s = a("message.reactions.label", { list: o.map((e) => `${e.emoji} ${e.reactions.length}`).join(", ") });
31493
31611
  return /* @__PURE__ */ R(_x, { children: [/* @__PURE__ */ L(vx, {
31494
31612
  asChild: !0,
31495
31613
  children: /* @__PURE__ */ R(W, {
@@ -31527,7 +31645,7 @@ function HN({ reactions: e, out: t, contactName: n, teamName: r, onRemoveMine: i
31527
31645
  }),
31528
31646
  /* @__PURE__ */ L("span", {
31529
31647
  className: "min-w-0 flex-1 truncate text-sm",
31530
- children: VN(t, a, n, r)
31648
+ children: HN(t, a, n, r)
31531
31649
  }),
31532
31650
  t.fromMe && i && /* @__PURE__ */ L(W, {
31533
31651
  type: "button",
@@ -31543,16 +31661,16 @@ function HN({ reactions: e, out: t, contactName: n, teamName: r, onRemoveMine: i
31543
31661
  })] });
31544
31662
  }
31545
31663
  // src/inbox/ReactionPicker.tsx
31546
- var UN = [
31664
+ var WN = [
31547
31665
  "👍",
31548
31666
  "❤️",
31549
31667
  "😂",
31550
31668
  "😮",
31551
31669
  "😢",
31552
31670
  "🙏"
31553
- ], WN = /* @__PURE__ */ "👍.❤️.😂.😮.😢.🙏.👏.🙌.🔥.🎉.💯.✅.👌.🤝.💪.😊.😍.🥰.😁.🤣.😅.😉.🤔.😎.😴.😭.😡.😱.🥲.🙈.👀.💐.🎂.☕.🍜.🚚.📦.💰.⭐.❌".split(".");
31554
- function GN({ out: e, current: t, currentBy: n, open: r, onOpenChange: i, onReact: a, disabledReason: o, onReply: s, onCopy: c }) {
31555
- let { t: l } = P("inbox"), [u, d] = g(!1), f = t && !UN.includes(t) ? [t, ...UN.slice(0, 5)] : UN, p = (e) => {
31671
+ ], GN = /* @__PURE__ */ "👍.❤️.😂.😮.😢.🙏.👏.🙌.🔥.🎉.💯.✅.👌.🤝.💪.😊.😍.🥰.😁.🤣.😅.😉.🤔.😎.😴.😭.😡.😱.🥲.🙈.👀.💐.🎂.☕.🍜.🚚.📦.💰.⭐.❌".split(".");
31672
+ function KN({ out: e, current: t, currentBy: n, open: r, onOpenChange: i, onReact: a, disabledReason: o, onReply: s, onCopy: c }) {
31673
+ let { t: l } = P("inbox"), [u, d] = g(!1), f = t && !WN.includes(t) ? [t, ...WN.slice(0, 5)] : WN, p = (e) => {
31556
31674
  a(e === t ? "" : e), i(!1);
31557
31675
  }, m = (e, n) => /* @__PURE__ */ L(W, {
31558
31676
  type: "button",
@@ -31607,7 +31725,7 @@ function GN({ out: e, current: t, currentBy: n, open: r, onOpenChange: i, onReac
31607
31725
  className: "grid max-h-56 grid-cols-6 gap-0.5 overflow-y-auto sm:grid-cols-8",
31608
31726
  role: "group",
31609
31727
  "aria-label": l("message.reactions.more"),
31610
- children: WN.map((e) => m(e, !1))
31728
+ children: GN.map((e) => m(e, !1))
31611
31729
  })] }) : /* @__PURE__ */ R("div", {
31612
31730
  className: "flex items-center gap-0.5",
31613
31731
  role: "group",
@@ -31654,8 +31772,8 @@ function GN({ out: e, current: t, currentBy: n, open: r, onOpenChange: i, onReac
31654
31772
  })]
31655
31773
  });
31656
31774
  }
31657
- var KN = 72, qN = 500, JN = 8;
31658
- function YN(e, t) {
31775
+ var qN = 72, JN = 500, YN = 8;
31776
+ function XN(e, t) {
31659
31777
  let [n, r] = g(0), i = h(null), a = h(null), o = () => {
31660
31778
  a.current && clearTimeout(a.current), a.current = null;
31661
31779
  };
@@ -31674,20 +31792,20 @@ function YN(e, t) {
31674
31792
  horizontal: !1
31675
31793
  }, o(), a.current = setTimeout(() => {
31676
31794
  a.current = null, i.current = null, r(0), (t ?? e)();
31677
- }, qN));
31795
+ }, JN));
31678
31796
  },
31679
31797
  onPointerMove(e) {
31680
31798
  let t = i.current;
31681
31799
  if (!t || e.pointerId !== t.id) return;
31682
31800
  let n = e.clientX - t.x, a = e.clientY - t.y;
31683
- if ((Math.abs(n) > JN || Math.abs(a) > JN) && o(), !t.horizontal) {
31684
- if (Math.abs(a) > JN && Math.abs(a) >= Math.abs(n)) {
31801
+ if ((Math.abs(n) > YN || Math.abs(a) > YN) && o(), !t.horizontal) {
31802
+ if (Math.abs(a) > YN && Math.abs(a) >= Math.abs(n)) {
31685
31803
  i.current = null;
31686
31804
  return;
31687
31805
  }
31688
- n > JN && (t.horizontal = !0);
31806
+ n > YN && (t.horizontal = !0);
31689
31807
  }
31690
- t.horizontal && r(Math.max(0, Math.min(n, KN)));
31808
+ t.horizontal && r(Math.max(0, Math.min(n, qN)));
31691
31809
  },
31692
31810
  onPointerUp() {
31693
31811
  let t = i.current?.horizontal && n >= 56;
@@ -31698,11 +31816,11 @@ function YN(e, t) {
31698
31816
  };
31699
31817
  }
31700
31818
  // src/inbox/MessageBubble.tsx
31701
- function XN({ chatJid: e, directory: t }) {
31819
+ function ZN({ chatJid: e, directory: t }) {
31702
31820
  let { t: n } = P("inbox"), r = Ts(e), i = `/chats/${encodeURIComponent(e)}?customer=1`, a = QC(i);
31703
31821
  return /* @__PURE__ */ R("div", {
31704
31822
  className: "space-y-3",
31705
- children: [r.data ? /* @__PURE__ */ L(uN, {
31823
+ children: [r.data ? /* @__PURE__ */ L(dN, {
31706
31824
  profile: r.data.profile,
31707
31825
  whatsappName: r.data.whatsappName,
31708
31826
  directory: t
@@ -31724,11 +31842,11 @@ function XN({ chatJid: e, directory: t }) {
31724
31842
  })]
31725
31843
  });
31726
31844
  }
31727
- var ZN = U("[&_a]:break-all [&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2", "[&_code]:rounded [&_code]:bg-muted/70 [&_code]:px-1 [&_code]:font-mono [&_code]:text-[13px]", "[&_[data-block]]:block [&_[data-block]]:px-2 [&_[data-block]]:py-1", "[&_[data-quote]]:block [&_[data-quote]]:border-l-4 [&_[data-quote]]:border-border [&_[data-quote]]:pl-2 [&_[data-quote]]:text-muted-foreground", "[&_[data-bullet]]:block [&_[data-bullet]]:pl-4 [&_[data-bullet]]:-indent-3 [&_[data-bullet]]:before:content-['•_']");
31728
- function QN(e, t, n) {
31845
+ var QN = U("[&_a]:break-all [&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2", "[&_code]:rounded [&_code]:bg-muted/70 [&_code]:px-1 [&_code]:font-mono [&_code]:text-[13px]", "[&_[data-block]]:block [&_[data-block]]:px-2 [&_[data-block]]:py-1", "[&_[data-quote]]:block [&_[data-quote]]:border-l-4 [&_[data-quote]]:border-border [&_[data-quote]]:pl-2 [&_[data-quote]]:text-muted-foreground", "[&_[data-bullet]]:block [&_[data-bullet]]:pl-4 [&_[data-bullet]]:-indent-3 [&_[data-bullet]]:before:content-['•_']");
31846
+ function $N(e, t, n) {
31729
31847
  return e.fromMe ? t("message.you") : n || e.senderName || t("message.contact");
31730
31848
  }
31731
- function $N(e, t) {
31849
+ function eP(e, t) {
31732
31850
  if (e.body) return Il(GC(e.body), 140);
31733
31851
  switch (e.type) {
31734
31852
  case "image": return t("message.quote.image");
@@ -31739,7 +31857,7 @@ function $N(e, t) {
31739
31857
  default: return t("message.quote.message");
31740
31858
  }
31741
31859
  }
31742
- function eP({ status: e }) {
31860
+ function tP({ status: e }) {
31743
31861
  let { t } = P("inbox"), n = "inline-block size-3.5 shrink-0", r = t(`message.status.${e}`);
31744
31862
  switch (e) {
31745
31863
  case "pending": return /* @__PURE__ */ L(ur, {
@@ -31769,7 +31887,7 @@ function eP({ status: e }) {
31769
31887
  });
31770
31888
  }
31771
31889
  }
31772
- function tP({ message: e }) {
31890
+ function nP({ message: e }) {
31773
31891
  let { t } = P("inbox");
31774
31892
  if (e.transcriptStatus === "ok" && e.transcript) return /* @__PURE__ */ R("p", {
31775
31893
  className: "mb-1 whitespace-pre-wrap break-words text-xs italic text-muted-foreground [overflow-wrap:anywhere]",
@@ -31785,8 +31903,8 @@ function tP({ message: e }) {
31785
31903
  children: n
31786
31904
  }) : null;
31787
31905
  }
31788
- function nP({ message: e, showSender: t, outboundLabel: n, quoted: r, onRetry: i, retrying: a, onMediaLoad: o, directory: s, onReply: c, onReact: l, reactDisabledReason: u = null, contactName: d }) {
31789
- let { t: f } = P(["inbox", "common"]), p = !!c && e.type !== "system" && !e.id.startsWith("local-"), m = p && !!l, [h, _] = g(!1), v = YN(p ? () => c(e) : void 0, m ? () => _(!0) : void 0);
31906
+ function rP({ message: e, showSender: t, outboundLabel: n, quoted: r, onRetry: i, retrying: a, onMediaLoad: o, directory: s, onReply: c, onReact: l, reactDisabledReason: u = null, contactName: d }) {
31907
+ let { t: f } = P(["inbox", "common"]), p = !!c && e.type !== "system" && !e.id.startsWith("local-"), m = p && !!l, [h, _] = g(!1), v = XN(p ? () => c(e) : void 0, m ? () => _(!0) : void 0);
31790
31908
  if (e.type === "system") return /* @__PURE__ */ L("div", {
31791
31909
  className: "flex justify-center px-3 py-1",
31792
31910
  children: /* @__PURE__ */ L("span", {
@@ -31794,7 +31912,7 @@ function nP({ message: e, showSender: t, outboundLabel: n, quoted: r, onRetry: i
31794
31912
  children: e.body
31795
31913
  })
31796
31914
  });
31797
- let y = e.fromMe, b = e.type !== "text", x = PN(e) ? e.safety : null, S = e.reactions ?? [], C = e.senderName ?? (e.senderJid ? mC(e.senderJid) || f("chatListItem.unknownContact") : null), w = y ? null : e.senderProfile ?? null, T = p && /* @__PURE__ */ L(W, {
31915
+ let y = e.fromMe, b = e.type !== "text", x = FN(e) ? e.safety : null, S = e.reactions ?? [], C = e.senderName ?? (e.senderJid ? mC(e.senderJid) || f("chatListItem.unknownContact") : null), w = y ? null : e.senderProfile ?? null, T = p && /* @__PURE__ */ L(W, {
31798
31916
  type: "button",
31799
31917
  variant: "outline",
31800
31918
  size: "icon",
@@ -31805,7 +31923,7 @@ function nP({ message: e, showSender: t, outboundLabel: n, quoted: r, onRetry: i
31805
31923
  children: /* @__PURE__ */ L(vi, { "aria-hidden": "true" })
31806
31924
  }), E = e.body, D = E ? async () => {
31807
31925
  try {
31808
- await wN(E), z.success(f("message.copy.done"));
31926
+ await TN(E), z.success(f("message.copy.done"));
31809
31927
  } catch {
31810
31928
  z.error(f("message.copy.failed"));
31811
31929
  }
@@ -31819,7 +31937,7 @@ function nP({ message: e, showSender: t, outboundLabel: n, quoted: r, onRetry: i
31819
31937
  "data-testid": "copy-message",
31820
31938
  className: "size-8 shrink-0 rounded-full text-muted-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100 focus-visible:opacity-100 pointer-coarse:not-focus-visible:sr-only",
31821
31939
  children: /* @__PURE__ */ L(fr, { "aria-hidden": "true" })
31822
- }), k = S.find((e) => e.fromMe) ?? null, ee = k?.sentByUserId ?? null, A = s?.me?.id ?? null, te = ee === null ? null : ee === A ? "" : s?.nameOf(ee) ?? f("message.reactions.fromTeammateUnknown"), ne = m && /* @__PURE__ */ L(GN, {
31940
+ }), k = S.find((e) => e.fromMe) ?? null, ee = k?.sentByUserId ?? null, A = s?.me?.id ?? null, te = ee === null ? null : ee === A ? "" : s?.nameOf(ee) ?? f("message.reactions.fromTeammateUnknown"), ne = m && /* @__PURE__ */ L(KN, {
31823
31941
  out: y,
31824
31942
  current: k?.emoji ?? "",
31825
31943
  currentBy: te || null,
@@ -31859,7 +31977,7 @@ function nP({ message: e, showSender: t, outboundLabel: n, quoted: r, onRetry: i
31859
31977
  }), /* @__PURE__ */ L(yx, {
31860
31978
  align: "start",
31861
31979
  className: "w-72 max-w-[calc(100vw-2rem)]",
31862
- children: /* @__PURE__ */ L(XN, {
31980
+ children: /* @__PURE__ */ L(ZN, {
31863
31981
  chatJid: w.chatJid,
31864
31982
  directory: s
31865
31983
  })
@@ -31875,32 +31993,32 @@ function nP({ message: e, showSender: t, outboundLabel: n, quoted: r, onRetry: i
31875
31993
  className: "mb-1 rounded-md border-l-4 border-primary bg-muted/70 px-2 py-1 text-xs",
31876
31994
  children: r ? /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("p", {
31877
31995
  className: "font-semibold text-primary",
31878
- children: QN(r, f, d)
31996
+ children: $N(r, f, d)
31879
31997
  }), /* @__PURE__ */ L("p", {
31880
31998
  className: "line-clamp-2 break-words text-muted-foreground",
31881
- children: $N(r, f)
31999
+ children: eP(r, f)
31882
32000
  })] }) : /* @__PURE__ */ L("p", {
31883
32001
  className: "italic text-muted-foreground",
31884
32002
  children: f("message.quotedMessage")
31885
32003
  })
31886
32004
  }),
31887
- x && /* @__PURE__ */ L(IN, {
32005
+ x && /* @__PURE__ */ L(LN, {
31888
32006
  safety: x,
31889
32007
  hasFile: b
31890
32008
  }),
31891
32009
  b && /* @__PURE__ */ L("div", {
31892
32010
  className: "mb-1",
31893
- children: x && (x.level === "high" || e.type === "document") ? /* @__PURE__ */ L(RN, {
32011
+ children: x && (x.level === "high" || e.type === "document") ? /* @__PURE__ */ L(zN, {
31894
32012
  message: e,
31895
32013
  safety: x
31896
- }) : /* @__PURE__ */ L(NN, {
32014
+ }) : /* @__PURE__ */ L(PN, {
31897
32015
  message: e,
31898
32016
  onLoad: o
31899
32017
  })
31900
32018
  }),
31901
- e.type === "audio" && /* @__PURE__ */ L(tP, { message: e }),
32019
+ e.type === "audio" && /* @__PURE__ */ L(nP, { message: e }),
31902
32020
  e.body && /* @__PURE__ */ L("p", {
31903
- className: U("whitespace-pre-wrap break-words text-[15px] leading-snug [overflow-wrap:anywhere]", ZN),
32021
+ className: U("whitespace-pre-wrap break-words text-[15px] leading-snug [overflow-wrap:anywhere]", QN),
31904
32022
  children: WC(e.body)
31905
32023
  }),
31906
32024
  /* @__PURE__ */ R("div", {
@@ -31949,7 +32067,7 @@ function nP({ message: e, showSender: t, outboundLabel: n, quoted: r, onRetry: i
31949
32067
  title: kl(e.timestamp),
31950
32068
  children: Dl(e.timestamp)
31951
32069
  }),
31952
- y && /* @__PURE__ */ L(eP, { status: e.status })
32070
+ y && /* @__PURE__ */ L(tP, { status: e.status })
31953
32071
  ]
31954
32072
  }),
31955
32073
  y && e.status === "failed" && /* @__PURE__ */ R("div", {
@@ -31969,7 +32087,7 @@ function nP({ message: e, showSender: t, outboundLabel: n, quoted: r, onRetry: i
31969
32087
  }), f(a ? "retrying" : "common:actions.retry")]
31970
32088
  })]
31971
32089
  }),
31972
- /* @__PURE__ */ L(HN, {
32090
+ /* @__PURE__ */ L(UN, {
31973
32091
  reactions: S,
31974
32092
  out: y,
31975
32093
  contactName: d,
@@ -31985,8 +32103,8 @@ function nP({ message: e, showSender: t, outboundLabel: n, quoted: r, onRetry: i
31985
32103
  });
31986
32104
  }
31987
32105
  // src/inbox/MessageList.tsx
31988
- var rP = 150;
31989
- function iP({ date: e }) {
32106
+ var iP = 150;
32107
+ function aP({ date: e }) {
31990
32108
  return P(), /* @__PURE__ */ L("div", {
31991
32109
  className: "sticky top-1 z-10 flex justify-center py-2",
31992
32110
  role: "separator",
@@ -31996,7 +32114,7 @@ function iP({ date: e }) {
31996
32114
  })
31997
32115
  });
31998
32116
  }
31999
- function aP({ items: e, messagesById: t, isGroup: n, directory: r, loading: i, hasOlder: a, loadingOlder: o, onLoadOlder: c, onRetry: l, retryingId: d, onReply: f, onReact: m, reactDisabledReason: _, contactName: v, footer: y }) {
32117
+ function oP({ items: e, messagesById: t, isGroup: n, directory: r, loading: i, hasOlder: a, loadingOlder: o, onLoadOlder: c, onRetry: l, retryingId: d, onReply: f, onReact: m, reactDisabledReason: _, contactName: v, footer: y }) {
32000
32118
  let { t: b } = P("inbox"), x = h(null), S = h(null), C = h(!0), w = h({
32001
32119
  height: 0,
32002
32120
  initialized: !1
@@ -32009,7 +32127,7 @@ function aP({ items: e, messagesById: t, isGroup: n, directory: r, loading: i, h
32009
32127
  }, []), O = s(() => {
32010
32128
  let e = x.current;
32011
32129
  if (!e) return;
32012
- let t = e.scrollHeight - e.scrollTop - e.clientHeight < rP;
32130
+ let t = e.scrollHeight - e.scrollTop - e.clientHeight < iP;
32013
32131
  C.current = t, E(!t);
32014
32132
  }, []);
32015
32133
  p(() => {
@@ -32084,18 +32202,18 @@ function aP({ items: e, messagesById: t, isGroup: n, directory: r, loading: i, h
32084
32202
  children: b("messageList.empty")
32085
32203
  }) : e.map((e) => {
32086
32204
  switch (e.kind) {
32087
- case "day": return /* @__PURE__ */ L(iP, { date: e.date }, e.key);
32088
- case "event": return /* @__PURE__ */ L(SN, {
32205
+ case "day": return /* @__PURE__ */ L(aP, { date: e.date }, e.key);
32206
+ case "event": return /* @__PURE__ */ L(CN, {
32089
32207
  event: e.event,
32090
32208
  directory: r
32091
32209
  }, e.key);
32092
- case "note": return /* @__PURE__ */ L(CN, {
32210
+ case "note": return /* @__PURE__ */ L(wN, {
32093
32211
  note: e.note,
32094
32212
  directory: r
32095
32213
  }, e.key);
32096
32214
  case "message": {
32097
32215
  let i = e.message, a = i.fromMe ? i.sentByUserId == null ? b("messageList.viaPhone") : r.nameOf(i.sentByUserId) : null;
32098
- return /* @__PURE__ */ L(nP, {
32216
+ return /* @__PURE__ */ L(rP, {
32099
32217
  message: i,
32100
32218
  showSender: n,
32101
32219
  outboundLabel: a,
@@ -32128,7 +32246,7 @@ function aP({ items: e, messagesById: t, isGroup: n, directory: r, loading: i, h
32128
32246
  });
32129
32247
  }
32130
32248
  // src/inbox/NotesPanel.tsx
32131
- function oP({ jid: e, notes: t, loading: n, directory: r, onClose: i, title: a, description: o }) {
32249
+ function sP({ jid: e, notes: t, loading: n, directory: r, onClose: i, title: a, description: o }) {
32132
32250
  let { t: s } = P("inbox"), [c, l] = g(""), u = xs(e);
32133
32251
  function d(e) {
32134
32252
  e.preventDefault();
@@ -32140,7 +32258,7 @@ function oP({ jid: e, notes: t, loading: n, directory: r, onClose: i, title: a,
32140
32258
  }
32141
32259
  let f = [...t].sort((e, t) => t.createdAt - e.createdAt);
32142
32260
  return /* @__PURE__ */ R(I, { children: [
32143
- /* @__PURE__ */ L(YM, {
32261
+ /* @__PURE__ */ L(XM, {
32144
32262
  icon: /* @__PURE__ */ L(Lr, {
32145
32263
  className: "size-4 shrink-0 text-note-foreground",
32146
32264
  "aria-hidden": "true"
@@ -32203,12 +32321,12 @@ function oP({ jid: e, notes: t, loading: n, directory: r, onClose: i, title: a,
32203
32321
  })
32204
32322
  ] });
32205
32323
  }
32206
- function sP({ open: e, onClose: t, ...n }) {
32324
+ function cP({ open: e, onClose: t, ...n }) {
32207
32325
  let { t: r } = P("inbox"), i = Dc("(min-width: 1024px)"), a = h(null);
32208
32326
  return i ? e ? /* @__PURE__ */ L("aside", {
32209
32327
  "aria-label": r("notes.title"),
32210
32328
  className: "flex w-80 shrink-0 flex-col border-l bg-surface",
32211
- children: /* @__PURE__ */ L(oP, {
32329
+ children: /* @__PURE__ */ L(sP, {
32212
32330
  ...n,
32213
32331
  onClose: t,
32214
32332
  title: /* @__PURE__ */ L("h3", { children: r("notes.title") }),
@@ -32225,7 +32343,7 @@ function sP({ open: e, onClose: t, ...n }) {
32225
32343
  onOpenAutoFocus: (e) => {
32226
32344
  e.preventDefault(), a.current?.focus();
32227
32345
  },
32228
- children: /* @__PURE__ */ L(oP, {
32346
+ children: /* @__PURE__ */ L(sP, {
32229
32347
  ...n,
32230
32348
  onClose: t,
32231
32349
  title: /* @__PURE__ */ L(Gy, {
@@ -32242,24 +32360,24 @@ function sP({ open: e, onClose: t, ...n }) {
32242
32360
  })
32243
32361
  });
32244
32362
  }
32245
- function cP(e, t) {
32363
+ function lP(e, t) {
32246
32364
  return e.isMe ? t("groupInfo.you") : e.name ?? (e.phone ? `+${e.phone}` : e.lid ?? e.jid);
32247
32365
  }
32248
- function lP(e, t) {
32366
+ function uP(e, t) {
32249
32367
  return e.username ? { text: `@${e.username}` } : e.phone ? { text: e.name || e.isMe ? `+${e.phone}` : t("groupInfo.noName") } : {
32250
32368
  text: t("groupInfo.hiddenNumber"),
32251
32369
  hidden: !0
32252
32370
  };
32253
32371
  }
32254
- var uP = (e) => [
32372
+ var dP = (e) => [
32255
32373
  e.name,
32256
32374
  e.phone,
32257
32375
  e.phone && `+${e.phone}`,
32258
32376
  e.username,
32259
32377
  e.lid
32260
32378
  ].filter(Boolean).join(" ").toLowerCase();
32261
- function dP({ groupJid: e, member: t, onOpen: n }) {
32262
- let { t: r } = P("inbox"), i = cP(t, r), a = lP(t, r), o = !t.name && !t.phone && !t.isMe;
32379
+ function fP({ groupJid: e, member: t, onOpen: n }) {
32380
+ let { t: r } = P("inbox"), i = lP(t, r), a = uP(t, r), o = !t.name && !t.phone && !t.isMe;
32263
32381
  return /* @__PURE__ */ L("li", { children: /* @__PURE__ */ R(W, {
32264
32382
  type: "button",
32265
32383
  variant: "ghost",
@@ -32290,8 +32408,8 @@ function dP({ groupJid: e, member: t, onOpen: n }) {
32290
32408
  ]
32291
32409
  }) });
32292
32410
  }
32293
- function fP({ data: e, onOpen: t, isAdmin: n }) {
32294
- let { t: r } = P("inbox"), [i, a] = g(""), [o, s] = g(!1), [c, u] = g(100), d = l(i.trim().toLowerCase()), f = m(() => e.members.map((e) => [e, uP(e)]), [e.members]), p = m(() => f.filter(([, e]) => !d || e.includes(d)).map(([e]) => e), [f, d]), h = m(() => o ? p.filter((e) => e.role !== "member") : p, [p, o]), { group: _ } = e, v = _.createdBy ? _.createdBy.name ?? (_.createdBy.phone ? `+${_.createdBy.phone}` : null) : null;
32411
+ function pP({ data: e, onOpen: t, isAdmin: n }) {
32412
+ let { t: r } = P("inbox"), [i, a] = g(""), [o, s] = g(!1), [c, u] = g(100), d = l(i.trim().toLowerCase()), f = m(() => e.members.map((e) => [e, dP(e)]), [e.members]), p = m(() => f.filter(([, e]) => !d || e.includes(d)).map(([e]) => e), [f, d]), h = m(() => o ? p.filter((e) => e.role !== "member") : p, [p, o]), { group: _ } = e, v = _.createdBy ? _.createdBy.name ?? (_.createdBy.phone ? `+${_.createdBy.phone}` : null) : null;
32295
32413
  return /* @__PURE__ */ R(I, { children: [
32296
32414
  /* @__PURE__ */ R("div", {
32297
32415
  className: "space-y-0.5 px-4 pt-3 pb-1",
@@ -32318,7 +32436,7 @@ function fP({ data: e, onOpen: t, isAdmin: n }) {
32318
32436
  })
32319
32437
  ]
32320
32438
  }),
32321
- /* @__PURE__ */ L(gN, {
32439
+ /* @__PURE__ */ L(_N, {
32322
32440
  jid: _.jid,
32323
32441
  isAdmin: n
32324
32442
  }),
@@ -32376,7 +32494,7 @@ function fP({ data: e, onOpen: t, isAdmin: n }) {
32376
32494
  children: r("groupInfo.none")
32377
32495
  }) : /* @__PURE__ */ L("ul", {
32378
32496
  "aria-label": r("groupInfo.listLabel"),
32379
- children: h.slice(0, c).map((e) => /* @__PURE__ */ L(dP, {
32497
+ children: h.slice(0, c).map((e) => /* @__PURE__ */ L(fP, {
32380
32498
  groupJid: _.jid,
32381
32499
  member: e,
32382
32500
  onOpen: () => t(e)
@@ -32411,8 +32529,8 @@ function fP({ data: e, onOpen: t, isAdmin: n }) {
32411
32529
  })
32412
32530
  ] });
32413
32531
  }
32414
- function pP({ groupJid: e, member: t, onBack: n, onOpenChat: r }) {
32415
- let { t: i } = P("inbox"), a = Cs(e, t.isMe ? null : t.lid ?? t.jid), o = ws(e), [s, c] = g(!1), l = cP(t, i), u = !t.name && !t.phone && !t.isMe, d = [[i("groupInfo.phone"), t.phone ? `+${t.phone}` : /* @__PURE__ */ L("i", { children: i("groupInfo.hiddenNumber") }, "h")]];
32532
+ function mP({ groupJid: e, member: t, onBack: n, onOpenChat: r }) {
32533
+ let { t: i } = P("inbox"), a = Cs(e, t.isMe ? null : t.lid ?? t.jid), o = ws(e), [s, c] = g(!1), l = lP(t, i), u = !t.name && !t.phone && !t.isMe, d = [[i("groupInfo.phone"), t.phone ? `+${t.phone}` : /* @__PURE__ */ L("i", { children: i("groupInfo.hiddenNumber") }, "h")]];
32416
32534
  t.lid && d.push([i("groupInfo.lid"), /* @__PURE__ */ L("span", {
32417
32535
  className: "font-mono text-xs",
32418
32536
  children: t.lid
@@ -32536,9 +32654,9 @@ function pP({ groupJid: e, member: t, onBack: n, onOpenChat: r }) {
32536
32654
  ]
32537
32655
  });
32538
32656
  }
32539
- function mP({ jid: e, open: t, onClose: n, title: r, description: i, isAdmin: a = !1 }) {
32657
+ function hP({ jid: e, open: t, onClose: n, title: r, description: i, isAdmin: a = !1 }) {
32540
32658
  let { t: o } = P("inbox"), s = ie(), c = Ss(e, t), [l, u] = g(null), d = l ? c.data?.members.find((e) => e.jid === l) : void 0;
32541
- return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L(YM, {
32659
+ return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L(XM, {
32542
32660
  icon: /* @__PURE__ */ L(ra, {
32543
32661
  className: "size-4 shrink-0 text-muted-foreground",
32544
32662
  "aria-hidden": "true"
@@ -32568,25 +32686,25 @@ function mP({ jid: e, open: t, onClose: n, title: r, description: i, isAdmin: a
32568
32686
  onClick: () => void c.refetch(),
32569
32687
  children: o("groupInfo.retry")
32570
32688
  })]
32571
- }) : d ? /* @__PURE__ */ L(pP, {
32689
+ }) : d ? /* @__PURE__ */ L(mP, {
32572
32690
  groupJid: e,
32573
32691
  member: d,
32574
32692
  onBack: () => u(null),
32575
32693
  onOpenChat: (e) => {
32576
32694
  n(), s(`/chats/${gC(e)}`);
32577
32695
  }
32578
- }, d.jid) : /* @__PURE__ */ L(fP, {
32696
+ }, d.jid) : /* @__PURE__ */ L(pP, {
32579
32697
  data: c.data,
32580
32698
  isAdmin: a,
32581
32699
  onOpen: (e) => u(e.jid)
32582
32700
  })] });
32583
32701
  }
32584
- function hP({ jid: e, open: t, onClose: n, isAdmin: r = !1 }) {
32702
+ function gP({ jid: e, open: t, onClose: n, isAdmin: r = !1 }) {
32585
32703
  let { t: i } = P("inbox"), a = Dc("(min-width: 1024px)"), o = h(null);
32586
32704
  return a ? t ? /* @__PURE__ */ L("aside", {
32587
32705
  "aria-label": i("groupInfo.title"),
32588
32706
  className: "flex w-80 shrink-0 flex-col border-l bg-surface",
32589
- children: /* @__PURE__ */ L(mP, {
32707
+ children: /* @__PURE__ */ L(hP, {
32590
32708
  jid: e,
32591
32709
  open: t,
32592
32710
  onClose: n,
@@ -32605,7 +32723,7 @@ function hP({ jid: e, open: t, onClose: n, isAdmin: r = !1 }) {
32605
32723
  onOpenAutoFocus: (e) => {
32606
32724
  e.preventDefault(), o.current?.focus();
32607
32725
  },
32608
- children: /* @__PURE__ */ L(mP, {
32726
+ children: /* @__PURE__ */ L(hP, {
32609
32727
  jid: e,
32610
32728
  open: t,
32611
32729
  onClose: n,
@@ -32625,19 +32743,19 @@ function hP({ jid: e, open: t, onClose: n, isAdmin: r = !1 }) {
32625
32743
  });
32626
32744
  }
32627
32745
  // src/inbox/timeline.ts
32628
- var gP = {
32746
+ var _P = {
32629
32747
  event: 0,
32630
32748
  message: 1,
32631
32749
  note: 2
32632
32750
  };
32633
- function _P(e) {
32751
+ function vP(e) {
32634
32752
  let t = new Date(e);
32635
32753
  return t.setHours(0, 0, 0, 0), t.getTime();
32636
32754
  }
32637
- function vP(e) {
32755
+ function yP(e) {
32638
32756
  return e.kind === "message" ? e.message.id : e.kind === "event" ? String(e.event.id).padStart(12, "0") : String(e.note.id).padStart(12, "0");
32639
32757
  }
32640
- function yP(e, t, n) {
32758
+ function bP(e, t, n) {
32641
32759
  let r = [
32642
32760
  ...e.map((e) => ({
32643
32761
  kind: "message",
@@ -32658,12 +32776,12 @@ function yP(e, t, n) {
32658
32776
  note: e
32659
32777
  }))
32660
32778
  ];
32661
- r.sort((e, t) => e.at - t.at || gP[e.kind] - gP[t.kind] || (vP(e) < vP(t) ? -1 : +(vP(e) > vP(t))));
32779
+ r.sort((e, t) => e.at - t.at || _P[e.kind] - _P[t.kind] || (yP(e) < yP(t) ? -1 : +(yP(e) > yP(t))));
32662
32780
  let i = [], a = /* @__PURE__ */ new Set(), o = null;
32663
32781
  for (let e of r) {
32664
32782
  if (a.has(e.key)) continue;
32665
32783
  a.add(e.key);
32666
- let t = _P(e.at);
32784
+ let t = vP(e.at);
32667
32785
  t !== o && (i.push({
32668
32786
  kind: "day",
32669
32787
  key: `d:${t}`,
@@ -32673,11 +32791,11 @@ function yP(e, t, n) {
32673
32791
  return i;
32674
32792
  }
32675
32793
  // src/inbox/assistant-started.ts
32676
- function bP(e, t, n) {
32794
+ function xP(e, t, n) {
32677
32795
  return e.type === "dm" && !n && t.length > 0 && t.every((e) => e.fromMe) && t.some((e) => e.viaAssistant === !0);
32678
32796
  }
32679
32797
  // src/inbox/TypingIndicator.tsx
32680
- function xP({ entries: e, meId: t }) {
32798
+ function SP({ entries: e, meId: t }) {
32681
32799
  let { t: n } = P("inbox"), r = e.filter((e) => e.userId !== t);
32682
32800
  if (r.length === 0) return null;
32683
32801
  let i = r.map((e) => e.displayName), a = i.length === 1 ? n("typing.one", { name: i[0] }) : i.length === 2 ? n("typing.two", {
@@ -32702,13 +32820,13 @@ function xP({ entries: e, meId: t }) {
32702
32820
  });
32703
32821
  }
32704
32822
  // src/inbox/WaBanner.tsx
32705
- function SP(e) {
32823
+ function CP(e) {
32706
32824
  return e === "disconnected" || e === "connecting";
32707
32825
  }
32708
- function CP(e) {
32826
+ function wP(e) {
32709
32827
  return e === "qr" || e === "logged_out" || e === "replaced" || e === "blocked";
32710
32828
  }
32711
- var wP = {
32829
+ var TP = {
32712
32830
  connecting: {
32713
32831
  tone: "info",
32714
32832
  titleKey: "waBanner.connecting.title",
@@ -32746,8 +32864,8 @@ var wP = {
32746
32864
  bodyKey: "waBanner.blocked.body"
32747
32865
  }
32748
32866
  };
32749
- function TP({ state: e, name: t, settingsPath: n }) {
32750
- let { t: r } = P("inbox"), { isAdmin: i } = Sl(), a = wP[e], o = r(n === "/admin/inboxes" ? "waBanner.openInboxes" : "waBanner.openSettings");
32867
+ function EP({ state: e, name: t, settingsPath: n }) {
32868
+ let { t: r } = P("inbox"), { isAdmin: i } = Sl(), a = TP[e], o = r(n === "/admin/inboxes" ? "waBanner.openInboxes" : "waBanner.openSettings");
32751
32869
  return /* @__PURE__ */ L(q, {
32752
32870
  tone: a.tone,
32753
32871
  title: t === void 0 ? r(a.titleKey) : r(a.inboxTitleKey, { name: t }),
@@ -32771,17 +32889,17 @@ function TP({ state: e, name: t, settingsPath: n }) {
32771
32889
  children: r(a.bodyKey)
32772
32890
  });
32773
32891
  }
32774
- function EP() {
32775
- let e = zs(), t = Wj(), n = t.length === 1 ? t[0] : void 0, r = (e.data?.maxInboxes ?? 1) > 1, i = Ls({ enabled: e.isError || t.some((e) => e.id === 1) || e.data != null && t.length === 0 && !r });
32892
+ function DP() {
32893
+ let e = zs(), t = Gj(), n = t.length === 1 ? t[0] : void 0, r = (e.data?.maxInboxes ?? 1) > 1, i = Ls({ enabled: e.isError || t.some((e) => e.id === 1) || e.data != null && t.length === 0 && !r });
32776
32894
  if (e.isPending) return null;
32777
32895
  if (t.length > 1) {
32778
32896
  let e = t.map((e) => ({
32779
32897
  inbox: e,
32780
- state: DP(e, i.data)
32898
+ state: OP(e, i.data)
32781
32899
  })).filter((e) => !!(e.state && e.state !== "open"));
32782
32900
  return e.length === 0 ? null : /* @__PURE__ */ L("div", {
32783
32901
  className: "space-y-2 border-b bg-surface px-3 py-2",
32784
- children: e.map(({ inbox: e, state: t }) => /* @__PURE__ */ L(TP, {
32902
+ children: e.map(({ inbox: e, state: t }) => /* @__PURE__ */ L(EP, {
32785
32903
  state: t,
32786
32904
  name: e.name,
32787
32905
  settingsPath: "/admin/inboxes"
@@ -32792,40 +32910,40 @@ function EP() {
32792
32910
  let a = n && n.id !== 1 ? n : void 0, o = a ? a.status.state : i.data?.state;
32793
32911
  return !o || o === "open" ? null : /* @__PURE__ */ L("div", {
32794
32912
  className: "border-b bg-surface px-3 py-2",
32795
- children: a ? /* @__PURE__ */ L(TP, {
32913
+ children: a ? /* @__PURE__ */ L(EP, {
32796
32914
  state: o,
32797
32915
  name: a.name,
32798
32916
  settingsPath: "/admin/inboxes"
32799
- }) : /* @__PURE__ */ L(TP, {
32917
+ }) : /* @__PURE__ */ L(EP, {
32800
32918
  state: o,
32801
32919
  settingsPath: "/admin/whatsapp"
32802
32920
  })
32803
32921
  });
32804
32922
  }
32805
- function DP(e, t) {
32923
+ function OP(e, t) {
32806
32924
  return e.id === 1 ? t?.state ?? e.status.state : e.status.state;
32807
32925
  }
32808
32926
  // src/api/templates.ts
32809
- var OP = encodeURIComponent, kP = (e) => ["templates", e];
32810
- function AP(e, t) {
32927
+ var kP = encodeURIComponent, AP = (e) => ["templates", e];
32928
+ function jP(e, t) {
32811
32929
  return w({
32812
- queryKey: kP(e),
32930
+ queryKey: AP(e),
32813
32931
  queryFn: ({ signal: t }) => B(`/inboxes/${e}/templates`, { signal: t }),
32814
32932
  enabled: t,
32815
32933
  staleTime: 6e4
32816
32934
  });
32817
32935
  }
32818
- function jP(e) {
32936
+ function MP(e) {
32819
32937
  let t = T();
32820
32938
  return S({
32821
32939
  mutationFn: () => B(`/inboxes/${e}/templates?refresh=1`),
32822
- onSuccess: (n) => t.setQueryData(kP(e), n)
32940
+ onSuccess: (n) => t.setQueryData(AP(e), n)
32823
32941
  });
32824
32942
  }
32825
- function MP(e) {
32943
+ function NP(e) {
32826
32944
  let t = T();
32827
32945
  return S({
32828
- mutationFn: (t) => B(`/chats/${OP(e)}/template`, {
32946
+ mutationFn: (t) => B(`/chats/${kP(e)}/template`, {
32829
32947
  method: "POST",
32830
32948
  body: t
32831
32949
  }),
@@ -32835,8 +32953,8 @@ function MP(e) {
32835
32953
  });
32836
32954
  }
32837
32955
  // src/inbox/ReplyWindow.tsx
32838
- var NP = "https://business.facebook.com/wa/manage/message-templates/";
32839
- function PP({ lastInboundAt: e, windowHours: t }) {
32956
+ var PP = "https://business.facebook.com/wa/manage/message-templates/";
32957
+ function FP({ lastInboundAt: e, windowHours: t }) {
32840
32958
  let { t: n } = P("inbox"), r = eD(e, t, nD()) ?? 0;
32841
32959
  if (r <= 0) return null;
32842
32960
  let i = Math.max(1, Math.ceil(r / 6e4)), a = Math.floor(i / 60), o = tD(r);
@@ -32854,7 +32972,7 @@ function PP({ lastInboundAt: e, windowHours: t }) {
32854
32972
  }) : n("window.leftMinutes", { minutes: i })]
32855
32973
  });
32856
32974
  }
32857
- function FP({ jid: e, inboxId: t, customerName: n, disabled: r }) {
32975
+ function IP({ jid: e, inboxId: t, customerName: n, disabled: r }) {
32858
32976
  let { t: i } = P("inbox"), [a, o] = g(!1);
32859
32977
  return /* @__PURE__ */ R("div", {
32860
32978
  className: "px-2 py-2 sm:px-3",
@@ -32873,7 +32991,7 @@ function FP({ jid: e, inboxId: t, customerName: n, disabled: r }) {
32873
32991
  children: [/* @__PURE__ */ L(br, { "aria-hidden": "true" }), i("window.sendTemplate")]
32874
32992
  })]
32875
32993
  })
32876
- }), /* @__PURE__ */ L(zP, {
32994
+ }), /* @__PURE__ */ L(BP, {
32877
32995
  open: a,
32878
32996
  jid: e,
32879
32997
  inboxId: t,
@@ -32882,20 +33000,20 @@ function FP({ jid: e, inboxId: t, customerName: n, disabled: r }) {
32882
33000
  })]
32883
33001
  });
32884
33002
  }
32885
- var IP = (e) => `${e.name}:${e.language}`;
32886
- function LP(e, t) {
33003
+ var LP = (e) => `${e.name}:${e.language}`;
33004
+ function RP(e, t) {
32887
33005
  return e.replace(/\{\{(\d+)\}\}/g, (e, n) => t[Number(n) - 1]?.trim() || e);
32888
33006
  }
32889
- function RP(e) {
33007
+ function zP(e) {
32890
33008
  return e.header && e.header !== "text" ? e.header : e.buttons ? "buttons" : "other";
32891
33009
  }
32892
- function zP({ open: e, jid: t, inboxId: n, customerName: r, onClose: i }) {
32893
- let { t: a } = P(["inbox", "common"]), o = AP(n, e), s = jP(n), c = MP(t), [l, d] = g(null), [f, p] = g([]), [m, h] = g(!1), [_, v] = g("");
33010
+ function BP({ open: e, jid: t, inboxId: n, customerName: r, onClose: i }) {
33011
+ let { t: a } = P(["inbox", "common"]), o = jP(n, e), s = MP(n), c = NP(t), [l, d] = g(null), [f, p] = g([]), [m, h] = g(!1), [_, v] = g("");
32894
33012
  u(() => {
32895
33013
  e && (d(null), p([]), h(!1), c.reset());
32896
33014
  }, [e]);
32897
- let y = o.data?.templates ?? [], b = y.find((e) => IP(e) === l) ?? null, x = f.some((e) => !e.trim()), S = (e) => {
32898
- d(IP(e)), h(!1), v(Zo()), c.reset();
33015
+ let y = o.data?.templates ?? [], b = y.find((e) => LP(e) === l) ?? null, x = f.some((e) => !e.trim()), S = (e) => {
33016
+ d(LP(e)), h(!1), v(Zo()), c.reset();
32899
33017
  let t = r.trim().split(/\s+/)[0] ?? "";
32900
33018
  p(Array.from({ length: e.variables }, (e, n) => n === 0 ? t : ""));
32901
33019
  }, C = /* @__PURE__ */ R(W, {
@@ -32943,7 +33061,7 @@ function zP({ open: e, jid: t, inboxId: n, customerName: r, onClose: i }) {
32943
33061
  size: "touch",
32944
33062
  className: "md:min-h-9",
32945
33063
  children: /* @__PURE__ */ R("a", {
32946
- href: NP,
33064
+ href: PP,
32947
33065
  target: "_blank",
32948
33066
  rel: "noopener noreferrer",
32949
33067
  children: [/* @__PURE__ */ L(_r, { "aria-hidden": "true" }), a("window.manage")]
@@ -32978,7 +33096,7 @@ function zP({ open: e, jid: t, inboxId: n, customerName: r, onClose: i }) {
32978
33096
  children: a("window.choose")
32979
33097
  }), C]
32980
33098
  }), y.map((e) => {
32981
- let t = IP(e), n = t === l;
33099
+ let t = LP(e), n = t === l;
32982
33100
  return /* @__PURE__ */ R(W, {
32983
33101
  type: "button",
32984
33102
  variant: "outline",
@@ -33010,7 +33128,7 @@ function zP({ open: e, jid: t, inboxId: n, customerName: r, onClose: i }) {
33010
33128
  }),
33011
33129
  !e.sendable && /* @__PURE__ */ L("span", {
33012
33130
  className: "text-xs font-medium text-muted-foreground",
33013
- children: a(`window.unsupported.${RP(e)}`)
33131
+ children: a(`window.unsupported.${zP(e)}`)
33014
33132
  })
33015
33133
  ]
33016
33134
  }, t);
@@ -33059,7 +33177,7 @@ function zP({ open: e, jid: t, inboxId: n, customerName: r, onClose: i }) {
33059
33177
  /* @__PURE__ */ L("p", {
33060
33178
  className: "min-w-0 rounded-lg border bg-muted/40 px-3 py-2 text-sm break-words whitespace-pre-wrap",
33061
33179
  "data-testid": "template-preview",
33062
- children: LP(b.body, f)
33180
+ children: RP(b.body, f)
33063
33181
  }),
33064
33182
  b.category === "marketing" && /* @__PURE__ */ L("p", {
33065
33183
  className: "text-xs text-muted-foreground",
@@ -33098,16 +33216,16 @@ function zP({ open: e, jid: t, inboxId: n, customerName: r, onClose: i }) {
33098
33216
  });
33099
33217
  }
33100
33218
  // src/inbox/Conversation.tsx
33101
- function BP(e) {
33219
+ function VP(e) {
33102
33220
  z.error(e instanceof Error ? e.message : N.t("inbox:conversation.updateFailed"));
33103
33221
  }
33104
- var VP = /* @__PURE__ */ new Set(), HP = [];
33105
- function UP({ jid: e, directory: t, onBack: n }) {
33106
- let { t: r } = P(["inbox", "common"]), i = Dc("(min-width: 640px)"), a = T(), o = cs(e), c = fs(e), l = bs(e), d = Os(), f = Gj(), p = ms(e), _ = hs(e), [v, y] = g(null);
33222
+ var HP = /* @__PURE__ */ new Set(), UP = [];
33223
+ function WP({ jid: e, directory: t, onBack: n }) {
33224
+ let { t: r } = P(["inbox", "common"]), i = Dc("(min-width: 640px)"), a = T(), o = cs(e), c = fs(e), l = bs(e), d = Os(), f = Kj(), p = ms(e), _ = hs(e), [v, y] = g(null);
33107
33225
  u(() => y(null), [e]);
33108
33226
  let b = gs(), { mutate: x } = _s(), S = ys(e), C = vs(e), { typing: w, emitTyping: E } = wc(), [D] = ae(), [O, k] = g(!1), [ee, A] = g(() => D.get("customer") === "1"), [te, ne] = g(!1), re = ZC(), ie = (e) => re.current ? re.current(e) : e(), [j, oe] = g(null), [se, ce] = g(null), M = o.data?.chat, le = Vs(M?.inboxId)?.state, ue = rD(), de = M ? ue(M.inboxId) : null, fe = oD(M?.lastInboundAt, de), [pe, me] = g(null), he = fe === !0 || pe !== null && pe.jid === e && pe.lastInboundAt === (M?.lastInboundAt ?? null), ge = Ss(e, M?.type === "group"), _e = iD(), ve = ge.isError, ye = ge.refetch, be = s(() => {
33109
33227
  ve && ye();
33110
- }, [ve, ye]), xe = gc(M?.type === "group" ? e : null), Se = o.data?.events, Ce = t.me, we = AO().data?.state ?? "off", Te = VO(), Ee = UO(Te.data?.spelling === "on"), De = m(() => Qt(Ee.data?.words ?? [], Ee.data?.businessWords ?? []), [Ee.data]), Oe = MO(e, we === "on" && M?.type === "dm"), ke = m(() => ps(c.data), [c.data]), Ae = m(() => new Map(ke.map((e) => [e.id, e])), [ke]), je = l.data, Me = m(() => yP(ke, Se ?? [], je ?? []), [
33228
+ }, [ve, ye]), xe = gc(M?.type === "group" ? e : null), Se = o.data?.events, Ce = t.me, we = AO().data?.state ?? "off", Te = VO(), Ee = UO(Te.data?.spelling === "on"), De = m(() => Qt(Ee.data?.words ?? [], Ee.data?.businessWords ?? []), [Ee.data]), Oe = MO(e, we === "on" && M?.type === "dm"), ke = m(() => ps(c.data), [c.data]), Ae = m(() => new Map(ke.map((e) => [e.id, e])), [ke]), je = l.data, Me = m(() => bP(ke, Se ?? [], je ?? []), [
33111
33229
  ke,
33112
33230
  Se,
33113
33231
  je
@@ -33136,7 +33254,7 @@ function UP({ jid: e, directory: t, onBack: n }) {
33136
33254
  Le
33137
33255
  ]);
33138
33256
  let Re = s(() => {
33139
- if (!M || M.assignedTo == null || M.assignedTo === Ce?.id || VP.has(e)) return !0;
33257
+ if (!M || M.assignedTo == null || M.assignedTo === Ce?.id || HP.has(e)) return !0;
33140
33258
  let n = t.nameOf(M.assignedTo) ?? r("conversation.someoneElse");
33141
33259
  return new Promise((e) => oe({
33142
33260
  name: n,
@@ -33150,7 +33268,7 @@ function UP({ jid: e, directory: t, onBack: n }) {
33150
33268
  r
33151
33269
  ]);
33152
33270
  function ze(t) {
33153
- t && VP.add(e), j?.resolve(t), oe(null);
33271
+ t && HP.add(e), j?.resolve(t), oe(null);
33154
33272
  }
33155
33273
  function Be(t) {
33156
33274
  ce(t.id), b.mutate(t.id, {
@@ -33234,7 +33352,7 @@ function UP({ jid: e, directory: t, onBack: n }) {
33234
33352
  })
33235
33353
  });
33236
33354
  }
33237
- let qe = CP(le), Je = SP(le), Ye = M.type === "dm" ? kC(M, r) : void 0, Xe = bP(M, ke, !!Ue);
33355
+ let qe = wP(le), Je = CP(le), Ye = M.type === "dm" ? kC(M, r) : void 0, Xe = xP(M, ke, !!Ue);
33238
33356
  return /* @__PURE__ */ R("div", {
33239
33357
  className: "flex min-h-0 min-w-0 flex-1",
33240
33358
  children: [
@@ -33244,14 +33362,14 @@ function UP({ jid: e, directory: t, onBack: n }) {
33244
33362
  enabled: !qe && !he,
33245
33363
  onFiles: (e) => Fe.current?.addFiles(e),
33246
33364
  children: [
33247
- /* @__PURE__ */ L(yN, {
33365
+ /* @__PURE__ */ L(bN, {
33248
33366
  chat: M,
33249
33367
  directory: t,
33250
33368
  inbox: f(M.inboxId),
33251
33369
  onBack: n,
33252
33370
  busy: C.isPending,
33253
- onAssign: (e) => C.mutate({ assignedTo: e }, { onError: BP }),
33254
- onToggleStatus: () => C.mutate({ status: M.status === "resolved" ? "open" : "resolved" }, { onError: BP }),
33371
+ onAssign: (e) => C.mutate({ assignedTo: e }, { onError: VP }),
33372
+ onToggleStatus: () => C.mutate({ status: M.status === "resolved" ? "open" : "resolved" }, { onError: VP }),
33255
33373
  notesOpen: O,
33256
33374
  notesCount: je?.length ?? 0,
33257
33375
  onToggleNotes: () => ie(() => {
@@ -33269,7 +33387,7 @@ function UP({ jid: e, directory: t, onBack: n }) {
33269
33387
  M.type === "group" ? (ne(!0), k(!1)) : (A(!0), k(!1));
33270
33388
  }
33271
33389
  }),
33272
- /* @__PURE__ */ L(zN, { jid: e }),
33390
+ /* @__PURE__ */ L(BN, { jid: e }),
33273
33391
  Xe && /* @__PURE__ */ L(q, {
33274
33392
  tone: "warning",
33275
33393
  title: r("conversation.startedByAssistantTitle"),
@@ -33279,7 +33397,7 @@ function UP({ jid: e, directory: t, onBack: n }) {
33279
33397
  children: r("conversation.startedByAssistantBody")
33280
33398
  })
33281
33399
  }),
33282
- /* @__PURE__ */ L(aP, {
33400
+ /* @__PURE__ */ L(oP, {
33283
33401
  items: Me,
33284
33402
  messagesById: Ae,
33285
33403
  isGroup: M.type === "group",
@@ -33298,7 +33416,7 @@ function UP({ jid: e, directory: t, onBack: n }) {
33298
33416
  /* @__PURE__ */ R("div", {
33299
33417
  className: "safe-bottom border-t bg-surface",
33300
33418
  children: [
33301
- /* @__PURE__ */ L(xP, {
33419
+ /* @__PURE__ */ L(SP, {
33302
33420
  entries: w[e] ?? [],
33303
33421
  meId: Ce?.id ?? null
33304
33422
  }),
@@ -33307,18 +33425,18 @@ function UP({ jid: e, directory: t, onBack: n }) {
33307
33425
  role: "status",
33308
33426
  children: r(qe ? "conversation.sendingBlocked" : "conversation.reconnecting")
33309
33427
  }),
33310
- de !== null && !he && /* @__PURE__ */ L(PP, {
33428
+ de !== null && !he && /* @__PURE__ */ L(FP, {
33311
33429
  lastInboundAt: M.lastInboundAt ?? null,
33312
33430
  windowHours: de
33313
33431
  }),
33314
- he ? /* @__PURE__ */ L(FP, {
33432
+ he ? /* @__PURE__ */ L(IP, {
33315
33433
  jid: e,
33316
33434
  inboxId: M.inboxId,
33317
33435
  customerName: kC(M, r),
33318
33436
  disabled: qe
33319
33437
  }) : /* @__PURE__ */ L("div", {
33320
33438
  className: "px-2 py-2 sm:px-3",
33321
- children: /* @__PURE__ */ L(KM, {
33439
+ children: /* @__PURE__ */ L(qM, {
33322
33440
  ref: Fe,
33323
33441
  quickReplies: d.data ?? [],
33324
33442
  disabled: qe,
@@ -33327,8 +33445,8 @@ function UP({ jid: e, directory: t, onBack: n }) {
33327
33445
  onTyping: () => E(e),
33328
33446
  replyTo: v ? {
33329
33447
  id: v.id,
33330
- author: QN(v, r, Ye),
33331
- preview: $N(v, r)
33448
+ author: $N(v, r, Ye),
33449
+ preview: eP(v, r)
33332
33450
  } : null,
33333
33451
  onCancelReply: () => y(null),
33334
33452
  askEzy: M.type === "dm" ? {
@@ -33340,7 +33458,7 @@ function UP({ jid: e, directory: t, onBack: n }) {
33340
33458
  lastCustomerMessageId: Ne,
33341
33459
  isAdmin: Ce?.role === "admin",
33342
33460
  state: we,
33343
- phrases: Oe.data?.phrases ?? HP
33461
+ phrases: Oe.data?.phrases ?? UP
33344
33462
  } : null,
33345
33463
  fixEnglish: {
33346
33464
  chatJid: M.jid,
@@ -33398,7 +33516,7 @@ function UP({ jid: e, directory: t, onBack: n }) {
33398
33516
  })
33399
33517
  ]
33400
33518
  }),
33401
- /* @__PURE__ */ L(sP, {
33519
+ /* @__PURE__ */ L(cP, {
33402
33520
  jid: e,
33403
33521
  open: O,
33404
33522
  notes: je ?? [],
@@ -33406,13 +33524,13 @@ function UP({ jid: e, directory: t, onBack: n }) {
33406
33524
  directory: t,
33407
33525
  onClose: () => k(!1)
33408
33526
  }),
33409
- M.type === "group" && /* @__PURE__ */ L(hP, {
33527
+ M.type === "group" && /* @__PURE__ */ L(gP, {
33410
33528
  jid: e,
33411
33529
  open: te,
33412
33530
  isAdmin: Ce?.role === "admin",
33413
33531
  onClose: () => ne(!1)
33414
33532
  }),
33415
- M.type === "dm" && /* @__PURE__ */ L(mN, {
33533
+ M.type === "dm" && /* @__PURE__ */ L(hN, {
33416
33534
  jid: e,
33417
33535
  open: ee,
33418
33536
  directory: t,
@@ -33441,11 +33559,11 @@ function UP({ jid: e, directory: t, onBack: n }) {
33441
33559
  });
33442
33560
  }
33443
33561
  // src/inbox/useDirectory.ts
33444
- function WP(e, t, n = !1) {
33562
+ function GP(e, t, n = !1) {
33445
33563
  return e.role === "admin" || e.kind === "ai" ? !0 : e.inboxIds == null ? !n : e.inboxIds === "all" || e.inboxIds.includes(t);
33446
33564
  }
33447
- function GP(e, t, n, r = {}) {
33448
- let i = r.multiInbox ?? !1, a = r.inboxAgents ?? /* @__PURE__ */ new Map(), o = (e, t) => e.kind === "ai" ? e.aiAgentId !== void 0 && a.get(t) === e.aiAgentId : WP(e, t, i), s = /* @__PURE__ */ new Map();
33565
+ function KP(e, t, n, r = {}) {
33566
+ let i = r.multiInbox ?? !1, a = r.inboxAgents ?? /* @__PURE__ */ new Map(), o = (e, t) => e.kind === "ai" ? e.aiAgentId !== void 0 && a.get(t) === e.aiAgentId : GP(e, t, i), s = /* @__PURE__ */ new Map();
33449
33567
  for (let e of n ?? []) s.set(e.id, e);
33450
33568
  e && s.set(e.id, {
33451
33569
  ...e,
@@ -33466,9 +33584,9 @@ function GP(e, t, n, r = {}) {
33466
33584
  }
33467
33585
  };
33468
33586
  }
33469
- function KP() {
33587
+ function qP() {
33470
33588
  let { user: e, isAdmin: t } = Sl(), { i18n: n } = P(), r = n.language, i = js({ enabled: t }), a = Ms({ enabled: !t && e != null }), o = t ? i.data : a.data, s = zs({ enabled: e != null }), c = (s.data?.maxInboxes ?? 1) > 1 || (s.data?.inboxes?.length ?? 0) > 1, l = s.data?.inboxes;
33471
- return m(() => GP(e, t, o, {
33589
+ return m(() => KP(e, t, o, {
33472
33590
  multiInbox: c,
33473
33591
  inboxAgents: new Map((l ?? []).map((e) => [e.id, e.aiAgentId]))
33474
33592
  }), [
@@ -33481,7 +33599,7 @@ function KP() {
33481
33599
  ]);
33482
33600
  }
33483
33601
  // src/inbox/ReconnectBanner.tsx
33484
- function qP({ connected: e }) {
33602
+ function JP({ connected: e }) {
33485
33603
  let { t } = P("inbox"), n = h(!1);
33486
33604
  return e && (n.current = !0), e || !n.current ? null : /* @__PURE__ */ L("div", {
33487
33605
  className: "border-b bg-surface px-3 py-2",
@@ -33492,12 +33610,12 @@ function qP({ connected: e }) {
33492
33610
  })
33493
33611
  });
33494
33612
  }
33495
- function JP() {
33613
+ function YP() {
33496
33614
  let { connected: e } = wc();
33497
- return /* @__PURE__ */ L(qP, { connected: e });
33615
+ return /* @__PURE__ */ L(JP, { connected: e });
33498
33616
  }
33499
33617
  // src/inbox/useCanonicalChatRedirect.ts
33500
- function YP(e) {
33618
+ function XP(e) {
33501
33619
  let t = cs(e), n = ie(), r = re(), i = t.data?.chat.jid;
33502
33620
  u(() => {
33503
33621
  e && i && i !== e && n(`/chats/${gC(i)}`, {
@@ -33512,14 +33630,14 @@ function YP(e) {
33512
33630
  ]);
33513
33631
  }
33514
33632
  // src/inbox/InboxPage.tsx
33515
- var XP = "wati.inbox.filters", ZP = {
33633
+ var ZP = "wati.inbox.filters", QP = {
33516
33634
  assigned: "any",
33517
33635
  status: "open"
33518
33636
  };
33519
- function QP() {
33637
+ function $P() {
33520
33638
  try {
33521
- let e = sessionStorage.getItem(XP);
33522
- if (!e) return ZP;
33639
+ let e = sessionStorage.getItem(ZP);
33640
+ if (!e) return QP;
33523
33641
  let t = JSON.parse(e), n = t.assigned === "me" || t.assigned === "none" ? t.assigned : "any", r = t.status === "resolved" ? "resolved" : "open", i = typeof t.tag == "string" && t.tag.trim() && t.tag.length <= 30 ? t.tag.trim() : void 0, a = typeof t.inbox == "number" && Number.isInteger(t.inbox) && t.inbox > 0 ? t.inbox : void 0;
33524
33642
  return {
33525
33643
  assigned: n,
@@ -33529,21 +33647,21 @@ function QP() {
33529
33647
  inbox: a
33530
33648
  };
33531
33649
  } catch {
33532
- return ZP;
33650
+ return QP;
33533
33651
  }
33534
33652
  }
33535
- function $P() {
33536
- let { t: e } = P(["inbox", "common"]), t = j(), n = t.jid ? _C(t.jid) : null, r = ie(), i = re(), a = KP(), o = eb();
33537
- YP(n);
33653
+ function eF() {
33654
+ let { t: e } = P(["inbox", "common"]), t = j(), n = t.jid ? _C(t.jid) : null, r = ie(), i = re(), a = qP(), o = eb();
33655
+ XP(n);
33538
33656
  let c = i.state?.fromList === !0, l = s(() => {
33539
33657
  c ? r(-1) : r("/", { replace: !0 });
33540
- }, [c, r]), [d, f] = g(QP);
33658
+ }, [c, r]), [d, f] = g($P);
33541
33659
  u(() => {
33542
33660
  try {
33543
- sessionStorage.setItem(XP, JSON.stringify(d));
33661
+ sessionStorage.setItem(ZP, JSON.stringify(d));
33544
33662
  } catch {}
33545
33663
  }, [d]);
33546
- let p = zs().data != null, h = Wj(), _ = m(() => d.inbox == null || !p || h.length > 1 && h.some((e) => e.id === d.inbox) ? d : {
33664
+ let p = zs().data != null, h = Gj(), _ = m(() => d.inbox == null || !p || h.length > 1 && h.some((e) => e.id === d.inbox) ? d : {
33547
33665
  ...d,
33548
33666
  inbox: void 0
33549
33667
  }, [
@@ -33556,8 +33674,8 @@ function $P() {
33556
33674
  children: [
33557
33675
  /* @__PURE__ */ L("div", { className: "safe-top bg-surface" }),
33558
33676
  /* @__PURE__ */ L(Vu, {}),
33559
- /* @__PURE__ */ L(EP, {}),
33560
- /* @__PURE__ */ L(JP, {}),
33677
+ /* @__PURE__ */ L(DP, {}),
33678
+ /* @__PURE__ */ L(YP, {}),
33561
33679
  /* @__PURE__ */ R("div", {
33562
33680
  className: "flex min-h-0 flex-1",
33563
33681
  children: [/* @__PURE__ */ R("aside", {
@@ -33585,19 +33703,19 @@ function $P() {
33585
33703
  })]
33586
33704
  })
33587
33705
  }),
33588
- /* @__PURE__ */ L(Cj, {})
33706
+ /* @__PURE__ */ L(wj, {})
33589
33707
  ]
33590
33708
  }),
33591
- /* @__PURE__ */ L(Rj, {
33709
+ /* @__PURE__ */ L(zj, {
33592
33710
  value: d,
33593
33711
  onChange: f,
33594
33712
  inboxes: h
33595
33713
  }),
33596
- /* @__PURE__ */ L(Yj, {
33714
+ /* @__PURE__ */ L(Xj, {
33597
33715
  filters: _,
33598
33716
  activeJid: n,
33599
33717
  directory: a,
33600
- onResetFilters: () => f(ZP)
33718
+ onResetFilters: () => f(QP)
33601
33719
  }),
33602
33720
  o && /* @__PURE__ */ L("p", {
33603
33721
  className: "border-t px-3 py-2 text-xs text-muted-foreground",
@@ -33610,7 +33728,7 @@ function $P() {
33610
33728
  ]
33611
33729
  }), /* @__PURE__ */ L("main", {
33612
33730
  className: U("min-h-0 min-w-0 flex-1 flex-col bg-background", n ? "flex" : "hidden md:flex"),
33613
- children: n ? /* @__PURE__ */ L(UP, {
33731
+ children: n ? /* @__PURE__ */ L(WP, {
33614
33732
  jid: n,
33615
33733
  directory: a,
33616
33734
  onBack: l
@@ -33619,7 +33737,7 @@ function $P() {
33619
33737
  illustration: "/illustrations/empty-inbox.png",
33620
33738
  title: e("page.selectTitle"),
33621
33739
  description: e("page.selectDescription"),
33622
- action: /* @__PURE__ */ L(Vj, { className: "mt-2" })
33740
+ action: /* @__PURE__ */ L(Hj, { className: "mt-2" })
33623
33741
  })
33624
33742
  })]
33625
33743
  })
@@ -33627,7 +33745,7 @@ function $P() {
33627
33745
  }) });
33628
33746
  }
33629
33747
  // src/setup/connected-label.ts
33630
- function eF(e, t) {
33748
+ function tF(e, t) {
33631
33749
  if (!e) return t("setup.wa.connected");
33632
33750
  let n = mC(e.jid);
33633
33751
  return e.name && n ? t("setup.wa.connectedAsNamed", {
@@ -33636,7 +33754,7 @@ function eF(e, t) {
33636
33754
  }) : n || e.name ? t("setup.wa.connectedAs", { number: n || e.name }) : t("setup.wa.connected");
33637
33755
  }
33638
33756
  // src/setup/WaLinkStep.tsx
33639
- var tF = [
33757
+ var nF = [
33640
33758
  "open",
33641
33759
  "qr",
33642
33760
  "connecting",
@@ -33645,10 +33763,10 @@ var tF = [
33645
33763
  "replaced",
33646
33764
  "blocked",
33647
33765
  "disconnected"
33648
- ], nF = (e) => tF.includes(e);
33649
- function rF({ onContinue: e, onSkip: t }) {
33766
+ ], rF = (e) => nF.includes(e);
33767
+ function iF({ onContinue: e, onSkip: t }) {
33650
33768
  let { t: n } = P(["auth", "common"]), r = Ls(), i = Hs(), a = r.data, o;
33651
- o = r.isPending ? /* @__PURE__ */ L(iF, { text: n("setup.wa.checking") }) : r.error ? /* @__PURE__ */ L(q, {
33769
+ o = r.isPending ? /* @__PURE__ */ L(aF, { text: n("setup.wa.checking") }) : r.error ? /* @__PURE__ */ L(q, {
33652
33770
  tone: "danger",
33653
33771
  children: V(r.error)
33654
33772
  }) : a?.state === "open" ? /* @__PURE__ */ R("div", {
@@ -33664,7 +33782,7 @@ function rF({ onContinue: e, onSkip: t }) {
33664
33782
  children: n("setup.wa.linked")
33665
33783
  }), /* @__PURE__ */ L("p", {
33666
33784
  className: "break-words text-muted-foreground",
33667
- children: eF(a.me, n)
33785
+ children: tF(a.me, n)
33668
33786
  })]
33669
33787
  })]
33670
33788
  }) : a?.state === "qr" && a.qr ? /* @__PURE__ */ R("div", {
@@ -33703,10 +33821,10 @@ function rF({ onContinue: e, onSkip: t }) {
33703
33821
  "aria-busy": i.isPending || void 0,
33704
33822
  disabled: i.isPending,
33705
33823
  onClick: () => i.mutate("relink"),
33706
- children: [i.isPending ? /* @__PURE__ */ L(tj, {}) : /* @__PURE__ */ L(gi, { "aria-hidden": "true" }), n("setup.wa.showNewQr")]
33824
+ children: [i.isPending ? /* @__PURE__ */ L(nj, {}) : /* @__PURE__ */ L(gi, { "aria-hidden": "true" }), n("setup.wa.showNewQr")]
33707
33825
  })
33708
33826
  ]
33709
- }) : /* @__PURE__ */ L(iF, { text: n("setup.wa.waitingQr") });
33827
+ }) : /* @__PURE__ */ L(aF, { text: n("setup.wa.waitingQr") });
33710
33828
  let s = a?.state === "open";
33711
33829
  return r.isPending || r.error || a?.state !== "qr" && a?.state !== "connecting" || (o = /* @__PURE__ */ R(Hw, {
33712
33830
  defaultValue: "qr",
@@ -33749,7 +33867,7 @@ function rF({ onContinue: e, onSkip: t }) {
33749
33867
  pulse: a.state === "qr" || a.state === "connecting",
33750
33868
  label: /* @__PURE__ */ L("span", {
33751
33869
  className: "text-muted-foreground",
33752
- children: nF(a.state) ? n(`setup.wa.states.${a.state}`) : a.state
33870
+ children: rF(a.state) ? n(`setup.wa.states.${a.state}`) : a.state
33753
33871
  })
33754
33872
  })]
33755
33873
  }), /* @__PURE__ */ R("ol", {
@@ -33786,7 +33904,7 @@ function rF({ onContinue: e, onSkip: t }) {
33786
33904
  ]
33787
33905
  });
33788
33906
  }
33789
- function iF({ text: e }) {
33907
+ function aF({ text: e }) {
33790
33908
  return /* @__PURE__ */ R("div", {
33791
33909
  role: "status",
33792
33910
  className: "flex flex-col items-center gap-3 py-8",
@@ -33799,20 +33917,20 @@ function iF({ text: e }) {
33799
33917
  })]
33800
33918
  });
33801
33919
  }
33802
- function aF(e, t) {
33920
+ function oF(e, t) {
33803
33921
  let n = e.trim().replace(/\s+/g, " "), r = t(n);
33804
33922
  if (r.length <= 64) return r;
33805
33923
  let i = Math.max(1, 64 - t("").length), a = n.slice(0, i), o = a.lastIndexOf(" ");
33806
33924
  return n[i] !== " " && o >= i / 2 && (a = a.slice(0, o)), a = a.replace(/[\s,.;:&/(-]+$/u, ""), t(a).slice(0, 64);
33807
33925
  }
33808
33926
  // src/setup/AiAssistantStep.tsx
33809
- function oF(e) {
33927
+ function sF(e) {
33810
33928
  let t = e.agents.find((t) => t.userId === e.member?.id);
33811
33929
  return t ? t.id : e.agents.length === 1 ? e.agents[0].id : null;
33812
33930
  }
33813
- function sF({ businessName: e, onDone: t }) {
33931
+ function cF({ businessName: e, onDone: t }) {
33814
33932
  let { t: n } = P("auth"), r = uy(), i = gy(), a = T(), o = d(), s = d(), c = d(), l = e || n("setup.ai.yourBusiness"), u = n("setup.ai.template", { business: l }), [f, p] = g(u), [m, _] = g(!0), [v, y] = g(null), [b, x] = g(!1), S = h(null), C = r.data ? Yx(r.data) : !1, w = async (e, t) => {
33815
- let n = oF(e);
33933
+ let n = sF(e);
33816
33934
  if (n === null) {
33817
33935
  await i.mutateAsync({
33818
33936
  kind: "addText",
@@ -33831,7 +33949,7 @@ function sF({ businessName: e, onDone: t }) {
33831
33949
  return;
33832
33950
  }
33833
33951
  let e = C && m, r = De.safeParse({
33834
- displayName: aF(l, (e) => n("setup.ai.agentName", { business: e })),
33952
+ displayName: oF(l, (e) => n("setup.ai.agentName", { business: e })),
33835
33953
  enabled: !1,
33836
33954
  instructions: st,
33837
33955
  handoffRules: ot
@@ -33920,7 +34038,7 @@ function sF({ businessName: e, onDone: t }) {
33920
34038
  }), r.data ? /* @__PURE__ */ L(iS, { status: r.data }) : r.error ? /* @__PURE__ */ L(q, {
33921
34039
  tone: "danger",
33922
34040
  children: V(r.error)
33923
- }) : /* @__PURE__ */ L(tj, {})]
34041
+ }) : /* @__PURE__ */ L(nj, {})]
33924
34042
  }),
33925
34043
  C && /* @__PURE__ */ R("div", {
33926
34044
  className: "flex items-start justify-between gap-4 rounded-lg border p-3",
@@ -33962,26 +34080,26 @@ function sF({ businessName: e, onDone: t }) {
33962
34080
  disabled: b,
33963
34081
  "aria-busy": b || void 0,
33964
34082
  onClick: () => void D(),
33965
- children: [b && /* @__PURE__ */ L(tj, {}), n("setup.ai.finish")]
34083
+ children: [b && /* @__PURE__ */ L(nj, {}), n("setup.ai.finish")]
33966
34084
  })]
33967
34085
  })
33968
34086
  ]
33969
34087
  });
33970
34088
  }
33971
34089
  // src/setup/username.ts
33972
- var cF = "admin";
33973
- function lF(e) {
34090
+ var lF = "admin";
34091
+ function uF(e) {
33974
34092
  return e.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().trim().replace(/\s+/g, ".").replace(/[^a-z0-9_.-]/g, "").replace(/\.{2,}/g, ".").slice(0, 32).replace(/^[._-]+|[._-]+$/g, "");
33975
34093
  }
33976
- function uF(e) {
34094
+ function dF(e) {
33977
34095
  if (!e.trim()) return "";
33978
- let t = lF(e);
33979
- return t.length >= 3 ? t : cF;
34096
+ let t = uF(e);
34097
+ return t.length >= 3 ? t : lF;
33980
34098
  }
33981
34099
  // src/setup/WhatsAppStepChoice.tsx
33982
- var dF = "linked_phone";
33983
- function fF({ phoneStep: e, onContinue: t, onSkip: n }) {
33984
- let { t: r } = P(["auth", "common"]), i = Mu(), a = T(), o = Lu().filter((e) => e.SetupForm), [s, c] = g(dF), [l, u] = g(null);
34100
+ var fF = "linked_phone";
34101
+ function pF({ phoneStep: e, onContinue: t, onSkip: n }) {
34102
+ let { t: r } = P(["auth", "common"]), i = Mu(), a = T(), o = Lu().filter((e) => e.SetupForm), [s, c] = g(fF), [l, u] = g(null);
33985
34103
  if (o.length === 0) return /* @__PURE__ */ L(I, { children: e });
33986
34104
  let d = o.find((e) => e.type === s);
33987
34105
  return /* @__PURE__ */ R("div", {
@@ -34003,7 +34121,7 @@ function fF({ phoneStep: e, onContinue: t, onSkip: n }) {
34003
34121
  onValueChange: c,
34004
34122
  className: "w-full [&>label]:flex-1",
34005
34123
  options: [{
34006
- value: dF,
34124
+ value: fF,
34007
34125
  label: r("setup.wa.choicePhone")
34008
34126
  }, ...o.map((e) => ({
34009
34127
  value: e.type,
@@ -34041,17 +34159,17 @@ function fF({ phoneStep: e, onContinue: t, onSkip: n }) {
34041
34159
  });
34042
34160
  }
34043
34161
  // src/lite-import/LiteSetupStart.tsx
34044
- var pF = [
34162
+ var mF = [
34045
34163
  "start",
34046
34164
  "bring",
34047
34165
  "ready"
34048
34166
  ];
34049
- function mF({ current: e }) {
34050
- let { t } = P("admin"), n = pF.indexOf(e);
34167
+ function hF({ current: e }) {
34168
+ let { t } = P("admin"), n = mF.indexOf(e);
34051
34169
  return /* @__PURE__ */ L("ol", {
34052
34170
  className: "mb-5 flex items-center gap-2 text-xs",
34053
34171
  "aria-label": t("liteImport.progress"),
34054
- children: pF.map((e, r) => /* @__PURE__ */ R("li", {
34172
+ children: mF.map((e, r) => /* @__PURE__ */ R("li", {
34055
34173
  className: "flex min-w-0 flex-1 items-center gap-2",
34056
34174
  children: [
34057
34175
  /* @__PURE__ */ L("span", {
@@ -34066,7 +34184,7 @@ function mF({ current: e }) {
34066
34184
  className: U("hidden truncate sm:inline", r === n ? "font-medium text-foreground" : "text-muted-foreground"),
34067
34185
  children: t(`liteImport.setup.steps.${e}`)
34068
34186
  }),
34069
- r < pF.length - 1 && /* @__PURE__ */ L("span", {
34187
+ r < mF.length - 1 && /* @__PURE__ */ L("span", {
34070
34188
  "aria-hidden": "true",
34071
34189
  className: U("h-px min-w-3 flex-1", r < n ? "bg-primary" : "bg-border")
34072
34190
  })
@@ -34074,7 +34192,7 @@ function mF({ current: e }) {
34074
34192
  }, e))
34075
34193
  });
34076
34194
  }
34077
- function hF({ icon: e, title: t, points: n, primary: r = !1, onPick: i, testId: a }) {
34195
+ function gF({ icon: e, title: t, points: n, primary: r = !1, onPick: i, testId: a }) {
34078
34196
  return /* @__PURE__ */ R("div", {
34079
34197
  className: U("flex min-w-0 flex-col gap-3 rounded-lg border p-4", r && "border-primary"),
34080
34198
  "data-testid": a,
@@ -34104,49 +34222,54 @@ function hF({ icon: e, title: t, points: n, primary: r = !1, onPick: i, testId:
34104
34222
  ]
34105
34223
  });
34106
34224
  }
34107
- function gF({ bridge: e, startNew: t }) {
34225
+ function _F({ bridge: e, startNew: t }) {
34108
34226
  let { t: n } = P("admin"), r = es(), { state: i, error: a, busy: o, act: s } = Wl(e), [c, l] = g("choose");
34109
34227
  if (c === "new" || a) return t;
34110
- if (!i || i.phase === "idle") return /* @__PURE__ */ L(nj, {});
34228
+ if (!i || i.phase === "idle") return /* @__PURE__ */ L(rj, {});
34111
34229
  if (i.phase === "none") return t;
34112
- let u = i.phase === "running" || i.phase === "done" || i.phase === "failed", d = i.lite;
34230
+ let u = i.phase === "running" || i.phase === "done" || i.phase === "failed", d = i.lite, f = i.phase === "protected";
34113
34231
  if (c === "choose" && !u) {
34114
- if (r.isPending) return /* @__PURE__ */ L(nj, {});
34115
- if (!r.data?.needsSetup || i.mode !== "copy" || !d) return t;
34232
+ if (r.isPending) return /* @__PURE__ */ L(rj, {});
34233
+ if (!r.data?.needsSetup || !f && (i.mode !== "copy" || !d)) return t;
34116
34234
  }
34117
- let f = n("liteImport.actionFailed"), p = {
34235
+ let p = n("liteImport.actionFailed"), m = {
34118
34236
  state: i,
34119
34237
  bridge: e,
34120
34238
  act: s,
34121
34239
  busy: o
34122
- }, m = c === "choose" && !u;
34123
- return /* @__PURE__ */ L($A, {
34240
+ }, h = c === "choose" && !u;
34241
+ return /* @__PURE__ */ L(ej, {
34124
34242
  wide: !0,
34125
34243
  title: n("liteImport.setup.title"),
34126
- subtitle: m ? n("liteImport.setup.subtitle") : void 0,
34244
+ subtitle: h ? n("liteImport.setup.subtitle") : void 0,
34127
34245
  children: /* @__PURE__ */ R("div", {
34128
34246
  className: "flex min-w-0 flex-col gap-4",
34129
34247
  "data-testid": "lite-setup",
34130
- "data-path": m ? "choose" : "lite",
34131
- children: [m && d && /* @__PURE__ */ R(I, { children: [
34248
+ "data-path": h ? "choose" : "lite",
34249
+ children: [h && (d || f) && /* @__PURE__ */ R(I, { children: [
34132
34250
  /* @__PURE__ */ L(Yl, {
34133
- number: d.number,
34251
+ number: d?.number ?? null,
34252
+ service: f,
34134
34253
  mode: "copy"
34135
34254
  }),
34136
34255
  /* @__PURE__ */ R("div", {
34137
34256
  className: "grid gap-3 sm:grid-cols-2",
34138
- children: [/* @__PURE__ */ L(hF, {
34257
+ children: [/* @__PURE__ */ L(gF, {
34139
34258
  testId: "lite-setup-bring",
34140
34259
  icon: hr,
34141
34260
  title: n("liteImport.setup.bring"),
34142
34261
  primary: !0,
34143
- points: [
34262
+ points: d && !f ? [
34144
34263
  [Wr, n("liteImport.setup.bringChats", { chats: d.chats })],
34145
34264
  [ra, n("liteImport.setup.bringTeam", { n: d.users.length })],
34146
34265
  [ca, n("liteImport.found.noQr")]
34266
+ ] : [
34267
+ [Wr, n("liteImport.setup.bringAll")],
34268
+ [Ar, n("liteImport.protected.ask")],
34269
+ [ca, n("liteImport.found.noQr")]
34147
34270
  ],
34148
34271
  onPick: () => l("lite")
34149
- }), /* @__PURE__ */ L(hF, {
34272
+ }), /* @__PURE__ */ L(gF, {
34150
34273
  testId: "lite-setup-new",
34151
34274
  icon: zi,
34152
34275
  title: n("liteImport.setup.new"),
@@ -34164,16 +34287,26 @@ function gF({ bridge: e, startNew: t }) {
34164
34287
  children: n("liteImport.setup.onlyHere")
34165
34288
  })]
34166
34289
  })
34167
- ] }), !m && /* @__PURE__ */ R(I, { children: [
34168
- /* @__PURE__ */ L(mF, { current: i.phase === "done" ? "ready" : "bring" }),
34169
- (i.phase === "found" || i.phase === "blocked") && /* @__PURE__ */ L(vA, {
34170
- ...p,
34290
+ ] }), !h && /* @__PURE__ */ R(I, { children: [
34291
+ /* @__PURE__ */ L(hF, { current: i.phase === "done" ? "ready" : "bring" }),
34292
+ f && /* @__PURE__ */ L(_A, {
34293
+ ...m,
34294
+ mode: "copy",
34295
+ cancel: /* @__PURE__ */ L(W, {
34296
+ variant: "outline",
34297
+ size: "touch",
34298
+ onClick: () => l("new"),
34299
+ children: n("liteImport.setup.new")
34300
+ })
34301
+ }),
34302
+ (i.phase === "found" || i.phase === "blocked") && /* @__PURE__ */ L(yA, {
34303
+ ...m,
34171
34304
  continueLabel: n("liteImport.found.continueCopy"),
34172
- onContinue: () => void s(() => e.start({ team: [] }), f)
34305
+ onContinue: () => void s(() => e.start({ team: [] }), p)
34173
34306
  }),
34174
- i.phase === "running" && /* @__PURE__ */ L(xA, { state: i }),
34175
- i.phase === "failed" && /* @__PURE__ */ L(TA, {
34176
- ...p,
34307
+ i.phase === "running" && /* @__PURE__ */ L(SA, { state: i }),
34308
+ i.phase === "failed" && /* @__PURE__ */ L(EA, {
34309
+ ...m,
34177
34310
  extra: /* @__PURE__ */ L(W, {
34178
34311
  variant: "ghost",
34179
34312
  size: "touch",
@@ -34181,31 +34314,31 @@ function gF({ bridge: e, startNew: t }) {
34181
34314
  children: n("liteImport.setup.new")
34182
34315
  })
34183
34316
  }),
34184
- i.phase === "done" && /* @__PURE__ */ L(DA, { state: i })
34317
+ i.phase === "done" && /* @__PURE__ */ L(OA, { state: i })
34185
34318
  ] })]
34186
34319
  })
34187
34320
  });
34188
34321
  }
34189
- function _F({ startNew: e }) {
34322
+ function vF({ startNew: e }) {
34190
34323
  let t = Hl();
34191
- return t ? /* @__PURE__ */ L(gF, {
34324
+ return t ? /* @__PURE__ */ L(_F, {
34192
34325
  bridge: t,
34193
34326
  startNew: e
34194
34327
  }) : /* @__PURE__ */ L(I, { children: e });
34195
34328
  }
34196
34329
  // src/setup/SetupWizard.tsx
34197
- var vF = [
34330
+ var yF = [
34198
34331
  "account",
34199
34332
  "whatsapp",
34200
34333
  "ai",
34201
34334
  "ready"
34202
34335
  ];
34203
- function yF({ current: e }) {
34204
- let { t } = P("auth"), n = vF.indexOf(e);
34336
+ function bF({ current: e }) {
34337
+ let { t } = P("auth"), n = yF.indexOf(e);
34205
34338
  return /* @__PURE__ */ L("ol", {
34206
34339
  className: "mb-5 flex items-center gap-2 text-xs",
34207
34340
  "aria-label": t("setup.progress"),
34208
- children: vF.map((e, r) => /* @__PURE__ */ R("li", {
34341
+ children: yF.map((e, r) => /* @__PURE__ */ R("li", {
34209
34342
  className: "flex min-w-0 flex-1 items-center gap-2",
34210
34343
  children: [
34211
34344
  /* @__PURE__ */ L("span", {
@@ -34220,7 +34353,7 @@ function yF({ current: e }) {
34220
34353
  className: U("hidden truncate sm:inline", r === n ? "font-medium text-foreground" : "text-muted-foreground"),
34221
34354
  children: t(`setup.steps.${e}`)
34222
34355
  }),
34223
- r < vF.length - 1 && /* @__PURE__ */ L("span", {
34356
+ r < yF.length - 1 && /* @__PURE__ */ L("span", {
34224
34357
  "aria-hidden": "true",
34225
34358
  className: U("h-px min-w-3 flex-1", r < n ? "bg-primary" : "bg-border")
34226
34359
  })
@@ -34228,19 +34361,19 @@ function yF({ current: e }) {
34228
34361
  }, e))
34229
34362
  });
34230
34363
  }
34231
- function bF({ current: e }) {
34364
+ function xF({ current: e }) {
34232
34365
  let { t } = P("auth");
34233
34366
  return /* @__PURE__ */ L("p", {
34234
34367
  className: "-mt-3 mb-5 text-center text-sm font-medium sm:hidden",
34235
34368
  children: t("setup.stepOf", {
34236
- n: vF.indexOf(e) + 1,
34237
- total: vF.length,
34369
+ n: yF.indexOf(e) + 1,
34370
+ total: yF.length,
34238
34371
  name: t(`setup.steps.${e}`)
34239
34372
  })
34240
34373
  });
34241
34374
  }
34242
- function xF({ businessName: e, onBusinessName: t, onDone: n }) {
34243
- let { t: r } = P("auth"), i = ts(), [a, o] = g(""), [s, c] = g(null), l = s ?? uF(a), [u, d] = g(""), f = (l.length > 0 || s !== null) && !/^[a-zA-Z0-9_.-]{3,32}$/.test(l) ? r("setup.admin.usernameRule") : void 0, p = u.length > 0 && u.length < 8 ? r("setup.admin.minLength") : void 0, m = e.trim().length > 0 && !f && l.length >= 3 && a.trim().length > 0 && u.length >= 8, h = (e) => {
34375
+ function SF({ businessName: e, onBusinessName: t, onDone: n }) {
34376
+ let { t: r } = P("auth"), i = ts(), [a, o] = g(""), [s, c] = g(null), l = s ?? dF(a), [u, d] = g(""), f = (l.length > 0 || s !== null) && !/^[a-zA-Z0-9_.-]{3,32}$/.test(l) ? r("setup.admin.usernameRule") : void 0, p = u.length > 0 && u.length < 8 ? r("setup.admin.minLength") : void 0, m = e.trim().length > 0 && !f && l.length >= 3 && a.trim().length > 0 && u.length >= 8, h = (e) => {
34244
34377
  e.preventDefault(), m && i.mutate({
34245
34378
  username: l,
34246
34379
  displayName: a.trim(),
@@ -34261,7 +34394,7 @@ function xF({ businessName: e, onBusinessName: t, onDone: n }) {
34261
34394
  title: _ ? r("setup.admin.forbiddenTitle") : void 0,
34262
34395
  children: _ ? r("setup.admin.forbiddenBody") : V(i.error)
34263
34396
  }),
34264
- /* @__PURE__ */ L(ej, {
34397
+ /* @__PURE__ */ L(tj, {
34265
34398
  label: r("setup.admin.businessName"),
34266
34399
  autoComplete: "organization",
34267
34400
  value: e,
@@ -34269,7 +34402,7 @@ function xF({ businessName: e, onBusinessName: t, onDone: n }) {
34269
34402
  onChange: (e) => t(e.target.value),
34270
34403
  hint: r("setup.admin.businessNameHint")
34271
34404
  }),
34272
- /* @__PURE__ */ L(ej, {
34405
+ /* @__PURE__ */ L(tj, {
34273
34406
  label: r("setup.admin.yourName"),
34274
34407
  autoComplete: "name",
34275
34408
  value: a,
@@ -34277,7 +34410,7 @@ function xF({ businessName: e, onBusinessName: t, onDone: n }) {
34277
34410
  onChange: (e) => o(e.target.value),
34278
34411
  hint: r("setup.admin.displayNameHint")
34279
34412
  }),
34280
- /* @__PURE__ */ L(ej, {
34413
+ /* @__PURE__ */ L(tj, {
34281
34414
  label: r("setup.admin.username"),
34282
34415
  autoComplete: "username",
34283
34416
  autoCapitalize: "none",
@@ -34286,9 +34419,9 @@ function xF({ businessName: e, onBusinessName: t, onDone: n }) {
34286
34419
  value: l,
34287
34420
  onChange: (e) => c(e.target.value),
34288
34421
  error: f,
34289
- hint: s === null && a.trim() !== "" && lF(a).length < 3 ? r("setup.admin.usernamePickedHint") : r("setup.admin.usernameAutoHint")
34422
+ hint: s === null && a.trim() !== "" && uF(a).length < 3 ? r("setup.admin.usernamePickedHint") : r("setup.admin.usernameAutoHint")
34290
34423
  }),
34291
- /* @__PURE__ */ L(ej, {
34424
+ /* @__PURE__ */ L(tj, {
34292
34425
  label: r("setup.admin.passLabel"),
34293
34426
  type: "password",
34294
34427
  autoComplete: "new-password",
@@ -34304,7 +34437,7 @@ function xF({ businessName: e, onBusinessName: t, onDone: n }) {
34304
34437
  "aria-busy": i.isPending || void 0,
34305
34438
  disabled: i.isPending || !m,
34306
34439
  children: [
34307
- i.isPending && /* @__PURE__ */ L(tj, {}),
34440
+ i.isPending && /* @__PURE__ */ L(nj, {}),
34308
34441
  r("setup.admin.submitContinue"),
34309
34442
  !i.isPending && /* @__PURE__ */ L(Cn, { "aria-hidden": "true" })
34310
34443
  ]
@@ -34312,7 +34445,7 @@ function xF({ businessName: e, onBusinessName: t, onDone: n }) {
34312
34445
  ]
34313
34446
  });
34314
34447
  }
34315
- function SF({ done: e, children: t }) {
34448
+ function CF({ done: e, children: t }) {
34316
34449
  return /* @__PURE__ */ R("li", {
34317
34450
  className: "flex items-start gap-2 text-sm",
34318
34451
  children: [e ? /* @__PURE__ */ L(ir, {
@@ -34327,7 +34460,7 @@ function SF({ done: e, children: t }) {
34327
34460
  })]
34328
34461
  });
34329
34462
  }
34330
- function CF({ aiOn: e }) {
34463
+ function wF({ aiOn: e }) {
34331
34464
  let { t } = P("auth"), n = ie(), r = Ls().data?.state === "open";
34332
34465
  return /* @__PURE__ */ R("div", {
34333
34466
  className: "flex flex-col gap-5",
@@ -34340,10 +34473,10 @@ function CF({ aiOn: e }) {
34340
34473
  children: t("setup.ready.title")
34341
34474
  }), /* @__PURE__ */ R("ul", {
34342
34475
  className: "flex flex-col gap-2",
34343
- children: [/* @__PURE__ */ L(SF, {
34476
+ children: [/* @__PURE__ */ L(CF, {
34344
34477
  done: r,
34345
34478
  children: t(r ? "setup.ready.waLinked" : "setup.ready.waNotLinked")
34346
- }), /* @__PURE__ */ L(SF, {
34479
+ }), /* @__PURE__ */ L(CF, {
34347
34480
  done: e,
34348
34481
  children: t(e ? "setup.ready.aiOn" : "setup.ready.aiOff")
34349
34482
  })]
@@ -34386,52 +34519,52 @@ function CF({ aiOn: e }) {
34386
34519
  ]
34387
34520
  });
34388
34521
  }
34389
- function wF() {
34522
+ function TF() {
34390
34523
  let { t: e } = P("auth"), t = es(), [n, r] = g("account"), [i, a] = g(""), [o, s] = g(!1), [c, l] = g(!1);
34391
- return t.data?.needsSetup && !c && l(!0), t.isPending ? /* @__PURE__ */ L(nj, {}) : !c && n === "account" && t.data && !t.data.needsSetup ? /* @__PURE__ */ L(k, {
34524
+ return t.data?.needsSetup && !c && l(!0), t.isPending ? /* @__PURE__ */ L(rj, {}) : !c && n === "account" && t.data && !t.data.needsSetup ? /* @__PURE__ */ L(k, {
34392
34525
  to: "/",
34393
34526
  replace: !0
34394
- }) : /* @__PURE__ */ R($A, {
34527
+ }) : /* @__PURE__ */ R(ej, {
34395
34528
  title: e("setup.title"),
34396
34529
  subtitle: e("setup.subtitle"),
34397
34530
  illustration: n === "account" ? "/illustrations/welcome.png" : void 0,
34398
34531
  wide: !0,
34399
34532
  children: [
34400
- /* @__PURE__ */ L(yF, { current: n }),
34401
34533
  /* @__PURE__ */ L(bF, { current: n }),
34534
+ /* @__PURE__ */ L(xF, { current: n }),
34402
34535
  t.error && n === "account" && /* @__PURE__ */ L(q, {
34403
34536
  tone: "danger",
34404
34537
  className: "mb-4",
34405
34538
  children: V(t.error)
34406
34539
  }),
34407
- n === "account" && /* @__PURE__ */ L(xF, {
34540
+ n === "account" && /* @__PURE__ */ L(SF, {
34408
34541
  businessName: i,
34409
34542
  onBusinessName: a,
34410
34543
  onDone: () => r("whatsapp")
34411
34544
  }),
34412
- n === "whatsapp" && /* @__PURE__ */ L(fF, {
34413
- phoneStep: /* @__PURE__ */ L(rF, {
34545
+ n === "whatsapp" && /* @__PURE__ */ L(pF, {
34546
+ phoneStep: /* @__PURE__ */ L(iF, {
34414
34547
  onContinue: () => r("ai"),
34415
34548
  onSkip: () => r("ai")
34416
34549
  }),
34417
34550
  onContinue: () => r("ai"),
34418
34551
  onSkip: () => r("ai")
34419
34552
  }),
34420
- n === "ai" && /* @__PURE__ */ L(sF, {
34553
+ n === "ai" && /* @__PURE__ */ L(cF, {
34421
34554
  businessName: i.trim(),
34422
34555
  onDone: (e) => {
34423
34556
  s(e), r("ready");
34424
34557
  }
34425
34558
  }),
34426
- n === "ready" && /* @__PURE__ */ L(CF, { aiOn: o })
34559
+ n === "ready" && /* @__PURE__ */ L(wF, { aiOn: o })
34427
34560
  ]
34428
34561
  });
34429
34562
  }
34430
- function TF() {
34431
- return /* @__PURE__ */ L(_F, { startNew: /* @__PURE__ */ L(wF, {}) });
34563
+ function EF() {
34564
+ return /* @__PURE__ */ L(vF, { startNew: /* @__PURE__ */ L(TF, {}) });
34432
34565
  }
34433
34566
  // src/components/app/DevBuildBadge.tsx
34434
- function EF() {
34567
+ function DF() {
34435
34568
  let { t: e } = P("common"), t = tb() === "dev", n = e("devBuild");
34436
34569
  return u(() => {
34437
34570
  if (!t) return;
@@ -34449,12 +34582,12 @@ function EF() {
34449
34582
  }) : null;
34450
34583
  }
34451
34584
  // src/askezy/api.ts
34452
- var DF = () => B("/ask-ezy/status", { schema: Le }), OF = (e, t) => B(`/ask-ezy/changes/${encodeURIComponent(e)}/${t}`, {
34585
+ var OF = () => B("/ask-ezy/status", { schema: Le }), kF = (e, t) => B(`/ask-ezy/changes/${encodeURIComponent(e)}/${t}`, {
34453
34586
  method: "POST",
34454
34587
  body: {},
34455
34588
  schema: Fe
34456
34589
  });
34457
- async function kF(e, t, n) {
34590
+ async function AF(e, t, n) {
34458
34591
  let r = await fetch("/api/ask-ezy", {
34459
34592
  method: "POST",
34460
34593
  headers: {
@@ -34493,7 +34626,7 @@ async function kF(e, t, n) {
34493
34626
  throw new fo(503, "ai_unavailable", "The answer stopped early");
34494
34627
  }
34495
34628
  // src/askezy/AskEzyBlocks.tsx
34496
- function AF({ title: e, finding: t, children: n, testId: r, changeId: i }) {
34629
+ function jF({ title: e, finding: t, children: n, testId: r, changeId: i }) {
34497
34630
  return /* @__PURE__ */ R("section", {
34498
34631
  className: "flex min-w-0 scroll-mt-2 flex-col gap-3 rounded-lg border bg-card p-3",
34499
34632
  "data-testid": r,
@@ -34510,9 +34643,9 @@ function AF({ title: e, finding: t, children: n, testId: r, changeId: i }) {
34510
34643
  }), n]
34511
34644
  });
34512
34645
  }
34513
- function jF({ block: e }) {
34646
+ function MF({ block: e }) {
34514
34647
  let { t } = P("inbox");
34515
- return /* @__PURE__ */ L(AF, {
34648
+ return /* @__PURE__ */ L(jF, {
34516
34649
  testId: "ask-block-stats",
34517
34650
  children: /* @__PURE__ */ L("dl", {
34518
34651
  className: "grid grid-cols-2 gap-2",
@@ -34551,7 +34684,7 @@ function jF({ block: e }) {
34551
34684
  })
34552
34685
  });
34553
34686
  }
34554
- function MF({ block: e }) {
34687
+ function NF({ block: e }) {
34555
34688
  let { t, i18n: n } = P("inbox"), r = (e) => new Intl.DateTimeFormat(n.language, {
34556
34689
  weekday: "long",
34557
34690
  timeZone: "UTC"
@@ -34563,7 +34696,7 @@ function MF({ block: e }) {
34563
34696
  h: n,
34564
34697
  v: e
34565
34698
  }))), o = [...a].sort((e, t) => t.v - e.v).slice(0, 3), s = Math.max(1, ...a.map((e) => e.v));
34566
- return /* @__PURE__ */ R(AF, {
34699
+ return /* @__PURE__ */ R(jF, {
34567
34700
  title: e.title,
34568
34701
  finding: e.finding,
34569
34702
  testId: "ask-block-heatmap",
@@ -34630,9 +34763,9 @@ function MF({ block: e }) {
34630
34763
  })]
34631
34764
  });
34632
34765
  }
34633
- function NF({ block: e, ctx: t }) {
34766
+ function PF({ block: e, ctx: t }) {
34634
34767
  let { t: n } = P("inbox");
34635
- return /* @__PURE__ */ L(AF, {
34768
+ return /* @__PURE__ */ L(jF, {
34636
34769
  title: e.title,
34637
34770
  testId: "ask-block-chats",
34638
34771
  children: /* @__PURE__ */ L("ul", {
@@ -34681,9 +34814,9 @@ function NF({ block: e, ctx: t }) {
34681
34814
  })
34682
34815
  });
34683
34816
  }
34684
- function PF({ block: e, ctx: t }) {
34817
+ function FF({ block: e, ctx: t }) {
34685
34818
  let { t: n } = P("inbox"), r = t.scopeJid === e.jid;
34686
- return /* @__PURE__ */ R(AF, {
34819
+ return /* @__PURE__ */ R(jF, {
34687
34820
  testId: "ask-block-customer",
34688
34821
  children: [
34689
34822
  /* @__PURE__ */ R("header", {
@@ -34757,7 +34890,7 @@ function PF({ block: e, ctx: t }) {
34757
34890
  ]
34758
34891
  });
34759
34892
  }
34760
- function FF({ before: e, after: t }) {
34893
+ function IF({ before: e, after: t }) {
34761
34894
  let { t: n } = P("inbox"), r = e.split("\n"), i = t.split("\n"), a = r.filter((e) => !i.includes(e)), o = i.filter((e) => r.includes(e)), s = i.filter((e) => !r.includes(e)), c = ({ kind: e, text: t }) => /* @__PURE__ */ R("li", {
34762
34895
  className: "flex items-start gap-2",
34763
34896
  children: [/* @__PURE__ */ L(G, {
@@ -34795,7 +34928,7 @@ function FF({ before: e, after: t }) {
34795
34928
  })]
34796
34929
  });
34797
34930
  }
34798
- function IF({ test: e, compact: t }) {
34931
+ function LF({ test: e, compact: t }) {
34799
34932
  let { t: n } = P("inbox");
34800
34933
  return /* @__PURE__ */ R("div", {
34801
34934
  className: "flex flex-col gap-2",
@@ -34834,14 +34967,14 @@ function IF({ test: e, compact: t }) {
34834
34967
  ]
34835
34968
  });
34836
34969
  }
34837
- function LF({ block: e, ctx: t }) {
34970
+ function RF({ block: e, ctx: t }) {
34838
34971
  let { t: n } = P("inbox"), { status: r, busy: i, error: a } = t.changes[e.id] ?? {
34839
34972
  status: e.status,
34840
34973
  version: e.version
34841
34974
  }, o = h(null), s = h(r);
34842
34975
  return u(() => {
34843
34976
  s.current !== r && (s.current = r, o.current?.focus());
34844
- }, [r]), /* @__PURE__ */ R(AF, {
34977
+ }, [r]), /* @__PURE__ */ R(jF, {
34845
34978
  testId: `ask-block-change-${e.id}`,
34846
34979
  changeId: e.id,
34847
34980
  children: [
@@ -34873,7 +35006,7 @@ function LF({ block: e, ctx: t }) {
34873
35006
  className: "text-sm",
34874
35007
  children: e.reason
34875
35008
  }),
34876
- /* @__PURE__ */ L(FF, {
35009
+ /* @__PURE__ */ L(IF, {
34877
35010
  before: e.before,
34878
35011
  after: e.after
34879
35012
  }),
@@ -34888,7 +35021,7 @@ function LF({ block: e, ctx: t }) {
34888
35021
  }), n("askEzy.test.show")]
34889
35022
  }), /* @__PURE__ */ L("div", {
34890
35023
  className: "mt-2",
34891
- children: /* @__PURE__ */ L(IF, {
35024
+ children: /* @__PURE__ */ L(LF, {
34892
35025
  test: e.test,
34893
35026
  compact: !0
34894
35027
  })
@@ -34960,10 +35093,10 @@ function LF({ block: e, ctx: t }) {
34960
35093
  ]
34961
35094
  });
34962
35095
  }
34963
- function RF({ block: e, ctx: t }) {
35096
+ function zF({ block: e, ctx: t }) {
34964
35097
  switch (e.type) {
34965
- case "stats": return /* @__PURE__ */ L(jF, { block: e });
34966
- case "bars": return /* @__PURE__ */ L(AF, {
35098
+ case "stats": return /* @__PURE__ */ L(MF, { block: e });
35099
+ case "bars": return /* @__PURE__ */ L(jF, {
34967
35100
  title: e.title,
34968
35101
  finding: e.finding,
34969
35102
  testId: "ask-block-bars",
@@ -34973,36 +35106,36 @@ function RF({ block: e, ctx: t }) {
34973
35106
  count: e.count
34974
35107
  })) })
34975
35108
  });
34976
- case "heatmap": return /* @__PURE__ */ L(MF, { block: e });
34977
- case "chats": return /* @__PURE__ */ L(NF, {
35109
+ case "heatmap": return /* @__PURE__ */ L(NF, { block: e });
35110
+ case "chats": return /* @__PURE__ */ L(PF, {
34978
35111
  block: e,
34979
35112
  ctx: t
34980
35113
  });
34981
- case "customer": return /* @__PURE__ */ L(PF, {
35114
+ case "customer": return /* @__PURE__ */ L(FF, {
34982
35115
  block: e,
34983
35116
  ctx: t
34984
35117
  });
34985
- case "change": return /* @__PURE__ */ L(LF, {
35118
+ case "change": return /* @__PURE__ */ L(RF, {
34986
35119
  block: e,
34987
35120
  ctx: t
34988
35121
  });
34989
- case "test": return /* @__PURE__ */ L(zF, { test: e });
35122
+ case "test": return /* @__PURE__ */ L(BF, { test: e });
34990
35123
  }
34991
35124
  }
34992
- function zF({ test: e }) {
35125
+ function BF({ test: e }) {
34993
35126
  let { t } = P("inbox");
34994
- return /* @__PURE__ */ R(AF, {
35127
+ return /* @__PURE__ */ R(jF, {
34995
35128
  title: t("askEzy.test.title"),
34996
35129
  testId: "ask-block-test",
34997
- children: [/* @__PURE__ */ L(IF, { test: e }), /* @__PURE__ */ L("p", {
35130
+ children: [/* @__PURE__ */ L(LF, { test: e }), /* @__PURE__ */ L("p", {
34998
35131
  className: "text-xs text-muted-foreground",
34999
35132
  children: t("askEzy.test.note")
35000
35133
  })]
35001
35134
  });
35002
35135
  }
35003
35136
  // src/askezy/AskEzyPanel.tsx
35004
- var BF = 2e3;
35005
- function VF(e) {
35137
+ var VF = 2e3;
35138
+ function HF(e) {
35006
35139
  let t = [];
35007
35140
  for (let n of e) n.role === "user" ? t.push({
35008
35141
  role: "user",
@@ -35013,7 +35146,7 @@ function VF(e) {
35013
35146
  });
35014
35147
  return t.slice(-12);
35015
35148
  }
35016
- var HF = [
35149
+ var UF = [
35017
35150
  "list_chats",
35018
35151
  "get_chat",
35019
35152
  "get_messages",
@@ -35027,11 +35160,11 @@ var HF = [
35027
35160
  "try_ai_reply",
35028
35161
  "propose_ai_setup_change"
35029
35162
  ];
35030
- function UF(e, t) {
35031
- return e(`askEzy.read.${HF.includes(t.key) ? t.key : "other"}`, { count: t.count ?? 0 });
35163
+ function WF(e, t) {
35164
+ return e(`askEzy.read.${UF.includes(t.key) ? t.key : "other"}`, { count: t.count ?? 0 });
35032
35165
  }
35033
- var WF = () => window.matchMedia?.("(pointer: fine)").matches ?? !1;
35034
- function GF({ items: e, onPick: t }) {
35166
+ var GF = () => window.matchMedia?.("(pointer: fine)").matches ?? !1;
35167
+ function KF({ items: e, onPick: t }) {
35035
35168
  return /* @__PURE__ */ L("ul", {
35036
35169
  className: "flex flex-col items-start gap-1.5",
35037
35170
  children: e.map((e) => /* @__PURE__ */ L("li", { children: /* @__PURE__ */ R(W, {
@@ -35046,7 +35179,7 @@ function GF({ items: e, onPick: t }) {
35046
35179
  }) }, e))
35047
35180
  });
35048
35181
  }
35049
- function KF({ tone: e, title: t, body: n, action: r, testId: i }) {
35182
+ function qF({ tone: e, title: t, body: n, action: r, testId: i }) {
35050
35183
  return /* @__PURE__ */ L("div", {
35051
35184
  "data-testid": i,
35052
35185
  children: /* @__PURE__ */ R(q, {
@@ -35059,12 +35192,12 @@ function KF({ tone: e, title: t, body: n, action: r, testId: i }) {
35059
35192
  })
35060
35193
  });
35061
35194
  }
35062
- function qF(e) {
35195
+ function JF(e) {
35063
35196
  let t = [e.text];
35064
35197
  for (let n of e.blocks) n.type === "stats" && t.push(...n.items.map((e) => `${e.label}: ${e.value}${e.change ? ` (${e.change})` : ""}`)), n.type === "bars" && t.push(n.title, ...n.rows.map((e) => `- ${e.label}: ${e.count}`)), n.type === "chats" && t.push(n.title, ...n.chats.map((e) => `- ${e.name} (${e.wait}): ${e.preview}`)), n.type === "customer" && t.push(n.name, ...n.points.map((e) => `- ${e}`), `Next: ${n.next}`), n.type === "heatmap" && n.finding && t.push(n.finding);
35065
35198
  return t.join("\n");
35066
35199
  }
35067
- function JF() {
35200
+ function YF() {
35068
35201
  let { t: e } = P("inbox"), { user: t, isAdmin: n } = Sl(), { open: r, closePanel: i, takePending: a } = Yy(), o = Dc("(min-width: 1280px)");
35069
35202
  u(() => {
35070
35203
  let e = document.documentElement;
@@ -35084,9 +35217,9 @@ function JF() {
35084
35217
  let a = new AbortController();
35085
35218
  E.current = a;
35086
35219
  try {
35087
- let t = await kF({
35220
+ let t = await AF({
35088
35221
  question: n,
35089
- history: VF(s),
35222
+ history: HF(s),
35090
35223
  chatJid: r
35091
35224
  }, (e) => {
35092
35225
  O.current = [...O.current, e], y(O.current);
@@ -35102,7 +35235,7 @@ function JF() {
35102
35235
  }]), x(e("askEzy.readyWith", { first: t.text.split(/(?<=[.!?])\s/)[0] })), requestAnimationFrame(() => ee.current.get(i)?.scrollIntoView({
35103
35236
  block: "start",
35104
35237
  behavior: "smooth"
35105
- })), WF() && te.current?.focus({ preventScroll: !0 });
35238
+ })), GF() && te.current?.focus({ preventScroll: !0 });
35106
35239
  } catch (t) {
35107
35240
  let i = a.signal.aborted ? "stopped" : t instanceof fo ? t.code : "ai_unavailable";
35108
35241
  i === "ai_not_connected" && C(!1), c((e) => [...e, {
@@ -35131,7 +35264,7 @@ function JF() {
35131
35264
  }
35132
35265
  }));
35133
35266
  try {
35134
- let r = await OF(t, n);
35267
+ let r = await kF(t, n);
35135
35268
  T((e) => ({
35136
35269
  ...e,
35137
35270
  [t]: {
@@ -35154,12 +35287,12 @@ function JF() {
35154
35287
  };
35155
35288
  u(() => {
35156
35289
  if (!r) return;
35157
- DF().then((e) => C(e.connected)).catch(() => C(!0));
35290
+ OF().then((e) => C(e.connected)).catch(() => C(!0));
35158
35291
  let e = a();
35159
35292
  e?.chatJid && e.chatName && p({
35160
35293
  jid: e.chatJid,
35161
35294
  name: e.chatName
35162
- }), e?.question ? ne(e) : WF() && setTimeout(() => te.current?.focus(), 50);
35295
+ }), e?.question ? ne(e) : GF() && setTimeout(() => te.current?.focus(), 50);
35163
35296
  }, [r]);
35164
35297
  let j = s.some((e) => e.role === "ezy" && e.answer.blocks.some((e) => e.type === "change" && (w[e.id]?.status ?? e.status) !== "discarded")), [ae, oe] = g(!1), se = () => {
35165
35298
  E.current?.abort(), c([]), p(null), d(""), y([]), T({}), te.current?.focus();
@@ -35307,7 +35440,7 @@ function JF() {
35307
35440
  className: "text-sm font-medium text-muted-foreground",
35308
35441
  children: e("askEzy.tryOne")
35309
35442
  }),
35310
- /* @__PURE__ */ L(GF, {
35443
+ /* @__PURE__ */ L(KF, {
35311
35444
  items: M,
35312
35445
  onPick: (e) => void ne({ question: e })
35313
35446
  })
@@ -35325,7 +35458,7 @@ function JF() {
35325
35458
  className: "max-w-[85%] self-end rounded-lg rounded-br-sm bg-muted px-3 py-2 text-sm whitespace-pre-wrap",
35326
35459
  children: t.text
35327
35460
  }),
35328
- t.role === "ezy" && /* @__PURE__ */ L(YF, {
35461
+ t.role === "ezy" && /* @__PURE__ */ L(XF, {
35329
35462
  answer: t.answer,
35330
35463
  isAdmin: n,
35331
35464
  scopeJid: f?.jid ?? null,
@@ -35335,7 +35468,7 @@ function JF() {
35335
35468
  onAsk: (e) => void ne({ question: e }),
35336
35469
  onAskAgain: () => void ne(t.request)
35337
35470
  }),
35338
- t.role === "error" && (t.code === "ai_not_connected" ? /* @__PURE__ */ L(KF, {
35471
+ t.role === "error" && (t.code === "ai_not_connected" ? /* @__PURE__ */ L(qF, {
35339
35472
  tone: "info",
35340
35473
  testId: "ask-ezy-error",
35341
35474
  title: e("askEzy.noConnection.title"),
@@ -35350,7 +35483,7 @@ function JF() {
35350
35483
  e("askEzy.errors.stoppedBody"),
35351
35484
  t.steps.length > 0 && /* @__PURE__ */ L("span", {
35352
35485
  className: "block text-xs",
35353
- children: e("askEzy.steps", { steps: t.steps.map((t) => UF(e, t)).join(" · ") })
35486
+ children: e("askEzy.steps", { steps: t.steps.map((t) => WF(e, t)).join(" · ") })
35354
35487
  })
35355
35488
  ] }), /* @__PURE__ */ R(W, {
35356
35489
  size: "sm",
@@ -35360,7 +35493,7 @@ function JF() {
35360
35493
  disabled: m,
35361
35494
  children: [/* @__PURE__ */ L(yi, { "aria-hidden": !0 }), e("askEzy.errors.askAgain")]
35362
35495
  })]
35363
- }) : /* @__PURE__ */ L(KF, {
35496
+ }) : /* @__PURE__ */ L(qF, {
35364
35497
  tone: "warning",
35365
35498
  testId: "ask-ezy-error",
35366
35499
  title: le(t.code).title,
@@ -35415,7 +35548,7 @@ function JF() {
35415
35548
  children: [/* @__PURE__ */ L(Gn, {
35416
35549
  className: "size-3 text-success",
35417
35550
  "aria-hidden": !0
35418
- }), e("askEzy.reading", { what: UF(e, t) })]
35551
+ }), e("askEzy.reading", { what: WF(e, t) })]
35419
35552
  }, `${n}-${t.key}`))
35420
35553
  })]
35421
35554
  })
@@ -35447,7 +35580,7 @@ function JF() {
35447
35580
  children: [/* @__PURE__ */ L(gb, {
35448
35581
  ref: te,
35449
35582
  value: l,
35450
- maxLength: BF,
35583
+ maxLength: VF,
35451
35584
  rows: 1,
35452
35585
  disabled: !S,
35453
35586
  placeholder: e(n ? "askEzy.placeholder" : "askEzy.placeholderMember"),
@@ -35489,10 +35622,10 @@ function JF() {
35489
35622
  })
35490
35623
  });
35491
35624
  }
35492
- function YF({ answer: e, isAdmin: t, scopeJid: n, changes: r, onChange: i, onNavigate: a, onAsk: o, onAskAgain: s }) {
35625
+ function XF({ answer: e, isAdmin: t, scopeJid: n, changes: r, onChange: i, onNavigate: a, onAsk: o, onAskAgain: s }) {
35493
35626
  let { t: c } = P("inbox"), l = window.matchMedia?.("(min-width: 640px)").matches ?? !0, u = e.blocks.filter((e) => e.type === "change" && (r[e.id]?.status ?? e.status) === "proposed" && !r[e.id]?.error), d = async () => {
35494
35627
  try {
35495
- await navigator.clipboard.writeText(qF(e)), z.success(c("askEzy.copied"));
35628
+ await navigator.clipboard.writeText(JF(e)), z.success(c("askEzy.copied"));
35496
35629
  } catch {
35497
35630
  z.error(c("askEzy.copyFailed"));
35498
35631
  }
@@ -35508,7 +35641,7 @@ function YF({ answer: e, isAdmin: t, scopeJid: n, changes: r, onChange: i, onNav
35508
35641
  "aria-hidden": !0
35509
35642
  }), /* @__PURE__ */ L("span", { children: e.text })]
35510
35643
  }),
35511
- e.blocks.map((e, t) => /* @__PURE__ */ L(RF, {
35644
+ e.blocks.map((e, t) => /* @__PURE__ */ L(zF, {
35512
35645
  block: e,
35513
35646
  ctx: {
35514
35647
  scopeJid: n,
@@ -35539,9 +35672,9 @@ function YF({ answer: e, isAdmin: t, scopeJid: n, changes: r, onChange: i, onNav
35539
35672
  }),
35540
35673
  e.steps.length > 0 && /* @__PURE__ */ L("p", {
35541
35674
  className: "text-sm text-muted-foreground",
35542
- children: c("askEzy.steps", { steps: e.steps.map((e) => UF(c, e)).join(" · ") })
35675
+ children: c("askEzy.steps", { steps: e.steps.map((e) => WF(c, e)).join(" · ") })
35543
35676
  }),
35544
- e.followUps.length > 0 && /* @__PURE__ */ L(GF, {
35677
+ e.followUps.length > 0 && /* @__PURE__ */ L(KF, {
35545
35678
  items: e.followUps,
35546
35679
  onPick: o
35547
35680
  }),
@@ -35559,54 +35692,54 @@ function YF({ answer: e, isAdmin: t, scopeJid: n, changes: r, onChange: i, onNav
35559
35692
  });
35560
35693
  }
35561
35694
  // src/App.tsx
35562
- function XF() {
35695
+ function ZF() {
35563
35696
  let { user: e } = Sl();
35564
- return e ? /* @__PURE__ */ L(mu, { children: /* @__PURE__ */ L(JF, {}) }) : null;
35697
+ return e ? /* @__PURE__ */ L(mu, { children: /* @__PURE__ */ L(YF, {}) }) : null;
35565
35698
  }
35566
- function ZF() {
35699
+ function QF() {
35567
35700
  let { pathname: e } = re(), t = Au();
35568
35701
  return /* @__PURE__ */ L(mu, {
35569
35702
  resetKey: e,
35570
35703
  children: /* @__PURE__ */ R(Jy, { children: [
35571
35704
  /* @__PURE__ */ L(Bl, {}),
35572
- /* @__PURE__ */ L(EF, {}),
35573
- /* @__PURE__ */ L(XF, {}),
35705
+ /* @__PURE__ */ L(DF, {}),
35706
+ /* @__PURE__ */ L(ZF, {}),
35574
35707
  /* @__PURE__ */ R(te, { children: [
35575
35708
  /* @__PURE__ */ L(A, {
35576
35709
  path: "/setup",
35577
- element: /* @__PURE__ */ L(TF, {})
35710
+ element: /* @__PURE__ */ L(EF, {})
35578
35711
  }),
35579
35712
  /* @__PURE__ */ L(A, {
35580
35713
  path: "/login",
35581
- element: /* @__PURE__ */ L(aj, {})
35714
+ element: /* @__PURE__ */ L(oj, {})
35582
35715
  }),
35583
35716
  /* @__PURE__ */ L(A, {
35584
35717
  path: "/change-password",
35585
- element: /* @__PURE__ */ L(cj, { children: /* @__PURE__ */ L(rj, {}) })
35718
+ element: /* @__PURE__ */ L(lj, { children: /* @__PURE__ */ L(ij, {}) })
35586
35719
  }),
35587
35720
  /* @__PURE__ */ R(A, {
35588
- element: /* @__PURE__ */ L(cj, {}),
35721
+ element: /* @__PURE__ */ L(lj, {}),
35589
35722
  children: [
35590
35723
  /* @__PURE__ */ L(A, {
35591
35724
  path: "/",
35592
- element: /* @__PURE__ */ L($P, {})
35725
+ element: /* @__PURE__ */ L(eF, {})
35593
35726
  }),
35594
35727
  /* @__PURE__ */ L(A, {
35595
35728
  path: "/oauth/authorize",
35596
- element: /* @__PURE__ */ L(sj, {})
35729
+ element: /* @__PURE__ */ L(cj, {})
35597
35730
  }),
35598
35731
  /* @__PURE__ */ L(A, {
35599
35732
  path: "/chats/:jid",
35600
- element: /* @__PURE__ */ L($P, {})
35733
+ element: /* @__PURE__ */ L(eF, {})
35601
35734
  }),
35602
35735
  Pu(t, !1)
35603
35736
  ]
35604
35737
  }),
35605
35738
  /* @__PURE__ */ L(A, {
35606
35739
  path: "/admin/*",
35607
- element: /* @__PURE__ */ L(cj, {
35740
+ element: /* @__PURE__ */ L(lj, {
35608
35741
  admin: !0,
35609
- children: /* @__PURE__ */ L(XA, {})
35742
+ children: /* @__PURE__ */ L(ZA, {})
35610
35743
  })
35611
35744
  }),
35612
35745
  /* @__PURE__ */ L(A, {
@@ -35621,8 +35754,8 @@ function ZF() {
35621
35754
  });
35622
35755
  }
35623
35756
  // src/access/AccessGate.tsx
35624
- var QF = 6e4, $F = 5e3;
35625
- async function eI(e) {
35757
+ var $F = 6e4, eI = 5e3;
35758
+ async function tI(e) {
35626
35759
  try {
35627
35760
  let t = await fetch("/api/access", {
35628
35761
  headers: { accept: "application/json" },
@@ -35636,10 +35769,10 @@ async function eI(e) {
35636
35769
  return null;
35637
35770
  }
35638
35771
  }
35639
- function tI() {
35772
+ function nI() {
35640
35773
  window.location.reload();
35641
35774
  }
35642
- function nI({ children: e, reload: t = tI }) {
35775
+ function rI({ children: e, reload: t = nI }) {
35643
35776
  let n = Au(), [r, i] = g({ status: "loading" }), a = h(r);
35644
35777
  u(() => {
35645
35778
  a.current = r;
@@ -35648,7 +35781,7 @@ function nI({ children: e, reload: t = tI }) {
35648
35781
  if (!c.current) {
35649
35782
  c.current = !0, o.current = Date.now();
35650
35783
  try {
35651
- let e = await eI(), n = a.current;
35784
+ let e = await tI(), n = a.current;
35652
35785
  e && !e.open ? i({
35653
35786
  status: "closed",
35654
35787
  code: e.code ?? "access_closed",
@@ -35669,7 +35802,7 @@ function nI({ children: e, reload: t = tI }) {
35669
35802
  confirmed: !1
35670
35803
  }), t());
35671
35804
  }, t = () => {
35672
- Date.now() - o.current >= $F && l();
35805
+ Date.now() - o.current >= eI && l();
35673
35806
  };
35674
35807
  return window.addEventListener(La, e), window.addEventListener(Ra, t), () => {
35675
35808
  window.removeEventListener(La, e), window.removeEventListener(Ra, t);
@@ -35678,13 +35811,13 @@ function nI({ children: e, reload: t = tI }) {
35678
35811
  let d = r.status === "closed";
35679
35812
  u(() => {
35680
35813
  if (!d) return;
35681
- let e = setInterval(() => void l(), QF);
35814
+ let e = setInterval(() => void l(), $F);
35682
35815
  return () => clearInterval(e);
35683
35816
  }, [d, l]);
35684
35817
  let f = s(() => void l(), [l]);
35685
- if (r.status === "loading") return /* @__PURE__ */ L(nj, {});
35818
+ if (r.status === "loading") return /* @__PURE__ */ L(rj, {});
35686
35819
  if (r.status === "open") return /* @__PURE__ */ L(I, { children: e });
35687
- let p = n.find((e) => e.lockScreen)?.lockScreen, m = /* @__PURE__ */ L(rI, {
35820
+ let p = n.find((e) => e.lockScreen)?.lockScreen, m = /* @__PURE__ */ L(iI, {
35688
35821
  code: r.code,
35689
35822
  recheck: f
35690
35823
  });
@@ -35696,13 +35829,13 @@ function nI({ children: e, reload: t = tI }) {
35696
35829
  }) : m
35697
35830
  });
35698
35831
  }
35699
- function rI({ code: e, recheck: t }) {
35832
+ function iI({ code: e, recheck: t }) {
35700
35833
  let { t: n } = P(), [r, i] = g(!1);
35701
35834
  return u(() => {
35702
35835
  if (!r) return;
35703
35836
  let e = setTimeout(() => i(!1), 1500);
35704
35837
  return () => clearTimeout(e);
35705
- }, [r]), /* @__PURE__ */ L($A, {
35838
+ }, [r]), /* @__PURE__ */ L(ej, {
35706
35839
  title: n("access.pausedTitle"),
35707
35840
  subtitle: n("access.pausedBody"),
35708
35841
  languageSelect: !1,
@@ -35739,7 +35872,7 @@ function rI({ code: e, recheck: t }) {
35739
35872
  });
35740
35873
  }
35741
35874
  // src/components/ui/sonner.tsx
35742
- var iI = ({ ...e }) => {
35875
+ var aI = ({ ...e }) => {
35743
35876
  let { resolvedTheme: t } = yO();
35744
35877
  return /* @__PURE__ */ L(Pa, {
35745
35878
  theme: t,
@@ -35761,26 +35894,26 @@ var iI = ({ ...e }) => {
35761
35894
  });
35762
35895
  };
35763
35896
  // src/components/ui/tooltip.tsx
35764
- function aI({ delayDuration: e = 0, ...t }) {
35897
+ function oI({ delayDuration: e = 0, ...t }) {
35765
35898
  return /* @__PURE__ */ L(Da.Provider, {
35766
35899
  "data-slot": "tooltip-provider",
35767
35900
  delayDuration: e,
35768
35901
  ...t
35769
35902
  });
35770
35903
  }
35771
- function oI({ ...e }) {
35904
+ function sI({ ...e }) {
35772
35905
  return /* @__PURE__ */ L(Da.Root, {
35773
35906
  "data-slot": "tooltip",
35774
35907
  ...e
35775
35908
  });
35776
35909
  }
35777
- function sI({ ...e }) {
35910
+ function cI({ ...e }) {
35778
35911
  return /* @__PURE__ */ L(Da.Trigger, {
35779
35912
  "data-slot": "tooltip-trigger",
35780
35913
  ...e
35781
35914
  });
35782
35915
  }
35783
- function cI({ className: e, sideOffset: t = 0, children: n, ...r }) {
35916
+ function lI({ className: e, sideOffset: t = 0, children: n, ...r }) {
35784
35917
  return /* @__PURE__ */ L(Da.Portal, { children: /* @__PURE__ */ R(Da.Content, {
35785
35918
  "data-slot": "tooltip-content",
35786
35919
  sideOffset: t,
@@ -35790,14 +35923,14 @@ function cI({ className: e, sideOffset: t = 0, children: n, ...r }) {
35790
35923
  }) });
35791
35924
  }
35792
35925
  // src/i18n/LocaleSync.tsx
35793
- function lI() {
35926
+ function uI() {
35794
35927
  let { user: e } = Sl(), { t } = P(), n = e?.locale ?? null;
35795
35928
  return u(() => {
35796
35929
  n && n !== dO.getSnapshot() && dO.setLocale(n).catch(() => z.error(t("language.loadFailed")));
35797
35930
  }, [n, t]), null;
35798
35931
  }
35799
35932
  // src/create-app.tsx
35800
- function uI() {
35933
+ function dI() {
35801
35934
  return new y({ defaultOptions: {
35802
35935
  queries: {
35803
35936
  staleTime: 15e3,
@@ -35807,20 +35940,20 @@ function uI() {
35807
35940
  mutations: { retry: !1 }
35808
35941
  } });
35809
35942
  }
35810
- async function dI({ extensions: e = [], root: t = document.getElementById("root") ?? void 0, productName: r, links: i } = {}) {
35943
+ async function fI({ extensions: e = [], root: t = document.getElementById("root") ?? void 0, productName: r, links: i } = {}) {
35811
35944
  Du(e);
35812
35945
  let a = dl(i);
35813
35946
  if (r !== void 0 && ao(r), !t) throw Error("#root missing");
35814
35947
  yo(), jb();
35815
- let o = uI(), s = () => v(t).render(/* @__PURE__ */ L(n, { children: /* @__PURE__ */ L(b, {
35948
+ let o = dI(), s = () => v(t).render(/* @__PURE__ */ L(n, { children: /* @__PURE__ */ L(b, {
35816
35949
  client: o,
35817
35950
  children: /* @__PURE__ */ L(E, { children: /* @__PURE__ */ L(ku, {
35818
35951
  extensions: e,
35819
35952
  children: /* @__PURE__ */ L(gl, {
35820
35953
  links: a,
35821
- children: /* @__PURE__ */ R(aI, {
35954
+ children: /* @__PURE__ */ R(oI, {
35822
35955
  delayDuration: 300,
35823
- children: [/* @__PURE__ */ L(nI, { children: /* @__PURE__ */ R(xl, { children: [/* @__PURE__ */ L(lI, {}), /* @__PURE__ */ L(Tc, { children: /* @__PURE__ */ L(ZF, {}) })] }) }), /* @__PURE__ */ L(iI, {
35956
+ children: [/* @__PURE__ */ L(rI, { children: /* @__PURE__ */ R(xl, { children: [/* @__PURE__ */ L(uI, {}), /* @__PURE__ */ L(Tc, { children: /* @__PURE__ */ L(QF, {}) })] }) }), /* @__PURE__ */ L(aI, {
35824
35957
  position: "top-center",
35825
35958
  closeButton: !0,
35826
35959
  richColors: !1
@@ -35832,4 +35965,4 @@ async function dI({ extensions: e = [], root: t = document.getElementById("root"
35832
35965
  for (let e of Object.values(c)) e().then((e) => (e.registerSW ?? e.default)?.()).catch((e) => console.warn("Service worker registration failed", e));
35833
35966
  await (e.length > 0 ? ju(e) : Promise.resolve()).then(() => dO.ready()).catch((e) => console.warn("Language load failed", e)).finally(s);
35834
35967
  }
35835
- export { ax as AlertDialog, hx as AlertDialogAction, gx as AlertDialogCancel, lx as AlertDialogContent, px as AlertDialogDescription, dx as AlertDialogFooter, ux as AlertDialogHeader, mx as AlertDialogMedia, cx as AlertDialogOverlay, sx as AlertDialogPortal, fx as AlertDialogTitle, ox as AlertDialogTrigger, fo as ApiError, QA as AppMark, $A as AuthShell, vC as Avatar, xC as AvatarBadge, bC as AvatarFallback, SC as AvatarGroup, CC as AvatarGroupCount, yC as AvatarImage, G as Badge, q as Banner, W as Button, X as Card, rb as CardAction, $ as CardContent, nb as CardDescription, ib as CardFooter, Z as CardHeader, Q as CardTitle, Pb as Checkbox, wj as Command, Tj as CommandDialog, Oj as CommandEmpty, kj as CommandGroup, Ej as CommandInput, jj as CommandItem, Dj as CommandList, Aj as CommandSeparator, Mj as CommandShortcut, Oc as Dialog, jc as DialogClose, Nc as DialogContent, Lc as DialogDescription, Fc as DialogFooter, Pc as DialogHeader, Mc as DialogOverlay, Ac as DialogPortal, Ic as DialogTitle, kc as DialogTrigger, Rc as Drawer, Vc as DrawerClose, Uc as DrawerContent, qc as DrawerDescription, Gc as DrawerFooter, Wc as DrawerHeader, Hc as DrawerOverlay, Bc as DrawerPortal, Kc as DrawerTitle, zc as DrawerTrigger, Fb as DropdownMenu, Vb as DropdownMenuCheckboxItem, Rb as DropdownMenuContent, zb as DropdownMenuGroup, Bb as DropdownMenuItem, Wb as DropdownMenuLabel, Ib as DropdownMenuPortal, Hb as DropdownMenuRadioGroup, Ub as DropdownMenuRadioItem, Gb as DropdownMenuSeparator, Kb as DropdownMenuShortcut, qb as DropdownMenuSub, Yb as DropdownMenuSubContent, Jb as DropdownMenuSubTrigger, Lb as DropdownMenuTrigger, _u as EXTENSION_NAME_PATTERN, ou as EmptyState, mu as ErrorBoundary, Ex as InfoTip, ab as Input, ul as LITE_APP_LINKS, K as Label, fu as PageHeader, rI as PausedScreen, _x as Popover, bx as PopoverAnchor, yx as PopoverContent, Cx as PopoverDescription, xx as PopoverHeader, Sx as PopoverTitle, vx as PopoverTrigger, Vl as Progress, ru as RadioGroup, iu as RadioGroupItem, du as ResponsiveDialog, pu as ResponsiveTable, $k as ScrollArea, eA as ScrollBar, au as SegmentedControl, ob as Select, ub as SelectContent, sb as SelectGroup, fb as SelectItem, db as SelectLabel, hb as SelectScrollDownButton, mb as SelectScrollUpButton, pb as SelectSeparator, lb as SelectTrigger, cb as SelectValue, Iy as Separator, Ly as Sheet, zy as SheetClose, Hy as SheetContent, Ky as SheetDescription, Wy as SheetFooter, Uy as SheetHeader, Gy as SheetTitle, Ry as SheetTrigger, ix as Skeleton, Uu as SlimBanner, cu as StatusDot, My as Switch, Jc as TIP_TOPICS, Xb as Table, Qb as TableBody, rx as TableCaption, nx as TableCell, $b as TableFooter, tx as TableHead, Zb as TableHeader, ex as TableRow, Hw as Tabs, Kw as TabsContent, Ww as TabsList, Gw as TabsTrigger, gb as Textarea, iI as Toaster, oI as Tooltip, cI as TooltipContent, aI as TooltipProvider, sI as TooltipTrigger, fn as Trans, gu as WEB_EXTENSION_ADMIN_SECTIONS, Cu as WebExtensionError, B as api, Rl as badgeVariants, Ec as buttonVariants, U as cn, dI as createInboxApp, V as errorMessage, Tu as extensionKeyPrefix, Eu as extensionPath, Uw as tabsListVariants, Bu as useAgentSection, _l as useAppLinks, Sl as useAuth, Mu as useExtensionTranslation, hn as useTranslation, Du as validateWebExtensions };
35968
+ export { ax as AlertDialog, hx as AlertDialogAction, gx as AlertDialogCancel, lx as AlertDialogContent, px as AlertDialogDescription, dx as AlertDialogFooter, ux as AlertDialogHeader, mx as AlertDialogMedia, cx as AlertDialogOverlay, sx as AlertDialogPortal, fx as AlertDialogTitle, ox as AlertDialogTrigger, fo as ApiError, $A as AppMark, ej as AuthShell, vC as Avatar, xC as AvatarBadge, bC as AvatarFallback, SC as AvatarGroup, CC as AvatarGroupCount, yC as AvatarImage, G as Badge, q as Banner, W as Button, X as Card, rb as CardAction, $ as CardContent, nb as CardDescription, ib as CardFooter, Z as CardHeader, Q as CardTitle, Pb as Checkbox, Tj as Command, Ej as CommandDialog, kj as CommandEmpty, Aj as CommandGroup, Dj as CommandInput, Mj as CommandItem, Oj as CommandList, jj as CommandSeparator, Nj as CommandShortcut, Oc as Dialog, jc as DialogClose, Nc as DialogContent, Lc as DialogDescription, Fc as DialogFooter, Pc as DialogHeader, Mc as DialogOverlay, Ac as DialogPortal, Ic as DialogTitle, kc as DialogTrigger, Rc as Drawer, Vc as DrawerClose, Uc as DrawerContent, qc as DrawerDescription, Gc as DrawerFooter, Wc as DrawerHeader, Hc as DrawerOverlay, Bc as DrawerPortal, Kc as DrawerTitle, zc as DrawerTrigger, Fb as DropdownMenu, Vb as DropdownMenuCheckboxItem, Rb as DropdownMenuContent, zb as DropdownMenuGroup, Bb as DropdownMenuItem, Wb as DropdownMenuLabel, Ib as DropdownMenuPortal, Hb as DropdownMenuRadioGroup, Ub as DropdownMenuRadioItem, Gb as DropdownMenuSeparator, Kb as DropdownMenuShortcut, qb as DropdownMenuSub, Yb as DropdownMenuSubContent, Jb as DropdownMenuSubTrigger, Lb as DropdownMenuTrigger, _u as EXTENSION_NAME_PATTERN, ou as EmptyState, mu as ErrorBoundary, Ex as InfoTip, ab as Input, ul as LITE_APP_LINKS, K as Label, fu as PageHeader, iI as PausedScreen, _x as Popover, bx as PopoverAnchor, yx as PopoverContent, Cx as PopoverDescription, xx as PopoverHeader, Sx as PopoverTitle, vx as PopoverTrigger, Vl as Progress, ru as RadioGroup, iu as RadioGroupItem, du as ResponsiveDialog, pu as ResponsiveTable, $k as ScrollArea, eA as ScrollBar, au as SegmentedControl, ob as Select, ub as SelectContent, sb as SelectGroup, fb as SelectItem, db as SelectLabel, hb as SelectScrollDownButton, mb as SelectScrollUpButton, pb as SelectSeparator, lb as SelectTrigger, cb as SelectValue, Iy as Separator, Ly as Sheet, zy as SheetClose, Hy as SheetContent, Ky as SheetDescription, Wy as SheetFooter, Uy as SheetHeader, Gy as SheetTitle, Ry as SheetTrigger, ix as Skeleton, Uu as SlimBanner, cu as StatusDot, My as Switch, Jc as TIP_TOPICS, Xb as Table, Qb as TableBody, rx as TableCaption, nx as TableCell, $b as TableFooter, tx as TableHead, Zb as TableHeader, ex as TableRow, Hw as Tabs, Kw as TabsContent, Ww as TabsList, Gw as TabsTrigger, gb as Textarea, aI as Toaster, sI as Tooltip, lI as TooltipContent, oI as TooltipProvider, cI as TooltipTrigger, fn as Trans, gu as WEB_EXTENSION_ADMIN_SECTIONS, Cu as WebExtensionError, B as api, Rl as badgeVariants, Ec as buttonVariants, U as cn, fI as createInboxApp, V as errorMessage, Tu as extensionKeyPrefix, Eu as extensionPath, Uw as tabsListVariants, Bu as useAgentSection, _l as useAppLinks, Sl as useAuth, Mu as useExtensionTranslation, hn as useTranslation, Du as validateWebExtensions };