@beff/aula-cli 0.10.0 → 0.12.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/dist/src/{aula-voice-tts-HPJAJO2Q.js → aula-voice-tts-YOS4IQXV.js} +1 -1
- package/dist/src/aula.js +4 -2
- package/dist/src/{chunk-5ABPFV55.js → chunk-2PAZTBSE.js} +2 -2
- package/dist/src/{chunk-JWBPHDVP.js → chunk-4QGX7XXO.js} +1 -1
- package/dist/src/{chunk-F3A54TW5.js → chunk-AXQBWV7J.js} +12 -6
- package/dist/src/{chunk-4PZYWKO5.js → chunk-DC7A435Z.js} +1 -1
- package/dist/src/{chunk-Y56UHOZ2.js → chunk-DN2LVJO3.js} +1 -0
- package/dist/src/{chunk-XLSX5LTB.js → chunk-HD6FTA3H.js} +9 -9
- package/dist/src/{chunk-5TUGYMFH.js → chunk-PZXFW6ZD.js} +3 -3
- package/dist/src/{chunk-QDLUI7QI.js → chunk-RAGZAJKD.js} +1 -1
- package/dist/src/{chunk-DFXG2P7A.js → chunk-T6CAPT32.js} +11 -7
- package/dist/src/{chunk-KCGXC2RV.js → chunk-TDAWUJ2L.js} +1 -1
- package/dist/src/cli.js +9 -9
- package/dist/src/{commands-INPEJKMQ.js → commands-BSDNHYB3.js} +10 -10
- package/dist/src/problems-CGKCPETU.js +18 -0
- package/dist/src/project-EUFMRQXR.js +16 -0
- package/dist/src/{run-5E6WELS7.js → run-ER27SVTA.js} +33 -23
- package/dist/src/{server-OMZWX7LL.js → server-TJTMSDO2.js} +18 -9
- package/dist/src/{site-FFFLW34V.js → site-RGPJOWSU.js} +32 -15
- package/dist/web/app/assets/{5047b09e → bf5dd884}/aula-method.js +1 -1
- package/dist/web/app/assets/bf5dd884/aula.js +1 -0
- package/dist/web/app/assets/{5047b09e → bf5dd884}/build-worker.js +2 -2
- package/dist/web/app/assets/{5047b09e → bf5dd884}/index.js +3 -2
- package/dist/web/app/assets/{index-BL7_U8KF.css → index-qn44kZJM.css} +1 -1
- package/dist/web/app/assets/protocol-Dc79M9p3.js +15 -0
- package/dist/web/app/assets/{src-DTLT9Lbm.js → src-DWqZcp-P.js} +1 -1
- package/dist/web/app/assets/{tex-mathjax-8QilZX4j.js → tex-mathjax-eWNptbJg.js} +1 -1
- package/dist/web/app/index.html +4 -4
- package/dist/web/site/assets/{eed21106 → 07fb5cf0}/aula-method.js +1 -1
- package/dist/web/site/assets/07fb5cf0/aula.js +1 -0
- package/dist/web/site/assets/{eed21106 → 07fb5cf0}/build-worker.js +2 -2
- package/dist/web/site/assets/{eed21106 → 07fb5cf0}/index.js +3 -2
- package/dist/web/site/assets/{index-BL7_U8KF.css → index-qn44kZJM.css} +1 -1
- package/dist/web/site/assets/protocol-F-4tHoAW.js +15 -0
- package/dist/web/site/assets/{src-DpS3WA7l.js → src-DfPcHwz-.js} +1 -1
- package/dist/web/site/assets/{tex-mathjax-CVHS5J80.js → tex-mathjax-DrZV_cwB.js} +1 -1
- package/dist/web/site/index.html +4 -4
- package/package.json +1 -1
- package/dist/src/problems-IWWXSHZN.js +0 -18
- package/dist/src/project-N53JRWMY.js +0 -16
- package/dist/web/app/assets/5047b09e/aula.js +0 -1
- package/dist/web/app/assets/protocol-C3Pseh4g.js +0 -15
- package/dist/web/site/assets/eed21106/aula.js +0 -1
- package/dist/web/site/assets/protocol-BOv1ch3F.js +0 -15
|
@@ -6,23 +6,25 @@ import {
|
|
|
6
6
|
nodeTree
|
|
7
7
|
} from "./chunk-THQ5Y74K.js";
|
|
8
8
|
import {
|
|
9
|
+
listedProjects,
|
|
9
10
|
loadBuiltProjects,
|
|
10
11
|
workspaceHost
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-AXQBWV7J.js";
|
|
13
|
+
import "./chunk-4QGX7XXO.js";
|
|
13
14
|
import {
|
|
14
15
|
AULA_VOICE_WEIGHTS
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TDAWUJ2L.js";
|
|
16
17
|
import {
|
|
17
18
|
Problems,
|
|
19
|
+
bundleProjects,
|
|
18
20
|
bundleWorkspace,
|
|
19
21
|
projectModules,
|
|
20
22
|
wrongArgument
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-T6CAPT32.js";
|
|
24
|
+
import "./chunk-RAGZAJKD.js";
|
|
23
25
|
import {
|
|
24
26
|
v8Frames
|
|
25
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-DN2LVJO3.js";
|
|
26
28
|
import {
|
|
27
29
|
fault
|
|
28
30
|
} from "./chunk-VX7UVLQW.js";
|
|
@@ -63,7 +65,7 @@ async function mediaFiles(capabilities, folder, projects) {
|
|
|
63
65
|
return (await walk(capabilities, folder)).filter((file) => MEDIA_FILE.test(file) && inProject(file)).toSorted();
|
|
64
66
|
}
|
|
65
67
|
var METHOD_STUB = "export const paragraph = () => () => ({});\n";
|
|
66
|
-
async function
|
|
68
|
+
async function loadSiteProjects(capabilities, workspaceBundle) {
|
|
67
69
|
const scratch = await capabilities.fs.mkdtemp(path.join(os.tmpdir(), "aula-site-videos-"));
|
|
68
70
|
let count = 0;
|
|
69
71
|
try {
|
|
@@ -85,15 +87,16 @@ async function listVideos(capabilities, workspaceBundle) {
|
|
|
85
87
|
};
|
|
86
88
|
const loaded = await loadBuiltProjects(workspaceBundle, workspaceHost(v8Frames), modules, player);
|
|
87
89
|
if (loaded._tag === "Left") throw new Problems(loaded.left);
|
|
88
|
-
return loaded.right
|
|
89
|
-
name: projectName,
|
|
90
|
-
title,
|
|
91
|
-
...section === void 0 ? {} : { section }
|
|
92
|
-
}));
|
|
90
|
+
return loaded.right;
|
|
93
91
|
} finally {
|
|
94
92
|
await capabilities.fs.rm(scratch, { recursive: true, force: true });
|
|
95
93
|
}
|
|
96
94
|
}
|
|
95
|
+
var videosOf = (projects) => projects.map(({ name: projectName, title, section }) => ({
|
|
96
|
+
name: projectName,
|
|
97
|
+
title,
|
|
98
|
+
...section === void 0 ? {} : { section }
|
|
99
|
+
}));
|
|
97
100
|
async function pageFiles(capabilities) {
|
|
98
101
|
if (!capabilities.fs.existsSync(new URL("index.html", PAGE))) {
|
|
99
102
|
fault("the site page is not built", "run `pnpm --filter aula-web-pages build`");
|
|
@@ -121,8 +124,7 @@ async function site(capabilities, options) {
|
|
|
121
124
|
if (listed._tag === "Left") throw new Problems(listed.left);
|
|
122
125
|
if (listed.right.length === 0) {
|
|
123
126
|
throw wrongArgument(
|
|
124
|
-
`no project in ${folder}
|
|
125
|
-
"give a folder that has index.ts, or whose subfolders have index.ts"
|
|
127
|
+
`no project in ${folder}: run from a project or playlist folder, or pass it (for example: aula site examples site-out)`
|
|
126
128
|
);
|
|
127
129
|
}
|
|
128
130
|
const bundler = createNodeBundler();
|
|
@@ -132,7 +134,22 @@ async function site(capabilities, options) {
|
|
|
132
134
|
const bundled = await bundleWorkspace(bundler, tree, folderName);
|
|
133
135
|
if (bundled._tag === "Left") throw new Problems(bundled.left);
|
|
134
136
|
workspaceBundle = bundled.right.bundle;
|
|
135
|
-
|
|
137
|
+
const loaded = await loadSiteProjects(capabilities, workspaceBundle);
|
|
138
|
+
const published = listedProjects(loaded);
|
|
139
|
+
if (published.length === 0) {
|
|
140
|
+
throw wrongArgument(
|
|
141
|
+
`no published project in ${folder}`,
|
|
142
|
+
"give a folder with at least one project that is not draft: true, or open a draft by its folder path"
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
if (published.length !== loaded.length) {
|
|
146
|
+
const keep = new Set(published.map((project) => project.name));
|
|
147
|
+
const filtered = workspaceBundle.projects.filter((project) => keep.has(project.name));
|
|
148
|
+
const rebundled = await bundleProjects(bundler, tree, folderName, filtered);
|
|
149
|
+
if (rebundled._tag === "Left") throw new Problems(rebundled.left);
|
|
150
|
+
workspaceBundle = rebundled.right.bundle;
|
|
151
|
+
}
|
|
152
|
+
videos = videosOf(published);
|
|
136
153
|
} finally {
|
|
137
154
|
await bundler.stop();
|
|
138
155
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as e}from"../src-
|
|
1
|
+
import{f as e}from"../src-DWqZcp-P.js";import"./aula.js";var t=e=>JSON.stringify(e);function n(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function r(e,t){if(t.length!==1||t.raw.length!==1)throw Error(`${e}: a \${…} is not allowed in this tag`);let n=t[0]??``;if(n.includes(`
|
|
2
2
|
`))throw Error(`${e}: the text must be one line`);return n}function i(e,r,i){let a=[],o=(t,n,r=e.place)=>{a.push({code:t,message:n,...r===void 0?{}:{at:r}})};i.mechanism.trim()===``&&o(`method-no-mechanism`,`the paragraph has no mechanism: name the one mechanism that the viewer must understand`);for(let e of i.sources)n(e)&&!r.exists(e)&&o(`method-missing-source`,`${t(e)}: this path is not a file: correct the path or add the file`);return a}function a(t){let n=r(`paragraph`,t);return({sources:t},r)=>e({mechanism:n,sources:t},(e,a)=>[...i(e,a,{mechanism:n,sources:t}),...r?.(e,a)??[]])}export{a as paragraph};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as defineChapter,l as defineProject,u as embed,y as loadEngine,o as m,f as paragraph,p as pronounce,m as say,h as show}from"../src-DWqZcp-P.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,t}from"../rolldown-runtime-BLXQ4ufn.js";import{a as n,d as r,f as i,g as a,h as o,i as s,l as c,n as l,o as u,p as d,u as f}from"../protocol-C3Pseh4g.js";import{S as p,g as m,v as h,y as g}from"../src-DTLT9Lbm.js";var _=44,v=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,y=new Uint8Array(64),b=new Uint8Array(128);for(let e=0;e<v.length;e++){let t=v.charCodeAt(e);y[e]=t,b[t]=e}function x(e){let t=0,n=0,r=0;do r=b[e.next()],t|=(r&31)<<n,n+=5;while(r&32);return t}function S(e){return e&1?-0x80000000|-(e>>>1):e>>>1}function C(e,t){return e.pos>=t?!1:e.peek()!==_}var ee=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function te(e){let{length:t}=e,n=new ee(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i+=S(x(n)),i<u&&(l=!1),u=i,C(n,e)?(a+=S(x(n)),o+=S(x(n)),s+=S(x(n)),C(n,e)?(c+=S(x(n)),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||w(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function w(e){e.sort(T)}function T(e,t){return e[0]-t[0]}var E=e(t(((e,t,n)=>{var r;(function(n,i){typeof e==`object`&&t!==void 0?t.exports=i():typeof r==`function`&&r.amd?r(i):(n=typeof globalThis<`u`?globalThis:n||self,n.resolveURI=i())})(n,(function(){let e=/^[\w+.-]+:\/\//,t=/^([\w+.-]+:)\/\/([^@/#?]*@)?(\[[^\]]+\]|[^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function r(t){return e.test(t)}function i(e){return e.startsWith(`//`)}function a(e){return e.startsWith(`/`)}function o(e){return e.startsWith(`file:`)}function s(e){return/^[.?#]/.test(e)}function c(e){let n=t.exec(e);return u(n[1],n[2]||``,n[3],n[4]||``,n[5]||`/`,n[6]||``,n[7]||``)}function l(e){let t=n.exec(e),r=t[2];return u(`file:`,``,t[1]||``,``,a(r)?r:`/`+r,t[3]||``,t[4]||``)}function u(e,t,n,r,i,a,o){return{scheme:e,user:t,host:n,port:r,path:i,query:a,hash:o,type:7}}function d(e){if(i(e)){let t=c(`http:`+e);return t.scheme=``,t.type=6,t}if(a(e)){let t=c(`http://foo.com`+e);return t.scheme=``,t.host=``,t.type=5,t}if(o(e))return l(e);if(r(e))return c(e);let t=c(`http://foo.com/`+e);return t.scheme=``,t.host=``,t.type=e?e.startsWith(`?`)?3:e.startsWith(`#`)?2:4:1,t}function f(e){if(e.endsWith(`/..`))return e;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function p(e,t){m(t,t.type),e.path=e.path===`/`?t.path:f(t.path)+e.path}function m(e,t){let n=t<=4,r=e.path.split(`/`),i=1,a=0,o=!1;for(let e=1;e<r.length;e++){let t=r[e];t?(o=!1,t!==`.`&&(t===`..`?a?(o=!0,a--,i--):n&&(r[i++]=t):(r[i++]=t,a++))):o=!0}let s=``;for(let e=1;e<i;e++)s+=`/`+r[e];(!s||o&&!s.endsWith(`/..`))&&(s+=`/`),e.path=s}function h(e,t){if(!e&&!t)return``;let n=d(e),r=n.type;if(t&&r!==7){let e=d(t),i=e.type;switch(r){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:p(n,e);case 5:n.user=e.user,n.host=e.host,n.port=e.port;case 6:n.scheme=e.scheme}i>r&&(r=i)}m(n,r);let i=n.query+n.hash;switch(r){case 2:case 3:return i;case 4:{let r=n.path.slice(1);return r?s(t||e)&&!s(r)?`./`+r+i:r+i:i||`.`}case 5:return n.path+i;default:return n.scheme+`//`+n.user+n.host+n.port+n.path+i}}return h}))}))(),1);function D(e){if(!e)return``;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function O(e,t){let n=D(e),r=t?t+`/`:``;return e=>(0,E.default)(r+(e||``),n)}var k=0,ne=1,re=2,ie=3,A=4;function j(e,t){let n=M(e,0);if(n===e.length)return e;t||(e=e.slice());for(let r=n;r<e.length;r=M(e,r+1))e[r]=P(e[r],t);return e}function M(e,t){for(let n=t;n<e.length;n++)if(!N(e[n]))return n;return e.length}function N(e){for(let t=1;t<e.length;t++)if(e[t][k]<e[t-1][k])return!1;return!0}function P(e,t){return t||(e=e.slice()),e.sort(F)}function F(e,t){return e[k]-t[k]}var I=!1;function L(e,t,n,r){for(;n<=r;){let i=n+(r-n>>1),a=e[i][k]-t;if(a===0)return I=!0,i;a<0?n=i+1:r=i-1}return I=!1,n-1}function R(e,t,n){for(let r=n+1;r<e.length&&e[r][k]===t;n=r++);return n}function z(e,t,n){for(let r=n-1;r>=0&&e[r][k]===t;n=r--);return n}function B(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function V(e,t,n,r){let{lastKey:i,lastNeedle:a,lastIndex:o}=n,s=0,c=e.length-1;if(r===i){if(t===a)return I=o!==-1&&e[o][k]===t,o;t>=a?s=o===-1?0:o:c=o}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=L(e,t,s,c)}function H(e){return typeof e==`string`?JSON.parse(e):e}var U="`line` must be greater than 0 (lines start at line 1)",W="`column` must be greater than or equal to 0 (columns start at column 0)",ae=class{constructor(e,t){let n=typeof e==`string`;if(!n&&e._decodedMemo)return e;let r=H(e),{version:i,file:a,names:o,sourceRoot:s,sources:c,sourcesContent:l}=r;this.version=i,this.file=a,this.names=o||[],this.sourceRoot=s,this.sources=c,this.sourcesContent=l,this.ignoreList=r.ignoreList||r.x_google_ignoreList||void 0;let u=O(t,s);this.resolvedSources=c.map(u);let{mappings:d}=r;if(typeof d==`string`)this._encoded=d,this._decoded=void 0;else if(Array.isArray(d))this._encoded=void 0,this._decoded=j(d,n);else if(r.sections)throw Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);else throw Error(`invalid source map: ${JSON.stringify(r)}`);this._decodedMemo=B(),this._bySources=void 0,this._bySourceMemos=void 0}};function G(e){return e}function K(e){var t;return(t=G(e))._decoded||(t._decoded=te(G(e)._encoded))}function q(e,t){let{line:n,column:r,bias:i}=t;if(n--,n<0)throw Error(U);if(r<0)throw Error(W);let a=K(e);if(n>=a.length)return J(null,null,null,null);let o=a[n],s=oe(o,G(e)._decodedMemo,n,r,i||1);if(s===-1)return J(null,null,null,null);let c=o[s];if(c.length===1)return J(null,null,null,null);let{names:l,resolvedSources:u}=e;return J(u[c[ne]],c[re]+1,c[ie],c.length===5?l[c[A]]:null)}function J(e,t,n,r){return{source:e,line:t,column:n,name:r}}function oe(e,t,n,r,i){let a=V(e,r,t,n);return I?a=(i===-1?R:z)(e,r,a):i===-1&&a++,a===-1||a===e.length?-1:a}var Y=new Map;function se(e,t,n){Y.set(e,{map:new ae(t),prefix:n})}function ce(e,t,n){let r=Y.get(e);if(!r)return{file:e,line:t,column:n};let i=q(r.map,{line:t,column:n-1});return i.source===null||i.line===null||i.column===null?{file:e,line:t,column:n}:{file:i.source.startsWith(r.prefix)?i.source.slice(r.prefix.length):i.source,line:i.line,column:i.column+1}}var X=a(ce);function le(e){let t=0,r=new Map;e.then(e=>{e.addEventListener(`message`,t=>{let i=t.data;if(i.kind===`error`)throw e.close(),new n(`the narrator stopped: ${i.message}`,i.stack);let a=r.get(i.id);r.delete(i.id),a?.(i)}),e.start()});let i=async(n,i)=>{let a=await e;return new Promise(e=>{let o=t++;r.set(o,e),a.postMessage({id:o,kind:n,words:i})})};return{speak:async e=>{let t=await i(`speak`,e);if(t.kind!==`speech`)throw Error(`the narrator answered ${t.kind} to a speech`);return{samples:t.samples,sampleRate:t.sampleRate,words:t.words}},time:async e=>{let t=await i(`time`,e);if(t.kind!==`timing`)throw Error(`the narrator answered ${t.kind} to a clock`);return{samples:t.samples,sampleRate:t.sampleRate,words:t.words}}}}function ue(e){let t=0,n=0,a=!1,u=new Map,d=n=>{let r=r=>{let i=t++,{promise:a,resolve:o}=Promise.withResolvers();return u.set(i,o),e.post({kind:`files`,id:i,tree:n,question:r},[]),a};return{bundle:async()=>{let e=await r({kind:`bundle`});if(e.kind!==`bundle`)throw Error(`the page answered ${e.kind} to a question of the bundle`);return e.result},name:async()=>{let e=await r({kind:`name`});if(e.kind!==`name`)throw Error(`the page answered ${e.kind} to a question of the name`);return e.name},read:async e=>{let t=await r({kind:`read`,path:e});if(t.kind!==`read`)throw Error(`the page answered ${t.kind} to a read of ${e}`);return t.text},bytes:async e=>{let t=await r({kind:`bytes`,path:e});if(t.kind!==`bytes`)throw Error(`the page answered ${t.kind} to a read of the bytes of ${e}`);return t.bytes},list:async e=>{let t=await r({kind:`list`,folder:e});if(t.kind!==`list`)throw Error(`the page answered ${t.kind} to a list of ${e}`);return t.names}}},p=async()=>{let t=d(n++),o=new Map,s=new Set,c=e=>{let t=o.get(e);return t===void 0&&s.add(e),t?{size:t.length,read:()=>t}:void 0},[l]=await Promise.all([t.bundle(),g().then(async()=>{await h(),e.post({kind:`stage`,stage:`engine`},[])})]),u;if(l!==null){if(l._tag===`Left`)return e.post({kind:`stage`,stage:`project`},[]),l;u=await f(l.right,i(X,c),e.modules,e.player)}else{let n=await t.name();if(n===null)return e.post({kind:`stage`,stage:`project`},[]),{_tag:`Right`,right:[]};let a={name:()=>Promise.resolve(n),read:t.read,list:t.list},o=await e.bundler();u=await r(a,i(X,c),e.modules,o,e.player)}if(e.post({kind:`stage`,stage:`project`},[]),u._tag===`Left`)return u;a||(a=!0,e.post({kind:`narrator`},[]));let p=async e=>{for(;;){s.clear();let n=e(),r=[...s].filter(e=>!o.has(e));if(r.length===0)return n;await Promise.all(r.map(async e=>o.set(e,await t.bytes(e))))}};return{_tag:`Right`,right:u.right.map(e=>{let t=new Set;return{...e,readScript:async()=>(await m(),p(()=>e.script())),readChapter:async n=>{t.has(n)||(await m(),await p(()=>e.walk?.(n)),t.add(n))}}})}},_=Promise.withResolvers(),v=o(c.create({voice:le(_.promise),workspace:{projects:p}})),y=[],b=(t,{chapters:n,...r})=>{let i=[],a=[],o=[];n.forEach((e,t)=>{let n=y[t];if(e===n)return;if(!e){i.push([t,void 0]);return}let r=n?.cues.map(e=>e.samples)??[];if(e.animation!==n?.animation){let{animation:n,cues:a,...o}=e,c=a.map(e=>{let t=e.samples?r.indexOf(e.samples):-1;return t===-1?null:t}),l=a.map(({at:e,length:t},n)=>({at:e,length:t,keep:c[n]??null}));i.push([t,{...o,lottie:s(n),cues:l}]),r=c.map(e=>e===null?void 0:r[e])}e.cues.forEach((e,n)=>{if(!e.samples||e.samples===r[n])return;let i=e.samples.slice();o.push(i.buffer),a.push({chapter:t,cue:n,samples:i})})}),y=n;let c={building:r.building,timeline:r.timeline,duration:r.duration,errors:l(r.errors)};e.post({kind:`state`,watch:t,state:c,count:n.length,drawings:i,sounds:a},o)};return t=>{switch(t.kind){case`list`:v.build.list().then(n=>{let r=n._tag===`Left`?{_tag:`Left`,left:l(n.left)}:n;e.post({kind:`listed`,id:t.id,videos:r},[])});return;case`watch`:y=[],v.build.watch(t.name,{changed:e=>{b(t.watch,e)}});return;case`seek`:v.build.seek(t.name,t.place);return;case`halt`:v.halt();return;case`refresh`:v.refresh(t.place);return;case`files`:{let e=u.get(t.id);u.delete(t.id),e?.(t.answer);return}case`narrator`:_.resolve(t.port);return}}}var Z=(e,t=[])=>{self.postMessage(e,{transfer:t})},Q=e=>{let t=u(e,X);Z({kind:`error`,message:t.message,stack:t.stack.map(e=>` ${e}`).join(`
|
|
2
|
-
`)})};self.addEventListener(`error`,e=>{e.preventDefault(),Q(e.error??Error(e.message))}),self.addEventListener(`unhandledrejection`,e=>{e.preventDefault(),Q(e.reason)});var de={"@beff/aula":new URL(`./aula.js`,import.meta.url).href,"@beff/aula-method":new URL(`./aula-method.js`,import.meta.url).href},fe={load:async({code:e,map:t})=>{let n=URL.createObjectURL(new Blob([e],{type:`text/javascript`}));return se(n,t,
|
|
1
|
+
import{r as e,t}from"../rolldown-runtime-BLXQ4ufn.js";import{a as n,d as r,f as i,g as a,i as o,l as s,m as c,n as l,o as u,p as d,u as f}from"../protocol-Dc79M9p3.js";import{S as p,g as m,v as h,y as g}from"../src-DWqZcp-P.js";var _=44,v=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,y=new Uint8Array(64),b=new Uint8Array(128);for(let e=0;e<v.length;e++){let t=v.charCodeAt(e);y[e]=t,b[t]=e}function x(e){let t=0,n=0,r=0;do r=b[e.next()],t|=(r&31)<<n,n+=5;while(r&32);return t}function S(e){return e&1?-0x80000000|-(e>>>1):e>>>1}function C(e,t){return e.pos>=t?!1:e.peek()!==_}var w=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function ee(e){let{length:t}=e,n=new w(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i+=S(x(n)),i<u&&(l=!1),u=i,C(n,e)?(a+=S(x(n)),o+=S(x(n)),s+=S(x(n)),C(n,e)?(c+=S(x(n)),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||te(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function te(e){e.sort(T)}function T(e,t){return e[0]-t[0]}var E=e(t(((e,t,n)=>{var r;(function(n,i){typeof e==`object`&&t!==void 0?t.exports=i():typeof r==`function`&&r.amd?r(i):(n=typeof globalThis<`u`?globalThis:n||self,n.resolveURI=i())})(n,(function(){let e=/^[\w+.-]+:\/\//,t=/^([\w+.-]+:)\/\/([^@/#?]*@)?(\[[^\]]+\]|[^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function r(t){return e.test(t)}function i(e){return e.startsWith(`//`)}function a(e){return e.startsWith(`/`)}function o(e){return e.startsWith(`file:`)}function s(e){return/^[.?#]/.test(e)}function c(e){let n=t.exec(e);return u(n[1],n[2]||``,n[3],n[4]||``,n[5]||`/`,n[6]||``,n[7]||``)}function l(e){let t=n.exec(e),r=t[2];return u(`file:`,``,t[1]||``,``,a(r)?r:`/`+r,t[3]||``,t[4]||``)}function u(e,t,n,r,i,a,o){return{scheme:e,user:t,host:n,port:r,path:i,query:a,hash:o,type:7}}function d(e){if(i(e)){let t=c(`http:`+e);return t.scheme=``,t.type=6,t}if(a(e)){let t=c(`http://foo.com`+e);return t.scheme=``,t.host=``,t.type=5,t}if(o(e))return l(e);if(r(e))return c(e);let t=c(`http://foo.com/`+e);return t.scheme=``,t.host=``,t.type=e?e.startsWith(`?`)?3:e.startsWith(`#`)?2:4:1,t}function f(e){if(e.endsWith(`/..`))return e;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function p(e,t){m(t,t.type),e.path=e.path===`/`?t.path:f(t.path)+e.path}function m(e,t){let n=t<=4,r=e.path.split(`/`),i=1,a=0,o=!1;for(let e=1;e<r.length;e++){let t=r[e];t?(o=!1,t!==`.`&&(t===`..`?a?(o=!0,a--,i--):n&&(r[i++]=t):(r[i++]=t,a++))):o=!0}let s=``;for(let e=1;e<i;e++)s+=`/`+r[e];(!s||o&&!s.endsWith(`/..`))&&(s+=`/`),e.path=s}function h(e,t){if(!e&&!t)return``;let n=d(e),r=n.type;if(t&&r!==7){let e=d(t),i=e.type;switch(r){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:p(n,e);case 5:n.user=e.user,n.host=e.host,n.port=e.port;case 6:n.scheme=e.scheme}i>r&&(r=i)}m(n,r);let i=n.query+n.hash;switch(r){case 2:case 3:return i;case 4:{let r=n.path.slice(1);return r?s(t||e)&&!s(r)?`./`+r+i:r+i:i||`.`}case 5:return n.path+i;default:return n.scheme+`//`+n.user+n.host+n.port+n.path+i}}return h}))}))(),1);function D(e){if(!e)return``;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function O(e,t){let n=D(e),r=t?t+`/`:``;return e=>(0,E.default)(r+(e||``),n)}var k=0,ne=1,re=2,ie=3,A=4;function j(e,t){let n=M(e,0);if(n===e.length)return e;t||(e=e.slice());for(let r=n;r<e.length;r=M(e,r+1))e[r]=P(e[r],t);return e}function M(e,t){for(let n=t;n<e.length;n++)if(!N(e[n]))return n;return e.length}function N(e){for(let t=1;t<e.length;t++)if(e[t][k]<e[t-1][k])return!1;return!0}function P(e,t){return t||(e=e.slice()),e.sort(F)}function F(e,t){return e[k]-t[k]}var I=!1;function L(e,t,n,r){for(;n<=r;){let i=n+(r-n>>1),a=e[i][k]-t;if(a===0)return I=!0,i;a<0?n=i+1:r=i-1}return I=!1,n-1}function R(e,t,n){for(let r=n+1;r<e.length&&e[r][k]===t;n=r++);return n}function z(e,t,n){for(let r=n-1;r>=0&&e[r][k]===t;n=r--);return n}function B(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function V(e,t,n,r){let{lastKey:i,lastNeedle:a,lastIndex:o}=n,s=0,c=e.length-1;if(r===i){if(t===a)return I=o!==-1&&e[o][k]===t,o;t>=a?s=o===-1?0:o:c=o}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=L(e,t,s,c)}function H(e){return typeof e==`string`?JSON.parse(e):e}var U="`line` must be greater than 0 (lines start at line 1)",W="`column` must be greater than or equal to 0 (columns start at column 0)",ae=class{constructor(e,t){let n=typeof e==`string`;if(!n&&e._decodedMemo)return e;let r=H(e),{version:i,file:a,names:o,sourceRoot:s,sources:c,sourcesContent:l}=r;this.version=i,this.file=a,this.names=o||[],this.sourceRoot=s,this.sources=c,this.sourcesContent=l,this.ignoreList=r.ignoreList||r.x_google_ignoreList||void 0;let u=O(t,s);this.resolvedSources=c.map(u);let{mappings:d}=r;if(typeof d==`string`)this._encoded=d,this._decoded=void 0;else if(Array.isArray(d))this._encoded=void 0,this._decoded=j(d,n);else if(r.sections)throw Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);else throw Error(`invalid source map: ${JSON.stringify(r)}`);this._decodedMemo=B(),this._bySources=void 0,this._bySourceMemos=void 0}};function G(e){return e}function K(e){var t;return(t=G(e))._decoded||(t._decoded=ee(G(e)._encoded))}function q(e,t){let{line:n,column:r,bias:i}=t;if(n--,n<0)throw Error(U);if(r<0)throw Error(W);let a=K(e);if(n>=a.length)return J(null,null,null,null);let o=a[n],s=oe(o,G(e)._decodedMemo,n,r,i||1);if(s===-1)return J(null,null,null,null);let c=o[s];if(c.length===1)return J(null,null,null,null);let{names:l,resolvedSources:u}=e;return J(u[c[ne]],c[re]+1,c[ie],c.length===5?l[c[A]]:null)}function J(e,t,n,r){return{source:e,line:t,column:n,name:r}}function oe(e,t,n,r,i){let a=V(e,r,t,n);return I?a=(i===-1?R:z)(e,r,a):i===-1&&a++,a===-1||a===e.length?-1:a}var Y=new Map;function se(e,t,n){Y.set(e,{map:new ae(t),prefix:n})}function ce(e,t,n){let r=Y.get(e);if(!r)return{file:e,line:t,column:n};let i=q(r.map,{line:t,column:n-1});return i.source===null||i.line===null||i.column===null?{file:e,line:t,column:n}:{file:i.source.startsWith(r.prefix)?i.source.slice(r.prefix.length):i.source,line:i.line,column:i.column+1}}var X=a(ce);function le(e){let t=0,r=new Map;e.then(e=>{e.addEventListener(`message`,t=>{let i=t.data;if(i.kind===`error`)throw e.close(),new n(`the narrator stopped: ${i.message}`,i.stack);let a=r.get(i.id);r.delete(i.id),a?.(i)}),e.start()});let i=async(n,i)=>{let a=await e;return new Promise(e=>{let o=t++;r.set(o,e),a.postMessage({id:o,kind:n,words:i})})};return{speak:async e=>{let t=await i(`speak`,e);if(t.kind!==`speech`)throw Error(`the narrator answered ${t.kind} to a speech`);return{samples:t.samples,sampleRate:t.sampleRate,words:t.words}},time:async e=>{let t=await i(`time`,e);if(t.kind!==`timing`)throw Error(`the narrator answered ${t.kind} to a clock`);return{samples:t.samples,sampleRate:t.sampleRate,words:t.words}}}}function ue(e){let t=0,n=0,a=!1,c=new Map,u=n=>{let r=r=>{let i=t++,{promise:a,resolve:o}=Promise.withResolvers();return c.set(i,o),e.post({kind:`files`,id:i,tree:n,question:r},[]),a};return{bundle:async()=>{let e=await r({kind:`bundle`});if(e.kind!==`bundle`)throw Error(`the page answered ${e.kind} to a question of the bundle`);return e.result},name:async()=>{let e=await r({kind:`name`});if(e.kind!==`name`)throw Error(`the page answered ${e.kind} to a question of the name`);return e.name},read:async e=>{let t=await r({kind:`read`,path:e});if(t.kind!==`read`)throw Error(`the page answered ${t.kind} to a read of ${e}`);return t.text},bytes:async e=>{let t=await r({kind:`bytes`,path:e});if(t.kind!==`bytes`)throw Error(`the page answered ${t.kind} to a read of the bytes of ${e}`);return t.bytes},list:async e=>{let t=await r({kind:`list`,folder:e});if(t.kind!==`list`)throw Error(`the page answered ${t.kind} to a list of ${e}`);return t.names}}},p=async()=>{let t=u(n++),o=new Map,s=new Set,c=e=>{let t=o.get(e);return t===void 0&&s.add(e),t?{size:t.length,read:()=>t}:void 0},[l]=await Promise.all([t.bundle(),g().then(async()=>{await h(),e.post({kind:`stage`,stage:`engine`},[])})]),f;if(l!==null){if(l._tag===`Left`)return e.post({kind:`stage`,stage:`project`},[]),l;f=await r(l.right,d(X,c),e.modules,e.player)}else{let n=await t.name();if(n===null)return e.post({kind:`stage`,stage:`project`},[]),{_tag:`Right`,right:[]};let r={name:()=>Promise.resolve(n),read:t.read,list:t.list},a=await e.bundler();f=await i(r,d(X,c),e.modules,a,e.player)}if(e.post({kind:`stage`,stage:`project`},[]),f._tag===`Left`)return f;a||(a=!0,e.post({kind:`narrator`},[]));let p=async e=>{for(;;){s.clear();let n=e(),r=[...s].filter(e=>!o.has(e));if(r.length===0)return n;await Promise.all(r.map(async e=>o.set(e,await t.bytes(e))))}};return{_tag:`Right`,right:f.right.map(e=>{let t=new Set;return{...e,readScript:async()=>(await m(),p(()=>e.script())),readChapter:async n=>{t.has(n)||(await m(),await p(()=>e.walk?.(n)),t.add(n))}}})}},_=Promise.withResolvers(),v=f(s.create({voice:le(_.promise),workspace:{projects:p}})),y=[],b=(t,{chapters:n,...r})=>{let i=[],a=[],s=[];n.forEach((e,t)=>{let n=y[t];if(e===n)return;if(!e){i.push([t,void 0]);return}let r=n?.cues.map(e=>e.samples)??[];if(e.animation!==n?.animation){let{animation:n,cues:a,...s}=e,c=a.map(e=>{let t=e.samples?r.indexOf(e.samples):-1;return t===-1?null:t}),l=a.map(({at:e,length:t},n)=>({at:e,length:t,keep:c[n]??null}));i.push([t,{...s,lottie:o(n),cues:l}]),r=c.map(e=>e===null?void 0:r[e])}e.cues.forEach((e,n)=>{if(!e.samples||e.samples===r[n])return;let i=e.samples.slice();s.push(i.buffer),a.push({chapter:t,cue:n,samples:i})})}),y=n;let c={building:r.building,timeline:r.timeline,duration:r.duration,errors:l(r.errors)};e.post({kind:`state`,watch:t,state:c,count:n.length,drawings:i,sounds:a},s)};return t=>{switch(t.kind){case`list`:v.build.list().then(n=>{let r=n._tag===`Left`?{_tag:`Left`,left:l(n.left)}:n;e.post({kind:`listed`,id:t.id,videos:r},[])});return;case`watch`:y=[],v.build.watch(t.name,{changed:e=>{b(t.watch,e)}});return;case`seek`:v.build.seek(t.name,t.place);return;case`halt`:v.halt();return;case`refresh`:v.refresh(t.place);return;case`files`:{let e=c.get(t.id);c.delete(t.id),e?.(t.answer);return}case`narrator`:_.resolve(t.port);return}}}var Z=(e,t=[])=>{self.postMessage(e,{transfer:t})},Q=e=>{let t=u(e,X);Z({kind:`error`,message:t.message,stack:t.stack.map(e=>` ${e}`).join(`
|
|
2
|
+
`)})};self.addEventListener(`error`,e=>{e.preventDefault(),Q(e.error??Error(e.message))}),self.addEventListener(`unhandledrejection`,e=>{e.preventDefault(),Q(e.reason)});var de={"@beff/aula":new URL(`./aula.js`,import.meta.url).href,"@beff/aula-method":new URL(`./aula-method.js`,import.meta.url).href},fe={load:async({code:e,map:t})=>{let n=URL.createObjectURL(new Blob([e],{type:`text/javascript`}));return se(n,t,c),{url:n,exports:await import(n)}}},$=null;function pe(){return $??=(async()=>{let t=performance.now(),[n,r]=await Promise.all([p(()=>import(`../browser-sNTR4ahh.js`).then(t=>e(t.default,1)),[]),p(()=>import(`../esbuild-D6hmBtXM.js`),[])]);return await n.initialize({wasmURL:r.default,worker:!1}),console.log(`aula: esbuild loaded in ${((performance.now()-t)/1e3).toFixed(1)} s`),n})(),$}var me=ue({post:Z,bundler:pe,modules:fe,player:de});self.addEventListener(`message`,e=>{me(e.data)});
|