@lambda-development/erp-core 0.6.10 → 0.6.11
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/components/ui/confirm-button.d.ts +8 -1
- package/dist/index.js +123 -115
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,6 +9,13 @@ interface ConfirmButtonProps {
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
className?: string;
|
|
11
11
|
timeout?: number;
|
|
12
|
+
/** Armed-button size: "sm" (compact, for icon triggers — default) or "md"
|
|
13
|
+
* (normal button height, to match a full-size labelled trigger). */
|
|
14
|
+
size?: "sm" | "md";
|
|
15
|
+
/** Which side the Cancel button sits on when armed. It should land where the
|
|
16
|
+
* trigger was so a double-click cancels: "left" for a left-aligned trigger
|
|
17
|
+
* (default), "right" for a right-aligned one (e.g. a toolbar delete button). */
|
|
18
|
+
cancelSide?: "left" | "right";
|
|
12
19
|
}
|
|
13
|
-
export declare function ConfirmButton({ onConfirm, children, confirmLabel, cancelLabel, title, danger, disabled, className, timeout, }: ConfirmButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function ConfirmButton({ onConfirm, children, confirmLabel, cancelLabel, title, danger, disabled, className, timeout, size, cancelSide, }: ConfirmButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
14
21
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ async function L(t, n) {
|
|
|
51
51
|
}
|
|
52
52
|
return a.json();
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Be(t) {
|
|
55
55
|
if (!t) return "";
|
|
56
56
|
const n = Object.fromEntries(
|
|
57
57
|
Object.entries(t).filter(([, s]) => s !== void 0 && s !== "")
|
|
@@ -89,12 +89,12 @@ const R = {
|
|
|
89
89
|
),
|
|
90
90
|
// Documents
|
|
91
91
|
listDocuments: (t, n) => L(
|
|
92
|
-
`/documents/${t}${
|
|
92
|
+
`/documents/${t}${Be(n)}`
|
|
93
93
|
),
|
|
94
94
|
getDocument: (t, n) => L(`/documents/${t}/${encodeURIComponent(n)}`),
|
|
95
95
|
// Prev/next record around `name` in the same order+filters the list uses.
|
|
96
96
|
adjacentDocument: (t, n, a) => L(
|
|
97
|
-
`/documents/${t}/${encodeURIComponent(n)}/adjacent${
|
|
97
|
+
`/documents/${t}/${encodeURIComponent(n)}/adjacent${Be(a)}`
|
|
98
98
|
),
|
|
99
99
|
// Prev/next master record around `name` in the master list's order (name ASC).
|
|
100
100
|
adjacentMaster: (t, n) => L(
|
|
@@ -115,7 +115,7 @@ const R = {
|
|
|
115
115
|
// Proposal (Sammelofferte) extras — CRUD goes through the document methods
|
|
116
116
|
// above (doctype "proposal"); these cover the appendix blob + cover default.
|
|
117
117
|
getProposalCoverDefault: (t, n) => L(
|
|
118
|
-
`/proposals/cover-default${
|
|
118
|
+
`/proposals/cover-default${Be({ company: t, customer: n })}`
|
|
119
119
|
),
|
|
120
120
|
uploadProposalAppendix: async (t, n) => {
|
|
121
121
|
const a = new FormData();
|
|
@@ -137,7 +137,7 @@ const R = {
|
|
|
137
137
|
proposalPdfUrl: (t) => `${ct}/documents/proposal/${encodeURIComponent(t)}/pdf`,
|
|
138
138
|
// Masters
|
|
139
139
|
listMasters: (t, n) => L(
|
|
140
|
-
`/masters/${t}${
|
|
140
|
+
`/masters/${t}${Be(n)}`
|
|
141
141
|
),
|
|
142
142
|
searchMasters: (t, n) => L(`/masters/${t}/search?q=${encodeURIComponent(n)}`),
|
|
143
143
|
searchDocuments: (t, n) => L(`/documents/${t}/search?q=${encodeURIComponent(n)}`),
|
|
@@ -151,7 +151,7 @@ const R = {
|
|
|
151
151
|
},
|
|
152
152
|
getMaster: (t, n) => L(`/masters/${t}/${encodeURIComponent(n)}`),
|
|
153
153
|
currencies: (t) => L(
|
|
154
|
-
`/accounting/currencies${
|
|
154
|
+
`/accounting/currencies${Be({ company: t })}`
|
|
155
155
|
),
|
|
156
156
|
createMaster: (t, n) => L(`/masters/${t}`, { method: "POST", body: JSON.stringify(n) }),
|
|
157
157
|
updateMaster: (t, n, a) => L(`/masters/${t}/${encodeURIComponent(n)}`, {
|
|
@@ -161,20 +161,20 @@ const R = {
|
|
|
161
161
|
deleteMaster: (t, n) => L(`/masters/${t}/${encodeURIComponent(n)}`, { method: "DELETE" }),
|
|
162
162
|
// Reports
|
|
163
163
|
trialBalance: (t) => L(
|
|
164
|
-
`/reports/trial-balance${
|
|
164
|
+
`/reports/trial-balance${Be(t)}`
|
|
165
165
|
),
|
|
166
166
|
chartOfAccounts: (t) => L(
|
|
167
|
-
`/reports/chart-of-accounts${
|
|
167
|
+
`/reports/chart-of-accounts${Be(t)}`
|
|
168
168
|
),
|
|
169
|
-
generalLedger: (t) => L(`/reports/general-ledger${
|
|
170
|
-
stockBalance: (t) => L(`/reports/stock-balance${
|
|
171
|
-
dashboardSummary: (t) => L(`/reports/dashboard-summary${
|
|
172
|
-
profitAndLoss: (t) => L(`/reports/profit-and-loss${
|
|
173
|
-
balanceSheet: (t) => L(`/reports/balance-sheet${
|
|
174
|
-
arAging: (t) => L(`/reports/ar-aging${
|
|
175
|
-
apAging: (t) => L(`/reports/ap-aging${
|
|
169
|
+
generalLedger: (t) => L(`/reports/general-ledger${Be(t)}`),
|
|
170
|
+
stockBalance: (t) => L(`/reports/stock-balance${Be(t)}`),
|
|
171
|
+
dashboardSummary: (t) => L(`/reports/dashboard-summary${Be({ company: t })}`),
|
|
172
|
+
profitAndLoss: (t) => L(`/reports/profit-and-loss${Be(t)}`),
|
|
173
|
+
balanceSheet: (t) => L(`/reports/balance-sheet${Be(t)}`),
|
|
174
|
+
arAging: (t) => L(`/reports/ar-aging${Be(t)}`),
|
|
175
|
+
apAging: (t) => L(`/reports/ap-aging${Be(t)}`),
|
|
176
176
|
analyticsMetrics: () => L("/reports/analytics/metrics"),
|
|
177
|
-
analytics: (t) => L(`/reports/analytics${
|
|
177
|
+
analytics: (t) => L(`/reports/analytics${Be(t)}`),
|
|
178
178
|
runtimeDatasets: () => L("/reports/runtime/datasets"),
|
|
179
179
|
runtimeData: (t) => L("/reports/runtime/data", { method: "POST", body: JSON.stringify(t) }),
|
|
180
180
|
createRuntimeDraft: (t) => L("/reports/runtime/drafts", { method: "POST", body: JSON.stringify(t) }),
|
|
@@ -413,16 +413,16 @@ function hr({ children: t }) {
|
|
|
413
413
|
}
|
|
414
414
|
function ie(I, K, Y) {
|
|
415
415
|
return new Promise((xe, we) => {
|
|
416
|
-
const
|
|
417
|
-
$.current.set(
|
|
416
|
+
const Re = pr();
|
|
417
|
+
$.current.set(Re, {
|
|
418
418
|
expectedType: Y,
|
|
419
419
|
resolve: xe,
|
|
420
420
|
reject: we
|
|
421
421
|
});
|
|
422
422
|
try {
|
|
423
|
-
B({ type: I, request_id:
|
|
423
|
+
B({ type: I, request_id: Re, ...K });
|
|
424
424
|
} catch (ot) {
|
|
425
|
-
$.current.delete(
|
|
425
|
+
$.current.delete(Re), we(ot instanceof Error ? ot : new Error("Chat request failed."));
|
|
426
426
|
}
|
|
427
427
|
});
|
|
428
428
|
}
|
|
@@ -437,11 +437,11 @@ function hr({ children: t }) {
|
|
|
437
437
|
we.close();
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
|
-
D("connected"), E((
|
|
441
|
-
}, we.onmessage = (
|
|
440
|
+
D("connected"), E((Re) => Re + 1);
|
|
441
|
+
}, we.onmessage = (Re) => {
|
|
442
442
|
var ot;
|
|
443
443
|
try {
|
|
444
|
-
const j = JSON.parse(
|
|
444
|
+
const j = JSON.parse(Re.data), Ze = typeof j.request_id == "string" ? j.request_id : null, fe = typeof j.type == "string" ? j.type : null, O = typeof j.session_id == "string" ? j.session_id : null;
|
|
445
445
|
if (Ze) {
|
|
446
446
|
const q = $.current.get(Ze);
|
|
447
447
|
q && (fe === "error" ? ($.current.delete(Ze), q.reject(new Error(String(j.content || "Request failed.")))) : fe === q.expectedType && ($.current.delete(Ze), q.resolve(j)));
|
|
@@ -659,9 +659,9 @@ function hr({ children: t }) {
|
|
|
659
659
|
}
|
|
660
660
|
}, we.onerror = () => {
|
|
661
661
|
we.close();
|
|
662
|
-
}, we.onclose = (
|
|
662
|
+
}, we.onclose = (Re) => {
|
|
663
663
|
if (G.current === we && (G.current = null), T("Chat disconnected."), D("disconnected"), !I) {
|
|
664
|
-
if (
|
|
664
|
+
if (Re.code === 4001 || Re.code === 4003) {
|
|
665
665
|
window.location.href = "/login";
|
|
666
666
|
return;
|
|
667
667
|
}
|
|
@@ -684,7 +684,7 @@ function hr({ children: t }) {
|
|
|
684
684
|
});
|
|
685
685
|
return te.current = I, I;
|
|
686
686
|
}
|
|
687
|
-
async function
|
|
687
|
+
async function Te(I) {
|
|
688
688
|
se(I, "running"), _(I, null);
|
|
689
689
|
try {
|
|
690
690
|
await ie("start_demo", { session_id: I }, "demo_started");
|
|
@@ -728,17 +728,17 @@ function hr({ children: t }) {
|
|
|
728
728
|
if (!xe && !we) return !1;
|
|
729
729
|
try {
|
|
730
730
|
X(I, !0);
|
|
731
|
-
const
|
|
731
|
+
const Re = {
|
|
732
732
|
type: "send_message",
|
|
733
733
|
session_id: I,
|
|
734
734
|
content: xe
|
|
735
735
|
};
|
|
736
|
-
return we && (
|
|
736
|
+
return we && (Re.attachment_ids = Y), B(Re), !0;
|
|
737
737
|
} catch {
|
|
738
738
|
return X(I, !1), !1;
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
async function
|
|
741
|
+
async function Ie(I, K, Y) {
|
|
742
742
|
const xe = await ie(
|
|
743
743
|
"transcribe",
|
|
744
744
|
{ audio_data: I, audio_format: K, session_id: Y },
|
|
@@ -775,14 +775,14 @@ function hr({ children: t }) {
|
|
|
775
775
|
connectionVersion: N,
|
|
776
776
|
navigationFlash: v,
|
|
777
777
|
createSession: Le,
|
|
778
|
-
startDemo:
|
|
778
|
+
startDemo: Te,
|
|
779
779
|
completeDemoTyping: Ke,
|
|
780
780
|
deleteSession: Fe,
|
|
781
781
|
loadHistory: xt,
|
|
782
782
|
loadMoreHistory: pt,
|
|
783
783
|
clearHistory: Je,
|
|
784
784
|
sendMessage: De,
|
|
785
|
-
transcribeAudio:
|
|
785
|
+
transcribeAudio: Ie,
|
|
786
786
|
getMessages: je,
|
|
787
787
|
hasMoreHistory: Oe,
|
|
788
788
|
isLoadingOlder: ht,
|
|
@@ -800,7 +800,7 @@ function mt() {
|
|
|
800
800
|
throw new Error("useChat must be used within ChatProvider.");
|
|
801
801
|
return t;
|
|
802
802
|
}
|
|
803
|
-
function
|
|
803
|
+
function _e(...t) {
|
|
804
804
|
return t.filter(Boolean).join(" ");
|
|
805
805
|
}
|
|
806
806
|
function qe(t, n = "USD") {
|
|
@@ -859,7 +859,7 @@ function Q({
|
|
|
859
859
|
type: l,
|
|
860
860
|
disabled: a,
|
|
861
861
|
onClick: s,
|
|
862
|
-
className:
|
|
862
|
+
className: _e(
|
|
863
863
|
// Layout + base interaction. focus-visible (not :focus) so
|
|
864
864
|
// mouse clicks don't leave a permanent ring; only keyboard
|
|
865
865
|
// navigation gets the visible outline.
|
|
@@ -892,7 +892,7 @@ function ee({ label: t, hint: n, error: a, className: s, id: o, ...i }) {
|
|
|
892
892
|
id: l,
|
|
893
893
|
"aria-invalid": !!a || void 0,
|
|
894
894
|
"aria-describedby": a || n ? `${l}-help` : void 0,
|
|
895
|
-
className:
|
|
895
|
+
className: _e(
|
|
896
896
|
// Bigger touch target (h-10) than the previous py-2 default;
|
|
897
897
|
// brand-coloured halo on focus instead of a single hard ring.
|
|
898
898
|
// text-sm is fine on desktop; the global media-query in
|
|
@@ -912,7 +912,7 @@ function ee({ label: t, hint: n, error: a, className: s, id: o, ...i }) {
|
|
|
912
912
|
"p",
|
|
913
913
|
{
|
|
914
914
|
id: `${l}-help`,
|
|
915
|
-
className:
|
|
915
|
+
className: _e(
|
|
916
916
|
"mt-1.5 text-xs",
|
|
917
917
|
a ? "text-red-600" : "text-fg-muted"
|
|
918
918
|
),
|
|
@@ -1181,7 +1181,7 @@ function Nr() {
|
|
|
1181
1181
|
qt,
|
|
1182
1182
|
{
|
|
1183
1183
|
to: `/chat/${p.id}`,
|
|
1184
|
-
className:
|
|
1184
|
+
className: _e(
|
|
1185
1185
|
"relative block truncate px-4 py-1.5 pl-10 pr-8 text-sm transition-colors",
|
|
1186
1186
|
u ? "bg-surface-subtle font-medium text-fg" : "text-fg-muted hover:bg-surface-subtle hover:text-fg"
|
|
1187
1187
|
),
|
|
@@ -1247,7 +1247,7 @@ function wr() {
|
|
|
1247
1247
|
{
|
|
1248
1248
|
type: "button",
|
|
1249
1249
|
onClick: n,
|
|
1250
|
-
className:
|
|
1250
|
+
className: _e(
|
|
1251
1251
|
"flex w-full items-center gap-2 px-4 py-2 text-xs font-semibold uppercase tracking-wider text-fg-muted transition-all duration-300 hover:text-fg",
|
|
1252
1252
|
p && u
|
|
1253
1253
|
),
|
|
@@ -1277,7 +1277,7 @@ function wr() {
|
|
|
1277
1277
|
qt,
|
|
1278
1278
|
{
|
|
1279
1279
|
to: v,
|
|
1280
|
-
className:
|
|
1280
|
+
className: _e(
|
|
1281
1281
|
"relative block truncate px-4 py-1.5 pl-10 pr-8 text-sm transition-all duration-300",
|
|
1282
1282
|
!f && "text-fg-muted hover:bg-surface-subtle hover:text-fg",
|
|
1283
1283
|
f && "bg-surface-subtle font-medium text-fg",
|
|
@@ -1310,7 +1310,7 @@ function kr({ group: t }) {
|
|
|
1310
1310
|
{
|
|
1311
1311
|
type: "button",
|
|
1312
1312
|
onClick: a,
|
|
1313
|
-
className:
|
|
1313
|
+
className: _e(
|
|
1314
1314
|
"flex w-full items-center gap-2 px-4 py-2 text-xs font-semibold uppercase tracking-wider text-fg-muted transition-all duration-300 hover:text-fg",
|
|
1315
1315
|
i && l
|
|
1316
1316
|
),
|
|
@@ -1330,7 +1330,7 @@ function kr({ group: t }) {
|
|
|
1330
1330
|
{
|
|
1331
1331
|
to: c.path,
|
|
1332
1332
|
end: h,
|
|
1333
|
-
className: ({ isActive: d }) =>
|
|
1333
|
+
className: ({ isActive: d }) => _e(
|
|
1334
1334
|
"relative block px-4 py-1.5 pl-10 text-sm transition-all duration-300",
|
|
1335
1335
|
!d && "text-fg-muted hover:bg-surface-subtle hover:text-fg",
|
|
1336
1336
|
d && "bg-surface-subtle font-medium text-fg",
|
|
@@ -1369,7 +1369,7 @@ function Sr({ isMobileOpen: t = !1, onClose: n }) {
|
|
|
1369
1369
|
return /* @__PURE__ */ r(
|
|
1370
1370
|
"aside",
|
|
1371
1371
|
{
|
|
1372
|
-
className:
|
|
1372
|
+
className: _e(
|
|
1373
1373
|
"fixed left-0 top-0 z-40 flex h-dvh w-64 flex-col border-r border-line bg-surface transition-transform duration-300 ease-out",
|
|
1374
1374
|
"md:translate-x-0",
|
|
1375
1375
|
t ? "translate-x-0 shadow-2xl" : "-translate-x-full"
|
|
@@ -1470,7 +1470,7 @@ function _r() {
|
|
|
1470
1470
|
"button",
|
|
1471
1471
|
{
|
|
1472
1472
|
onClick: () => p(!0),
|
|
1473
|
-
className:
|
|
1473
|
+
className: _e(
|
|
1474
1474
|
"rounded p-1 text-gray-500 transition-all duration-300 hover:bg-gray-100 hover:text-gray-900 md:hidden",
|
|
1475
1475
|
u
|
|
1476
1476
|
),
|
|
@@ -1516,7 +1516,7 @@ function M({ title: t, children: n, className: a, interactive: s }) {
|
|
|
1516
1516
|
return /* @__PURE__ */ r(
|
|
1517
1517
|
"div",
|
|
1518
1518
|
{
|
|
1519
|
-
className:
|
|
1519
|
+
className: _e(
|
|
1520
1520
|
// Surface + 1px hairline ring + multi-layer soft shadow gives
|
|
1521
1521
|
// the card depth on a tinted page background. The shadow is
|
|
1522
1522
|
// closer in feel to Linear / Vercel than Tailwind's default
|
|
@@ -1544,7 +1544,7 @@ function Rt({ variant: t = "default", dot: n, children: a, className: s }) {
|
|
|
1544
1544
|
return /* @__PURE__ */ r(
|
|
1545
1545
|
"span",
|
|
1546
1546
|
{
|
|
1547
|
-
className:
|
|
1547
|
+
className: _e(
|
|
1548
1548
|
"inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium",
|
|
1549
1549
|
Rr[t],
|
|
1550
1550
|
s
|
|
@@ -2487,7 +2487,7 @@ function Ve({ label: t, options: n, value: a, onChange: s, className: o, require
|
|
|
2487
2487
|
onChange: s,
|
|
2488
2488
|
required: i,
|
|
2489
2489
|
disabled: l,
|
|
2490
|
-
className:
|
|
2490
|
+
className: _e(
|
|
2491
2491
|
// Same shape as the Input primitive: h-10, surface bg, line ring,
|
|
2492
2492
|
// brand-tinted halo on focus.
|
|
2493
2493
|
"block h-10 w-full rounded-lg bg-surface px-3 text-sm text-fg",
|
|
@@ -2983,16 +2983,16 @@ function Dn() {
|
|
|
2983
2983
|
}), G = Pe(
|
|
2984
2984
|
(B, ie) => {
|
|
2985
2985
|
B === "currency" && p(!0), h((Le) => {
|
|
2986
|
-
const
|
|
2987
|
-
return B === "currency" && (
|
|
2986
|
+
const Te = { ...Le, [B]: ie };
|
|
2987
|
+
return B === "currency" && (Te.conversion_rate = 0), Sn(Te, i);
|
|
2988
2988
|
});
|
|
2989
2989
|
},
|
|
2990
2990
|
[i]
|
|
2991
2991
|
), k = Pe(
|
|
2992
2992
|
(B, ie) => {
|
|
2993
2993
|
h((Le) => {
|
|
2994
|
-
const
|
|
2995
|
-
return Sn(
|
|
2994
|
+
const Te = { ...Le, [B]: ie };
|
|
2995
|
+
return Sn(Te, i);
|
|
2996
2996
|
});
|
|
2997
2997
|
},
|
|
2998
2998
|
[i]
|
|
@@ -3637,7 +3637,7 @@ function Ae({
|
|
|
3637
3637
|
},
|
|
3638
3638
|
onBlur: G,
|
|
3639
3639
|
placeholder: `Search ${s}...`,
|
|
3640
|
-
className:
|
|
3640
|
+
className: _e(
|
|
3641
3641
|
"block h-9 w-full rounded-lg bg-surface px-3 text-sm text-fg ring-1 ring-line transition-all placeholder:text-fg-muted/70 focus:outline-none focus:ring-2 focus:ring-brand/30",
|
|
3642
3642
|
u && "bg-surface-subtle"
|
|
3643
3643
|
)
|
|
@@ -4965,9 +4965,9 @@ function As() {
|
|
|
4965
4965
|
const Le = window.setTimeout(() => {
|
|
4966
4966
|
ce.terminate(), ie(new Error("Report runtime exceeded 4 seconds"));
|
|
4967
4967
|
}, 4e3);
|
|
4968
|
-
ce.onmessage = (
|
|
4968
|
+
ce.onmessage = (Te) => {
|
|
4969
4969
|
var Ke, Fe;
|
|
4970
|
-
window.clearTimeout(Le), ce.terminate(), E.current === ce && (E.current = null), (Ke =
|
|
4970
|
+
window.clearTimeout(Le), ce.terminate(), E.current === ce && (E.current = null), (Ke = Te.data) != null && Ke.ok ? B(Te.data.output) : ie(new Error(((Fe = Te.data) == null ? void 0 : Fe.error) || "Runtime failed"));
|
|
4971
4971
|
}, ce.postMessage({
|
|
4972
4972
|
datasets: H.datasets,
|
|
4973
4973
|
params: {},
|
|
@@ -6076,7 +6076,7 @@ function Mn() {
|
|
|
6076
6076
|
isThinking: X,
|
|
6077
6077
|
getDemoStatus: se,
|
|
6078
6078
|
getDemoTypingCue: _
|
|
6079
|
-
} = mt(), U = oe(null), ne = oe(null), H = oe(null), ce = oe(null), [Se, B] = w(0), ie = oe(!1), Le = oe(null),
|
|
6079
|
+
} = mt(), U = oe(null), ne = oe(null), H = oe(null), ce = oe(null), [Se, B] = w(0), ie = oe(!1), Le = oe(null), Te = oe(0), Ke = oe(!0), Fe = oe(null), xt = oe(!1), pt = oe(null), Je = P(n), De = D === "connected", Ie = X(n), je = se(n), Qe = _(n), Oe = i || je === "running", ht = T(n), it = z(n), gt = Je[Je.length - 1], I = gt ? `${gt.type}:${gt.timestamp || ""}:${gt.content}` : "empty", K = Pe(() => {
|
|
6080
6080
|
xt.current = !0, pt.current !== null && window.clearTimeout(pt.current), pt.current = window.setTimeout(() => {
|
|
6081
6081
|
xt.current = !1, pt.current = null;
|
|
6082
6082
|
}, 600);
|
|
@@ -6086,23 +6086,23 @@ function Mn() {
|
|
|
6086
6086
|
K(), F.scrollTo({ top: F.scrollHeight, behavior: C });
|
|
6087
6087
|
const ae = () => {
|
|
6088
6088
|
const he = U.current;
|
|
6089
|
-
he && (!Ke.current && !Oe && !
|
|
6089
|
+
he && (!Ke.current && !Oe && !Ie || he.scrollTop + he.clientHeight >= he.scrollHeight - 2 || (K(), he.scrollTo({ top: he.scrollHeight, behavior: "auto" })));
|
|
6090
6090
|
};
|
|
6091
6091
|
requestAnimationFrame(ae), window.setTimeout(ae, 120);
|
|
6092
|
-
}, [Oe,
|
|
6092
|
+
}, [Oe, Ie, K]);
|
|
6093
6093
|
pn(() => {
|
|
6094
6094
|
const C = U.current, F = Fe.current;
|
|
6095
6095
|
if (!C || F === null) return;
|
|
6096
6096
|
const ae = C.scrollHeight - F;
|
|
6097
6097
|
ae > 0 && (C.scrollTop = C.scrollTop + ae), Fe.current = null;
|
|
6098
6098
|
}, [Je.length]), re(() => {
|
|
6099
|
-
Fe.current === null && (!Ke.current && !Oe && !
|
|
6100
|
-
}, [I, Oe,
|
|
6099
|
+
Fe.current === null && (!Ke.current && !Oe && !Ie || Y(Oe ? "auto" : "smooth"));
|
|
6100
|
+
}, [I, Oe, Ie, Y]), re(() => {
|
|
6101
6101
|
const C = U.current;
|
|
6102
6102
|
if (!C || typeof ResizeObserver > "u") return;
|
|
6103
6103
|
let F = 0;
|
|
6104
6104
|
const ae = new ResizeObserver(() => {
|
|
6105
|
-
Fe.current === null && (!Ke.current && !Oe && !
|
|
6105
|
+
Fe.current === null && (!Ke.current && !Oe && !Ie || (cancelAnimationFrame(F), F = requestAnimationFrame(() => {
|
|
6106
6106
|
const ye = U.current;
|
|
6107
6107
|
if (!ye) return;
|
|
6108
6108
|
ye.scrollHeight - ye.scrollTop - ye.clientHeight <= 120 && (K(), ye.scrollTo({ top: ye.scrollHeight, behavior: "auto" }));
|
|
@@ -6111,7 +6111,7 @@ function Mn() {
|
|
|
6111
6111
|
return he && ae.observe(he), ae.observe(C), () => {
|
|
6112
6112
|
ae.disconnect(), cancelAnimationFrame(F);
|
|
6113
6113
|
};
|
|
6114
|
-
}, [Oe,
|
|
6114
|
+
}, [Oe, Ie, K]), pn(() => {
|
|
6115
6115
|
const C = ce.current;
|
|
6116
6116
|
if (!C || (B(C.offsetHeight), typeof ResizeObserver > "u")) return;
|
|
6117
6117
|
const F = new ResizeObserver(() => B(C.offsetHeight));
|
|
@@ -6125,7 +6125,7 @@ function Mn() {
|
|
|
6125
6125
|
});
|
|
6126
6126
|
}, [n, it, ht, te]), we = oe(null);
|
|
6127
6127
|
re(() => {
|
|
6128
|
-
d(""), Le.current = null,
|
|
6128
|
+
d(""), Le.current = null, Te.current += 1, n && ia(n);
|
|
6129
6129
|
const C = s.state;
|
|
6130
6130
|
C != null && C.prefillMessage && we.current !== C ? (we.current = C, c(C.prefillMessage), window.setTimeout(() => {
|
|
6131
6131
|
var F;
|
|
@@ -6141,18 +6141,18 @@ function Mn() {
|
|
|
6141
6141
|
C = !0;
|
|
6142
6142
|
};
|
|
6143
6143
|
}, [n, De, a]);
|
|
6144
|
-
const
|
|
6144
|
+
const Re = oe($);
|
|
6145
6145
|
re(() => {
|
|
6146
|
-
|
|
6146
|
+
Re.current = $;
|
|
6147
6147
|
}, [$]), re(() => {
|
|
6148
|
-
!n || !De || i || je === "running" ||
|
|
6148
|
+
!n || !De || i || je === "running" || Re.current(n).catch(() => {
|
|
6149
6149
|
});
|
|
6150
6150
|
}, [n, De, N, i, je]), re(() => {
|
|
6151
|
-
ie.current && !
|
|
6151
|
+
ie.current && !Ie && De && setTimeout(() => {
|
|
6152
6152
|
var C;
|
|
6153
6153
|
return (C = H.current) == null ? void 0 : C.focus();
|
|
6154
|
-
}, 50), ie.current =
|
|
6155
|
-
}, [
|
|
6154
|
+
}, 50), ie.current = Ie;
|
|
6155
|
+
}, [Ie, De]);
|
|
6156
6156
|
function ot(C) {
|
|
6157
6157
|
if (xt.current) return;
|
|
6158
6158
|
const F = C.currentTarget, ae = F.scrollHeight - F.scrollTop - F.clientHeight;
|
|
@@ -6173,18 +6173,18 @@ function Mn() {
|
|
|
6173
6173
|
re(() => {
|
|
6174
6174
|
if (!Qe || !n || Ze.current === Qe.seq) return;
|
|
6175
6175
|
Ze.current = Qe.seq;
|
|
6176
|
-
const C = n, F = Qe.content, ae = F.length > 0 ? Math.max(8, Qe.typingMs / F.length) : 0, he = Qe.seq, ye = ++
|
|
6176
|
+
const C = n, F = Qe.content, ae = F.length > 0 ? Math.max(8, Qe.typingMs / F.length) : 0, he = Qe.seq, ye = ++Te.current;
|
|
6177
6177
|
async function et() {
|
|
6178
6178
|
c("");
|
|
6179
6179
|
for (const yt of F) {
|
|
6180
|
-
if (ye !==
|
|
6180
|
+
if (ye !== Te.current) return;
|
|
6181
6181
|
c((Ge) => Ge + yt), await Ws(ae);
|
|
6182
6182
|
}
|
|
6183
|
-
ye ===
|
|
6183
|
+
ye === Te.current && j.current(C, he);
|
|
6184
6184
|
}
|
|
6185
6185
|
et();
|
|
6186
6186
|
}, [Qe, n]), re(() => {
|
|
6187
|
-
je === "complete" && (
|
|
6187
|
+
je === "complete" && (Te.current += 1, c(""));
|
|
6188
6188
|
}, [je]);
|
|
6189
6189
|
const fe = Pe((C) => {
|
|
6190
6190
|
if (!n) return;
|
|
@@ -6414,7 +6414,7 @@ function Mn() {
|
|
|
6414
6414
|
onKeyDown: Nt,
|
|
6415
6415
|
onPaste: Me,
|
|
6416
6416
|
placeholder: t(Oe ? "chat.placeholderDemo" : De ? "chat.placeholderType" : "chat.placeholderConnecting"),
|
|
6417
|
-
disabled: !De || !n ||
|
|
6417
|
+
disabled: !De || !n || Ie || Oe,
|
|
6418
6418
|
rows: 2,
|
|
6419
6419
|
className: "block flex-1 resize-none bg-transparent px-2.5 py-1.5 text-sm text-fg outline-none placeholder:text-fg-muted/70 disabled:text-fg-muted",
|
|
6420
6420
|
style: { minHeight: "3rem", maxHeight: "120px" },
|
|
@@ -6431,7 +6431,7 @@ function Mn() {
|
|
|
6431
6431
|
var C;
|
|
6432
6432
|
return (C = v.current) == null ? void 0 : C.click();
|
|
6433
6433
|
},
|
|
6434
|
-
disabled: !De || !n ||
|
|
6434
|
+
disabled: !De || !n || Ie || Oe || p.length >= Qt,
|
|
6435
6435
|
className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-lg text-fg-muted transition-all hover:bg-surface-subtle hover:text-fg disabled:cursor-not-allowed disabled:opacity-40 md:h-10 md:w-10",
|
|
6436
6436
|
title: t("chat.attachTitle"),
|
|
6437
6437
|
children: /* @__PURE__ */ e("svg", { viewBox: "0 0 24 24", width: "20", height: "20", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48" }) })
|
|
@@ -6441,7 +6441,7 @@ function Mn() {
|
|
|
6441
6441
|
"button",
|
|
6442
6442
|
{
|
|
6443
6443
|
onClick: Ra,
|
|
6444
|
-
disabled: !De || !n ||
|
|
6444
|
+
disabled: !De || !n || Ie || Oe || S === "transcribing",
|
|
6445
6445
|
className: `flex h-11 w-11 shrink-0 items-center justify-center rounded-lg transition-all disabled:cursor-not-allowed disabled:opacity-40 md:h-10 md:w-10 ${S === "recording" ? "bg-rose-500/10 text-rose-600 hover:bg-rose-500/20" : "text-fg-muted hover:bg-surface-subtle hover:text-fg"}`,
|
|
6446
6446
|
title: t(S === "recording" ? "chat.voiceStop" : S === "transcribing" ? "chat.voiceTranscribing" : "chat.voiceStart"),
|
|
6447
6447
|
children: S === "transcribing" ? /* @__PURE__ */ e("svg", { viewBox: "0 0 24 24", width: "20", height: "20", fill: "none", stroke: "currentColor", strokeWidth: "2", className: "animate-spin", children: /* @__PURE__ */ e("path", { d: "M21 12a9 9 0 11-6.219-8.56", strokeLinecap: "round" }) }) : S === "recording" ? /* @__PURE__ */ e("svg", { viewBox: "0 0 24 24", width: "18", height: "18", fill: "currentColor", className: "animate-pulse", children: /* @__PURE__ */ e("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" }) }) : /* @__PURE__ */ r("svg", { viewBox: "0 0 24 24", width: "20", height: "20", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
@@ -6456,7 +6456,7 @@ function Mn() {
|
|
|
6456
6456
|
"button",
|
|
6457
6457
|
{
|
|
6458
6458
|
onClick: ft,
|
|
6459
|
-
disabled: !l.trim() && ge.length === 0 || !De || !n ||
|
|
6459
|
+
disabled: !l.trim() && ge.length === 0 || !De || !n || Ie || Oe || ke || pe,
|
|
6460
6460
|
className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-lg text-brand transition-all hover:bg-brand/10 active:translate-y-px disabled:cursor-not-allowed disabled:text-fg-muted disabled:active:translate-y-0 md:h-10 md:w-10",
|
|
6461
6461
|
children: /* @__PURE__ */ e(
|
|
6462
6462
|
"svg",
|
|
@@ -8161,52 +8161,60 @@ function tl({
|
|
|
8161
8161
|
danger: i = !0,
|
|
8162
8162
|
disabled: l,
|
|
8163
8163
|
className: c,
|
|
8164
|
-
timeout: h = 4e3
|
|
8164
|
+
timeout: h = 4e3,
|
|
8165
|
+
size: d = "sm",
|
|
8166
|
+
cancelSide: p = "left"
|
|
8165
8167
|
}) {
|
|
8166
|
-
const { t:
|
|
8167
|
-
|
|
8168
|
-
if (
|
|
8169
|
-
return
|
|
8170
|
-
}, [
|
|
8171
|
-
|
|
8168
|
+
const { t: u } = Z(), [g, b] = w(!1), x = oe(void 0);
|
|
8169
|
+
if (re(() => {
|
|
8170
|
+
if (g)
|
|
8171
|
+
return x.current = setTimeout(() => b(!1), h), () => clearTimeout(x.current);
|
|
8172
|
+
}, [g, h]), !g)
|
|
8173
|
+
return /* @__PURE__ */ e(
|
|
8174
|
+
"button",
|
|
8175
|
+
{
|
|
8176
|
+
type: "button",
|
|
8177
|
+
disabled: l,
|
|
8178
|
+
title: o,
|
|
8179
|
+
onClick: () => b(!0),
|
|
8180
|
+
className: c,
|
|
8181
|
+
children: n
|
|
8182
|
+
}
|
|
8183
|
+
);
|
|
8184
|
+
const y = d === "md", S = /* @__PURE__ */ e(
|
|
8185
|
+
"button",
|
|
8172
8186
|
{
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
"button",
|
|
8187
|
-
{
|
|
8188
|
-
type: "button",
|
|
8189
|
-
onClick: () => {
|
|
8190
|
-
u(!1), t();
|
|
8191
|
-
},
|
|
8192
|
-
className: Be(
|
|
8193
|
-
"rounded-md px-2 py-1 text-xs font-medium text-white",
|
|
8194
|
-
i ? "bg-red-600 hover:bg-red-700" : "bg-brand hover:bg-brand/90"
|
|
8195
|
-
),
|
|
8196
|
-
children: a ?? d("common.delete", { defaultValue: "Delete" })
|
|
8197
|
-
}
|
|
8198
|
-
)
|
|
8199
|
-
]
|
|
8200
|
-
}
|
|
8201
|
-
) : /* @__PURE__ */ e(
|
|
8187
|
+
type: "button",
|
|
8188
|
+
onClick: () => {
|
|
8189
|
+
b(!1), t();
|
|
8190
|
+
},
|
|
8191
|
+
className: _e(
|
|
8192
|
+
"rounded-md font-medium text-white",
|
|
8193
|
+
y ? "px-3 py-1.5 text-sm" : "px-2 py-1 text-xs",
|
|
8194
|
+
i ? "bg-red-600 hover:bg-red-700" : "bg-brand hover:bg-brand/90"
|
|
8195
|
+
),
|
|
8196
|
+
children: a ?? u("common.delete", { defaultValue: "Delete" })
|
|
8197
|
+
},
|
|
8198
|
+
"confirm"
|
|
8199
|
+
), A = /* @__PURE__ */ e(
|
|
8202
8200
|
"button",
|
|
8203
8201
|
{
|
|
8204
8202
|
type: "button",
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8203
|
+
onClick: () => b(!1),
|
|
8204
|
+
className: _e(
|
|
8205
|
+
"rounded-md",
|
|
8206
|
+
y ? "px-3 py-1.5 text-sm font-medium text-fg ring-1 ring-line hover:bg-surface-subtle" : "px-2 py-1 text-xs text-fg-muted hover:text-fg"
|
|
8207
|
+
),
|
|
8208
|
+
children: s ?? u("common.cancel", { defaultValue: "Cancel" })
|
|
8209
|
+
},
|
|
8210
|
+
"cancel"
|
|
8211
|
+
);
|
|
8212
|
+
return /* @__PURE__ */ e(
|
|
8213
|
+
"span",
|
|
8214
|
+
{
|
|
8215
|
+
className: _e("inline-flex items-center", y ? "gap-2" : "gap-1"),
|
|
8216
|
+
onMouseLeave: () => b(!1),
|
|
8217
|
+
children: p === "right" ? [S, A] : [A, S]
|
|
8210
8218
|
}
|
|
8211
8219
|
);
|
|
8212
8220
|
}
|