mulmoclaude 0.1.1 → 0.3.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/bin/mulmoclaude.js +50 -5
- package/client/assets/{index-KNLBjwuh.css → index-Bm70FDU2.css} +1 -1
- package/client/assets/{index-D8rhwXLq.js → index-eHWB79u5.js} +3 -3
- package/client/index.html +2 -2
- package/package.json +1 -1
- package/server/agent/config.ts +12 -12
- package/server/agent/mcp-server.ts +19 -19
- package/server/agent/mcp-tools/x.ts +5 -5
- package/server/agent/prompt.ts +9 -4
- package/server/agent/sandboxMounts.ts +7 -7
- package/server/agent/stream.ts +4 -4
- package/server/api/routes/files.ts +9 -9
- package/server/api/routes/scheduler.ts +8 -8
- package/server/api/routes/schedulerHandlers.ts +12 -12
- package/server/api/routes/schedulerTasks.ts +14 -14
- package/server/api/routes/sessions.ts +24 -24
- package/server/api/routes/todosColumnsHandlers.ts +30 -30
- package/server/api/routes/wiki.ts +14 -14
- package/server/events/scheduler-adapter.ts +20 -20
- package/server/events/session-store/index.ts +10 -10
- package/server/events/task-manager/index.ts +7 -7
- package/server/index.ts +19 -19
- package/server/utils/date.ts +18 -18
- package/server/utils/files/atomic.ts +9 -9
- package/server/utils/files/html-io.ts +5 -5
- package/server/utils/files/image-store.ts +2 -2
- package/server/utils/files/journal-io.ts +2 -2
- package/server/utils/files/naming.ts +2 -2
- package/server/utils/files/roles-io.ts +10 -10
- package/server/utils/files/scheduler-io.ts +5 -5
- package/server/utils/files/session-io.ts +35 -35
- package/server/utils/files/spreadsheet-store.ts +2 -2
- package/server/utils/files/todos-io.ts +9 -9
- package/server/utils/files/user-tasks-io.ts +5 -5
- package/server/workspace/chat-index/indexer.ts +15 -15
- package/server/workspace/custom-dirs.ts +11 -11
- package/server/workspace/journal/archivist.ts +35 -35
- package/server/workspace/journal/dailyPass.ts +31 -28
- package/server/workspace/journal/indexFile.ts +29 -25
- package/server/workspace/reference-dirs.ts +18 -18
- package/server/workspace/roles.ts +6 -6
- package/server/workspace/skills/discovery.ts +4 -4
- package/server/workspace/skills/user-tasks.ts +34 -34
- package/server/workspace/sources/arxivDiscovery.ts +8 -8
- package/server/workspace/sources/classifier.ts +7 -7
- package/server/workspace/sources/fetchers/arxiv.ts +7 -7
- package/server/workspace/sources/fetchers/githubIssues.ts +7 -7
- package/server/workspace/sources/fetchers/githubReleases.ts +7 -7
- package/server/workspace/sources/interests.ts +9 -9
- package/server/workspace/sources/pipeline/index.ts +6 -6
- package/server/workspace/sources/pipeline/plan.ts +5 -5
- package/server/workspace/sources/registry.ts +16 -16
- package/server/workspace/sources/robots.ts +14 -14
- package/server/workspace/sources/sourceState.ts +11 -9
- package/server/workspace/tool-trace/index.ts +1 -1
- package/server/workspace/tool-trace/writeSearch.ts +26 -16
- package/server/workspace/wiki-backlinks/index.ts +8 -8
- package/server/workspace/wiki-backlinks/sessionBacklinks.ts +15 -15
- package/src/App.vue +30 -30
- package/src/components/ChatInput.vue +7 -7
- package/src/components/LockStatusPopup.vue +2 -2
- package/src/components/NotificationToast.vue +2 -2
- package/src/components/RoleSelector.vue +2 -2
- package/src/components/SessionHistoryPanel.vue +6 -6
- package/src/components/SettingsMcpTab.vue +7 -7
- package/src/components/SettingsModal.vue +3 -3
- package/src/components/SettingsReferenceDirsTab.vue +10 -10
- package/src/components/SettingsWorkspaceDirsTab.vue +5 -5
- package/src/components/SuggestionsPanel.vue +2 -2
- package/src/components/todo/TodoAddDialog.vue +2 -2
- package/src/components/todo/TodoEditPanel.vue +2 -2
- package/src/components/todo/TodoListView.vue +5 -5
- package/src/composables/useCanvasViewMode.ts +5 -5
- package/src/composables/useClickOutside.ts +2 -2
- package/src/composables/useFreshPluginData.ts +3 -3
- package/src/composables/useKeyNavigation.ts +11 -11
- package/src/composables/useMcpTools.ts +2 -2
- package/src/composables/useNotifications.ts +3 -3
- package/src/composables/usePdfDownload.ts +4 -4
- package/src/composables/usePendingCalls.ts +1 -1
- package/src/composables/usePubSub.ts +10 -10
- package/src/composables/useRoles.ts +1 -1
- package/src/composables/useSandboxStatus.ts +1 -1
- package/src/composables/useSessionDerived.ts +3 -3
- package/src/composables/useSessionSync.ts +8 -8
- package/src/composables/useViewLayout.ts +2 -2
- package/src/config/roles.ts +2 -2
- package/src/plugins/chart/Preview.vue +4 -4
- package/src/plugins/manageSkills/View.vue +3 -3
- package/src/plugins/manageSource/Preview.vue +1 -1
- package/src/plugins/markdown/View.vue +2 -2
- package/src/plugins/presentHtml/helpers.ts +8 -8
- package/src/plugins/presentMulmoScript/View.vue +4 -4
- package/src/plugins/presentMulmoScript/helpers.ts +1 -1
- package/src/plugins/scheduler/Preview.vue +6 -6
- package/src/plugins/scheduler/TasksTab.vue +4 -4
- package/src/plugins/textResponse/View.vue +2 -2
- package/src/plugins/todo/Preview.vue +2 -2
- package/src/plugins/todo/View.vue +11 -11
- package/src/plugins/todo/composables/useTodos.ts +5 -5
- package/src/plugins/wiki/Preview.vue +5 -5
- package/src/plugins/wiki/helpers.ts +4 -4
- package/src/router/guards.ts +12 -12
- package/src/types/session.ts +4 -3
- package/src/utils/agent/request.ts +3 -3
- package/src/utils/dom/scrollable.ts +2 -2
- package/src/utils/files/expandedDirs.ts +1 -1
- package/src/utils/files/sortChildren.ts +6 -6
- package/src/utils/format/frontmatter.ts +6 -6
- package/src/utils/image/rewriteMarkdownImageRefs.ts +5 -5
- package/src/utils/markdown/extractFirstH1.ts +2 -2
- package/src/utils/path/relativeLink.ts +15 -15
- package/src/utils/role/icon.ts +2 -2
- package/src/utils/role/merge.ts +2 -2
- package/src/utils/role/plugins.ts +1 -1
- package/src/utils/session/sessionFactory.ts +2 -2
- package/src/utils/session/sessionHelpers.ts +2 -2
- package/src/utils/tools/dedup.ts +4 -4
- package/src/utils/tools/result.ts +3 -3
- package/src/utils/types.ts +2 -2
|
@@ -96,7 +96,7 @@ ${this.parser.parse(Ph)}</blockquote>
|
|
|
96
96
|
${Ph}</tr>
|
|
97
97
|
`}tablecell(Ph){let Fh=this.parser.parseInline(Ph.tokens),Ih=Ph.header?`th`:`td`;return(Ph.align?`<${Ih} align="${Ph.align}">`:`<${Ih}>`)+Fh+`</${Ih}>
|
|
98
98
|
`}strong({tokens:Ph}){return`<strong>${this.parser.parseInline(Ph)}</strong>`}em({tokens:Ph}){return`<em>${this.parser.parseInline(Ph)}</em>`}codespan({text:Ph}){return`<code>${O$5(Ph,!0)}</code>`}br(Ph){return`<br>`}del({tokens:Ph}){return`<del>${this.parser.parseInline(Ph)}</del>`}link({href:Ph,title:Fh,tokens:Ih}){let Lh=this.parser.parseInline(Ih),Rh=J$5(Ph);if(Rh===null)return Lh;Ph=Rh;let zh=`<a href="`+Ph+`"`;return Fh&&(zh+=` title="`+O$5(Fh)+`"`),zh+=`>`+Lh+`</a>`,zh}image({href:Ph,title:Fh,text:Ih,tokens:Lh}){Lh&&(Ih=this.parser.parseInline(Lh,this.parser.textRenderer));let Rh=J$5(Ph);if(Rh===null)return O$5(Ih);Ph=Rh;let zh=`<img src="${Ph}" alt="${O$5(Ih)}"`;return Fh&&(zh+=` title="${O$5(Fh)}"`),zh+=`>`,zh}text(Ph){return`tokens`in Ph&&Ph.tokens?this.parser.parseInline(Ph.tokens):`escaped`in Ph&&Ph.escaped?Ph.text:O$5(Ph.text)}},L$6=class{strong({text:Ph}){return Ph}em({text:Ph}){return Ph}codespan({text:Ph}){return Ph}del({text:Ph}){return Ph}html({text:Ph}){return Ph}text({text:Ph}){return Ph}link({text:Ph}){return``+Ph}image({text:Ph}){return``+Ph}br(){return``}checkbox({raw:Ph}){return Ph}},b$4=class Ph{options;renderer;textRenderer;constructor(Ph){this.options=Ph||T$5,this.options.renderer=this.options.renderer||new y$3,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new L$6}static parse(Fh,Ih){return new Ph(Ih).parse(Fh)}static parseInline(Fh,Ih){return new Ph(Ih).parseInline(Fh)}parse(Ph){this.renderer.parser=this;let Fh=``;for(let Ih=0;Ih<Ph.length;Ih++){let Lh=Ph[Ih];if(this.options.extensions?.renderers?.[Lh.type]){let Ph=Lh,Ih=this.options.extensions.renderers[Ph.type].call({parser:this},Ph);if(Ih!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(Ph.type)){Fh+=Ih||``;continue}}let Rh=Lh;switch(Rh.type){case`space`:Fh+=this.renderer.space(Rh);break;case`hr`:Fh+=this.renderer.hr(Rh);break;case`heading`:Fh+=this.renderer.heading(Rh);break;case`code`:Fh+=this.renderer.code(Rh);break;case`table`:Fh+=this.renderer.table(Rh);break;case`blockquote`:Fh+=this.renderer.blockquote(Rh);break;case`list`:Fh+=this.renderer.list(Rh);break;case`checkbox`:Fh+=this.renderer.checkbox(Rh);break;case`html`:Fh+=this.renderer.html(Rh);break;case`def`:Fh+=this.renderer.def(Rh);break;case`paragraph`:Fh+=this.renderer.paragraph(Rh);break;case`text`:Fh+=this.renderer.text(Rh);break;default:{let Ph=`Token with "`+Rh.type+`" type was not found.`;if(this.options.silent)return console.error(Ph),``;throw Error(Ph)}}}return Fh}parseInline(Ph,Fh=this.renderer){this.renderer.parser=this;let Ih=``;for(let Lh=0;Lh<Ph.length;Lh++){let Rh=Ph[Lh];if(this.options.extensions?.renderers?.[Rh.type]){let Ph=this.options.extensions.renderers[Rh.type].call({parser:this},Rh);if(Ph!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(Rh.type)){Ih+=Ph||``;continue}}let zh=Rh;switch(zh.type){case`escape`:Ih+=Fh.text(zh);break;case`html`:Ih+=Fh.html(zh);break;case`link`:Ih+=Fh.link(zh);break;case`image`:Ih+=Fh.image(zh);break;case`checkbox`:Ih+=Fh.checkbox(zh);break;case`strong`:Ih+=Fh.strong(zh);break;case`em`:Ih+=Fh.em(zh);break;case`codespan`:Ih+=Fh.codespan(zh);break;case`br`:Ih+=Fh.br(zh);break;case`del`:Ih+=Fh.del(zh);break;case`text`:Ih+=Fh.text(zh);break;default:{let Ph=`Token with "`+zh.type+`" type was not found.`;if(this.options.silent)return console.error(Ph),``;throw Error(Ph)}}}return Ih}},P$5=class{options;block;constructor(Ph){this.options=Ph||T$5}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(Ph){return Ph}postprocess(Ph){return Ph}processAllTokens(Ph){return Ph}emStrongMask(Ph){return Ph}provideLexer(Ph=this.block){return Ph?x$4.lex:x$4.lexInline}provideParser(Ph=this.block){return Ph?b$4.parse:b$4.parseInline}},D$5=class{defaults=z$6();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=b$4;Renderer=y$3;TextRenderer=L$6;Lexer=x$4;Tokenizer=w$5;Hooks=P$5;constructor(...Ph){this.use(...Ph)}walkTokens(Ph,Fh){let Ih=[];for(let Lh of Ph)switch(Ih=Ih.concat(Fh.call(this,Lh)),Lh.type){case`table`:{let Ph=Lh;for(let Lh of Ph.header)Ih=Ih.concat(this.walkTokens(Lh.tokens,Fh));for(let Lh of Ph.rows)for(let Ph of Lh)Ih=Ih.concat(this.walkTokens(Ph.tokens,Fh));break}case`list`:{let Ph=Lh;Ih=Ih.concat(this.walkTokens(Ph.items,Fh));break}default:{let Ph=Lh;this.defaults.extensions?.childTokens?.[Ph.type]?this.defaults.extensions.childTokens[Ph.type].forEach(Lh=>{let Rh=Ph[Lh].flat(1/0);Ih=Ih.concat(this.walkTokens(Rh,Fh))}):Ph.tokens&&(Ih=Ih.concat(this.walkTokens(Ph.tokens,Fh)))}}return Ih}use(...Ph){let Fh=this.defaults.extensions||{renderers:{},childTokens:{}};return Ph.forEach(Ph=>{let Ih={...Ph};if(Ih.async=this.defaults.async||Ih.async||!1,Ph.extensions&&(Ph.extensions.forEach(Ph=>{if(!Ph.name)throw Error(`extension name required`);if(`renderer`in Ph){let Ih=Fh.renderers[Ph.name];Ih?Fh.renderers[Ph.name]=function(...Fh){let Lh=Ph.renderer.apply(this,Fh);return Lh===!1&&(Lh=Ih.apply(this,Fh)),Lh}:Fh.renderers[Ph.name]=Ph.renderer}if(`tokenizer`in Ph){if(!Ph.level||Ph.level!==`block`&&Ph.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let Ih=Fh[Ph.level];Ih?Ih.unshift(Ph.tokenizer):Fh[Ph.level]=[Ph.tokenizer],Ph.start&&(Ph.level===`block`?Fh.startBlock?Fh.startBlock.push(Ph.start):Fh.startBlock=[Ph.start]:Ph.level===`inline`&&(Fh.startInline?Fh.startInline.push(Ph.start):Fh.startInline=[Ph.start]))}`childTokens`in Ph&&Ph.childTokens&&(Fh.childTokens[Ph.name]=Ph.childTokens)}),Ih.extensions=Fh),Ph.renderer){let Fh=this.defaults.renderer||new y$3(this.defaults);for(let Ih in Ph.renderer){if(!(Ih in Fh))throw Error(`renderer '${Ih}' does not exist`);if([`options`,`parser`].includes(Ih))continue;let Lh=Ih,Rh=Ph.renderer[Lh],zh=Fh[Lh];Fh[Lh]=(...Ph)=>{let Ih=Rh.apply(Fh,Ph);return Ih===!1&&(Ih=zh.apply(Fh,Ph)),Ih||``}}Ih.renderer=Fh}if(Ph.tokenizer){let Fh=this.defaults.tokenizer||new w$5(this.defaults);for(let Ih in Ph.tokenizer){if(!(Ih in Fh))throw Error(`tokenizer '${Ih}' does not exist`);if([`options`,`rules`,`lexer`].includes(Ih))continue;let Lh=Ih,Rh=Ph.tokenizer[Lh],zh=Fh[Lh];Fh[Lh]=(...Ph)=>{let Ih=Rh.apply(Fh,Ph);return Ih===!1&&(Ih=zh.apply(Fh,Ph)),Ih}}Ih.tokenizer=Fh}if(Ph.hooks){let Fh=this.defaults.hooks||new P$5;for(let Ih in Ph.hooks){if(!(Ih in Fh))throw Error(`hook '${Ih}' does not exist`);if([`options`,`block`].includes(Ih))continue;let Lh=Ih,Rh=Ph.hooks[Lh],zh=Fh[Lh];P$5.passThroughHooks.has(Ih)?Fh[Lh]=Ph=>{if(this.defaults.async&&P$5.passThroughHooksRespectAsync.has(Ih))return(async()=>{let Ih=await Rh.call(Fh,Ph);return zh.call(Fh,Ih)})();let Lh=Rh.call(Fh,Ph);return zh.call(Fh,Lh)}:Fh[Lh]=(...Ph)=>{if(this.defaults.async)return(async()=>{let Ih=await Rh.apply(Fh,Ph);return Ih===!1&&(Ih=await zh.apply(Fh,Ph)),Ih})();let Ih=Rh.apply(Fh,Ph);return Ih===!1&&(Ih=zh.apply(Fh,Ph)),Ih}}Ih.hooks=Fh}if(Ph.walkTokens){let Fh=this.defaults.walkTokens,Lh=Ph.walkTokens;Ih.walkTokens=function(Ph){let Ih=[];return Ih.push(Lh.call(this,Ph)),Fh&&(Ih=Ih.concat(Fh.call(this,Ph))),Ih}}this.defaults={...this.defaults,...Ih}}),this}setOptions(Ph){return this.defaults={...this.defaults,...Ph},this}lexer(Ph,Fh){return x$4.lex(Ph,Fh??this.defaults)}parser(Ph,Fh){return b$4.parse(Ph,Fh??this.defaults)}parseMarkdown(Ph){return(Fh,Ih)=>{let Lh={...Ih},Rh={...this.defaults,...Lh},zh=this.onError(!!Rh.silent,!!Rh.async);if(this.defaults.async===!0&&Lh.async===!1)return zh(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof Fh>`u`||Fh===null)return zh(Error(`marked(): input parameter is undefined or null`));if(typeof Fh!=`string`)return zh(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(Fh)+`, string expected`));if(Rh.hooks&&(Rh.hooks.options=Rh,Rh.hooks.block=Ph),Rh.async)return(async()=>{let Ih=Rh.hooks?await Rh.hooks.preprocess(Fh):Fh,Lh=await(Rh.hooks?await Rh.hooks.provideLexer(Ph):Ph?x$4.lex:x$4.lexInline)(Ih,Rh),zh=Rh.hooks?await Rh.hooks.processAllTokens(Lh):Lh;Rh.walkTokens&&await Promise.all(this.walkTokens(zh,Rh.walkTokens));let Bh=await(Rh.hooks?await Rh.hooks.provideParser(Ph):Ph?b$4.parse:b$4.parseInline)(zh,Rh);return Rh.hooks?await Rh.hooks.postprocess(Bh):Bh})().catch(zh);try{Rh.hooks&&(Fh=Rh.hooks.preprocess(Fh));let Ih=(Rh.hooks?Rh.hooks.provideLexer(Ph):Ph?x$4.lex:x$4.lexInline)(Fh,Rh);Rh.hooks&&(Ih=Rh.hooks.processAllTokens(Ih)),Rh.walkTokens&&this.walkTokens(Ih,Rh.walkTokens);let Lh=(Rh.hooks?Rh.hooks.provideParser(Ph):Ph?b$4.parse:b$4.parseInline)(Ih,Rh);return Rh.hooks&&(Lh=Rh.hooks.postprocess(Lh)),Lh}catch(Ph){return zh(Ph)}}}onError(Ph,Fh){return Ih=>{if(Ih.message+=`
|
|
99
|
-
Please report this to https://github.com/markedjs/marked.`,Ph){let Ph=`<p>An error occurred:</p><pre>`+O$5(Ih.message+``,!0)+`</pre>`;return Fh?Promise.resolve(Ph):Ph}if(Fh)return Promise.reject(Ih);throw Ih}}},M$5=new D$5;function g$3(Ph,Fh){return M$5.parse(Ph,Fh)}g$3.options=g$3.setOptions=function(Ph){return M$5.setOptions(Ph),g$3.defaults=M$5.defaults,G$5(g$3.defaults),g$3},g$3.getDefaults=z$6,g$3.defaults=T$5,g$3.use=function(...Ph){return M$5.use(...Ph),g$3.defaults=M$5.defaults,G$5(g$3.defaults),g$3},g$3.walkTokens=function(Ph,Fh){return M$5.walkTokens(Ph,Fh)},g$3.parseInline=M$5.parseInline,g$3.Parser=b$4,g$3.parser=b$4.parse,g$3.Renderer=y$3,g$3.TextRenderer=L$6,g$3.Lexer=x$4,g$3.lexer=x$4.lex,g$3.Tokenizer=w$5,g$3.Hooks=P$5,g$3.parse=g$3;var jt$2=g$3.options,Ft$2=g$3.setOptions,Ut$2=g$3.use,Kt$2=g$3.walkTokens,Wt$2=g$3.parseInline,Xt$2=g$3,Jt$2=b$4.parse,Vt$2=x$4.lex;function isCrossOriginHttpUrl(Ph,Fh){if(!Ph.startsWith(`http://`)&&!Ph.startsWith(`https://`))return!1;try{return new URL(Ph).origin!==Fh}catch{return!1}}function handleExternalLinkClick(Ph){if(Ph.button!==0||Ph.ctrlKey||Ph.metaKey||Ph.shiftKey)return!1;let Fh=Ph.target;if(!Fh)return!1;let Ih=Fh.closest(`a`);if(!Ih)return!1;let Lh=Ih.href;return isCrossOriginHttpUrl(Lh,window.location.origin)?(Ph.preventDefault(),window.open(Lh,`_blank`,`noopener,noreferrer`),!0):!1}var EVENT_TYPES={status:`status`,text:`text`,toolCall:`tool_call`,toolCallResult:`tool_call_result`,toolResult:`tool_result`,switchRole:`switch_role`,error:`error`,claudeSessionId:`claude_session_id`,sessionFinished:`session_finished`,sessionMeta:`session_meta`,rolesUpdated:`roles_updated`,generationStarted:`generation_started`,generationFinished:`generation_finished`},GENERATION_KINDS={beatImage:`beatImage`,characterImage:`characterImage`,beatAudio:`beatAudio`,movie:`movie`};function generationKey(Ph,Fh,Ih){return`${Ph}\u001f${Fh}\u001f${Ih}`}var CHAT_SERVICE_ROUTES={message:`/api/transports/:transportId/chats/:externalChatId`,connect:`/api/transports/:transportId/chats/:externalChatId/connect`},API_ROUTES={health:`/api/health`,sandbox:`/api/sandbox`,agent:{run:`/api/agent`,cancel:`/api/agent/cancel`,internal:{toolResult:`/api/internal/tool-result`,switchRole:`/api/internal/switch-role`}},chart:{present:`/api/present-chart`},chatIndex:{rebuild:`/api/chat-index/rebuild`},chatService:CHAT_SERVICE_ROUTES,config:{base:`/api/config`,settings:`/api/config/settings`,mcp:`/api/config/mcp`,workspaceDirs:`/api/config/workspace-dirs`,referenceDirs:`/api/config/reference-dirs`,schedulerOverrides:`/api/config/scheduler-overrides`},files:{tree:`/api/files/tree`,dir:`/api/files/dir`,content:`/api/files/content`,raw:`/api/files/raw`,refRoots:`/api/files/ref-roots`},html:{generate:`/api/generate-html`,edit:`/api/edit-html`,present:`/api/present-html`},image:{generate:`/api/generate-image`,edit:`/api/edit-image`,upload:`/api/images`,update:`/api/images/:filename`},mcpTools:{list:`/api/mcp-tools`,invoke:`/api/mcp-tools/:tool`},notifications:{test:`/api/notifications/test`},mulmoScript:{save:`/api/mulmo-script`,updateBeat:`/api/mulmo-script/update-beat`,updateScript:`/api/mulmo-script/update-script`,beatImage:`/api/mulmo-script/beat-image`,beatAudio:`/api/mulmo-script/beat-audio`,generateBeatAudio:`/api/mulmo-script/generate-beat-audio`,renderBeat:`/api/mulmo-script/render-beat`,uploadBeatImage:`/api/mulmo-script/upload-beat-image`,characterImage:`/api/mulmo-script/character-image`,renderCharacter:`/api/mulmo-script/render-character`,uploadCharacterImage:`/api/mulmo-script/upload-character-image`,movieStatus:`/api/mulmo-script/movie-status`,generateMovie:`/api/mulmo-script/generate-movie`,downloadMovie:`/api/mulmo-script/download-movie`},pdf:{markdown:`/api/pdf/markdown`},plugins:{presentDocument:`/api/present-document`,updateMarkdown:`/api/markdowns/:filename`,presentSpreadsheet:`/api/present-spreadsheet`,updateSpreadsheet:`/api/spreadsheets/:filename`,mindmap:`/api/mindmap`,quiz:`/api/quiz`,form:`/api/form`,canvas:`/api/canvas`,present3d:`/api/present3d`},roles:{list:`/api/roles`,manage:`/api/roles/manage`},scheduler:{base:`/api/scheduler`,tasks:`/api/scheduler/tasks`,task:`/api/scheduler/tasks/:id`,taskRun:`/api/scheduler/tasks/:id/run`,logs:`/api/scheduler/logs`},sessions:{list:`/api/sessions`,detail:`/api/sessions/:id`,markRead:`/api/sessions/:id/mark-read`},skills:{list:`/api/skills`,detail:`/api/skills/:name`,create:`/api/skills`,update:`/api/skills/:name`,remove:`/api/skills/:name`},sources:{list:`/api/sources`,create:`/api/sources`,remove:`/api/sources/:slug`,rebuild:`/api/sources/rebuild`,manage:`/api/sources/manage`},todos:{list:`/api/todos`,dispatch:`/api/todos`,items:`/api/todos/items`,item:`/api/todos/items/:id`,itemMove:`/api/todos/items/:id/move`,columns:`/api/todos/columns`,column:`/api/todos/columns/:id`,columnsOrder:`/api/todos/columns/order`},wiki:{base:`/api/wiki`}};function errorMessage(Ph){return Ph instanceof Error?Ph.message:String(Ph)}function isRecord(Ph){return typeof Ph==`object`&&!!Ph&&!Array.isArray(Ph)}function isObj(Ph){return typeof Ph==`object`&&!!Ph}function hasStringProp(Ph,Fh){return isRecord(Ph)&&typeof Ph[Fh]==`string`}var authToken=null;function setAuthToken(Ph){authToken=Ph}function buildQueryString(Ph){if(!Ph)return``;let Fh=[];for(let[Ih,Lh]of Object.entries(Ph))Lh!==void 0&&Fh.push(`${encodeURIComponent(Ih)}=${encodeURIComponent(String(Lh))}`);return Fh.length===0?``:`?${Fh.join(`&`)}`}function buildHeaders(Ph,Fh){let Ih={...Ph.headers??{}};return Fh&&Ih[`Content-Type`]===void 0&&(Ih[`Content-Type`]=`application/json`),authToken&&Ih.Authorization===void 0&&(Ih.Authorization=`Bearer ${authToken}`),Ih}async function extractError(Ph){let Fh=Ph.status;try{let Ih=await Ph.clone().json();if(hasStringProp(Ih,`error`))return{error:Ih.error,status:Fh}}catch{}return{error:Ph.statusText||`Request failed (${Fh})`,status:Fh}}async function apiCall(Ph,Fh={}){let Ih=Fh.method??`GET`,Lh=Fh.body!==void 0,Rh=`${Ph}${buildQueryString(Fh.query)}`,zh={method:Ih,headers:buildHeaders(Fh,Lh),signal:Fh.signal};Lh&&(zh.body=JSON.stringify(Fh.body));let Bh;try{Bh=await fetch(Rh,zh)}catch(Ph){return{ok:!1,error:errorMessage(Ph),status:0}}if(!Bh.ok){let{error:Ph,status:Fh}=await extractError(Bh);return{ok:!1,error:Ph,status:Fh}}try{return{ok:!0,data:await Bh.json()}}catch(Ph){return{ok:!1,error:`Invalid JSON response: ${errorMessage(Ph)}`,status:Bh.status}}}function apiGet(Ph,Fh,Ih={}){return apiCall(Ph,{...Ih,method:`GET`,query:Fh})}function apiPost(Ph,Fh,Ih={}){return apiCall(Ph,{...Ih,method:`POST`,body:Fh})}function apiPut(Ph,Fh,Ih={}){return apiCall(Ph,{...Ih,method:`PUT`,body:Fh})}function apiDelete(Ph,Fh,Ih={}){return apiCall(Ph,{...Ih,method:`DELETE`,body:Fh})}async function apiFetchRaw(Ph,Fh={}){let Ih=`${Ph}${buildQueryString(Fh.query)}`,Lh={method:Fh.method??`GET`,headers:buildHeaders(Fh,!1),body:Fh.body,signal:Fh.signal};return fetch(Ih,Lh)}function usePdfDownload(){let Ph=ref(!1),Fh=ref(null);async function Ih(Ih,Lh){Fh.value=null,Ph.value=!0;let Rh=null;try{let Ph=await apiFetchRaw(API_ROUTES.pdf.markdown,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({markdown:Ih,filename:Lh})});if(!Ph.ok){let Ih=await Ph.text().catch(()=>``);Fh.value=`PDF error ${Ph.status}: ${Ih}`;return}let zh=await Ph.blob();Rh=URL.createObjectURL(zh);let Bh=document.createElement(`a`);Bh.href=Rh,Bh.download=Lh,Bh.click()}catch(Ph){Fh.value=errorMessage(Ph)}finally{Rh&&URL.revokeObjectURL(Rh),Ph.value=!1}}return{pdfDownloading:Ph,pdfError:Fh,downloadPdf:Ih}}function useClipboardCopy(Ph=2e3){let Fh=ref(!1);async function Ih(Ih){try{await navigator.clipboard.writeText(Ih),Fh.value=!0,setTimeout(()=>{Fh.value=!1},Ph)}catch{}}return{copied:Fh,copy:Ih}}var _hoisted_1$59={class:`h-full flex flex-col`},_hoisted_2$56={key:0,class:`flex justify-end px-4 py-2 border-b border-gray-100 shrink-0`},_hoisted_3$54={class:`button-group`},_hoisted_4$43=[`disabled`],_hoisted_5$40={class:`material-icons`},_hoisted_6$37=[`title`],_hoisted_7$34={class:`text-response-container`},_hoisted_8$32={class:`text-response-content-wrapper`},_hoisted_9$30={class:`p-6`},_hoisted_10$27={class:`max-w-3xl mx-auto space-y-4`},_hoisted_11$25={class:`flex justify-between items-start mb-2 text-sm text-gray-500`},_hoisted_12$22={class:`font-medium text-gray-700`},_hoisted_13$20={key:0,class:`italic`},_hoisted_14$19=[`innerHTML`],_hoisted_15$19=[`disabled`],_hoisted_16$18=[`title`],_hoisted_17$16={class:`material-icons`},View_vue_vue_type_script_setup_true_lang_default$14=defineComponent({__name:`View`,props:{selectedResult:{},editable:{type:Boolean,default:!0},editableSource:{default:void 0}},emits:[`updateResult`,`updateSource`],setup(Ph,{emit:Fh}){let Ih=Ph,Lh=Fh,Rh=computed(()=>Ih.selectedResult.data?.text??``),zh=computed(()=>Ih.editableSource===void 0?Rh.value:Ih.editableSource),Bh=ref(zh.value);watch(zh,Ph=>{Bh.value=Ph});let Vh=computed(()=>Ih.selectedResult.data?.role??`assistant`),Hh=computed(()=>Ih.selectedResult.data?.transportKind??``),Uh=computed(()=>{if(!Rh.value)return``;let Ph=Rh.value,Fh=Ph.trim();if(Fh.startsWith(`{`)&&Fh.endsWith(`}`)||Fh.startsWith(`[`)&&Fh.endsWith(`]`))try{JSON.parse(Fh),Ph="```json\n"+Fh+"\n```"}catch{}return Ph=Ph.replace(/<think>([\s\S]*?)<\/think>/g,(Ph,Fh)=>`<div class="think-block">${g$3(Fh.trim())}</div>`),g$3(Ph,{breaks:!0,gfm:!0})}),Wh=computed(()=>{switch(Vh.value){case`system`:return`System`;case`user`:return`You`;default:return`Assistant`}}),Gh=computed(()=>{switch(Vh.value){case`system`:return`bg-blue-50 border-blue-200`;case`user`:return`bg-green-50 border-green-200`;default:return`bg-purple-50 border-purple-200`}}),Kh=computed(()=>Bh.value!==zh.value);function qh(){Kh.value&&(Ih.editableSource===void 0?Lh(`updateResult`,{...Ih.selectedResult,data:{...Ih.selectedResult.data,text:Bh.value}}):Lh(`updateSource`,Bh.value),$h.value&&($h.value.open=!1))}let Jh=computed(()=>(Ih.selectedResult.data?.role??`assistant`)===`assistant`);function Yh(Ph){handleExternalLinkClick(Ph)}let{pdfDownloading:Xh,pdfError:Zh,downloadPdf:Qh}=usePdfDownload(),$h=ref(),eg=ref(!1);function tg(Ph){eg.value=Ph.target.open}onMounted(()=>{$h.value?.addEventListener(`toggle`,tg)}),onBeforeUnmount(()=>{$h.value?.removeEventListener(`toggle`,tg)});function ng(){$h.value&&($h.value.open=!1),Bh.value=zh.value}let{copied:rg,copy:ig}=useClipboardCopy();async function ag(){await ig(Ih.selectedResult.data?.text??``)}async function og(){await Qh(Ih.selectedResult.data?.text??``,`${Ih.selectedResult.title??`response`}.pdf`)}return(Fh,Ih)=>(openBlock(),createElementBlock(`div`,_hoisted_1$59,[Jh.value?(openBlock(),createElementBlock(`div`,_hoisted_2$56,[createBaseVNode(`div`,_hoisted_3$54,[createBaseVNode(`button`,{class:`download-btn download-btn-green`,disabled:unref(Xh),onClick:og},[createBaseVNode(`span`,_hoisted_5$40,toDisplayString(unref(Xh)?`hourglass_empty`:`download`),1),Ih[1]||=createTextVNode(` PDF `,-1)],8,_hoisted_4$43)]),unref(Zh)?(openBlock(),createElementBlock(`span`,{key:0,class:`text-xs text-red-500 self-center ml-2`,title:unref(Zh)},`⚠ PDF failed`,8,_hoisted_6$37)):createCommentVNode(``,!0)])):createCommentVNode(``,!0),createBaseVNode(`div`,{class:`flex-1 overflow-hidden relative`,onClickCapture:Yh},[createBaseVNode(`div`,_hoisted_7$34,[createBaseVNode(`div`,_hoisted_8$32,[createBaseVNode(`div`,_hoisted_9$30,[createBaseVNode(`div`,_hoisted_10$27,[createBaseVNode(`div`,{class:normalizeClass([`rounded-lg border border-gray-300 bg-white shadow-sm p-5`,Gh.value])},[createBaseVNode(`div`,_hoisted_11$25,[createBaseVNode(`span`,_hoisted_12$22,toDisplayString(Wh.value),1),Hh.value?(openBlock(),createElementBlock(`span`,_hoisted_13$20,toDisplayString(Hh.value),1)):createCommentVNode(``,!0)]),createBaseVNode(`div`,{class:`markdown-content prose prose-slate max-w-none leading-relaxed text-gray-900`,innerHTML:Uh.value},null,8,_hoisted_14$19)],2)])])]),Ph.editable?(openBlock(),createElementBlock(`details`,{key:0,ref_key:`detailsEl`,ref:$h,class:`text-response-source`,"data-testid":`text-response-edit`},[Ih[2]||=createBaseVNode(`summary`,{"data-testid":`text-response-edit-summary`},`Edit Text Content`,-1),withDirectives(createBaseVNode(`textarea`,{"onUpdate:modelValue":Ih[0]||=Ph=>Bh.value=Ph,class:`text-response-editor`,spellcheck:`false`,"data-testid":`text-response-edit-textarea`},null,512),[[vModelText,Bh.value]]),createBaseVNode(`button`,{class:`apply-btn`,disabled:!Kh.value,"data-testid":`text-response-apply-btn`,onClick:qh},`Apply Changes`,8,_hoisted_15$19)],512)):createCommentVNode(``,!0)]),withDirectives(createBaseVNode(`button`,{class:`copy-btn`,title:unref(rg)?`Copied!`:`Copy`,onClick:ag},[createBaseVNode(`span`,_hoisted_17$16,toDisplayString(unref(rg)?`check`:`content_copy`),1)],8,_hoisted_16$18),[[vShow,!eg.value]]),withDirectives(createBaseVNode(`button`,{class:`cancel-btn`,onClick:ng},`Cancel`,512),[[vShow,eg.value]])],32)]))}}),_plugin_vue_export_helper_default=(Ph,Fh)=>{let Ih=Ph.__vccOpts||Ph;for(let[Ph,Lh]of Fh)Ih[Ph]=Lh;return Ih},View_default$14=_plugin_vue_export_helper_default(View_vue_vue_type_script_setup_true_lang_default$14,[[`__scopeId`,`data-v-5156fb2a`]]),_hoisted_1$58=[`innerHTML`],Preview_vue_vue_type_script_setup_true_lang_default$14=defineComponent({__name:`Preview`,props:{result:{}},setup(Ph){let Fh=Ph,Ih=computed(()=>Fh.result.data?.text??``),Lh=computed(()=>Fh.result.data?.role??`assistant`),Rh=computed(()=>{switch(Lh.value){case`system`:return`text-blue-700`;case`user`:return`text-green-700 font-medium`;default:return`text-gray-700`}}),zh=computed(()=>g$3(Ih.value,{breaks:!0,gfm:!0}));return(Ph,Fh)=>(openBlock(),createElementBlock(`div`,{class:normalizeClass([`text-sm leading-snug`,Rh.value])},[createBaseVNode(`div`,{class:`preview-markdown`,innerHTML:zh.value},null,8,_hoisted_1$58)],2))}}),Preview_default$14=_plugin_vue_export_helper_default(Preview_vue_vue_type_script_setup_true_lang_default$14,[[`__scopeId`,`data-v-18f55ea0`]]),plugin={...pluginCore,viewComponent:View_default$14,previewComponent:Preview_default$14,samples},textResponse_default={plugin},TOOL_NAME$10=`presentDocument`;function isFilePath(Ph){return Ph.endsWith(`.md`)?Ph.startsWith(`artifacts/documents/`)||Ph.startsWith(`markdowns/`):!1}var toolDefinition$13={type:`function`,name:TOOL_NAME$10,description:`Display a document in markdown format.`,prompt:`Use the ${TOOL_NAME$10} tool when the user asks for a document that combines text with embedded images — guides, reports, tutorials, articles, or any structured content with visuals. Prefer this over standalone image generation when the user wants informational content with supporting visuals.\n\nFormat embedded images as: `,parameters:{type:`object`,properties:{title:{type:`string`,description:`Title for the document`},markdown:{type:`string`,description:`The markdown content to display. Describe embedded images in the following format: . IMPORTANT: For embedded images, you MUST use the EXACT placeholder path '__too_be_replaced_image_path__'.`},filenamePrefix:{type:`string`,description:`Short English filename prefix (without extension). Use lowercase with hyphens, e.g. 'project-summary'. The server sanitizes the value and appends a random id to prevent collisions.`}},required:[`title`,`markdown`,`filenamePrefix`]}};function resolveImageSrc(Ph){return Ph.startsWith(`data:`)?Ph:`${API_ROUTES.files.raw}?path=${encodeURIComponent(Ph)}`}function shouldSkip(Ph){return!!(Ph.startsWith(`data:`)||Ph.startsWith(`http://`)||Ph.startsWith(`https://`)||Ph.startsWith(`/api/`))}function resolveWorkspacePath(Ph,Fh){let Ih=Fh.startsWith(`/`),Lh=[...Ih?[]:Ph.split(`/`).filter(Ph=>Ph!==``&&Ph!==`.`)],Rh=(Ih?Fh.slice(1):Fh).split(`/`);for(let Ph of Rh)if(!(Ph===``||Ph===`.`)){if(Ph===`..`){if(Lh.length===0)return null;Lh.pop();continue}Lh.push(Ph)}return Lh.length===0?null:Lh.join(`/`)}function extractBracketedAlt(Ph){if(!Ph.startsWith(`![`))return null;let Fh=1;for(let Ih=2;Ih<Ph.length;Ih++){let Lh=Ph[Ih];if(Lh===`[`)Fh++;else if(Lh===`]`&&(Fh--,Fh===0))return Ph.slice(2,Ih)}return null}function rewriteImageToken(Ph,Fh){let Ih=(Ph.href??``).trim();if(Ih===``||shouldSkip(Ih))return null;let Lh=resolveWorkspacePath(Fh,Ih);if(Lh===null)return null;let Rh=resolveImageSrc(Lh),zh=extractBracketedAlt(Ph.raw)??Ph.text??``;return Ph.title?`}")`:``}function isSkippable(Ph){return Ph.type===`code`||Ph.type===`codespan`||Ph.type===`html`}function getContainerChildren(Ph){let Fh=Ph;return Array.isArray(Fh.tokens)&&Fh.tokens.length>0?Fh.tokens:Array.isArray(Fh.items)&&Fh.items.length>0?Fh.items:null}function renderContainerChildren(Ph,Fh,Ih,Lh){let Rh=Fh.map(Ph=>Ph.raw??``).join(``);if(Rh===``)return!1;let zh=Ph.indexOf(Rh);if(zh<0)return!1;zh>0&&Lh.push(Ph.slice(0,zh));for(let Ph of Fh)renderToken(Ph,Ih,Lh);let Bh=Ph.slice(zh+Rh.length);return Bh&&Lh.push(Bh),!0}function renderToken(Ph,Fh,Ih){if(isSkippable(Ph)){Ih.push(Ph.raw);return}if(Ph.type===`image`){let Lh=rewriteImageToken(Ph,Fh);Ih.push(Lh??Ph.raw);return}let Lh=Ph.raw??``,Rh=getContainerChildren(Ph);Rh&&renderContainerChildren(Lh,Rh,Fh,Ih)||Ih.push(Lh)}function rewriteMarkdownImageRefs(Ph,Fh=``){let Ih=g$3.lexer(Ph),Lh=[];for(let Ph of Ih)renderToken(Ph,Fh,Lh);return Lh.join(``)}var UNSAFE_FILENAME_CHARS=/[/\\:*?"<>|]/g;function toSafeFilename(Ph,Fh=`download`){return Ph.replace(UNSAFE_FILENAME_CHARS,`_`).trim()||Fh}var _hoisted_1$57={class:`markdown-container`},_hoisted_2$55={key:0,class:`min-h-full p-8 flex items-center justify-center`},_hoisted_3$53={key:1,class:`min-h-full p-8 flex items-center justify-center`},_hoisted_4$42={class:`load-error-banner`,role:`alert`},_hoisted_5$39={key:2,class:`min-h-full p-8 flex items-center justify-center`},_hoisted_6$36={key:0,class:`load-error-banner`,role:`alert`},_hoisted_7$33={class:`markdown-content-wrapper`},_hoisted_8$31={class:`p-4`},_hoisted_9$29={class:`header-row`},_hoisted_10$26={class:`document-title`},_hoisted_11$24={class:`button-group`},_hoisted_12$21=[`disabled`],_hoisted_13$19={class:`material-icons`},_hoisted_14$18=[`title`],_hoisted_15$18=[`innerHTML`],_hoisted_16$17={class:`bottom-bar-wrapper`},_hoisted_17$15={class:`editor-actions`},_hoisted_18$13=[`disabled`],_hoisted_19$13={key:0,class:`save-error`,role:`alert`},_hoisted_20$11=[`title`],_hoisted_21$9={class:`material-icons`},View_vue_vue_type_script_setup_true_lang_default$13=defineComponent({__name:`View`,props:{selectedResult:{}},emits:[`updateResult`],setup(Ph,{emit:Fh}){let Ih=Ph,Lh=Fh,Rh=ref(!1),zh=ref(!1),Bh=ref(null),Vh=ref(null),Hh=ref(``),Uh=ref(``);async function Wh(){Vh.value=null;let Ph=Ih.selectedResult.data?.markdown;if(!Ph){Hh.value=``,Uh.value=``;return}if(isFilePath(Ph)){Rh.value=!0;let Fh=await apiGet(API_ROUTES.files.content,{path:Ph});if(!Fh.ok){Vh.value=Fh.error,Rh.value=!1;return}Hh.value=Fh.data.content??``,Rh.value=!1}else Hh.value=Ph;Uh.value=Hh.value}Wh();let Gh=computed(()=>Uh.value!==Hh.value),Kh=computed(()=>{if(!Hh.value)return``;let Ph=Ih.selectedResult.data?.markdown,Fh=typeof Ph==`string`&&isFilePath(Ph)?Ph.slice(0,Ph.lastIndexOf(`/`)):``;return g$3(rewriteMarkdownImageRefs(Hh.value,Fh))});watch(()=>Ih.selectedResult?.viewState?.scrollToAnchor,Ph=>{Ph&&nextTick$1(()=>{let Fh=document.getElementById(Ph);Fh?Fh.scrollIntoView({behavior:`smooth`,block:`start`}):console.warn(`Anchor element with id "${Ph}" not found`)})});let qh=ref(),Jh=ref(!1),{copied:Yh,copy:Xh}=useClipboardCopy();function Zh(Ph){let Fh=Ph.target.open;Jh.value=Fh,Fh||(Uh.value=Hh.value,Bh.value=null)}function Qh(){qh.value&&(qh.value.open=!1)}async function $h(){await Xh(Hh.value)}let{pdfDownloading:eg,pdfError:tg,downloadPdf:ng}=usePdfDownload();async function rg(){if(!Hh.value)return;let Ph=toSafeFilename(Ih.selectedResult.data?.filenamePrefix||Ih.selectedResult.title||`document`,`document`);await ng(Hh.value,`${Ph}.pdf`)}async function ig(){let Ph=Ih.selectedResult.data?.markdown;if(Ph){if(Bh.value=null,isFilePath(Ph)){zh.value=!0;let Fh=Ph.replace(/^(artifacts\/documents|markdowns)\//,``),Ih=await apiPut(API_ROUTES.plugins.updateMarkdown.replace(`:filename`,Fh),{markdown:Uh.value});if(zh.value=!1,!Ih.ok){Bh.value=`Save failed: ${Ih.error}`;return}}Hh.value=Uh.value,Lh(`updateResult`,{...Ih.selectedResult,data:{...Ih.selectedResult.data,markdown:isFilePath(Ph)?Ph:Uh.value,pdfPath:void 0}}),qh.value&&(qh.value.open=!1)}}return watch(()=>Ih.selectedResult.data?.markdown,()=>{Wh()}),(Fh,Ih)=>(openBlock(),createElementBlock(`div`,_hoisted_1$57,[Rh.value?(openBlock(),createElementBlock(`div`,_hoisted_2$55,[...Ih[1]||=[createBaseVNode(`div`,{class:`text-gray-500`},`Loading document...`,-1)]])):Vh.value&&!Hh.value?(openBlock(),createElementBlock(`div`,_hoisted_3$53,[createBaseVNode(`div`,_hoisted_4$42,`⚠ Failed to load document: `+toDisplayString(Vh.value),1)])):Hh.value?(openBlock(),createElementBlock(Fragment,{key:3},[Vh.value?(openBlock(),createElementBlock(`div`,_hoisted_6$36,` ⚠ Failed to refresh document: `+toDisplayString(Vh.value)+` — showing last successfully loaded content. `,1)):createCommentVNode(``,!0),createBaseVNode(`div`,_hoisted_7$33,[createBaseVNode(`div`,_hoisted_8$31,[createBaseVNode(`div`,_hoisted_9$29,[createBaseVNode(`h1`,_hoisted_10$26,toDisplayString(Ph.selectedResult.title||`Document`),1),createBaseVNode(`div`,_hoisted_11$24,[createBaseVNode(`button`,{class:`download-btn download-btn-green`,disabled:unref(eg),onClick:rg},[createBaseVNode(`span`,_hoisted_13$19,toDisplayString(unref(eg)?`hourglass_empty`:`download`),1),Ih[3]||=createTextVNode(` PDF `,-1)],8,_hoisted_12$21)]),unref(tg)?(openBlock(),createElementBlock(`span`,{key:0,class:`text-xs text-red-500 self-center ml-2`,title:unref(tg)},`⚠ PDF failed`,8,_hoisted_14$18)):createCommentVNode(``,!0)]),createBaseVNode(`div`,{class:`markdown-content prose prose-slate max-w-none`,innerHTML:Kh.value},null,8,_hoisted_15$18)])]),createBaseVNode(`div`,_hoisted_16$17,[createBaseVNode(`details`,{ref_key:`sourceDetails`,ref:qh,class:`markdown-source`,onToggle:Zh},[Ih[4]||=createBaseVNode(`summary`,null,`Edit Markdown Source`,-1),withDirectives(createBaseVNode(`textarea`,{"onUpdate:modelValue":Ih[0]||=Ph=>Uh.value=Ph,class:`markdown-editor`,spellcheck:`false`},null,512),[[vModelText,Uh.value]]),createBaseVNode(`div`,_hoisted_17$15,[createBaseVNode(`button`,{class:`apply-btn`,disabled:!Gh.value||zh.value,onClick:ig},toDisplayString(zh.value?`Saving...`:`Apply Changes`),9,_hoisted_18$13),createBaseVNode(`button`,{class:`cancel-btn`,onClick:Qh},`Cancel`)]),Bh.value?(openBlock(),createElementBlock(`p`,_hoisted_19$13,`⚠ `+toDisplayString(Bh.value),1)):createCommentVNode(``,!0)],544),withDirectives(createBaseVNode(`button`,{class:`copy-btn`,title:unref(Yh)?`Copied!`:`Copy`,onClick:$h},[createBaseVNode(`span`,_hoisted_21$9,toDisplayString(unref(Yh)?`check`:`content_copy`),1)],8,_hoisted_20$11),[[vShow,!Jh.value]])])],64)):(openBlock(),createElementBlock(`div`,_hoisted_5$39,[...Ih[2]||=[createBaseVNode(`div`,{class:`text-gray-500`},`No markdown content available`,-1)]]))]))}}),View_default$13=_plugin_vue_export_helper_default(View_vue_vue_type_script_setup_true_lang_default$13,[[`__scopeId`,`data-v-50422e68`]]);function extractFirstH1(Ph){for(let Fh of splitLines(Ph)){if(Fh.length<2||Fh[0]!==`#`||!isInlineSpace(Fh.charCodeAt(1)))continue;let Ph=Fh.slice(2).trim();if(Ph.length>0)return Ph}return null}function splitLines(Ph){return Ph.split(/\r\n|\r|\n/)}function isInlineSpace(Ph){return Ph===32||Ph===9}var _hoisted_1$56={class:`p-3 bg-purple-100 rounded overflow-hidden`},_hoisted_2$54={class:`text-sm text-gray-800 font-medium truncate`},_hoisted_3$52={key:0,class:`text-xs text-gray-500 mt-1 line-clamp-4 whitespace-pre-line`},Preview_vue_vue_type_script_setup_true_lang_default$13=defineComponent({__name:`Preview`,props:{result:{}},setup(Ph){let Fh=Ph,Ih=ref(``);async function Lh(){let Ph=Fh.result.data?.markdown;if(!Ph||!isFilePath(Ph)){Ih.value=``;return}let Lh=await apiGet(API_ROUTES.files.content,{path:Ph});if(!Lh.ok){Ih.value=``;return}Ih.value=Lh.data.content??``}Lh(),watch(()=>Fh.result.data?.markdown,Lh);let Rh=computed(()=>{if(Fh.result.title)return Fh.result.title;let Ph=zh.value;if(Ph){let Fh=extractFirstH1(Ph);if(Fh)return Fh}return`Markdown Document`}),zh=computed(()=>{let Ph=Fh.result.data?.markdown;return Ph?isFilePath(Ph)?Ih.value:Ph:``});function Bh(Ph){return Ph.split(`
|
|
99
|
+
Please report this to https://github.com/markedjs/marked.`,Ph){let Ph=`<p>An error occurred:</p><pre>`+O$5(Ih.message+``,!0)+`</pre>`;return Fh?Promise.resolve(Ph):Ph}if(Fh)return Promise.reject(Ih);throw Ih}}},M$5=new D$5;function g$3(Ph,Fh){return M$5.parse(Ph,Fh)}g$3.options=g$3.setOptions=function(Ph){return M$5.setOptions(Ph),g$3.defaults=M$5.defaults,G$5(g$3.defaults),g$3},g$3.getDefaults=z$6,g$3.defaults=T$5,g$3.use=function(...Ph){return M$5.use(...Ph),g$3.defaults=M$5.defaults,G$5(g$3.defaults),g$3},g$3.walkTokens=function(Ph,Fh){return M$5.walkTokens(Ph,Fh)},g$3.parseInline=M$5.parseInline,g$3.Parser=b$4,g$3.parser=b$4.parse,g$3.Renderer=y$3,g$3.TextRenderer=L$6,g$3.Lexer=x$4,g$3.lexer=x$4.lex,g$3.Tokenizer=w$5,g$3.Hooks=P$5,g$3.parse=g$3;var jt$2=g$3.options,Ft$2=g$3.setOptions,Ut$2=g$3.use,Kt$2=g$3.walkTokens,Wt$2=g$3.parseInline,Xt$2=g$3,Jt$2=b$4.parse,Vt$2=x$4.lex;function isCrossOriginHttpUrl(Ph,Fh){if(!Ph.startsWith(`http://`)&&!Ph.startsWith(`https://`))return!1;try{return new URL(Ph).origin!==Fh}catch{return!1}}function handleExternalLinkClick(Ph){if(Ph.button!==0||Ph.ctrlKey||Ph.metaKey||Ph.shiftKey)return!1;let Fh=Ph.target;if(!Fh)return!1;let Ih=Fh.closest(`a`);if(!Ih)return!1;let Lh=Ih.href;return isCrossOriginHttpUrl(Lh,window.location.origin)?(Ph.preventDefault(),window.open(Lh,`_blank`,`noopener,noreferrer`),!0):!1}var EVENT_TYPES={status:`status`,text:`text`,toolCall:`tool_call`,toolCallResult:`tool_call_result`,toolResult:`tool_result`,switchRole:`switch_role`,error:`error`,claudeSessionId:`claude_session_id`,sessionFinished:`session_finished`,sessionMeta:`session_meta`,rolesUpdated:`roles_updated`,generationStarted:`generation_started`,generationFinished:`generation_finished`},GENERATION_KINDS={beatImage:`beatImage`,characterImage:`characterImage`,beatAudio:`beatAudio`,movie:`movie`};function generationKey(Ph,Fh,Ih){return`${Ph}\u001f${Fh}\u001f${Ih}`}var CHAT_SERVICE_ROUTES={message:`/api/transports/:transportId/chats/:externalChatId`,connect:`/api/transports/:transportId/chats/:externalChatId/connect`},API_ROUTES={health:`/api/health`,sandbox:`/api/sandbox`,agent:{run:`/api/agent`,cancel:`/api/agent/cancel`,internal:{toolResult:`/api/internal/tool-result`,switchRole:`/api/internal/switch-role`}},chart:{present:`/api/present-chart`},chatIndex:{rebuild:`/api/chat-index/rebuild`},chatService:CHAT_SERVICE_ROUTES,config:{base:`/api/config`,settings:`/api/config/settings`,mcp:`/api/config/mcp`,workspaceDirs:`/api/config/workspace-dirs`,referenceDirs:`/api/config/reference-dirs`,schedulerOverrides:`/api/config/scheduler-overrides`},files:{tree:`/api/files/tree`,dir:`/api/files/dir`,content:`/api/files/content`,raw:`/api/files/raw`,refRoots:`/api/files/ref-roots`},html:{generate:`/api/generate-html`,edit:`/api/edit-html`,present:`/api/present-html`},image:{generate:`/api/generate-image`,edit:`/api/edit-image`,upload:`/api/images`,update:`/api/images/:filename`},mcpTools:{list:`/api/mcp-tools`,invoke:`/api/mcp-tools/:tool`},notifications:{test:`/api/notifications/test`},mulmoScript:{save:`/api/mulmo-script`,updateBeat:`/api/mulmo-script/update-beat`,updateScript:`/api/mulmo-script/update-script`,beatImage:`/api/mulmo-script/beat-image`,beatAudio:`/api/mulmo-script/beat-audio`,generateBeatAudio:`/api/mulmo-script/generate-beat-audio`,renderBeat:`/api/mulmo-script/render-beat`,uploadBeatImage:`/api/mulmo-script/upload-beat-image`,characterImage:`/api/mulmo-script/character-image`,renderCharacter:`/api/mulmo-script/render-character`,uploadCharacterImage:`/api/mulmo-script/upload-character-image`,movieStatus:`/api/mulmo-script/movie-status`,generateMovie:`/api/mulmo-script/generate-movie`,downloadMovie:`/api/mulmo-script/download-movie`},pdf:{markdown:`/api/pdf/markdown`},plugins:{presentDocument:`/api/present-document`,updateMarkdown:`/api/markdowns/:filename`,presentSpreadsheet:`/api/present-spreadsheet`,updateSpreadsheet:`/api/spreadsheets/:filename`,mindmap:`/api/mindmap`,quiz:`/api/quiz`,form:`/api/form`,canvas:`/api/canvas`,present3d:`/api/present3d`},roles:{list:`/api/roles`,manage:`/api/roles/manage`},scheduler:{base:`/api/scheduler`,tasks:`/api/scheduler/tasks`,task:`/api/scheduler/tasks/:id`,taskRun:`/api/scheduler/tasks/:id/run`,logs:`/api/scheduler/logs`},sessions:{list:`/api/sessions`,detail:`/api/sessions/:id`,markRead:`/api/sessions/:id/mark-read`},skills:{list:`/api/skills`,detail:`/api/skills/:name`,create:`/api/skills`,update:`/api/skills/:name`,remove:`/api/skills/:name`},sources:{list:`/api/sources`,create:`/api/sources`,remove:`/api/sources/:slug`,rebuild:`/api/sources/rebuild`,manage:`/api/sources/manage`},todos:{list:`/api/todos`,dispatch:`/api/todos`,items:`/api/todos/items`,item:`/api/todos/items/:id`,itemMove:`/api/todos/items/:id/move`,columns:`/api/todos/columns`,column:`/api/todos/columns/:id`,columnsOrder:`/api/todos/columns/order`},wiki:{base:`/api/wiki`}};function errorMessage(Ph){return Ph instanceof Error?Ph.message:String(Ph)}function isRecord(Ph){return typeof Ph==`object`&&!!Ph&&!Array.isArray(Ph)}function isObj(Ph){return typeof Ph==`object`&&!!Ph}function hasStringProp(Ph,Fh){return isRecord(Ph)&&typeof Ph[Fh]==`string`}var authToken=null;function setAuthToken(Ph){authToken=Ph}function buildQueryString(Ph){if(!Ph)return``;let Fh=[];for(let[Ih,Lh]of Object.entries(Ph))Lh!==void 0&&Fh.push(`${encodeURIComponent(Ih)}=${encodeURIComponent(String(Lh))}`);return Fh.length===0?``:`?${Fh.join(`&`)}`}function buildHeaders(Ph,Fh){let Ih={...Ph.headers??{}};return Fh&&Ih[`Content-Type`]===void 0&&(Ih[`Content-Type`]=`application/json`),authToken&&Ih.Authorization===void 0&&(Ih.Authorization=`Bearer ${authToken}`),Ih}async function extractError(Ph){let Fh=Ph.status;try{let Ih=await Ph.clone().json();if(hasStringProp(Ih,`error`))return{error:Ih.error,status:Fh}}catch{}return{error:Ph.statusText||`Request failed (${Fh})`,status:Fh}}async function apiCall(Ph,Fh={}){let Ih=Fh.method??`GET`,Lh=Fh.body!==void 0,Rh=`${Ph}${buildQueryString(Fh.query)}`,zh={method:Ih,headers:buildHeaders(Fh,Lh),signal:Fh.signal};Lh&&(zh.body=JSON.stringify(Fh.body));let Bh;try{Bh=await fetch(Rh,zh)}catch(Ph){return{ok:!1,error:errorMessage(Ph),status:0}}if(!Bh.ok){let{error:Ph,status:Fh}=await extractError(Bh);return{ok:!1,error:Ph,status:Fh}}try{return{ok:!0,data:await Bh.json()}}catch(Ph){return{ok:!1,error:`Invalid JSON response: ${errorMessage(Ph)}`,status:Bh.status}}}function apiGet(Ph,Fh,Ih={}){return apiCall(Ph,{...Ih,method:`GET`,query:Fh})}function apiPost(Ph,Fh,Ih={}){return apiCall(Ph,{...Ih,method:`POST`,body:Fh})}function apiPut(Ph,Fh,Ih={}){return apiCall(Ph,{...Ih,method:`PUT`,body:Fh})}function apiDelete(Ph,Fh,Ih={}){return apiCall(Ph,{...Ih,method:`DELETE`,body:Fh})}async function apiFetchRaw(Ph,Fh={}){let Ih=`${Ph}${buildQueryString(Fh.query)}`,Lh={method:Fh.method??`GET`,headers:buildHeaders(Fh,!1),body:Fh.body,signal:Fh.signal};return fetch(Ih,Lh)}function usePdfDownload(){let Ph=ref(!1),Fh=ref(null);async function Ih(Ih,Lh){Fh.value=null,Ph.value=!0;let Rh=null;try{let Ph=await apiFetchRaw(API_ROUTES.pdf.markdown,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({markdown:Ih,filename:Lh})});if(!Ph.ok){let Ih=await Ph.text().catch(()=>``);Fh.value=`PDF error ${Ph.status}: ${Ih}`;return}let zh=await Ph.blob();Rh=URL.createObjectURL(zh);let Bh=document.createElement(`a`);Bh.href=Rh,Bh.download=Lh,Bh.click()}catch(Ph){Fh.value=errorMessage(Ph)}finally{Rh&&URL.revokeObjectURL(Rh),Ph.value=!1}}return{pdfDownloading:Ph,pdfError:Fh,downloadPdf:Ih}}function useClipboardCopy(Ph=2e3){let Fh=ref(!1);async function Ih(Ih){try{await navigator.clipboard.writeText(Ih),Fh.value=!0,setTimeout(()=>{Fh.value=!1},Ph)}catch{}}return{copied:Fh,copy:Ih}}var _hoisted_1$59={class:`h-full flex flex-col`},_hoisted_2$56={key:0,class:`flex justify-end px-4 py-2 border-b border-gray-100 shrink-0`},_hoisted_3$54={class:`button-group`},_hoisted_4$43=[`disabled`],_hoisted_5$40={class:`material-icons`},_hoisted_6$37=[`title`],_hoisted_7$34={class:`text-response-container`},_hoisted_8$32={class:`text-response-content-wrapper`},_hoisted_9$30={class:`p-6`},_hoisted_10$27={class:`max-w-3xl mx-auto space-y-4`},_hoisted_11$25={class:`flex justify-between items-start mb-2 text-sm text-gray-500`},_hoisted_12$22={class:`font-medium text-gray-700`},_hoisted_13$20={key:0,class:`italic`},_hoisted_14$19=[`innerHTML`],_hoisted_15$19=[`disabled`],_hoisted_16$18=[`title`],_hoisted_17$16={class:`material-icons`},View_vue_vue_type_script_setup_true_lang_default$14=defineComponent({__name:`View`,props:{selectedResult:{},editable:{type:Boolean,default:!0},editableSource:{default:void 0}},emits:[`updateResult`,`updateSource`],setup(Ph,{emit:Fh}){let Ih=Ph,Lh=Fh,Rh=computed(()=>Ih.selectedResult.data?.text??``),zh=computed(()=>Ih.editableSource===void 0?Rh.value:Ih.editableSource),Bh=ref(zh.value);watch(zh,Ph=>{Bh.value=Ph});let Vh=computed(()=>Ih.selectedResult.data?.role??`assistant`),Hh=computed(()=>Ih.selectedResult.data?.transportKind??``),Uh=computed(()=>{if(!Rh.value)return``;let Ph=Rh.value,Fh=Ph.trim();if(Fh.startsWith(`{`)&&Fh.endsWith(`}`)||Fh.startsWith(`[`)&&Fh.endsWith(`]`))try{JSON.parse(Fh),Ph="```json\n"+Fh+"\n```"}catch{}return Ph=Ph.replace(/<think>([\s\S]*?)<\/think>/g,(Ph,Fh)=>`<div class="think-block">${g$3(Fh.trim())}</div>`),g$3(Ph,{breaks:!0,gfm:!0})}),Wh=computed(()=>{switch(Vh.value){case`system`:return`System`;case`user`:return`You`;default:return`Assistant`}}),Gh=computed(()=>{switch(Vh.value){case`system`:return`bg-blue-50 border-blue-200`;case`user`:return`bg-green-50 border-green-200`;default:return`bg-purple-50 border-purple-200`}}),Kh=computed(()=>Bh.value!==zh.value);function qh(){Kh.value&&(Ih.editableSource===void 0?Lh(`updateResult`,{...Ih.selectedResult,data:{...Ih.selectedResult.data,text:Bh.value}}):Lh(`updateSource`,Bh.value),$h.value&&($h.value.open=!1))}let Jh=computed(()=>(Ih.selectedResult.data?.role??`assistant`)===`assistant`);function Yh(Ph){handleExternalLinkClick(Ph)}let{pdfDownloading:Xh,pdfError:Zh,downloadPdf:Qh}=usePdfDownload(),$h=ref(),eg=ref(!1);function tg(Ph){eg.value=Ph.target.open}onMounted(()=>{$h.value?.addEventListener(`toggle`,tg)}),onBeforeUnmount(()=>{$h.value?.removeEventListener(`toggle`,tg)});function ng(){$h.value&&($h.value.open=!1),Bh.value=zh.value}let{copied:rg,copy:ig}=useClipboardCopy();async function ag(){await ig(Ih.selectedResult.data?.text??``)}async function og(){await Qh(Ih.selectedResult.data?.text??``,`${Ih.selectedResult.title??`response`}.pdf`)}return(Fh,Ih)=>(openBlock(),createElementBlock(`div`,_hoisted_1$59,[Jh.value?(openBlock(),createElementBlock(`div`,_hoisted_2$56,[createBaseVNode(`div`,_hoisted_3$54,[createBaseVNode(`button`,{class:`download-btn download-btn-green`,disabled:unref(Xh),onClick:og},[createBaseVNode(`span`,_hoisted_5$40,toDisplayString(unref(Xh)?`hourglass_empty`:`download`),1),Ih[1]||=createTextVNode(` PDF `,-1)],8,_hoisted_4$43)]),unref(Zh)?(openBlock(),createElementBlock(`span`,{key:0,class:`text-xs text-red-500 self-center ml-2`,title:unref(Zh)},`⚠ PDF failed`,8,_hoisted_6$37)):createCommentVNode(``,!0)])):createCommentVNode(``,!0),createBaseVNode(`div`,{class:`flex-1 overflow-hidden relative`,onClickCapture:Yh},[createBaseVNode(`div`,_hoisted_7$34,[createBaseVNode(`div`,_hoisted_8$32,[createBaseVNode(`div`,_hoisted_9$30,[createBaseVNode(`div`,_hoisted_10$27,[createBaseVNode(`div`,{class:normalizeClass([`rounded-lg border border-gray-300 bg-white shadow-sm p-5`,Gh.value])},[createBaseVNode(`div`,_hoisted_11$25,[createBaseVNode(`span`,_hoisted_12$22,toDisplayString(Wh.value),1),Hh.value?(openBlock(),createElementBlock(`span`,_hoisted_13$20,toDisplayString(Hh.value),1)):createCommentVNode(``,!0)]),createBaseVNode(`div`,{class:`markdown-content prose prose-slate max-w-none leading-relaxed text-gray-900`,innerHTML:Uh.value},null,8,_hoisted_14$19)],2)])])]),Ph.editable?(openBlock(),createElementBlock(`details`,{key:0,ref_key:`detailsEl`,ref:$h,class:`text-response-source`,"data-testid":`text-response-edit`},[Ih[2]||=createBaseVNode(`summary`,{"data-testid":`text-response-edit-summary`},`Edit Text Content`,-1),withDirectives(createBaseVNode(`textarea`,{"onUpdate:modelValue":Ih[0]||=Ph=>Bh.value=Ph,class:`text-response-editor`,spellcheck:`false`,"data-testid":`text-response-edit-textarea`},null,512),[[vModelText,Bh.value]]),createBaseVNode(`button`,{class:`apply-btn`,disabled:!Kh.value,"data-testid":`text-response-apply-btn`,onClick:qh},`Apply Changes`,8,_hoisted_15$19)],512)):createCommentVNode(``,!0)]),withDirectives(createBaseVNode(`button`,{class:`copy-btn`,title:unref(rg)?`Copied!`:`Copy`,onClick:ag},[createBaseVNode(`span`,_hoisted_17$16,toDisplayString(unref(rg)?`check`:`content_copy`),1)],8,_hoisted_16$18),[[vShow,!eg.value]]),withDirectives(createBaseVNode(`button`,{class:`cancel-btn`,onClick:ng},`Cancel`,512),[[vShow,eg.value]])],32)]))}}),_plugin_vue_export_helper_default=(Ph,Fh)=>{let Ih=Ph.__vccOpts||Ph;for(let[Ph,Lh]of Fh)Ih[Ph]=Lh;return Ih},View_default$14=_plugin_vue_export_helper_default(View_vue_vue_type_script_setup_true_lang_default$14,[[`__scopeId`,`data-v-b5047e81`]]),_hoisted_1$58=[`innerHTML`],Preview_vue_vue_type_script_setup_true_lang_default$14=defineComponent({__name:`Preview`,props:{result:{}},setup(Ph){let Fh=Ph,Ih=computed(()=>Fh.result.data?.text??``),Lh=computed(()=>Fh.result.data?.role??`assistant`),Rh=computed(()=>{switch(Lh.value){case`system`:return`text-blue-700`;case`user`:return`text-green-700 font-medium`;default:return`text-gray-700`}}),zh=computed(()=>g$3(Ih.value,{breaks:!0,gfm:!0}));return(Ph,Fh)=>(openBlock(),createElementBlock(`div`,{class:normalizeClass([`text-sm leading-snug`,Rh.value])},[createBaseVNode(`div`,{class:`preview-markdown`,innerHTML:zh.value},null,8,_hoisted_1$58)],2))}}),Preview_default$14=_plugin_vue_export_helper_default(Preview_vue_vue_type_script_setup_true_lang_default$14,[[`__scopeId`,`data-v-18f55ea0`]]),plugin={...pluginCore,viewComponent:View_default$14,previewComponent:Preview_default$14,samples},textResponse_default={plugin},TOOL_NAME$10=`presentDocument`;function isFilePath(Ph){return Ph.endsWith(`.md`)?Ph.startsWith(`artifacts/documents/`)||Ph.startsWith(`markdowns/`):!1}var toolDefinition$13={type:`function`,name:TOOL_NAME$10,description:`Display a document in markdown format.`,prompt:`Use the ${TOOL_NAME$10} tool when the user asks for a document that combines text with embedded images — guides, reports, tutorials, articles, or any structured content with visuals. Prefer this over standalone image generation when the user wants informational content with supporting visuals.\n\nFormat embedded images as: `,parameters:{type:`object`,properties:{title:{type:`string`,description:`Title for the document`},markdown:{type:`string`,description:`The markdown content to display. Describe embedded images in the following format: . IMPORTANT: For embedded images, you MUST use the EXACT placeholder path '__too_be_replaced_image_path__'.`},filenamePrefix:{type:`string`,description:`Short English filename prefix (without extension). Use lowercase with hyphens, e.g. 'project-summary'. The server sanitizes the value and appends a random id to prevent collisions.`}},required:[`title`,`markdown`,`filenamePrefix`]}};function resolveImageSrc(Ph){return Ph.startsWith(`data:`)?Ph:`${API_ROUTES.files.raw}?path=${encodeURIComponent(Ph)}`}function shouldSkip(Ph){return!!(Ph.startsWith(`data:`)||Ph.startsWith(`http://`)||Ph.startsWith(`https://`)||Ph.startsWith(`/api/`))}function resolveWorkspacePath(Ph,Fh){let Ih=Fh.startsWith(`/`),Lh=[...Ih?[]:Ph.split(`/`).filter(Ph=>Ph!==``&&Ph!==`.`)],Rh=(Ih?Fh.slice(1):Fh).split(`/`);for(let Ph of Rh)if(!(Ph===``||Ph===`.`)){if(Ph===`..`){if(Lh.length===0)return null;Lh.pop();continue}Lh.push(Ph)}return Lh.length===0?null:Lh.join(`/`)}function extractBracketedAlt(Ph){if(!Ph.startsWith(`![`))return null;let Fh=1;for(let Ih=2;Ih<Ph.length;Ih++){let Lh=Ph[Ih];if(Lh===`[`)Fh++;else if(Lh===`]`&&(Fh--,Fh===0))return Ph.slice(2,Ih)}return null}function rewriteImageToken(Ph,Fh){let Ih=(Ph.href??``).trim();if(Ih===``||shouldSkip(Ih))return null;let Lh=resolveWorkspacePath(Fh,Ih);if(Lh===null)return null;let Rh=resolveImageSrc(Lh),zh=extractBracketedAlt(Ph.raw)??Ph.text??``;return Ph.title?`}")`:``}function isSkippable(Ph){return Ph.type===`code`||Ph.type===`codespan`||Ph.type===`html`}function getContainerChildren(Ph){let Fh=Ph;return Array.isArray(Fh.tokens)&&Fh.tokens.length>0?Fh.tokens:Array.isArray(Fh.items)&&Fh.items.length>0?Fh.items:null}function renderContainerChildren(Ph,Fh,Ih,Lh){let Rh=Fh.map(Ph=>Ph.raw??``).join(``);if(Rh===``)return!1;let zh=Ph.indexOf(Rh);if(zh<0)return!1;zh>0&&Lh.push(Ph.slice(0,zh));for(let Ph of Fh)renderToken(Ph,Ih,Lh);let Bh=Ph.slice(zh+Rh.length);return Bh&&Lh.push(Bh),!0}function renderToken(Ph,Fh,Ih){if(isSkippable(Ph)){Ih.push(Ph.raw);return}if(Ph.type===`image`){let Lh=rewriteImageToken(Ph,Fh);Ih.push(Lh??Ph.raw);return}let Lh=Ph.raw??``,Rh=getContainerChildren(Ph);Rh&&renderContainerChildren(Lh,Rh,Fh,Ih)||Ih.push(Lh)}function rewriteMarkdownImageRefs(Ph,Fh=``){let Ih=g$3.lexer(Ph),Lh=[];for(let Ph of Ih)renderToken(Ph,Fh,Lh);return Lh.join(``)}var UNSAFE_FILENAME_CHARS=/[/\\:*?"<>|]/g;function toSafeFilename(Ph,Fh=`download`){return Ph.replace(UNSAFE_FILENAME_CHARS,`_`).trim()||Fh}var _hoisted_1$57={class:`markdown-container`},_hoisted_2$55={key:0,class:`min-h-full p-8 flex items-center justify-center`},_hoisted_3$53={key:1,class:`min-h-full p-8 flex items-center justify-center`},_hoisted_4$42={class:`load-error-banner`,role:`alert`},_hoisted_5$39={key:2,class:`min-h-full p-8 flex items-center justify-center`},_hoisted_6$36={key:0,class:`load-error-banner`,role:`alert`},_hoisted_7$33={class:`markdown-content-wrapper`},_hoisted_8$31={class:`p-4`},_hoisted_9$29={class:`header-row`},_hoisted_10$26={class:`document-title`},_hoisted_11$24={class:`button-group`},_hoisted_12$21=[`disabled`],_hoisted_13$19={class:`material-icons`},_hoisted_14$18=[`title`],_hoisted_15$18=[`innerHTML`],_hoisted_16$17={class:`bottom-bar-wrapper`},_hoisted_17$15={class:`editor-actions`},_hoisted_18$13=[`disabled`],_hoisted_19$13={key:0,class:`save-error`,role:`alert`},_hoisted_20$11=[`title`],_hoisted_21$9={class:`material-icons`},View_vue_vue_type_script_setup_true_lang_default$13=defineComponent({__name:`View`,props:{selectedResult:{}},emits:[`updateResult`],setup(Ph,{emit:Fh}){let Ih=Ph,Lh=Fh,Rh=ref(!1),zh=ref(!1),Bh=ref(null),Vh=ref(null),Hh=ref(``),Uh=ref(``);async function Wh(){Vh.value=null;let Ph=Ih.selectedResult.data?.markdown;if(!Ph){Hh.value=``,Uh.value=``;return}if(isFilePath(Ph)){Rh.value=!0;let Fh=await apiGet(API_ROUTES.files.content,{path:Ph});if(!Fh.ok){Vh.value=Fh.error,Rh.value=!1;return}Hh.value=Fh.data.content??``,Rh.value=!1}else Hh.value=Ph;Uh.value=Hh.value}Wh();let Gh=computed(()=>Uh.value!==Hh.value),Kh=computed(()=>{if(!Hh.value)return``;let Ph=Ih.selectedResult.data?.markdown,Fh=typeof Ph==`string`&&isFilePath(Ph)?Ph.slice(0,Ph.lastIndexOf(`/`)):``;return g$3(rewriteMarkdownImageRefs(Hh.value,Fh))});watch(()=>Ih.selectedResult?.viewState?.scrollToAnchor,Ph=>{Ph&&nextTick$1(()=>{let Fh=document.getElementById(Ph);Fh?Fh.scrollIntoView({behavior:`smooth`,block:`start`}):console.warn(`Anchor element with id "${Ph}" not found`)})});let qh=ref(),Jh=ref(!1),{copied:Yh,copy:Xh}=useClipboardCopy();function Zh(Ph){let Fh=Ph.target.open;Jh.value=Fh,Fh||(Uh.value=Hh.value,Bh.value=null)}function Qh(){qh.value&&(qh.value.open=!1)}async function $h(){await Xh(Hh.value)}let{pdfDownloading:eg,pdfError:tg,downloadPdf:ng}=usePdfDownload();async function rg(){if(!Hh.value)return;let Ph=toSafeFilename(Ih.selectedResult.data?.filenamePrefix||Ih.selectedResult.title||`document`,`document`);await ng(Hh.value,`${Ph}.pdf`)}async function ig(){let Ph=Ih.selectedResult.data?.markdown;if(Ph){if(Bh.value=null,isFilePath(Ph)){zh.value=!0;let Fh=Ph.replace(/^(artifacts\/documents|markdowns)\//,``),Ih=await apiPut(API_ROUTES.plugins.updateMarkdown.replace(`:filename`,Fh),{markdown:Uh.value});if(zh.value=!1,!Ih.ok){Bh.value=`Save failed: ${Ih.error}`;return}}Hh.value=Uh.value,Lh(`updateResult`,{...Ih.selectedResult,data:{...Ih.selectedResult.data,markdown:isFilePath(Ph)?Ph:Uh.value,pdfPath:void 0}}),qh.value&&(qh.value.open=!1)}}return watch(()=>Ih.selectedResult.data?.markdown,()=>{Wh()}),(Fh,Ih)=>(openBlock(),createElementBlock(`div`,_hoisted_1$57,[Rh.value?(openBlock(),createElementBlock(`div`,_hoisted_2$55,[...Ih[1]||=[createBaseVNode(`div`,{class:`text-gray-500`},`Loading document...`,-1)]])):Vh.value&&!Hh.value?(openBlock(),createElementBlock(`div`,_hoisted_3$53,[createBaseVNode(`div`,_hoisted_4$42,`⚠ Failed to load document: `+toDisplayString(Vh.value),1)])):Hh.value?(openBlock(),createElementBlock(Fragment,{key:3},[Vh.value?(openBlock(),createElementBlock(`div`,_hoisted_6$36,` ⚠ Failed to refresh document: `+toDisplayString(Vh.value)+` — showing last successfully loaded content. `,1)):createCommentVNode(``,!0),createBaseVNode(`div`,_hoisted_7$33,[createBaseVNode(`div`,_hoisted_8$31,[createBaseVNode(`div`,_hoisted_9$29,[createBaseVNode(`h1`,_hoisted_10$26,toDisplayString(Ph.selectedResult.title||`Document`),1),createBaseVNode(`div`,_hoisted_11$24,[createBaseVNode(`button`,{class:`download-btn download-btn-green`,disabled:unref(eg),onClick:rg},[createBaseVNode(`span`,_hoisted_13$19,toDisplayString(unref(eg)?`hourglass_empty`:`download`),1),Ih[3]||=createTextVNode(` PDF `,-1)],8,_hoisted_12$21)]),unref(tg)?(openBlock(),createElementBlock(`span`,{key:0,class:`text-xs text-red-500 self-center ml-2`,title:unref(tg)},`⚠ PDF failed`,8,_hoisted_14$18)):createCommentVNode(``,!0)]),createBaseVNode(`div`,{class:`markdown-content prose prose-slate max-w-none`,innerHTML:Kh.value},null,8,_hoisted_15$18)])]),createBaseVNode(`div`,_hoisted_16$17,[createBaseVNode(`details`,{ref_key:`sourceDetails`,ref:qh,class:`markdown-source`,onToggle:Zh},[Ih[4]||=createBaseVNode(`summary`,null,`Edit Markdown Source`,-1),withDirectives(createBaseVNode(`textarea`,{"onUpdate:modelValue":Ih[0]||=Ph=>Uh.value=Ph,class:`markdown-editor`,spellcheck:`false`},null,512),[[vModelText,Uh.value]]),createBaseVNode(`div`,_hoisted_17$15,[createBaseVNode(`button`,{class:`apply-btn`,disabled:!Gh.value||zh.value,onClick:ig},toDisplayString(zh.value?`Saving...`:`Apply Changes`),9,_hoisted_18$13),createBaseVNode(`button`,{class:`cancel-btn`,onClick:Qh},`Cancel`)]),Bh.value?(openBlock(),createElementBlock(`p`,_hoisted_19$13,`⚠ `+toDisplayString(Bh.value),1)):createCommentVNode(``,!0)],544),withDirectives(createBaseVNode(`button`,{class:`copy-btn`,title:unref(Yh)?`Copied!`:`Copy`,onClick:$h},[createBaseVNode(`span`,_hoisted_21$9,toDisplayString(unref(Yh)?`check`:`content_copy`),1)],8,_hoisted_20$11),[[vShow,!Jh.value]])])],64)):(openBlock(),createElementBlock(`div`,_hoisted_5$39,[...Ih[2]||=[createBaseVNode(`div`,{class:`text-gray-500`},`No markdown content available`,-1)]]))]))}}),View_default$13=_plugin_vue_export_helper_default(View_vue_vue_type_script_setup_true_lang_default$13,[[`__scopeId`,`data-v-c40dc609`]]);function extractFirstH1(Ph){for(let Fh of splitLines(Ph)){if(Fh.length<2||Fh[0]!==`#`||!isInlineSpace(Fh.charCodeAt(1)))continue;let Ph=Fh.slice(2).trim();if(Ph.length>0)return Ph}return null}function splitLines(Ph){return Ph.split(/\r\n|\r|\n/)}function isInlineSpace(Ph){return Ph===32||Ph===9}var _hoisted_1$56={class:`p-3 bg-purple-100 rounded overflow-hidden`},_hoisted_2$54={class:`text-sm text-gray-800 font-medium truncate`},_hoisted_3$52={key:0,class:`text-xs text-gray-500 mt-1 line-clamp-4 whitespace-pre-line`},Preview_vue_vue_type_script_setup_true_lang_default$13=defineComponent({__name:`Preview`,props:{result:{}},setup(Ph){let Fh=Ph,Ih=ref(``);async function Lh(){let Ph=Fh.result.data?.markdown;if(!Ph||!isFilePath(Ph)){Ih.value=``;return}let Lh=await apiGet(API_ROUTES.files.content,{path:Ph});if(!Lh.ok){Ih.value=``;return}Ih.value=Lh.data.content??``}Lh(),watch(()=>Fh.result.data?.markdown,Lh);let Rh=computed(()=>{if(Fh.result.title)return Fh.result.title;let Ph=zh.value;if(Ph){let Fh=extractFirstH1(Ph);if(Fh)return Fh}return`Markdown Document`}),zh=computed(()=>{let Ph=Fh.result.data?.markdown;return Ph?isFilePath(Ph)?Ih.value:Ph:``});function Bh(Ph){return Ph.split(`
|
|
100
100
|
`).filter(Ph=>!/^#{1,6}\s/.test(Ph)&&Ph.trim()!==``).map(Ph=>Ph.replace(/[*_`~[\]]/g,``).trim()).filter(Boolean).slice(0,6).join(`
|
|
101
101
|
`)}let Vh=computed(()=>{let Ph=zh.value;return Ph?Bh(Ph):``});return(Ph,Fh)=>(openBlock(),createElementBlock(`div`,_hoisted_1$56,[createBaseVNode(`div`,_hoisted_2$54,toDisplayString(Rh.value),1),Vh.value?(openBlock(),createElementBlock(`div`,_hoisted_3$52,toDisplayString(Vh.value),1)):createCommentVNode(``,!0)]))}}),Preview_default$13=Preview_vue_vue_type_script_setup_true_lang_default$13,markdownPlugin={toolDefinition:toolDefinition$13,async execute(Ph,Fh){let Ih=await apiPost(API_ROUTES.plugins.presentDocument,Fh);return Ih.ok?{...Ih.data,toolName:TOOL_NAME$10,uuid:crypto.randomUUID()}:{toolName:TOOL_NAME$10,uuid:crypto.randomUUID(),message:Ih.error}},isEnabled:()=>!0,generatingMessage:`Creating document...`,viewComponent:View_default$13,previewComponent:Preview_default$13},TOOL_NAME$9=`presentSpreadsheet`,toolDefinition$12={type:`function`,name:TOOL_NAME$9,description:`Display an Excel-like spreadsheet with formulas and calculations.`,prompt:`Use ${TOOL_NAME$9} when the user asks for a spreadsheet, table with calculations, or what-if analysis. Use formulas and cell references instead of pre-calculated values so the spreadsheet stays interactive. For cell format details and available functions, read \`helps/spreadsheet.md\` in the workspace.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`Title for the spreadsheet`},sheets:{type:`array`,description:`Sheets to render as spreadsheet tabs. Each sheet includes a name and 2D array of cells (rows x columns).`,items:{type:`object`,properties:{name:{type:`string`,description:`Sheet name (e.g., 'Sales Q1', 'Summary')`},data:{type:`array`,description:`Rows of cells. Each cell is an object with 'v' (value) and 'f' (format). Use Excel-style A1 notation in formulas: columns are letters (A, B, C...), rows are 1-based numbers (1, 2, 3...). Values can be text, numbers, dates, or formulas. Examples: [{"v": "Product"}, {"v": 2024, "f": "#,##0"}, {"v": "01/15/2025", "f": "MM/DD/YYYY"}, {"v": "=B2*1.05", "f": "$#,##0.00"}]. Format codes: '$#,##0.00' (currency), '#,##0' (integer), '0.00%' (percent), '0.00' (decimal), 'MM/DD/YYYY' (date), 'DD-MMM-YYYY' (date), 'YYYY-MM-DD' (ISO date).`,items:{type:`array`,description:`Row of cells. Each cell is an object with value and format.`,items:{type:`object`,description:`Cell object with value and optional format. If value is a string starting with '=', it's treated as a formula.`,properties:{v:{oneOf:[{type:`string`},{type:`number`}],description:`Cell value. Can be text, number, date, or formula (string starting with '='). Examples: 'Revenue', 1500000, '01/15/2025', '=SUM(A1:A10)', '=B2-TODAY()'. Date strings like '01/15/2025' are automatically parsed to date serial numbers.`},f:{type:`string`,description:`Optional format code for displaying the value. Common formats: '$#,##0.00' (currency), '#,##0' (integer), '0.00%' (percent), '0.00' (decimal), 'MM/DD/YYYY' (date), 'DD-MMM-YYYY' (date), 'YYYY-MM-DD' (ISO date)`}},required:[`v`]}}}},required:[`name`,`data`]}}},required:[`title`,`sheets`]}},XLSX={};XLSX.version=`0.20.3`;var current_codepage=1200,current_ansi=1252,$cptable,VALID_ANSI=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],CS2CP={0:1252,1:65001,2:65001,77:1e4,128:932,129:949,130:1361,134:936,136:950,161:1253,162:1254,163:1258,177:1255,178:1256,186:1257,204:1251,222:874,238:1250,255:1252,69:6969},set_ansi=function(Ph){VALID_ANSI.indexOf(Ph)!=-1&&(current_ansi=CS2CP[0]=Ph)};function reset_ansi(){set_ansi(1252)}var set_cp=function(Ph){current_codepage=Ph,set_ansi(Ph)};function reset_cp(){set_cp(1200),reset_ansi()}function utf16beread(Ph){for(var Fh=[],Ih=0;Ih<Ph.length>>1;++Ih)Fh[Ih]=String.fromCharCode(Ph.charCodeAt(2*Ih+1)+(Ph.charCodeAt(2*Ih)<<8));return Fh.join(``)}var _getchar=function(Ph){return String.fromCharCode(Ph)},_getansi=function(Ph){return String.fromCharCode(Ph)},DENSE=null,DIF_XL=!0,Base64_map=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`;function Base64_encode(Ph){for(var Fh=``,Ih=0,Lh=0,Rh=0,zh=0,Bh=0,Vh=0,Hh=0,Uh=0;Uh<Ph.length;)Ih=Ph.charCodeAt(Uh++),zh=Ih>>2,Lh=Ph.charCodeAt(Uh++),Bh=(Ih&3)<<4|Lh>>4,Rh=Ph.charCodeAt(Uh++),Vh=(Lh&15)<<2|Rh>>6,Hh=Rh&63,isNaN(Lh)?Vh=Hh=64:isNaN(Rh)&&(Hh=64),Fh+=Base64_map.charAt(zh)+Base64_map.charAt(Bh)+Base64_map.charAt(Vh)+Base64_map.charAt(Hh);return Fh}function Base64_encode_pass(Ph){for(var Fh=``,Ih=0,Lh=0,Rh=0,zh=0,Bh=0,Vh=0,Hh=0,Uh=0;Uh<Ph.length;)Ih=Ph.charCodeAt(Uh++),Ih>255&&(Ih=95),zh=Ih>>2,Lh=Ph.charCodeAt(Uh++),Lh>255&&(Lh=95),Bh=(Ih&3)<<4|Lh>>4,Rh=Ph.charCodeAt(Uh++),Rh>255&&(Rh=95),Vh=(Lh&15)<<2|Rh>>6,Hh=Rh&63,isNaN(Lh)?Vh=Hh=64:isNaN(Rh)&&(Hh=64),Fh+=Base64_map.charAt(zh)+Base64_map.charAt(Bh)+Base64_map.charAt(Vh)+Base64_map.charAt(Hh);return Fh}function Base64_encode_arr(Ph){for(var Fh=``,Ih=0,Lh=0,Rh=0,zh=0,Bh=0,Vh=0,Hh=0,Uh=0;Uh<Ph.length;)Ih=Ph[Uh++],zh=Ih>>2,Lh=Ph[Uh++],Bh=(Ih&3)<<4|Lh>>4,Rh=Ph[Uh++],Vh=(Lh&15)<<2|Rh>>6,Hh=Rh&63,isNaN(Lh)?Vh=Hh=64:isNaN(Rh)&&(Hh=64),Fh+=Base64_map.charAt(zh)+Base64_map.charAt(Bh)+Base64_map.charAt(Vh)+Base64_map.charAt(Hh);return Fh}function Base64_decode(Ph){var Fh=``,Ih=0,Lh=0,Rh=0,zh=0,Bh=0,Vh=0,Hh=0;if(Ph.slice(0,5)==`data:`){var Uh=Ph.slice(0,1024).indexOf(`;base64,`);Uh>-1&&(Ph=Ph.slice(Uh+8))}Ph=Ph.replace(/[^\w\+\/\=]/g,``);for(var Uh=0;Uh<Ph.length;)zh=Base64_map.indexOf(Ph.charAt(Uh++)),Bh=Base64_map.indexOf(Ph.charAt(Uh++)),Ih=zh<<2|Bh>>4,Fh+=String.fromCharCode(Ih),Vh=Base64_map.indexOf(Ph.charAt(Uh++)),Lh=(Bh&15)<<4|Vh>>2,Vh!==64&&(Fh+=String.fromCharCode(Lh)),Hh=Base64_map.indexOf(Ph.charAt(Uh++)),Rh=(Vh&3)<<6|Hh,Hh!==64&&(Fh+=String.fromCharCode(Rh));return Fh}var has_buf=(function(){return typeof Buffer<`u`&&typeof process<`u`&&process.versions!==void 0&&!!process.versions.node})(),Buffer_from=(function(){if(typeof Buffer<`u`){var Ph=!Buffer.from;if(!Ph)try{Buffer.from(`foo`,`utf8`)}catch{Ph=!0}return Ph?function(Ph,Fh){return Fh?new Buffer(Ph,Fh):new Buffer(Ph)}:Buffer.from.bind(Buffer)}return function(){}})(),buf_utf16le=(function(){if(typeof Buffer>`u`)return!1;var Ph=Buffer_from([65,0]);return Ph?Ph.toString(`utf16le`).length==1:!1})();function new_raw_buf(Ph){return has_buf?Buffer.alloc?Buffer.alloc(Ph):new Buffer(Ph):typeof Uint8Array<`u`?new Uint8Array(Ph):Array(Ph)}function new_unsafe_buf(Ph){return has_buf?Buffer.allocUnsafe?Buffer.allocUnsafe(Ph):new Buffer(Ph):typeof Uint8Array<`u`?new Uint8Array(Ph):Array(Ph)}var s2a=function(Ph){return has_buf?Buffer_from(Ph,`binary`):Ph.split(``).map(function(Ph){return Ph.charCodeAt(0)&255})};function s2ab(Ph){if(typeof ArrayBuffer>`u`)return s2a(Ph);for(var Fh=new ArrayBuffer(Ph.length),Ih=new Uint8Array(Fh),Lh=0;Lh!=Ph.length;++Lh)Ih[Lh]=Ph.charCodeAt(Lh)&255;return Fh}function a2s(Ph){if(Array.isArray(Ph))return Ph.map(function(Ph){return String.fromCharCode(Ph)}).join(``);for(var Fh=[],Ih=0;Ih<Ph.length;++Ih)Fh[Ih]=String.fromCharCode(Ph[Ih]);return Fh.join(``)}function a2u(Ph){if(typeof Uint8Array>`u`)throw Error(`Unsupported`);return new Uint8Array(Ph)}var bconcat=has_buf?function(Ph){return Buffer.concat(Ph.map(function(Ph){return Buffer.isBuffer(Ph)?Ph:Buffer_from(Ph)}))}:function(Ph){if(typeof Uint8Array<`u`){var Fh=0,Ih=0;for(Fh=0;Fh<Ph.length;++Fh)Ih+=Ph[Fh].length;var Lh=new Uint8Array(Ih),Rh=0;for(Fh=0,Ih=0;Fh<Ph.length;Ih+=Rh,++Fh)Rh=Ph[Fh].length,Ph[Fh]instanceof Uint8Array?Lh.set(Ph[Fh],Ih):typeof Ph[Fh]==`string`?Lh.set(new Uint8Array(s2a(Ph[Fh])),Ih):Lh.set(new Uint8Array(Ph[Fh]),Ih);return Lh}return[].concat.apply([],Ph.map(function(Ph){return Array.isArray(Ph)?Ph:[].slice.call(Ph)}))};function utf8decode(Ph){for(var Fh=[],Ih=0,Lh=Ph.length+250,Rh=new_raw_buf(Ph.length+255),zh=0;zh<Ph.length;++zh){var Bh=Ph.charCodeAt(zh);if(Bh<128)Rh[Ih++]=Bh;else if(Bh<2048)Rh[Ih++]=192|Bh>>6&31,Rh[Ih++]=128|Bh&63;else if(Bh>=55296&&Bh<57344){Bh=(Bh&1023)+64;var Vh=Ph.charCodeAt(++zh)&1023;Rh[Ih++]=240|Bh>>8&7,Rh[Ih++]=128|Bh>>2&63,Rh[Ih++]=128|Vh>>6&15|(Bh&3)<<4,Rh[Ih++]=128|Vh&63}else Rh[Ih++]=224|Bh>>12&15,Rh[Ih++]=128|Bh>>6&63,Rh[Ih++]=128|Bh&63;Ih>Lh&&(Fh.push(Rh.slice(0,Ih)),Ih=0,Rh=new_raw_buf(65535),Lh=65530)}return Fh.push(Rh.slice(0,Ih)),bconcat(Fh)}var chr0=/\u0000/g,chr1=/[\u0001-\u0006]/g;function _strrev(Ph){for(var Fh=``,Ih=Ph.length-1;Ih>=0;)Fh+=Ph.charAt(Ih--);return Fh}function pad0(Ph,Fh){var Ih=``+Ph;return Ih.length>=Fh?Ih:fill(`0`,Fh-Ih.length)+Ih}function pad_(Ph,Fh){var Ih=``+Ph;return Ih.length>=Fh?Ih:fill(` `,Fh-Ih.length)+Ih}function rpad_(Ph,Fh){var Ih=``+Ph;return Ih.length>=Fh?Ih:Ih+fill(` `,Fh-Ih.length)}function pad0r1(Ph,Fh){var Ih=``+Math.round(Ph);return Ih.length>=Fh?Ih:fill(`0`,Fh-Ih.length)+Ih}function pad0r2(Ph,Fh){var Ih=``+Ph;return Ih.length>=Fh?Ih:fill(`0`,Fh-Ih.length)+Ih}var p2_32=2**32;function pad0r(Ph,Fh){return Ph>p2_32||Ph<-p2_32?pad0r1(Ph,Fh):pad0r2(Math.round(Ph),Fh)}function SSF_isgeneral(Ph,Fh){return Fh||=0,Ph.length>=7+Fh&&(Ph.charCodeAt(Fh)|32)==103&&(Ph.charCodeAt(Fh+1)|32)==101&&(Ph.charCodeAt(Fh+2)|32)==110&&(Ph.charCodeAt(Fh+3)|32)==101&&(Ph.charCodeAt(Fh+4)|32)==114&&(Ph.charCodeAt(Fh+5)|32)==97&&(Ph.charCodeAt(Fh+6)|32)==108}var days=[[`Sun`,`Sunday`],[`Mon`,`Monday`],[`Tue`,`Tuesday`],[`Wed`,`Wednesday`],[`Thu`,`Thursday`],[`Fri`,`Friday`],[`Sat`,`Saturday`]],months=[[`J`,`Jan`,`January`],[`F`,`Feb`,`February`],[`M`,`Mar`,`March`],[`A`,`Apr`,`April`],[`M`,`May`,`May`],[`J`,`Jun`,`June`],[`J`,`Jul`,`July`],[`A`,`Aug`,`August`],[`S`,`Sep`,`September`],[`O`,`Oct`,`October`],[`N`,`Nov`,`November`],[`D`,`Dec`,`December`]];function SSF_init_table(Ph){return Ph||={},Ph[0]=`General`,Ph[1]=`0`,Ph[2]=`0.00`,Ph[3]=`#,##0`,Ph[4]=`#,##0.00`,Ph[9]=`0%`,Ph[10]=`0.00%`,Ph[11]=`0.00E+00`,Ph[12]=`# ?/?`,Ph[13]=`# ??/??`,Ph[14]=`m/d/yy`,Ph[15]=`d-mmm-yy`,Ph[16]=`d-mmm`,Ph[17]=`mmm-yy`,Ph[18]=`h:mm AM/PM`,Ph[19]=`h:mm:ss AM/PM`,Ph[20]=`h:mm`,Ph[21]=`h:mm:ss`,Ph[22]=`m/d/yy h:mm`,Ph[37]=`#,##0 ;(#,##0)`,Ph[38]=`#,##0 ;[Red](#,##0)`,Ph[39]=`#,##0.00;(#,##0.00)`,Ph[40]=`#,##0.00;[Red](#,##0.00)`,Ph[45]=`mm:ss`,Ph[46]=`[h]:mm:ss`,Ph[47]=`mmss.0`,Ph[48]=`##0.0E+0`,Ph[49]=`@`,Ph[56]=`"上午/下午 "hh"時"mm"分"ss"秒 "`,Ph}var table_fmt={0:`General`,1:`0`,2:`0.00`,3:`#,##0`,4:`#,##0.00`,9:`0%`,10:`0.00%`,11:`0.00E+00`,12:`# ?/?`,13:`# ??/??`,14:`m/d/yy`,15:`d-mmm-yy`,16:`d-mmm`,17:`mmm-yy`,18:`h:mm AM/PM`,19:`h:mm:ss AM/PM`,20:`h:mm`,21:`h:mm:ss`,22:`m/d/yy h:mm`,37:`#,##0 ;(#,##0)`,38:`#,##0 ;[Red](#,##0)`,39:`#,##0.00;(#,##0.00)`,40:`#,##0.00;[Red](#,##0.00)`,45:`mm:ss`,46:`[h]:mm:ss`,47:`mmss.0`,48:`##0.0E+0`,49:`@`,56:`"上午/下午 "hh"時"mm"分"ss"秒 "`},SSF_default_map={5:37,6:38,7:39,8:40,23:0,24:0,25:0,26:0,27:14,28:14,29:14,30:14,31:14,50:14,51:14,52:14,53:14,54:14,55:14,56:14,57:14,58:14,59:1,60:2,61:3,62:4,67:9,68:10,69:12,70:13,71:14,72:14,73:15,74:16,75:17,76:20,77:21,78:22,79:45,80:46,81:47,82:0},SSF_default_str={5:`"$"#,##0_);\\("$"#,##0\\)`,63:`"$"#,##0_);\\("$"#,##0\\)`,6:`"$"#,##0_);[Red]\\("$"#,##0\\)`,64:`"$"#,##0_);[Red]\\("$"#,##0\\)`,7:`"$"#,##0.00_);\\("$"#,##0.00\\)`,65:`"$"#,##0.00_);\\("$"#,##0.00\\)`,8:`"$"#,##0.00_);[Red]\\("$"#,##0.00\\)`,66:`"$"#,##0.00_);[Red]\\("$"#,##0.00\\)`,41:`_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)`,42:`_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)`,43:`_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)`,44:`_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)`};function SSF_frac(Ph,Fh,Ih){for(var Lh=Ph<0?-1:1,Rh=Ph*Lh,zh=0,Bh=1,Vh=0,Hh=1,Uh=0,Wh=0,Gh=Math.floor(Rh);Uh<Fh&&(Gh=Math.floor(Rh),Vh=Gh*Bh+zh,Wh=Gh*Uh+Hh,!(Rh-Gh<5e-8));)Rh=1/(Rh-Gh),zh=Bh,Bh=Vh,Hh=Uh,Uh=Wh;if(Wh>Fh&&(Uh>Fh?(Wh=Hh,Vh=zh):(Wh=Uh,Vh=Bh)),!Ih)return[0,Lh*Vh,Wh];var Kh=Math.floor(Lh*Vh/Wh);return[Kh,Lh*Vh-Kh*Wh,Wh]}function SSF_normalize_xl_unsafe(Ph){var Fh=Ph.toPrecision(16);if(Fh.indexOf(`e`)>-1){var Ih=Fh.slice(0,Fh.indexOf(`e`));return Ih=Ih.indexOf(`.`)>-1?Ih.slice(0,Ih.slice(0,2)==`0.`?17:16):Ih.slice(0,15)+fill(`0`,Ih.length-15),Ih+Fh.slice(Fh.indexOf(`e`))}var Lh=Fh.indexOf(`.`)>-1?Fh.slice(0,Fh.slice(0,2)==`0.`?17:16):Fh.slice(0,15)+fill(`0`,Fh.length-15);return Number(Lh)}function SSF_parse_date_code(Ph,Fh,Ih){if(Ph>2958465||Ph<0)return null;Ph=SSF_normalize_xl_unsafe(Ph);var Lh=Ph|0,Rh=Math.floor(86400*(Ph-Lh)),zh=0,Bh=[],Vh={D:Lh,T:Rh,u:86400*(Ph-Lh)-Rh,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(Vh.u)<1e-6&&(Vh.u=0),Fh&&Fh.date1904&&(Lh+=1462),Vh.u>.9999&&(Vh.u=0,++Rh==86400&&(Vh.T=Rh=0,++Lh,++Vh.D)),Lh===60)Bh=Ih?[1317,10,29]:[1900,2,29],zh=3;else if(Lh===0)Bh=Ih?[1317,8,29]:[1900,1,0],zh=6;else{Lh>60&&--Lh;var Hh=new Date(1900,0,1);Hh.setDate(Hh.getDate()+Lh-1),Bh=[Hh.getFullYear(),Hh.getMonth()+1,Hh.getDate()],zh=Hh.getDay(),Lh<60&&(zh=(zh+6)%7),Ih&&(zh=SSF_fix_hijri(Hh,Bh))}return Vh.y=Bh[0],Vh.m=Bh[1],Vh.d=Bh[2],Vh.S=Rh%60,Rh=Math.floor(Rh/60),Vh.M=Rh%60,Rh=Math.floor(Rh/60),Vh.H=Rh,Vh.q=zh,Vh}function SSF_strip_decimal(Ph){return Ph.indexOf(`.`)==-1?Ph:Ph.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,`$1`)}function SSF_normalize_exp(Ph){return Ph.indexOf(`E`)==-1?Ph:Ph.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,`$1E`).replace(/(E[+-])(\d)$/,`$10$2`)}function SSF_small_exp(Ph){var Fh=Ph<0?12:11,Ih=SSF_strip_decimal(Ph.toFixed(12));return Ih.length<=Fh||(Ih=Ph.toPrecision(10),Ih.length<=Fh)?Ih:Ph.toExponential(5)}function SSF_large_exp(Ph){var Fh=SSF_strip_decimal(Ph.toFixed(11));return Fh.length>(Ph<0?12:11)||Fh===`0`||Fh===`-0`?Ph.toPrecision(6):Fh}function SSF_general_num(Ph){if(!isFinite(Ph))return isNaN(Ph)?`#NUM!`:`#DIV/0!`;var Fh=Math.floor(Math.log(Math.abs(Ph))*Math.LOG10E);return SSF_strip_decimal(SSF_normalize_exp((Fh>=-4&&Fh<=-1?Ph.toPrecision(10+Fh):Math.abs(Fh)<=9?SSF_small_exp(Ph):Fh===10?Ph.toFixed(10).substr(0,12):SSF_large_exp(Ph)).toUpperCase()))}function SSF_general(Ph,Fh){switch(typeof Ph){case`string`:return Ph;case`boolean`:return Ph?`TRUE`:`FALSE`;case`number`:return(Ph|0)===Ph?Ph.toString(10):SSF_general_num(Ph);case`undefined`:return``;case`object`:if(Ph==null)return``;if(Ph instanceof Date)return SSF_format(14,datenum(Ph,Fh&&Fh.date1904),Fh)}throw Error(`unsupported value in General format: `+Ph)}function SSF_fix_hijri(Ph,Fh){Fh[0]-=581;var Ih=Ph.getDay();return Ph<60&&(Ih=(Ih+6)%7),Ih}function SSF_write_date(Ph,Fh,Ih,Lh){var Rh=``,zh=0,Bh=0,Vh=Ih.y,Hh,Uh=0;switch(Ph){case 98:Vh=Ih.y+543;case 121:switch(Fh.length){case 1:case 2:Hh=Vh%100,Uh=2;break;default:Hh=Vh%1e4,Uh=4;break}break;case 109:switch(Fh.length){case 1:case 2:Hh=Ih.m,Uh=Fh.length;break;case 3:return months[Ih.m-1][1];case 5:return months[Ih.m-1][0];default:return months[Ih.m-1][2]}break;case 100:switch(Fh.length){case 1:case 2:Hh=Ih.d,Uh=Fh.length;break;case 3:return days[Ih.q][0];default:return days[Ih.q][1]}break;case 104:switch(Fh.length){case 1:case 2:Hh=1+(Ih.H+11)%12,Uh=Fh.length;break;default:throw`bad hour format: `+Fh}break;case 72:switch(Fh.length){case 1:case 2:Hh=Ih.H,Uh=Fh.length;break;default:throw`bad hour format: `+Fh}break;case 77:switch(Fh.length){case 1:case 2:Hh=Ih.M,Uh=Fh.length;break;default:throw`bad minute format: `+Fh}break;case 115:if(Fh!=`s`&&Fh!=`ss`&&Fh!=`.0`&&Fh!=`.00`&&Fh!=`.000`)throw`bad second format: `+Fh;return Ih.u===0&&(Fh==`s`||Fh==`ss`)?pad0(Ih.S,Fh.length):(Bh=Lh>=2?Lh===3?1e3:100:Lh===1?10:1,zh=Math.round(Bh*(Ih.S+Ih.u)),zh>=60*Bh&&(zh=0),Fh===`s`?zh===0?`0`:``+zh/Bh:(Rh=pad0(zh,2+Lh),Fh===`ss`?Rh.substr(0,2):`.`+Rh.substr(2,Fh.length-1)));case 90:switch(Fh){case`[h]`:case`[hh]`:Hh=Ih.D*24+Ih.H;break;case`[m]`:case`[mm]`:Hh=(Ih.D*24+Ih.H)*60+Ih.M;break;case`[s]`:case`[ss]`:Hh=((Ih.D*24+Ih.H)*60+Ih.M)*60+(Lh==0?Math.round(Ih.S+Ih.u):Ih.S);break;default:throw`bad abstime format: `+Fh}Uh=Fh.length===3?1:2;break;case 101:Hh=Vh,Uh=1;break}return Uh>0?pad0(Hh,Uh):``}function commaify(Ph){var Fh=3;if(Ph.length<=Fh)return Ph;for(var Ih=Ph.length%Fh,Lh=Ph.substr(0,Ih);Ih!=Ph.length;Ih+=Fh)Lh+=(Lh.length>0?`,`:``)+Ph.substr(Ih,Fh);return Lh}var pct1=/%/g;function write_num_pct(Ph,Fh,Ih){var Lh=Fh.replace(pct1,``),Rh=Fh.length-Lh.length;return write_num(Ph,Lh,Ih*10**(2*Rh))+fill(`%`,Rh)}function write_num_cm(Ph,Fh,Ih){for(var Lh=Fh.length-1;Fh.charCodeAt(Lh-1)===44;)--Lh;return write_num(Ph,Fh.substr(0,Lh),Ih/10**(3*(Fh.length-Lh)))}function write_num_exp(Ph,Fh){var Ih,Lh=Ph.indexOf(`E`)-Ph.indexOf(`.`)-1;if(Ph.match(/^#+0.0E\+0$/)){if(Fh==0)return`0.0E+0`;if(Fh<0)return`-`+write_num_exp(Ph,-Fh);var Rh=Ph.indexOf(`.`);Rh===-1&&(Rh=Ph.indexOf(`E`));var zh=Math.floor(Math.log(Fh)*Math.LOG10E)%Rh;if(zh<0&&(zh+=Rh),Ih=(Fh/10**zh).toPrecision(Lh+1+(Rh+zh)%Rh),Ih.indexOf(`e`)===-1){var Bh=Math.floor(Math.log(Fh)*Math.LOG10E);for(Ih.indexOf(`.`)===-1?Ih=Ih.charAt(0)+`.`+Ih.substr(1)+`E+`+(Bh-Ih.length+zh):Ih+=`E+`+(Bh-zh);Ih.substr(0,2)===`0.`;)Ih=Ih.charAt(0)+Ih.substr(2,Rh)+`.`+Ih.substr(2+Rh),Ih=Ih.replace(/^0+([1-9])/,`$1`).replace(/^0+\./,`0.`);Ih=Ih.replace(/\+-/,`-`)}Ih=Ih.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(Ph,Fh,Ih,Lh){return Fh+Ih+Lh.substr(0,(Rh+zh)%Rh)+`.`+Lh.substr(zh)+`E`})}else Ih=Fh.toExponential(Lh);return Ph.match(/E\+00$/)&&Ih.match(/e[+-]\d$/)&&(Ih=Ih.substr(0,Ih.length-1)+`0`+Ih.charAt(Ih.length-1)),Ph.match(/E\-/)&&Ih.match(/e\+/)&&(Ih=Ih.replace(/e\+/,`e`)),Ih.replace(`e`,`E`)}var frac1=/# (\?+)( ?)\/( ?)(\d+)/;function write_num_f1(Ph,Fh,Ih){var Lh=parseInt(Ph[4],10),Rh=Math.round(Fh*Lh),zh=Math.floor(Rh/Lh),Bh=Rh-zh*Lh,Vh=Lh;return Ih+(zh===0?``:``+zh)+` `+(Bh===0?fill(` `,Ph[1].length+1+Ph[4].length):pad_(Bh,Ph[1].length)+Ph[2]+`/`+Ph[3]+pad0(Vh,Ph[4].length))}function write_num_f2(Ph,Fh,Ih){return Ih+(Fh===0?``:``+Fh)+fill(` `,Ph[1].length+2+Ph[4].length)}var dec1=/^#*0*\.([0#]+)/,closeparen=/\)[^)]*[0#]/,phone=/\(###\) ###\\?-####/;function hashq(Ph){for(var Fh=``,Ih,Lh=0;Lh!=Ph.length;++Lh)switch(Ih=Ph.charCodeAt(Lh)){case 35:break;case 63:Fh+=` `;break;case 48:Fh+=`0`;break;default:Fh+=String.fromCharCode(Ih)}return Fh}function rnd(Ph,Fh){var Ih=10**Fh;return``+Math.round(Ph*Ih)/Ih}function dec(Ph,Fh){var Ih=Ph-Math.floor(Ph),Lh=10**Fh;return Fh<(``+Math.round(Ih*Lh)).length?0:Math.round(Ih*Lh)}function carry(Ph,Fh){return+(Fh<(``+Math.round((Ph-Math.floor(Ph))*10**Fh)).length)}function flr(Ph){return Ph<2147483647&&Ph>-2147483648?``+(Ph>=0?Ph|0:Ph-1|0):``+Math.floor(Ph)}function write_num_flt(Ph,Fh,Ih){if(Ph.charCodeAt(0)===40&&!Fh.match(closeparen)){var Lh=Fh.replace(/\( */,``).replace(/ \)/,``).replace(/\)/,``);return Ih>=0?write_num_flt(`n`,Lh,Ih):`(`+write_num_flt(`n`,Lh,-Ih)+`)`}if(Fh.charCodeAt(Fh.length-1)===44)return write_num_cm(Ph,Fh,Ih);if(Fh.indexOf(`%`)!==-1)return write_num_pct(Ph,Fh,Ih);if(Fh.indexOf(`E`)!==-1)return write_num_exp(Fh,Ih);if(Fh.charCodeAt(0)===36)return`$`+write_num_flt(Ph,Fh.substr(Fh.charAt(1)==` `?2:1),Ih);var Rh,zh,Bh,Vh,Hh=Math.abs(Ih),Uh=Ih<0?`-`:``;if(Fh.match(/^00+$/))return Uh+pad0r(Hh,Fh.length);if(Fh.match(/^[#?]+$/))return Rh=pad0r(Ih,0),Rh===`0`&&(Rh=``),Rh.length>Fh.length?Rh:hashq(Fh.substr(0,Fh.length-Rh.length))+Rh;if(zh=Fh.match(frac1))return write_num_f1(zh,Hh,Uh);if(Fh.match(/^#+0+$/))return Uh+pad0r(Hh,Fh.length-Fh.indexOf(`0`));if(zh=Fh.match(dec1))return Rh=rnd(Ih,zh[1].length).replace(/^([^\.]+)$/,`$1.`+hashq(zh[1])).replace(/\.$/,`.`+hashq(zh[1])).replace(/\.(\d*)$/,function(Ph,Fh){return`.`+Fh+fill(`0`,hashq(zh[1]).length-Fh.length)}),Fh.indexOf(`0.`)===-1?Rh.replace(/^0\./,`.`):Rh;if(Fh=Fh.replace(/^#+([0.])/,`$1`),zh=Fh.match(/^(0*)\.(#*)$/))return Uh+rnd(Hh,zh[2].length).replace(/\.(\d*[1-9])0*$/,`.$1`).replace(/^(-?\d*)$/,`$1.`).replace(/^0\./,zh[1].length?`0.`:`.`);if(zh=Fh.match(/^#{1,3},##0(\.?)$/))return Uh+commaify(pad0r(Hh,0));if(zh=Fh.match(/^#,##0\.([#0]*0)$/))return Ih<0?`-`+write_num_flt(Ph,Fh,-Ih):commaify(``+(Math.floor(Ih)+carry(Ih,zh[1].length)))+`.`+pad0(dec(Ih,zh[1].length),zh[1].length);if(zh=Fh.match(/^#,#*,#0/))return write_num_flt(Ph,Fh.replace(/^#,#*,/,``),Ih);if(zh=Fh.match(/^([0#]+)(\\?-([0#]+))+$/))return Rh=_strrev(write_num_flt(Ph,Fh.replace(/[\\-]/g,``),Ih)),Bh=0,_strrev(_strrev(Fh.replace(/\\/g,``)).replace(/[0#]/g,function(Ph){return Bh<Rh.length?Rh.charAt(Bh++):Ph===`0`?`0`:``}));if(Fh.match(phone))return Rh=write_num_flt(Ph,`##########`,Ih),`(`+Rh.substr(0,3)+`) `+Rh.substr(3,3)+`-`+Rh.substr(6);var Wh=``;if(zh=Fh.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Bh=Math.min(zh[4].length,7),Vh=SSF_frac(Hh,10**Bh-1,!1),Rh=``+Uh,Wh=write_num(`n`,zh[1],Vh[1]),Wh.charAt(Wh.length-1)==` `&&(Wh=Wh.substr(0,Wh.length-1)+`0`),Rh+=Wh+zh[2]+`/`+zh[3],Wh=rpad_(Vh[2],Bh),Wh.length<zh[4].length&&(Wh=hashq(zh[4].substr(zh[4].length-Wh.length))+Wh),Rh+=Wh,Rh;if(zh=Fh.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Bh=Math.min(Math.max(zh[1].length,zh[4].length),7),Vh=SSF_frac(Hh,10**Bh-1,!0),Uh+(Vh[0]||(Vh[1]?``:`0`))+` `+(Vh[1]?pad_(Vh[1],Bh)+zh[2]+`/`+zh[3]+rpad_(Vh[2],Bh):fill(` `,2*Bh+1+zh[2].length+zh[3].length));if(zh=Fh.match(/^[#0?]+$/))return Rh=pad0r(Ih,0),Fh.length<=Rh.length?Rh:hashq(Fh.substr(0,Fh.length-Rh.length))+Rh;if(zh=Fh.match(/^([#0?]+)\.([#0]+)$/)){Rh=``+Ih.toFixed(Math.min(zh[2].length,10)).replace(/([^0])0+$/,`$1`),Bh=Rh.indexOf(`.`);var Gh=Fh.indexOf(`.`)-Bh,Kh=Fh.length-Rh.length-Gh;return hashq(Fh.substr(0,Gh)+Rh+Fh.substr(Fh.length-Kh))}if(zh=Fh.match(/^00,000\.([#0]*0)$/))return Bh=dec(Ih,zh[1].length),Ih<0?`-`+write_num_flt(Ph,Fh,-Ih):commaify(flr(Ih)).replace(/^\d,\d{3}$/,`0$&`).replace(/^\d*$/,function(Ph){return`00,`+(Ph.length<3?pad0(0,3-Ph.length):``)+Ph})+`.`+pad0(Bh,zh[1].length);switch(Fh){case`###,##0.00`:return write_num_flt(Ph,`#,##0.00`,Ih);case`###,###`:case`##,###`:case`#,###`:var qh=commaify(pad0r(Hh,0));return qh===`0`?``:Uh+qh;case`###,###.00`:return write_num_flt(Ph,`###,##0.00`,Ih).replace(/^0\./,`.`);case`#,###.00`:return write_num_flt(Ph,`#,##0.00`,Ih).replace(/^0\./,`.`);default:}throw Error(`unsupported format |`+Fh+`|`)}function write_num_cm2(Ph,Fh,Ih){for(var Lh=Fh.length-1;Fh.charCodeAt(Lh-1)===44;)--Lh;return write_num(Ph,Fh.substr(0,Lh),Ih/10**(3*(Fh.length-Lh)))}function write_num_pct2(Ph,Fh,Ih){var Lh=Fh.replace(pct1,``),Rh=Fh.length-Lh.length;return write_num(Ph,Lh,Ih*10**(2*Rh))+fill(`%`,Rh)}function write_num_exp2(Ph,Fh){var Ih,Lh=Ph.indexOf(`E`)-Ph.indexOf(`.`)-1;if(Ph.match(/^#+0.0E\+0$/)){if(Fh==0)return`0.0E+0`;if(Fh<0)return`-`+write_num_exp2(Ph,-Fh);var Rh=Ph.indexOf(`.`);Rh===-1&&(Rh=Ph.indexOf(`E`));var zh=Math.floor(Math.log(Fh)*Math.LOG10E)%Rh;if(zh<0&&(zh+=Rh),Ih=(Fh/10**zh).toPrecision(Lh+1+(Rh+zh)%Rh),!Ih.match(/[Ee]/)){var Bh=Math.floor(Math.log(Fh)*Math.LOG10E);Ih.indexOf(`.`)===-1?Ih=Ih.charAt(0)+`.`+Ih.substr(1)+`E+`+(Bh-Ih.length+zh):Ih+=`E+`+(Bh-zh),Ih=Ih.replace(/\+-/,`-`)}Ih=Ih.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(Ph,Fh,Ih,Lh){return Fh+Ih+Lh.substr(0,(Rh+zh)%Rh)+`.`+Lh.substr(zh)+`E`})}else Ih=Fh.toExponential(Lh);return Ph.match(/E\+00$/)&&Ih.match(/e[+-]\d$/)&&(Ih=Ih.substr(0,Ih.length-1)+`0`+Ih.charAt(Ih.length-1)),Ph.match(/E\-/)&&Ih.match(/e\+/)&&(Ih=Ih.replace(/e\+/,`e`)),Ih.replace(`e`,`E`)}function write_num_int(Ph,Fh,Ih){if(Ph.charCodeAt(0)===40&&!Fh.match(closeparen)){var Lh=Fh.replace(/\( */,``).replace(/ \)/,``).replace(/\)/,``);return Ih>=0?write_num_int(`n`,Lh,Ih):`(`+write_num_int(`n`,Lh,-Ih)+`)`}if(Fh.charCodeAt(Fh.length-1)===44)return write_num_cm2(Ph,Fh,Ih);if(Fh.indexOf(`%`)!==-1)return write_num_pct2(Ph,Fh,Ih);if(Fh.indexOf(`E`)!==-1)return write_num_exp2(Fh,Ih);if(Fh.charCodeAt(0)===36)return`$`+write_num_int(Ph,Fh.substr(Fh.charAt(1)==` `?2:1),Ih);var Rh,zh,Bh,Vh,Hh=Math.abs(Ih),Uh=Ih<0?`-`:``;if(Fh.match(/^00+$/))return Uh+pad0(Hh,Fh.length);if(Fh.match(/^[#?]+$/))return Rh=``+Ih,Ih===0&&(Rh=``),Rh.length>Fh.length?Rh:hashq(Fh.substr(0,Fh.length-Rh.length))+Rh;if(zh=Fh.match(frac1))return write_num_f2(zh,Hh,Uh);if(Fh.match(/^#+0+$/))return Uh+pad0(Hh,Fh.length-Fh.indexOf(`0`));if(zh=Fh.match(dec1))return Rh=(``+Ih).replace(/^([^\.]+)$/,`$1.`+hashq(zh[1])).replace(/\.$/,`.`+hashq(zh[1])),Rh=Rh.replace(/\.(\d*)$/,function(Ph,Fh){return`.`+Fh+fill(`0`,hashq(zh[1]).length-Fh.length)}),Fh.indexOf(`0.`)===-1?Rh.replace(/^0\./,`.`):Rh;if(Fh=Fh.replace(/^#+([0.])/,`$1`),zh=Fh.match(/^(0*)\.(#*)$/))return Uh+(``+Hh).replace(/\.(\d*[1-9])0*$/,`.$1`).replace(/^(-?\d*)$/,`$1.`).replace(/^0\./,zh[1].length?`0.`:`.`);if(zh=Fh.match(/^#{1,3},##0(\.?)$/))return Uh+commaify(``+Hh);if(zh=Fh.match(/^#,##0\.([#0]*0)$/))return Ih<0?`-`+write_num_int(Ph,Fh,-Ih):commaify(``+Ih)+`.`+fill(`0`,zh[1].length);if(zh=Fh.match(/^#,#*,#0/))return write_num_int(Ph,Fh.replace(/^#,#*,/,``),Ih);if(zh=Fh.match(/^([0#]+)(\\?-([0#]+))+$/))return Rh=_strrev(write_num_int(Ph,Fh.replace(/[\\-]/g,``),Ih)),Bh=0,_strrev(_strrev(Fh.replace(/\\/g,``)).replace(/[0#]/g,function(Ph){return Bh<Rh.length?Rh.charAt(Bh++):Ph===`0`?`0`:``}));if(Fh.match(phone))return Rh=write_num_int(Ph,`##########`,Ih),`(`+Rh.substr(0,3)+`) `+Rh.substr(3,3)+`-`+Rh.substr(6);var Wh=``;if(zh=Fh.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Bh=Math.min(zh[4].length,7),Vh=SSF_frac(Hh,10**Bh-1,!1),Rh=``+Uh,Wh=write_num(`n`,zh[1],Vh[1]),Wh.charAt(Wh.length-1)==` `&&(Wh=Wh.substr(0,Wh.length-1)+`0`),Rh+=Wh+zh[2]+`/`+zh[3],Wh=rpad_(Vh[2],Bh),Wh.length<zh[4].length&&(Wh=hashq(zh[4].substr(zh[4].length-Wh.length))+Wh),Rh+=Wh,Rh;if(zh=Fh.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Bh=Math.min(Math.max(zh[1].length,zh[4].length),7),Vh=SSF_frac(Hh,10**Bh-1,!0),Uh+(Vh[0]||(Vh[1]?``:`0`))+` `+(Vh[1]?pad_(Vh[1],Bh)+zh[2]+`/`+zh[3]+rpad_(Vh[2],Bh):fill(` `,2*Bh+1+zh[2].length+zh[3].length));if(zh=Fh.match(/^[#0?]+$/))return Rh=``+Ih,Fh.length<=Rh.length?Rh:hashq(Fh.substr(0,Fh.length-Rh.length))+Rh;if(zh=Fh.match(/^([#0]+)\.([#0]+)$/)){Rh=``+Ih.toFixed(Math.min(zh[2].length,10)).replace(/([^0])0+$/,`$1`),Bh=Rh.indexOf(`.`);var Gh=Fh.indexOf(`.`)-Bh,Kh=Fh.length-Rh.length-Gh;return hashq(Fh.substr(0,Gh)+Rh+Fh.substr(Fh.length-Kh))}if(zh=Fh.match(/^00,000\.([#0]*0)$/))return Ih<0?`-`+write_num_int(Ph,Fh,-Ih):commaify(``+Ih).replace(/^\d,\d{3}$/,`0$&`).replace(/^\d*$/,function(Ph){return`00,`+(Ph.length<3?pad0(0,3-Ph.length):``)+Ph})+`.`+pad0(0,zh[1].length);switch(Fh){case`###,###`:case`##,###`:case`#,###`:var qh=commaify(``+Hh);return qh===`0`?``:Uh+qh;default:if(Fh.match(/\.[0#?]*$/))return write_num_int(Ph,Fh.slice(0,Fh.lastIndexOf(`.`)),Ih)+hashq(Fh.slice(Fh.lastIndexOf(`.`)))}throw Error(`unsupported format |`+Fh+`|`)}function write_num(Ph,Fh,Ih){return(Ih|0)===Ih?write_num_int(Ph,Fh,Ih):write_num_flt(Ph,Fh,Ih)}function SSF_split_fmt(Ph){for(var Fh=[],Ih=!1,Lh=0,Rh=0;Lh<Ph.length;++Lh)switch(Ph.charCodeAt(Lh)){case 34:Ih=!Ih;break;case 95:case 42:case 92:++Lh;break;case 59:Fh[Fh.length]=Ph.substr(Rh,Lh-Rh),Rh=Lh+1}if(Fh[Fh.length]=Ph.substr(Rh),Ih===!0)throw Error(`Format |`+Ph+`| unterminated string `);return Fh}var SSF_abstime=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function fmt_is_date(Ph){for(var Fh=0,Ih=``,Lh=``;Fh<Ph.length;)switch(Ih=Ph.charAt(Fh)){case`G`:SSF_isgeneral(Ph,Fh)&&(Fh+=6),Fh++;break;case`"`:for(;Ph.charCodeAt(++Fh)!==34&&Fh<Ph.length;);++Fh;break;case`\\`:Fh+=2;break;case`_`:Fh+=2;break;case`@`:++Fh;break;case`B`:case`b`:if(Ph.charAt(Fh+1)===`1`||Ph.charAt(Fh+1)===`2`)return!0;case`M`:case`D`:case`Y`:case`H`:case`S`:case`E`:case`m`:case`d`:case`y`:case`h`:case`s`:case`e`:case`g`:return!0;case`A`:case`a`:case`上`:if(Ph.substr(Fh,3).toUpperCase()===`A/P`||Ph.substr(Fh,5).toUpperCase()===`AM/PM`||Ph.substr(Fh,5).toUpperCase()===`上午/下午`)return!0;++Fh;break;case`[`:for(Lh=Ih;Ph.charAt(Fh++)!==`]`&&Fh<Ph.length;)Lh+=Ph.charAt(Fh);if(Lh.match(SSF_abstime))return!0;break;case`.`:case`0`:case`#`:for(;Fh<Ph.length&&(`0#?.,E+-%`.indexOf(Ih=Ph.charAt(++Fh))>-1||Ih==`\\`&&Ph.charAt(Fh+1)==`-`&&`0#`.indexOf(Ph.charAt(Fh+2))>-1););break;case`?`:for(;Ph.charAt(++Fh)===Ih;);break;case`*`:++Fh,(Ph.charAt(Fh)==` `||Ph.charAt(Fh)==`*`)&&++Fh;break;case`(`:case`)`:++Fh;break;case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:for(;Fh<Ph.length&&`0123456789`.indexOf(Ph.charAt(++Fh))>-1;);break;case` `:++Fh;break;default:++Fh;break}return!1}function eval_fmt(Ph,Fh,Ih,Lh){for(var Rh=[],zh=``,Bh=0,Vh=``,Hh=`t`,Uh,Wh,Gh,Kh=`H`;Bh<Ph.length;)switch(Vh=Ph.charAt(Bh)){case`G`:if(!SSF_isgeneral(Ph,Bh))throw Error(`unrecognized character `+Vh+` in `+Ph);Rh[Rh.length]={t:`G`,v:`General`},Bh+=7;break;case`"`:for(zh=``;(Gh=Ph.charCodeAt(++Bh))!==34&&Bh<Ph.length;)zh+=String.fromCharCode(Gh);Rh[Rh.length]={t:`t`,v:zh},++Bh;break;case`\\`:var qh=Ph.charAt(++Bh),Jh=qh===`(`||qh===`)`?qh:`t`;Rh[Rh.length]={t:Jh,v:qh},++Bh;break;case`_`:Rh[Rh.length]={t:`t`,v:` `},Bh+=2;break;case`@`:Rh[Rh.length]={t:`T`,v:Fh},++Bh;break;case`B`:case`b`:if(Ph.charAt(Bh+1)===`1`||Ph.charAt(Bh+1)===`2`){if(Uh==null&&(Uh=SSF_parse_date_code(Fh,Ih,Ph.charAt(Bh+1)===`2`),Uh==null))return``;Rh[Rh.length]={t:`X`,v:Ph.substr(Bh,2)},Hh=Vh,Bh+=2;break}case`M`:case`D`:case`Y`:case`H`:case`S`:case`E`:Vh=Vh.toLowerCase();case`m`:case`d`:case`y`:case`h`:case`s`:case`e`:case`g`:if(Fh<0||Uh==null&&(Uh=SSF_parse_date_code(Fh,Ih),Uh==null))return``;for(zh=Vh;++Bh<Ph.length&&Ph.charAt(Bh).toLowerCase()===Vh;)zh+=Vh;Vh===`m`&&Hh.toLowerCase()===`h`&&(Vh=`M`),Vh===`h`&&(Vh=Kh),Rh[Rh.length]={t:Vh,v:zh},Hh=Vh;break;case`A`:case`a`:case`上`:var Yh={t:Vh,v:Vh};if(Uh??=SSF_parse_date_code(Fh,Ih),Ph.substr(Bh,3).toUpperCase()===`A/P`?(Uh!=null&&(Yh.v=Uh.H>=12?Ph.charAt(Bh+2):Vh),Yh.t=`T`,Kh=`h`,Bh+=3):Ph.substr(Bh,5).toUpperCase()===`AM/PM`?(Uh!=null&&(Yh.v=Uh.H>=12?`PM`:`AM`),Yh.t=`T`,Bh+=5,Kh=`h`):Ph.substr(Bh,5).toUpperCase()===`上午/下午`?(Uh!=null&&(Yh.v=Uh.H>=12?`下午`:`上午`),Yh.t=`T`,Bh+=5,Kh=`h`):(Yh.t=`t`,++Bh),Uh==null&&Yh.t===`T`)return``;Rh[Rh.length]=Yh,Hh=Vh;break;case`[`:for(zh=Vh;Ph.charAt(Bh++)!==`]`&&Bh<Ph.length;)zh+=Ph.charAt(Bh);if(zh.slice(-1)!==`]`)throw`unterminated "[" block: |`+zh+`|`;if(zh.match(SSF_abstime)){if(Uh==null&&(Uh=SSF_parse_date_code(Fh,Ih),Uh==null))return``;Rh[Rh.length]={t:`Z`,v:zh.toLowerCase()},Hh=zh.charAt(1)}else zh.indexOf(`$`)>-1&&(zh=(zh.match(/\$([^-\[\]]*)/)||[])[1]||`$`,fmt_is_date(Ph)||(Rh[Rh.length]={t:`t`,v:zh}));break;case`.`:if(Uh!=null){for(zh=Vh;++Bh<Ph.length&&(Vh=Ph.charAt(Bh))===`0`;)zh+=Vh;Rh[Rh.length]={t:`s`,v:zh};break}case`0`:case`#`:for(zh=Vh;++Bh<Ph.length&&`0#?.,E+-%`.indexOf(Vh=Ph.charAt(Bh))>-1;)zh+=Vh;Rh[Rh.length]={t:`n`,v:zh};break;case`?`:for(zh=Vh;Ph.charAt(++Bh)===Vh;)zh+=Vh;Rh[Rh.length]={t:Vh,v:zh},Hh=Vh;break;case`*`:++Bh,(Ph.charAt(Bh)==` `||Ph.charAt(Bh)==`*`)&&++Bh;break;case`(`:case`)`:Rh[Rh.length]={t:Lh===1?`t`:Vh,v:Vh},++Bh;break;case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:for(zh=Vh;Bh<Ph.length&&`0123456789`.indexOf(Ph.charAt(++Bh))>-1;)zh+=Ph.charAt(Bh);Rh[Rh.length]={t:`D`,v:zh};break;case` `:Rh[Rh.length]={t:Vh,v:Vh},++Bh;break;case`$`:Rh[Rh.length]={t:`t`,v:`$`},++Bh;break;default:if(`,$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP`.indexOf(Vh)===-1)throw Error(`unrecognized character `+Vh+` in `+Ph);Rh[Rh.length]={t:`t`,v:Vh},++Bh;break}var Xh=0,Zh=0,Qh;for(Bh=Rh.length-1,Hh=`t`;Bh>=0;--Bh)switch(Rh[Bh].t){case`h`:case`H`:Rh[Bh].t=Kh,Hh=`h`,Xh<1&&(Xh=1);break;case`s`:(Qh=Rh[Bh].v.match(/\.0+$/))&&(Zh=Math.max(Zh,Qh[0].length-1),Xh=4),Xh<3&&(Xh=3);case`d`:case`y`:case`e`:Hh=Rh[Bh].t;break;case`M`:Hh=Rh[Bh].t,Xh<2&&(Xh=2);break;case`m`:Hh===`s`&&(Rh[Bh].t=`M`,Xh<2&&(Xh=2));break;case`X`:break;case`Z`:Xh<1&&Rh[Bh].v.match(/[Hh]/)&&(Xh=1),Xh<2&&Rh[Bh].v.match(/[Mm]/)&&(Xh=2),Xh<3&&Rh[Bh].v.match(/[Ss]/)&&(Xh=3)}var $h;switch(Xh){case 0:break;case 1:case 2:case 3:Uh.u>=.5&&(Uh.u=0,++Uh.S),Uh.S>=60&&(Uh.S=0,++Uh.M),Uh.M>=60&&(Uh.M=0,++Uh.H),Uh.H>=24&&(Uh.H=0,++Uh.D,$h=SSF_parse_date_code(Uh.D),$h.u=Uh.u,$h.S=Uh.S,$h.M=Uh.M,$h.H=Uh.H,Uh=$h);break;case 4:switch(Zh){case 1:Uh.u=Math.round(Uh.u*10)/10;break;case 2:Uh.u=Math.round(Uh.u*100)/100;break;case 3:Uh.u=Math.round(Uh.u*1e3)/1e3;break}Uh.u>=1&&(Uh.u=0,++Uh.S),Uh.S>=60&&(Uh.S=0,++Uh.M),Uh.M>=60&&(Uh.M=0,++Uh.H),Uh.H>=24&&(Uh.H=0,++Uh.D,$h=SSF_parse_date_code(Uh.D),$h.u=Uh.u,$h.S=Uh.S,$h.M=Uh.M,$h.H=Uh.H,Uh=$h);break}var eg=``,tg;for(Bh=0;Bh<Rh.length;++Bh)switch(Rh[Bh].t){case`t`:case`T`:case` `:case`D`:break;case`X`:Rh[Bh].v=``,Rh[Bh].t=`;`;break;case`d`:case`m`:case`y`:case`h`:case`H`:case`M`:case`s`:case`e`:case`b`:case`Z`:Rh[Bh].v=SSF_write_date(Rh[Bh].t.charCodeAt(0),Rh[Bh].v,Uh,Zh),Rh[Bh].t=`t`;break;case`n`:case`?`:for(tg=Bh+1;Rh[tg]!=null&&((Vh=Rh[tg].t)===`?`||Vh===`D`||(Vh===` `||Vh===`t`)&&Rh[tg+1]!=null&&(Rh[tg+1].t===`?`||Rh[tg+1].t===`t`&&Rh[tg+1].v===`/`)||Rh[Bh].t===`(`&&(Vh===` `||Vh===`n`||Vh===`)`)||Vh===`t`&&(Rh[tg].v===`/`||Rh[tg].v===` `&&Rh[tg+1]!=null&&Rh[tg+1].t==`?`));)Rh[Bh].v+=Rh[tg].v,Rh[tg]={v:``,t:`;`},++tg;eg+=Rh[Bh].v,Bh=tg-1;break;case`G`:Rh[Bh].t=`t`,Rh[Bh].v=SSF_general(Fh,Ih);break}var ng=``,rg,ig;if(eg.length>0){eg.charCodeAt(0)==40?(rg=Fh<0&&eg.charCodeAt(0)===45?-Fh:Fh,ig=write_num(`n`,eg,rg)):(rg=Fh<0&&Lh>1?-Fh:Fh,ig=write_num(`n`,eg,rg),rg<0&&Rh[0]&&Rh[0].t==`t`&&(ig=ig.substr(1),Rh[0].v=`-`+Rh[0].v)),tg=ig.length-1;var ag=Rh.length;for(Bh=0;Bh<Rh.length;++Bh)if(Rh[Bh]!=null&&Rh[Bh].t!=`t`&&Rh[Bh].v.indexOf(`.`)>-1){ag=Bh;break}var og=Rh.length;if(ag===Rh.length&&ig.indexOf(`E`)===-1){for(Bh=Rh.length-1;Bh>=0;--Bh)Rh[Bh]==null||`n?`.indexOf(Rh[Bh].t)===-1||(tg>=Rh[Bh].v.length-1?(tg-=Rh[Bh].v.length,Rh[Bh].v=ig.substr(tg+1,Rh[Bh].v.length)):tg<0?Rh[Bh].v=``:(Rh[Bh].v=ig.substr(0,tg+1),tg=-1),Rh[Bh].t=`t`,og=Bh);tg>=0&&og<Rh.length&&(Rh[og].v=ig.substr(0,tg+1)+Rh[og].v)}else if(ag!==Rh.length&&ig.indexOf(`E`)===-1){for(tg=ig.indexOf(`.`)-1,Bh=ag;Bh>=0;--Bh)if(!(Rh[Bh]==null||`n?`.indexOf(Rh[Bh].t)===-1)){for(Wh=Rh[Bh].v.indexOf(`.`)>-1&&Bh===ag?Rh[Bh].v.indexOf(`.`)-1:Rh[Bh].v.length-1,ng=Rh[Bh].v.substr(Wh+1);Wh>=0;--Wh)tg>=0&&(Rh[Bh].v.charAt(Wh)===`0`||Rh[Bh].v.charAt(Wh)===`#`)&&(ng=ig.charAt(tg--)+ng);Rh[Bh].v=ng,Rh[Bh].t=`t`,og=Bh}for(tg>=0&&og<Rh.length&&(Rh[og].v=ig.substr(0,tg+1)+Rh[og].v),tg=ig.indexOf(`.`)+1,Bh=ag;Bh<Rh.length;++Bh)if(!(Rh[Bh]==null||`n?(`.indexOf(Rh[Bh].t)===-1&&Bh!==ag)){for(Wh=Rh[Bh].v.indexOf(`.`)>-1&&Bh===ag?Rh[Bh].v.indexOf(`.`)+1:0,ng=Rh[Bh].v.substr(0,Wh);Wh<Rh[Bh].v.length;++Wh)tg<ig.length&&(ng+=ig.charAt(tg++));Rh[Bh].v=ng,Rh[Bh].t=`t`,og=Bh}}}for(Bh=0;Bh<Rh.length;++Bh)Rh[Bh]!=null&&`n?`.indexOf(Rh[Bh].t)>-1&&(rg=Lh>1&&Fh<0&&Bh>0&&Rh[Bh-1].v===`-`?-Fh:Fh,Rh[Bh].v=write_num(Rh[Bh].t,Rh[Bh].v,rg),Rh[Bh].t=`t`);var sg=``;for(Bh=0;Bh!==Rh.length;++Bh)Rh[Bh]!=null&&(sg+=Rh[Bh].v);return sg}var cfregex2=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function chkcond(Ph,Fh){if(Fh==null)return!1;var Ih=parseFloat(Fh[2]);switch(Fh[1]){case`=`:if(Ph==Ih)return!0;break;case`>`:if(Ph>Ih)return!0;break;case`<`:if(Ph<Ih)return!0;break;case`<>`:if(Ph!=Ih)return!0;break;case`>=`:if(Ph>=Ih)return!0;break;case`<=`:if(Ph<=Ih)return!0;break}return!1}function choose_fmt(Ph,Fh){var Ih=SSF_split_fmt(Ph),Lh=Ih.length,Rh=Ih[Lh-1].indexOf(`@`);if(Lh<4&&Rh>-1&&--Lh,Ih.length>4)throw Error(`cannot find right format for |`+Ih.join(`|`)+`|`);if(typeof Fh!=`number`)return[4,Ih.length===4||Rh>-1?Ih[Ih.length-1]:`@`];switch(typeof Fh==`number`&&!isFinite(Fh)&&(Fh=0),Ih.length){case 1:Ih=Rh>-1?[`General`,`General`,`General`,Ih[0]]:[Ih[0],Ih[0],Ih[0],`@`];break;case 2:Ih=Rh>-1?[Ih[0],Ih[0],Ih[0],Ih[1]]:[Ih[0],Ih[1],Ih[0],`@`];break;case 3:Ih=Rh>-1?[Ih[0],Ih[1],Ih[0],Ih[2]]:[Ih[0],Ih[1],Ih[2],`@`];break;case 4:break}var zh=Fh>0?Ih[0]:Fh<0?Ih[1]:Ih[2];if(Ih[0].indexOf(`[`)===-1&&Ih[1].indexOf(`[`)===-1)return[Lh,zh];if(Ih[0].match(/\[[=<>]/)!=null||Ih[1].match(/\[[=<>]/)!=null){var Bh=Ih[0].match(cfregex2),Vh=Ih[1].match(cfregex2);return chkcond(Fh,Bh)?[Lh,Ih[0]]:chkcond(Fh,Vh)?[Lh,Ih[1]]:[Lh,Ih[Bh!=null&&Vh!=null?2:1]]}return[Lh,zh]}function SSF_format(Ph,Fh,Ih){Ih??={};var Lh=``;switch(typeof Ph){case`string`:Lh=Ph==`m/d/yy`&&Ih.dateNF?Ih.dateNF:Ph;break;case`number`:Lh=Ph==14&&Ih.dateNF?Ih.dateNF:(Ih.table==null?table_fmt:Ih.table)[Ph],Lh??=Ih.table&&Ih.table[SSF_default_map[Ph]]||table_fmt[SSF_default_map[Ph]],Lh??=SSF_default_str[Ph]||`General`;break}if(SSF_isgeneral(Lh,0))return SSF_general(Fh,Ih);Fh instanceof Date&&(Fh=datenum(Fh,Ih.date1904));var Rh=choose_fmt(Lh,Fh);if(SSF_isgeneral(Rh[1]))return SSF_general(Fh,Ih);if(Fh===!0)Fh=`TRUE`;else if(Fh===!1)Fh=`FALSE`;else if(Fh===``||Fh==null)return``;else if(isNaN(Fh)&&Rh[1].indexOf(`0`)>-1)return`#NUM!`;else if(!isFinite(Fh)&&Rh[1].indexOf(`0`)>-1)return`#DIV/0!`;return eval_fmt(Rh[1],Fh,Ih,Rh[0])}function SSF_load(Ph,Fh){if(typeof Fh!=`number`){Fh=+Fh||-1;for(var Ih=0;Ih<392;++Ih){if(table_fmt[Ih]==null){Fh<0&&(Fh=Ih);continue}if(table_fmt[Ih]==Ph){Fh=Ih;break}}Fh<0&&(Fh=391)}return table_fmt[Fh]=Ph,Fh}function SSF_load_table(Ph){for(var Fh=0;Fh!=392;++Fh)Ph[Fh]!==void 0&&SSF_load(Ph[Fh],Fh)}function make_ssf(){table_fmt=SSF_init_table()}var dateNFregex=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function dateNF_regex(Ph){var Fh=typeof Ph==`number`?table_fmt[Ph]:Ph;return Fh=Fh.replace(dateNFregex,`(\\d+)`),dateNFregex.lastIndex=0,RegExp(`^`+Fh+`$`)}function dateNF_fix(Ph,Fh,Ih){var Lh=-1,Rh=-1,zh=-1,Bh=-1,Vh=-1,Hh=-1;(Fh.match(dateNFregex)||[]).forEach(function(Ph,Fh){var Uh=parseInt(Ih[Fh+1],10);switch(Ph.toLowerCase().charAt(0)){case`y`:Lh=Uh;break;case`d`:zh=Uh;break;case`h`:Bh=Uh;break;case`s`:Hh=Uh;break;case`m`:Bh>=0?Vh=Uh:Rh=Uh;break}}),dateNFregex.lastIndex=0,Hh>=0&&Vh==-1&&Rh>=0&&(Vh=Rh,Rh=-1);var Uh=(``+(Lh>=0?Lh:new Date().getFullYear())).slice(-4)+`-`+(`00`+(Rh>=1?Rh:1)).slice(-2)+`-`+(`00`+(zh>=1?zh:1)).slice(-2);Uh.length==7&&(Uh=`0`+Uh),Uh.length==8&&(Uh=`20`+Uh);var Wh=(`00`+(Bh>=0?Bh:0)).slice(-2)+`:`+(`00`+(Vh>=0?Vh:0)).slice(-2)+`:`+(`00`+(Hh>=0?Hh:0)).slice(-2);return Bh==-1&&Vh==-1&&Hh==-1?Uh:Lh==-1&&Rh==-1&&zh==-1?Wh:Uh+`T`+Wh}var bad_formats={"d.m":`d\\.m`};function SSF__load(Ph,Fh){return SSF_load(bad_formats[Ph]||Ph,Fh)}var CRC32=(function(){var Ph={};Ph.version=`1.2.0`;function Fh(){for(var Ph=0,Fh=Array(256),Ih=0;Ih!=256;++Ih)Ph=Ih,Ph=Ph&1?-306674912^Ph>>>1:Ph>>>1,Ph=Ph&1?-306674912^Ph>>>1:Ph>>>1,Ph=Ph&1?-306674912^Ph>>>1:Ph>>>1,Ph=Ph&1?-306674912^Ph>>>1:Ph>>>1,Ph=Ph&1?-306674912^Ph>>>1:Ph>>>1,Ph=Ph&1?-306674912^Ph>>>1:Ph>>>1,Ph=Ph&1?-306674912^Ph>>>1:Ph>>>1,Ph=Ph&1?-306674912^Ph>>>1:Ph>>>1,Fh[Ih]=Ph;return typeof Int32Array<`u`?new Int32Array(Fh):Fh}var Ih=Fh();function Lh(Ph){var Fh=0,Ih=0,Lh=0,Rh=typeof Int32Array<`u`?new Int32Array(4096):Array(4096);for(Lh=0;Lh!=256;++Lh)Rh[Lh]=Ph[Lh];for(Lh=0;Lh!=256;++Lh)for(Ih=Ph[Lh],Fh=256+Lh;Fh<4096;Fh+=256)Ih=Rh[Fh]=Ih>>>8^Ph[Ih&255];var zh=[];for(Lh=1;Lh!=16;++Lh)zh[Lh-1]=typeof Int32Array<`u`&&typeof Rh.subarray==`function`?Rh.subarray(Lh*256,Lh*256+256):Rh.slice(Lh*256,Lh*256+256);return zh}var Rh=Lh(Ih),zh=Rh[0],Bh=Rh[1],Vh=Rh[2],Hh=Rh[3],Uh=Rh[4],Wh=Rh[5],Gh=Rh[6],Kh=Rh[7],qh=Rh[8],Jh=Rh[9],Yh=Rh[10],Xh=Rh[11],Zh=Rh[12],Qh=Rh[13],$h=Rh[14];function eg(Ph,Fh){for(var Lh=Fh^-1,Rh=0,zh=Ph.length;Rh<zh;)Lh=Lh>>>8^Ih[(Lh^Ph.charCodeAt(Rh++))&255];return~Lh}function tg(Ph,Fh){for(var Lh=Fh^-1,Rh=Ph.length-15,eg=0;eg<Rh;)Lh=$h[Ph[eg++]^Lh&255]^Qh[Ph[eg++]^Lh>>8&255]^Zh[Ph[eg++]^Lh>>16&255]^Xh[Ph[eg++]^Lh>>>24]^Yh[Ph[eg++]]^Jh[Ph[eg++]]^qh[Ph[eg++]]^Kh[Ph[eg++]]^Gh[Ph[eg++]]^Wh[Ph[eg++]]^Uh[Ph[eg++]]^Hh[Ph[eg++]]^Vh[Ph[eg++]]^Bh[Ph[eg++]]^zh[Ph[eg++]]^Ih[Ph[eg++]];for(Rh+=15;eg<Rh;)Lh=Lh>>>8^Ih[(Lh^Ph[eg++])&255];return~Lh}function ng(Ph,Fh){for(var Lh=Fh^-1,Rh=0,zh=Ph.length,Bh=0,Vh=0;Rh<zh;)Bh=Ph.charCodeAt(Rh++),Bh<128?Lh=Lh>>>8^Ih[(Lh^Bh)&255]:Bh<2048?(Lh=Lh>>>8^Ih[(Lh^(192|Bh>>6&31))&255],Lh=Lh>>>8^Ih[(Lh^(128|Bh&63))&255]):Bh>=55296&&Bh<57344?(Bh=(Bh&1023)+64,Vh=Ph.charCodeAt(Rh++)&1023,Lh=Lh>>>8^Ih[(Lh^(240|Bh>>8&7))&255],Lh=Lh>>>8^Ih[(Lh^(128|Bh>>2&63))&255],Lh=Lh>>>8^Ih[(Lh^(128|Vh>>6&15|(Bh&3)<<4))&255],Lh=Lh>>>8^Ih[(Lh^(128|Vh&63))&255]):(Lh=Lh>>>8^Ih[(Lh^(224|Bh>>12&15))&255],Lh=Lh>>>8^Ih[(Lh^(128|Bh>>6&63))&255],Lh=Lh>>>8^Ih[(Lh^(128|Bh&63))&255]);return~Lh}return Ph.table=Ih,Ph.bstr=eg,Ph.buf=tg,Ph.str=ng,Ph})(),CFB=(function(){var Ph={};Ph.version=`1.2.2`;function Fh(Ph,Fh){for(var Ih=Ph.split(`/`),Lh=Fh.split(`/`),Rh=0,zh=0,Bh=Math.min(Ih.length,Lh.length);Rh<Bh;++Rh){if(zh=Ih[Rh].length-Lh[Rh].length)return zh;if(Ih[Rh]!=Lh[Rh])return Ih[Rh]<Lh[Rh]?-1:1}return Ih.length-Lh.length}function Ih(Ph){if(Ph.charAt(Ph.length-1)==`/`)return Ph.slice(0,-1).indexOf(`/`)===-1?Ph:Ih(Ph.slice(0,-1));var Fh=Ph.lastIndexOf(`/`);return Fh===-1?Ph:Ph.slice(0,Fh+1)}function Lh(Ph){if(Ph.charAt(Ph.length-1)==`/`)return Lh(Ph.slice(0,-1));var Fh=Ph.lastIndexOf(`/`);return Fh===-1?Ph:Ph.slice(Fh+1)}function Rh(Ph,Fh){typeof Fh==`string`&&(Fh=new Date(Fh));var Ih=Fh.getHours();Ih=Ih<<6|Fh.getMinutes(),Ih=Ih<<5|Fh.getSeconds()>>>1,Ph.write_shift(2,Ih);var Lh=Fh.getFullYear()-1980;Lh=Lh<<4|Fh.getMonth()+1,Lh=Lh<<5|Fh.getDate(),Ph.write_shift(2,Lh)}function zh(Ph){var Fh=Ph.read_shift(2)&65535,Ih=Ph.read_shift(2)&65535,Lh=new Date,Rh=Ih&31;Ih>>>=5;var zh=Ih&15;Ih>>>=4,Lh.setMilliseconds(0),Lh.setFullYear(Ih+1980),Lh.setMonth(zh-1),Lh.setDate(Rh);var Bh=Fh&31;Fh>>>=5;var Vh=Fh&63;return Fh>>>=6,Lh.setHours(Fh),Lh.setMinutes(Vh),Lh.setSeconds(Bh<<1),Lh}function Bh(Ph){prep_blob(Ph,0);for(var Fh={},Ih=0;Ph.l<=Ph.length-4;){var Lh=Ph.read_shift(2),Rh=Ph.read_shift(2),zh=Ph.l+Rh,Bh={};switch(Lh){case 21589:Ih=Ph.read_shift(1),Ih&1&&(Bh.mtime=Ph.read_shift(4)),Rh>5&&(Ih&2&&(Bh.atime=Ph.read_shift(4)),Ih&4&&(Bh.ctime=Ph.read_shift(4))),Bh.mtime&&(Bh.mt=new Date(Bh.mtime*1e3));break;case 1:var Vh=Ph.read_shift(4),Hh=Ph.read_shift(4);Bh.usz=Hh*2**32+Vh,Vh=Ph.read_shift(4),Hh=Ph.read_shift(4),Bh.csz=Hh*2**32+Vh;break}Ph.l=zh,Fh[Lh]=Bh}return Fh}var Vh;function Hh(){return Vh||=_fs}function Uh(Ph,Fh){if(Ph[0]==80&&Ph[1]==75)return t_(Ph,Fh);if((Ph[0]|32)==109&&(Ph[1]|32)==105)return u_(Ph,Fh);if(Ph.length<512)throw Error(`CFB file size `+Ph.length+` < 512`);var Ih=3,Lh=512,Rh=0,zh=0,Bh=0,Vh=0,Hh=0,Uh=[],Jh=Ph.slice(0,512);prep_blob(Jh,0);var Xh=Wh(Jh);switch(Ih=Xh[0],Ih){case 3:Lh=512;break;case 4:Lh=4096;break;case 0:if(Xh[1]==0)return t_(Ph,Fh);default:throw Error(`Major Version: Expected 3 or 4 saw `+Ih)}Lh!==512&&(Jh=Ph.slice(0,Lh),prep_blob(Jh,28));var $h=Ph.slice(0,Lh);Gh(Jh,Ih);var eg=Jh.read_shift(4,`i`);if(Ih===3&&eg!==0)throw Error(`# Directory Sectors: Expected 0 saw `+eg);Jh.l+=4,Bh=Jh.read_shift(4,`i`),Jh.l+=4,Jh.chk(`00100000`,`Mini Stream Cutoff Size: `),Vh=Jh.read_shift(4,`i`),Rh=Jh.read_shift(4,`i`),Hh=Jh.read_shift(4,`i`),zh=Jh.read_shift(4,`i`);for(var tg=-1,ng=0;ng<109&&(tg=Jh.read_shift(4,`i`),!(tg<0));++ng)Uh[ng]=tg;var rg=Kh(Ph,Lh);Yh(Hh,zh,rg,Lh,Uh);var ig=Zh(rg,Bh,Uh,Lh);Bh<ig.length&&(ig[Bh].name=`!Directory`),Rh>0&&Vh!==cg&&(ig[Vh].name=`!MiniFAT`),ig[Uh[0]].name=`!FAT`,ig.fat_addrs=Uh,ig.ssz=Lh;var ag={},og=[],sg=[],lg=[];Qh(Bh,ig,rg,og,Rh,ag,sg,Vh),qh(sg,lg,og),og.shift();var ug={FileIndex:sg,FullPaths:lg};return Fh&&Fh.raw&&(ug.raw={header:$h,sectors:rg}),ug}function Wh(Ph){if(Ph[Ph.l]==80&&Ph[Ph.l+1]==75)return[0,0];Ph.chk(lg,`Header Signature: `),Ph.l+=16;var Fh=Ph.read_shift(2,`u`);return[Ph.read_shift(2,`u`),Fh]}function Gh(Ph,Fh){var Ih=9;switch(Ph.l+=2,Ih=Ph.read_shift(2)){case 9:if(Fh!=3)throw Error(`Sector Shift: Expected 9 saw `+Ih);break;case 12:if(Fh!=4)throw Error(`Sector Shift: Expected 12 saw `+Ih);break;default:throw Error(`Sector Shift: Expected 9 or 12 saw `+Ih)}Ph.chk(`0600`,`Mini Sector Shift: `),Ph.chk(`000000000000`,`Reserved: `)}function Kh(Ph,Fh){for(var Ih=Math.ceil(Ph.length/Fh)-1,Lh=[],Rh=1;Rh<Ih;++Rh)Lh[Rh-1]=Ph.slice(Rh*Fh,(Rh+1)*Fh);return Lh[Ih-1]=Ph.slice(Ih*Fh),Lh}function qh(Ph,Fh,Ih){for(var Lh=0,Rh=0,zh=0,Bh=0,Vh=0,Hh=Ih.length,Uh=[],Wh=[];Lh<Hh;++Lh)Uh[Lh]=Wh[Lh]=Lh,Fh[Lh]=Ih[Lh];for(;Vh<Wh.length;++Vh)Lh=Wh[Vh],Rh=Ph[Lh].L,zh=Ph[Lh].R,Bh=Ph[Lh].C,Uh[Lh]===Lh&&(Rh!==-1&&Uh[Rh]!==Rh&&(Uh[Lh]=Uh[Rh]),zh!==-1&&Uh[zh]!==zh&&(Uh[Lh]=Uh[zh])),Bh!==-1&&(Uh[Bh]=Lh),Rh!==-1&&Lh!=Uh[Lh]&&(Uh[Rh]=Uh[Lh],Wh.lastIndexOf(Rh)<Vh&&Wh.push(Rh)),zh!==-1&&Lh!=Uh[Lh]&&(Uh[zh]=Uh[Lh],Wh.lastIndexOf(zh)<Vh&&Wh.push(zh));for(Lh=1;Lh<Hh;++Lh)Uh[Lh]===Lh&&(zh!==-1&&Uh[zh]!==zh?Uh[Lh]=Uh[zh]:Rh!==-1&&Uh[Rh]!==Rh&&(Uh[Lh]=Uh[Rh]));for(Lh=1;Lh<Hh;++Lh)if(Ph[Lh].type!==0){if(Vh=Lh,Vh!=Uh[Vh])do Vh=Uh[Vh],Fh[Lh]=Fh[Vh]+`/`+Fh[Lh];while(Vh!==0&&Uh[Vh]!==-1&&Vh!=Uh[Vh]);Uh[Lh]=-1}for(Fh[0]+=`/`,Lh=1;Lh<Hh;++Lh)Ph[Lh].type!==2&&(Fh[Lh]+=`/`)}function Jh(Ph,Fh,Ih){for(var Lh=Ph.start,Rh=Ph.size,zh=[],Bh=Lh;Ih&&Rh>0&&Bh>=0;)zh.push(Fh.slice(Bh*sg,Bh*sg+sg)),Rh-=sg,Bh=__readInt32LE(Ih,Bh*4);return zh.length===0?new_buf(0):bconcat(zh).slice(0,Ph.size)}function Yh(Ph,Fh,Ih,Lh,Rh){var zh=cg;if(Ph===cg){if(Fh!==0)throw Error(`DIFAT chain shorter than expected`)}else if(Ph!==-1){var Bh=Ih[Ph],Vh=(Lh>>>2)-1;if(!Bh)return;for(var Hh=0;Hh<Vh&&(zh=__readInt32LE(Bh,Hh*4))!==cg;++Hh)Rh.push(zh);Fh>=1&&Yh(__readInt32LE(Bh,Lh-4),Fh-1,Ih,Lh,Rh)}}function Xh(Ph,Fh,Ih,Lh,Rh){var zh=[],Bh=[];Rh||=[];var Vh=Lh-1,Hh=0,Uh=0;for(Hh=Fh;Hh>=0;){Rh[Hh]=!0,zh[zh.length]=Hh,Bh.push(Ph[Hh]);var Wh=Ih[Math.floor(Hh*4/Lh)];if(Uh=Hh*4&Vh,Lh<4+Uh)throw Error(`FAT boundary crossed: `+Hh+` 4 `+Lh);if(!Ph[Wh])break;Hh=__readInt32LE(Ph[Wh],Uh)}return{nodes:zh,data:__toBuffer([Bh])}}function Zh(Ph,Fh,Ih,Lh){var Rh=Ph.length,zh=[],Bh=[],Vh=[],Hh=[],Uh=Lh-1,Wh=0,Gh=0,Kh=0,qh=0;for(Wh=0;Wh<Rh;++Wh)if(Vh=[],Kh=Wh+Fh,Kh>=Rh&&(Kh-=Rh),!Bh[Kh]){Hh=[];var Jh=[];for(Gh=Kh;Gh>=0;){Jh[Gh]=!0,Bh[Gh]=!0,Vh[Vh.length]=Gh,Hh.push(Ph[Gh]);var Yh=Ih[Math.floor(Gh*4/Lh)];if(qh=Gh*4&Uh,Lh<4+qh)throw Error(`FAT boundary crossed: `+Gh+` 4 `+Lh);if(!Ph[Yh]||(Gh=__readInt32LE(Ph[Yh],qh),Jh[Gh]))break}zh[Kh]={nodes:Vh,data:__toBuffer([Hh])}}return zh}function Qh(Ph,Fh,Ih,Lh,Rh,zh,Bh,Vh){for(var Hh=0,Uh=Lh.length?2:0,Wh=Fh[Ph].data,Gh=0,Kh=0,qh;Gh<Wh.length;Gh+=128){var Yh=Wh.slice(Gh,Gh+128);prep_blob(Yh,64),Kh=Yh.read_shift(2),qh=__utf16le(Yh,0,Kh-Uh),Lh.push(qh);var Zh={name:qh,type:Yh.read_shift(1),color:Yh.read_shift(1),L:Yh.read_shift(4,`i`),R:Yh.read_shift(4,`i`),C:Yh.read_shift(4,`i`),clsid:Yh.read_shift(16),state:Yh.read_shift(4,`i`),start:0,size:0};Yh.read_shift(2)+Yh.read_shift(2)+Yh.read_shift(2)+Yh.read_shift(2)!==0&&(Zh.ct=$h(Yh,Yh.l-8)),Yh.read_shift(2)+Yh.read_shift(2)+Yh.read_shift(2)+Yh.read_shift(2)!==0&&(Zh.mt=$h(Yh,Yh.l-8)),Zh.start=Yh.read_shift(4,`i`),Zh.size=Yh.read_shift(4,`i`),Zh.size<0&&Zh.start<0&&(Zh.size=Zh.type=0,Zh.start=cg,Zh.name=``),Zh.type===5?(Hh=Zh.start,Rh>0&&Hh!==cg&&(Fh[Hh].name=`!StreamData`)):Zh.size>=4096?(Zh.storage=`fat`,Fh[Zh.start]===void 0&&(Fh[Zh.start]=Xh(Ih,Zh.start,Fh.fat_addrs,Fh.ssz)),Fh[Zh.start].name=Zh.name,Zh.content=Fh[Zh.start].data.slice(0,Zh.size)):(Zh.storage=`minifat`,Zh.size<0?Zh.size=0:Hh!==cg&&Zh.start!==cg&&Fh[Hh]&&(Zh.content=Jh(Zh,Fh[Hh].data,(Fh[Vh]||{}).data))),Zh.content&&prep_blob(Zh.content,0),zh[qh]=Zh,Bh.push(Zh)}}function $h(Ph,Fh){return new Date((__readUInt32LE(Ph,Fh+4)/1e7*2**32+__readUInt32LE(Ph,Fh)/1e7-11644473600)*1e3)}function eg(Ph,Fh){return Hh(),Uh(Vh.readFileSync(Ph),Fh)}function tg(Ph,Fh){var Ih=Fh&&Fh.type;switch(Ih||has_buf&&Buffer.isBuffer(Ph)&&(Ih=`buffer`),Ih||`base64`){case`file`:return eg(Ph,Fh);case`base64`:return Uh(s2a(Base64_decode(Ph)),Fh);case`binary`:return Uh(s2a(Ph),Fh)}return Uh(Ph,Fh)}function ng(Ph,Fh){var Ih=Fh||{},Lh=Ih.root||`Root Entry`;if(Ph.FullPaths||=[],Ph.FileIndex||=[],Ph.FullPaths.length!==Ph.FileIndex.length)throw Error(`inconsistent CFB structure`);Ph.FullPaths.length===0&&(Ph.FullPaths[0]=Lh+`/`,Ph.FileIndex[0]={name:Lh,type:5}),Ih.CLSID&&(Ph.FileIndex[0].clsid=Ih.CLSID),rg(Ph)}function rg(Ph){var Fh=`Sh33tJ5`;if(!CFB.find(Ph,`/`+Fh)){var Ih=new_buf(4);Ih[0]=55,Ih[1]=Ih[3]=50,Ih[2]=54,Ph.FileIndex.push({name:Fh,type:2,content:Ih,size:4,L:69,R:69,C:69}),Ph.FullPaths.push(Ph.FullPaths[0]+Fh),ig(Ph)}}function ig(Ph,Rh){ng(Ph);for(var zh=!1,Bh=!1,Vh=Ph.FullPaths.length-1;Vh>=0;--Vh){var Hh=Ph.FileIndex[Vh];switch(Hh.type){case 0:Bh?zh=!0:(Ph.FileIndex.pop(),Ph.FullPaths.pop());break;case 1:case 2:case 5:Bh=!0,isNaN(Hh.R*Hh.L*Hh.C)&&(zh=!0),Hh.R>-1&&Hh.L>-1&&Hh.R==Hh.L&&(zh=!0);break;default:zh=!0;break}}if(!(!zh&&!Rh)){var Uh=new Date(1987,1,19),Wh=0,Gh=Object.create?Object.create(null):{},Kh=[];for(Vh=0;Vh<Ph.FullPaths.length;++Vh)Gh[Ph.FullPaths[Vh]]=!0,Ph.FileIndex[Vh].type!==0&&Kh.push([Ph.FullPaths[Vh],Ph.FileIndex[Vh]]);for(Vh=0;Vh<Kh.length;++Vh){var qh=Ih(Kh[Vh][0]);for(Bh=Gh[qh];!Bh;){for(;Ih(qh)&&!Gh[Ih(qh)];)qh=Ih(qh);Kh.push([qh,{name:Lh(qh).replace(`/`,``),type:1,clsid:dg,ct:Uh,mt:Uh,content:null}]),Gh[qh]=!0,qh=Ih(Kh[Vh][0]),Bh=Gh[qh]}}for(Kh.sort(function(Ph,Ih){return Fh(Ph[0],Ih[0])}),Ph.FullPaths=[],Ph.FileIndex=[],Vh=0;Vh<Kh.length;++Vh)Ph.FullPaths[Vh]=Kh[Vh][0],Ph.FileIndex[Vh]=Kh[Vh][1];for(Vh=0;Vh<Kh.length;++Vh){var Jh=Ph.FileIndex[Vh],Yh=Ph.FullPaths[Vh];if(Jh.name=Lh(Yh).replace(`/`,``),Jh.L=Jh.R=Jh.C=-(Jh.color=1),Jh.size=Jh.content?Jh.content.length:0,Jh.start=0,Jh.clsid=Jh.clsid||dg,Vh===0)Jh.C=Kh.length>1?1:-1,Jh.size=0,Jh.type=5;else if(Yh.slice(-1)==`/`){for(Wh=Vh+1;Wh<Kh.length&&Ih(Ph.FullPaths[Wh])!=Yh;++Wh);for(Jh.C=Wh>=Kh.length?-1:Wh,Wh=Vh+1;Wh<Kh.length&&Ih(Ph.FullPaths[Wh])!=Ih(Yh);++Wh);Jh.R=Wh>=Kh.length?-1:Wh,Jh.type=1}else Ih(Ph.FullPaths[Vh+1]||``)==Ih(Yh)&&(Jh.R=Vh+1),Jh.type=2}}}function ag(Ph,Fh){var Ih=Fh||{};if(Ih.fileType==`mad`)return d_(Ph,Ih);switch(ig(Ph),Ih.fileType){case`zip`:return r_(Ph,Ih)}var Lh=(function(Ph){for(var Fh=0,Ih=0,Lh=0;Lh<Ph.FileIndex.length;++Lh){var Rh=Ph.FileIndex[Lh];if(Rh.content){var zh=Rh.content.length;zh>0&&(zh<4096?Fh+=zh+63>>6:Ih+=zh+511>>9)}}for(var Bh=Ph.FullPaths.length+3>>2,Vh=Fh+7>>3,Hh=Fh+127>>7,Uh=Vh+Ih+Bh+Hh,Wh=Uh+127>>7,Gh=Wh<=109?0:Math.ceil((Wh-109)/127);Uh+Wh+Gh+127>>7>Wh;)Gh=++Wh<=109?0:Math.ceil((Wh-109)/127);var Kh=[1,Gh,Wh,Hh,Bh,Ih,Fh,0];return Ph.FileIndex[0].size=Fh<<6,Kh[7]=(Ph.FileIndex[0].start=Kh[0]+Kh[1]+Kh[2]+Kh[3]+Kh[4]+Kh[5])+(Kh[6]+7>>3),Kh})(Ph),Rh=new_buf(Lh[7]<<9),zh=0,Bh=0;for(zh=0;zh<8;++zh)Rh.write_shift(1,ug[zh]);for(zh=0;zh<8;++zh)Rh.write_shift(2,0);for(Rh.write_shift(2,62),Rh.write_shift(2,3),Rh.write_shift(2,65534),Rh.write_shift(2,9),Rh.write_shift(2,6),zh=0;zh<3;++zh)Rh.write_shift(2,0);for(Rh.write_shift(4,0),Rh.write_shift(4,Lh[2]),Rh.write_shift(4,Lh[0]+Lh[1]+Lh[2]+Lh[3]-1),Rh.write_shift(4,0),Rh.write_shift(4,4096),Rh.write_shift(4,Lh[3]?Lh[0]+Lh[1]+Lh[2]-1:cg),Rh.write_shift(4,Lh[3]),Rh.write_shift(-4,Lh[1]?Lh[0]-1:cg),Rh.write_shift(4,Lh[1]),zh=0;zh<109;++zh)Rh.write_shift(-4,zh<Lh[2]?Lh[1]+zh:-1);if(Lh[1])for(Bh=0;Bh<Lh[1];++Bh){for(;zh<236+Bh*127;++zh)Rh.write_shift(-4,zh<Lh[2]?Lh[1]+zh:-1);Rh.write_shift(-4,Bh===Lh[1]-1?cg:Bh+1)}var Vh=function(Ph){for(Bh+=Ph;zh<Bh-1;++zh)Rh.write_shift(-4,zh+1);Ph&&(++zh,Rh.write_shift(-4,cg))};for(Bh=zh=0,Bh+=Lh[1];zh<Bh;++zh)Rh.write_shift(-4,fg.DIFSECT);for(Bh+=Lh[2];zh<Bh;++zh)Rh.write_shift(-4,fg.FATSECT);Vh(Lh[3]),Vh(Lh[4]);for(var Hh=0,Uh=0,Wh=Ph.FileIndex[0];Hh<Ph.FileIndex.length;++Hh)Wh=Ph.FileIndex[Hh],Wh.content&&(Uh=Wh.content.length,!(Uh<4096)&&(Wh.start=Bh,Vh(Uh+511>>9)));for(Vh(Lh[6]+7>>3);Rh.l&511;)Rh.write_shift(-4,fg.ENDOFCHAIN);for(Bh=zh=0,Hh=0;Hh<Ph.FileIndex.length;++Hh)Wh=Ph.FileIndex[Hh],Wh.content&&(Uh=Wh.content.length,!(!Uh||Uh>=4096)&&(Wh.start=Bh,Vh(Uh+63>>6)));for(;Rh.l&511;)Rh.write_shift(-4,fg.ENDOFCHAIN);for(zh=0;zh<Lh[4]<<2;++zh){var Gh=Ph.FullPaths[zh];if(!Gh||Gh.length===0){for(Hh=0;Hh<17;++Hh)Rh.write_shift(4,0);for(Hh=0;Hh<3;++Hh)Rh.write_shift(4,-1);for(Hh=0;Hh<12;++Hh)Rh.write_shift(4,0);continue}Wh=Ph.FileIndex[zh],zh===0&&(Wh.start=Wh.size?Wh.start-1:cg);var Kh=zh===0&&Ih.root||Wh.name;if(Kh.length>31&&(console.error(`Name `+Kh+` will be truncated to `+Kh.slice(0,31)),Kh=Kh.slice(0,31)),Uh=2*(Kh.length+1),Rh.write_shift(64,Kh,`utf16le`),Rh.write_shift(2,Uh),Rh.write_shift(1,Wh.type),Rh.write_shift(1,Wh.color),Rh.write_shift(-4,Wh.L),Rh.write_shift(-4,Wh.R),Rh.write_shift(-4,Wh.C),Wh.clsid)Rh.write_shift(16,Wh.clsid,`hex`);else for(Hh=0;Hh<4;++Hh)Rh.write_shift(4,0);Rh.write_shift(4,Wh.state||0),Rh.write_shift(4,0),Rh.write_shift(4,0),Rh.write_shift(4,0),Rh.write_shift(4,0),Rh.write_shift(4,Wh.start),Rh.write_shift(4,Wh.size),Rh.write_shift(4,0)}for(zh=1;zh<Ph.FileIndex.length;++zh)if(Wh=Ph.FileIndex[zh],Wh.size>=4096)if(Rh.l=Wh.start+1<<9,has_buf&&Buffer.isBuffer(Wh.content))Wh.content.copy(Rh,Rh.l,0,Wh.size),Rh.l+=Wh.size+511&-512;else{for(Hh=0;Hh<Wh.size;++Hh)Rh.write_shift(1,Wh.content[Hh]);for(;Hh&511;++Hh)Rh.write_shift(1,0)}for(zh=1;zh<Ph.FileIndex.length;++zh)if(Wh=Ph.FileIndex[zh],Wh.size>0&&Wh.size<4096)if(has_buf&&Buffer.isBuffer(Wh.content))Wh.content.copy(Rh,Rh.l,0,Wh.size),Rh.l+=Wh.size+63&-64;else{for(Hh=0;Hh<Wh.size;++Hh)Rh.write_shift(1,Wh.content[Hh]);for(;Hh&63;++Hh)Rh.write_shift(1,0)}if(has_buf)Rh.l=Rh.length;else for(;Rh.l<Rh.length;)Rh.write_shift(1,0);return Rh}function og(Ph,Fh){var Ih=Ph.FullPaths.map(function(Ph){return Ph.toUpperCase()}),Lh=Ih.map(function(Ph){var Fh=Ph.split(`/`);return Fh[Fh.length-(Ph.slice(-1)==`/`?2:1)]}),Rh=!1;Fh.charCodeAt(0)===47?(Rh=!0,Fh=Ih[0].slice(0,-1)+Fh):Rh=Fh.indexOf(`/`)!==-1;var zh=Fh.toUpperCase(),Bh=Rh===!0?Ih.indexOf(zh):Lh.indexOf(zh);if(Bh!==-1)return Ph.FileIndex[Bh];var Vh=!zh.match(chr1);for(zh=zh.replace(chr0,``),Vh&&(zh=zh.replace(chr1,`!`)),Bh=0;Bh<Ih.length;++Bh)if((Vh?Ih[Bh].replace(chr1,`!`):Ih[Bh]).replace(chr0,``)==zh||(Vh?Lh[Bh].replace(chr1,`!`):Lh[Bh]).replace(chr0,``)==zh)return Ph.FileIndex[Bh];return null}var sg=64,cg=-2,lg=`d0cf11e0a1b11ae1`,ug=[208,207,17,224,161,177,26,225],dg=`00000000000000000000000000000000`,fg={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:cg,FREESECT:-1,HEADER_SIGNATURE:lg,HEADER_MINOR_VERSION:`3e00`,MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:dg,EntryTypes:[`unknown`,`storage`,`stream`,`lockbytes`,`property`,`root`]};function pg(Ph,Fh,Ih){Hh();var Lh=ag(Ph,Ih);Vh.writeFileSync(Fh,Lh)}function mg(Ph){for(var Fh=Array(Ph.length),Ih=0;Ih<Ph.length;++Ih)Fh[Ih]=String.fromCharCode(Ph[Ih]);return Fh.join(``)}function hg(Ph,Fh){var Ih=ag(Ph,Fh);switch(Fh&&Fh.type||`buffer`){case`file`:return Hh(),Vh.writeFileSync(Fh.filename,Ih),Ih;case`binary`:return typeof Ih==`string`?Ih:mg(Ih);case`base64`:return Base64_encode(typeof Ih==`string`?Ih:mg(Ih));case`buffer`:if(has_buf)return Buffer.isBuffer(Ih)?Ih:Buffer_from(Ih);case`array`:return typeof Ih==`string`?s2a(Ih):Ih}return Ih}var gg;function _g(Ph){try{var Fh=Ph.InflateRaw,Ih=new Fh;if(Ih._processChunk(new Uint8Array([3,0]),Ih._finishFlushFlag),Ih.bytesRead)gg=Ph;else throw Error(`zlib does not expose bytesRead`)}catch(Ph){console.error(`cannot use native zlib: `+(Ph.message||Ph))}}function vg(Ph,Fh){if(!gg)return $g(Ph,Fh);var Ih=gg.InflateRaw,Lh=new Ih,Rh=Lh._processChunk(Ph.slice(Ph.l),Lh._finishFlushFlag);return Ph.l+=Lh.bytesRead,Rh}function yg(Ph){return gg?gg.deflateRawSync(Ph):Gg(Ph)}var bg=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],xg=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],Sg=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];function Cg(Ph){var Fh=(Ph<<1|Ph<<11)&139536|(Ph<<5|Ph<<15)&558144;return(Fh>>16|Fh>>8|Fh)&255}for(var wg=typeof Uint8Array<`u`,Tg=wg?new Uint8Array(256):[],Eg=0;Eg<256;++Eg)Tg[Eg]=Cg(Eg);function Dg(Ph,Fh){var Ih=Tg[Ph&255];return Fh<=8?Ih>>>8-Fh:(Ih=Ih<<8|Tg[Ph>>8&255],Fh<=16?Ih>>>16-Fh:(Ih=Ih<<8|Tg[Ph>>16&255],Ih>>>24-Fh))}function Og(Ph,Fh){var Ih=Fh&7,Lh=Fh>>>3;return(Ph[Lh]|(Ih<=6?0:Ph[Lh+1]<<8))>>>Ih&3}function kg(Ph,Fh){var Ih=Fh&7,Lh=Fh>>>3;return(Ph[Lh]|(Ih<=5?0:Ph[Lh+1]<<8))>>>Ih&7}function Ag(Ph,Fh){var Ih=Fh&7,Lh=Fh>>>3;return(Ph[Lh]|(Ih<=4?0:Ph[Lh+1]<<8))>>>Ih&15}function jg(Ph,Fh){var Ih=Fh&7,Lh=Fh>>>3;return(Ph[Lh]|(Ih<=3?0:Ph[Lh+1]<<8))>>>Ih&31}function Mg(Ph,Fh){var Ih=Fh&7,Lh=Fh>>>3;return(Ph[Lh]|(Ih<=1?0:Ph[Lh+1]<<8))>>>Ih&127}function Ng(Ph,Fh,Ih){var Lh=Fh&7,Rh=Fh>>>3,zh=(1<<Ih)-1,Bh=Ph[Rh]>>>Lh;return Ih<8-Lh||(Bh|=Ph[Rh+1]<<8-Lh,Ih<16-Lh)||(Bh|=Ph[Rh+2]<<16-Lh,Ih<24-Lh)||(Bh|=Ph[Rh+3]<<24-Lh),Bh&zh}function Pg(Ph,Fh,Ih){var Lh=Fh&7,Rh=Fh>>>3;return Lh<=5?Ph[Rh]|=(Ih&7)<<Lh:(Ph[Rh]|=Ih<<Lh&255,Ph[Rh+1]=(Ih&7)>>8-Lh),Fh+3}function Fg(Ph,Fh,Ih){var Lh=Fh&7,Rh=Fh>>>3;return Ih=(Ih&1)<<Lh,Ph[Rh]|=Ih,Fh+1}function Ig(Ph,Fh,Ih){var Lh=Fh&7,Rh=Fh>>>3;return Ih<<=Lh,Ph[Rh]|=Ih&255,Ih>>>=8,Ph[Rh+1]=Ih,Fh+8}function Lg(Ph,Fh,Ih){var Lh=Fh&7,Rh=Fh>>>3;return Ih<<=Lh,Ph[Rh]|=Ih&255,Ih>>>=8,Ph[Rh+1]=Ih&255,Ph[Rh+2]=Ih>>>8,Fh+16}function Rg(Ph,Fh){var Ih=Ph.length,Lh=2*Ih>Fh?2*Ih:Fh+5,Rh=0;if(Ih>=Fh)return Ph;if(has_buf){var zh=new_unsafe_buf(Lh);if(Ph.copy)Ph.copy(zh);else for(;Rh<Ph.length;++Rh)zh[Rh]=Ph[Rh];return zh}else if(wg){var Bh=new Uint8Array(Lh);if(Bh.set)Bh.set(Ph);else for(;Rh<Ih;++Rh)Bh[Rh]=Ph[Rh];return Bh}return Ph.length=Lh,Ph}function zg(Ph){for(var Fh=Array(Ph),Ih=0;Ih<Ph;++Ih)Fh[Ih]=0;return Fh}function Bg(Ph,Fh,Ih){var Lh=1,Rh=0,zh=0,Bh=0,Vh=0,Hh=Ph.length,Uh=wg?new Uint16Array(32):zg(32);for(zh=0;zh<32;++zh)Uh[zh]=0;for(zh=Hh;zh<Ih;++zh)Ph[zh]=0;Hh=Ph.length;var Wh=wg?new Uint16Array(Hh):zg(Hh);for(zh=0;zh<Hh;++zh)Uh[Rh=Ph[zh]]++,Lh<Rh&&(Lh=Rh),Wh[zh]=0;for(Uh[0]=0,zh=1;zh<=Lh;++zh)Uh[zh+16]=Vh=Vh+Uh[zh-1]<<1;for(zh=0;zh<Hh;++zh)Vh=Ph[zh],Vh!=0&&(Wh[zh]=Uh[Vh+16]++);var Gh=0;for(zh=0;zh<Hh;++zh)if(Gh=Ph[zh],Gh!=0)for(Vh=Dg(Wh[zh],Lh)>>Lh-Gh,Bh=(1<<Lh+4-Gh)-1;Bh>=0;--Bh)Fh[Vh|Bh<<Gh]=Gh&15|zh<<4;return Lh}var Vg=wg?new Uint16Array(512):zg(512),Hg=wg?new Uint16Array(32):zg(32);if(!wg){for(var Ug=0;Ug<512;++Ug)Vg[Ug]=0;for(Ug=0;Ug<32;++Ug)Hg[Ug]=0}(function(){for(var Ph=[],Fh=0;Fh<32;Fh++)Ph.push(5);Bg(Ph,Hg,32);var Ih=[];for(Fh=0;Fh<=143;Fh++)Ih.push(8);for(;Fh<=255;Fh++)Ih.push(9);for(;Fh<=279;Fh++)Ih.push(7);for(;Fh<=287;Fh++)Ih.push(8);Bg(Ih,Vg,288)})();var Wg=(function(){for(var Ph=wg?new Uint8Array(32768):[],Fh=0,Ih=0;Fh<Sg.length-1;++Fh)for(;Ih<Sg[Fh+1];++Ih)Ph[Ih]=Fh;for(;Ih<32768;++Ih)Ph[Ih]=29;var Lh=wg?new Uint8Array(259):[];for(Fh=0,Ih=0;Fh<xg.length-1;++Fh)for(;Ih<xg[Fh+1];++Ih)Lh[Ih]=Fh;function Rh(Ph,Fh){for(var Ih=0;Ih<Ph.length;){var Lh=Math.min(65535,Ph.length-Ih),Rh=Ih+Lh==Ph.length;for(Fh.write_shift(1,+Rh),Fh.write_shift(2,Lh),Fh.write_shift(2,~Lh&65535);Lh-- >0;)Fh[Fh.l++]=Ph[Ih++]}return Fh.l}function zh(Fh,Ih){for(var Rh=0,zh=0,Bh=wg?new Uint16Array(32768):[];zh<Fh.length;){var Vh=Math.min(65535,Fh.length-zh);if(Vh<10){for(Rh=Pg(Ih,Rh,+(zh+Vh==Fh.length)),Rh&7&&(Rh+=8-(Rh&7)),Ih.l=Rh/8|0,Ih.write_shift(2,Vh),Ih.write_shift(2,~Vh&65535);Vh-- >0;)Ih[Ih.l++]=Fh[zh++];Rh=Ih.l*8;continue}Rh=Pg(Ih,Rh,+(zh+Vh==Fh.length)+2);for(var Hh=0;Vh-- >0;){var Uh=Fh[zh];Hh=(Hh<<5^Uh)&32767;var Wh=-1,Gh=0;if((Wh=Bh[Hh])&&(Wh|=zh&-32768,Wh>zh&&(Wh-=32768),Wh<zh))for(;Fh[Wh+Gh]==Fh[zh+Gh]&&Gh<250;)++Gh;if(Gh>2){Uh=Lh[Gh],Uh<=22?Rh=Ig(Ih,Rh,Tg[Uh+1]>>1)-1:(Ig(Ih,Rh,3),Rh+=5,Ig(Ih,Rh,Tg[Uh-23]>>5),Rh+=3);var Kh=Uh<8?0:Uh-4>>2;Kh>0&&(Lg(Ih,Rh,Gh-xg[Uh]),Rh+=Kh),Uh=Ph[zh-Wh],Rh=Ig(Ih,Rh,Tg[Uh]>>3),Rh-=3;var qh=Uh<4?0:Uh-2>>1;qh>0&&(Lg(Ih,Rh,zh-Wh-Sg[Uh]),Rh+=qh);for(var Jh=0;Jh<Gh;++Jh)Bh[Hh]=zh&32767,Hh=(Hh<<5^Fh[zh])&32767,++zh;Vh-=Gh-1}else Uh<=143?Uh+=48:Rh=Fg(Ih,Rh,1),Rh=Ig(Ih,Rh,Tg[Uh]),Bh[Hh]=zh&32767,++zh}Rh=Ig(Ih,Rh,0)-1}return Ih.l=(Rh+7)/8|0,Ih.l}return function(Ph,Fh){return Ph.length<8?Rh(Ph,Fh):zh(Ph,Fh)}})();function Gg(Ph){var Fh=new_buf(50+Math.floor(Ph.length*1.1)),Ih=Wg(Ph,Fh);return Fh.slice(0,Ih)}var Kg=wg?new Uint16Array(32768):zg(32768),qg=wg?new Uint16Array(32768):zg(32768),Jg=wg?new Uint16Array(128):zg(128),Yg=1,Xg=1;function Zg(Ph,Fh){var Ih=jg(Ph,Fh)+257;Fh+=5;var Lh=jg(Ph,Fh)+1;Fh+=5;var Rh=Ag(Ph,Fh)+4;Fh+=4;for(var zh=0,Bh=wg?new Uint8Array(19):zg(19),Vh=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Hh=1,Uh=wg?new Uint8Array(8):zg(8),Wh=wg?new Uint8Array(8):zg(8),Gh=Bh.length,Kh=0;Kh<Rh;++Kh)Bh[bg[Kh]]=zh=kg(Ph,Fh),Hh<zh&&(Hh=zh),Uh[zh]++,Fh+=3;var qh=0;for(Uh[0]=0,Kh=1;Kh<=Hh;++Kh)Wh[Kh]=qh=qh+Uh[Kh-1]<<1;for(Kh=0;Kh<Gh;++Kh)(qh=Bh[Kh])!=0&&(Vh[Kh]=Wh[qh]++);var Jh=0;for(Kh=0;Kh<Gh;++Kh)if(Jh=Bh[Kh],Jh!=0){qh=Tg[Vh[Kh]]>>8-Jh;for(var Yh=(1<<7-Jh)-1;Yh>=0;--Yh)Jg[qh|Yh<<Jh]=Jh&7|Kh<<3}var Xh=[];for(Hh=1;Xh.length<Ih+Lh;)switch(qh=Jg[Mg(Ph,Fh)],Fh+=qh&7,qh>>>=3){case 16:for(zh=3+Og(Ph,Fh),Fh+=2,qh=Xh[Xh.length-1];zh-- >0;)Xh.push(qh);break;case 17:for(zh=3+kg(Ph,Fh),Fh+=3;zh-- >0;)Xh.push(0);break;case 18:for(zh=11+Mg(Ph,Fh),Fh+=7;zh-- >0;)Xh.push(0);break;default:Xh.push(qh),Hh<qh&&(Hh=qh);break}var Zh=Xh.slice(0,Ih),Qh=Xh.slice(Ih);for(Kh=Ih;Kh<286;++Kh)Zh[Kh]=0;for(Kh=Lh;Kh<30;++Kh)Qh[Kh]=0;return Yg=Bg(Zh,Kg,286),Xg=Bg(Qh,qg,30),Fh}function Qg(Ph,Fh){if(Ph[0]==3&&!(Ph[1]&3))return[new_raw_buf(Fh),2];for(var Ih=0,Lh=0,Rh=new_unsafe_buf(Fh||1<<18),zh=0,Bh=Rh.length>>>0,Vh=0,Hh=0;!(Lh&1);){if(Lh=kg(Ph,Ih),Ih+=3,Lh>>>1)Lh>>1==1?(Vh=9,Hh=5):(Ih=Zg(Ph,Ih),Vh=Yg,Hh=Xg);else{Ih&7&&(Ih+=8-(Ih&7));var Uh=Ph[Ih>>>3]|Ph[(Ih>>>3)+1]<<8;if(Ih+=32,Uh>0)for(!Fh&&Bh<zh+Uh&&(Rh=Rg(Rh,zh+Uh),Bh=Rh.length);Uh-- >0;)Rh[zh++]=Ph[Ih>>>3],Ih+=8;continue}for(;;){!Fh&&Bh<zh+32767&&(Rh=Rg(Rh,zh+32767),Bh=Rh.length);var Wh=Ng(Ph,Ih,Vh),Gh=Lh>>>1==1?Vg[Wh]:Kg[Wh];if(Ih+=Gh&15,Gh>>>=4,!(Gh>>>8&255))Rh[zh++]=Gh;else if(Gh==256)break;else{Gh-=257;var Kh=Gh<8?0:Gh-4>>2;Kh>5&&(Kh=0);var qh=zh+xg[Gh];Kh>0&&(qh+=Ng(Ph,Ih,Kh),Ih+=Kh),Wh=Ng(Ph,Ih,Hh),Gh=Lh>>>1==1?Hg[Wh]:qg[Wh],Ih+=Gh&15,Gh>>>=4;var Jh=Gh<4?0:Gh-2>>1,Yh=Sg[Gh];for(Jh>0&&(Yh+=Ng(Ph,Ih,Jh),Ih+=Jh),!Fh&&Bh<qh&&(Rh=Rg(Rh,qh+100),Bh=Rh.length);zh<qh;)Rh[zh]=Rh[zh-Yh],++zh}}}return Fh?[Rh,Ih+7>>>3]:[Rh.slice(0,zh),Ih+7>>>3]}function $g(Ph,Fh){var Ih=Qg(Ph.slice(Ph.l||0),Fh);return Ph.l+=Ih[1],Ih[0]}function e_(Ph,Fh){if(Ph)typeof console<`u`&&console.error(Fh);else throw Error(Fh)}function t_(Ph,Fh){var Ih=Ph;prep_blob(Ih,0);var Lh={FileIndex:[],FullPaths:[]};ng(Lh,{root:Fh.root});for(var Rh=Ih.length-4;(Ih[Rh]!=80||Ih[Rh+1]!=75||Ih[Rh+2]!=5||Ih[Rh+3]!=6)&&Rh>=0;)--Rh;Ih.l=Rh+4,Ih.l+=4;var zh=Ih.read_shift(2);for(Ih.l+=6,Ih.l=Ih.read_shift(4),Rh=0;Rh<zh;++Rh){Ih.l+=20;var Vh=Ih.read_shift(4),Hh=Ih.read_shift(4),Uh=Ih.read_shift(2),Wh=Ih.read_shift(2),Gh=Ih.read_shift(2);Ih.l+=8;var Kh=Ih.read_shift(4),qh=Bh(Ih.slice(Ih.l+Uh,Ih.l+Uh+Wh));Ih.l+=Uh+Wh+Gh;var Jh=Ih.l;Ih.l=Kh+4,qh&&qh[1]&&((qh[1]||{}).usz&&(Hh=qh[1].usz),(qh[1]||{}).csz&&(Vh=qh[1].csz)),n_(Ih,Vh,Hh,Lh,qh),Ih.l=Jh}return Lh}function n_(Ph,Fh,Ih,Lh,Rh){Ph.l+=2;var Vh=Ph.read_shift(2),Hh=Ph.read_shift(2),Uh=zh(Ph);if(Vh&8257)throw Error(`Unsupported ZIP encryption`);for(var Wh=Ph.read_shift(4),Gh=Ph.read_shift(4),Kh=Ph.read_shift(4),qh=Ph.read_shift(2),Jh=Ph.read_shift(2),Yh=``,Xh=0;Xh<qh;++Xh)Yh+=String.fromCharCode(Ph[Ph.l++]);if(Jh){var Zh=Bh(Ph.slice(Ph.l,Ph.l+Jh));(Zh[21589]||{}).mt&&(Uh=Zh[21589].mt),(Zh[1]||{}).usz&&(Kh=Zh[1].usz),(Zh[1]||{}).csz&&(Gh=Zh[1].csz),Rh&&((Rh[21589]||{}).mt&&(Uh=Rh[21589].mt),(Rh[1]||{}).usz&&(Kh=Rh[1].usz),(Rh[1]||{}).csz&&(Gh=Rh[1].csz))}Ph.l+=Jh;var Qh=Ph.slice(Ph.l,Ph.l+Gh);switch(Hh){case 8:Qh=vg(Ph,Kh);break;case 0:Ph.l+=Gh;break;default:throw Error(`Unsupported ZIP Compression method `+Hh)}var $h=!1;Vh&8&&(Wh=Ph.read_shift(4),Wh==134695760&&(Wh=Ph.read_shift(4),$h=!0),Gh=Ph.read_shift(4),Kh=Ph.read_shift(4)),Gh!=Fh&&e_($h,`Bad compressed size: `+Fh+` != `+Gh),Kh!=Ih&&e_($h,`Bad uncompressed size: `+Ih+` != `+Kh),p_(Lh,Yh,Qh,{unsafe:!0,mt:Uh})}function r_(Ph,Fh){var Ih=Fh||{},Lh=[],zh=[],Bh=new_buf(1),Vh=Ih.compression?8:0,Hh=0,Uh=0,Wh=0,Gh=0,Kh=0,qh=Ph.FullPaths[0],Jh=qh,Yh=Ph.FileIndex[0],Xh=[],Zh=0;for(Uh=1;Uh<Ph.FullPaths.length;++Uh)if(Jh=Ph.FullPaths[Uh].slice(qh.length),Yh=Ph.FileIndex[Uh],!(!Yh.size||!Yh.content||Array.isArray(Yh.content)&&Yh.content.length==0||Jh==`Sh33tJ5`)){var Qh=Gh,$h=new_buf(Jh.length);for(Wh=0;Wh<Jh.length;++Wh)$h.write_shift(1,Jh.charCodeAt(Wh)&127);$h=$h.slice(0,$h.l),Xh[Kh]=typeof Yh.content==`string`?CRC32.bstr(Yh.content,0):CRC32.buf(Yh.content,0);var eg=typeof Yh.content==`string`?s2a(Yh.content):Yh.content;Vh==8&&(eg=yg(eg)),Bh=new_buf(30),Bh.write_shift(4,67324752),Bh.write_shift(2,20),Bh.write_shift(2,Hh),Bh.write_shift(2,Vh),Yh.mt?Rh(Bh,Yh.mt):Bh.write_shift(4,0),Bh.write_shift(-4,Hh&8?0:Xh[Kh]),Bh.write_shift(4,Hh&8?0:eg.length),Bh.write_shift(4,Hh&8?0:Yh.content.length),Bh.write_shift(2,$h.length),Bh.write_shift(2,0),Gh+=Bh.length,Lh.push(Bh),Gh+=$h.length,Lh.push($h),Gh+=eg.length,Lh.push(eg),Hh&8&&(Bh=new_buf(12),Bh.write_shift(-4,Xh[Kh]),Bh.write_shift(4,eg.length),Bh.write_shift(4,Yh.content.length),Gh+=Bh.l,Lh.push(Bh)),Bh=new_buf(46),Bh.write_shift(4,33639248),Bh.write_shift(2,0),Bh.write_shift(2,20),Bh.write_shift(2,Hh),Bh.write_shift(2,Vh),Bh.write_shift(4,0),Bh.write_shift(-4,Xh[Kh]),Bh.write_shift(4,eg.length),Bh.write_shift(4,Yh.content.length),Bh.write_shift(2,$h.length),Bh.write_shift(2,0),Bh.write_shift(2,0),Bh.write_shift(2,0),Bh.write_shift(2,0),Bh.write_shift(4,0),Bh.write_shift(4,Qh),Zh+=Bh.l,zh.push(Bh),Zh+=$h.length,zh.push($h),++Kh}return Bh=new_buf(22),Bh.write_shift(4,101010256),Bh.write_shift(2,0),Bh.write_shift(2,0),Bh.write_shift(2,Kh),Bh.write_shift(2,Kh),Bh.write_shift(4,Zh),Bh.write_shift(4,Gh),Bh.write_shift(2,0),bconcat([bconcat(Lh),bconcat(zh),Bh])}var i_={htm:`text/html`,xml:`text/xml`,gif:`image/gif`,jpg:`image/jpeg`,png:`image/png`,mso:`application/x-mso`,thmx:`application/vnd.ms-officetheme`,sh33tj5:`application/octet-stream`};function a_(Ph,Fh){if(Ph.ctype)return Ph.ctype;var Ih=Ph.name||``,Lh=Ih.match(/\.([^\.]+)$/);return Lh&&i_[Lh[1]]||Fh&&(Lh=(Ih=Fh).match(/[\.\\]([^\.\\])+$/),Lh&&i_[Lh[1]])?i_[Lh[1]]:`application/octet-stream`}function o_(Ph){for(var Fh=Base64_encode(Ph),Ih=[],Lh=0;Lh<Fh.length;Lh+=76)Ih.push(Fh.slice(Lh,Lh+76));return Ih.join(`\r
|
|
102
102
|
`)+`\r
|
|
@@ -4684,7 +4684,7 @@ IMPORTANT: "imagePrompt" and "moviePrompt" are plain string fields on the beat,
|
|
|
4684
4684
|
`)}Fh.write(`payload.value = newResult;`),Fh.write(`return payload;`);let Vh=Fh.compile();return(Fh,Ih)=>Vh(Ph,Fh,Ih)},zh,Bh=isObject$5,Vh=!globalConfig.jitless,Hh=Vh&&allowsEval.value,Uh=Fh.catchall,Wh;Ph._zod.parse=(Gh,Kh)=>{Wh??=Lh.value;let qh=Gh.value;return Bh(qh)?Vh&&Hh&&Kh?.async===!1&&Kh.jitless!==!0?(zh||=Rh(Fh.shape),Gh=zh(Gh,Kh),Uh?handleCatchall([],qh,Gh,Kh,Wh,Ph):Gh):Ih(Gh,Kh):(Gh.issues.push({expected:`object`,code:`invalid_type`,input:qh,inst:Ph}),Gh)}});function handleUnionResults(Ph,Fh,Ih,Lh){for(let Ih of Ph)if(Ih.issues.length===0)return Fh.value=Ih.value,Fh;let Rh=Ph.filter(Ph=>!aborted(Ph));return Rh.length===1?(Fh.value=Rh[0].value,Rh[0]):(Fh.issues.push({code:`invalid_union`,input:Fh.value,inst:Ih,errors:Ph.map(Ph=>Ph.issues.map(Ph=>finalizeIssue(Ph,Lh,config())))}),Fh)}var $ZodUnion=$constructor(`$ZodUnion`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),defineLazy(Ph._zod,`optin`,()=>Fh.options.some(Ph=>Ph._zod.optin===`optional`)?`optional`:void 0),defineLazy(Ph._zod,`optout`,()=>Fh.options.some(Ph=>Ph._zod.optout===`optional`)?`optional`:void 0),defineLazy(Ph._zod,`values`,()=>{if(Fh.options.every(Ph=>Ph._zod.values))return new Set(Fh.options.flatMap(Ph=>Array.from(Ph._zod.values)))}),defineLazy(Ph._zod,`pattern`,()=>{if(Fh.options.every(Ph=>Ph._zod.pattern)){let Ph=Fh.options.map(Ph=>Ph._zod.pattern);return RegExp(`^(${Ph.map(Ph=>cleanRegex(Ph.source)).join(`|`)})$`)}});let Ih=Fh.options.length===1,Lh=Fh.options[0]._zod.run;Ph._zod.parse=(Rh,zh)=>{if(Ih)return Lh(Rh,zh);let Bh=!1,Vh=[];for(let Ph of Fh.options){let Fh=Ph._zod.run({value:Rh.value,issues:[]},zh);if(Fh instanceof Promise)Vh.push(Fh),Bh=!0;else{if(Fh.issues.length===0)return Fh;Vh.push(Fh)}}return Bh?Promise.all(Vh).then(Fh=>handleUnionResults(Fh,Rh,Ph,zh)):handleUnionResults(Vh,Rh,Ph,zh)}}),$ZodDiscriminatedUnion=$constructor(`$ZodDiscriminatedUnion`,(Ph,Fh)=>{Fh.inclusive=!1,$ZodUnion.init(Ph,Fh);let Ih=Ph._zod.parse;defineLazy(Ph._zod,`propValues`,()=>{let Ph={};for(let Ih of Fh.options){let Lh=Ih._zod.propValues;if(!Lh||Object.keys(Lh).length===0)throw Error(`Invalid discriminated union option at index "${Fh.options.indexOf(Ih)}"`);for(let[Fh,Ih]of Object.entries(Lh)){Ph[Fh]||(Ph[Fh]=new Set);for(let Lh of Ih)Ph[Fh].add(Lh)}}return Ph});let Lh=cached(()=>{let Ph=Fh.options,Ih=new Map;for(let Lh of Ph){let Ph=Lh._zod.propValues?.[Fh.discriminator];if(!Ph||Ph.size===0)throw Error(`Invalid discriminated union option at index "${Fh.options.indexOf(Lh)}"`);for(let Fh of Ph){if(Ih.has(Fh))throw Error(`Duplicate discriminator value "${String(Fh)}"`);Ih.set(Fh,Lh)}}return Ih});Ph._zod.parse=(Rh,zh)=>{let Bh=Rh.value;if(!isObject$5(Bh))return Rh.issues.push({code:`invalid_type`,expected:`object`,input:Bh,inst:Ph}),Rh;let Vh=Lh.value.get(Bh?.[Fh.discriminator]);return Vh?Vh._zod.run(Rh,zh):Fh.unionFallback?Ih(Rh,zh):(Rh.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:Fh.discriminator,input:Bh,path:[Fh.discriminator],inst:Ph}),Rh)}}),$ZodIntersection=$constructor(`$ZodIntersection`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),Ph._zod.parse=(Ph,Ih)=>{let Lh=Ph.value,Rh=Fh.left._zod.run({value:Lh,issues:[]},Ih),zh=Fh.right._zod.run({value:Lh,issues:[]},Ih);return Rh instanceof Promise||zh instanceof Promise?Promise.all([Rh,zh]).then(([Fh,Ih])=>handleIntersectionResults(Ph,Fh,Ih)):handleIntersectionResults(Ph,Rh,zh)}});function mergeValues(Ph,Fh){if(Ph===Fh||Ph instanceof Date&&Fh instanceof Date&&+Ph==+Fh)return{valid:!0,data:Ph};if(isPlainObject(Ph)&&isPlainObject(Fh)){let Ih=Object.keys(Fh),Lh=Object.keys(Ph).filter(Ph=>Ih.indexOf(Ph)!==-1),Rh={...Ph,...Fh};for(let Ih of Lh){let Lh=mergeValues(Ph[Ih],Fh[Ih]);if(!Lh.valid)return{valid:!1,mergeErrorPath:[Ih,...Lh.mergeErrorPath]};Rh[Ih]=Lh.data}return{valid:!0,data:Rh}}if(Array.isArray(Ph)&&Array.isArray(Fh)){if(Ph.length!==Fh.length)return{valid:!1,mergeErrorPath:[]};let Ih=[];for(let Lh=0;Lh<Ph.length;Lh++){let Rh=Ph[Lh],zh=Fh[Lh],Bh=mergeValues(Rh,zh);if(!Bh.valid)return{valid:!1,mergeErrorPath:[Lh,...Bh.mergeErrorPath]};Ih.push(Bh.data)}return{valid:!0,data:Ih}}return{valid:!1,mergeErrorPath:[]}}function handleIntersectionResults(Ph,Fh,Ih){let Lh=new Map,Rh;for(let Ih of Fh.issues)if(Ih.code===`unrecognized_keys`){Rh??=Ih;for(let Ph of Ih.keys)Lh.has(Ph)||Lh.set(Ph,{}),Lh.get(Ph).l=!0}else Ph.issues.push(Ih);for(let Fh of Ih.issues)if(Fh.code===`unrecognized_keys`)for(let Ph of Fh.keys)Lh.has(Ph)||Lh.set(Ph,{}),Lh.get(Ph).r=!0;else Ph.issues.push(Fh);let zh=[...Lh].filter(([,Ph])=>Ph.l&&Ph.r).map(([Ph])=>Ph);if(zh.length&&Rh&&Ph.issues.push({...Rh,keys:zh}),aborted(Ph))return Ph;let Bh=mergeValues(Fh.value,Ih.value);if(!Bh.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Bh.mergeErrorPath)}`);return Ph.value=Bh.data,Ph}var $ZodTuple=$constructor(`$ZodTuple`,(Ph,Fh)=>{$ZodType.init(Ph,Fh);let Ih=Fh.items;Ph._zod.parse=(Lh,Rh)=>{let zh=Lh.value;if(!Array.isArray(zh))return Lh.issues.push({input:zh,inst:Ph,expected:`tuple`,code:`invalid_type`}),Lh;Lh.value=[];let Bh=[],Vh=[...Ih].reverse().findIndex(Ph=>Ph._zod.optin!==`optional`),Hh=Vh===-1?0:Ih.length-Vh;if(!Fh.rest){let Fh=zh.length>Ih.length,Rh=zh.length<Hh-1;if(Fh||Rh)return Lh.issues.push({...Fh?{code:`too_big`,maximum:Ih.length,inclusive:!0}:{code:`too_small`,minimum:Ih.length},input:zh,inst:Ph,origin:`array`}),Lh}let Uh=-1;for(let Ph of Ih){if(Uh++,Uh>=zh.length&&Uh>=Hh)continue;let Fh=Ph._zod.run({value:zh[Uh],issues:[]},Rh);Fh instanceof Promise?Bh.push(Fh.then(Ph=>handleTupleResult(Ph,Lh,Uh))):handleTupleResult(Fh,Lh,Uh)}if(Fh.rest){let Ph=zh.slice(Ih.length);for(let Ih of Ph){Uh++;let Ph=Fh.rest._zod.run({value:Ih,issues:[]},Rh);Ph instanceof Promise?Bh.push(Ph.then(Ph=>handleTupleResult(Ph,Lh,Uh))):handleTupleResult(Ph,Lh,Uh)}}return Bh.length?Promise.all(Bh).then(()=>Lh):Lh}});function handleTupleResult(Ph,Fh,Ih){Ph.issues.length&&Fh.issues.push(...prefixIssues(Ih,Ph.issues)),Fh.value[Ih]=Ph.value}var $ZodRecord=$constructor(`$ZodRecord`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),Ph._zod.parse=(Ih,Lh)=>{let Rh=Ih.value;if(!isPlainObject(Rh))return Ih.issues.push({expected:`record`,code:`invalid_type`,input:Rh,inst:Ph}),Ih;let zh=[],Bh=Fh.keyType._zod.values;if(Bh){Ih.value={};let Vh=new Set;for(let Ph of Bh)if(typeof Ph==`string`||typeof Ph==`number`||typeof Ph==`symbol`){Vh.add(typeof Ph==`number`?Ph.toString():Ph);let Bh=Fh.valueType._zod.run({value:Rh[Ph],issues:[]},Lh);Bh instanceof Promise?zh.push(Bh.then(Fh=>{Fh.issues.length&&Ih.issues.push(...prefixIssues(Ph,Fh.issues)),Ih.value[Ph]=Fh.value})):(Bh.issues.length&&Ih.issues.push(...prefixIssues(Ph,Bh.issues)),Ih.value[Ph]=Bh.value)}let Hh;for(let Ph in Rh)Vh.has(Ph)||(Hh??=[],Hh.push(Ph));Hh&&Hh.length>0&&Ih.issues.push({code:`unrecognized_keys`,input:Rh,inst:Ph,keys:Hh})}else{Ih.value={};for(let Bh of Reflect.ownKeys(Rh)){if(Bh===`__proto__`)continue;let Vh=Fh.keyType._zod.run({value:Bh,issues:[]},Lh);if(Vh instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof Bh==`string`&&number$1.test(Bh)&&Vh.issues.length){let Ph=Fh.keyType._zod.run({value:Number(Bh),issues:[]},Lh);if(Ph instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);Ph.issues.length===0&&(Vh=Ph)}if(Vh.issues.length){Fh.mode===`loose`?Ih.value[Bh]=Rh[Bh]:Ih.issues.push({code:`invalid_key`,origin:`record`,issues:Vh.issues.map(Ph=>finalizeIssue(Ph,Lh,config())),input:Bh,path:[Bh],inst:Ph});continue}let Hh=Fh.valueType._zod.run({value:Rh[Bh],issues:[]},Lh);Hh instanceof Promise?zh.push(Hh.then(Ph=>{Ph.issues.length&&Ih.issues.push(...prefixIssues(Bh,Ph.issues)),Ih.value[Vh.value]=Ph.value})):(Hh.issues.length&&Ih.issues.push(...prefixIssues(Bh,Hh.issues)),Ih.value[Vh.value]=Hh.value)}}return zh.length?Promise.all(zh).then(()=>Ih):Ih}}),$ZodEnum=$constructor(`$ZodEnum`,(Ph,Fh)=>{$ZodType.init(Ph,Fh);let Ih=getEnumValues(Fh.entries),Lh=new Set(Ih);Ph._zod.values=Lh,Ph._zod.pattern=RegExp(`^(${Ih.filter(Ph=>propertyKeyTypes.has(typeof Ph)).map(Ph=>typeof Ph==`string`?escapeRegex(Ph):Ph.toString()).join(`|`)})$`),Ph._zod.parse=(Fh,Rh)=>{let zh=Fh.value;return Lh.has(zh)||Fh.issues.push({code:`invalid_value`,values:Ih,input:zh,inst:Ph}),Fh}}),$ZodLiteral=$constructor(`$ZodLiteral`,(Ph,Fh)=>{if($ZodType.init(Ph,Fh),Fh.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let Ih=new Set(Fh.values);Ph._zod.values=Ih,Ph._zod.pattern=RegExp(`^(${Fh.values.map(Ph=>typeof Ph==`string`?escapeRegex(Ph):Ph?escapeRegex(Ph.toString()):String(Ph)).join(`|`)})$`),Ph._zod.parse=(Lh,Rh)=>{let zh=Lh.value;return Ih.has(zh)||Lh.issues.push({code:`invalid_value`,values:Fh.values,input:zh,inst:Ph}),Lh}}),$ZodTransform=$constructor(`$ZodTransform`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),Ph._zod.parse=(Ih,Lh)=>{if(Lh.direction===`backward`)throw new $ZodEncodeError(Ph.constructor.name);let Rh=Fh.transform(Ih.value,Ih);if(Lh.async)return(Rh instanceof Promise?Rh:Promise.resolve(Rh)).then(Ph=>(Ih.value=Ph,Ih));if(Rh instanceof Promise)throw new $ZodAsyncError;return Ih.value=Rh,Ih}});function handleOptionalResult(Ph,Fh){return Ph.issues.length&&Fh===void 0?{issues:[],value:void 0}:Ph}var $ZodOptional=$constructor(`$ZodOptional`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),Ph._zod.optin=`optional`,Ph._zod.optout=`optional`,defineLazy(Ph._zod,`values`,()=>Fh.innerType._zod.values?new Set([...Fh.innerType._zod.values,void 0]):void 0),defineLazy(Ph._zod,`pattern`,()=>{let Ph=Fh.innerType._zod.pattern;return Ph?RegExp(`^(${cleanRegex(Ph.source)})?$`):void 0}),Ph._zod.parse=(Ph,Ih)=>{if(Fh.innerType._zod.optin===`optional`){let Lh=Fh.innerType._zod.run(Ph,Ih);return Lh instanceof Promise?Lh.then(Fh=>handleOptionalResult(Fh,Ph.value)):handleOptionalResult(Lh,Ph.value)}return Ph.value===void 0?Ph:Fh.innerType._zod.run(Ph,Ih)}}),$ZodExactOptional=$constructor(`$ZodExactOptional`,(Ph,Fh)=>{$ZodOptional.init(Ph,Fh),defineLazy(Ph._zod,`values`,()=>Fh.innerType._zod.values),defineLazy(Ph._zod,`pattern`,()=>Fh.innerType._zod.pattern),Ph._zod.parse=(Ph,Ih)=>Fh.innerType._zod.run(Ph,Ih)}),$ZodNullable=$constructor(`$ZodNullable`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),defineLazy(Ph._zod,`optin`,()=>Fh.innerType._zod.optin),defineLazy(Ph._zod,`optout`,()=>Fh.innerType._zod.optout),defineLazy(Ph._zod,`pattern`,()=>{let Ph=Fh.innerType._zod.pattern;return Ph?RegExp(`^(${cleanRegex(Ph.source)}|null)$`):void 0}),defineLazy(Ph._zod,`values`,()=>Fh.innerType._zod.values?new Set([...Fh.innerType._zod.values,null]):void 0),Ph._zod.parse=(Ph,Ih)=>Ph.value===null?Ph:Fh.innerType._zod.run(Ph,Ih)}),$ZodDefault=$constructor(`$ZodDefault`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),Ph._zod.optin=`optional`,defineLazy(Ph._zod,`values`,()=>Fh.innerType._zod.values),Ph._zod.parse=(Ph,Ih)=>{if(Ih.direction===`backward`)return Fh.innerType._zod.run(Ph,Ih);if(Ph.value===void 0)return Ph.value=Fh.defaultValue,Ph;let Lh=Fh.innerType._zod.run(Ph,Ih);return Lh instanceof Promise?Lh.then(Ph=>handleDefaultResult(Ph,Fh)):handleDefaultResult(Lh,Fh)}});function handleDefaultResult(Ph,Fh){return Ph.value===void 0&&(Ph.value=Fh.defaultValue),Ph}var $ZodPrefault=$constructor(`$ZodPrefault`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),Ph._zod.optin=`optional`,defineLazy(Ph._zod,`values`,()=>Fh.innerType._zod.values),Ph._zod.parse=(Ph,Ih)=>(Ih.direction===`backward`||Ph.value===void 0&&(Ph.value=Fh.defaultValue),Fh.innerType._zod.run(Ph,Ih))}),$ZodNonOptional=$constructor(`$ZodNonOptional`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),defineLazy(Ph._zod,`values`,()=>{let Ph=Fh.innerType._zod.values;return Ph?new Set([...Ph].filter(Ph=>Ph!==void 0)):void 0}),Ph._zod.parse=(Ih,Lh)=>{let Rh=Fh.innerType._zod.run(Ih,Lh);return Rh instanceof Promise?Rh.then(Fh=>handleNonOptionalResult(Fh,Ph)):handleNonOptionalResult(Rh,Ph)}});function handleNonOptionalResult(Ph,Fh){return!Ph.issues.length&&Ph.value===void 0&&Ph.issues.push({code:`invalid_type`,expected:`nonoptional`,input:Ph.value,inst:Fh}),Ph}var $ZodCatch=$constructor(`$ZodCatch`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),defineLazy(Ph._zod,`optin`,()=>Fh.innerType._zod.optin),defineLazy(Ph._zod,`optout`,()=>Fh.innerType._zod.optout),defineLazy(Ph._zod,`values`,()=>Fh.innerType._zod.values),Ph._zod.parse=(Ph,Ih)=>{if(Ih.direction===`backward`)return Fh.innerType._zod.run(Ph,Ih);let Lh=Fh.innerType._zod.run(Ph,Ih);return Lh instanceof Promise?Lh.then(Lh=>(Ph.value=Lh.value,Lh.issues.length&&(Ph.value=Fh.catchValue({...Ph,error:{issues:Lh.issues.map(Ph=>finalizeIssue(Ph,Ih,config()))},input:Ph.value}),Ph.issues=[]),Ph)):(Ph.value=Lh.value,Lh.issues.length&&(Ph.value=Fh.catchValue({...Ph,error:{issues:Lh.issues.map(Ph=>finalizeIssue(Ph,Ih,config()))},input:Ph.value}),Ph.issues=[]),Ph)}}),$ZodPipe=$constructor(`$ZodPipe`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),defineLazy(Ph._zod,`values`,()=>Fh.in._zod.values),defineLazy(Ph._zod,`optin`,()=>Fh.in._zod.optin),defineLazy(Ph._zod,`optout`,()=>Fh.out._zod.optout),defineLazy(Ph._zod,`propValues`,()=>Fh.in._zod.propValues),Ph._zod.parse=(Ph,Ih)=>{if(Ih.direction===`backward`){let Lh=Fh.out._zod.run(Ph,Ih);return Lh instanceof Promise?Lh.then(Ph=>handlePipeResult(Ph,Fh.in,Ih)):handlePipeResult(Lh,Fh.in,Ih)}let Lh=Fh.in._zod.run(Ph,Ih);return Lh instanceof Promise?Lh.then(Ph=>handlePipeResult(Ph,Fh.out,Ih)):handlePipeResult(Lh,Fh.out,Ih)}});function handlePipeResult(Ph,Fh,Ih){return Ph.issues.length?(Ph.aborted=!0,Ph):Fh._zod.run({value:Ph.value,issues:Ph.issues},Ih)}var $ZodReadonly=$constructor(`$ZodReadonly`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),defineLazy(Ph._zod,`propValues`,()=>Fh.innerType._zod.propValues),defineLazy(Ph._zod,`values`,()=>Fh.innerType._zod.values),defineLazy(Ph._zod,`optin`,()=>Fh.innerType?._zod?.optin),defineLazy(Ph._zod,`optout`,()=>Fh.innerType?._zod?.optout),Ph._zod.parse=(Ph,Ih)=>{if(Ih.direction===`backward`)return Fh.innerType._zod.run(Ph,Ih);let Lh=Fh.innerType._zod.run(Ph,Ih);return Lh instanceof Promise?Lh.then(handleReadonlyResult):handleReadonlyResult(Lh)}});function handleReadonlyResult(Ph){return Ph.value=Object.freeze(Ph.value),Ph}var $ZodLazy=$constructor(`$ZodLazy`,(Ph,Fh)=>{$ZodType.init(Ph,Fh),defineLazy(Ph._zod,`innerType`,()=>Fh.getter()),defineLazy(Ph._zod,`pattern`,()=>Ph._zod.innerType?._zod?.pattern),defineLazy(Ph._zod,`propValues`,()=>Ph._zod.innerType?._zod?.propValues),defineLazy(Ph._zod,`optin`,()=>Ph._zod.innerType?._zod?.optin??void 0),defineLazy(Ph._zod,`optout`,()=>Ph._zod.innerType?._zod?.optout??void 0),Ph._zod.parse=(Fh,Ih)=>Ph._zod.innerType._zod.run(Fh,Ih)}),$ZodCustom=$constructor(`$ZodCustom`,(Ph,Fh)=>{$ZodCheck.init(Ph,Fh),$ZodType.init(Ph,Fh),Ph._zod.parse=(Ph,Fh)=>Ph,Ph._zod.check=Ih=>{let Lh=Ih.value,Rh=Fh.fn(Lh);if(Rh instanceof Promise)return Rh.then(Fh=>handleRefineResult(Fh,Ih,Lh,Ph));handleRefineResult(Rh,Ih,Lh,Ph)}});function handleRefineResult(Ph,Fh,Ih,Lh){if(!Ph){let Ph={code:`custom`,input:Ih,inst:Lh,path:[...Lh._zod.def.path??[]],continue:!Lh._zod.def.abort};Lh._zod.def.params&&(Ph.params=Lh._zod.def.params),Fh.issues.push(issue(Ph))}}var _a$1,$ZodRegistry=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(Ph,...Fh){let Ih=Fh[0];return this._map.set(Ph,Ih),Ih&&typeof Ih==`object`&&`id`in Ih&&this._idmap.set(Ih.id,Ph),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(Ph){let Fh=this._map.get(Ph);return Fh&&typeof Fh==`object`&&`id`in Fh&&this._idmap.delete(Fh.id),this._map.delete(Ph),this}get(Ph){let Fh=Ph._zod.parent;if(Fh){let Ih={...this.get(Fh)??{}};delete Ih.id;let Lh={...Ih,...this._map.get(Ph)};return Object.keys(Lh).length?Lh:void 0}return this._map.get(Ph)}has(Ph){return this._map.has(Ph)}};function registry(){return new $ZodRegistry}(_a$1=globalThis).__zod_globalRegistry??(_a$1.__zod_globalRegistry=registry());var globalRegistry=globalThis.__zod_globalRegistry;function _string(Ph,Fh){return new Ph({type:`string`,...normalizeParams(Fh)})}function _email(Ph,Fh){return new Ph({type:`string`,format:`email`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _guid(Ph,Fh){return new Ph({type:`string`,format:`guid`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _uuid(Ph,Fh){return new Ph({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _uuidv4(Ph,Fh){return new Ph({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...normalizeParams(Fh)})}function _uuidv6(Ph,Fh){return new Ph({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...normalizeParams(Fh)})}function _uuidv7(Ph,Fh){return new Ph({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...normalizeParams(Fh)})}function _url(Ph,Fh){return new Ph({type:`string`,format:`url`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _emoji(Ph,Fh){return new Ph({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _nanoid(Ph,Fh){return new Ph({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _cuid(Ph,Fh){return new Ph({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _cuid2(Ph,Fh){return new Ph({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _ulid(Ph,Fh){return new Ph({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _xid(Ph,Fh){return new Ph({type:`string`,format:`xid`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _ksuid(Ph,Fh){return new Ph({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _ipv4(Ph,Fh){return new Ph({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _ipv6(Ph,Fh){return new Ph({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _cidrv4(Ph,Fh){return new Ph({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _cidrv6(Ph,Fh){return new Ph({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _base64(Ph,Fh){return new Ph({type:`string`,format:`base64`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _base64url(Ph,Fh){return new Ph({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _e164(Ph,Fh){return new Ph({type:`string`,format:`e164`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _jwt(Ph,Fh){return new Ph({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...normalizeParams(Fh)})}function _isoDateTime(Ph,Fh){return new Ph({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...normalizeParams(Fh)})}function _isoDate(Ph,Fh){return new Ph({type:`string`,format:`date`,check:`string_format`,...normalizeParams(Fh)})}function _isoTime(Ph,Fh){return new Ph({type:`string`,format:`time`,check:`string_format`,precision:null,...normalizeParams(Fh)})}function _isoDuration(Ph,Fh){return new Ph({type:`string`,format:`duration`,check:`string_format`,...normalizeParams(Fh)})}function _number(Ph,Fh){return new Ph({type:`number`,checks:[],...normalizeParams(Fh)})}function _int(Ph,Fh){return new Ph({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...normalizeParams(Fh)})}function _boolean(Ph,Fh){return new Ph({type:`boolean`,...normalizeParams(Fh)})}function _any(Ph){return new Ph({type:`any`})}function _unknown(Ph){return new Ph({type:`unknown`})}function _never(Ph,Fh){return new Ph({type:`never`,...normalizeParams(Fh)})}function _lt(Ph,Fh){return new $ZodCheckLessThan({check:`less_than`,...normalizeParams(Fh),value:Ph,inclusive:!1})}function _lte(Ph,Fh){return new $ZodCheckLessThan({check:`less_than`,...normalizeParams(Fh),value:Ph,inclusive:!0})}function _gt(Ph,Fh){return new $ZodCheckGreaterThan({check:`greater_than`,...normalizeParams(Fh),value:Ph,inclusive:!1})}function _gte(Ph,Fh){return new $ZodCheckGreaterThan({check:`greater_than`,...normalizeParams(Fh),value:Ph,inclusive:!0})}function _multipleOf(Ph,Fh){return new $ZodCheckMultipleOf({check:`multiple_of`,...normalizeParams(Fh),value:Ph})}function _maxLength(Ph,Fh){return new $ZodCheckMaxLength({check:`max_length`,...normalizeParams(Fh),maximum:Ph})}function _minLength(Ph,Fh){return new $ZodCheckMinLength({check:`min_length`,...normalizeParams(Fh),minimum:Ph})}function _length(Ph,Fh){return new $ZodCheckLengthEquals({check:`length_equals`,...normalizeParams(Fh),length:Ph})}function _regex(Ph,Fh){return new $ZodCheckRegex({check:`string_format`,format:`regex`,...normalizeParams(Fh),pattern:Ph})}function _lowercase(Ph){return new $ZodCheckLowerCase({check:`string_format`,format:`lowercase`,...normalizeParams(Ph)})}function _uppercase(Ph){return new $ZodCheckUpperCase({check:`string_format`,format:`uppercase`,...normalizeParams(Ph)})}function _includes(Ph,Fh){return new $ZodCheckIncludes({check:`string_format`,format:`includes`,...normalizeParams(Fh),includes:Ph})}function _startsWith(Ph,Fh){return new $ZodCheckStartsWith({check:`string_format`,format:`starts_with`,...normalizeParams(Fh),prefix:Ph})}function _endsWith(Ph,Fh){return new $ZodCheckEndsWith({check:`string_format`,format:`ends_with`,...normalizeParams(Fh),suffix:Ph})}function _overwrite(Ph){return new $ZodCheckOverwrite({check:`overwrite`,tx:Ph})}function _normalize(Ph){return _overwrite(Fh=>Fh.normalize(Ph))}function _trim$1(){return _overwrite(Ph=>Ph.trim())}function _toLowerCase(){return _overwrite(Ph=>Ph.toLowerCase())}function _toUpperCase(){return _overwrite(Ph=>Ph.toUpperCase())}function _slugify(){return _overwrite(Ph=>slugify(Ph))}function _array(Ph,Fh,Ih){return new Ph({type:`array`,element:Fh,...normalizeParams(Ih)})}function _refine(Ph,Fh,Ih){return new Ph({type:`custom`,check:`custom`,fn:Fh,...normalizeParams(Ih)})}function _superRefine(Ph){let Fh=_check(Ih=>(Ih.addIssue=Ph=>{if(typeof Ph==`string`)Ih.issues.push(issue(Ph,Ih.value,Fh._zod.def));else{let Lh=Ph;Lh.fatal&&(Lh.continue=!1),Lh.code??=`custom`,Lh.input??=Ih.value,Lh.inst??=Fh,Lh.continue??=!Fh._zod.def.abort,Ih.issues.push(issue(Lh))}},Ph(Ih.value,Ih)));return Fh}function _check(Ph,Fh){let Ih=new $ZodCheck({check:`custom`,...normalizeParams(Fh)});return Ih._zod.check=Ph,Ih}function describe$1(Ph){let Fh=new $ZodCheck({check:`describe`});return Fh._zod.onattach=[Fh=>{let Ih=globalRegistry.get(Fh)??{};globalRegistry.add(Fh,{...Ih,description:Ph})}],Fh._zod.check=()=>{},Fh}function meta$1(Ph){let Fh=new $ZodCheck({check:`meta`});return Fh._zod.onattach=[Fh=>{let Ih=globalRegistry.get(Fh)??{};globalRegistry.add(Fh,{...Ih,...Ph})}],Fh._zod.check=()=>{},Fh}function initializeContext(Ph){let Fh=Ph?.target??`draft-2020-12`;return Fh===`draft-4`&&(Fh=`draft-04`),Fh===`draft-7`&&(Fh=`draft-07`),{processors:Ph.processors??{},metadataRegistry:Ph?.metadata??globalRegistry,target:Fh,unrepresentable:Ph?.unrepresentable??`throw`,override:Ph?.override??(()=>{}),io:Ph?.io??`output`,counter:0,seen:new Map,cycles:Ph?.cycles??`ref`,reused:Ph?.reused??`inline`,external:Ph?.external??void 0}}function process$1(Ph,Fh,Ih={path:[],schemaPath:[]}){var Lh;let Rh=Ph._zod.def,zh=Fh.seen.get(Ph);if(zh)return zh.count++,Ih.schemaPath.includes(Ph)&&(zh.cycle=Ih.path),zh.schema;let Bh={schema:{},count:1,cycle:void 0,path:Ih.path};Fh.seen.set(Ph,Bh);let Vh=Ph._zod.toJSONSchema?.();if(Vh)Bh.schema=Vh;else{let Lh={...Ih,schemaPath:[...Ih.schemaPath,Ph],path:Ih.path};if(Ph._zod.processJSONSchema)Ph._zod.processJSONSchema(Fh,Bh.schema,Lh);else{let Ih=Bh.schema,zh=Fh.processors[Rh.type];if(!zh)throw Error(`[toJSONSchema]: Non-representable type encountered: ${Rh.type}`);zh(Ph,Fh,Ih,Lh)}let zh=Ph._zod.parent;zh&&(Bh.ref||=zh,process$1(zh,Fh,Lh),Fh.seen.get(zh).isParent=!0)}let Hh=Fh.metadataRegistry.get(Ph);return Hh&&Object.assign(Bh.schema,Hh),Fh.io===`input`&&isTransforming(Ph)&&(delete Bh.schema.examples,delete Bh.schema.default),Fh.io===`input`&&Bh.schema._prefault&&((Lh=Bh.schema).default??(Lh.default=Bh.schema._prefault)),delete Bh.schema._prefault,Fh.seen.get(Ph).schema}function extractDefs(Ph,Fh){let Ih=Ph.seen.get(Fh);if(!Ih)throw Error(`Unprocessed schema. This is a bug in Zod.`);let Lh=new Map;for(let Fh of Ph.seen.entries()){let Ih=Ph.metadataRegistry.get(Fh[0])?.id;if(Ih){let Ph=Lh.get(Ih);if(Ph&&Ph!==Fh[0])throw Error(`Duplicate schema id "${Ih}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);Lh.set(Ih,Fh[0])}}let Rh=Fh=>{let Lh=Ph.target===`draft-2020-12`?`$defs`:`definitions`;if(Ph.external){let Ih=Ph.external.registry.get(Fh[0])?.id,Rh=Ph.external.uri??(Ph=>Ph);if(Ih)return{ref:Rh(Ih)};let zh=Fh[1].defId??Fh[1].schema.id??`schema${Ph.counter++}`;return Fh[1].defId=zh,{defId:zh,ref:`${Rh(`__shared`)}#/${Lh}/${zh}`}}if(Fh[1]===Ih)return{ref:`#`};let Rh=`#/${Lh}/`,zh=Fh[1].schema.id??`__schema${Ph.counter++}`;return{defId:zh,ref:Rh+zh}},zh=Ph=>{if(Ph[1].schema.$ref)return;let Fh=Ph[1],{ref:Ih,defId:Lh}=Rh(Ph);Fh.def={...Fh.schema},Lh&&(Fh.defId=Lh);let zh=Fh.schema;for(let Ph in zh)delete zh[Ph];zh.$ref=Ih};if(Ph.cycles===`throw`)for(let Fh of Ph.seen.entries()){let Ph=Fh[1];if(Ph.cycle)throw Error(`Cycle detected: #/${Ph.cycle?.join(`/`)}/<root>
|
|
4685
4685
|
|
|
4686
4686
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Ih of Ph.seen.entries()){let Lh=Ih[1];if(Fh===Ih[0]){zh(Ih);continue}if(Ph.external){let Lh=Ph.external.registry.get(Ih[0])?.id;if(Fh!==Ih[0]&&Lh){zh(Ih);continue}}if(Ph.metadataRegistry.get(Ih[0])?.id){zh(Ih);continue}if(Lh.cycle){zh(Ih);continue}if(Lh.count>1&&Ph.reused===`ref`){zh(Ih);continue}}}function finalize(Ph,Fh){let Ih=Ph.seen.get(Fh);if(!Ih)throw Error(`Unprocessed schema. This is a bug in Zod.`);let Lh=Fh=>{let Ih=Ph.seen.get(Fh);if(Ih.ref===null)return;let Rh=Ih.def??Ih.schema,zh={...Rh},Bh=Ih.ref;if(Ih.ref=null,Bh){Lh(Bh);let Ih=Ph.seen.get(Bh),Vh=Ih.schema;if(Vh.$ref&&(Ph.target===`draft-07`||Ph.target===`draft-04`||Ph.target===`openapi-3.0`)?(Rh.allOf=Rh.allOf??[],Rh.allOf.push(Vh)):Object.assign(Rh,Vh),Object.assign(Rh,zh),Fh._zod.parent===Bh)for(let Ph in Rh)Ph===`$ref`||Ph===`allOf`||Ph in zh||delete Rh[Ph];if(Vh.$ref&&Ih.def)for(let Ph in Rh)Ph===`$ref`||Ph===`allOf`||Ph in Ih.def&&JSON.stringify(Rh[Ph])===JSON.stringify(Ih.def[Ph])&&delete Rh[Ph]}let Vh=Fh._zod.parent;if(Vh&&Vh!==Bh){Lh(Vh);let Fh=Ph.seen.get(Vh);if(Fh?.schema.$ref&&(Rh.$ref=Fh.schema.$ref,Fh.def))for(let Ph in Rh)Ph===`$ref`||Ph===`allOf`||Ph in Fh.def&&JSON.stringify(Rh[Ph])===JSON.stringify(Fh.def[Ph])&&delete Rh[Ph]}Ph.override({zodSchema:Fh,jsonSchema:Rh,path:Ih.path??[]})};for(let Fh of[...Ph.seen.entries()].reverse())Lh(Fh[0]);let Rh={};if(Ph.target===`draft-2020-12`?Rh.$schema=`https://json-schema.org/draft/2020-12/schema`:Ph.target===`draft-07`?Rh.$schema=`http://json-schema.org/draft-07/schema#`:Ph.target===`draft-04`?Rh.$schema=`http://json-schema.org/draft-04/schema#`:Ph.target,Ph.external?.uri){let Ih=Ph.external.registry.get(Fh)?.id;if(!Ih)throw Error("Schema is missing an `id` property");Rh.$id=Ph.external.uri(Ih)}Object.assign(Rh,Ih.def??Ih.schema);let zh=Ph.external?.defs??{};for(let Fh of Ph.seen.entries()){let Ph=Fh[1];Ph.def&&Ph.defId&&(zh[Ph.defId]=Ph.def)}Ph.external||Object.keys(zh).length>0&&(Ph.target===`draft-2020-12`?Rh.$defs=zh:Rh.definitions=zh);try{let Ih=JSON.parse(JSON.stringify(Rh));return Object.defineProperty(Ih,`~standard`,{value:{...Fh[`~standard`],jsonSchema:{input:createStandardJSONSchemaMethod(Fh,`input`,Ph.processors),output:createStandardJSONSchemaMethod(Fh,`output`,Ph.processors)}},enumerable:!1,writable:!1}),Ih}catch{throw Error(`Error converting schema to JSON.`)}}function isTransforming(Ph,Fh){let Ih=Fh??{seen:new Set};if(Ih.seen.has(Ph))return!1;Ih.seen.add(Ph);let Lh=Ph._zod.def;if(Lh.type===`transform`)return!0;if(Lh.type===`array`)return isTransforming(Lh.element,Ih);if(Lh.type===`set`)return isTransforming(Lh.valueType,Ih);if(Lh.type===`lazy`)return isTransforming(Lh.getter(),Ih);if(Lh.type===`promise`||Lh.type===`optional`||Lh.type===`nonoptional`||Lh.type===`nullable`||Lh.type===`readonly`||Lh.type===`default`||Lh.type===`prefault`)return isTransforming(Lh.innerType,Ih);if(Lh.type===`intersection`)return isTransforming(Lh.left,Ih)||isTransforming(Lh.right,Ih);if(Lh.type===`record`||Lh.type===`map`)return isTransforming(Lh.keyType,Ih)||isTransforming(Lh.valueType,Ih);if(Lh.type===`pipe`)return isTransforming(Lh.in,Ih)||isTransforming(Lh.out,Ih);if(Lh.type===`object`){for(let Ph in Lh.shape)if(isTransforming(Lh.shape[Ph],Ih))return!0;return!1}if(Lh.type===`union`){for(let Ph of Lh.options)if(isTransforming(Ph,Ih))return!0;return!1}if(Lh.type===`tuple`){for(let Ph of Lh.items)if(isTransforming(Ph,Ih))return!0;return!!(Lh.rest&&isTransforming(Lh.rest,Ih))}return!1}var createToJSONSchemaMethod=(Ph,Fh={})=>Ih=>{let Lh=initializeContext({...Ih,processors:Fh});return process$1(Ph,Lh),extractDefs(Lh,Ph),finalize(Lh,Ph)},createStandardJSONSchemaMethod=(Ph,Fh,Ih={})=>Lh=>{let{libraryOptions:Rh,target:zh}=Lh??{},Bh=initializeContext({...Rh??{},target:zh,io:Fh,processors:Ih});return process$1(Ph,Bh),extractDefs(Bh,Ph),finalize(Bh,Ph)},formatMap={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},stringProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ih;Rh.type=`string`;let{minimum:zh,maximum:Bh,format:Vh,patterns:Hh,contentEncoding:Uh}=Ph._zod.bag;if(typeof zh==`number`&&(Rh.minLength=zh),typeof Bh==`number`&&(Rh.maxLength=Bh),Vh&&(Rh.format=formatMap[Vh]??Vh,Rh.format===``&&delete Rh.format,Vh===`time`&&delete Rh.format),Uh&&(Rh.contentEncoding=Uh),Hh&&Hh.size>0){let Ph=[...Hh];Ph.length===1?Rh.pattern=Ph[0].source:Ph.length>1&&(Rh.allOf=[...Ph.map(Ph=>({...Fh.target===`draft-07`||Fh.target===`draft-04`||Fh.target===`openapi-3.0`?{type:`string`}:{},pattern:Ph.source}))])}},numberProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ih,{minimum:zh,maximum:Bh,format:Vh,multipleOf:Hh,exclusiveMaximum:Uh,exclusiveMinimum:Wh}=Ph._zod.bag;typeof Vh==`string`&&Vh.includes(`int`)?Rh.type=`integer`:Rh.type=`number`,typeof Wh==`number`&&(Fh.target===`draft-04`||Fh.target===`openapi-3.0`?(Rh.minimum=Wh,Rh.exclusiveMinimum=!0):Rh.exclusiveMinimum=Wh),typeof zh==`number`&&(Rh.minimum=zh,typeof Wh==`number`&&Fh.target!==`draft-04`&&(Wh>=zh?delete Rh.minimum:delete Rh.exclusiveMinimum)),typeof Uh==`number`&&(Fh.target===`draft-04`||Fh.target===`openapi-3.0`?(Rh.maximum=Uh,Rh.exclusiveMaximum=!0):Rh.exclusiveMaximum=Uh),typeof Bh==`number`&&(Rh.maximum=Bh,typeof Uh==`number`&&Fh.target!==`draft-04`&&(Uh<=Bh?delete Rh.maximum:delete Rh.exclusiveMaximum)),typeof Hh==`number`&&(Rh.multipleOf=Hh)},booleanProcessor=(Ph,Fh,Ih,Lh)=>{Ih.type=`boolean`},neverProcessor=(Ph,Fh,Ih,Lh)=>{Ih.not={}},anyProcessor=(Ph,Fh,Ih,Lh)=>{},unknownProcessor=(Ph,Fh,Ih,Lh)=>{},enumProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def,zh=getEnumValues(Rh.entries);zh.every(Ph=>typeof Ph==`number`)&&(Ih.type=`number`),zh.every(Ph=>typeof Ph==`string`)&&(Ih.type=`string`),Ih.enum=zh},literalProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def,zh=[];for(let Ph of Rh.values)if(Ph===void 0){if(Fh.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof Ph==`bigint`){if(Fh.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);zh.push(Number(Ph))}else zh.push(Ph);if(zh.length!==0)if(zh.length===1){let Ph=zh[0];Ih.type=Ph===null?`null`:typeof Ph,Fh.target===`draft-04`||Fh.target===`openapi-3.0`?Ih.enum=[Ph]:Ih.const=Ph}else zh.every(Ph=>typeof Ph==`number`)&&(Ih.type=`number`),zh.every(Ph=>typeof Ph==`string`)&&(Ih.type=`string`),zh.every(Ph=>typeof Ph==`boolean`)&&(Ih.type=`boolean`),zh.every(Ph=>Ph===null)&&(Ih.type=`null`),Ih.enum=zh},customProcessor=(Ph,Fh,Ih,Lh)=>{if(Fh.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},transformProcessor=(Ph,Fh,Ih,Lh)=>{if(Fh.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},arrayProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ih,zh=Ph._zod.def,{minimum:Bh,maximum:Vh}=Ph._zod.bag;typeof Bh==`number`&&(Rh.minItems=Bh),typeof Vh==`number`&&(Rh.maxItems=Vh),Rh.type=`array`,Rh.items=process$1(zh.element,Fh,{...Lh,path:[...Lh.path,`items`]})},objectProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ih,zh=Ph._zod.def;Rh.type=`object`,Rh.properties={};let Bh=zh.shape;for(let Ph in Bh)Rh.properties[Ph]=process$1(Bh[Ph],Fh,{...Lh,path:[...Lh.path,`properties`,Ph]});let Vh=new Set(Object.keys(Bh)),Hh=new Set([...Vh].filter(Ph=>{let Ih=zh.shape[Ph]._zod;return Fh.io===`input`?Ih.optin===void 0:Ih.optout===void 0}));Hh.size>0&&(Rh.required=Array.from(Hh)),zh.catchall?._zod.def.type===`never`?Rh.additionalProperties=!1:zh.catchall?zh.catchall&&(Rh.additionalProperties=process$1(zh.catchall,Fh,{...Lh,path:[...Lh.path,`additionalProperties`]})):Fh.io===`output`&&(Rh.additionalProperties=!1)},unionProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def,zh=Rh.inclusive===!1,Bh=Rh.options.map((Ph,Ih)=>process$1(Ph,Fh,{...Lh,path:[...Lh.path,zh?`oneOf`:`anyOf`,Ih]}));zh?Ih.oneOf=Bh:Ih.anyOf=Bh},intersectionProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def,zh=process$1(Rh.left,Fh,{...Lh,path:[...Lh.path,`allOf`,0]}),Bh=process$1(Rh.right,Fh,{...Lh,path:[...Lh.path,`allOf`,1]}),Vh=Ph=>`allOf`in Ph&&Object.keys(Ph).length===1;Ih.allOf=[...Vh(zh)?zh.allOf:[zh],...Vh(Bh)?Bh.allOf:[Bh]]},tupleProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ih,zh=Ph._zod.def;Rh.type=`array`;let Bh=Fh.target===`draft-2020-12`?`prefixItems`:`items`,Vh=Fh.target===`draft-2020-12`||Fh.target===`openapi-3.0`?`items`:`additionalItems`,Hh=zh.items.map((Ph,Ih)=>process$1(Ph,Fh,{...Lh,path:[...Lh.path,Bh,Ih]})),Uh=zh.rest?process$1(zh.rest,Fh,{...Lh,path:[...Lh.path,Vh,...Fh.target===`openapi-3.0`?[zh.items.length]:[]]}):null;Fh.target===`draft-2020-12`?(Rh.prefixItems=Hh,Uh&&(Rh.items=Uh)):Fh.target===`openapi-3.0`?(Rh.items={anyOf:Hh},Uh&&Rh.items.anyOf.push(Uh),Rh.minItems=Hh.length,Uh||(Rh.maxItems=Hh.length)):(Rh.items=Hh,Uh&&(Rh.additionalItems=Uh));let{minimum:Wh,maximum:Gh}=Ph._zod.bag;typeof Wh==`number`&&(Rh.minItems=Wh),typeof Gh==`number`&&(Rh.maxItems=Gh)},recordProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ih,zh=Ph._zod.def;Rh.type=`object`;let Bh=zh.keyType,Vh=Bh._zod.bag?.patterns;if(zh.mode===`loose`&&Vh&&Vh.size>0){let Ph=process$1(zh.valueType,Fh,{...Lh,path:[...Lh.path,`patternProperties`,`*`]});Rh.patternProperties={};for(let Fh of Vh)Rh.patternProperties[Fh.source]=Ph}else (Fh.target===`draft-07`||Fh.target===`draft-2020-12`)&&(Rh.propertyNames=process$1(zh.keyType,Fh,{...Lh,path:[...Lh.path,`propertyNames`]})),Rh.additionalProperties=process$1(zh.valueType,Fh,{...Lh,path:[...Lh.path,`additionalProperties`]});let Hh=Bh._zod.values;if(Hh){let Ph=[...Hh].filter(Ph=>typeof Ph==`string`||typeof Ph==`number`);Ph.length>0&&(Rh.required=Ph)}},nullableProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def,zh=process$1(Rh.innerType,Fh,Lh),Bh=Fh.seen.get(Ph);Fh.target===`openapi-3.0`?(Bh.ref=Rh.innerType,Ih.nullable=!0):Ih.anyOf=[zh,{type:`null`}]},nonoptionalProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def;process$1(Rh.innerType,Fh,Lh);let zh=Fh.seen.get(Ph);zh.ref=Rh.innerType},defaultProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def;process$1(Rh.innerType,Fh,Lh);let zh=Fh.seen.get(Ph);zh.ref=Rh.innerType,Ih.default=JSON.parse(JSON.stringify(Rh.defaultValue))},prefaultProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def;process$1(Rh.innerType,Fh,Lh);let zh=Fh.seen.get(Ph);zh.ref=Rh.innerType,Fh.io===`input`&&(Ih._prefault=JSON.parse(JSON.stringify(Rh.defaultValue)))},catchProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def;process$1(Rh.innerType,Fh,Lh);let zh=Fh.seen.get(Ph);zh.ref=Rh.innerType;let Bh;try{Bh=Rh.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}Ih.default=Bh},pipeProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def,zh=Fh.io===`input`?Rh.in._zod.def.type===`transform`?Rh.out:Rh.in:Rh.out;process$1(zh,Fh,Lh);let Bh=Fh.seen.get(Ph);Bh.ref=zh},readonlyProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def;process$1(Rh.innerType,Fh,Lh);let zh=Fh.seen.get(Ph);zh.ref=Rh.innerType,Ih.readOnly=!0},optionalProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.def;process$1(Rh.innerType,Fh,Lh);let zh=Fh.seen.get(Ph);zh.ref=Rh.innerType},lazyProcessor=(Ph,Fh,Ih,Lh)=>{let Rh=Ph._zod.innerType;process$1(Rh,Fh,Lh);let zh=Fh.seen.get(Ph);zh.ref=Rh},ZodISODateTime=$constructor(`ZodISODateTime`,(Ph,Fh)=>{$ZodISODateTime.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)});function datetime(Ph){return _isoDateTime(ZodISODateTime,Ph)}var ZodISODate=$constructor(`ZodISODate`,(Ph,Fh)=>{$ZodISODate.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)});function date(Ph){return _isoDate(ZodISODate,Ph)}var ZodISOTime=$constructor(`ZodISOTime`,(Ph,Fh)=>{$ZodISOTime.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)});function time(Ph){return _isoTime(ZodISOTime,Ph)}var ZodISODuration=$constructor(`ZodISODuration`,(Ph,Fh)=>{$ZodISODuration.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)});function duration(Ph){return _isoDuration(ZodISODuration,Ph)}var initializer=(Ph,Fh)=>{$ZodError.init(Ph,Fh),Ph.name=`ZodError`,Object.defineProperties(Ph,{format:{value:Fh=>formatError(Ph,Fh)},flatten:{value:Fh=>flattenError(Ph,Fh)},addIssue:{value:Fh=>{Ph.issues.push(Fh),Ph.message=JSON.stringify(Ph.issues,jsonStringifyReplacer,2)}},addIssues:{value:Fh=>{Ph.issues.push(...Fh),Ph.message=JSON.stringify(Ph.issues,jsonStringifyReplacer,2)}},isEmpty:{get(){return Ph.issues.length===0}}})},ZodError=$constructor(`ZodError`,initializer),ZodRealError=$constructor(`ZodError`,initializer,{Parent:Error}),parse$3=_parse(ZodRealError),parseAsync=_parseAsync(ZodRealError),safeParse=_safeParse(ZodRealError),safeParseAsync=_safeParseAsync(ZodRealError),encode$1=_encode(ZodRealError),decode$4=_decode(ZodRealError),encodeAsync=_encodeAsync(ZodRealError),decodeAsync=_decodeAsync(ZodRealError),safeEncode=_safeEncode(ZodRealError),safeDecode=_safeDecode(ZodRealError),safeEncodeAsync=_safeEncodeAsync(ZodRealError),safeDecodeAsync=_safeDecodeAsync(ZodRealError),ZodType=$constructor(`ZodType`,(Ph,Fh)=>($ZodType.init(Ph,Fh),Object.assign(Ph[`~standard`],{jsonSchema:{input:createStandardJSONSchemaMethod(Ph,`input`),output:createStandardJSONSchemaMethod(Ph,`output`)}}),Ph.toJSONSchema=createToJSONSchemaMethod(Ph,{}),Ph.def=Fh,Ph.type=Fh.type,Object.defineProperty(Ph,`_def`,{value:Fh}),Ph.check=(...Ih)=>Ph.clone(mergeDefs(Fh,{checks:[...Fh.checks??[],...Ih.map(Ph=>typeof Ph==`function`?{_zod:{check:Ph,def:{check:`custom`},onattach:[]}}:Ph)]}),{parent:!0}),Ph.with=Ph.check,Ph.clone=(Fh,Ih)=>clone$6(Ph,Fh,Ih),Ph.brand=()=>Ph,Ph.register=((Fh,Ih)=>(Fh.add(Ph,Ih),Ph)),Ph.parse=(Fh,Ih)=>parse$3(Ph,Fh,Ih,{callee:Ph.parse}),Ph.safeParse=(Fh,Ih)=>safeParse(Ph,Fh,Ih),Ph.parseAsync=async(Fh,Ih)=>parseAsync(Ph,Fh,Ih,{callee:Ph.parseAsync}),Ph.safeParseAsync=async(Fh,Ih)=>safeParseAsync(Ph,Fh,Ih),Ph.spa=Ph.safeParseAsync,Ph.encode=(Fh,Ih)=>encode$1(Ph,Fh,Ih),Ph.decode=(Fh,Ih)=>decode$4(Ph,Fh,Ih),Ph.encodeAsync=async(Fh,Ih)=>encodeAsync(Ph,Fh,Ih),Ph.decodeAsync=async(Fh,Ih)=>decodeAsync(Ph,Fh,Ih),Ph.safeEncode=(Fh,Ih)=>safeEncode(Ph,Fh,Ih),Ph.safeDecode=(Fh,Ih)=>safeDecode(Ph,Fh,Ih),Ph.safeEncodeAsync=async(Fh,Ih)=>safeEncodeAsync(Ph,Fh,Ih),Ph.safeDecodeAsync=async(Fh,Ih)=>safeDecodeAsync(Ph,Fh,Ih),Ph.refine=(Fh,Ih)=>Ph.check(refine(Fh,Ih)),Ph.superRefine=Fh=>Ph.check(superRefine(Fh)),Ph.overwrite=Fh=>Ph.check(_overwrite(Fh)),Ph.optional=()=>optional(Ph),Ph.exactOptional=()=>exactOptional(Ph),Ph.nullable=()=>nullable(Ph),Ph.nullish=()=>optional(nullable(Ph)),Ph.nonoptional=Fh=>nonoptional(Ph,Fh),Ph.array=()=>array(Ph),Ph.or=Fh=>union([Ph,Fh]),Ph.and=Fh=>intersection(Ph,Fh),Ph.transform=Fh=>pipe(Ph,transform$1(Fh)),Ph.default=Fh=>_default(Ph,Fh),Ph.prefault=Fh=>prefault(Ph,Fh),Ph.catch=Fh=>_catch(Ph,Fh),Ph.pipe=Fh=>pipe(Ph,Fh),Ph.readonly=()=>readonly(Ph),Ph.describe=Fh=>{let Ih=Ph.clone();return globalRegistry.add(Ih,{description:Fh}),Ih},Object.defineProperty(Ph,`description`,{get(){return globalRegistry.get(Ph)?.description},configurable:!0}),Ph.meta=(...Fh)=>{if(Fh.length===0)return globalRegistry.get(Ph);let Ih=Ph.clone();return globalRegistry.add(Ih,Fh[0]),Ih},Ph.isOptional=()=>Ph.safeParse(void 0).success,Ph.isNullable=()=>Ph.safeParse(null).success,Ph.apply=Fh=>Fh(Ph),Ph)),_ZodString=$constructor(`_ZodString`,(Ph,Fh)=>{$ZodString.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>stringProcessor(Ph,Fh,Ih,Lh);let Ih=Ph._zod.bag;Ph.format=Ih.format??null,Ph.minLength=Ih.minimum??null,Ph.maxLength=Ih.maximum??null,Ph.regex=(...Fh)=>Ph.check(_regex(...Fh)),Ph.includes=(...Fh)=>Ph.check(_includes(...Fh)),Ph.startsWith=(...Fh)=>Ph.check(_startsWith(...Fh)),Ph.endsWith=(...Fh)=>Ph.check(_endsWith(...Fh)),Ph.min=(...Fh)=>Ph.check(_minLength(...Fh)),Ph.max=(...Fh)=>Ph.check(_maxLength(...Fh)),Ph.length=(...Fh)=>Ph.check(_length(...Fh)),Ph.nonempty=(...Fh)=>Ph.check(_minLength(1,...Fh)),Ph.lowercase=Fh=>Ph.check(_lowercase(Fh)),Ph.uppercase=Fh=>Ph.check(_uppercase(Fh)),Ph.trim=()=>Ph.check(_trim$1()),Ph.normalize=(...Fh)=>Ph.check(_normalize(...Fh)),Ph.toLowerCase=()=>Ph.check(_toLowerCase()),Ph.toUpperCase=()=>Ph.check(_toUpperCase()),Ph.slugify=()=>Ph.check(_slugify())}),ZodString=$constructor(`ZodString`,(Ph,Fh)=>{$ZodString.init(Ph,Fh),_ZodString.init(Ph,Fh),Ph.email=Fh=>Ph.check(_email(ZodEmail,Fh)),Ph.url=Fh=>Ph.check(_url(ZodURL,Fh)),Ph.jwt=Fh=>Ph.check(_jwt(ZodJWT,Fh)),Ph.emoji=Fh=>Ph.check(_emoji(ZodEmoji,Fh)),Ph.guid=Fh=>Ph.check(_guid(ZodGUID,Fh)),Ph.uuid=Fh=>Ph.check(_uuid(ZodUUID,Fh)),Ph.uuidv4=Fh=>Ph.check(_uuidv4(ZodUUID,Fh)),Ph.uuidv6=Fh=>Ph.check(_uuidv6(ZodUUID,Fh)),Ph.uuidv7=Fh=>Ph.check(_uuidv7(ZodUUID,Fh)),Ph.nanoid=Fh=>Ph.check(_nanoid(ZodNanoID,Fh)),Ph.guid=Fh=>Ph.check(_guid(ZodGUID,Fh)),Ph.cuid=Fh=>Ph.check(_cuid(ZodCUID,Fh)),Ph.cuid2=Fh=>Ph.check(_cuid2(ZodCUID2,Fh)),Ph.ulid=Fh=>Ph.check(_ulid(ZodULID,Fh)),Ph.base64=Fh=>Ph.check(_base64(ZodBase64,Fh)),Ph.base64url=Fh=>Ph.check(_base64url(ZodBase64URL,Fh)),Ph.xid=Fh=>Ph.check(_xid(ZodXID,Fh)),Ph.ksuid=Fh=>Ph.check(_ksuid(ZodKSUID,Fh)),Ph.ipv4=Fh=>Ph.check(_ipv4(ZodIPv4,Fh)),Ph.ipv6=Fh=>Ph.check(_ipv6(ZodIPv6,Fh)),Ph.cidrv4=Fh=>Ph.check(_cidrv4(ZodCIDRv4,Fh)),Ph.cidrv6=Fh=>Ph.check(_cidrv6(ZodCIDRv6,Fh)),Ph.e164=Fh=>Ph.check(_e164(ZodE164,Fh)),Ph.datetime=Fh=>Ph.check(datetime(Fh)),Ph.date=Fh=>Ph.check(date(Fh)),Ph.time=Fh=>Ph.check(time(Fh)),Ph.duration=Fh=>Ph.check(duration(Fh))});function string(Ph){return _string(ZodString,Ph)}var ZodStringFormat=$constructor(`ZodStringFormat`,(Ph,Fh)=>{$ZodStringFormat.init(Ph,Fh),_ZodString.init(Ph,Fh)}),ZodEmail=$constructor(`ZodEmail`,(Ph,Fh)=>{$ZodEmail.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodGUID=$constructor(`ZodGUID`,(Ph,Fh)=>{$ZodGUID.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodUUID=$constructor(`ZodUUID`,(Ph,Fh)=>{$ZodUUID.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodURL=$constructor(`ZodURL`,(Ph,Fh)=>{$ZodURL.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)});function url$1(Ph){return _url(ZodURL,Ph)}var ZodEmoji=$constructor(`ZodEmoji`,(Ph,Fh)=>{$ZodEmoji.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodNanoID=$constructor(`ZodNanoID`,(Ph,Fh)=>{$ZodNanoID.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodCUID=$constructor(`ZodCUID`,(Ph,Fh)=>{$ZodCUID.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodCUID2=$constructor(`ZodCUID2`,(Ph,Fh)=>{$ZodCUID2.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodULID=$constructor(`ZodULID`,(Ph,Fh)=>{$ZodULID.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodXID=$constructor(`ZodXID`,(Ph,Fh)=>{$ZodXID.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodKSUID=$constructor(`ZodKSUID`,(Ph,Fh)=>{$ZodKSUID.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodIPv4=$constructor(`ZodIPv4`,(Ph,Fh)=>{$ZodIPv4.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodIPv6=$constructor(`ZodIPv6`,(Ph,Fh)=>{$ZodIPv6.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodCIDRv4=$constructor(`ZodCIDRv4`,(Ph,Fh)=>{$ZodCIDRv4.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodCIDRv6=$constructor(`ZodCIDRv6`,(Ph,Fh)=>{$ZodCIDRv6.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodBase64=$constructor(`ZodBase64`,(Ph,Fh)=>{$ZodBase64.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodBase64URL=$constructor(`ZodBase64URL`,(Ph,Fh)=>{$ZodBase64URL.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodE164=$constructor(`ZodE164`,(Ph,Fh)=>{$ZodE164.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodJWT=$constructor(`ZodJWT`,(Ph,Fh)=>{$ZodJWT.init(Ph,Fh),ZodStringFormat.init(Ph,Fh)}),ZodNumber=$constructor(`ZodNumber`,(Ph,Fh)=>{$ZodNumber.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>numberProcessor(Ph,Fh,Ih,Lh),Ph.gt=(Fh,Ih)=>Ph.check(_gt(Fh,Ih)),Ph.gte=(Fh,Ih)=>Ph.check(_gte(Fh,Ih)),Ph.min=(Fh,Ih)=>Ph.check(_gte(Fh,Ih)),Ph.lt=(Fh,Ih)=>Ph.check(_lt(Fh,Ih)),Ph.lte=(Fh,Ih)=>Ph.check(_lte(Fh,Ih)),Ph.max=(Fh,Ih)=>Ph.check(_lte(Fh,Ih)),Ph.int=Fh=>Ph.check(int(Fh)),Ph.safe=Fh=>Ph.check(int(Fh)),Ph.positive=Fh=>Ph.check(_gt(0,Fh)),Ph.nonnegative=Fh=>Ph.check(_gte(0,Fh)),Ph.negative=Fh=>Ph.check(_lt(0,Fh)),Ph.nonpositive=Fh=>Ph.check(_lte(0,Fh)),Ph.multipleOf=(Fh,Ih)=>Ph.check(_multipleOf(Fh,Ih)),Ph.step=(Fh,Ih)=>Ph.check(_multipleOf(Fh,Ih)),Ph.finite=()=>Ph;let Ih=Ph._zod.bag;Ph.minValue=Math.max(Ih.minimum??-1/0,Ih.exclusiveMinimum??-1/0)??null,Ph.maxValue=Math.min(Ih.maximum??1/0,Ih.exclusiveMaximum??1/0)??null,Ph.isInt=(Ih.format??``).includes(`int`)||Number.isSafeInteger(Ih.multipleOf??.5),Ph.isFinite=!0,Ph.format=Ih.format??null});function number(Ph){return _number(ZodNumber,Ph)}var ZodNumberFormat=$constructor(`ZodNumberFormat`,(Ph,Fh)=>{$ZodNumberFormat.init(Ph,Fh),ZodNumber.init(Ph,Fh)});function int(Ph){return _int(ZodNumberFormat,Ph)}var ZodBoolean=$constructor(`ZodBoolean`,(Ph,Fh)=>{$ZodBoolean.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>booleanProcessor(Ph,Fh,Ih,Lh)});function boolean(Ph){return _boolean(ZodBoolean,Ph)}var ZodAny=$constructor(`ZodAny`,(Ph,Fh)=>{$ZodAny.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Ph,Fh,Ih)=>void 0});function any(){return _any(ZodAny)}var ZodUnknown=$constructor(`ZodUnknown`,(Ph,Fh)=>{$ZodUnknown.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Ph,Fh,Ih)=>void 0});function unknown(){return _unknown(ZodUnknown)}var ZodNever=$constructor(`ZodNever`,(Ph,Fh)=>{$ZodNever.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>neverProcessor(Ph,Fh,Ih,Lh)});function never(Ph){return _never(ZodNever,Ph)}var ZodArray=$constructor(`ZodArray`,(Ph,Fh)=>{$ZodArray.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>arrayProcessor(Ph,Fh,Ih,Lh),Ph.element=Fh.element,Ph.min=(Fh,Ih)=>Ph.check(_minLength(Fh,Ih)),Ph.nonempty=Fh=>Ph.check(_minLength(1,Fh)),Ph.max=(Fh,Ih)=>Ph.check(_maxLength(Fh,Ih)),Ph.length=(Fh,Ih)=>Ph.check(_length(Fh,Ih)),Ph.unwrap=()=>Ph.element});function array(Ph,Fh){return _array(ZodArray,Ph,Fh)}var ZodObject=$constructor(`ZodObject`,(Ph,Fh)=>{$ZodObjectJIT.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>objectProcessor(Ph,Fh,Ih,Lh),defineLazy(Ph,`shape`,()=>Fh.shape),Ph.keyof=()=>_enum(Object.keys(Ph._zod.def.shape)),Ph.catchall=Fh=>Ph.clone({...Ph._zod.def,catchall:Fh}),Ph.passthrough=()=>Ph.clone({...Ph._zod.def,catchall:unknown()}),Ph.loose=()=>Ph.clone({...Ph._zod.def,catchall:unknown()}),Ph.strict=()=>Ph.clone({...Ph._zod.def,catchall:never()}),Ph.strip=()=>Ph.clone({...Ph._zod.def,catchall:void 0}),Ph.extend=Fh=>extend$2(Ph,Fh),Ph.safeExtend=Fh=>safeExtend(Ph,Fh),Ph.merge=Fh=>merge$1(Ph,Fh),Ph.pick=Fh=>pick$1(Ph,Fh),Ph.omit=Fh=>omit(Ph,Fh),Ph.partial=(...Fh)=>partial(ZodOptional,Ph,Fh[0]),Ph.required=(...Fh)=>required(ZodNonOptional,Ph,Fh[0])});function object(Ph,Fh){return new ZodObject({type:`object`,shape:Ph??{},...normalizeParams(Fh)})}var ZodUnion=$constructor(`ZodUnion`,(Ph,Fh)=>{$ZodUnion.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>unionProcessor(Ph,Fh,Ih,Lh),Ph.options=Fh.options});function union(Ph,Fh){return new ZodUnion({type:`union`,options:Ph,...normalizeParams(Fh)})}var ZodDiscriminatedUnion=$constructor(`ZodDiscriminatedUnion`,(Ph,Fh)=>{ZodUnion.init(Ph,Fh),$ZodDiscriminatedUnion.init(Ph,Fh)});function discriminatedUnion(Ph,Fh,Ih){return new ZodDiscriminatedUnion({type:`union`,options:Fh,discriminator:Ph,...normalizeParams(Ih)})}var ZodIntersection=$constructor(`ZodIntersection`,(Ph,Fh)=>{$ZodIntersection.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>intersectionProcessor(Ph,Fh,Ih,Lh)});function intersection(Ph,Fh){return new ZodIntersection({type:`intersection`,left:Ph,right:Fh})}var ZodTuple=$constructor(`ZodTuple`,(Ph,Fh)=>{$ZodTuple.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>tupleProcessor(Ph,Fh,Ih,Lh),Ph.rest=Fh=>Ph.clone({...Ph._zod.def,rest:Fh})});function tuple(Ph,Fh,Ih){let Lh=Fh instanceof $ZodType;return new ZodTuple({type:`tuple`,items:Ph,rest:Lh?Fh:null,...normalizeParams(Lh?Ih:Fh)})}var ZodRecord=$constructor(`ZodRecord`,(Ph,Fh)=>{$ZodRecord.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>recordProcessor(Ph,Fh,Ih,Lh),Ph.keyType=Fh.keyType,Ph.valueType=Fh.valueType});function record(Ph,Fh,Ih){return new ZodRecord({type:`record`,keyType:Ph,valueType:Fh,...normalizeParams(Ih)})}var ZodEnum=$constructor(`ZodEnum`,(Ph,Fh)=>{$ZodEnum.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>enumProcessor(Ph,Fh,Ih,Lh),Ph.enum=Fh.entries,Ph.options=Object.values(Fh.entries);let Ih=new Set(Object.keys(Fh.entries));Ph.extract=(Ph,Lh)=>{let Rh={};for(let Lh of Ph)if(Ih.has(Lh))Rh[Lh]=Fh.entries[Lh];else throw Error(`Key ${Lh} not found in enum`);return new ZodEnum({...Fh,checks:[],...normalizeParams(Lh),entries:Rh})},Ph.exclude=(Ph,Lh)=>{let Rh={...Fh.entries};for(let Fh of Ph)if(Ih.has(Fh))delete Rh[Fh];else throw Error(`Key ${Fh} not found in enum`);return new ZodEnum({...Fh,checks:[],...normalizeParams(Lh),entries:Rh})}});function _enum(Ph,Fh){return new ZodEnum({type:`enum`,entries:Array.isArray(Ph)?Object.fromEntries(Ph.map(Ph=>[Ph,Ph])):Ph,...normalizeParams(Fh)})}var ZodLiteral=$constructor(`ZodLiteral`,(Ph,Fh)=>{$ZodLiteral.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>literalProcessor(Ph,Fh,Ih,Lh),Ph.values=new Set(Fh.values),Object.defineProperty(Ph,`value`,{get(){if(Fh.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Fh.values[0]}})});function literal(Ph,Fh){return new ZodLiteral({type:`literal`,values:Array.isArray(Ph)?Ph:[Ph],...normalizeParams(Fh)})}var ZodTransform=$constructor(`ZodTransform`,(Ph,Fh)=>{$ZodTransform.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>transformProcessor(Ph,Fh,Ih,Lh),Ph._zod.parse=(Ih,Lh)=>{if(Lh.direction===`backward`)throw new $ZodEncodeError(Ph.constructor.name);Ih.addIssue=Lh=>{if(typeof Lh==`string`)Ih.issues.push(issue(Lh,Ih.value,Fh));else{let Fh=Lh;Fh.fatal&&(Fh.continue=!1),Fh.code??=`custom`,Fh.input??=Ih.value,Fh.inst??=Ph,Ih.issues.push(issue(Fh))}};let Rh=Fh.transform(Ih.value,Ih);return Rh instanceof Promise?Rh.then(Ph=>(Ih.value=Ph,Ih)):(Ih.value=Rh,Ih)}});function transform$1(Ph){return new ZodTransform({type:`transform`,transform:Ph})}var ZodOptional=$constructor(`ZodOptional`,(Ph,Fh)=>{$ZodOptional.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>optionalProcessor(Ph,Fh,Ih,Lh),Ph.unwrap=()=>Ph._zod.def.innerType});function optional(Ph){return new ZodOptional({type:`optional`,innerType:Ph})}var ZodExactOptional=$constructor(`ZodExactOptional`,(Ph,Fh)=>{$ZodExactOptional.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>optionalProcessor(Ph,Fh,Ih,Lh),Ph.unwrap=()=>Ph._zod.def.innerType});function exactOptional(Ph){return new ZodExactOptional({type:`optional`,innerType:Ph})}var ZodNullable=$constructor(`ZodNullable`,(Ph,Fh)=>{$ZodNullable.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>nullableProcessor(Ph,Fh,Ih,Lh),Ph.unwrap=()=>Ph._zod.def.innerType});function nullable(Ph){return new ZodNullable({type:`nullable`,innerType:Ph})}var ZodDefault=$constructor(`ZodDefault`,(Ph,Fh)=>{$ZodDefault.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>defaultProcessor(Ph,Fh,Ih,Lh),Ph.unwrap=()=>Ph._zod.def.innerType,Ph.removeDefault=Ph.unwrap});function _default(Ph,Fh){return new ZodDefault({type:`default`,innerType:Ph,get defaultValue(){return typeof Fh==`function`?Fh():shallowClone(Fh)}})}var ZodPrefault=$constructor(`ZodPrefault`,(Ph,Fh)=>{$ZodPrefault.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>prefaultProcessor(Ph,Fh,Ih,Lh),Ph.unwrap=()=>Ph._zod.def.innerType});function prefault(Ph,Fh){return new ZodPrefault({type:`prefault`,innerType:Ph,get defaultValue(){return typeof Fh==`function`?Fh():shallowClone(Fh)}})}var ZodNonOptional=$constructor(`ZodNonOptional`,(Ph,Fh)=>{$ZodNonOptional.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>nonoptionalProcessor(Ph,Fh,Ih,Lh),Ph.unwrap=()=>Ph._zod.def.innerType});function nonoptional(Ph,Fh){return new ZodNonOptional({type:`nonoptional`,innerType:Ph,...normalizeParams(Fh)})}var ZodCatch=$constructor(`ZodCatch`,(Ph,Fh)=>{$ZodCatch.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>catchProcessor(Ph,Fh,Ih,Lh),Ph.unwrap=()=>Ph._zod.def.innerType,Ph.removeCatch=Ph.unwrap});function _catch(Ph,Fh){return new ZodCatch({type:`catch`,innerType:Ph,catchValue:typeof Fh==`function`?Fh:()=>Fh})}var ZodPipe=$constructor(`ZodPipe`,(Ph,Fh)=>{$ZodPipe.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>pipeProcessor(Ph,Fh,Ih,Lh),Ph.in=Fh.in,Ph.out=Fh.out});function pipe(Ph,Fh){return new ZodPipe({type:`pipe`,in:Ph,out:Fh})}var ZodReadonly=$constructor(`ZodReadonly`,(Ph,Fh)=>{$ZodReadonly.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>readonlyProcessor(Ph,Fh,Ih,Lh),Ph.unwrap=()=>Ph._zod.def.innerType});function readonly(Ph){return new ZodReadonly({type:`readonly`,innerType:Ph})}var ZodLazy=$constructor(`ZodLazy`,(Ph,Fh)=>{$ZodLazy.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>lazyProcessor(Ph,Fh,Ih,Lh),Ph.unwrap=()=>Ph._zod.def.getter()});function lazy(Ph){return new ZodLazy({type:`lazy`,getter:Ph})}var ZodCustom=$constructor(`ZodCustom`,(Ph,Fh)=>{$ZodCustom.init(Ph,Fh),ZodType.init(Ph,Fh),Ph._zod.processJSONSchema=(Fh,Ih,Lh)=>customProcessor(Ph,Fh,Ih,Lh)});function refine(Ph,Fh={}){return _refine(ZodCustom,Ph,Fh)}function superRefine(Ph){return _superRefine(Ph)}var describe=describe$1,meta=meta$1,provider2TTSAgent={openai:{agentName:`ttsOpenaiAgent`,hasLimitedConcurrency:!1,defaultModel:`gpt-4o-mini-tts`,defaultVoice:`shimmer`,keyName:`OPENAI_API_KEY`,baseURLKeyName:`OPENAI_BASE_URL`},google:{agentName:`ttsGoogleAgent`,hasLimitedConcurrency:!1,keyName:`GEMINI_API_KEY`},gemini:{agentName:`ttsGeminiAgent`,hasLimitedConcurrency:!1,defaultModel:`gemini-2.5-flash-preview-tts`,defaultVoice:`Kore`,models:[`gemini-2.5-flash-preview-tts`,`gemini-2.5-pro-preview-tts`],keyName:`GEMINI_API_KEY`},elevenlabs:{agentName:`ttsElevenlabsAgent`,hasLimitedConcurrency:!0,defaultModel:`eleven_multilingual_v2`,models:[`eleven_v3`,`eleven_multilingual_v2`,`eleven_turbo_v2_5`,`eleven_turbo_v2`,`eleven_flash_v2_5`,`eleven_flash_v2`],keyName:`ELEVENLABS_API_KEY`},kotodama:{agentName:`ttsKotodamaAgent`,hasLimitedConcurrency:!0,defaultVoice:`Atla`,defaultDecoration:`neutral`,keyName:`KOTODAMA_API_KEY`},mock:{agentName:`mediaMockAgent`,hasLimitedConcurrency:!0,defaultModel:`mock-model`,models:[`mock-model`]}},gptImages=[`gpt-image-1.5`,`gpt-image-1`,`gpt-image-1-mini`],provider2ImageAgent={openai:{agentName:`imageOpenaiAgent`,defaultModel:`gpt-image-1`,models:[`dall-e-3`,...gptImages],keyName:`OPENAI_API_KEY`,baseURLKeyName:`OPENAI_BASE_URL`},google:{agentName:`imageGenAIAgent`,defaultModel:`gemini-2.5-flash-image`,models:[`imagen-4.0-generate-001`,`imagen-4.0-ultra-generate-001`,`imagen-4.0-fast-generate-001`,`gemini-2.5-flash-image`,`gemini-3.1-flash-image-preview`,`gemini-3-pro-image-preview`],keyName:`GEMINI_API_KEY`},replicate:{agentName:`imageReplicateAgent`,defaultModel:`bytedance/seedream-4`,models:[`bytedance/seedream-4`,`qwen/qwen-image`],keyName:`REPLICATE_API_TOKEN`},mock:{agentName:`mediaMockAgent`,defaultModel:`mock-model`,models:[`mock-model`],keyName:``}},provider2MovieAgent={replicate:{agentName:`movieReplicateAgent`,defaultModel:`bytedance/seedance-1-lite`,keyName:`REPLICATE_API_TOKEN`,models:[`bytedance/seedance-1-lite`,`bytedance/seedance-1-pro`,`kwaivgi/kling-v1.6-pro`,`kwaivgi/kling-v2.1`,`kwaivgi/kling-v2.1-master`,`google/veo-2`,`google/veo-3`,`google/veo-3.1`,`google/veo-3.1-fast`,`google/veo-3.1-lite`,`google/veo-3-fast`,`minimax/video-01`,`minimax/hailuo-02`,`minimax/hailuo-02-fast`,`pixverse/pixverse-v4.5`,`wan-video/wan-2.2-i2v-fast`,`wan-video/wan-2.2-t2v-fast`,`xai/grok-imagine-video`,`xai/grok-imagine-r2v`,`runwayml/gen-4.5`,`kwaivgi/kling-v3-omni-video`,`kwaivgi/kling-v3-video`],modelParams:{"bytedance/seedance-1-lite":{durations:[5,10],start_image:`image`,last_image:`last_frame_image`,price_per_sec:.036},"bytedance/seedance-1-pro":{durations:[5,10],start_image:`image`,last_image:`last_frame_image`,price_per_sec:.15},"kwaivgi/kling-v1.6-pro":{durations:[5,10],start_image:`start_image`,price_per_sec:.095},"kwaivgi/kling-v2.1":{durations:[5,10],start_image:`start_image`,price_per_sec:.05},"kwaivgi/kling-v2.1-master":{durations:[5,10],start_image:`start_image`,price_per_sec:.28},"google/veo-2":{durations:[5,6,7,8],start_image:`image`,price_per_sec:.5},"google/veo-3":{durations:[8],start_image:`image`,price_per_sec:.75},"google/veo-3.1":{durations:[4,6,8],start_image:`image`,last_image:`last_frame_image`,reference_images_param:`reference_images`,price_per_sec:.75},"google/veo-3.1-fast":{durations:[4,6,8],start_image:`image`,last_image:`last_frame_image`,price_per_sec:.4},"google/veo-3.1-lite":{durations:[4,6,8],start_image:`image`,last_image:`last_frame`,price_per_sec:.05},"google/veo-3-fast":{durations:[8],start_image:`image`,price_per_sec:.4},"minimax/video-01":{durations:[6],start_image:`first_frame_image`,price_per_sec:.5},"minimax/hailuo-02":{durations:[6],start_image:`first_frame_image`,last_image:`end_image`,price_per_sec:.08},"minimax/hailuo-02-fast":{durations:[6,10],start_image:`first_frame_image`,price_per_sec:.0166},"pixverse/pixverse-v4.5":{durations:[5,8],start_image:`image`,last_image:`last_frame_image`,price_per_sec:.12},"wan-video/wan-2.2-i2v-fast":{durations:[5],start_image:`image`,price_per_sec:.012},"wan-video/wan-2.2-t2v-fast":{durations:[5],start_image:void 0,price_per_sec:.012},"xai/grok-imagine-video":{durations:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],start_image:`image`,price_per_sec:.08},"xai/grok-imagine-r2v":{durations:[1,2,3,4,5,6,7,8,9,10],start_image:void 0,reference_images_param:`reference_images`,price_per_sec:.08},"runwayml/gen-4.5":{durations:[5,10],start_image:`image`,price_per_sec:.25},"kwaivgi/kling-v3-omni-video":{durations:[3,4,5,6,7,8,9,10,11,12,13,14,15],start_image:`start_image`,last_image:`end_image`,reference_images_param:`reference_images`,price_per_sec:.3},"kwaivgi/kling-v3-video":{durations:[3,4,5,6,7,8,9,10,11,12,13,14,15],start_image:`start_image`,last_image:`end_image`,reference_images_param:`reference_images`,price_per_sec:.3}}},google:{agentName:`movieGenAIAgent`,defaultModel:`veo-2.0-generate-001`,models:[`veo-2.0-generate-001`,`veo-3.0-generate-001`,`veo-3.1-generate-preview`,`veo-3.1-lite-generate-preview`],keyName:`GEMINI_API_KEY`,modelParams:{"veo-3.1-lite-generate-preview":{durations:[4,6,8],supportsDuration:!0,supportsLastFrame:!0,supportsReferenceImages:!1,supportsPersonGeneration:!1},"veo-3.1-generate-preview":{durations:[4,6,8],supportsDuration:!0,supportsLastFrame:!0,supportsReferenceImages:!0,supportsPersonGeneration:!1},"veo-3.0-generate-001":{durations:[8],supportsDuration:!1,supportsLastFrame:!1,supportsReferenceImages:!1,supportsPersonGeneration:!1},"veo-2.0-generate-001":{durations:[5,6,8],supportsDuration:!0,supportsLastFrame:!1,supportsReferenceImages:!1,supportsPersonGeneration:!0}}},mock:{agentName:`mediaMockAgent`,defaultModel:`mock-model`,models:[`mock-model`],keyName:``,modelParams:{}}},provider2SoundEffectAgent={replicate:{agentName:`soundEffectReplicateAgent`,defaultModel:`zsxkib/mmaudio`,keyName:`REPLICATE_API_TOKEN`,models:[`zsxkib/mmaudio`],modelParams:{"zsxkib/mmaudio":{identifier:`zsxkib/mmaudio:62871fb59889b2d7c13777f08deb3b36bdff88f7e1d53a50ad7694548a41b484`}}}},defaultProviders={tts:`openai`,text2image:`openai`,text2movie:`replicate`,text2Html:`openai`,llm:`openai`,soundEffect:`replicate`,lipSync:`replicate`},htmlLLMProvider=[`openai`,`anthropic`,`mock`],mulmoVideoFilterMonoSchema=object({type:literal(`mono`)}),mulmoVideoFilterSepiaSchema=object({type:literal(`sepia`)}),mulmoVideoFilterBrightnessContrastSchema=object({type:literal(`brightness_contrast`),brightness:number().min(-1).max(1).optional().default(0),contrast:number().min(0).max(3).optional().default(1)}),mulmoVideoFilterHueSchema=object({type:literal(`hue`),hue:number().min(-180).max(180).optional().default(0),saturation:number().min(-10).max(10).optional().default(1),brightness:number().min(-10).max(10).optional().default(0)}),mulmoVideoFilterColorBalanceSchema=object({type:literal(`colorbalance`),rs:number().min(-1).max(1).optional().default(0),gs:number().min(-1).max(1).optional().default(0),bs:number().min(-1).max(1).optional().default(0),rm:number().min(-1).max(1).optional().default(0),gm:number().min(-1).max(1).optional().default(0),bm:number().min(-1).max(1).optional().default(0),rh:number().min(-1).max(1).optional().default(0),gh:number().min(-1).max(1).optional().default(0),bh:number().min(-1).max(1).optional().default(0)}),mulmoVideoFilterVibranceSchema=object({type:literal(`vibrance`),intensity:number().min(-2).max(2).optional().default(0)}),mulmoVideoFilterNegateSchema=object({type:literal(`negate`),negate_alpha:boolean().optional().default(!1)}),mulmoVideoFilterColorHoldSchema=object({type:literal(`colorhold`),color:string().optional().default(`red`),similarity:number().min(0).max(1).optional().default(.01),blend:number().min(0).max(1).optional().default(0)}),mulmoVideoFilterColorKeySchema=object({type:literal(`colorkey`),color:string().optional().default(`green`),similarity:number().min(0).max(1).optional().default(.01),blend:number().min(0).max(1).optional().default(0)}),mulmoVideoFilterBlurSchema=object({type:literal(`blur`),radius:number().min(1).max(50).optional().default(10),power:number().min(1).max(10).optional().default(1)}),mulmoVideoFilterGBlurSchema=object({type:literal(`gblur`),sigma:number().min(0).max(100).optional().default(30)}),mulmoVideoFilterAvgBlurSchema=object({type:literal(`avgblur`),sizeX:number().min(1).max(100).optional().default(10),sizeY:number().min(1).max(100).optional().default(10)}),mulmoVideoFilterUnsharpSchema=object({type:literal(`unsharp`),luma_msize_x:number().min(3).max(23).optional().default(5),luma_msize_y:number().min(3).max(23).optional().default(5),luma_amount:number().min(-2).max(5).optional().default(1),chroma_msize_x:number().min(3).max(23).optional().default(5),chroma_msize_y:number().min(3).max(23).optional().default(5),chroma_amount:number().min(-2).max(5).optional().default(0)}),mulmoVideoFilterEdgeDetectSchema=object({type:literal(`edgedetect`),low:number().min(0).max(1).optional().default(.2),high:number().min(0).max(1).optional().default(.4),mode:_enum([`wires`,`colormix`,`canny`]).optional().default(`wires`)}),mulmoVideoFilterSobelSchema=object({type:literal(`sobel`),planes:number().min(0).max(15).optional().default(15),scale:number().min(0).max(65535).optional().default(1),delta:number().min(-65535).max(65535).optional().default(0)}),mulmoVideoFilterEmbossSchema=object({type:literal(`emboss`)}),mulmoVideoFilterGlitchSchema=object({type:literal(`glitch`),intensity:number().min(1).max(100).optional().default(20),style:_enum([`noise`,`blend`]).optional().default(`noise`)}),mulmoVideoFilterGrainSchema=object({type:literal(`grain`),intensity:number().min(1).max(100).optional().default(10)}),mulmoVideoFilterHFlipSchema=object({type:literal(`hflip`)}),mulmoVideoFilterVFlipSchema=object({type:literal(`vflip`)}),mulmoVideoFilterRotateSchema=object({type:literal(`rotate`),angle:number().optional().default(0),fillcolor:string().optional().default(`black`)}),mulmoVideoFilterTransposeSchema=object({type:literal(`transpose`),dir:_enum([`cclock`,`clock`,`cclock_flip`,`clock_flip`]).optional().default(`clock`)}),mulmoVideoFilterVignetteSchema=object({type:literal(`vignette`),angle:number().min(0).max(Math.PI).optional().default(Math.PI/5),x0:number().min(0).max(1).optional(),y0:number().min(0).max(1).optional(),mode:_enum([`forward`,`backward`]).optional().default(`forward`)}),mulmoVideoFilterFadeSchema=object({type:literal(`fade`),mode:_enum([`in`,`out`]).optional().default(`in`),start_frame:number().min(0).optional().default(0),nb_frames:number().min(1).optional().default(25),alpha:boolean().optional().default(!1),color:string().optional().default(`black`)}),mulmoVideoFilterPixelizeSchema=object({type:literal(`pixelize`),width:number().min(1).max(1e3).optional().default(16),height:number().min(1).max(1e3).optional().default(16),mode:_enum([`avg`,`min`,`max`]).optional().default(`avg`)}),mulmoVideoFilterPseudoColorSchema=object({type:literal(`pseudocolor`),preset:_enum([`magma`,`inferno`,`plasma`,`viridis`,`turbo`,`cividis`,`range1`,`range2`,`shadows`,`highlights`,`solar`,`nominal`,`preferred`,`total`]).optional().default(`magma`)}),mulmoVideoFilterTmixSchema=object({type:literal(`tmix`),frames:number().min(1).max(1024).optional().default(3),weights:string().optional()}),mulmoVideoFilterLagfunSchema=object({type:literal(`lagfun`),decay:number().min(0).max(1).optional().default(.95),planes:number().min(0).max(15).optional().default(15)}),mulmoVideoFilterThresholdSchema=object({type:literal(`threshold`),planes:number().min(0).max(15).optional().default(15)}),mulmoVideoFilterElbgSchema=object({type:literal(`elbg`),codebook_length:number().min(1).max(256).optional().default(256)}),mulmoVideoFilterLensDistortionSchema=object({type:literal(`lensdistortion`),k1:number().min(-1).max(1).optional().default(0),k2:number().min(-1).max(1).optional().default(0)}),mulmoVideoFilterChromaShiftSchema=object({type:literal(`chromashift`),cbh:number().min(-255).max(255).optional().default(0),cbv:number().min(-255).max(255).optional().default(0),crh:number().min(-255).max(255).optional().default(0),crv:number().min(-255).max(255).optional().default(0),edge:_enum([`smear`,`wrap`]).optional().default(`smear`)}),mulmoVideoFilterDeflickerSchema=object({type:literal(`deflicker`),size:number().min(2).max(129).optional().default(5),mode:_enum([`am`,`gm`,`hm`,`qm`,`cm`,`pm`,`median`]).optional().default(`am`)}),mulmoVideoFilterDctDenoiseSchema=object({type:literal(`dctdnoiz`),sigma:number().min(0).max(999).optional().default(10)}),mulmoVideoFilterCustomSchema=object({type:literal(`custom`),filter:string()}),mulmoVideoFilterSchema=union([mulmoVideoFilterMonoSchema,mulmoVideoFilterSepiaSchema,mulmoVideoFilterBrightnessContrastSchema,mulmoVideoFilterHueSchema,mulmoVideoFilterColorBalanceSchema,mulmoVideoFilterVibranceSchema,mulmoVideoFilterNegateSchema,mulmoVideoFilterColorHoldSchema,mulmoVideoFilterColorKeySchema,mulmoVideoFilterBlurSchema,mulmoVideoFilterGBlurSchema,mulmoVideoFilterAvgBlurSchema,mulmoVideoFilterUnsharpSchema,mulmoVideoFilterEdgeDetectSchema,mulmoVideoFilterSobelSchema,mulmoVideoFilterEmbossSchema,mulmoVideoFilterGlitchSchema,mulmoVideoFilterGrainSchema,mulmoVideoFilterHFlipSchema,mulmoVideoFilterVFlipSchema,mulmoVideoFilterRotateSchema,mulmoVideoFilterTransposeSchema,mulmoVideoFilterVignetteSchema,mulmoVideoFilterFadeSchema,mulmoVideoFilterPixelizeSchema,mulmoVideoFilterPseudoColorSchema,mulmoVideoFilterTmixSchema,mulmoVideoFilterLagfunSchema,mulmoVideoFilterThresholdSchema,mulmoVideoFilterElbgSchema,mulmoVideoFilterLensDistortionSchema,mulmoVideoFilterChromaShiftSchema,mulmoVideoFilterDeflickerSchema,mulmoVideoFilterDctDenoiseSchema,mulmoVideoFilterCustomSchema]),hexColorSchema=string().regex(/^[0-9A-Fa-f]{6}$/),accentColorKeySchema=_enum([`primary`,`accent`,`success`,`warning`,`danger`,`info`,`highlight`]),slideThemeColorsSchema=object({bg:hexColorSchema,bgCard:hexColorSchema,bgCardAlt:hexColorSchema,text:hexColorSchema,textMuted:hexColorSchema,textDim:hexColorSchema,primary:hexColorSchema,accent:hexColorSchema,success:hexColorSchema,warning:hexColorSchema,danger:hexColorSchema,info:hexColorSchema,highlight:hexColorSchema}),slideThemeFontsSchema=object({title:string(),body:string(),mono:string()}),slideThemeSchema=object({colors:slideThemeColorsSchema,fonts:slideThemeFontsSchema}),textBlockSchema=object({type:literal(`text`),value:string(),align:_enum([`left`,`center`,`right`]).optional(),bold:boolean().optional(),dim:boolean().optional(),fontSize:number().optional(),color:accentColorKeySchema.optional()}),subBulletItemSchema=union([string(),object({text:string()})]),bulletItemSchema=union([string(),object({text:string(),items:array(subBulletItemSchema).optional()})]),bulletsBlockSchema=object({type:literal(`bullets`),items:array(bulletItemSchema),ordered:boolean().optional(),icon:string().optional()}),codeBlockSchema=object({type:literal(`code`),code:string(),language:string().optional()}),calloutBlockSchema=object({type:literal(`callout`),text:string(),label:string().optional(),color:accentColorKeySchema.optional(),style:_enum([`quote`,`info`,`warning`]).optional()}),metricBlockSchema=object({type:literal(`metric`),value:string(),label:string(),color:accentColorKeySchema.optional(),change:string().optional()}),dividerBlockSchema=object({type:literal(`divider`),color:accentColorKeySchema.optional()}),imageBlockSchema=object({type:literal(`image`),src:string(),alt:string().optional(),fit:_enum([`contain`,`cover`]).optional()}),imageRefBlockSchema=object({type:literal(`imageRef`),ref:string(),alt:string().optional(),fit:_enum([`contain`,`cover`]).optional()}),chartBlockSchema=object({type:literal(`chart`),chartData:record(string(),unknown()),title:string().optional()}),mermaidBlockSchema=object({type:literal(`mermaid`),code:string(),title:string().optional()}),tableCellValueSchema=union([string(),object({text:string(),color:accentColorKeySchema.optional(),bold:boolean().optional(),badge:boolean().optional()})]),tableBlockSchema=object({type:literal(`table`),title:string().optional(),headers:array(string()).optional(),rows:array(array(tableCellValueSchema)),rowHeaders:boolean().optional(),striped:boolean().optional()}),baseBlockSchemas=[textBlockSchema,bulletsBlockSchema,codeBlockSchema,calloutBlockSchema,metricBlockSchema,dividerBlockSchema,imageBlockSchema,imageRefBlockSchema,chartBlockSchema,mermaidBlockSchema,tableBlockSchema],nonSectionContentBlockSchema=discriminatedUnion(`type`,[...baseBlockSchemas]),sectionBlockSchema=object({type:literal(`section`),label:string(),color:accentColorKeySchema.optional(),content:array(nonSectionContentBlockSchema).optional(),text:string().optional(),sidebar:boolean().optional()}),contentBlockSchema=discriminatedUnion(`type`,[...baseBlockSchemas,sectionBlockSchema]),calloutBarSchema=object({text:string(),label:string().optional(),color:accentColorKeySchema.optional(),align:_enum([`left`,`center`]).optional(),leftBar:boolean().optional()}),cardSchema=object({title:string(),accentColor:accentColorKeySchema.optional(),content:array(contentBlockSchema).optional(),footer:string().optional(),label:string().optional(),num:number().optional(),icon:string().optional()}),slideStyleSchema=object({bgColor:string().optional(),decorations:boolean().optional(),bgOpacity:number().optional(),footer:string().optional()}),slideBaseFields={accentColor:accentColorKeySchema.optional(),style:slideStyleSchema.optional()},titleSlideSchema=object({layout:literal(`title`),...slideBaseFields,title:string(),subtitle:string().optional(),author:string().optional(),note:string().optional()}),columnsSlideSchema=object({layout:literal(`columns`),...slideBaseFields,title:string(),stepLabel:string().optional(),subtitle:string().optional(),columns:array(cardSchema),showArrows:boolean().optional(),callout:calloutBarSchema.optional(),bottomText:string().optional()}),comparisonPanelSchema=object({title:string(),accentColor:accentColorKeySchema.optional(),content:array(contentBlockSchema).optional(),footer:string().optional()}),comparisonSlideSchema=object({layout:literal(`comparison`),...slideBaseFields,title:string(),stepLabel:string().optional(),subtitle:string().optional(),left:comparisonPanelSchema,right:comparisonPanelSchema,callout:calloutBarSchema.optional()}),gridItemSchema=object({title:string(),description:string().optional(),accentColor:accentColorKeySchema.optional(),num:number().optional(),icon:string().optional(),content:array(contentBlockSchema).optional()}),gridSlideSchema=object({layout:literal(`grid`),...slideBaseFields,title:string(),subtitle:string().optional(),gridColumns:number().optional(),items:array(gridItemSchema),footer:string().optional()}),bigQuoteSlideSchema=object({layout:literal(`bigQuote`),...slideBaseFields,quote:string(),author:string().optional(),role:string().optional()}),statItemSchema=object({value:string(),label:string(),color:accentColorKeySchema.optional(),change:string().optional()}),statsSlideSchema=object({layout:literal(`stats`),...slideBaseFields,title:string(),stepLabel:string().optional(),subtitle:string().optional(),stats:array(statItemSchema),callout:calloutBarSchema.optional()}),timelineItemSchema=object({date:string(),title:string(),description:string().optional(),color:accentColorKeySchema.optional(),done:boolean().optional()}),timelineSlideSchema=object({layout:literal(`timeline`),...slideBaseFields,title:string(),stepLabel:string().optional(),subtitle:string().optional(),items:array(timelineItemSchema)}),splitPanelSchema=object({title:string().optional(),subtitle:string().optional(),label:string().optional(),labelBadge:boolean().optional(),accentColor:accentColorKeySchema.optional(),content:array(contentBlockSchema).optional(),dark:boolean().optional(),ratio:number().optional(),valign:_enum([`top`,`center`,`bottom`]).optional()}),splitSlideSchema=object({layout:literal(`split`),...slideBaseFields,left:splitPanelSchema.optional(),right:splitPanelSchema.optional()}),matrixCellSchema=object({label:string(),items:array(string()).optional(),content:array(contentBlockSchema).optional(),accentColor:accentColorKeySchema.optional()}),matrixSlideSchema=object({layout:literal(`matrix`),...slideBaseFields,title:string(),stepLabel:string().optional(),subtitle:string().optional(),rows:number().optional(),cols:number().optional(),xAxis:object({low:string().optional(),high:string().optional(),label:string().optional()}).optional(),yAxis:object({low:string().optional(),high:string().optional(),label:string().optional()}).optional(),cells:array(matrixCellSchema)}),tableSlideSchema=object({layout:literal(`table`),...slideBaseFields,title:string(),stepLabel:string().optional(),subtitle:string().optional(),headers:array(string()),rows:array(array(tableCellValueSchema)),rowHeaders:boolean().optional(),striped:boolean().optional(),callout:calloutBarSchema.optional()}),waterfallItemSchema=object({label:string(),value:number(),isTotal:boolean().optional(),color:accentColorKeySchema.optional()}),waterfallSlideSchema=object({layout:literal(`waterfall`),...slideBaseFields,title:string(),stepLabel:string().optional(),subtitle:string().optional(),items:array(waterfallItemSchema),unit:string().optional(),callout:calloutBarSchema.optional()}),funnelStageSchema=object({label:string(),value:string().optional(),description:string().optional(),color:accentColorKeySchema.optional()}),funnelSlideSchema=object({layout:literal(`funnel`),...slideBaseFields,title:string(),stepLabel:string().optional(),subtitle:string().optional(),stages:array(funnelStageSchema),callout:calloutBarSchema.optional()}),slideMediaSourceSchema=discriminatedUnion(`kind`,[object({kind:literal(`url`),url:url$1()}).strict(),object({kind:literal(`base64`),data:string().min(1)}).strict(),object({kind:literal(`path`),path:string().min(1)}).strict()]),slideBackgroundImageSourceSchema=object({source:slideMediaSourceSchema,size:_enum([`cover`,`contain`,`fill`,`auto`]).optional(),opacity:number().min(0).max(1).optional(),bgOpacity:number().min(0).max(1).optional()}),slideBrandingLogoSchema=object({source:slideMediaSourceSchema,position:_enum([`top-left`,`top-right`,`bottom-left`,`bottom-right`]).default(`top-right`),width:number().positive().default(120)}).strict(),slideBrandingSchema=object({logo:slideBrandingLogoSchema.optional(),backgroundImage:slideBackgroundImageSourceSchema.optional()}).strict(),slideLayoutSchema=discriminatedUnion(`layout`,[titleSlideSchema,columnsSlideSchema,comparisonSlideSchema,gridSlideSchema,bigQuoteSlideSchema,statsSlideSchema,timelineSlideSchema,splitSlideSchema,matrixSlideSchema,tableSlideSchema,funnelSlideSchema,waterfallSlideSchema]),mulmoSlideMediaSchema=object({type:literal(`slide`),theme:slideThemeSchema.optional(),slide:slideLayoutSchema,reference:string().optional(),branding:slideBrandingSchema.nullable().optional()}).strict(),langSchema=string(),URLStringSchema=url$1(),localizedTextSchema=object({text:string(),lang:langSchema,texts:array(string()).optional(),ttsTexts:array(string()).optional(),cacheKey:string(),duration:number().optional()}).strict(),multiLingualTextsSchema=record(langSchema,localizedTextSchema),speechOptionsSchema=object({speed:number().optional(),instruction:string().optional(),decoration:string().optional(),stability:number().optional(),similarity_boost:number().optional()}).strict(),speakerIdSchema=string(),defaultSpeaker=`Presenter`,text2SpeechProviderSchema=_enum(Object.keys(provider2TTSAgent)).default(defaultProviders.tts),speakerDataSchema=object({displayName:record(langSchema,string()).optional(),voiceId:string(),isDefault:boolean().optional(),speechOptions:speechOptionsSchema.optional(),provider:text2SpeechProviderSchema.optional(),model:string().optional().describe(`TTS model to use for this speaker`),baseURL:string().optional(),apiVersion:string().optional()}).strict(),speakerSchema=speakerDataSchema.extend({lang:record(langSchema,speakerDataSchema).optional()}),speakerDictionarySchema=record(speakerIdSchema,speakerSchema),mulmoSpeechParamsSchema=object({speakers:speakerDictionarySchema}).default({speakers:{[defaultSpeaker]:{provider:defaultProviders.tts,voiceId:`shimmer`,displayName:{en:defaultSpeaker}}}}),mediaSourceSchema=discriminatedUnion(`kind`,[object({kind:literal(`url`),url:URLStringSchema}).strict(),object({kind:literal(`base64`),data:string().min(1)}).strict(),object({kind:literal(`path`),path:string().min(1)}).strict()]),mediaSourceMermaidSchema=discriminatedUnion(`kind`,[object({kind:literal(`url`),url:URLStringSchema}).strict(),object({kind:literal(`base64`),data:string().min(1)}).strict(),object({kind:literal(`text`),text:string().min(1)}).strict(),object({kind:literal(`path`),path:string().min(1)}).strict()]),backgroundImageSourceSchema=object({source:mediaSourceSchema,size:_enum([`cover`,`contain`,`fill`,`auto`]).optional(),opacity:number().min(0).max(1).optional()}),backgroundImageSchema=union([string(),backgroundImageSourceSchema]).nullable().optional(),stringOrStringArray=union([string(),array(string())]),row2Schema=tuple([stringOrStringArray,stringOrStringArray]),grid2x2Schema=tuple([stringOrStringArray,stringOrStringArray,stringOrStringArray,stringOrStringArray]),layoutFrameSchema=object({header:stringOrStringArray.optional(),"sidebar-left":stringOrStringArray.optional()}),layoutMainSchema=union([object({"row-2":row2Schema}),object({"2x2":grid2x2Schema}),object({content:stringOrStringArray})]),markdownLayoutSchema=layoutFrameSchema.and(layoutMainSchema),mulmoMarkdownMediaSchema=object({type:literal(`markdown`),markdown:union([stringOrStringArray,markdownLayoutSchema]),style:string().optional(),backgroundImage:backgroundImageSchema}).strict(),mulmoWebMediaSchema=object({type:literal(`web`),url:URLStringSchema}).strict(),mulmoPdfMediaSchema=object({type:literal(`pdf`),source:mediaSourceSchema}).strict(),mulmoImageMediaSchema=object({type:literal(`image`),source:mediaSourceSchema}).strict(),mulmoSvgMediaSchema=object({type:literal(`svg`),source:mediaSourceSchema}).strict(),mulmoMovieMediaSchema=object({type:literal(`movie`),source:mediaSourceSchema}).strict(),mulmoMoviePromptMediaSchema=object({type:literal(`moviePrompt`),prompt:string().min(1),imageName:string().optional().describe(`Reference an imageRefs key to use as image-to-video input`)}).strict(),mulmoTextSlideMediaSchema=object({type:literal(`textSlide`),slide:object({title:string(),subtitle:string().optional(),bullets:array(string()).optional()}),style:string().optional(),backgroundImage:backgroundImageSchema}).strict(),captionSplitSchema=_enum([`none`,`estimate`]).default(`none`),textSplitSchema=discriminatedUnion(`type`,[object({type:literal(`none`)}),object({type:literal(`delimiters`),delimiters:array(string()).optional()})]),mulmoCaptionParamsSchema=object({lang:langSchema.optional(),styles:array(string()).optional(),captionSplit:captionSplitSchema.optional(),textSplit:textSplitSchema.optional(),bottomOffset:number().min(0).max(100).optional()}).strict(),mulmoChartMediaSchema=object({type:literal(`chart`),title:string(),chartData:record(string(),any()),style:string().optional(),backgroundImage:backgroundImageSchema}).strict(),mulmoMermaidMediaSchema=object({type:literal(`mermaid`),title:string().describe(`The title of the diagram`),code:mediaSourceMermaidSchema.describe(`The code of the mermaid diagram`),appendix:array(string()).optional().describe(`The appendix of the mermaid diagram; typically, style information.`),style:string().optional(),backgroundImage:backgroundImageSchema}).strict(),swipePositionValue=union([number(),string()]),swipeTransitionSchema=object({opacity:number().min(0).max(1).optional(),rotate:number().optional(),scale:union([number(),tuple([number(),number()])]).optional(),translate:tuple([number(),number()]).optional(),bc:string().optional(),timing:tuple([number(),number()]).default([0,1]).optional().describe(`Animation timing [start, end] as ratio 0.0-1.0 of beat duration`)}).strict(),swipeLoopSchema=object({style:_enum([`vibrate`,`blink`,`wiggle`,`spin`,`shift`,`bounce`,`pulse`]),count:number().optional().describe(`Number of loop iterations. 0 = infinite`),delta:number().optional().describe(`Distance for vibrate / angle for wiggle`),duration:number().optional().describe(`Duration of one cycle in seconds`),direction:_enum([`n`,`s`,`e`,`w`]).optional().describe(`Direction for shift animation`),clockwise:boolean().optional().describe(`Spin direction. Default: true`)}).strict(),swipeShadowSchema=object({color:string().optional().default(`black`),offset:tuple([number(),number()]).optional().default([1,1]),opacity:number().optional().default(.5),radius:number().optional().default(1)}).strict(),swipeElementSchema=lazy(()=>object({id:string().optional(),x:swipePositionValue.optional(),y:swipePositionValue.optional(),w:swipePositionValue.optional(),h:swipePositionValue.optional(),pos:tuple([swipePositionValue,swipePositionValue]).optional().describe(`Position by anchor point [x, y]`),bc:string().optional().describe(`Background color`),opacity:number().min(0).max(1).optional(),rotate:number().optional(),scale:union([number(),tuple([number(),number()])]).optional(),translate:tuple([number(),number()]).optional(),cornerRadius:number().optional(),borderWidth:number().optional(),borderColor:string().optional(),shadow:swipeShadowSchema.optional(),clip:boolean().optional(),text:string().optional(),fontSize:union([number(),string()]).optional(),fontWeight:string().optional(),textColor:string().optional(),textAlign:_enum([`center`,`left`,`right`]).optional(),lineHeight:union([number(),string()]).optional(),img:string().optional().describe(`Image URL or image:ref`),imgFit:_enum([`contain`,`cover`,`fill`]).optional().default(`contain`),to:swipeTransitionSchema.optional().describe(`Transition animation`),loop:swipeLoopSchema.optional().describe(`Loop animation`),elements:array(lazy(()=>swipeElementSchema)).optional()}).strict()),htmlTailwindAnimationSchema=union([literal(!0),object({fps:number().min(1).max(60).optional().default(30),movie:boolean().optional().describe(`Use CDP screencast for real-time recording (experimental, faster). Default: false (frame-by-frame screenshot).`)})]),mulmoHtmlTailwindMediaSchema=object({type:literal(`html_tailwind`),html:stringOrStringArray.optional(),script:stringOrStringArray.optional().describe(`JavaScript code for the beat. Injected as a <script> tag after html. Use for render() function etc.`),elements:array(swipeElementSchema).optional().describe(`Swipe-style declarative animation elements. Converted to HTML + render() automatically. Use this OR html, not both.`),animation:htmlTailwindAnimationSchema.optional().describe(`Enable frame-based animation (Remotion-style). true for defaults (30fps), or { fps: N } for custom frame rate.`)}).strict(),mulmoBeatReferenceMediaSchema=object({type:literal(`beat`),id:string().optional().describe(`Specifies the beat to reference.`)}).strict(),mulmoVoiceOverMediaSchema=object({type:literal(`voice_over`),startAt:number().optional().describe(`The time to start the voice over the video in seconds.`)}).strict(),mulmoVisionMediaSchema=object({type:literal(`vision`),style:string().min(1),data:record(string(),any())}).strict(),mulmoImageAssetSchema=union([mulmoMarkdownMediaSchema,mulmoWebMediaSchema,mulmoPdfMediaSchema,mulmoImageMediaSchema,mulmoSvgMediaSchema,mulmoMovieMediaSchema,mulmoTextSlideMediaSchema,mulmoChartMediaSchema,mulmoMermaidMediaSchema,mulmoHtmlTailwindMediaSchema,mulmoBeatReferenceMediaSchema,mulmoVoiceOverMediaSchema,mulmoVisionMediaSchema,mulmoSlideMediaSchema]),mulmoAudioMediaSchema=object({type:literal(`audio`),source:mediaSourceSchema}).strict(),mulmoMidiMediaSchema=object({type:literal(`midi`),source:string()}).strict(),mulmoAudioAssetSchema=union([mulmoAudioMediaSchema,mulmoMidiMediaSchema]),imageIdSchema=string(),mulmoImagePromptMediaSchema=object({type:literal(`imagePrompt`),prompt:string().min(1),canvasSize:object({width:number(),height:number()}).strict().optional(),referenceImageName:imageIdSchema.optional().describe(`Reference another imageRefs key as input for image generation`),referenceImage:mediaSourceSchema.optional().describe(`Direct source (path/url/base64) as reference image for generation`)}).strict(),mulmoImageParamsImagesValueSchema=union([mulmoImageMediaSchema,mulmoImagePromptMediaSchema,mulmoMovieMediaSchema,mulmoMoviePromptMediaSchema]),mulmoImageParamsImagesSchema=record(imageIdSchema,mulmoImageParamsImagesValueSchema),mulmoFillOptionSchema=object({style:_enum([`aspectFit`,`aspectFill`]).optional().default(`aspectFit`)}).describe(`How to handle aspect ratio differences between image and canvas`),text2ImageProviderSchema=_enum(Object.keys(provider2ImageAgent)).optional(),mulmoOpenAIImageModelSchema=object({provider:literal(`openai`),model:_enum(provider2ImageAgent.openai.models).optional(),quality:_enum([`low`,`medium`,`high`,`auto`]).optional()}).strict(),mulmoGoogleImageModelSchema=object({provider:literal(`google`),model:_enum(provider2ImageAgent.google.models).optional()}).strict(),mulmoBeatImageParamsSchema=object({provider:text2ImageProviderSchema,model:string().optional(),quality:string().optional(),style:string().optional(),moderation:string().optional(),baseURL:string().optional(),apiVersion:string().optional(),vertexai_project:string().optional(),vertexai_location:string().optional()}).strict(),mulmoImageParamsSchema=mulmoBeatImageParamsSchema.extend({images:mulmoImageParamsImagesSchema.optional(),backgroundImage:backgroundImageSchema,concurrency:number().int().positive().optional().describe(`Max concurrent image generation requests`)}).strict(),textSlideParamsSchema=object({cssStyles:stringOrStringArray}).strict(),mulmoSlideParamsSchema=object({theme:slideThemeSchema,branding:slideBrandingSchema.optional()}).strict(),beatAudioParamsSchema=object({padding:number().optional().describe(`Padding between beats`),movieVolume:number().min(0).max(1).optional().describe(`Audio volume of the imported or generated movie`)}).strict(),mulmoHtmlImageParamsSchema=object({model:string().optional()}).strict(),audioParamsSchema=object({padding:number().optional().default(.3).describe(`Padding between beats`),introPadding:number().optional().default(1).describe(`Padding at the beginning of the audio`),closingPadding:number().optional().default(.8).describe(`Padding before the last beat`),outroPadding:number().optional().default(1).describe(`Padding at the end of the audio`),bgm:mediaSourceSchema.optional(),bgmVolume:number().optional().default(.2).describe(`Volume of the background music`),audioVolume:number().optional().default(1).describe(`Volume of the audio`),suppressSpeech:boolean().optional().default(!1).describe(`Suppress speech generation`),movieVolume:number().min(0).max(1).optional().describe(`Default movie audio volume for all beats`),ttsVolume:number().min(0).max(2).optional().describe(`TTS narration volume before mixing with BGM/movie audio`),ducking:object({ratio:number().min(0).max(1).optional().describe(`Movie volume ratio during TTS beats (default 0.3)`)}).optional().describe(`Auto-reduce movie audio when TTS is playing`),concurrency:number().int().positive().optional().describe(`Max concurrent TTS generation requests`)}).strict(),htmlPromptParamsSchema=object({systemPrompt:string().optional().default(``),prompt:string().min(1),data:any().optional(),images:record(string(),any()).optional()}).strict(),text2MovieProviderSchema=_enum(Object.keys(provider2MovieAgent)),text2SoundEffectProviderSchema=_enum(Object.keys(provider2SoundEffectAgent)).default(defaultProviders.soundEffect),mulmoSoundEffectParamsSchema=object({provider:text2SoundEffectProviderSchema.optional(),model:string().optional()}),mulmoLipSyncParamsSchema=object({provider:string().optional(),model:string().optional()}),mulmoTransitionSchema=object({type:_enum([`fade`,`slideout_left`,`slideout_right`,`slideout_up`,`slideout_down`,`slidein_left`,`slidein_right`,`slidein_up`,`slidein_down`,`wipeleft`,`wiperight`,`wipeup`,`wipedown`,`wipetl`,`wipetr`,`wipebl`,`wipebr`]),duration:number().min(0).max(2).optional().default(.3)}),movieReferenceImageSchema=object({imageName:imageIdSchema.describe(`Reference an imageRefs key`),referenceType:_enum([`ASSET`,`STYLE`]).describe(`ASSET: scene/object/character, STYLE: aesthetics/lighting`)}),mulmoMovieParamsSchema=object({provider:text2MovieProviderSchema.optional(),model:string().optional(),fillOption:mulmoFillOptionSchema.optional(),transition:mulmoTransitionSchema.optional(),filters:array(mulmoVideoFilterSchema).optional(),vertexai_project:string().optional(),vertexai_location:string().optional(),firstFrameImageName:imageIdSchema.optional().describe(`Reference an imageRefs key for the first frame (image-to-video input)`),lastFrameImageName:imageIdSchema.optional().describe(`Reference an imageRefs key for the last frame (image-to-video interpolation)`),referenceImages:array(movieReferenceImageSchema).optional().describe(`Style/asset reference images (Veo 3.1). Mutually exclusive with imageName/lastFrameImageName`),concurrency:number().int().positive().optional().describe(`Max concurrent movie generation requests`)}),mulmoBeatSchema=object({speaker:speakerIdSchema.optional(),text:string().optional().default(``).describe(`Text to be spoken. If empty, the audio is not generated.`),texts:array(string()).optional().describe(`Manually split texts for captions. Takes precedence over text for caption display.`),id:string().optional().describe(`Unique identifier for the beat.`),description:string().optional(),image:mulmoImageAssetSchema.optional(),audio:mulmoAudioAssetSchema.optional(),duration:number().optional().describe(`Duration of the beat. Used only when the text is empty`),imageParams:mulmoBeatImageParamsSchema.optional(),audioParams:beatAudioParamsSchema.optional(),movieParams:mulmoMovieParamsSchema.extend({speed:number().optional().describe(`Speed of the video. 1.0 is normal speed. 0.5 is half speed. 2.0 is double speed.`)}).optional(),soundEffectParams:mulmoSoundEffectParamsSchema.optional(),lipSyncParams:mulmoLipSyncParamsSchema.optional(),htmlImageParams:mulmoHtmlImageParamsSchema.optional(),speechOptions:speechOptionsSchema.optional(),textSlideParams:textSlideParamsSchema.optional(),captionParams:mulmoCaptionParamsSchema.optional(),images:mulmoImageParamsImagesSchema.optional().describe(`Beat-local media references. Same schema as imageParams.images. Merged with global refs (local takes precedence).`),imageNames:array(imageIdSchema).optional(),imagePrompt:string().optional(),moviePrompt:string().optional(),soundEffectPrompt:string().optional(),htmlPrompt:htmlPromptParamsSchema.optional(),enableLipSync:boolean().optional().describe(`Enable lip sync generation for this beat`),hidden:boolean().optional().describe(`Hide this beat from the presentation`)}).strict(),mulmoCanvasDimensionSchema=object({width:number(),height:number()}).default({width:1280,height:720}),mulmoCastCreditSchema=object({version:literal(`1.1`),credit:literal(`closing`).optional()}).strict(),text2HtmlImageProviderSchema=_enum(htmlLLMProvider).default(defaultProviders.text2Html),mulmoGoogleMovieModelSchema=object({provider:literal(`google`),model:_enum(provider2MovieAgent.google.models).optional()}).strict(),mulmoReplicateMovieModelSchema=object({provider:literal(`replicate`),model:_enum(provider2MovieAgent.replicate.models).optional()}).strict(),mulmoPresentationStyleSchema=object({$mulmocast:mulmoCastCreditSchema,canvasSize:mulmoCanvasDimensionSchema,speechParams:mulmoSpeechParamsSchema,imageParams:mulmoImageParamsSchema.optional().default({provider:defaultProviders.text2image,images:{}}),movieParams:mulmoMovieParamsSchema.optional().default({provider:defaultProviders.text2movie}),soundEffectParams:mulmoSoundEffectParamsSchema.optional().default({provider:defaultProviders.soundEffect}),lipSyncParams:mulmoLipSyncParamsSchema.optional(),htmlImageParams:mulmoHtmlImageParamsSchema.extend({provider:text2HtmlImageProviderSchema}).optional(),textSlideParams:textSlideParamsSchema.optional(),slideParams:mulmoSlideParamsSchema.optional(),captionParams:mulmoCaptionParamsSchema.optional(),audioParams:audioParamsSchema.default({introPadding:1,padding:.3,closingPadding:.8,outroPadding:1,bgmVolume:.2,audioVolume:1,suppressSpeech:!1})}),mulmoReferenceSchema=object({url:URLStringSchema,title:string().optional(),description:string().optional(),type:union([_enum([`article`,`paper`,`image`,`video`,`audio`]),string()]).optional().default(`article`)}),mulmoScriptSchema=mulmoPresentationStyleSchema.extend({title:string().optional(),description:string().optional(),references:array(mulmoReferenceSchema).optional(),lang:langSchema.optional().default(`en`),beats:array(mulmoBeatSchema).min(1),imagePath:string().optional(),__test_invalid__:boolean().optional()}).strict(),mulmoStudioBeatSchema=object({id:string().optional().describe(`Unique identifier for the beat.`),hash:string().optional(),duration:number().optional(),startAt:number().optional(),audioDuration:number().optional(),movieDuration:number().optional(),silenceDuration:number().optional(),hasMovieAudio:boolean().optional(),audioFile:string().optional(),imageFile:string().optional(),movieFile:string().optional(),soundEffectFile:string().optional(),lipSyncFile:string().optional(),captionFile:string().optional(),captionFiles:array(object({file:string(),startAt:number(),endAt:number()})).optional(),htmlImageFile:string().optional(),markdown:string().optional(),html:string().optional()}).strict(),mulmoStudioMultiLingualDataSchema=object({multiLingualTexts:multiLingualTextsSchema,cacheKey:string().optional()}),mulmoStudioMultiLingualArraySchema=array(mulmoStudioMultiLingualDataSchema).min(1),mulmoStudioMultiLingualSchema=record(string(),mulmoStudioMultiLingualDataSchema),mulmoStudioMultiLingualFileSchema=object({version:literal(`1.1`),multiLingual:mulmoStudioMultiLingualSchema}),mulmoSessionStateSchema=object({inSession:object({audio:boolean(),image:boolean(),video:boolean(),multiLingual:boolean(),caption:boolean(),pdf:boolean(),markdown:boolean(),html:boolean()}),inBeatSession:object({audio:record(string(),boolean()),image:record(string(),boolean()),movie:record(string(),boolean()),multiLingual:record(string(),boolean()),caption:record(string(),boolean()),html:record(string(),boolean()),imageReference:record(string(),boolean()),soundEffect:record(string(),boolean()),lipSync:record(string(),boolean())})}),mulmoStudioSchema=object({script:mulmoScriptSchema,filename:string(),beats:array(mulmoStudioBeatSchema).min(1)}).strict(),mulmoPromptTemplateSchema=object({title:string(),description:string(),systemPrompt:string(),scriptName:string().optional(),presentationStyle:mulmoPresentationStyleSchema.optional()}).strict(),mulmoPromptTemplateFileSchema=mulmoPromptTemplateSchema.extend({filename:string()}),mulmoStoryboardSceneSchema=object({description:string(),references:array(mulmoReferenceSchema).optional()}).describe(`A detailed description of the content of the scene, not the presentation style`).strict(),mulmoStoryboardSchema=object({title:string(),references:array(mulmoReferenceSchema).optional(),scenes:array(mulmoStoryboardSceneSchema)}).describe(`A storyboard for a presentation, a story, a video, etc.`).strict(),urlsSchema=array(url$1({message:`Invalid URL format`})),mulmoViewerBeatSchema=object({id:string().optional(),text:string().optional(),duration:number().optional(),startTime:number().optional(),endTime:number().optional(),importance:number().optional(),multiLinguals:record(string(),string()).optional(),audioSources:record(string(),string().optional()).optional(),imageSource:string().optional(),videoSource:string().optional(),videoWithAudioSource:string().optional(),htmlImageSource:string().optional(),soundEffectSource:string().optional()}),mulmoViewerDataSchema=object({beats:array(mulmoViewerBeatSchema),bgmSource:string().optional(),bgmFile:string().optional(),title:string().optional(),lang:string().optional()});function parseSSEEventLine(Ph){if(!Ph.startsWith(`data: `))return null;let Fh;try{Fh=JSON.parse(Ph.slice(6))}catch{return null}if(!isRecord(Fh))return null;let Ih=Fh;return Ih.type===`beat_image_done`&&typeof Ih.beatIndex==`number`?{type:`beat_image_done`,beatIndex:Ih.beatIndex}:Ih.type===`beat_audio_done`&&typeof Ih.beatIndex==`number`?{type:`beat_audio_done`,beatIndex:Ih.beatIndex}:Ih.type===`done`&&typeof Ih.moviePath==`string`?{type:`done`,moviePath:Ih.moviePath}:Ih.type===`error`&&typeof Ih.message==`string`?{type:`error`,message:Ih.message}:{type:`unknown`}}function shouldAutoRenderBeat(Ph,Fh,Ih){if(Fh)return!1;let Lh=Ph.image?.type;return typeof Lh==`string`?Ih.includes(Lh):!1}function getMissingCharacterKeys(Ph,Fh,Ih){return Ph.filter(Ph=>!Fh[Ph]&&Ih[Ph]!==`rendering`)}function validateBeatJSON(Ph,Fh){let Ih;try{Ih=JSON.parse(Ph)}catch{return!1}return Fh.safeParse(Ih).success}function extractErrorMessage(Ph){return errorMessage(Ph)}function applyMovieEvent(Ph,Fh){switch(Ph.type){case`beat_image_done`:Fh.onBeatImageDone(Ph.beatIndex);return;case`beat_audio_done`:Fh.onBeatAudioDone(Ph.beatIndex);return;case`done`:Fh.onDone(Ph.moviePath);return;case`error`:throw Error(Ph.message);case`unknown`:return}}async function streamMovieEvents(Ph,Fh){let Ih=Ph.getReader(),Lh=new TextDecoder,Rh=``;for(;;){let{done:Ph,value:zh}=await Ih.read();if(Ph)break;Rh+=Lh.decode(zh,{stream:!0});let Bh=Rh.split(`
|
|
4687
|
-
`);Rh=Bh.pop()??``;for(let Ph of Bh){let Ih=parseSSEEventLine(Ph);Ih&&applyMovieEvent(Ih,Fh)}}}var ACTIVE_SESSION_KEY=Symbol(`activeSession`);function provideActiveSession(Ph){provide(ACTIVE_SESSION_KEY,Ph)}function useActiveSession(){return inject(ACTIVE_SESSION_KEY)}var _hoisted_1$37={class:`h-full bg-white flex flex-col overflow-hidden`},_hoisted_2$35={class:`flex items-start justify-between px-6 py-4 border-b border-gray-100 shrink-0`},_hoisted_3$33={class:`min-w-0 flex-1`},_hoisted_4$29={class:`text-lg font-semibold text-gray-800 truncate`},_hoisted_5$27={key:0,class:`text-sm text-gray-500 mt-0.5 truncate`},_hoisted_6$24={class:`flex items-center gap-3 mt-1 text-xs text-gray-400`},_hoisted_7$22={key:0},_hoisted_8$20={key:1,class:`truncate`},_hoisted_9$19={class:`ml-4 shrink-0 flex gap-2`},_hoisted_10$16=[`href`],_hoisted_11$14=[`disabled`],_hoisted_12$12={key:0,class:`animate-spin w-3 h-3 shrink-0`,viewBox:`0 0 24 24`,fill:`none`},_hoisted_13$10={key:1},_hoisted_14$9={key:0,class:`border-b border-gray-100 shrink-0 px-4 py-3`},_hoisted_15$9={class:`flex items-center justify-between mb-2`},_hoisted_16$8=[`disabled`],_hoisted_17$6={class:`flex gap-3 flex-wrap`},_hoisted_18$5=[`onDragover`,`onDragleave`,`onDrop`],_hoisted_19$5=[`src`,`alt`,`onClick`],_hoisted_20$4={key:1,class:`animate-spin w-4 h-4 text-green-400`,viewBox:`0 0 24 24`,fill:`none`},_hoisted_21$4={key:2,class:`text-xs text-red-400 text-center px-1`},_hoisted_22$4={key:3,class:`text-xs text-gray-300 text-center px-1 leading-tight`},_hoisted_23$3={key:4,class:`absolute bottom-0 inset-x-0 text-center text-xs text-gray-400 bg-white/70 py-0.5 pointer-events-none`},_hoisted_24$2={key:5,class:`absolute inset-0 flex items-center justify-center bg-blue-50/80 pointer-events-none`},_hoisted_25$2=[`disabled`,`onClick`],_hoisted_26$2={key:0,class:`inline-block animate-spin`},_hoisted_27$2={key:1},_hoisted_28$1=[`disabled`,`onClick`],_hoisted_29={key:0,class:`animate-spin w-3 h-3`,viewBox:`0 0 24 24`,fill:`none`},_hoisted_30={key:1},_hoisted_31={class:`text-xs text-gray-600 text-center truncate w-full`},_hoisted_32={class:`flex gap-3 items-stretch`},_hoisted_33=[`onDragover`,`onDragleave`,`onDrop`],_hoisted_34=[`src`,`alt`,`onClick`],_hoisted_35=[`disabled`,`onClick`],_hoisted_36={key:2,class:`w-full aspect-video flex flex-col items-center justify-center gap-1 p-2`},_hoisted_37={key:1,class:`text-xs text-red-400 text-center`},_hoisted_38={key:0,class:`text-xs text-gray-400 text-center italic leading-relaxed px-1`},_hoisted_39={key:1,class:`text-xs text-gray-300`},_hoisted_40={key:3,class:`absolute inset-0 flex items-center justify-center bg-blue-50/80 pointer-events-none`},_hoisted_41={key:4,class:`absolute bottom-0 inset-x-0 text-center text-xs text-gray-400 bg-white/70 py-0.5 pointer-events-none`},_hoisted_42=[`onClick`],_hoisted_43={class:`flex flex-col flex-1 min-w-0 px-2 py-1.5`},_hoisted_44={class:`text-sm text-gray-800 leading-relaxed`},_hoisted_45={class:`flex justify-between mt-auto pt-1`},_hoisted_46={class:`flex items-center gap-1`},_hoisted_47={key:0,class:`animate-spin w-3 h-3 text-green-400`,viewBox:`0 0 24 24`,fill:`none`},_hoisted_48=[`onClick`],_hoisted_49=[`title`],_hoisted_50=[`disabled`,`onClick`],_hoisted_51=[`onClick`],_hoisted_52=[`title`,`onClick`],_hoisted_53={key:0,class:`border-t border-gray-100`},_hoisted_54=[`onUpdate:modelValue`],_hoisted_55={class:`flex items-center justify-end gap-2 px-2 pb-2`},_hoisted_56={key:0,class:`text-xs text-red-600`,role:`alert`},_hoisted_57=[`disabled`,`onClick`],_hoisted_58={key:0,class:`flex items-center justify-center h-32 text-gray-400 text-sm`},_hoisted_59={class:`bottom-bar-wrapper`},_hoisted_60={class:`editor-actions`},_hoisted_61=[`disabled`],_hoisted_62=[`title`],_hoisted_63={class:`material-icons`},_hoisted_64=[`disabled`],_hoisted_65={class:`flex flex-col items-center gap-3`},_hoisted_66=[`src`],_hoisted_67={class:`flex items-center gap-4`},_hoisted_68={key:0,class:`max-w-[80vw] text-center text-white text-2xl leading-relaxed`},_hoisted_69=[`disabled`],View_vue_vue_type_script_setup_true_lang_default$2=defineComponent({__name:`View`,props:{selectedResult:{}},emits:[`updateResult`],setup(Ph,{emit:Fh}){let Ih=Ph,Lh=Fh,Rh=computed(()=>Ih.selectedResult.data),zh=computed(()=>Rh.value?.script??{}),Bh=computed(()=>Rh.value?.filePath??``),Vh=computed(()=>zh.value.beats??[]),Hh=API_ROUTES.mulmoScript.downloadMovie,Uh=reactive({}),Wh=reactive({}),Gh=reactive({}),Kh=reactive({}),qh=reactive({}),Jh=reactive({}),Yh=reactive({}),Xh=reactive({}),Zh=ref(!1),Qh=ref(null),$h=reactive({}),eg=reactive({}),tg=reactive({}),ng=ref(null),rg=ref(null),ig=ref(null),ag=reactive({}),og=reactive({}),sg=reactive({}),cg=reactive({}),lg=reactive({}),ug=computed(()=>Object.values(Uh).some(Ph=>Ph===`rendering`)),dg=computed(()=>{let Ph=zh.value.imageParams?.images??{};return Object.keys(Ph).filter(Fh=>Ph[Fh]?.type===`imagePrompt`)}),fg=useActiveSession(),pg=computed(()=>fg?.value?.id),mg=computed(()=>{let Ph={},Fh=fg?.value?.pendingGenerations??{},Ih=Bh.value;if(!Ih)return Ph;for(let[Lh,Rh]of Object.entries(Fh))Rh.filePath===Ih&&(Ph[Lh]=Rh);return Ph});function hg(Ph){return zh.value.imageParams?.images?.[Ph]?.prompt??``}function gg(Ph){ng.value&&=(ng.value.audio.pause(),null),ig.value={src:Wh[Ph],text:Pg(Ph).text,index:Ph}}let _g=computed(()=>{if(!ig.value)return!1;for(let Ph=ig.value.index-1;Ph>=0;Ph--)if(Wh[Ph])return!0;return!1}),vg=computed(()=>{if(!ig.value)return!1;for(let Ph=ig.value.index+1;Ph<Vh.value.length;Ph++)if(Wh[Ph])return!0;return!1});function yg(Ph){if(!ig.value)return;let Fh=Vh.value.length,Ih=ig.value.index+Ph;for(;Ih>=0&&Ih<Fh;){if(Wh[Ih]){gg(Ih);return}Ih+=Ph}}let bg=ref(),xg=ref(!1),Sg=ref(``),{copied:Cg,copy:wg}=useClipboardCopy(),Tg=computed(()=>({...zh.value,beats:Vh.value.map((Ph,Fh)=>Xh[Fh]??Ph)})),Eg=computed(()=>JSON.stringify(Tg.value,null,2)),Dg=ref(``),Og=computed(()=>Sg.value!==Dg.value),kg=computed(()=>{try{let Ph=JSON.parse(Sg.value);return mulmoScriptSchema.safeParse(Ph).success}catch{return!1}});async function Ag(Ph){if(xg.value=Ph,Ph){let Ph=Eg.value;if(Bh.value){let Fh=await apiGet(API_ROUTES.files.content,{path:Bh.value});Fh.ok&&Fh.data.content&&(Ph=Fh.data.content)}Sg.value=Ph,Dg.value=Ph}}function jg(){bg.value&&(bg.value.open=!1)}async function Mg(){let Ph;try{Ph=JSON.parse(Sg.value)}catch(Ph){alert(extractErrorMessage(Ph));return}let Fh=await apiPost(API_ROUTES.mulmoScript.updateScript,{filePath:Bh.value,script:Ph});if(!Fh.ok){alert(Fh.error||`Update failed`);return}Lh(`updateResult`,{...Ih.selectedResult,data:{...Ih.selectedResult.data,script:Ph}}),bg.value&&(bg.value.open=!1),await t_()}async function Ng(){await wg(Eg.value)}function Pg(Ph){return Xh[Ph]??Vh.value[Ph]??{}}function Fg(Ph){Kh[Ph]||(qh[Ph]=JSON.stringify(Pg(Ph),null,2),delete Jh[Ph]),Kh[Ph]=!Kh[Ph]}function Ig(Ph){return validateBeatJSON(qh[Ph]??``,mulmoBeatSchema)}async function Lg(Ph){let Fh;try{Fh=JSON.parse(qh[Ph])}catch(Fh){Jh[Ph]=`Invalid JSON: ${errorMessage(Fh)}`;return}let Ih=JSON.stringify(Pg(Ph).image);delete Jh[Ph],Yh[Ph]=!0;let Lh=await apiPost(API_ROUTES.mulmoScript.updateBeat,{filePath:Bh.value,beatIndex:Ph,beat:Fh});if(delete Yh[Ph],!Lh.ok){Jh[Ph]=`Save failed: ${Lh.error}`;return}Xh[Ph]=Fh,Kh[Ph]=!1,JSON.stringify(Fh.image)!==Ih&&(delete Wh[Ph],Rg(Ph))}async function Rg(Ph){Uh[Ph]=`rendering`;let Fh=await apiPost(API_ROUTES.mulmoScript.renderBeat,{filePath:Bh.value,beatIndex:Ph,chatSessionId:pg.value});if(!Fh.ok){Gh[Ph]=Fh.error||`Render failed`,Uh[Ph]=`error`;return}if(Fh.data.error){Gh[Ph]=Fh.data.error,Uh[Ph]=`error`;return}Wh[Ph]=Fh.data.image??``,Uh[Ph]=`done`,Qg()}async function zg(Ph){delete Wh[Ph],Uh[Ph]=`rendering`;let Fh=await apiPost(API_ROUTES.mulmoScript.renderBeat,{filePath:Bh.value,beatIndex:Ph,force:!0,chatSessionId:pg.value});if(!Fh.ok){Gh[Ph]=Fh.error||`Render failed`,Uh[Ph]=`error`;return}if(Fh.data.error){Gh[Ph]=Fh.data.error,Uh[Ph]=`error`;return}Wh[Ph]=Fh.data.image??``,Uh[Ph]=`done`}async function Bg(Ph){let Fh=await apiGet(API_ROUTES.mulmoScript.beatImage,{filePath:Bh.value,beatIndex:String(Ph)});Fh.ok&&Fh.data.image&&(Wh[Ph]=Fh.data.image,Uh[Ph]=`done`)}async function Vg(Ph){let Fh=await apiGet(API_ROUTES.mulmoScript.beatAudio,{filePath:Bh.value,beatIndex:String(Ph)});Fh.ok&&Fh.data.audio&&($h[Ph]=Fh.data.audio,eg[Ph]=`done`)}async function Hg(Ph){eg[Ph]=`generating`,delete tg[Ph];let Fh=await apiPost(API_ROUTES.mulmoScript.generateBeatAudio,{filePath:Bh.value,beatIndex:Ph,chatSessionId:pg.value});if(!Fh.ok){tg[Ph]=Fh.error||`Audio generation failed`,eg[Ph]=`error`;return}if(Fh.data.error){tg[Ph]=Fh.data.error,eg[Ph]=`error`;return}$h[Ph]=Fh.data.audio??``,eg[Ph]=`done`}function Ug(Ph){if(ng.value){ng.value.audio.pause();let Fh=ng.value.index;if(ng.value=null,Fh===Ph)return}let Fh=$h[Ph];if(!Fh)return;let Ih=new Audio(Fh);ng.value={index:Ph,audio:Ih},Ih.addEventListener(`ended`,()=>{if(ng.value?.index===Ph&&(ng.value=null,ig.value?.index===Ph)){yg(1);let Fh=ig.value?.index;Fh!==void 0&&Fh!==Ph&&$h[Fh]&&Ug(Fh)}}),Ih.play()}function Wg(Ph,Fh){Ph.dataTransfer?.types.includes(`Files`)&&(Ph.preventDefault(),lg[Fh]=!0)}function Gg(Ph){lg[Ph]=!1}async function Kg(Ph,Fh){Ph.preventDefault(),lg[Fh]=!1;let Ih=Ph.dataTransfer?.files[0];if(!Ih||!Ih.type.startsWith(`image/`))return;Uh[Fh]=`rendering`,delete Gh[Fh];let Lh;try{Lh=await new Promise((Ph,Fh)=>{let Lh=new FileReader;Lh.onload=()=>Ph(Lh.result),Lh.onerror=Fh,Lh.readAsDataURL(Ih)})}catch(Ph){Gh[Fh]=errorMessage(Ph),Uh[Fh]=`error`;return}let Rh=await apiPost(API_ROUTES.mulmoScript.uploadBeatImage,{filePath:Bh.value,beatIndex:Fh,imageData:Lh});if(!Rh.ok){Gh[Fh]=Rh.error||`Upload failed`,Uh[Fh]=`error`;return}if(Rh.data.error){Gh[Fh]=Rh.data.error,Uh[Fh]=`error`;return}Wh[Fh]=Rh.data.image??``,Uh[Fh]=`done`}function qg(Ph,Fh){Ph.dataTransfer?.types.includes(`Files`)&&(Ph.preventDefault(),cg[Fh]=!0)}function Jg(Ph){cg[Ph]=!1}async function Yg(Ph,Fh){Ph.preventDefault(),cg[Fh]=!1;let Ih=Ph.dataTransfer?.files[0];if(!Ih||!Ih.type.startsWith(`image/`))return;ag[Fh]=`rendering`,delete sg[Fh];let Lh;try{Lh=await new Promise((Ph,Fh)=>{let Lh=new FileReader;Lh.onload=()=>Ph(Lh.result),Lh.onerror=Fh,Lh.readAsDataURL(Ih)})}catch(Ph){sg[Fh]=errorMessage(Ph),ag[Fh]=`error`;return}let Rh=await apiPost(API_ROUTES.mulmoScript.uploadCharacterImage,{filePath:Bh.value,key:Fh,imageData:Lh});if(!Rh.ok){sg[Fh]=Rh.error||`Upload failed`,ag[Fh]=`error`;return}if(Rh.data.error){sg[Fh]=Rh.data.error,ag[Fh]=`error`;return}og[Fh]=Rh.data.image??``,ag[Fh]=`done`}function Xg(Ph){ng.value&&=(ng.value.audio.pause(),null),ig.value={src:og[Ph],text:Ph,index:-1,isCharacter:!0}}async function Zg(Ph){let Fh=await apiGet(API_ROUTES.mulmoScript.characterImage,{filePath:Bh.value,key:Ph});Fh.ok&&Fh.data.image&&(og[Ph]=Fh.data.image,ag[Ph]=`done`)}function Qg(){getMissingCharacterKeys(dg.value,og,ag).forEach(Ph=>Zg(Ph))}async function $g(Ph,Fh){ag[Ph]=`rendering`,delete sg[Ph];let Ih=await apiPost(API_ROUTES.mulmoScript.renderCharacter,{filePath:Bh.value,key:Ph,force:Fh,chatSessionId:pg.value});if(!Ih.ok){sg[Ph]=Ih.error||`Render failed`,ag[Ph]=`error`;return}if(Ih.data.error){sg[Ph]=Ih.data.error,ag[Ph]=`error`;return}og[Ph]=Ih.data.image??``,ag[Ph]=`done`}async function e_(){await Promise.all(dg.value.filter(Ph=>ag[Ph]!==`rendering`).map(Ph=>$g(Ph,!1)))}async function t_(){rg.value&&(rg.value.scrollTop=0),Object.keys(Uh).forEach(Ph=>delete Uh[+Ph]),Object.keys(Wh).forEach(Ph=>delete Wh[+Ph]),Object.keys(Gh).forEach(Ph=>delete Gh[+Ph]),Object.keys(Kh).forEach(Ph=>delete Kh[+Ph]),Object.keys(qh).forEach(Ph=>delete qh[+Ph]),Object.keys(Jh).forEach(Ph=>delete Jh[+Ph]),Object.keys(Yh).forEach(Ph=>delete Yh[+Ph]),Object.keys(Xh).forEach(Ph=>delete Xh[+Ph]),Object.keys($h).forEach(Ph=>delete $h[+Ph]),Object.keys(eg).forEach(Ph=>delete eg[+Ph]),Object.keys(tg).forEach(Ph=>delete tg[+Ph]),Object.keys(ag).forEach(Ph=>delete ag[Ph]),Object.keys(og).forEach(Ph=>delete og[Ph]),Object.keys(sg).forEach(Ph=>delete sg[Ph]),Object.keys(lg).forEach(Ph=>delete lg[+Ph]),Qh.value=null,bg.value&&(bg.value.open=!1);let Ph=[`textSlide`,`markdown`,`chart`,`mermaid`,`html_tailwind`],Fh=dg.value.length>0;if(Vh.value.forEach((Ih,Lh)=>{shouldAutoRenderBeat(Ih,Fh,Ph)?Rg(Lh):Ih.imagePrompt&&Bg(Lh),Ih.text&&Vg(Lh)}),dg.value.forEach(Ph=>Zg(Ph)),Bh.value){let Ph=await apiGet(API_ROUTES.mulmoScript.movieStatus,{filePath:Bh.value});Ph.ok&&Ph.data.moviePath&&(Qh.value=Ph.data.moviePath)}for(let Ph of Object.values(mg.value))n_(Ph)}onMounted(t_),watch(()=>Ih.selectedResult,t_),watch(mg,(Ph,Fh={})=>{for(let[Ih,Lh]of Object.entries(Ph))Ih in Fh||n_(Lh);for(let[Ih,Lh]of Object.entries(Fh))Ih in Ph||r_(Lh).catch(Ph=>{console.error(`[presentMulmoScript] reload on finish failed:`,Ph)})});function n_(Ph){if(Ph.kind===GENERATION_KINDS.beatImage){let Fh=Number(Ph.key);Wh[Fh]||(Uh[Fh]=`rendering`)}else if(Ph.kind===GENERATION_KINDS.beatAudio){let Fh=Number(Ph.key);$h[Fh]||(eg[Fh]=`generating`)}else Ph.kind===GENERATION_KINDS.characterImage?og[Ph.key]||(ag[Ph.key]=`rendering`):Ph.kind===GENERATION_KINDS.movie&&(Zh.value=!0)}async function r_(Ph){if(Ph.kind===GENERATION_KINDS.beatImage){let Fh=Number(Ph.key);await Bg(Fh),Uh[Fh]===`rendering`&&delete Uh[Fh]}else if(Ph.kind===GENERATION_KINDS.beatAudio){let Fh=Number(Ph.key);await Vg(Fh),eg[Fh]===`generating`&&delete eg[Fh]}else Ph.kind===GENERATION_KINDS.characterImage?(await Zg(Ph.key),ag[Ph.key]===`rendering`&&delete ag[Ph.key]):Ph.kind===GENERATION_KINDS.movie&&(Zh.value=!1,await i_())}async function i_(){if(!Bh.value)return;let Ph=await apiGet(API_ROUTES.mulmoScript.movieStatus,{filePath:Bh.value});Ph.ok&&Ph.data.moviePath&&(Qh.value=Ph.data.moviePath)}async function a_(){Zh.value=!0;try{let Ph=await apiFetchRaw(API_ROUTES.mulmoScript.generateMovie,{method:`POST`,body:JSON.stringify({filePath:Bh.value,chatSessionId:pg.value}),headers:{"Content-Type":`application/json`}});if(!Ph.ok||!Ph.body)throw Error(`Generation failed`);await streamMovieEvents(Ph.body,{onBeatImageDone:Ph=>{Bg(Ph),Qg()},onBeatAudioDone:Ph=>Vg(Ph),onDone:Ph=>{Qh.value=Ph}})}catch(Ph){alert(extractErrorMessage(Ph))}finally{Zh.value=!1}}return(Ph,Fh)=>(openBlock(),createElementBlock(`div`,_hoisted_1$37,[createBaseVNode(`div`,_hoisted_2$35,[createBaseVNode(`div`,_hoisted_3$33,[createBaseVNode(`h2`,_hoisted_4$29,toDisplayString(zh.value.title||`Untitled Script`),1),zh.value.description?(openBlock(),createElementBlock(`p`,_hoisted_5$27,toDisplayString(zh.value.description),1)):createCommentVNode(``,!0),createBaseVNode(`div`,_hoisted_6$24,[createBaseVNode(`span`,null,toDisplayString(Vh.value.length)+` beat`+toDisplayString(Vh.value.length===1?``:`s`),1),zh.value.lang?(openBlock(),createElementBlock(`span`,_hoisted_7$22,toDisplayString(zh.value.lang),1)):createCommentVNode(``,!0),Bh.value?(openBlock(),createElementBlock(`span`,_hoisted_8$20,toDisplayString(Bh.value),1)):createCommentVNode(``,!0)])]),createBaseVNode(`div`,_hoisted_9$19,[Qh.value&&!Zh.value?(openBlock(),createElementBlock(`a`,{key:0,href:`${unref(Hh)}?moviePath=${encodeURIComponent(Qh.value)}`,download:``,class:`px-3 py-1 text-xs rounded-full border transition-colors border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center justify-center gap-1`},[...Fh[7]||=[createBaseVNode(`span`,{class:`material-icons text-sm leading-none`},`download`,-1),createBaseVNode(`span`,null,`Movie`,-1)]],8,_hoisted_10$16)):createCommentVNode(``,!0),createBaseVNode(`button`,{class:`px-3 py-1 text-xs rounded-full border transition-colors border-gray-200 text-gray-500 hover:bg-gray-50 disabled:opacity-40 flex items-center justify-center gap-1`,disabled:Zh.value,onClick:a_},[Zh.value?(openBlock(),createElementBlock(`svg`,_hoisted_12$12,[...Fh[8]||=[createBaseVNode(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`},null,-1),createBaseVNode(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`},null,-1)]])):createCommentVNode(``,!0),Zh.value?(openBlock(),createElementBlock(`span`,_hoisted_13$10,`Generating…`)):(openBlock(),createElementBlock(Fragment,{key:2},[Fh[9]||=createBaseVNode(`span`,{class:`material-icons text-sm leading-none`},`refresh`,-1),Fh[10]||=createBaseVNode(`span`,null,`Movie`,-1)],64))],8,_hoisted_11$14)])]),dg.value.length>0?(openBlock(),createElementBlock(`div`,_hoisted_14$9,[createBaseVNode(`div`,_hoisted_15$9,[Fh[11]||=createBaseVNode(`span`,{class:`text-xs font-semibold text-gray-500 uppercase tracking-wide`},`Characters`,-1),createBaseVNode(`button`,{class:`px-2 py-0.5 text-xs rounded border border-gray-300 text-gray-500 hover:bg-gray-50 disabled:opacity-50`,disabled:Zh.value||ug.value||dg.value.every(Ph=>ag[Ph]===`rendering`),onClick:e_},` Generate All `,8,_hoisted_16$8)]),createBaseVNode(`div`,_hoisted_17$6,[(openBlock(!0),createElementBlock(Fragment,null,renderList(dg.value,Ph=>(openBlock(),createElementBlock(`div`,{key:Ph,class:`flex flex-col items-center gap-1 w-36`},[createBaseVNode(`div`,{class:normalizeClass([`relative w-36 h-36 rounded-lg border overflow-hidden bg-gray-50 flex items-center justify-center transition-colors`,cg[Ph]?`border-blue-400 bg-blue-50`:`border-gray-200`]),onDragover:Fh=>qg(Fh,Ph),onDragleave:Fh=>Jg(Ph),onDrop:Fh=>Yg(Fh,Ph)},[og[Ph]?(openBlock(),createElementBlock(`img`,{key:0,src:og[Ph],class:`w-full h-full object-cover cursor-zoom-in`,alt:Ph,onClick:Fh=>Xg(Ph)},null,8,_hoisted_19$5)):ag[Ph]===`rendering`?(openBlock(),createElementBlock(`svg`,_hoisted_20$4,[...Fh[12]||=[createBaseVNode(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`},null,-1),createBaseVNode(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`},null,-1)]])):ag[Ph]===`error`?(openBlock(),createElementBlock(`span`,_hoisted_21$4,toDisplayString(sg[Ph]),1)):(openBlock(),createElementBlock(`span`,_hoisted_22$4,toDisplayString(hg(Ph)),1)),cg[Ph]?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_23$3,` or drop image `)),cg[Ph]?(openBlock(),createElementBlock(`div`,_hoisted_24$2,[...Fh[13]||=[createBaseVNode(`span`,{class:`text-xs text-blue-500 font-medium`},`Drop`,-1)]])):createCommentVNode(``,!0),og[Ph]&&ag[Ph]!==`rendering`?(openBlock(),createElementBlock(`button`,{key:6,class:normalizeClass([`absolute top-0.5 right-0.5 px-1 py-0.5 text-xs rounded border bg-white`,Zh.value||ug.value?`border-yellow-400 text-yellow-500 cursor-not-allowed`:`border-gray-400 text-gray-600 hover:bg-gray-50`]),disabled:Zh.value||ug.value,onClick:withModifiers(Fh=>$g(Ph,!0),[`stop`])},[Zh.value||ug.value?(openBlock(),createElementBlock(`span`,_hoisted_26$2,`↺`)):(openBlock(),createElementBlock(`span`,_hoisted_27$2,`↺`))],10,_hoisted_25$2)):!og[Ph]&&ag[Ph]!==`rendering`?(openBlock(),createElementBlock(`button`,{key:7,class:normalizeClass([`absolute top-0.5 right-0.5 px-1 py-0.5 text-xs rounded border bg-white`,Zh.value||ug.value?`border-yellow-400 text-yellow-500 cursor-not-allowed`:`border-blue-400 text-blue-600 hover:bg-blue-50`]),disabled:Zh.value||ug.value,onClick:withModifiers(Fh=>$g(Ph,!1),[`stop`])},[Zh.value||ug.value?(openBlock(),createElementBlock(`svg`,_hoisted_29,[...Fh[14]||=[createBaseVNode(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`},null,-1),createBaseVNode(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`},null,-1)]])):(openBlock(),createElementBlock(`span`,_hoisted_30,`Gen`))],10,_hoisted_28$1)):createCommentVNode(``,!0)],42,_hoisted_18$5),createBaseVNode(`span`,_hoisted_31,toDisplayString(Ph),1)]))),128))])])):createCommentVNode(``,!0),createBaseVNode(`div`,{ref_key:`beatListEl`,ref:rg,class:`flex-1 overflow-y-auto p-2 space-y-1.5`},[(openBlock(!0),createElementBlock(Fragment,null,renderList(Vh.value,(Ph,Ih)=>(openBlock(),createElementBlock(`div`,{key:Ih,class:`rounded-lg border border-gray-200 overflow-hidden`},[createBaseVNode(`div`,_hoisted_32,[createBaseVNode(`div`,{class:normalizeClass([`relative shrink-0 w-[45%] overflow-hidden bg-gray-50 transition-colors`,lg[Ih]?`bg-blue-50`:``]),onDragover:Ph=>Wg(Ph,Ih),onDragleave:Ph=>Gg(Ih),onDrop:Ph=>Kg(Ph,Ih)},[Wh[Ih]?(openBlock(),createElementBlock(`img`,{key:0,src:Wh[Ih],class:`w-full object-contain cursor-zoom-in`,alt:`Beat ${Ih+1}`,onClick:Ph=>gg(Ih)},null,8,_hoisted_34)):createCommentVNode(``,!0),Wh[Ih]&&Uh[Ih]!==`rendering`?(openBlock(),createElementBlock(`button`,{key:1,class:`absolute top-1.5 right-1.5 flex items-center gap-1 px-2 py-0.5 text-xs rounded border border-gray-400 text-gray-600 bg-white hover:bg-gray-50 disabled:opacity-60 disabled:cursor-not-allowed`,disabled:Zh.value,onClick:withModifiers(Ph=>zg(Ih),[`stop`])},` ↺ `,8,_hoisted_35)):Wh[Ih]?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_36,[Uh[Ih]===`rendering`||Zh.value&&!Wh[Ih]&&Pg(Ih).imagePrompt?(openBlock(),createElementBlock(Fragment,{key:0},[Fh[15]||=createBaseVNode(`svg`,{class:`animate-spin w-4 h-4 text-green-400`,viewBox:`0 0 24 24`,fill:`none`},[createBaseVNode(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`}),createBaseVNode(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`})],-1),Fh[16]||=createBaseVNode(`span`,{class:`text-xs text-green-500`},`Rendering…`,-1)],64)):Uh[Ih]===`error`?(openBlock(),createElementBlock(`span`,_hoisted_37,toDisplayString(Gh[Ih]),1)):(openBlock(),createElementBlock(Fragment,{key:2},[Pg(Ih).imagePrompt?(openBlock(),createElementBlock(`span`,_hoisted_38,toDisplayString(Pg(Ih).imagePrompt),1)):(openBlock(),createElementBlock(`span`,_hoisted_39,toDisplayString(Ph.image?.type??`—`),1))],64))])),lg[Ih]?(openBlock(),createElementBlock(`div`,_hoisted_40,[...Fh[17]||=[createBaseVNode(`span`,{class:`text-xs text-blue-500 font-medium`},`Drop`,-1)]])):!Wh[Ih]&&Uh[Ih]!==`rendering`?(openBlock(),createElementBlock(`div`,_hoisted_41,` or drop image `)):createCommentVNode(``,!0),Pg(Ih).imagePrompt&&!Wh[Ih]&&Uh[Ih]!==`rendering`&&!Zh.value?(openBlock(),createElementBlock(`button`,{key:5,class:`absolute top-1.5 right-1.5 flex items-center gap-1 px-2 py-0.5 text-xs rounded border border-blue-400 text-blue-600 bg-white hover:bg-blue-50`,onClick:Ph=>Rg(Ih)},` Generate `,8,_hoisted_42)):createCommentVNode(``,!0)],42,_hoisted_33),createBaseVNode(`div`,_hoisted_43,[createBaseVNode(`span`,_hoisted_44,toDisplayString(Pg(Ih).text),1),createBaseVNode(`div`,_hoisted_45,[createBaseVNode(`div`,_hoisted_46,[eg[Ih]===`generating`||Zh.value&&!$h[Ih]&&Pg(Ih).text?(openBlock(),createElementBlock(`svg`,_hoisted_47,[...Fh[18]||=[createBaseVNode(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`},null,-1),createBaseVNode(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`},null,-1)]])):$h[Ih]?(openBlock(),createElementBlock(`button`,{key:1,class:normalizeClass([`text-xs px-2 py-0.5 rounded border`,ng.value?.index===Ih?`border-red-400 text-red-600 hover:bg-red-50`:`border-green-400 text-green-600 hover:bg-green-50`]),onClick:Ph=>Ug(Ih)},toDisplayString(ng.value?.index===Ih?`■ Stop`:`▶ Play`),11,_hoisted_48)):tg[Ih]?(openBlock(),createElementBlock(Fragment,{key:2},[createBaseVNode(`span`,{class:`text-xs text-red-400`,title:tg[Ih]},`⚠ Error`,8,_hoisted_49),Pg(Ih).text?(openBlock(),createElementBlock(`button`,{key:0,class:`text-xs px-2 py-0.5 rounded border border-gray-300 text-gray-500 hover:bg-gray-50 disabled:opacity-50`,disabled:Zh.value,onClick:Ph=>Hg(Ih)},` ↺ `,8,_hoisted_50)):createCommentVNode(``,!0)],64)):Pg(Ih).text?(openBlock(),createElementBlock(`button`,{key:3,class:`text-xs px-2 py-0.5 rounded border border-gray-300 text-gray-500 hover:bg-gray-50`,onClick:Ph=>Hg(Ih)},` ♪ Generate `,8,_hoisted_51)):createCommentVNode(``,!0)]),createBaseVNode(`button`,{class:`text-gray-400 hover:text-gray-600`,title:Kh[Ih]?`Hide source`:`Show source`,onClick:Ph=>Fg(Ih)},[...Fh[19]||=[createBaseVNode(`svg`,{xmlns:`http://www.w3.org/2000/svg`,class:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[createBaseVNode(`polyline`,{points:`16 18 22 12 16 6`}),createBaseVNode(`polyline`,{points:`8 6 2 12 8 18`})],-1)]],8,_hoisted_52)])])]),Kh[Ih]?(openBlock(),createElementBlock(`div`,_hoisted_53,[withDirectives(createBaseVNode(`textarea`,{"onUpdate:modelValue":Ph=>qh[Ih]=Ph,class:normalizeClass([`w-full text-xs text-gray-600 bg-gray-50 p-2 font-mono resize-none`,Ig(Ih)?`outline-none`:`outline outline-2 outline-red-400`]),rows:`8`,spellcheck:`false`},null,10,_hoisted_54),[[vModelText,qh[Ih]]]),createBaseVNode(`div`,_hoisted_55,[Jh[Ih]?(openBlock(),createElementBlock(`span`,_hoisted_56,`⚠ `+toDisplayString(Jh[Ih]),1)):createCommentVNode(``,!0),createBaseVNode(`button`,{class:normalizeClass([`px-2 py-1 text-xs rounded border`,Ig(Ih)&&!Yh[Ih]?`border-blue-400 text-blue-600 hover:bg-blue-50 cursor-pointer`:`border-gray-200 text-gray-300 cursor-not-allowed`]),disabled:!Ig(Ih)||!!Yh[Ih],onClick:Ph=>Lg(Ih)},toDisplayString(Yh[Ih]?`Saving…`:`Update`),11,_hoisted_57)])])):createCommentVNode(``,!0)]))),128)),Vh.value.length===0?(openBlock(),createElementBlock(`div`,_hoisted_58,`No beats found in script`)):createCommentVNode(``,!0)],512),createBaseVNode(`div`,_hoisted_59,[createBaseVNode(`details`,{ref_key:`sourceDetails`,ref:bg,class:`script-source`,onToggle:Fh[1]||=Ph=>Ag(Ph.target.open)},[Fh[20]||=createBaseVNode(`summary`,null,`Edit Script Source`,-1),withDirectives(createBaseVNode(`textarea`,{"onUpdate:modelValue":Fh[0]||=Ph=>Sg.value=Ph,class:normalizeClass([`script-editor`,{"script-editor-invalid":Og.value&&!kg.value}]),spellcheck:`false`},null,2),[[vModelText,Sg.value]]),createBaseVNode(`div`,_hoisted_60,[createBaseVNode(`button`,{class:`apply-btn`,disabled:!Og.value||!kg.value,onClick:Mg},`Apply Changes`,8,_hoisted_61),createBaseVNode(`button`,{class:`cancel-btn`,onClick:jg},`Cancel`)])],544),withDirectives(createBaseVNode(`button`,{class:`copy-btn`,title:unref(Cg)?`Copied!`:`Copy`,onClick:Ng},[createBaseVNode(`span`,_hoisted_63,toDisplayString(unref(Cg)?`check`:`content_copy`),1)],8,_hoisted_62),[[vShow,!xg.value]])]),ig.value?(openBlock(),createElementBlock(`div`,{key:1,class:`fixed inset-0 z-50 flex items-center justify-center bg-black/80`,onClick:Fh[6]||=Ph=>ig.value=null},[createBaseVNode(`div`,{class:`flex items-center gap-4`,onClick:Fh[5]||=withModifiers(()=>{},[`stop`])},[ig.value.isCharacter?createCommentVNode(``,!0):(openBlock(),createElementBlock(`button`,{key:0,class:`text-white/60 hover:text-white disabled:opacity-20 text-4xl leading-none`,disabled:!_g.value,onClick:Fh[2]||=Ph=>yg(-1)},` ‹ `,8,_hoisted_64)),createBaseVNode(`div`,_hoisted_65,[createBaseVNode(`img`,{src:ig.value.src,class:`max-w-[80vw] max-h-[80vh] object-contain rounded shadow-2xl`},null,8,_hoisted_66),createBaseVNode(`div`,_hoisted_67,[ig.value.text?(openBlock(),createElementBlock(`p`,_hoisted_68,toDisplayString(ig.value.text),1)):createCommentVNode(``,!0),$h[ig.value.index]?(openBlock(),createElementBlock(`button`,{key:1,class:normalizeClass([`shrink-0 text-sm px-3 py-1 rounded border`,ng.value?.index===ig.value.index?`border-red-400 text-red-400 hover:bg-red-400/20`:`border-white/60 text-white/60 hover:bg-white/20`]),onClick:Fh[3]||=Ph=>Ug(ig.value.index)},toDisplayString(ng.value?.index===ig.value.index?`■ Stop`:`▶ Play`),3)):createCommentVNode(``,!0)])]),ig.value.isCharacter?createCommentVNode(``,!0):(openBlock(),createElementBlock(`button`,{key:1,class:`text-white/60 hover:text-white disabled:opacity-20 text-4xl leading-none`,disabled:!vg.value,onClick:Fh[4]||=Ph=>yg(1)},` › `,8,_hoisted_69))])])):createCommentVNode(``,!0)]))}}),View_default$2=_plugin_vue_export_helper_default(View_vue_vue_type_script_setup_true_lang_default$2,[[`__scopeId`,`data-v-9fa2760c`]]),_hoisted_1$36={class:`text-sm`},_hoisted_2$34={class:`font-medium text-gray-700 truncate mb-1`},_hoisted_3$32={key:0,class:`text-xs text-gray-500 leading-relaxed`},Preview_vue_vue_type_script_setup_true_lang_default$2=defineComponent({__name:`Preview`,props:{result:{}},setup(Ph){let Fh=Ph,Ih=computed(()=>Fh.result.data),Lh=computed(()=>Ih.value?.script),Rh=computed(()=>Lh.value?.title||Ih.value?.filePath?.split(`/`).pop()||`MulmoScript`),zh=computed(()=>Lh.value?.description);return(Ph,Fh)=>(openBlock(),createElementBlock(`div`,_hoisted_1$36,[createBaseVNode(`div`,_hoisted_2$34,toDisplayString(Rh.value),1),zh.value?(openBlock(),createElementBlock(`div`,_hoisted_3$32,toDisplayString(zh.value),1)):createCommentVNode(``,!0)]))}}),Preview_default$2=Preview_vue_vue_type_script_setup_true_lang_default$2,presentMulmoScriptPlugin={toolDefinition:toolDefinition$2,async execute(Ph,Fh){let Ih=await apiPost(API_ROUTES.mulmoScript.save,Fh);return Ih.ok?{...Ih.data,toolName:TOOL_NAME$2,uuid:crypto.randomUUID()}:{toolName:TOOL_NAME$2,uuid:crypto.randomUUID(),message:Ih.error}},isEnabled:()=>!0,generatingMessage:`Generating MulmoScript storyboard…`,viewComponent:View_default$2,previewComponent:Preview_default$2},TOOL_NAME$1=`presentHtml`,toolDefinition$1={type:`function`,name:TOOL_NAME$1,description:`Save and present a complete, self-contained HTML page in the canvas. Claude generates the HTML and calls this tool to display it. Use for rich interactive output, dashboards, custom layouts, or any content best expressed as HTML.`,parameters:{type:`object`,properties:{html:{type:`string`,description:`Complete, self-contained HTML string. All CSS and JavaScript must be inline or loaded via CDN. Must be a full document (include <!DOCTYPE html> and <html>/<body> tags).`},title:{type:`string`,description:`Short label shown in the preview sidebar.`}},required:[`html`]}},_hoisted_1$35={class:`h-full flex flex-col overflow-hidden`},_hoisted_2$33={class:`px-4 py-2 border-b border-gray-100 shrink-0 flex items-center justify-between`},_hoisted_3$31={class:`text-sm font-medium text-gray-700 truncate`},_hoisted_4$28={class:`flex items-center gap-2`},_hoisted_5$26={key:0,class:`border-b border-gray-100 shrink-0`},_hoisted_6$23=[`value`],_hoisted_7$21=[`srcdoc`],PRINT_STYLE=`<style>@media print {
|
|
4687
|
+
`);Rh=Bh.pop()??``;for(let Ph of Bh){let Ih=parseSSEEventLine(Ph);Ih&&applyMovieEvent(Ih,Fh)}}}var ACTIVE_SESSION_KEY=Symbol(`activeSession`);function provideActiveSession(Ph){provide(ACTIVE_SESSION_KEY,Ph)}function useActiveSession(){return inject(ACTIVE_SESSION_KEY)}var _hoisted_1$37={class:`h-full bg-white flex flex-col overflow-hidden`},_hoisted_2$35={class:`flex items-start justify-between px-6 py-4 border-b border-gray-100 shrink-0`},_hoisted_3$33={class:`min-w-0 flex-1`},_hoisted_4$29={class:`text-lg font-semibold text-gray-800 truncate`},_hoisted_5$27={key:0,class:`text-sm text-gray-500 mt-0.5 truncate`},_hoisted_6$24={class:`flex items-center gap-3 mt-1 text-xs text-gray-400`},_hoisted_7$22={key:0},_hoisted_8$20={key:1,class:`truncate`},_hoisted_9$19={class:`ml-4 shrink-0 flex gap-2`},_hoisted_10$16=[`href`],_hoisted_11$14=[`disabled`],_hoisted_12$12={key:0,class:`animate-spin w-3 h-3 shrink-0`,viewBox:`0 0 24 24`,fill:`none`},_hoisted_13$10={key:1},_hoisted_14$9={key:0,class:`border-b border-gray-100 shrink-0 px-4 py-3`},_hoisted_15$9={class:`flex items-center justify-between mb-2`},_hoisted_16$8=[`disabled`],_hoisted_17$6={class:`flex gap-3 flex-wrap`},_hoisted_18$5=[`onDragover`,`onDragleave`,`onDrop`],_hoisted_19$5=[`src`,`alt`,`onClick`],_hoisted_20$4={key:1,class:`animate-spin w-4 h-4 text-green-400`,viewBox:`0 0 24 24`,fill:`none`},_hoisted_21$4={key:2,class:`text-xs text-red-400 text-center px-1`},_hoisted_22$4={key:3,class:`text-xs text-gray-300 text-center px-1 leading-tight`},_hoisted_23$3={key:4,class:`absolute bottom-0 inset-x-0 text-center text-xs text-gray-400 bg-white/70 py-0.5 pointer-events-none`},_hoisted_24$2={key:5,class:`absolute inset-0 flex items-center justify-center bg-blue-50/80 pointer-events-none`},_hoisted_25$2=[`disabled`,`onClick`],_hoisted_26$2={key:0,class:`inline-block animate-spin`},_hoisted_27$2={key:1},_hoisted_28$1=[`disabled`,`onClick`],_hoisted_29={key:0,class:`animate-spin w-3 h-3`,viewBox:`0 0 24 24`,fill:`none`},_hoisted_30={key:1},_hoisted_31={class:`text-xs text-gray-600 text-center truncate w-full`},_hoisted_32={class:`flex gap-3 items-stretch`},_hoisted_33=[`onDragover`,`onDragleave`,`onDrop`],_hoisted_34=[`src`,`alt`,`onClick`],_hoisted_35=[`disabled`,`onClick`],_hoisted_36={key:2,class:`w-full aspect-video flex flex-col items-center justify-center gap-1 p-2`},_hoisted_37={key:1,class:`text-xs text-red-400 text-center`},_hoisted_38={key:0,class:`text-xs text-gray-400 text-center italic leading-relaxed px-1`},_hoisted_39={key:1,class:`text-xs text-gray-300`},_hoisted_40={key:3,class:`absolute inset-0 flex items-center justify-center bg-blue-50/80 pointer-events-none`},_hoisted_41={key:4,class:`absolute bottom-0 inset-x-0 text-center text-xs text-gray-400 bg-white/70 py-0.5 pointer-events-none`},_hoisted_42=[`onClick`],_hoisted_43={class:`flex flex-col flex-1 min-w-0 px-2 py-1.5`},_hoisted_44={class:`text-sm text-gray-800 leading-relaxed`},_hoisted_45={class:`flex justify-between mt-auto pt-1`},_hoisted_46={class:`flex items-center gap-1`},_hoisted_47={key:0,class:`animate-spin w-3 h-3 text-green-400`,viewBox:`0 0 24 24`,fill:`none`},_hoisted_48=[`onClick`],_hoisted_49=[`title`],_hoisted_50=[`disabled`,`onClick`],_hoisted_51=[`onClick`],_hoisted_52=[`title`,`onClick`],_hoisted_53={key:0,class:`border-t border-gray-100`},_hoisted_54=[`onUpdate:modelValue`],_hoisted_55={class:`flex items-center justify-end gap-2 px-2 pb-2`},_hoisted_56={key:0,class:`text-xs text-red-600`,role:`alert`},_hoisted_57=[`disabled`,`onClick`],_hoisted_58={key:0,class:`flex items-center justify-center h-32 text-gray-400 text-sm`},_hoisted_59={class:`bottom-bar-wrapper`},_hoisted_60={class:`editor-actions`},_hoisted_61=[`disabled`],_hoisted_62=[`title`],_hoisted_63={class:`material-icons`},_hoisted_64=[`disabled`],_hoisted_65={class:`flex flex-col items-center gap-3`},_hoisted_66=[`src`],_hoisted_67={class:`flex items-center gap-4`},_hoisted_68={key:0,class:`max-w-[80vw] text-center text-white text-2xl leading-relaxed`},_hoisted_69=[`disabled`],View_vue_vue_type_script_setup_true_lang_default$2=defineComponent({__name:`View`,props:{selectedResult:{}},emits:[`updateResult`],setup(Ph,{emit:Fh}){let Ih=Ph,Lh=Fh,Rh=computed(()=>Ih.selectedResult.data),zh=computed(()=>Rh.value?.script??{}),Bh=computed(()=>Rh.value?.filePath??``),Vh=computed(()=>zh.value.beats??[]),Hh=API_ROUTES.mulmoScript.downloadMovie,Uh=reactive({}),Wh=reactive({}),Gh=reactive({}),Kh=reactive({}),qh=reactive({}),Jh=reactive({}),Yh=reactive({}),Xh=reactive({}),Zh=ref(!1),Qh=ref(null),$h=reactive({}),eg=reactive({}),tg=reactive({}),ng=ref(null),rg=ref(null),ig=ref(null),ag=reactive({}),og=reactive({}),sg=reactive({}),cg=reactive({}),lg=reactive({}),ug=computed(()=>Object.values(Uh).some(Ph=>Ph===`rendering`)),dg=computed(()=>{let Ph=zh.value.imageParams?.images??{};return Object.keys(Ph).filter(Fh=>Ph[Fh]?.type===`imagePrompt`)}),fg=useActiveSession(),pg=computed(()=>fg?.value?.id),mg=computed(()=>{let Ph={},Fh=fg?.value?.pendingGenerations??{},Ih=Bh.value;if(!Ih)return Ph;for(let[Lh,Rh]of Object.entries(Fh))Rh.filePath===Ih&&(Ph[Lh]=Rh);return Ph});function hg(Ph){return zh.value.imageParams?.images?.[Ph]?.prompt??``}function gg(Ph){ng.value&&=(ng.value.audio.pause(),null),ig.value={src:Wh[Ph],text:Pg(Ph).text,index:Ph}}let _g=computed(()=>{if(!ig.value)return!1;for(let Ph=ig.value.index-1;Ph>=0;Ph--)if(Wh[Ph])return!0;return!1}),vg=computed(()=>{if(!ig.value)return!1;for(let Ph=ig.value.index+1;Ph<Vh.value.length;Ph++)if(Wh[Ph])return!0;return!1});function yg(Ph){if(!ig.value)return;let Fh=Vh.value.length,Ih=ig.value.index+Ph;for(;Ih>=0&&Ih<Fh;){if(Wh[Ih]){gg(Ih);return}Ih+=Ph}}let bg=ref(),xg=ref(!1),Sg=ref(``),{copied:Cg,copy:wg}=useClipboardCopy(),Tg=computed(()=>({...zh.value,beats:Vh.value.map((Ph,Fh)=>Xh[Fh]??Ph)})),Eg=computed(()=>JSON.stringify(Tg.value,null,2)),Dg=ref(``),Og=computed(()=>Sg.value!==Dg.value),kg=computed(()=>{try{let Ph=JSON.parse(Sg.value);return mulmoScriptSchema.safeParse(Ph).success}catch{return!1}});async function Ag(Ph){if(xg.value=Ph,Ph){let Ph=Eg.value;if(Bh.value){let Fh=await apiGet(API_ROUTES.files.content,{path:Bh.value});Fh.ok&&Fh.data.content&&(Ph=Fh.data.content)}Sg.value=Ph,Dg.value=Ph}}function jg(){bg.value&&(bg.value.open=!1)}async function Mg(){let Ph;try{Ph=JSON.parse(Sg.value)}catch(Ph){alert(extractErrorMessage(Ph));return}let Fh=await apiPost(API_ROUTES.mulmoScript.updateScript,{filePath:Bh.value,script:Ph});if(!Fh.ok){alert(Fh.error||`Update failed`);return}Lh(`updateResult`,{...Ih.selectedResult,data:{...Ih.selectedResult.data,script:Ph}}),bg.value&&(bg.value.open=!1),await t_()}async function Ng(){await wg(Eg.value)}function Pg(Ph){return Xh[Ph]??Vh.value[Ph]??{}}function Fg(Ph){Kh[Ph]||(qh[Ph]=JSON.stringify(Pg(Ph),null,2),delete Jh[Ph]),Kh[Ph]=!Kh[Ph]}function Ig(Ph){return validateBeatJSON(qh[Ph]??``,mulmoBeatSchema)}async function Lg(Ph){let Fh;try{Fh=JSON.parse(qh[Ph])}catch(Fh){Jh[Ph]=`Invalid JSON: ${errorMessage(Fh)}`;return}let Ih=JSON.stringify(Pg(Ph).image);delete Jh[Ph],Yh[Ph]=!0;let Lh=await apiPost(API_ROUTES.mulmoScript.updateBeat,{filePath:Bh.value,beatIndex:Ph,beat:Fh});if(delete Yh[Ph],!Lh.ok){Jh[Ph]=`Save failed: ${Lh.error}`;return}Xh[Ph]=Fh,Kh[Ph]=!1,JSON.stringify(Fh.image)!==Ih&&(delete Wh[Ph],Rg(Ph))}async function Rg(Ph){Uh[Ph]=`rendering`;let Fh=await apiPost(API_ROUTES.mulmoScript.renderBeat,{filePath:Bh.value,beatIndex:Ph,chatSessionId:pg.value});if(!Fh.ok){Gh[Ph]=Fh.error||`Render failed`,Uh[Ph]=`error`;return}if(Fh.data.error){Gh[Ph]=Fh.data.error,Uh[Ph]=`error`;return}Wh[Ph]=Fh.data.image??``,Uh[Ph]=`done`,Qg()}async function zg(Ph){delete Wh[Ph],Uh[Ph]=`rendering`;let Fh=await apiPost(API_ROUTES.mulmoScript.renderBeat,{filePath:Bh.value,beatIndex:Ph,force:!0,chatSessionId:pg.value});if(!Fh.ok){Gh[Ph]=Fh.error||`Render failed`,Uh[Ph]=`error`;return}if(Fh.data.error){Gh[Ph]=Fh.data.error,Uh[Ph]=`error`;return}Wh[Ph]=Fh.data.image??``,Uh[Ph]=`done`}async function Bg(Ph){let Fh=await apiGet(API_ROUTES.mulmoScript.beatImage,{filePath:Bh.value,beatIndex:String(Ph)});Fh.ok&&Fh.data.image&&(Wh[Ph]=Fh.data.image,Uh[Ph]=`done`)}async function Vg(Ph){let Fh=await apiGet(API_ROUTES.mulmoScript.beatAudio,{filePath:Bh.value,beatIndex:String(Ph)});Fh.ok&&Fh.data.audio&&($h[Ph]=Fh.data.audio,eg[Ph]=`done`)}async function Hg(Ph){eg[Ph]=`generating`,delete tg[Ph];let Fh=await apiPost(API_ROUTES.mulmoScript.generateBeatAudio,{filePath:Bh.value,beatIndex:Ph,chatSessionId:pg.value});if(!Fh.ok){tg[Ph]=Fh.error||`Audio generation failed`,eg[Ph]=`error`;return}if(Fh.data.error){tg[Ph]=Fh.data.error,eg[Ph]=`error`;return}$h[Ph]=Fh.data.audio??``,eg[Ph]=`done`}function Ug(Ph){if(ng.value){ng.value.audio.pause();let Fh=ng.value.index;if(ng.value=null,Fh===Ph)return}let Fh=$h[Ph];if(!Fh)return;let Ih=new Audio(Fh);ng.value={index:Ph,audio:Ih},Ih.addEventListener(`ended`,()=>{if(ng.value?.index===Ph&&(ng.value=null,ig.value?.index===Ph)){yg(1);let Fh=ig.value?.index;Fh!==void 0&&Fh!==Ph&&$h[Fh]&&Ug(Fh)}}),Ih.play()}function Wg(Ph,Fh){Ph.dataTransfer?.types.includes(`Files`)&&(Ph.preventDefault(),lg[Fh]=!0)}function Gg(Ph){lg[Ph]=!1}async function Kg(Ph,Fh){Ph.preventDefault(),lg[Fh]=!1;let Ih=Ph.dataTransfer?.files[0];if(!Ih||!Ih.type.startsWith(`image/`))return;Uh[Fh]=`rendering`,delete Gh[Fh];let Lh;try{Lh=await new Promise((Ph,Fh)=>{let Lh=new FileReader;Lh.onload=()=>Ph(Lh.result),Lh.onerror=Fh,Lh.readAsDataURL(Ih)})}catch(Ph){Gh[Fh]=errorMessage(Ph),Uh[Fh]=`error`;return}let Rh=await apiPost(API_ROUTES.mulmoScript.uploadBeatImage,{filePath:Bh.value,beatIndex:Fh,imageData:Lh});if(!Rh.ok){Gh[Fh]=Rh.error||`Upload failed`,Uh[Fh]=`error`;return}if(Rh.data.error){Gh[Fh]=Rh.data.error,Uh[Fh]=`error`;return}Wh[Fh]=Rh.data.image??``,Uh[Fh]=`done`}function qg(Ph,Fh){Ph.dataTransfer?.types.includes(`Files`)&&(Ph.preventDefault(),cg[Fh]=!0)}function Jg(Ph){cg[Ph]=!1}async function Yg(Ph,Fh){Ph.preventDefault(),cg[Fh]=!1;let Ih=Ph.dataTransfer?.files[0];if(!Ih||!Ih.type.startsWith(`image/`))return;ag[Fh]=`rendering`,delete sg[Fh];let Lh;try{Lh=await new Promise((Ph,Fh)=>{let Lh=new FileReader;Lh.onload=()=>Ph(Lh.result),Lh.onerror=Fh,Lh.readAsDataURL(Ih)})}catch(Ph){sg[Fh]=errorMessage(Ph),ag[Fh]=`error`;return}let Rh=await apiPost(API_ROUTES.mulmoScript.uploadCharacterImage,{filePath:Bh.value,key:Fh,imageData:Lh});if(!Rh.ok){sg[Fh]=Rh.error||`Upload failed`,ag[Fh]=`error`;return}if(Rh.data.error){sg[Fh]=Rh.data.error,ag[Fh]=`error`;return}og[Fh]=Rh.data.image??``,ag[Fh]=`done`}function Xg(Ph){ng.value&&=(ng.value.audio.pause(),null),ig.value={src:og[Ph],text:Ph,index:-1,isCharacter:!0}}async function Zg(Ph){let Fh=await apiGet(API_ROUTES.mulmoScript.characterImage,{filePath:Bh.value,key:Ph});Fh.ok&&Fh.data.image&&(og[Ph]=Fh.data.image,ag[Ph]=`done`)}function Qg(){getMissingCharacterKeys(dg.value,og,ag).forEach(Ph=>Zg(Ph))}async function $g(Ph,Fh){ag[Ph]=`rendering`,delete sg[Ph];let Ih=await apiPost(API_ROUTES.mulmoScript.renderCharacter,{filePath:Bh.value,key:Ph,force:Fh,chatSessionId:pg.value});if(!Ih.ok){sg[Ph]=Ih.error||`Render failed`,ag[Ph]=`error`;return}if(Ih.data.error){sg[Ph]=Ih.data.error,ag[Ph]=`error`;return}og[Ph]=Ih.data.image??``,ag[Ph]=`done`}async function e_(){await Promise.all(dg.value.filter(Ph=>ag[Ph]!==`rendering`).map(Ph=>$g(Ph,!1)))}async function t_(){rg.value&&(rg.value.scrollTop=0),Object.keys(Uh).forEach(Ph=>delete Uh[+Ph]),Object.keys(Wh).forEach(Ph=>delete Wh[+Ph]),Object.keys(Gh).forEach(Ph=>delete Gh[+Ph]),Object.keys(Kh).forEach(Ph=>delete Kh[+Ph]),Object.keys(qh).forEach(Ph=>delete qh[+Ph]),Object.keys(Jh).forEach(Ph=>delete Jh[+Ph]),Object.keys(Yh).forEach(Ph=>delete Yh[+Ph]),Object.keys(Xh).forEach(Ph=>delete Xh[+Ph]),Object.keys($h).forEach(Ph=>delete $h[+Ph]),Object.keys(eg).forEach(Ph=>delete eg[+Ph]),Object.keys(tg).forEach(Ph=>delete tg[+Ph]),Object.keys(ag).forEach(Ph=>delete ag[Ph]),Object.keys(og).forEach(Ph=>delete og[Ph]),Object.keys(sg).forEach(Ph=>delete sg[Ph]),Object.keys(lg).forEach(Ph=>delete lg[+Ph]),Qh.value=null,bg.value&&(bg.value.open=!1);let Ph=[`textSlide`,`markdown`,`chart`,`mermaid`,`html_tailwind`],Fh=dg.value.length>0;if(Vh.value.forEach((Ih,Lh)=>{shouldAutoRenderBeat(Ih,Fh,Ph)?Rg(Lh):Ih.imagePrompt&&Bg(Lh),Ih.text&&Vg(Lh)}),dg.value.forEach(Ph=>Zg(Ph)),Bh.value){let Ph=await apiGet(API_ROUTES.mulmoScript.movieStatus,{filePath:Bh.value});Ph.ok&&Ph.data.moviePath&&(Qh.value=Ph.data.moviePath)}for(let Ph of Object.values(mg.value))n_(Ph)}onMounted(t_),watch(()=>Ih.selectedResult,t_),watch(mg,(Ph,Fh={})=>{for(let[Ih,Lh]of Object.entries(Ph))Ih in Fh||n_(Lh);for(let[Ih,Lh]of Object.entries(Fh))Ih in Ph||r_(Lh).catch(Ph=>{console.error(`[presentMulmoScript] reload on finish failed:`,Ph)})});function n_(Ph){if(Ph.kind===GENERATION_KINDS.beatImage){let Fh=Number(Ph.key);Wh[Fh]||(Uh[Fh]=`rendering`)}else if(Ph.kind===GENERATION_KINDS.beatAudio){let Fh=Number(Ph.key);$h[Fh]||(eg[Fh]=`generating`)}else Ph.kind===GENERATION_KINDS.characterImage?og[Ph.key]||(ag[Ph.key]=`rendering`):Ph.kind===GENERATION_KINDS.movie&&(Zh.value=!0)}async function r_(Ph){if(Ph.kind===GENERATION_KINDS.beatImage){let Fh=Number(Ph.key);await Bg(Fh),Uh[Fh]===`rendering`&&delete Uh[Fh]}else if(Ph.kind===GENERATION_KINDS.beatAudio){let Fh=Number(Ph.key);await Vg(Fh),eg[Fh]===`generating`&&delete eg[Fh]}else Ph.kind===GENERATION_KINDS.characterImage?(await Zg(Ph.key),ag[Ph.key]===`rendering`&&delete ag[Ph.key]):Ph.kind===GENERATION_KINDS.movie&&(Zh.value=!1,await i_())}async function i_(){if(!Bh.value)return;let Ph=await apiGet(API_ROUTES.mulmoScript.movieStatus,{filePath:Bh.value});Ph.ok&&Ph.data.moviePath&&(Qh.value=Ph.data.moviePath)}async function a_(){Zh.value=!0;try{let Ph=await apiFetchRaw(API_ROUTES.mulmoScript.generateMovie,{method:`POST`,body:JSON.stringify({filePath:Bh.value,chatSessionId:pg.value}),headers:{"Content-Type":`application/json`}});if(!Ph.ok||!Ph.body)throw Error(`Generation failed`);await streamMovieEvents(Ph.body,{onBeatImageDone:Ph=>{Bg(Ph),Qg()},onBeatAudioDone:Ph=>Vg(Ph),onDone:Ph=>{Qh.value=Ph}})}catch(Ph){alert(extractErrorMessage(Ph))}finally{Zh.value=!1}}return(Ph,Fh)=>(openBlock(),createElementBlock(`div`,_hoisted_1$37,[createBaseVNode(`div`,_hoisted_2$35,[createBaseVNode(`div`,_hoisted_3$33,[createBaseVNode(`h2`,_hoisted_4$29,toDisplayString(zh.value.title||`Untitled Script`),1),zh.value.description?(openBlock(),createElementBlock(`p`,_hoisted_5$27,toDisplayString(zh.value.description),1)):createCommentVNode(``,!0),createBaseVNode(`div`,_hoisted_6$24,[createBaseVNode(`span`,null,toDisplayString(Vh.value.length)+` beat`+toDisplayString(Vh.value.length===1?``:`s`),1),zh.value.lang?(openBlock(),createElementBlock(`span`,_hoisted_7$22,toDisplayString(zh.value.lang),1)):createCommentVNode(``,!0),Bh.value?(openBlock(),createElementBlock(`span`,_hoisted_8$20,toDisplayString(Bh.value),1)):createCommentVNode(``,!0)])]),createBaseVNode(`div`,_hoisted_9$19,[Qh.value&&!Zh.value?(openBlock(),createElementBlock(`a`,{key:0,href:`${unref(Hh)}?moviePath=${encodeURIComponent(Qh.value)}`,download:``,class:`px-3 py-1 text-xs rounded-full border transition-colors border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center justify-center gap-1`},[...Fh[7]||=[createBaseVNode(`span`,{class:`material-icons text-sm leading-none`},`download`,-1),createBaseVNode(`span`,null,`Movie`,-1)]],8,_hoisted_10$16)):createCommentVNode(``,!0),createBaseVNode(`button`,{class:`px-3 py-1 text-xs rounded-full border transition-colors border-gray-200 text-gray-500 hover:bg-gray-50 disabled:opacity-40 flex items-center justify-center gap-1`,disabled:Zh.value,onClick:a_},[Zh.value?(openBlock(),createElementBlock(`svg`,_hoisted_12$12,[...Fh[8]||=[createBaseVNode(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`},null,-1),createBaseVNode(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`},null,-1)]])):createCommentVNode(``,!0),Zh.value?(openBlock(),createElementBlock(`span`,_hoisted_13$10,`Generating…`)):(openBlock(),createElementBlock(Fragment,{key:2},[Fh[9]||=createBaseVNode(`span`,{class:`material-icons text-sm leading-none`},`refresh`,-1),Fh[10]||=createBaseVNode(`span`,null,`Movie`,-1)],64))],8,_hoisted_11$14)])]),dg.value.length>0?(openBlock(),createElementBlock(`div`,_hoisted_14$9,[createBaseVNode(`div`,_hoisted_15$9,[Fh[11]||=createBaseVNode(`span`,{class:`text-xs font-semibold text-gray-500 uppercase tracking-wide`},`Characters`,-1),createBaseVNode(`button`,{class:`px-2 py-0.5 text-xs rounded border border-gray-300 text-gray-500 hover:bg-gray-50 disabled:opacity-50`,disabled:Zh.value||ug.value||dg.value.every(Ph=>ag[Ph]===`rendering`),onClick:e_},` Generate All `,8,_hoisted_16$8)]),createBaseVNode(`div`,_hoisted_17$6,[(openBlock(!0),createElementBlock(Fragment,null,renderList(dg.value,Ph=>(openBlock(),createElementBlock(`div`,{key:Ph,class:`flex flex-col items-center gap-1 w-36`},[createBaseVNode(`div`,{class:normalizeClass([`relative w-36 h-36 rounded-lg border overflow-hidden bg-gray-50 flex items-center justify-center transition-colors`,cg[Ph]?`border-blue-400 bg-blue-50`:`border-gray-200`]),onDragover:Fh=>qg(Fh,Ph),onDragleave:Fh=>Jg(Ph),onDrop:Fh=>Yg(Fh,Ph)},[og[Ph]?(openBlock(),createElementBlock(`img`,{key:0,src:og[Ph],class:`w-full h-full object-cover cursor-zoom-in`,alt:Ph,onClick:Fh=>Xg(Ph)},null,8,_hoisted_19$5)):ag[Ph]===`rendering`?(openBlock(),createElementBlock(`svg`,_hoisted_20$4,[...Fh[12]||=[createBaseVNode(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`},null,-1),createBaseVNode(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`},null,-1)]])):ag[Ph]===`error`?(openBlock(),createElementBlock(`span`,_hoisted_21$4,toDisplayString(sg[Ph]),1)):(openBlock(),createElementBlock(`span`,_hoisted_22$4,toDisplayString(hg(Ph)),1)),cg[Ph]?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_23$3,` or drop image `)),cg[Ph]?(openBlock(),createElementBlock(`div`,_hoisted_24$2,[...Fh[13]||=[createBaseVNode(`span`,{class:`text-xs text-blue-500 font-medium`},`Drop`,-1)]])):createCommentVNode(``,!0),og[Ph]&&ag[Ph]!==`rendering`?(openBlock(),createElementBlock(`button`,{key:6,class:normalizeClass([`absolute top-0.5 right-0.5 px-1 py-0.5 text-xs rounded border bg-white`,Zh.value||ug.value?`border-yellow-400 text-yellow-500 cursor-not-allowed`:`border-gray-400 text-gray-600 hover:bg-gray-50`]),disabled:Zh.value||ug.value,onClick:withModifiers(Fh=>$g(Ph,!0),[`stop`])},[Zh.value||ug.value?(openBlock(),createElementBlock(`span`,_hoisted_26$2,`↺`)):(openBlock(),createElementBlock(`span`,_hoisted_27$2,`↺`))],10,_hoisted_25$2)):!og[Ph]&&ag[Ph]!==`rendering`?(openBlock(),createElementBlock(`button`,{key:7,class:normalizeClass([`absolute top-0.5 right-0.5 px-1 py-0.5 text-xs rounded border bg-white`,Zh.value||ug.value?`border-yellow-400 text-yellow-500 cursor-not-allowed`:`border-blue-400 text-blue-600 hover:bg-blue-50`]),disabled:Zh.value||ug.value,onClick:withModifiers(Fh=>$g(Ph,!1),[`stop`])},[Zh.value||ug.value?(openBlock(),createElementBlock(`svg`,_hoisted_29,[...Fh[14]||=[createBaseVNode(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`},null,-1),createBaseVNode(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`},null,-1)]])):(openBlock(),createElementBlock(`span`,_hoisted_30,`Gen`))],10,_hoisted_28$1)):createCommentVNode(``,!0)],42,_hoisted_18$5),createBaseVNode(`span`,_hoisted_31,toDisplayString(Ph),1)]))),128))])])):createCommentVNode(``,!0),createBaseVNode(`div`,{ref_key:`beatListEl`,ref:rg,class:`flex-1 overflow-y-auto p-2 space-y-1.5`},[(openBlock(!0),createElementBlock(Fragment,null,renderList(Vh.value,(Ph,Ih)=>(openBlock(),createElementBlock(`div`,{key:Ih,class:`rounded-lg border border-gray-200 overflow-hidden`},[createBaseVNode(`div`,_hoisted_32,[createBaseVNode(`div`,{class:normalizeClass([`relative shrink-0 w-[45%] overflow-hidden bg-gray-50 transition-colors`,lg[Ih]?`bg-blue-50`:``]),onDragover:Ph=>Wg(Ph,Ih),onDragleave:Ph=>Gg(Ih),onDrop:Ph=>Kg(Ph,Ih)},[Wh[Ih]?(openBlock(),createElementBlock(`img`,{key:0,src:Wh[Ih],class:`w-full object-contain cursor-zoom-in`,alt:`Beat ${Ih+1}`,onClick:Ph=>gg(Ih)},null,8,_hoisted_34)):createCommentVNode(``,!0),Wh[Ih]&&Uh[Ih]!==`rendering`?(openBlock(),createElementBlock(`button`,{key:1,class:`absolute top-1.5 right-1.5 flex items-center gap-1 px-2 py-0.5 text-xs rounded border border-gray-400 text-gray-600 bg-white hover:bg-gray-50 disabled:opacity-60 disabled:cursor-not-allowed`,disabled:Zh.value,onClick:withModifiers(Ph=>zg(Ih),[`stop`])},` ↺ `,8,_hoisted_35)):Wh[Ih]?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_36,[Uh[Ih]===`rendering`||Zh.value&&!Wh[Ih]&&Pg(Ih).imagePrompt?(openBlock(),createElementBlock(Fragment,{key:0},[Fh[15]||=createBaseVNode(`svg`,{class:`animate-spin w-4 h-4 text-green-400`,viewBox:`0 0 24 24`,fill:`none`},[createBaseVNode(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`}),createBaseVNode(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`})],-1),Fh[16]||=createBaseVNode(`span`,{class:`text-xs text-green-500`},`Rendering…`,-1)],64)):Uh[Ih]===`error`?(openBlock(),createElementBlock(`span`,_hoisted_37,toDisplayString(Gh[Ih]),1)):(openBlock(),createElementBlock(Fragment,{key:2},[Pg(Ih).imagePrompt?(openBlock(),createElementBlock(`span`,_hoisted_38,toDisplayString(Pg(Ih).imagePrompt),1)):(openBlock(),createElementBlock(`span`,_hoisted_39,toDisplayString(Ph.image?.type??`—`),1))],64))])),lg[Ih]?(openBlock(),createElementBlock(`div`,_hoisted_40,[...Fh[17]||=[createBaseVNode(`span`,{class:`text-xs text-blue-500 font-medium`},`Drop`,-1)]])):!Wh[Ih]&&Uh[Ih]!==`rendering`?(openBlock(),createElementBlock(`div`,_hoisted_41,` or drop image `)):createCommentVNode(``,!0),Pg(Ih).imagePrompt&&!Wh[Ih]&&Uh[Ih]!==`rendering`&&!Zh.value?(openBlock(),createElementBlock(`button`,{key:5,class:`absolute top-1.5 right-1.5 flex items-center gap-1 px-2 py-0.5 text-xs rounded border border-blue-400 text-blue-600 bg-white hover:bg-blue-50`,onClick:Ph=>Rg(Ih)},` Generate `,8,_hoisted_42)):createCommentVNode(``,!0)],42,_hoisted_33),createBaseVNode(`div`,_hoisted_43,[createBaseVNode(`span`,_hoisted_44,toDisplayString(Pg(Ih).text),1),createBaseVNode(`div`,_hoisted_45,[createBaseVNode(`div`,_hoisted_46,[eg[Ih]===`generating`||Zh.value&&!$h[Ih]&&Pg(Ih).text?(openBlock(),createElementBlock(`svg`,_hoisted_47,[...Fh[18]||=[createBaseVNode(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`},null,-1),createBaseVNode(`path`,{class:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`},null,-1)]])):$h[Ih]?(openBlock(),createElementBlock(`button`,{key:1,class:normalizeClass([`text-xs px-2 py-0.5 rounded border`,ng.value?.index===Ih?`border-red-400 text-red-600 hover:bg-red-50`:`border-green-400 text-green-600 hover:bg-green-50`]),onClick:Ph=>Ug(Ih)},toDisplayString(ng.value?.index===Ih?`■ Stop`:`▶ Play`),11,_hoisted_48)):tg[Ih]?(openBlock(),createElementBlock(Fragment,{key:2},[createBaseVNode(`span`,{class:`text-xs text-red-400`,title:tg[Ih]},`⚠ Error`,8,_hoisted_49),Pg(Ih).text?(openBlock(),createElementBlock(`button`,{key:0,class:`text-xs px-2 py-0.5 rounded border border-gray-300 text-gray-500 hover:bg-gray-50 disabled:opacity-50`,disabled:Zh.value,onClick:Ph=>Hg(Ih)},` ↺ `,8,_hoisted_50)):createCommentVNode(``,!0)],64)):Pg(Ih).text?(openBlock(),createElementBlock(`button`,{key:3,class:`text-xs px-2 py-0.5 rounded border border-gray-300 text-gray-500 hover:bg-gray-50`,onClick:Ph=>Hg(Ih)},` ♪ Generate `,8,_hoisted_51)):createCommentVNode(``,!0)]),createBaseVNode(`button`,{class:`text-gray-400 hover:text-gray-600`,title:Kh[Ih]?`Hide source`:`Show source`,onClick:Ph=>Fg(Ih)},[...Fh[19]||=[createBaseVNode(`svg`,{xmlns:`http://www.w3.org/2000/svg`,class:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[createBaseVNode(`polyline`,{points:`16 18 22 12 16 6`}),createBaseVNode(`polyline`,{points:`8 6 2 12 8 18`})],-1)]],8,_hoisted_52)])])]),Kh[Ih]?(openBlock(),createElementBlock(`div`,_hoisted_53,[withDirectives(createBaseVNode(`textarea`,{"onUpdate:modelValue":Ph=>qh[Ih]=Ph,class:normalizeClass([`w-full text-xs text-gray-600 bg-gray-50 p-2 font-mono resize-none`,Ig(Ih)?`outline-none`:`outline outline-2 outline-red-400`]),rows:`8`,spellcheck:`false`},null,10,_hoisted_54),[[vModelText,qh[Ih]]]),createBaseVNode(`div`,_hoisted_55,[Jh[Ih]?(openBlock(),createElementBlock(`span`,_hoisted_56,`⚠ `+toDisplayString(Jh[Ih]),1)):createCommentVNode(``,!0),createBaseVNode(`button`,{class:normalizeClass([`px-2 py-1 text-xs rounded border`,Ig(Ih)&&!Yh[Ih]?`border-blue-400 text-blue-600 hover:bg-blue-50 cursor-pointer`:`border-gray-200 text-gray-300 cursor-not-allowed`]),disabled:!Ig(Ih)||!!Yh[Ih],onClick:Ph=>Lg(Ih)},toDisplayString(Yh[Ih]?`Saving…`:`Update`),11,_hoisted_57)])])):createCommentVNode(``,!0)]))),128)),Vh.value.length===0?(openBlock(),createElementBlock(`div`,_hoisted_58,`No beats found in script`)):createCommentVNode(``,!0)],512),createBaseVNode(`div`,_hoisted_59,[createBaseVNode(`details`,{ref_key:`sourceDetails`,ref:bg,class:`script-source`,onToggle:Fh[1]||=Ph=>Ag(Ph.target.open)},[Fh[20]||=createBaseVNode(`summary`,null,`Edit Script Source`,-1),withDirectives(createBaseVNode(`textarea`,{"onUpdate:modelValue":Fh[0]||=Ph=>Sg.value=Ph,class:normalizeClass([`script-editor`,{"script-editor-invalid":Og.value&&!kg.value}]),spellcheck:`false`},null,2),[[vModelText,Sg.value]]),createBaseVNode(`div`,_hoisted_60,[createBaseVNode(`button`,{class:`apply-btn`,disabled:!Og.value||!kg.value,onClick:Mg},`Apply Changes`,8,_hoisted_61),createBaseVNode(`button`,{class:`cancel-btn`,onClick:jg},`Cancel`)])],544),withDirectives(createBaseVNode(`button`,{class:`copy-btn`,title:unref(Cg)?`Copied!`:`Copy`,onClick:Ng},[createBaseVNode(`span`,_hoisted_63,toDisplayString(unref(Cg)?`check`:`content_copy`),1)],8,_hoisted_62),[[vShow,!xg.value]])]),ig.value?(openBlock(),createElementBlock(`div`,{key:1,class:`fixed inset-0 z-50 flex items-center justify-center bg-black/80`,onClick:Fh[6]||=Ph=>ig.value=null},[createBaseVNode(`div`,{class:`flex items-center gap-4`,onClick:Fh[5]||=withModifiers(()=>{},[`stop`])},[ig.value.isCharacter?createCommentVNode(``,!0):(openBlock(),createElementBlock(`button`,{key:0,class:`text-white/60 hover:text-white disabled:opacity-20 text-4xl leading-none`,disabled:!_g.value,onClick:Fh[2]||=Ph=>yg(-1)},` ‹ `,8,_hoisted_64)),createBaseVNode(`div`,_hoisted_65,[createBaseVNode(`img`,{src:ig.value.src,class:`max-w-[80vw] max-h-[80vh] object-contain rounded shadow-2xl`},null,8,_hoisted_66),createBaseVNode(`div`,_hoisted_67,[ig.value.text?(openBlock(),createElementBlock(`p`,_hoisted_68,toDisplayString(ig.value.text),1)):createCommentVNode(``,!0),$h[ig.value.index]?(openBlock(),createElementBlock(`button`,{key:1,class:normalizeClass([`shrink-0 text-sm px-3 py-1 rounded border`,ng.value?.index===ig.value.index?`border-red-400 text-red-400 hover:bg-red-400/20`:`border-white/60 text-white/60 hover:bg-white/20`]),onClick:Fh[3]||=Ph=>Ug(ig.value.index)},toDisplayString(ng.value?.index===ig.value.index?`■ Stop`:`▶ Play`),3)):createCommentVNode(``,!0)])]),ig.value.isCharacter?createCommentVNode(``,!0):(openBlock(),createElementBlock(`button`,{key:1,class:`text-white/60 hover:text-white disabled:opacity-20 text-4xl leading-none`,disabled:!vg.value,onClick:Fh[4]||=Ph=>yg(1)},` › `,8,_hoisted_69))])])):createCommentVNode(``,!0)]))}}),View_default$2=_plugin_vue_export_helper_default(View_vue_vue_type_script_setup_true_lang_default$2,[[`__scopeId`,`data-v-554954f9`]]),_hoisted_1$36={class:`text-sm`},_hoisted_2$34={class:`font-medium text-gray-700 truncate mb-1`},_hoisted_3$32={key:0,class:`text-xs text-gray-500 leading-relaxed`},Preview_vue_vue_type_script_setup_true_lang_default$2=defineComponent({__name:`Preview`,props:{result:{}},setup(Ph){let Fh=Ph,Ih=computed(()=>Fh.result.data),Lh=computed(()=>Ih.value?.script),Rh=computed(()=>Lh.value?.title||Ih.value?.filePath?.split(`/`).pop()||`MulmoScript`),zh=computed(()=>Lh.value?.description);return(Ph,Fh)=>(openBlock(),createElementBlock(`div`,_hoisted_1$36,[createBaseVNode(`div`,_hoisted_2$34,toDisplayString(Rh.value),1),zh.value?(openBlock(),createElementBlock(`div`,_hoisted_3$32,toDisplayString(zh.value),1)):createCommentVNode(``,!0)]))}}),Preview_default$2=Preview_vue_vue_type_script_setup_true_lang_default$2,presentMulmoScriptPlugin={toolDefinition:toolDefinition$2,async execute(Ph,Fh){let Ih=await apiPost(API_ROUTES.mulmoScript.save,Fh);return Ih.ok?{...Ih.data,toolName:TOOL_NAME$2,uuid:crypto.randomUUID()}:{toolName:TOOL_NAME$2,uuid:crypto.randomUUID(),message:Ih.error}},isEnabled:()=>!0,generatingMessage:`Generating MulmoScript storyboard…`,viewComponent:View_default$2,previewComponent:Preview_default$2},TOOL_NAME$1=`presentHtml`,toolDefinition$1={type:`function`,name:TOOL_NAME$1,description:`Save and present a complete, self-contained HTML page in the canvas. Claude generates the HTML and calls this tool to display it. Use for rich interactive output, dashboards, custom layouts, or any content best expressed as HTML.`,parameters:{type:`object`,properties:{html:{type:`string`,description:`Complete, self-contained HTML string. All CSS and JavaScript must be inline or loaded via CDN. Must be a full document (include <!DOCTYPE html> and <html>/<body> tags).`},title:{type:`string`,description:`Short label shown in the preview sidebar.`}},required:[`html`]}},_hoisted_1$35={class:`h-full flex flex-col overflow-hidden`},_hoisted_2$33={class:`px-4 py-2 border-b border-gray-100 shrink-0 flex items-center justify-between`},_hoisted_3$31={class:`text-sm font-medium text-gray-700 truncate`},_hoisted_4$28={class:`flex items-center gap-2`},_hoisted_5$26={key:0,class:`border-b border-gray-100 shrink-0`},_hoisted_6$23=[`value`],_hoisted_7$21=[`srcdoc`],PRINT_STYLE=`<style>@media print {
|
|
4688
4688
|
* { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
|
|
4689
4689
|
body { width: 100% !important; margin: 0 !important; padding: 8px !important; }
|
|
4690
4690
|
@page { margin: 10mm; }
|
|
@@ -4746,7 +4746,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
4746
4746
|
/workspace/path`,"data-testid":`mcp-draft-args`,onKeydown:Ih[8]||=withModifiers(()=>{},[`stop`])},null,544),[[vModelText,Bh.value.argsText]])])])),Vh.value?(openBlock(),createElementBlock(`div`,_hoisted_28,toDisplayString(Vh.value),1)):createCommentVNode(``,!0),createBaseVNode(`div`,{class:`flex justify-end gap-2`},[createBaseVNode(`button`,{class:`px-2 py-1 text-xs rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,"data-testid":`mcp-draft-cancel`,onClick:Wh},` Cancel `),createBaseVNode(`button`,{class:`px-2 py-1 text-xs rounded bg-blue-500 text-white hover:bg-blue-600`,"data-testid":`mcp-draft-add`,onClick:Zh},`Add`)])])):(openBlock(),createElementBlock(`button`,{key:2,class:`text-xs px-2 py-1 rounded border border-gray-300 text-gray-700 hover:bg-gray-50`,"data-testid":`mcp-add-btn`,onClick:Uh},` + Add MCP Server `))]))}}),SettingsMcpTab_default=SettingsMcpTab_vue_vue_type_script_setup_true_lang_default,_hoisted_1$4={class:`space-y-3`},_hoisted_2$4={key:0,class:`text-sm text-gray-400`},_hoisted_3$4={key:1,class:`text-sm text-red-600 bg-red-50 rounded px-3 py-2`},_hoisted_4$4={key:0,class:`text-sm text-gray-400`},_hoisted_5$4={key:1,class:`space-y-1.5`},_hoisted_6$4=[`data-testid`],_hoisted_7$3={class:`flex-1 min-w-0`},_hoisted_8$3={class:`font-mono text-xs text-gray-800`},_hoisted_9$3={key:0,class:`text-xs text-gray-500 truncate`},_hoisted_10$3={class:`text-[10px] px-1.5 py-0.5 rounded bg-gray-200 text-gray-600 shrink-0`},_hoisted_11$3=[`onClick`],_hoisted_12$3={class:`border border-gray-200 rounded p-2 space-y-2`},_hoisted_13$2={class:`flex gap-2`},_hoisted_14$1={class:`flex items-center gap-2`},_hoisted_15$1={key:0,class:`text-xs text-red-500`},_hoisted_16={class:`flex items-center gap-2`},_hoisted_17=[`disabled`],SettingsWorkspaceDirsTab_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`SettingsWorkspaceDirsTab`,setup(Ph){let Fh=ref([]),Ih=ref(!0),Lh=ref(``),Rh=ref(!1),zh=ref(``),Bh=ref(``),Vh=ref(``),Hh=ref(`flat`),Uh=ref(``);async function Wh(){Ih.value=!0,Lh.value=``;let Ph=await apiGet(API_ROUTES.config.workspaceDirs);if(Ih.value=!1,!Ph.ok){Lh.value=Ph.error;return}Fh.value=Ph.data.dirs}async function Gh(){Rh.value=!0,zh.value=``;let Ph=await apiPut(API_ROUTES.config.workspaceDirs,{dirs:Fh.value});if(Rh.value=!1,!Ph.ok){zh.value=Ph.error;return}Fh.value=Ph.data.dirs,zh.value=`Saved`,setTimeout(()=>{zh.value=``},2e3)}function Kh(){Uh.value=``;let Ph=Bh.value.trim();if(!Ph){Uh.value=`Path required`;return}if(!Ph.startsWith(`data/`)&&!Ph.startsWith(`artifacts/`)){Uh.value=`Must start with data/ or artifacts/`;return}if(Fh.value.some(Fh=>Fh.path===Ph)){Uh.value=`Already exists`;return}Fh.value.push({path:Ph,description:Vh.value.trim(),structure:Hh.value}),Bh.value=``,Vh.value=``,Hh.value=`flat`}function qh(Ph){Fh.value.splice(Ph,1)}return onMounted(Wh),(Ph,Wh)=>(openBlock(),createElementBlock(`div`,_hoisted_1$4,[Wh[8]||=createBaseVNode(`p`,{class:`text-xs text-gray-600 leading-relaxed`},[createTextVNode(` Custom directories for organizing files under `),createBaseVNode(`code`,{class:`bg-gray-100 px-1 rounded`},`data/`),createTextVNode(` and `),createBaseVNode(`code`,{class:`bg-gray-100 px-1 rounded`},`artifacts/`),createTextVNode(`. Claude uses these to route file saves. `)],-1),Ih.value?(openBlock(),createElementBlock(`div`,_hoisted_2$4,`Loading...`)):Lh.value?(openBlock(),createElementBlock(`div`,_hoisted_3$4,toDisplayString(Lh.value),1)):(openBlock(),createElementBlock(Fragment,{key:2},[Fh.value.length===0?(openBlock(),createElementBlock(`div`,_hoisted_4$4,`No custom directories configured.`)):(openBlock(),createElementBlock(`div`,_hoisted_5$4,[(openBlock(!0),createElementBlock(Fragment,null,renderList(Fh.value,(Ph,Fh)=>(openBlock(),createElementBlock(`div`,{key:Ph.path,class:`flex items-center gap-2 px-2 py-1.5 bg-gray-50 rounded text-sm`,"data-testid":`workspace-dir-${Fh}`},[createBaseVNode(`div`,_hoisted_7$3,[createBaseVNode(`div`,_hoisted_8$3,toDisplayString(Ph.path)+`/`,1),Ph.description?(openBlock(),createElementBlock(`div`,_hoisted_9$3,toDisplayString(Ph.description),1)):createCommentVNode(``,!0)]),createBaseVNode(`span`,_hoisted_10$3,toDisplayString(Ph.structure),1),createBaseVNode(`button`,{class:`text-gray-300 hover:text-red-500 shrink-0`,title:`Remove`,onClick:Ph=>qh(Fh)},[...Wh[5]||=[createBaseVNode(`span`,{class:`material-icons text-sm`},`close`,-1)]],8,_hoisted_11$3)],8,_hoisted_6$4))),128))])),createBaseVNode(`div`,_hoisted_12$3,[Wh[7]||=createBaseVNode(`div`,{class:`text-xs font-semibold text-gray-600`},`Add directory`,-1),createBaseVNode(`div`,_hoisted_13$2,[withDirectives(createBaseVNode(`input`,{"onUpdate:modelValue":Wh[0]||=Ph=>Bh.value=Ph,class:`flex-1 px-2 py-1 text-xs font-mono border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:`data/clients or artifacts/reports`,"data-testid":`workspace-dir-path-input`,onKeydown:[withKeys(Kh,[`enter`]),Wh[1]||=withModifiers(()=>{},[`stop`])]},null,544),[[vModelText,Bh.value]]),withDirectives(createBaseVNode(`select`,{"onUpdate:modelValue":Wh[2]||=Ph=>Hh.value=Ph,class:`text-xs border border-gray-300 rounded px-1 py-1 focus:outline-none`,"data-testid":`workspace-dir-structure-select`},[...Wh[6]||=[createBaseVNode(`option`,{value:`flat`},`flat`,-1),createBaseVNode(`option`,{value:`by-name`},`by-name`,-1),createBaseVNode(`option`,{value:`by-date`},`by-date`,-1)]],512),[[vModelSelect,Hh.value]])]),withDirectives(createBaseVNode(`input`,{"onUpdate:modelValue":Wh[3]||=Ph=>Vh.value=Ph,class:`w-full px-2 py-1 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:`Description (what goes in this folder)`,"data-testid":`workspace-dir-desc-input`,onKeydown:[withKeys(Kh,[`enter`]),Wh[4]||=withModifiers(()=>{},[`stop`])]},null,544),[[vModelText,Vh.value]]),createBaseVNode(`div`,_hoisted_14$1,[createBaseVNode(`button`,{class:`px-2 py-1 text-xs rounded bg-blue-500 text-white hover:bg-blue-600`,"data-testid":`workspace-dir-add-btn`,onClick:Kh},`Add`),Uh.value?(openBlock(),createElementBlock(`span`,_hoisted_15$1,toDisplayString(Uh.value),1)):createCommentVNode(``,!0)])]),createBaseVNode(`div`,_hoisted_16,[createBaseVNode(`button`,{class:`px-3 py-1.5 text-sm rounded bg-blue-500 text-white hover:bg-blue-600 disabled:bg-gray-300`,disabled:Rh.value,"data-testid":`workspace-dirs-save-btn`,onClick:Gh},toDisplayString(Rh.value?`Saving...`:`Save`),9,_hoisted_17),zh.value?(openBlock(),createElementBlock(`span`,{key:0,class:normalizeClass([`text-xs`,zh.value===`Saved`?`text-green-600`:`text-red-600`])},toDisplayString(zh.value),3)):createCommentVNode(``,!0)])],64))]))}}),SettingsWorkspaceDirsTab_default=SettingsWorkspaceDirsTab_vue_vue_type_script_setup_true_lang_default,_hoisted_1$3={class:`space-y-3`},_hoisted_2$3={key:0,class:`text-sm text-gray-400`},_hoisted_3$3={key:1,class:`text-sm text-red-600 bg-red-50 rounded px-3 py-2`},_hoisted_4$3={key:0,class:`text-sm text-gray-400`},_hoisted_5$3={key:1,class:`space-y-1.5`},_hoisted_6$3=[`data-testid`],_hoisted_7$2={class:`flex-1 min-w-0`},_hoisted_8$2={class:`font-mono text-xs text-gray-800 truncate`},_hoisted_9$2={key:0,class:`text-xs text-gray-500 truncate`},_hoisted_10$2=[`onClick`],_hoisted_11$2={class:`border border-gray-200 rounded p-2 space-y-2`},_hoisted_12$2={class:`flex items-center gap-2`},_hoisted_13$1={key:0,class:`text-xs text-red-500`},_hoisted_14={class:`flex items-center gap-2`},_hoisted_15=[`disabled`],SettingsReferenceDirsTab_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`SettingsReferenceDirsTab`,setup(Ph){let Fh=ref([]),Ih=ref(!0),Lh=ref(``),Rh=ref(!1),zh=ref(``),Bh=ref(``),Vh=ref(``),Hh=ref(``);async function Uh(){Ih.value=!0,Lh.value=``;let Ph=await apiGet(API_ROUTES.config.referenceDirs);if(Ih.value=!1,!Ph.ok){Lh.value=Ph.error;return}Fh.value=Ph.data.dirs}async function Wh(){Rh.value=!0,zh.value=``;let Ph=await apiPut(API_ROUTES.config.referenceDirs,{dirs:Fh.value});if(Rh.value=!1,!Ph.ok){zh.value=Ph.error;return}Fh.value=Ph.data.dirs,zh.value=`Saved`,setTimeout(()=>{zh.value=``},2e3)}function Gh(){Hh.value=``;let Ph=Bh.value.trim();if(!Ph){Hh.value=`Path required`;return}if(!Ph.startsWith(`/`)&&!Ph.startsWith(`~/`)){Hh.value=`Must be an absolute path or start with ~/`;return}let Ih=Ph;for(;Ih.length>1&&Ih.endsWith(`/`);)Ih=Ih.slice(0,-1);let Lh=Ph=>{let Fh=Ph;for(;Fh.length>1&&Fh.endsWith(`/`);)Fh=Fh.slice(0,-1);return Fh};if(Fh.value.some(Ph=>Lh(Ph.hostPath)===Ih)){Hh.value=`Already exists`;return}let Rh=Ih.split(`/`).pop(),zh=Vh.value.trim()||Rh||Ih;if(Fh.value.some(Ph=>Ph.label===zh)){Hh.value=`Label "${zh}" already exists`;return}Fh.value.push({hostPath:Ih,label:zh}),Bh.value=``,Vh.value=``}function Kh(Ph){Fh.value.splice(Ph,1)}return onMounted(Uh),(Ph,Uh)=>(openBlock(),createElementBlock(`div`,_hoisted_1$3,[Uh[8]||=createBaseVNode(`p`,{class:`text-xs text-gray-600 leading-relaxed`},` External directories Claude can read but not modify. In Docker mode, these are mounted read-only. Useful for referencing Obsidian vaults, project code, or document folders. `,-1),Ih.value?(openBlock(),createElementBlock(`div`,_hoisted_2$3,`Loading...`)):Lh.value?(openBlock(),createElementBlock(`div`,_hoisted_3$3,toDisplayString(Lh.value),1)):(openBlock(),createElementBlock(Fragment,{key:2},[Fh.value.length===0?(openBlock(),createElementBlock(`div`,_hoisted_4$3,`No reference directories configured.`)):(openBlock(),createElementBlock(`div`,_hoisted_5$3,[(openBlock(!0),createElementBlock(Fragment,null,renderList(Fh.value,(Ph,Fh)=>(openBlock(),createElementBlock(`div`,{key:Ph.hostPath,class:`flex items-center gap-2 px-2 py-1.5 bg-gray-50 rounded text-sm`,"data-testid":`reference-dir-${Fh}`},[Uh[5]||=createBaseVNode(`span`,{class:`material-icons text-sm text-gray-400 shrink-0`},`folder_open`,-1),createBaseVNode(`div`,_hoisted_7$2,[createBaseVNode(`div`,_hoisted_8$2,toDisplayString(Ph.hostPath),1),Ph.label?(openBlock(),createElementBlock(`div`,_hoisted_9$2,toDisplayString(Ph.label),1)):createCommentVNode(``,!0)]),Uh[6]||=createBaseVNode(`span`,{class:`text-[10px] px-1.5 py-0.5 rounded bg-blue-100 text-blue-600 shrink-0`},` read-only `,-1),createBaseVNode(`button`,{class:`text-gray-300 hover:text-red-500 shrink-0`,title:`Remove`,"data-testid":`reference-dir-remove-btn`,onClick:Ph=>Kh(Fh)},[...Uh[4]||=[createBaseVNode(`span`,{class:`material-icons text-sm`},`close`,-1)]],8,_hoisted_10$2)],8,_hoisted_6$3))),128))])),createBaseVNode(`div`,_hoisted_11$2,[Uh[7]||=createBaseVNode(`div`,{class:`text-xs font-semibold text-gray-600`},`Add reference directory`,-1),withDirectives(createBaseVNode(`input`,{"onUpdate:modelValue":Uh[0]||=Ph=>Bh.value=Ph,class:`w-full px-2 py-1 text-xs font-mono border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:`/Users/me/ObsidianVault or ~/Documents/notes`,"data-testid":`reference-dir-path-input`,onKeydown:[withKeys(Gh,[`enter`]),Uh[1]||=withModifiers(()=>{},[`stop`])]},null,544),[[vModelText,Bh.value]]),withDirectives(createBaseVNode(`input`,{"onUpdate:modelValue":Uh[2]||=Ph=>Vh.value=Ph,class:`w-full px-2 py-1 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:`Label (optional — defaults to folder name)`,"data-testid":`reference-dir-label-input`,onKeydown:[withKeys(Gh,[`enter`]),Uh[3]||=withModifiers(()=>{},[`stop`])]},null,544),[[vModelText,Vh.value]]),createBaseVNode(`div`,_hoisted_12$2,[createBaseVNode(`button`,{class:`px-2 py-1 text-xs rounded bg-blue-500 text-white hover:bg-blue-600`,"data-testid":`reference-dir-add-btn`,onClick:Gh},`Add`),Hh.value?(openBlock(),createElementBlock(`span`,_hoisted_13$1,toDisplayString(Hh.value),1)):createCommentVNode(``,!0)])]),createBaseVNode(`div`,_hoisted_14,[createBaseVNode(`button`,{class:`px-3 py-1.5 text-sm rounded bg-blue-500 text-white hover:bg-blue-600 disabled:bg-gray-300`,disabled:Rh.value,"data-testid":`reference-dirs-save-btn`,onClick:Wh},toDisplayString(Rh.value?`Saving...`:`Save`),9,_hoisted_15),zh.value?(openBlock(),createElementBlock(`span`,{key:0,class:normalizeClass([`text-xs`,zh.value===`Saved`?`text-green-600`:`text-red-600`])},toDisplayString(zh.value),3)):createCommentVNode(``,!0)])],64))]))}}),SettingsReferenceDirsTab_default=SettingsReferenceDirsTab_vue_vue_type_script_setup_true_lang_default,_hoisted_1$2={class:`flex border-b border-gray-200 px-5`},_hoisted_2$2={class:`px-5 py-4 overflow-y-auto flex-1 space-y-4 text-gray-900`},_hoisted_3$2={key:0,class:`text-sm text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2`,role:`alert`,"data-testid":`settings-load-error`},_hoisted_4$2={key:1,class:`space-y-3`},_hoisted_5$2={class:`block`},_hoisted_6$2={key:0,class:`text-xs text-amber-700`},_hoisted_7$1={key:2,class:`space-y-3`},_hoisted_8$1={key:0,class:`text-xs text-amber-800 bg-amber-50 border border-amber-200 rounded px-2 py-1`,role:`alert`,"data-testid":`mcp-tools-error`},_hoisted_9$1={class:`px-5 py-3 border-t border-gray-200 flex items-center justify-between gap-3`},_hoisted_10$1={key:1,class:`text-xs text-gray-500`},_hoisted_11$1={class:`flex gap-2`},_hoisted_12$1=[`disabled`,`title`],SettingsModal_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`SettingsModal`,props:{open:{type:Boolean},dockerMode:{type:Boolean,default:!1},mcpToolsError:{default:null}},emits:[`update:open`,`saved`],setup(Ph,{emit:Fh}){let Ih=Ph,Lh=Fh,Rh=ref(null),zh=ref(`tools`),Bh=ref(``),Vh=ref([]),Hh=ref(``),Uh=ref(``),Wh=ref(!1),Gh=ref(!1),Kh=ref(!1),qh=0,Jh=computed(()=>Bh.value.split(`
|
|
4747
4747
|
`).map(Ph=>Ph.trim()).filter(Ph=>Ph.length>0)),Yh=computed(()=>Jh.value.filter(Ph=>!Ph.startsWith(`mcp__`)&&!Xh(Ph)));function Xh(Ph){return[`Bash`,`Read`,`Write`,`Edit`,`Glob`,`Grep`,`WebFetch`,`WebSearch`].includes(Ph)}async function Zh(){let Ph=++qh;Kh.value=!0,Hh.value=``,Uh.value=``;let Fh=await apiGet(API_ROUTES.config.base);Ph===qh&&(Fh.ok?(Bh.value=Fh.data.settings.extraAllowedTools.join(`
|
|
4748
4748
|
`),Vh.value=Fh.data.mcp?.servers??[]):Hh.value=Fh.status===0?Fh.error||`Network error`:`Failed to load settings (HTTP ${Fh.status})`,Ph===qh&&(Kh.value=!1))}async function Qh(){if(Kh.value)return;if(Rh.value&&!Rh.value.flushDraft()){Wh.value=!0,Uh.value=`Finish or cancel the pending MCP server entry first.`;return}Gh.value=!0,Uh.value=``,Wh.value=!1;let Ph=await apiPut(API_ROUTES.config.base,{settings:{extraAllowedTools:Jh.value},mcp:{servers:Vh.value}});Ph.ok?(Lh(`saved`),$h()):(Wh.value=!0,Uh.value=Ph.error||`Save failed`),Gh.value=!1}function $h(){Lh(`update:open`,!1)}function eg(Ph){Vh.value=[...Vh.value,Ph]}function tg(Ph,Fh){let Ih=[...Vh.value];Ih[Ph]=Fh,Vh.value=Ih}function ng(Ph){let Fh=[...Vh.value];Fh.splice(Ph,1),Vh.value=Fh}return watch(()=>Ih.open,Ph=>{Ph&&(Zh(),Uh.value=``,Wh.value=!1)},{immediate:!0}),(Fh,Ih)=>Ph.open?(openBlock(),createElementBlock(`div`,{key:0,class:`fixed inset-0 z-50 bg-black/40 flex items-center justify-center`,"data-testid":`settings-modal-backdrop`,onClick:$h},[createBaseVNode(`div`,{class:`bg-white rounded-lg shadow-xl w-[36rem] max-h-[85vh] flex flex-col`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-modal-title`,"data-testid":`settings-modal`,onClick:Ih[6]||=withModifiers(()=>{},[`stop`])},[createBaseVNode(`div`,{class:`px-5 py-4 border-b border-gray-200 flex items-center justify-between`},[Ih[8]||=createBaseVNode(`h2`,{id:`settings-modal-title`,class:`text-base font-semibold text-gray-900`},`Settings`,-1),createBaseVNode(`button`,{class:`text-gray-400 hover:text-gray-700`,title:`Close`,"data-testid":`settings-close-btn`,onClick:$h},[...Ih[7]||=[createBaseVNode(`span`,{class:`material-icons`},`close`,-1)]])]),createBaseVNode(`div`,_hoisted_1$2,[createBaseVNode(`button`,{class:normalizeClass([`px-3 py-2 text-sm border-b-2`,zh.value===`tools`?`border-blue-500 text-blue-600`:`border-transparent text-gray-500 hover:text-gray-800`]),"data-testid":`settings-tab-tools`,onClick:Ih[0]||=Ph=>zh.value=`tools`},` Allowed Tools `,2),createBaseVNode(`button`,{class:normalizeClass([`px-3 py-2 text-sm border-b-2`,zh.value===`mcp`?`border-blue-500 text-blue-600`:`border-transparent text-gray-500 hover:text-gray-800`]),"data-testid":`settings-tab-mcp`,onClick:Ih[1]||=Ph=>zh.value=`mcp`},` MCP Servers `,2),createBaseVNode(`button`,{class:normalizeClass([`px-3 py-2 text-sm border-b-2`,zh.value===`dirs`?`border-blue-500 text-blue-600`:`border-transparent text-gray-500 hover:text-gray-800`]),"data-testid":`settings-tab-dirs`,onClick:Ih[2]||=Ph=>zh.value=`dirs`},` Directories `,2),createBaseVNode(`button`,{class:normalizeClass([`px-3 py-2 text-sm border-b-2`,zh.value===`refs`?`border-blue-500 text-blue-600`:`border-transparent text-gray-500 hover:text-gray-800`]),"data-testid":`settings-tab-refs`,onClick:Ih[3]||=Ph=>zh.value=`refs`},` Reference Dirs `,2)]),createBaseVNode(`div`,_hoisted_2$2,[Hh.value?(openBlock(),createElementBlock(`div`,_hoisted_3$2,` ⚠ `+toDisplayString(Hh.value),1)):createCommentVNode(``,!0),zh.value===`tools`?(openBlock(),createElementBlock(`div`,_hoisted_4$2,[Ih[12]||=createBaseVNode(`p`,{class:`text-xs text-gray-600 leading-relaxed`},[createTextVNode(` Extra tool names to pass to Claude via `),createBaseVNode(`code`,{class:`bg-gray-100 px-1 rounded`},`--allowedTools`),createTextVNode(`. One per line. Useful for built-in Claude Code MCP servers like Gmail / Google Calendar after you have authenticated via `),createBaseVNode(`code`,{class:`bg-gray-100 px-1 rounded`},`claude mcp`),createTextVNode(`. `)],-1),createBaseVNode(`label`,_hoisted_5$2,[Ih[9]||=createBaseVNode(`span`,{class:`text-xs font-semibold text-gray-700`},`Tool names`,-1),withDirectives(createBaseVNode(`textarea`,{"onUpdate:modelValue":Ih[4]||=Ph=>Bh.value=Ph,class:`mt-1 w-full h-48 px-2 py-1.5 text-sm font-mono border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:`mcp__claude_ai_Gmail
|
|
4749
|
-
mcp__claude_ai_Google_Calendar`,"data-testid":`settings-tools-textarea`,onKeydown:Ih[5]||=withModifiers(()=>{},[`stop`])},null,544),[[vModelText,Bh.value]])]),Yh.value.length>0?(openBlock(),createElementBlock(`p`,_hoisted_6$2,[Ih[10]||=createTextVNode(` These look non-standard (expected prefix `,-1),Ih[11]||=createBaseVNode(`code`,{class:`bg-gray-100 px-1 rounded`},`mcp__`,-1),createTextVNode(`): `+toDisplayString(Yh.value.join(`, `)),1)])):createCommentVNode(``,!0)])):zh.value===`mcp`?(openBlock(),createElementBlock(`div`,_hoisted_7$1,[Ph.mcpToolsError?(openBlock(),createElementBlock(`div`,_hoisted_8$1,` ⚠ Could not fetch MCP tool status: `+toDisplayString(Ph.mcpToolsError)+`. Showing all tools regardless of enablement. `,1)):createCommentVNode(``,!0),createVNode$1(SettingsMcpTab_default,{ref_key:`mcpTabRef`,ref:Rh,servers:Vh.value,"docker-mode":Ph.dockerMode,onAdd:eg,onUpdate:tg,onRemove:ng},null,8,[`servers`,`docker-mode`])])):zh.value===`dirs`?(openBlock(),createBlock(SettingsWorkspaceDirsTab_default,{key:3})):zh.value===`refs`?(openBlock(),createBlock(SettingsReferenceDirsTab_default,{key:4})):createCommentVNode(``,!0)]),createBaseVNode(`div`,_hoisted_9$1,[Uh.value?(openBlock(),createElementBlock(`span`,{key:0,class:normalizeClass([`text-xs`,Wh.value?`text-red-600`:`text-green-600`]),"data-testid":`settings-status`},toDisplayString(Uh.value),3)):(openBlock(),createElementBlock(`span`,_hoisted_10$1,` Changes apply on the next message. No restart needed. `)),createBaseVNode(`div`,_hoisted_11$1,[createBaseVNode(`button`,{class:`px-3 py-1.5 text-sm rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,"data-testid":`settings-cancel-btn`,onClick:$h},` Cancel `),createBaseVNode(`button`,{class:`px-3 py-1.5 text-sm rounded bg-blue-500 text-white hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed`,disabled:Gh.value||Kh.value||!!Hh.value,title:Hh.value?`Cannot save until settings load successfully`:void 0,"data-testid":`settings-save-btn`,onClick:Qh},toDisplayString(Gh.value?`Saving…`:Kh.value?`Loading…`:`Save`),9,_hoisted_12$1)])])])])):createCommentVNode(``,!0)}}),SettingsModal_default=SettingsModal_vue_vue_type_script_setup_true_lang_default,ONE_SECOND_MS=1e3,ONE_MINUTE_MS=6e4,SUBPROCESS_PROBE_TIMEOUT_MS=5*ONE_SECOND_MS,CLI_SUBPROCESS_TIMEOUT_MS=5*ONE_MINUTE_MS,_hoisted_1$1={key:0,"data-testid":`notification-toast`,class:`fixed top-4 right-4 z-50 max-w-sm rounded-lg bg-slate-800 text-white shadow-lg p-4 flex items-start gap-3`},_hoisted_2$1={class:`material-icons text-sky-300`,"aria-hidden":`true`},_hoisted_3$1={class:`flex-1 min-w-0`},_hoisted_4$1={class:`text-sm font-medium break-words`},_hoisted_5$1={key:0,class:`mt-0.5 text-xs text-slate-300 break-words`},_hoisted_6$1={class:`mt-1 text-xs text-slate-400`},NotificationToast_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`NotificationToast`,setup(Ph){let Fh=5*ONE_SECOND_MS,{latest:Ih}=useNotifications(),Lh=ref(null),Rh=null;watch(Ih,Ph=>{Ph&&(Lh.value=Ph,Rh!==null&&clearTimeout(Rh),Rh=setTimeout(()=>{Lh.value=null,Rh=null},Fh))});function zh(){Rh!==null&&clearTimeout(Rh),Rh=null,Lh.value=null}function Bh(Ph){return Ph.icon??NOTIFICATION_ICONS[Ph.kind]??`notifications`}return(Ph,Fh)=>(openBlock(),createBlock(Transition,{name:`toast`},{default:withCtx(()=>[Lh.value?(openBlock(),createElementBlock(`div`,_hoisted_1$1,[createBaseVNode(`span`,_hoisted_2$1,toDisplayString(Bh(Lh.value)),1),createBaseVNode(`div`,_hoisted_3$1,[createBaseVNode(`p`,_hoisted_4$1,toDisplayString(Lh.value.title),1),Lh.value.body?(openBlock(),createElementBlock(`p`,_hoisted_5$1,toDisplayString(Lh.value.body),1)):createCommentVNode(``,!0),createBaseVNode(`p`,_hoisted_6$1,toDisplayString(unref(formatSmartTime)(Lh.value.firedAt)),1)]),createBaseVNode(`button`,{type:`button`,class:`text-slate-400 hover:text-white`,"aria-label":`Dismiss`,onClick:zh},[...Fh[0]||=[createBaseVNode(`span`,{class:`material-icons text-base`},`close`,-1)]])])):createCommentVNode(``,!0)]),_:1}))}}),NotificationToast_default=_plugin_vue_export_helper_default(NotificationToast_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-dec9dfbb`]]);function isUserTextResponse(Ph){if(Ph.toolName!==`text-response`)return!1;let Fh=Ph.data;return isRecord(Fh)?Fh.role===`user`:!1}function extractImageData(Ph){let Fh=Ph?.data;if(isRecord(Fh)&&typeof Fh.imageData==`string`)return Fh.imageData}function makeTextResult(Ph,Fh){return{uuid:v4(),toolName:`text-response`,message:Ph,title:Fh===`user`?`You`:`Assistant`,data:{text:Ph,role:Fh,transportKind:`text-rest`}}}function buildAgentRequestBody(Ph){return{message:Ph.message,roleId:Ph.role.id,chatSessionId:Ph.chatSessionId,selectedImageData:Ph.selectedImageData}}async function postAgentRun(Ph){try{let Fh=await apiFetchRaw(API_ROUTES.agent.run,{method:`POST`,body:JSON.stringify(Ph),headers:{"Content-Type":`application/json`}});if(!Fh.ok){let Ph=await Fh.text().catch(()=>``);return{ok:!1,error:`Server error ${Fh.status}: ${Ph.slice(0,200)}`}}return{ok:!0}}catch(Ph){return console.error(`[agent] fetch error:`,Ph),{ok:!1,error:Ph instanceof Error?Ph.message:`Connection error.`}}}function toToolCallEntry(Ph){return{toolUseId:Ph.toolUseId,toolName:Ph.toolName,args:Ph.args,timestamp:Date.now()}}function findPendingToolCall(Ph,Fh){for(let Ih=Ph.length-1;Ih>=0;Ih--){let Lh=Ph[Ih];if(Lh.toolUseId===Fh&&Lh.result===void 0&&Lh.error===void 0)return Lh}}function shouldSelectAssistantText(Ph,Fh){for(let Ih=Fh;Ih<Ph.length;Ih++)if(Ph[Ih].toolName!==`text-response`)return!1;return!0}function pushResult(Ph,Fh){Ph.toolResults.push(Fh),Ph.resultTimestamps.set(Fh.uuid,Date.now())}function pushErrorMessage(Ph,Fh){let Ih=`[Error] ${Fh}`,Lh={uuid:v4(),toolName:`text-response`,message:Ih,title:`Error`,data:{text:Ih,role:`assistant`,transportKind:`text-rest`}};pushResult(Ph,Lh),Ph.selectedResultUuid=Lh.uuid}function beginUserTurn(Ph,Fh){Ph.updatedAt=new Date().toISOString(),pushResult(Ph,makeTextResult(Fh,`user`)),Ph.runStartIndex=Ph.toolResults.length}function appendToLastAssistantText(Ph,Fh){let Ih=Ph.toolResults[Ph.toolResults.length-1],Lh=Ih?.data;return Ih?.toolName!==`text-response`||Lh?.role!==`assistant`?!1:(Lh.text=(Lh.text??``)+Fh,Ih.message=(Ih.message??``)+Fh,!0)}function isDuplicateUserText(Ph,Fh){let Ih=Ph.toolResults[Ph.toolResults.length-1],Lh=Ih?.data;return Ih?.toolName===`text-response`&&Lh?.role===`user`&&Lh?.text===Fh}function applyTextEvent(Ph,Fh,Ih){if(Ih===`user`){isDuplicateUserText(Ph,Fh)||(pushResult(Ph,makeTextResult(Fh,`user`)),Ph.runStartIndex=Ph.toolResults.length);return}if(appendToLastAssistantText(Ph,Fh))return;let Lh=makeTextResult(Fh,`assistant`);pushResult(Ph,Lh),shouldSelectAssistantText(Ph.toolResults,Ph.runStartIndex)&&(Ph.selectedResultUuid=Lh.uuid)}function updateResult(Ph,Fh){let Ih=Ph.toolResults.findIndex(Ph=>Ph.uuid===Fh.uuid);Ih!==-1&&Object.assign(Ph.toolResults[Ih],Fh)}function applyToolResultToSession(Ph,Fh){let Ih=Ph.toolResults.findIndex(Ph=>Ph.uuid===Fh.uuid);Ih>=0?Ph.toolResults[Ih]=Fh:(pushResult(Ph,Fh),Ph.selectedResultUuid=Fh.uuid)}async function applyAgentEvent(Ph,Fh){let{session:Ih}=Fh;switch(Ph.type){case EVENT_TYPES.toolCall:Ih.toolCallHistory.push(toToolCallEntry(Ph)),Fh.scrollSidebarToBottom();return;case EVENT_TYPES.toolCallResult:{let Lh=findPendingToolCall(Ih.toolCallHistory,Ph.toolUseId);Lh&&(Lh.result=Ph.content),Fh.scrollSidebarToBottom();return}case EVENT_TYPES.status:Ih.statusMessage=Ph.message;return;case EVENT_TYPES.switchRole:setTimeout(()=>{Fh.setCurrentRoleId(Ph.roleId),Fh.onRoleChange()},0);return;case EVENT_TYPES.rolesUpdated:await Fh.refreshRoles();return;case EVENT_TYPES.text:applyTextEvent(Ih,Ph.message,Ph.source??`assistant`);return;case EVENT_TYPES.toolResult:applyToolResultToSession(Ih,Ph.result);return;case EVENT_TYPES.error:console.error(`[agent] error event:`,Ph.message),pushErrorMessage(Ih,Ph.message);return;case EVENT_TYPES.sessionFinished:return;case EVENT_TYPES.generationStarted:{let Fh=generationKey(Ph.kind,Ph.filePath,Ph.key);Ih.pendingGenerations[Fh]={kind:Ph.kind,filePath:Ph.filePath,key:Ph.key};return}case EVENT_TYPES.generationFinished:{let Lh=generationKey(Ph.kind,Ph.filePath,Ph.key);delete Ih.pendingGenerations[Lh],Object.keys(Ih.pendingGenerations).length===0&&Fh.onGenerationsDrained();return}}}var TOOL_NAMES={textResponse:`text-response`,manageTodoList:`manageTodoList`,manageScheduler:`manageScheduler`,manageRoles:`manageRoles`,manageSkills:`manageSkills`,manageSource:`manageSource`,manageWiki:`manageWiki`,presentMulmoScript:`presentMulmoScript`,presentDocument:`presentDocument`,presentSpreadsheet:`presentSpreadsheet`,presentHtml:`presentHtml`,presentChart:`presentChart`,presentForm:`presentForm`,present3D:`present3D`,createMindMap:`createMindMap`,generateImage:`generateImage`,editImage:`editImage`,openCanvas:`openCanvas`,putQuestions:`putQuestions`,weather:`weather`,readXPost:`readXPost`,searchX:`searchX`,switchRole:`switchRole`},ALL_TOOL_NAMES=Object.values(TOOL_NAMES),toolNameEnum=_enum(ALL_TOOL_NAMES),RoleSchema=object({id:string(),name:string(),icon:string(),prompt:string(),availablePlugins:array(toolNameEnum),queries:array(string()).optional()}),ROLES=[{id:`general`,name:`General`,icon:`star`,prompt:"You are a helpful assistant with access to the user's workspace. Help with tasks, answer questions, and use available tools when appropriate.\n\n## Wiki\n\nA personal knowledge wiki lives at `data/wiki/` in the workspace. You can build and query it:\n\n- **Ingest**: fetch or read the source, save raw to `data/wiki/sources/<slug>.md`, create/update pages in `data/wiki/pages/`, update `data/wiki/index.md`, append to `data/wiki/log.md`. Call manageWiki with action='index' when done.\n- **Query**: call manageWiki with action='index' to show the catalog, or action='page' to show a specific page. Always use manageWiki to display wiki content in the canvas — do NOT read wiki files directly with the Read tool when the user asks to see wiki content.\n- **Lint**: call manageWiki with action='lint_report', then fix issues found.\n\nPage format: YAML frontmatter (title, created, updated, tags) + markdown body + `[[wiki links]]` for cross-references. Slugs are lowercase hyphen-separated. Always keep `data/wiki/index.md` current and append to `data/wiki/log.md` after any change. Read `config/helps/wiki.md` for full details.",availablePlugins:[`manageTodoList`,`manageScheduler`,`manageWiki`,`manageSkills`,`manageSource`,`presentDocument`,`createMindMap`,`presentHtml`,`presentChart`,`readXPost`,`searchX`,`switchRole`],queries:[`Tell me about this app, MulmoClaude.`,`What is wiki in this app and how to use it?`,`How do I use the Telegram bridge to talk to MulmoClaude from my phone?`,`Show my wiki index`,`Lint my wiki`,`Show my todo list`,`Show me the scheduler`]},{id:`office`,name:`Office`,icon:`business_center`,prompt:`You are a professional office assistant. Create and edit documents, spreadsheets, and presentations. Read existing files in the workspace for context.
|
|
4749
|
+
mcp__claude_ai_Google_Calendar`,"data-testid":`settings-tools-textarea`,onKeydown:Ih[5]||=withModifiers(()=>{},[`stop`])},null,544),[[vModelText,Bh.value]])]),Yh.value.length>0?(openBlock(),createElementBlock(`p`,_hoisted_6$2,[Ih[10]||=createTextVNode(` These look non-standard (expected prefix `,-1),Ih[11]||=createBaseVNode(`code`,{class:`bg-gray-100 px-1 rounded`},`mcp__`,-1),createTextVNode(`): `+toDisplayString(Yh.value.join(`, `)),1)])):createCommentVNode(``,!0)])):zh.value===`mcp`?(openBlock(),createElementBlock(`div`,_hoisted_7$1,[Ph.mcpToolsError?(openBlock(),createElementBlock(`div`,_hoisted_8$1,` ⚠ Could not fetch MCP tool status: `+toDisplayString(Ph.mcpToolsError)+`. Showing all tools regardless of enablement. `,1)):createCommentVNode(``,!0),createVNode$1(SettingsMcpTab_default,{ref_key:`mcpTabRef`,ref:Rh,servers:Vh.value,"docker-mode":Ph.dockerMode,onAdd:eg,onUpdate:tg,onRemove:ng},null,8,[`servers`,`docker-mode`])])):zh.value===`dirs`?(openBlock(),createBlock(SettingsWorkspaceDirsTab_default,{key:3})):zh.value===`refs`?(openBlock(),createBlock(SettingsReferenceDirsTab_default,{key:4})):createCommentVNode(``,!0)]),createBaseVNode(`div`,_hoisted_9$1,[Uh.value?(openBlock(),createElementBlock(`span`,{key:0,class:normalizeClass([`text-xs`,Wh.value?`text-red-600`:`text-green-600`]),"data-testid":`settings-status`},toDisplayString(Uh.value),3)):(openBlock(),createElementBlock(`span`,_hoisted_10$1,` Changes apply on the next message. No restart needed. `)),createBaseVNode(`div`,_hoisted_11$1,[createBaseVNode(`button`,{class:`px-3 py-1.5 text-sm rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,"data-testid":`settings-cancel-btn`,onClick:$h},` Cancel `),createBaseVNode(`button`,{class:`px-3 py-1.5 text-sm rounded bg-blue-500 text-white hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed`,disabled:Gh.value||Kh.value||!!Hh.value,title:Hh.value?`Cannot save until settings load successfully`:void 0,"data-testid":`settings-save-btn`,onClick:Qh},toDisplayString(Gh.value?`Saving…`:Kh.value?`Loading…`:`Save`),9,_hoisted_12$1)])])])])):createCommentVNode(``,!0)}}),SettingsModal_default=SettingsModal_vue_vue_type_script_setup_true_lang_default,ONE_SECOND_MS=1e3,ONE_MINUTE_MS=6e4,SUBPROCESS_PROBE_TIMEOUT_MS=5*ONE_SECOND_MS,CLI_SUBPROCESS_TIMEOUT_MS=5*ONE_MINUTE_MS,_hoisted_1$1={key:0,"data-testid":`notification-toast`,class:`fixed top-4 right-4 z-50 max-w-sm rounded-lg bg-slate-800 text-white shadow-lg p-4 flex items-start gap-3`},_hoisted_2$1={class:`material-icons text-sky-300`,"aria-hidden":`true`},_hoisted_3$1={class:`flex-1 min-w-0`},_hoisted_4$1={class:`text-sm font-medium break-words`},_hoisted_5$1={key:0,class:`mt-0.5 text-xs text-slate-300 break-words`},_hoisted_6$1={class:`mt-1 text-xs text-slate-400`},NotificationToast_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`NotificationToast`,setup(Ph){let Fh=5*ONE_SECOND_MS,{latest:Ih}=useNotifications(),Lh=ref(null),Rh=null;watch(Ih,Ph=>{Ph&&(Lh.value=Ph,Rh!==null&&clearTimeout(Rh),Rh=setTimeout(()=>{Lh.value=null,Rh=null},Fh))});function zh(){Rh!==null&&clearTimeout(Rh),Rh=null,Lh.value=null}function Bh(Ph){return Ph.icon??NOTIFICATION_ICONS[Ph.kind]??`notifications`}return(Ph,Fh)=>(openBlock(),createBlock(Transition,{name:`toast`},{default:withCtx(()=>[Lh.value?(openBlock(),createElementBlock(`div`,_hoisted_1$1,[createBaseVNode(`span`,_hoisted_2$1,toDisplayString(Bh(Lh.value)),1),createBaseVNode(`div`,_hoisted_3$1,[createBaseVNode(`p`,_hoisted_4$1,toDisplayString(Lh.value.title),1),Lh.value.body?(openBlock(),createElementBlock(`p`,_hoisted_5$1,toDisplayString(Lh.value.body),1)):createCommentVNode(``,!0),createBaseVNode(`p`,_hoisted_6$1,toDisplayString(unref(formatSmartTime)(Lh.value.firedAt)),1)]),createBaseVNode(`button`,{type:`button`,class:`text-slate-400 hover:text-white`,"aria-label":`Dismiss`,onClick:zh},[...Fh[0]||=[createBaseVNode(`span`,{class:`material-icons text-base`},`close`,-1)]])])):createCommentVNode(``,!0)]),_:1}))}}),NotificationToast_default=_plugin_vue_export_helper_default(NotificationToast_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-28eac2ce`]]);function isUserTextResponse(Ph){if(Ph.toolName!==`text-response`)return!1;let Fh=Ph.data;return isRecord(Fh)?Fh.role===`user`:!1}function extractImageData(Ph){let Fh=Ph?.data;if(isRecord(Fh)&&typeof Fh.imageData==`string`)return Fh.imageData}function makeTextResult(Ph,Fh){return{uuid:v4(),toolName:`text-response`,message:Ph,title:Fh===`user`?`You`:`Assistant`,data:{text:Ph,role:Fh,transportKind:`text-rest`}}}function buildAgentRequestBody(Ph){return{message:Ph.message,roleId:Ph.role.id,chatSessionId:Ph.chatSessionId,selectedImageData:Ph.selectedImageData}}async function postAgentRun(Ph){try{let Fh=await apiFetchRaw(API_ROUTES.agent.run,{method:`POST`,body:JSON.stringify(Ph),headers:{"Content-Type":`application/json`}});if(!Fh.ok){let Ph=await Fh.text().catch(()=>``);return{ok:!1,error:`Server error ${Fh.status}: ${Ph.slice(0,200)}`}}return{ok:!0}}catch(Ph){return console.error(`[agent] fetch error:`,Ph),{ok:!1,error:Ph instanceof Error?Ph.message:`Connection error.`}}}function toToolCallEntry(Ph){return{toolUseId:Ph.toolUseId,toolName:Ph.toolName,args:Ph.args,timestamp:Date.now()}}function findPendingToolCall(Ph,Fh){for(let Ih=Ph.length-1;Ih>=0;Ih--){let Lh=Ph[Ih];if(Lh.toolUseId===Fh&&Lh.result===void 0&&Lh.error===void 0)return Lh}}function shouldSelectAssistantText(Ph,Fh){for(let Ih=Fh;Ih<Ph.length;Ih++)if(Ph[Ih].toolName!==`text-response`)return!1;return!0}function pushResult(Ph,Fh){Ph.toolResults.push(Fh),Ph.resultTimestamps.set(Fh.uuid,Date.now())}function pushErrorMessage(Ph,Fh){let Ih=`[Error] ${Fh}`,Lh={uuid:v4(),toolName:`text-response`,message:Ih,title:`Error`,data:{text:Ih,role:`assistant`,transportKind:`text-rest`}};pushResult(Ph,Lh),Ph.selectedResultUuid=Lh.uuid}function beginUserTurn(Ph,Fh){Ph.updatedAt=new Date().toISOString(),pushResult(Ph,makeTextResult(Fh,`user`)),Ph.runStartIndex=Ph.toolResults.length}function appendToLastAssistantText(Ph,Fh){let Ih=Ph.toolResults[Ph.toolResults.length-1],Lh=Ih?.data;return Ih?.toolName!==`text-response`||Lh?.role!==`assistant`?!1:(Lh.text=(Lh.text??``)+Fh,Ih.message=(Ih.message??``)+Fh,!0)}function isDuplicateUserText(Ph,Fh){let Ih=Ph.toolResults[Ph.toolResults.length-1],Lh=Ih?.data;return Ih?.toolName===`text-response`&&Lh?.role===`user`&&Lh?.text===Fh}function applyTextEvent(Ph,Fh,Ih){if(Ih===`user`){isDuplicateUserText(Ph,Fh)||(pushResult(Ph,makeTextResult(Fh,`user`)),Ph.runStartIndex=Ph.toolResults.length);return}if(appendToLastAssistantText(Ph,Fh))return;let Lh=makeTextResult(Fh,`assistant`);pushResult(Ph,Lh),shouldSelectAssistantText(Ph.toolResults,Ph.runStartIndex)&&(Ph.selectedResultUuid=Lh.uuid)}function updateResult(Ph,Fh){let Ih=Ph.toolResults.findIndex(Ph=>Ph.uuid===Fh.uuid);Ih!==-1&&Object.assign(Ph.toolResults[Ih],Fh)}function applyToolResultToSession(Ph,Fh){let Ih=Ph.toolResults.findIndex(Ph=>Ph.uuid===Fh.uuid);Ih>=0?Ph.toolResults[Ih]=Fh:(pushResult(Ph,Fh),Ph.selectedResultUuid=Fh.uuid)}async function applyAgentEvent(Ph,Fh){let{session:Ih}=Fh;switch(Ph.type){case EVENT_TYPES.toolCall:Ih.toolCallHistory.push(toToolCallEntry(Ph)),Fh.scrollSidebarToBottom();return;case EVENT_TYPES.toolCallResult:{let Lh=findPendingToolCall(Ih.toolCallHistory,Ph.toolUseId);Lh&&(Lh.result=Ph.content),Fh.scrollSidebarToBottom();return}case EVENT_TYPES.status:Ih.statusMessage=Ph.message;return;case EVENT_TYPES.switchRole:setTimeout(()=>{Fh.setCurrentRoleId(Ph.roleId),Fh.onRoleChange()},0);return;case EVENT_TYPES.rolesUpdated:await Fh.refreshRoles();return;case EVENT_TYPES.text:applyTextEvent(Ih,Ph.message,Ph.source??`assistant`);return;case EVENT_TYPES.toolResult:applyToolResultToSession(Ih,Ph.result);return;case EVENT_TYPES.error:console.error(`[agent] error event:`,Ph.message),pushErrorMessage(Ih,Ph.message);return;case EVENT_TYPES.sessionFinished:return;case EVENT_TYPES.generationStarted:{let Fh=generationKey(Ph.kind,Ph.filePath,Ph.key);Ih.pendingGenerations[Fh]={kind:Ph.kind,filePath:Ph.filePath,key:Ph.key};return}case EVENT_TYPES.generationFinished:{let Lh=generationKey(Ph.kind,Ph.filePath,Ph.key);delete Ih.pendingGenerations[Lh],Object.keys(Ih.pendingGenerations).length===0&&Fh.onGenerationsDrained();return}}}var TOOL_NAMES={textResponse:`text-response`,manageTodoList:`manageTodoList`,manageScheduler:`manageScheduler`,manageRoles:`manageRoles`,manageSkills:`manageSkills`,manageSource:`manageSource`,manageWiki:`manageWiki`,presentMulmoScript:`presentMulmoScript`,presentDocument:`presentDocument`,presentSpreadsheet:`presentSpreadsheet`,presentHtml:`presentHtml`,presentChart:`presentChart`,presentForm:`presentForm`,present3D:`present3D`,createMindMap:`createMindMap`,generateImage:`generateImage`,editImage:`editImage`,openCanvas:`openCanvas`,putQuestions:`putQuestions`,weather:`weather`,readXPost:`readXPost`,searchX:`searchX`,switchRole:`switchRole`},ALL_TOOL_NAMES=Object.values(TOOL_NAMES),toolNameEnum=_enum(ALL_TOOL_NAMES),RoleSchema=object({id:string(),name:string(),icon:string(),prompt:string(),availablePlugins:array(toolNameEnum),queries:array(string()).optional()}),ROLES=[{id:`general`,name:`General`,icon:`star`,prompt:"You are a helpful assistant with access to the user's workspace. Help with tasks, answer questions, and use available tools when appropriate.\n\n## Wiki\n\nA personal knowledge wiki lives at `data/wiki/` in the workspace. You can build and query it:\n\n- **Ingest**: fetch or read the source, save raw to `data/wiki/sources/<slug>.md`, create/update pages in `data/wiki/pages/`, update `data/wiki/index.md`, append to `data/wiki/log.md`. Call manageWiki with action='index' when done.\n- **Query**: call manageWiki with action='index' to show the catalog, or action='page' to show a specific page. Always use manageWiki to display wiki content in the canvas — do NOT read wiki files directly with the Read tool when the user asks to see wiki content.\n- **Lint**: call manageWiki with action='lint_report', then fix issues found.\n\nPage format: YAML frontmatter (title, created, updated, tags) + markdown body + `[[wiki links]]` for cross-references. Slugs are lowercase hyphen-separated. Always keep `data/wiki/index.md` current and append to `data/wiki/log.md` after any change. Read `config/helps/wiki.md` for full details.",availablePlugins:[`manageTodoList`,`manageScheduler`,`manageWiki`,`manageSkills`,`manageSource`,`presentDocument`,`createMindMap`,`presentHtml`,`presentChart`,`readXPost`,`searchX`,`switchRole`],queries:[`Tell me about this app, MulmoClaude.`,`What is wiki in this app and how to use it?`,`How do I use the Telegram bridge to talk to MulmoClaude from my phone?`,`Show my wiki index`,`Lint my wiki`,`Show my todo list`,`Show me the scheduler`]},{id:`office`,name:`Office`,icon:`business_center`,prompt:`You are a professional office assistant. Create and edit documents, spreadsheets, and presentations. Read existing files in the workspace for context.
|
|
4750
4750
|
|
|
4751
4751
|
For multi-slide presentations, use presentMulmoScript. Follow the template and rules in config/helps/business.md exactly.
|
|
4752
4752
|
|