@gui-chat-plugin/mulmocast 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/samples-BABMT6Qw.cjs +1 -0
- package/dist/{samples-SOf0ey-s.js → samples-Pl6MPtJB.js} +22 -27
- package/dist/style.css +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +1 -1
- package/package.json +12 -12
- package/dist/samples-Dp1dUlUh.cjs +0 -1
package/README.md
CHANGED
|
@@ -121,3 +121,8 @@ Try these prompts to test the plugin:
|
|
|
121
121
|
## License
|
|
122
122
|
|
|
123
123
|
MIT
|
|
124
|
+
|
|
125
|
+
## Related
|
|
126
|
+
|
|
127
|
+
- Protocol spec: [gui-chat-protocol](https://github.com/receptron/gui-chat-protocol)
|
|
128
|
+
- Reference implementations using this protocol: [mulmoclaude](https://github.com/receptron/mulmoclaude) · [MulmoChat](https://github.com/receptron/MulmoChat)
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./samples-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./samples-BABMT6Qw.cjs`);exports.TOOL_DEFINITION=e.o,exports.TOOL_NAME=e.s,exports.executeMulmocast=e.n,exports.pluginCore=e.r,exports.samples=e.t,exports.showPresentation=e.i;
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e, n as t, o as n, r, s as i, t as a } from "./samples-
|
|
1
|
+
import { i as e, n as t, o as n, r, s as i, t as a } from "./samples-Pl6MPtJB.js";
|
|
2
2
|
export { n as TOOL_DEFINITION, i as TOOL_NAME, t as executeMulmocast, r as pluginCore, a as samples, e as showPresentation };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./samples-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./samples-BABMT6Qw.cjs`);require(`./core.cjs`),exports.TOOL_DEFINITION=e.o,exports.TOOL_NAME=e.s,exports.executeMulmocast=e.n,exports.pluginCore=e.r,exports.samples=e.t,exports.showPresentation=e.i;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as e, n as t, o as n, r, s as i, t as a } from "./samples-
|
|
1
|
+
import { i as e, n as t, o as n, r, s as i, t as a } from "./samples-Pl6MPtJB.js";
|
|
2
2
|
import "./core.js";
|
|
3
3
|
export { n as TOOL_DEFINITION, i as TOOL_NAME, t as executeMulmocast, r as pluginCore, a as samples, e as showPresentation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`showPresentation`,t={type:`function`,name:e,description:`Let MulmoCast to process a given MulmoScript to generate a presentation of a given topic or story.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`The title of the presentation`},lang:{type:`string`,description:`The language of the presentation, such as en, ja, etc.`},beats:{type:`array`,items:{type:`object`,properties:{text:{type:`string`,description:`The text to be spoken by the presenter, which is also used to generate an image if there is no imagePrompt. Typically 50 to 70 words.`},imagePrompt:{type:`string`,description:`Optional prompt to be used to generate an image. Typically 50 to 70 words. Do not specify the image style.`}},required:[`text`],additionalProperties:!1},minItems:1}},required:[`title`,`lang`,`beats`],additionalProperties:!1}},n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));function r(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+`-`+n[e[t+4]]+n[e[t+5]]+`-`+n[e[t+6]]+n[e[t+7]]+`-`+n[e[t+8]]+n[e[t+9]]+`-`+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}var i=new Uint8Array(16);function a(){return crypto.getRandomValues(i)}function o(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():s(e,t,n)}function s(e,t,n){e||={};let i=e.random??e.rng?.()??a();if(i.length<16)throw Error(`Random bytes length must be >= 16`);if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=i[e];return t}return r(i)}var c=async(e,t)=>{let{title:n,beats:r}=t,i=e.app?.loadBlankImageBase64?await e.app.loadBlankImageBase64():``,a=i?[i]:[],s=r.map(e=>({id:o(),speaker:`Presenter`,text:e.text,imagePrompt:e.imagePrompt})),c={};if(e.app?.generateImageWithBackend){let t=s.map(async t=>{let n=t.imagePrompt||`generate image appropriate for the text. <text>${t.text}</text>. Let the art convey the story and emotions without text. Use the last image for the aspect ratio.`;try{let r=await e.app.generateImageWithBackend(n,a,e);if(r.success&&r.imageData)return{id:t.id,imageData:r.imageData}}catch(e){console.error(`Failed to generate image for beat:`,e)}return{id:t.id,imageData:null}});(await Promise.all(t)).forEach(e=>{e.imageData&&(c[e.id]=e.imageData)})}let l={$mulmocast:{version:`1.1`},canvasSize:{width:1536,height:1080},imageParams:{provider:`google`,model:`gemini-2.5-flash-image-preview`},audioParams:{padding:.2,introPadding:.5,closingPadding:.5,outroPadding:.5,bgmVolume:.1,audioVolume:1.5,suppressSpeech:!1},soundEffectParams:{},speechParams:{speakers:{Presenter:{voiceId:`shimmer`}}},title:n,lang:t.lang,beats:s};return{message:`Mulmocast has processed the MulmoScript for "${n}" with ${r.length} beats. Movie generation will begin automatically.`,title:n,instructions:`Acknowledge that all the images were successfully generated and that the movie is being generated.`,data:{mulmoScript:l,images:c}}},l={toolDefinition:t,execute:c,generatingMessage:`Processing with Mulmocast...`,waitingMessage:`Tell the user that the script was written and we are generating images and video with Mulmocast.`,isEnabled:()=>!0,backends:[`imageGen`,`mulmocast`]},u=c,d=[{name:`Simple Presentation`,args:{title:`Introduction to AI`,lang:`en`,beats:[{text:`Artificial Intelligence is transforming the way we live and work. From voice assistants to self-driving cars, AI is becoming an integral part of our daily lives.`,imagePrompt:`A futuristic city with AI-powered robots and flying vehicles`},{text:`Machine learning, a subset of AI, enables computers to learn from data without being explicitly programmed. This technology powers recommendation systems and fraud detection.`}]}}];Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return d}});
|
|
@@ -48,20 +48,18 @@ function r(e, t = 0) {
|
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region node_modules/uuid/dist/rng.js
|
|
51
|
-
var i
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
if (typeof crypto > "u" || !crypto.getRandomValues) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
55
|
-
i = crypto.getRandomValues.bind(crypto);
|
|
56
|
-
}
|
|
57
|
-
return i(a);
|
|
51
|
+
var i = new Uint8Array(16);
|
|
52
|
+
function a() {
|
|
53
|
+
return crypto.getRandomValues(i);
|
|
58
54
|
}
|
|
59
|
-
var s = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
|
|
60
55
|
//#endregion
|
|
61
56
|
//#region node_modules/uuid/dist/v4.js
|
|
62
|
-
function
|
|
57
|
+
function o(e, t, n) {
|
|
58
|
+
return !t && !e && crypto.randomUUID ? crypto.randomUUID() : s(e, t, n);
|
|
59
|
+
}
|
|
60
|
+
function s(e, t, n) {
|
|
63
61
|
e ||= {};
|
|
64
|
-
let i = e.random ?? e.rng?.() ??
|
|
62
|
+
let i = e.random ?? e.rng?.() ?? a();
|
|
65
63
|
if (i.length < 16) throw Error("Random bytes length must be >= 16");
|
|
66
64
|
if (i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, t) {
|
|
67
65
|
if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`);
|
|
@@ -70,20 +68,17 @@ function c(e, t, n) {
|
|
|
70
68
|
}
|
|
71
69
|
return r(i);
|
|
72
70
|
}
|
|
73
|
-
function l(e, t, n) {
|
|
74
|
-
return s.randomUUID && !t && !e ? s.randomUUID() : c(e, t, n);
|
|
75
|
-
}
|
|
76
71
|
//#endregion
|
|
77
72
|
//#region src/core/plugin.ts
|
|
78
|
-
var
|
|
79
|
-
let { title: n, beats: r } = t, i = e.app?.loadBlankImageBase64 ? await e.app.loadBlankImageBase64() : "", a = i ? [i] : [],
|
|
80
|
-
id:
|
|
73
|
+
var c = async (e, t) => {
|
|
74
|
+
let { title: n, beats: r } = t, i = e.app?.loadBlankImageBase64 ? await e.app.loadBlankImageBase64() : "", a = i ? [i] : [], s = r.map((e) => ({
|
|
75
|
+
id: o(),
|
|
81
76
|
speaker: "Presenter",
|
|
82
77
|
text: e.text,
|
|
83
78
|
imagePrompt: e.imagePrompt
|
|
84
|
-
})),
|
|
79
|
+
})), c = {};
|
|
85
80
|
if (e.app?.generateImageWithBackend) {
|
|
86
|
-
let t =
|
|
81
|
+
let t = s.map(async (t) => {
|
|
87
82
|
let n = t.imagePrompt || `generate image appropriate for the text. <text>${t.text}</text>. Let the art convey the story and emotions without text. Use the last image for the aspect ratio.`;
|
|
88
83
|
try {
|
|
89
84
|
let r = await e.app.generateImageWithBackend(n, a, e);
|
|
@@ -100,10 +95,10 @@ var u = async (e, t) => {
|
|
|
100
95
|
};
|
|
101
96
|
});
|
|
102
97
|
(await Promise.all(t)).forEach((e) => {
|
|
103
|
-
e.imageData && (
|
|
98
|
+
e.imageData && (c[e.id] = e.imageData);
|
|
104
99
|
});
|
|
105
100
|
}
|
|
106
|
-
let
|
|
101
|
+
let l = {
|
|
107
102
|
$mulmocast: { version: "1.1" },
|
|
108
103
|
canvasSize: {
|
|
109
104
|
width: 1536,
|
|
@@ -126,25 +121,25 @@ var u = async (e, t) => {
|
|
|
126
121
|
speechParams: { speakers: { Presenter: { voiceId: "shimmer" } } },
|
|
127
122
|
title: n,
|
|
128
123
|
lang: t.lang,
|
|
129
|
-
beats:
|
|
124
|
+
beats: s
|
|
130
125
|
};
|
|
131
126
|
return {
|
|
132
127
|
message: `Mulmocast has processed the MulmoScript for "${n}" with ${r.length} beats. Movie generation will begin automatically.`,
|
|
133
128
|
title: n,
|
|
134
129
|
instructions: "Acknowledge that all the images were successfully generated and that the movie is being generated.",
|
|
135
130
|
data: {
|
|
136
|
-
mulmoScript:
|
|
137
|
-
images:
|
|
131
|
+
mulmoScript: l,
|
|
132
|
+
images: c
|
|
138
133
|
}
|
|
139
134
|
};
|
|
140
|
-
},
|
|
135
|
+
}, l = {
|
|
141
136
|
toolDefinition: t,
|
|
142
|
-
execute:
|
|
137
|
+
execute: c,
|
|
143
138
|
generatingMessage: "Processing with Mulmocast...",
|
|
144
139
|
waitingMessage: "Tell the user that the script was written and we are generating images and video with Mulmocast.",
|
|
145
140
|
isEnabled: () => !0,
|
|
146
141
|
backends: ["imageGen", "mulmocast"]
|
|
147
|
-
},
|
|
142
|
+
}, u = c, d = [{
|
|
148
143
|
name: "Simple Presentation",
|
|
149
144
|
args: {
|
|
150
145
|
title: "Introduction to AI",
|
|
@@ -156,4 +151,4 @@ var u = async (e, t) => {
|
|
|
156
151
|
}
|
|
157
152
|
}];
|
|
158
153
|
//#endregion
|
|
159
|
-
export {
|
|
154
|
+
export { o as a, c as i, u as n, t as o, l as r, e as s, d as t };
|
package/dist/style.css
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! tailwindcss v4.
|
|
1
|
+
/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
2
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-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-outline-style:solid}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, 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-red-600:oklch(57.7% .245 27.325);--color-green-100:oklch(96.2% .044 156.743);--color-green-600:oklch(62.7% .194 149.214);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-800:oklch(43.2% .095 166.913);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--radius-md:.375rem;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--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,ui-sans-serif, system-ui, 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{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{.relative{position:relative}.m-0{margin:calc(var(--spacing) * 0)}.mx-auto{margin-inline:auto}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.block{display:block}.contents{display:contents}.flex{display:flex}.aspect-video{aspect-ratio:var(--aspect-video)}.h-full{height:100%}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.flex-shrink{flex-shrink: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)}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-y{resize:vertical}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-green-100{background-color:var(--color-green-100)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-white{background-color:var(--color-white)}.object-cover{object-fit:cover}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.font-mono{font-family:var(--font-mono)}.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))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.whitespace-pre-wrap{white-space:pre-wrap}.text-emerald-800{color:var(--color-emerald-800)}.text-gray-600{color:var(--color-gray-600)}.text-gray-800{color:var(--color-gray-800)}.text-green-600{color:var(--color-green-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px 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)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.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))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.hover\:border-indigo-300:hover{border-color:var(--color-indigo-300)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-\[3px\]:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-indigo-500\/10:focus{--tw-ring-color:#625fff1a}@supports (color:color-mix(in lab, red, red)){.focus\:ring-indigo-500\/10:focus{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 10%, transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}}@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-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-outline-style{syntax:"*";inherits:false;initial-value:solid}@keyframes spin{to{transform:rotate(360deg)}}.mulmocast-container[data-v-0070ab10]{background:#fff;flex-direction:column;width:100%;height:100%;display:flex}.mulmocast-content-wrapper[data-v-0070ab10]{flex:1;min-height:0;overflow-y:auto}.header-row[data-v-0070ab10]{justify-content:space-between;align-items:center;margin-bottom:1em;display:flex}.document-title[data-v-0070ab10]{margin:0;font-size:2em}.button-group[data-v-0070ab10]{gap:.5em;display:flex}.download-btn[data-v-0070ab10]{color:#fff;cursor:pointer;border:none;border-radius:4px;align-items:center;gap:.5em;padding:.5em 1em;font-size:.9em;display:flex}.download-btn-green[data-v-0070ab10]{background-color:#4caf50}.download-btn-orange[data-v-0070ab10]{background-color:#ff9800}.download-btn-blue[data-v-0070ab10]{background-color:#2196f3}.download-btn-disabled[data-v-0070ab10]{cursor:not-allowed;background-color:#ccc}.download-btn .material-icons[data-v-0070ab10]{font-size:1.2em}.beat-container[data-v-0070ab10]{margin-bottom:1em}.error-message[data-v-0070ab10]{color:#c62828;background:#ffebee;border-radius:4px;margin:1em 0;padding:1em}.viewer-container[data-v-0070ab10]{margin:1em 0;position:relative}.video-player[data-v-0070ab10],.beat-image[data-v-0070ab10]{max-width:100%;margin:1em 0}.beat-text[data-v-0070ab10]{margin-bottom:1em}.script-source[data-v-0070ab10]{background:#f5f5f5;border-top:1px solid #e0e0e0;flex-shrink:0;padding:.5rem;font-family:monospace;font-size:.85rem}.script-source summary[data-v-0070ab10]{cursor:pointer;-webkit-user-select:none;user-select:none;color:#333;background:#e8e8e8;border-radius:4px;padding:.5rem;font-weight:500}.script-source[open] summary[data-v-0070ab10]{margin-bottom:.5rem}.script-source summary[data-v-0070ab10]:hover{background:#d8d8d8}.error[data-v-0070ab10]{color:#f66;background:#ff000020;border-radius:4px;margin-bottom:.5rem;padding:.5rem;font-family:monospace}.script-editor[data-v-0070ab10]{color:#333;resize:vertical;background:#fff;border:1px solid #ccc;border-radius:4px;width:100%;height:40vh;margin-bottom:.5rem;padding:1rem;font-family:Courier New,monospace;font-size:.9rem;line-height:1.5}.script-editor[data-v-0070ab10]:focus{border-color:#4caf50;outline:none;box-shadow:0 0 0 2px #4caf501a}.apply-btn[data-v-0070ab10]{color:#fff;cursor:pointer;background:#4caf50;border:none;border-radius:4px;padding:.5rem 1rem;font-size:.9rem;font-weight:500;transition:background .2s}.apply-btn[data-v-0070ab10]:hover{background:#45a049}.apply-btn[data-v-0070ab10]:active{background:#3d8b40}.apply-btn[data-v-0070ab10]:disabled{color:#666;cursor:not-allowed;opacity:.6;background:#ccc}.apply-btn[data-v-0070ab10]:disabled:hover{background:#ccc}@keyframes spin-0070ab10{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin[data-v-0070ab10]{animation:1s linear infinite spin-0070ab10}.nav-button[data-v-0070ab10]{color:#fff;cursor:pointer;z-index:10;-webkit-user-select:none;user-select:none;background:#00000080;border:none;border-radius:50%;justify-content:center;align-items:center;width:48px;height:48px;font-size:32px;line-height:1;transition:all .2s;display:flex;position:absolute;top:50%;transform:translateY(-50%)}.nav-button[data-v-0070ab10]:hover{background:#000000b3;transform:translateY(-50%)scale(1.1)}.nav-button[data-v-0070ab10]:active{transform:translateY(-50%)scale(.95)}.nav-button-prev[data-v-0070ab10]{left:0}.nav-button-next[data-v-0070ab10]{right:0}
|
|
3
3
|
/*$vite$:1*/
|
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./samples-Dp1dUlUh.cjs`);let t=require(`vue`);var n={video:`16/9`,square:`1/1`},r=/^(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)$/,i=e=>{let t=r.exec(e);return t?Number(t[1])>0&&Number(t[2])>0:!1},a=e=>{if(!e)return;let t=n[e];if(t)return t;if(i(e))return e},o=async e=>await new Promise(t=>setTimeout(t,e)),s=(e,t)=>{let n=e=>e instanceof Error?e:Error(`Aborted`);return new Promise((r,i)=>{if(t.aborted){i(n(t.reason));return}let a=()=>{clearTimeout(o),i(n(t.reason))},o=setTimeout(()=>{t.removeEventListener(`abort`,a),r()},e);t.addEventListener(`abort`,a,{once:!0})})},c=1,l=.5,u=.5,d=.2,f=(e,t)=>e>t+c,p=e=>{if(!e||e.ended||isNaN(e.duration)||e.duration<=0)return!0;let t=Math.min(l,e.duration/2);return e.currentTime>=e.duration-t},m=e=>e.soundEffectSource?1:e.videoSource&&e.audioSource&&e.currentLang&&e.defaultLang&&e.currentLang!==e.defaultLang?d:0,h=(e,t,n)=>{if(isNaN(e)||isNaN(t)||isNaN(n))return null;let r=Math.min(e,n);return Math.abs(t-r)>u?r:null},g=(e,t,n)=>e?!1:n?t:!0,_=(e,t)=>e?!1:p(t),v=e=>!(e.isStopping||e.videoEnded&&e.audioExists&&!e.audioEnded),y={class:`items-center justify-center w-full`},b={key:0,class:`group relative`},x=[`src`],S={class:`play-overlay absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none`},C={key:0,class:`w-8 h-8 text-white ml-1`,fill:`currentColor`,viewBox:`0 0 24 24`},w={key:1,class:`w-8 h-8 text-white`,fill:`currentColor`,viewBox:`0 0 24 24`},T={key:1,class:`group relative inline-block`},E=[`src`,`controls`],D=[`src`],O={class:`play-overlay absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none`},k={key:0,class:`w-8 h-8 text-white ml-1`,fill:`currentColor`,viewBox:`0 0 24 24`},ee={key:1,class:`w-8 h-8 text-white`,fill:`currentColor`,viewBox:`0 0 24 24`},te={key:2,class:`group relative inline-block`},ne=[`src`],re=[`src`],ie={class:`play-overlay absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none`},ae={key:0,class:`w-8 h-8 text-white ml-1`,fill:`currentColor`,viewBox:`0 0 24 24`},oe={key:1,class:`w-8 h-8 text-white`,fill:`currentColor`,viewBox:`0 0 24 24`},se={key:3,class:`group relative inline-block`},ce=[`src`],le={class:`play-overlay absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none`},ue={key:0,class:`w-8 h-8 text-white ml-1`,fill:`currentColor`,viewBox:`0 0 24 24`},de={key:1,class:`w-8 h-8 text-white`,fill:`currentColor`,viewBox:`0 0 24 24`},fe={key:4},pe={key:0,class:`mt-4 px-6 py-4 text-left`},me={class:`text-lg leading-relaxed font-sans text-gray-800`},he={key:0,class:`text-base leading-relaxed font-sans text-gray-400 mt-3 italic`},ge=`https://github.com/receptron/mulmocast-cli/blob/main/assets/images/mulmocast_credit.png?raw=true`,A=(0,t.defineComponent)({__name:`mulmo_player`,props:{index:{},videoWithAudioSource:{default:void 0},soundEffectSource:{default:void 0},videoSource:{default:void 0},imageSource:{default:void 0},audioSource:{default:void 0},text:{default:void 0},originalText:{default:void 0},duration:{default:void 0},defaultLang:{default:void 0},currentLang:{default:void 0},playbackSpeed:{default:1},mediaAspectRatio:{default:void 0}},emits:[`play`,`pause`,`ended`],setup(e,{expose:n,emit:r}){let i=(0,t.computed)(()=>{let e=a(o.mediaAspectRatio);return e?{aspectRatio:e}:{}}),o=e,c=r,l=(0,t.ref)(),u=(0,t.ref)(),d=(0,t.ref)(),p=(0,t.ref)(),A=(0,t.ref)(!1),j=()=>{u.value&&d.value&&!isNaN(u.value.duration)&&!isNaN(d.value.duration)&&(A.value=f(d.value.duration,u.value.duration))},M=()=>{u.value&&(u.value.volume=m({soundEffectSource:o.soundEffectSource,videoSource:o.videoSource,audioSource:o.audioSource,currentLang:o.currentLang,defaultLang:o.defaultLang}))},N=()=>{let e=o.playbackSpeed??1;l.value&&(l.value.playbackRate=e),u.value&&(u.value.playbackRate=e),d.value&&(d.value.playbackRate=e),p.value&&(p.value.playbackRate=e)};(0,t.watch)([()=>o.currentLang,()=>o.defaultLang,()=>o.videoSource,()=>o.audioSource],()=>{M()}),(0,t.watch)(()=>o.playbackSpeed,()=>{N()}),(0,t.watch)(u,e=>{e&&(M(),N())}),(0,t.watch)([l,d,p],()=>{N()}),(0,t.onMounted)(()=>{M(),N()});let P=(0,t.ref)(!1),F=(0,t.ref)(!1),I=(0,t.computed)(()=>K.value||F.value),L=null,R=()=>{L&&=(L.abort(),null)},z=()=>{K.value=!0,d.value&&u.value&&!d.value.ended&&(d.value.currentTime=u.value.currentTime,d.value.play().catch(()=>{})),c(`play`)},B=e=>{v({isStopping:F.value,videoEnded:u.value?.ended??!1,audioExists:!!d.value,audioEnded:d.value?.ended??!0})&&(document.hidden||(K.value=!1),!u.value?.ended&&d?.value&&d.value?.pause(),U(e))},V=()=>{g(P.value,d.value?.ended??!0,!!d.value)&&W()},_e=()=>{let e=u.value?{ended:u.value.ended,duration:u.value.duration,currentTime:u.value.currentTime}:null;_(P.value,e)&&W()},ve=()=>{if(!u.value||!d.value)return;let e=h(d.value.currentTime,u.value.currentTime,u.value.duration);e!==null&&(u.value.currentTime=e)},ye=()=>{K.value=!0,u.value&&!u.value.ended&&u.value.play().catch(()=>{}),c(`play`)},be=()=>{F.value||d.value?.ended||(document.hidden||(K.value=!1),u.value&&!u.value.ended&&u.value.pause(),c(`pause`))},H=()=>{K.value=!0,c(`play`)},U=e=>{if(F.value)return;document.hidden||(K.value=!1);let t=e.target;t.duration!==t.currentTime&&c(`pause`)},W=()=>{P.value||(P.value=!0,K.value=!1,c(`ended`))},G=()=>{l.value?.pause(),u.value?.pause(),d.value?.pause(),p.value?.pause()},K=(0,t.ref)(!1),q=null,J=async()=>{if(F.value=!1,P.value=!1,K.value=!0,l.value&&(N(),l.value.play().catch(()=>{})),u.value&&(M(),N(),u.value.play().catch(()=>{}),d.value&&(d.value.currentTime=u.value.currentTime,d.value.play().catch(()=>{}))),p.value&&(N(),p.value.play().catch(()=>{})),!l.value&&!u.value&&!p.value)try{R(),L=new AbortController,await s((o.duration??0)*1e3,L.signal),L=null,P.value||(K.value=!1,P.value=!0,c(`ended`))}catch{}},xe=()=>{F.value=!0,K.value=!1,P.value=!0,R(),l.value?.pause(),u.value?.pause(),d.value?.pause(),p.value?.pause()},Se=()=>{if(!d.value||!u.value||d.value.ended)return;let e=h(u.value.currentTime,d.value.currentTime,d.value.duration);e!==null&&(d.value.currentTime=e)},Y=e=>{e?.paused&&!e.ended&&e.play().catch(()=>{})},Ce=(e,t)=>{t.paused&&!t.ended&&(e.ended||(t.currentTime=e.currentTime),t.play().catch(()=>{}))},X=()=>{K.value&&(Y(l.value),u.value&&d.value?(Y(u.value),Ce(u.value,d.value)):Y(u.value),Y(p.value))},Z=()=>{document.hidden&&K.value?q||=setInterval(X,500):document.hidden||(q&&=(clearInterval(q),null))},Q=()=>{document.hidden&&K.value&&setTimeout(X,50)};return(0,t.onMounted)(()=>{document.addEventListener(`visibilitychange`,Z),l.value?.addEventListener(`pause`,Q),u.value?.addEventListener(`pause`,Q),p.value?.addEventListener(`pause`,Q),d.value?.addEventListener(`pause`,Q)}),(0,t.onUnmounted)(()=>{document.removeEventListener(`visibilitychange`,Z),l.value?.removeEventListener(`pause`,Q),u.value?.removeEventListener(`pause`,Q),p.value?.removeEventListener(`pause`,Q),d.value?.removeEventListener(`pause`,Q),q&&=(clearInterval(q),null),R()}),n({play:J,stop:xe}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,y,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`w-full flex items-center justify-center overflow-hidden`,{"[&>*]:w-full [&>*]:h-full":e.mediaAspectRatio}]),style:(0,t.normalizeStyle)(i.value)},[e.videoWithAudioSource?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,b,[(0,t.createElementVNode)(`video`,{ref_key:`videoWithAudioRef`,ref:l,src:e.videoWithAudioSource,class:`mulmocast-video mx-auto h-auto max-h-[80vh] w-auto object-contain`,controls:!0,playsinline:`true`,onPlay:H,onPause:U,onEnded:W},null,40,x),(0,t.createElementVNode)(`div`,S,[(0,t.createElementVNode)(`button`,{class:`pointer-events-auto w-16 h-16 bg-black/50 hover:bg-black/70 rounded-full flex items-center justify-center transition-colors cursor-pointer`,onClick:r[0]||=e=>I.value?G():J()},[I.value?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,w,[...r[5]||=[(0,t.createElementVNode)(`path`,{d:`M6 19h4V5H6v14zm8-14v14h4V5h-4z`},null,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,C,[...r[4]||=[(0,t.createElementVNode)(`path`,{d:`M8 5v14l11-7z`},null,-1)]]))])])])):e.soundEffectSource||e.videoSource?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,T,[(0,t.createElementVNode)(`video`,{ref_key:`videoRef`,ref:u,class:`mulmocast-video mx-auto h-auto max-h-[80vh] w-auto object-contain`,src:e.soundEffectSource||e.videoSource,controls:!A.value,playsinline:`true`,onPlay:z,onPause:B,onEnded:V,onSeeked:Se,onLoadedmetadata:j},null,40,E),e.audioSource?((0,t.openBlock)(),(0,t.createElementBlock)(`audio`,{key:0,ref_key:`audioSyncRef`,ref:d,src:e.audioSource,controls:!0,class:(0,t.normalizeClass)(A.value?`mulmocast-audio absolute bottom-0 left-0 w-full`:`hidden`),onEnded:_e,onSeeked:ve,onPlay:ye,onPause:be,onLoadedmetadata:j},null,42,D)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,O,[(0,t.createElementVNode)(`button`,{class:`pointer-events-auto w-16 h-16 bg-black/50 hover:bg-black/70 rounded-full flex items-center justify-center transition-colors cursor-pointer`,onClick:r[1]||=e=>I.value?G():J()},[I.value?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,ee,[...r[7]||=[(0,t.createElementVNode)(`path`,{d:`M6 19h4V5H6v14zm8-14v14h4V5h-4z`},null,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,k,[...r[6]||=[(0,t.createElementVNode)(`path`,{d:`M8 5v14l11-7z`},null,-1)]]))])])])):e.audioSource?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,te,[e.imageSource?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:0,src:e.imageSource,class:`mx-auto h-auto max-h-[80vh] w-auto object-contain`,alt:`Background`},null,8,ne)):((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:1,src:ge,class:`mx-auto h-auto max-h-[80vh] w-auto object-contain`,alt:`Background`})),(0,t.createElementVNode)(`audio`,{ref_key:`audioRef`,ref:p,class:`mulmocast-audio absolute inset-0 w-full h-full`,src:e.audioSource,controls:!0,onPlay:H,onPause:U,onEnded:W},null,40,re),(0,t.createElementVNode)(`div`,ie,[(0,t.createElementVNode)(`button`,{class:`pointer-events-auto w-16 h-16 bg-black/50 hover:bg-black/70 rounded-full flex items-center justify-center transition-colors cursor-pointer`,onClick:r[2]||=e=>I.value?G():J()},[I.value?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,oe,[...r[9]||=[(0,t.createElementVNode)(`path`,{d:`M6 19h4V5H6v14zm8-14v14h4V5h-4z`},null,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,ae,[...r[8]||=[(0,t.createElementVNode)(`path`,{d:`M8 5v14l11-7z`},null,-1)]]))])])])):e.imageSource?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,se,[(0,t.createElementVNode)(`img`,{src:e.imageSource,class:`max-w-full max-h-full object-contain`},null,8,ce),(0,t.createElementVNode)(`div`,le,[(0,t.createElementVNode)(`button`,{class:`pointer-events-auto w-16 h-16 bg-black/50 hover:bg-black/70 rounded-full flex items-center justify-center transition-colors cursor-pointer`,onClick:r[3]||=e=>I.value?G():J()},[I.value?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,de,[...r[11]||=[(0,t.createElementVNode)(`path`,{d:`M6 19h4V5H6v14zm8-14v14h4V5h-4z`},null,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,ue,[...r[10]||=[(0,t.createElementVNode)(`path`,{d:`M8 5v14l11-7z`},null,-1)]]))])])])):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,fe,`No media available`))],6),e.text?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,pe,[(0,t.createElementVNode)(`p`,me,(0,t.toDisplayString)(e.text),1),e.originalText&&e.originalText!==e.text?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,he,(0,t.toDisplayString)(e.originalText),1)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0)]))}}),j=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},M=j(A,[[`__scopeId`,`data-v-0e76dd6a`]]),N=[`value`],P=[`value`],F=(0,t.defineComponent)({__name:`select_language`,props:{modelValue:{}},emits:[`update:modelValue`],setup(e,{emit:n}){let r=[`en`,`ja`],i={en:`English`,ja:`日本語`},a=n,o=e=>{let t=e.target;a(`update:modelValue`,t.value)};return(n,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`select`,{value:e.modelValue,class:`px-4 py-2 bg-white border-2 border-gray-300 rounded-lg shadow-sm hover:border-indigo-400 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-200 focus:outline-none transition-colors cursor-pointer text-base font-medium text-gray-700`,onChange:o},[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r,e=>(0,t.createElementVNode)(`option`,{key:e,value:e},(0,t.toDisplayString)(i[e]||e),9,P)),64))],40,N))}}),I={class:`w-full overflow-hidden`},L={class:`max-w-7xl mx-auto px-4`},R={class:`grid grid-cols-[auto,1fr,auto] gap-x-4 gap-y-4 max-sm:grid-cols-2`},z=[`disabled`],B={class:`col-start-2 row-start-1 min-w-0 max-sm:col-span-2 max-sm:col-start-1`},V=[`disabled`],_e={key:0,class:`mulmo-text-box col-start-2 row-start-2 min-w-0 mt-1 rounded-lg px-6 py-4 text-left max-sm:col-span-2 max-sm:col-start-1 max-sm:row-start-3`},ve={class:`mulmo-text-primary text-lg leading-relaxed font-sans`},ye={key:0,class:`mulmo-text-secondary text-base leading-relaxed font-sans mt-3 italic`},be=[`src`],H=j((0,t.defineComponent)({__name:`mulmo_viewer`,props:{dataSet:{default:void 0},basePath:{},initPage:{default:void 0},audioLang:{default:`en`},textLang:{default:`en`},playbackSpeed:{default:1},mediaAspectRatio:{default:void 0}},emits:[`updatedPage`,`update:audioLang`,`update:textLang`,`allCompleted`],setup(e,{expose:n,emit:r}){let i=e,a=r,s=i.dataSet?.beats?.length??0,c=(0,t.ref)(i.initPage??0),l=(0,t.ref)(!0),u=(0,t.ref)(),d=(0,t.ref)(),f=(0,t.computed)({get:()=>i.audioLang,set:e=>a(`update:audioLang`,e||`en`)}),p=(0,t.computed)({get:()=>i.textLang,set:e=>a(`update:textLang`,e||`en`)}),m=0;(0,t.watch)(()=>i.audioLang,async(e,t)=>{if(e!==t&&v.value){m++;let e=m;if(u.value?.stop(),await o(500),e!==m)return;u.value&&(v.value=!0,await u.value.play())}}),(0,t.watch)(()=>i.textLang,async(e,t)=>{e!==t&&v.value&&(await o(100),u.value&&await u.value.play())}),(0,t.watch)(d,e=>{e&&(e.volume=.3)});let h=(0,t.computed)(()=>i.dataSet?.beats[c.value]),g=e=>e?i.basePath+`/`+e:``,_=(0,t.computed)(()=>g(i.dataSet?.bgmSource)),v=(0,t.ref)(!1),y=()=>{v.value=!0,d.value&&(d.value.volume=.3,d.value.play())},b=()=>{v.value=!1,d.value&&d.value.pause()},x=async()=>{m++;let e=m;u.value?.stop(),await o(500),e===m&&u.value&&u.value.play()},S=e=>{c.value!==e&&(c.value=e,v.value&&l.value&&x())},C=e=>{let t=c.value+e;return t>-1&&t<s?(S(t),a(`updatedPage`,t),!0):!1},w=()=>{l.value&&C(1)||(v.value=!1,d.value&&d.value.pause(),a(`allCompleted`))},T={onPlay:y,onPause:b,onEnded:w},E=(0,t.computed)(()=>{let e=h.value,t=e?.audioSources?.[f.value],n=e?.multiLinguals?.[p.value]??e?.text??``,r=i.dataSet?.lang?e?.multiLinguals?.[i.dataSet.lang]??e?.text??``:``;return{videoWithAudioSource:g(e?.videoWithAudioSource),videoSource:g(e?.videoSource),soundEffectSource:g(e?.soundEffectSource),audioSource:g(t),imageSource:g(e?.imageSource),index:c.value,text:n,originalText:r,duration:e?.duration,defaultLang:i.dataSet?.lang,currentLang:f.value,playbackSpeed:i.playbackSpeed,mediaAspectRatio:i.mediaAspectRatio,...T}}),D=(0,t.computed)(()=>i.dataSet?.beats[c.value+1]),O=(0,t.computed)(()=>{if(c.value+1>=s)return null;let e=D.value;return{videoWithAudioSource:g(e?.videoWithAudioSource),videoSource:g(e?.videoSource),soundEffectSource:g(e?.soundEffectSource),audioSource:g(e?.audioSources?.[f.value]),imageSource:g(e?.imageSource),index:c.value+1,text:e?.multiLinguals?.[p.value]??e?.text??``,duration:e?.duration}}),k=(0,t.computed)(()=>({MulmoPlayer:M,pageProps:E.value,currentPage:c.value,pageCount:s,pageMove:C,isPlaying:v.value,audioLang:f,textLang:p,SelectLanguage:F,mediaPlayerRef:u,mediaAspectRatio:i.mediaAspectRatio,handlePlay:y,handlePause:b,handleEnded:w}));return n({updatePage:S}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.renderSlot)(e.$slots,`default`,(0,t.normalizeProps)((0,t.guardReactiveProps)(k.value)),()=>[(0,t.createElementVNode)(`div`,I,[(0,t.createElementVNode)(`div`,L,[(0,t.createElementVNode)(`div`,R,[(0,t.createElementVNode)(`button`,{class:`col-start-1 row-start-1 justify-self-start w-auto px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600 disabled:opacity-50 self-center max-sm:row-start-2`,disabled:c.value===0,onClick:n[0]||=e=>C(-1)},` Prev `,8,z),(0,t.createElementVNode)(`div`,B,[(0,t.createVNode)(M,(0,t.mergeProps)({ref_key:`mediaPlayer`,ref:u},{...E.value,text:``,originalText:``}),null,16)]),(0,t.createElementVNode)(`button`,{class:`col-start-3 row-start-1 justify-self-end w-auto px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600 disabled:opacity-50 self-center max-sm:col-start-2 max-sm:row-start-2`,disabled:c.value>=(0,t.unref)(s)-1,onClick:n[1]||=e=>C(1)},` Next `,8,V),E.value.text?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_e,[(0,t.createElementVNode)(`p`,ve,(0,t.toDisplayString)(E.value.text),1),E.value.originalText&&E.value.originalText!==E.value.text?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,ye,(0,t.toDisplayString)(E.value.originalText),1)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0)])])])],!0),O.value?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(M,(0,t.normalizeProps)((0,t.mergeProps)({key:0},O.value)),null,16)),[[t.vShow,!1]]):(0,t.createCommentVNode)(``,!0),_.value?((0,t.openBlock)(),(0,t.createElementBlock)(`audio`,{key:1,ref_key:`bgmRef`,ref:d,src:_.value},null,8,be)):(0,t.createCommentVNode)(``,!0)],64))}}),[[`__scopeId`,`data-v-5693d3ec`]]),U={class:`mulmocast-container`},W={class:`mulmocast-content-wrapper`},G={class:`p-4`},K={key:0,class:`header-row`},q={class:`document-title`},J={class:`button-group`},xe=[`disabled`],Se={key:0,class:`error-message`},Y={key:1,class:`viewer-container`},Ce=[`src`],X=[`src`,`alt`],Z={class:`beat-text`},Q={key:0,class:`script-source`},we={key:0,class:`error`},Te=[`disabled`],Ee=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,t.defineComponent)({__name:`View`,props:{selectedResult:{},setMute:{type:Function},pluginConfigs:{}},emits:[`updateResult`],setup(n,{emit:r}){let i=n,a=(0,t.computed)(()=>i.pluginConfigs?.mulmocast??!0),o=r,s=(0,t.ref)(null),c=(0,t.ref)(!1),l=(0,t.ref)(null),u=(0,t.ref)(null),d=(0,t.ref)(JSON.stringify(i.selectedResult?.data?.mulmoScript,null,2)||``),f=(0,t.ref)(null),p=(0,t.ref)(`en`),m=(0,t.ref)(`en`),h=(0,t.ref)(1),g=(0,t.ref)(0),_=(0,t.computed)(()=>i.selectedResult?.data?.moviePath||null),v=(0,t.computed)(()=>i.selectedResult?.data?.viewerJsonPath||null),y=(0,t.computed)(()=>{if(!v.value)return``;let e=v.value.indexOf(`/output/`);if(e!==-1){let t=v.value.substring(e),n=t.lastIndexOf(`/`);return t.substring(0,n)}return``}),b=(0,t.computed)(()=>{let e=JSON.stringify(i.selectedResult?.data?.mulmoScript,null,2);return d.value!==e});(0,t.onUnmounted)(()=>{s.value&&URL.revokeObjectURL(s.value)});async function x(){let t=i.selectedResult?.data?.mulmoScript;if(!(!t||c.value||!i.selectedResult)){c.value=!0,l.value=null;try{let n=e.a(),r=await fetch(`/api/generate-movie`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mulmoScript:t,uuid:n,images:i.selectedResult?.data?.images||{}})});if(r.ok){let e=await r.json();o(`updateResult`,{...i.selectedResult,data:{...i.selectedResult.data,moviePath:e.outputPath,viewerJsonPath:e.viewerJsonPath}})}else{let e=await r.json();l.value=e.details||e.error||`Failed to generate movie`}}catch(e){l.value=e instanceof Error?e.message:`Unknown error`}finally{c.value=!1}}}(0,t.watch)(()=>i.selectedResult?.data?.mulmoScript,async e=>{!e||i.selectedResult?.data?.moviePath||c.value||!i.selectedResult||a.value===!1||await x()},{immediate:!0}),(0,t.watch)(v,async e=>{if(!e){f.value=null;return}try{let t=await fetch(`/api/viewer-json`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({viewerJsonPath:e})});if(!t.ok)throw Error(`Failed to load viewer JSON`);f.value=await t.json()}catch(e){console.error(`Viewer JSON loading failed:`,e),f.value=null}},{immediate:!0}),(0,t.watch)(_,async e=>{if(e)try{let t=await fetch(`/api/download-movie`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({moviePath:e})});if(!t.ok)throw Error(`Failed to load movie`);let n=await t.blob();s.value&&URL.revokeObjectURL(s.value),s.value=URL.createObjectURL(n)}catch(e){console.error(`Movie loading failed:`,e)}},{immediate:!0});let S=()=>{if(!i.selectedResult?.data?.mulmoScript)return;let e=JSON.stringify(i.selectedResult.data.mulmoScript,null,2),t=new Blob([e],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${(i.selectedResult.data.mulmoScript.title||`mulmoscript`).replace(/[^a-z0-9]/gi,`_`).replace(/_+/g,`_`).replace(/^_|_$/g,``).toLowerCase()}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)},C=async()=>{if(_.value)try{let e=await fetch(`/api/download-movie`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({moviePath:_.value})});if(!e.ok)throw Error(`Failed to download movie`);let t=e.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/),n=t?t[1]:`movie.mp4`,r=await e.blob(),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=n,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}catch(e){console.error(`Movie download failed:`,e),alert(`Failed to download movie: ${e instanceof Error?e.message:`Unknown error`}`)}},w=()=>{i.setMute?.(!0)},T=()=>{i.setMute?.(!1)},E=()=>{i.setMute?.(!1)};function D(){try{let e=JSON.parse(d.value);u.value=null,o(`updateResult`,{...i.selectedResult,data:{...i.selectedResult.data,mulmoScript:e,moviePath:void 0,viewerJsonPath:void 0}})}catch(e){u.value=e instanceof Error?e.message:`Invalid JSON`}}(0,t.watch)(()=>i.selectedResult?.data?.mulmoScript,e=>{d.value=JSON.stringify(e,null,2)||``,u.value=null});function O(){if(f.value&&g.value<f.value.beats.length-1){let e=document.querySelector(`video, audio`),t=e&&!e.paused;g.value++,t&&setTimeout(()=>{let e=document.querySelector(`video, audio`);e&&e.play().catch(()=>{})},100)}}function k(){if(g.value>0){let e=document.querySelector(`video, audio`),t=e&&!e.paused;g.value--,t&&setTimeout(()=>{let e=document.querySelector(`video, audio`);e&&e.play().catch(()=>{})},100)}}return(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,U,[(0,t.createElementVNode)(`div`,W,[(0,t.createElementVNode)(`div`,G,[n.selectedResult?.data?.mulmoScript?.title?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,K,[(0,t.createElementVNode)(`h1`,q,(0,t.toDisplayString)(n.selectedResult.data.mulmoScript.title),1),(0,t.createElementVNode)(`div`,J,[(0,t.createElementVNode)(`button`,{onClick:S,class:`download-btn download-btn-green`},[...r[4]||=[(0,t.createElementVNode)(`span`,{class:`material-icons`},`download`,-1),(0,t.createTextVNode)(` Script `,-1)]]),!_.value&&!c.value&&a.value===!1?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:0,onClick:x,class:`download-btn download-btn-orange`},[...r[5]||=[(0,t.createElementVNode)(`span`,{class:`material-icons`},`movie`,-1),(0,t.createTextVNode)(` Generate Movie `,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:1,onClick:C,disabled:!_.value,class:(0,t.normalizeClass)([`download-btn`,_.value?`download-btn-blue`:`download-btn-disabled`])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`material-icons`,{"animate-spin":c.value}])},(0,t.toDisplayString)(c.value?`hourglass_empty`:`download`),3),r[6]||=(0,t.createTextVNode)(` Movie `,-1)],10,xe))])])):(0,t.createCommentVNode)(``,!0),n.selectedResult?.data?.mulmoScript?.beats?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(n.selectedResult.data.mulmoScript.beats,(e,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.id||i,class:`beat-container`},[i===0&&l.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Se,` Movie generation failed: `+(0,t.toDisplayString)(l.value),1)):i===0&&f.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Y,[g.value>0?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:0,onClick:k,class:`nav-button nav-button-prev`,"aria-label":`Previous page`},` ‹ `)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(H),{ref_for:!0,ref:`viewerRef`,key:`viewer-${g.value}`,"audio-lang":p.value,"onUpdate:audioLang":r[0]||=e=>p.value=e,"text-lang":m.value,"onUpdate:textLang":r[1]||=e=>m.value=e,"data-set":f.value,"base-path":y.value,"init-page":g.value,"playback-speed":h.value,onUpdatedPage:r[2]||=e=>g.value=e},null,8,[`audio-lang`,`text-lang`,`data-set`,`base-path`,`init-page`,`playback-speed`])),f.value&&g.value<f.value.beats.length-1?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:1,onClick:O,class:`nav-button nav-button-next`,"aria-label":`Next page`},` › `)):(0,t.createCommentVNode)(``,!0)])):i===0&&_.value&&s.value&&!f.value?((0,t.openBlock)(),(0,t.createElementBlock)(`video`,{key:2,ref_for:!0,ref:`videoEl`,src:s.value,controls:``,class:`video-player`,onPlay:w,onPause:T,onEnded:E},null,40,Ce)):e.id&&n.selectedResult.data?.images?.[e.id]?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:3,src:`data:image/png;base64,${n.selectedResult.data.images[e.id]}`,alt:e.text,class:`beat-image`},null,8,X)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`p`,Z,(0,t.toDisplayString)(e.text),1)]))),128)):(0,t.createCommentVNode)(``,!0)])]),n.selectedResult?.data?.mulmoScript?((0,t.openBlock)(),(0,t.createElementBlock)(`details`,Q,[r[8]||=(0,t.createElementVNode)(`summary`,null,`Edit MulmoScript Source`,-1),u.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,we,[r[7]||=(0,t.createElementVNode)(`strong`,null,`Parse Error:`,-1),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(u.value),1)])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`textarea`,{"onUpdate:modelValue":r[3]||=e=>d.value=e,class:`script-editor`,spellcheck:`false`},null,512),[[t.vModelText,d.value]]),(0,t.createElementVNode)(`button`,{onClick:D,class:`apply-btn`,disabled:!b.value},` Apply Changes `,8,Te)])):(0,t.createCommentVNode)(``,!0)]))}}),[[`__scopeId`,`data-v-0070ab10`]]),De={class:`bg-green-100 rounded overflow-hidden`},Oe={key:0,class:`w-full aspect-video bg-gray-200`,style:{position:`relative`}},ke=[`src`,`alt`],Ae={class:`p-2`},je={class:`text-green-600 font-medium text-sm truncate`},Me=(0,t.defineComponent)({__name:`Preview`,props:{result:{}},setup(e){let n=e,r=(0,t.computed)(()=>{let e=n.result.data?.mulmoScript?.beats?.[0];return e?.id&&n.result.data?.images?.[e.id]?n.result.data.images[e.id]:null});return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,De,[r.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Oe,[(0,t.createElementVNode)(`img`,{src:`data:image/png;base64,${r.value}`,alt:e.result.data?.mulmoScript?.title||`Presentation`,class:`w-full h-full object-cover`},null,8,ke)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Ae,[(0,t.createElementVNode)(`div`,je,(0,t.toDisplayString)(e.result.data?.mulmoScript?.title||e.result.title||`Presentation`),1)])]))}}),Ne=`showPresentation`,Pe=`Call the ${Ne} API to display presentations when the user is asking for a presentation.`,$={...e.r,viewComponent:Ee,previewComponent:Me,samples:e.t,systemPrompt:Pe},Fe={plugin:$};exports.Preview=Me,exports.SYSTEM_PROMPT=Pe,exports.TOOL_DEFINITION=e.o,exports.TOOL_NAME=Ne,exports.View=Ee,exports.default=Fe,exports.executeMulmocast=e.n,exports.plugin=$,exports.pluginCore=e.r,exports.samples=e.t;
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./samples-BABMT6Qw.cjs`);let t=require(`vue`);var n={video:`16/9`,square:`1/1`},r=/^(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)$/,i=e=>{let t=r.exec(e);return t?Number(t[1])>0&&Number(t[2])>0:!1},a=e=>{if(!e)return;let t=n[e];if(t)return t;if(i(e))return e},o=async e=>await new Promise(t=>setTimeout(t,e)),s=(e,t)=>{let n=e=>e instanceof Error?e:Error(`Aborted`);return new Promise((r,i)=>{if(t.aborted){i(n(t.reason));return}let a=()=>{clearTimeout(o),i(n(t.reason))},o=setTimeout(()=>{t.removeEventListener(`abort`,a),r()},e);t.addEventListener(`abort`,a,{once:!0})})},c=1,l=.5,u=.5,d=.2,f=(e,t)=>e>t+c,p=e=>{if(!e||e.ended||isNaN(e.duration)||e.duration<=0)return!0;let t=Math.min(l,e.duration/2);return e.currentTime>=e.duration-t},m=e=>e.soundEffectSource?1:e.videoSource&&e.audioSource&&e.currentLang&&e.defaultLang&&e.currentLang!==e.defaultLang?d:0,h=(e,t,n)=>{if(isNaN(e)||isNaN(t)||isNaN(n))return null;let r=Math.min(e,n);return Math.abs(t-r)>u?r:null},g=(e,t,n)=>e?!1:n?t:!0,_=(e,t)=>e?!1:p(t),v=e=>!(e.isStopping||e.videoEnded&&e.audioExists&&!e.audioEnded),y={class:`items-center justify-center w-full`},b={key:0,class:`group relative`},x=[`src`],S={class:`play-overlay absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none`},C={key:0,class:`w-8 h-8 text-white ml-1`,fill:`currentColor`,viewBox:`0 0 24 24`},w={key:1,class:`w-8 h-8 text-white`,fill:`currentColor`,viewBox:`0 0 24 24`},T={key:1,class:`group relative inline-block`},E=[`src`,`controls`],D=[`src`],O={class:`play-overlay absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none`},k={key:0,class:`w-8 h-8 text-white ml-1`,fill:`currentColor`,viewBox:`0 0 24 24`},ee={key:1,class:`w-8 h-8 text-white`,fill:`currentColor`,viewBox:`0 0 24 24`},te={key:2,class:`group relative inline-block`},ne=[`src`],re=[`src`],ie={class:`play-overlay absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none`},ae={key:0,class:`w-8 h-8 text-white ml-1`,fill:`currentColor`,viewBox:`0 0 24 24`},oe={key:1,class:`w-8 h-8 text-white`,fill:`currentColor`,viewBox:`0 0 24 24`},se={key:3,class:`group relative inline-block`},ce=[`src`],le={class:`play-overlay absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none`},ue={key:0,class:`w-8 h-8 text-white ml-1`,fill:`currentColor`,viewBox:`0 0 24 24`},de={key:1,class:`w-8 h-8 text-white`,fill:`currentColor`,viewBox:`0 0 24 24`},fe={key:4},pe={key:0,class:`mt-4 px-6 py-4 text-left`},me={class:`text-lg leading-relaxed font-sans text-gray-800`},he={key:0,class:`text-base leading-relaxed font-sans text-gray-400 mt-3 italic`},ge=`https://github.com/receptron/mulmocast-cli/blob/main/assets/images/mulmocast_credit.png?raw=true`,A=(0,t.defineComponent)({__name:`mulmo_player`,props:{index:{},videoWithAudioSource:{default:void 0},soundEffectSource:{default:void 0},videoSource:{default:void 0},imageSource:{default:void 0},audioSource:{default:void 0},text:{default:void 0},originalText:{default:void 0},duration:{default:void 0},defaultLang:{default:void 0},currentLang:{default:void 0},playbackSpeed:{default:1},mediaAspectRatio:{default:void 0}},emits:[`play`,`pause`,`ended`],setup(e,{expose:n,emit:r}){let i=(0,t.computed)(()=>{let e=a(o.mediaAspectRatio);return e?{aspectRatio:e}:{}}),o=e,c=r,l=(0,t.ref)(),u=(0,t.ref)(),d=(0,t.ref)(),p=(0,t.ref)(),A=(0,t.ref)(!1),j=()=>{u.value&&d.value&&!isNaN(u.value.duration)&&!isNaN(d.value.duration)&&(A.value=f(d.value.duration,u.value.duration))},M=()=>{u.value&&(u.value.volume=m({soundEffectSource:o.soundEffectSource,videoSource:o.videoSource,audioSource:o.audioSource,currentLang:o.currentLang,defaultLang:o.defaultLang}))},N=()=>{let e=o.playbackSpeed??1;l.value&&(l.value.playbackRate=e),u.value&&(u.value.playbackRate=e),d.value&&(d.value.playbackRate=e),p.value&&(p.value.playbackRate=e)};(0,t.watch)([()=>o.currentLang,()=>o.defaultLang,()=>o.videoSource,()=>o.audioSource],()=>{M()}),(0,t.watch)(()=>o.playbackSpeed,()=>{N()}),(0,t.watch)(u,e=>{e&&(M(),N())}),(0,t.watch)([l,d,p],()=>{N()}),(0,t.onMounted)(()=>{M(),N()});let P=(0,t.ref)(!1),F=(0,t.ref)(!1),I=(0,t.computed)(()=>K.value||F.value),L=null,R=()=>{L&&=(L.abort(),null)},z=()=>{K.value=!0,d.value&&u.value&&!d.value.ended&&(d.value.currentTime=u.value.currentTime,d.value.play().catch(()=>{})),c(`play`)},B=e=>{v({isStopping:F.value,videoEnded:u.value?.ended??!1,audioExists:!!d.value,audioEnded:d.value?.ended??!0})&&(document.hidden||(K.value=!1),!u.value?.ended&&d?.value&&d.value?.pause(),U(e))},V=()=>{g(P.value,d.value?.ended??!0,!!d.value)&&W()},_e=()=>{let e=u.value?{ended:u.value.ended,duration:u.value.duration,currentTime:u.value.currentTime}:null;_(P.value,e)&&W()},ve=()=>{if(!u.value||!d.value)return;let e=h(d.value.currentTime,u.value.currentTime,u.value.duration);e!==null&&(u.value.currentTime=e)},ye=()=>{K.value=!0,u.value&&!u.value.ended&&u.value.play().catch(()=>{}),c(`play`)},be=()=>{F.value||d.value?.ended||(document.hidden||(K.value=!1),u.value&&!u.value.ended&&u.value.pause(),c(`pause`))},H=()=>{K.value=!0,c(`play`)},U=e=>{if(F.value)return;document.hidden||(K.value=!1);let t=e.target;t.duration!==t.currentTime&&c(`pause`)},W=()=>{P.value||(P.value=!0,K.value=!1,c(`ended`))},G=()=>{l.value?.pause(),u.value?.pause(),d.value?.pause(),p.value?.pause()},K=(0,t.ref)(!1),q=null,J=async()=>{if(F.value=!1,P.value=!1,K.value=!0,l.value&&(N(),l.value.play().catch(()=>{})),u.value&&(M(),N(),u.value.play().catch(()=>{}),d.value&&(d.value.currentTime=u.value.currentTime,d.value.play().catch(()=>{}))),p.value&&(N(),p.value.play().catch(()=>{})),!l.value&&!u.value&&!p.value)try{R(),L=new AbortController,await s((o.duration??0)*1e3,L.signal),L=null,P.value||(K.value=!1,P.value=!0,c(`ended`))}catch{}},xe=()=>{F.value=!0,K.value=!1,P.value=!0,R(),l.value?.pause(),u.value?.pause(),d.value?.pause(),p.value?.pause()},Se=()=>{if(!d.value||!u.value||d.value.ended)return;let e=h(u.value.currentTime,d.value.currentTime,d.value.duration);e!==null&&(d.value.currentTime=e)},Y=e=>{e?.paused&&!e.ended&&e.play().catch(()=>{})},Ce=(e,t)=>{t.paused&&!t.ended&&(e.ended||(t.currentTime=e.currentTime),t.play().catch(()=>{}))},X=()=>{K.value&&(Y(l.value),u.value&&d.value?(Y(u.value),Ce(u.value,d.value)):Y(u.value),Y(p.value))},Z=()=>{document.hidden&&K.value?q||=setInterval(X,500):document.hidden||(q&&=(clearInterval(q),null))},Q=()=>{document.hidden&&K.value&&setTimeout(X,50)};return(0,t.onMounted)(()=>{document.addEventListener(`visibilitychange`,Z),l.value?.addEventListener(`pause`,Q),u.value?.addEventListener(`pause`,Q),p.value?.addEventListener(`pause`,Q),d.value?.addEventListener(`pause`,Q)}),(0,t.onUnmounted)(()=>{document.removeEventListener(`visibilitychange`,Z),l.value?.removeEventListener(`pause`,Q),u.value?.removeEventListener(`pause`,Q),p.value?.removeEventListener(`pause`,Q),d.value?.removeEventListener(`pause`,Q),q&&=(clearInterval(q),null),R()}),n({play:J,stop:xe}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,y,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`w-full flex items-center justify-center overflow-hidden`,{"[&>*]:w-full [&>*]:h-full":e.mediaAspectRatio}]),style:(0,t.normalizeStyle)(i.value)},[e.videoWithAudioSource?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,b,[(0,t.createElementVNode)(`video`,{ref_key:`videoWithAudioRef`,ref:l,src:e.videoWithAudioSource,class:`mulmocast-video mx-auto h-auto max-h-[80vh] w-auto object-contain`,controls:!0,playsinline:`true`,onPlay:H,onPause:U,onEnded:W},null,40,x),(0,t.createElementVNode)(`div`,S,[(0,t.createElementVNode)(`button`,{class:`pointer-events-auto w-16 h-16 bg-black/50 hover:bg-black/70 rounded-full flex items-center justify-center transition-colors cursor-pointer`,onClick:r[0]||=e=>I.value?G():J()},[I.value?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,w,[...r[5]||=[(0,t.createElementVNode)(`path`,{d:`M6 19h4V5H6v14zm8-14v14h4V5h-4z`},null,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,C,[...r[4]||=[(0,t.createElementVNode)(`path`,{d:`M8 5v14l11-7z`},null,-1)]]))])])])):e.soundEffectSource||e.videoSource?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,T,[(0,t.createElementVNode)(`video`,{ref_key:`videoRef`,ref:u,class:`mulmocast-video mx-auto h-auto max-h-[80vh] w-auto object-contain`,src:e.soundEffectSource||e.videoSource,controls:!A.value,playsinline:`true`,onPlay:z,onPause:B,onEnded:V,onSeeked:Se,onLoadedmetadata:j},null,40,E),e.audioSource?((0,t.openBlock)(),(0,t.createElementBlock)(`audio`,{key:0,ref_key:`audioSyncRef`,ref:d,src:e.audioSource,controls:!0,class:(0,t.normalizeClass)(A.value?`mulmocast-audio absolute bottom-0 left-0 w-full`:`hidden`),onEnded:_e,onSeeked:ve,onPlay:ye,onPause:be,onLoadedmetadata:j},null,42,D)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,O,[(0,t.createElementVNode)(`button`,{class:`pointer-events-auto w-16 h-16 bg-black/50 hover:bg-black/70 rounded-full flex items-center justify-center transition-colors cursor-pointer`,onClick:r[1]||=e=>I.value?G():J()},[I.value?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,ee,[...r[7]||=[(0,t.createElementVNode)(`path`,{d:`M6 19h4V5H6v14zm8-14v14h4V5h-4z`},null,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,k,[...r[6]||=[(0,t.createElementVNode)(`path`,{d:`M8 5v14l11-7z`},null,-1)]]))])])])):e.audioSource?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,te,[e.imageSource?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:0,src:e.imageSource,class:`mx-auto h-auto max-h-[80vh] w-auto object-contain`,alt:`Background`},null,8,ne)):((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:1,src:ge,class:`mx-auto h-auto max-h-[80vh] w-auto object-contain`,alt:`Background`})),(0,t.createElementVNode)(`audio`,{ref_key:`audioRef`,ref:p,class:`mulmocast-audio absolute inset-0 w-full h-full`,src:e.audioSource,controls:!0,onPlay:H,onPause:U,onEnded:W},null,40,re),(0,t.createElementVNode)(`div`,ie,[(0,t.createElementVNode)(`button`,{class:`pointer-events-auto w-16 h-16 bg-black/50 hover:bg-black/70 rounded-full flex items-center justify-center transition-colors cursor-pointer`,onClick:r[2]||=e=>I.value?G():J()},[I.value?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,oe,[...r[9]||=[(0,t.createElementVNode)(`path`,{d:`M6 19h4V5H6v14zm8-14v14h4V5h-4z`},null,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,ae,[...r[8]||=[(0,t.createElementVNode)(`path`,{d:`M8 5v14l11-7z`},null,-1)]]))])])])):e.imageSource?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,se,[(0,t.createElementVNode)(`img`,{src:e.imageSource,class:`max-w-full max-h-full object-contain`},null,8,ce),(0,t.createElementVNode)(`div`,le,[(0,t.createElementVNode)(`button`,{class:`pointer-events-auto w-16 h-16 bg-black/50 hover:bg-black/70 rounded-full flex items-center justify-center transition-colors cursor-pointer`,onClick:r[3]||=e=>I.value?G():J()},[I.value?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,de,[...r[11]||=[(0,t.createElementVNode)(`path`,{d:`M6 19h4V5H6v14zm8-14v14h4V5h-4z`},null,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,ue,[...r[10]||=[(0,t.createElementVNode)(`path`,{d:`M8 5v14l11-7z`},null,-1)]]))])])])):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,fe,`No media available`))],6),e.text?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,pe,[(0,t.createElementVNode)(`p`,me,(0,t.toDisplayString)(e.text),1),e.originalText&&e.originalText!==e.text?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,he,(0,t.toDisplayString)(e.originalText),1)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0)]))}}),j=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},M=j(A,[[`__scopeId`,`data-v-0e76dd6a`]]),N=[`value`],P=[`value`],F=(0,t.defineComponent)({__name:`select_language`,props:{modelValue:{}},emits:[`update:modelValue`],setup(e,{emit:n}){let r=[`en`,`ja`],i={en:`English`,ja:`日本語`},a=n,o=e=>{let t=e.target;a(`update:modelValue`,t.value)};return(n,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`select`,{value:e.modelValue,class:`px-4 py-2 bg-white border-2 border-gray-300 rounded-lg shadow-sm hover:border-indigo-400 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-200 focus:outline-none transition-colors cursor-pointer text-base font-medium text-gray-700`,onChange:o},[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r,e=>(0,t.createElementVNode)(`option`,{key:e,value:e},(0,t.toDisplayString)(i[e]||e),9,P)),64))],40,N))}}),I={class:`w-full overflow-hidden`},L={class:`max-w-7xl mx-auto px-4`},R={class:`grid grid-cols-[auto,1fr,auto] gap-x-4 gap-y-4 max-sm:grid-cols-2`},z=[`disabled`],B={class:`col-start-2 row-start-1 min-w-0 max-sm:col-span-2 max-sm:col-start-1`},V=[`disabled`],_e={key:0,class:`mulmo-text-box col-start-2 row-start-2 min-w-0 mt-1 rounded-lg px-6 py-4 text-left max-sm:col-span-2 max-sm:col-start-1 max-sm:row-start-3`},ve={class:`mulmo-text-primary text-lg leading-relaxed font-sans`},ye={key:0,class:`mulmo-text-secondary text-base leading-relaxed font-sans mt-3 italic`},be=[`src`],H=j((0,t.defineComponent)({__name:`mulmo_viewer`,props:{dataSet:{default:void 0},basePath:{},initPage:{default:void 0},audioLang:{default:`en`},textLang:{default:`en`},playbackSpeed:{default:1},mediaAspectRatio:{default:void 0}},emits:[`updatedPage`,`update:audioLang`,`update:textLang`,`allCompleted`],setup(e,{expose:n,emit:r}){let i=e,a=r,s=i.dataSet?.beats?.length??0,c=(0,t.ref)(i.initPage??0),l=(0,t.ref)(!0),u=(0,t.ref)(),d=(0,t.ref)(),f=(0,t.computed)({get:()=>i.audioLang,set:e=>a(`update:audioLang`,e||`en`)}),p=(0,t.computed)({get:()=>i.textLang,set:e=>a(`update:textLang`,e||`en`)}),m=0;(0,t.watch)(()=>i.audioLang,async(e,t)=>{if(e!==t&&v.value){m++;let e=m;if(u.value?.stop(),await o(500),e!==m)return;u.value&&(v.value=!0,await u.value.play())}}),(0,t.watch)(()=>i.textLang,async(e,t)=>{e!==t&&v.value&&(await o(100),u.value&&await u.value.play())}),(0,t.watch)(d,e=>{e&&(e.volume=.3)});let h=(0,t.computed)(()=>i.dataSet?.beats[c.value]),g=e=>e?i.basePath+`/`+e:``,_=(0,t.computed)(()=>g(i.dataSet?.bgmSource)),v=(0,t.ref)(!1),y=()=>{v.value=!0,d.value&&(d.value.volume=.3,d.value.play())},b=()=>{v.value=!1,d.value&&d.value.pause()},x=async()=>{m++;let e=m;u.value?.stop(),await o(500),e===m&&u.value&&u.value.play()},S=e=>{c.value!==e&&(c.value=e,v.value&&l.value&&x())},C=e=>{let t=c.value+e;return t>-1&&t<s?(S(t),a(`updatedPage`,t),!0):!1},w=()=>{l.value&&C(1)||(v.value=!1,d.value&&d.value.pause(),a(`allCompleted`))},T={onPlay:y,onPause:b,onEnded:w},E=(0,t.computed)(()=>{let e=h.value,t=e?.audioSources?.[f.value],n=e?.multiLinguals?.[p.value]??e?.text??``,r=i.dataSet?.lang?e?.multiLinguals?.[i.dataSet.lang]??e?.text??``:``;return{videoWithAudioSource:g(e?.videoWithAudioSource),videoSource:g(e?.videoSource),soundEffectSource:g(e?.soundEffectSource),audioSource:g(t),imageSource:g(e?.imageSource),index:c.value,text:n,originalText:r,duration:e?.duration,defaultLang:i.dataSet?.lang,currentLang:f.value,playbackSpeed:i.playbackSpeed,mediaAspectRatio:i.mediaAspectRatio,...T}}),D=(0,t.computed)(()=>i.dataSet?.beats[c.value+1]),O=(0,t.computed)(()=>{if(c.value+1>=s)return null;let e=D.value;return{videoWithAudioSource:g(e?.videoWithAudioSource),videoSource:g(e?.videoSource),soundEffectSource:g(e?.soundEffectSource),audioSource:g(e?.audioSources?.[f.value]),imageSource:g(e?.imageSource),index:c.value+1,text:e?.multiLinguals?.[p.value]??e?.text??``,duration:e?.duration}}),k=(0,t.computed)(()=>({MulmoPlayer:M,pageProps:E.value,currentPage:c.value,pageCount:s,pageMove:C,isPlaying:v.value,audioLang:f,textLang:p,SelectLanguage:F,mediaPlayerRef:u,mediaAspectRatio:i.mediaAspectRatio,handlePlay:y,handlePause:b,handleEnded:w}));return n({updatePage:S}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.renderSlot)(e.$slots,`default`,(0,t.normalizeProps)((0,t.guardReactiveProps)(k.value)),()=>[(0,t.createElementVNode)(`div`,I,[(0,t.createElementVNode)(`div`,L,[(0,t.createElementVNode)(`div`,R,[(0,t.createElementVNode)(`button`,{class:`col-start-1 row-start-1 justify-self-start w-auto px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600 disabled:opacity-50 self-center max-sm:row-start-2`,disabled:c.value===0,onClick:n[0]||=e=>C(-1)},` Prev `,8,z),(0,t.createElementVNode)(`div`,B,[(0,t.createVNode)(M,(0,t.mergeProps)({ref_key:`mediaPlayer`,ref:u},{...E.value,text:``,originalText:``}),null,16)]),(0,t.createElementVNode)(`button`,{class:`col-start-3 row-start-1 justify-self-end w-auto px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600 disabled:opacity-50 self-center max-sm:col-start-2 max-sm:row-start-2`,disabled:c.value>=(0,t.unref)(s)-1,onClick:n[1]||=e=>C(1)},` Next `,8,V),E.value.text?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_e,[(0,t.createElementVNode)(`p`,ve,(0,t.toDisplayString)(E.value.text),1),E.value.originalText&&E.value.originalText!==E.value.text?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,ye,(0,t.toDisplayString)(E.value.originalText),1)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0)])])])],!0),O.value?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(M,(0,t.normalizeProps)((0,t.mergeProps)({key:0},O.value)),null,16)),[[t.vShow,!1]]):(0,t.createCommentVNode)(``,!0),_.value?((0,t.openBlock)(),(0,t.createElementBlock)(`audio`,{key:1,ref_key:`bgmRef`,ref:d,src:_.value},null,8,be)):(0,t.createCommentVNode)(``,!0)],64))}}),[[`__scopeId`,`data-v-5693d3ec`]]),U={class:`mulmocast-container`},W={class:`mulmocast-content-wrapper`},G={class:`p-4`},K={key:0,class:`header-row`},q={class:`document-title`},J={class:`button-group`},xe=[`disabled`],Se={key:0,class:`error-message`},Y={key:1,class:`viewer-container`},Ce=[`src`],X=[`src`,`alt`],Z={class:`beat-text`},Q={key:0,class:`script-source`},we={key:0,class:`error`},Te=[`disabled`],Ee=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,t.defineComponent)({__name:`View`,props:{selectedResult:{},setMute:{type:Function},pluginConfigs:{}},emits:[`updateResult`],setup(n,{emit:r}){let i=n,a=(0,t.computed)(()=>i.pluginConfigs?.mulmocast??!0),o=r,s=(0,t.ref)(null),c=(0,t.ref)(!1),l=(0,t.ref)(null),u=(0,t.ref)(null),d=(0,t.ref)(JSON.stringify(i.selectedResult?.data?.mulmoScript,null,2)||``),f=(0,t.ref)(null),p=(0,t.ref)(`en`),m=(0,t.ref)(`en`),h=(0,t.ref)(1),g=(0,t.ref)(0),_=(0,t.computed)(()=>i.selectedResult?.data?.moviePath||null),v=(0,t.computed)(()=>i.selectedResult?.data?.viewerJsonPath||null),y=(0,t.computed)(()=>{if(!v.value)return``;let e=v.value.indexOf(`/output/`);if(e!==-1){let t=v.value.substring(e),n=t.lastIndexOf(`/`);return t.substring(0,n)}return``}),b=(0,t.computed)(()=>{let e=JSON.stringify(i.selectedResult?.data?.mulmoScript,null,2);return d.value!==e});(0,t.onUnmounted)(()=>{s.value&&URL.revokeObjectURL(s.value)});async function x(){let t=i.selectedResult?.data?.mulmoScript;if(!(!t||c.value||!i.selectedResult)){c.value=!0,l.value=null;try{let n=e.a(),r=await fetch(`/api/generate-movie`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mulmoScript:t,uuid:n,images:i.selectedResult?.data?.images||{}})});if(r.ok){let e=await r.json();o(`updateResult`,{...i.selectedResult,data:{...i.selectedResult.data,moviePath:e.outputPath,viewerJsonPath:e.viewerJsonPath}})}else{let e=await r.json();l.value=e.details||e.error||`Failed to generate movie`}}catch(e){l.value=e instanceof Error?e.message:`Unknown error`}finally{c.value=!1}}}(0,t.watch)(()=>i.selectedResult?.data?.mulmoScript,async e=>{!e||i.selectedResult?.data?.moviePath||c.value||!i.selectedResult||a.value===!1||await x()},{immediate:!0}),(0,t.watch)(v,async e=>{if(!e){f.value=null;return}try{let t=await fetch(`/api/viewer-json`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({viewerJsonPath:e})});if(!t.ok)throw Error(`Failed to load viewer JSON`);f.value=await t.json()}catch(e){console.error(`Viewer JSON loading failed:`,e),f.value=null}},{immediate:!0}),(0,t.watch)(_,async e=>{if(e)try{let t=await fetch(`/api/download-movie`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({moviePath:e})});if(!t.ok)throw Error(`Failed to load movie`);let n=await t.blob();s.value&&URL.revokeObjectURL(s.value),s.value=URL.createObjectURL(n)}catch(e){console.error(`Movie loading failed:`,e)}},{immediate:!0});let S=()=>{if(!i.selectedResult?.data?.mulmoScript)return;let e=JSON.stringify(i.selectedResult.data.mulmoScript,null,2),t=new Blob([e],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${(i.selectedResult.data.mulmoScript.title||`mulmoscript`).replace(/[^a-z0-9]/gi,`_`).replace(/_+/g,`_`).replace(/^_|_$/g,``).toLowerCase()}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)},C=async()=>{if(_.value)try{let e=await fetch(`/api/download-movie`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({moviePath:_.value})});if(!e.ok)throw Error(`Failed to download movie`);let t=e.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/),n=t?t[1]:`movie.mp4`,r=await e.blob(),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=n,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}catch(e){console.error(`Movie download failed:`,e),alert(`Failed to download movie: ${e instanceof Error?e.message:`Unknown error`}`)}},w=()=>{i.setMute?.(!0)},T=()=>{i.setMute?.(!1)},E=()=>{i.setMute?.(!1)};function D(){try{let e=JSON.parse(d.value);u.value=null,o(`updateResult`,{...i.selectedResult,data:{...i.selectedResult.data,mulmoScript:e,moviePath:void 0,viewerJsonPath:void 0}})}catch(e){u.value=e instanceof Error?e.message:`Invalid JSON`}}(0,t.watch)(()=>i.selectedResult?.data?.mulmoScript,e=>{d.value=JSON.stringify(e,null,2)||``,u.value=null});function O(){if(f.value&&g.value<f.value.beats.length-1){let e=document.querySelector(`video, audio`),t=e&&!e.paused;g.value++,t&&setTimeout(()=>{let e=document.querySelector(`video, audio`);e&&e.play().catch(()=>{})},100)}}function k(){if(g.value>0){let e=document.querySelector(`video, audio`),t=e&&!e.paused;g.value--,t&&setTimeout(()=>{let e=document.querySelector(`video, audio`);e&&e.play().catch(()=>{})},100)}}return(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,U,[(0,t.createElementVNode)(`div`,W,[(0,t.createElementVNode)(`div`,G,[n.selectedResult?.data?.mulmoScript?.title?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,K,[(0,t.createElementVNode)(`h1`,q,(0,t.toDisplayString)(n.selectedResult.data.mulmoScript.title),1),(0,t.createElementVNode)(`div`,J,[(0,t.createElementVNode)(`button`,{onClick:S,class:`download-btn download-btn-green`},[...r[4]||=[(0,t.createElementVNode)(`span`,{class:`material-icons`},`download`,-1),(0,t.createTextVNode)(` Script `,-1)]]),!_.value&&!c.value&&a.value===!1?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:0,onClick:x,class:`download-btn download-btn-orange`},[...r[5]||=[(0,t.createElementVNode)(`span`,{class:`material-icons`},`movie`,-1),(0,t.createTextVNode)(` Generate Movie `,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:1,onClick:C,disabled:!_.value,class:(0,t.normalizeClass)([`download-btn`,_.value?`download-btn-blue`:`download-btn-disabled`])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`material-icons`,{"animate-spin":c.value}])},(0,t.toDisplayString)(c.value?`hourglass_empty`:`download`),3),r[6]||=(0,t.createTextVNode)(` Movie `,-1)],10,xe))])])):(0,t.createCommentVNode)(``,!0),n.selectedResult?.data?.mulmoScript?.beats?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(n.selectedResult.data.mulmoScript.beats,(e,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.id||i,class:`beat-container`},[i===0&&l.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Se,` Movie generation failed: `+(0,t.toDisplayString)(l.value),1)):i===0&&f.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Y,[g.value>0?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:0,onClick:k,class:`nav-button nav-button-prev`,"aria-label":`Previous page`},` ‹ `)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(H),{ref_for:!0,ref:`viewerRef`,key:`viewer-${g.value}`,"audio-lang":p.value,"onUpdate:audioLang":r[0]||=e=>p.value=e,"text-lang":m.value,"onUpdate:textLang":r[1]||=e=>m.value=e,"data-set":f.value,"base-path":y.value,"init-page":g.value,"playback-speed":h.value,onUpdatedPage:r[2]||=e=>g.value=e},null,8,[`audio-lang`,`text-lang`,`data-set`,`base-path`,`init-page`,`playback-speed`])),f.value&&g.value<f.value.beats.length-1?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:1,onClick:O,class:`nav-button nav-button-next`,"aria-label":`Next page`},` › `)):(0,t.createCommentVNode)(``,!0)])):i===0&&_.value&&s.value&&!f.value?((0,t.openBlock)(),(0,t.createElementBlock)(`video`,{key:2,ref_for:!0,ref:`videoEl`,src:s.value,controls:``,class:`video-player`,onPlay:w,onPause:T,onEnded:E},null,40,Ce)):e.id&&n.selectedResult.data?.images?.[e.id]?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:3,src:`data:image/png;base64,${n.selectedResult.data.images[e.id]}`,alt:e.text,class:`beat-image`},null,8,X)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`p`,Z,(0,t.toDisplayString)(e.text),1)]))),128)):(0,t.createCommentVNode)(``,!0)])]),n.selectedResult?.data?.mulmoScript?((0,t.openBlock)(),(0,t.createElementBlock)(`details`,Q,[r[8]||=(0,t.createElementVNode)(`summary`,null,`Edit MulmoScript Source`,-1),u.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,we,[r[7]||=(0,t.createElementVNode)(`strong`,null,`Parse Error:`,-1),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(u.value),1)])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`textarea`,{"onUpdate:modelValue":r[3]||=e=>d.value=e,class:`script-editor`,spellcheck:`false`},null,512),[[t.vModelText,d.value]]),(0,t.createElementVNode)(`button`,{onClick:D,class:`apply-btn`,disabled:!b.value},` Apply Changes `,8,Te)])):(0,t.createCommentVNode)(``,!0)]))}}),[[`__scopeId`,`data-v-0070ab10`]]),De={class:`bg-green-100 rounded overflow-hidden`},Oe={key:0,class:`w-full aspect-video bg-gray-200`,style:{position:`relative`}},ke=[`src`,`alt`],Ae={class:`p-2`},je={class:`text-green-600 font-medium text-sm truncate`},Me=(0,t.defineComponent)({__name:`Preview`,props:{result:{}},setup(e){let n=e,r=(0,t.computed)(()=>{let e=n.result.data?.mulmoScript?.beats?.[0];return e?.id&&n.result.data?.images?.[e.id]?n.result.data.images[e.id]:null});return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,De,[r.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Oe,[(0,t.createElementVNode)(`img`,{src:`data:image/png;base64,${r.value}`,alt:e.result.data?.mulmoScript?.title||`Presentation`,class:`w-full h-full object-cover`},null,8,ke)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Ae,[(0,t.createElementVNode)(`div`,je,(0,t.toDisplayString)(e.result.data?.mulmoScript?.title||e.result.title||`Presentation`),1)])]))}}),Ne=`showPresentation`,Pe=`Call the ${Ne} API to display presentations when the user is asking for a presentation.`,$={...e.r,viewComponent:Ee,previewComponent:Me,samples:e.t,systemPrompt:Pe},Fe={plugin:$};exports.Preview=Me,exports.SYSTEM_PROMPT=Pe,exports.TOOL_DEFINITION=e.o,exports.TOOL_NAME=Ne,exports.View=Ee,exports.default=Fe,exports.executeMulmocast=e.n,exports.plugin=$,exports.pluginCore=e.r,exports.samples=e.t;
|
package/dist/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, n as t, o as n, r, t as i } from "./samples-
|
|
1
|
+
import { a as e, n as t, o as n, r, t as i } from "./samples-Pl6MPtJB.js";
|
|
2
2
|
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, guardReactiveProps as m, mergeProps as h, normalizeClass as g, normalizeProps as _, normalizeStyle as v, onMounted as y, onUnmounted as b, openBlock as x, ref as S, renderList as C, renderSlot as w, toDisplayString as T, unref as E, vModelText as D, vShow as O, watch as k, withDirectives as A } from "vue";
|
|
3
3
|
//#region node_modules/mulmocast-viewer/dist/mulmocast-viewer.es.js
|
|
4
4
|
var j = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gui-chat-plugin/mulmocast",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Mulmocast presentation plugin for GUI Chat applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -30,27 +30,27 @@
|
|
|
30
30
|
"preview": "vite preview"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@mulmocast/types": "^2.6.
|
|
34
|
-
"gui-chat-protocol": "^0.
|
|
35
|
-
"mulmocast": "^2.6.
|
|
33
|
+
"@mulmocast/types": "^2.6.14",
|
|
34
|
+
"gui-chat-protocol": "^0.4.0",
|
|
35
|
+
"mulmocast": "^2.6.14",
|
|
36
36
|
"mulmocast-viewer": "^0.2.4",
|
|
37
|
-
"uuid": "^
|
|
37
|
+
"uuid": "^14.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@eslint/js": "^10.0.1",
|
|
41
|
-
"@tailwindcss/vite": "^4.
|
|
42
|
-
"@types/node": "^25.0
|
|
41
|
+
"@tailwindcss/vite": "^4.3.0",
|
|
42
|
+
"@types/node": "^25.7.0",
|
|
43
43
|
"@types/uuid": "^11.0.0",
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^8.59.
|
|
45
|
-
"@typescript-eslint/parser": "^8.59.
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.59.3",
|
|
45
|
+
"@typescript-eslint/parser": "^8.59.3",
|
|
46
46
|
"@vitejs/plugin-vue": "^6.0.5",
|
|
47
47
|
"eslint": "^10.3.0",
|
|
48
48
|
"eslint-plugin-vue": "^10.9.1",
|
|
49
49
|
"globals": "^17.6.0",
|
|
50
|
-
"tailwindcss": "^4.
|
|
50
|
+
"tailwindcss": "^4.3.0",
|
|
51
51
|
"typescript": "~6.0.3",
|
|
52
|
-
"vite": "^8.0.
|
|
53
|
-
"vite-plugin-dts": "^
|
|
52
|
+
"vite": "^8.0.12",
|
|
53
|
+
"vite-plugin-dts": "^5.0.0",
|
|
54
54
|
"vue": "^3.5.34",
|
|
55
55
|
"vue-eslint-parser": "^10.4.0",
|
|
56
56
|
"vue-tsc": "^3.2.8"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`showPresentation`,t={type:`function`,name:e,description:`Let MulmoCast to process a given MulmoScript to generate a presentation of a given topic or story.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`The title of the presentation`},lang:{type:`string`,description:`The language of the presentation, such as en, ja, etc.`},beats:{type:`array`,items:{type:`object`,properties:{text:{type:`string`,description:`The text to be spoken by the presenter, which is also used to generate an image if there is no imagePrompt. Typically 50 to 70 words.`},imagePrompt:{type:`string`,description:`Optional prompt to be used to generate an image. Typically 50 to 70 words. Do not specify the image style.`}},required:[`text`],additionalProperties:!1},minItems:1}},required:[`title`,`lang`,`beats`],additionalProperties:!1}},n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));function r(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+`-`+n[e[t+4]]+n[e[t+5]]+`-`+n[e[t+6]]+n[e[t+7]]+`-`+n[e[t+8]]+n[e[t+9]]+`-`+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}var i,a=new Uint8Array(16);function o(){if(!i){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);i=crypto.getRandomValues.bind(crypto)}return i(a)}var s={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function c(e,t,n){e||={};let i=e.random??e.rng?.()??o();if(i.length<16)throw Error(`Random bytes length must be >= 16`);if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=i[e];return t}return r(i)}function l(e,t,n){return s.randomUUID&&!t&&!e?s.randomUUID():c(e,t,n)}var u=async(e,t)=>{let{title:n,beats:r}=t,i=e.app?.loadBlankImageBase64?await e.app.loadBlankImageBase64():``,a=i?[i]:[],o=r.map(e=>({id:l(),speaker:`Presenter`,text:e.text,imagePrompt:e.imagePrompt})),s={};if(e.app?.generateImageWithBackend){let t=o.map(async t=>{let n=t.imagePrompt||`generate image appropriate for the text. <text>${t.text}</text>. Let the art convey the story and emotions without text. Use the last image for the aspect ratio.`;try{let r=await e.app.generateImageWithBackend(n,a,e);if(r.success&&r.imageData)return{id:t.id,imageData:r.imageData}}catch(e){console.error(`Failed to generate image for beat:`,e)}return{id:t.id,imageData:null}});(await Promise.all(t)).forEach(e=>{e.imageData&&(s[e.id]=e.imageData)})}let c={$mulmocast:{version:`1.1`},canvasSize:{width:1536,height:1080},imageParams:{provider:`google`,model:`gemini-2.5-flash-image-preview`},audioParams:{padding:.2,introPadding:.5,closingPadding:.5,outroPadding:.5,bgmVolume:.1,audioVolume:1.5,suppressSpeech:!1},soundEffectParams:{},speechParams:{speakers:{Presenter:{voiceId:`shimmer`}}},title:n,lang:t.lang,beats:o};return{message:`Mulmocast has processed the MulmoScript for "${n}" with ${r.length} beats. Movie generation will begin automatically.`,title:n,instructions:`Acknowledge that all the images were successfully generated and that the movie is being generated.`,data:{mulmoScript:c,images:s}}},d={toolDefinition:t,execute:u,generatingMessage:`Processing with Mulmocast...`,waitingMessage:`Tell the user that the script was written and we are generating images and video with Mulmocast.`,isEnabled:()=>!0,backends:[`imageGen`,`mulmocast`]},f=u,p=[{name:`Simple Presentation`,args:{title:`Introduction to AI`,lang:`en`,beats:[{text:`Artificial Intelligence is transforming the way we live and work. From voice assistants to self-driving cars, AI is becoming an integral part of our daily lives.`,imagePrompt:`A futuristic city with AI-powered robots and flying vehicles`},{text:`Machine learning, a subset of AI, enables computers to learn from data without being explicitly programmed. This technology powers recommendation systems and fraud detection.`}]}}];Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return p}});
|