@beff/aula-cli 0.4.0 → 0.4.1

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.
@@ -304,6 +304,7 @@ var SAMPLE_RATE = 24e3;
304
304
  var HOP = 300;
305
305
  var MAX_TOKENS = 250;
306
306
  var LEAD = 16;
307
+ var FIRST = 3;
307
308
  var PEAK = 0.99;
308
309
  function limited(audio) {
309
310
  let loudest = 0;
@@ -328,9 +329,10 @@ async function layout(parts, words, audio) {
328
329
  for (let i = 0; i < spoken.durations.length; i++) edges.push((edges[i] ?? 0) + Number(spoken.durations[i]) * HOP);
329
330
  const head = Math.max((edges[1] ?? 0) - LEAD * HOP, 0);
330
331
  const tail = edges.at(-2) ?? head;
332
+ const first = Math.max((edges[1] ?? 0) - FIRST * HOP, head);
331
333
  known.forEach((phoneme, i) => {
332
- const start = (edges[i + 1] ?? head) - head + offset;
333
- const end = (edges[i + 2] ?? tail) - head + offset;
334
+ const start = (i === 0 ? first : edges[i] ?? head) - head + offset;
335
+ const end = (edges[i + 1] ?? tail) - head + offset;
334
336
  timings.push({ phoneme, start: start / SAMPLE_RATE, end: end / SAMPLE_RATE });
335
337
  });
336
338
  const pause = index < batches.length - 1 ? Math.floor(pauseAfter(batch) * SAMPLE_RATE) : 0;
package/dist/src/cli.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  studentWeightFile,
15
15
  timeAulaVoice,
16
16
  tokenBatches
17
- } from "./chunk-MIOIV5II.js";
17
+ } from "./chunk-S54ZVMWJ.js";
18
18
 
19
19
  // src/cli.ts
20
20
  import { spawn } from "node:child_process";
@@ -271,9 +271,9 @@ var base = Capabilities.create({
271
271
  },
272
272
  spawn
273
273
  });
274
- var { diagnosticsOf, printDiagnostics } = await import("./problems-5HZFSN3S.js");
274
+ var { diagnosticsOf, printDiagnostics } = await import("./problems-BOX43W3Z.js");
275
275
  var { host, loadProject } = await import("./project-NWT5MDQI.js");
276
- var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, webOptions } = await import("./run-XZIXPEHO.js");
276
+ var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, webOptions } = await import("./run-GOYOUYXS.js");
277
277
  var locks = createLocks(base, path3.join(os.homedir(), ".cache/aula/heavy.lock"));
278
278
  var render = createRender(base, process.execPath);
279
279
  var models = path3.join(os.homedir(), ".cache/aula/models");
@@ -296,7 +296,7 @@ async function main(argv) {
296
296
  }
297
297
  const args = parse(rest, optionsOf(command));
298
298
  if (command === "web") {
299
- const { serve } = await import("./server-5YF26EOD.js");
299
+ const { serve } = await import("./server-PFMYGOU2.js");
300
300
  const stop = new AbortController();
301
301
  for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => stop.abort());
302
302
  const web = Capabilities.create({
@@ -312,7 +312,7 @@ async function main(argv) {
312
312
  return 0;
313
313
  }
314
314
  if (command === "tokens") {
315
- const { tokens, tokensArgs } = await import("./commands-XCQ2Y7WV.js");
315
+ const { tokens, tokensArgs } = await import("./commands-CCEO6TTU.js");
316
316
  tokensArgs(args.positional);
317
317
  const tokensOf = createTokens();
318
318
  return await tokens(capabilities, tokensOf, createInterface({ input: process.stdin, crlfDelay: Infinity })) ? 0 : 1;
@@ -12,7 +12,7 @@ import "./chunk-GFCJYE75.js";
12
12
  import "./chunk-2XGNOG2U.js";
13
13
  import "./chunk-BT3Z5CJI.js";
14
14
  import "./chunk-S74JLCZK.js";
15
- import "./chunk-MIOIV5II.js";
15
+ import "./chunk-S54ZVMWJ.js";
16
16
  import "./chunk-46KT47TH.js";
17
17
  import "./chunk-7KT36JRP.js";
18
18
  export {
@@ -2,7 +2,7 @@ import {
2
2
  printDiagnostics
3
3
  } from "./chunk-BT3Z5CJI.js";
4
4
  import "./chunk-S74JLCZK.js";
5
- import "./chunk-MIOIV5II.js";
5
+ import "./chunk-S54ZVMWJ.js";
6
6
  import {
7
7
  diagnosticsOf
8
8
  } from "./chunk-7KT36JRP.js";
@@ -10,7 +10,7 @@ import "./chunk-GFCJYE75.js";
10
10
  import "./chunk-2XGNOG2U.js";
11
11
  import "./chunk-BT3Z5CJI.js";
12
12
  import "./chunk-S74JLCZK.js";
13
- import "./chunk-MIOIV5II.js";
13
+ import "./chunk-S54ZVMWJ.js";
14
14
  import "./chunk-46KT47TH.js";
15
15
  import {
16
16
  wrongArgument
@@ -1,7 +1,7 @@
1
1
  import "./chunk-S74JLCZK.js";
2
2
  import {
3
3
  SERVER_WEIGHTS_PATH
4
- } from "./chunk-MIOIV5II.js";
4
+ } from "./chunk-S54ZVMWJ.js";
5
5
  import {
6
6
  exists
7
7
  } from "./chunk-46KT47TH.js";
@@ -1 +1 @@
1
- import{_ as e,f as t}from"../src-BktLa5tx.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=e(`paragraph`,n);return({sources:e},n)=>t({mechanism:r,sources:e},n??((t,n)=>m(t,n,{mechanism:r,sources:e})))}export{m as findings,h as paragraph};
1
+ import{_ as e,f as t}from"../src-DYumAKNc.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=e(`paragraph`,n);return({sources:e},n)=>t({mechanism:r,sources:e},n??((t,n)=>m(t,n,{mechanism:r,sources:e})))}export{m as findings,h as paragraph};
@@ -1 +1 @@
1
- export{t as checkChapter,n as checkLexicon,r as checkTitle,l as defineChapter,u as defineProject,d as isProjectDefinition,c as m,f as paragraph,p as pronounce,a as readChapter,o as renderChapter,m as renderScene,h as say,g as show,_ as tagText}from"../src-BktLa5tx.js";
1
+ export{t as checkChapter,n as checkLexicon,r as checkTitle,l as defineChapter,u as defineProject,d as isProjectDefinition,c as m,f as paragraph,p as pronounce,a as readChapter,o as renderChapter,m as renderScene,h as say,g as show,_ as tagText}from"../src-DYumAKNc.js";
@@ -1,4 +1,4 @@
1
- import{r as e,t}from"../rolldown-runtime-BLXQ4ufn.js";import{a as n,d as r,f as i,i as a,l as o,m as s,n as c,o as l,p as u,u as d}from"../protocol-sH01VXxC.js";var f=e(t(((e,t)=>{(e=>{var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},o=(e,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(let c of r(a))!i.call(e,c)&&c!==o&&t(e,c,{get:()=>a[c],enumerable:!(s=n(a,c))||s.enumerable});return e},s=e=>o(t({},`__esModule`,{value:!0}),e),c=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),l={};a(l,{analyzeMetafile:()=>be,analyzeMetafileSync:()=>we,build:()=>ge,buildSync:()=>xe,context:()=>_e,default:()=>je,formatMessages:()=>ye,formatMessagesSync:()=>Ce,initialize:()=>ke,stop:()=>Te,transform:()=>ve,transformSync:()=>Se,version:()=>he}),e.exports=s(l);function u(e){let t=e=>{if(e===null)n.write8(0);else if(typeof e==`boolean`)n.write8(1),n.write8(+e);else if(typeof e==`number`)n.write8(2),n.write32(e|0);else if(typeof e==`string`)n.write8(3),n.write(p(e));else if(e instanceof Uint8Array)n.write8(4),n.write(e);else if(e instanceof Array){n.write8(5),n.write32(e.length);for(let n of e)t(n)}else{let r=Object.keys(e);n.write8(6),n.write32(r.length);for(let i of r)n.write(p(i)),t(e[i])}},n=new f;return n.write32(0),n.write32(e.id<<1|!e.isRequest),t(e.value),_(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function d(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return m(n.read());case 4:return n.read();case 5:{let e=n.read32(),r=[];for(let n=0;n<e;n++)r.push(t());return r}case 6:{let e=n.read32(),r={};for(let i=0;i<e;i++)r[m(n.read())]=t();return r}default:throw Error(`Invalid packet`)}},n=new f(e),r=n.read32(),i=!(r&1);r>>>=1;let a=t();if(n.ptr!==e.length)throw Error(`Invalid packet`);return{id:r,isRequest:i,value:a}}var f=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e}write32(e){let t=this._write(4);_(this.buf,e,t)}write(e){let t=this._write(4+e.length);_(this.buf,e.length,t),this.buf.set(e,t+4)}_read(e){if(this.ptr+e>this.buf.length)throw Error(`Invalid packet`);return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return g(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),n=this._read(t.length);return t.set(this.buf.subarray(n,n+e)),t}},p,m,h;if(typeof TextEncoder<`u`&&typeof TextDecoder<`u`){let e=new TextEncoder,t=new TextDecoder;p=t=>e.encode(t),m=e=>t.decode(e),h=`new TextEncoder().encode("")`}else if(typeof Buffer<`u`)p=e=>Buffer.from(e),m=e=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},h=`Buffer.from("")`;else throw Error(`No UTF-8 codec found`);if(!(p(``)instanceof Uint8Array))throw Error(`Invariant violation: "${h} instanceof Uint8Array" is incorrectly false
1
+ import{r as e,t}from"../rolldown-runtime-BLXQ4ufn.js";import{a as n,d as r,f as i,i as a,l as o,m as s,n as c,o as l,p as u,u as d}from"../protocol-OKrdpPQW.js";var f=e(t(((e,t)=>{(e=>{var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},o=(e,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(let c of r(a))!i.call(e,c)&&c!==o&&t(e,c,{get:()=>a[c],enumerable:!(s=n(a,c))||s.enumerable});return e},s=e=>o(t({},`__esModule`,{value:!0}),e),c=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),l={};a(l,{analyzeMetafile:()=>be,analyzeMetafileSync:()=>we,build:()=>ge,buildSync:()=>xe,context:()=>_e,default:()=>je,formatMessages:()=>ye,formatMessagesSync:()=>Ce,initialize:()=>ke,stop:()=>Te,transform:()=>ve,transformSync:()=>Se,version:()=>he}),e.exports=s(l);function u(e){let t=e=>{if(e===null)n.write8(0);else if(typeof e==`boolean`)n.write8(1),n.write8(+e);else if(typeof e==`number`)n.write8(2),n.write32(e|0);else if(typeof e==`string`)n.write8(3),n.write(p(e));else if(e instanceof Uint8Array)n.write8(4),n.write(e);else if(e instanceof Array){n.write8(5),n.write32(e.length);for(let n of e)t(n)}else{let r=Object.keys(e);n.write8(6),n.write32(r.length);for(let i of r)n.write(p(i)),t(e[i])}},n=new f;return n.write32(0),n.write32(e.id<<1|!e.isRequest),t(e.value),_(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function d(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return m(n.read());case 4:return n.read();case 5:{let e=n.read32(),r=[];for(let n=0;n<e;n++)r.push(t());return r}case 6:{let e=n.read32(),r={};for(let i=0;i<e;i++)r[m(n.read())]=t();return r}default:throw Error(`Invalid packet`)}},n=new f(e),r=n.read32(),i=!(r&1);r>>>=1;let a=t();if(n.ptr!==e.length)throw Error(`Invalid packet`);return{id:r,isRequest:i,value:a}}var f=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e}write32(e){let t=this._write(4);_(this.buf,e,t)}write(e){let t=this._write(4+e.length);_(this.buf,e.length,t),this.buf.set(e,t+4)}_read(e){if(this.ptr+e>this.buf.length)throw Error(`Invalid packet`);return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return g(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),n=this._read(t.length);return t.set(this.buf.subarray(n,n+e)),t}},p,m,h;if(typeof TextEncoder<`u`&&typeof TextDecoder<`u`){let e=new TextEncoder,t=new TextDecoder;p=t=>e.encode(t),m=e=>t.decode(e),h=`new TextEncoder().encode("")`}else if(typeof Buffer<`u`)p=e=>Buffer.from(e),m=e=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},h=`Buffer.from("")`;else throw Error(`No UTF-8 codec found`);if(!(p(``)instanceof Uint8Array))throw Error(`Invariant violation: "${h} instanceof Uint8Array" is incorrectly false
2
2
 
3
3
  This indicates that your JavaScript environment is broken. You cannot use
4
4
  esbuild in this environment because esbuild relies on this invariant. This