@celljs/ta-lips 0.0.0-stage → 4.29.0
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/README.en.md +9 -0
- package/README.md +8 -2
- package/host/index.mjs +329 -0
- package/package.json +66 -4
- package/python/lips.py +816 -0
- package/web/index.js +435 -0
package/web/index.js
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
// ../ta-protocol/esm/common/language.js
|
|
2
|
+
var TaLanguageUtil;
|
|
3
|
+
(function(TaLanguageUtil2) {
|
|
4
|
+
TaLanguageUtil2.ALL = ["zh-CN", "zh-TW", "en-US", "ja-JP"];
|
|
5
|
+
TaLanguageUtil2.NAMES = { "zh-CN": "简体中文", "zh-TW": "繁體中文", "en-US": "English", "ja-JP": "日本語" };
|
|
6
|
+
function of(tag) {
|
|
7
|
+
const said = (tag !== null && tag !== undefined ? tag : "").toLowerCase().replace(/_/g, "-");
|
|
8
|
+
if (/^zh(\b|-)/.test(said)) {
|
|
9
|
+
return /-hant\b/.test(said) || !/-hans\b/.test(said) && /-(tw|hk|mo)\b/.test(said) ? "zh-TW" : "zh-CN";
|
|
10
|
+
}
|
|
11
|
+
return /^ja(\b|-)/.test(said) ? "ja-JP" : "en-US";
|
|
12
|
+
}
|
|
13
|
+
TaLanguageUtil2.of = of;
|
|
14
|
+
function server(env = typeof process === "undefined" ? {} : process.env) {
|
|
15
|
+
return of(env.TA_LANGUAGE || env.LC_ALL || env.LC_MESSAGES || env.LANG);
|
|
16
|
+
}
|
|
17
|
+
TaLanguageUtil2.server = server;
|
|
18
|
+
function pick(language, words) {
|
|
19
|
+
return words[of(language)];
|
|
20
|
+
}
|
|
21
|
+
TaLanguageUtil2.pick = pick;
|
|
22
|
+
function say(words) {
|
|
23
|
+
return words[server()];
|
|
24
|
+
}
|
|
25
|
+
TaLanguageUtil2.say = say;
|
|
26
|
+
function chinese(language) {
|
|
27
|
+
return of(language).startsWith("zh");
|
|
28
|
+
}
|
|
29
|
+
TaLanguageUtil2.chinese = chinese;
|
|
30
|
+
function cjk(language) {
|
|
31
|
+
return of(language) !== "en-US";
|
|
32
|
+
}
|
|
33
|
+
TaLanguageUtil2.cjk = cjk;
|
|
34
|
+
function list(language, items) {
|
|
35
|
+
return items.join(cjk(language) ? "、" : ", ");
|
|
36
|
+
}
|
|
37
|
+
TaLanguageUtil2.list = list;
|
|
38
|
+
})(TaLanguageUtil || (TaLanguageUtil = {}));
|
|
39
|
+
|
|
40
|
+
// web-src/i18n.ts
|
|
41
|
+
var EN = {
|
|
42
|
+
title: "Lifelike mouth in video calls",
|
|
43
|
+
section: "Mouth",
|
|
44
|
+
hint: "Draws her mouth again on this computer for each thing Ta says, so that her lips match the words. It downloads about 6 GB once.",
|
|
45
|
+
get: "Download",
|
|
46
|
+
getting: "Downloading {percent}%",
|
|
47
|
+
ready: "On",
|
|
48
|
+
remove: "Remove",
|
|
49
|
+
failed: "Could not set it up: {error}",
|
|
50
|
+
unsupported: "Needs a Mac with Apple silicon or a computer with an NVIDIA GPU.",
|
|
51
|
+
askTitle: "Make her mouth match the words?",
|
|
52
|
+
ask: "Ta can draw her mouth again on this computer as she speaks, so that her lips match what she says. It downloads about 6 GB once, then works offline. This call goes on as it is meanwhile.",
|
|
53
|
+
askYes: "Download",
|
|
54
|
+
askNo: "Not now",
|
|
55
|
+
started: "Downloading in the background; the next video call will use it.",
|
|
56
|
+
herTitle: "Her own mouth",
|
|
57
|
+
herHint: "A mouth trained on her own videos and on Ta's voice: it looks like her and follows the words better. Off draws the general one. About 1 GB more, downloaded once.",
|
|
58
|
+
herLater: "After the download above"
|
|
59
|
+
};
|
|
60
|
+
var ZH = {
|
|
61
|
+
title: "视频通话口型更真",
|
|
62
|
+
section: "口型",
|
|
63
|
+
hint: "在这台电脑上按 Ta 说的每句话重画她的嘴,让嘴型对上字和声音。第一次需要下载约 6 GB。",
|
|
64
|
+
get: "下载",
|
|
65
|
+
getting: "正在下载 {percent}%",
|
|
66
|
+
ready: "已开启",
|
|
67
|
+
remove: "移除",
|
|
68
|
+
failed: "没装好:{error}",
|
|
69
|
+
unsupported: "需要 Apple 芯片的 Mac,或带 NVIDIA 显卡的电脑。",
|
|
70
|
+
askTitle: "让她的嘴型对上说的话?",
|
|
71
|
+
ask: "Ta 可以在这台电脑上边说边重画她的嘴,让嘴型和字、声音一致。需要下载约 6 GB,只下一次,之后离线也能用。这次通话先照常进行。",
|
|
72
|
+
askYes: "下载",
|
|
73
|
+
askNo: "以后再说",
|
|
74
|
+
started: "已在后台下载,下次视频通话就会用上。",
|
|
75
|
+
herTitle: "用她自己的嘴型",
|
|
76
|
+
herHint: "用她自己的视频和 Ta 的声音训练过的嘴型,更像她本人,也更跟得上说的话。关掉就用通用嘴型。多下载约 1 GB,只下一次。",
|
|
77
|
+
herLater: "先完成上面的下载"
|
|
78
|
+
};
|
|
79
|
+
var ZH_TW = {
|
|
80
|
+
title: "視訊通話口型更真",
|
|
81
|
+
section: "口型",
|
|
82
|
+
hint: "在這台電腦上按 Ta 說的每句話重畫她的嘴,讓嘴型對上字和聲音。第一次需要下載約 6 GB。",
|
|
83
|
+
get: "下載",
|
|
84
|
+
getting: "正在下載 {percent}%",
|
|
85
|
+
ready: "已開啟",
|
|
86
|
+
remove: "移除",
|
|
87
|
+
failed: "沒裝好:{error}",
|
|
88
|
+
unsupported: "需要 Apple 晶片的 Mac,或有 NVIDIA 顯示卡的電腦。",
|
|
89
|
+
askTitle: "讓她的嘴型對上說的話?",
|
|
90
|
+
ask: "Ta 可以在這台電腦上邊說邊重畫她的嘴,讓嘴型和字、聲音一致。需要下載約 6 GB,只下一次,之後離線也能用。這次通話先照常進行。",
|
|
91
|
+
askYes: "下載",
|
|
92
|
+
askNo: "以後再說",
|
|
93
|
+
started: "已在背景下載,下次視訊通話就會用上。",
|
|
94
|
+
herTitle: "用她自己的嘴型",
|
|
95
|
+
herHint: "用她自己的影片和 Ta 的聲音訓練過的嘴型,更像她本人,也更跟得上說的話。關掉就用通用嘴型。多下載約 1 GB,只下一次。",
|
|
96
|
+
herLater: "先完成上面的下載"
|
|
97
|
+
};
|
|
98
|
+
var JA = {
|
|
99
|
+
title: "ビデオ通話の口元をリアルに",
|
|
100
|
+
section: "口元",
|
|
101
|
+
hint: "Ta が話すたびにこのコンピューターで口元を描き直し、言葉と口の動きを合わせます。初回に約 6 GB をダウンロードします。",
|
|
102
|
+
get: "ダウンロード",
|
|
103
|
+
getting: "ダウンロード中 {percent}%",
|
|
104
|
+
ready: "オン",
|
|
105
|
+
remove: "削除",
|
|
106
|
+
failed: "セットアップできませんでした:{error}",
|
|
107
|
+
unsupported: "Apple シリコンの Mac か、NVIDIA GPU のあるコンピューターが必要です。",
|
|
108
|
+
askTitle: "口の動きを言葉に合わせますか?",
|
|
109
|
+
ask: "Ta は話しながらこのコンピューターで口元を描き直し、言葉と声に口の動きを合わせられます。約 6 GB を一度だけダウンロードし、その後はオフラインでも使えます。この通話はこのまま続きます。",
|
|
110
|
+
askYes: "ダウンロード",
|
|
111
|
+
askNo: "あとで",
|
|
112
|
+
started: "バックグラウンドでダウンロード中です。次のビデオ通話から使われます。",
|
|
113
|
+
herTitle: "彼女自身の口元",
|
|
114
|
+
herHint: "彼女自身の動画と Ta の声で学習した口元です。本人らしく見え、言葉にもよく合います。オフにすると汎用の口元になります。追加で約 1 GB を一度だけダウンロードします。",
|
|
115
|
+
herLater: "上のダウンロードのあとで"
|
|
116
|
+
};
|
|
117
|
+
var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
|
|
118
|
+
var LipsWords;
|
|
119
|
+
((LipsWords) => {
|
|
120
|
+
function of(language) {
|
|
121
|
+
return TaLanguageUtil.pick(language, WORDS);
|
|
122
|
+
}
|
|
123
|
+
LipsWords.of = of;
|
|
124
|
+
function fill(text, values) {
|
|
125
|
+
return text.replace(/\{(\w+)\}/g, (_, key) => String(values[key] ?? ""));
|
|
126
|
+
}
|
|
127
|
+
LipsWords.fill = fill;
|
|
128
|
+
})(LipsWords ||= {});
|
|
129
|
+
|
|
130
|
+
// web-src/lips-protocol.ts
|
|
131
|
+
var LIPS_FPS = 24;
|
|
132
|
+
var HOLD_MS = 1200;
|
|
133
|
+
var POLL_MS = 120;
|
|
134
|
+
var STARTS_MS = 9000;
|
|
135
|
+
var KEEP_ALIVE_MS = 20000;
|
|
136
|
+
|
|
137
|
+
// web-src/react.ts
|
|
138
|
+
var React;
|
|
139
|
+
function bind(react) {
|
|
140
|
+
React = react;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// web-src/style.ts
|
|
144
|
+
var STYLE = `
|
|
145
|
+
.ta-lips-row { display: inline-flex; align-items: center; gap: 8px; }
|
|
146
|
+
.ta-lips-note { color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }
|
|
147
|
+
.ta-lips-button { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--ta-border); background: transparent; color: var(--ta-text); font: inherit; font-weight: 500; cursor: pointer; }
|
|
148
|
+
.ta-lips-primary { background: var(--ta-accent); border-color: var(--ta-accent); color: #fff; }
|
|
149
|
+
.ta-lips-ask { margin: 0 0 16px; color: var(--ta-secondary); line-height: 1.6; }
|
|
150
|
+
.ta-lips-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
151
|
+
`;
|
|
152
|
+
function injectStyle() {
|
|
153
|
+
const element = document.createElement("style");
|
|
154
|
+
element.dataset.taPackage = "ta-lips";
|
|
155
|
+
element.textContent = STYLE;
|
|
156
|
+
document.head.appendChild(element);
|
|
157
|
+
return () => element.remove();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// web-src/index.tsx
|
|
161
|
+
var ASKED = "asked";
|
|
162
|
+
function activate(pi) {
|
|
163
|
+
bind(pi.React);
|
|
164
|
+
if (!pi.registerCallMouth) {
|
|
165
|
+
return () => {
|
|
166
|
+
return;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
const removeStyle = injectStyle();
|
|
170
|
+
pi.registerCallMouth({ open: () => LipsMouth.open(pi) });
|
|
171
|
+
pi.registerSettings({
|
|
172
|
+
title: () => LipsWords.of(pi.ui.language).section,
|
|
173
|
+
icon: pi.ui.icons.Sparkles,
|
|
174
|
+
group: "voice",
|
|
175
|
+
order: 30,
|
|
176
|
+
rows: [setupRow(pi), herRow(pi)]
|
|
177
|
+
});
|
|
178
|
+
return removeStyle;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
class LipsMouth {
|
|
182
|
+
pi;
|
|
183
|
+
holdMs = HOLD_MS;
|
|
184
|
+
fps = LIPS_FPS;
|
|
185
|
+
frames = new Map;
|
|
186
|
+
reading = new Set;
|
|
187
|
+
timer;
|
|
188
|
+
alive;
|
|
189
|
+
closed = false;
|
|
190
|
+
started = false;
|
|
191
|
+
openedAt = Date.now();
|
|
192
|
+
constructor(pi) {
|
|
193
|
+
this.pi = pi;
|
|
194
|
+
}
|
|
195
|
+
static async open(pi) {
|
|
196
|
+
if (!pi.files.byUrl) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const status = await LipsMouth.state(pi);
|
|
200
|
+
if (!status?.supported) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (status.state !== "ready") {
|
|
204
|
+
if (status.state === "none" && !await pi.storage.get(ASKED)) {
|
|
205
|
+
await pi.storage.set(ASKED, true);
|
|
206
|
+
pi.ui.custom?.(({ close }) => /* @__PURE__ */ React.createElement(AskSetup, {
|
|
207
|
+
pi,
|
|
208
|
+
close
|
|
209
|
+
}));
|
|
210
|
+
}
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const mouth = new LipsMouth(pi);
|
|
214
|
+
pi.callHost("start").then(() => {
|
|
215
|
+
mouth.started = true;
|
|
216
|
+
}, () => mouth.close());
|
|
217
|
+
mouth.keepAlive();
|
|
218
|
+
return mouth;
|
|
219
|
+
}
|
|
220
|
+
keepAlive() {
|
|
221
|
+
this.alive = setInterval(() => void this.pi.callHost("start").catch(() => {
|
|
222
|
+
return;
|
|
223
|
+
}), KEEP_ALIVE_MS);
|
|
224
|
+
}
|
|
225
|
+
static async state(pi, tries = 4) {
|
|
226
|
+
for (let i = 0;; i++) {
|
|
227
|
+
try {
|
|
228
|
+
return await pi.callHost("state");
|
|
229
|
+
} catch {
|
|
230
|
+
if (i + 1 >= tries) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
await new Promise((done) => setTimeout(done, 1500));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
sound(say, pcm, rate, slots, first) {
|
|
238
|
+
if (this.closed) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
this.reading.add(say);
|
|
242
|
+
this.poll();
|
|
243
|
+
const message = { op: "say", id: String(say), pcm: pcm ? LipsMouth.base64(pcm) : "", rate, fps: this.fps, slots, first, final: !pcm };
|
|
244
|
+
this.pi.callHost("tell", message).catch(() => {
|
|
245
|
+
return;
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
at(say, slot) {
|
|
249
|
+
this.pi.callHost("tell", { op: "at", id: String(say), slot }).catch(() => {
|
|
250
|
+
return;
|
|
251
|
+
});
|
|
252
|
+
for (const key of this.frames.keys()) {
|
|
253
|
+
const [id, at] = key.split(":").map(Number);
|
|
254
|
+
if (id !== say || at < slot - 1) {
|
|
255
|
+
this.frames.delete(key);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
readyIn() {
|
|
260
|
+
return this.started ? 0 : Math.max(500, STARTS_MS - (Date.now() - this.openedAt));
|
|
261
|
+
}
|
|
262
|
+
cut(say) {
|
|
263
|
+
this.reading.delete(say);
|
|
264
|
+
this.pi.callHost("tell", { op: "cut", id: String(say) }).catch(() => {
|
|
265
|
+
return;
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
frame(say, slot) {
|
|
269
|
+
return this.frames.get(`${say}:${slot}`);
|
|
270
|
+
}
|
|
271
|
+
close() {
|
|
272
|
+
this.closed = true;
|
|
273
|
+
clearInterval(this.timer);
|
|
274
|
+
clearInterval(this.alive);
|
|
275
|
+
for (const say of this.reading) {
|
|
276
|
+
this.cut(say);
|
|
277
|
+
}
|
|
278
|
+
this.frames.clear();
|
|
279
|
+
}
|
|
280
|
+
poll() {
|
|
281
|
+
if (this.timer) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
this.timer = setInterval(() => {
|
|
285
|
+
if (!this.reading.size) {
|
|
286
|
+
clearInterval(this.timer);
|
|
287
|
+
this.timer = undefined;
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
for (const say of this.reading) {
|
|
291
|
+
this.pi.callHost("take", String(say)).then((frames) => frames.forEach((frame) => void this.decode(say, frame)), () => {
|
|
292
|
+
return;
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}, POLL_MS);
|
|
296
|
+
}
|
|
297
|
+
async decode(say, frame) {
|
|
298
|
+
const bytes = Uint8Array.from(atob(frame.data), (char) => char.charCodeAt(0));
|
|
299
|
+
const image = await createImageBitmap(new Blob([bytes], { type: "image/webp" }));
|
|
300
|
+
if (!this.closed) {
|
|
301
|
+
this.frames.set(`${say}:${frame.slot}`, { clip: frame.clip, frame: frame.frame, box: frame.box, image });
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
static base64(bytes) {
|
|
305
|
+
let text = "";
|
|
306
|
+
for (let i = 0;i < bytes.length; i += 32768) {
|
|
307
|
+
text += String.fromCharCode(...bytes.subarray(i, i + 32768));
|
|
308
|
+
}
|
|
309
|
+
return btoa(text);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function useStatus(pi) {
|
|
313
|
+
const [status, setStatus] = React.useState();
|
|
314
|
+
React.useEffect(() => {
|
|
315
|
+
let live = true;
|
|
316
|
+
const read = () => pi.callHost("state").then((next) => live && setStatus(next), () => {
|
|
317
|
+
return;
|
|
318
|
+
});
|
|
319
|
+
read();
|
|
320
|
+
const timer = setInterval(read, 1000);
|
|
321
|
+
return () => {
|
|
322
|
+
live = false;
|
|
323
|
+
clearInterval(timer);
|
|
324
|
+
};
|
|
325
|
+
}, [pi]);
|
|
326
|
+
return [status, setStatus];
|
|
327
|
+
}
|
|
328
|
+
function setupRow(pi) {
|
|
329
|
+
return {
|
|
330
|
+
key: "setup",
|
|
331
|
+
label: () => LipsWords.of(pi.ui.language).title,
|
|
332
|
+
description: () => LipsWords.of(pi.ui.language).hint,
|
|
333
|
+
render: () => /* @__PURE__ */ React.createElement(SetupControl, {
|
|
334
|
+
pi
|
|
335
|
+
})
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
function herRow(pi) {
|
|
339
|
+
return {
|
|
340
|
+
key: "her",
|
|
341
|
+
label: () => LipsWords.of(pi.ui.language).herTitle,
|
|
342
|
+
description: () => LipsWords.of(pi.ui.language).herHint,
|
|
343
|
+
render: () => /* @__PURE__ */ React.createElement(HerControl, {
|
|
344
|
+
pi
|
|
345
|
+
})
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function HerControl({ pi }) {
|
|
349
|
+
const words = LipsWords.of(pi.ui.language);
|
|
350
|
+
const [status, setStatus] = useStatus(pi);
|
|
351
|
+
if (status?.state !== "ready") {
|
|
352
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
353
|
+
className: "ta-lips-note"
|
|
354
|
+
}, words.herLater);
|
|
355
|
+
}
|
|
356
|
+
if (status.her === "getting") {
|
|
357
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
358
|
+
className: "ta-lips-note"
|
|
359
|
+
}, LipsWords.fill(words.getting, { percent: Math.floor((status.herProgress ?? 0) * 100) }));
|
|
360
|
+
}
|
|
361
|
+
const Switch = pi.ui.Switch;
|
|
362
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
363
|
+
className: "ta-lips-row"
|
|
364
|
+
}, status.herError && /* @__PURE__ */ React.createElement("span", {
|
|
365
|
+
className: "ta-lips-note"
|
|
366
|
+
}, LipsWords.fill(words.failed, { error: status.herError })), /* @__PURE__ */ React.createElement(Switch, {
|
|
367
|
+
checked: status.her === "on",
|
|
368
|
+
label: words.herTitle,
|
|
369
|
+
onChange: (on) => pi.callHost("her", on).then(setStatus, (error) => {
|
|
370
|
+
pi.ui.notify(String(error?.message ?? error), "error");
|
|
371
|
+
throw error;
|
|
372
|
+
})
|
|
373
|
+
}));
|
|
374
|
+
}
|
|
375
|
+
function SetupControl({ pi }) {
|
|
376
|
+
const words = LipsWords.of(pi.ui.language);
|
|
377
|
+
const [status, setStatus] = useStatus(pi);
|
|
378
|
+
const act = (method) => pi.callHost(method).then(setStatus, (error) => pi.ui.notify(String(error?.message ?? error), "error"));
|
|
379
|
+
if (!status) {
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
if (!status.supported) {
|
|
383
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
384
|
+
className: "ta-lips-note"
|
|
385
|
+
}, words.unsupported);
|
|
386
|
+
}
|
|
387
|
+
if (status.state === "setting-up") {
|
|
388
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
389
|
+
className: "ta-lips-note"
|
|
390
|
+
}, LipsWords.fill(words.getting, { percent: Math.floor(status.progress * 100) }));
|
|
391
|
+
}
|
|
392
|
+
if (status.state === "ready") {
|
|
393
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
394
|
+
type: "button",
|
|
395
|
+
className: "ta-lips-button",
|
|
396
|
+
onClick: () => act("remove")
|
|
397
|
+
}, words.remove);
|
|
398
|
+
}
|
|
399
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
400
|
+
className: "ta-lips-row"
|
|
401
|
+
}, status.state === "failed" && /* @__PURE__ */ React.createElement("span", {
|
|
402
|
+
className: "ta-lips-note"
|
|
403
|
+
}, LipsWords.fill(words.failed, { error: status.error ?? "" })), /* @__PURE__ */ React.createElement("button", {
|
|
404
|
+
type: "button",
|
|
405
|
+
className: "ta-lips-button",
|
|
406
|
+
onClick: () => act("setup")
|
|
407
|
+
}, words.get));
|
|
408
|
+
}
|
|
409
|
+
function AskSetup({ pi, close }) {
|
|
410
|
+
const words = LipsWords.of(pi.ui.language);
|
|
411
|
+
const Dialog = pi.ui.Dialog;
|
|
412
|
+
return /* @__PURE__ */ React.createElement(Dialog, {
|
|
413
|
+
title: words.askTitle,
|
|
414
|
+
onClose: close
|
|
415
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
416
|
+
className: "ta-lips-ask"
|
|
417
|
+
}, words.ask), /* @__PURE__ */ React.createElement("div", {
|
|
418
|
+
className: "ta-lips-actions"
|
|
419
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
420
|
+
type: "button",
|
|
421
|
+
className: "ta-lips-button",
|
|
422
|
+
onClick: close
|
|
423
|
+
}, words.askNo), /* @__PURE__ */ React.createElement("button", {
|
|
424
|
+
type: "button",
|
|
425
|
+
className: "ta-lips-button ta-lips-primary",
|
|
426
|
+
onClick: () => {
|
|
427
|
+
close();
|
|
428
|
+
pi.callHost("setup").then(() => pi.ui.notify(words.started), (error) => pi.ui.notify(String(error?.message ?? error), "error"));
|
|
429
|
+
}
|
|
430
|
+
}, words.askYes)));
|
|
431
|
+
}
|
|
432
|
+
export {
|
|
433
|
+
activate as default,
|
|
434
|
+
LipsMouth
|
|
435
|
+
};
|