swerasty_editor 0.2.7 → 0.2.8
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/style.css +1 -1
- package/dist/swerasty-editor.js +540 -534
- package/dist/swerasty-editor.umd.cjs +28 -28
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/swerasty-editor.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as g, jsxs as
|
|
2
|
-
import oo, { forwardRef as be, useRef as j, useState as
|
|
1
|
+
import { jsx as g, jsxs as k } from "react/jsx-runtime";
|
|
2
|
+
import oo, { forwardRef as be, useRef as j, useState as q, useCallback as le, useEffect as he, useImperativeHandle as io, createElement as Ye, useMemo as ni } from "react";
|
|
3
3
|
const so = be(({ onHistoryChange: t }, e) => {
|
|
4
|
-
const n = j(null), o = j(null), [s, l] =
|
|
4
|
+
const n = j(null), o = j(null), [s, l] = q(!1), [a, u] = q(!1), c = j(null), [d, f] = q([]), [p, h] = q(-1), m = le(() => {
|
|
5
5
|
const E = n.current, C = c.current;
|
|
6
6
|
if (!E || !C || E.width === 0 || E.height === 0) return;
|
|
7
|
-
const S = C.getImageData(0, 0, E.width, E.height),
|
|
8
|
-
f([...
|
|
7
|
+
const S = C.getImageData(0, 0, E.width, E.height), R = d.slice(0, p + 1);
|
|
8
|
+
f([...R, S]), h(R.length);
|
|
9
9
|
}, [d, p]);
|
|
10
10
|
he(() => {
|
|
11
11
|
t == null || t({
|
|
@@ -17,15 +17,15 @@ const so = be(({ onHistoryChange: t }, e) => {
|
|
|
17
17
|
const E = n.current, C = o.current;
|
|
18
18
|
if (!E || !C) return;
|
|
19
19
|
c.current = E.getContext("2d");
|
|
20
|
-
const S = new ResizeObserver((
|
|
21
|
-
var
|
|
22
|
-
const { width:
|
|
23
|
-
if (
|
|
24
|
-
let
|
|
25
|
-
E.width > 0 && E.height > 0 && (
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const L =
|
|
20
|
+
const S = new ResizeObserver((R) => {
|
|
21
|
+
var M;
|
|
22
|
+
const { width: P, height: I } = R[0].contentRect;
|
|
23
|
+
if (P === 0 || I === 0) return;
|
|
24
|
+
let N = null;
|
|
25
|
+
E.width > 0 && E.height > 0 && (N = ((M = c.current) == null ? void 0 : M.getImageData(0, 0, E.width, E.height)) || null), E.width = P, E.height = I;
|
|
26
|
+
const A = c.current;
|
|
27
|
+
if (A && (A.lineCap = "round", A.strokeStyle = "#000", A.lineWidth = 2, N && A.putImageData(N, 0, 0)), d.length === 0) {
|
|
28
|
+
const L = A == null ? void 0 : A.getImageData(0, 0, P, I);
|
|
29
29
|
L && (f([L]), h(0));
|
|
30
30
|
}
|
|
31
31
|
});
|
|
@@ -36,21 +36,21 @@ const so = be(({ onHistoryChange: t }, e) => {
|
|
|
36
36
|
const y = (E) => {
|
|
37
37
|
const C = n.current;
|
|
38
38
|
if (!C) return { offsetX: 0, offsetY: 0 };
|
|
39
|
-
const S = C.getBoundingClientRect(),
|
|
39
|
+
const S = C.getBoundingClientRect(), R = "touches" in E ? E.touches[0].clientX : E.clientX, P = "touches" in E ? E.touches[0].clientY : E.clientY;
|
|
40
40
|
return {
|
|
41
|
-
offsetX:
|
|
42
|
-
offsetY:
|
|
41
|
+
offsetX: R - S.left,
|
|
42
|
+
offsetY: P - S.top
|
|
43
43
|
};
|
|
44
44
|
}, _ = (E) => {
|
|
45
45
|
E.preventDefault();
|
|
46
46
|
const C = c.current;
|
|
47
47
|
if (!C) return;
|
|
48
|
-
const { offsetX: S, offsetY:
|
|
49
|
-
C.beginPath(), C.moveTo(S,
|
|
48
|
+
const { offsetX: S, offsetY: R } = y(E);
|
|
49
|
+
C.beginPath(), C.moveTo(S, R), l(!0), u(!0);
|
|
50
50
|
}, T = () => {
|
|
51
51
|
const E = c.current;
|
|
52
52
|
!E || !s || (E.closePath(), l(!1), m());
|
|
53
|
-
},
|
|
53
|
+
}, v = (E) => {
|
|
54
54
|
if (!s || !c.current) return;
|
|
55
55
|
E.preventDefault();
|
|
56
56
|
const { offsetX: C, offsetY: S } = y(E);
|
|
@@ -86,19 +86,19 @@ const so = be(({ onHistoryChange: t }, e) => {
|
|
|
86
86
|
getTrimmedImageData() {
|
|
87
87
|
const E = n.current, C = c.current;
|
|
88
88
|
if (!a || !E || !C || E.width === 0 || E.height === 0) return null;
|
|
89
|
-
const S = E.width,
|
|
90
|
-
let
|
|
91
|
-
for (let H = 0; H <
|
|
89
|
+
const S = E.width, R = E.height, I = C.getImageData(0, 0, S, R).data;
|
|
90
|
+
let N = S, A = R, M = 0, L = 0;
|
|
91
|
+
for (let H = 0; H < R; H++)
|
|
92
92
|
for (let K = 0; K < S; K++)
|
|
93
|
-
|
|
94
|
-
if (
|
|
93
|
+
I[(S * H + K) * 4 + 3] > 0 && (N = Math.min(N, K), A = Math.min(A, H), M = Math.max(M, K), L = Math.max(L, H));
|
|
94
|
+
if (N === S)
|
|
95
95
|
return null;
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
const b =
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
return
|
|
96
|
+
const D = 15;
|
|
97
|
+
N = Math.max(0, N - D), A = Math.max(0, A - D), M = Math.min(S, M + D), L = Math.min(R, L + D);
|
|
98
|
+
const b = M - N, G = L - A, w = document.createElement("canvas");
|
|
99
|
+
w.width = b, w.height = G;
|
|
100
|
+
const V = w.getContext("2d");
|
|
101
|
+
return V ? (V.drawImage(E, N, A, b, G, 0, 0, b, G), w.toDataURL("image/png")) : null;
|
|
102
102
|
}
|
|
103
103
|
})), /* @__PURE__ */ g("div", { ref: o, className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ g(
|
|
104
104
|
"canvas",
|
|
@@ -106,11 +106,11 @@ const so = be(({ onHistoryChange: t }, e) => {
|
|
|
106
106
|
ref: n,
|
|
107
107
|
onMouseDown: _,
|
|
108
108
|
onMouseUp: T,
|
|
109
|
-
onMouseMove:
|
|
109
|
+
onMouseMove: v,
|
|
110
110
|
onMouseLeave: T,
|
|
111
111
|
onTouchStart: _,
|
|
112
112
|
onTouchEnd: T,
|
|
113
|
-
onTouchMove:
|
|
113
|
+
onTouchMove: v,
|
|
114
114
|
className: "w-full h-full",
|
|
115
115
|
style: { cursor: "crosshair", touchAction: "none" }
|
|
116
116
|
}
|
|
@@ -144,7 +144,7 @@ function ri(t, e, n, o) {
|
|
|
144
144
|
*/
|
|
145
145
|
class te {
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function x(t, e) {
|
|
148
148
|
const n = /\{([^}]+)\}/g;
|
|
149
149
|
return t.replace(n, (o, s) => {
|
|
150
150
|
if (Object.prototype.hasOwnProperty.call(e, s)) {
|
|
@@ -1755,10 +1755,10 @@ function gs(t, e, n) {
|
|
|
1755
1755
|
"responseMimeType"
|
|
1756
1756
|
]);
|
|
1757
1757
|
T != null && r(o, ["responseMimeType"], T);
|
|
1758
|
-
const
|
|
1758
|
+
const v = i(e, [
|
|
1759
1759
|
"responseSchema"
|
|
1760
1760
|
]);
|
|
1761
|
-
|
|
1761
|
+
v != null && r(o, ["responseSchema"], ct(v));
|
|
1762
1762
|
const E = i(e, [
|
|
1763
1763
|
"responseJsonSchema"
|
|
1764
1764
|
]);
|
|
@@ -1771,41 +1771,41 @@ function gs(t, e, n) {
|
|
|
1771
1771
|
]);
|
|
1772
1772
|
if (n !== void 0 && C != null) {
|
|
1773
1773
|
let b = C;
|
|
1774
|
-
Array.isArray(b) && (b = b.map((
|
|
1774
|
+
Array.isArray(b) && (b = b.map((G) => ks(G))), r(n, ["safetySettings"], b);
|
|
1775
1775
|
}
|
|
1776
1776
|
const S = i(e, ["tools"]);
|
|
1777
1777
|
if (n !== void 0 && S != null) {
|
|
1778
1778
|
let b = ge(S);
|
|
1779
|
-
Array.isArray(b) && (b = b.map((
|
|
1779
|
+
Array.isArray(b) && (b = b.map((G) => Us(me(G)))), r(n, ["tools"], b);
|
|
1780
1780
|
}
|
|
1781
|
-
const
|
|
1782
|
-
if (n !== void 0 &&
|
|
1781
|
+
const R = i(e, ["toolConfig"]);
|
|
1782
|
+
if (n !== void 0 && R != null && r(n, ["toolConfig"], Ds(R)), i(e, ["labels"]) !== void 0)
|
|
1783
1783
|
throw new Error("labels parameter is not supported in Gemini API.");
|
|
1784
|
-
const
|
|
1784
|
+
const P = i(e, [
|
|
1785
1785
|
"cachedContent"
|
|
1786
1786
|
]);
|
|
1787
|
-
n !== void 0 &&
|
|
1788
|
-
const
|
|
1787
|
+
n !== void 0 && P != null && r(n, ["cachedContent"], ne(t, P));
|
|
1788
|
+
const I = i(e, [
|
|
1789
1789
|
"responseModalities"
|
|
1790
1790
|
]);
|
|
1791
|
-
|
|
1792
|
-
const
|
|
1791
|
+
I != null && r(o, ["responseModalities"], I);
|
|
1792
|
+
const N = i(e, [
|
|
1793
1793
|
"mediaResolution"
|
|
1794
1794
|
]);
|
|
1795
|
-
|
|
1796
|
-
const
|
|
1797
|
-
if (
|
|
1795
|
+
N != null && r(o, ["mediaResolution"], N);
|
|
1796
|
+
const A = i(e, ["speechConfig"]);
|
|
1797
|
+
if (A != null && r(o, ["speechConfig"], ft(A)), i(e, ["audioTimestamp"]) !== void 0)
|
|
1798
1798
|
throw new Error("audioTimestamp parameter is not supported in Gemini API.");
|
|
1799
|
-
const
|
|
1799
|
+
const M = i(e, [
|
|
1800
1800
|
"thinkingConfig"
|
|
1801
1801
|
]);
|
|
1802
|
-
|
|
1802
|
+
M != null && r(o, ["thinkingConfig"], M);
|
|
1803
1803
|
const L = i(e, ["imageConfig"]);
|
|
1804
1804
|
L != null && r(o, ["imageConfig"], vs(L));
|
|
1805
|
-
const
|
|
1805
|
+
const D = i(e, [
|
|
1806
1806
|
"enableEnhancedCivicAnswers"
|
|
1807
1807
|
]);
|
|
1808
|
-
return
|
|
1808
|
+
return D != null && r(o, ["enableEnhancedCivicAnswers"], D), o;
|
|
1809
1809
|
}
|
|
1810
1810
|
function ys(t) {
|
|
1811
1811
|
const e = {}, n = i(t, [
|
|
@@ -2187,7 +2187,7 @@ class bs extends te {
|
|
|
2187
2187
|
this.apiClient,
|
|
2188
2188
|
// Use instance apiClient
|
|
2189
2189
|
e
|
|
2190
|
-
), o = n._url, s =
|
|
2190
|
+
), o = n._url, s = x("{model}:batchGenerateContent", o), u = n.batch.inputConfig.requests, c = u.requests, d = [];
|
|
2191
2191
|
for (const f of c) {
|
|
2192
2192
|
const p = Object.assign({}, f);
|
|
2193
2193
|
if (p.systemInstruction) {
|
|
@@ -2240,7 +2240,7 @@ class bs extends te {
|
|
|
2240
2240
|
let a, u = "", c = {};
|
|
2241
2241
|
if (this.apiClient.isVertexAI()) {
|
|
2242
2242
|
const d = os(this.apiClient, e);
|
|
2243
|
-
return u =
|
|
2243
|
+
return u = x("batchPredictionJobs", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2244
2244
|
path: u,
|
|
2245
2245
|
queryParams: c,
|
|
2246
2246
|
body: JSON.stringify(d),
|
|
@@ -2250,7 +2250,7 @@ class bs extends te {
|
|
|
2250
2250
|
}).then((f) => f.json()), a.then((f) => Qe(f));
|
|
2251
2251
|
} else {
|
|
2252
2252
|
const d = kn(this.apiClient, e);
|
|
2253
|
-
return u =
|
|
2253
|
+
return u = x("{model}:batchGenerateContent", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2254
2254
|
path: u,
|
|
2255
2255
|
queryParams: c,
|
|
2256
2256
|
body: JSON.stringify(d),
|
|
@@ -2274,7 +2274,7 @@ class bs extends te {
|
|
|
2274
2274
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
2275
2275
|
{
|
|
2276
2276
|
const u = ss(this.apiClient, e);
|
|
2277
|
-
return l =
|
|
2277
|
+
return l = x("{model}:asyncBatchEmbedContent", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
2278
2278
|
path: l,
|
|
2279
2279
|
queryParams: a,
|
|
2280
2280
|
body: JSON.stringify(u),
|
|
@@ -2300,7 +2300,7 @@ class bs extends te {
|
|
|
2300
2300
|
let a, u = "", c = {};
|
|
2301
2301
|
if (this.apiClient.isVertexAI()) {
|
|
2302
2302
|
const d = _s(this.apiClient, e);
|
|
2303
|
-
return u =
|
|
2303
|
+
return u = x("batchPredictionJobs/{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2304
2304
|
path: u,
|
|
2305
2305
|
queryParams: c,
|
|
2306
2306
|
body: JSON.stringify(d),
|
|
@@ -2310,7 +2310,7 @@ class bs extends te {
|
|
|
2310
2310
|
}).then((f) => f.json()), a.then((f) => Qe(f));
|
|
2311
2311
|
} else {
|
|
2312
2312
|
const d = Ts(this.apiClient, e);
|
|
2313
|
-
return u =
|
|
2313
|
+
return u = x("batches/{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2314
2314
|
path: u,
|
|
2315
2315
|
queryParams: c,
|
|
2316
2316
|
body: JSON.stringify(d),
|
|
@@ -2336,7 +2336,7 @@ class bs extends te {
|
|
|
2336
2336
|
let a = "", u = {};
|
|
2337
2337
|
if (this.apiClient.isVertexAI()) {
|
|
2338
2338
|
const c = Zi(this.apiClient, e);
|
|
2339
|
-
a =
|
|
2339
|
+
a = x("batchPredictionJobs/{name}:cancel", c._url), u = c._query, delete c._url, delete c._query, await this.apiClient.request({
|
|
2340
2340
|
path: a,
|
|
2341
2341
|
queryParams: u,
|
|
2342
2342
|
body: JSON.stringify(c),
|
|
@@ -2346,7 +2346,7 @@ class bs extends te {
|
|
|
2346
2346
|
});
|
|
2347
2347
|
} else {
|
|
2348
2348
|
const c = Qi(this.apiClient, e);
|
|
2349
|
-
a =
|
|
2349
|
+
a = x("batches/{name}:cancel", c._url), u = c._query, delete c._url, delete c._query, await this.apiClient.request({
|
|
2350
2350
|
path: a,
|
|
2351
2351
|
queryParams: u,
|
|
2352
2352
|
body: JSON.stringify(c),
|
|
@@ -2361,7 +2361,7 @@ class bs extends te {
|
|
|
2361
2361
|
let a, u = "", c = {};
|
|
2362
2362
|
if (this.apiClient.isVertexAI()) {
|
|
2363
2363
|
const d = Rs(e);
|
|
2364
|
-
return u =
|
|
2364
|
+
return u = x("batchPredictionJobs", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2365
2365
|
path: u,
|
|
2366
2366
|
queryParams: c,
|
|
2367
2367
|
body: JSON.stringify(d),
|
|
@@ -2379,7 +2379,7 @@ class bs extends te {
|
|
|
2379
2379
|
});
|
|
2380
2380
|
} else {
|
|
2381
2381
|
const d = ws(e);
|
|
2382
|
-
return u =
|
|
2382
|
+
return u = x("batches", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2383
2383
|
path: u,
|
|
2384
2384
|
queryParams: c,
|
|
2385
2385
|
body: JSON.stringify(d),
|
|
@@ -2413,7 +2413,7 @@ class bs extends te {
|
|
|
2413
2413
|
let a, u = "", c = {};
|
|
2414
2414
|
if (this.apiClient.isVertexAI()) {
|
|
2415
2415
|
const d = ls(this.apiClient, e);
|
|
2416
|
-
return u =
|
|
2416
|
+
return u = x("batchPredictionJobs/{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2417
2417
|
path: u,
|
|
2418
2418
|
queryParams: c,
|
|
2419
2419
|
body: JSON.stringify(d),
|
|
@@ -2428,7 +2428,7 @@ class bs extends te {
|
|
|
2428
2428
|
})), a.then((f) => us(f));
|
|
2429
2429
|
} else {
|
|
2430
2430
|
const d = rs(this.apiClient, e);
|
|
2431
|
-
return u =
|
|
2431
|
+
return u = x("batches/{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2432
2432
|
path: u,
|
|
2433
2433
|
queryParams: c,
|
|
2434
2434
|
body: JSON.stringify(d),
|
|
@@ -2855,7 +2855,7 @@ class pr extends te {
|
|
|
2855
2855
|
let a, u = "", c = {};
|
|
2856
2856
|
if (this.apiClient.isVertexAI()) {
|
|
2857
2857
|
const d = qs(this.apiClient, e);
|
|
2858
|
-
return u =
|
|
2858
|
+
return u = x("cachedContents", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2859
2859
|
path: u,
|
|
2860
2860
|
queryParams: c,
|
|
2861
2861
|
body: JSON.stringify(d),
|
|
@@ -2865,7 +2865,7 @@ class pr extends te {
|
|
|
2865
2865
|
}).then((f) => f.json()), a.then((f) => f);
|
|
2866
2866
|
} else {
|
|
2867
2867
|
const d = Vs(this.apiClient, e);
|
|
2868
|
-
return u =
|
|
2868
|
+
return u = x("cachedContents", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2869
2869
|
path: u,
|
|
2870
2870
|
queryParams: c,
|
|
2871
2871
|
body: JSON.stringify(d),
|
|
@@ -2891,7 +2891,7 @@ class pr extends te {
|
|
|
2891
2891
|
let a, u = "", c = {};
|
|
2892
2892
|
if (this.apiClient.isVertexAI()) {
|
|
2893
2893
|
const d = Xs(this.apiClient, e);
|
|
2894
|
-
return u =
|
|
2894
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2895
2895
|
path: u,
|
|
2896
2896
|
queryParams: c,
|
|
2897
2897
|
body: JSON.stringify(d),
|
|
@@ -2901,7 +2901,7 @@ class pr extends te {
|
|
|
2901
2901
|
}).then((f) => f.json()), a.then((f) => f);
|
|
2902
2902
|
} else {
|
|
2903
2903
|
const d = Os(this.apiClient, e);
|
|
2904
|
-
return u =
|
|
2904
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2905
2905
|
path: u,
|
|
2906
2906
|
queryParams: c,
|
|
2907
2907
|
body: JSON.stringify(d),
|
|
@@ -2927,7 +2927,7 @@ class pr extends te {
|
|
|
2927
2927
|
let a, u = "", c = {};
|
|
2928
2928
|
if (this.apiClient.isVertexAI()) {
|
|
2929
2929
|
const d = Bs(this.apiClient, e);
|
|
2930
|
-
return u =
|
|
2930
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2931
2931
|
path: u,
|
|
2932
2932
|
queryParams: c,
|
|
2933
2933
|
body: JSON.stringify(d),
|
|
@@ -2945,7 +2945,7 @@ class pr extends te {
|
|
|
2945
2945
|
});
|
|
2946
2946
|
} else {
|
|
2947
2947
|
const d = Hs(this.apiClient, e);
|
|
2948
|
-
return u =
|
|
2948
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2949
2949
|
path: u,
|
|
2950
2950
|
queryParams: c,
|
|
2951
2951
|
body: JSON.stringify(d),
|
|
@@ -2982,7 +2982,7 @@ class pr extends te {
|
|
|
2982
2982
|
let a, u = "", c = {};
|
|
2983
2983
|
if (this.apiClient.isVertexAI()) {
|
|
2984
2984
|
const d = fr(this.apiClient, e);
|
|
2985
|
-
return u =
|
|
2985
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2986
2986
|
path: u,
|
|
2987
2987
|
queryParams: c,
|
|
2988
2988
|
body: JSON.stringify(d),
|
|
@@ -2992,7 +2992,7 @@ class pr extends te {
|
|
|
2992
2992
|
}).then((f) => f.json()), a.then((f) => f);
|
|
2993
2993
|
} else {
|
|
2994
2994
|
const d = cr(this.apiClient, e);
|
|
2995
|
-
return u =
|
|
2995
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
2996
2996
|
path: u,
|
|
2997
2997
|
queryParams: c,
|
|
2998
2998
|
body: JSON.stringify(d),
|
|
@@ -3007,7 +3007,7 @@ class pr extends te {
|
|
|
3007
3007
|
let a, u = "", c = {};
|
|
3008
3008
|
if (this.apiClient.isVertexAI()) {
|
|
3009
3009
|
const d = nr(e);
|
|
3010
|
-
return u =
|
|
3010
|
+
return u = x("cachedContents", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
3011
3011
|
path: u,
|
|
3012
3012
|
queryParams: c,
|
|
3013
3013
|
body: JSON.stringify(d),
|
|
@@ -3025,7 +3025,7 @@ class pr extends te {
|
|
|
3025
3025
|
});
|
|
3026
3026
|
} else {
|
|
3027
3027
|
const d = tr(e);
|
|
3028
|
-
return u =
|
|
3028
|
+
return u = x("cachedContents", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
3029
3029
|
path: u,
|
|
3030
3030
|
queryParams: c,
|
|
3031
3031
|
body: JSON.stringify(d),
|
|
@@ -3062,8 +3062,8 @@ function Un(t) {
|
|
|
3062
3062
|
};
|
|
3063
3063
|
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
3064
3064
|
}
|
|
3065
|
-
function
|
|
3066
|
-
return this instanceof
|
|
3065
|
+
function U(t) {
|
|
3066
|
+
return this instanceof U ? (this.v = t, this) : new U(t);
|
|
3067
3067
|
}
|
|
3068
3068
|
function X(t, e, n) {
|
|
3069
3069
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
@@ -3078,8 +3078,8 @@ function X(t, e, n) {
|
|
|
3078
3078
|
}
|
|
3079
3079
|
function u(m, y) {
|
|
3080
3080
|
o[m] && (s[m] = function(_) {
|
|
3081
|
-
return new Promise(function(T,
|
|
3082
|
-
l.push([m, _, T,
|
|
3081
|
+
return new Promise(function(T, v) {
|
|
3082
|
+
l.push([m, _, T, v]) > 1 || c(m, _);
|
|
3083
3083
|
});
|
|
3084
3084
|
}, y && (s[m] = y(s[m])));
|
|
3085
3085
|
}
|
|
@@ -3091,7 +3091,7 @@ function X(t, e, n) {
|
|
|
3091
3091
|
}
|
|
3092
3092
|
}
|
|
3093
3093
|
function d(m) {
|
|
3094
|
-
m.value instanceof
|
|
3094
|
+
m.value instanceof U ? Promise.resolve(m.value.v).then(f, p) : h(l[0][2], m);
|
|
3095
3095
|
}
|
|
3096
3096
|
function f(m) {
|
|
3097
3097
|
c("next", m);
|
|
@@ -3315,20 +3315,20 @@ class yr {
|
|
|
3315
3315
|
var s, l, a, u, c, d;
|
|
3316
3316
|
const f = [];
|
|
3317
3317
|
try {
|
|
3318
|
-
for (var p = !0, h = Q(e), m; m = yield
|
|
3318
|
+
for (var p = !0, h = Q(e), m; m = yield U(h.next()), s = m.done, !s; p = !0) {
|
|
3319
3319
|
u = m.value, p = !1;
|
|
3320
3320
|
const y = u;
|
|
3321
3321
|
if (hr(y)) {
|
|
3322
3322
|
const _ = (d = (c = y.candidates) === null || c === void 0 ? void 0 : c[0]) === null || d === void 0 ? void 0 : d.content;
|
|
3323
3323
|
_ !== void 0 && f.push(_);
|
|
3324
3324
|
}
|
|
3325
|
-
yield yield
|
|
3325
|
+
yield yield U(y);
|
|
3326
3326
|
}
|
|
3327
3327
|
} catch (y) {
|
|
3328
3328
|
l = { error: y };
|
|
3329
3329
|
} finally {
|
|
3330
3330
|
try {
|
|
3331
|
-
!p && !s && (a = h.return) && (yield
|
|
3331
|
+
!p && !s && (a = h.return) && (yield U(a.call(h)));
|
|
3332
3332
|
} finally {
|
|
3333
3333
|
if (l) throw l.error;
|
|
3334
3334
|
}
|
|
@@ -3492,7 +3492,7 @@ class xr extends te {
|
|
|
3492
3492
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
3493
3493
|
{
|
|
3494
3494
|
const u = Sr(e);
|
|
3495
|
-
return l =
|
|
3495
|
+
return l = x("files", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
3496
3496
|
path: l,
|
|
3497
3497
|
queryParams: a,
|
|
3498
3498
|
body: JSON.stringify(u),
|
|
@@ -3517,7 +3517,7 @@ class xr extends te {
|
|
|
3517
3517
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
3518
3518
|
{
|
|
3519
3519
|
const u = Tr(e);
|
|
3520
|
-
return l =
|
|
3520
|
+
return l = x("upload/v1beta/files", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
3521
3521
|
path: l,
|
|
3522
3522
|
queryParams: a,
|
|
3523
3523
|
body: JSON.stringify(u),
|
|
@@ -3552,7 +3552,7 @@ class xr extends te {
|
|
|
3552
3552
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
3553
3553
|
{
|
|
3554
3554
|
const u = vr(e);
|
|
3555
|
-
return l =
|
|
3555
|
+
return l = x("files/{file}", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
3556
3556
|
path: l,
|
|
3557
3557
|
queryParams: a,
|
|
3558
3558
|
body: JSON.stringify(u),
|
|
@@ -3582,7 +3582,7 @@ class xr extends te {
|
|
|
3582
3582
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
3583
3583
|
{
|
|
3584
3584
|
const u = Er(e);
|
|
3585
|
-
return l =
|
|
3585
|
+
return l = x("files/{file}", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
3586
3586
|
path: l,
|
|
3587
3587
|
queryParams: a,
|
|
3588
3588
|
body: JSON.stringify(u),
|
|
@@ -3723,8 +3723,8 @@ function Pr(t) {
|
|
|
3723
3723
|
"routingConfig"
|
|
3724
3724
|
]);
|
|
3725
3725
|
T != null && r(e, ["routingConfig"], T);
|
|
3726
|
-
const
|
|
3727
|
-
|
|
3726
|
+
const v = i(t, ["seed"]);
|
|
3727
|
+
v != null && r(e, ["seed"], v);
|
|
3728
3728
|
const E = i(t, ["speechConfig"]);
|
|
3729
3729
|
E != null && r(e, ["speechConfig"], E);
|
|
3730
3730
|
const C = i(t, [
|
|
@@ -3733,14 +3733,14 @@ function Pr(t) {
|
|
|
3733
3733
|
C != null && r(e, ["stopSequences"], C);
|
|
3734
3734
|
const S = i(t, ["temperature"]);
|
|
3735
3735
|
S != null && r(e, ["temperature"], S);
|
|
3736
|
-
const
|
|
3736
|
+
const R = i(t, [
|
|
3737
3737
|
"thinkingConfig"
|
|
3738
3738
|
]);
|
|
3739
|
-
|
|
3740
|
-
const
|
|
3741
|
-
|
|
3742
|
-
const
|
|
3743
|
-
if (
|
|
3739
|
+
R != null && r(e, ["thinkingConfig"], R);
|
|
3740
|
+
const P = i(t, ["topK"]);
|
|
3741
|
+
P != null && r(e, ["topK"], P);
|
|
3742
|
+
const I = i(t, ["topP"]);
|
|
3743
|
+
if (I != null && r(e, ["topP"], I), i(t, ["enableEnhancedCivicAnswers"]) !== void 0)
|
|
3744
3744
|
throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");
|
|
3745
3745
|
return e;
|
|
3746
3746
|
}
|
|
@@ -3803,17 +3803,17 @@ function Ur(t, e) {
|
|
|
3803
3803
|
e !== void 0 && y != null && r(e, ["setup", "systemInstruction"], wr(J(y)));
|
|
3804
3804
|
const _ = i(t, ["tools"]);
|
|
3805
3805
|
if (e !== void 0 && _ != null) {
|
|
3806
|
-
let
|
|
3807
|
-
Array.isArray(
|
|
3806
|
+
let P = ge(_);
|
|
3807
|
+
Array.isArray(P) && (P = P.map((I) => Wr(me(I)))), r(e, ["setup", "tools"], P);
|
|
3808
3808
|
}
|
|
3809
3809
|
const T = i(t, [
|
|
3810
3810
|
"sessionResumption"
|
|
3811
3811
|
]);
|
|
3812
3812
|
e !== void 0 && T != null && r(e, ["setup", "sessionResumption"], $r(T));
|
|
3813
|
-
const
|
|
3813
|
+
const v = i(t, [
|
|
3814
3814
|
"inputAudioTranscription"
|
|
3815
3815
|
]);
|
|
3816
|
-
e !== void 0 &&
|
|
3816
|
+
e !== void 0 && v != null && r(e, ["setup", "inputAudioTranscription"], v);
|
|
3817
3817
|
const E = i(t, [
|
|
3818
3818
|
"outputAudioTranscription"
|
|
3819
3819
|
]);
|
|
@@ -3826,8 +3826,8 @@ function Ur(t, e) {
|
|
|
3826
3826
|
"contextWindowCompression"
|
|
3827
3827
|
]);
|
|
3828
3828
|
e !== void 0 && S != null && r(e, ["setup", "contextWindowCompression"], S);
|
|
3829
|
-
const
|
|
3830
|
-
if (e !== void 0 &&
|
|
3829
|
+
const R = i(t, ["proactivity"]);
|
|
3830
|
+
if (e !== void 0 && R != null && r(e, ["setup", "proactivity"], R), i(t, ["explicitVadSignal"]) !== void 0)
|
|
3831
3831
|
throw new Error("explicitVadSignal parameter is not supported in Gemini API.");
|
|
3832
3832
|
return n;
|
|
3833
3833
|
}
|
|
@@ -3872,17 +3872,17 @@ function br(t, e) {
|
|
|
3872
3872
|
e !== void 0 && y != null && r(e, ["setup", "systemInstruction"], J(y));
|
|
3873
3873
|
const _ = i(t, ["tools"]);
|
|
3874
3874
|
if (e !== void 0 && _ != null) {
|
|
3875
|
-
let
|
|
3876
|
-
Array.isArray(
|
|
3875
|
+
let I = ge(_);
|
|
3876
|
+
Array.isArray(I) && (I = I.map((N) => Yr(me(N)))), r(e, ["setup", "tools"], I);
|
|
3877
3877
|
}
|
|
3878
3878
|
const T = i(t, [
|
|
3879
3879
|
"sessionResumption"
|
|
3880
3880
|
]);
|
|
3881
3881
|
e !== void 0 && T != null && r(e, ["setup", "sessionResumption"], T);
|
|
3882
|
-
const
|
|
3882
|
+
const v = i(t, [
|
|
3883
3883
|
"inputAudioTranscription"
|
|
3884
3884
|
]);
|
|
3885
|
-
e !== void 0 &&
|
|
3885
|
+
e !== void 0 && v != null && r(e, ["setup", "inputAudioTranscription"], v);
|
|
3886
3886
|
const E = i(t, [
|
|
3887
3887
|
"outputAudioTranscription"
|
|
3888
3888
|
]);
|
|
@@ -3895,12 +3895,12 @@ function br(t, e) {
|
|
|
3895
3895
|
"contextWindowCompression"
|
|
3896
3896
|
]);
|
|
3897
3897
|
e !== void 0 && S != null && r(e, ["setup", "contextWindowCompression"], S);
|
|
3898
|
-
const
|
|
3899
|
-
e !== void 0 &&
|
|
3900
|
-
const
|
|
3898
|
+
const R = i(t, ["proactivity"]);
|
|
3899
|
+
e !== void 0 && R != null && r(e, ["setup", "proactivity"], R);
|
|
3900
|
+
const P = i(t, [
|
|
3901
3901
|
"explicitVadSignal"
|
|
3902
3902
|
]);
|
|
3903
|
-
return e !== void 0 &&
|
|
3903
|
+
return e !== void 0 && P != null && r(e, ["setup", "explicitVadSignal"], P), n;
|
|
3904
3904
|
}
|
|
3905
3905
|
function Lr(t, e) {
|
|
3906
3906
|
const n = {}, o = i(e, ["model"]);
|
|
@@ -4406,8 +4406,8 @@ function fl(t, e) {
|
|
|
4406
4406
|
e !== void 0 && _ != null && r(e, ["parameters", "outputOptions", "compressionQuality"], _);
|
|
4407
4407
|
const T = i(t, ["addWatermark"]);
|
|
4408
4408
|
e !== void 0 && T != null && r(e, ["parameters", "addWatermark"], T);
|
|
4409
|
-
const
|
|
4410
|
-
e !== void 0 &&
|
|
4409
|
+
const v = i(t, ["labels"]);
|
|
4410
|
+
e !== void 0 && v != null && r(e, ["labels"], v);
|
|
4411
4411
|
const E = i(t, ["editMode"]);
|
|
4412
4412
|
e !== void 0 && E != null && r(e, ["parameters", "editMode"], E);
|
|
4413
4413
|
const C = i(t, ["baseSteps"]);
|
|
@@ -4626,10 +4626,10 @@ function xl(t, e, n) {
|
|
|
4626
4626
|
"responseMimeType"
|
|
4627
4627
|
]);
|
|
4628
4628
|
T != null && r(o, ["responseMimeType"], T);
|
|
4629
|
-
const
|
|
4629
|
+
const v = i(e, [
|
|
4630
4630
|
"responseSchema"
|
|
4631
4631
|
]);
|
|
4632
|
-
|
|
4632
|
+
v != null && r(o, ["responseSchema"], ct(v));
|
|
4633
4633
|
const E = i(e, [
|
|
4634
4634
|
"responseJsonSchema"
|
|
4635
4635
|
]);
|
|
@@ -4642,41 +4642,41 @@ function xl(t, e, n) {
|
|
|
4642
4642
|
]);
|
|
4643
4643
|
if (n !== void 0 && C != null) {
|
|
4644
4644
|
let b = C;
|
|
4645
|
-
Array.isArray(b) && (b = b.map((
|
|
4645
|
+
Array.isArray(b) && (b = b.map((G) => ga(G))), r(n, ["safetySettings"], b);
|
|
4646
4646
|
}
|
|
4647
4647
|
const S = i(e, ["tools"]);
|
|
4648
4648
|
if (n !== void 0 && S != null) {
|
|
4649
4649
|
let b = ge(S);
|
|
4650
|
-
Array.isArray(b) && (b = b.map((
|
|
4650
|
+
Array.isArray(b) && (b = b.map((G) => Ia(me(G)))), r(n, ["tools"], b);
|
|
4651
4651
|
}
|
|
4652
|
-
const
|
|
4653
|
-
if (n !== void 0 &&
|
|
4652
|
+
const R = i(e, ["toolConfig"]);
|
|
4653
|
+
if (n !== void 0 && R != null && r(n, ["toolConfig"], va(R)), i(e, ["labels"]) !== void 0)
|
|
4654
4654
|
throw new Error("labels parameter is not supported in Gemini API.");
|
|
4655
|
-
const
|
|
4655
|
+
const P = i(e, [
|
|
4656
4656
|
"cachedContent"
|
|
4657
4657
|
]);
|
|
4658
|
-
n !== void 0 &&
|
|
4659
|
-
const
|
|
4658
|
+
n !== void 0 && P != null && r(n, ["cachedContent"], ne(t, P));
|
|
4659
|
+
const I = i(e, [
|
|
4660
4660
|
"responseModalities"
|
|
4661
4661
|
]);
|
|
4662
|
-
|
|
4663
|
-
const
|
|
4662
|
+
I != null && r(o, ["responseModalities"], I);
|
|
4663
|
+
const N = i(e, [
|
|
4664
4664
|
"mediaResolution"
|
|
4665
4665
|
]);
|
|
4666
|
-
|
|
4667
|
-
const
|
|
4668
|
-
if (
|
|
4666
|
+
N != null && r(o, ["mediaResolution"], N);
|
|
4667
|
+
const A = i(e, ["speechConfig"]);
|
|
4668
|
+
if (A != null && r(o, ["speechConfig"], ft(A)), i(e, ["audioTimestamp"]) !== void 0)
|
|
4669
4669
|
throw new Error("audioTimestamp parameter is not supported in Gemini API.");
|
|
4670
|
-
const
|
|
4670
|
+
const M = i(e, [
|
|
4671
4671
|
"thinkingConfig"
|
|
4672
4672
|
]);
|
|
4673
|
-
|
|
4673
|
+
M != null && r(o, ["thinkingConfig"], M);
|
|
4674
4674
|
const L = i(e, ["imageConfig"]);
|
|
4675
4675
|
L != null && r(o, ["imageConfig"], jl(L));
|
|
4676
|
-
const
|
|
4676
|
+
const D = i(e, [
|
|
4677
4677
|
"enableEnhancedCivicAnswers"
|
|
4678
4678
|
]);
|
|
4679
|
-
return
|
|
4679
|
+
return D != null && r(o, ["enableEnhancedCivicAnswers"], D), o;
|
|
4680
4680
|
}
|
|
4681
4681
|
function wl(t, e, n) {
|
|
4682
4682
|
const o = {}, s = i(e, [
|
|
@@ -4721,10 +4721,10 @@ function wl(t, e, n) {
|
|
|
4721
4721
|
"responseMimeType"
|
|
4722
4722
|
]);
|
|
4723
4723
|
T != null && r(o, ["responseMimeType"], T);
|
|
4724
|
-
const
|
|
4724
|
+
const v = i(e, [
|
|
4725
4725
|
"responseSchema"
|
|
4726
4726
|
]);
|
|
4727
|
-
|
|
4727
|
+
v != null && r(o, ["responseSchema"], ct(v));
|
|
4728
4728
|
const E = i(e, [
|
|
4729
4729
|
"responseJsonSchema"
|
|
4730
4730
|
]);
|
|
@@ -4737,46 +4737,46 @@ function wl(t, e, n) {
|
|
|
4737
4737
|
"modelSelectionConfig"
|
|
4738
4738
|
]);
|
|
4739
4739
|
S != null && r(o, ["modelConfig"], S);
|
|
4740
|
-
const
|
|
4740
|
+
const R = i(e, [
|
|
4741
4741
|
"safetySettings"
|
|
4742
4742
|
]);
|
|
4743
|
-
if (n !== void 0 && v != null) {
|
|
4744
|
-
let G = v;
|
|
4745
|
-
Array.isArray(G) && (G = G.map((H) => H)), r(n, ["safetySettings"], G);
|
|
4746
|
-
}
|
|
4747
|
-
const R = i(e, ["tools"]);
|
|
4748
4743
|
if (n !== void 0 && R != null) {
|
|
4749
|
-
let
|
|
4750
|
-
Array.isArray(
|
|
4751
|
-
}
|
|
4752
|
-
const
|
|
4753
|
-
n !== void 0 &&
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4744
|
+
let V = R;
|
|
4745
|
+
Array.isArray(V) && (V = V.map((H) => H)), r(n, ["safetySettings"], V);
|
|
4746
|
+
}
|
|
4747
|
+
const P = i(e, ["tools"]);
|
|
4748
|
+
if (n !== void 0 && P != null) {
|
|
4749
|
+
let V = ge(P);
|
|
4750
|
+
Array.isArray(V) && (V = V.map((H) => Ao(me(H)))), r(n, ["tools"], V);
|
|
4751
|
+
}
|
|
4752
|
+
const I = i(e, ["toolConfig"]);
|
|
4753
|
+
n !== void 0 && I != null && r(n, ["toolConfig"], I);
|
|
4754
|
+
const N = i(e, ["labels"]);
|
|
4755
|
+
n !== void 0 && N != null && r(n, ["labels"], N);
|
|
4756
|
+
const A = i(e, [
|
|
4757
4757
|
"cachedContent"
|
|
4758
4758
|
]);
|
|
4759
|
-
n !== void 0 &&
|
|
4760
|
-
const
|
|
4759
|
+
n !== void 0 && A != null && r(n, ["cachedContent"], ne(t, A));
|
|
4760
|
+
const M = i(e, [
|
|
4761
4761
|
"responseModalities"
|
|
4762
4762
|
]);
|
|
4763
|
-
|
|
4763
|
+
M != null && r(o, ["responseModalities"], M);
|
|
4764
4764
|
const L = i(e, [
|
|
4765
4765
|
"mediaResolution"
|
|
4766
4766
|
]);
|
|
4767
4767
|
L != null && r(o, ["mediaResolution"], L);
|
|
4768
|
-
const
|
|
4769
|
-
|
|
4768
|
+
const D = i(e, ["speechConfig"]);
|
|
4769
|
+
D != null && r(o, ["speechConfig"], ft(D));
|
|
4770
4770
|
const b = i(e, [
|
|
4771
4771
|
"audioTimestamp"
|
|
4772
4772
|
]);
|
|
4773
4773
|
b != null && r(o, ["audioTimestamp"], b);
|
|
4774
|
-
const
|
|
4774
|
+
const G = i(e, [
|
|
4775
4775
|
"thinkingConfig"
|
|
4776
4776
|
]);
|
|
4777
|
-
|
|
4778
|
-
const
|
|
4779
|
-
if (
|
|
4777
|
+
G != null && r(o, ["thinkingConfig"], G);
|
|
4778
|
+
const w = i(e, ["imageConfig"]);
|
|
4779
|
+
if (w != null && r(o, ["imageConfig"], ea(w)), i(e, ["enableEnhancedCivicAnswers"]) !== void 0)
|
|
4780
4780
|
throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");
|
|
4781
4781
|
return o;
|
|
4782
4782
|
}
|
|
@@ -4948,8 +4948,8 @@ function Nl(t, e) {
|
|
|
4948
4948
|
e !== void 0 && _ != null && r(e, ["parameters", "outputOptions", "compressionQuality"], _);
|
|
4949
4949
|
const T = i(t, ["addWatermark"]);
|
|
4950
4950
|
e !== void 0 && T != null && r(e, ["parameters", "addWatermark"], T);
|
|
4951
|
-
const
|
|
4952
|
-
e !== void 0 &&
|
|
4951
|
+
const v = i(t, ["labels"]);
|
|
4952
|
+
e !== void 0 && v != null && r(e, ["labels"], v);
|
|
4953
4953
|
const E = i(t, ["imageSize"]);
|
|
4954
4954
|
e !== void 0 && E != null && r(e, ["parameters", "sampleImageSize"], E);
|
|
4955
4955
|
const C = i(t, [
|
|
@@ -5099,8 +5099,8 @@ function bl(t, e) {
|
|
|
5099
5099
|
let C = T;
|
|
5100
5100
|
Array.isArray(C) && (C = C.map((S) => Fa(S))), r(e, ["instances[0]", "referenceImages"], C);
|
|
5101
5101
|
}
|
|
5102
|
-
const
|
|
5103
|
-
e !== void 0 &&
|
|
5102
|
+
const v = i(t, ["mask"]);
|
|
5103
|
+
e !== void 0 && v != null && r(e, ["instances[0]", "mask"], ba(v));
|
|
5104
5104
|
const E = i(t, [
|
|
5105
5105
|
"compressionQuality"
|
|
5106
5106
|
]);
|
|
@@ -5308,8 +5308,8 @@ function zl(t) {
|
|
|
5308
5308
|
"routingConfig"
|
|
5309
5309
|
]);
|
|
5310
5310
|
T != null && r(e, ["routingConfig"], T);
|
|
5311
|
-
const
|
|
5312
|
-
|
|
5311
|
+
const v = i(t, ["seed"]);
|
|
5312
|
+
v != null && r(e, ["seed"], v);
|
|
5313
5313
|
const E = i(t, ["speechConfig"]);
|
|
5314
5314
|
E != null && r(e, ["speechConfig"], E);
|
|
5315
5315
|
const C = i(t, [
|
|
@@ -5318,14 +5318,14 @@ function zl(t) {
|
|
|
5318
5318
|
C != null && r(e, ["stopSequences"], C);
|
|
5319
5319
|
const S = i(t, ["temperature"]);
|
|
5320
5320
|
S != null && r(e, ["temperature"], S);
|
|
5321
|
-
const
|
|
5321
|
+
const R = i(t, [
|
|
5322
5322
|
"thinkingConfig"
|
|
5323
5323
|
]);
|
|
5324
|
-
|
|
5325
|
-
const
|
|
5326
|
-
|
|
5327
|
-
const
|
|
5328
|
-
if (
|
|
5324
|
+
R != null && r(e, ["thinkingConfig"], R);
|
|
5325
|
+
const P = i(t, ["topK"]);
|
|
5326
|
+
P != null && r(e, ["topK"], P);
|
|
5327
|
+
const I = i(t, ["topP"]);
|
|
5328
|
+
if (I != null && r(e, ["topP"], I), i(t, ["enableEnhancedCivicAnswers"]) !== void 0)
|
|
5329
5329
|
throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");
|
|
5330
5330
|
return e;
|
|
5331
5331
|
}
|
|
@@ -6309,7 +6309,7 @@ class su {
|
|
|
6309
6309
|
\r
|
|
6310
6310
|
`];
|
|
6311
6311
|
for (; ; ) {
|
|
6312
|
-
const { done: d, value: f } = yield
|
|
6312
|
+
const { done: d, value: f } = yield U(s.read());
|
|
6313
6313
|
if (d) {
|
|
6314
6314
|
if (a.trim().length > 0)
|
|
6315
6315
|
throw new Error("Incomplete JSON segment at the end");
|
|
@@ -6319,11 +6319,11 @@ class su {
|
|
|
6319
6319
|
try {
|
|
6320
6320
|
const y = JSON.parse(p);
|
|
6321
6321
|
if ("error" in y) {
|
|
6322
|
-
const _ = JSON.parse(JSON.stringify(y.error)), T = _.status,
|
|
6323
|
-
if (
|
|
6322
|
+
const _ = JSON.parse(JSON.stringify(y.error)), T = _.status, v = _.code, E = `got status: ${T}. ${JSON.stringify(y)}`;
|
|
6323
|
+
if (v >= 400 && v < 600)
|
|
6324
6324
|
throw new Le({
|
|
6325
6325
|
message: E,
|
|
6326
|
-
status:
|
|
6326
|
+
status: v
|
|
6327
6327
|
});
|
|
6328
6328
|
}
|
|
6329
6329
|
} catch (y) {
|
|
@@ -6335,8 +6335,8 @@ class su {
|
|
|
6335
6335
|
for (; ; ) {
|
|
6336
6336
|
h = -1, m = 0;
|
|
6337
6337
|
for (const T of c) {
|
|
6338
|
-
const
|
|
6339
|
-
|
|
6338
|
+
const v = a.indexOf(T);
|
|
6339
|
+
v !== -1 && (h === -1 || v < h) && (h = v, m = T.length);
|
|
6340
6340
|
}
|
|
6341
6341
|
if (h === -1)
|
|
6342
6342
|
break;
|
|
@@ -6346,14 +6346,14 @@ class su {
|
|
|
6346
6346
|
if (_.startsWith(u)) {
|
|
6347
6347
|
const T = _.substring(u.length).trim();
|
|
6348
6348
|
try {
|
|
6349
|
-
const
|
|
6349
|
+
const v = new Response(T, {
|
|
6350
6350
|
headers: e == null ? void 0 : e.headers,
|
|
6351
6351
|
status: e == null ? void 0 : e.status,
|
|
6352
6352
|
statusText: e == null ? void 0 : e.statusText
|
|
6353
6353
|
});
|
|
6354
|
-
yield yield
|
|
6355
|
-
} catch (
|
|
6356
|
-
throw new Error(`exception parsing stream chunk ${T}. ${
|
|
6354
|
+
yield yield U(new Oe(v));
|
|
6355
|
+
} catch (v) {
|
|
6356
|
+
throw new Error(`exception parsing stream chunk ${T}. ${v}`);
|
|
6357
6357
|
}
|
|
6358
6358
|
}
|
|
6359
6359
|
}
|
|
@@ -6409,7 +6409,7 @@ class su {
|
|
|
6409
6409
|
s.mimeType = u;
|
|
6410
6410
|
const c = {
|
|
6411
6411
|
file: s
|
|
6412
|
-
}, d = this.getFileName(e), f =
|
|
6412
|
+
}, d = this.getFileName(e), f = x("upload/v1beta/files", c._url), p = await this.fetchUploadUrl(f, s.sizeBytes, s.mimeType, d, c, n == null ? void 0 : n.httpOptions);
|
|
6413
6413
|
return l.upload(e, p, this);
|
|
6414
6414
|
}
|
|
6415
6415
|
/**
|
|
@@ -6544,9 +6544,9 @@ function du(t) {
|
|
|
6544
6544
|
return X(this, arguments, function* (n, o = 100) {
|
|
6545
6545
|
let s, l = 0;
|
|
6546
6546
|
for (; l < o; ) {
|
|
6547
|
-
const a = yield
|
|
6547
|
+
const a = yield U(n.listTools({ cursor: s }));
|
|
6548
6548
|
for (const u of a.tools)
|
|
6549
|
-
yield yield
|
|
6549
|
+
yield yield U(u), l++;
|
|
6550
6550
|
if (!a.nextCursor)
|
|
6551
6551
|
break;
|
|
6552
6552
|
s = a.nextCursor;
|
|
@@ -6874,49 +6874,49 @@ class Tu {
|
|
|
6874
6874
|
if (this.apiClient.isVertexAI())
|
|
6875
6875
|
f = `${c}/ws/google.cloud.aiplatform.${d}.LlmBidiService/BidiGenerateContent`, await this.auth.addAuthHeaders(h, f);
|
|
6876
6876
|
else {
|
|
6877
|
-
const
|
|
6878
|
-
let
|
|
6879
|
-
|
|
6877
|
+
const A = this.apiClient.getApiKey();
|
|
6878
|
+
let M = "BidiGenerateContent", L = "key";
|
|
6879
|
+
A != null && A.startsWith("auth_tokens/") && (console.warn("Warning: Ephemeral token support is experimental and may change in future versions."), d !== "v1alpha" && console.warn("Warning: The SDK's ephemeral token support is in v1alpha only. Please use const ai = new GoogleGenAI({apiKey: token.name, httpOptions: { apiVersion: 'v1alpha' }}); before session connection."), M = "BidiGenerateContentConstrained", L = "access_token"), f = `${c}/ws/google.ai.generativelanguage.${d}.GenerativeService.${M}?${L}=${A}`;
|
|
6880
6880
|
}
|
|
6881
6881
|
let m = () => {
|
|
6882
6882
|
};
|
|
6883
|
-
const y = new Promise((
|
|
6884
|
-
m =
|
|
6883
|
+
const y = new Promise((A) => {
|
|
6884
|
+
m = A;
|
|
6885
6885
|
}), _ = e.callbacks, T = function() {
|
|
6886
|
-
var
|
|
6887
|
-
(
|
|
6888
|
-
},
|
|
6886
|
+
var A;
|
|
6887
|
+
(A = _ == null ? void 0 : _.onopen) === null || A === void 0 || A.call(_), m({});
|
|
6888
|
+
}, v = this.apiClient, E = {
|
|
6889
6889
|
onopen: T,
|
|
6890
|
-
onmessage: (
|
|
6891
|
-
yu(
|
|
6890
|
+
onmessage: (A) => {
|
|
6891
|
+
yu(v, _.onmessage, A);
|
|
6892
6892
|
},
|
|
6893
|
-
onerror: (n = _ == null ? void 0 : _.onerror) !== null && n !== void 0 ? n : function(
|
|
6893
|
+
onerror: (n = _ == null ? void 0 : _.onerror) !== null && n !== void 0 ? n : function(A) {
|
|
6894
6894
|
},
|
|
6895
|
-
onclose: (o = _ == null ? void 0 : _.onclose) !== null && o !== void 0 ? o : function(
|
|
6895
|
+
onclose: (o = _ == null ? void 0 : _.onclose) !== null && o !== void 0 ? o : function(A) {
|
|
6896
6896
|
}
|
|
6897
6897
|
}, C = this.webSocketFactory.create(f, Cu(h), E);
|
|
6898
6898
|
C.connect(), await y;
|
|
6899
6899
|
let S = F(this.apiClient, e.model);
|
|
6900
6900
|
if (this.apiClient.isVertexAI() && S.startsWith("publishers/")) {
|
|
6901
|
-
const
|
|
6902
|
-
S = `projects/${
|
|
6901
|
+
const A = this.apiClient.getProject(), M = this.apiClient.getLocation();
|
|
6902
|
+
S = `projects/${A}/locations/${M}/` + S;
|
|
6903
6903
|
}
|
|
6904
|
-
let
|
|
6904
|
+
let R = {};
|
|
6905
6905
|
this.apiClient.isVertexAI() && ((s = e.config) === null || s === void 0 ? void 0 : s.responseModalities) === void 0 && (e.config === void 0 ? e.config = { responseModalities: [Ne.AUDIO] } : e.config.responseModalities = [Ne.AUDIO]), !((l = e.config) === null || l === void 0) && l.generationConfig && console.warn("Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025).");
|
|
6906
|
-
const
|
|
6907
|
-
for (const
|
|
6908
|
-
if (this.isCallableTool(
|
|
6909
|
-
const
|
|
6910
|
-
|
|
6906
|
+
const P = (u = (a = e.config) === null || a === void 0 ? void 0 : a.tools) !== null && u !== void 0 ? u : [], I = [];
|
|
6907
|
+
for (const A of P)
|
|
6908
|
+
if (this.isCallableTool(A)) {
|
|
6909
|
+
const M = A;
|
|
6910
|
+
I.push(await M.tool());
|
|
6911
6911
|
} else
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
const
|
|
6912
|
+
I.push(A);
|
|
6913
|
+
I.length > 0 && (e.config.tools = I);
|
|
6914
|
+
const N = {
|
|
6915
6915
|
model: S,
|
|
6916
6916
|
config: e.config,
|
|
6917
6917
|
callbacks: e.callbacks
|
|
6918
6918
|
};
|
|
6919
|
-
return this.apiClient.isVertexAI() ?
|
|
6919
|
+
return this.apiClient.isVertexAI() ? R = Fr(this.apiClient, N) : R = Lr(this.apiClient, N), delete R.config, C.send(JSON.stringify(R)), new Eu(C, this.apiClient);
|
|
6920
6920
|
}
|
|
6921
6921
|
// TODO: b/416041229 - Abstract this method to a common place.
|
|
6922
6922
|
isCallableTool(e) {
|
|
@@ -7169,9 +7169,9 @@ class Su extends te {
|
|
|
7169
7169
|
let y = 0;
|
|
7170
7170
|
for (; y < m && (f = await this.generateContentInternal(c), !(!f.functionCalls || f.functionCalls.length === 0)); ) {
|
|
7171
7171
|
const _ = f.candidates[0].content, T = [];
|
|
7172
|
-
for (const
|
|
7173
|
-
if (pe(
|
|
7174
|
-
const C = await
|
|
7172
|
+
for (const v of (u = (a = n.config) === null || a === void 0 ? void 0 : a.tools) !== null && u !== void 0 ? u : [])
|
|
7173
|
+
if (pe(v)) {
|
|
7174
|
+
const C = await v.callTool(f.functionCalls);
|
|
7175
7175
|
T.push(...C);
|
|
7176
7176
|
}
|
|
7177
7177
|
y++, p = {
|
|
@@ -7314,53 +7314,53 @@ class Su extends te {
|
|
|
7314
7314
|
const c = await this.initAfcToolsMap(e);
|
|
7315
7315
|
return function(d, f, p) {
|
|
7316
7316
|
return X(this, arguments, function* () {
|
|
7317
|
-
for (var h, m, y, _, T,
|
|
7317
|
+
for (var h, m, y, _, T, v; u < l; ) {
|
|
7318
7318
|
a && (u++, a = !1);
|
|
7319
|
-
const
|
|
7319
|
+
const R = yield U(d.processParamsMaybeAddMcpUsage(p)), P = yield U(d.generateContentStreamInternal(R)), I = [], N = [];
|
|
7320
7320
|
try {
|
|
7321
|
-
for (var E = !0, C = (m = void 0, Q(
|
|
7321
|
+
for (var E = !0, C = (m = void 0, Q(P)), S; S = yield U(C.next()), h = S.done, !h; E = !0) {
|
|
7322
7322
|
_ = S.value, E = !1;
|
|
7323
|
-
const
|
|
7324
|
-
if (yield yield
|
|
7325
|
-
|
|
7326
|
-
for (const
|
|
7327
|
-
if (u < l &&
|
|
7328
|
-
if (!
|
|
7323
|
+
const A = _;
|
|
7324
|
+
if (yield yield U(A), A.candidates && (!((T = A.candidates[0]) === null || T === void 0) && T.content)) {
|
|
7325
|
+
N.push(A.candidates[0].content);
|
|
7326
|
+
for (const M of (v = A.candidates[0].content.parts) !== null && v !== void 0 ? v : [])
|
|
7327
|
+
if (u < l && M.functionCall) {
|
|
7328
|
+
if (!M.functionCall.name)
|
|
7329
7329
|
throw new Error("Function call name was not returned by the model.");
|
|
7330
|
-
if (f.has(
|
|
7331
|
-
const L = yield
|
|
7332
|
-
|
|
7330
|
+
if (f.has(M.functionCall.name)) {
|
|
7331
|
+
const L = yield U(f.get(M.functionCall.name).callTool([M.functionCall]));
|
|
7332
|
+
I.push(...L);
|
|
7333
7333
|
} else
|
|
7334
|
-
throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${f.keys()}, mising tool: ${
|
|
7334
|
+
throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${f.keys()}, mising tool: ${M.functionCall.name}`);
|
|
7335
7335
|
}
|
|
7336
7336
|
}
|
|
7337
7337
|
}
|
|
7338
|
-
} catch (
|
|
7339
|
-
m = { error:
|
|
7338
|
+
} catch (A) {
|
|
7339
|
+
m = { error: A };
|
|
7340
7340
|
} finally {
|
|
7341
7341
|
try {
|
|
7342
|
-
!E && !h && (y = C.return) && (yield
|
|
7342
|
+
!E && !h && (y = C.return) && (yield U(y.call(C)));
|
|
7343
7343
|
} finally {
|
|
7344
7344
|
if (m) throw m.error;
|
|
7345
7345
|
}
|
|
7346
7346
|
}
|
|
7347
|
-
if (
|
|
7347
|
+
if (I.length > 0) {
|
|
7348
7348
|
a = !0;
|
|
7349
|
-
const
|
|
7350
|
-
|
|
7349
|
+
const A = new _e();
|
|
7350
|
+
A.candidates = [
|
|
7351
7351
|
{
|
|
7352
7352
|
content: {
|
|
7353
7353
|
role: "user",
|
|
7354
|
-
parts:
|
|
7354
|
+
parts: I
|
|
7355
7355
|
}
|
|
7356
7356
|
}
|
|
7357
|
-
], yield yield
|
|
7358
|
-
const
|
|
7359
|
-
|
|
7357
|
+
], yield yield U(A);
|
|
7358
|
+
const M = [];
|
|
7359
|
+
M.push(...N), M.push({
|
|
7360
7360
|
role: "user",
|
|
7361
|
-
parts:
|
|
7361
|
+
parts: I
|
|
7362
7362
|
});
|
|
7363
|
-
const L = z(p.contents).concat(
|
|
7363
|
+
const L = z(p.contents).concat(M);
|
|
7364
7364
|
p.contents = L;
|
|
7365
7365
|
} else
|
|
7366
7366
|
break;
|
|
@@ -7373,7 +7373,7 @@ class Su extends te {
|
|
|
7373
7373
|
let a, u = "", c = {};
|
|
7374
7374
|
if (this.apiClient.isVertexAI()) {
|
|
7375
7375
|
const d = Fn(this.apiClient, e);
|
|
7376
|
-
return u =
|
|
7376
|
+
return u = x("{model}:generateContent", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7377
7377
|
path: u,
|
|
7378
7378
|
queryParams: c,
|
|
7379
7379
|
body: JSON.stringify(d),
|
|
@@ -7391,7 +7391,7 @@ class Su extends te {
|
|
|
7391
7391
|
});
|
|
7392
7392
|
} else {
|
|
7393
7393
|
const d = Ln(this.apiClient, e);
|
|
7394
|
-
return u =
|
|
7394
|
+
return u = x("{model}:generateContent", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7395
7395
|
path: u,
|
|
7396
7396
|
queryParams: c,
|
|
7397
7397
|
body: JSON.stringify(d),
|
|
@@ -7414,7 +7414,7 @@ class Su extends te {
|
|
|
7414
7414
|
let a, u = "", c = {};
|
|
7415
7415
|
if (this.apiClient.isVertexAI()) {
|
|
7416
7416
|
const d = Fn(this.apiClient, e);
|
|
7417
|
-
return u =
|
|
7417
|
+
return u = x("{model}:streamGenerateContent?alt=sse", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.requestStream({
|
|
7418
7418
|
path: u,
|
|
7419
7419
|
queryParams: c,
|
|
7420
7420
|
body: JSON.stringify(d),
|
|
@@ -7425,20 +7425,20 @@ class Su extends te {
|
|
|
7425
7425
|
return X(this, arguments, function* () {
|
|
7426
7426
|
var h, m, y, _;
|
|
7427
7427
|
try {
|
|
7428
|
-
for (var T = !0,
|
|
7428
|
+
for (var T = !0, v = Q(p), E; E = yield U(v.next()), h = E.done, !h; T = !0) {
|
|
7429
7429
|
_ = E.value, T = !1;
|
|
7430
|
-
const C = _, S = Vn(yield
|
|
7430
|
+
const C = _, S = Vn(yield U(C.json()));
|
|
7431
7431
|
S.sdkHttpResponse = {
|
|
7432
7432
|
headers: C.headers
|
|
7433
7433
|
};
|
|
7434
|
-
const
|
|
7435
|
-
Object.assign(
|
|
7434
|
+
const R = new _e();
|
|
7435
|
+
Object.assign(R, S), yield yield U(R);
|
|
7436
7436
|
}
|
|
7437
7437
|
} catch (C) {
|
|
7438
7438
|
m = { error: C };
|
|
7439
7439
|
} finally {
|
|
7440
7440
|
try {
|
|
7441
|
-
!T && !h && (y =
|
|
7441
|
+
!T && !h && (y = v.return) && (yield U(y.call(v)));
|
|
7442
7442
|
} finally {
|
|
7443
7443
|
if (m) throw m.error;
|
|
7444
7444
|
}
|
|
@@ -7447,7 +7447,7 @@ class Su extends te {
|
|
|
7447
7447
|
});
|
|
7448
7448
|
} else {
|
|
7449
7449
|
const d = Ln(this.apiClient, e);
|
|
7450
|
-
return u =
|
|
7450
|
+
return u = x("{model}:streamGenerateContent?alt=sse", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.requestStream({
|
|
7451
7451
|
path: u,
|
|
7452
7452
|
queryParams: c,
|
|
7453
7453
|
body: JSON.stringify(d),
|
|
@@ -7458,20 +7458,20 @@ class Su extends te {
|
|
|
7458
7458
|
return X(this, arguments, function* () {
|
|
7459
7459
|
var h, m, y, _;
|
|
7460
7460
|
try {
|
|
7461
|
-
for (var T = !0,
|
|
7461
|
+
for (var T = !0, v = Q(p), E; E = yield U(v.next()), h = E.done, !h; T = !0) {
|
|
7462
7462
|
_ = E.value, T = !1;
|
|
7463
|
-
const C = _, S = Gn(yield
|
|
7463
|
+
const C = _, S = Gn(yield U(C.json()));
|
|
7464
7464
|
S.sdkHttpResponse = {
|
|
7465
7465
|
headers: C.headers
|
|
7466
7466
|
};
|
|
7467
|
-
const
|
|
7468
|
-
Object.assign(
|
|
7467
|
+
const R = new _e();
|
|
7468
|
+
Object.assign(R, S), yield yield U(R);
|
|
7469
7469
|
}
|
|
7470
7470
|
} catch (C) {
|
|
7471
7471
|
m = { error: C };
|
|
7472
7472
|
} finally {
|
|
7473
7473
|
try {
|
|
7474
|
-
!T && !h && (y =
|
|
7474
|
+
!T && !h && (y = v.return) && (yield U(y.call(v)));
|
|
7475
7475
|
} finally {
|
|
7476
7476
|
if (m) throw m.error;
|
|
7477
7477
|
}
|
|
@@ -7506,7 +7506,7 @@ class Su extends te {
|
|
|
7506
7506
|
let a, u = "", c = {};
|
|
7507
7507
|
if (this.apiClient.isVertexAI()) {
|
|
7508
7508
|
const d = Tl(this.apiClient, e);
|
|
7509
|
-
return u =
|
|
7509
|
+
return u = x("{model}:predict", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7510
7510
|
path: u,
|
|
7511
7511
|
queryParams: c,
|
|
7512
7512
|
body: JSON.stringify(d),
|
|
@@ -7524,7 +7524,7 @@ class Su extends te {
|
|
|
7524
7524
|
});
|
|
7525
7525
|
} else {
|
|
7526
7526
|
const d = yl(this.apiClient, e);
|
|
7527
|
-
return u =
|
|
7527
|
+
return u = x("{model}:batchEmbedContents", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7528
7528
|
path: u,
|
|
7529
7529
|
queryParams: c,
|
|
7530
7530
|
body: JSON.stringify(d),
|
|
@@ -7550,7 +7550,7 @@ class Su extends te {
|
|
|
7550
7550
|
let a, u = "", c = {};
|
|
7551
7551
|
if (this.apiClient.isVertexAI()) {
|
|
7552
7552
|
const d = Pl(this.apiClient, e);
|
|
7553
|
-
return u =
|
|
7553
|
+
return u = x("{model}:predict", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7554
7554
|
path: u,
|
|
7555
7555
|
queryParams: c,
|
|
7556
7556
|
body: JSON.stringify(d),
|
|
@@ -7568,7 +7568,7 @@ class Su extends te {
|
|
|
7568
7568
|
});
|
|
7569
7569
|
} else {
|
|
7570
7570
|
const d = Ml(this.apiClient, e);
|
|
7571
|
-
return u =
|
|
7571
|
+
return u = x("{model}:predict", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7572
7572
|
path: u,
|
|
7573
7573
|
queryParams: c,
|
|
7574
7574
|
body: JSON.stringify(d),
|
|
@@ -7594,7 +7594,7 @@ class Su extends te {
|
|
|
7594
7594
|
let s, l = "", a = {};
|
|
7595
7595
|
if (this.apiClient.isVertexAI()) {
|
|
7596
7596
|
const u = pl(this.apiClient, e);
|
|
7597
|
-
return l =
|
|
7597
|
+
return l = x("{model}:predict", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
7598
7598
|
path: l,
|
|
7599
7599
|
queryParams: a,
|
|
7600
7600
|
body: JSON.stringify(u),
|
|
@@ -7621,7 +7621,7 @@ class Su extends te {
|
|
|
7621
7621
|
let s, l = "", a = {};
|
|
7622
7622
|
if (this.apiClient.isVertexAI()) {
|
|
7623
7623
|
const u = Pa(this.apiClient, e);
|
|
7624
|
-
return l =
|
|
7624
|
+
return l = x("{model}:predict", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
7625
7625
|
path: l,
|
|
7626
7626
|
queryParams: a,
|
|
7627
7627
|
body: JSON.stringify(u),
|
|
@@ -7683,7 +7683,7 @@ class Su extends te {
|
|
|
7683
7683
|
let s, l = "", a = {};
|
|
7684
7684
|
if (this.apiClient.isVertexAI()) {
|
|
7685
7685
|
const u = fa(this.apiClient, e);
|
|
7686
|
-
return l =
|
|
7686
|
+
return l = x("{model}:predict", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
7687
7687
|
path: l,
|
|
7688
7688
|
queryParams: a,
|
|
7689
7689
|
body: JSON.stringify(u),
|
|
@@ -7722,7 +7722,7 @@ class Su extends te {
|
|
|
7722
7722
|
let s, l = "", a = {};
|
|
7723
7723
|
if (this.apiClient.isVertexAI()) {
|
|
7724
7724
|
const u = _a(this.apiClient, e);
|
|
7725
|
-
return l =
|
|
7725
|
+
return l = x("{model}:predict", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
7726
7726
|
path: l,
|
|
7727
7727
|
queryParams: a,
|
|
7728
7728
|
body: JSON.stringify(u),
|
|
@@ -7749,7 +7749,7 @@ class Su extends te {
|
|
|
7749
7749
|
let a, u = "", c = {};
|
|
7750
7750
|
if (this.apiClient.isVertexAI()) {
|
|
7751
7751
|
const d = Xl(this.apiClient, e);
|
|
7752
|
-
return u =
|
|
7752
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7753
7753
|
path: u,
|
|
7754
7754
|
queryParams: c,
|
|
7755
7755
|
body: JSON.stringify(d),
|
|
@@ -7759,7 +7759,7 @@ class Su extends te {
|
|
|
7759
7759
|
}).then((f) => f.json()), a.then((f) => je(f));
|
|
7760
7760
|
} else {
|
|
7761
7761
|
const d = Ol(this.apiClient, e);
|
|
7762
|
-
return u =
|
|
7762
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7763
7763
|
path: u,
|
|
7764
7764
|
queryParams: c,
|
|
7765
7765
|
body: JSON.stringify(d),
|
|
@@ -7774,7 +7774,7 @@ class Su extends te {
|
|
|
7774
7774
|
let a, u = "", c = {};
|
|
7775
7775
|
if (this.apiClient.isVertexAI()) {
|
|
7776
7776
|
const d = sa(this.apiClient, e);
|
|
7777
|
-
return u =
|
|
7777
|
+
return u = x("{models_url}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7778
7778
|
path: u,
|
|
7779
7779
|
queryParams: c,
|
|
7780
7780
|
body: JSON.stringify(d),
|
|
@@ -7792,7 +7792,7 @@ class Su extends te {
|
|
|
7792
7792
|
});
|
|
7793
7793
|
} else {
|
|
7794
7794
|
const d = ia(this.apiClient, e);
|
|
7795
|
-
return u =
|
|
7795
|
+
return u = x("{models_url}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7796
7796
|
path: u,
|
|
7797
7797
|
queryParams: c,
|
|
7798
7798
|
body: JSON.stringify(d),
|
|
@@ -7832,7 +7832,7 @@ class Su extends te {
|
|
|
7832
7832
|
let a, u = "", c = {};
|
|
7833
7833
|
if (this.apiClient.isVertexAI()) {
|
|
7834
7834
|
const d = Na(this.apiClient, e);
|
|
7835
|
-
return u =
|
|
7835
|
+
return u = x("{model}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7836
7836
|
path: u,
|
|
7837
7837
|
queryParams: c,
|
|
7838
7838
|
body: JSON.stringify(d),
|
|
@@ -7842,7 +7842,7 @@ class Su extends te {
|
|
|
7842
7842
|
}).then((f) => f.json()), a.then((f) => je(f));
|
|
7843
7843
|
} else {
|
|
7844
7844
|
const d = Ra(this.apiClient, e);
|
|
7845
|
-
return u =
|
|
7845
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7846
7846
|
path: u,
|
|
7847
7847
|
queryParams: c,
|
|
7848
7848
|
body: JSON.stringify(d),
|
|
@@ -7868,7 +7868,7 @@ class Su extends te {
|
|
|
7868
7868
|
let a, u = "", c = {};
|
|
7869
7869
|
if (this.apiClient.isVertexAI()) {
|
|
7870
7870
|
const d = ul(this.apiClient, e);
|
|
7871
|
-
return u =
|
|
7871
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7872
7872
|
path: u,
|
|
7873
7873
|
queryParams: c,
|
|
7874
7874
|
body: JSON.stringify(d),
|
|
@@ -7886,7 +7886,7 @@ class Su extends te {
|
|
|
7886
7886
|
});
|
|
7887
7887
|
} else {
|
|
7888
7888
|
const d = al(this.apiClient, e);
|
|
7889
|
-
return u =
|
|
7889
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7890
7890
|
path: u,
|
|
7891
7891
|
queryParams: c,
|
|
7892
7892
|
body: JSON.stringify(d),
|
|
@@ -7925,7 +7925,7 @@ class Su extends te {
|
|
|
7925
7925
|
let a, u = "", c = {};
|
|
7926
7926
|
if (this.apiClient.isVertexAI()) {
|
|
7927
7927
|
const d = sl(this.apiClient, e);
|
|
7928
|
-
return u =
|
|
7928
|
+
return u = x("{model}:countTokens", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7929
7929
|
path: u,
|
|
7930
7930
|
queryParams: c,
|
|
7931
7931
|
body: JSON.stringify(d),
|
|
@@ -7943,7 +7943,7 @@ class Su extends te {
|
|
|
7943
7943
|
});
|
|
7944
7944
|
} else {
|
|
7945
7945
|
const d = il(this.apiClient, e);
|
|
7946
|
-
return u =
|
|
7946
|
+
return u = x("{model}:countTokens", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
7947
7947
|
path: u,
|
|
7948
7948
|
queryParams: c,
|
|
7949
7949
|
body: JSON.stringify(d),
|
|
@@ -7984,7 +7984,7 @@ class Su extends te {
|
|
|
7984
7984
|
let s, l = "", a = {};
|
|
7985
7985
|
if (this.apiClient.isVertexAI()) {
|
|
7986
7986
|
const u = Qr(this.apiClient, e);
|
|
7987
|
-
return l =
|
|
7987
|
+
return l = x("{model}:computeTokens", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
7988
7988
|
path: l,
|
|
7989
7989
|
queryParams: a,
|
|
7990
7990
|
body: JSON.stringify(u),
|
|
@@ -8011,7 +8011,7 @@ class Su extends te {
|
|
|
8011
8011
|
let a, u = "", c = {};
|
|
8012
8012
|
if (this.apiClient.isVertexAI()) {
|
|
8013
8013
|
const d = Vl(this.apiClient, e);
|
|
8014
|
-
return u =
|
|
8014
|
+
return u = x("{model}:predictLongRunning", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
8015
8015
|
path: u,
|
|
8016
8016
|
queryParams: c,
|
|
8017
8017
|
body: JSON.stringify(d),
|
|
@@ -8024,7 +8024,7 @@ class Su extends te {
|
|
|
8024
8024
|
});
|
|
8025
8025
|
} else {
|
|
8026
8026
|
const d = Gl(this.apiClient, e);
|
|
8027
|
-
return u =
|
|
8027
|
+
return u = x("{model}:predictLongRunning", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
8028
8028
|
path: u,
|
|
8029
8029
|
queryParams: c,
|
|
8030
8030
|
body: JSON.stringify(d),
|
|
@@ -8120,7 +8120,7 @@ class Au extends te {
|
|
|
8120
8120
|
let a, u = "", c = {};
|
|
8121
8121
|
if (this.apiClient.isVertexAI()) {
|
|
8122
8122
|
const d = gi(e);
|
|
8123
|
-
return u =
|
|
8123
|
+
return u = x("{operationName}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
8124
8124
|
path: u,
|
|
8125
8125
|
queryParams: c,
|
|
8126
8126
|
body: JSON.stringify(d),
|
|
@@ -8130,7 +8130,7 @@ class Au extends te {
|
|
|
8130
8130
|
}).then((f) => f.json()), a;
|
|
8131
8131
|
} else {
|
|
8132
8132
|
const d = mi(e);
|
|
8133
|
-
return u =
|
|
8133
|
+
return u = x("{operationName}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
8134
8134
|
path: u,
|
|
8135
8135
|
queryParams: c,
|
|
8136
8136
|
body: JSON.stringify(d),
|
|
@@ -8145,7 +8145,7 @@ class Au extends te {
|
|
|
8145
8145
|
let s, l = "", a = {};
|
|
8146
8146
|
if (this.apiClient.isVertexAI()) {
|
|
8147
8147
|
const u = ai(e);
|
|
8148
|
-
return l =
|
|
8148
|
+
return l = x("{resourceName}:fetchPredictOperation", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
8149
8149
|
path: l,
|
|
8150
8150
|
queryParams: a,
|
|
8151
8151
|
body: JSON.stringify(u),
|
|
@@ -8280,17 +8280,17 @@ function Uu(t, e) {
|
|
|
8280
8280
|
e !== void 0 && y != null && r(e, ["setup", "systemInstruction"], wu(J(y)));
|
|
8281
8281
|
const _ = i(t, ["tools"]);
|
|
8282
8282
|
if (e !== void 0 && _ != null) {
|
|
8283
|
-
let
|
|
8284
|
-
Array.isArray(
|
|
8283
|
+
let P = ge(_);
|
|
8284
|
+
Array.isArray(P) && (P = P.map((I) => Gu(me(I)))), r(e, ["setup", "tools"], P);
|
|
8285
8285
|
}
|
|
8286
8286
|
const T = i(t, [
|
|
8287
8287
|
"sessionResumption"
|
|
8288
8288
|
]);
|
|
8289
8289
|
e !== void 0 && T != null && r(e, ["setup", "sessionResumption"], Fu(T));
|
|
8290
|
-
const
|
|
8290
|
+
const v = i(t, [
|
|
8291
8291
|
"inputAudioTranscription"
|
|
8292
8292
|
]);
|
|
8293
|
-
e !== void 0 &&
|
|
8293
|
+
e !== void 0 && v != null && r(e, ["setup", "inputAudioTranscription"], v);
|
|
8294
8294
|
const E = i(t, [
|
|
8295
8295
|
"outputAudioTranscription"
|
|
8296
8296
|
]);
|
|
@@ -8303,8 +8303,8 @@ function Uu(t, e) {
|
|
|
8303
8303
|
"contextWindowCompression"
|
|
8304
8304
|
]);
|
|
8305
8305
|
e !== void 0 && S != null && r(e, ["setup", "contextWindowCompression"], S);
|
|
8306
|
-
const
|
|
8307
|
-
if (e !== void 0 &&
|
|
8306
|
+
const R = i(t, ["proactivity"]);
|
|
8307
|
+
if (e !== void 0 && R != null && r(e, ["setup", "proactivity"], R), i(t, ["explicitVadSignal"]) !== void 0)
|
|
8308
8308
|
throw new Error("explicitVadSignal parameter is not supported in Gemini API.");
|
|
8309
8309
|
return n;
|
|
8310
8310
|
}
|
|
@@ -8530,7 +8530,7 @@ class Hu extends te {
|
|
|
8530
8530
|
throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");
|
|
8531
8531
|
{
|
|
8532
8532
|
const u = Nu(this.apiClient, e);
|
|
8533
|
-
l =
|
|
8533
|
+
l = x("auth_tokens", u._url), a = u._query, delete u.config, delete u._url, delete u._query;
|
|
8534
8534
|
const c = qu(u, e.config);
|
|
8535
8535
|
return s = this.apiClient.request({
|
|
8536
8536
|
path: l,
|
|
@@ -8612,7 +8612,7 @@ class zu extends te {
|
|
|
8612
8612
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
8613
8613
|
{
|
|
8614
8614
|
const u = $u(e);
|
|
8615
|
-
return l =
|
|
8615
|
+
return l = x("{name}", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
8616
8616
|
path: l,
|
|
8617
8617
|
queryParams: a,
|
|
8618
8618
|
body: JSON.stringify(u),
|
|
@@ -8634,7 +8634,7 @@ class zu extends te {
|
|
|
8634
8634
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
8635
8635
|
{
|
|
8636
8636
|
const a = Ju(e);
|
|
8637
|
-
s =
|
|
8637
|
+
s = x("{name}", a._url), l = a._query, delete a._url, delete a._query, await this.apiClient.request({
|
|
8638
8638
|
path: s,
|
|
8639
8639
|
queryParams: l,
|
|
8640
8640
|
body: JSON.stringify(a),
|
|
@@ -8651,7 +8651,7 @@ class zu extends te {
|
|
|
8651
8651
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
8652
8652
|
{
|
|
8653
8653
|
const u = Yu(e);
|
|
8654
|
-
return l =
|
|
8654
|
+
return l = x("{parent}/documents", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
8655
8655
|
path: l,
|
|
8656
8656
|
queryParams: a,
|
|
8657
8657
|
body: JSON.stringify(u),
|
|
@@ -8728,7 +8728,7 @@ class Ou extends te {
|
|
|
8728
8728
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
8729
8729
|
{
|
|
8730
8730
|
const u = Va(e);
|
|
8731
|
-
return l =
|
|
8731
|
+
return l = x("fileSearchStores", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
8732
8732
|
path: l,
|
|
8733
8733
|
queryParams: a,
|
|
8734
8734
|
body: JSON.stringify(u),
|
|
@@ -8751,7 +8751,7 @@ class Ou extends te {
|
|
|
8751
8751
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
8752
8752
|
{
|
|
8753
8753
|
const u = Ba(e);
|
|
8754
|
-
return l =
|
|
8754
|
+
return l = x("{name}", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
8755
8755
|
path: l,
|
|
8756
8756
|
queryParams: a,
|
|
8757
8757
|
body: JSON.stringify(u),
|
|
@@ -8773,7 +8773,7 @@ class Ou extends te {
|
|
|
8773
8773
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
8774
8774
|
{
|
|
8775
8775
|
const a = Ha(e);
|
|
8776
|
-
s =
|
|
8776
|
+
s = x("{name}", a._url), l = a._query, delete a._url, delete a._query, await this.apiClient.request({
|
|
8777
8777
|
path: s,
|
|
8778
8778
|
queryParams: l,
|
|
8779
8779
|
body: JSON.stringify(a),
|
|
@@ -8790,7 +8790,7 @@ class Ou extends te {
|
|
|
8790
8790
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
8791
8791
|
{
|
|
8792
8792
|
const u = za(e);
|
|
8793
|
-
return l =
|
|
8793
|
+
return l = x("fileSearchStores", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
8794
8794
|
path: l,
|
|
8795
8795
|
queryParams: a,
|
|
8796
8796
|
body: JSON.stringify(u),
|
|
@@ -8810,7 +8810,7 @@ class Ou extends te {
|
|
|
8810
8810
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
8811
8811
|
{
|
|
8812
8812
|
const u = Xa(e);
|
|
8813
|
-
return l =
|
|
8813
|
+
return l = x("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
8814
8814
|
path: l,
|
|
8815
8815
|
queryParams: a,
|
|
8816
8816
|
body: JSON.stringify(u),
|
|
@@ -8838,7 +8838,7 @@ class Ou extends te {
|
|
|
8838
8838
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
8839
8839
|
{
|
|
8840
8840
|
const u = Wa(e);
|
|
8841
|
-
return l =
|
|
8841
|
+
return l = x("{file_search_store_name}:importFile", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
8842
8842
|
path: l,
|
|
8843
8843
|
queryParams: a,
|
|
8844
8844
|
body: JSON.stringify(u),
|
|
@@ -9243,13 +9243,13 @@ const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null)), E
|
|
|
9243
9243
|
var m, y, _;
|
|
9244
9244
|
/[?#]/.test(p) && (s = !0);
|
|
9245
9245
|
const T = o[h];
|
|
9246
|
-
let
|
|
9246
|
+
let v = (s ? encodeURIComponent : t)("" + T);
|
|
9247
9247
|
return h !== o.length && (T == null || typeof T == "object" && // handle values from other realms
|
|
9248
|
-
T.toString === ((_ = Object.getPrototypeOf((y = Object.getPrototypeOf((m = T.hasOwnProperty) !== null && m !== void 0 ? m : zn)) !== null && y !== void 0 ? y : zn)) === null || _ === void 0 ? void 0 : _.toString)) && (
|
|
9248
|
+
T.toString === ((_ = Object.getPrototypeOf((y = Object.getPrototypeOf((m = T.hasOwnProperty) !== null && m !== void 0 ? m : zn)) !== null && y !== void 0 ? y : zn)) === null || _ === void 0 ? void 0 : _.toString)) && (v = T + "", l.push({
|
|
9249
9249
|
start: f.length + p.length,
|
|
9250
|
-
length:
|
|
9250
|
+
length: v.length,
|
|
9251
9251
|
error: `Value of type ${Object.prototype.toString.call(T).slice(8, -1)} is not a valid path parameter`
|
|
9252
|
-
})), f + p + (h === o.length ? "" :
|
|
9252
|
+
})), f + p + (h === o.length ? "" : v);
|
|
9253
9253
|
}, ""), u = a.split(/[?#]/, 1)[0], c = new RegExp("(?<=^|\\/)(?:\\.|%2e){1,2}(?=\\/|$)", "gi");
|
|
9254
9254
|
let d;
|
|
9255
9255
|
for (; (d = c.exec(u)) !== null; )
|
|
@@ -9472,7 +9472,7 @@ class ce {
|
|
|
9472
9472
|
let h = !1;
|
|
9473
9473
|
try {
|
|
9474
9474
|
try {
|
|
9475
|
-
for (var m = !0, y = Q(Ad(e, n)), _; _ = yield
|
|
9475
|
+
for (var m = !0, y = Q(Ad(e, n)), _; _ = yield U(y.next()), c = _.done, !c; m = !0) {
|
|
9476
9476
|
p = _.value, m = !1;
|
|
9477
9477
|
const T = p;
|
|
9478
9478
|
if (!h)
|
|
@@ -9481,16 +9481,16 @@ class ce {
|
|
|
9481
9481
|
continue;
|
|
9482
9482
|
} else
|
|
9483
9483
|
try {
|
|
9484
|
-
yield yield
|
|
9485
|
-
} catch (
|
|
9486
|
-
throw l.error("Could not parse message into JSON:", T.data), l.error("From chunk:", T.raw),
|
|
9484
|
+
yield yield U(JSON.parse(T.data));
|
|
9485
|
+
} catch (v) {
|
|
9486
|
+
throw l.error("Could not parse message into JSON:", T.data), l.error("From chunk:", T.raw), v;
|
|
9487
9487
|
}
|
|
9488
9488
|
}
|
|
9489
9489
|
} catch (T) {
|
|
9490
9490
|
d = { error: T };
|
|
9491
9491
|
} finally {
|
|
9492
9492
|
try {
|
|
9493
|
-
!m && !c && (f = y.return) && (yield
|
|
9493
|
+
!m && !c && (f = y.return) && (yield U(f.call(y)));
|
|
9494
9494
|
} finally {
|
|
9495
9495
|
if (d) throw d.error;
|
|
9496
9496
|
}
|
|
@@ -9498,7 +9498,7 @@ class ce {
|
|
|
9498
9498
|
h = !0;
|
|
9499
9499
|
} catch (T) {
|
|
9500
9500
|
if (tt(T))
|
|
9501
|
-
return yield
|
|
9501
|
+
return yield U(void 0);
|
|
9502
9502
|
throw T;
|
|
9503
9503
|
} finally {
|
|
9504
9504
|
h || n.abort();
|
|
@@ -9518,23 +9518,23 @@ class ce {
|
|
|
9518
9518
|
var c, d, f, p;
|
|
9519
9519
|
const h = new He(), m = Bo(e);
|
|
9520
9520
|
try {
|
|
9521
|
-
for (var y = !0, _ = Q(m), T; T = yield
|
|
9521
|
+
for (var y = !0, _ = Q(m), T; T = yield U(_.next()), c = T.done, !c; y = !0) {
|
|
9522
9522
|
p = T.value, y = !1;
|
|
9523
|
-
const
|
|
9524
|
-
for (const E of h.decode(
|
|
9525
|
-
yield yield
|
|
9523
|
+
const v = p;
|
|
9524
|
+
for (const E of h.decode(v))
|
|
9525
|
+
yield yield U(E);
|
|
9526
9526
|
}
|
|
9527
|
-
} catch (
|
|
9528
|
-
d = { error:
|
|
9527
|
+
} catch (v) {
|
|
9528
|
+
d = { error: v };
|
|
9529
9529
|
} finally {
|
|
9530
9530
|
try {
|
|
9531
|
-
!y && !c && (f = _.return) && (yield
|
|
9531
|
+
!y && !c && (f = _.return) && (yield U(f.call(_)));
|
|
9532
9532
|
} finally {
|
|
9533
9533
|
if (d) throw d.error;
|
|
9534
9534
|
}
|
|
9535
9535
|
}
|
|
9536
|
-
for (const
|
|
9537
|
-
yield yield
|
|
9536
|
+
for (const v of h.flush())
|
|
9537
|
+
yield yield U(v);
|
|
9538
9538
|
});
|
|
9539
9539
|
}
|
|
9540
9540
|
function a() {
|
|
@@ -9546,16 +9546,16 @@ class ce {
|
|
|
9546
9546
|
let h = !1;
|
|
9547
9547
|
try {
|
|
9548
9548
|
try {
|
|
9549
|
-
for (var m = !0, y = Q(l()), _; _ = yield
|
|
9549
|
+
for (var m = !0, y = Q(l()), _; _ = yield U(y.next()), c = _.done, !c; m = !0) {
|
|
9550
9550
|
p = _.value, m = !1;
|
|
9551
9551
|
const T = p;
|
|
9552
|
-
h || T && (yield yield
|
|
9552
|
+
h || T && (yield yield U(JSON.parse(T)));
|
|
9553
9553
|
}
|
|
9554
9554
|
} catch (T) {
|
|
9555
9555
|
d = { error: T };
|
|
9556
9556
|
} finally {
|
|
9557
9557
|
try {
|
|
9558
|
-
!m && !c && (f = y.return) && (yield
|
|
9558
|
+
!m && !c && (f = y.return) && (yield U(f.call(y)));
|
|
9559
9559
|
} finally {
|
|
9560
9560
|
if (d) throw d.error;
|
|
9561
9561
|
}
|
|
@@ -9563,7 +9563,7 @@ class ce {
|
|
|
9563
9563
|
h = !0;
|
|
9564
9564
|
} catch (T) {
|
|
9565
9565
|
if (tt(T))
|
|
9566
|
-
return yield
|
|
9566
|
+
return yield U(void 0);
|
|
9567
9567
|
throw T;
|
|
9568
9568
|
} finally {
|
|
9569
9569
|
h || n.abort();
|
|
@@ -9632,26 +9632,26 @@ function Ad(t, e) {
|
|
|
9632
9632
|
throw e.abort(), typeof globalThis.navigator < "u" && globalThis.navigator.product === "ReactNative" ? new O("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api") : new O("Attempted to iterate over a response with no body");
|
|
9633
9633
|
const u = new wd(), c = new He(), d = Bo(t.body);
|
|
9634
9634
|
try {
|
|
9635
|
-
for (var f = !0, p = Q(xd(d)), h; h = yield
|
|
9635
|
+
for (var f = !0, p = Q(xd(d)), h; h = yield U(p.next()), o = h.done, !o; f = !0) {
|
|
9636
9636
|
a = h.value, f = !1;
|
|
9637
9637
|
const m = a;
|
|
9638
9638
|
for (const y of c.decode(m)) {
|
|
9639
9639
|
const _ = u.decode(y);
|
|
9640
|
-
_ && (yield yield
|
|
9640
|
+
_ && (yield yield U(_));
|
|
9641
9641
|
}
|
|
9642
9642
|
}
|
|
9643
9643
|
} catch (m) {
|
|
9644
9644
|
s = { error: m };
|
|
9645
9645
|
} finally {
|
|
9646
9646
|
try {
|
|
9647
|
-
!f && !o && (l = p.return) && (yield
|
|
9647
|
+
!f && !o && (l = p.return) && (yield U(l.call(p)));
|
|
9648
9648
|
} finally {
|
|
9649
9649
|
if (s) throw s.error;
|
|
9650
9650
|
}
|
|
9651
9651
|
}
|
|
9652
9652
|
for (const m of c.flush()) {
|
|
9653
9653
|
const y = u.decode(m);
|
|
9654
|
-
y && (yield yield
|
|
9654
|
+
y && (yield yield U(y));
|
|
9655
9655
|
}
|
|
9656
9656
|
});
|
|
9657
9657
|
}
|
|
@@ -9660,7 +9660,7 @@ function xd(t) {
|
|
|
9660
9660
|
var n, o, s, l;
|
|
9661
9661
|
let a = new Uint8Array();
|
|
9662
9662
|
try {
|
|
9663
|
-
for (var u = !0, c = Q(t), d; d = yield
|
|
9663
|
+
for (var u = !0, c = Q(t), d; d = yield U(c.next()), n = d.done, !n; u = !0) {
|
|
9664
9664
|
l = d.value, u = !1;
|
|
9665
9665
|
const f = l;
|
|
9666
9666
|
if (f == null)
|
|
@@ -9670,18 +9670,18 @@ function xd(t) {
|
|
|
9670
9670
|
h.set(a), h.set(p, a.length), a = h;
|
|
9671
9671
|
let m;
|
|
9672
9672
|
for (; (m = Id(a)) !== -1; )
|
|
9673
|
-
yield yield
|
|
9673
|
+
yield yield U(a.slice(0, m)), a = a.slice(m);
|
|
9674
9674
|
}
|
|
9675
9675
|
} catch (f) {
|
|
9676
9676
|
o = { error: f };
|
|
9677
9677
|
} finally {
|
|
9678
9678
|
try {
|
|
9679
|
-
!u && !n && (s = c.return) && (yield
|
|
9679
|
+
!u && !n && (s = c.return) && (yield U(s.call(c)));
|
|
9680
9680
|
} finally {
|
|
9681
9681
|
if (o) throw o.error;
|
|
9682
9682
|
}
|
|
9683
9683
|
}
|
|
9684
|
-
a.length > 0 && (yield yield
|
|
9684
|
+
a.length > 0 && (yield yield U(a));
|
|
9685
9685
|
});
|
|
9686
9686
|
}
|
|
9687
9687
|
class wd {
|
|
@@ -9980,7 +9980,7 @@ class Be {
|
|
|
9980
9980
|
headers: d.headers
|
|
9981
9981
|
})), !((l = u.signal) === null || l === void 0) && l.aborted)
|
|
9982
9982
|
throw new ot();
|
|
9983
|
-
const _ = new AbortController(), T = await this.fetchWithTimeout(f, d, p, _).catch(nt),
|
|
9983
|
+
const _ = new AbortController(), T = await this.fetchWithTimeout(f, d, p, _).catch(nt), v = Date.now();
|
|
9984
9984
|
if (T instanceof globalThis.Error) {
|
|
9985
9985
|
const C = `retrying, ${n} attempts remaining`;
|
|
9986
9986
|
if (!((a = u.signal) === null || a === void 0) && a.aborted)
|
|
@@ -9990,47 +9990,47 @@ class Be {
|
|
|
9990
9990
|
return $(this).info(`[${h}] connection ${S ? "timed out" : "failed"} - ${C}`), $(this).debug(`[${h}] connection ${S ? "timed out" : "failed"} (${C})`, re({
|
|
9991
9991
|
retryOfRequestLogID: o,
|
|
9992
9992
|
url: f,
|
|
9993
|
-
durationMs:
|
|
9993
|
+
durationMs: v - y,
|
|
9994
9994
|
message: T.message
|
|
9995
9995
|
})), this.retryRequest(u, n, o ?? h);
|
|
9996
9996
|
throw $(this).info(`[${h}] connection ${S ? "timed out" : "failed"} - error; no more retries left`), $(this).debug(`[${h}] connection ${S ? "timed out" : "failed"} (error; no more retries left)`, re({
|
|
9997
9997
|
retryOfRequestLogID: o,
|
|
9998
9998
|
url: f,
|
|
9999
|
-
durationMs:
|
|
9999
|
+
durationMs: v - y,
|
|
10000
10000
|
message: T.message
|
|
10001
10001
|
})), S ? new ko() : new qe({ cause: T });
|
|
10002
10002
|
}
|
|
10003
|
-
const E = `[${h}${m}] ${d.method} ${f} ${T.ok ? "succeeded" : "failed"} with status ${T.status} in ${
|
|
10003
|
+
const E = `[${h}${m}] ${d.method} ${f} ${T.ok ? "succeeded" : "failed"} with status ${T.status} in ${v - y}ms`;
|
|
10004
10004
|
if (!T.ok) {
|
|
10005
10005
|
const C = await this.shouldRetry(T);
|
|
10006
10006
|
if (n && C) {
|
|
10007
|
-
const
|
|
10008
|
-
return await fd(T.body), $(this).info(`${E} - ${
|
|
10007
|
+
const A = `retrying, ${n} attempts remaining`;
|
|
10008
|
+
return await fd(T.body), $(this).info(`${E} - ${A}`), $(this).debug(`[${h}] response error (${A})`, re({
|
|
10009
10009
|
retryOfRequestLogID: o,
|
|
10010
10010
|
url: T.url,
|
|
10011
10011
|
status: T.status,
|
|
10012
10012
|
headers: T.headers,
|
|
10013
|
-
durationMs:
|
|
10013
|
+
durationMs: v - y
|
|
10014
10014
|
})), this.retryRequest(u, n, o ?? h, T.headers);
|
|
10015
10015
|
}
|
|
10016
10016
|
const S = C ? "error; no more retries left" : "error; not retryable";
|
|
10017
10017
|
$(this).info(`${E} - ${S}`);
|
|
10018
|
-
const
|
|
10018
|
+
const R = await T.text().catch((A) => nt(A).message), P = id(R), I = P ? void 0 : R;
|
|
10019
10019
|
throw $(this).debug(`[${h}] response error (${S})`, re({
|
|
10020
10020
|
retryOfRequestLogID: o,
|
|
10021
10021
|
url: T.url,
|
|
10022
10022
|
status: T.status,
|
|
10023
10023
|
headers: T.headers,
|
|
10024
|
-
message:
|
|
10024
|
+
message: I,
|
|
10025
10025
|
durationMs: Date.now() - y
|
|
10026
|
-
})), this.makeStatusError(T.status,
|
|
10026
|
+
})), this.makeStatusError(T.status, P, I, T.headers);
|
|
10027
10027
|
}
|
|
10028
10028
|
return $(this).info(E), $(this).debug(`[${h}] response start`, re({
|
|
10029
10029
|
retryOfRequestLogID: o,
|
|
10030
10030
|
url: T.url,
|
|
10031
10031
|
status: T.status,
|
|
10032
10032
|
headers: T.headers,
|
|
10033
|
-
durationMs:
|
|
10033
|
+
durationMs: v - y
|
|
10034
10034
|
})), { response: T, options: u, controller: _, requestLogID: h, retryOfRequestLogID: o, startTime: y };
|
|
10035
10035
|
}
|
|
10036
10036
|
async fetchWithTimeout(e, n, o, s) {
|
|
@@ -10479,10 +10479,10 @@ function rt(t, e) {
|
|
|
10479
10479
|
"preferenceOptimizationSpec"
|
|
10480
10480
|
]);
|
|
10481
10481
|
T != null && r(n, ["preferenceOptimizationSpec"], T);
|
|
10482
|
-
const
|
|
10482
|
+
const v = i(t, [
|
|
10483
10483
|
"tuningDataStats"
|
|
10484
10484
|
]);
|
|
10485
|
-
|
|
10485
|
+
v != null && r(n, ["tuningDataStats"], v);
|
|
10486
10486
|
const E = i(t, [
|
|
10487
10487
|
"encryptionSpec"
|
|
10488
10488
|
]);
|
|
@@ -10495,22 +10495,22 @@ function rt(t, e) {
|
|
|
10495
10495
|
"customBaseModel"
|
|
10496
10496
|
]);
|
|
10497
10497
|
S != null && r(n, ["customBaseModel"], S);
|
|
10498
|
-
const
|
|
10499
|
-
|
|
10500
|
-
const
|
|
10501
|
-
|
|
10502
|
-
const
|
|
10503
|
-
|
|
10504
|
-
const
|
|
10505
|
-
|
|
10506
|
-
const
|
|
10498
|
+
const R = i(t, ["experiment"]);
|
|
10499
|
+
R != null && r(n, ["experiment"], R);
|
|
10500
|
+
const P = i(t, ["labels"]);
|
|
10501
|
+
P != null && r(n, ["labels"], P);
|
|
10502
|
+
const I = i(t, ["outputUri"]);
|
|
10503
|
+
I != null && r(n, ["outputUri"], I);
|
|
10504
|
+
const N = i(t, ["pipelineJob"]);
|
|
10505
|
+
N != null && r(n, ["pipelineJob"], N);
|
|
10506
|
+
const A = i(t, [
|
|
10507
10507
|
"serviceAccount"
|
|
10508
10508
|
]);
|
|
10509
|
-
|
|
10510
|
-
const
|
|
10509
|
+
A != null && r(n, ["serviceAccount"], A);
|
|
10510
|
+
const M = i(t, [
|
|
10511
10511
|
"tunedModelDisplayName"
|
|
10512
10512
|
]);
|
|
10513
|
-
|
|
10513
|
+
M != null && r(n, ["tunedModelDisplayName"], M);
|
|
10514
10514
|
const L = i(t, [
|
|
10515
10515
|
"veoTuningSpec"
|
|
10516
10516
|
]);
|
|
@@ -10574,7 +10574,7 @@ class Qd extends te {
|
|
|
10574
10574
|
let a, u = "", c = {};
|
|
10575
10575
|
if (this.apiClient.isVertexAI()) {
|
|
10576
10576
|
const d = qd(e);
|
|
10577
|
-
return u =
|
|
10577
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
10578
10578
|
path: u,
|
|
10579
10579
|
queryParams: c,
|
|
10580
10580
|
body: JSON.stringify(d),
|
|
@@ -10589,7 +10589,7 @@ class Qd extends te {
|
|
|
10589
10589
|
})), a.then((f) => rt(f));
|
|
10590
10590
|
} else {
|
|
10591
10591
|
const d = Vd(e);
|
|
10592
|
-
return u =
|
|
10592
|
+
return u = x("{name}", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
10593
10593
|
path: u,
|
|
10594
10594
|
queryParams: c,
|
|
10595
10595
|
body: JSON.stringify(d),
|
|
@@ -10609,7 +10609,7 @@ class Qd extends te {
|
|
|
10609
10609
|
let a, u = "", c = {};
|
|
10610
10610
|
if (this.apiClient.isVertexAI()) {
|
|
10611
10611
|
const d = $d(e);
|
|
10612
|
-
return u =
|
|
10612
|
+
return u = x("tuningJobs", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
10613
10613
|
path: u,
|
|
10614
10614
|
queryParams: c,
|
|
10615
10615
|
body: JSON.stringify(d),
|
|
@@ -10627,7 +10627,7 @@ class Qd extends te {
|
|
|
10627
10627
|
});
|
|
10628
10628
|
} else {
|
|
10629
10629
|
const d = Jd(e);
|
|
10630
|
-
return u =
|
|
10630
|
+
return u = x("tunedModels", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
10631
10631
|
path: u,
|
|
10632
10632
|
queryParams: c,
|
|
10633
10633
|
body: JSON.stringify(d),
|
|
@@ -10661,7 +10661,7 @@ class Qd extends te {
|
|
|
10661
10661
|
let a, u = "", c = {};
|
|
10662
10662
|
if (this.apiClient.isVertexAI()) {
|
|
10663
10663
|
const d = kd(e);
|
|
10664
|
-
return u =
|
|
10664
|
+
return u = x("{name}:cancel", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
10665
10665
|
path: u,
|
|
10666
10666
|
queryParams: c,
|
|
10667
10667
|
body: JSON.stringify(d),
|
|
@@ -10679,7 +10679,7 @@ class Qd extends te {
|
|
|
10679
10679
|
});
|
|
10680
10680
|
} else {
|
|
10681
10681
|
const d = Pd(e);
|
|
10682
|
-
return u =
|
|
10682
|
+
return u = x("{name}:cancel", d._url), c = d._query, delete d._url, delete d._query, a = this.apiClient.request({
|
|
10683
10683
|
path: u,
|
|
10684
10684
|
queryParams: c,
|
|
10685
10685
|
body: JSON.stringify(d),
|
|
@@ -10702,7 +10702,7 @@ class Qd extends te {
|
|
|
10702
10702
|
let s, l = "", a = {};
|
|
10703
10703
|
if (this.apiClient.isVertexAI()) {
|
|
10704
10704
|
const u = Gd(e, e);
|
|
10705
|
-
return l =
|
|
10705
|
+
return l = x("tuningJobs", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
10706
10706
|
path: l,
|
|
10707
10707
|
queryParams: a,
|
|
10708
10708
|
body: JSON.stringify(u),
|
|
@@ -10725,7 +10725,7 @@ class Qd extends te {
|
|
|
10725
10725
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
10726
10726
|
{
|
|
10727
10727
|
const u = Fd(e);
|
|
10728
|
-
return l =
|
|
10728
|
+
return l = x("tunedModels", u._url), a = u._query, delete u._url, delete u._query, s = this.apiClient.request({
|
|
10729
10729
|
path: l,
|
|
10730
10730
|
queryParams: a,
|
|
10731
10731
|
body: JSON.stringify(u),
|
|
@@ -10949,14 +10949,14 @@ Example: For an image showing 'x squared', your literal output must be: x^2` },
|
|
|
10949
10949
|
} catch (o) {
|
|
10950
10950
|
throw console.error("Error calling Gemini API:", o), o instanceof Error && (o.message.includes("API key not valid") || o.message.includes("400")) ? new Error("The API key is not valid. Please check your configuration.") : new Error("Failed to recognize handwriting. The model may be unavailable or the drawing is unclear.");
|
|
10951
10951
|
}
|
|
10952
|
-
}, jo = () => /* @__PURE__ */
|
|
10952
|
+
}, jo = () => /* @__PURE__ */ k("span", { className: "text-sm leading-tight flex flex-col items-center text-black -mt-0.5", children: [
|
|
10953
10953
|
/* @__PURE__ */ g("span", { children: "□" }),
|
|
10954
10954
|
/* @__PURE__ */ g("span", { className: "w-2 h-px bg-black my-[1px]" }),
|
|
10955
10955
|
/* @__PURE__ */ g("span", { children: "□" })
|
|
10956
|
-
] }), ei = () => /* @__PURE__ */
|
|
10956
|
+
] }), ei = () => /* @__PURE__ */ k("span", { className: "text-black text-lg", children: [
|
|
10957
10957
|
"√",
|
|
10958
10958
|
/* @__PURE__ */ g("span", { className: "border-t border-black -ml-1", children: "□" })
|
|
10959
|
-
] }), hc = () => /* @__PURE__ */
|
|
10959
|
+
] }), hc = () => /* @__PURE__ */ k("span", { className: "text-black text-lg", children: [
|
|
10960
10960
|
/* @__PURE__ */ g("sup", { className: "-mr-1", children: "□" }),
|
|
10961
10961
|
"√",
|
|
10962
10962
|
/* @__PURE__ */ g("span", { className: "border-t border-black -ml-1", children: "□" })
|
|
@@ -10977,7 +10977,7 @@ Example: For an image showing 'x squared', your literal output must be: x^2` },
|
|
|
10977
10977
|
children: n
|
|
10978
10978
|
}
|
|
10979
10979
|
), yc = [
|
|
10980
|
-
{ key: "layout", display: /* @__PURE__ */
|
|
10980
|
+
{ key: "layout", display: /* @__PURE__ */ k("div", { className: "flex items-center gap-1", children: [
|
|
10981
10981
|
/* @__PURE__ */ g(ei, {}),
|
|
10982
10982
|
" ",
|
|
10983
10983
|
/* @__PURE__ */ g(jo, {})
|
|
@@ -11127,9 +11127,9 @@ Example: For an image showing 'x squared', your literal output must be: x^2` },
|
|
|
11127
11127
|
],
|
|
11128
11128
|
products: []
|
|
11129
11129
|
}, Tc = ({ onInsert: t }) => {
|
|
11130
|
-
const [e, n] =
|
|
11131
|
-
return /* @__PURE__ */
|
|
11132
|
-
/* @__PURE__ */
|
|
11130
|
+
const [e, n] = q("layout");
|
|
11131
|
+
return /* @__PURE__ */ k("div", { className: "bg-[#e9eff1] px-2 py-1 flex flex-col space-y-1 shrink-0 border-b border-gray-300", children: [
|
|
11132
|
+
/* @__PURE__ */ k("div", { className: "flex flex-wrap gap-1 items-center", children: [
|
|
11133
11133
|
yc.map((o) => /* @__PURE__ */ g(
|
|
11134
11134
|
gc,
|
|
11135
11135
|
{
|
|
@@ -11143,13 +11143,13 @@ Example: For an image showing 'x squared', your literal output must be: x^2` },
|
|
|
11143
11143
|
/* @__PURE__ */ g("div", { className: "flex-grow" }),
|
|
11144
11144
|
/* @__PURE__ */ g("button", { title: "Help", className: "w-8 h-8 rounded-full bg-gray-400 hover:bg-gray-500 text-white flex items-center justify-center shadow-sm transition-all", children: /* @__PURE__ */ g("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ g("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) })
|
|
11145
11145
|
] }),
|
|
11146
|
-
/* @__PURE__ */
|
|
11147
|
-
/* @__PURE__ */ g("div", { className: "flex items-start", children: eo[e].map((o, s) => /* @__PURE__ */
|
|
11146
|
+
/* @__PURE__ */ k("div", { className: "flex items-start bg-white rounded border border-gray-300 min-h-[5rem] shadow-inner p-1 overflow-x-auto", children: [
|
|
11147
|
+
/* @__PURE__ */ g("div", { className: "flex items-start", children: eo[e].map((o, s) => /* @__PURE__ */ k(oo.Fragment, { children: [
|
|
11148
11148
|
/* @__PURE__ */ g("div", { className: "flex flex-col", children: o.map((l, a) => /* @__PURE__ */ g("div", { className: "flex", children: l.map((u, c) => /* @__PURE__ */ g(mc, { symbol: u, onInsert: t }, c)) }, a)) }),
|
|
11149
11149
|
s < eo[e].length - 1 && /* @__PURE__ */ g("div", { className: "w-px bg-gray-300 mx-1 self-stretch" })
|
|
11150
11150
|
] }, s)) }),
|
|
11151
11151
|
/* @__PURE__ */ g("div", { className: "flex-grow" }),
|
|
11152
|
-
/* @__PURE__ */ g("div", { className: "flex items-center space-x-2 shrink-0 self-center pr-2", children: /* @__PURE__ */
|
|
11152
|
+
/* @__PURE__ */ g("div", { className: "flex items-center space-x-2 shrink-0 self-center pr-2", children: /* @__PURE__ */ k("div", { className: "flex flex-col space-y-1", children: [
|
|
11153
11153
|
/* @__PURE__ */ g("select", { disabled: !0, className: "text-sm border border-gray-300 rounded h-6 w-32 px-1 text-black opacity-50", children: /* @__PURE__ */ g("option", { children: "Font..." }) }),
|
|
11154
11154
|
/* @__PURE__ */ g("select", { disabled: !0, className: "text-sm border border-gray-300 rounded h-6 w-32 px-1 text-black opacity-50", children: /* @__PURE__ */ g("option", { children: "Size..." }) })
|
|
11155
11155
|
] }) })
|
|
@@ -11196,11 +11196,11 @@ Example: For an image showing 'x squared', your literal output must be: x^2` },
|
|
|
11196
11196
|
[{ display: "↔", latex: "\\leftrightarrow " }]
|
|
11197
11197
|
],
|
|
11198
11198
|
[
|
|
11199
|
-
[{ display: /* @__PURE__ */
|
|
11199
|
+
[{ display: /* @__PURE__ */ k("span", { className: "text-lg", children: [
|
|
11200
11200
|
"→",
|
|
11201
11201
|
/* @__PURE__ */ g("sup", { className: "-top-1.5 text-[8px]", children: "□" })
|
|
11202
11202
|
] }), latex: "\\xrightarrow{}" }],
|
|
11203
|
-
[{ display: /* @__PURE__ */
|
|
11203
|
+
[{ display: /* @__PURE__ */ k("span", { className: "text-lg", children: [
|
|
11204
11204
|
"⇌",
|
|
11205
11205
|
/* @__PURE__ */ g("sup", { className: "-top-1.5 text-[8px]", children: "□" })
|
|
11206
11206
|
] }), latex: "\\xrightleftharpoons{}" }]
|
|
@@ -11279,9 +11279,9 @@ Example: For an image showing 'x squared', your literal output must be: x^2` },
|
|
|
11279
11279
|
]
|
|
11280
11280
|
]
|
|
11281
11281
|
}, vc = ({ onInsert: t }) => {
|
|
11282
|
-
const [e, n] =
|
|
11283
|
-
return /* @__PURE__ */
|
|
11284
|
-
/* @__PURE__ */
|
|
11282
|
+
const [e, n] = q("chem");
|
|
11283
|
+
return /* @__PURE__ */ k("div", { className: "bg-[#e9eff1] px-2 py-1 flex flex-col space-y-1 shrink-0 border-b border-gray-300", children: [
|
|
11284
|
+
/* @__PURE__ */ k("div", { className: "flex flex-wrap gap-1 items-center", children: [
|
|
11285
11285
|
Cc.map((o) => /* @__PURE__ */ g(
|
|
11286
11286
|
Ec,
|
|
11287
11287
|
{
|
|
@@ -11295,13 +11295,13 @@ Example: For an image showing 'x squared', your literal output must be: x^2` },
|
|
|
11295
11295
|
/* @__PURE__ */ g("div", { className: "flex-grow" }),
|
|
11296
11296
|
/* @__PURE__ */ g("button", { title: "Help", className: "w-8 h-8 rounded-full bg-gray-400 hover:bg-gray-500 text-white flex items-center justify-center shadow-sm transition-all", children: /* @__PURE__ */ g("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ g("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) })
|
|
11297
11297
|
] }),
|
|
11298
|
-
/* @__PURE__ */
|
|
11299
|
-
/* @__PURE__ */ g("div", { className: "flex items-start", children: to[e].map((o, s) => /* @__PURE__ */
|
|
11298
|
+
/* @__PURE__ */ k("div", { className: "flex items-start bg-white rounded border border-gray-300 min-h-[5rem] shadow-inner p-1 overflow-x-auto", children: [
|
|
11299
|
+
/* @__PURE__ */ g("div", { className: "flex items-start", children: to[e].map((o, s) => /* @__PURE__ */ k(oo.Fragment, { children: [
|
|
11300
11300
|
/* @__PURE__ */ g("div", { className: "flex flex-col", children: o.map((l, a) => /* @__PURE__ */ g("div", { className: "flex", children: l.map((u, c) => /* @__PURE__ */ g(_c, { symbol: u, onInsert: t }, c)) }, a)) }),
|
|
11301
11301
|
s < to[e].length - 1 && /* @__PURE__ */ g("div", { className: "w-px bg-gray-300 mx-1 self-stretch" })
|
|
11302
11302
|
] }, s)) }),
|
|
11303
11303
|
/* @__PURE__ */ g("div", { className: "flex-grow" }),
|
|
11304
|
-
/* @__PURE__ */ g("div", { className: "flex items-center space-x-2 shrink-0 self-center pr-2", children: /* @__PURE__ */
|
|
11304
|
+
/* @__PURE__ */ g("div", { className: "flex items-center space-x-2 shrink-0 self-center pr-2", children: /* @__PURE__ */ k("div", { className: "flex flex-col space-y-1", children: [
|
|
11305
11305
|
/* @__PURE__ */ g("select", { disabled: !0, className: "text-sm border border-gray-300 rounded h-6 w-32 px-1 text-black opacity-50", children: /* @__PURE__ */ g("option", { children: "Font..." }) }),
|
|
11306
11306
|
/* @__PURE__ */ g("select", { disabled: !0, className: "text-sm border border-gray-300 rounded h-6 w-32 px-1 text-black opacity-50", children: /* @__PURE__ */ g("option", { children: "Size..." }) })
|
|
11307
11307
|
] }) })
|
|
@@ -11561,104 +11561,104 @@ const Zc = [
|
|
|
11561
11561
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
11562
11562
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
11563
11563
|
], jc = Y("x", Zc), ef = ({ isOpen: t, onClose: e, onInsert: n, apiKey: o = "" }) => {
|
|
11564
|
-
const s = j(null), l = j(null), [a, u] =
|
|
11564
|
+
const s = j(null), l = j(null), [a, u] = q(!1), [c, d] = q(null), [f, p] = q(""), [h, m] = q("keyboard"), [y, _] = q("math"), [T, v] = q(!1), [E, C] = q(!1), [S, R] = q(""), [P, I] = q(!1);
|
|
11565
11565
|
he(() => {
|
|
11566
11566
|
if (h === "keyboard" && f.trim() && window.katex)
|
|
11567
11567
|
try {
|
|
11568
|
-
const
|
|
11568
|
+
const D = window.katex.renderToString(f, {
|
|
11569
11569
|
throwOnError: !0,
|
|
11570
11570
|
displayMode: !1,
|
|
11571
11571
|
output: "mathml"
|
|
11572
11572
|
});
|
|
11573
|
-
console.log("previewHTML : ", S),
|
|
11573
|
+
console.log("previewHTML : ", S), R(D), I(!0);
|
|
11574
11574
|
} catch {
|
|
11575
|
-
|
|
11575
|
+
R('<span class="text-red-500 text-xs">Invalid formula syntax</span>'), I(!1);
|
|
11576
11576
|
}
|
|
11577
11577
|
else
|
|
11578
|
-
|
|
11578
|
+
R(""), I(!1);
|
|
11579
11579
|
}, [f, h]);
|
|
11580
|
-
const
|
|
11581
|
-
_(
|
|
11582
|
-
},
|
|
11583
|
-
var
|
|
11584
|
-
(
|
|
11585
|
-
}, []),
|
|
11580
|
+
const N = (D) => {
|
|
11581
|
+
_(D), D === "chem" && m("keyboard");
|
|
11582
|
+
}, A = le(() => {
|
|
11583
|
+
var D;
|
|
11584
|
+
(D = s.current) == null || D.clear(), p(""), d(null), u(!1);
|
|
11585
|
+
}, []), M = le((D) => {
|
|
11586
11586
|
const b = l.current;
|
|
11587
11587
|
if (!b) {
|
|
11588
|
-
p((H) => H +
|
|
11588
|
+
p((H) => H + D);
|
|
11589
11589
|
return;
|
|
11590
11590
|
}
|
|
11591
|
-
const
|
|
11592
|
-
p(
|
|
11593
|
-
b.focus(), b.selectionStart = b.selectionEnd =
|
|
11591
|
+
const G = b.selectionStart, w = b.selectionEnd, V = f.substring(0, G) + D + f.substring(w);
|
|
11592
|
+
p(V), setTimeout(() => {
|
|
11593
|
+
b.focus(), b.selectionStart = b.selectionEnd = G + D.length;
|
|
11594
11594
|
}, 0);
|
|
11595
11595
|
}, [f]), L = le(async () => {
|
|
11596
|
-
var b,
|
|
11596
|
+
var b, G;
|
|
11597
11597
|
if (!o) {
|
|
11598
11598
|
d("Please configure your Gemini API key in the main editor.");
|
|
11599
11599
|
return;
|
|
11600
11600
|
}
|
|
11601
|
-
const
|
|
11602
|
-
if (!
|
|
11601
|
+
const D = (b = s.current) == null ? void 0 : b.getTrimmedImageData();
|
|
11602
|
+
if (!D) {
|
|
11603
11603
|
d("Draw a formula on the pad first.");
|
|
11604
11604
|
return;
|
|
11605
11605
|
}
|
|
11606
11606
|
u(!0), d(null);
|
|
11607
11607
|
try {
|
|
11608
|
-
const
|
|
11609
|
-
|
|
11610
|
-
} catch (
|
|
11611
|
-
d(
|
|
11608
|
+
const w = D.split(",")[1], V = await pc(w, o);
|
|
11609
|
+
M(V), m("keyboard"), (G = s.current) == null || G.clear();
|
|
11610
|
+
} catch (w) {
|
|
11611
|
+
d(w.message || "AI recognition failed.");
|
|
11612
11612
|
} finally {
|
|
11613
11613
|
u(!1);
|
|
11614
11614
|
}
|
|
11615
|
-
}, [o,
|
|
11616
|
-
return t ? /* @__PURE__ */ g("div", { className: "fixed inset-0 z-[100] flex items-center justify-center bg-slate-900/40 backdrop-blur-md p-4 animate-in fade-in duration-200", children: /* @__PURE__ */
|
|
11617
|
-
/* @__PURE__ */
|
|
11618
|
-
/* @__PURE__ */
|
|
11615
|
+
}, [o, M]);
|
|
11616
|
+
return t ? /* @__PURE__ */ g("div", { className: "fixed inset-0 z-[100] flex items-center justify-center bg-slate-900/40 backdrop-blur-md p-4 animate-in fade-in duration-200", children: /* @__PURE__ */ k("div", { className: "bg-white rounded-2xl shadow-2xl flex flex-col w-full max-w-4xl h-[600px] border border-slate-200 overflow-hidden", onClick: (D) => D.stopPropagation(), children: [
|
|
11617
|
+
/* @__PURE__ */ k("header", { className: "px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/50", children: [
|
|
11618
|
+
/* @__PURE__ */ k("div", { className: "flex items-center gap-6", children: [
|
|
11619
11619
|
/* @__PURE__ */ g("h2", { className: "text-lg font-bold text-slate-900", children: "AI Formula Pad" }),
|
|
11620
|
-
/* @__PURE__ */
|
|
11621
|
-
/* @__PURE__ */ g("button", { onClick: () =>
|
|
11622
|
-
/* @__PURE__ */ g("button", { onClick: () =>
|
|
11620
|
+
/* @__PURE__ */ k("div", { className: "flex bg-slate-200 p-1 rounded-lg", children: [
|
|
11621
|
+
/* @__PURE__ */ g("button", { onClick: () => N("math"), className: `px-4 py-1 text-xs font-semibold rounded-md transition-all ${y === "math" ? "bg-white shadow text-blue-600" : "text-slate-500"}`, children: "Math" }),
|
|
11622
|
+
/* @__PURE__ */ g("button", { onClick: () => N("chem"), className: `px-4 py-1 text-xs font-semibold rounded-md transition-all ${y === "chem" ? "bg-white shadow text-blue-600" : "text-slate-500"}`, children: "Chemistry" })
|
|
11623
11623
|
] })
|
|
11624
11624
|
] }),
|
|
11625
11625
|
/* @__PURE__ */ g("button", { title: "Close", onClick: e, className: "p-2 hover:bg-slate-200 rounded-full text-slate-400 hover:text-slate-600 transition-colors", children: /* @__PURE__ */ g(jc, { size: 20 }) })
|
|
11626
11626
|
] }),
|
|
11627
|
-
/* @__PURE__ */
|
|
11628
|
-
/* @__PURE__ */
|
|
11627
|
+
/* @__PURE__ */ k("div", { className: "flex-1 flex overflow-hidden", children: [
|
|
11628
|
+
/* @__PURE__ */ k("div", { className: "w-16 border-r border-slate-100 flex flex-col items-center py-6 gap-4 bg-slate-50/30", children: [
|
|
11629
11629
|
/* @__PURE__ */ g("button", { onClick: () => m("keyboard"), className: `p-3 rounded-xl transition-all ${h === "keyboard" ? "bg-blue-600 text-white shadow-lg" : "text-slate-400 hover:text-slate-600"}`, children: /* @__PURE__ */ g(Dc, { size: 24 }) }),
|
|
11630
11630
|
y === "math" && /* @__PURE__ */ g("button", { onClick: () => m("handwriting"), className: `p-3 rounded-xl transition-all ${h === "handwriting" ? "bg-blue-600 text-white shadow-lg" : "text-slate-400 hover:text-slate-600"}`, children: /* @__PURE__ */ g(Jc, { size: 24 }) })
|
|
11631
11631
|
] }),
|
|
11632
|
-
/* @__PURE__ */
|
|
11633
|
-
/* @__PURE__ */ g("div", { className: "shrink-0", children: h === "keyboard" && (y === "math" ? /* @__PURE__ */ g(Tc, { onInsert:
|
|
11634
|
-
/* @__PURE__ */ g("div", { className: "flex-1 p-6 relative bg-slate-50/20", children: h === "keyboard" ? /* @__PURE__ */
|
|
11632
|
+
/* @__PURE__ */ k("div", { className: "flex-1 flex flex-col overflow-hidden", children: [
|
|
11633
|
+
/* @__PURE__ */ g("div", { className: "shrink-0", children: h === "keyboard" && (y === "math" ? /* @__PURE__ */ g(Tc, { onInsert: M }) : /* @__PURE__ */ g(vc, { onInsert: M })) }),
|
|
11634
|
+
/* @__PURE__ */ g("div", { className: "flex-1 p-6 relative bg-slate-50/20", children: h === "keyboard" ? /* @__PURE__ */ k("div", { className: "h-full flex flex-col gap-4", children: [
|
|
11635
11635
|
/* @__PURE__ */ g(
|
|
11636
11636
|
"textarea",
|
|
11637
11637
|
{
|
|
11638
11638
|
ref: l,
|
|
11639
11639
|
value: f,
|
|
11640
|
-
onChange: (
|
|
11640
|
+
onChange: (D) => p(D.target.value),
|
|
11641
11641
|
className: "flex-1 w-full p-6 border border-slate-200 rounded-xl shadow-inner focus:outline-none focus:ring-2 focus:ring-blue-500/10 font-mono text-xl text-slate-800",
|
|
11642
11642
|
placeholder: `Enter LaTeX for ${y}...`
|
|
11643
11643
|
}
|
|
11644
11644
|
),
|
|
11645
11645
|
/* @__PURE__ */ g("div", { className: "h-20 bg-white border border-slate-100 rounded-xl flex items-center justify-center p-4 shadow-sm overflow-auto", children: S ? /* @__PURE__ */ g("div", { dangerouslySetInnerHTML: { __html: S } }) : /* @__PURE__ */ g("span", { className: "text-slate-300 italic", children: "Preview will appear here" }) })
|
|
11646
|
-
] }) : /* @__PURE__ */
|
|
11647
|
-
/* @__PURE__ */ g(so, { ref: s, onHistoryChange: (
|
|
11648
|
-
|
|
11646
|
+
] }) : /* @__PURE__ */ k("div", { className: "h-full border border-slate-200 bg-white rounded-2xl shadow-inner overflow-hidden relative", children: [
|
|
11647
|
+
/* @__PURE__ */ g(so, { ref: s, onHistoryChange: (D) => {
|
|
11648
|
+
v(D.canUndo), C(D.canRedo);
|
|
11649
11649
|
} }),
|
|
11650
|
-
/* @__PURE__ */
|
|
11650
|
+
/* @__PURE__ */ k("div", { className: "absolute top-4 right-4 flex flex-col gap-2", children: [
|
|
11651
11651
|
/* @__PURE__ */ g("button", { onClick: () => {
|
|
11652
|
-
var
|
|
11653
|
-
return (
|
|
11652
|
+
var D;
|
|
11653
|
+
return (D = s.current) == null ? void 0 : D.undo();
|
|
11654
11654
|
}, disabled: !T, className: "p-2 bg-white border border-slate-200 rounded-lg shadow-sm disabled:opacity-30 hover:bg-slate-50", children: /* @__PURE__ */ g(Wc, { size: 18 }) }),
|
|
11655
11655
|
/* @__PURE__ */ g("button", { onClick: () => {
|
|
11656
|
-
var
|
|
11657
|
-
return (
|
|
11656
|
+
var D;
|
|
11657
|
+
return (D = s.current) == null ? void 0 : D.redo();
|
|
11658
11658
|
}, disabled: !E, className: "p-2 bg-white border border-slate-200 rounded-lg shadow-sm disabled:opacity-30 hover:bg-slate-50", children: /* @__PURE__ */ g(Kc, { size: 18 }) }),
|
|
11659
|
-
/* @__PURE__ */ g("button", { onClick:
|
|
11659
|
+
/* @__PURE__ */ g("button", { onClick: A, className: "p-2 bg-white border border-slate-200 rounded-lg shadow-sm text-red-500 hover:bg-red-50", children: /* @__PURE__ */ g(Qc, { size: 18 }) })
|
|
11660
11660
|
] }),
|
|
11661
|
-
/* @__PURE__ */ g("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2 flex gap-4", children: /* @__PURE__ */
|
|
11661
|
+
/* @__PURE__ */ g("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2 flex gap-4", children: /* @__PURE__ */ k(
|
|
11662
11662
|
"button",
|
|
11663
11663
|
{
|
|
11664
11664
|
onClick: L,
|
|
@@ -11673,9 +11673,9 @@ const Zc = [
|
|
|
11673
11673
|
] }) })
|
|
11674
11674
|
] })
|
|
11675
11675
|
] }),
|
|
11676
|
-
/* @__PURE__ */
|
|
11676
|
+
/* @__PURE__ */ k("footer", { className: "px-6 py-4 border-t border-slate-100 flex justify-between items-center bg-slate-50/50", children: [
|
|
11677
11677
|
c && /* @__PURE__ */ g("span", { className: "text-sm font-medium text-red-500 animate-pulse", children: c }),
|
|
11678
|
-
/* @__PURE__ */
|
|
11678
|
+
/* @__PURE__ */ k("div", { className: "ml-auto flex gap-3", children: [
|
|
11679
11679
|
/* @__PURE__ */ g("button", { onClick: e, className: "px-6 py-2 text-slate-600 font-semibold hover:bg-slate-200 rounded-xl transition", children: "Cancel" }),
|
|
11680
11680
|
/* @__PURE__ */ g(
|
|
11681
11681
|
"button",
|
|
@@ -11683,7 +11683,7 @@ const Zc = [
|
|
|
11683
11683
|
onClick: () => {
|
|
11684
11684
|
n(S), e();
|
|
11685
11685
|
},
|
|
11686
|
-
disabled: !
|
|
11686
|
+
disabled: !P,
|
|
11687
11687
|
className: "px-8 py-2 bg-slate-900 text-white font-bold rounded-xl shadow-lg disabled:opacity-40 hover:bg-slate-800 transition",
|
|
11688
11688
|
children: "Insert Into Editor"
|
|
11689
11689
|
}
|
|
@@ -11692,11 +11692,11 @@ const Zc = [
|
|
|
11692
11692
|
] })
|
|
11693
11693
|
] }) }) : null;
|
|
11694
11694
|
}, tf = ({ isOpen: t, onClose: e, onInsert: n }) => {
|
|
11695
|
-
const [o, s] =
|
|
11696
|
-
return t ? /* @__PURE__ */ g("div", { className: "fixed inset-0 z-[60] flex items-center justify-center bg-black bg-opacity-50 backdrop-blur-sm", onClick: e, children: /* @__PURE__ */
|
|
11695
|
+
const [o, s] = q(3), [l, a] = q(3);
|
|
11696
|
+
return t ? /* @__PURE__ */ g("div", { className: "fixed inset-0 z-[60] flex items-center justify-center bg-black bg-opacity-50 backdrop-blur-sm", onClick: e, children: /* @__PURE__ */ k("div", { className: "bg-white rounded-lg shadow-xl p-6 w-full max-w-sm", onClick: (c) => c.stopPropagation(), children: [
|
|
11697
11697
|
/* @__PURE__ */ g("h3", { className: "text-lg font-semibold text-gray-800 mb-4", children: "Insert Table" }),
|
|
11698
|
-
/* @__PURE__ */
|
|
11699
|
-
/* @__PURE__ */
|
|
11698
|
+
/* @__PURE__ */ k("div", { className: "space-y-4", children: [
|
|
11699
|
+
/* @__PURE__ */ k("div", { children: [
|
|
11700
11700
|
/* @__PURE__ */ g("label", { htmlFor: "rows", className: "block text-sm font-medium text-gray-700 mb-1", children: "Rows" }),
|
|
11701
11701
|
/* @__PURE__ */ g(
|
|
11702
11702
|
"input",
|
|
@@ -11709,7 +11709,7 @@ const Zc = [
|
|
|
11709
11709
|
}
|
|
11710
11710
|
)
|
|
11711
11711
|
] }),
|
|
11712
|
-
/* @__PURE__ */
|
|
11712
|
+
/* @__PURE__ */ k("div", { children: [
|
|
11713
11713
|
/* @__PURE__ */ g("label", { htmlFor: "cols", className: "block text-sm font-medium text-gray-700 mb-1", children: "Columns" }),
|
|
11714
11714
|
/* @__PURE__ */ g(
|
|
11715
11715
|
"input",
|
|
@@ -11723,7 +11723,7 @@ const Zc = [
|
|
|
11723
11723
|
)
|
|
11724
11724
|
] })
|
|
11725
11725
|
] }),
|
|
11726
|
-
/* @__PURE__ */
|
|
11726
|
+
/* @__PURE__ */ k("div", { className: "mt-6 flex justify-end space-x-3", children: [
|
|
11727
11727
|
/* @__PURE__ */ g("button", { title: "Cancel and discard", onClick: e, className: "px-4 py-2 bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition", children: "Cancel" }),
|
|
11728
11728
|
/* @__PURE__ */ g("button", { onClick: () => {
|
|
11729
11729
|
o > 0 && l > 0 && n(o, l);
|
|
@@ -11739,9 +11739,9 @@ const Zc = [
|
|
|
11739
11739
|
canRedo: l,
|
|
11740
11740
|
apiKey: a
|
|
11741
11741
|
}) => {
|
|
11742
|
-
const [u, c] =
|
|
11742
|
+
const [u, c] = q(!1), [d, f] = q(!1), [p, h] = q(7), m = j(null), y = j([]), _ = j(null), [T, v] = q(!1);
|
|
11743
11743
|
he(() => {
|
|
11744
|
-
a !== "" && a &&
|
|
11744
|
+
a !== "" && a && v(!0);
|
|
11745
11745
|
}, [a]);
|
|
11746
11746
|
const E = ni(() => [
|
|
11747
11747
|
{ id: "font", priority: 1 },
|
|
@@ -11753,9 +11753,9 @@ const Zc = [
|
|
|
11753
11753
|
{ id: "handwriting", priority: 7 }
|
|
11754
11754
|
], []);
|
|
11755
11755
|
he(() => {
|
|
11756
|
-
const
|
|
11757
|
-
if (!
|
|
11758
|
-
const
|
|
11756
|
+
const w = m.current;
|
|
11757
|
+
if (!w) return;
|
|
11758
|
+
const V = new ResizeObserver((H) => {
|
|
11759
11759
|
const se = H[0].contentRect.width - 50;
|
|
11760
11760
|
let Te = 0, yt = 0;
|
|
11761
11761
|
for (let Je = 0; Je < y.current.length; Je++) {
|
|
@@ -11770,100 +11770,100 @@ const Zc = [
|
|
|
11770
11770
|
}
|
|
11771
11771
|
h(Math.max(1, yt));
|
|
11772
11772
|
});
|
|
11773
|
-
return
|
|
11773
|
+
return V.observe(w), () => V.disconnect();
|
|
11774
11774
|
}, []);
|
|
11775
|
-
const C = (
|
|
11775
|
+
const C = (w) => {
|
|
11776
11776
|
var H;
|
|
11777
|
-
const
|
|
11778
|
-
if (
|
|
11777
|
+
const V = (H = w.target.files) == null ? void 0 : H[0];
|
|
11778
|
+
if (V) {
|
|
11779
11779
|
const K = new FileReader();
|
|
11780
11780
|
K.onload = (se) => {
|
|
11781
11781
|
var Te;
|
|
11782
11782
|
return e("insertImage", (Te = se.target) == null ? void 0 : Te.result);
|
|
11783
|
-
}, K.readAsDataURL(
|
|
11783
|
+
}, K.readAsDataURL(V);
|
|
11784
11784
|
}
|
|
11785
|
-
|
|
11786
|
-
}, S = (
|
|
11785
|
+
w.target.value = "";
|
|
11786
|
+
}, S = (w, V) => {
|
|
11787
11787
|
let H = '<table style="width:100%; border-collapse: collapse; border: 1px solid black;"><tbody>';
|
|
11788
|
-
for (let K = 0; K <
|
|
11788
|
+
for (let K = 0; K < w; K++) {
|
|
11789
11789
|
H += "<tr>";
|
|
11790
|
-
for (let se = 0; se <
|
|
11790
|
+
for (let se = 0; se < V; se++) H += '<td style="border: 1px solid black; padding: 5px;"><p><br></p></td>';
|
|
11791
11791
|
H += "</tr>";
|
|
11792
11792
|
}
|
|
11793
11793
|
H += "</tbody></table><p><br></p>", e("insertHTML", H), c(!1);
|
|
11794
|
-
},
|
|
11795
|
-
/* @__PURE__ */
|
|
11794
|
+
}, R = () => /* @__PURE__ */ k("div", { ref: (w) => y.current[0] = w, className: "flex items-center gap-2 shrink-0", children: [
|
|
11795
|
+
/* @__PURE__ */ k("select", { title: "Font Family", onMouseDown: (w) => w.stopPropagation(), onChange: (w) => e("fontName", w.target.value), defaultValue: "Arial", className: "bg-white border border-gray-300 rounded px-2 py-1 text-xs text-black outline-none focus:ring-1 focus:ring-blue-500 min-w-[80px]", children: [
|
|
11796
11796
|
/* @__PURE__ */ g("option", { value: "Arial", children: "Arial" }),
|
|
11797
11797
|
/* @__PURE__ */ g("option", { value: "Verdana", children: "Verdana" }),
|
|
11798
11798
|
/* @__PURE__ */ g("option", { value: "Georgia", children: "Georgia" })
|
|
11799
11799
|
] }),
|
|
11800
|
-
/* @__PURE__ */
|
|
11800
|
+
/* @__PURE__ */ k("select", { title: "Font Size", onMouseDown: (w) => w.stopPropagation(), onChange: (w) => e("fontSize", w.target.value), defaultValue: "3", className: "bg-white border border-gray-300 rounded px-2 py-1 text-xs text-black outline-none focus:ring-1 focus:ring-blue-500", children: [
|
|
11801
11801
|
/* @__PURE__ */ g("option", { value: "1", children: "S" }),
|
|
11802
11802
|
/* @__PURE__ */ g("option", { value: "3", children: "M" }),
|
|
11803
11803
|
/* @__PURE__ */ g("option", { value: "5", children: "L" })
|
|
11804
11804
|
] })
|
|
11805
|
-
] }),
|
|
11805
|
+
] }), P = () => /* @__PURE__ */ k("div", { ref: (w) => y.current[1] = w, className: "flex bg-white border border-gray-300 rounded overflow-hidden shrink-0", children: [
|
|
11806
11806
|
/* @__PURE__ */ g("button", { title: "Undo", onClick: n, disabled: !s, className: "p-1.5 hover:bg-gray-100 disabled:opacity-30 border-r border-gray-200", children: /* @__PURE__ */ g("svg", { className: "w-4 h-4 text-black", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ g("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M10 19l-7-7m0 0l7-7m-7 7h18" }) }) }),
|
|
11807
11807
|
/* @__PURE__ */ g("button", { title: "Redo", onClick: o, disabled: !l, className: "p-1.5 hover:bg-gray-100 disabled:opacity-30", children: /* @__PURE__ */ g("svg", { className: "w-4 h-4 text-black", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ g("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M14 5l7 7m0 0l-7 7m7-7H3" }) }) })
|
|
11808
|
-
] }),
|
|
11808
|
+
] }), I = () => /* @__PURE__ */ k("div", { ref: (w) => y.current[2] = w, className: "flex bg-white border border-gray-300 rounded overflow-hidden shrink-0", children: [
|
|
11809
11809
|
/* @__PURE__ */ g("button", { title: "Bold", onClick: () => e("bold"), className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g("b", { className: "text-black", children: "B" }) }),
|
|
11810
11810
|
/* @__PURE__ */ g("button", { title: "Italic", onClick: () => e("italic"), className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g("i", { className: "text-black", children: "I" }) }),
|
|
11811
11811
|
/* @__PURE__ */ g("button", { title: "Underline", onClick: () => e("underline"), className: "p-1.5 hover:bg-gray-100", children: /* @__PURE__ */ g("u", { className: "text-black", children: "U" }) })
|
|
11812
|
-
] }),
|
|
11813
|
-
/* @__PURE__ */
|
|
11812
|
+
] }), N = () => /* @__PURE__ */ k("div", { ref: (w) => y.current[3] = w, className: "flex bg-white border border-gray-300 rounded overflow-hidden shrink-0", children: [
|
|
11813
|
+
/* @__PURE__ */ k("label", { className: "p-2 hover:bg-slate-100 rounded-md cursor-pointer relative group", title: "Text Color", onMouseDown: (w) => w.preventDefault(), children: [
|
|
11814
11814
|
/* @__PURE__ */ g(Hc, { size: 18, className: "text-slate-600" }),
|
|
11815
|
-
/* @__PURE__ */ g("input", { type: "color", onInput: (
|
|
11815
|
+
/* @__PURE__ */ g("input", { type: "color", onInput: (w) => e("foreColor", w.target.value), className: "opacity-0 absolute inset-0 cursor-pointer" })
|
|
11816
11816
|
] }),
|
|
11817
|
-
/* @__PURE__ */
|
|
11817
|
+
/* @__PURE__ */ k("label", { className: "p-2 hover:bg-slate-100 rounded-md cursor-pointer relative group", title: "Highlight Color", onMouseDown: (w) => w.preventDefault(), children: [
|
|
11818
11818
|
/* @__PURE__ */ g(Nc, { size: 18, className: "text-slate-600" }),
|
|
11819
|
-
/* @__PURE__ */ g("input", { type: "color", onInput: (
|
|
11819
|
+
/* @__PURE__ */ g("input", { type: "color", onInput: (w) => e("backColor", w.target.value), className: "opacity-0 absolute inset-0 cursor-pointer" })
|
|
11820
11820
|
] })
|
|
11821
|
-
] }),
|
|
11821
|
+
] }), A = () => /* @__PURE__ */ k("div", { ref: (w) => y.current[4] = w, className: "flex bg-white border border-gray-300 rounded overflow-hidden shrink-0", children: [
|
|
11822
11822
|
/* @__PURE__ */ g("button", { title: "Ordered List", onClick: () => e("insertOrderedList"), className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g(bc, { size: 18 }) }),
|
|
11823
11823
|
/* @__PURE__ */ g("button", { title: "Unordered List", onClick: () => e("insertUnorderedList"), className: "p-1.5 hover:bg-gray-100", children: /* @__PURE__ */ g(Fc, { size: 18 }) })
|
|
11824
|
-
] }),
|
|
11824
|
+
] }), M = () => /* @__PURE__ */ k("div", { ref: (w) => y.current[5] = w, className: "flex bg-white border border-gray-300 rounded overflow-hidden shrink-0", children: [
|
|
11825
11825
|
/* @__PURE__ */ g("button", { title: "Upload Image", onClick: () => {
|
|
11826
|
-
var
|
|
11827
|
-
return (
|
|
11826
|
+
var w;
|
|
11827
|
+
return (w = _.current) == null ? void 0 : w.click();
|
|
11828
11828
|
}, className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g(Pc, { size: 18 }) }),
|
|
11829
11829
|
/* @__PURE__ */ g("button", { title: "Insert Table", onClick: () => c(!0), className: "p-1.5 hover:bg-gray-100", children: /* @__PURE__ */ g(Oc, { size: 18 }) })
|
|
11830
|
-
] }), L = () => /* @__PURE__ */ g("div", { ref: (
|
|
11830
|
+
] }), L = () => /* @__PURE__ */ g("div", { ref: (w) => y.current[6] = w, className: "shrink-0", children: /* @__PURE__ */ g("button", { title: "Handwriting Math Pad", onClick: t, onMouseDown: (w) => w.preventDefault(), className: "p-2 bg-blue-50 border border-blue-200 hover:bg-blue-100 text-blue-700 rounded flex items-center transition-colors shadow-sm", children: /* @__PURE__ */ k("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
11831
11831
|
/* @__PURE__ */ g("path", { d: "M3 12h2l4 8 4-16h6" }),
|
|
11832
11832
|
/* @__PURE__ */ g("path", { d: "m17 8 4 4" }),
|
|
11833
11833
|
/* @__PURE__ */ g("path", { d: "m21 8-4 4" })
|
|
11834
|
-
] }) }) }),
|
|
11835
|
-
switch (
|
|
11834
|
+
] }) }) }), D = (w) => {
|
|
11835
|
+
switch (w) {
|
|
11836
11836
|
case "font":
|
|
11837
|
-
return /* @__PURE__ */ g(
|
|
11837
|
+
return /* @__PURE__ */ g(R, {}, "font");
|
|
11838
11838
|
case "history":
|
|
11839
|
-
return /* @__PURE__ */ g(
|
|
11839
|
+
return /* @__PURE__ */ g(P, {}, "history");
|
|
11840
11840
|
case "formatting":
|
|
11841
|
-
return /* @__PURE__ */ g(
|
|
11841
|
+
return /* @__PURE__ */ g(I, {}, "formatting");
|
|
11842
11842
|
case "colors":
|
|
11843
|
-
return /* @__PURE__ */ g(
|
|
11843
|
+
return /* @__PURE__ */ g(N, {}, "colors");
|
|
11844
11844
|
case "lists":
|
|
11845
|
-
return /* @__PURE__ */ g(
|
|
11845
|
+
return /* @__PURE__ */ g(A, {}, "lists");
|
|
11846
11846
|
case "media":
|
|
11847
|
-
return /* @__PURE__ */ g(
|
|
11847
|
+
return /* @__PURE__ */ g(M, {}, "media");
|
|
11848
11848
|
case "handwriting":
|
|
11849
11849
|
return /* @__PURE__ */ g(L, {}, "handwriting");
|
|
11850
11850
|
default:
|
|
11851
11851
|
return null;
|
|
11852
11852
|
}
|
|
11853
|
-
}, b = E.slice(0, p),
|
|
11854
|
-
return /* @__PURE__ */
|
|
11855
|
-
/* @__PURE__ */
|
|
11856
|
-
/* @__PURE__ */
|
|
11857
|
-
/* @__PURE__ */ g(v, {}),
|
|
11853
|
+
}, b = E.slice(0, p), G = E.slice(p);
|
|
11854
|
+
return /* @__PURE__ */ k("div", { className: "relative", children: [
|
|
11855
|
+
/* @__PURE__ */ k("div", { ref: m, className: "bg-gray-50 p-2 flex items-center gap-3 border-b border-gray-200 rounded-t-lg flex-nowrap overflow-visible", children: [
|
|
11856
|
+
/* @__PURE__ */ k("div", { className: "absolute top-0 left-0 invisible pointer-events-none flex gap-3 whitespace-nowrap overflow-hidden", children: [
|
|
11858
11857
|
/* @__PURE__ */ g(R, {}),
|
|
11859
|
-
/* @__PURE__ */ g(w, {}),
|
|
11860
|
-
/* @__PURE__ */ g(U, {}),
|
|
11861
|
-
/* @__PURE__ */ g(x, {}),
|
|
11862
11858
|
/* @__PURE__ */ g(P, {}),
|
|
11859
|
+
/* @__PURE__ */ g(I, {}),
|
|
11860
|
+
/* @__PURE__ */ g(N, {}),
|
|
11861
|
+
/* @__PURE__ */ g(A, {}),
|
|
11862
|
+
/* @__PURE__ */ g(M, {}),
|
|
11863
11863
|
T && /* @__PURE__ */ g(L, {})
|
|
11864
11864
|
] }),
|
|
11865
|
-
/* @__PURE__ */ g("div", { className: "flex items-center gap-3 flex-nowrap overflow-hidden", children: b.map((
|
|
11866
|
-
|
|
11865
|
+
/* @__PURE__ */ g("div", { className: "flex items-center gap-3 flex-nowrap overflow-hidden", children: b.map((w) => D(w.id)) }),
|
|
11866
|
+
G.length > 0 && /* @__PURE__ */ k("div", { className: "ml-auto relative shrink-0", children: [
|
|
11867
11867
|
/* @__PURE__ */ g(
|
|
11868
11868
|
"button",
|
|
11869
11869
|
{
|
|
@@ -11873,109 +11873,115 @@ const Zc = [
|
|
|
11873
11873
|
children: /* @__PURE__ */ g("svg", { className: "w-5 h-5 text-gray-600", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ g("path", { d: "M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM18 10a2 2 0 11-4 0 2 2 0 014 0z" }) })
|
|
11874
11874
|
}
|
|
11875
11875
|
),
|
|
11876
|
-
d && /* @__PURE__ */ g("div", { className: "absolute right-0 mt-2 bg-white border border-gray-200 shadow-2xl rounded-lg p-3 z-[100] flex flex-col gap-4 min-w-[200px] ring-1 ring-black ring-opacity-5", children:
|
|
11877
|
-
/* @__PURE__ */ g("span", { className: "text-[10px] font-bold text-gray-400 uppercase tracking-tighter", children:
|
|
11878
|
-
/* @__PURE__ */ g("div", { onClick: (
|
|
11879
|
-
] },
|
|
11876
|
+
d && /* @__PURE__ */ g("div", { className: "absolute right-0 mt-2 bg-white border border-gray-200 shadow-2xl rounded-lg p-3 z-[100] flex flex-col gap-4 min-w-[200px] ring-1 ring-black ring-opacity-5", children: G.map((w) => /* @__PURE__ */ k("div", { className: "flex flex-col gap-1", children: [
|
|
11877
|
+
/* @__PURE__ */ g("span", { className: "text-[10px] font-bold text-gray-400 uppercase tracking-tighter", children: w.id }),
|
|
11878
|
+
/* @__PURE__ */ g("div", { onClick: (V) => V.stopPropagation(), children: D(w.id) })
|
|
11879
|
+
] }, w.id)) })
|
|
11880
11880
|
] })
|
|
11881
11881
|
] }),
|
|
11882
11882
|
/* @__PURE__ */ g("input", { type: "file", ref: _, onChange: C, accept: "image/*", className: "hidden" }),
|
|
11883
11883
|
/* @__PURE__ */ g(tf, { isOpen: u, onClose: () => c(!1), onInsert: S }),
|
|
11884
11884
|
d && /* @__PURE__ */ g("div", { className: "fixed inset-0 z-[90]", onClick: () => f(!1) })
|
|
11885
11885
|
] });
|
|
11886
|
-
}, of = be(({ initialContent: t = "", onChange: e, apiKey: n },
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11886
|
+
}, of = be(({ initialContent: t = "", onChange: e, apiKey: n, minHeight: o, maxHeight: s }, l) => {
|
|
11887
|
+
console.log("MaxHeight : ", s);
|
|
11888
|
+
const a = j(null), [u, c] = q(!1), [d, f] = q([t]), [p, h] = q(0), m = j(null), y = p > 0, _ = p < d.length - 1, T = le((I) => {
|
|
11889
|
+
if (I === d[p]) return;
|
|
11890
|
+
const N = d.slice(0, p + 1);
|
|
11891
|
+
N.push(I), N.length > 50 && N.shift(), f(N), h(N.length - 1), e == null || e(I);
|
|
11892
|
+
}, [d, p, e]), v = le(() => {
|
|
11893
|
+
var N;
|
|
11894
|
+
const I = window.getSelection();
|
|
11895
|
+
if (I && I.rangeCount > 0) {
|
|
11896
|
+
const A = I.getRangeAt(0);
|
|
11897
|
+
(N = a.current) != null && N.contains(A.commonAncestorContainer) && (m.current = A.cloneRange());
|
|
11897
11898
|
}
|
|
11898
|
-
}, []),
|
|
11899
|
-
if (
|
|
11900
|
-
const
|
|
11901
|
-
|
|
11899
|
+
}, []), E = le(() => {
|
|
11900
|
+
if (m.current) {
|
|
11901
|
+
const I = window.getSelection();
|
|
11902
|
+
I && (I.removeAllRanges(), I.addRange(m.current));
|
|
11902
11903
|
}
|
|
11903
11904
|
}, []);
|
|
11904
|
-
io(
|
|
11905
|
+
io(l, () => ({
|
|
11905
11906
|
getContent: () => {
|
|
11906
|
-
var
|
|
11907
|
-
return ((
|
|
11907
|
+
var I;
|
|
11908
|
+
return ((I = a.current) == null ? void 0 : I.innerHTML) || "";
|
|
11908
11909
|
},
|
|
11909
|
-
setContent: (
|
|
11910
|
-
|
|
11910
|
+
setContent: (I) => {
|
|
11911
|
+
a.current && (a.current.innerHTML = I, T(I));
|
|
11911
11912
|
}
|
|
11912
11913
|
})), he(() => {
|
|
11913
|
-
|
|
11914
|
+
a.current && (document.execCommand("defaultParagraphSeparator", !1, "p"), t && !a.current.innerHTML && (a.current.innerHTML = t));
|
|
11914
11915
|
}, [t]);
|
|
11915
|
-
const
|
|
11916
|
-
var
|
|
11917
|
-
(
|
|
11918
|
-
},
|
|
11919
|
-
if (
|
|
11920
|
-
const
|
|
11921
|
-
|
|
11916
|
+
const C = (I, N) => {
|
|
11917
|
+
var A, M;
|
|
11918
|
+
(A = a.current) == null || A.focus(), E(), document.execCommand(I, !1, N), v(), T(((M = a.current) == null ? void 0 : M.innerHTML) || "");
|
|
11919
|
+
}, S = () => {
|
|
11920
|
+
if (y) {
|
|
11921
|
+
const I = p - 1;
|
|
11922
|
+
h(I), a.current && (a.current.innerHTML = d[I], e == null || e(d[I]));
|
|
11922
11923
|
}
|
|
11923
|
-
},
|
|
11924
|
-
if (
|
|
11925
|
-
const
|
|
11926
|
-
|
|
11924
|
+
}, R = () => {
|
|
11925
|
+
if (_) {
|
|
11926
|
+
const I = p + 1;
|
|
11927
|
+
h(I), a.current && (a.current.innerHTML = d[I], e == null || e(d[I]));
|
|
11927
11928
|
}
|
|
11928
|
-
},
|
|
11929
|
-
var
|
|
11930
|
-
const
|
|
11931
|
-
let
|
|
11932
|
-
if ((!
|
|
11933
|
-
|
|
11934
|
-
const
|
|
11935
|
-
|
|
11936
|
-
const
|
|
11937
|
-
|
|
11938
|
-
const
|
|
11939
|
-
|
|
11929
|
+
}, P = (I) => {
|
|
11930
|
+
var M, L, D;
|
|
11931
|
+
const N = window.getSelection();
|
|
11932
|
+
let A = m.current;
|
|
11933
|
+
if ((!A || !((M = a.current) != null && M.contains(A.commonAncestorContainer))) && (A = document.createRange(), A.selectNodeContents(a.current), A.collapse(!1)), N && A) {
|
|
11934
|
+
N.removeAllRanges(), N.addRange(A);
|
|
11935
|
+
const b = document.createElement("span");
|
|
11936
|
+
b.contentEditable = "false", b.className = "math-container inline-block mx-1 align-middle", b.innerHTML = I;
|
|
11937
|
+
const G = document.createTextNode(" ");
|
|
11938
|
+
A.deleteContents(), A.insertNode(G), A.insertNode(b);
|
|
11939
|
+
const w = document.createRange();
|
|
11940
|
+
w.setStartAfter(G), w.setEndAfter(G), N.removeAllRanges(), N.addRange(w), (L = a.current) == null || L.focus(), T(((D = a.current) == null ? void 0 : D.innerHTML) || ""), m.current = null;
|
|
11940
11941
|
}
|
|
11941
11942
|
};
|
|
11942
|
-
return /* @__PURE__ */
|
|
11943
|
+
return /* @__PURE__ */ k("div", { className: "w-full bg-white shadow-xl border border-slate-200 flex flex-col transition-all duration-300", children: [
|
|
11943
11944
|
/* @__PURE__ */ g("div", { className: "relative z-20", children: /* @__PURE__ */ g(
|
|
11944
11945
|
nf,
|
|
11945
11946
|
{
|
|
11946
|
-
onApplyStyle:
|
|
11947
|
+
onApplyStyle: C,
|
|
11947
11948
|
onOpenHandwritingModal: () => {
|
|
11948
|
-
|
|
11949
|
+
v(), c(!0);
|
|
11949
11950
|
},
|
|
11950
|
-
onUndo:
|
|
11951
|
-
onRedo:
|
|
11952
|
-
canUndo:
|
|
11953
|
-
canRedo:
|
|
11951
|
+
onUndo: S,
|
|
11952
|
+
onRedo: R,
|
|
11953
|
+
canUndo: y,
|
|
11954
|
+
canRedo: _,
|
|
11954
11955
|
apiKey: n
|
|
11955
11956
|
}
|
|
11956
11957
|
) }),
|
|
11957
11958
|
/* @__PURE__ */ g(
|
|
11958
11959
|
"div",
|
|
11959
11960
|
{
|
|
11960
|
-
ref:
|
|
11961
|
+
ref: a,
|
|
11961
11962
|
contentEditable: !0,
|
|
11962
11963
|
onInput: () => {
|
|
11963
|
-
var
|
|
11964
|
-
return
|
|
11964
|
+
var I;
|
|
11965
|
+
return T(((I = a.current) == null ? void 0 : I.innerHTML) || "");
|
|
11965
11966
|
},
|
|
11966
|
-
onKeyUp:
|
|
11967
|
-
onMouseUp:
|
|
11968
|
-
className: "flex-1 p-10 outline-none prose prose-slate prose-lg max-w-none prose-headings:font-bold prose-a:text-blue-600 prose-img:rounded-xl prose-table:border border-slate-100 bg-white",
|
|
11969
|
-
style: {
|
|
11967
|
+
onKeyUp: v,
|
|
11968
|
+
onMouseUp: v,
|
|
11969
|
+
className: "flex-1 p-10 outline-none prose prose-slate prose-lg max-w-none prose-p:my-1 prose-headings:mt-4 prose-headings:mb-2 prose-li:my-0 prose-ul:my-1 prose-ol:my-1 prose-headings:font-bold prose-a:text-blue-600 prose-img:rounded-xl prose-table:border border-slate-100 bg-white leading-snug",
|
|
11970
|
+
style: {
|
|
11971
|
+
minHeight: `${o != null && o != "" ? o : "200px"}`,
|
|
11972
|
+
maxHeight: `${s != null && s != "" ? s : "250px"}`,
|
|
11973
|
+
overflow: "scroll",
|
|
11974
|
+
fontVariantLigatures: "common-ligatures"
|
|
11975
|
+
}
|
|
11970
11976
|
}
|
|
11971
11977
|
),
|
|
11972
|
-
|
|
11978
|
+
u && /* @__PURE__ */ g(
|
|
11973
11979
|
ef,
|
|
11974
11980
|
{
|
|
11975
|
-
isOpen:
|
|
11976
|
-
onClose: () =>
|
|
11977
|
-
onInsert: (
|
|
11978
|
-
|
|
11981
|
+
isOpen: u,
|
|
11982
|
+
onClose: () => c(!1),
|
|
11983
|
+
onInsert: (I) => {
|
|
11984
|
+
P(I);
|
|
11979
11985
|
},
|
|
11980
11986
|
apiKey: n
|
|
11981
11987
|
}
|