@openspecui/web 3.11.4 → 3.11.5
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/assets/CanvasRenderer-B4xoxAIc.js +1 -0
- package/dist/assets/WebGLRenderer-B0Jtk0nh.js +1 -0
- package/dist/assets/WebGPURenderer-Cfl-sqIJ.js +1 -0
- package/dist/assets/browserAll-BAtKDoiA.js +1 -0
- package/dist/assets/{dist-B85dtRfx.js → dist-B1OAaHtN.js} +1 -1
- package/dist/assets/{dist-BZECNWGg.js → dist-BD5mncFZ.js} +1 -1
- package/dist/assets/{dist-BRxF7Jkf.js → dist-BPXRU7xA.js} +1 -1
- package/dist/assets/dist-BPb0nckX.js +1 -0
- package/dist/assets/{dist-CbJQUXs0.js → dist-BoE24RpQ.js} +1 -1
- package/dist/assets/{dist-SfwxOhmW.js → dist-C4vm2Q_T.js} +1 -1
- package/dist/assets/dist-C5Si4P75.js +1 -0
- package/dist/assets/{dist-CmKsGuOc.js → dist-CM2xvCkf.js} +1 -1
- package/dist/assets/dist-CyBfJ6hc.js +1 -0
- package/dist/assets/{dist-zpg9m3aC.js → dist-DHe7I_KZ.js} +1 -1
- package/dist/assets/{dist-BfZLQFwN.js → dist-DSuLZBKC.js} +1 -1
- package/dist/assets/{dist-DiwHgET9.js → dist-iayOqDE6.js} +1 -1
- package/dist/assets/{init-fMWSa5Px.js → init-DUi_seZz.js} +1 -1
- package/dist/assets/{main-X9jaWXie.css → main-BBjD638P.css} +1 -1
- package/dist/assets/{main-C9sK_hBV.js → main-CWtuI7Nz.js} +170 -170
- package/dist/assets/trpc-C0ZfTMd0.js +1 -0
- package/dist/assets/webworkerAll-s8l06Z4r.js +1 -0
- package/dist/index.html +2 -2
- package/dist-ssg/client/.vite/ssr-manifest.json +15 -15
- package/dist-ssg/client/assets/CanvasRenderer-C0SJkAx_.js +1 -0
- package/dist-ssg/client/assets/WebGLRenderer-_kPaznMR.js +1 -0
- package/dist-ssg/client/assets/WebGPURenderer-BxiyOM-9.js +1 -0
- package/dist-ssg/client/assets/browserAll-gJgi68_s.js +1 -0
- package/dist-ssg/client/assets/{dist-BCjKNKOg.js → dist-BHOFHtBx.js} +1 -1
- package/dist-ssg/client/assets/{dist-DgYslwM5.js → dist-BZziKvqb.js} +1 -1
- package/dist-ssg/client/assets/{dist-B9IiVt9G.js → dist-BjFWEmHB.js} +1 -1
- package/dist-ssg/client/assets/{dist-B6MkJ-H7.js → dist-BnZ2HTAx.js} +1 -1
- package/dist-ssg/client/assets/{dist-CjF4SWnb.js → dist-Bv4vhBN7.js} +1 -1
- package/dist-ssg/client/assets/{dist-CFjNhfqM.js → dist-CIuFQ_JU.js} +1 -1
- package/dist-ssg/client/assets/dist-CrxbKAeY.js +1 -0
- package/dist-ssg/client/assets/{dist-Ch_E0jle.js → dist-CsJzUP3e.js} +1 -1
- package/dist-ssg/client/assets/dist-DI0_1FlR.js +1 -0
- package/dist-ssg/client/assets/{dist-CIMwXheF.js → dist-DMB6LAIC.js} +1 -1
- package/dist-ssg/client/assets/dist-DtUEqoN7.js +1 -0
- package/dist-ssg/client/assets/{dist-CNLvbQSx.js → dist-n4MxMk4A.js} +1 -1
- package/dist-ssg/client/assets/{ghostty-web-BYk-wneR.js → ghostty-web-BcYHa-ju.js} +1 -1
- package/dist-ssg/client/assets/{index-8OoZ339S.css → index-CinxwuFk.css} +1 -1
- package/dist-ssg/client/assets/{index.ssg-BWQbO3uy.js → index.ssg-VKLGiOJL.js} +145 -145
- package/dist-ssg/client/assets/{init-DnSi5N8V.js → init-BotiXPO-.js} +1 -1
- package/dist-ssg/client/assets/trpc-C4pu2wyc.js +1 -0
- package/dist-ssg/client/assets/webworkerAll-DBwLgZ3e.js +1 -0
- package/dist-ssg/client/index.ssg.html +2 -2
- package/dist-ssg/server/entry-server.js +321 -11
- package/package.json +3 -3
- package/dist/assets/CanvasRenderer-CaB1iANG.js +0 -1
- package/dist/assets/WebGLRenderer-BQkM8hJI.js +0 -1
- package/dist/assets/WebGPURenderer-DL2luov0.js +0 -1
- package/dist/assets/browserAll-77yDI0Dz.js +0 -1
- package/dist/assets/dist-B8IUilny.js +0 -1
- package/dist/assets/dist-Djq8Qfgl.js +0 -1
- package/dist/assets/dist-DpKtO7Rd.js +0 -1
- package/dist/assets/trpc-CYA_MIjc.js +0 -1
- package/dist/assets/webworkerAll-BDQFYrM_.js +0 -1
- package/dist-ssg/client/assets/CanvasRenderer-tPU4vV1i.js +0 -1
- package/dist-ssg/client/assets/WebGLRenderer-8XaEJZ8d.js +0 -1
- package/dist-ssg/client/assets/WebGPURenderer-D_U45dp8.js +0 -1
- package/dist-ssg/client/assets/browserAll-6a90eROj.js +0 -1
- package/dist-ssg/client/assets/dist-Bqpf_8HF.js +0 -1
- package/dist-ssg/client/assets/dist-CWcubuXa.js +0 -1
- package/dist-ssg/client/assets/dist-D2pHEmiw.js +0 -1
- package/dist-ssg/client/assets/trpc-BhXIjp-3.js +0 -1
- package/dist-ssg/client/assets/webworkerAll-Dp42RyhF.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{it as e}from"./Geometry-DYOOLchf.js";import{E as t,T as n}from"./index.ssg-
|
|
1
|
+
import{it as e}from"./Geometry-DYOOLchf.js";import{E as t,T as n}from"./index.ssg-VKLGiOJL.js";e.add(n),e.add(t);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as e}from"./index.ssg-VKLGiOJL.js";export{e as trpcClient};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./Geometry-DYOOLchf.js";import"./index.ssg-VKLGiOJL.js";import"./init-BotiXPO-.js";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<script>
|
|
9
9
|
window.__OPENSPEC_BASE_PATH__ = '/'
|
|
10
10
|
</script>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index.ssg-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index.ssg-VKLGiOJL.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/chunk-DECur_0Z.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/dist-UN0VvTJo.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/dist-DK_X22KS.js">
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/getTextureBatchBindGroup-BZ3pD2UV.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/BufferResource-4Jl_6qej.js">
|
|
20
20
|
<link rel="modulepreload" crossorigin href="/assets/ImageSource-_DLFcjTj.js">
|
|
21
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
21
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CinxwuFk.css">
|
|
22
22
|
</head>
|
|
23
23
|
<body>
|
|
24
24
|
<div id="root"><!--app-html--></div>
|
|
@@ -32665,24 +32665,47 @@ var TranslationOpenAISettingsSchema = objectType({
|
|
|
32665
32665
|
token: stringType().default(""),
|
|
32666
32666
|
model: stringType().default("gpt-4.1-mini")
|
|
32667
32667
|
});
|
|
32668
|
+
var TranslationOpenAISettingsUpdateSchema = objectType({
|
|
32669
|
+
baseUrl: stringType().optional(),
|
|
32670
|
+
token: stringType().optional(),
|
|
32671
|
+
model: stringType().optional()
|
|
32672
|
+
});
|
|
32668
32673
|
var TranslationLocalSettingsSchema = objectType({
|
|
32669
32674
|
model: stringType().default("Xenova/nllb-200-distilled-600M"),
|
|
32670
32675
|
selectedGroupId: stringType().optional(),
|
|
32671
32676
|
hfEndpoint: stringType().default(""),
|
|
32672
32677
|
memoryBudgetPercent: numberType().min(0).max(100).default(25)
|
|
32673
32678
|
});
|
|
32679
|
+
var TranslationLocalSettingsUpdateSchema = objectType({
|
|
32680
|
+
model: stringType().min(1).optional(),
|
|
32681
|
+
selectedGroupId: stringType().min(1).nullable().optional(),
|
|
32682
|
+
hfEndpoint: stringType().optional(),
|
|
32683
|
+
memoryBudgetPercent: numberType().min(0).max(100).optional()
|
|
32684
|
+
});
|
|
32674
32685
|
var TranslationLocalCt2SettingsSchema = objectType({
|
|
32675
32686
|
model: stringType().default("ooeoeo/opus-mt-en-zh-ct2-float16"),
|
|
32676
32687
|
selectedGroupId: stringType().optional(),
|
|
32677
32688
|
hfEndpoint: stringType().default(""),
|
|
32678
32689
|
memoryBudgetPercent: numberType().min(0).max(100).default(25)
|
|
32679
32690
|
});
|
|
32691
|
+
var TranslationLocalCt2SettingsUpdateSchema = objectType({
|
|
32692
|
+
model: stringType().min(1).optional(),
|
|
32693
|
+
selectedGroupId: stringType().min(1).nullable().optional(),
|
|
32694
|
+
hfEndpoint: stringType().optional(),
|
|
32695
|
+
memoryBudgetPercent: numberType().min(0).max(100).optional()
|
|
32696
|
+
});
|
|
32680
32697
|
var TranslationLocalLlamaSettingsSchema = objectType({
|
|
32681
32698
|
model: stringType().default("bartowski/Qwen2.5-0.5B-Instruct-GGUF"),
|
|
32682
32699
|
selectedGroupId: stringType().optional(),
|
|
32683
32700
|
hfEndpoint: stringType().default(""),
|
|
32684
32701
|
memoryBudgetPercent: numberType().min(0).max(100).default(25)
|
|
32685
32702
|
});
|
|
32703
|
+
var TranslationLocalLlamaSettingsUpdateSchema = objectType({
|
|
32704
|
+
model: stringType().min(1).optional(),
|
|
32705
|
+
selectedGroupId: stringType().min(1).nullable().optional(),
|
|
32706
|
+
hfEndpoint: stringType().optional(),
|
|
32707
|
+
memoryBudgetPercent: numberType().min(0).max(100).optional()
|
|
32708
|
+
});
|
|
32686
32709
|
objectType({
|
|
32687
32710
|
engineId: TranslationEngineIdSchema.default(DEFAULT_TRANSLATION_ENGINE_ID),
|
|
32688
32711
|
openai: TranslationOpenAISettingsSchema.default(TranslationOpenAISettingsSchema.parse({})),
|
|
@@ -32690,6 +32713,13 @@ objectType({
|
|
|
32690
32713
|
localCt2: TranslationLocalCt2SettingsSchema.default(TranslationLocalCt2SettingsSchema.parse({})),
|
|
32691
32714
|
localLlama: TranslationLocalLlamaSettingsSchema.default(TranslationLocalLlamaSettingsSchema.parse({}))
|
|
32692
32715
|
});
|
|
32716
|
+
objectType({
|
|
32717
|
+
engineId: TranslationEngineIdSchema.optional(),
|
|
32718
|
+
openai: TranslationOpenAISettingsUpdateSchema.optional(),
|
|
32719
|
+
local: TranslationLocalSettingsUpdateSchema.optional(),
|
|
32720
|
+
localCt2: TranslationLocalCt2SettingsUpdateSchema.optional(),
|
|
32721
|
+
localLlama: TranslationLocalLlamaSettingsUpdateSchema.optional()
|
|
32722
|
+
});
|
|
32693
32723
|
objectType({
|
|
32694
32724
|
engineId: TranslationEngineIdSchema,
|
|
32695
32725
|
sourceLanguage: stringType().min(1),
|
|
@@ -32725,6 +32755,21 @@ var TranslationEngineProjectSettingsSchema = objectType({
|
|
|
32725
32755
|
}).default({}),
|
|
32726
32756
|
openai: objectType({ model: stringType().min(1).optional() }).default({})
|
|
32727
32757
|
}).default({});
|
|
32758
|
+
var TranslationEngineProjectSettingsUpdateSchema = objectType({
|
|
32759
|
+
local: objectType({
|
|
32760
|
+
model: stringType().min(1).optional(),
|
|
32761
|
+
selectedGroupId: stringType().min(1).nullable().optional()
|
|
32762
|
+
}).optional(),
|
|
32763
|
+
localCt2: objectType({
|
|
32764
|
+
model: stringType().min(1).optional(),
|
|
32765
|
+
selectedGroupId: stringType().min(1).nullable().optional()
|
|
32766
|
+
}).optional(),
|
|
32767
|
+
localLlama: objectType({
|
|
32768
|
+
model: stringType().min(1).optional(),
|
|
32769
|
+
selectedGroupId: stringType().min(1).nullable().optional()
|
|
32770
|
+
}).optional(),
|
|
32771
|
+
openai: objectType({ model: stringType().min(1).optional() }).optional()
|
|
32772
|
+
});
|
|
32728
32773
|
var DocumentTranslationConfigSchema = objectType({
|
|
32729
32774
|
enabled: booleanType().default(false),
|
|
32730
32775
|
targetLanguage: stringType().min(1).default("zh"),
|
|
@@ -32733,7 +32778,18 @@ var DocumentTranslationConfigSchema = objectType({
|
|
|
32733
32778
|
engineId: TranslationEngineIdSchema.default(DEFAULT_TRANSLATION_ENGINE_ID),
|
|
32734
32779
|
engines: TranslationEngineProjectSettingsSchema
|
|
32735
32780
|
});
|
|
32736
|
-
objectType({
|
|
32781
|
+
objectType({
|
|
32782
|
+
enabled: booleanType().optional(),
|
|
32783
|
+
targetLanguage: stringType().min(1).optional(),
|
|
32784
|
+
displayMode: DocumentTranslationDisplayModeSchema.optional(),
|
|
32785
|
+
cacheEnabled: booleanType().optional(),
|
|
32786
|
+
engineId: TranslationEngineIdSchema.optional(),
|
|
32787
|
+
engines: TranslationEngineProjectSettingsUpdateSchema.optional()
|
|
32788
|
+
});
|
|
32789
|
+
var DEFAULT_TRANSLATION_CACHE_ENTRY_LIMIT = 1e4;
|
|
32790
|
+
var MAX_TRANSLATION_CACHE_ENTRY_LIMIT = 2e5;
|
|
32791
|
+
objectType({ entryLimit: numberType().int().min(100).max(MAX_TRANSLATION_CACHE_ENTRY_LIMIT).default(DEFAULT_TRANSLATION_CACHE_ENTRY_LIMIT) });
|
|
32792
|
+
objectType({ entryLimit: numberType().int().min(100).max(MAX_TRANSLATION_CACHE_ENTRY_LIMIT).optional() });
|
|
32737
32793
|
objectType({
|
|
32738
32794
|
key: stringType().min(1),
|
|
32739
32795
|
keyHash: stringType().min(1),
|
|
@@ -115117,6 +115173,25 @@ function navigateHashAnchor(anchorElement, hash) {
|
|
|
115117
115173
|
}
|
|
115118
115174
|
//#endregion
|
|
115119
115175
|
//#region ../browser-translator/dist/index.mjs
|
|
115176
|
+
var DEFAULT_SOURCE_LANGUAGE$1 = "en";
|
|
115177
|
+
async function probeBrowserTranslator(targetLanguage, sourceLanguage = DEFAULT_SOURCE_LANGUAGE$1, win = window) {
|
|
115178
|
+
const translator = win.Translator;
|
|
115179
|
+
if (!translator) return {
|
|
115180
|
+
availability: "missing",
|
|
115181
|
+
message: "Browser Translator API is not exposed."
|
|
115182
|
+
};
|
|
115183
|
+
try {
|
|
115184
|
+
return { availability: normalizeAvailability$1(await translator.availability({
|
|
115185
|
+
sourceLanguage,
|
|
115186
|
+
targetLanguage
|
|
115187
|
+
})) };
|
|
115188
|
+
} catch (error) {
|
|
115189
|
+
return {
|
|
115190
|
+
availability: "error",
|
|
115191
|
+
message: getErrorMessage$1(error)
|
|
115192
|
+
};
|
|
115193
|
+
}
|
|
115194
|
+
}
|
|
115120
115195
|
async function scanBrowserTranslationSupportTable(options) {
|
|
115121
115196
|
const translator = (options.win ?? window).Translator;
|
|
115122
115197
|
if (!translator) return {
|
|
@@ -115174,6 +115249,63 @@ async function scanBrowserTranslationSupportTable(options) {
|
|
|
115174
115249
|
rows
|
|
115175
115250
|
};
|
|
115176
115251
|
}
|
|
115252
|
+
async function prepareBrowserTranslator(targetLanguage, options) {
|
|
115253
|
+
const sourceLanguage = options.sourceLanguage ?? DEFAULT_SOURCE_LANGUAGE$1;
|
|
115254
|
+
const win = options.win ?? window;
|
|
115255
|
+
const translator = win.Translator;
|
|
115256
|
+
if (!translator) return {
|
|
115257
|
+
availability: "missing",
|
|
115258
|
+
message: "Browser Translator API is not exposed."
|
|
115259
|
+
};
|
|
115260
|
+
try {
|
|
115261
|
+
const initialStatus = await probeBrowserTranslator(targetLanguage, sourceLanguage, win);
|
|
115262
|
+
if (initialStatus.availability === "missing" || initialStatus.availability === "unavailable" || initialStatus.availability === "error") {
|
|
115263
|
+
options.onStatus?.(initialStatus);
|
|
115264
|
+
return initialStatus;
|
|
115265
|
+
}
|
|
115266
|
+
if (initialStatus.availability === "available") {
|
|
115267
|
+
options.onStatus?.(initialStatus);
|
|
115268
|
+
return initialStatus;
|
|
115269
|
+
}
|
|
115270
|
+
options.onStatus?.({
|
|
115271
|
+
availability: "downloading",
|
|
115272
|
+
message: "Downloading browser translation support."
|
|
115273
|
+
});
|
|
115274
|
+
(await raceAbort$1(translator.create({
|
|
115275
|
+
sourceLanguage,
|
|
115276
|
+
targetLanguage,
|
|
115277
|
+
signal: options.signal,
|
|
115278
|
+
monitor: (monitor) => monitorDownload(monitor, { setStatus(input) {
|
|
115279
|
+
options.onStatus?.({
|
|
115280
|
+
availability: "downloading",
|
|
115281
|
+
progress: input.progress,
|
|
115282
|
+
message: input.message
|
|
115283
|
+
});
|
|
115284
|
+
} })
|
|
115285
|
+
}), options.signal)).destroy?.();
|
|
115286
|
+
const finalStatus = {
|
|
115287
|
+
availability: "available",
|
|
115288
|
+
message: "Browser translator is ready."
|
|
115289
|
+
};
|
|
115290
|
+
options.onStatus?.(finalStatus);
|
|
115291
|
+
return finalStatus;
|
|
115292
|
+
} catch (error) {
|
|
115293
|
+
if (options.signal.aborted) {
|
|
115294
|
+
const cancelledStatus = {
|
|
115295
|
+
availability: "downloadable",
|
|
115296
|
+
message: "Browser translation download was cancelled."
|
|
115297
|
+
};
|
|
115298
|
+
options.onStatus?.(cancelledStatus);
|
|
115299
|
+
return cancelledStatus;
|
|
115300
|
+
}
|
|
115301
|
+
const failureStatus = {
|
|
115302
|
+
availability: "error",
|
|
115303
|
+
message: getErrorMessage$1(error)
|
|
115304
|
+
};
|
|
115305
|
+
options.onStatus?.(failureStatus);
|
|
115306
|
+
return failureStatus;
|
|
115307
|
+
}
|
|
115308
|
+
}
|
|
115177
115309
|
var BrowserTranslatorFactory = class {
|
|
115178
115310
|
constructor(win = window) {
|
|
115179
115311
|
this.win = win;
|
|
@@ -136904,6 +137036,18 @@ var SUPPORTED_TRANSLATION_LANGUAGE_CODES = new Set(SUPPORTED_TRANSLATION_LANGUAG
|
|
|
136904
137036
|
function isBrowserTranslationSupported() {
|
|
136905
137037
|
return typeof window !== "undefined" && !!window.Translator;
|
|
136906
137038
|
}
|
|
137039
|
+
async function prepareBrowserTranslation(targetLanguage, input) {
|
|
137040
|
+
if (typeof window === "undefined") return {
|
|
137041
|
+
availability: "missing",
|
|
137042
|
+
message: "Browser translation is not available."
|
|
137043
|
+
};
|
|
137044
|
+
return prepareBrowserTranslator(targetLanguage, {
|
|
137045
|
+
sourceLanguage: input.sourceLanguage ?? DEFAULT_SOURCE_LANGUAGE,
|
|
137046
|
+
signal: input.signal,
|
|
137047
|
+
onStatus: input.onStatus,
|
|
137048
|
+
win: window
|
|
137049
|
+
});
|
|
137050
|
+
}
|
|
136907
137051
|
function getBrowserSupportTableState(targetLanguage) {
|
|
136908
137052
|
return browserSupportTableCache.get(normalizeBrowserSupportTargetKey(targetLanguage)) ?? null;
|
|
136909
137053
|
}
|
|
@@ -137777,6 +137921,7 @@ function toMarkdownFactKindFromHast(tagName) {
|
|
|
137777
137921
|
if (/^h[1-6]$/.test(tagName)) return "heading";
|
|
137778
137922
|
if (tagName === "li") return "listItem";
|
|
137779
137923
|
if (tagName === "blockquote") return "blockquote";
|
|
137924
|
+
if (tagName === "td" || tagName === "th") return "tableCell";
|
|
137780
137925
|
return "paragraph";
|
|
137781
137926
|
}
|
|
137782
137927
|
function toTranslationSegmentKindFromHast(tagName) {
|
|
@@ -138189,12 +138334,20 @@ function projectTranslateServiceStatus(input) {
|
|
|
138189
138334
|
message: input.browserCapabilityLoading ? "Browser translation capability is being checked." : "Browser translator will be checked before translation starts."
|
|
138190
138335
|
};
|
|
138191
138336
|
switch (input.browserCapability.availability) {
|
|
138192
|
-
case "available":
|
|
138193
|
-
|
|
138337
|
+
case "available": return {
|
|
138338
|
+
state: "ready",
|
|
138339
|
+
engineId: "browser",
|
|
138340
|
+
message: input.browserCapability.message ?? "Browser translator is ready."
|
|
138341
|
+
};
|
|
138342
|
+
case "downloadable": return {
|
|
138343
|
+
state: "ready",
|
|
138344
|
+
engineId: "browser",
|
|
138345
|
+
message: input.browserCapability.message ?? "Browser translation support will be downloaded when translation starts."
|
|
138346
|
+
};
|
|
138194
138347
|
case "downloading": return {
|
|
138195
138348
|
state: "ready",
|
|
138196
138349
|
engineId: "browser",
|
|
138197
|
-
message: "Browser
|
|
138350
|
+
message: input.browserCapability.message ?? "Browser translation support is downloading and will continue when ready."
|
|
138198
138351
|
};
|
|
138199
138352
|
case "missing":
|
|
138200
138353
|
case "unavailable":
|
|
@@ -138263,6 +138416,7 @@ function isLocalAssetReady(asset, selectedGroupId) {
|
|
|
138263
138416
|
}
|
|
138264
138417
|
//#endregion
|
|
138265
138418
|
//#region src/lib/translate-service.ts
|
|
138419
|
+
var DEFAULT_BROWSER_SOURCE_LANGUAGE = "en";
|
|
138266
138420
|
async function resolveTranslateServiceState(input) {
|
|
138267
138421
|
const config = input.config;
|
|
138268
138422
|
if (!config?.enabled || !input.hasSource) return emitTranslateServiceState(input.onUpdate, { status: projectTranslateServiceStatus({
|
|
@@ -138424,7 +138578,7 @@ function prepareTranslateServiceRun(input) {
|
|
|
138424
138578
|
hasSource: input.hasSource,
|
|
138425
138579
|
engineId: input.config.engineId
|
|
138426
138580
|
}) });
|
|
138427
|
-
const preferredRow =
|
|
138581
|
+
const preferredRow = selectPreferredBrowserSupportRow(input.browserSupportTable);
|
|
138428
138582
|
if (!preferredRow) return createTranslateServiceState({
|
|
138429
138583
|
browserSupportTable: input.browserSupportTable,
|
|
138430
138584
|
status: projectTranslateServiceStatus({
|
|
@@ -138452,6 +138606,51 @@ function prepareTranslateServiceRun(input) {
|
|
|
138452
138606
|
})
|
|
138453
138607
|
});
|
|
138454
138608
|
}
|
|
138609
|
+
async function ensureBrowserTranslationReady(input) {
|
|
138610
|
+
const preferredRow = selectPreferredBrowserSupportRow(input.browserSupportTable, input.sourceLanguage);
|
|
138611
|
+
const sourceLanguage = input.sourceLanguage?.trim() || preferredRow?.sourceLanguage || DEFAULT_BROWSER_SOURCE_LANGUAGE;
|
|
138612
|
+
if (!sourceLanguage) throw new Error("No browser translation language pair is available to prepare.");
|
|
138613
|
+
if (preferredRow?.availability === "available" && normalizeBrowserLanguageTag(preferredRow.sourceLanguage) === normalizeBrowserLanguageTag(sourceLanguage)) return {
|
|
138614
|
+
capability: {
|
|
138615
|
+
availability: "available",
|
|
138616
|
+
message: preferredRow.message
|
|
138617
|
+
},
|
|
138618
|
+
browserSupportTable: input.browserSupportTable,
|
|
138619
|
+
sourceLanguage
|
|
138620
|
+
};
|
|
138621
|
+
let nextTable = input.browserSupportTable;
|
|
138622
|
+
const emit = (capability) => {
|
|
138623
|
+
nextTable = patchBrowserSupportTableRow(input.targetLanguage, {
|
|
138624
|
+
sourceLanguage,
|
|
138625
|
+
targetLanguage: input.targetLanguage,
|
|
138626
|
+
availability: capability.availability,
|
|
138627
|
+
progress: capability.progress,
|
|
138628
|
+
message: capability.message
|
|
138629
|
+
}, { state: capability.availability === "error" ? "error" : "ready" });
|
|
138630
|
+
input.onUpdate?.({
|
|
138631
|
+
capability,
|
|
138632
|
+
browserSupportTable: nextTable,
|
|
138633
|
+
sourceLanguage
|
|
138634
|
+
});
|
|
138635
|
+
};
|
|
138636
|
+
const finalStatus = await prepareBrowserTranslation(input.targetLanguage, {
|
|
138637
|
+
sourceLanguage,
|
|
138638
|
+
signal: input.signal ?? new AbortController().signal,
|
|
138639
|
+
onStatus: emit
|
|
138640
|
+
});
|
|
138641
|
+
if (input.signal?.aborted) throw new DOMException("The operation was aborted.", "AbortError");
|
|
138642
|
+
if (finalStatus.availability !== "available") throw new Error(finalStatus.message ?? "Browser translator is not ready.");
|
|
138643
|
+
const readyCapability = {
|
|
138644
|
+
availability: "available",
|
|
138645
|
+
message: finalStatus.message
|
|
138646
|
+
};
|
|
138647
|
+
emit(readyCapability);
|
|
138648
|
+
return {
|
|
138649
|
+
capability: readyCapability,
|
|
138650
|
+
browserSupportTable: nextTable,
|
|
138651
|
+
sourceLanguage
|
|
138652
|
+
};
|
|
138653
|
+
}
|
|
138455
138654
|
function createTranslationEngineExecution(config) {
|
|
138456
138655
|
if (config.engineId === "browser" || isStaticMode()) return createBrowserTranslationExecution();
|
|
138457
138656
|
const model = config.engineId === "openai" ? config.engines.openai.model : getManagedLocalEngineConfig(config).model;
|
|
@@ -138493,6 +138692,18 @@ function getManagedLocalEngineConfig(config) {
|
|
|
138493
138692
|
selectedGroupId: config.engines.local.selectedGroupId
|
|
138494
138693
|
};
|
|
138495
138694
|
}
|
|
138695
|
+
function selectPreferredBrowserSupportRow(browserSupportTable, sourceLanguage) {
|
|
138696
|
+
const rows = browserSupportTable?.table?.rows ?? [];
|
|
138697
|
+
if (sourceLanguage) {
|
|
138698
|
+
const normalizedSourceLanguage = normalizeBrowserLanguageTag(sourceLanguage);
|
|
138699
|
+
const matchingRow = rows.find((row) => normalizeBrowserLanguageTag(row.sourceLanguage) === normalizedSourceLanguage);
|
|
138700
|
+
if (matchingRow) return matchingRow;
|
|
138701
|
+
}
|
|
138702
|
+
return rows.find((row) => row.availability === "available") ?? rows.find((row) => row.availability === "downloading") ?? rows.find((row) => row.availability === "downloadable") ?? null;
|
|
138703
|
+
}
|
|
138704
|
+
function normalizeBrowserLanguageTag(language) {
|
|
138705
|
+
return language.trim().toLowerCase();
|
|
138706
|
+
}
|
|
138496
138707
|
async function queryManagedLocalPanelState(engineId, input) {
|
|
138497
138708
|
return engineId === "local" ? trpcClient.localModels.panelState.query(input) : engineId === "local-ct2" ? trpcClient.localCt2Models.panelState.query(input) : trpcClient.localLlamaModels.panelState.query(input);
|
|
138498
138709
|
}
|
|
@@ -138593,8 +138804,6 @@ function useDocumentTranslation(markdown, config) {
|
|
|
138593
138804
|
(0, import_react.useEffect)(() => reset, [reset]);
|
|
138594
138805
|
(0, import_react.useEffect)(() => {
|
|
138595
138806
|
generationRef.current += 1;
|
|
138596
|
-
setCapability(null);
|
|
138597
|
-
setBrowserSupportTable(null);
|
|
138598
138807
|
segmentPatchMapRef.current.clear();
|
|
138599
138808
|
setResult(null);
|
|
138600
138809
|
setStatus("source");
|
|
@@ -138613,6 +138822,21 @@ function useDocumentTranslation(markdown, config) {
|
|
|
138613
138822
|
config?.engines.openai.model,
|
|
138614
138823
|
config?.targetLanguage
|
|
138615
138824
|
]);
|
|
138825
|
+
(0, import_react.useEffect)(() => {
|
|
138826
|
+
setCapability(null);
|
|
138827
|
+
setBrowserSupportTable(null);
|
|
138828
|
+
}, [
|
|
138829
|
+
config?.enabled,
|
|
138830
|
+
config?.engineId,
|
|
138831
|
+
config?.engines.local.model,
|
|
138832
|
+
config?.engines.local.selectedGroupId,
|
|
138833
|
+
config?.engines.localCt2.model,
|
|
138834
|
+
config?.engines.localCt2.selectedGroupId,
|
|
138835
|
+
config?.engines.localLlama.model,
|
|
138836
|
+
config?.engines.localLlama.selectedGroupId,
|
|
138837
|
+
config?.engines.openai.model,
|
|
138838
|
+
config?.targetLanguage
|
|
138839
|
+
]);
|
|
138616
138840
|
(0, import_react.useEffect)(() => {
|
|
138617
138841
|
let disposed = false;
|
|
138618
138842
|
const controller = new AbortController();
|
|
@@ -138667,6 +138891,7 @@ function useDocumentTranslation(markdown, config) {
|
|
|
138667
138891
|
segmentPatchMapRef.current.clear();
|
|
138668
138892
|
setError(null);
|
|
138669
138893
|
setStatus("initializing");
|
|
138894
|
+
let restoreServiceStatus = null;
|
|
138670
138895
|
try {
|
|
138671
138896
|
if (serviceStatus.state !== "ready") {
|
|
138672
138897
|
setError(serviceStatus.message);
|
|
@@ -138687,6 +138912,30 @@ function useDocumentTranslation(markdown, config) {
|
|
|
138687
138912
|
setStatus("unavailable");
|
|
138688
138913
|
return;
|
|
138689
138914
|
}
|
|
138915
|
+
restoreServiceStatus = nextState.status;
|
|
138916
|
+
const preparedState = await ensureBrowserTranslationReady({
|
|
138917
|
+
targetLanguage: config.targetLanguage,
|
|
138918
|
+
browserSupportTable: nextState.browserSupportTable,
|
|
138919
|
+
signal: controller.signal,
|
|
138920
|
+
onUpdate: (browserState) => {
|
|
138921
|
+
if (controller.signal.aborted || abortRef.current !== controller || generationRef.current !== generationId) return;
|
|
138922
|
+
setCapability(browserState.capability);
|
|
138923
|
+
setBrowserSupportTable(browserState.browserSupportTable);
|
|
138924
|
+
setServiceStatus(browserState.capability.availability === "available" ? nextState.status : {
|
|
138925
|
+
state: "checking",
|
|
138926
|
+
engineId: "browser",
|
|
138927
|
+
message: browserState.capability.message ?? "Preparing browser translation support."
|
|
138928
|
+
});
|
|
138929
|
+
}
|
|
138930
|
+
});
|
|
138931
|
+
if (controller.signal.aborted || abortRef.current !== controller || generationRef.current !== generationId) return;
|
|
138932
|
+
setCapability(preparedState.capability);
|
|
138933
|
+
setBrowserSupportTable(preparedState.browserSupportTable);
|
|
138934
|
+
setServiceStatus({
|
|
138935
|
+
state: "ready",
|
|
138936
|
+
engineId: "browser",
|
|
138937
|
+
message: preparedState.capability.message ?? "Browser translator is ready."
|
|
138938
|
+
});
|
|
138690
138939
|
}
|
|
138691
138940
|
setStatus("translating");
|
|
138692
138941
|
setResult({
|
|
@@ -138723,6 +138972,10 @@ function useDocumentTranslation(markdown, config) {
|
|
|
138723
138972
|
setStatus("translated");
|
|
138724
138973
|
} catch (translationError) {
|
|
138725
138974
|
if (controller.signal.aborted || abortRef.current !== controller || generationRef.current !== generationId) return;
|
|
138975
|
+
if (restoreServiceStatus?.engineId === "browser") {
|
|
138976
|
+
const fallbackServiceStatus = restoreServiceStatus;
|
|
138977
|
+
setServiceStatus((current) => current.state === "checking" ? fallbackServiceStatus : current);
|
|
138978
|
+
}
|
|
138726
138979
|
setError(translationError instanceof Error ? translationError.message : "Translation failed.");
|
|
138727
138980
|
setStatus("error");
|
|
138728
138981
|
} finally {
|
|
@@ -138751,6 +139004,7 @@ function useDocumentTranslation(markdown, config) {
|
|
|
138751
139004
|
const segment = result.segments[segmentIndex];
|
|
138752
139005
|
if (segmentIndex < 0 || !segment || segment.status !== "error") return;
|
|
138753
139006
|
const controller = new AbortController();
|
|
139007
|
+
let restoreServiceStatus = null;
|
|
138754
139008
|
const retryingSegment = {
|
|
138755
139009
|
...segment,
|
|
138756
139010
|
error: void 0,
|
|
@@ -138761,6 +139015,39 @@ function useDocumentTranslation(markdown, config) {
|
|
|
138761
139015
|
segments: current.segments.map((entry, index) => index === segmentIndex ? retryingSegment : entry)
|
|
138762
139016
|
} : current);
|
|
138763
139017
|
try {
|
|
139018
|
+
if (config.engineId === "browser") {
|
|
139019
|
+
restoreServiceStatus = {
|
|
139020
|
+
state: "ready",
|
|
139021
|
+
engineId: "browser",
|
|
139022
|
+
message: capability?.message ?? "Browser translator is ready."
|
|
139023
|
+
};
|
|
139024
|
+
const preparedState = await ensureBrowserTranslationReady({
|
|
139025
|
+
targetLanguage: config.targetLanguage,
|
|
139026
|
+
sourceLanguage: segment.sourceLanguage,
|
|
139027
|
+
browserSupportTable,
|
|
139028
|
+
signal: controller.signal,
|
|
139029
|
+
onUpdate: (browserState) => {
|
|
139030
|
+
setCapability(browserState.capability);
|
|
139031
|
+
setBrowserSupportTable(browserState.browserSupportTable);
|
|
139032
|
+
setServiceStatus(browserState.capability.availability === "available" ? {
|
|
139033
|
+
state: "ready",
|
|
139034
|
+
engineId: "browser",
|
|
139035
|
+
message: browserState.capability.message ?? "Browser translator is ready."
|
|
139036
|
+
} : {
|
|
139037
|
+
state: "checking",
|
|
139038
|
+
engineId: "browser",
|
|
139039
|
+
message: browserState.capability.message ?? "Preparing browser translation support."
|
|
139040
|
+
});
|
|
139041
|
+
}
|
|
139042
|
+
});
|
|
139043
|
+
setCapability(preparedState.capability);
|
|
139044
|
+
setBrowserSupportTable(preparedState.browserSupportTable);
|
|
139045
|
+
setServiceStatus({
|
|
139046
|
+
state: "ready",
|
|
139047
|
+
engineId: "browser",
|
|
139048
|
+
message: preparedState.capability.message ?? "Browser translator is ready."
|
|
139049
|
+
});
|
|
139050
|
+
}
|
|
138764
139051
|
const nextSegment = await retryTranslationSegment({
|
|
138765
139052
|
segment,
|
|
138766
139053
|
sourceLanguage: segment.sourceLanguage,
|
|
@@ -138786,6 +139073,10 @@ function useDocumentTranslation(markdown, config) {
|
|
|
138786
139073
|
return getDocumentTranslationFailureMessage(buildRetriedDocumentResult(result, segmentIndex, nextSegment)) ? "error" : "translated";
|
|
138787
139074
|
});
|
|
138788
139075
|
} catch (retryError) {
|
|
139076
|
+
if (restoreServiceStatus?.engineId === "browser") {
|
|
139077
|
+
const fallbackServiceStatus = restoreServiceStatus;
|
|
139078
|
+
setServiceStatus((current) => current.state === "checking" ? fallbackServiceStatus : current);
|
|
139079
|
+
}
|
|
138789
139080
|
setResult((current) => current ? {
|
|
138790
139081
|
...current,
|
|
138791
139082
|
segments: current.segments.map((entry, index) => index === segmentIndex ? {
|
|
@@ -138795,7 +139086,12 @@ function useDocumentTranslation(markdown, config) {
|
|
|
138795
139086
|
} : entry)
|
|
138796
139087
|
} : current);
|
|
138797
139088
|
}
|
|
138798
|
-
}, [
|
|
139089
|
+
}, [
|
|
139090
|
+
browserSupportTable,
|
|
139091
|
+
capability?.message,
|
|
139092
|
+
config,
|
|
139093
|
+
result
|
|
139094
|
+
]);
|
|
138799
139095
|
(0, import_react.useEffect)(() => {
|
|
138800
139096
|
latestStartRef.current = start;
|
|
138801
139097
|
}, [start]);
|
|
@@ -138803,10 +139099,14 @@ function useDocumentTranslation(markdown, config) {
|
|
|
138803
139099
|
if (activation !== "translated" || !config?.enabled || markdown.length === 0) return;
|
|
138804
139100
|
if (status !== "source") return;
|
|
138805
139101
|
if (serviceStatus.state !== "ready") return;
|
|
139102
|
+
if (config.engineId === "browser" && !canAutoStartBrowserTranslation(capability, browserSupportTable)) return;
|
|
138806
139103
|
latestStartRef.current?.();
|
|
138807
139104
|
}, [
|
|
138808
139105
|
activation,
|
|
139106
|
+
browserSupportTable,
|
|
139107
|
+
capability,
|
|
138809
139108
|
config?.enabled,
|
|
139109
|
+
config?.engineId,
|
|
138810
139110
|
markdown.length,
|
|
138811
139111
|
serviceStatus.state,
|
|
138812
139112
|
status
|
|
@@ -138858,6 +139158,10 @@ function buildRetriedDocumentResult(current, segmentIndex, nextSegment) {
|
|
|
138858
139158
|
segments: current.segments.map((entry, index) => index === segmentIndex ? nextSegment : entry)
|
|
138859
139159
|
});
|
|
138860
139160
|
}
|
|
139161
|
+
function canAutoStartBrowserTranslation(capability, browserSupportTable) {
|
|
139162
|
+
if (capability?.availability === "available") return true;
|
|
139163
|
+
return (browserSupportTable?.table?.rows ?? []).some((row) => row.availability === "available");
|
|
139164
|
+
}
|
|
138861
139165
|
//#endregion
|
|
138862
139166
|
//#region ../../node_modules/.pnpm/comma-separated-tokens@2.0.3/node_modules/comma-separated-tokens/index.js
|
|
138863
139167
|
/**
|
|
@@ -149267,15 +149571,21 @@ function createAnnotationComponents(inlineAnnotations, blockAnnotationByOffset)
|
|
|
149267
149571
|
});
|
|
149268
149572
|
},
|
|
149269
149573
|
th: ({ children, node, ...props }) => {
|
|
149574
|
+
const annotation = getBlockAnnotation(node, blockAnnotationByOffset, "tableCell");
|
|
149270
149575
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
149271
149576
|
...props,
|
|
149272
|
-
|
|
149577
|
+
...annotation?.dataAttributes,
|
|
149578
|
+
className: mergeClassName$2(props.className, annotation?.className),
|
|
149579
|
+
children: renderBlockChildren(children, annotation)
|
|
149273
149580
|
});
|
|
149274
149581
|
},
|
|
149275
149582
|
td: ({ children, node, ...props }) => {
|
|
149583
|
+
const annotation = getBlockAnnotation(node, blockAnnotationByOffset, "tableCell");
|
|
149276
149584
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
149277
149585
|
...props,
|
|
149278
|
-
|
|
149586
|
+
...annotation?.dataAttributes,
|
|
149587
|
+
className: mergeClassName$2(props.className, annotation?.className),
|
|
149588
|
+
children: renderBlockChildren(children, annotation)
|
|
149279
149589
|
});
|
|
149280
149590
|
}
|
|
149281
149591
|
};
|
|
@@ -149347,7 +149657,7 @@ function CodeBlock({ children, className, title }) {
|
|
|
149347
149657
|
isInline
|
|
149348
149658
|
]);
|
|
149349
149659
|
if (isInline) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
|
|
149350
|
-
className: "
|
|
149660
|
+
className: "text-foreground rounded px-1 font-mono text-sm [box-shadow:0_1px_0px_var(--primary)]",
|
|
149351
149661
|
title,
|
|
149352
149662
|
children: code
|
|
149353
149663
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openspecui/web",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"openspecui-ssg": "./dist-ssg/ssg-cli.mjs"
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@fontsource/share-tech-mono": "^5.2.7",
|
|
42
42
|
"@lezer/common": "^1.4.0",
|
|
43
43
|
"@lezer/highlight": "^1.2.3",
|
|
44
|
-
"@openspecui/search": "3.11.
|
|
45
|
-
"@openspecui/server": "3.11.
|
|
44
|
+
"@openspecui/search": "3.11.5",
|
|
45
|
+
"@openspecui/server": "3.11.5",
|
|
46
46
|
"@storybook/addon-vitest": "^10.2.19",
|
|
47
47
|
"@storybook/web-components": "^10.2.19",
|
|
48
48
|
"@storybook/web-components-vite": "^10.2.19",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./Geometry-Dr8DqqDe.js";import{w as e}from"./main-C9sK_hBV.js";export{e as CanvasRenderer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./Geometry-Dr8DqqDe.js";import{C as e}from"./main-C9sK_hBV.js";export{e as WebGLRenderer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./Geometry-Dr8DqqDe.js";import{S as e}from"./main-C9sK_hBV.js";export{e as WebGPURenderer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{it as e,x as t}from"./Geometry-Dr8DqqDe.js";import{A as n,D as r,O as i,k as a}from"./main-C9sK_hBV.js";import"./init-fMWSa5Px.js";e.add(n),e.mixin(t,a),e.add(i),e.mixin(t,r);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./dist-vqrjFRzf.js";import{b as e}from"./main-C9sK_hBV.js";export{e as json};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./dist-vqrjFRzf.js";import{t as e}from"./main-C9sK_hBV.js";export{e as yaml};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./dist-vqrjFRzf.js";import{g as e}from"./main-C9sK_hBV.js";export{e as css};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./jsx-runtime-1jQlXmIx.js";import{F as e}from"./main-C9sK_hBV.js";export{e as trpcClient};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./Geometry-Dr8DqqDe.js";import"./main-C9sK_hBV.js";import"./init-fMWSa5Px.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./Geometry-DYOOLchf.js";import{w as e}from"./index.ssg-BWQbO3uy.js";export{e as CanvasRenderer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./Geometry-DYOOLchf.js";import{C as e}from"./index.ssg-BWQbO3uy.js";export{e as WebGLRenderer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./Geometry-DYOOLchf.js";import{S as e}from"./index.ssg-BWQbO3uy.js";export{e as WebGPURenderer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{it as e,x as t}from"./Geometry-DYOOLchf.js";import{A as n,D as r,O as i,k as a}from"./index.ssg-BWQbO3uy.js";import"./init-DnSi5N8V.js";e.add(n),e.mixin(t,a),e.add(i),e.mixin(t,r);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./dist-UN0VvTJo.js";import{t as e}from"./index.ssg-BWQbO3uy.js";export{e as yaml};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./dist-UN0VvTJo.js";import{g as e}from"./index.ssg-BWQbO3uy.js";export{e as css};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./dist-UN0VvTJo.js";import{b as e}from"./index.ssg-BWQbO3uy.js";export{e as json};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as e}from"./index.ssg-BWQbO3uy.js";export{e as trpcClient};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./Geometry-DYOOLchf.js";import"./index.ssg-BWQbO3uy.js";import"./init-DnSi5N8V.js";
|