@tombcato/ai-selector-react 0.1.0 → 0.1.2
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/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1244 -3
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +31 -0
- package/dist/index.umd.js.map +1 -0
- package/package.json +41 -41
- package/dist/index-BDJQBhY0.js +0 -2031
- package/dist/index-BDJQBhY0.js.map +0 -1
- package/dist/index-BseB50dK.js +0 -22
- package/dist/index-BseB50dK.js.map +0 -1
- package/dist/index.umd.cjs +0 -31
- package/dist/index.umd.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,1247 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import Ve, { useState as M, useMemo as le, useRef as _e, useEffect as ne, useCallback as ce } from "react";
|
|
2
|
+
import { resolveProviderConfig as gr, createConfigStorage as br, testConnection as yr, I18N as he } from "@tombcato/ai-selector-core";
|
|
3
|
+
import { Ticker as jr } from "@tombcato/smart-ticker";
|
|
4
|
+
function wr(s = {}) {
|
|
5
|
+
var X, G, H, Z, Q;
|
|
6
|
+
const [u, E] = M(((X = s.initialConfig) == null ? void 0 : X.providerId) || ""), [l, C] = M(((G = s.initialConfig) == null ? void 0 : G.apiKey) || ""), [f, b] = M(((H = s.initialConfig) == null ? void 0 : H.model) || ""), [x, c] = M(((Z = s.initialConfig) == null ? void 0 : Z.modelName) || ""), [p, o] = M(((Q = s.initialConfig) == null ? void 0 : Q.baseUrl) || ""), [_, h] = M([]), [A, j] = M("idle"), [I, P] = M(null), [F, w] = M(!1), [k, K] = M(null), O = le(
|
|
7
|
+
() => gr(s.providerConfig),
|
|
8
|
+
[s.providerConfig]
|
|
9
|
+
), R = O.providers, v = le(
|
|
10
|
+
() => R.find((i) => i.id === u) || null,
|
|
11
|
+
[R, u]
|
|
12
|
+
), V = le(() => br(void 0, {
|
|
13
|
+
serialize: s.onSerialize,
|
|
14
|
+
deserialize: s.onDeserialize
|
|
15
|
+
}), [s.onSerialize, s.onDeserialize]), q = _e(/* @__PURE__ */ new Map());
|
|
16
|
+
ne(() => {
|
|
17
|
+
const i = V.load();
|
|
18
|
+
i && (i.providerId && E(i.providerId), i.apiKey && C(i.apiKey), i.model && b(i.model), i.modelName && c(i.modelName), i.baseUrl && o(i.baseUrl));
|
|
19
|
+
}, [V]), ne(() => {
|
|
20
|
+
if (!u || !v) {
|
|
21
|
+
h([]), K(null), w(!1);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const i = v.supportsModelsApi && (!v.needsApiKey || !!l), N = p || v.baseUrl, U = `${u}|${N}|${l}`, J = q.current.get(U);
|
|
25
|
+
if (J) {
|
|
26
|
+
h(J), K(null), w(!1);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (!i) {
|
|
30
|
+
const $ = O.getModels(u);
|
|
31
|
+
h($), q.current.set(U, $), K(null), w(!1);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
w(!0), K(null), _.length === 0 && h(O.getModels(u));
|
|
35
|
+
const ee = setTimeout(async () => {
|
|
36
|
+
try {
|
|
37
|
+
let $;
|
|
38
|
+
s.modelFetcher ? $ = await s.modelFetcher({
|
|
39
|
+
type: "fetchModels",
|
|
40
|
+
providerId: v.id,
|
|
41
|
+
baseUrl: N,
|
|
42
|
+
apiKey: l
|
|
43
|
+
}) : $ = await import("@tombcato/ai-selector-core").then((re) => re.fetchModels({
|
|
44
|
+
provider: v,
|
|
45
|
+
apiKey: l,
|
|
46
|
+
baseUrl: N,
|
|
47
|
+
proxyUrl: s.proxyUrl,
|
|
48
|
+
fallbackToStatic: !1
|
|
49
|
+
})), h($), q.current.set(U, $);
|
|
50
|
+
} catch ($) {
|
|
51
|
+
console.warn("Model fetch failed:", $), K("fetchModelsFailed");
|
|
52
|
+
const re = O.getModels(u);
|
|
53
|
+
h(re);
|
|
54
|
+
} finally {
|
|
55
|
+
w(!1);
|
|
56
|
+
}
|
|
57
|
+
}, 500);
|
|
58
|
+
return () => clearTimeout(ee);
|
|
59
|
+
}, [u, v, l, p, O, s.proxyUrl, s.modelFetcher]), ne(() => {
|
|
60
|
+
(A === "error" || A === "success") && (j("idle"), P(null));
|
|
61
|
+
}, [l, p]);
|
|
62
|
+
const ue = ce(async () => {
|
|
63
|
+
if (!v || v.needsApiKey && !l) return;
|
|
64
|
+
j("testing"), P(null);
|
|
65
|
+
let i;
|
|
66
|
+
if (s.modelFetcher)
|
|
67
|
+
try {
|
|
68
|
+
const N = await s.modelFetcher({
|
|
69
|
+
type: "checkConnection",
|
|
70
|
+
providerId: v.id,
|
|
71
|
+
baseUrl: p || v.baseUrl,
|
|
72
|
+
apiKey: l,
|
|
73
|
+
modelId: f
|
|
74
|
+
});
|
|
75
|
+
i = {
|
|
76
|
+
success: N.success,
|
|
77
|
+
latencyMs: N.latency || N.latencyMs,
|
|
78
|
+
message: N.message
|
|
79
|
+
};
|
|
80
|
+
} catch (N) {
|
|
81
|
+
i = { success: !1, message: N.message || "Unknown error" };
|
|
82
|
+
}
|
|
83
|
+
else
|
|
84
|
+
i = await yr({
|
|
85
|
+
provider: v,
|
|
86
|
+
apiKey: l,
|
|
87
|
+
baseUrl: p,
|
|
88
|
+
model: f,
|
|
89
|
+
proxyUrl: s.proxyUrl
|
|
90
|
+
});
|
|
91
|
+
return P(i), j(i.success ? "success" : "error"), setTimeout(() => {
|
|
92
|
+
j("idle");
|
|
93
|
+
}, 2e3), i;
|
|
94
|
+
}, [v, l, p, f, s.proxyUrl, s.modelFetcher]), de = ce(() => {
|
|
95
|
+
const i = _.find((U) => U.id === f), N = (i == null ? void 0 : i.name) || x || f;
|
|
96
|
+
i != null && i.name && i.name !== x && c(i.name), V.save({
|
|
97
|
+
providerId: u,
|
|
98
|
+
apiKey: l,
|
|
99
|
+
model: f,
|
|
100
|
+
modelName: N,
|
|
101
|
+
baseUrl: p
|
|
102
|
+
});
|
|
103
|
+
}, [u, l, f, x, p, _, V]), se = ce(() => {
|
|
104
|
+
V.clear(), E(""), C(""), b(""), c(""), o("");
|
|
105
|
+
}, [V]), z = ce((i) => {
|
|
106
|
+
E(i), C(""), b(""), c(""), o(""), j("idle"), P(null);
|
|
107
|
+
}, []), B = ce((i, N) => {
|
|
108
|
+
if (b(i), N)
|
|
109
|
+
c(N);
|
|
110
|
+
else {
|
|
111
|
+
const U = _.find((J) => J.id === i);
|
|
112
|
+
c((U == null ? void 0 : U.name) || i);
|
|
113
|
+
}
|
|
114
|
+
}, [_]), Y = le(() => !(!u || !f || v != null && v.needsApiKey && !l), [u, f, v, l]);
|
|
115
|
+
return {
|
|
116
|
+
// State
|
|
117
|
+
config: le(() => ({
|
|
118
|
+
providerId: u,
|
|
119
|
+
apiKey: l,
|
|
120
|
+
model: f,
|
|
121
|
+
modelName: x,
|
|
122
|
+
baseUrl: p || (v == null ? void 0 : v.baseUrl) || ""
|
|
123
|
+
}), [u, l, f, x, p, v]),
|
|
124
|
+
providerId: u,
|
|
125
|
+
apiKey: l,
|
|
126
|
+
model: f,
|
|
127
|
+
modelName: x,
|
|
128
|
+
baseUrl: p,
|
|
129
|
+
models: _,
|
|
130
|
+
testStatus: A,
|
|
131
|
+
testResult: I,
|
|
132
|
+
isFetchingModels: F,
|
|
133
|
+
fetchModelError: k,
|
|
134
|
+
provider: v,
|
|
135
|
+
providers: R,
|
|
136
|
+
isValid: Y,
|
|
137
|
+
// Actions
|
|
138
|
+
setProviderId: z,
|
|
139
|
+
setApiKey: C,
|
|
140
|
+
setModel: b,
|
|
141
|
+
selectModel: B,
|
|
142
|
+
setBaseUrl: o,
|
|
143
|
+
runTest: ue,
|
|
144
|
+
save: de,
|
|
145
|
+
clear: se
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
var ye = { exports: {} }, pe = {};
|
|
149
|
+
/**
|
|
150
|
+
* @license React
|
|
151
|
+
* react-jsx-runtime.production.min.js
|
|
152
|
+
*
|
|
153
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
154
|
+
*
|
|
155
|
+
* This source code is licensed under the MIT license found in the
|
|
156
|
+
* LICENSE file in the root directory of this source tree.
|
|
157
|
+
*/
|
|
158
|
+
var We;
|
|
159
|
+
function kr() {
|
|
160
|
+
if (We) return pe;
|
|
161
|
+
We = 1;
|
|
162
|
+
var s = Ve, u = Symbol.for("react.element"), E = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, C = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
163
|
+
function b(x, c, p) {
|
|
164
|
+
var o, _ = {}, h = null, A = null;
|
|
165
|
+
p !== void 0 && (h = "" + p), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (A = c.ref);
|
|
166
|
+
for (o in c) l.call(c, o) && !f.hasOwnProperty(o) && (_[o] = c[o]);
|
|
167
|
+
if (x && x.defaultProps) for (o in c = x.defaultProps, c) _[o] === void 0 && (_[o] = c[o]);
|
|
168
|
+
return { $$typeof: u, type: x, key: h, ref: A, props: _, _owner: C.current };
|
|
169
|
+
}
|
|
170
|
+
return pe.Fragment = E, pe.jsx = b, pe.jsxs = b, pe;
|
|
171
|
+
}
|
|
172
|
+
var ve = {};
|
|
173
|
+
/**
|
|
174
|
+
* @license React
|
|
175
|
+
* react-jsx-runtime.development.js
|
|
176
|
+
*
|
|
177
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
178
|
+
*
|
|
179
|
+
* This source code is licensed under the MIT license found in the
|
|
180
|
+
* LICENSE file in the root directory of this source tree.
|
|
181
|
+
*/
|
|
182
|
+
var Ke;
|
|
183
|
+
function Cr() {
|
|
184
|
+
return Ke || (Ke = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
185
|
+
var s = Ve, u = Symbol.for("react.element"), E = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), b = Symbol.for("react.provider"), x = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), p = Symbol.for("react.suspense"), o = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), j = Symbol.iterator, I = "@@iterator";
|
|
186
|
+
function P(e) {
|
|
187
|
+
if (e === null || typeof e != "object")
|
|
188
|
+
return null;
|
|
189
|
+
var t = j && e[j] || e[I];
|
|
190
|
+
return typeof t == "function" ? t : null;
|
|
191
|
+
}
|
|
192
|
+
var F = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
193
|
+
function w(e) {
|
|
194
|
+
{
|
|
195
|
+
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), a = 1; a < t; a++)
|
|
196
|
+
n[a - 1] = arguments[a];
|
|
197
|
+
k("error", e, n);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function k(e, t, n) {
|
|
201
|
+
{
|
|
202
|
+
var a = F.ReactDebugCurrentFrame, g = a.getStackAddendum();
|
|
203
|
+
g !== "" && (t += "%s", n = n.concat([g]));
|
|
204
|
+
var y = n.map(function(m) {
|
|
205
|
+
return String(m);
|
|
206
|
+
});
|
|
207
|
+
y.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, y);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
var K = !1, O = !1, R = !1, v = !1, V = !1, q;
|
|
211
|
+
q = Symbol.for("react.module.reference");
|
|
212
|
+
function ue(e) {
|
|
213
|
+
return !!(typeof e == "string" || typeof e == "function" || e === l || e === f || V || e === C || e === p || e === o || v || e === A || K || O || R || typeof e == "object" && e !== null && (e.$$typeof === h || e.$$typeof === _ || e.$$typeof === b || e.$$typeof === x || e.$$typeof === c || // This needs to include all possible module reference object
|
|
214
|
+
// types supported by any Flight configuration anywhere since
|
|
215
|
+
// we don't know which Flight build this will end up being used
|
|
216
|
+
// with.
|
|
217
|
+
e.$$typeof === q || e.getModuleId !== void 0));
|
|
218
|
+
}
|
|
219
|
+
function de(e, t, n) {
|
|
220
|
+
var a = e.displayName;
|
|
221
|
+
if (a)
|
|
222
|
+
return a;
|
|
223
|
+
var g = t.displayName || t.name || "";
|
|
224
|
+
return g !== "" ? n + "(" + g + ")" : n;
|
|
225
|
+
}
|
|
226
|
+
function se(e) {
|
|
227
|
+
return e.displayName || "Context";
|
|
228
|
+
}
|
|
229
|
+
function z(e) {
|
|
230
|
+
if (e == null)
|
|
231
|
+
return null;
|
|
232
|
+
if (typeof e.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
233
|
+
return e.displayName || e.name || null;
|
|
234
|
+
if (typeof e == "string")
|
|
235
|
+
return e;
|
|
236
|
+
switch (e) {
|
|
237
|
+
case l:
|
|
238
|
+
return "Fragment";
|
|
239
|
+
case E:
|
|
240
|
+
return "Portal";
|
|
241
|
+
case f:
|
|
242
|
+
return "Profiler";
|
|
243
|
+
case C:
|
|
244
|
+
return "StrictMode";
|
|
245
|
+
case p:
|
|
246
|
+
return "Suspense";
|
|
247
|
+
case o:
|
|
248
|
+
return "SuspenseList";
|
|
249
|
+
}
|
|
250
|
+
if (typeof e == "object")
|
|
251
|
+
switch (e.$$typeof) {
|
|
252
|
+
case x:
|
|
253
|
+
var t = e;
|
|
254
|
+
return se(t) + ".Consumer";
|
|
255
|
+
case b:
|
|
256
|
+
var n = e;
|
|
257
|
+
return se(n._context) + ".Provider";
|
|
258
|
+
case c:
|
|
259
|
+
return de(e, e.render, "ForwardRef");
|
|
260
|
+
case _:
|
|
261
|
+
var a = e.displayName || null;
|
|
262
|
+
return a !== null ? a : z(e.type) || "Memo";
|
|
263
|
+
case h: {
|
|
264
|
+
var g = e, y = g._payload, m = g._init;
|
|
265
|
+
try {
|
|
266
|
+
return z(m(y));
|
|
267
|
+
} catch {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
var B = Object.assign, Y = 0, fe, X, G, H, Z, Q, i;
|
|
275
|
+
function N() {
|
|
276
|
+
}
|
|
277
|
+
N.__reactDisabledLog = !0;
|
|
278
|
+
function U() {
|
|
279
|
+
{
|
|
280
|
+
if (Y === 0) {
|
|
281
|
+
fe = console.log, X = console.info, G = console.warn, H = console.error, Z = console.group, Q = console.groupCollapsed, i = console.groupEnd;
|
|
282
|
+
var e = {
|
|
283
|
+
configurable: !0,
|
|
284
|
+
enumerable: !0,
|
|
285
|
+
value: N,
|
|
286
|
+
writable: !0
|
|
287
|
+
};
|
|
288
|
+
Object.defineProperties(console, {
|
|
289
|
+
info: e,
|
|
290
|
+
log: e,
|
|
291
|
+
warn: e,
|
|
292
|
+
error: e,
|
|
293
|
+
group: e,
|
|
294
|
+
groupCollapsed: e,
|
|
295
|
+
groupEnd: e
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
Y++;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function J() {
|
|
302
|
+
{
|
|
303
|
+
if (Y--, Y === 0) {
|
|
304
|
+
var e = {
|
|
305
|
+
configurable: !0,
|
|
306
|
+
enumerable: !0,
|
|
307
|
+
writable: !0
|
|
308
|
+
};
|
|
309
|
+
Object.defineProperties(console, {
|
|
310
|
+
log: B({}, e, {
|
|
311
|
+
value: fe
|
|
312
|
+
}),
|
|
313
|
+
info: B({}, e, {
|
|
314
|
+
value: X
|
|
315
|
+
}),
|
|
316
|
+
warn: B({}, e, {
|
|
317
|
+
value: G
|
|
318
|
+
}),
|
|
319
|
+
error: B({}, e, {
|
|
320
|
+
value: H
|
|
321
|
+
}),
|
|
322
|
+
group: B({}, e, {
|
|
323
|
+
value: Z
|
|
324
|
+
}),
|
|
325
|
+
groupCollapsed: B({}, e, {
|
|
326
|
+
value: Q
|
|
327
|
+
}),
|
|
328
|
+
groupEnd: B({}, e, {
|
|
329
|
+
value: i
|
|
330
|
+
})
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
Y < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
var ae = F.ReactCurrentDispatcher, ee;
|
|
337
|
+
function $(e, t, n) {
|
|
338
|
+
{
|
|
339
|
+
if (ee === void 0)
|
|
340
|
+
try {
|
|
341
|
+
throw Error();
|
|
342
|
+
} catch (g) {
|
|
343
|
+
var a = g.stack.trim().match(/\n( *(at )?)/);
|
|
344
|
+
ee = a && a[1] || "";
|
|
345
|
+
}
|
|
346
|
+
return `
|
|
347
|
+
` + ee + e;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
var re = !1, xe;
|
|
351
|
+
{
|
|
352
|
+
var Je = typeof WeakMap == "function" ? WeakMap : Map;
|
|
353
|
+
xe = new Je();
|
|
354
|
+
}
|
|
355
|
+
function Re(e, t) {
|
|
356
|
+
if (!e || re)
|
|
357
|
+
return "";
|
|
358
|
+
{
|
|
359
|
+
var n = xe.get(e);
|
|
360
|
+
if (n !== void 0)
|
|
361
|
+
return n;
|
|
362
|
+
}
|
|
363
|
+
var a;
|
|
364
|
+
re = !0;
|
|
365
|
+
var g = Error.prepareStackTrace;
|
|
366
|
+
Error.prepareStackTrace = void 0;
|
|
367
|
+
var y;
|
|
368
|
+
y = ae.current, ae.current = null, U();
|
|
369
|
+
try {
|
|
370
|
+
if (t) {
|
|
371
|
+
var m = function() {
|
|
372
|
+
throw Error();
|
|
373
|
+
};
|
|
374
|
+
if (Object.defineProperty(m.prototype, "props", {
|
|
375
|
+
set: function() {
|
|
376
|
+
throw Error();
|
|
377
|
+
}
|
|
378
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
379
|
+
try {
|
|
380
|
+
Reflect.construct(m, []);
|
|
381
|
+
} catch (D) {
|
|
382
|
+
a = D;
|
|
383
|
+
}
|
|
384
|
+
Reflect.construct(e, [], m);
|
|
385
|
+
} else {
|
|
386
|
+
try {
|
|
387
|
+
m.call();
|
|
388
|
+
} catch (D) {
|
|
389
|
+
a = D;
|
|
390
|
+
}
|
|
391
|
+
e.call(m.prototype);
|
|
392
|
+
}
|
|
393
|
+
} else {
|
|
394
|
+
try {
|
|
395
|
+
throw Error();
|
|
396
|
+
} catch (D) {
|
|
397
|
+
a = D;
|
|
398
|
+
}
|
|
399
|
+
e();
|
|
400
|
+
}
|
|
401
|
+
} catch (D) {
|
|
402
|
+
if (D && a && typeof D.stack == "string") {
|
|
403
|
+
for (var d = D.stack.split(`
|
|
404
|
+
`), L = a.stack.split(`
|
|
405
|
+
`), T = d.length - 1, S = L.length - 1; T >= 1 && S >= 0 && d[T] !== L[S]; )
|
|
406
|
+
S--;
|
|
407
|
+
for (; T >= 1 && S >= 0; T--, S--)
|
|
408
|
+
if (d[T] !== L[S]) {
|
|
409
|
+
if (T !== 1 || S !== 1)
|
|
410
|
+
do
|
|
411
|
+
if (T--, S--, S < 0 || d[T] !== L[S]) {
|
|
412
|
+
var W = `
|
|
413
|
+
` + d[T].replace(" at new ", " at ");
|
|
414
|
+
return e.displayName && W.includes("<anonymous>") && (W = W.replace("<anonymous>", e.displayName)), typeof e == "function" && xe.set(e, W), W;
|
|
415
|
+
}
|
|
416
|
+
while (T >= 1 && S >= 0);
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
} finally {
|
|
421
|
+
re = !1, ae.current = y, J(), Error.prepareStackTrace = g;
|
|
422
|
+
}
|
|
423
|
+
var oe = e ? e.displayName || e.name : "", te = oe ? $(oe) : "";
|
|
424
|
+
return typeof e == "function" && xe.set(e, te), te;
|
|
425
|
+
}
|
|
426
|
+
function qe(e, t, n) {
|
|
427
|
+
return Re(e, !1);
|
|
428
|
+
}
|
|
429
|
+
function Ge(e) {
|
|
430
|
+
var t = e.prototype;
|
|
431
|
+
return !!(t && t.isReactComponent);
|
|
432
|
+
}
|
|
433
|
+
function ge(e, t, n) {
|
|
434
|
+
if (e == null)
|
|
435
|
+
return "";
|
|
436
|
+
if (typeof e == "function")
|
|
437
|
+
return Re(e, Ge(e));
|
|
438
|
+
if (typeof e == "string")
|
|
439
|
+
return $(e);
|
|
440
|
+
switch (e) {
|
|
441
|
+
case p:
|
|
442
|
+
return $("Suspense");
|
|
443
|
+
case o:
|
|
444
|
+
return $("SuspenseList");
|
|
445
|
+
}
|
|
446
|
+
if (typeof e == "object")
|
|
447
|
+
switch (e.$$typeof) {
|
|
448
|
+
case c:
|
|
449
|
+
return qe(e.render);
|
|
450
|
+
case _:
|
|
451
|
+
return ge(e.type, t, n);
|
|
452
|
+
case h: {
|
|
453
|
+
var a = e, g = a._payload, y = a._init;
|
|
454
|
+
try {
|
|
455
|
+
return ge(y(g), t, n);
|
|
456
|
+
} catch {
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return "";
|
|
461
|
+
}
|
|
462
|
+
var me = Object.prototype.hasOwnProperty, Ne = {}, Te = F.ReactDebugCurrentFrame;
|
|
463
|
+
function be(e) {
|
|
464
|
+
if (e) {
|
|
465
|
+
var t = e._owner, n = ge(e.type, e._source, t ? t.type : null);
|
|
466
|
+
Te.setExtraStackFrame(n);
|
|
467
|
+
} else
|
|
468
|
+
Te.setExtraStackFrame(null);
|
|
469
|
+
}
|
|
470
|
+
function Xe(e, t, n, a, g) {
|
|
471
|
+
{
|
|
472
|
+
var y = Function.call.bind(me);
|
|
473
|
+
for (var m in e)
|
|
474
|
+
if (y(e, m)) {
|
|
475
|
+
var d = void 0;
|
|
476
|
+
try {
|
|
477
|
+
if (typeof e[m] != "function") {
|
|
478
|
+
var L = Error((a || "React class") + ": " + n + " type `" + m + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[m] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
479
|
+
throw L.name = "Invariant Violation", L;
|
|
480
|
+
}
|
|
481
|
+
d = e[m](t, m, a, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
482
|
+
} catch (T) {
|
|
483
|
+
d = T;
|
|
484
|
+
}
|
|
485
|
+
d && !(d instanceof Error) && (be(g), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", a || "React class", n, m, typeof d), be(null)), d instanceof Error && !(d.message in Ne) && (Ne[d.message] = !0, be(g), w("Failed %s type: %s", n, d.message), be(null));
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
var He = Array.isArray;
|
|
490
|
+
function je(e) {
|
|
491
|
+
return He(e);
|
|
492
|
+
}
|
|
493
|
+
function Ze(e) {
|
|
494
|
+
{
|
|
495
|
+
var t = typeof Symbol == "function" && Symbol.toStringTag, n = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
496
|
+
return n;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
function Qe(e) {
|
|
500
|
+
try {
|
|
501
|
+
return Se(e), !1;
|
|
502
|
+
} catch {
|
|
503
|
+
return !0;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
function Se(e) {
|
|
507
|
+
return "" + e;
|
|
508
|
+
}
|
|
509
|
+
function Pe(e) {
|
|
510
|
+
if (Qe(e))
|
|
511
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ze(e)), Se(e);
|
|
512
|
+
}
|
|
513
|
+
var Oe = F.ReactCurrentOwner, er = {
|
|
514
|
+
key: !0,
|
|
515
|
+
ref: !0,
|
|
516
|
+
__self: !0,
|
|
517
|
+
__source: !0
|
|
518
|
+
}, Me, Fe;
|
|
519
|
+
function rr(e) {
|
|
520
|
+
if (me.call(e, "ref")) {
|
|
521
|
+
var t = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
522
|
+
if (t && t.isReactWarning)
|
|
523
|
+
return !1;
|
|
524
|
+
}
|
|
525
|
+
return e.ref !== void 0;
|
|
526
|
+
}
|
|
527
|
+
function tr(e) {
|
|
528
|
+
if (me.call(e, "key")) {
|
|
529
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
530
|
+
if (t && t.isReactWarning)
|
|
531
|
+
return !1;
|
|
532
|
+
}
|
|
533
|
+
return e.key !== void 0;
|
|
534
|
+
}
|
|
535
|
+
function nr(e, t) {
|
|
536
|
+
typeof e.ref == "string" && Oe.current;
|
|
537
|
+
}
|
|
538
|
+
function sr(e, t) {
|
|
539
|
+
{
|
|
540
|
+
var n = function() {
|
|
541
|
+
Me || (Me = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
|
|
542
|
+
};
|
|
543
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
544
|
+
get: n,
|
|
545
|
+
configurable: !0
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
function ar(e, t) {
|
|
550
|
+
{
|
|
551
|
+
var n = function() {
|
|
552
|
+
Fe || (Fe = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
|
|
553
|
+
};
|
|
554
|
+
n.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
555
|
+
get: n,
|
|
556
|
+
configurable: !0
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
var ir = function(e, t, n, a, g, y, m) {
|
|
561
|
+
var d = {
|
|
562
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
563
|
+
$$typeof: u,
|
|
564
|
+
// Built-in properties that belong on the element
|
|
565
|
+
type: e,
|
|
566
|
+
key: t,
|
|
567
|
+
ref: n,
|
|
568
|
+
props: m,
|
|
569
|
+
// Record the component responsible for creating this element.
|
|
570
|
+
_owner: y
|
|
571
|
+
};
|
|
572
|
+
return d._store = {}, Object.defineProperty(d._store, "validated", {
|
|
573
|
+
configurable: !1,
|
|
574
|
+
enumerable: !1,
|
|
575
|
+
writable: !0,
|
|
576
|
+
value: !1
|
|
577
|
+
}), Object.defineProperty(d, "_self", {
|
|
578
|
+
configurable: !1,
|
|
579
|
+
enumerable: !1,
|
|
580
|
+
writable: !1,
|
|
581
|
+
value: a
|
|
582
|
+
}), Object.defineProperty(d, "_source", {
|
|
583
|
+
configurable: !1,
|
|
584
|
+
enumerable: !1,
|
|
585
|
+
writable: !1,
|
|
586
|
+
value: g
|
|
587
|
+
}), Object.freeze && (Object.freeze(d.props), Object.freeze(d)), d;
|
|
588
|
+
};
|
|
589
|
+
function or(e, t, n, a, g) {
|
|
590
|
+
{
|
|
591
|
+
var y, m = {}, d = null, L = null;
|
|
592
|
+
n !== void 0 && (Pe(n), d = "" + n), tr(t) && (Pe(t.key), d = "" + t.key), rr(t) && (L = t.ref, nr(t, g));
|
|
593
|
+
for (y in t)
|
|
594
|
+
me.call(t, y) && !er.hasOwnProperty(y) && (m[y] = t[y]);
|
|
595
|
+
if (e && e.defaultProps) {
|
|
596
|
+
var T = e.defaultProps;
|
|
597
|
+
for (y in T)
|
|
598
|
+
m[y] === void 0 && (m[y] = T[y]);
|
|
599
|
+
}
|
|
600
|
+
if (d || L) {
|
|
601
|
+
var S = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
602
|
+
d && sr(m, S), L && ar(m, S);
|
|
603
|
+
}
|
|
604
|
+
return ir(e, d, L, g, a, Oe.current, m);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
var we = F.ReactCurrentOwner, Le = F.ReactDebugCurrentFrame;
|
|
608
|
+
function ie(e) {
|
|
609
|
+
if (e) {
|
|
610
|
+
var t = e._owner, n = ge(e.type, e._source, t ? t.type : null);
|
|
611
|
+
Le.setExtraStackFrame(n);
|
|
612
|
+
} else
|
|
613
|
+
Le.setExtraStackFrame(null);
|
|
614
|
+
}
|
|
615
|
+
var ke;
|
|
616
|
+
ke = !1;
|
|
617
|
+
function Ce(e) {
|
|
618
|
+
return typeof e == "object" && e !== null && e.$$typeof === u;
|
|
619
|
+
}
|
|
620
|
+
function Ae() {
|
|
621
|
+
{
|
|
622
|
+
if (we.current) {
|
|
623
|
+
var e = z(we.current.type);
|
|
624
|
+
if (e)
|
|
625
|
+
return `
|
|
626
|
+
|
|
627
|
+
Check the render method of \`` + e + "`.";
|
|
628
|
+
}
|
|
629
|
+
return "";
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
function lr(e) {
|
|
633
|
+
return "";
|
|
634
|
+
}
|
|
635
|
+
var Ie = {};
|
|
636
|
+
function cr(e) {
|
|
637
|
+
{
|
|
638
|
+
var t = Ae();
|
|
639
|
+
if (!t) {
|
|
640
|
+
var n = typeof e == "string" ? e : e.displayName || e.name;
|
|
641
|
+
n && (t = `
|
|
642
|
+
|
|
643
|
+
Check the top-level render call using <` + n + ">.");
|
|
644
|
+
}
|
|
645
|
+
return t;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
function Ue(e, t) {
|
|
649
|
+
{
|
|
650
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
651
|
+
return;
|
|
652
|
+
e._store.validated = !0;
|
|
653
|
+
var n = cr(t);
|
|
654
|
+
if (Ie[n])
|
|
655
|
+
return;
|
|
656
|
+
Ie[n] = !0;
|
|
657
|
+
var a = "";
|
|
658
|
+
e && e._owner && e._owner !== we.current && (a = " It was passed a child from " + z(e._owner.type) + "."), ie(e), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, a), ie(null);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
function $e(e, t) {
|
|
662
|
+
{
|
|
663
|
+
if (typeof e != "object")
|
|
664
|
+
return;
|
|
665
|
+
if (je(e))
|
|
666
|
+
for (var n = 0; n < e.length; n++) {
|
|
667
|
+
var a = e[n];
|
|
668
|
+
Ce(a) && Ue(a, t);
|
|
669
|
+
}
|
|
670
|
+
else if (Ce(e))
|
|
671
|
+
e._store && (e._store.validated = !0);
|
|
672
|
+
else if (e) {
|
|
673
|
+
var g = P(e);
|
|
674
|
+
if (typeof g == "function" && g !== e.entries)
|
|
675
|
+
for (var y = g.call(e), m; !(m = y.next()).done; )
|
|
676
|
+
Ce(m.value) && Ue(m.value, t);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
function ur(e) {
|
|
681
|
+
{
|
|
682
|
+
var t = e.type;
|
|
683
|
+
if (t == null || typeof t == "string")
|
|
684
|
+
return;
|
|
685
|
+
var n;
|
|
686
|
+
if (typeof t == "function")
|
|
687
|
+
n = t.propTypes;
|
|
688
|
+
else if (typeof t == "object" && (t.$$typeof === c || // Note: Memo only checks outer props here.
|
|
689
|
+
// Inner props are checked in the reconciler.
|
|
690
|
+
t.$$typeof === _))
|
|
691
|
+
n = t.propTypes;
|
|
692
|
+
else
|
|
693
|
+
return;
|
|
694
|
+
if (n) {
|
|
695
|
+
var a = z(t);
|
|
696
|
+
Xe(n, e.props, "prop", a, e);
|
|
697
|
+
} else if (t.PropTypes !== void 0 && !ke) {
|
|
698
|
+
ke = !0;
|
|
699
|
+
var g = z(t);
|
|
700
|
+
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", g || "Unknown");
|
|
701
|
+
}
|
|
702
|
+
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
function dr(e) {
|
|
706
|
+
{
|
|
707
|
+
for (var t = Object.keys(e.props), n = 0; n < t.length; n++) {
|
|
708
|
+
var a = t[n];
|
|
709
|
+
if (a !== "children" && a !== "key") {
|
|
710
|
+
ie(e), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), ie(null);
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
e.ref !== null && (ie(e), w("Invalid attribute `ref` supplied to `React.Fragment`."), ie(null));
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
var De = {};
|
|
718
|
+
function ze(e, t, n, a, g, y) {
|
|
719
|
+
{
|
|
720
|
+
var m = ue(e);
|
|
721
|
+
if (!m) {
|
|
722
|
+
var d = "";
|
|
723
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (d += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
724
|
+
var L = lr();
|
|
725
|
+
L ? d += L : d += Ae();
|
|
726
|
+
var T;
|
|
727
|
+
e === null ? T = "null" : je(e) ? T = "array" : e !== void 0 && e.$$typeof === u ? (T = "<" + (z(e.type) || "Unknown") + " />", d = " Did you accidentally export a JSX literal instead of a component?") : T = typeof e, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", T, d);
|
|
728
|
+
}
|
|
729
|
+
var S = or(e, t, n, g, y);
|
|
730
|
+
if (S == null)
|
|
731
|
+
return S;
|
|
732
|
+
if (m) {
|
|
733
|
+
var W = t.children;
|
|
734
|
+
if (W !== void 0)
|
|
735
|
+
if (a)
|
|
736
|
+
if (je(W)) {
|
|
737
|
+
for (var oe = 0; oe < W.length; oe++)
|
|
738
|
+
$e(W[oe], e);
|
|
739
|
+
Object.freeze && Object.freeze(W);
|
|
740
|
+
} else
|
|
741
|
+
w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
742
|
+
else
|
|
743
|
+
$e(W, e);
|
|
744
|
+
}
|
|
745
|
+
if (me.call(t, "key")) {
|
|
746
|
+
var te = z(e), D = Object.keys(t).filter(function(xr) {
|
|
747
|
+
return xr !== "key";
|
|
748
|
+
}), Ee = D.length > 0 ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
749
|
+
if (!De[te + Ee]) {
|
|
750
|
+
var hr = D.length > 0 ? "{" + D.join(": ..., ") + ": ...}" : "{}";
|
|
751
|
+
w(`A props object containing a "key" prop is being spread into JSX:
|
|
752
|
+
let props = %s;
|
|
753
|
+
<%s {...props} />
|
|
754
|
+
React keys must be passed directly to JSX without using spread:
|
|
755
|
+
let props = %s;
|
|
756
|
+
<%s key={someKey} {...props} />`, Ee, te, hr, te), De[te + Ee] = !0;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
return e === l ? dr(S) : ur(S), S;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
function fr(e, t, n) {
|
|
763
|
+
return ze(e, t, n, !0);
|
|
764
|
+
}
|
|
765
|
+
function mr(e, t, n) {
|
|
766
|
+
return ze(e, t, n, !1);
|
|
767
|
+
}
|
|
768
|
+
var pr = mr, vr = fr;
|
|
769
|
+
ve.Fragment = l, ve.jsx = pr, ve.jsxs = vr;
|
|
770
|
+
})()), ve;
|
|
771
|
+
}
|
|
772
|
+
var Be;
|
|
773
|
+
function Er() {
|
|
774
|
+
return Be || (Be = 1, process.env.NODE_ENV === "production" ? ye.exports = kr() : ye.exports = Cr()), ye.exports;
|
|
775
|
+
}
|
|
776
|
+
var r = Er();
|
|
777
|
+
function Ye({ text: s, className: u = "", placeholder: E }) {
|
|
778
|
+
return !s && E ? /* @__PURE__ */ r.jsx("span", { className: `apmsu-placeholder ${u}`, children: E }) : s ? /* @__PURE__ */ r.jsx("span", { className: `inline-flex min-w-0 ${u}`, children: /* @__PURE__ */ r.jsx(jr, { value: s, charWidth: 0.8, duration: 300 }) }) : null;
|
|
779
|
+
}
|
|
780
|
+
function _r({
|
|
781
|
+
providers: s,
|
|
782
|
+
selectedProviderId: u,
|
|
783
|
+
onSelect: E,
|
|
784
|
+
isOpen: l,
|
|
785
|
+
setIsOpen: C,
|
|
786
|
+
disabled: f,
|
|
787
|
+
language: b = "zh"
|
|
788
|
+
}) {
|
|
789
|
+
const x = he[b], c = _e(null), p = s.find((o) => o.id === u);
|
|
790
|
+
return ne(() => {
|
|
791
|
+
const o = (_) => {
|
|
792
|
+
c.current && !c.current.contains(_.target) && C(!1);
|
|
793
|
+
};
|
|
794
|
+
return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
|
|
795
|
+
}, [C]), /* @__PURE__ */ r.jsxs("div", { className: "apmsu-field", ref: c, children: [
|
|
796
|
+
/* @__PURE__ */ r.jsx("label", { className: "apmsu-label", children: x.providerLabel }),
|
|
797
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
798
|
+
/* @__PURE__ */ r.jsxs(
|
|
799
|
+
"button",
|
|
800
|
+
{
|
|
801
|
+
type: "button",
|
|
802
|
+
onClick: () => !f && C(!l),
|
|
803
|
+
disabled: f,
|
|
804
|
+
className: "apmsu-select-trigger",
|
|
805
|
+
children: [
|
|
806
|
+
p ? /* @__PURE__ */ r.jsxs("span", { className: "flex items-center gap-2 min-w-0", children: [
|
|
807
|
+
/* @__PURE__ */ r.jsx(
|
|
808
|
+
"img",
|
|
809
|
+
{
|
|
810
|
+
src: p.icon,
|
|
811
|
+
alt: p.name,
|
|
812
|
+
className: "apmsu-provider-icon"
|
|
813
|
+
}
|
|
814
|
+
),
|
|
815
|
+
/* @__PURE__ */ r.jsx(Ye, { text: p.name })
|
|
816
|
+
] }) : /* @__PURE__ */ r.jsx("span", { className: "apmsu-placeholder", children: x.selectProvider }),
|
|
817
|
+
/* @__PURE__ */ r.jsx(Rr, { isOpen: l })
|
|
818
|
+
]
|
|
819
|
+
}
|
|
820
|
+
),
|
|
821
|
+
/* @__PURE__ */ r.jsx("div", { className: `apmsu-dropdown max-h-[300px] overflow-auto p-1 origin-top ${l ? "apmsu-dropdown-open" : ""}`, children: s.map((o) => /* @__PURE__ */ r.jsxs(
|
|
822
|
+
"button",
|
|
823
|
+
{
|
|
824
|
+
type: "button",
|
|
825
|
+
onClick: () => {
|
|
826
|
+
E(o.id), C(!1);
|
|
827
|
+
},
|
|
828
|
+
className: `apmsu-dropdown-item rounded-sm ${u === o.id ? "apmsu-dropdown-item-active" : ""}`,
|
|
829
|
+
children: [
|
|
830
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2 flex-shrink-0", children: [
|
|
831
|
+
/* @__PURE__ */ r.jsx(
|
|
832
|
+
"img",
|
|
833
|
+
{
|
|
834
|
+
src: o.icon,
|
|
835
|
+
alt: o.name,
|
|
836
|
+
className: "apmsu-provider-icon"
|
|
837
|
+
}
|
|
838
|
+
),
|
|
839
|
+
/* @__PURE__ */ r.jsx("span", { className: "font-medium whitespace-nowrap", children: o.name })
|
|
840
|
+
] }),
|
|
841
|
+
/* @__PURE__ */ r.jsx("span", { className: "apmsu-hint-text ml-auto text-right truncate flex-1 min-w-0", children: o.baseUrl.replace("https://", "") })
|
|
842
|
+
]
|
|
843
|
+
},
|
|
844
|
+
o.id
|
|
845
|
+
)) })
|
|
846
|
+
] })
|
|
847
|
+
] });
|
|
848
|
+
}
|
|
849
|
+
const Rr = ({ isOpen: s }) => /* @__PURE__ */ r.jsx(
|
|
850
|
+
"svg",
|
|
851
|
+
{
|
|
852
|
+
className: `apmsu-chevron ${s ? "rotate-180" : ""}`,
|
|
853
|
+
fill: "none",
|
|
854
|
+
stroke: "currentColor",
|
|
855
|
+
viewBox: "0 0 24 24",
|
|
856
|
+
children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
857
|
+
}
|
|
858
|
+
);
|
|
859
|
+
function Nr({
|
|
860
|
+
provider: s,
|
|
861
|
+
apiKey: u,
|
|
862
|
+
onChange: E,
|
|
863
|
+
testStatus: l,
|
|
864
|
+
disabled: C,
|
|
865
|
+
language: f = "zh"
|
|
866
|
+
}) {
|
|
867
|
+
const [b, x] = M(!1), c = he[f];
|
|
868
|
+
if (!s || !s.needsApiKey) return null;
|
|
869
|
+
const p = () => l === "success" ? "apmsu-input apmsu-input-success" : "apmsu-input apmsu-input-default";
|
|
870
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "space-y-2", children: [
|
|
871
|
+
/* @__PURE__ */ r.jsx("label", { className: "apmsu-label", children: c.apiKeyLabel }),
|
|
872
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
873
|
+
/* @__PURE__ */ r.jsx(
|
|
874
|
+
"input",
|
|
875
|
+
{
|
|
876
|
+
type: b ? "text" : "password",
|
|
877
|
+
value: u,
|
|
878
|
+
onChange: (o) => E(o.target.value),
|
|
879
|
+
onFocus: () => x(!0),
|
|
880
|
+
onBlur: () => x(!1),
|
|
881
|
+
placeholder: c.apiKeyPlaceholder,
|
|
882
|
+
disabled: C,
|
|
883
|
+
className: `${p()} pr-10`
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
/* @__PURE__ */ r.jsx("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center", children: b ? /* @__PURE__ */ r.jsxs("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
|
|
887
|
+
/* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" }),
|
|
888
|
+
/* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" })
|
|
889
|
+
] }) : /* @__PURE__ */ r.jsx("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" }) }) })
|
|
890
|
+
] })
|
|
891
|
+
] });
|
|
892
|
+
}
|
|
893
|
+
function Tr({
|
|
894
|
+
provider: s,
|
|
895
|
+
models: u,
|
|
896
|
+
selectedModelId: E,
|
|
897
|
+
onSelect: l,
|
|
898
|
+
isOpen: C,
|
|
899
|
+
setIsOpen: f,
|
|
900
|
+
hasApiKey: b,
|
|
901
|
+
disabled: x,
|
|
902
|
+
language: c = "zh",
|
|
903
|
+
isFetchingModels: p,
|
|
904
|
+
fetchModelError: o,
|
|
905
|
+
selectedModelName: _
|
|
906
|
+
}) {
|
|
907
|
+
var w;
|
|
908
|
+
const h = he[c], A = _e(null), [j, I] = M("");
|
|
909
|
+
ne(() => {
|
|
910
|
+
const k = (K) => {
|
|
911
|
+
A.current && !A.current.contains(K.target) && (f(!1), I(""));
|
|
912
|
+
};
|
|
913
|
+
return document.addEventListener("mousedown", k), () => document.removeEventListener("mousedown", k);
|
|
914
|
+
}, [f]);
|
|
915
|
+
const P = u.filter(
|
|
916
|
+
(k) => k.name.toLowerCase().includes(j.toLowerCase()) || k.id.toLowerCase().includes(j.toLowerCase())
|
|
917
|
+
), F = ((w = u.find((k) => k.id === E)) == null ? void 0 : w.name) || _ || E;
|
|
918
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "apmsu-field", ref: A, children: [
|
|
919
|
+
/* @__PURE__ */ r.jsx("label", { className: "apmsu-label flex items-center justify-between", children: /* @__PURE__ */ r.jsx("span", { children: h.modelLabel }) }),
|
|
920
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
921
|
+
/* @__PURE__ */ r.jsxs(
|
|
922
|
+
"button",
|
|
923
|
+
{
|
|
924
|
+
type: "button",
|
|
925
|
+
onClick: () => !x && s && f(!C),
|
|
926
|
+
disabled: x || !s,
|
|
927
|
+
className: "apmsu-select-trigger",
|
|
928
|
+
children: [
|
|
929
|
+
/* @__PURE__ */ r.jsx(
|
|
930
|
+
Ye,
|
|
931
|
+
{
|
|
932
|
+
text: F,
|
|
933
|
+
placeholder: h.selectModel
|
|
934
|
+
}
|
|
935
|
+
),
|
|
936
|
+
/* @__PURE__ */ r.jsx(Sr, { isOpen: C })
|
|
937
|
+
]
|
|
938
|
+
}
|
|
939
|
+
),
|
|
940
|
+
/* @__PURE__ */ r.jsxs("div", { className: `apmsu-dropdown origin-top ${C ? "apmsu-dropdown-open" : ""}`, children: [
|
|
941
|
+
/* @__PURE__ */ r.jsx("div", { className: "p-1.5 apmsu-divider", children: /* @__PURE__ */ r.jsx(
|
|
942
|
+
"input",
|
|
943
|
+
{
|
|
944
|
+
type: "text",
|
|
945
|
+
value: j,
|
|
946
|
+
onChange: (k) => I(k.target.value),
|
|
947
|
+
placeholder: h.searchModel,
|
|
948
|
+
className: "apmsu-select-trigger",
|
|
949
|
+
autoFocus: C
|
|
950
|
+
}
|
|
951
|
+
) }),
|
|
952
|
+
/* @__PURE__ */ r.jsxs("div", { className: "max-h-60 overflow-auto", children: [
|
|
953
|
+
j && !P.some((k) => k.id === j) && /* @__PURE__ */ r.jsx(
|
|
954
|
+
"button",
|
|
955
|
+
{
|
|
956
|
+
type: "button",
|
|
957
|
+
onClick: () => {
|
|
958
|
+
l(j), f(!1), I("");
|
|
959
|
+
},
|
|
960
|
+
className: "apmsu-dropdown-item bg-blue-50 dark:bg-blue-900/20 border-b",
|
|
961
|
+
children: /* @__PURE__ */ r.jsxs("span", { className: "text-blue-500", children: [
|
|
962
|
+
h.useCustom,
|
|
963
|
+
": ",
|
|
964
|
+
j
|
|
965
|
+
] })
|
|
966
|
+
}
|
|
967
|
+
),
|
|
968
|
+
P.map((k) => /* @__PURE__ */ r.jsx(
|
|
969
|
+
"button",
|
|
970
|
+
{
|
|
971
|
+
type: "button",
|
|
972
|
+
onClick: () => {
|
|
973
|
+
l(k.id, k.name), f(!1), I("");
|
|
974
|
+
},
|
|
975
|
+
className: `apmsu-dropdown-item ${E === k.id ? "apmsu-dropdown-item-active" : ""}`,
|
|
976
|
+
children: /* @__PURE__ */ r.jsx("span", { children: k.name })
|
|
977
|
+
},
|
|
978
|
+
k.id
|
|
979
|
+
)),
|
|
980
|
+
P.length === 0 && !j && /* @__PURE__ */ r.jsx("div", { className: "p-4 text-center apmsu-hint-text", children: h.noModels })
|
|
981
|
+
] })
|
|
982
|
+
] })
|
|
983
|
+
] }),
|
|
984
|
+
(s == null ? void 0 : s.supportsModelsApi) && /* @__PURE__ */ r.jsx("div", { className: "min-h-[20px] flex items-center", children: p ? /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text animate-pulse", children: h.refreshingModels }) : o ? /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text dark:text-zinc-500", children: h[o] || o }) : s != null && s.needsApiKey && !b ? /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text", children: h.apiKeyTip }) : /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text", children: h.modelListUpdated }) })
|
|
985
|
+
] });
|
|
986
|
+
}
|
|
987
|
+
const Sr = ({ isOpen: s }) => /* @__PURE__ */ r.jsx(
|
|
988
|
+
"svg",
|
|
989
|
+
{
|
|
990
|
+
className: `apmsu-chevron ${s ? "rotate-180" : ""}`,
|
|
991
|
+
fill: "none",
|
|
992
|
+
stroke: "currentColor",
|
|
993
|
+
viewBox: "0 0 24 24",
|
|
994
|
+
children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
995
|
+
}
|
|
996
|
+
);
|
|
997
|
+
function Pr({
|
|
998
|
+
provider: s,
|
|
999
|
+
baseUrl: u,
|
|
1000
|
+
onChange: E,
|
|
1001
|
+
disabled: l,
|
|
1002
|
+
language: C = "zh"
|
|
1003
|
+
}) {
|
|
1004
|
+
const [f, b] = M(!1), x = he[C];
|
|
1005
|
+
return s ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1006
|
+
/* @__PURE__ */ r.jsxs(
|
|
1007
|
+
"button",
|
|
1008
|
+
{
|
|
1009
|
+
type: "button",
|
|
1010
|
+
onClick: () => b(!f),
|
|
1011
|
+
className: "text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 flex items-center gap-1 transition-colors",
|
|
1012
|
+
children: [
|
|
1013
|
+
/* @__PURE__ */ r.jsx(
|
|
1014
|
+
"svg",
|
|
1015
|
+
{
|
|
1016
|
+
className: `w-3 h-3 transition-transform ${f ? "rotate-90" : ""}`,
|
|
1017
|
+
fill: "none",
|
|
1018
|
+
stroke: "currentColor",
|
|
1019
|
+
viewBox: "0 0 24 24",
|
|
1020
|
+
children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
|
|
1021
|
+
}
|
|
1022
|
+
),
|
|
1023
|
+
x.customBaseUrl
|
|
1024
|
+
]
|
|
1025
|
+
}
|
|
1026
|
+
),
|
|
1027
|
+
/* @__PURE__ */ r.jsx(
|
|
1028
|
+
"div",
|
|
1029
|
+
{
|
|
1030
|
+
className: "grid transition-all duration-200 ease-out",
|
|
1031
|
+
style: { gridTemplateRows: f ? "1fr" : "0fr" },
|
|
1032
|
+
children: /* @__PURE__ */ r.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ r.jsx(
|
|
1033
|
+
"input",
|
|
1034
|
+
{
|
|
1035
|
+
type: "text",
|
|
1036
|
+
value: u,
|
|
1037
|
+
onChange: (c) => E(c.target.value),
|
|
1038
|
+
placeholder: s.baseUrl,
|
|
1039
|
+
disabled: l,
|
|
1040
|
+
className: "apmsu-input apmsu-input-default"
|
|
1041
|
+
}
|
|
1042
|
+
) })
|
|
1043
|
+
}
|
|
1044
|
+
)
|
|
1045
|
+
] }) : null;
|
|
1046
|
+
}
|
|
1047
|
+
function Ur({
|
|
1048
|
+
proxyUrl: s,
|
|
1049
|
+
config: u,
|
|
1050
|
+
initialConfig: E,
|
|
1051
|
+
title: l,
|
|
1052
|
+
showPreview: C = !1,
|
|
1053
|
+
saveButtonText: f,
|
|
1054
|
+
disabled: b = !1,
|
|
1055
|
+
onSave: x,
|
|
1056
|
+
onTestResult: c,
|
|
1057
|
+
onChange: p,
|
|
1058
|
+
onSerialize: o,
|
|
1059
|
+
onDeserialize: _,
|
|
1060
|
+
language: h = "zh",
|
|
1061
|
+
modelFetcher: A
|
|
1062
|
+
}) {
|
|
1063
|
+
const j = le(() => he[h], [h]), {
|
|
1064
|
+
providerId: I,
|
|
1065
|
+
apiKey: P,
|
|
1066
|
+
model: F,
|
|
1067
|
+
modelName: w,
|
|
1068
|
+
baseUrl: k,
|
|
1069
|
+
models: K,
|
|
1070
|
+
testStatus: O,
|
|
1071
|
+
testResult: R,
|
|
1072
|
+
provider: v,
|
|
1073
|
+
providers: V,
|
|
1074
|
+
isValid: q,
|
|
1075
|
+
setProviderId: ue,
|
|
1076
|
+
setApiKey: de,
|
|
1077
|
+
selectModel: se,
|
|
1078
|
+
setBaseUrl: z,
|
|
1079
|
+
runTest: B,
|
|
1080
|
+
save: Y,
|
|
1081
|
+
isFetchingModels: fe,
|
|
1082
|
+
fetchModelError: X,
|
|
1083
|
+
config: G
|
|
1084
|
+
} = wr({
|
|
1085
|
+
proxyUrl: s,
|
|
1086
|
+
providerConfig: u,
|
|
1087
|
+
initialConfig: E,
|
|
1088
|
+
onSerialize: o,
|
|
1089
|
+
onDeserialize: _,
|
|
1090
|
+
modelFetcher: A
|
|
1091
|
+
}), [H, Z] = M(!1), [Q, i] = M(!1), [N, U] = M("idle"), [J, ae] = M(!1);
|
|
1092
|
+
ne(() => {
|
|
1093
|
+
p == null || p({ providerId: I, apiKey: P, model: F, baseUrl: k });
|
|
1094
|
+
}, [I, P, F, k, p]), ne(() => {
|
|
1095
|
+
R && (c == null || c(R));
|
|
1096
|
+
}, [R, c]);
|
|
1097
|
+
const ee = ce(() => {
|
|
1098
|
+
Y(), U("saved"), x == null || x(G), setTimeout(() => U("idle"), 2e3);
|
|
1099
|
+
}, [Y, x, G]);
|
|
1100
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "apmsu-card", children: [
|
|
1101
|
+
l && /* @__PURE__ */ r.jsx("h2", { className: "text-lg font-semibold mb-4", children: l }),
|
|
1102
|
+
/* @__PURE__ */ r.jsxs("div", { className: "space-y-3", children: [
|
|
1103
|
+
/* @__PURE__ */ r.jsx(
|
|
1104
|
+
_r,
|
|
1105
|
+
{
|
|
1106
|
+
providers: V,
|
|
1107
|
+
selectedProviderId: I,
|
|
1108
|
+
onSelect: ue,
|
|
1109
|
+
isOpen: H,
|
|
1110
|
+
setIsOpen: Z,
|
|
1111
|
+
disabled: b,
|
|
1112
|
+
language: h
|
|
1113
|
+
}
|
|
1114
|
+
),
|
|
1115
|
+
/* @__PURE__ */ r.jsx(
|
|
1116
|
+
Pr,
|
|
1117
|
+
{
|
|
1118
|
+
provider: v,
|
|
1119
|
+
baseUrl: k,
|
|
1120
|
+
onChange: z,
|
|
1121
|
+
disabled: b,
|
|
1122
|
+
language: h
|
|
1123
|
+
}
|
|
1124
|
+
),
|
|
1125
|
+
/* @__PURE__ */ r.jsx("div", { className: `transition-all duration-500 ease-in-out ${I ? "max-h-[1000px] opacity-100 overflow-visible" : "max-h-0 opacity-0 overflow-hidden"}`, children: /* @__PURE__ */ r.jsxs("div", { className: "space-y-4", children: [
|
|
1126
|
+
/* @__PURE__ */ r.jsx(
|
|
1127
|
+
Nr,
|
|
1128
|
+
{
|
|
1129
|
+
provider: v,
|
|
1130
|
+
apiKey: P,
|
|
1131
|
+
onChange: de,
|
|
1132
|
+
testStatus: O,
|
|
1133
|
+
disabled: b,
|
|
1134
|
+
language: h
|
|
1135
|
+
}
|
|
1136
|
+
),
|
|
1137
|
+
/* @__PURE__ */ r.jsx(
|
|
1138
|
+
Tr,
|
|
1139
|
+
{
|
|
1140
|
+
provider: v,
|
|
1141
|
+
models: K,
|
|
1142
|
+
selectedModelId: F,
|
|
1143
|
+
onSelect: se,
|
|
1144
|
+
isOpen: Q,
|
|
1145
|
+
setIsOpen: i,
|
|
1146
|
+
hasApiKey: !!P,
|
|
1147
|
+
disabled: b,
|
|
1148
|
+
language: h,
|
|
1149
|
+
isFetchingModels: fe,
|
|
1150
|
+
fetchModelError: X,
|
|
1151
|
+
selectedModelName: w
|
|
1152
|
+
}
|
|
1153
|
+
)
|
|
1154
|
+
] }) }),
|
|
1155
|
+
/* @__PURE__ */ r.jsxs("div", { className: "pt-2 space-y-2", children: [
|
|
1156
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex gap-2", children: [
|
|
1157
|
+
/* @__PURE__ */ r.jsx(
|
|
1158
|
+
"button",
|
|
1159
|
+
{
|
|
1160
|
+
onClick: () => B(),
|
|
1161
|
+
disabled: !I || !P || !F || b || O === "testing",
|
|
1162
|
+
className: `apmsu-btn flex-1 ${O === "success" ? "apmsu-btn-success" : O === "error" ? "bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-900/40" : "apmsu-btn-ghost border border-gray-200 dark:border-zinc-700"}`,
|
|
1163
|
+
children: O === "testing" ? /* @__PURE__ */ r.jsxs("span", { className: "flex items-center justify-center gap-2", children: [
|
|
1164
|
+
/* @__PURE__ */ r.jsx(Or, {}),
|
|
1165
|
+
j.testing
|
|
1166
|
+
] }) : O === "success" ? /* @__PURE__ */ r.jsxs("span", { className: "flex items-center justify-center gap-2", children: [
|
|
1167
|
+
/* @__PURE__ */ r.jsx(Mr, {}),
|
|
1168
|
+
j.testSuccess,
|
|
1169
|
+
" ",
|
|
1170
|
+
(R == null ? void 0 : R.latencyMs) && `${R.latencyMs}ms`
|
|
1171
|
+
] }) : O === "error" ? /* @__PURE__ */ r.jsxs("span", { className: "flex items-center justify-center gap-2", children: [
|
|
1172
|
+
/* @__PURE__ */ r.jsx(Fr, {}),
|
|
1173
|
+
j.testFailed
|
|
1174
|
+
] }) : j.testConnection
|
|
1175
|
+
}
|
|
1176
|
+
),
|
|
1177
|
+
/* @__PURE__ */ r.jsx(
|
|
1178
|
+
"button",
|
|
1179
|
+
{
|
|
1180
|
+
onClick: ee,
|
|
1181
|
+
disabled: !q || b,
|
|
1182
|
+
className: `apmsu-btn flex-1 ${N === "saved" ? "apmsu-btn-success" : "apmsu-btn-primary"}`,
|
|
1183
|
+
children: N === "saved" ? /* @__PURE__ */ r.jsxs("span", { className: "flex items-center justify-center gap-2", children: [
|
|
1184
|
+
/* @__PURE__ */ r.jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) }),
|
|
1185
|
+
j.saved
|
|
1186
|
+
] }) : f || j.save
|
|
1187
|
+
}
|
|
1188
|
+
)
|
|
1189
|
+
] }),
|
|
1190
|
+
/* @__PURE__ */ r.jsx(
|
|
1191
|
+
"div",
|
|
1192
|
+
{
|
|
1193
|
+
className: "grid transition-all duration-200 ease-out",
|
|
1194
|
+
style: { gridTemplateRows: !(R != null && R.success) && (R != null && R.message) && O !== "testing" && O !== "success" ? "1fr" : "0fr" },
|
|
1195
|
+
children: /* @__PURE__ */ r.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ r.jsx("div", { className: "p-2 rounded-md bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800", children: /* @__PURE__ */ r.jsx("p", { className: "text-xs text-red-600 dark:text-red-400 line-clamp-3 text-left", children: R == null ? void 0 : R.message }) }) })
|
|
1196
|
+
}
|
|
1197
|
+
)
|
|
1198
|
+
] })
|
|
1199
|
+
] }),
|
|
1200
|
+
C && v && /* @__PURE__ */ r.jsxs("div", { className: "mt-6 border border-gray-200/50 dark:border-zinc-800 rounded-lg overflow-hidden", children: [
|
|
1201
|
+
/* @__PURE__ */ r.jsxs(
|
|
1202
|
+
"button",
|
|
1203
|
+
{
|
|
1204
|
+
type: "button",
|
|
1205
|
+
onClick: () => ae(!J),
|
|
1206
|
+
className: "w-full flex items-center justify-between px-4 py-3 bg-zinc-50 dark:bg-zinc-900/50 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors",
|
|
1207
|
+
children: [
|
|
1208
|
+
/* @__PURE__ */ r.jsx("h3", { className: "text-xs font-medium text-gray-500 dark:text-zinc-500 uppercase tracking-wider", children: j.preview }),
|
|
1209
|
+
/* @__PURE__ */ r.jsx(
|
|
1210
|
+
"svg",
|
|
1211
|
+
{
|
|
1212
|
+
className: `w-4 h-4 text-gray-400 transition-transform duration-200 ${J ? "rotate-180" : ""}`,
|
|
1213
|
+
fill: "none",
|
|
1214
|
+
stroke: "currentColor",
|
|
1215
|
+
viewBox: "0 0 24 24",
|
|
1216
|
+
children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
1217
|
+
}
|
|
1218
|
+
)
|
|
1219
|
+
]
|
|
1220
|
+
}
|
|
1221
|
+
),
|
|
1222
|
+
/* @__PURE__ */ r.jsx(
|
|
1223
|
+
"div",
|
|
1224
|
+
{
|
|
1225
|
+
className: "grid transition-all duration-200 ease-out",
|
|
1226
|
+
style: { gridTemplateRows: J ? "1fr" : "0fr" },
|
|
1227
|
+
children: /* @__PURE__ */ r.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ r.jsx("pre", { className: "text-xs text-gray-600 dark:text-zinc-400 font-mono overflow-x-auto leading-relaxed p-4 bg-zinc-50 dark:bg-zinc-900/50", children: JSON.stringify({
|
|
1228
|
+
provider: v.name,
|
|
1229
|
+
apiFormat: v.apiFormat,
|
|
1230
|
+
baseUrl: k || v.baseUrl,
|
|
1231
|
+
model: F || j.unselected,
|
|
1232
|
+
hasApiKey: !!P
|
|
1233
|
+
}, null, 2) }) })
|
|
1234
|
+
}
|
|
1235
|
+
)
|
|
1236
|
+
] })
|
|
1237
|
+
] });
|
|
1238
|
+
}
|
|
1239
|
+
const Or = () => /* @__PURE__ */ r.jsxs("svg", { className: "apmsu-icon-spin", viewBox: "0 0 24 24", fill: "none", children: [
|
|
1240
|
+
/* @__PURE__ */ r.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
1241
|
+
/* @__PURE__ */ r.jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
|
|
1242
|
+
] }), Mr = () => /* @__PURE__ */ r.jsx("svg", { className: "apmsu-icon-success", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ r.jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) }), Fr = () => /* @__PURE__ */ r.jsx("svg", { className: "apmsu-icon-error", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ r.jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) });
|
|
2
1243
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
1244
|
+
Ur as AIConfigForm,
|
|
1245
|
+
wr as useAIConfig
|
|
5
1246
|
};
|
|
6
1247
|
//# sourceMappingURL=index.js.map
|