@gui-chat-plugin/sequence 0.3.1 → 0.4.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.
@@ -0,0 +1,145 @@
1
+ let e=require("gui-chat-protocol");var t=1280,n=720,r=6e4,i=`https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.3.3/dist/index.global.js`,a=`sha384-2ql948lIdLcGEE0/qxNiudyTjgauA3RDJERu5xW75kFCvSl5a9odyQYCb6tEjnmB`,o=[`animate`,`counter`,`typewriter`],s=8,c=`
2
+ (() => {
3
+ const EASE = {
4
+ linear: (t) => t,
5
+ easeIn: (t) => t * t,
6
+ easeOut: (t) => 1 - (1 - t) * (1 - t),
7
+ easeInOut: (t) => (t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2),
8
+ };
9
+ const AUTO_END = 8;
10
+ const TRANSFORMS = [
11
+ ["data-translate-x", "translateX", "px"],
12
+ ["data-translate-y", "translateY", "px"],
13
+ ["data-scale", "scale", ""],
14
+ ["data-rotate", "rotate", "deg"],
15
+ ["data-rotate-x", "rotateX", "deg"],
16
+ ["data-rotate-y", "rotateY", "deg"],
17
+ ["data-rotate-z", "rotateZ", "deg"],
18
+ ];
19
+ const STYLES = [
20
+ ["data-opacity", "opacity", ""],
21
+ ["data-width", "width", "px"],
22
+ ["data-height", "height", "px"],
23
+ ];
24
+ const number = (value, fallback) => {
25
+ const n = Number(value);
26
+ return value !== null && value.trim() !== "" && Number.isFinite(n) ? n : fallback;
27
+ };
28
+ const range = (value, unit) => {
29
+ if (value === null) return null;
30
+ const parts = value.split(",").map((part) => part.trim());
31
+ const from = Number(parts[0]);
32
+ const to = Number(parts[1]);
33
+ if (!Number.isFinite(from) || !Number.isFinite(to)) return null;
34
+ return { from, to, unit: parts[2] || unit };
35
+ };
36
+ const ranges = (el, table) =>
37
+ table
38
+ .map(([attr, name, unit]) => [name, range(el.getAttribute(attr), unit)])
39
+ .filter(([, r]) => r);
40
+ let entries = [];
41
+ const collect = () => {
42
+ entries = [...document.querySelectorAll("[data-animation]")].map((el) => {
43
+ const kind = el.getAttribute("data-animation");
44
+ const end = el.getAttribute("data-end");
45
+ const entry = {
46
+ el,
47
+ kind,
48
+ start: number(el.getAttribute("data-start"), 0),
49
+ end: end === null || end.trim() === "auto" ? null : number(end, null),
50
+ ease: EASE[el.getAttribute("data-easing")] || EASE.linear,
51
+ };
52
+ if (kind === "animate") {
53
+ entry.transforms = ranges(el, TRANSFORMS);
54
+ entry.styles = ranges(el, STYLES);
55
+ } else if (kind === "counter") {
56
+ entry.from = number(el.getAttribute("data-from"), 0);
57
+ entry.to = number(el.getAttribute("data-to"), 0);
58
+ entry.decimals = Math.max(0, Math.round(number(el.getAttribute("data-decimals"), 0)));
59
+ entry.prefix = el.getAttribute("data-prefix") || "";
60
+ entry.suffix = el.getAttribute("data-suffix") || "";
61
+ } else if (kind === "typewriter") {
62
+ entry.text = el.getAttribute("data-text") ?? el.textContent;
63
+ } else {
64
+ return null;
65
+ }
66
+ return entry;
67
+ }).filter(Boolean);
68
+ };
69
+ const seek = (t) => {
70
+ for (const e of entries) {
71
+ const end = e.end ?? AUTO_END;
72
+ const span = end - e.start;
73
+ const p = span > 0 ? Math.min(1, Math.max(0, (t - e.start) / span)) : t >= e.start ? 1 : 0;
74
+ const k = e.ease(p);
75
+ const at = (r) => r.from + (r.to - r.from) * k;
76
+ if (e.kind === "animate") {
77
+ if (e.transforms.length) {
78
+ e.el.style.transform = e.transforms.map(([name, r]) => name + "(" + at(r) + r.unit + ")").join(" ");
79
+ }
80
+ for (const [name, r] of e.styles) e.el.style[name] = at(r) + r.unit;
81
+ } else if (e.kind === "counter") {
82
+ e.el.textContent = e.prefix + (e.from + (e.to - e.from) * k).toFixed(e.decimals) + e.suffix;
83
+ } else {
84
+ e.el.textContent = e.text.slice(0, Math.floor(e.text.length * k));
85
+ }
86
+ }
87
+ };
88
+ window.__slideSeek = seek;
89
+ const play = () => {
90
+ const last = Math.max(0, ...entries.map((e) => e.end ?? AUTO_END));
91
+ const begun = performance.now();
92
+ const tick = (now) => {
93
+ const t = (now - begun) / 1000;
94
+ seek(t);
95
+ if (t <= last) requestAnimationFrame(tick);
96
+ };
97
+ requestAnimationFrame(tick);
98
+ };
99
+ // Collected once the body is parsed: at DOMContentLoaded, or earlier when
100
+ // the fallback shows the slide while a slow Tailwind still holds
101
+ // DOMContentLoaded back (the body is parsed by then: readyState is
102
+ // "interactive" before deferred scripts run). Played once both are done.
103
+ let collected = false;
104
+ let shown = false;
105
+ const init = () => {
106
+ if (collected || document.readyState === "loading") return;
107
+ collected = true;
108
+ collect();
109
+ seek(0);
110
+ if (shown) play();
111
+ };
112
+ const show = () => {
113
+ if (shown) return;
114
+ init();
115
+ shown = true;
116
+ document.documentElement.classList.add("ready");
117
+ if (collected) play();
118
+ };
119
+ const ready = () => requestAnimationFrame(() => requestAnimationFrame(show));
120
+ const check = () =>
121
+ document.querySelector("style:not([type]):not(#slide-base)") ? ready() : setTimeout(check, 30);
122
+ addEventListener("DOMContentLoaded", () => {
123
+ init();
124
+ check();
125
+ });
126
+ setTimeout(show, 1000);
127
+ addEventListener("click", (event) => {
128
+ if (event.target instanceof Element && event.target.closest("a, area")) event.preventDefault();
129
+ }, true);
130
+ })();`,l=[`default-src 'none'`,`script-src 'sha256-0zsqCvkCfq5Z1iJCn46NiAtSAyIr/JDkyNs/Fae1J+Y=' ${i}`,`style-src 'unsafe-inline' https://fonts.googleapis.com`,`font-src https://fonts.gstatic.com data:`,`img-src data: blob:`,`media-src data: blob:`,`connect-src 'none'`,`form-action 'none'`,`base-uri 'none'`].join(`; `),u=e=>e.replace(/<(?=(meta|base|link)\b)/gi,`&lt;`).replace(/shadowroot/gi,`data-no-shadow-root`),d=`*, *::before, *::after { animation-play-state: paused !important; animation-duration: 0s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; animation-fill-mode: both !important; transition: none !important; }`,f=`
131
+ html, body { margin: 0; width: ${t}px; height: 720px; overflow: hidden; }
132
+ html:not(.ready) body { visibility: hidden; }
133
+ ${d}`;function p(e){return`<!doctype html>
134
+ <html lang="en">
135
+ <head>
136
+ <meta charset="utf-8">
137
+ <meta http-equiv="Content-Security-Policy" content="${l}">
138
+ <style id="slide-base">${f}</style>
139
+ <script>${c}<\/script>
140
+ <script defer src="${i}" integrity="${a}" crossorigin="anonymous"><\/script>
141
+ </head>
142
+ <body class="bg-white text-slate-900 font-sans antialiased">
143
+ ${u(e)}
144
+ </body>
145
+ </html>`}var m=`presentSlide`,h=`defineStoryboard`,g=`presentPanel`,ee=4,te=12,ne=3,_=/^[0-9a-f]{12}$/,v=e=>typeof e==`object`&&!!e&&!Array.isArray(e),y=e=>typeof e==`string`?e.trim():``,b=(e,t)=>e.toLowerCase()===t.toLowerCase(),x=e=>typeof e==`number`&&Number.isInteger(e),S=`presentSlide needs slide and totalSlides (whole numbers, slide from 1 to totalSlides), and either an imagePrompt or html`,C=`presentSlide's html is too long: keep a slide under ${r} characters`;function w(e){let{slide:t,totalSlides:n,title:r,imagePrompt:i}=e,a=y(e.html);return!x(t)||!x(n)||t<1||n<t||!a&&!y(i)?S:a.length>6e4?C:{slide:t,totalSlides:n,title:typeof r==`string`?r:``,imagePrompt:a?``:String(i),...a&&{html:a},mode:e.mode===`steps`?`steps`:`presentation`}}var T=({slide:e,totalSlides:t,title:n,mode:r})=>{let i=n?` ("${n}")`:``;if(r===`steps`){let n=`Step ${e} of ${t}${i}`;return e<t?`${n} is now on the screen. Explain what to do in this step, then stop and wait while the user does it. When they say they're ready (next, done, go on), call presentSlide for step ${e+1} with mode "steps". If they ask to go back or to see a step again, call presentSlide for that step.`:`${n}, the last one, is now on the screen. Explain what to do, then wrap up the guide once the user is done.`}let a=`Slide ${e} of ${t}${i}`;return e<t?`${a} is now on the screen. Explain it, then, in this same reply and without waiting for the user, call presentSlide for slide ${e+1}. If the user has asked you to stop, or asked something else, since the slideshow began, answer them instead of going on.`:`${a}, the last one, is now on the screen. Explain it, then wrap up the slideshow.`},re=[`For an HTML slide, instead of imagePrompt: the slide's content, the inside of <body> only (no <html>, <head> or <body> tags), for a ${t}x720 px canvas, which it should fill (start with a <div class="w-full h-full ...">). Style it with Tailwind CSS v4 classes, which are loaded for you: a clear layout, a large title (text-6xl or so), few words in large type, a color scheme, and inline SVG or emoji for icons and diagrams. There is no network: no <img> from URLs, no links to follow.`,`Animate it so it builds up as you explain it, with MulmoCast's data-animation attributes (the same ones make it move in a movie of the slideshow): data-animation="animate" with data-opacity="0,1", data-translate-x, data-translate-y (px), data-scale, data-rotate (deg), data-width or data-height ("0,80,%"), each "from,to"; data-animation="counter" with data-from, data-to, data-decimals, data-prefix, data-suffix; data-animation="typewriter" (its text, or data-text). Give every one data-start and data-end in seconds, and optionally data-easing (linear, easeIn, easeOut, easeInOut); stagger the parts with later data-start values so they appear one after another over a few seconds (for example 0, 0.6, 1.2). Set the first frame inline too (style="opacity:0" on an element that fades in).`,`CSS animations, transitions and scripts don't play: animate only with data-animation. A <style> for layout is allowed (and Google Fonts by @import).`].join(` `),ie=`When the user asks for a slideshow (or to explain something with slides), plan four to six slides, then show them one at a time with presentSlide: slide 1 first, and each next slide only after you have explained the one on the screen. Go on to the last slide without asking whether to continue. A slide is a generated picture (imagePrompt) or a designed slide in HTML (html): use a picture for a scene, an object or a place, and HTML for words, numbers, lists, comparisons, timelines and diagrams, which a picture model draws badly; a slideshow can mix them. When the user asks for HTML slides (slides in HTML, an HTML presentation), this is the tool: make them HTML slides with presentSlide, one call per slide, not one HTML page. When the user wants to be shown how to do something they will do along with you (cooking, folding, fixing, an exercise), make it a step-by-step guide instead: mode "steps", one slide per step, and after each step wait for the user to say they are ready. Use generateImage for a single picture, not for slides.`,E={type:`function`,name:m,prompt:ie,description:`Show one slide of a slideshow, full screen: a picture generated from imagePrompt, or a slide written in HTML (html). Call it once per slide, in order, starting with slide 1. With mode "steps" it is a step-by-step guide: one slide per step, and the next step waits for the user.`,parameters:{type:`object`,properties:{slide:{type:`integer`,description:`This slide's number, starting at 1.`},totalSlides:{type:`integer`,description:`How many slides the slideshow has. Keep it the same for every slide.`},title:{type:`string`,description:`The slide's title.`},imagePrompt:{type:`string`,description:`For a picture slide: the picture, a clear illustration of its point, with the title as its only large text. Be concrete. For a step, show the action: hands, tools and the object. Leave it out for an HTML slide.`},html:{type:`string`,description:re},mode:{type:`string`,enum:[`presentation`,`steps`],description:`"presentation" (the default) goes on by itself; "steps" is a how-to the user does along with you, and waits for them after each step. Keep it the same for every slide.`}},required:[`slide`,`totalSlides`,`title`]}};function D(e){let{totalPanels:t}=e;if(!x(t)||t<1||t>12)return`totalPanels must be a whole number from 1 to 12`;let n=[];for(let t of Array.isArray(e.characters)?e.characters:[]){let e=v(t)?y(t.name):``,r=v(t)?y(t.description):``;if(!e||!r)return`every character needs a name and a description`;if(n.some(t=>b(t.name,e)))return`two characters are named ${e}`;n.push({name:e,description:r})}return n.length<1||n.length>4?`a storyboard has 1 to 4 characters`:{title:y(e.title),style:y(e.style),totalPanels:t,characters:n,interactive:e.interactive===!0}}var O=({title:e,id:t})=>`The cast of "${e}" is now on the screen. Introduce the characters briefly, then, in this same reply and without waiting for the user, call presentPanel for panel 1 with storyboardId "${t}". If the user has asked you to stop, or asked something else, answer them instead of going on.`,k=`presentPanel needs a storyboardId, a panel number (from 1) and an imagePrompt`;function A(e){let{panel:t}=e,n=y(e.storyboardId),r=y(e.imagePrompt);if(!n||!r||!x(t)||t<1)return null;let i=e=>(Array.isArray(e)?e:[]).map(y).filter(Boolean);return{storyboardId:n,panel:t,characters:i(e.characters),imagePrompt:r,caption:y(e.caption),choices:i(e.choices).slice(0,3)}}function j(e,t,n){let{id:r,totalPanels:i}=e;return n.length?`Panel ${t} of ${i} is now on the screen, with the user's choices: ${n.map((e,t)=>`${t+1}. ${e}`).join(` `)} Tell this part of the story, then read the choices out and ask the user which one they pick, and wait for their answer. Then call presentPanel for panel ${t+1} with storyboardId "${r}", going on the way they chose.`:t<i?`Panel ${t} of ${i} is now on the screen. Tell this part of the story, then, in this same reply and without waiting for the user, call presentPanel for panel ${t+1} with storyboardId "${r}". If the user has asked you to stop, or asked something else, since the story began, answer them instead of going on.`:`Panel ${t} of ${i}, the last one, is now on the screen. Tell this part of the story, then bring it to an end.`}var M=`When the user asks for a story, a picture book, a comic or a storyboard, tell it in pictures: first call defineStoryboard with the art style and the characters who appear more than once (it draws a reference sheet for each, so they look the same in every panel), then show the panels one at a time with presentPanel, naming the characters in each, and tell each part of the story when its panel appears. Go on to the last panel without asking whether to continue, unless the story is interactive. When the user wants to decide what happens (an adventure, a story for a child who wants to choose), set interactive, and give two or three choices on two or three of the panels: the story waits there for the user's pick and goes on their way; it still ends at the last panel whichever way it goes. Use presentSlide to explain a topic, not to tell a story.`,N={type:`function`,name:h,prompt:M,description:`Start a story told in pictures: set its art style and draw a reference sheet for each recurring character, shown as the cast. Then call presentPanel for each panel, in order.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`The story's title.`},style:{type:`string`,description:`The art style of every picture, in one sentence (for example: soft watercolor, children's picture book).`},totalPanels:{type:`integer`,description:`How many panels the story has, at most 12; four to eight is usual.`},interactive:{type:`boolean`,description:`The user chooses what happens: panels can offer choices, and the story waits for the pick.`},characters:{type:`array`,description:`The characters who appear in more than one panel, 1 to 4.`,items:{type:`object`,properties:{name:{type:`string`,description:`A short name, used in presentPanel.`},description:{type:`string`,description:`How they look: age, build, face, hair, clothes and colors. Be concrete: it is drawn once and reused in every panel.`}},required:[`name`,`description`]}}},required:[`title`,`style`,`totalPanels`,`characters`]}},P={type:`function`,name:g,description:`Show one panel of a storyboard made with defineStoryboard: a picture of the scene with its characters drawn as in their reference sheets, and a caption. Call it once per panel, in order, starting with panel 1.`,parameters:{type:`object`,properties:{storyboardId:{type:`string`,description:`The storyboardId defineStoryboard returned.`},panel:{type:`integer`,description:`This panel's number, starting at 1.`},characters:{type:`array`,items:{type:`string`},description:`The names (as in defineStoryboard) of the characters in this panel.`},imagePrompt:{type:`string`,description:`What the panel shows: the setting, what happens, expressions and the camera angle. Refer to characters by name; don't describe their looks again.`},caption:{type:`string`,description:`One short line shown under the picture.`},choices:{type:`array`,items:{type:`string`},description:`Only in an interactive story, and not on the last panel: two or three short options for what happens next. The story waits for the user's pick.`}},required:[`storyboardId`,`panel`,`characters`,`imagePrompt`]}},F=e=>typeof e==`object`&&!!e&&!Array.isArray(e),ae=e=>F(e)&&typeof e.message==`string`;function I(e){let t=F(e?.data)?e.data:{};return{...typeof t.imageData==`string`&&{imageData:t.imageData},...typeof t.imagePath==`string`&&{imagePath:t.imagePath}}}function L(e){let t=F(e?.data)?e.data:{};return typeof t.html==`string`?t.html:``}var oe=e=>!!I(e).imageData||!!L(e);function se(e,t){let n=I(e),r=I(t);if(n.imagePath&&r.imagePath)return n.imagePath===r.imagePath;if(n.imageData)return n.imageData===r.imageData;let i=L(e);return!!i&&i===L(t)}var R=(e,t)=>e.userSpokeAt===void 0||e.userSpokeAt>t,z=()=>crypto.randomUUID().replace(/-/g,``).slice(0,12),ce=`artifacts/`;async function B(e,t){let n=e.files?.artifacts;if(!e.app?.editImages||!n)return[];let r=[];for(let e of t)if(e.startsWith(ce))try{await n.exists(e.slice(10))&&r.push(e)}catch{}return r}async function V(e,t,n=[]){let r=e.app,i=r?.editImages,a=r?.generateImage;try{let e;if(n.length&&i)e=await i(t,[...n]);else if(a)e=await a(t);else return{message:`image generation isn't available`};return ae(e)?e:{message:`image generation returned an unrecognized result`}}catch(e){return{message:`image generation failed: ${e instanceof Error?e.message:String(e)}`}}}var le=50;function ue(e){let t=new Map;return n=>{let r=n.conversationId??``,i=t.get(r);if(i===void 0?i=e():t.delete(r),t.set(r,i),t.size>le){let e=t.keys().next().value;e!==void 0&&t.delete(e)}return i}}var H=`slideshows`,U=`storyboards`,W={},G=new WeakMap,K=new WeakMap;function q(e){let t=G.get(e);return t||G.set(e,t=new Map),t}function de(t,n){let r=K.get(t);r||K.set(t,r=new Map);let i=r.get(n);return i||r.set(n,i=(0,e.createSerialLock)()),i}var J=(e,t)=>`${e}/${t}.json`;async function Y(e,t){let n=q(e??W),r=n.get(t);if(r)return r;if(!e)return null;try{let r=JSON.parse(await e.read(t));return n.set(t,r),r}catch{return null}}async function X(e,t,n){return _.test(n)?Y(e,J(t,n)):null}async function Z(e,t,n,r){let i=J(t,n),a=e??W;return de(a,i)(async()=>{let t=r(await Y(e,i));if(q(a).set(i,t),!e)return!1;try{return await e.write(i,JSON.stringify(t,null,2)),!0}catch(e){return console.warn(`[sequence] could not save`,i,e),!1}})}var Q=e=>`the ${e} could not be saved, so it lasts only until the app or server restarts`,fe=6e4;function $(){let e=new Map;return{claim:t=>{let n=Date.now();for(let[t,r]of e)n-r.at>fe&&e.delete(t);let r=e.get(t);if(r)return{earlier:r.shown};let i=()=>void 0,a=new Promise(e=>i=e);return e.set(t,{at:n,shown:a}),{settle:n=>{!n&&e.get(t)?.shown===a&&e.delete(t),i(n)}}}}}function pe({slide:e,totalSlides:t,mode:n}){return n===`steps`?{step:e,total:t,kind:`guide`,label:`Step ${e} of ${t}`,onShown:`explain it`,nextCall:`call presentSlide for step ${e+1} of ${t} with mode "steps"`,waitsForUser:!0}:{step:e,total:t,kind:`slideshow`,label:`Slide ${e} of ${t}`,onShown:`explain it`,nextCall:`call presentSlide for slide ${e+1} of ${t}`}}var me=(e,{slide:t,totalSlides:n,title:r,imagePrompt:i,html:a})=>JSON.stringify([e,t,n,r,i,a]),he=ue(()=>({latest:{presentation:null,steps:null},lastShown:null,repeats:$()}));function ge(e,t){let n=e.latest[t.mode],r=n?.totalSlides===t.totalSlides&&(t.slide!==1||n.firstTitle===t.title);if(n&&r)return n;let i={id:z(),mode:t.mode,totalSlides:t.totalSlides,firstTitle:t.slide===1?t.title:``,slides:new Map,current:0,shownAt:-1/0};return e.latest[t.mode]=i,i}function _e(e,t,n,r){t.current=n.slide,t.shownAt=Date.now(),e.lastShown=t;let i=n.mode===`steps`?`step`:`slide`,{uuid:a,...o}=r;return{...o,message:`${i} ${n.slide} of ${n.totalSlides} is on the screen again, as it was`,instructions:T(n),instructionsRequired:!0,sequence:pe(n)}}function ve(e,t){if(e.mode!==`steps`)return e.title?`A presentation slide titled "${e.title}". ${e.imagePrompt}`:e.imagePrompt;let n=e.title?`, "${e.title}"`:``;return[`An instructional illustration of step ${e.slide} of ${e.totalSlides}${n}. ${e.imagePrompt}`,t?`The reference image is the previous step: keep the same objects, hands, tools and setting, and show what this step changes.`:``,`Show the action clearly, with little or no text.`].filter(Boolean).join(` `)}async function ye(e,t,n){if(n.html)return{html:n.html,prompt:``};let r=t.slides.get(n.slide-1),i=n.mode===`steps`?I(r).imagePath:void 0,a=i?await B(e,[i]):[],o=ve(n,a.length>0),s=await V(e,o,a),{imageData:c,imagePath:l}=I(s);return c?{imageData:c,...l&&{imagePath:l},prompt:o}:{failed:{...s,sequence:null}}}async function be(e,t,n){let r=await ye(e,t,n);if(`failed`in r)return r.failed;let{imageData:i,imagePath:a,html:o,prompt:s}=r,c=t.id,l=await Z(e.files?.artifacts,H,c,e=>{let t=e??{id:c,title:``,mode:n.mode,totalSlides:n.totalSlides,slides:{}};return n.slide===1&&(t.title=n.title),t.slides[String(n.slide)]={title:n.title,imagePrompt:n.imagePrompt,...a&&{imagePath:a},...o&&{html:o}},t}),u={...i&&{imageData:i},...a&&{imagePath:a},...o&&{html:o},prompt:s,slideshowId:c,slide:n.slide,totalSlides:n.totalSlides,title:n.title,mode:n.mode},d=n.mode===`steps`?`step`:`slide`;return{data:u,title:n.title||`Slide ${n.slide}`,message:[`${d} ${n.slide} of ${n.totalSlides} of slideshow "${c}" is on the screen`,a?`saved to ${a}`:``,l?``:Q(`slideshow`)].filter(Boolean).join(`; `),instructions:T(n),instructionsRequired:!0,sequence:pe(n)}}async function xe(e,t){let n=w(t);if(typeof n==`string`)return{message:n,sequence:null};let r=he(e),i=ge(r,n),a=n.mode===`steps`;if(a&&n.slide>i.current&&i.current>0&&!R(e,i.shownAt)){console.info(`[sequence] holding step ${n.slide} for the user`);let e=i.shownAt===1/0?`is still being drawn`:`is still on the screen`;return{message:`step ${n.slide} was not shown: the user hasn't said they're ready yet, and step ${i.current} ${e}. Wait for them before calling presentSlide for step ${n.slide}.`,cancelled:!0}}let o=a?i.slides.get(n.slide):void 0;if(o)return se(e.currentResult,o)?{message:`step ${n.slide} of ${n.totalSlides} is already on the screen`,cancelled:!0}:_e(r,i,n,o);let s=r.repeats.claim(me(i.id,n));if(`earlier`in s){if(!await s.earlier)return xe(e,t);let a=i.slides.get(n.slide);return a&&r.lastShown!==i?_e(r,i,n,a):{message:`slide ${n.slide} of ${n.totalSlides} is already on the screen`,cancelled:!0}}let{settle:c}=s,l={current:i.current,shownAt:i.shownAt};i.current=n.slide,i.shownAt=1/0;let u=!1;try{let t=await be(e,i,n);return u=oe(t),u&&(i.slides.set(n.slide,t),i.current=n.slide,i.shownAt=Date.now(),r.lastShown=i),t}finally{c(u),!u&&i.current===n.slide&&(i.current=l.current,i.shownAt=l.shownAt)}}var Se=({id:e,title:t,totalPanels:n})=>({step:0,total:n,kind:`story`,label:`The cast of "${t}"`,onShown:`introduce the characters`,nextCall:`call presentPanel for panel 1 of ${n} with storyboardId "${e}"`}),Ce=({id:e,totalPanels:t},n,r)=>({step:n,total:t,kind:`story`,label:`Panel ${n} of ${t}`,onShown:`tell that part of the story`,nextCall:`call presentPanel for panel ${n+1} of ${t} with storyboardId "${e}"`,...r.length>0&&{waitsForUser:!0}}),we=(e,t)=>e?`${e}. ${t}`:t,Te=(e,{name:t,description:n})=>we(e,`Character reference sheet of ${t}: ${n}. Full body, front, side and back views, on a plain white background. No text or labels.`);async function Ee(e,t){let n=D(t);if(typeof n==`string`)return{message:n,sequence:null};let r=await Promise.all(n.characters.map(t=>V(e,Te(n.style,t)))),i=r.map(I),a=r.find((e,t)=>!i[t]?.imageData);if(i.every(({imageData:e})=>!e)&&a)return{...a,message:`the character sheets couldn't be made: ${a.message}`,sequence:null};let o={id:z(),...n,characters:n.characters.map((e,t)=>{let n=i[t]?.imagePath;return{...e,...n&&{imagePath:n}}}),panels:{}},s=await Z(e.files?.artifacts,U,o.id,()=>o),c=o.characters.filter(e=>e.imagePath).map(e=>`${e.name}: ${e.imagePath}`),l=n.characters.map(({name:e},t)=>i[t]?.imageData?null:`${e} (${r[t]?.message??``})`).filter(e=>!!e),u=i.find(e=>e.imageData)?.imageData;return{data:{storyboardId:o.id,title:o.title,totalPanels:o.totalPanels,...u&&{imageData:u},characters:o.characters.map(({name:e,imagePath:t},n)=>{let r=i[n]?.imageData;return{name:e,...r&&{imageData:r},...t&&{imagePath:t}}})},title:o.title,message:[`storyboard "${o.id}" is ready with ${o.totalPanels} panels; the cast is on the screen`,c.length?`character sheets saved to ${c.join(`, `)}`:``,l.length?`no sheet for ${l.join(`; `)}: they will be drawn from their description`:``,s?``:Q(`storyboard`)].filter(Boolean).join(`; `),instructions:O(o),instructionsRequired:!0,sequence:Se(o)}}function De(e,t,n){let r=[we(e.style,`Panel ${t.panel} of ${e.totalPanels} of the illustrated story "${e.title}". ${t.imagePrompt}`)],i=0,a=n.map(({character:e,hasSheet:t})=>t?`${e.name} is the character in reference image ${++i}`:`${e.name}: ${e.description}`);return a.length&&r.push(`${a.join(`. `)}.`),i&&r.push(`Draw each character exactly as in their reference image: the same face, hair, clothes and colors. Use the reference images only for how the characters look, not for their pose or the background.`),r.push(`No captions, speech bubbles or other text in the picture.`),r.join(` `)}async function Oe(e,t,n){let r=[],i=[];for(let a of n.characters){let n=t.characters.find(e=>b(e.name,a));if(!n)r.push(a);else if(!i.some(e=>e.character===n)){let[t]=n.imagePath?await B(e,[n.imagePath]):[];i.push({character:n,sheet:t??null})}}let a=i.map(({sheet:e})=>e).filter(e=>!!e),o=De(t,n,i.map(({character:e,sheet:t})=>({character:e,hasSheet:!!t}))),s=await V(e,o,a),{imageData:c,imagePath:l}=I(s);if(!c)return{...s,sequence:null};let u=n.panel<t.totalPanels&&n.choices.length>=2?n.choices:[],d=await Z(e.files?.artifacts,U,t.id,e=>{let r=e??t;return u.length&&(r.interactive=!0),r.panels[String(n.panel)]={caption:n.caption,characters:i.map(({character:e})=>e.name),imagePrompt:n.imagePrompt,...l&&{imagePath:l},...u.length&&{choices:u}},r});return{data:{imageData:c,...l&&{imagePath:l},prompt:o,storyboardId:t.id,panel:n.panel,totalPanels:t.totalPanels,caption:n.caption,...u.length&&{choices:u}},title:n.caption||`Panel ${n.panel}`,message:[`panel ${n.panel} of ${t.totalPanels} is on the screen`,l?`saved to ${l}`:``,r.length?`not in the cast, so drawn from the prompt alone: ${r.join(`, `)}`:``,d?``:Q(`storyboard`)].filter(Boolean).join(`; `),instructions:j(t,n.panel,u),instructionsRequired:!0,sequence:Ce(t,n.panel,u)}}var ke=ue(()=>({repeats:$(),awaitingChoice:new Map}));async function Ae(e,t){let n=A(t);if(!n)return{message:k,sequence:null};let{storyboardId:r,panel:i}=n,{repeats:a,awaitingChoice:o}=ke(e),s=o.get(r);if(s&&i>s.panel&&!R(e,s.shownAt))return console.info(`[sequence] holding panel ${i} for the user`),{message:s.shownAt===1/0?`panel ${i} was not shown: panel ${s.panel} is still being drawn. Wait for it before going on.`:`panel ${i} was not shown: the user hasn't picked a choice yet, and panel ${s.panel} is still on the screen. Wait for their answer.`,cancelled:!0};let c=a.claim(JSON.stringify(n));if(`earlier`in c)return await c.earlier?{message:`panel ${i} is already on the screen`,cancelled:!0}:Ae(e,t);let{settle:l}=c,u={panel:i,shownAt:1/0},d=o.get(r);o.set(r,u);let f=()=>o.get(r)===u,p=!1;try{let t=await X(e.files?.artifacts,U,r);if(!t)return{message:`there is no storyboard "${r}"; call defineStoryboard first`,sequence:null};if(i>t.totalPanels)return{message:`storyboard "${t.id}" has ${t.totalPanels} panels`,sequence:null};let a=await Oe(e,t,n);p=!!I(a).imageData;let s=a.data;return p&&f()&&(s?.choices?.length?o.set(r,{panel:i,shownAt:Date.now()}):o.delete(r)),a}finally{l(p),!p&&f()&&(d?o.set(r,d):o.delete(r))}}var je={toolDefinition:E,generatingMessage:`Making the slide...`,isEnabled:()=>!0,execute:(e,t)=>xe(e,t)},Me={toolDefinition:N,generatingMessage:`Drawing the characters...`,isEnabled:()=>!0,execute:(e,t)=>Ee(e,t)},Ne={toolDefinition:P,generatingMessage:`Drawing the panel...`,isEnabled:()=>!0,execute:(e,t)=>Ae(e,t)};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return S}});
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-CPlicVIg.cjs");exports.DEFINE_STORYBOARD=e.s,exports.DEFINE_STORYBOARD_DEFINITION=e.c,exports.MAX_CHARACTERS=e.l,exports.MAX_CHOICES=e.u,exports.MAX_PANELS=e.d,exports.MAX_SLIDE_HTML=e.k,exports.PANEL_ARGS_ERROR=e.f,exports.PRESENT_PANEL=e.p,exports.PRESENT_PANEL_DEFINITION=e.m,exports.PRESENT_SLIDE=e.h,exports.PRESENT_SLIDE_DEFINITION=e.g,exports.PRESENT_SLIDE_PROMPT=e._,exports.SEQUENCE_ID=e.v,exports.SLIDESHOWS_DIR=e.i,exports.SLIDE_ANIMATIONS=e.A,exports.SLIDE_ARGS_ERROR=e.y,exports.SLIDE_HEIGHT=e.j,exports.SLIDE_HTML_TOO_LONG=e.b,exports.SLIDE_WIDTH=e.M,exports.STORYBOARDS_DIR=e.a,exports.STORYBOARD_PROMPT=e.x,exports.castShownInstructions=e.S,exports.defineStoryboardPluginCore=e.t,exports.loadRecord=e.o,exports.panelShownInstructions=e.C,exports.parsePanelArgs=e.w,exports.parseSlideArgs=e.T,exports.parseStoryboardArgs=e.E,exports.presentPanelPluginCore=e.n,exports.presentSlidePluginCore=e.r,exports.sameName=e.D,exports.slideHtmlDocument=e.N,exports.slideShownInstructions=e.O;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-OZRdlavD.cjs");exports.DEFINE_STORYBOARD=e.s,exports.DEFINE_STORYBOARD_DEFINITION=e.c,exports.MAX_CHARACTERS=e.l,exports.MAX_CHOICES=e.u,exports.MAX_PANELS=e.d,exports.MAX_SLIDE_HTML=e.k,exports.PANEL_ARGS_ERROR=e.f,exports.PRESENT_PANEL=e.p,exports.PRESENT_PANEL_DEFINITION=e.m,exports.PRESENT_SLIDE=e.h,exports.PRESENT_SLIDE_DEFINITION=e.g,exports.PRESENT_SLIDE_PROMPT=e._,exports.SEQUENCE_ID=e.v,exports.SLIDESHOWS_DIR=e.i,exports.SLIDE_ANIMATION_KINDS=e.A,exports.SLIDE_ARGS_ERROR=e.y,exports.SLIDE_AUTO_END_SECONDS=e.j,exports.SLIDE_CSS_ANIMATIONS_FINISHED=e.M,exports.SLIDE_HEIGHT=e.N,exports.SLIDE_HTML_TOO_LONG=e.b,exports.SLIDE_WIDTH=e.P,exports.STORYBOARDS_DIR=e.a,exports.STORYBOARD_PROMPT=e.x,exports.castShownInstructions=e.S,exports.defineStoryboardPluginCore=e.t,exports.loadRecord=e.o,exports.panelShownInstructions=e.C,exports.parsePanelArgs=e.w,exports.parseSlideArgs=e.T,exports.parseStoryboardArgs=e.E,exports.presentPanelPluginCore=e.n,exports.presentSlidePluginCore=e.r,exports.sameName=e.D,exports.slideHtmlDocument=e.F,exports.slideShownInstructions=e.O;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, j as v, k as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, v as k, w as A, x as j, y as M } from "./core-BJ7q9fgr.js";
2
- export { E as DEFINE_STORYBOARD, f as DEFINE_STORYBOARD_DEFINITION, b as MAX_CHARACTERS, O as MAX_CHOICES, p as MAX_PANELS, y as MAX_SLIDE_HTML, m as PANEL_ARGS_ERROR, w as PRESENT_PANEL, x as PRESENT_PANEL_DEFINITION, g as PRESENT_SLIDE, h as PRESENT_SLIDE_DEFINITION, l as PRESENT_SLIDE_PROMPT, k as SEQUENCE_ID, _ as SLIDESHOWS_DIR, e as SLIDE_ANIMATIONS, M as SLIDE_ARGS_ERROR, v as SLIDE_HEIGHT, d as SLIDE_HTML_TOO_LONG, i as SLIDE_WIDTH, u as STORYBOARDS_DIR, j as STORYBOARD_PROMPT, s as castShownInstructions, D as defineStoryboardPluginCore, C as loadRecord, t as panelShownInstructions, A as parsePanelArgs, c as parseSlideArgs, r as parseStoryboardArgs, S as presentPanelPluginCore, T as presentSlidePluginCore, n as sameName, a as slideHtmlDocument, o as slideShownInstructions };
1
+ import { A as e, C as t, D as n, E as r, F as i, M as a, N as o, O as s, P as c, S as l, T as u, _ as d, a as f, b as p, c as m, d as h, f as g, g as _, h as v, i as y, j as b, k as x, l as S, m as C, n as w, o as T, p as E, r as D, s as O, t as k, u as A, v as j, w as M, x as N, y as P } from "./core-D3XJ6n_I.js";
2
+ export { O as DEFINE_STORYBOARD, m as DEFINE_STORYBOARD_DEFINITION, S as MAX_CHARACTERS, A as MAX_CHOICES, h as MAX_PANELS, x as MAX_SLIDE_HTML, g as PANEL_ARGS_ERROR, E as PRESENT_PANEL, C as PRESENT_PANEL_DEFINITION, v as PRESENT_SLIDE, _ as PRESENT_SLIDE_DEFINITION, d as PRESENT_SLIDE_PROMPT, j as SEQUENCE_ID, y as SLIDESHOWS_DIR, e as SLIDE_ANIMATION_KINDS, P as SLIDE_ARGS_ERROR, b as SLIDE_AUTO_END_SECONDS, a as SLIDE_CSS_ANIMATIONS_FINISHED, o as SLIDE_HEIGHT, p as SLIDE_HTML_TOO_LONG, c as SLIDE_WIDTH, f as STORYBOARDS_DIR, N as STORYBOARD_PROMPT, l as castShownInstructions, k as defineStoryboardPluginCore, T as loadRecord, t as panelShownInstructions, M as parsePanelArgs, u as parseSlideArgs, r as parseStoryboardArgs, w as presentPanelPluginCore, D as presentSlidePluginCore, n as sameName, i as slideHtmlDocument, s as slideShownInstructions };
package/dist/style.css CHANGED
@@ -1,3 +1,3 @@
1
1
  /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-sky-500:oklch(68.5% .169 237.323);--color-indigo-600:oklch(51.1% .262 276.966);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-900:oklch(20.8% .042 265.755);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-tight:1.25;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--aspect-video:16 / 9;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.relative{position:relative}.mt-1{margin-top:var(--spacing)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.aspect-video{aspect-ratio:var(--aspect-video)}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-0{min-height:0}.w-full{width:100%}.max-w-full{max-width:100%}.flex-1{flex:1}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.auto-rows-fr{grid-auto-rows:minmax(0,1fr)}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:2147483647px}.border-0{border-style:var(--tw-border-style);border-width:0}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-white{background-color:var(--color-white)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-indigo-600{--tw-gradient-from:var(--color-indigo-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-500{--tw-gradient-to:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.object-contain{object-fit:contain}.p-2{padding:calc(var(--spacing) * 2)}.p-4{padding:calc(var(--spacing) * 4)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-2{padding-block:calc(var(--spacing) * 2)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.text-center{text-align:center}.font-sans{font-family:var(--font-sans)}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-gray-800{color:var(--color-gray-800)}.text-slate-900{color:var(--color-slate-900)}.text-white{color:var(--color-white)}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-80{opacity:.8}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.\[animation-delay\:…\]{animation-delay:…}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-sky-500:oklch(68.5% .169 237.323);--color-indigo-600:oklch(51.1% .262 276.966);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-900:oklch(20.8% .042 265.755);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-tight:1.25;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.relative{position:relative}.mt-1{margin-top:var(--spacing)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.table{display:table}.aspect-video{aspect-ratio:var(--aspect-video)}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-0{min-height:0}.w-full{width:100%}.max-w-full{max-width:100%}.flex-1{flex:1}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.auto-rows-fr{grid-auto-rows:minmax(0,1fr)}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:2147483647px}.border-0{border-style:var(--tw-border-style);border-width:0}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-white{background-color:var(--color-white)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-indigo-600{--tw-gradient-from:var(--color-indigo-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-500{--tw-gradient-to:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.object-contain{object-fit:contain}.p-2{padding:calc(var(--spacing) * 2)}.p-4{padding:calc(var(--spacing) * 4)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-2{padding-block:calc(var(--spacing) * 2)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.text-center{text-align:center}.font-sans{font-family:var(--font-sans)}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-gray-800{color:var(--color-gray-800)}.text-slate-900{color:var(--color-slate-900)}.text-white{color:var(--color-white)}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-80{opacity:.8}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
3
3
  /*$vite$:1*/
package/dist/vue.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-CPlicVIg.cjs");let t=require("vue"),n=require("@mulmochat-plugin/ui-image");function r({caption:e,choices:n}){let r=[];return e&&r.push((0,t.h)(`p`,{class:`text-center text-lg text-gray-800 px-4`},e)),n?.length&&r.push((0,t.h)(`ol`,{class:`flex flex-wrap justify-center gap-3 px-4`},n.map((e,n)=>(0,t.h)(`li`,{class:`rounded-full bg-indigo-600 text-white text-xl px-5 py-2 font-medium`},`${n+1}. ${e}`)))),r.length?(0,t.h)(`div`,{class:`flex flex-col gap-2 pb-2`},r):null}function i(e,n=()=>({})){return(0,t.markRaw)((0,t.defineComponent)({name:e,props:{selectedResult:{type:Object,required:!0}},setup(e){return()=>{let i=e.selectedResult.data;return i?.imageData?(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-white p-2 gap-2`},[(0,t.h)(`div`,{class:`flex-1 min-h-0 flex items-center justify-center`},[(0,t.h)(`img`,{src:i.imageData,alt:i.prompt??``,class:`max-w-full max-h-full object-contain`})]),r(n(i))]):(0,t.h)(`div`,{class:`h-full bg-white`})}}}))}var a=(0,t.defineComponent)({name:`HtmlSlide`,props:{html:{type:String,required:!0}},setup(n){let r=(0,t.ref)(null),i=(0,t.ref)(0),a,o=()=>{let t=r.value;t&&(i.value=Math.min(t.clientWidth/e.M,t.clientHeight/720))};return(0,t.onMounted)(()=>{o(),a=new ResizeObserver(o),r.value&&a.observe(r.value)}),(0,t.onBeforeUnmount)(()=>a?.disconnect()),()=>(0,t.h)(`div`,{ref:r,class:`flex-1 min-h-0 w-full relative overflow-hidden`},i.value>0?[(0,t.h)(`iframe`,{srcdoc:e.N(n.html),sandbox:`allow-scripts`,title:`slide`,width:e.M,height:720,class:`absolute border-0 bg-white shadow`,style:{left:`50%`,top:`50%`,transform:`translate(-50%, -50%) scale(${i.value})`}})]:[])}}),o=i(`PresentSlideImageView`),s=(0,t.markRaw)((0,t.defineComponent)({name:`PresentSlideView`,props:{selectedResult:{type:Object,required:!0}},setup(e){return()=>{let n=e.selectedResult.data?.html;return n?(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-slate-100 p-2`},[(0,t.h)(a,{key:e.selectedResult.uuid??n,html:n})]):(0,t.h)(o,{selectedResult:e.selectedResult})}}})),c=(0,t.markRaw)((0,t.defineComponent)({name:`PresentSlidePreview`,props:{result:{type:Object,required:!0}},setup(e){return()=>{let r=e.result.data;return r?.html?(0,t.h)(`div`,{class:`aspect-video w-full rounded bg-gradient-to-br from-indigo-600 to-sky-500 text-white flex flex-col items-center justify-center p-2 text-center`},[(0,t.h)(`div`,{class:`text-xs opacity-80`},`Slide ${r.slide} of ${r.totalSlides}`),(0,t.h)(`div`,{class:`text-sm font-semibold leading-tight line-clamp-2`},r.title||e.result.title||``)]):(0,t.h)(n.ImagePreview,{result:e.result})}}}));function l(e){return(0,t.markRaw)((0,t.defineComponent)({name:e,props:{result:{type:Object,required:!0}},setup(e){return()=>(0,t.h)(n.ImagePreview,{result:e.result})}}))}var u=(0,t.markRaw)((0,t.defineComponent)({name:`StoryboardCastView`,props:{selectedResult:{type:Object,required:!0}},setup(e){return()=>{let n=e.selectedResult.data,r=n?.characters??[];return(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-white p-4`},[(0,t.h)(`h2`,{class:`text-center text-xl font-semibold text-gray-800 mb-3`},n?.title??``),(0,t.h)(`div`,{class:`flex-1 min-h-0 grid gap-3 ${r.length>1?`grid-cols-2`:`grid-cols-1`} auto-rows-fr`},r.map(e=>(0,t.h)(`figure`,{class:`min-h-0 flex flex-col items-center`},[e.imageData?(0,t.h)(`img`,{src:e.imageData,alt:e.name,class:`flex-1 min-h-0 max-w-full object-contain`}):(0,t.h)(`div`,{class:`flex-1`}),(0,t.h)(`figcaption`,{class:`text-lg text-gray-800 mt-1`},e.name)])))])}}})),d=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],f={...e.r,viewComponent:s,previewComponent:c},p={...e.t,viewComponent:u,previewComponent:l(`StoryboardCastPreview`)},m={...e.n,viewComponent:i(`PresentPanelView`,e=>({caption:typeof e.caption==`string`?e.caption:``,choices:d(e.choices)})),previewComponent:l(`PresentPanelPreview`)},h=[f,p,m];exports.DEFINE_STORYBOARD=e.s,exports.DEFINE_STORYBOARD_DEFINITION=e.c,exports.MAX_CHARACTERS=e.l,exports.MAX_CHOICES=e.u,exports.MAX_PANELS=e.d,exports.MAX_SLIDE_HTML=e.k,exports.PANEL_ARGS_ERROR=e.f,exports.PRESENT_PANEL=e.p,exports.PRESENT_PANEL_DEFINITION=e.m,exports.PRESENT_SLIDE=e.h,exports.PRESENT_SLIDE_DEFINITION=e.g,exports.PRESENT_SLIDE_PROMPT=e._,exports.SEQUENCE_ID=e.v,exports.SLIDESHOWS_DIR=e.i,exports.SLIDE_ANIMATIONS=e.A,exports.SLIDE_ARGS_ERROR=e.y,exports.SLIDE_HEIGHT=e.j,exports.SLIDE_HTML_TOO_LONG=e.b,exports.SLIDE_WIDTH=e.M,exports.STORYBOARDS_DIR=e.a,exports.STORYBOARD_PROMPT=e.x,exports.castShownInstructions=e.S,exports.defineStoryboardPlugin=p,exports.defineStoryboardPluginCore=e.t,exports.loadRecord=e.o,exports.panelShownInstructions=e.C,exports.parsePanelArgs=e.w,exports.parseSlideArgs=e.T,exports.parseStoryboardArgs=e.E,exports.plugins=h,exports.presentPanelPlugin=m,exports.presentPanelPluginCore=e.n,exports.presentSlidePlugin=f,exports.presentSlidePluginCore=e.r,exports.sameName=e.D,exports.slideHtmlDocument=e.N,exports.slideShownInstructions=e.O;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-OZRdlavD.cjs");let t=require("vue"),n=require("@mulmochat-plugin/ui-image");function r({caption:e,choices:n}){let r=[];return e&&r.push((0,t.h)(`p`,{class:`text-center text-lg text-gray-800 px-4`},e)),n?.length&&r.push((0,t.h)(`ol`,{class:`flex flex-wrap justify-center gap-3 px-4`},n.map((e,n)=>(0,t.h)(`li`,{class:`rounded-full bg-indigo-600 text-white text-xl px-5 py-2 font-medium`},`${n+1}. ${e}`)))),r.length?(0,t.h)(`div`,{class:`flex flex-col gap-2 pb-2`},r):null}function i(e,n=()=>({})){return(0,t.markRaw)((0,t.defineComponent)({name:e,props:{selectedResult:{type:Object,required:!0}},setup(e){return()=>{let i=e.selectedResult.data;return i?.imageData?(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-white p-2 gap-2`},[(0,t.h)(`div`,{class:`flex-1 min-h-0 flex items-center justify-center`},[(0,t.h)(`img`,{src:i.imageData,alt:i.prompt??``,class:`max-w-full max-h-full object-contain`})]),r(n(i))]):(0,t.h)(`div`,{class:`h-full bg-white`})}}}))}var a=(0,t.defineComponent)({name:`HtmlSlide`,props:{html:{type:String,required:!0}},setup(n){let r=(0,t.ref)(null),i=(0,t.ref)(0),a,o=()=>{let t=r.value;t&&(i.value=Math.min(t.clientWidth/e.P,t.clientHeight/720))};return(0,t.onMounted)(()=>{o(),a=new ResizeObserver(o),r.value&&a.observe(r.value)}),(0,t.onBeforeUnmount)(()=>a?.disconnect()),()=>(0,t.h)(`div`,{ref:r,class:`flex-1 min-h-0 w-full relative overflow-hidden`},i.value>0?[(0,t.h)(`iframe`,{srcdoc:e.F(n.html),sandbox:`allow-scripts`,title:`slide`,width:e.P,height:720,class:`absolute border-0 bg-white shadow`,style:{left:`50%`,top:`50%`,transform:`translate(-50%, -50%) scale(${i.value})`}})]:[])}}),o=i(`PresentSlideImageView`),s=(0,t.markRaw)((0,t.defineComponent)({name:`PresentSlideView`,props:{selectedResult:{type:Object,required:!0}},setup(e){return()=>{let n=e.selectedResult.data?.html;return n?(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-slate-100 p-2`},[(0,t.h)(a,{key:e.selectedResult.uuid??n,html:n})]):(0,t.h)(o,{selectedResult:e.selectedResult})}}})),c=(0,t.markRaw)((0,t.defineComponent)({name:`PresentSlidePreview`,props:{result:{type:Object,required:!0}},setup(e){return()=>{let r=e.result.data;return r?.html?(0,t.h)(`div`,{class:`aspect-video w-full rounded bg-gradient-to-br from-indigo-600 to-sky-500 text-white flex flex-col items-center justify-center p-2 text-center`},[(0,t.h)(`div`,{class:`text-xs opacity-80`},`Slide ${r.slide} of ${r.totalSlides}`),(0,t.h)(`div`,{class:`text-sm font-semibold leading-tight line-clamp-2`},r.title||e.result.title||``)]):(0,t.h)(n.ImagePreview,{result:e.result})}}}));function l(e){return(0,t.markRaw)((0,t.defineComponent)({name:e,props:{result:{type:Object,required:!0}},setup(e){return()=>(0,t.h)(n.ImagePreview,{result:e.result})}}))}var u=(0,t.markRaw)((0,t.defineComponent)({name:`StoryboardCastView`,props:{selectedResult:{type:Object,required:!0}},setup(e){return()=>{let n=e.selectedResult.data,r=n?.characters??[];return(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-white p-4`},[(0,t.h)(`h2`,{class:`text-center text-xl font-semibold text-gray-800 mb-3`},n?.title??``),(0,t.h)(`div`,{class:`flex-1 min-h-0 grid gap-3 ${r.length>1?`grid-cols-2`:`grid-cols-1`} auto-rows-fr`},r.map(e=>(0,t.h)(`figure`,{class:`min-h-0 flex flex-col items-center`},[e.imageData?(0,t.h)(`img`,{src:e.imageData,alt:e.name,class:`flex-1 min-h-0 max-w-full object-contain`}):(0,t.h)(`div`,{class:`flex-1`}),(0,t.h)(`figcaption`,{class:`text-lg text-gray-800 mt-1`},e.name)])))])}}})),d=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],f={...e.r,viewComponent:s,previewComponent:c},p={...e.t,viewComponent:u,previewComponent:l(`StoryboardCastPreview`)},m={...e.n,viewComponent:i(`PresentPanelView`,e=>({caption:typeof e.caption==`string`?e.caption:``,choices:d(e.choices)})),previewComponent:l(`PresentPanelPreview`)},h=[f,p,m];exports.DEFINE_STORYBOARD=e.s,exports.DEFINE_STORYBOARD_DEFINITION=e.c,exports.MAX_CHARACTERS=e.l,exports.MAX_CHOICES=e.u,exports.MAX_PANELS=e.d,exports.MAX_SLIDE_HTML=e.k,exports.PANEL_ARGS_ERROR=e.f,exports.PRESENT_PANEL=e.p,exports.PRESENT_PANEL_DEFINITION=e.m,exports.PRESENT_SLIDE=e.h,exports.PRESENT_SLIDE_DEFINITION=e.g,exports.PRESENT_SLIDE_PROMPT=e._,exports.SEQUENCE_ID=e.v,exports.SLIDESHOWS_DIR=e.i,exports.SLIDE_ANIMATION_KINDS=e.A,exports.SLIDE_ARGS_ERROR=e.y,exports.SLIDE_AUTO_END_SECONDS=e.j,exports.SLIDE_CSS_ANIMATIONS_FINISHED=e.M,exports.SLIDE_HEIGHT=e.N,exports.SLIDE_HTML_TOO_LONG=e.b,exports.SLIDE_WIDTH=e.P,exports.STORYBOARDS_DIR=e.a,exports.STORYBOARD_PROMPT=e.x,exports.castShownInstructions=e.S,exports.defineStoryboardPlugin=p,exports.defineStoryboardPluginCore=e.t,exports.loadRecord=e.o,exports.panelShownInstructions=e.C,exports.parsePanelArgs=e.w,exports.parseSlideArgs=e.T,exports.parseStoryboardArgs=e.E,exports.plugins=h,exports.presentPanelPlugin=m,exports.presentPanelPluginCore=e.n,exports.presentSlidePlugin=f,exports.presentSlidePluginCore=e.r,exports.sameName=e.D,exports.slideHtmlDocument=e.F,exports.slideShownInstructions=e.O;
package/dist/vue.js CHANGED
@@ -1,13 +1,13 @@
1
- import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, j as v, k as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, v as k, w as A, x as j, y as M } from "./core-BJ7q9fgr.js";
2
- import { defineComponent as N, h as P, markRaw as F, onBeforeUnmount as I, onMounted as L, ref as R } from "vue";
3
- import { ImagePreview as z } from "@mulmochat-plugin/ui-image";
1
+ import { A as e, C as t, D as n, E as r, F as i, M as a, N as o, O as s, P as c, S as ee, T as l, _ as u, a as d, b as f, c as p, d as m, f as h, g, h as _, i as v, j as y, k as b, l as x, m as S, n as C, o as w, p as T, r as E, s as D, t as O, u as k, v as A, w as j, x as M, y as N } from "./core-D3XJ6n_I.js";
2
+ import { defineComponent as P, h as F, markRaw as I, onBeforeUnmount as L, onMounted as R, ref as z } from "vue";
3
+ import { ImagePreview as B } from "@mulmochat-plugin/ui-image";
4
4
  //#region src/vue/index.ts
5
- function B({ caption: e, choices: t }) {
5
+ function V({ caption: e, choices: t }) {
6
6
  let n = [];
7
- return e && n.push(P("p", { class: "text-center text-lg text-gray-800 px-4" }, e)), t?.length && n.push(P("ol", { class: "flex flex-wrap justify-center gap-3 px-4" }, t.map((e, t) => P("li", { class: "rounded-full bg-indigo-600 text-white text-xl px-5 py-2 font-medium" }, `${t + 1}. ${e}`)))), n.length ? P("div", { class: "flex flex-col gap-2 pb-2" }, n) : null;
7
+ return e && n.push(F("p", { class: "text-center text-lg text-gray-800 px-4" }, e)), t?.length && n.push(F("ol", { class: "flex flex-wrap justify-center gap-3 px-4" }, t.map((e, t) => F("li", { class: "rounded-full bg-indigo-600 text-white text-xl px-5 py-2 font-medium" }, `${t + 1}. ${e}`)))), n.length ? F("div", { class: "flex flex-col gap-2 pb-2" }, n) : null;
8
8
  }
9
- function V(e, t = () => ({})) {
10
- return F(N({
9
+ function H(e, t = () => ({})) {
10
+ return I(P({
11
11
  name: e,
12
12
  props: { selectedResult: {
13
13
  type: Object,
@@ -16,36 +16,36 @@ function V(e, t = () => ({})) {
16
16
  setup(e) {
17
17
  return () => {
18
18
  let n = e.selectedResult.data;
19
- return n?.imageData ? P("div", { class: "h-full w-full flex flex-col bg-white p-2 gap-2" }, [P("div", { class: "flex-1 min-h-0 flex items-center justify-center" }, [P("img", {
19
+ return n?.imageData ? F("div", { class: "h-full w-full flex flex-col bg-white p-2 gap-2" }, [F("div", { class: "flex-1 min-h-0 flex items-center justify-center" }, [F("img", {
20
20
  src: n.imageData,
21
21
  alt: n.prompt ?? "",
22
22
  class: "max-w-full max-h-full object-contain"
23
- })]), B(t(n))]) : P("div", { class: "h-full bg-white" });
23
+ })]), V(t(n))]) : F("div", { class: "h-full bg-white" });
24
24
  };
25
25
  }
26
26
  }));
27
27
  }
28
- var H = N({
28
+ var U = P({
29
29
  name: "HtmlSlide",
30
30
  props: { html: {
31
31
  type: String,
32
32
  required: !0
33
33
  } },
34
34
  setup(e) {
35
- let t = R(null), n = R(0), r, o = () => {
35
+ let t = z(null), n = z(0), r, a = () => {
36
36
  let e = t.value;
37
- e && (n.value = Math.min(e.clientWidth / i, e.clientHeight / 720));
37
+ e && (n.value = Math.min(e.clientWidth / c, e.clientHeight / 720));
38
38
  };
39
- return L(() => {
40
- o(), r = new ResizeObserver(o), t.value && r.observe(t.value);
41
- }), I(() => r?.disconnect()), () => P("div", {
39
+ return R(() => {
40
+ a(), r = new ResizeObserver(a), t.value && r.observe(t.value);
41
+ }), L(() => r?.disconnect()), () => F("div", {
42
42
  ref: t,
43
43
  class: "flex-1 min-h-0 w-full relative overflow-hidden"
44
- }, n.value > 0 ? [P("iframe", {
45
- srcdoc: a(e.html),
44
+ }, n.value > 0 ? [F("iframe", {
45
+ srcdoc: i(e.html),
46
46
  sandbox: "allow-scripts",
47
47
  title: "slide",
48
- width: i,
48
+ width: c,
49
49
  height: 720,
50
50
  class: "absolute border-0 bg-white shadow",
51
51
  style: {
@@ -55,7 +55,7 @@ var H = N({
55
55
  }
56
56
  })] : []);
57
57
  }
58
- }), U = V("PresentSlideImageView"), W = F(N({
58
+ }), W = H("PresentSlideImageView"), G = I(P({
59
59
  name: "PresentSlideView",
60
60
  props: { selectedResult: {
61
61
  type: Object,
@@ -64,13 +64,13 @@ var H = N({
64
64
  setup(e) {
65
65
  return () => {
66
66
  let t = e.selectedResult.data?.html;
67
- return t ? P("div", { class: "h-full w-full flex flex-col bg-slate-100 p-2" }, [P(H, {
67
+ return t ? F("div", { class: "h-full w-full flex flex-col bg-slate-100 p-2" }, [F(U, {
68
68
  key: e.selectedResult.uuid ?? t,
69
69
  html: t
70
- })]) : P(U, { selectedResult: e.selectedResult });
70
+ })]) : F(W, { selectedResult: e.selectedResult });
71
71
  };
72
72
  }
73
- })), G = F(N({
73
+ })), K = I(P({
74
74
  name: "PresentSlidePreview",
75
75
  props: { result: {
76
76
  type: Object,
@@ -79,23 +79,23 @@ var H = N({
79
79
  setup(e) {
80
80
  return () => {
81
81
  let t = e.result.data;
82
- return t?.html ? P("div", { class: "aspect-video w-full rounded bg-gradient-to-br from-indigo-600 to-sky-500 text-white flex flex-col items-center justify-center p-2 text-center" }, [P("div", { class: "text-xs opacity-80" }, `Slide ${t.slide} of ${t.totalSlides}`), P("div", { class: "text-sm font-semibold leading-tight line-clamp-2" }, t.title || e.result.title || "")]) : P(z, { result: e.result });
82
+ return t?.html ? F("div", { class: "aspect-video w-full rounded bg-gradient-to-br from-indigo-600 to-sky-500 text-white flex flex-col items-center justify-center p-2 text-center" }, [F("div", { class: "text-xs opacity-80" }, `Slide ${t.slide} of ${t.totalSlides}`), F("div", { class: "text-sm font-semibold leading-tight line-clamp-2" }, t.title || e.result.title || "")]) : F(B, { result: e.result });
83
83
  };
84
84
  }
85
85
  }));
86
- function K(e) {
87
- return F(N({
86
+ function q(e) {
87
+ return I(P({
88
88
  name: e,
89
89
  props: { result: {
90
90
  type: Object,
91
91
  required: !0
92
92
  } },
93
93
  setup(e) {
94
- return () => P(z, { result: e.result });
94
+ return () => F(B, { result: e.result });
95
95
  }
96
96
  }));
97
97
  }
98
- var q = F(N({
98
+ var J = I(P({
99
99
  name: "StoryboardCastView",
100
100
  props: { selectedResult: {
101
101
  type: Object,
@@ -104,32 +104,32 @@ var q = F(N({
104
104
  setup(e) {
105
105
  return () => {
106
106
  let t = e.selectedResult.data, n = t?.characters ?? [];
107
- return P("div", { class: "h-full w-full flex flex-col bg-white p-4" }, [P("h2", { class: "text-center text-xl font-semibold text-gray-800 mb-3" }, t?.title ?? ""), P("div", { class: `flex-1 min-h-0 grid gap-3 ${n.length > 1 ? "grid-cols-2" : "grid-cols-1"} auto-rows-fr` }, n.map((e) => P("figure", { class: "min-h-0 flex flex-col items-center" }, [e.imageData ? P("img", {
107
+ return F("div", { class: "h-full w-full flex flex-col bg-white p-4" }, [F("h2", { class: "text-center text-xl font-semibold text-gray-800 mb-3" }, t?.title ?? ""), F("div", { class: `flex-1 min-h-0 grid gap-3 ${n.length > 1 ? "grid-cols-2" : "grid-cols-1"} auto-rows-fr` }, n.map((e) => F("figure", { class: "min-h-0 flex flex-col items-center" }, [e.imageData ? F("img", {
108
108
  src: e.imageData,
109
109
  alt: e.name,
110
110
  class: "flex-1 min-h-0 max-w-full object-contain"
111
- }) : P("div", { class: "flex-1" }), P("figcaption", { class: "text-lg text-gray-800 mt-1" }, e.name)])))]);
111
+ }) : F("div", { class: "flex-1" }), F("figcaption", { class: "text-lg text-gray-800 mt-1" }, e.name)])))]);
112
112
  };
113
113
  }
114
- })), J = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], Y = {
115
- ...T,
116
- viewComponent: W,
117
- previewComponent: G
118
- }, X = {
119
- ...D,
120
- viewComponent: q,
121
- previewComponent: K("StoryboardCastPreview")
114
+ })), Y = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], X = {
115
+ ...E,
116
+ viewComponent: G,
117
+ previewComponent: K
122
118
  }, Z = {
123
- ...S,
124
- viewComponent: V("PresentPanelView", (e) => ({
119
+ ...O,
120
+ viewComponent: J,
121
+ previewComponent: q("StoryboardCastPreview")
122
+ }, Q = {
123
+ ...C,
124
+ viewComponent: H("PresentPanelView", (e) => ({
125
125
  caption: typeof e.caption == "string" ? e.caption : "",
126
- choices: J(e.choices)
126
+ choices: Y(e.choices)
127
127
  })),
128
- previewComponent: K("PresentPanelPreview")
129
- }, Q = [
130
- Y,
128
+ previewComponent: q("PresentPanelPreview")
129
+ }, $ = [
131
130
  X,
132
- Z
131
+ Z,
132
+ Q
133
133
  ];
134
134
  //#endregion
135
- export { E as DEFINE_STORYBOARD, f as DEFINE_STORYBOARD_DEFINITION, b as MAX_CHARACTERS, O as MAX_CHOICES, p as MAX_PANELS, y as MAX_SLIDE_HTML, m as PANEL_ARGS_ERROR, w as PRESENT_PANEL, x as PRESENT_PANEL_DEFINITION, g as PRESENT_SLIDE, h as PRESENT_SLIDE_DEFINITION, l as PRESENT_SLIDE_PROMPT, k as SEQUENCE_ID, _ as SLIDESHOWS_DIR, e as SLIDE_ANIMATIONS, M as SLIDE_ARGS_ERROR, v as SLIDE_HEIGHT, d as SLIDE_HTML_TOO_LONG, i as SLIDE_WIDTH, u as STORYBOARDS_DIR, j as STORYBOARD_PROMPT, s as castShownInstructions, X as defineStoryboardPlugin, D as defineStoryboardPluginCore, C as loadRecord, t as panelShownInstructions, A as parsePanelArgs, c as parseSlideArgs, r as parseStoryboardArgs, Q as plugins, Z as presentPanelPlugin, S as presentPanelPluginCore, Y as presentSlidePlugin, T as presentSlidePluginCore, n as sameName, a as slideHtmlDocument, o as slideShownInstructions };
135
+ export { D as DEFINE_STORYBOARD, p as DEFINE_STORYBOARD_DEFINITION, x as MAX_CHARACTERS, k as MAX_CHOICES, m as MAX_PANELS, b as MAX_SLIDE_HTML, h as PANEL_ARGS_ERROR, T as PRESENT_PANEL, S as PRESENT_PANEL_DEFINITION, _ as PRESENT_SLIDE, g as PRESENT_SLIDE_DEFINITION, u as PRESENT_SLIDE_PROMPT, A as SEQUENCE_ID, v as SLIDESHOWS_DIR, e as SLIDE_ANIMATION_KINDS, N as SLIDE_ARGS_ERROR, y as SLIDE_AUTO_END_SECONDS, a as SLIDE_CSS_ANIMATIONS_FINISHED, o as SLIDE_HEIGHT, f as SLIDE_HTML_TOO_LONG, c as SLIDE_WIDTH, d as STORYBOARDS_DIR, M as STORYBOARD_PROMPT, ee as castShownInstructions, Z as defineStoryboardPlugin, O as defineStoryboardPluginCore, w as loadRecord, t as panelShownInstructions, j as parsePanelArgs, l as parseSlideArgs, r as parseStoryboardArgs, $ as plugins, Q as presentPanelPlugin, C as presentPanelPluginCore, X as presentSlidePlugin, E as presentSlidePluginCore, n as sameName, i as slideHtmlDocument, s as slideShownInstructions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gui-chat-plugin/sequence",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Slideshows, step-by-step guides and stories told in pictures (presentSlide, defineStoryboard, presentPanel) for GUI Chat Protocol hosts",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1,46 +0,0 @@
1
- let e=require("gui-chat-protocol");var t=1280,n=720,r=6e4,i=`https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.3.3/dist/index.global.js`,a=`sha384-2ql948lIdLcGEE0/qxNiudyTjgauA3RDJERu5xW75kFCvSl5a9odyQYCb6tEjnmB`,o=[`fade-in`,`fade-up`,`fade-down`,`slide-in-left`,`slide-in-right`,`zoom-in`,`pop`,`draw`],s=`
2
- @theme {
3
- --animate-fade-in: fade-in 0.8s ease-out both;
4
- --animate-fade-up: fade-up 0.8s ease-out both;
5
- --animate-fade-down: fade-down 0.8s ease-out both;
6
- --animate-slide-in-left: slide-in-left 0.8s ease-out both;
7
- --animate-slide-in-right: slide-in-right 0.8s ease-out both;
8
- --animate-zoom-in: zoom-in 0.8s ease-out both;
9
- --animate-pop: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
10
- --animate-draw: draw 1.5s ease-in-out both;
11
- @keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
12
- @keyframes fade-up { from { opacity: 0; transform: translateY(40px) } to { opacity: 1; transform: none } }
13
- @keyframes fade-down { from { opacity: 0; transform: translateY(-40px) } to { opacity: 1; transform: none } }
14
- @keyframes slide-in-left { from { opacity: 0; transform: translateX(-80px) } to { opacity: 1; transform: none } }
15
- @keyframes slide-in-right { from { opacity: 0; transform: translateX(80px) } to { opacity: 1; transform: none } }
16
- @keyframes zoom-in { from { opacity: 0; transform: scale(0.8) } to { opacity: 1; transform: none } }
17
- @keyframes pop { from { opacity: 0; transform: scale(0.5) } to { opacity: 1; transform: none } }
18
- @keyframes draw { from { stroke-dashoffset: var(--draw-length, 1000) } to { stroke-dashoffset: 0 } }
19
- }`,c=`
20
- (() => {
21
- const show = () => document.documentElement.classList.add("ready");
22
- const ready = () => requestAnimationFrame(() => requestAnimationFrame(show));
23
- const check = () =>
24
- document.querySelector("style:not([type]):not(#slide-base)") ? ready() : setTimeout(check, 30);
25
- addEventListener("DOMContentLoaded", check);
26
- setTimeout(show, 1000);
27
- addEventListener("click", (event) => {
28
- if (event.target instanceof Element && event.target.closest("a, area")) event.preventDefault();
29
- }, true);
30
- })();`,l=[`default-src 'none'`,`script-src 'sha256-MZyL5rvWmIVxl3WUuDU5BqzPJGR2/fV/YPh01MNyUoM=' ${i}`,`style-src 'unsafe-inline' https://fonts.googleapis.com`,`font-src https://fonts.gstatic.com data:`,`img-src data: blob:`,`media-src data: blob:`,`connect-src 'none'`,`form-action 'none'`,`base-uri 'none'`].join(`; `),u=e=>e.replace(/<(?=(meta|base|link)\b)/gi,`&lt;`).replace(/shadowroot/gi,`data-no-shadow-root`),d=`
31
- html, body { margin: 0; width: ${t}px; height: 720px; overflow: hidden; }
32
- html:not(.ready) body { visibility: hidden; }
33
- html:not(.ready) body * { animation-play-state: paused !important; }`;function f(e){return`<!doctype html>
34
- <html lang="en">
35
- <head>
36
- <meta charset="utf-8">
37
- <meta http-equiv="Content-Security-Policy" content="${l}">
38
- <style id="slide-base">${d}</style>
39
- <script>${c}<\/script>
40
- <script defer src="${i}" integrity="${a}" crossorigin="anonymous"><\/script>
41
- <style type="text/tailwindcss">${s}</style>
42
- </head>
43
- <body class="bg-white text-slate-900 font-sans antialiased">
44
- ${u(e)}
45
- </body>
46
- </html>`}var p=`presentSlide`,m=`defineStoryboard`,h=`presentPanel`,ee=4,te=12,ne=3,g=/^[0-9a-f]{12}$/,_=e=>typeof e==`object`&&!!e&&!Array.isArray(e),v=e=>typeof e==`string`?e.trim():``,y=(e,t)=>e.toLowerCase()===t.toLowerCase(),b=e=>typeof e==`number`&&Number.isInteger(e),x=`presentSlide needs slide and totalSlides (whole numbers, slide from 1 to totalSlides), and either an imagePrompt or html`,re=`presentSlide's html is too long: keep a slide under ${r} characters`;function ie(e){let{slide:t,totalSlides:n,title:r,imagePrompt:i}=e,a=v(e.html);return!b(t)||!b(n)||t<1||n<t||!a&&!v(i)?x:a.length>6e4?re:{slide:t,totalSlides:n,title:typeof r==`string`?r:``,imagePrompt:a?``:String(i),...a&&{html:a},mode:e.mode===`steps`?`steps`:`presentation`}}var S=({slide:e,totalSlides:t,title:n,mode:r})=>{let i=n?` ("${n}")`:``;if(r===`steps`){let n=`Step ${e} of ${t}${i}`;return e<t?`${n} is now on the screen. Explain what to do in this step, then stop and wait while the user does it. When they say they're ready (next, done, go on), call presentSlide for step ${e+1} with mode "steps". If they ask to go back or to see a step again, call presentSlide for that step.`:`${n}, the last one, is now on the screen. Explain what to do, then wrap up the guide once the user is done.`}let a=`Slide ${e} of ${t}${i}`;return e<t?`${a} is now on the screen. Explain it, then, in this same reply and without waiting for the user, call presentSlide for slide ${e+1}. If the user has asked you to stop, or asked something else, since the slideshow began, answer them instead of going on.`:`${a}, the last one, is now on the screen. Explain it, then wrap up the slideshow.`},ae=[`For an HTML slide, instead of imagePrompt: the slide's content, the inside of <body> only (no <html>, <head> or <body> tags), for a ${t}x720 px canvas, which it should fill (start with a <div class="w-full h-full ...">). Style it with Tailwind CSS v4 classes, which are loaded for you: a clear layout, a large title (text-6xl or so), few words in large type, a color scheme, and inline SVG or emoji for icons and diagrams. There is no network: no <img> from URLs, no links to follow.`,`Animate it so it builds up as you explain it: these classes are defined, ${o.map(e=>`animate-${e}`).join(`, `)} (an SVG path drawing itself: set stroke-dasharray and --draw-length to its length), plus Tailwind's animate-pulse, animate-bounce, animate-spin and animate-ping, and transitions. Stagger the parts with a delay, [animation-delay:600ms], so they appear one after another over a few seconds. A <style> with your own @keyframes is allowed too (and Google Fonts by @import). Scripts don't run: animate with CSS only.`].join(` `),C=`When the user asks for a slideshow (or to explain something with slides), plan four to six slides, then show them one at a time with presentSlide: slide 1 first, and each next slide only after you have explained the one on the screen. Go on to the last slide without asking whether to continue. A slide is a generated picture (imagePrompt) or a designed slide in HTML (html): use a picture for a scene, an object or a place, and HTML for words, numbers, lists, comparisons, timelines and diagrams, which a picture model draws badly; a slideshow can mix them. When the user asks for HTML slides (slides in HTML, an HTML presentation), this is the tool: make them HTML slides with presentSlide, one call per slide, not one HTML page. When the user wants to be shown how to do something they will do along with you (cooking, folding, fixing, an exercise), make it a step-by-step guide instead: mode "steps", one slide per step, and after each step wait for the user to say they are ready. Use generateImage for a single picture, not for slides.`,w={type:`function`,name:p,prompt:C,description:`Show one slide of a slideshow, full screen: a picture generated from imagePrompt, or a slide written in HTML (html). Call it once per slide, in order, starting with slide 1. With mode "steps" it is a step-by-step guide: one slide per step, and the next step waits for the user.`,parameters:{type:`object`,properties:{slide:{type:`integer`,description:`This slide's number, starting at 1.`},totalSlides:{type:`integer`,description:`How many slides the slideshow has. Keep it the same for every slide.`},title:{type:`string`,description:`The slide's title.`},imagePrompt:{type:`string`,description:`For a picture slide: the picture, a clear illustration of its point, with the title as its only large text. Be concrete. For a step, show the action: hands, tools and the object. Leave it out for an HTML slide.`},html:{type:`string`,description:ae},mode:{type:`string`,enum:[`presentation`,`steps`],description:`"presentation" (the default) goes on by itself; "steps" is a how-to the user does along with you, and waits for them after each step. Keep it the same for every slide.`}},required:[`slide`,`totalSlides`,`title`]}};function T(e){let{totalPanels:t}=e;if(!b(t)||t<1||t>12)return`totalPanels must be a whole number from 1 to 12`;let n=[];for(let t of Array.isArray(e.characters)?e.characters:[]){let e=_(t)?v(t.name):``,r=_(t)?v(t.description):``;if(!e||!r)return`every character needs a name and a description`;if(n.some(t=>y(t.name,e)))return`two characters are named ${e}`;n.push({name:e,description:r})}return n.length<1||n.length>4?`a storyboard has 1 to 4 characters`:{title:v(e.title),style:v(e.style),totalPanels:t,characters:n,interactive:e.interactive===!0}}var E=({title:e,id:t})=>`The cast of "${e}" is now on the screen. Introduce the characters briefly, then, in this same reply and without waiting for the user, call presentPanel for panel 1 with storyboardId "${t}". If the user has asked you to stop, or asked something else, answer them instead of going on.`,D=`presentPanel needs a storyboardId, a panel number (from 1) and an imagePrompt`;function O(e){let{panel:t}=e,n=v(e.storyboardId),r=v(e.imagePrompt);if(!n||!r||!b(t)||t<1)return null;let i=e=>(Array.isArray(e)?e:[]).map(v).filter(Boolean);return{storyboardId:n,panel:t,characters:i(e.characters),imagePrompt:r,caption:v(e.caption),choices:i(e.choices).slice(0,3)}}function k(e,t,n){let{id:r,totalPanels:i}=e;return n.length?`Panel ${t} of ${i} is now on the screen, with the user's choices: ${n.map((e,t)=>`${t+1}. ${e}`).join(` `)} Tell this part of the story, then read the choices out and ask the user which one they pick, and wait for their answer. Then call presentPanel for panel ${t+1} with storyboardId "${r}", going on the way they chose.`:t<i?`Panel ${t} of ${i} is now on the screen. Tell this part of the story, then, in this same reply and without waiting for the user, call presentPanel for panel ${t+1} with storyboardId "${r}". If the user has asked you to stop, or asked something else, since the story began, answer them instead of going on.`:`Panel ${t} of ${i}, the last one, is now on the screen. Tell this part of the story, then bring it to an end.`}var A=`When the user asks for a story, a picture book, a comic or a storyboard, tell it in pictures: first call defineStoryboard with the art style and the characters who appear more than once (it draws a reference sheet for each, so they look the same in every panel), then show the panels one at a time with presentPanel, naming the characters in each, and tell each part of the story when its panel appears. Go on to the last panel without asking whether to continue, unless the story is interactive. When the user wants to decide what happens (an adventure, a story for a child who wants to choose), set interactive, and give two or three choices on two or three of the panels: the story waits there for the user's pick and goes on their way; it still ends at the last panel whichever way it goes. Use presentSlide to explain a topic, not to tell a story.`,j={type:`function`,name:m,prompt:A,description:`Start a story told in pictures: set its art style and draw a reference sheet for each recurring character, shown as the cast. Then call presentPanel for each panel, in order.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`The story's title.`},style:{type:`string`,description:`The art style of every picture, in one sentence (for example: soft watercolor, children's picture book).`},totalPanels:{type:`integer`,description:`How many panels the story has, at most 12; four to eight is usual.`},interactive:{type:`boolean`,description:`The user chooses what happens: panels can offer choices, and the story waits for the pick.`},characters:{type:`array`,description:`The characters who appear in more than one panel, 1 to 4.`,items:{type:`object`,properties:{name:{type:`string`,description:`A short name, used in presentPanel.`},description:{type:`string`,description:`How they look: age, build, face, hair, clothes and colors. Be concrete: it is drawn once and reused in every panel.`}},required:[`name`,`description`]}}},required:[`title`,`style`,`totalPanels`,`characters`]}},M={type:`function`,name:h,description:`Show one panel of a storyboard made with defineStoryboard: a picture of the scene with its characters drawn as in their reference sheets, and a caption. Call it once per panel, in order, starting with panel 1.`,parameters:{type:`object`,properties:{storyboardId:{type:`string`,description:`The storyboardId defineStoryboard returned.`},panel:{type:`integer`,description:`This panel's number, starting at 1.`},characters:{type:`array`,items:{type:`string`},description:`The names (as in defineStoryboard) of the characters in this panel.`},imagePrompt:{type:`string`,description:`What the panel shows: the setting, what happens, expressions and the camera angle. Refer to characters by name; don't describe their looks again.`},caption:{type:`string`,description:`One short line shown under the picture.`},choices:{type:`array`,items:{type:`string`},description:`Only in an interactive story, and not on the last panel: two or three short options for what happens next. The story waits for the user's pick.`}},required:[`storyboardId`,`panel`,`characters`,`imagePrompt`]}},N=e=>typeof e==`object`&&!!e&&!Array.isArray(e),oe=e=>N(e)&&typeof e.message==`string`;function P(e){let t=N(e?.data)?e.data:{};return{...typeof t.imageData==`string`&&{imageData:t.imageData},...typeof t.imagePath==`string`&&{imagePath:t.imagePath}}}function F(e){let t=N(e?.data)?e.data:{};return typeof t.html==`string`?t.html:``}var se=e=>!!P(e).imageData||!!F(e);function ce(e,t){let n=P(e),r=P(t);if(n.imagePath&&r.imagePath)return n.imagePath===r.imagePath;if(n.imageData)return n.imageData===r.imageData;let i=F(e);return!!i&&i===F(t)}var I=(e,t)=>e.userSpokeAt===void 0||e.userSpokeAt>t,L=()=>crypto.randomUUID().replace(/-/g,``).slice(0,12),le=`artifacts/`;async function R(e,t){let n=e.files?.artifacts;if(!e.app?.editImages||!n)return[];let r=[];for(let e of t)if(e.startsWith(le))try{await n.exists(e.slice(10))&&r.push(e)}catch{}return r}async function z(e,t,n=[]){let r=e.app,i=r?.editImages,a=r?.generateImage;try{let e;if(n.length&&i)e=await i(t,[...n]);else if(a)e=await a(t);else return{message:`image generation isn't available`};return oe(e)?e:{message:`image generation returned an unrecognized result`}}catch(e){return{message:`image generation failed: ${e instanceof Error?e.message:String(e)}`}}}var ue=50;function B(e){let t=new Map;return n=>{let r=n.conversationId??``,i=t.get(r);if(i===void 0?i=e():t.delete(r),t.set(r,i),t.size>ue){let e=t.keys().next().value;e!==void 0&&t.delete(e)}return i}}var V=`slideshows`,H=`storyboards`,U={},W=new WeakMap,G=new WeakMap;function K(e){let t=W.get(e);return t||W.set(e,t=new Map),t}function de(t,n){let r=G.get(t);r||G.set(t,r=new Map);let i=r.get(n);return i||r.set(n,i=(0,e.createSerialLock)()),i}var q=(e,t)=>`${e}/${t}.json`;async function J(e,t){let n=K(e??U),r=n.get(t);if(r)return r;if(!e)return null;try{let r=JSON.parse(await e.read(t));return n.set(t,r),r}catch{return null}}async function Y(e,t,n){return g.test(n)?J(e,q(t,n)):null}async function X(e,t,n,r){let i=q(t,n),a=e??U;return de(a,i)(async()=>{let t=r(await J(e,i));if(K(a).set(i,t),!e)return!1;try{return await e.write(i,JSON.stringify(t,null,2)),!0}catch(e){return console.warn(`[sequence] could not save`,i,e),!1}})}var Z=e=>`the ${e} could not be saved, so it lasts only until the app or server restarts`,fe=6e4;function pe(){let e=new Map;return{claim:t=>{let n=Date.now();for(let[t,r]of e)n-r.at>fe&&e.delete(t);let r=e.get(t);if(r)return{earlier:r.shown};let i=()=>void 0,a=new Promise(e=>i=e);return e.set(t,{at:n,shown:a}),{settle:n=>{!n&&e.get(t)?.shown===a&&e.delete(t),i(n)}}}}}function me({slide:e,totalSlides:t,mode:n}){return n===`steps`?{step:e,total:t,kind:`guide`,label:`Step ${e} of ${t}`,onShown:`explain it`,nextCall:`call presentSlide for step ${e+1} of ${t} with mode "steps"`,waitsForUser:!0}:{step:e,total:t,kind:`slideshow`,label:`Slide ${e} of ${t}`,onShown:`explain it`,nextCall:`call presentSlide for slide ${e+1} of ${t}`}}var he=(e,{slide:t,totalSlides:n,title:r,imagePrompt:i,html:a})=>JSON.stringify([e,t,n,r,i,a]),ge=B(()=>({latest:{presentation:null,steps:null},lastShown:null,repeats:pe()}));function _e(e,t){let n=e.latest[t.mode],r=n?.totalSlides===t.totalSlides&&(t.slide!==1||n.firstTitle===t.title);if(n&&r)return n;let i={id:L(),mode:t.mode,totalSlides:t.totalSlides,firstTitle:t.slide===1?t.title:``,slides:new Map,current:0,shownAt:-1/0};return e.latest[t.mode]=i,i}function ve(e,t,n,r){t.current=n.slide,t.shownAt=Date.now(),e.lastShown=t;let i=n.mode===`steps`?`step`:`slide`,{uuid:a,...o}=r;return{...o,message:`${i} ${n.slide} of ${n.totalSlides} is on the screen again, as it was`,instructions:S(n),instructionsRequired:!0,sequence:me(n)}}function ye(e,t){if(e.mode!==`steps`)return e.title?`A presentation slide titled "${e.title}". ${e.imagePrompt}`:e.imagePrompt;let n=e.title?`, "${e.title}"`:``;return[`An instructional illustration of step ${e.slide} of ${e.totalSlides}${n}. ${e.imagePrompt}`,t?`The reference image is the previous step: keep the same objects, hands, tools and setting, and show what this step changes.`:``,`Show the action clearly, with little or no text.`].filter(Boolean).join(` `)}async function be(e,t,n){if(n.html)return{html:n.html,prompt:``};let r=t.slides.get(n.slide-1),i=n.mode===`steps`?P(r).imagePath:void 0,a=i?await R(e,[i]):[],o=ye(n,a.length>0),s=await z(e,o,a),{imageData:c,imagePath:l}=P(s);return c?{imageData:c,...l&&{imagePath:l},prompt:o}:{failed:{...s,sequence:null}}}async function xe(e,t,n){let r=await be(e,t,n);if(`failed`in r)return r.failed;let{imageData:i,imagePath:a,html:o,prompt:s}=r,c=t.id,l=await X(e.files?.artifacts,V,c,e=>{let t=e??{id:c,title:``,mode:n.mode,totalSlides:n.totalSlides,slides:{}};return n.slide===1&&(t.title=n.title),t.slides[String(n.slide)]={title:n.title,imagePrompt:n.imagePrompt,...a&&{imagePath:a},...o&&{html:o}},t}),u={...i&&{imageData:i},...a&&{imagePath:a},...o&&{html:o},prompt:s,slideshowId:c,slide:n.slide,totalSlides:n.totalSlides,title:n.title,mode:n.mode},d=n.mode===`steps`?`step`:`slide`;return{data:u,title:n.title||`Slide ${n.slide}`,message:[`${d} ${n.slide} of ${n.totalSlides} of slideshow "${c}" is on the screen`,a?`saved to ${a}`:``,l?``:Z(`slideshow`)].filter(Boolean).join(`; `),instructions:S(n),instructionsRequired:!0,sequence:me(n)}}async function Q(e,t){let n=ie(t);if(typeof n==`string`)return{message:n,sequence:null};let r=ge(e),i=_e(r,n),a=n.mode===`steps`;if(a&&n.slide>i.current&&i.current>0&&!I(e,i.shownAt)){console.info(`[sequence] holding step ${n.slide} for the user`);let e=i.shownAt===1/0?`is still being drawn`:`is still on the screen`;return{message:`step ${n.slide} was not shown: the user hasn't said they're ready yet, and step ${i.current} ${e}. Wait for them before calling presentSlide for step ${n.slide}.`,cancelled:!0}}let o=a?i.slides.get(n.slide):void 0;if(o)return ce(e.currentResult,o)?{message:`step ${n.slide} of ${n.totalSlides} is already on the screen`,cancelled:!0}:ve(r,i,n,o);let s=r.repeats.claim(he(i.id,n));if(`earlier`in s){if(!await s.earlier)return Q(e,t);let a=i.slides.get(n.slide);return a&&r.lastShown!==i?ve(r,i,n,a):{message:`slide ${n.slide} of ${n.totalSlides} is already on the screen`,cancelled:!0}}let{settle:c}=s,l={current:i.current,shownAt:i.shownAt};i.current=n.slide,i.shownAt=1/0;let u=!1;try{let t=await xe(e,i,n);return u=se(t),u&&(i.slides.set(n.slide,t),i.current=n.slide,i.shownAt=Date.now(),r.lastShown=i),t}finally{c(u),!u&&i.current===n.slide&&(i.current=l.current,i.shownAt=l.shownAt)}}var Se=({id:e,title:t,totalPanels:n})=>({step:0,total:n,kind:`story`,label:`The cast of "${t}"`,onShown:`introduce the characters`,nextCall:`call presentPanel for panel 1 of ${n} with storyboardId "${e}"`}),Ce=({id:e,totalPanels:t},n,r)=>({step:n,total:t,kind:`story`,label:`Panel ${n} of ${t}`,onShown:`tell that part of the story`,nextCall:`call presentPanel for panel ${n+1} of ${t} with storyboardId "${e}"`,...r.length>0&&{waitsForUser:!0}}),we=(e,t)=>e?`${e}. ${t}`:t,Te=(e,{name:t,description:n})=>we(e,`Character reference sheet of ${t}: ${n}. Full body, front, side and back views, on a plain white background. No text or labels.`);async function Ee(e,t){let n=T(t);if(typeof n==`string`)return{message:n,sequence:null};let r=await Promise.all(n.characters.map(t=>z(e,Te(n.style,t)))),i=r.map(P),a=r.find((e,t)=>!i[t]?.imageData);if(i.every(({imageData:e})=>!e)&&a)return{...a,message:`the character sheets couldn't be made: ${a.message}`,sequence:null};let o={id:L(),...n,characters:n.characters.map((e,t)=>{let n=i[t]?.imagePath;return{...e,...n&&{imagePath:n}}}),panels:{}},s=await X(e.files?.artifacts,H,o.id,()=>o),c=o.characters.filter(e=>e.imagePath).map(e=>`${e.name}: ${e.imagePath}`),l=n.characters.map(({name:e},t)=>i[t]?.imageData?null:`${e} (${r[t]?.message??``})`).filter(e=>!!e),u=i.find(e=>e.imageData)?.imageData;return{data:{storyboardId:o.id,title:o.title,totalPanels:o.totalPanels,...u&&{imageData:u},characters:o.characters.map(({name:e,imagePath:t},n)=>{let r=i[n]?.imageData;return{name:e,...r&&{imageData:r},...t&&{imagePath:t}}})},title:o.title,message:[`storyboard "${o.id}" is ready with ${o.totalPanels} panels; the cast is on the screen`,c.length?`character sheets saved to ${c.join(`, `)}`:``,l.length?`no sheet for ${l.join(`; `)}: they will be drawn from their description`:``,s?``:Z(`storyboard`)].filter(Boolean).join(`; `),instructions:E(o),instructionsRequired:!0,sequence:Se(o)}}function De(e,t,n){let r=[we(e.style,`Panel ${t.panel} of ${e.totalPanels} of the illustrated story "${e.title}". ${t.imagePrompt}`)],i=0,a=n.map(({character:e,hasSheet:t})=>t?`${e.name} is the character in reference image ${++i}`:`${e.name}: ${e.description}`);return a.length&&r.push(`${a.join(`. `)}.`),i&&r.push(`Draw each character exactly as in their reference image: the same face, hair, clothes and colors. Use the reference images only for how the characters look, not for their pose or the background.`),r.push(`No captions, speech bubbles or other text in the picture.`),r.join(` `)}async function Oe(e,t,n){let r=[],i=[];for(let a of n.characters){let n=t.characters.find(e=>y(e.name,a));if(!n)r.push(a);else if(!i.some(e=>e.character===n)){let[t]=n.imagePath?await R(e,[n.imagePath]):[];i.push({character:n,sheet:t??null})}}let a=i.map(({sheet:e})=>e).filter(e=>!!e),o=De(t,n,i.map(({character:e,sheet:t})=>({character:e,hasSheet:!!t}))),s=await z(e,o,a),{imageData:c,imagePath:l}=P(s);if(!c)return{...s,sequence:null};let u=n.panel<t.totalPanels&&n.choices.length>=2?n.choices:[],d=await X(e.files?.artifacts,H,t.id,e=>{let r=e??t;return u.length&&(r.interactive=!0),r.panels[String(n.panel)]={caption:n.caption,characters:i.map(({character:e})=>e.name),imagePrompt:n.imagePrompt,...l&&{imagePath:l},...u.length&&{choices:u}},r});return{data:{imageData:c,...l&&{imagePath:l},prompt:o,storyboardId:t.id,panel:n.panel,totalPanels:t.totalPanels,caption:n.caption,...u.length&&{choices:u}},title:n.caption||`Panel ${n.panel}`,message:[`panel ${n.panel} of ${t.totalPanels} is on the screen`,l?`saved to ${l}`:``,r.length?`not in the cast, so drawn from the prompt alone: ${r.join(`, `)}`:``,d?``:Z(`storyboard`)].filter(Boolean).join(`; `),instructions:k(t,n.panel,u),instructionsRequired:!0,sequence:Ce(t,n.panel,u)}}var ke=B(()=>({repeats:pe(),awaitingChoice:new Map}));async function $(e,t){let n=O(t);if(!n)return{message:D,sequence:null};let{storyboardId:r,panel:i}=n,{repeats:a,awaitingChoice:o}=ke(e),s=o.get(r);if(s&&i>s.panel&&!I(e,s.shownAt))return console.info(`[sequence] holding panel ${i} for the user`),{message:s.shownAt===1/0?`panel ${i} was not shown: panel ${s.panel} is still being drawn. Wait for it before going on.`:`panel ${i} was not shown: the user hasn't picked a choice yet, and panel ${s.panel} is still on the screen. Wait for their answer.`,cancelled:!0};let c=a.claim(JSON.stringify(n));if(`earlier`in c)return await c.earlier?{message:`panel ${i} is already on the screen`,cancelled:!0}:$(e,t);let{settle:l}=c,u={panel:i,shownAt:1/0},d=o.get(r);o.set(r,u);let f=()=>o.get(r)===u,p=!1;try{let t=await Y(e.files?.artifacts,H,r);if(!t)return{message:`there is no storyboard "${r}"; call defineStoryboard first`,sequence:null};if(i>t.totalPanels)return{message:`storyboard "${t.id}" has ${t.totalPanels} panels`,sequence:null};let a=await Oe(e,t,n);p=!!P(a).imageData;let s=a.data;return p&&f()&&(s?.choices?.length?o.set(r,{panel:i,shownAt:Date.now()}):o.delete(r)),a}finally{l(p),!p&&f()&&(d?o.set(r,d):o.delete(r))}}var Ae={toolDefinition:w,generatingMessage:`Making the slide...`,isEnabled:()=>!0,execute:(e,t)=>Q(e,t)},je={toolDefinition:j,generatingMessage:`Drawing the characters...`,isEnabled:()=>!0,execute:(e,t)=>Ee(e,t)},Me={toolDefinition:M,generatingMessage:`Drawing the panel...`,isEnabled:()=>!0,execute:(e,t)=>$(e,t)};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return x}});