@celljs/ta-creator 0.0.0-stage → 4.32.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/web/index.js ADDED
@@ -0,0 +1,1410 @@
1
+ // web-src/react.ts
2
+ var React;
3
+ function bind(react) {
4
+ React = react;
5
+ }
6
+
7
+ // web-src/creator-protocol.ts
8
+ var NAME = "@celljs/ta-creator";
9
+ var PAGE = `${NAME}/home`;
10
+ var REVIEW = "ta-creator-review";
11
+ var Keys;
12
+ ((Keys) => {
13
+ Keys.SETTINGS = "settings";
14
+ Keys.ITEMS = "items";
15
+ Keys.WEEKS = "weeks";
16
+ Keys.TASKS = "tasks";
17
+ })(Keys ||= {});
18
+ var STAGES = ["topic", "making", "review", "published"];
19
+ var FORMS = ["video", "post"];
20
+ var KINDS = ["hot", "howto", "explain"];
21
+ var STEPS = ["script", "visuals", "voice", "captions", "versions", "checks"];
22
+ var ASPECTS = ["16:9", "9:16", "3:4", "1:1"];
23
+ var PLATFORMS = [
24
+ {
25
+ id: "bilibili",
26
+ name: "B站",
27
+ color: "#fb7299",
28
+ video: { aspect: "16:9" },
29
+ publish: "https://member.bilibili.com/platform/upload/video/frame",
30
+ declare: "创作声明 → 该视频使用人工智能合成技术"
31
+ },
32
+ {
33
+ id: "xiaohongshu",
34
+ name: "小红书",
35
+ color: "#ff2442",
36
+ video: { aspect: "3:4", maxSeconds: 900 },
37
+ post: { aspect: "3:4", maxImages: 18 },
38
+ publish: "https://creator.xiaohongshu.com",
39
+ declare: "内容类型声明 → 笔记含 AI 合成内容"
40
+ },
41
+ {
42
+ id: "channels",
43
+ name: "视频号",
44
+ color: "#fa9d3b",
45
+ video: { aspect: "9:16" },
46
+ publish: "https://channels.weixin.qq.com",
47
+ declare: "声明 → 内容由 AI 生成"
48
+ },
49
+ {
50
+ id: "douyin",
51
+ name: "抖音",
52
+ color: "#25f4ee",
53
+ video: { aspect: "9:16" },
54
+ post: { aspect: "3:4", maxImages: 35 },
55
+ publish: "https://creator.douyin.com",
56
+ declare: "作品声明 → 内容由 AI 生成"
57
+ },
58
+ { id: "kuaishou", name: "快手", color: "#ff6a00", video: { aspect: "9:16" }, publish: "https://cp.kuaishou.com", declare: "作者声明 → 内容由 AI 生成" },
59
+ {
60
+ id: "youtube",
61
+ name: "YouTube",
62
+ color: "#ff0033",
63
+ video: { aspect: "16:9" },
64
+ publish: "https://studio.youtube.com",
65
+ declare: "Altered or synthetic content → Yes"
66
+ },
67
+ {
68
+ id: "wechat-article",
69
+ name: "公众号",
70
+ color: "#07c160",
71
+ post: { aspect: "16:9" },
72
+ publish: "https://mp.weixin.qq.com",
73
+ declare: "创作来源 → 内容由 AI 生成"
74
+ }
75
+ ];
76
+ var SOURCES = [
77
+ { name: "Hacker News", url: "https://news.ycombinator.com" },
78
+ { name: "GitHub Trending", url: "https://github.com/trending" },
79
+ { name: "Product Hunt", url: "https://www.producthunt.com" },
80
+ { name: "Hugging Face Papers", url: "https://huggingface.co/papers" }
81
+ ];
82
+
83
+ // web-src/creator-util.ts
84
+ var DAY = 86400000;
85
+ var MAX_TOPICS = 200;
86
+ var HOT_FOR = 2 * DAY;
87
+ var text = (value, max = 2000) => typeof value === "string" ? value.trim().slice(0, max) : "";
88
+ var texts = (value, max = 50) => Array.isArray(value) ? value.map((one) => text(one, 200)).filter(Boolean).slice(0, max) : [];
89
+ var time = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
90
+ var oneOf = (all, value, fallback) => all.includes(value) ? value : fallback;
91
+ var object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
92
+ var CreatorUtil;
93
+ ((CreatorUtil) => {
94
+ function settings(value) {
95
+ const kept = object(value) ?? {};
96
+ const platforms = Array.isArray(kept.platforms) ? kept.platforms.map(platform).filter((one) => !!one) : [...PLATFORMS];
97
+ const ids = new Set(platforms.map((one) => one.id));
98
+ const goal = object(kept.goal);
99
+ return {
100
+ niche: text(kept.niche, 500),
101
+ picked: texts(kept.picked).filter((id) => ids.has(id)),
102
+ platforms,
103
+ sources: Array.isArray(kept.sources) ? kept.sources.map(source).filter((one) => !!one) : [...SOURCES],
104
+ ...goal && time(goal.from) ? { goal: { from: time(goal.from), days: count(goal.days, 30), videos: count(goal.videos, 0), posts: count(goal.posts, 0) } } : {},
105
+ minutesCap: count(kept.minutesCap, 120),
106
+ voice: text(kept.voice, 60) || "zh-CN-XiaoxiaoNeural"
107
+ };
108
+ }
109
+ CreatorUtil.settings = settings;
110
+ function platform(value) {
111
+ const kept = object(value);
112
+ const id = text(kept?.id, 60);
113
+ const name = text(kept?.name, 60);
114
+ if (!kept || !id || !name) {
115
+ return;
116
+ }
117
+ const shape = (one) => {
118
+ const it = object(one);
119
+ return it ? { aspect: oneOf(ASPECTS, it.aspect, "16:9"), ...count(it.maxSeconds, 0) ? { maxSeconds: count(it.maxSeconds, 0) } : {} } : undefined;
120
+ };
121
+ const video = shape(kept.video);
122
+ const post = object(kept.post) ? {
123
+ aspect: oneOf(ASPECTS, object(kept.post)?.aspect, "3:4"),
124
+ ...count(object(kept.post)?.maxImages, 0) ? { maxImages: count(object(kept.post)?.maxImages, 0) } : {}
125
+ } : undefined;
126
+ const publish = url(kept.publish);
127
+ const declare = text(kept.declare, 200);
128
+ return {
129
+ id,
130
+ name,
131
+ color: text(kept.color, 40) || "#8e8e93",
132
+ ...video ? { video } : {},
133
+ ...post ? { post } : {},
134
+ ...publish ? { publish } : {},
135
+ ...declare ? { declare } : {}
136
+ };
137
+ }
138
+ CreatorUtil.platform = platform;
139
+ function items(value) {
140
+ return Array.isArray(value) ? value.map(item).filter((one) => !!one) : [];
141
+ }
142
+ CreatorUtil.items = items;
143
+ function item(value) {
144
+ const kept = object(value);
145
+ const id = text(kept?.id, 80);
146
+ const title = text(kept?.title, 200);
147
+ const at = time(kept?.at);
148
+ if (!kept || !id || !title || !at) {
149
+ return;
150
+ }
151
+ const origin = object(kept.origin);
152
+ const originUrl = url(origin?.url);
153
+ return {
154
+ id,
155
+ title,
156
+ form: oneOf(FORMS, kept.form, "video"),
157
+ kind: oneOf(KINDS, kept.kind, "howto"),
158
+ stage: oneOf(STAGES, kept.stage, "topic"),
159
+ ...text(kept.why, 300) ? { why: text(kept.why, 300) } : {},
160
+ ...typeof kept.heat === "number" ? { heat: Math.max(0, Math.min(100, Math.round(kept.heat))) } : {},
161
+ ...time(kept.until) ? { until: time(kept.until) } : {},
162
+ ...texts(kept.seen, 10).length ? { seen: texts(kept.seen, 10) } : {},
163
+ ...origin && originUrl ? {
164
+ origin: {
165
+ url: originUrl,
166
+ ...text(origin.title, 200) ? { title: text(origin.title, 200) } : {},
167
+ ...text(origin.author, 100) ? { author: text(origin.author, 100) } : {},
168
+ ...text(origin.licence, 100) ? { licence: text(origin.licence, 100) } : {}
169
+ }
170
+ } : {},
171
+ ...Array.isArray(kept.done) ? { done: STEPS.filter((step) => kept.done.includes(step)) } : {},
172
+ ...text(kept.script, 20000) ? { script: text(kept.script, 20000) } : {},
173
+ ...Array.isArray(kept.versions) ? { versions: kept.versions.map(version).filter((one) => !!one) } : {},
174
+ ...Array.isArray(kept.checks) ? { checks: kept.checks.map(check).filter((one) => !!one) } : {},
175
+ ...text(kept.session, 1000) ? { session: text(kept.session, 1000) } : {},
176
+ ...time(kept.approved) ? { approved: time(kept.approved) } : {},
177
+ ...Array.isArray(kept.links) ? { links: kept.links.map(link).filter((one) => !!one) } : {},
178
+ ...kept.dropped === true ? { dropped: true } : {},
179
+ at,
180
+ changedAt: time(kept.changedAt) ?? at
181
+ };
182
+ }
183
+ CreatorUtil.item = item;
184
+ function weeks(value) {
185
+ if (!Array.isArray(value)) {
186
+ return [];
187
+ }
188
+ return value.map((one) => object(one)).filter((one) => !!one && /^\d{4}-\d{2}-\d{2}$/.test(String(one.week))).map((one) => ({
189
+ week: String(one.week),
190
+ platforms: (Array.isArray(one.platforms) ? one.platforms : []).map((it) => object(it)).filter((it) => !!it && !!text(it.platform, 60)).map((it) => ({
191
+ platform: text(it.platform, 60),
192
+ views: count(it.views, 0),
193
+ ...typeof it.likes === "number" ? { likes: count(it.likes, 0) } : {},
194
+ ...typeof it.follows === "number" ? { follows: count(it.follows, 0) } : {},
195
+ ...typeof it.completion === "number" ? { completion: Math.max(0, Math.min(1, it.completion)) } : {}
196
+ })),
197
+ minutes: count(one.minutes, 0)
198
+ }));
199
+ }
200
+ CreatorUtil.weeks = weeks;
201
+ function picked(settings2) {
202
+ return settings2.picked.map((id) => settings2.platforms.find((one) => one.id === id)).filter((one) => !!one);
203
+ }
204
+ CreatorUtil.picked = picked;
205
+ function columns(items2, now) {
206
+ const latest = (a, b) => b.changedAt - a.changedAt;
207
+ const of = (stage) => items2.filter((one) => one.stage === stage && !one.dropped);
208
+ return {
209
+ topic: of("topic").filter((one) => !expired(one, now)).sort((a, b) => (b.heat ?? 0) - (a.heat ?? 0) || b.at - a.at),
210
+ making: of("making").sort(latest),
211
+ review: of("review").sort(latest),
212
+ published: of("published").sort((a, b) => publishedAt(b) - publishedAt(a))
213
+ };
214
+ }
215
+ CreatorUtil.columns = columns;
216
+ function expired(item2, now) {
217
+ return item2.stage === "topic" && item2.kind === "hot" && now > (item2.until ?? item2.at + HOT_FOR);
218
+ }
219
+ CreatorUtil.expired = expired;
220
+ function publishedAt(item2) {
221
+ return Math.min(...(item2.links ?? []).map((one) => one.at), item2.changedAt);
222
+ }
223
+ CreatorUtil.publishedAt = publishedAt;
224
+ function addTopics(items2, topics, now, id) {
225
+ const key = (title) => title.toLowerCase().replace(/[\s\p{P}]+/gu, "");
226
+ const titles = new Set(items2.map((one) => key(one.title)));
227
+ const origins = new Set(items2.map((one) => one.origin?.url).filter(Boolean));
228
+ const added = [];
229
+ for (const topic of topics) {
230
+ const made = item({ ...topic, id: id(), stage: "topic", at: now, changedAt: now });
231
+ if (!made || titles.has(key(made.title)) || made.origin && origins.has(made.origin.url)) {
232
+ continue;
233
+ }
234
+ titles.add(key(made.title));
235
+ if (made.origin) {
236
+ origins.add(made.origin.url);
237
+ }
238
+ added.push(made);
239
+ }
240
+ const all = [...items2, ...added];
241
+ const topicsKept = all.filter((one) => one.stage === "topic");
242
+ const over = new Set(topicsKept.sort((a, b) => b.at - a.at).slice(MAX_TOPICS).map((one) => one.id));
243
+ return { items: all.filter((one) => !over.has(one.id)), added: added.filter((one) => !over.has(one.id)) };
244
+ }
245
+ CreatorUtil.addTopics = addTopics;
246
+ function change(items2, id, patch, now) {
247
+ const at = items2.findIndex((one) => one.id === id);
248
+ if (at < 0) {
249
+ throw new Error(`No such piece: ${id}.`);
250
+ }
251
+ const before = items2[at];
252
+ const changed = item({ ...before, ...patch, id: before.id, at: before.at, changedAt: now });
253
+ if (!changed) {
254
+ throw new Error("The change leaves the piece without a title.");
255
+ }
256
+ return items2.map((one, index) => index === at ? changed : one);
257
+ }
258
+ CreatorUtil.change = change;
259
+ function progress(items2, goal, now) {
260
+ if (!goal) {
261
+ return;
262
+ }
263
+ const end = goal.from + goal.days * DAY;
264
+ const published = items2.filter((one) => one.stage === "published" && (one.links?.length ?? 0) > 0).filter((one) => {
265
+ const at = publishedAt(one);
266
+ return at >= goal.from && at < end;
267
+ });
268
+ return {
269
+ videos: published.filter((one) => one.form === "video").length,
270
+ posts: published.filter((one) => one.form === "post").length,
271
+ day: Math.max(1, Math.min(goal.days, Math.floor((now - goal.from) / DAY) + 1))
272
+ };
273
+ }
274
+ CreatorUtil.progress = progress;
275
+ function weekOf(at) {
276
+ const day = new Date(at);
277
+ day.setHours(0, 0, 0, 0);
278
+ day.setDate(day.getDate() - (day.getDay() + 6) % 7);
279
+ const two = (n) => String(n).padStart(2, "0");
280
+ return `${day.getFullYear()}-${two(day.getMonth() + 1)}-${two(day.getDate())}`;
281
+ }
282
+ CreatorUtil.weekOf = weekOf;
283
+ function minutes(weeks2, now) {
284
+ return weeks2.find((one) => one.week === weekOf(now))?.minutes ?? 0;
285
+ }
286
+ CreatorUtil.minutes = minutes;
287
+ function addMinutes(weeks2, minutes2, now) {
288
+ const week = weekOf(now);
289
+ const kept = weeks2.find((one) => one.week === week);
290
+ const next = { week, platforms: kept?.platforms ?? [], minutes: Math.max(0, (kept?.minutes ?? 0) + Math.round(minutes2)) };
291
+ return [...weeks2.filter((one) => one.week !== week), next].sort((a, b) => a.week.localeCompare(b.week)).slice(-26);
292
+ }
293
+ CreatorUtil.addMinutes = addMinutes;
294
+ function setWeek(weeks2, week, platforms) {
295
+ const kept = weeks2.find((one) => one.week === week);
296
+ const next = CreatorUtil.weeks([{ week, platforms, minutes: kept?.minutes ?? 0 }]);
297
+ if (!next.length) {
298
+ throw new Error(`A week is its Monday, YYYY-MM-DD: ${week}.`);
299
+ }
300
+ return [...weeks2.filter((one) => one.week !== week), ...next].sort((a, b) => a.week.localeCompare(b.week)).slice(-26);
301
+ }
302
+ CreatorUtil.setWeek = setWeek;
303
+ function offer(settings2, weeks2, now) {
304
+ return minutes(weeks2, now) >= settings2.minutesCap * 0.75 ? 2 : 6;
305
+ }
306
+ CreatorUtil.offer = offer;
307
+ function version(value) {
308
+ const kept = object(value);
309
+ const platform2 = text(kept?.platform, 60);
310
+ if (!kept || !platform2) {
311
+ return;
312
+ }
313
+ const cover = text(kept.cover, 500);
314
+ return {
315
+ platform: platform2,
316
+ title: text(kept.title, 200),
317
+ text: text(kept.text, 5000),
318
+ tags: texts(kept.tags, 20),
319
+ files: texts(kept.files, 40),
320
+ ...cover ? { cover } : {}
321
+ };
322
+ }
323
+ function check(value) {
324
+ const kept = object(value);
325
+ return kept && text(kept.text, 200) ? { text: text(kept.text, 200), ok: kept.ok === true } : undefined;
326
+ }
327
+ function link(value) {
328
+ const kept = object(value);
329
+ const href = url(kept?.url);
330
+ return kept && href && text(kept.platform, 60) ? { platform: text(kept.platform, 60), url: href, at: time(kept.at) ?? Date.now() } : undefined;
331
+ }
332
+ function source(value) {
333
+ const kept = object(value);
334
+ const href = url(kept?.url);
335
+ return kept && href && text(kept.name, 80) ? { name: text(kept.name, 80), url: href } : undefined;
336
+ }
337
+ function url(value) {
338
+ const raw = text(value, 1000);
339
+ return /^https?:\/\/\S+$/i.test(raw) ? raw : undefined;
340
+ }
341
+ function count(value, fallback) {
342
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : fallback;
343
+ }
344
+ })(CreatorUtil ||= {});
345
+
346
+ // ../ta-protocol/esm/common/language.js
347
+ var TaLanguageUtil;
348
+ (function(TaLanguageUtil2) {
349
+ TaLanguageUtil2.ALL = ["zh-CN", "zh-TW", "en-US", "ja-JP"];
350
+ TaLanguageUtil2.NAMES = { "zh-CN": "简体中文", "zh-TW": "繁體中文", "en-US": "English", "ja-JP": "日本語" };
351
+ function of(tag) {
352
+ const said = (tag !== null && tag !== undefined ? tag : "").toLowerCase().replace(/_/g, "-");
353
+ if (/^zh(\b|-)/.test(said)) {
354
+ return /-hant\b/.test(said) || !/-hans\b/.test(said) && /-(tw|hk|mo)\b/.test(said) ? "zh-TW" : "zh-CN";
355
+ }
356
+ return /^ja(\b|-)/.test(said) ? "ja-JP" : "en-US";
357
+ }
358
+ TaLanguageUtil2.of = of;
359
+ function server(env = typeof process === "undefined" ? {} : process.env) {
360
+ return of(env.TA_LANGUAGE || env.LC_ALL || env.LC_MESSAGES || env.LANG);
361
+ }
362
+ TaLanguageUtil2.server = server;
363
+ function pick(language, words) {
364
+ return words[of(language)];
365
+ }
366
+ TaLanguageUtil2.pick = pick;
367
+ function say(words) {
368
+ return words[server()];
369
+ }
370
+ TaLanguageUtil2.say = say;
371
+ function chinese(language) {
372
+ return of(language).startsWith("zh");
373
+ }
374
+ TaLanguageUtil2.chinese = chinese;
375
+ function cjk(language) {
376
+ return of(language) !== "en-US";
377
+ }
378
+ TaLanguageUtil2.cjk = cjk;
379
+ function list(language, items) {
380
+ return items.join(cjk(language) ? "、" : ", ");
381
+ }
382
+ TaLanguageUtil2.list = list;
383
+ })(TaLanguageUtil || (TaLanguageUtil = {}));
384
+
385
+ // web-src/i18n.ts
386
+ var EN = {
387
+ title: "Creator",
388
+ sub: "A channel without your face",
389
+ topic: "Topics",
390
+ making: "Making",
391
+ review: "To review",
392
+ published: "Published",
393
+ data: "Numbers",
394
+ hotAt: "Hot topics · updated {time}",
395
+ findNow: "Find some now",
396
+ noTopics: "No topics yet",
397
+ noTopicsHint: "Ta looks at 8:00, 12:00 and 18:00",
398
+ make: "Make it",
399
+ drop: "Not this",
400
+ hot: "Hot",
401
+ howto: "How-to",
402
+ explain: "Explained",
403
+ video: "Video",
404
+ post: "Post",
405
+ heat: "Heat {n}",
406
+ script: "Script",
407
+ visuals: "Visuals",
408
+ voice: "Voice",
409
+ captions: "Captions",
410
+ versions: "Versions",
411
+ checks: "Checks",
412
+ makingEmpty: "Pick a topic to start",
413
+ reviewEmpty: "Nothing waits for you",
414
+ publishedEmpty: "Nothing published yet",
415
+ open: "Open",
416
+ pass: "Pass, fill it in",
417
+ change: "Change",
418
+ changeAsk: "What should change?",
419
+ approved: "Passed: Ta fills in the pages, you press Publish",
420
+ views: "Views",
421
+ follows: "New followers",
422
+ minutes: "Your time this week",
423
+ minutesValue: "{n} min",
424
+ goal: "{days}-day goal",
425
+ goalDay: "Day {day}",
426
+ noData: "Each Monday Ta sums up the week before",
427
+ setupTitle: "What is your channel about?",
428
+ nicheHint: "For example: AI coding hands-on, for developers who want to work faster",
429
+ platformsLabel: "Where you publish",
430
+ start: "Start",
431
+ settings: "Settings",
432
+ save: "Save",
433
+ startGoal: "Start a 30-day goal",
434
+ source: "Source",
435
+ failed: "Did not work: {error}",
436
+ makePrompt: "Make this piece: {title} ({id})",
437
+ findPrompt: "Find hot topics for my channel now",
438
+ passPrompt: "Passed: fill in the publishing pages of {id}, stopping before Publish",
439
+ changePrompt: "Change {id}: {note}"
440
+ };
441
+ var ZH = {
442
+ title: "创作者",
443
+ sub: "不出镜内容号",
444
+ topic: "选题",
445
+ making: "制作中",
446
+ review: "待审",
447
+ published: "已发布",
448
+ data: "数据",
449
+ hotAt: "热点 · {time} 更新",
450
+ findNow: "现在找一批",
451
+ noTopics: "还没有选题",
452
+ noTopicsHint: "Ta 每天 8、12、18 点各找一次",
453
+ make: "做这个",
454
+ drop: "不要",
455
+ hot: "热点",
456
+ howto: "实操",
457
+ explain: "解读",
458
+ video: "视频",
459
+ post: "图文",
460
+ heat: "热度 {n}",
461
+ script: "脚本",
462
+ visuals: "画面",
463
+ voice: "配音",
464
+ captions: "字幕",
465
+ versions: "各平台版本",
466
+ checks: "检查",
467
+ makingEmpty: "选一个选题开工",
468
+ reviewEmpty: "没有等你审的",
469
+ publishedEmpty: "还没有发布",
470
+ open: "打开",
471
+ pass: "通过,去发布",
472
+ change: "改一句",
473
+ changeAsk: "要改哪里?",
474
+ approved: "已通过:Ta 填好发布页,你来点发布",
475
+ views: "播放与浏览",
476
+ follows: "新增关注",
477
+ minutes: "本周花了你",
478
+ minutesValue: "{n} 分钟",
479
+ goal: "{days} 天目标",
480
+ goalDay: "第 {day} 天",
481
+ noData: "每周一 Ta 整理上周的数据",
482
+ setupTitle: "你的内容号做什么?",
483
+ nicheHint: "比如:AI 编程实操,给想提效的程序员",
484
+ platformsLabel: "发在哪些平台",
485
+ start: "开始",
486
+ settings: "设置",
487
+ save: "保存",
488
+ startGoal: "开始 30 天目标",
489
+ source: "出处",
490
+ failed: "没做成:{error}",
491
+ makePrompt: "做这条内容:{title}({id})",
492
+ findPrompt: "现在给我的内容号找一批热点选题",
493
+ passPrompt: "{id} 审过了:去各平台填好发布页,停在发布按钮前",
494
+ changePrompt: "{id} 要改:{note}"
495
+ };
496
+ var ZH_TW = {
497
+ title: "創作者",
498
+ sub: "不出鏡內容號",
499
+ topic: "選題",
500
+ making: "製作中",
501
+ review: "待審",
502
+ published: "已發佈",
503
+ data: "數據",
504
+ hotAt: "熱點 · {time} 更新",
505
+ findNow: "現在找一批",
506
+ noTopics: "還沒有選題",
507
+ noTopicsHint: "Ta 每天 8、12、18 點各找一次",
508
+ make: "做這個",
509
+ drop: "不要",
510
+ hot: "熱點",
511
+ howto: "實作",
512
+ explain: "解讀",
513
+ video: "影片",
514
+ post: "圖文",
515
+ heat: "熱度 {n}",
516
+ script: "腳本",
517
+ visuals: "畫面",
518
+ voice: "配音",
519
+ captions: "字幕",
520
+ versions: "各平台版本",
521
+ checks: "檢查",
522
+ makingEmpty: "選一個選題開工",
523
+ reviewEmpty: "沒有等你審的",
524
+ publishedEmpty: "還沒有發佈",
525
+ open: "打開",
526
+ pass: "通過,去發佈",
527
+ change: "改一句",
528
+ changeAsk: "要改哪裡?",
529
+ approved: "已通過:Ta 填好發佈頁,你來點發佈",
530
+ views: "播放與瀏覽",
531
+ follows: "新增追蹤",
532
+ minutes: "本週花了你",
533
+ minutesValue: "{n} 分鐘",
534
+ goal: "{days} 天目標",
535
+ goalDay: "第 {day} 天",
536
+ noData: "每週一 Ta 整理上週的數據",
537
+ setupTitle: "你的內容號做什麼?",
538
+ nicheHint: "比如:AI 程式實作,給想提效的工程師",
539
+ platformsLabel: "發在哪些平台",
540
+ start: "開始",
541
+ settings: "設定",
542
+ save: "儲存",
543
+ startGoal: "開始 30 天目標",
544
+ source: "出處",
545
+ failed: "沒做成:{error}",
546
+ makePrompt: "做這條內容:{title}({id})",
547
+ findPrompt: "現在給我的內容號找一批熱點選題",
548
+ passPrompt: "{id} 審過了:去各平台填好發佈頁,停在發佈按鈕前",
549
+ changePrompt: "{id} 要改:{note}"
550
+ };
551
+ var JA = {
552
+ title: "クリエイター",
553
+ sub: "顔出しなしのチャンネル",
554
+ topic: "ネタ",
555
+ making: "制作中",
556
+ review: "確認待ち",
557
+ published: "公開済み",
558
+ data: "データ",
559
+ hotAt: "話題 · {time} 更新",
560
+ findNow: "今すぐ探す",
561
+ noTopics: "まだネタがありません",
562
+ noTopicsHint: "Ta が毎日 8・12・18 時に探します",
563
+ make: "これを作る",
564
+ drop: "見送る",
565
+ hot: "話題",
566
+ howto: "実演",
567
+ explain: "解説",
568
+ video: "動画",
569
+ post: "画像投稿",
570
+ heat: "注目度 {n}",
571
+ script: "台本",
572
+ visuals: "映像",
573
+ voice: "ナレーション",
574
+ captions: "字幕",
575
+ versions: "各プラットフォーム版",
576
+ checks: "チェック",
577
+ makingEmpty: "ネタを選んで始めましょう",
578
+ reviewEmpty: "確認待ちはありません",
579
+ publishedEmpty: "まだ公開していません",
580
+ open: "開く",
581
+ pass: "OK、投稿へ",
582
+ change: "直す",
583
+ changeAsk: "どこを直しますか?",
584
+ approved: "OK 済み:Ta が投稿ページに入力し、投稿はあなたが押します",
585
+ views: "再生と閲覧",
586
+ follows: "新規フォロワー",
587
+ minutes: "今週かかった時間",
588
+ minutesValue: "{n} 分",
589
+ goal: "{days} 日間の目標",
590
+ goalDay: "{day} 日目",
591
+ noData: "毎週月曜に Ta が先週のデータをまとめます",
592
+ setupTitle: "どんなチャンネルですか?",
593
+ nicheHint: "例:AI プログラミングの実演、効率を上げたい開発者向け",
594
+ platformsLabel: "投稿先",
595
+ start: "始める",
596
+ settings: "設定",
597
+ save: "保存",
598
+ startGoal: "30 日間の目標を始める",
599
+ source: "出典",
600
+ failed: "できませんでした:{error}",
601
+ makePrompt: "このコンテンツを作って:{title}({id})",
602
+ findPrompt: "私のチャンネル向けに今の話題からネタを探して",
603
+ passPrompt: "{id} は確認済み:各プラットフォームの投稿ページに入力し、投稿ボタンの手前で止めて",
604
+ changePrompt: "{id} を直して:{note}"
605
+ };
606
+ var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
607
+ var CreatorWords;
608
+ ((CreatorWords) => {
609
+ function of(language) {
610
+ return TaLanguageUtil.pick(language, WORDS);
611
+ }
612
+ CreatorWords.of = of;
613
+ function format(text2, values) {
614
+ return text2.replace(/\{(\w+)\}/g, (all, key) => (key in values) ? String(values[key]) : all);
615
+ }
616
+ CreatorWords.format = format;
617
+ })(CreatorWords ||= {});
618
+
619
+ // web-src/ui.tsx
620
+ var format = CreatorWords.format;
621
+ function useStore(store) {
622
+ const [, tick] = React.useReducer((n) => n + 1, 0);
623
+ React.useEffect(() => store.subscribe(tick), [store]);
624
+ return store.state;
625
+ }
626
+ function useWords(pi) {
627
+ return CreatorWords.of(pi.ui.language);
628
+ }
629
+ function failed(pi) {
630
+ return (error) => pi.ui.notify(format(CreatorWords.of(pi.ui.language).failed, { error: error instanceof Error ? error.message : String(error) }), "error");
631
+ }
632
+ async function talk(pi, title, message) {
633
+ const { cwd } = await pi.server.getServerInfo();
634
+ const opened = pi.server.openSession({ cwd });
635
+ const id = opened.then((session2) => session2.sessionId);
636
+ await pi.switchSession(id, { title, cwd });
637
+ pi.ui.showView("");
638
+ const session = await opened;
639
+ await pi.server.setSessionName(session.sessionId, title);
640
+ await pi.server.prompt(session.sessionId, { message, clientMessageId: crypto.randomUUID() });
641
+ return session.sessionFile;
642
+ }
643
+ async function make(context, item) {
644
+ const { pi, store } = context;
645
+ const words = useWordsOf(pi);
646
+ await store.call("start", item.id);
647
+ const file = await talk(pi, item.title, format(words.makePrompt, { title: item.title, id: item.id }));
648
+ if (file) {
649
+ await store.call("update", item.id, { session: file });
650
+ }
651
+ }
652
+ async function openPiece(context, item) {
653
+ const { pi } = context;
654
+ if (item.session && await pi.openChat?.(item.session)) {
655
+ return;
656
+ }
657
+ await talk(pi, item.title, format(useWordsOf(pi).makePrompt, { title: item.title, id: item.id }));
658
+ }
659
+ function useWordsOf(pi) {
660
+ return CreatorWords.of(pi.ui.language);
661
+ }
662
+ function PlatformName({ platform, bare }) {
663
+ if (!platform) {
664
+ return null;
665
+ }
666
+ return /* @__PURE__ */ React.createElement("span", {
667
+ className: "tcre-pf"
668
+ }, /* @__PURE__ */ React.createElement("i", {
669
+ style: { background: platform.color }
670
+ }), !bare && platform.name);
671
+ }
672
+ function Steps({ item, words }) {
673
+ const done = new Set(item.done ?? []);
674
+ const next = STEPS.find((step) => !done.has(step));
675
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
676
+ className: "tcre-steps",
677
+ "aria-hidden": true
678
+ }, STEPS.map((step) => /* @__PURE__ */ React.createElement("i", {
679
+ key: step,
680
+ "data-state": done.has(step) ? "done" : step === next ? "now" : undefined
681
+ }))), /* @__PURE__ */ React.createElement("div", {
682
+ className: "tcre-steps-label"
683
+ }, /* @__PURE__ */ React.createElement("span", null, STEPS.map((step) => words[step]).join(" · ")), /* @__PURE__ */ React.createElement("span", null, next ? words[next] : words.review)));
684
+ }
685
+ function short(n, language) {
686
+ return new Intl.NumberFormat(language, { notation: n >= 1e4 ? "compact" : "standard", maximumFractionDigits: 1 }).format(n);
687
+ }
688
+ function platformOf(context, id) {
689
+ return context.store.state.settings.platforms.find((one) => one.id === id);
690
+ }
691
+ function BusyButton({
692
+ pi,
693
+ className,
694
+ disabled,
695
+ onClick,
696
+ children
697
+ }) {
698
+ const [busy, run] = pi.ui.useBusy();
699
+ return /* @__PURE__ */ React.createElement("button", {
700
+ type: "button",
701
+ className: busy ? `${className} ta-busy` : className,
702
+ disabled,
703
+ onClick: () => void run(() => Promise.resolve().then(onClick).catch(failed(pi)))
704
+ }, busy && /* @__PURE__ */ React.createElement("span", {
705
+ className: "ta-spinner ta-busy-mark"
706
+ }), children);
707
+ }
708
+
709
+ // web-src/cards.tsx
710
+ var VIDEO = /\.(mp4|mov|webm|m4v)$/i;
711
+ function useFileUrl(context, path) {
712
+ const [url, setUrl] = React.useState();
713
+ React.useEffect(() => {
714
+ let live = true;
715
+ setUrl(undefined);
716
+ if (path) {
717
+ const { pi } = context;
718
+ pi.workspace.fileUrl(path).then((url2) => pi.files.loadable(url2)).then((got) => live && setUrl(got), () => {
719
+ return;
720
+ });
721
+ }
722
+ return () => {
723
+ live = false;
724
+ };
725
+ }, [path]);
726
+ return url;
727
+ }
728
+ function Preview({ context, version }) {
729
+ const file = version?.files[0];
730
+ const url = useFileUrl(context, file);
731
+ const cover = useFileUrl(context, version?.cover);
732
+ const words = useWords(context.pi);
733
+ return /* @__PURE__ */ React.createElement("div", {
734
+ className: "tcre-preview"
735
+ }, url && file && VIDEO.test(file) ? /* @__PURE__ */ React.createElement("video", {
736
+ src: url,
737
+ poster: cover,
738
+ controls: true,
739
+ playsInline: true,
740
+ preload: "metadata"
741
+ }) : url ? /* @__PURE__ */ React.createElement("img", {
742
+ src: url,
743
+ alt: ""
744
+ }) : /* @__PURE__ */ React.createElement("div", {
745
+ className: "tcre-preview-empty"
746
+ }, version ? "" : words.versions), /* @__PURE__ */ React.createElement("span", {
747
+ className: "tcre-ai"
748
+ }, "AI"), version && version.files.length > 1 && /* @__PURE__ */ React.createElement("span", {
749
+ className: "tcre-count"
750
+ }, "1/", version.files.length));
751
+ }
752
+ function ReviewCard({ context, item, send }) {
753
+ const { pi, store } = context;
754
+ const words = useWords(pi);
755
+ const versions = item.versions ?? [];
756
+ const [shown, setShown] = React.useState(0);
757
+ const opened = React.useRef(Date.now());
758
+ const version = versions[Math.min(shown, versions.length - 1)];
759
+ const minutes = () => Math.min(30, Math.max(1, Math.round((Date.now() - opened.current) / 60000)));
760
+ const say = async (text2) => {
761
+ if (send) {
762
+ await send(text2);
763
+ } else if (item.session && await pi.openChat?.(item.session)) {
764
+ await pi.sendUserMessage(text2);
765
+ } else {
766
+ await talk(pi, item.title, text2);
767
+ }
768
+ };
769
+ const change = async () => {
770
+ const note = (await pi.ui.input(words.changeAsk))?.trim();
771
+ if (note) {
772
+ await store.call("revise", item.id, note, minutes());
773
+ await say(format(words.changePrompt, { id: item.id, note }));
774
+ }
775
+ };
776
+ const pass = async () => {
777
+ await store.call("approve", item.id, minutes());
778
+ await say(format(words.passPrompt, { id: item.id }));
779
+ };
780
+ return /* @__PURE__ */ React.createElement("div", {
781
+ className: "tcre-card tcre-review"
782
+ }, /* @__PURE__ */ React.createElement(Preview, {
783
+ context,
784
+ version
785
+ }), versions.length > 1 && /* @__PURE__ */ React.createElement("div", {
786
+ className: "ta-segmented tcre-tabs",
787
+ role: "tablist"
788
+ }, versions.map((one, at) => /* @__PURE__ */ React.createElement("button", {
789
+ key: one.platform,
790
+ type: "button",
791
+ role: "tab",
792
+ "aria-selected": at === shown,
793
+ className: at === shown ? "ta-on" : undefined,
794
+ onClick: () => setShown(at)
795
+ }, /* @__PURE__ */ React.createElement(PlatformName, {
796
+ platform: platformOf(context, one.platform) ?? { id: one.platform, name: one.platform, color: "var(--ta-muted)" }
797
+ })))), /* @__PURE__ */ React.createElement("div", {
798
+ className: "tcre-review-title"
799
+ }, version?.title || item.title), version?.text && /* @__PURE__ */ React.createElement("p", {
800
+ className: "tcre-review-text"
801
+ }, version.text), !!version?.tags.length && /* @__PURE__ */ React.createElement("div", {
802
+ className: "tcre-tags"
803
+ }, version.tags.map((tag) => `#${tag}`).join(" ")), item.origin && /* @__PURE__ */ React.createElement("div", {
804
+ className: "tcre-origin"
805
+ }, words.source, ": ", item.origin.title ?? item.origin.url, item.origin.author ? ` · ${item.origin.author}` : ""), !!item.checks?.length && /* @__PURE__ */ React.createElement("div", {
806
+ className: "tcre-checks"
807
+ }, item.checks.map((check) => /* @__PURE__ */ React.createElement("span", {
808
+ key: check.text,
809
+ "data-ok": check.ok || undefined
810
+ }, /* @__PURE__ */ React.createElement("i", null, check.ok ? "✓" : "!"), check.text))), item.approved ? /* @__PURE__ */ React.createElement("div", {
811
+ className: "tcre-approved"
812
+ }, words.approved) : item.stage === "review" && /* @__PURE__ */ React.createElement("div", {
813
+ className: "tcre-buttons"
814
+ }, /* @__PURE__ */ React.createElement(BusyButton, {
815
+ pi,
816
+ className: "tcre-secondary",
817
+ onClick: change
818
+ }, words.change), /* @__PURE__ */ React.createElement(BusyButton, {
819
+ pi,
820
+ className: "tcre-primary",
821
+ onClick: pass
822
+ }, words.pass)));
823
+ }
824
+ function reviewBlock(context) {
825
+ return function Review({ code, closed, send }) {
826
+ const state = useStore(context.store);
827
+ if (!closed) {
828
+ return null;
829
+ }
830
+ const id = ReviewCode.id(code);
831
+ const item = id ? state.items.find((one) => one.id === id) : undefined;
832
+ if (!item) {
833
+ return state.loaded ? /* @__PURE__ */ React.createElement("pre", null, code) : null;
834
+ }
835
+ return /* @__PURE__ */ React.createElement(ReviewCard, {
836
+ context,
837
+ item,
838
+ send
839
+ });
840
+ };
841
+ }
842
+ var ReviewCode;
843
+ ((ReviewCode) => {
844
+ function id(code) {
845
+ try {
846
+ const value = JSON.parse(code);
847
+ return typeof value?.id === "string" ? value.id : undefined;
848
+ } catch {
849
+ return;
850
+ }
851
+ }
852
+ ReviewCode.id = id;
853
+ })(ReviewCode ||= {});
854
+
855
+ // web-src/creator-store.ts
856
+ var KEYS = [Keys.SETTINGS, Keys.ITEMS, Keys.WEEKS];
857
+
858
+ class CreatorStore {
859
+ pi;
860
+ current = { loaded: false, settings: CreatorUtil.settings(undefined), items: [], weeks: [] };
861
+ listeners = new Set;
862
+ constructor(pi) {
863
+ this.pi = pi;
864
+ this.read();
865
+ pi.storage.onChange((keys) => keys.some((key) => KEYS.includes(key)) && this.read());
866
+ }
867
+ get state() {
868
+ return this.current;
869
+ }
870
+ subscribe = (listener) => {
871
+ this.listeners.add(listener);
872
+ return () => this.listeners.delete(listener);
873
+ };
874
+ item(id) {
875
+ return this.current.items.find((one) => one.id === id);
876
+ }
877
+ call(method, ...params) {
878
+ return this.pi.callHost(method, ...params);
879
+ }
880
+ read() {
881
+ Promise.all(KEYS.map((key) => this.pi.storage.get(key))).then(([settings, items, weeks]) => {
882
+ const next = { loaded: true, settings: CreatorUtil.settings(settings), items: CreatorUtil.items(items), weeks: CreatorUtil.weeks(weeks) };
883
+ if (!this.current.loaded || JSON.stringify(next) !== JSON.stringify(this.current)) {
884
+ this.set(next);
885
+ }
886
+ }, () => this.set({ ...this.current, loaded: true }));
887
+ }
888
+ set(state) {
889
+ this.current = state;
890
+ for (const listener of this.listeners) {
891
+ listener();
892
+ }
893
+ }
894
+ }
895
+
896
+ // web-src/page.tsx
897
+ var COLUMNS = ["topic", "making", "review", "published", "data"];
898
+ function CreatorHead({ context }) {
899
+ const state = useStore(context.store);
900
+ const words = useWords(context.pi);
901
+ return /* @__PURE__ */ React.createElement("div", {
902
+ className: "tcre-pagehead"
903
+ }, /* @__PURE__ */ React.createElement("span", {
904
+ className: "tcre-pagehead-title"
905
+ }, words.title), /* @__PURE__ */ React.createElement("span", {
906
+ className: "tcre-pagehead-sub"
907
+ }, state.settings.niche || words.sub));
908
+ }
909
+ function CreatorPage({ context }) {
910
+ const { pi } = context;
911
+ const state = useStore(context.store);
912
+ const words = useWords(pi);
913
+ const device = pi.ui.useDevice();
914
+ const [column, setColumn] = React.useState("topic");
915
+ const [editing, setEditing] = React.useState(false);
916
+ if (!state.loaded) {
917
+ return /* @__PURE__ */ React.createElement(pi.ui.Loading, null);
918
+ }
919
+ if (editing || !state.settings.picked.length) {
920
+ return /* @__PURE__ */ React.createElement("div", {
921
+ className: "tcre-page"
922
+ }, /* @__PURE__ */ React.createElement(Setup, {
923
+ context,
924
+ done: () => setEditing(false)
925
+ }));
926
+ }
927
+ const now = Date.now();
928
+ const columns = CreatorUtil.columns(state.items, now);
929
+ const counts = {
930
+ topic: columns.topic.length,
931
+ making: columns.making.length,
932
+ review: columns.review.length,
933
+ published: columns.published.length,
934
+ data: undefined
935
+ };
936
+ const body = (one) => {
937
+ switch (one) {
938
+ case "topic":
939
+ return /* @__PURE__ */ React.createElement(Topics, {
940
+ context,
941
+ items: columns.topic
942
+ });
943
+ case "making":
944
+ return /* @__PURE__ */ React.createElement(Making, {
945
+ context,
946
+ items: columns.making
947
+ });
948
+ case "review":
949
+ return columns.review.length ? columns.review.map((item) => /* @__PURE__ */ React.createElement(ReviewCard, {
950
+ key: item.id,
951
+ context,
952
+ item
953
+ })) : /* @__PURE__ */ React.createElement(Empty, {
954
+ pi,
955
+ text: words.reviewEmpty
956
+ });
957
+ case "published":
958
+ return /* @__PURE__ */ React.createElement(Published, {
959
+ context,
960
+ items: columns.published
961
+ });
962
+ case "data":
963
+ return /* @__PURE__ */ React.createElement(Numbers, {
964
+ context,
965
+ board: device.layout !== "compact"
966
+ });
967
+ }
968
+ };
969
+ const settings = /* @__PURE__ */ React.createElement("button", {
970
+ type: "button",
971
+ className: "tcre-link",
972
+ onClick: () => setEditing(true)
973
+ }, words.settings);
974
+ if (device.layout === "compact") {
975
+ return /* @__PURE__ */ React.createElement("div", {
976
+ className: "tcre-page"
977
+ }, /* @__PURE__ */ React.createElement("div", {
978
+ className: "ta-segmented tcre-seg",
979
+ role: "tablist"
980
+ }, COLUMNS.map((one) => /* @__PURE__ */ React.createElement("button", {
981
+ key: one,
982
+ type: "button",
983
+ role: "tab",
984
+ "aria-selected": one === column,
985
+ className: one === column ? "ta-on" : undefined,
986
+ onClick: () => setColumn(one)
987
+ }, words[one], counts[one] ? /* @__PURE__ */ React.createElement("em", null, counts[one]) : null))), /* @__PURE__ */ React.createElement("div", {
988
+ className: "tcre-col",
989
+ key: column
990
+ }, body(column)), /* @__PURE__ */ React.createElement("div", {
991
+ className: "tcre-foot"
992
+ }, settings));
993
+ }
994
+ return /* @__PURE__ */ React.createElement("div", {
995
+ className: "tcre-board"
996
+ }, /* @__PURE__ */ React.createElement("div", {
997
+ className: "tcre-board-bar"
998
+ }, CreatorUtil.picked(state.settings).map((platform) => /* @__PURE__ */ React.createElement(PlatformName, {
999
+ key: platform.id,
1000
+ platform
1001
+ })), /* @__PURE__ */ React.createElement("span", {
1002
+ className: "tcre-grow"
1003
+ }), /* @__PURE__ */ React.createElement("span", {
1004
+ className: "tcre-pill"
1005
+ }, words.minutes, " ", /* @__PURE__ */ React.createElement("b", null, format(words.minutesValue, { n: CreatorUtil.minutes(state.weeks, now) }))), settings), /* @__PURE__ */ React.createElement("div", {
1006
+ className: "tcre-board-cols"
1007
+ }, COLUMNS.map((one) => /* @__PURE__ */ React.createElement("section", {
1008
+ key: one,
1009
+ className: "tcre-board-col"
1010
+ }, /* @__PURE__ */ React.createElement("header", null, words[one], !!counts[one] && /* @__PURE__ */ React.createElement("em", null, counts[one])), /* @__PURE__ */ React.createElement("div", {
1011
+ className: "tcre-board-list"
1012
+ }, body(one))))));
1013
+ }
1014
+ function Empty({ pi, text: text2, hint, children }) {
1015
+ return /* @__PURE__ */ React.createElement("div", {
1016
+ className: "tcre-empty"
1017
+ }, /* @__PURE__ */ React.createElement(pi.ui.Empty, {
1018
+ compact: true,
1019
+ title: text2,
1020
+ hint
1021
+ }, children));
1022
+ }
1023
+ function kindLabel(item, words) {
1024
+ return [words[item.form], words[item.kind]].join(" · ");
1025
+ }
1026
+ function Topics({ context, items }) {
1027
+ const { pi, store } = context;
1028
+ const words = useWords(pi);
1029
+ const latest = items.reduce((at, one) => Math.max(at, one.at), 0);
1030
+ const find = () => talk(pi, words.findNow, words.findPrompt);
1031
+ if (!items.length) {
1032
+ return /* @__PURE__ */ React.createElement(Empty, {
1033
+ pi,
1034
+ text: words.noTopics,
1035
+ hint: words.noTopicsHint
1036
+ }, /* @__PURE__ */ React.createElement(BusyButton, {
1037
+ pi,
1038
+ className: "tcre-secondary tcre-small",
1039
+ onClick: find
1040
+ }, words.findNow));
1041
+ }
1042
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
1043
+ className: "tcre-h"
1044
+ }, /* @__PURE__ */ React.createElement("span", null, latest ? format(words.hotAt, {
1045
+ time: new Date(latest).toLocaleTimeString(pi.ui.language, { hour: "2-digit", minute: "2-digit", hour12: false })
1046
+ }) : ""), /* @__PURE__ */ React.createElement(BusyButton, {
1047
+ pi,
1048
+ className: "tcre-link",
1049
+ onClick: find
1050
+ }, words.findNow)), items.map((item) => /* @__PURE__ */ React.createElement("div", {
1051
+ key: item.id,
1052
+ className: "tcre-card tcre-topic"
1053
+ }, /* @__PURE__ */ React.createElement("div", {
1054
+ className: "tcre-topic-title"
1055
+ }, item.title), item.why && /* @__PURE__ */ React.createElement("p", null, item.why), /* @__PURE__ */ React.createElement("div", {
1056
+ className: "tcre-topic-foot"
1057
+ }, /* @__PURE__ */ React.createElement("span", {
1058
+ className: "tcre-chips"
1059
+ }, /* @__PURE__ */ React.createElement("span", {
1060
+ className: "tcre-chip"
1061
+ }, kindLabel(item, words)), item.heat !== undefined && /* @__PURE__ */ React.createElement("span", {
1062
+ className: "tcre-heat"
1063
+ }, format(words.heat, { n: item.heat }))), /* @__PURE__ */ React.createElement("span", {
1064
+ className: "tcre-buttons-inline"
1065
+ }, /* @__PURE__ */ React.createElement(BusyButton, {
1066
+ pi,
1067
+ className: "tcre-text",
1068
+ onClick: () => store.call("drop", item.id)
1069
+ }, words.drop), /* @__PURE__ */ React.createElement(BusyButton, {
1070
+ pi,
1071
+ className: "tcre-primary",
1072
+ onClick: () => make(context, item)
1073
+ }, words.make))))));
1074
+ }
1075
+ function Making({ context, items }) {
1076
+ const words = useWords(context.pi);
1077
+ if (!items.length) {
1078
+ return /* @__PURE__ */ React.createElement(Empty, {
1079
+ pi: context.pi,
1080
+ text: words.makingEmpty
1081
+ });
1082
+ }
1083
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, items.map((item) => /* @__PURE__ */ React.createElement(BusyButton, {
1084
+ key: item.id,
1085
+ pi: context.pi,
1086
+ className: "tcre-card tcre-making",
1087
+ onClick: () => openPiece(context, item)
1088
+ }, /* @__PURE__ */ React.createElement("span", {
1089
+ className: "tcre-making-title"
1090
+ }, item.title), /* @__PURE__ */ React.createElement(Steps, {
1091
+ item,
1092
+ words
1093
+ }))));
1094
+ }
1095
+ function Published({ context, items }) {
1096
+ const { pi } = context;
1097
+ const words = useWords(pi);
1098
+ if (!items.length) {
1099
+ return /* @__PURE__ */ React.createElement(Empty, {
1100
+ pi,
1101
+ text: words.publishedEmpty
1102
+ });
1103
+ }
1104
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, items.map((item) => /* @__PURE__ */ React.createElement("div", {
1105
+ key: item.id,
1106
+ className: "tcre-card tcre-pub"
1107
+ }, /* @__PURE__ */ React.createElement("span", {
1108
+ className: "tcre-pub-main"
1109
+ }, /* @__PURE__ */ React.createElement("span", {
1110
+ className: "tcre-pub-title"
1111
+ }, item.title), /* @__PURE__ */ React.createElement("span", {
1112
+ className: "tcre-pub-kind"
1113
+ }, words[item.form]), /* @__PURE__ */ React.createElement("span", {
1114
+ className: "tcre-pub-links"
1115
+ }, (item.links ?? []).map((link) => /* @__PURE__ */ React.createElement(BusyButton, {
1116
+ key: link.platform,
1117
+ pi,
1118
+ className: "tcre-text",
1119
+ onClick: () => pi.openLink?.(link.url)
1120
+ }, /* @__PURE__ */ React.createElement(PlatformName, {
1121
+ platform: platformOf(context, link.platform)
1122
+ }))))))));
1123
+ }
1124
+ function Numbers({ context, board }) {
1125
+ const { pi } = context;
1126
+ const state = useStore(context.store);
1127
+ const words = useWords(pi);
1128
+ const now = Date.now();
1129
+ const thisWeek = CreatorUtil.weekOf(now);
1130
+ const weeks = state.weeks.filter((one) => one.week < thisWeek && one.platforms.length);
1131
+ const last = weeks[weeks.length - 1];
1132
+ const before = weeks[weeks.length - 2];
1133
+ const sum = (week, key) => (week?.platforms ?? []).reduce((all, one) => all + (one[key] ?? 0), 0);
1134
+ const delta = (a, b) => b > 0 ? `${a >= b ? "+" : ""}${Math.round((a - b) / b * 100)}%` : "";
1135
+ const progress = CreatorUtil.progress(state.items, state.settings.goal, now);
1136
+ const goal = state.settings.goal;
1137
+ const most = Math.max(1, ...(last?.platforms ?? []).map((one) => one.views));
1138
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
1139
+ className: "tcre-card tcre-stats"
1140
+ }, /* @__PURE__ */ React.createElement("div", {
1141
+ className: "tcre-stats-row"
1142
+ }, /* @__PURE__ */ React.createElement("div", {
1143
+ className: "tcre-stat",
1144
+ "data-none": last ? undefined : true
1145
+ }, /* @__PURE__ */ React.createElement("b", null, last ? short(sum(last, "views"), pi.ui.language) : "—", last && before && /* @__PURE__ */ React.createElement("em", null, delta(sum(last, "views"), sum(before, "views")))), /* @__PURE__ */ React.createElement("span", null, words.views)), /* @__PURE__ */ React.createElement("div", {
1146
+ className: "tcre-stat",
1147
+ "data-none": last ? undefined : true
1148
+ }, /* @__PURE__ */ React.createElement("b", null, last ? short(sum(last, "follows"), pi.ui.language) : "—"), /* @__PURE__ */ React.createElement("span", null, words.follows)), !board && /* @__PURE__ */ React.createElement("div", {
1149
+ className: "tcre-stat"
1150
+ }, /* @__PURE__ */ React.createElement("b", null, format(words.minutesValue, { n: CreatorUtil.minutes(state.weeks, now) })), /* @__PURE__ */ React.createElement("span", null, words.minutes))), !last && /* @__PURE__ */ React.createElement("div", {
1151
+ className: "tcre-stats-note"
1152
+ }, words.noData)), last && /* @__PURE__ */ React.createElement("div", {
1153
+ className: "tcre-card tcre-bars"
1154
+ }, last.platforms.map((one) => {
1155
+ const platform = platformOf(context, one.platform);
1156
+ return /* @__PURE__ */ React.createElement("div", {
1157
+ key: one.platform,
1158
+ className: "tcre-bar"
1159
+ }, /* @__PURE__ */ React.createElement("span", {
1160
+ className: "tcre-bar-label"
1161
+ }, platform?.name ?? one.platform), /* @__PURE__ */ React.createElement("span", {
1162
+ className: "tcre-bar-track"
1163
+ }, /* @__PURE__ */ React.createElement("i", {
1164
+ style: { width: `${one.views / most * 100}%`, background: platform?.color }
1165
+ })), /* @__PURE__ */ React.createElement("span", {
1166
+ className: "tcre-bar-value"
1167
+ }, short(one.views, pi.ui.language)));
1168
+ })), goal && progress && /* @__PURE__ */ React.createElement("div", {
1169
+ className: "tcre-card tcre-goal"
1170
+ }, /* @__PURE__ */ React.createElement("div", {
1171
+ className: "tcre-goal-title"
1172
+ }, format(words.goal, { days: goal.days }), /* @__PURE__ */ React.createElement("span", {
1173
+ className: "tcre-muted"
1174
+ }, format(words.goalDay, { day: progress.day }))), [
1175
+ [words.video, progress.videos, goal.videos],
1176
+ [words.post, progress.posts, goal.posts]
1177
+ ].map(([label, made, aim]) => /* @__PURE__ */ React.createElement("div", {
1178
+ key: label
1179
+ }, /* @__PURE__ */ React.createElement("div", {
1180
+ className: "tcre-goal-row"
1181
+ }, /* @__PURE__ */ React.createElement("span", null, label), /* @__PURE__ */ React.createElement("span", {
1182
+ className: "tcre-muted"
1183
+ }, made, " / ", aim)), /* @__PURE__ */ React.createElement("div", {
1184
+ className: "tcre-goal-track"
1185
+ }, /* @__PURE__ */ React.createElement("i", {
1186
+ style: { width: `${aim ? Math.min(100, made / aim * 100) : 0}%` }
1187
+ }))))));
1188
+ }
1189
+ function Setup({ context, done }) {
1190
+ const { pi, store } = context;
1191
+ const state = useStore(store);
1192
+ const words = useWords(pi);
1193
+ const [niche, setNiche] = React.useState(state.settings.niche);
1194
+ const [picked, setPicked] = React.useState(state.settings.picked);
1195
+ const save = (goal) => store.call("setSettings", {
1196
+ niche: niche.trim(),
1197
+ picked,
1198
+ ...goal ? { goal: { from: Date.now(), days: 30, videos: 8, posts: 12 } } : {}
1199
+ }).then(done);
1200
+ return /* @__PURE__ */ React.createElement("div", {
1201
+ className: "tcre-setup"
1202
+ }, /* @__PURE__ */ React.createElement("div", {
1203
+ className: "tcre-setup-title"
1204
+ }, words.setupTitle), /* @__PURE__ */ React.createElement("textarea", {
1205
+ className: "tcre-input",
1206
+ rows: 2,
1207
+ value: niche,
1208
+ placeholder: words.nicheHint,
1209
+ onChange: (event) => setNiche(event.target.value)
1210
+ }), /* @__PURE__ */ React.createElement("div", {
1211
+ className: "tcre-setup-label"
1212
+ }, words.platformsLabel), /* @__PURE__ */ React.createElement("div", {
1213
+ className: "tcre-pick"
1214
+ }, state.settings.platforms.map((platform) => {
1215
+ const on = picked.includes(platform.id);
1216
+ return /* @__PURE__ */ React.createElement("button", {
1217
+ key: platform.id,
1218
+ type: "button",
1219
+ "aria-pressed": on,
1220
+ onClick: () => setPicked(on ? picked.filter((id) => id !== platform.id) : [...picked, platform.id])
1221
+ }, /* @__PURE__ */ React.createElement(PlatformName, {
1222
+ platform
1223
+ }));
1224
+ })), /* @__PURE__ */ React.createElement("div", {
1225
+ className: "tcre-buttons"
1226
+ }, !state.settings.goal && /* @__PURE__ */ React.createElement(BusyButton, {
1227
+ pi,
1228
+ className: "tcre-secondary",
1229
+ disabled: !picked.length,
1230
+ onClick: () => save(true)
1231
+ }, words.startGoal), /* @__PURE__ */ React.createElement(BusyButton, {
1232
+ pi,
1233
+ className: "tcre-primary",
1234
+ disabled: !picked.length,
1235
+ onClick: () => save(false)
1236
+ }, state.settings.picked.length ? words.save : words.start)));
1237
+ }
1238
+
1239
+ // web-src/style.ts
1240
+ var STYLE = `
1241
+ .tcre-page { height: 100%; overflow-y: auto; box-sizing: border-box; padding: 4px 16px calc(24px + env(safe-area-inset-bottom)); background: var(--ta-side); color: var(--ta-text); font-size: calc(14px * var(--ta-font-scale)); line-height: 1.5; }
1242
+ :root:not([data-theme='light']) :is(.tcre-page, .tcre-board) { --ta-card: var(--ta-raised); }
1243
+ .tcre-pagehead { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.25; }
1244
+ .tcre-pagehead-title { font-weight: 600; font-size: calc(15px * var(--ta-font-scale)); }
1245
+ .tcre-pagehead-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); }
1246
+ .tcre-seg { margin: 6px 0 12px; }
1247
+ .tcre-seg button { min-width: 0; height: calc(32px * var(--ta-font-scale)); padding: 0 2px; gap: 3px; font-size: calc(13.5px * var(--ta-font-scale)); white-space: nowrap; }
1248
+ .tcre-seg .ta-on { font-weight: 600; }
1249
+ .tcre-seg em, .tcre-board-col header em { font-style: normal; font-weight: 400; font-size: calc(11px * var(--ta-font-scale)); color: var(--ta-muted); font-variant-numeric: tabular-nums; }
1250
+ .tcre-col { animation: tcre-in 160ms var(--ta-ease); }
1251
+ @keyframes tcre-in { from { opacity: 0; } }
1252
+ .tcre-h { display: flex; justify-content: space-between; align-items: center; margin: 4px 4px 8px; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }
1253
+ .tcre-card { display: block; width: 100%; box-sizing: border-box; margin: 0 0 10px; padding: 13px 14px; border: 0; border-radius: 16px; background: var(--ta-card); color: inherit; font: inherit; text-align: left; }
1254
+ :root[data-theme='light'] .tcre-card { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
1255
+ button.tcre-card { cursor: pointer; -webkit-tap-highlight-color: transparent; }
1256
+ .tcre-topic-title, .tcre-making-title, .tcre-review-title { display: block; font-size: calc(15.5px * var(--ta-font-scale)); font-weight: 600; line-height: 1.4; }
1257
+ .tcre-topic p { margin: 5px 0 10px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }
1258
+ .tcre-topic-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
1259
+ .tcre-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
1260
+ .tcre-chip { padding: 2px 8px; border-radius: 999px; background: var(--ta-chip); color: var(--ta-secondary); font-size: calc(11.5px * var(--ta-font-scale)); white-space: nowrap; }
1261
+ .tcre-heat { color: var(--ta-warning, #d97706); font-size: calc(12px * var(--ta-font-scale)); font-weight: 600; white-space: nowrap; }
1262
+ .tcre-buttons-inline { display: flex; align-items: center; gap: 4px; flex: none; }
1263
+ .tcre-primary, .tcre-secondary { height: calc(32px * var(--ta-font-scale)); padding: 0 14px; border: 0; border-radius: 999px; font: inherit; font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; white-space: nowrap; cursor: pointer; }
1264
+ .tcre-primary { background: var(--ta-text); color: var(--ta-side); }
1265
+ .tcre-secondary { background: var(--ta-chip); color: var(--ta-text); font-weight: 500; }
1266
+ .tcre-primary:disabled, .tcre-secondary:disabled { opacity: 0.5; cursor: default; }
1267
+ .tcre-text, .tcre-link { border: 0; background: transparent; color: var(--ta-secondary); font: inherit; font-size: calc(13px * var(--ta-font-scale)); padding: 4px 6px; cursor: pointer; }
1268
+ .tcre-link { color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }
1269
+ .tcre-steps { display: flex; gap: 4px; margin: 10px 0 6px; }
1270
+ .tcre-steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--ta-chip); }
1271
+ .tcre-steps i[data-state='done'] { background: var(--ta-text); }
1272
+ .tcre-steps i[data-state='now'] { background: color-mix(in oklab, var(--ta-text) 40%, var(--ta-chip)); }
1273
+ .tcre-steps-label { display: flex; justify-content: space-between; gap: 8px; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); }
1274
+ .tcre-steps-label span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1275
+ .tcre-steps-label span:last-child { flex: none; white-space: nowrap; }
1276
+ .tcre-pf { display: inline-flex; align-items: center; gap: 5px; color: var(--ta-secondary); font-size: calc(12.5px * var(--ta-font-scale)); white-space: nowrap; }
1277
+ .tcre-pf i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
1278
+ .tcre-review { padding: 12px; }
1279
+ .tcre-preview { position: relative; overflow: hidden; border-radius: 12px; background: #111215; aspect-ratio: 16 / 10; display: grid; place-items: center; }
1280
+ .tcre-preview video, .tcre-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
1281
+ .tcre-preview-empty { color: #7c7c82; font-size: calc(12px * var(--ta-font-scale)); }
1282
+ .tcre-ai, .tcre-count { position: absolute; top: 8px; padding: 1px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.18); color: #fff; font-size: calc(10.5px * var(--ta-font-scale)); font-weight: 600; }
1283
+ .tcre-ai { right: 8px; }
1284
+ .tcre-count { left: 8px; }
1285
+ .tcre-tabs { margin: 12px 0 10px; }
1286
+ .tcre-tabs .ta-on .tcre-pf { color: var(--ta-text); font-weight: 600; }
1287
+ @media (prefers-reduced-motion: reduce) { .tcre-col { animation: none; } }
1288
+ .tcre-review-title { margin: 10px 2px 4px; font-size: calc(15px * var(--ta-font-scale)); }
1289
+ .tcre-review-text { margin: 0 2px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); white-space: pre-wrap; }
1290
+ .tcre-tags, .tcre-origin { margin: 4px 2px 0; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); overflow-wrap: anywhere; }
1291
+ .tcre-checks { display: flex; flex-direction: column; gap: 7px; margin: 12px 2px; font-size: calc(13px * var(--ta-font-scale)); color: var(--ta-text); }
1292
+ .tcre-checks span { display: flex; gap: 8px; align-items: flex-start; }
1293
+ .tcre-checks i { flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: calc(10px * var(--ta-font-scale)); font-weight: 700; color: var(--ta-warning, #d97706); background: color-mix(in oklab, var(--ta-warning, #d97706) 18%, transparent); }
1294
+ .tcre-checks span[data-ok] i { color: var(--ta-success, #16a34a); background: color-mix(in oklab, var(--ta-success, #16a34a) 18%, transparent); }
1295
+ .tcre-buttons { display: flex; gap: 8px; margin-top: 4px; }
1296
+ .tcre-buttons .tcre-secondary { flex: 1; }
1297
+ .tcre-buttons .tcre-primary { flex: 2; }
1298
+ .tcre-approved { margin: 4px 2px 2px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }
1299
+ .tcre-pub { display: block; }
1300
+ .tcre-pub-main { flex: 1; min-width: 0; }
1301
+ .tcre-pub-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; line-height: 1.4; }
1302
+ .tcre-pub-kind { display: block; margin-top: 2px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
1303
+ .tcre-pub-links { display: flex; flex-wrap: wrap; gap: 2px; margin: 2px 0 -4px -6px; }
1304
+ .tcre-stats { padding: 14px 0; }
1305
+ .tcre-stats-row { display: flex; }
1306
+ .tcre-stats-row > * { flex: 1; }
1307
+ .tcre-stat { min-width: 0; padding: 0 14px; display: flex; flex-direction: column; gap: 2px; }
1308
+ .tcre-stat + .tcre-stat { border-left: 1px solid color-mix(in oklab, var(--ta-text) 9%, transparent); }
1309
+ .tcre-stat b { font-size: calc(20px * var(--ta-font-scale)); font-weight: 600; line-height: 1.2; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
1310
+ .tcre-stat[data-none] b { color: var(--ta-muted); font-weight: 400; }
1311
+ .tcre-stat b em { margin-left: 4px; font-style: normal; font-weight: 400; font-size: calc(12px * var(--ta-font-scale)); color: var(--ta-success, #16a34a); }
1312
+ .tcre-stat span { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1313
+ .tcre-stats-note { margin: 12px 14px 0; padding-top: 10px; border-top: 1px solid color-mix(in oklab, var(--ta-text) 9%, transparent); color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
1314
+ .tcre-bar { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: calc(12.5px * var(--ta-font-scale)); }
1315
+ .tcre-bar-label { width: 58px; flex: none; color: var(--ta-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1316
+ .tcre-bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--ta-chip); overflow: hidden; }
1317
+ .tcre-bar-track i { display: block; height: 100%; border-radius: 4px; }
1318
+ .tcre-bar-value { width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
1319
+ .tcre-goal-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; }
1320
+ .tcre-goal-title .tcre-muted { font-weight: 400; font-size: calc(12px * var(--ta-font-scale)); }
1321
+ .tcre-goal-row { display: flex; justify-content: space-between; margin: 10px 0 6px; font-size: calc(13px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
1322
+ .tcre-goal-track { height: 6px; border-radius: 3px; background: var(--ta-chip); overflow: hidden; }
1323
+ .tcre-goal-track i { display: block; height: 100%; border-radius: 3px; background: var(--ta-text); }
1324
+ .tcre-empty { margin: 0 0 10px; border: 1px dashed color-mix(in oklab, var(--ta-text) 16%, transparent); border-radius: 16px; }
1325
+ .tcre-empty .ta-empty-compact { padding: 22px 14px; }
1326
+ .tcre-empty .ta-empty-hint { max-width: 240px; }
1327
+ .tcre-small { height: calc(28px * var(--ta-font-scale)); margin-top: 6px; padding: 0 12px; font-size: calc(12.5px * var(--ta-font-scale)); }
1328
+ .tcre-muted { color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }
1329
+ .tcre-foot { display: flex; justify-content: center; padding: 6px 0; }
1330
+ .tcre-board { height: 100%; display: flex; flex-direction: column; background: var(--ta-side); color: var(--ta-text); font-size: calc(14px * var(--ta-font-scale)); line-height: 1.5; }
1331
+ .tcre-board-bar { display: flex; align-items: center; gap: 16px; padding: 10px 24px; border-bottom: 1px solid var(--ta-border-muted, var(--ta-border)); }
1332
+ .tcre-board-bar .tcre-link { padding: 5px 12px; border-radius: 999px; color: var(--ta-secondary); }
1333
+ .tcre-board-bar .tcre-link:hover { background: var(--ta-hover); color: var(--ta-text); }
1334
+ .tcre-pill { padding: 5px 12px; border-radius: 999px; background: var(--ta-chip); color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); white-space: nowrap; }
1335
+ .tcre-pill b { margin-left: 2px; color: var(--ta-text); font-weight: 600; }
1336
+ .tcre-grow { flex: 1; }
1337
+ .tcre-board-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 16px; padding: 18px 24px 0; overflow-x: auto; }
1338
+ .tcre-board-col { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
1339
+ .tcre-board-col header { display: flex; align-items: center; gap: 6px; height: 22px; margin: 0 2px 12px; font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; }
1340
+ .tcre-board-col header em { min-width: 18px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; background: var(--ta-chip); color: var(--ta-secondary); text-align: center; line-height: 18px; }
1341
+ .tcre-board-list { flex: 1; overflow-y: auto; padding-bottom: 20px; }
1342
+ .tcre-board .tcre-card { padding: 11px 12px; }
1343
+ .tcre-board :is(.tcre-topic-title, .tcre-making-title) { font-size: calc(13.5px * var(--ta-font-scale)); }
1344
+ .tcre-board .tcre-topic-foot { flex-wrap: wrap; }
1345
+ .tcre-setup { max-width: 520px; margin: 18px auto; }
1346
+ .tcre-setup-title { font-size: calc(20px * var(--ta-font-scale)); font-weight: 600; margin: 0 2px 12px; }
1347
+ .tcre-setup-label { margin: 16px 2px 8px; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); }
1348
+ .tcre-input { width: 100%; box-sizing: border-box; padding: 12px 14px; border: 0; border-radius: 14px; background: var(--ta-card); color: var(--ta-text); font: inherit; resize: none; outline: none; }
1349
+ .tcre-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
1350
+ .tcre-pick button { height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--ta-card); font: inherit; cursor: pointer; box-shadow: inset 0 0 0 1px var(--ta-border-muted, var(--ta-border)); }
1351
+ .tcre-pick button[aria-pressed='true'] { box-shadow: inset 0 0 0 1.5px var(--ta-text); }
1352
+ .tcre-pick button[aria-pressed='true'] .tcre-pf { color: var(--ta-text); font-weight: 600; }
1353
+ `;
1354
+ function injectStyle() {
1355
+ const element = document.createElement("style");
1356
+ element.dataset.taPackage = "ta-creator";
1357
+ element.textContent = STYLE;
1358
+ document.head.appendChild(element);
1359
+ return () => element.remove();
1360
+ }
1361
+
1362
+ // web-src/index.tsx
1363
+ function activate(pi) {
1364
+ bind(pi.React);
1365
+ const removeStyle = injectStyle();
1366
+ const store = new CreatorStore(pi);
1367
+ const context = { pi, store };
1368
+ pi.registerView("home", {
1369
+ title: () => CreatorWords.of(pi.ui.language).title,
1370
+ icon: pi.ui.icons.Film,
1371
+ render: () => /* @__PURE__ */ React.createElement(CreatorPage, {
1372
+ context
1373
+ }),
1374
+ head: () => /* @__PURE__ */ React.createElement(CreatorHead, {
1375
+ context
1376
+ }),
1377
+ navigation: false
1378
+ });
1379
+ pi.registerHomeItems?.({
1380
+ items: () => {
1381
+ const words = CreatorWords.of(pi.ui.language);
1382
+ const columns = CreatorUtil.columns(store.state.items, Date.now());
1383
+ const waiting = columns.review.filter((one) => !one.approved).length;
1384
+ const detail = waiting ? `${words.review} ${waiting}` : columns.topic[0] ? `${words.topic} · ${columns.topic[0].title}` : store.state.settings.niche || words.sub;
1385
+ return [
1386
+ {
1387
+ id: "creator",
1388
+ title: words.title,
1389
+ detail,
1390
+ icon: pi.ui.icons.Film,
1391
+ tint: "creator",
1392
+ unseen: waiting > 0,
1393
+ place: "double",
1394
+ open: () => pi.ui.showView(PAGE)
1395
+ }
1396
+ ];
1397
+ },
1398
+ subscribe: (listener) => store.subscribe(listener)
1399
+ });
1400
+ pi.registerCodeRenderer?.(REVIEW, reviewBlock(context), {
1401
+ spoken: (code) => {
1402
+ const item = store.item(ReviewCode.id(code) ?? "");
1403
+ return item ? `${CreatorWords.of(pi.ui.language).review}: ${item.title}` : undefined;
1404
+ }
1405
+ });
1406
+ return removeStyle;
1407
+ }
1408
+ export {
1409
+ activate as default
1410
+ };