react-semaphor 0.1.542 → 0.1.544
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/activity/index.js +73 -0
- package/dist/assistant-context/index.js +1 -1
- package/dist/briefings/index.js +51 -50
- package/dist/chunks/{apply-dashboard-operations-Btbp2-6v.js → apply-dashboard-operations-Bz4n1Lq6.js} +44 -44
- package/dist/chunks/{assistant-chat-oHF5lTjA.js → assistant-chat-BNLkCDml.js} +288 -288
- package/dist/chunks/{comparison-window-caption-ChIyd_-L.js → comparison-window-caption-BTkrN3W4.js} +468 -463
- package/dist/chunks/dashboard-briefing-launcher-DQ_8O_e2.js +3725 -0
- package/dist/chunks/{dashboard-controls-CIn22Qgp.js → dashboard-controls-8RyBTQUO.js} +530 -525
- package/dist/chunks/dashboard-g5a4DKWq.js +14 -0
- package/dist/chunks/{dashboard-json-ZUYsIExq.js → dashboard-json-7qT9jmfL.js} +1 -1
- package/dist/chunks/{document-dashboard-inputs-C6MJVyoI.js → document-dashboard-inputs-BC6p-ESg.js} +4 -4
- package/dist/chunks/{document-sheet-utils-BsZUnHRl.js → document-sheet-utils-Duo9uLoH.js} +11 -11
- package/dist/chunks/{edit-dashboard-visual-DLdereA7.js → edit-dashboard-visual-BfJwnRIZ.js} +249 -248
- package/dist/chunks/export-file-format-C-tJsxsf.js +111 -0
- package/dist/chunks/{index-CV5rHq5D.js → index-DkAyQvC6.js} +59 -58
- package/dist/chunks/{matrix-formatter-BnsTX90d.js → matrix-formatter-CxJLkztA.js} +1 -1
- package/dist/chunks/{numeric-presentation-BSAqPpHt.js → numeric-presentation-DESvLiu9.js} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-BBlAfBA0.js → pivot-result-lifecycle-DM4CyGKs.js} +287 -395
- package/dist/chunks/{raw-temporal-presentation-CZ2r0Vb_.js → raw-temporal-presentation-CLiVi90c.js} +2 -2
- package/dist/chunks/{report-preferences-dialog-MRUWpMcJ.js → report-preferences-dialog-Df7VpRVW.js} +195 -195
- package/dist/chunks/{saved-dashboard-context-DjPqgFly.js → saved-dashboard-context-B-mQ--nV.js} +3 -3
- package/dist/chunks/{semaphor-ready-indicator-BWSpRsPj.js → semaphor-ready-indicator-DDAxk8us.js} +39892 -39380
- package/dist/chunks/{shelf-drop-preview-context-CQbFLm3q.js → shelf-drop-preview-context-BSRPwaED.js} +414 -371
- package/dist/chunks/{table-export-sheet-BHSnuZHd.js → table-export-sheet-CPfGAQ9X.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BJDNqdOh.js → use-create-flow-overlay-state-BxzFviM-.js} +67 -78
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +72 -72
- package/dist/data-app-sdk/index.js +1 -1
- package/dist/format-utils/index.js +226 -223
- package/dist/index.js +266 -271
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/activity.d.ts +2 -0
- package/dist/types/components/activity/activity-bell.d.ts +11 -0
- package/dist/types/components/activity/activity-instance.d.ts +50 -0
- package/dist/types/components/activity/activity-notices.d.ts +7 -0
- package/dist/types/components/activity/activity-provider.d.ts +21 -0
- package/dist/types/components/activity/activity-types.d.ts +177 -0
- package/dist/types/components/activity/index.d.ts +6 -0
- package/dist/types/components/activity/use-activity.d.ts +20 -0
- package/dist/types/components/briefings/briefing-author/run-model.d.ts +1 -2
- package/dist/types/components/briefings/briefing-author.d.ts +14 -12
- package/dist/types/components/briefings/dashboard-briefing-launcher.d.ts +5 -0
- package/dist/types/components/briefings/use-briefing-run-detail.d.ts +34 -0
- package/dist/types/components/index.d.ts +1 -4
- package/dist/types/lib/activity-identity.d.ts +21 -0
- package/dist/types/lib/api/exports-api.d.ts +4 -4
- package/dist/types/lib/hooks/index.d.ts +1 -3
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +4 -0
- package/dist/types/shared/activity/activity-contract.d.ts +84 -0
- package/dist/types/shared/activity/index.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +6 -0
- package/dist/types/shared/format-utils/export-policy.d.ts +12 -0
- package/package.json +5 -1
- package/dist/chunks/dashboard-briefing-launcher-B-cm719R.js +0 -4248
- package/dist/chunks/dashboard-s5WJBcK8.js +0 -14
- package/dist/types/components/briefings/briefing-author/run-ui.d.ts +0 -81
- package/dist/types/components/briefings/use-briefing-run-polling.d.ts +0 -34
- package/dist/types/components/notifications/export-notification-item.d.ts +0 -24
- package/dist/types/components/notifications/export-notification-list.d.ts +0 -8
- package/dist/types/components/notifications/index.d.ts +0 -3
- package/dist/types/components/notifications/notification-bell.d.ts +0 -13
- package/dist/types/lib/exports/bounded-request.d.ts +0 -12
- package/dist/types/lib/hooks/use-export-polling.d.ts +0 -32
- package/dist/types/lib/hooks/use-export-recovery.d.ts +0 -11
- package/dist/types/lib/stores/export-store.d.ts +0 -62
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
1
|
+
var br = (e) => {
|
|
2
2
|
throw TypeError(e);
|
|
3
3
|
};
|
|
4
|
-
var xr = (e, t, r) => t.has(e) ||
|
|
5
|
-
var Z = (e, t, r) => (xr(e, t, "read from private field"), r ? r.call(e) : t.get(e)), se = (e, t, r) => t.has(e) ?
|
|
4
|
+
var xr = (e, t, r) => t.has(e) || br("Cannot " + r);
|
|
5
|
+
var Z = (e, t, r) => (xr(e, t, "read from private field"), r ? r.call(e) : t.get(e)), se = (e, t, r) => t.has(e) ? br("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), J = (e, t, r, n) => (xr(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
|
|
6
6
|
import { jsx as m, jsxs as T, Fragment as Ve } from "react/jsx-runtime";
|
|
7
7
|
import { useCallback as ae, useRef as oe, useMemo as qe, useEffect as ke, useState as L, useLayoutEffect as Ze, useId as fo } from "react";
|
|
8
|
-
import { u as H,
|
|
8
|
+
import { u as H, df as mo, bV as ho, bX as go, aZ as vo, cJ as yo, O as bo, dg as xo, dh as wo, aW as _o, di as Io, bg as So, dj as Gt, cE as Eo, dk as No, dl as Yt, dm as yn, dn as ko, aQ as bn, c8 as wr, dp as xn, dq as To, dr as Ao, ds as Co, bT as wn, aV as _n, aH as $o, aX as zo, bf as at, dt as Oo, du as Mo, dv as Po, dw as Ro, Y as In, c5 as Zo, c6 as Do, c7 as jo, cc as Fo, dx as Lo, dy as Uo, dz as Bo } from "./semaphor-ready-indicator-DDAxk8us.js";
|
|
9
9
|
import { i as Vo } from "./conversation-sQiWYUOb.js";
|
|
10
10
|
import { B as te, i as qo, j as Jo, c as Sn, L as Je, P as En, a as Nn, b as kn } from "./switch-C3jLxlG0.js";
|
|
11
11
|
import "./index-CuHybtft.js";
|
|
@@ -18,17 +18,17 @@ import { c as q } from "./class-utils-Df1OVOT1.js";
|
|
|
18
18
|
import { f as Tn } from "./editor-draft-sync-BN5qYHPF.js";
|
|
19
19
|
import { A as Wo } from "./table-settings-CLZocegs.js";
|
|
20
20
|
import { l as Go, m as Ke, c as _r, A as We, d as An } from "./context-ClREvqCZ.js";
|
|
21
|
-
import { p as Ir, a as Yo, A as Cn } from "./saved-dashboard-context-
|
|
22
|
-
import { ak as Ho, k as Xo } from "./document-dashboard-inputs-
|
|
23
|
-
import { x as Qo } from "./document-sheet-utils-
|
|
21
|
+
import { p as Ir, a as Yo, A as Cn } from "./saved-dashboard-context-B-mQ--nV.js";
|
|
22
|
+
import { ak as Ho, k as Xo } from "./document-dashboard-inputs-BC6p-ESg.js";
|
|
23
|
+
import { x as Qo } from "./document-sheet-utils-Duo9uLoH.js";
|
|
24
24
|
import { w as es, c as $n } from "./visual-choice-JiJ-_3bi.js";
|
|
25
25
|
import { A as ts, v as zn, t as rs, e as ue, d as ns, b as as, f as Ht, s as Dt, a as os } from "./add-to-dashboard-BuAqfA2Y.js";
|
|
26
26
|
import { v as Sr } from "./custom-visual-inputs-DUtpYZOk.js";
|
|
27
27
|
import { g as ss } from "./_commonjsHelpers-BkfeUUK-.js";
|
|
28
28
|
import { S as Er, U as Nr, V as kr, O as Tr, f as is, F as ls } from "./temporal-bucket-D7NBrrtL.js";
|
|
29
29
|
import { C as cs, a as us } from "./selection-reducer-Dj_8xD69.js";
|
|
30
|
-
import { c as
|
|
31
|
-
import { x as ds, y as ps, z as fs, A as ot, B as ms, C as Ar, E as hs } from "./matrix-formatter-
|
|
30
|
+
import { c as bt, X as Ge } from "./x-4f5U2XwU.js";
|
|
31
|
+
import { x as ds, y as ps, z as fs, A as ot, B as ms, C as Ar, E as hs } from "./matrix-formatter-CxJLkztA.js";
|
|
32
32
|
import { L as Cr } from "./layout-grid-Bgzth8vd.js";
|
|
33
33
|
function gs(e, t, r) {
|
|
34
34
|
const n = ds(), a = (r == null ? void 0 : r.locale) ?? n.locale ?? ps, o = fs(e, t);
|
|
@@ -40,10 +40,10 @@ function gs(e, t, r) {
|
|
|
40
40
|
});
|
|
41
41
|
let c, p;
|
|
42
42
|
o > 0 ? (c = ot(t), p = ot(e)) : (c = ot(e), p = ot(t));
|
|
43
|
-
const i = ms((r == null ? void 0 : r.roundingMethod) ?? "round"),
|
|
43
|
+
const i = ms((r == null ? void 0 : r.roundingMethod) ?? "round"), b = p.getTime() - c.getTime(), u = b / Tr, g = Ar(p) - Ar(c), I = (b - g) / Tr, _ = r == null ? void 0 : r.unit;
|
|
44
44
|
let N;
|
|
45
45
|
if (_ ? N = _ : u < 1 ? N = "second" : u < 60 ? N = "minute" : u < Er ? N = "hour" : I < Nr ? N = "day" : I < kr ? N = "month" : N = "year", N === "second") {
|
|
46
|
-
const E = i(
|
|
46
|
+
const E = i(b / 1e3);
|
|
47
47
|
return a.formatDistance("xSeconds", E, s);
|
|
48
48
|
} else if (N === "minute") {
|
|
49
49
|
const E = i(u);
|
|
@@ -71,7 +71,7 @@ function vs(e, t) {
|
|
|
71
71
|
* This source code is licensed under the ISC license.
|
|
72
72
|
* See the LICENSE file in the root directory of this source tree.
|
|
73
73
|
*/
|
|
74
|
-
const
|
|
74
|
+
const ys = bt("AppWindow", [
|
|
75
75
|
["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }],
|
|
76
76
|
["path", { d: "M10 4v4", key: "pp8u80" }],
|
|
77
77
|
["path", { d: "M2 8h20", key: "d11cs7" }],
|
|
@@ -83,7 +83,7 @@ const bs = yt("AppWindow", [
|
|
|
83
83
|
* This source code is licensed under the ISC license.
|
|
84
84
|
* See the LICENSE file in the root directory of this source tree.
|
|
85
85
|
*/
|
|
86
|
-
const
|
|
86
|
+
const bs = bt("CornerDownLeft", [
|
|
87
87
|
["polyline", { points: "9 10 4 15 9 20", key: "r3jprv" }],
|
|
88
88
|
["path", { d: "M20 4v7a4 4 0 0 1-4 4H4", key: "6o5b7l" }]
|
|
89
89
|
]);
|
|
@@ -93,7 +93,7 @@ const ys = yt("CornerDownLeft", [
|
|
|
93
93
|
* This source code is licensed under the ISC license.
|
|
94
94
|
* See the LICENSE file in the root directory of this source tree.
|
|
95
95
|
*/
|
|
96
|
-
const xs =
|
|
96
|
+
const xs = bt("PanelLeft", [
|
|
97
97
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
98
98
|
["path", { d: "M9 3v18", key: "fh3hqa" }]
|
|
99
99
|
]);
|
|
@@ -103,7 +103,7 @@ const xs = yt("PanelLeft", [
|
|
|
103
103
|
* This source code is licensed under the ISC license.
|
|
104
104
|
* See the LICENSE file in the root directory of this source tree.
|
|
105
105
|
*/
|
|
106
|
-
const On =
|
|
106
|
+
const On = bt("PanelRight", [
|
|
107
107
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
108
108
|
["path", { d: "M15 3v18", key: "14nvp0" }]
|
|
109
109
|
]);
|
|
@@ -139,7 +139,7 @@ function ws(e = "dashboard") {
|
|
|
139
139
|
...c && p !== void 0 ? { selectedCard: { cardId: c, snapshot: p, ...a ? { card: a.card } : {} } } : {},
|
|
140
140
|
...a ? { editing: { mode: a.mode } } : {},
|
|
141
141
|
calendar: s
|
|
142
|
-
},
|
|
142
|
+
}, b = [
|
|
143
143
|
i.dashboard,
|
|
144
144
|
i.sheetId,
|
|
145
145
|
...Object.values(i.runtimeValues),
|
|
@@ -150,37 +150,37 @@ function ws(e = "dashboard") {
|
|
|
150
150
|
a == null ? void 0 : a.mode,
|
|
151
151
|
s
|
|
152
152
|
];
|
|
153
|
-
if (t && $r(t.reads,
|
|
153
|
+
if (t && $r(t.reads, b)) return t.sent;
|
|
154
154
|
const u = Ir(i), g = u.selectedCard ? Yo({
|
|
155
155
|
dashboard: o.dashboard,
|
|
156
156
|
cardId: u.selectedCard.id,
|
|
157
157
|
snapshot: p ?? "pending",
|
|
158
158
|
...a ? { card: a.card } : {}
|
|
159
159
|
}) : void 0, I = { context: u, ...g ? { cardReplay: g } : {} };
|
|
160
|
-
return t = { reads:
|
|
160
|
+
return t = { reads: b, sent: I }, I;
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
163
|
function $r(e, t) {
|
|
164
164
|
return e.length === t.length && e.every((r, n) => Object.is(r, t[n]));
|
|
165
165
|
}
|
|
166
166
|
function _s(e) {
|
|
167
|
-
const { canEditDashboard: t, isInspectionMode: r } = ho(), n = go(), a = H((
|
|
167
|
+
const { canEditDashboard: t, isInspectionMode: r } = ho(), n = go(), a = H((b) => {
|
|
168
168
|
var g, I;
|
|
169
|
-
const u = (I = (g =
|
|
169
|
+
const u = (I = (g = b.dashboard) == null ? void 0 : g.sheets) == null ? void 0 : I.find((_) => _.id === b.selectedSheetId);
|
|
170
170
|
return !!u && !Qo(u);
|
|
171
|
-
}), o = H((
|
|
172
|
-
async (
|
|
171
|
+
}), o = H((b) => b.isVisualEditing), s = vo(), c = yo(), p = ae(
|
|
172
|
+
async (b, u) => {
|
|
173
173
|
var C, M;
|
|
174
174
|
const g = H.getState(), I = (C = g.dashboard) == null ? void 0 : C.id, _ = g.selectedSheetId;
|
|
175
175
|
if (!I || !_) throw new dt(Nt);
|
|
176
|
-
const N = { title:
|
|
176
|
+
const N = { title: b.title, type: ts[u], ...b.card }, E = !Is({ ...N, id: "check" }, b, u), y = { ...N, ...E ? { type: "table" } : {}, id: Sr() }, w = { id: Sr(), cards: [y], activeCardId: y.id }, h = await c(w, { reuseLoaded: !0 }).catch((Q) => {
|
|
177
177
|
console.warn("Adding the result without refreshed semantic metadata:", Q);
|
|
178
178
|
}), d = structuredClone(H.getState().semanticExecutionPayload);
|
|
179
|
-
|
|
179
|
+
bo(d, h);
|
|
180
180
|
const v = es(
|
|
181
|
-
|
|
182
|
-
Ss(
|
|
183
|
-
), f = v === (
|
|
181
|
+
y.config ?? {},
|
|
182
|
+
Ss(y, _, d, s)
|
|
183
|
+
), f = v === (y.config ?? {}) ? w : { ...w, cards: [{ ...y, config: v }] }, x = H.getState();
|
|
184
184
|
if (((M = x.dashboard) == null ? void 0 : M.id) !== I || x.selectedSheetId !== _ || x.isVisualEditing)
|
|
185
185
|
throw new dt(Nt);
|
|
186
186
|
const { actions: k } = x;
|
|
@@ -197,7 +197,7 @@ function Is(e, t, r) {
|
|
|
197
197
|
if (r !== "line" && r !== "bar" && r !== "stackedBar") return !0;
|
|
198
198
|
const n = $n(zn(t), r);
|
|
199
199
|
if (!n.ok) return !1;
|
|
200
|
-
const { x: a, y: o = [], series: s } = n.visual.encodings, c = xo({ card: e, cardType: e.type, records: t.records }), p = (i,
|
|
200
|
+
const { x: a, y: o = [], series: s } = n.visual.encodings, c = xo({ card: e, cardType: e.type, records: t.records }), p = (i, b, u) => JSON.stringify([i, b ?? null, [...u].sort()]);
|
|
201
201
|
return p(c.axisKeys, c.seriesKey, c.valueKeys) === p(a ? [a] : [], s, o);
|
|
202
202
|
}
|
|
203
203
|
class dt extends Error {
|
|
@@ -366,8 +366,8 @@ function S(e, t, r) {
|
|
|
366
366
|
value: c._zod ?? {},
|
|
367
367
|
enumerable: !1
|
|
368
368
|
}), (i = c._zod).traits ?? (i.traits = /* @__PURE__ */ new Set()), c._zod.traits.add(e), t(c, p);
|
|
369
|
-
for (const
|
|
370
|
-
|
|
369
|
+
for (const b in s.prototype)
|
|
370
|
+
b in c || Object.defineProperty(c, b, { value: s.prototype[b].bind(c) });
|
|
371
371
|
c._zod.constr = s, c._zod.def = p;
|
|
372
372
|
}
|
|
373
373
|
const a = (r == null ? void 0 : r.Parent) ?? Object;
|
|
@@ -378,8 +378,8 @@ function S(e, t, r) {
|
|
|
378
378
|
var p;
|
|
379
379
|
const i = r != null && r.Parent ? new o() : this;
|
|
380
380
|
n(i, c), (p = i._zod).deferred ?? (p.deferred = []);
|
|
381
|
-
for (const
|
|
382
|
-
|
|
381
|
+
for (const b of i._zod.deferred)
|
|
382
|
+
b();
|
|
383
383
|
return i;
|
|
384
384
|
}
|
|
385
385
|
return Object.defineProperty(s, "init", { value: n }), Object.defineProperty(s, Symbol.hasInstance, {
|
|
@@ -629,8 +629,8 @@ function ge(e, t, r) {
|
|
|
629
629
|
var a, o, s, c, p, i;
|
|
630
630
|
const n = { ...e, path: e.path ?? [] };
|
|
631
631
|
if (!e.message) {
|
|
632
|
-
const
|
|
633
|
-
n.message =
|
|
632
|
+
const b = st((s = (o = (a = e.inst) == null ? void 0 : a._zod.def) == null ? void 0 : o.error) == null ? void 0 : s.call(o, e)) ?? st((c = t == null ? void 0 : t.error) == null ? void 0 : c.call(t, e)) ?? st((p = r.customError) == null ? void 0 : p.call(r, e)) ?? st((i = r.localeError) == null ? void 0 : i.call(r, e)) ?? "Invalid input";
|
|
633
|
+
n.message = b;
|
|
634
634
|
}
|
|
635
635
|
return delete n.inst, delete n.continue, t != null && t.reportInput || delete n.input, n;
|
|
636
636
|
}
|
|
@@ -734,10 +734,10 @@ function ia(e) {
|
|
|
734
734
|
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
735
735
|
return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
736
736
|
}
|
|
737
|
-
function
|
|
737
|
+
function yi(e) {
|
|
738
738
|
return new RegExp(`^${ia(e)}$`);
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function bi(e) {
|
|
741
741
|
const t = ia({ precision: e.precision }), r = ["Z"];
|
|
742
742
|
e.local && r.push(""), e.offset && r.push("([+-]\\d{2}:\\d{2})");
|
|
743
743
|
const n = `${t}(?:${r.join("|")})`;
|
|
@@ -1060,7 +1060,7 @@ const Fi = {
|
|
|
1060
1060
|
});
|
|
1061
1061
|
else {
|
|
1062
1062
|
const o = (s, c, p) => {
|
|
1063
|
-
let i = Be(s),
|
|
1063
|
+
let i = Be(s), b;
|
|
1064
1064
|
for (const u of c) {
|
|
1065
1065
|
if (u._zod.def.when) {
|
|
1066
1066
|
if (!u._zod.def.when(s))
|
|
@@ -1070,8 +1070,8 @@ const Fi = {
|
|
|
1070
1070
|
const g = s.issues.length, I = u._zod.check(s);
|
|
1071
1071
|
if (I instanceof Promise && (p == null ? void 0 : p.async) === !1)
|
|
1072
1072
|
throw new Ye();
|
|
1073
|
-
if (
|
|
1074
|
-
|
|
1073
|
+
if (b || I instanceof Promise)
|
|
1074
|
+
b = (b ?? Promise.resolve()).then(async () => {
|
|
1075
1075
|
await I, s.issues.length !== g && (i || (i = Be(s, g)));
|
|
1076
1076
|
});
|
|
1077
1077
|
else {
|
|
@@ -1080,7 +1080,7 @@ const Fi = {
|
|
|
1080
1080
|
i || (i = Be(s, g));
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
1083
|
-
return
|
|
1083
|
+
return b ? b.then(() => s) : s;
|
|
1084
1084
|
};
|
|
1085
1085
|
e._zod.run = (s, c) => {
|
|
1086
1086
|
const p = e._zod.parse(s, c);
|
|
@@ -1194,11 +1194,11 @@ const Fi = {
|
|
|
1194
1194
|
}), Hi = /* @__PURE__ */ S("$ZodKSUID", (e, t) => {
|
|
1195
1195
|
t.pattern ?? (t.pattern = ni), j.init(e, t);
|
|
1196
1196
|
}), Xi = /* @__PURE__ */ S("$ZodISODateTime", (e, t) => {
|
|
1197
|
-
t.pattern ?? (t.pattern =
|
|
1197
|
+
t.pattern ?? (t.pattern = bi(t)), j.init(e, t);
|
|
1198
1198
|
}), Qi = /* @__PURE__ */ S("$ZodISODate", (e, t) => {
|
|
1199
1199
|
t.pattern ?? (t.pattern = vi), j.init(e, t);
|
|
1200
1200
|
}), el = /* @__PURE__ */ S("$ZodISOTime", (e, t) => {
|
|
1201
|
-
t.pattern ?? (t.pattern =
|
|
1201
|
+
t.pattern ?? (t.pattern = yi(t)), j.init(e, t);
|
|
1202
1202
|
}), tl = /* @__PURE__ */ S("$ZodISODuration", (e, t) => {
|
|
1203
1203
|
t.pattern ?? (t.pattern = oi), j.init(e, t);
|
|
1204
1204
|
}), rl = /* @__PURE__ */ S("$ZodIPv4", (e, t) => {
|
|
@@ -1404,7 +1404,7 @@ function it(e, t, r) {
|
|
|
1404
1404
|
function Rr(e, t, r, n) {
|
|
1405
1405
|
e.issues.length ? n[r] === void 0 ? r in n ? t.value[r] = void 0 : t.value[r] = e.value : t.issues.push(..._e(r, e.issues)) : e.value === void 0 ? r in n && (t.value[r] = void 0) : t.value[r] = e.value;
|
|
1406
1406
|
}
|
|
1407
|
-
const
|
|
1407
|
+
const yl = /* @__PURE__ */ S("$ZodObject", (e, t) => {
|
|
1408
1408
|
D.init(e, t);
|
|
1409
1409
|
const r = Xt(() => {
|
|
1410
1410
|
const u = Object.keys(t.shape);
|
|
@@ -1477,14 +1477,14 @@ const bl = /* @__PURE__ */ S("$ZodObject", (e, t) => {
|
|
|
1477
1477
|
})));`), g.write(`newResult[${Fe(w)}] = ${h}.value`);
|
|
1478
1478
|
}
|
|
1479
1479
|
g.write("payload.value = newResult;"), g.write("return payload;");
|
|
1480
|
-
const
|
|
1481
|
-
return (w, h) =>
|
|
1480
|
+
const y = g.compile();
|
|
1481
|
+
return (w, h) => y(u, w, h);
|
|
1482
1482
|
};
|
|
1483
1483
|
let a;
|
|
1484
1484
|
const o = mt, s = !Hn.jitless, p = s && Zs.value, i = t.catchall;
|
|
1485
|
-
let
|
|
1485
|
+
let b;
|
|
1486
1486
|
e._zod.parse = (u, g) => {
|
|
1487
|
-
|
|
1487
|
+
b ?? (b = r.value);
|
|
1488
1488
|
const I = u.value;
|
|
1489
1489
|
if (!o(I))
|
|
1490
1490
|
return u.issues.push({
|
|
@@ -1498,15 +1498,15 @@ const bl = /* @__PURE__ */ S("$ZodObject", (e, t) => {
|
|
|
1498
1498
|
a || (a = n(t.shape)), u = a(u, g);
|
|
1499
1499
|
else {
|
|
1500
1500
|
u.value = {};
|
|
1501
|
-
const h =
|
|
1502
|
-
for (const d of
|
|
1501
|
+
const h = b.shape;
|
|
1502
|
+
for (const d of b.keys) {
|
|
1503
1503
|
const v = h[d], f = v._zod.run({ value: I[d], issues: [] }, g), x = v._zod.optin === "optional" && v._zod.optout === "optional";
|
|
1504
1504
|
f instanceof Promise ? _.push(f.then((k) => x ? Rr(k, u, d, I) : it(k, u, d))) : x ? Rr(f, u, d, I) : it(f, u, d);
|
|
1505
1505
|
}
|
|
1506
1506
|
}
|
|
1507
1507
|
if (!i)
|
|
1508
1508
|
return _.length ? Promise.all(_).then(() => u) : u;
|
|
1509
|
-
const N = [], E =
|
|
1509
|
+
const N = [], E = b.keySet, y = i._zod, w = y.def.type;
|
|
1510
1510
|
for (const h of Object.keys(I)) {
|
|
1511
1511
|
if (E.has(h))
|
|
1512
1512
|
continue;
|
|
@@ -1514,7 +1514,7 @@ const bl = /* @__PURE__ */ S("$ZodObject", (e, t) => {
|
|
|
1514
1514
|
N.push(h);
|
|
1515
1515
|
continue;
|
|
1516
1516
|
}
|
|
1517
|
-
const d =
|
|
1517
|
+
const d = y.run({ value: I[h], issues: [] }, g);
|
|
1518
1518
|
d instanceof Promise ? _.push(d.then((v) => it(v, u, h))) : it(d, u, h);
|
|
1519
1519
|
}
|
|
1520
1520
|
return N.length && u.issues.push({
|
|
@@ -1563,7 +1563,7 @@ const fa = /* @__PURE__ */ S("$ZodUnion", (e, t) => {
|
|
|
1563
1563
|
}
|
|
1564
1564
|
return a ? Promise.all(o).then((s) => Zr(s, r, e, n)) : Zr(o, r, e, n);
|
|
1565
1565
|
};
|
|
1566
|
-
}),
|
|
1566
|
+
}), bl = /* @__PURE__ */ S("$ZodDiscriminatedUnion", (e, t) => {
|
|
1567
1567
|
fa.init(e, t);
|
|
1568
1568
|
const r = e._zod.parse;
|
|
1569
1569
|
P(e._zod, "propValues", () => {
|
|
@@ -1679,8 +1679,8 @@ const wl = /* @__PURE__ */ S("$ZodRecord", (e, t) => {
|
|
|
1679
1679
|
for (const p of s)
|
|
1680
1680
|
if (typeof p == "string" || typeof p == "number" || typeof p == "symbol") {
|
|
1681
1681
|
const i = t.valueType._zod.run({ value: a[p], issues: [] }, n);
|
|
1682
|
-
i instanceof Promise ? o.push(i.then((
|
|
1683
|
-
|
|
1682
|
+
i instanceof Promise ? o.push(i.then((b) => {
|
|
1683
|
+
b.issues.length && r.issues.push(..._e(p, b.issues)), r.value[p] = b.value;
|
|
1684
1684
|
})) : (i.issues.length && r.issues.push(..._e(p, i.issues)), r.value[p] = i.value);
|
|
1685
1685
|
}
|
|
1686
1686
|
let c;
|
|
@@ -2258,7 +2258,7 @@ function vc(e, t) {
|
|
|
2258
2258
|
includes: e
|
|
2259
2259
|
});
|
|
2260
2260
|
}
|
|
2261
|
-
function
|
|
2261
|
+
function yc(e, t) {
|
|
2262
2262
|
return new Ri({
|
|
2263
2263
|
check: "string_format",
|
|
2264
2264
|
format: "starts_with",
|
|
@@ -2266,7 +2266,7 @@ function bc(e, t) {
|
|
|
2266
2266
|
prefix: e
|
|
2267
2267
|
});
|
|
2268
2268
|
}
|
|
2269
|
-
function
|
|
2269
|
+
function bc(e, t) {
|
|
2270
2270
|
return new Zi({
|
|
2271
2271
|
check: "string_format",
|
|
2272
2272
|
format: "ends_with",
|
|
@@ -2354,12 +2354,12 @@ class Wr {
|
|
|
2354
2354
|
const E = c.schema;
|
|
2355
2355
|
switch (a.type) {
|
|
2356
2356
|
case "string": {
|
|
2357
|
-
const
|
|
2358
|
-
|
|
2357
|
+
const y = E;
|
|
2358
|
+
y.type = "string";
|
|
2359
2359
|
const { minimum: w, maximum: h, format: d, patterns: v, contentEncoding: f } = t._zod.bag;
|
|
2360
|
-
if (typeof w == "number" && (
|
|
2360
|
+
if (typeof w == "number" && (y.minLength = w), typeof h == "number" && (y.maxLength = h), d && (y.format = o[d] ?? d, y.format === "" && delete y.format), f && (y.contentEncoding = f), v && v.size > 0) {
|
|
2361
2361
|
const x = [...v];
|
|
2362
|
-
x.length === 1 ?
|
|
2362
|
+
x.length === 1 ? y.pattern = x[0].source : x.length > 1 && (c.schema.allOf = [
|
|
2363
2363
|
...x.map((k) => ({
|
|
2364
2364
|
...this.target === "draft-7" ? { type: "string" } : {},
|
|
2365
2365
|
pattern: k.source
|
|
@@ -2369,13 +2369,13 @@ class Wr {
|
|
|
2369
2369
|
break;
|
|
2370
2370
|
}
|
|
2371
2371
|
case "number": {
|
|
2372
|
-
const
|
|
2373
|
-
typeof d == "string" && d.includes("int") ?
|
|
2372
|
+
const y = E, { minimum: w, maximum: h, format: d, multipleOf: v, exclusiveMaximum: f, exclusiveMinimum: x } = t._zod.bag;
|
|
2373
|
+
typeof d == "string" && d.includes("int") ? y.type = "integer" : y.type = "number", typeof x == "number" && (y.exclusiveMinimum = x), typeof w == "number" && (y.minimum = w, typeof x == "number" && (x >= w ? delete y.minimum : delete y.exclusiveMinimum)), typeof f == "number" && (y.exclusiveMaximum = f), typeof h == "number" && (y.maximum = h, typeof f == "number" && (f <= h ? delete y.maximum : delete y.exclusiveMaximum)), typeof v == "number" && (y.multipleOf = v);
|
|
2374
2374
|
break;
|
|
2375
2375
|
}
|
|
2376
2376
|
case "boolean": {
|
|
2377
|
-
const
|
|
2378
|
-
|
|
2377
|
+
const y = E;
|
|
2378
|
+
y.type = "boolean";
|
|
2379
2379
|
break;
|
|
2380
2380
|
}
|
|
2381
2381
|
case "bigint": {
|
|
@@ -2416,16 +2416,16 @@ class Wr {
|
|
|
2416
2416
|
break;
|
|
2417
2417
|
}
|
|
2418
2418
|
case "array": {
|
|
2419
|
-
const
|
|
2420
|
-
typeof w == "number" && (
|
|
2419
|
+
const y = E, { minimum: w, maximum: h } = t._zod.bag;
|
|
2420
|
+
typeof w == "number" && (y.minItems = w), typeof h == "number" && (y.maxItems = h), y.type = "array", y.items = this.process(a.element, { ..._, path: [..._.path, "items"] });
|
|
2421
2421
|
break;
|
|
2422
2422
|
}
|
|
2423
2423
|
case "object": {
|
|
2424
|
-
const
|
|
2425
|
-
|
|
2424
|
+
const y = E;
|
|
2425
|
+
y.type = "object", y.properties = {};
|
|
2426
2426
|
const w = a.shape;
|
|
2427
2427
|
for (const v in w)
|
|
2428
|
-
|
|
2428
|
+
y.properties[v] = this.process(w[v], {
|
|
2429
2429
|
..._,
|
|
2430
2430
|
path: [..._.path, "properties", v]
|
|
2431
2431
|
});
|
|
@@ -2433,22 +2433,22 @@ class Wr {
|
|
|
2433
2433
|
const f = a.shape[v]._zod;
|
|
2434
2434
|
return this.io === "input" ? f.optin === void 0 : f.optout === void 0;
|
|
2435
2435
|
}));
|
|
2436
|
-
d.size > 0 && (
|
|
2436
|
+
d.size > 0 && (y.required = Array.from(d)), ((I = a.catchall) == null ? void 0 : I._zod.def.type) === "never" ? y.additionalProperties = !1 : a.catchall ? a.catchall && (y.additionalProperties = this.process(a.catchall, {
|
|
2437
2437
|
..._,
|
|
2438
2438
|
path: [..._.path, "additionalProperties"]
|
|
2439
|
-
})) : this.io === "output" && (
|
|
2439
|
+
})) : this.io === "output" && (y.additionalProperties = !1);
|
|
2440
2440
|
break;
|
|
2441
2441
|
}
|
|
2442
2442
|
case "union": {
|
|
2443
|
-
const
|
|
2444
|
-
|
|
2443
|
+
const y = E;
|
|
2444
|
+
y.anyOf = a.options.map((w, h) => this.process(w, {
|
|
2445
2445
|
..._,
|
|
2446
2446
|
path: [..._.path, "anyOf", h]
|
|
2447
2447
|
}));
|
|
2448
2448
|
break;
|
|
2449
2449
|
}
|
|
2450
2450
|
case "intersection": {
|
|
2451
|
-
const
|
|
2451
|
+
const y = E, w = this.process(a.left, {
|
|
2452
2452
|
..._,
|
|
2453
2453
|
path: [..._.path, "allOf", 0]
|
|
2454
2454
|
}), h = this.process(a.right, {
|
|
@@ -2458,31 +2458,31 @@ class Wr {
|
|
|
2458
2458
|
...d(w) ? w.allOf : [w],
|
|
2459
2459
|
...d(h) ? h.allOf : [h]
|
|
2460
2460
|
];
|
|
2461
|
-
|
|
2461
|
+
y.allOf = v;
|
|
2462
2462
|
break;
|
|
2463
2463
|
}
|
|
2464
2464
|
case "tuple": {
|
|
2465
|
-
const
|
|
2466
|
-
|
|
2465
|
+
const y = E;
|
|
2466
|
+
y.type = "array";
|
|
2467
2467
|
const w = a.items.map((v, f) => this.process(v, { ..._, path: [..._.path, "prefixItems", f] }));
|
|
2468
|
-
if (this.target === "draft-2020-12" ?
|
|
2468
|
+
if (this.target === "draft-2020-12" ? y.prefixItems = w : y.items = w, a.rest) {
|
|
2469
2469
|
const v = this.process(a.rest, {
|
|
2470
2470
|
..._,
|
|
2471
2471
|
path: [..._.path, "items"]
|
|
2472
2472
|
});
|
|
2473
|
-
this.target === "draft-2020-12" ?
|
|
2473
|
+
this.target === "draft-2020-12" ? y.items = v : y.additionalItems = v;
|
|
2474
2474
|
}
|
|
2475
|
-
a.rest && (
|
|
2475
|
+
a.rest && (y.items = this.process(a.rest, {
|
|
2476
2476
|
..._,
|
|
2477
2477
|
path: [..._.path, "items"]
|
|
2478
2478
|
}));
|
|
2479
2479
|
const { minimum: h, maximum: d } = t._zod.bag;
|
|
2480
|
-
typeof h == "number" && (
|
|
2480
|
+
typeof h == "number" && (y.minItems = h), typeof d == "number" && (y.maxItems = d);
|
|
2481
2481
|
break;
|
|
2482
2482
|
}
|
|
2483
2483
|
case "record": {
|
|
2484
|
-
const
|
|
2485
|
-
|
|
2484
|
+
const y = E;
|
|
2485
|
+
y.type = "object", y.propertyNames = this.process(a.keyType, { ..._, path: [..._.path, "propertyNames"] }), y.additionalProperties = this.process(a.valueType, {
|
|
2486
2486
|
..._,
|
|
2487
2487
|
path: [..._.path, "additionalProperties"]
|
|
2488
2488
|
});
|
|
@@ -2499,12 +2499,12 @@ class Wr {
|
|
|
2499
2499
|
break;
|
|
2500
2500
|
}
|
|
2501
2501
|
case "enum": {
|
|
2502
|
-
const
|
|
2503
|
-
w.every((h) => typeof h == "number") && (
|
|
2502
|
+
const y = E, w = Xn(a.entries);
|
|
2503
|
+
w.every((h) => typeof h == "number") && (y.type = "number"), w.every((h) => typeof h == "string") && (y.type = "string"), y.enum = w;
|
|
2504
2504
|
break;
|
|
2505
2505
|
}
|
|
2506
2506
|
case "literal": {
|
|
2507
|
-
const
|
|
2507
|
+
const y = E, w = [];
|
|
2508
2508
|
for (const h of a.values)
|
|
2509
2509
|
if (h === void 0) {
|
|
2510
2510
|
if (this.unrepresentable === "throw")
|
|
@@ -2517,18 +2517,18 @@ class Wr {
|
|
|
2517
2517
|
w.push(h);
|
|
2518
2518
|
if (w.length !== 0) if (w.length === 1) {
|
|
2519
2519
|
const h = w[0];
|
|
2520
|
-
|
|
2520
|
+
y.type = h === null ? "null" : typeof h, y.const = h;
|
|
2521
2521
|
} else
|
|
2522
|
-
w.every((h) => typeof h == "number") && (
|
|
2522
|
+
w.every((h) => typeof h == "number") && (y.type = "number"), w.every((h) => typeof h == "string") && (y.type = "string"), w.every((h) => typeof h == "boolean") && (y.type = "string"), w.every((h) => h === null) && (y.type = "null"), y.enum = w;
|
|
2523
2523
|
break;
|
|
2524
2524
|
}
|
|
2525
2525
|
case "file": {
|
|
2526
|
-
const
|
|
2526
|
+
const y = E, w = {
|
|
2527
2527
|
type: "string",
|
|
2528
2528
|
format: "binary",
|
|
2529
2529
|
contentEncoding: "binary"
|
|
2530
2530
|
}, { minimum: h, maximum: d, mime: v } = t._zod.bag;
|
|
2531
|
-
h !== void 0 && (w.minLength = h), d !== void 0 && (w.maxLength = d), v ? v.length === 1 ? (w.contentMediaType = v[0], Object.assign(
|
|
2531
|
+
h !== void 0 && (w.minLength = h), d !== void 0 && (w.maxLength = d), v ? v.length === 1 ? (w.contentMediaType = v[0], Object.assign(y, w)) : y.anyOf = v.map((f) => ({ ...w, contentMediaType: f })) : Object.assign(y, w);
|
|
2532
2532
|
break;
|
|
2533
2533
|
}
|
|
2534
2534
|
case "transform": {
|
|
@@ -2537,8 +2537,8 @@ class Wr {
|
|
|
2537
2537
|
break;
|
|
2538
2538
|
}
|
|
2539
2539
|
case "nullable": {
|
|
2540
|
-
const
|
|
2541
|
-
E.anyOf = [
|
|
2540
|
+
const y = this.process(a.innerType, _);
|
|
2541
|
+
E.anyOf = [y, { type: "null" }];
|
|
2542
2542
|
break;
|
|
2543
2543
|
}
|
|
2544
2544
|
case "nonoptional": {
|
|
@@ -2546,8 +2546,8 @@ class Wr {
|
|
|
2546
2546
|
break;
|
|
2547
2547
|
}
|
|
2548
2548
|
case "success": {
|
|
2549
|
-
const
|
|
2550
|
-
|
|
2549
|
+
const y = E;
|
|
2550
|
+
y.type = "boolean";
|
|
2551
2551
|
break;
|
|
2552
2552
|
}
|
|
2553
2553
|
case "default": {
|
|
@@ -2560,13 +2560,13 @@ class Wr {
|
|
|
2560
2560
|
}
|
|
2561
2561
|
case "catch": {
|
|
2562
2562
|
this.process(a.innerType, _), c.ref = a.innerType;
|
|
2563
|
-
let
|
|
2563
|
+
let y;
|
|
2564
2564
|
try {
|
|
2565
|
-
|
|
2565
|
+
y = a.catchValue(void 0);
|
|
2566
2566
|
} catch {
|
|
2567
2567
|
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
2568
2568
|
}
|
|
2569
|
-
E.default =
|
|
2569
|
+
E.default = y;
|
|
2570
2570
|
break;
|
|
2571
2571
|
}
|
|
2572
2572
|
case "nan": {
|
|
@@ -2575,15 +2575,15 @@ class Wr {
|
|
|
2575
2575
|
break;
|
|
2576
2576
|
}
|
|
2577
2577
|
case "template_literal": {
|
|
2578
|
-
const
|
|
2578
|
+
const y = E, w = t._zod.pattern;
|
|
2579
2579
|
if (!w)
|
|
2580
2580
|
throw new Error("Pattern not found in template literal");
|
|
2581
|
-
|
|
2581
|
+
y.type = "string", y.pattern = w.source;
|
|
2582
2582
|
break;
|
|
2583
2583
|
}
|
|
2584
2584
|
case "pipe": {
|
|
2585
|
-
const
|
|
2586
|
-
this.process(
|
|
2585
|
+
const y = this.io === "input" ? a.in._zod.def.type === "transform" ? a.out : a.in : a.out;
|
|
2586
|
+
this.process(y, _), c.ref = y;
|
|
2587
2587
|
break;
|
|
2588
2588
|
}
|
|
2589
2589
|
case "readonly": {
|
|
@@ -2599,8 +2599,8 @@ class Wr {
|
|
|
2599
2599
|
break;
|
|
2600
2600
|
}
|
|
2601
2601
|
case "lazy": {
|
|
2602
|
-
const
|
|
2603
|
-
this.process(
|
|
2602
|
+
const y = t._zod.innerType;
|
|
2603
|
+
this.process(y, _), c.ref = y;
|
|
2604
2604
|
break;
|
|
2605
2605
|
}
|
|
2606
2606
|
case "custom": {
|
|
@@ -2615,7 +2615,7 @@ class Wr {
|
|
|
2615
2615
|
return i && Object.assign(c.schema, i), this.io === "input" && B(t) && (delete c.schema.examples, delete c.schema.default), this.io === "input" && c.schema._prefault && ((n = c.schema).default ?? (n.default = c.schema._prefault)), delete c.schema._prefault, this.seen.get(t).schema;
|
|
2616
2616
|
}
|
|
2617
2617
|
emit(t, r) {
|
|
2618
|
-
var
|
|
2618
|
+
var b, u, g, I, _, N;
|
|
2619
2619
|
const n = {
|
|
2620
2620
|
cycles: (r == null ? void 0 : r.cycles) ?? "ref",
|
|
2621
2621
|
reused: (r == null ? void 0 : r.reused) ?? "inline",
|
|
@@ -2627,38 +2627,38 @@ class Wr {
|
|
|
2627
2627
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2628
2628
|
const o = (E) => {
|
|
2629
2629
|
var v;
|
|
2630
|
-
const
|
|
2630
|
+
const y = this.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
2631
2631
|
if (n.external) {
|
|
2632
2632
|
const f = (v = n.external.registry.get(E[0])) == null ? void 0 : v.id, x = n.external.uri ?? ((C) => C);
|
|
2633
2633
|
if (f)
|
|
2634
2634
|
return { ref: x(f) };
|
|
2635
2635
|
const k = E[1].defId ?? E[1].schema.id ?? `schema${this.counter++}`;
|
|
2636
|
-
return E[1].defId = k, { defId: k, ref: `${x("__shared")}#/${
|
|
2636
|
+
return E[1].defId = k, { defId: k, ref: `${x("__shared")}#/${y}/${k}` };
|
|
2637
2637
|
}
|
|
2638
2638
|
if (E[1] === a)
|
|
2639
2639
|
return { ref: "#" };
|
|
2640
|
-
const h = `#/${
|
|
2640
|
+
const h = `#/${y}/`, d = E[1].schema.id ?? `__schema${this.counter++}`;
|
|
2641
2641
|
return { defId: d, ref: h + d };
|
|
2642
2642
|
}, s = (E) => {
|
|
2643
2643
|
if (E[1].schema.$ref)
|
|
2644
2644
|
return;
|
|
2645
|
-
const
|
|
2646
|
-
|
|
2647
|
-
const d =
|
|
2645
|
+
const y = E[1], { ref: w, defId: h } = o(E);
|
|
2646
|
+
y.def = { ...y.schema }, h && (y.defId = h);
|
|
2647
|
+
const d = y.schema;
|
|
2648
2648
|
for (const v in d)
|
|
2649
2649
|
delete d[v];
|
|
2650
2650
|
d.$ref = w;
|
|
2651
2651
|
};
|
|
2652
2652
|
if (n.cycles === "throw")
|
|
2653
2653
|
for (const E of this.seen.entries()) {
|
|
2654
|
-
const
|
|
2655
|
-
if (
|
|
2656
|
-
throw new Error(`Cycle detected: #/${(
|
|
2654
|
+
const y = E[1];
|
|
2655
|
+
if (y.cycle)
|
|
2656
|
+
throw new Error(`Cycle detected: #/${(b = y.cycle) == null ? void 0 : b.join("/")}/<root>
|
|
2657
2657
|
|
|
2658
2658
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
2659
2659
|
}
|
|
2660
2660
|
for (const E of this.seen.entries()) {
|
|
2661
|
-
const
|
|
2661
|
+
const y = E[1];
|
|
2662
2662
|
if (t === E[0]) {
|
|
2663
2663
|
s(E);
|
|
2664
2664
|
continue;
|
|
@@ -2674,24 +2674,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
2674
2674
|
s(E);
|
|
2675
2675
|
continue;
|
|
2676
2676
|
}
|
|
2677
|
-
if (
|
|
2677
|
+
if (y.cycle) {
|
|
2678
2678
|
s(E);
|
|
2679
2679
|
continue;
|
|
2680
2680
|
}
|
|
2681
|
-
if (
|
|
2681
|
+
if (y.count > 1 && n.reused === "ref") {
|
|
2682
2682
|
s(E);
|
|
2683
2683
|
continue;
|
|
2684
2684
|
}
|
|
2685
2685
|
}
|
|
2686
|
-
const c = (E,
|
|
2686
|
+
const c = (E, y) => {
|
|
2687
2687
|
const w = this.seen.get(E), h = w.def ?? w.schema, d = { ...h };
|
|
2688
2688
|
if (w.ref === null)
|
|
2689
2689
|
return;
|
|
2690
2690
|
const v = w.ref;
|
|
2691
2691
|
if (w.ref = null, v) {
|
|
2692
|
-
c(v,
|
|
2692
|
+
c(v, y);
|
|
2693
2693
|
const f = this.seen.get(v).schema;
|
|
2694
|
-
f.$ref &&
|
|
2694
|
+
f.$ref && y.target === "draft-7" ? (h.allOf = h.allOf ?? [], h.allOf.push(f)) : (Object.assign(h, f), Object.assign(h, d));
|
|
2695
2695
|
}
|
|
2696
2696
|
w.isParent || this.override({
|
|
2697
2697
|
zodSchema: E,
|
|
@@ -2711,8 +2711,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
2711
2711
|
Object.assign(p, a.def);
|
|
2712
2712
|
const i = ((N = n.external) == null ? void 0 : N.defs) ?? {};
|
|
2713
2713
|
for (const E of this.seen.entries()) {
|
|
2714
|
-
const
|
|
2715
|
-
|
|
2714
|
+
const y = E[1];
|
|
2715
|
+
y.def && y.defId && (i[y.defId] = y.def);
|
|
2716
2716
|
}
|
|
2717
2717
|
n.external || Object.keys(i).length > 0 && (this.target === "draft-2020-12" ? p.$defs = i : p.definitions = i);
|
|
2718
2718
|
try {
|
|
@@ -2890,7 +2890,7 @@ const Rc = (e, t) => {
|
|
|
2890
2890
|
]
|
|
2891
2891
|
}
|
|
2892
2892
|
// { parent: true }
|
|
2893
|
-
), e.clone = (r, n) => Ae(e, r, n), e.brand = () => e, e.register = (r, n) => (r.add(e, n), e), e.parse = (r, n) => Zc(e, r, n, { callee: e.parse }), e.safeParse = (r, n) => jc(e, r, n), e.parseAsync = async (r, n) => Dc(e, r, n, { callee: e.parseAsync }), e.safeParseAsync = async (r, n) => va(e, r, n), e.spa = e.safeParseAsync, e.refine = (r, n) => e.check(Lu(r, n)), e.superRefine = (r) => e.check(Uu(r)), e.overwrite = (r) => e.check(tt(r)), e.optional = () => Hr(e), e.nullable = () => Xr(e), e.nullish = () => Hr(Xr(e)), e.nonoptional = (r) => $u(e, r), e.array = () => wa(e), e.or = (r) => Sa([e, r]), e.and = (r) =>
|
|
2893
|
+
), e.clone = (r, n) => Ae(e, r, n), e.brand = () => e, e.register = (r, n) => (r.add(e, n), e), e.parse = (r, n) => Zc(e, r, n, { callee: e.parse }), e.safeParse = (r, n) => jc(e, r, n), e.parseAsync = async (r, n) => Dc(e, r, n, { callee: e.parseAsync }), e.safeParseAsync = async (r, n) => va(e, r, n), e.spa = e.safeParseAsync, e.refine = (r, n) => e.check(Lu(r, n)), e.superRefine = (r) => e.check(Uu(r)), e.overwrite = (r) => e.check(tt(r)), e.optional = () => Hr(e), e.nullable = () => Xr(e), e.nullish = () => Hr(Xr(e)), e.nonoptional = (r) => $u(e, r), e.array = () => wa(e), e.or = (r) => Sa([e, r]), e.and = (r) => bu(e, r), e.transform = (r) => Qr(e, Eu(r)), e.default = (r) => Tu(e, r), e.prefault = (r) => Cu(e, r), e.catch = (r) => Ou(e, r), e.pipe = (r) => Qr(e, r), e.readonly = () => Ru(e), e.describe = (r) => {
|
|
2894
2894
|
const n = e.clone();
|
|
2895
2895
|
return Ue.add(n, { description: r }), n;
|
|
2896
2896
|
}, Object.defineProperty(e, "description", {
|
|
@@ -2904,18 +2904,18 @@ const Rc = (e, t) => {
|
|
|
2904
2904
|
return Ue.get(e);
|
|
2905
2905
|
const n = e.clone();
|
|
2906
2906
|
return Ue.add(n, r[0]), n;
|
|
2907
|
-
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)),
|
|
2907
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), ya = /* @__PURE__ */ S("_ZodString", (e, t) => {
|
|
2908
2908
|
rr.init(e, t), F.init(e, t);
|
|
2909
2909
|
const r = e._zod.bag;
|
|
2910
|
-
e.format = r.format ?? null, e.minLength = r.minimum ?? null, e.maxLength = r.maximum ?? null, e.regex = (...n) => e.check(mc(...n)), e.includes = (...n) => e.check(vc(...n)), e.startsWith = (...n) => e.check(
|
|
2910
|
+
e.format = r.format ?? null, e.minLength = r.minimum ?? null, e.maxLength = r.maximum ?? null, e.regex = (...n) => e.check(mc(...n)), e.includes = (...n) => e.check(vc(...n)), e.startsWith = (...n) => e.check(yc(...n)), e.endsWith = (...n) => e.check(bc(...n)), e.min = (...n) => e.check(gt(...n)), e.max = (...n) => e.check(ha(...n)), e.length = (...n) => e.check(ga(...n)), e.nonempty = (...n) => e.check(gt(1, ...n)), e.lowercase = (n) => e.check(hc(n)), e.uppercase = (n) => e.check(gc(n)), e.trim = () => e.check(wc()), e.normalize = (...n) => e.check(xc(...n)), e.toLowerCase = () => e.check(_c()), e.toUpperCase = () => e.check(Ic());
|
|
2911
2911
|
}), Fc = /* @__PURE__ */ S("ZodString", (e, t) => {
|
|
2912
|
-
rr.init(e, t),
|
|
2912
|
+
rr.init(e, t), ya.init(e, t), e.email = (r) => e.check(Zl(Uc, r)), e.url = (r) => e.check(Ul(Bc, r)), e.jwt = (r) => e.check(nc(au, r)), e.emoji = (r) => e.check(Bl(Vc, r)), e.guid = (r) => e.check(Vr(Gr, r)), e.uuid = (r) => e.check(Dl(lt, r)), e.uuidv4 = (r) => e.check(jl(lt, r)), e.uuidv6 = (r) => e.check(Fl(lt, r)), e.uuidv7 = (r) => e.check(Ll(lt, r)), e.nanoid = (r) => e.check(Vl(qc, r)), e.guid = (r) => e.check(Vr(Gr, r)), e.cuid = (r) => e.check(ql(Jc, r)), e.cuid2 = (r) => e.check(Jl(Kc, r)), e.ulid = (r) => e.check(Kl(Wc, r)), e.base64 = (r) => e.check(ec(tu, r)), e.base64url = (r) => e.check(tc(ru, r)), e.xid = (r) => e.check(Wl(Gc, r)), e.ksuid = (r) => e.check(Gl(Yc, r)), e.ipv4 = (r) => e.check(Yl(Hc, r)), e.ipv6 = (r) => e.check(Hl(Xc, r)), e.cidrv4 = (r) => e.check(Xl(Qc, r)), e.cidrv6 = (r) => e.check(Ql(eu, r)), e.e164 = (r) => e.check(rc(nu, r)), e.datetime = (r) => e.check(Ac(r)), e.date = (r) => e.check($c(r)), e.time = (r) => e.check(Oc(r)), e.duration = (r) => e.check(Pc(r));
|
|
2913
2913
|
});
|
|
2914
2914
|
function Lc(e) {
|
|
2915
2915
|
return Rl(Fc, e);
|
|
2916
2916
|
}
|
|
2917
2917
|
const U = /* @__PURE__ */ S("ZodStringFormat", (e, t) => {
|
|
2918
|
-
j.init(e, t),
|
|
2918
|
+
j.init(e, t), ya.init(e, t);
|
|
2919
2919
|
}), Uc = /* @__PURE__ */ S("ZodEmail", (e, t) => {
|
|
2920
2920
|
Bi.init(e, t), U.init(e, t);
|
|
2921
2921
|
}), Gr = /* @__PURE__ */ S("ZodGUID", (e, t) => {
|
|
@@ -2954,16 +2954,16 @@ const U = /* @__PURE__ */ S("ZodStringFormat", (e, t) => {
|
|
|
2954
2954
|
cl.init(e, t), U.init(e, t);
|
|
2955
2955
|
}), au = /* @__PURE__ */ S("ZodJWT", (e, t) => {
|
|
2956
2956
|
dl.init(e, t), U.init(e, t);
|
|
2957
|
-
}),
|
|
2957
|
+
}), ba = /* @__PURE__ */ S("ZodNumber", (e, t) => {
|
|
2958
2958
|
pa.init(e, t), F.init(e, t), e.gt = (n, a) => e.check(Jr(n, a)), e.gte = (n, a) => e.check(Tt(n, a)), e.min = (n, a) => e.check(Tt(n, a)), e.lt = (n, a) => e.check(qr(n, a)), e.lte = (n, a) => e.check(kt(n, a)), e.max = (n, a) => e.check(kt(n, a)), e.int = (n) => e.check(Yr(n)), e.safe = (n) => e.check(Yr(n)), e.positive = (n) => e.check(Jr(0, n)), e.nonnegative = (n) => e.check(Tt(0, n)), e.negative = (n) => e.check(qr(0, n)), e.nonpositive = (n) => e.check(kt(0, n)), e.multipleOf = (n, a) => e.check(Kr(n, a)), e.step = (n, a) => e.check(Kr(n, a)), e.finite = () => e;
|
|
2959
2959
|
const r = e._zod.bag;
|
|
2960
2960
|
e.minValue = Math.max(r.minimum ?? Number.NEGATIVE_INFINITY, r.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(r.maximum ?? Number.POSITIVE_INFINITY, r.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (r.format ?? "").includes("int") || Number.isSafeInteger(r.multipleOf ?? 0.5), e.isFinite = !0, e.format = r.format ?? null;
|
|
2961
2961
|
});
|
|
2962
2962
|
function ou(e) {
|
|
2963
|
-
return lc(
|
|
2963
|
+
return lc(ba, e);
|
|
2964
2964
|
}
|
|
2965
2965
|
const su = /* @__PURE__ */ S("ZodNumberFormat", (e, t) => {
|
|
2966
|
-
pl.init(e, t),
|
|
2966
|
+
pl.init(e, t), ba.init(e, t);
|
|
2967
2967
|
});
|
|
2968
2968
|
function Yr(e) {
|
|
2969
2969
|
return cc(su, e);
|
|
@@ -2999,7 +2999,7 @@ function wa(e, t) {
|
|
|
2999
2999
|
return Sc(fu, e, t);
|
|
3000
3000
|
}
|
|
3001
3001
|
const _a = /* @__PURE__ */ S("ZodObject", (e, t) => {
|
|
3002
|
-
|
|
3002
|
+
yl.init(e, t), F.init(e, t), P(e, "shape", () => t.shape), e.keyof = () => Ea(Object.keys(e._zod.def.shape)), e.catchall = (r) => e.clone({ ...e._zod.def, catchall: r }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: vt() }), e.loose = () => e.clone({ ...e._zod.def, catchall: vt() }), e.strict = () => e.clone({ ...e._zod.def, catchall: xa() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (r) => Bs(e, r), e.merge = (r) => Vs(e, r), e.pick = (r) => Ls(e, r), e.omit = (r) => Us(e, r), e.partial = (...r) => qs(Na, e, r[0]), e.required = (...r) => Js(ka, e, r[0]);
|
|
3003
3003
|
});
|
|
3004
3004
|
function mu(e, t) {
|
|
3005
3005
|
const r = {
|
|
@@ -3032,7 +3032,7 @@ function Sa(e, t) {
|
|
|
3032
3032
|
});
|
|
3033
3033
|
}
|
|
3034
3034
|
const gu = /* @__PURE__ */ S("ZodDiscriminatedUnion", (e, t) => {
|
|
3035
|
-
Ia.init(e, t),
|
|
3035
|
+
Ia.init(e, t), bl.init(e, t);
|
|
3036
3036
|
});
|
|
3037
3037
|
function vu(e, t, r) {
|
|
3038
3038
|
return new gu({
|
|
@@ -3042,11 +3042,11 @@ function vu(e, t, r) {
|
|
|
3042
3042
|
...$(r)
|
|
3043
3043
|
});
|
|
3044
3044
|
}
|
|
3045
|
-
const
|
|
3045
|
+
const yu = /* @__PURE__ */ S("ZodIntersection", (e, t) => {
|
|
3046
3046
|
xl.init(e, t), F.init(e, t);
|
|
3047
3047
|
});
|
|
3048
|
-
function
|
|
3049
|
-
return new
|
|
3048
|
+
function bu(e, t) {
|
|
3049
|
+
return new yu({
|
|
3050
3050
|
type: "intersection",
|
|
3051
3051
|
left: e,
|
|
3052
3052
|
right: t
|
|
@@ -3282,7 +3282,7 @@ function qu(e) {
|
|
|
3282
3282
|
"`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
|
|
3283
3283
|
);
|
|
3284
3284
|
const { onEvent: t = Ct, onError: r = Ct, onRetry: n = Ct, onComment: a, maxBufferSize: o } = e, s = [];
|
|
3285
|
-
let c = 0, p = !0, i,
|
|
3285
|
+
let c = 0, p = !0, i, b = "", u = 0, g, I = !1;
|
|
3286
3286
|
function _(v) {
|
|
3287
3287
|
if (I)
|
|
3288
3288
|
throw new Error(
|
|
@@ -3305,7 +3305,7 @@ function qu(e) {
|
|
|
3305
3305
|
x !== "" && (s.push(x), c = x.length), N();
|
|
3306
3306
|
}
|
|
3307
3307
|
function N() {
|
|
3308
|
-
o !== void 0 && (c +
|
|
3308
|
+
o !== void 0 && (c + b.length <= o || (I = !0, s.length = 0, c = 0, i = void 0, b = "", u = 0, g = void 0, r(
|
|
3309
3309
|
new At(`Buffered data exceeded max buffer size of ${o} characters`, {
|
|
3310
3310
|
type: "max-buffer-size-exceeded"
|
|
3311
3311
|
})
|
|
@@ -3318,7 +3318,7 @@ function qu(e) {
|
|
|
3318
3318
|
`, f);
|
|
3319
3319
|
for (; x !== -1; ) {
|
|
3320
3320
|
if (f === x) {
|
|
3321
|
-
u > 0 && t({ id: i, event: g, data:
|
|
3321
|
+
u > 0 && t({ id: i, event: g, data: b }), i = void 0, b = "", u = 0, g = void 0, f = x + 1, x = v.indexOf(`
|
|
3322
3322
|
`, f);
|
|
3323
3323
|
continue;
|
|
3324
3324
|
}
|
|
@@ -3326,16 +3326,16 @@ function qu(e) {
|
|
|
3326
3326
|
if (tn(v, f, k)) {
|
|
3327
3327
|
const C = v.charCodeAt(f + 5) === xe ? f + 6 : f + 5, M = v.slice(C, x);
|
|
3328
3328
|
if (u === 0 && v.charCodeAt(x + 1) === en) {
|
|
3329
|
-
t({ id: i, event: g, data: M }), i = void 0,
|
|
3329
|
+
t({ id: i, event: g, data: M }), i = void 0, b = "", g = void 0, f = x + 2, x = v.indexOf(`
|
|
3330
3330
|
`, f);
|
|
3331
3331
|
continue;
|
|
3332
3332
|
}
|
|
3333
|
-
|
|
3333
|
+
b = u === 0 ? M : `${b}
|
|
3334
3334
|
${M}`, u++;
|
|
3335
3335
|
} else rn(v, f, k) ? g = v.slice(
|
|
3336
3336
|
v.charCodeAt(f + 6) === xe ? f + 7 : f + 6,
|
|
3337
3337
|
x
|
|
3338
|
-
) || void 0 :
|
|
3338
|
+
) || void 0 : y(v, f, x);
|
|
3339
3339
|
f = x + 1, x = v.indexOf(`
|
|
3340
3340
|
`, f);
|
|
3341
3341
|
}
|
|
@@ -3347,11 +3347,11 @@ ${M}`, u++;
|
|
|
3347
3347
|
let C = -1;
|
|
3348
3348
|
if (x !== -1 && k !== -1 ? C = x < k ? x : k : x !== -1 ? x === v.length - 1 ? C = -1 : C = x : k !== -1 && (C = k), C === -1)
|
|
3349
3349
|
break;
|
|
3350
|
-
|
|
3350
|
+
y(v, f, C), f = C + 1, v.charCodeAt(f - 1) === Vu && v.charCodeAt(f) === en && f++;
|
|
3351
3351
|
}
|
|
3352
3352
|
return v.slice(f);
|
|
3353
3353
|
}
|
|
3354
|
-
function
|
|
3354
|
+
function y(v, f, x) {
|
|
3355
3355
|
if (f === x) {
|
|
3356
3356
|
h();
|
|
3357
3357
|
return;
|
|
@@ -3359,7 +3359,7 @@ ${M}`, u++;
|
|
|
3359
3359
|
const k = v.charCodeAt(f);
|
|
3360
3360
|
if (tn(v, f, k)) {
|
|
3361
3361
|
const G = v.charCodeAt(f + 5) === xe ? f + 6 : f + 5, pe = v.slice(G, x);
|
|
3362
|
-
|
|
3362
|
+
b = u === 0 ? pe : `${b}
|
|
3363
3363
|
${pe}`, u++;
|
|
3364
3364
|
return;
|
|
3365
3365
|
}
|
|
@@ -3393,7 +3393,7 @@ ${pe}`, u++;
|
|
|
3393
3393
|
g = f || void 0;
|
|
3394
3394
|
break;
|
|
3395
3395
|
case "data":
|
|
3396
|
-
|
|
3396
|
+
b = u === 0 ? f : `${b}
|
|
3397
3397
|
${f}`, u++;
|
|
3398
3398
|
break;
|
|
3399
3399
|
case "id":
|
|
@@ -3422,15 +3422,15 @@ ${f}`, u++;
|
|
|
3422
3422
|
u > 0 && t({
|
|
3423
3423
|
id: i,
|
|
3424
3424
|
event: g,
|
|
3425
|
-
data:
|
|
3426
|
-
}), i = void 0,
|
|
3425
|
+
data: b
|
|
3426
|
+
}), i = void 0, b = "", u = 0, g = void 0;
|
|
3427
3427
|
}
|
|
3428
3428
|
function d(v = {}) {
|
|
3429
3429
|
if (v.consume && s.length > 0) {
|
|
3430
3430
|
const f = s.join("");
|
|
3431
|
-
|
|
3431
|
+
y(f, 0, f.length);
|
|
3432
3432
|
}
|
|
3433
|
-
p = !0, i = void 0,
|
|
3433
|
+
p = !0, i = void 0, b = "", u = 0, g = void 0, s.length = 0, c = 0, I = !1;
|
|
3434
3434
|
}
|
|
3435
3435
|
return { feed: _, reset: d };
|
|
3436
3436
|
}
|
|
@@ -3980,7 +3980,7 @@ const Ut = {
|
|
|
3980
3980
|
ZodBoolean: "boolean",
|
|
3981
3981
|
ZodNull: "null"
|
|
3982
3982
|
};
|
|
3983
|
-
function
|
|
3983
|
+
function yd(e, t) {
|
|
3984
3984
|
const r = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
3985
3985
|
if (r.every((n) => n._def.typeName in Ut && (!n._def.checks || !n._def.checks.length))) {
|
|
3986
3986
|
const n = r.reduce((a, o) => {
|
|
@@ -4015,9 +4015,9 @@ function bd(e, t) {
|
|
|
4015
4015
|
type: "string",
|
|
4016
4016
|
enum: r.reduce((n, a) => [...n, ...a._def.values.filter((o) => !n.includes(o))], [])
|
|
4017
4017
|
};
|
|
4018
|
-
return
|
|
4018
|
+
return bd(e, t);
|
|
4019
4019
|
}
|
|
4020
|
-
const
|
|
4020
|
+
const bd = (e, t) => {
|
|
4021
4021
|
const r = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((n, a) => R(n._def, {
|
|
4022
4022
|
...t,
|
|
4023
4023
|
currentPath: [
|
|
@@ -4216,7 +4216,7 @@ const zd = (e, t) => R(e.innerType._def, t), Od = (e, t, r) => {
|
|
|
4216
4216
|
return td(e, r);
|
|
4217
4217
|
case "ZodUnion":
|
|
4218
4218
|
case "ZodDiscriminatedUnion":
|
|
4219
|
-
return
|
|
4219
|
+
return yd(e, r);
|
|
4220
4220
|
case "ZodIntersection":
|
|
4221
4221
|
return ud(e, r);
|
|
4222
4222
|
case "ZodTuple":
|
|
@@ -4329,9 +4329,9 @@ const Pd = (e, t) => {
|
|
|
4329
4329
|
};
|
|
4330
4330
|
}, Dd = (e, t) => {
|
|
4331
4331
|
const r = Zd(t);
|
|
4332
|
-
let n = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((p, [i,
|
|
4332
|
+
let n = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((p, [i, b]) => ({
|
|
4333
4333
|
...p,
|
|
4334
|
-
[i]: R(
|
|
4334
|
+
[i]: R(b._def, {
|
|
4335
4335
|
...r,
|
|
4336
4336
|
currentPath: [
|
|
4337
4337
|
...r.basePath,
|
|
@@ -4813,11 +4813,11 @@ l.union([
|
|
|
4813
4813
|
function cp(e) {
|
|
4814
4814
|
const t = ["ROOT"];
|
|
4815
4815
|
let r = -1, n = null, a = 0;
|
|
4816
|
-
function o(
|
|
4817
|
-
return
|
|
4816
|
+
function o(b) {
|
|
4817
|
+
return b >= "0" && b <= "9" || b >= "A" && b <= "F" || b >= "a" && b <= "f";
|
|
4818
4818
|
}
|
|
4819
|
-
function s(
|
|
4820
|
-
switch (
|
|
4819
|
+
function s(b, u, g) {
|
|
4820
|
+
switch (b) {
|
|
4821
4821
|
case '"':
|
|
4822
4822
|
r = u, t.pop(), t.push(g), t.push("INSIDE_STRING");
|
|
4823
4823
|
break;
|
|
@@ -4848,8 +4848,8 @@ function cp(e) {
|
|
|
4848
4848
|
r = u, t.pop(), t.push(g), t.push("INSIDE_ARRAY_START");
|
|
4849
4849
|
}
|
|
4850
4850
|
}
|
|
4851
|
-
function c(
|
|
4852
|
-
switch (
|
|
4851
|
+
function c(b, u) {
|
|
4852
|
+
switch (b) {
|
|
4853
4853
|
case ",":
|
|
4854
4854
|
t.pop(), t.push("INSIDE_OBJECT_AFTER_COMMA");
|
|
4855
4855
|
break;
|
|
@@ -4857,8 +4857,8 @@ function cp(e) {
|
|
|
4857
4857
|
r = u, t.pop();
|
|
4858
4858
|
}
|
|
4859
4859
|
}
|
|
4860
|
-
function p(
|
|
4861
|
-
switch (
|
|
4860
|
+
function p(b, u) {
|
|
4861
|
+
switch (b) {
|
|
4862
4862
|
case ",":
|
|
4863
4863
|
t.pop(), t.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
4864
4864
|
break;
|
|
@@ -4866,11 +4866,11 @@ function cp(e) {
|
|
|
4866
4866
|
r = u, t.pop();
|
|
4867
4867
|
}
|
|
4868
4868
|
}
|
|
4869
|
-
for (let
|
|
4870
|
-
const u = e[
|
|
4869
|
+
for (let b = 0; b < e.length; b++) {
|
|
4870
|
+
const u = e[b];
|
|
4871
4871
|
switch (t[t.length - 1]) {
|
|
4872
4872
|
case "ROOT":
|
|
4873
|
-
s(u,
|
|
4873
|
+
s(u, b, "FINISH");
|
|
4874
4874
|
break;
|
|
4875
4875
|
case "INSIDE_OBJECT_START":
|
|
4876
4876
|
switch (u) {
|
|
@@ -4878,7 +4878,7 @@ function cp(e) {
|
|
|
4878
4878
|
t.pop(), t.push("INSIDE_OBJECT_KEY");
|
|
4879
4879
|
break;
|
|
4880
4880
|
case "}":
|
|
4881
|
-
r =
|
|
4881
|
+
r = b, t.pop();
|
|
4882
4882
|
}
|
|
4883
4883
|
break;
|
|
4884
4884
|
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
@@ -4900,30 +4900,30 @@ function cp(e) {
|
|
|
4900
4900
|
}
|
|
4901
4901
|
break;
|
|
4902
4902
|
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
4903
|
-
s(u,
|
|
4903
|
+
s(u, b, "INSIDE_OBJECT_AFTER_VALUE");
|
|
4904
4904
|
break;
|
|
4905
4905
|
case "INSIDE_OBJECT_AFTER_VALUE":
|
|
4906
|
-
c(u,
|
|
4906
|
+
c(u, b);
|
|
4907
4907
|
break;
|
|
4908
4908
|
case "INSIDE_STRING":
|
|
4909
4909
|
switch (u) {
|
|
4910
4910
|
case '"':
|
|
4911
|
-
t.pop(), r =
|
|
4911
|
+
t.pop(), r = b;
|
|
4912
4912
|
break;
|
|
4913
4913
|
case "\\":
|
|
4914
4914
|
t.push("INSIDE_STRING_ESCAPE");
|
|
4915
4915
|
break;
|
|
4916
4916
|
default:
|
|
4917
|
-
r =
|
|
4917
|
+
r = b;
|
|
4918
4918
|
}
|
|
4919
4919
|
break;
|
|
4920
4920
|
case "INSIDE_ARRAY_START":
|
|
4921
4921
|
switch (u) {
|
|
4922
4922
|
case "]":
|
|
4923
|
-
r =
|
|
4923
|
+
r = b, t.pop();
|
|
4924
4924
|
break;
|
|
4925
4925
|
default:
|
|
4926
|
-
r =
|
|
4926
|
+
r = b, s(u, b, "INSIDE_ARRAY_AFTER_VALUE");
|
|
4927
4927
|
}
|
|
4928
4928
|
break;
|
|
4929
4929
|
case "INSIDE_ARRAY_AFTER_VALUE":
|
|
@@ -4932,20 +4932,20 @@ function cp(e) {
|
|
|
4932
4932
|
t.pop(), t.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
4933
4933
|
break;
|
|
4934
4934
|
case "]":
|
|
4935
|
-
r =
|
|
4935
|
+
r = b, t.pop();
|
|
4936
4936
|
break;
|
|
4937
4937
|
default:
|
|
4938
|
-
r =
|
|
4938
|
+
r = b;
|
|
4939
4939
|
}
|
|
4940
4940
|
break;
|
|
4941
4941
|
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
4942
|
-
s(u,
|
|
4942
|
+
s(u, b, "INSIDE_ARRAY_AFTER_VALUE");
|
|
4943
4943
|
break;
|
|
4944
4944
|
case "INSIDE_STRING_ESCAPE":
|
|
4945
|
-
t.pop(), u === "u" ? (a = 0, t.push("INSIDE_STRING_UNICODE_ESCAPE")) : r =
|
|
4945
|
+
t.pop(), u === "u" ? (a = 0, t.push("INSIDE_STRING_UNICODE_ESCAPE")) : r = b;
|
|
4946
4946
|
break;
|
|
4947
4947
|
case "INSIDE_STRING_UNICODE_ESCAPE":
|
|
4948
|
-
o(u) && (a++, a === 4 && (t.pop(), r =
|
|
4948
|
+
o(u) && (a++, a === 4 && (t.pop(), r = b));
|
|
4949
4949
|
break;
|
|
4950
4950
|
case "INSIDE_NUMBER":
|
|
4951
4951
|
switch (u) {
|
|
@@ -4959,7 +4959,7 @@ function cp(e) {
|
|
|
4959
4959
|
case "7":
|
|
4960
4960
|
case "8":
|
|
4961
4961
|
case "9":
|
|
4962
|
-
r =
|
|
4962
|
+
r = b;
|
|
4963
4963
|
break;
|
|
4964
4964
|
case "e":
|
|
4965
4965
|
case "E":
|
|
@@ -4967,27 +4967,27 @@ function cp(e) {
|
|
|
4967
4967
|
case ".":
|
|
4968
4968
|
break;
|
|
4969
4969
|
case ",":
|
|
4970
|
-
t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && p(u,
|
|
4970
|
+
t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && p(u, b), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" && c(u, b);
|
|
4971
4971
|
break;
|
|
4972
4972
|
case "}":
|
|
4973
|
-
t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" && c(u,
|
|
4973
|
+
t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" && c(u, b);
|
|
4974
4974
|
break;
|
|
4975
4975
|
case "]":
|
|
4976
|
-
t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && p(u,
|
|
4976
|
+
t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && p(u, b);
|
|
4977
4977
|
break;
|
|
4978
4978
|
default:
|
|
4979
4979
|
t.pop();
|
|
4980
4980
|
}
|
|
4981
4981
|
break;
|
|
4982
4982
|
case "INSIDE_LITERAL": {
|
|
4983
|
-
const g = e.substring(n,
|
|
4984
|
-
!"false".startsWith(g) && !"true".startsWith(g) && !"null".startsWith(g) ? (t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" ? c(u,
|
|
4983
|
+
const g = e.substring(n, b + 1);
|
|
4984
|
+
!"false".startsWith(g) && !"true".startsWith(g) && !"null".startsWith(g) ? (t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" ? c(u, b) : t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && p(u, b)) : r = b;
|
|
4985
4985
|
break;
|
|
4986
4986
|
}
|
|
4987
4987
|
}
|
|
4988
4988
|
}
|
|
4989
4989
|
let i = e.slice(0, r + 1);
|
|
4990
|
-
for (let
|
|
4990
|
+
for (let b = t.length - 1; b >= 0; b--) switch (t[b]) {
|
|
4991
4991
|
case "INSIDE_STRING":
|
|
4992
4992
|
i += '"';
|
|
4993
4993
|
break;
|
|
@@ -5243,14 +5243,14 @@ function pp(e) {
|
|
|
5243
5243
|
function Me() {
|
|
5244
5244
|
return /* @__PURE__ */ Object.create(null);
|
|
5245
5245
|
}
|
|
5246
|
-
function
|
|
5246
|
+
function yt(e) {
|
|
5247
5247
|
return e.type.startsWith("tool-");
|
|
5248
5248
|
}
|
|
5249
5249
|
function fp(e) {
|
|
5250
5250
|
return e.type === "dynamic-tool";
|
|
5251
5251
|
}
|
|
5252
5252
|
function ce(e) {
|
|
5253
|
-
return
|
|
5253
|
+
return yt(e) || fp(e);
|
|
5254
5254
|
}
|
|
5255
5255
|
function qt(e) {
|
|
5256
5256
|
return e.type.split("-").slice(1).join("-");
|
|
@@ -5266,7 +5266,7 @@ function Ba({ lastMessage: e, messageId: t }) {
|
|
|
5266
5266
|
for (const s of r.parts.slice(a + 1)) {
|
|
5267
5267
|
if (!ce(s)) continue;
|
|
5268
5268
|
const c = o;
|
|
5269
|
-
|
|
5269
|
+
yt(s) && o++, s.state === "input-streaming" && (n[s.toolCallId] = {
|
|
5270
5270
|
text: s.rawInput ?? "",
|
|
5271
5271
|
index: c,
|
|
5272
5272
|
toolName: s.type === "dynamic-tool" ? s.toolName : qt(s),
|
|
@@ -5283,7 +5283,7 @@ function Ba({ lastMessage: e, messageId: t }) {
|
|
|
5283
5283
|
};
|
|
5284
5284
|
}
|
|
5285
5285
|
function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdateMessageJob: n, onError: a, onToolCall: o, onData: s, resetStateOnMessageIdChange: c = !1, resetStateOnFirstMessageStart: p = !1 }) {
|
|
5286
|
-
return e.pipeThrough(new TransformStream({ async transform(i,
|
|
5286
|
+
return e.pipeThrough(new TransformStream({ async transform(i, b) {
|
|
5287
5287
|
await n(async ({ state: u, write: g }) => {
|
|
5288
5288
|
function I() {
|
|
5289
5289
|
const d = u.message.parts;
|
|
@@ -5325,8 +5325,8 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5325
5325
|
});
|
|
5326
5326
|
return v;
|
|
5327
5327
|
}
|
|
5328
|
-
function
|
|
5329
|
-
const f = v ?? I().find((C) =>
|
|
5328
|
+
function y(d, v) {
|
|
5329
|
+
const f = v ?? I().find((C) => yt(C) && C.toolCallId === d.toolCallId), x = d, k = f;
|
|
5330
5330
|
if (f != null) {
|
|
5331
5331
|
f.state = d.state, k.input = x.input, k.output = x.output, k.errorText = x.errorText, k.rawInput = x.rawInput, k.preliminary = x.preliminary, d.title !== void 0 && (k.title = d.title), d.toolMetadata !== void 0 && (k.toolMetadata = d.toolMetadata), k.providerExecuted = x.providerExecuted ?? f.providerExecuted;
|
|
5332
5332
|
const C = x.providerMetadata;
|
|
@@ -5490,7 +5490,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5490
5490
|
}), g();
|
|
5491
5491
|
break;
|
|
5492
5492
|
case "tool-input-start": {
|
|
5493
|
-
const d = I().filter(
|
|
5493
|
+
const d = I().filter(yt);
|
|
5494
5494
|
u.partialToolCalls[i.toolCallId] = {
|
|
5495
5495
|
text: "",
|
|
5496
5496
|
toolName: i.toolName,
|
|
@@ -5507,7 +5507,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5507
5507
|
title: i.title,
|
|
5508
5508
|
toolMetadata: i.toolMetadata,
|
|
5509
5509
|
providerMetadata: i.providerMetadata
|
|
5510
|
-
}) :
|
|
5510
|
+
}) : y({
|
|
5511
5511
|
toolCallId: i.toolCallId,
|
|
5512
5512
|
toolName: i.toolName,
|
|
5513
5513
|
state: "input-streaming",
|
|
@@ -5536,7 +5536,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5536
5536
|
rawInput: d.text,
|
|
5537
5537
|
title: d.title,
|
|
5538
5538
|
toolMetadata: d.toolMetadata
|
|
5539
|
-
}) :
|
|
5539
|
+
}) : y({
|
|
5540
5540
|
toolCallId: i.toolCallId,
|
|
5541
5541
|
toolName: d.toolName,
|
|
5542
5542
|
state: "input-streaming",
|
|
@@ -5557,7 +5557,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5557
5557
|
providerMetadata: i.providerMetadata,
|
|
5558
5558
|
title: i.title,
|
|
5559
5559
|
toolMetadata: i.toolMetadata
|
|
5560
|
-
}) :
|
|
5560
|
+
}) : y({
|
|
5561
5561
|
toolCallId: i.toolCallId,
|
|
5562
5562
|
toolName: i.toolName,
|
|
5563
5563
|
state: "input-available",
|
|
@@ -5579,7 +5579,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5579
5579
|
providerExecuted: i.providerExecuted,
|
|
5580
5580
|
providerMetadata: i.providerMetadata,
|
|
5581
5581
|
toolMetadata: i.toolMetadata
|
|
5582
|
-
}) :
|
|
5582
|
+
}) : y({
|
|
5583
5583
|
toolCallId: i.toolCallId,
|
|
5584
5584
|
toolName: i.toolName,
|
|
5585
5585
|
state: "output-error",
|
|
@@ -5631,7 +5631,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5631
5631
|
providerMetadata: i.providerMetadata,
|
|
5632
5632
|
title: d.title,
|
|
5633
5633
|
toolMetadata: i.toolMetadata ?? d.toolMetadata
|
|
5634
|
-
}, d) :
|
|
5634
|
+
}, d) : y({
|
|
5635
5635
|
toolCallId: i.toolCallId,
|
|
5636
5636
|
toolName: qt(d),
|
|
5637
5637
|
state: "output-available",
|
|
@@ -5657,7 +5657,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5657
5657
|
providerMetadata: i.providerMetadata,
|
|
5658
5658
|
title: d.title,
|
|
5659
5659
|
toolMetadata: i.toolMetadata ?? d.toolMetadata
|
|
5660
|
-
}, d) :
|
|
5660
|
+
}, d) : y({
|
|
5661
5661
|
toolCallId: i.toolCallId,
|
|
5662
5662
|
toolName: qt(d),
|
|
5663
5663
|
state: "output-error",
|
|
@@ -5719,7 +5719,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5719
5719
|
v != null ? v.data = d.data : u.message.parts.push(d), s == null || s(d), g();
|
|
5720
5720
|
}
|
|
5721
5721
|
}
|
|
5722
|
-
|
|
5722
|
+
b.enqueue(i);
|
|
5723
5723
|
});
|
|
5724
5724
|
} }));
|
|
5725
5725
|
}
|
|
@@ -5866,7 +5866,7 @@ async function ln({ response: e, url: t, fallbackMessage: r }) {
|
|
|
5866
5866
|
responseBody: n
|
|
5867
5867
|
});
|
|
5868
5868
|
}
|
|
5869
|
-
async function
|
|
5869
|
+
async function yp(e) {
|
|
5870
5870
|
if (e == null) return [];
|
|
5871
5871
|
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Ms({
|
|
5872
5872
|
functionality: "FileList",
|
|
@@ -5888,7 +5888,7 @@ async function bp(e) {
|
|
|
5888
5888
|
};
|
|
5889
5889
|
}));
|
|
5890
5890
|
}
|
|
5891
|
-
function
|
|
5891
|
+
function bp(e, t) {
|
|
5892
5892
|
const r = e.search(/[?#]/), n = r === -1 ? e : e.slice(0, r), a = r === -1 ? "" : e.slice(r);
|
|
5893
5893
|
return `${n.endsWith("/") && t.startsWith("/") ? n.slice(0, -1) : n}${t}${a}`;
|
|
5894
5894
|
}
|
|
@@ -5921,14 +5921,14 @@ var xp = class {
|
|
|
5921
5921
|
messages: t.messages,
|
|
5922
5922
|
trigger: t.trigger,
|
|
5923
5923
|
messageId: t.messageId
|
|
5924
|
-
},
|
|
5924
|
+
}, b = (s == null ? void 0 : s.credentials) ?? a, u = await (this.fetch ?? globalThis.fetch)(c, {
|
|
5925
5925
|
method: "POST",
|
|
5926
5926
|
headers: {
|
|
5927
5927
|
"content-type": "application/json",
|
|
5928
5928
|
...p
|
|
5929
5929
|
},
|
|
5930
5930
|
body: JSON.stringify(i),
|
|
5931
|
-
credentials:
|
|
5931
|
+
credentials: b,
|
|
5932
5932
|
signal: e
|
|
5933
5933
|
});
|
|
5934
5934
|
if (!u.ok) throw await ln({
|
|
@@ -5940,11 +5940,11 @@ var xp = class {
|
|
|
5940
5940
|
return this.processResponseStream(u.body);
|
|
5941
5941
|
}
|
|
5942
5942
|
async reconnectToStream(e) {
|
|
5943
|
-
var
|
|
5943
|
+
var b;
|
|
5944
5944
|
const t = await Oe(this.body), r = await Oe(this.headers), n = await Oe(this.credentials), a = {
|
|
5945
5945
|
...ze(r),
|
|
5946
5946
|
...ze(e.headers)
|
|
5947
|
-
}, o = await ((
|
|
5947
|
+
}, o = await ((b = this.prepareReconnectToStreamRequest) == null ? void 0 : b.call(this, {
|
|
5948
5948
|
api: this.api,
|
|
5949
5949
|
id: e.chatId,
|
|
5950
5950
|
body: {
|
|
@@ -5962,7 +5962,7 @@ var xp = class {
|
|
|
5962
5962
|
value: e.chatId,
|
|
5963
5963
|
message: 'Chat IDs must not be "." or ".." when using the default reconnect URL.'
|
|
5964
5964
|
});
|
|
5965
|
-
s =
|
|
5965
|
+
s = bp(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
5966
5966
|
}
|
|
5967
5967
|
const c = (o == null ? void 0 : o.headers) !== void 0 ? ze(o.headers) : a, p = (o == null ? void 0 : o.credentials) ?? n, i = await (this.fetch ?? globalThis.fetch)(s, {
|
|
5968
5968
|
method: "GET",
|
|
@@ -5993,22 +5993,22 @@ var xp = class {
|
|
|
5993
5993
|
} }));
|
|
5994
5994
|
}
|
|
5995
5995
|
}, wp = class {
|
|
5996
|
-
constructor({ generateId: e = Ku, id: t = e(), transport: r = new sr(), messageMetadataSchema: n, dataPartSchemas: a, state: o, onError: s, onToolCall: c, onFinish: p, onData: i, sendAutomaticallyWhen:
|
|
5996
|
+
constructor({ generateId: e = Ku, id: t = e(), transport: r = new sr(), messageMetadataSchema: n, dataPartSchemas: a, state: o, onError: s, onToolCall: c, onFinish: p, onData: i, sendAutomaticallyWhen: b }) {
|
|
5997
5997
|
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new vp(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (u, g) => {
|
|
5998
5998
|
var _;
|
|
5999
5999
|
if (u == null) {
|
|
6000
6000
|
let N = this.pendingApprovalMessageId;
|
|
6001
6001
|
if (N == null) {
|
|
6002
6002
|
N = (_ = this.lastMessage) == null ? void 0 : _.id;
|
|
6003
|
-
for (let
|
|
6004
|
-
const w = this.state.messages[
|
|
6003
|
+
for (let y = this.state.messages.length - 1; y >= 0; y--) {
|
|
6004
|
+
const w = this.state.messages[y];
|
|
6005
6005
|
if (w.role === "assistant" && w.parts.some((h) => ce(h) && h.state === "approval-responded")) {
|
|
6006
6006
|
N = w.id;
|
|
6007
6007
|
break;
|
|
6008
6008
|
}
|
|
6009
6009
|
}
|
|
6010
6010
|
}
|
|
6011
|
-
const E = N != null && N === this.pendingApprovalMessageId ? this.state.messages.findIndex((
|
|
6011
|
+
const E = N != null && N === this.pendingApprovalMessageId ? this.state.messages.findIndex((y) => y.id === N) : -1;
|
|
6012
6012
|
await this.makeRequestForToolApproval({
|
|
6013
6013
|
messageId: N,
|
|
6014
6014
|
messageIndex: E,
|
|
@@ -6022,7 +6022,7 @@ var xp = class {
|
|
|
6022
6022
|
this.pendingMessagePreparations.add(N);
|
|
6023
6023
|
let E;
|
|
6024
6024
|
try {
|
|
6025
|
-
E = Array.isArray(u.files) ? u.files : await
|
|
6025
|
+
E = Array.isArray(u.files) ? u.files : await yp(u.files);
|
|
6026
6026
|
} finally {
|
|
6027
6027
|
this.pendingMessagePreparations.delete(N);
|
|
6028
6028
|
}
|
|
@@ -6090,28 +6090,28 @@ var xp = class {
|
|
|
6090
6090
|
approved: g,
|
|
6091
6091
|
reason: I
|
|
6092
6092
|
}
|
|
6093
|
-
} : w,
|
|
6094
|
-
if (
|
|
6095
|
-
const w = N[
|
|
6096
|
-
this.state.replaceMessage(
|
|
6093
|
+
} : w, y = N.findIndex((w) => w.parts.some((h) => ce(h) && h.state === "approval-requested" && h.approval.id === u));
|
|
6094
|
+
if (y !== -1) {
|
|
6095
|
+
const w = N[y];
|
|
6096
|
+
this.state.replaceMessage(y, {
|
|
6097
6097
|
...w,
|
|
6098
6098
|
parts: w.parts.map(E)
|
|
6099
6099
|
}), this.pendingApprovalMessageId = w.id;
|
|
6100
6100
|
}
|
|
6101
|
-
if (this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(E)),
|
|
6101
|
+
if (this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(E)), y !== -1 && this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen) {
|
|
6102
6102
|
const w = await this.shouldSendAutomatically();
|
|
6103
6103
|
w && this.runAutomaticRequest(() => {
|
|
6104
6104
|
var d;
|
|
6105
|
-
const h =
|
|
6105
|
+
const h = y === -1 ? (d = this.lastMessage) == null ? void 0 : d.id : N[y].id;
|
|
6106
6106
|
return this.makeRequestForToolApproval({
|
|
6107
6107
|
messageId: h,
|
|
6108
|
-
messageIndex:
|
|
6108
|
+
messageIndex: y,
|
|
6109
6109
|
..._
|
|
6110
6110
|
});
|
|
6111
6111
|
}, w);
|
|
6112
6112
|
}
|
|
6113
6113
|
}), this.addToolOutput = async ({ state: u, toolCallId: g, output: I, errorText: _, options: N }) => this.jobExecutor.run(async () => {
|
|
6114
|
-
const E = this.state.messages,
|
|
6114
|
+
const E = this.state.messages, y = E[E.length - 1], w = (h) => {
|
|
6115
6115
|
if (!ce(h) || h.toolCallId !== g) return h;
|
|
6116
6116
|
const { approval: d, ...v } = h, f = (d == null ? void 0 : d.approved) === !0 ? { approval: {
|
|
6117
6117
|
...d,
|
|
@@ -6134,8 +6134,8 @@ var xp = class {
|
|
|
6134
6134
|
};
|
|
6135
6135
|
};
|
|
6136
6136
|
if (this.state.replaceMessage(E.length - 1, {
|
|
6137
|
-
...
|
|
6138
|
-
parts:
|
|
6137
|
+
...y,
|
|
6138
|
+
parts: y.parts.map(w)
|
|
6139
6139
|
}), this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(w)), this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen) {
|
|
6140
6140
|
const h = await this.shouldSendAutomatically();
|
|
6141
6141
|
h && this.runAutomaticRequest(() => {
|
|
@@ -6159,7 +6159,7 @@ var xp = class {
|
|
|
6159
6159
|
}, this.dispose = async () => {
|
|
6160
6160
|
var u, g;
|
|
6161
6161
|
await this.stop(), (g = (u = this.transport).close) == null || g.call(u);
|
|
6162
|
-
}, this.id = t, this.transport = r, this.generateId = e, this.messageMetadataSchema = n, this.dataPartSchemas = a, this.state = o, this.onError = s, this.onToolCall = c, this.onFinish = p, this.onData = i, this.sendAutomaticallyWhen =
|
|
6162
|
+
}, this.id = t, this.transport = r, this.generateId = e, this.messageMetadataSchema = n, this.dataPartSchemas = a, this.state = o, this.onError = s, this.onToolCall = c, this.onFinish = p, this.onData = i, this.sendAutomaticallyWhen = b;
|
|
6163
6163
|
}
|
|
6164
6164
|
/**
|
|
6165
6165
|
* Hook status:
|
|
@@ -6231,7 +6231,7 @@ var xp = class {
|
|
|
6231
6231
|
const p = () => c == null || this.activeResumeRequest === c, i = () => {
|
|
6232
6232
|
this.activeResumeRequest === c && (this.activeResumeRequest = void 0);
|
|
6233
6233
|
};
|
|
6234
|
-
let
|
|
6234
|
+
let b;
|
|
6235
6235
|
if (e === "resume-stream") try {
|
|
6236
6236
|
const f = await this.transport.reconnectToStream({
|
|
6237
6237
|
chatId: this.id,
|
|
@@ -6249,7 +6249,7 @@ var xp = class {
|
|
|
6249
6249
|
this.setStatus({ status: "ready" }), this.resumableStreamState = void 0, i();
|
|
6250
6250
|
return;
|
|
6251
6251
|
}
|
|
6252
|
-
|
|
6252
|
+
b = f;
|
|
6253
6253
|
} catch (f) {
|
|
6254
6254
|
if (s.signal.aborted || f.name === "AbortError") {
|
|
6255
6255
|
p() && (this.setStatus({ status: "ready" }), this.resumableStreamState = void 0), i();
|
|
@@ -6267,7 +6267,7 @@ var xp = class {
|
|
|
6267
6267
|
error: void 0
|
|
6268
6268
|
});
|
|
6269
6269
|
const u = this.lastMessage, g = e === "submit-message" && a != null ? this.state.messages.findIndex((f) => f.id === a) : this.state.messages.length - 1, I = g === -1 ? u : this.state.messages[g], _ = e === "resume-stream" && (I == null ? void 0 : I.role) === "assistant" && I.parts.some((f) => ce(f) && (f.state === "input-streaming" || f.state === "input-available" && f.providerExecuted || f.state === "approval-responded")) ? this.state.snapshot(I) : void 0, N = g !== -1 && g < this.state.messages.length - 1 && (I == null ? void 0 : I.role) === "assistant";
|
|
6270
|
-
let E = !1,
|
|
6270
|
+
let E = !1, y = !1, w = !1, h;
|
|
6271
6271
|
try {
|
|
6272
6272
|
const f = {
|
|
6273
6273
|
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : Ba({
|
|
@@ -6281,7 +6281,7 @@ var xp = class {
|
|
|
6281
6281
|
E = !0;
|
|
6282
6282
|
}), this.activeResponse = f;
|
|
6283
6283
|
let x;
|
|
6284
|
-
e === "resume-stream" ? x =
|
|
6284
|
+
e === "resume-stream" ? x = b : x = await this.transport.sendMessages({
|
|
6285
6285
|
chatId: this.id,
|
|
6286
6286
|
messages: this.state.messages,
|
|
6287
6287
|
abortSignal: f.abortController.signal,
|
|
@@ -6325,9 +6325,9 @@ var xp = class {
|
|
|
6325
6325
|
if (!p()) return null;
|
|
6326
6326
|
if (w = !0, f instanceof TypeError) {
|
|
6327
6327
|
const x = f.message.toLowerCase();
|
|
6328
|
-
|
|
6328
|
+
y = x.includes("fetch") || x.includes("network") || x === "load failed";
|
|
6329
6329
|
}
|
|
6330
|
-
|
|
6330
|
+
y ? this.resumableStreamState = h == null ? void 0 : h.state : this.resumableStreamState === (h == null ? void 0 : h.state) && (this.resumableStreamState = void 0), this.onError && f instanceof Error && this.onError(f), this.setStatus({
|
|
6331
6331
|
status: "error",
|
|
6332
6332
|
error: f
|
|
6333
6333
|
});
|
|
@@ -6337,7 +6337,7 @@ var xp = class {
|
|
|
6337
6337
|
message: h.state.message,
|
|
6338
6338
|
messages: this.state.messages,
|
|
6339
6339
|
isAbort: E,
|
|
6340
|
-
isDisconnect:
|
|
6340
|
+
isDisconnect: y,
|
|
6341
6341
|
isError: w,
|
|
6342
6342
|
finishReason: h.state.finishReason
|
|
6343
6343
|
}));
|
|
@@ -6508,10 +6508,10 @@ function Ap({ throttle: e, experimental_throttle: t, resume: r = !1, ...n } = {}
|
|
|
6508
6508
|
var d, v;
|
|
6509
6509
|
return ((v = (d = s.current).sendAutomaticallyWhen) == null ? void 0 : v.call(d, h)) ?? !1;
|
|
6510
6510
|
}
|
|
6511
|
-
},
|
|
6511
|
+
}, b = "chat" in n ? n.chat : n.id, { chat: u, isExternallyManaged: g } = qe(() => ({
|
|
6512
6512
|
chat: "chat" in n ? n.chat : new Va(i),
|
|
6513
6513
|
isExternallyManaged: "chat" in n
|
|
6514
|
-
}), [
|
|
6514
|
+
}), [b]);
|
|
6515
6515
|
ke(() => {
|
|
6516
6516
|
if (!g)
|
|
6517
6517
|
return () => {
|
|
@@ -6534,7 +6534,7 @@ function Ap({ throttle: e, experimental_throttle: t, resume: r = !1, ...n } = {}
|
|
|
6534
6534
|
h = !1, v.forEach((x) => x());
|
|
6535
6535
|
};
|
|
6536
6536
|
}, [u, a]);
|
|
6537
|
-
const { messages: N, status: E, error:
|
|
6537
|
+
const { messages: N, status: E, error: y } = I, w = ae((h) => {
|
|
6538
6538
|
typeof h == "function" && (h = h(u.messages)), u.messages = h;
|
|
6539
6539
|
}, [u]);
|
|
6540
6540
|
return ke(() => {
|
|
@@ -6550,7 +6550,7 @@ function Ap({ throttle: e, experimental_throttle: t, resume: r = !1, ...n } = {}
|
|
|
6550
6550
|
regenerate: u.regenerate,
|
|
6551
6551
|
clearError: u.clearError,
|
|
6552
6552
|
stop: u.stop,
|
|
6553
|
-
error:
|
|
6553
|
+
error: y,
|
|
6554
6554
|
resumeStream: u.resumeStream,
|
|
6555
6555
|
status: E,
|
|
6556
6556
|
/**
|
|
@@ -6623,7 +6623,7 @@ function Rp(e) {
|
|
|
6623
6623
|
}
|
|
6624
6624
|
})), [n, a] = L(() => Mt(r)), { messages: o, status: s, error: c } = Ap({ chat: n.chat });
|
|
6625
6625
|
ke(() => () => void n.chat.stop(), [n]);
|
|
6626
|
-
const [p, i] = L(), [
|
|
6626
|
+
const [p, i] = L(), [b, u] = L([]), g = oe(void 0), [I, _] = L(!1);
|
|
6627
6627
|
ke(() => () => {
|
|
6628
6628
|
var x;
|
|
6629
6629
|
return (x = g.current) == null ? void 0 : x.abort();
|
|
@@ -6647,7 +6647,7 @@ function Rp(e) {
|
|
|
6647
6647
|
const Q = {
|
|
6648
6648
|
turnId: Up(),
|
|
6649
6649
|
context: M.context,
|
|
6650
|
-
addedSources:
|
|
6650
|
+
addedSources: b,
|
|
6651
6651
|
...M.cardReplay ?? {},
|
|
6652
6652
|
...k.length ? { taggedFields: k } : {}
|
|
6653
6653
|
};
|
|
@@ -6660,8 +6660,8 @@ function Rp(e) {
|
|
|
6660
6660
|
{ body: Q }
|
|
6661
6661
|
), "sent";
|
|
6662
6662
|
},
|
|
6663
|
-
[n,
|
|
6664
|
-
),
|
|
6663
|
+
[n, b]
|
|
6664
|
+
), y = ae(() => void n.chat.stop(), [n]), w = ae(() => {
|
|
6665
6665
|
N(), i(void 0), a(Mt(r)), u([]);
|
|
6666
6666
|
}, [N, r]), h = ae(
|
|
6667
6667
|
(x, k) => {
|
|
@@ -6704,7 +6704,7 @@ function Rp(e) {
|
|
|
6704
6704
|
busy: Pt(s),
|
|
6705
6705
|
/** A stored conversation is loading; sending waits. */
|
|
6706
6706
|
loading: I,
|
|
6707
|
-
addedSources:
|
|
6707
|
+
addedSources: b,
|
|
6708
6708
|
addSource: d,
|
|
6709
6709
|
removeSource: v,
|
|
6710
6710
|
/** What went wrong with the last send, in plain words; never a raw error. */
|
|
@@ -6712,7 +6712,7 @@ function Rp(e) {
|
|
|
6712
6712
|
notice: p,
|
|
6713
6713
|
clearNotice: () => i(void 0),
|
|
6714
6714
|
send: E,
|
|
6715
|
-
stop:
|
|
6715
|
+
stop: y,
|
|
6716
6716
|
startNew: w,
|
|
6717
6717
|
askedAbout: h,
|
|
6718
6718
|
open: f
|
|
@@ -6723,12 +6723,12 @@ function Mt(e, t) {
|
|
|
6723
6723
|
fetch: ir,
|
|
6724
6724
|
// One new message and the context; never history (spec 2.1).
|
|
6725
6725
|
prepareSendMessagesRequest: ({ messages: a, body: o }) => {
|
|
6726
|
-
const { apiServiceUrl: s, accessToken: c } = e.connection(), { turnId: p, context: i, addedSources:
|
|
6726
|
+
const { apiServiceUrl: s, accessToken: c } = e.connection(), { turnId: p, context: i, addedSources: b, selectedCardRequest: u, selectedCardUnavailable: g, taggedFields: I } = o, _ = {
|
|
6727
6727
|
turnId: p,
|
|
6728
6728
|
...r.conversationId ? { conversationId: r.conversationId } : {},
|
|
6729
6729
|
message: Lp(a.at(-1)),
|
|
6730
6730
|
context: i,
|
|
6731
|
-
addedSources:
|
|
6731
|
+
addedSources: b,
|
|
6732
6732
|
...u ? { selectedCardRequest: u } : {},
|
|
6733
6733
|
...g ? { selectedCardUnavailable: g } : {},
|
|
6734
6734
|
...I ? { taggedFields: I } : {}
|
|
@@ -6829,8 +6829,8 @@ function pn(e, t) {
|
|
|
6829
6829
|
function Vp(e, t, r, n = {}) {
|
|
6830
6830
|
var g;
|
|
6831
6831
|
if (t.kind !== "line" && t.kind !== "bar" && t.kind !== "stackedBar") return null;
|
|
6832
|
-
const a = new Map(e.columns.map((I) => [I.key, I])), { x: o, y: s = [], series: c } = t.encodings, p = o ? a.get(o) : void 0, i = s.map((I) => a.get(I)),
|
|
6833
|
-
if (!p || i.length === 0 || !Jp(i) || c && !
|
|
6832
|
+
const a = new Map(e.columns.map((I) => [I.key, I])), { x: o, y: s = [], series: c } = t.encodings, p = o ? a.get(o) : void 0, i = s.map((I) => a.get(I)), b = c ? a.get(c) : void 0;
|
|
6833
|
+
if (!p || i.length === 0 || !Jp(i) || c && !b) return null;
|
|
6834
6834
|
const u = { id: `assistant-artifact-${e.artifactId}`, title: e.title, type: t.kind };
|
|
6835
6835
|
try {
|
|
6836
6836
|
const I = Io({
|
|
@@ -6841,10 +6841,10 @@ function Vp(e, t, r, n = {}) {
|
|
|
6841
6841
|
resultColumns: e.columns,
|
|
6842
6842
|
fieldRoles: {
|
|
6843
6843
|
axisKeys: [p.key],
|
|
6844
|
-
...
|
|
6845
|
-
valueKeys:
|
|
6844
|
+
...b ? { seriesKey: b.key } : {},
|
|
6845
|
+
valueKeys: b ? [i[0].key] : i.map((N) => N.key)
|
|
6846
6846
|
},
|
|
6847
|
-
temporalPresentation: qp([p, ...
|
|
6847
|
+
temporalPresentation: qp([p, ...b ? [b] : []], p.key, r),
|
|
6848
6848
|
themeStyle: n.themeStyle
|
|
6849
6849
|
});
|
|
6850
6850
|
if (!I) return null;
|
|
@@ -6857,7 +6857,7 @@ function Vp(e, t, r, n = {}) {
|
|
|
6857
6857
|
var E;
|
|
6858
6858
|
return {
|
|
6859
6859
|
...N,
|
|
6860
|
-
label:
|
|
6860
|
+
label: b ? "semaphorCanonicalSeriesKey" in N ? ur(N.semaphorCanonicalSeriesKey, b, r) || "(Blank)" : N.label : ((E = a.get(N.semaphorResultColumnKey ?? "")) == null ? void 0 : E.label) ?? N.label
|
|
6861
6861
|
};
|
|
6862
6862
|
})
|
|
6863
6863
|
}
|
|
@@ -6964,7 +6964,7 @@ function Yp(e, t, r) {
|
|
|
6964
6964
|
},
|
|
6965
6965
|
className: "inline-flex h-[26px] items-center gap-1 rounded-control border border-border px-2 text-[11.5px] font-medium text-foreground hover:bg-accent disabled:opacity-60",
|
|
6966
6966
|
children: [
|
|
6967
|
-
s ? /* @__PURE__ */ m(Je, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ m(
|
|
6967
|
+
s ? /* @__PURE__ */ m(Je, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ m(bn, { className: "h-3.5 w-3.5" }),
|
|
6968
6968
|
"Add"
|
|
6969
6969
|
]
|
|
6970
6970
|
}
|
|
@@ -7014,8 +7014,8 @@ function Xp({ artifact: e, onClose: t }) {
|
|
|
7014
7014
|
columns: e.columns,
|
|
7015
7015
|
records: i,
|
|
7016
7016
|
sort: c,
|
|
7017
|
-
onSort: (
|
|
7018
|
-
(u) => (u == null ? void 0 : u.key) ===
|
|
7017
|
+
onSort: (b) => p(
|
|
7018
|
+
(u) => (u == null ? void 0 : u.key) === b ? { key: b, direction: u.direction === "asc" ? "desc" : "asc" } : { key: b, direction: "asc" }
|
|
7019
7019
|
)
|
|
7020
7020
|
}
|
|
7021
7021
|
) : s === "number" ? /* @__PURE__ */ m(Qa, { artifact: e, visual: a }) : /* @__PURE__ */ m(Xa, { cfg: o, className: "h-[360px]" }),
|
|
@@ -7102,7 +7102,7 @@ function eo({
|
|
|
7102
7102
|
onClick: () => n(s.key),
|
|
7103
7103
|
children: [
|
|
7104
7104
|
s.label,
|
|
7105
|
-
(r == null ? void 0 : r.key) === s.key ? r.direction === "asc" ? /* @__PURE__ */ m(Yt, { className: "h-3 w-3" }) : /* @__PURE__ */ m(
|
|
7105
|
+
(r == null ? void 0 : r.key) === s.key ? r.direction === "asc" ? /* @__PURE__ */ m(Yt, { className: "h-3 w-3" }) : /* @__PURE__ */ m(yn, { className: "h-3 w-3" }) : null
|
|
7106
7106
|
]
|
|
7107
7107
|
}
|
|
7108
7108
|
) : s.label }, s.key)) }) }),
|
|
@@ -7255,7 +7255,7 @@ function lf({
|
|
|
7255
7255
|
/* @__PURE__ */ m("span", { className: "block text-[13px] font-medium leading-[1.45] text-foreground", children: a.label }),
|
|
7256
7256
|
a.description ? /* @__PURE__ */ m("span", { className: "block text-[12px] leading-[1.45] text-muted-foreground", children: a.description }) : null
|
|
7257
7257
|
] }),
|
|
7258
|
-
/* @__PURE__ */ m(
|
|
7258
|
+
/* @__PURE__ */ m(bs, { "aria-hidden": "true", className: "mt-1 h-3.5 w-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100" })
|
|
7259
7259
|
]
|
|
7260
7260
|
},
|
|
7261
7261
|
a.optionId
|
|
@@ -7410,8 +7410,8 @@ function ff({
|
|
|
7410
7410
|
onAdd: n,
|
|
7411
7411
|
onPick: a
|
|
7412
7412
|
}) {
|
|
7413
|
-
var
|
|
7414
|
-
const o = e.parts.find(mf), s = (
|
|
7413
|
+
var b;
|
|
7414
|
+
const o = e.parts.find(mf), s = (b = e.parts.find(hf)) == null ? void 0 : b.data, c = e.parts.filter(gf).map((u) => u.data), p = e.parts.filter(
|
|
7415
7415
|
(u) => u.type === "text" || u.type === "data-refusal" || u.type === "data-artifact" || u.type === "data-clarify"
|
|
7416
7416
|
), i = t ? [...c].reverse().find((u) => u.state === "live") : void 0;
|
|
7417
7417
|
return /* @__PURE__ */ T("div", { className: "space-y-2", "data-testid": "assistant-answer", "data-message-id": e.id, children: [
|
|
@@ -7440,10 +7440,10 @@ function gf(e) {
|
|
|
7440
7440
|
return e.type === "data-stage";
|
|
7441
7441
|
}
|
|
7442
7442
|
function vf({ items: e, notes: t }) {
|
|
7443
|
-
const r = e.map(
|
|
7443
|
+
const r = e.map(bf), n = r.slice(0, fn), a = r.slice(fn);
|
|
7444
7444
|
return /* @__PURE__ */ T("div", { className: "space-y-0.5", "data-testid": "assistant-using", children: [
|
|
7445
7445
|
/* @__PURE__ */ T("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "What this answer used", children: [
|
|
7446
|
-
n.map((o, s) => /* @__PURE__ */ m(
|
|
7446
|
+
n.map((o, s) => /* @__PURE__ */ m(yf, { children: o }, s)),
|
|
7447
7447
|
a.length ? /* @__PURE__ */ T(En, { children: [
|
|
7448
7448
|
/* @__PURE__ */ m(Nn, { asChild: !0, children: /* @__PURE__ */ T("button", { type: "button", "aria-label": `${a.length} more`, className: no, children: [
|
|
7449
7449
|
"+",
|
|
@@ -7456,10 +7456,10 @@ function vf({ items: e, notes: t }) {
|
|
|
7456
7456
|
] });
|
|
7457
7457
|
}
|
|
7458
7458
|
const no = "inline-flex h-5 min-w-0 max-w-full items-center truncate whitespace-nowrap rounded-control border border-border bg-muted/50 px-1.5 text-[11px] text-muted-foreground";
|
|
7459
|
-
function
|
|
7459
|
+
function yf({ children: e }) {
|
|
7460
7460
|
return /* @__PURE__ */ m("span", { className: no, title: e, children: e });
|
|
7461
7461
|
}
|
|
7462
|
-
function
|
|
7462
|
+
function bf(e) {
|
|
7463
7463
|
switch (e.kind) {
|
|
7464
7464
|
case "card":
|
|
7465
7465
|
return e.change ? `${e.title} ${e.change}` : e.title;
|
|
@@ -7566,11 +7566,11 @@ function Sf({
|
|
|
7566
7566
|
staleTime: 0,
|
|
7567
7567
|
// A failed read says so at once, whichever client the host mounted.
|
|
7568
7568
|
retry: !1
|
|
7569
|
-
}), p = _n(), [i,
|
|
7570
|
-
|
|
7569
|
+
}), p = _n(), [i, b] = L(), [u, g] = L(() => /* @__PURE__ */ new Set()), [I, _] = L(), N = (w = c.data) == null ? void 0 : w.filter((h) => !u.has(h.conversationId)), E = async (h) => {
|
|
7570
|
+
b(h);
|
|
7571
7571
|
const d = await n(h);
|
|
7572
|
-
|
|
7573
|
-
},
|
|
7572
|
+
b((v) => v === h ? void 0 : v), d === "not_opened" && Kt(p, Jt(e));
|
|
7573
|
+
}, y = async (h) => {
|
|
7574
7574
|
_(void 0), g((d) => new Set(d).add(h)), a(h);
|
|
7575
7575
|
try {
|
|
7576
7576
|
await Op(t(), h);
|
|
@@ -7622,7 +7622,7 @@ function Sf({
|
|
|
7622
7622
|
type: "button",
|
|
7623
7623
|
"aria-label": `Delete ${h.title}`,
|
|
7624
7624
|
title: "Delete",
|
|
7625
|
-
onClick: () => void
|
|
7625
|
+
onClick: () => void y(h.conversationId),
|
|
7626
7626
|
className: "absolute right-1 top-1.5 flex h-6 w-6 items-center justify-center rounded-control text-muted-foreground opacity-0 hover:bg-background hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100",
|
|
7627
7627
|
children: /* @__PURE__ */ m($o, { className: "h-3 w-3" })
|
|
7628
7628
|
}
|
|
@@ -7691,7 +7691,7 @@ function kf({
|
|
|
7691
7691
|
disabled: n,
|
|
7692
7692
|
onAdd: a
|
|
7693
7693
|
}) {
|
|
7694
|
-
const [o, s] = L(!1), [c, p] = L(""), i = oo(e, t, o || r.length > 0),
|
|
7694
|
+
const [o, s] = L(!1), [c, p] = L(""), i = oo(e, t, o || r.length > 0), b = new Set(r.map(ue)), u = (i.data ?? []).filter((_) => !b.has(ue(_.source))), g = c.trim().toLowerCase(), I = g ? u.filter((_) => `${_.label} ${_.domainLabel ?? ""}`.toLowerCase().includes(g)) : u;
|
|
7695
7695
|
return /* @__PURE__ */ T(
|
|
7696
7696
|
En,
|
|
7697
7697
|
{
|
|
@@ -7710,7 +7710,7 @@ function kf({
|
|
|
7710
7710
|
"aria-label": "Add source",
|
|
7711
7711
|
title: "Add source",
|
|
7712
7712
|
disabled: n,
|
|
7713
|
-
children: /* @__PURE__ */ m(
|
|
7713
|
+
children: /* @__PURE__ */ m(bn, { className: "h-4 w-4" })
|
|
7714
7714
|
}
|
|
7715
7715
|
) }),
|
|
7716
7716
|
/* @__PURE__ */ m(kn, { align: "start", className: "w-72 p-1.5", children: i.isPending ? /* @__PURE__ */ T("p", { className: "flex items-center gap-1.5 px-1.5 py-1 text-[12px] text-muted-foreground", role: "status", children: [
|
|
@@ -7799,19 +7799,19 @@ function gm({
|
|
|
7799
7799
|
surface: t = "dashboard",
|
|
7800
7800
|
placement: r
|
|
7801
7801
|
}) {
|
|
7802
|
-
var vr,
|
|
7803
|
-
const n = t === "none", a = zo(), o = at(e.store, (A) => A.focus), s = at(e.store, (A) => A.isOpen), c = at(e.store, (A) => A.askCount), p = at(e.store, (A) => A.layout), i = n ? "full-page" : p,
|
|
7802
|
+
var vr, yr;
|
|
7803
|
+
const n = t === "none", a = zo(), o = at(e.store, (A) => A.focus), s = at(e.store, (A) => A.isOpen), c = at(e.store, (A) => A.askCount), p = at(e.store, (A) => A.layout), i = n ? "full-page" : p, b = r ?? i, u = b === "beside-card", g = H(
|
|
7804
7804
|
(A) => {
|
|
7805
7805
|
var O;
|
|
7806
7806
|
return o && A.dashboard ? (O = Wo(A.dashboard, o.cardId)) == null ? void 0 : O.card : void 0;
|
|
7807
7807
|
}
|
|
7808
|
-
), I = Rf(n), _ = oe(void 0), [N] = L(() => ws(t)), [E,
|
|
7808
|
+
), I = Rf(n), _ = oe(void 0), [N] = L(() => ws(t)), [E, y] = L([]), w = ae(
|
|
7809
7809
|
(A) => {
|
|
7810
7810
|
_.current = A;
|
|
7811
7811
|
const O = Of(
|
|
7812
7812
|
() => N({ focus: e.store.getState().focus, snapshot: A, editing: io(n) })
|
|
7813
7813
|
);
|
|
7814
|
-
|
|
7814
|
+
y((ne) => Mf(ne, O) ? ne : O);
|
|
7815
7815
|
},
|
|
7816
7816
|
[e, N, n]
|
|
7817
7817
|
), h = _n(), d = () => {
|
|
@@ -7842,7 +7842,7 @@ function gm({
|
|
|
7842
7842
|
const { focus: A, beside: O } = e.store.getState();
|
|
7843
7843
|
A && M.current(A.cardId, { beside: O });
|
|
7844
7844
|
}, [c, e]);
|
|
7845
|
-
const Q = (I == null ? void 0 : I.id) ?? (g == null ? void 0 : g.id), V = Af(Q), ve = Q ? E : [], [G, pe] = L(), Ce = G ? V.available(ve).filter((A) => A.label.toLowerCase().includes(G.query.toLowerCase())) : [],
|
|
7845
|
+
const Q = (I == null ? void 0 : I.id) ?? (g == null ? void 0 : g.id), V = Af(Q), ve = Q ? E : [], [G, pe] = L(), Ce = G ? V.available(ve).filter((A) => A.label.toLowerCase().includes(G.query.toLowerCase())) : [], ye = G && Ce.length ? { ...G, active: Math.min(G.active, Ce.length - 1) } : void 0, je = oe(void 0);
|
|
7846
7846
|
Ze(() => {
|
|
7847
7847
|
var A;
|
|
7848
7848
|
je.current !== void 0 && ((A = C.current) == null || A.setSelectionRange(je.current, je.current), je.current = void 0);
|
|
@@ -7858,19 +7858,19 @@ function gm({
|
|
|
7858
7858
|
const O = f.send(A) === "sent";
|
|
7859
7859
|
return O && ((ne = C.current) == null || ne.focus()), O;
|
|
7860
7860
|
}, co = (A) => {
|
|
7861
|
-
if (
|
|
7861
|
+
if (ye) {
|
|
7862
7862
|
if (A.key === "ArrowDown" || A.key === "ArrowUp") {
|
|
7863
7863
|
A.preventDefault();
|
|
7864
7864
|
const O = A.key === "ArrowDown" ? 1 : -1;
|
|
7865
|
-
pe({ ...
|
|
7865
|
+
pe({ ...ye, active: (ye.active + O + Ce.length) % Ce.length });
|
|
7866
7866
|
return;
|
|
7867
7867
|
}
|
|
7868
7868
|
if ((A.key === "Enter" || A.key === "Tab") && !A.nativeEvent.isComposing) {
|
|
7869
|
-
A.preventDefault(), pr(Ce[
|
|
7869
|
+
A.preventDefault(), pr(Ce[ye.active]);
|
|
7870
7870
|
return;
|
|
7871
7871
|
}
|
|
7872
7872
|
}
|
|
7873
|
-
if (
|
|
7873
|
+
if (ye && A.key === "Escape") {
|
|
7874
7874
|
A.preventDefault(), pe(void 0);
|
|
7875
7875
|
return;
|
|
7876
7876
|
}
|
|
@@ -7881,7 +7881,7 @@ function gm({
|
|
|
7881
7881
|
A.key === "Enter" && !A.shiftKey && !A.nativeEvent.isComposing && fr(A);
|
|
7882
7882
|
}, St = f.messages.length === 0, [$e, mr] = L(), hr = ($e == null ? void 0 : $e.sessionKey) === f.sessionKey ? Pf(f.messages, $e.artifactId) : void 0, uo = (A) => {
|
|
7883
7883
|
mr((O) => ({ sessionKey: f.sessionKey, artifactId: A, opened: ((O == null ? void 0 : O.opened) ?? 0) + 1 })), e.leaveBeside(), i !== "full-page" && e.setLayout("full-page");
|
|
7884
|
-
},
|
|
7884
|
+
}, be = b === "full-page", gr = /* @__PURE__ */ m(
|
|
7885
7885
|
te,
|
|
7886
7886
|
{
|
|
7887
7887
|
variant: "ghost",
|
|
@@ -7907,7 +7907,7 @@ function gm({
|
|
|
7907
7907
|
onClick: e.close,
|
|
7908
7908
|
children: /* @__PURE__ */ m(Ge, { className: "h-3.5 w-3.5" })
|
|
7909
7909
|
}
|
|
7910
|
-
), nt = St &&
|
|
7910
|
+
), nt = St && be && !f.loading, po = /* @__PURE__ */ T("footer", { className: q("shrink-0 space-y-2", nt ? "px-0" : "p-3"), children: [
|
|
7911
7911
|
g && !I && !u ? /* @__PURE__ */ T("div", { className: "flex items-center gap-1.5", children: [
|
|
7912
7912
|
/* @__PURE__ */ T(
|
|
7913
7913
|
"span",
|
|
@@ -7944,7 +7944,7 @@ function gm({
|
|
|
7944
7944
|
),
|
|
7945
7945
|
f.notice ? /* @__PURE__ */ m("p", { role: "alert", className: "text-[12px] leading-[1.5] text-destructive", children: f.notice }) : null,
|
|
7946
7946
|
/* @__PURE__ */ T("form", { onSubmit: fr, className: "relative rounded-control border border-input bg-background focus-within:border-ring", children: [
|
|
7947
|
-
|
|
7947
|
+
ye ? /* @__PURE__ */ m(uf, { fields: Ce, active: ye.active, onPick: pr }) : null,
|
|
7948
7948
|
V.shown.length ? (
|
|
7949
7949
|
// The tagged fields sit in the question itself, before its words.
|
|
7950
7950
|
/* @__PURE__ */ m("div", { className: "flex flex-wrap gap-1 px-2.5 pt-2", "data-testid": "assistant-question-tags", children: V.shown.map((A) => /* @__PURE__ */ m(ro, { field: A, onRemove: () => V.remove(A) }, `${A.role}:${A.name}:${A.aggregate ?? ""}:${A.granularity ?? ""}`)) })
|
|
@@ -8027,8 +8027,8 @@ function gm({
|
|
|
8027
8027
|
] });
|
|
8028
8028
|
return (
|
|
8029
8029
|
// Full page stacks on a narrow screen: the sidebar's title row becomes a top bar.
|
|
8030
|
-
/* @__PURE__ */ T("div", { className: q("relative flex h-full min-h-0 w-full",
|
|
8031
|
-
|
|
8030
|
+
/* @__PURE__ */ T("div", { className: q("relative flex h-full min-h-0 w-full", be && "flex-col md:flex-row"), children: [
|
|
8031
|
+
be ? /* @__PURE__ */ m(
|
|
8032
8032
|
Sf,
|
|
8033
8033
|
{
|
|
8034
8034
|
instanceId: e.id,
|
|
@@ -8051,7 +8051,7 @@ function gm({
|
|
|
8051
8051
|
}
|
|
8052
8052
|
) : null,
|
|
8053
8053
|
/* @__PURE__ */ T("div", { className: "relative flex min-h-0 min-w-0 flex-1 flex-col", children: [
|
|
8054
|
-
|
|
8054
|
+
be && !n ? (
|
|
8055
8055
|
// No header bar: back to docked and Close sit at the page's top right.
|
|
8056
8056
|
/* @__PURE__ */ T("div", { className: "absolute right-3 top-2 z-10 flex items-center gap-0.5", children: [
|
|
8057
8057
|
/* @__PURE__ */ m(mn, { layout: i, onChange: e.setLayout }),
|
|
@@ -8065,7 +8065,7 @@ function gm({
|
|
|
8065
8065
|
"flex h-full min-h-0 min-w-0 flex-1 flex-col",
|
|
8066
8066
|
// Full page reads as one column of conversation, not a page-wide
|
|
8067
8067
|
// line length, set off by whitespace rather than lines.
|
|
8068
|
-
|
|
8068
|
+
be && "mx-auto w-full max-w-[820px] pt-11"
|
|
8069
8069
|
),
|
|
8070
8070
|
children: [
|
|
8071
8071
|
u ? (
|
|
@@ -8073,7 +8073,7 @@ function gm({
|
|
|
8073
8073
|
/* @__PURE__ */ T("header", { className: "flex h-10 shrink-0 items-center justify-between gap-2 pl-3 pr-1.5", children: [
|
|
8074
8074
|
/* @__PURE__ */ T("h2", { className: "flex min-w-0 items-center gap-1.5 text-[12.5px] font-medium text-foreground", children: [
|
|
8075
8075
|
/* @__PURE__ */ m(Cr, { className: "h-3 w-3 shrink-0 text-muted-foreground" }),
|
|
8076
|
-
/* @__PURE__ */ m("span", { className: "truncate", children: ((
|
|
8076
|
+
/* @__PURE__ */ m("span", { className: "truncate", children: ((yr = g == null ? void 0 : g.title) == null ? void 0 : yr.trim()) || "Untitled" })
|
|
8077
8077
|
] }),
|
|
8078
8078
|
/* @__PURE__ */ T("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
8079
8079
|
/* @__PURE__ */ T(
|
|
@@ -8095,7 +8095,7 @@ function gm({
|
|
|
8095
8095
|
Et
|
|
8096
8096
|
] })
|
|
8097
8097
|
] })
|
|
8098
|
-
) :
|
|
8098
|
+
) : be ? null : /* @__PURE__ */ T("header", { className: "flex h-11 shrink-0 items-center justify-between gap-2 px-3", children: [
|
|
8099
8099
|
/* @__PURE__ */ m("h2", { className: "truncate text-[13px] font-semibold text-foreground", children: e.assistantName }),
|
|
8100
8100
|
/* @__PURE__ */ T("div", { className: "flex items-center gap-0.5", children: [
|
|
8101
8101
|
/* @__PURE__ */ m(mn, { layout: i, onChange: e.setLayout }),
|
|
@@ -8116,7 +8116,7 @@ function gm({
|
|
|
8116
8116
|
{
|
|
8117
8117
|
conversation: f,
|
|
8118
8118
|
empty: St,
|
|
8119
|
-
layout:
|
|
8119
|
+
layout: b,
|
|
8120
8120
|
onExpand: uo,
|
|
8121
8121
|
onAdd: v,
|
|
8122
8122
|
onPick: lo
|
|
@@ -8136,7 +8136,7 @@ function gm({
|
|
|
8136
8136
|
}
|
|
8137
8137
|
)
|
|
8138
8138
|
] }),
|
|
8139
|
-
|
|
8139
|
+
be && $e && hr ? (
|
|
8140
8140
|
// Beside the conversation; on a narrow screen, where the page stacks, it covers it.
|
|
8141
8141
|
/* @__PURE__ */ m("aside", { className: "absolute inset-0 z-20 h-full bg-background md:static md:w-[min(560px,45%)] md:shrink-0 md:border-l md:border-border", children: /* @__PURE__ */ m(Xp, { artifact: hr, onClose: () => mr(void 0) }, $e.opened) })
|
|
8142
8142
|
) : null
|
|
@@ -8161,7 +8161,7 @@ function Pf(e, t) {
|
|
|
8161
8161
|
const Zt = [
|
|
8162
8162
|
{ layout: "docked-right", label: "Dock right", icon: On },
|
|
8163
8163
|
{ layout: "docked-left", label: "Dock left", icon: xs },
|
|
8164
|
-
{ layout: "centered", label: "Centered", icon:
|
|
8164
|
+
{ layout: "centered", label: "Centered", icon: ys },
|
|
8165
8165
|
{ layout: "full-page", label: "Full page", icon: us }
|
|
8166
8166
|
];
|
|
8167
8167
|
function mn({ layout: e, onChange: t }) {
|
|
@@ -8244,10 +8244,10 @@ function Ff({
|
|
|
8244
8244
|
onAdd: a,
|
|
8245
8245
|
onPick: o
|
|
8246
8246
|
}) {
|
|
8247
|
-
const s = oe(null), [c, p] = L(!0), i = oe(void 0),
|
|
8247
|
+
const s = oe(null), [c, p] = L(!0), i = oe(void 0), b = oe(r);
|
|
8248
8248
|
Ze(() => {
|
|
8249
8249
|
const _ = s.current;
|
|
8250
|
-
!_ ||
|
|
8250
|
+
!_ || b.current === r || (b.current = r, c ? _.scrollTop = _.scrollHeight : i.current && jf(_, i.current));
|
|
8251
8251
|
}, [r, c]);
|
|
8252
8252
|
const u = e.messages.at(-1), g = qe(
|
|
8253
8253
|
() => `${e.messages.length}:${(u == null ? void 0 : u.parts.length) ?? 0}:${e.status}:${e.failure ?? ""}`,
|
|
@@ -8293,7 +8293,7 @@ function Ff({
|
|
|
8293
8293
|
onClick: () => {
|
|
8294
8294
|
I(), p(!0);
|
|
8295
8295
|
},
|
|
8296
|
-
children: /* @__PURE__ */ m(
|
|
8296
|
+
children: /* @__PURE__ */ m(yn, { className: "h-3.5 w-3.5" })
|
|
8297
8297
|
}
|
|
8298
8298
|
) : null
|
|
8299
8299
|
] });
|