@beff/aula-cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/licenses/aula-g2p-NOTICE.txt +13 -0
- package/dist/licenses/espeak-ng-COPYING.txt +674 -0
- package/dist/licenses/fonts-OFL-JetBrainsMono.txt +93 -0
- package/dist/licenses/fonts-OFL-NunitoSans.txt +93 -0
- package/dist/src/aula-render.core.wasm +0 -0
- package/dist/src/aula-voice-tts-ZXQ7XXHJ.js +14 -0
- package/dist/src/chunk-2XGNOG2U.js +28 -0
- package/dist/src/chunk-3IBMAZRS.js +21 -0
- package/dist/src/chunk-EYXQ2I7K.js +604 -0
- package/dist/src/chunk-GFCJYE75.js +42 -0
- package/dist/src/chunk-KLE5UOUB.js +57 -0
- package/dist/src/chunk-OMBYV6CK.js +1063 -0
- package/dist/src/chunk-PYRORQA5.js +88 -0
- package/dist/src/chunk-SDFXIMLW.js +1083 -0
- package/dist/src/chunk-UREQAEFC.js +491 -0
- package/dist/src/chunk-X3HJY34X.js +81 -0
- package/dist/src/cli.js +269 -0
- package/dist/src/commands-VDGWDVWT.js +28 -0
- package/dist/src/problems-OGUR4BLZ.js +12 -0
- package/dist/src/project-M63R4ENB.js +11 -0
- package/dist/src/render-child.js +3771 -0
- package/dist/src/run-CY72QGZJ.js +127 -0
- package/dist/src/server-ZG6K7Z7H.js +280 -0
- package/dist/web/app/assets/__vite-browser-external-Bbi05A7N.js +1 -0
- package/dist/web/app/assets/__vite-browser-external-BtQTJ51O.js +1 -0
- package/dist/web/app/assets/aula-method.js +1 -0
- package/dist/web/app/assets/aula-voice-worker-BL6WcrSe.js +52 -0
- package/dist/web/app/assets/aula.core-BtiPQSZi.wasm +0 -0
- package/dist/web/app/assets/aula.core5-BdGB-M10.wasm +0 -0
- package/dist/web/app/assets/aula.js +1 -0
- package/dist/web/app/assets/build-worker.js +697 -0
- package/dist/web/app/assets/esbuild-BaXVPFT2.wasm +0 -0
- package/dist/web/app/assets/index-BVQqteYG.js +53 -0
- package/dist/web/app/assets/index-CS60sOpp.css +2 -0
- package/dist/web/app/assets/protocol-Ds4jI5bY.js +15 -0
- package/dist/web/app/assets/rolldown-runtime-BLXQ4ufn.js +1 -0
- package/dist/web/app/assets/src-BbJ5r410.js +25 -0
- package/dist/web/app/index.html +15 -0
- package/package.json +26 -3
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bundle,
|
|
3
|
+
check,
|
|
4
|
+
exportVideo,
|
|
5
|
+
preview,
|
|
6
|
+
script,
|
|
7
|
+
timeline
|
|
8
|
+
} from "./chunk-OMBYV6CK.js";
|
|
9
|
+
import "./chunk-GFCJYE75.js";
|
|
10
|
+
import "./chunk-2XGNOG2U.js";
|
|
11
|
+
import "./chunk-UREQAEFC.js";
|
|
12
|
+
import "./chunk-KLE5UOUB.js";
|
|
13
|
+
import "./chunk-SDFXIMLW.js";
|
|
14
|
+
import "./chunk-EYXQ2I7K.js";
|
|
15
|
+
import "./chunk-3IBMAZRS.js";
|
|
16
|
+
import {
|
|
17
|
+
wrongArgument
|
|
18
|
+
} from "./chunk-PYRORQA5.js";
|
|
19
|
+
|
|
20
|
+
// src/run.ts
|
|
21
|
+
import path from "node:path";
|
|
22
|
+
var USAGE = `aula: storyboard-first narrated aula videos.
|
|
23
|
+
|
|
24
|
+
<folder> is a project folder: it has index.ts, which exports
|
|
25
|
+
defineProject({ title, theme, chapters }). <chapter> is a chapter name such as
|
|
26
|
+
01-double-the-side (its number and the slug of its heading), or title (the
|
|
27
|
+
title card). Each chapter module holds its script, storyboard notes and
|
|
28
|
+
animations; messages name its lines (file:line:col).
|
|
29
|
+
|
|
30
|
+
aula check <folder> [<chapter> ...]
|
|
31
|
+
every check, with no narration and no frames
|
|
32
|
+
aula preview <folder> <out> [<chapter>[:<line>] ...]
|
|
33
|
+
PNG pictures for review: per chapter, stills,
|
|
34
|
+
motion stills, contact sheets and moves.md
|
|
35
|
+
aula export <folder> <file.mp4> the video to send: narrated in this run, H.264 and
|
|
36
|
+
AAC at 1280x720 and 30 fps; needs ffmpeg
|
|
37
|
+
aula web [<folder>] [--port N] the web app for each subfolder with index.ts, and the
|
|
38
|
+
folder itself if it has one (default: the current
|
|
39
|
+
folder); also the narration API (POST /speak)
|
|
40
|
+
aula bundle <folder> <file.zip> the project zip: the project folder, and the
|
|
41
|
+
packages it imports, to share or host
|
|
42
|
+
aula script <folder> print the narration text with lines
|
|
43
|
+
aula timeline <folder> [<chapter> ...]
|
|
44
|
+
print each say and move with its line, second
|
|
45
|
+
and note
|
|
46
|
+
aula tokens Kokoro v1.0's token ids of texts, for training
|
|
47
|
+
data: reads JSON lines {"id"?, "text"} on
|
|
48
|
+
stdin, writes {"id"?, "batches": [{"phonemes",
|
|
49
|
+
"ids"}]} on stdout, one batch per model run
|
|
50
|
+
|
|
51
|
+
Errors make the exit code 1. Warnings do not change it.`;
|
|
52
|
+
var VALUED = {
|
|
53
|
+
"--port": "a port number"
|
|
54
|
+
};
|
|
55
|
+
function parse(argv, allowed) {
|
|
56
|
+
const args = { positional: [], values: /* @__PURE__ */ new Map() };
|
|
57
|
+
for (let i = 0; i < argv.length; i++) {
|
|
58
|
+
const arg = argv[i] ?? "";
|
|
59
|
+
const what = VALUED[arg];
|
|
60
|
+
if (what !== void 0 && allowed.includes(arg)) {
|
|
61
|
+
i += 1;
|
|
62
|
+
const value = argv[i];
|
|
63
|
+
if (value === void 0) throw wrongArgument(`${arg} needs ${what}`);
|
|
64
|
+
if (!/^[0-9]+$/.test(value)) throw wrongArgument(`${arg} ${value} is not a number`);
|
|
65
|
+
args.values.set(arg, Number(value));
|
|
66
|
+
} else if (arg.startsWith("--")) {
|
|
67
|
+
throw wrongArgument(`unknown option ${arg}`, "run `aula help` for the options of each command");
|
|
68
|
+
} else {
|
|
69
|
+
args.positional.push(arg);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return args;
|
|
73
|
+
}
|
|
74
|
+
var OPTIONS = {
|
|
75
|
+
web: ["--port"]
|
|
76
|
+
};
|
|
77
|
+
var isHelp = (command) => command === void 0 || command === "help" || command === "-h" || command === "--help";
|
|
78
|
+
var ARITY = {
|
|
79
|
+
check: [0, Infinity],
|
|
80
|
+
preview: [1, Infinity],
|
|
81
|
+
export: [1, 1],
|
|
82
|
+
bundle: [1, 1],
|
|
83
|
+
script: [0, 0],
|
|
84
|
+
timeline: [0, Infinity]
|
|
85
|
+
};
|
|
86
|
+
function folderArgs(cwd, command, args) {
|
|
87
|
+
const arity = ARITY[command];
|
|
88
|
+
if (arity === void 0) throw wrongArgument(`unknown command ${command}`, "run `aula help` for the commands");
|
|
89
|
+
const [folder, ...rest] = args.positional;
|
|
90
|
+
if (folder === void 0) throw wrongArgument("missing <folder>: the project folder, which has index.ts");
|
|
91
|
+
if (rest.length < arity[0] || rest.length > arity[1])
|
|
92
|
+
throw wrongArgument("wrong number of arguments", "run `aula help` for the usage");
|
|
93
|
+
return { folder: path.resolve(cwd, folder), rest };
|
|
94
|
+
}
|
|
95
|
+
async function run(capabilities, cwd, command, project, rest) {
|
|
96
|
+
const [first = "", ...more] = rest;
|
|
97
|
+
switch (command) {
|
|
98
|
+
case "check":
|
|
99
|
+
return check(capabilities, cwd, project, rest);
|
|
100
|
+
case "preview":
|
|
101
|
+
return preview(capabilities, cwd, project, path.resolve(cwd, first), more);
|
|
102
|
+
case "export":
|
|
103
|
+
return exportVideo(capabilities, cwd, project, path.resolve(cwd, first));
|
|
104
|
+
case "bundle":
|
|
105
|
+
return bundle(capabilities, project, path.resolve(cwd, first));
|
|
106
|
+
case "script":
|
|
107
|
+
return script(capabilities, cwd, project);
|
|
108
|
+
case "timeline":
|
|
109
|
+
return timeline(capabilities, cwd, project, rest);
|
|
110
|
+
default:
|
|
111
|
+
throw wrongArgument(`unknown command ${command}`, "run `aula help` for the commands");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function webOptions(cwd, args) {
|
|
115
|
+
if (args.positional.length > 1) throw wrongArgument("aula web takes one folder", "run `aula help` for the usage");
|
|
116
|
+
return { root: path.resolve(cwd, args.positional[0] ?? "."), port: args.values.get("--port") ?? 0 };
|
|
117
|
+
}
|
|
118
|
+
var optionsOf = (command) => OPTIONS[command] ?? [];
|
|
119
|
+
export {
|
|
120
|
+
USAGE,
|
|
121
|
+
folderArgs,
|
|
122
|
+
isHelp,
|
|
123
|
+
optionsOf,
|
|
124
|
+
parse,
|
|
125
|
+
run,
|
|
126
|
+
webOptions
|
|
127
|
+
};
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import {
|
|
2
|
+
speakAnswer,
|
|
3
|
+
timeAnswer
|
|
4
|
+
} from "./chunk-X3HJY34X.js";
|
|
5
|
+
import {
|
|
6
|
+
Parsers
|
|
7
|
+
} from "./chunk-KLE5UOUB.js";
|
|
8
|
+
import "./chunk-SDFXIMLW.js";
|
|
9
|
+
import {
|
|
10
|
+
SERVER_WEIGHTS_PATH
|
|
11
|
+
} from "./chunk-EYXQ2I7K.js";
|
|
12
|
+
import {
|
|
13
|
+
exists
|
|
14
|
+
} from "./chunk-3IBMAZRS.js";
|
|
15
|
+
import "./chunk-PYRORQA5.js";
|
|
16
|
+
|
|
17
|
+
// src/web/server.ts
|
|
18
|
+
import { once } from "node:events";
|
|
19
|
+
import { createServer } from "node:http";
|
|
20
|
+
import { basename, dirname, join } from "node:path";
|
|
21
|
+
import { AulaError } from "@beff/aula/errors";
|
|
22
|
+
|
|
23
|
+
// src/package.ts
|
|
24
|
+
var PACKAGE = new URL("../", import.meta.url);
|
|
25
|
+
|
|
26
|
+
// src/web/page.ts
|
|
27
|
+
import { fault } from "@beff/aula/errors";
|
|
28
|
+
var APP = new URL("web/app/", PACKAGE);
|
|
29
|
+
var KINDS = /* @__PURE__ */ new Map([
|
|
30
|
+
[".html", "text/html; charset=utf-8"],
|
|
31
|
+
[".js", "text/javascript"],
|
|
32
|
+
[".css", "text/css"],
|
|
33
|
+
[".svg", "image/svg+xml"],
|
|
34
|
+
[".wasm", "application/wasm"],
|
|
35
|
+
[".json", "application/json"]
|
|
36
|
+
]);
|
|
37
|
+
var plain = (name) => name !== "" && !/[/\\]/.test(name) && !name.startsWith(".");
|
|
38
|
+
async function asset(capabilities, path) {
|
|
39
|
+
const read = async (file) => {
|
|
40
|
+
const url = new URL(file, APP);
|
|
41
|
+
return exists(capabilities, url) ? capabilities.fs.readFile(url) : null;
|
|
42
|
+
};
|
|
43
|
+
if (path === "/") {
|
|
44
|
+
const body2 = await read("index.html");
|
|
45
|
+
if (!body2) fault("the web player is not built", "run `pnpm --filter aula-web-node build`");
|
|
46
|
+
return { body: body2, kind: "text/html; charset=utf-8" };
|
|
47
|
+
}
|
|
48
|
+
if (!path.startsWith("/assets/")) return null;
|
|
49
|
+
const name = path.slice("/assets/".length);
|
|
50
|
+
const kind = KINDS.get(name.slice(name.lastIndexOf(".")));
|
|
51
|
+
if (!plain(name) || kind === void 0) return null;
|
|
52
|
+
const body = await read(`assets/${name}`);
|
|
53
|
+
return body ? { body, kind } : null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/web/reload.ts
|
|
57
|
+
var QUIET = 0.1;
|
|
58
|
+
function watcher(capabilities, reload) {
|
|
59
|
+
let quiet = null;
|
|
60
|
+
const watched = /* @__PURE__ */ new Map();
|
|
61
|
+
const changed = () => {
|
|
62
|
+
const signal = capabilities.clock.timeout(QUIET);
|
|
63
|
+
quiet = signal;
|
|
64
|
+
signal.addEventListener(
|
|
65
|
+
"abort",
|
|
66
|
+
() => {
|
|
67
|
+
if (quiet !== signal) return;
|
|
68
|
+
quiet = null;
|
|
69
|
+
reload();
|
|
70
|
+
},
|
|
71
|
+
{ once: true }
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
follow: (folders) => {
|
|
76
|
+
for (const [folder, handle] of watched) {
|
|
77
|
+
if (folders.includes(folder)) continue;
|
|
78
|
+
handle.close();
|
|
79
|
+
watched.delete(folder);
|
|
80
|
+
}
|
|
81
|
+
for (const folder of folders) {
|
|
82
|
+
if (!watched.has(folder)) watched.set(folder, capabilities.watch(folder, changed));
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
close: () => {
|
|
86
|
+
for (const handle of watched.values()) handle.close();
|
|
87
|
+
watched.clear();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// src/web/server.ts
|
|
93
|
+
function changes(capabilities) {
|
|
94
|
+
const streams = /* @__PURE__ */ new Set();
|
|
95
|
+
const folders = /* @__PURE__ */ new Set();
|
|
96
|
+
const files = watcher(capabilities, () => {
|
|
97
|
+
for (const response of streams) response.write("data: changed\n\n");
|
|
98
|
+
});
|
|
99
|
+
return {
|
|
100
|
+
served: (file) => {
|
|
101
|
+
const folder = dirname(file);
|
|
102
|
+
if (folders.has(folder)) return;
|
|
103
|
+
folders.add(folder);
|
|
104
|
+
files.follow([...folders]);
|
|
105
|
+
},
|
|
106
|
+
stream: (response) => {
|
|
107
|
+
response.writeHead(200, { "Content-Type": "text/event-stream", "Cache-Control": "no-cache" });
|
|
108
|
+
response.write(": watching\n\n");
|
|
109
|
+
streams.add(response);
|
|
110
|
+
response.on("close", () => streams.delete(response));
|
|
111
|
+
},
|
|
112
|
+
close: () => {
|
|
113
|
+
files.close();
|
|
114
|
+
for (const response of streams) response.end();
|
|
115
|
+
streams.clear();
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function shared(load) {
|
|
120
|
+
let running;
|
|
121
|
+
return () => {
|
|
122
|
+
running ??= load().finally(() => {
|
|
123
|
+
running = void 0;
|
|
124
|
+
});
|
|
125
|
+
return running;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
var MAX_BODY = 1 << 20;
|
|
129
|
+
async function serve(capabilities, options) {
|
|
130
|
+
const narration = narrator(capabilities);
|
|
131
|
+
const watching = changes(capabilities);
|
|
132
|
+
const weights = shared(capabilities.weights);
|
|
133
|
+
const server = createServer((request, response) => {
|
|
134
|
+
answer(capabilities, options.root, narration, watching, weights, request, response).catch((error) => {
|
|
135
|
+
const fix = error instanceof AulaError && error.hint !== void 0 ? `: ${error.hint}` : "";
|
|
136
|
+
const message = `${error instanceof Error ? error.message : String(error)}${fix}`;
|
|
137
|
+
capabilities.log.err(`aula web: ${request.url ?? ""}: ${message}`);
|
|
138
|
+
if (!response.headersSent) send(request, response, `${message}
|
|
139
|
+
`, "text/plain", 500);
|
|
140
|
+
else response.destroy();
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
server.listen(options.port, "127.0.0.1");
|
|
144
|
+
await once(server, "listening");
|
|
145
|
+
const address = server.address();
|
|
146
|
+
const port = typeof address === "object" && address !== null ? address.port : options.port;
|
|
147
|
+
capabilities.log.out(`aula web: open http://127.0.0.1:${String(port)}/ in a browser (Ctrl-C stops it)`);
|
|
148
|
+
options.stop.addEventListener("abort", () => {
|
|
149
|
+
watching.close();
|
|
150
|
+
server.close();
|
|
151
|
+
server.closeAllConnections();
|
|
152
|
+
});
|
|
153
|
+
await once(server, "close");
|
|
154
|
+
}
|
|
155
|
+
function narrator(capabilities) {
|
|
156
|
+
let turn = Promise.resolve();
|
|
157
|
+
const speak = async (text, speed) => {
|
|
158
|
+
const release = await capabilities.locks.heavy();
|
|
159
|
+
try {
|
|
160
|
+
return speakAnswer(await capabilities.narrator.speak(text, speed));
|
|
161
|
+
} finally {
|
|
162
|
+
await release();
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
time: async (text, speed) => timeAnswer(await capabilities.narrator.time(text, speed)),
|
|
167
|
+
speak: async (text, speed) => {
|
|
168
|
+
const before = turn;
|
|
169
|
+
const { promise, resolve: done } = Promise.withResolvers();
|
|
170
|
+
turn = promise;
|
|
171
|
+
await before;
|
|
172
|
+
try {
|
|
173
|
+
return await speak(text, speed);
|
|
174
|
+
} finally {
|
|
175
|
+
done();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function send(request, response, body, kind, status) {
|
|
181
|
+
const data = typeof body === "string" ? Buffer.from(body) : body;
|
|
182
|
+
response.writeHead(status, {
|
|
183
|
+
"Content-Type": kind,
|
|
184
|
+
"Cache-Control": "no-cache",
|
|
185
|
+
"Content-Length": data.length
|
|
186
|
+
});
|
|
187
|
+
if (request.method === "HEAD") response.end();
|
|
188
|
+
else response.end(data);
|
|
189
|
+
}
|
|
190
|
+
var notFound = (request, response) => {
|
|
191
|
+
send(request, response, "Not found\n", "text/plain", 404);
|
|
192
|
+
};
|
|
193
|
+
function pathParts(path) {
|
|
194
|
+
const parts = decodeURIComponent(path).split("/");
|
|
195
|
+
return parts.every((part) => part !== "" && !part.startsWith(".") && !part.includes("\\")) ? parts : null;
|
|
196
|
+
}
|
|
197
|
+
async function readBody(request) {
|
|
198
|
+
const chunks = [];
|
|
199
|
+
let size = 0;
|
|
200
|
+
for await (const chunk of request) {
|
|
201
|
+
const piece = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk));
|
|
202
|
+
size += piece.length;
|
|
203
|
+
if (size > MAX_BODY) throw new Error("the request is too large");
|
|
204
|
+
chunks.push(piece);
|
|
205
|
+
}
|
|
206
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
207
|
+
}
|
|
208
|
+
async function folderFile(capabilities, root, path, request, response, served) {
|
|
209
|
+
const folder = path.startsWith("/folders/") || path === "/folders";
|
|
210
|
+
if (!folder && !path.startsWith("/files/")) return false;
|
|
211
|
+
const rest = path.replace(/^\/(files|folders)\/?/, "");
|
|
212
|
+
const parts = rest === "" && folder ? [] : pathParts(rest);
|
|
213
|
+
if (parts === null) {
|
|
214
|
+
notFound(request, response);
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
const target = join(root, ...parts);
|
|
218
|
+
if (!exists(capabilities, target)) {
|
|
219
|
+
notFound(request, response);
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
if (folder) {
|
|
223
|
+
const entries = await capabilities.fs.readdir(target, { withFileTypes: true });
|
|
224
|
+
const names = entries.filter((e) => (e.isDirectory() || e.isSymbolicLink()) && !e.name.startsWith(".")).map((e) => e.name);
|
|
225
|
+
send(request, response, JSON.stringify(names.toSorted()), "application/json", 200);
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
const data = await capabilities.fs.readFile(target);
|
|
229
|
+
served(target);
|
|
230
|
+
send(request, response, data, "text/plain; charset=utf-8", 200);
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
async function answer(capabilities, root, narration, watching, weights, request, response) {
|
|
234
|
+
const path = new URL(request.url ?? "/", "http://localhost").pathname;
|
|
235
|
+
if (path === "/speak" || path === "/time") {
|
|
236
|
+
if (request.method !== "POST") {
|
|
237
|
+
send(request, response, "Use POST\n", "text/plain", 405);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const parsed = Parsers.SpeakRequest.safeParse(JSON.parse(await readBody(request)));
|
|
241
|
+
if (!parsed.success) {
|
|
242
|
+
send(request, response, 'The body must be {"text": <text>, "speed": <number>}\n', "text/plain", 400);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const { text, speed } = parsed.data;
|
|
246
|
+
const answered = path === "/speak" ? await narration.speak(text, speed) : await narration.time(text, speed);
|
|
247
|
+
send(request, response, JSON.stringify(answered), "application/json", 200);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
251
|
+
notFound(request, response);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (path === "/changes") {
|
|
255
|
+
watching.stream(response);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if (path === SERVER_WEIGHTS_PATH) {
|
|
259
|
+
send(request, response, await weights(), "application/octet-stream", 200);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (path === "/name") {
|
|
263
|
+
send(request, response, basename(root), "text/plain; charset=utf-8", 200);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const file = await asset(capabilities, path);
|
|
267
|
+
if (file) {
|
|
268
|
+
send(request, response, file.body, file.kind, 200);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const served = (target) => {
|
|
272
|
+
watching.served(target);
|
|
273
|
+
};
|
|
274
|
+
if (await folderFile(capabilities, root, path, request, response, served)) return;
|
|
275
|
+
notFound(request, response);
|
|
276
|
+
}
|
|
277
|
+
export {
|
|
278
|
+
pathParts,
|
|
279
|
+
serve
|
|
280
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./aula-voice-worker-BL6WcrSe.js";var t=/* @__PURE__ */ e(((e,t)=>{t.exports={}}));export default t();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./rolldown-runtime-BLXQ4ufn.js";var t=e(((e,t)=>{t.exports={}}));export default t();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e,p as t}from"./src-BbJ5r410.js";var n=8,r=.5,i=3,a=3,o=[`view`,`claim`,`forecast`,`estimate`,`proposed`,`external`,`schematic`,`not measured`,`expected`,`alleged`],s=1,c=e=>JSON.stringify(e);function l(e){return e.toLowerCase().match(/[a-z0-9$%]+/g)??[]}function u(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function d(e,t){let n=l(e),r=` ${l(t).join(` `)} `;for(let e=0;e+a<=n.length;e++)if(r.includes(` ${n.slice(e,e+a).join(` `)} `))return!0;return!1}function f(e){let t=e.toLowerCase();return o.some(e=>t.includes(e))||/(^|[^\p{L}\p{N}_])\p{Lu}[\p{L}\p{N}_.&-]*['’]s(?![\p{L}\p{N}_])/u.test(e)}function p(e,t){let n=Math.max(e.low[0]-t.high[0],t.low[0]-e.high[0],0),r=Math.max(e.low[1]-t.high[1],t.low[1]-e.high[1],0);return Math.hypot(n,r)<=s}function m(e,t,a){let o=[],s=(t,n=e.place)=>{o.push({message:t,...n===void 0?{}:{at:n}})};a.mechanism.trim()===``&&s(`the paragraph has no mechanism: name the one mechanism that the viewer must understand`),a.sources.length===0&&s(`the paragraph has no sources (give its sources, or ["recap"])`);for(let e of a.sources)u(e)&&!t.exists(e)&&s(`${c(e)}: this path is not a file: correct the path or add the file`);let l=t.paragraphs.flatMap(e=>e.says.map(e=>e.text)).join(` `),m=new Map;for(let t of e.screen.instants)for(let e of t.texts)m.set(JSON.stringify([e.place,e.text]),e);for(let e of m.values())e.text.split(/\s+/).filter(Boolean).length>i&&s(`text on screen over ${String(i)} words: ${c(e.text)}; make it shorter`,e.place),d(e.text,l)&&s(`text on screen repeats the narration: ${c(e.text)}; use other words`,e.place);let h=new Map;for(let t of e.screen.instants){let e=new Set(t.texts.filter(e=>e.opacity>r).map(e=>e.id)).size,i=JSON.stringify(t.place);e>(h.get(i)?.count??n)&&h.set(i,{count:e,at:t.place})}for(let{count:e,at:t}of h.values())s(`${String(e)} labels on screen (about ${String(n)} at most): show fewer labels at one time, or split the picture`,t);let g=new Map,_=new Set;for(let t of e.screen.instants)for(let e of t.dashed)t.texts.some(t=>f(t.text)&&p(t,e))?_.add(e.id):g.set(e.id,e);for(let[e,t]of g)_.has(e)||s(`dashed shape with no attribution text near it: put a text that says whose view it is, such as "Smith's view", next to it`,t.place);return t.number===t.count&&e.index===t.paragraphs.length-1&&(a.sources.length!==1||a.sources[0]!==`recap`)&&s(`the video must end with a recap paragraph (sources: ["recap"])`),o}function h(n){let r=t(`paragraph`,n);return({sources:t},n)=>e({mechanism:r,sources:t},n??((e,n)=>m(e,n,{mechanism:r,sources:t})))}export{m as findings,h as paragraph};
|