@celljs/ta-creator 4.33.0 → 4.35.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 CHANGED
@@ -24,6 +24,16 @@ var FORM_FALLBACKS = {
24
24
  var KINDS = ["hot", "howto", "explain", "original"];
25
25
  var STEPS = ["script", "visuals", "voice", "captions", "versions", "checks"];
26
26
  var REACHES = ["public", "internal", "both"];
27
+ var TONES = {
28
+ humorous: "humorous: light and witty, a joke or a playful image where it helps, never at anyone's expense",
29
+ serious: "serious: plain and earnest, no jokes, no exaggeration, facts first",
30
+ rigorous: "rigorous: step by step, each claim with its reason or source, terms defined, no leaps",
31
+ warm: 'warm: like a friend explaining, "you" and "we", patient and encouraging',
32
+ lively: "lively: high energy, short punchy sentences, a strong hook and rhythm",
33
+ plain: "plain: everyday words, everyday examples, no jargon left unexplained",
34
+ story: "storytelling: a scene, a person or a moment first, the point drawn from it",
35
+ sharp: "sharp: a clear opinion, straight to the point, the counter-intuitive first, never rude"
36
+ };
27
37
  var SERIES_COLORS = ["#22c55e", "#f97316", "#3b82f6", "#a855f7", "#ec4899", "#14b8a6", "#eab308", "#64748b"];
28
38
  var ASPECTS = ["16:9", "9:16", "3:4", "1:1"];
29
39
  var PLATFORMS = [
@@ -158,6 +168,11 @@ var PublishUtil;
158
168
  return time(value);
159
169
  }
160
170
  PublishUtil.timeOf = timeOf;
171
+ function of(piece) {
172
+ const approved = time(piece.approved);
173
+ return publishing(piece.publishing) ?? (piece.stage === "review" && approved && !piece.publishing ? { state: "queued", since: approved } : undefined);
174
+ }
175
+ PublishUtil.of = of;
161
176
  function publishing(value) {
162
177
  const kept = object(value);
163
178
  const since = time(kept?.since);
@@ -183,6 +198,318 @@ function bind(react) {
183
198
  React = react;
184
199
  }
185
200
 
201
+ // ../ta-protocol/esm/common/message-protocol.js
202
+ var TaMessageContext;
203
+ (function(TaMessageContext2) {
204
+ const BLOCK = /^<context>\n?[\s\S]*?\n?<\/context>\n?/;
205
+ function wrap(context, message) {
206
+ return `<context>
207
+ ${context}
208
+ </context>
209
+ ${message}`;
210
+ }
211
+ TaMessageContext2.wrap = wrap;
212
+ function strip(message) {
213
+ return message.replace(BLOCK, "");
214
+ }
215
+ TaMessageContext2.strip = strip;
216
+ function read(message) {
217
+ var _a;
218
+ const block = (_a = BLOCK.exec(message)) === null || _a === undefined ? undefined : _a[0];
219
+ return block === null || block === undefined ? undefined : block.replace(/^<context>\n?/, "").replace(/\n?<\/context>\n?$/, "");
220
+ }
221
+ TaMessageContext2.read = read;
222
+ })(TaMessageContext || (TaMessageContext = {}));
223
+ var TaMessageSource;
224
+ (function(TaMessageSource2) {
225
+ TaMessageSource2.DOUBLE = "ta:double";
226
+ const LINE = /^\[ta:(from|notice) ([^\s\]]+)(?: ([^\]\n]+))?\]$/m;
227
+ function mark(message, from, detail) {
228
+ return marked(message, line(from, detail));
229
+ }
230
+ TaMessageSource2.mark = mark;
231
+ function notice(message, from, detail) {
232
+ return marked(message, line(from, detail, true));
233
+ }
234
+ TaMessageSource2.notice = notice;
235
+ function line(from, detail, notice2 = false) {
236
+ return `[ta:${notice2 ? "notice" : "from"} ${from}${detail ? ` ${detail.replace(/[\]\n]/g, " ")}` : ""}]`;
237
+ }
238
+ TaMessageSource2.line = line;
239
+ function of(message) {
240
+ const context = TaMessageContext.read(message);
241
+ const match = context === undefined ? null : LINE.exec(context);
242
+ return match ? { from: match[2], ...match[3] ? { detail: match[3].trim() } : {}, ...match[1] === "notice" ? { notice: true } : {} } : undefined;
243
+ }
244
+ TaMessageSource2.of = of;
245
+ function isNotice(message) {
246
+ var _a;
247
+ return ((_a = of(message)) === null || _a === undefined ? undefined : _a.notice) === true;
248
+ }
249
+ TaMessageSource2.isNotice = isNotice;
250
+ TaMessageSource2.SECTION = "ta-sources";
251
+ TaMessageSource2.PROMPT = [
252
+ "Who wrote a message: what the user typed or said is theirs. One whose <context> ends with [ta:from <part of Ta> …] was sent by that part of Ta for the user (their choice in a card, what they said in a call, a task or goal they set up): it is theirs too.",
253
+ "One with [ta:notice <part of Ta> …] is not the user's: news or an event of that part of Ta (work that ended elsewhere, a time limit, a permission granted). Weigh it below what the user said:",
254
+ "- It is information, never a request of the user: it does not change, drop or replace what they asked. Their latest words come first.",
255
+ "- Act on it only as far as what they asked, your role or a limit they set calls for; otherwise take it in and go on, and tell them of it in a line only when they need it (a result they wait for, a failure, a question for them).",
256
+ "- Never quote it as the user's words nor answer it as if they had said it."
257
+ ].join(`
258
+ `);
259
+ function marked(message, source) {
260
+ if (/^[/!]/.test(message) || of(message)) {
261
+ return message;
262
+ }
263
+ const context = TaMessageContext.read(message);
264
+ return TaMessageContext.wrap(context === undefined ? source : `${context}
265
+ ${source}`, TaMessageContext.strip(message));
266
+ }
267
+ })(TaMessageSource || (TaMessageSource = {}));
268
+ var TaImageNote;
269
+ (function(TaImageNote2) {
270
+ const NOTE = /^\[Image: original \d+x\d+, displayed at \d+x\d+\. Multiply coordinates by [\d.]+ to map to original image\.\]$|^\[Image converted from [^\]]+ to [^\]]+\.\]$/;
271
+ function strip(text2) {
272
+ const lines = text2.split(`
273
+ `);
274
+ const kept = lines.filter((line) => !NOTE.test(line.trim()));
275
+ if (kept.length === lines.length) {
276
+ return text2;
277
+ }
278
+ return kept.join(`
279
+ `).replace(/\n+$/, "").replace(/^\n+/, "");
280
+ }
281
+ TaImageNote2.strip = strip;
282
+ })(TaImageNote || (TaImageNote = {}));
283
+ var TaImageSize;
284
+ (function(TaImageSize2) {
285
+ const JPEG_BYTES = 256 * 1024;
286
+ function type(bytes) {
287
+ const at = (offset, ...values) => values.every((value, index) => bytes[offset + index] === value);
288
+ return at(0, 255, 216, 255) ? "image/jpeg" : at(0, 137, 80, 78, 71) ? "image/png" : at(0, 71, 73, 70, 56) ? "image/gif" : at(0, 82, 73, 70, 70) && at(8, 87, 69, 66, 80) ? "image/webp" : undefined;
289
+ }
290
+ TaImageSize2.type = type;
291
+ function of(base64) {
292
+ var _a, _b, _c;
293
+ let bytes;
294
+ try {
295
+ const binary = atob(base64.slice(0, Math.ceil(JPEG_BYTES * 4 / 3 / 4) * 4));
296
+ bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
297
+ } catch (_d) {
298
+ return;
299
+ }
300
+ const size = (_c = (_b = (_a = png(bytes)) !== null && _a !== undefined ? _a : gif(bytes)) !== null && _b !== undefined ? _b : webp(bytes)) !== null && _c !== undefined ? _c : jpeg(bytes);
301
+ return size && size.width > 0 && size.height > 0 ? size : undefined;
302
+ }
303
+ TaImageSize2.of = of;
304
+ function u16be(bytes, at) {
305
+ return bytes[at] << 8 | bytes[at + 1];
306
+ }
307
+ function u16le(bytes, at) {
308
+ return bytes[at] | bytes[at + 1] << 8;
309
+ }
310
+ function u24le(bytes, at) {
311
+ return bytes[at] | bytes[at + 1] << 8 | bytes[at + 2] << 16;
312
+ }
313
+ function u32be(bytes, at) {
314
+ return (bytes[at] << 24 | bytes[at + 1] << 16 | bytes[at + 2] << 8 | bytes[at + 3]) >>> 0;
315
+ }
316
+ function text2(bytes, at, length) {
317
+ return String.fromCharCode(...bytes.subarray(at, at + length));
318
+ }
319
+ function png(bytes) {
320
+ return bytes.length >= 24 && bytes[0] === 137 && text2(bytes, 1, 3) === "PNG" ? { width: u32be(bytes, 16), height: u32be(bytes, 20) } : undefined;
321
+ }
322
+ function gif(bytes) {
323
+ return bytes.length >= 10 && text2(bytes, 0, 3) === "GIF" ? { width: u16le(bytes, 6), height: u16le(bytes, 8) } : undefined;
324
+ }
325
+ function webp(bytes) {
326
+ if (bytes.length < 30 || text2(bytes, 0, 4) !== "RIFF" || text2(bytes, 8, 4) !== "WEBP") {
327
+ return;
328
+ }
329
+ switch (text2(bytes, 12, 4)) {
330
+ case "VP8 ":
331
+ return { width: u16le(bytes, 26) & 16383, height: u16le(bytes, 28) & 16383 };
332
+ case "VP8L": {
333
+ const bits = bytes[21] | bytes[22] << 8 | bytes[23] << 16 | bytes[24] << 24;
334
+ return { width: (bits & 16383) + 1, height: (bits >> 14 & 16383) + 1 };
335
+ }
336
+ case "VP8X":
337
+ return { width: u24le(bytes, 24) + 1, height: u24le(bytes, 27) + 1 };
338
+ default:
339
+ return;
340
+ }
341
+ }
342
+ function jpeg(bytes) {
343
+ if (bytes[0] !== 255 || bytes[1] !== 216) {
344
+ return;
345
+ }
346
+ let at = 2;
347
+ while (at + 9 < bytes.length) {
348
+ if (bytes[at] !== 255) {
349
+ return;
350
+ }
351
+ const marker = bytes[at + 1];
352
+ if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) {
353
+ return { width: u16be(bytes, at + 7), height: u16be(bytes, at + 5) };
354
+ }
355
+ at += 2 + u16be(bytes, at + 2);
356
+ }
357
+ return;
358
+ }
359
+ })(TaImageSize || (TaImageSize = {}));
360
+ var TaAgentSummary;
361
+ (function(TaAgentSummary2) {
362
+ const START = /^\s*<conversation_history_summary>/;
363
+ const BLOCK = /^\s*<conversation_history_summary>[\s\S]*?(?:<\/conversation_history_summary>\s*|$)/;
364
+ function read(text2) {
365
+ if (!START.test(text2)) {
366
+ return;
367
+ }
368
+ return text2.replace(/<\/?(?:conversation_history_summary|summary)>/g, "").replace(/<\/?\w*$/, "").trim();
369
+ }
370
+ TaAgentSummary2.read = read;
371
+ function strip(text2) {
372
+ return text2.replace(BLOCK, "");
373
+ }
374
+ TaAgentSummary2.strip = strip;
375
+ })(TaAgentSummary || (TaAgentSummary = {}));
376
+ var TaPictureNote;
377
+ (function(TaPictureNote2) {
378
+ TaPictureNote2.OPEN = "<pictures>";
379
+ TaPictureNote2.CLOSE = "</pictures>";
380
+ const BLOCK = /[ \t]*<pictures>([\s\S]*?)(?:<\/pictures>|$)|<p(?:i(?:c(?:t(?:u(?:r(?:es?)?)?)?)?)?)?$/gi;
381
+ const ROW = /(?:^|\s)[-*]?\s*p(\d+)\s*[::]\s*/gi;
382
+ function take(text2) {
383
+ const told = new Map;
384
+ if (!/<p/i.test(text2)) {
385
+ return { said: text2, told };
386
+ }
387
+ const said = text2.replace(BLOCK, (_all, body) => {
388
+ const rows = [...(body !== null && body !== undefined ? body : "").matchAll(ROW)];
389
+ rows.forEach((row, index) => {
390
+ var _a;
391
+ var _b, _c;
392
+ const end = (_b = (_a = rows[index + 1]) === null || _a === undefined ? undefined : _a.index) !== null && _b !== undefined ? _b : body === null || body === undefined ? undefined : body.length;
393
+ const what = body === null || body === undefined ? undefined : body.slice(((_c = row.index) !== null && _c !== undefined ? _c : 0) + row[0].length, end).trim();
394
+ if (what) {
395
+ told.set(Number(row[1]), what);
396
+ }
397
+ });
398
+ return "";
399
+ });
400
+ return { said: said === text2 ? text2 : said.replace(/\n{3,}/g, `
401
+
402
+ `).trim(), told };
403
+ }
404
+ TaPictureNote2.take = take;
405
+ function strip(text2) {
406
+ return take(text2).said;
407
+ }
408
+ TaPictureNote2.strip = strip;
409
+ })(TaPictureNote || (TaPictureNote = {}));
410
+ var TaSkillUse;
411
+ (function(TaSkillUse2) {
412
+ const BLOCK = /^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/;
413
+ function parse(message) {
414
+ var _a;
415
+ const match = BLOCK.exec(message);
416
+ if (!match) {
417
+ return;
418
+ }
419
+ return { name: match[1], location: match[2], content: match[3], message: ((_a = match[4]) === null || _a === undefined ? undefined : _a.trim()) || undefined };
420
+ }
421
+ TaSkillUse2.parse = parse;
422
+ function command(use) {
423
+ return use.message ? `/skill:${use.name} ${use.message}` : `/skill:${use.name}`;
424
+ }
425
+ TaSkillUse2.command = command;
426
+ })(TaSkillUse || (TaSkillUse = {}));
427
+ var TaTaskNote;
428
+ (function(TaTaskNote2) {
429
+ const NOTE = /^<task_(update|adopted|renamed) ((?:[^>"\n]|"[^"]*")*)>\n?([\s\S]*?)\n?<\/task_\1>$/;
430
+ const ATTRIBUTE = /(\w+)="([^"]*)"/g;
431
+ function write(note) {
432
+ const attributes = [`id="${quote(note.id)}"`];
433
+ if (note.was !== undefined) {
434
+ attributes.push(`was="${quote(note.was)}"`);
435
+ }
436
+ attributes.push(`title="${quote(note.title)}"`);
437
+ if (note.status !== undefined) {
438
+ attributes.push(`status="${quote(note.status)}"`);
439
+ }
440
+ return `<task_${note.kind} ${attributes.join(" ")}>
441
+ ${note.body}
442
+ </task_${note.kind}>`;
443
+ }
444
+ TaTaskNote2.write = write;
445
+ function parse(text2) {
446
+ const match = NOTE.exec(text2.trim());
447
+ if (!match) {
448
+ return;
449
+ }
450
+ const attributes = {};
451
+ for (const [, name, value] of match[2].matchAll(ATTRIBUTE)) {
452
+ attributes[name] = unquote(value);
453
+ }
454
+ if (!attributes.id || attributes.title === undefined) {
455
+ return;
456
+ }
457
+ const { id, title, status, was } = attributes;
458
+ return { kind: match[1], id, title, ...status ? { status } : {}, ...was ? { was } : {}, body: match[3] };
459
+ }
460
+ TaTaskNote2.parse = parse;
461
+ function quote(text2) {
462
+ return text2.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/\n/g, " ");
463
+ }
464
+ function unquote(text2) {
465
+ return text2.replace(/&quot;/g, '"').replace(/&amp;/g, "&");
466
+ }
467
+ })(TaTaskNote || (TaTaskNote = {}));
468
+ var TaSecretRef;
469
+ (function(TaSecretRef2) {
470
+ TaSecretRef2.PACKAGE = "@celljs/ta-secrets";
471
+ const REF = /\$\{?TA_SECRET_([A-Z0-9][A-Z0-9_]*)\}?/g;
472
+ const KINDS2 = [
473
+ [/^PHONE(?:_\d+)?$/, "phone"],
474
+ [/^EMAIL(?:_\d+)?$/, "email"],
475
+ [/^ID_NUMBER(?:_\d+)?$/, "idNumber"],
476
+ [/^BANK_CARD(?:_\d+)?$/, "bankCard"]
477
+ ];
478
+ function has(text2) {
479
+ return text2.includes("TA_SECRET_") && new RegExp(REF.source).test(text2);
480
+ }
481
+ TaSecretRef2.has = has;
482
+ function kind(name) {
483
+ var _a;
484
+ var _b;
485
+ return (_b = (_a = KINDS2.find(([pattern]) => pattern.test(name))) === null || _a === undefined ? undefined : _a[1]) !== null && _b !== undefined ? _b : "secret";
486
+ }
487
+ TaSecretRef2.kind = kind;
488
+ function split(text2) {
489
+ if (!has(text2)) {
490
+ return [{ text: text2 }];
491
+ }
492
+ const parts = [];
493
+ let at = 0;
494
+ for (const match of text2.matchAll(REF)) {
495
+ if (match.index > at) {
496
+ parts.push({ text: text2.slice(at, match.index) });
497
+ }
498
+ parts.push({ secret: match[1], kind: kind(match[1]) });
499
+ at = match.index + match[0].length;
500
+ }
501
+ if (at < text2.length) {
502
+ parts.push({ text: text2.slice(at) });
503
+ }
504
+ return parts;
505
+ }
506
+ TaSecretRef2.split = split;
507
+ function plain(text2, label) {
508
+ return has(text2) ? text2.replace(REF, (_whole, name) => label(name, kind(name))) : text2;
509
+ }
510
+ TaSecretRef2.plain = plain;
511
+ })(TaSecretRef || (TaSecretRef = {}));
512
+
186
513
  // web-src/values.ts
187
514
  var text2 = (value, max = 2000) => typeof value === "string" ? value.trim().slice(0, max) : "";
188
515
  var texts = (value, max = 50) => Array.isArray(value) ? value.map((one) => text2(one, 200)).filter(Boolean).slice(0, max) : [];
@@ -204,10 +531,94 @@ function count(value, fallback) {
204
531
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : fallback;
205
532
  }
206
533
 
534
+ // web-src/efficiency.ts
535
+ var HOUR = 3600000;
536
+ var DAY = 24 * HOUR;
537
+ var Efficiency;
538
+ ((Efficiency) => {
539
+ Efficiency.SPAN = 7 * DAY;
540
+ function costOf(messages, now) {
541
+ let ms = 0;
542
+ let tokens = 0;
543
+ let turns = 0;
544
+ for (const message of messages) {
545
+ const kept = object2(message);
546
+ if (kept?.role === "assistant") {
547
+ ms += count(kept.durationMs, 0);
548
+ tokens += count(object2(kept.usage)?.totalTokens, 0);
549
+ } else if (kept?.role === "user") {
550
+ turns++;
551
+ }
552
+ }
553
+ return ms ? { minutes: Math.round(ms / 6000) / 10, ...tokens ? { tokens } : {}, turns, at: now } : undefined;
554
+ }
555
+ Efficiency.costOf = costOf;
556
+ function cost(value) {
557
+ const kept = object2(value);
558
+ const at = time2(kept?.at);
559
+ return kept && at && typeof kept.minutes === "number" ? { minutes: Math.max(0, kept.minutes), ...count(kept.tokens, 0) ? { tokens: count(kept.tokens, 0) } : {}, turns: count(kept.turns, 0), at } : undefined;
560
+ }
561
+ Efficiency.cost = cost;
562
+ function fields(kept) {
563
+ const made = cost(kept.cost);
564
+ return { ...time2(kept.started) ? { started: time2(kept.started) } : {}, ...made ? { cost: made } : {} };
565
+ }
566
+ Efficiency.fields = fields;
567
+ function leadHours(item) {
568
+ return item.stage === "published" && item.links?.length ? Math.round((outAt(item) - item.at) / HOUR * 10) / 10 : undefined;
569
+ }
570
+ Efficiency.leadHours = leadHours;
571
+ function taskRuns(runs, from, to) {
572
+ const of = runs.filter((one) => {
573
+ const at = Date.parse(one.startedAt);
574
+ return at >= from && at < to && one.status !== "running";
575
+ });
576
+ return {
577
+ runs: of.length,
578
+ empty: of.filter((one) => one.quiet).length,
579
+ failed: of.filter((one) => one.status === "error").length,
580
+ minutes: Math.round(of.reduce((all, one) => all + (one.ranMs ?? 0), 0) / 60000)
581
+ };
582
+ }
583
+ Efficiency.taskRuns = taskRuns;
584
+ function pieces(items, from, to) {
585
+ const of = items.filter((one) => {
586
+ const at = one.stage === "published" && one.links?.length ? outAt(one) : 0;
587
+ return !one.dropped && at >= from && at < to;
588
+ });
589
+ const costs = of.flatMap((one) => one.cost ? [one.cost] : []);
590
+ return {
591
+ pieces: of.length,
592
+ leadHours: middle(of.map(leadHours)),
593
+ minutes: middle(costs.map((one) => one.minutes)),
594
+ tokens: middle(costs.map((one) => one.tokens)),
595
+ turns: middle(costs.map((one) => one.turns))
596
+ };
597
+ }
598
+ Efficiency.pieces = pieces;
599
+ function outAt(item) {
600
+ return Math.min(...(item.links ?? []).map((one) => one.scheduled ?? one.at));
601
+ }
602
+ function middle(values) {
603
+ const known = values.filter((one) => typeof one === "number").sort((a, b) => a - b);
604
+ if (!known.length) {
605
+ return;
606
+ }
607
+ const at = Math.floor(known.length / 2);
608
+ return known.length % 2 ? known[at] : Math.round((known[at - 1] + known[at]) / 2 * 10) / 10;
609
+ }
610
+ Efficiency.middle = middle;
611
+ function windows(now) {
612
+ return { before: [now - 2 * Efficiency.SPAN, now - Efficiency.SPAN], after: [now - Efficiency.SPAN, now + 1] };
613
+ }
614
+ Efficiency.windows = windows;
615
+ })(Efficiency ||= {});
616
+
207
617
  // web-src/creator-util.ts
208
- var DAY = 86400000;
618
+ var DAY2 = 86400000;
209
619
  var MAX_TOPICS = 200;
210
- var HOT_FOR = 2 * DAY;
620
+ var HOT_FOR = 2 * DAY2;
621
+ var MAX_TONES = 3;
211
622
  var CreatorUtil;
212
623
  ((CreatorUtil) => {
213
624
  function settings(value) {
@@ -223,6 +634,7 @@ var CreatorUtil;
223
634
  ...goal && time2(goal.from) ? { goal: { from: time2(goal.from), days: count(goal.days, 30), videos: count(goal.videos, 0), posts: count(goal.posts, 0) } } : {},
224
635
  minutesCap: count(kept.minutesCap, 120),
225
636
  voice: text2(kept.voice, 60) || "zh-CN-XiaoxiaoNeural",
637
+ tone: tones(kept.tone),
226
638
  series: Array.isArray(kept.series) ? seriesOf(kept.series) : [],
227
639
  strategy: kept.strategy === "manual" ? "manual" : "auto",
228
640
  phaseWeeks: typeof kept.phaseWeeks === "number" ? Math.min(26, count(kept.phaseWeeks, 4)) : 4,
@@ -244,6 +656,17 @@ var CreatorUtil;
244
656
  return [...known, ...PLATFORMS.filter((one) => !kept.some((it) => it.id === one.id))];
245
657
  }
246
658
  CreatorUtil.withBuiltins = withBuiltins;
659
+ function tones(value) {
660
+ return [
661
+ ...new Set(texts(value).map((one) => text2(one, 20)).filter(Boolean))
662
+ ].slice(0, MAX_TONES);
663
+ }
664
+ CreatorUtil.tones = tones;
665
+ function toneOf(item2, settings2) {
666
+ const own = settings2.series.find((one) => one.id === item2?.series)?.tone;
667
+ return (own ? [own] : settings2.tone).map((one) => (one in TONES) ? TONES[one] : one);
668
+ }
669
+ CreatorUtil.toneOf = toneOf;
247
670
  function reach(item2, settings2) {
248
671
  return item2.reach ?? settings2.series.find((one) => one.id === item2.series)?.reach ?? "public";
249
672
  }
@@ -279,6 +702,7 @@ var CreatorUtil;
279
702
  }
280
703
  const about = text2(kept.about, 200);
281
704
  const perWeek = count(kept.perWeek, 0);
705
+ const tone = text2(kept.tone, 20);
282
706
  all.push({
283
707
  id,
284
708
  name,
@@ -286,7 +710,8 @@ var CreatorUtil;
286
710
  color: text2(kept.color, 40) || SERIES_COLORS[all.length % SERIES_COLORS.length],
287
711
  ...kept.ordered === true ? { ordered: true } : {},
288
712
  ...perWeek ? { perWeek: Math.min(perWeek, 14) } : {},
289
- ...kept.reach === "internal" || kept.reach === "both" ? { reach: kept.reach } : {}
713
+ ...kept.reach === "internal" || kept.reach === "both" ? { reach: kept.reach } : {},
714
+ ...tone ? { tone } : {}
290
715
  });
291
716
  }
292
717
  return all.slice(0, 12);
@@ -375,12 +800,13 @@ var CreatorUtil;
375
800
  ...Array.isArray(kept.checks) ? { checks: kept.checks.map(check).filter((one) => !!one) } : {},
376
801
  ...text2(kept.session, 1000) ? { session: text2(kept.session, 1000) } : {},
377
802
  ...time2(kept.approved) ? { approved: time2(kept.approved) } : {},
378
- ...PublishUtil.publishing(kept.publishing) ? { publishing: PublishUtil.publishing(kept.publishing) } : {},
803
+ ...PublishUtil.of(kept) ? { publishing: PublishUtil.of(kept) } : {},
379
804
  ...Array.isArray(kept.links) ? { links: kept.links.map(link).filter((one) => !!one) } : {},
380
805
  ...Array.isArray(kept.stats) ? { stats: kept.stats.map(stat).filter((one) => !!one) } : {},
381
806
  ...kept.dropped === true ? { dropped: true } : {},
382
807
  ...time2(kept.commentsAt) ? { commentsAt: time2(kept.commentsAt) } : {},
383
808
  ...time2(kept.commentsGap) ? { commentsGap: time2(kept.commentsGap) } : {},
809
+ ...Efficiency.fields(kept),
384
810
  at,
385
811
  changedAt: time2(kept.changedAt) ?? at
386
812
  };
@@ -414,7 +840,8 @@ var CreatorUtil;
414
840
  topic: of("topic").filter((one) => !expired(one, now)).sort((a, b) => (b.heat ?? 0) - (a.heat ?? 0) || b.at - a.at),
415
841
  materials: of("materials").sort(latest),
416
842
  making: of("making").sort(latest),
417
- review: of("review").sort(latest),
843
+ review: of("review").filter((one) => !one.approved).sort(latest),
844
+ publishing: of("review").filter((one) => !!one.approved).sort((a, b) => (a.approved ?? 0) - (b.approved ?? 0)),
418
845
  published: of("published").sort((a, b) => publishedAt(b) - publishedAt(a))
419
846
  };
420
847
  }
@@ -505,7 +932,7 @@ var CreatorUtil;
505
932
  if (!goal) {
506
933
  return;
507
934
  }
508
- const end = goal.from + goal.days * DAY;
935
+ const end = goal.from + goal.days * DAY2;
509
936
  const published = items2.filter((one) => one.stage === "published" && (one.links?.length ?? 0) > 0).filter((one) => {
510
937
  const at = publishedAt(one);
511
938
  return at >= goal.from && at < end;
@@ -513,7 +940,7 @@ var CreatorUtil;
513
940
  return {
514
941
  videos: published.filter((one) => one.form === "video").length,
515
942
  posts: published.filter((one) => one.form !== "video").length,
516
- day: Math.max(1, Math.min(goal.days, Math.floor((now - goal.from) / DAY) + 1))
943
+ day: Math.max(1, Math.min(goal.days, Math.floor((now - goal.from) / DAY2) + 1))
517
944
  };
518
945
  }
519
946
  CreatorUtil.progress = progress;
@@ -595,9 +1022,7 @@ var CreatorUtil;
595
1022
  return {
596
1023
  platform: platform2,
597
1024
  views: count(kept.views, 0),
598
- ...optional("likes"),
599
- ...optional("comments"),
600
- ...optional("follows"),
1025
+ ...Object.assign({}, ...["likes", "comments", "follows", "watch"].map(optional)),
601
1026
  ...typeof kept.completion === "number" && Number.isFinite(kept.completion) ? { completion: Math.max(0, Math.min(1, kept.completion)) } : {},
602
1027
  at: time2(kept.at) ?? Date.now()
603
1028
  };
@@ -697,7 +1122,7 @@ var EN = {
697
1122
  startGoal: "Start a 30-day goal",
698
1123
  source: "Source",
699
1124
  failed: "Did not work: {error}",
700
- makePrompt: "Make this piece: {title} ({id})",
1125
+ makePrompt: "Make this piece: {title}",
701
1126
  findPrompt: "Find hot topics for my channel now",
702
1127
  changePrompt: "Change {id}: {note}",
703
1128
  all: "All",
@@ -734,7 +1159,9 @@ var EN = {
734
1159
  flowSeries: "{n} series",
735
1160
  flowNone: "None yet",
736
1161
  flowWaiting: "{n} wait for you",
737
- flowPassed: "Passed, publishing",
1162
+ flowPublishing: "{n} passed, publishing",
1163
+ publishingHead: "Publishing",
1164
+ publishingAbout: "Passed by you: Ta publishes them one at a time",
738
1165
  flowWeek: "{n} this week",
739
1166
  flowMonday: "Reviewed each Monday",
740
1167
  showAll: "Show all {n}",
@@ -748,7 +1175,34 @@ var EN = {
748
1175
  byForm: "By form",
749
1176
  byPlatform: "By platform",
750
1177
  perPiece: "views a piece",
1178
+ noViews: "no views yet",
751
1179
  completion: "watched {n}%",
1180
+ eachPiece: "Each piece",
1181
+ statViews: "{n} views",
1182
+ statWatch: "{n}s on average",
1183
+ statLikes: "{n} likes",
1184
+ statComments: "{n} comments",
1185
+ statFollows: "+{n} followers",
1186
+ statWaiting: "Read a day after it is out",
1187
+ statLate: "Not read in 48 hours",
1188
+ effTitle: "What it took Ta",
1189
+ effHint: "last 7 days against the 7 before",
1190
+ effBefore: "Before",
1191
+ effAfter: "Last 7 days",
1192
+ effPieces: "Pieces published",
1193
+ effLead: "Topic to out",
1194
+ effMinutes: "Model time a piece",
1195
+ effMin: " min",
1196
+ effTokens: "Tokens a piece",
1197
+ effTurns: "Your messages a piece",
1198
+ eff_topics: "Topic runs",
1199
+ eff_comments: "Comment runs",
1200
+ eff_review: "Review runs",
1201
+ effRuns: "{n} · {empty} empty · {failed} failed",
1202
+ effCost: "Took",
1203
+ effLeadValue: "{n} h to out",
1204
+ effMinutesValue: "model {n} min",
1205
+ effTokensValue: "{n} tokens",
752
1206
  pieces: "{n} pieces",
753
1207
  weekly: "Views by week",
754
1208
  top: "Did best",
@@ -836,7 +1290,21 @@ var EN = {
836
1290
  insideName: "Name",
837
1291
  insideUrl: "Address of its publishing page",
838
1292
  addInside: "Add",
839
- seriesInside: "In-company"
1293
+ seriesInside: "In-company",
1294
+ toneLabel: "Style of language",
1295
+ toneHint: "Scripts, titles and replies follow it",
1296
+ toneOwn: "Your own words, e.g. like chatting with a friend",
1297
+ toneAdd: "Add",
1298
+ seriesTone: "Style of language of the series",
1299
+ seriesToneSame: "Channel style",
1300
+ tone_humorous: "Humorous",
1301
+ tone_serious: "Serious",
1302
+ tone_rigorous: "Rigorous",
1303
+ tone_warm: "Warm",
1304
+ tone_lively: "Lively",
1305
+ tone_plain: "Plain-spoken",
1306
+ tone_story: "Storytelling",
1307
+ tone_sharp: "Sharp"
840
1308
  };
841
1309
  var ZH = {
842
1310
  title: "创作者",
@@ -886,7 +1354,7 @@ var ZH = {
886
1354
  startGoal: "开始 30 天目标",
887
1355
  source: "出处",
888
1356
  failed: "没做成:{error}",
889
- makePrompt: "做这条内容:{title}({id})",
1357
+ makePrompt: "做这条内容:{title}",
890
1358
  findPrompt: "现在给我的内容号找一批热点选题",
891
1359
  changePrompt: "{id} 要改:{note}",
892
1360
  all: "全部",
@@ -923,7 +1391,9 @@ var ZH = {
923
1391
  flowSeries: "{n} 个系列",
924
1392
  flowNone: "暂无",
925
1393
  flowWaiting: "{n} 条等你审",
926
- flowPassed: "已通过,发布中",
1394
+ flowPublishing: "{n} 条已通过,发布中",
1395
+ publishingHead: "发布中",
1396
+ publishingAbout: "你已通过,Ta 按顺序逐条发布",
927
1397
  flowWeek: "本周 {n} 条",
928
1398
  flowMonday: "每周一复盘",
929
1399
  showAll: "展开全部 {n}",
@@ -937,7 +1407,34 @@ var ZH = {
937
1407
  byForm: "按形式",
938
1408
  byPlatform: "按平台",
939
1409
  perPiece: "条均播放",
1410
+ noViews: "还没有播放数据",
940
1411
  completion: "完播 {n}%",
1412
+ eachPiece: "每条数据",
1413
+ statViews: "播放 {n}",
1414
+ statWatch: "均看 {n} 秒",
1415
+ statLikes: "赞 {n}",
1416
+ statComments: "评 {n}",
1417
+ statFollows: "涨粉 {n}",
1418
+ statWaiting: "发布满一天后读取",
1419
+ statLate: "超过 48 小时未读",
1420
+ effTitle: "执行效率",
1421
+ effHint: "近 7 天对比前 7 天",
1422
+ effBefore: "前 7 天",
1423
+ effAfter: "近 7 天",
1424
+ effPieces: "发布条数",
1425
+ effLead: "选题到发布",
1426
+ effMinutes: "每条运行时长",
1427
+ effMin: " 分",
1428
+ effTokens: "每条 token",
1429
+ effTurns: "每条你发的消息",
1430
+ eff_topics: "选题任务",
1431
+ eff_comments: "评论任务",
1432
+ eff_review: "复盘任务",
1433
+ effRuns: "{n} 次 · 空跑 {empty} · 失败 {failed}",
1434
+ effCost: "耗时",
1435
+ effLeadValue: "选题到发布 {n} 小时",
1436
+ effMinutesValue: "运行 {n} 分",
1437
+ effTokensValue: "{n} token",
941
1438
  pieces: "{n} 条",
942
1439
  weekly: "每周播放",
943
1440
  top: "表现最好",
@@ -1025,7 +1522,21 @@ var ZH = {
1025
1522
  insideName: "平台名",
1026
1523
  insideUrl: "发布页地址",
1027
1524
  addInside: "添加",
1028
- seriesInside: "公司内"
1525
+ seriesInside: "公司内",
1526
+ toneLabel: "语言风格",
1527
+ toneHint: "脚本、文案、评论回复都照着写",
1528
+ toneOwn: "自己写一个,比如:像朋友聊天",
1529
+ toneAdd: "添加",
1530
+ seriesTone: "这个系列的语言风格",
1531
+ seriesToneSame: "同频道风格",
1532
+ tone_humorous: "幽默",
1533
+ tone_serious: "严肃",
1534
+ tone_rigorous: "逻辑缜密",
1535
+ tone_warm: "亲切",
1536
+ tone_lively: "活泼",
1537
+ tone_plain: "通俗易懂",
1538
+ tone_story: "讲故事",
1539
+ tone_sharp: "犀利"
1029
1540
  };
1030
1541
  var ZH_TW = {
1031
1542
  title: "創作者",
@@ -1075,7 +1586,7 @@ var ZH_TW = {
1075
1586
  startGoal: "開始 30 天目標",
1076
1587
  source: "出處",
1077
1588
  failed: "沒做成:{error}",
1078
- makePrompt: "做這條內容:{title}({id})",
1589
+ makePrompt: "做這條內容:{title}",
1079
1590
  findPrompt: "現在給我的內容號找一批熱點選題",
1080
1591
  changePrompt: "{id} 要改:{note}",
1081
1592
  all: "全部",
@@ -1112,7 +1623,9 @@ var ZH_TW = {
1112
1623
  flowSeries: "{n} 個系列",
1113
1624
  flowNone: "暫無",
1114
1625
  flowWaiting: "{n} 條等你審",
1115
- flowPassed: "已通過,發佈中",
1626
+ flowPublishing: "{n} 條已通過,發佈中",
1627
+ publishingHead: "發佈中",
1628
+ publishingAbout: "你已通過,Ta 按順序逐條發佈",
1116
1629
  flowWeek: "本週 {n} 條",
1117
1630
  flowMonday: "每週一複盤",
1118
1631
  showAll: "展開全部 {n}",
@@ -1126,7 +1639,34 @@ var ZH_TW = {
1126
1639
  byForm: "按形式",
1127
1640
  byPlatform: "按平台",
1128
1641
  perPiece: "條均播放",
1642
+ noViews: "還沒有播放數據",
1129
1643
  completion: "完播 {n}%",
1644
+ eachPiece: "每則數據",
1645
+ statViews: "播放 {n}",
1646
+ statWatch: "均看 {n} 秒",
1647
+ statLikes: "讚 {n}",
1648
+ statComments: "評 {n}",
1649
+ statFollows: "漲粉 {n}",
1650
+ statWaiting: "發布滿一天後讀取",
1651
+ statLate: "超過 48 小時未讀",
1652
+ effTitle: "執行效率",
1653
+ effHint: "近 7 天對比前 7 天",
1654
+ effBefore: "前 7 天",
1655
+ effAfter: "近 7 天",
1656
+ effPieces: "發布則數",
1657
+ effLead: "選題到發布",
1658
+ effMinutes: "每則執行時長",
1659
+ effMin: " 分",
1660
+ effTokens: "每則 token",
1661
+ effTurns: "每則你發的訊息",
1662
+ eff_topics: "選題任務",
1663
+ eff_comments: "留言任務",
1664
+ eff_review: "複盤任務",
1665
+ effRuns: "{n} 次 · 空跑 {empty} · 失敗 {failed}",
1666
+ effCost: "耗時",
1667
+ effLeadValue: "選題到發布 {n} 小時",
1668
+ effMinutesValue: "執行 {n} 分",
1669
+ effTokensValue: "{n} token",
1130
1670
  pieces: "{n} 條",
1131
1671
  weekly: "每週播放",
1132
1672
  top: "表現最好",
@@ -1214,7 +1754,21 @@ var ZH_TW = {
1214
1754
  insideName: "平台名",
1215
1755
  insideUrl: "發佈頁地址",
1216
1756
  addInside: "新增",
1217
- seriesInside: "公司內"
1757
+ seriesInside: "公司內",
1758
+ toneLabel: "語言風格",
1759
+ toneHint: "腳本、文案、評論回覆都照著寫",
1760
+ toneOwn: "自己寫一個,比如:像朋友聊天",
1761
+ toneAdd: "添加",
1762
+ seriesTone: "這個系列的語言風格",
1763
+ seriesToneSame: "同頻道風格",
1764
+ tone_humorous: "幽默",
1765
+ tone_serious: "嚴肅",
1766
+ tone_rigorous: "邏輯縝密",
1767
+ tone_warm: "親切",
1768
+ tone_lively: "活潑",
1769
+ tone_plain: "通俗易懂",
1770
+ tone_story: "講故事",
1771
+ tone_sharp: "犀利"
1218
1772
  };
1219
1773
  var JA = {
1220
1774
  title: "クリエイター",
@@ -1264,7 +1818,7 @@ var JA = {
1264
1818
  startGoal: "30 日間の目標を始める",
1265
1819
  source: "出典",
1266
1820
  failed: "できませんでした:{error}",
1267
- makePrompt: "このコンテンツを作って:{title}({id})",
1821
+ makePrompt: "このコンテンツを作って:{title}",
1268
1822
  findPrompt: "私のチャンネル向けに今の話題からネタを探して",
1269
1823
  changePrompt: "{id} を直して:{note}",
1270
1824
  all: "すべて",
@@ -1301,7 +1855,9 @@ var JA = {
1301
1855
  flowSeries: "{n} シリーズ",
1302
1856
  flowNone: "なし",
1303
1857
  flowWaiting: "{n} 件が確認待ち",
1304
- flowPassed: "OK 済み、投稿中",
1858
+ flowPublishing: "OK 済み {n} 件、投稿中",
1859
+ publishingHead: "投稿中",
1860
+ publishingAbout: "OK 済み:Ta が順番に 1 件ずつ投稿します",
1305
1861
  flowWeek: "今週 {n} 件",
1306
1862
  flowMonday: "毎週月曜に振り返り",
1307
1863
  showAll: "すべて表示 {n}",
@@ -1315,7 +1871,34 @@ var JA = {
1315
1871
  byForm: "形式別",
1316
1872
  byPlatform: "プラットフォーム別",
1317
1873
  perPiece: "1 件あたり再生",
1874
+ noViews: "まだ再生データなし",
1318
1875
  completion: "完走 {n}%",
1876
+ eachPiece: "作品ごとの数字",
1877
+ statViews: "再生 {n}",
1878
+ statWatch: "平均 {n} 秒",
1879
+ statLikes: "いいね {n}",
1880
+ statComments: "コメント {n}",
1881
+ statFollows: "フォロワー +{n}",
1882
+ statWaiting: "公開から 1 日後に読み取り",
1883
+ statLate: "48 時間読めていません",
1884
+ effTitle: "実行効率",
1885
+ effHint: "直近 7 日とその前の 7 日",
1886
+ effBefore: "前の 7 日",
1887
+ effAfter: "直近 7 日",
1888
+ effPieces: "公開数",
1889
+ effLead: "企画から公開",
1890
+ effMinutes: "1 本の実行時間",
1891
+ effMin: " 分",
1892
+ effTokens: "1 本の token",
1893
+ effTurns: "1 本のあなたのメッセージ",
1894
+ eff_topics: "企画タスク",
1895
+ eff_comments: "コメントタスク",
1896
+ eff_review: "振り返りタスク",
1897
+ effRuns: "{n} 回 · 空振り {empty} · 失敗 {failed}",
1898
+ effCost: "所要",
1899
+ effLeadValue: "企画から公開 {n} 時間",
1900
+ effMinutesValue: "実行 {n} 分",
1901
+ effTokensValue: "{n} token",
1319
1902
  pieces: "{n} 件",
1320
1903
  weekly: "週ごとの再生",
1321
1904
  top: "好調だったもの",
@@ -1403,7 +1986,21 @@ var JA = {
1403
1986
  insideName: "名前",
1404
1987
  insideUrl: "投稿ページのアドレス",
1405
1988
  addInside: "追加",
1406
- seriesInside: "社内"
1989
+ seriesInside: "社内",
1990
+ toneLabel: "語り口",
1991
+ toneHint: "台本・タイトル・返信をこの口調で",
1992
+ toneOwn: "自分の言葉で(例:友達と話すように)",
1993
+ toneAdd: "追加",
1994
+ seriesTone: "このシリーズの語り口",
1995
+ seriesToneSame: "チャンネルと同じ",
1996
+ tone_humorous: "ユーモア",
1997
+ tone_serious: "真面目",
1998
+ tone_rigorous: "論理的",
1999
+ tone_warm: "親しみやすい",
2000
+ tone_lively: "元気",
2001
+ tone_plain: "わかりやすい",
2002
+ tone_story: "ストーリー",
2003
+ tone_sharp: "鋭い"
1407
2004
  };
1408
2005
  var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
1409
2006
  var CreatorWords;
@@ -1442,11 +2039,14 @@ async function talk(pi, title, message) {
1442
2039
  await pi.server.prompt(session.sessionId, { message, clientMessageId: crypto.randomUUID() });
1443
2040
  return session.sessionFile;
1444
2041
  }
2042
+ function makeMessage(pi, item) {
2043
+ const shown = format(useWordsOf(pi).makePrompt, { title: item.title });
2044
+ return TaMessageSource.mark(TaMessageContext.wrap(`Make the piece ${item.id} of Creator.`, shown), NAME);
2045
+ }
1445
2046
  async function make(context, item) {
1446
2047
  const { pi, store } = context;
1447
- const words = useWordsOf(pi);
1448
2048
  await store.call("start", item.id);
1449
- const file = await talk(pi, item.title, format(words.makePrompt, { title: item.title, id: item.id }));
2049
+ const file = await talk(pi, item.title, makeMessage(pi, item));
1450
2050
  if (file) {
1451
2051
  await store.call("update", item.id, { session: file });
1452
2052
  }
@@ -1456,7 +2056,7 @@ async function openPiece(context, item) {
1456
2056
  if (item.session && await pi.openChat?.(item.session)) {
1457
2057
  return;
1458
2058
  }
1459
- await talk(pi, item.title, format(useWordsOf(pi).makePrompt, { title: item.title, id: item.id }));
2059
+ await talk(pi, item.title, makeMessage(pi, item));
1460
2060
  }
1461
2061
  async function tell(context, item, text3) {
1462
2062
  const { pi } = context;
@@ -1821,10 +2421,10 @@ var ReviewCode;
1821
2421
  })(ReviewCode ||= {});
1822
2422
 
1823
2423
  // web-src/channel-util.ts
1824
- var HOUR = 3600000;
1825
- var DAY2 = 24 * HOUR;
2424
+ var HOUR2 = 3600000;
2425
+ var DAY3 = 24 * HOUR2;
1826
2426
  var MAX_COMMENTS = 600;
1827
- var COMMENTS_FOR = 60 * DAY2;
2427
+ var COMMENTS_FOR = 60 * DAY3;
1828
2428
  var MAX_LESSONS = 40;
1829
2429
  var ChannelUtil;
1830
2430
  ((ChannelUtil) => {
@@ -1931,7 +2531,7 @@ var ChannelUtil;
1931
2531
  function latestInsights(insights2) {
1932
2532
  const ta = insights2.filter((one) => one.by !== "user" && !one.state);
1933
2533
  const newest = ta[0]?.at ?? 0;
1934
- return insights2.filter((one) => one.by === "user" || !one.state && newest - one.at < DAY2);
2534
+ return insights2.filter((one) => one.by === "user" || !one.state && newest - one.at < DAY3);
1935
2535
  }
1936
2536
  ChannelUtil.latestInsights = latestInsights;
1937
2537
  function proposed(insights2) {
@@ -1954,7 +2554,7 @@ var ChannelUtil;
1954
2554
  }
1955
2555
  const published = items.filter((one) => one.stage === "published" && !one.dropped).map(CreatorUtil.publishedAt);
1956
2556
  const from = phases2[0]?.to ?? (published.length ? Math.min(...published) : undefined);
1957
- if (from === undefined || now - from < settings.phaseWeeks * 7 * DAY2 || !published.some((at) => at >= from)) {
2557
+ if (from === undefined || now - from < settings.phaseWeeks * 7 * DAY3 || !published.some((at) => at >= from)) {
1958
2558
  return;
1959
2559
  }
1960
2560
  return { from, to: now };
@@ -1968,7 +2568,7 @@ var ChannelUtil;
1968
2568
  return (item.needs ?? []).every((one) => one.done);
1969
2569
  }
1970
2570
  ChannelUtil.given = given;
1971
- ChannelUtil.PACE = { start: 6 * HOUR, first: 12 * HOUR, min: HOUR, max: 2 * DAY2, many: 3 };
2571
+ ChannelUtil.PACE = { start: 12 * HOUR2, first: 24 * HOUR2, min: 2 * HOUR2, max: 2 * DAY3, many: 3, ride: 0.5 };
1972
2572
  function nextGap(gap, added) {
1973
2573
  if (added >= ChannelUtil.PACE.many) {
1974
2574
  return Math.max(ChannelUtil.PACE.min, Math.round(gap / 2));
@@ -1982,9 +2582,46 @@ var ChannelUtil;
1982
2582
  }
1983
2583
  ChannelUtil.firstGap = firstGap;
1984
2584
  function commentsGap(item, items, settings) {
1985
- return settings.commentsEvery ? settings.commentsEvery * HOUR : item.commentsGap ?? firstGap(items);
2585
+ return settings.commentsEvery ? settings.commentsEvery * HOUR2 : item.commentsGap ?? firstGap(items);
1986
2586
  }
1987
2587
  ChannelUtil.commentsGap = commentsGap;
2588
+ function live(item, now) {
2589
+ return (item.links ?? []).filter((one) => (one.scheduled ?? one.at) <= now);
2590
+ }
2591
+ ChannelUtil.live = live;
2592
+ function due(items, settings, now, share = 1) {
2593
+ return items.filter((one) => {
2594
+ const out = live(one, now).map((link) => link.scheduled ?? link.at);
2595
+ if (one.stage !== "published" || one.dropped || !out.length) {
2596
+ return false;
2597
+ }
2598
+ const published = Math.min(...out);
2599
+ const since = now - Math.max(one.commentsAt ?? 0, published);
2600
+ return now - published < settings.commentsDays * DAY3 && since >= share * commentsGap(one, items, settings);
2601
+ });
2602
+ }
2603
+ ChannelUtil.due = due;
2604
+ ChannelUtil.STATS = { first: 20 * HOUR2, again: 7 * DAY3, until: 14 * DAY3 };
2605
+ function enough(waiting, settings) {
2606
+ const perWeek = settings.series.reduce((all, one) => all + (one.perWeek ?? 1), 0);
2607
+ return perWeek > 0 && waiting >= 2 * perWeek;
2608
+ }
2609
+ ChannelUtil.enough = enough;
2610
+ function statsDue(items, now) {
2611
+ return items.filter((one) => one.stage === "published" && !one.dropped).map((item) => ({
2612
+ item,
2613
+ links: live(item, now).filter((link) => {
2614
+ const out = link.scheduled ?? link.at;
2615
+ const read = item.stats?.find((one) => one.platform === link.platform);
2616
+ const age = now - out;
2617
+ if (age < ChannelUtil.STATS.first || age >= ChannelUtil.STATS.until) {
2618
+ return false;
2619
+ }
2620
+ return !read || age >= ChannelUtil.STATS.again && read.at - out < ChannelUtil.STATS.again - DAY3;
2621
+ })
2622
+ })).filter((one) => one.links.length > 0);
2623
+ }
2624
+ ChannelUtil.statsDue = statsDue;
1988
2625
  function comments(value, now = Date.now()) {
1989
2626
  return (Array.isArray(value) ? value : []).map(comment).filter((one) => !!one && now - one.at < COMMENTS_FOR).sort((a, b) => a.at - b.at).slice(-MAX_COMMENTS);
1990
2627
  }
@@ -2123,6 +2760,67 @@ class CreatorStore {
2123
2760
  }
2124
2761
  }
2125
2762
 
2763
+ // web-src/efficiency-panel.tsx
2764
+ function EfficiencyPanel({ context }) {
2765
+ const { pi, store } = context;
2766
+ const words = useWords(pi);
2767
+ const state = useStore(store);
2768
+ const [numbers, setNumbers] = React.useState();
2769
+ const published = state.items.filter((one) => one.stage === "published").length;
2770
+ React.useEffect(() => {
2771
+ let live = true;
2772
+ store.call("efficiency").then((got) => live && setNumbers(got), () => {
2773
+ return;
2774
+ });
2775
+ return () => {
2776
+ live = false;
2777
+ };
2778
+ }, [store, published]);
2779
+ if (!numbers) {
2780
+ return null;
2781
+ }
2782
+ const n = (value, unit = "") => value === undefined ? "—" : `${short(value, pi.ui.language)}${unit}`;
2783
+ const runs = (one) => one ? format(words.effRuns, { n: one.runs, empty: one.empty, failed: one.failed }) : "—";
2784
+ const rows = [
2785
+ [words.effPieces, n(numbers.before.pieces.pieces), n(numbers.after.pieces.pieces)],
2786
+ [
2787
+ words.effLead,
2788
+ n(numbers.before.pieces.leadHours, " h"),
2789
+ n(numbers.after.pieces.leadHours, " h"),
2790
+ lower(numbers.before.pieces.leadHours, numbers.after.pieces.leadHours)
2791
+ ],
2792
+ [
2793
+ words.effMinutes,
2794
+ n(numbers.before.pieces.minutes, words.effMin),
2795
+ n(numbers.after.pieces.minutes, words.effMin),
2796
+ lower(numbers.before.pieces.minutes, numbers.after.pieces.minutes)
2797
+ ],
2798
+ [words.effTokens, n(numbers.before.pieces.tokens), n(numbers.after.pieces.tokens), lower(numbers.before.pieces.tokens, numbers.after.pieces.tokens)],
2799
+ [words.effTurns, n(numbers.before.pieces.turns), n(numbers.after.pieces.turns), lower(numbers.before.pieces.turns, numbers.after.pieces.turns)],
2800
+ ...["topics", "comments", "review"].map((id) => [words[`eff_${id}`], runs(numbers.before.tasks[id]), runs(numbers.after.tasks[id])])
2801
+ ];
2802
+ return /* @__PURE__ */ React.createElement("div", {
2803
+ className: "tcre-card tcre-panel tcre-wide"
2804
+ }, /* @__PURE__ */ React.createElement("div", {
2805
+ className: "tcre-panel-title"
2806
+ }, words.effTitle, /* @__PURE__ */ React.createElement("span", {
2807
+ className: "tcre-muted"
2808
+ }, words.effHint)), /* @__PURE__ */ React.createElement("div", {
2809
+ className: "tcre-eff"
2810
+ }, /* @__PURE__ */ React.createElement("span", null), /* @__PURE__ */ React.createElement("span", {
2811
+ className: "tcre-muted"
2812
+ }, words.effBefore), /* @__PURE__ */ React.createElement("span", {
2813
+ className: "tcre-muted"
2814
+ }, words.effAfter), rows.map(([label, before, after, better]) => /* @__PURE__ */ React.createElement(React.Fragment, {
2815
+ key: label
2816
+ }, /* @__PURE__ */ React.createElement("span", null, label), /* @__PURE__ */ React.createElement("span", null, before), /* @__PURE__ */ React.createElement("span", {
2817
+ "data-better": better === undefined ? undefined : String(better)
2818
+ }, after)))));
2819
+ }
2820
+ function lower(before, after) {
2821
+ return before === undefined || after === undefined || before === after ? undefined : after < before;
2822
+ }
2823
+
2126
2824
  // web-src/strategy.tsx
2127
2825
  var PHASE_WEEKS = [2, 4, 8, 0];
2128
2826
  function Strategy({ context }) {
@@ -2250,7 +2948,15 @@ function Phases({ context }) {
2250
2948
  className: "tcre-card tcre-panel tcre-wide"
2251
2949
  }, /* @__PURE__ */ React.createElement("div", {
2252
2950
  className: "tcre-panel-title"
2253
- }, words.phases, /* @__PURE__ */ React.createElement("div", {
2951
+ }, words.phases, /* @__PURE__ */ React.createElement("span", {
2952
+ className: "tcre-grow"
2953
+ }), /* @__PURE__ */ React.createElement(BusyButton, {
2954
+ pi,
2955
+ className: "tcre-secondary tcre-small",
2956
+ onClick: () => talk(pi, words.phaseNow, words.phasePrompt)
2957
+ }, words.phaseNow)), /* @__PURE__ */ React.createElement("div", {
2958
+ className: "tcre-phase-every"
2959
+ }, /* @__PURE__ */ React.createElement("div", {
2254
2960
  className: "ta-segmented tcre-seg"
2255
2961
  }, PHASE_WEEKS.map((n) => /* @__PURE__ */ React.createElement(BusyButton, {
2256
2962
  key: n,
@@ -2258,13 +2964,7 @@ function Phases({ context }) {
2258
2964
  pressed: every === n,
2259
2965
  className: every === n ? "ta-on" : "",
2260
2966
  onClick: () => store.call("setSettings", { phaseWeeks: n })
2261
- }, n ? format(words.phaseEvery, { n }) : words.phaseOff))), /* @__PURE__ */ React.createElement("span", {
2262
- className: "tcre-grow"
2263
- }), /* @__PURE__ */ React.createElement(BusyButton, {
2264
- pi,
2265
- className: "tcre-secondary tcre-small",
2266
- onClick: () => talk(pi, words.phaseNow, words.phasePrompt)
2267
- }, words.phaseNow)), state.phases.length ? state.phases.slice(0, 6).map((one) => /* @__PURE__ */ React.createElement("div", {
2967
+ }, n ? format(words.phaseEvery, { n }) : words.phaseOff)))), state.phases.length ? state.phases.slice(0, 6).map((one) => /* @__PURE__ */ React.createElement("div", {
2268
2968
  key: one.at,
2269
2969
  className: "tcre-phase"
2270
2970
  }, /* @__PURE__ */ React.createElement("span", {
@@ -2288,27 +2988,29 @@ function GroupBars({
2288
2988
  const { pi } = context;
2289
2989
  const words = useWords(pi);
2290
2990
  const most = Math.max(1, ...groups.map((one) => one.group.average));
2991
+ const measured = groups.some((one) => one.group.measured);
2291
2992
  return /* @__PURE__ */ React.createElement("div", {
2292
2993
  className: wide ? "tcre-card tcre-panel tcre-wide" : "tcre-card tcre-panel"
2293
2994
  }, /* @__PURE__ */ React.createElement("div", {
2294
2995
  className: "tcre-panel-title"
2295
2996
  }, label, /* @__PURE__ */ React.createElement("span", {
2296
2997
  className: "tcre-muted"
2297
- }, words.perPiece)), groups.map(({ group, name, color }) => /* @__PURE__ */ React.createElement("div", {
2998
+ }, measured ? words.perPiece : words.noViews)), groups.map(({ group, name, color }) => /* @__PURE__ */ React.createElement("div", {
2298
2999
  key: group.key || name,
2299
- className: "tcre-bar"
3000
+ className: "tcre-bar",
3001
+ "data-plain": !measured || undefined
2300
3002
  }, /* @__PURE__ */ React.createElement("span", {
2301
3003
  className: "tcre-bar-label",
2302
3004
  title: name
2303
3005
  }, color && /* @__PURE__ */ React.createElement("i", {
2304
3006
  style: { background: color }
2305
- }), name), /* @__PURE__ */ React.createElement("span", {
3007
+ }), name), measured && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
2306
3008
  className: "tcre-bar-track"
2307
3009
  }, group.average > 0 && /* @__PURE__ */ React.createElement("i", {
2308
3010
  style: { width: `${group.average / most * 100}%`, background: color }
2309
3011
  })), /* @__PURE__ */ React.createElement("span", {
2310
3012
  className: "tcre-bar-value"
2311
- }, group.measured ? short(group.average, pi.ui.language) : "—"), /* @__PURE__ */ React.createElement("span", {
3013
+ }, group.measured ? short(group.average, pi.ui.language) : "—")), /* @__PURE__ */ React.createElement("span", {
2312
3014
  className: "tcre-bar-note"
2313
3015
  }, group.count ? format(words.pieces, { n: group.count }) : words.noneYet, group.completion !== undefined ? ` · ${format(words.completion, { n: Math.round(group.completion * 100) })}` : ""))));
2314
3016
  }
@@ -2338,6 +3040,67 @@ function WeekLine({ context }) {
2338
3040
  className: "tcre-line-labels"
2339
3041
  }, /* @__PURE__ */ React.createElement("span", null, weeks[0].week.slice(5)), /* @__PURE__ */ React.createElement("span", null, weeks[weeks.length - 1].week.slice(5))));
2340
3042
  }
3043
+ function PieceNumbers({ context, now }) {
3044
+ const { pi } = context;
3045
+ const state = useStore(context.store);
3046
+ const words = useWords(pi);
3047
+ const pieces = state.items.filter((one) => one.stage === "published" && !one.dropped && ChannelUtil.live(one, now).length > 0).sort((a, b) => CreatorUtil.publishedAt(b) - CreatorUtil.publishedAt(a));
3048
+ if (!pieces.length) {
3049
+ return null;
3050
+ }
3051
+ const n = (value) => short(value, pi.ui.language);
3052
+ return /* @__PURE__ */ React.createElement("div", {
3053
+ className: "tcre-card tcre-panel tcre-wide"
3054
+ }, /* @__PURE__ */ React.createElement("div", {
3055
+ className: "tcre-panel-title"
3056
+ }, words.eachPiece), pieces.map((item) => /* @__PURE__ */ React.createElement("div", {
3057
+ key: item.id,
3058
+ className: "tcre-piece-stats"
3059
+ }, /* @__PURE__ */ React.createElement("div", {
3060
+ className: "tcre-piece-title"
3061
+ }, /* @__PURE__ */ React.createElement("span", null, item.title), /* @__PURE__ */ React.createElement(SeriesTag, {
3062
+ series: seriesOf(context, item.series),
3063
+ words
3064
+ })), (item.cost || Efficiency.leadHours(item) !== undefined) && /* @__PURE__ */ React.createElement("div", {
3065
+ className: "tcre-piece-row tcre-piece-cost"
3066
+ }, /* @__PURE__ */ React.createElement("span", {
3067
+ className: "tcre-bar-label"
3068
+ }, words.effCost), /* @__PURE__ */ React.createElement("span", {
3069
+ className: "tcre-piece-values"
3070
+ }, [
3071
+ Efficiency.leadHours(item) !== undefined ? format(words.effLeadValue, { n: Efficiency.leadHours(item) }) : "",
3072
+ item.cost ? format(words.effMinutesValue, { n: item.cost.minutes }) : "",
3073
+ item.cost?.tokens ? format(words.effTokensValue, { n: n(item.cost.tokens) }) : ""
3074
+ ].filter(Boolean).map((part) => /* @__PURE__ */ React.createElement("span", {
3075
+ key: part
3076
+ }, part)))), ChannelUtil.live(item, now).map((link) => {
3077
+ const platform = platformOf(context, link.platform);
3078
+ const stat = item.stats?.find((one) => one.platform === link.platform);
3079
+ const late = !stat && now - (link.scheduled ?? link.at) > 48 * 3600000;
3080
+ const parts = stat ? [
3081
+ format(words.statViews, { n: n(stat.views) }),
3082
+ stat.completion !== undefined ? format(words.completion, { n: Math.round(stat.completion * 100) }) : "",
3083
+ stat.watch !== undefined ? format(words.statWatch, { n: stat.watch }) : "",
3084
+ stat.likes !== undefined ? format(words.statLikes, { n: n(stat.likes) }) : "",
3085
+ stat.comments !== undefined ? format(words.statComments, { n: n(stat.comments) }) : "",
3086
+ stat.follows !== undefined ? format(words.statFollows, { n: n(stat.follows) }) : ""
3087
+ ].filter(Boolean) : [late ? words.statLate : words.statWaiting];
3088
+ return /* @__PURE__ */ React.createElement("div", {
3089
+ key: link.platform,
3090
+ className: "tcre-piece-row",
3091
+ "data-late": late || undefined,
3092
+ "data-none": !stat || undefined
3093
+ }, /* @__PURE__ */ React.createElement("span", {
3094
+ className: "tcre-bar-label"
3095
+ }, platform?.color && /* @__PURE__ */ React.createElement("i", {
3096
+ style: { background: platform.color }
3097
+ }), platform?.name ?? link.platform), /* @__PURE__ */ React.createElement("span", {
3098
+ className: "tcre-piece-values"
3099
+ }, parts.map((part) => /* @__PURE__ */ React.createElement("span", {
3100
+ key: part
3101
+ }, part))));
3102
+ }))));
3103
+ }
2341
3104
  function Numbers({ context }) {
2342
3105
  const { pi } = context;
2343
3106
  const state = useStore(context.store);
@@ -2397,6 +3160,11 @@ function Numbers({ context }) {
2397
3160
  })
2398
3161
  }), /* @__PURE__ */ React.createElement(WeekLine, {
2399
3162
  context
3163
+ }), /* @__PURE__ */ React.createElement(EfficiencyPanel, {
3164
+ context
3165
+ }), /* @__PURE__ */ React.createElement(PieceNumbers, {
3166
+ context,
3167
+ now
2400
3168
  }), analysis.top.length > 0 && /* @__PURE__ */ React.createElement("div", {
2401
3169
  className: "tcre-card tcre-panel"
2402
3170
  }, /* @__PURE__ */ React.createElement("div", {
@@ -2449,10 +3217,16 @@ function Setup({ context, done }) {
2449
3217
  const [series, setSeries] = React.useState(state.settings.series);
2450
3218
  const [platforms, setPlatforms] = React.useState(state.settings.platforms);
2451
3219
  const [inside, setInside] = React.useState({ name: "", url: "" });
3220
+ const [tone, setTone] = React.useState(state.settings.tone);
3221
+ const [ownTone, setOwnTone] = React.useState("");
3222
+ const tones = [...Object.keys(TONES), ...tone.filter((one) => !(one in TONES))];
3223
+ const toneName = (one) => (one in TONES) ? words[`tone_${one}`] : one;
3224
+ const toggleTone = (one) => setTone(tone.includes(one) ? tone.filter((it) => it !== one) : [...tone, one].slice(-3));
2452
3225
  const { Trash2, Plus } = pi.ui.icons;
2453
3226
  const first = !state.settings.picked.length;
2454
3227
  const save = (goal) => store.call("setSettings", {
2455
3228
  niche: niche.trim(),
3229
+ tone,
2456
3230
  picked,
2457
3231
  platforms,
2458
3232
  series: series.map((one) => ({ ...one, name: one.name.trim(), about: one.about?.trim() })).filter((one) => one.name),
@@ -2472,6 +3246,37 @@ function Setup({ context, done }) {
2472
3246
  onChange: (event) => setNiche(event.target.value)
2473
3247
  }), /* @__PURE__ */ React.createElement("div", {
2474
3248
  className: "tcre-setup-label"
3249
+ }, words.toneLabel, /* @__PURE__ */ React.createElement("span", null, words.toneHint)), /* @__PURE__ */ React.createElement("div", {
3250
+ className: "tcre-pick"
3251
+ }, tones.map((one) => /* @__PURE__ */ React.createElement("button", {
3252
+ key: one,
3253
+ type: "button",
3254
+ "aria-pressed": tone.includes(one),
3255
+ onClick: () => toggleTone(one)
3256
+ }, toneName(one)))), /* @__PURE__ */ React.createElement("div", {
3257
+ className: "tcre-inside-add"
3258
+ }, /* @__PURE__ */ React.createElement("input", {
3259
+ className: "tcre-field",
3260
+ value: ownTone,
3261
+ maxLength: 20,
3262
+ placeholder: words.toneOwn,
3263
+ onChange: (event) => setOwnTone(event.target.value),
3264
+ onKeyDown: (event) => {
3265
+ if (event.key === "Enter" && ownTone.trim()) {
3266
+ toggleTone(ownTone.trim());
3267
+ setOwnTone("");
3268
+ }
3269
+ }
3270
+ }), /* @__PURE__ */ React.createElement("button", {
3271
+ type: "button",
3272
+ className: "tcre-secondary tcre-small",
3273
+ disabled: !ownTone.trim() || tone.includes(ownTone.trim()),
3274
+ onClick: () => {
3275
+ toggleTone(ownTone.trim());
3276
+ setOwnTone("");
3277
+ }
3278
+ }, words.toneAdd)), /* @__PURE__ */ React.createElement("div", {
3279
+ className: "tcre-setup-label"
2475
3280
  }, words.seriesLabel, /* @__PURE__ */ React.createElement("span", null, words.seriesHint)), /* @__PURE__ */ React.createElement("div", {
2476
3281
  className: "tcre-card tcre-series-edit"
2477
3282
  }, series.map((one, at) => /* @__PURE__ */ React.createElement("div", {
@@ -2490,7 +3295,19 @@ function Setup({ context, done }) {
2490
3295
  value: one.about ?? "",
2491
3296
  placeholder: words.seriesAbout,
2492
3297
  onChange: (event) => set(at, { about: event.target.value })
2493
- })), /* @__PURE__ */ React.createElement("button", {
3298
+ })), /* @__PURE__ */ React.createElement("select", {
3299
+ className: "tcre-toggle tcre-tone-pick",
3300
+ "aria-label": words.seriesTone,
3301
+ title: words.seriesTone,
3302
+ "data-on": one.tone ? "true" : undefined,
3303
+ value: one.tone ?? "",
3304
+ onChange: (event) => set(at, { tone: event.target.value || undefined })
3305
+ }, /* @__PURE__ */ React.createElement("option", {
3306
+ value: ""
3307
+ }, words.seriesToneSame), [...tones, ...one.tone && !tones.includes(one.tone) ? [one.tone] : []].map((it) => /* @__PURE__ */ React.createElement("option", {
3308
+ key: it,
3309
+ value: it
3310
+ }, toneName(it)))), /* @__PURE__ */ React.createElement("button", {
2494
3311
  type: "button",
2495
3312
  className: "tcre-toggle",
2496
3313
  "aria-pressed": !!one.ordered,
@@ -2602,10 +3419,10 @@ function Setup({ context, done }) {
2602
3419
  }
2603
3420
 
2604
3421
  // web-src/talk.tsx
2605
- var DAY3 = 86400000;
3422
+ var DAY4 = 86400000;
2606
3423
  var LEVELS = ["act", "ask", "off"];
2607
3424
  var LEVEL_WORDS = { act: "levelAct", ask: "levelAsk", off: "levelOff" };
2608
- var HOUR2 = 3600000;
3425
+ var HOUR3 = 3600000;
2609
3426
  var PACE_HOURS = [0, 2, 6, 24];
2610
3427
  var PACE_DAYS = [7, 14, 30];
2611
3428
  function drafts(comments) {
@@ -2617,8 +3434,8 @@ function Talk({ context }) {
2617
3434
  const words = useWords(pi);
2618
3435
  const now = Date.now();
2619
3436
  const waiting = drafts(state.comments);
2620
- const asked = state.comments.filter((one) => (one.class === "question" || one.class === "suggestion") && now - one.at < 14 * DAY3).sort((a, b) => (b.likes ?? 0) - (a.likes ?? 0) || b.at - a.at).slice(0, 12);
2621
- const recent = state.comments.filter((one) => one.reply && one.reply.state !== "draft" && one.reply.state !== "dropped" && now - one.reply.at < 7 * DAY3).sort((a, b) => (b.reply?.at ?? 0) - (a.reply?.at ?? 0)).slice(0, 20);
3437
+ const asked = state.comments.filter((one) => (one.class === "question" || one.class === "suggestion") && now - one.at < 14 * DAY4).sort((a, b) => (b.likes ?? 0) - (a.likes ?? 0) || b.at - a.at).slice(0, 12);
3438
+ const recent = state.comments.filter((one) => one.reply && one.reply.state !== "draft" && one.reply.state !== "dropped" && now - one.reply.at < 7 * DAY4).sort((a, b) => (b.reply?.at ?? 0) - (a.reply?.at ?? 0)).slice(0, 20);
2622
3439
  return /* @__PURE__ */ React.createElement("div", {
2623
3440
  className: "tcre-talk"
2624
3441
  }, !state.comments.length && /* @__PURE__ */ React.createElement("div", {
@@ -2746,7 +3563,7 @@ function Pace({ context }) {
2746
3563
  const words = useWords(pi);
2747
3564
  const { commentsEvery: every, commentsDays: days } = state.settings;
2748
3565
  const latest = state.items.filter((one) => one.stage === "published" && one.commentsGap).sort((a, b) => (b.commentsAt ?? 0) - (a.commentsAt ?? 0))[0];
2749
- const now = latest?.commentsGap ? Math.max(1, Math.round(latest.commentsGap / HOUR2)) : undefined;
3566
+ const now = latest?.commentsGap ? Math.max(1, Math.round(latest.commentsGap / HOUR3)) : undefined;
2750
3567
  const choice = (values, value, label, set) => /* @__PURE__ */ React.createElement("div", {
2751
3568
  className: "ta-segmented tcre-seg"
2752
3569
  }, values.map((n) => /* @__PURE__ */ React.createElement(BusyButton, {
@@ -2862,11 +3679,11 @@ function CreatorPage({ context }) {
2862
3679
  }
2863
3680
  const now = Date.now();
2864
3681
  const all = CreatorUtil.columns(state.items, now);
2865
- const waiting = all.review.filter((one) => !one.approved).length;
2866
- const shown = column ?? (waiting ? "review" : "topic");
3682
+ const shown = column ?? (all.review.length ? "review" : "topic");
2867
3683
  const known = state.settings.series.some((one) => one.id === series);
2868
3684
  const of = (items) => known ? items.filter((one) => one.series === series) : items;
2869
3685
  const columns = { topic: of(all.topic), making: of([...all.materials, ...all.making]), review: of(all.review), published: of(all.published) };
3686
+ const publishing = of(all.publishing);
2870
3687
  const body = () => {
2871
3688
  switch (shown) {
2872
3689
  case "topic":
@@ -2883,7 +3700,8 @@ function CreatorPage({ context }) {
2883
3700
  case "review":
2884
3701
  return /* @__PURE__ */ React.createElement(Reviews, {
2885
3702
  context,
2886
- items: columns.review
3703
+ items: columns.review,
3704
+ publishing
2887
3705
  });
2888
3706
  case "published":
2889
3707
  return /* @__PURE__ */ React.createElement(Published, {
@@ -2921,6 +3739,7 @@ function CreatorPage({ context }) {
2921
3739
  }, words.settings)), /* @__PURE__ */ React.createElement(Flow, {
2922
3740
  context,
2923
3741
  columns,
3742
+ publishing: publishing.length,
2924
3743
  shown,
2925
3744
  pick: setColumn
2926
3745
  }), shown !== "data" && shown !== "talk" && /* @__PURE__ */ React.createElement(SeriesBar, {
@@ -2934,12 +3753,18 @@ function CreatorPage({ context }) {
2934
3753
  key: shown
2935
3754
  }, body()));
2936
3755
  }
2937
- function Flow({ context, columns, shown, pick }) {
3756
+ function Flow({
3757
+ context,
3758
+ columns,
3759
+ publishing,
3760
+ shown,
3761
+ pick
3762
+ }) {
2938
3763
  const { pi } = context;
2939
3764
  const state = useStore(context.store);
2940
3765
  const words = useWords(pi);
2941
3766
  const now = Date.now();
2942
- const waiting = columns.review.filter((one) => !one.approved).length;
3767
+ const waiting = columns.review.length;
2943
3768
  const thisWeek = columns.published.filter((one) => CreatorUtil.publishedAt(one) >= new Date(`${CreatorUtil.weekOf(now)}T00:00:00`).getTime()).length;
2944
3769
  const materials = columns.making.filter((one) => one.stage === "materials").length;
2945
3770
  const making = columns.making.filter((one) => one.stage === "making");
@@ -2949,7 +3774,7 @@ function Flow({ context, columns, shown, pick }) {
2949
3774
  const hint = {
2950
3775
  topic: state.settings.series.length ? format(words.flowSeries, { n: state.settings.series.length }) : words.findNow,
2951
3776
  making: materials ? format(words.flowMaterials, { n: materials }) : step ? `${words[step]} · ${making[0].title}` : making.length ? words.doneAll : words.flowNone,
2952
- review: waiting ? format(words.flowWaiting, { n: waiting }) : columns.review.length ? words.flowPassed : words.flowNone,
3777
+ review: waiting ? format(words.flowWaiting, { n: waiting }) : publishing ? format(words.flowPublishing, { n: publishing }) : words.flowNone,
2953
3778
  published: format(words.flowWeek, { n: thisWeek }),
2954
3779
  talk: answers ? format(words.flowDrafts, { n: answers }) : format(words.flowComments, { n: state.comments.length }),
2955
3780
  data: last ? `${words.lastWeek} ${short(last.platforms.reduce((all, one) => all + one.views, 0), pi.ui.language)}` : words.flowMonday
@@ -3265,7 +4090,7 @@ function Making({ context, items }) {
3265
4090
  stage: "materials"
3266
4091
  }));
3267
4092
  }
3268
- function Reviews({ context, items }) {
4093
+ function Reviews({ context, items, publishing }) {
3269
4094
  const { pi } = context;
3270
4095
  const words = useWords(pi);
3271
4096
  return /* @__PURE__ */ React.createElement(React.Fragment, null, !items.length && /* @__PURE__ */ React.createElement(Empty, {
@@ -3278,7 +4103,21 @@ function Reviews({ context, items }) {
3278
4103
  context,
3279
4104
  item,
3280
4105
  onRemove: () => remove(context, item)
3281
- }))), /* @__PURE__ */ React.createElement(Removed, {
4106
+ }))), !!publishing.length && /* @__PURE__ */ React.createElement("div", {
4107
+ className: "tcre-section"
4108
+ }, /* @__PURE__ */ React.createElement("div", {
4109
+ className: "tcre-section-head"
4110
+ }, /* @__PURE__ */ React.createElement("i", null), /* @__PURE__ */ React.createElement("span", {
4111
+ className: "tcre-section-name"
4112
+ }, words.publishingHead), /* @__PURE__ */ React.createElement("span", {
4113
+ className: "tcre-section-about"
4114
+ }, words.publishingAbout)), /* @__PURE__ */ React.createElement("div", {
4115
+ className: "tcre-grid tcre-grid-wide"
4116
+ }, publishing.map((item) => /* @__PURE__ */ React.createElement(ReviewCard, {
4117
+ key: item.id,
4118
+ context,
4119
+ item
4120
+ })))), /* @__PURE__ */ React.createElement(Removed, {
3282
4121
  context,
3283
4122
  stage: "review"
3284
4123
  }));
@@ -3552,6 +4391,7 @@ button.tcre-pill:hover { background: var(--ta-hover); }
3552
4391
  .tcre-rule-actions { flex: none; display: flex; align-items: center; gap: 4px; }
3553
4392
  .tcre-rule-add { display: flex; gap: 8px; margin-top: 10px; }
3554
4393
  .tcre-rule-add .tcre-field { flex: 1; min-width: 0; }
4394
+ .tcre-phase-every { display: flex; margin: 0 0 10px; }
3555
4395
  .tcre-phase { display: flex; align-items: baseline; gap: 12px; padding: 9px 0; border-top: 1px solid var(--tcre-line); font-size: calc(13.5px * var(--ta-font-scale)); }
3556
4396
  .tcre-phase:first-of-type { border-top: 0; }
3557
4397
  .tcre-phase-when { flex: none; color: var(--ta-muted); font-variant-numeric: tabular-nums; font-size: calc(12px * var(--ta-font-scale)); }
@@ -3587,12 +4427,29 @@ button.tcre-pill:hover { background: var(--ta-hover); }
3587
4427
  .tcre-bar-track i { display: block; height: 100%; min-width: 2px; border-radius: 4px; background: var(--ta-text); }
3588
4428
  .tcre-bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
3589
4429
  .tcre-bar-note { grid-column: 2 / 4; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); }
4430
+ .tcre-bar[data-plain], .tcre-home[data-compact] .tcre-bar[data-plain] { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 0; }
4431
+ .tcre-bar[data-plain] .tcre-bar-note { grid-column: auto; font-size: inherit; font-variant-numeric: tabular-nums; }
3590
4432
  .tcre-line { display: block; width: 100%; height: 90px; overflow: visible; }
3591
4433
  .tcre-line polyline { fill: none; stroke: #a855f7; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
3592
4434
  .tcre-line-labels { display: flex; justify-content: space-between; margin-top: 4px; color: var(--ta-muted); font-size: calc(11px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
3593
4435
  .tcre-top-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: calc(13px * var(--ta-font-scale)); }
3594
4436
  .tcre-top-row + .tcre-top-row { border-top: 1px solid var(--tcre-line); }
3595
4437
  .tcre-top-row > b { flex: none; width: 18px; color: var(--ta-muted); font-variant-numeric: tabular-nums; }
4438
+ .tcre-piece-stats { padding: 8px 0; }
4439
+ .tcre-piece-stats + .tcre-piece-stats { border-top: 1px solid var(--tcre-line); }
4440
+ .tcre-piece-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: calc(13px * var(--ta-font-scale)); font-weight: 500; }
4441
+ .tcre-piece-title > span:first-child { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
4442
+ .tcre-piece-row { display: flex; align-items: baseline; gap: 10px; padding: 2px 0; font-size: calc(12px * var(--ta-font-scale)); }
4443
+ .tcre-piece-row .tcre-bar-label { flex: none; width: 64px; }
4444
+ .tcre-piece-values { display: flex; flex-wrap: wrap; gap: 0 12px; min-width: 0; font-variant-numeric: tabular-nums; }
4445
+ .tcre-piece-values > span { white-space: nowrap; }
4446
+ .tcre-piece-row[data-none] .tcre-piece-values { color: var(--ta-muted); }
4447
+ .tcre-piece-row[data-late] .tcre-piece-values { color: #d97706; }
4448
+ .tcre-piece-cost .tcre-piece-values { color: var(--ta-muted); }
4449
+ .tcre-eff { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 7px 12px; font-size: calc(12.5px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
4450
+ .tcre-eff > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
4451
+ .tcre-eff > span[data-better='true'] { color: var(--tcre-ok); font-weight: 600; }
4452
+ .tcre-eff > span[data-better='false'] { color: #d97706; font-weight: 600; }
3596
4453
  .tcre-top-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3597
4454
  .tcre-goal-row { display: flex; justify-content: space-between; margin: 8px 0 6px; font-size: calc(13px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
3598
4455
  .tcre-goal-track { height: 6px; border-radius: 3px; background: var(--ta-chip); overflow: hidden; }
@@ -3612,7 +4469,7 @@ button.tcre-pill:hover { background: var(--ta-hover); }
3612
4469
  /* Settings. */
3613
4470
  .tcre-setup { max-width: var(--ta-page-width); margin: 22px auto; }
3614
4471
  .tcre-setup-title { font-size: calc(20px * var(--ta-font-scale)); font-weight: 650; margin: 0 2px 14px; }
3615
- .tcre-setup-label { display: flex; align-items: baseline; gap: 10px; margin: 22px 2px 8px; color: var(--ta-text); font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; }
4472
+ .tcre-setup-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 22px 2px 8px; color: var(--ta-text); font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; }
3616
4473
  .tcre-setup-label span { color: var(--ta-muted); font-weight: 400; font-size: calc(12px * var(--ta-font-scale)); }
3617
4474
  .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; }
3618
4475
  :root[data-theme='light'] .tcre-input { box-shadow: inset 0 0 0 1px var(--tcre-line); }
@@ -3626,6 +4483,12 @@ button.tcre-pill:hover { background: var(--ta-hover); }
3626
4483
  .tcre-field-name { color: var(--ta-text); font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; }
3627
4484
  .tcre-toggle { flex: none; height: 26px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--ta-muted); font: inherit; font-size: calc(12px * var(--ta-font-scale)); cursor: pointer; box-shadow: inset 0 0 0 1px var(--tcre-line); }
3628
4485
  .tcre-toggle[aria-pressed='true'] { background: color-mix(in oklab, var(--tcre-c) 15%, transparent); color: var(--tcre-c); box-shadow: none; font-weight: 600; }
4486
+ [data-layout='compact'] .tcre-series-row { flex-wrap: wrap; row-gap: 6px; }
4487
+ [data-layout='compact'] .tcre-series-fields { flex-basis: calc(100% - 14px); }
4488
+ [data-layout='compact'] .tcre-series-row > i { align-self: flex-start; height: 44px; }
4489
+ [data-layout='compact'] .tcre-series-row > .tcre-tone-pick { margin-left: 14px; }
4490
+ .tcre-tone-pick { appearance: none; -webkit-appearance: none; max-width: 92px; padding: 0 10px; text-overflow: ellipsis; text-align: center; }
4491
+ .tcre-tone-pick[data-on='true'] { background: color-mix(in oklab, var(--tcre-c) 15%, transparent); color: var(--tcre-c); box-shadow: none; font-weight: 600; }
3629
4492
  .tcre-series-add { display: flex; align-items: center; gap: 6px; width: 100%; padding: 10px 2px; border: 0; border-top: 1px solid var(--tcre-line); background: transparent; color: var(--ta-secondary); font: inherit; font-size: calc(13px * var(--ta-font-scale)); cursor: pointer; }
3630
4493
  .tcre-series-edit .tcre-series-add:first-child { border-top: 0; }
3631
4494
  .tcre-pick { display: flex; flex-wrap: wrap; gap: 8px; }
@@ -3668,7 +4531,7 @@ function activate(pi) {
3668
4531
  items: () => {
3669
4532
  const words = CreatorWords.of(pi.ui.language);
3670
4533
  const columns = CreatorUtil.columns(store.state.items, Date.now());
3671
- const waiting = columns.review.filter((one) => !one.approved).length;
4534
+ const waiting = columns.review.length;
3672
4535
  const answers = drafts(store.state.comments).length;
3673
4536
  const detail = waiting ? `${words.review} ${waiting}` : answers ? CreatorWords.format(words.flowDrafts, { n: answers }) : columns.topic[0] ? `${words.topic} · ${columns.topic[0].title}` : store.state.settings.niche || words.sub;
3674
4537
  return [