@burdenoff/fe-libs 2026.904.21 → 2026.904.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node_modules/fflate/esm/browser.js +324 -0
- package/dist/node_modules/pdfjs-dist/build/pdf.js +15775 -0
- package/dist/node_modules/pdfjs-dist/build/pdf.worker.min.js +50952 -0
- package/dist/shared/assistant/documentExtract.d.ts +22 -0
- package/dist/shared/assistant/documentExtract.d.ts.map +1 -0
- package/dist/shared/assistant/documentExtract.js +133 -0
- package/dist/shared/assistant/index.d.ts +3 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +50 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts.map +1 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +185 -0
- package/dist/shared/assistant/useAssistantAttachments.d.ts +26 -0
- package/dist/shared/assistant/useAssistantAttachments.d.ts.map +1 -0
- package/dist/shared/assistant/useAssistantAttachments.js +244 -0
- package/dist/shared/utils/imageDownscale.d.ts +91 -0
- package/dist/shared/utils/imageDownscale.d.ts.map +1 -0
- package/dist/shared/utils/imageDownscale.js +102 -0
- package/dist/shared/utils/index.d.ts +4 -3
- package/dist/shared/utils/index.d.ts.map +1 -1
- package/dist/shared-assistant.js +4 -1
- package/dist/shared-utils.js +6 -5
- package/dist/shared.js +94 -93
- package/dist/utils/index.js +1 -0
- package/package.json +13 -3
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { graphqlFetch as e } from "../graphql/fetch.js";
|
|
2
|
+
import "../../shared-graphql.js";
|
|
3
|
+
import { downscaleImage as t } from "../utils/imageDownscale.js";
|
|
4
|
+
import { useAssistantTr as n } from "./i18n.js";
|
|
5
|
+
import { AttachmentRejectedError as r, INLINE_IMAGE_QUALITY as i, MAX_INLINE_CHARS_PER_FILE as a, classifyAttachment as o, detectDocumentFormat as s, getAttachmentSendBlocker as c, truncateForInline as l, validateFile as u } from "./attachments.js";
|
|
6
|
+
import { getWorkspaceId as d } from "./context.js";
|
|
7
|
+
import { useSaveToFiles as f } from "../../storage/useSaveToFiles.js";
|
|
8
|
+
import "../../storage/index.js";
|
|
9
|
+
import { extractDocumentText as p } from "./documentExtract.js";
|
|
10
|
+
import { useCallback as m, useEffect as h, useRef as g, useState as _ } from "react";
|
|
11
|
+
//#region src/shared/assistant/useAssistantAttachments.ts
|
|
12
|
+
var v = "/HealthyBowl/AI Assistant/Attachments", y = "\n query HealthyBowlAssistantAttachmentUrl($id: ID!) {\n getFileDownloadUrl(id: $id)\n }\n";
|
|
13
|
+
async function b(t, n) {
|
|
14
|
+
if (!t || !n) return null;
|
|
15
|
+
try {
|
|
16
|
+
return (await e({
|
|
17
|
+
gateway: "workspace",
|
|
18
|
+
query: y,
|
|
19
|
+
variables: { id: t },
|
|
20
|
+
workspaceToken: !0,
|
|
21
|
+
workspaceId: n,
|
|
22
|
+
suppressGlobalErrorEvent: !0
|
|
23
|
+
})).data?.getFileDownloadUrl ?? null;
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
var x = 0;
|
|
29
|
+
function S() {
|
|
30
|
+
return x += 1, `att-${Date.now()}-${x}`;
|
|
31
|
+
}
|
|
32
|
+
async function C(e) {
|
|
33
|
+
let n = o(e.type, e.name), c = {
|
|
34
|
+
id: S(),
|
|
35
|
+
status: "pending"
|
|
36
|
+
};
|
|
37
|
+
if (n === "image") {
|
|
38
|
+
let a = await t(e, {
|
|
39
|
+
encodeFallback: !1,
|
|
40
|
+
inline: {
|
|
41
|
+
maxDim: 768,
|
|
42
|
+
quality: i
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (!a.downscaled && a.blob.size > 10485760) throw new r("unsupported-image");
|
|
46
|
+
return {
|
|
47
|
+
attachment: {
|
|
48
|
+
...c,
|
|
49
|
+
filename: a.filename,
|
|
50
|
+
mimeType: a.mimeType,
|
|
51
|
+
size: a.blob.size,
|
|
52
|
+
kind: n,
|
|
53
|
+
previewUrl: a.dataUrl || void 0,
|
|
54
|
+
inlineDataUrl: a.inlineDataUrl
|
|
55
|
+
},
|
|
56
|
+
blob: a.blob
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (n === "text") {
|
|
60
|
+
let { text: t, truncated: r } = l(await e.text(), a);
|
|
61
|
+
return {
|
|
62
|
+
attachment: {
|
|
63
|
+
...c,
|
|
64
|
+
filename: e.name,
|
|
65
|
+
mimeType: e.type || "text/plain",
|
|
66
|
+
size: e.size,
|
|
67
|
+
kind: n,
|
|
68
|
+
textContent: t,
|
|
69
|
+
textTruncated: r
|
|
70
|
+
},
|
|
71
|
+
blob: e
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
let u = s(e.type, e.name);
|
|
75
|
+
if (u) {
|
|
76
|
+
let t = await p(e, u);
|
|
77
|
+
return {
|
|
78
|
+
attachment: {
|
|
79
|
+
...c,
|
|
80
|
+
filename: e.name,
|
|
81
|
+
mimeType: e.type || "application/octet-stream",
|
|
82
|
+
size: e.size,
|
|
83
|
+
kind: n,
|
|
84
|
+
extraction: t.extraction,
|
|
85
|
+
textContent: t.textContent,
|
|
86
|
+
textTruncated: t.textTruncated,
|
|
87
|
+
documentPages: t.documentPages
|
|
88
|
+
},
|
|
89
|
+
blob: e
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
attachment: {
|
|
94
|
+
...c,
|
|
95
|
+
filename: e.name,
|
|
96
|
+
mimeType: e.type || "application/octet-stream",
|
|
97
|
+
size: e.size,
|
|
98
|
+
kind: n
|
|
99
|
+
},
|
|
100
|
+
blob: e
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function w() {
|
|
104
|
+
let e = n(), { save: t } = f(), [i, a] = _([]), [o, s] = _(null), l = g(Promise.resolve()), [p, y] = _(0), x = g(0), S = g(/* @__PURE__ */ new Map()), w = g(/* @__PURE__ */ new Set()), T = g(0), E = g(!0);
|
|
105
|
+
h(() => () => {
|
|
106
|
+
E.current = !1;
|
|
107
|
+
}, []);
|
|
108
|
+
let D = g([]);
|
|
109
|
+
h(() => {
|
|
110
|
+
D.current = i;
|
|
111
|
+
}, [i]);
|
|
112
|
+
let O = m((e, t) => {
|
|
113
|
+
E.current && a((n) => n.map((n) => n.id === e ? {
|
|
114
|
+
...n,
|
|
115
|
+
...t
|
|
116
|
+
} : n));
|
|
117
|
+
}, []), k = m(async ({ attachment: n, blob: r }) => {
|
|
118
|
+
if (!w.current.has(n.id)) {
|
|
119
|
+
O(n.id, {
|
|
120
|
+
status: "uploading",
|
|
121
|
+
progressNote: void 0
|
|
122
|
+
});
|
|
123
|
+
try {
|
|
124
|
+
let i = await t({
|
|
125
|
+
source: {
|
|
126
|
+
kind: "blob",
|
|
127
|
+
filename: n.filename,
|
|
128
|
+
mimeType: n.mimeType,
|
|
129
|
+
getBlob: async () => ({
|
|
130
|
+
blob: r,
|
|
131
|
+
filename: n.filename,
|
|
132
|
+
mimeType: n.mimeType
|
|
133
|
+
})
|
|
134
|
+
},
|
|
135
|
+
folderPath: v,
|
|
136
|
+
onRetry: (t) => {
|
|
137
|
+
w.current.has(n.id) || O(n.id, { progressNote: t.kind === "cold-start" ? e("attachments.waking", "File service is starting up — retry {{attempt}} of {{max}}", {
|
|
138
|
+
attempt: String(t.attempt),
|
|
139
|
+
max: String(t.maxAttempts)
|
|
140
|
+
}) : e("attachments.retrying", "Retrying {{attempt}} of {{max}}", {
|
|
141
|
+
attempt: String(t.attempt),
|
|
142
|
+
max: String(t.maxAttempts)
|
|
143
|
+
}) });
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
if (w.current.has(n.id)) return;
|
|
147
|
+
let a = i?.id ? await b(i.id, d()) : null;
|
|
148
|
+
if (w.current.has(n.id)) return;
|
|
149
|
+
O(n.id, {
|
|
150
|
+
status: "ready",
|
|
151
|
+
fileId: i?.id,
|
|
152
|
+
downloadUrl: a ?? void 0,
|
|
153
|
+
progressNote: void 0
|
|
154
|
+
});
|
|
155
|
+
} catch (e) {
|
|
156
|
+
if (w.current.has(n.id)) return;
|
|
157
|
+
if (n.kind === "text" || n.textContent) {
|
|
158
|
+
O(n.id, {
|
|
159
|
+
status: "ready",
|
|
160
|
+
progressNote: void 0
|
|
161
|
+
});
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
O(n.id, {
|
|
165
|
+
status: "error",
|
|
166
|
+
error: e instanceof Error ? e.message : "Upload failed",
|
|
167
|
+
progressNote: void 0
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}, [
|
|
172
|
+
O,
|
|
173
|
+
t,
|
|
174
|
+
e
|
|
175
|
+
]), A = m((e) => {
|
|
176
|
+
if (!e) return;
|
|
177
|
+
let t = Array.from(e);
|
|
178
|
+
if (t.length === 0) return;
|
|
179
|
+
s(null);
|
|
180
|
+
let n = [];
|
|
181
|
+
for (let e of t) {
|
|
182
|
+
let t = u(e, T.current);
|
|
183
|
+
if (t) {
|
|
184
|
+
s(t);
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
n.push(e), T.current += 1;
|
|
188
|
+
}
|
|
189
|
+
if (n.length !== 0) {
|
|
190
|
+
y((e) => e + n.length);
|
|
191
|
+
for (let e of n) {
|
|
192
|
+
let t = x.current;
|
|
193
|
+
l.current = l.current.then(async () => {
|
|
194
|
+
let n = null;
|
|
195
|
+
try {
|
|
196
|
+
n = await C(e);
|
|
197
|
+
} catch (e) {
|
|
198
|
+
T.current = Math.max(0, T.current - 1), E.current && s(e instanceof r ? e.reason : "unreadable");
|
|
199
|
+
}
|
|
200
|
+
if (!E.current || (y((e) => Math.max(0, e - 1)), !n)) return;
|
|
201
|
+
if (t !== x.current) {
|
|
202
|
+
T.current = Math.max(0, T.current - 1);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
let i = n;
|
|
206
|
+
S.current.set(i.attachment.id, i.blob), a((e) => [...e, i.attachment]), await k(i);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}, [k]), j = m((e) => {
|
|
211
|
+
w.current.add(e), S.current.delete(e), T.current = Math.max(0, T.current - 1), a((t) => t.filter((t) => t.id !== e));
|
|
212
|
+
}, []), M = m((e) => {
|
|
213
|
+
let t = D.current.find((t) => t.id === e), n = S.current.get(e);
|
|
214
|
+
!t || t.status !== "error" || !n || (w.current.delete(e), O(e, {
|
|
215
|
+
status: "pending",
|
|
216
|
+
error: void 0,
|
|
217
|
+
progressNote: void 0
|
|
218
|
+
}), l.current = l.current.then(() => k({
|
|
219
|
+
attachment: {
|
|
220
|
+
...t,
|
|
221
|
+
status: "pending",
|
|
222
|
+
error: void 0
|
|
223
|
+
},
|
|
224
|
+
blob: n
|
|
225
|
+
})));
|
|
226
|
+
}, [O, k]), N = m(() => {
|
|
227
|
+
x.current += 1, T.current = 0, D.current.forEach((e) => w.current.add(e.id)), S.current.clear(), a([]);
|
|
228
|
+
}, []), P = c(p, i);
|
|
229
|
+
return {
|
|
230
|
+
attachments: i,
|
|
231
|
+
isBusy: P === "in-flight",
|
|
232
|
+
preparingCount: p,
|
|
233
|
+
sendBlocker: P,
|
|
234
|
+
rejection: o,
|
|
235
|
+
addFiles: A,
|
|
236
|
+
remove: j,
|
|
237
|
+
retry: M,
|
|
238
|
+
clear: N,
|
|
239
|
+
clearRejection: m(() => s(null), []),
|
|
240
|
+
canAddMore: T.current < 5
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
export { w as useAssistantAttachments };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side image downscaling for the AI Pest & Disease scan flow (BOFF-2887)
|
|
3
|
+
* and the AI Assistant composer.
|
|
4
|
+
*
|
|
5
|
+
* A phone photo can be several megabytes; we downscale it to a sane max dimension
|
|
6
|
+
* and re-encode as JPEG before (a) sending the base64 to the diagnosis model and
|
|
7
|
+
* (b) uploading it to wspace-files-svc. This keeps the GraphQL payload small, the
|
|
8
|
+
* upload fast, and the model call cheap — without changing what the farmer sees.
|
|
9
|
+
*
|
|
10
|
+
* Falls back to the original file bytes if the browser can't rasterise the image
|
|
11
|
+
* (e.g. an exotic format), so a scan is never blocked by the optimisation. That
|
|
12
|
+
* fallback is not free — see `encodeFallback`.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The transport encode for the diagnosis mutation: it is sized against the
|
|
16
|
+
* gateway's body cap rather than against the upload. The stored copy stays at
|
|
17
|
+
* the primary 1280px encode — the file library should not be degraded to the
|
|
18
|
+
* transport's budget — while `inline` produces a second, smaller encode from
|
|
19
|
+
* the SAME decode for the wire (768px/q0.6 ≈ 92 KB of base64 fits the 256 KB
|
|
20
|
+
* body cap; the 1280px primary measures ~360 KB and does not).
|
|
21
|
+
*/
|
|
22
|
+
export declare const INLINE_ENCODE: {
|
|
23
|
+
readonly maxDim: 768;
|
|
24
|
+
readonly quality: 0.6;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The payload the mutation should carry: the transport encode when we have one,
|
|
28
|
+
* otherwise the primary. Returns '' when neither is usable.
|
|
29
|
+
*/
|
|
30
|
+
export declare function selectInlineBase64(image: DownscaledImage): string;
|
|
31
|
+
export interface DownscaledImage {
|
|
32
|
+
/** Re-encoded image blob, for upload to files-svc. */
|
|
33
|
+
blob: Blob;
|
|
34
|
+
/** Bare base64 (no `data:` prefix), for the diagnosis mutation. '' when skipped. */
|
|
35
|
+
base64: string;
|
|
36
|
+
/** `data:<mime>;base64,...` URL, for an <img> preview. '' when skipped. */
|
|
37
|
+
dataUrl: string;
|
|
38
|
+
/**
|
|
39
|
+
* A SECOND, smaller `data:` URL for callers that must fit the image inside a
|
|
40
|
+
* request body (see `DownscaleOptions.inline`). Absent unless asked for, and
|
|
41
|
+
* absent when it would not actually be smaller than `dataUrl`.
|
|
42
|
+
*/
|
|
43
|
+
inlineDataUrl?: string;
|
|
44
|
+
mimeType: string;
|
|
45
|
+
filename: string;
|
|
46
|
+
/**
|
|
47
|
+
* Did the browser actually rasterise and re-encode the image?
|
|
48
|
+
*
|
|
49
|
+
* False means `blob` is the ORIGINAL file: the format could not be decoded
|
|
50
|
+
* here (HEIC from an iPhone is the real-world case — neither Chrome nor
|
|
51
|
+
* Firefox decodes it), so nothing was resized, `mimeType` is whatever the file
|
|
52
|
+
* claimed, and any preview built from it cannot render either.
|
|
53
|
+
*
|
|
54
|
+
* NOTE this is "was it rasterised", NOT "did the dimensions shrink". An image
|
|
55
|
+
* already smaller than `maxDim` takes `scale === 1` yet still goes through the
|
|
56
|
+
* canvas and comes back as a perfectly good JPEG — that is a success.
|
|
57
|
+
*/
|
|
58
|
+
downscaled: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface DownscaleOptions {
|
|
61
|
+
/** Longest-edge ceiling for the primary encode. */
|
|
62
|
+
maxDim?: number;
|
|
63
|
+
/** JPEG quality for the primary encode. */
|
|
64
|
+
quality?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Encode the fallback (un-rasterisable) bytes to base64 as well?
|
|
67
|
+
*
|
|
68
|
+
* Default true, for callers that need `base64` no matter what. Pass false when
|
|
69
|
+
* only `blob` is used: base64 costs ~1.37x the file size in a string that is
|
|
70
|
+
* then held in memory, and on the fallback path the file has NOT been
|
|
71
|
+
* downscaled — so a 12 MB HEIC becomes ~16 MB of strings backing a preview the
|
|
72
|
+
* browser cannot render anyway.
|
|
73
|
+
*/
|
|
74
|
+
encodeFallback?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Also produce `inlineDataUrl` at these settings, reusing the bitmap that has
|
|
77
|
+
* already been decoded (one decode, two encodes — the second is cheap).
|
|
78
|
+
*
|
|
79
|
+
* This exists because "small enough to upload" and "small enough to fit in a
|
|
80
|
+
* request body" are different budgets: the upload can be a 1280px photo, but
|
|
81
|
+
* the turn that carries the pixels to the model has to fit through a gateway
|
|
82
|
+
* that caps bodies at 256 KB. Keeping them separate means the file the farmer
|
|
83
|
+
* later opens from their file library is NOT degraded to the transport's size.
|
|
84
|
+
*/
|
|
85
|
+
inline?: {
|
|
86
|
+
maxDim: number;
|
|
87
|
+
quality: number;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export declare function downscaleImage(file: File, options?: DownscaleOptions): Promise<DownscaledImage>;
|
|
91
|
+
//# sourceMappingURL=imageDownscale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageDownscale.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/imageDownscale.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;CAAyC,CAAC;AAQpE;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAIjE;AAED,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,IAAI,EAAE,IAAI,CAAC;IACX,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;OAWG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9C;AA0FD,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAiF1B"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
//#region src/shared/utils/imageDownscale.ts
|
|
2
|
+
var e = {
|
|
3
|
+
maxDim: 768,
|
|
4
|
+
quality: .6
|
|
5
|
+
};
|
|
6
|
+
function t(e) {
|
|
7
|
+
let t = e.indexOf(",");
|
|
8
|
+
return t >= 0 ? e.slice(t + 1) : e;
|
|
9
|
+
}
|
|
10
|
+
function n(e) {
|
|
11
|
+
return e.inlineDataUrl ? t(e.inlineDataUrl) : e.base64;
|
|
12
|
+
}
|
|
13
|
+
function r(e) {
|
|
14
|
+
return new Promise((t, n) => {
|
|
15
|
+
let r = new FileReader();
|
|
16
|
+
r.onload = () => {
|
|
17
|
+
let e = String(r.result ?? ""), n = e.indexOf(",");
|
|
18
|
+
t({
|
|
19
|
+
base64: n >= 0 ? e.slice(n + 1) : e,
|
|
20
|
+
dataUrl: e
|
|
21
|
+
});
|
|
22
|
+
}, r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Could not read image")), r.readAsDataURL(e);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async function i(e) {
|
|
26
|
+
if (typeof createImageBitmap == "function") try {
|
|
27
|
+
let t = await createImageBitmap(e);
|
|
28
|
+
return {
|
|
29
|
+
width: t.width,
|
|
30
|
+
height: t.height,
|
|
31
|
+
draw: (e, n, r) => e.drawImage(t, 0, 0, n, r),
|
|
32
|
+
release: () => t.close()
|
|
33
|
+
};
|
|
34
|
+
} catch {}
|
|
35
|
+
return new Promise((t) => {
|
|
36
|
+
let n = URL.createObjectURL(e), r = new Image();
|
|
37
|
+
r.onload = () => {
|
|
38
|
+
t({
|
|
39
|
+
width: r.naturalWidth,
|
|
40
|
+
height: r.naturalHeight,
|
|
41
|
+
draw: (e, t, n) => e.drawImage(r, 0, 0, t, n),
|
|
42
|
+
release: () => URL.revokeObjectURL(n)
|
|
43
|
+
});
|
|
44
|
+
}, r.onerror = () => {
|
|
45
|
+
URL.revokeObjectURL(n), t(null);
|
|
46
|
+
}, r.src = n;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async function a(e, t, n) {
|
|
50
|
+
let r = Math.min(1, t / Math.max(e.width, e.height)), i = Math.max(1, Math.round(e.width * r)), a = Math.max(1, Math.round(e.height * r)), o = document.createElement("canvas");
|
|
51
|
+
o.width = i, o.height = a;
|
|
52
|
+
let s = o.getContext("2d");
|
|
53
|
+
if (!s) return null;
|
|
54
|
+
e.draw(s, i, a);
|
|
55
|
+
let c = await new Promise((e) => o.toBlob((t) => e(t), "image/jpeg", n));
|
|
56
|
+
return c && c.size > 0 ? c : null;
|
|
57
|
+
}
|
|
58
|
+
async function o(e, t = {}) {
|
|
59
|
+
let { maxDim: n = 1280, quality: o = .72, encodeFallback: s = !0, inline: c } = t, l = e.name.replace(/\.[^.]+$/, "") + ".jpg", u = null;
|
|
60
|
+
try {
|
|
61
|
+
if (u = await i(e), u && u.width > 0 && u.height > 0) {
|
|
62
|
+
let e = await a(u, n, o);
|
|
63
|
+
if (e) {
|
|
64
|
+
let { base64: t, dataUrl: n } = await r(e), i;
|
|
65
|
+
if (c) try {
|
|
66
|
+
let t = await a(u, c.maxDim, c.quality);
|
|
67
|
+
t && t.size < e.size && (i = (await r(t)).dataUrl);
|
|
68
|
+
} catch {}
|
|
69
|
+
return {
|
|
70
|
+
blob: e,
|
|
71
|
+
base64: t,
|
|
72
|
+
dataUrl: n,
|
|
73
|
+
inlineDataUrl: i,
|
|
74
|
+
mimeType: "image/jpeg",
|
|
75
|
+
filename: l,
|
|
76
|
+
downscaled: !0
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} catch {} finally {
|
|
81
|
+
u?.release();
|
|
82
|
+
}
|
|
83
|
+
if (!s) return {
|
|
84
|
+
blob: e,
|
|
85
|
+
base64: "",
|
|
86
|
+
dataUrl: "",
|
|
87
|
+
mimeType: e.type || "image/jpeg",
|
|
88
|
+
filename: e.name || l,
|
|
89
|
+
downscaled: !1
|
|
90
|
+
};
|
|
91
|
+
let { base64: d, dataUrl: f } = await r(e);
|
|
92
|
+
return {
|
|
93
|
+
blob: e,
|
|
94
|
+
base64: d,
|
|
95
|
+
dataUrl: f,
|
|
96
|
+
mimeType: e.type || "image/jpeg",
|
|
97
|
+
filename: e.name || l,
|
|
98
|
+
downscaled: !1
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
export { e as INLINE_ENCODE, o as downscaleImage, n as selectInlineBase64 };
|
|
@@ -16,15 +16,16 @@ export { clearAuthSessionStorage, hasAuthGraphQLErrors, isAuthGraphQLError, isAu
|
|
|
16
16
|
export type { GraphQLErrorLike, TokenRefreshConfig } from './authErrorHandling';
|
|
17
17
|
export { BACKEND_ERROR_EVENT, CONNECTION_STATUS_EVENT, dispatchBackendErrorEvent, extractBackendError, isAbortError, isBackendErrorDisplay, isTransportError, markConnectionHealthy, shouldToastBackendError, } from './backendErrors';
|
|
18
18
|
export type { BackendErrorDisplay, BackendErrorExtensions, ConnectionStatusDetail, ExtractBackendErrorOptions, GraphQLBackendErrorLike, } from './backendErrors';
|
|
19
|
-
export { AppInitializer, useShellNavigate, useRegistryHelpers } from './appHelpers';
|
|
19
|
+
export { AppInitializer, useShellNavigate, useRegistryHelpers, } from './appHelpers';
|
|
20
20
|
export type { AppInitializerProps } from './appHelpers';
|
|
21
|
-
export { initializeLogger, setUserContext, clearUserContext } from './loggerInit';
|
|
21
|
+
export { initializeLogger, setUserContext, clearUserContext, } from './loggerInit';
|
|
22
22
|
export type { InitLoggerOptions } from './loggerInit';
|
|
23
23
|
export { setSSoCookie, getSSoCookie, clearSSoCookie, setShellSsoCookies, readShellSsoCookie, clearShellSsoCookies, isSharedSsoCookieDomain, isTrustedSsoOrigin, } from './authCookie';
|
|
24
24
|
export type { ShellSsoCookieData } from './authCookie';
|
|
25
25
|
export { SSO_DEPOSITED_PARAM, beginSsoNavigation, isSsoNavigationPending, clearSsoNavigation, readSsoDepositState, markSsoDepositPending, markSsoDepositDone, clearSsoDepositState, shouldAttemptSsoDeposit, mintSsoSessionTokens, buildSsoDepositUrl, consumeSsoDepositMarker, } from './ssoDeposit';
|
|
26
26
|
export type { MintedSsoTokens, MintSsoSessionResult, SsoDepositPayload, SsoDepositState, } from './ssoDeposit';
|
|
27
|
-
export { createProfileScopedStorage, getProfileScopedKey } from './profileScopedStorage';
|
|
27
|
+
export { createProfileScopedStorage, getProfileScopedKey, } from './profileScopedStorage';
|
|
28
28
|
export { QUOTA_EXHAUSTED_CODE, RESOURCE_CAP_EXCEEDED_CODE, STORAGE_QUOTA_EXCEEDED_CODE, UPGRADE_ERROR_CODES, isQuotaExhaustedError, isUpgradeError, extractUpgradeErrorExtensions, extractQuotaExhaustedExtensions, buildQuotaExhaustedMessage, } from './quotaErrors';
|
|
29
29
|
export type { QuotaExhaustedExtensions, UpgradeErrorCode, UpgradeErrorExtensions, } from './quotaErrors';
|
|
30
|
+
export * from './imageDownscale';
|
|
30
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C;;;GAGG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,YAAY,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAG1D,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,eAAe,EACf,OAAO,EACP,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,GACX,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG9E,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/index.ts"],"names":[],"mappings":"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"}
|
package/dist/shared-assistant.js
CHANGED
|
@@ -79,4 +79,7 @@ import { useConversationTurns as ii } from "./shared/assistant/useConversationTu
|
|
|
79
79
|
import { isMultimodalBodyRejection as ai, isRecoverableAssistantError as oi } from "./shared/assistant/transportErrors.js";
|
|
80
80
|
import { aiCreditsUpdatedEventName as si, dispatchAssistantQuotaExhausted as ci, notifyAiCreditsUpdated as li } from "./shared/assistant/aiCredits.js";
|
|
81
81
|
import { useWorkspaceWriteAccess as ui } from "./shared/assistant/useWorkspaceWriteAccess.js";
|
|
82
|
-
|
|
82
|
+
import { extractDocumentText as di } from "./shared/assistant/documentExtract.js";
|
|
83
|
+
import { useAssistantAttachments as fi } from "./shared/assistant/useAssistantAttachments.js";
|
|
84
|
+
import { AssistantComposer as pi } from "./shared/assistant/ui/composer/AssistantComposer.js";
|
|
85
|
+
export { h as ASSISTANT_API_AUTH_STRATEGY, Mt as ASSISTANT_LANGUAGES, Pr as ASSISTANT_MODE_META, Tn as ATTACHMENT_ACCEPT, pr as ATTACHMENT_SOURCES, Rr as AUTO_VOICE, Ar as AssistantAttachmentButton, jr as AssistantAttachmentChips, yr as AssistantAutoSpeakToggle, pi as AssistantComposer, Qr as AssistantConversationList, $r as AssistantEmptyState, Zr as AssistantHeader, Wt as AssistantI18nProvider, Mr as AssistantLanguageSelector, br as AssistantMarkdownImage, Cr as AssistantMarkdownRenderer, Tr as AssistantMessageAttachments, ei as AssistantMessageItem, ti as AssistantMessageList, Fr as AssistantModeSelector, Xr as AssistantMoreMenu, Er as AssistantPendingWriteCard, Bt as AssistantProductProvider, Dr as AssistantReplyLanguageSelector, G as AssistantRuntimeManager, Or as AssistantSpeakButton, or as AssistantSpeechProvider, kr as AssistantSpokenTurnsNotice, ir as AssistantToolActivity, Lr as AssistantVoiceButton, Br as AssistantVoiceOrb, zr as AssistantVoiceSelector, ni as AssistantVoiceSession, Vr as AssistantVoiceSessionButton, En as AttachmentRejectedError, an as BOILERPLATE_PAGE_SHARE, o as CHECK_AI_CREDITS, s as CREATE_SANDBOX, pt as DEFAULT_SPEAKABLE_LABELS, Nt as DEFAULT_SPEECH_RATE, Be as ENDPOINT_GRACE_MS, c as EXTEND_SANDBOX_TTL, Nr as FOLLOW_APP_LOCALE, l as GET_ACTIVE_SANDBOXES, u as GET_SANDBOX, ge as HOSTED_TTS_MAX_CHARS, fe as HOSTED_TTS_TIER, pe as HOSTED_VOICES, Qt as IDLE_PLAYBACK, Ve as INITIAL_SESSION, Dn as INLINE_IMAGE_MAX_DIM, On as INLINE_IMAGE_QUALITY, He as INTERRUPT_MAX_MS, Ue as INTERRUPT_MIN_MS, kn as MAX_ATTACHMENTS, on as MAX_BOILERPLATE_LINE_CHARS, sn as MAX_EXTRACTED_CHARS, An as MAX_FILE_BYTES, jn as MAX_INLINE_CHARS_PER_FILE, Mn as MAX_INLINE_CHARS_TOTAL, nn as MAX_INLINE_IMAGE_BASE64_BYTES, Nn as MAX_INLINE_IMAGE_BASE64_CHARS, Pn as MAX_INLINE_IMAGE_PARTS, Fn as MAX_INLINE_TURN_BODY_BYTES, cn as MAX_PDF_PAGES_SCANNED, rn as MAX_REQUEST_BODY_BYTES, mt as MAX_SPEAKABLE_CHARS, ht as MAX_SPOKEN_TABLE_ROWS, In as MAX_TURN_BODY_BYTES, ln as MIN_PAGE_TEXT_CHARS, un as MIN_TEXT_PAGE_SHARE, Tt as POLL_FAST_MS, Et as POLL_FAST_UNTIL_MS, Dt as POLL_SLOW_MS, Ot as POLL_STEADY_MS, kt as POLL_STEADY_UNTIL_MS, Ct as PREVIEW_LANGUAGES, Ln as PROMPT_ENVELOPE_RESERVE_BYTES, d as PROXY_SANDBOX_REQUEST, f as REPORT_AI_TOKEN_USAGE, gr as SANDBOX_READY_TTL_MS, We as SILENCE_SUBMIT_MS, _e as SPEAKING_RATE_MAX, ve as SPEAKING_RATE_MAX_STREAMING, ye as SPEAKING_RATE_MAX_SYNC, be as SPEAKING_RATE_MIN, gt as SPEECH_CHUNK_CHARS, _t as SPEECH_CHUNK_CJK_CHARS, Qe as SPEECH_LANG, Jt as SPOKEN_LABEL_LANGUAGES, p as STOP_ASSISTANT_SANDBOX, Rn as TURN_BODY_HEADROOM_BYTES, $e as VOICE_LIST_TIMEOUT_MS, Hr as VoiceCaption, Ur as VoiceConversationView, Gr as VoiceMiniController, Kr as VoiceStage, qr as VoiceTranscriptDrawer, Wr as VoiceWaveform, m as WAIT_FOR_SANDBOX_RUNNING, si as aiCreditsUpdatedEventName, Gt as assistantTranslationKey, wr as assistantUrlTransform, mr as availableAttachmentSources, xe as base64ToBytes, de as browserSpeechEngine, T as buildAssistantSandboxEnv, zn as buildAttachmentPromptBlock, ut as buildContinuedFromVoiceNote, K as buildProgress, Bn as buildPromptParts, E as buildPromptRequestBody, Vn as buildPromptWithAttachments, Se as buildRequest, i as buildSandboxContextInput, dt as buildVoiceTranscriptMarkdown, ie as chatTurns, D as checkAssistantAiCredits, vt as chunkForSpeech, Hn as classifyAttachment, Ce as classifyHttpFailure, t as classifyQuotaError, dn as columnLetterToIndex, ke as configureSpeechEngine, yt as containsCjk, lr as copyToClipboard, Un as countInlineImageCandidates, Wn as countInlinedImageParts, O as createAssistantSandbox, k as createAssistantSession, De as createHostedTtsEngine, _r as createReadinessTracker, Oe as createRoutingSpeechEngine, ne as createSandboxAssistantTransport, Ae as createSpeechEngines, we as decodeAudioResponse, fn as decodeXmlEntities, Gn as detectDocumentFormat, Xt as detectScriptLocale, hr as deviceHasCamera, ci as dispatchAssistantQuotaExhausted, pn as docxXmlToText, A as downloadAssistantArtifact, Jr as downloadFile, Kn as estimateTurnBodyBytes, a as executeSandboxGraphQL, Yr as exportConversation, j as extendAssistantSandboxTTL, di as extractDocumentText, Pt as findAssistantLanguage, M as findExistingSandbox, Rt as findPendingWrite, mn as fitPdfPages, qn as formatBytes, hn as formatPageRanges, ur as getActorId, N as getAssistantArtifacts, q as getAssistantMedia, P as getAssistantMessages, F as getAssistantSession, I as getAssistantStreamAccess, J as getAssistantText, Jn as getAttachmentSendBlocker, x as getCapability, Yn as getExtension, g as getImageForMode, _ as getImageTagForMode, dr as getOrganizationId, Y as getRawMessageCreatedAt, v as getResourcesForMode, y as getSandboxImageRegistry, Xn as getSendableAttachments, je as getSpeechEngine, X as getToolProgress, fr as getWorkspaceId, ae as groupBySession, oe as groupConsecutiveBySession, Zn as hasAttachmentWorkInFlight, me as hostedLocaleFor, he as hostedSupportsLanguage, xr as imageHostLabel, Ge as isCapturing, Ke as isEcho, gn as isMostlyImagePages, ai as isMultimodalBodyRejection, n as isQuotaExhaustedError, Z as isReapedSandboxConnectionError, vr as isRecentlyVerified, Q as isRecoverable, oi as isRecoverableAssistantError, Sr as isRemoteImageSrc, $t as isSpeakingMessage, et as isSpeechBlocked, qe as isSubmittable, rr as isTurnInFlight, S as isUnknownFieldError, se as isVoiceTurn, _n as joinSheets, tt as languageDisplayName, $ as mapSessionToHistory, C as markSupported, w as markUnsupported, ee as mergeMessagesById, Pe as micIsInterrupt, L as modeRequiresConfirmWrites, Ir as nextModeIndex, nt as normalizeLangTag, li as notifyAiCreditsUpdated, Je as orbMode, vn as pageMarker, zt as parseConfirmationRefusal, Qn as parseDataUrl, yn as parseSharedStrings, ar as parseToolActivity, bn as parseWorkbookSheets, xn as pdfTextItemsToPage, Ye as planReplyConsumption, At as pollDelayMs, rt as primaryLanguageSubtag, r as quotaExhaustedEventName, Me as readSpeechEngineConfig, It as replyFollowsInput, R as reportAssistantAiTokenUsage, en as requiresCancel, Ne as resetSpeechEngine, Ft as resolveAssistantLanguage, Lt as resolveLanguagePair, Vt as resolveModeConfig, b as resolveSandboxAssistantMode, Zt as resolveSpeechLocale, te as sanitize, z as selectExistingAssistantSandbox, it as selectVoiceForLocale, B as sendAssistantPromptAsync, V as sendHeartbeat, Sn as sheetXmlToRows, Te as shouldDisableEngine, Fe as showsAssistantCaption, Ie as showsUserCaption, bt as speakableEmail, at as speechGate, Yt as speechLabelsFor, ot as speechLangForLocale, tn as speechPlaybackReducer, Ee as splitForVendor, xt as splitTableRow, Xe as spokenSoFar, H as stopReapedAssistantSandbox, Cn as summarisePageText, jt as toCaptionText, $n as toMessageAttachment, St as toSpeakableText, er as truncateForInline, wn as truncatePagesForInline, ri as useAssistantApiAccess, fi as useAssistantAttachments, Kt as useAssistantI18nNamespace, Ht as useAssistantProduct, Ut as useAssistantProductOrNull, sr as useAssistantSpeech, nr as useAssistantStore, qt as useAssistantTr, ii as useConversationTurns, re as useSandboxAssistantTransport, e as useVoiceInput, cr as useVoiceSession, ui as useWorkspaceWriteAccess, tr as validateFile, st as voiceAvailability, ce as voiceMarker, wt as voicePreviewText, ct as voiceQualityRank, le as voiceSessionIdOf, Ze as voiceSessionReducer, Le as voiceStageState, ft as voiceTranscriptFilename, ue as voiceTurnsOnly, lt as voicesForLocale, U as waitForAssistantServiceReady, W as waitForSandboxRunning, Re as waveformIsActive, ze as waveformIsSettled };
|
package/dist/shared-utils.js
CHANGED
|
@@ -11,11 +11,12 @@ import { AppInitializer as ve, useRegistryHelpers as ye, useShellNavigate as be
|
|
|
11
11
|
import { clearUserContext as xe, initializeLogger as Se, setUserContext as Ce } from "./shared/utils/loggerInit.js";
|
|
12
12
|
import { createProfileScopedStorage as we, getProfileScopedKey as Te } from "./shared/utils/profileScopedStorage.js";
|
|
13
13
|
import { QUOTA_EXHAUSTED_CODE as Ee, RESOURCE_CAP_EXCEEDED_CODE as De, STORAGE_QUOTA_EXCEEDED_CODE as Oe, UPGRADE_ERROR_CODES as ke, buildQuotaExhaustedMessage as Ae, extractQuotaExhaustedExtensions as je, extractUpgradeErrorExtensions as Me, isQuotaExhaustedError as Ne, isUpgradeError as Pe } from "./shared/utils/quotaErrors.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { INLINE_ENCODE as Fe, downscaleImage as Ie, selectInlineBase64 as Le } from "./shared/utils/imageDownscale.js";
|
|
15
|
+
import { clsx as Re } from "clsx";
|
|
16
|
+
import { twMerge as ze } from "tailwind-merge";
|
|
16
17
|
//#region src/shared/utils/index.ts
|
|
17
|
-
function
|
|
18
|
-
return
|
|
18
|
+
function Be(...e) {
|
|
19
|
+
return ze(Re(e));
|
|
19
20
|
}
|
|
20
21
|
//#endregion
|
|
21
|
-
export { ve as AppInitializer, L as BACKEND_ERROR_EVENT, R as CONNECTION_STATUS_EVENT, Ee as QUOTA_EXHAUSTED_CODE, De as RESOURCE_CAP_EXCEEDED_CODE, oe as SSO_DEPOSITED_PARAM, Oe as STORAGE_QUOTA_EXCEEDED_CODE, ke as UPGRADE_ERROR_CODES, t as alertTokens, K as attemptTokenRefresh, se as beginSsoNavigation, Ae as buildQuotaExhaustedMessage, ce as buildSsoDepositUrl, f as capitalizeFirst, p as capitalizeWords, n as categoryTokens, q as clearAuthSessionStorage, Q as clearSSoCookie, $ as clearShellSsoCookies, le as clearSsoDepositState, ue as clearSsoNavigation, xe as clearUserContext,
|
|
22
|
+
export { ve as AppInitializer, L as BACKEND_ERROR_EVENT, R as CONNECTION_STATUS_EVENT, Fe as INLINE_ENCODE, Ee as QUOTA_EXHAUSTED_CODE, De as RESOURCE_CAP_EXCEEDED_CODE, oe as SSO_DEPOSITED_PARAM, Oe as STORAGE_QUOTA_EXCEEDED_CODE, ke as UPGRADE_ERROR_CODES, t as alertTokens, K as attemptTokenRefresh, se as beginSsoNavigation, Ae as buildQuotaExhaustedMessage, ce as buildSsoDepositUrl, f as capitalizeFirst, p as capitalizeWords, n as categoryTokens, q as clearAuthSessionStorage, Q as clearSSoCookie, $ as clearShellSsoCookies, le as clearSsoDepositState, ue as clearSsoNavigation, xe as clearUserContext, Be as cn, de as consumeSsoDepositMarker, e as createApolloClient, we as createProfileScopedStorage, z as dispatchBackendErrorEvent, Ie as downscaleImage, B as extractBackendError, je as extractQuotaExhaustedExtensions, Me as extractUpgradeErrorExtensions, m as formatBytes, h as formatCompactNumber, g as formatCurrency, _ as formatCurrencyCompact, v as formatDate, y as formatDateTime, b as formatDuration, x as formatList, S as formatNumber, C as formatOrdinal, w as formatPercentage, T as formatRelativeTime, E as formatTime, r as getAlertTokens, i as getCategoryTokens, Te as getProfileScopedKey, a as getProgressTokens, ee as getSSoCookie, o as getStatusBadgeTokens, s as getStatusTokens, c as getTrendTokens, J as hasAuthGraphQLErrors, Se as initializeLogger, P as installGatewayFetchRewrite, V as isAbortError, Y as isAuthGraphQLError, X as isAuthNetworkError, H as isBackendErrorDisplay, M as isChunkLoadError, Ne as isQuotaExhaustedError, te as isSharedSsoCookieDomain, fe as isSsoNavigationPending, U as isTransportError, ne as isTrustedSsoOrigin, Pe as isUpgradeError, N as lazyWithRetry, W as markConnectionHealthy, pe as markSsoDepositDone, me as markSsoDepositPending, he as mintSsoSessionTokens, D as pluralize, l as progressTokens, re as readShellSsoCookie, ge as readSsoDepositState, Z as redirectToLogin, F as resolveGatewayBases, Le as selectInlineBase64, ie as setSSoCookie, ae as setShellSsoCookies, Ce as setUserContext, _e as shouldAttemptSsoDeposit, G as shouldToastBackendError, O as slugify, u as statusTokens, I as suppressConsole, k as toCamelCase, A as toPascalCase, d as trendTokens, j as truncateText, ye as useRegistryHelpers, be as useShellNavigate };
|