mulmoclaude 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-WdrBPTib.js","assets/preload-helper-DjzSQ1t3.js","assets/purify.es--06brOip.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-DW_6BPHk.js","assets/vue.runtime.esm-bundler-DbiEnlk_.js","assets/chunk-VPRB5NB3-DJwzxOvX.js","assets/chunk-3YJQHVM4-B7k0Ax1Y.js","assets/dist-DZ6DeOnT.js","assets/chunk-HJ2JQQFS-BUkLVG5Q.js","assets/chunk-E2ZNV5FY-BxnF7m7I.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-4EA7E6EY-B6wa0jVq.js","assets/chunk-XC4XBNZT-Vf-SY2dZ.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-DBDB3WZW-D_vtcaIV.js","assets/chunk-2BW5OAIV-B9pYIv_I.js","assets/line-CurEgqao.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-NTY3LDVX-CezxuLni.js","assets/marp-YZRvgIPH.js","assets/__vite-browser-external-DqEzMOO6.js","assets/mathjax-CKUsPrGp.js","assets/PrioritizedList-eJRu6WvY.js","assets/liteAdaptor-B0eis_j_.js","assets/Options-CYbTeauH.js","assets/Element-B42_M0OM.js","assets/Entities-BfRsJZ6m.js","assets/Styles-DPGs4Hx-.js","assets/html-BflDrDmz.js","assets/InputJax-DUzWklmz.js","assets/FunctionList-CC730Pv3.js","assets/OutputJax-DDdLZyyK.js","assets/MathItem-N3JGdklA.js","assets/MmlFactory-BJkVyfsg.js","assets/mo-DaYH2rk3.js","assets/TeXAtom-enlUz5U6.js","assets/tex-DpoKXVoQ.js","assets/BaseConfiguration-C_BgfgNn.js","assets/lengths-C7yT5v5h.js","assets/AllPackages-DwgnOrIx.js","assets/svg-DshK0DeA.js","assets/assistive-mml-BidX9pmv.js","assets/manifold-BwDb_BB5.js","assets/html2canvas-D0m9Y8pD-BsUGnk_5.js","assets/style-CCV5GAnU-D55tgtzm.js","assets/index.es-HSMDtZ_a-DbgeZZaz.js","assets/typeof-CcP5rTWg-B5XbjTb1.js","assets/heic2any-CqvOYQny.js","assets/JsonEditor-zdl4EA3_.js","assets/vue-i18n-BPKcFpbw.js","assets/_plugin-vue_export-helper-BDNMzG2s.js","assets/JsonEditor-CPJfn76E.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-WdrBPTib.js","assets/preload-helper-DjzSQ1t3.js","assets/purify.es--06brOip.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-DW_6BPHk.js","assets/vue.runtime.esm-bundler-DbiEnlk_.js","assets/chunk-VPRB5NB3-DJwzxOvX.js","assets/chunk-3YJQHVM4-B7k0Ax1Y.js","assets/dist-DZ6DeOnT.js","assets/chunk-HJ2JQQFS-BUkLVG5Q.js","assets/chunk-E2ZNV5FY-BxnF7m7I.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-4EA7E6EY-B6wa0jVq.js","assets/chunk-XC4XBNZT-Vf-SY2dZ.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-DBDB3WZW-D_vtcaIV.js","assets/chunk-2BW5OAIV-B9pYIv_I.js","assets/line-CurEgqao.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-NTY3LDVX-CezxuLni.js","assets/marp-BvWwTP5d.js","assets/__vite-browser-external-DqEzMOO6.js","assets/mathjax-CKUsPrGp.js","assets/PrioritizedList-eJRu6WvY.js","assets/liteAdaptor-B0eis_j_.js","assets/Options-CYbTeauH.js","assets/Element-B42_M0OM.js","assets/Entities-BfRsJZ6m.js","assets/Styles-DPGs4Hx-.js","assets/html-BflDrDmz.js","assets/InputJax-DUzWklmz.js","assets/FunctionList-CC730Pv3.js","assets/OutputJax-DDdLZyyK.js","assets/MathItem-N3JGdklA.js","assets/MmlFactory-BJkVyfsg.js","assets/mo-DaYH2rk3.js","assets/TeXAtom-enlUz5U6.js","assets/tex-DpoKXVoQ.js","assets/BaseConfiguration-C_BgfgNn.js","assets/lengths-C7yT5v5h.js","assets/AllPackages-DwgnOrIx.js","assets/svg-DshK0DeA.js","assets/assistive-mml-BidX9pmv.js","assets/manifold-BwDb_BB5.js","assets/html2canvas-D0m9Y8pD-BsUGnk_5.js","assets/style-CCV5GAnU-D55tgtzm.js","assets/index.es-HSMDtZ_a-DbgeZZaz.js","assets/typeof-CcP5rTWg-B5XbjTb1.js","assets/heic2any-CqvOYQny.js","assets/JsonEditor-BC9ITErx.js","assets/vue-i18n-BPKcFpbw.js","assets/_plugin-vue_export-helper-BDNMzG2s.js","assets/JsonEditor-CPJfn76E.css"])))=>i.map(i=>d[i]);
2
2
  import{$ as e,$n as t,Ar as n,At as r,C as i,Cr as a,Ct as o,D as s,Dr as c,E as l,En as u,Er as d,Fn as f,Fr as p,G as m,Gn as h,Hn as g,Ht as _,In as v,Ir as y,J as b,Jn as x,K as S,Kt as C,Lt as w,Mr as T,Nr as E,P as D,Pr as O,Pt as k,Qt as A,R as j,Rn as M,Rr as N,Rt as P,S as F,Sr as I,T as L,Tr as R,Wn as z,Wt as B,Xn as V,Xt as H,Y as U,Yn as ee,Zn as te,Zt as ne,_r as re,a as ie,b as ae,bn as oe,br as W,cn as se,cr as ce,d as le,dn as ue,dr as de,en as fe,fn as G,fr as pe,ft as me,gr as he,h as ge,hr as _e,ht as ve,it as K,jr as ye,jt as be,kr as xe,kt as Se,lr as Ce,mr as we,n as Te,nr as Ee,nt as De,or as q,pr as Oe,q as ke,rt as Ae,sr as je,tr as Me,tt as J,ur as Ne,vr as Pe,w as Fe,wn as Ie,wr as Le,wt as Re,x as ze,xr as Be,yn as Ve,yr as He,zr as Ue}from"./vue.runtime.esm-bundler-DbiEnlk_.js";import{n as We,t as Ge}from"./vue-i18n-BPKcFpbw.js";import{a as Ke,i as qe,n as Je,t as Ye}from"./vue-DqDQKO-Y.js";import{t as Xe}from"./preload-helper-DjzSQ1t3.js";import{t as Ze}from"./purify.es--06brOip.js";import{t as Qe}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{t as $e}from"./style-CCV5GAnU-D55tgtzm.js";import{t as et}from"./typeof-CcP5rTWg-B5XbjTb1.js";import{t as tt}from"./v4-DDdyfk2q.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),Object.freeze({min:0,max:65535});function nt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rt(e){return typeof e==`object`&&!!e}function it(e){return Array.isArray(e)}function at(e,t){return nt(e)&&typeof e[t]==`string`}function ot(e,t){return e instanceof Error?e.message:at(e,`details`)&&e.details?e.details:at(e,`message`)&&e.message?e.message:t===void 0?String(e):t}var st=new Map([[`&`,`&amp;`],[`<`,`&lt;`],[`>`,`&gt;`],[`"`,`&quot;`],[`'`,`&#39;`]]);function ct(e){return e.replace(/[&<>"']/g,e=>st.get(e)??e)}var lt=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Date;function ut(e){return e==null||!lt(e)?null:e instanceof Date?Number.isNaN(e.getTime())?null:e.toISOString():String(e)}function dt(e,t=``){return ut(e)??t}var ft=new Set([`derived`,`embed`,`backlinks`,`rollup`,`toggle`,`flag`]);function pt(e,t){return e.type===`embed`?e.id?e.id:e.idField&&t?dt(t[e.idField]):``:``}var mt=8;function ht(e,t,n=mt){let r=t();for(let i=0;i<n&&e.has(r);i++)r=t();return r}function gt(e,t,n,r=mt){return ht(new Set(e.map(e=>dt(e[t]))),n,r)}var _t=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{9}Z$/,vt=1e3,yt=1e6,bt=e=>{if(typeof e!=`string`||!_t.test(e)||e.startsWith(`0000-`))return!1;let t=Date.parse(`${e.slice(0,19)}Z`);return!Number.isNaN(t)&&new Date(t).toISOString().slice(0,19)===e.slice(0,19)};function xt(e){if(!bt(e))return null;let t=Date.parse(`${e.slice(0,19)}Z`);if(Number.isNaN(t))return null;let n=Number(e.slice(20,29));return{seconds:Math.floor(t/vt),nanoseconds:n}}function St(e){let t=xt(e);return t===null?null:t.seconds*vt+Math.floor(t.nanoseconds/yt)}var Ct={violet:`bg-violet-50 text-violet-700`,indigo:`bg-indigo-50 text-indigo-700`,sky:`bg-sky-50 text-sky-700`,teal:`bg-teal-50 text-teal-700`,emerald:`bg-emerald-50 text-emerald-700`,lime:`bg-lime-50 text-lime-700`,fuchsia:`bg-fuchsia-50 text-fuchsia-700`};function wt(e){return typeof e==`string`&&Object.hasOwn(Ct,e)}function Tt(e){return wt(e)?Ct[e]:null}var Et=864e5,Dt=/^(\d{4})-(\d{2})-(\d{2})$/,Ot=/^\d{2}$/,kt=/(\d{1,2}):(\d{2})/g,At=/[-–—~〜~]/,jt=1440;function Mt(e){return String(e).padStart(2,`0`)}function Nt(e){return`${String(e.year).padStart(4,`0`)}-${Mt(e.month)}-${Mt(e.day)}`}function Pt(e){if(typeof e!=`string`)return null;let t=Dt.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),a=new Date(Date.UTC(n,r-1,i));return a.getUTCFullYear()!==n||a.getUTCMonth()!==r-1||a.getUTCDate()!==i?null:{year:n,month:r,day:i}}function Ft(e,t){return e<0||e>23||t<0||t>59?null:e*60+t}function It(e){if(typeof e!=`string`)return null;let t=e.trim(),n=t.indexOf(`T`);if(n===-1)return null;let r=Pt(t.slice(0,n));if(!r)return null;let i=t.slice(n+1).split(`:`);if(i.length<2||i.length>3||!i.every(e=>Ot.test(e)))return null;let a=Ft(Number(i[0]),Number(i[1]));return a===null?null:{ymd:r,minutes:a}}function Lt(e){let t=St(e);if(t===null)return null;let n=new Date(t);return{ymd:{year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate()},minutes:n.getHours()*60+n.getMinutes()}}function Rt(e){return Pt(e)??It(e)?.ymd??Lt(e)?.ymd??null}function zt(e){return It(e)?.minutes??Lt(e)?.minutes??null}function Bt(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;let n=[...t.matchAll(kt)];if(n.length===0)return null;let r=e=>Ft(Number(e[1]),Number(e[2]));if(!At.test(t)){let[e]=n,t=e?r(e):null;return t===null?null:{startMin:t,endMin:null}}let i=t.search(At),a=null,o=null;for(let e of n)(e.index??0)<i?a=r(e):o=r(e);return a===null?null:{startMin:a,endMin:o}}function Vt(e){return Date.UTC(e.year,e.month-1,e.day)}function Ht(e){let t=new Date(e);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate()}}function Ut(e,t){return Vt(e)-Vt(t)}function Wt(e,t){return Ut(e.start,t)<=0&&Ut(t,e.end)<=0}function Gt(e,t,n=0){let r=(new Date(Date.UTC(e,t-1,1)).getUTCDay()-n+7)%7,i=Date.UTC(e,t-1,1)-r*Et,a=[];for(let n=0;n<42;n++){let r=Ht(i+n*Et);a.push({ymd:r,inMonth:r.year===e&&r.month===t,key:Nt(r)})}return a}function Kt(e,t,n,r,i={}){let a=Zt(e,t,n);return a?Qt(i.endExclusive&&n!==void 0?Xt(a,e[n]):a,r?e[r]:void 0):null}function qt(e,t){return{endExclusive:(t===void 0?void 0:e.googleCalendar?.map[t])===`end`}}var Jt=/T00:00(?::00)?$/;function Yt(e){return Pt(e)!==null||typeof e==`string`&&It(e)!==null&&Jt.test(e.trim())}function Xt(e,t){if(!Yt(t)||Ut(e.end,e.start)<=0)return e;let n=Ht(Vt(e.end)-Et),r=e.endMin===0||e.startMin!==null;return{...e,end:n,endMin:r?jt:null}}function Zt(e,t,n){let r=e[t],i=Rt(r);if(!i)return null;let a=n?e[n]:void 0,o=Rt(a),s=o!==null&&Ut(o,i)>=0?o:null;return{item:e,start:i,end:s??i,startMin:zt(r),endMin:s?zt(a):null}}function Qt(e,t){if(e.startMin!==null||e.endMin!==null)return e;let n=Bt(t);return n?{...e,startMin:n.startMin,endMin:n.endMin}:e}function $t(e,t,n,r,i={}){let a=[],o=[];for(let s of e){let e=Kt(s,t,n,r,i);e?a.push(e):o.push(s)}return a.sort((e,t)=>Ut(e.start,t.start)),{spans:a,noDate:o}}function en(e,t){if(!Wt(e,t))return null;let{startMin:n,endMin:r}=e;if(n===null&&r===null)return{kind:`allDay`,startMin:0,endMin:jt,bleedsBefore:!1,bleedsAfter:!1};let i=Ut(e.start,e.end)===0,a=Ut(t,e.start)===0,o=Ut(t,e.end)===0;if(i&&n!==null&&r===null)return{kind:`line`,startMin:n,endMin:n,bleedsBefore:!1,bleedsAfter:!1};let s=a&&n!==null?n:0,c=o&&r!==null?r:jt;return i&&c<=s?{kind:`line`,startMin:s,endMin:s,bleedsBefore:!1,bleedsAfter:!1}:{kind:`block`,startMin:s,endMin:c,bleedsBefore:!a,bleedsAfter:!o}}function tn(e){return[...e.entries()].map(([e,t])=>({index:e,span:t})).sort((e,t)=>e.span.startMin-t.span.startMin||e.span.endMin-t.span.endMin)}function nn(e){let t=e.reduce((e,t)=>e.current.length>0&&t.span.startMin>=e.end?(e.done.push(e.current),{done:e.done,current:[t],end:t.span.endMin}):(e.current.push(t),{done:e.done,current:e.current,end:Math.max(e.end,t.span.endMin)}),{done:[],current:[],end:-1/0});return t.current.length>0&&t.done.push(t.current),t.done}function rn(e){let t=[];return e.map(({index:e,span:n})=>{let r=t.findIndex(e=>e<=n.startMin),i=r===-1?t.length:r;return t[i]=n.endMin,{index:e,lane:i}}).map(({index:e,lane:n})=>[e,{lane:n,lanes:t.length}])}function an(e){let t=nn(tn(e)),n=new Map(t.flatMap(rn));return e.map((e,t)=>n.get(t)??{lane:0,lanes:1})}function on(){return crypto.randomUUID().replace(/-/g,``)}function sn(e){return e.type!==`enum`||e.default===void 0?null:e.values.includes(e.default)?e.default:null}function cn(e,t){if(!e)return!0;let n=ut(t[e.field]);return n!==null&&e.in.includes(n)}function ln(e,t){return cn(e.when??e.require,t)}function un(e,t){return t===void 0?`collection/${e}`:`item/${t}/${e}`}function dn(e,t){return cn(e.when,t)}function fn(e,t,n){if(Object.hasOwn(t,e))return ut(t[e])===n;let r=e.indexOf(`.`);if(r===-1)return!1;let i=e.slice(0,r),a=e.slice(r+1),o=t[i];return it(o)?o.some(e=>nt(e)&&ut(e[a])===n):!1}function pn(e,t,n){return t?n.filter(n=>fn(e.via,n,t)&&cn(e.filter,n)):[]}function mn(e){return typeof e==`number`?e:typeof e==`string`&&e.trim()!==``?Number(e):NaN}function hn(e,t,n){let r=pn(e,t,n);if(e.op===`count`)return r.length;let i=0;for(let t of r){let n=mn(e.column===void 0?void 0:t[e.column]);Number.isFinite(n)&&(i+=n)}return i}function gn(e){let t=new Set,n=e=>{for(let r of Object.values(e))r.type===`ref`&&typeof r.to==`string`&&r.to.length>0&&t.add(r.to),r.type===`table`&&r.of&&n(r.of)};return n(e.fields),[...t]}function _n(e){let t=new Set;for(let n of Object.values(e.fields))n.type===`embed`&&typeof n.to==`string`&&n.to.length>0&&t.add(n.to);return[...t]}function vn(e){let t=new Set;for(let n of Object.values(e.fields))(n.type===`backlinks`||n.type===`rollup`)&&n.from.length>0&&t.add(n.from);return[...t]}function yn(e){return e==null}function bn(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function xn(e,t,n){if(!e.valueFrom)return e.value;let{record:r,field:i}=e.valueFrom,a=r===void 0?t:bn(n,r),o=a===void 0?void 0:bn(a,i);return yn(o)?void 0:String(o)}function Sn(e,t,n){return e===`gt`?t>n:e===`gte`?t>=n:e===`lt`?t<n:t<=n}function Cn(e){return e.trim()===``?NaN:Number(e)}function wn(e,t,n){if(Array.isArray(n))return!1;let r=Cn(t),i=Cn(n);return Number.isNaN(r)||Number.isNaN(i)?!1:Sn(e,r,i)}function Tn(e,t,n){switch(e){case`eq`:return t===String(n);case`ne`:return t!==String(n);case`in`:return Array.isArray(n)&&n.includes(t);case`contains`:return t.includes(String(n));case`gt`:case`gte`:case`lt`:case`lte`:return wn(e,t,n);default:return!1}}function En(e,t,n){let r=bn(t,e.field);if(yn(r))return e.op===`ne`;let i=xn(e,t,n);return i!==void 0&&Tn(e.op,String(r),i)}function Dn(e,t,n={}){return e.every(e=>En(e,t,n))}function On(e,t){let{completionField:n,completionDoneValues:r}=e;if(!n)return!1;let i=e.fields?.[n];if(i?.type===`flag`&&i.where)return Dn(i.where,t);if(!r)return!1;let a=ut(t[n]);return a!==null&&r.includes(a)}function kn(e){let{completionField:t,completionDoneValues:n}=e;if(n?.length!==1)return!1;let[r]=n;return e.fields[t??``]?.type===`boolean`?r===`true`:Object.values(e.fields).some(e=>e.type===`toggle`&&e.field===t&&e.onValue===r)}function An(e,t){return t.type===`toggle`&&dt(e[t.field])===t.onValue}function jn(e,t){return e[t]===!0}function Mn(e,t,n,r){if(e.synthetic)return On(t,n);let i=t.fields[e.key];return i?.type===`toggle`?An(n,i):i?.type===`boolean`?n[e.key]===!0:jn(r(n),e.key)}function Nn(e,t){let n;try{n=Bn(e)}catch{return null}let r=new Gn(n),i;try{if(i=r.parseExpr(),!r.atEnd())return null}catch{return null}let a=Kn(i,t);return Number.isFinite(a)?a:null}var Pn=[`(`,`)`,`+`,`-`,`*`,`/`,`.`];function Fn(e){return Pn.some(t=>t===e)}function In(e){let t=e.input[e.index];return t===` `||t===` `||t===`
3
3
  `?(e.index++,!0):!1}function Ln(e){let t=e.input[e.index]??``,n=e.input[e.index+1]??``;if(!Vn(t)&&!(t===`.`&&Vn(n)))return null;let r=``;for(;e.index<e.input.length;){let t=e.input[e.index]??``;if(!Vn(t)&&t!==`.`)break;r+=t,e.index++}let i=Number(r);if(!Number.isFinite(i))throw Error(`bad number`);return{kind:`number`,value:i}}function Rn(e){if(!Hn(e.input[e.index]??``))return null;let t=``;for(;e.index<e.input.length&&Un(e.input[e.index]??``);)t+=e.input[e.index],e.index++;return{kind:`ident`,value:t}}function zn(e){let t=e.input[e.index]??``;return t===`[`&&e.input[e.index+1]===`]`?(e.index+=2,{kind:`[]`}):Fn(t)?(e.index++,{kind:t}):null}function Bn(e){let t=[],n={input:e,index:0};for(;n.index<e.length;){if(In(n))continue;let r=Ln(n);if(r){t.push(r);continue}let i=zn(n);if(i){t.push(i);continue}let a=Rn(n);if(a){t.push(a);continue}throw Error(`unexpected char ${e[n.index]}`)}return t}function Vn(e){return e>=`0`&&e<=`9`}function Hn(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`_`}function Un(e){return Hn(e)||Vn(e)}function eee(e){return e===`+`||e===`-`?e:null}function Wn(e){return e===`*`||e===`/`?e:null}var Gn=class{tokens;cursor=0;constructor(e){this.tokens=e}atEnd(){return this.cursor>=this.tokens.length}peek(){return this.tokens[this.cursor]}consume(){let e=this.tokens[this.cursor++];if(!e)throw Error(`unexpected end of input`);return e}expectPunct(e){let t=this.consume();if(t.kind!==e)throw Error(`expected ${e}, got ${t.kind}`)}expectIdent(){let e=this.consume();if(e.kind!==`ident`)throw Error(`expected ident, got ${e.kind}`);return e.value}takeOperator(e){let t=e(this.peek()?.kind);return t&&this.consume(),t}*operatorRun(e){for(;;){let t=this.takeOperator(e);if(!t)return;yield t}}parseChain(e,t){let n=t(),r=[];for(let n of this.operatorRun(e))r.push({operator:n,right:t()});return r.reduce((e,{operator:t,right:n})=>({kind:`binop`,operator:t,left:e,right:n}),n)}parseExpr(){return this.parseChain(eee,()=>this.parseTerm())}parseTerm(){return this.parseChain(Wn,()=>this.parseFactor())}parseFactor(){let e=this.peek();if(!e)throw Error(`unexpected end in factor`);if(e.kind===`number`)return this.consume(),{kind:`num`,value:e.value};if(e.kind===`(`){this.consume();let e=this.parseExpr();return this.expectPunct(`)`),e}if(e.kind===`ident`)return this.parseIdentFactor(e.value);throw Error(`unexpected token ${e.kind} in factor`)}parseIdentFactor(e){if(e===`sum`&&this.tokens[this.cursor+1]?.kind===`(`){this.consume(),this.expectPunct(`(`);let e=this.parseSumArg();return this.expectPunct(`)`),{kind:`sum`,arg:e}}return this.consume(),this.peek()?.kind===`.`?(this.consume(),{kind:`ref`,field:e,col:this.expectIdent()}):{kind:`ident`,name:e}}parseSumArg(){let e=[this.parseTableCol()],t=[];for(let n of this.operatorRun(Wn))t.push(n),e.push(this.parseTableCol());return{factors:e,operators:t}}parseTableCol(){let e=this.expectIdent();return this.expectPunct(`[]`),this.expectPunct(`.`),{table:e,col:this.expectIdent()}}};function Kn(e,t){let n=[{kind:`visit`,node:e}],r=[];for(let e=n.pop();e;e=n.pop())if(e.kind===`apply`)r.push(tee(e.operator,r));else if(e.node.kind===`binop`){let{operator:t,left:r,right:i}=e.node;n.push({kind:`apply`,operator:t},{kind:`visit`,node:i},{kind:`visit`,node:r})}else r.push(nee(e.node,t));let i=r.pop();return i!==void 0&&r.length===0?i:NaN}function tee(e,t){let n=t.pop(),r=t.pop();return r===void 0||n===void 0?NaN:qn(e,r,n)}function nee(e,t){if(e.kind===`num`)return e.value;if(e.kind===`ident`)return Zn(t.record[e.name]);if(e.kind===`ref`){let n=t.refs?.[e.field]??null;return n?Zn(n[e.col]):NaN}return Jn(e.arg,t)}function qn(e,t,n){return!Number.isFinite(t)||!Number.isFinite(n)?NaN:e===`+`?t+n:e===`-`?t-n:e===`*`?t*n:n===0?NaN:t/n}function Jn(e,t){let n=e.factors.at(0);if(!n)return 0;if(e.factors.some(e=>e.table!==n.table))return NaN;let r=t.record[n.table];return it(r)?r.filter(rt).reduce((t,n)=>t+Yn(n,e),0):0}function Yn(e,{factors:t,operators:n}){let[r,...i]=t;return r?i.reduce((t,r,i)=>{let a=n[i];return a?qn(a,t,Xn(e,r.col)):NaN},Xn(e,r.col)):NaN}function Xn(e,t){return nt(e)?Zn(e[t]):NaN}function Zn(e){if(typeof e==`number`)return Number.isFinite(e)?e:NaN;if(typeof e==`string`&&e.length>0){let t=Number(e);return Number.isFinite(t)?t:NaN}return NaN}function Qn(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function $n(e,t,n){let r={};for(let[i,a]of Object.entries(e.fields)){if(a.type!==`ref`||!a.to)continue;let e=t[i],o=Qn(n,a.to);r[i]=typeof e==`string`&&o?Qn(o,e)??null:null}return r}function er(e){return e.type===`derived`||e.type===`flag`}function tr(e,t,n){if(e.type===`derived`&&e.formula)return Nn(e.formula,{record:t,refs:n});if(e.type===`flag`&&e.where)return Dn(e.where,t)}function nr(e,t,n){let r=new Set(Object.entries(e.fields).filter(([,e])=>er(e)).map(([e])=>e)),i=Object.fromEntries(Object.entries(t).filter(([e])=>!r.has(e))),a=$n(e,t,n);for(let t=0;t<r.size;t++){let t=!1;for(let[n,r]of Object.entries(e.fields)){let e=tr(r,i,a);e!=null&&i[n]!==e&&(i[n]=e,t=!0)}if(!t)break}return i}var rr=200;function ir(e){return e.replace(/[<>]/g,``).replace(/`/g,`'`).replace(/\$\{/g,`$ {`).replace(/\s+/g,` `).slice(0,rr)}var ar=/^[a-z0-9_]+$/;function or(e){try{let t=new Intl.Segmenter(void 0,{granularity:`grapheme`});for(let{segment:n}of t.segment(e))return n;return e}catch{return[...e][0]??e}}function sr(e,t){let n=(e??``).trim()||t.trim()||`dataset`;return ar.test(n)?{kind:`symbol`,name:n}:{kind:`glyph`,text:or(n)}}function cr(e,t){return e instanceof Error?e:Error(t??ot(e))}var lr=`presentCollection`;function ur(e){return e.scope===void 0?e.collectionSlug:`${e.scope}\u0000${e.collectionSlug}`}var dr={type:`function`,name:lr,description:"Display a schema-driven collection inline in the chat as an interactive, editable card. Shows the collection's list of records. Pass `itemId` to open one specific record on mount.",parameters:{type:`object`,properties:{collectionSlug:{type:`string`,description:`The slug of the collection to display (e.g. 'clients', 'invoices', 'contacts').`},itemId:{type:`string`,description:`Optional primary-key value of a single record to open in detail view on mount. Omit to show the full list.`}},required:[`collectionSlug`]},prompt:`After making changes to schema-driven collections, use ${lr} to present either the collection or the item`},fr=e=>typeof e==`string`&&e.trim().length>0?e.trim():void 0,pr=e=>{let t=fr(e?.collectionSlug);if(!t)return null;let n=fr(e.itemId);return{collectionSlug:t,...n?{itemId:n}:{}}},mr=async(e,t)=>{let n=pr(t);if(!n)return{message:`presentCollection error: collectionSlug is required`,instructions:`Tell the user you couldn't display the collection because no collection was specified, and ask which collection they mean.`};let{collectionSlug:r,itemId:i}=n;return{message:`Presented collection ${i?`${r} / ${i}`:r}`,data:n,jsonData:n,instructions:`The collection has been presented to the user as an interactive card. They can browse and open records directly; on a writable collection they can also edit, create, and delete (a read-only dataSource collection shows no edit controls — its records change by editing the backing data file). No further action is needed unless they ask.`}},hr=[{card:`border-indigo-200 bg-indigo-50 text-indigo-600 hover:bg-indigo-100`,dot:`bg-indigo-500`,badge:`bg-indigo-100 text-indigo-700`,border:`border-indigo-200`},{card:`border-sky-200 bg-sky-50 text-sky-600 hover:bg-sky-100`,dot:`bg-sky-500`,badge:`bg-sky-100 text-sky-700`,border:`border-sky-200`},{card:`border-cyan-200 bg-cyan-50 text-cyan-600 hover:bg-cyan-100`,dot:`bg-cyan-500`,badge:`bg-cyan-100 text-cyan-700`,border:`border-cyan-200`},{card:`border-teal-200 bg-teal-50 text-teal-600 hover:bg-teal-100`,dot:`bg-teal-500`,badge:`bg-teal-100 text-teal-700`,border:`border-teal-200`},{card:`border-emerald-200 bg-emerald-50 text-emerald-600 hover:bg-emerald-100`,dot:`bg-emerald-500`,badge:`bg-emerald-100 text-emerald-700`,border:`border-emerald-200`},{card:`border-lime-200 bg-lime-50 text-lime-600 hover:bg-lime-100`,dot:`bg-lime-500`,badge:`bg-lime-100 text-lime-700`,border:`border-lime-200`},{card:`border-violet-200 bg-violet-50 text-violet-600 hover:bg-violet-100`,dot:`bg-violet-500`,badge:`bg-violet-100 text-violet-700`,border:`border-violet-200`},{card:`border-fuchsia-200 bg-fuchsia-50 text-fuchsia-600 hover:bg-fuchsia-100`,dot:`bg-fuchsia-500`,badge:`bg-fuchsia-100 text-fuchsia-700`,border:`border-fuchsia-200`}],gr={card:`border-slate-200 bg-slate-50 text-slate-500 hover:bg-slate-100`,dot:`bg-slate-300`,badge:`bg-slate-100 text-slate-500`,border:`border-slate-200`},_r={card:`border-red-200 bg-red-50 text-red-600 hover:bg-red-100`,dot:`bg-red-500`,badge:`bg-red-100 text-red-700`,border:`border-red-200`},vr={card:`border-amber-200 bg-amber-50 text-amber-600 hover:bg-amber-100`,dot:`bg-amber-500`,badge:`bg-amber-100 text-amber-700`,border:`border-amber-200`};function yr(e){return e<0?gr:hr[e%hr.length]??gr}function br(e,t){let n=ut(t);return n===null||n===``?-1:e?.indexOf(n)??-1}function ree(e,t){let n=e.notifyWhen;return n&&n.field===t?n.in:void 0}function xr(e,t,n){let r=ree(e,t);if(r){let e=dt(n),t=r.indexOf(e);return t<0?gr:t===0?_r:vr}let i=e.fields[t];return yr(br(i?.type===`enum`?i.values:void 0,n))}function Sr(e,t){let n={},r={},i={},a={};for(let[o,s]of Object.entries(e)){let e=t(o);s.type===`boolean`?(r[o]=e===!0,i[o]=typeof e==`boolean`,a[o]=!1):n[o]=dt(e)}return{text:n,bool:r,boolOriginallyPresent:i,boolTouched:a}}function Cr(e){return Sr(e,()=>void 0)}function wr(e,t){return Sr(t,t=>e[t])}function Tr(e,t){return Object.hasOwn(e,t)&&e[t]===!0}function Er(e,t,n){return Tr(e.boolOriginallyPresent,t)||Tr(e.boolTouched,t)||!!n.required}function Dr(e,t){if(e!==void 0&&e!==``){if(t===`number`||t===`money`){let t=Number(e);return Number.isFinite(t)?t:e}return e}}function Or(e,t){let n={};for(let[r,i]of Object.entries(t)){if(i.type===`boolean`){let t=Tr(e.bool,r);(Tr(e.boolOriginallyPresent,r)||Tr(e.boolTouched,r)||t||i.required)&&(n[r]=t);continue}let t=Dr(e.text[r],i.type);t!==void 0&&(n[r]=t)}return n}function kr(e,t){let n=[];for(let[r,i]of Object.entries(t.fields)){if(ft.has(i.type))continue;if(i.type===`boolean`){Er(e,r,i)&&n.push([r,Tr(e.bool,r)]);continue}if(i.type===`table`&&i.of){let t=i.of;n.push([r,(e.table[r]??[]).map(e=>Or(e,t))]);continue}let t=Dr(e.text[r],i.type);t!==void 0&&n.push([r,t])}return Object.fromEntries(n)}function Ar(e,t){return e.type===`boolean`?t===!0:t===``?void 0:t}function jr(e,t,n){if(n===void 0){let{[t]:n,...r}=e;return r}return{...e,[t]:n}}function Mr(e){return e==null||e===``}function Nr(e,t){if(e.type!==`table`||!t)return null;for(let[n,r]of t.entries())for(let[t,i]of Object.entries(e.of))if(i.required&&i.type!==`boolean`&&Mr(r.text[t]))return`${e.label} #${n+1}: ${i.label}`;return null}var Pr=new Set([`boolean`,...ft]);function Fr(e,t,n,r){if(!dn(t,r))return null;if(t.type===`table`&&t.of){let r=n.table[e];return t.required&&(!r||r.length===0)?t.label:Nr(t,r)}return!t.required||n.mode===`create`&&t.primary===!0||Pr.has(t.type)?null:Mr(n.text[e])?t.label:null}function Ir(e,t){let n=kr(e,t);for(let[r,i]of Object.entries(t.fields)){let t=Fr(r,i,e,n);if(t)return t}return null}function Lr(e){return e.allowSendChat===!0}function Rr(e,t,n){return n?`/${e} id=${n} ${t}`:`/${e} ${t}`}function zr(e,t){return{slug:e.slug,title:e.title,icon:e.icon&&e.icon.length>0?e.icon:t,...e.color===void 0?{}:{color:e.color}}}var Br={empty:!0},Vr=new Set([`markdown`,`table`,`image`,`file`,`embed`,`backlinks`,`rollup`]);function Hr(e){return!Vr.has(e.type)}function Ur(e){return e===null?`asc`:e===`asc`?`desc`:null}function Wr(e){if(e==null||e===``)return Br;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?{empty:!1,num:t}:Br}function Gr(e){let t=ut(e);return t===null||t.trim()===``?Br:{empty:!1,str:t}}function Kr(e){let t=Pt(e);return t===null?Date.parse(e):new Date(t.year,t.month-1,t.day).getTime()}function qr(e){let t=ut(e);if(t===null||t===``)return Br;let n=Kr(t);return Number.isNaN(n)?Gr(e):{empty:!1,num:n}}function iee(e,t){let n=ut(t);if(n===null||n===``)return Br;let r=e?e.indexOf(n):-1;return r<0?Br:{empty:!1,num:r}}function Jr(e){return{empty:!1,num:+!!e}}function aee(e,t){if(e.num!==void 0&&t.num!==void 0)return e.num-t.num;let n=e.str??String(e.num??``),r=t.str??String(t.num??``);return n.localeCompare(r)}function oee(e,t,n){let r=t===`asc`?1:-1;return e.map((e,t)=>({item:e,index:t,sv:n(e)})).sort((e,t)=>{if(e.sv.empty||t.sv.empty)return e.sv.empty&&t.sv.empty?e.index-t.index:e.sv.empty?1:-1;let n=aee(e.sv,t.sv);return n===0?e.index-t.index:n*r}).map(e=>e.item)}function see(e,t,n){switch(e.type){case`number`:case`money`:return Wr(t);case`date`:case`datetime`:return qr(t);case`enum`:return iee(e.values,t);case`boolean`:return Jr(t===!0);case`ref`:return e.to&&typeof t==`string`&&t?Gr(n(e.to,t)):Gr(t);default:return Gr(t)}}function cee(e,t,n,r){let i=e.type===`derived`?e.display:void 0;if(i===void 0||i===`number`||i===`money`)return Wr(r.evaluateDerived(e,t,n));let a=r.deriveRecord(n);return i===`date`?qr(a[t]):Gr(a[t])}function lee(e,t,n,r){return e.type===`toggle`?Jr(r.toggleChecked(n,e)):e.type===`flag`?Jr(r.flagValueOf(t,n)):e.type===`derived`?cee(e,t,n,r):see(e,n[t],r.resolveRefDisplay)}function Yr(e,t){return t===``||Object.values(e).some(e=>{let n=ut(e);return n!==null&&n.toLowerCase().includes(t)})}function Xr(e,t){return`${e}:${t}`}function Zr(e,t){return e?dt(t[e]):``}function Qr(e,t){let n=new Set,r=Object.entries(e.fields).filter(([,e])=>e.type===`enum`).map(([e])=>e);if(r.length===0)return n;for(let i of t){let t=dt(i[e.primaryKey]);for(let e of r)(i[e]==null||i[e]===``)&&n.add(Xr(t,e))}return n}var uee=new Set([`string`,`text`,`markdown`,`email`]);function $r(e){if(e.displayField)return e.displayField;for(let[t,n]of Object.entries(e.fields))if(t!==e.primaryKey&&uee.has(n.type))return t;return null}function ei(e,t){return dt(e[t.primaryKey])}function ti(e,t,n){if(n){let t=e[n];if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`){let e=String(t);if(e.length>0)return e}}return ei(e,t)}var ni=e=>e===`ref`||e===`embed`,dee=(e,t,n)=>{let r=e.find(e=>e.kind===`ref`&&e.from===n.to&&e.to===t&&(n.via===void 0||e.field===n.via));if(r){r.reverseFields=[...r.reverseFields??[],n.field];return}e.push({from:n.to,to:t,field:n.field,kind:n.kind})},ri=e=>{let t=[];for(let n of e)for(let e of n.relations)ni(e.kind)&&t.push({from:n.slug,to:e.to,field:e.field,kind:e.kind});for(let n of e)for(let e of n.relations)ni(e.kind)||dee(t,n.slug,e);return t},ii=(e,t)=>{let n=new Set;for(let r of e)t.has(r.from)||n.add(r.from),t.has(r.to)||n.add(r.to);return[...n].sort()},ai=e=>{let t=ri(e),n=new Set(e.map(e=>e.slug)),r=e.map(({slug:e,title:t,icon:n,recordCount:r})=>({slug:e,title:t,icon:n,recordCount:r}));for(let e of ii(t,n))r.push({slug:e,title:e,icon:``,recordCount:0,missing:!0});return{nodes:r,edges:t}};M(),o();var fee=e=>Ge({legacy:!1,locale:`en`,fallbackLocale:`en`,messages:e}),oi=e=>{let t={wired:!1};return()=>{t.wired||=(e(),!0)}};function si(e,t){let n=fee(e),r=f(!0),i=oi(()=>{r.run(()=>{oe(()=>{n.global.locale.value=t()})})});return()=>(i(),{t:n.global.t,locale:n.global.locale})}var ci=Symbol(`NOT_RESOLVED`);function li(e,t){return{tagName:e,nodeKind:`scalar`,implicit:t.implicit??!1,matchByTagPrefix:t.matchByTagPrefix??!1,implicitFirstChars:t.implicitFirstChars??null,resolve:t.resolve,identify:t.identify,represent:t.represent??(e=>String(e)),representTagName:t.representTagName??(()=>e)}}function ui(e,t){let n=t.finalize===void 0;return{tagName:e,nodeKind:`sequence`,implicit:!1,matchByTagPrefix:t.matchByTagPrefix??!1,create:t.create,addItem:t.addItem,finalize:t.finalize??(e=>e),carrierIsResult:n,identify:t.identify,represent:t.represent??(e=>e),representTagName:t.representTagName??(()=>e)}}function di(e,t){let n=t.finalize===void 0;return{tagName:e,nodeKind:`mapping`,implicit:!1,matchByTagPrefix:t.matchByTagPrefix??!1,create:t.create,addPair:t.addPair,has:t.has,keys:t.keys,get:t.get,finalize:t.finalize??(e=>e),carrierIsResult:n,identify:t.identify,represent:t.represent??(e=>e),representTagName:t.representTagName??(()=>e)}}var fi=li(`tag:yaml.org,2002:str`,{resolve:e=>e,identify:e=>typeof e==`string`}),pi=[``,`~`,`null`,`Null`,`NULL`],mi=li(`tag:yaml.org,2002:null`,{implicit:!0,implicitFirstChars:[``,`~`,`n`,`N`],resolve:e=>pi.indexOf(e)===-1?ci:null,identify:e=>e===null,represent:()=>`null`}),pee=li(`tag:yaml.org,2002:null`,{implicit:!0,implicitFirstChars:[`n`],resolve:(e,t)=>e===`null`||t&&e===``?null:ci,identify:e=>e===null,represent:()=>`null`}),hi=[``,`~`,`null`,`Null`,`NULL`],gi=li(`tag:yaml.org,2002:null`,{implicit:!0,implicitFirstChars:[``,`~`,`n`,`N`],resolve:e=>hi.indexOf(e)===-1?ci:null,identify:e=>e===null,represent:()=>`null`}),_i=[`true`,`True`,`TRUE`],vi=[`false`,`False`,`FALSE`],yi=li(`tag:yaml.org,2002:bool`,{implicit:!0,implicitFirstChars:[`t`,`T`,`f`,`F`],resolve:e=>_i.indexOf(e)!==-1||vi.indexOf(e)===-1&&ci,identify:e=>Object.prototype.toString.call(e)===`[object Boolean]`,represent:e=>e?`true`:`false`}),mee=[`true`],bi=[`false`],hee=li(`tag:yaml.org,2002:bool`,{implicit:!0,implicitFirstChars:[`t`,`f`],resolve:e=>mee.indexOf(e)!==-1||bi.indexOf(e)===-1&&ci,identify:e=>Object.prototype.toString.call(e)===`[object Boolean]`,represent:e=>e?`true`:`false`}),gee=[`true`,`True`,`TRUE`,`y`,`Y`,`yes`,`Yes`,`YES`,`on`,`On`,`ON`],_ee=[`false`,`False`,`FALSE`,`n`,`N`,`no`,`No`,`NO`,`off`,`Off`,`OFF`],vee=li(`tag:yaml.org,2002:bool`,{implicit:!0,implicitFirstChars:[`y`,`Y`,`n`,`N`,`t`,`T`,`f`,`F`,`o`,`O`],resolve:e=>gee.indexOf(e)!==-1||_ee.indexOf(e)===-1&&ci,identify:e=>Object.prototype.toString.call(e)===`[object Boolean]`,represent:e=>e?`true`:`false`}),yee=RegExp(`^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$`),bee=RegExp(`^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$`);function xi(e){let t=e,n=1;return(t[0]===`-`||t[0]===`+`)&&(t[0]===`-`&&(n=-1),t=t.slice(1)),t.startsWith(`0b`)?n*parseInt(t.slice(2),2):t.startsWith(`0o`)?n*parseInt(t.slice(2),8):t.startsWith(`0x`)?n*parseInt(t.slice(2),16):n*parseInt(t,10)}function Si(e,t){if(t){if(!bee.test(e))return ci}else if(!yee.test(e))return ci;let n=xi(e);return Number.isFinite(n)?n:ci}var Ci=li(`tag:yaml.org,2002:int`,{implicit:!0,implicitFirstChars:[`-`,`+`,...`0123456789`],resolve:Si,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf(`e`)<0,represent:e=>e.toString(10)}),xee=RegExp(`^-?(?:0|[1-9][0-9]*)$`),wi=RegExp(`^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$`);function See(e){let t=e,n=1;return(t[0]===`-`||t[0]===`+`)&&(t[0]===`-`&&(n=-1),t=t.slice(1)),t.startsWith(`0b`)?n*parseInt(t.slice(2),2):t.startsWith(`0o`)?n*parseInt(t.slice(2),8):t.startsWith(`0x`)?n*parseInt(t.slice(2),16):n*parseInt(t,10)}function Cee(e,t){if(t){if(!wi.test(e))return ci}else if(!xee.test(e))return ci;let n=See(e);return Number.isFinite(n)?n:ci}var wee=li(`tag:yaml.org,2002:int`,{implicit:!0,implicitFirstChars:[`-`,...`0123456789`],resolve:Cee,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf(`e`)<0,represent:e=>e.toString(10)}),Tee=RegExp(`^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$`);function Eee(e){let t=e.replace(/_/g,``),n=1;if((t[0]===`-`||t[0]===`+`)&&(t[0]===`-`&&(n=-1),t=t.slice(1)),t.startsWith(`0b`))return n*parseInt(t.slice(2),2);if(t.startsWith(`0x`))return n*parseInt(t.slice(2),16);if(t.includes(`:`)){let e=0;for(let n of t.split(`:`))e=e*60+Number(n);return n*e}return t!==`0`&&t[0]===`0`?n*parseInt(t,8):n*parseInt(t,10)}function Dee(e){if(!Tee.test(e))return ci;let t=Eee(e);return Number.isFinite(t)?t:ci}var Ti=li(`tag:yaml.org,2002:int`,{implicit:!0,implicitFirstChars:[`-`,`+`,...`0123456789`],resolve:Dee,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf(`e`)<0,represent:e=>e.toString(10)}),Oee=RegExp(`^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`),kee=RegExp(`^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function Aee(e){if(!Oee.test(e))return ci;let t=e.toLowerCase(),n=t[0]===`-`?-1:1;if(`+-`.includes(t[0])&&(t=t.slice(1)),t===`.inf`)return n===1?1/0:-1/0;if(t===`.nan`)return NaN;let r=n*parseFloat(t);return Number.isFinite(r)||kee.test(e)?r:ci}function jee(e){if(isNaN(e))return`.nan`;if(e===1/0)return`.inf`;if(e===-1/0)return`-.inf`;if(Object.is(e,-0))return`-0.0`;let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace(`e`,`.e`):t}var Mee=li(`tag:yaml.org,2002:float`,{implicit:!0,implicitFirstChars:[`-`,`+`,`.`,...`0123456789`],resolve:Aee,identify:e=>typeof e==`number`&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf(`e`)>=0),represent:jee}),Nee=RegExp(`^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$`),Pee=RegExp(`^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function Fee(e,t){if(t){if(!Pee.test(e))return ci;let t=e.toLowerCase(),n=t[0]===`-`?-1:1;if(`+-`.includes(t[0])&&(t=t.slice(1)),t===`.inf`)return n===1?1/0:-1/0;if(t===`.nan`)return NaN;let r=n*parseFloat(t);return Number.isFinite(r)?r:ci}if(!Nee.test(e))return ci;let n=Number(e);return Number.isFinite(n)?n:ci}function Iee(e){if(isNaN(e))return`.nan`;if(e===1/0)return`.inf`;if(e===-1/0)return`-.inf`;if(Object.is(e,-0))return`-0.0`;let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace(`e`,`.e`):t}var Lee=li(`tag:yaml.org,2002:float`,{implicit:!0,implicitFirstChars:[`-`,...`0123456789`],resolve:Fee,identify:e=>typeof e==`number`&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf(`e`)>=0),represent:Iee}),Ree=RegExp(`^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`),zee=RegExp(`^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function Bee(e){if(!Ree.test(e))return ci;let t=e.toLowerCase().replace(/_/g,``),n=t[0]===`-`?-1:1;if(`+-`.includes(t[0])&&(t=t.slice(1)),t===`.inf`)return n===1?1/0:-1/0;if(t===`.nan`)return NaN;let r=0;if(t.includes(`:`)){for(let e of t.split(`:`))r=r*60+Number(e);r*=n}else r=n*parseFloat(t);return Number.isFinite(r)||zee.test(e)?r:ci}function Vee(e){if(isNaN(e))return`.nan`;if(e===1/0)return`.inf`;if(e===-1/0)return`-.inf`;if(Object.is(e,-0))return`-0.0`;let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace(`e`,`.e`):t}var Ei=li(`tag:yaml.org,2002:float`,{implicit:!0,implicitFirstChars:[`-`,`+`,`.`,...`0123456789`],resolve:Bee,identify:e=>typeof e==`number`&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf(`e`)>=0),represent:Vee}),Hee=li(`tag:yaml.org,2002:merge`,{implicit:!0,implicitFirstChars:[`<`],resolve:(e,t)=>e===`<<`||t&&e===``?`<<`:ci,identify:()=>!1}),Uee=/^[A-Za-z0-9+/]*={0,2}$/;function Wee(e){let t=e.replace(/\s/g,``);if(t.length%4!=0||!Uee.test(t))return ci;let n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}function Gee(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}var Kee=li(`tag:yaml.org,2002:binary`,{resolve:Wee,identify:e=>Object.prototype.toString.call(e)===`[object Uint8Array]`,represent:Gee}),qee=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$`),Jee=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$`);function Yee(e,t,n,r=0,i=0,a=0,o=0){let s=new Date(Date.UTC(e,t,n,r,i,a,o));return s.setUTCFullYear(e,t,n),s}function Xee(e){let t=qee.exec(e);if(t===null&&(t=Jee.exec(e)),t===null)return ci;let n=+t[1],r=t[2]-1,i=+t[3];if(!t[4]){let e=Yee(n,r,i);return e.getUTCFullYear()!==n||e.getUTCMonth()!==r||e.getUTCDate()!==i?ci:e}let a=+t[4],o=+t[5],s=+t[6],c=0;if(a>23||o>59||s>59)return ci;if(t[7]){let e=t[7].slice(0,3);for(;e.length<3;)e+=`0`;c=+e}let l=Yee(n,r,i,a,o,s,c);if(l.getUTCFullYear()!==n||l.getUTCMonth()!==r||l.getUTCDate()!==i)return ci;if(t[9]){let e=+t[10],n=+(t[11]||0);if(e>23||n>59)return ci;let r=(e*60+n)*6e4;l.setTime(l.getTime()-(t[9]===`-`?-r:r))}return l}var Zee=li(`tag:yaml.org,2002:timestamp`,{implicit:!0,implicitFirstChars:[...`0123456789`],resolve:Xee,identify:e=>e instanceof Date,represent:e=>e.toISOString()}),Qee=ui(`tag:yaml.org,2002:seq`,{create:()=>[],addItem:(e,t)=>{e.push(t)},identify:Array.isArray});function Di(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Oi(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}var $ee=ui(`tag:yaml.org,2002:omap`,{create:()=>({list:[],seen:new Set}),addItem:(e,t)=>{let n;if(t instanceof Map){if(t.size!==1)return`cannot resolve an ordered map item`;n=t.keys().next().value}else if(Di(t)){let e=Object.keys(t);if(e.length!==1)return`cannot resolve an ordered map item`;n=e[0]}else return`cannot resolve an ordered map item`;return e.seen.has(n)?`duplicate key in ordered map`:(e.seen.add(n),e.list.push(t),``)},finalize:e=>e.list,identify:()=>!1}),ete=ui(`tag:yaml.org,2002:pairs`,{create:()=>[],addItem:(e,t)=>{if(t instanceof Map)return t.size===1?(e.push(t.entries().next().value),``):`cannot resolve a pairs item`;if(Object.prototype.toString.call(t)!==`[object Object]`)return`cannot resolve a pairs item`;let n=t,r=Object.keys(n);return r.length===1?(e.push([r[0],n[r[0]]]),``):`cannot resolve a pairs item`},identify:()=>!1}),tte=di(`tag:yaml.org,2002:map`,{create:()=>({}),identify:Di,represent:e=>{let t=new Map;for(let n of Object.keys(e))t.set(n,e[n]);return t},addPair:(e,t,n)=>{if(typeof t==`object`&&t)return`object-based map does not support complex keys`;let r=String(t);return r===`__proto__`?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,``},has:(e,t)=>typeof t==`object`&&t?!1:Object.prototype.hasOwnProperty.call(e,String(t)),keys:e=>Object.keys(e),get:(e,t)=>{let n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?e[n]:null}}),nte=di(`tag:yaml.org,2002:set`,{create:()=>new Set,identify:e=>e instanceof Set,represent:e=>{let t=new Map;for(let n of e)t.set(n,null);return t},addPair:(e,t,n)=>n===null?(e.add(t),``):`cannot resolve a set item`,has:(e,t)=>e.has(t),keys:e=>e.keys(),get:()=>null});function rte(){return{scalar:Object.create(null),sequence:Object.create(null),mapping:Object.create(null)}}function ite(){return{scalar:[],sequence:[],mapping:[]}}function ate(e){let t=[];for(let n of e){let e=t.length;for(let r=0;r<t.length;r++){let i=t[r];if(i.nodeKind===n.nodeKind&&i.tagName===n.tagName&&i.matchByTagPrefix===n.matchByTagPrefix){e=r;break}}t[e]=n}return t}var ki=class e{tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(e){let t=ate(e),n=[],r=rte(),i=ite();for(let e of t){if(e.nodeKind===`scalar`&&e.implicit){if(e.matchByTagPrefix)throw Error(`Implicit scalar tags cannot match by tag prefix`);n.push(e)}switch(e.nodeKind){case`scalar`:e.matchByTagPrefix?i.scalar.push(e):r.scalar[e.tagName]=e;break;case`sequence`:e.matchByTagPrefix?i.sequence.push(e):r.sequence[e.tagName]=e;break;case`mapping`:e.matchByTagPrefix?i.mapping.push(e):r.mapping[e.tagName]=e}}let a=n.filter(e=>e.implicitFirstChars===null),o=new Set;for(let e of n)if(e.implicitFirstChars!==null)for(let t of e.implicitFirstChars)o.add(t);let s=new Map;for(let e of o)s.set(e,n.filter(t=>t.implicitFirstChars===null||t.implicitFirstChars.indexOf(e)!==-1));let c=r.scalar[`tag:yaml.org,2002:str`];if(!c)throw Error(`schema does not define the default scalar tag (tag:yaml.org,2002:str)`);this.tags=t,this.implicitScalarTags=n,this.implicitScalarByFirstChar=s,this.implicitScalarAnyFirstChar=a,this.defaultScalarTag=c,this.defaultSequenceTag=r.sequence[`tag:yaml.org,2002:seq`],this.defaultMappingTag=r.mapping[`tag:yaml.org,2002:map`],this.exact=r,this.prefix=i}lookupScalarTag(e){let t=this.exact.scalar[e];if(t)return t;for(let t of this.prefix.scalar)if(e.startsWith(t.tagName))return t}lookupSequenceTag(e){let t=this.exact.sequence[e];if(t)return t;for(let t of this.prefix.sequence)if(e.startsWith(t.tagName))return t}lookupMappingTag(e){let t=this.exact.mapping[e];if(t)return t;for(let t of this.prefix.mapping)if(e.startsWith(t.tagName))return t}resolveImplicitScalarTag(e){let t=this.implicitScalarByFirstChar.get(e.charAt(0))??this.implicitScalarAnyFirstChar;for(let n of t){let t=n.resolve(e,!1,n.tagName);if(t!==ci)return{value:t,tag:n}}let n=this.defaultScalarTag;return{value:n.resolve(e,!1,n.tagName),tag:n}}withTags(...t){let n=[];for(let e of t)n=n.concat(e);return new e([...this.tags,...n])}},Ai=new ki([fi,Qee,tte]);new ki([...Ai.tags,pee,hee,wee,Lee]);var ote=new ki([...Ai.tags,mi,yi,Ci,Mee]),ste=new ki([...Ai.tags,gi,vee,Ti,Ei,Zee,Hee,Kee,$ee,ete,nte]).withTags({...Ti,resolve:(e,t,n)=>{let r=Ti.resolve(e,t,n);return r===ci?Ci.resolve(e,t,n):r}},{...Ei,resolve:(e,t,n)=>{let r=Ei.resolve(e,t,n);return r===ci?Mee.resolve(e,t,n):r}});di(`tag:yaml.org,2002:map`,{create:()=>new Map,addPair:(e,t,n)=>(e.set(t,n),``),has:(e,t)=>e.has(t),keys:e=>e.keys(),get:(e,t)=>e.get(t),identify:e=>e instanceof Map||Di(e),represent:e=>{if(e instanceof Map)return e;let t=new Map,n=e;for(let e of Object.keys(n))t.set(e,n[e]);return t}});function cte(e){if(Array.isArray(e)){let t=Array.prototype.slice.call(e);for(let e=0;e<t.length;e++){if(Array.isArray(t[e]))return null;typeof t[e]==`object`&&Object.prototype.toString.call(t[e])===`[object Object]`&&(t[e]=`[object Object]`)}return String(t)}return typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`?`[object Object]`:String(e)}di(`tag:yaml.org,2002:map`,{create:()=>({}),identify:Di,represent:e=>{let t=new Map;for(let n of Object.keys(e))t.set(n,e[n]);return t},addPair:(e,t,n)=>{let r=cte(t);return r===null?`nested arrays are not supported inside keys`:(r===`__proto__`?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,``)},has:(e,t)=>{let n=cte(t);return n!==null&&Object.prototype.hasOwnProperty.call(e,n)},keys:e=>Object.keys(e),get:(e,t)=>{let n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?e[n]:null}});var lte={maxLength:79,indent:1,linesBefore:3,linesAfter:2};function ji(e,t,n,r,i){let a=``,o=``,s=Math.floor(i/2)-1;return r-t>s&&(a=` ... `,t=r-s+a.length),n-r>s&&(o=` ...`,n=r+s-o.length),{str:a+e.slice(t,n).replace(/\t/g,`→`)+o,pos:r-t+a.length}}function Mi(e,t){return` `.repeat(Math.max(t-e.length,0))+e}function ute(e,t){if(!e.buffer)return null;let n={...lte,...t},r=/\r?\n|\r|\0/g,i=[0],a=[],o,s=-1;for(;o=r.exec(e.buffer);)a.push(o.index),i.push(o.index+o[0].length),e.position<=o.index&&s<0&&(s=i.length-2);s<0&&(s=i.length-1);let c=``,l=Math.min(e.line+n.linesAfter,a.length).toString().length,u=n.maxLength-(n.indent+l+3);for(let t=1;t<=n.linesBefore&&!(s-t<0);t++){let r=ji(e.buffer,i[s-t],a[s-t],e.position-(i[s]-i[s-t]),u);c=`${` `.repeat(n.indent)}${Mi((e.line-t+1).toString(),l)} | ${r.str}\n${c}`}let d=ji(e.buffer,i[s],a[s],e.position,u);c+=`${` `.repeat(n.indent)}${Mi((e.line+1).toString(),l)} | ${d.str}\n`,c+=`${`-`.repeat(n.indent+l+3+d.pos)}^\n`;for(let t=1;t<=n.linesAfter&&!(s+t>=a.length);t++){let r=ji(e.buffer,i[s+t],a[s+t],e.position-(i[s]-i[s+t]),u);c+=`${` `.repeat(n.indent)}${Mi((e.line+t+1).toString(),l)} | ${r.str}\n`}return c.replace(/\n$/,``)}function dte(e,t){let n=``;return e.mark?(e.mark.name&&(n+=`in "${e.mark.name}" `),n+=`(${e.mark.line+1}:${e.mark.column+1})`,!t&&e.mark.snippet&&(n+=`\n\n${e.mark.snippet}`),`${e.reason} ${n}`):e.reason}var Ni=class e extends Error{reason;mark;constructor(e,t){super(),this.name=`YAMLException`,this.reason=e,this.mark=t,this.message=dte(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(e){return`${this.name}: ${dte(this,e)}`}static throwAt(t,n,r,i=``){let a=0,o=0;for(let e=0;e<n;e++){let n=t.charCodeAt(e);n===10?(a++,o=e+1):n===13&&(a++,t.charCodeAt(e+1)===10&&e++,o=e+1)}let s={name:i,buffer:t,position:n,line:a,column:n-o};throw s.snippet=ute(s),new e(r,s)}},Pi={DOCUMENT:1,SEQUENCE:2,MAPPING:3,SCALAR:4,ALIAS:5,POP:6},Fi={PLAIN:1,SINGLE_QUOTED:2,DOUBLE_QUOTED:3,LITERAL_BLOCK:4,FOLDED_BLOCK:5},Ii={BLOCK:1,FLOW:2},Li={CLIP:1,STRIP:2,KEEP:3},fte=-1;function pte(e){switch(e){case 48:return`\0`;case 97:return`\x07`;case 98:return`\b`;case 116:return` `;case 9:return` `;case 110:return`
4
4
  `;case 118:return`\v`;case 102:return`\f`;case 114:return`\r`;case 101:return`\x1B`;case 32:return` `;case 34:return`"`;case 47:return`/`;case 92:return`\\`;case 78:return`…`;case 95:return`\xA0`;case 76:return`\u2028`;case 80:return`\u2029`;default:return``}}var mte=Array(256),hte=Array(256);for(let e=0;e<256;e++)mte[e]=+!!pte(e),hte[e]=pte(e);function gte(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function _te(e){return e>=48&&e<=57?e-48:(e|32)-97+10}function vte(e){return e===120?2:e===117?4:8}function Ri(e,t,n){let r=0;for(;t<n;){let n=e.charCodeAt(t);if(n===10)r++,t++;else if(n===13)r++,t++,e.charCodeAt(t)===10&&t++;else if(n===32||n===9)t++;else break}return{position:t,breaks:r}}function zi(e){return e===1?` `:`
@@ -261,7 +261,7 @@ Cette action est irréversible.`},notificationBell:{notifications:`Notifications
261
261
 
262
262
  Dies kann nicht rückgängig gemacht werden.`},notificationBell:{notifications:`Benachrichtigungen`,activeSection:`Aktiv`,historySection:`Verlauf`,noActive:`Keine aktiven Benachrichtigungen`,noHistory:`Keine kürzlichen Aktivitäten`,clearAll:`Alle löschen`,dismiss:`Verwerfen`,cancel:`Abbrechen`,showMore:`Mehr anzeigen ({count})`,showLess:`Weniger anzeigen`,openTarget:`Öffnen`,expandDetails:`Details anzeigen`},pluginDiagnostics:{title:`Plugin-Konfigurationsproblem`,hostBody:`Das Plugin „{plugin}“ hat versucht, den {label}-Schlüssel „{key}“ zu registrieren, aber er ist vom Host reserviert. Der Plugin-Eintrag wurde verworfen.`,intraBody:`Die Plugins „{first}“ und „{second}“ registrieren beide {dimension} „{key}“. „{first}“ hat ihn zuerst beansprucht, daher wird die Registrierung von „{second}“ ignoriert.`},shadowedEnv:{title:`Shell-Umgebung überschreibt .env`,body:`Sowohl in der Shell als auch in .env gesetzt: {keys}. Der Wert aus der Shell gewinnt, daher wird .env ignoriert. Wenn Sie .env bearbeitet haben, aktualisieren oder entfernen Sie den Wert in der Shell und starten Sie neu.`},optionalDeps:{title:`Optionale Abhängigkeit nicht verfügbar`,titleNotFound:`{command} ist nicht installiert`,titleNotResponding:`{command} läuft nicht`,notFound:`{command} nicht gefunden — zugehörige Funktionen wurden deaktiviert. Installieren Sie {command} und starten Sie MulmoClaude neu, um sie zu aktivieren.`,notResponding:`{command} ist installiert, läuft aber nicht — zugehörige Funktionen wurden deaktiviert. Starten Sie {command} und starten Sie MulmoClaude neu, um sie zu aktivieren.`},billingMigration:{title:`Die Rechnungsstellung wird jetzt bei Bedarf eingerichtet`,body:`Die gebündelten Sammlungen clients, worklog, invoice und profile wurden aus deinem Dashboard entfernt, deine Daten sind jedoch sicher und unverändert. Bitte um die Einrichtung der Kunden- und Zeiterfassung und anschließend der Rechnungsstellung, um sie neu zu erstellen – deine vorhandenen Datensätze werden wieder angezeigt.`},backendOffline:{title:`Backend nicht erreichbar`,body:`Der MulmoClaude-Server läuft möglicherweise nicht. Prüfe den Dev-Server und versuche es erneut.`,retry:`Erneut versuchen`},pluginErrorBoundary:{title:`Plugin {pkg} ist abgestürzt`,subtitle:`Das Plugin konnte nicht gerendert werden. Der Fehler wurde in der Konsole protokolliert.`,showDetails:`Details anzeigen`,hideDetails:`Details ausblenden`,retry:`Erneut versuchen`},remoteHostOffline:{title:`Remote-Host getrennt`,body:`Ihr Telefon kann erst nach dem erneuten Verbinden an dieses Gerät senden.`,reconnect:`Erneut verbinden`},remoteHost:{title:`Remote-Host`,online:`Remote-Host online`,offline:`Remote-Host offline`,uid:`uid {uid}`,signIn:`Mit Google anmelden`,connecting:`Verbinden…`,disconnect:`Trennen`,disconnecting:`Wird getrennt…`,noToken:`Google-Anmeldung hat kein idToken zurückgegeben`,connectFailed:`Verbindung fehlgeschlagen`,disconnectFailed:`Trennen fehlgeschlagen`,signInFailed:`Google-Anmeldung fehlgeschlagen`,statusFailed:`Status konnte nicht geladen werden`,description:`Mit Remote-Zugriff kann ein Mobilgerät auf die Sammlungen und Feeds dieser MulmoClaude-Instanz zugreifen.`,howTo:`Öffne auf deinem Smartphone {url} und melde dich mit demselben Google-Konto an.`,customViewHint:`Für eine mobiltaugliche Ansicht bitte Claude, statt einer normalen Custom View eine {keyword} zu bauen.`,qrHint:`Oder scanne diesen QR-Code mit der Handykamera.`},sessionModelChip:{tooltip:`Modell dieser Sitzung: {model}`,tooltipOverride:`Modell dieses Chats: {model} (überschreibt Rolle / globale Einstellung)`,ariaLabel:`Modell dieses Chats`,clear:`Zurück zum Standard`,unknown:`unbekannt`,inherited:`{model} (geerbt)`},sidebarHeader:{newMessages:`Neue Nachrichten`,home:`Zum neuesten Chat`,toolCallHistory:`Tool-Aufrufverlauf`,settings:`Einstellungen`,settingsGeminiMissing:`Einstellungen — Gemini-API-Schlüssel fehlt`,todayJournal:`Heutige Zusammenfassung`,todayJournalNotFound:`Noch keine Zusammenfassung — chatte etwas und das Journal erstellt eine.`,todayJournalLoadFailed:`Journal konnte nicht geladen werden (Status {status}): {error}`,copyMarkdown:`Chat als Markdown kopieren`,copiedMarkdown:`Kopiert!`},rightSidebar:{permalink:`Permalink zur ausgewählten Nachricht`,copyPermalink:`Permalink zur ausgewählten Nachricht kopieren`,copiedPermalink:`Kopiert!`,toggleSystemPrompt:`System-Prompt umschalten`,systemPrompt:`System-Prompt`,availableTools:`Verfügbare Tools`,toggleToolDescription:`Tool-Beschreibung umschalten`,toolCallHistory:`Tool-Aufrufverlauf`,copyHistory:`Tool-Aufrufverlauf kopieren`,copiedHistory:`Kopiert!`,noToolCalls:`Noch keine Tool-Aufrufe`,arguments:`Argumente`,error:`Fehler`,result:`Ergebnis`,running:`Läuft...`,mcpHint:{title:e=>`Einrichtungshinweis: ${e.named(`server`)}`,requiredKeys:`Erforderliche Schlüssel`,setupGuide:`Einrichtungsanleitung öffnen`}},fileTreePane:{sort:`Sortieren:`,sortByName:`Nach Name sortieren`,name:`Name`,sortByRecent:`Nach Änderungsdatum sortieren (neueste zuerst)`,recent:`Zuletzt`,reference:`Referenz`,readOnlyBadge:`RO`,showSystemFiles:`Systemdateien anzeigen`,showSystemFilesTitle:`Zeigt agent-interne Top-Level-Verzeichnisse (conversations/, feeds/ usw.) zusätzlich zu den Nutzer-Daten (data/, artifacts/, config/) an.`},fileTree:{dropHint:`Dateien hier ablegen, um sie in diesem Ordner zu speichern`,upload:{progress:`Hochladen {done} von {total}…`,done:`{count} Datei(en) gespeichert`,failed:`{count} Datei(en) konnten nicht gespeichert werden`},workspace:`(Arbeitsbereich)`,recentlyChanged:`Kürzlich geändert`,newFileMenuItem:`Neue Datei`,newFileInputAria:`Name der neuen Datei`,newFilePlaceholder:{wikiPage:`seiten-slug`,summary:`zusammenfassungsname`,document:`dokumentname`,html:`seitenname`,story:`story-name`},newFileError:{empty:`Der Dateiname darf nicht leer sein.`,unsafe:`Der Dateiname enthält ungültige Zeichen.`,exists:`Eine Datei mit dem Namen {filename} existiert hier bereits.`,saveFailed:`Datei konnte nicht erstellt werden. Bitte erneut versuchen.`}},lockStatusPopup:{sandboxEnabledTooltip:`Sandbox aktiviert (Docker)`,noSandboxTooltip:`Keine Sandbox (Docker nicht gefunden)`,sandboxEnabledLabel:`Sandbox aktiviert:`,sandboxEnabledBody:`Docker läuft. Der Dateisystemzugriff ist isoliert.`,noSandboxLabel:`Keine Sandbox:`,noSandboxBodyPrefix:`Claude kann auf alle Dateien auf Ihrem Rechner zugreifen. Installieren Sie`,noSandboxBodySuffix:`, um die Dateisystem-Isolation zu aktivieren.`,dockerDesktop:`Docker Desktop`,hostCredentials:`Angehängte Host-Zugangsdaten:`,credsLoading:`wird geladen…`,sshAgent:`SSH-Agent:`,forwarded:`weitergeleitet`,notForwarded:`nicht weitergeleitet`,mountedConfigs:`Eingebundene Konfigurationen:`,none:`keine`,testIsolation:`Sandbox-Isolation testen:`},settingsModal:{title:`Einstellungen`,version:`MulmoClaude v{version}`,tabs:{gemini:`Gemini-API-Schlüssel`,tools:`Erlaubte Tools`,mcp:`MCP-Server`,dirs:`Verzeichnisse`,refs:`Referenzverzeichnisse`,map:`Karte`,photos:`Fotos`,google:`Google`,model:`Modell`,voice:`Sprache`,chatIndex:`Chat-Index`,journal:`Journal`,notifications:`Web Push`,skills:`Skills`,roles:`Rollen`,quit:`Beenden`},groups:{llm:`LLM`,servers:`Server`,workspace:`Arbeitsbereich`,notifications:`Benachrichtigungen`,plugins:`Plugins`,management:`Verwaltung`,server:`Server`},navAriaLabel:`Einstellungsbereiche`,googleTab:{description:`Verknüpfe dein Google-Konto, damit dieser Rechner Google-APIs direkt aufrufen kann (zuerst Kalender). Das Refresh-Token wird nur auf diesem Rechner gespeichert und außer an Google an keinen Server gesendet.`,statusLinked:`Verknüpft`,statusNotLinked:`Nicht verknüpft`,statusPending:`Warte auf Abschluss der Einwilligung im Browser…`,connect:`Google-Konto verknüpfen`,unlink:`Verknüpfung aufheben`,unlinkConfirm:`Google-Konto-Verknüpfung aufheben? Das gespeicherte Token wird widerrufen und von diesem Rechner gelöscht.`,clientSecretAmbiguous:`In ~/.secrets/ wurden mehrere client_secret_*.json-Dateien gefunden. Behalte genau eine, damit das gespeicherte Token dem richtigen OAuth-Client zugeordnet bleibt.`,loadError:`Der Google-Verknüpfungsstatus konnte nicht geladen werden.`,connectError:`Der Google-Autorisierungsablauf konnte nicht gestartet werden.`,unlinkError:`Die Google-Verknüpfung konnte nicht aufgehoben werden.`},geminiTab:{required:`Die Bildgenerierung erfordert {envKey}. Fügen Sie den Schlüssel unten ein und speichern Sie ihn.`,apiKeyLabel:`Gemini-API-Schlüssel`,apiKeyPlaceholder:`AIza…`,helperText:`Erstellen oder kopieren Sie einen Schlüssel in {studioLink}.`,storageNote:`Wird nur auf diesem Rechner gespeichert, außerhalb des Workspace, und ist nur für Sie lesbar. Er wirkt sofort — ohne Neustart.`,storedHere:`In der App gespeichert`,storedInEnvironment:`Kommt aus der Umgebung`,notConfigured:`Nicht konfiguriert`,clear:`Löschen`,fromEnvironment:`Dieser Schlüssel kommt aus der Shell, die die App gestartet hat, oder aus {envFile}. Ein hier gespeicherter Schlüssel hat Vorrang.`,loadError:`Schlüsselstatus konnte nicht geladen werden`,saveError:`Schlüssel konnte nicht gespeichert werden`,clearError:`Schlüssel konnte nicht gelöscht werden`},mapTab:{description:`Legt den Google-Maps-API-Schlüssel fest, den das Karten-Plugin verwendet. Der Schlüssel wird lokal gespeichert und nur an Google Maps gesendet.`,apiKeyLabel:`Google-Maps-API-Schlüssel`,apiKeyPlaceholder:`AIza…`,helperText:`Erstelle oder kopiere einen Schlüssel aus {consoleLink}.`,requiredApis:`Erforderliche APIs: Maps JavaScript API, Geocoding API, Places API (New), Directions API.`,configured:`Konfiguriert`,notConfigured:`Nicht konfiguriert`,clear:`Löschen`,loadError:`Einstellungen konnten nicht geladen werden`,saveError:`Speichern fehlgeschlagen`},photosTab:{description:`Datenschutzeinstellungen für Fotos, die per Chat oder verbundener Bridge empfangen wurden. EXIF-Standortdaten sind sensibel — Häkchen entfernen, um die automatische Erfassung zu deaktivieren.`,autoCaptureLabel:`Fotostandort automatisch erfassen`,autoCaptureHint:`Aktiv: Für jedes hochgeladene Bild mit EXIF-GPS wird ein Standort-Sidecar in data/locations/ erzeugt. Aus: Es wird nichts automatisch erfasst; das LLM kann EXIF weiterhin auf Anforderung lesen.`,statusOn:`Automatische Erfassung AN`,statusOff:`Automatische Erfassung AUS`,loadError:`Einstellungen konnten nicht geladen werden`,saveError:`Speichern fehlgeschlagen`},quitTab:{description:`Beendet den MulmoClaude-Server auf diesem Rechner. Über das Symbol gestartet, läuft er weiter, auch wenn du diesen Tab schließt — hier beendest du ihn ohne Terminal.`,restartHint:()=>"Zum erneuten Starten doppelklicke auf das MulmoClaude-Symbol (oder führe `npx mulmoclaude@latest` aus).",quitLabel:`MulmoClaude beenden`,confirmBody:`Der Server hält an und diese Seite funktioniert nicht mehr. Laufende Vorgänge werden abgebrochen.`,confirmLabel:`Beenden`,stopping:`Wird beendet…`,stoppedTitle:`MulmoClaude wurde beendet`,stoppedBody:`Du kannst diesen Tab schließen. Doppelklicke auf das Symbol, um neu zu starten.`,error:`Server konnte nicht beendet werden`},notificationsTab:{description:`Erhalte eine Push-Benachrichtigung auf deinen registrierten Geräten, wenn eine hier gestartete Aufgabe abgeschlossen ist — praktisch, wenn du etwas fragst, weggehst und wissen willst, sobald die Antwort fertig ist.`,enableLabel:`Web Push senden, wenn eine Aufgabe abgeschlossen ist`,enableHint:`Wird ausgelöst, wenn ein hier gestarteter Chat abgeschlossen ist. Geplante und Hintergrundaufgaben lösen es nicht aus.`,remoteHostNote:`Erfordert die RemoteHost-Verbindung (sie liefert die Anmeldung) und mindestens ein registriertes Gerät. Fehlt eines davon, passiert nichts.`,macosRemindersLabel:`Bei Aufgabenende eine macOS-Erinnerung anlegen`,macosRemindersHint:`Legt die erledigte Aufgabe in deiner Standard-Erinnerungsliste an. Die iCloud-Synchronisierung spiegelt sie auf dein iPhone, das die Mitteilung zustellt.`,macosRemindersForcedOff:`Beim Start durch --disable-macos-reminders oder DISABLE_MACOS_REMINDER_NOTIFICATIONS deaktiviert. Entferne die Option oder die Umgebungsvariable und starte neu, um sie hier zu steuern.`,statusOn:`Web Push ist AN`,statusOff:`Web Push ist AUS`,loadError:`Einstellungen konnten nicht geladen werden`,saveError:`Speichern fehlgeschlagen`},modelTab:{description:`Wählt das Modell und den Reasoning-Effort, die Claude Code pro Zug verwendet. Ohne Einstellung bleibt die Auflösung durch Claude selbst bestehen.`,modelLabel:`Modell`,modelUnset:`(nicht gesetzt — ~/.claude/settings.json folgen)`,modelHelperText:`Ohne Einstellung stammt das Modell aus ~/.claude/settings.json — dieselbe Datei, in die andere Claude-Code-Clients (VS Code, Cursor) ihre /model-Auswahl schreiben; eine Umstellung dort ändert also auch MulmoClaude. Aliase folgen der jeweils neuesten Generation einer Familie.`,modelConfigured:`Modell: {model}`,modelNotConfigured:`Nicht gesetzt (geteilt)`,effortLabel:`Reasoning-Effort`,effortUnset:`(nicht gesetzt — Standard von Claude verwenden)`,helperText:`Höhere Stufen erlauben mehr Denkzeit, erhöhen aber Latenz und Token-Verbrauch.`,configured:`Effort: {level}`,notConfigured:`Nicht gesetzt`,userSettingsLabel:`Benutzereinstellungen und Plugins von Claude Code laden`,userSettingsHint:`Liest Skills, Plugins und Hooks aus ~/.claude – dieselben, die Claude Code verwendet. Schalten Sie dies aus, wenn installierte Plugins so viele Skills mitbringen, dass jede Anfrage schwer wird; die Skills des Workspace bleiben nutzbar. Gilt ab der nächsten Nachricht. Ausgeschaltet folgt ein nicht gesetztes Modell auch nicht mehr ~/.claude/settings.json.`,skillListingSummary:`Im letzten Durchgang geladene Skills: {count}.`,skillListingPlugins:`Aus Plugins: {plugins}.`,skillListingHeavy:`So viele Skills machen jede Anfrage schwer; ausschalten entfernt die aus ~/.claude.`,loadError:`Einstellungen konnten nicht geladen werden`,saveError:`Speichern fehlgeschlagen`},voiceTab:{description:`Diktieren Sie Chat-Nachrichten mit Ihrer Stimme. Das Audio wird lokal auf dem Rechner transkribiert, der MulmoClaude ausführt — nichts wird an einen externen Dienst gesendet.`,requirements:`Nur unter macOS verfügbar. Erfordert den whisper.cpp-Server — bauen Sie ihn mit yarn build:whisper (siehe Abschnitt Local Voice Input in der README).`,unsupported:`Spracheingabe erfordert macOS mit installiertem whisper.cpp-Server. Auf diesem Rechner ist sie nicht verfügbar.`,enableLabel:`Spracheingabe aktivieren`,enableHint:`Beim Aktivieren wird das Sprachmodell (1–3 GB) einmalig heruntergeladen. Anschließend erscheint eine Mikrofon-Schaltfläche im Chat-Eingabefeld.`,modelLabel:`Sprachmodell`,downloading:`Modell wird heruntergeladen… {percent}%`,ready:`Modell bereit`,downloadError:`Modell-Download fehlgeschlagen.`,retry:`Erneut versuchen`,loadError:`Einstellungen konnten nicht geladen werden`,saveError:`Speichern fehlgeschlagen`},chatIndexTab:{description:`Automatische KI-Titel und Zusammenfassungen für den Chat-Verlauf. Standardmäßig aus — Automatisierungs-Sessions (Scheduler / System-Worker) werden auch bei aktivierter Option immer übersprungen; menschliche Sessions kosten pro beendetem Turn genau einen Summarizer-Aufruf.`,modeLabel:`Chat-Index-Modell`,helperText:`Haiku ist günstiger; Sonnet liefert schärfere Titel bei langen, themenwechselnden Sessions.`,mode:{off:`Aus`,haiku:`Haiku`,sonnet:`Sonnet`},status:{off:`Indizierung ist AUS`,haiku:`Indizierung läuft mit Haiku`,sonnet:`Indizierung läuft mit Sonnet`},loadError:`Einstellungen konnten nicht geladen werden`,saveError:`Speichern fehlgeschlagen`},journalTab:{description:`Automatisiertes Tages-Journal — fasst kürzliche Chat-Sessions in journal/*.md zusammen und extrahiert dauerhafte Memory-Notizen. Standardmäßig aus. Automatisierungs-Sessions (Scheduler / System-Worker) werden unabhängig von dieser Einstellung immer ausgeschlossen.`,modeLabel:`Journal-Modell`,helperText:`Haiku ist günstiger; Sonnet liefert reichhaltigere Tages- und Themen-Zusammenfassungen. Der stündliche Lauf startet nur, wenn dies gesetzt ist.`,mode:{off:`Aus`,haiku:`Haiku`,sonnet:`Sonnet`},status:{off:`Journal ist AUS`,haiku:`Journal läuft mit Haiku`,sonnet:`Journal läuft mit Sonnet`},loadError:`Einstellungen konnten nicht geladen werden`,saveError:`Speichern fehlgeschlagen`},geminiAskButton:`Claude fragen`,geminiAskMessage:`Welche Rolle spielt der Gemini-API-Schlüssel in dieser App?`,toolNamesLabel:`Tool-Namen`,invalidToolNamesPrefix:`Diese sehen nicht standardmäßig aus (erwartetes Präfix`,invalidToolNamesSuffix:`):`,mcpToolsError:`⚠ MCP-Tool-Status konnte nicht abgerufen werden: {error}. Alle Tools werden unabhängig von der Aktivierung angezeigt.`,changesHint:`Änderungen werden bei der nächsten Nachricht wirksam. Kein Neustart erforderlich.`,cannotSaveTooltip:`Kann nicht gespeichert werden, bis die Einstellungen erfolgreich geladen sind`,saving:`Wird gespeichert…`,loadingLabel:`Wird geladen…`,unsavedMarker:`●`,unsavedToolsConfirm:`Allowed Tools enthält ungespeicherte Änderungen. Trotzdem schließen?`,unsavedMcpDraftConfirm:`Ein MCP-Server-Entwurf ist noch offen. Trotzdem schließen?`,mcpSaveFailed:`Änderungen an den MCP-Servern konnten nicht gespeichert werden.`},canvasViewToggle:{stackViewTooltip:`Stapelansicht · klicken, um zur Einzelansicht zu wechseln`,singleViewTooltip:`Einzelansicht · klicken, um zur Stapelansicht zu wechseln`,switchToSingle:`Zur Einzelansicht wechseln`,switchToStack:`Zur Stapelansicht wechseln`},sessionHistoryToggle:{showTooltip:`Sitzungsverlauf-Panel links anzeigen`,hideTooltip:`Sitzungsverlauf-Panel ausblenden`,show:`Sitzungsverlauf anzeigen`,hide:`Sitzungsverlauf ausblenden`},sessionHistoryExpand:{expandTooltip:`Sitzungsverlauf-Panel auf volle Breite erweitern`,collapseTooltip:`Sitzungsverlauf-Panel verkleinern`,expand:`Sitzungsverlauf erweitern`,collapse:`Sitzungsverlauf verkleinern`},settingsWorkspaceDirs:{explanation:`Benutzerdefinierte Verzeichnisse zur Organisation von Dateien unter {dataDir} und {artifactsDir}. Claude nutzt sie, um das Speichern von Dateien zu steuern.`,noEntries:`Keine benutzerdefinierten Verzeichnisse konfiguriert.`,addDirTitle:`Verzeichnis hinzufügen`,pathPlaceholder:`data/kunden oder artifacts/berichte`,descPlaceholder:`Beschreibung (was in diesen Ordner gehört)`,errPathRequired:`Pfad ist erforderlich`,errMustStartWith:`Muss mit data/ oder artifacts/ beginnen`,errAlreadyExists:`Existiert bereits`},settingsReferenceDirs:{explanation:`Externe Verzeichnisse, die Claude lesen, aber nicht ändern kann. Im Docker-Modus werden sie schreibgeschützt eingebunden. Nützlich, um Obsidian-Vaults, Projektcode oder Dokumentordner zu referenzieren.`,noEntries:`Keine Referenzverzeichnisse konfiguriert.`,addDirTitle:`Referenzverzeichnis hinzufügen`,pathPlaceholder:`/Users/ich/ObsidianVault oder ~/Dokumente/notizen`,labelPlaceholder:`Label (optional — Standardwert ist der Ordnername)`,readOnlyBadge:`schreibgeschützt`,errPathRequired:`Pfad ist erforderlich`,errMustBeAbsolute:`Muss ein absoluter Pfad sein oder mit ~/ beginnen`,errAlreadyExists:`Existiert bereits`,errLabelConflict:`Label "{label}" existiert bereits`},dashboard:{empty:`Noch keine Lieblingssammlungen.`,emptyHint:`Hefte eine Sammlung (★) an, um sie hier zu sehen.`,viewTable:`Tabelle`,viewCalendar:`Kalender`,viewKanban:`Kanban`,viewPickerLabel:`Ansicht wählen`,openFull:`Zum Öffnen der Vollansicht doppelklicken`,dragHint:`Zum Neuordnen ziehen`,resizeHint:`Zum Ändern der Höhe ziehen`},pluginLauncher:{chat:{label:`Chat`},dashboard:{label:`Dashboard`},automations:{label:`Aktionen`},wiki:{label:`Wiki`},collections:{label:`Sammlungen`},feeds:{label:`Feeds`},accounting:{label:`Buchhaltung`},files:{label:`Dateien`}},shortcuts:{pin:`An Launcher anheften`,unpin:`Vom Launcher lösen`,zoneAriaLabel:`Angeheftete Verknüpfungen`,reorder:{open:`Verknüpfungen neu anordnen`,title:`Neu anordnen`,moveUp:`Nach oben`,moveDown:`Nach unten`}},fileContentHeader:{showRendered:`Gerendertes Markdown anzeigen`,showRaw:`Rohquelltext anzeigen`,rendered:`Gerendert`,raw:`Roh`,closeFile:`Datei schließen`,revealInOs:`Im Ordner anzeigen`,revealInOsFailed:`Ordner konnte nicht geöffnet werden`},fileContentRenderer:{download:`ZIP`,downloadZip:`Als eigenständiges ZIP herunterladen (Assets gebündelt)`,downloadError:`Download fehlgeschlagen`,selectFile:`Datei auswählen`,htmlPreview:`HTML-Vorschau`,pdfPreview:`PDF-Vorschau`,parseError:`Parse-Fehler`,editJson:`JSON bearbeiten`,jsonEditorLabel:`JSON-Editor`,invalidJson:`Ungültiges JSON`,undo:`Rückgängig`,redo:`Wiederholen`,editMarp:`Folienquelle bearbeiten`,marpEditorLabel:`Marp-Folienquelle`,openInOs:`Im Betriebssystem oeffnen`,openingInOs:`Wird geoeffnet…`,openInOsFailed:`Konnte nicht im Betriebssystem geoeffnet werden`,downloadFile:`Herunterladen`,downloadingFile:`Wird heruntergeladen…`},filesView:{chatPlaceholder:`Frage zu dieser Datei stellen…`},systemFiles:{schemaLabel:`Schema`,showDetails:`Details anzeigen`,hideDetails:`Details ausblenden`,editPolicy:{"agent-managed-but-hand-editable":`Agent-verwaltet (manuelle Bearbeitung erlaubt)`,"user-editable":`Benutzer-bearbeitbar`,"agent-managed":`Agent-verwaltet`,"fragile-format":`Empfindliches Format`,ephemeral:`Flüchtig`},mcp:{title:`MCP-Server`,summary:`Externe Model-Context-Protocol-Server, die mit dem Agenten verbunden sind. HTTP- oder Stdio-Server hinzufügen, um die Werkzeugauswahl zu erweitern.`},settings:{title:`App-Einstellungen`,summary:`Vom Benutzer bearbeitbare Verhaltenseinstellungen — Gemini-API-Schlüssel, erlaubte Werkzeuge, Sandbox-Konfiguration usw.`},schedulerTasks:{title:`Scheduler-Aufgaben`,summary:`Wiederkehrende Agent-Automationen, die nach Zeitplan ausgelöst werden. Verwaltet über die Automations-UI; diese Datei ist die Quelle auf Festplatte.`},schedulerOverrides:{title:`Scheduler-Überschreibungen`,summary:`Pro-Aufgabe Zeit-/Intervall-Überschreibungen über dem Systemzeitplan. Der Agent bearbeitet dies, wenn du den Zeitpunkt einer wiederkehrenden Aufgabe änderst.`},schedulerItems:{title:`Scheduler-Item-Warteschlange`,summary:`Geplante Aufrufe, die zur Auslösung bereitstehen. Agent-verwaltet; nicht von Hand bearbeiten, ohne jedes Feld zu verstehen.`},wikiIndex:{title:`Wiki-Index`,summary:`Automatisch erzeugter Index aller Wiki-Seiten. Wird bei jeder Wiki-Bearbeitung aktualisiert; nicht von Hand bearbeiten (Änderungen werden überschrieben).`},wikiLog:{title:`Wiki-Bearbeitungsprotokoll`,summary:`Aktivitätsprotokoll der Erstellungs- und Bearbeitungsvorgänge im Wiki. Agent-verwaltet und nur anhängend — nützlich als Feed der letzten Änderungen.`},wikiSummary:{title:`Wiki-Übersicht`,summary:`Automatisch erzeugte Übersicht des Wikis — Themencluster, Seitenzahl, jüngste Aktivitäten. Vom Agenten aktualisiert.`},wikiSchema:{title:`Wiki-Schema`,summary:`Formatspezifikation, die der Agent liest, um Wiki-Seiten konsistent zu halten. Empfindlich — eine bestimmte Struktur wird erwartet; bevorzuge Agent-getriebene Bearbeitung.`},memory:{title:`Memory`,summary:`Destillierte Fakten über dich, immer als Kontext für neue Gespräche geladen. Der Journal-Extraktor hängt automatisch an; manuelle Bearbeitung ebenfalls möglich.`},summariesIndex:{title:`Zusammenfassungs-Index`,summary:`Durchsuchbarer Index, der zu den vom Journal erzeugten Tages- und Themen-Zusammenfassungen verlinkt. Agent-verwaltet; bei jedem Journal-Lauf aktualisiert.`},rolesJson:{title:`Rollendefinition (JSON)`,summary:`Rollenkonfiguration — Modellauswahl, MCP-Server, erlaubte Plugins, Anfragen-Vorschläge. Vom Benutzer bearbeitbar, kein Neustart nötig.`},rolesMd:{title:`Rollenbeschreibung (Markdown)`,summary:`Persona und System-Prompt-Text der Rolle, geladen als Kontext, wenn diese Rolle aktiv ist. Vom Benutzer bearbeitbar; Änderungen wirken ab der nächsten Nachricht.`},journalDaily:{title:`Tägliche Journal-Zusammenfassung`,summary:`Automatisch erzeugte Rückschau auf deine Aktivitäten an einem Kalendertag, vom Journal-Lauf aus den Chat-Sitzungen destilliert.`},journalTopic:{title:`Themen-Journal`,summary:`Langlaufende Notizen zu einem bestimmten Thema, gesammelt und überarbeitet, während du weiter darüber sprichst. Agent-verwaltet.`}},settingsMcpTab:{explanation:`Externe MCP-Server hinzufügen. HTTP-Server funktionieren in allen Modi. Stdio-Server nutzen {npx} / {node} / {tsx} aus dem Sandbox-Image; wenn Docker aktiviert ist, müssen die Pfade im Workspace liegen.`,localhostRewrite:`Im Docker-Modus wird {localhost} zu {hostDockerInternal} umgeschrieben.`,noServers:`Noch keine MCP-Server konfiguriert.`,enabled:`aktiviert`,urlLabel:`URL:`,commandLabel:`Befehl:`,dockerStdioUnsupported:`⚠ Wird nicht ausgeführt, solange die Docker-Sandbox aktiv ist.`,dockerStdioHostExecActive:`⚠ Läuft auf dem Host — dieser Server verlässt die Docker-Sandbox.`,dockerStdioHostExecOptIn:`Trotzdem auf dem Host ausführen (fortgeschritten). Dieser Server läuft über ein lokales HTTP-Gateway außerhalb der Docker-Sandbox und kann auf Ihren Rechner zugreifen.`,learnMore:`Mehr erfahren`,addServerButton:`+ MCP-Server hinzufügen`,nameLabel:`Name`,namePlaceholder:`mein-server`,typeHttp:`HTTP`,typeStdio:`Stdio (Befehl)`,urlFieldLabel:`URL`,urlPlaceholder:`https://example.com/mcp`,commandFieldLabel:`Befehl`,argsLabel:`Argumente (eins pro Zeile)`,argsPlaceholder:()=>`-y
263
263
  @modelcontextprotocol/server-filesystem
264
- /workspace/path`,errNoName:`Bitte einen Namen angeben oder eine URL / Argumente eingeben, aus denen sich einer ableiten lässt.`,errBadName:`Der Name muss mit einem Kleinbuchstaben beginnen und darf nur [a-z0-9_-] enthalten.`,errIdExists:`Die Server-ID "{id}" existiert bereits.`,errBadHttpUrl:`Die HTTP-URL muss mit http:// oder https:// beginnen`,pendingEntryWarning:`Schließen Sie den ausstehenden MCP-Servereintrag zuerst ab oder brechen Sie ihn ab.`,customHeading:`Benutzerdefinierte Server`,catalog:{heading:`Vorkonfigurierte MCP-Server`,audience:{general:`🟢 Allgemein`,developer:`🔵 Entwickler`},risk:{low:`niedrig`,medium:`mittel`,high:`hoch`},upstream:`📦 Quelle`,setupGuide:`📚 Einrichtung`,entry:{memory:{displayName:`Memory`,description:`Lässt Claude den Gesprächskontext über Sitzungen hinweg merken.`},sequentialThinking:{displayName:`Sequenzielles Denken`,description:`Hilft Claude, komplexe Probleme schrittweise zu lösen.`},context7:{displayName:`Context7 (Bibliotheksdokumentation)`,description:`Aktuelle Dokumentation gängiger Bibliotheken — geht über das Trainings-Cutoff des Modells hinaus.`},deepwiki:{displayName:`DeepWiki (Wiki für GitHub-Repositories)`,description:`Stelle Fragen zu beliebigen GitHub-Repositories und erhalte eine strukturierte Antwort im Wiki-Stil.`},notion:{displayName:`Notion`,description:`Lese und schreibe in deinem Notion-Workspace — Seiten, Datenbanken und Suche.`,field:{apiKey:{label:`Notion-Integrationstoken`,help:`Erstelle eine Notion-Integration und kopiere das Internal Integration Secret. 🔑 öffnet die Integrationen-Seite.`}}},slack:{displayName:`Slack`,description:`Kanäle auflisten, Nachrichten senden und den Verlauf deines Slack-Workspaces durchsuchen.`,field:{botToken:{label:`Bot-Token`,help:`Slack-App → OAuth & Permissions → Bot User OAuth Token. Beginnt mit xoxb-.`},teamId:{label:`Team- / Workspace-ID`,help:`Rufe team.info auf oder prüfe die Workspace-URL — etwa T01ABC23DEF.`}}},googleMaps:{displayName:`Google Maps`,description:`Orte suchen, Routen berechnen und Standortdetails abrufen.`,field:{apiKey:{label:`Google-Maps-API-Key`,help:`Google Cloud Console → APIs & Services → Credentials → API-Key erstellen. Aktiviere Places + Directions.`}}},appleNative:{displayName:`Native Apple-Apps (macOS)`,description:`Liest und schreibt Erinnerungen, Kalender, Notizen, Mail und Karten via AppleScript. Nur macOS — keine Zugangsdaten nötig.`},gmail:{displayName:`Gmail`,description:`Liest, sendet und beschriftet dein Gmail. Nutzt einen Google-OAuth-Client, den du selbst in deinem eigenen Google-Cloud-Projekt erstellst (keine App-Verifizierung nötig).`,field:{credentials:{label:`Pfad zu credentials.json`,help:`Google Cloud Console → APIs & Services → Credentials → OAuth-Client-ID (Desktop app). Lade credentials.json herunter und füge den absoluten Pfad ein.`}}},googleCalendar:{displayName:`Google Kalender`,description:`Liest und erstellt Termine im Google Kalender. Gleiches BYO-credentials.json-Muster wie Gmail.`,field:{credentials:{label:`Pfad zu credentials.json`,help:`Verwende denselben Google-Cloud-OAuth-Client wie Gmail, oder erstelle einen separaten nur für Calendar.`}}},googleDrive:{displayName:`Google Drive`,description:`Sucht und liest Google-Drive-Dateien. BYO Google-OAuth-Zugangsdaten — Token wird lokal neben der Datei zwischengespeichert.`,field:{credentials:{label:`Pfad zu credentials.json`,help:`Google Cloud Console → APIs & Services → Credentials → OAuth-Client-ID (Desktop app). Aktiviere die Google-Drive-API im selben Projekt.`}}},github:{displayName:`GitHub`,description:"Liest Repos, Issues, PRs und führt Suchen mit einem Personal Access Token aus. Begrenze den Token-Scope — Schreibrechte (z.B. `repo`) erlauben dem Agenten Pushes auf jeden zugänglichen Repo.",field:{token:{label:`Personal Access Token`,help:`GitHub → Settings → Developer settings → Personal access tokens. Bevorzuge fine-grained tokens, die nur auf Repos beschränkt sind, in denen der Agent arbeiten soll.`}}},linear:{displayName:`Linear`,description:`Liest und aktualisiert Linear-Issues, -Projekte und -Cycles mit einem persönlichen API-Key.`,field:{apiKey:{label:`Linear-API-Key`,help:`Linear → Settings → API → Personal API keys. Klicke auf 🔑, um die Seite zu öffnen, und dann auf Create key.`}}},weatherOpenMeteo:{displayName:`Wetter (Open-Meteo)`,description:`Kostenlose Wettervorhersagen und aktuelle Bedingungen weltweit — ohne API-Key.`},spotify:{displayName:`Spotify`,description:`Suche Tracks, verwalte Playlists, steuere die Wiedergabe. BYO Spotify-Developer-App — nur Client ID (PKCE-Flow, kein Client Secret nötig).`,field:{clientId:{label:`Client ID`,help:"Spotify Developer Dashboard → Create app, setze die Redirect URI auf http://127.0.0.1:8888/callback, kopiere die Client ID. Führe dann einmal im Terminal `SPOTIFY_CLIENT_ID=<id> npx spotify-mcp@latest auth` aus, um dich anzumelden (Refresh-Token wird in ~/.spotify-mcp/tokens.json gecacht)."}}},youtubeTranscript:{displayName:`YouTube-Transkript`,description:`Holt die Untertitel zu jedem öffentlichen YouTube-Video per URL. Keine Zugangsdaten nötig.`}},config:{howToGet:`So erhältst du den Wert`,install:`Installieren`,errMissingRequired:`Pflichtfelder fehlen: {fields}`,requiredMarker:`*`,requiredAria:`Pflichtfeld`}}},pluginScheduler:{previewIcon:`📅`,previewAutomations:`{count} Automatisierung | {count} Automatisierungen`,previewMore:`+ {count} weitere…`},pluginSchedulerTasks:{recommendedFrequencies:`Empfohlene Häufigkeiten`,tableTaskType:`Aufgabentyp`,tableSuggestedSchedule:`Empfohlener Zeitplan`,noTasks:`Keine geplanten Aufgaben`,runNow:`Jetzt ausführen`,enable:`Aktivieren`,disable:`Deaktivieren`,delete:`Löschen`,nextRun:`Nächste: {time}`,originSystem:`System`,originUser:`Benutzer`,originSkill:`Skill`,runFailed:`Ausführung fehlgeschlagen: {error}`,toggleFailed:`Umschalten fehlgeschlagen: {error}`,deleteFailed:`Löschen fehlgeschlagen: {error}`,detailsToggle:`Details anzeigen`,promptLabel:`Prompt`,roleLabel:`Rolle`,confirmDelete:`Aufgabe {name} löschen? Dies kann nicht rückgängig gemacht werden.`,hintNewsRss:`News- / RSS-Abruf`,hintJournal:`Täglicher Journallauf`,hintWiki:`Wiki-Wartung`,hintMemory:`Speicherextraktion`,hintCalendar:`Kalender- / Kontaktsynchronisierung`},pluginCanvas:{undo:`Rückgängig`,redo:`Wiederherstellen`,clear:`Löschen`,styleLabel:`Stil:`,stylePromptWithPath:"Wandle das Bild unter `{path}` in ein Bild im {style}-Stil um.",stylePromptNoPath:`Wandle meine Zeichnung auf dem Canvas in ein Bild im {style}-Stil um.`,saveFailed:`Nicht gespeichert`},pluginWiki:{backToIndex:`Zurück zum Index`,pdf:`PDF`,pdfFailed:`⚠ PDF fehlgeschlagen`,tabIndex:`Index`,tabLog:`Protokoll`,tabLint:`Lint`,tabGraph:`Graph`,graphEmpty:`Noch keine Verknüpfungen für den Graphen.`,linkedReferences:`Eingehende Verweise`,empty:`Das Wiki ist leer. Bitten Sie den Wiki Manager, eine Quelle einzulesen.`,previewMore:`+ {count} weitere…`,chatPlaceholder:`Fragen Sie zu dieser Seite…`,emptyPage:`Die Seite „{title}“ existiert noch nicht.`,emptyContent:`Die Seite „{title}“ existiert, hat aber keinen Inhalt.`,createPage:`Erstellung dieser Wiki-Seite anfordern`,updatePage:`Aktualisierung dieser Wiki-Seite anfordern`,tagFilterAll:`Alle`,noMatches:`Keine Seiten mit dem Tag #{tag}`,lintChat:`Wiki prüfen`,taskCountMismatch:`Wiki-Quelle und gerendertes Ergebnis stimmen in der Anzahl der Aufgaben nicht überein. Die Umschaltung wurde abgelehnt, um eine Beschädigung der Datei zu vermeiden.`,metadataCreated:`Erstellt`,metadataUpdated:`Aktualisiert`,metadataEditor:`Bearbeiter`,pageEditHeader:`Wiki-Bearbeitung`,snapshotExpired:`Snapshot abgelaufen — aktuelle Seite wird angezeigt`,snapshotLoadError:`Snapshot konnte nicht geladen werden — die Seite existiert möglicherweise noch. Bitte aktualisieren.`,pageDeleted:`Seite gelöscht`,history:{tabContent:`Inhalt`,tabHistory:`Verlauf`,empty:`Noch kein Verlauf — bearbeite diese Seite, und die erste Version erscheint hier.`,loading:`Verlauf wird geladen…`,backToList:`Zurück zum Verlauf`,restoreButton:`Diese Version wiederherstellen`,restoreConfirmTitle:`Diese Version wiederherstellen?`,restoreConfirmBody:`Seite auf die Version vom {ts} von {editor} zurücksetzen. Die aktuelle Seite wird ersetzt. Der bestehende Verlauf bleibt erhalten.`,restoreConfirmAction:`Wiederherstellen`,restoreConfirmCancel:`Abbrechen`,restoreSuccessToast:`Seite wiederhergestellt.`,restoreFailureBanner:`Wiederherstellung fehlgeschlagen: {error}`,compareCurrent:`Mit aktueller Seite vergleichen`,comparePrevious:`Mit vorheriger Version vergleichen`,diffNoPrevious:`Keine vorherige Version zum Vergleichen vorhanden.`,diffNoChanges:`Zwischen dieser Version und dem Vergleichsobjekt gibt es keine inhaltlichen Unterschiede.`,editorBadgeUser:`Benutzer`,editorBadgeLLM:`LLM`,editorBadgeSystem:`System`,hiddenLines:`{count} unveränderte Zeilen ausgeblendet`,expandHidden:`Anzeigen`}},pluginPresentForm:{fallbackTitle:`Formular`,fieldCount:`{count} Feld | {count} Felder`,submitted:`Gesendet`,errorSummary:`Bitte korrigieren Sie die folgenden Fehler`,requiredMarker:`*`,selectOption:`Bitte auswählen`,charactersCount:`{current} / {max} Zeichen`,charactersCountNoMax:`{current} Zeichen`,submit:`Senden`,progress:`{filled} von {total} Pflichtfeldern ausgefüllt`},pluginPresentSvg:{saveAsPng:`Als PNG herunterladen`,png:`PNG`,saveAsPdf:`Als PDF speichern (öffnet Druckdialog)`,pdf:`PDF`,untitled:`SVG-Zeichnung`,editSource:`SVG-Quelltext bearbeiten`,cancel:`Abbrechen`,applyChanges:`Änderungen anwenden`,saving:`Wird gespeichert...`,saveError:`⚠ Speichern fehlgeschlagen: {error}`,exportError:`⚠ Export fehlgeschlagen: {error}`,loadingSource:`Quelltext wird geladen…`,sourceError:`Quelltext konnte nicht geladen werden: {error}`},photoLocations:{title:`Fotostandorte`,summary:`{total} erfasst · {withGps} mit GPS`,mapHint:`Bitte Claude um "auf der Karte anzeigen", um sie mit dem Google-Map-Plugin einzuzeichnen.`,loading:`Lädt…`,empty:`Noch keine Fotostandorte erfasst. Sende ein Foto mit GPS-Tag über den Chat oder eine verbundene Bridge, um zu beginnen.`,noGps:`Keine GPS-Daten`},pluginManageSkills:{deleteProjectSkill:`Diese Projekt-Skill löschen`,unstarPresetSkill:`Markierung dieser Preset-Skill entfernen — sie kehrt in den Katalog zurück`,heading:`Skills`,previewCount:`{count} Skill | {count} Skills`,previewMore:`+{count} weitere`,subheading:({named:e})=>`${e(`count`)} verfügbar · zum Anzeigen klicken · "Run" ruft sie als /<name> auf`,emptyWithPath:`Keine Skills gefunden. Fügen Sie Skill-Ordner unter {path} hinzu.`,emptySkillPath:`~/.claude/skills/`,selectHint:`Wählen Sie links eine Skill aus, um ihre SKILL.md anzuzeigen.`,loading:`Wird geladen…`,fieldDescription:`Beschreibung`,fieldBody:`Inhalt (Markdown)`,emptyBody:`(leerer Inhalt)`,btnEdit:`Bearbeiten`,btnDelete:`Löschen`,btnUnstar:`Markierung entfernen`,errListFailed:`Skills konnten nicht geladen werden: {error}`,errDetailFailed:`Skill konnte nicht geladen werden: {error}`,errSaveFailed:`Speichern fehlgeschlagen: {error}`,errDeleteFailed:`Löschen fehlgeschlagen`,confirmDelete:`Skill "{name}" löschen? Dies entfernt ~/mulmoclaude/.claude/skills/{name}/SKILL.md.`,confirmUnstar:`Skill "{name}" zurück in den Katalog verschieben? Sie wird nicht mehr in den Prompt geladen, aber die Katalog-Kopie bleibt erhalten — du kannst sie jederzeit erneut markieren.`,sectionActive:`Aktiv`,sectionCatalog:`Katalog`,sectionLegendActive:`Skills, die Claude jetzt verwenden kann. Claude verwendet sie automatisch im Verlauf des Gesprächs, oder du kannst eine durch Eingabe ihres Namens aufrufen. {system} System (mc- mitgeliefert) / {project} Projekt (bearbeitbar, nur in diesem Workspace) / {user} Nutzer (Skills in ~/.claude/skills/) / {claudePlugin} Plugin (aus einem installierten Claude-Code-Plugin, schreibgeschützt).`,sectionLegendCatalog:`Katalog: Skills, die durch {star} Markieren Aktiv werden. {star} in Aktiv entfernen bringt eine Skill zurück in den Katalog — Claude verwendet sie dann nicht mehr (die Skill wird nicht gelöscht).`,catalogEmpty:`Keine Preset-Skills verfügbar.`,catalogPresetHeading:`Presets`,catalogStar:`Markieren`,catalogStarred:`Markiert`,sourceUserTitle:`Benutzer-Skill (~/.claude/skills/, in allen Workspaces verfügbar)`,sourceClaudePluginTitle:`Plugin-Skill (installiertes Claude-Code-Plugin — schreibgeschützt, wird vom Plugin aktualisiert)`,sourceSystemTitle:`System-Skill (mitgeliefert, mc- Präfix — schreibgeschützt, vom Launcher überschrieben)`,sourceProjectTitle:`Projekt-Skill (.claude/skills/ des Workspaces, nur dieser Workspace)`,sourcePresetTitle:`Preset-Katalog — Markieren anklicken, um in diesem Workspace zu aktivieren`,errCatalogListFailed:`Katalog konnte nicht geladen werden: {error}`,errCatalogStarFailed:`Skill konnte nicht markiert werden: {error}`,errCatalogPreviewFailed:`Skill-Vorschau konnte nicht geladen werden: {error}`,catalogAddRepo:`Skill-Repository hinzufügen`,catalogAddRepoTitle:`Ein Skill-Repository hinzufügen`,catalogRepoUrlLabel:`GitHub-URL`,catalogRepoUrlPlaceholder:`https://github.com/owner/repo`,catalogRepoSubpathLabel:`Unterpfad (optional)`,catalogRepoSubpathPlaceholder:`skills`,catalogAddRepoSubmit:`Installieren`,catalogAddRepoSuggestions:`Vorgeschlagene Repositories`,catalogUninstallRepo:`Repository deinstallieren`,catalogUpdateRepo:`Repository aktualisieren (neueste Version erneut laden)`,catalogRepoOpenLink:`Repository auf GitHub öffnen (neuer Tab)`,catalogUninstallConfirm:`Dieses Repository deinstallieren? Bereits mit Stern markierte Skills bleiben in deiner aktiven Liste.`,catalogRepoInstalling:`Installiere…`,catalogRepoEmpty:`In diesem Repository wurden keine Skills gefunden.`,sourceExternalTitle:`Externe Skill (aus einem GitHub-Repository installiert — zum Aktivieren auf den Stern klicken)`,errCatalogRepoListFailed:`Installierte Repositories konnten nicht geladen werden: {error}`,errCatalogRepoInstallFailed:`Repository konnte nicht installiert werden: {error}`,errCatalogRepoUninstallFailed:`Repository konnte nicht deinstalliert werden: {error}`,errCatalogRepoInvalidUrl:`Gib eine GitHub-Repository-URL ein.`},pluginManageRoles:{heading:`Benutzerdefinierte Rollen`,roleCount:`{count} Rolle | {count} Rollen`,addButton:`+ Hinzufügen`,createPanel:`Neue Rolle erstellen`,fieldId:`ID`,fieldName:`Name`,fieldIcon:`Symbol`,fieldPrompt:`Prompt`,fieldPlugins:`Plugins`,fieldModel:`Modell`,modelUnset:`(nicht gesetzt — der globalen Einstellung folgen)`,modelHelp:`Sitzungen mit dieser Rolle laufen auf diesem Modell. Nützlich, um eine Routine-Rolle aus dem Wochenlimit des Top-Modells herauszuhalten. Eingebaute Rollen folgen immer der globalen Einstellung.`,fieldStarterQueries:`Einstiegsfragen`,onePerLine:`(eine pro Zeile)`,helpLink:`?`,idFormatted:`({id})`,missingEnv:`({env} fehlt)`,requiresEnv:`Erfordert {env} in .env`,collapse:`Einklappen`,expand:`Ausklappen`,idPlaceholder:`eindeutige-id`,creating:`Wird erstellt…`,create:`Erstellen`,updating:`Wird aktualisiert…`,update:`Aktualisieren`,cancel:`Abbrechen`,delete:`Löschen`,emptyHint:`Noch keine benutzerdefinierten Rollen. Klicken Sie auf "+ Hinzufügen" oder bitten Sie Claude, eine zu erstellen.`,errIdRequired:`Die ID ist erforderlich.`,errIdInvalid:`Die ID darf nur Buchstaben, Zahlen, '-' und '_' enthalten.`,errNameRequired:`Der Name ist erforderlich.`,errIdDuplicate:`Eine Rolle mit der ID '{id}' existiert bereits.`,errCreateFailed:`Erstellen fehlgeschlagen`,errSaveFailed:`Speichern fehlgeschlagen`,errDeleteFailed:`Löschen fehlgeschlagen`,errNetworkError:`Netzwerkfehler`,errServerError:`Serverfehler: {status}`,errRefreshFailed:`Gespeichert, aber die Liste konnte nicht aktualisiert werden.`,confirmDelete:`Rolle {name} löschen? Dies kann nicht rückgängig gemacht werden.`},pluginUiImage:{promptLabel:`{label}:`},markdownCodeCopy:{copyLabel:`Code kopieren`,copiedLabel:`Kopiert`},markdownMermaid:{loadFailed:`⚠ Mermaid konnte nicht geladen werden: {error}`,renderFailed:`⚠ Mermaid-Rendering fehlgeschlagen: {error}`},pluginTextResponse:{pdf:`PDF`,pdfFailed:`⚠ PDF fehlgeschlagen`,editContent:`Textinhalt bearbeiten`,applyChanges:`Änderungen übernehmen`,copyLabel:`Kopieren`,speakerSystem:`System`,speakerUser:`Sie`,speakerAssistant:`Assistent`,copiedLabel:`Kopiert!`,cancel:`Abbrechen`,seededByPlugin:`von {pkg}`,seededByPluginTooltip:`Diese Nachricht wurde vom Plugin {pkg} erstellt und nicht von Ihnen gesendet.`,truncatedForRender:`Diese Nachricht ist ungewöhnlich lang (insgesamt {total} Zeichen). Nur der erste Teil wird angezeigt – {omitted} Zeichen ausgeblendet, damit der Tab reaktionsfähig bleibt. Nutze „Kopieren“ für den vollständigen Text.`},pluginSkill:{noDescription:`(keine Beschreibung)`},pluginSpreadsheet:{previewUntitled:`Tabelle`,previewSheets:`{count} Blatt | {count} Blätter`,untitled:`Tabelle`,excel:`Excel`,valuePlaceholder:`Wert`,valueOrFormulaPlaceholder:`Wert oder Formel (z. B. 100 oder SUM(B2:B11))`,formatPlaceholder:`Format (z. B. $#,##0.00)`,loading:`Tabelle wird geladen...`,noData:`Keine Tabellendaten verfügbar`,editData:`Tabellendaten bearbeiten`,applyChanges:`Änderungen übernehmen`,dataMustBeArray:`Daten müssen ein Array von Blättern sein`,loadFailed:`Laden der Tabelle fehlgeschlagen: {error}`,invalidJsonAlert:`Ungültiges JSON-Format: {error}`,unknownError:`Unbekannter Fehler`,update:`Aktualisieren`,stringType:`Zeichenkette`,formulaType:`Formel`},app:{startConversation:`Gespräch beginnen`,thinking:`Denkt nach…`},suggestionsPanel:{suggestions:`Vorschläge`,skills:`Skills`,tooltip:`Vorschläge und Skills`,emptySuggestions:`Keine Vorschläge.`,emptySkills:`Keine Skills installiert.`,skillsError:`Fehler beim Laden der Skills: {error}`,sendEditHint:`klicken zum Senden · Shift+Klick zum Bearbeiten`},settingsToolsTab:{explanation:`Zusätzliche Tool-Namen, die Claude über {allowedTools} übergeben werden sollen. Einer pro Zeile. Nützlich für in Claude Code integrierte MCP-Server wie Gmail / Google Kalender, nachdem Sie sich über {claudeMcp} authentifiziert haben.`,connectorsSectionTitle:`Verbundene Konnektoren`,connectorsEmpty:`Keine Konnektoren gefunden.`,connectorConnected:`Verbunden`,connectorDisconnected:`Nicht verbunden`,connectorsGuide:`Konnektoren wie Slack und Gmail erlauben Claude den Zugriff auf Ihre Konten. Konnektoren können in Claude Desktop oder {configLink} hinzugefügt oder entfernt werden. (Öffnet claude.ai)`,connectorsConfigLinkText:`hier`},confirmModal:{defaultTitle:`Bestätigen`,defaultConfirm:`Bestätigen`,defaultCancel:`Abbrechen`}},UI=[`en`,`ja`,`zh`,`ko`,`es`,`pt-BR`,`fr`,`de`],xlt={en:plt,ja:mlt,zh:hlt,ko:glt,es:_lt,"pt-BR":vlt,fr:ylt,de:blt};function WI(e){return UI.some(t=>t===e)}function Slt(e){if(WI(e))return e;let t=e.toLowerCase();for(let e of UI)if(e.toLowerCase()===t)return e;let[n=t]=t.split(`-`);return WI(n)?n:UI.find(e=>e.toLowerCase().startsWith(`${n}-`))??null}var Clt=`en`;function wlt(){if(typeof navigator<`u`){let e=navigator.languages&&navigator.languages.length>0?navigator.languages:[navigator.language];for(let t of e){if(typeof t!=`string`)continue;let e=Slt(t);if(e)return e}}return Clt}var Tlt=wlt(),GI=Ge({legacy:!1,locale:Tlt,fallbackLocale:`en`,messages:xlt}),KI=Qce,Elt=[`frame-src`,`script-src`,`style-src`,`font-src`,`img-src`,`media-src`,`connect-src`],qI=(e,t)=>[...e[t]??[]];function Dlt(e){try{let t=new URL(e);return t.protocol!==`https:`||e.toLowerCase()!==`https://${t.host}`?!1:t.hostname.length>0&&[...t.hostname].every(e=>/[a-z0-9.-]/i.test(e))}catch{return!1}}function Olt(e){if(!Ma(e))return{};let t={};for(let n of Elt){let r=e[n];if(!Array.isArray(r))continue;let i=r.map(e=>typeof e==`string`?e.trim():``).filter(Dlt);i.length>0&&(t[n]=[...new Set(i)])}return t}function klt(e,t,n,r=``,i=``,a={}){let o=[...n],s=Olt(a),c=[`default-src 'none'`,`script-src ${[`'unsafe-inline'`,...o,...qI(s,`script-src`)].join(` `)}`,`style-src ${[`'unsafe-inline'`,...o,...qI(s,`style-src`)].join(` `)}`,`font-src ${[...o,...qI(s,`font-src`)].join(` `)}`,`img-src ${[t,...o,`data:`,`blob:`,...r?[r]:[],...qI(s,`img-src`)].join(` `)}`],l=[...i?[i]:[],...qI(s,`media-src`)];l.length>0&&c.push(`media-src ${l.join(` `)}`);let u=qI(s,`frame-src`);return u.length>0&&c.push(`frame-src ${u.join(` `)}`),c.push(`connect-src ${[e,...qI(s,`connect-src`)].join(` `)}`),c.join(`; `)}function Alt(e,t=KI,n={}){return klt(`'none'`,e??`'self'`,t,``,``,n)}function jlt(e,t=KI,n={}){return klt(e,e,t,`https:`,`${e} https: data: blob:`,n)}var Mlt=``;function Nlt(e,t={}){let n=`<meta http-equiv="Content-Security-Policy" content="${Alt(void 0,KI,t)}">`;return/<head\b[^>]*>/i.test(e)?e.replace(/(<head\b[^>]*>)/i,`$1${n}`):`<!DOCTYPE html><html><head>${n}</head><body>${e}</body></html>${Mlt}`}M();var Plt=V({}),Flt=ee(Plt);async function JI(){try{let e=await pN(SP.config.base);e.ok&&(Plt.value=Olt(e.data.csp??{}))}catch{}}var Ilt={key:`text-blue-700`,string:`text-green-700`,number:`text-orange-600`,keyword:`text-purple-700`,punct:`text-gray-500`,whitespace:``},Llt=[{type:`string`,pattern:/^"(?:[^"\\]|\\.)*"/},{type:`keyword`,pattern:/^(?:true|false|null)\b/},{type:`number`,pattern:/^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/},{type:`whitespace`,pattern:/^\s+/},{type:`punct`,pattern:/^[{}[\]:,]/}];function Rlt(e){for(let{type:t,pattern:n}of Llt){let r=n.exec(e);if(r)return{type:t,value:r[0]}}return null}function YI(e){let t=[],n=0;for(;n<e.length;){let r=e.slice(n),i=Rlt(r);if(!i){t.push({type:`punct`,value:r.slice(0,1)}),n++;continue}t.push(i),n+=i.value.length}return Vlt(t)}var zlt=e=>e?.type===`punct`&&e.value===`:`,Blt=(e,t)=>{let n=e[t+1];return n?.type===`whitespace`?e[t+2]:n};function Vlt(e){return e.map((t,n)=>t.type===`string`&&zlt(Blt(e,n))?{type:`key`,value:t.value}:t)}function Hlt(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Ult(e){return e.split(/\r?\n/).filter(e=>e.trim().length>0).map(e=>{try{return{tokens:YI(JSON.stringify(JSON.parse(e),null,2)),parseError:!1}}catch{return{tokens:YI(e),parseError:!0}}})}o();function XI(e,t){if(!e)return!1;let n=e.toLowerCase();return t.some(e=>n.endsWith(e))}var Wlt=`artifacts/html/`;function ZI(e){if(!e)return null;let t=e.toLowerCase();if(!t.endsWith(`.html`)&&!t.endsWith(`.htm`)||!e.startsWith(Wlt))return null;let n=e.slice(15);return n.length===0?null:`/artifacts/html/${n.split(`/`).map(encodeURIComponent).join(`/`)}`}var Glt=`artifacts/svg/`;function QI(e){if(!e||!e.toLowerCase().endsWith(`.svg`)||!e.startsWith(Glt))return null;let t=e.slice(14);return t.length===0?null:`/artifacts/svg/${t.split(`/`).map(encodeURIComponent).join(`/`)}`}function Klt(e,t){let n=m(()=>XI(e.value,[`.md`,`.markdown`])),r=m(()=>XI(e.value,[`.html`,`.htm`])),i=m(()=>XI(e.value,[`.json`])),a=m(()=>XI(e.value,[`.jsonl`,`.ndjson`])),o=m(()=>t.value?.kind===`text`&&r.value?Nlt(t.value.content,Flt.value):``);return Ve(()=>t.value?.kind===`text`&&r.value,e=>{e&&JI()},{immediate:!0}),{isMarkdown:n,isHtml:r,isJson:i,isJsonl:a,sandboxedHtml:o,htmlPreviewUrl:m(()=>r.value?ZI(e.value):null),jsonTokens:m(()=>!t.value||t.value.kind!==`text`||!i.value?[]:YI(Hlt(t.value.content))),jsonlLines:m(()=>!t.value||t.value.kind!==`text`||!a.value?[]:Ult(t.value.content)),mdFrontmatter:m(()=>{if(!t.value||t.value.kind!==`text`||!n.value)return null;let e=Ba(t.value.content),r=Object.entries(e.meta).map(([e,t])=>({key:e,value:t}));return{...e,fields:r}})}}M();function qlt(){let e=V(null),t=V(!1),n=V(null),r=null;async function i(i){r?.abort();let a=new AbortController;r=a,t.value=!0,n.value=null,e.value=null;try{let t=await pN(SP.files.content,{path:i},{signal:a.signal});if(a.signal.aborted)return;t.ok?e.value=t.data:n.value=t.error}finally{r===a&&(t.value=!1,r=null)}}function a(){r?.abort(),r=null,t.value=!1}return{content:e,contentLoading:t,contentError:n,loadContent:i,abortContent:a}}M();function $I(e){return typeof e!=`string`||e.length===0||e.startsWith(`/`)?!1:!e.split(`/`).some(e=>e===`..`)}function eL(e){return Array.isArray(e)?e.length===0?null:e.join(`/`):Pa(e)?e:null}function Jlt(){let e=OI(),t=DI(),{content:n,contentLoading:r,contentError:i,loadContent:a,abortContent:o}=qlt(),s=eL(e.params.pathMatch),c=V($I(s)?s:null);function l(n){c.value=n,a(n),t.push({name:`files`,params:{pathMatch:n.split(`/`)},query:e.query}).catch(e=>{CI(e)||console.error(`[selectFile] navigation failed:`,e)})}function u(){o(),c.value=null,n.value=null,i.value=null,t.replace({name:`files`,params:{pathMatch:[]},query:e.query}).catch(e=>{CI(e)||console.error(`[deselectFile] navigation failed:`,e)})}return{selectedPath:c,content:n,contentLoading:r,contentError:i,loadContent:a,selectFile:l,deselectFile:u,abortContent:o}}M();var Ylt=x({});function Xlt(e){return Ylt[e]??0}function Zlt(e){Ylt[e]=Date.now()}var Qlt=`/api/files/raw`;function $lt(e){Qlt=e}var eut=`artifacts/images/`;function tL(e){return e.startsWith(`data:`)?e:e.startsWith(eut)?`/${e}`:`${Qlt}?path=${encodeURIComponent(e)}`}function tut(e){if(e.startsWith(`data:`))return e;let t=tL(e),n=Xlt(e);return n<=0?t:`${t}${t.includes(`?`)?`&`:`?`}v=${n}`}var nut=150,rut=150;function iut(){return`(function(){var v=window.__MC_VIEW,cbs=[],t,qcbs=[],qt;function fire(){t=undefined;cbs.slice().forEach(function(cb){try{cb()}catch(e){}});}function fireQuery(){qt=undefined;var q=v.searchQuery;qcbs.slice().forEach(function(cb){try{cb(q)}catch(e){}});}window.addEventListener('message',function(e){if(e.source!==window.parent)return;var d=e.data;if(!d||d.type!=='mc-collection-changed'||d.slug!==v.slug)return;if(t)clearTimeout(t);t=setTimeout(fire,${nut});});var qch=new MessageChannel();qch.port1.onmessage=function(e){var d=e.data;if(!d||d.type!=='mc-search-query')return;v.searchQuery=typeof d.query==='string'?d.query:'';if(qt)clearTimeout(qt);qt=setTimeout(fireQuery,${rut});};window.parent.postMessage({type:'mc-view-ready',slug:v.slug},v.origin,[qch.port2]);v.onChange=function(cb){if(typeof cb!=='function')return function(){};cbs.push(cb);return function(){var i=cbs.indexOf(cb);if(i>=0)cbs.splice(i,1);};};v.onSearchQueryChange=function(cb){if(typeof cb!=='function')return function(){};qcbs.push(cb);return function(){var i=qcbs.indexOf(cb);if(i>=0)qcbs.splice(i,1);};};v.openItem=function(id,mode){window.parent.postMessage({type:'mc-open-item',slug:v.slug,id:String(id),mode:mode==='edit'?'edit':'view'},v.origin);};v.startChat=function(prompt,role){window.parent.postMessage({type:'mc-start-chat',slug:v.slug,prompt:String(prompt),role:typeof role==='string'?role:undefined},v.origin);};v.dict=v.dict||{};v.t=function(key,named){var s=v.dict[key];if(typeof s!=='string')return typeof key==='string'?key:String(key);if(!named||typeof named!=='object')return s;return s.replace(/\\{(\\w+)\\}/g,function(m,n){var x=named[n];return x==null?m:String(x);});};document.addEventListener('securitypolicyviolation',function(e){window.parent.postMessage({type:'mc-csp-violation',slug:v.slug,nonce:v.cspNonce,blockedURI:e.blockedURI,violatedDirective:e.violatedDirective,effectiveDirective:e.effectiveDirective},v.origin);});})();`}function aut(e,t){return e.startsWith(`/`)?`${t}${e}`:e}function out(e,t,n={},r=``){let i=`${`<meta http-equiv="Content-Security-Policy" content="${jlt(t.origin,void 0,n)}">`}<script>window.__MC_VIEW=${JSON.stringify({slug:t.slug,token:t.token,dataUrl:aut(t.dataUrl,t.origin),origin:t.origin,searchQuery:``,cspNonce:r,locale:t.locale??``,dict:t.dict??{}}).replace(/</g,`\\u003c`)};${iut()}<\/script>`;return/<head\b[^>]*>/i.test(e)?e.replace(/(<head\b[^>]*>)/i,`$1${i}`):`<!DOCTYPE html><html><head>${i}</head><body>${e}</body></html>`}M();var sut=5,nL=V([]),cut=ee(nL);function lut(){nL.value=[]}function uut(e){try{return new URL(e).origin}catch{return e}}var dut=64,rL=new Set;function fut(e){if(e)for(rL.add(e);rL.size>dut;){let e=rL.values().next().value;if(e===void 0)break;rL.delete(e)}}function put(e){return Ma(e)&&e.type===`mc-csp-violation`}function mut(e){if(!put(e))return null;let t=typeof e.blockedURI==`string`?e.blockedURI:``,n=typeof e.violatedDirective==`string`?e.violatedDirective:typeof e.effectiveDirective==`string`?e.effectiveDirective:``;return!t||t===`inline`||t===`eval`?null:{host:uut(t),directive:n.split(` `)[0]||``}}function hut(e){if(nL.value.some(t=>t.host===e.host&&t.directive===e.directive))return;nL.value=[e,...nL.value].slice(0,sut);let t=e.directive?` (${e.directive})`:``;console.warn(`[csp] blocked ${e.host}${t}. To allow it, add the host to config/csp.json — but only if you trust it.`)}function gut(e,t,n){return e!==`null`||!put(t)||!n(typeof t.nonce==`string`?t.nonce:``)?null:mut(t)}function _ut(e){let t=gut(e.origin,e.data,e=>rL.has(e));t&&hut(t)}var vut=!1;function yut(){vut||typeof window>`u`||(vut=!0,window.addEventListener(`message`,_ut))}M();var iL=V({isOpen:!1,title:``,message:``,confirmText:``,cancelText:``,variant:`primary`,resolve:null});function but(){function e(e){let t=typeof e==`string`?{message:e}:e;return new Promise(e=>{let n=iL.value.resolve;n&&n(!1),iL.value={isOpen:!0,title:t.title||``,message:t.message,confirmText:t.confirmText||``,cancelText:t.cancelText||``,variant:t.variant||`primary`,resolve:e}})}function t(e){iL.value.resolve&&iL.value.resolve(e),iL.value.isOpen=!1,iL.value.resolve=null}return{confirmState:iL,openConfirm:e,handleConfirm:t}}function xut(){let e=Promise.resolve();return{enqueue:t=>{let n=e.then(t,t);return e=n.then(()=>void 0,()=>void 0),n}}}var Sut=Object.keys({kind:!0,slug:!0,title:!0,icon:!0,color:!0});function Cut(e){let t=Object.entries(e);return Object.fromEntries(t.filter(([e])=>!Sut.includes(e)))}function aL(e,t){return e.kind===t.kind&&e.slug===t.slug}function wut(e,t,n){let r=n===`up`?t-1:t+1,i=e[t],a=e[r];if(!i||!a)return e;let o=[...e];return o[t]=a,o[r]=i,o}function Tut(e,t,n,r){let i=e.findIndex(e=>aL(e,{kind:t,slug:n}));return i<0?e:wut(e,i,r)}function Eut(e){return e===void 0?{}:{color:e}}function Dut(e,t){return t.title!==e.title||t.icon!==e.icon||t.color!==e.color}function Out(e,t){return{...Cut(e),kind:e.kind,slug:e.slug,title:t.title,icon:t.icon,...Eut(t.color)}}function kut(e,t,n){let r=new Map(n.map(e=>[e.slug,e])),i=e.flatMap(e=>{if(e.kind!==t)return[e];let n=r.get(e.slug);return n?[Dut(e,n)?Out(e,n):e]:[]});return{next:i,drifted:i.length!==e.length||i.some((t,n)=>t!==e[n])}}o(),M();var oL=V([]),sL=V(null),cL=V(!1),lL=null;async function uL(e=!1){return lL&&!e||(lL=(async()=>{let e=await pN(SP.shortcuts);if(!e.ok){sL.value=e.error,lL=null;return}sL.value=null,oL.value=e.data.shortcuts,cL.value=!0})()),lL}var{enqueue:dL}=xut();async function fL(e,t){oL.value=e;let n=await hN(SP.shortcuts,{shortcuts:e});return n.ok?(oL.value=n.data.shortcuts,sL.value=null,!0):(oL.value=t,sL.value=n.error,console.error(`[useShortcuts] persist failed`,n.error),!1)}function pL(e,t){return oL.value.some(n=>aL(n,{kind:e,slug:t}))}function Aut(e){return dL(async()=>{if(await uL(),!cL.value)return!1;if(pL(e.kind,e.slug))return!0;let t=oL.value;return fL([...t,e],t)})}function jut(e,t){return dL(async()=>{if(await uL(),!cL.value)return!1;if(!pL(e,t))return!0;let n=oL.value;return fL(n.filter(n=>!aL(n,{kind:e,slug:t})),n)})}function Mut(e,t,n){return dL(async()=>{if(await uL(),!cL.value)return!1;let r=oL.value,i=Tut(r,e,t,n);return i===r||fL(i,r)})}function Nut(e,t){return dL(async()=>{if(await uL(),!cL.value)return;let{next:n,drifted:r}=kut(oL.value,e,t);r&&await fL(n,oL.value)})}function mL(){return uL(),{shortcuts:m(()=>oL.value),loadError:m(()=>sL.value),load:uL,isPinned:pL,pin:Aut,unpin:jut,movePinned:Mut,reconcile:Nut}}o(),M(),we(),le();var Put=[`title`,`aria-label`,`aria-pressed`,`data-testid`],Fut={class:`material-icons text-lg`},Iut=K({__name:`PinToggle`,props:{kind:{},slug:{},title:{},icon:{},color:{}},setup(e){let t=e,{t:n}=We(),{isPinned:r,pin:i,unpin:a}=mL(),o=m(()=>r(t.kind,t.slug));function u(){o.value?a(t.kind,t.slug):i({kind:t.kind,slug:t.slug,title:t.title,icon:t.icon,...t.color===void 0?{}:{color:t.color}})}return(t,r)=>(B(),U(`button`,{type:`button`,class:c([`h-8 w-8 flex items-center justify-center rounded transition-colors`,o.value?`text-amber-500 hover:bg-amber-50`:`text-slate-400 hover:bg-slate-100 hover:text-slate-600`]),title:o.value?q(n)(`shortcuts.unpin`):q(n)(`shortcuts.pin`),"aria-label":o.value?q(n)(`shortcuts.unpin`):q(n)(`shortcuts.pin`),"aria-pressed":o.value,"data-testid":`pin-toggle-${e.kind}-${e.slug}`,onClick:s(u,[`stop`]),onKeydown:[r[0]||=l(s(()=>{},[`stop`]),[`enter`]),r[1]||=l(s(()=>{},[`stop`]),[`space`])]},[S(`span`,Fut,T(o.value?`star`:`star_border`),1)],42,Put))}});M(),$lt(SP.files.raw);var{openConfirm:Lut}=but(),hL=(e,t)=>e.replace(`:slug`,encodeURIComponent(t)),Rut=(e,t)=>hL(SP.collections.item,e).replace(`:itemId`,encodeURIComponent(t)),zut=(e,t,n)=>hL(SP.collections.itemAction,e).replace(`:itemId`,encodeURIComponent(t)).replace(`:actionId`,encodeURIComponent(n)),But=(e,t)=>hL(SP.collections.collectionAction,e).replace(`:actionId`,encodeURIComponent(t)),Vut=(e,t)=>hL(SP.collections.viewDelete,e).replace(`:viewId`,encodeURIComponent(t)),Hut=(e,t)=>hL(SP.collections.remoteViewMutate,e).replace(`:viewId`,encodeURIComponent(t)),Uut=(e,t)=>hL(SP.collections.remoteViewItems,e).replace(`:viewId`,encodeURIComponent(t)),Wut=null,Gut=null,Kut=null,gL=new Map,_L=new Map;function qut(e,t,n){return QN().subscribe(ret(e,t),()=>n())}function Jut(e){let{slug:t,appId:n}=e;if(gL.get(t)!==n){n===void 0?gL.delete(t):gL.set(t,n);for(let e of _L.get(t)??[])e.unsubscribeApp?.(),e.unsubscribeApp=n===void 0?null:qut(t,n,e.onChange)}}function Yut(e,t){let n=QN().subscribe(ret(e),()=>t()),r=gL.get(e),i={onChange:t,unsubscribeApp:r===void 0?null:qut(e,r,t)},a=_L.get(e)??new Set;return a.add(i),_L.set(e,a),()=>{n(),i.unsubscribeApp?.(),i.unsubscribeApp=null,a.delete(i),a.size===0&&_L.delete(e)}}function Xut(e){Wut=e.startChat,Gut=e.startNewChatDraft,Kut=e.notifiedSeverities}UXe({fetchCollectionDetail:e=>pN(hL(SP.collections.detail,e)).then(e=>(e.ok&&Jut(e.data.collection),e)),fileAssetUrl:e=>$I(e)?ZI(e)??QI(e):null,fileRoutePath:e=>$I(e)?`/files/${e.split(`/`).map(encodeURIComponent).join(`/`)}`:null,imageSrc:e=>tL(e),confirm:e=>Lut(e),deleteView:(e,t)=>gN(Vut(e,t)),mintViewToken:(e,t)=>mN(hL(SP.collections.viewToken,e),{viewId:t}),fetchViewHtml:async(e,t)=>{try{await JI();let n=await _N(hL(SP.collections.viewFile,e),{query:{id:t}});return n.ok?{ok:!0,html:await n.text()}:{ok:!1,status:n.status}}catch{return{ok:!1,status:0}}},fetchViewI18n:(e,t,n)=>pN(hL(SP.collections.viewI18n,e),{id:t,locale:n}),fetchRemoteView:(e,t,n)=>pN(hL(SP.collections.remoteView,e),{id:t,locale:n}),mutateRemoteView:(e,t,n)=>mN(Hut(e,t),n),fetchRemoteViewItems:(e,t,n)=>pN(Uut(e,t),{offset:n.offset,limit:n.limit,fields:n.fields?.join(`,`)||void 0}),buildViewSrcdoc:(e,t)=>{let n=crypto.randomUUID();return fut(n),out(e,t,Flt.value,n)},createItem:(e,t)=>mN(hL(SP.collections.items,e),t),updateItem:(e,t,n)=>hN(Rut(e,t),n),deleteItem:(e,t)=>gN(Rut(e,t)),deleteCollection:e=>gN(hL(SP.collections.detail,e)),deleteFeed:e=>gN(hL(SP.feeds.detail,e)),runItemAction:(e,t,n,r)=>mN(zut(e,t,n),r?{params:r}:{}),runCollectionAction:(e,t)=>mN(But(e,t),{}),refreshCollection:e=>mN(hL(SP.collections.refresh,e),{}),pushCalendarCollection:e=>mN(hL(SP.collections.calendarPush,e),{}),routeSlug:()=>typeof HI.currentRoute.value.params.slug==`string`?HI.currentRoute.value.params.slug:void 0,routeSelectedId:()=>typeof HI.currentRoute.value.query.selected==`string`?HI.currentRoute.value.query.selected:void 0,isFeedRoute:()=>HI.currentRoute.value.name===CP.feeds,setSelectedId:e=>{let t={...HI.currentRoute.value.query};e===null?delete t.selected:t.selected=e,HI.replace({query:t}).catch(()=>{})},gotoIndex:e=>{HI.push({name:e===`feed`?CP.feeds:CP.collections,params:{}}).catch(()=>{})},gotoDetail:(e,t)=>{HI.push({name:e===`feed`?CP.feeds:CP.collections,params:{slug:t}}).catch(()=>{})},navigateToRecord:(e,t)=>{HI.push({name:CP.collections,params:{slug:e},query:t===void 0?{}:{selected:t}}).catch(()=>{})},recordHref:(e,t)=>{let n=`/collections/${encodeURIComponent(e)}`;return t===void 0?n:`${n}?selected=${encodeURIComponent(t)}`},navigate:e=>{HI.push(e).catch(()=>{})},listCollections:()=>pN(SP.collections.list).then(e=>(e.ok&&e.data.collections.forEach(Jut),e)),listFeeds:()=>pN(SP.feeds.list),fetchOntology:()=>pN(SP.collections.ontology),listRegistry:()=>pN(SP.collectionsRegistry.list),importRegistry:(e,t,n)=>mN(SP.collectionsRegistry.import,{author:e,slug:t,registry:n}),reconcileShortcuts:(e,t)=>mL().reconcile(e,t),localeTag:()=>q(GI.global.locale),startChat:(e,t)=>Wut?.(e,t),startNewChatDraft:(e,t)=>Gut?.(e,t),generalRoleId:gI.general,personalRoleId:gI.personal,unpin:(e,t)=>mL().unpin(e,t),notifiedSeverities:e=>Kut?.(e)??new Map,subscribeChanges:(e,t)=>Yut(e,t),pinToggle:Iut,translate:e=>mN(SP.translation.translate,e).then(e=>e.ok?e.data:null)}),o(),we(),M(),le();var vL=null;function Zut(e){vL=e}function yL(){if(!vL)throw Error(`@mulmoclaude/accounting-plugin: configureAccountingHost() must be called before the accounting View mounts`);return vL}function Qut(e,t){return yL().apiCall(e,t)}function $ut(e,t){return yL().subscribe(e,t)}function edt(){return yL().localeTag()}function bL(){return vL?.projectScope?.()??null}var xL=si({en:{pluginAccounting:{title:`Accounting`,noBook:`No books yet — click "+ New book" above to create your first one.`,common:{cancel:`Cancel`,loading:`Loading…`,error:`Error: {error}`,empty:`No entries yet.`},tabs:{journal:`Journal`,newEntry:`New entry`,opening:`Opening`,accounts:`Accounts`,ledger:`Ledger`,balanceSheet:`Balance sheet`,profitLoss:`P&L`,settings:`Settings`},bookSwitcher:{label:`Book`,newBook:`New book…`,create:`Create`,nameLabel:`Name`,currencyLabel:`Currency`,countryLabel:`Country`,countryPlaceholder:`Select a country…`,countryHint:`The country sets the tax jurisdiction so the assistant can give country-specific advice (T-number for Japan, VAT ID for the EU, etc.).`,fiscalYearEndLabel:`Fiscal year end`,fiscalYearEndHint:`Determines the fiscal year boundary used by the date-range shortcuts in this book. Pick the month whose last day the fiscal year ends on. Default is December (calendar year).`,placeholder:`Pick a book…`,firstRunHint:`Pick a name, currency, country, and fiscal year end for your first book. The currency is set per-book and is hard to change once you start booking entries.`},deletedNotice:{title:`"{bookName}" has been deleted.`,body:`Pick another book from the dropdown above, or create a new one.`},journalList:{fromLabel:`From`,toLabel:`To`,accountLabel:`Account`,allAccounts:`All accounts`,void:`Void`,edit:`Edit`,voidConfirm:`Void this entry? The original stays in the journal; a reversing pair is appended.`,voidReason:`Reason (optional):`,columns:{date:`Date`,kind:`Kind`,memo:`Memo`,lines:`Lines`},kind:{normal:`—`,opening:`Opening`,void:`Reverse`,voidMarker:`Void marker`}},entryForm:{title:`New journal entry`,editTitle:`Edit journal entry`,editBanner:`When you submit, the original entry will be voided and replaced by this one.`,dateLabel:`Date`,memoLabel:`Memo`,accountLabel:`Account`,debitLabel:`Debit`,creditLabel:`Credit`,taxRegistrationIdLabel:`Tax registration ID`,taxRegistrationIdPlaceholder:`T-number / VAT ID / GSTIN…`,taxRegistrationIdMissingWarning:`Required`,addLine:`Add line`,removeLine:`Remove`,submit:`Post entry`,submitting:`Posting…`,update:`Update entry`,updating:`Updating…`,cancelEdit:`Cancel`,success:`Entry posted.`,editSuccess:`Entry updated.`,editVoidReason:`edited`,imbalance:`Imbalance: {amount}`,balanced:`Balanced ✓`},openingForm:{title:`Opening balances`,asOfLabel:`As of`,explainer:`Enter your balance-sheet positions as of the start date. Income / expense accounts are not allowed here. Σ debit must equal Σ credit; the difference plug-in is Retained Earnings.`,emptyHint:`It's fine to save with everything blank — you can update opening balances later. The book just needs an opening on file before other tabs unlock.`,explainer2:`Balance-sheet accounts only.`,submit:`Save opening balances`,replaceWarning:`Saving replaces the existing opening (the old one is voided in the journal).`,none:`No opening balance set yet.`,setBy:`Set as of {date}`,success:`Opening balances saved.`},ledger:{selectAccount:`Select account`,closingBalance:`Closing balance`,columns:{date:`Date`,memo:`Memo`,debit:`Debit`,credit:`Credit`,balance:`Balance`,taxRegistrationId:`Tax registration ID`}},dateRange:{shortcutLabel:`Range`,currentQuarter:`Current quarter`,previousQuarter:`Last quarter`,currentYear:`Current year`,previousYear:`Last year`,lifetime:`Lifetime`,all:`All`,fromLabel:`From`,toLabel:`To`},balanceSheet:{asOfLabel:`Period`,sections:{asset:`Assets`,liability:`Liabilities`,equity:`Equity`},total:`Total`,imbalance:`Imbalance: {amount}`,currentEarnings:`Current period earnings`,shortcutLabel:`Shortcut`,thisMonth:`This month`,lastMonth:`Last month`,lastQuarter:`Last quarter`,lastYear:`Last year`},profitLoss:{fromLabel:`From`,toLabel:`To`,income:`Income`,expense:`Expense`,netIncome:`Net income:`},accounts:{listEmpty:`No accounts in this category yet.`,openLedgerAria:`Open ledger for {code} {name}`,manageButton:`Manage accounts`,modalTitle:`Manage accounts`,addAccount:`Add account`,sectionTitle:{asset:`Assets`,liability:`Liabilities`,equity:`Equity`,income:`Income`,expense:`Expenses`},columnCode:`Code`,columnName:`Name`,columnType:`Type`,columnNote:`Note`,typeOption:{asset:`Asset`,liability:`Liability`,equity:`Equity`,income:`Income`,expense:`Expense`},edit:`Edit`,save:`Save`,cancel:`Cancel`,saving:`Saving…`,addToCategory:`Add {type} account`,deactivate:`Deactivate`,reactivate:`Activate`,deactivateConfirm:`Hide "{name}" from entry/ledger dropdowns? Existing journal entries are unaffected.`,errorEmptyCode:`Code is required.`,errorReservedCode:`Codes starting with “_” are reserved for system rows.`,errorInvalidCodeFormat:`Account code must be exactly 4 digits.`,errorCodeTypeMismatch:`Code must match the account type: 1xxx asset, 2xxx liability, 3xxx equity, 4xxx income, 5xxx expense.`,errorEmptyName:`Name is required.`,errorDuplicateCode:`An account with this code already exists.`,errorDuplicateName:`An account with this name already exists.`,success:`Account saved.`,codeReadOnlyHint:`Code can't be changed once an account is created.`,noteOptional:`(optional)`},settings:{bookInfo:`Book information`,bookInfoExplain:`Edit the country to update tax-jurisdiction-specific advice. Currency cannot be changed once entries are booked.`,countryUnset:`(not set)`,fiscalYearEndExplain:`Changes only how date-range shortcuts resolve from now on; existing journal entries are not moved.`,saveChanges:`Save changes`,updateOk:`Book updated.`,rebuild:`Rebuild snapshots`,rebuildExplain:`Drops every cached monthly snapshot and recomputes them from the journal. Safe to run; useful after editing journal files by hand.`,rebuildOk:`Rebuilt {count} period(s).`,advanced:`Advanced…`,deleteBook:`Delete book`,deleteBookExplain:`Permanently deletes this book's directory. Cannot be undone.`,deleteBookConfirm:`Type "{bookName}" to confirm:`,deleteBookButton:`Delete forever`},preview:{entry:`Posted entry on {date}`,pl:`P&L {from} → {to}: net {net}`,bs:`Balance sheet as of {date} · assets {assets}`,bookCreated:`Created book "{name}" ({id})`,accountSaved:`Saved account {code} "{name}"`,entryVoided:`Voided entry; reversal posted on {date}`,openingSet:`Set opening balances as of {date}`,openingReplaced:`Replaced opening balances as of {date}`},previewSummary:`Accounting · {bookId}`,previewError:`Accounting: {error}`,previewGeneric:`Accounting result`}},ja:{pluginAccounting:{title:`会計`,noBook:`まだ帳簿がありません — 上の "+ 新しい帳簿" から作成してください。`,common:{cancel:`キャンセル`,loading:`読み込み中…`,error:`エラー: {error}`,empty:`まだエントリがありません。`},tabs:{journal:`仕訳`,newEntry:`新規仕訳`,opening:`期首残高`,accounts:`勘定科目`,ledger:`元帳`,balanceSheet:`貸借対照表`,profitLoss:`損益`,settings:`設定`},bookSwitcher:{label:`帳簿`,newBook:`新しい帳簿…`,create:`作成`,nameLabel:`名前`,currencyLabel:`通貨`,countryLabel:`国`,countryPlaceholder:`国を選択…`,countryHint:`国を設定すると税の管轄が決まり、アシスタントが国別のアドバイス(日本のT番号、EUのVAT IDなど)を提供できます。`,fiscalYearEndLabel:`会計年度末日`,fiscalYearEndHint:`この帳簿の日付範囲ショートカットで使う会計年度の境界を決めます。会計年度が終わる月(その月末日)を選びます。デフォルトは12月(暦年)。`,placeholder:`帳簿を選択…`,firstRunHint:`最初の帳簿の名前・通貨・国・会計年度末日を選んでください。通貨は帳簿ごとに固定で、仕訳を入力した後の変更は難しくなります。`},deletedNotice:{title:`「{bookName}」を削除しました。`,body:`上のドロップダウンから別の帳簿を選ぶか、新しい帳簿を作成してください。`},journalList:{fromLabel:`開始日`,toLabel:`終了日`,accountLabel:`勘定科目`,allAccounts:`すべての科目`,void:`取消`,edit:`編集`,voidConfirm:`この仕訳を取り消しますか?元の仕訳は journal に残り、逆仕訳が追記されます。`,voidReason:`理由(任意):`,columns:{date:`日付`,kind:`種別`,memo:`メモ`,lines:`行`},kind:{normal:`—`,opening:`期首`,void:`逆仕訳`,voidMarker:`取消マーカー`}},entryForm:{title:`新規仕訳`,editTitle:`仕訳の編集`,editBanner:`送信すると、元の仕訳は取り消され、この内容で置き換えられます。`,dateLabel:`日付`,memoLabel:`メモ`,accountLabel:`勘定科目`,debitLabel:`借方`,creditLabel:`貸方`,taxRegistrationIdLabel:`登録番号`,taxRegistrationIdPlaceholder:`T1234567890123`,taxRegistrationIdMissingWarning:`必須`,addLine:`行を追加`,removeLine:`削除`,submit:`起票`,submitting:`起票中…`,update:`更新`,updating:`更新中…`,cancelEdit:`キャンセル`,success:`起票しました。`,editSuccess:`仕訳を更新しました。`,editVoidReason:`編集`,imbalance:`差額: {amount}`,balanced:`バランス OK ✓`},openingForm:{title:`期首残高`,asOfLabel:`基準日`,explainer:`B/S 科目(資産・負債・純資産)のみ入力可能。Σ借方=Σ貸方を満たす必要があり、差額は Retained Earnings に集約されます。`,emptyHint:`すべて空欄のまま保存しても構いません — 期首残高は後から更新できます。他のタブを利用するには、いったん期首残高が登録されている必要があります。`,explainer2:`B/S 科目のみ。`,submit:`期首残高を保存`,replaceWarning:`保存すると既存の期首残高は journal で取り消されます。`,none:`期首残高は未設定です。`,setBy:`{date} 時点で設定済み`,success:`期首残高を保存しました。`},ledger:{selectAccount:`科目を選択`,closingBalance:`期末残高`,columns:{date:`日付`,memo:`メモ`,debit:`借方`,credit:`貸方`,balance:`残高`,taxRegistrationId:`登録番号`}},dateRange:{shortcutLabel:`範囲`,currentQuarter:`今四半期`,previousQuarter:`前四半期`,currentYear:`今年度`,previousYear:`前年度`,lifetime:`開設以来`,all:`すべて`,fromLabel:`開始日`,toLabel:`終了日`},balanceSheet:{asOfLabel:`対象月`,sections:{asset:`資産`,liability:`負債`,equity:`純資産`},total:`合計`,imbalance:`差額: {amount}`,currentEarnings:`当期純損益`,shortcutLabel:`ショートカット`,thisMonth:`今月`,lastMonth:`先月`,lastQuarter:`前四半期`,lastYear:`前年`},profitLoss:{fromLabel:`開始日`,toLabel:`終了日`,income:`収益`,expense:`費用`,netIncome:`当期純利益:`},accounts:{listEmpty:`このカテゴリにはまだ勘定科目がありません。`,openLedgerAria:`{code} {name} の元帳を開く`,manageButton:`勘定科目を管理`,modalTitle:`勘定科目の管理`,addAccount:`勘定科目を追加`,sectionTitle:{asset:`資産`,liability:`負債`,equity:`純資産`,income:`収益`,expense:`費用`},columnCode:`コード`,columnName:`名称`,columnType:`区分`,columnNote:`メモ`,typeOption:{asset:`資産`,liability:`負債`,equity:`純資産`,income:`収益`,expense:`費用`},edit:`編集`,save:`保存`,cancel:`キャンセル`,saving:`保存中…`,addToCategory:`{type}を追加`,deactivate:`無効化`,reactivate:`有効化`,deactivateConfirm:`「{name}」を仕訳・元帳の選択肢から非表示にしますか?既存の仕訳には影響しません。`,errorEmptyCode:`コードは必須です。`,errorReservedCode:`「_」で始まるコードはシステム用に予約されています。`,errorInvalidCodeFormat:`勘定科目コードは4桁の数字で入力してください。`,errorCodeTypeMismatch:`コードの先頭桁は勘定科目タイプと一致させてください: 1xxx 資産, 2xxx 負債, 3xxx 純資産, 4xxx 収益, 5xxx 費用。`,errorEmptyName:`名称は必須です。`,errorDuplicateCode:`このコードの勘定科目は既に存在します。`,errorDuplicateName:`この名称の勘定科目は既に存在します。`,success:`勘定科目を保存しました。`,codeReadOnlyHint:`コードは作成後に変更できません。`,noteOptional:`(任意)`},settings:{bookInfo:`帳簿情報`,bookInfoExplain:`国を編集すると税の管轄に応じたアドバイスが更新されます。通貨は仕訳を入力した後は変更できません。`,countryUnset:`(未設定)`,fiscalYearEndExplain:`今後の日付範囲ショートカットの解決方法のみが変わります。既存の仕訳は移動しません。`,saveChanges:`変更を保存`,updateOk:`帳簿を更新しました。`,rebuild:`スナップショット再構築`,rebuildExplain:`月次スナップショットキャッシュをすべて削除し、journal から再計算します。journal を手で編集した後のリカバリに使えます。`,rebuildOk:`{count} 期間を再構築しました。`,advanced:`詳細設定…`,deleteBook:`帳簿を削除`,deleteBookExplain:`この帳簿のディレクトリを完全に削除します。元に戻せません。`,deleteBookConfirm:`確認のため "{bookName}" を入力してください:`,deleteBookButton:`完全に削除`},preview:{entry:`{date} の仕訳を起票`,pl:`P&L {from} → {to}: 純損益 {net}`,bs:`{date} 時点の B/S · 資産 {assets}`,bookCreated:`帳簿 "{name}" ({id}) を作成`,accountSaved:`勘定科目 {code} "{name}" を保存`,entryVoided:`仕訳を取り消し、{date} に反対仕訳を計上`,openingSet:`{date} 時点の期首残高を設定`,openingReplaced:`{date} 時点の期首残高を置き換え`},previewSummary:`会計 · {bookId}`,previewError:`会計: {error}`,previewGeneric:`会計の結果`}},zh:{pluginAccounting:{title:`会计`,noBook:`尚无账簿 — 点击上方 "+ 新建账簿" 创建第一个。`,common:{cancel:`取消`,loading:`加载中…`,error:`错误: {error}`,empty:`尚无条目。`},tabs:{journal:`日记账`,newEntry:`新建分录`,opening:`期初余额`,accounts:`科目`,ledger:`明细账`,balanceSheet:`资产负债表`,profitLoss:`损益`,settings:`设置`},bookSwitcher:{label:`账簿`,newBook:`新建账簿…`,create:`创建`,nameLabel:`名称`,currencyLabel:`货币`,countryLabel:`国家/地区`,countryPlaceholder:`选择国家/地区…`,countryHint:`国家/地区决定税务管辖,助手可据此提供本地化建议(日本T号、欧盟VAT ID等)。`,fiscalYearEndLabel:`财年结束日`,fiscalYearEndHint:`决定本账簿日期范围快捷方式所使用的财年边界。请选择财年结束的月份(该月最后一天)。默认 12月(自然年)。`,placeholder:`选择账簿…`,firstRunHint:`请为第一本账簿选择名称、货币、国家/地区与财年结束日。货币按账簿固定,登账后再更改会比较困难。`},deletedNotice:{title:`“{bookName}” 已删除。`,body:`请从上方下拉菜单选择其他账簿,或新建一本。`},journalList:{fromLabel:`起始`,toLabel:`结束`,accountLabel:`科目`,allAccounts:`所有科目`,void:`冲销`,edit:`编辑`,voidConfirm:`冲销此分录?原始分录保留在日记账中,会追加一对反向分录。`,voidReason:`原因(可选):`,columns:{date:`日期`,kind:`类型`,memo:`备注`,lines:`明细`},kind:{normal:`—`,opening:`期初`,void:`反向`,voidMarker:`冲销标记`}},entryForm:{title:`新建分录`,editTitle:`编辑分录`,editBanner:`提交后,原分录将被冲销并以此内容替换。`,dateLabel:`日期`,memoLabel:`备注`,accountLabel:`科目`,debitLabel:`借方`,creditLabel:`贷方`,taxRegistrationIdLabel:`税务登记号`,taxRegistrationIdPlaceholder:`T-number / VAT ID / GSTIN…`,taxRegistrationIdMissingWarning:`必填`,addLine:`添加行`,removeLine:`删除`,submit:`登账`,submitting:`登账中…`,update:`更新`,updating:`更新中…`,cancelEdit:`取消`,success:`已登账。`,editSuccess:`分录已更新。`,editVoidReason:`已编辑`,imbalance:`差额: {amount}`,balanced:`已平衡 ✓`},openingForm:{title:`期初余额`,asOfLabel:`基准日`,explainer:`仅允许 B/S 科目(资产 / 负债 / 权益)。Σ借方=Σ贷方,差额会落入 Retained Earnings。`,emptyHint:`可以全部留空保存——期初余额稍后再更新。账簿只需先存在一条期初记录,其他标签页才会解锁。`,explainer2:`仅 B/S 科目。`,submit:`保存期初余额`,replaceWarning:`保存会替换现有期初余额(旧的会在日记账中冲销)。`,none:`尚未设置期初余额。`,setBy:`{date} 已设置`,success:`期初余额已保存。`},ledger:{selectAccount:`选择科目`,closingBalance:`期末余额`,columns:{date:`日期`,memo:`备注`,debit:`借方`,credit:`贷方`,balance:`余额`,taxRegistrationId:`税务登记号`}},dateRange:{shortcutLabel:`范围`,currentQuarter:`本季度`,previousQuarter:`上季度`,currentYear:`本年度`,previousYear:`上年度`,lifetime:`自开账以来`,all:`全部`,fromLabel:`起始`,toLabel:`结束`},balanceSheet:{asOfLabel:`期间`,sections:{asset:`资产`,liability:`负债`,equity:`权益`},total:`合计`,imbalance:`差额: {amount}`,currentEarnings:`当期净损益`,shortcutLabel:`快捷方式`,thisMonth:`本月`,lastMonth:`上月`,lastQuarter:`上季度`,lastYear:`上年`},profitLoss:{fromLabel:`起始`,toLabel:`结束`,income:`收入`,expense:`支出`,netIncome:`净利润:`},accounts:{listEmpty:`此分类下暂无科目。`,openLedgerAria:`打开 {code} {name} 的明细账`,manageButton:`管理科目`,modalTitle:`管理科目`,addAccount:`添加科目`,sectionTitle:{asset:`资产`,liability:`负债`,equity:`权益`,income:`收入`,expense:`费用`},columnCode:`代码`,columnName:`名称`,columnType:`类型`,columnNote:`备注`,typeOption:{asset:`资产`,liability:`负债`,equity:`权益`,income:`收入`,expense:`费用`},edit:`编辑`,save:`保存`,cancel:`取消`,saving:`保存中…`,addToCategory:`添加{type}`,deactivate:`停用`,reactivate:`启用`,deactivateConfirm:`在分录/明细账下拉框中隐藏“{name}”?现有日记账分录不受影响。`,errorEmptyCode:`代码不能为空。`,errorReservedCode:`以 “_” 开头的代码保留给系统行使用。`,errorInvalidCodeFormat:`科目代码必须为 4 位数字。`,errorCodeTypeMismatch:`代码首位必须与科目类型匹配:1xxx 资产,2xxx 负债,3xxx 权益,4xxx 收入,5xxx 费用。`,errorEmptyName:`名称不能为空。`,errorDuplicateCode:`此代码的科目已存在。`,errorDuplicateName:`此名称的科目已存在。`,success:`科目已保存。`,codeReadOnlyHint:`科目创建后代码不能更改。`,noteOptional:`(可选)`},settings:{bookInfo:`账簿信息`,bookInfoExplain:`修改国家/地区可更新税务管辖相关建议。开始登账后货币不可更改。`,countryUnset:`(未设置)`,fiscalYearEndExplain:`仅影响今后日期范围快捷方式的解析方式;现有日记账分录不会移动。`,saveChanges:`保存更改`,updateOk:`账簿已更新。`,rebuild:`重建快照`,rebuildExplain:`删除全部月度快照缓存并从日记账重新计算。手动编辑日记账后可用。`,rebuildOk:`已重建 {count} 期。`,advanced:`高级设置…`,deleteBook:`删除账簿`,deleteBookExplain:`永久删除该账簿目录。无法撤销。`,deleteBookConfirm:`请输入 "{bookName}" 以确认:`,deleteBookButton:`彻底删除`},preview:{entry:`已记账 {date} 的分录`,pl:`P&L {from} → {to}: 净额 {net}`,bs:`{date} 资产负债表 · 资产 {assets}`,bookCreated:`已创建账簿 "{name}" ({id})`,accountSaved:`已保存科目 {code} "{name}"`,entryVoided:`已作废分录,并于 {date} 过账冲销分录`,openingSet:`已设置截至 {date} 的期初余额`,openingReplaced:`已替换截至 {date} 的期初余额`},previewSummary:`会计 · {bookId}`,previewError:`会计: {error}`,previewGeneric:`会计结果`}},ko:{pluginAccounting:{title:`회계`,noBook:`장부가 없습니다 — 위의 "+ 새 장부"를 눌러 첫 장부를 만드세요.`,common:{cancel:`취소`,loading:`불러오는 중…`,error:`오류: {error}`,empty:`아직 항목이 없습니다.`},tabs:{journal:`분개장`,newEntry:`새 분개`,opening:`기초잔액`,accounts:`계정`,ledger:`원장`,balanceSheet:`재무상태표`,profitLoss:`손익`,settings:`설정`},bookSwitcher:{label:`장부`,newBook:`새 장부…`,create:`생성`,nameLabel:`이름`,currencyLabel:`통화`,countryLabel:`국가`,countryPlaceholder:`국가 선택…`,countryHint:`국가를 설정하면 세무 관할이 결정되어 어시스턴트가 국가별 안내(일본 T-번호, EU VAT ID 등)를 제공할 수 있습니다.`,fiscalYearEndLabel:`회계연도 종료일`,fiscalYearEndHint:`이 장부의 날짜 범위 단축 메뉴에 사용되는 회계연도 경계를 결정합니다. 회계연도가 끝나는 월(그 달의 마지막 날)을 선택하세요. 기본값은 12월(달력 연도)입니다.`,placeholder:`장부 선택…`,firstRunHint:`첫 장부의 이름, 통화, 국가, 회계연도 종료일을 선택하세요. 통화는 장부별로 설정되며 분개를 시작한 뒤에는 변경이 어렵습니다.`},deletedNotice:{title:`“{bookName}” 장부가 삭제되었습니다.`,body:`위 드롭다운에서 다른 장부를 선택하거나 새 장부를 만드세요.`},journalList:{fromLabel:`시작`,toLabel:`종료`,accountLabel:`계정`,allAccounts:`모든 계정`,void:`취소`,edit:`편집`,voidConfirm:`이 분개를 취소하시겠습니까? 원 분개는 분개장에 남고 반대 분개가 추가됩니다.`,voidReason:`사유(선택):`,columns:{date:`날짜`,kind:`종류`,memo:`메모`,lines:`라인`},kind:{normal:`—`,opening:`기초`,void:`반대`,voidMarker:`취소 마커`}},entryForm:{title:`새 분개`,editTitle:`분개 편집`,editBanner:`제출하면 원본 분개가 무효 처리되고 이 내용으로 대체됩니다.`,dateLabel:`날짜`,memoLabel:`메모`,accountLabel:`계정`,debitLabel:`차변`,creditLabel:`대변`,taxRegistrationIdLabel:`세무 등록번호`,taxRegistrationIdPlaceholder:`T-number / VAT ID / GSTIN…`,taxRegistrationIdMissingWarning:`필수`,addLine:`라인 추가`,removeLine:`삭제`,submit:`등록`,submitting:`등록 중…`,update:`업데이트`,updating:`업데이트 중…`,cancelEdit:`취소`,success:`분개를 등록했습니다.`,editSuccess:`분개가 업데이트되었습니다.`,editVoidReason:`편집됨`,imbalance:`차액: {amount}`,balanced:`균형 ✓`},openingForm:{title:`기초잔액`,asOfLabel:`기준일`,explainer:`재무상태표 계정(자산/부채/자본)만 입력 가능. Σ차변=Σ대변이 되어야 하며 차액은 Retained Earnings에 흡수됩니다.`,emptyHint:`모두 비워둔 채 저장해도 괜찮습니다 — 기초잔액은 나중에 업데이트할 수 있습니다. 다른 탭을 사용하려면 일단 기초잔액 항목이 등록되어 있어야 합니다.`,explainer2:`재무상태표 계정만.`,submit:`기초잔액 저장`,replaceWarning:`저장 시 기존 기초잔액은 분개장에서 취소됩니다.`,none:`기초잔액이 설정되지 않았습니다.`,setBy:`{date} 기준 설정됨`,success:`기초잔액을 저장했습니다.`},ledger:{selectAccount:`계정 선택`,closingBalance:`기말 잔액`,columns:{date:`날짜`,memo:`메모`,debit:`차변`,credit:`대변`,balance:`잔액`,taxRegistrationId:`세무 등록번호`}},dateRange:{shortcutLabel:`범위`,currentQuarter:`이번 분기`,previousQuarter:`지난 분기`,currentYear:`이번 연도`,previousYear:`지난 연도`,lifetime:`개설 이후`,all:`전체`,fromLabel:`시작`,toLabel:`종료`},balanceSheet:{asOfLabel:`기간`,sections:{asset:`자산`,liability:`부채`,equity:`자본`},total:`합계`,imbalance:`차액: {amount}`,currentEarnings:`당기 순손익`,shortcutLabel:`바로가기`,thisMonth:`이번 달`,lastMonth:`지난달`,lastQuarter:`지난 분기`,lastYear:`지난 연도`},profitLoss:{fromLabel:`시작`,toLabel:`종료`,income:`수익`,expense:`비용`,netIncome:`당기순이익:`},accounts:{listEmpty:`이 카테고리에는 아직 계정이 없습니다.`,openLedgerAria:`{code} {name} 원장 열기`,manageButton:`계정 관리`,modalTitle:`계정 관리`,addAccount:`계정 추가`,sectionTitle:{asset:`자산`,liability:`부채`,equity:`자본`,income:`수익`,expense:`비용`},columnCode:`코드`,columnName:`이름`,columnType:`유형`,columnNote:`메모`,typeOption:{asset:`자산`,liability:`부채`,equity:`자본`,income:`수익`,expense:`비용`},edit:`편집`,save:`저장`,cancel:`취소`,saving:`저장 중…`,addToCategory:`{type} 추가`,deactivate:`비활성화`,reactivate:`활성화`,deactivateConfirm:`‘{name}’을(를) 분개/원장 드롭다운에서 숨기시겠습니까? 기존 분개 항목에는 영향이 없습니다.`,errorEmptyCode:`코드는 필수입니다.`,errorReservedCode:`“_”로 시작하는 코드는 시스템 행에 예약되어 있습니다.`,errorInvalidCodeFormat:`계정 코드는 정확히 4자리 숫자여야 합니다.`,errorCodeTypeMismatch:`코드의 첫 자리는 계정 유형과 일치해야 합니다: 1xxx 자산, 2xxx 부채, 3xxx 자본, 4xxx 수익, 5xxx 비용.`,errorEmptyName:`이름은 필수입니다.`,errorDuplicateCode:`이 코드의 계정이 이미 존재합니다.`,errorDuplicateName:`이 이름의 계정이 이미 존재합니다.`,success:`계정을 저장했습니다.`,codeReadOnlyHint:`계정을 만든 후에는 코드를 변경할 수 없습니다.`,noteOptional:`(선택)`},settings:{bookInfo:`장부 정보`,bookInfoExplain:`국가를 변경하면 세무 관할 기반 안내가 갱신됩니다. 분개를 시작한 뒤에는 통화를 변경할 수 없습니다.`,countryUnset:`(미설정)`,fiscalYearEndExplain:`이후 날짜 범위 단축 메뉴의 해석 방식만 변경됩니다. 기존 분개 항목은 이동되지 않습니다.`,saveChanges:`변경 저장`,updateOk:`장부를 업데이트했습니다.`,rebuild:`스냅샷 재구축`,rebuildExplain:`모든 월별 스냅샷 캐시를 지우고 분개장에서 재계산합니다. 분개 파일을 직접 편집한 뒤 복구할 때 유용합니다.`,rebuildOk:`{count}개 기간을 재구축했습니다.`,advanced:`고급…`,deleteBook:`장부 삭제`,deleteBookExplain:`이 장부의 디렉터리를 영구히 삭제합니다. 되돌릴 수 없습니다.`,deleteBookConfirm:`확인을 위해 "{bookName}"을 입력하세요:`,deleteBookButton:`영구 삭제`},preview:{entry:`{date} 분개를 등록`,pl:`P&L {from} → {to}: 순이익 {net}`,bs:`{date} 재무상태표 · 자산 {assets}`,bookCreated:`장부 "{name}" ({id})를 생성했습니다`,accountSaved:`계정 {code} "{name}"을(를) 저장했습니다`,entryVoided:`분개를 취소하고 {date}에 역분개를 기록했습니다`,openingSet:`{date} 기준 기초 잔액을 설정했습니다`,openingReplaced:`{date} 기준 기초 잔액을 교체했습니다`},previewSummary:`회계 · {bookId}`,previewError:`회계: {error}`,previewGeneric:`회계 결과`}},es:{pluginAccounting:{title:`Contabilidad`,noBook:`Aún no hay libros — pulsa "+ Nuevo libro" arriba para crear el primero.`,common:{cancel:`Cancelar`,loading:`Cargando…`,error:`Error: {error}`,empty:`Aún no hay entradas.`},tabs:{journal:`Diario`,newEntry:`Nueva entrada`,opening:`Apertura`,accounts:`Cuentas`,ledger:`Mayor`,balanceSheet:`Balance`,profitLoss:`P&L`,settings:`Ajustes`},bookSwitcher:{label:`Libro`,newBook:`Nuevo libro…`,create:`Crear`,nameLabel:`Nombre`,currencyLabel:`Moneda`,countryLabel:`País`,countryPlaceholder:`Selecciona un país…`,countryHint:`El país define la jurisdicción fiscal para que el asistente pueda dar consejos específicos (T-number en Japón, ID de IVA en la UE, etc.).`,fiscalYearEndLabel:`Cierre del ejercicio`,fiscalYearEndHint:`Define el límite del ejercicio para los atajos de rango de fechas de este libro. Elige el mes en cuyo último día cierra el ejercicio. Por defecto: diciembre (año natural).`,placeholder:`Elige un libro…`,firstRunHint:`Elige el nombre, la moneda, el país y el cierre de ejercicio de tu primer libro. La moneda se fija por libro y es difícil cambiarla una vez que empieces a registrar asientos.`},deletedNotice:{title:`“{bookName}” se ha eliminado.`,body:`Elige otro libro en el desplegable de arriba o crea uno nuevo.`},journalList:{fromLabel:`Desde`,toLabel:`Hasta`,accountLabel:`Cuenta`,allAccounts:`Todas`,void:`Anular`,edit:`Editar`,voidConfirm:`¿Anular esta entrada? La original permanece en el diario; se añade un par de reversión.`,voidReason:`Motivo (opcional):`,columns:{date:`Fecha`,kind:`Tipo`,memo:`Memo`,lines:`Líneas`},kind:{normal:`—`,opening:`Apertura`,void:`Reverso`,voidMarker:`Marcador de anulación`}},entryForm:{title:`Nueva entrada`,editTitle:`Editar entrada`,editBanner:`Al enviar, la entrada original será anulada y sustituida por esta.`,dateLabel:`Fecha`,memoLabel:`Memo`,accountLabel:`Cuenta`,debitLabel:`Debe`,creditLabel:`Haber`,taxRegistrationIdLabel:`ID fiscal`,taxRegistrationIdPlaceholder:`NIF / VAT ID / RFC…`,taxRegistrationIdMissingWarning:`Obligatorio`,addLine:`Añadir línea`,removeLine:`Quitar`,submit:`Asentar`,submitting:`Asentando…`,update:`Actualizar`,updating:`Actualizando…`,cancelEdit:`Cancelar`,success:`Entrada asentada.`,editSuccess:`Entrada actualizada.`,editVoidReason:`editado`,imbalance:`Descuadre: {amount}`,balanced:`Cuadrada ✓`},openingForm:{title:`Saldos de apertura`,asOfLabel:`Al`,explainer:`Solo cuentas de balance (activo/pasivo/patrimonio). Σ debe = Σ haber; la diferencia va a Retained Earnings.`,emptyHint:`Puedes guardar todo en blanco — luego puedes actualizar los saldos de apertura. Solo hace falta tener una apertura registrada para desbloquear las demás pestañas.`,explainer2:`Solo cuentas de balance.`,submit:`Guardar saldos de apertura`,replaceWarning:`Al guardar se reemplaza la apertura existente (la anterior se anula en el diario).`,none:`Aún no hay saldos de apertura.`,setBy:`Establecido al {date}`,success:`Saldos guardados.`},ledger:{selectAccount:`Seleccionar cuenta`,closingBalance:`Saldo final`,columns:{date:`Fecha`,memo:`Memo`,debit:`Debe`,credit:`Haber`,balance:`Saldo`,taxRegistrationId:`ID fiscal`}},dateRange:{shortcutLabel:`Rango`,currentQuarter:`Trimestre actual`,previousQuarter:`Último trimestre`,currentYear:`Año en curso`,previousYear:`Año anterior`,lifetime:`Desde la apertura`,all:`Todo`,fromLabel:`Desde`,toLabel:`Hasta`},balanceSheet:{asOfLabel:`Período`,sections:{asset:`Activo`,liability:`Pasivo`,equity:`Patrimonio`},total:`Total`,imbalance:`Descuadre: {amount}`,currentEarnings:`Resultado del período`,shortcutLabel:`Atajo`,thisMonth:`Este mes`,lastMonth:`Mes anterior`,lastQuarter:`Último trimestre`,lastYear:`Año anterior`},profitLoss:{fromLabel:`Desde`,toLabel:`Hasta`,income:`Ingresos`,expense:`Gastos`,netIncome:`Resultado neto:`},accounts:{listEmpty:`No hay cuentas en esta categoría.`,openLedgerAria:`Abrir mayor de {code} {name}`,manageButton:`Gestionar cuentas`,modalTitle:`Gestionar cuentas`,addAccount:`Añadir cuenta`,sectionTitle:{asset:`Activos`,liability:`Pasivos`,equity:`Patrimonio`,income:`Ingresos`,expense:`Gastos`},columnCode:`Código`,columnName:`Nombre`,columnType:`Tipo`,columnNote:`Nota`,typeOption:{asset:`Activo`,liability:`Pasivo`,equity:`Patrimonio`,income:`Ingreso`,expense:`Gasto`},edit:`Editar`,save:`Guardar`,cancel:`Cancelar`,saving:`Guardando…`,addToCategory:`Añadir cuenta de {type}`,deactivate:`Desactivar`,reactivate:`Activar`,deactivateConfirm:`¿Ocultar “{name}” de los desplegables de asientos / mayor? Los asientos existentes no se ven afectados.`,errorEmptyCode:`El código es obligatorio.`,errorReservedCode:`Los códigos que empiezan por “_” están reservados para filas del sistema.`,errorInvalidCodeFormat:`El código de cuenta debe tener exactamente 4 dígitos.`,errorCodeTypeMismatch:`El código debe coincidir con el tipo de cuenta: 1xxx activo, 2xxx pasivo, 3xxx patrimonio, 4xxx ingreso, 5xxx gasto.`,errorEmptyName:`El nombre es obligatorio.`,errorDuplicateCode:`Ya existe una cuenta con este código.`,errorDuplicateName:`Ya existe una cuenta con este nombre.`,success:`Cuenta guardada.`,codeReadOnlyHint:`El código no puede cambiarse una vez creada la cuenta.`,noteOptional:`(opcional)`},settings:{bookInfo:`Información del libro`,bookInfoExplain:`Edita el país para actualizar los consejos según la jurisdicción fiscal. La moneda no puede cambiarse una vez registrados los asientos.`,countryUnset:`(sin definir)`,fiscalYearEndExplain:`Solo cambia cómo se resuelven los atajos de rango de fechas en adelante; los asientos existentes no se mueven.`,saveChanges:`Guardar cambios`,updateOk:`Libro actualizado.`,rebuild:`Reconstruir snapshots`,rebuildExplain:`Borra todos los snapshots mensuales y los recalcula desde el diario. Útil tras editar el diario a mano.`,rebuildOk:`Reconstruidos {count} período(s).`,advanced:`Avanzado…`,deleteBook:`Eliminar libro`,deleteBookExplain:`Elimina permanentemente el directorio del libro. No se puede deshacer.`,deleteBookConfirm:`Escribe "{bookName}" para confirmar:`,deleteBookButton:`Eliminar para siempre`},preview:{entry:`Entrada asentada el {date}`,pl:`P&L {from} → {to}: neto {net}`,bs:`Balance al {date} · activos {assets}`,bookCreated:`Libro "{name}" ({id}) creado`,accountSaved:`Cuenta {code} "{name}" guardada`,entryVoided:`Asiento anulado; reversión registrada el {date}`,openingSet:`Saldos iniciales establecidos al {date}`,openingReplaced:`Saldos iniciales reemplazados al {date}`},previewSummary:`Contabilidad · {bookId}`,previewError:`Contabilidad: {error}`,previewGeneric:`Resultado de contabilidad`}},"pt-BR":{pluginAccounting:{title:`Contabilidade`,noBook:`Ainda não há livros — clique em "+ Novo livro" acima para criar o primeiro.`,common:{cancel:`Cancelar`,loading:`Carregando…`,error:`Erro: {error}`,empty:`Ainda não há lançamentos.`},tabs:{journal:`Diário`,newEntry:`Novo lançamento`,opening:`Abertura`,accounts:`Contas`,ledger:`Razão`,balanceSheet:`Balanço`,profitLoss:`DRE`,settings:`Configurações`},bookSwitcher:{label:`Livro`,newBook:`Novo livro…`,create:`Criar`,nameLabel:`Nome`,currencyLabel:`Moeda`,countryLabel:`País`,countryPlaceholder:`Selecione um país…`,countryHint:`O país define a jurisdição fiscal para que o assistente possa dar conselhos específicos (T-number no Japão, ID de IVA na UE, etc.).`,fiscalYearEndLabel:`Encerramento do exercício`,fiscalYearEndHint:`Define o limite do exercício social usado pelos atalhos de período deste livro. Escolha o mês em cujo último dia o exercício encerra. Padrão: dezembro (ano civil).`,placeholder:`Selecione um livro…`,firstRunHint:`Escolha o nome, a moeda, o país e o encerramento do exercício do seu primeiro livro. A moeda é definida por livro e fica difícil alterar depois de começar a lançar.`},deletedNotice:{title:`“{bookName}” foi excluído.`,body:`Selecione outro livro no menu acima ou crie um novo.`},journalList:{fromLabel:`De`,toLabel:`Até`,accountLabel:`Conta`,allAccounts:`Todas as contas`,void:`Estornar`,edit:`Editar`,voidConfirm:`Estornar este lançamento? O original permanece no diário e um par de reversão é anexado.`,voidReason:`Motivo (opcional):`,columns:{date:`Data`,kind:`Tipo`,memo:`Memo`,lines:`Linhas`},kind:{normal:`—`,opening:`Abertura`,void:`Reverso`,voidMarker:`Marcador de estorno`}},entryForm:{title:`Novo lançamento`,editTitle:`Editar lançamento`,editBanner:`Ao enviar, o lançamento original será estornado e substituído por este.`,dateLabel:`Data`,memoLabel:`Memo`,accountLabel:`Conta`,debitLabel:`Débito`,creditLabel:`Crédito`,taxRegistrationIdLabel:`Inscrição fiscal`,taxRegistrationIdPlaceholder:`CNPJ / VAT ID / GSTIN…`,taxRegistrationIdMissingWarning:`Obrigatório`,addLine:`Adicionar linha`,removeLine:`Remover`,submit:`Lançar`,submitting:`Lançando…`,update:`Atualizar`,updating:`Atualizando…`,cancelEdit:`Cancelar`,success:`Lançamento registrado.`,editSuccess:`Lançamento atualizado.`,editVoidReason:`editado`,imbalance:`Diferença: {amount}`,balanced:`Equilibrado ✓`},openingForm:{title:`Saldos iniciais`,asOfLabel:`Em`,explainer:`Apenas contas de balanço (ativo/passivo/patrimônio). Σ débito = Σ crédito; a diferença entra em Retained Earnings.`,emptyHint:`Você pode salvar tudo em branco — os saldos iniciais podem ser atualizados depois. Basta ter uma abertura registrada para que as outras abas sejam liberadas.`,explainer2:`Apenas contas de balanço.`,submit:`Salvar saldos iniciais`,replaceWarning:`Salvar substitui a abertura existente (a anterior é estornada no diário).`,none:`Ainda não há saldo inicial.`,setBy:`Definido em {date}`,success:`Saldos iniciais salvos.`},ledger:{selectAccount:`Selecionar conta`,closingBalance:`Saldo final`,columns:{date:`Data`,memo:`Memo`,debit:`Débito`,credit:`Crédito`,balance:`Saldo`,taxRegistrationId:`Inscrição fiscal`}},dateRange:{shortcutLabel:`Período`,currentQuarter:`Trimestre atual`,previousQuarter:`Último trimestre`,currentYear:`Ano atual`,previousYear:`Ano anterior`,lifetime:`Desde a abertura`,all:`Tudo`,fromLabel:`De`,toLabel:`Até`},balanceSheet:{asOfLabel:`Período`,sections:{asset:`Ativo`,liability:`Passivo`,equity:`Patrimônio`},total:`Total`,imbalance:`Diferença: {amount}`,currentEarnings:`Resultado do período`,shortcutLabel:`Atalho`,thisMonth:`Este mês`,lastMonth:`Mês anterior`,lastQuarter:`Último trimestre`,lastYear:`Ano anterior`},profitLoss:{fromLabel:`De`,toLabel:`Até`,income:`Receita`,expense:`Despesa`,netIncome:`Resultado líquido:`},accounts:{listEmpty:`Ainda não há contas nesta categoria.`,openLedgerAria:`Abrir razão de {code} {name}`,manageButton:`Gerenciar contas`,modalTitle:`Gerenciar contas`,addAccount:`Adicionar conta`,sectionTitle:{asset:`Ativos`,liability:`Passivos`,equity:`Patrimônio`,income:`Receitas`,expense:`Despesas`},columnCode:`Código`,columnName:`Nome`,columnType:`Tipo`,columnNote:`Observação`,typeOption:{asset:`Ativo`,liability:`Passivo`,equity:`Patrimônio`,income:`Receita`,expense:`Despesa`},edit:`Editar`,save:`Salvar`,cancel:`Cancelar`,saving:`Salvando…`,addToCategory:`Adicionar conta de {type}`,deactivate:`Desativar`,reactivate:`Ativar`,deactivateConfirm:`Ocultar “{name}” dos menus de lançamentos / razão? Os lançamentos existentes não são afetados.`,errorEmptyCode:`O código é obrigatório.`,errorReservedCode:`Códigos iniciados por “_” são reservados para linhas do sistema.`,errorInvalidCodeFormat:`O código da conta deve ter exatamente 4 dígitos.`,errorCodeTypeMismatch:`O código deve corresponder ao tipo de conta: 1xxx ativo, 2xxx passivo, 3xxx patrimônio, 4xxx receita, 5xxx despesa.`,errorEmptyName:`O nome é obrigatório.`,errorDuplicateCode:`Já existe uma conta com este código.`,errorDuplicateName:`Já existe uma conta com este nome.`,success:`Conta salva.`,codeReadOnlyHint:`O código não pode ser alterado depois que a conta é criada.`,noteOptional:`(opcional)`},settings:{bookInfo:`Informações do livro`,bookInfoExplain:`Edite o país para atualizar as recomendações conforme a jurisdição fiscal. A moeda não pode ser alterada após registrar lançamentos.`,countryUnset:`(não definido)`,fiscalYearEndExplain:`Apenas altera como os atalhos de período são resolvidos a partir de agora; lançamentos existentes não são movidos.`,saveChanges:`Salvar alterações`,updateOk:`Livro atualizado.`,rebuild:`Reconstruir snapshots`,rebuildExplain:`Apaga todos os snapshots mensais e recalcula a partir do diário. Útil após editar o diário manualmente.`,rebuildOk:`Reconstruído(s) {count} período(s).`,advanced:`Avançado…`,deleteBook:`Excluir livro`,deleteBookExplain:`Exclui permanentemente o diretório do livro. Não pode ser desfeito.`,deleteBookConfirm:`Digite "{bookName}" para confirmar:`,deleteBookButton:`Excluir para sempre`},preview:{entry:`Lançamento em {date}`,pl:`P&L {from} → {to}: líquido {net}`,bs:`Balanço em {date} · ativos {assets}`,bookCreated:`Livro "{name}" ({id}) criado`,accountSaved:`Conta {code} "{name}" salva`,entryVoided:`Lançamento estornado; reversão lançada em {date}`,openingSet:`Saldos iniciais definidos em {date}`,openingReplaced:`Saldos iniciais substituídos em {date}`},previewSummary:`Contabilidade · {bookId}`,previewError:`Contabilidade: {error}`,previewGeneric:`Resultado da contabilidade`}},fr:{pluginAccounting:{title:`Comptabilité`,noBook:`Pas encore de livres — cliquez sur "+ Nouveau livre" en haut pour créer le premier.`,common:{cancel:`Annuler`,loading:`Chargement…`,error:`Erreur : {error}`,empty:`Aucune écriture pour l'instant.`},tabs:{journal:`Journal`,newEntry:`Nouvelle écriture`,opening:`Ouverture`,accounts:`Comptes`,ledger:`Grand livre`,balanceSheet:`Bilan`,profitLoss:`Résultat`,settings:`Paramètres`},bookSwitcher:{label:`Livre`,newBook:`Nouveau livre…`,create:`Créer`,nameLabel:`Nom`,currencyLabel:`Devise`,countryLabel:`Pays`,countryPlaceholder:`Sélectionner un pays…`,countryHint:`Le pays définit la juridiction fiscale afin que l'assistant puisse donner des conseils ciblés (T-number au Japon, ID TVA dans l'UE, etc.).`,fiscalYearEndLabel:`Clôture de l'exercice`,fiscalYearEndHint:`Définit la limite de l'exercice utilisée par les raccourcis de plage de dates de ce livre. Choisissez le mois au dernier jour duquel l'exercice se clôture. Par défaut : décembre (année civile).`,placeholder:`Sélectionner un livre…`,firstRunHint:`Choisissez le nom, la devise, le pays et la clôture de l'exercice de votre premier livre. La devise est figée par livre et difficile à changer une fois les écritures commencées.`},deletedNotice:{title:`« {bookName} » a été supprimé.`,body:`Choisissez un autre livre dans la liste ci-dessus ou créez-en un nouveau.`},journalList:{fromLabel:`Du`,toLabel:`Au`,accountLabel:`Compte`,allAccounts:`Tous`,void:`Annuler`,edit:`Modifier`,voidConfirm:`Annuler cette écriture ? L'originale reste dans le journal ; une paire de contre-passation est ajoutée.`,voidReason:`Motif (optionnel) :`,columns:{date:`Date`,kind:`Type`,memo:`Mémo`,lines:`Lignes`},kind:{normal:`—`,opening:`Ouverture`,void:`Contre-passation`,voidMarker:`Marqueur d'annulation`}},entryForm:{title:`Nouvelle écriture`,editTitle:`Modifier l'écriture`,editBanner:`À l'envoi, l'écriture d'origine sera contre-passée et remplacée par celle-ci.`,dateLabel:`Date`,memoLabel:`Mémo`,accountLabel:`Compte`,debitLabel:`Débit`,creditLabel:`Crédit`,taxRegistrationIdLabel:`N° d'identification fiscale`,taxRegistrationIdPlaceholder:`TVA / SIRET / GSTIN…`,taxRegistrationIdMissingWarning:`Obligatoire`,addLine:`Ajouter une ligne`,removeLine:`Supprimer`,submit:`Comptabiliser`,submitting:`Comptabilisation…`,update:`Mettre à jour`,updating:`Mise à jour…`,cancelEdit:`Annuler`,success:`Écriture comptabilisée.`,editSuccess:`Écriture mise à jour.`,editVoidReason:`modifiée`,imbalance:`Déséquilibre : {amount}`,balanced:`Équilibré ✓`},openingForm:{title:`Soldes d'ouverture`,asOfLabel:`Au`,explainer:`Comptes de bilan uniquement (actif/passif/capitaux). Σ débit = Σ crédit ; le solde tombe sur Retained Earnings.`,emptyHint:`Vous pouvez enregistrer en laissant tout vide — les soldes d'ouverture peuvent être mis à jour plus tard. Il suffit qu'une ouverture soit enregistrée pour débloquer les autres onglets.`,explainer2:`Comptes de bilan uniquement.`,submit:`Enregistrer les soldes d'ouverture`,replaceWarning:`Enregistrer remplace l'ouverture existante (l'ancienne est contre-passée dans le journal).`,none:`Aucun solde d'ouverture défini.`,setBy:`Défini au {date}`,success:`Soldes d'ouverture enregistrés.`},ledger:{selectAccount:`Sélectionner un compte`,closingBalance:`Solde de clôture`,columns:{date:`Date`,memo:`Mémo`,debit:`Débit`,credit:`Crédit`,balance:`Solde`,taxRegistrationId:`N° d'identification fiscale`}},dateRange:{shortcutLabel:`Plage`,currentQuarter:`Trimestre en cours`,previousQuarter:`Trimestre précédent`,currentYear:`Exercice en cours`,previousYear:`Exercice précédent`,lifetime:`Depuis l'ouverture`,all:`Tout`,fromLabel:`Du`,toLabel:`Au`},balanceSheet:{asOfLabel:`Période`,sections:{asset:`Actif`,liability:`Passif`,equity:`Capitaux`},total:`Total`,imbalance:`Déséquilibre : {amount}`,currentEarnings:`Résultat de la période`,shortcutLabel:`Raccourci`,thisMonth:`Ce mois-ci`,lastMonth:`Mois précédent`,lastQuarter:`Trimestre précédent`,lastYear:`Année précédente`},profitLoss:{fromLabel:`Du`,toLabel:`Au`,income:`Produits`,expense:`Charges`,netIncome:`Résultat net :`},accounts:{listEmpty:`Aucun compte dans cette catégorie pour l'instant.`,openLedgerAria:`Ouvrir le grand livre de {code} {name}`,manageButton:`Gérer les comptes`,modalTitle:`Gérer les comptes`,addAccount:`Ajouter un compte`,sectionTitle:{asset:`Actifs`,liability:`Passifs`,equity:`Capitaux propres`,income:`Produits`,expense:`Charges`},columnCode:`Code`,columnName:`Nom`,columnType:`Type`,columnNote:`Note`,typeOption:{asset:`Actif`,liability:`Passif`,equity:`Capitaux propres`,income:`Produit`,expense:`Charge`},edit:`Modifier`,save:`Enregistrer`,cancel:`Annuler`,saving:`Enregistrement…`,addToCategory:`Ajouter un compte de {type}`,deactivate:`Désactiver`,reactivate:`Activer`,deactivateConfirm:`Masquer « {name} » des listes déroulantes d’écriture / grand livre ? Les écritures existantes ne sont pas affectées.`,errorEmptyCode:`Le code est requis.`,errorReservedCode:`Les codes commençant par « _ » sont réservés aux lignes système.`,errorInvalidCodeFormat:`Le code de compte doit comporter exactement 4 chiffres.`,errorCodeTypeMismatch:`Le code doit correspondre au type de compte : 1xxx actif, 2xxx passif, 3xxx capitaux propres, 4xxx produit, 5xxx charge.`,errorEmptyName:`Le nom est requis.`,errorDuplicateCode:`Un compte avec ce code existe déjà.`,errorDuplicateName:`Un compte portant ce nom existe déjà.`,success:`Compte enregistré.`,codeReadOnlyHint:`Le code ne peut pas être modifié une fois le compte créé.`,noteOptional:`(facultatif)`},settings:{bookInfo:`Informations du livre`,bookInfoExplain:`Modifiez le pays pour mettre à jour les conseils selon la juridiction fiscale. La devise ne peut pas être changée une fois des écritures saisies.`,countryUnset:`(non défini)`,fiscalYearEndExplain:`Modifie uniquement la résolution des raccourcis de plage de dates à partir de maintenant ; les écritures existantes ne sont pas déplacées.`,saveChanges:`Enregistrer les modifications`,updateOk:`Livre mis à jour.`,rebuild:`Reconstruire les snapshots`,rebuildExplain:`Supprime tous les snapshots mensuels et les recalcule depuis le journal. Utile après modification manuelle du journal.`,rebuildOk:`{count} période(s) reconstruite(s).`,advanced:`Avancé…`,deleteBook:`Supprimer le livre`,deleteBookExplain:`Supprime définitivement le répertoire du livre. Irréversible.`,deleteBookConfirm:`Tapez "{bookName}" pour confirmer :`,deleteBookButton:`Supprimer définitivement`},preview:{entry:`Écriture comptabilisée le {date}`,pl:`P&L {from} → {to} : net {net}`,bs:`Bilan au {date} · actif {assets}`,bookCreated:`Livre "{name}" ({id}) créé`,accountSaved:`Compte {code} « {name} » enregistré`,entryVoided:`Écriture annulée ; contrepassation passée le {date}`,openingSet:`Soldes d'ouverture définis au {date}`,openingReplaced:`Soldes d'ouverture remplacés au {date}`},previewSummary:`Comptabilité · {bookId}`,previewError:`Comptabilité : {error}`,previewGeneric:`Résultat comptable`}},de:{pluginAccounting:{title:`Buchhaltung`,noBook:`Noch keine Bücher — klicken Sie oben auf "+ Neues Buch", um das erste anzulegen.`,common:{cancel:`Abbrechen`,loading:`Lädt…`,error:`Fehler: {error}`,empty:`Noch keine Einträge.`},tabs:{journal:`Journal`,newEntry:`Neuer Eintrag`,opening:`Eröffnung`,accounts:`Konten`,ledger:`Hauptbuch`,balanceSheet:`Bilanz`,profitLoss:`GuV`,settings:`Einstellungen`},bookSwitcher:{label:`Buch`,newBook:`Neues Buch…`,create:`Anlegen`,nameLabel:`Name`,currencyLabel:`Währung`,countryLabel:`Land`,countryPlaceholder:`Land auswählen…`,countryHint:`Das Land legt die Steuerjurisdiktion fest, damit der Assistent länderspezifische Hinweise geben kann (T-Nummer in Japan, USt-IdNr. in der EU usw.).`,fiscalYearEndLabel:`Geschäftsjahresende`,fiscalYearEndHint:`Bestimmt die Geschäftsjahresgrenze, die für die Datumsbereich-Schnellauswahl in diesem Buch verwendet wird. Wähle den Monat, an dessen letztem Tag das Geschäftsjahr endet. Standard: Dezember (Kalenderjahr).`,placeholder:`Buch auswählen…`,firstRunHint:`Wählen Sie Name, Währung, Land und Geschäftsjahresende für Ihr erstes Buch. Die Währung ist pro Buch fest und nach den ersten Buchungen schwer zu ändern.`},deletedNotice:{title:`Das Buch "{bookName}" wurde gelöscht.`,body:`Wählen Sie oben ein anderes Buch aus oder legen Sie ein neues an.`},journalList:{fromLabel:`Von`,toLabel:`Bis`,accountLabel:`Konto`,allAccounts:`Alle Konten`,void:`Stornieren`,edit:`Bearbeiten`,voidConfirm:`Diesen Eintrag stornieren? Das Original bleibt im Journal; ein Stornopaar wird angehängt.`,voidReason:`Grund (optional):`,columns:{date:`Datum`,kind:`Art`,memo:`Memo`,lines:`Zeilen`},kind:{normal:`—`,opening:`Eröffnung`,void:`Storno`,voidMarker:`Storno-Marker`}},entryForm:{title:`Neuer Eintrag`,editTitle:`Eintrag bearbeiten`,editBanner:`Beim Absenden wird der Originaleintrag storniert und durch diesen ersetzt.`,dateLabel:`Datum`,memoLabel:`Memo`,accountLabel:`Konto`,debitLabel:`Soll`,creditLabel:`Haben`,taxRegistrationIdLabel:`Steuernummer`,taxRegistrationIdPlaceholder:`USt-IdNr. / VAT ID / GSTIN…`,taxRegistrationIdMissingWarning:`Erforderlich`,addLine:`Zeile hinzufügen`,removeLine:`Entfernen`,submit:`Buchen`,submitting:`Bucht…`,update:`Aktualisieren`,updating:`Aktualisiert…`,cancelEdit:`Abbrechen`,success:`Eintrag gebucht.`,editSuccess:`Eintrag aktualisiert.`,editVoidReason:`bearbeitet`,imbalance:`Differenz: {amount}`,balanced:`Ausgeglichen ✓`},openingForm:{title:`Eröffnungsbilanz`,asOfLabel:`Per`,explainer:`Nur Bilanzkonten (Aktiva/Passiva/Eigenkapital). Σ Soll = Σ Haben; die Differenz fließt in Retained Earnings.`,emptyHint:`Sie können das Formular leer speichern — die Eröffnungsbilanz lässt sich später aktualisieren. Es reicht, dass einmalig eine Eröffnung hinterlegt ist, damit die übrigen Tabs freigeschaltet werden.`,explainer2:`Nur Bilanzkonten.`,submit:`Eröffnungsbilanz speichern`,replaceWarning:`Beim Speichern wird die bestehende Eröffnung ersetzt (die alte wird im Journal storniert).`,none:`Noch keine Eröffnungsbilanz.`,setBy:`Per {date} festgelegt`,success:`Eröffnungsbilanz gespeichert.`},ledger:{selectAccount:`Konto wählen`,closingBalance:`Schlusssaldo`,columns:{date:`Datum`,memo:`Memo`,debit:`Soll`,credit:`Haben`,balance:`Saldo`,taxRegistrationId:`Steuernummer`}},dateRange:{shortcutLabel:`Bereich`,currentQuarter:`Aktuelles Quartal`,previousQuarter:`Letztes Quartal`,currentYear:`Aktuelles Jahr`,previousYear:`Letztes Jahr`,lifetime:`Seit Eröffnung`,all:`Alle`,fromLabel:`Von`,toLabel:`Bis`},balanceSheet:{asOfLabel:`Periode`,sections:{asset:`Aktiva`,liability:`Passiva`,equity:`Eigenkapital`},total:`Summe`,imbalance:`Differenz: {amount}`,currentEarnings:`Periodenergebnis`,shortcutLabel:`Schnellauswahl`,thisMonth:`Dieser Monat`,lastMonth:`Letzter Monat`,lastQuarter:`Letztes Quartal`,lastYear:`Letztes Jahr`},profitLoss:{fromLabel:`Von`,toLabel:`Bis`,income:`Erträge`,expense:`Aufwendungen`,netIncome:`Jahresüberschuss:`},accounts:{listEmpty:`In dieser Kategorie sind noch keine Konten vorhanden.`,openLedgerAria:`Hauptbuch für {code} {name} öffnen`,manageButton:`Konten verwalten`,modalTitle:`Konten verwalten`,addAccount:`Konto hinzufügen`,sectionTitle:{asset:`Aktiva`,liability:`Passiva`,equity:`Eigenkapital`,income:`Erträge`,expense:`Aufwendungen`},columnCode:`Code`,columnName:`Name`,columnType:`Typ`,columnNote:`Notiz`,typeOption:{asset:`Aktivkonto`,liability:`Passivkonto`,equity:`Eigenkapital`,income:`Ertrag`,expense:`Aufwand`},edit:`Bearbeiten`,save:`Speichern`,cancel:`Abbrechen`,saving:`Wird gespeichert…`,addToCategory:`Konto vom Typ {type} hinzufügen`,deactivate:`Deaktivieren`,reactivate:`Aktivieren`,deactivateConfirm:`Soll „{name}“ aus den Buchungs- und Kontodropdowns ausgeblendet werden? Bestehende Buchungen bleiben unberührt.`,errorEmptyCode:`Code ist erforderlich.`,errorReservedCode:`Codes, die mit „_“ beginnen, sind für Systemzeilen reserviert.`,errorInvalidCodeFormat:`Der Kontocode muss genau 4 Ziffern haben.`,errorCodeTypeMismatch:`Der Code muss zur Kontoart passen: 1xxx Aktivkonto, 2xxx Passivkonto, 3xxx Eigenkapital, 4xxx Ertrag, 5xxx Aufwand.`,errorEmptyName:`Name ist erforderlich.`,errorDuplicateCode:`Ein Konto mit diesem Code existiert bereits.`,errorDuplicateName:`Ein Konto mit diesem Namen existiert bereits.`,success:`Konto gespeichert.`,codeReadOnlyHint:`Der Code kann nach dem Anlegen des Kontos nicht mehr geändert werden.`,noteOptional:`(optional)`},settings:{bookInfo:`Buchinformationen`,bookInfoExplain:`Ändern Sie das Land, um die Hinweise zur Steuerjurisdiktion zu aktualisieren. Die Währung kann nach gebuchten Einträgen nicht mehr geändert werden.`,countryUnset:`(nicht gesetzt)`,fiscalYearEndExplain:`Ändert nur, wie die Datumsbereich-Schnellauswahl ab jetzt aufgelöst wird; bestehende Buchungen werden nicht verschoben.`,saveChanges:`Änderungen speichern`,updateOk:`Buch aktualisiert.`,rebuild:`Snapshots neu aufbauen`,rebuildExplain:`Verwirft alle Monats-Snapshots und berechnet sie aus dem Journal neu. Nützlich nach manueller Bearbeitung.`,rebuildOk:`{count} Periode(n) neu aufgebaut.`,advanced:`Erweitert…`,deleteBook:`Buch löschen`,deleteBookExplain:`Löscht das Buch-Verzeichnis dauerhaft. Nicht rückgängig zu machen.`,deleteBookConfirm:`Tippen Sie "{bookName}" zur Bestätigung:`,deleteBookButton:`Endgültig löschen`},preview:{entry:`Eintrag am {date} gebucht`,pl:`GuV {from} → {to}: netto {net}`,bs:`Bilanz per {date} · Aktiva {assets}`,bookCreated:`Buch "{name}" ({id}) angelegt`,accountSaved:`Konto {code} "{name}" gespeichert`,entryVoided:`Buchung storniert; Gegenbuchung am {date} erfasst`,openingSet:`Eröffnungssalden zum {date} festgelegt`,openingReplaced:`Eröffnungssalden zum {date} ersetzt`},previewSummary:`Buchhaltung · {bookId}`,previewError:`Buchhaltung: {error}`,previewGeneric:`Buchhaltungs-Ergebnis`}}},edt),tdt=Q7e.dispatch.path,ndt=Q7e.dispatch.method;function rdt(e){return function(t,n={}){let r=e(),i=r?{[$7e]:r}:{};return Qut(tdt,{method:ndt,body:{action:t,...n,...i}})}}function idt(e){function t(){return e(tP.getBooks)}function n(t){return e(tP.createBook,t)}function r(t){return e(tP.updateBook,t)}function i(t){return e(tP.deleteBook,{bookId:t,confirm:!0})}return{getBooks:t,createBook:n,updateBook:r,deleteBook:i}}function adt(e){function t(t){return e(tP.getAccounts,{bookId:t})}function n(t,n){return e(tP.upsertAccount,{account:t,bookId:n})}return{getAccounts:t,upsertAccount:n}}function odt(e){function t(t){return e(tP.addEntries,t)}function n(t){return e(tP.voidEntry,t)}function r(t){return e(tP.getJournalEntries,t)}function i(t){return e(tP.getOpeningBalances,{bookId:t})}function a(t){return e(tP.setOpeningBalances,t)}return{addEntries:t,voidEntry:n,getJournalEntries:r,getOpeningBalances:i,setOpeningBalances:a}}function sdt(e){function t(t,n){return e(tP.getReport,{kind:`balance`,period:t,bookId:n})}function n(t,n){return e(tP.getReport,{kind:`pl`,period:t,bookId:n})}function r(t,n,r){return e(tP.getReport,{kind:`ledger`,accountCode:t,period:n,bookId:r})}function i(t){return e(tP.getTimeSeries,{...t})}function a(t){return e(tP.rebuildSnapshots,{bookId:t})}return{getBalanceSheet:t,getProfitLoss:n,getLedger:r,getTimeSeries:i,rebuildSnapshots:a}}function cdt(e){let t=rdt(e);return{...idt(t),...adt(t),...odt(t),...sdt(t)}}var ldt=cdt(bL),udt=Symbol(`accounting-api`);function ddt(e){let t=cdt(e);return C(udt,t),t}function SL(){return Re(udt,ldt)}var fdt={class:`text-base font-semibold`},pdt={key:0,class:`text-xs text-gray-500`,"data-testid":`accounting-new-book-firstrun`},mdt={class:`text-sm flex flex-col gap-1`},hdt={class:`text-sm flex flex-col gap-1`},gdt=[`value`],_dt={class:`text-sm flex flex-col gap-1`},vdt={value:``},ydt=[`value`],bdt={class:`text-xs text-gray-500`},xdt={class:`text-sm flex flex-col gap-1`},Sdt=[`value`],Cdt={class:`text-xs text-gray-500`},wdt={key:1,class:`text-xs text-red-500`,"data-testid":`accounting-new-book-error`},Tdt={class:`flex justify-end gap-2 mt-1`},Edt=[`disabled`],Ddt=K({__name:`NewBookForm`,props:{firstRun:{type:Boolean,default:!1},cancelable:{type:Boolean,default:!0},fullPage:{type:Boolean,default:!1}},emits:[`cancel`,`created`],setup(e,{emit:t}){let n=SL(),{t:r,locale:a}=xL();function o(e){try{let{region:t}=new Intl.Locale(e).maximize();if(x9e(t))return t}catch{}return``}function l(e){let t=o(e);return t===``?o(typeof navigator<`u`&&typeof navigator.language==`string`?navigator.language:``):t}let d=e,f=t,p=V(``),h=V(`USD`),g=V(l(a.value)),_=V(12),v=V(!1),y=V(null),x=V(null);P(()=>{be(()=>x.value?.focus())});let C=m(()=>w9e.map(e=>({code:e,label:`${e} — ${E9e(e,a.value)}`}))),w=m(()=>cP.map(e=>({code:e,label:`${e} — ${b9e(e,a.value)}`}))),E=m(()=>iP.map(e=>({value:e,label:d9e(e,a.value)}))),O=m(()=>d.fullPage?`flex-1 bg-white flex items-center justify-center p-6 overflow-auto`:`fixed inset-0 z-50 bg-black/20 flex items-center justify-center`),k=m(()=>d.cancelable&&!d.fullPage);function A(){d.fullPage||j()}function j(){d.cancelable&&f(`cancel`)}async function M(){if(!v.value){v.value=!0,y.value=null;try{let e=g.value===``?void 0:g.value,t=await n.createBook({name:p.value.trim(),currency:h.value,country:e,fiscalYearEnd:_.value});if(!t.ok){y.value=t.error;return}f(`created`,t.data.book)}finally{v.value=!1}}}return(t,n)=>(B(),U(`div`,{class:c(O.value),"data-testid":`accounting-new-book-modal`,onClick:s(A,[`self`])},[S(`form`,{class:`bg-white p-4 rounded shadow-lg w-96 flex flex-col gap-3`,"data-testid":`accounting-new-book-form`,onSubmit:s(M,[`prevent`])},[S(`h3`,fdt,T(q(r)(`pluginAccounting.bookSwitcher.newBook`)),1),e.firstRun?(B(),U(`p`,pdt,T(q(r)(`pluginAccounting.bookSwitcher.firstRunHint`)),1)):b(``,!0),S(`label`,mdt,[J(T(q(r)(`pluginAccounting.bookSwitcher.nameLabel`))+` `,1),u(S(`input`,{ref_key:`nameInput`,ref:x,"onUpdate:modelValue":n[0]||=e=>p.value=e,required:``,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-new-book-name`},null,512),[[Fe,p.value]])]),S(`label`,hdt,[J(T(q(r)(`pluginAccounting.bookSwitcher.currencyLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[1]||=e=>h.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-new-book-currency`},[(B(!0),U(D,null,H(C.value,e=>(B(),U(`option`,{key:e.code,value:e.code},T(e.label),9,gdt))),128))],512),[[i,h.value]])]),S(`label`,_dt,[J(T(q(r)(`pluginAccounting.bookSwitcher.countryLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[2]||=e=>g.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-new-book-country`},[S(`option`,vdt,T(q(r)(`pluginAccounting.bookSwitcher.countryPlaceholder`)),1),(B(!0),U(D,null,H(w.value,e=>(B(),U(`option`,{key:e.code,value:e.code},T(e.label),9,ydt))),128))],512),[[i,g.value]])]),S(`p`,bdt,T(q(r)(`pluginAccounting.bookSwitcher.countryHint`)),1),S(`label`,xdt,[J(T(q(r)(`pluginAccounting.bookSwitcher.fiscalYearEndLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[3]||=e=>_.value=e,required:``,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-new-book-fiscal-year-end`},[(B(!0),U(D,null,H(E.value,e=>(B(),U(`option`,{key:e.value,value:e.value},T(e.label),9,Sdt))),128))],512),[[i,_.value]])]),S(`p`,Cdt,T(q(r)(`pluginAccounting.bookSwitcher.fiscalYearEndHint`)),1),y.value?(B(),U(`p`,wdt,T(y.value),1)):b(``,!0),S(`div`,Tdt,[k.value?(B(),U(`button`,{key:0,type:`button`,class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-700 hover:bg-gray-50`,onClick:j},T(q(r)(`pluginAccounting.common.cancel`)),1)):b(``,!0),S(`button`,{type:`submit`,class:`h-8 px-2.5 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm`,disabled:v.value,"data-testid":`accounting-new-book-submit`},T(v.value?q(r)(`pluginAccounting.common.loading`):q(r)(`pluginAccounting.bookSwitcher.create`)),9,Edt)])],32)],2))}}),Odt={class:`flex items-center gap-2`},kdt={class:`text-xs text-gray-500`,for:`accounting-book-select`},Adt=[`value`],jdt={key:0,value:``,disabled:``},Mdt=[`value`],Ndt=`__new__`,Pdt=K({__name:`BookSwitcher`,props:{modelValue:{},books:{}},emits:[`update:modelValue`,`books-changed`,`book-created`],setup(e,{emit:t}){let{t:n}=xL(),r=e,i=t,a=V(!1);function o(e){let t=e.country?`${e.currency} · ${e.country}`:e.currency;return`${e.name} (${t})`}function s(e){let{target:t}=e;if(!(t instanceof HTMLSelectElement))return;let n=t.value;if(n===Ndt){t.value=r.modelValue,a.value=!0;return}n!==r.modelValue&&i(`update:modelValue`,n)}function c(e){a.value=!1,i(`book-created`,e)}return(t,r)=>(B(),U(`div`,Odt,[S(`label`,kdt,T(q(n)(`pluginAccounting.bookSwitcher.label`)),1),S(`select`,{id:`accounting-book-select`,value:e.modelValue,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-book-select`,onChange:s},[e.modelValue===``?(B(),U(`option`,jdt,T(q(n)(`pluginAccounting.bookSwitcher.placeholder`)),1)):b(``,!0),(B(!0),U(D,null,H(e.books,e=>(B(),U(`option`,{key:e.id,value:e.id},T(o(e)),9,Mdt))),128)),r[1]||=S(`option`,{disabled:``},`──────────`,-1),S(`option`,{value:Ndt,"data-testid":`accounting-new-book-option`},`+ `+T(q(n)(`pluginAccounting.bookSwitcher.newBook`)),1)],40,Adt),a.value?(B(),ke(Ddt,{key:0,onCancel:r[0]||=e=>a.value=!1,onCreated:c})):b(``,!0)]))}});function CL(){let e=0;return{begin(){return e+=1,e},isCurrent(t){return t===e}}}var Fdt={class:`flex flex-wrap items-end gap-2`,"data-testid":`accounting-daterange`},Idt={class:`text-xs text-gray-500 flex flex-col gap-1`},Ldt=[`value`],Rdt={value:`currentQuarter`},zdt={value:`previousQuarter`},Bdt={value:`currentYear`},Vdt={value:`previousYear`},Hdt={key:0,value:`lifetime`},Udt={value:`all`},Wdt={class:`text-xs text-gray-500 flex flex-col gap-1`},Gdt=[`value`],Kdt={class:`text-xs text-gray-500 flex flex-col gap-1`},qdt=[`value`],wL=K({__name:`DateRangePicker`,props:{modelValue:{},fiscalYearEnd:{},openingDate:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let{t:n}=xL(),r=e,i=t,a=m(()=>!!r.openingDate),o={from:``,to:``};function s(){return r.openingDate?{from:r.openingDate,to:dP()}:null}function c(e,t){return e.from===t.from&&e.to===t.to}let l=m(()=>{let e=r.modelValue,t=new Date;if(c(e,_9e(r.fiscalYearEnd,t)))return`currentQuarter`;if(c(e,v9e(r.fiscalYearEnd,t)))return`previousQuarter`;if(c(e,sP(r.fiscalYearEnd,t)))return`currentYear`;if(c(e,y9e(r.fiscalYearEnd,t)))return`previousYear`;let n=s();return n&&c(e,n)?`lifetime`:c(e,o)?`all`:``});function u(e){let{target:t}=e;if(!(t instanceof HTMLSelectElement))return;let n=t.value,a=new Date;if(n===`currentQuarter`)i(`update:modelValue`,_9e(r.fiscalYearEnd,a));else if(n===`previousQuarter`)i(`update:modelValue`,v9e(r.fiscalYearEnd,a));else if(n===`currentYear`)i(`update:modelValue`,sP(r.fiscalYearEnd,a));else if(n===`previousYear`)i(`update:modelValue`,y9e(r.fiscalYearEnd,a));else if(n===`lifetime`){let e=s();e&&i(`update:modelValue`,e)}else n===`all`&&i(`update:modelValue`,o)}function d(e){let{target:t}=e;t instanceof HTMLInputElement&&i(`update:modelValue`,{from:t.value,to:r.modelValue.to})}function f(e){let{target:t}=e;t instanceof HTMLInputElement&&i(`update:modelValue`,{from:r.modelValue.from,to:t.value})}return(t,r)=>(B(),U(`div`,Fdt,[S(`label`,Idt,[J(T(q(n)(`pluginAccounting.dateRange.shortcutLabel`))+` `,1),S(`select`,{value:l.value,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-daterange-shortcut`,onChange:u},[r[0]||=S(`option`,{value:``,hidden:``},null,-1),S(`option`,Rdt,T(q(n)(`pluginAccounting.dateRange.currentQuarter`)),1),S(`option`,zdt,T(q(n)(`pluginAccounting.dateRange.previousQuarter`)),1),S(`option`,Bdt,T(q(n)(`pluginAccounting.dateRange.currentYear`)),1),S(`option`,Vdt,T(q(n)(`pluginAccounting.dateRange.previousYear`)),1),a.value?(B(),U(`option`,Hdt,T(q(n)(`pluginAccounting.dateRange.lifetime`)),1)):b(``,!0),S(`option`,Udt,T(q(n)(`pluginAccounting.dateRange.all`)),1)],40,Ldt)]),S(`label`,Wdt,[J(T(q(n)(`pluginAccounting.dateRange.fromLabel`))+` `,1),S(`input`,{value:e.modelValue.from,type:`date`,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-daterange-from`,onInput:d},null,40,Gdt)]),S(`label`,Kdt,[J(T(q(n)(`pluginAccounting.dateRange.toLabel`))+` `,1),S(`input`,{value:e.modelValue.to,type:`date`,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-daterange-to`,onInput:f},null,40,qdt)])]))}}),TL={asset:1,liability:2,equity:3,income:4,expense:5},Jdt=[`14`];function Ydt(e){return Jdt.some(t=>e.startsWith(t))}var Xdt=/^\d{4}$/,Zdt=10;function EL(e){return Xdt.test(e)}function Qdt(e){if(!EL(e))return null;let t=Number.parseInt(e.charAt(0),10);return e9e.find(e=>TL[e]===t)??null}function $dt(e,t){return Qdt(e)===t}function eft(e,t){let n=TL[e],r=[];for(let e of t){if(!EL(e.code))continue;let t=Number.parseInt(e.code,10);Math.floor(t/1e3)===n&&r.push(t)}if(r.length===0)return`${n}000`;let i=Math.max(...r),a=i+Zdt;if(Math.floor(a/1e3)===n&&a<=9999)return String(a);let o=i+1;return Math.floor(o/1e3)===n&&o<=9999?String(o):`${n}999`}var tft=[`data-testid`],nft=[`checked`,`title`,`aria-label`,`data-testid`],rft={class:`font-mono text-xs text-gray-500 w-16 shrink-0`},ift=[`data-testid`],aft=[`title`],oft=[`data-testid`,`disabled`,`aria-hidden`,`tabindex`],sft=K({__name:`AccountRow`,props:{account:{}},emits:[`edit`,`toggleActive`],setup(e,{emit:t}){let{t:n}=xL(),r=e,i=t,a=m(()=>r.account.active===!1);return(t,r)=>(B(),U(`div`,{class:c([`flex items-center gap-2 px-2 py-0.5 text-sm`,a.value?`opacity-60`:``]),"data-testid":`accounting-accounts-row-${e.account.code}`},[S(`input`,{type:`checkbox`,checked:!a.value,title:a.value?q(n)(`pluginAccounting.accounts.reactivate`):q(n)(`pluginAccounting.accounts.deactivate`),"aria-label":a.value?q(n)(`pluginAccounting.accounts.reactivate`):q(n)(`pluginAccounting.accounts.deactivate`),class:`h-4 w-4 shrink-0 cursor-pointer`,"data-testid":`accounting-accounts-toggle-${e.account.code}`,onChange:r[0]||=e=>i(`toggleActive`)},null,40,nft),S(`span`,rft,T(e.account.code),1),S(`span`,{class:c([`grow min-w-0 truncate`,a.value?`line-through`:``]),"data-testid":a.value?`accounting-accounts-inactive-${e.account.code}`:void 0},T(e.account.name),11,ift),e.account.note?(B(),U(`span`,{key:0,class:`text-xs text-gray-400 truncate max-w-[8rem]`,title:e.account.note},T(e.account.note),9,aft)):b(``,!0),S(`button`,{type:`button`,class:c([`h-8 px-2.5 rounded text-sm text-blue-600 hover:bg-blue-50`,a.value?`invisible`:``]),"data-testid":`accounting-accounts-edit-${e.account.code}`,disabled:a.value,"aria-hidden":a.value?`true`:void 0,tabindex:a.value?-1:void 0,onClick:r[1]||=e=>i(`edit`)},T(q(n)(`pluginAccounting.accounts.edit`)),11,oft)],10,tft))}});function cft(e,t,n){let r=e.code.trim();return r.length===0?`emptyCode`:r.startsWith(`_`)?`reservedCode`:n&&!EL(r)?`invalidCodeFormat`:n&&!$dt(r,e.type)?`codeTypeMismatch`:n&&t.some(e=>e.code===r)?`duplicateCode`:null}function lft(e,t,n){let r=e.name.trim();if(r.length===0)return`emptyName`;let i=r.toLowerCase();return t.some(t=>!n&&t.code===e.code.trim()?!1:t.name.trim().toLowerCase()===i)?`duplicateName`:null}function uft(e,t,n){return cft(e,t,n)??lft(e,t,n)}var dft=[`data-testid`],fft={class:`flex flex-wrap gap-2`},pft={class:`text-xs text-gray-500 flex flex-col gap-1 w-28`},mft={class:`px-2 flex items-center bg-gray-100 text-gray-500 border-r border-gray-200 select-none`,"data-testid":`accounting-accounts-form-code-prefix`},hft={class:`text-xs text-gray-500 flex flex-col gap-1 grow min-w-[10rem]`},gft={class:`text-xs text-gray-500 flex flex-col gap-1 w-32`},_ft=[`value`],vft={class:`text-xs text-gray-500 flex flex-col gap-1`},yft={class:`text-gray-400`},bft={key:0,class:`text-xs text-gray-400`},xft={class:`text-xs text-red-500 min-h-[1rem]`,"data-testid":`accounting-accounts-form-error`},Sft={class:`flex justify-end gap-2`},Cft=[`disabled`],wft=K({__name:`AccountEditor`,props:{draft:{},isNew:{type:Boolean},busy:{type:Boolean},error:{},existingAccounts:{}},emits:[`save`,`cancel`],setup(e,{emit:t}){let{t:n}=xL(),r=e,a=t,o=[`asset`,`liability`,`equity`,`income`,`expense`],l={emptyCode:`pluginAccounting.accounts.errorEmptyCode`,reservedCode:`pluginAccounting.accounts.errorReservedCode`,invalidCodeFormat:`pluginAccounting.accounts.errorInvalidCodeFormat`,codeTypeMismatch:`pluginAccounting.accounts.errorCodeTypeMismatch`,emptyName:`pluginAccounting.accounts.errorEmptyName`,duplicateCode:`pluginAccounting.accounts.errorDuplicateCode`,duplicateName:`pluginAccounting.accounts.errorDuplicateName`},d=x({...r.draft}),f=V(null),p=V(!1),h=V(!1),g=m(()=>String(TL[d.type])),_=m({get:()=>{let{code:e}=d;return e.startsWith(g.value)?e.slice(g.value.length):e},set:e=>{let t=e.replace(/\D/g,``).slice(0,3);d.code=g.value+t}}),v=m(()=>{let e=cft(d,r.existingAccounts,r.isNew);return e===`emptyCode`&&!p.value?null:e}),y=m(()=>{let e=lft(d,r.existingAccounts,r.isNew);return e===`emptyName`&&!h.value&&!r.isNew?null:e}),C=m(()=>{let e=v.value;if(e!==null)return n(l[e]);let t=y.value;return t===null?null:n(l[t])});Ve(()=>r.draft,e=>{d.code=e.code,d.name=e.name,d.type=e.type,d.note=e.note,p.value=!1,h.value=!1}),P(()=>{be(()=>f.value?.focus())});function w(){p.value=!0,h.value=!0,a(`save`,{code:d.code,name:d.name,type:d.type,note:d.note})}return(t,r)=>(B(),U(`form`,{class:`flex flex-col gap-2 p-2 border border-blue-200 bg-blue-50/40 rounded text-sm`,"data-testid":e.isNew?`accounting-accounts-form-new`:`accounting-accounts-form-edit-${e.draft.code}`,onSubmit:s(w,[`prevent`])},[S(`div`,fft,[S(`label`,pft,[J(T(q(n)(`pluginAccounting.accounts.columnCode`))+` `,1),e.isNew?(B(),U(`div`,{key:0,class:c([`flex items-stretch h-8 rounded border bg-white text-sm font-mono overflow-hidden`,v.value?`border-red-500 ring-1 ring-red-500`:`border-gray-300 focus-within:ring-1 focus-within:ring-blue-500`])},[S(`span`,mft,T(g.value),1),u(S(`input`,{"onUpdate:modelValue":r[0]||=e=>_.value=e,type:`text`,inputmode:`numeric`,maxlength:`3`,pattern:`\\d{3}`,class:`px-2 grow w-0 outline-none bg-transparent`,"data-testid":`accounting-accounts-form-code`,onInput:r[1]||=e=>p.value=!0},null,544),[[Fe,_.value]])],2)):u((B(),U(`input`,{key:1,"onUpdate:modelValue":r[2]||=e=>d.code=e,type:`text`,disabled:``,class:`h-8 px-2 rounded border border-gray-300 text-sm font-mono bg-gray-100 text-gray-500`,"data-testid":`accounting-accounts-form-code`},null,512)),[[Fe,d.code]])]),S(`label`,hft,[J(T(q(n)(`pluginAccounting.accounts.columnName`))+` `,1),u(S(`input`,{ref_key:`nameInput`,ref:f,"onUpdate:modelValue":r[3]||=e=>d.name=e,type:`text`,class:c([`h-8 px-2 rounded border text-sm focus:outline-none`,y.value?`border-red-500 ring-1 ring-red-500`:`border-gray-300 focus:ring-1 focus:ring-blue-500`]),"data-testid":`accounting-accounts-form-name`,onInput:r[4]||=e=>h.value=!0},null,34),[[Fe,d.name]])]),S(`label`,gft,[J(T(q(n)(`pluginAccounting.accounts.columnType`))+` `,1),u(S(`select`,{"onUpdate:modelValue":r[5]||=e=>d.type=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white disabled:bg-gray-100 disabled:text-gray-500`,disabled:``,"data-testid":`accounting-accounts-form-type`},[(B(),U(D,null,H(o,e=>S(`option`,{key:e,value:e},T(q(n)(`pluginAccounting.accounts.typeOption.${e}`)),9,_ft)),64))],512),[[i,d.type]])])]),S(`label`,vft,[S(`span`,null,[J(T(q(n)(`pluginAccounting.accounts.columnNote`))+` `,1),S(`span`,yft,T(q(n)(`pluginAccounting.accounts.noteOptional`)),1)]),u(S(`input`,{"onUpdate:modelValue":r[6]||=e=>d.note=e,type:`text`,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-accounts-form-note`},null,512),[[Fe,d.note]])]),e.isNew?b(``,!0):(B(),U(`p`,bft,T(q(n)(`pluginAccounting.accounts.codeReadOnlyHint`)),1)),S(`p`,xft,T(C.value??e.error??``),1),S(`div`,Sft,[S(`button`,{type:`button`,class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-accounts-form-cancel`,onClick:r[7]||=e=>a(`cancel`)},T(q(n)(`pluginAccounting.accounts.cancel`)),1),S(`button`,{type:`submit`,class:`h-8 px-2.5 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm disabled:opacity-50`,disabled:e.busy,"data-testid":`accounting-accounts-form-save`},T(e.busy?q(n)(`pluginAccounting.accounts.saving`):q(n)(`pluginAccounting.accounts.save`)),9,Cft)])],40,dft))}}),Tft={class:`bg-white rounded shadow-lg w-[32rem] max-h-[80vh] flex flex-col`},Eft={class:`flex items-center justify-between px-4 py-2 border-b border-gray-200 shrink-0`},Dft={id:`accounting-accounts-modal-title`,class:`text-base font-semibold`},Oft=[`aria-label`],kft={class:`flex-1 overflow-auto px-4 py-3 flex flex-col gap-3`},Aft={key:0,class:`text-xs text-green-600`,"data-testid":`accounting-accounts-success`},jft={key:1,class:`text-xs text-red-500`,"data-testid":`accounting-accounts-toggle-error`},Mft={class:`text-xs font-semibold text-gray-500 uppercase tracking-wide`},Nft={key:0,class:`text-xs text-gray-400 italic px-1`},Pft=[`data-testid`,`onClick`],Fft=2500,DL=K({__name:`AccountsModal`,props:{bookId:{},accounts:{}},emits:[`close`,`changed`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),i=e,a=t,o=[`asset`,`liability`,`equity`,`income`,`expense`],c={emptyCode:`pluginAccounting.accounts.errorEmptyCode`,reservedCode:`pluginAccounting.accounts.errorReservedCode`,invalidCodeFormat:`pluginAccounting.accounts.errorInvalidCodeFormat`,codeTypeMismatch:`pluginAccounting.accounts.errorCodeTypeMismatch`,emptyName:`pluginAccounting.accounts.errorEmptyName`,duplicateCode:`pluginAccounting.accounts.errorDuplicateCode`,duplicateName:`pluginAccounting.accounts.errorDuplicateName`},u=m(()=>o.map(e=>({type:e,accounts:i.accounts.filter(t=>t.type===e).slice().sort(d)})));function d(e,t){return e.code.localeCompare(t.code)}let f=V(null),p=V(!1),h=V(k(`asset`)),g=V(!1),v=V(null),y=V(!1),x=V(null),C=V(null),w=V(null),E=V(null),O=null;function k(e){return{code:``,name:``,type:e,note:``}}function A(e){return{code:eft(e,i.accounts),name:``,type:e,note:``}}function j(e,t){t===h.value.type&&(E.value=e instanceof HTMLDivElement?e:null)}function M(e){p.value=!1,v.value=null,h.value={code:e.code,name:e.name,type:e.type,note:e.note??``},f.value=e.code}function N(e){f.value=null,v.value=null,h.value=A(e),p.value=!0,be(()=>{E.value?.scrollIntoView({behavior:`smooth`,block:`nearest`})})}function F(){f.value=null,p.value=!1,v.value=null,h.value=k(`asset`)}function I(e,t){let n=uft(e,i.accounts,t);return n===null?null:r(c[n])}async function L(e){if(g.value)return;let t=p.value,o=I(e,t);if(o!==null){v.value=o;return}g.value=!0,v.value=null;try{let o={code:e.code.trim(),name:e.name.trim(),type:e.type},s=e.note.trim();s.length>0&&(o.note=s),t||i.accounts.find(e=>e.code===o.code)?.active===!1&&(o.active=!1);let c=await n.upsertAccount(o,i.bookId);if(!c.ok){v.value=c.error;return}F(),z(r(`pluginAccounting.accounts.success`)),a(`changed`)}catch(e){v.value=rP(e)}finally{g.value=!1}}async function R(e){if(y.value)return;F();let t=e.active!==!1;y.value=!0,x.value=null;try{let r={code:e.code,name:e.name,type:e.type};e.note!==void 0&&e.note.length>0&&(r.note=e.note),r.active=!t;let o=await n.upsertAccount(r,i.bookId);if(!o.ok){x.value=o.error;return}a(`changed`)}catch(e){x.value=rP(e)}finally{y.value=!1}}function z(e){C.value=e,O!==null&&clearTimeout(O),O=setTimeout(()=>{C.value=null,O=null},Fft)}function ee(){a(`close`)}return P(()=>{be(()=>w.value?.focus())}),_(()=>{O!==null&&clearTimeout(O)}),(t,n)=>(B(),U(`div`,{class:`fixed inset-0 z-50 bg-black/20 flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`accounting-accounts-modal-title`,"data-testid":`accounting-accounts-modal`,onClick:s(ee,[`self`]),onKeydown:n[1]||=l(e=>a(`close`),[`esc`])},[S(`div`,Tft,[S(`header`,Eft,[S(`h3`,Dft,T(q(r)(`pluginAccounting.accounts.modalTitle`)),1),S(`button`,{ref_key:`closeButton`,ref:w,type:`button`,class:`h-8 w-8 flex items-center justify-center rounded text-gray-500 hover:bg-gray-100`,"data-testid":`accounting-accounts-close`,"aria-label":q(r)(`pluginAccounting.common.cancel`),onClick:n[0]||=e=>a(`close`)},[...n[2]||=[S(`span`,{class:`material-icons text-base`},`close`,-1)]],8,Oft)]),S(`div`,kft,[C.value?(B(),U(`p`,Aft,T(C.value),1)):b(``,!0),x.value?(B(),U(`p`,jft,T(x.value),1)):b(``,!0),(B(!0),U(D,null,H(u.value,t=>(B(),U(`section`,{key:t.type,class:`flex flex-col gap-1`},[S(`h4`,Mft,T(q(r)(`pluginAccounting.accounts.sectionTitle.${t.type}`)),1),t.accounts.length===0?(B(),U(`div`,Nft,T(q(r)(`pluginAccounting.common.empty`)),1)):b(``,!0),(B(!0),U(D,null,H(t.accounts,t=>(B(),U(D,{key:t.code},[f.value===t.code?(B(),ke(wft,{key:1,draft:h.value,"is-new":!1,busy:g.value,error:v.value,"existing-accounts":e.accounts,onSave:L,onCancel:F},null,8,[`draft`,`busy`,`error`,`existing-accounts`])):(B(),ke(sft,{key:0,account:t,onEdit:e=>M(t),onToggleActive:e=>R(t)},null,8,[`account`,`onEdit`,`onToggleActive`]))],64))),128)),p.value&&h.value.type===t.type?(B(),U(`div`,{key:1,ref_for:!0,ref:e=>j(e,t.type)},[De(wft,{draft:h.value,"is-new":``,busy:g.value,error:v.value,"existing-accounts":e.accounts,onSave:L,onCancel:F},null,8,[`draft`,`busy`,`error`,`existing-accounts`])],512)):(B(),U(`button`,{key:2,type:`button`,class:`self-start h-8 px-2.5 flex items-center gap-1 rounded text-xs text-gray-600 hover:bg-gray-100`,"data-testid":`accounting-accounts-add-${t.type}`,onClick:e=>N(t.type)},[n[3]||=S(`span`,{class:`material-icons text-sm`},`add`,-1),S(`span`,null,T(q(r)(`pluginAccounting.accounts.addToCategory`,{type:q(r)(`pluginAccounting.accounts.typeOption.${t.type}`)})),1)],8,Pft))]))),128))])])],32))}}),Ift={key:0,class:`text-base font-semibold`},Lft={class:`flex flex-wrap gap-3`},Rft={class:`text-xs text-gray-500 flex flex-col gap-1`},zft={class:`text-xs text-gray-500 flex flex-col gap-1 grow min-w-0`},Bft={class:`w-full text-sm`},Vft={class:`text-xs text-gray-500 border-b border-gray-200`},Hft={class:`text-left py-1 px-2`},Uft={class:`text-right py-1 px-2 w-32`},Wft={class:`text-right py-1 px-2 w-32`},Gft={key:0,class:`text-left py-1 px-2 w-40`},Kft={class:`py-1 px-2`},qft=[`onUpdate:modelValue`,`data-testid`],Jft=[`value`],Yft={class:`py-1 px-2`},Xft=[`onUpdate:modelValue`,`step`,`data-testid`,`onInput`],Zft={class:`py-1 px-2`},Qft=[`onUpdate:modelValue`,`step`,`data-testid`,`onInput`],$ft={key:0,class:`py-1 px-2`},ept=[`onUpdate:modelValue`,`placeholder`,`data-testid`,`aria-describedby`],tpt=[`id`,`data-testid`],npt={class:`py-1 px-2 text-right`},rpt=[`onClick`],ipt={class:`flex items-center justify-between`},apt={class:`flex items-center gap-2`},opt={key:1,class:`text-xs text-red-500`,"data-testid":`accounting-entry-error`},spt={key:2,class:`text-xs text-green-600`,"data-testid":`accounting-entry-success`},cpt={class:`flex items-center justify-between gap-2`},lpt={key:0,class:`text-xs text-gray-500 flex-1 min-w-0`,"data-testid":`accounting-entry-edit-banner`},upt={key:1},dpt={class:`flex items-center gap-2`},fpt=[`disabled`],ppt=[`disabled`],mpt=`—`,hpt=32,gpt=K({__name:`JournalEntryForm`,props:{bookId:{},accounts:{},currency:{},country:{},entryToEdit:{}},emits:[`submitted`,`cancel`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),a=e,o=t,l=V(!1);function d(e){return`${e.name} (${e.code})`}let f=m(()=>a.accounts.filter(e=>e.active!==!1)),p=m(()=>new Set(f.value.map(e=>e.code)));function h(){return{accountCode:``,debit:null,credit:null,taxRegistrationId:``}}function g(e){return e.taxRegistrationId.trim().length>hpt}function _(e){return e.accountCode!==``&&Ydt(e.accountCode)}function v(e){return!_(e)||!ie(e)||!C9e(`warnMissingTaxRegistrationId`,a.country)?!1:e.taxRegistrationId.trim()===``}let y=V(dP()),x=V(``),C=V([h(),h()]),w=V(!1),E=V(null),O=V(null),k=m(()=>!!a.entryToEdit),A=m(()=>w.value?k.value?r(`pluginAccounting.entryForm.updating`):r(`pluginAccounting.entryForm.submitting`):k.value?r(`pluginAccounting.entryForm.update`):r(`pluginAccounting.entryForm.submit`)),j=V(!1),M=m(()=>k.value&&j.value);function N(){C.value.push(h())}function P(e){e.debit!==null&&e.debit!==0&&(e.credit=null)}function F(e){e.credit!==null&&e.credit!==0&&(e.debit=null)}let I=m(()=>{let e=0;for(let t of C.value)ie(t)&&(re(t.debit)&&(e+=t.debit),re(t.credit)&&(e-=t.credit));return e}),L=m(()=>{let e=0;for(let t of C.value)if(ie(t)&&(e+=1,e>=2))return!0;return!1}),R=m(()=>C.value.some(_)),z=m(()=>C.value.some(g)),ee=m(()=>Math.abs(I.value)<=.005&&L.value&&!z.value),te=m(()=>lP(I.value,a.currency)),ne=m(()=>O9e(a.currency));function re(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function ie(e){return!e.accountCode||!p.value.has(e.accountCode)?!1:re(e.debit)||re(e.credit)}function ae(){let e=[];for(let t of C.value){if(!ie(t))continue;let n={accountCode:t.accountCode};if(re(t.debit)&&(n.debit=t.debit),re(t.credit)&&(n.credit=t.credit),_(t)){let e=t.taxRegistrationId.trim();e!==``&&(n.taxRegistrationId=e)}e.push(n)}return e}async function oe(){if(!(w.value||!ee.value||M.value)){w.value=!0,E.value=null,O.value=null;try{let e=a.entryToEdit?.id;if(e){j.value=!0;let t=await n.voidEntry({bookId:a.bookId,entryId:e,reason:r(`pluginAccounting.entryForm.editVoidReason`)});if(!t.ok){E.value=t.error;return}}let t=await n.addEntries({bookId:a.bookId,entries:[{date:y.value,memo:x.value.trim()||void 0,lines:ae(),...e?{replacesEntryId:e}:{}}]});if(!t.ok){E.value=t.error;return}O.value=r(e?`pluginAccounting.entryForm.editSuccess`:`pluginAccounting.entryForm.success`),C.value=[h(),h()],x.value=``,o(`submitted`)}catch(e){E.value=rP(e)}finally{w.value=!1}}}return Ve(()=>a.bookId,()=>{C.value=[h(),h()],x.value=``,y.value=dP(),E.value=null,O.value=null}),Ve(()=>a.entryToEdit,e=>{if(E.value=null,O.value=null,j.value=!1,!e){C.value=[h(),h()],x.value=``,y.value=dP();return}if(y.value=e.date,x.value=e.memo??``,C.value=e.lines.map(e=>({accountCode:e.accountCode,debit:typeof e.debit==`number`?e.debit:null,credit:typeof e.credit==`number`?e.credit:null,taxRegistrationId:e.taxRegistrationId??``})),C.value.length<2)for(;C.value.length<2;)C.value.push(h())},{immediate:!0}),Ve(p,e=>{for(let t of C.value)t.accountCode&&!e.has(t.accountCode)&&(t.accountCode=``)}),(t,n)=>(B(),U(D,null,[S(`form`,{class:`flex flex-col gap-3`,"data-testid":`accounting-entry-form`,onSubmit:s(oe,[`prevent`])},[k.value?b(``,!0):(B(),U(`h3`,Ift,T(q(r)(`pluginAccounting.entryForm.title`)),1)),S(`div`,Lft,[S(`label`,Rft,[J(T(q(r)(`pluginAccounting.entryForm.dateLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[0]||=e=>y.value=e,type:`date`,required:``,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-entry-date`},null,512),[[Fe,y.value]])]),S(`label`,zft,[J(T(q(r)(`pluginAccounting.entryForm.memoLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[1]||=e=>x.value=e,type:`text`,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-entry-memo`},null,512),[[Fe,x.value]])])]),S(`table`,Bft,[S(`thead`,null,[S(`tr`,Vft,[S(`th`,Hft,T(q(r)(`pluginAccounting.entryForm.accountLabel`)),1),S(`th`,Uft,T(q(r)(`pluginAccounting.entryForm.debitLabel`)),1),S(`th`,Wft,T(q(r)(`pluginAccounting.entryForm.creditLabel`)),1),R.value?(B(),U(`th`,Gft,T(q(r)(`pluginAccounting.entryForm.taxRegistrationIdLabel`)),1)):b(``,!0),n[5]||=S(`th`,{class:`py-1 px-2`},null,-1)])]),S(`tbody`,null,[(B(!0),U(D,null,H(C.value,(e,t)=>(B(),U(`tr`,{key:t,class:`border-b border-gray-100`},[S(`td`,Kft,[u(S(`select`,{"onUpdate:modelValue":t=>e.accountCode=t,class:`h-8 px-2 w-full rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-entry-line-account-${t}`},[S(`option`,{value:``},T(mpt)),(B(!0),U(D,null,H(f.value,e=>(B(),U(`option`,{key:e.code,value:e.code},T(d(e)),9,Jft))),128))],8,qft),[[i,e.accountCode]])]),S(`td`,Yft,[u(S(`input`,{"onUpdate:modelValue":t=>e.debit=t,type:`number`,step:ne.value,min:`0`,class:`h-8 px-2 w-full rounded border border-gray-300 text-sm text-right bg-white`,"data-testid":`accounting-entry-line-debit-${t}`,onInput:t=>P(e)},null,40,Xft),[[Fe,e.debit,void 0,{number:!0}]])]),S(`td`,Zft,[u(S(`input`,{"onUpdate:modelValue":t=>e.credit=t,type:`number`,step:ne.value,min:`0`,class:`h-8 px-2 w-full rounded border border-gray-300 text-sm text-right bg-white`,"data-testid":`accounting-entry-line-credit-${t}`,onInput:t=>F(e)},null,40,Qft),[[Fe,e.credit,void 0,{number:!0}]])]),R.value?(B(),U(`td`,$ft,[_(e)?(B(),U(D,{key:0},[u(S(`input`,{"onUpdate:modelValue":t=>e.taxRegistrationId=t,type:`text`,maxlength:hpt,placeholder:q(r)(`pluginAccounting.entryForm.taxRegistrationIdPlaceholder`),class:c([`h-8 px-2 w-full rounded border text-sm font-mono bg-white focus:outline-none`,g(e)?`border-red-500 ring-1 ring-red-500`:v(e)?`border-amber-500 ring-1 ring-amber-500`:`border-gray-300 focus:ring-1 focus:ring-blue-500`]),"data-testid":`accounting-entry-line-tax-registration-id-${t}`,"aria-describedby":v(e)?`accounting-entry-line-tax-registration-id-warning-${t}`:void 0},null,10,ept),[[Fe,e.taxRegistrationId]]),v(e)?(B(),U(`p`,{key:0,id:`accounting-entry-line-tax-registration-id-warning-${t}`,class:`text-xs text-amber-600 mt-1`,role:`status`,"aria-live":`polite`,"data-testid":`accounting-entry-line-tax-registration-id-warning-${t}`},T(q(r)(`pluginAccounting.entryForm.taxRegistrationIdMissingWarning`)),9,tpt)):b(``,!0)],64)):b(``,!0)])):b(``,!0),S(`td`,npt,[C.value.length>2?(B(),U(`button`,{key:0,type:`button`,class:`text-xs text-red-500 hover:underline`,onClick:e=>C.value.splice(t,1)},T(q(r)(`pluginAccounting.entryForm.removeLine`)),9,rpt)):b(``,!0)])]))),128))])]),S(`div`,ipt,[S(`div`,apt,[S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-entry-add-line`,onClick:N},[n[6]||=S(`span`,{class:`material-icons text-base`},`add`,-1),S(`span`,null,T(q(r)(`pluginAccounting.entryForm.addLine`)),1)]),S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-entry-manage-accounts`,onClick:n[2]||=e=>l.value=!0},[n[7]||=S(`span`,{class:`material-icons text-base`},`tune`,-1),S(`span`,null,T(q(r)(`pluginAccounting.accounts.manageButton`)),1)])]),S(`span`,{class:c([ee.value?`text-green-600`:`text-red-500`,`text-xs`]),"data-testid":`accounting-entry-balance`},T(ee.value?q(r)(`pluginAccounting.entryForm.balanced`):q(r)(`pluginAccounting.entryForm.imbalance`,{amount:te.value})),3)]),E.value?(B(),U(`p`,opt,T(E.value),1)):b(``,!0),O.value?(B(),U(`p`,spt,T(O.value),1)):b(``,!0),S(`div`,cpt,[k.value?(B(),U(`p`,lpt,T(q(r)(`pluginAccounting.entryForm.editBanner`)),1)):(B(),U(`span`,upt)),S(`div`,dpt,[S(`button`,{type:`button`,class:`h-8 px-3 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,disabled:w.value,"data-testid":`accounting-entry-cancel-edit`,onClick:n[3]||=e=>o(`cancel`)},T(q(r)(`pluginAccounting.common.cancel`)),9,fpt),S(`button`,{type:`submit`,class:`h-8 px-3 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm disabled:opacity-50`,disabled:!ee.value||w.value||M.value,"data-testid":`accounting-entry-submit`},T(A.value),9,ppt)])])],32),l.value?(B(),ke(DL,{key:0,"book-id":e.bookId,accounts:e.accounts,onClose:n[4]||=e=>l.value=!1},null,8,[`book-id`,`accounts`])):b(``,!0)],64))}}),OL=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},_pt=OL(gpt,[[`__scopeId`,`data-v-8624a7bf`]]),vpt={class:`flex flex-col h-full gap-3`},ypt={key:0,class:`border border-gray-200 rounded p-3`,"data-testid":`accounting-journal-inline-form`},bpt={key:1,class:`flex items-center justify-end`},xpt={class:`flex flex-wrap items-end gap-2`},Spt={class:`text-xs text-gray-500 flex flex-col gap-1`},Cpt={value:``},wpt=[`value`],Tpt={class:`flex-1 min-h-0 overflow-auto`},Ept={key:0,class:`text-xs text-gray-400`},Dpt={key:1,class:`text-xs text-red-500`},Opt={key:2,class:`text-xs text-gray-400`},kpt={key:3,class:`w-full text-sm`,"data-testid":`accounting-journal-table`},Apt={class:`text-xs text-gray-500 border-b border-gray-200`},jpt={class:`sticky top-0 bg-white text-left py-1 px-2`},Mpt={class:`sticky top-0 bg-white text-left py-1 px-2`},Npt={class:`sticky top-0 bg-white text-left py-1 px-2`},Ppt={class:`sticky top-0 bg-white text-left py-1 px-2`},Fpt=[`data-testid`,`aria-expanded`,`onClick`,`onKeydown`],Ipt={class:`py-1 px-2 whitespace-nowrap`},Lpt={class:`py-1 px-2 text-xs`},Rpt={class:`py-1 px-2`},zpt={key:0},Bpt={class:`py-1 px-2`},Vpt={class:`font-mono text-[10px] text-gray-400`},Hpt={key:0},Upt={key:1},Wpt={key:2},Gpt={key:1,class:`flex items-center justify-between gap-2`},Kpt={class:`text-xs text-gray-400 font-mono`},qpt=[`data-testid`,`aria-label`],Jpt=[`data-testid`],Ypt={colspan:4,class:`px-6 py-2`},Xpt=[`data-testid`],Zpt={class:`flex items-center gap-3 mb-2`},Qpt=[`data-testid`,`onClick`],$pt=[`data-testid`,`onClick`],emt=[`data-testid`],tmt={class:`w-full text-xs`},nmt={class:`text-gray-500 border-b border-gray-200`},rmt={class:`text-left py-1 px-2`},imt={class:`text-right py-1 px-2`},amt={class:`text-right py-1 px-2`},omt={class:`text-left py-1 px-2`},smt={key:0,class:`text-left py-1 px-2`},cmt={class:`py-1 px-2`},lmt={class:`font-mono text-[10px] text-gray-400 mr-2`},umt={key:0},dmt={class:`py-1 px-2 text-right font-mono`},fmt={class:`py-1 px-2 text-right font-mono`},pmt={class:`py-1 px-2`},mmt={key:0,class:`py-1 px-2 font-mono text-[10px]`},hmt={class:`font-semibold border-t border-gray-300 text-gray-700`},gmt={class:`py-1 px-2 text-gray-500`},_mt={class:`py-1 px-2 text-right font-mono`},vmt={class:`py-1 px-2 text-right font-mono`},ymt=[`colspan`],bmt=OL(K({__name:`JournalList`,props:{bookId:{},accounts:{},currency:{},country:{},version:{},fiscalYearEnd:{},openingDate:{},preselectEntryId:{}},emits:[`editOpening`,`preselectConsumed`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),a=e,o=t,d=V(!1),f=V(null),p=V(null);function h(){f.value=null,d.value=!0}function g(e){d.value=!1,f.value=e}function _(){d.value=!1,f.value=null}function v(){_(),p.value=null,W()}function y(){_()}Ve(()=>a.bookId,()=>{_(),p.value=null});let x=m(()=>aP(a.fiscalYearEnd)),C=V(sP(x.value)),w=V(``),E=V([]),O=V([]),k=V(!1),A=V(null),{begin:j,isCurrent:M}=CL();function N(e){return r(e===`opening`?`pluginAccounting.journalList.kind.opening`:e===`void`?`pluginAccounting.journalList.kind.void`:e===`void-marker`?`pluginAccounting.journalList.kind.voidMarker`:`pluginAccounting.journalList.kind.normal`)}function P(e){return`DR ${lP(e,a.currency)}`}function F(e){return`CR ${lP(e,a.currency)}`}function I(e){return`${e.name} (${e.code})`}function L(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return`(${e})`;let n=e=>String(e).padStart(2,`0`);return`(${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())})`}let R=m(()=>{let e=new Map;for(let t of a.accounts)e.set(t.code,t.name);return e});function z(e){return R.value.get(e)??null}function ee(){p.value=null,f.value=null}function te(e){f.value?.id!==e&&(p.value=p.value===e?null:e,f.value=null)}function ne(e,t){e.repeat||te(t)}function re(e){return e.lines.some(e=>!!e.taxRegistrationId)}function ie(e,t){return e.reduce((e,n)=>e+(t(n)??0),0)}function ae(e){return ie(e.lines,e=>e.debit)}function oe(e){return ie(e.lines,e=>e.credit)}async function W(){let e=j();k.value=!0,A.value=null;try{let t=await n.getJournalEntries({bookId:a.bookId,from:C.value.from||void 0,to:C.value.to||void 0,accountCode:w.value||void 0});if(!M(e))return;if(!t.ok){A.value=t.error,E.value=[],O.value=[];return}E.value=t.data.entries,O.value=t.data.voidedEntryIds}finally{M(e)&&(k.value=!1)}}let se=m(()=>E.value),ce=m(()=>{let e=se.value,t=f.value;return t&&!e.some(e=>e.id===t.id)?[t,...e]:e}),le=m(()=>new Set(O.value));async function ue(e){let t=window.prompt(r(`pluginAccounting.journalList.voidReason`));if(t!==null)try{let r=await n.voidEntry({entryId:e.id,reason:t||void 0,bookId:a.bookId});r.ok||(A.value=r.error)}catch(e){A.value=rP(e)}}Ve(()=>[a.bookId,x.value],()=>{C.value=sP(x.value)}),Ve(()=>[a.bookId,a.version,C.value.from,C.value.to,w.value],W,{immediate:!0});let de=V(null);return Ve(()=>a.preselectEntryId,e=>{e&&(de.value=e)},{immediate:!0}),Ve([de,E],async([e,t])=>{if(e&&t.some(t=>t.id===e)){if(f.value){de.value=null,o(`preselectConsumed`);return}p.value=e,await be(),(document.querySelector(`[data-testid="accounting-journal-row-${e}"]`)??document.querySelector(`[data-testid="accounting-journal-row-voided-${e}"]`))?.scrollIntoView({behavior:`smooth`,block:`center`}),de.value=null,o(`preselectConsumed`)}}),(t,n)=>(B(),U(`div`,vpt,[d.value?(B(),U(`div`,ypt,[De(_pt,{"book-id":e.bookId,accounts:e.accounts,currency:e.currency,country:e.country,"entry-to-edit":null,onSubmitted:v,onCancel:y},null,8,[`book-id`,`accounts`,`currency`,`country`])])):(B(),U(`div`,bpt,[S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-journal-new-entry`,onClick:h},[n[3]||=S(`span`,{class:`material-icons text-base`},`add`,-1),S(`span`,null,T(q(r)(`pluginAccounting.tabs.newEntry`)),1)])])),S(`div`,xpt,[De(wL,{modelValue:C.value,"onUpdate:modelValue":n[0]||=e=>C.value=e,"fiscal-year-end":x.value,"opening-date":e.openingDate},null,8,[`modelValue`,`fiscal-year-end`,`opening-date`]),S(`label`,Spt,[J(T(q(r)(`pluginAccounting.journalList.accountLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[1]||=e=>w.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-journal-account`},[S(`option`,Cpt,T(q(r)(`pluginAccounting.journalList.allAccounts`)),1),(B(!0),U(D,null,H(e.accounts,e=>(B(),U(`option`,{key:e.code,value:e.code},T(I(e)),9,wpt))),128))],512),[[i,w.value]])]),S(`button`,{class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,onClick:W},[...n[4]||=[S(`span`,{class:`material-icons text-base align-middle`},`refresh`,-1)]])]),S(`div`,Tpt,[k.value?(B(),U(`p`,Ept,T(q(r)(`pluginAccounting.common.loading`)),1)):A.value?(B(),U(`p`,Dpt,T(q(r)(`pluginAccounting.common.error`,{error:A.value})),1)):ce.value.length===0?(B(),U(`p`,Opt,T(q(r)(`pluginAccounting.common.empty`)),1)):(B(),U(`table`,kpt,[S(`thead`,null,[S(`tr`,Apt,[S(`th`,jpt,T(q(r)(`pluginAccounting.journalList.columns.date`)),1),S(`th`,Mpt,T(q(r)(`pluginAccounting.journalList.columns.kind`)),1),S(`th`,Npt,T(q(r)(`pluginAccounting.journalList.columns.memo`)),1),S(`th`,Ppt,T(q(r)(`pluginAccounting.journalList.columns.lines`)),1)])]),S(`tbody`,null,[(B(!0),U(D,null,H(ce.value,t=>(B(),U(D,{key:t.id},[S(`tr`,{class:c([le.value.has(t.id)?`text-gray-400 line-through`:``,p.value===t.id?`row-selected`:``,`border-b border-gray-100 align-top cursor-pointer hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400`]),"data-testid":le.value.has(t.id)?`accounting-journal-row-voided-${t.id}`:`accounting-journal-row-${t.id}`,tabindex:`0`,role:`button`,"aria-expanded":p.value===t.id,onClick:e=>te(t.id),onKeydown:[l(s(e=>ne(e,t.id),[`prevent`,`self`]),[`enter`]),l(s(e=>ne(e,t.id),[`prevent`,`self`]),[`space`])]},[S(`td`,Ipt,T(t.date),1),S(`td`,Lpt,T(N(t.kind)),1),S(`td`,Rpt,[t.memo?(B(),U(`span`,zpt,T(t.memo),1)):b(``,!0)]),S(`td`,Bpt,[p.value===t.id?(B(),U(`div`,Gpt,[S(`span`,Kpt,T(L(t.createdAt)),1),S(`button`,{type:`button`,class:`h-6 w-6 flex items-center justify-center rounded text-gray-500 hover:bg-gray-100`,"data-testid":`accounting-journal-detail-close-${t.id}`,"aria-label":q(r)(`common.close`),onClick:s(ee,[`stop`])},[...n[5]||=[S(`span`,{class:`material-icons text-base`},`close`,-1)]],8,qpt)])):(B(!0),U(D,{key:0},H(t.lines,(e,t)=>(B(),U(`div`,{key:t,class:`text-xs flex gap-2 items-baseline`},[S(`span`,Vpt,T(e.accountCode),1),z(e.accountCode)?(B(),U(`span`,Hpt,T(z(e.accountCode)),1)):b(``,!0),e.debit?(B(),U(`span`,Upt,T(P(e.debit)),1)):b(``,!0),e.credit?(B(),U(`span`,Wpt,T(F(e.credit)),1)):b(``,!0)]))),128))])],42,Fpt),p.value===t.id?(B(),U(`tr`,{key:0,class:`bg-gray-50 detail-selected`,"data-testid":`accounting-journal-detail-${t.id}`},[S(`td`,Ypt,[f.value?.id===t.id?(B(),U(`div`,{key:0,"data-testid":`accounting-journal-detail-edit-${t.id}`},[De(_pt,{"book-id":e.bookId,accounts:e.accounts,currency:e.currency,country:e.country,"entry-to-edit":f.value,onSubmitted:v,onCancel:y},null,8,[`book-id`,`accounts`,`currency`,`country`,`entry-to-edit`])],8,Xpt)):(B(),U(D,{key:1},[S(`div`,Zpt,[t.kind===`normal`&&!le.value.has(t.id)?(B(),U(D,{key:0},[S(`button`,{class:`text-xs text-blue-600 hover:underline`,"data-testid":`accounting-edit-${t.id}`,onClick:e=>g(t)},T(q(r)(`pluginAccounting.journalList.edit`)),9,Qpt),S(`button`,{class:`text-xs text-red-500 hover:underline`,"data-testid":`accounting-void-${t.id}`,onClick:e=>ue(t)},T(q(r)(`pluginAccounting.journalList.void`)),9,$pt)],64)):t.kind===`opening`&&!le.value.has(t.id)?(B(),U(`button`,{key:1,class:`text-xs text-blue-600 hover:underline`,"data-testid":`accounting-edit-opening-${t.id}`,onClick:n[2]||=e=>o(`editOpening`)},T(q(r)(`pluginAccounting.journalList.edit`)),9,emt)):b(``,!0)]),S(`table`,tmt,[S(`thead`,null,[S(`tr`,nmt,[S(`th`,rmt,T(q(r)(`pluginAccounting.entryForm.accountLabel`)),1),S(`th`,imt,T(q(r)(`pluginAccounting.entryForm.debitLabel`)),1),S(`th`,amt,T(q(r)(`pluginAccounting.entryForm.creditLabel`)),1),S(`th`,omt,T(q(r)(`pluginAccounting.entryForm.memoLabel`)),1),re(t)?(B(),U(`th`,smt,T(q(r)(`pluginAccounting.entryForm.taxRegistrationIdLabel`)),1)):b(``,!0)])]),S(`tbody`,null,[(B(!0),U(D,null,H(t.lines,(n,r)=>(B(),U(`tr`,{key:r,class:`border-b border-gray-100 text-gray-700`},[S(`td`,cmt,[S(`span`,lmt,T(n.accountCode),1),z(n.accountCode)?(B(),U(`span`,umt,T(z(n.accountCode)),1)):b(``,!0)]),S(`td`,dmt,[n.debit?(B(),U(D,{key:0},[J(T(q(lP)(n.debit,e.currency)),1)],64)):b(``,!0)]),S(`td`,fmt,[n.credit?(B(),U(D,{key:0},[J(T(q(lP)(n.credit,e.currency)),1)],64)):b(``,!0)]),S(`td`,pmt,[n.memo?(B(),U(D,{key:0},[J(T(n.memo),1)],64)):b(``,!0)]),re(t)?(B(),U(`td`,mmt,[n.taxRegistrationId?(B(),U(D,{key:0},[J(T(n.taxRegistrationId),1)],64)):b(``,!0)])):b(``,!0)]))),128))]),S(`tfoot`,null,[S(`tr`,hmt,[S(`td`,gmt,T(q(r)(`pluginAccounting.balanceSheet.total`)),1),S(`td`,_mt,T(q(lP)(ae(t),e.currency)),1),S(`td`,vmt,T(q(lP)(oe(t),e.currency)),1),S(`td`,{colspan:re(t)?2:1},null,8,ymt)])])])],64))])],8,Jpt)):b(``,!0)],64))),128))])]))])]))}}),[[`__scopeId`,`data-v-6d11cf47`]]),xmt={class:`flex items-center justify-between gap-2`},Smt={class:`text-base font-semibold`},Cmt={class:`text-xs text-gray-500`},wmt={class:`text-xs text-blue-600`,"data-testid":`accounting-opening-empty-hint`},Tmt={key:0,class:`text-xs text-gray-500`,"data-testid":`accounting-opening-existing`},Emt={key:0,class:`text-amber-600 ml-2`},Dmt={key:1,class:`text-xs text-gray-400`,"data-testid":`accounting-opening-none`},Omt={class:`text-xs text-gray-500 flex flex-col gap-1 w-fit`},kmt={class:`w-full text-sm`},Amt={class:`text-xs text-gray-500 border-b border-gray-200`},jmt={class:`text-left py-1 px-2`},Mmt={class:`text-right py-1 px-2 w-32`},Nmt={class:`text-right py-1 px-2 w-32`},Pmt={class:`py-1 px-2`},Fmt={class:`font-mono text-[10px] text-gray-400 mr-2`},Imt={class:`ml-2 text-xs text-gray-400`},Lmt={class:`py-1 px-2`},Rmt=[`onUpdate:modelValue`,`step`,`data-testid`,`onInput`],zmt={class:`py-1 px-2`},Bmt=[`onUpdate:modelValue`,`step`,`data-testid`,`onInput`],Vmt={class:`flex items-center justify-between`},Hmt={class:`text-xs text-gray-400`},Umt={key:2,class:`text-xs text-red-500`,"data-testid":`accounting-opening-error`},Wmt={key:3,class:`text-xs text-green-600`,"data-testid":`accounting-opening-success`},Gmt={class:`flex justify-end`},Kmt=[`disabled`],qmt=OL(K({__name:`OpeningBalancesForm`,props:{bookId:{},accounts:{},currency:{},version:{}},emits:[`submitted`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),i=e,a=t,o=V(!1),l=V(dP()),d=V({}),f=V(null),p=V(!1),h=V(null),g=V(null),{begin:_,isCurrent:v}=CL(),y=m(()=>i.accounts.filter(e=>(e.type===`asset`||e.type===`liability`||e.type===`equity`)&&e.active!==!1));function x(){for(let e of y.value)d.value[e.code]||(d.value[e.code]={debit:null,credit:null})}let C=m(()=>y.value.flatMap(e=>{let t=d.value[e.code];return t?[{account:e,row:t}]:[]}));function w(e){let t=d.value[e];t&&t.debit!==null&&t.debit!==0&&(t.credit=null)}function E(e){let t=d.value[e];t&&t.credit!==null&&t.credit!==0&&(t.debit=null)}let O=m(()=>{let e=0;for(let t of y.value){let n=d.value[t.code];n&&(typeof n.debit==`number`&&(e+=n.debit),typeof n.credit==`number`&&(e-=n.credit))}return e}),k=m(()=>Math.abs(O.value)<=.005),A=m(()=>lP(O.value,i.currency)),j=m(()=>O9e(i.currency));function M(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function N(){let e=[];for(let t of y.value){let n=d.value[t.code];if(!n)continue;let{debit:r,credit:i}=n,a=M(r),o=M(i);if(!a&&!o)continue;let s={accountCode:t.code};a&&(s.debit=r),o&&(s.credit=i),e.push(s)}return e}function P(){let e={};for(let t of y.value)e[t.code]={debit:null,credit:null};return e}async function F(){let e=_(),t=P(),r=await n.getOpeningBalances(i.bookId);if(v(e)){if(!r.ok){f.value=null,d.value=t;return}if(f.value=r.data.opening,r.data.opening){l.value=r.data.opening.date;for(let e of r.data.opening.lines)t[e.accountCode]={debit:e.debit??null,credit:e.credit??null}}else l.value=dP();d.value=t}}async function I(){if(!p.value&&k.value){p.value=!0,h.value=null,g.value=null;try{let e=await n.setOpeningBalances({bookId:i.bookId,asOfDate:l.value,lines:N()});if(!e.ok){h.value=e.error;return}g.value=r(`pluginAccounting.openingForm.success`),a(`submitted`)}catch(e){h.value=rP(e)}finally{p.value=!1}}}return Ve(()=>[i.bookId,i.version,i.accounts.length],()=>{x(),F()},{immediate:!0}),(t,n)=>(B(),U(D,null,[S(`form`,{class:`flex flex-col gap-3`,"data-testid":`accounting-opening-form`,onSubmit:s(I,[`prevent`])},[S(`div`,xmt,[S(`h3`,Smt,T(q(r)(`pluginAccounting.openingForm.title`)),1),S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-opening-manage-accounts`,onClick:n[0]||=e=>o.value=!0},[n[3]||=S(`span`,{class:`material-icons text-base`},`tune`,-1),S(`span`,null,T(q(r)(`pluginAccounting.accounts.manageButton`)),1)])]),S(`p`,Cmt,T(q(r)(`pluginAccounting.openingForm.explainer`)),1),S(`p`,wmt,T(q(r)(`pluginAccounting.openingForm.emptyHint`)),1),f.value?(B(),U(`div`,Tmt,[J(T(q(r)(`pluginAccounting.openingForm.setBy`,{date:f.value.date}))+` `,1),f.value?(B(),U(`span`,Emt,T(q(r)(`pluginAccounting.openingForm.replaceWarning`)),1)):b(``,!0)])):(B(),U(`p`,Dmt,T(q(r)(`pluginAccounting.openingForm.none`)),1)),S(`label`,Omt,[J(T(q(r)(`pluginAccounting.openingForm.asOfLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[1]||=e=>l.value=e,type:`date`,required:``,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-opening-asof`},null,512),[[Fe,l.value]])]),S(`table`,kmt,[S(`thead`,null,[S(`tr`,Amt,[S(`th`,jmt,T(q(r)(`pluginAccounting.entryForm.accountLabel`)),1),S(`th`,Mmt,T(q(r)(`pluginAccounting.entryForm.debitLabel`)),1),S(`th`,Nmt,T(q(r)(`pluginAccounting.entryForm.creditLabel`)),1)])]),S(`tbody`,null,[(B(!0),U(D,null,H(C.value,({account:e,row:t})=>(B(),U(`tr`,{key:e.code,class:`border-b border-gray-100`},[S(`td`,Pmt,[S(`span`,Fmt,T(e.code),1),S(`span`,null,T(e.name),1),S(`span`,Imt,T(e.type),1)]),S(`td`,Lmt,[u(S(`input`,{"onUpdate:modelValue":e=>t.debit=e,type:`number`,step:j.value,min:`0`,class:`h-8 px-2 w-full rounded border border-gray-300 text-sm text-right`,"data-testid":`accounting-opening-debit-${e.code}`,onInput:t=>w(e.code)},null,40,Rmt),[[Fe,t.debit,void 0,{number:!0}]])]),S(`td`,zmt,[u(S(`input`,{"onUpdate:modelValue":e=>t.credit=e,type:`number`,step:j.value,min:`0`,class:`h-8 px-2 w-full rounded border border-gray-300 text-sm text-right`,"data-testid":`accounting-opening-credit-${e.code}`,onInput:t=>E(e.code)},null,40,Bmt),[[Fe,t.credit,void 0,{number:!0}]])])]))),128))])]),S(`div`,Vmt,[S(`span`,Hmt,T(q(r)(`pluginAccounting.openingForm.explainer2`)),1),S(`span`,{class:c([k.value?`text-green-600`:`text-red-500`,`text-xs`]),"data-testid":`accounting-opening-balance`},T(k.value?q(r)(`pluginAccounting.entryForm.balanced`):q(r)(`pluginAccounting.entryForm.imbalance`,{amount:A.value})),3)]),h.value?(B(),U(`p`,Umt,T(h.value),1)):b(``,!0),g.value?(B(),U(`p`,Wmt,T(g.value),1)):b(``,!0),S(`div`,Gmt,[S(`button`,{type:`submit`,class:`h-8 px-3 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm disabled:opacity-50`,disabled:!k.value||p.value,"data-testid":`accounting-opening-submit`},T(p.value?q(r)(`pluginAccounting.entryForm.submitting`):q(r)(`pluginAccounting.openingForm.submit`)),9,Kmt)])],32),o.value?(B(),ke(DL,{key:0,"book-id":e.bookId,accounts:e.accounts,onClose:n[2]||=e=>o.value=!1},null,8,[`book-id`,`accounts`])):b(``,!0)],64))}}),[[`__scopeId`,`data-v-08e2a48f`]]),Jmt={class:`flex flex-col gap-3`,"data-testid":`accounting-accounts-list`},Ymt={class:`flex flex-wrap items-center justify-end gap-2`},Xmt={class:`text-xs font-semibold text-gray-500 uppercase tracking-wide`},Zmt={key:0,class:`text-xs text-gray-400 italic px-1`},Qmt={key:1,class:`flex flex-col`},$mt=[`aria-label`,`data-testid`,`onClick`,`onKeydown`],eht={class:`font-mono text-xs w-16 shrink-0`},tht={class:`text-sm flex-1 min-w-0 truncate`},nht=K({__name:`AccountsList`,props:{bookId:{},accounts:{}},emits:[`selectAccount`,`changed`],setup(e,{emit:t}){let{t:n}=xL(),r=e,i=t,a=[`asset`,`liability`,`equity`,`income`,`expense`],o=V(!1);function c(e,t){return e.code.localeCompare(t.code)}let u=m(()=>a.map(e=>({type:e,accounts:r.accounts.filter(t=>t.type===e&&t.active!==!1).slice().sort(c)})));function d(e){i(`selectAccount`,e.code)}function f(e,t){e.repeat||i(`selectAccount`,t.code)}function p(){i(`changed`)}return(t,r)=>(B(),U(`div`,Jmt,[S(`div`,Ymt,[S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-accounts-manage`,onClick:r[0]||=e=>o.value=!0},[r[2]||=S(`span`,{class:`material-icons text-base`},`tune`,-1),S(`span`,null,T(q(n)(`pluginAccounting.accounts.manageButton`)),1)])]),(B(!0),U(D,null,H(u.value,e=>(B(),U(`section`,{key:e.type,class:`flex flex-col gap-1`},[S(`h4`,Xmt,T(q(n)(`pluginAccounting.accounts.sectionTitle.${e.type}`)),1),e.accounts.length===0?(B(),U(`p`,Zmt,T(q(n)(`pluginAccounting.accounts.listEmpty`)),1)):(B(),U(`ul`,Qmt,[(B(!0),U(D,null,H(e.accounts,e=>(B(),U(`li`,{key:e.code,tabindex:`0`,role:`button`,"aria-label":q(n)(`pluginAccounting.accounts.openLedgerAria`,{code:e.code,name:e.name}),class:`flex items-center gap-3 px-2 py-1.5 border-b border-gray-100 hover:bg-blue-50 cursor-pointer text-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 rounded`,"data-testid":`accounting-account-row-${e.code}`,onClick:t=>d(e),onKeydown:[l(s(t=>f(t,e),[`prevent`,`self`]),[`enter`]),l(s(t=>f(t,e),[`prevent`,`self`]),[`space`])]},[S(`span`,eht,T(e.code),1),S(`span`,tht,T(e.name),1)],40,$mt))),128))]))]))),128)),o.value?(B(),ke(DL,{key:0,"book-id":e.bookId,accounts:e.accounts,onClose:r[1]||=e=>o.value=!1,onChanged:p},null,8,[`book-id`,`accounts`])):b(``,!0)]))}}),rht={class:`flex flex-col gap-3`,"data-testid":`accounting-ledger`},iht={class:`flex flex-wrap items-end gap-3`},aht={class:`text-xs text-gray-500 flex flex-col gap-1`},oht=[`value`],sht={key:0,class:`text-xs text-gray-400`},cht={key:1,class:`text-xs text-red-500`},lht=[`data-testid`],uht={class:`text-xs text-gray-500 border-b border-gray-200`},dht={class:`text-left py-1 px-2`},fht={class:`text-left py-1 px-2`},pht={key:0,class:`text-left py-1 px-2 w-40`},mht={class:`text-right py-1 px-2 w-28`},hht={class:`text-right py-1 px-2 w-28`},ght={class:`text-right py-1 px-2 w-28`},_ht={class:`py-1 px-2 whitespace-nowrap`},vht={class:`py-1 px-2`},yht={key:0},bht={key:0,class:`py-1 px-2 font-mono text-xs`},xht={key:0},Sht={class:`py-1 px-2 text-right`},Cht={key:0},wht={class:`py-1 px-2 text-right`},Tht={key:0},Eht={class:`py-1 px-2 text-right font-mono`},Dht={class:`font-semibold border-t border-gray-300`},Oht=[`colspan`],kht={class:`py-1 px-2 text-right`},Aht=`—`,jht=K({__name:`Ledger`,props:{bookId:{},accounts:{},currency:{},version:{},fiscalYearEnd:{},openingDate:{},preselectAccountCode:{}},setup(e){let t=SL(),{t:n}=xL(),r=e,a=V(``),o=V(null),s=V(!1),l=V(null),{begin:d,isCurrent:f}=CL(),p=m(()=>aP(r.fiscalYearEnd)),h=V(sP(p.value));function g(e){return lP(e,r.currency)}function _(e){return`${e.name} (${e.code})`}let v=m(()=>r.accounts.filter(e=>e.active!==!1)),y=m(()=>o.value?Ydt(o.value.accountCode):!1);function x(e){if(e.from!==``||e.to!==``)return{kind:`range`,from:e.from||`0000-01-01`,to:e.to||`9999-12-31`}}async function C(){let e=d();if(!a.value){o.value=null,l.value=null,s.value=!1;return}s.value=!0,l.value=null;try{let n=await t.getLedger(a.value,x(h.value),r.bookId);if(!f(e))return;if(!n.ok){l.value=n.error,o.value=null;return}o.value=n.data.ledger}finally{f(e)&&(s.value=!1)}}return Ve(()=>[r.bookId,p.value],()=>{a.value=``,h.value=sP(p.value)}),Ve(()=>r.preselectAccountCode,e=>{e&&(a.value=e,h.value=sP(p.value))},{immediate:!0}),Ve(()=>[r.bookId,r.version,a.value,h.value.from,h.value.to],C,{immediate:!0}),(t,r)=>(B(),U(`div`,rht,[S(`div`,iht,[S(`label`,aht,[J(T(q(n)(`pluginAccounting.ledger.selectAccount`))+` `,1),u(S(`select`,{"onUpdate:modelValue":r[0]||=e=>a.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-ledger-account`},[S(`option`,{value:``},T(Aht)),(B(!0),U(D,null,H(v.value,e=>(B(),U(`option`,{key:e.code,value:e.code},T(_(e)),9,oht))),128))],512),[[i,a.value]])]),De(wL,{modelValue:h.value,"onUpdate:modelValue":r[1]||=e=>h.value=e,"fiscal-year-end":p.value,"opening-date":e.openingDate},null,8,[`modelValue`,`fiscal-year-end`,`opening-date`]),S(`button`,{class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,onClick:C},[...r[2]||=[S(`span`,{class:`material-icons text-base align-middle`},`refresh`,-1)]])]),s.value?(B(),U(`p`,sht,T(q(n)(`pluginAccounting.common.loading`)),1)):l.value?(B(),U(`p`,cht,T(q(n)(`pluginAccounting.common.error`,{error:l.value})),1)):o.value?(B(),U(`table`,{key:2,class:`w-full text-sm`,"data-testid":y.value?`accounting-ledger-table-with-tax-id`:`accounting-ledger-table`},[S(`thead`,null,[S(`tr`,uht,[S(`th`,dht,T(q(n)(`pluginAccounting.ledger.columns.date`)),1),S(`th`,fht,T(q(n)(`pluginAccounting.ledger.columns.memo`)),1),y.value?(B(),U(`th`,pht,T(q(n)(`pluginAccounting.ledger.columns.taxRegistrationId`)),1)):b(``,!0),S(`th`,mht,T(q(n)(`pluginAccounting.ledger.columns.debit`)),1),S(`th`,hht,T(q(n)(`pluginAccounting.ledger.columns.credit`)),1),S(`th`,ght,T(q(n)(`pluginAccounting.ledger.columns.balance`)),1)])]),S(`tbody`,null,[(B(!0),U(D,null,H(o.value.rows,e=>(B(),U(`tr`,{key:`${e.entryId}-${e.date}`,class:c([e.kind===`void`||e.kind===`void-marker`?`text-gray-400 line-through`:``,`border-b border-gray-100`])},[S(`td`,_ht,T(e.date),1),S(`td`,vht,[e.memo?(B(),U(`span`,yht,T(e.memo),1)):b(``,!0)]),y.value?(B(),U(`td`,bht,[e.taxRegistrationId?(B(),U(`span`,xht,T(e.taxRegistrationId),1)):b(``,!0)])):b(``,!0),S(`td`,Sht,[e.debit?(B(),U(`span`,Cht,T(g(e.debit)),1)):b(``,!0)]),S(`td`,wht,[e.credit?(B(),U(`span`,Tht,T(g(e.credit)),1)):b(``,!0)]),S(`td`,Eht,T(g(e.runningBalance)),1)],2))),128))]),S(`tfoot`,null,[S(`tr`,Dht,[S(`td`,{colspan:y.value?5:4,class:`py-1 px-2 text-right`},T(q(n)(`pluginAccounting.ledger.closingBalance`)),9,Oht),S(`td`,kht,T(g(o.value.closingBalance)),1)])])],8,lht)):b(``,!0)]))}}),Mht={class:`flex flex-col gap-3`,"data-testid":`accounting-balance-sheet`},Nht={class:`flex flex-wrap items-end gap-3`},Pht={class:`text-xs text-gray-500 flex flex-col gap-1`},Fht=[`value`],Iht={value:`thisMonth`},Lht={value:`lastMonth`},Rht={value:`lastQuarter`},zht={value:`lastYear`},Bht={class:`text-xs text-gray-500 flex flex-col gap-1`},Vht={key:0,class:`text-xs text-gray-400`},Hht={key:1,class:`text-xs text-red-500`},Uht={class:`grid grid-cols-1 md:grid-cols-2 gap-4`},Wht={class:`text-sm font-semibold mb-2`},Ght={class:`w-full text-sm`},Kht=[`tabindex`,`role`,`aria-label`,`data-testid`,`onClick`,`onKeydown`],qht={class:`py-1 px-1`},Jht={key:0,class:`font-mono text-[10px] text-gray-400 mr-2`},Yht={class:`py-1 px-1 text-right font-mono`},Xht={class:`font-semibold border-t border-gray-300`},Zht={class:`py-1 px-1`},Qht={class:`py-1 px-1 text-right`},$ht=`_currentEarnings`,egt=K({__name:`BalanceSheet`,props:{bookId:{},currency:{},version:{}},emits:[`selectAccount`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),i=e,a=t,o=V(fP()),d=V(null),f=V(!1),p=V(null),{begin:h,isCurrent:g}=CL();function _(e){return lP(e,i.currency)}function v(e){return e===`asset`?r(`pluginAccounting.balanceSheet.sections.asset`):e===`liability`?r(`pluginAccounting.balanceSheet.sections.liability`):e===`equity`?r(`pluginAccounting.balanceSheet.sections.equity`):e}function y(e){return e.accountCode===$ht}function x(e){return y(e)?r(`pluginAccounting.balanceSheet.currentEarnings`):e.accountName}function C(e){y(e)||a(`selectAccount`,e.accountCode)}function w(e,t){e.repeat||y(t)||a(`selectAccount`,t.accountCode)}let E=m(()=>{let{value:e}=o,t=new Date;return e===fP(t)?`thisMonth`:e===A9e(t)?`lastMonth`:e===j9e(t)?`lastQuarter`:e===M9e(t)?`lastYear`:``});function O(e){let{target:t}=e;if(!(t instanceof HTMLSelectElement))return;let n=t.value,r=new Date;n===`thisMonth`?o.value=fP(r):n===`lastMonth`?o.value=A9e(r):n===`lastQuarter`?o.value=j9e(r):n===`lastYear`&&(o.value=M9e(r))}async function k(){let e=h();f.value=!0,p.value=null;try{let t=await n.getBalanceSheet({kind:`month`,period:o.value},i.bookId);if(!g(e))return;if(!t.ok){p.value=t.error,d.value=null;return}d.value=t.data.balanceSheet}finally{g(e)&&(f.value=!1)}}return Ve(()=>[i.bookId,i.version,o.value],k,{immediate:!0}),(e,t)=>(B(),U(`div`,Mht,[S(`div`,Nht,[S(`label`,Pht,[J(T(q(r)(`pluginAccounting.balanceSheet.shortcutLabel`))+` `,1),S(`select`,{value:E.value,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-bs-shortcut`,onChange:O},[t[1]||=S(`option`,{value:``,hidden:``},null,-1),S(`option`,Iht,T(q(r)(`pluginAccounting.balanceSheet.thisMonth`)),1),S(`option`,Lht,T(q(r)(`pluginAccounting.balanceSheet.lastMonth`)),1),S(`option`,Rht,T(q(r)(`pluginAccounting.balanceSheet.lastQuarter`)),1),S(`option`,zht,T(q(r)(`pluginAccounting.balanceSheet.lastYear`)),1)],40,Fht)]),S(`label`,Bht,[J(T(q(r)(`pluginAccounting.balanceSheet.asOfLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":t[0]||=e=>o.value=e,type:`month`,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-bs-period`},null,512),[[Fe,o.value]])]),S(`button`,{class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,onClick:k},[...t[2]||=[S(`span`,{class:`material-icons text-base align-middle`},`refresh`,-1)]])]),f.value?(B(),U(`p`,Vht,T(q(r)(`pluginAccounting.common.loading`)),1)):p.value?(B(),U(`p`,Hht,T(q(r)(`pluginAccounting.common.error`,{error:p.value})),1)):d.value?(B(),U(D,{key:2},[S(`div`,Uht,[(B(!0),U(D,null,H(d.value.sections,e=>(B(),U(`section`,{key:e.type,class:`border border-gray-200 rounded p-3`},[S(`h4`,Wht,T(v(e.type)),1),S(`table`,Ght,[S(`tbody`,null,[(B(!0),U(D,null,H(e.rows,e=>(B(),U(`tr`,{key:e.accountCode,class:c([`border-b border-gray-100`,y(e)?`italic text-gray-600`:`hover:bg-blue-50 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400`]),tabindex:y(e)?-1:0,role:y(e)?void 0:`button`,"aria-label":y(e)?void 0:q(r)(`pluginAccounting.accounts.openLedgerAria`,{code:e.accountCode,name:e.accountName}),"data-testid":y(e)?void 0:`accounting-bs-row-${e.accountCode}`,onClick:t=>C(e),onKeydown:[l(s(t=>w(t,e),[`prevent`,`self`]),[`enter`]),l(s(t=>w(t,e),[`prevent`,`self`]),[`space`])]},[S(`td`,qht,[y(e)?b(``,!0):(B(),U(`span`,Jht,T(e.accountCode),1)),J(T(x(e)),1)]),S(`td`,Yht,T(_(e.balance)),1)],42,Kht))),128))]),S(`tfoot`,null,[S(`tr`,Xht,[S(`td`,Zht,T(q(r)(`pluginAccounting.balanceSheet.total`)),1),S(`td`,Qht,T(_(e.total)),1)])])])]))),128))]),S(`p`,{class:c([Math.abs(d.value.imbalance)<=.01?`text-green-600`:`text-red-500`,`text-xs`]),"data-testid":`accounting-bs-imbalance`},T(q(r)(`pluginAccounting.balanceSheet.imbalance`,{amount:_(d.value.imbalance)})),3)],64)):b(``,!0)]))}}),tgt={class:`flex flex-col gap-3`,"data-testid":`accounting-profit-loss`},ngt={class:`flex flex-wrap items-end gap-3`},rgt={key:0,class:`text-xs text-gray-400`},igt={key:1,class:`text-xs text-red-500`},agt={class:`border border-gray-200 rounded p-3`},ogt={class:`text-sm font-semibold mb-2`},sgt={class:`w-full text-sm`},cgt=[`aria-label`,`data-testid`,`onClick`,`onKeydown`],lgt={class:`py-1 px-1`},ugt={class:`font-mono text-[10px] text-gray-400 mr-2`},dgt={class:`py-1 px-1 text-right font-mono`},fgt={class:`font-semibold border-t border-gray-300`},pgt={class:`py-1 px-1`},mgt={class:`py-1 px-1 text-right`},hgt={class:`border border-gray-200 rounded p-3`},ggt={class:`text-sm font-semibold mb-2`},_gt={class:`w-full text-sm`},vgt=[`aria-label`,`data-testid`,`onClick`,`onKeydown`],ygt={class:`py-1 px-1`},bgt={class:`font-mono text-[10px] text-gray-400 mr-2`},xgt={class:`py-1 px-1 text-right font-mono`},Sgt={class:`font-semibold border-t border-gray-300`},Cgt={class:`py-1 px-1`},wgt={class:`py-1 px-1 text-right`},Tgt={class:`flex justify-end items-center gap-2 text-sm font-semibold`,"data-testid":`accounting-pl-net`},Egt=K({__name:`ProfitLoss`,props:{bookId:{},currency:{},version:{},fiscalYearEnd:{},openingDate:{}},emits:[`selectAccount`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),i=e,a=t,o=m(()=>aP(i.fiscalYearEnd));function u(e){a(`selectAccount`,e)}function d(e,t){e.repeat||a(`selectAccount`,t)}let f=V(sP(o.value)),p=V(null),h=V(!1),g=V(null),{begin:_,isCurrent:v}=CL();function y(e){return lP(e,i.currency)}async function x(){let e=_();h.value=!0,g.value=null;try{let t=f.value.from||`0000-01-01`,r=f.value.to||`9999-12-31`,a=await n.getProfitLoss({kind:`range`,from:t,to:r},i.bookId);if(!v(e))return;if(!a.ok){g.value=a.error,p.value=null;return}p.value=a.data.profitLoss}finally{v(e)&&(h.value=!1)}}return Ve(()=>[i.bookId,o.value],()=>{f.value=sP(o.value)}),Ve(()=>[i.bookId,i.version,f.value.from,f.value.to],x,{immediate:!0}),(t,n)=>(B(),U(`div`,tgt,[S(`div`,ngt,[De(wL,{modelValue:f.value,"onUpdate:modelValue":n[0]||=e=>f.value=e,"fiscal-year-end":o.value,"opening-date":e.openingDate},null,8,[`modelValue`,`fiscal-year-end`,`opening-date`]),S(`button`,{class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,onClick:x},[...n[1]||=[S(`span`,{class:`material-icons text-base align-middle`},`refresh`,-1)]])]),h.value?(B(),U(`p`,rgt,T(q(r)(`pluginAccounting.common.loading`)),1)):g.value?(B(),U(`p`,igt,T(q(r)(`pluginAccounting.common.error`,{error:g.value})),1)):p.value?(B(),U(D,{key:2},[S(`section`,agt,[S(`h4`,ogt,T(q(r)(`pluginAccounting.profitLoss.income`)),1),S(`table`,sgt,[S(`tbody`,null,[(B(!0),U(D,null,H(p.value.income.rows,e=>(B(),U(`tr`,{key:e.accountCode,class:`border-b border-gray-100 hover:bg-blue-50 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400`,tabindex:`0`,role:`button`,"aria-label":q(r)(`pluginAccounting.accounts.openLedgerAria`,{code:e.accountCode,name:e.accountName}),"data-testid":`accounting-pl-row-${e.accountCode}`,onClick:t=>u(e.accountCode),onKeydown:[l(s(t=>d(t,e.accountCode),[`prevent`,`self`]),[`enter`]),l(s(t=>d(t,e.accountCode),[`prevent`,`self`]),[`space`])]},[S(`td`,lgt,[S(`span`,ugt,T(e.accountCode),1),J(T(e.accountName),1)]),S(`td`,dgt,T(y(e.amount)),1)],40,cgt))),128))]),S(`tfoot`,null,[S(`tr`,fgt,[S(`td`,pgt,T(q(r)(`pluginAccounting.balanceSheet.total`)),1),S(`td`,mgt,T(y(p.value.income.total)),1)])])])]),S(`section`,hgt,[S(`h4`,ggt,T(q(r)(`pluginAccounting.profitLoss.expense`)),1),S(`table`,_gt,[S(`tbody`,null,[(B(!0),U(D,null,H(p.value.expense.rows,e=>(B(),U(`tr`,{key:e.accountCode,class:`border-b border-gray-100 hover:bg-blue-50 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400`,tabindex:`0`,role:`button`,"aria-label":q(r)(`pluginAccounting.accounts.openLedgerAria`,{code:e.accountCode,name:e.accountName}),"data-testid":`accounting-pl-row-${e.accountCode}`,onClick:t=>u(e.accountCode),onKeydown:[l(s(t=>d(t,e.accountCode),[`prevent`,`self`]),[`enter`]),l(s(t=>d(t,e.accountCode),[`prevent`,`self`]),[`space`])]},[S(`td`,ygt,[S(`span`,bgt,T(e.accountCode),1),J(T(e.accountName),1)]),S(`td`,xgt,T(y(e.amount)),1)],40,vgt))),128))]),S(`tfoot`,null,[S(`tr`,Sgt,[S(`td`,Cgt,T(q(r)(`pluginAccounting.balanceSheet.total`)),1),S(`td`,wgt,T(y(p.value.expense.total)),1)])])])]),S(`div`,Tgt,[S(`span`,null,T(q(r)(`pluginAccounting.profitLoss.netIncome`)),1),S(`span`,{class:c(p.value.netIncome>=0?`text-green-600`:`text-red-500`)},T(y(p.value.netIncome)),3)])],64)):b(``,!0)]))}}),Dgt={class:`flex flex-col gap-4`,"data-testid":`accounting-settings`},Ogt={class:`border border-gray-200 rounded p-3 flex flex-col gap-2`},kgt={class:`text-sm font-semibold`},Agt={class:`text-xs text-gray-500`},jgt={class:`text-sm flex flex-col gap-1`},Mgt=[`disabled`],Ngt={class:`text-xs text-gray-700 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1`},Pgt={class:`text-gray-500`},Fgt={class:`text-sm flex flex-col gap-1 mt-1`},Igt=[`disabled`],Lgt={value:``},Rgt=[`value`],zgt={class:`text-sm flex flex-col gap-1 mt-1`},Bgt=[`disabled`],Vgt=[`value`],Hgt={class:`text-xs text-gray-500`},Ugt={key:0,class:`text-xs text-green-600`,"data-testid":`accounting-settings-update-ok`},Wgt={key:1,class:`text-xs text-red-500`,"data-testid":`accounting-settings-update-error`},Ggt=[`disabled`],Kgt={class:`border border-gray-200 rounded p-3 flex flex-col gap-2`},qgt={class:`text-sm font-semibold`},Jgt={class:`text-xs text-gray-500`},Ygt={key:0,class:`text-xs text-green-600`,"data-testid":`accounting-settings-rebuild-ok`},Xgt={key:1,class:`text-xs text-red-500`,"data-testid":`accounting-settings-rebuild-error`},Zgt=[`disabled`],Qgt={key:0},$gt={key:1,class:`border border-red-300 rounded p-3 flex flex-col gap-2`},e_t={class:`text-sm font-semibold text-red-700`},t_t={class:`text-xs text-gray-500`},n_t={key:0,class:`text-xs text-red-500`,"data-testid":`accounting-settings-delete-error`},r_t={class:`text-xs text-gray-500 flex flex-col gap-1`},i_t=[`disabled`],a_t=K({__name:`BookSettings`,props:{bookId:{},bookName:{},currency:{},country:{},fiscalYearEnd:{}},emits:[`deleted`,`books-changed`],setup(e,{emit:t}){let n=SL(),{t:r,locale:a}=xL(),o=e,s=t,c=V(!1),l=V(null),d=V(null),f=V(!1),p=V(null),h=V(``),g=V(!1),_=V(null),v=V(null),y=V(!1),x=V(o.bookName),C=V(o.country??``),w=V(aP(o.fiscalYearEnd)),E=m(()=>cP.map(e=>({code:e,label:`${e} — ${b9e(e,a.value)}`}))),O=m(()=>iP.map(e=>({value:e,label:d9e(e,a.value)}))),k=m(()=>{let e=x.value.trim()!==o.bookName,t=x.value.trim().length>0,n=C.value!==(o.country??``),r=w.value!==aP(o.fiscalYearEnd);return t&&(e||n||r)});async function A(){c.value=!0,l.value=null,d.value=null;try{let e=await n.rebuildSnapshots(o.bookId);if(!e.ok){d.value=e.error;return}l.value=r(`pluginAccounting.settings.rebuildOk`,{count:e.data.rebuilt.length})}finally{c.value=!1}}async function j(){if(!g.value){g.value=!0,_.value=null,v.value=null;try{let e=C.value,t=e===``||x9e(e)?e:``,i=await n.updateBook({bookId:o.bookId,name:x.value.trim(),country:t,fiscalYearEnd:w.value});if(!i.ok){v.value=i.error;return}_.value=r(`pluginAccounting.settings.updateOk`),s(`books-changed`)}finally{g.value=!1}}}async function M(){if(!f.value){f.value=!0,p.value=null;try{let e=await n.deleteBook(o.bookId);if(!e.ok){p.value=e.error;return}s(`deleted`,o.bookName),s(`books-changed`)}finally{f.value=!1}}}return Ve(()=>o.bookId,()=>{l.value=null,d.value=null,p.value=null,h.value=``,_.value=null,v.value=null,x.value=o.bookName,C.value=o.country??``,w.value=aP(o.fiscalYearEnd),y.value=!1}),Ve(()=>o.bookName,e=>{x.value=e}),Ve(()=>o.country,e=>{C.value=e??``}),Ve(()=>o.fiscalYearEnd,e=>{w.value=aP(e)}),(t,n)=>(B(),U(`div`,Dgt,[S(`section`,Ogt,[S(`h4`,kgt,T(q(r)(`pluginAccounting.settings.bookInfo`)),1),S(`p`,Agt,T(q(r)(`pluginAccounting.settings.bookInfoExplain`)),1),S(`label`,jgt,[J(T(q(r)(`pluginAccounting.bookSwitcher.nameLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[0]||=e=>x.value=e,type:`text`,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-settings-name`,disabled:g.value,maxlength:`200`},null,8,Mgt),[[Fe,x.value]])]),S(`dl`,Ngt,[S(`dt`,Pgt,T(q(r)(`pluginAccounting.bookSwitcher.currencyLabel`)),1),S(`dd`,null,T(e.currency),1)]),S(`label`,Fgt,[J(T(q(r)(`pluginAccounting.bookSwitcher.countryLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[1]||=e=>C.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-settings-country`,disabled:g.value},[S(`option`,Lgt,T(q(r)(`pluginAccounting.settings.countryUnset`)),1),(B(!0),U(D,null,H(E.value,e=>(B(),U(`option`,{key:e.code,value:e.code},T(e.label),9,Rgt))),128))],8,Igt),[[i,C.value]])]),S(`label`,zgt,[J(T(q(r)(`pluginAccounting.bookSwitcher.fiscalYearEndLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[2]||=e=>w.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-settings-fiscal-year-end`,disabled:g.value},[(B(!0),U(D,null,H(O.value,e=>(B(),U(`option`,{key:e.value,value:e.value},T(e.label),9,Vgt))),128))],8,Bgt),[[i,w.value]])]),S(`p`,Hgt,T(q(r)(`pluginAccounting.settings.fiscalYearEndExplain`)),1),_.value?(B(),U(`p`,Ugt,T(_.value),1)):b(``,!0),v.value?(B(),U(`p`,Wgt,T(v.value),1)):b(``,!0),S(`div`,null,[S(`button`,{class:`h-8 px-3 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm disabled:opacity-50`,disabled:g.value||!k.value,"data-testid":`accounting-settings-save`,onClick:j},T(g.value?q(r)(`pluginAccounting.common.loading`):q(r)(`pluginAccounting.settings.saveChanges`)),9,Ggt)])]),S(`section`,Kgt,[S(`h4`,qgt,T(q(r)(`pluginAccounting.settings.rebuild`)),1),S(`p`,Jgt,T(q(r)(`pluginAccounting.settings.rebuildExplain`)),1),l.value?(B(),U(`p`,Ygt,T(l.value),1)):b(``,!0),d.value?(B(),U(`p`,Xgt,T(d.value),1)):b(``,!0),S(`div`,null,[S(`button`,{class:`h-8 px-3 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm disabled:opacity-50`,disabled:c.value,"data-testid":`accounting-settings-rebuild`,onClick:A},T(c.value?q(r)(`pluginAccounting.common.loading`):q(r)(`pluginAccounting.settings.rebuild`)),9,Zgt)])]),y.value?b(``,!0):(B(),U(`div`,Qgt,[S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-settings-advanced`,onClick:n[3]||=e=>y.value=!0},[n[5]||=S(`span`,{class:`material-icons text-base`},`expand_more`,-1),S(`span`,null,T(q(r)(`pluginAccounting.settings.advanced`)),1)])])),y.value?(B(),U(`section`,$gt,[S(`h4`,e_t,T(q(r)(`pluginAccounting.settings.deleteBook`)),1),S(`p`,t_t,T(q(r)(`pluginAccounting.settings.deleteBookExplain`)),1),p.value?(B(),U(`p`,n_t,T(p.value),1)):b(``,!0),S(`label`,r_t,[J(T(q(r)(`pluginAccounting.settings.deleteBookConfirm`,{bookName:e.bookName}))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[4]||=e=>h.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-settings-delete-confirm`},null,512),[[Fe,h.value]])]),S(`div`,null,[S(`button`,{class:`h-8 px-3 rounded bg-red-600 hover:bg-red-700 text-white text-sm disabled:opacity-50`,disabled:h.value!==e.bookName||f.value,"data-testid":`accounting-settings-delete`,onClick:M},T(f.value?q(r)(`pluginAccounting.common.loading`):q(r)(`pluginAccounting.settings.deleteBookButton`)),9,i_t)])])):b(``,!0)]))}}),o_t=Object.values(i9e);function s_t(e){if(typeof e!=`object`||!e||!(`kind`in e))return null;let t=o_t.find(t=>t===e.kind);if(t===void 0)return null;let n=`period`in e&&typeof e.period==`string`?e.period:void 0;return n===void 0?{kind:t}:{kind:t,period:n}}function c_t(e){return m(()=>e===void 0?bL():typeof e==`function`?e():e)}function l_t(e,t,n){let r=c_t(n),i=V(0),a=null;function o(e){a?.(),a=null,i.value=0,e&&(a=$ut(t9e(e,r.value),e=>{i.value+=1;let n=s_t(e);n&&t?.(n)}))}return Ve([e,r],([e])=>o(e),{immediate:!0}),_(()=>{a?.(),a=null}),{version:i}}function u_t(e,t){let n=c_t(t),r=null;Ve(n,t=>{r?.(),r=$ut(r9e(t),e)},{immediate:!0}),_(()=>{r?.(),r=null})}var d_t={class:`h-full bg-white flex flex-col`,"data-testid":`accounting-app`},f_t={class:`flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-100 shrink-0`},p_t={class:`flex items-center gap-2 min-w-0`},m_t={class:`text-lg font-semibold text-gray-800`},h_t={class:`flex items-center gap-0.5 px-3 py-1.5 border-b border-gray-100 shrink-0 overflow-x-auto`,"data-testid":`accounting-tabs`},g_t=[`data-testid`,`disabled`,`onClick`],__t={class:`material-icons text-base`},v_t={class:`flex-1 overflow-auto p-4`},y_t={key:0,class:`text-center text-sm text-gray-600 flex flex-col gap-2 items-center justify-center h-full`,"data-testid":`accounting-deleted-notice`},b_t={class:`font-medium`,"data-testid":`accounting-deleted-notice-title`},x_t={class:`text-xs text-gray-500`},S_t={key:1,class:`text-sm text-gray-400`},C_t={key:2,class:`text-sm text-red-500`,"data-testid":`accounting-load-error`},w_t={key:3,class:`text-sm text-gray-500`,"data-testid":`accounting-no-book`},T_t=K({__name:`View`,props:{selectedResult:{}},setup(e){let{t}=xL(),n=e,r=[`journal`,`opening`,`accounts`,`ledger`,`balanceSheet`,`profitLoss`,`settings`],i=[{key:`journal`,icon:`list`,labelKey:`pluginAccounting.tabs.journal`},{key:`opening`,icon:`play_arrow`,labelKey:`pluginAccounting.tabs.opening`},{key:`accounts`,icon:`list_alt`,labelKey:`pluginAccounting.tabs.accounts`},{key:`ledger`,icon:`menu_book`,labelKey:`pluginAccounting.tabs.ledger`},{key:`balanceSheet`,icon:`balance`,labelKey:`pluginAccounting.tabs.balanceSheet`},{key:`profitLoss`,icon:`trending_up`,labelKey:`pluginAccounting.tabs.profitLoss`},{key:`settings`,icon:`settings`,labelKey:`pluginAccounting.tabs.settings`}];function a(e){return r.some(t=>t===e)}let o=m(()=>n.selectedResult?.data??n.selectedResult?.jsonData??{}),s=m(()=>{let e=o.value;return`scope`in e?e.scope??null:bL()}),l=ddt(()=>s.value),u=m(()=>a(o.value.initialTab)?o.value.initialTab:`journal`),d=V(u.value),f=V([]),p=V(null),h=V([]),g=V(!0),_=V(!1),v=V(!1),y=V(!1),x=V(null),C=V(null),w=V(void 0),E=V(null),O=m(()=>f.value.find(e=>e.id===p.value)??null),k=m(()=>O.value?.name??``),A=m(()=>O.value?.currency??`USD`),j=m(()=>O.value?.country),M=m(()=>O.value?.fiscalYearEnd),{version:N}=l_t(p,void 0,()=>s.value);u_t(()=>void F(),()=>s.value);function P(){let[e]=f.value;if(!e)return null;let t=o.value.bookId;return t&&f.value.some(e=>e.id===t)?t:e.id}async function F(){g.value=!0,x.value=null;let e=O.value;try{let t=await l.getBooks();if(!t.ok){x.value=t.error;return}f.value=t.data.books,_.value=!0,E.value===null&&(p.value!==null&&f.value.some(e=>e.id===p.value)||(e?(p.value=null,E.value=e.name):p.value=P())),!y.value&&f.value.length===0&&(y.value=!0,v.value=!0)}catch(e){x.value=rP(e)}finally{g.value=!1}}async function I(e){v.value=!1,await F(),p.value=e.id}async function L(e){f.value.some(t=>t.id===e.id)||(f.value=[...f.value,e]),p.value=e.id,E.value=null,d.value=`journal`,await F()}async function R(){if(!p.value){h.value=[];return}let e=await l.getAccounts(p.value);e.ok&&(h.value=e.data.accounts)}async function z(){if(!p.value){C.value=null,w.value=void 0;return}let e=await l.getOpeningBalances(p.value);e.ok&&(C.value=e.data.opening!==null,w.value=e.data.opening?.date)}let ee=m(()=>p.value!==null&&C.value===!1),te=m(()=>ee.value?i.filter(e=>e.key===`opening`||e.key===`settings`):i.filter(e=>e.key!==`opening`||d.value===`opening`));function ne(e){p.value=e,E.value=null}let re=V(void 0),ie=V(void 0);function ae(e){ie.value=void 0,Promise.resolve().then(()=>{ie.value=e}),d.value=`ledger`}function oe(){d.value===`opening`&&(d.value=`journal`)}async function W(e){d.value=`journal`,p.value=null,E.value=e,await F()}Ve(()=>[p.value,N.value],()=>{p.value&&R()},{immediate:!0}),Ve(p,()=>{ie.value=void 0});let se=V(null);function ce(e){if(f.value.some(t=>t.id===e)){p.value=e,se.value=null;return}se.value=e}Ve(()=>o.value.bookId,e=>{e&&ce(e)}),Ve(f,()=>{let e=se.value;e&&ce(e)});function le(e){if(a(e.initialTab))return e.initialTab;switch(e.action){case tP.addEntries:case tP.voidEntry:return`journal`;case tP.upsertAccount:return`accounts`;case tP.updateBook:return`settings`;case tP.openBook:case tP.createBook:case tP.setOpeningBalances:return`balanceSheet`;default:return null}}function ue(e){if(e.action===tP.addEntries){let t=Array.isArray(e.entries)?e.entries:[];return t[t.length-1]?.id}if(e.action===tP.voidEntry)return e.markerEntry?.id}return Ve(()=>o.value,e=>{let t=le(e);t&&(d.value=t),re.value=ue(e)},{immediate:!0}),Ve(p,(e,t)=>{t&&(re.value=void 0)}),Ve(()=>[p.value,N.value],()=>void z(),{immediate:!0}),Ve(ee,e=>{e&&d.value!==`opening`&&(d.value=`opening`)}),F(),(e,n)=>(B(),U(`div`,d_t,[v.value?(B(),ke(Ddt,{key:0,"first-run":``,"full-page":``,onCreated:I})):(B(),U(D,{key:1},[S(`header`,f_t,[S(`div`,p_t,[n[2]||=S(`span`,{class:`material-icons text-gray-600`},`account_balance`,-1),S(`h2`,m_t,T(q(t)(`pluginAccounting.title`)),1)]),_.value?(B(),ke(Pdt,{key:0,"model-value":p.value??``,books:f.value,"onUpdate:modelValue":ne,onBooksChanged:F,onBookCreated:L},null,8,[`model-value`,`books`])):b(``,!0)]),S(`nav`,h_t,[(B(!0),U(D,null,H(te.value,e=>(B(),U(`button`,{key:e.key,class:c([`h-8 px-2.5 flex items-center gap-1 rounded text-sm whitespace-nowrap`,E.value===null?d.value===e.key?`bg-blue-50 text-blue-600 font-medium`:`text-gray-600 hover:bg-gray-50`:`text-gray-400 cursor-not-allowed`]),"data-testid":`accounting-tab-${e.key}`,disabled:E.value!==null,onClick:t=>d.value=e.key},[S(`span`,__t,T(e.icon),1),S(`span`,null,T(q(t)(e.labelKey)),1)],10,g_t))),128))]),S(`main`,v_t,[E.value===null?g.value&&!_.value?(B(),U(`p`,S_t,T(q(t)(`pluginAccounting.common.loading`)),1)):x.value?(B(),U(`p`,C_t,T(q(t)(`pluginAccounting.common.error`,{error:x.value})),1)):p.value?p.value?(B(),U(D,{key:4},[d.value===`journal`?(B(),ke(bmt,{key:0,"book-id":p.value,accounts:h.value,currency:A.value,country:j.value,version:q(N),"fiscal-year-end":M.value,"opening-date":w.value,"preselect-entry-id":re.value,onEditOpening:n[0]||=e=>d.value=`opening`,onPreselectConsumed:n[1]||=e=>re.value=void 0},null,8,[`book-id`,`accounts`,`currency`,`country`,`version`,`fiscal-year-end`,`opening-date`,`preselect-entry-id`])):d.value===`opening`?(B(),ke(qmt,{key:1,"book-id":p.value,accounts:h.value,currency:A.value,version:q(N),onSubmitted:oe},null,8,[`book-id`,`accounts`,`currency`,`version`])):d.value===`accounts`?(B(),ke(nht,{key:2,"book-id":p.value,accounts:h.value,onSelectAccount:ae},null,8,[`book-id`,`accounts`])):d.value===`ledger`?(B(),ke(jht,{key:3,"book-id":p.value,accounts:h.value,currency:A.value,version:q(N),"fiscal-year-end":M.value,"opening-date":w.value,"preselect-account-code":ie.value},null,8,[`book-id`,`accounts`,`currency`,`version`,`fiscal-year-end`,`opening-date`,`preselect-account-code`])):d.value===`balanceSheet`?(B(),ke(egt,{key:4,"book-id":p.value,currency:A.value,version:q(N),onSelectAccount:ae},null,8,[`book-id`,`currency`,`version`])):d.value===`profitLoss`?(B(),ke(Egt,{key:5,"book-id":p.value,currency:A.value,version:q(N),"fiscal-year-end":M.value,"opening-date":w.value,onSelectAccount:ae},null,8,[`book-id`,`currency`,`version`,`fiscal-year-end`,`opening-date`])):d.value===`settings`?(B(),ke(a_t,{key:6,"book-id":p.value,"book-name":k.value,currency:A.value,country:j.value,"fiscal-year-end":M.value,onDeleted:W,onBooksChanged:F},null,8,[`book-id`,`book-name`,`currency`,`country`,`fiscal-year-end`])):b(``,!0)],64)):b(``,!0):(B(),U(`p`,w_t,T(q(t)(`pluginAccounting.noBook`)),1)):(B(),U(`div`,y_t,[n[3]||=S(`span`,{class:`material-icons text-gray-400`,style:{"font-size":`48px`}},`delete_outline`,-1),S(`p`,b_t,T(q(t)(`pluginAccounting.deletedNotice.title`,{bookName:E.value})),1),S(`p`,x_t,T(q(t)(`pluginAccounting.deletedNotice.body`)),1)]))])],64))]))}}),kL=e=>typeof e==`string`?e:void 0,E_t=e=>typeof e==`number`?e:void 0;function D_t(e,t){let n=kL(e.error);return n===void 0?null:t(`pluginAccounting.previewError`,{error:n})}function O_t(e,t){let[n]=a9e(e.entries)?e.entries:[],r=nP(n)?n:void 0,i=kL(r?.id),a=kL(r?.date);return!i||!a?null:t(`pluginAccounting.preview.entry`,{date:a})}function k_t(e,t){let{profitLoss:n}=e;if(!nP(n))return null;let r=E_t(n.netIncome);return r===void 0?null:t(`pluginAccounting.preview.pl`,{from:kL(n.from)??`?`,to:kL(n.to)??`?`,net:k9e(r)})}function A_t(e,t){let{balanceSheet:n}=e;if(!nP(n))return null;let r=kL(n.asOf),i=a9e(n.sections)?n.sections:void 0;if(!r||!i)return null;let a=i.find(e=>nP(e)&&e.type===`asset`);return t(`pluginAccounting.preview.bs`,{date:r,assets:nP(a)?k9e(E_t(a.total)??0):`?`})}function j_t(e,t){let{book:n}=e;if(!nP(n))return null;let r=kL(n.id),i=kL(n.name);return!r||!i?null:t(`pluginAccounting.preview.bookCreated`,{name:i,id:r})}function M_t(e,t){let{account:n}=e;if(!nP(n))return null;let r=kL(n.code),i=kL(n.name);return!r||!i?null:t(`pluginAccounting.preview.accountSaved`,{code:r,name:i})}function N_t(e,t){let{reverseEntry:n}=e;if(!nP(n))return null;let r=kL(n.date);return r?t(`pluginAccounting.preview.entryVoided`,{date:r}):null}function P_t(e,t){let{openingEntry:n}=e;if(!nP(n))return null;let r=kL(n.date);return r?t(e.replacedExisting===!0?`pluginAccounting.preview.openingReplaced`:`pluginAccounting.preview.openingSet`,{date:r}):null}function F_t(e,t){let n=kL(e.bookId);return n===void 0?t(`pluginAccounting.previewGeneric`):t(`pluginAccounting.previewSummary`,{bookId:n})}var I_t=e=>nP(e)?e:{};function L_t(e,t){let n=I_t(e);return D_t(n,t)??O_t(n,t)??k_t(n,t)??A_t(n,t)??j_t(n,t)??M_t(n,t)??N_t(n,t)??P_t(n,t)??F_t(n,t)}var R_t={class:`text-sm text-gray-700`,"data-testid":`accounting-preview`},z_t=K({__name:`Preview`,props:{result:{}},setup(e){let{t}=xL(),n=e,r=m(()=>L_t(n.result.data,t));return(e,t)=>(B(),U(`div`,R_t,[t[0]||=S(`span`,{class:`material-icons text-base align-middle mr-1`},`account_balance`,-1),S(`span`,null,T(r.value),1)]))}});M();var{subscribe:B_t}=QN();Zut({apiCall:fN,subscribe:B_t,localeTag:()=>q(GI.global.locale)}),o(),M();var V_t=Ae(()=>Xe(()=>Promise.resolve().then(()=>fvt),void 0)),AL=x(new Map);function H_t(e){return AL.get(e)??null}function U_t(){return Array.from(AL.keys())}function W_t(e){if(document.querySelector(`link[data-runtime-plugin-css="${e}"]`))return;let t=document.createElement(`link`);t.rel=`stylesheet`,t.href=e,t.dataset.runtimePluginCss=e,document.head.appendChild(t)}function G_t(e){return{toolDefinition:{type:`function`,name:e.toolName,description:e.description,parameters:{type:`object`,properties:{},required:[]}}}}async function K_t(e){AL.set(e.toolName,G_t(e));let t=`${e.assetBase}/dist/vue.js`,n;try{n=(await fetch(t,{method:`HEAD`})).status}catch(t){console.warn(`[runtime-plugin] HEAD probe failed for ${e.name}@${e.version}`,t);return}if(n===404)return;if(n!==200){console.warn(`[runtime-plugin] unexpected HEAD status ${n} for ${e.name}@${e.version}`);return}let r;try{r=await Xe(()=>import(t),[])}catch(t){console.warn(`[runtime-plugin] dynamic import failed (asset reachable): ${e.name}@${e.version}`,t);return}let i=r.plugin??r.default?.plugin;if(!i?.toolDefinition){console.warn(`[runtime-plugin] plugin export missing toolDefinition: ${e.name}`);return}W_t(`${e.assetBase}/dist/style.css`),AL.set(e.toolName,{toolDefinition:i.toolDefinition,viewComponent:q_t(i.viewComponent,e.name),previewComponent:q_t(i.previewComponent,e.name)})}function q_t(e,t){if(e)return z(K({name:`RuntimePluginScope:${t}`,inheritAttrs:!1,setup(n,{attrs:r,slots:i}){return()=>ve(V_t,{pkgName:t},()=>ve(e,r,i))}}))}async function J_t(){let e=await pN(SP.plugins.runtimeList);if(!e.ok){console.warn(`[runtime-plugin] list fetch failed: ${e.error}`);return}let t=e.data.plugins;t.length!==0&&await Promise.allSettled(t.map(K_t))}var Y_t={type:`function`,name:pP.toolName,prompt:`When the user asks to open / view their books, or to record, look up, or summarise journal entries / balances / opening balances, use manageAccounting. Use action='openBook' (with the target bookId) to switch the canvas to a specific existing book; use the specific action (addEntries / getReport / etc.) for narrowly-scoped operations the user asked about by name. On a fresh workspace call 'createBook' (always pass \`country\` so tax-registration advice is country-aware) — the accounting view picks up the new book automatically (no follow-up 'openBook' needed for this id). Use 'updateBook' to change a book's name or country (currency cannot be changed). Reach for 'openBook' only when switching to a different existing book. For cross-period charts and dashboards ("chart my quarterly revenue over the last two years", "show net income month-over-month for this fiscal year", "plot the cash balance by month") use action='getTimeSeries' — it returns one chart-ready point per bucket in a single round-trip; do NOT loop over 'getReport' to assemble a series yourself.`,description:`Manage a double-entry accounting book stored in the workspace file system. Supports multiple books (entities), opening balances for adoption from existing books, journal entries, voiding (append-only — corrections are reversing pairs), and balance-sheet / profit-loss / ledger reports. Action='openBook' mounts the full accounting UI in the canvas (requires bookId); 'getTimeSeries' returns chart-ready (label, value)[] series for revenue / expense / netIncome / accountBalance over time; specific actions return compact results that render inline.`,parameters:{type:`object`,properties:{action:{type:`string`,enum:Object.values(tP),description:`Operation to perform. 'openBook' mounts the full UI for a specific book; others perform a single read or write. Use 'openBook' when the user wants to browse / interact, and a specific action when the user named the operation.`},bookId:{type:`string`,description:`Target book id. Required for every action that reads or writes book data, including 'openBook'; call 'getBooks' first to enumerate available ids. The only actions that do NOT take a bookId are 'getBooks' and 'createBook' (which creates a fresh one).`},name:{type:`string`,description:`For 'createBook' / 'updateBook': human-readable book name.`},currency:{type:`string`,description:`For 'createBook': ISO 4217 currency code (default USD). Single-currency per book — cannot be changed once set.`},country:{type:`string`,enum:[...cP,``],description:`For 'createBook' / 'updateBook': ISO 3166-1 alpha-2 country code identifying the tax jurisdiction. Drives country-aware advice — e.g. when set to 'JP', strongly suggest the supplier's T-number (適格請求書発行事業者登録番号) on tax-related lines under インボイス制度. Only the codes listed in the enum are accepted; pass an empty string to 'updateBook' to clear the field.`},fiscalYearEnd:{type:`integer`,minimum:Math.min(...iP),maximum:Math.max(...iP),description:`For 'createBook' / 'updateBook': the calendar month (1-12) on whose LAST DAY this book's fiscal year closes — e.g. 3 = March 31, 8 = August 31, 12 = December 31 (calendar year, the default). Any month is allowed. Drives the date-range shortcuts in the UI ('current quarter', 'current year', etc.). Pure metadata: changing it does not move existing entries.`},initialTab:{type:`string`,description:`For 'openBook': initial tab to show (e.g. 'journal', 'opening', 'balanceSheet').`},confirm:{type:`boolean`,description:`For 'deleteBook': must be true to actually delete (guard against accidental deletion).`},account:{type:`object`,description:`For 'upsertAccount': the account to insert or update (matched by code).`,properties:{code:{type:`string`},name:{type:`string`},type:{type:`string`,enum:[`asset`,`liability`,`equity`,`income`,`expense`]},note:{type:`string`},active:{type:`boolean`,description:"Soft-delete flag. `false` deactivates the account (hides it from entry / ledger dropdowns while keeping it visible in Manage Accounts and historical entries — accounting integrity requires that a code referenced by a journal line never disappears). `true` reactivates a previously-deactivated account. Omit to preserve the existing state — handy when updating name / type / note without touching the active flag."}},required:[`code`,`name`,`type`]},entries:{type:`array`,description:`For 'addEntries': one or more journal entries to post atomically (all-or-nothing — if any entry fails validation, the whole batch is rejected and nothing is written). Use a single-element array to post one entry. Each entry has its own date, lines, optional memo, and optional replacesEntryId.`,items:{type:`object`,properties:{date:{type:`string`,description:`YYYY-MM-DD booking date.`},lines:{type:`array`,description:`Journal lines for this entry. Each line sets exactly one of debit or credit (positive amount). Σ debit must equal Σ credit.`,items:{type:`object`,properties:{accountCode:{type:`string`},debit:{type:`number`},credit:{type:`number`},memo:{type:`string`},taxRegistrationId:{type:`string`,description:`Optional counterparty tax-authority registration ID for this line (Japan T-number, EU VAT ID, UK VAT registration number, India GSTIN, Australia ABN, etc.). Free-form string, max 32 chars. Required for input-tax-credit eligibility under regimes like Japan's インボイス制度.`}},required:[`accountCode`]}},memo:{type:`string`,description:`Optional entry-level memo.`},replacesEntryId:{type:`string`,description:`Optional — id of an entry this one replaces (the 'edit' flow). The caller MUST issue a 'voidEntry' for that id immediately before this addEntries call; the void + post pair is not atomic on the server.`}},required:[`date`,`lines`]}},lines:{type:`array`,description:`For 'setOpeningBalances': journal lines. Each line sets exactly one of debit or credit (positive amount). Σ debit must equal Σ credit. Only balance-sheet accounts (asset / liability / equity) are accepted.`,items:{type:`object`,properties:{accountCode:{type:`string`},debit:{type:`number`},credit:{type:`number`},memo:{type:`string`},taxRegistrationId:{type:`string`}},required:[`accountCode`]}},memo:{type:`string`,description:`For 'setOpeningBalances': optional entry-level memo.`},entryId:{type:`string`,description:`For 'voidEntry': id of the entry to void. The reverse + marker pair is appended (journal stays append-only).`},reason:{type:`string`,description:`For 'voidEntry': human-readable reason.`},voidDate:{type:`string`,description:`For 'voidEntry': YYYY-MM-DD date for the reverse entry (defaults to today).`},from:{type:`string`,description:`For 'getJournalEntries': inclusive YYYY-MM-DD lower bound on entry date. For 'getTimeSeries': inclusive YYYY-MM-DD lower bound — the first bucket is the one CONTAINING this date (it can extend earlier).`},to:{type:`string`,description:`For 'getJournalEntries': inclusive YYYY-MM-DD upper bound on entry date. For 'getTimeSeries': inclusive YYYY-MM-DD upper bound — the last bucket is the one CONTAINING this date (it can extend later).`},accountCode:{type:`string`,description:`For 'getJournalEntries' / 'getReport' (kind=ledger): filter to entries that touch a specific account code. For 'getTimeSeries' with metric='accountBalance': REQUIRED — the account whose closing balance to plot per bucket. Forbidden for the other metrics.`},metric:{type:`string`,enum:[...N9e],description:"For 'getTimeSeries': what to plot per bucket. 'revenue' = sum of income-account presentation values within the bucket (positive = money earned). 'expense' = sum of expense accounts within the bucket (positive = money spent). 'netIncome' = revenue − expense (positive = profit). 'accountBalance' = closing balance of `accountCode` at the end of each bucket (cumulative, includes opening balances)."},granularity:{type:`string`,enum:[...P9e],description:`For 'getTimeSeries': bucket size. 'month' uses calendar months (label format YYYY-MM). 'quarter' and 'year' honour the book's fiscalYearEnd — for a December year-end book (12) they coincide with calendar quarters / years; any other closing month shifts them accordingly. Quarter labels are 'FY{endYear}-Q{1..4}', year labels are 'FY{endYear}'; the FY is named by its END calendar year (e.g. an FY running Apr 2025 – Mar 2026 is FY2026).`},asOfDate:{type:`string`,description:`For 'setOpeningBalances': YYYY-MM-DD date the balances are stated as-of. Must be on or before any existing entry.`},kind:{type:`string`,enum:[`balance`,`pl`,`ledger`],description:`For 'getReport': which report. 'balance' = balance sheet; 'pl' = profit & loss; 'ledger' = per-account running balance.`},period:{type:`object`,description:`For 'getReport': either a single closing month or a date range.`,properties:{kind:{type:`string`,enum:[`month`,`range`]},period:{type:`string`,description:`For kind='month': YYYY-MM.`},from:{type:`string`},to:{type:`string`}},required:[`kind`]}},required:[`action`]}};o();function X_t(e,t){return`plugin:${e}:${t}`}function Z_t(e,t){return n=>{let r;try{r=e(n)}catch{return}r!==null&&t&&t(r)}}function Q_t(e){let{subscribe:t}=QN();function n(n,r,i){let a=X_t(e,n);return typeof r==`function`?t(a,r):t(a,Z_t(r.parse,i))}return{subscribe:n}}function $_t(e){let t=`[plugin/${e}]`;return{debug:(e,n)=>console.debug(t,e,n),info:(e,n)=>console.info(t,e,n),warn:(e,n)=>console.warn(t,e,n),error:(e,n)=>console.error(t,e,n)}}var evt=new Set([`http:`,`https:`]);function tvt(e){return t=>{let n;try{n=new URL(t)}catch{console.warn(`[plugin/${e}] openUrl rejected unparseable URL`,{url:t});return}if(!evt.has(n.protocol)){console.warn(`[plugin/${e}] openUrl rejected non-http(s) scheme`,{scheme:n.protocol});return}window.open(t,`_blank`,`noopener,noreferrer`)||console.warn(`[plugin/${e}] window.open returned null`,{url:t})}}function nvt(e){let t=SP.plugins.runtimeDispatch.replace(`:pkg`,encodeURIComponent(e));async function n(n,r){let i=await mN(t,n);if(!i.ok)throw Error(`plugin/${e} dispatch failed (${i.status}): ${i.error}`);return r?r(i.data):i.data}return n}function rvt(e){let{pkgName:t,endpoints:n}=e,{locale:r}=We(),i=m({get:()=>String(r.value),set:e=>{WI(e)&&(r.value=e)}});return{pubsub:Q_t(t),locale:i,log:$_t(t),openUrl:tvt(t),dispatch:nvt(t),...n===void 0?{}:{endpoints:n}}}o(),M();function ivt(e){let t=V(null),n=V(!1),r=V(0),i=m(()=>{if(!t.value)return``;let e=t.value.message||String(t.value),n=t.value.stack??``;return n?`${e}\n\n${n}`:e});function a(n){let r=cr(n);console.error(`[plugin/${e}] uncaught error`,r),t.value=r}function o(){t.value=null,n.value=!1,r.value+=1}return{error:t,showDetails:n,mountKey:r,errorDetails:i,captureError:a,retry:o}}o(),M(),we();var avt={key:0,class:`rounded border border-red-200 bg-red-50 p-3 text-sm`,"data-testid":`plugin-error-boundary`,role:`alert`},ovt={class:`flex items-center gap-2 mb-1`},svt={class:`font-medium text-red-800`},cvt={class:`text-red-700 mb-2`},lvt={class:`flex items-center gap-3`},uvt={key:0,class:`mt-2 text-xs text-red-900 bg-red-100 p-2 rounded overflow-auto max-h-40 whitespace-pre-wrap break-words`},dvt=K({__name:`PluginScopedRoot`,props:{pkgName:{},endpoints:{}},setup(e){let t=e,{t:n}=We(),r=rvt({pkgName:t.pkgName,endpoints:t.endpoints});C(Ye,r);let{error:i,showDetails:a,mountKey:o,errorDetails:s,captureError:c,retry:l}=ivt(t.pkgName);return w(e=>(c(e),!1)),(t,r)=>q(i)?(B(),U(`div`,avt,[S(`div`,ovt,[r[2]||=S(`span`,{class:`material-icons text-red-500`,"aria-hidden":`true`},`error_outline`,-1),S(`span`,svt,T(q(n)(`pluginErrorBoundary.title`,{pkg:e.pkgName})),1)]),S(`p`,cvt,T(q(n)(`pluginErrorBoundary.subtitle`)),1),S(`div`,lvt,[S(`button`,{type:`button`,class:`text-xs text-red-600 hover:underline`,"data-testid":`plugin-error-toggle-details`,onClick:r[0]||=e=>a.value=!q(a)},T(q(a)?q(n)(`pluginErrorBoundary.hideDetails`):q(n)(`pluginErrorBoundary.showDetails`)),1),S(`button`,{type:`button`,class:`text-xs text-red-600 hover:underline`,"data-testid":`plugin-error-retry`,onClick:r[1]||=(...e)=>q(l)&&q(l)(...e)},T(q(n)(`pluginErrorBoundary.retry`)),1)]),q(a)?(B(),U(`pre`,uvt,T(q(s)),1)):b(``,!0)])):ne(t.$slots,`default`,{key:q(o)})}}),fvt=y({default:()=>jL}),jL=dvt,ML=null;function pvt(e){ML=e}function NL(){if(ML===null)throw Error(`Plugin host context not installed. Call installHostContext(...) at app boot before mounting any plugin component.`);return ML}function PL(e){let{endpoints:t}=NL(),n=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(!n)throw Error(`Unknown plugin endpoint scope: "${e}"`);return n}function FL(){return NL().builtinRoleIds}function mvt(e){let{pageRoutes:t}=NL(),n=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(!n)throw Error(`Unknown page route: "${e}"`);return n}function hvt(){return NL().chatModels}o(),M();function IL(e,t){return t&&z(K({name:`BuiltInPluginScope:${e}`,inheritAttrs:!1,setup(n,{attrs:r,slots:i}){let a=PL(e);return()=>ve(jL,{pkgName:e,endpoints:a},()=>ve(t,r,i))}}))}function LL(){return crypto.randomUUID()}var gvt={toolDefinition:Y_t,async execute(e,t){let n=Y_t.name,{method:r,path:i}=pP.apiRoutes.dispatch,a=await fN(`/api/${pP.apiNamespace}${i}`,{method:r,body:t});return a.ok?{...a.data,toolName:n,uuid:a.data.uuid??LL()}:{toolName:n,uuid:LL(),message:a.error}},isEnabled:()=>!0,generatingMessage:`Working on the books...`,viewComponent:IL(`accounting`,T_t),previewComponent:IL(`accounting`,z_t)},_vt={toolName:pP.toolName,entry:gvt},RL=F9e.toolName,vvt={type:`function`,name:RL,description:`Open a drawing canvas for the user to create drawings, sketches, or diagrams.`,prompt:`When the user asks 'I want to draw an image.', call ${RL} API to open the canvas.`,parameters:{type:`object`,properties:{},required:[]}};async function yvt(e,t,n){let r=await fN(e.url,{method:e.method,body:n});return r.ok?{...r.data,toolName:t,uuid:LL()}:{toolName:t,uuid:LL(),message:r.error}}function bvt(e,t,n){if(e===void 0)throw Error(`Plugin endpoint "${n}" is not registered for scope "${t}"`);return e}function zL(e,t,n){return async(r,i)=>{let a=PL(e)[t];return yvt(bvt(a,e,t),n,i)}}function xvt(e,t,n){return async(r,i)=>{let a=PL(e)[t];return yvt({method:`POST`,url:bvt(a,e,t)},n,i)}}var Svt=K({name:`VueDrawingCanvas`,props:{strokeType:{type:String,validator:e=>[`dash`,`line`,`square`,`circle`,`triangle`,`half_triangle`].indexOf(e)!==-1,default:()=>`dash`},fillShape:{type:Boolean,default:()=>!1},width:{type:[String,Number],default:()=>600},height:{type:[String,Number],default:()=>400},image:{type:String,default:()=>``},eraser:{type:Boolean,default:()=>!1},color:{type:String,default:()=>`#000000`},lineWidth:{type:Number,default:()=>5},lineCap:{type:String,validator:e=>[`round`,`square`,`butt`].indexOf(e)!==-1,default:()=>`round`},lineJoin:{type:String,validator:e=>[`miter`,`round`,`bevel`].indexOf(e)!==-1,default:()=>`miter`},lock:{type:Boolean,default:()=>!1},styles:{type:[Array,String,Object]},classes:{type:[Array,String,Object]},backgroundColor:{type:String,default:()=>`#FFFFFF`},backgroundImage:{type:String,default:()=>null},watermark:{type:Object,default:()=>null},saveAs:{type:String,validator:e=>[`jpeg`,`png`].indexOf(e)!==-1,default:()=>`png`},canvasId:{type:String,default:()=>`VueDrawingCanvas`},initialImage:{type:Array,default:()=>[]},additionalImages:{type:Array,default:()=>[]},outputWidth:{type:Number},outputHeight:{type:Number}},data(){return{loadedImage:null,drawing:!1,context:null,images:[],strokes:{type:``,from:{x:0,y:0},coordinates:[],color:``,width:``,fill:!1,lineCap:``,lineJoin:``},guides:[],trash:[]}},mounted(){this.setContext(),this.$nextTick(()=>{this.drawInitialImage(),this.drawAdditionalImages()})},watch:{backgroundImage:function(){this.loadedImage=null}},methods:{async setContext(){let e=document.querySelector(`#`+this.canvasId);this.context=this.context?this.context:e.getContext(`2d`),await this.setBackground()},drawInitialImage(){this.initialImage&&this.initialImage.length>0&&(this.images=[].concat(this.images,this.initialImage),this.redraw(!0))},drawAdditionalImages(){if(this.additionalImages&&this.additionalImages.length>0){let e=document.querySelector(`#`+this.canvasId);this.additionalImages.forEach(t=>{this.drawWatermark(e,this.context,t)})}},clear(){this.context.clearRect(0,0,Number(this.width),Number(this.height))},async setBackground(){this.clear(),this.context.fillStyle=this.backgroundColor,this.context.fillRect(0,0,Number(this.width),Number(this.height)),await this.$nextTick(async()=>{await this.drawBackgroundImage()}),this.save()},async drawBackgroundImage(){if(this.loadedImage)this.context.drawImage(this.loadedImage,0,0,Number(this.width),Number(this.height));else return new Promise(e=>{if(!this.backgroundImage){e();return}let t=new Image;t.src=this.backgroundImage,t.onload=()=>{this.context.drawImage(t,0,0,Number(this.width),Number(this.height)),this.loadedImage=t,e()}})},getCoordinates(e){let t,n;if(e.touches&&e.touches.length>0){let r=document.querySelector(`#`+this.canvasId).getBoundingClientRect();t=e.touches[0].clientX-r.left,n=e.touches[0].clientY-r.top}else t=e.offsetX,n=e.offsetY;return{x:t,y:n}},startDraw(e){if(!this.lock){this.drawing=!0;let t=this.getCoordinates(e);this.strokes={type:this.eraser?`eraser`:this.strokeType,from:t,coordinates:[],color:this.eraser?this.backgroundColor:this.color,width:this.lineWidth,fill:this.eraser||this.strokeType===`dash`||this.strokeType===`line`?!1:this.fillShape,lineCap:this.lineCap,lineJoin:this.lineJoin},this.guides=[]}},draw(e){if(this.drawing){this.context||this.setContext();let t=this.getCoordinates(e);if(this.eraser||this.strokeType===`dash`)this.strokes.coordinates.push(t),this.drawShape(this.context,this.strokes,!1);else{switch(this.strokeType){case`line`:this.guides=[{x:t.x,y:t.y}];break;case`square`:this.guides=[{x:t.x,y:this.strokes.from.y},{x:t.x,y:t.y},{x:this.strokes.from.x,y:t.y},{x:this.strokes.from.x,y:this.strokes.from.y}];break;case`triangle`:let e=Math.floor((t.x-this.strokes.from.x)/2)<0?Math.floor((t.x-this.strokes.from.x)/2)*-1:Math.floor((t.x-this.strokes.from.x)/2),n=this.strokes.from.x<t.x?this.strokes.from.x+e:this.strokes.from.x-e;this.guides=[{x:t.x,y:this.strokes.from.y},{x:n,y:t.y},{x:this.strokes.from.x,y:this.strokes.from.y}];break;case`half_triangle`:this.guides=[{x:t.x,y:this.strokes.from.y},{x:this.strokes.from.x,y:t.y},{x:this.strokes.from.x,y:this.strokes.from.y}];break;case`circle`:let r=this.strokes.from.x-t.x<0?(this.strokes.from.x-t.x)*-1:this.strokes.from.x-t.x;this.guides=[{x:this.strokes.from.x>t.x?this.strokes.from.x-r:this.strokes.from.x+r,y:this.strokes.from.y},{x:r,y:r}]}this.drawGuide(!0)}}},drawGuide(e){this.redraw(!0),this.$nextTick(()=>{this.context.strokeStyle=this.color,this.context.lineWidth=1,this.context.lineJoin=this.lineJoin,this.context.lineCap=this.lineCap,this.context.beginPath(),this.context.setLineDash([15,15]),this.strokes.type===`circle`?this.context.ellipse(this.guides[0].x,this.guides[0].y,this.guides[1].x,this.guides[1].y,0,0,Math.PI*2):(this.context.moveTo(this.strokes.from.x,this.strokes.from.y),this.guides.forEach(e=>{this.context.lineTo(e.x,e.y)}),e&&this.context.closePath()),this.context.stroke()})},drawShape(e,t,n){e.strokeStyle=t.color,e.fillStyle=t.color,e.lineWidth=t.width,e.lineJoin=t.lineJoin===void 0?this.lineJoin:t.lineJoin,e.lineCap=t.lineCap===void 0?this.lineCap:t.lineCap,e.beginPath(),e.setLineDash([]),t.type===`circle`?e.ellipse(t.coordinates[0].x,t.coordinates[0].y,t.coordinates[1].x,t.coordinates[1].y,0,0,Math.PI*2):(e.moveTo(t.from.x,t.from.y),t.coordinates.forEach(t=>{e.lineTo(t.x,t.y)}),n&&e.closePath()),t.fill?e.fill():e.stroke()},stopDraw(){this.drawing&&(this.strokes.coordinates=this.guides.length>0?this.guides:this.strokes.coordinates,this.images.push(this.strokes),this.redraw(!0),this.drawing=!1,this.trash=[])},reset(){this.lock||(this.images=[],this.strokes={type:``,coordinates:[],color:``,width:``,fill:!1,lineCap:``,lineJoin:``},this.guides=[],this.trash=[],this.redraw(!0))},undo(){if(!this.lock){let e=this.images.pop();e&&(this.trash.push(e),this.redraw(!0))}},redo(){if(!this.lock){let e=this.trash.pop();e&&(this.images.push(e),this.redraw(!0))}},async redraw(e){e=e===void 0||e,await this.setBackground().then(()=>{this.drawAdditionalImages()}).then(()=>{let e=document.createElement(`canvas`),t=e.getContext(`2d`);e.width=Number(this.width),e.height=Number(this.height),t&&(this.images.forEach(e=>{t&&(t.globalCompositeOperation=e.type===`eraser`?`destination-out`:`source-over`,(e.type!==`circle`||e.type===`circle`&&e.coordinates.length>0)&&this.drawShape(t,e,e.type!==`eraser`&&e.type!==`dash`&&e.type!==`line`))}),this.context.drawImage(e,0,0,Number(this.width),Number(this.height)))}).then(()=>{e&&this.save()})},wrapText(e,t,n,r,i,a){let o=/(\r\n|\n\r|\n|\r)+/g,s=/\s+/g;var c=t.split(o).filter(e=>e.length>0);for(let t=0;t<c.length;t++){for(var l=c[t].split(s).filter(e=>e.length>0),u=``,d=0;d<l.length;d++){var f=u+l[d]+` `;e.measureText(f).width>i&&d>0?(this.watermark&&this.watermark.fontStyle&&this.watermark.fontStyle.drawType&&this.watermark.fontStyle.drawType===`stroke`?e.strokeText(u,n,r):e.fillText(u,n,r),u=l[d]+` `,r+=a):u=f}this.watermark&&this.watermark.fontStyle&&this.watermark.fontStyle.drawType&&this.watermark.fontStyle.drawType===`stroke`?e.strokeText(u,n,r):e.fillText(u,n,r),r+=l.length>0?a:0}},save(){let e=document.querySelector(`#`+this.canvasId);if(this.watermark){let t=document.createElement(`canvas`),n=t.getContext(`2d`);n&&(t.width=Number(this.width),t.height=Number(this.height),n.drawImage(e,0,0,Number(this.width),Number(this.height)),this.drawWatermark(t,n,this.watermark))}else{let t=document.createElement(`canvas`),n=t.getContext(`2d`),r=this.outputWidth===void 0?this.width:this.outputWidth,i=this.outputHeight===void 0?this.height:this.outputHeight;if(t.width=Number(r),t.height=Number(i),n)return n.drawImage(e,0,0,Number(r),Number(i)),this.$emit(`update:image`,t.toDataURL(`image/`+this.saveAs,1)),t.toDataURL(`image/`+this.saveAs,1)}},drawWatermark(e,t,n){if(n.type===`Image`){let r=n.imageStyle&&n.imageStyle.width?n.imageStyle.width:Number(this.width),i=n.imageStyle&&n.imageStyle.height?n.imageStyle.height:Number(this.height),a=new Image;a.src=n.source,a.onload=()=>{n&&t&&t.drawImage(a,n.x,n.y,Number(r),Number(i));let o=document.createElement(`canvas`),s=o.getContext(`2d`),c=this.outputWidth===void 0?this.width:this.outputWidth,l=this.outputHeight===void 0?this.height:this.outputHeight;if(o.width=Number(c),o.height=Number(l),s)return s.drawImage(e,0,0,Number(c),Number(l)),this.$emit(`update:image`,o.toDataURL(`image/`+this.saveAs,1)),o.toDataURL(`image/`+this.saveAs,1)}}else if(n.type===`Text`){let r=n.fontStyle&&n.fontStyle.font?n.fontStyle.font:`20px serif`,i=n.fontStyle&&n.fontStyle.textAlign?n.fontStyle.textAlign:`start`,a=n.fontStyle&&n.fontStyle.textBaseline?n.fontStyle.textBaseline:`alphabetic`,o=n.fontStyle&&n.fontStyle.color?n.fontStyle.color:`#000000`;if(t.font=r,t.textAlign=i,t.textBaseline=a,n.fontStyle&&n.fontStyle.rotate){let e,r;e=n.fontStyle&&n.fontStyle.width?n.x+Math.floor(n.fontStyle.width/2):n.x,r=n.fontStyle&&n.fontStyle.lineHeight?n.y+Math.floor(n.fontStyle.lineHeight/2):n.y,t.translate(e,r),t.rotate(n.fontStyle.rotate*Math.PI/180),t.translate(e*-1,r*-1)}n.fontStyle&&n.fontStyle.drawType&&n.fontStyle.drawType===`stroke`?(t.strokeStyle=n.fontStyle.color,n.fontStyle&&n.fontStyle.width?this.wrapText(t,n.source,n.x,n.y,n.fontStyle.width,n.fontStyle.lineHeight):t.strokeText(n.source,n.x,n.y)):(t.fillStyle=o,n.fontStyle&&n.fontStyle.width?this.wrapText(t,n.source,n.x,n.y,n.fontStyle.width,n.fontStyle.lineHeight):t.fillText(n.source,n.x,n.y));let s=document.createElement(`canvas`),c=s.getContext(`2d`),l=this.outputWidth===void 0?this.width:this.outputWidth,u=this.outputHeight===void 0?this.height:this.outputHeight;if(s.width=Number(l),s.height=Number(u),c)return c.drawImage(e,0,0,Number(l),Number(u)),this.$emit(`update:image`,s.toDataURL(`image/`+this.saveAs,1)),s.toDataURL(`image/`+this.saveAs,1)}},isEmpty(){return!(this.images.length>0)},getAllStrokes(){return this.images}},render(){return ve(`canvas`,{id:this.canvasId,height:Number(this.height),width:Number(this.width),style:{touchAction:`none`,...this.styles},class:this.classes,onMousedown:e=>this.startDraw(e),onMousemove:e=>this.draw(e),onMouseup:()=>this.stopDraw(),onMouseleave:()=>this.stopDraw(),onTouchstart:e=>this.startDraw(e),onTouchmove:e=>this.draw(e),onTouchend:()=>this.stopDraw(),onTouchleave:()=>this.stopDraw(),onTouchcancel:()=>this.stopDraw(),onPointerdown:e=>this.startDraw(e),onPointermove:e=>this.draw(e),onPointerup:()=>this.stopDraw(),onPointerleave:()=>this.stopDraw(),onPointercancel:()=>this.stopDraw()})}}),Cvt=16,wvt=9,Tvt=(e,t)=>{let n=Math.floor(e-32),r=Math.floor(n*wvt/Cvt);if(n<=0||r<=0)return{size:null,changed:!1,isFirstPaint:!1};let i=n!==t.width||r!==t.height;return{size:{width:n,height:r},changed:i,isFirstPaint:t.width===0}},Evt=(e,t)=>`vdc-${(e??`default`).replace(/[^A-Za-z0-9_-]/g,`-`)}-${t}`;o(),we(),le(),M();var Dvt={class:`w-full h-full flex flex-col bg-white`},Ovt={class:`flex-shrink-0 px-4 py-2 border-b border-gray-100 bg-gray-50`},kvt={class:`flex items-center justify-between gap-4`},Avt={class:`flex items-center gap-4`},jvt={class:`flex items-center gap-2`},Mvt={class:`flex gap-1`},Nvt=[`onClick`],Pvt={class:`flex items-center gap-2`},Fvt={class:`flex items-center gap-1`},Ivt={key:0,class:`text-xs text-red-600 bg-red-50 border border-red-200 rounded px-2 py-1 mr-1`,role:`alert`,"data-testid":`canvas-save-failed`},Lvt=[`title`],Rvt=[`title`],zvt=[`title`],Bvt={class:`flex items-center gap-2 flex-wrap mt-3`},Vvt={class:`text-xs text-gray-500 mr-1`},Hvt=[`onClick`],Uvt=K({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},setup(e){let t=PL(`imageStore`),{t:n}=We(),i=e,a=[{id:`ghibli`,label:`Ghibli`},{id:`ukiyoe`,label:`Ukiyoe`},{id:`sumie`,label:`Sumi-e`},{id:`picasso`,label:`Picasso`},{id:`gogh`,label:`Van Gogh`},{id:`photo`,label:`Photo-realistic`},{id:`watercolor`,label:`Watercolor`},{id:`popart`,label:`Pop Art`},{id:`american`,label:`American Comic`},{id:`cyberpunk`,label:`Cyberpunk`},{id:`pencilsketch`,label:`Pencil Sketch`},{id:`pixelart`,label:`Pixel Art`}],o=V(null),s=V(null),l=V(5),d=V(`#000000`),f=V(0),p=V(0),h=V(0),g=m(()=>Evt(i.selectedResult?.uuid,h.value)),v=V(!1),y=m(()=>{let e=i.selectedResult?.data?.imageData;return!e||e.startsWith(`data:`)?``:e}),x=e=>{let t=y.value,r=t?n(`pluginCanvas.stylePromptWithPath`,{path:t,style:e.label}):n(`pluginCanvas.stylePromptNoPath`,{style:e.label});i.sendTextMessage?.(r)},C=Date.now(),w=m(()=>{if(!y.value)return;let e=tL(y.value);return`${e}${e.includes(`?`)?`&`:`?`}mt=${C}-${h.value}`}),E=!1,O=!1;async function k(e){let n=await hN(t.update,{relativePath:y.value,imageData:e});if(!n.ok)throw Error(`PUT failed: ${n.error}`);Zlt(y.value)}async function A(){if(o.value&&y.value){if(E){O=!0;return}E=!0;try{await k(await o.value.save()),v.value=!1}catch(e){console.error(`Failed to save drawing:`,e),v.value=!0}finally{E=!1,O&&(O=!1,A())}}}let j=()=>{o.value?.undo(),setTimeout(A,50)},M=()=>{o.value?.redo(),setTimeout(A,50)},N=async()=>{if(o.value?.reset(),!y.value)return;let e=document.createElement(`canvas`);e.width=f.value,e.height=p.value;let t=e.getContext(`2d`);if(t){t.fillStyle=`#FFFFFF`,t.fillRect(0,0,e.width,e.height);try{await k(e.toDataURL(`image/png`)),v.value=!1,h.value++}catch(e){console.error(`Failed to clear drawing:`,e),v.value=!0}}},F=()=>{let e=s.value;if(!e)return;let{size:t,changed:n,isFirstPaint:r}=Tvt(e.getBoundingClientRect().width,{width:f.value,height:p.value});t&&n&&(f.value=t.width,p.value=t.height,r||h.value++)};return P(async()=>{await be(),F(),window.addEventListener(`resize`,F)}),_(()=>{window.removeEventListener(`resize`,F)}),(t,i)=>(B(),U(`div`,Dvt,[S(`div`,Ovt,[S(`div`,kvt,[S(`div`,Avt,[S(`div`,jvt,[S(`div`,Mvt,[(B(),U(D,null,H([2,5,10,20],e=>S(`button`,{key:e,class:c([`w-8 h-8 rounded border-2 transition-colors`,l.value===e?`border-blue-500 bg-blue-100`:`border-gray-300 bg-white hover:bg-gray-50`]),onClick:t=>l.value=e},[S(`div`,{class:`bg-gray-800 rounded-full mx-auto`,style:xe({width:Math.max(2,e*1)+`px`,height:Math.max(2,e*1)+`px`})},null,4)],10,Nvt)),64))])]),S(`div`,Pvt,[u(S(`input`,{"onUpdate:modelValue":i[0]||=e=>d.value=e,type:`color`,class:`w-12 h-8 rounded border border-gray-300`},null,512),[[Fe,d.value]])])]),S(`div`,Fvt,[v.value?(B(),U(`span`,Ivt,T(q(n)(`pluginCanvas.saveFailed`)),1)):b(``,!0),S(`button`,{class:`w-8 h-8 flex items-center justify-center rounded border-2 border-gray-300 bg-white hover:bg-gray-50`,title:q(n)(`pluginCanvas.undo`),onClick:j},[...i[1]||=[S(`span`,{class:`material-icons text-sm`},`undo`,-1)]],8,Lvt),S(`button`,{class:`w-8 h-8 flex items-center justify-center rounded border-2 border-gray-300 bg-white hover:bg-gray-50`,title:q(n)(`pluginCanvas.redo`),onClick:M},[...i[2]||=[S(`span`,{class:`material-icons text-sm`},`redo`,-1)]],8,Rvt),S(`button`,{class:`w-8 h-8 flex items-center justify-center rounded border-2 border-red-300 bg-white hover:bg-red-50`,title:q(n)(`pluginCanvas.clear`),onClick:N},[...i[3]||=[S(`span`,{class:`material-icons text-sm`},`delete`,-1)]],8,zvt)])])]),S(`div`,{ref_key:`containerRef`,ref:s,class:`flex-1 p-4 overflow-hidden`},[f.value>0?(B(),ke(q(Svt),r({ref_key:`canvasRef`,ref:o,key:`${e.selectedResult?.uuid||`default`}-${h.value}`,"canvas-id":g.value,width:f.value,height:p.value,"stroke-type":`dash`,"line-cap":`round`,"line-join":`round`,"fill-shape":!1,eraser:!1,"line-width":l.value,color:d.value,"background-color":`#FFFFFF`},w.value===void 0?{}:{backgroundImage:w.value},{"save-as":`png`,styles:{border:`1px solid #ddd`,borderRadius:`8px`},lock:!1,onMouseup:A,onMouseleave:A,onTouchend:A,onTouchcancel:A}),null,16,[`canvas-id`,`width`,`height`,`line-width`,`color`])):b(``,!0),S(`div`,Bvt,[S(`span`,Vvt,T(q(n)(`pluginCanvas.styleLabel`)),1),(B(),U(D,null,H(a,e=>S(`button`,{key:e.id,class:`px-3 py-1.5 text-xs rounded-full border border-gray-300 bg-white hover:bg-blue-50 hover:border-blue-400 transition-colors`,onClick:t=>x(e)},T(e.label),9,Hvt)),64))])],512)]))}});o(),M(),we();var Wvt={class:`w-full h-full overflow-y-auto`},Gvt={class:`min-h-full flex flex-col items-center justify-center p-4`},Kvt={key:0,class:`flex-1 flex items-center justify-center min-h-0`},qvt=[`src`,`alt`],Jvt={key:1,class:`flex-1 flex items-center justify-center text-gray-400 text-sm`},Yvt={key:2,class:`mt-4 p-3 bg-gray-100 rounded-lg max-w-full flex-shrink-0`},Xvt={class:`text-sm text-gray-700`},Zvt={class:`font-medium`},Qvt=K({__name:`ImageView`,props:{selectedResult:{},alt:{default:`Image`},promptLabel:{default:`Prompt`}},setup(e){let{t}=We(),n=e,r=m(()=>n.selectedResult.data?.imageData?tut(n.selectedResult.data.imageData):``);return(n,i)=>(B(),U(`div`,Wvt,[S(`div`,Gvt,[r.value?(B(),U(`div`,Kvt,[S(`img`,{src:r.value,class:`max-w-full max-h-full object-contain rounded`,alt:e.alt},null,8,qvt)])):(B(),U(`div`,Jvt,T(q(t)(`common.noImageYet`)),1)),e.selectedResult.data?.prompt?(B(),U(`div`,Yvt,[S(`p`,Xvt,[S(`span`,Zvt,T(q(t)(`pluginUiImage.promptLabel`,{label:e.promptLabel})),1),J(` `+T(e.selectedResult.data.prompt),1)])])):b(``,!0)])]))}});o(),M(),we();var $vt={class:`min-h-24 flex items-center justify-center`},eyt=[`src`,`alt`],tyt={key:1,class:`text-gray-400 text-sm`},BL=K({__name:`ImagePreview`,props:{result:{},alt:{default:`Image`}},setup(e){let{t}=We(),n=e,r=m(()=>n.result.data?.imageData?tut(n.result.data.imageData):``);return(n,i)=>(B(),U(`div`,$vt,[r.value?(B(),U(`img`,{key:0,src:r.value,class:`max-w-full h-auto rounded`,alt:e.alt},null,8,eyt)):(B(),U(`div`,tyt,T(q(t)(`common.noImageYet`)),1))]))}});o(),M();var nyt=K({__name:`Preview`,props:{result:{}},setup(e){return(t,n)=>(B(),ke(q(BL),{result:e.result,alt:`Canvas drawing`},null,8,[`result`]))}}),ryt={toolName:RL,entry:{toolDefinition:vvt,execute:zL(`canvas`,`dispatch`,RL),isEnabled:()=>!0,generatingMessage:`Opening drawing canvas...`,viewComponent:IL(`canvas`,Uvt),previewComponent:IL(`canvas`,nyt)}},iyt=120;function ayt(e,t){if(!e)return t;let n=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`),r=0,i=n.length;for(;r<i&&n[r]===`-`;)r+=1;for(;i>r&&n[i-1]===`-`;)--i;for(i-r>iyt&&(i=r+iyt);i>r&&n[i-1]===`-`;)--i;return n.slice(r,i)||t}function oyt(e=new Date){return`${e.getUTCFullYear()}/${String(e.getUTCMonth()+1).padStart(2,`0`)}`}function VL(e){let{dir:t,title:n,ext:r,fallback:i,now:a=new Date,partitioned:o=!0,suffix:s}=e,c=s?`${a.getTime()}-${s}`:`${a.getTime()}`,l=`${ayt(n,i)}-${c}${r}`;return(o?[t,oyt(a),l]:[t,l]).join(`/`)}function HL(e){return`${Ke}/${e}`}function UL(e){return e.split(/[/\\]/).some(e=>e===``||e===`.`||e===`..`)}var syt=/^[a-zA-Z]:[\\/]/;function cyt(e){return e.startsWith(`/`)||e.startsWith(`\\`)||syt.test(e)}function WL(e,t){if(!e||e.includes(`\0`))return null;let n=e.toLowerCase();if(!t.some(e=>n.endsWith(e)))return null;let r=cyt(e),i=e.split(/[/\\]/),a=r?i.slice(i.findIndex(e=>e.length>0)):i;return a.length===0||a.some(e=>e===``||e===`.`||e===`..`)?null:r?`absolute`:`relative`}function lyt(e){return e.split(/[/\\]/).some(e=>e.startsWith(`.`))}var uyt={type:`function`,name:`presentChart`,description:"Save and present one or more Apache ECharts visualizations as a single document. Use this for line, bar, area, scatter, pie, candlestick, heatmap, sankey, or graph/network charts — anything ECharts supports. Pass ECharts option object(s) directly; the plugin calls setOption on each one. Use `charts: []` array form even for a single chart so multi-chart dashboards share the same slug.",parameters:{type:`object`,properties:{document:{type:`object`,description:`Chart document. Contains an optional title and an array of chart entries. Each entry has its own ECharts option object that the UI renders independently.`,properties:{title:{type:`string`,description:`Optional human-friendly title for the whole document. Used to derive the file slug and as the preview label.`},charts:{type:`array`,description:`List of charts to render, in order. Each charts[i].option is passed as-is to ECharts' setOption().`,items:{type:`object`,properties:{title:{type:`string`,description:`Optional short label for this specific chart (shown above it in the UI).`},type:{type:`string`,description:`Informational tag shown in the UI (e.g. 'line', 'bar', 'candlestick', 'sankey'). The actual chart type is determined by option.series[].type.`},option:{type:`object`,description:`Full ECharts option object. Include all series, axes, tooltip, legend, dataset — anything ECharts accepts. Keep data inline; large datasets are fine.`}},required:[`option`]}}},required:[`charts`]},title:{type:`string`,description:`Short label shown in the canvas preview sidebar. Defaults to document.title, or 'Chart' when both are blank.`}},required:[`document`]}},dyt=`charts`,fyt=`chart`;function pyt(e,t=new Date){let n=VL({dir:dyt,title:e,ext:`.chart.json`,fallback:fyt,now:t});return{relPath:n,filePath:HL(n)}}function GL(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function KL(e){return e===void 0||typeof e==`string`}function myt(e){return!GL(e)||!KL(e.title)||!KL(e.type)?!1:GL(e.option)}function hyt(e){return!GL(e)||!KL(e.title)||!Array.isArray(e.charts)||e.charts.length===0?!1:e.charts.every(e=>myt(e))}var gyt={toolDefinition:uyt,execute:async(e,t)=>{if(!GL(t))return{message:"presentChart args must be an object containing a `document`",instructions:`Acknowledge the error and retry with { document: { charts: [{ option: {...} }] } }.`};let{document:n,title:r}=t;if(!hyt(n))return{message:`document must be { charts: [{ option: {...}, title?, type? }, ...] } with at least one entry`,instructions:`Acknowledge that the chart could not be created and retry with a valid ECharts document shape.`};if(r!==void 0&&typeof r!=`string`)return{message:`title must be a string when provided`,instructions:`Acknowledge the error and retry with a string title (or omit it).`};let{relPath:i,filePath:a}=pyt(r??n.title??`chart`);await e.files.artifacts.write(i,`${JSON.stringify(n,null,2)}\n`);let o=n.charts.length;return{message:`Saved chart document to ${a}`,data:{document:n,title:r,filePath:a},instructions:`Acknowledge that the chart(s) have been presented to the user. The document contains ${o} chart${o===1?``:`s`}.`}},generatingMessage:`Rendering chart…`,isEnabled:()=>!0};o(),M(),we();var _yt=Je({de:{untitled:`Diagramm`,chartCount:e=>`${e} Diagramm${e===1?``:`e`}`,chartTitle:e=>`Diagramm ${e}`,png:`PNG`},en:{untitled:`Chart`,chartCount:e=>`${e} chart${e===1?``:`s`}`,chartTitle:e=>`Chart ${e}`,png:`PNG`},es:{untitled:`Gráfico`,chartCount:e=>`${e} gráfico${e===1?``:`s`}`,chartTitle:e=>`Gráfico ${e}`,png:`PNG`},fr:{untitled:`Graphique`,chartCount:e=>`${e} graphique${e===1?``:`s`}`,chartTitle:e=>`Graphique ${e}`,png:`PNG`},ja:{untitled:`チャート`,chartCount:e=>`${e} チャート`,chartTitle:e=>`チャート ${e}`,png:`PNG`},ko:{untitled:`차트`,chartCount:e=>`${e}개 차트`,chartTitle:e=>`차트 ${e}`,png:`PNG`},"pt-BR":{untitled:`Gráfico`,chartCount:e=>`${e} gráfico${e===1?``:`s`}`,chartTitle:e=>`Gráfico ${e}`,png:`PNG`},zh:{untitled:`图表`,chartCount:e=>`${e} 个图表`,chartTitle:e=>`图表 ${e}`,png:`PNG`}}),vyt={class:`h-full flex flex-col overflow-hidden`},yyt={class:`px-4 py-2 border-b border-gray-100 shrink-0 flex items-center justify-between`},byt={class:`text-sm font-medium text-gray-700 truncate`},xyt={class:`text-xs text-gray-500 shrink-0`},Syt={class:`flex-1 overflow-y-auto p-4 space-y-4`},Cyt=[`data-testid`],wyt={class:`px-3 py-2 border-b border-gray-100 flex items-center justify-between gap-2`},Tyt={class:`flex items-center gap-2 min-w-0`},Eyt={class:`text-sm font-medium text-gray-800 truncate`},Dyt={key:0,class:`text-[10px] uppercase tracking-wide rounded px-1.5 py-0.5 bg-blue-50 text-blue-700 shrink-0`},Oyt=[`data-testid`,`onClick`],kyt=[`data-testid`],Ayt=K({__name:`View`,props:{selectedResult:{}},setup(e){let t=_yt(),n=e,r=m(()=>n.selectedResult.data),i=m(()=>r.value?.document?.charts??[]),a=m(()=>r.value?.title??r.value?.document?.title),o=V([]),s=[];function c(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function l(e,t){o.value[e]=t}function u(){for(let e of s)e?.dispose();s.length=0}function d(e){let{dataZoom:t}=e;if(t==null)return e;let n=e=>c(e)?{...e,zoomOnMouseWheel:!1,moveOnMouseWheel:!1}:e,r=Array.isArray(t)?t.map(n):n(t);return{...e,dataZoom:r}}function f(){u();for(let e=0;e<i.value.length;e+=1){let t=o.value[e],n=i.value[e];if(!t||!n){s[e]=void 0;continue}let r=$S(t);try{r.setOption(d(n.option))}catch{}s[e]=r}}function p(){for(let e of s)e?.resize()}P(()=>{queueMicrotask(f),window.addEventListener(`resize`,p)}),k(()=>{window.removeEventListener(`resize`,p),u()}),Ve(()=>r.value?.filePath,()=>queueMicrotask(f));function h(e,t){let n=s[e];if(!n)return;let r=n.getDataURL({type:`png`,pixelRatio:2,backgroundColor:`#ffffff`}),i=(t??a.value??`chart`).toLowerCase().replace(/[^a-z0-9-]+/g,`-`);for(;i.startsWith(`-`);)i=i.slice(1);for(;i.endsWith(`-`);)i=i.slice(0,-1);i||=`chart`;let o=document.createElement(`a`);o.href=r,o.download=`${i}-${e+1}.png`,document.body.appendChild(o),o.click(),document.body.removeChild(o)}return(e,n)=>(B(),U(`div`,vyt,[S(`div`,yyt,[S(`span`,byt,T(a.value??q(t).untitled),1),S(`span`,xyt,T(q(t).chartCount(i.value.length)),1)]),S(`div`,Syt,[(B(!0),U(D,null,H(i.value,(e,r)=>(B(),U(`div`,{key:r,class:`border border-gray-200 rounded-lg bg-white`,"data-testid":`chart-card-${r}`},[S(`div`,wyt,[S(`div`,Tyt,[S(`span`,Eyt,T(e.title??q(t).chartTitle(r+1)),1),e.type?(B(),U(`span`,Dyt,T(e.type),1)):b(``,!0)]),S(`button`,{class:`px-2 py-1 text-xs rounded border border-gray-300 text-gray-500 hover:bg-gray-50 shrink-0`,"data-testid":`chart-export-png-${r}`,onClick:t=>h(r,e.title)},[n[0]||=S(`span`,{class:`material-icons text-sm align-middle`},`download`,-1),J(` `+T(q(t).png),1)],8,Oyt)]),S(`div`,{ref_for:!0,ref:e=>l(r,e),class:`w-full h-[400px]`,"data-testid":`chart-canvas-${r}`},null,8,kyt)],8,Cyt))),128))])]))}}),jyt={class:`p-2 text-sm`},Myt={class:`font-medium text-gray-700 truncate mb-1`},Nyt={key:0,class:`text-xs text-gray-500 leading-relaxed truncate`},Pyt=K({__name:`Preview`,props:{result:{}},setup(e){let t=e,n=m(()=>t.result.data),r=m(()=>n.value?.title??n.value?.document?.title??`Chart`),i=m(()=>{let e=n.value?.document?.charts??[];if(e.length===0)return``;let t=e.map(e=>e.type??a(e.option)).filter(e=>!!e).slice(0,3),r=e.length>t.length?`, …`:``,i=t.join(`, `),o=e.length===1?``:`s`,s=i?`: ${i}${r}`:``;return`${e.length} chart${o}${s}`});function a(e){let{series:t}=e;if(Array.isArray(t)&&t.length>0){let e=t[0];if(typeof e.type==`string`)return e.type}else if(t&&typeof t==`object`){let e=t.type;if(typeof e==`string`)return e}return null}return(e,t)=>(B(),U(`div`,jyt,[S(`div`,Myt,T(r.value),1),i.value?(B(),U(`div`,Nyt,T(i.value),1)):b(``,!0)]))}});({...gyt});var Fyt=I9e.toolName,Iyt={toolName:Fyt,entry:{toolDefinition:uyt,execute:zL(`chart`,`create`,Fyt),isEnabled:()=>!0,generatingMessage:`Rendering chart…`,viewComponent:IL(`chart`,Ayt),previewComponent:IL(`chart`,Pyt)}},qL=`editImages`,Lyt={type:`function`,name:qL,description:`Edit one or more existing images based on a text prompt. Returns a single new image.`,prompt:`When the user asks to transform or restyle an existing image (e.g. "turn this into a Ghibli-style image", "combine these two photos"), call ${qL} with the workspace-relative paths of the source images in \`imagePaths\` and the edit instructions in \`prompt\`. Use a single-element array for one image; pass two or more paths to combine multiple images.`,parameters:{type:`object`,properties:{prompt:{type:`string`,description:`Description of the edits to be made to the image(s) in English`},imagePaths:{type:`array`,items:{type:`string`},description:`Workspace-relative paths of the source images to edit (e.g. ["artifacts/images/2026/04/abc.png"]). Pass at least one path. Multiple paths are combined into a single result image.`}},required:[`prompt`,`imagePaths`]}},Ryt=`The image service answered with an unrecognized response.`,zyt=e=>Ma(e)&&typeof e.imageData==`string`&&e.imageData.length>0&&Ia(e.prompt),Byt=e=>Ma(e)&&typeof e.message==`string`&&Ia(e.toolName)&&Ia(e.uuid)&&Ia(e.title)&&Ia(e.action)&&Ia(e.instructions)&&La(e.instructionsRequired)&&La(e.updating)&&La(e.cancelled)&&e.jsonData===void 0&&(e.data===void 0||zyt(e.data))&&(e.viewState===void 0||Ma(e.viewState));function Vyt(e,t){let n=xvt(`image`,e,t);return async(e,r)=>{let i=await n(e,r);return Byt(i)?i:{toolName:t,uuid:LL(),message:Ryt}}}o(),M();var Hyt=K({__name:`View`,props:{selectedResult:{}},setup(e){return(t,n)=>e.selectedResult?(B(),ke(q(Qvt),{key:0,"selected-result":e.selectedResult,alt:`Edited image`,"prompt-label":`Edit prompt`},null,8,[`selected-result`])):b(``,!0)}});o(),M();var Uyt=K({__name:`Preview`,props:{result:{}},setup(e){return(t,n)=>(B(),ke(q(BL),{result:e.result,alt:`Edited image`},null,8,[`result`]))}}),Wyt={toolName:qL,entry:{toolDefinition:Lyt,execute:Vyt(`edit`,qL),isEnabled:()=>!0,generatingMessage:`Editing images...`,viewComponent:IL(`image`,Hyt),previewComponent:IL(`image`,Uyt)}},JL=`generateImage`,Gyt={type:`function`,name:JL,description:`Generate an image based on the prompt and display it on the screen. Be descriptive and specify the concrete details of the images in the prompt. Each call generates one image.`,prompt:`When the user asks you to generate, draw, or create an image, use the ${JL} API. You may also offer to generate an image when a visual would clearly enhance the conversation, but do not generate images unsolicited during casual discussion.`,parameters:{type:`object`,properties:{prompt:{type:`string`,description:`A detailed prompt describing the image to generate`}},required:[`prompt`]}};o(),M();var Kyt={"data-testid":`generate-image-view`,class:`w-full h-full`},qyt=K({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},emits:[`updateResult`],setup(e){let t=e,n=V(null);return Ve(()=>t.selectedResult,e=>{e?.toolName===`generateImage`&&e.data&&(n.value=e)},{immediate:!0}),(e,t)=>(B(),U(`div`,Kyt,[n.value?(B(),ke(q(Qvt),{key:0,"selected-result":n.value},null,8,[`selected-result`])):b(``,!0)]))}});o(),M();var Jyt=K({__name:`Preview`,props:{result:{}},setup(e){return(t,n)=>(B(),ke(q(BL),{result:e.result},null,8,[`result`]))}});function Yyt(e,t,n){return{toolName:JL,data:{imageData:e,prompt:n},message:``,title:t}}var Xyt={toolName:JL,entry:{toolDefinition:Gyt,execute:Vyt(`generate`,JL),isEnabled:()=>!0,generatingMessage:`Generating image...`,inputHandlers:[{type:`file`,acceptedTypes:[`image/png`,`image/jpeg`],handleInput:(e,t)=>Yyt(e,t,``)},{type:`clipboard-image`,handleInput:e=>Yyt(e,`clipboard-image.png`,``)}],viewComponent:IL(`image`,qyt),previewComponent:IL(`image`,Jyt)}},YL=z9e.toolName,Zyt={type:`function`,name:YL,description:`List, save, update, or delete Claude Code skills. Discovery covers ~/.claude/skills/ (user), <workspace>/.claude/skills/ (project) and the skills of installed Claude Code plugins, which are listed as <plugin>:<skill>. Only the project scope is writable, so save, update, and delete affect only those; everything else is read-only.`,prompt:`Use the ${YL} tool for the user's skill library:\n\n- **list** (default, no args): show every available skill in the canvas.\n- **save**: when the user asks to turn the current conversation into a skill (e.g. "skill 化して" / "save this as a skill"), do these steps:\n 1. Read the current chat transcript via the Read tool. The path is \`chat/<session-id>.jsonl\` under the workspace; if you don't know the session id, list \`chat/\` first.\n 2. Distill the conversation into a short markdown body explaining the steps you took, in second person ("First, do X. Then, do Y."). Keep it focused on the reusable workflow, not the one-off details.\n 3. Pick a kebab-case slug (lowercase letters, digits, hyphens; no leading/trailing hyphen; 1-64 chars). If the user gave a name in the request, use it.\n 4. Write a one-line description for the YAML frontmatter.\n 5. Call ${YL} with \`{action: "save", name, description, body}\`. Saves go to <workspace>/.claude/skills/<slug>/SKILL.md.\n 6. If the response says the name already exists, ask the user for a different one.\n- **update**: when the user asks to modify an existing skill (e.g. "〇〇のスキルを更新して" / "change the description of X"), call \`{action: "update", name, description, body}\`. Only project-scope skills can be updated; user-scope and plugin skills are read-only. You must provide both description and body (read the current skill first via list or the Read tool if you only need to change part of it).\n- **delete**: when the user asks to remove a named skill, call \`{action: "delete", name}\`. Only project-scope skills can be deleted; user-scope and plugin skills are protected.\n\n**IMPORTANT**: NEVER edit SKILL.md files directly with the Edit or Write tools. Always use this ${YL} tool with the appropriate action. Direct file edits bypass validation and won't refresh the skills UI.`,parameters:{type:`object`,properties:{action:{type:`string`,enum:[`list`,`save`,`update`,`delete`],description:`The operation to perform. Default: list (show all skills).`},name:{type:`string`,description:`Skill slug. Required for save and delete. Lowercase letters, digits, and hyphens only; 1-64 chars; no leading/trailing or consecutive hyphens.`},description:{type:`string`,description:`One-line summary for the YAML frontmatter. Required for save.`},body:{type:`string`,description:`Markdown body of the skill (instructions for Claude to follow). Required for save. May be multi-line.`}},required:[`action`]}};function Qyt(e){return e.source===`claude-plugin`?`claude-plugin`:e.source===`user`?`user`:e.name.startsWith(`mc-`)?`system`:`project`}function $yt(e,t){let n=+(e.source===`claude-plugin`),r=+(t.source===`claude-plugin`);return n===r?e.name.localeCompare(t.name):n-r}var ebt=[`active`,`catalog`],tbt=[],nbt=`skills:sectionCollapsed`;function rbt(e){return typeof e==`string`&&ebt.some(t=>t===e)}function ibt(){let e=new Set(tbt);if(typeof window>`u`)return e;try{let t=window.localStorage.getItem(nbt);if(t===null)return e;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(rbt)):e}catch{return e}}function abt(e){if(typeof window<`u`)try{window.localStorage.setItem(nbt,JSON.stringify([...e]))}catch{}}function obt(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}var sbt=`skills:repoCollapsed`;function cbt(){if(typeof window>`u`)return new Set;try{let e=window.localStorage.getItem(sbt);if(e===null)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function lbt(e){if(typeof window<`u`)try{window.localStorage.setItem(sbt,JSON.stringify([...e]))}catch{}}function XL(e,t){if(t.has(`active`))return null;let[n]=e;return n?.name??null}function ubt(e,t,n,r){if(n!==t)return n;if(r.has(`active`))return null;let i=e.findIndex(e=>e.name===t),a=e.filter(e=>e.name!==t);return i===-1||a.length===0?null:a[Math.min(i,a.length-1)]?.name??null}function ZL(e){return e.source===`external`&&e.repoId&&e.skillFolder?`${e.repoId}/${e.skillFolder}`:e.slug}function dbt(e){return e.source===`external`&&e.repoId&&e.skillFolder?{source:`external`,repoId:e.repoId,skillFolder:e.skillFolder}:{source:e.source,slug:e.slug}}function fbt(e,t){let n={url:e},r=t?.trim();return r&&(n.subpath=r),n}function pbt(e,t){return t.map(t=>({repo:t,entries:e.filter(e=>e.repoId===t.repoId).sort((e,t)=>e.slug.localeCompare(t.slug))}))}var mbt=/github\.com\/([^/]+\/[^/]+?)(?:\.git)?\/?$/;function hbt(e){return mbt.exec(e.url)?.[1]??e.repoId}function gbt(e){let t=Qyt(e);return t===`system`?{icon:`lock`,colour:`text-gray-500`,titleKey:`pluginManageSkills.sourceSystemTitle`}:t===`user`?{icon:`home`,colour:`text-blue-500`,titleKey:`pluginManageSkills.sourceUserTitle`}:t===`claude-plugin`?{icon:`extension`,colour:`text-purple-500`,titleKey:`pluginManageSkills.sourceClaudePluginTitle`}:{icon:`folder`,colour:`text-green-600`,titleKey:`pluginManageSkills.sourceProjectTitle`}}var QL={icon:`inventory_2`,colour:`text-gray-400`,titleKey:`pluginManageSkills.sourcePresetTitle`};function _bt(e,t){return e?t.some(t=>t.slug===e&&t.source===`preset`):!1}var vbt=(e,t,n)=>e.map(e=>e.name===t?{...e,description:n}:e),ybt=(e,t)=>e.filter(e=>e.name!==t),bbt=(e,t)=>e===null?{acquired:!0,key:t}:{acquired:!1,key:e},xbt=(e,t)=>e===t?null:e;o(),M();async function Sbt(e){let t=await pN(e.endpoints.catalogList.url);if(!t.ok){e.catalogError.value=e.t(`pluginManageSkills.errCatalogListFailed`,{error:t.error});return}e.catalogError.value=null,Array.isArray(t.data.entries)&&(e.catalogPresets.value=t.data.entries.filter(e=>e.source===`preset`),e.catalogExternal.value=t.data.entries.filter(e=>e.source===`external`))}async function Cbt(e,t){let n=await pN(e.endpoints.catalogPreview.url,dbt(t));return n.ok?(e.catalogError.value=null,n.data.detail):(e.catalogError.value=e.t(`pluginManageSkills.errCatalogPreviewFailed`,{error:n.error}),null)}function wbt(e,t){let{selectedCatalog:n}=e;if(!n.value||ZL(n.value)!==ZL(t))return;let r=(t.source===`external`?e.catalogExternal.value:e.catalogPresets.value).find(e=>ZL(e)===ZL(t));r&&(n.value=r)}async function Tbt(e,t){if(t.alreadyActive)return;let n=ZL(t),{acquired:r,key:i}=bbt(e.catalogActioningKey.value,n);if(r){e.catalogActioningKey.value=i;try{let n=await mN(e.endpoints.catalogStar.url,dbt(t));if(!n.ok){e.catalogError.value=e.t(`pluginManageSkills.errCatalogStarFailed`,{error:n.error});return}e.catalogError.value=null,await Promise.all([Sbt(e),e.deps.refreshActiveList()]),wbt(e,t)}finally{e.catalogActioningKey.value=xbt(e.catalogActioningKey.value,n)}}}async function Ebt(e,t){e.deps.clearActiveSelection(),e.selectedCatalog.value=t,e.catalogDetail.value=null,e.catalogDetailLoading.value=!0;let n=ZL(t),r=await Cbt(e,t);e.selectedCatalog.value&&ZL(e.selectedCatalog.value)===n&&(e.catalogDetailLoading.value=!1,r!==null&&(e.catalogDetail.value=r))}function $L(e){e.selectedCatalog.value=null,e.catalogDetail.value=null}function Dbt(e,t){e.selectedCatalog.value?.repoId===t&&$L(e)}function Obt(e,t){if(e.selectedCatalog.value?.slug!==t)return;let n=e.catalogPresets.value.find(e=>e.slug===t);n&&(e.selectedCatalog.value=n)}function kbt(e){$L(e),e.catalogDetailLoading.value=!1,e.catalogActioningKey.value=null,e.catalogError.value=null}function Abt(){return{catalogPresets:V([]),catalogExternal:V([]),catalogError:V(null),selectedCatalog:V(null),catalogDetail:V(null),catalogDetailLoading:V(!1),catalogActioningKey:V(null)}}function jbt(e){let{t}=We(),n=PL(`skills`),r=Abt(),i=m(()=>r.selectedCatalog.value?ZL(r.selectedCatalog.value):null),a={t,endpoints:n,deps:e,...r};return{...r,selectedCatalogKey:i,loadCatalog:()=>Sbt(a),selectCatalogEntry:e=>Ebt(a,e),starCatalogEntry:e=>Tbt(a,e),clearSelection:()=>$L(a),clearSelectionIfRepo:e=>Dbt(a,e),reconcileAfterDelete:e=>Obt(a,e),reset:()=>kbt(a)}}o(),M();function Mbt(e,t){return!e.repoCollapsed.value.has(t)}function Nbt(e,t){let n=obt(e.repoCollapsed.value,t);e.repoCollapsed.value=n,lbt(n)}async function eR(e){let t=await pN(e.endpoints.externalReposList.url);if(!t.ok){e.repoListError.value=e.t(`pluginManageSkills.errCatalogRepoListFailed`,{error:t.error});return}e.repoListError.value=null,Array.isArray(t.data.repos)&&(e.catalogRepos.value=t.data.repos)}async function Pbt(e){let t=await pN(e.endpoints.externalSuggestions.url);t.ok&&Array.isArray(t.data.suggestions)&&(e.suggestions.value=t.data.suggestions)}function Fbt(e){e.addRepoUrl.value=``,e.addRepoSubpath.value=``,e.addRepoError.value=null,e.selectedSuggestionUrl.value=null,e.addRepoOpen.value=!0,e.suggestions.value.length===0&&Pbt(e)}function Ibt(e,t){e.addRepoUrl.value=t.url,e.addRepoSubpath.value=t.subpath??``,e.addRepoError.value=null,e.selectedSuggestionUrl.value=t.url}async function Lbt(e,t,n){if(e.addRepoBusy.value)return;let r=t.trim();if(r.length===0){e.addRepoError.value=e.t(`pluginManageSkills.errCatalogRepoInvalidUrl`);return}e.addRepoBusy.value=!0,e.addRepoError.value=null;try{let t=await mN(e.endpoints.externalReposInstall.url,fbt(r,n));if(!t.ok){e.addRepoError.value=e.t(`pluginManageSkills.errCatalogRepoInstallFailed`,{error:t.error});return}e.addRepoOpen.value=!1,await Promise.all([eR(e),e.deps.reloadCatalog()])}finally{e.addRepoBusy.value=!1}}async function Rbt(e,t){if(e.uninstallingRepoId.value===null&&e.updatingRepoId.value!==t&&(typeof window>`u`||window.confirm(e.t(`pluginManageSkills.catalogUninstallConfirm`)))){e.uninstallingRepoId.value=t;try{let n=await gN(eP(e.endpoints.externalReposRemove,{repoId:t}));if(!n.ok){e.deps.catalogError.value=e.t(`pluginManageSkills.errCatalogRepoUninstallFailed`,{error:n.error});return}e.deps.catalogError.value=null,e.deps.clearCatalogSelectionForRepo(t),await Promise.all([eR(e),e.deps.reloadCatalog(),e.deps.refreshActiveList()])}finally{e.uninstallingRepoId.value=null}}}async function zbt(e,t){if(e.updatingRepoId.value===null&&e.uninstallingRepoId.value!==t.repoId){e.updatingRepoId.value=t.repoId;try{let n=await mN(e.endpoints.externalReposInstall.url,fbt(t.url,t.subpath));if(!n.ok){e.deps.catalogError.value=e.t(`pluginManageSkills.errCatalogRepoInstallFailed`,{error:n.error});return}e.deps.catalogError.value=null,await Promise.all([eR(e),e.deps.reloadCatalog()])}finally{e.updatingRepoId.value=null}}}function Bbt(e){e.addRepoOpen.value=!1,e.addRepoError.value=null,e.selectedSuggestionUrl.value=null,e.uninstallingRepoId.value=null,e.updatingRepoId.value=null}function Vbt(){return{catalogRepos:V([]),repoListError:V(null),repoCollapsed:t(cbt()),addRepoOpen:V(!1),addRepoUrl:V(``),addRepoSubpath:V(``),addRepoError:V(null),addRepoBusy:V(!1),suggestions:V([]),selectedSuggestionUrl:V(null),uninstallingRepoId:V(null),updatingRepoId:V(null)}}function Hbt(e){let{t}=We(),n=PL(`skills`),r=Vbt(),i={t,endpoints:n,deps:e,...r},a=m(()=>pbt(e.catalogExternal.value,r.catalogRepos.value));return{...r,externalGroups:a,isRepoOpen:e=>Mbt(i,e),toggleRepo:e=>Nbt(i,e),loadExternalRepos:()=>eR(i),openAddRepo:()=>Fbt(i),selectSuggestion:e=>Ibt(i,e),installRepo:(e,t)=>Lbt(i,e,t),uninstallRepo:e=>Rbt(i,e),updateRepo:e=>zbt(i,e),resetModalState:()=>Bbt(i)}}o(),M(),we(),le();var Ubt={class:`bg-white rounded-lg shadow-xl w-full max-w-md p-5`},Wbt={class:`text-base font-semibold text-gray-800 mb-3`},Gbt={class:`block text-xs font-medium text-gray-600 mb-1`},Kbt=[`placeholder`],qbt={class:`block text-xs font-medium text-gray-600 mb-1`},Jbt=[`placeholder`],Ybt={key:0,class:`text-xs text-red-600 mb-3`,"data-testid":`skill-add-repo-error`},Xbt={class:`flex items-center justify-end gap-2 mb-4`},Zbt=[`disabled`],Qbt={key:1},$bt={class:`text-xs font-medium text-gray-600 mb-2`},ext={class:`flex items-start`},txt=[`data-testid`,`aria-pressed`,`onClick`],nxt={class:`font-medium text-gray-700`},rxt=[`href`,`data-testid`,`title`,`aria-label`],ixt=K({__name:`AddRepoModal`,props:Se({error:{},busy:{type:Boolean},suggestions:{},selectedSuggestionUrl:{}},{url:{required:!0},urlModifiers:{},subpath:{required:!0},subpathModifiers:{}}),emits:Se([`close`,`install`,`select-suggestion`],[`update:url`,`update:subpath`]),setup(e,{emit:t}){let{t:n}=We(),r=G(e,`url`),i=G(e,`subpath`),a=t;return(t,o)=>(B(),U(`div`,{class:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4`,"data-testid":`skill-add-repo-modal`,onClick:o[7]||=s(e=>a(`close`),[`self`])},[S(`div`,Ubt,[S(`h3`,Wbt,T(q(n)(`pluginManageSkills.catalogAddRepoTitle`)),1),S(`label`,Gbt,T(q(n)(`pluginManageSkills.catalogRepoUrlLabel`)),1),u(S(`input`,{"onUpdate:modelValue":o[0]||=e=>r.value=e,type:`text`,"data-testid":`skill-add-repo-url`,class:`w-full h-8 px-2 mb-3 text-sm border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:q(n)(`pluginManageSkills.catalogRepoUrlPlaceholder`),onKeydown:o[1]||=l(e=>a(`install`),[`enter`])},null,40,Kbt),[[Fe,r.value]]),S(`label`,qbt,T(q(n)(`pluginManageSkills.catalogRepoSubpathLabel`)),1),u(S(`input`,{"onUpdate:modelValue":o[2]||=e=>i.value=e,type:`text`,"data-testid":`skill-add-repo-subpath`,class:`w-full h-8 px-2 mb-3 text-sm border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:q(n)(`pluginManageSkills.catalogRepoSubpathPlaceholder`),onKeydown:o[3]||=l(e=>a(`install`),[`enter`])},null,40,Jbt),[[Fe,i.value]]),e.error?(B(),U(`p`,Ybt,T(e.error),1)):b(``,!0),S(`div`,Xbt,[S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center text-sm rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,onClick:o[4]||=e=>a(`close`)},T(q(n)(`common.cancel`)),1),S(`button`,{type:`button`,"data-testid":`skill-add-repo-submit`,class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-40`,disabled:e.busy,onClick:o[5]||=e=>a(`install`)},T(e.busy?q(n)(`pluginManageSkills.catalogRepoInstalling`):q(n)(`pluginManageSkills.catalogAddRepoSubmit`)),9,Zbt)]),e.suggestions.length>0?(B(),U(`div`,Qbt,[S(`p`,$bt,T(q(n)(`pluginManageSkills.catalogAddRepoSuggestions`)),1),(B(!0),U(D,null,H(e.suggestions,t=>(B(),U(`div`,{key:t.url,class:c([`mb-1 rounded border`,e.selectedSuggestionUrl===t.url?`border-blue-400 bg-blue-50`:`border-gray-200`])},[S(`div`,ext,[S(`button`,{type:`button`,"data-testid":`skill-add-repo-suggestion-${t.url}`,class:`flex-1 min-w-0 text-left px-3 py-2 text-sm`,"aria-pressed":e.selectedSuggestionUrl===t.url,onClick:e=>a(`select-suggestion`,t)},[S(`div`,nxt,T(t.displayName),1),S(`div`,{class:c([`text-xs text-gray-500`,e.selectedSuggestionUrl===t.url?`whitespace-normal break-words`:`truncate`])},T(t.description),3)],8,txt),S(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`skill-add-repo-suggestion-link-${t.url}`,class:`h-8 w-8 shrink-0 flex items-center justify-center rounded text-gray-400 hover:text-blue-600`,title:q(n)(`pluginManageSkills.catalogRepoOpenLink`),"aria-label":q(n)(`pluginManageSkills.catalogRepoOpenLink`),onClick:o[6]||=s(()=>{},[`stop`])},[...o[8]||=[S(`span`,{class:`material-icons text-sm`,"aria-hidden":`true`},`open_in_new`,-1)]],8,rxt)])],2))),128))])):b(``,!0)])]))}}),axt=1,oxt=e=>e!==null&&`nodeType`in e&&e.nodeType===axt;function sxt(e,t){if(!e.startsWith(`http://`)&&!e.startsWith(`https://`))return!1;try{return new URL(e).origin!==t}catch{return!1}}function tR(e){if(e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey)return!1;let{target:t}=e;if(!oxt(t))return!1;let n=t.closest(`a`);if(!n)return!1;let r=n.href;return sxt(r,window.location.origin)?(e.preventDefault(),window.open(r,`_blank`,`noopener,noreferrer`),!0):!1}function nR(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var rR=nR();function cxt(e){rR=e}var iR={exec:()=>null};function aR(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function oR(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(sR.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var lxt=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),sR={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:aR(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:aR(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:aR(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:aR(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:aR(e=>RegExp(`^ {0,${e}}(?:</?(?:${fR})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:aR(e=>RegExp(`^ {0,${e}}>`))},uxt=/^(?:[ \t]*(?:\n|$))+/,dxt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fxt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,cR=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,pxt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,lR=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,mxt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,hxt=oR(mxt).replace(/bull/g,lR).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),gxt=oR(mxt).replace(/bull/g,lR).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),uR=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,_xt=/^[^\n]+/,dR=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,vxt=oR(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,dR).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),yxt=oR(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,lR).getRegex(),fR=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,pR=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,bxt=oR(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,pR).replace(`tag`,fR).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xxt=e=>oR(uR).replace(`hr`,cR).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,fR).getRegex(),Sxt=xxt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Cxt=xxt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),mR={blockquote:oR(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Cxt).getRegex(),code:dxt,def:vxt,fences:fxt,heading:pxt,hr:cR,html:bxt,lheading:hxt,list:yxt,newline:uxt,paragraph:Sxt,table:iR,text:_xt},wxt=oR(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,cR).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,fR).getRegex(),Txt={...mR,lheading:gxt,table:wxt,paragraph:oR(uR).replace(`hr`,cR).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,wxt).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,fR).getRegex()},Ext={...mR,html:oR(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,pR).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:iR,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:oR(uR).replace(`hr`,cR).replace(`heading`,` *#{1,6} *[^
264
+ /workspace/path`,errNoName:`Bitte einen Namen angeben oder eine URL / Argumente eingeben, aus denen sich einer ableiten lässt.`,errBadName:`Der Name muss mit einem Kleinbuchstaben beginnen und darf nur [a-z0-9_-] enthalten.`,errIdExists:`Die Server-ID "{id}" existiert bereits.`,errBadHttpUrl:`Die HTTP-URL muss mit http:// oder https:// beginnen`,pendingEntryWarning:`Schließen Sie den ausstehenden MCP-Servereintrag zuerst ab oder brechen Sie ihn ab.`,customHeading:`Benutzerdefinierte Server`,catalog:{heading:`Vorkonfigurierte MCP-Server`,audience:{general:`🟢 Allgemein`,developer:`🔵 Entwickler`},risk:{low:`niedrig`,medium:`mittel`,high:`hoch`},upstream:`📦 Quelle`,setupGuide:`📚 Einrichtung`,entry:{memory:{displayName:`Memory`,description:`Lässt Claude den Gesprächskontext über Sitzungen hinweg merken.`},sequentialThinking:{displayName:`Sequenzielles Denken`,description:`Hilft Claude, komplexe Probleme schrittweise zu lösen.`},context7:{displayName:`Context7 (Bibliotheksdokumentation)`,description:`Aktuelle Dokumentation gängiger Bibliotheken — geht über das Trainings-Cutoff des Modells hinaus.`},deepwiki:{displayName:`DeepWiki (Wiki für GitHub-Repositories)`,description:`Stelle Fragen zu beliebigen GitHub-Repositories und erhalte eine strukturierte Antwort im Wiki-Stil.`},notion:{displayName:`Notion`,description:`Lese und schreibe in deinem Notion-Workspace — Seiten, Datenbanken und Suche.`,field:{apiKey:{label:`Notion-Integrationstoken`,help:`Erstelle eine Notion-Integration und kopiere das Internal Integration Secret. 🔑 öffnet die Integrationen-Seite.`}}},slack:{displayName:`Slack`,description:`Kanäle auflisten, Nachrichten senden und den Verlauf deines Slack-Workspaces durchsuchen.`,field:{botToken:{label:`Bot-Token`,help:`Slack-App → OAuth & Permissions → Bot User OAuth Token. Beginnt mit xoxb-.`},teamId:{label:`Team- / Workspace-ID`,help:`Rufe team.info auf oder prüfe die Workspace-URL — etwa T01ABC23DEF.`}}},googleMaps:{displayName:`Google Maps`,description:`Orte suchen, Routen berechnen und Standortdetails abrufen.`,field:{apiKey:{label:`Google-Maps-API-Key`,help:`Google Cloud Console → APIs & Services → Credentials → API-Key erstellen. Aktiviere Places + Directions.`}}},appleNative:{displayName:`Native Apple-Apps (macOS)`,description:`Liest und schreibt Erinnerungen, Kalender, Notizen, Mail und Karten via AppleScript. Nur macOS — keine Zugangsdaten nötig.`},gmail:{displayName:`Gmail`,description:`Liest, sendet und beschriftet dein Gmail. Nutzt einen Google-OAuth-Client, den du selbst in deinem eigenen Google-Cloud-Projekt erstellst (keine App-Verifizierung nötig).`,field:{credentials:{label:`Pfad zu credentials.json`,help:`Google Cloud Console → APIs & Services → Credentials → OAuth-Client-ID (Desktop app). Lade credentials.json herunter und füge den absoluten Pfad ein.`}}},googleCalendar:{displayName:`Google Kalender`,description:`Liest und erstellt Termine im Google Kalender. Gleiches BYO-credentials.json-Muster wie Gmail.`,field:{credentials:{label:`Pfad zu credentials.json`,help:`Verwende denselben Google-Cloud-OAuth-Client wie Gmail, oder erstelle einen separaten nur für Calendar.`}}},googleDrive:{displayName:`Google Drive`,description:`Sucht und liest Google-Drive-Dateien. BYO Google-OAuth-Zugangsdaten — Token wird lokal neben der Datei zwischengespeichert.`,field:{credentials:{label:`Pfad zu credentials.json`,help:`Google Cloud Console → APIs & Services → Credentials → OAuth-Client-ID (Desktop app). Aktiviere die Google-Drive-API im selben Projekt.`}}},github:{displayName:`GitHub`,description:"Liest Repos, Issues, PRs und führt Suchen mit einem Personal Access Token aus. Begrenze den Token-Scope — Schreibrechte (z.B. `repo`) erlauben dem Agenten Pushes auf jeden zugänglichen Repo.",field:{token:{label:`Personal Access Token`,help:`GitHub → Settings → Developer settings → Personal access tokens. Bevorzuge fine-grained tokens, die nur auf Repos beschränkt sind, in denen der Agent arbeiten soll.`}}},linear:{displayName:`Linear`,description:`Liest und aktualisiert Linear-Issues, -Projekte und -Cycles mit einem persönlichen API-Key.`,field:{apiKey:{label:`Linear-API-Key`,help:`Linear → Settings → API → Personal API keys. Klicke auf 🔑, um die Seite zu öffnen, und dann auf Create key.`}}},weatherOpenMeteo:{displayName:`Wetter (Open-Meteo)`,description:`Kostenlose Wettervorhersagen und aktuelle Bedingungen weltweit — ohne API-Key.`},spotify:{displayName:`Spotify`,description:`Suche Tracks, verwalte Playlists, steuere die Wiedergabe. BYO Spotify-Developer-App — nur Client ID (PKCE-Flow, kein Client Secret nötig).`,field:{clientId:{label:`Client ID`,help:"Spotify Developer Dashboard → Create app, setze die Redirect URI auf http://127.0.0.1:8888/callback, kopiere die Client ID. Führe dann einmal im Terminal `SPOTIFY_CLIENT_ID=<id> npx spotify-mcp@latest auth` aus, um dich anzumelden (Refresh-Token wird in ~/.spotify-mcp/tokens.json gecacht)."}}},youtubeTranscript:{displayName:`YouTube-Transkript`,description:`Holt die Untertitel zu jedem öffentlichen YouTube-Video per URL. Keine Zugangsdaten nötig.`}},config:{howToGet:`So erhältst du den Wert`,install:`Installieren`,errMissingRequired:`Pflichtfelder fehlen: {fields}`,requiredMarker:`*`,requiredAria:`Pflichtfeld`}}},pluginScheduler:{previewIcon:`📅`,previewAutomations:`{count} Automatisierung | {count} Automatisierungen`,previewMore:`+ {count} weitere…`},pluginSchedulerTasks:{recommendedFrequencies:`Empfohlene Häufigkeiten`,tableTaskType:`Aufgabentyp`,tableSuggestedSchedule:`Empfohlener Zeitplan`,noTasks:`Keine geplanten Aufgaben`,runNow:`Jetzt ausführen`,enable:`Aktivieren`,disable:`Deaktivieren`,delete:`Löschen`,nextRun:`Nächste: {time}`,originSystem:`System`,originUser:`Benutzer`,originSkill:`Skill`,runFailed:`Ausführung fehlgeschlagen: {error}`,toggleFailed:`Umschalten fehlgeschlagen: {error}`,deleteFailed:`Löschen fehlgeschlagen: {error}`,detailsToggle:`Details anzeigen`,promptLabel:`Prompt`,roleLabel:`Rolle`,confirmDelete:`Aufgabe {name} löschen? Dies kann nicht rückgängig gemacht werden.`,hintNewsRss:`News- / RSS-Abruf`,hintJournal:`Täglicher Journallauf`,hintWiki:`Wiki-Wartung`,hintMemory:`Speicherextraktion`,hintCalendar:`Kalender- / Kontaktsynchronisierung`},pluginCanvas:{undo:`Rückgängig`,redo:`Wiederherstellen`,clear:`Löschen`,styleLabel:`Stil:`,stylePromptWithPath:"Wandle das Bild unter `{path}` in ein Bild im {style}-Stil um.",stylePromptNoPath:`Wandle meine Zeichnung auf dem Canvas in ein Bild im {style}-Stil um.`,saveFailed:`Nicht gespeichert`},pluginWiki:{backToIndex:`Zurück zum Index`,pdf:`PDF`,pdfFailed:`⚠ PDF fehlgeschlagen`,tabIndex:`Index`,tabLog:`Protokoll`,tabLint:`Lint`,tabGraph:`Graph`,graphEmpty:`Noch keine Verknüpfungen für den Graphen.`,linkedReferences:`Eingehende Verweise`,empty:`Das Wiki ist leer. Bitten Sie den Wiki Manager, eine Quelle einzulesen.`,previewMore:`+ {count} weitere…`,chatPlaceholder:`Fragen Sie zu dieser Seite…`,emptyPage:`Die Seite „{title}“ existiert noch nicht.`,emptyContent:`Die Seite „{title}“ existiert, hat aber keinen Inhalt.`,createPage:`Erstellung dieser Wiki-Seite anfordern`,updatePage:`Aktualisierung dieser Wiki-Seite anfordern`,tagFilterAll:`Alle`,noMatches:`Keine Seiten mit dem Tag #{tag}`,lintChat:`Wiki prüfen`,taskCountMismatch:`Wiki-Quelle und gerendertes Ergebnis stimmen in der Anzahl der Aufgaben nicht überein. Die Umschaltung wurde abgelehnt, um eine Beschädigung der Datei zu vermeiden.`,metadataCreated:`Erstellt`,metadataUpdated:`Aktualisiert`,metadataEditor:`Bearbeiter`,pageEditHeader:`Wiki-Bearbeitung`,snapshotExpired:`Snapshot abgelaufen — aktuelle Seite wird angezeigt`,snapshotLoadError:`Snapshot konnte nicht geladen werden — die Seite existiert möglicherweise noch. Bitte aktualisieren.`,pageDeleted:`Seite gelöscht`,history:{tabContent:`Inhalt`,tabHistory:`Verlauf`,empty:`Noch kein Verlauf — bearbeite diese Seite, und die erste Version erscheint hier.`,loading:`Verlauf wird geladen…`,backToList:`Zurück zum Verlauf`,restoreButton:`Diese Version wiederherstellen`,restoreConfirmTitle:`Diese Version wiederherstellen?`,restoreConfirmBody:`Seite auf die Version vom {ts} von {editor} zurücksetzen. Die aktuelle Seite wird ersetzt. Der bestehende Verlauf bleibt erhalten.`,restoreConfirmAction:`Wiederherstellen`,restoreConfirmCancel:`Abbrechen`,restoreSuccessToast:`Seite wiederhergestellt.`,restoreFailureBanner:`Wiederherstellung fehlgeschlagen: {error}`,compareCurrent:`Mit aktueller Seite vergleichen`,comparePrevious:`Mit vorheriger Version vergleichen`,diffNoPrevious:`Keine vorherige Version zum Vergleichen vorhanden.`,diffNoChanges:`Zwischen dieser Version und dem Vergleichsobjekt gibt es keine inhaltlichen Unterschiede.`,editorBadgeUser:`Benutzer`,editorBadgeLLM:`LLM`,editorBadgeSystem:`System`,hiddenLines:`{count} unveränderte Zeilen ausgeblendet`,expandHidden:`Anzeigen`}},pluginPresentForm:{fallbackTitle:`Formular`,fieldCount:`{count} Feld | {count} Felder`,submitted:`Gesendet`,errorSummary:`Bitte korrigieren Sie die folgenden Fehler`,requiredMarker:`*`,selectOption:`Bitte auswählen`,charactersCount:`{current} / {max} Zeichen`,charactersCountNoMax:`{current} Zeichen`,submit:`Senden`,progress:`{filled} von {total} Pflichtfeldern ausgefüllt`},pluginPresentSvg:{saveAsPng:`Als PNG herunterladen`,png:`PNG`,saveAsPdf:`Als PDF speichern (öffnet Druckdialog)`,pdf:`PDF`,untitled:`SVG-Zeichnung`,editSource:`SVG-Quelltext bearbeiten`,cancel:`Abbrechen`,applyChanges:`Änderungen anwenden`,saving:`Wird gespeichert...`,saveError:`⚠ Speichern fehlgeschlagen: {error}`,exportError:`⚠ Export fehlgeschlagen: {error}`,loadingSource:`Quelltext wird geladen…`,sourceError:`Quelltext konnte nicht geladen werden: {error}`},photoLocations:{title:`Fotostandorte`,summary:`{total} erfasst · {withGps} mit GPS`,mapHint:`Bitte Claude um "auf der Karte anzeigen", um sie mit dem Google-Map-Plugin einzuzeichnen.`,loading:`Lädt…`,empty:`Noch keine Fotostandorte erfasst. Sende ein Foto mit GPS-Tag über den Chat oder eine verbundene Bridge, um zu beginnen.`,noGps:`Keine GPS-Daten`},pluginManageSkills:{deleteProjectSkill:`Diese Projekt-Skill löschen`,unstarPresetSkill:`Markierung dieser Preset-Skill entfernen — sie kehrt in den Katalog zurück`,heading:`Skills`,previewCount:`{count} Skill | {count} Skills`,previewMore:`+{count} weitere`,subheading:({named:e})=>`${e(`count`)} verfügbar · zum Anzeigen klicken · "Run" ruft sie als /<name> auf`,emptyWithPath:`Keine Skills gefunden. Fügen Sie Skill-Ordner unter {path} hinzu.`,emptySkillPath:`~/.claude/skills/`,selectHint:`Wählen Sie links eine Skill aus, um ihre SKILL.md anzuzeigen.`,loading:`Wird geladen…`,fieldDescription:`Beschreibung`,fieldBody:`Inhalt (Markdown)`,emptyBody:`(leerer Inhalt)`,btnEdit:`Bearbeiten`,btnDelete:`Löschen`,btnUnstar:`Markierung entfernen`,errListFailed:`Skills konnten nicht geladen werden: {error}`,errDetailFailed:`Skill konnte nicht geladen werden: {error}`,errSaveFailed:`Speichern fehlgeschlagen: {error}`,errDeleteFailed:`Löschen fehlgeschlagen`,confirmDelete:`Skill "{name}" löschen? Dies entfernt ~/mulmoclaude/.claude/skills/{name}/SKILL.md.`,confirmUnstar:`Skill "{name}" zurück in den Katalog verschieben? Sie wird nicht mehr in den Prompt geladen, aber die Katalog-Kopie bleibt erhalten — du kannst sie jederzeit erneut markieren.`,sectionActive:`Aktiv`,sectionCatalog:`Katalog`,sectionLegendActive:`Skills, die Claude jetzt verwenden kann. Claude verwendet sie automatisch im Verlauf des Gesprächs, oder du kannst eine durch Eingabe ihres Namens aufrufen. {system} System (mc- mitgeliefert) / {project} Projekt (bearbeitbar, nur in diesem Workspace) / {user} Nutzer (Skills in ~/.claude/skills/) / {claudePlugin} Plugin (aus einem installierten Claude-Code-Plugin, schreibgeschützt).`,sectionLegendCatalog:`Katalog: Skills, die durch {star} Markieren Aktiv werden. {star} in Aktiv entfernen bringt eine Skill zurück in den Katalog — Claude verwendet sie dann nicht mehr (die Skill wird nicht gelöscht).`,catalogEmpty:`Keine Preset-Skills verfügbar.`,catalogPresetHeading:`Presets`,catalogStar:`Markieren`,catalogStarred:`Markiert`,sourceUserTitle:`Benutzer-Skill (~/.claude/skills/, in allen Workspaces verfügbar)`,sourceClaudePluginTitle:`Plugin-Skill (installiertes Claude-Code-Plugin — schreibgeschützt, wird vom Plugin aktualisiert)`,sourceSystemTitle:`System-Skill (mitgeliefert, mc- Präfix — schreibgeschützt, vom Launcher überschrieben)`,sourceProjectTitle:`Projekt-Skill (.claude/skills/ des Workspaces, nur dieser Workspace)`,sourcePresetTitle:`Preset-Katalog — Markieren anklicken, um in diesem Workspace zu aktivieren`,errCatalogListFailed:`Katalog konnte nicht geladen werden: {error}`,errCatalogStarFailed:`Skill konnte nicht markiert werden: {error}`,errCatalogPreviewFailed:`Skill-Vorschau konnte nicht geladen werden: {error}`,catalogAddRepo:`Skill-Repository hinzufügen`,catalogAddRepoTitle:`Ein Skill-Repository hinzufügen`,catalogRepoUrlLabel:`GitHub-URL`,catalogRepoUrlPlaceholder:`https://github.com/owner/repo`,catalogRepoSubpathLabel:`Unterpfad (optional)`,catalogRepoSubpathPlaceholder:`skills`,catalogAddRepoSubmit:`Installieren`,catalogAddRepoSuggestions:`Vorgeschlagene Repositories`,catalogUninstallRepo:`Repository deinstallieren`,catalogUpdateRepo:`Repository aktualisieren (neueste Version erneut laden)`,catalogRepoOpenLink:`Repository auf GitHub öffnen (neuer Tab)`,catalogUninstallConfirm:`Dieses Repository deinstallieren? Bereits mit Stern markierte Skills bleiben in deiner aktiven Liste.`,catalogRepoInstalling:`Installiere…`,catalogRepoEmpty:`In diesem Repository wurden keine Skills gefunden.`,sourceExternalTitle:`Externe Skill (aus einem GitHub-Repository installiert — zum Aktivieren auf den Stern klicken)`,errCatalogRepoListFailed:`Installierte Repositories konnten nicht geladen werden: {error}`,errCatalogRepoInstallFailed:`Repository konnte nicht installiert werden: {error}`,errCatalogRepoUninstallFailed:`Repository konnte nicht deinstalliert werden: {error}`,errCatalogRepoInvalidUrl:`Gib eine GitHub-Repository-URL ein.`},pluginManageRoles:{heading:`Benutzerdefinierte Rollen`,roleCount:`{count} Rolle | {count} Rollen`,addButton:`+ Hinzufügen`,createPanel:`Neue Rolle erstellen`,fieldId:`ID`,fieldName:`Name`,fieldIcon:`Symbol`,fieldPrompt:`Prompt`,fieldPlugins:`Plugins`,fieldModel:`Modell`,modelUnset:`(nicht gesetzt — der globalen Einstellung folgen)`,modelHelp:`Sitzungen mit dieser Rolle laufen auf diesem Modell. Nützlich, um eine Routine-Rolle aus dem Wochenlimit des Top-Modells herauszuhalten. Eingebaute Rollen folgen immer der globalen Einstellung.`,fieldStarterQueries:`Einstiegsfragen`,onePerLine:`(eine pro Zeile)`,helpLink:`?`,idFormatted:`({id})`,missingEnv:`({env} fehlt)`,requiresEnv:`Erfordert {env} in .env`,collapse:`Einklappen`,expand:`Ausklappen`,idPlaceholder:`eindeutige-id`,creating:`Wird erstellt…`,create:`Erstellen`,updating:`Wird aktualisiert…`,update:`Aktualisieren`,cancel:`Abbrechen`,delete:`Löschen`,emptyHint:`Noch keine benutzerdefinierten Rollen. Klicken Sie auf "+ Hinzufügen" oder bitten Sie Claude, eine zu erstellen.`,errIdRequired:`Die ID ist erforderlich.`,errIdInvalid:`Die ID darf nur Buchstaben, Zahlen, '-' und '_' enthalten.`,errNameRequired:`Der Name ist erforderlich.`,errIdDuplicate:`Eine Rolle mit der ID '{id}' existiert bereits.`,errCreateFailed:`Erstellen fehlgeschlagen`,errSaveFailed:`Speichern fehlgeschlagen`,errDeleteFailed:`Löschen fehlgeschlagen`,errNetworkError:`Netzwerkfehler`,errServerError:`Serverfehler: {status}`,errRefreshFailed:`Gespeichert, aber die Liste konnte nicht aktualisiert werden.`,confirmDelete:`Rolle {name} löschen? Dies kann nicht rückgängig gemacht werden.`},pluginUiImage:{promptLabel:`{label}:`},markdownCodeCopy:{copyLabel:`Code kopieren`,copiedLabel:`Kopiert`},markdownMermaid:{loadFailed:`⚠ Mermaid konnte nicht geladen werden: {error}`,renderFailed:`⚠ Mermaid-Rendering fehlgeschlagen: {error}`},pluginTextResponse:{pdf:`PDF`,pdfFailed:`⚠ PDF fehlgeschlagen`,editContent:`Textinhalt bearbeiten`,applyChanges:`Änderungen übernehmen`,copyLabel:`Kopieren`,speakerSystem:`System`,speakerUser:`Sie`,speakerAssistant:`Assistent`,copiedLabel:`Kopiert!`,cancel:`Abbrechen`,seededByPlugin:`von {pkg}`,seededByPluginTooltip:`Diese Nachricht wurde vom Plugin {pkg} erstellt und nicht von Ihnen gesendet.`,truncatedForRender:`Diese Nachricht ist ungewöhnlich lang (insgesamt {total} Zeichen). Nur der erste Teil wird angezeigt – {omitted} Zeichen ausgeblendet, damit der Tab reaktionsfähig bleibt. Nutze „Kopieren“ für den vollständigen Text.`},pluginSkill:{noDescription:`(keine Beschreibung)`},pluginSpreadsheet:{previewUntitled:`Tabelle`,previewSheets:`{count} Blatt | {count} Blätter`,untitled:`Tabelle`,excel:`Excel`,valuePlaceholder:`Wert`,valueOrFormulaPlaceholder:`Wert oder Formel (z. B. 100 oder SUM(B2:B11))`,formatPlaceholder:`Format (z. B. $#,##0.00)`,loading:`Tabelle wird geladen...`,noData:`Keine Tabellendaten verfügbar`,editData:`Tabellendaten bearbeiten`,applyChanges:`Änderungen übernehmen`,dataMustBeArray:`Daten müssen ein Array von Blättern sein`,loadFailed:`Laden der Tabelle fehlgeschlagen: {error}`,invalidJsonAlert:`Ungültiges JSON-Format: {error}`,unknownError:`Unbekannter Fehler`,update:`Aktualisieren`,stringType:`Zeichenkette`,formulaType:`Formel`},app:{startConversation:`Gespräch beginnen`,thinking:`Denkt nach…`},suggestionsPanel:{suggestions:`Vorschläge`,skills:`Skills`,tooltip:`Vorschläge und Skills`,emptySuggestions:`Keine Vorschläge.`,emptySkills:`Keine Skills installiert.`,skillsError:`Fehler beim Laden der Skills: {error}`,sendEditHint:`klicken zum Senden · Shift+Klick zum Bearbeiten`},settingsToolsTab:{explanation:`Zusätzliche Tool-Namen, die Claude über {allowedTools} übergeben werden sollen. Einer pro Zeile. Nützlich für in Claude Code integrierte MCP-Server wie Gmail / Google Kalender, nachdem Sie sich über {claudeMcp} authentifiziert haben.`,connectorsSectionTitle:`Verbundene Konnektoren`,connectorsEmpty:`Keine Konnektoren gefunden.`,connectorConnected:`Verbunden`,connectorDisconnected:`Nicht verbunden`,connectorsGuide:`Konnektoren wie Slack und Gmail erlauben Claude den Zugriff auf Ihre Konten. Konnektoren können in Claude Desktop oder {configLink} hinzugefügt oder entfernt werden. (Öffnet claude.ai)`,connectorsConfigLinkText:`hier`},confirmModal:{defaultTitle:`Bestätigen`,defaultConfirm:`Bestätigen`,defaultCancel:`Abbrechen`}},UI=[`en`,`ja`,`zh`,`ko`,`es`,`pt-BR`,`fr`,`de`],xlt={en:plt,ja:mlt,zh:hlt,ko:glt,es:_lt,"pt-BR":vlt,fr:ylt,de:blt};function WI(e){return UI.some(t=>t===e)}function Slt(e){if(WI(e))return e;let t=e.toLowerCase();for(let e of UI)if(e.toLowerCase()===t)return e;let[n=t]=t.split(`-`);return WI(n)?n:UI.find(e=>e.toLowerCase().startsWith(`${n}-`))??null}var Clt=`en`;function wlt(){if(typeof navigator<`u`){let e=navigator.languages&&navigator.languages.length>0?navigator.languages:[navigator.language];for(let t of e){if(typeof t!=`string`)continue;let e=Slt(t);if(e)return e}}return Clt}var Tlt=wlt(),GI=Ge({legacy:!1,locale:Tlt,fallbackLocale:`en`,messages:xlt}),KI=Qce,Elt=[`frame-src`,`script-src`,`style-src`,`font-src`,`img-src`,`media-src`,`connect-src`],qI=(e,t)=>[...e[t]??[]];function Dlt(e){try{let t=new URL(e);return t.protocol!==`https:`||e.toLowerCase()!==`https://${t.host}`?!1:t.hostname.length>0&&[...t.hostname].every(e=>/[a-z0-9.-]/i.test(e))}catch{return!1}}function Olt(e){if(!Ma(e))return{};let t={};for(let n of Elt){let r=e[n];if(!Array.isArray(r))continue;let i=r.map(e=>typeof e==`string`?e.trim():``).filter(Dlt);i.length>0&&(t[n]=[...new Set(i)])}return t}function klt(e,t,n,r=``,i=``,a={}){let o=[...n],s=Olt(a),c=[`default-src 'none'`,`script-src ${[`'unsafe-inline'`,...o,...qI(s,`script-src`)].join(` `)}`,`style-src ${[`'unsafe-inline'`,...o,...qI(s,`style-src`)].join(` `)}`,`font-src ${[...o,...qI(s,`font-src`)].join(` `)}`,`img-src ${[t,...o,`data:`,`blob:`,...r?[r]:[],...qI(s,`img-src`)].join(` `)}`],l=[...i?[i]:[],...qI(s,`media-src`)];l.length>0&&c.push(`media-src ${l.join(` `)}`);let u=qI(s,`frame-src`);return u.length>0&&c.push(`frame-src ${u.join(` `)}`),c.push(`connect-src ${[e,...qI(s,`connect-src`)].join(` `)}`),c.join(`; `)}function Alt(e,t=KI,n={}){return klt(`'none'`,e??`'self'`,t,``,``,n)}function jlt(e,t=KI,n={}){return klt(e,e,t,`https:`,`${e} https: data: blob:`,n)}var Mlt=``;function Nlt(e,t={}){let n=`<meta http-equiv="Content-Security-Policy" content="${Alt(void 0,KI,t)}">`;return/<head\b[^>]*>/i.test(e)?e.replace(/(<head\b[^>]*>)/i,`$1${n}`):`<!DOCTYPE html><html><head>${n}</head><body>${e}</body></html>${Mlt}`}M();var Plt=V({}),Flt=ee(Plt);async function JI(){try{let e=await pN(SP.config.base);e.ok&&(Plt.value=Olt(e.data.csp??{}))}catch{}}var Ilt={key:`text-blue-700`,string:`text-green-700`,number:`text-orange-600`,keyword:`text-purple-700`,punct:`text-gray-500`,whitespace:``},Llt=[{type:`string`,pattern:/^"(?:[^"\\]|\\.)*"/},{type:`keyword`,pattern:/^(?:true|false|null)\b/},{type:`number`,pattern:/^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/},{type:`whitespace`,pattern:/^\s+/},{type:`punct`,pattern:/^[{}[\]:,]/}];function Rlt(e){for(let{type:t,pattern:n}of Llt){let r=n.exec(e);if(r)return{type:t,value:r[0]}}return null}function YI(e){let t=[],n=0;for(;n<e.length;){let r=e.slice(n),i=Rlt(r);if(!i){t.push({type:`punct`,value:r.slice(0,1)}),n++;continue}t.push(i),n+=i.value.length}return Vlt(t)}var zlt=e=>e?.type===`punct`&&e.value===`:`,Blt=(e,t)=>{let n=e[t+1];return n?.type===`whitespace`?e[t+2]:n};function Vlt(e){return e.map((t,n)=>t.type===`string`&&zlt(Blt(e,n))?{type:`key`,value:t.value}:t)}function Hlt(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Ult(e){return e.split(/\r?\n/).filter(e=>e.trim().length>0).map(e=>{try{return{tokens:YI(JSON.stringify(JSON.parse(e),null,2)),parseError:!1}}catch{return{tokens:YI(e),parseError:!0}}})}o();function XI(e,t){if(!e)return!1;let n=e.toLowerCase();return t.some(e=>n.endsWith(e))}var Wlt=`artifacts/html/`;function ZI(e){if(!e)return null;let t=e.toLowerCase();if(!t.endsWith(`.html`)&&!t.endsWith(`.htm`)||!e.startsWith(Wlt))return null;let n=e.slice(15);return n.length===0?null:`/artifacts/html/${n.split(`/`).map(encodeURIComponent).join(`/`)}`}var Glt=`artifacts/svg/`;function QI(e){if(!e||!e.toLowerCase().endsWith(`.svg`)||!e.startsWith(Glt))return null;let t=e.slice(14);return t.length===0?null:`/artifacts/svg/${t.split(`/`).map(encodeURIComponent).join(`/`)}`}function Klt(e,t){let n=m(()=>XI(e.value,[`.md`,`.markdown`])),r=m(()=>XI(e.value,[`.html`,`.htm`])),i=m(()=>XI(e.value,[`.json`])),a=m(()=>XI(e.value,[`.jsonl`,`.ndjson`])),o=m(()=>t.value?.kind===`text`&&r.value?Nlt(t.value.content,Flt.value):``);return Ve(()=>t.value?.kind===`text`&&r.value,e=>{e&&JI()},{immediate:!0}),{isMarkdown:n,isHtml:r,isJson:i,isJsonl:a,sandboxedHtml:o,htmlPreviewUrl:m(()=>r.value?ZI(e.value):null),jsonTokens:m(()=>!t.value||t.value.kind!==`text`||!i.value?[]:YI(Hlt(t.value.content))),jsonlLines:m(()=>!t.value||t.value.kind!==`text`||!a.value?[]:Ult(t.value.content)),mdFrontmatter:m(()=>{if(!t.value||t.value.kind!==`text`||!n.value)return null;let e=Ba(t.value.content),r=Object.entries(e.meta).map(([e,t])=>({key:e,value:t}));return{...e,fields:r}})}}M();function qlt(){let e=V(null),t=V(!1),n=V(null),r=null;async function i(i){r?.abort();let a=new AbortController;r=a,t.value=!0,n.value=null,e.value=null;try{let t=await pN(SP.files.content,{path:i},{signal:a.signal});if(a.signal.aborted)return;t.ok?e.value=t.data:n.value=t.error}finally{r===a&&(t.value=!1,r=null)}}function a(){r?.abort(),r=null,t.value=!1}return{content:e,contentLoading:t,contentError:n,loadContent:i,abortContent:a}}M();function $I(e){return typeof e!=`string`||e.length===0||e.startsWith(`/`)?!1:!e.split(`/`).some(e=>e===`..`)}function eL(e){return Array.isArray(e)?e.length===0?null:e.join(`/`):Pa(e)?e:null}function Jlt(){let e=OI(),t=DI(),{content:n,contentLoading:r,contentError:i,loadContent:a,abortContent:o}=qlt(),s=eL(e.params.pathMatch),c=V($I(s)?s:null);function l(n){c.value=n,a(n),t.push({name:`files`,params:{pathMatch:n.split(`/`)},query:e.query}).catch(e=>{CI(e)||console.error(`[selectFile] navigation failed:`,e)})}function u(){o(),c.value=null,n.value=null,i.value=null,t.replace({name:`files`,params:{pathMatch:[]},query:e.query}).catch(e=>{CI(e)||console.error(`[deselectFile] navigation failed:`,e)})}return{selectedPath:c,content:n,contentLoading:r,contentError:i,loadContent:a,selectFile:l,deselectFile:u,abortContent:o}}M();var Ylt=x({});function Xlt(e){return Ylt[e]??0}function Zlt(e){Ylt[e]=Date.now()}var Qlt=`/api/files/raw`;function $lt(e){Qlt=e}var eut=`artifacts/images/`;function tL(e){return e.startsWith(`data:`)?e:e.startsWith(eut)?`/${e}`:`${Qlt}?path=${encodeURIComponent(e)}`}function tut(e){if(e.startsWith(`data:`))return e;let t=tL(e),n=Xlt(e);return n<=0?t:`${t}${t.includes(`?`)?`&`:`?`}v=${n}`}var nut=150,rut=150;function iut(){return`(function(){var v=window.__MC_VIEW,cbs=[],t,qcbs=[],qt;function fire(){t=undefined;cbs.slice().forEach(function(cb){try{cb()}catch(e){}});}function fireQuery(){qt=undefined;var q=v.searchQuery;qcbs.slice().forEach(function(cb){try{cb(q)}catch(e){}});}window.addEventListener('message',function(e){if(e.source!==window.parent)return;var d=e.data;if(!d||d.type!=='mc-collection-changed'||d.slug!==v.slug)return;if(t)clearTimeout(t);t=setTimeout(fire,${nut});});var qch=new MessageChannel();qch.port1.onmessage=function(e){var d=e.data;if(!d||d.type!=='mc-search-query')return;v.searchQuery=typeof d.query==='string'?d.query:'';if(qt)clearTimeout(qt);qt=setTimeout(fireQuery,${rut});};window.parent.postMessage({type:'mc-view-ready',slug:v.slug},v.origin,[qch.port2]);v.onChange=function(cb){if(typeof cb!=='function')return function(){};cbs.push(cb);return function(){var i=cbs.indexOf(cb);if(i>=0)cbs.splice(i,1);};};v.onSearchQueryChange=function(cb){if(typeof cb!=='function')return function(){};qcbs.push(cb);return function(){var i=qcbs.indexOf(cb);if(i>=0)qcbs.splice(i,1);};};v.openItem=function(id,mode){window.parent.postMessage({type:'mc-open-item',slug:v.slug,id:String(id),mode:mode==='edit'?'edit':'view'},v.origin);};v.startChat=function(prompt,role){window.parent.postMessage({type:'mc-start-chat',slug:v.slug,prompt:String(prompt),role:typeof role==='string'?role:undefined},v.origin);};v.dict=v.dict||{};v.t=function(key,named){var s=v.dict[key];if(typeof s!=='string')return typeof key==='string'?key:String(key);if(!named||typeof named!=='object')return s;return s.replace(/\\{(\\w+)\\}/g,function(m,n){var x=named[n];return x==null?m:String(x);});};document.addEventListener('securitypolicyviolation',function(e){window.parent.postMessage({type:'mc-csp-violation',slug:v.slug,nonce:v.cspNonce,blockedURI:e.blockedURI,violatedDirective:e.violatedDirective,effectiveDirective:e.effectiveDirective},v.origin);});})();`}function aut(e,t){return e.startsWith(`/`)?`${t}${e}`:e}function out(e,t,n={},r=``){let i=`${`<meta http-equiv="Content-Security-Policy" content="${jlt(t.origin,void 0,n)}">`}<script>window.__MC_VIEW=${JSON.stringify({slug:t.slug,token:t.token,dataUrl:aut(t.dataUrl,t.origin),origin:t.origin,searchQuery:``,cspNonce:r,locale:t.locale??``,dict:t.dict??{}}).replace(/</g,`\\u003c`)};${iut()}<\/script>`;return/<head\b[^>]*>/i.test(e)?e.replace(/(<head\b[^>]*>)/i,`$1${i}`):`<!DOCTYPE html><html><head>${i}</head><body>${e}</body></html>`}M();var sut=5,nL=V([]),cut=ee(nL);function lut(){nL.value=[]}function uut(e){try{return new URL(e).origin}catch{return e}}var dut=64,rL=new Set;function fut(e){if(e)for(rL.add(e);rL.size>dut;){let e=rL.values().next().value;if(e===void 0)break;rL.delete(e)}}function put(e){return Ma(e)&&e.type===`mc-csp-violation`}function mut(e){if(!put(e))return null;let t=typeof e.blockedURI==`string`?e.blockedURI:``,n=typeof e.violatedDirective==`string`?e.violatedDirective:typeof e.effectiveDirective==`string`?e.effectiveDirective:``;return!t||t===`inline`||t===`eval`?null:{host:uut(t),directive:n.split(` `)[0]||``}}function hut(e){if(nL.value.some(t=>t.host===e.host&&t.directive===e.directive))return;nL.value=[e,...nL.value].slice(0,sut);let t=e.directive?` (${e.directive})`:``;console.warn(`[csp] blocked ${e.host}${t}. To allow it, add the host to config/csp.json — but only if you trust it.`)}function gut(e,t,n){return e!==`null`||!put(t)||!n(typeof t.nonce==`string`?t.nonce:``)?null:mut(t)}function _ut(e){let t=gut(e.origin,e.data,e=>rL.has(e));t&&hut(t)}var vut=!1;function yut(){vut||typeof window>`u`||(vut=!0,window.addEventListener(`message`,_ut))}M();var iL=V({isOpen:!1,title:``,message:``,confirmText:``,cancelText:``,variant:`primary`,resolve:null});function but(){function e(e){let t=typeof e==`string`?{message:e}:e;return new Promise(e=>{let n=iL.value.resolve;n&&n(!1),iL.value={isOpen:!0,title:t.title||``,message:t.message,confirmText:t.confirmText||``,cancelText:t.cancelText||``,variant:t.variant||`primary`,resolve:e}})}function t(e){iL.value.resolve&&iL.value.resolve(e),iL.value.isOpen=!1,iL.value.resolve=null}return{confirmState:iL,openConfirm:e,handleConfirm:t}}function xut(){let e=Promise.resolve();return{enqueue:t=>{let n=e.then(t,t);return e=n.then(()=>void 0,()=>void 0),n}}}var Sut=Object.keys({kind:!0,slug:!0,title:!0,icon:!0,color:!0});function Cut(e){let t=Object.entries(e);return Object.fromEntries(t.filter(([e])=>!Sut.includes(e)))}function aL(e,t){return e.kind===t.kind&&e.slug===t.slug}function wut(e,t,n){let r=n===`up`?t-1:t+1,i=e[t],a=e[r];if(!i||!a)return e;let o=[...e];return o[t]=a,o[r]=i,o}function Tut(e,t,n,r){let i=e.findIndex(e=>aL(e,{kind:t,slug:n}));return i<0?e:wut(e,i,r)}function Eut(e){return e===void 0?{}:{color:e}}function Dut(e,t){return t.title!==e.title||t.icon!==e.icon||t.color!==e.color}function Out(e,t){return{...Cut(e),kind:e.kind,slug:e.slug,title:t.title,icon:t.icon,...Eut(t.color)}}function kut(e,t,n){let r=new Map(n.map(e=>[e.slug,e])),i=e.flatMap(e=>{if(e.kind!==t)return[e];let n=r.get(e.slug);return n?[Dut(e,n)?Out(e,n):e]:[]});return{next:i,drifted:i.length!==e.length||i.some((t,n)=>t!==e[n])}}o(),M();var oL=V([]),sL=V(null),cL=V(!1),lL=null;async function uL(e=!1){return lL&&!e||(lL=(async()=>{let e=await pN(SP.shortcuts);if(!e.ok){sL.value=e.error,lL=null;return}sL.value=null,oL.value=e.data.shortcuts,cL.value=!0})()),lL}var{enqueue:dL}=xut();async function fL(e,t){oL.value=e;let n=await hN(SP.shortcuts,{shortcuts:e});return n.ok?(oL.value=n.data.shortcuts,sL.value=null,!0):(oL.value=t,sL.value=n.error,console.error(`[useShortcuts] persist failed`,n.error),!1)}function pL(e,t){return oL.value.some(n=>aL(n,{kind:e,slug:t}))}function Aut(e){return dL(async()=>{if(await uL(),!cL.value)return!1;if(pL(e.kind,e.slug))return!0;let t=oL.value;return fL([...t,e],t)})}function jut(e,t){return dL(async()=>{if(await uL(),!cL.value)return!1;if(!pL(e,t))return!0;let n=oL.value;return fL(n.filter(n=>!aL(n,{kind:e,slug:t})),n)})}function Mut(e,t,n){return dL(async()=>{if(await uL(),!cL.value)return!1;let r=oL.value,i=Tut(r,e,t,n);return i===r||fL(i,r)})}function Nut(e,t){return dL(async()=>{if(await uL(),!cL.value)return;let{next:n,drifted:r}=kut(oL.value,e,t);r&&await fL(n,oL.value)})}function mL(){return uL(),{shortcuts:m(()=>oL.value),loadError:m(()=>sL.value),load:uL,isPinned:pL,pin:Aut,unpin:jut,movePinned:Mut,reconcile:Nut}}o(),M(),we(),le();var Put=[`title`,`aria-label`,`aria-pressed`,`data-testid`],Fut={class:`material-icons text-lg`},Iut=K({__name:`PinToggle`,props:{kind:{},slug:{},title:{},icon:{},color:{}},setup(e){let t=e,{t:n}=We(),{isPinned:r,pin:i,unpin:a}=mL(),o=m(()=>r(t.kind,t.slug));function u(){o.value?a(t.kind,t.slug):i({kind:t.kind,slug:t.slug,title:t.title,icon:t.icon,...t.color===void 0?{}:{color:t.color}})}return(t,r)=>(B(),U(`button`,{type:`button`,class:c([`h-8 w-8 flex items-center justify-center rounded transition-colors`,o.value?`text-amber-500 hover:bg-amber-50`:`text-slate-400 hover:bg-slate-100 hover:text-slate-600`]),title:o.value?q(n)(`shortcuts.unpin`):q(n)(`shortcuts.pin`),"aria-label":o.value?q(n)(`shortcuts.unpin`):q(n)(`shortcuts.pin`),"aria-pressed":o.value,"data-testid":`pin-toggle-${e.kind}-${e.slug}`,onClick:s(u,[`stop`]),onKeydown:[r[0]||=l(s(()=>{},[`stop`]),[`enter`]),r[1]||=l(s(()=>{},[`stop`]),[`space`])]},[S(`span`,Fut,T(o.value?`star`:`star_border`),1)],42,Put))}});M(),$lt(SP.files.raw);var{openConfirm:Lut}=but(),hL=(e,t)=>e.replace(`:slug`,encodeURIComponent(t)),Rut=(e,t)=>hL(SP.collections.item,e).replace(`:itemId`,encodeURIComponent(t)),zut=(e,t,n)=>hL(SP.collections.itemAction,e).replace(`:itemId`,encodeURIComponent(t)).replace(`:actionId`,encodeURIComponent(n)),But=(e,t)=>hL(SP.collections.collectionAction,e).replace(`:actionId`,encodeURIComponent(t)),Vut=(e,t)=>hL(SP.collections.viewDelete,e).replace(`:viewId`,encodeURIComponent(t)),Hut=(e,t)=>hL(SP.collections.remoteViewMutate,e).replace(`:viewId`,encodeURIComponent(t)),Uut=(e,t)=>hL(SP.collections.remoteViewItems,e).replace(`:viewId`,encodeURIComponent(t)),Wut=null,Gut=null,Kut=null,gL=new Map,_L=new Map;function qut(e,t,n){return QN().subscribe(ret(e,t),()=>n())}function Jut(e){let{slug:t,appId:n}=e;if(gL.get(t)!==n){n===void 0?gL.delete(t):gL.set(t,n);for(let e of _L.get(t)??[])e.unsubscribeApp?.(),e.unsubscribeApp=n===void 0?null:qut(t,n,e.onChange)}}function Yut(e,t){let n=QN().subscribe(ret(e),()=>t()),r=gL.get(e),i={onChange:t,unsubscribeApp:r===void 0?null:qut(e,r,t)},a=_L.get(e)??new Set;return a.add(i),_L.set(e,a),()=>{n(),i.unsubscribeApp?.(),i.unsubscribeApp=null,a.delete(i),a.size===0&&_L.delete(e)}}function Xut(e){Wut=e.startChat,Gut=e.startNewChatDraft,Kut=e.notifiedSeverities}UXe({fetchCollectionDetail:e=>pN(hL(SP.collections.detail,e)).then(e=>(e.ok&&Jut(e.data.collection),e)),fileAssetUrl:e=>$I(e)?ZI(e)??QI(e):null,fileRoutePath:e=>$I(e)?`/files/${e.split(`/`).map(encodeURIComponent).join(`/`)}`:null,imageSrc:e=>tL(e),confirm:e=>Lut(e),deleteView:(e,t)=>gN(Vut(e,t)),mintViewToken:(e,t)=>mN(hL(SP.collections.viewToken,e),{viewId:t}),fetchViewHtml:async(e,t)=>{try{await JI();let n=await _N(hL(SP.collections.viewFile,e),{query:{id:t}});return n.ok?{ok:!0,html:await n.text()}:{ok:!1,status:n.status}}catch{return{ok:!1,status:0}}},fetchViewI18n:(e,t,n)=>pN(hL(SP.collections.viewI18n,e),{id:t,locale:n}),fetchRemoteView:(e,t,n)=>pN(hL(SP.collections.remoteView,e),{id:t,locale:n}),mutateRemoteView:(e,t,n)=>mN(Hut(e,t),n),fetchRemoteViewItems:(e,t,n)=>pN(Uut(e,t),{offset:n.offset,limit:n.limit,fields:n.fields?.join(`,`)||void 0}),buildViewSrcdoc:(e,t)=>{let n=crypto.randomUUID();return fut(n),out(e,t,Flt.value,n)},createItem:(e,t)=>mN(hL(SP.collections.items,e),t),updateItem:(e,t,n)=>hN(Rut(e,t),n),deleteItem:(e,t)=>gN(Rut(e,t)),deleteCollection:e=>gN(hL(SP.collections.detail,e)),deleteFeed:e=>gN(hL(SP.feeds.detail,e)),runItemAction:(e,t,n,r)=>mN(zut(e,t,n),r?{params:r}:{}),runCollectionAction:(e,t)=>mN(But(e,t),{}),refreshCollection:e=>mN(hL(SP.collections.refresh,e),{}),pushCalendarCollection:e=>mN(hL(SP.collections.calendarPush,e),{}),routeSlug:()=>typeof HI.currentRoute.value.params.slug==`string`?HI.currentRoute.value.params.slug:void 0,routeSelectedId:()=>typeof HI.currentRoute.value.query.selected==`string`?HI.currentRoute.value.query.selected:void 0,isFeedRoute:()=>HI.currentRoute.value.name===CP.feeds,setSelectedId:e=>{let t={...HI.currentRoute.value.query};e===null?delete t.selected:t.selected=e,HI.replace({query:t}).catch(()=>{})},gotoIndex:e=>{HI.push({name:e===`feed`?CP.feeds:CP.collections,params:{}}).catch(()=>{})},gotoDetail:(e,t)=>{HI.push({name:e===`feed`?CP.feeds:CP.collections,params:{slug:t}}).catch(()=>{})},navigateToRecord:(e,t)=>{HI.push({name:CP.collections,params:{slug:e},query:t===void 0?{}:{selected:t}}).catch(()=>{})},recordHref:(e,t)=>{let n=`/collections/${encodeURIComponent(e)}`;return t===void 0?n:`${n}?selected=${encodeURIComponent(t)}`},navigate:e=>{HI.push(e).catch(()=>{})},listCollections:()=>pN(SP.collections.list).then(e=>(e.ok&&e.data.collections.forEach(Jut),e)),listFeeds:()=>pN(SP.feeds.list),fetchOntology:()=>pN(SP.collections.ontology),listRegistry:()=>pN(SP.collectionsRegistry.list),importRegistry:(e,t,n)=>mN(SP.collectionsRegistry.import,{author:e,slug:t,registry:n}),reconcileShortcuts:(e,t)=>mL().reconcile(e,t),localeTag:()=>q(GI.global.locale),startChat:(e,t)=>Wut?.(e,t),startNewChatDraft:(e,t)=>Gut?.(e,t),generalRoleId:gI.general,personalRoleId:gI.personal,unpin:(e,t)=>mL().unpin(e,t),notifiedSeverities:e=>Kut?.(e)??new Map,subscribeChanges:(e,t)=>Yut(e,t),pinToggle:Iut,translate:e=>mN(SP.translation.translate,e).then(e=>e.ok?e.data:null)}),o(),we(),M(),le();var vL=null;function Zut(e){vL=e}function yL(){if(!vL)throw Error(`@mulmoclaude/accounting-plugin: configureAccountingHost() must be called before the accounting View mounts`);return vL}function Qut(e,t){return yL().apiCall(e,t)}function $ut(e,t){return yL().subscribe(e,t)}function edt(){return yL().localeTag()}function bL(){return vL?.projectScope?.()??null}var xL=si({en:{pluginAccounting:{title:`Accounting`,noBook:`No books yet — click "+ New book" above to create your first one.`,common:{cancel:`Cancel`,loading:`Loading…`,error:`Error: {error}`,empty:`No entries yet.`},tabs:{journal:`Journal`,newEntry:`New entry`,opening:`Opening`,accounts:`Accounts`,ledger:`Ledger`,balanceSheet:`Balance sheet`,profitLoss:`P&L`,settings:`Settings`},bookSwitcher:{label:`Book`,newBook:`New book…`,create:`Create`,nameLabel:`Name`,currencyLabel:`Currency`,countryLabel:`Country`,countryPlaceholder:`Select a country…`,countryHint:`The country sets the tax jurisdiction so the assistant can give country-specific advice (T-number for Japan, VAT ID for the EU, etc.).`,fiscalYearEndLabel:`Fiscal year end`,fiscalYearEndHint:`Determines the fiscal year boundary used by the date-range shortcuts in this book. Pick the month whose last day the fiscal year ends on. Default is December (calendar year).`,placeholder:`Pick a book…`,firstRunHint:`Pick a name, currency, country, and fiscal year end for your first book. The currency is set per-book and is hard to change once you start booking entries.`},deletedNotice:{title:`"{bookName}" has been deleted.`,body:`Pick another book from the dropdown above, or create a new one.`},journalList:{fromLabel:`From`,toLabel:`To`,accountLabel:`Account`,allAccounts:`All accounts`,void:`Void`,edit:`Edit`,voidConfirm:`Void this entry? The original stays in the journal; a reversing pair is appended.`,voidReason:`Reason (optional):`,columns:{date:`Date`,kind:`Kind`,memo:`Memo`,lines:`Lines`},kind:{normal:`—`,opening:`Opening`,void:`Reverse`,voidMarker:`Void marker`}},entryForm:{title:`New journal entry`,editTitle:`Edit journal entry`,editBanner:`When you submit, the original entry will be voided and replaced by this one.`,dateLabel:`Date`,memoLabel:`Memo`,accountLabel:`Account`,debitLabel:`Debit`,creditLabel:`Credit`,taxRegistrationIdLabel:`Tax registration ID`,taxRegistrationIdPlaceholder:`T-number / VAT ID / GSTIN…`,taxRegistrationIdMissingWarning:`Required`,addLine:`Add line`,removeLine:`Remove`,submit:`Post entry`,submitting:`Posting…`,update:`Update entry`,updating:`Updating…`,cancelEdit:`Cancel`,success:`Entry posted.`,editSuccess:`Entry updated.`,editVoidReason:`edited`,imbalance:`Imbalance: {amount}`,balanced:`Balanced ✓`},openingForm:{title:`Opening balances`,asOfLabel:`As of`,explainer:`Enter your balance-sheet positions as of the start date. Income / expense accounts are not allowed here. Σ debit must equal Σ credit; the difference plug-in is Retained Earnings.`,emptyHint:`It's fine to save with everything blank — you can update opening balances later. The book just needs an opening on file before other tabs unlock.`,explainer2:`Balance-sheet accounts only.`,submit:`Save opening balances`,replaceWarning:`Saving replaces the existing opening (the old one is voided in the journal).`,none:`No opening balance set yet.`,setBy:`Set as of {date}`,success:`Opening balances saved.`},ledger:{selectAccount:`Select account`,closingBalance:`Closing balance`,columns:{date:`Date`,memo:`Memo`,debit:`Debit`,credit:`Credit`,balance:`Balance`,taxRegistrationId:`Tax registration ID`}},dateRange:{shortcutLabel:`Range`,currentQuarter:`Current quarter`,previousQuarter:`Last quarter`,currentYear:`Current year`,previousYear:`Last year`,lifetime:`Lifetime`,all:`All`,fromLabel:`From`,toLabel:`To`},balanceSheet:{asOfLabel:`Period`,sections:{asset:`Assets`,liability:`Liabilities`,equity:`Equity`},total:`Total`,imbalance:`Imbalance: {amount}`,currentEarnings:`Current period earnings`,shortcutLabel:`Shortcut`,thisMonth:`This month`,lastMonth:`Last month`,lastQuarter:`Last quarter`,lastYear:`Last year`},profitLoss:{fromLabel:`From`,toLabel:`To`,income:`Income`,expense:`Expense`,netIncome:`Net income:`},accounts:{listEmpty:`No accounts in this category yet.`,openLedgerAria:`Open ledger for {code} {name}`,manageButton:`Manage accounts`,modalTitle:`Manage accounts`,addAccount:`Add account`,sectionTitle:{asset:`Assets`,liability:`Liabilities`,equity:`Equity`,income:`Income`,expense:`Expenses`},columnCode:`Code`,columnName:`Name`,columnType:`Type`,columnNote:`Note`,typeOption:{asset:`Asset`,liability:`Liability`,equity:`Equity`,income:`Income`,expense:`Expense`},edit:`Edit`,save:`Save`,cancel:`Cancel`,saving:`Saving…`,addToCategory:`Add {type} account`,deactivate:`Deactivate`,reactivate:`Activate`,deactivateConfirm:`Hide "{name}" from entry/ledger dropdowns? Existing journal entries are unaffected.`,errorEmptyCode:`Code is required.`,errorReservedCode:`Codes starting with “_” are reserved for system rows.`,errorInvalidCodeFormat:`Account code must be exactly 4 digits.`,errorCodeTypeMismatch:`Code must match the account type: 1xxx asset, 2xxx liability, 3xxx equity, 4xxx income, 5xxx expense.`,errorEmptyName:`Name is required.`,errorDuplicateCode:`An account with this code already exists.`,errorDuplicateName:`An account with this name already exists.`,success:`Account saved.`,codeReadOnlyHint:`Code can't be changed once an account is created.`,noteOptional:`(optional)`},settings:{bookInfo:`Book information`,bookInfoExplain:`Edit the country to update tax-jurisdiction-specific advice. Currency cannot be changed once entries are booked.`,countryUnset:`(not set)`,fiscalYearEndExplain:`Changes only how date-range shortcuts resolve from now on; existing journal entries are not moved.`,saveChanges:`Save changes`,updateOk:`Book updated.`,rebuild:`Rebuild snapshots`,rebuildExplain:`Drops every cached monthly snapshot and recomputes them from the journal. Safe to run; useful after editing journal files by hand.`,rebuildOk:`Rebuilt {count} period(s).`,advanced:`Advanced…`,deleteBook:`Delete book`,deleteBookExplain:`Permanently deletes this book's directory. Cannot be undone.`,deleteBookConfirm:`Type "{bookName}" to confirm:`,deleteBookButton:`Delete forever`},preview:{entry:`Posted entry on {date}`,pl:`P&L {from} → {to}: net {net}`,bs:`Balance sheet as of {date} · assets {assets}`,bookCreated:`Created book "{name}" ({id})`,accountSaved:`Saved account {code} "{name}"`,entryVoided:`Voided entry; reversal posted on {date}`,openingSet:`Set opening balances as of {date}`,openingReplaced:`Replaced opening balances as of {date}`},previewSummary:`Accounting · {bookId}`,previewError:`Accounting: {error}`,previewGeneric:`Accounting result`}},ja:{pluginAccounting:{title:`会計`,noBook:`まだ帳簿がありません — 上の "+ 新しい帳簿" から作成してください。`,common:{cancel:`キャンセル`,loading:`読み込み中…`,error:`エラー: {error}`,empty:`まだエントリがありません。`},tabs:{journal:`仕訳`,newEntry:`新規仕訳`,opening:`期首残高`,accounts:`勘定科目`,ledger:`元帳`,balanceSheet:`貸借対照表`,profitLoss:`損益`,settings:`設定`},bookSwitcher:{label:`帳簿`,newBook:`新しい帳簿…`,create:`作成`,nameLabel:`名前`,currencyLabel:`通貨`,countryLabel:`国`,countryPlaceholder:`国を選択…`,countryHint:`国を設定すると税の管轄が決まり、アシスタントが国別のアドバイス(日本のT番号、EUのVAT IDなど)を提供できます。`,fiscalYearEndLabel:`会計年度末日`,fiscalYearEndHint:`この帳簿の日付範囲ショートカットで使う会計年度の境界を決めます。会計年度が終わる月(その月末日)を選びます。デフォルトは12月(暦年)。`,placeholder:`帳簿を選択…`,firstRunHint:`最初の帳簿の名前・通貨・国・会計年度末日を選んでください。通貨は帳簿ごとに固定で、仕訳を入力した後の変更は難しくなります。`},deletedNotice:{title:`「{bookName}」を削除しました。`,body:`上のドロップダウンから別の帳簿を選ぶか、新しい帳簿を作成してください。`},journalList:{fromLabel:`開始日`,toLabel:`終了日`,accountLabel:`勘定科目`,allAccounts:`すべての科目`,void:`取消`,edit:`編集`,voidConfirm:`この仕訳を取り消しますか?元の仕訳は journal に残り、逆仕訳が追記されます。`,voidReason:`理由(任意):`,columns:{date:`日付`,kind:`種別`,memo:`メモ`,lines:`行`},kind:{normal:`—`,opening:`期首`,void:`逆仕訳`,voidMarker:`取消マーカー`}},entryForm:{title:`新規仕訳`,editTitle:`仕訳の編集`,editBanner:`送信すると、元の仕訳は取り消され、この内容で置き換えられます。`,dateLabel:`日付`,memoLabel:`メモ`,accountLabel:`勘定科目`,debitLabel:`借方`,creditLabel:`貸方`,taxRegistrationIdLabel:`登録番号`,taxRegistrationIdPlaceholder:`T1234567890123`,taxRegistrationIdMissingWarning:`必須`,addLine:`行を追加`,removeLine:`削除`,submit:`起票`,submitting:`起票中…`,update:`更新`,updating:`更新中…`,cancelEdit:`キャンセル`,success:`起票しました。`,editSuccess:`仕訳を更新しました。`,editVoidReason:`編集`,imbalance:`差額: {amount}`,balanced:`バランス OK ✓`},openingForm:{title:`期首残高`,asOfLabel:`基準日`,explainer:`B/S 科目(資産・負債・純資産)のみ入力可能。Σ借方=Σ貸方を満たす必要があり、差額は Retained Earnings に集約されます。`,emptyHint:`すべて空欄のまま保存しても構いません — 期首残高は後から更新できます。他のタブを利用するには、いったん期首残高が登録されている必要があります。`,explainer2:`B/S 科目のみ。`,submit:`期首残高を保存`,replaceWarning:`保存すると既存の期首残高は journal で取り消されます。`,none:`期首残高は未設定です。`,setBy:`{date} 時点で設定済み`,success:`期首残高を保存しました。`},ledger:{selectAccount:`科目を選択`,closingBalance:`期末残高`,columns:{date:`日付`,memo:`メモ`,debit:`借方`,credit:`貸方`,balance:`残高`,taxRegistrationId:`登録番号`}},dateRange:{shortcutLabel:`範囲`,currentQuarter:`今四半期`,previousQuarter:`前四半期`,currentYear:`今年度`,previousYear:`前年度`,lifetime:`開設以来`,all:`すべて`,fromLabel:`開始日`,toLabel:`終了日`},balanceSheet:{asOfLabel:`対象月`,sections:{asset:`資産`,liability:`負債`,equity:`純資産`},total:`合計`,imbalance:`差額: {amount}`,currentEarnings:`当期純損益`,shortcutLabel:`ショートカット`,thisMonth:`今月`,lastMonth:`先月`,lastQuarter:`前四半期`,lastYear:`前年`},profitLoss:{fromLabel:`開始日`,toLabel:`終了日`,income:`収益`,expense:`費用`,netIncome:`当期純利益:`},accounts:{listEmpty:`このカテゴリにはまだ勘定科目がありません。`,openLedgerAria:`{code} {name} の元帳を開く`,manageButton:`勘定科目を管理`,modalTitle:`勘定科目の管理`,addAccount:`勘定科目を追加`,sectionTitle:{asset:`資産`,liability:`負債`,equity:`純資産`,income:`収益`,expense:`費用`},columnCode:`コード`,columnName:`名称`,columnType:`区分`,columnNote:`メモ`,typeOption:{asset:`資産`,liability:`負債`,equity:`純資産`,income:`収益`,expense:`費用`},edit:`編集`,save:`保存`,cancel:`キャンセル`,saving:`保存中…`,addToCategory:`{type}を追加`,deactivate:`無効化`,reactivate:`有効化`,deactivateConfirm:`「{name}」を仕訳・元帳の選択肢から非表示にしますか?既存の仕訳には影響しません。`,errorEmptyCode:`コードは必須です。`,errorReservedCode:`「_」で始まるコードはシステム用に予約されています。`,errorInvalidCodeFormat:`勘定科目コードは4桁の数字で入力してください。`,errorCodeTypeMismatch:`コードの先頭桁は勘定科目タイプと一致させてください: 1xxx 資産, 2xxx 負債, 3xxx 純資産, 4xxx 収益, 5xxx 費用。`,errorEmptyName:`名称は必須です。`,errorDuplicateCode:`このコードの勘定科目は既に存在します。`,errorDuplicateName:`この名称の勘定科目は既に存在します。`,success:`勘定科目を保存しました。`,codeReadOnlyHint:`コードは作成後に変更できません。`,noteOptional:`(任意)`},settings:{bookInfo:`帳簿情報`,bookInfoExplain:`国を編集すると税の管轄に応じたアドバイスが更新されます。通貨は仕訳を入力した後は変更できません。`,countryUnset:`(未設定)`,fiscalYearEndExplain:`今後の日付範囲ショートカットの解決方法のみが変わります。既存の仕訳は移動しません。`,saveChanges:`変更を保存`,updateOk:`帳簿を更新しました。`,rebuild:`スナップショット再構築`,rebuildExplain:`月次スナップショットキャッシュをすべて削除し、journal から再計算します。journal を手で編集した後のリカバリに使えます。`,rebuildOk:`{count} 期間を再構築しました。`,advanced:`詳細設定…`,deleteBook:`帳簿を削除`,deleteBookExplain:`この帳簿のディレクトリを完全に削除します。元に戻せません。`,deleteBookConfirm:`確認のため "{bookName}" を入力してください:`,deleteBookButton:`完全に削除`},preview:{entry:`{date} の仕訳を起票`,pl:`P&L {from} → {to}: 純損益 {net}`,bs:`{date} 時点の B/S · 資産 {assets}`,bookCreated:`帳簿 "{name}" ({id}) を作成`,accountSaved:`勘定科目 {code} "{name}" を保存`,entryVoided:`仕訳を取り消し、{date} に反対仕訳を計上`,openingSet:`{date} 時点の期首残高を設定`,openingReplaced:`{date} 時点の期首残高を置き換え`},previewSummary:`会計 · {bookId}`,previewError:`会計: {error}`,previewGeneric:`会計の結果`}},zh:{pluginAccounting:{title:`会计`,noBook:`尚无账簿 — 点击上方 "+ 新建账簿" 创建第一个。`,common:{cancel:`取消`,loading:`加载中…`,error:`错误: {error}`,empty:`尚无条目。`},tabs:{journal:`日记账`,newEntry:`新建分录`,opening:`期初余额`,accounts:`科目`,ledger:`明细账`,balanceSheet:`资产负债表`,profitLoss:`损益`,settings:`设置`},bookSwitcher:{label:`账簿`,newBook:`新建账簿…`,create:`创建`,nameLabel:`名称`,currencyLabel:`货币`,countryLabel:`国家/地区`,countryPlaceholder:`选择国家/地区…`,countryHint:`国家/地区决定税务管辖,助手可据此提供本地化建议(日本T号、欧盟VAT ID等)。`,fiscalYearEndLabel:`财年结束日`,fiscalYearEndHint:`决定本账簿日期范围快捷方式所使用的财年边界。请选择财年结束的月份(该月最后一天)。默认 12月(自然年)。`,placeholder:`选择账簿…`,firstRunHint:`请为第一本账簿选择名称、货币、国家/地区与财年结束日。货币按账簿固定,登账后再更改会比较困难。`},deletedNotice:{title:`“{bookName}” 已删除。`,body:`请从上方下拉菜单选择其他账簿,或新建一本。`},journalList:{fromLabel:`起始`,toLabel:`结束`,accountLabel:`科目`,allAccounts:`所有科目`,void:`冲销`,edit:`编辑`,voidConfirm:`冲销此分录?原始分录保留在日记账中,会追加一对反向分录。`,voidReason:`原因(可选):`,columns:{date:`日期`,kind:`类型`,memo:`备注`,lines:`明细`},kind:{normal:`—`,opening:`期初`,void:`反向`,voidMarker:`冲销标记`}},entryForm:{title:`新建分录`,editTitle:`编辑分录`,editBanner:`提交后,原分录将被冲销并以此内容替换。`,dateLabel:`日期`,memoLabel:`备注`,accountLabel:`科目`,debitLabel:`借方`,creditLabel:`贷方`,taxRegistrationIdLabel:`税务登记号`,taxRegistrationIdPlaceholder:`T-number / VAT ID / GSTIN…`,taxRegistrationIdMissingWarning:`必填`,addLine:`添加行`,removeLine:`删除`,submit:`登账`,submitting:`登账中…`,update:`更新`,updating:`更新中…`,cancelEdit:`取消`,success:`已登账。`,editSuccess:`分录已更新。`,editVoidReason:`已编辑`,imbalance:`差额: {amount}`,balanced:`已平衡 ✓`},openingForm:{title:`期初余额`,asOfLabel:`基准日`,explainer:`仅允许 B/S 科目(资产 / 负债 / 权益)。Σ借方=Σ贷方,差额会落入 Retained Earnings。`,emptyHint:`可以全部留空保存——期初余额稍后再更新。账簿只需先存在一条期初记录,其他标签页才会解锁。`,explainer2:`仅 B/S 科目。`,submit:`保存期初余额`,replaceWarning:`保存会替换现有期初余额(旧的会在日记账中冲销)。`,none:`尚未设置期初余额。`,setBy:`{date} 已设置`,success:`期初余额已保存。`},ledger:{selectAccount:`选择科目`,closingBalance:`期末余额`,columns:{date:`日期`,memo:`备注`,debit:`借方`,credit:`贷方`,balance:`余额`,taxRegistrationId:`税务登记号`}},dateRange:{shortcutLabel:`范围`,currentQuarter:`本季度`,previousQuarter:`上季度`,currentYear:`本年度`,previousYear:`上年度`,lifetime:`自开账以来`,all:`全部`,fromLabel:`起始`,toLabel:`结束`},balanceSheet:{asOfLabel:`期间`,sections:{asset:`资产`,liability:`负债`,equity:`权益`},total:`合计`,imbalance:`差额: {amount}`,currentEarnings:`当期净损益`,shortcutLabel:`快捷方式`,thisMonth:`本月`,lastMonth:`上月`,lastQuarter:`上季度`,lastYear:`上年`},profitLoss:{fromLabel:`起始`,toLabel:`结束`,income:`收入`,expense:`支出`,netIncome:`净利润:`},accounts:{listEmpty:`此分类下暂无科目。`,openLedgerAria:`打开 {code} {name} 的明细账`,manageButton:`管理科目`,modalTitle:`管理科目`,addAccount:`添加科目`,sectionTitle:{asset:`资产`,liability:`负债`,equity:`权益`,income:`收入`,expense:`费用`},columnCode:`代码`,columnName:`名称`,columnType:`类型`,columnNote:`备注`,typeOption:{asset:`资产`,liability:`负债`,equity:`权益`,income:`收入`,expense:`费用`},edit:`编辑`,save:`保存`,cancel:`取消`,saving:`保存中…`,addToCategory:`添加{type}`,deactivate:`停用`,reactivate:`启用`,deactivateConfirm:`在分录/明细账下拉框中隐藏“{name}”?现有日记账分录不受影响。`,errorEmptyCode:`代码不能为空。`,errorReservedCode:`以 “_” 开头的代码保留给系统行使用。`,errorInvalidCodeFormat:`科目代码必须为 4 位数字。`,errorCodeTypeMismatch:`代码首位必须与科目类型匹配:1xxx 资产,2xxx 负债,3xxx 权益,4xxx 收入,5xxx 费用。`,errorEmptyName:`名称不能为空。`,errorDuplicateCode:`此代码的科目已存在。`,errorDuplicateName:`此名称的科目已存在。`,success:`科目已保存。`,codeReadOnlyHint:`科目创建后代码不能更改。`,noteOptional:`(可选)`},settings:{bookInfo:`账簿信息`,bookInfoExplain:`修改国家/地区可更新税务管辖相关建议。开始登账后货币不可更改。`,countryUnset:`(未设置)`,fiscalYearEndExplain:`仅影响今后日期范围快捷方式的解析方式;现有日记账分录不会移动。`,saveChanges:`保存更改`,updateOk:`账簿已更新。`,rebuild:`重建快照`,rebuildExplain:`删除全部月度快照缓存并从日记账重新计算。手动编辑日记账后可用。`,rebuildOk:`已重建 {count} 期。`,advanced:`高级设置…`,deleteBook:`删除账簿`,deleteBookExplain:`永久删除该账簿目录。无法撤销。`,deleteBookConfirm:`请输入 "{bookName}" 以确认:`,deleteBookButton:`彻底删除`},preview:{entry:`已记账 {date} 的分录`,pl:`P&L {from} → {to}: 净额 {net}`,bs:`{date} 资产负债表 · 资产 {assets}`,bookCreated:`已创建账簿 "{name}" ({id})`,accountSaved:`已保存科目 {code} "{name}"`,entryVoided:`已作废分录,并于 {date} 过账冲销分录`,openingSet:`已设置截至 {date} 的期初余额`,openingReplaced:`已替换截至 {date} 的期初余额`},previewSummary:`会计 · {bookId}`,previewError:`会计: {error}`,previewGeneric:`会计结果`}},ko:{pluginAccounting:{title:`회계`,noBook:`장부가 없습니다 — 위의 "+ 새 장부"를 눌러 첫 장부를 만드세요.`,common:{cancel:`취소`,loading:`불러오는 중…`,error:`오류: {error}`,empty:`아직 항목이 없습니다.`},tabs:{journal:`분개장`,newEntry:`새 분개`,opening:`기초잔액`,accounts:`계정`,ledger:`원장`,balanceSheet:`재무상태표`,profitLoss:`손익`,settings:`설정`},bookSwitcher:{label:`장부`,newBook:`새 장부…`,create:`생성`,nameLabel:`이름`,currencyLabel:`통화`,countryLabel:`국가`,countryPlaceholder:`국가 선택…`,countryHint:`국가를 설정하면 세무 관할이 결정되어 어시스턴트가 국가별 안내(일본 T-번호, EU VAT ID 등)를 제공할 수 있습니다.`,fiscalYearEndLabel:`회계연도 종료일`,fiscalYearEndHint:`이 장부의 날짜 범위 단축 메뉴에 사용되는 회계연도 경계를 결정합니다. 회계연도가 끝나는 월(그 달의 마지막 날)을 선택하세요. 기본값은 12월(달력 연도)입니다.`,placeholder:`장부 선택…`,firstRunHint:`첫 장부의 이름, 통화, 국가, 회계연도 종료일을 선택하세요. 통화는 장부별로 설정되며 분개를 시작한 뒤에는 변경이 어렵습니다.`},deletedNotice:{title:`“{bookName}” 장부가 삭제되었습니다.`,body:`위 드롭다운에서 다른 장부를 선택하거나 새 장부를 만드세요.`},journalList:{fromLabel:`시작`,toLabel:`종료`,accountLabel:`계정`,allAccounts:`모든 계정`,void:`취소`,edit:`편집`,voidConfirm:`이 분개를 취소하시겠습니까? 원 분개는 분개장에 남고 반대 분개가 추가됩니다.`,voidReason:`사유(선택):`,columns:{date:`날짜`,kind:`종류`,memo:`메모`,lines:`라인`},kind:{normal:`—`,opening:`기초`,void:`반대`,voidMarker:`취소 마커`}},entryForm:{title:`새 분개`,editTitle:`분개 편집`,editBanner:`제출하면 원본 분개가 무효 처리되고 이 내용으로 대체됩니다.`,dateLabel:`날짜`,memoLabel:`메모`,accountLabel:`계정`,debitLabel:`차변`,creditLabel:`대변`,taxRegistrationIdLabel:`세무 등록번호`,taxRegistrationIdPlaceholder:`T-number / VAT ID / GSTIN…`,taxRegistrationIdMissingWarning:`필수`,addLine:`라인 추가`,removeLine:`삭제`,submit:`등록`,submitting:`등록 중…`,update:`업데이트`,updating:`업데이트 중…`,cancelEdit:`취소`,success:`분개를 등록했습니다.`,editSuccess:`분개가 업데이트되었습니다.`,editVoidReason:`편집됨`,imbalance:`차액: {amount}`,balanced:`균형 ✓`},openingForm:{title:`기초잔액`,asOfLabel:`기준일`,explainer:`재무상태표 계정(자산/부채/자본)만 입력 가능. Σ차변=Σ대변이 되어야 하며 차액은 Retained Earnings에 흡수됩니다.`,emptyHint:`모두 비워둔 채 저장해도 괜찮습니다 — 기초잔액은 나중에 업데이트할 수 있습니다. 다른 탭을 사용하려면 일단 기초잔액 항목이 등록되어 있어야 합니다.`,explainer2:`재무상태표 계정만.`,submit:`기초잔액 저장`,replaceWarning:`저장 시 기존 기초잔액은 분개장에서 취소됩니다.`,none:`기초잔액이 설정되지 않았습니다.`,setBy:`{date} 기준 설정됨`,success:`기초잔액을 저장했습니다.`},ledger:{selectAccount:`계정 선택`,closingBalance:`기말 잔액`,columns:{date:`날짜`,memo:`메모`,debit:`차변`,credit:`대변`,balance:`잔액`,taxRegistrationId:`세무 등록번호`}},dateRange:{shortcutLabel:`범위`,currentQuarter:`이번 분기`,previousQuarter:`지난 분기`,currentYear:`이번 연도`,previousYear:`지난 연도`,lifetime:`개설 이후`,all:`전체`,fromLabel:`시작`,toLabel:`종료`},balanceSheet:{asOfLabel:`기간`,sections:{asset:`자산`,liability:`부채`,equity:`자본`},total:`합계`,imbalance:`차액: {amount}`,currentEarnings:`당기 순손익`,shortcutLabel:`바로가기`,thisMonth:`이번 달`,lastMonth:`지난달`,lastQuarter:`지난 분기`,lastYear:`지난 연도`},profitLoss:{fromLabel:`시작`,toLabel:`종료`,income:`수익`,expense:`비용`,netIncome:`당기순이익:`},accounts:{listEmpty:`이 카테고리에는 아직 계정이 없습니다.`,openLedgerAria:`{code} {name} 원장 열기`,manageButton:`계정 관리`,modalTitle:`계정 관리`,addAccount:`계정 추가`,sectionTitle:{asset:`자산`,liability:`부채`,equity:`자본`,income:`수익`,expense:`비용`},columnCode:`코드`,columnName:`이름`,columnType:`유형`,columnNote:`메모`,typeOption:{asset:`자산`,liability:`부채`,equity:`자본`,income:`수익`,expense:`비용`},edit:`편집`,save:`저장`,cancel:`취소`,saving:`저장 중…`,addToCategory:`{type} 추가`,deactivate:`비활성화`,reactivate:`활성화`,deactivateConfirm:`‘{name}’을(를) 분개/원장 드롭다운에서 숨기시겠습니까? 기존 분개 항목에는 영향이 없습니다.`,errorEmptyCode:`코드는 필수입니다.`,errorReservedCode:`“_”로 시작하는 코드는 시스템 행에 예약되어 있습니다.`,errorInvalidCodeFormat:`계정 코드는 정확히 4자리 숫자여야 합니다.`,errorCodeTypeMismatch:`코드의 첫 자리는 계정 유형과 일치해야 합니다: 1xxx 자산, 2xxx 부채, 3xxx 자본, 4xxx 수익, 5xxx 비용.`,errorEmptyName:`이름은 필수입니다.`,errorDuplicateCode:`이 코드의 계정이 이미 존재합니다.`,errorDuplicateName:`이 이름의 계정이 이미 존재합니다.`,success:`계정을 저장했습니다.`,codeReadOnlyHint:`계정을 만든 후에는 코드를 변경할 수 없습니다.`,noteOptional:`(선택)`},settings:{bookInfo:`장부 정보`,bookInfoExplain:`국가를 변경하면 세무 관할 기반 안내가 갱신됩니다. 분개를 시작한 뒤에는 통화를 변경할 수 없습니다.`,countryUnset:`(미설정)`,fiscalYearEndExplain:`이후 날짜 범위 단축 메뉴의 해석 방식만 변경됩니다. 기존 분개 항목은 이동되지 않습니다.`,saveChanges:`변경 저장`,updateOk:`장부를 업데이트했습니다.`,rebuild:`스냅샷 재구축`,rebuildExplain:`모든 월별 스냅샷 캐시를 지우고 분개장에서 재계산합니다. 분개 파일을 직접 편집한 뒤 복구할 때 유용합니다.`,rebuildOk:`{count}개 기간을 재구축했습니다.`,advanced:`고급…`,deleteBook:`장부 삭제`,deleteBookExplain:`이 장부의 디렉터리를 영구히 삭제합니다. 되돌릴 수 없습니다.`,deleteBookConfirm:`확인을 위해 "{bookName}"을 입력하세요:`,deleteBookButton:`영구 삭제`},preview:{entry:`{date} 분개를 등록`,pl:`P&L {from} → {to}: 순이익 {net}`,bs:`{date} 재무상태표 · 자산 {assets}`,bookCreated:`장부 "{name}" ({id})를 생성했습니다`,accountSaved:`계정 {code} "{name}"을(를) 저장했습니다`,entryVoided:`분개를 취소하고 {date}에 역분개를 기록했습니다`,openingSet:`{date} 기준 기초 잔액을 설정했습니다`,openingReplaced:`{date} 기준 기초 잔액을 교체했습니다`},previewSummary:`회계 · {bookId}`,previewError:`회계: {error}`,previewGeneric:`회계 결과`}},es:{pluginAccounting:{title:`Contabilidad`,noBook:`Aún no hay libros — pulsa "+ Nuevo libro" arriba para crear el primero.`,common:{cancel:`Cancelar`,loading:`Cargando…`,error:`Error: {error}`,empty:`Aún no hay entradas.`},tabs:{journal:`Diario`,newEntry:`Nueva entrada`,opening:`Apertura`,accounts:`Cuentas`,ledger:`Mayor`,balanceSheet:`Balance`,profitLoss:`P&L`,settings:`Ajustes`},bookSwitcher:{label:`Libro`,newBook:`Nuevo libro…`,create:`Crear`,nameLabel:`Nombre`,currencyLabel:`Moneda`,countryLabel:`País`,countryPlaceholder:`Selecciona un país…`,countryHint:`El país define la jurisdicción fiscal para que el asistente pueda dar consejos específicos (T-number en Japón, ID de IVA en la UE, etc.).`,fiscalYearEndLabel:`Cierre del ejercicio`,fiscalYearEndHint:`Define el límite del ejercicio para los atajos de rango de fechas de este libro. Elige el mes en cuyo último día cierra el ejercicio. Por defecto: diciembre (año natural).`,placeholder:`Elige un libro…`,firstRunHint:`Elige el nombre, la moneda, el país y el cierre de ejercicio de tu primer libro. La moneda se fija por libro y es difícil cambiarla una vez que empieces a registrar asientos.`},deletedNotice:{title:`“{bookName}” se ha eliminado.`,body:`Elige otro libro en el desplegable de arriba o crea uno nuevo.`},journalList:{fromLabel:`Desde`,toLabel:`Hasta`,accountLabel:`Cuenta`,allAccounts:`Todas`,void:`Anular`,edit:`Editar`,voidConfirm:`¿Anular esta entrada? La original permanece en el diario; se añade un par de reversión.`,voidReason:`Motivo (opcional):`,columns:{date:`Fecha`,kind:`Tipo`,memo:`Memo`,lines:`Líneas`},kind:{normal:`—`,opening:`Apertura`,void:`Reverso`,voidMarker:`Marcador de anulación`}},entryForm:{title:`Nueva entrada`,editTitle:`Editar entrada`,editBanner:`Al enviar, la entrada original será anulada y sustituida por esta.`,dateLabel:`Fecha`,memoLabel:`Memo`,accountLabel:`Cuenta`,debitLabel:`Debe`,creditLabel:`Haber`,taxRegistrationIdLabel:`ID fiscal`,taxRegistrationIdPlaceholder:`NIF / VAT ID / RFC…`,taxRegistrationIdMissingWarning:`Obligatorio`,addLine:`Añadir línea`,removeLine:`Quitar`,submit:`Asentar`,submitting:`Asentando…`,update:`Actualizar`,updating:`Actualizando…`,cancelEdit:`Cancelar`,success:`Entrada asentada.`,editSuccess:`Entrada actualizada.`,editVoidReason:`editado`,imbalance:`Descuadre: {amount}`,balanced:`Cuadrada ✓`},openingForm:{title:`Saldos de apertura`,asOfLabel:`Al`,explainer:`Solo cuentas de balance (activo/pasivo/patrimonio). Σ debe = Σ haber; la diferencia va a Retained Earnings.`,emptyHint:`Puedes guardar todo en blanco — luego puedes actualizar los saldos de apertura. Solo hace falta tener una apertura registrada para desbloquear las demás pestañas.`,explainer2:`Solo cuentas de balance.`,submit:`Guardar saldos de apertura`,replaceWarning:`Al guardar se reemplaza la apertura existente (la anterior se anula en el diario).`,none:`Aún no hay saldos de apertura.`,setBy:`Establecido al {date}`,success:`Saldos guardados.`},ledger:{selectAccount:`Seleccionar cuenta`,closingBalance:`Saldo final`,columns:{date:`Fecha`,memo:`Memo`,debit:`Debe`,credit:`Haber`,balance:`Saldo`,taxRegistrationId:`ID fiscal`}},dateRange:{shortcutLabel:`Rango`,currentQuarter:`Trimestre actual`,previousQuarter:`Último trimestre`,currentYear:`Año en curso`,previousYear:`Año anterior`,lifetime:`Desde la apertura`,all:`Todo`,fromLabel:`Desde`,toLabel:`Hasta`},balanceSheet:{asOfLabel:`Período`,sections:{asset:`Activo`,liability:`Pasivo`,equity:`Patrimonio`},total:`Total`,imbalance:`Descuadre: {amount}`,currentEarnings:`Resultado del período`,shortcutLabel:`Atajo`,thisMonth:`Este mes`,lastMonth:`Mes anterior`,lastQuarter:`Último trimestre`,lastYear:`Año anterior`},profitLoss:{fromLabel:`Desde`,toLabel:`Hasta`,income:`Ingresos`,expense:`Gastos`,netIncome:`Resultado neto:`},accounts:{listEmpty:`No hay cuentas en esta categoría.`,openLedgerAria:`Abrir mayor de {code} {name}`,manageButton:`Gestionar cuentas`,modalTitle:`Gestionar cuentas`,addAccount:`Añadir cuenta`,sectionTitle:{asset:`Activos`,liability:`Pasivos`,equity:`Patrimonio`,income:`Ingresos`,expense:`Gastos`},columnCode:`Código`,columnName:`Nombre`,columnType:`Tipo`,columnNote:`Nota`,typeOption:{asset:`Activo`,liability:`Pasivo`,equity:`Patrimonio`,income:`Ingreso`,expense:`Gasto`},edit:`Editar`,save:`Guardar`,cancel:`Cancelar`,saving:`Guardando…`,addToCategory:`Añadir cuenta de {type}`,deactivate:`Desactivar`,reactivate:`Activar`,deactivateConfirm:`¿Ocultar “{name}” de los desplegables de asientos / mayor? Los asientos existentes no se ven afectados.`,errorEmptyCode:`El código es obligatorio.`,errorReservedCode:`Los códigos que empiezan por “_” están reservados para filas del sistema.`,errorInvalidCodeFormat:`El código de cuenta debe tener exactamente 4 dígitos.`,errorCodeTypeMismatch:`El código debe coincidir con el tipo de cuenta: 1xxx activo, 2xxx pasivo, 3xxx patrimonio, 4xxx ingreso, 5xxx gasto.`,errorEmptyName:`El nombre es obligatorio.`,errorDuplicateCode:`Ya existe una cuenta con este código.`,errorDuplicateName:`Ya existe una cuenta con este nombre.`,success:`Cuenta guardada.`,codeReadOnlyHint:`El código no puede cambiarse una vez creada la cuenta.`,noteOptional:`(opcional)`},settings:{bookInfo:`Información del libro`,bookInfoExplain:`Edita el país para actualizar los consejos según la jurisdicción fiscal. La moneda no puede cambiarse una vez registrados los asientos.`,countryUnset:`(sin definir)`,fiscalYearEndExplain:`Solo cambia cómo se resuelven los atajos de rango de fechas en adelante; los asientos existentes no se mueven.`,saveChanges:`Guardar cambios`,updateOk:`Libro actualizado.`,rebuild:`Reconstruir snapshots`,rebuildExplain:`Borra todos los snapshots mensuales y los recalcula desde el diario. Útil tras editar el diario a mano.`,rebuildOk:`Reconstruidos {count} período(s).`,advanced:`Avanzado…`,deleteBook:`Eliminar libro`,deleteBookExplain:`Elimina permanentemente el directorio del libro. No se puede deshacer.`,deleteBookConfirm:`Escribe "{bookName}" para confirmar:`,deleteBookButton:`Eliminar para siempre`},preview:{entry:`Entrada asentada el {date}`,pl:`P&L {from} → {to}: neto {net}`,bs:`Balance al {date} · activos {assets}`,bookCreated:`Libro "{name}" ({id}) creado`,accountSaved:`Cuenta {code} "{name}" guardada`,entryVoided:`Asiento anulado; reversión registrada el {date}`,openingSet:`Saldos iniciales establecidos al {date}`,openingReplaced:`Saldos iniciales reemplazados al {date}`},previewSummary:`Contabilidad · {bookId}`,previewError:`Contabilidad: {error}`,previewGeneric:`Resultado de contabilidad`}},"pt-BR":{pluginAccounting:{title:`Contabilidade`,noBook:`Ainda não há livros — clique em "+ Novo livro" acima para criar o primeiro.`,common:{cancel:`Cancelar`,loading:`Carregando…`,error:`Erro: {error}`,empty:`Ainda não há lançamentos.`},tabs:{journal:`Diário`,newEntry:`Novo lançamento`,opening:`Abertura`,accounts:`Contas`,ledger:`Razão`,balanceSheet:`Balanço`,profitLoss:`DRE`,settings:`Configurações`},bookSwitcher:{label:`Livro`,newBook:`Novo livro…`,create:`Criar`,nameLabel:`Nome`,currencyLabel:`Moeda`,countryLabel:`País`,countryPlaceholder:`Selecione um país…`,countryHint:`O país define a jurisdição fiscal para que o assistente possa dar conselhos específicos (T-number no Japão, ID de IVA na UE, etc.).`,fiscalYearEndLabel:`Encerramento do exercício`,fiscalYearEndHint:`Define o limite do exercício social usado pelos atalhos de período deste livro. Escolha o mês em cujo último dia o exercício encerra. Padrão: dezembro (ano civil).`,placeholder:`Selecione um livro…`,firstRunHint:`Escolha o nome, a moeda, o país e o encerramento do exercício do seu primeiro livro. A moeda é definida por livro e fica difícil alterar depois de começar a lançar.`},deletedNotice:{title:`“{bookName}” foi excluído.`,body:`Selecione outro livro no menu acima ou crie um novo.`},journalList:{fromLabel:`De`,toLabel:`Até`,accountLabel:`Conta`,allAccounts:`Todas as contas`,void:`Estornar`,edit:`Editar`,voidConfirm:`Estornar este lançamento? O original permanece no diário e um par de reversão é anexado.`,voidReason:`Motivo (opcional):`,columns:{date:`Data`,kind:`Tipo`,memo:`Memo`,lines:`Linhas`},kind:{normal:`—`,opening:`Abertura`,void:`Reverso`,voidMarker:`Marcador de estorno`}},entryForm:{title:`Novo lançamento`,editTitle:`Editar lançamento`,editBanner:`Ao enviar, o lançamento original será estornado e substituído por este.`,dateLabel:`Data`,memoLabel:`Memo`,accountLabel:`Conta`,debitLabel:`Débito`,creditLabel:`Crédito`,taxRegistrationIdLabel:`Inscrição fiscal`,taxRegistrationIdPlaceholder:`CNPJ / VAT ID / GSTIN…`,taxRegistrationIdMissingWarning:`Obrigatório`,addLine:`Adicionar linha`,removeLine:`Remover`,submit:`Lançar`,submitting:`Lançando…`,update:`Atualizar`,updating:`Atualizando…`,cancelEdit:`Cancelar`,success:`Lançamento registrado.`,editSuccess:`Lançamento atualizado.`,editVoidReason:`editado`,imbalance:`Diferença: {amount}`,balanced:`Equilibrado ✓`},openingForm:{title:`Saldos iniciais`,asOfLabel:`Em`,explainer:`Apenas contas de balanço (ativo/passivo/patrimônio). Σ débito = Σ crédito; a diferença entra em Retained Earnings.`,emptyHint:`Você pode salvar tudo em branco — os saldos iniciais podem ser atualizados depois. Basta ter uma abertura registrada para que as outras abas sejam liberadas.`,explainer2:`Apenas contas de balanço.`,submit:`Salvar saldos iniciais`,replaceWarning:`Salvar substitui a abertura existente (a anterior é estornada no diário).`,none:`Ainda não há saldo inicial.`,setBy:`Definido em {date}`,success:`Saldos iniciais salvos.`},ledger:{selectAccount:`Selecionar conta`,closingBalance:`Saldo final`,columns:{date:`Data`,memo:`Memo`,debit:`Débito`,credit:`Crédito`,balance:`Saldo`,taxRegistrationId:`Inscrição fiscal`}},dateRange:{shortcutLabel:`Período`,currentQuarter:`Trimestre atual`,previousQuarter:`Último trimestre`,currentYear:`Ano atual`,previousYear:`Ano anterior`,lifetime:`Desde a abertura`,all:`Tudo`,fromLabel:`De`,toLabel:`Até`},balanceSheet:{asOfLabel:`Período`,sections:{asset:`Ativo`,liability:`Passivo`,equity:`Patrimônio`},total:`Total`,imbalance:`Diferença: {amount}`,currentEarnings:`Resultado do período`,shortcutLabel:`Atalho`,thisMonth:`Este mês`,lastMonth:`Mês anterior`,lastQuarter:`Último trimestre`,lastYear:`Ano anterior`},profitLoss:{fromLabel:`De`,toLabel:`Até`,income:`Receita`,expense:`Despesa`,netIncome:`Resultado líquido:`},accounts:{listEmpty:`Ainda não há contas nesta categoria.`,openLedgerAria:`Abrir razão de {code} {name}`,manageButton:`Gerenciar contas`,modalTitle:`Gerenciar contas`,addAccount:`Adicionar conta`,sectionTitle:{asset:`Ativos`,liability:`Passivos`,equity:`Patrimônio`,income:`Receitas`,expense:`Despesas`},columnCode:`Código`,columnName:`Nome`,columnType:`Tipo`,columnNote:`Observação`,typeOption:{asset:`Ativo`,liability:`Passivo`,equity:`Patrimônio`,income:`Receita`,expense:`Despesa`},edit:`Editar`,save:`Salvar`,cancel:`Cancelar`,saving:`Salvando…`,addToCategory:`Adicionar conta de {type}`,deactivate:`Desativar`,reactivate:`Ativar`,deactivateConfirm:`Ocultar “{name}” dos menus de lançamentos / razão? Os lançamentos existentes não são afetados.`,errorEmptyCode:`O código é obrigatório.`,errorReservedCode:`Códigos iniciados por “_” são reservados para linhas do sistema.`,errorInvalidCodeFormat:`O código da conta deve ter exatamente 4 dígitos.`,errorCodeTypeMismatch:`O código deve corresponder ao tipo de conta: 1xxx ativo, 2xxx passivo, 3xxx patrimônio, 4xxx receita, 5xxx despesa.`,errorEmptyName:`O nome é obrigatório.`,errorDuplicateCode:`Já existe uma conta com este código.`,errorDuplicateName:`Já existe uma conta com este nome.`,success:`Conta salva.`,codeReadOnlyHint:`O código não pode ser alterado depois que a conta é criada.`,noteOptional:`(opcional)`},settings:{bookInfo:`Informações do livro`,bookInfoExplain:`Edite o país para atualizar as recomendações conforme a jurisdição fiscal. A moeda não pode ser alterada após registrar lançamentos.`,countryUnset:`(não definido)`,fiscalYearEndExplain:`Apenas altera como os atalhos de período são resolvidos a partir de agora; lançamentos existentes não são movidos.`,saveChanges:`Salvar alterações`,updateOk:`Livro atualizado.`,rebuild:`Reconstruir snapshots`,rebuildExplain:`Apaga todos os snapshots mensais e recalcula a partir do diário. Útil após editar o diário manualmente.`,rebuildOk:`Reconstruído(s) {count} período(s).`,advanced:`Avançado…`,deleteBook:`Excluir livro`,deleteBookExplain:`Exclui permanentemente o diretório do livro. Não pode ser desfeito.`,deleteBookConfirm:`Digite "{bookName}" para confirmar:`,deleteBookButton:`Excluir para sempre`},preview:{entry:`Lançamento em {date}`,pl:`P&L {from} → {to}: líquido {net}`,bs:`Balanço em {date} · ativos {assets}`,bookCreated:`Livro "{name}" ({id}) criado`,accountSaved:`Conta {code} "{name}" salva`,entryVoided:`Lançamento estornado; reversão lançada em {date}`,openingSet:`Saldos iniciais definidos em {date}`,openingReplaced:`Saldos iniciais substituídos em {date}`},previewSummary:`Contabilidade · {bookId}`,previewError:`Contabilidade: {error}`,previewGeneric:`Resultado da contabilidade`}},fr:{pluginAccounting:{title:`Comptabilité`,noBook:`Pas encore de livres — cliquez sur "+ Nouveau livre" en haut pour créer le premier.`,common:{cancel:`Annuler`,loading:`Chargement…`,error:`Erreur : {error}`,empty:`Aucune écriture pour l'instant.`},tabs:{journal:`Journal`,newEntry:`Nouvelle écriture`,opening:`Ouverture`,accounts:`Comptes`,ledger:`Grand livre`,balanceSheet:`Bilan`,profitLoss:`Résultat`,settings:`Paramètres`},bookSwitcher:{label:`Livre`,newBook:`Nouveau livre…`,create:`Créer`,nameLabel:`Nom`,currencyLabel:`Devise`,countryLabel:`Pays`,countryPlaceholder:`Sélectionner un pays…`,countryHint:`Le pays définit la juridiction fiscale afin que l'assistant puisse donner des conseils ciblés (T-number au Japon, ID TVA dans l'UE, etc.).`,fiscalYearEndLabel:`Clôture de l'exercice`,fiscalYearEndHint:`Définit la limite de l'exercice utilisée par les raccourcis de plage de dates de ce livre. Choisissez le mois au dernier jour duquel l'exercice se clôture. Par défaut : décembre (année civile).`,placeholder:`Sélectionner un livre…`,firstRunHint:`Choisissez le nom, la devise, le pays et la clôture de l'exercice de votre premier livre. La devise est figée par livre et difficile à changer une fois les écritures commencées.`},deletedNotice:{title:`« {bookName} » a été supprimé.`,body:`Choisissez un autre livre dans la liste ci-dessus ou créez-en un nouveau.`},journalList:{fromLabel:`Du`,toLabel:`Au`,accountLabel:`Compte`,allAccounts:`Tous`,void:`Annuler`,edit:`Modifier`,voidConfirm:`Annuler cette écriture ? L'originale reste dans le journal ; une paire de contre-passation est ajoutée.`,voidReason:`Motif (optionnel) :`,columns:{date:`Date`,kind:`Type`,memo:`Mémo`,lines:`Lignes`},kind:{normal:`—`,opening:`Ouverture`,void:`Contre-passation`,voidMarker:`Marqueur d'annulation`}},entryForm:{title:`Nouvelle écriture`,editTitle:`Modifier l'écriture`,editBanner:`À l'envoi, l'écriture d'origine sera contre-passée et remplacée par celle-ci.`,dateLabel:`Date`,memoLabel:`Mémo`,accountLabel:`Compte`,debitLabel:`Débit`,creditLabel:`Crédit`,taxRegistrationIdLabel:`N° d'identification fiscale`,taxRegistrationIdPlaceholder:`TVA / SIRET / GSTIN…`,taxRegistrationIdMissingWarning:`Obligatoire`,addLine:`Ajouter une ligne`,removeLine:`Supprimer`,submit:`Comptabiliser`,submitting:`Comptabilisation…`,update:`Mettre à jour`,updating:`Mise à jour…`,cancelEdit:`Annuler`,success:`Écriture comptabilisée.`,editSuccess:`Écriture mise à jour.`,editVoidReason:`modifiée`,imbalance:`Déséquilibre : {amount}`,balanced:`Équilibré ✓`},openingForm:{title:`Soldes d'ouverture`,asOfLabel:`Au`,explainer:`Comptes de bilan uniquement (actif/passif/capitaux). Σ débit = Σ crédit ; le solde tombe sur Retained Earnings.`,emptyHint:`Vous pouvez enregistrer en laissant tout vide — les soldes d'ouverture peuvent être mis à jour plus tard. Il suffit qu'une ouverture soit enregistrée pour débloquer les autres onglets.`,explainer2:`Comptes de bilan uniquement.`,submit:`Enregistrer les soldes d'ouverture`,replaceWarning:`Enregistrer remplace l'ouverture existante (l'ancienne est contre-passée dans le journal).`,none:`Aucun solde d'ouverture défini.`,setBy:`Défini au {date}`,success:`Soldes d'ouverture enregistrés.`},ledger:{selectAccount:`Sélectionner un compte`,closingBalance:`Solde de clôture`,columns:{date:`Date`,memo:`Mémo`,debit:`Débit`,credit:`Crédit`,balance:`Solde`,taxRegistrationId:`N° d'identification fiscale`}},dateRange:{shortcutLabel:`Plage`,currentQuarter:`Trimestre en cours`,previousQuarter:`Trimestre précédent`,currentYear:`Exercice en cours`,previousYear:`Exercice précédent`,lifetime:`Depuis l'ouverture`,all:`Tout`,fromLabel:`Du`,toLabel:`Au`},balanceSheet:{asOfLabel:`Période`,sections:{asset:`Actif`,liability:`Passif`,equity:`Capitaux`},total:`Total`,imbalance:`Déséquilibre : {amount}`,currentEarnings:`Résultat de la période`,shortcutLabel:`Raccourci`,thisMonth:`Ce mois-ci`,lastMonth:`Mois précédent`,lastQuarter:`Trimestre précédent`,lastYear:`Année précédente`},profitLoss:{fromLabel:`Du`,toLabel:`Au`,income:`Produits`,expense:`Charges`,netIncome:`Résultat net :`},accounts:{listEmpty:`Aucun compte dans cette catégorie pour l'instant.`,openLedgerAria:`Ouvrir le grand livre de {code} {name}`,manageButton:`Gérer les comptes`,modalTitle:`Gérer les comptes`,addAccount:`Ajouter un compte`,sectionTitle:{asset:`Actifs`,liability:`Passifs`,equity:`Capitaux propres`,income:`Produits`,expense:`Charges`},columnCode:`Code`,columnName:`Nom`,columnType:`Type`,columnNote:`Note`,typeOption:{asset:`Actif`,liability:`Passif`,equity:`Capitaux propres`,income:`Produit`,expense:`Charge`},edit:`Modifier`,save:`Enregistrer`,cancel:`Annuler`,saving:`Enregistrement…`,addToCategory:`Ajouter un compte de {type}`,deactivate:`Désactiver`,reactivate:`Activer`,deactivateConfirm:`Masquer « {name} » des listes déroulantes d’écriture / grand livre ? Les écritures existantes ne sont pas affectées.`,errorEmptyCode:`Le code est requis.`,errorReservedCode:`Les codes commençant par « _ » sont réservés aux lignes système.`,errorInvalidCodeFormat:`Le code de compte doit comporter exactement 4 chiffres.`,errorCodeTypeMismatch:`Le code doit correspondre au type de compte : 1xxx actif, 2xxx passif, 3xxx capitaux propres, 4xxx produit, 5xxx charge.`,errorEmptyName:`Le nom est requis.`,errorDuplicateCode:`Un compte avec ce code existe déjà.`,errorDuplicateName:`Un compte portant ce nom existe déjà.`,success:`Compte enregistré.`,codeReadOnlyHint:`Le code ne peut pas être modifié une fois le compte créé.`,noteOptional:`(facultatif)`},settings:{bookInfo:`Informations du livre`,bookInfoExplain:`Modifiez le pays pour mettre à jour les conseils selon la juridiction fiscale. La devise ne peut pas être changée une fois des écritures saisies.`,countryUnset:`(non défini)`,fiscalYearEndExplain:`Modifie uniquement la résolution des raccourcis de plage de dates à partir de maintenant ; les écritures existantes ne sont pas déplacées.`,saveChanges:`Enregistrer les modifications`,updateOk:`Livre mis à jour.`,rebuild:`Reconstruire les snapshots`,rebuildExplain:`Supprime tous les snapshots mensuels et les recalcule depuis le journal. Utile après modification manuelle du journal.`,rebuildOk:`{count} période(s) reconstruite(s).`,advanced:`Avancé…`,deleteBook:`Supprimer le livre`,deleteBookExplain:`Supprime définitivement le répertoire du livre. Irréversible.`,deleteBookConfirm:`Tapez "{bookName}" pour confirmer :`,deleteBookButton:`Supprimer définitivement`},preview:{entry:`Écriture comptabilisée le {date}`,pl:`P&L {from} → {to} : net {net}`,bs:`Bilan au {date} · actif {assets}`,bookCreated:`Livre "{name}" ({id}) créé`,accountSaved:`Compte {code} « {name} » enregistré`,entryVoided:`Écriture annulée ; contrepassation passée le {date}`,openingSet:`Soldes d'ouverture définis au {date}`,openingReplaced:`Soldes d'ouverture remplacés au {date}`},previewSummary:`Comptabilité · {bookId}`,previewError:`Comptabilité : {error}`,previewGeneric:`Résultat comptable`}},de:{pluginAccounting:{title:`Buchhaltung`,noBook:`Noch keine Bücher — klicken Sie oben auf "+ Neues Buch", um das erste anzulegen.`,common:{cancel:`Abbrechen`,loading:`Lädt…`,error:`Fehler: {error}`,empty:`Noch keine Einträge.`},tabs:{journal:`Journal`,newEntry:`Neuer Eintrag`,opening:`Eröffnung`,accounts:`Konten`,ledger:`Hauptbuch`,balanceSheet:`Bilanz`,profitLoss:`GuV`,settings:`Einstellungen`},bookSwitcher:{label:`Buch`,newBook:`Neues Buch…`,create:`Anlegen`,nameLabel:`Name`,currencyLabel:`Währung`,countryLabel:`Land`,countryPlaceholder:`Land auswählen…`,countryHint:`Das Land legt die Steuerjurisdiktion fest, damit der Assistent länderspezifische Hinweise geben kann (T-Nummer in Japan, USt-IdNr. in der EU usw.).`,fiscalYearEndLabel:`Geschäftsjahresende`,fiscalYearEndHint:`Bestimmt die Geschäftsjahresgrenze, die für die Datumsbereich-Schnellauswahl in diesem Buch verwendet wird. Wähle den Monat, an dessen letztem Tag das Geschäftsjahr endet. Standard: Dezember (Kalenderjahr).`,placeholder:`Buch auswählen…`,firstRunHint:`Wählen Sie Name, Währung, Land und Geschäftsjahresende für Ihr erstes Buch. Die Währung ist pro Buch fest und nach den ersten Buchungen schwer zu ändern.`},deletedNotice:{title:`Das Buch "{bookName}" wurde gelöscht.`,body:`Wählen Sie oben ein anderes Buch aus oder legen Sie ein neues an.`},journalList:{fromLabel:`Von`,toLabel:`Bis`,accountLabel:`Konto`,allAccounts:`Alle Konten`,void:`Stornieren`,edit:`Bearbeiten`,voidConfirm:`Diesen Eintrag stornieren? Das Original bleibt im Journal; ein Stornopaar wird angehängt.`,voidReason:`Grund (optional):`,columns:{date:`Datum`,kind:`Art`,memo:`Memo`,lines:`Zeilen`},kind:{normal:`—`,opening:`Eröffnung`,void:`Storno`,voidMarker:`Storno-Marker`}},entryForm:{title:`Neuer Eintrag`,editTitle:`Eintrag bearbeiten`,editBanner:`Beim Absenden wird der Originaleintrag storniert und durch diesen ersetzt.`,dateLabel:`Datum`,memoLabel:`Memo`,accountLabel:`Konto`,debitLabel:`Soll`,creditLabel:`Haben`,taxRegistrationIdLabel:`Steuernummer`,taxRegistrationIdPlaceholder:`USt-IdNr. / VAT ID / GSTIN…`,taxRegistrationIdMissingWarning:`Erforderlich`,addLine:`Zeile hinzufügen`,removeLine:`Entfernen`,submit:`Buchen`,submitting:`Bucht…`,update:`Aktualisieren`,updating:`Aktualisiert…`,cancelEdit:`Abbrechen`,success:`Eintrag gebucht.`,editSuccess:`Eintrag aktualisiert.`,editVoidReason:`bearbeitet`,imbalance:`Differenz: {amount}`,balanced:`Ausgeglichen ✓`},openingForm:{title:`Eröffnungsbilanz`,asOfLabel:`Per`,explainer:`Nur Bilanzkonten (Aktiva/Passiva/Eigenkapital). Σ Soll = Σ Haben; die Differenz fließt in Retained Earnings.`,emptyHint:`Sie können das Formular leer speichern — die Eröffnungsbilanz lässt sich später aktualisieren. Es reicht, dass einmalig eine Eröffnung hinterlegt ist, damit die übrigen Tabs freigeschaltet werden.`,explainer2:`Nur Bilanzkonten.`,submit:`Eröffnungsbilanz speichern`,replaceWarning:`Beim Speichern wird die bestehende Eröffnung ersetzt (die alte wird im Journal storniert).`,none:`Noch keine Eröffnungsbilanz.`,setBy:`Per {date} festgelegt`,success:`Eröffnungsbilanz gespeichert.`},ledger:{selectAccount:`Konto wählen`,closingBalance:`Schlusssaldo`,columns:{date:`Datum`,memo:`Memo`,debit:`Soll`,credit:`Haben`,balance:`Saldo`,taxRegistrationId:`Steuernummer`}},dateRange:{shortcutLabel:`Bereich`,currentQuarter:`Aktuelles Quartal`,previousQuarter:`Letztes Quartal`,currentYear:`Aktuelles Jahr`,previousYear:`Letztes Jahr`,lifetime:`Seit Eröffnung`,all:`Alle`,fromLabel:`Von`,toLabel:`Bis`},balanceSheet:{asOfLabel:`Periode`,sections:{asset:`Aktiva`,liability:`Passiva`,equity:`Eigenkapital`},total:`Summe`,imbalance:`Differenz: {amount}`,currentEarnings:`Periodenergebnis`,shortcutLabel:`Schnellauswahl`,thisMonth:`Dieser Monat`,lastMonth:`Letzter Monat`,lastQuarter:`Letztes Quartal`,lastYear:`Letztes Jahr`},profitLoss:{fromLabel:`Von`,toLabel:`Bis`,income:`Erträge`,expense:`Aufwendungen`,netIncome:`Jahresüberschuss:`},accounts:{listEmpty:`In dieser Kategorie sind noch keine Konten vorhanden.`,openLedgerAria:`Hauptbuch für {code} {name} öffnen`,manageButton:`Konten verwalten`,modalTitle:`Konten verwalten`,addAccount:`Konto hinzufügen`,sectionTitle:{asset:`Aktiva`,liability:`Passiva`,equity:`Eigenkapital`,income:`Erträge`,expense:`Aufwendungen`},columnCode:`Code`,columnName:`Name`,columnType:`Typ`,columnNote:`Notiz`,typeOption:{asset:`Aktivkonto`,liability:`Passivkonto`,equity:`Eigenkapital`,income:`Ertrag`,expense:`Aufwand`},edit:`Bearbeiten`,save:`Speichern`,cancel:`Abbrechen`,saving:`Wird gespeichert…`,addToCategory:`Konto vom Typ {type} hinzufügen`,deactivate:`Deaktivieren`,reactivate:`Aktivieren`,deactivateConfirm:`Soll „{name}“ aus den Buchungs- und Kontodropdowns ausgeblendet werden? Bestehende Buchungen bleiben unberührt.`,errorEmptyCode:`Code ist erforderlich.`,errorReservedCode:`Codes, die mit „_“ beginnen, sind für Systemzeilen reserviert.`,errorInvalidCodeFormat:`Der Kontocode muss genau 4 Ziffern haben.`,errorCodeTypeMismatch:`Der Code muss zur Kontoart passen: 1xxx Aktivkonto, 2xxx Passivkonto, 3xxx Eigenkapital, 4xxx Ertrag, 5xxx Aufwand.`,errorEmptyName:`Name ist erforderlich.`,errorDuplicateCode:`Ein Konto mit diesem Code existiert bereits.`,errorDuplicateName:`Ein Konto mit diesem Namen existiert bereits.`,success:`Konto gespeichert.`,codeReadOnlyHint:`Der Code kann nach dem Anlegen des Kontos nicht mehr geändert werden.`,noteOptional:`(optional)`},settings:{bookInfo:`Buchinformationen`,bookInfoExplain:`Ändern Sie das Land, um die Hinweise zur Steuerjurisdiktion zu aktualisieren. Die Währung kann nach gebuchten Einträgen nicht mehr geändert werden.`,countryUnset:`(nicht gesetzt)`,fiscalYearEndExplain:`Ändert nur, wie die Datumsbereich-Schnellauswahl ab jetzt aufgelöst wird; bestehende Buchungen werden nicht verschoben.`,saveChanges:`Änderungen speichern`,updateOk:`Buch aktualisiert.`,rebuild:`Snapshots neu aufbauen`,rebuildExplain:`Verwirft alle Monats-Snapshots und berechnet sie aus dem Journal neu. Nützlich nach manueller Bearbeitung.`,rebuildOk:`{count} Periode(n) neu aufgebaut.`,advanced:`Erweitert…`,deleteBook:`Buch löschen`,deleteBookExplain:`Löscht das Buch-Verzeichnis dauerhaft. Nicht rückgängig zu machen.`,deleteBookConfirm:`Tippen Sie "{bookName}" zur Bestätigung:`,deleteBookButton:`Endgültig löschen`},preview:{entry:`Eintrag am {date} gebucht`,pl:`GuV {from} → {to}: netto {net}`,bs:`Bilanz per {date} · Aktiva {assets}`,bookCreated:`Buch "{name}" ({id}) angelegt`,accountSaved:`Konto {code} "{name}" gespeichert`,entryVoided:`Buchung storniert; Gegenbuchung am {date} erfasst`,openingSet:`Eröffnungssalden zum {date} festgelegt`,openingReplaced:`Eröffnungssalden zum {date} ersetzt`},previewSummary:`Buchhaltung · {bookId}`,previewError:`Buchhaltung: {error}`,previewGeneric:`Buchhaltungs-Ergebnis`}}},edt),tdt=Q7e.dispatch.path,ndt=Q7e.dispatch.method;function rdt(e){return function(t,n={}){let r=e(),i=r?{[$7e]:r}:{};return Qut(tdt,{method:ndt,body:{action:t,...n,...i}})}}function idt(e){function t(){return e(tP.getBooks)}function n(t){return e(tP.createBook,t)}function r(t){return e(tP.updateBook,t)}function i(t){return e(tP.deleteBook,{bookId:t,confirm:!0})}return{getBooks:t,createBook:n,updateBook:r,deleteBook:i}}function adt(e){function t(t){return e(tP.getAccounts,{bookId:t})}function n(t,n){return e(tP.upsertAccount,{account:t,bookId:n})}return{getAccounts:t,upsertAccount:n}}function odt(e){function t(t){return e(tP.addEntries,t)}function n(t){return e(tP.voidEntry,t)}function r(t){return e(tP.getJournalEntries,t)}function i(t){return e(tP.getOpeningBalances,{bookId:t})}function a(t){return e(tP.setOpeningBalances,t)}return{addEntries:t,voidEntry:n,getJournalEntries:r,getOpeningBalances:i,setOpeningBalances:a}}function sdt(e){function t(t,n){return e(tP.getReport,{kind:`balance`,period:t,bookId:n})}function n(t,n){return e(tP.getReport,{kind:`pl`,period:t,bookId:n})}function r(t,n,r){return e(tP.getReport,{kind:`ledger`,accountCode:t,period:n,bookId:r})}function i(t){return e(tP.getTimeSeries,{...t})}function a(t){return e(tP.rebuildSnapshots,{bookId:t})}return{getBalanceSheet:t,getProfitLoss:n,getLedger:r,getTimeSeries:i,rebuildSnapshots:a}}function cdt(e){let t=rdt(e);return{...idt(t),...adt(t),...odt(t),...sdt(t)}}var ldt=cdt(bL),udt=Symbol(`accounting-api`);function ddt(e){let t=cdt(e);return C(udt,t),t}function SL(){return Re(udt,ldt)}var fdt={class:`text-base font-semibold`},pdt={key:0,class:`text-xs text-gray-500`,"data-testid":`accounting-new-book-firstrun`},mdt={class:`text-sm flex flex-col gap-1`},hdt={class:`text-sm flex flex-col gap-1`},gdt=[`value`],_dt={class:`text-sm flex flex-col gap-1`},vdt={value:``},ydt=[`value`],bdt={class:`text-xs text-gray-500`},xdt={class:`text-sm flex flex-col gap-1`},Sdt=[`value`],Cdt={class:`text-xs text-gray-500`},wdt={key:1,class:`text-xs text-red-500`,"data-testid":`accounting-new-book-error`},Tdt={class:`flex justify-end gap-2 mt-1`},Edt=[`disabled`],Ddt=K({__name:`NewBookForm`,props:{firstRun:{type:Boolean,default:!1},cancelable:{type:Boolean,default:!0},fullPage:{type:Boolean,default:!1}},emits:[`cancel`,`created`],setup(e,{emit:t}){let n=SL(),{t:r,locale:a}=xL();function o(e){try{let{region:t}=new Intl.Locale(e).maximize();if(x9e(t))return t}catch{}return``}function l(e){let t=o(e);return t===``?o(typeof navigator<`u`&&typeof navigator.language==`string`?navigator.language:``):t}let d=e,f=t,p=V(``),h=V(`USD`),g=V(l(a.value)),_=V(12),v=V(!1),y=V(null),x=V(null);P(()=>{be(()=>x.value?.focus())});let C=m(()=>w9e.map(e=>({code:e,label:`${e} — ${E9e(e,a.value)}`}))),w=m(()=>cP.map(e=>({code:e,label:`${e} — ${b9e(e,a.value)}`}))),E=m(()=>iP.map(e=>({value:e,label:d9e(e,a.value)}))),O=m(()=>d.fullPage?`flex-1 bg-white flex items-center justify-center p-6 overflow-auto`:`fixed inset-0 z-50 bg-black/20 flex items-center justify-center`),k=m(()=>d.cancelable&&!d.fullPage);function A(){d.fullPage||j()}function j(){d.cancelable&&f(`cancel`)}async function M(){if(!v.value){v.value=!0,y.value=null;try{let e=g.value===``?void 0:g.value,t=await n.createBook({name:p.value.trim(),currency:h.value,country:e,fiscalYearEnd:_.value});if(!t.ok){y.value=t.error;return}f(`created`,t.data.book)}finally{v.value=!1}}}return(t,n)=>(B(),U(`div`,{class:c(O.value),"data-testid":`accounting-new-book-modal`,onClick:s(A,[`self`])},[S(`form`,{class:`bg-white p-4 rounded shadow-lg w-96 flex flex-col gap-3`,"data-testid":`accounting-new-book-form`,onSubmit:s(M,[`prevent`])},[S(`h3`,fdt,T(q(r)(`pluginAccounting.bookSwitcher.newBook`)),1),e.firstRun?(B(),U(`p`,pdt,T(q(r)(`pluginAccounting.bookSwitcher.firstRunHint`)),1)):b(``,!0),S(`label`,mdt,[J(T(q(r)(`pluginAccounting.bookSwitcher.nameLabel`))+` `,1),u(S(`input`,{ref_key:`nameInput`,ref:x,"onUpdate:modelValue":n[0]||=e=>p.value=e,required:``,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-new-book-name`},null,512),[[Fe,p.value]])]),S(`label`,hdt,[J(T(q(r)(`pluginAccounting.bookSwitcher.currencyLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[1]||=e=>h.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-new-book-currency`},[(B(!0),U(D,null,H(C.value,e=>(B(),U(`option`,{key:e.code,value:e.code},T(e.label),9,gdt))),128))],512),[[i,h.value]])]),S(`label`,_dt,[J(T(q(r)(`pluginAccounting.bookSwitcher.countryLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[2]||=e=>g.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-new-book-country`},[S(`option`,vdt,T(q(r)(`pluginAccounting.bookSwitcher.countryPlaceholder`)),1),(B(!0),U(D,null,H(w.value,e=>(B(),U(`option`,{key:e.code,value:e.code},T(e.label),9,ydt))),128))],512),[[i,g.value]])]),S(`p`,bdt,T(q(r)(`pluginAccounting.bookSwitcher.countryHint`)),1),S(`label`,xdt,[J(T(q(r)(`pluginAccounting.bookSwitcher.fiscalYearEndLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[3]||=e=>_.value=e,required:``,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-new-book-fiscal-year-end`},[(B(!0),U(D,null,H(E.value,e=>(B(),U(`option`,{key:e.value,value:e.value},T(e.label),9,Sdt))),128))],512),[[i,_.value]])]),S(`p`,Cdt,T(q(r)(`pluginAccounting.bookSwitcher.fiscalYearEndHint`)),1),y.value?(B(),U(`p`,wdt,T(y.value),1)):b(``,!0),S(`div`,Tdt,[k.value?(B(),U(`button`,{key:0,type:`button`,class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-700 hover:bg-gray-50`,onClick:j},T(q(r)(`pluginAccounting.common.cancel`)),1)):b(``,!0),S(`button`,{type:`submit`,class:`h-8 px-2.5 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm`,disabled:v.value,"data-testid":`accounting-new-book-submit`},T(v.value?q(r)(`pluginAccounting.common.loading`):q(r)(`pluginAccounting.bookSwitcher.create`)),9,Edt)])],32)],2))}}),Odt={class:`flex items-center gap-2`},kdt={class:`text-xs text-gray-500`,for:`accounting-book-select`},Adt=[`value`],jdt={key:0,value:``,disabled:``},Mdt=[`value`],Ndt=`__new__`,Pdt=K({__name:`BookSwitcher`,props:{modelValue:{},books:{}},emits:[`update:modelValue`,`books-changed`,`book-created`],setup(e,{emit:t}){let{t:n}=xL(),r=e,i=t,a=V(!1);function o(e){let t=e.country?`${e.currency} · ${e.country}`:e.currency;return`${e.name} (${t})`}function s(e){let{target:t}=e;if(!(t instanceof HTMLSelectElement))return;let n=t.value;if(n===Ndt){t.value=r.modelValue,a.value=!0;return}n!==r.modelValue&&i(`update:modelValue`,n)}function c(e){a.value=!1,i(`book-created`,e)}return(t,r)=>(B(),U(`div`,Odt,[S(`label`,kdt,T(q(n)(`pluginAccounting.bookSwitcher.label`)),1),S(`select`,{id:`accounting-book-select`,value:e.modelValue,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-book-select`,onChange:s},[e.modelValue===``?(B(),U(`option`,jdt,T(q(n)(`pluginAccounting.bookSwitcher.placeholder`)),1)):b(``,!0),(B(!0),U(D,null,H(e.books,e=>(B(),U(`option`,{key:e.id,value:e.id},T(o(e)),9,Mdt))),128)),r[1]||=S(`option`,{disabled:``},`──────────`,-1),S(`option`,{value:Ndt,"data-testid":`accounting-new-book-option`},`+ `+T(q(n)(`pluginAccounting.bookSwitcher.newBook`)),1)],40,Adt),a.value?(B(),ke(Ddt,{key:0,onCancel:r[0]||=e=>a.value=!1,onCreated:c})):b(``,!0)]))}});function CL(){let e=0;return{begin(){return e+=1,e},isCurrent(t){return t===e}}}var Fdt={class:`flex flex-wrap items-end gap-2`,"data-testid":`accounting-daterange`},Idt={class:`text-xs text-gray-500 flex flex-col gap-1`},Ldt=[`value`],Rdt={value:`currentQuarter`},zdt={value:`previousQuarter`},Bdt={value:`currentYear`},Vdt={value:`previousYear`},Hdt={key:0,value:`lifetime`},Udt={value:`all`},Wdt={class:`text-xs text-gray-500 flex flex-col gap-1`},Gdt=[`value`],Kdt={class:`text-xs text-gray-500 flex flex-col gap-1`},qdt=[`value`],wL=K({__name:`DateRangePicker`,props:{modelValue:{},fiscalYearEnd:{},openingDate:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let{t:n}=xL(),r=e,i=t,a=m(()=>!!r.openingDate),o={from:``,to:``};function s(){return r.openingDate?{from:r.openingDate,to:dP()}:null}function c(e,t){return e.from===t.from&&e.to===t.to}let l=m(()=>{let e=r.modelValue,t=new Date;if(c(e,_9e(r.fiscalYearEnd,t)))return`currentQuarter`;if(c(e,v9e(r.fiscalYearEnd,t)))return`previousQuarter`;if(c(e,sP(r.fiscalYearEnd,t)))return`currentYear`;if(c(e,y9e(r.fiscalYearEnd,t)))return`previousYear`;let n=s();return n&&c(e,n)?`lifetime`:c(e,o)?`all`:``});function u(e){let{target:t}=e;if(!(t instanceof HTMLSelectElement))return;let n=t.value,a=new Date;if(n===`currentQuarter`)i(`update:modelValue`,_9e(r.fiscalYearEnd,a));else if(n===`previousQuarter`)i(`update:modelValue`,v9e(r.fiscalYearEnd,a));else if(n===`currentYear`)i(`update:modelValue`,sP(r.fiscalYearEnd,a));else if(n===`previousYear`)i(`update:modelValue`,y9e(r.fiscalYearEnd,a));else if(n===`lifetime`){let e=s();e&&i(`update:modelValue`,e)}else n===`all`&&i(`update:modelValue`,o)}function d(e){let{target:t}=e;t instanceof HTMLInputElement&&i(`update:modelValue`,{from:t.value,to:r.modelValue.to})}function f(e){let{target:t}=e;t instanceof HTMLInputElement&&i(`update:modelValue`,{from:r.modelValue.from,to:t.value})}return(t,r)=>(B(),U(`div`,Fdt,[S(`label`,Idt,[J(T(q(n)(`pluginAccounting.dateRange.shortcutLabel`))+` `,1),S(`select`,{value:l.value,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-daterange-shortcut`,onChange:u},[r[0]||=S(`option`,{value:``,hidden:``},null,-1),S(`option`,Rdt,T(q(n)(`pluginAccounting.dateRange.currentQuarter`)),1),S(`option`,zdt,T(q(n)(`pluginAccounting.dateRange.previousQuarter`)),1),S(`option`,Bdt,T(q(n)(`pluginAccounting.dateRange.currentYear`)),1),S(`option`,Vdt,T(q(n)(`pluginAccounting.dateRange.previousYear`)),1),a.value?(B(),U(`option`,Hdt,T(q(n)(`pluginAccounting.dateRange.lifetime`)),1)):b(``,!0),S(`option`,Udt,T(q(n)(`pluginAccounting.dateRange.all`)),1)],40,Ldt)]),S(`label`,Wdt,[J(T(q(n)(`pluginAccounting.dateRange.fromLabel`))+` `,1),S(`input`,{value:e.modelValue.from,type:`date`,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-daterange-from`,onInput:d},null,40,Gdt)]),S(`label`,Kdt,[J(T(q(n)(`pluginAccounting.dateRange.toLabel`))+` `,1),S(`input`,{value:e.modelValue.to,type:`date`,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-daterange-to`,onInput:f},null,40,qdt)])]))}}),TL={asset:1,liability:2,equity:3,income:4,expense:5},Jdt=[`14`];function Ydt(e){return Jdt.some(t=>e.startsWith(t))}var Xdt=/^\d{4}$/,Zdt=10;function EL(e){return Xdt.test(e)}function Qdt(e){if(!EL(e))return null;let t=Number.parseInt(e.charAt(0),10);return e9e.find(e=>TL[e]===t)??null}function $dt(e,t){return Qdt(e)===t}function eft(e,t){let n=TL[e],r=[];for(let e of t){if(!EL(e.code))continue;let t=Number.parseInt(e.code,10);Math.floor(t/1e3)===n&&r.push(t)}if(r.length===0)return`${n}000`;let i=Math.max(...r),a=i+Zdt;if(Math.floor(a/1e3)===n&&a<=9999)return String(a);let o=i+1;return Math.floor(o/1e3)===n&&o<=9999?String(o):`${n}999`}var tft=[`data-testid`],nft=[`checked`,`title`,`aria-label`,`data-testid`],rft={class:`font-mono text-xs text-gray-500 w-16 shrink-0`},ift=[`data-testid`],aft=[`title`],oft=[`data-testid`,`disabled`,`aria-hidden`,`tabindex`],sft=K({__name:`AccountRow`,props:{account:{}},emits:[`edit`,`toggleActive`],setup(e,{emit:t}){let{t:n}=xL(),r=e,i=t,a=m(()=>r.account.active===!1);return(t,r)=>(B(),U(`div`,{class:c([`flex items-center gap-2 px-2 py-0.5 text-sm`,a.value?`opacity-60`:``]),"data-testid":`accounting-accounts-row-${e.account.code}`},[S(`input`,{type:`checkbox`,checked:!a.value,title:a.value?q(n)(`pluginAccounting.accounts.reactivate`):q(n)(`pluginAccounting.accounts.deactivate`),"aria-label":a.value?q(n)(`pluginAccounting.accounts.reactivate`):q(n)(`pluginAccounting.accounts.deactivate`),class:`h-4 w-4 shrink-0 cursor-pointer`,"data-testid":`accounting-accounts-toggle-${e.account.code}`,onChange:r[0]||=e=>i(`toggleActive`)},null,40,nft),S(`span`,rft,T(e.account.code),1),S(`span`,{class:c([`grow min-w-0 truncate`,a.value?`line-through`:``]),"data-testid":a.value?`accounting-accounts-inactive-${e.account.code}`:void 0},T(e.account.name),11,ift),e.account.note?(B(),U(`span`,{key:0,class:`text-xs text-gray-400 truncate max-w-[8rem]`,title:e.account.note},T(e.account.note),9,aft)):b(``,!0),S(`button`,{type:`button`,class:c([`h-8 px-2.5 rounded text-sm text-blue-600 hover:bg-blue-50`,a.value?`invisible`:``]),"data-testid":`accounting-accounts-edit-${e.account.code}`,disabled:a.value,"aria-hidden":a.value?`true`:void 0,tabindex:a.value?-1:void 0,onClick:r[1]||=e=>i(`edit`)},T(q(n)(`pluginAccounting.accounts.edit`)),11,oft)],10,tft))}});function cft(e,t,n){let r=e.code.trim();return r.length===0?`emptyCode`:r.startsWith(`_`)?`reservedCode`:n&&!EL(r)?`invalidCodeFormat`:n&&!$dt(r,e.type)?`codeTypeMismatch`:n&&t.some(e=>e.code===r)?`duplicateCode`:null}function lft(e,t,n){let r=e.name.trim();if(r.length===0)return`emptyName`;let i=r.toLowerCase();return t.some(t=>!n&&t.code===e.code.trim()?!1:t.name.trim().toLowerCase()===i)?`duplicateName`:null}function uft(e,t,n){return cft(e,t,n)??lft(e,t,n)}var dft=[`data-testid`],fft={class:`flex flex-wrap gap-2`},pft={class:`text-xs text-gray-500 flex flex-col gap-1 w-28`},mft={class:`px-2 flex items-center bg-gray-100 text-gray-500 border-r border-gray-200 select-none`,"data-testid":`accounting-accounts-form-code-prefix`},hft={class:`text-xs text-gray-500 flex flex-col gap-1 grow min-w-[10rem]`},gft={class:`text-xs text-gray-500 flex flex-col gap-1 w-32`},_ft=[`value`],vft={class:`text-xs text-gray-500 flex flex-col gap-1`},yft={class:`text-gray-400`},bft={key:0,class:`text-xs text-gray-400`},xft={class:`text-xs text-red-500 min-h-[1rem]`,"data-testid":`accounting-accounts-form-error`},Sft={class:`flex justify-end gap-2`},Cft=[`disabled`],wft=K({__name:`AccountEditor`,props:{draft:{},isNew:{type:Boolean},busy:{type:Boolean},error:{},existingAccounts:{}},emits:[`save`,`cancel`],setup(e,{emit:t}){let{t:n}=xL(),r=e,a=t,o=[`asset`,`liability`,`equity`,`income`,`expense`],l={emptyCode:`pluginAccounting.accounts.errorEmptyCode`,reservedCode:`pluginAccounting.accounts.errorReservedCode`,invalidCodeFormat:`pluginAccounting.accounts.errorInvalidCodeFormat`,codeTypeMismatch:`pluginAccounting.accounts.errorCodeTypeMismatch`,emptyName:`pluginAccounting.accounts.errorEmptyName`,duplicateCode:`pluginAccounting.accounts.errorDuplicateCode`,duplicateName:`pluginAccounting.accounts.errorDuplicateName`},d=x({...r.draft}),f=V(null),p=V(!1),h=V(!1),g=m(()=>String(TL[d.type])),_=m({get:()=>{let{code:e}=d;return e.startsWith(g.value)?e.slice(g.value.length):e},set:e=>{let t=e.replace(/\D/g,``).slice(0,3);d.code=g.value+t}}),v=m(()=>{let e=cft(d,r.existingAccounts,r.isNew);return e===`emptyCode`&&!p.value?null:e}),y=m(()=>{let e=lft(d,r.existingAccounts,r.isNew);return e===`emptyName`&&!h.value&&!r.isNew?null:e}),C=m(()=>{let e=v.value;if(e!==null)return n(l[e]);let t=y.value;return t===null?null:n(l[t])});Ve(()=>r.draft,e=>{d.code=e.code,d.name=e.name,d.type=e.type,d.note=e.note,p.value=!1,h.value=!1}),P(()=>{be(()=>f.value?.focus())});function w(){p.value=!0,h.value=!0,a(`save`,{code:d.code,name:d.name,type:d.type,note:d.note})}return(t,r)=>(B(),U(`form`,{class:`flex flex-col gap-2 p-2 border border-blue-200 bg-blue-50/40 rounded text-sm`,"data-testid":e.isNew?`accounting-accounts-form-new`:`accounting-accounts-form-edit-${e.draft.code}`,onSubmit:s(w,[`prevent`])},[S(`div`,fft,[S(`label`,pft,[J(T(q(n)(`pluginAccounting.accounts.columnCode`))+` `,1),e.isNew?(B(),U(`div`,{key:0,class:c([`flex items-stretch h-8 rounded border bg-white text-sm font-mono overflow-hidden`,v.value?`border-red-500 ring-1 ring-red-500`:`border-gray-300 focus-within:ring-1 focus-within:ring-blue-500`])},[S(`span`,mft,T(g.value),1),u(S(`input`,{"onUpdate:modelValue":r[0]||=e=>_.value=e,type:`text`,inputmode:`numeric`,maxlength:`3`,pattern:`\\d{3}`,class:`px-2 grow w-0 outline-none bg-transparent`,"data-testid":`accounting-accounts-form-code`,onInput:r[1]||=e=>p.value=!0},null,544),[[Fe,_.value]])],2)):u((B(),U(`input`,{key:1,"onUpdate:modelValue":r[2]||=e=>d.code=e,type:`text`,disabled:``,class:`h-8 px-2 rounded border border-gray-300 text-sm font-mono bg-gray-100 text-gray-500`,"data-testid":`accounting-accounts-form-code`},null,512)),[[Fe,d.code]])]),S(`label`,hft,[J(T(q(n)(`pluginAccounting.accounts.columnName`))+` `,1),u(S(`input`,{ref_key:`nameInput`,ref:f,"onUpdate:modelValue":r[3]||=e=>d.name=e,type:`text`,class:c([`h-8 px-2 rounded border text-sm focus:outline-none`,y.value?`border-red-500 ring-1 ring-red-500`:`border-gray-300 focus:ring-1 focus:ring-blue-500`]),"data-testid":`accounting-accounts-form-name`,onInput:r[4]||=e=>h.value=!0},null,34),[[Fe,d.name]])]),S(`label`,gft,[J(T(q(n)(`pluginAccounting.accounts.columnType`))+` `,1),u(S(`select`,{"onUpdate:modelValue":r[5]||=e=>d.type=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white disabled:bg-gray-100 disabled:text-gray-500`,disabled:``,"data-testid":`accounting-accounts-form-type`},[(B(),U(D,null,H(o,e=>S(`option`,{key:e,value:e},T(q(n)(`pluginAccounting.accounts.typeOption.${e}`)),9,_ft)),64))],512),[[i,d.type]])])]),S(`label`,vft,[S(`span`,null,[J(T(q(n)(`pluginAccounting.accounts.columnNote`))+` `,1),S(`span`,yft,T(q(n)(`pluginAccounting.accounts.noteOptional`)),1)]),u(S(`input`,{"onUpdate:modelValue":r[6]||=e=>d.note=e,type:`text`,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-accounts-form-note`},null,512),[[Fe,d.note]])]),e.isNew?b(``,!0):(B(),U(`p`,bft,T(q(n)(`pluginAccounting.accounts.codeReadOnlyHint`)),1)),S(`p`,xft,T(C.value??e.error??``),1),S(`div`,Sft,[S(`button`,{type:`button`,class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-accounts-form-cancel`,onClick:r[7]||=e=>a(`cancel`)},T(q(n)(`pluginAccounting.accounts.cancel`)),1),S(`button`,{type:`submit`,class:`h-8 px-2.5 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm disabled:opacity-50`,disabled:e.busy,"data-testid":`accounting-accounts-form-save`},T(e.busy?q(n)(`pluginAccounting.accounts.saving`):q(n)(`pluginAccounting.accounts.save`)),9,Cft)])],40,dft))}}),Tft={class:`bg-white rounded shadow-lg w-[32rem] max-h-[80vh] flex flex-col`},Eft={class:`flex items-center justify-between px-4 py-2 border-b border-gray-200 shrink-0`},Dft={id:`accounting-accounts-modal-title`,class:`text-base font-semibold`},Oft=[`aria-label`],kft={class:`flex-1 overflow-auto px-4 py-3 flex flex-col gap-3`},Aft={key:0,class:`text-xs text-green-600`,"data-testid":`accounting-accounts-success`},jft={key:1,class:`text-xs text-red-500`,"data-testid":`accounting-accounts-toggle-error`},Mft={class:`text-xs font-semibold text-gray-500 uppercase tracking-wide`},Nft={key:0,class:`text-xs text-gray-400 italic px-1`},Pft=[`data-testid`,`onClick`],Fft=2500,DL=K({__name:`AccountsModal`,props:{bookId:{},accounts:{}},emits:[`close`,`changed`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),i=e,a=t,o=[`asset`,`liability`,`equity`,`income`,`expense`],c={emptyCode:`pluginAccounting.accounts.errorEmptyCode`,reservedCode:`pluginAccounting.accounts.errorReservedCode`,invalidCodeFormat:`pluginAccounting.accounts.errorInvalidCodeFormat`,codeTypeMismatch:`pluginAccounting.accounts.errorCodeTypeMismatch`,emptyName:`pluginAccounting.accounts.errorEmptyName`,duplicateCode:`pluginAccounting.accounts.errorDuplicateCode`,duplicateName:`pluginAccounting.accounts.errorDuplicateName`},u=m(()=>o.map(e=>({type:e,accounts:i.accounts.filter(t=>t.type===e).slice().sort(d)})));function d(e,t){return e.code.localeCompare(t.code)}let f=V(null),p=V(!1),h=V(k(`asset`)),g=V(!1),v=V(null),y=V(!1),x=V(null),C=V(null),w=V(null),E=V(null),O=null;function k(e){return{code:``,name:``,type:e,note:``}}function A(e){return{code:eft(e,i.accounts),name:``,type:e,note:``}}function j(e,t){t===h.value.type&&(E.value=e instanceof HTMLDivElement?e:null)}function M(e){p.value=!1,v.value=null,h.value={code:e.code,name:e.name,type:e.type,note:e.note??``},f.value=e.code}function N(e){f.value=null,v.value=null,h.value=A(e),p.value=!0,be(()=>{E.value?.scrollIntoView({behavior:`smooth`,block:`nearest`})})}function F(){f.value=null,p.value=!1,v.value=null,h.value=k(`asset`)}function I(e,t){let n=uft(e,i.accounts,t);return n===null?null:r(c[n])}async function L(e){if(g.value)return;let t=p.value,o=I(e,t);if(o!==null){v.value=o;return}g.value=!0,v.value=null;try{let o={code:e.code.trim(),name:e.name.trim(),type:e.type},s=e.note.trim();s.length>0&&(o.note=s),t||i.accounts.find(e=>e.code===o.code)?.active===!1&&(o.active=!1);let c=await n.upsertAccount(o,i.bookId);if(!c.ok){v.value=c.error;return}F(),z(r(`pluginAccounting.accounts.success`)),a(`changed`)}catch(e){v.value=rP(e)}finally{g.value=!1}}async function R(e){if(y.value)return;F();let t=e.active!==!1;y.value=!0,x.value=null;try{let r={code:e.code,name:e.name,type:e.type};e.note!==void 0&&e.note.length>0&&(r.note=e.note),r.active=!t;let o=await n.upsertAccount(r,i.bookId);if(!o.ok){x.value=o.error;return}a(`changed`)}catch(e){x.value=rP(e)}finally{y.value=!1}}function z(e){C.value=e,O!==null&&clearTimeout(O),O=setTimeout(()=>{C.value=null,O=null},Fft)}function ee(){a(`close`)}return P(()=>{be(()=>w.value?.focus())}),_(()=>{O!==null&&clearTimeout(O)}),(t,n)=>(B(),U(`div`,{class:`fixed inset-0 z-50 bg-black/20 flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`accounting-accounts-modal-title`,"data-testid":`accounting-accounts-modal`,onClick:s(ee,[`self`]),onKeydown:n[1]||=l(e=>a(`close`),[`esc`])},[S(`div`,Tft,[S(`header`,Eft,[S(`h3`,Dft,T(q(r)(`pluginAccounting.accounts.modalTitle`)),1),S(`button`,{ref_key:`closeButton`,ref:w,type:`button`,class:`h-8 w-8 flex items-center justify-center rounded text-gray-500 hover:bg-gray-100`,"data-testid":`accounting-accounts-close`,"aria-label":q(r)(`pluginAccounting.common.cancel`),onClick:n[0]||=e=>a(`close`)},[...n[2]||=[S(`span`,{class:`material-icons text-base`},`close`,-1)]],8,Oft)]),S(`div`,kft,[C.value?(B(),U(`p`,Aft,T(C.value),1)):b(``,!0),x.value?(B(),U(`p`,jft,T(x.value),1)):b(``,!0),(B(!0),U(D,null,H(u.value,t=>(B(),U(`section`,{key:t.type,class:`flex flex-col gap-1`},[S(`h4`,Mft,T(q(r)(`pluginAccounting.accounts.sectionTitle.${t.type}`)),1),t.accounts.length===0?(B(),U(`div`,Nft,T(q(r)(`pluginAccounting.common.empty`)),1)):b(``,!0),(B(!0),U(D,null,H(t.accounts,t=>(B(),U(D,{key:t.code},[f.value===t.code?(B(),ke(wft,{key:1,draft:h.value,"is-new":!1,busy:g.value,error:v.value,"existing-accounts":e.accounts,onSave:L,onCancel:F},null,8,[`draft`,`busy`,`error`,`existing-accounts`])):(B(),ke(sft,{key:0,account:t,onEdit:e=>M(t),onToggleActive:e=>R(t)},null,8,[`account`,`onEdit`,`onToggleActive`]))],64))),128)),p.value&&h.value.type===t.type?(B(),U(`div`,{key:1,ref_for:!0,ref:e=>j(e,t.type)},[De(wft,{draft:h.value,"is-new":``,busy:g.value,error:v.value,"existing-accounts":e.accounts,onSave:L,onCancel:F},null,8,[`draft`,`busy`,`error`,`existing-accounts`])],512)):(B(),U(`button`,{key:2,type:`button`,class:`self-start h-8 px-2.5 flex items-center gap-1 rounded text-xs text-gray-600 hover:bg-gray-100`,"data-testid":`accounting-accounts-add-${t.type}`,onClick:e=>N(t.type)},[n[3]||=S(`span`,{class:`material-icons text-sm`},`add`,-1),S(`span`,null,T(q(r)(`pluginAccounting.accounts.addToCategory`,{type:q(r)(`pluginAccounting.accounts.typeOption.${t.type}`)})),1)],8,Pft))]))),128))])])],32))}}),Ift={key:0,class:`text-base font-semibold`},Lft={class:`flex flex-wrap gap-3`},Rft={class:`text-xs text-gray-500 flex flex-col gap-1`},zft={class:`text-xs text-gray-500 flex flex-col gap-1 grow min-w-0`},Bft={class:`w-full text-sm`},Vft={class:`text-xs text-gray-500 border-b border-gray-200`},Hft={class:`text-left py-1 px-2`},Uft={class:`text-right py-1 px-2 w-32`},Wft={class:`text-right py-1 px-2 w-32`},Gft={key:0,class:`text-left py-1 px-2 w-40`},Kft={class:`py-1 px-2`},qft=[`onUpdate:modelValue`,`data-testid`],Jft=[`value`],Yft={class:`py-1 px-2`},Xft=[`onUpdate:modelValue`,`step`,`data-testid`,`onInput`],Zft={class:`py-1 px-2`},Qft=[`onUpdate:modelValue`,`step`,`data-testid`,`onInput`],$ft={key:0,class:`py-1 px-2`},ept=[`onUpdate:modelValue`,`placeholder`,`data-testid`,`aria-describedby`],tpt=[`id`,`data-testid`],npt={class:`py-1 px-2 text-right`},rpt=[`onClick`],ipt={class:`flex items-center justify-between`},apt={class:`flex items-center gap-2`},opt={key:1,class:`text-xs text-red-500`,"data-testid":`accounting-entry-error`},spt={key:2,class:`text-xs text-green-600`,"data-testid":`accounting-entry-success`},cpt={class:`flex items-center justify-between gap-2`},lpt={key:0,class:`text-xs text-gray-500 flex-1 min-w-0`,"data-testid":`accounting-entry-edit-banner`},upt={key:1},dpt={class:`flex items-center gap-2`},fpt=[`disabled`],ppt=[`disabled`],mpt=`—`,hpt=32,gpt=K({__name:`JournalEntryForm`,props:{bookId:{},accounts:{},currency:{},country:{},entryToEdit:{}},emits:[`submitted`,`cancel`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),a=e,o=t,l=V(!1);function d(e){return`${e.name} (${e.code})`}let f=m(()=>a.accounts.filter(e=>e.active!==!1)),p=m(()=>new Set(f.value.map(e=>e.code)));function h(){return{accountCode:``,debit:null,credit:null,taxRegistrationId:``}}function g(e){return e.taxRegistrationId.trim().length>hpt}function _(e){return e.accountCode!==``&&Ydt(e.accountCode)}function v(e){return!_(e)||!ie(e)||!C9e(`warnMissingTaxRegistrationId`,a.country)?!1:e.taxRegistrationId.trim()===``}let y=V(dP()),x=V(``),C=V([h(),h()]),w=V(!1),E=V(null),O=V(null),k=m(()=>!!a.entryToEdit),A=m(()=>w.value?k.value?r(`pluginAccounting.entryForm.updating`):r(`pluginAccounting.entryForm.submitting`):k.value?r(`pluginAccounting.entryForm.update`):r(`pluginAccounting.entryForm.submit`)),j=V(!1),M=m(()=>k.value&&j.value);function N(){C.value.push(h())}function P(e){e.debit!==null&&e.debit!==0&&(e.credit=null)}function F(e){e.credit!==null&&e.credit!==0&&(e.debit=null)}let I=m(()=>{let e=0;for(let t of C.value)ie(t)&&(re(t.debit)&&(e+=t.debit),re(t.credit)&&(e-=t.credit));return e}),L=m(()=>{let e=0;for(let t of C.value)if(ie(t)&&(e+=1,e>=2))return!0;return!1}),R=m(()=>C.value.some(_)),z=m(()=>C.value.some(g)),ee=m(()=>Math.abs(I.value)<=.005&&L.value&&!z.value),te=m(()=>lP(I.value,a.currency)),ne=m(()=>O9e(a.currency));function re(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function ie(e){return!e.accountCode||!p.value.has(e.accountCode)?!1:re(e.debit)||re(e.credit)}function ae(){let e=[];for(let t of C.value){if(!ie(t))continue;let n={accountCode:t.accountCode};if(re(t.debit)&&(n.debit=t.debit),re(t.credit)&&(n.credit=t.credit),_(t)){let e=t.taxRegistrationId.trim();e!==``&&(n.taxRegistrationId=e)}e.push(n)}return e}async function oe(){if(!(w.value||!ee.value||M.value)){w.value=!0,E.value=null,O.value=null;try{let e=a.entryToEdit?.id;if(e){j.value=!0;let t=await n.voidEntry({bookId:a.bookId,entryId:e,reason:r(`pluginAccounting.entryForm.editVoidReason`)});if(!t.ok){E.value=t.error;return}}let t=await n.addEntries({bookId:a.bookId,entries:[{date:y.value,memo:x.value.trim()||void 0,lines:ae(),...e?{replacesEntryId:e}:{}}]});if(!t.ok){E.value=t.error;return}O.value=r(e?`pluginAccounting.entryForm.editSuccess`:`pluginAccounting.entryForm.success`),C.value=[h(),h()],x.value=``,o(`submitted`)}catch(e){E.value=rP(e)}finally{w.value=!1}}}return Ve(()=>a.bookId,()=>{C.value=[h(),h()],x.value=``,y.value=dP(),E.value=null,O.value=null}),Ve(()=>a.entryToEdit,e=>{if(E.value=null,O.value=null,j.value=!1,!e){C.value=[h(),h()],x.value=``,y.value=dP();return}if(y.value=e.date,x.value=e.memo??``,C.value=e.lines.map(e=>({accountCode:e.accountCode,debit:typeof e.debit==`number`?e.debit:null,credit:typeof e.credit==`number`?e.credit:null,taxRegistrationId:e.taxRegistrationId??``})),C.value.length<2)for(;C.value.length<2;)C.value.push(h())},{immediate:!0}),Ve(p,e=>{for(let t of C.value)t.accountCode&&!e.has(t.accountCode)&&(t.accountCode=``)}),(t,n)=>(B(),U(D,null,[S(`form`,{class:`flex flex-col gap-3`,"data-testid":`accounting-entry-form`,onSubmit:s(oe,[`prevent`])},[k.value?b(``,!0):(B(),U(`h3`,Ift,T(q(r)(`pluginAccounting.entryForm.title`)),1)),S(`div`,Lft,[S(`label`,Rft,[J(T(q(r)(`pluginAccounting.entryForm.dateLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[0]||=e=>y.value=e,type:`date`,required:``,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-entry-date`},null,512),[[Fe,y.value]])]),S(`label`,zft,[J(T(q(r)(`pluginAccounting.entryForm.memoLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[1]||=e=>x.value=e,type:`text`,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-entry-memo`},null,512),[[Fe,x.value]])])]),S(`table`,Bft,[S(`thead`,null,[S(`tr`,Vft,[S(`th`,Hft,T(q(r)(`pluginAccounting.entryForm.accountLabel`)),1),S(`th`,Uft,T(q(r)(`pluginAccounting.entryForm.debitLabel`)),1),S(`th`,Wft,T(q(r)(`pluginAccounting.entryForm.creditLabel`)),1),R.value?(B(),U(`th`,Gft,T(q(r)(`pluginAccounting.entryForm.taxRegistrationIdLabel`)),1)):b(``,!0),n[5]||=S(`th`,{class:`py-1 px-2`},null,-1)])]),S(`tbody`,null,[(B(!0),U(D,null,H(C.value,(e,t)=>(B(),U(`tr`,{key:t,class:`border-b border-gray-100`},[S(`td`,Kft,[u(S(`select`,{"onUpdate:modelValue":t=>e.accountCode=t,class:`h-8 px-2 w-full rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-entry-line-account-${t}`},[S(`option`,{value:``},T(mpt)),(B(!0),U(D,null,H(f.value,e=>(B(),U(`option`,{key:e.code,value:e.code},T(d(e)),9,Jft))),128))],8,qft),[[i,e.accountCode]])]),S(`td`,Yft,[u(S(`input`,{"onUpdate:modelValue":t=>e.debit=t,type:`number`,step:ne.value,min:`0`,class:`h-8 px-2 w-full rounded border border-gray-300 text-sm text-right bg-white`,"data-testid":`accounting-entry-line-debit-${t}`,onInput:t=>P(e)},null,40,Xft),[[Fe,e.debit,void 0,{number:!0}]])]),S(`td`,Zft,[u(S(`input`,{"onUpdate:modelValue":t=>e.credit=t,type:`number`,step:ne.value,min:`0`,class:`h-8 px-2 w-full rounded border border-gray-300 text-sm text-right bg-white`,"data-testid":`accounting-entry-line-credit-${t}`,onInput:t=>F(e)},null,40,Qft),[[Fe,e.credit,void 0,{number:!0}]])]),R.value?(B(),U(`td`,$ft,[_(e)?(B(),U(D,{key:0},[u(S(`input`,{"onUpdate:modelValue":t=>e.taxRegistrationId=t,type:`text`,maxlength:hpt,placeholder:q(r)(`pluginAccounting.entryForm.taxRegistrationIdPlaceholder`),class:c([`h-8 px-2 w-full rounded border text-sm font-mono bg-white focus:outline-none`,g(e)?`border-red-500 ring-1 ring-red-500`:v(e)?`border-amber-500 ring-1 ring-amber-500`:`border-gray-300 focus:ring-1 focus:ring-blue-500`]),"data-testid":`accounting-entry-line-tax-registration-id-${t}`,"aria-describedby":v(e)?`accounting-entry-line-tax-registration-id-warning-${t}`:void 0},null,10,ept),[[Fe,e.taxRegistrationId]]),v(e)?(B(),U(`p`,{key:0,id:`accounting-entry-line-tax-registration-id-warning-${t}`,class:`text-xs text-amber-600 mt-1`,role:`status`,"aria-live":`polite`,"data-testid":`accounting-entry-line-tax-registration-id-warning-${t}`},T(q(r)(`pluginAccounting.entryForm.taxRegistrationIdMissingWarning`)),9,tpt)):b(``,!0)],64)):b(``,!0)])):b(``,!0),S(`td`,npt,[C.value.length>2?(B(),U(`button`,{key:0,type:`button`,class:`text-xs text-red-500 hover:underline`,onClick:e=>C.value.splice(t,1)},T(q(r)(`pluginAccounting.entryForm.removeLine`)),9,rpt)):b(``,!0)])]))),128))])]),S(`div`,ipt,[S(`div`,apt,[S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-entry-add-line`,onClick:N},[n[6]||=S(`span`,{class:`material-icons text-base`},`add`,-1),S(`span`,null,T(q(r)(`pluginAccounting.entryForm.addLine`)),1)]),S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-entry-manage-accounts`,onClick:n[2]||=e=>l.value=!0},[n[7]||=S(`span`,{class:`material-icons text-base`},`tune`,-1),S(`span`,null,T(q(r)(`pluginAccounting.accounts.manageButton`)),1)])]),S(`span`,{class:c([ee.value?`text-green-600`:`text-red-500`,`text-xs`]),"data-testid":`accounting-entry-balance`},T(ee.value?q(r)(`pluginAccounting.entryForm.balanced`):q(r)(`pluginAccounting.entryForm.imbalance`,{amount:te.value})),3)]),E.value?(B(),U(`p`,opt,T(E.value),1)):b(``,!0),O.value?(B(),U(`p`,spt,T(O.value),1)):b(``,!0),S(`div`,cpt,[k.value?(B(),U(`p`,lpt,T(q(r)(`pluginAccounting.entryForm.editBanner`)),1)):(B(),U(`span`,upt)),S(`div`,dpt,[S(`button`,{type:`button`,class:`h-8 px-3 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,disabled:w.value,"data-testid":`accounting-entry-cancel-edit`,onClick:n[3]||=e=>o(`cancel`)},T(q(r)(`pluginAccounting.common.cancel`)),9,fpt),S(`button`,{type:`submit`,class:`h-8 px-3 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm disabled:opacity-50`,disabled:!ee.value||w.value||M.value,"data-testid":`accounting-entry-submit`},T(A.value),9,ppt)])])],32),l.value?(B(),ke(DL,{key:0,"book-id":e.bookId,accounts:e.accounts,onClose:n[4]||=e=>l.value=!1},null,8,[`book-id`,`accounts`])):b(``,!0)],64))}}),OL=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},_pt=OL(gpt,[[`__scopeId`,`data-v-8624a7bf`]]),vpt={class:`flex flex-col h-full gap-3`},ypt={key:0,class:`border border-gray-200 rounded p-3`,"data-testid":`accounting-journal-inline-form`},bpt={key:1,class:`flex items-center justify-end`},xpt={class:`flex flex-wrap items-end gap-2`},Spt={class:`text-xs text-gray-500 flex flex-col gap-1`},Cpt={value:``},wpt=[`value`],Tpt={class:`flex-1 min-h-0 overflow-auto`},Ept={key:0,class:`text-xs text-gray-400`},Dpt={key:1,class:`text-xs text-red-500`},Opt={key:2,class:`text-xs text-gray-400`},kpt={key:3,class:`w-full text-sm`,"data-testid":`accounting-journal-table`},Apt={class:`text-xs text-gray-500 border-b border-gray-200`},jpt={class:`sticky top-0 bg-white text-left py-1 px-2`},Mpt={class:`sticky top-0 bg-white text-left py-1 px-2`},Npt={class:`sticky top-0 bg-white text-left py-1 px-2`},Ppt={class:`sticky top-0 bg-white text-left py-1 px-2`},Fpt=[`data-testid`,`aria-expanded`,`onClick`,`onKeydown`],Ipt={class:`py-1 px-2 whitespace-nowrap`},Lpt={class:`py-1 px-2 text-xs`},Rpt={class:`py-1 px-2`},zpt={key:0},Bpt={class:`py-1 px-2`},Vpt={class:`font-mono text-[10px] text-gray-400`},Hpt={key:0},Upt={key:1},Wpt={key:2},Gpt={key:1,class:`flex items-center justify-between gap-2`},Kpt={class:`text-xs text-gray-400 font-mono`},qpt=[`data-testid`,`aria-label`],Jpt=[`data-testid`],Ypt={colspan:4,class:`px-6 py-2`},Xpt=[`data-testid`],Zpt={class:`flex items-center gap-3 mb-2`},Qpt=[`data-testid`,`onClick`],$pt=[`data-testid`,`onClick`],emt=[`data-testid`],tmt={class:`w-full text-xs`},nmt={class:`text-gray-500 border-b border-gray-200`},rmt={class:`text-left py-1 px-2`},imt={class:`text-right py-1 px-2`},amt={class:`text-right py-1 px-2`},omt={class:`text-left py-1 px-2`},smt={key:0,class:`text-left py-1 px-2`},cmt={class:`py-1 px-2`},lmt={class:`font-mono text-[10px] text-gray-400 mr-2`},umt={key:0},dmt={class:`py-1 px-2 text-right font-mono`},fmt={class:`py-1 px-2 text-right font-mono`},pmt={class:`py-1 px-2`},mmt={key:0,class:`py-1 px-2 font-mono text-[10px]`},hmt={class:`font-semibold border-t border-gray-300 text-gray-700`},gmt={class:`py-1 px-2 text-gray-500`},_mt={class:`py-1 px-2 text-right font-mono`},vmt={class:`py-1 px-2 text-right font-mono`},ymt=[`colspan`],bmt=OL(K({__name:`JournalList`,props:{bookId:{},accounts:{},currency:{},country:{},version:{},fiscalYearEnd:{},openingDate:{},preselectEntryId:{}},emits:[`editOpening`,`preselectConsumed`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),a=e,o=t,d=V(!1),f=V(null),p=V(null);function h(){f.value=null,d.value=!0}function g(e){d.value=!1,f.value=e}function _(){d.value=!1,f.value=null}function v(){_(),p.value=null,W()}function y(){_()}Ve(()=>a.bookId,()=>{_(),p.value=null});let x=m(()=>aP(a.fiscalYearEnd)),C=V(sP(x.value)),w=V(``),E=V([]),O=V([]),k=V(!1),A=V(null),{begin:j,isCurrent:M}=CL();function N(e){return r(e===`opening`?`pluginAccounting.journalList.kind.opening`:e===`void`?`pluginAccounting.journalList.kind.void`:e===`void-marker`?`pluginAccounting.journalList.kind.voidMarker`:`pluginAccounting.journalList.kind.normal`)}function P(e){return`DR ${lP(e,a.currency)}`}function F(e){return`CR ${lP(e,a.currency)}`}function I(e){return`${e.name} (${e.code})`}function L(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return`(${e})`;let n=e=>String(e).padStart(2,`0`);return`(${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())})`}let R=m(()=>{let e=new Map;for(let t of a.accounts)e.set(t.code,t.name);return e});function z(e){return R.value.get(e)??null}function ee(){p.value=null,f.value=null}function te(e){f.value?.id!==e&&(p.value=p.value===e?null:e,f.value=null)}function ne(e,t){e.repeat||te(t)}function re(e){return e.lines.some(e=>!!e.taxRegistrationId)}function ie(e,t){return e.reduce((e,n)=>e+(t(n)??0),0)}function ae(e){return ie(e.lines,e=>e.debit)}function oe(e){return ie(e.lines,e=>e.credit)}async function W(){let e=j();k.value=!0,A.value=null;try{let t=await n.getJournalEntries({bookId:a.bookId,from:C.value.from||void 0,to:C.value.to||void 0,accountCode:w.value||void 0});if(!M(e))return;if(!t.ok){A.value=t.error,E.value=[],O.value=[];return}E.value=t.data.entries,O.value=t.data.voidedEntryIds}finally{M(e)&&(k.value=!1)}}let se=m(()=>E.value),ce=m(()=>{let e=se.value,t=f.value;return t&&!e.some(e=>e.id===t.id)?[t,...e]:e}),le=m(()=>new Set(O.value));async function ue(e){let t=window.prompt(r(`pluginAccounting.journalList.voidReason`));if(t!==null)try{let r=await n.voidEntry({entryId:e.id,reason:t||void 0,bookId:a.bookId});r.ok||(A.value=r.error)}catch(e){A.value=rP(e)}}Ve(()=>[a.bookId,x.value],()=>{C.value=sP(x.value)}),Ve(()=>[a.bookId,a.version,C.value.from,C.value.to,w.value],W,{immediate:!0});let de=V(null);return Ve(()=>a.preselectEntryId,e=>{e&&(de.value=e)},{immediate:!0}),Ve([de,E],async([e,t])=>{if(e&&t.some(t=>t.id===e)){if(f.value){de.value=null,o(`preselectConsumed`);return}p.value=e,await be(),(document.querySelector(`[data-testid="accounting-journal-row-${e}"]`)??document.querySelector(`[data-testid="accounting-journal-row-voided-${e}"]`))?.scrollIntoView({behavior:`smooth`,block:`center`}),de.value=null,o(`preselectConsumed`)}}),(t,n)=>(B(),U(`div`,vpt,[d.value?(B(),U(`div`,ypt,[De(_pt,{"book-id":e.bookId,accounts:e.accounts,currency:e.currency,country:e.country,"entry-to-edit":null,onSubmitted:v,onCancel:y},null,8,[`book-id`,`accounts`,`currency`,`country`])])):(B(),U(`div`,bpt,[S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-journal-new-entry`,onClick:h},[n[3]||=S(`span`,{class:`material-icons text-base`},`add`,-1),S(`span`,null,T(q(r)(`pluginAccounting.tabs.newEntry`)),1)])])),S(`div`,xpt,[De(wL,{modelValue:C.value,"onUpdate:modelValue":n[0]||=e=>C.value=e,"fiscal-year-end":x.value,"opening-date":e.openingDate},null,8,[`modelValue`,`fiscal-year-end`,`opening-date`]),S(`label`,Spt,[J(T(q(r)(`pluginAccounting.journalList.accountLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[1]||=e=>w.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-journal-account`},[S(`option`,Cpt,T(q(r)(`pluginAccounting.journalList.allAccounts`)),1),(B(!0),U(D,null,H(e.accounts,e=>(B(),U(`option`,{key:e.code,value:e.code},T(I(e)),9,wpt))),128))],512),[[i,w.value]])]),S(`button`,{class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,onClick:W},[...n[4]||=[S(`span`,{class:`material-icons text-base align-middle`},`refresh`,-1)]])]),S(`div`,Tpt,[k.value?(B(),U(`p`,Ept,T(q(r)(`pluginAccounting.common.loading`)),1)):A.value?(B(),U(`p`,Dpt,T(q(r)(`pluginAccounting.common.error`,{error:A.value})),1)):ce.value.length===0?(B(),U(`p`,Opt,T(q(r)(`pluginAccounting.common.empty`)),1)):(B(),U(`table`,kpt,[S(`thead`,null,[S(`tr`,Apt,[S(`th`,jpt,T(q(r)(`pluginAccounting.journalList.columns.date`)),1),S(`th`,Mpt,T(q(r)(`pluginAccounting.journalList.columns.kind`)),1),S(`th`,Npt,T(q(r)(`pluginAccounting.journalList.columns.memo`)),1),S(`th`,Ppt,T(q(r)(`pluginAccounting.journalList.columns.lines`)),1)])]),S(`tbody`,null,[(B(!0),U(D,null,H(ce.value,t=>(B(),U(D,{key:t.id},[S(`tr`,{class:c([le.value.has(t.id)?`text-gray-400 line-through`:``,p.value===t.id?`row-selected`:``,`border-b border-gray-100 align-top cursor-pointer hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400`]),"data-testid":le.value.has(t.id)?`accounting-journal-row-voided-${t.id}`:`accounting-journal-row-${t.id}`,tabindex:`0`,role:`button`,"aria-expanded":p.value===t.id,onClick:e=>te(t.id),onKeydown:[l(s(e=>ne(e,t.id),[`prevent`,`self`]),[`enter`]),l(s(e=>ne(e,t.id),[`prevent`,`self`]),[`space`])]},[S(`td`,Ipt,T(t.date),1),S(`td`,Lpt,T(N(t.kind)),1),S(`td`,Rpt,[t.memo?(B(),U(`span`,zpt,T(t.memo),1)):b(``,!0)]),S(`td`,Bpt,[p.value===t.id?(B(),U(`div`,Gpt,[S(`span`,Kpt,T(L(t.createdAt)),1),S(`button`,{type:`button`,class:`h-6 w-6 flex items-center justify-center rounded text-gray-500 hover:bg-gray-100`,"data-testid":`accounting-journal-detail-close-${t.id}`,"aria-label":q(r)(`common.close`),onClick:s(ee,[`stop`])},[...n[5]||=[S(`span`,{class:`material-icons text-base`},`close`,-1)]],8,qpt)])):(B(!0),U(D,{key:0},H(t.lines,(e,t)=>(B(),U(`div`,{key:t,class:`text-xs flex gap-2 items-baseline`},[S(`span`,Vpt,T(e.accountCode),1),z(e.accountCode)?(B(),U(`span`,Hpt,T(z(e.accountCode)),1)):b(``,!0),e.debit?(B(),U(`span`,Upt,T(P(e.debit)),1)):b(``,!0),e.credit?(B(),U(`span`,Wpt,T(F(e.credit)),1)):b(``,!0)]))),128))])],42,Fpt),p.value===t.id?(B(),U(`tr`,{key:0,class:`bg-gray-50 detail-selected`,"data-testid":`accounting-journal-detail-${t.id}`},[S(`td`,Ypt,[f.value?.id===t.id?(B(),U(`div`,{key:0,"data-testid":`accounting-journal-detail-edit-${t.id}`},[De(_pt,{"book-id":e.bookId,accounts:e.accounts,currency:e.currency,country:e.country,"entry-to-edit":f.value,onSubmitted:v,onCancel:y},null,8,[`book-id`,`accounts`,`currency`,`country`,`entry-to-edit`])],8,Xpt)):(B(),U(D,{key:1},[S(`div`,Zpt,[t.kind===`normal`&&!le.value.has(t.id)?(B(),U(D,{key:0},[S(`button`,{class:`text-xs text-blue-600 hover:underline`,"data-testid":`accounting-edit-${t.id}`,onClick:e=>g(t)},T(q(r)(`pluginAccounting.journalList.edit`)),9,Qpt),S(`button`,{class:`text-xs text-red-500 hover:underline`,"data-testid":`accounting-void-${t.id}`,onClick:e=>ue(t)},T(q(r)(`pluginAccounting.journalList.void`)),9,$pt)],64)):t.kind===`opening`&&!le.value.has(t.id)?(B(),U(`button`,{key:1,class:`text-xs text-blue-600 hover:underline`,"data-testid":`accounting-edit-opening-${t.id}`,onClick:n[2]||=e=>o(`editOpening`)},T(q(r)(`pluginAccounting.journalList.edit`)),9,emt)):b(``,!0)]),S(`table`,tmt,[S(`thead`,null,[S(`tr`,nmt,[S(`th`,rmt,T(q(r)(`pluginAccounting.entryForm.accountLabel`)),1),S(`th`,imt,T(q(r)(`pluginAccounting.entryForm.debitLabel`)),1),S(`th`,amt,T(q(r)(`pluginAccounting.entryForm.creditLabel`)),1),S(`th`,omt,T(q(r)(`pluginAccounting.entryForm.memoLabel`)),1),re(t)?(B(),U(`th`,smt,T(q(r)(`pluginAccounting.entryForm.taxRegistrationIdLabel`)),1)):b(``,!0)])]),S(`tbody`,null,[(B(!0),U(D,null,H(t.lines,(n,r)=>(B(),U(`tr`,{key:r,class:`border-b border-gray-100 text-gray-700`},[S(`td`,cmt,[S(`span`,lmt,T(n.accountCode),1),z(n.accountCode)?(B(),U(`span`,umt,T(z(n.accountCode)),1)):b(``,!0)]),S(`td`,dmt,[n.debit?(B(),U(D,{key:0},[J(T(q(lP)(n.debit,e.currency)),1)],64)):b(``,!0)]),S(`td`,fmt,[n.credit?(B(),U(D,{key:0},[J(T(q(lP)(n.credit,e.currency)),1)],64)):b(``,!0)]),S(`td`,pmt,[n.memo?(B(),U(D,{key:0},[J(T(n.memo),1)],64)):b(``,!0)]),re(t)?(B(),U(`td`,mmt,[n.taxRegistrationId?(B(),U(D,{key:0},[J(T(n.taxRegistrationId),1)],64)):b(``,!0)])):b(``,!0)]))),128))]),S(`tfoot`,null,[S(`tr`,hmt,[S(`td`,gmt,T(q(r)(`pluginAccounting.balanceSheet.total`)),1),S(`td`,_mt,T(q(lP)(ae(t),e.currency)),1),S(`td`,vmt,T(q(lP)(oe(t),e.currency)),1),S(`td`,{colspan:re(t)?2:1},null,8,ymt)])])])],64))])],8,Jpt)):b(``,!0)],64))),128))])]))])]))}}),[[`__scopeId`,`data-v-6d11cf47`]]),xmt={class:`flex items-center justify-between gap-2`},Smt={class:`text-base font-semibold`},Cmt={class:`text-xs text-gray-500`},wmt={class:`text-xs text-blue-600`,"data-testid":`accounting-opening-empty-hint`},Tmt={key:0,class:`text-xs text-gray-500`,"data-testid":`accounting-opening-existing`},Emt={key:0,class:`text-amber-600 ml-2`},Dmt={key:1,class:`text-xs text-gray-400`,"data-testid":`accounting-opening-none`},Omt={class:`text-xs text-gray-500 flex flex-col gap-1 w-fit`},kmt={class:`w-full text-sm`},Amt={class:`text-xs text-gray-500 border-b border-gray-200`},jmt={class:`text-left py-1 px-2`},Mmt={class:`text-right py-1 px-2 w-32`},Nmt={class:`text-right py-1 px-2 w-32`},Pmt={class:`py-1 px-2`},Fmt={class:`font-mono text-[10px] text-gray-400 mr-2`},Imt={class:`ml-2 text-xs text-gray-400`},Lmt={class:`py-1 px-2`},Rmt=[`onUpdate:modelValue`,`step`,`data-testid`,`onInput`],zmt={class:`py-1 px-2`},Bmt=[`onUpdate:modelValue`,`step`,`data-testid`,`onInput`],Vmt={class:`flex items-center justify-between`},Hmt={class:`text-xs text-gray-400`},Umt={key:2,class:`text-xs text-red-500`,"data-testid":`accounting-opening-error`},Wmt={key:3,class:`text-xs text-green-600`,"data-testid":`accounting-opening-success`},Gmt={class:`flex justify-end`},Kmt=[`disabled`],qmt=OL(K({__name:`OpeningBalancesForm`,props:{bookId:{},accounts:{},currency:{},version:{}},emits:[`submitted`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),i=e,a=t,o=V(!1),l=V(dP()),d=V({}),f=V(null),p=V(!1),h=V(null),g=V(null),{begin:_,isCurrent:v}=CL(),y=m(()=>i.accounts.filter(e=>(e.type===`asset`||e.type===`liability`||e.type===`equity`)&&e.active!==!1));function x(){for(let e of y.value)d.value[e.code]||(d.value[e.code]={debit:null,credit:null})}let C=m(()=>y.value.flatMap(e=>{let t=d.value[e.code];return t?[{account:e,row:t}]:[]}));function w(e){let t=d.value[e];t&&t.debit!==null&&t.debit!==0&&(t.credit=null)}function E(e){let t=d.value[e];t&&t.credit!==null&&t.credit!==0&&(t.debit=null)}let O=m(()=>{let e=0;for(let t of y.value){let n=d.value[t.code];n&&(typeof n.debit==`number`&&(e+=n.debit),typeof n.credit==`number`&&(e-=n.credit))}return e}),k=m(()=>Math.abs(O.value)<=.005),A=m(()=>lP(O.value,i.currency)),j=m(()=>O9e(i.currency));function M(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function N(){let e=[];for(let t of y.value){let n=d.value[t.code];if(!n)continue;let{debit:r,credit:i}=n,a=M(r),o=M(i);if(!a&&!o)continue;let s={accountCode:t.code};a&&(s.debit=r),o&&(s.credit=i),e.push(s)}return e}function P(){let e={};for(let t of y.value)e[t.code]={debit:null,credit:null};return e}async function F(){let e=_(),t=P(),r=await n.getOpeningBalances(i.bookId);if(v(e)){if(!r.ok){f.value=null,d.value=t;return}if(f.value=r.data.opening,r.data.opening){l.value=r.data.opening.date;for(let e of r.data.opening.lines)t[e.accountCode]={debit:e.debit??null,credit:e.credit??null}}else l.value=dP();d.value=t}}async function I(){if(!p.value&&k.value){p.value=!0,h.value=null,g.value=null;try{let e=await n.setOpeningBalances({bookId:i.bookId,asOfDate:l.value,lines:N()});if(!e.ok){h.value=e.error;return}g.value=r(`pluginAccounting.openingForm.success`),a(`submitted`)}catch(e){h.value=rP(e)}finally{p.value=!1}}}return Ve(()=>[i.bookId,i.version,i.accounts.length],()=>{x(),F()},{immediate:!0}),(t,n)=>(B(),U(D,null,[S(`form`,{class:`flex flex-col gap-3`,"data-testid":`accounting-opening-form`,onSubmit:s(I,[`prevent`])},[S(`div`,xmt,[S(`h3`,Smt,T(q(r)(`pluginAccounting.openingForm.title`)),1),S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-opening-manage-accounts`,onClick:n[0]||=e=>o.value=!0},[n[3]||=S(`span`,{class:`material-icons text-base`},`tune`,-1),S(`span`,null,T(q(r)(`pluginAccounting.accounts.manageButton`)),1)])]),S(`p`,Cmt,T(q(r)(`pluginAccounting.openingForm.explainer`)),1),S(`p`,wmt,T(q(r)(`pluginAccounting.openingForm.emptyHint`)),1),f.value?(B(),U(`div`,Tmt,[J(T(q(r)(`pluginAccounting.openingForm.setBy`,{date:f.value.date}))+` `,1),f.value?(B(),U(`span`,Emt,T(q(r)(`pluginAccounting.openingForm.replaceWarning`)),1)):b(``,!0)])):(B(),U(`p`,Dmt,T(q(r)(`pluginAccounting.openingForm.none`)),1)),S(`label`,Omt,[J(T(q(r)(`pluginAccounting.openingForm.asOfLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[1]||=e=>l.value=e,type:`date`,required:``,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-opening-asof`},null,512),[[Fe,l.value]])]),S(`table`,kmt,[S(`thead`,null,[S(`tr`,Amt,[S(`th`,jmt,T(q(r)(`pluginAccounting.entryForm.accountLabel`)),1),S(`th`,Mmt,T(q(r)(`pluginAccounting.entryForm.debitLabel`)),1),S(`th`,Nmt,T(q(r)(`pluginAccounting.entryForm.creditLabel`)),1)])]),S(`tbody`,null,[(B(!0),U(D,null,H(C.value,({account:e,row:t})=>(B(),U(`tr`,{key:e.code,class:`border-b border-gray-100`},[S(`td`,Pmt,[S(`span`,Fmt,T(e.code),1),S(`span`,null,T(e.name),1),S(`span`,Imt,T(e.type),1)]),S(`td`,Lmt,[u(S(`input`,{"onUpdate:modelValue":e=>t.debit=e,type:`number`,step:j.value,min:`0`,class:`h-8 px-2 w-full rounded border border-gray-300 text-sm text-right`,"data-testid":`accounting-opening-debit-${e.code}`,onInput:t=>w(e.code)},null,40,Rmt),[[Fe,t.debit,void 0,{number:!0}]])]),S(`td`,zmt,[u(S(`input`,{"onUpdate:modelValue":e=>t.credit=e,type:`number`,step:j.value,min:`0`,class:`h-8 px-2 w-full rounded border border-gray-300 text-sm text-right`,"data-testid":`accounting-opening-credit-${e.code}`,onInput:t=>E(e.code)},null,40,Bmt),[[Fe,t.credit,void 0,{number:!0}]])])]))),128))])]),S(`div`,Vmt,[S(`span`,Hmt,T(q(r)(`pluginAccounting.openingForm.explainer2`)),1),S(`span`,{class:c([k.value?`text-green-600`:`text-red-500`,`text-xs`]),"data-testid":`accounting-opening-balance`},T(k.value?q(r)(`pluginAccounting.entryForm.balanced`):q(r)(`pluginAccounting.entryForm.imbalance`,{amount:A.value})),3)]),h.value?(B(),U(`p`,Umt,T(h.value),1)):b(``,!0),g.value?(B(),U(`p`,Wmt,T(g.value),1)):b(``,!0),S(`div`,Gmt,[S(`button`,{type:`submit`,class:`h-8 px-3 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm disabled:opacity-50`,disabled:!k.value||p.value,"data-testid":`accounting-opening-submit`},T(p.value?q(r)(`pluginAccounting.entryForm.submitting`):q(r)(`pluginAccounting.openingForm.submit`)),9,Kmt)])],32),o.value?(B(),ke(DL,{key:0,"book-id":e.bookId,accounts:e.accounts,onClose:n[2]||=e=>o.value=!1},null,8,[`book-id`,`accounts`])):b(``,!0)],64))}}),[[`__scopeId`,`data-v-08e2a48f`]]),Jmt={class:`flex flex-col gap-3`,"data-testid":`accounting-accounts-list`},Ymt={class:`flex flex-wrap items-center justify-end gap-2`},Xmt={class:`text-xs font-semibold text-gray-500 uppercase tracking-wide`},Zmt={key:0,class:`text-xs text-gray-400 italic px-1`},Qmt={key:1,class:`flex flex-col`},$mt=[`aria-label`,`data-testid`,`onClick`,`onKeydown`],eht={class:`font-mono text-xs w-16 shrink-0`},tht={class:`text-sm flex-1 min-w-0 truncate`},nht=K({__name:`AccountsList`,props:{bookId:{},accounts:{}},emits:[`selectAccount`,`changed`],setup(e,{emit:t}){let{t:n}=xL(),r=e,i=t,a=[`asset`,`liability`,`equity`,`income`,`expense`],o=V(!1);function c(e,t){return e.code.localeCompare(t.code)}let u=m(()=>a.map(e=>({type:e,accounts:r.accounts.filter(t=>t.type===e&&t.active!==!1).slice().sort(c)})));function d(e){i(`selectAccount`,e.code)}function f(e,t){e.repeat||i(`selectAccount`,t.code)}function p(){i(`changed`)}return(t,r)=>(B(),U(`div`,Jmt,[S(`div`,Ymt,[S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-accounts-manage`,onClick:r[0]||=e=>o.value=!0},[r[2]||=S(`span`,{class:`material-icons text-base`},`tune`,-1),S(`span`,null,T(q(n)(`pluginAccounting.accounts.manageButton`)),1)])]),(B(!0),U(D,null,H(u.value,e=>(B(),U(`section`,{key:e.type,class:`flex flex-col gap-1`},[S(`h4`,Xmt,T(q(n)(`pluginAccounting.accounts.sectionTitle.${e.type}`)),1),e.accounts.length===0?(B(),U(`p`,Zmt,T(q(n)(`pluginAccounting.accounts.listEmpty`)),1)):(B(),U(`ul`,Qmt,[(B(!0),U(D,null,H(e.accounts,e=>(B(),U(`li`,{key:e.code,tabindex:`0`,role:`button`,"aria-label":q(n)(`pluginAccounting.accounts.openLedgerAria`,{code:e.code,name:e.name}),class:`flex items-center gap-3 px-2 py-1.5 border-b border-gray-100 hover:bg-blue-50 cursor-pointer text-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 rounded`,"data-testid":`accounting-account-row-${e.code}`,onClick:t=>d(e),onKeydown:[l(s(t=>f(t,e),[`prevent`,`self`]),[`enter`]),l(s(t=>f(t,e),[`prevent`,`self`]),[`space`])]},[S(`span`,eht,T(e.code),1),S(`span`,tht,T(e.name),1)],40,$mt))),128))]))]))),128)),o.value?(B(),ke(DL,{key:0,"book-id":e.bookId,accounts:e.accounts,onClose:r[1]||=e=>o.value=!1,onChanged:p},null,8,[`book-id`,`accounts`])):b(``,!0)]))}}),rht={class:`flex flex-col gap-3`,"data-testid":`accounting-ledger`},iht={class:`flex flex-wrap items-end gap-3`},aht={class:`text-xs text-gray-500 flex flex-col gap-1`},oht=[`value`],sht={key:0,class:`text-xs text-gray-400`},cht={key:1,class:`text-xs text-red-500`},lht=[`data-testid`],uht={class:`text-xs text-gray-500 border-b border-gray-200`},dht={class:`text-left py-1 px-2`},fht={class:`text-left py-1 px-2`},pht={key:0,class:`text-left py-1 px-2 w-40`},mht={class:`text-right py-1 px-2 w-28`},hht={class:`text-right py-1 px-2 w-28`},ght={class:`text-right py-1 px-2 w-28`},_ht={class:`py-1 px-2 whitespace-nowrap`},vht={class:`py-1 px-2`},yht={key:0},bht={key:0,class:`py-1 px-2 font-mono text-xs`},xht={key:0},Sht={class:`py-1 px-2 text-right`},Cht={key:0},wht={class:`py-1 px-2 text-right`},Tht={key:0},Eht={class:`py-1 px-2 text-right font-mono`},Dht={class:`font-semibold border-t border-gray-300`},Oht=[`colspan`],kht={class:`py-1 px-2 text-right`},Aht=`—`,jht=K({__name:`Ledger`,props:{bookId:{},accounts:{},currency:{},version:{},fiscalYearEnd:{},openingDate:{},preselectAccountCode:{}},setup(e){let t=SL(),{t:n}=xL(),r=e,a=V(``),o=V(null),s=V(!1),l=V(null),{begin:d,isCurrent:f}=CL(),p=m(()=>aP(r.fiscalYearEnd)),h=V(sP(p.value));function g(e){return lP(e,r.currency)}function _(e){return`${e.name} (${e.code})`}let v=m(()=>r.accounts.filter(e=>e.active!==!1)),y=m(()=>o.value?Ydt(o.value.accountCode):!1);function x(e){if(e.from!==``||e.to!==``)return{kind:`range`,from:e.from||`0000-01-01`,to:e.to||`9999-12-31`}}async function C(){let e=d();if(!a.value){o.value=null,l.value=null,s.value=!1;return}s.value=!0,l.value=null;try{let n=await t.getLedger(a.value,x(h.value),r.bookId);if(!f(e))return;if(!n.ok){l.value=n.error,o.value=null;return}o.value=n.data.ledger}finally{f(e)&&(s.value=!1)}}return Ve(()=>[r.bookId,p.value],()=>{a.value=``,h.value=sP(p.value)}),Ve(()=>r.preselectAccountCode,e=>{e&&(a.value=e,h.value=sP(p.value))},{immediate:!0}),Ve(()=>[r.bookId,r.version,a.value,h.value.from,h.value.to],C,{immediate:!0}),(t,r)=>(B(),U(`div`,rht,[S(`div`,iht,[S(`label`,aht,[J(T(q(n)(`pluginAccounting.ledger.selectAccount`))+` `,1),u(S(`select`,{"onUpdate:modelValue":r[0]||=e=>a.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-ledger-account`},[S(`option`,{value:``},T(Aht)),(B(!0),U(D,null,H(v.value,e=>(B(),U(`option`,{key:e.code,value:e.code},T(_(e)),9,oht))),128))],512),[[i,a.value]])]),De(wL,{modelValue:h.value,"onUpdate:modelValue":r[1]||=e=>h.value=e,"fiscal-year-end":p.value,"opening-date":e.openingDate},null,8,[`modelValue`,`fiscal-year-end`,`opening-date`]),S(`button`,{class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,onClick:C},[...r[2]||=[S(`span`,{class:`material-icons text-base align-middle`},`refresh`,-1)]])]),s.value?(B(),U(`p`,sht,T(q(n)(`pluginAccounting.common.loading`)),1)):l.value?(B(),U(`p`,cht,T(q(n)(`pluginAccounting.common.error`,{error:l.value})),1)):o.value?(B(),U(`table`,{key:2,class:`w-full text-sm`,"data-testid":y.value?`accounting-ledger-table-with-tax-id`:`accounting-ledger-table`},[S(`thead`,null,[S(`tr`,uht,[S(`th`,dht,T(q(n)(`pluginAccounting.ledger.columns.date`)),1),S(`th`,fht,T(q(n)(`pluginAccounting.ledger.columns.memo`)),1),y.value?(B(),U(`th`,pht,T(q(n)(`pluginAccounting.ledger.columns.taxRegistrationId`)),1)):b(``,!0),S(`th`,mht,T(q(n)(`pluginAccounting.ledger.columns.debit`)),1),S(`th`,hht,T(q(n)(`pluginAccounting.ledger.columns.credit`)),1),S(`th`,ght,T(q(n)(`pluginAccounting.ledger.columns.balance`)),1)])]),S(`tbody`,null,[(B(!0),U(D,null,H(o.value.rows,e=>(B(),U(`tr`,{key:`${e.entryId}-${e.date}`,class:c([e.kind===`void`||e.kind===`void-marker`?`text-gray-400 line-through`:``,`border-b border-gray-100`])},[S(`td`,_ht,T(e.date),1),S(`td`,vht,[e.memo?(B(),U(`span`,yht,T(e.memo),1)):b(``,!0)]),y.value?(B(),U(`td`,bht,[e.taxRegistrationId?(B(),U(`span`,xht,T(e.taxRegistrationId),1)):b(``,!0)])):b(``,!0),S(`td`,Sht,[e.debit?(B(),U(`span`,Cht,T(g(e.debit)),1)):b(``,!0)]),S(`td`,wht,[e.credit?(B(),U(`span`,Tht,T(g(e.credit)),1)):b(``,!0)]),S(`td`,Eht,T(g(e.runningBalance)),1)],2))),128))]),S(`tfoot`,null,[S(`tr`,Dht,[S(`td`,{colspan:y.value?5:4,class:`py-1 px-2 text-right`},T(q(n)(`pluginAccounting.ledger.closingBalance`)),9,Oht),S(`td`,kht,T(g(o.value.closingBalance)),1)])])],8,lht)):b(``,!0)]))}}),Mht={class:`flex flex-col gap-3`,"data-testid":`accounting-balance-sheet`},Nht={class:`flex flex-wrap items-end gap-3`},Pht={class:`text-xs text-gray-500 flex flex-col gap-1`},Fht=[`value`],Iht={value:`thisMonth`},Lht={value:`lastMonth`},Rht={value:`lastQuarter`},zht={value:`lastYear`},Bht={class:`text-xs text-gray-500 flex flex-col gap-1`},Vht={key:0,class:`text-xs text-gray-400`},Hht={key:1,class:`text-xs text-red-500`},Uht={class:`grid grid-cols-1 md:grid-cols-2 gap-4`},Wht={class:`text-sm font-semibold mb-2`},Ght={class:`w-full text-sm`},Kht=[`tabindex`,`role`,`aria-label`,`data-testid`,`onClick`,`onKeydown`],qht={class:`py-1 px-1`},Jht={key:0,class:`font-mono text-[10px] text-gray-400 mr-2`},Yht={class:`py-1 px-1 text-right font-mono`},Xht={class:`font-semibold border-t border-gray-300`},Zht={class:`py-1 px-1`},Qht={class:`py-1 px-1 text-right`},$ht=`_currentEarnings`,egt=K({__name:`BalanceSheet`,props:{bookId:{},currency:{},version:{}},emits:[`selectAccount`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),i=e,a=t,o=V(fP()),d=V(null),f=V(!1),p=V(null),{begin:h,isCurrent:g}=CL();function _(e){return lP(e,i.currency)}function v(e){return e===`asset`?r(`pluginAccounting.balanceSheet.sections.asset`):e===`liability`?r(`pluginAccounting.balanceSheet.sections.liability`):e===`equity`?r(`pluginAccounting.balanceSheet.sections.equity`):e}function y(e){return e.accountCode===$ht}function x(e){return y(e)?r(`pluginAccounting.balanceSheet.currentEarnings`):e.accountName}function C(e){y(e)||a(`selectAccount`,e.accountCode)}function w(e,t){e.repeat||y(t)||a(`selectAccount`,t.accountCode)}let E=m(()=>{let{value:e}=o,t=new Date;return e===fP(t)?`thisMonth`:e===A9e(t)?`lastMonth`:e===j9e(t)?`lastQuarter`:e===M9e(t)?`lastYear`:``});function O(e){let{target:t}=e;if(!(t instanceof HTMLSelectElement))return;let n=t.value,r=new Date;n===`thisMonth`?o.value=fP(r):n===`lastMonth`?o.value=A9e(r):n===`lastQuarter`?o.value=j9e(r):n===`lastYear`&&(o.value=M9e(r))}async function k(){let e=h();f.value=!0,p.value=null;try{let t=await n.getBalanceSheet({kind:`month`,period:o.value},i.bookId);if(!g(e))return;if(!t.ok){p.value=t.error,d.value=null;return}d.value=t.data.balanceSheet}finally{g(e)&&(f.value=!1)}}return Ve(()=>[i.bookId,i.version,o.value],k,{immediate:!0}),(e,t)=>(B(),U(`div`,Mht,[S(`div`,Nht,[S(`label`,Pht,[J(T(q(r)(`pluginAccounting.balanceSheet.shortcutLabel`))+` `,1),S(`select`,{value:E.value,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-bs-shortcut`,onChange:O},[t[1]||=S(`option`,{value:``,hidden:``},null,-1),S(`option`,Iht,T(q(r)(`pluginAccounting.balanceSheet.thisMonth`)),1),S(`option`,Lht,T(q(r)(`pluginAccounting.balanceSheet.lastMonth`)),1),S(`option`,Rht,T(q(r)(`pluginAccounting.balanceSheet.lastQuarter`)),1),S(`option`,zht,T(q(r)(`pluginAccounting.balanceSheet.lastYear`)),1)],40,Fht)]),S(`label`,Bht,[J(T(q(r)(`pluginAccounting.balanceSheet.asOfLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":t[0]||=e=>o.value=e,type:`month`,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-bs-period`},null,512),[[Fe,o.value]])]),S(`button`,{class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,onClick:k},[...t[2]||=[S(`span`,{class:`material-icons text-base align-middle`},`refresh`,-1)]])]),f.value?(B(),U(`p`,Vht,T(q(r)(`pluginAccounting.common.loading`)),1)):p.value?(B(),U(`p`,Hht,T(q(r)(`pluginAccounting.common.error`,{error:p.value})),1)):d.value?(B(),U(D,{key:2},[S(`div`,Uht,[(B(!0),U(D,null,H(d.value.sections,e=>(B(),U(`section`,{key:e.type,class:`border border-gray-200 rounded p-3`},[S(`h4`,Wht,T(v(e.type)),1),S(`table`,Ght,[S(`tbody`,null,[(B(!0),U(D,null,H(e.rows,e=>(B(),U(`tr`,{key:e.accountCode,class:c([`border-b border-gray-100`,y(e)?`italic text-gray-600`:`hover:bg-blue-50 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400`]),tabindex:y(e)?-1:0,role:y(e)?void 0:`button`,"aria-label":y(e)?void 0:q(r)(`pluginAccounting.accounts.openLedgerAria`,{code:e.accountCode,name:e.accountName}),"data-testid":y(e)?void 0:`accounting-bs-row-${e.accountCode}`,onClick:t=>C(e),onKeydown:[l(s(t=>w(t,e),[`prevent`,`self`]),[`enter`]),l(s(t=>w(t,e),[`prevent`,`self`]),[`space`])]},[S(`td`,qht,[y(e)?b(``,!0):(B(),U(`span`,Jht,T(e.accountCode),1)),J(T(x(e)),1)]),S(`td`,Yht,T(_(e.balance)),1)],42,Kht))),128))]),S(`tfoot`,null,[S(`tr`,Xht,[S(`td`,Zht,T(q(r)(`pluginAccounting.balanceSheet.total`)),1),S(`td`,Qht,T(_(e.total)),1)])])])]))),128))]),S(`p`,{class:c([Math.abs(d.value.imbalance)<=.01?`text-green-600`:`text-red-500`,`text-xs`]),"data-testid":`accounting-bs-imbalance`},T(q(r)(`pluginAccounting.balanceSheet.imbalance`,{amount:_(d.value.imbalance)})),3)],64)):b(``,!0)]))}}),tgt={class:`flex flex-col gap-3`,"data-testid":`accounting-profit-loss`},ngt={class:`flex flex-wrap items-end gap-3`},rgt={key:0,class:`text-xs text-gray-400`},igt={key:1,class:`text-xs text-red-500`},agt={class:`border border-gray-200 rounded p-3`},ogt={class:`text-sm font-semibold mb-2`},sgt={class:`w-full text-sm`},cgt=[`aria-label`,`data-testid`,`onClick`,`onKeydown`],lgt={class:`py-1 px-1`},ugt={class:`font-mono text-[10px] text-gray-400 mr-2`},dgt={class:`py-1 px-1 text-right font-mono`},fgt={class:`font-semibold border-t border-gray-300`},pgt={class:`py-1 px-1`},mgt={class:`py-1 px-1 text-right`},hgt={class:`border border-gray-200 rounded p-3`},ggt={class:`text-sm font-semibold mb-2`},_gt={class:`w-full text-sm`},vgt=[`aria-label`,`data-testid`,`onClick`,`onKeydown`],ygt={class:`py-1 px-1`},bgt={class:`font-mono text-[10px] text-gray-400 mr-2`},xgt={class:`py-1 px-1 text-right font-mono`},Sgt={class:`font-semibold border-t border-gray-300`},Cgt={class:`py-1 px-1`},wgt={class:`py-1 px-1 text-right`},Tgt={class:`flex justify-end items-center gap-2 text-sm font-semibold`,"data-testid":`accounting-pl-net`},Egt=K({__name:`ProfitLoss`,props:{bookId:{},currency:{},version:{},fiscalYearEnd:{},openingDate:{}},emits:[`selectAccount`],setup(e,{emit:t}){let n=SL(),{t:r}=xL(),i=e,a=t,o=m(()=>aP(i.fiscalYearEnd));function u(e){a(`selectAccount`,e)}function d(e,t){e.repeat||a(`selectAccount`,t)}let f=V(sP(o.value)),p=V(null),h=V(!1),g=V(null),{begin:_,isCurrent:v}=CL();function y(e){return lP(e,i.currency)}async function x(){let e=_();h.value=!0,g.value=null;try{let t=f.value.from||`0000-01-01`,r=f.value.to||`9999-12-31`,a=await n.getProfitLoss({kind:`range`,from:t,to:r},i.bookId);if(!v(e))return;if(!a.ok){g.value=a.error,p.value=null;return}p.value=a.data.profitLoss}finally{v(e)&&(h.value=!1)}}return Ve(()=>[i.bookId,o.value],()=>{f.value=sP(o.value)}),Ve(()=>[i.bookId,i.version,f.value.from,f.value.to],x,{immediate:!0}),(t,n)=>(B(),U(`div`,tgt,[S(`div`,ngt,[De(wL,{modelValue:f.value,"onUpdate:modelValue":n[0]||=e=>f.value=e,"fiscal-year-end":o.value,"opening-date":e.openingDate},null,8,[`modelValue`,`fiscal-year-end`,`opening-date`]),S(`button`,{class:`h-8 px-2.5 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,onClick:x},[...n[1]||=[S(`span`,{class:`material-icons text-base align-middle`},`refresh`,-1)]])]),h.value?(B(),U(`p`,rgt,T(q(r)(`pluginAccounting.common.loading`)),1)):g.value?(B(),U(`p`,igt,T(q(r)(`pluginAccounting.common.error`,{error:g.value})),1)):p.value?(B(),U(D,{key:2},[S(`section`,agt,[S(`h4`,ogt,T(q(r)(`pluginAccounting.profitLoss.income`)),1),S(`table`,sgt,[S(`tbody`,null,[(B(!0),U(D,null,H(p.value.income.rows,e=>(B(),U(`tr`,{key:e.accountCode,class:`border-b border-gray-100 hover:bg-blue-50 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400`,tabindex:`0`,role:`button`,"aria-label":q(r)(`pluginAccounting.accounts.openLedgerAria`,{code:e.accountCode,name:e.accountName}),"data-testid":`accounting-pl-row-${e.accountCode}`,onClick:t=>u(e.accountCode),onKeydown:[l(s(t=>d(t,e.accountCode),[`prevent`,`self`]),[`enter`]),l(s(t=>d(t,e.accountCode),[`prevent`,`self`]),[`space`])]},[S(`td`,lgt,[S(`span`,ugt,T(e.accountCode),1),J(T(e.accountName),1)]),S(`td`,dgt,T(y(e.amount)),1)],40,cgt))),128))]),S(`tfoot`,null,[S(`tr`,fgt,[S(`td`,pgt,T(q(r)(`pluginAccounting.balanceSheet.total`)),1),S(`td`,mgt,T(y(p.value.income.total)),1)])])])]),S(`section`,hgt,[S(`h4`,ggt,T(q(r)(`pluginAccounting.profitLoss.expense`)),1),S(`table`,_gt,[S(`tbody`,null,[(B(!0),U(D,null,H(p.value.expense.rows,e=>(B(),U(`tr`,{key:e.accountCode,class:`border-b border-gray-100 hover:bg-blue-50 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400`,tabindex:`0`,role:`button`,"aria-label":q(r)(`pluginAccounting.accounts.openLedgerAria`,{code:e.accountCode,name:e.accountName}),"data-testid":`accounting-pl-row-${e.accountCode}`,onClick:t=>u(e.accountCode),onKeydown:[l(s(t=>d(t,e.accountCode),[`prevent`,`self`]),[`enter`]),l(s(t=>d(t,e.accountCode),[`prevent`,`self`]),[`space`])]},[S(`td`,ygt,[S(`span`,bgt,T(e.accountCode),1),J(T(e.accountName),1)]),S(`td`,xgt,T(y(e.amount)),1)],40,vgt))),128))]),S(`tfoot`,null,[S(`tr`,Sgt,[S(`td`,Cgt,T(q(r)(`pluginAccounting.balanceSheet.total`)),1),S(`td`,wgt,T(y(p.value.expense.total)),1)])])])]),S(`div`,Tgt,[S(`span`,null,T(q(r)(`pluginAccounting.profitLoss.netIncome`)),1),S(`span`,{class:c(p.value.netIncome>=0?`text-green-600`:`text-red-500`)},T(y(p.value.netIncome)),3)])],64)):b(``,!0)]))}}),Dgt={class:`flex flex-col gap-4`,"data-testid":`accounting-settings`},Ogt={class:`border border-gray-200 rounded p-3 flex flex-col gap-2`},kgt={class:`text-sm font-semibold`},Agt={class:`text-xs text-gray-500`},jgt={class:`text-sm flex flex-col gap-1`},Mgt=[`disabled`],Ngt={class:`text-xs text-gray-700 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1`},Pgt={class:`text-gray-500`},Fgt={class:`text-sm flex flex-col gap-1 mt-1`},Igt=[`disabled`],Lgt={value:``},Rgt=[`value`],zgt={class:`text-sm flex flex-col gap-1 mt-1`},Bgt=[`disabled`],Vgt=[`value`],Hgt={class:`text-xs text-gray-500`},Ugt={key:0,class:`text-xs text-green-600`,"data-testid":`accounting-settings-update-ok`},Wgt={key:1,class:`text-xs text-red-500`,"data-testid":`accounting-settings-update-error`},Ggt=[`disabled`],Kgt={class:`border border-gray-200 rounded p-3 flex flex-col gap-2`},qgt={class:`text-sm font-semibold`},Jgt={class:`text-xs text-gray-500`},Ygt={key:0,class:`text-xs text-green-600`,"data-testid":`accounting-settings-rebuild-ok`},Xgt={key:1,class:`text-xs text-red-500`,"data-testid":`accounting-settings-rebuild-error`},Zgt=[`disabled`],Qgt={key:0},$gt={key:1,class:`border border-red-300 rounded p-3 flex flex-col gap-2`},e_t={class:`text-sm font-semibold text-red-700`},t_t={class:`text-xs text-gray-500`},n_t={key:0,class:`text-xs text-red-500`,"data-testid":`accounting-settings-delete-error`},r_t={class:`text-xs text-gray-500 flex flex-col gap-1`},i_t=[`disabled`],a_t=K({__name:`BookSettings`,props:{bookId:{},bookName:{},currency:{},country:{},fiscalYearEnd:{}},emits:[`deleted`,`books-changed`],setup(e,{emit:t}){let n=SL(),{t:r,locale:a}=xL(),o=e,s=t,c=V(!1),l=V(null),d=V(null),f=V(!1),p=V(null),h=V(``),g=V(!1),_=V(null),v=V(null),y=V(!1),x=V(o.bookName),C=V(o.country??``),w=V(aP(o.fiscalYearEnd)),E=m(()=>cP.map(e=>({code:e,label:`${e} — ${b9e(e,a.value)}`}))),O=m(()=>iP.map(e=>({value:e,label:d9e(e,a.value)}))),k=m(()=>{let e=x.value.trim()!==o.bookName,t=x.value.trim().length>0,n=C.value!==(o.country??``),r=w.value!==aP(o.fiscalYearEnd);return t&&(e||n||r)});async function A(){c.value=!0,l.value=null,d.value=null;try{let e=await n.rebuildSnapshots(o.bookId);if(!e.ok){d.value=e.error;return}l.value=r(`pluginAccounting.settings.rebuildOk`,{count:e.data.rebuilt.length})}finally{c.value=!1}}async function j(){if(!g.value){g.value=!0,_.value=null,v.value=null;try{let e=C.value,t=e===``||x9e(e)?e:``,i=await n.updateBook({bookId:o.bookId,name:x.value.trim(),country:t,fiscalYearEnd:w.value});if(!i.ok){v.value=i.error;return}_.value=r(`pluginAccounting.settings.updateOk`),s(`books-changed`)}finally{g.value=!1}}}async function M(){if(!f.value){f.value=!0,p.value=null;try{let e=await n.deleteBook(o.bookId);if(!e.ok){p.value=e.error;return}s(`deleted`,o.bookName),s(`books-changed`)}finally{f.value=!1}}}return Ve(()=>o.bookId,()=>{l.value=null,d.value=null,p.value=null,h.value=``,_.value=null,v.value=null,x.value=o.bookName,C.value=o.country??``,w.value=aP(o.fiscalYearEnd),y.value=!1}),Ve(()=>o.bookName,e=>{x.value=e}),Ve(()=>o.country,e=>{C.value=e??``}),Ve(()=>o.fiscalYearEnd,e=>{w.value=aP(e)}),(t,n)=>(B(),U(`div`,Dgt,[S(`section`,Ogt,[S(`h4`,kgt,T(q(r)(`pluginAccounting.settings.bookInfo`)),1),S(`p`,Agt,T(q(r)(`pluginAccounting.settings.bookInfoExplain`)),1),S(`label`,jgt,[J(T(q(r)(`pluginAccounting.bookSwitcher.nameLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[0]||=e=>x.value=e,type:`text`,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-settings-name`,disabled:g.value,maxlength:`200`},null,8,Mgt),[[Fe,x.value]])]),S(`dl`,Ngt,[S(`dt`,Pgt,T(q(r)(`pluginAccounting.bookSwitcher.currencyLabel`)),1),S(`dd`,null,T(e.currency),1)]),S(`label`,Fgt,[J(T(q(r)(`pluginAccounting.bookSwitcher.countryLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[1]||=e=>C.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-settings-country`,disabled:g.value},[S(`option`,Lgt,T(q(r)(`pluginAccounting.settings.countryUnset`)),1),(B(!0),U(D,null,H(E.value,e=>(B(),U(`option`,{key:e.code,value:e.code},T(e.label),9,Rgt))),128))],8,Igt),[[i,C.value]])]),S(`label`,zgt,[J(T(q(r)(`pluginAccounting.bookSwitcher.fiscalYearEndLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[2]||=e=>w.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm bg-white`,"data-testid":`accounting-settings-fiscal-year-end`,disabled:g.value},[(B(!0),U(D,null,H(O.value,e=>(B(),U(`option`,{key:e.value,value:e.value},T(e.label),9,Vgt))),128))],8,Bgt),[[i,w.value]])]),S(`p`,Hgt,T(q(r)(`pluginAccounting.settings.fiscalYearEndExplain`)),1),_.value?(B(),U(`p`,Ugt,T(_.value),1)):b(``,!0),v.value?(B(),U(`p`,Wgt,T(v.value),1)):b(``,!0),S(`div`,null,[S(`button`,{class:`h-8 px-3 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm disabled:opacity-50`,disabled:g.value||!k.value,"data-testid":`accounting-settings-save`,onClick:j},T(g.value?q(r)(`pluginAccounting.common.loading`):q(r)(`pluginAccounting.settings.saveChanges`)),9,Ggt)])]),S(`section`,Kgt,[S(`h4`,qgt,T(q(r)(`pluginAccounting.settings.rebuild`)),1),S(`p`,Jgt,T(q(r)(`pluginAccounting.settings.rebuildExplain`)),1),l.value?(B(),U(`p`,Ygt,T(l.value),1)):b(``,!0),d.value?(B(),U(`p`,Xgt,T(d.value),1)):b(``,!0),S(`div`,null,[S(`button`,{class:`h-8 px-3 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm disabled:opacity-50`,disabled:c.value,"data-testid":`accounting-settings-rebuild`,onClick:A},T(c.value?q(r)(`pluginAccounting.common.loading`):q(r)(`pluginAccounting.settings.rebuild`)),9,Zgt)])]),y.value?b(``,!0):(B(),U(`div`,Qgt,[S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-sm text-gray-600 hover:bg-gray-50`,"data-testid":`accounting-settings-advanced`,onClick:n[3]||=e=>y.value=!0},[n[5]||=S(`span`,{class:`material-icons text-base`},`expand_more`,-1),S(`span`,null,T(q(r)(`pluginAccounting.settings.advanced`)),1)])])),y.value?(B(),U(`section`,$gt,[S(`h4`,e_t,T(q(r)(`pluginAccounting.settings.deleteBook`)),1),S(`p`,t_t,T(q(r)(`pluginAccounting.settings.deleteBookExplain`)),1),p.value?(B(),U(`p`,n_t,T(p.value),1)):b(``,!0),S(`label`,r_t,[J(T(q(r)(`pluginAccounting.settings.deleteBookConfirm`,{bookName:e.bookName}))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[4]||=e=>h.value=e,class:`h-8 px-2 rounded border border-gray-300 text-sm`,"data-testid":`accounting-settings-delete-confirm`},null,512),[[Fe,h.value]])]),S(`div`,null,[S(`button`,{class:`h-8 px-3 rounded bg-red-600 hover:bg-red-700 text-white text-sm disabled:opacity-50`,disabled:h.value!==e.bookName||f.value,"data-testid":`accounting-settings-delete`,onClick:M},T(f.value?q(r)(`pluginAccounting.common.loading`):q(r)(`pluginAccounting.settings.deleteBookButton`)),9,i_t)])])):b(``,!0)]))}}),o_t=Object.values(i9e);function s_t(e){if(typeof e!=`object`||!e||!(`kind`in e))return null;let t=o_t.find(t=>t===e.kind);if(t===void 0)return null;let n=`period`in e&&typeof e.period==`string`?e.period:void 0;return n===void 0?{kind:t}:{kind:t,period:n}}function c_t(e){return m(()=>e===void 0?bL():typeof e==`function`?e():e)}function l_t(e,t,n){let r=c_t(n),i=V(0),a=null;function o(e){a?.(),a=null,i.value=0,e&&(a=$ut(t9e(e,r.value),e=>{i.value+=1;let n=s_t(e);n&&t?.(n)}))}return Ve([e,r],([e])=>o(e),{immediate:!0}),_(()=>{a?.(),a=null}),{version:i}}function u_t(e,t){let n=c_t(t),r=null;Ve(n,t=>{r?.(),r=$ut(r9e(t),e)},{immediate:!0}),_(()=>{r?.(),r=null})}var d_t={class:`h-full bg-white flex flex-col`,"data-testid":`accounting-app`},f_t={class:`flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-100 shrink-0`},p_t={class:`flex items-center gap-2 min-w-0`},m_t={class:`text-lg font-semibold text-gray-800`},h_t={class:`flex items-center gap-0.5 px-3 py-1.5 border-b border-gray-100 shrink-0 overflow-x-auto`,"data-testid":`accounting-tabs`},g_t=[`data-testid`,`disabled`,`onClick`],__t={class:`material-icons text-base`},v_t={class:`flex-1 overflow-auto p-4`},y_t={key:0,class:`text-center text-sm text-gray-600 flex flex-col gap-2 items-center justify-center h-full`,"data-testid":`accounting-deleted-notice`},b_t={class:`font-medium`,"data-testid":`accounting-deleted-notice-title`},x_t={class:`text-xs text-gray-500`},S_t={key:1,class:`text-sm text-gray-400`},C_t={key:2,class:`text-sm text-red-500`,"data-testid":`accounting-load-error`},w_t={key:3,class:`text-sm text-gray-500`,"data-testid":`accounting-no-book`},T_t=K({__name:`View`,props:{selectedResult:{}},setup(e){let{t}=xL(),n=e,r=[`journal`,`opening`,`accounts`,`ledger`,`balanceSheet`,`profitLoss`,`settings`],i=[{key:`journal`,icon:`list`,labelKey:`pluginAccounting.tabs.journal`},{key:`opening`,icon:`play_arrow`,labelKey:`pluginAccounting.tabs.opening`},{key:`accounts`,icon:`list_alt`,labelKey:`pluginAccounting.tabs.accounts`},{key:`ledger`,icon:`menu_book`,labelKey:`pluginAccounting.tabs.ledger`},{key:`balanceSheet`,icon:`balance`,labelKey:`pluginAccounting.tabs.balanceSheet`},{key:`profitLoss`,icon:`trending_up`,labelKey:`pluginAccounting.tabs.profitLoss`},{key:`settings`,icon:`settings`,labelKey:`pluginAccounting.tabs.settings`}];function a(e){return r.some(t=>t===e)}let o=m(()=>n.selectedResult?.data??n.selectedResult?.jsonData??{}),s=m(()=>{let e=o.value;return`scope`in e?e.scope??null:bL()}),l=ddt(()=>s.value),u=m(()=>a(o.value.initialTab)?o.value.initialTab:`journal`),d=V(u.value),f=V([]),p=V(null),h=V([]),g=V(!0),_=V(!1),v=V(!1),y=V(!1),x=V(null),C=V(null),w=V(void 0),E=V(null),O=m(()=>f.value.find(e=>e.id===p.value)??null),k=m(()=>O.value?.name??``),A=m(()=>O.value?.currency??`USD`),j=m(()=>O.value?.country),M=m(()=>O.value?.fiscalYearEnd),{version:N}=l_t(p,void 0,()=>s.value);u_t(()=>void F(),()=>s.value);function P(){let[e]=f.value;if(!e)return null;let t=o.value.bookId;return t&&f.value.some(e=>e.id===t)?t:e.id}async function F(){g.value=!0,x.value=null;let e=O.value;try{let t=await l.getBooks();if(!t.ok){x.value=t.error;return}f.value=t.data.books,_.value=!0,E.value===null&&(p.value!==null&&f.value.some(e=>e.id===p.value)||(e?(p.value=null,E.value=e.name):p.value=P())),!y.value&&f.value.length===0&&(y.value=!0,v.value=!0)}catch(e){x.value=rP(e)}finally{g.value=!1}}async function I(e){v.value=!1,await F(),p.value=e.id}async function L(e){f.value.some(t=>t.id===e.id)||(f.value=[...f.value,e]),p.value=e.id,E.value=null,d.value=`journal`,await F()}async function R(){if(!p.value){h.value=[];return}let e=await l.getAccounts(p.value);e.ok&&(h.value=e.data.accounts)}async function z(){if(!p.value){C.value=null,w.value=void 0;return}let e=await l.getOpeningBalances(p.value);e.ok&&(C.value=e.data.opening!==null,w.value=e.data.opening?.date)}let ee=m(()=>p.value!==null&&C.value===!1),te=m(()=>ee.value?i.filter(e=>e.key===`opening`||e.key===`settings`):i.filter(e=>e.key!==`opening`||d.value===`opening`));function ne(e){p.value=e,E.value=null}let re=V(void 0),ie=V(void 0);function ae(e){ie.value=void 0,Promise.resolve().then(()=>{ie.value=e}),d.value=`ledger`}function oe(){d.value===`opening`&&(d.value=`journal`)}async function W(e){d.value=`journal`,p.value=null,E.value=e,await F()}Ve(()=>[p.value,N.value],()=>{p.value&&R()},{immediate:!0}),Ve(p,()=>{ie.value=void 0});let se=V(null);function ce(e){if(f.value.some(t=>t.id===e)){p.value=e,se.value=null;return}se.value=e}Ve(()=>o.value.bookId,e=>{e&&ce(e)}),Ve(f,()=>{let e=se.value;e&&ce(e)});function le(e){if(a(e.initialTab))return e.initialTab;switch(e.action){case tP.addEntries:case tP.voidEntry:return`journal`;case tP.upsertAccount:return`accounts`;case tP.updateBook:return`settings`;case tP.openBook:case tP.createBook:case tP.setOpeningBalances:return`balanceSheet`;default:return null}}function ue(e){if(e.action===tP.addEntries){let t=Array.isArray(e.entries)?e.entries:[];return t[t.length-1]?.id}if(e.action===tP.voidEntry)return e.markerEntry?.id}return Ve(()=>o.value,e=>{let t=le(e);t&&(d.value=t),re.value=ue(e)},{immediate:!0}),Ve(p,(e,t)=>{t&&(re.value=void 0)}),Ve(()=>[p.value,N.value],()=>void z(),{immediate:!0}),Ve(ee,e=>{e&&d.value!==`opening`&&(d.value=`opening`)}),F(),(e,n)=>(B(),U(`div`,d_t,[v.value?(B(),ke(Ddt,{key:0,"first-run":``,"full-page":``,onCreated:I})):(B(),U(D,{key:1},[S(`header`,f_t,[S(`div`,p_t,[n[2]||=S(`span`,{class:`material-icons text-gray-600`},`account_balance`,-1),S(`h2`,m_t,T(q(t)(`pluginAccounting.title`)),1)]),_.value?(B(),ke(Pdt,{key:0,"model-value":p.value??``,books:f.value,"onUpdate:modelValue":ne,onBooksChanged:F,onBookCreated:L},null,8,[`model-value`,`books`])):b(``,!0)]),S(`nav`,h_t,[(B(!0),U(D,null,H(te.value,e=>(B(),U(`button`,{key:e.key,class:c([`h-8 px-2.5 flex items-center gap-1 rounded text-sm whitespace-nowrap`,E.value===null?d.value===e.key?`bg-blue-50 text-blue-600 font-medium`:`text-gray-600 hover:bg-gray-50`:`text-gray-400 cursor-not-allowed`]),"data-testid":`accounting-tab-${e.key}`,disabled:E.value!==null,onClick:t=>d.value=e.key},[S(`span`,__t,T(e.icon),1),S(`span`,null,T(q(t)(e.labelKey)),1)],10,g_t))),128))]),S(`main`,v_t,[E.value===null?g.value&&!_.value?(B(),U(`p`,S_t,T(q(t)(`pluginAccounting.common.loading`)),1)):x.value?(B(),U(`p`,C_t,T(q(t)(`pluginAccounting.common.error`,{error:x.value})),1)):p.value?p.value?(B(),U(D,{key:4},[d.value===`journal`?(B(),ke(bmt,{key:0,"book-id":p.value,accounts:h.value,currency:A.value,country:j.value,version:q(N),"fiscal-year-end":M.value,"opening-date":w.value,"preselect-entry-id":re.value,onEditOpening:n[0]||=e=>d.value=`opening`,onPreselectConsumed:n[1]||=e=>re.value=void 0},null,8,[`book-id`,`accounts`,`currency`,`country`,`version`,`fiscal-year-end`,`opening-date`,`preselect-entry-id`])):d.value===`opening`?(B(),ke(qmt,{key:1,"book-id":p.value,accounts:h.value,currency:A.value,version:q(N),onSubmitted:oe},null,8,[`book-id`,`accounts`,`currency`,`version`])):d.value===`accounts`?(B(),ke(nht,{key:2,"book-id":p.value,accounts:h.value,onSelectAccount:ae},null,8,[`book-id`,`accounts`])):d.value===`ledger`?(B(),ke(jht,{key:3,"book-id":p.value,accounts:h.value,currency:A.value,version:q(N),"fiscal-year-end":M.value,"opening-date":w.value,"preselect-account-code":ie.value},null,8,[`book-id`,`accounts`,`currency`,`version`,`fiscal-year-end`,`opening-date`,`preselect-account-code`])):d.value===`balanceSheet`?(B(),ke(egt,{key:4,"book-id":p.value,currency:A.value,version:q(N),onSelectAccount:ae},null,8,[`book-id`,`currency`,`version`])):d.value===`profitLoss`?(B(),ke(Egt,{key:5,"book-id":p.value,currency:A.value,version:q(N),"fiscal-year-end":M.value,"opening-date":w.value,onSelectAccount:ae},null,8,[`book-id`,`currency`,`version`,`fiscal-year-end`,`opening-date`])):d.value===`settings`?(B(),ke(a_t,{key:6,"book-id":p.value,"book-name":k.value,currency:A.value,country:j.value,"fiscal-year-end":M.value,onDeleted:W,onBooksChanged:F},null,8,[`book-id`,`book-name`,`currency`,`country`,`fiscal-year-end`])):b(``,!0)],64)):b(``,!0):(B(),U(`p`,w_t,T(q(t)(`pluginAccounting.noBook`)),1)):(B(),U(`div`,y_t,[n[3]||=S(`span`,{class:`material-icons text-gray-400`,style:{"font-size":`48px`}},`delete_outline`,-1),S(`p`,b_t,T(q(t)(`pluginAccounting.deletedNotice.title`,{bookName:E.value})),1),S(`p`,x_t,T(q(t)(`pluginAccounting.deletedNotice.body`)),1)]))])],64))]))}}),kL=e=>typeof e==`string`?e:void 0,E_t=e=>typeof e==`number`?e:void 0;function D_t(e,t){let n=kL(e.error);return n===void 0?null:t(`pluginAccounting.previewError`,{error:n})}function O_t(e,t){let[n]=a9e(e.entries)?e.entries:[],r=nP(n)?n:void 0,i=kL(r?.id),a=kL(r?.date);return!i||!a?null:t(`pluginAccounting.preview.entry`,{date:a})}function k_t(e,t){let{profitLoss:n}=e;if(!nP(n))return null;let r=E_t(n.netIncome);return r===void 0?null:t(`pluginAccounting.preview.pl`,{from:kL(n.from)??`?`,to:kL(n.to)??`?`,net:k9e(r)})}function A_t(e,t){let{balanceSheet:n}=e;if(!nP(n))return null;let r=kL(n.asOf),i=a9e(n.sections)?n.sections:void 0;if(!r||!i)return null;let a=i.find(e=>nP(e)&&e.type===`asset`);return t(`pluginAccounting.preview.bs`,{date:r,assets:nP(a)?k9e(E_t(a.total)??0):`?`})}function j_t(e,t){let{book:n}=e;if(!nP(n))return null;let r=kL(n.id),i=kL(n.name);return!r||!i?null:t(`pluginAccounting.preview.bookCreated`,{name:i,id:r})}function M_t(e,t){let{account:n}=e;if(!nP(n))return null;let r=kL(n.code),i=kL(n.name);return!r||!i?null:t(`pluginAccounting.preview.accountSaved`,{code:r,name:i})}function N_t(e,t){let{reverseEntry:n}=e;if(!nP(n))return null;let r=kL(n.date);return r?t(`pluginAccounting.preview.entryVoided`,{date:r}):null}function P_t(e,t){let{openingEntry:n}=e;if(!nP(n))return null;let r=kL(n.date);return r?t(e.replacedExisting===!0?`pluginAccounting.preview.openingReplaced`:`pluginAccounting.preview.openingSet`,{date:r}):null}function F_t(e,t){let n=kL(e.bookId);return n===void 0?t(`pluginAccounting.previewGeneric`):t(`pluginAccounting.previewSummary`,{bookId:n})}var I_t=e=>nP(e)?e:{};function L_t(e,t){let n=I_t(e);return D_t(n,t)??O_t(n,t)??k_t(n,t)??A_t(n,t)??j_t(n,t)??M_t(n,t)??N_t(n,t)??P_t(n,t)??F_t(n,t)}var R_t={class:`text-sm text-gray-700`,"data-testid":`accounting-preview`},z_t=K({__name:`Preview`,props:{result:{}},setup(e){let{t}=xL(),n=e,r=m(()=>L_t(n.result.data,t));return(e,t)=>(B(),U(`div`,R_t,[t[0]||=S(`span`,{class:`material-icons text-base align-middle mr-1`},`account_balance`,-1),S(`span`,null,T(r.value),1)]))}});M();var{subscribe:B_t}=QN();Zut({apiCall:fN,subscribe:B_t,localeTag:()=>q(GI.global.locale)}),o(),M();var V_t=Ae(()=>Xe(()=>Promise.resolve().then(()=>fvt),void 0)),AL=x(new Map);function H_t(e){return AL.get(e)??null}function U_t(){return Array.from(AL.keys())}function W_t(e){if(document.querySelector(`link[data-runtime-plugin-css="${e}"]`))return;let t=document.createElement(`link`);t.rel=`stylesheet`,t.href=e,t.dataset.runtimePluginCss=e,document.head.appendChild(t)}function G_t(e){return{toolDefinition:{type:`function`,name:e.toolName,description:e.description,parameters:{type:`object`,properties:{},required:[]}}}}async function K_t(e){AL.set(e.toolName,G_t(e));let t=`${e.assetBase}/dist/vue.js`,n;try{n=(await fetch(t,{method:`HEAD`})).status}catch(t){console.warn(`[runtime-plugin] HEAD probe failed for ${e.name}@${e.version}`,t);return}if(n===404)return;if(n!==200){console.warn(`[runtime-plugin] unexpected HEAD status ${n} for ${e.name}@${e.version}`);return}let r;try{r=await Xe(()=>import(t),[])}catch(t){console.warn(`[runtime-plugin] dynamic import failed (asset reachable): ${e.name}@${e.version}`,t);return}let i=r.plugin??r.default?.plugin;if(!i?.toolDefinition){console.warn(`[runtime-plugin] plugin export missing toolDefinition: ${e.name}`);return}W_t(`${e.assetBase}/dist/style.css`),AL.set(e.toolName,{toolDefinition:i.toolDefinition,viewComponent:q_t(i.viewComponent,e.name),previewComponent:q_t(i.previewComponent,e.name)})}function q_t(e,t){if(e)return z(K({name:`RuntimePluginScope:${t}`,inheritAttrs:!1,setup(n,{attrs:r,slots:i}){return()=>ve(V_t,{pkgName:t},()=>ve(e,r,i))}}))}async function J_t(){let e=await pN(SP.plugins.runtimeList);if(!e.ok){console.warn(`[runtime-plugin] list fetch failed: ${e.error}`);return}let t=e.data.plugins;t.length!==0&&await Promise.allSettled(t.map(K_t))}var Y_t={type:`function`,name:pP.toolName,prompt:`When the user asks to open / view their books, or to record, look up, or summarise journal entries / balances / opening balances, use manageAccounting. Use action='openBook' (with the target bookId) to switch the canvas to a specific existing book; use the specific action (addEntries / getReport / etc.) for narrowly-scoped operations the user asked about by name. On a fresh workspace call 'createBook' (always pass \`country\` so tax-registration advice is country-aware) — the accounting view picks up the new book automatically (no follow-up 'openBook' needed for this id). Use 'updateBook' to change a book's name or country (currency cannot be changed). Reach for 'openBook' only when switching to a different existing book. For cross-period charts and dashboards ("chart my quarterly revenue over the last two years", "show net income month-over-month for this fiscal year", "plot the cash balance by month") use action='getTimeSeries' — it returns one chart-ready point per bucket in a single round-trip; do NOT loop over 'getReport' to assemble a series yourself.`,description:`Manage a double-entry accounting book stored in the workspace file system. Supports multiple books (entities), opening balances for adoption from existing books, journal entries, voiding (append-only — corrections are reversing pairs), and balance-sheet / profit-loss / ledger reports. Action='openBook' mounts the full accounting UI in the canvas (requires bookId); 'getTimeSeries' returns chart-ready (label, value)[] series for revenue / expense / netIncome / accountBalance over time; specific actions return compact results that render inline.`,parameters:{type:`object`,properties:{action:{type:`string`,enum:Object.values(tP),description:`Operation to perform. 'openBook' mounts the full UI for a specific book; others perform a single read or write. Use 'openBook' when the user wants to browse / interact, and a specific action when the user named the operation.`},bookId:{type:`string`,description:`Target book id. Required for every action that reads or writes book data, including 'openBook'; call 'getBooks' first to enumerate available ids. The only actions that do NOT take a bookId are 'getBooks' and 'createBook' (which creates a fresh one).`},name:{type:`string`,description:`For 'createBook' / 'updateBook': human-readable book name.`},currency:{type:`string`,description:`For 'createBook': ISO 4217 currency code (default USD). Single-currency per book — cannot be changed once set.`},country:{type:`string`,enum:[...cP,``],description:`For 'createBook' / 'updateBook': ISO 3166-1 alpha-2 country code identifying the tax jurisdiction. Drives country-aware advice — e.g. when set to 'JP', strongly suggest the supplier's T-number (適格請求書発行事業者登録番号) on tax-related lines under インボイス制度. Only the codes listed in the enum are accepted; pass an empty string to 'updateBook' to clear the field.`},fiscalYearEnd:{type:`integer`,minimum:Math.min(...iP),maximum:Math.max(...iP),description:`For 'createBook' / 'updateBook': the calendar month (1-12) on whose LAST DAY this book's fiscal year closes — e.g. 3 = March 31, 8 = August 31, 12 = December 31 (calendar year, the default). Any month is allowed. Drives the date-range shortcuts in the UI ('current quarter', 'current year', etc.). Pure metadata: changing it does not move existing entries.`},initialTab:{type:`string`,description:`For 'openBook': initial tab to show (e.g. 'journal', 'opening', 'balanceSheet').`},confirm:{type:`boolean`,description:`For 'deleteBook': must be true to actually delete (guard against accidental deletion).`},account:{type:`object`,description:`For 'upsertAccount': the account to insert or update (matched by code).`,properties:{code:{type:`string`},name:{type:`string`},type:{type:`string`,enum:[`asset`,`liability`,`equity`,`income`,`expense`]},note:{type:`string`},active:{type:`boolean`,description:"Soft-delete flag. `false` deactivates the account (hides it from entry / ledger dropdowns while keeping it visible in Manage Accounts and historical entries — accounting integrity requires that a code referenced by a journal line never disappears). `true` reactivates a previously-deactivated account. Omit to preserve the existing state — handy when updating name / type / note without touching the active flag."}},required:[`code`,`name`,`type`]},entries:{type:`array`,description:`For 'addEntries': one or more journal entries to post atomically (all-or-nothing — if any entry fails validation, the whole batch is rejected and nothing is written). Use a single-element array to post one entry. Each entry has its own date, lines, optional memo, and optional replacesEntryId.`,items:{type:`object`,properties:{date:{type:`string`,description:`YYYY-MM-DD booking date.`},lines:{type:`array`,description:`Journal lines for this entry. Each line sets exactly one of debit or credit (positive amount). Σ debit must equal Σ credit.`,items:{type:`object`,properties:{accountCode:{type:`string`},debit:{type:`number`},credit:{type:`number`},memo:{type:`string`},taxRegistrationId:{type:`string`,description:`Optional counterparty tax-authority registration ID for this line (Japan T-number, EU VAT ID, UK VAT registration number, India GSTIN, Australia ABN, etc.). Free-form string, max 32 chars. Required for input-tax-credit eligibility under regimes like Japan's インボイス制度.`}},required:[`accountCode`]}},memo:{type:`string`,description:`Optional entry-level memo.`},replacesEntryId:{type:`string`,description:`Optional — id of an entry this one replaces (the 'edit' flow). The caller MUST issue a 'voidEntry' for that id immediately before this addEntries call; the void + post pair is not atomic on the server.`}},required:[`date`,`lines`]}},lines:{type:`array`,description:`For 'setOpeningBalances': journal lines. Each line sets exactly one of debit or credit (positive amount). Σ debit must equal Σ credit. Only balance-sheet accounts (asset / liability / equity) are accepted.`,items:{type:`object`,properties:{accountCode:{type:`string`},debit:{type:`number`},credit:{type:`number`},memo:{type:`string`},taxRegistrationId:{type:`string`}},required:[`accountCode`]}},memo:{type:`string`,description:`For 'setOpeningBalances': optional entry-level memo.`},entryId:{type:`string`,description:`For 'voidEntry': id of the entry to void. The reverse + marker pair is appended (journal stays append-only).`},reason:{type:`string`,description:`For 'voidEntry': human-readable reason.`},voidDate:{type:`string`,description:`For 'voidEntry': YYYY-MM-DD date for the reverse entry (defaults to today).`},from:{type:`string`,description:`For 'getJournalEntries': inclusive YYYY-MM-DD lower bound on entry date. For 'getTimeSeries': inclusive YYYY-MM-DD lower bound — the first bucket is the one CONTAINING this date (it can extend earlier).`},to:{type:`string`,description:`For 'getJournalEntries': inclusive YYYY-MM-DD upper bound on entry date. For 'getTimeSeries': inclusive YYYY-MM-DD upper bound — the last bucket is the one CONTAINING this date (it can extend later).`},accountCode:{type:`string`,description:`For 'getJournalEntries' / 'getReport' (kind=ledger): filter to entries that touch a specific account code. For 'getTimeSeries' with metric='accountBalance': REQUIRED — the account whose closing balance to plot per bucket. Forbidden for the other metrics.`},metric:{type:`string`,enum:[...N9e],description:"For 'getTimeSeries': what to plot per bucket. 'revenue' = sum of income-account presentation values within the bucket (positive = money earned). 'expense' = sum of expense accounts within the bucket (positive = money spent). 'netIncome' = revenue − expense (positive = profit). 'accountBalance' = closing balance of `accountCode` at the end of each bucket (cumulative, includes opening balances)."},granularity:{type:`string`,enum:[...P9e],description:`For 'getTimeSeries': bucket size. 'month' uses calendar months (label format YYYY-MM). 'quarter' and 'year' honour the book's fiscalYearEnd — for a December year-end book (12) they coincide with calendar quarters / years; any other closing month shifts them accordingly. Quarter labels are 'FY{endYear}-Q{1..4}', year labels are 'FY{endYear}'; the FY is named by its END calendar year (e.g. an FY running Apr 2025 – Mar 2026 is FY2026).`},asOfDate:{type:`string`,description:`For 'setOpeningBalances': YYYY-MM-DD date the balances are stated as-of. Must be on or before any existing entry.`},kind:{type:`string`,enum:[`balance`,`pl`,`ledger`],description:`For 'getReport': which report. 'balance' = balance sheet; 'pl' = profit & loss; 'ledger' = per-account running balance.`},period:{type:`object`,description:`For 'getReport': either a single closing month or a date range.`,properties:{kind:{type:`string`,enum:[`month`,`range`]},period:{type:`string`,description:`For kind='month': YYYY-MM.`},from:{type:`string`},to:{type:`string`}},required:[`kind`]}},required:[`action`]}};o();function X_t(e,t){return`plugin:${e}:${t}`}function Z_t(e,t){return n=>{let r;try{r=e(n)}catch{return}r!==null&&t&&t(r)}}function Q_t(e){let{subscribe:t}=QN();function n(n,r,i){let a=X_t(e,n);return typeof r==`function`?t(a,r):t(a,Z_t(r.parse,i))}return{subscribe:n}}function $_t(e){let t=`[plugin/${e}]`;return{debug:(e,n)=>console.debug(t,e,n),info:(e,n)=>console.info(t,e,n),warn:(e,n)=>console.warn(t,e,n),error:(e,n)=>console.error(t,e,n)}}var evt=new Set([`http:`,`https:`]);function tvt(e){return t=>{let n;try{n=new URL(t)}catch{console.warn(`[plugin/${e}] openUrl rejected unparseable URL`,{url:t});return}if(!evt.has(n.protocol)){console.warn(`[plugin/${e}] openUrl rejected non-http(s) scheme`,{scheme:n.protocol});return}window.open(t,`_blank`,`noopener,noreferrer`)||console.warn(`[plugin/${e}] window.open returned null`,{url:t})}}function nvt(e){let t=SP.plugins.runtimeDispatch.replace(`:pkg`,encodeURIComponent(e));async function n(n,r){let i=await mN(t,n);if(!i.ok)throw Error(`plugin/${e} dispatch failed (${i.status}): ${i.error}`);return r?r(i.data):i.data}return n}function rvt(e){let{pkgName:t,endpoints:n}=e,{locale:r}=We(),i=m({get:()=>String(r.value),set:e=>{WI(e)&&(r.value=e)}});return{pubsub:Q_t(t),locale:i,log:$_t(t),openUrl:tvt(t),dispatch:nvt(t),...n===void 0?{}:{endpoints:n}}}o(),M();function ivt(e){let t=V(null),n=V(!1),r=V(0),i=m(()=>{if(!t.value)return``;let e=t.value.message||String(t.value),n=t.value.stack??``;return n?`${e}\n\n${n}`:e});function a(n){let r=cr(n);console.error(`[plugin/${e}] uncaught error`,r),t.value=r}function o(){t.value=null,n.value=!1,r.value+=1}return{error:t,showDetails:n,mountKey:r,errorDetails:i,captureError:a,retry:o}}o(),M(),we();var avt={key:0,class:`rounded border border-red-200 bg-red-50 p-3 text-sm`,"data-testid":`plugin-error-boundary`,role:`alert`},ovt={class:`flex items-center gap-2 mb-1`},svt={class:`font-medium text-red-800`},cvt={class:`text-red-700 mb-2`},lvt={class:`flex items-center gap-3`},uvt={key:0,class:`mt-2 text-xs text-red-900 bg-red-100 p-2 rounded overflow-auto max-h-40 whitespace-pre-wrap break-words`},dvt=K({__name:`PluginScopedRoot`,props:{pkgName:{},endpoints:{}},setup(e){let t=e,{t:n}=We(),r=rvt({pkgName:t.pkgName,endpoints:t.endpoints});C(Ye,r);let{error:i,showDetails:a,mountKey:o,errorDetails:s,captureError:c,retry:l}=ivt(t.pkgName);return w(e=>(c(e),!1)),(t,r)=>q(i)?(B(),U(`div`,avt,[S(`div`,ovt,[r[2]||=S(`span`,{class:`material-icons text-red-500`,"aria-hidden":`true`},`error_outline`,-1),S(`span`,svt,T(q(n)(`pluginErrorBoundary.title`,{pkg:e.pkgName})),1)]),S(`p`,cvt,T(q(n)(`pluginErrorBoundary.subtitle`)),1),S(`div`,lvt,[S(`button`,{type:`button`,class:`text-xs text-red-600 hover:underline`,"data-testid":`plugin-error-toggle-details`,onClick:r[0]||=e=>a.value=!q(a)},T(q(a)?q(n)(`pluginErrorBoundary.hideDetails`):q(n)(`pluginErrorBoundary.showDetails`)),1),S(`button`,{type:`button`,class:`text-xs text-red-600 hover:underline`,"data-testid":`plugin-error-retry`,onClick:r[1]||=(...e)=>q(l)&&q(l)(...e)},T(q(n)(`pluginErrorBoundary.retry`)),1)]),q(a)?(B(),U(`pre`,uvt,T(q(s)),1)):b(``,!0)])):ne(t.$slots,`default`,{key:q(o)})}}),fvt=y({default:()=>jL}),jL=dvt,ML=null;function pvt(e){ML=e}function NL(){if(ML===null)throw Error(`Plugin host context not installed. Call installHostContext(...) at app boot before mounting any plugin component.`);return ML}function PL(e){let{endpoints:t}=NL(),n=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(!n)throw Error(`Unknown plugin endpoint scope: "${e}"`);return n}function FL(){return NL().builtinRoleIds}function mvt(e){let{pageRoutes:t}=NL(),n=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(!n)throw Error(`Unknown page route: "${e}"`);return n}function hvt(){return NL().chatModels}o(),M();function IL(e,t){return t&&z(K({name:`BuiltInPluginScope:${e}`,inheritAttrs:!1,setup(n,{attrs:r,slots:i}){let a=PL(e);return()=>ve(jL,{pkgName:e,endpoints:a},()=>ve(t,r,i))}}))}function LL(){return crypto.randomUUID()}var gvt={toolDefinition:Y_t,async execute(e,t){let n=Y_t.name,{method:r,path:i}=pP.apiRoutes.dispatch,a=await fN(`/api/${pP.apiNamespace}${i}`,{method:r,body:t});return a.ok?{...a.data,toolName:n,uuid:a.data.uuid??LL()}:{toolName:n,uuid:LL(),message:a.error}},isEnabled:()=>!0,generatingMessage:`Working on the books...`,viewComponent:IL(`accounting`,T_t),previewComponent:IL(`accounting`,z_t)},_vt={toolName:pP.toolName,entry:gvt},RL=F9e.toolName,vvt={type:`function`,name:RL,description:`Open a drawing canvas for the user to create drawings, sketches, or diagrams.`,prompt:`When the user asks 'I want to draw an image.', call ${RL} API to open the canvas.`,parameters:{type:`object`,properties:{},required:[]}};async function yvt(e,t,n){let r=await fN(e.url,{method:e.method,body:n});return r.ok?{...r.data,toolName:t,uuid:LL()}:{toolName:t,uuid:LL(),message:r.error}}function bvt(e,t,n){if(e===void 0)throw Error(`Plugin endpoint "${n}" is not registered for scope "${t}"`);return e}function zL(e,t,n){return async(r,i)=>{let a=PL(e)[t];return yvt(bvt(a,e,t),n,i)}}function xvt(e,t,n){return async(r,i)=>{let a=PL(e)[t];return yvt({method:`POST`,url:bvt(a,e,t)},n,i)}}var Svt=K({name:`VueDrawingCanvas`,props:{strokeType:{type:String,validator:e=>[`dash`,`line`,`square`,`circle`,`triangle`,`half_triangle`].indexOf(e)!==-1,default:()=>`dash`},fillShape:{type:Boolean,default:()=>!1},width:{type:[String,Number],default:()=>600},height:{type:[String,Number],default:()=>400},image:{type:String,default:()=>``},eraser:{type:Boolean,default:()=>!1},color:{type:String,default:()=>`#000000`},lineWidth:{type:Number,default:()=>5},lineCap:{type:String,validator:e=>[`round`,`square`,`butt`].indexOf(e)!==-1,default:()=>`round`},lineJoin:{type:String,validator:e=>[`miter`,`round`,`bevel`].indexOf(e)!==-1,default:()=>`miter`},lock:{type:Boolean,default:()=>!1},styles:{type:[Array,String,Object]},classes:{type:[Array,String,Object]},backgroundColor:{type:String,default:()=>`#FFFFFF`},backgroundImage:{type:String,default:()=>null},watermark:{type:Object,default:()=>null},saveAs:{type:String,validator:e=>[`jpeg`,`png`].indexOf(e)!==-1,default:()=>`png`},canvasId:{type:String,default:()=>`VueDrawingCanvas`},initialImage:{type:Array,default:()=>[]},additionalImages:{type:Array,default:()=>[]},outputWidth:{type:Number},outputHeight:{type:Number}},data(){return{loadedImage:null,drawing:!1,context:null,images:[],strokes:{type:``,from:{x:0,y:0},coordinates:[],color:``,width:``,fill:!1,lineCap:``,lineJoin:``},guides:[],trash:[]}},mounted(){this.setContext(),this.$nextTick(()=>{this.drawInitialImage(),this.drawAdditionalImages()})},watch:{backgroundImage:function(){this.loadedImage=null}},methods:{async setContext(){let e=document.querySelector(`#`+this.canvasId);this.context=this.context?this.context:e.getContext(`2d`),await this.setBackground()},drawInitialImage(){this.initialImage&&this.initialImage.length>0&&(this.images=[].concat(this.images,this.initialImage),this.redraw(!0))},drawAdditionalImages(){if(this.additionalImages&&this.additionalImages.length>0){let e=document.querySelector(`#`+this.canvasId);this.additionalImages.forEach(t=>{this.drawWatermark(e,this.context,t)})}},clear(){this.context.clearRect(0,0,Number(this.width),Number(this.height))},async setBackground(){this.clear(),this.context.fillStyle=this.backgroundColor,this.context.fillRect(0,0,Number(this.width),Number(this.height)),await this.$nextTick(async()=>{await this.drawBackgroundImage()}),this.save()},async drawBackgroundImage(){if(this.loadedImage)this.context.drawImage(this.loadedImage,0,0,Number(this.width),Number(this.height));else return new Promise(e=>{if(!this.backgroundImage){e();return}let t=new Image;t.src=this.backgroundImage,t.onload=()=>{this.context.drawImage(t,0,0,Number(this.width),Number(this.height)),this.loadedImage=t,e()}})},getCoordinates(e){let t,n;if(e.touches&&e.touches.length>0){let r=document.querySelector(`#`+this.canvasId).getBoundingClientRect();t=e.touches[0].clientX-r.left,n=e.touches[0].clientY-r.top}else t=e.offsetX,n=e.offsetY;return{x:t,y:n}},startDraw(e){if(!this.lock){this.drawing=!0;let t=this.getCoordinates(e);this.strokes={type:this.eraser?`eraser`:this.strokeType,from:t,coordinates:[],color:this.eraser?this.backgroundColor:this.color,width:this.lineWidth,fill:this.eraser||this.strokeType===`dash`||this.strokeType===`line`?!1:this.fillShape,lineCap:this.lineCap,lineJoin:this.lineJoin},this.guides=[]}},draw(e){if(this.drawing){this.context||this.setContext();let t=this.getCoordinates(e);if(this.eraser||this.strokeType===`dash`)this.strokes.coordinates.push(t),this.drawShape(this.context,this.strokes,!1);else{switch(this.strokeType){case`line`:this.guides=[{x:t.x,y:t.y}];break;case`square`:this.guides=[{x:t.x,y:this.strokes.from.y},{x:t.x,y:t.y},{x:this.strokes.from.x,y:t.y},{x:this.strokes.from.x,y:this.strokes.from.y}];break;case`triangle`:let e=Math.floor((t.x-this.strokes.from.x)/2)<0?Math.floor((t.x-this.strokes.from.x)/2)*-1:Math.floor((t.x-this.strokes.from.x)/2),n=this.strokes.from.x<t.x?this.strokes.from.x+e:this.strokes.from.x-e;this.guides=[{x:t.x,y:this.strokes.from.y},{x:n,y:t.y},{x:this.strokes.from.x,y:this.strokes.from.y}];break;case`half_triangle`:this.guides=[{x:t.x,y:this.strokes.from.y},{x:this.strokes.from.x,y:t.y},{x:this.strokes.from.x,y:this.strokes.from.y}];break;case`circle`:let r=this.strokes.from.x-t.x<0?(this.strokes.from.x-t.x)*-1:this.strokes.from.x-t.x;this.guides=[{x:this.strokes.from.x>t.x?this.strokes.from.x-r:this.strokes.from.x+r,y:this.strokes.from.y},{x:r,y:r}]}this.drawGuide(!0)}}},drawGuide(e){this.redraw(!0),this.$nextTick(()=>{this.context.strokeStyle=this.color,this.context.lineWidth=1,this.context.lineJoin=this.lineJoin,this.context.lineCap=this.lineCap,this.context.beginPath(),this.context.setLineDash([15,15]),this.strokes.type===`circle`?this.context.ellipse(this.guides[0].x,this.guides[0].y,this.guides[1].x,this.guides[1].y,0,0,Math.PI*2):(this.context.moveTo(this.strokes.from.x,this.strokes.from.y),this.guides.forEach(e=>{this.context.lineTo(e.x,e.y)}),e&&this.context.closePath()),this.context.stroke()})},drawShape(e,t,n){e.strokeStyle=t.color,e.fillStyle=t.color,e.lineWidth=t.width,e.lineJoin=t.lineJoin===void 0?this.lineJoin:t.lineJoin,e.lineCap=t.lineCap===void 0?this.lineCap:t.lineCap,e.beginPath(),e.setLineDash([]),t.type===`circle`?e.ellipse(t.coordinates[0].x,t.coordinates[0].y,t.coordinates[1].x,t.coordinates[1].y,0,0,Math.PI*2):(e.moveTo(t.from.x,t.from.y),t.coordinates.forEach(t=>{e.lineTo(t.x,t.y)}),n&&e.closePath()),t.fill?e.fill():e.stroke()},stopDraw(){this.drawing&&(this.strokes.coordinates=this.guides.length>0?this.guides:this.strokes.coordinates,this.images.push(this.strokes),this.redraw(!0),this.drawing=!1,this.trash=[])},reset(){this.lock||(this.images=[],this.strokes={type:``,coordinates:[],color:``,width:``,fill:!1,lineCap:``,lineJoin:``},this.guides=[],this.trash=[],this.redraw(!0))},undo(){if(!this.lock){let e=this.images.pop();e&&(this.trash.push(e),this.redraw(!0))}},redo(){if(!this.lock){let e=this.trash.pop();e&&(this.images.push(e),this.redraw(!0))}},async redraw(e){e=e===void 0||e,await this.setBackground().then(()=>{this.drawAdditionalImages()}).then(()=>{let e=document.createElement(`canvas`),t=e.getContext(`2d`);e.width=Number(this.width),e.height=Number(this.height),t&&(this.images.forEach(e=>{t&&(t.globalCompositeOperation=e.type===`eraser`?`destination-out`:`source-over`,(e.type!==`circle`||e.type===`circle`&&e.coordinates.length>0)&&this.drawShape(t,e,e.type!==`eraser`&&e.type!==`dash`&&e.type!==`line`))}),this.context.drawImage(e,0,0,Number(this.width),Number(this.height)))}).then(()=>{e&&this.save()})},wrapText(e,t,n,r,i,a){let o=/(\r\n|\n\r|\n|\r)+/g,s=/\s+/g;var c=t.split(o).filter(e=>e.length>0);for(let t=0;t<c.length;t++){for(var l=c[t].split(s).filter(e=>e.length>0),u=``,d=0;d<l.length;d++){var f=u+l[d]+` `;e.measureText(f).width>i&&d>0?(this.watermark&&this.watermark.fontStyle&&this.watermark.fontStyle.drawType&&this.watermark.fontStyle.drawType===`stroke`?e.strokeText(u,n,r):e.fillText(u,n,r),u=l[d]+` `,r+=a):u=f}this.watermark&&this.watermark.fontStyle&&this.watermark.fontStyle.drawType&&this.watermark.fontStyle.drawType===`stroke`?e.strokeText(u,n,r):e.fillText(u,n,r),r+=l.length>0?a:0}},save(){let e=document.querySelector(`#`+this.canvasId);if(this.watermark){let t=document.createElement(`canvas`),n=t.getContext(`2d`);n&&(t.width=Number(this.width),t.height=Number(this.height),n.drawImage(e,0,0,Number(this.width),Number(this.height)),this.drawWatermark(t,n,this.watermark))}else{let t=document.createElement(`canvas`),n=t.getContext(`2d`),r=this.outputWidth===void 0?this.width:this.outputWidth,i=this.outputHeight===void 0?this.height:this.outputHeight;if(t.width=Number(r),t.height=Number(i),n)return n.drawImage(e,0,0,Number(r),Number(i)),this.$emit(`update:image`,t.toDataURL(`image/`+this.saveAs,1)),t.toDataURL(`image/`+this.saveAs,1)}},drawWatermark(e,t,n){if(n.type===`Image`){let r=n.imageStyle&&n.imageStyle.width?n.imageStyle.width:Number(this.width),i=n.imageStyle&&n.imageStyle.height?n.imageStyle.height:Number(this.height),a=new Image;a.src=n.source,a.onload=()=>{n&&t&&t.drawImage(a,n.x,n.y,Number(r),Number(i));let o=document.createElement(`canvas`),s=o.getContext(`2d`),c=this.outputWidth===void 0?this.width:this.outputWidth,l=this.outputHeight===void 0?this.height:this.outputHeight;if(o.width=Number(c),o.height=Number(l),s)return s.drawImage(e,0,0,Number(c),Number(l)),this.$emit(`update:image`,o.toDataURL(`image/`+this.saveAs,1)),o.toDataURL(`image/`+this.saveAs,1)}}else if(n.type===`Text`){let r=n.fontStyle&&n.fontStyle.font?n.fontStyle.font:`20px serif`,i=n.fontStyle&&n.fontStyle.textAlign?n.fontStyle.textAlign:`start`,a=n.fontStyle&&n.fontStyle.textBaseline?n.fontStyle.textBaseline:`alphabetic`,o=n.fontStyle&&n.fontStyle.color?n.fontStyle.color:`#000000`;if(t.font=r,t.textAlign=i,t.textBaseline=a,n.fontStyle&&n.fontStyle.rotate){let e,r;e=n.fontStyle&&n.fontStyle.width?n.x+Math.floor(n.fontStyle.width/2):n.x,r=n.fontStyle&&n.fontStyle.lineHeight?n.y+Math.floor(n.fontStyle.lineHeight/2):n.y,t.translate(e,r),t.rotate(n.fontStyle.rotate*Math.PI/180),t.translate(e*-1,r*-1)}n.fontStyle&&n.fontStyle.drawType&&n.fontStyle.drawType===`stroke`?(t.strokeStyle=n.fontStyle.color,n.fontStyle&&n.fontStyle.width?this.wrapText(t,n.source,n.x,n.y,n.fontStyle.width,n.fontStyle.lineHeight):t.strokeText(n.source,n.x,n.y)):(t.fillStyle=o,n.fontStyle&&n.fontStyle.width?this.wrapText(t,n.source,n.x,n.y,n.fontStyle.width,n.fontStyle.lineHeight):t.fillText(n.source,n.x,n.y));let s=document.createElement(`canvas`),c=s.getContext(`2d`),l=this.outputWidth===void 0?this.width:this.outputWidth,u=this.outputHeight===void 0?this.height:this.outputHeight;if(s.width=Number(l),s.height=Number(u),c)return c.drawImage(e,0,0,Number(l),Number(u)),this.$emit(`update:image`,s.toDataURL(`image/`+this.saveAs,1)),s.toDataURL(`image/`+this.saveAs,1)}},isEmpty(){return!(this.images.length>0)},getAllStrokes(){return this.images}},render(){return ve(`canvas`,{id:this.canvasId,height:Number(this.height),width:Number(this.width),style:{touchAction:`none`,...this.styles},class:this.classes,onMousedown:e=>this.startDraw(e),onMousemove:e=>this.draw(e),onMouseup:()=>this.stopDraw(),onMouseleave:()=>this.stopDraw(),onTouchstart:e=>this.startDraw(e),onTouchmove:e=>this.draw(e),onTouchend:()=>this.stopDraw(),onTouchleave:()=>this.stopDraw(),onTouchcancel:()=>this.stopDraw(),onPointerdown:e=>this.startDraw(e),onPointermove:e=>this.draw(e),onPointerup:()=>this.stopDraw(),onPointerleave:()=>this.stopDraw(),onPointercancel:()=>this.stopDraw()})}}),Cvt=16,wvt=9,Tvt=(e,t)=>{let n=Math.floor(e-32),r=Math.floor(n*wvt/Cvt);if(n<=0||r<=0)return{size:null,changed:!1,isFirstPaint:!1};let i=n!==t.width||r!==t.height;return{size:{width:n,height:r},changed:i,isFirstPaint:t.width===0}},Evt=(e,t)=>`vdc-${(e??`default`).replace(/[^A-Za-z0-9_-]/g,`-`)}-${t}`;o(),we(),le(),M();var Dvt={class:`w-full h-full flex flex-col bg-white`},Ovt={class:`flex-shrink-0 px-4 py-2 border-b border-gray-100 bg-gray-50`},kvt={class:`flex items-center justify-between gap-4`},Avt={class:`flex items-center gap-4`},jvt={class:`flex items-center gap-2`},Mvt={class:`flex gap-1`},Nvt=[`onClick`],Pvt={class:`flex items-center gap-2`},Fvt={class:`flex items-center gap-1`},Ivt={key:0,class:`text-xs text-red-600 bg-red-50 border border-red-200 rounded px-2 py-1 mr-1`,role:`alert`,"data-testid":`canvas-save-failed`},Lvt=[`title`],Rvt=[`title`],zvt=[`title`],Bvt={class:`flex items-center gap-2 flex-wrap mt-3`},Vvt={class:`text-xs text-gray-500 mr-1`},Hvt=[`onClick`],Uvt=K({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},setup(e){let t=PL(`imageStore`),{t:n}=We(),i=e,a=[{id:`ghibli`,label:`Ghibli`},{id:`ukiyoe`,label:`Ukiyoe`},{id:`sumie`,label:`Sumi-e`},{id:`picasso`,label:`Picasso`},{id:`gogh`,label:`Van Gogh`},{id:`photo`,label:`Photo-realistic`},{id:`watercolor`,label:`Watercolor`},{id:`popart`,label:`Pop Art`},{id:`american`,label:`American Comic`},{id:`cyberpunk`,label:`Cyberpunk`},{id:`pencilsketch`,label:`Pencil Sketch`},{id:`pixelart`,label:`Pixel Art`}],o=V(null),s=V(null),l=V(5),d=V(`#000000`),f=V(0),p=V(0),h=V(0),g=m(()=>Evt(i.selectedResult?.uuid,h.value)),v=V(!1),y=m(()=>{let e=i.selectedResult?.data?.imageData;return!e||e.startsWith(`data:`)?``:e}),x=e=>{let t=y.value,r=t?n(`pluginCanvas.stylePromptWithPath`,{path:t,style:e.label}):n(`pluginCanvas.stylePromptNoPath`,{style:e.label});i.sendTextMessage?.(r)},C=Date.now(),w=m(()=>{if(!y.value)return;let e=tL(y.value);return`${e}${e.includes(`?`)?`&`:`?`}mt=${C}-${h.value}`}),E=!1,O=!1;async function k(e){let n=await hN(t.update,{relativePath:y.value,imageData:e});if(!n.ok)throw Error(`PUT failed: ${n.error}`);Zlt(y.value)}async function A(){if(o.value&&y.value){if(E){O=!0;return}E=!0;try{await k(await o.value.save()),v.value=!1}catch(e){console.error(`Failed to save drawing:`,e),v.value=!0}finally{E=!1,O&&(O=!1,A())}}}let j=()=>{o.value?.undo(),setTimeout(A,50)},M=()=>{o.value?.redo(),setTimeout(A,50)},N=async()=>{if(o.value?.reset(),!y.value)return;let e=document.createElement(`canvas`);e.width=f.value,e.height=p.value;let t=e.getContext(`2d`);if(t){t.fillStyle=`#FFFFFF`,t.fillRect(0,0,e.width,e.height);try{await k(e.toDataURL(`image/png`)),v.value=!1,h.value++}catch(e){console.error(`Failed to clear drawing:`,e),v.value=!0}}},F=()=>{let e=s.value;if(!e)return;let{size:t,changed:n,isFirstPaint:r}=Tvt(e.getBoundingClientRect().width,{width:f.value,height:p.value});t&&n&&(f.value=t.width,p.value=t.height,r||h.value++)};return P(async()=>{await be(),F(),window.addEventListener(`resize`,F)}),_(()=>{window.removeEventListener(`resize`,F)}),(t,i)=>(B(),U(`div`,Dvt,[S(`div`,Ovt,[S(`div`,kvt,[S(`div`,Avt,[S(`div`,jvt,[S(`div`,Mvt,[(B(),U(D,null,H([2,5,10,20],e=>S(`button`,{key:e,class:c([`w-8 h-8 rounded border-2 transition-colors`,l.value===e?`border-blue-500 bg-blue-100`:`border-gray-300 bg-white hover:bg-gray-50`]),onClick:t=>l.value=e},[S(`div`,{class:`bg-gray-800 rounded-full mx-auto`,style:xe({width:Math.max(2,e*1)+`px`,height:Math.max(2,e*1)+`px`})},null,4)],10,Nvt)),64))])]),S(`div`,Pvt,[u(S(`input`,{"onUpdate:modelValue":i[0]||=e=>d.value=e,type:`color`,class:`w-12 h-8 rounded border border-gray-300`},null,512),[[Fe,d.value]])])]),S(`div`,Fvt,[v.value?(B(),U(`span`,Ivt,T(q(n)(`pluginCanvas.saveFailed`)),1)):b(``,!0),S(`button`,{class:`w-8 h-8 flex items-center justify-center rounded border-2 border-gray-300 bg-white hover:bg-gray-50`,title:q(n)(`pluginCanvas.undo`),onClick:j},[...i[1]||=[S(`span`,{class:`material-icons text-sm`},`undo`,-1)]],8,Lvt),S(`button`,{class:`w-8 h-8 flex items-center justify-center rounded border-2 border-gray-300 bg-white hover:bg-gray-50`,title:q(n)(`pluginCanvas.redo`),onClick:M},[...i[2]||=[S(`span`,{class:`material-icons text-sm`},`redo`,-1)]],8,Rvt),S(`button`,{class:`w-8 h-8 flex items-center justify-center rounded border-2 border-red-300 bg-white hover:bg-red-50`,title:q(n)(`pluginCanvas.clear`),onClick:N},[...i[3]||=[S(`span`,{class:`material-icons text-sm`},`delete`,-1)]],8,zvt)])])]),S(`div`,{ref_key:`containerRef`,ref:s,class:`flex-1 p-4 overflow-hidden`},[f.value>0?(B(),ke(q(Svt),r({ref_key:`canvasRef`,ref:o,key:`${e.selectedResult?.uuid||`default`}-${h.value}`,"canvas-id":g.value,width:f.value,height:p.value,"stroke-type":`dash`,"line-cap":`round`,"line-join":`round`,"fill-shape":!1,eraser:!1,"line-width":l.value,color:d.value,"background-color":`#FFFFFF`},w.value===void 0?{}:{backgroundImage:w.value},{"save-as":`png`,styles:{border:`1px solid #ddd`,borderRadius:`8px`},lock:!1,onMouseup:A,onMouseleave:A,onTouchend:A,onTouchcancel:A}),null,16,[`canvas-id`,`width`,`height`,`line-width`,`color`])):b(``,!0),S(`div`,Bvt,[S(`span`,Vvt,T(q(n)(`pluginCanvas.styleLabel`)),1),(B(),U(D,null,H(a,e=>S(`button`,{key:e.id,class:`px-3 py-1.5 text-xs rounded-full border border-gray-300 bg-white hover:bg-blue-50 hover:border-blue-400 transition-colors`,onClick:t=>x(e)},T(e.label),9,Hvt)),64))])],512)]))}});o(),M(),we();var Wvt={class:`w-full h-full overflow-y-auto`},Gvt={class:`min-h-full flex flex-col items-center justify-center p-4`},Kvt={key:0,class:`flex-1 flex items-center justify-center min-h-0`},qvt=[`src`,`alt`],Jvt={key:1,class:`flex-1 flex items-center justify-center text-gray-400 text-sm`},Yvt={key:2,class:`mt-4 p-3 bg-gray-100 rounded-lg max-w-full flex-shrink-0`},Xvt={class:`text-sm text-gray-700`},Zvt={class:`font-medium`},Qvt=K({__name:`ImageView`,props:{selectedResult:{},alt:{default:`Image`},promptLabel:{default:`Prompt`}},setup(e){let{t}=We(),n=e,r=m(()=>n.selectedResult.data?.imageData?tut(n.selectedResult.data.imageData):``);return(n,i)=>(B(),U(`div`,Wvt,[S(`div`,Gvt,[r.value?(B(),U(`div`,Kvt,[S(`img`,{src:r.value,class:`max-w-full max-h-full object-contain rounded`,alt:e.alt},null,8,qvt)])):(B(),U(`div`,Jvt,T(q(t)(`common.noImageYet`)),1)),e.selectedResult.data?.prompt?(B(),U(`div`,Yvt,[S(`p`,Xvt,[S(`span`,Zvt,T(q(t)(`pluginUiImage.promptLabel`,{label:e.promptLabel})),1),J(` `+T(e.selectedResult.data.prompt),1)])])):b(``,!0)])]))}});o(),M(),we();var $vt={class:`min-h-24 flex items-center justify-center`},eyt=[`src`,`alt`],tyt={key:1,class:`text-gray-400 text-sm`},BL=K({__name:`ImagePreview`,props:{result:{},alt:{default:`Image`}},setup(e){let{t}=We(),n=e,r=m(()=>n.result.data?.imageData?tut(n.result.data.imageData):``);return(n,i)=>(B(),U(`div`,$vt,[r.value?(B(),U(`img`,{key:0,src:r.value,class:`max-w-full h-auto rounded`,alt:e.alt},null,8,eyt)):(B(),U(`div`,tyt,T(q(t)(`common.noImageYet`)),1))]))}});o(),M();var nyt=K({__name:`Preview`,props:{result:{}},setup(e){return(t,n)=>(B(),ke(q(BL),{result:e.result,alt:`Canvas drawing`},null,8,[`result`]))}}),ryt={toolName:RL,entry:{toolDefinition:vvt,execute:zL(`canvas`,`dispatch`,RL),isEnabled:()=>!0,generatingMessage:`Opening drawing canvas...`,viewComponent:IL(`canvas`,Uvt),previewComponent:IL(`canvas`,nyt)}},iyt=120;function ayt(e,t){if(!e)return t;let n=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`),r=0,i=n.length;for(;r<i&&n[r]===`-`;)r+=1;for(;i>r&&n[i-1]===`-`;)--i;for(i-r>iyt&&(i=r+iyt);i>r&&n[i-1]===`-`;)--i;return n.slice(r,i)||t}function oyt(e=new Date){return`${e.getUTCFullYear()}/${String(e.getUTCMonth()+1).padStart(2,`0`)}`}function VL(e){let{dir:t,title:n,ext:r,fallback:i,now:a=new Date,partitioned:o=!0,suffix:s}=e,c=s?`${a.getTime()}-${s}`:`${a.getTime()}`,l=`${ayt(n,i)}-${c}${r}`;return(o?[t,oyt(a),l]:[t,l]).join(`/`)}function HL(e){return`${Ke}/${e}`}function UL(e){return e.split(/[/\\]/).some(e=>e===``||e===`.`||e===`..`)}var syt=/^[a-zA-Z]:[\\/]/;function cyt(e){return e.startsWith(`/`)||e.startsWith(`\\`)||syt.test(e)}function WL(e,t){if(!e||e.includes(`\0`))return null;let n=e.toLowerCase();if(!t.some(e=>n.endsWith(e)))return null;let r=cyt(e),i=e.split(/[/\\]/),a=r?i.slice(i.findIndex(e=>e.length>0)):i;return a.length===0||a.some(e=>e===``||e===`.`||e===`..`)?null:r?`absolute`:`relative`}function lyt(e){return e.split(/[/\\]/).some(e=>e.startsWith(`.`))}var uyt={type:`function`,name:`presentChart`,description:"Save and present one or more Apache ECharts visualizations as a single document. Use this for line, bar, area, scatter, pie, candlestick, heatmap, sankey, or graph/network charts — anything ECharts supports. Pass ECharts option object(s) directly; the plugin calls setOption on each one. Use `charts: []` array form even for a single chart so multi-chart dashboards share the same slug.",parameters:{type:`object`,properties:{document:{type:`object`,description:`Chart document. Contains an optional title and an array of chart entries. Each entry has its own ECharts option object that the UI renders independently.`,properties:{title:{type:`string`,description:`Optional human-friendly title for the whole document. Used to derive the file slug and as the preview label.`},charts:{type:`array`,description:`List of charts to render, in order. Each charts[i].option is passed as-is to ECharts' setOption().`,items:{type:`object`,properties:{title:{type:`string`,description:`Optional short label for this specific chart (shown above it in the UI).`},type:{type:`string`,description:`Informational tag shown in the UI (e.g. 'line', 'bar', 'candlestick', 'sankey'). The actual chart type is determined by option.series[].type.`},option:{type:`object`,description:`Full ECharts option object. Include all series, axes, tooltip, legend, dataset — anything ECharts accepts. Keep data inline; large datasets are fine.`}},required:[`option`]}}},required:[`charts`]},title:{type:`string`,description:`Short label shown in the canvas preview sidebar. Defaults to document.title, or 'Chart' when both are blank.`}},required:[`document`]}},dyt=`charts`,fyt=`chart`;function pyt(e,t=new Date){let n=VL({dir:dyt,title:e,ext:`.chart.json`,fallback:fyt,now:t});return{relPath:n,filePath:HL(n)}}function GL(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function KL(e){return e===void 0||typeof e==`string`}function myt(e){return!GL(e)||!KL(e.title)||!KL(e.type)?!1:GL(e.option)}function hyt(e){return!GL(e)||!KL(e.title)||!Array.isArray(e.charts)||e.charts.length===0?!1:e.charts.every(e=>myt(e))}var gyt={toolDefinition:uyt,execute:async(e,t)=>{if(!GL(t))return{message:"presentChart args must be an object containing a `document`",instructions:`Acknowledge the error and retry with { document: { charts: [{ option: {...} }] } }.`};let{document:n,title:r}=t;if(!hyt(n))return{message:`document must be { charts: [{ option: {...}, title?, type? }, ...] } with at least one entry`,instructions:`Acknowledge that the chart could not be created and retry with a valid ECharts document shape.`};if(r!==void 0&&typeof r!=`string`)return{message:`title must be a string when provided`,instructions:`Acknowledge the error and retry with a string title (or omit it).`};let{relPath:i,filePath:a}=pyt(r??n.title??`chart`);await e.files.artifacts.write(i,`${JSON.stringify(n,null,2)}\n`);let o=n.charts.length;return{message:`Saved chart document to ${a}`,data:{document:n,title:r,filePath:a},instructions:`Acknowledge that the chart(s) have been presented to the user. The document contains ${o} chart${o===1?``:`s`}.`}},generatingMessage:`Rendering chart…`,isEnabled:()=>!0};o(),M(),we();var _yt=Je({de:{untitled:`Diagramm`,chartCount:e=>`${e} Diagramm${e===1?``:`e`}`,chartTitle:e=>`Diagramm ${e}`,png:`PNG`},en:{untitled:`Chart`,chartCount:e=>`${e} chart${e===1?``:`s`}`,chartTitle:e=>`Chart ${e}`,png:`PNG`},es:{untitled:`Gráfico`,chartCount:e=>`${e} gráfico${e===1?``:`s`}`,chartTitle:e=>`Gráfico ${e}`,png:`PNG`},fr:{untitled:`Graphique`,chartCount:e=>`${e} graphique${e===1?``:`s`}`,chartTitle:e=>`Graphique ${e}`,png:`PNG`},ja:{untitled:`チャート`,chartCount:e=>`${e} チャート`,chartTitle:e=>`チャート ${e}`,png:`PNG`},ko:{untitled:`차트`,chartCount:e=>`${e}개 차트`,chartTitle:e=>`차트 ${e}`,png:`PNG`},"pt-BR":{untitled:`Gráfico`,chartCount:e=>`${e} gráfico${e===1?``:`s`}`,chartTitle:e=>`Gráfico ${e}`,png:`PNG`},zh:{untitled:`图表`,chartCount:e=>`${e} 个图表`,chartTitle:e=>`图表 ${e}`,png:`PNG`}}),vyt={class:`h-full flex flex-col overflow-hidden`},yyt={class:`px-4 py-2 border-b border-gray-100 shrink-0 flex items-center justify-between`},byt={class:`text-sm font-medium text-gray-700 truncate`},xyt={class:`text-xs text-gray-500 shrink-0`},Syt={class:`flex-1 overflow-y-auto p-4 space-y-4`},Cyt=[`data-testid`],wyt={class:`px-3 py-2 border-b border-gray-100 flex items-center justify-between gap-2`},Tyt={class:`flex items-center gap-2 min-w-0`},Eyt={class:`text-sm font-medium text-gray-800 truncate`},Dyt={key:0,class:`text-[10px] uppercase tracking-wide rounded px-1.5 py-0.5 bg-blue-50 text-blue-700 shrink-0`},Oyt=[`data-testid`,`onClick`],kyt=[`data-testid`],Ayt=K({__name:`View`,props:{selectedResult:{}},setup(e){let t=_yt(),n=e,r=m(()=>n.selectedResult.data),i=m(()=>r.value?.document?.charts??[]),a=m(()=>r.value?.title??r.value?.document?.title),o=V([]),s=[];function c(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function l(e,t){o.value[e]=t}function u(){for(let e of s)e?.dispose();s.length=0}function d(e){let{dataZoom:t}=e;if(t==null)return e;let n=e=>c(e)?{...e,zoomOnMouseWheel:!1,moveOnMouseWheel:!1}:e,r=Array.isArray(t)?t.map(n):n(t);return{...e,dataZoom:r}}function f(){u();for(let e=0;e<i.value.length;e+=1){let t=o.value[e],n=i.value[e];if(!t||!n){s[e]=void 0;continue}let r=$S(t);try{r.setOption(d(n.option))}catch{}s[e]=r}}function p(){for(let e of s)e?.resize()}P(()=>{queueMicrotask(f),window.addEventListener(`resize`,p)}),k(()=>{window.removeEventListener(`resize`,p),u()}),Ve(()=>r.value?.filePath,()=>queueMicrotask(f));function h(e,t){let n=s[e];if(!n)return;let r=n.getDataURL({type:`png`,pixelRatio:2,backgroundColor:`#ffffff`}),i=(t??a.value??`chart`).toLowerCase().replace(/[^a-z0-9-]+/g,`-`);for(;i.startsWith(`-`);)i=i.slice(1);for(;i.endsWith(`-`);)i=i.slice(0,-1);i||=`chart`;let o=document.createElement(`a`);o.href=r,o.download=`${i}-${e+1}.png`,document.body.appendChild(o),o.click(),document.body.removeChild(o)}return(e,n)=>(B(),U(`div`,vyt,[S(`div`,yyt,[S(`span`,byt,T(a.value??q(t).untitled),1),S(`span`,xyt,T(q(t).chartCount(i.value.length)),1)]),S(`div`,Syt,[(B(!0),U(D,null,H(i.value,(e,r)=>(B(),U(`div`,{key:r,class:`border border-gray-200 rounded-lg bg-white`,"data-testid":`chart-card-${r}`},[S(`div`,wyt,[S(`div`,Tyt,[S(`span`,Eyt,T(e.title??q(t).chartTitle(r+1)),1),e.type?(B(),U(`span`,Dyt,T(e.type),1)):b(``,!0)]),S(`button`,{class:`px-2 py-1 text-xs rounded border border-gray-300 text-gray-500 hover:bg-gray-50 shrink-0`,"data-testid":`chart-export-png-${r}`,onClick:t=>h(r,e.title)},[n[0]||=S(`span`,{class:`material-icons text-sm align-middle`},`download`,-1),J(` `+T(q(t).png),1)],8,Oyt)]),S(`div`,{ref_for:!0,ref:e=>l(r,e),class:`w-full h-[400px]`,"data-testid":`chart-canvas-${r}`},null,8,kyt)],8,Cyt))),128))])]))}}),jyt={class:`p-2 text-sm`},Myt={class:`font-medium text-gray-700 truncate mb-1`},Nyt={key:0,class:`text-xs text-gray-500 leading-relaxed truncate`},Pyt=K({__name:`Preview`,props:{result:{}},setup(e){let t=e,n=m(()=>t.result.data),r=m(()=>n.value?.title??n.value?.document?.title??`Chart`),i=m(()=>{let e=n.value?.document?.charts??[];if(e.length===0)return``;let t=e.map(e=>e.type??a(e.option)).filter(e=>!!e).slice(0,3),r=e.length>t.length?`, …`:``,i=t.join(`, `),o=e.length===1?``:`s`,s=i?`: ${i}${r}`:``;return`${e.length} chart${o}${s}`});function a(e){let{series:t}=e;if(Array.isArray(t)&&t.length>0){let e=t[0];if(typeof e.type==`string`)return e.type}else if(t&&typeof t==`object`){let e=t.type;if(typeof e==`string`)return e}return null}return(e,t)=>(B(),U(`div`,jyt,[S(`div`,Myt,T(r.value),1),i.value?(B(),U(`div`,Nyt,T(i.value),1)):b(``,!0)]))}});({...gyt});var Fyt=I9e.toolName,Iyt={toolName:Fyt,entry:{toolDefinition:uyt,execute:zL(`chart`,`create`,Fyt),isEnabled:()=>!0,generatingMessage:`Rendering chart…`,viewComponent:IL(`chart`,Ayt),previewComponent:IL(`chart`,Pyt)}},qL=`editImages`,Lyt={type:`function`,name:qL,description:`Edit one or more existing images based on a text prompt. Returns a single new image.`,prompt:`When the user asks to transform or restyle an existing image (e.g. "turn this into a Ghibli-style image", "combine these two photos"), call ${qL} with the workspace-relative paths of the source images in \`imagePaths\` and the edit instructions in \`prompt\`. Use a single-element array for one image; pass two or more paths to combine multiple images.`,parameters:{type:`object`,properties:{prompt:{type:`string`,description:`Description of the edits to be made to the image(s) in English`},imagePaths:{type:`array`,items:{type:`string`},description:`Workspace-relative paths of the source images to edit (e.g. ["artifacts/images/2026/04/abc.png"]). Pass at least one path. Multiple paths are combined into a single result image.`}},required:[`prompt`,`imagePaths`]}},Ryt=`The image service answered with an unrecognized response.`,zyt=e=>Ma(e)&&typeof e.imageData==`string`&&e.imageData.length>0&&Ia(e.prompt),Byt=e=>Ma(e)&&typeof e.message==`string`&&Ia(e.toolName)&&Ia(e.uuid)&&Ia(e.title)&&Ia(e.action)&&Ia(e.instructions)&&La(e.instructionsRequired)&&La(e.updating)&&La(e.cancelled)&&e.jsonData===void 0&&(e.data===void 0||zyt(e.data))&&(e.viewState===void 0||Ma(e.viewState));function Vyt(e,t){let n=xvt(`image`,e,t);return async(e,r)=>{let i=await n(e,r);return Byt(i)?i:{toolName:t,uuid:LL(),message:Ryt}}}o(),M();var Hyt=K({__name:`View`,props:{selectedResult:{}},setup(e){return(t,n)=>e.selectedResult?(B(),ke(q(Qvt),{key:0,"selected-result":e.selectedResult,alt:`Edited image`,"prompt-label":`Edit prompt`},null,8,[`selected-result`])):b(``,!0)}});o(),M();var Uyt=K({__name:`Preview`,props:{result:{}},setup(e){return(t,n)=>(B(),ke(q(BL),{result:e.result,alt:`Edited image`},null,8,[`result`]))}}),Wyt={toolName:qL,entry:{toolDefinition:Lyt,execute:Vyt(`edit`,qL),isEnabled:()=>!0,generatingMessage:`Editing images...`,viewComponent:IL(`image`,Hyt),previewComponent:IL(`image`,Uyt)}},JL=`generateImage`,Gyt={type:`function`,name:JL,description:`Generate an image based on the prompt and display it on the screen. Be descriptive and specify the concrete details of the images in the prompt. Each call generates one image.`,prompt:`When the user asks you to generate, draw, or create an image, use the ${JL} API. You may also offer to generate an image when a visual would clearly enhance the conversation, but do not generate images unsolicited during casual discussion.`,parameters:{type:`object`,properties:{prompt:{type:`string`,description:`A detailed prompt describing the image to generate`}},required:[`prompt`]}};o(),M();var Kyt={"data-testid":`generate-image-view`,class:`w-full h-full`},qyt=K({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},emits:[`updateResult`],setup(e){let t=e,n=V(null);return Ve(()=>t.selectedResult,e=>{e?.toolName===`generateImage`&&e.data&&(n.value=e)},{immediate:!0}),(e,t)=>(B(),U(`div`,Kyt,[n.value?(B(),ke(q(Qvt),{key:0,"selected-result":n.value},null,8,[`selected-result`])):b(``,!0)]))}});o(),M();var Jyt=K({__name:`Preview`,props:{result:{}},setup(e){return(t,n)=>(B(),ke(q(BL),{result:e.result},null,8,[`result`]))}});function Yyt(e,t,n){return{toolName:JL,data:{imageData:e,prompt:n},message:``,title:t}}var Xyt={toolName:JL,entry:{toolDefinition:Gyt,execute:Vyt(`generate`,JL),isEnabled:()=>!0,generatingMessage:`Generating image...`,inputHandlers:[{type:`file`,acceptedTypes:[`image/png`,`image/jpeg`],handleInput:(e,t)=>Yyt(e,t,``)},{type:`clipboard-image`,handleInput:e=>Yyt(e,`clipboard-image.png`,``)}],viewComponent:IL(`image`,qyt),previewComponent:IL(`image`,Jyt)}},YL=z9e.toolName,Zyt={type:`function`,name:YL,description:`List, save, update, or delete Claude Code skills. Discovery covers ~/.claude/skills/ (user), <workspace>/.claude/skills/ (project) and the skills of installed Claude Code plugins, which are listed as <plugin>:<skill>. Only the project scope is writable, so save, update, and delete affect only those; everything else is read-only.`,prompt:`Use the ${YL} tool for the user's skill library:\n\n- **list** (default, no args): show every available skill in the canvas.\n- **save**: when the user asks to turn the current conversation into a skill (e.g. "skill 化して" / "save this as a skill"), do these steps:\n 1. Read the current chat transcript via the Read tool. The path is \`conversations/chat/<session-id>.jsonl\` under the workspace; if you don't know the session id, list \`conversations/chat/\` first.\n 2. Distill the conversation into a short markdown body explaining the steps you took, in second person ("First, do X. Then, do Y."). Keep it focused on the reusable workflow, not the one-off details.\n 3. Pick a kebab-case slug (lowercase letters, digits, hyphens; no leading/trailing hyphen; 1-64 chars). If the user gave a name in the request, use it.\n 4. Write a one-line description for the YAML frontmatter.\n 5. Call ${YL} with \`{action: "save", name, description, body}\`. Saves go to <workspace>/.claude/skills/<slug>/SKILL.md.\n 6. If the response says the name already exists, ask the user for a different one.\n- **update**: when the user asks to modify an existing skill (e.g. "〇〇のスキルを更新して" / "change the description of X"), call \`{action: "update", name, description, body}\`. Only project-scope skills can be updated; user-scope and plugin skills are read-only. You must provide both description and body (read the current skill first via list or the Read tool if you only need to change part of it).\n- **delete**: when the user asks to remove a named skill, call \`{action: "delete", name}\`. Only project-scope skills can be deleted; user-scope and plugin skills are protected.\n\n**IMPORTANT**: NEVER edit SKILL.md files directly with the Edit or Write tools. Always use this ${YL} tool with the appropriate action. Direct file edits bypass validation and won't refresh the skills UI.`,parameters:{type:`object`,properties:{action:{type:`string`,enum:[`list`,`save`,`update`,`delete`],description:`The operation to perform. Default: list (show all skills).`},name:{type:`string`,description:`Skill slug. Required for save and delete. Lowercase letters, digits, and hyphens only; 1-64 chars; no leading/trailing or consecutive hyphens.`},description:{type:`string`,description:`One-line summary for the YAML frontmatter. Required for save.`},body:{type:`string`,description:`Markdown body of the skill (instructions for Claude to follow). Required for save. May be multi-line.`}},required:[`action`]}};function Qyt(e){return e.source===`claude-plugin`?`claude-plugin`:e.source===`user`?`user`:e.name.startsWith(`mc-`)?`system`:`project`}function $yt(e,t){let n=+(e.source===`claude-plugin`),r=+(t.source===`claude-plugin`);return n===r?e.name.localeCompare(t.name):n-r}var ebt=[`active`,`catalog`],tbt=[],nbt=`skills:sectionCollapsed`;function rbt(e){return typeof e==`string`&&ebt.some(t=>t===e)}function ibt(){let e=new Set(tbt);if(typeof window>`u`)return e;try{let t=window.localStorage.getItem(nbt);if(t===null)return e;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(rbt)):e}catch{return e}}function abt(e){if(typeof window<`u`)try{window.localStorage.setItem(nbt,JSON.stringify([...e]))}catch{}}function obt(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}var sbt=`skills:repoCollapsed`;function cbt(){if(typeof window>`u`)return new Set;try{let e=window.localStorage.getItem(sbt);if(e===null)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function lbt(e){if(typeof window<`u`)try{window.localStorage.setItem(sbt,JSON.stringify([...e]))}catch{}}function XL(e,t){if(t.has(`active`))return null;let[n]=e;return n?.name??null}function ubt(e,t,n,r){if(n!==t)return n;if(r.has(`active`))return null;let i=e.findIndex(e=>e.name===t),a=e.filter(e=>e.name!==t);return i===-1||a.length===0?null:a[Math.min(i,a.length-1)]?.name??null}function ZL(e){return e.source===`external`&&e.repoId&&e.skillFolder?`${e.repoId}/${e.skillFolder}`:e.slug}function dbt(e){return e.source===`external`&&e.repoId&&e.skillFolder?{source:`external`,repoId:e.repoId,skillFolder:e.skillFolder}:{source:e.source,slug:e.slug}}function fbt(e,t){let n={url:e},r=t?.trim();return r&&(n.subpath=r),n}function pbt(e,t){return t.map(t=>({repo:t,entries:e.filter(e=>e.repoId===t.repoId).sort((e,t)=>e.slug.localeCompare(t.slug))}))}var mbt=/github\.com\/([^/]+\/[^/]+?)(?:\.git)?\/?$/;function hbt(e){return mbt.exec(e.url)?.[1]??e.repoId}function gbt(e){let t=Qyt(e);return t===`system`?{icon:`lock`,colour:`text-gray-500`,titleKey:`pluginManageSkills.sourceSystemTitle`}:t===`user`?{icon:`home`,colour:`text-blue-500`,titleKey:`pluginManageSkills.sourceUserTitle`}:t===`claude-plugin`?{icon:`extension`,colour:`text-purple-500`,titleKey:`pluginManageSkills.sourceClaudePluginTitle`}:{icon:`folder`,colour:`text-green-600`,titleKey:`pluginManageSkills.sourceProjectTitle`}}var QL={icon:`inventory_2`,colour:`text-gray-400`,titleKey:`pluginManageSkills.sourcePresetTitle`};function _bt(e,t){return e?t.some(t=>t.slug===e&&t.source===`preset`):!1}var vbt=(e,t,n)=>e.map(e=>e.name===t?{...e,description:n}:e),ybt=(e,t)=>e.filter(e=>e.name!==t),bbt=(e,t)=>e===null?{acquired:!0,key:t}:{acquired:!1,key:e},xbt=(e,t)=>e===t?null:e;o(),M();async function Sbt(e){let t=await pN(e.endpoints.catalogList.url);if(!t.ok){e.catalogError.value=e.t(`pluginManageSkills.errCatalogListFailed`,{error:t.error});return}e.catalogError.value=null,Array.isArray(t.data.entries)&&(e.catalogPresets.value=t.data.entries.filter(e=>e.source===`preset`),e.catalogExternal.value=t.data.entries.filter(e=>e.source===`external`))}async function Cbt(e,t){let n=await pN(e.endpoints.catalogPreview.url,dbt(t));return n.ok?(e.catalogError.value=null,n.data.detail):(e.catalogError.value=e.t(`pluginManageSkills.errCatalogPreviewFailed`,{error:n.error}),null)}function wbt(e,t){let{selectedCatalog:n}=e;if(!n.value||ZL(n.value)!==ZL(t))return;let r=(t.source===`external`?e.catalogExternal.value:e.catalogPresets.value).find(e=>ZL(e)===ZL(t));r&&(n.value=r)}async function Tbt(e,t){if(t.alreadyActive)return;let n=ZL(t),{acquired:r,key:i}=bbt(e.catalogActioningKey.value,n);if(r){e.catalogActioningKey.value=i;try{let n=await mN(e.endpoints.catalogStar.url,dbt(t));if(!n.ok){e.catalogError.value=e.t(`pluginManageSkills.errCatalogStarFailed`,{error:n.error});return}e.catalogError.value=null,await Promise.all([Sbt(e),e.deps.refreshActiveList()]),wbt(e,t)}finally{e.catalogActioningKey.value=xbt(e.catalogActioningKey.value,n)}}}async function Ebt(e,t){e.deps.clearActiveSelection(),e.selectedCatalog.value=t,e.catalogDetail.value=null,e.catalogDetailLoading.value=!0;let n=ZL(t),r=await Cbt(e,t);e.selectedCatalog.value&&ZL(e.selectedCatalog.value)===n&&(e.catalogDetailLoading.value=!1,r!==null&&(e.catalogDetail.value=r))}function $L(e){e.selectedCatalog.value=null,e.catalogDetail.value=null}function Dbt(e,t){e.selectedCatalog.value?.repoId===t&&$L(e)}function Obt(e,t){if(e.selectedCatalog.value?.slug!==t)return;let n=e.catalogPresets.value.find(e=>e.slug===t);n&&(e.selectedCatalog.value=n)}function kbt(e){$L(e),e.catalogDetailLoading.value=!1,e.catalogActioningKey.value=null,e.catalogError.value=null}function Abt(){return{catalogPresets:V([]),catalogExternal:V([]),catalogError:V(null),selectedCatalog:V(null),catalogDetail:V(null),catalogDetailLoading:V(!1),catalogActioningKey:V(null)}}function jbt(e){let{t}=We(),n=PL(`skills`),r=Abt(),i=m(()=>r.selectedCatalog.value?ZL(r.selectedCatalog.value):null),a={t,endpoints:n,deps:e,...r};return{...r,selectedCatalogKey:i,loadCatalog:()=>Sbt(a),selectCatalogEntry:e=>Ebt(a,e),starCatalogEntry:e=>Tbt(a,e),clearSelection:()=>$L(a),clearSelectionIfRepo:e=>Dbt(a,e),reconcileAfterDelete:e=>Obt(a,e),reset:()=>kbt(a)}}o(),M();function Mbt(e,t){return!e.repoCollapsed.value.has(t)}function Nbt(e,t){let n=obt(e.repoCollapsed.value,t);e.repoCollapsed.value=n,lbt(n)}async function eR(e){let t=await pN(e.endpoints.externalReposList.url);if(!t.ok){e.repoListError.value=e.t(`pluginManageSkills.errCatalogRepoListFailed`,{error:t.error});return}e.repoListError.value=null,Array.isArray(t.data.repos)&&(e.catalogRepos.value=t.data.repos)}async function Pbt(e){let t=await pN(e.endpoints.externalSuggestions.url);t.ok&&Array.isArray(t.data.suggestions)&&(e.suggestions.value=t.data.suggestions)}function Fbt(e){e.addRepoUrl.value=``,e.addRepoSubpath.value=``,e.addRepoError.value=null,e.selectedSuggestionUrl.value=null,e.addRepoOpen.value=!0,e.suggestions.value.length===0&&Pbt(e)}function Ibt(e,t){e.addRepoUrl.value=t.url,e.addRepoSubpath.value=t.subpath??``,e.addRepoError.value=null,e.selectedSuggestionUrl.value=t.url}async function Lbt(e,t,n){if(e.addRepoBusy.value)return;let r=t.trim();if(r.length===0){e.addRepoError.value=e.t(`pluginManageSkills.errCatalogRepoInvalidUrl`);return}e.addRepoBusy.value=!0,e.addRepoError.value=null;try{let t=await mN(e.endpoints.externalReposInstall.url,fbt(r,n));if(!t.ok){e.addRepoError.value=e.t(`pluginManageSkills.errCatalogRepoInstallFailed`,{error:t.error});return}e.addRepoOpen.value=!1,await Promise.all([eR(e),e.deps.reloadCatalog()])}finally{e.addRepoBusy.value=!1}}async function Rbt(e,t){if(e.uninstallingRepoId.value===null&&e.updatingRepoId.value!==t&&(typeof window>`u`||window.confirm(e.t(`pluginManageSkills.catalogUninstallConfirm`)))){e.uninstallingRepoId.value=t;try{let n=await gN(eP(e.endpoints.externalReposRemove,{repoId:t}));if(!n.ok){e.deps.catalogError.value=e.t(`pluginManageSkills.errCatalogRepoUninstallFailed`,{error:n.error});return}e.deps.catalogError.value=null,e.deps.clearCatalogSelectionForRepo(t),await Promise.all([eR(e),e.deps.reloadCatalog(),e.deps.refreshActiveList()])}finally{e.uninstallingRepoId.value=null}}}async function zbt(e,t){if(e.updatingRepoId.value===null&&e.uninstallingRepoId.value!==t.repoId){e.updatingRepoId.value=t.repoId;try{let n=await mN(e.endpoints.externalReposInstall.url,fbt(t.url,t.subpath));if(!n.ok){e.deps.catalogError.value=e.t(`pluginManageSkills.errCatalogRepoInstallFailed`,{error:n.error});return}e.deps.catalogError.value=null,await Promise.all([eR(e),e.deps.reloadCatalog()])}finally{e.updatingRepoId.value=null}}}function Bbt(e){e.addRepoOpen.value=!1,e.addRepoError.value=null,e.selectedSuggestionUrl.value=null,e.uninstallingRepoId.value=null,e.updatingRepoId.value=null}function Vbt(){return{catalogRepos:V([]),repoListError:V(null),repoCollapsed:t(cbt()),addRepoOpen:V(!1),addRepoUrl:V(``),addRepoSubpath:V(``),addRepoError:V(null),addRepoBusy:V(!1),suggestions:V([]),selectedSuggestionUrl:V(null),uninstallingRepoId:V(null),updatingRepoId:V(null)}}function Hbt(e){let{t}=We(),n=PL(`skills`),r=Vbt(),i={t,endpoints:n,deps:e,...r},a=m(()=>pbt(e.catalogExternal.value,r.catalogRepos.value));return{...r,externalGroups:a,isRepoOpen:e=>Mbt(i,e),toggleRepo:e=>Nbt(i,e),loadExternalRepos:()=>eR(i),openAddRepo:()=>Fbt(i),selectSuggestion:e=>Ibt(i,e),installRepo:(e,t)=>Lbt(i,e,t),uninstallRepo:e=>Rbt(i,e),updateRepo:e=>zbt(i,e),resetModalState:()=>Bbt(i)}}o(),M(),we(),le();var Ubt={class:`bg-white rounded-lg shadow-xl w-full max-w-md p-5`},Wbt={class:`text-base font-semibold text-gray-800 mb-3`},Gbt={class:`block text-xs font-medium text-gray-600 mb-1`},Kbt=[`placeholder`],qbt={class:`block text-xs font-medium text-gray-600 mb-1`},Jbt=[`placeholder`],Ybt={key:0,class:`text-xs text-red-600 mb-3`,"data-testid":`skill-add-repo-error`},Xbt={class:`flex items-center justify-end gap-2 mb-4`},Zbt=[`disabled`],Qbt={key:1},$bt={class:`text-xs font-medium text-gray-600 mb-2`},ext={class:`flex items-start`},txt=[`data-testid`,`aria-pressed`,`onClick`],nxt={class:`font-medium text-gray-700`},rxt=[`href`,`data-testid`,`title`,`aria-label`],ixt=K({__name:`AddRepoModal`,props:Se({error:{},busy:{type:Boolean},suggestions:{},selectedSuggestionUrl:{}},{url:{required:!0},urlModifiers:{},subpath:{required:!0},subpathModifiers:{}}),emits:Se([`close`,`install`,`select-suggestion`],[`update:url`,`update:subpath`]),setup(e,{emit:t}){let{t:n}=We(),r=G(e,`url`),i=G(e,`subpath`),a=t;return(t,o)=>(B(),U(`div`,{class:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4`,"data-testid":`skill-add-repo-modal`,onClick:o[7]||=s(e=>a(`close`),[`self`])},[S(`div`,Ubt,[S(`h3`,Wbt,T(q(n)(`pluginManageSkills.catalogAddRepoTitle`)),1),S(`label`,Gbt,T(q(n)(`pluginManageSkills.catalogRepoUrlLabel`)),1),u(S(`input`,{"onUpdate:modelValue":o[0]||=e=>r.value=e,type:`text`,"data-testid":`skill-add-repo-url`,class:`w-full h-8 px-2 mb-3 text-sm border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:q(n)(`pluginManageSkills.catalogRepoUrlPlaceholder`),onKeydown:o[1]||=l(e=>a(`install`),[`enter`])},null,40,Kbt),[[Fe,r.value]]),S(`label`,qbt,T(q(n)(`pluginManageSkills.catalogRepoSubpathLabel`)),1),u(S(`input`,{"onUpdate:modelValue":o[2]||=e=>i.value=e,type:`text`,"data-testid":`skill-add-repo-subpath`,class:`w-full h-8 px-2 mb-3 text-sm border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:q(n)(`pluginManageSkills.catalogRepoSubpathPlaceholder`),onKeydown:o[3]||=l(e=>a(`install`),[`enter`])},null,40,Jbt),[[Fe,i.value]]),e.error?(B(),U(`p`,Ybt,T(e.error),1)):b(``,!0),S(`div`,Xbt,[S(`button`,{type:`button`,class:`h-8 px-2.5 flex items-center text-sm rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,onClick:o[4]||=e=>a(`close`)},T(q(n)(`common.cancel`)),1),S(`button`,{type:`button`,"data-testid":`skill-add-repo-submit`,class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-40`,disabled:e.busy,onClick:o[5]||=e=>a(`install`)},T(e.busy?q(n)(`pluginManageSkills.catalogRepoInstalling`):q(n)(`pluginManageSkills.catalogAddRepoSubmit`)),9,Zbt)]),e.suggestions.length>0?(B(),U(`div`,Qbt,[S(`p`,$bt,T(q(n)(`pluginManageSkills.catalogAddRepoSuggestions`)),1),(B(!0),U(D,null,H(e.suggestions,t=>(B(),U(`div`,{key:t.url,class:c([`mb-1 rounded border`,e.selectedSuggestionUrl===t.url?`border-blue-400 bg-blue-50`:`border-gray-200`])},[S(`div`,ext,[S(`button`,{type:`button`,"data-testid":`skill-add-repo-suggestion-${t.url}`,class:`flex-1 min-w-0 text-left px-3 py-2 text-sm`,"aria-pressed":e.selectedSuggestionUrl===t.url,onClick:e=>a(`select-suggestion`,t)},[S(`div`,nxt,T(t.displayName),1),S(`div`,{class:c([`text-xs text-gray-500`,e.selectedSuggestionUrl===t.url?`whitespace-normal break-words`:`truncate`])},T(t.description),3)],8,txt),S(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`skill-add-repo-suggestion-link-${t.url}`,class:`h-8 w-8 shrink-0 flex items-center justify-center rounded text-gray-400 hover:text-blue-600`,title:q(n)(`pluginManageSkills.catalogRepoOpenLink`),"aria-label":q(n)(`pluginManageSkills.catalogRepoOpenLink`),onClick:o[6]||=s(()=>{},[`stop`])},[...o[8]||=[S(`span`,{class:`material-icons text-sm`,"aria-hidden":`true`},`open_in_new`,-1)]],8,rxt)])],2))),128))])):b(``,!0)])]))}}),axt=1,oxt=e=>e!==null&&`nodeType`in e&&e.nodeType===axt;function sxt(e,t){if(!e.startsWith(`http://`)&&!e.startsWith(`https://`))return!1;try{return new URL(e).origin!==t}catch{return!1}}function tR(e){if(e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey)return!1;let{target:t}=e;if(!oxt(t))return!1;let n=t.closest(`a`);if(!n)return!1;let r=n.href;return sxt(r,window.location.origin)?(e.preventDefault(),window.open(r,`_blank`,`noopener,noreferrer`),!0):!1}function nR(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var rR=nR();function cxt(e){rR=e}var iR={exec:()=>null};function aR(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function oR(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(sR.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var lxt=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),sR={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:aR(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:aR(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:aR(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:aR(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:aR(e=>RegExp(`^ {0,${e}}(?:</?(?:${fR})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:aR(e=>RegExp(`^ {0,${e}}>`))},uxt=/^(?:[ \t]*(?:\n|$))+/,dxt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fxt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,cR=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,pxt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,lR=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,mxt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,hxt=oR(mxt).replace(/bull/g,lR).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),gxt=oR(mxt).replace(/bull/g,lR).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),uR=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,_xt=/^[^\n]+/,dR=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,vxt=oR(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,dR).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),yxt=oR(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,lR).getRegex(),fR=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,pR=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,bxt=oR(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,pR).replace(`tag`,fR).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xxt=e=>oR(uR).replace(`hr`,cR).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,fR).getRegex(),Sxt=xxt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Cxt=xxt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),mR={blockquote:oR(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Cxt).getRegex(),code:dxt,def:vxt,fences:fxt,heading:pxt,hr:cR,html:bxt,lheading:hxt,list:yxt,newline:uxt,paragraph:Sxt,table:iR,text:_xt},wxt=oR(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,cR).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,fR).getRegex(),Txt={...mR,lheading:gxt,table:wxt,paragraph:oR(uR).replace(`hr`,cR).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,wxt).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,fR).getRegex()},Ext={...mR,html:oR(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,pR).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:iR,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:oR(uR).replace(`hr`,cR).replace(`heading`,` *#{1,6} *[^
265
265
  ]`).replace(`lheading`,hxt).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Dxt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Oxt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,kxt=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,Axt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,hR=/[\p{P}\p{S}]/u,gR=/[\s\p{P}\p{S}]/u,_R=/[^\s\p{P}\p{S}]/u,jxt=oR(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,gR).getRegex(),Mxt=/[\p{Pi}\p{Ps}"']/u,Nxt=/(?!~)[\p{P}\p{S}]/u,Pxt=/(?!~)[\s\p{P}\p{S}]/u,Fxt=/(?:[^\s\p{P}\p{S}]|~)/u,Ixt=oR(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,lxt?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Lxt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Rxt=oR(Lxt,`u`).replace(/punct/g,hR).getRegex(),zxt=oR(Lxt,`u`).replace(/punct/g,Nxt).getRegex(),Bxt=oR(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Mxt).replace(/punct/g,hR).getRegex(),Vxt=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Hxt=oR(Vxt,`gu`).replace(/notPunctSpace/g,_R).replace(/punctSpace/g,gR).replace(/punct/g,hR).getRegex(),Uxt=oR(Vxt,`gu`).replace(/notPunctSpace/g,Fxt).replace(/punctSpace/g,Pxt).replace(/punct/g,Nxt).getRegex(),Wxt=oR(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,_R).replace(/punctSpace/g,gR).replace(/punct/g,hR).getRegex(),Gxt=oR(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,_R).replace(/punctSpace/g,gR).replace(/punct/g,hR).getRegex(),Kxt=oR(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,_R).replace(/punctSpace/g,gR).replace(/punct/g,hR).getRegex(),qxt=oR(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,hR).getRegex(),Jxt=oR(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,_R).replace(/punctSpace/g,gR).replace(/punct/g,hR).getRegex(),Yxt=oR(/\\(punct)/,`gu`).replace(/punct/g,hR).getRegex(),Xxt=oR(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Zxt=oR(pR).replace(`(?:-->|$)`,`-->`).getRegex(),Qxt=oR(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Zxt).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),$xt=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,vR=oR(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,$xt).getRegex(),eSt=oR(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,vR).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),tSt=oR(/^!?\[(label)\]\[(ref)\]/).replace(`label`,vR).replace(`ref`,dR).getRegex(),nSt=oR(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,dR).getRegex(),rSt=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,iSt=oR(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,$xt).getRegex(),aSt=oR(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,oR(/^!?\[(label)\]\[(ref)\]/).replace(`label`,iSt).replace(`ref`,rSt).getRegex()).replace(`nolink`,oR(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,rSt).getRegex()).getRegex(),oSt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,sSt=oR(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),yR={_backpedal:iR,anyPunctuation:Yxt,autolink:Xxt,blockSkip:Ixt,br:kxt,code:Oxt,del:iR,delLDelim:iR,delRDelim:iR,emStrongLDelim:Rxt,emStrongRDelimAst:Hxt,emStrongRDelimUnd:Gxt,escape:Dxt,link:eSt,nolink:nSt,punctuation:jxt,reflink:tSt,reflinkSearch:aSt,tag:Qxt,text:Axt,url:iR},cSt={...yR,emStrongLDelim:Bxt,emStrongRDelimAst:Wxt,emStrongRDelimUnd:Kxt,link:oR(/^!?\[(label)\]\((.*?)\)/).replace(`label`,vR).getRegex(),reflink:oR(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,vR).getRegex()},bR={...yR,emStrongRDelimAst:Uxt,emStrongLDelim:zxt,delLDelim:qxt,delRDelim:Jxt,url:oR(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,sSt).replace(`protocol`,oSt).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:oR(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,oSt).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},lSt={...bR,br:oR(kxt).replace(`{2,}`,`*`).getRegex(),text:oR(bR.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},xR={normal:mR,gfm:Txt,pedantic:Ext},SR={normal:yR,gfm:bR,breaks:lSt,pedantic:cSt},uSt={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},dSt=e=>uSt[e];function CR(e,t){if(t){if(sR.escapeTest.test(e))return e.replace(sR.escapeReplace,dSt)}else if(sR.escapeTestNoEncode.test(e))return e.replace(sR.escapeReplaceNoEncode,dSt);return e}function fSt(e){return e.replace(sR.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function pSt(e){try{e=encodeURI(e).replace(sR.percentDecode,`%`)}catch{return null}return e}function mSt(e,t){let n=e.replace(sR.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(sR.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(sR.slashPipe,`|`);return n}function wR(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function hSt(e){let t=e.split(`
266
266
  `),n=t.length-1;for(;n>=0&&sR.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
267
267
  `)}function TR(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function gSt(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function _St(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function vSt(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function ySt(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
@@ -356,7 +356,7 @@ Aspect: \`size: 16:9\` (default 1280×720) or \`size: 4:3\` (960×720) — handl
356
356
  - \`size: WxH\` → any custom pixel canvas (e.g. \`size: 1920x1080\`)
357
357
  Themes: \`theme: default\` | \`gaia\` | \`uncover\`. Custom sizes compose on top of whichever theme is chosen.`,Iwt={type:`function`,name:RR,description:`Display a document in markdown format — either new markdown (saved) or an existing saved document (by path).`,prompt:Fwt,promptCompact:[`Use the ${RR} tool for a document that combines text with embedded images (guides, reports, tutorials, articles); prefer it over standalone image generation for informational content.`,"Provide EITHER `markdown` + `filenamePrefix` (new content, saved) OR `path` (any existing `.md`, opened in place — never read a file and re-send its content as `markdown`).",`Embed generated images as ![Detailed image prompt](__too_be_replaced_image_path__).`,`For a slide deck / presentation / スライド (Marp), image directives, sizes or themes, Read {{promptFilesDir}}/presentDocument.md first.`].join(` `),promptFiles:{"presentDocument.md":Fwt},parameters:{type:`object`,properties:{title:{type:`string`,description:`Title for the document`},markdown:{type:`string`,description:"The markdown content to display. Provide this (with `filenamePrefix`) OR `path`. Describe embedded images in the following format: ![Detailed image prompt](__too_be_replaced_image_path__). 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). Always send it with `markdown` — it is what makes the saved file findable; omitting it falls back to 'document'. Ignored with `path`. Use lowercase with hyphens, e.g. 'project-summary'. The server sanitizes the value and appends a random id to prevent collisions."},path:{type:`string`,description:"Path to an existing `.md` file to present without re-saving — workspace-relative (`README.md`, `docs/design.md`, `artifacts/documents/2026/07/report-abc123.md`) or absolute. The user's edits in the view overwrite this file. Provide this OR `markdown`."}},required:[`title`]}};async function Lwt(e,t){let{app:n}=e;if(!n)throw Error(`markdown plugin: context.app (MarkdownHostApp) was not provided by the host`);switch(t.kind){case`loadDoc`:return n.loadDoc(t.path);case`saveDoc`:return n.saveDoc(t.path,t.markdown);case`marpThemes`:return n.marpThemes();case`exportPdf`:return n.exportPdf({markdown:t.markdown,filename:t.filename,marp:t.marp,baseDir:t.baseDir,format:t.format,stripFrontmatter:t.stripFrontmatter});case`fillImages`:return n.fillImages(t.markdown);case`bookmarkPattern`:return n.bookmarkPattern?n.bookmarkPattern():{pattern:null};default:throw Error(`markdown plugin: unknown dispatch kind ${JSON.stringify(t)}`)}}var Rwt=`The document has been presented to the user in a rendered markdown view.`,BR=e=>typeof e==`string`&&e.length>0;async function zwt(e,t,n){if(!Pwt(t))return{message:"path must be a .md file path, without `.` / `..` segments",instructions:"Acknowledge the error and retry with a valid path to an existing .md file, or inline `markdown`."};try{await e.loadDoc(t)}catch(e){return{message:`Cannot open ${t}: ${e instanceof Error?e.message:String(e)}`,instructions:"Acknowledge that the document could not be opened and retry with a path that exists or inline `markdown`."}}return{message:`Presented existing document${n?`: ${n}`:``}`,data:{markdown:t,docPath:t},instructions:Rwt}}async function Bwt(e,t){let{title:n,markdown:r,filenamePrefix:i}=t,a=(await e.fillImages(r??``)).markdown,{path:o}=await e.saveNewDoc(i??`document`,a);return{message:`Document created${n?`: ${n}`:``}`,data:{markdown:o,docPath:o,filenamePrefix:i},instructions:Rwt}}async function Vwt(e,t){let{app:n}=e;if(!n)throw Error(`markdown plugin: context.app (MarkdownHostApp) was not provided by the host`);let{title:r,markdown:i,path:a}=t;return BR(a)&&BR(i)?{message:"provide either `markdown` or `path`, not both",instructions:"Acknowledge the error and retry with exactly one of `markdown` or `path`."}:BR(a)?zwt(n,a,r):BR(i)?Bwt(n,t):{message:"provide either `markdown` or `path`",instructions:"Acknowledge the error and retry with inline `markdown` or an existing `path`."}}var Hwt=new Set([`loadDoc`,`saveDoc`,`marpThemes`,`exportPdf`,`fillImages`,`bookmarkPattern`]);function Uwt(e){if(typeof e!=`object`||!e)return!1;let t=e.kind;return typeof t==`string`&&Hwt.has(t)}var Wwt={toolDefinition:Iwt,execute:async(e,t)=>{let n=e;return Uwt(t)?Lwt(n,t):Vwt(n,t)},generatingMessage:`Creating document...`,isEnabled:()=>!0};function Gwt(e){let t,n=Promise.resolve(),r=Promise.resolve(),i=()=>{};function a(t,r){let i=async()=>{if(e.isWanted(r))try{await e.write(t,r)}catch{}};n=n.then(i,i)}return{schedule(n,o){i(),clearTimeout(t),r=new Promise(e=>{i=e}),t=setTimeout(()=>{t=void 0,a(n,o),i()},e.delayMs)},cancel(){clearTimeout(t),t=void 0,i()},settled(){return r.then(()=>n)}}}var Kwt=`^\\.\\.\\.`,qwt=80;function Jwt(e){try{return new RegExp(e,`gm`)}catch{return null}}function Ywt(e,t){let n=e.lastIndexOf(`
358
358
  `,t-1)+1,r=e.indexOf(`
359
- `,t);return y5e(e.slice(n,r<0?e.length:r).trim(),qwt)}var Xwt=50;function Zwt(e,t){if(t===null||e.length===0)return[];let n=new RegExp(t.source,t.flags.includes(`g`)?t.flags:`${t.flags}g`),r=[],i=Date.now()+Xwt,a;for(;(a=n.exec(e))!==null&&(r.push({offset:a.index,fraction:a.index/e.length,label:Ywt(e,a.index)}),a.index===n.lastIndex&&(n.lastIndex+=1),!(r.length>=200||Date.now()>i)););return r}Object.freeze({min:0,max:65535});function VR(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Qwt(e,t){return VR(e)&&typeof e[t]==`string`}function $wt(e,t){return e instanceof Error?e.message:Qwt(e,`details`)&&e.details?e.details:Qwt(e,`message`)&&e.message?e.message:t===void 0?String(e):t}var HR=(e,t)=>{throw Error(`markdown plugin: dispatch returned no ${e} (got ${typeof t})`)};function eTt(e){return VR(e)&&typeof e.content==`string`?{content:e.content}:HR(`document content`,e)}function tTt(e){return!VR(e)||!Array.isArray(e.themes)?HR(`marp themes`,e):{themes:e.themes.filter(e=>VR(e)&&typeof e.name==`string`&&typeof e.css==`string`)}}function nTt(e){return VR(e)&&(typeof e.pattern==`string`||e.pattern===null)?{pattern:e.pattern}:HR(`bookmark pattern`,e)}function rTt(e){return VR(e)&&typeof e.pdfBase64==`string`?{pdfBase64:e.pdfBase64}:HR(`exported PDF`,e)}var UR=1280,iTt=200,aTt=3840;function WR(e,t){return!Number.isFinite(e)||e<iTt?t:Math.min(e,aTt)}var oTt=/div\.marpit\s*>\s*section\s*\{[^}]*?width:\s*(\d+)px[^}]*?height:\s*(\d+)px/;function sTt(e){let t=e.match(oTt);return t?{width:WR(Number(t[1]),UR),height:WR(Number(t[2]),720)}:{width:UR,height:720}}var cTt=/viewBox="0 0 (\d+) (\d+)"/;function lTt(e){let t=e.match(cTt);return t?{width:WR(Number(t[1]),UR),height:WR(Number(t[2]),720)}:{width:UR,height:720}}async function uTt(e,t={}){let n=t.inlineSVG??!1,{Marp:r}=await Xe(async()=>{let{Marp:e}=await import(`./marp-YZRvgIPH.js`).then(e=>Ue(e.default,1));return{Marp:e}},__vite__mapDeps([22,5,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43])),i=new r({inlineSVG:n,html:Swt,emoji:{unicode:!1,shortcode:!1}});for(let e of t.themes??[])i.themeSet.add(e.css);let a=jwt(i,e),{html:o,css:s}=i.render(a),{width:c,height:l}=n?lTt(o):sTt(s);return{html:o,css:s,slideWidth:c,slideHeight:l}}var dTt={img:[`src`],source:[`src`],video:[`poster`,`src`],audio:[`src`]},fTt={img:[`srcset`],source:[`srcset`]};function GR(e){return e===` `||e===` `||e===`
359
+ `,t);return y5e(e.slice(n,r<0?e.length:r).trim(),qwt)}var Xwt=50;function Zwt(e,t){if(t===null||e.length===0)return[];let n=new RegExp(t.source,t.flags.includes(`g`)?t.flags:`${t.flags}g`),r=[],i=Date.now()+Xwt,a;for(;(a=n.exec(e))!==null&&(r.push({offset:a.index,fraction:a.index/e.length,label:Ywt(e,a.index)}),a.index===n.lastIndex&&(n.lastIndex+=1),!(r.length>=200||Date.now()>i)););return r}Object.freeze({min:0,max:65535});function VR(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Qwt(e,t){return VR(e)&&typeof e[t]==`string`}function $wt(e,t){return e instanceof Error?e.message:Qwt(e,`details`)&&e.details?e.details:Qwt(e,`message`)&&e.message?e.message:t===void 0?String(e):t}var HR=(e,t)=>{throw Error(`markdown plugin: dispatch returned no ${e} (got ${typeof t})`)};function eTt(e){return VR(e)&&typeof e.content==`string`?{content:e.content}:HR(`document content`,e)}function tTt(e){return!VR(e)||!Array.isArray(e.themes)?HR(`marp themes`,e):{themes:e.themes.filter(e=>VR(e)&&typeof e.name==`string`&&typeof e.css==`string`)}}function nTt(e){return VR(e)&&(typeof e.pattern==`string`||e.pattern===null)?{pattern:e.pattern}:HR(`bookmark pattern`,e)}function rTt(e){return VR(e)&&typeof e.pdfBase64==`string`?{pdfBase64:e.pdfBase64}:HR(`exported PDF`,e)}var UR=1280,iTt=200,aTt=3840;function WR(e,t){return!Number.isFinite(e)||e<iTt?t:Math.min(e,aTt)}var oTt=/div\.marpit\s*>\s*section\s*\{[^}]*?width:\s*(\d+)px[^}]*?height:\s*(\d+)px/;function sTt(e){let t=e.match(oTt);return t?{width:WR(Number(t[1]),UR),height:WR(Number(t[2]),720)}:{width:UR,height:720}}var cTt=/viewBox="0 0 (\d+) (\d+)"/;function lTt(e){let t=e.match(cTt);return t?{width:WR(Number(t[1]),UR),height:WR(Number(t[2]),720)}:{width:UR,height:720}}async function uTt(e,t={}){let n=t.inlineSVG??!1,{Marp:r}=await Xe(async()=>{let{Marp:e}=await import(`./marp-BvWwTP5d.js`).then(e=>Ue(e.default,1));return{Marp:e}},__vite__mapDeps([22,5,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43])),i=new r({inlineSVG:n,html:Swt,emoji:{unicode:!1,shortcode:!1}});for(let e of t.themes??[])i.themeSet.add(e.css);let a=jwt(i,e),{html:o,css:s}=i.render(a),{width:c,height:l}=n?lTt(o):sTt(s);return{html:o,css:s,slideWidth:c,slideHeight:l}}var dTt={img:[`src`],source:[`src`],video:[`poster`,`src`],audio:[`src`]},fTt={img:[`srcset`],source:[`srcset`]};function GR(e){return e===` `||e===` `||e===`
360
360
  `||e===`\f`||e===`\r`}function pTt(e){let t=e.length;for(;t>0&&e[t-1]===`,`;)t--;return e.slice(0,t)}function mTt(e,t){let n=t;for(;n<e.length&&(GR(e[n])||e[n]===`,`);)n++;return n}function hTt(e,t){let n=t,r=n;for(;n<e.length&&!GR(e[n]);)n++;let i=e.slice(r,n),a=pTt(i);if(a.length!==i.length)return{candidate:a?{url:a,descriptor:``}:null,next:n};for(;n<e.length&&GR(e[n]);)n++;let o=n;for(;n<e.length&&e[n]!==`,`;)n++;let s=e.slice(o,n).trim();return n<e.length&&e[n]===`,`&&n++,{candidate:a?{url:a,descriptor:s}:null,next:n}}function gTt(e){let t=[],n=0;for(;n<e.length&&(n=mTt(e,n),!(n>=e.length));){let{candidate:r,next:i}=hTt(e,n);n=i,r&&t.push(r)}return t}function _Tt(e,t){let n=gTt(e);if(n.length===0)return e;let r=!1,i=n.map(({url:e,descriptor:n})=>{let i=t(e),a=i===null||i===e?e:(r=!0,i);return n?`${a} ${n}`:a});return r?i.join(`, `):e}var vTt=/<(?:img|source|video|audio)\b(?:[^>"']|"[^"]*"|'[^']*')*\/?>/gi,yTt=/^<([a-z]+)/i,bTt=/(\s)([A-Za-z][\w:-]*)(?:(\s*=\s*)("([^"]*)"|'([^']*)'|([^\s>"'][^\s>]*)))?/g;function xTt(e,t){return e&&e.replace(vTt,e=>{let n=yTt.exec(e)?.[1]?.toLowerCase();if(n===void 0)return e;let r=dTt[n],i=fTt[n];return!r&&!i?e:e.replace(bTt,(...e)=>CTt(e,r??[],i??[],t))})}function STt(e){let[t,n,r,i,,a,o,s]=e.map(e=>typeof e==`string`?e:void 0);return{full:t??``,leading:n??``,name:r??``,eqWithSpaces:i,doubleQuoted:a,singleQuoted:o,bare:s}}function CTt(e,t,n,r){let{full:i,leading:a,name:o,eqWithSpaces:s,doubleQuoted:c,singleQuoted:l,bare:u}=STt(e);if(!s)return i;let d=o.toLowerCase(),f=n.includes(d);if(!f&&!t.includes(d))return i;let p=(c??l??u??``).trim();if(!p)return i;let m=f?_Tt(p,r):r(p);if(m===null||m===p)return i;let h=c===void 0?l===void 0?`"`:`'`:`"`;return`${a}${o}${s}${h}${m}${h}`}function wTt(e){return!!(e.startsWith(`data:`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/api/`))}function TTt(e,t){let n=t.startsWith(`/`),r=[...n?[]:e.split(`/`).filter(e=>e!==``&&e!==`.`)],i=(n?t.slice(1):t).split(`/`);for(let e of i)if(e!==``&&e!==`.`){if(e===`..`){if(r.length===0)return null;r.pop();continue}r.push(e)}return r.length===0?null:r.join(`/`)}function ETt(e){if(!e.startsWith(`![`))return null;let t=1;for(let n=2;n<e.length;n++){let r=e[n];if(r===`[`)t++;else if(r===`]`&&(t--,t===0))return e.slice(2,n)}return null}function DTt(e,t){let n=(e.href??``).trim();if(n===``||wTt(n))return null;let r=TTt(t,n);if(r===null)return null;let i=tL(r),a=ETt(e.raw)??e.text??``;return e.title?`![${a}](${i} "${e.title.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}")`:`![${a}](${i})`}function OTt(e,t){return xTt(e,e=>{if(wTt(e))return null;let n=TTt(t,e);return n===null?null:tL(n)})}function kTt(e){return e.type===`code`||e.type===`codespan`}function ATt(e){return typeof e!=`object`||!e?!1:`type`in e&&typeof e.type==`string`&&`raw`in e&&typeof e.raw==`string`}function jTt(e){if(!Array.isArray(e)||e.length===0)return null;let t=e;return t.every(ATt)?t:null}function MTt(e){let t=`tokens`in e?e.tokens:void 0,n=`items`in e?e.items:void 0;return jTt(t)??jTt(n)}function NTt(e,t,n,r){let i=t.map(e=>e.raw).join(``);if(i===``)return!1;let a=e.indexOf(i);if(a<0)return!1;a>0&&r.push(e.slice(0,a));for(let e of t)PTt(e,n,r);let o=e.slice(a+i.length);return o&&r.push(o),!0}function PTt(e,t,n){if(kTt(e)){n.push(e.raw);return}if(e.type===`image`){let r=DTt(e,t);n.push(r??e.raw);return}if(e.type===`html`){n.push(OTt(e.raw,t));return}let{raw:r}=e,i=MTt(e);i&&NTt(r,i,t,n)||n.push(r)}function KR(e,t=``){let n=NR.lexer(e),r=[];for(let e of n)PTt(e,t,r);return r.join(``)}var FTt=/^(\s*(?:>\s*)*)([-*+]|\d+[.)])(\s+)\[([ xX])\]/,ITt=/^( {0,3})(`{3,}|~{3,})/,LTt=/^(\s*(?:>\s?)+)/;function RTt(e,t){let n=e.match(LTt),r=n?e.slice(n[0].length):e,i=r.match(ITt),a=i?.[2];if(i&&a!==void 0){if(!t.inFence)return t.inFence=!0,t.marker=a,!0;let e=r.slice(i[0].length);return t.marker&&a[0]===t.marker[0]&&a.length>=t.marker.length&&/^\s*$/.test(e)?(t.inFence=!1,t.marker=null,!0):!0}return t.inFence}function zTt(e,t){let[n,r,i,a,o]=t;return`${r}${i}${a}[${o===` `?`x`:` `}]${e.slice(n.length)}`}function qR(e){let t={inFence:!1,marker:null},n=[];for(let[r,i]of e.split(`
361
361
  `).entries())RTt(i,t)||FTt.test(i)&&n.push(r);return n}function BTt(e,t){if(!Number.isInteger(t)||t<0)return null;let n=qR(e)[t];if(n===void 0)return null;let r=e.split(`
362
362
  `),i=r[n];if(i===void 0)return null;let a=i.match(FTt);return a?(r[n]=zTt(i,a),r.join(`
@@ -413,7 +413,7 @@ Look for: text overflowing, clipped by the canvas edge or by its container; elem
413
413
  - If the scene is ready to ship, reply with exactly LGTM and nothing else.
414
414
  - Otherwise reply with the whole improved component in one \`\`\`tsx code block, fixing every problem you found while keeping what works.`].join(`
415
415
 
416
- `);var EMt={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`]}},DMt=[`gpt-image-2`,`gpt-image-1.5`,`gpt-image-1`,`gpt-image-1-mini`],OMt={"bytedance/seedream-4":{maxReferenceImages:10}},_z={openai:{agentName:`imageOpenaiAgent`,defaultModel:`gpt-image-1`,models:[...DMt],keyName:`OPENAI_API_KEY`,baseURLKeyName:`OPENAI_BASE_URL`,maxReferenceImages:16},google:{agentName:`imageGenAIAgent`,defaultModel:`gemini-2.5-flash-image`,models:[`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`,imageModelParams:OMt,models:[`bytedance/seedream-4`,`qwen/qwen-image`,`black-forest-labs/flux-2-pro`,`black-forest-labs/flux-2-dev`,`black-forest-labs/flux-1.1-pro`,`black-forest-labs/flux-1.1-pro-ultra`,`black-forest-labs/flux-pro`,`black-forest-labs/flux-dev`,`black-forest-labs/flux-schnell`,`ideogram-ai/ideogram-v3-turbo`,`ideogram-ai/ideogram-v3-balanced`,`ideogram-ai/ideogram-v3-quality`,`recraft-ai/recraft-v3`,`stability-ai/stable-diffusion-3.5-large`,`luma/photon`],keyName:`REPLICATE_API_TOKEN`},mock:{agentName:`mediaMockAgent`,defaultModel:`mock-model`,models:[`mock-model`],keyName:``}},vz=`never`,yz=`always`,bz=`optional`,xz={replicate:{agentName:`movieReplicateAgent`,defaultModel:`bytedance/seedance-1-lite`,keyName:`REPLICATE_API_TOKEN`,models:`bytedance/seedance-1-lite,bytedance/seedance-1-pro,bytedance/seedance-2.0,bytedance/seedance-2.0-fast,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,alibaba/happyhorse-1.0,minimax/hailuo-2.3,minimax/hailuo-2.3-fast,pixverse/pixverse-v5,prunaai/p-video,xai/grok-imagine-video-1.5`.split(`,`),modelParams:{"bytedance/seedance-1-lite":{durations:[4,5,6,7,8,9,10,11,12],start_image:`image`,last_image:`last_frame_image`,audio:{mode:vz},price_per_sec:.036},"bytedance/seedance-1-pro":{durations:[5,10],start_image:`image`,last_image:`last_frame_image`,audio:{mode:vz},price_per_sec:.15},"bytedance/seedance-2.0":{durations:[4,5,6,7,8,9,10,11,12,13,14,15],start_image:`image`,last_image:`last_frame_image`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.29},"bytedance/seedance-2.0-fast":{durations:[4,5,6,7,8,9,10,11,12,13,14,15],start_image:`image`,last_image:`last_frame_image`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.22},"kwaivgi/kling-v1.6-pro":{durations:[5,10],start_image:`start_image`,audio:{mode:vz},price_per_sec:.095},"kwaivgi/kling-v2.1":{durations:[5,10],start_image:`start_image`,audio:{mode:vz},price_per_sec:.05},"kwaivgi/kling-v2.1-master":{durations:[5,10],start_image:`start_image`,audio:{mode:vz},price_per_sec:.28},"google/veo-2":{durations:[5,6,7,8],start_image:`image`,audio:{mode:vz},price_per_sec:.5},"google/veo-3":{durations:[8],start_image:`image`,audio:{mode:bz,param:`generate_audio`},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`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.75},"google/veo-3.1-fast":{durations:[4,6,8],start_image:`image`,last_image:`last_frame_image`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.4},"google/veo-3.1-lite":{durations:[4,6,8],start_image:`image`,last_image:`last_frame`,audio:{mode:vz},price_per_sec:.05},"google/veo-3-fast":{durations:[8],start_image:`image`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.4},"minimax/video-01":{durations:[6],start_image:`first_frame_image`,audio:{mode:vz},price_per_sec:.5},"minimax/hailuo-02":{durations:[6],start_image:`first_frame_image`,last_image:`end_image`,audio:{mode:vz},price_per_sec:.08},"minimax/hailuo-02-fast":{durations:[6,10],start_image:`first_frame_image`,audio:{mode:vz},price_per_sec:.0166},"pixverse/pixverse-v4.5":{durations:[5,8],start_image:`image`,last_image:`last_frame_image`,audio:{mode:bz,param:`sound_effect_switch`},price_per_sec:.12},"wan-video/wan-2.2-i2v-fast":{durations:[5],start_image:`image`,start_image_required:!0,last_image:`last_image`,audio:{mode:vz},price_per_sec:.01},"wan-video/wan-2.2-t2v-fast":{durations:[5],start_image:void 0,audio:{mode:vz},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`,audio:{mode:vz},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`,audio:{mode:vz},price_per_sec:.08},"runwayml/gen-4.5":{durations:[5,10],start_image:`image`,audio:{mode:vz},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`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.28},"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`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.3},"alibaba/happyhorse-1.0":{durations:[3,4,5,6,7,8,9,10,11,12,13,14,15],start_image:`image`,audio:{mode:vz},price_per_sec:.05},"minimax/hailuo-2.3":{durations:[6,10],start_image:`first_frame_image`,audio:{mode:vz},price_per_sec:.1},"minimax/hailuo-2.3-fast":{durations:[6,10],start_image:`first_frame_image`,start_image_required:!0,audio:{mode:vz},price_per_sec:.06},"pixverse/pixverse-v5":{durations:[5,8],start_image:`image`,last_image:`last_frame_image`,audio:{mode:vz},price_per_sec:.12},"prunaai/p-video":{durations:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],start_image:`image`,last_image:`last_frame_image`,audio:{mode:bz,param:`save_audio`},price_per_sec:.02},"xai/grok-imagine-video-1.5":{durations:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],start_image:`image`,start_image_required:!0,audio:{mode:yz},price_per_sec:.08}}},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,audio:{mode:yz}},"veo-3.1-generate-preview":{durations:[4,6,8],supportsDuration:!0,supportsLastFrame:!0,supportsReferenceImages:!0,supportsPersonGeneration:!1,audio:{mode:yz}},"veo-3.0-generate-001":{durations:[8],supportsDuration:!1,supportsLastFrame:!1,supportsReferenceImages:!1,supportsPersonGeneration:!1,audio:{mode:yz}},"veo-2.0-generate-001":{durations:[5,6,8],supportsDuration:!0,supportsLastFrame:!1,supportsReferenceImages:!1,supportsPersonGeneration:!0,audio:{mode:vz}}}},mock:{agentName:`mediaMockAgent`,defaultModel:`mock-model`,models:[`mock-model`],keyName:``,modelParams:{}}},kMt={replicate:{agentName:`soundEffectReplicateAgent`,defaultModel:`zsxkib/mmaudio`,keyName:`REPLICATE_API_TOKEN`,models:[`zsxkib/mmaudio`],modelParams:{"zsxkib/mmaudio":{identifier:`zsxkib/mmaudio:62871fb59889b2d7c13777f08deb3b36bdff88f7e1d53a50ad7694548a41b484`}}}},AMt={replicate:{agentName:`lipSyncReplicateAgent`,defaultModel:`bytedance/omni-human`,keyName:`REPLICATE_API_TOKEN`,models:[`bytedance/latentsync`,`tmappdev/lipsync`,`bytedance/omni-human`,`pixverse/lipsync`],modelParams:{"bytedance/latentsync":{identifier:`bytedance/latentsync:637ce1919f807ca20da3a448ddc2743535d2853649574cd52a933120e9b9e293`,video:`video`,audio:`audio`},"tmappdev/lipsync":{identifier:`tmappdev/lipsync:c54ce2fe673ea59b857b91250b3d71a2cd304a78f2370687632805c8405fbf4c`,video:`video_input`,audio:`audio_input`},"bytedance/omni-human":{identifier:`bytedance/omni-human`,image:`image`,audio:`audio`,price_per_sec:.14},"pixverse/lipsync":{identifier:`pixverse/lipsync:3ca6d73f4fb9e1d77a4b6e14f8998ee18926e4dc462838e31fa2bb5e662c1e2c`,video:`video`,audio:`audio`}}}},jMt={openai:{agentName:`openAIAgent`,defaultModel:`gpt-5`,keyName:`OPENAI_API_KEY`,baseURLKeyName:`OPENAI_BASE_URL`,apiVersionKeyName:`OPENAI_API_VERSION`,max_tokens:8192,models:[`gpt-5`,`gpt-5-nano`,`gpt-5-mini`,`gpt-4.1`,`gpt-4.1-mini`,`gpt-4.1-nano`,`o3`,`o3-mini`,`o3-pro`,`o1`,`o1-pro`,`gpt-4o`,`gpt-4o-mini`]},anthropic:{agentName:`anthropicAgent`,defaultModel:`claude-sonnet-4-5-20250929`,max_tokens:8192,models:[`claude-opus-4-1-20250805`,`claude-opus-4-20250514`,`claude-sonnet-4-20250514`,`claude-sonnet-4-5-20250929`,`claude-haiku-4-5-20251001`],keyName:`ANTHROPIC_API_KEY`,apiKeyNameOverride:`ANTHROPIC_API_TOKEN`},gemini:{agentName:`geminiAgent`,defaultModel:`gemini-2.5-flash`,max_tokens:8192,models:[`gemini-3.1-pro-preview`,`gemini-3-flash-preview`,`gemini-2.5-pro`,`gemini-2.5-flash`,`gemini-2.5-flash-lite`],keyName:`GEMINI_API_KEY`},groq:{agentName:`groqAgent`,defaultModel:`llama-3.1-8b-instant`,keyName:`GROQ_API_KEY`,max_tokens:4096,models:[`llama-3.1-8b-instant`,`llama-3.3-70b-versatile`,`deepseek-r1-distill-llama-70b`,`openai/gpt-oss-120b`,`openai/gpt-oss-20b`]},mock:{agentName:`mediaMockAgent`,defaultModel:`mock`,max_tokens:4096,models:[`mock`]}},Sz={tts:`openai`,text2image:`openai`,text2movie:`replicate`,text2Html:`openai`,llm:`openai`,soundEffect:`replicate`,lipSync:`replicate`};Object.keys(jMt);var MMt=[`openai`,`anthropic`,`mock`],NMt=`2026-07-03`,PMt=Object.fromEntries(Object.entries(xz.replicate.modelParams).map(([e,t])=>[e,{unit:`seconds`,perSecUSD:t.price_per_sec,asOf:NMt}])),FMt=Object.fromEntries(Object.entries(AMt.replicate.modelParams).filter(([,e])=>e.price_per_sec!==void 0).map(([e,t])=>[e,{unit:`seconds`,perSecUSD:t.price_per_sec,asOf:NMt}]));({...PMt,...FMt});var IMt=/^[A-Za-z_][A-Za-z0-9_-]*$/,LMt=iI([rI({type:uI(`mono`)}),rI({type:uI(`sepia`)}),rI({type:uI(`brightness_contrast`),brightness:QF().min(-1).max(1).optional().default(0),contrast:QF().min(0).max(3).optional().default(1)}),rI({type:uI(`hue`),hue:QF().min(-180).max(180).optional().default(0),saturation:QF().min(-10).max(10).optional().default(1),brightness:QF().min(-10).max(10).optional().default(0)}),rI({type:uI(`colorbalance`),rs:QF().min(-1).max(1).optional().default(0),gs:QF().min(-1).max(1).optional().default(0),bs:QF().min(-1).max(1).optional().default(0),rm:QF().min(-1).max(1).optional().default(0),gm:QF().min(-1).max(1).optional().default(0),bm:QF().min(-1).max(1).optional().default(0),rh:QF().min(-1).max(1).optional().default(0),gh:QF().min(-1).max(1).optional().default(0),bh:QF().min(-1).max(1).optional().default(0)}),rI({type:uI(`vibrance`),intensity:QF().min(-2).max(2).optional().default(0)}),rI({type:uI(`negate`),negate_alpha:$F().optional().default(!1)}),rI({type:uI(`colorhold`),color:X().optional().default(`red`),similarity:QF().min(0).max(1).optional().default(.01),blend:QF().min(0).max(1).optional().default(0)}),rI({type:uI(`colorkey`),color:X().optional().default(`green`),similarity:QF().min(0).max(1).optional().default(.01),blend:QF().min(0).max(1).optional().default(0)}),rI({type:uI(`blur`),radius:QF().min(1).max(50).optional().default(10),power:QF().min(1).max(10).optional().default(1)}),rI({type:uI(`gblur`),sigma:QF().min(0).max(100).optional().default(30)}),rI({type:uI(`avgblur`),sizeX:QF().min(1).max(100).optional().default(10),sizeY:QF().min(1).max(100).optional().default(10)}),rI({type:uI(`unsharp`),luma_msize_x:QF().min(3).max(23).optional().default(5),luma_msize_y:QF().min(3).max(23).optional().default(5),luma_amount:QF().min(-2).max(5).optional().default(1),chroma_msize_x:QF().min(3).max(23).optional().default(5),chroma_msize_y:QF().min(3).max(23).optional().default(5),chroma_amount:QF().min(-2).max(5).optional().default(0)}),rI({type:uI(`edgedetect`),low:QF().min(0).max(1).optional().default(.2),high:QF().min(0).max(1).optional().default(.4),mode:lI([`wires`,`colormix`,`canny`]).optional().default(`wires`)}),rI({type:uI(`sobel`),planes:QF().min(0).max(15).optional().default(15),scale:QF().min(0).max(65535).optional().default(1),delta:QF().min(-65535).max(65535).optional().default(0)}),rI({type:uI(`emboss`)}),rI({type:uI(`glitch`),intensity:QF().min(1).max(100).optional().default(20),style:lI([`noise`,`blend`]).optional().default(`noise`)}),rI({type:uI(`grain`),intensity:QF().min(1).max(100).optional().default(10)}),rI({type:uI(`hflip`)}),rI({type:uI(`vflip`)}),rI({type:uI(`rotate`),angle:QF().optional().default(0),fillcolor:X().optional().default(`black`)}),rI({type:uI(`transpose`),dir:lI([`cclock`,`clock`,`cclock_flip`,`clock_flip`]).optional().default(`clock`)}),rI({type:uI(`vignette`),angle:QF().min(0).max(Math.PI).optional().default(Math.PI/5),x0:QF().min(0).max(1).optional(),y0:QF().min(0).max(1).optional(),mode:lI([`forward`,`backward`]).optional().default(`forward`)}),rI({type:uI(`fade`),mode:lI([`in`,`out`]).optional().default(`in`),start_frame:QF().min(0).optional().default(0),nb_frames:QF().min(1).optional().default(25),alpha:$F().optional().default(!1),color:X().optional().default(`black`)}),rI({type:uI(`pixelize`),width:QF().min(1).max(1e3).optional().default(16),height:QF().min(1).max(1e3).optional().default(16),mode:lI([`avg`,`min`,`max`]).optional().default(`avg`)}),rI({type:uI(`pseudocolor`),preset:lI([`magma`,`inferno`,`plasma`,`viridis`,`turbo`,`cividis`,`range1`,`range2`,`shadows`,`highlights`,`solar`,`nominal`,`preferred`,`total`]).optional().default(`magma`)}),rI({type:uI(`tmix`),frames:QF().min(1).max(1024).optional().default(3),weights:X().optional()}),rI({type:uI(`lagfun`),decay:QF().min(0).max(1).optional().default(.95),planes:QF().min(0).max(15).optional().default(15)}),rI({type:uI(`threshold`),planes:QF().min(0).max(15).optional().default(15)}),rI({type:uI(`elbg`),codebook_length:QF().min(1).max(256).optional().default(256)}),rI({type:uI(`lensdistortion`),k1:QF().min(-1).max(1).optional().default(0),k2:QF().min(-1).max(1).optional().default(0)}),rI({type:uI(`chromashift`),cbh:QF().min(-255).max(255).optional().default(0),cbv:QF().min(-255).max(255).optional().default(0),crh:QF().min(-255).max(255).optional().default(0),crv:QF().min(-255).max(255).optional().default(0),edge:lI([`smear`,`wrap`]).optional().default(`smear`)}),rI({type:uI(`deflicker`),size:QF().min(2).max(129).optional().default(5),mode:lI([`am`,`gm`,`hm`,`qm`,`cm`,`pm`,`median`]).optional().default(`am`)}),rI({type:uI(`dctdnoiz`),sigma:QF().min(0).max(999).optional().default(10)}),rI({type:uI(`custom`),filter:X()})]),RMt=[...new Set(Object.values({bg:`bg`,bgCard:`card`,bgCardAlt:`alt`,text:`text`,textMuted:`muted`,textDim:`dim`,primary:`primary`,accent:`accent`,success:`success`,warning:`warning`,danger:`danger`,info:`info`,highlight:`highlight`}))],zMt=[`title`,`body`,`mono`,`accent`],BMt=[[`bg`,`background-color`],[`text`,`color`],[`border`,`border-color`],[`ring`,`--tw-ring-color`],[`ring-offset`,`--tw-ring-offset-color`]],VMt=[[`bg`,`alt`,30],[`bg`,`card`,40],[`border`,`dim`,30],[`bg`,`*`,10]],HMt=()=>BMt.flatMap(([e,t])=>RMt.map(n=>`.${e}-d-${n}{${t}:var(--d-${n})}`)),UMt=()=>VMt.flatMap(([e,t,n])=>{let r=BMt.find(([t])=>t===e)?.[1];if(!r)throw Error(`alpha variant "${e}" has no colour utility`);return(t===`*`?RMt:[t]).map(t=>`.${e}-d-${t}\\/${n}{${r}:color-mix(in srgb,var(--d-${t}) ${n}%,transparent)}`)}),WMt=()=>zMt.map(e=>`.font-${e}{font-family:var(--d-font-${e})}`),GMt=[...HMt(),...UMt(),...WMt()].join(``),Cz=X().regex(/^[0-9A-Fa-f]{6}$/),wz=lI([`primary`,`accent`,`success`,`warning`,`danger`,`info`,`highlight`]),KMt=rI({bg:Cz,bgCard:Cz,bgCardAlt:Cz,text:Cz,textMuted:Cz,textDim:Cz,primary:Cz,accent:Cz,success:Cz,warning:Cz,danger:Cz,info:Cz,highlight:Cz}),qMt=rI({title:X(),body:X(),mono:X(),accent:X().optional()}),JMt=lI([`glass`,`solid`]),Tz=rI({colors:KMt,fonts:qMt,bgGradient:X().optional(),titleGradient:X().optional(),cardStyle:JMt.optional()}),Ez=lI([`lead`,`big`,`sub`]),YMt=rI({type:uI(`text`),value:X(),align:lI([`left`,`center`,`right`]).optional(),bold:$F().optional(),dim:$F().optional(),fontSize:QF().optional(),color:wz.optional(),size:Ez.optional()}),XMt=iI([X(),rI({text:X()})]),ZMt=lI([`ok`,`no`,`warn`]),QMt=iI([X(),rI({text:X(),items:nI(XMt).optional(),icon:ZMt.optional(),size:Ez.optional()})]),$Mt=rI({type:uI(`bullets`),items:nI(QMt),ordered:$F().optional(),icon:X().optional(),size:Ez.optional()}),eNt=rI({type:uI(`code`),code:X(),language:X().optional()}),tNt=rI({type:uI(`callout`),text:X(),label:X().optional(),color:wz.optional(),style:lI([`quote`,`info`,`warning`]).optional(),size:Ez.optional()}),nNt=rI({type:uI(`metric`),value:X(),label:X(),color:wz.optional(),change:X().optional()}),rNt=rI({type:uI(`divider`),color:wz.optional()}),iNt=rI({type:uI(`tag`),text:X(),color:wz.optional()}),aNt=rI({type:uI(`image`),src:X(),alt:X().optional(),fit:lI([`contain`,`cover`]).optional()}),oNt=rI({type:uI(`imageRef`),ref:X(),alt:X().optional(),fit:lI([`contain`,`cover`]).optional()}),sNt=rI({type:uI(`chart`),chartData:sI(X(),tI()),title:X().optional()}),cNt=rI({type:uI(`mermaid`),code:X(),title:X().optional()}),lNt=iI([X(),rI({text:X(),color:wz.optional(),bold:$F().optional(),badge:$F().optional()})]),uNt=[YMt,$Mt,eNt,tNt,nNt,rNt,aNt,oNt,sNt,cNt,rI({type:uI(`table`),title:X().optional(),headers:nI(X()).optional(),rows:nI(nI(lNt)),rowHeaders:$F().optional(),striped:$F().optional()}),iNt],dNt=aI(`type`,[...uNt]),fNt=rI({type:uI(`section`),label:X(),color:wz.optional(),content:nI(dNt).optional(),text:X().optional(),sidebar:$F().optional()}),Dz=aI(`type`,[...uNt,fNt]),Oz=rI({text:X(),label:X().optional(),color:wz.optional(),align:lI([`left`,`center`]).optional(),leftBar:$F().optional()}),pNt=rI({title:X(),accentColor:wz.optional(),content:nI(Dz).optional(),footer:X().optional(),label:X().optional(),num:QF().optional(),numLabel:X().optional(),icon:X().optional()}),mNt=rI({bgColor:X().optional(),bgGradient:X().optional(),decorations:$F().optional(),bgOpacity:QF().optional(),footer:X().optional()}),hNt=rI({label:X(),color:wz.optional()}),gNt=lI([`compact`,`default`]),_Nt=lI([`small`,`default`,`large`,`hero`]),vNt=lI([`default`,`big`,`lead`]),yNt=lI([`fade`,`fade-up`,`fade-down`,`slide-left`,`slide-right`,`zoom-in`]),kz={accentColor:wz.optional(),style:mNt.optional(),eyebrow:hNt.optional(),density:gNt.optional(),titleSize:_Nt.optional(),subtitleSize:vNt.optional(),intro:yNt.optional(),staggerMs:QF().int().min(0).max(2e3).optional()},bNt=rI({layout:uI(`title`),...kz,title:X(),subtitle:X().optional(),author:X().optional(),note:X().optional(),chips:nI(X()).optional()}),xNt=rI({layout:uI(`columns`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),columns:nI(pNt),showArrows:$F().optional(),callout:Oz.optional(),bottomText:X().optional()}),SNt=rI({title:X(),accentColor:wz.optional(),content:nI(Dz).optional(),footer:X().optional(),ratio:QF().positive().optional(),cardless:$F().optional()}),CNt=rI({layout:uI(`comparison`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),left:SNt,right:SNt,callout:Oz.optional()}),wNt=rI({title:X(),description:X().optional(),accentColor:wz.optional(),num:QF().optional(),icon:X().optional(),content:nI(Dz).optional(),span:QF().int().min(1).max(4).optional()}),TNt=rI({layout:uI(`grid`),...kz,title:X(),subtitle:X().optional(),gridColumns:QF().optional(),items:nI(wNt),footer:X().optional()}),ENt=rI({layout:uI(`bigQuote`),...kz,quote:X(),author:X().optional(),role:X().optional()}),DNt=rI({value:X(),label:X(),color:wz.optional(),change:X().optional(),numLabel:X().optional()}),ONt=rI({layout:uI(`stats`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),stats:nI(DNt),callout:Oz.optional()}),kNt=rI({date:X(),title:X(),description:X().optional(),color:wz.optional(),done:$F().optional(),hot:$F().optional()}),ANt=rI({layout:uI(`timeline`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),items:nI(kNt)}),jNt=rI({title:X().optional(),subtitle:X().optional(),label:X().optional(),labelBadge:$F().optional(),accentColor:wz.optional(),content:nI(Dz).optional(),dark:$F().optional(),ratio:QF().optional(),valign:lI([`top`,`center`,`bottom`]).optional()}),MNt=rI({layout:uI(`split`),...kz,left:jNt.optional(),right:jNt.optional()}),NNt=rI({label:X(),items:nI(X()).optional(),content:nI(Dz).optional(),accentColor:wz.optional()}),PNt=rI({layout:uI(`matrix`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),rows:QF().optional(),cols:QF().optional(),xAxis:rI({low:X().optional(),high:X().optional(),label:X().optional()}).optional(),yAxis:rI({low:X().optional(),high:X().optional(),label:X().optional()}).optional(),cells:nI(NNt)}),FNt=rI({layout:uI(`table`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),headers:nI(X()),rows:nI(nI(lNt)),rowHeaders:$F().optional(),striped:$F().optional(),callout:Oz.optional()}),INt=rI({label:X(),value:QF(),isTotal:$F().optional(),color:wz.optional()}),LNt=rI({layout:uI(`waterfall`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),items:nI(INt),unit:X().optional(),callout:Oz.optional()}),RNt=rI({label:X(),value:X().optional(),description:X().optional(),color:wz.optional()}),zNt=rI({layout:uI(`funnel`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),stages:nI(RNt),callout:Oz.optional()}),BNt=rI({title:X(),description:X().optional(),accentColor:wz.optional()}),VNt=rI({layout:uI(`manifesto`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),items:nI(BNt),columns:QF().int().min(1).max(4).optional(),callout:Oz.optional()}),HNt=aI(`kind`,[rI({kind:uI(`url`),url:wot()}).strict(),rI({kind:uI(`base64`),data:X().min(1)}).strict(),rI({kind:uI(`path`),path:X().min(1)}).strict()]),UNt=rI({source:HNt,size:lI([`cover`,`contain`,`fill`,`auto`]).optional(),opacity:QF().min(0).max(1).optional(),bgOpacity:QF().min(0).max(1).optional()}),Az=rI({logo:rI({source:HNt,position:lI([`top-left`,`top-right`,`bottom-left`,`bottom-right`]).default(`top-right`),width:QF().positive().default(120)}).strict().optional(),backgroundImage:UNt.optional()}).strict(),WNt=aI(`layout`,[bNt,xNt,CNt,TNt,ENt,ONt,ANt,MNt,PNt,FNt,zNt,LNt,VNt]),GNt=rI({type:uI(`slide`),theme:Tz.optional(),slide:WNt,reference:X().optional(),branding:Az.nullable().optional()}).strict(),jz=X(),Mz=wot(),KNt=sI(jz,rI({text:X(),lang:jz,texts:nI(X()).optional(),ttsTexts:nI(X()).optional(),cacheKey:X(),duration:QF().optional()}).strict()),qNt=rI({speed:QF().optional(),instruction:X().optional(),decoration:X().optional(),stability:QF().optional(),similarity_boost:QF().optional()}).strict(),JNt=X(),YNt=`Presenter`,XNt=lI(Object.keys(EMt)).default(Sz.tts),Nz=X().regex(/^-?\d+(\.\d+)?%$/,`a percentage such as "84%"`),ZNt=rI({x:Nz.optional().describe(`Horizontal centre of the avatar, % of the canvas width. Default 84%`),y:Nz.optional().describe(`Bottom edge of the avatar, % of the canvas height. Default 100%`),scale:Nz.optional().describe(`Height of the avatar, % of the canvas height. Default 62%`)}).strict(),QNt=lI([`neutral`,`happy`,`sad`,`angry`,`surprised`,`relaxed`]),$Nt=rI({source:X().describe(`AvatarScript avatar package (a folder with avatar.json, or a mesh-avatar-studio project): a path relative to the script, or an http(s) URL`),position:ZNt.optional()}).strict(),ePt=rI({position:ZNt.optional(),emotion:QNt.optional().describe(`The avatar's expression during this beat`),motions:nI(rI({motion:X().describe(`Motion name, e.g. nod, tilt, think, giggle, surprise`),at:X().optional().describe(`Words of the beat's text where the motion starts. Default: the start of the beat`)}).strict()).optional(),hidden:$F().optional().describe(`Hide the speaker's avatar during this beat`)}).strict(),tPt=rI({displayName:sI(jz,X()).optional(),voiceId:X(),isDefault:$F().optional(),speechOptions:qNt.optional(),provider:XNt.optional(),model:X().optional().describe(`TTS model to use for this speaker`),baseURL:X().optional(),apiVersion:X().optional(),avatar:$Nt.optional().describe(`Avatar shown over the beat visuals, speaking this speaker's lines`)}).strict(),nPt=rI({speakers:sI(JNt,tPt.extend({lang:sI(jz,tPt).optional()}))}).default({speakers:{[YNt]:{provider:Sz.tts,voiceId:`shimmer`,displayName:{en:YNt}}}}),Pz=aI(`kind`,[rI({kind:uI(`url`),url:Mz}).strict(),rI({kind:uI(`base64`),data:X().min(1)}).strict(),rI({kind:uI(`path`),path:X().min(1)}).strict()]),rPt=aI(`kind`,[rI({kind:uI(`url`),url:Mz}).strict(),rI({kind:uI(`base64`),data:X().min(1)}).strict(),rI({kind:uI(`text`),text:X().min(1)}).strict(),rI({kind:uI(`path`),path:X().min(1)}).strict()]),iPt=rI({source:Pz,size:lI([`cover`,`contain`,`fill`,`auto`]).optional(),opacity:QF().min(0).max(1).optional()}),Fz=iI([X(),iPt]).nullable().optional(),Iz=iI([X(),nI(X())]),aPt=oI([Iz,Iz]),oPt=oI([Iz,Iz,Iz,Iz]),sPt=rI({header:Iz.optional(),"sidebar-left":Iz.optional()}),cPt=iI([rI({"row-2":aPt}),rI({"2x2":oPt}),rI({content:Iz})]),lPt=sPt.and(cPt),uPt=rI({type:uI(`markdown`),markdown:iI([Iz,lPt]),style:X().optional(),backgroundImage:Fz}).strict(),dPt=rI({type:uI(`web`),url:Mz}).strict(),fPt=rI({type:uI(`pdf`),source:Pz}).strict(),Lz={Image:`image`,ImagePrompt:`imagePrompt`,Movie:`movie`,MoviePrompt:`moviePrompt`,Beat:`beat`,VoiceOver:`voice_over`,Remotion:`remotion`};Lz.Movie,Lz.Beat,Lz.VoiceOver;var pPt=rI({type:uI(Lz.Image),source:Pz}).strict(),mPt=rI({type:uI(`svg`),source:Pz}).strict(),hPt=rI({type:uI(Lz.Movie),source:Pz}).strict(),gPt=rI({type:uI(Lz.MoviePrompt),prompt:X().min(1),imageName:X().optional().describe(`Reference an imageRefs key to use as image-to-video input`)}).strict(),_Pt=rI({type:uI(`textSlide`),slide:rI({title:X(),subtitle:X().optional(),bullets:nI(X()).optional()}),style:X().optional(),backgroundImage:Fz}).strict(),vPt=lI([`none`,`estimate`]).default(`none`),yPt=aI(`type`,[rI({type:uI(`none`)}),rI({type:uI(`delimiters`),delimiters:nI(X()).optional()})]),bPt=rI({lang:jz.optional(),styles:nI(X()).optional(),captionSplit:vPt.optional(),textSplit:yPt.optional(),bottomOffset:QF().min(0).max(100).optional()}).strict(),xPt=rI({type:uI(`chart`),title:X(),chartData:sI(X(),eI()),style:X().optional(),backgroundImage:Fz}).strict(),SPt=rI({type:uI(`mermaid`),title:X().describe(`The title of the diagram`),code:rPt.describe(`The code of the mermaid diagram`),appendix:nI(X()).optional().describe(`The appendix of the mermaid diagram; typically, style information.`),style:X().optional(),backgroundImage:Fz}).strict(),Rz=iI([QF(),X()]),CPt=rI({opacity:QF().min(0).max(1).optional(),rotate:QF().optional(),scale:iI([QF(),oI([QF(),QF()])]).optional(),translate:oI([QF(),QF()]).optional(),bc:X().optional(),timing:oI([QF(),QF()]).default([0,1]).optional().describe(`Animation timing [start, end] as ratio 0.0-1.0 of beat duration`)}).strict(),wPt=rI({style:lI([`vibrate`,`blink`,`wiggle`,`spin`,`shift`,`bounce`,`pulse`]),count:QF().optional().describe(`Number of loop iterations. 0 = infinite`),delta:QF().optional().describe(`Distance for vibrate / angle for wiggle`),duration:QF().optional().describe(`Duration of one cycle in seconds`),direction:lI([`n`,`s`,`e`,`w`]).optional().describe(`Direction for shift animation`),clockwise:$F().optional().describe(`Spin direction. Default: true`)}).strict(),TPt=rI({color:X().optional().default(`black`),offset:oI([QF(),QF()]).optional().default([1,1]),opacity:QF().optional().default(.5),radius:QF().optional().default(1)}).strict(),EPt=Cst(()=>rI({id:X().regex(IMt,`must start with a letter or underscore, then letters, digits, hyphens or underscores`).optional().describe(`Element id. Used as an HTML id and as a CSS selector in the generated animation script, so it must match [A-Za-z_][A-Za-z0-9_-]*.`),x:Rz.optional(),y:Rz.optional(),w:Rz.optional(),h:Rz.optional(),pos:oI([Rz,Rz]).optional().describe(`Position by anchor point [x, y]`),bc:X().optional().describe(`Background color`),opacity:QF().min(0).max(1).optional(),rotate:QF().optional(),scale:iI([QF(),oI([QF(),QF()])]).optional(),translate:oI([QF(),QF()]).optional(),cornerRadius:QF().optional(),borderWidth:QF().optional(),borderColor:X().optional(),shadow:TPt.optional(),clip:$F().optional(),text:X().optional(),fontSize:iI([QF(),X()]).optional(),fontWeight:X().optional(),textColor:X().optional(),textAlign:lI([`center`,`left`,`right`]).optional(),lineHeight:iI([QF(),X()]).optional(),img:X().optional().describe(`Image URL or image:ref`),imgFit:lI([`contain`,`cover`,`fill`]).optional().default(`contain`),to:CPt.optional().describe(`Transition animation`),loop:wPt.optional().describe(`Loop animation`),elements:nI(Cst(()=>EPt)).optional()}).strict()),DPt=iI([uI(!0),rI({fps:QF().min(1).max(60).optional().default(30),movie:$F().optional().describe(`Use CDP screencast for real-time recording (experimental, faster). Default: false (frame-by-frame screenshot).`)})]),OPt=rI({type:uI(`html_tailwind`),html:Iz.optional(),script:Iz.optional().describe(`JavaScript code for the beat. Injected as a <script> tag after html. Use for render() function etc.`),elements:nI(EPt).optional().describe(`Swipe-style declarative animation elements. Converted to HTML + render() automatically. Use this OR html, not both.`),animation:DPt.optional().describe(`Enable frame-based animation (Remotion-style). true for defaults (30fps), or { fps: N } for custom frame rate.`)}).strict(),kPt=rI({type:uI(Lz.Beat),id:X().optional().describe(`Specifies the beat to reference.`)}).strict(),APt=rI({type:uI(Lz.VoiceOver),startAt:QF().optional().describe(`The time to start the voice over the video in seconds.`)}).strict(),jPt=rI({type:uI(`vision`),style:X().min(1),data:sI(X(),eI())}).strict(),MPt=aI(`kind`,[rI({kind:uI(`text`),text:X().min(1)}).strict(),rI({kind:uI(`path`),path:X().min(1).describe(`Relative to the script`)}).strict()]),NPt={type:uI(Lz.Remotion),fps:QF().min(1).max(60).optional().describe(`Frame rate of the rendered video. Default: 30.`)},PPt=iI([rI({...NPt,prompt:X().min(1).describe(`What the scene shows. Claude Code (claude -p) writes a Remotion component from it.`)}).strict(),rI({...NPt,code:MPt.describe(`A finished Remotion component (TSX that default-exports the scene). It is rendered as is, without claude -p.`)}).strict()]),FPt=rI({brief:X().optional().describe(`Whole-video art direction shared by every remotion beat (palette, type, mood), so all scenes look like one film.`)}).strict(),IPt=iI([uPt,dPt,fPt,pPt,mPt,hPt,_Pt,xPt,SPt,OPt,kPt,APt,jPt,GNt,PPt]),LPt=iI([rI({type:uI(`audio`),source:Pz}).strict(),rI({type:uI(`midi`),source:X()}).strict()]),zz=X(),RPt=zz.refine(e=>!e.startsWith(`$`),{message:`image keys must not start with the reserved prefix "$"`}),zPt=rI({name:zz.optional().describe(`An imageRefs key to use as a reference image`),source:Pz.optional().describe(`Direct source (path/url) to use as a reference image`),label:X().optional().describe(`Role of this reference (e.g. 'the firefighter Travis Kane'), injected into the prompt as a preamble`)}).strict().refine(e=>e.name===void 0!=(e.source===void 0),{message:`specify exactly one of name or source`}),BPt=sI(RPt,iI([pPt,rI({type:uI(Lz.ImagePrompt),prompt:X().min(1),canvasSize:rI({width:QF(),height:QF()}).strict().optional(),referenceImageName:zz.optional().describe(`Reference another imageRefs key as input for image generation. Sugar for references[0].name`),referenceImage:Pz.optional().describe(`Direct source (path/url/base64) as reference image for generation. Sugar for references[0].source`),references:nI(zPt).optional().describe(`Reference images (by imageRefs key or direct source) with optional role labels`)}).strict(),hPt,gPt])),VPt=rI({style:lI([`aspectFit`,`aspectFill`]).optional().default(`aspectFit`)}).describe(`How to handle aspect ratio differences between image and canvas`),HPt=lI(Object.keys(_z)).optional();rI({provider:uI(`openai`),model:lI(_z.openai.models).optional(),quality:lI([`low`,`medium`,`high`,`auto`]).optional()}).strict(),rI({provider:uI(`google`),model:lI(_z.google.models).optional()}).strict();var UPt=rI({provider:HPt,model:X().optional(),quality:X().optional(),style:X().optional(),moderation:X().optional(),baseURL:X().optional(),apiVersion:X().optional(),vertexai_project:X().optional(),vertexai_location:X().optional()}).strict(),WPt=UPt.extend({images:BPt.optional(),backgroundImage:Fz,concurrency:QF().int().positive().optional().describe(`Max concurrent image generation requests`)}).strict(),GPt=rI({cssStyles:Iz}).strict(),KPt=rI({theme:Tz,branding:Az.optional()}).strict(),qPt=rI({padding:QF().optional().describe(`Padding between beats`),movieVolume:QF().min(0).max(1).optional().describe(`Audio volume of the imported or generated movie`)}).strict(),JPt=rI({model:X().optional()}).strict(),YPt=rI({padding:QF().optional().default(.3).describe(`Padding between beats`),introPadding:QF().optional().default(1).describe(`Padding at the beginning of the audio`),closingPadding:QF().optional().default(.8).describe(`Padding before the last beat (typically the closing credit). For padding after the last beat, use outroPadding`),outroPadding:QF().optional().default(1).describe(`Padding after the last beat, at the very end of the audio where the BGM fades out (distinct from closingPadding, which comes before the last beat)`),bgm:Pz.optional(),bgmVolume:QF().optional().default(.2).describe(`Volume of the background music`),audioVolume:QF().optional().default(1).describe(`Volume of the audio`),suppressSpeech:$F().optional().default(!1).describe(`Suppress speech generation`),movieVolume:QF().min(0).max(1).optional().describe(`Default movie audio volume for all beats`),ttsVolume:QF().min(0).max(2).optional().describe(`TTS narration volume before mixing with BGM/movie audio`),ducking:rI({ratio:QF().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:QF().int().positive().optional().describe(`Max concurrent TTS generation requests`)}).strict(),XPt=rI({systemPrompt:X().optional().default(``),prompt:X().min(1),data:eI().optional(),images:sI(X(),eI()).optional()}).strict(),ZPt=lI(Object.keys(xz)),QPt=rI({provider:lI(Object.keys(kMt)).default(Sz.soundEffect).optional(),model:X().optional()}),$Pt=rI({provider:X().optional(),model:X().optional()}),eFt=rI({type:lI([`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:QF().min(0).max(2).optional().default(.3)}),tFt=rI({imageName:zz.describe(`Reference an imageRefs key`),referenceType:lI([`ASSET`,`STYLE`]).describe(`ASSET: scene/object/character, STYLE: aesthetics/lighting`)}),nFt=rI({provider:ZPt.optional(),model:X().optional(),fillOption:VPt.optional(),transition:eFt.optional(),filters:nI(LMt).optional(),vertexai_project:X().optional(),vertexai_location:X().optional(),firstFrameImageName:zz.optional().describe(`Reference an imageRefs key for the first frame (image-to-video input), or '$beatImage' for the beat's own generated image`),lastFrameImageName:zz.optional().describe(`Reference an imageRefs key for the last frame (image-to-video interpolation), or '$beatImage' for the beat's own generated image`),frameFillColor:X().regex(/^(#|0x)?[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$|^[a-zA-Z]+$/,`must be a hex color ('#RRGGBB[AA]', '0x' or no prefix) or a color name`).optional().describe(`Fill color used when padding firstFrame/lastFrame reference images to the canvas aspect ratio (e.g. '#F7F6F4'). Default: black`),referenceImages:nI(tFt).optional().describe(`Style/asset reference images (Veo 3.1). Mutually exclusive with imageName/lastFrameImageName`),concurrency:QF().int().positive().optional().describe(`Max concurrent movie generation requests`),generateAudio:$F().optional().describe(`Request audio generation in the video (model-dependent)`)}),Bz=rI({speaker:JNt.optional(),text:X().optional().default(``).describe(`Text to be spoken. If empty, the audio is not generated.`),texts:nI(X()).optional().describe(`Manually split texts for captions. Takes precedence over text for caption display.`),id:X().optional().describe(`Unique identifier for the beat.`),description:X().optional(),image:IPt.optional(),audio:LPt.optional(),duration:QF().optional().describe(`Duration of the beat. Used only when the text is empty`),imageParams:UPt.optional(),audioParams:qPt.optional(),movieParams:nFt.extend({speed:QF().optional().describe(`Speed of the video. 1.0 is normal speed. 0.5 is half speed. 2.0 is double speed.`)}).optional(),soundEffectParams:QPt.optional(),lipSyncParams:$Pt.optional(),avatarParams:ePt.optional(),htmlImageParams:JPt.optional(),speechOptions:qNt.optional(),textSlideParams:GPt.optional(),captionParams:bPt.optional(),images:BPt.optional().describe(`Beat-local media references. Same schema as imageParams.images. Merged with global refs (local takes precedence).`),imageNames:nI(RPt).optional(),imagePrompt:X().optional(),moviePrompt:X().optional(),soundEffectPrompt:X().optional(),htmlPrompt:XPt.optional(),enableLipSync:$F().optional().describe(`Enable lip sync generation for this beat`),hidden:$F().optional().describe(`Hide this beat from the presentation`)}).strict(),rFt=rI({width:QF(),height:QF()}).default({width:1280,height:720}),iFt=rI({version:uI(`1.1`),credit:uI(`closing`).optional()}).strict(),aFt=lI(MMt).default(Sz.text2Html);rI({provider:uI(`google`),model:lI(xz.google.models).optional()}).strict(),rI({provider:uI(`replicate`),model:lI(xz.replicate.models).optional()}).strict();var oFt=rI({$mulmocast:iFt,canvasSize:rFt,speechParams:nPt,imageParams:WPt.optional().default({provider:Sz.text2image,images:{}}),movieParams:nFt.optional().default({provider:Sz.text2movie}),soundEffectParams:QPt.optional().default({provider:Sz.soundEffect}),lipSyncParams:$Pt.optional(),avatarParams:ePt.optional(),htmlImageParams:JPt.extend({provider:aFt}).optional(),textSlideParams:GPt.optional(),slideParams:KPt.optional(),remotionParams:FPt.optional(),captionParams:bPt.optional(),audioParams:YPt.default({introPadding:1,padding:.3,closingPadding:.8,outroPadding:1,bgmVolume:.2,audioVolume:1,suppressSpeech:!1})}),Vz=rI({url:Mz,title:X().optional(),description:X().optional(),type:iI([lI([`article`,`paper`,`image`,`video`,`audio`]),X()]).optional().default(`article`)}),Hz=oFt.extend({title:X().optional(),description:X().optional(),references:nI(Vz).optional(),lang:jz.optional().default(`en`),beats:nI(Bz).min(1),imagePath:X().optional(),__test_invalid__:$F().optional()}).strict(),sFt=rI({id:X().optional().describe(`Unique identifier for the beat.`),hash:X().optional(),duration:QF().optional(),startAt:QF().optional(),audioDuration:QF().optional(),movieDuration:QF().optional(),silenceDuration:QF().optional(),hasMovieAudio:$F().optional(),audioFile:X().optional(),imageFile:X().optional(),movieFile:X().optional(),soundEffectFile:X().optional(),lipSyncFile:X().optional(),captionFile:X().optional(),captionFiles:nI(rI({file:X(),startAt:QF(),endAt:QF()})).optional(),htmlImageFile:X().optional(),markdown:X().optional(),html:X().optional()}).strict(),cFt=rI({multiLingualTexts:KNt,cacheKey:X().optional()});nI(cFt).min(1);var lFt=sI(X(),cFt);rI({version:uI(`1.1`),multiLingual:lFt}),rI({inSession:rI({audio:$F(),image:$F(),video:$F(),multiLingual:$F(),caption:$F(),pdf:$F(),markdown:$F(),html:$F(),viewer:$F()}),inBeatSession:rI({audio:sI(X(),$F()),image:sI(X(),$F()),movie:sI(X(),$F()),multiLingual:sI(X(),$F()),caption:sI(X(),$F()),html:sI(X(),$F()),imageReference:sI(X(),$F()),soundEffect:sI(X(),$F()),lipSync:sI(X(),$F())})});var uFt=rI({speaker:X(),file:X(),width:QF(),height:QF(),placements:nI(rI({start:QF(),end:QF(),x:QF(),y:QF(),width:QF(),height:QF()}).strict())}).strict();rI({script:Hz,filename:X(),beats:nI(sFt).min(1),avatarTracks:nI(uFt).optional()}).strict(),rI({title:X(),description:X(),systemPrompt:X(),scriptName:X().optional(),presentationStyle:oFt.optional()}).strict().extend({filename:X()});var dFt=rI({description:X(),references:nI(Vz).optional()}).describe(`A detailed description of the content of the scene, not the presentation style`).strict();rI({title:X(),references:nI(Vz).optional(),scenes:nI(dFt)}).describe(`A storyboard for a presentation, a story, a video, etc.`).strict(),rI({beats:nI(rI({id:X().optional(),text:X().optional(),duration:QF().optional(),startTime:QF().optional(),endTime:QF().optional(),importance:QF().optional(),multiLinguals:sI(X(),X()).optional(),audioSources:sI(X(),X().optional()).optional(),imageSource:X().optional(),videoSource:X().optional(),videoWithAudioSource:X().optional(),htmlImageSource:X().optional(),soundEffectSource:X().optional()})),bgmSource:X().optional(),bgmFile:X().optional(),title:X().optional(),lang:X().optional()});var fFt=`presentMulmoScript`,Uz=`remotion-component-guide.md`,pFt=`Save and present a MulmoScript story or presentation as a visual storyboard in the canvas.
416
+ `);var EMt={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-3.8-flash-tts`,defaultVoice:`Kore`,models:[`gemini-3.8-flash-tts`,`gemini-3.8-flash-lite-tts`,`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`]}},DMt=[`gpt-image-2.5-sunburst`,`gpt-image-2.5-flare`,`gpt-image-2`,`gpt-image-1.5`,`gpt-image-1`,`gpt-image-1-mini`],OMt={"bytedance/seedream-4":{maxReferenceImages:10}},_z={openai:{agentName:`imageOpenaiAgent`,defaultModel:`gpt-image-2.5-sunburst`,models:[...DMt],keyName:`OPENAI_API_KEY`,baseURLKeyName:`OPENAI_BASE_URL`,maxReferenceImages:16},google:{agentName:`imageGenAIAgent`,defaultModel:`gemini-3.1-flash-lite-image`,models:[`gemini-3.1-flash-lite-image`,`gemini-3.1-flash-image`,`gemini-3-pro-image`,`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`,imageModelParams:OMt,models:[`bytedance/seedream-4`,`qwen/qwen-image`,`black-forest-labs/flux-2-pro`,`black-forest-labs/flux-2-dev`,`black-forest-labs/flux-1.1-pro`,`black-forest-labs/flux-1.1-pro-ultra`,`black-forest-labs/flux-pro`,`black-forest-labs/flux-dev`,`black-forest-labs/flux-schnell`,`ideogram-ai/ideogram-v3-turbo`,`ideogram-ai/ideogram-v3-balanced`,`ideogram-ai/ideogram-v3-quality`,`recraft-ai/recraft-v3`,`stability-ai/stable-diffusion-3.5-large`,`luma/photon`],keyName:`REPLICATE_API_TOKEN`},mock:{agentName:`mediaMockAgent`,defaultModel:`mock-model`,models:[`mock-model`],keyName:``}},vz=`never`,yz=`always`,bz=`optional`,xz={replicate:{agentName:`movieReplicateAgent`,defaultModel:`bytedance/seedance-1-lite`,keyName:`REPLICATE_API_TOKEN`,models:`bytedance/seedance-1-lite,bytedance/seedance-1-pro,bytedance/seedance-2.0,bytedance/seedance-2.0-fast,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,alibaba/happyhorse-1.0,minimax/hailuo-2.3,minimax/hailuo-2.3-fast,pixverse/pixverse-v5,prunaai/p-video,xai/grok-imagine-video-1.5`.split(`,`),modelParams:{"bytedance/seedance-1-lite":{durations:[4,5,6,7,8,9,10,11,12],start_image:`image`,last_image:`last_frame_image`,audio:{mode:vz},price_per_sec:.036},"bytedance/seedance-1-pro":{durations:[5,10],start_image:`image`,last_image:`last_frame_image`,audio:{mode:vz},price_per_sec:.15},"bytedance/seedance-2.0":{durations:[4,5,6,7,8,9,10,11,12,13,14,15],start_image:`image`,last_image:`last_frame_image`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.18},"bytedance/seedance-2.0-fast":{durations:[4,5,6,7,8,9,10,11,12,13,14,15],start_image:`image`,last_image:`last_frame_image`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.15},"kwaivgi/kling-v2.1":{durations:[5,10],start_image:`start_image`,audio:{mode:vz},price_per_sec:.05},"kwaivgi/kling-v2.1-master":{durations:[5,10],start_image:`start_image`,audio:{mode:vz},price_per_sec:.28},"google/veo-2":{durations:[5,6,7,8],start_image:`image`,audio:{mode:vz},price_per_sec:.5},"google/veo-3":{durations:[8],start_image:`image`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.2},"google/veo-3.1":{durations:[4,6,8],start_image:`image`,last_image:`last_frame_image`,reference_images_param:`reference_images`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.2},"google/veo-3.1-fast":{durations:[4,6,8],start_image:`image`,last_image:`last_frame_image`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.1},"google/veo-3.1-lite":{durations:[4,6,8],start_image:`image`,last_image:`last_frame`,audio:{mode:vz},price_per_sec:.05},"google/veo-3-fast":{durations:[8],start_image:`image`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.1},"minimax/video-01":{durations:[6],start_image:`first_frame_image`,audio:{mode:vz},price_per_sec:.083},"minimax/hailuo-02":{durations:[6],start_image:`first_frame_image`,last_image:`end_image`,audio:{mode:vz},price_per_sec:.08},"minimax/hailuo-02-fast":{durations:[6,10],start_image:`first_frame_image`,audio:{mode:vz},price_per_sec:.0166},"pixverse/pixverse-v4.5":{durations:[5,8],start_image:`image`,last_image:`last_frame_image`,audio:{mode:bz,param:`sound_effect_switch`},price_per_sec:.06},"wan-video/wan-2.2-i2v-fast":{durations:[5],start_image:`image`,start_image_required:!0,last_image:`last_image`,audio:{mode:vz},price_per_sec:.01},"wan-video/wan-2.2-t2v-fast":{durations:[5],start_image:void 0,audio:{mode:vz},price_per_sec:.01},"xai/grok-imagine-video":{durations:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],start_image:`image`,audio:{mode:vz},price_per_sec:.05},"xai/grok-imagine-r2v":{durations:[1,2,3,4,5,6,7,8,9,10],start_image:void 0,reference_images_param:`reference_images`,audio:{mode:vz},price_per_sec:.05},"runwayml/gen-4.5":{durations:[5,10],start_image:`image`,audio:{mode:vz},price_per_sec:.12},"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`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.224},"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`,audio:{mode:bz,param:`generate_audio`},price_per_sec:.224},"alibaba/happyhorse-1.0":{durations:[3,4,5,6,7,8,9,10,11,12,13,14,15],start_image:`image`,audio:{mode:vz},price_per_sec:.14},"minimax/hailuo-2.3":{durations:[6,10],start_image:`first_frame_image`,audio:{mode:vz},price_per_sec:.047},"minimax/hailuo-2.3-fast":{durations:[6,10],start_image:`first_frame_image`,start_image_required:!0,audio:{mode:vz},price_per_sec:.032},"pixverse/pixverse-v5":{durations:[5,8],start_image:`image`,last_image:`last_frame_image`,audio:{mode:vz},price_per_sec:.06},"prunaai/p-video":{durations:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],start_image:`image`,last_image:`last_frame_image`,audio:{mode:bz,param:`save_audio`},price_per_sec:.02},"xai/grok-imagine-video-1.5":{durations:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],start_image:`image`,start_image_required:!0,audio:{mode:yz},price_per_sec:.08}}},google:{agentName:`movieGenAIAgent`,defaultModel:`veo-3.1-generate-preview`,models:[`veo-3.1-generate-preview`,`veo-3.1-lite-generate-preview`,`veo-3.1-generate-001`],keyName:`GEMINI_API_KEY`,modelParams:{"veo-3.1-lite-generate-preview":{durations:[4,6,8],supportsDuration:!0,supportsLastFrame:!0,supportsReferenceImages:!1,supportsPersonGeneration:!1,audio:{mode:yz}},"veo-3.1-generate-001":{durations:[4,6,8],supportsDuration:!0,supportsLastFrame:!0,supportsReferenceImages:!0,supportsPersonGeneration:!1,audio:{mode:yz}},"veo-3.1-generate-preview":{durations:[4,6,8],supportsDuration:!0,supportsLastFrame:!0,supportsReferenceImages:!0,supportsPersonGeneration:!1,audio:{mode:yz}}}},mock:{agentName:`mediaMockAgent`,defaultModel:`mock-model`,models:[`mock-model`],keyName:``,modelParams:{}}},kMt={replicate:{agentName:`soundEffectReplicateAgent`,defaultModel:`zsxkib/mmaudio`,keyName:`REPLICATE_API_TOKEN`,models:[`zsxkib/mmaudio`],modelParams:{"zsxkib/mmaudio":{identifier:`zsxkib/mmaudio:62871fb59889b2d7c13777f08deb3b36bdff88f7e1d53a50ad7694548a41b484`}}}},AMt={replicate:{agentName:`lipSyncReplicateAgent`,defaultModel:`bytedance/omni-human`,keyName:`REPLICATE_API_TOKEN`,models:[`bytedance/latentsync`,`tmappdev/lipsync`,`bytedance/omni-human`,`pixverse/lipsync`],modelParams:{"bytedance/latentsync":{identifier:`bytedance/latentsync:637ce1919f807ca20da3a448ddc2743535d2853649574cd52a933120e9b9e293`,video:`video`,audio:`audio`},"tmappdev/lipsync":{identifier:`tmappdev/lipsync:c54ce2fe673ea59b857b91250b3d71a2cd304a78f2370687632805c8405fbf4c`,video:`video_input`,audio:`audio_input`},"bytedance/omni-human":{identifier:`bytedance/omni-human`,image:`image`,audio:`audio`,price_per_sec:.14},"pixverse/lipsync":{identifier:`pixverse/lipsync:3ca6d73f4fb9e1d77a4b6e14f8998ee18926e4dc462838e31fa2bb5e662c1e2c`,video:`video`,audio:`audio`}}}},jMt={openai:{agentName:`openAIAgent`,defaultModel:`gpt-5.6-sol`,keyName:`OPENAI_API_KEY`,baseURLKeyName:`OPENAI_BASE_URL`,apiVersionKeyName:`OPENAI_API_VERSION`,max_tokens:8192,models:[`gpt-5.6-sol`,`gpt-5.6-terra`,`gpt-5.6-luna`,`gpt-5`,`gpt-5-nano`,`gpt-5-mini`,`gpt-4.1`,`gpt-4.1-mini`,`gpt-4.1-nano`,`o3`,`o3-mini`,`o3-pro`,`o1`,`o1-pro`,`gpt-4o`,`gpt-4o-mini`]},anthropic:{agentName:`anthropicAgent`,defaultModel:`claude-sonnet-4-6`,max_tokens:8192,models:[`claude-sonnet-4-6`,`claude-sonnet-4-5-20250929`,`claude-haiku-4-5-20251001`],keyName:`ANTHROPIC_API_KEY`,apiKeyNameOverride:`ANTHROPIC_API_TOKEN`},gemini:{agentName:`geminiAgent`,defaultModel:`gemini-3.8-flash`,max_tokens:8192,models:[`gemini-3.8-flash`,`gemini-3.1-pro-preview`,`gemini-3-flash-preview`,`gemini-2.5-pro`,`gemini-2.5-flash`,`gemini-2.5-flash-lite`],keyName:`GEMINI_API_KEY`},groq:{agentName:`groqAgent`,defaultModel:`openai/gpt-oss-20b`,keyName:`GROQ_API_KEY`,max_tokens:4096,models:[`openai/gpt-oss-20b`,`openai/gpt-oss-120b`]},mock:{agentName:`mediaMockAgent`,defaultModel:`mock`,max_tokens:4096,models:[`mock`]}},Sz={tts:`openai`,text2image:`openai`,text2movie:`replicate`,text2Html:`openai`,llm:`openai`,soundEffect:`replicate`,lipSync:`replicate`};Object.keys(jMt);var MMt=[`openai`,`anthropic`,`mock`],NMt=`2026-10-07`,PMt=Object.fromEntries(Object.entries(xz.replicate.modelParams).map(([e,t])=>[e,{unit:`seconds`,perSecUSD:t.price_per_sec,asOf:NMt}])),FMt=Object.fromEntries(Object.entries(AMt.replicate.modelParams).filter(([,e])=>e.price_per_sec!==void 0).map(([e,t])=>[e,{unit:`seconds`,perSecUSD:t.price_per_sec,asOf:NMt}]));({...PMt,...FMt});var IMt=/^[A-Za-z_][A-Za-z0-9_-]*$/,LMt=iI([rI({type:uI(`mono`)}),rI({type:uI(`sepia`)}),rI({type:uI(`brightness_contrast`),brightness:QF().min(-1).max(1).optional().default(0),contrast:QF().min(0).max(3).optional().default(1)}),rI({type:uI(`hue`),hue:QF().min(-180).max(180).optional().default(0),saturation:QF().min(-10).max(10).optional().default(1),brightness:QF().min(-10).max(10).optional().default(0)}),rI({type:uI(`colorbalance`),rs:QF().min(-1).max(1).optional().default(0),gs:QF().min(-1).max(1).optional().default(0),bs:QF().min(-1).max(1).optional().default(0),rm:QF().min(-1).max(1).optional().default(0),gm:QF().min(-1).max(1).optional().default(0),bm:QF().min(-1).max(1).optional().default(0),rh:QF().min(-1).max(1).optional().default(0),gh:QF().min(-1).max(1).optional().default(0),bh:QF().min(-1).max(1).optional().default(0)}),rI({type:uI(`vibrance`),intensity:QF().min(-2).max(2).optional().default(0)}),rI({type:uI(`negate`),negate_alpha:$F().optional().default(!1)}),rI({type:uI(`colorhold`),color:X().optional().default(`red`),similarity:QF().min(0).max(1).optional().default(.01),blend:QF().min(0).max(1).optional().default(0)}),rI({type:uI(`colorkey`),color:X().optional().default(`green`),similarity:QF().min(0).max(1).optional().default(.01),blend:QF().min(0).max(1).optional().default(0)}),rI({type:uI(`blur`),radius:QF().min(1).max(50).optional().default(10),power:QF().min(1).max(10).optional().default(1)}),rI({type:uI(`gblur`),sigma:QF().min(0).max(100).optional().default(30)}),rI({type:uI(`avgblur`),sizeX:QF().min(1).max(100).optional().default(10),sizeY:QF().min(1).max(100).optional().default(10)}),rI({type:uI(`unsharp`),luma_msize_x:QF().min(3).max(23).optional().default(5),luma_msize_y:QF().min(3).max(23).optional().default(5),luma_amount:QF().min(-2).max(5).optional().default(1),chroma_msize_x:QF().min(3).max(23).optional().default(5),chroma_msize_y:QF().min(3).max(23).optional().default(5),chroma_amount:QF().min(-2).max(5).optional().default(0)}),rI({type:uI(`edgedetect`),low:QF().min(0).max(1).optional().default(.2),high:QF().min(0).max(1).optional().default(.4),mode:lI([`wires`,`colormix`,`canny`]).optional().default(`wires`)}),rI({type:uI(`sobel`),planes:QF().min(0).max(15).optional().default(15),scale:QF().min(0).max(65535).optional().default(1),delta:QF().min(-65535).max(65535).optional().default(0)}),rI({type:uI(`emboss`)}),rI({type:uI(`glitch`),intensity:QF().min(1).max(100).optional().default(20),style:lI([`noise`,`blend`]).optional().default(`noise`)}),rI({type:uI(`grain`),intensity:QF().min(1).max(100).optional().default(10)}),rI({type:uI(`hflip`)}),rI({type:uI(`vflip`)}),rI({type:uI(`rotate`),angle:QF().optional().default(0),fillcolor:X().optional().default(`black`)}),rI({type:uI(`transpose`),dir:lI([`cclock`,`clock`,`cclock_flip`,`clock_flip`]).optional().default(`clock`)}),rI({type:uI(`vignette`),angle:QF().min(0).max(Math.PI).optional().default(Math.PI/5),x0:QF().min(0).max(1).optional(),y0:QF().min(0).max(1).optional(),mode:lI([`forward`,`backward`]).optional().default(`forward`)}),rI({type:uI(`fade`),mode:lI([`in`,`out`]).optional().default(`in`),start_frame:QF().min(0).optional().default(0),nb_frames:QF().min(1).optional().default(25),alpha:$F().optional().default(!1),color:X().optional().default(`black`)}),rI({type:uI(`pixelize`),width:QF().min(1).max(1e3).optional().default(16),height:QF().min(1).max(1e3).optional().default(16),mode:lI([`avg`,`min`,`max`]).optional().default(`avg`)}),rI({type:uI(`pseudocolor`),preset:lI([`magma`,`inferno`,`plasma`,`viridis`,`turbo`,`cividis`,`range1`,`range2`,`shadows`,`highlights`,`solar`,`nominal`,`preferred`,`total`]).optional().default(`magma`)}),rI({type:uI(`tmix`),frames:QF().min(1).max(1024).optional().default(3),weights:X().optional()}),rI({type:uI(`lagfun`),decay:QF().min(0).max(1).optional().default(.95),planes:QF().min(0).max(15).optional().default(15)}),rI({type:uI(`threshold`),planes:QF().min(0).max(15).optional().default(15)}),rI({type:uI(`elbg`),codebook_length:QF().min(1).max(256).optional().default(256)}),rI({type:uI(`lensdistortion`),k1:QF().min(-1).max(1).optional().default(0),k2:QF().min(-1).max(1).optional().default(0)}),rI({type:uI(`chromashift`),cbh:QF().min(-255).max(255).optional().default(0),cbv:QF().min(-255).max(255).optional().default(0),crh:QF().min(-255).max(255).optional().default(0),crv:QF().min(-255).max(255).optional().default(0),edge:lI([`smear`,`wrap`]).optional().default(`smear`)}),rI({type:uI(`deflicker`),size:QF().min(2).max(129).optional().default(5),mode:lI([`am`,`gm`,`hm`,`qm`,`cm`,`pm`,`median`]).optional().default(`am`)}),rI({type:uI(`dctdnoiz`),sigma:QF().min(0).max(999).optional().default(10)}),rI({type:uI(`custom`),filter:X()})]),RMt=[...new Set(Object.values({bg:`bg`,bgCard:`card`,bgCardAlt:`alt`,text:`text`,textMuted:`muted`,textDim:`dim`,primary:`primary`,accent:`accent`,success:`success`,warning:`warning`,danger:`danger`,info:`info`,highlight:`highlight`}))],zMt=[`title`,`body`,`mono`,`accent`],BMt=[[`bg`,`background-color`],[`text`,`color`],[`border`,`border-color`],[`ring`,`--tw-ring-color`],[`ring-offset`,`--tw-ring-offset-color`]],VMt=[[`bg`,`alt`,30],[`bg`,`card`,40],[`border`,`dim`,30],[`bg`,`*`,10]],HMt=()=>BMt.flatMap(([e,t])=>RMt.map(n=>`.${e}-d-${n}{${t}:var(--d-${n})}`)),UMt=()=>VMt.flatMap(([e,t,n])=>{let r=BMt.find(([t])=>t===e)?.[1];if(!r)throw Error(`alpha variant "${e}" has no colour utility`);return(t===`*`?RMt:[t]).map(t=>`.${e}-d-${t}\\/${n}{${r}:color-mix(in srgb,var(--d-${t}) ${n}%,transparent)}`)}),WMt=()=>zMt.map(e=>`.font-${e}{font-family:var(--d-font-${e})}`),GMt=[...HMt(),...UMt(),...WMt()].join(``),Cz=X().regex(/^[0-9A-Fa-f]{6}$/),wz=lI([`primary`,`accent`,`success`,`warning`,`danger`,`info`,`highlight`]),KMt=rI({bg:Cz,bgCard:Cz,bgCardAlt:Cz,text:Cz,textMuted:Cz,textDim:Cz,primary:Cz,accent:Cz,success:Cz,warning:Cz,danger:Cz,info:Cz,highlight:Cz}),qMt=rI({title:X(),body:X(),mono:X(),accent:X().optional()}),JMt=lI([`glass`,`solid`]),Tz=rI({colors:KMt,fonts:qMt,bgGradient:X().optional(),titleGradient:X().optional(),cardStyle:JMt.optional()}),Ez=lI([`lead`,`big`,`sub`]),YMt=rI({type:uI(`text`),value:X(),align:lI([`left`,`center`,`right`]).optional(),bold:$F().optional(),dim:$F().optional(),fontSize:QF().optional(),color:wz.optional(),size:Ez.optional()}),XMt=iI([X(),rI({text:X()})]),ZMt=lI([`ok`,`no`,`warn`]),QMt=iI([X(),rI({text:X(),items:nI(XMt).optional(),icon:ZMt.optional(),size:Ez.optional()})]),$Mt=rI({type:uI(`bullets`),items:nI(QMt),ordered:$F().optional(),icon:X().optional(),size:Ez.optional()}),eNt=rI({type:uI(`code`),code:X(),language:X().optional()}),tNt=rI({type:uI(`callout`),text:X(),label:X().optional(),color:wz.optional(),style:lI([`quote`,`info`,`warning`]).optional(),size:Ez.optional()}),nNt=rI({type:uI(`metric`),value:X(),label:X(),color:wz.optional(),change:X().optional()}),rNt=rI({type:uI(`divider`),color:wz.optional()}),iNt=rI({type:uI(`tag`),text:X(),color:wz.optional()}),aNt=rI({type:uI(`image`),src:X(),alt:X().optional(),fit:lI([`contain`,`cover`]).optional()}),oNt=rI({type:uI(`imageRef`),ref:X(),alt:X().optional(),fit:lI([`contain`,`cover`]).optional()}),sNt=rI({type:uI(`chart`),chartData:sI(X(),tI()),title:X().optional()}),cNt=rI({type:uI(`mermaid`),code:X(),title:X().optional()}),lNt=iI([X(),rI({text:X(),color:wz.optional(),bold:$F().optional(),badge:$F().optional()})]),uNt=[YMt,$Mt,eNt,tNt,nNt,rNt,aNt,oNt,sNt,cNt,rI({type:uI(`table`),title:X().optional(),headers:nI(X()).optional(),rows:nI(nI(lNt)),rowHeaders:$F().optional(),striped:$F().optional()}),iNt],dNt=aI(`type`,[...uNt]),fNt=rI({type:uI(`section`),label:X(),color:wz.optional(),content:nI(dNt).optional(),text:X().optional(),sidebar:$F().optional()}),Dz=aI(`type`,[...uNt,fNt]),Oz=rI({text:X(),label:X().optional(),color:wz.optional(),align:lI([`left`,`center`]).optional(),leftBar:$F().optional()}),pNt=rI({title:X(),accentColor:wz.optional(),content:nI(Dz).optional(),footer:X().optional(),label:X().optional(),num:QF().optional(),numLabel:X().optional(),icon:X().optional()}),mNt=rI({bgColor:X().optional(),bgGradient:X().optional(),decorations:$F().optional(),bgOpacity:QF().optional(),footer:X().optional()}),hNt=rI({label:X(),color:wz.optional()}),gNt=lI([`compact`,`default`]),_Nt=lI([`small`,`default`,`large`,`hero`]),vNt=lI([`default`,`big`,`lead`]),yNt=lI([`fade`,`fade-up`,`fade-down`,`slide-left`,`slide-right`,`zoom-in`]),kz={accentColor:wz.optional(),style:mNt.optional(),eyebrow:hNt.optional(),density:gNt.optional(),titleSize:_Nt.optional(),subtitleSize:vNt.optional(),intro:yNt.optional(),staggerMs:QF().int().min(0).max(2e3).optional()},bNt=rI({layout:uI(`title`),...kz,title:X(),subtitle:X().optional(),author:X().optional(),note:X().optional(),chips:nI(X()).optional()}),xNt=rI({layout:uI(`columns`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),columns:nI(pNt),showArrows:$F().optional(),callout:Oz.optional(),bottomText:X().optional()}),SNt=rI({title:X(),accentColor:wz.optional(),content:nI(Dz).optional(),footer:X().optional(),ratio:QF().positive().optional(),cardless:$F().optional()}),CNt=rI({layout:uI(`comparison`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),left:SNt,right:SNt,callout:Oz.optional()}),wNt=rI({title:X(),description:X().optional(),accentColor:wz.optional(),num:QF().optional(),icon:X().optional(),content:nI(Dz).optional(),span:QF().int().min(1).max(4).optional()}),TNt=rI({layout:uI(`grid`),...kz,title:X(),subtitle:X().optional(),gridColumns:QF().optional(),items:nI(wNt),footer:X().optional()}),ENt=rI({layout:uI(`bigQuote`),...kz,quote:X(),author:X().optional(),role:X().optional()}),DNt=rI({value:X(),label:X(),color:wz.optional(),change:X().optional(),numLabel:X().optional()}),ONt=rI({layout:uI(`stats`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),stats:nI(DNt),callout:Oz.optional()}),kNt=rI({date:X(),title:X(),description:X().optional(),color:wz.optional(),done:$F().optional(),hot:$F().optional()}),ANt=rI({layout:uI(`timeline`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),items:nI(kNt)}),jNt=rI({title:X().optional(),subtitle:X().optional(),label:X().optional(),labelBadge:$F().optional(),accentColor:wz.optional(),content:nI(Dz).optional(),dark:$F().optional(),ratio:QF().optional(),valign:lI([`top`,`center`,`bottom`]).optional()}),MNt=rI({layout:uI(`split`),...kz,left:jNt.optional(),right:jNt.optional()}),NNt=rI({label:X(),items:nI(X()).optional(),content:nI(Dz).optional(),accentColor:wz.optional()}),PNt=rI({layout:uI(`matrix`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),rows:QF().optional(),cols:QF().optional(),xAxis:rI({low:X().optional(),high:X().optional(),label:X().optional()}).optional(),yAxis:rI({low:X().optional(),high:X().optional(),label:X().optional()}).optional(),cells:nI(NNt)}),FNt=rI({layout:uI(`table`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),headers:nI(X()),rows:nI(nI(lNt)),rowHeaders:$F().optional(),striped:$F().optional(),callout:Oz.optional()}),INt=rI({label:X(),value:QF(),isTotal:$F().optional(),color:wz.optional()}),LNt=rI({layout:uI(`waterfall`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),items:nI(INt),unit:X().optional(),callout:Oz.optional()}),RNt=rI({label:X(),value:X().optional(),description:X().optional(),color:wz.optional()}),zNt=rI({layout:uI(`funnel`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),stages:nI(RNt),callout:Oz.optional()}),BNt=rI({title:X(),description:X().optional(),accentColor:wz.optional()}),VNt=rI({layout:uI(`manifesto`),...kz,title:X(),stepLabel:X().optional(),subtitle:X().optional(),items:nI(BNt),columns:QF().int().min(1).max(4).optional(),callout:Oz.optional()}),HNt=aI(`kind`,[rI({kind:uI(`url`),url:wot()}).strict(),rI({kind:uI(`base64`),data:X().min(1)}).strict(),rI({kind:uI(`path`),path:X().min(1)}).strict()]),UNt=rI({source:HNt,size:lI([`cover`,`contain`,`fill`,`auto`]).optional(),opacity:QF().min(0).max(1).optional(),bgOpacity:QF().min(0).max(1).optional()}),Az=rI({logo:rI({source:HNt,position:lI([`top-left`,`top-right`,`bottom-left`,`bottom-right`]).default(`top-right`),width:QF().positive().default(120)}).strict().optional(),backgroundImage:UNt.optional()}).strict(),WNt=aI(`layout`,[bNt,xNt,CNt,TNt,ENt,ONt,ANt,MNt,PNt,FNt,zNt,LNt,VNt]),GNt=rI({type:uI(`slide`),theme:Tz.optional(),slide:WNt,reference:X().optional(),branding:Az.nullable().optional()}).strict(),jz=X(),Mz=wot(),KNt=sI(jz,rI({text:X(),lang:jz,texts:nI(X()).optional(),ttsTexts:nI(X()).optional(),cacheKey:X(),duration:QF().optional()}).strict()),qNt=rI({speed:QF().optional(),instruction:X().optional(),decoration:X().optional(),stability:QF().optional(),similarity_boost:QF().optional()}).strict(),JNt=X(),YNt=`Presenter`,XNt=lI(Object.keys(EMt)).default(Sz.tts),Nz=X().regex(/^-?\d+(\.\d+)?%$/,`a percentage such as "84%"`),ZNt=rI({x:Nz.optional().describe(`Horizontal centre of the avatar, % of the canvas width. Default 84%`),y:Nz.optional().describe(`Bottom edge of the avatar, % of the canvas height. Default 100%`),scale:Nz.optional().describe(`Height of the avatar, % of the canvas height. Default 62%`)}).strict(),QNt=lI([`neutral`,`happy`,`sad`,`angry`,`surprised`,`relaxed`]),$Nt=rI({source:X().describe(`AvatarScript avatar package (a folder with avatar.json, or a mesh-avatar-studio project): a path relative to the script, or an http(s) URL`),position:ZNt.optional()}).strict(),ePt=rI({position:ZNt.optional(),emotion:QNt.optional().describe(`The avatar's expression during this beat`),motions:nI(rI({motion:X().describe(`Motion name, e.g. nod, tilt, think, giggle, surprise`),at:X().optional().describe(`Words of the beat's text where the motion starts. Default: the start of the beat`)}).strict()).optional(),hidden:$F().optional().describe(`Hide the speaker's avatar during this beat`)}).strict(),tPt=rI({displayName:sI(jz,X()).optional(),voiceId:X(),isDefault:$F().optional(),speechOptions:qNt.optional(),provider:XNt.optional(),model:X().optional().describe(`TTS model to use for this speaker`),baseURL:X().optional(),apiVersion:X().optional(),avatar:$Nt.optional().describe(`Avatar shown over the beat visuals, speaking this speaker's lines`)}).strict(),nPt=rI({speakers:sI(JNt,tPt.extend({lang:sI(jz,tPt).optional()}))}).default({speakers:{[YNt]:{provider:Sz.tts,voiceId:`shimmer`,displayName:{en:YNt}}}}),Pz=aI(`kind`,[rI({kind:uI(`url`),url:Mz}).strict(),rI({kind:uI(`base64`),data:X().min(1)}).strict(),rI({kind:uI(`path`),path:X().min(1)}).strict()]),rPt=aI(`kind`,[rI({kind:uI(`url`),url:Mz}).strict(),rI({kind:uI(`base64`),data:X().min(1)}).strict(),rI({kind:uI(`text`),text:X().min(1)}).strict(),rI({kind:uI(`path`),path:X().min(1)}).strict()]),iPt=rI({source:Pz,size:lI([`cover`,`contain`,`fill`,`auto`]).optional(),opacity:QF().min(0).max(1).optional()}),Fz=iI([X(),iPt]).nullable().optional(),Iz=iI([X(),nI(X())]),aPt=oI([Iz,Iz]),oPt=oI([Iz,Iz,Iz,Iz]),sPt=rI({header:Iz.optional(),"sidebar-left":Iz.optional()}),cPt=iI([rI({"row-2":aPt}),rI({"2x2":oPt}),rI({content:Iz})]),lPt=sPt.and(cPt),uPt=rI({type:uI(`markdown`),markdown:iI([Iz,lPt]),style:X().optional(),backgroundImage:Fz}).strict(),dPt=rI({type:uI(`web`),url:Mz}).strict(),fPt=rI({type:uI(`pdf`),source:Pz}).strict(),Lz={Image:`image`,ImagePrompt:`imagePrompt`,Movie:`movie`,MoviePrompt:`moviePrompt`,Beat:`beat`,VoiceOver:`voice_over`,Remotion:`remotion`};Lz.Movie,Lz.Beat,Lz.VoiceOver;var pPt=rI({type:uI(Lz.Image),source:Pz}).strict(),mPt=rI({type:uI(`svg`),source:Pz}).strict(),hPt=rI({type:uI(Lz.Movie),source:Pz}).strict(),gPt=rI({type:uI(Lz.MoviePrompt),prompt:X().min(1),imageName:X().optional().describe(`Reference an imageRefs key to use as image-to-video input`)}).strict(),_Pt=rI({type:uI(`textSlide`),slide:rI({title:X(),subtitle:X().optional(),bullets:nI(X()).optional()}),style:X().optional(),backgroundImage:Fz}).strict(),vPt=lI([`none`,`estimate`]).default(`none`),yPt=aI(`type`,[rI({type:uI(`none`)}),rI({type:uI(`delimiters`),delimiters:nI(X()).optional()})]),bPt=rI({lang:jz.optional(),styles:nI(X()).optional(),captionSplit:vPt.optional(),textSplit:yPt.optional(),bottomOffset:QF().min(0).max(100).optional()}).strict(),xPt=rI({type:uI(`chart`),title:X(),chartData:sI(X(),eI()),style:X().optional(),backgroundImage:Fz}).strict(),SPt=rI({type:uI(`mermaid`),title:X().describe(`The title of the diagram`),code:rPt.describe(`The code of the mermaid diagram`),appendix:nI(X()).optional().describe(`The appendix of the mermaid diagram; typically, style information.`),style:X().optional(),backgroundImage:Fz}).strict(),Rz=iI([QF(),X()]),CPt=rI({opacity:QF().min(0).max(1).optional(),rotate:QF().optional(),scale:iI([QF(),oI([QF(),QF()])]).optional(),translate:oI([QF(),QF()]).optional(),bc:X().optional(),timing:oI([QF(),QF()]).default([0,1]).optional().describe(`Animation timing [start, end] as ratio 0.0-1.0 of beat duration`)}).strict(),wPt=rI({style:lI([`vibrate`,`blink`,`wiggle`,`spin`,`shift`,`bounce`,`pulse`]),count:QF().optional().describe(`Number of loop iterations. 0 = infinite`),delta:QF().optional().describe(`Distance for vibrate / angle for wiggle`),duration:QF().optional().describe(`Duration of one cycle in seconds`),direction:lI([`n`,`s`,`e`,`w`]).optional().describe(`Direction for shift animation`),clockwise:$F().optional().describe(`Spin direction. Default: true`)}).strict(),TPt=rI({color:X().optional().default(`black`),offset:oI([QF(),QF()]).optional().default([1,1]),opacity:QF().optional().default(.5),radius:QF().optional().default(1)}).strict(),EPt=Cst(()=>rI({id:X().regex(IMt,`must start with a letter or underscore, then letters, digits, hyphens or underscores`).optional().describe(`Element id. Used as an HTML id and as a CSS selector in the generated animation script, so it must match [A-Za-z_][A-Za-z0-9_-]*.`),x:Rz.optional(),y:Rz.optional(),w:Rz.optional(),h:Rz.optional(),pos:oI([Rz,Rz]).optional().describe(`Position by anchor point [x, y]`),bc:X().optional().describe(`Background color`),opacity:QF().min(0).max(1).optional(),rotate:QF().optional(),scale:iI([QF(),oI([QF(),QF()])]).optional(),translate:oI([QF(),QF()]).optional(),cornerRadius:QF().optional(),borderWidth:QF().optional(),borderColor:X().optional(),shadow:TPt.optional(),clip:$F().optional(),text:X().optional(),fontSize:iI([QF(),X()]).optional(),fontWeight:X().optional(),textColor:X().optional(),textAlign:lI([`center`,`left`,`right`]).optional(),lineHeight:iI([QF(),X()]).optional(),img:X().optional().describe(`Image URL or image:ref`),imgFit:lI([`contain`,`cover`,`fill`]).optional().default(`contain`),to:CPt.optional().describe(`Transition animation`),loop:wPt.optional().describe(`Loop animation`),elements:nI(Cst(()=>EPt)).optional()}).strict()),DPt=iI([uI(!0),rI({fps:QF().min(1).max(60).optional().default(30),movie:$F().optional().describe(`Use CDP screencast for real-time recording (experimental, faster). Default: false (frame-by-frame screenshot).`)})]),OPt=rI({type:uI(`html_tailwind`),html:Iz.optional(),script:Iz.optional().describe(`JavaScript code for the beat. Injected as a <script> tag after html. Use for render() function etc.`),elements:nI(EPt).optional().describe(`Swipe-style declarative animation elements. Converted to HTML + render() automatically. Use this OR html, not both.`),animation:DPt.optional().describe(`Enable frame-based animation (Remotion-style). true for defaults (30fps), or { fps: N } for custom frame rate.`)}).strict(),kPt=rI({type:uI(Lz.Beat),id:X().optional().describe(`Specifies the beat to reference.`)}).strict(),APt=rI({type:uI(Lz.VoiceOver),startAt:QF().optional().describe(`The time to start the voice over the video in seconds.`)}).strict(),jPt=rI({type:uI(`vision`),style:X().min(1),data:sI(X(),eI())}).strict(),MPt=aI(`kind`,[rI({kind:uI(`text`),text:X().min(1)}).strict(),rI({kind:uI(`path`),path:X().min(1).describe(`Relative to the script`)}).strict()]),NPt={type:uI(Lz.Remotion),fps:QF().min(1).max(60).optional().describe(`Frame rate of the rendered video. Default: 30.`)},PPt=iI([rI({...NPt,prompt:X().min(1).describe(`What the scene shows. Claude Code (claude -p) writes a Remotion component from it.`)}).strict(),rI({...NPt,code:MPt.describe(`A finished Remotion component (TSX that default-exports the scene). It is rendered as is, without claude -p.`)}).strict()]),FPt=rI({brief:X().optional().describe(`Whole-video art direction shared by every remotion beat (palette, type, mood), so all scenes look like one film.`)}).strict(),IPt=iI([uPt,dPt,fPt,pPt,mPt,hPt,_Pt,xPt,SPt,OPt,kPt,APt,jPt,GNt,PPt]),LPt=iI([rI({type:uI(`audio`),source:Pz}).strict(),rI({type:uI(`midi`),source:X()}).strict()]),zz=X(),RPt=zz.refine(e=>!e.startsWith(`$`),{message:`image keys must not start with the reserved prefix "$"`}),zPt=rI({name:zz.optional().describe(`An imageRefs key to use as a reference image`),source:Pz.optional().describe(`Direct source (path/url) to use as a reference image`),label:X().optional().describe(`Role of this reference (e.g. 'the firefighter Travis Kane'), injected into the prompt as a preamble`)}).strict().refine(e=>e.name===void 0!=(e.source===void 0),{message:`specify exactly one of name or source`}),BPt=sI(RPt,iI([pPt,rI({type:uI(Lz.ImagePrompt),prompt:X().min(1),canvasSize:rI({width:QF(),height:QF()}).strict().optional(),referenceImageName:zz.optional().describe(`Reference another imageRefs key as input for image generation. Sugar for references[0].name`),referenceImage:Pz.optional().describe(`Direct source (path/url/base64) as reference image for generation. Sugar for references[0].source`),references:nI(zPt).optional().describe(`Reference images (by imageRefs key or direct source) with optional role labels`)}).strict(),hPt,gPt])),VPt=rI({style:lI([`aspectFit`,`aspectFill`]).optional().default(`aspectFit`)}).describe(`How to handle aspect ratio differences between image and canvas`),HPt=lI(Object.keys(_z)).optional();rI({provider:uI(`openai`),model:lI(_z.openai.models).optional(),quality:lI([`low`,`medium`,`high`,`auto`]).optional()}).strict(),rI({provider:uI(`google`),model:lI(_z.google.models).optional()}).strict();var UPt=rI({provider:HPt,model:X().optional(),quality:X().optional(),style:X().optional(),moderation:X().optional(),baseURL:X().optional(),apiVersion:X().optional(),vertexai_project:X().optional(),vertexai_location:X().optional()}).strict(),WPt=UPt.extend({images:BPt.optional(),backgroundImage:Fz,concurrency:QF().int().positive().optional().describe(`Max concurrent image generation requests`)}).strict(),GPt=rI({cssStyles:Iz}).strict(),KPt=rI({theme:Tz,branding:Az.optional()}).strict(),qPt=rI({padding:QF().optional().describe(`Padding between beats`),movieVolume:QF().min(0).max(1).optional().describe(`Audio volume of the imported or generated movie`)}).strict(),JPt=rI({model:X().optional()}).strict(),YPt=rI({padding:QF().optional().default(.3).describe(`Padding between beats`),introPadding:QF().optional().default(1).describe(`Padding at the beginning of the audio`),closingPadding:QF().optional().default(.8).describe(`Padding before the last beat (typically the closing credit). For padding after the last beat, use outroPadding`),outroPadding:QF().optional().default(1).describe(`Padding after the last beat, at the very end of the audio where the BGM fades out (distinct from closingPadding, which comes before the last beat)`),bgm:Pz.optional(),bgmVolume:QF().optional().default(.2).describe(`Volume of the background music`),audioVolume:QF().optional().default(1).describe(`Volume of the audio`),suppressSpeech:$F().optional().default(!1).describe(`Suppress speech generation`),movieVolume:QF().min(0).max(1).optional().describe(`Default movie audio volume for all beats`),ttsVolume:QF().min(0).max(2).optional().describe(`TTS narration volume before mixing with BGM/movie audio`),ducking:rI({ratio:QF().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:QF().int().positive().optional().describe(`Max concurrent TTS generation requests`)}).strict(),XPt=rI({systemPrompt:X().optional().default(``),prompt:X().min(1),data:eI().optional(),images:sI(X(),eI()).optional()}).strict(),ZPt=lI(Object.keys(xz)),QPt=rI({provider:lI(Object.keys(kMt)).default(Sz.soundEffect).optional(),model:X().optional()}),$Pt=rI({provider:X().optional(),model:X().optional()}),eFt=rI({type:lI([`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:QF().min(0).max(2).optional().default(.3)}),tFt=rI({imageName:zz.describe(`Reference an imageRefs key`),referenceType:lI([`ASSET`,`STYLE`]).describe(`ASSET: scene/object/character, STYLE: aesthetics/lighting`)}),nFt=rI({provider:ZPt.optional(),model:X().optional(),fillOption:VPt.optional(),transition:eFt.optional(),filters:nI(LMt).optional(),vertexai_project:X().optional(),vertexai_location:X().optional(),firstFrameImageName:zz.optional().describe(`Reference an imageRefs key for the first frame (image-to-video input), or '$beatImage' for the beat's own generated image`),lastFrameImageName:zz.optional().describe(`Reference an imageRefs key for the last frame (image-to-video interpolation), or '$beatImage' for the beat's own generated image`),frameFillColor:X().regex(/^(#|0x)?[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$|^[a-zA-Z]+$/,`must be a hex color ('#RRGGBB[AA]', '0x' or no prefix) or a color name`).optional().describe(`Fill color used when padding firstFrame/lastFrame reference images to the canvas aspect ratio (e.g. '#F7F6F4'). Default: black`),referenceImages:nI(tFt).optional().describe(`Style/asset reference images (Veo 3.1). Mutually exclusive with imageName/lastFrameImageName`),concurrency:QF().int().positive().optional().describe(`Max concurrent movie generation requests`),generateAudio:$F().optional().describe(`Request audio generation in the video (model-dependent)`)}),Bz=rI({speaker:JNt.optional(),text:X().optional().default(``).describe(`Text to be spoken. If empty, the audio is not generated.`),texts:nI(X()).optional().describe(`Manually split texts for captions. Takes precedence over text for caption display.`),id:X().optional().describe(`Unique identifier for the beat.`),description:X().optional(),image:IPt.optional(),audio:LPt.optional(),duration:QF().optional().describe(`Duration of the beat. Used only when the text is empty`),imageParams:UPt.optional(),audioParams:qPt.optional(),movieParams:nFt.extend({speed:QF().optional().describe(`Speed of the video. 1.0 is normal speed. 0.5 is half speed. 2.0 is double speed.`)}).optional(),soundEffectParams:QPt.optional(),lipSyncParams:$Pt.optional(),avatarParams:ePt.optional(),htmlImageParams:JPt.optional(),speechOptions:qNt.optional(),textSlideParams:GPt.optional(),captionParams:bPt.optional(),images:BPt.optional().describe(`Beat-local media references. Same schema as imageParams.images. Merged with global refs (local takes precedence).`),imageNames:nI(RPt).optional(),imagePrompt:X().optional(),moviePrompt:X().optional(),soundEffectPrompt:X().optional(),htmlPrompt:XPt.optional(),enableLipSync:$F().optional().describe(`Enable lip sync generation for this beat`),hidden:$F().optional().describe(`Hide this beat from the presentation`)}).strict(),rFt=rI({width:QF(),height:QF()}).default({width:1280,height:720}),iFt=rI({version:uI(`1.1`),credit:uI(`closing`).optional()}).strict(),aFt=lI(MMt).default(Sz.text2Html);rI({provider:uI(`google`),model:lI(xz.google.models).optional()}).strict(),rI({provider:uI(`replicate`),model:lI(xz.replicate.models).optional()}).strict();var oFt=rI({$mulmocast:iFt,canvasSize:rFt,speechParams:nPt,imageParams:WPt.optional().default({provider:Sz.text2image,images:{}}),movieParams:nFt.optional().default({provider:Sz.text2movie}),soundEffectParams:QPt.optional().default({provider:Sz.soundEffect}),lipSyncParams:$Pt.optional(),avatarParams:ePt.optional(),htmlImageParams:JPt.extend({provider:aFt}).optional(),textSlideParams:GPt.optional(),slideParams:KPt.optional(),remotionParams:FPt.optional(),captionParams:bPt.optional(),audioParams:YPt.default({introPadding:1,padding:.3,closingPadding:.8,outroPadding:1,bgmVolume:.2,audioVolume:1,suppressSpeech:!1})}),Vz=rI({url:Mz,title:X().optional(),description:X().optional(),type:iI([lI([`article`,`paper`,`image`,`video`,`audio`]),X()]).optional().default(`article`)}),Hz=oFt.extend({title:X().optional(),description:X().optional(),references:nI(Vz).optional(),lang:jz.optional().default(`en`),beats:nI(Bz).min(1),imagePath:X().optional(),__test_invalid__:$F().optional()}).strict(),sFt=rI({id:X().optional().describe(`Unique identifier for the beat.`),hash:X().optional(),duration:QF().optional(),startAt:QF().optional(),audioDuration:QF().optional(),movieDuration:QF().optional(),silenceDuration:QF().optional(),hasMovieAudio:$F().optional(),audioFile:X().optional(),imageFile:X().optional(),movieFile:X().optional(),soundEffectFile:X().optional(),lipSyncFile:X().optional(),captionFile:X().optional(),captionFiles:nI(rI({file:X(),startAt:QF(),endAt:QF()})).optional(),htmlImageFile:X().optional(),markdown:X().optional(),html:X().optional()}).strict(),cFt=rI({multiLingualTexts:KNt,cacheKey:X().optional()});nI(cFt).min(1);var lFt=sI(X(),cFt);rI({version:uI(`1.1`),multiLingual:lFt}),rI({inSession:rI({audio:$F(),image:$F(),video:$F(),multiLingual:$F(),caption:$F(),pdf:$F(),markdown:$F(),html:$F(),viewer:$F()}),inBeatSession:rI({audio:sI(X(),$F()),image:sI(X(),$F()),movie:sI(X(),$F()),multiLingual:sI(X(),$F()),caption:sI(X(),$F()),html:sI(X(),$F()),imageReference:sI(X(),$F()),soundEffect:sI(X(),$F()),lipSync:sI(X(),$F())})});var uFt=rI({speaker:X(),file:X(),width:QF(),height:QF(),placements:nI(rI({start:QF(),end:QF(),x:QF(),y:QF(),width:QF(),height:QF()}).strict())}).strict();rI({script:Hz,filename:X(),beats:nI(sFt).min(1),avatarTracks:nI(uFt).optional()}).strict(),rI({title:X(),description:X(),systemPrompt:X(),scriptName:X().optional(),presentationStyle:oFt.optional()}).strict().extend({filename:X()});var dFt=rI({description:X(),references:nI(Vz).optional()}).describe(`A detailed description of the content of the scene, not the presentation style`).strict();rI({title:X(),references:nI(Vz).optional(),scenes:nI(dFt)}).describe(`A storyboard for a presentation, a story, a video, etc.`).strict(),rI({beats:nI(rI({id:X().optional(),text:X().optional(),duration:QF().optional(),startTime:QF().optional(),endTime:QF().optional(),importance:QF().optional(),multiLinguals:sI(X(),X()).optional(),audioSources:sI(X(),X().optional()).optional(),imageSource:X().optional(),videoSource:X().optional(),videoWithAudioSource:X().optional(),htmlImageSource:X().optional(),soundEffectSource:X().optional()})),bgmSource:X().optional(),bgmFile:X().optional(),title:X().optional(),lang:X().optional()});var fFt=`presentMulmoScript`,Uz=`remotion-component-guide.md`,pFt=`Save and present a MulmoScript story or presentation as a visual storyboard in the canvas.
417
417
 
418
418
  Provide EXACTLY ONE of \`script\` or \`filePath\`:
419
419
 
@@ -5697,7 +5697,7 @@ First, I need to consider the requirements:
5697
5697
  3. Code should be readable
5698
5698
  </think>
5699
5699
 
5700
- Based on my analysis, here's my recommendation...`,role:`assistant`}},{name:`With Transport`,args:{text:`This response came from a specific transport provider.`,role:`assistant`,transportKind:`openai-realtime`}}];o(),we();var VOn=[`src`,`alt`,`title`,`data-variant`],HOn=[`title`,`data-variant`],UOn={class:`truncate`},p4=K({__name:`SentAttachmentChip`,props:{path:{},filename:{default:``},variant:{default:`thumb`}},setup(e){let t=e,n=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`,`.svg`]),r=m(()=>{let e=t.path.lastIndexOf(`.`);return e>=0?t.path.slice(e).toLowerCase():``}),i=m(()=>{let e=t.path.lastIndexOf(`/`);return e>=0?t.path.slice(e+1):t.path}),a=m(()=>t.filename||i.value),o=m(()=>t.filename?`${t.filename} (${i.value})`:i.value),s=m(()=>n.has(r.value)),l=m(()=>`${SP.files.raw}?path=${encodeURIComponent(t.path)}`),u=m(()=>t.variant===`block`?`block w-full max-h-[60vh] object-contain rounded-lg border border-gray-200 bg-gray-50`:`block max-h-16 max-w-24 object-contain rounded border border-gray-300 bg-white`),d=m(()=>{let e=`inline-flex items-center gap-1.5 border border-gray-300 bg-white rounded text-gray-700`;return t.variant===`block`?`${e} px-3 py-2 text-sm max-w-full`:`${e} px-2 py-1 text-xs`}),f=m(()=>t.variant===`block`?`text-xl`:`text-base`),p=m(()=>{switch(r.value){case`.pdf`:return`picture_as_pdf`;case`.docx`:return`description`;case`.xlsx`:case`.csv`:return`table_chart`;case`.pptx`:return`slideshow`;case`.txt`:case`.md`:return`article`;case`.json`:case`.xml`:case`.yaml`:case`.yml`:case`.toml`:return`data_object`;default:return`insert_drive_file`}}),h=m(()=>{switch(r.value){case`.pdf`:return`text-red-500`;case`.docx`:return`text-blue-500`;case`.xlsx`:case`.csv`:return`text-green-600`;case`.pptx`:return`text-orange-500`;default:return`text-gray-500`}});return(t,n)=>s.value?(B(),U(`img`,{key:0,src:l.value,alt:a.value,title:o.value,class:c(u.value),"data-testid":`sent-attachment-chip`,"data-variant":e.variant},null,10,VOn)):(B(),U(`div`,{key:1,title:o.value,class:c(d.value),"data-testid":`sent-attachment-chip`,"data-variant":e.variant},[S(`span`,{class:c([`material-icons`,[h.value,f.value]])},T(p.value),3),S(`span`,UOn,T(a.value),1)],10,HOn))}});function WOn(e){let t=e.indexOf(`#`),n=e.indexOf(`?`),r=e.length;return t!==-1&&t<r&&(r=t),n!==-1&&n<r&&(r=n),e.slice(0,r)}function GOn(e){if(e.length===0)return null;let t=[];for(let n of e.split(`/`))if(n!==``&&n!==`.`){if(n===`..`){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.length===0?null:t.join(`/`)}function KOn(e,t){let n=e.split(`/`).pop()??``;return n===``?t:n}function m4(e){if(!e||e.startsWith(`//`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`mailto:`)||e.startsWith(`tel:`)||e.startsWith(`ftp://`))return!0;let t=e.indexOf(`:`);if(t>0){let n=e.indexOf(`/`);if(n===-1||n>t)return!0}return!1}function qOn(e,t){if(!t||m4(t)||t.startsWith(`#`))return null;let n=WOn(t);if(n.length===0)return null;let r;if(n.startsWith(`/`))r=n.slice(1);else{let t=YOn(e);r=t===``?n:`${t}/${n}`}return GOn(r)}function JOn(e){if(!e.startsWith(`chat/`)||!e.endsWith(`.jsonl`))return null;let t=e.slice(5,e.length-6);return t.length===0||t.includes(`/`)?null:t}function YOn(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var XOn=/(?:data\/)?wiki\/pages\/([^/]+)\.md$/,ZOn=`conversations/`,QOn=new Set(Object.values(CP).filter(e=>e!==CP.chat&&e!==CP.files)),$On=new Set([`calendar`,`scheduler`]);function h4(e){if(!e||m4(e)||e.startsWith(`#`))return null;let t=WOn(e);if(t.length===0)return null;let n=GOn(tkn(t));if(!n)return null;let r=n.match(XOn)?.[1];if(r!==void 0)return{kind:`wiki`,slug:r};if(n.startsWith(ZOn)){let e=JOn(n.slice(14));if(e)return{kind:`session`,sessionId:e}}let[i=``,...a]=n.split(`/`);return(QOn.has(i)||$On.has(i))&&!a.some(rkn)?{kind:`spa-route`,path:`/${n}${ikn(e)}`}:{kind:`file`,path:n}}function ekn(e,t){return m4(e)?e:e.startsWith(`./`)||e.startsWith(`../`)||!e.includes(`/`)?`${t}/${e}`:e}function tkn(e){return e.split(`/`).map(nkn).join(`/`)}function nkn(e){if(/%2[fF]/.test(e))return e;try{return decodeURIComponent(e)}catch{return e}}function rkn(e){return/\.[a-zA-Z0-9]{1,8}$/.test(e)}function ikn(e){let t=e.indexOf(`?`);if(t===-1)return``;let n=e.indexOf(`#`);if(n!==-1&&n<t)return``;let r=n===-1?e.length:n;return e.slice(t,r)}o();var akn=Symbol(`appApi`);function okn(e){C(akn,e)}function g4(){let e=Re(akn);if(!e)throw Error(`useAppApi() called outside an App.vue subtree — provideAppApi must run first.`);return e}function skn(e,t,n,r){let{baseDir:i,stripFrontmatter:a,marp:o}=r;return _N(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({markdown:t,filename:n,baseDir:i,stripFrontmatter:a,marp:o})})}M();function ckn(){let e=V(!1),t=V(null);async function n(n,r,i={}){t.value=null,e.value=!0;let a=null;try{let e=await skn(SP.pdf.markdown,n,r,i);if(!e.ok){let n=await e.text().catch(()=>``);t.value=`PDF error ${e.status}: ${n}`;return}let o=await e.blob();a=URL.createObjectURL(o);let s=document.createElement(`a`);s.href=a,s.download=r,s.click()}catch(e){t.value=ot(e)}finally{a&&URL.revokeObjectURL(a),e.value=!1}}return{pdfDownloading:e,pdfError:t,downloadPdf:n}}M();function lkn(){let e=V(!1),t=V(!1);async function n(n,r,i={}){t.value=!1,e.value=!0;try{let e=await skn(SP.share.packMarkdown,n,r,i);if(!e.ok){t.value=!0;return}KU(await e.blob(),Y3t(e.headers.get(`content-disposition`),`${r}.zip`))}catch{t.value=!0}finally{e.value=!1}}return{zipDownloading:e,zipFailed:t,downloadZip:n}}var ukn=50,dkn=2e4;function fkn(e,t){let n=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(n)?n.slice(0,-1):n}function pkn(e){let t=e.length;if(t<=1e5)return{displayText:e,wasTruncated:!1,originalChars:t,omittedChars:0};let n=fkn(e,dkn);return{displayText:n,wasTruncated:!0,originalChars:t,omittedChars:t-n.length}}function mkn(e){let t=null,n=!1;for(let r of e.split(`
5700
+ Based on my analysis, here's my recommendation...`,role:`assistant`}},{name:`With Transport`,args:{text:`This response came from a specific transport provider.`,role:`assistant`,transportKind:`openai-realtime`}}];o(),we();var VOn=[`src`,`alt`,`title`,`data-variant`],HOn=[`title`,`data-variant`],UOn={class:`truncate`},p4=K({__name:`SentAttachmentChip`,props:{path:{},filename:{default:``},variant:{default:`thumb`}},setup(e){let t=e,n=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`,`.svg`]),r=m(()=>{let e=t.path.lastIndexOf(`.`);return e>=0?t.path.slice(e).toLowerCase():``}),i=m(()=>{let e=t.path.lastIndexOf(`/`);return e>=0?t.path.slice(e+1):t.path}),a=m(()=>t.filename||i.value),o=m(()=>t.filename?`${t.filename} (${i.value})`:i.value),s=m(()=>n.has(r.value)),l=m(()=>`${SP.files.raw}?path=${encodeURIComponent(t.path)}`),u=m(()=>t.variant===`block`?`block w-full max-h-[60vh] object-contain rounded-lg border border-gray-200 bg-gray-50`:`block max-h-16 max-w-24 object-contain rounded border border-gray-300 bg-white`),d=m(()=>{let e=`inline-flex items-center gap-1.5 border border-gray-300 bg-white rounded text-gray-700`;return t.variant===`block`?`${e} px-3 py-2 text-sm max-w-full`:`${e} px-2 py-1 text-xs`}),f=m(()=>t.variant===`block`?`text-xl`:`text-base`),p=m(()=>{switch(r.value){case`.pdf`:return`picture_as_pdf`;case`.docx`:return`description`;case`.xlsx`:case`.csv`:return`table_chart`;case`.pptx`:return`slideshow`;case`.txt`:case`.md`:return`article`;case`.json`:case`.xml`:case`.yaml`:case`.yml`:case`.toml`:return`data_object`;default:return`insert_drive_file`}}),h=m(()=>{switch(r.value){case`.pdf`:return`text-red-500`;case`.docx`:return`text-blue-500`;case`.xlsx`:case`.csv`:return`text-green-600`;case`.pptx`:return`text-orange-500`;default:return`text-gray-500`}});return(t,n)=>s.value?(B(),U(`img`,{key:0,src:l.value,alt:a.value,title:o.value,class:c(u.value),"data-testid":`sent-attachment-chip`,"data-variant":e.variant},null,10,VOn)):(B(),U(`div`,{key:1,title:o.value,class:c(d.value),"data-testid":`sent-attachment-chip`,"data-variant":e.variant},[S(`span`,{class:c([`material-icons`,[h.value,f.value]])},T(p.value),3),S(`span`,UOn,T(a.value),1)],10,HOn))}});function WOn(e){let t=e.indexOf(`#`),n=e.indexOf(`?`),r=e.length;return t!==-1&&t<r&&(r=t),n!==-1&&n<r&&(r=n),e.slice(0,r)}function GOn(e){if(e.length===0)return null;let t=[];for(let n of e.split(`/`))if(n!==``&&n!==`.`){if(n===`..`){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.length===0?null:t.join(`/`)}function KOn(e,t){let n=e.split(`/`).pop()??``;return n===``?t:n}function m4(e){if(!e||e.startsWith(`//`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`mailto:`)||e.startsWith(`tel:`)||e.startsWith(`ftp://`))return!0;let t=e.indexOf(`:`);if(t>0){let n=e.indexOf(`/`);if(n===-1||n>t)return!0}return!1}function qOn(e,t){if(!t||m4(t)||t.startsWith(`#`))return null;let n=WOn(t);if(n.length===0)return null;let r;if(n.startsWith(`/`))r=n.slice(1);else{let t=YOn(e);r=t===``?n:`${t}/${n}`}return GOn(r)}function JOn(e){if(!e.startsWith(`chat/`)||!e.endsWith(`.jsonl`))return null;let t=e.slice(5,e.length-6);return t.length===0||t.includes(`/`)?null:t}function YOn(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var XOn=/(?:data\/)?wiki\/pages\/([^/]+)\.md$/,ZOn=`conversations/`,QOn=new Set(Object.values(CP).filter(e=>e!==CP.chat&&e!==CP.files)),$On=new Set([`calendar`,`scheduler`]);function h4(e){if(!e||m4(e)||e.startsWith(`#`))return null;let t=WOn(e);if(t.length===0)return null;let n=GOn(tkn(t));if(!n)return null;let r=n.match(XOn)?.[1];if(r!==void 0)return{kind:`wiki`,slug:r};let i=JOn(n.startsWith(ZOn)?n.slice(14):n);if(i)return{kind:`session`,sessionId:i};let[a=``,...o]=n.split(`/`);return(QOn.has(a)||$On.has(a))&&!o.some(rkn)?{kind:`spa-route`,path:`/${n}${ikn(e)}`}:{kind:`file`,path:n}}function ekn(e,t){return m4(e)?e:e.startsWith(`./`)||e.startsWith(`../`)||!e.includes(`/`)?`${t}/${e}`:e}function tkn(e){return e.split(`/`).map(nkn).join(`/`)}function nkn(e){if(/%2[fF]/.test(e))return e;try{return decodeURIComponent(e)}catch{return e}}function rkn(e){return/\.[a-zA-Z0-9]{1,8}$/.test(e)}function ikn(e){let t=e.indexOf(`?`);if(t===-1)return``;let n=e.indexOf(`#`);if(n!==-1&&n<t)return``;let r=n===-1?e.length:n;return e.slice(t,r)}o();var akn=Symbol(`appApi`);function okn(e){C(akn,e)}function g4(){let e=Re(akn);if(!e)throw Error(`useAppApi() called outside an App.vue subtree — provideAppApi must run first.`);return e}function skn(e,t,n,r){let{baseDir:i,stripFrontmatter:a,marp:o}=r;return _N(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({markdown:t,filename:n,baseDir:i,stripFrontmatter:a,marp:o})})}M();function ckn(){let e=V(!1),t=V(null);async function n(n,r,i={}){t.value=null,e.value=!0;let a=null;try{let e=await skn(SP.pdf.markdown,n,r,i);if(!e.ok){let n=await e.text().catch(()=>``);t.value=`PDF error ${e.status}: ${n}`;return}let o=await e.blob();a=URL.createObjectURL(o);let s=document.createElement(`a`);s.href=a,s.download=r,s.click()}catch(e){t.value=ot(e)}finally{a&&URL.revokeObjectURL(a),e.value=!1}}return{pdfDownloading:e,pdfError:t,downloadPdf:n}}M();function lkn(){let e=V(!1),t=V(!1);async function n(n,r,i={}){t.value=!1,e.value=!0;try{let e=await skn(SP.share.packMarkdown,n,r,i);if(!e.ok){t.value=!0;return}KU(await e.blob(),Y3t(e.headers.get(`content-disposition`),`${r}.zip`))}catch{t.value=!0}finally{e.value=!1}}return{zipDownloading:e,zipFailed:t,downloadZip:n}}var ukn=50,dkn=2e4;function fkn(e,t){let n=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(n)?n.slice(0,-1):n}function pkn(e){let t=e.length;if(t<=1e5)return{displayText:e,wasTruncated:!1,originalChars:t,omittedChars:0};let n=fkn(e,dkn);return{displayText:n,wasTruncated:!0,originalChars:t,omittedChars:t-n.length}}function mkn(e){let t=null,n=!1;for(let r of e.split(`
5701
5701
  `)){let e=r.trim();if(e){if(/^(```|~~~)/.test(e)){n=!n,t===null&&(t=e);continue}if(!n&&e.startsWith(`# `))return e.slice(2).trim().slice(0,ukn);t===null&&(t=e)}}return(t??``).slice(0,ukn)}var hkn=/^\s*(```|~~~)/;function gkn(e){let t=[],n=[],r=!1,i=e=>{n.length>0&&(t.push({code:e,text:n.join(`
5702
5702
  `)}),n=[])};for(let t of e.split(`
5703
5703
  `)){if(!hkn.test(t)){n.push(t);continue}r?(n.push(t),i(!0),r=!1):(i(!1),r=!0,n.push(t))}return i(r),t}var _kn=/<think>([\s\S]*?)<\/think>/g;function vkn(e,t){return gkn(e).map(e=>e.code?e.text:e.text.replace(_kn,(e,n)=>`<div class="think-block">${t(n.trim())}</div>`)).join(`
@@ -5900,7 +5900,7 @@ end`};t.events.push([`putFont`,function(t){(function(t){var n=t.font,i=t.out,a=t
5900
5900
 
5901
5901
  ---
5902
5902
 
5903
- `),i=T$n(t);return r.length>0?`${i}\n\n${r}\n`:`${i}\n`}o(),M(),we();var D$n=[`disabled`,`title`,`aria-label`],O$n={class:`material-icons text-lg`,"aria-hidden":`true`},k$n=1500,A$n=K({__name:`CopyChatButton`,props:{results:{},resultTimestamps:{},sessionRoleName:{}},setup(e){let{t}=We(),n=e,r=V(!1),i=null;async function a(e){let t=await pN(SP.files.content,{path:e});return t.ok?t.data.content??null:null}async function o(){let e=await E$n(n.results,{sessionRoleName:n.sessionRoleName,resultTimestamps:n.resultTimestamps,readFile:a});try{await navigator.clipboard.writeText(e),r.value=!0,i!==null&&clearTimeout(i),i=setTimeout(()=>{r.value=!1,i=null},k$n)}catch{}}return _(()=>{i!==null&&clearTimeout(i)}),(n,i)=>(B(),U(`button`,{type:`button`,class:c([`h-8 w-8 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,{"!text-green-600":r.value}]),"data-testid":`copy-chat-md`,disabled:e.results.length===0,title:r.value?q(t)(`sidebarHeader.copiedMarkdown`):q(t)(`sidebarHeader.copyMarkdown`),"aria-label":r.value?q(t)(`sidebarHeader.copiedMarkdown`):q(t)(`sidebarHeader.copyMarkdown`),onClick:o},[S(`span`,O$n,T(r.value?`check`:`content_copy`),1)],10,D$n))}});o(),M(),we();var j$n={class:`flex-1 min-h-0 flex flex-col bg-gray-100`},M$n={class:`shrink-0 flex items-center gap-2 text-xs text-gray-400 px-3 py-2 border-b border-gray-100`,"data-testid":`sidebar-role-header`},N$n={key:1,class:`truncate`},P$n={class:`ml-auto flex items-center gap-0.5 shrink-0`},F$n=[`title`,`aria-label`,`aria-pressed`],I$n={class:`relative flex-1 min-h-0 flex flex-col`},L$n=[`onClick`],R$n={class:`absolute top-0 left-2 -translate-y-1/2 bg-gray-100 px-1 text-[10px] text-gray-400 leading-none pointer-events-none`},z$n={key:0,class:`absolute top-0 right-2 -translate-y-1/2 bg-gray-100 px-1 text-[10px] text-gray-400 leading-none pointer-events-none`},B$n={key:2,class:`block truncate p-2`},V$n=Qe(K({__name:`SessionSidebar`,props:{results:{},selectedUuid:{},resultTimestamps:{},sessionRoleName:{},sessionRoleIcon:{},sessionModel:{},sessionModelOverride:{},layoutMode:{},showRightSidebar:{type:Boolean},hasNewMessages:{type:Boolean}},emits:[`select`,`activate`,`update:layoutMode`,`toggle-right-sidebar`,`jump-to-latest`,`update:sessionModelOverride`],setup(e,{expose:t,emit:n}){let{t:r}=We();function i(e){if(e.toolName===`text-response`)return e.title??`Assistant`;let t=Ma(e)?e.action:void 0;return typeof t==`string`&&t.length>0?`${e.toolName}(${t})`:e.toolName}let a=n,o=V(null);return t({root:o}),(t,n)=>(B(),U(`div`,j$n,[S(`div`,M$n,[e.sessionRoleIcon?(B(),U(`span`,{key:0,class:c([`material-icons text-xs leading-none`,q(h9)])},T(e.sessionRoleIcon),3)):b(``,!0),e.sessionRoleName?(B(),U(`span`,N$n,T(e.sessionRoleName),1)):b(``,!0),e.sessionRoleName?(B(),ke(o$n,{key:2,model:e.sessionModel,override:e.sessionModelOverride,"onUpdate:override":n[0]||=e=>a(`update:sessionModelOverride`,e)},null,8,[`model`,`override`])):b(``,!0),S(`div`,P$n,[De(A$n,{results:e.results,"result-timestamps":e.resultTimestamps,"session-role-name":e.sessionRoleName},null,8,[`results`,`result-timestamps`,`session-role-name`]),S(`button`,{type:`button`,class:c([`h-8 w-8 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-colors`,{"!text-blue-500":e.showRightSidebar}]),title:q(r)(`sidebarHeader.toolCallHistory`),"aria-label":q(r)(`sidebarHeader.toolCallHistory`),"aria-pressed":e.showRightSidebar,onClick:n[1]||=e=>a(`toggle-right-sidebar`)},[...n[5]||=[S(`span`,{class:`material-icons text-lg`,"aria-hidden":`true`},`build`,-1)]],10,F$n),De(KQn,{"model-value":e.layoutMode,"onUpdate:modelValue":n[2]||=e=>a(`update:layoutMode`,e)},null,8,[`model-value`])])]),S(`div`,I$n,[e.hasNewMessages?(B(),U(`button`,{key:0,type:`button`,class:`absolute bottom-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 rounded-full bg-blue-600 px-3 py-1.5 text-xs font-medium text-white shadow-lg hover:bg-blue-700 transition-colors`,"data-testid":`chat-new-messages`,onClick:n[3]||=e=>a(`jump-to-latest`)},[J(T(q(r)(`sidebarHeader.newMessages`))+` `,1),n[6]||=S(`span`,{class:`material-icons text-sm leading-none`,"aria-hidden":`true`},`arrow_downward`,-1)])):b(``,!0),S(`div`,{ref_key:`root`,ref:o,class:`flex-1 min-h-0 overflow-y-auto p-2 space-y-2 outline-none`,tabindex:`0`,"data-testid":`tool-results-scroll`,onMousedown:n[4]||=e=>a(`activate`)},[(B(!0),U(D,null,H(e.results,t=>(B(),U(`div`,{key:t.uuid,class:c([`relative cursor-pointer rounded border border-gray-300 text-sm text-gray-900 hover:opacity-75 transition-opacity`,t.uuid===e.selectedUuid?`ring-2 ring-blue-500`:``]),onClick:e=>a(`select`,t.uuid)},[S(`span`,R$n,T(i(t)),1),e.resultTimestamps.get(t.uuid)?(B(),U(`span`,z$n,T(q(oz)(e.resultTimestamps.get(t.uuid))),1)):b(``,!0),q(O5)(t.toolName)?.previewComponent?(B(),ke(fe(q(O5)(t.toolName)?.previewComponent),{key:1,result:t},null,8,[`result`])):(B(),U(`span`,B$n,T(t.title||t.toolName),1))],10,L$n))),128))],544)])]))}}),[[`__scopeId`,`data-v-1abed690`]]),C9=1e3,w9=60*C9,H$n=60*w9;function U$n(e){let t=e>0?e:0;return t<C9?`${(Math.floor(t/100)/10).toFixed(1)}s`:t<w9?`${Math.floor(t/C9)}s`:t<H$n?`${Math.floor(t/w9)}m ${Math.floor(t%w9/C9)}s`:`${Math.floor(t/H$n)}h ${Math.floor(t%H$n/w9)}m`}o(),we(),M();var W$n={class:`px-2 py-1 text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`thinking-indicator`},G$n={class:`flex items-center gap-2 text-gray-500`},K$n={class:`text-xs`},q$n={key:0,class:`text-xs text-gray-400 tabular-nums`,"data-testid":`run-elapsed`},J$n={key:0,class:`mt-1 space-y-0.5`},Y$n={class:`font-mono truncate`},X$n={class:`text-xs text-gray-300 tabular-nums shrink-0`},Z$n=K({__name:`ThinkingIndicator`,props:{statusMessage:{},runElapsedMs:{default:null},pendingCalls:{default:()=>[]}},setup(e){return(t,n)=>(B(),U(`div`,W$n,[S(`div`,G$n,[S(`span`,K$n,T(e.statusMessage),1),n[0]||=S(`span`,{class:`flex gap-1`,"aria-hidden":`true`},[S(`span`,{class:`w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce`,style:{"animation-delay":`0ms`}}),S(`span`,{class:`w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce`,style:{"animation-delay":`150ms`}}),S(`span`,{class:`w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce`,style:{"animation-delay":`300ms`}})],-1),e.runElapsedMs!==null&&e.runElapsedMs>=1e3?(B(),U(`span`,q$n,` · `+T(q(U$n)(e.runElapsedMs)),1)):b(``,!0)]),e.pendingCalls&&e.pendingCalls.length>0?(B(),U(`div`,J$n,[(B(!0),U(D,null,H(e.pendingCalls,e=>(B(),U(`div`,{key:e.toolUseId,class:`flex items-center gap-1.5 text-xs text-gray-400`},[n[1]||=S(`span`,{class:`w-1.5 h-1.5 rounded-full bg-blue-300 shrink-0 animate-pulse`,"aria-hidden":`true`},null,-1),S(`span`,Y$n,T(e.toolName),1),S(`span`,X$n,`· `+T(q(U$n)(e.elapsedMs)),1)]))),128))])):b(``,!0)]))}});o(),M(),we();var Q$n=[`title`],$$n=[`title`],e1n=K({__name:`SessionCountBadges`,props:{activeSessionCount:{},unreadCount:{}},setup(e){let{t}=We();return(n,r)=>(B(),U(D,null,[e.activeSessionCount>0?(B(),U(`span`,{key:0,class:`absolute -top-0.5 -left-0.5 min-w-[1rem] h-4 px-0.5 bg-yellow-400 text-white text-[10px] font-bold rounded-full flex items-center justify-center leading-none cursor-help`,"data-testid":`session-count-active`,title:q(t)(`sessionTabBar.activeSessions`,e.activeSessionCount,{named:{count:e.activeSessionCount}})},T(e.activeSessionCount),9,Q$n)):b(``,!0),e.unreadCount>0?(B(),U(`span`,{key:1,class:`absolute -top-0.5 -right-0.5 min-w-[1rem] h-4 px-0.5 bg-red-500 text-white text-[10px] font-bold rounded-full flex items-center justify-center leading-none cursor-help`,"data-testid":`session-count-unread`,title:q(t)(`sessionTabBar.unreadReplies`,e.unreadCount,{named:{count:e.unreadCount}})},T(e.unreadCount),9,$$n)):b(``,!0)],64))}});o(),M(),we();var t1n=[`title`,`aria-label`,`aria-expanded`],n1n=[`aria-label`],r1n={class:`px-3 py-2 text-xs font-semibold text-gray-500 border-b border-gray-100`},i1n={class:`max-h-64 overflow-y-auto py-1 [scrollbar-width:thin]`},a1n=[`data-testid`],o1n=[`title`],s1n=[`title`,`aria-label`,`disabled`,`data-testid`,`onClick`],c1n=[`title`,`aria-label`,`disabled`,`data-testid`,`onClick`],l1n=K({__name:`ShortcutReorderPopover`,setup(e){let{t}=We(),{shortcuts:n,movePinned:r}=mL(),i=V(!1),a=V(null),o=V(null),s=V(null);async function l(e,t){await r(e.kind,e.slug,t)}let{handler:u}=C4({isOpen:i,buttonRef:o,popupRef:s});function d(e){e.key===`Escape`&&i.value&&(i.value=!1)}return P(()=>{document.addEventListener(`mousedown`,u),document.addEventListener(`keydown`,d)}),k(()=>{document.removeEventListener(`mousedown`,u),document.removeEventListener(`keydown`,d)}),(e,r)=>(B(),U(`div`,{ref_key:`wrapper`,ref:a,class:`relative inline-flex flex-none`},[S(`button`,{ref_key:`trigger`,ref:o,type:`button`,class:c([`h-8 w-8 flex items-center justify-center border border-gray-300 rounded bg-white text-gray-600 hover:bg-gray-50 transition-colors`,{"bg-blue-50 text-blue-600":i.value}]),title:q(t)(`shortcuts.reorder.open`),"aria-label":q(t)(`shortcuts.reorder.open`),"aria-expanded":i.value,"aria-haspopup":`true`,"data-testid":`shortcut-reorder-open`,onClick:r[0]||=e=>i.value=!i.value},[...r[1]||=[S(`span`,{class:`material-icons text-base`},`edit`,-1)]],10,t1n),i.value?(B(),U(`div`,{key:0,ref_key:`panel`,ref:s,class:`absolute right-0 top-full mt-1 z-50 w-64 max-w-[80vw] bg-white border border-gray-200 rounded-lg shadow-lg overflow-hidden`,role:`dialog`,"aria-label":q(t)(`shortcuts.reorder.title`),"data-testid":`shortcut-reorder-panel`},[S(`div`,r1n,T(q(t)(`shortcuts.reorder.title`)),1),S(`ul`,i1n,[(B(!0),U(D,null,H(q(n),(e,i)=>(B(),U(`li`,{key:`${e.kind}:${e.slug}`,class:`flex items-center gap-2 px-3 py-1 text-sm text-gray-900`,"data-testid":`shortcut-reorder-row-${e.kind}-${e.slug}`},[S(`span`,{class:c([`h-6 w-6 rounded flex items-center justify-center flex-none`,q(Tt)(e.color)??`text-gray-500`])},[De(q(Wa),{icon:e.icon,"size-class":`text-base`},null,8,[`icon`])],2),S(`span`,{class:`flex-1 truncate`,title:e.title},T(e.title),9,o1n),S(`button`,{type:`button`,class:`h-6 w-6 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent`,title:q(t)(`shortcuts.reorder.moveUp`),"aria-label":q(t)(`shortcuts.reorder.moveUp`),disabled:i===0,"data-testid":`shortcut-reorder-up-${e.kind}-${e.slug}`,onClick:t=>l(e,`up`)},[...r[2]||=[S(`span`,{class:`material-icons text-base`},`arrow_upward`,-1)]],8,s1n),S(`button`,{type:`button`,class:`h-6 w-6 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent`,title:q(t)(`shortcuts.reorder.moveDown`),"aria-label":q(t)(`shortcuts.reorder.moveDown`),disabled:i===q(n).length-1,"data-testid":`shortcut-reorder-down-${e.kind}-${e.slug}`,onClick:t=>l(e,`down`)},[...r[3]||=[S(`span`,{class:`material-icons text-base`},`arrow_downward`,-1)]],8,c1n)],8,a1n))),128))])],8,n1n)):b(``,!0)],512))}});o(),we(),M();var u1n={class:`inline-flex max-w-full items-center gap-2 text-xs`,"data-testid":`plugin-launcher`},d1n={class:`inline-flex flex-none items-stretch border border-gray-300 rounded`},f1n=[`title`,`aria-label`],p1n=[`title`,`aria-label`,`data-testid`,`onClick`],m1n={class:`material-icons text-base`},h1n=[`aria-label`],g1n=[`title`,`aria-label`,`data-testid`,`onClick`],_1n=K({__name:`PluginLauncher`,props:{activeViewMode:{},shortcuts:{},activeSessionCount:{},unreadCount:{}},emits:[`navigate`,`navigateShortcut`,`navigateChat`],setup(e,{emit:t}){let{t:n}=We(),r=OI(),i=e,a=m(()=>i.shortcuts??[]),o=m(()=>r.name===CP.chat),s=m(()=>i.activeSessionCount??0),l=m(()=>i.unreadCount??0),u=m(()=>{let e=[n(`pluginLauncher.chat.label`)];return s.value>0&&e.push(n(`sessionTabBar.activeSessions`,s.value,{named:{count:s.value}})),l.value>0&&e.push(n(`sessionTabBar.unreadReplies`,l.value,{named:{count:l.value}})),e.join(`, `)}),d=[{key:`dashboard`,kind:`view`,icon:`dashboard`},{key:`wiki`,kind:`view`,icon:`menu_book`},{key:`collections`,kind:`view`,icon:`apps`},{key:`feeds`,kind:`view`,icon:`rss_feed`},{key:`accounting`,kind:`view`,icon:`account_balance`},{key:`files`,kind:`view`,icon:`folder`},{key:`automations`,kind:`view`,icon:`schedule`},{key:`debug`,kind:`view`,icon:`bug_report`,devOnly:!0,literalLabel:`Debug`,literalTitle:`Open debug playground (dev mode only)`}],f=m(()=>d.filter(e=>!e.devOnly||!1));function p(e){return i.activeViewMode===e.key}let h={collection:CP.collections,feed:CP.feeds};function g(e){return i.activeViewMode===h[e.kind]&&r.params.slug===e.slug}function _(e){if(g(e))return`bg-blue-50 text-blue-600`;let t=Tt(e.color);return t?`${t} hover:brightness-95`:`bg-white text-gray-600 hover:bg-gray-50`}let v=t;return(e,t)=>(B(),U(`div`,u1n,[S(`div`,d1n,[S(`button`,{class:c([`relative h-8 w-8 flex items-center justify-center rounded-l border-r border-gray-200 transition-colors`,o.value?`bg-blue-50 text-blue-600`:`bg-white text-gray-600 hover:bg-gray-50`]),title:u.value,"aria-label":u.value,"data-testid":`plugin-launcher-chat`,onClick:t[0]||=e=>v(`navigateChat`)},[t[1]||=S(`span`,{class:`material-icons text-base`},`forum`,-1),De(e1n,{"active-session-count":s.value,"unread-count":l.value},null,8,[`active-session-count`,`unread-count`])],10,f1n),(B(!0),U(D,null,H(f.value,e=>(B(),U(`button`,{key:e.key,class:c([`h-8 w-8 flex items-center justify-center border-r border-gray-200 last:border-r-0 last:rounded-r transition-colors`,p(e)?`bg-blue-50 text-blue-600`:`bg-white text-gray-600 hover:bg-gray-50`]),title:e.literalTitle??q(n)(`pluginLauncher.${e.key}.label`),"aria-label":e.literalLabel??q(n)(`pluginLauncher.${e.key}.label`),"data-testid":`plugin-launcher-${e.key}`,onClick:t=>v(`navigate`,e)},[S(`span`,m1n,T(e.icon),1)],10,p1n))),128))]),a.value.length>0?(B(),U(`div`,{key:0,class:`inline-flex min-w-0 items-stretch border border-gray-300 rounded overflow-x-auto [scrollbar-width:thin]`,"aria-label":q(n)(`shortcuts.zoneAriaLabel`),"data-testid":`plugin-launcher-shortcuts`},[(B(!0),U(D,null,H(a.value,e=>(B(),U(`button`,{key:`${e.kind}:${e.slug}`,class:c([`h-8 w-8 flex items-center justify-center flex-none border-r border-gray-200 last:border-r-0 transition-colors`,_(e)]),title:e.title,"aria-label":e.title,"data-testid":`plugin-launcher-shortcut-${e.kind}-${e.slug}`,onClick:t=>v(`navigateShortcut`,e)},[De(q(Wa),{icon:e.icon,"size-class":`text-base`},null,8,[`icon`])],10,g1n))),128))],8,h1n)):b(``,!0),a.value.length>1?(B(),ke(l1n,{key:1})):b(``,!0)]))}});o(),M();var T9=V([]),E9=V({}),D9=V(null),O9=V(!1),k9=null;function A9(){return{tiles:T9.value,rowHeights:E9.value}}function j9(e){T9.value=e.tiles,E9.value=e.rowHeights}async function M9(e=!1){return k9&&!e||(k9=(async()=>{let e=await pN(SP.dashboard);if(!e.ok){D9.value=e.error,k9=null;return}D9.value=null,j9({tiles:e.data.tiles,rowHeights:e.data.rowHeights??{}}),O9.value=!0})()),k9}var{enqueue:N9}=xut();async function P9(e,t){j9(e);let n=await hN(SP.dashboard,{tiles:e.tiles,rowHeights:e.rowHeights});return n.ok?(j9({tiles:n.data.tiles,rowHeights:n.data.rowHeights??e.rowHeights}),D9.value=null,!0):(j9(t),D9.value=n.error,console.error(`[useDashboard] persist failed`,n.error),!1)}function v1n(e){return N9(async()=>(await M9(),O9.value?P9({tiles:e,rowHeights:E9.value},A9()):!1))}function y1n(e,t){return N9(async()=>{if(await M9(),!O9.value)return!1;if(!T9.value.some(t=>t.slug===e))return!0;let n=A9();return P9({tiles:n.tiles.map(n=>{if(n.slug!==e)return n;if(t===null){let{viewMode:e,...t}=n;return t}return{...n,viewMode:t}}),rowHeights:n.rowHeights},n)})}function b1n(e,t,n){return N9(async()=>{if(await M9(),!O9.value)return!1;if(e<1||t<0)return!0;let r=A9(),i=String(e),a=[...r.rowHeights[i]??[]];for(;a.length<=t;)a.push(0);a[t]=n;let o={...r.rowHeights,[i]:a};return P9({tiles:r.tiles,rowHeights:o},r)})}function x1n(e){return N9(async()=>{if(await M9(),!O9.value)return;let t=new Set(e),n=T9.value.filter(e=>t.has(e.slug)),r=new Set(n.map(e=>e.slug)),i=e.filter(e=>!r.has(e)).map(e=>({slug:e})),a=[...n,...i];(a.length!==T9.value.length||a.some((e,t)=>e.slug!==T9.value[t]?.slug))&&await P9({tiles:a,rowHeights:E9.value},A9())})}function S1n(){return M9(),{tiles:m(()=>T9.value),rowHeights:m(()=>E9.value),loadError:m(()=>D9.value),load:M9,setTiles:v1n,setViewMode:y1n,setRowHeight:b1n,reconcile:x1n}}o(),M(),we(),le();var C1n={key:0,class:`h-full flex flex-col items-center justify-center text-center text-slate-500 gap-2`},w1n={class:`text-sm font-medium`},T1n={class:`text-xs`},E1n={key:1,class:`grid gap-4 sm:grid-cols-2`,"data-testid":`dashboard-grid`},D1n=[`data-dashboard-index`,`data-testid`],O1n={class:`flex items-center gap-2 px-3 py-2 border-b border-slate-100 bg-slate-50`},k1n=[`title`,`aria-label`,`onPointerdown`],A1n=[`title`,`onClick`,`onDblclick`],j1n={class:`truncate`},M1n=[`value`,`aria-label`,`data-testid`,`onChange`],N1n=[`value`],P1n=[`title`,`aria-label`,`data-testid`,`onPointerdown`],F1n=320,I1n=160,L1n=900,R1n=`(min-width: 640px)`,z1n=K({__name:`DashboardView`,setup(e){let{t}=We(),n=DI(),{shortcuts:r,load:i}=mL(),{tiles:a,rowHeights:o,load:l,reconcile:d,setTiles:f,setViewMode:p,setRowHeight:h}=S1n(),g=m(()=>r.value.filter(e=>e.kind===`collection`)),_=m(()=>g.value.map(e=>e.slug)),v=e=>g.value.find(t=>t.slug===e),y=V({});async function b(e){if(y.value[e])return;let t=await pN(SP.collections.detail.replace(`:slug`,encodeURIComponent(e)));t.ok&&(y.value={...y.value,[e]:t.data.collection.schema})}function x(e){let t=y.value[e];return t?OQe(t):[`table`]}function C(e){let t=x(e.slug);return t.find(t=>t===e.viewMode)??t[0]??`table`}let w={table:`dashboard.viewTable`,calendar:`dashboard.viewCalendar`,kanban:`dashboard.viewKanban`};function E(e,n){let r=w[n];return r?t(r):y.value[e]?.views?.find(e=>tN(e.id)===n)?.label??n}function O(e,t){let{target:n}=t;n instanceof HTMLSelectElement&&p(e,n.value)}function A(e){n.push({name:CP.collections,params:{slug:e}}).catch(()=>{})}function j(e,t){e.detail===0&&A(t)}function M(e){let{currentTarget:t}=e;if(!(t instanceof HTMLElement))return null;try{t.setPointerCapture(e.pointerId)}catch{}return t}let N=V(null),F=V(null),I=V(!1),R=null;function z(e,t){let n=document.elementFromPoint(e,t)?.closest(`[data-dashboard-index]`);if(!n)return null;let r=Number(n.dataset.dashboardIndex);return Number.isNaN(r)?null:r}function ee(e){R&&(e.preventDefault(),F.value=z(e.clientX,e.clientY))}function te(){window.removeEventListener(`pointermove`,ee),window.removeEventListener(`pointerup`,ne),window.removeEventListener(`pointercancel`,ne),I.value=!1}function ne(){if(te(),!R)return;let{startIndex:e,handle:t,pointerId:n}=R,r=F.value;R=null,N.value=null,F.value=null;try{t.releasePointerCapture(n)}catch{}if(r===null||r===e)return;let i=[...a.value],[o]=i.splice(e,1);o&&(i.splice(r,0,o),f(i))}function re(e,t){let n=M(t);n&&(R={startIndex:e,handle:n,pointerId:t.pointerId},N.value=e,I.value=!0,window.addEventListener(`pointermove`,ee),window.addEventListener(`pointerup`,ne),window.addEventListener(`pointercancel`,ne))}let ie=V(2),ae=null;function oe(){ie.value=ae?.matches?2:1}function W(e){return Math.floor(e/ie.value)}let se=V({});function ce(e,t){return`${e}:${t}`}function le(e){let t=W(e),n=se.value[ce(ie.value,t)];if(n!==void 0)return n;let r=o.value[String(ie.value)]?.[t];return r&&r>0?r:F1n}let ue=V(!1),de=null,fe=null,G=0;function pe(){if(G=0,!de||fe===null)return;let e=Math.min(L1n,Math.max(I1n,de.startHeight+(fe-de.startY)));se.value={...se.value,[ce(de.cols,de.row)]:e}}function me(e){de&&(e.preventDefault(),fe=e.clientY,G||=requestAnimationFrame(pe))}function he(e,t){let n=ce(e,t);se.value=Object.fromEntries(Object.entries(se.value).filter(([e])=>e!==n))}async function ge(e,t,n){await h(e,t,Math.round(n)),he(e,t)}function _e(){window.removeEventListener(`pointermove`,me),window.removeEventListener(`pointerup`,ve),window.removeEventListener(`pointercancel`,ve),G&&cancelAnimationFrame(G),G=0,fe=null,ue.value=!1}function ve(){if(_e(),!de)return;let{cols:e,row:t,handle:n,pointerId:r}=de;de=null;try{n.releasePointerCapture(r)}catch{}let i=se.value[ce(e,t)];i!==void 0&&ge(e,t,i)}function K(e,t){let n=M(t);n&&(de={cols:ie.value,row:W(e),startY:t.clientY,startHeight:le(e),handle:n,pointerId:t.pointerId},ue.value=!0,window.addEventListener(`pointermove`,me),window.addEventListener(`pointerup`,ve),window.addEventListener(`pointercancel`,ve))}return k(()=>{_e(),te(),ae?.removeEventListener(`change`,oe)}),P(async()=>{ae=window.matchMedia(R1n),oe(),ae.addEventListener(`change`,oe),await Promise.all([i(),l()]),await d(_.value)}),Ve(_,e=>void d(e)),Ve(a,e=>e.forEach(e=>void b(e.slug)),{immediate:!0}),(e,n)=>(B(),U(`div`,{class:c([`h-full overflow-auto p-4`,{"select-none":ue.value||I.value}]),"data-testid":`dashboard-view`},[_.value.length===0?(B(),U(`div`,C1n,[n[0]||=S(`span`,{class:`material-icons text-4xl text-slate-300`},`dashboard`,-1),S(`p`,w1n,T(q(t)(`dashboard.empty`)),1),S(`p`,T1n,T(q(t)(`dashboard.emptyHint`)),1)])):(B(),U(`div`,E1n,[(B(!0),U(D,null,H(q(a),(e,r)=>u((B(),U(`section`,{key:e.slug,class:c([`flex flex-col border border-slate-200 rounded-lg bg-white overflow-hidden shadow-sm transition-opacity`,{"ring-2 ring-indigo-400":F.value===r&&N.value!==r,"opacity-50":N.value===r}]),"data-dashboard-index":r,"data-testid":`dashboard-tile-${e.slug}`},[S(`header`,O1n,[S(`span`,{class:`material-icons text-base text-slate-400 cursor-grab select-none touch-none`,title:q(t)(`dashboard.dragHint`),"aria-label":q(t)(`dashboard.dragHint`),"data-testid":`dashboard-tile-drag`,onPointerdown:s(e=>re(r,e),[`prevent`])},`drag_indicator`,40,k1n),S(`button`,{type:`button`,class:`flex items-center gap-1.5 min-w-0 flex-1 text-left text-sm font-semibold text-slate-700 hover:text-indigo-600`,title:q(t)(`dashboard.openFull`),onClick:t=>j(t,e.slug),onDblclick:t=>A(e.slug)},[S(`span`,{class:c([`h-6 w-6 rounded flex items-center justify-center flex-none`,q(Tt)(v(e.slug)?.color)??``])},[De(q(Wa),{icon:v(e.slug)?.icon,fallback:`apps`,"size-class":`text-base`},null,8,[`icon`])],2),S(`span`,j1n,T(v(e.slug)?.title||e.slug),1)],40,A1n),S(`select`,{class:`flex-none text-xs bg-white border border-slate-200 rounded px-1.5 py-1 text-slate-600 focus:outline-none focus:ring-2 focus:ring-indigo-500/20`,value:C(e),"aria-label":q(t)(`dashboard.viewPickerLabel`),"data-testid":`dashboard-tile-view-${e.slug}`,onChange:t=>O(e.slug,t)},[(B(!0),U(D,null,H(x(e.slug),t=>(B(),U(`option`,{key:t,value:t},T(E(e.slug,t)),9,N1n))),128))],40,M1n)]),S(`div`,{class:`overflow-auto`,style:xe({height:`${le(r)}px`})},[(B(),ke(q(cN),{key:`${e.slug}:${C(e)}`,slug:e.slug,"initial-view":C(e),"hide-view-toggle":``,"hide-header":``,"hide-search":``},null,8,[`slug`,`initial-view`]))],4),S(`div`,{class:`h-2 flex-none cursor-row-resize bg-slate-100 hover:bg-indigo-200 transition-colors flex items-center justify-center`,title:q(t)(`dashboard.resizeHint`),"aria-label":q(t)(`dashboard.resizeHint`),"data-testid":`dashboard-tile-resize-${e.slug}`,onPointerdown:s(e=>K(r,e),[`prevent`])},[...n[1]||=[S(`span`,{class:`h-0.5 w-8 rounded-full bg-slate-300`},null,-1)]],40,P1n)],10,D1n)),[[L,v(e.slug)]])),128))]))],2))}}),B1n=3e4,V1n=.85;function H1n(e,t){if(!Number.isFinite(e)||e<=0)return 0;if(!Number.isFinite(t)||t<=0)return Math.min(e,B1n);let n=Math.max(1,Math.floor(t*V1n));return Math.min(e,B1n,n)}function U1n(e,t=80){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function W1n(e){for(let t of e.querySelectorAll(`*`)){if(t.scrollHeight<=t.clientHeight)continue;let e=getComputedStyle(t);if(e.overflowY===`auto`||e.overflowY===`scroll`||e.overflow===`auto`||e.overflow===`scroll`)return t}return null}function G1n(e,t,n){let r=[],i=new Map;for(let a of e){let e=t(a);if(e===null){r.push({key:n(a),head:a,members:[a],isGroup:!1});continue}let o=i.get(e);if(o!==void 0){o.members.push(a),o.head=a;continue}let s={key:`group:${e}`,head:a,members:[a],isGroup:!0};i.set(e,s),r.push(s)}return r}function K1n(e,t,n,r){let i=null;for(let a of e){let e=t(a.head),o=n(e);if(o!==null){if(o<=r)i=e;else break}}return i}function q1n(e,t,n){if(t===void 0)return{kind:`none`};let r=n(t),i=e=>e.members.some(e=>n(e)===r),a=e[e.length-1];if(a!==void 0&&i(a))return{kind:`bottom`};let o=e.find(i);return o===void 0?{kind:`none`}:{kind:`card`,headUuid:n(o.head)}}o(),M(),we();var J1n={class:`h-full flex flex-col bg-gray-50`},Y1n={class:`shrink-0 flex items-center gap-1 text-xs text-gray-400 px-4 pt-3 pb-2`,"data-testid":`stack-role-header`},X1n={key:1},Z1n={class:`ml-auto flex items-center gap-0.5`},Q1n=[`title`,`aria-label`,`aria-pressed`],$1n={key:0,class:`flex-1 flex flex-col items-center justify-center h-full px-6 text-center`,"data-testid":`stack-empty`},e0n={key:1,class:`text-lg font-medium text-gray-700 mb-4`},t0n={key:2,class:`flex flex-wrap gap-2 justify-center max-w-xl`},n0n=[`onClick`],r0n={key:3,class:`text-sm text-gray-500`},i0n=[`title`,`onClick`],a0n={class:`material-icons text-sm text-gray-400`},o0n={class:`text-sm font-medium text-gray-800 truncate`},s0n={key:0,class:`text-[10px] text-gray-400 shrink-0`},c0n={key:1,class:`text-[10px] text-gray-400 shrink-0`},l0n={class:`font-mono text-xs text-gray-400 shrink-0`},u0n={key:0,class:`stack-text-response`},d0n={key:1,class:`h-full overflow-auto p-4 text-xs text-gray-500 whitespace-pre-wrap`},f0n=`min(60vh, 560px)`,p0n=150,m0n=Qe(K({__name:`StackView`,props:{toolResults:{},selectedResultUuid:{},resultTimestamps:{},sendTextMessage:{type:Function},queries:{},sessionRoleName:{},sessionRoleIcon:{},sessionModel:{},sessionModelOverride:{},layoutMode:{},showRightSidebar:{type:Boolean},googleMapKey:{}},emits:[`select`,`updateResult`,`update:layoutMode`,`toggle-right-sidebar`,`update:sessionModelOverride`],setup(e,{emit:t}){let{t:n}=We(),r={[pI.presentMulmoScript]:`min(85vh, 820px)`};function i(e){return r[e]??f0n}let a=new Set([`presentHtml`,`presentDocument`,`presentSpreadsheet`,`manageWiki`,`presentChart`,`skill`]);function o(e){return a.has(e)}let s=e;function l(e){return e===pI.mapControl?s.googleMapKey??null:null}let u=t,d=V(null),f=V(!0),p=new Map,h=new Map;function g(e){let{toolName:t,uuid:n}=e;typeof t==`string`&&typeof n==`string`&&u(`updateResult`,{...e,toolName:t,uuid:n})}function v(e,t){t?p.set(e,t):p.delete(e)}let y=e=>e instanceof HTMLElement?e:null;function x(e,t){let n=y(t);n?(h.set(e,n),be(()=>O(n))):h.delete(e)}function C(e){if(e.toolName!==pI.mapControl)return null;let{data:t}=e;if(!Ma(t))return null;let{groupId:n}=t;return typeof n==`string`&&n.length>0?n:null}let w=m(()=>G1n(s.toolResults,C,e=>e.uuid));function E(e,t){let n=y(t);for(let t of e)v(t.uuid,n)}function O(e){let t=e.querySelectorAll(`iframe`);for(let e of t){if(e.dataset.stackSized===`true`)continue;e.dataset.stackSized=`true`;let t=()=>I(e);e.addEventListener(`load`,t);try{e.contentDocument?.readyState===`complete`&&t()}catch{}}}let k=new WeakMap,A=new Map,j=null;function M(e){let t=k.get(e);if(t&&t.isConnected)return t;for(let t of h.values())for(let n of t.querySelectorAll(`iframe`)){let t=n.contentWindow;if(t&&(k.set(t,n),t===e))return n}return null}function N(){j=null;for(let[e,t]of A)e.isConnected&&e.style.setProperty(`height`,`${t}px`,`important`);A.clear()}function F(e){let{data:t}=e;if(!Ma(t)||t.type!==`mc-iframe-height`)return;let n=t.height;if(typeof n!=`number`)return;let{source:r}=e;if(!r)return;let i=M(r);if(!i)return;let a=H1n(n,window.innerHeight);a<=0||(A.set(i,a),j===null&&(j=requestAnimationFrame(N)))}function I(e){try{let t=e.contentDocument;if(!t)return;let n=H1n(Math.max(t.documentElement?.scrollHeight??0,t.body?.scrollHeight??0),window.innerHeight);if(n<=0)return;e.style.height=`${n}px`}catch{}}function L(e){if(e.toolName!==`text-response`)return!1;let{data:t}=e;return Ma(t)?typeof t.text==`string`:!1}function R(e){return e===`text-response`?`chat`:`extension`}let z=!1,ee=null,te=null,ne=null;function re(){z=!0,ee!==null&&clearTimeout(ee),ee=setTimeout(()=>{z=!1,ee=null},p0n)}function ie(e){let t=parseFloat(getComputedStyle(e).paddingTop);return Number.isFinite(t)?t:0}function ae(){if(!d.value)return null;let e=d.value,t=e.getBoundingClientRect().top+ie(e);return K1n(w.value,e=>e.uuid,e=>{let t=p.get(e);return t?t.getBoundingClientRect().top:null},t)}function oe(){z||(d.value&&(f.value=U1n(d.value)),te===null&&(te=requestAnimationFrame(()=>{if(te=null,z)return;let e=ae();e&&e!==s.selectedResultUuid&&(ne=e,u(`select`,e))})))}Ve(()=>s.selectedResultUuid,e=>{if(e){if(ne===e){ne=null;return}ne=null,be(()=>{let t=p.get(e);t&&(re(),t.scrollIntoView({block:`start`,behavior:`auto`}))})}});let W=m(()=>{let e=s.toolResults,t=e[e.length-1];return`${e.length}:${t?.uuid??``}:${t?.message?.length??0}`});return Ve(W,()=>{be(()=>{if(d.value&&f.value){re();let e=s.toolResults[s.toolResults.length-1],t=q1n(w.value,e,e=>e.uuid);if(t.kind===`bottom`)d.value.scrollTop=d.value.scrollHeight;else if(t.kind===`card`){let e=p.get(t.headUuid);e&&e.scrollIntoView({block:`nearest`,behavior:`auto`})}}for(let e of h.values())O(e)})}),Ve(d,(e,t)=>{t?.removeEventListener(`scroll`,oe),e?.addEventListener(`scroll`,oe,{passive:!0})},{immediate:!0}),P(()=>{window.addEventListener(`message`,F),be(()=>{if(!s.selectedResultUuid)return;let e=p.get(s.selectedResultUuid);e&&(re(),e.scrollIntoView({block:`start`,behavior:`auto`}))})}),_(()=>{d.value?.removeEventListener(`scroll`,oe),window.removeEventListener(`message`,F),te!==null&&cancelAnimationFrame(te),ee!==null&&clearTimeout(ee),j!==null&&cancelAnimationFrame(j),A.clear(),h.clear()}),(t,r)=>(B(),U(`div`,J1n,[S(`div`,Y1n,[e.sessionRoleIcon?(B(),U(`span`,{key:0,class:c([`material-icons text-xs leading-none`,q(h9)])},T(e.sessionRoleIcon),3)):b(``,!0),e.sessionRoleName?(B(),U(`span`,X1n,T(e.sessionRoleName),1)):b(``,!0),e.sessionRoleName?(B(),ke(o$n,{key:2,model:e.sessionModel,override:e.sessionModelOverride,"onUpdate:override":r[0]||=e=>u(`update:sessionModelOverride`,e)},null,8,[`model`,`override`])):b(``,!0),S(`div`,Z1n,[De(A$n,{results:e.toolResults,"result-timestamps":e.resultTimestamps,"session-role-name":e.sessionRoleName},null,8,[`results`,`result-timestamps`,`session-role-name`]),S(`button`,{type:`button`,class:c([`h-8 w-8 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-colors`,{"!text-blue-500":e.showRightSidebar}]),title:q(n)(`sidebarHeader.toolCallHistory`),"aria-label":q(n)(`sidebarHeader.toolCallHistory`),"aria-pressed":e.showRightSidebar,onClick:r[1]||=e=>u(`toggle-right-sidebar`)},[...r[3]||=[S(`span`,{class:`material-icons text-lg`,"aria-hidden":`true`},`build`,-1)]],10,Q1n),De(KQn,{"model-value":e.layoutMode,"onUpdate:modelValue":r[2]||=e=>u(`update:layoutMode`,e)},null,8,[`model-value`])])]),e.toolResults.length===0?(B(),U(`div`,$1n,[e.sessionRoleIcon?(B(),U(`span`,{key:0,class:c([`material-icons text-5xl text-gray-400 mb-2`,q(h9)]),"aria-hidden":`true`},T(e.sessionRoleIcon),3)):b(``,!0),e.sessionRoleName?(B(),U(`p`,e0n,T(e.sessionRoleName),1)):b(``,!0),e.queries&&e.queries.length>0&&e.sendTextMessage?(B(),U(`div`,t0n,[(B(!0),U(D,null,H(e.queries,(t,n)=>(B(),U(`button`,{key:`${n}-${t}`,type:`button`,class:`text-sm bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-full px-4 py-2 border border-gray-300 transition-colors`,"data-testid":`stack-empty-query`,onClick:n=>e.sendTextMessage(t)},T(t),9,n0n))),128))])):(B(),U(`p`,r0n,T(q(n)(`app.startConversation`)),1))])):(B(),U(`div`,{key:1,ref_key:`containerRef`,ref:d,class:`flex-1 min-h-0 overflow-y-auto px-4 pb-4 space-y-3`,"data-testid":`stack-scroll`},[(B(!0),U(D,null,H(w.value,t=>(B(),U(`div`,{key:t.key,ref_for:!0,ref:e=>E(t.members,e),class:c([`bg-white rounded-lg border transition-colors`,t.members.some(t=>t.uuid===e.selectedResultUuid)?`border-blue-400 ring-2 ring-blue-200`:`border-gray-200`])},[S(`button`,{class:`w-full flex items-center gap-2 px-3 py-2 border-b border-gray-100 text-left hover:bg-gray-50`,title:t.head.title||t.head.toolName,onClick:e=>u(`select`,t.head.uuid)},[S(`span`,a0n,T(R(t.head.toolName)),1),S(`span`,o0n,T(t.head.title||t.head.toolName),1),t.isGroup&&t.members.length>1?(B(),U(`span`,s0n,T(`${t.members.length}×`),1)):b(``,!0),e.resultTimestamps.get(t.head.uuid)?(B(),U(`span`,c0n,T(q(oz)(e.resultTimestamps.get(t.head.uuid))),1)):b(``,!0),S(`span`,l0n,T(t.head.toolName),1)],8,i0n),L(t.head)?(B(),U(`div`,u0n,[De(q(_4),{"selected-result":t.head,onUpdateResult:g},null,8,[`selected-result`])])):o(t.head.toolName)?(B(),U(`div`,{key:1,ref_for:!0,ref:e=>x(t.head.uuid,e),class:`stack-natural`},[q(O5)(t.head.toolName)?.viewComponent?(B(),ke(fe(q(O5)(t.head.toolName)?.viewComponent),{key:`${t.key}-${l(t.head.toolName)??``}`,"selected-result":t.head,"send-text-message":e.sendTextMessage,"google-map-key":l(t.head.toolName),onUpdateResult:g},null,40,[`selected-result`,`send-text-message`,`google-map-key`])):b(``,!0)],512)):(B(),U(`div`,{key:2,style:xe({height:i(t.head.toolName)})},[q(O5)(t.head.toolName)?.viewComponent?(B(),ke(fe(q(O5)(t.head.toolName)?.viewComponent),{key:`${t.key}-${l(t.head.toolName)??``}`,"selected-result":t.head,results:t.isGroup?t.members:void 0,"send-text-message":e.sendTextMessage,"google-map-key":l(t.head.toolName),onUpdateResult:g},null,40,[`selected-result`,`results`,`send-text-message`,`google-map-key`])):(B(),U(`pre`,d0n,T(JSON.stringify(t.head,null,2)),1))],4))],2))),128))],512))]))}}),[[`__scopeId`,`data-v-7bdfeccd`]]),h0n=`files_expanded_dirs`,g0n=[``];function _0n(e){if(e===null)return new Set(g0n);try{let t=JSON.parse(e);if(!Array.isArray(t))return new Set(g0n);let n=t.filter(e=>typeof e==`string`);return new Set(n)}catch{return new Set(g0n)}}function v0n(e){return JSON.stringify([...e])}M(),o();function y0n(){if(typeof localStorage>`u`)return _0n(null);try{return _0n(localStorage.getItem(h0n))}catch{return _0n(null)}}var F9=V(y0n());Ve(F9,e=>{try{localStorage.setItem(h0n,v0n(e))}catch{}});function b0n(){function e(e){return F9.value.has(e)}function t(e){let t=new Set(F9.value);t.has(e)?t.delete(e):t.add(e),F9.value=t}function n(e){if(F9.value.has(e))return;let t=new Set(F9.value);t.add(e),F9.value=t}function r(){return Array.from(F9.value)}return{isExpanded:e,toggle:t,expand:n,expandedPaths:r}}o(),M();var x0n=null;function I9(e){return e.dataTransfer?.types.includes(`Files`)??!1}function S0n(){D0n()}var C0n=V(0),w0n=null;function T0n(){if(w0n!==null||typeof window>`u`)return;let e=()=>{C0n.value+=1};window.addEventListener(`drop`,e),window.addEventListener(`dragend`,e),w0n=e}function E0n(){return D0n(),T0n(),C0n}function D0n(){if(x0n!==null||typeof window>`u`)return;let e=e=>{I9(e)&&e.preventDefault()};window.addEventListener(`dragover`,e),window.addEventListener(`drop`,e),x0n=e}function O0n(e){D0n();let t=V(!1),n=0;function r(e){I9(e)&&(e.preventDefault(),n+=1,t.value=!0)}function i(e){I9(e)&&e.preventDefault()}function a(){n!==0&&(--n,n<=0&&s())}function o(t){if(!I9(t))return;t.preventDefault(),s();let n=t.dataTransfer?.files;n&&n.length>0&&e.onFiles(Array.from(n))}function s(){n=0,t.value=!1}return P(()=>{typeof window<`u`&&(window.addEventListener(`drop`,s),window.addEventListener(`dragend`,s))}),k(()=>{typeof window<`u`&&(window.removeEventListener(`drop`,s),window.removeEventListener(`dragend`,s))}),{isDragging:t,onDragenter:r,onDragover:i,onDragleave:a,onDrop:o}}function k0n(e,t){let n=e.slice();return n.sort((e,n)=>{if(e.type!==n.type)return e.type===`dir`?-1:1;if(t===`recent`){let t=e.modifiedMs??-1/0,r=n.modifiedMs??-1/0;if(t!==r)return r-t}return e.name.localeCompare(n.name)}),n}var A0n=[{kind:`exact`,path:`config/mcp.json`,descriptor:{id:`mcp`,schemaRef:`server/system/config.ts`,editPolicy:`user-editable`}},{kind:`exact`,path:`config/settings.json`,descriptor:{id:`settings`,schemaRef:`server/system/config.ts`,editPolicy:`user-editable`}},{kind:`exact`,path:`config/scheduler/tasks.json`,descriptor:{id:`schedulerTasks`,schemaRef:`server/utils/files/user-tasks-io.ts`,editPolicy:`agent-managed`}},{kind:`exact`,path:`config/scheduler/overrides.json`,descriptor:{id:`schedulerOverrides`,schemaRef:`server/utils/files/scheduler-io.ts`,editPolicy:`agent-managed`}},{kind:`exact`,path:`data/scheduler/items.json`,descriptor:{id:`schedulerItems`,schemaRef:`server/utils/files/scheduler-io.ts`,editPolicy:`agent-managed`}},{kind:`exact`,path:`data/wiki/index.md`,descriptor:{id:`wikiIndex`,editPolicy:`agent-managed`}},{kind:`exact`,path:`data/wiki/log.md`,descriptor:{id:`wikiLog`,editPolicy:`agent-managed`}},{kind:`exact`,path:`data/wiki/summary.md`,descriptor:{id:`wikiSummary`,editPolicy:`agent-managed`}},{kind:`exact`,path:`data/wiki/SCHEMA.md`,descriptor:{id:`wikiSchema`,editPolicy:`fragile-format`}},{kind:`exact`,path:`conversations/memory.md`,descriptor:{id:`memory`,schemaRef:`server/agent/prompt.ts`,editPolicy:`agent-managed-but-hand-editable`}},{kind:`exact`,path:`conversations/summaries/_index.md`,descriptor:{id:`summariesIndex`,editPolicy:`agent-managed`}},{kind:`pattern`,regex:/^config\/roles\/[^/]+\.json$/,descriptor:{id:`rolesJson`,schemaRef:`src/config/roles.ts`,editPolicy:`user-editable`}},{kind:`pattern`,regex:/^config\/roles\/[^/]+\.md$/,descriptor:{id:`rolesMd`,schemaRef:`src/config/roles.ts`,editPolicy:`user-editable`}},{kind:`pattern`,regex:/^conversations\/summaries\/daily\/\d{4}\/\d{2}\/\d{2}\.md$/,descriptor:{id:`journalDaily`,editPolicy:`agent-managed`}},{kind:`pattern`,regex:/^conversations\/summaries\/topics\/[^/]+\.md$/,descriptor:{id:`journalTopic`,editPolicy:`agent-managed`}}];function j0n(e){for(let t of A0n)if(t.kind===`exact`&&t.path===e||t.kind===`pattern`&&t.regex.test(e))return t.descriptor;return null}var M0n=new Set([`user-editable`,`agent-managed-but-hand-editable`]);function N0n(e){let t=j0n(e);return t===null||M0n.has(t.editPolicy)}var P0n={"agent-managed-but-hand-editable":`text-emerald-500`,"user-editable":`text-blue-500`,"agent-managed":`text-amber-500`,"fragile-format":`text-orange-500`,ephemeral:`text-gray-400`},F0n=[`data`,`artifacts`,`config`];function I0n(e){return F0n.includes(e)}var L0n=[{folder:`data/wiki/pages`,extension:`.md`,placeholderKey:`fileTree.newFilePlaceholder.wikiPage`},{folder:`conversations/summaries`,extension:`.md`,placeholderKey:`fileTree.newFilePlaceholder.summary`},{folder:`artifacts/documents`,extension:`.md`,placeholderKey:`fileTree.newFilePlaceholder.document`},{folder:`artifacts/html`,extension:`.html`,placeholderKey:`fileTree.newFilePlaceholder.html`},{folder:`artifacts/stories`,extension:`.json`,placeholderKey:`fileTree.newFilePlaceholder.story`}];function R0n(e){return L0n.find(t=>t.folder===e)??null}function z0n(e,t){let n=e.trim().replace(/\.[a-z0-9]+$/i,``);return n.length===0?{ok:!1,reason:`empty`}:MXe(n)?{ok:!0,filename:n+t.extension}:{ok:!1,reason:`unsafe`}}o(),M(),we(),le();var B0n=[`data-testid`,`data-drop-target`,`title`],V0n={class:`material-icons text-sm text-gray-400 shrink-0`},H0n={class:`text-gray-700 truncate`},U0n=[`data-testid`,`data-selected`,`title`],W0n={class:`truncate`},G0n=[`title`],K0n={key:2,class:`pl-4`},q0n=[`data-testid`],J0n=[`placeholder`,`aria-label`],Y0n={class:`text-xs text-gray-400 font-mono shrink-0 select-none`},X0n={key:1,class:`px-2 py-1 text-xs text-red-600`,"data-testid":`file-tree-new-file-error`},Z0n={key:2,class:`px-2 py-1 text-xs text-gray-400`},Q0n=`text-gray-400`,$0n=K({__name:`FileTree`,props:{node:{},selectedPath:{},recentPaths:{},childrenByPath:{},sortMode:{},showHiddenSystem:{type:Boolean},allowUpload:{type:Boolean}},emits:[`select`,`loadChildren`,`uploadFiles`,`createFile`],setup(e,{emit:t}){let{t:n}=We(),r=e,i=t,{isExpanded:a,toggle:o,expand:l}=b0n(),d=m(()=>a(r.node.path)),f=m(()=>r.childrenByPath.get(r.node.path)),p=m(()=>f.value===null),h=m(()=>Array.isArray(f.value)?k0n(f.value,r.sortMode):[]),g=m(()=>r.node.path===``),_=m(()=>!g.value||r.showHiddenSystem?h.value:h.value.filter(e=>e.type===`dir`&&I0n(e.name)));Ve([d,f],([e,t])=>{e&&r.node.type===`dir`&&t===void 0&&i(`loadChildren`,r.node.path)},{immediate:!0});function v(){o(r.node.path),a(r.node.path)&&f.value===void 0&&i(`loadChildren`,r.node.path)}let y=V(!1),x=0;function C(e){return e.dataTransfer?.types.includes(`Files`)??!1}function w(e){return r.allowUpload&&r.node.type===`dir`&&C(e)}function E(e){w(e)&&(e.preventDefault(),x+=1,y.value=!0)}function O(e){w(e)&&e.preventDefault()}function M(){x!==0&&(--x,x<=0&&P())}function N(e){if(!w(e))return;e.preventDefault(),e.stopPropagation(),P();let t=e.dataTransfer?.files;t&&t.length>0&&i(`uploadFiles`,{folder:r.node.path,files:Array.from(t)})}function P(){x=0,y.value=!1}Ve(E0n(),P);let F=new Set([`.mp3`,`.wav`,`.m4a`,`.ogg`,`.oga`,`.flac`,`.aac`]),I=m(()=>{if(r.node.type!==`file`)return`description`;let{name:e}=r.node,t=e.lastIndexOf(`.`);if(t<0)return`description`;let n=e.slice(t).toLowerCase();return F.has(n)?`audiotrack`:`description`}),L=m(()=>r.recentPaths.has(r.node.path)),R=m(()=>{if(r.node.type!==`file`)return Q0n;let e=j0n(r.node.path);return e?P0n[e.editPolicy]:Q0n}),z=m(()=>r.node.type===`dir`?R0n(r.node.path):null),ee=m(()=>z.value?n(z.value.placeholderKey):``),te=V(!1),ne=V(0),re=V(0),ie=V(!1),ae=V(``),oe=V(null),W=V(null),se=!1;function ce(e){z.value&&(e.preventDefault(),ne.value=e.clientX,re.value=e.clientY,te.value=!0)}function le(){te.value=!1}function ue(){le(),z.value&&(a(r.node.path)||l(r.node.path),ae.value=``,oe.value=null,ie.value=!0,be(()=>{W.value?.focus()}))}function de(){ie.value=!1,ae.value=``,oe.value=null}function fe(){if(se){se=!1;return}de()}let G=V(!1);function pe(){G.value=!0}function me(){setTimeout(()=>{G.value=!1},0)}function he(e){if(e.key===`Enter`){if(G.value||e.isComposing||e.keyCode===229)return;e.preventDefault(),_e();return}e.key===`Escape`&&(e.preventDefault(),de())}function ge(){se=!0,be(()=>{W.value?.focus(),setTimeout(()=>{se=!1},0)})}function _e(){if(!z.value)return;let e=z0n(ae.value,z.value);if(!e.ok){oe.value=e.reason===`empty`?n(`fileTree.newFileError.empty`):n(`fileTree.newFileError.unsafe`),ge();return}se=!0,i(`createFile`,{folder:r.node.path,filename:e.filename,resolve:(e,t)=>{if(e){de();return}oe.value=t??n(`fileTree.newFileError.saveFailed`),ge()}})}function ve(){te.value&&le()}function K(e){e.key===`Escape`&&te.value&&le()}return Ve(te,e=>{e?(window.addEventListener(`click`,ve),window.addEventListener(`keydown`,K)):(window.removeEventListener(`click`,ve),window.removeEventListener(`keydown`,K))}),k(()=>{window.removeEventListener(`click`,ve),window.removeEventListener(`keydown`,K)}),(t,r)=>{let a=A(`FileTree`,!0);return B(),U(`div`,null,[e.node.type===`dir`?(B(),U(`button`,{key:0,class:c([`w-full flex items-center gap-1 px-2 py-1 text-left text-sm rounded transition-colors`,y.value?`bg-blue-100 ring-1 ring-blue-400`:`hover:bg-gray-100`]),"data-testid":`file-tree-dir-${e.node.name||`root`}`,"data-drop-target":y.value?`true`:void 0,title:e.allowUpload?q(n)(`fileTree.dropHint`):void 0,onClick:v,onContextmenu:ce,onDragenter:E,onDragover:O,onDragleave:M,onDrop:N},[S(`span`,V0n,T(d.value?`folder_open`:`folder`),1),S(`span`,H0n,T(e.node.name||q(n)(`fileTree.workspace`)),1)],42,B0n)):(B(),U(`button`,{key:1,class:c([`w-full flex items-center gap-1 px-2 py-1 text-left text-sm rounded transition-colors`,e.selectedPath===e.node.path?`bg-blue-100 text-blue-700`:`text-gray-700 hover:bg-gray-100`]),"data-testid":`file-tree-file-${e.node.name}`,"data-selected":e.selectedPath===e.node.path?`true`:void 0,title:e.node.path,onClick:r[0]||=t=>i(`select`,e.node.path)},[S(`span`,{class:c([`material-icons text-sm shrink-0`,R.value])},T(I.value),3),S(`span`,W0n,T(e.node.name),1),L.value?(B(),U(`span`,{key:0,class:`ml-auto w-1.5 h-1.5 rounded-full bg-green-500 shrink-0`,title:q(n)(`fileTree.recentlyChanged`)},null,8,G0n)):b(``,!0)],10,U0n)),e.node.type===`dir`&&d.value?(B(),U(`div`,K0n,[ie.value?(B(),U(`div`,{key:0,class:`flex items-center gap-1 px-2 py-1 text-sm`,"data-testid":`file-tree-new-file-input-${e.node.name||`root`}`},[r[7]||=S(`span`,{class:`material-icons text-sm text-gray-400 shrink-0`},`description`,-1),u(S(`input`,{ref_key:`newFileInputRef`,ref:W,"onUpdate:modelValue":r[1]||=e=>ae.value=e,type:`text`,class:`flex-1 min-w-0 px-1 py-0.5 text-sm border border-blue-400 rounded focus:outline-none focus:ring-1 focus:ring-blue-400`,placeholder:ee.value,"aria-label":q(n)(`fileTree.newFileInputAria`),"data-testid":`file-tree-new-file-input`,onKeydown:he,onCompositionstart:pe,onCompositionend:me,onBlur:fe},null,40,J0n),[[Fe,ae.value]]),S(`span`,Y0n,T(z.value?.extension),1)],8,q0n)):b(``,!0),oe.value?(B(),U(`div`,X0n,T(oe.value),1)):b(``,!0),p.value?(B(),U(`div`,Z0n,T(q(n)(`common.loading`)),1)):b(``,!0),(B(!0),U(D,null,H(_.value,t=>(B(),ke(a,{key:t.path,node:t,"selected-path":e.selectedPath,"recent-paths":e.recentPaths,"children-by-path":e.childrenByPath,"sort-mode":e.sortMode,"show-hidden-system":e.showHiddenSystem,"allow-upload":e.allowUpload,onSelect:r[2]||=e=>i(`select`,e),onLoadChildren:r[3]||=e=>i(`loadChildren`,e),onCreateFile:r[4]||=e=>i(`createFile`,e),onUploadFiles:r[5]||=e=>i(`uploadFiles`,e)},null,8,[`node`,`selected-path`,`recent-paths`,`children-by-path`,`sort-mode`,`show-hidden-system`,`allow-upload`]))),128))])):b(``,!0),(B(),ke(j,{to:`body`},[te.value?(B(),U(`div`,{key:0,class:`fixed z-50 min-w-32 bg-white border border-gray-200 rounded shadow-md py-1 text-sm`,style:xe({top:`${re.value}px`,left:`${ne.value}px`}),"data-testid":`file-tree-context-menu`,translate:`no`,onClick:r[6]||=s(()=>{},[`stop`])},[S(`button`,{type:`button`,class:`w-full text-left px-3 py-1.5 hover:bg-gray-100 flex items-center gap-2`,"data-testid":`file-tree-context-new-file`,onClick:ue},[r[8]||=S(`span`,{class:`material-icons text-sm text-gray-400`},`note_add`,-1),J(` `+T(q(n)(`fileTree.newFileMenuItem`)),1)])],4)):b(``,!0)]))])}}});o(),M(),we();var e2n={class:`w-72 flex-shrink-0 border-r border-gray-200 overflow-y-auto p-2 bg-gray-50`},t2n={class:`flex flex-wrap justify-end items-center gap-x-3 gap-y-1 pb-1 text-xs`},n2n=[`title`],r2n=[`checked`],i2n={class:`flex items-center gap-2`},a2n={class:`text-gray-400`},o2n={class:`flex border border-gray-300 rounded overflow-hidden`},s2n=[`aria-pressed`,`title`],c2n=[`aria-pressed`,`title`],l2n={key:0,class:`p-2 text-xs text-red-600`},u2n={key:1,class:`p-2 text-xs text-gray-400`},d2n={class:`mt-2 pt-2 border-t border-gray-200 px-1 mb-1 flex items-center gap-1`},f2n={class:`text-[10px] font-semibold text-gray-400 uppercase`},p2n={class:`text-[9px] px-1 py-0.5 rounded bg-blue-100 text-blue-600`},m2n=K({__name:`FileTreePane`,props:{rootNode:{},refRoots:{},childrenByPath:{},treeError:{},selectedPath:{},recentPaths:{},sortMode:{},showHiddenSystem:{type:Boolean}},emits:[`select`,`loadChildren`,`update:sortMode`,`update:showHiddenSystem`,`createFile`,`uploadFiles`],setup(e,{emit:t}){let{t:n}=We(),r=t;function i(e){let{target:t}=e;t instanceof HTMLInputElement&&r(`update:showHiddenSystem`,t.checked)}S0n();let a=new Set;return(t,o)=>(B(),U(`div`,e2n,[S(`div`,t2n,[S(`label`,{class:`flex items-center gap-1 text-gray-500 cursor-pointer select-none`,title:q(n)(`fileTreePane.showSystemFilesTitle`)},[S(`input`,{type:`checkbox`,class:`h-3.5 w-3.5`,"data-testid":`file-tree-show-system-toggle`,checked:e.showHiddenSystem,onChange:i},null,40,r2n),J(` `+T(q(n)(`fileTreePane.showSystemFiles`)),1)],8,n2n),S(`div`,i2n,[S(`span`,a2n,T(q(n)(`fileTreePane.sort`)),1),S(`div`,o2n,[S(`button`,{type:`button`,class:c([`h-8 px-2.5 flex items-center gap-1 transition-colors`,e.sortMode===`name`?`bg-blue-50 text-blue-700 font-medium`:`bg-white text-gray-500 hover:bg-gray-50`]),"aria-pressed":e.sortMode===`name`,title:q(n)(`fileTreePane.sortByName`),"data-testid":`file-sort-name`,onClick:o[0]||=e=>r(`update:sortMode`,`name`)},T(q(n)(`fileTreePane.name`)),11,s2n),S(`button`,{type:`button`,class:c([`h-8 px-2.5 flex items-center gap-1 transition-colors`,e.sortMode===`recent`?`bg-blue-50 text-blue-700 font-medium`:`bg-white text-gray-500 hover:bg-gray-50`]),"aria-pressed":e.sortMode===`recent`,title:q(n)(`fileTreePane.sortByRecent`),"data-testid":`file-sort-recent`,onClick:o[1]||=e=>r(`update:sortMode`,`recent`)},T(q(n)(`fileTreePane.recent`)),11,c2n)])])]),e.treeError?(B(),U(`div`,l2n,T(e.treeError),1)):e.rootNode?(B(),ke($0n,{key:2,node:e.rootNode,"selected-path":e.selectedPath,"recent-paths":e.recentPaths,"children-by-path":e.childrenByPath,"sort-mode":e.sortMode,"show-hidden-system":e.showHiddenSystem,"allow-upload":``,onSelect:o[2]||=e=>r(`select`,e),onLoadChildren:o[3]||=e=>r(`loadChildren`,e),onCreateFile:o[4]||=e=>r(`createFile`,e),onUploadFiles:o[5]||=e=>r(`uploadFiles`,e)},null,8,[`node`,`selected-path`,`recent-paths`,`children-by-path`,`sort-mode`,`show-hidden-system`])):(B(),U(`div`,u2n,T(q(n)(`common.loading`)),1)),e.refRoots.length>0?(B(),U(D,{key:3},[S(`div`,d2n,[S(`span`,f2n,T(q(n)(`fileTreePane.reference`)),1),S(`span`,p2n,T(q(n)(`fileTreePane.readOnlyBadge`)),1)]),(B(!0),U(D,null,H(e.refRoots,t=>(B(),ke($0n,{key:t.path,node:t,"selected-path":e.selectedPath,"recent-paths":q(a),"children-by-path":e.childrenByPath,"sort-mode":e.sortMode,"show-hidden-system":``,"allow-upload":!1,onSelect:o[6]||=e=>r(`select`,e),onLoadChildren:o[7]||=e=>r(`loadChildren`,e)},null,8,[`node`,`selected-path`,`recent-paths`,`children-by-path`,`sort-mode`]))),128))],64)):b(``,!0)]))}}),h2n=1024,g2n=h2n*1024,_2n=g2n*1024;function v2n(e){return e===void 0||!Number.isFinite(e)?1:Math.min(100,Math.max(0,Math.floor(e)))}function y2n(e,t={}){if(!Number.isFinite(e)||e<0)return`—`;let n=v2n(t.decimals);return e<h2n?`${Math.trunc(e)} B`:e<g2n?`${(e/h2n).toFixed(n)} KB`:e<_2n?`${(e/g2n).toFixed(n)} MB`:`${(e/_2n).toFixed(n)} GB`}M(),o();function b2n(e,t,n){let r=V(!1),i=V(null);Ve(e,()=>{r.value=!1,i.value=null});async function a(){let a=e.value;if(a){r.value=!0,i.value=null;try{let e=await mN(`${t}?path=${encodeURIComponent(a)}`,{path:a});e.ok||(i.value=e.error||n())}finally{r.value=!1}}}return{busy:r,error:i,run:a}}function x2n(e,t){let{busy:n,error:r,run:i}=b2n(e,SP.files.open,t);return{busy:n,error:r,open:i}}function S2n(e,t){let{busy:n,error:r,run:i}=b2n(e,SP.files.reveal,t);return{busy:n,error:r,reveal:i}}o(),we(),M();var C2n={key:0,class:`flex items-center gap-2 px-3 py-2 border-b border-gray-200 text-xs text-gray-500 font-mono shrink-0`},w2n={class:`truncate min-w-0`},T2n={key:0,class:`text-gray-400 shrink-0`},E2n={key:1,class:`text-gray-400 shrink-0`},D2n=[`disabled`,`title`,`aria-label`],O2n=[`title`],k2n=[`title`,`aria-label`],A2n=K({__name:`FileContentHeader`,props:{selectedPath:{},size:{},modifiedMs:{},isMarkdown:{type:Boolean},mdRawMode:{type:Boolean}},emits:[`toggleMdRaw`,`deselect`],setup(e,{emit:t}){let{t:n}=We(),r=e,i=t,{busy:a,error:o,reveal:s}=S2n(Ee(r,`selectedPath`),()=>n(`fileContentHeader.revealInOsFailed`)),l=m(()=>{let e=n(`fileContentHeader.revealInOs`);return o.value?`${e} – ${o.value}`:e});return(t,r)=>e.selectedPath?(B(),U(`div`,C2n,[S(`span`,w2n,T(e.selectedPath),1),e.size===null?b(``,!0):(B(),U(`span`,T2n,`· `+T(q(y2n)(e.size)),1)),e.modifiedMs===null?b(``,!0):(B(),U(`span`,E2n,`· `+T(q(hkt)(e.modifiedMs)),1)),S(`button`,{type:`button`,class:c([`ml-auto shrink-0 h-8 w-8 flex items-center justify-center rounded hover:bg-gray-100 font-sans disabled:opacity-50`,q(o)?`text-red-500`:`text-gray-400 hover:text-gray-700`]),disabled:q(a),title:q(o)||q(n)(`fileContentHeader.revealInOs`),"aria-label":l.value,"data-testid":`file-reveal-in-os`,onClick:r[0]||=(...e)=>q(s)&&q(s)(...e)},[...r[3]||=[S(`span`,{class:`material-icons text-base`,"aria-hidden":`true`},`folder_open`,-1)]],10,D2n),e.isMarkdown?(B(),U(`button`,{key:2,class:`shrink-0 h-8 px-2.5 flex items-center gap-1 rounded border border-gray-200 text-gray-600 hover:bg-gray-100 font-sans`,title:e.mdRawMode?q(n)(`fileContentHeader.showRendered`):q(n)(`fileContentHeader.showRaw`),onClick:r[1]||=e=>i(`toggleMdRaw`)},T(e.mdRawMode?q(n)(`fileContentHeader.rendered`):q(n)(`fileContentHeader.raw`)),9,O2n)):b(``,!0),S(`button`,{type:`button`,class:`shrink-0 h-8 w-8 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100`,title:q(n)(`fileContentHeader.closeFile`),"aria-label":q(n)(`fileContentHeader.closeFile`),"data-testid":`close-file-btn`,onClick:r[2]||=e=>i(`deselect`)},[...r[4]||=[S(`span`,{class:`material-icons text-base`,"aria-hidden":`true`},`close`,-1)]],8,k2n)])):b(``,!0)}});o(),we(),M();var j2n={class:`m-4 mb-0 rounded border border-blue-200 bg-blue-50 text-sm`,"data-testid":`system-file-banner`},M2n={class:`flex items-start gap-2 px-3 py-2`},N2n={class:`flex-1 min-w-0`},P2n={class:`flex items-center gap-2 flex-wrap`},F2n={class:`font-semibold text-blue-900`},I2n={key:0,class:`mt-1 text-gray-700 leading-snug whitespace-pre-line`},L2n={key:1,class:`mt-1 text-xs text-gray-500`},R2n=[`href`],z2n=[`aria-label`],B2n=`systemFileBanner.collapsed.`,V2n=`ℹ️`,H2n=`https://github.com/receptron/mulmoclaude/blob/main/`,U2n=K({__name:`SystemFileBanner`,props:{descriptor:{},path:{}},setup(e){let{t}=We(),n=e;function r(e){return B2n+e}function i(e){try{return localStorage.getItem(r(e))===`1`}catch{return!1}}function a(e,t){try{t?localStorage.setItem(r(e),`1`):localStorage.removeItem(r(e))}catch{}}let o=V(i(n.descriptor.id));Ve(()=>n.descriptor.id,e=>{o.value=i(e)});function s(){o.value=!o.value,a(n.descriptor.id,o.value)}let l={"agent-managed-but-hand-editable":`bg-emerald-100 text-emerald-800`,"user-editable":`bg-blue-100 text-blue-800`,"agent-managed":`bg-amber-100 text-amber-800`,"fragile-format":`bg-orange-100 text-orange-800`,ephemeral:`bg-gray-200 text-gray-700`},u=m(()=>l[n.descriptor.editPolicy]),d=m(()=>n.descriptor.schemaRef?H2n+n.descriptor.schemaRef:``);return(n,r)=>(B(),U(`div`,j2n,[S(`div`,M2n,[S(`span`,{class:`text-blue-600 shrink-0`,"aria-hidden":`true`},T(V2n)),S(`div`,N2n,[S(`div`,P2n,[S(`span`,F2n,T(q(t)(`systemFiles.${e.descriptor.id}.title`)),1),S(`span`,{class:c([`text-xs px-1.5 py-0.5 rounded shrink-0`,u.value])},T(q(t)(`systemFiles.editPolicy.${e.descriptor.editPolicy}`)),3)]),o.value?b(``,!0):(B(),U(`p`,I2n,T(q(t)(`systemFiles.${e.descriptor.id}.summary`)),1)),!o.value&&e.descriptor.schemaRef?(B(),U(`p`,L2n,[J(T(q(t)(`systemFiles.schemaLabel`))+`: `,1),S(`a`,{href:d.value,target:`_blank`,rel:`noopener noreferrer`,class:`font-mono text-blue-700 hover:underline break-all`},T(e.descriptor.schemaRef),9,R2n)])):b(``,!0)]),S(`button`,{type:`button`,class:`shrink-0 text-xs text-blue-700 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 rounded px-1`,"aria-label":o.value?q(t)(`systemFiles.showDetails`):q(t)(`systemFiles.hideDetails`),"data-testid":`system-file-banner-toggle`,onClick:s},T(o.value?q(t)(`systemFiles.showDetails`):q(t)(`systemFiles.hideDetails`)),9,z2n)])]))}});M();function W2n(e){return`${e.split(`/`).pop()?.replace(/\.html?$/i,``)||`share`}.zip`}function G2n(){let e=V(!1),t=V(!1);async function n(n){t.value=!1,e.value=!0;try{let e=await _N(SP.share.pack,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})});if(!e.ok){t.value=!0;return}KU(await e.blob(),Y3t(e.headers.get(`content-disposition`),W2n(n)))}catch{t.value=!0}finally{e.value=!1}}function r(){t.value=!1}return{packing:e,packFailed:t,downloadZip:n,reset:r}}M(),o();var K2n=`download`;function q2n(e,t){let n=V(!1),r=V(null),i=0,a=null;function o(){i+=1,a?.abort(),a=null}Ve(e,()=>{o(),n.value=!1,r.value=null});async function s(){let s=e.value;if(!s)return;o();let c=i,l=new AbortController;a=l,n.value=!0,r.value=null;try{let e=await _N(SP.files.raw,{query:{path:s},signal:l.signal});if(c!==i)return;if(!e.ok){r.value=t();return}let n=await e.blob();if(c!==i)return;KU(n,KOn(s,K2n))}catch{if(c!==i)return;r.value=t()}finally{c===i&&(n.value=!1)}}return{busy:n,error:r,download:s}}o(),M(),we();var J2n={class:`flex-1 overflow-auto min-h-0`},Y2n={key:0,class:`h-full flex items-center justify-center text-gray-400 text-sm`},X2n={key:1,class:`p-4 text-sm text-red-600`},Z2n={key:2,class:`p-4 text-sm text-gray-400`},Q2n={key:1,class:`h-full flex flex-col overflow-y-auto`},$2n={class:`m-auto w-full`},e4n=[`title`,`aria-label`],t4n={key:2,class:`shrink-0 m-4 mt-0 rounded border border-red-300 bg-red-50 p-2 text-xs text-red-700`,role:`alert`,"data-testid":`files-marp-save-error`},n4n={key:1,class:`h-full flex flex-col overflow-auto`},r4n={key:0,class:`shrink-0 m-4 mb-0 rounded border border-gray-200 bg-gray-50 p-3 text-xs`},i4n={class:`font-semibold text-gray-600 shrink-0`},a4n={key:0,class:`flex flex-wrap gap-1`},o4n={key:1,class:`text-gray-800 break-words`},s4n={key:1,class:`shrink-0 m-4 mt-0 rounded border border-red-300 bg-red-50 p-2 text-xs text-red-700`,role:`alert`},c4n={key:2,class:`p-4 text-xs whitespace-pre-wrap font-mono text-gray-800`},l4n={key:3,class:`relative w-full h-full`},u4n={key:0,class:`absolute top-2 right-2 z-10 flex flex-col items-end gap-1`},d4n=[`title`,`disabled`],f4n={key:0,class:`text-xs text-red-600 bg-white/90 px-1 rounded`,role:`alert`},p4n=[`src`,`title`],m4n=[`srcdoc`,`title`],h4n={key:5,class:`h-full flex flex-col overflow-auto`},g4n={class:`shrink-0 flex items-center justify-end gap-2 px-4 pt-3`},_4n={key:0,class:`text-xs text-red-600 self-center`,"data-testid":`files-json-invalid-hint`},v4n=[`disabled`,`title`],y4n={key:1,class:`flex-1 p-4 text-xs whitespace-pre-wrap font-mono text-gray-800`},b4n={key:2,class:`shrink-0 m-4 mt-0 rounded border border-red-300 bg-red-50 p-2 text-xs text-red-700`,role:`alert`,"data-testid":`files-json-save-error`},x4n={key:6,class:`p-4 space-y-2`},S4n={key:0,class:`text-xs text-red-600 mb-1 font-sans`},C4n={class:`text-xs font-mono text-gray-800 whitespace-pre-wrap`},w4n={key:7,class:`p-4 text-xs whitespace-pre-wrap font-mono text-gray-800`},T4n={key:2,class:`h-full flex items-center justify-center p-4`},E4n=[`src`,`alt`],D4n=[`src`,`title`],O4n={key:4,class:`h-full flex items-center justify-center p-4`},k4n=[`src`],A4n={key:5,class:`h-full flex items-center justify-center p-4 bg-black`},j4n=[`src`],M4n={key:6,class:`p-4 text-sm text-gray-500 flex flex-col gap-3`},N4n={key:1},P4n={class:`flex flex-wrap items-center gap-2`},F4n=[`disabled`],I4n=[`disabled`],L4n={key:0,class:`mt-2 text-xs text-red-600`,"data-testid":`file-download-error`},R4n={key:1,class:`mt-2 text-xs text-red-600`},z4n=K({__name:`FileContentRenderer`,props:{selectedPath:{},content:{},contentError:{},contentLoading:{type:Boolean},isMarkdown:{type:Boolean},isHtml:{type:Boolean},isJson:{type:Boolean},isJsonl:{type:Boolean},mdRawMode:{type:Boolean},sandboxedHtml:{},htmlPreviewUrl:{},jsonTokens:{},jsonlLines:{},mdFrontmatter:{},rawSaveError:{}},emits:[`markdownLinkClick`,`updateSource`],setup(e,{emit:t}){let n=IL(`markdown`,az),r=IL(`markdown`,cOt),i=Ae(()=>Xe(()=>import(`./JsonEditor-zdl4EA3_.js`),__vite__mapDeps([51,5,52,53,54]))),{t:a}=We(),o=e,s=t,l=m(()=>o.selectedPath?j0n(o.selectedPath):null),{packing:u,packFailed:d,downloadZip:f,reset:p}=G2n(),h=m(()=>!!(o.isHtml&&o.htmlPreviewUrl&&o.selectedPath?.toLowerCase().endsWith(`.html`)));function g(){o.selectedPath&&f(o.selectedPath)}Ve(()=>o.selectedPath,()=>p());let _=m(()=>!!(o.mdFrontmatter&&ez(o.mdFrontmatter.meta))),v=m(()=>{let e=o.selectedPath;if(!e)return;let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}),y=m(()=>{let e=o.selectedPath??``,t=e.lastIndexOf(`/`),n=t>=0?e.slice(t+1):e,r=n.lastIndexOf(`.`);return $R({name:r>0?n.slice(0,r):n,fallback:`slides`})}),{busy:x,error:C,open:w}=x2n(Ee(o,`selectedPath`),()=>a(`fileContentRenderer.openInOsFailed`)),{busy:E,error:O,download:k}=q2n(Ee(o,`selectedPath`),()=>a(`common.downloadFailed`)),A=V(!1),j=V(``),M=m(()=>o.isJson&&o.selectedPath!==null&&o.content?.kind===`text`&&N0n(o.selectedPath)),N=m(()=>{try{return JSON.parse(j.value),!0}catch{return!1}});function P(){o.content?.kind===`text`&&(j.value=o.content.content,A.value=!0)}function F(){A.value=!1}function I(){s(`updateSource`,j.value)}let L=V(!1),R=V(``);function z(){o.content?.kind===`text`&&(R.value=o.content.content,L.value=!0)}function ee(){L.value=!1}function te(){s(`updateSource`,R.value)}Ve(()=>o.content,()=>{A.value=!1,L.value=!1});function ne(e){return`${SP.files.raw}?path=${encodeURIComponent(e)}`}function re(e){let t=o.selectedPath??``,n=t.lastIndexOf(`/`),r=n>=0?t.slice(0,n):``,i=KR(e,r),a=o.content?.kind===`text`?o.content.content:e,s=o.mdFrontmatter!==null;return{uuid:`files-preview`,toolName:`text-response`,message:i,title:o.selectedPath??``,data:{text:i,role:`assistant`,transportKind:`text-rest`,pdfSourceText:a,pdfBaseDir:r,pdfStripFrontmatter:s}}}return(t,o)=>(B(),U(`div`,J2n,[e.selectedPath?e.contentError?(B(),U(`div`,X2n,T(e.contentError),1)):e.contentLoading?(B(),U(`div`,Z2n,T(q(a)(`common.loading`)),1)):e.content?(B(),U(D,{key:3},[l.value&&e.selectedPath?(B(),ke(U2n,{key:0,descriptor:l.value,path:e.selectedPath},null,8,[`descriptor`,`path`])):b(``,!0),e.content.kind===`text`?(B(),U(D,{key:1},[e.isMarkdown&&!e.mdRawMode&&_.value?(B(),U(D,{key:0},[L.value?(B(),ke(q(r),{key:0,modelValue:R.value,"onUpdate:modelValue":o[0]||=e=>R.value=e,"pdf-filename":y.value,"base-dir":v.value,"editor-label":q(a)(`fileContentRenderer.marpEditorLabel`)},{actions:Ie(()=>[S(`button`,{class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,"data-testid":`files-marp-cancel-btn`,onClick:ee},T(q(a)(`common.cancel`)),1),S(`button`,{class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded bg-green-600 hover:bg-green-700 text-white`,"data-testid":`files-marp-save-btn`,onClick:te},[o[6]||=S(`span`,{class:`material-icons text-sm`,"aria-hidden":`true`},`save`,-1),J(` `+T(q(a)(`common.save`)),1)])]),_:1},8,[`modelValue`,`pdf-filename`,`base-dir`,`editor-label`])):(B(),U(`div`,Q2n,[S(`div`,$2n,[De(q(n),{markdown:e.content.content,"pdf-filename":y.value,"base-dir":v.value},{toolbar:Ie(()=>[S(`button`,{class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-gray-600 hover:bg-gray-50 text-sm`,title:q(a)(`fileContentRenderer.editMarp`),"aria-label":q(a)(`fileContentRenderer.editMarp`),"data-testid":`files-marp-edit-btn`,onClick:z},[o[7]||=S(`span`,{class:`material-icons text-sm`,"aria-hidden":`true`},`edit`,-1),J(` `+T(q(a)(`fileContentRenderer.editMarp`)),1)],8,e4n)]),_:1},8,[`markdown`,`pdf-filename`,`base-dir`])])])),e.rawSaveError?(B(),U(`div`,t4n,` ⚠ `+T(e.rawSaveError),1)):b(``,!0)],64)):e.isMarkdown&&!e.mdRawMode?(B(),U(`div`,n4n,[e.mdFrontmatter&&e.mdFrontmatter.fields.length>0?(B(),U(`div`,r4n,[(B(!0),U(D,null,H(e.mdFrontmatter.fields,e=>(B(),U(`div`,{key:e.key,class:`flex items-baseline gap-2 py-0.5`},[S(`span`,i4n,T(e.key)+`:`,1),Array.isArray(e.value)?(B(),U(`span`,a4n,[(B(!0),U(D,null,H(e.value,(e,t)=>(B(),U(`span`,{key:String(t)+`:`+q(Va)(e),class:`rounded-full bg-white border border-gray-300 px-2 py-0.5 text-gray-700`},T(q(Va)(e)),1))),128))])):(B(),U(`span`,o4n,T(q(Va)(e.value)),1))]))),128))])):b(``,!0),S(`div`,{class:`flex-1 min-h-0`,onClickCapture:o[2]||=e=>s(`markdownLinkClick`,e)},[De(_4,{"selected-result":re(e.mdFrontmatter?e.mdFrontmatter.body:e.content.content),"editable-source":e.content.content,onUpdateSource:o[1]||=e=>s(`updateSource`,e)},null,8,[`selected-result`,`editable-source`])],32),e.rawSaveError?(B(),U(`div`,s4n,` ⚠ `+T(e.rawSaveError),1)):b(``,!0)])):e.isMarkdown&&e.mdRawMode?(B(),U(`pre`,c4n,T(e.content.content),1)):e.isHtml&&e.htmlPreviewUrl?(B(),U(`div`,l4n,[h.value?(B(),U(`div`,u4n,[S(`button`,{class:`px-2 py-1 text-xs rounded border border-gray-300 bg-white/90 text-gray-600 hover:bg-gray-50 disabled:opacity-50 shadow-sm`,title:q(a)(`fileContentRenderer.downloadZip`),disabled:q(u),"data-testid":`file-html-download`,onClick:g},[o[8]||=S(`span`,{class:`material-icons text-sm align-middle`},`download`,-1),J(` `+T(q(a)(`fileContentRenderer.download`)),1)],8,d4n),q(d)?(B(),U(`span`,f4n,T(q(a)(`fileContentRenderer.downloadError`)),1)):b(``,!0)])):b(``,!0),S(`iframe`,{src:e.htmlPreviewUrl,class:`w-full h-full border-0`,sandbox:`allow-scripts`,title:q(a)(`fileContentRenderer.htmlPreview`)},null,8,p4n)])):e.isHtml?(B(),U(`iframe`,{key:4,srcdoc:e.sandboxedHtml,class:`w-full h-full border-0`,sandbox:`allow-scripts`,title:q(a)(`fileContentRenderer.htmlPreview`)},null,8,m4n)):e.isJson?(B(),U(`div`,h4n,[S(`div`,g4n,[A.value?(B(),U(D,{key:0},[S(`button`,{class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,"data-testid":`files-json-cancel-btn`,onClick:F},T(q(a)(`common.cancel`)),1),N.value?b(``,!0):(B(),U(`span`,_4n,T(q(a)(`fileContentRenderer.invalidJson`)),1)),S(`button`,{class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded bg-green-600 hover:bg-green-700 text-white disabled:opacity-40 disabled:cursor-not-allowed`,"data-testid":`files-json-save-btn`,disabled:!N.value,title:N.value?void 0:q(a)(`fileContentRenderer.invalidJson`),onClick:I},[o[9]||=S(`span`,{class:`material-icons text-sm`},`save`,-1),J(` `+T(q(a)(`common.save`)),1)],8,v4n)],64)):M.value?(B(),U(`button`,{key:1,class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,"data-testid":`files-json-edit-btn`,onClick:P},[o[10]||=S(`span`,{class:`material-icons text-sm`},`edit`,-1),J(` `+T(q(a)(`fileContentRenderer.editJson`)),1)])):b(``,!0)]),A.value?(B(),ke(q(i),{key:0,modelValue:j.value,"onUpdate:modelValue":o[3]||=e=>j.value=e,"editor-label":q(a)(`fileContentRenderer.jsonEditorLabel`),class:`flex-1 min-h-0 m-4`},null,8,[`modelValue`,`editor-label`])):(B(),U(`pre`,y4n,[(B(!0),U(D,null,H(e.jsonTokens,(e,t)=>(B(),U(`span`,{key:t,class:c(q(Ilt)[e.type])},T(e.value),3))),128))])),e.rawSaveError?(B(),U(`div`,b4n,` ⚠ `+T(e.rawSaveError),1)):b(``,!0)])):e.isJsonl?(B(),U(`div`,x4n,[(B(!0),U(D,null,H(e.jsonlLines,(e,t)=>(B(),U(`div`,{key:t,class:c([`rounded border bg-gray-50 p-3`,e.parseError?`border-red-300`:`border-gray-200`])},[e.parseError?(B(),U(`div`,S4n,T(q(a)(`fileContentRenderer.parseError`)),1)):b(``,!0),S(`pre`,C4n,[(B(!0),U(D,null,H(e.tokens,(e,t)=>(B(),U(`span`,{key:t,class:c(q(Ilt)[e.type])},T(e.value),3))),128))])],2))),128))])):(B(),U(`pre`,w4n,T(e.content.content),1))],64)):e.content.kind===`image`&&e.selectedPath?(B(),U(`div`,T4n,[S(`img`,{src:ne(e.selectedPath),alt:e.selectedPath,class:`max-w-full max-h-full object-contain`},null,8,E4n)])):e.content.kind===`pdf`&&e.selectedPath?(B(),U(`iframe`,{key:3,src:ne(e.selectedPath),class:`w-full h-full border-0`,title:q(a)(`fileContentRenderer.pdfPreview`)},null,8,D4n)):e.content.kind===`audio`&&e.selectedPath?(B(),U(`div`,O4n,[(B(),U(`audio`,{key:e.selectedPath,src:ne(e.selectedPath),controls:``,preload:`metadata`,class:`w-full max-w-2xl`},null,8,k4n))])):e.content.kind===`video`&&e.selectedPath?(B(),U(`div`,A4n,[(B(),U(`video`,{key:e.selectedPath,src:ne(e.selectedPath),controls:``,preload:`metadata`,class:`max-w-full max-h-full`},null,8,j4n))])):(B(),U(`div`,M4n,[`message`in e.content?(B(),U(D,{key:0},[J(T(e.content.message),1)],64)):b(``,!0),e.selectedPath?(B(),U(`div`,N4n,[S(`div`,P4n,[S(`button`,{type:`button`,class:`h-8 px-3 flex items-center gap-1 rounded border border-gray-300 bg-white hover:bg-gray-50 text-gray-700 font-medium disabled:opacity-50`,disabled:q(E),"data-testid":`file-download`,onClick:o[4]||=(...e)=>q(k)&&q(k)(...e)},[o[11]||=S(`span`,{class:`material-icons text-sm`},`download`,-1),J(` `+T(q(E)?q(a)(`fileContentRenderer.downloadingFile`):q(a)(`fileContentRenderer.downloadFile`)),1)],8,F4n),S(`button`,{type:`button`,class:`h-8 px-3 flex items-center gap-1 rounded border border-gray-300 bg-white hover:bg-gray-50 text-gray-700 font-medium disabled:opacity-50`,disabled:q(x),"data-testid":`file-open-in-os`,onClick:o[5]||=(...e)=>q(w)&&q(w)(...e)},[o[12]||=S(`span`,{class:`material-icons text-sm`},`open_in_new`,-1),J(` `+T(q(x)?q(a)(`fileContentRenderer.openingInOs`):q(a)(`fileContentRenderer.openInOs`)),1)],8,I4n)]),q(O)?(B(),U(`p`,L4n,T(q(O)),1)):b(``,!0),q(C)?(B(),U(`p`,R4n,T(q(C)),1)):b(``,!0)])):b(``,!0)]))],64)):b(``,!0):(B(),U(`div`,Y2n,T(q(a)(`fileContentRenderer.selectFile`)),1))]))}});function B4n(e){let t=e.split(`/`).filter(Boolean);if(t.length<=1)return[];let n=[];for(let e=1;e<t.length;e++)n.push(t.slice(0,e).join(`/`));return n}function V4n(e,t,n){let r=new Map(e);return r.set(t,n),r}function H4n(e,t){let n=new Map(e);return n.delete(t),n}M();function U4n(){let e=V(null),t=V(new Map),n=V(null),r=0,i=new Map;function a(e){let t=(i.get(e)??0)+1;return i.set(e,t),t}async function o(o){if(t.value.has(o))return;let s=r,c=a(o);t.value=V4n(t.value,o,null);let l=await pN(SP.files.dir,{path:o});if(s!==r||i.get(o)!==c)return;if(!l.ok){t.value=H4n(t.value,o),n.value=l.error||`dir: ${l.status}`;return}let u=l.data;t.value=V4n(t.value,o,u.children??[]),o===``&&(e.value={...u,children:[]})}async function s(){r++,e.value=null,t.value=new Map,n.value=null,await o(``)}async function c(e){a(e),t.value=H4n(t.value,e),await o(e)}return{rootNode:e,childrenByPath:t,treeError:n,loadDirChildren:o,reloadRoot:s,reloadDirChildren:c}}M();function W4n(){let e=V([]);async function t(){let t=await pN(SP.files.refRoots);t.ok&&Array.isArray(t.data)&&(e.value=t.data)}return{refRoots:e,loadRefRoots:t}}function G4n(){let{expand:e}=b0n(),t=U4n(),{refRoots:n,loadRefRoots:r}=W4n();async function i(n){for(let r of B4n(n))e(r),await t.loadDirChildren(r)}return{rootNode:t.rootNode,refRoots:n,childrenByPath:t.childrenByPath,treeError:t.treeError,loadDirChildren:t.loadDirChildren,ensureAncestorsLoaded:i,reloadRoot:t.reloadRoot,reloadDirChildren:t.reloadDirChildren,loadRefRoots:r}}M();var K4n=`files_md_raw_mode`;function q4n(){let e=V(localStorage.getItem(K4n)===`true`);function t(){e.value=!e.value,localStorage.setItem(K4n,String(e.value))}return{mdRawMode:e,toggleMdRaw:t}}M();var J4n=`files_sort_mode`;function Y4n(){return localStorage.getItem(J4n)===`recent`?`recent`:`name`}function X4n(){let e=V(Y4n());function t(t){e.value=t,localStorage.setItem(J4n,t)}return{sortMode:e,setSortMode:t}}M();var Z4n=`filesView.showHiddenSystem`;function Q4n(){return localStorage.getItem(Z4n)===`true`}function $4n(){let e=V(Q4n());function t(t){e.value=t,localStorage.setItem(Z4n,t?`true`:`false`)}return{showHiddenSystem:e,setShowHiddenSystem:t}}function e3n(e,t){function n(n){if(n.button!==0||n.ctrlKey||n.metaKey||n.shiftKey)return;let{target:r}=n;if(!(r instanceof Element))return;let i=r.closest(`a`);if(!i)return;let a=i.getAttribute(`href`);if(!a||m4(a)||a.startsWith(`#`)||!e.value)return;let o=qOn(e.value,a);if(!o)return;n.preventDefault(),n.stopPropagation();let s=JOn(o);if(s!==null){t.onLoadSession(s);return}t.onNavigate(o)}return{handleMarkdownLinkClick:n}}o(),M(),we();var t3n={class:`h-full flex bg-white`,"data-testid":`files-view-root`},n3n={class:`flex-1 flex flex-col min-w-0 overflow-hidden`},r3n=6e4,i3n=4e3,a3n=K({__name:`FilesView`,props:{refreshToken:{}},emits:[`loadSession`],setup(e,{emit:t}){let n=OI(),{t:r}=We(),i=e,a=t,{rootNode:o,refRoots:s,childrenByPath:l,treeError:u,loadDirChildren:d,ensureAncestorsLoaded:f,reloadDirChildren:p,reloadRoot:h,loadRefRoots:g}=G4n(),{selectedPath:v,content:y,contentLoading:x,contentError:C,loadContent:w,selectFile:E,deselectFile:D,abortContent:O}=Jlt(),{mdRawMode:k,toggleMdRaw:A}=q4n(),{sortMode:j,setSortMode:M}=X4n(),{showHiddenSystem:N,setShowHiddenSystem:F}=$4n(),{isMarkdown:I,isHtml:L,isJson:R,isJsonl:z,sandboxedHtml:H,htmlPreviewUrl:ee,jsonTokens:te,jsonlLines:ne,mdFrontmatter:re}=Klt(v,y),ie=V(null);async function ae(e){if(!v.value||y.value?.kind!==`text`||e===y.value.content)return;let t=v.value;ie.value=null;let n=await hN(SP.files.content,{path:t,content:e});if(v.value===t){if(!n.ok){ie.value=n.error;return}y.value={kind:`text`,path:n.data.path,content:e,size:n.data.size,modifiedMs:n.data.modifiedMs}}}Ve(y,()=>{ie.value=null});async function oe(e){let{folder:t,filename:n,resolve:i}=e,a=t?`${t}/${n}`:n,o=l.value.get(t);if(Array.isArray(o)&&o.some(e=>e.name===n)){i(!1,r(`fileTree.newFileError.exists`,{filename:n}));return}let s=await mN(SP.files.create,{path:a,content:``});if(!s.ok){if(s.status===409){i(!1,r(`fileTree.newFileError.exists`,{filename:n})),await p(t);return}i(!1,r(`fileTree.newFileError.saveFailed`));return}i(!0),await p(t),E(s.data.path)}let W=V(null),se=null,ce=m(()=>{let e=W.value;return e===null?null:e.done<e.total?{failed:!1,message:r(`fileTree.upload.progress`,{done:e.done,total:e.total})}:e.failed>0?{failed:!0,message:r(`fileTree.upload.failed`,{count:e.failed})}:{failed:!1,message:r(`fileTree.upload.done`,{count:e.total})}});function le(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`file read failed`)),r.onload=()=>t(typeof r.result==`string`?r.result:``),r.readAsDataURL(e)})}async function ue(e,t){try{let n=await le(t);return n!==``&&(await mN(SP.files.upload,{dir:e,filename:t.name,dataUrl:n})).ok}catch{return!1}}async function de(e){let{folder:t,files:n}=e;se!==null&&(clearTimeout(se),se=null);let r=W.value;W.value=r===null?{done:0,total:n.length,failed:0}:{done:r.done,total:r.total+n.length,failed:r.failed};for(let e of n){let r=await ue(t,e),i=W.value;W.value=i===null?{done:1,total:n.length,failed:+!r}:{done:i.done+1,total:i.total,failed:i.failed+ +!r}}await p(t);let i=W.value;i!==null&&i.done>=i.total&&(se=setTimeout(()=>{W.value=null},i3n))}let fe=m(()=>{let e=new Set,t=Date.now();for(let n of l.value.values())if(n)for(let r of n)r.type===`file`&&r.modifiedMs&&t-r.modifiedMs<r3n&&e.add(r.path);return e}),{handleMarkdownLinkClick:G}=e3n(v,{onNavigate:E,onLoadSession:e=>a(`loadSession`,e)});Ve(()=>eL(n.params.pathMatch),e=>{if(!$I(e)){v.value!==null&&(v.value=null,y.value=null);return}e!==v.value&&(v.value=e,w(e))}),Ve(v,e=>{e&&f(e)},{immediate:!0});let pe=V(null),me=0;function he(){v.value&&me===0&&(me=requestAnimationFrame(()=>{me=0;let e=pe.value?.$el;e instanceof HTMLElement&&e.querySelector(`button[data-selected="true"]`)?.scrollIntoView({block:`nearest`})}))}return Ve(v,he),Ve(l,he),Ve(()=>i.refreshToken,()=>{h(),v.value&&w(v.value)}),P(async()=>{await d(``),await g(),v.value&&w(v.value)}),_(()=>{O(),me!==0&&cancelAnimationFrame(me)}),(e,t)=>(B(),U(`div`,t3n,[De(m2n,{ref_key:`treePaneRef`,ref:pe,"root-node":q(o),"ref-roots":q(s),"children-by-path":q(l),"tree-error":q(u),"selected-path":q(v),"recent-paths":fe.value,"sort-mode":q(j),"show-hidden-system":q(N),onSelect:q(E),onLoadChildren:q(d),"onUpdate:sortMode":q(M),"onUpdate:showHiddenSystem":q(F),onCreateFile:oe,onUploadFiles:de},null,8,[`root-node`,`ref-roots`,`children-by-path`,`tree-error`,`selected-path`,`recent-paths`,`sort-mode`,`show-hidden-system`,`onSelect`,`onLoadChildren`,`onUpdate:sortMode`,`onUpdate:showHiddenSystem`]),ce.value?(B(),U(`div`,{key:0,class:c([`fixed bottom-4 left-4 z-50 px-3 py-2 rounded shadow-md text-sm`,ce.value.failed?`bg-red-50 text-red-700 border border-red-200`:`bg-blue-50 text-blue-700 border border-blue-200`]),"data-testid":`file-upload-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},T(ce.value.message),3)):b(``,!0),S(`div`,n3n,[De(A2n,{"selected-path":q(v),size:q(y)?.size??null,"modified-ms":q(y)?.modifiedMs??null,"is-markdown":q(I),"md-raw-mode":q(k),onToggleMdRaw:q(A),onDeselect:q(D)},null,8,[`selected-path`,`size`,`modified-ms`,`is-markdown`,`md-raw-mode`,`onToggleMdRaw`,`onDeselect`]),De(z4n,{"selected-path":q(v),content:q(y),"content-error":q(C),"content-loading":q(x),"is-markdown":q(I),"is-html":q(L),"is-json":q(R),"is-jsonl":q(z),"md-raw-mode":q(k),"sandboxed-html":q(H),"html-preview-url":q(ee),"json-tokens":q(te),"jsonl-lines":q(ne),"md-frontmatter":q(re),"raw-save-error":ie.value,onMarkdownLinkClick:q(G),onUpdateSource:ae},null,8,[`selected-path`,`content`,`content-error`,`content-loading`,`is-markdown`,`is-html`,`is-json`,`is-jsonl`,`md-raw-mode`,`sandboxed-html`,`html-preview-url`,`json-tokens`,`jsonl-lines`,`md-frontmatter`,`raw-save-error`,`onMarkdownLinkClick`]),q(v)&&!q(x)&&!q(C)?(B(),ke(OAn,{key:q(v),placeholder:q(r)(`filesView.chatPlaceholder`),"prepend-text":`Before answering, take a look at the file at ${q(v)}.`,"test-id-prefix":`files-page-chat`},null,8,[`placeholder`,`prepend-text`])):b(``,!0)])]))}}),o3n=[{id:`memory`,displayName:`settingsMcpTab.catalog.entry.memory.displayName`,description:`settingsMcpTab.catalog.entry.memory.description`,audience:`general`,upstreamUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/memory`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-memory`]},configSchema:[],riskLevel:`low`},{id:`sequential-thinking`,displayName:`settingsMcpTab.catalog.entry.sequentialThinking.displayName`,description:`settingsMcpTab.catalog.entry.sequentialThinking.description`,audience:`general`,upstreamUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-sequential-thinking`]},configSchema:[],riskLevel:`low`},{id:`context7`,displayName:`settingsMcpTab.catalog.entry.context7.displayName`,description:`settingsMcpTab.catalog.entry.context7.description`,audience:`general`,upstreamUrl:`https://github.com/upstash/context7`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@upstash/context7-mcp`]},configSchema:[],riskLevel:`low`},{id:`deepwiki`,displayName:`settingsMcpTab.catalog.entry.deepwiki.displayName`,description:`settingsMcpTab.catalog.entry.deepwiki.description`,audience:`general`,upstreamUrl:`https://docs.devin.ai/work-with-devin/deepwiki-mcp`,spec:{type:`http`,url:`https://mcp.deepwiki.com/sse`},configSchema:[],riskLevel:`low`},{id:`notion`,displayName:`settingsMcpTab.catalog.entry.notion.displayName`,description:`settingsMcpTab.catalog.entry.notion.description`,audience:`general`,upstreamUrl:`https://github.com/makenotion/notion-mcp-server`,setupGuideUrl:`https://www.notion.so/help/create-integrations-with-the-notion-api`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@notionhq/notion-mcp-server`],env:{NOTION_TOKEN:"${NOTION_API_KEY}"}},configSchema:[{key:`NOTION_API_KEY`,label:`settingsMcpTab.catalog.entry.notion.field.apiKey.label`,kind:`secret`,placeholder:`secret_...`,required:!0,helpUrl:`https://www.notion.so/my-integrations`,helpText:`settingsMcpTab.catalog.entry.notion.field.apiKey.help`}],riskLevel:`medium`},{id:`slack`,displayName:`settingsMcpTab.catalog.entry.slack.displayName`,description:`settingsMcpTab.catalog.entry.slack.description`,audience:`general`,upstreamUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/slack`,setupGuideUrl:`https://api.slack.com/quickstart`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-slack`],env:{SLACK_BOT_TOKEN:"${SLACK_BOT_TOKEN}",SLACK_TEAM_ID:"${SLACK_TEAM_ID}"}},configSchema:[{key:`SLACK_BOT_TOKEN`,label:`settingsMcpTab.catalog.entry.slack.field.botToken.label`,kind:`secret`,placeholder:`xoxb-...`,required:!0,helpUrl:`https://api.slack.com/apps`,helpText:`settingsMcpTab.catalog.entry.slack.field.botToken.help`},{key:`SLACK_TEAM_ID`,label:`settingsMcpTab.catalog.entry.slack.field.teamId.label`,kind:`text`,placeholder:`T01ABC23DEF`,required:!0,helpUrl:`https://api.slack.com/methods/team.info`,helpText:`settingsMcpTab.catalog.entry.slack.field.teamId.help`}],riskLevel:`medium`},{id:`google-maps`,displayName:`settingsMcpTab.catalog.entry.googleMaps.displayName`,description:`settingsMcpTab.catalog.entry.googleMaps.description`,audience:`general`,upstreamUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/google-maps`,setupGuideUrl:`https://developers.google.com/maps/documentation/javascript/get-api-key`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-google-maps`],env:{GOOGLE_MAPS_API_KEY:"${GOOGLE_MAPS_API_KEY}"}},configSchema:[{key:`GOOGLE_MAPS_API_KEY`,label:`settingsMcpTab.catalog.entry.googleMaps.field.apiKey.label`,kind:`secret`,placeholder:`AIza...`,required:!0,helpUrl:`https://console.cloud.google.com/google/maps-apis/credentials`,helpText:`settingsMcpTab.catalog.entry.googleMaps.field.apiKey.help`}],riskLevel:`low`},{id:`apple-native`,displayName:`settingsMcpTab.catalog.entry.appleNative.displayName`,description:`settingsMcpTab.catalog.entry.appleNative.description`,audience:`general`,upstreamUrl:`https://github.com/Dhravya/apple-mcp`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@dhravya/apple-mcp`]},configSchema:[],riskLevel:`medium`},{id:`gmail`,displayName:`settingsMcpTab.catalog.entry.gmail.displayName`,description:`settingsMcpTab.catalog.entry.gmail.description`,audience:`general`,upstreamUrl:`https://github.com/GongRzhe/Gmail-MCP-Server`,setupGuideUrl:`https://developers.google.com/workspace/guides/create-credentials#desktop-app`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@gongrzhe/server-gmail-autoauth-mcp`],env:{GMAIL_OAUTH_PATH:"${GMAIL_OAUTH_PATH}"}},configSchema:[{key:`GMAIL_OAUTH_PATH`,label:`settingsMcpTab.catalog.entry.gmail.field.credentials.label`,kind:`path`,placeholder:`~/.gmail-mcp/credentials.json`,required:!0,helpUrl:`https://console.cloud.google.com/apis/credentials`,helpText:`settingsMcpTab.catalog.entry.gmail.field.credentials.help`}],riskLevel:`high`},{id:`google-calendar`,displayName:`settingsMcpTab.catalog.entry.googleCalendar.displayName`,description:`settingsMcpTab.catalog.entry.googleCalendar.description`,audience:`general`,upstreamUrl:`https://github.com/nspady/google-calendar-mcp`,setupGuideUrl:`https://developers.google.com/workspace/guides/create-credentials#desktop-app`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@cocal/google-calendar-mcp`],env:{GOOGLE_OAUTH_CREDENTIALS:"${GOOGLE_OAUTH_CREDENTIALS}"}},configSchema:[{key:`GOOGLE_OAUTH_CREDENTIALS`,label:`settingsMcpTab.catalog.entry.googleCalendar.field.credentials.label`,kind:`path`,placeholder:`~/.gcal-mcp/credentials.json`,required:!0,helpUrl:`https://console.cloud.google.com/apis/credentials`,helpText:`settingsMcpTab.catalog.entry.googleCalendar.field.credentials.help`}],riskLevel:`medium`},{id:`google-drive`,displayName:`settingsMcpTab.catalog.entry.googleDrive.displayName`,description:`settingsMcpTab.catalog.entry.googleDrive.description`,audience:`general`,upstreamUrl:`https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gdrive`,setupGuideUrl:`https://developers.google.com/workspace/guides/create-credentials#desktop-app`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-gdrive`],env:{GDRIVE_CREDENTIALS_PATH:"${GDRIVE_CREDENTIALS_PATH}"}},configSchema:[{key:`GDRIVE_CREDENTIALS_PATH`,label:`settingsMcpTab.catalog.entry.googleDrive.field.credentials.label`,kind:`path`,placeholder:`~/.gdrive-mcp/credentials.json`,required:!0,helpUrl:`https://console.cloud.google.com/apis/credentials`,helpText:`settingsMcpTab.catalog.entry.googleDrive.field.credentials.help`}],riskLevel:`medium`},{id:`github`,displayName:`settingsMcpTab.catalog.entry.github.displayName`,description:`settingsMcpTab.catalog.entry.github.description`,audience:`general`,upstreamUrl:`https://github.com/github/github-mcp-server`,setupGuideUrl:`https://docs.github.com/en/copilot/how-tos/provide-context/use-mcp/set-up-the-github-mcp-server`,spec:{type:`http`,url:`https://api.githubcopilot.com/mcp/`,headers:{Authorization:"Bearer ${GITHUB_PERSONAL_ACCESS_TOKEN}"}},configSchema:[{key:`GITHUB_PERSONAL_ACCESS_TOKEN`,label:`settingsMcpTab.catalog.entry.github.field.token.label`,kind:`secret`,placeholder:`ghp_…`,required:!0,helpUrl:`https://github.com/settings/tokens`,helpText:`settingsMcpTab.catalog.entry.github.field.token.help`}],riskLevel:`medium`},{id:`linear`,displayName:`settingsMcpTab.catalog.entry.linear.displayName`,description:`settingsMcpTab.catalog.entry.linear.description`,audience:`general`,upstreamUrl:`https://github.com/tacticlaunch/mcp-linear`,setupGuideUrl:`https://linear.app/docs/personal-api-keys`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@tacticlaunch/mcp-linear`],env:{LINEAR_API_KEY:"${LINEAR_API_KEY}"}},configSchema:[{key:`LINEAR_API_KEY`,label:`settingsMcpTab.catalog.entry.linear.field.apiKey.label`,kind:`secret`,placeholder:`lin_api_…`,required:!0,helpUrl:`https://linear.app/settings/api`,helpText:`settingsMcpTab.catalog.entry.linear.field.apiKey.help`}],riskLevel:`medium`},{id:`weather-open-meteo`,displayName:`settingsMcpTab.catalog.entry.weatherOpenMeteo.displayName`,description:`settingsMcpTab.catalog.entry.weatherOpenMeteo.description`,audience:`general`,upstreamUrl:`https://www.npmjs.com/package/open-meteo-mcp`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`open-meteo-mcp`]},configSchema:[],riskLevel:`low`},{id:`spotify`,displayName:`settingsMcpTab.catalog.entry.spotify.displayName`,description:`settingsMcpTab.catalog.entry.spotify.description`,audience:`general`,upstreamUrl:`https://github.com/calebWei/SpotifyMCP`,setupGuideUrl:`https://developer.spotify.com/documentation/web-api/concepts/apps`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`spotify-mcp@latest`],env:{SPOTIFY_CLIENT_ID:"${SPOTIFY_CLIENT_ID}"}},configSchema:[{key:`SPOTIFY_CLIENT_ID`,label:`settingsMcpTab.catalog.entry.spotify.field.clientId.label`,kind:`secret`,placeholder:`spotify-client-id`,required:!0,helpUrl:`https://developer.spotify.com/dashboard`,helpText:`settingsMcpTab.catalog.entry.spotify.field.clientId.help`}],riskLevel:`medium`},{id:`youtube-transcript`,displayName:`settingsMcpTab.catalog.entry.youtubeTranscript.displayName`,description:`settingsMcpTab.catalog.entry.youtubeTranscript.description`,audience:`general`,upstreamUrl:`https://github.com/kimtaeyoon83/mcp-server-youtube-transcript`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@kimtaeyoon83/mcp-server-youtube-transcript`]},configSchema:[],riskLevel:`low`}];function s3n(e){return o3n.find(t=>t.id===e)??null}function c3n(e){return new Set(e.configSchema.filter(e=>e.required).map(e=>e.key))}var l3n=/\$\{([A-Z_][A-Z0-9_]*)\}/g;function u3n(e,t,n){let r=new Set,i=new Set,a=e=>e.replace(l3n,(e,a)=>{i.add(a);let o=t[a];return o===void 0||o===``?(n.has(a)&&r.add(a),``):o}),o;o=e.type===`http`?{type:`http`,url:a(e.url),...e.headers!==void 0&&{headers:d3n(e.headers,a)},...e.enabled!==void 0&&{enabled:e.enabled}}:{type:`stdio`,command:a(e.command),...e.args!==void 0&&{args:e.args.map(a)},...e.env!==void 0&&{env:d3n(e.env,a)},...e.enabled!==void 0&&{enabled:e.enabled}};for(let e of n)i.has(e)||r.add(e);return r.size>0?{ok:!1,missing:[...r]}:{ok:!0,spec:o}}function d3n(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=t(i);return n}o(),M(),we(),le();var f3n={class:`space-y-3`},p3n={"data-testid":`mcp-catalog`,class:`space-y-2 pt-1`},m3n={class:`text-xs font-semibold text-gray-700`},h3n={class:`group`,open:``,"data-testid":`mcp-catalog-audience-general`},g3n={class:`cursor-pointer text-xs font-medium text-gray-700 select-none py-1`},_3n={class:`text-gray-400 ml-1`},v3n={class:`mt-2 space-y-2`},y3n=[`data-testid`],b3n={class:`flex items-start gap-2 cursor-pointer`},x3n=[`checked`,`data-testid`,`onChange`],S3n={class:`flex-1 min-w-0`},C3n={class:`flex items-center gap-2 flex-wrap`},w3n={class:`text-sm font-semibold text-gray-800`},T3n={class:`text-xs text-gray-600 mt-0.5`},E3n={class:`text-[11px] text-gray-500 flex flex-wrap gap-x-3 ml-6`},D3n=[`href`,`data-testid`,`textContent`],O3n=[`href`,`data-testid`,`textContent`],k3n=[`data-testid`],A3n=[`data-testid`,`onSubmit`],j3n={class:`flex items-center gap-1.5`},M3n=[`for`],N3n=[`aria-label`],P3n=[`href`,`title`,`aria-label`,`data-testid`],F3n=[`id`,`onUpdate:modelValue`,`aria-required`,`data-testid`],I3n={key:0,value:``},L3n=[`value`],R3n=[`id`,`onUpdate:modelValue`,`type`,`placeholder`,`aria-required`,`data-testid`],z3n={key:2,class:`text-[11px] text-gray-500`},B3n=[`data-testid`],V3n={class:`flex gap-2 justify-end`},H3n=[`data-testid`],U3n=[`data-testid`],W3n={class:`text-xs font-semibold text-gray-700`},G3n={key:0,class:`text-xs text-gray-500 italic`,"data-testid":`mcp-empty`},K3n={key:1,class:`space-y-2`,"data-testid":`mcp-server-list`},q3n=[`data-testid`],J3n={class:`flex items-center justify-between`},Y3n={class:`flex items-center gap-2`},X3n={class:`text-sm font-semibold text-gray-800`},Z3n={class:`flex items-center gap-1 text-xs text-gray-600 ml-2`},Q3n=[`checked`,`data-testid`,`onChange`],$3n=[`data-testid`,`onClick`],e6n={key:0,class:`text-xs space-y-1`},t6n={class:`text-gray-500`},n6n={class:`ml-1`},r6n={key:1,class:`text-xs space-y-1`},i6n={class:`text-gray-500`},a6n={class:`ml-1`},o6n={key:0,class:`ml-1`},s6n=[`data-testid`],c6n={class:`flex items-start gap-1.5 text-gray-600 cursor-pointer`},l6n=[`checked`,`data-testid`,`onChange`],u6n={key:3,class:`border border-blue-300 rounded p-3 space-y-2`,"data-testid":`mcp-add-form`},d6n={class:`block text-xs font-semibold text-gray-700`},f6n=[`placeholder`],p6n={class:`flex gap-3 text-xs`},m6n={class:`flex items-center gap-1`},h6n={class:`flex items-center gap-1`},g6n={key:0,class:`space-y-2`},_6n={class:`block text-xs font-semibold text-gray-700`},v6n=[`placeholder`],y6n={key:1,class:`space-y-2`},b6n={class:`block text-xs font-semibold text-gray-700`},x6n={class:`block text-xs font-semibold text-gray-700`},S6n=[`placeholder`],C6n={key:2,class:`text-xs text-red-600`,"data-testid":`mcp-draft-error`},w6n={class:`flex justify-end gap-2`},T6n=`mcp-catalog-draft:`,E6n=`https://github.com/receptron/mulmoclaude/blob/main/docs/mcp-sandbox.md`,D6n=K({__name:`SettingsMcpTab`,props:{servers:{},dockerMode:{type:Boolean}},emits:[`add`,`update`,`remove`],setup(e,{expose:t,emit:n}){let{t:r}=We(),a=e,o=n,l=V(!1),d=V(P()),f=V(``),p=m(()=>o3n.filter(e=>e.audience===`general`));function h(e){return a.servers.some(t=>t.id===e)}function g(e,t){let n=t.target;if(!(n instanceof HTMLInputElement))return;if(n.checked){if(e.configSchema.length>0){x(e),n.checked=!1;return}o(`add`,{id:e.id,spec:{...e.spec,enabled:!0}});return}let r=a.servers.findIndex(t=>t.id===e.id);r>=0&&o(`remove`,r)}let _=V(null),v=V({}),y=V([]);function x(e){_.value=e.id,y.value=[],v.value=O(e.id);for(let t of e.configSchema)v.value[t.key]===void 0&&(v.value[t.key]=``)}function C(){_.value=null,v.value={},y.value=[]}function w(){C()}function E(e){y.value=[];let t=u3n(e.spec,v.value,c3n(e));if(!t.ok){y.value=t.missing,k(e.id,v.value,e.configSchema);return}o(`add`,{id:e.id,spec:{...t.spec,enabled:!0}}),j(e.id),C()}function O(e){try{let t=window.localStorage.getItem(T6n+e);if(!t)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n))typeof t==`string`&&(r[e]=t);return r}catch{return{}}}function k(e,t,n){let r=new Set(n.filter(e=>e.kind===`secret`).map(e=>e.key)),i={};for(let[e,n]of Object.entries(t))r.has(e)||(i[e]=n);try{window.localStorage.setItem(T6n+e,JSON.stringify(i))}catch{}}function j(e){try{window.localStorage.removeItem(T6n+e)}catch{}}function M(e){return e.kind===`secret`?`password`:e.kind===`url`?`url`:`text`}function N(e){return e===`low`?`bg-green-100 text-green-700`:e===`medium`?`bg-amber-100 text-amber-700`:`bg-red-100 text-red-700`}function P(){return{id:``,type:`http`,url:``,command:`npx`,argsText:``}}function I(){d.value=P(),f.value=``,l.value=!0}function L(){l.value=!1,f.value=``}let R=/^[a-z][a-z0-9_-]{0,63}$/;function z(e){return e.type===`http`?ee(e.url.trim()):te(e.argsText.split(`
5903
+ `),i=T$n(t);return r.length>0?`${i}\n\n${r}\n`:`${i}\n`}o(),M(),we();var D$n=[`disabled`,`title`,`aria-label`],O$n={class:`material-icons text-lg`,"aria-hidden":`true`},k$n=1500,A$n=K({__name:`CopyChatButton`,props:{results:{},resultTimestamps:{},sessionRoleName:{}},setup(e){let{t}=We(),n=e,r=V(!1),i=null;async function a(e){let t=await pN(SP.files.content,{path:e});return t.ok?t.data.content??null:null}async function o(){let e=await E$n(n.results,{sessionRoleName:n.sessionRoleName,resultTimestamps:n.resultTimestamps,readFile:a});try{await navigator.clipboard.writeText(e),r.value=!0,i!==null&&clearTimeout(i),i=setTimeout(()=>{r.value=!1,i=null},k$n)}catch{}}return _(()=>{i!==null&&clearTimeout(i)}),(n,i)=>(B(),U(`button`,{type:`button`,class:c([`h-8 w-8 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,{"!text-green-600":r.value}]),"data-testid":`copy-chat-md`,disabled:e.results.length===0,title:r.value?q(t)(`sidebarHeader.copiedMarkdown`):q(t)(`sidebarHeader.copyMarkdown`),"aria-label":r.value?q(t)(`sidebarHeader.copiedMarkdown`):q(t)(`sidebarHeader.copyMarkdown`),onClick:o},[S(`span`,O$n,T(r.value?`check`:`content_copy`),1)],10,D$n))}});o(),M(),we();var j$n={class:`flex-1 min-h-0 flex flex-col bg-gray-100`},M$n={class:`shrink-0 flex items-center gap-2 text-xs text-gray-400 px-3 py-2 border-b border-gray-100`,"data-testid":`sidebar-role-header`},N$n={key:1,class:`truncate`},P$n={class:`ml-auto flex items-center gap-0.5 shrink-0`},F$n=[`title`,`aria-label`,`aria-pressed`],I$n={class:`relative flex-1 min-h-0 flex flex-col`},L$n=[`onClick`],R$n={class:`absolute top-0 left-2 -translate-y-1/2 bg-gray-100 px-1 text-[10px] text-gray-400 leading-none pointer-events-none`},z$n={key:0,class:`absolute top-0 right-2 -translate-y-1/2 bg-gray-100 px-1 text-[10px] text-gray-400 leading-none pointer-events-none`},B$n={key:2,class:`block truncate p-2`},V$n=Qe(K({__name:`SessionSidebar`,props:{results:{},selectedUuid:{},resultTimestamps:{},sessionRoleName:{},sessionRoleIcon:{},sessionModel:{},sessionModelOverride:{},layoutMode:{},showRightSidebar:{type:Boolean},hasNewMessages:{type:Boolean}},emits:[`select`,`activate`,`update:layoutMode`,`toggle-right-sidebar`,`jump-to-latest`,`update:sessionModelOverride`],setup(e,{expose:t,emit:n}){let{t:r}=We();function i(e){if(e.toolName===`text-response`)return e.title??`Assistant`;let t=Ma(e)?e.action:void 0;return typeof t==`string`&&t.length>0?`${e.toolName}(${t})`:e.toolName}let a=n,o=V(null);return t({root:o}),(t,n)=>(B(),U(`div`,j$n,[S(`div`,M$n,[e.sessionRoleIcon?(B(),U(`span`,{key:0,class:c([`material-icons text-xs leading-none`,q(h9)])},T(e.sessionRoleIcon),3)):b(``,!0),e.sessionRoleName?(B(),U(`span`,N$n,T(e.sessionRoleName),1)):b(``,!0),e.sessionRoleName?(B(),ke(o$n,{key:2,model:e.sessionModel,override:e.sessionModelOverride,"onUpdate:override":n[0]||=e=>a(`update:sessionModelOverride`,e)},null,8,[`model`,`override`])):b(``,!0),S(`div`,P$n,[De(A$n,{results:e.results,"result-timestamps":e.resultTimestamps,"session-role-name":e.sessionRoleName},null,8,[`results`,`result-timestamps`,`session-role-name`]),S(`button`,{type:`button`,class:c([`h-8 w-8 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-colors`,{"!text-blue-500":e.showRightSidebar}]),title:q(r)(`sidebarHeader.toolCallHistory`),"aria-label":q(r)(`sidebarHeader.toolCallHistory`),"aria-pressed":e.showRightSidebar,onClick:n[1]||=e=>a(`toggle-right-sidebar`)},[...n[5]||=[S(`span`,{class:`material-icons text-lg`,"aria-hidden":`true`},`build`,-1)]],10,F$n),De(KQn,{"model-value":e.layoutMode,"onUpdate:modelValue":n[2]||=e=>a(`update:layoutMode`,e)},null,8,[`model-value`])])]),S(`div`,I$n,[e.hasNewMessages?(B(),U(`button`,{key:0,type:`button`,class:`absolute bottom-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 rounded-full bg-blue-600 px-3 py-1.5 text-xs font-medium text-white shadow-lg hover:bg-blue-700 transition-colors`,"data-testid":`chat-new-messages`,onClick:n[3]||=e=>a(`jump-to-latest`)},[J(T(q(r)(`sidebarHeader.newMessages`))+` `,1),n[6]||=S(`span`,{class:`material-icons text-sm leading-none`,"aria-hidden":`true`},`arrow_downward`,-1)])):b(``,!0),S(`div`,{ref_key:`root`,ref:o,class:`flex-1 min-h-0 overflow-y-auto p-2 space-y-2 outline-none`,tabindex:`0`,"data-testid":`tool-results-scroll`,onMousedown:n[4]||=e=>a(`activate`)},[(B(!0),U(D,null,H(e.results,t=>(B(),U(`div`,{key:t.uuid,class:c([`relative cursor-pointer rounded border border-gray-300 text-sm text-gray-900 hover:opacity-75 transition-opacity`,t.uuid===e.selectedUuid?`ring-2 ring-blue-500`:``]),onClick:e=>a(`select`,t.uuid)},[S(`span`,R$n,T(i(t)),1),e.resultTimestamps.get(t.uuid)?(B(),U(`span`,z$n,T(q(oz)(e.resultTimestamps.get(t.uuid))),1)):b(``,!0),q(O5)(t.toolName)?.previewComponent?(B(),ke(fe(q(O5)(t.toolName)?.previewComponent),{key:1,result:t},null,8,[`result`])):(B(),U(`span`,B$n,T(t.title||t.toolName),1))],10,L$n))),128))],544)])]))}}),[[`__scopeId`,`data-v-1abed690`]]),C9=1e3,w9=60*C9,H$n=60*w9;function U$n(e){let t=e>0?e:0;return t<C9?`${(Math.floor(t/100)/10).toFixed(1)}s`:t<w9?`${Math.floor(t/C9)}s`:t<H$n?`${Math.floor(t/w9)}m ${Math.floor(t%w9/C9)}s`:`${Math.floor(t/H$n)}h ${Math.floor(t%H$n/w9)}m`}o(),we(),M();var W$n={class:`px-2 py-1 text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`thinking-indicator`},G$n={class:`flex items-center gap-2 text-gray-500`},K$n={class:`text-xs`},q$n={key:0,class:`text-xs text-gray-400 tabular-nums`,"data-testid":`run-elapsed`},J$n={key:0,class:`mt-1 space-y-0.5`},Y$n={class:`font-mono truncate`},X$n={class:`text-xs text-gray-300 tabular-nums shrink-0`},Z$n=K({__name:`ThinkingIndicator`,props:{statusMessage:{},runElapsedMs:{default:null},pendingCalls:{default:()=>[]}},setup(e){return(t,n)=>(B(),U(`div`,W$n,[S(`div`,G$n,[S(`span`,K$n,T(e.statusMessage),1),n[0]||=S(`span`,{class:`flex gap-1`,"aria-hidden":`true`},[S(`span`,{class:`w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce`,style:{"animation-delay":`0ms`}}),S(`span`,{class:`w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce`,style:{"animation-delay":`150ms`}}),S(`span`,{class:`w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce`,style:{"animation-delay":`300ms`}})],-1),e.runElapsedMs!==null&&e.runElapsedMs>=1e3?(B(),U(`span`,q$n,` · `+T(q(U$n)(e.runElapsedMs)),1)):b(``,!0)]),e.pendingCalls&&e.pendingCalls.length>0?(B(),U(`div`,J$n,[(B(!0),U(D,null,H(e.pendingCalls,e=>(B(),U(`div`,{key:e.toolUseId,class:`flex items-center gap-1.5 text-xs text-gray-400`},[n[1]||=S(`span`,{class:`w-1.5 h-1.5 rounded-full bg-blue-300 shrink-0 animate-pulse`,"aria-hidden":`true`},null,-1),S(`span`,Y$n,T(e.toolName),1),S(`span`,X$n,`· `+T(q(U$n)(e.elapsedMs)),1)]))),128))])):b(``,!0)]))}});o(),M(),we();var Q$n=[`title`],$$n=[`title`],e1n=K({__name:`SessionCountBadges`,props:{activeSessionCount:{},unreadCount:{}},setup(e){let{t}=We();return(n,r)=>(B(),U(D,null,[e.activeSessionCount>0?(B(),U(`span`,{key:0,class:`absolute -top-0.5 -left-0.5 min-w-[1rem] h-4 px-0.5 bg-yellow-400 text-white text-[10px] font-bold rounded-full flex items-center justify-center leading-none cursor-help`,"data-testid":`session-count-active`,title:q(t)(`sessionTabBar.activeSessions`,e.activeSessionCount,{named:{count:e.activeSessionCount}})},T(e.activeSessionCount),9,Q$n)):b(``,!0),e.unreadCount>0?(B(),U(`span`,{key:1,class:`absolute -top-0.5 -right-0.5 min-w-[1rem] h-4 px-0.5 bg-red-500 text-white text-[10px] font-bold rounded-full flex items-center justify-center leading-none cursor-help`,"data-testid":`session-count-unread`,title:q(t)(`sessionTabBar.unreadReplies`,e.unreadCount,{named:{count:e.unreadCount}})},T(e.unreadCount),9,$$n)):b(``,!0)],64))}});o(),M(),we();var t1n=[`title`,`aria-label`,`aria-expanded`],n1n=[`aria-label`],r1n={class:`px-3 py-2 text-xs font-semibold text-gray-500 border-b border-gray-100`},i1n={class:`max-h-64 overflow-y-auto py-1 [scrollbar-width:thin]`},a1n=[`data-testid`],o1n=[`title`],s1n=[`title`,`aria-label`,`disabled`,`data-testid`,`onClick`],c1n=[`title`,`aria-label`,`disabled`,`data-testid`,`onClick`],l1n=K({__name:`ShortcutReorderPopover`,setup(e){let{t}=We(),{shortcuts:n,movePinned:r}=mL(),i=V(!1),a=V(null),o=V(null),s=V(null);async function l(e,t){await r(e.kind,e.slug,t)}let{handler:u}=C4({isOpen:i,buttonRef:o,popupRef:s});function d(e){e.key===`Escape`&&i.value&&(i.value=!1)}return P(()=>{document.addEventListener(`mousedown`,u),document.addEventListener(`keydown`,d)}),k(()=>{document.removeEventListener(`mousedown`,u),document.removeEventListener(`keydown`,d)}),(e,r)=>(B(),U(`div`,{ref_key:`wrapper`,ref:a,class:`relative inline-flex flex-none`},[S(`button`,{ref_key:`trigger`,ref:o,type:`button`,class:c([`h-8 w-8 flex items-center justify-center border border-gray-300 rounded bg-white text-gray-600 hover:bg-gray-50 transition-colors`,{"bg-blue-50 text-blue-600":i.value}]),title:q(t)(`shortcuts.reorder.open`),"aria-label":q(t)(`shortcuts.reorder.open`),"aria-expanded":i.value,"aria-haspopup":`true`,"data-testid":`shortcut-reorder-open`,onClick:r[0]||=e=>i.value=!i.value},[...r[1]||=[S(`span`,{class:`material-icons text-base`},`edit`,-1)]],10,t1n),i.value?(B(),U(`div`,{key:0,ref_key:`panel`,ref:s,class:`absolute right-0 top-full mt-1 z-50 w-64 max-w-[80vw] bg-white border border-gray-200 rounded-lg shadow-lg overflow-hidden`,role:`dialog`,"aria-label":q(t)(`shortcuts.reorder.title`),"data-testid":`shortcut-reorder-panel`},[S(`div`,r1n,T(q(t)(`shortcuts.reorder.title`)),1),S(`ul`,i1n,[(B(!0),U(D,null,H(q(n),(e,i)=>(B(),U(`li`,{key:`${e.kind}:${e.slug}`,class:`flex items-center gap-2 px-3 py-1 text-sm text-gray-900`,"data-testid":`shortcut-reorder-row-${e.kind}-${e.slug}`},[S(`span`,{class:c([`h-6 w-6 rounded flex items-center justify-center flex-none`,q(Tt)(e.color)??`text-gray-500`])},[De(q(Wa),{icon:e.icon,"size-class":`text-base`},null,8,[`icon`])],2),S(`span`,{class:`flex-1 truncate`,title:e.title},T(e.title),9,o1n),S(`button`,{type:`button`,class:`h-6 w-6 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent`,title:q(t)(`shortcuts.reorder.moveUp`),"aria-label":q(t)(`shortcuts.reorder.moveUp`),disabled:i===0,"data-testid":`shortcut-reorder-up-${e.kind}-${e.slug}`,onClick:t=>l(e,`up`)},[...r[2]||=[S(`span`,{class:`material-icons text-base`},`arrow_upward`,-1)]],8,s1n),S(`button`,{type:`button`,class:`h-6 w-6 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent`,title:q(t)(`shortcuts.reorder.moveDown`),"aria-label":q(t)(`shortcuts.reorder.moveDown`),disabled:i===q(n).length-1,"data-testid":`shortcut-reorder-down-${e.kind}-${e.slug}`,onClick:t=>l(e,`down`)},[...r[3]||=[S(`span`,{class:`material-icons text-base`},`arrow_downward`,-1)]],8,c1n)],8,a1n))),128))])],8,n1n)):b(``,!0)],512))}});o(),we(),M();var u1n={class:`inline-flex max-w-full items-center gap-2 text-xs`,"data-testid":`plugin-launcher`},d1n={class:`inline-flex flex-none items-stretch border border-gray-300 rounded`},f1n=[`title`,`aria-label`],p1n=[`title`,`aria-label`,`data-testid`,`onClick`],m1n={class:`material-icons text-base`},h1n=[`aria-label`],g1n=[`title`,`aria-label`,`data-testid`,`onClick`],_1n=K({__name:`PluginLauncher`,props:{activeViewMode:{},shortcuts:{},activeSessionCount:{},unreadCount:{}},emits:[`navigate`,`navigateShortcut`,`navigateChat`],setup(e,{emit:t}){let{t:n}=We(),r=OI(),i=e,a=m(()=>i.shortcuts??[]),o=m(()=>r.name===CP.chat),s=m(()=>i.activeSessionCount??0),l=m(()=>i.unreadCount??0),u=m(()=>{let e=[n(`pluginLauncher.chat.label`)];return s.value>0&&e.push(n(`sessionTabBar.activeSessions`,s.value,{named:{count:s.value}})),l.value>0&&e.push(n(`sessionTabBar.unreadReplies`,l.value,{named:{count:l.value}})),e.join(`, `)}),d=[{key:`dashboard`,kind:`view`,icon:`dashboard`},{key:`wiki`,kind:`view`,icon:`menu_book`},{key:`collections`,kind:`view`,icon:`apps`},{key:`feeds`,kind:`view`,icon:`rss_feed`},{key:`accounting`,kind:`view`,icon:`account_balance`},{key:`files`,kind:`view`,icon:`folder`},{key:`automations`,kind:`view`,icon:`schedule`},{key:`debug`,kind:`view`,icon:`bug_report`,devOnly:!0,literalLabel:`Debug`,literalTitle:`Open debug playground (dev mode only)`}],f=m(()=>d.filter(e=>!e.devOnly||!1));function p(e){return i.activeViewMode===e.key}let h={collection:CP.collections,feed:CP.feeds};function g(e){return i.activeViewMode===h[e.kind]&&r.params.slug===e.slug}function _(e){if(g(e))return`bg-blue-50 text-blue-600`;let t=Tt(e.color);return t?`${t} hover:brightness-95`:`bg-white text-gray-600 hover:bg-gray-50`}let v=t;return(e,t)=>(B(),U(`div`,u1n,[S(`div`,d1n,[S(`button`,{class:c([`relative h-8 w-8 flex items-center justify-center rounded-l border-r border-gray-200 transition-colors`,o.value?`bg-blue-50 text-blue-600`:`bg-white text-gray-600 hover:bg-gray-50`]),title:u.value,"aria-label":u.value,"data-testid":`plugin-launcher-chat`,onClick:t[0]||=e=>v(`navigateChat`)},[t[1]||=S(`span`,{class:`material-icons text-base`},`forum`,-1),De(e1n,{"active-session-count":s.value,"unread-count":l.value},null,8,[`active-session-count`,`unread-count`])],10,f1n),(B(!0),U(D,null,H(f.value,e=>(B(),U(`button`,{key:e.key,class:c([`h-8 w-8 flex items-center justify-center border-r border-gray-200 last:border-r-0 last:rounded-r transition-colors`,p(e)?`bg-blue-50 text-blue-600`:`bg-white text-gray-600 hover:bg-gray-50`]),title:e.literalTitle??q(n)(`pluginLauncher.${e.key}.label`),"aria-label":e.literalLabel??q(n)(`pluginLauncher.${e.key}.label`),"data-testid":`plugin-launcher-${e.key}`,onClick:t=>v(`navigate`,e)},[S(`span`,m1n,T(e.icon),1)],10,p1n))),128))]),a.value.length>0?(B(),U(`div`,{key:0,class:`inline-flex min-w-0 items-stretch border border-gray-300 rounded overflow-x-auto [scrollbar-width:thin]`,"aria-label":q(n)(`shortcuts.zoneAriaLabel`),"data-testid":`plugin-launcher-shortcuts`},[(B(!0),U(D,null,H(a.value,e=>(B(),U(`button`,{key:`${e.kind}:${e.slug}`,class:c([`h-8 w-8 flex items-center justify-center flex-none border-r border-gray-200 last:border-r-0 transition-colors`,_(e)]),title:e.title,"aria-label":e.title,"data-testid":`plugin-launcher-shortcut-${e.kind}-${e.slug}`,onClick:t=>v(`navigateShortcut`,e)},[De(q(Wa),{icon:e.icon,"size-class":`text-base`},null,8,[`icon`])],10,g1n))),128))],8,h1n)):b(``,!0),a.value.length>1?(B(),ke(l1n,{key:1})):b(``,!0)]))}});o(),M();var T9=V([]),E9=V({}),D9=V(null),O9=V(!1),k9=null;function A9(){return{tiles:T9.value,rowHeights:E9.value}}function j9(e){T9.value=e.tiles,E9.value=e.rowHeights}async function M9(e=!1){return k9&&!e||(k9=(async()=>{let e=await pN(SP.dashboard);if(!e.ok){D9.value=e.error,k9=null;return}D9.value=null,j9({tiles:e.data.tiles,rowHeights:e.data.rowHeights??{}}),O9.value=!0})()),k9}var{enqueue:N9}=xut();async function P9(e,t){j9(e);let n=await hN(SP.dashboard,{tiles:e.tiles,rowHeights:e.rowHeights});return n.ok?(j9({tiles:n.data.tiles,rowHeights:n.data.rowHeights??e.rowHeights}),D9.value=null,!0):(j9(t),D9.value=n.error,console.error(`[useDashboard] persist failed`,n.error),!1)}function v1n(e){return N9(async()=>(await M9(),O9.value?P9({tiles:e,rowHeights:E9.value},A9()):!1))}function y1n(e,t){return N9(async()=>{if(await M9(),!O9.value)return!1;if(!T9.value.some(t=>t.slug===e))return!0;let n=A9();return P9({tiles:n.tiles.map(n=>{if(n.slug!==e)return n;if(t===null){let{viewMode:e,...t}=n;return t}return{...n,viewMode:t}}),rowHeights:n.rowHeights},n)})}function b1n(e,t,n){return N9(async()=>{if(await M9(),!O9.value)return!1;if(e<1||t<0)return!0;let r=A9(),i=String(e),a=[...r.rowHeights[i]??[]];for(;a.length<=t;)a.push(0);a[t]=n;let o={...r.rowHeights,[i]:a};return P9({tiles:r.tiles,rowHeights:o},r)})}function x1n(e){return N9(async()=>{if(await M9(),!O9.value)return;let t=new Set(e),n=T9.value.filter(e=>t.has(e.slug)),r=new Set(n.map(e=>e.slug)),i=e.filter(e=>!r.has(e)).map(e=>({slug:e})),a=[...n,...i];(a.length!==T9.value.length||a.some((e,t)=>e.slug!==T9.value[t]?.slug))&&await P9({tiles:a,rowHeights:E9.value},A9())})}function S1n(){return M9(),{tiles:m(()=>T9.value),rowHeights:m(()=>E9.value),loadError:m(()=>D9.value),load:M9,setTiles:v1n,setViewMode:y1n,setRowHeight:b1n,reconcile:x1n}}o(),M(),we(),le();var C1n={key:0,class:`h-full flex flex-col items-center justify-center text-center text-slate-500 gap-2`},w1n={class:`text-sm font-medium`},T1n={class:`text-xs`},E1n={key:1,class:`grid gap-4 sm:grid-cols-2`,"data-testid":`dashboard-grid`},D1n=[`data-dashboard-index`,`data-testid`],O1n={class:`flex items-center gap-2 px-3 py-2 border-b border-slate-100 bg-slate-50`},k1n=[`title`,`aria-label`,`onPointerdown`],A1n=[`title`,`onClick`,`onDblclick`],j1n={class:`truncate`},M1n=[`value`,`aria-label`,`data-testid`,`onChange`],N1n=[`value`],P1n=[`title`,`aria-label`,`data-testid`,`onPointerdown`],F1n=320,I1n=160,L1n=900,R1n=`(min-width: 640px)`,z1n=K({__name:`DashboardView`,setup(e){let{t}=We(),n=DI(),{shortcuts:r,load:i}=mL(),{tiles:a,rowHeights:o,load:l,reconcile:d,setTiles:f,setViewMode:p,setRowHeight:h}=S1n(),g=m(()=>r.value.filter(e=>e.kind===`collection`)),_=m(()=>g.value.map(e=>e.slug)),v=e=>g.value.find(t=>t.slug===e),y=V({});async function b(e){if(y.value[e])return;let t=await pN(SP.collections.detail.replace(`:slug`,encodeURIComponent(e)));t.ok&&(y.value={...y.value,[e]:t.data.collection.schema})}function x(e){let t=y.value[e];return t?OQe(t):[`table`]}function C(e){let t=x(e.slug);return t.find(t=>t===e.viewMode)??t[0]??`table`}let w={table:`dashboard.viewTable`,calendar:`dashboard.viewCalendar`,kanban:`dashboard.viewKanban`};function E(e,n){let r=w[n];return r?t(r):y.value[e]?.views?.find(e=>tN(e.id)===n)?.label??n}function O(e,t){let{target:n}=t;n instanceof HTMLSelectElement&&p(e,n.value)}function A(e){n.push({name:CP.collections,params:{slug:e}}).catch(()=>{})}function j(e,t){e.detail===0&&A(t)}function M(e){let{currentTarget:t}=e;if(!(t instanceof HTMLElement))return null;try{t.setPointerCapture(e.pointerId)}catch{}return t}let N=V(null),F=V(null),I=V(!1),R=null;function z(e,t){let n=document.elementFromPoint(e,t)?.closest(`[data-dashboard-index]`);if(!n)return null;let r=Number(n.dataset.dashboardIndex);return Number.isNaN(r)?null:r}function ee(e){R&&(e.preventDefault(),F.value=z(e.clientX,e.clientY))}function te(){window.removeEventListener(`pointermove`,ee),window.removeEventListener(`pointerup`,ne),window.removeEventListener(`pointercancel`,ne),I.value=!1}function ne(){if(te(),!R)return;let{startIndex:e,handle:t,pointerId:n}=R,r=F.value;R=null,N.value=null,F.value=null;try{t.releasePointerCapture(n)}catch{}if(r===null||r===e)return;let i=[...a.value],[o]=i.splice(e,1);o&&(i.splice(r,0,o),f(i))}function re(e,t){let n=M(t);n&&(R={startIndex:e,handle:n,pointerId:t.pointerId},N.value=e,I.value=!0,window.addEventListener(`pointermove`,ee),window.addEventListener(`pointerup`,ne),window.addEventListener(`pointercancel`,ne))}let ie=V(2),ae=null;function oe(){ie.value=ae?.matches?2:1}function W(e){return Math.floor(e/ie.value)}let se=V({});function ce(e,t){return`${e}:${t}`}function le(e){let t=W(e),n=se.value[ce(ie.value,t)];if(n!==void 0)return n;let r=o.value[String(ie.value)]?.[t];return r&&r>0?r:F1n}let ue=V(!1),de=null,fe=null,G=0;function pe(){if(G=0,!de||fe===null)return;let e=Math.min(L1n,Math.max(I1n,de.startHeight+(fe-de.startY)));se.value={...se.value,[ce(de.cols,de.row)]:e}}function me(e){de&&(e.preventDefault(),fe=e.clientY,G||=requestAnimationFrame(pe))}function he(e,t){let n=ce(e,t);se.value=Object.fromEntries(Object.entries(se.value).filter(([e])=>e!==n))}async function ge(e,t,n){await h(e,t,Math.round(n)),he(e,t)}function _e(){window.removeEventListener(`pointermove`,me),window.removeEventListener(`pointerup`,ve),window.removeEventListener(`pointercancel`,ve),G&&cancelAnimationFrame(G),G=0,fe=null,ue.value=!1}function ve(){if(_e(),!de)return;let{cols:e,row:t,handle:n,pointerId:r}=de;de=null;try{n.releasePointerCapture(r)}catch{}let i=se.value[ce(e,t)];i!==void 0&&ge(e,t,i)}function K(e,t){let n=M(t);n&&(de={cols:ie.value,row:W(e),startY:t.clientY,startHeight:le(e),handle:n,pointerId:t.pointerId},ue.value=!0,window.addEventListener(`pointermove`,me),window.addEventListener(`pointerup`,ve),window.addEventListener(`pointercancel`,ve))}return k(()=>{_e(),te(),ae?.removeEventListener(`change`,oe)}),P(async()=>{ae=window.matchMedia(R1n),oe(),ae.addEventListener(`change`,oe),await Promise.all([i(),l()]),await d(_.value)}),Ve(_,e=>void d(e)),Ve(a,e=>e.forEach(e=>void b(e.slug)),{immediate:!0}),(e,n)=>(B(),U(`div`,{class:c([`h-full overflow-auto p-4`,{"select-none":ue.value||I.value}]),"data-testid":`dashboard-view`},[_.value.length===0?(B(),U(`div`,C1n,[n[0]||=S(`span`,{class:`material-icons text-4xl text-slate-300`},`dashboard`,-1),S(`p`,w1n,T(q(t)(`dashboard.empty`)),1),S(`p`,T1n,T(q(t)(`dashboard.emptyHint`)),1)])):(B(),U(`div`,E1n,[(B(!0),U(D,null,H(q(a),(e,r)=>u((B(),U(`section`,{key:e.slug,class:c([`flex flex-col border border-slate-200 rounded-lg bg-white overflow-hidden shadow-sm transition-opacity`,{"ring-2 ring-indigo-400":F.value===r&&N.value!==r,"opacity-50":N.value===r}]),"data-dashboard-index":r,"data-testid":`dashboard-tile-${e.slug}`},[S(`header`,O1n,[S(`span`,{class:`material-icons text-base text-slate-400 cursor-grab select-none touch-none`,title:q(t)(`dashboard.dragHint`),"aria-label":q(t)(`dashboard.dragHint`),"data-testid":`dashboard-tile-drag`,onPointerdown:s(e=>re(r,e),[`prevent`])},`drag_indicator`,40,k1n),S(`button`,{type:`button`,class:`flex items-center gap-1.5 min-w-0 flex-1 text-left text-sm font-semibold text-slate-700 hover:text-indigo-600`,title:q(t)(`dashboard.openFull`),onClick:t=>j(t,e.slug),onDblclick:t=>A(e.slug)},[S(`span`,{class:c([`h-6 w-6 rounded flex items-center justify-center flex-none`,q(Tt)(v(e.slug)?.color)??``])},[De(q(Wa),{icon:v(e.slug)?.icon,fallback:`apps`,"size-class":`text-base`},null,8,[`icon`])],2),S(`span`,j1n,T(v(e.slug)?.title||e.slug),1)],40,A1n),S(`select`,{class:`flex-none text-xs bg-white border border-slate-200 rounded px-1.5 py-1 text-slate-600 focus:outline-none focus:ring-2 focus:ring-indigo-500/20`,value:C(e),"aria-label":q(t)(`dashboard.viewPickerLabel`),"data-testid":`dashboard-tile-view-${e.slug}`,onChange:t=>O(e.slug,t)},[(B(!0),U(D,null,H(x(e.slug),t=>(B(),U(`option`,{key:t,value:t},T(E(e.slug,t)),9,N1n))),128))],40,M1n)]),S(`div`,{class:`overflow-auto`,style:xe({height:`${le(r)}px`})},[(B(),ke(q(cN),{key:`${e.slug}:${C(e)}`,slug:e.slug,"initial-view":C(e),"hide-view-toggle":``,"hide-header":``,"hide-search":``},null,8,[`slug`,`initial-view`]))],4),S(`div`,{class:`h-2 flex-none cursor-row-resize bg-slate-100 hover:bg-indigo-200 transition-colors flex items-center justify-center`,title:q(t)(`dashboard.resizeHint`),"aria-label":q(t)(`dashboard.resizeHint`),"data-testid":`dashboard-tile-resize-${e.slug}`,onPointerdown:s(e=>K(r,e),[`prevent`])},[...n[1]||=[S(`span`,{class:`h-0.5 w-8 rounded-full bg-slate-300`},null,-1)]],40,P1n)],10,D1n)),[[L,v(e.slug)]])),128))]))],2))}}),B1n=3e4,V1n=.85;function H1n(e,t){if(!Number.isFinite(e)||e<=0)return 0;if(!Number.isFinite(t)||t<=0)return Math.min(e,B1n);let n=Math.max(1,Math.floor(t*V1n));return Math.min(e,B1n,n)}function U1n(e,t=80){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function W1n(e){for(let t of e.querySelectorAll(`*`)){if(t.scrollHeight<=t.clientHeight)continue;let e=getComputedStyle(t);if(e.overflowY===`auto`||e.overflowY===`scroll`||e.overflow===`auto`||e.overflow===`scroll`)return t}return null}function G1n(e,t,n){let r=[],i=new Map;for(let a of e){let e=t(a);if(e===null){r.push({key:n(a),head:a,members:[a],isGroup:!1});continue}let o=i.get(e);if(o!==void 0){o.members.push(a),o.head=a;continue}let s={key:`group:${e}`,head:a,members:[a],isGroup:!0};i.set(e,s),r.push(s)}return r}function K1n(e,t,n,r){let i=null;for(let a of e){let e=t(a.head),o=n(e);if(o!==null){if(o<=r)i=e;else break}}return i}function q1n(e,t,n){if(t===void 0)return{kind:`none`};let r=n(t),i=e=>e.members.some(e=>n(e)===r),a=e[e.length-1];if(a!==void 0&&i(a))return{kind:`bottom`};let o=e.find(i);return o===void 0?{kind:`none`}:{kind:`card`,headUuid:n(o.head)}}o(),M(),we();var J1n={class:`h-full flex flex-col bg-gray-50`},Y1n={class:`shrink-0 flex items-center gap-1 text-xs text-gray-400 px-4 pt-3 pb-2`,"data-testid":`stack-role-header`},X1n={key:1},Z1n={class:`ml-auto flex items-center gap-0.5`},Q1n=[`title`,`aria-label`,`aria-pressed`],$1n={key:0,class:`flex-1 flex flex-col items-center justify-center h-full px-6 text-center`,"data-testid":`stack-empty`},e0n={key:1,class:`text-lg font-medium text-gray-700 mb-4`},t0n={key:2,class:`flex flex-wrap gap-2 justify-center max-w-xl`},n0n=[`onClick`],r0n={key:3,class:`text-sm text-gray-500`},i0n=[`title`,`onClick`],a0n={class:`material-icons text-sm text-gray-400`},o0n={class:`text-sm font-medium text-gray-800 truncate`},s0n={key:0,class:`text-[10px] text-gray-400 shrink-0`},c0n={key:1,class:`text-[10px] text-gray-400 shrink-0`},l0n={class:`font-mono text-xs text-gray-400 shrink-0`},u0n={key:0,class:`stack-text-response`},d0n={key:1,class:`h-full overflow-auto p-4 text-xs text-gray-500 whitespace-pre-wrap`},f0n=`min(60vh, 560px)`,p0n=150,m0n=Qe(K({__name:`StackView`,props:{toolResults:{},selectedResultUuid:{},resultTimestamps:{},sendTextMessage:{type:Function},queries:{},sessionRoleName:{},sessionRoleIcon:{},sessionModel:{},sessionModelOverride:{},layoutMode:{},showRightSidebar:{type:Boolean},googleMapKey:{}},emits:[`select`,`updateResult`,`update:layoutMode`,`toggle-right-sidebar`,`update:sessionModelOverride`],setup(e,{emit:t}){let{t:n}=We(),r={[pI.presentMulmoScript]:`min(85vh, 820px)`};function i(e){return r[e]??f0n}let a=new Set([`presentHtml`,`presentDocument`,`presentSpreadsheet`,`manageWiki`,`presentChart`,`skill`]);function o(e){return a.has(e)}let s=e;function l(e){return e===pI.mapControl?s.googleMapKey??null:null}let u=t,d=V(null),f=V(!0),p=new Map,h=new Map;function g(e){let{toolName:t,uuid:n}=e;typeof t==`string`&&typeof n==`string`&&u(`updateResult`,{...e,toolName:t,uuid:n})}function v(e,t){t?p.set(e,t):p.delete(e)}let y=e=>e instanceof HTMLElement?e:null;function x(e,t){let n=y(t);n?(h.set(e,n),be(()=>O(n))):h.delete(e)}function C(e){if(e.toolName!==pI.mapControl)return null;let{data:t}=e;if(!Ma(t))return null;let{groupId:n}=t;return typeof n==`string`&&n.length>0?n:null}let w=m(()=>G1n(s.toolResults,C,e=>e.uuid));function E(e,t){let n=y(t);for(let t of e)v(t.uuid,n)}function O(e){let t=e.querySelectorAll(`iframe`);for(let e of t){if(e.dataset.stackSized===`true`)continue;e.dataset.stackSized=`true`;let t=()=>I(e);e.addEventListener(`load`,t);try{e.contentDocument?.readyState===`complete`&&t()}catch{}}}let k=new WeakMap,A=new Map,j=null;function M(e){let t=k.get(e);if(t&&t.isConnected)return t;for(let t of h.values())for(let n of t.querySelectorAll(`iframe`)){let t=n.contentWindow;if(t&&(k.set(t,n),t===e))return n}return null}function N(){j=null;for(let[e,t]of A)e.isConnected&&e.style.setProperty(`height`,`${t}px`,`important`);A.clear()}function F(e){let{data:t}=e;if(!Ma(t)||t.type!==`mc-iframe-height`)return;let n=t.height;if(typeof n!=`number`)return;let{source:r}=e;if(!r)return;let i=M(r);if(!i)return;let a=H1n(n,window.innerHeight);a<=0||(A.set(i,a),j===null&&(j=requestAnimationFrame(N)))}function I(e){try{let t=e.contentDocument;if(!t)return;let n=H1n(Math.max(t.documentElement?.scrollHeight??0,t.body?.scrollHeight??0),window.innerHeight);if(n<=0)return;e.style.height=`${n}px`}catch{}}function L(e){if(e.toolName!==`text-response`)return!1;let{data:t}=e;return Ma(t)?typeof t.text==`string`:!1}function R(e){return e===`text-response`?`chat`:`extension`}let z=!1,ee=null,te=null,ne=null;function re(){z=!0,ee!==null&&clearTimeout(ee),ee=setTimeout(()=>{z=!1,ee=null},p0n)}function ie(e){let t=parseFloat(getComputedStyle(e).paddingTop);return Number.isFinite(t)?t:0}function ae(){if(!d.value)return null;let e=d.value,t=e.getBoundingClientRect().top+ie(e);return K1n(w.value,e=>e.uuid,e=>{let t=p.get(e);return t?t.getBoundingClientRect().top:null},t)}function oe(){z||(d.value&&(f.value=U1n(d.value)),te===null&&(te=requestAnimationFrame(()=>{if(te=null,z)return;let e=ae();e&&e!==s.selectedResultUuid&&(ne=e,u(`select`,e))})))}Ve(()=>s.selectedResultUuid,e=>{if(e){if(ne===e){ne=null;return}ne=null,be(()=>{let t=p.get(e);t&&(re(),t.scrollIntoView({block:`start`,behavior:`auto`}))})}});let W=m(()=>{let e=s.toolResults,t=e[e.length-1];return`${e.length}:${t?.uuid??``}:${t?.message?.length??0}`});return Ve(W,()=>{be(()=>{if(d.value&&f.value){re();let e=s.toolResults[s.toolResults.length-1],t=q1n(w.value,e,e=>e.uuid);if(t.kind===`bottom`)d.value.scrollTop=d.value.scrollHeight;else if(t.kind===`card`){let e=p.get(t.headUuid);e&&e.scrollIntoView({block:`nearest`,behavior:`auto`})}}for(let e of h.values())O(e)})}),Ve(d,(e,t)=>{t?.removeEventListener(`scroll`,oe),e?.addEventListener(`scroll`,oe,{passive:!0})},{immediate:!0}),P(()=>{window.addEventListener(`message`,F),be(()=>{if(!s.selectedResultUuid)return;let e=p.get(s.selectedResultUuid);e&&(re(),e.scrollIntoView({block:`start`,behavior:`auto`}))})}),_(()=>{d.value?.removeEventListener(`scroll`,oe),window.removeEventListener(`message`,F),te!==null&&cancelAnimationFrame(te),ee!==null&&clearTimeout(ee),j!==null&&cancelAnimationFrame(j),A.clear(),h.clear()}),(t,r)=>(B(),U(`div`,J1n,[S(`div`,Y1n,[e.sessionRoleIcon?(B(),U(`span`,{key:0,class:c([`material-icons text-xs leading-none`,q(h9)])},T(e.sessionRoleIcon),3)):b(``,!0),e.sessionRoleName?(B(),U(`span`,X1n,T(e.sessionRoleName),1)):b(``,!0),e.sessionRoleName?(B(),ke(o$n,{key:2,model:e.sessionModel,override:e.sessionModelOverride,"onUpdate:override":r[0]||=e=>u(`update:sessionModelOverride`,e)},null,8,[`model`,`override`])):b(``,!0),S(`div`,Z1n,[De(A$n,{results:e.toolResults,"result-timestamps":e.resultTimestamps,"session-role-name":e.sessionRoleName},null,8,[`results`,`result-timestamps`,`session-role-name`]),S(`button`,{type:`button`,class:c([`h-8 w-8 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-colors`,{"!text-blue-500":e.showRightSidebar}]),title:q(n)(`sidebarHeader.toolCallHistory`),"aria-label":q(n)(`sidebarHeader.toolCallHistory`),"aria-pressed":e.showRightSidebar,onClick:r[1]||=e=>u(`toggle-right-sidebar`)},[...r[3]||=[S(`span`,{class:`material-icons text-lg`,"aria-hidden":`true`},`build`,-1)]],10,Q1n),De(KQn,{"model-value":e.layoutMode,"onUpdate:modelValue":r[2]||=e=>u(`update:layoutMode`,e)},null,8,[`model-value`])])]),e.toolResults.length===0?(B(),U(`div`,$1n,[e.sessionRoleIcon?(B(),U(`span`,{key:0,class:c([`material-icons text-5xl text-gray-400 mb-2`,q(h9)]),"aria-hidden":`true`},T(e.sessionRoleIcon),3)):b(``,!0),e.sessionRoleName?(B(),U(`p`,e0n,T(e.sessionRoleName),1)):b(``,!0),e.queries&&e.queries.length>0&&e.sendTextMessage?(B(),U(`div`,t0n,[(B(!0),U(D,null,H(e.queries,(t,n)=>(B(),U(`button`,{key:`${n}-${t}`,type:`button`,class:`text-sm bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-full px-4 py-2 border border-gray-300 transition-colors`,"data-testid":`stack-empty-query`,onClick:n=>e.sendTextMessage(t)},T(t),9,n0n))),128))])):(B(),U(`p`,r0n,T(q(n)(`app.startConversation`)),1))])):(B(),U(`div`,{key:1,ref_key:`containerRef`,ref:d,class:`flex-1 min-h-0 overflow-y-auto px-4 pb-4 space-y-3`,"data-testid":`stack-scroll`},[(B(!0),U(D,null,H(w.value,t=>(B(),U(`div`,{key:t.key,ref_for:!0,ref:e=>E(t.members,e),class:c([`bg-white rounded-lg border transition-colors`,t.members.some(t=>t.uuid===e.selectedResultUuid)?`border-blue-400 ring-2 ring-blue-200`:`border-gray-200`])},[S(`button`,{class:`w-full flex items-center gap-2 px-3 py-2 border-b border-gray-100 text-left hover:bg-gray-50`,title:t.head.title||t.head.toolName,onClick:e=>u(`select`,t.head.uuid)},[S(`span`,a0n,T(R(t.head.toolName)),1),S(`span`,o0n,T(t.head.title||t.head.toolName),1),t.isGroup&&t.members.length>1?(B(),U(`span`,s0n,T(`${t.members.length}×`),1)):b(``,!0),e.resultTimestamps.get(t.head.uuid)?(B(),U(`span`,c0n,T(q(oz)(e.resultTimestamps.get(t.head.uuid))),1)):b(``,!0),S(`span`,l0n,T(t.head.toolName),1)],8,i0n),L(t.head)?(B(),U(`div`,u0n,[De(q(_4),{"selected-result":t.head,onUpdateResult:g},null,8,[`selected-result`])])):o(t.head.toolName)?(B(),U(`div`,{key:1,ref_for:!0,ref:e=>x(t.head.uuid,e),class:`stack-natural`},[q(O5)(t.head.toolName)?.viewComponent?(B(),ke(fe(q(O5)(t.head.toolName)?.viewComponent),{key:`${t.key}-${l(t.head.toolName)??``}`,"selected-result":t.head,"send-text-message":e.sendTextMessage,"google-map-key":l(t.head.toolName),onUpdateResult:g},null,40,[`selected-result`,`send-text-message`,`google-map-key`])):b(``,!0)],512)):(B(),U(`div`,{key:2,style:xe({height:i(t.head.toolName)})},[q(O5)(t.head.toolName)?.viewComponent?(B(),ke(fe(q(O5)(t.head.toolName)?.viewComponent),{key:`${t.key}-${l(t.head.toolName)??``}`,"selected-result":t.head,results:t.isGroup?t.members:void 0,"send-text-message":e.sendTextMessage,"google-map-key":l(t.head.toolName),onUpdateResult:g},null,40,[`selected-result`,`results`,`send-text-message`,`google-map-key`])):(B(),U(`pre`,d0n,T(JSON.stringify(t.head,null,2)),1))],4))],2))),128))],512))]))}}),[[`__scopeId`,`data-v-7bdfeccd`]]),h0n=`files_expanded_dirs`,g0n=[``];function _0n(e){if(e===null)return new Set(g0n);try{let t=JSON.parse(e);if(!Array.isArray(t))return new Set(g0n);let n=t.filter(e=>typeof e==`string`);return new Set(n)}catch{return new Set(g0n)}}function v0n(e){return JSON.stringify([...e])}M(),o();function y0n(){if(typeof localStorage>`u`)return _0n(null);try{return _0n(localStorage.getItem(h0n))}catch{return _0n(null)}}var F9=V(y0n());Ve(F9,e=>{try{localStorage.setItem(h0n,v0n(e))}catch{}});function b0n(){function e(e){return F9.value.has(e)}function t(e){let t=new Set(F9.value);t.has(e)?t.delete(e):t.add(e),F9.value=t}function n(e){if(F9.value.has(e))return;let t=new Set(F9.value);t.add(e),F9.value=t}function r(){return Array.from(F9.value)}return{isExpanded:e,toggle:t,expand:n,expandedPaths:r}}o(),M();var x0n=null;function I9(e){return e.dataTransfer?.types.includes(`Files`)??!1}function S0n(){D0n()}var C0n=V(0),w0n=null;function T0n(){if(w0n!==null||typeof window>`u`)return;let e=()=>{C0n.value+=1};window.addEventListener(`drop`,e),window.addEventListener(`dragend`,e),w0n=e}function E0n(){return D0n(),T0n(),C0n}function D0n(){if(x0n!==null||typeof window>`u`)return;let e=e=>{I9(e)&&e.preventDefault()};window.addEventListener(`dragover`,e),window.addEventListener(`drop`,e),x0n=e}function O0n(e){D0n();let t=V(!1),n=0;function r(e){I9(e)&&(e.preventDefault(),n+=1,t.value=!0)}function i(e){I9(e)&&e.preventDefault()}function a(){n!==0&&(--n,n<=0&&s())}function o(t){if(!I9(t))return;t.preventDefault(),s();let n=t.dataTransfer?.files;n&&n.length>0&&e.onFiles(Array.from(n))}function s(){n=0,t.value=!1}return P(()=>{typeof window<`u`&&(window.addEventListener(`drop`,s),window.addEventListener(`dragend`,s))}),k(()=>{typeof window<`u`&&(window.removeEventListener(`drop`,s),window.removeEventListener(`dragend`,s))}),{isDragging:t,onDragenter:r,onDragover:i,onDragleave:a,onDrop:o}}function k0n(e,t){let n=e.slice();return n.sort((e,n)=>{if(e.type!==n.type)return e.type===`dir`?-1:1;if(t===`recent`){let t=e.modifiedMs??-1/0,r=n.modifiedMs??-1/0;if(t!==r)return r-t}return e.name.localeCompare(n.name)}),n}var A0n=[{kind:`exact`,path:`config/mcp.json`,descriptor:{id:`mcp`,schemaRef:`server/system/config.ts`,editPolicy:`user-editable`}},{kind:`exact`,path:`config/settings.json`,descriptor:{id:`settings`,schemaRef:`server/system/config.ts`,editPolicy:`user-editable`}},{kind:`exact`,path:`config/scheduler/tasks.json`,descriptor:{id:`schedulerTasks`,schemaRef:`server/utils/files/user-tasks-io.ts`,editPolicy:`agent-managed`}},{kind:`exact`,path:`config/scheduler/overrides.json`,descriptor:{id:`schedulerOverrides`,schemaRef:`server/utils/files/scheduler-io.ts`,editPolicy:`agent-managed`}},{kind:`exact`,path:`data/scheduler/items.json`,descriptor:{id:`schedulerItems`,schemaRef:`server/utils/files/scheduler-io.ts`,editPolicy:`agent-managed`}},{kind:`exact`,path:`data/wiki/index.md`,descriptor:{id:`wikiIndex`,editPolicy:`agent-managed`}},{kind:`exact`,path:`data/wiki/log.md`,descriptor:{id:`wikiLog`,editPolicy:`agent-managed`}},{kind:`exact`,path:`data/wiki/summary.md`,descriptor:{id:`wikiSummary`,editPolicy:`agent-managed`}},{kind:`exact`,path:`data/wiki/SCHEMA.md`,descriptor:{id:`wikiSchema`,editPolicy:`fragile-format`}},{kind:`exact`,path:`conversations/memory.md`,descriptor:{id:`memory`,schemaRef:`server/agent/prompt.ts`,editPolicy:`agent-managed-but-hand-editable`}},{kind:`exact`,path:`conversations/summaries/_index.md`,descriptor:{id:`summariesIndex`,editPolicy:`agent-managed`}},{kind:`pattern`,regex:/^config\/roles\/[^/]+\.json$/,descriptor:{id:`rolesJson`,schemaRef:`src/config/roles.ts`,editPolicy:`user-editable`}},{kind:`pattern`,regex:/^config\/roles\/[^/]+\.md$/,descriptor:{id:`rolesMd`,schemaRef:`src/config/roles.ts`,editPolicy:`user-editable`}},{kind:`pattern`,regex:/^conversations\/summaries\/daily\/\d{4}\/\d{2}\/\d{2}\.md$/,descriptor:{id:`journalDaily`,editPolicy:`agent-managed`}},{kind:`pattern`,regex:/^conversations\/summaries\/topics\/[^/]+\.md$/,descriptor:{id:`journalTopic`,editPolicy:`agent-managed`}}];function j0n(e){for(let t of A0n)if(t.kind===`exact`&&t.path===e||t.kind===`pattern`&&t.regex.test(e))return t.descriptor;return null}var M0n=new Set([`user-editable`,`agent-managed-but-hand-editable`]);function N0n(e){let t=j0n(e);return t===null||M0n.has(t.editPolicy)}var P0n={"agent-managed-but-hand-editable":`text-emerald-500`,"user-editable":`text-blue-500`,"agent-managed":`text-amber-500`,"fragile-format":`text-orange-500`,ephemeral:`text-gray-400`},F0n=[`data`,`artifacts`,`config`];function I0n(e){return F0n.includes(e)}var L0n=[{folder:`data/wiki/pages`,extension:`.md`,placeholderKey:`fileTree.newFilePlaceholder.wikiPage`},{folder:`conversations/summaries`,extension:`.md`,placeholderKey:`fileTree.newFilePlaceholder.summary`},{folder:`artifacts/documents`,extension:`.md`,placeholderKey:`fileTree.newFilePlaceholder.document`},{folder:`artifacts/html`,extension:`.html`,placeholderKey:`fileTree.newFilePlaceholder.html`},{folder:`artifacts/stories`,extension:`.json`,placeholderKey:`fileTree.newFilePlaceholder.story`}];function R0n(e){return L0n.find(t=>t.folder===e)??null}function z0n(e,t){let n=e.trim().replace(/\.[a-z0-9]+$/i,``);return n.length===0?{ok:!1,reason:`empty`}:MXe(n)?{ok:!0,filename:n+t.extension}:{ok:!1,reason:`unsafe`}}o(),M(),we(),le();var B0n=[`data-testid`,`data-drop-target`,`title`],V0n={class:`material-icons text-sm text-gray-400 shrink-0`},H0n={class:`text-gray-700 truncate`},U0n=[`data-testid`,`data-selected`,`title`],W0n={class:`truncate`},G0n=[`title`],K0n={key:2,class:`pl-4`},q0n=[`data-testid`],J0n=[`placeholder`,`aria-label`],Y0n={class:`text-xs text-gray-400 font-mono shrink-0 select-none`},X0n={key:1,class:`px-2 py-1 text-xs text-red-600`,"data-testid":`file-tree-new-file-error`},Z0n={key:2,class:`px-2 py-1 text-xs text-gray-400`},Q0n=`text-gray-400`,$0n=K({__name:`FileTree`,props:{node:{},selectedPath:{},recentPaths:{},childrenByPath:{},sortMode:{},showHiddenSystem:{type:Boolean},allowUpload:{type:Boolean}},emits:[`select`,`loadChildren`,`uploadFiles`,`createFile`],setup(e,{emit:t}){let{t:n}=We(),r=e,i=t,{isExpanded:a,toggle:o,expand:l}=b0n(),d=m(()=>a(r.node.path)),f=m(()=>r.childrenByPath.get(r.node.path)),p=m(()=>f.value===null),h=m(()=>Array.isArray(f.value)?k0n(f.value,r.sortMode):[]),g=m(()=>r.node.path===``),_=m(()=>!g.value||r.showHiddenSystem?h.value:h.value.filter(e=>e.type===`dir`&&I0n(e.name)));Ve([d,f],([e,t])=>{e&&r.node.type===`dir`&&t===void 0&&i(`loadChildren`,r.node.path)},{immediate:!0});function v(){o(r.node.path),a(r.node.path)&&f.value===void 0&&i(`loadChildren`,r.node.path)}let y=V(!1),x=0;function C(e){return e.dataTransfer?.types.includes(`Files`)??!1}function w(e){return r.allowUpload&&r.node.type===`dir`&&C(e)}function E(e){w(e)&&(e.preventDefault(),x+=1,y.value=!0)}function O(e){w(e)&&e.preventDefault()}function M(){x!==0&&(--x,x<=0&&P())}function N(e){if(!w(e))return;e.preventDefault(),e.stopPropagation(),P();let t=e.dataTransfer?.files;t&&t.length>0&&i(`uploadFiles`,{folder:r.node.path,files:Array.from(t)})}function P(){x=0,y.value=!1}Ve(E0n(),P);let F=new Set([`.mp3`,`.wav`,`.m4a`,`.ogg`,`.oga`,`.flac`,`.aac`]),I=m(()=>{if(r.node.type!==`file`)return`description`;let{name:e}=r.node,t=e.lastIndexOf(`.`);if(t<0)return`description`;let n=e.slice(t).toLowerCase();return F.has(n)?`audiotrack`:`description`}),L=m(()=>r.recentPaths.has(r.node.path)),R=m(()=>{if(r.node.type!==`file`)return Q0n;let e=j0n(r.node.path);return e?P0n[e.editPolicy]:Q0n}),z=m(()=>r.node.type===`dir`?R0n(r.node.path):null),ee=m(()=>z.value?n(z.value.placeholderKey):``),te=V(!1),ne=V(0),re=V(0),ie=V(!1),ae=V(``),oe=V(null),W=V(null),se=!1;function ce(e){z.value&&(e.preventDefault(),ne.value=e.clientX,re.value=e.clientY,te.value=!0)}function le(){te.value=!1}function ue(){le(),z.value&&(a(r.node.path)||l(r.node.path),ae.value=``,oe.value=null,ie.value=!0,be(()=>{W.value?.focus()}))}function de(){ie.value=!1,ae.value=``,oe.value=null}function fe(){if(se){se=!1;return}de()}let G=V(!1);function pe(){G.value=!0}function me(){setTimeout(()=>{G.value=!1},0)}function he(e){if(e.key===`Enter`){if(G.value||e.isComposing||e.keyCode===229)return;e.preventDefault(),_e();return}e.key===`Escape`&&(e.preventDefault(),de())}function ge(){se=!0,be(()=>{W.value?.focus(),setTimeout(()=>{se=!1},0)})}function _e(){if(!z.value)return;let e=z0n(ae.value,z.value);if(!e.ok){oe.value=e.reason===`empty`?n(`fileTree.newFileError.empty`):n(`fileTree.newFileError.unsafe`),ge();return}se=!0,i(`createFile`,{folder:r.node.path,filename:e.filename,resolve:(e,t)=>{if(e){de();return}oe.value=t??n(`fileTree.newFileError.saveFailed`),ge()}})}function ve(){te.value&&le()}function K(e){e.key===`Escape`&&te.value&&le()}return Ve(te,e=>{e?(window.addEventListener(`click`,ve),window.addEventListener(`keydown`,K)):(window.removeEventListener(`click`,ve),window.removeEventListener(`keydown`,K))}),k(()=>{window.removeEventListener(`click`,ve),window.removeEventListener(`keydown`,K)}),(t,r)=>{let a=A(`FileTree`,!0);return B(),U(`div`,null,[e.node.type===`dir`?(B(),U(`button`,{key:0,class:c([`w-full flex items-center gap-1 px-2 py-1 text-left text-sm rounded transition-colors`,y.value?`bg-blue-100 ring-1 ring-blue-400`:`hover:bg-gray-100`]),"data-testid":`file-tree-dir-${e.node.name||`root`}`,"data-drop-target":y.value?`true`:void 0,title:e.allowUpload?q(n)(`fileTree.dropHint`):void 0,onClick:v,onContextmenu:ce,onDragenter:E,onDragover:O,onDragleave:M,onDrop:N},[S(`span`,V0n,T(d.value?`folder_open`:`folder`),1),S(`span`,H0n,T(e.node.name||q(n)(`fileTree.workspace`)),1)],42,B0n)):(B(),U(`button`,{key:1,class:c([`w-full flex items-center gap-1 px-2 py-1 text-left text-sm rounded transition-colors`,e.selectedPath===e.node.path?`bg-blue-100 text-blue-700`:`text-gray-700 hover:bg-gray-100`]),"data-testid":`file-tree-file-${e.node.name}`,"data-selected":e.selectedPath===e.node.path?`true`:void 0,title:e.node.path,onClick:r[0]||=t=>i(`select`,e.node.path)},[S(`span`,{class:c([`material-icons text-sm shrink-0`,R.value])},T(I.value),3),S(`span`,W0n,T(e.node.name),1),L.value?(B(),U(`span`,{key:0,class:`ml-auto w-1.5 h-1.5 rounded-full bg-green-500 shrink-0`,title:q(n)(`fileTree.recentlyChanged`)},null,8,G0n)):b(``,!0)],10,U0n)),e.node.type===`dir`&&d.value?(B(),U(`div`,K0n,[ie.value?(B(),U(`div`,{key:0,class:`flex items-center gap-1 px-2 py-1 text-sm`,"data-testid":`file-tree-new-file-input-${e.node.name||`root`}`},[r[7]||=S(`span`,{class:`material-icons text-sm text-gray-400 shrink-0`},`description`,-1),u(S(`input`,{ref_key:`newFileInputRef`,ref:W,"onUpdate:modelValue":r[1]||=e=>ae.value=e,type:`text`,class:`flex-1 min-w-0 px-1 py-0.5 text-sm border border-blue-400 rounded focus:outline-none focus:ring-1 focus:ring-blue-400`,placeholder:ee.value,"aria-label":q(n)(`fileTree.newFileInputAria`),"data-testid":`file-tree-new-file-input`,onKeydown:he,onCompositionstart:pe,onCompositionend:me,onBlur:fe},null,40,J0n),[[Fe,ae.value]]),S(`span`,Y0n,T(z.value?.extension),1)],8,q0n)):b(``,!0),oe.value?(B(),U(`div`,X0n,T(oe.value),1)):b(``,!0),p.value?(B(),U(`div`,Z0n,T(q(n)(`common.loading`)),1)):b(``,!0),(B(!0),U(D,null,H(_.value,t=>(B(),ke(a,{key:t.path,node:t,"selected-path":e.selectedPath,"recent-paths":e.recentPaths,"children-by-path":e.childrenByPath,"sort-mode":e.sortMode,"show-hidden-system":e.showHiddenSystem,"allow-upload":e.allowUpload,onSelect:r[2]||=e=>i(`select`,e),onLoadChildren:r[3]||=e=>i(`loadChildren`,e),onCreateFile:r[4]||=e=>i(`createFile`,e),onUploadFiles:r[5]||=e=>i(`uploadFiles`,e)},null,8,[`node`,`selected-path`,`recent-paths`,`children-by-path`,`sort-mode`,`show-hidden-system`,`allow-upload`]))),128))])):b(``,!0),(B(),ke(j,{to:`body`},[te.value?(B(),U(`div`,{key:0,class:`fixed z-50 min-w-32 bg-white border border-gray-200 rounded shadow-md py-1 text-sm`,style:xe({top:`${re.value}px`,left:`${ne.value}px`}),"data-testid":`file-tree-context-menu`,translate:`no`,onClick:r[6]||=s(()=>{},[`stop`])},[S(`button`,{type:`button`,class:`w-full text-left px-3 py-1.5 hover:bg-gray-100 flex items-center gap-2`,"data-testid":`file-tree-context-new-file`,onClick:ue},[r[8]||=S(`span`,{class:`material-icons text-sm text-gray-400`},`note_add`,-1),J(` `+T(q(n)(`fileTree.newFileMenuItem`)),1)])],4)):b(``,!0)]))])}}});o(),M(),we();var e2n={class:`w-72 flex-shrink-0 border-r border-gray-200 overflow-y-auto p-2 bg-gray-50`},t2n={class:`flex flex-wrap justify-end items-center gap-x-3 gap-y-1 pb-1 text-xs`},n2n=[`title`],r2n=[`checked`],i2n={class:`flex items-center gap-2`},a2n={class:`text-gray-400`},o2n={class:`flex border border-gray-300 rounded overflow-hidden`},s2n=[`aria-pressed`,`title`],c2n=[`aria-pressed`,`title`],l2n={key:0,class:`p-2 text-xs text-red-600`},u2n={key:1,class:`p-2 text-xs text-gray-400`},d2n={class:`mt-2 pt-2 border-t border-gray-200 px-1 mb-1 flex items-center gap-1`},f2n={class:`text-[10px] font-semibold text-gray-400 uppercase`},p2n={class:`text-[9px] px-1 py-0.5 rounded bg-blue-100 text-blue-600`},m2n=K({__name:`FileTreePane`,props:{rootNode:{},refRoots:{},childrenByPath:{},treeError:{},selectedPath:{},recentPaths:{},sortMode:{},showHiddenSystem:{type:Boolean}},emits:[`select`,`loadChildren`,`update:sortMode`,`update:showHiddenSystem`,`createFile`,`uploadFiles`],setup(e,{emit:t}){let{t:n}=We(),r=t;function i(e){let{target:t}=e;t instanceof HTMLInputElement&&r(`update:showHiddenSystem`,t.checked)}S0n();let a=new Set;return(t,o)=>(B(),U(`div`,e2n,[S(`div`,t2n,[S(`label`,{class:`flex items-center gap-1 text-gray-500 cursor-pointer select-none`,title:q(n)(`fileTreePane.showSystemFilesTitle`)},[S(`input`,{type:`checkbox`,class:`h-3.5 w-3.5`,"data-testid":`file-tree-show-system-toggle`,checked:e.showHiddenSystem,onChange:i},null,40,r2n),J(` `+T(q(n)(`fileTreePane.showSystemFiles`)),1)],8,n2n),S(`div`,i2n,[S(`span`,a2n,T(q(n)(`fileTreePane.sort`)),1),S(`div`,o2n,[S(`button`,{type:`button`,class:c([`h-8 px-2.5 flex items-center gap-1 transition-colors`,e.sortMode===`name`?`bg-blue-50 text-blue-700 font-medium`:`bg-white text-gray-500 hover:bg-gray-50`]),"aria-pressed":e.sortMode===`name`,title:q(n)(`fileTreePane.sortByName`),"data-testid":`file-sort-name`,onClick:o[0]||=e=>r(`update:sortMode`,`name`)},T(q(n)(`fileTreePane.name`)),11,s2n),S(`button`,{type:`button`,class:c([`h-8 px-2.5 flex items-center gap-1 transition-colors`,e.sortMode===`recent`?`bg-blue-50 text-blue-700 font-medium`:`bg-white text-gray-500 hover:bg-gray-50`]),"aria-pressed":e.sortMode===`recent`,title:q(n)(`fileTreePane.sortByRecent`),"data-testid":`file-sort-recent`,onClick:o[1]||=e=>r(`update:sortMode`,`recent`)},T(q(n)(`fileTreePane.recent`)),11,c2n)])])]),e.treeError?(B(),U(`div`,l2n,T(e.treeError),1)):e.rootNode?(B(),ke($0n,{key:2,node:e.rootNode,"selected-path":e.selectedPath,"recent-paths":e.recentPaths,"children-by-path":e.childrenByPath,"sort-mode":e.sortMode,"show-hidden-system":e.showHiddenSystem,"allow-upload":``,onSelect:o[2]||=e=>r(`select`,e),onLoadChildren:o[3]||=e=>r(`loadChildren`,e),onCreateFile:o[4]||=e=>r(`createFile`,e),onUploadFiles:o[5]||=e=>r(`uploadFiles`,e)},null,8,[`node`,`selected-path`,`recent-paths`,`children-by-path`,`sort-mode`,`show-hidden-system`])):(B(),U(`div`,u2n,T(q(n)(`common.loading`)),1)),e.refRoots.length>0?(B(),U(D,{key:3},[S(`div`,d2n,[S(`span`,f2n,T(q(n)(`fileTreePane.reference`)),1),S(`span`,p2n,T(q(n)(`fileTreePane.readOnlyBadge`)),1)]),(B(!0),U(D,null,H(e.refRoots,t=>(B(),ke($0n,{key:t.path,node:t,"selected-path":e.selectedPath,"recent-paths":q(a),"children-by-path":e.childrenByPath,"sort-mode":e.sortMode,"show-hidden-system":``,"allow-upload":!1,onSelect:o[6]||=e=>r(`select`,e),onLoadChildren:o[7]||=e=>r(`loadChildren`,e)},null,8,[`node`,`selected-path`,`recent-paths`,`children-by-path`,`sort-mode`]))),128))],64)):b(``,!0)]))}}),h2n=1024,g2n=h2n*1024,_2n=g2n*1024;function v2n(e){return e===void 0||!Number.isFinite(e)?1:Math.min(100,Math.max(0,Math.floor(e)))}function y2n(e,t={}){if(!Number.isFinite(e)||e<0)return`—`;let n=v2n(t.decimals);return e<h2n?`${Math.trunc(e)} B`:e<g2n?`${(e/h2n).toFixed(n)} KB`:e<_2n?`${(e/g2n).toFixed(n)} MB`:`${(e/_2n).toFixed(n)} GB`}M(),o();function b2n(e,t,n){let r=V(!1),i=V(null);Ve(e,()=>{r.value=!1,i.value=null});async function a(){let a=e.value;if(a){r.value=!0,i.value=null;try{let e=await mN(`${t}?path=${encodeURIComponent(a)}`,{path:a});e.ok||(i.value=e.error||n())}finally{r.value=!1}}}return{busy:r,error:i,run:a}}function x2n(e,t){let{busy:n,error:r,run:i}=b2n(e,SP.files.open,t);return{busy:n,error:r,open:i}}function S2n(e,t){let{busy:n,error:r,run:i}=b2n(e,SP.files.reveal,t);return{busy:n,error:r,reveal:i}}o(),we(),M();var C2n={key:0,class:`flex items-center gap-2 px-3 py-2 border-b border-gray-200 text-xs text-gray-500 font-mono shrink-0`},w2n={class:`truncate min-w-0`},T2n={key:0,class:`text-gray-400 shrink-0`},E2n={key:1,class:`text-gray-400 shrink-0`},D2n=[`disabled`,`title`,`aria-label`],O2n=[`title`],k2n=[`title`,`aria-label`],A2n=K({__name:`FileContentHeader`,props:{selectedPath:{},size:{},modifiedMs:{},isMarkdown:{type:Boolean},mdRawMode:{type:Boolean}},emits:[`toggleMdRaw`,`deselect`],setup(e,{emit:t}){let{t:n}=We(),r=e,i=t,{busy:a,error:o,reveal:s}=S2n(Ee(r,`selectedPath`),()=>n(`fileContentHeader.revealInOsFailed`)),l=m(()=>{let e=n(`fileContentHeader.revealInOs`);return o.value?`${e} – ${o.value}`:e});return(t,r)=>e.selectedPath?(B(),U(`div`,C2n,[S(`span`,w2n,T(e.selectedPath),1),e.size===null?b(``,!0):(B(),U(`span`,T2n,`· `+T(q(y2n)(e.size)),1)),e.modifiedMs===null?b(``,!0):(B(),U(`span`,E2n,`· `+T(q(hkt)(e.modifiedMs)),1)),S(`button`,{type:`button`,class:c([`ml-auto shrink-0 h-8 w-8 flex items-center justify-center rounded hover:bg-gray-100 font-sans disabled:opacity-50`,q(o)?`text-red-500`:`text-gray-400 hover:text-gray-700`]),disabled:q(a),title:q(o)||q(n)(`fileContentHeader.revealInOs`),"aria-label":l.value,"data-testid":`file-reveal-in-os`,onClick:r[0]||=(...e)=>q(s)&&q(s)(...e)},[...r[3]||=[S(`span`,{class:`material-icons text-base`,"aria-hidden":`true`},`folder_open`,-1)]],10,D2n),e.isMarkdown?(B(),U(`button`,{key:2,class:`shrink-0 h-8 px-2.5 flex items-center gap-1 rounded border border-gray-200 text-gray-600 hover:bg-gray-100 font-sans`,title:e.mdRawMode?q(n)(`fileContentHeader.showRendered`):q(n)(`fileContentHeader.showRaw`),onClick:r[1]||=e=>i(`toggleMdRaw`)},T(e.mdRawMode?q(n)(`fileContentHeader.rendered`):q(n)(`fileContentHeader.raw`)),9,O2n)):b(``,!0),S(`button`,{type:`button`,class:`shrink-0 h-8 w-8 flex items-center justify-center rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100`,title:q(n)(`fileContentHeader.closeFile`),"aria-label":q(n)(`fileContentHeader.closeFile`),"data-testid":`close-file-btn`,onClick:r[2]||=e=>i(`deselect`)},[...r[4]||=[S(`span`,{class:`material-icons text-base`,"aria-hidden":`true`},`close`,-1)]],8,k2n)])):b(``,!0)}});o(),we(),M();var j2n={class:`m-4 mb-0 rounded border border-blue-200 bg-blue-50 text-sm`,"data-testid":`system-file-banner`},M2n={class:`flex items-start gap-2 px-3 py-2`},N2n={class:`flex-1 min-w-0`},P2n={class:`flex items-center gap-2 flex-wrap`},F2n={class:`font-semibold text-blue-900`},I2n={key:0,class:`mt-1 text-gray-700 leading-snug whitespace-pre-line`},L2n={key:1,class:`mt-1 text-xs text-gray-500`},R2n=[`href`],z2n=[`aria-label`],B2n=`systemFileBanner.collapsed.`,V2n=`ℹ️`,H2n=`https://github.com/receptron/mulmoclaude/blob/main/`,U2n=K({__name:`SystemFileBanner`,props:{descriptor:{},path:{}},setup(e){let{t}=We(),n=e;function r(e){return B2n+e}function i(e){try{return localStorage.getItem(r(e))===`1`}catch{return!1}}function a(e,t){try{t?localStorage.setItem(r(e),`1`):localStorage.removeItem(r(e))}catch{}}let o=V(i(n.descriptor.id));Ve(()=>n.descriptor.id,e=>{o.value=i(e)});function s(){o.value=!o.value,a(n.descriptor.id,o.value)}let l={"agent-managed-but-hand-editable":`bg-emerald-100 text-emerald-800`,"user-editable":`bg-blue-100 text-blue-800`,"agent-managed":`bg-amber-100 text-amber-800`,"fragile-format":`bg-orange-100 text-orange-800`,ephemeral:`bg-gray-200 text-gray-700`},u=m(()=>l[n.descriptor.editPolicy]),d=m(()=>n.descriptor.schemaRef?H2n+n.descriptor.schemaRef:``);return(n,r)=>(B(),U(`div`,j2n,[S(`div`,M2n,[S(`span`,{class:`text-blue-600 shrink-0`,"aria-hidden":`true`},T(V2n)),S(`div`,N2n,[S(`div`,P2n,[S(`span`,F2n,T(q(t)(`systemFiles.${e.descriptor.id}.title`)),1),S(`span`,{class:c([`text-xs px-1.5 py-0.5 rounded shrink-0`,u.value])},T(q(t)(`systemFiles.editPolicy.${e.descriptor.editPolicy}`)),3)]),o.value?b(``,!0):(B(),U(`p`,I2n,T(q(t)(`systemFiles.${e.descriptor.id}.summary`)),1)),!o.value&&e.descriptor.schemaRef?(B(),U(`p`,L2n,[J(T(q(t)(`systemFiles.schemaLabel`))+`: `,1),S(`a`,{href:d.value,target:`_blank`,rel:`noopener noreferrer`,class:`font-mono text-blue-700 hover:underline break-all`},T(e.descriptor.schemaRef),9,R2n)])):b(``,!0)]),S(`button`,{type:`button`,class:`shrink-0 text-xs text-blue-700 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 rounded px-1`,"aria-label":o.value?q(t)(`systemFiles.showDetails`):q(t)(`systemFiles.hideDetails`),"data-testid":`system-file-banner-toggle`,onClick:s},T(o.value?q(t)(`systemFiles.showDetails`):q(t)(`systemFiles.hideDetails`)),9,z2n)])]))}});M();function W2n(e){return`${e.split(`/`).pop()?.replace(/\.html?$/i,``)||`share`}.zip`}function G2n(){let e=V(!1),t=V(!1);async function n(n){t.value=!1,e.value=!0;try{let e=await _N(SP.share.pack,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})});if(!e.ok){t.value=!0;return}KU(await e.blob(),Y3t(e.headers.get(`content-disposition`),W2n(n)))}catch{t.value=!0}finally{e.value=!1}}function r(){t.value=!1}return{packing:e,packFailed:t,downloadZip:n,reset:r}}M(),o();var K2n=`download`;function q2n(e,t){let n=V(!1),r=V(null),i=0,a=null;function o(){i+=1,a?.abort(),a=null}Ve(e,()=>{o(),n.value=!1,r.value=null});async function s(){let s=e.value;if(!s)return;o();let c=i,l=new AbortController;a=l,n.value=!0,r.value=null;try{let e=await _N(SP.files.raw,{query:{path:s},signal:l.signal});if(c!==i)return;if(!e.ok){r.value=t();return}let n=await e.blob();if(c!==i)return;KU(n,KOn(s,K2n))}catch{if(c!==i)return;r.value=t()}finally{c===i&&(n.value=!1)}}return{busy:n,error:r,download:s}}o(),M(),we();var J2n={class:`flex-1 overflow-auto min-h-0`},Y2n={key:0,class:`h-full flex items-center justify-center text-gray-400 text-sm`},X2n={key:1,class:`p-4 text-sm text-red-600`},Z2n={key:2,class:`p-4 text-sm text-gray-400`},Q2n={key:1,class:`h-full flex flex-col overflow-y-auto`},$2n={class:`m-auto w-full`},e4n=[`title`,`aria-label`],t4n={key:2,class:`shrink-0 m-4 mt-0 rounded border border-red-300 bg-red-50 p-2 text-xs text-red-700`,role:`alert`,"data-testid":`files-marp-save-error`},n4n={key:1,class:`h-full flex flex-col overflow-auto`},r4n={key:0,class:`shrink-0 m-4 mb-0 rounded border border-gray-200 bg-gray-50 p-3 text-xs`},i4n={class:`font-semibold text-gray-600 shrink-0`},a4n={key:0,class:`flex flex-wrap gap-1`},o4n={key:1,class:`text-gray-800 break-words`},s4n={key:1,class:`shrink-0 m-4 mt-0 rounded border border-red-300 bg-red-50 p-2 text-xs text-red-700`,role:`alert`},c4n={key:2,class:`p-4 text-xs whitespace-pre-wrap font-mono text-gray-800`},l4n={key:3,class:`relative w-full h-full`},u4n={key:0,class:`absolute top-2 right-2 z-10 flex flex-col items-end gap-1`},d4n=[`title`,`disabled`],f4n={key:0,class:`text-xs text-red-600 bg-white/90 px-1 rounded`,role:`alert`},p4n=[`src`,`title`],m4n=[`srcdoc`,`title`],h4n={key:5,class:`h-full flex flex-col overflow-auto`},g4n={class:`shrink-0 flex items-center justify-end gap-2 px-4 pt-3`},_4n={key:0,class:`text-xs text-red-600 self-center`,"data-testid":`files-json-invalid-hint`},v4n=[`disabled`,`title`],y4n={key:1,class:`flex-1 p-4 text-xs whitespace-pre-wrap font-mono text-gray-800`},b4n={key:2,class:`shrink-0 m-4 mt-0 rounded border border-red-300 bg-red-50 p-2 text-xs text-red-700`,role:`alert`,"data-testid":`files-json-save-error`},x4n={key:6,class:`p-4 space-y-2`},S4n={key:0,class:`text-xs text-red-600 mb-1 font-sans`},C4n={class:`text-xs font-mono text-gray-800 whitespace-pre-wrap`},w4n={key:7,class:`p-4 text-xs whitespace-pre-wrap font-mono text-gray-800`},T4n={key:2,class:`h-full flex items-center justify-center p-4`},E4n=[`src`,`alt`],D4n=[`src`,`title`],O4n={key:4,class:`h-full flex items-center justify-center p-4`},k4n=[`src`],A4n={key:5,class:`h-full flex items-center justify-center p-4 bg-black`},j4n=[`src`],M4n={key:6,class:`p-4 text-sm text-gray-500 flex flex-col gap-3`},N4n={key:1},P4n={class:`flex flex-wrap items-center gap-2`},F4n=[`disabled`],I4n=[`disabled`],L4n={key:0,class:`mt-2 text-xs text-red-600`,"data-testid":`file-download-error`},R4n={key:1,class:`mt-2 text-xs text-red-600`},z4n=K({__name:`FileContentRenderer`,props:{selectedPath:{},content:{},contentError:{},contentLoading:{type:Boolean},isMarkdown:{type:Boolean},isHtml:{type:Boolean},isJson:{type:Boolean},isJsonl:{type:Boolean},mdRawMode:{type:Boolean},sandboxedHtml:{},htmlPreviewUrl:{},jsonTokens:{},jsonlLines:{},mdFrontmatter:{},rawSaveError:{}},emits:[`markdownLinkClick`,`updateSource`],setup(e,{emit:t}){let n=IL(`markdown`,az),r=IL(`markdown`,cOt),i=Ae(()=>Xe(()=>import(`./JsonEditor-BC9ITErx.js`),__vite__mapDeps([51,5,52,53,54]))),{t:a}=We(),o=e,s=t,l=m(()=>o.selectedPath?j0n(o.selectedPath):null),{packing:u,packFailed:d,downloadZip:f,reset:p}=G2n(),h=m(()=>!!(o.isHtml&&o.htmlPreviewUrl&&o.selectedPath?.toLowerCase().endsWith(`.html`)));function g(){o.selectedPath&&f(o.selectedPath)}Ve(()=>o.selectedPath,()=>p());let _=m(()=>!!(o.mdFrontmatter&&ez(o.mdFrontmatter.meta))),v=m(()=>{let e=o.selectedPath;if(!e)return;let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}),y=m(()=>{let e=o.selectedPath??``,t=e.lastIndexOf(`/`),n=t>=0?e.slice(t+1):e,r=n.lastIndexOf(`.`);return $R({name:r>0?n.slice(0,r):n,fallback:`slides`})}),{busy:x,error:C,open:w}=x2n(Ee(o,`selectedPath`),()=>a(`fileContentRenderer.openInOsFailed`)),{busy:E,error:O,download:k}=q2n(Ee(o,`selectedPath`),()=>a(`common.downloadFailed`)),A=V(!1),j=V(``),M=m(()=>o.isJson&&o.selectedPath!==null&&o.content?.kind===`text`&&N0n(o.selectedPath)),N=m(()=>{try{return JSON.parse(j.value),!0}catch{return!1}});function P(){o.content?.kind===`text`&&(j.value=o.content.content,A.value=!0)}function F(){A.value=!1}function I(){s(`updateSource`,j.value)}let L=V(!1),R=V(``);function z(){o.content?.kind===`text`&&(R.value=o.content.content,L.value=!0)}function ee(){L.value=!1}function te(){s(`updateSource`,R.value)}Ve(()=>o.content,()=>{A.value=!1,L.value=!1});function ne(e){return`${SP.files.raw}?path=${encodeURIComponent(e)}`}function re(e){let t=o.selectedPath??``,n=t.lastIndexOf(`/`),r=n>=0?t.slice(0,n):``,i=KR(e,r),a=o.content?.kind===`text`?o.content.content:e,s=o.mdFrontmatter!==null;return{uuid:`files-preview`,toolName:`text-response`,message:i,title:o.selectedPath??``,data:{text:i,role:`assistant`,transportKind:`text-rest`,pdfSourceText:a,pdfBaseDir:r,pdfStripFrontmatter:s}}}return(t,o)=>(B(),U(`div`,J2n,[e.selectedPath?e.contentError?(B(),U(`div`,X2n,T(e.contentError),1)):e.contentLoading?(B(),U(`div`,Z2n,T(q(a)(`common.loading`)),1)):e.content?(B(),U(D,{key:3},[l.value&&e.selectedPath?(B(),ke(U2n,{key:0,descriptor:l.value,path:e.selectedPath},null,8,[`descriptor`,`path`])):b(``,!0),e.content.kind===`text`?(B(),U(D,{key:1},[e.isMarkdown&&!e.mdRawMode&&_.value?(B(),U(D,{key:0},[L.value?(B(),ke(q(r),{key:0,modelValue:R.value,"onUpdate:modelValue":o[0]||=e=>R.value=e,"pdf-filename":y.value,"base-dir":v.value,"editor-label":q(a)(`fileContentRenderer.marpEditorLabel`)},{actions:Ie(()=>[S(`button`,{class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,"data-testid":`files-marp-cancel-btn`,onClick:ee},T(q(a)(`common.cancel`)),1),S(`button`,{class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded bg-green-600 hover:bg-green-700 text-white`,"data-testid":`files-marp-save-btn`,onClick:te},[o[6]||=S(`span`,{class:`material-icons text-sm`,"aria-hidden":`true`},`save`,-1),J(` `+T(q(a)(`common.save`)),1)])]),_:1},8,[`modelValue`,`pdf-filename`,`base-dir`,`editor-label`])):(B(),U(`div`,Q2n,[S(`div`,$2n,[De(q(n),{markdown:e.content.content,"pdf-filename":y.value,"base-dir":v.value},{toolbar:Ie(()=>[S(`button`,{class:`h-8 px-2.5 flex items-center gap-1 rounded border border-gray-300 text-gray-600 hover:bg-gray-50 text-sm`,title:q(a)(`fileContentRenderer.editMarp`),"aria-label":q(a)(`fileContentRenderer.editMarp`),"data-testid":`files-marp-edit-btn`,onClick:z},[o[7]||=S(`span`,{class:`material-icons text-sm`,"aria-hidden":`true`},`edit`,-1),J(` `+T(q(a)(`fileContentRenderer.editMarp`)),1)],8,e4n)]),_:1},8,[`markdown`,`pdf-filename`,`base-dir`])])])),e.rawSaveError?(B(),U(`div`,t4n,` ⚠ `+T(e.rawSaveError),1)):b(``,!0)],64)):e.isMarkdown&&!e.mdRawMode?(B(),U(`div`,n4n,[e.mdFrontmatter&&e.mdFrontmatter.fields.length>0?(B(),U(`div`,r4n,[(B(!0),U(D,null,H(e.mdFrontmatter.fields,e=>(B(),U(`div`,{key:e.key,class:`flex items-baseline gap-2 py-0.5`},[S(`span`,i4n,T(e.key)+`:`,1),Array.isArray(e.value)?(B(),U(`span`,a4n,[(B(!0),U(D,null,H(e.value,(e,t)=>(B(),U(`span`,{key:String(t)+`:`+q(Va)(e),class:`rounded-full bg-white border border-gray-300 px-2 py-0.5 text-gray-700`},T(q(Va)(e)),1))),128))])):(B(),U(`span`,o4n,T(q(Va)(e.value)),1))]))),128))])):b(``,!0),S(`div`,{class:`flex-1 min-h-0`,onClickCapture:o[2]||=e=>s(`markdownLinkClick`,e)},[De(_4,{"selected-result":re(e.mdFrontmatter?e.mdFrontmatter.body:e.content.content),"editable-source":e.content.content,onUpdateSource:o[1]||=e=>s(`updateSource`,e)},null,8,[`selected-result`,`editable-source`])],32),e.rawSaveError?(B(),U(`div`,s4n,` ⚠ `+T(e.rawSaveError),1)):b(``,!0)])):e.isMarkdown&&e.mdRawMode?(B(),U(`pre`,c4n,T(e.content.content),1)):e.isHtml&&e.htmlPreviewUrl?(B(),U(`div`,l4n,[h.value?(B(),U(`div`,u4n,[S(`button`,{class:`px-2 py-1 text-xs rounded border border-gray-300 bg-white/90 text-gray-600 hover:bg-gray-50 disabled:opacity-50 shadow-sm`,title:q(a)(`fileContentRenderer.downloadZip`),disabled:q(u),"data-testid":`file-html-download`,onClick:g},[o[8]||=S(`span`,{class:`material-icons text-sm align-middle`},`download`,-1),J(` `+T(q(a)(`fileContentRenderer.download`)),1)],8,d4n),q(d)?(B(),U(`span`,f4n,T(q(a)(`fileContentRenderer.downloadError`)),1)):b(``,!0)])):b(``,!0),S(`iframe`,{src:e.htmlPreviewUrl,class:`w-full h-full border-0`,sandbox:`allow-scripts`,title:q(a)(`fileContentRenderer.htmlPreview`)},null,8,p4n)])):e.isHtml?(B(),U(`iframe`,{key:4,srcdoc:e.sandboxedHtml,class:`w-full h-full border-0`,sandbox:`allow-scripts`,title:q(a)(`fileContentRenderer.htmlPreview`)},null,8,m4n)):e.isJson?(B(),U(`div`,h4n,[S(`div`,g4n,[A.value?(B(),U(D,{key:0},[S(`button`,{class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,"data-testid":`files-json-cancel-btn`,onClick:F},T(q(a)(`common.cancel`)),1),N.value?b(``,!0):(B(),U(`span`,_4n,T(q(a)(`fileContentRenderer.invalidJson`)),1)),S(`button`,{class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded bg-green-600 hover:bg-green-700 text-white disabled:opacity-40 disabled:cursor-not-allowed`,"data-testid":`files-json-save-btn`,disabled:!N.value,title:N.value?void 0:q(a)(`fileContentRenderer.invalidJson`),onClick:I},[o[9]||=S(`span`,{class:`material-icons text-sm`},`save`,-1),J(` `+T(q(a)(`common.save`)),1)],8,v4n)],64)):M.value?(B(),U(`button`,{key:1,class:`h-8 px-2.5 flex items-center gap-1 text-sm rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,"data-testid":`files-json-edit-btn`,onClick:P},[o[10]||=S(`span`,{class:`material-icons text-sm`},`edit`,-1),J(` `+T(q(a)(`fileContentRenderer.editJson`)),1)])):b(``,!0)]),A.value?(B(),ke(q(i),{key:0,modelValue:j.value,"onUpdate:modelValue":o[3]||=e=>j.value=e,"editor-label":q(a)(`fileContentRenderer.jsonEditorLabel`),class:`flex-1 min-h-0 m-4`},null,8,[`modelValue`,`editor-label`])):(B(),U(`pre`,y4n,[(B(!0),U(D,null,H(e.jsonTokens,(e,t)=>(B(),U(`span`,{key:t,class:c(q(Ilt)[e.type])},T(e.value),3))),128))])),e.rawSaveError?(B(),U(`div`,b4n,` ⚠ `+T(e.rawSaveError),1)):b(``,!0)])):e.isJsonl?(B(),U(`div`,x4n,[(B(!0),U(D,null,H(e.jsonlLines,(e,t)=>(B(),U(`div`,{key:t,class:c([`rounded border bg-gray-50 p-3`,e.parseError?`border-red-300`:`border-gray-200`])},[e.parseError?(B(),U(`div`,S4n,T(q(a)(`fileContentRenderer.parseError`)),1)):b(``,!0),S(`pre`,C4n,[(B(!0),U(D,null,H(e.tokens,(e,t)=>(B(),U(`span`,{key:t,class:c(q(Ilt)[e.type])},T(e.value),3))),128))])],2))),128))])):(B(),U(`pre`,w4n,T(e.content.content),1))],64)):e.content.kind===`image`&&e.selectedPath?(B(),U(`div`,T4n,[S(`img`,{src:ne(e.selectedPath),alt:e.selectedPath,class:`max-w-full max-h-full object-contain`},null,8,E4n)])):e.content.kind===`pdf`&&e.selectedPath?(B(),U(`iframe`,{key:3,src:ne(e.selectedPath),class:`w-full h-full border-0`,title:q(a)(`fileContentRenderer.pdfPreview`)},null,8,D4n)):e.content.kind===`audio`&&e.selectedPath?(B(),U(`div`,O4n,[(B(),U(`audio`,{key:e.selectedPath,src:ne(e.selectedPath),controls:``,preload:`metadata`,class:`w-full max-w-2xl`},null,8,k4n))])):e.content.kind===`video`&&e.selectedPath?(B(),U(`div`,A4n,[(B(),U(`video`,{key:e.selectedPath,src:ne(e.selectedPath),controls:``,preload:`metadata`,class:`max-w-full max-h-full`},null,8,j4n))])):(B(),U(`div`,M4n,[`message`in e.content?(B(),U(D,{key:0},[J(T(e.content.message),1)],64)):b(``,!0),e.selectedPath?(B(),U(`div`,N4n,[S(`div`,P4n,[S(`button`,{type:`button`,class:`h-8 px-3 flex items-center gap-1 rounded border border-gray-300 bg-white hover:bg-gray-50 text-gray-700 font-medium disabled:opacity-50`,disabled:q(E),"data-testid":`file-download`,onClick:o[4]||=(...e)=>q(k)&&q(k)(...e)},[o[11]||=S(`span`,{class:`material-icons text-sm`},`download`,-1),J(` `+T(q(E)?q(a)(`fileContentRenderer.downloadingFile`):q(a)(`fileContentRenderer.downloadFile`)),1)],8,F4n),S(`button`,{type:`button`,class:`h-8 px-3 flex items-center gap-1 rounded border border-gray-300 bg-white hover:bg-gray-50 text-gray-700 font-medium disabled:opacity-50`,disabled:q(x),"data-testid":`file-open-in-os`,onClick:o[5]||=(...e)=>q(w)&&q(w)(...e)},[o[12]||=S(`span`,{class:`material-icons text-sm`},`open_in_new`,-1),J(` `+T(q(x)?q(a)(`fileContentRenderer.openingInOs`):q(a)(`fileContentRenderer.openInOs`)),1)],8,I4n)]),q(O)?(B(),U(`p`,L4n,T(q(O)),1)):b(``,!0),q(C)?(B(),U(`p`,R4n,T(q(C)),1)):b(``,!0)])):b(``,!0)]))],64)):b(``,!0):(B(),U(`div`,Y2n,T(q(a)(`fileContentRenderer.selectFile`)),1))]))}});function B4n(e){let t=e.split(`/`).filter(Boolean);if(t.length<=1)return[];let n=[];for(let e=1;e<t.length;e++)n.push(t.slice(0,e).join(`/`));return n}function V4n(e,t,n){let r=new Map(e);return r.set(t,n),r}function H4n(e,t){let n=new Map(e);return n.delete(t),n}M();function U4n(){let e=V(null),t=V(new Map),n=V(null),r=0,i=new Map;function a(e){let t=(i.get(e)??0)+1;return i.set(e,t),t}async function o(o){if(t.value.has(o))return;let s=r,c=a(o);t.value=V4n(t.value,o,null);let l=await pN(SP.files.dir,{path:o});if(s!==r||i.get(o)!==c)return;if(!l.ok){t.value=H4n(t.value,o),n.value=l.error||`dir: ${l.status}`;return}let u=l.data;t.value=V4n(t.value,o,u.children??[]),o===``&&(e.value={...u,children:[]})}async function s(){r++,e.value=null,t.value=new Map,n.value=null,await o(``)}async function c(e){a(e),t.value=H4n(t.value,e),await o(e)}return{rootNode:e,childrenByPath:t,treeError:n,loadDirChildren:o,reloadRoot:s,reloadDirChildren:c}}M();function W4n(){let e=V([]);async function t(){let t=await pN(SP.files.refRoots);t.ok&&Array.isArray(t.data)&&(e.value=t.data)}return{refRoots:e,loadRefRoots:t}}function G4n(){let{expand:e}=b0n(),t=U4n(),{refRoots:n,loadRefRoots:r}=W4n();async function i(n){for(let r of B4n(n))e(r),await t.loadDirChildren(r)}return{rootNode:t.rootNode,refRoots:n,childrenByPath:t.childrenByPath,treeError:t.treeError,loadDirChildren:t.loadDirChildren,ensureAncestorsLoaded:i,reloadRoot:t.reloadRoot,reloadDirChildren:t.reloadDirChildren,loadRefRoots:r}}M();var K4n=`files_md_raw_mode`;function q4n(){let e=V(localStorage.getItem(K4n)===`true`);function t(){e.value=!e.value,localStorage.setItem(K4n,String(e.value))}return{mdRawMode:e,toggleMdRaw:t}}M();var J4n=`files_sort_mode`;function Y4n(){return localStorage.getItem(J4n)===`recent`?`recent`:`name`}function X4n(){let e=V(Y4n());function t(t){e.value=t,localStorage.setItem(J4n,t)}return{sortMode:e,setSortMode:t}}M();var Z4n=`filesView.showHiddenSystem`;function Q4n(){return localStorage.getItem(Z4n)===`true`}function $4n(){let e=V(Q4n());function t(t){e.value=t,localStorage.setItem(Z4n,t?`true`:`false`)}return{showHiddenSystem:e,setShowHiddenSystem:t}}function e3n(e,t){function n(n){if(n.button!==0||n.ctrlKey||n.metaKey||n.shiftKey)return;let{target:r}=n;if(!(r instanceof Element))return;let i=r.closest(`a`);if(!i)return;let a=i.getAttribute(`href`);if(!a||m4(a)||a.startsWith(`#`)||!e.value)return;let o=qOn(e.value,a);if(!o)return;n.preventDefault(),n.stopPropagation();let s=JOn(o);if(s!==null){t.onLoadSession(s);return}t.onNavigate(o)}return{handleMarkdownLinkClick:n}}o(),M(),we();var t3n={class:`h-full flex bg-white`,"data-testid":`files-view-root`},n3n={class:`flex-1 flex flex-col min-w-0 overflow-hidden`},r3n=6e4,i3n=4e3,a3n=K({__name:`FilesView`,props:{refreshToken:{}},emits:[`loadSession`],setup(e,{emit:t}){let n=OI(),{t:r}=We(),i=e,a=t,{rootNode:o,refRoots:s,childrenByPath:l,treeError:u,loadDirChildren:d,ensureAncestorsLoaded:f,reloadDirChildren:p,reloadRoot:h,loadRefRoots:g}=G4n(),{selectedPath:v,content:y,contentLoading:x,contentError:C,loadContent:w,selectFile:E,deselectFile:D,abortContent:O}=Jlt(),{mdRawMode:k,toggleMdRaw:A}=q4n(),{sortMode:j,setSortMode:M}=X4n(),{showHiddenSystem:N,setShowHiddenSystem:F}=$4n(),{isMarkdown:I,isHtml:L,isJson:R,isJsonl:z,sandboxedHtml:H,htmlPreviewUrl:ee,jsonTokens:te,jsonlLines:ne,mdFrontmatter:re}=Klt(v,y),ie=V(null);async function ae(e){if(!v.value||y.value?.kind!==`text`||e===y.value.content)return;let t=v.value;ie.value=null;let n=await hN(SP.files.content,{path:t,content:e});if(v.value===t){if(!n.ok){ie.value=n.error;return}y.value={kind:`text`,path:n.data.path,content:e,size:n.data.size,modifiedMs:n.data.modifiedMs}}}Ve(y,()=>{ie.value=null});async function oe(e){let{folder:t,filename:n,resolve:i}=e,a=t?`${t}/${n}`:n,o=l.value.get(t);if(Array.isArray(o)&&o.some(e=>e.name===n)){i(!1,r(`fileTree.newFileError.exists`,{filename:n}));return}let s=await mN(SP.files.create,{path:a,content:``});if(!s.ok){if(s.status===409){i(!1,r(`fileTree.newFileError.exists`,{filename:n})),await p(t);return}i(!1,r(`fileTree.newFileError.saveFailed`));return}i(!0),await p(t),E(s.data.path)}let W=V(null),se=null,ce=m(()=>{let e=W.value;return e===null?null:e.done<e.total?{failed:!1,message:r(`fileTree.upload.progress`,{done:e.done,total:e.total})}:e.failed>0?{failed:!0,message:r(`fileTree.upload.failed`,{count:e.failed})}:{failed:!1,message:r(`fileTree.upload.done`,{count:e.total})}});function le(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`file read failed`)),r.onload=()=>t(typeof r.result==`string`?r.result:``),r.readAsDataURL(e)})}async function ue(e,t){try{let n=await le(t);return n!==``&&(await mN(SP.files.upload,{dir:e,filename:t.name,dataUrl:n})).ok}catch{return!1}}async function de(e){let{folder:t,files:n}=e;se!==null&&(clearTimeout(se),se=null);let r=W.value;W.value=r===null?{done:0,total:n.length,failed:0}:{done:r.done,total:r.total+n.length,failed:r.failed};for(let e of n){let r=await ue(t,e),i=W.value;W.value=i===null?{done:1,total:n.length,failed:+!r}:{done:i.done+1,total:i.total,failed:i.failed+ +!r}}await p(t);let i=W.value;i!==null&&i.done>=i.total&&(se=setTimeout(()=>{W.value=null},i3n))}let fe=m(()=>{let e=new Set,t=Date.now();for(let n of l.value.values())if(n)for(let r of n)r.type===`file`&&r.modifiedMs&&t-r.modifiedMs<r3n&&e.add(r.path);return e}),{handleMarkdownLinkClick:G}=e3n(v,{onNavigate:E,onLoadSession:e=>a(`loadSession`,e)});Ve(()=>eL(n.params.pathMatch),e=>{if(!$I(e)){v.value!==null&&(v.value=null,y.value=null);return}e!==v.value&&(v.value=e,w(e))}),Ve(v,e=>{e&&f(e)},{immediate:!0});let pe=V(null),me=0;function he(){v.value&&me===0&&(me=requestAnimationFrame(()=>{me=0;let e=pe.value?.$el;e instanceof HTMLElement&&e.querySelector(`button[data-selected="true"]`)?.scrollIntoView({block:`nearest`})}))}return Ve(v,he),Ve(l,he),Ve(()=>i.refreshToken,()=>{h(),v.value&&w(v.value)}),P(async()=>{await d(``),await g(),v.value&&w(v.value)}),_(()=>{O(),me!==0&&cancelAnimationFrame(me)}),(e,t)=>(B(),U(`div`,t3n,[De(m2n,{ref_key:`treePaneRef`,ref:pe,"root-node":q(o),"ref-roots":q(s),"children-by-path":q(l),"tree-error":q(u),"selected-path":q(v),"recent-paths":fe.value,"sort-mode":q(j),"show-hidden-system":q(N),onSelect:q(E),onLoadChildren:q(d),"onUpdate:sortMode":q(M),"onUpdate:showHiddenSystem":q(F),onCreateFile:oe,onUploadFiles:de},null,8,[`root-node`,`ref-roots`,`children-by-path`,`tree-error`,`selected-path`,`recent-paths`,`sort-mode`,`show-hidden-system`,`onSelect`,`onLoadChildren`,`onUpdate:sortMode`,`onUpdate:showHiddenSystem`]),ce.value?(B(),U(`div`,{key:0,class:c([`fixed bottom-4 left-4 z-50 px-3 py-2 rounded shadow-md text-sm`,ce.value.failed?`bg-red-50 text-red-700 border border-red-200`:`bg-blue-50 text-blue-700 border border-blue-200`]),"data-testid":`file-upload-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},T(ce.value.message),3)):b(``,!0),S(`div`,n3n,[De(A2n,{"selected-path":q(v),size:q(y)?.size??null,"modified-ms":q(y)?.modifiedMs??null,"is-markdown":q(I),"md-raw-mode":q(k),onToggleMdRaw:q(A),onDeselect:q(D)},null,8,[`selected-path`,`size`,`modified-ms`,`is-markdown`,`md-raw-mode`,`onToggleMdRaw`,`onDeselect`]),De(z4n,{"selected-path":q(v),content:q(y),"content-error":q(C),"content-loading":q(x),"is-markdown":q(I),"is-html":q(L),"is-json":q(R),"is-jsonl":q(z),"md-raw-mode":q(k),"sandboxed-html":q(H),"html-preview-url":q(ee),"json-tokens":q(te),"jsonl-lines":q(ne),"md-frontmatter":q(re),"raw-save-error":ie.value,onMarkdownLinkClick:q(G),onUpdateSource:ae},null,8,[`selected-path`,`content`,`content-error`,`content-loading`,`is-markdown`,`is-html`,`is-json`,`is-jsonl`,`md-raw-mode`,`sandboxed-html`,`html-preview-url`,`json-tokens`,`jsonl-lines`,`md-frontmatter`,`raw-save-error`,`onMarkdownLinkClick`]),q(v)&&!q(x)&&!q(C)?(B(),ke(OAn,{key:q(v),placeholder:q(r)(`filesView.chatPlaceholder`),"prepend-text":`Before answering, take a look at the file at ${q(v)}.`,"test-id-prefix":`files-page-chat`},null,8,[`placeholder`,`prepend-text`])):b(``,!0)])]))}}),o3n=[{id:`memory`,displayName:`settingsMcpTab.catalog.entry.memory.displayName`,description:`settingsMcpTab.catalog.entry.memory.description`,audience:`general`,upstreamUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/memory`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-memory`]},configSchema:[],riskLevel:`low`},{id:`sequential-thinking`,displayName:`settingsMcpTab.catalog.entry.sequentialThinking.displayName`,description:`settingsMcpTab.catalog.entry.sequentialThinking.description`,audience:`general`,upstreamUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-sequential-thinking`]},configSchema:[],riskLevel:`low`},{id:`context7`,displayName:`settingsMcpTab.catalog.entry.context7.displayName`,description:`settingsMcpTab.catalog.entry.context7.description`,audience:`general`,upstreamUrl:`https://github.com/upstash/context7`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@upstash/context7-mcp`]},configSchema:[],riskLevel:`low`},{id:`deepwiki`,displayName:`settingsMcpTab.catalog.entry.deepwiki.displayName`,description:`settingsMcpTab.catalog.entry.deepwiki.description`,audience:`general`,upstreamUrl:`https://docs.devin.ai/work-with-devin/deepwiki-mcp`,spec:{type:`http`,url:`https://mcp.deepwiki.com/sse`},configSchema:[],riskLevel:`low`},{id:`notion`,displayName:`settingsMcpTab.catalog.entry.notion.displayName`,description:`settingsMcpTab.catalog.entry.notion.description`,audience:`general`,upstreamUrl:`https://github.com/makenotion/notion-mcp-server`,setupGuideUrl:`https://www.notion.so/help/create-integrations-with-the-notion-api`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@notionhq/notion-mcp-server`],env:{NOTION_TOKEN:"${NOTION_API_KEY}"}},configSchema:[{key:`NOTION_API_KEY`,label:`settingsMcpTab.catalog.entry.notion.field.apiKey.label`,kind:`secret`,placeholder:`secret_...`,required:!0,helpUrl:`https://www.notion.so/my-integrations`,helpText:`settingsMcpTab.catalog.entry.notion.field.apiKey.help`}],riskLevel:`medium`},{id:`slack`,displayName:`settingsMcpTab.catalog.entry.slack.displayName`,description:`settingsMcpTab.catalog.entry.slack.description`,audience:`general`,upstreamUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/slack`,setupGuideUrl:`https://api.slack.com/quickstart`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-slack`],env:{SLACK_BOT_TOKEN:"${SLACK_BOT_TOKEN}",SLACK_TEAM_ID:"${SLACK_TEAM_ID}"}},configSchema:[{key:`SLACK_BOT_TOKEN`,label:`settingsMcpTab.catalog.entry.slack.field.botToken.label`,kind:`secret`,placeholder:`xoxb-...`,required:!0,helpUrl:`https://api.slack.com/apps`,helpText:`settingsMcpTab.catalog.entry.slack.field.botToken.help`},{key:`SLACK_TEAM_ID`,label:`settingsMcpTab.catalog.entry.slack.field.teamId.label`,kind:`text`,placeholder:`T01ABC23DEF`,required:!0,helpUrl:`https://api.slack.com/methods/team.info`,helpText:`settingsMcpTab.catalog.entry.slack.field.teamId.help`}],riskLevel:`medium`},{id:`google-maps`,displayName:`settingsMcpTab.catalog.entry.googleMaps.displayName`,description:`settingsMcpTab.catalog.entry.googleMaps.description`,audience:`general`,upstreamUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/google-maps`,setupGuideUrl:`https://developers.google.com/maps/documentation/javascript/get-api-key`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-google-maps`],env:{GOOGLE_MAPS_API_KEY:"${GOOGLE_MAPS_API_KEY}"}},configSchema:[{key:`GOOGLE_MAPS_API_KEY`,label:`settingsMcpTab.catalog.entry.googleMaps.field.apiKey.label`,kind:`secret`,placeholder:`AIza...`,required:!0,helpUrl:`https://console.cloud.google.com/google/maps-apis/credentials`,helpText:`settingsMcpTab.catalog.entry.googleMaps.field.apiKey.help`}],riskLevel:`low`},{id:`apple-native`,displayName:`settingsMcpTab.catalog.entry.appleNative.displayName`,description:`settingsMcpTab.catalog.entry.appleNative.description`,audience:`general`,upstreamUrl:`https://github.com/Dhravya/apple-mcp`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@dhravya/apple-mcp`]},configSchema:[],riskLevel:`medium`},{id:`gmail`,displayName:`settingsMcpTab.catalog.entry.gmail.displayName`,description:`settingsMcpTab.catalog.entry.gmail.description`,audience:`general`,upstreamUrl:`https://github.com/GongRzhe/Gmail-MCP-Server`,setupGuideUrl:`https://developers.google.com/workspace/guides/create-credentials#desktop-app`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@gongrzhe/server-gmail-autoauth-mcp`],env:{GMAIL_OAUTH_PATH:"${GMAIL_OAUTH_PATH}"}},configSchema:[{key:`GMAIL_OAUTH_PATH`,label:`settingsMcpTab.catalog.entry.gmail.field.credentials.label`,kind:`path`,placeholder:`~/.gmail-mcp/credentials.json`,required:!0,helpUrl:`https://console.cloud.google.com/apis/credentials`,helpText:`settingsMcpTab.catalog.entry.gmail.field.credentials.help`}],riskLevel:`high`},{id:`google-calendar`,displayName:`settingsMcpTab.catalog.entry.googleCalendar.displayName`,description:`settingsMcpTab.catalog.entry.googleCalendar.description`,audience:`general`,upstreamUrl:`https://github.com/nspady/google-calendar-mcp`,setupGuideUrl:`https://developers.google.com/workspace/guides/create-credentials#desktop-app`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@cocal/google-calendar-mcp`],env:{GOOGLE_OAUTH_CREDENTIALS:"${GOOGLE_OAUTH_CREDENTIALS}"}},configSchema:[{key:`GOOGLE_OAUTH_CREDENTIALS`,label:`settingsMcpTab.catalog.entry.googleCalendar.field.credentials.label`,kind:`path`,placeholder:`~/.gcal-mcp/credentials.json`,required:!0,helpUrl:`https://console.cloud.google.com/apis/credentials`,helpText:`settingsMcpTab.catalog.entry.googleCalendar.field.credentials.help`}],riskLevel:`medium`},{id:`google-drive`,displayName:`settingsMcpTab.catalog.entry.googleDrive.displayName`,description:`settingsMcpTab.catalog.entry.googleDrive.description`,audience:`general`,upstreamUrl:`https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gdrive`,setupGuideUrl:`https://developers.google.com/workspace/guides/create-credentials#desktop-app`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-gdrive`],env:{GDRIVE_CREDENTIALS_PATH:"${GDRIVE_CREDENTIALS_PATH}"}},configSchema:[{key:`GDRIVE_CREDENTIALS_PATH`,label:`settingsMcpTab.catalog.entry.googleDrive.field.credentials.label`,kind:`path`,placeholder:`~/.gdrive-mcp/credentials.json`,required:!0,helpUrl:`https://console.cloud.google.com/apis/credentials`,helpText:`settingsMcpTab.catalog.entry.googleDrive.field.credentials.help`}],riskLevel:`medium`},{id:`github`,displayName:`settingsMcpTab.catalog.entry.github.displayName`,description:`settingsMcpTab.catalog.entry.github.description`,audience:`general`,upstreamUrl:`https://github.com/github/github-mcp-server`,setupGuideUrl:`https://docs.github.com/en/copilot/how-tos/provide-context/use-mcp/set-up-the-github-mcp-server`,spec:{type:`http`,url:`https://api.githubcopilot.com/mcp/`,headers:{Authorization:"Bearer ${GITHUB_PERSONAL_ACCESS_TOKEN}"}},configSchema:[{key:`GITHUB_PERSONAL_ACCESS_TOKEN`,label:`settingsMcpTab.catalog.entry.github.field.token.label`,kind:`secret`,placeholder:`ghp_…`,required:!0,helpUrl:`https://github.com/settings/tokens`,helpText:`settingsMcpTab.catalog.entry.github.field.token.help`}],riskLevel:`medium`},{id:`linear`,displayName:`settingsMcpTab.catalog.entry.linear.displayName`,description:`settingsMcpTab.catalog.entry.linear.description`,audience:`general`,upstreamUrl:`https://github.com/tacticlaunch/mcp-linear`,setupGuideUrl:`https://linear.app/docs/personal-api-keys`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@tacticlaunch/mcp-linear`],env:{LINEAR_API_KEY:"${LINEAR_API_KEY}"}},configSchema:[{key:`LINEAR_API_KEY`,label:`settingsMcpTab.catalog.entry.linear.field.apiKey.label`,kind:`secret`,placeholder:`lin_api_…`,required:!0,helpUrl:`https://linear.app/settings/api`,helpText:`settingsMcpTab.catalog.entry.linear.field.apiKey.help`}],riskLevel:`medium`},{id:`weather-open-meteo`,displayName:`settingsMcpTab.catalog.entry.weatherOpenMeteo.displayName`,description:`settingsMcpTab.catalog.entry.weatherOpenMeteo.description`,audience:`general`,upstreamUrl:`https://www.npmjs.com/package/open-meteo-mcp`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`open-meteo-mcp`]},configSchema:[],riskLevel:`low`},{id:`spotify`,displayName:`settingsMcpTab.catalog.entry.spotify.displayName`,description:`settingsMcpTab.catalog.entry.spotify.description`,audience:`general`,upstreamUrl:`https://github.com/calebWei/SpotifyMCP`,setupGuideUrl:`https://developer.spotify.com/documentation/web-api/concepts/apps`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`spotify-mcp@latest`],env:{SPOTIFY_CLIENT_ID:"${SPOTIFY_CLIENT_ID}"}},configSchema:[{key:`SPOTIFY_CLIENT_ID`,label:`settingsMcpTab.catalog.entry.spotify.field.clientId.label`,kind:`secret`,placeholder:`spotify-client-id`,required:!0,helpUrl:`https://developer.spotify.com/dashboard`,helpText:`settingsMcpTab.catalog.entry.spotify.field.clientId.help`}],riskLevel:`medium`},{id:`youtube-transcript`,displayName:`settingsMcpTab.catalog.entry.youtubeTranscript.displayName`,description:`settingsMcpTab.catalog.entry.youtubeTranscript.description`,audience:`general`,upstreamUrl:`https://github.com/kimtaeyoon83/mcp-server-youtube-transcript`,spec:{type:`stdio`,command:`npx`,args:[`-y`,`@kimtaeyoon83/mcp-server-youtube-transcript`]},configSchema:[],riskLevel:`low`}];function s3n(e){return o3n.find(t=>t.id===e)??null}function c3n(e){return new Set(e.configSchema.filter(e=>e.required).map(e=>e.key))}var l3n=/\$\{([A-Z_][A-Z0-9_]*)\}/g;function u3n(e,t,n){let r=new Set,i=new Set,a=e=>e.replace(l3n,(e,a)=>{i.add(a);let o=t[a];return o===void 0||o===``?(n.has(a)&&r.add(a),``):o}),o;o=e.type===`http`?{type:`http`,url:a(e.url),...e.headers!==void 0&&{headers:d3n(e.headers,a)},...e.enabled!==void 0&&{enabled:e.enabled}}:{type:`stdio`,command:a(e.command),...e.args!==void 0&&{args:e.args.map(a)},...e.env!==void 0&&{env:d3n(e.env,a)},...e.enabled!==void 0&&{enabled:e.enabled}};for(let e of n)i.has(e)||r.add(e);return r.size>0?{ok:!1,missing:[...r]}:{ok:!0,spec:o}}function d3n(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=t(i);return n}o(),M(),we(),le();var f3n={class:`space-y-3`},p3n={"data-testid":`mcp-catalog`,class:`space-y-2 pt-1`},m3n={class:`text-xs font-semibold text-gray-700`},h3n={class:`group`,open:``,"data-testid":`mcp-catalog-audience-general`},g3n={class:`cursor-pointer text-xs font-medium text-gray-700 select-none py-1`},_3n={class:`text-gray-400 ml-1`},v3n={class:`mt-2 space-y-2`},y3n=[`data-testid`],b3n={class:`flex items-start gap-2 cursor-pointer`},x3n=[`checked`,`data-testid`,`onChange`],S3n={class:`flex-1 min-w-0`},C3n={class:`flex items-center gap-2 flex-wrap`},w3n={class:`text-sm font-semibold text-gray-800`},T3n={class:`text-xs text-gray-600 mt-0.5`},E3n={class:`text-[11px] text-gray-500 flex flex-wrap gap-x-3 ml-6`},D3n=[`href`,`data-testid`,`textContent`],O3n=[`href`,`data-testid`,`textContent`],k3n=[`data-testid`],A3n=[`data-testid`,`onSubmit`],j3n={class:`flex items-center gap-1.5`},M3n=[`for`],N3n=[`aria-label`],P3n=[`href`,`title`,`aria-label`,`data-testid`],F3n=[`id`,`onUpdate:modelValue`,`aria-required`,`data-testid`],I3n={key:0,value:``},L3n=[`value`],R3n=[`id`,`onUpdate:modelValue`,`type`,`placeholder`,`aria-required`,`data-testid`],z3n={key:2,class:`text-[11px] text-gray-500`},B3n=[`data-testid`],V3n={class:`flex gap-2 justify-end`},H3n=[`data-testid`],U3n=[`data-testid`],W3n={class:`text-xs font-semibold text-gray-700`},G3n={key:0,class:`text-xs text-gray-500 italic`,"data-testid":`mcp-empty`},K3n={key:1,class:`space-y-2`,"data-testid":`mcp-server-list`},q3n=[`data-testid`],J3n={class:`flex items-center justify-between`},Y3n={class:`flex items-center gap-2`},X3n={class:`text-sm font-semibold text-gray-800`},Z3n={class:`flex items-center gap-1 text-xs text-gray-600 ml-2`},Q3n=[`checked`,`data-testid`,`onChange`],$3n=[`data-testid`,`onClick`],e6n={key:0,class:`text-xs space-y-1`},t6n={class:`text-gray-500`},n6n={class:`ml-1`},r6n={key:1,class:`text-xs space-y-1`},i6n={class:`text-gray-500`},a6n={class:`ml-1`},o6n={key:0,class:`ml-1`},s6n=[`data-testid`],c6n={class:`flex items-start gap-1.5 text-gray-600 cursor-pointer`},l6n=[`checked`,`data-testid`,`onChange`],u6n={key:3,class:`border border-blue-300 rounded p-3 space-y-2`,"data-testid":`mcp-add-form`},d6n={class:`block text-xs font-semibold text-gray-700`},f6n=[`placeholder`],p6n={class:`flex gap-3 text-xs`},m6n={class:`flex items-center gap-1`},h6n={class:`flex items-center gap-1`},g6n={key:0,class:`space-y-2`},_6n={class:`block text-xs font-semibold text-gray-700`},v6n=[`placeholder`],y6n={key:1,class:`space-y-2`},b6n={class:`block text-xs font-semibold text-gray-700`},x6n={class:`block text-xs font-semibold text-gray-700`},S6n=[`placeholder`],C6n={key:2,class:`text-xs text-red-600`,"data-testid":`mcp-draft-error`},w6n={class:`flex justify-end gap-2`},T6n=`mcp-catalog-draft:`,E6n=`https://github.com/receptron/mulmoclaude/blob/main/docs/mcp-sandbox.md`,D6n=K({__name:`SettingsMcpTab`,props:{servers:{},dockerMode:{type:Boolean}},emits:[`add`,`update`,`remove`],setup(e,{expose:t,emit:n}){let{t:r}=We(),a=e,o=n,l=V(!1),d=V(P()),f=V(``),p=m(()=>o3n.filter(e=>e.audience===`general`));function h(e){return a.servers.some(t=>t.id===e)}function g(e,t){let n=t.target;if(!(n instanceof HTMLInputElement))return;if(n.checked){if(e.configSchema.length>0){x(e),n.checked=!1;return}o(`add`,{id:e.id,spec:{...e.spec,enabled:!0}});return}let r=a.servers.findIndex(t=>t.id===e.id);r>=0&&o(`remove`,r)}let _=V(null),v=V({}),y=V([]);function x(e){_.value=e.id,y.value=[],v.value=O(e.id);for(let t of e.configSchema)v.value[t.key]===void 0&&(v.value[t.key]=``)}function C(){_.value=null,v.value={},y.value=[]}function w(){C()}function E(e){y.value=[];let t=u3n(e.spec,v.value,c3n(e));if(!t.ok){y.value=t.missing,k(e.id,v.value,e.configSchema);return}o(`add`,{id:e.id,spec:{...t.spec,enabled:!0}}),j(e.id),C()}function O(e){try{let t=window.localStorage.getItem(T6n+e);if(!t)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n))typeof t==`string`&&(r[e]=t);return r}catch{return{}}}function k(e,t,n){let r=new Set(n.filter(e=>e.kind===`secret`).map(e=>e.key)),i={};for(let[e,n]of Object.entries(t))r.has(e)||(i[e]=n);try{window.localStorage.setItem(T6n+e,JSON.stringify(i))}catch{}}function j(e){try{window.localStorage.removeItem(T6n+e)}catch{}}function M(e){return e.kind===`secret`?`password`:e.kind===`url`?`url`:`text`}function N(e){return e===`low`?`bg-green-100 text-green-700`:e===`medium`?`bg-amber-100 text-amber-700`:`bg-red-100 text-red-700`}function P(){return{id:``,type:`http`,url:``,command:`npx`,argsText:``}}function I(){d.value=P(),f.value=``,l.value=!0}function L(){l.value=!1,f.value=``}let R=/^[a-z][a-z0-9_-]{0,63}$/;function z(e){return e.type===`http`?ee(e.url.trim()):te(e.argsText.split(`
5904
5904
  `).map(e=>e.trim()).filter(e=>e.length>0))}function ee(e){try{let t=new URL(e).hostname.split(`.`).filter(e=>e.length>0);return ne(t.filter((e,n)=>(n!==0||e!==`mcp`&&e!==`www`&&e!==`api`)&&!(n===t.length-1&&/^[a-z]{2,4}$/.test(e)))[0]??t[0]??``)}catch{return``}}function te(e){let t=e.find(e=>!e.startsWith(`-`));return t?ne((t.split(`/`).pop()??t).replace(/^(mcp-server-|server-|mcp-)/,``).replace(/\.(?:[jt]s|mjs|cjs)$/,``)):``}function ne(e){let t=e.toLowerCase().replace(/[^a-z0-9_-]+/g,`-`);for(;t.startsWith(`-`);)t=t.slice(1);for(;t.endsWith(`-`);)t=t.slice(0,-1);return t=t.slice(0,64),/^[a-z]/.test(t)?t:``}function re(e){if(!e)return``;if(!a.servers.some(t=>t.id===e))return e;for(let t=2;t<1e3;t+=1){let n=`${e}-${t}`;if(!a.servers.some(e=>e.id===n))return n}return``}function ie(){let e=d.value.id.trim();if(!e){let t=re(z(d.value));if(!t){f.value=r(`settingsMcpTab.errNoName`);return}e=t}if(!R.test(e)){f.value=r(`settingsMcpTab.errBadName`);return}if(a.servers.some(t=>t.id===e)){f.value=r(`settingsMcpTab.errIdExists`,{id:e});return}let t;if(d.value.type===`http`){let e=d.value.url.trim();if(!/^https?:\/\//.test(e)){f.value=r(`settingsMcpTab.errBadHttpUrl`);return}t={type:`http`,url:e,enabled:!0}}else{let e=d.value.argsText.split(`
5905
5905
  `).map(e=>e.trim()).filter(e=>e.length>0);t={type:`stdio`,command:d.value.command,args:e,enabled:!0}}o(`add`,{id:e,spec:t}),l.value=!1,f.value=``}function ae(){return l.value?d.value.id.trim().length>0||d.value.type===`http`&&d.value.url.trim().length>0||d.value.type===`stdio`&&d.value.argsText.trim().length>0?(ie(),!l.value):(L(),!0):!0}function oe(){return l.value?d.value.id.trim().length>0||d.value.url.trim().length>0||d.value.type===`stdio`&&(d.value.command.trim().length>0||d.value.argsText.trim().length>0):!1}t({flushDraft:ae,hasPendingDraft:oe});function W(e,t){let{target:n}=t;if(!(n instanceof HTMLInputElement))return;let r=a.servers[e];r&&o(`update`,e,{...r,spec:{...r.spec,enabled:n.checked}})}function se(e,t){let{target:n}=t;if(!(n instanceof HTMLInputElement))return;let r=a.servers[e];r&&r.spec.type===`stdio`&&o(`update`,e,{...r,spec:{...r.spec,hostExecInDocker:n.checked}})}function ce(e){return/^https?:\/\/(localhost|127\.0\.0\.1)(?=[:/]|$)/.test(e)}return(t,n)=>{let a=A(`i18n-t`);return B(),U(`div`,f3n,[De(a,{keypath:`settingsMcpTab.explanation`,tag:`p`,class:`text-xs text-gray-600 leading-relaxed`},{npx:Ie(()=>[...n[9]||=[S(`code`,{class:`bg-gray-100 px-1 rounded`},`npx`,-1)]]),node:Ie(()=>[...n[10]||=[S(`code`,{class:`bg-gray-100 px-1 rounded`},`node`,-1)]]),tsx:Ie(()=>[...n[11]||=[S(`code`,{class:`bg-gray-100 px-1 rounded`},`tsx`,-1)]]),_:1}),S(`section`,p3n,[S(`h3`,m3n,T(q(r)(`settingsMcpTab.catalog.heading`)),1),S(`details`,h3n,[S(`summary`,g3n,[J(T(q(r)(`settingsMcpTab.catalog.audience.general`))+` `,1),S(`span`,_3n,`(`+T(p.value.length)+`)`,1)]),S(`ul`,v3n,[(B(!0),U(D,null,H(p.value,t=>(B(),U(`li`,{key:t.id,"data-testid":`mcp-catalog-entry-${t.id}`,class:`border border-gray-200 rounded p-3 space-y-1.5`},[S(`label`,b3n,[S(`input`,{type:`checkbox`,checked:h(t.id),"data-testid":`mcp-catalog-toggle-${t.id}`,class:`mt-1 shrink-0`,onChange:e=>g(t,e)},null,40,x3n),S(`div`,S3n,[S(`div`,C3n,[S(`span`,w3n,T(q(r)(t.displayName)),1),S(`span`,{class:c([`text-[10px] uppercase tracking-wide rounded px-1.5 py-0.5`,N(t.riskLevel)])},T(q(r)(`settingsMcpTab.catalog.risk.${t.riskLevel}`)),3)]),S(`p`,T3n,T(q(r)(t.description)),1)])]),S(`div`,E3n,[S(`a`,{href:t.upstreamUrl,target:`_blank`,rel:`noopener noreferrer`,class:`hover:text-blue-600 hover:underline`,"data-testid":`mcp-catalog-upstream-${t.id}`,textContent:T(q(r)(`settingsMcpTab.catalog.upstream`))},null,8,D3n),t.setupGuideUrl?(B(),U(`a`,{key:0,href:t.setupGuideUrl,target:`_blank`,rel:`noopener noreferrer`,class:`hover:text-blue-600 hover:underline`,"data-testid":`mcp-catalog-setup-${t.id}`,textContent:T(q(r)(`settingsMcpTab.catalog.setupGuide`))},null,8,O3n)):b(``,!0)]),e.dockerMode&&t.spec.type===`stdio`?(B(),U(`div`,{key:0,class:`flex items-baseline gap-2 text-amber-700 text-[11px] ml-6`,"data-testid":`mcp-catalog-docker-warning-${t.id}`},[S(`span`,null,T(q(r)(`settingsMcpTab.dockerStdioUnsupported`)),1),S(`a`,{href:E6n,target:`_blank`,rel:`noopener noreferrer`,class:`underline whitespace-nowrap`},T(q(r)(`settingsMcpTab.learnMore`)),1)],8,k3n)):b(``,!0),_.value===t.id?(B(),U(`form`,{key:1,"data-testid":`mcp-catalog-config-form-${t.id}`,class:`ml-6 mt-2 space-y-3 border-l-2 border-blue-200 pl-3`,onSubmit:s(e=>E(t),[`prevent`])},[(B(!0),U(D,null,H(t.configSchema,e=>(B(),U(`div`,{key:e.key,class:`space-y-1`},[S(`div`,j3n,[S(`label`,{for:`mcp-config-${t.id}-${e.key}`,class:`text-xs font-medium text-gray-700`},[J(T(q(r)(e.label))+` `,1),e.required?(B(),U(`span`,{key:0,class:`text-red-500`,"aria-label":q(r)(`settingsMcpTab.catalog.config.requiredAria`)},T(q(r)(`settingsMcpTab.catalog.config.requiredMarker`)),9,N3n)):b(``,!0)],8,M3n),e.helpUrl?(B(),U(`a`,{key:0,href:e.helpUrl,target:`_blank`,rel:`noopener noreferrer`,class:`text-xs text-blue-600 hover:underline`,title:q(r)(`settingsMcpTab.catalog.config.howToGet`),"aria-label":q(r)(`settingsMcpTab.catalog.config.howToGet`),"data-testid":`mcp-catalog-config-help-${t.id}-${e.key}`},` 🔑 `,8,P3n)):b(``,!0)]),e.kind===`select`?u((B(),U(`select`,{key:0,id:`mcp-config-${t.id}-${e.key}`,"onUpdate:modelValue":t=>v.value[e.key]=t,"aria-required":e.required,class:c([`w-full px-2 py-1 text-xs border rounded`,y.value.includes(e.key)?`border-red-400 bg-red-50`:`border-gray-300`]),"data-testid":`mcp-catalog-config-input-${t.id}-${e.key}`},[e.required?b(``,!0):(B(),U(`option`,I3n,T(e.placeholder??``),1)),(B(!0),U(D,null,H(e.options??[],e=>(B(),U(`option`,{key:e,value:e},T(e),9,L3n))),128))],10,F3n)),[[i,v.value[e.key]]]):u((B(),U(`input`,{key:1,id:`mcp-config-${t.id}-${e.key}`,"onUpdate:modelValue":t=>v.value[e.key]=t,type:M(e),placeholder:e.placeholder??``,"aria-required":e.required,class:c([`w-full px-2 py-1 text-xs border rounded`,y.value.includes(e.key)?`border-red-400 bg-red-50`:`border-gray-300`]),"data-testid":`mcp-catalog-config-input-${t.id}-${e.key}`,autocomplete:`off`,spellcheck:`false`},null,10,R3n)),[[ze,v.value[e.key]]]),e.helpText?(B(),U(`p`,z3n,T(q(r)(e.helpText)),1)):b(``,!0)]))),128)),y.value.length>0?(B(),U(`div`,{key:0,class:`text-xs text-red-600`,"data-testid":`mcp-catalog-config-error-${t.id}`},T(q(r)(`settingsMcpTab.catalog.config.errMissingRequired`,{fields:y.value.join(`, `)})),9,B3n)):b(``,!0),S(`div`,V3n,[S(`button`,{type:`button`,class:`px-2 py-1 text-xs rounded border border-gray-300 text-gray-600 hover:bg-gray-50`,"data-testid":`mcp-catalog-config-cancel-${t.id}`,onClick:w},T(q(r)(`common.cancel`)),9,H3n),S(`button`,{type:`submit`,class:`px-2 py-1 text-xs rounded bg-blue-500 text-white hover:bg-blue-600`,"data-testid":`mcp-catalog-config-install-${t.id}`},T(q(r)(`settingsMcpTab.catalog.config.install`)),9,U3n)])],40,A3n)):b(``,!0)],8,y3n))),128))])])]),n[15]||=S(`hr`,{class:`border-gray-200`},null,-1),S(`h3`,W3n,T(q(r)(`settingsMcpTab.customHeading`)),1),e.servers.length===0?(B(),U(`div`,G3n,T(q(r)(`settingsMcpTab.noServers`)),1)):(B(),U(`ul`,K3n,[(B(!0),U(D,null,H(e.servers,(t,i)=>(B(),U(`li`,{key:t.id+`:`+i,class:`border border-gray-200 rounded p-3 space-y-2`,"data-testid":`mcp-server-`+t.id},[S(`div`,J3n,[S(`div`,Y3n,[S(`span`,X3n,T(t.id),1),S(`span`,{class:c([`text-[10px] uppercase tracking-wide rounded px-1.5 py-0.5`,t.spec.type===`http`?`bg-green-100 text-green-700`:`bg-amber-100 text-amber-700`])},T(t.spec.type),3),S(`label`,Z3n,[S(`input`,{type:`checkbox`,checked:t.spec.enabled!==!1,"data-testid":`mcp-enabled-`+t.id,onChange:e=>W(i,e)},null,40,Q3n),J(` `+T(q(r)(`settingsMcpTab.enabled`)),1)])]),S(`button`,{class:`text-xs text-red-600 hover:text-red-800`,"data-testid":`mcp-remove-`+t.id,onClick:e=>o(`remove`,i)},T(q(r)(`common.remove`)),9,$3n)]),t.spec.type===`http`?(B(),U(`div`,e6n,[S(`div`,null,[S(`span`,t6n,T(q(r)(`settingsMcpTab.urlLabel`)),1),S(`code`,n6n,T(t.spec.url),1)]),e.dockerMode&&ce(t.spec.url)?(B(),ke(a,{key:0,keypath:`settingsMcpTab.localhostRewrite`,tag:`div`,class:`text-amber-700`},{localhost:Ie(()=>[...n[12]||=[S(`code`,null,`localhost`,-1)]]),hostDockerInternal:Ie(()=>[...n[13]||=[S(`code`,null,`host.docker.internal`,-1)]]),_:1})):b(``,!0)])):t.spec.type===`stdio`?(B(),U(`div`,r6n,[S(`div`,null,[S(`span`,i6n,T(q(r)(`settingsMcpTab.commandLabel`)),1),S(`code`,a6n,T(t.spec.command),1),t.spec.args?.length?(B(),U(`code`,o6n,T((t.spec.args??[]).join(` `)),1)):b(``,!0)]),e.dockerMode?(B(),U(`div`,{key:0,class:`space-y-1`,"data-testid":`mcp-docker-warning-`+t.id},[S(`div`,{class:c([`flex items-baseline gap-2`,t.spec.hostExecInDocker?`text-red-700`:`text-amber-700`])},[S(`span`,null,T(t.spec.hostExecInDocker?q(r)(`settingsMcpTab.dockerStdioHostExecActive`):q(r)(`settingsMcpTab.dockerStdioUnsupported`)),1),S(`a`,{href:E6n,target:`_blank`,rel:`noopener noreferrer`,class:`underline whitespace-nowrap`},T(q(r)(`settingsMcpTab.learnMore`)),1)],2),S(`label`,c6n,[S(`input`,{type:`checkbox`,class:`mt-0.5 shrink-0`,checked:t.spec.hostExecInDocker===!0,"data-testid":`mcp-hostexec-`+t.id,onChange:e=>se(i,e)},null,40,l6n),S(`span`,null,T(q(r)(`settingsMcpTab.dockerStdioHostExecOptIn`)),1)])],8,s6n)):b(``,!0)])):b(``,!0)],8,q3n))),128))])),l.value?(B(),U(`div`,u6n,[S(`label`,d6n,[J(T(q(r)(`settingsMcpTab.nameLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[0]||=e=>d.value.id=e,type:`text`,placeholder:q(r)(`settingsMcpTab.namePlaceholder`),class:`mt-1 w-full px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:border-blue-400`,"data-testid":`mcp-draft-id`,onKeydown:n[1]||=s(()=>{},[`stop`])},null,40,f6n),[[Fe,d.value.id]])]),S(`div`,p6n,[S(`label`,m6n,[u(S(`input`,{"onUpdate:modelValue":n[2]||=e=>d.value.type=e,type:`radio`,value:`http`,"data-testid":`mcp-draft-type-http`},null,512),[[F,d.value.type]]),J(` `+T(q(r)(`settingsMcpTab.typeHttp`)),1)]),S(`label`,h6n,[u(S(`input`,{"onUpdate:modelValue":n[3]||=e=>d.value.type=e,type:`radio`,value:`stdio`,"data-testid":`mcp-draft-type-stdio`},null,512),[[F,d.value.type]]),J(` `+T(q(r)(`settingsMcpTab.typeStdio`)),1)])]),d.value.type===`http`?(B(),U(`div`,g6n,[S(`label`,_6n,[J(T(q(r)(`settingsMcpTab.urlFieldLabel`))+` `,1),u(S(`input`,{"onUpdate:modelValue":n[4]||=e=>d.value.url=e,type:`text`,placeholder:q(r)(`settingsMcpTab.urlPlaceholder`),class:`mt-1 w-full px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:border-blue-400`,"data-testid":`mcp-draft-url`,onKeydown:n[5]||=s(()=>{},[`stop`])},null,40,v6n),[[Fe,d.value.url]])])])):(B(),U(`div`,y6n,[S(`label`,b6n,[J(T(q(r)(`settingsMcpTab.commandFieldLabel`))+` `,1),u(S(`select`,{"onUpdate:modelValue":n[6]||=e=>d.value.command=e,class:`mt-1 w-full px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:border-blue-400`,"data-testid":`mcp-draft-command`},[...n[14]||=[S(`option`,{value:`npx`},`npx`,-1),S(`option`,{value:`node`},`node`,-1),S(`option`,{value:`tsx`},`tsx`,-1)]],512),[[i,d.value.command]])]),S(`label`,x6n,[J(T(q(r)(`settingsMcpTab.argsLabel`))+` `,1),u(S(`textarea`,{"onUpdate:modelValue":n[7]||=e=>d.value.argsText=e,class:`mt-1 w-full h-20 px-2 py-1 text-sm font-mono border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:q(r)(`settingsMcpTab.argsPlaceholder`),"data-testid":`mcp-draft-args`,onKeydown:n[8]||=s(()=>{},[`stop`])},null,40,S6n),[[Fe,d.value.argsText]])])])),f.value?(B(),U(`div`,C6n,T(f.value),1)):b(``,!0),S(`div`,w6n,[S(`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:L},T(q(r)(`common.cancel`)),1),S(`button`,{class:`px-2 py-1 text-xs rounded bg-blue-500 text-white hover:bg-blue-600`,"data-testid":`mcp-draft-add`,onClick:ie},T(q(r)(`common.add`)),1)])])):(B(),U(`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:I},T(q(r)(`settingsMcpTab.addServerButton`)),1))])}}});o(),M(),we(),le();var O6n={class:`space-y-3`},k6n={key:0,class:`text-sm text-gray-400`},A6n={key:1,class:`text-sm text-red-600 bg-red-50 rounded px-3 py-2`},j6n={key:0,class:`text-sm text-gray-400`},M6n={key:1,class:`space-y-1.5`},N6n=[`data-testid`],P6n={class:`flex-1 min-w-0`},F6n={class:`font-mono text-xs text-gray-800`},I6n={key:0,class:`text-xs text-gray-500 truncate`},L6n={class:`text-[10px] px-1.5 py-0.5 rounded bg-gray-200 text-gray-600 shrink-0`},R6n=[`title`,`onClick`],z6n={class:`border border-gray-200 rounded p-2 space-y-2`},B6n={class:`text-xs font-semibold text-gray-600`},V6n={class:`flex gap-2`},H6n=[`placeholder`],U6n=[`placeholder`],W6n={class:`flex items-center gap-2`},G6n={key:0,class:`text-xs text-red-500`},K6n={key:2,class:`text-xs text-red-600 bg-red-50 rounded px-3 py-1.5`,"data-testid":`workspace-dirs-persist-error`},q6n=K({__name:`SettingsWorkspaceDirsTab`,setup(e){let{t}=We(),n=V([]),r=V(!0),a=V(``),o=V(``),c=V(``),d=V(``),f=V(`flat`),p=V(``);async function m(){r.value=!0,a.value=``;let e=await pN(SP.config.workspaceDirs);if(r.value=!1,!e.ok){a.value=e.error;return}n.value=e.data.dirs}let h=Promise.resolve();async function g(e){let t=h.catch(()=>void 0).then(async()=>{let t=e(n.value),r=await hN(SP.config.workspaceDirs,{dirs:t});return r.ok?(n.value=r.data.dirs,o.value=``,!0):(o.value=r.error,!1)});return h=t,t}async function _(){p.value=``;let e=c.value.trim();if(!e){p.value=t(`settingsWorkspaceDirs.errPathRequired`);return}if(!e.startsWith(`data/`)&&!e.startsWith(`artifacts/`)){p.value=t(`settingsWorkspaceDirs.errMustStartWith`);return}if(n.value.some(t=>t.path===e)){p.value=t(`settingsWorkspaceDirs.errAlreadyExists`);return}let r={path:e,description:d.value.trim(),structure:f.value};await g(e=>[...e,r])&&(c.value=``,d.value=``,f.value=`flat`)}async function v(e){let t=n.value[e];t&&await g(e=>e.filter(e=>e!==t))}return P(m),(e,m)=>{let h=A(`i18n-t`);return B(),U(`div`,O6n,[De(h,{keypath:`settingsWorkspaceDirs.explanation`,tag:`p`,class:`text-xs text-gray-600 leading-relaxed`},{dataDir:Ie(()=>[...m[5]||=[S(`code`,{class:`bg-gray-100 px-1 rounded`},`data/`,-1)]]),artifactsDir:Ie(()=>[...m[6]||=[S(`code`,{class:`bg-gray-100 px-1 rounded`},`artifacts/`,-1)]]),_:1}),r.value?(B(),U(`div`,k6n,T(q(t)(`common.loading`)),1)):a.value?(B(),U(`div`,A6n,T(a.value),1)):(B(),U(D,{key:2},[n.value.length===0?(B(),U(`div`,j6n,T(q(t)(`settingsWorkspaceDirs.noEntries`)),1)):(B(),U(`div`,M6n,[(B(!0),U(D,null,H(n.value,(e,n)=>(B(),U(`div`,{key:e.path,class:`flex items-center gap-2 px-2 py-1.5 bg-gray-50 rounded text-sm`,"data-testid":`workspace-dir-${n}`},[S(`div`,P6n,[S(`div`,F6n,T(e.path)+`/`,1),e.description?(B(),U(`div`,I6n,T(e.description),1)):b(``,!0)]),S(`span`,L6n,T(e.structure),1),S(`button`,{class:`text-gray-300 hover:text-red-500 shrink-0`,title:q(t)(`common.remove`),onClick:e=>v(n)},[...m[7]||=[S(`span`,{class:`material-icons text-sm`},`close`,-1)]],8,R6n)],8,N6n))),128))])),S(`div`,z6n,[S(`div`,B6n,T(q(t)(`settingsWorkspaceDirs.addDirTitle`)),1),S(`div`,V6n,[u(S(`input`,{"onUpdate:modelValue":m[0]||=e=>c.value=e,class:`flex-1 px-2 py-1 text-xs font-mono border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:q(t)(`settingsWorkspaceDirs.pathPlaceholder`),"data-testid":`workspace-dir-path-input`,onKeydown:[l(_,[`enter`]),m[1]||=s(()=>{},[`stop`])]},null,40,H6n),[[Fe,c.value]]),u(S(`select`,{"onUpdate:modelValue":m[2]||=e=>f.value=e,class:`text-xs border border-gray-300 rounded px-1 py-1 focus:outline-none`,"data-testid":`workspace-dir-structure-select`},[...m[8]||=[S(`option`,{value:`flat`},`flat`,-1),S(`option`,{value:`by-name`},`by-name`,-1),S(`option`,{value:`by-date`},`by-date`,-1)]],512),[[i,f.value]])]),u(S(`input`,{"onUpdate:modelValue":m[3]||=e=>d.value=e,class:`w-full px-2 py-1 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:q(t)(`settingsWorkspaceDirs.descPlaceholder`),"data-testid":`workspace-dir-desc-input`,onKeydown:[l(_,[`enter`]),m[4]||=s(()=>{},[`stop`])]},null,40,U6n),[[Fe,d.value]]),S(`div`,W6n,[S(`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:_},T(q(t)(`common.add`)),1),p.value?(B(),U(`span`,G6n,T(p.value),1)):b(``,!0)])]),o.value?(B(),U(`div`,K6n,T(o.value),1)):b(``,!0)],64))])}}});o(),M(),we(),le();var J6n={class:`space-y-3`},Y6n={class:`text-xs text-gray-600 leading-relaxed`},X6n={key:0,class:`text-sm text-gray-400`},Z6n={key:1,class:`text-sm text-red-600 bg-red-50 rounded px-3 py-2`},Q6n={key:0,class:`text-sm text-gray-400`},$6n={key:1,class:`space-y-1.5`},e8n=[`data-testid`],t8n={class:`flex-1 min-w-0`},n8n={class:`font-mono text-xs text-gray-800 truncate`},r8n={key:0,class:`text-xs text-gray-500 truncate`},i8n={class:`text-[10px] px-1.5 py-0.5 rounded bg-blue-100 text-blue-600 shrink-0`},a8n=[`title`,`onClick`],o8n={class:`border border-gray-200 rounded p-2 space-y-2`},s8n={class:`text-xs font-semibold text-gray-600`},c8n=[`placeholder`],l8n=[`placeholder`],u8n={class:`flex items-center gap-2`},d8n={key:0,class:`text-xs text-red-500`},f8n={key:2,class:`text-xs text-red-600 bg-red-50 rounded px-3 py-1.5`,"data-testid":`reference-dirs-persist-error`},p8n=K({__name:`SettingsReferenceDirsTab`,setup(e){let{t}=We(),n=V([]),r=V(!0),i=V(``),a=V(``),o=V(``),c=V(``),d=V(``);async function f(){r.value=!0,i.value=``;let e=await pN(SP.config.referenceDirs);if(r.value=!1,!e.ok){i.value=e.error;return}n.value=e.data.dirs}let p=Promise.resolve();async function m(e){let t=p.catch(()=>void 0).then(async()=>{let t=e(n.value),r=await hN(SP.config.referenceDirs,{dirs:t});return r.ok?(n.value=r.data.dirs,a.value=``,!0):(a.value=r.error,!1)});return p=t,t}async function h(){d.value=``;let e=o.value.trim();if(!e){d.value=t(`settingsReferenceDirs.errPathRequired`);return}if(!e.startsWith(`/`)&&!e.startsWith(`~/`)){d.value=t(`settingsReferenceDirs.errMustBeAbsolute`);return}let r=e;for(;r.length>1&&r.endsWith(`/`);)r=r.slice(0,-1);let i=e=>{let t=e;for(;t.length>1&&t.endsWith(`/`);)t=t.slice(0,-1);return t};if(n.value.some(e=>i(e.hostPath)===r)){d.value=t(`settingsReferenceDirs.errAlreadyExists`);return}let a=r.split(`/`).pop(),s=c.value.trim()||a||r;if(n.value.some(e=>e.label===s)){d.value=t(`settingsReferenceDirs.errLabelConflict`,{label:s});return}let l={hostPath:r,label:s};await m(e=>[...e,l])&&(o.value=``,c.value=``)}async function g(e){let t=n.value[e];t&&await m(e=>e.filter(e=>e!==t))}return P(f),(e,f)=>(B(),U(`div`,J6n,[S(`p`,Y6n,T(q(t)(`settingsReferenceDirs.explanation`)),1),r.value?(B(),U(`div`,X6n,T(q(t)(`common.loading`)),1)):i.value?(B(),U(`div`,Z6n,T(i.value),1)):(B(),U(D,{key:2},[n.value.length===0?(B(),U(`div`,Q6n,T(q(t)(`settingsReferenceDirs.noEntries`)),1)):(B(),U(`div`,$6n,[(B(!0),U(D,null,H(n.value,(e,n)=>(B(),U(`div`,{key:e.hostPath,class:`flex items-center gap-2 px-2 py-1.5 bg-gray-50 rounded text-sm`,"data-testid":`reference-dir-${n}`},[f[5]||=S(`span`,{class:`material-icons text-sm text-gray-400 shrink-0`},`folder_open`,-1),S(`div`,t8n,[S(`div`,n8n,T(e.hostPath),1),e.label?(B(),U(`div`,r8n,T(e.label),1)):b(``,!0)]),S(`span`,i8n,T(q(t)(`settingsReferenceDirs.readOnlyBadge`)),1),S(`button`,{class:`text-gray-300 hover:text-red-500 shrink-0`,title:q(t)(`common.remove`),"data-testid":`reference-dir-remove-btn`,onClick:e=>g(n)},[...f[4]||=[S(`span`,{class:`material-icons text-sm`},`close`,-1)]],8,a8n)],8,e8n))),128))])),S(`div`,o8n,[S(`div`,s8n,T(q(t)(`settingsReferenceDirs.addDirTitle`)),1),u(S(`input`,{"onUpdate:modelValue":f[0]||=e=>o.value=e,class:`w-full px-2 py-1 text-xs font-mono border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:q(t)(`settingsReferenceDirs.pathPlaceholder`),"data-testid":`reference-dir-path-input`,onKeydown:[l(h,[`enter`]),f[1]||=s(()=>{},[`stop`])]},null,40,c8n),[[Fe,o.value]]),u(S(`input`,{"onUpdate:modelValue":f[2]||=e=>c.value=e,class:`w-full px-2 py-1 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-400`,placeholder:q(t)(`settingsReferenceDirs.labelPlaceholder`),"data-testid":`reference-dir-label-input`,onKeydown:[l(h,[`enter`]),f[3]||=s(()=>{},[`stop`])]},null,40,l8n),[[Fe,c.value]]),S(`div`,u8n,[S(`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:h},T(q(t)(`common.add`)),1),d.value?(B(),U(`span`,d8n,T(d.value),1)):b(``,!0)])]),a.value?(B(),U(`div`,f8n,T(a.value),1)):b(``,!0)],64))]))}});o(),M(),we(),le();var m8n={class:`space-y-3`,"data-testid":`settings-gemini-tab`},h8n={key:0,class:`rounded border border-yellow-400 bg-yellow-50 p-3 text-sm text-yellow-800`,"data-testid":`settings-gemini-warning`},g8n={class:`space-y-2`},_8n={class:`block text-sm font-medium text-gray-800`,for:`settings-gemini-api-key`},v8n={class:`flex items-center gap-2`},y8n=[`placeholder`,`disabled`,`onKeydown`],b8n=[`disabled`],x8n={class:`text-xs text-gray-500`},S8n={class:`text-xs text-gray-500`},C8n={class:`flex items-center gap-3 text-xs`},w8n=[`disabled`],T8n={key:1,class:`text-xs text-gray-500`,"data-testid":`settings-gemini-env-source`},E8n={class:`font-mono`},D8n={key:2,class:`text-sm text-red-700`,role:`alert`,"data-testid":`settings-gemini-error`},L9=`GEMINI_API_KEY`,O8n=`.env`,k8n=K({__name:`SettingsGeminiTab`,props:{reloadToken:{},geminiAvailable:{type:Boolean},envFilePath:{}},emits:[`saved`,`ask`],setup(e,{emit:t}){let{t:n}=We(),r=e,i=t,a=V(``),o=V(`none`),d=V(!0),f=V(!1),p=V(``),h=m(()=>d.value||f.value),g=m(()=>r.envFilePath||O8n),_=m(()=>f.value?n(`common.saving`):d.value?n(`common.loading`):o.value===`gui`?n(`settingsModal.geminiTab.storedHere`):o.value===`env`?n(`settingsModal.geminiTab.storedInEnvironment`):n(`settingsModal.geminiTab.notConfigured`)),v=m(()=>p.value?`text-red-600`:o.value===`none`?`text-gray-500`:`text-green-600`);async function y(){p.value=``,d.value=!0;let e=await pN(SP.secrets);if(d.value=!1,!e.ok){p.value=e.error||n(`settingsModal.geminiTab.loadError`);return}o.value=e.data.secrets.find(e=>e.key===L9)?.source??`none`,a.value=``}async function x(){let e=a.value.trim();if(h.value||e===``)return;f.value=!0,p.value=``;let t=await hN(SP.secrets,{key:L9,value:e});if(f.value=!1,!t.ok){p.value=t.error||n(`settingsModal.geminiTab.saveError`);return}o.value=t.data.secrets.find(e=>e.key===L9)?.source??`gui`,a.value=``,i(`saved`)}async function C(){if(h.value)return;f.value=!0,p.value=``;let e=await gN(SP.secrets,{key:L9});if(f.value=!1,!e.ok){p.value=e.error||n(`settingsModal.geminiTab.clearError`);return}o.value=e.data.secrets.find(e=>e.key===L9)?.source??`none`,i(`saved`)}return Ve(()=>r.reloadToken,y,{immediate:!0}),(t,r)=>{let d=A(`i18n-t`);return B(),U(`div`,m8n,[e.geminiAvailable?b(``,!0):(B(),U(`div`,h8n,[r[3]||=S(`span`,{class:`material-icons text-sm align-middle mr-1`},`warning`,-1),De(d,{keypath:`settingsModal.geminiTab.required`,tag:`span`},{envKey:Ie(()=>[...r[2]||=[S(`code`,{class:`font-mono`},`GEMINI_API_KEY`,-1)]]),_:1})])),S(`div`,g8n,[S(`label`,_8n,T(q(n)(`settingsModal.geminiTab.apiKeyLabel`)),1),S(`div`,v8n,[u(S(`input`,{id:`settings-gemini-api-key`,"onUpdate:modelValue":r[0]||=e=>a.value=e,type:`password`,autocomplete:`off`,spellcheck:`false`,class:`flex-1 px-3 py-2 text-sm font-mono rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 disabled:cursor-not-allowed`,placeholder:q(n)(`settingsModal.geminiTab.apiKeyPlaceholder`),disabled:h.value,"data-testid":`settings-gemini-api-key-input`,onKeydown:l(s(x,[`prevent`]),[`enter`])},null,40,y8n),[[Fe,a.value]]),S(`button`,{class:`px-3 py-2 text-sm rounded bg-blue-500 text-white hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed`,disabled:h.value||a.value.trim()===``,"data-testid":`settings-gemini-save-btn`,onClick:x},T(q(n)(`common.save`)),9,b8n)]),S(`p`,x8n,[De(d,{keypath:`settingsModal.geminiTab.helperText`,tag:`span`},{studioLink:Ie(()=>[...r[4]||=[S(`a`,{href:`https://aistudio.google.com/apikey`,target:`_blank`,rel:`noopener noreferrer`,class:`text-blue-600 hover:underline`},`Google AI Studio`,-1)]]),_:1})]),S(`p`,S8n,T(q(n)(`settingsModal.geminiTab.storageNote`)),1)]),S(`div`,C8n,[S(`span`,{class:c(v.value),"data-testid":`settings-gemini-status`},T(_.value),3),o.value===`gui`?(B(),U(`button`,{key:0,class:`text-xs text-red-600 hover:underline disabled:text-gray-400`,disabled:h.value,"data-testid":`settings-gemini-clear-btn`,onClick:C},T(q(n)(`settingsModal.geminiTab.clear`)),9,w8n)):b(``,!0)]),o.value===`env`?(B(),U(`p`,T8n,[De(d,{keypath:`settingsModal.geminiTab.fromEnvironment`,tag:`span`},{envFile:Ie(()=>[S(`code`,E8n,T(g.value),1)]),_:1})])):b(``,!0),p.value?(B(),U(`p`,D8n,T(p.value),1)):b(``,!0),S(`button`,{class:`px-3 py-1.5 text-sm rounded bg-gray-100 text-gray-800 hover:bg-gray-200`,"data-testid":`settings-gemini-ask-btn`,onClick:r[1]||=e=>i(`ask`)},T(q(n)(`settingsModal.geminiAskButton`)),1)])}}});o(),M(),we(),le();var A8n={class:`space-y-3`,"data-testid":`settings-map-tab`},j8n={class:`text-sm text-gray-700`},M8n={class:`space-y-2`},N8n={class:`block text-sm font-medium text-gray-800`,for:`settings-map-api-key`},P8n=[`placeholder`,`disabled`,`onKeydown`],F8n={class:`text-xs text-gray-500`},I8n={class:`text-xs text-gray-500`},L8n={key:0,class:`flex items-center gap-3 text-xs`},R8n={key:1,class:`text-sm text-red-700`,role:`alert`,"data-testid":`settings-map-error`},z8n=K({__name:`SettingsMapTab`,props:{reloadToken:{}},emits:[`saved`],setup(e,{emit:t}){let{t:n}=We(),r=e,i=t,a=V(``),o=V(``),d=V(!0),f=V(!1),p=V(!1),h=V(``),g=m(()=>p.value?n(`common.saving`):h.value?h.value:o.value?n(`settingsModal.mapTab.configured`):n(`settingsModal.mapTab.notConfigured`)),_=m(()=>p.value?`text-gray-500`:h.value?`text-red-600`:o.value?`text-green-600`:`text-gray-500`);async function v(){h.value=``,d.value=!0;let e=await pN(SP.config.base);if(d.value=!1,!e.ok){h.value=e.error||n(`settingsModal.mapTab.loadError`);return}o.value=e.data.settings.googleMapsApiKey??``,a.value=o.value,f.value=!0}async function y(){if(p.value)return;let e=a.value.trim();if(e===o.value)return;p.value=!0,h.value=``;let t=await hN(SP.config.settings,{googleMapsApiKey:e});if(p.value=!1,!t.ok){h.value=t.error||n(`settingsModal.mapTab.saveError`);return}o.value=e,a.value=e,i(`saved`)}function x(e){let{target:t}=e;t instanceof HTMLElement&&t.blur()}return Ve(()=>r.reloadToken,()=>{v()},{immediate:!0}),(e,t)=>{let r=A(`i18n-t`);return B(),U(`div`,A8n,[S(`p`,j8n,T(q(n)(`settingsModal.mapTab.description`)),1),S(`div`,M8n,[S(`label`,N8n,T(q(n)(`settingsModal.mapTab.apiKeyLabel`)),1),u(S(`input`,{id:`settings-map-api-key`,"onUpdate:modelValue":t[0]||=e=>a.value=e,type:`password`,autocomplete:`off`,spellcheck:`false`,class:`w-full px-3 py-2 text-sm font-mono rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 disabled:cursor-not-allowed`,placeholder:q(n)(`settingsModal.mapTab.apiKeyPlaceholder`),disabled:d.value,"data-testid":`settings-map-api-key-input`,onBlur:y,onKeydown:l(s(x,[`prevent`]),[`enter`])},null,40,P8n),[[Fe,a.value]]),S(`p`,F8n,[De(r,{keypath:`settingsModal.mapTab.helperText`,tag:`span`},{consoleLink:Ie(()=>[...t[1]||=[S(`a`,{href:`https://console.cloud.google.com/apis/credentials`,target:`_blank`,rel:`noopener noreferrer`,class:`text-blue-600 hover:underline`},`Google Cloud Console`,-1)]]),_:1})]),S(`p`,I8n,T(q(n)(`settingsModal.mapTab.requiredApis`)),1)]),f.value?(B(),U(`div`,L8n,[S(`span`,{class:c(_.value),"data-testid":`settings-map-status`},T(g.value),3)])):b(``,!0),h.value?(B(),U(`p`,R8n,T(h.value),1)):b(``,!0)])}}});o(),M(),we(),le();var B8n={class:`space-y-3`,"data-testid":`settings-photos-tab`},V8n={class:`text-sm text-gray-700`},H8n={class:`flex items-start gap-3`},U8n=[`disabled`],W8n={for:`settings-photos-auto-capture`,class:`flex-1`},G8n={class:`block text-sm font-medium text-gray-800`},K8n={class:`block text-xs text-gray-500 mt-0.5`},q8n={key:0,class:`flex items-center gap-3 text-xs`},J8n={key:1,class:`text-sm text-red-700`,role:`alert`,"data-testid":`settings-photos-error`},Y8n=K({__name:`SettingsPhotosTab`,props:{reloadToken:{}},emits:[`saved`],setup(e,{emit:t}){let{t:n}=We(),r=e,i=t,a=V(!0),o=V(!0),s=V(!1),l=V(!1),d=V(``),f=m(()=>l.value?n(`common.saving`):d.value?d.value:o.value?n(`settingsModal.photosTab.statusOn`):n(`settingsModal.photosTab.statusOff`)),p=m(()=>l.value?`text-gray-500`:d.value?`text-red-600`:o.value?`text-green-600`:`text-gray-500`);async function h(){d.value=``;let e=await pN(SP.config.base);if(!e.ok){d.value=e.error||n(`settingsModal.photosTab.loadError`);return}let t=e.data.settings.photoExif?.autoCapture??!0;o.value=t,a.value=t,s.value=!0}async function g(){if(l.value||a.value===o.value)return;l.value=!0,d.value=``;let e=await hN(SP.config.settings,{photoExif:{autoCapture:a.value}});if(l.value=!1,!e.ok){d.value=e.error||n(`settingsModal.photosTab.saveError`),a.value=o.value;return}o.value=a.value,i(`saved`)}return Ve(()=>r.reloadToken,()=>{h()},{immediate:!0}),(e,t)=>(B(),U(`div`,B8n,[S(`p`,V8n,T(q(n)(`settingsModal.photosTab.description`)),1),S(`div`,H8n,[u(S(`input`,{id:`settings-photos-auto-capture`,"onUpdate:modelValue":t[0]||=e=>a.value=e,type:`checkbox`,class:`mt-1 h-4 w-4`,disabled:l.value,"data-testid":`settings-photos-auto-capture-input`,onChange:g},null,40,U8n),[[ae,a.value]]),S(`label`,W8n,[S(`span`,G8n,T(q(n)(`settingsModal.photosTab.autoCaptureLabel`)),1),S(`span`,K8n,T(q(n)(`settingsModal.photosTab.autoCaptureHint`)),1)])]),s.value?(B(),U(`div`,q8n,[S(`span`,{class:c(p.value),"data-testid":`settings-photos-status`},T(f.value),3)])):b(``,!0),d.value?(B(),U(`p`,J8n,T(d.value),1)):b(``,!0)]))}});o(),M(),we();var X8n={class:`space-y-3`,"data-testid":`settings-google-tab`},Z8n={class:`text-sm text-gray-700`},Q8n={key:0,class:`text-sm text-amber-700`,"data-testid":`settings-google-secret-ambiguous`},$8n={key:1,class:`flex items-center gap-3`},e5n=[`disabled`],t5n=[`disabled`],n5n={key:2,class:`text-sm text-red-700`,role:`alert`,"data-testid":`settings-google-error`},r5n=2e3,i5n=3e4,a5n=K({__name:`SettingsGoogleTab`,props:{reloadToken:{}},setup(e){let{t}=We(),n=e,r=V(!1),i=V(!1),a=V(`found`),o=V(!1),s=V(!1),l=V(``),u=V(null),d=V(0),f=!1,p=m(()=>i.value?t(`settingsModal.googleTab.statusPending`):r.value?t(`settingsModal.googleTab.statusLinked`):t(`settingsModal.googleTab.statusNotLinked`)),h=m(()=>r.value?`text-green-600`:`text-gray-500`),g=e=>Math.min(r5n*2**e,i5n),_=(e=r5n)=>{u.value&&clearTimeout(u.value),u.value=!f&&i.value?setTimeout(()=>void v(),e):null};async function v(){let e=await pN(SP.google.status);if(!f){if(!e.ok){l.value=e.error||t(`settingsModal.googleTab.loadError`),d.value+=1,_(g(d.value));return}d.value=0,r.value=e.data.linked,i.value=e.data.pending,a.value=e.data.clientSecret,l.value=e.data.lastError??``,o.value=!0,_()}}async function y(){s.value=!0,l.value=``;let e=await mN(SP.google.authorize,{});if(s.value=!1,!e.ok){l.value=e.error||t(`settingsModal.googleTab.connectError`);return}window.open(e.data.authUrl,`_blank`,`noopener`),i.value=!0,d.value=0,_()}async function x(){if(!window.confirm(t(`settingsModal.googleTab.unlinkConfirm`)))return;s.value=!0,l.value=``;let e=await mN(SP.google.unlink,{});if(s.value=!1,!e.ok){l.value=e.error||t(`settingsModal.googleTab.unlinkError`);return}r.value=!1}return Ve(()=>n.reloadToken,()=>{v()},{immediate:!0}),k(()=>{f=!0,u.value&&clearTimeout(u.value)}),(e,n)=>(B(),U(`div`,X8n,[S(`p`,Z8n,T(q(t)(`settingsModal.googleTab.description`)),1),o.value&&a.value===`ambiguous`?(B(),U(`p`,Q8n,T(q(t)(`settingsModal.googleTab.clientSecretAmbiguous`)),1)):b(``,!0),o.value?(B(),U(`div`,$8n,[S(`span`,{class:c([`text-sm`,h.value]),"data-testid":`settings-google-status`},T(p.value),3),r.value?(B(),U(`button`,{key:1,class:`px-2 py-1 text-xs rounded border border-gray-300 text-gray-700 hover:bg-gray-100 disabled:opacity-50`,disabled:s.value,"data-testid":`settings-google-unlink-btn`,onClick:x},T(q(t)(`settingsModal.googleTab.unlink`)),9,t5n)):(B(),U(`button`,{key:0,class:`px-2 py-1 text-xs rounded bg-blue-500 text-white hover:bg-blue-600 disabled:opacity-50`,disabled:s.value||a.value===`ambiguous`,"data-testid":`settings-google-connect-btn`,onClick:y},T(q(t)(`settingsModal.googleTab.connect`)),9,e5n))])):b(``,!0),l.value?(B(),U(`p`,n5n,T(l.value),1)):b(``,!0)]))}}),o5n=(e,t,n)=>!e&&t!==n,s5n=(e,t,n)=>({store:e,resend:t!==n});o(),M(),we(),le();var c5n={class:`space-y-3`,"data-testid":`settings-model-tab`},l5n={class:`text-sm text-gray-700`},u5n={class:`space-y-2`},d5n={class:`block text-sm font-medium text-gray-800`,for:`settings-model-chat-model`},f5n={value:``},p5n=[`value`],m5n={class:`text-xs text-gray-500`},h5n={class:`space-y-2`},g5n={class:`block text-sm font-medium text-gray-800`,for:`settings-model-effort`},_5n={value:``},v5n=[`value`],y5n={class:`text-xs text-gray-500`},b5n={class:`flex items-start gap-3 border-t border-gray-200 pt-3`},x5n=[`disabled`],S5n={for:`settings-model-user-settings`,class:`flex-1`},C5n={class:`block text-sm font-medium text-gray-800`},w5n={class:`block text-xs text-gray-500 mt-0.5`},T5n={key:0,class:`block text-xs text-gray-600 mt-1`,"data-testid":`settings-model-skill-listing`},E5n={key:1,class:`block text-xs text-amber-700 mt-1`,"data-testid":`settings-model-skill-listing-heavy`},D5n={key:0,class:`flex items-center gap-3 text-xs`},O5n={key:1,class:`text-sm text-red-700`,role:`alert`,"data-testid":`settings-model-error`},k5n=K({__name:`SettingsModelTab`,props:{reloadToken:{}},emits:[`saved`],setup(e,{emit:t}){let{t:n}=We(),r=e,a=t,o=V(``),s=V(``),l=V(!1),d={key:`effortLevel`,draft:o,stored:s,saving:l},f=V(``),p=V(``),h=V(!1),g={key:`chatModel`,draft:f,stored:p,saving:h},_=V(!0),v=V(!0),y=V(!1),x=V(null),C=V(!1),w=V(``),E=m(()=>l.value?n(`common.saving`):s.value?n(`settingsModal.modelTab.configured`,{level:s.value}):n(`settingsModal.modelTab.notConfigured`)),O=m(()=>h.value?n(`common.saving`):p.value?n(`settingsModal.modelTab.modelConfigured`,{model:p.value}):n(`settingsModal.modelTab.modelNotConfigured`));function k(e){return e.saving.value?`text-gray-500`:e.stored.value?`text-green-600`:`text-gray-500`}async function A(){w.value=``;let e=await pN(SP.config.base);if(!e.ok){w.value=e.error||n(`settingsModal.modelTab.loadError`);return}s.value=e.data.settings.effortLevel??``,o.value=s.value,p.value=e.data.settings.chatModel??``,f.value=p.value,v.value=e.data.settings.loadClaudeUserSettings??!0,_.value=v.value,x.value=e.data.skillListing??null,C.value=!0}async function j(e){if(!o5n(e.saving.value,e.draft.value,e.stored.value))return;let t=e.draft.value;e.saving.value=!0,w.value=``;let r=await hN(SP.config.settings,{[e.key]:t===``?null:t});e.saving.value=!1;let i=r.ok?``:r.error||n(`settingsModal.modelTab.saveError`),{store:o,resend:s}=s5n(r.ok,e.draft.value,t);o&&(e.stored.value=t,a(`saved`)),w.value=i,s&&j(e)}async function M(){if(y.value||_.value===v.value)return;let e=_.value;y.value=!0,w.value=``;let t=await hN(SP.config.settings,{loadClaudeUserSettings:e});if(y.value=!1,!t.ok){w.value=t.error||n(`settingsModal.modelTab.saveError`),_.value=v.value;return}v.value=e,a(`saved`)}return Ve(()=>r.reloadToken,()=>{A()},{immediate:!0}),(e,t)=>(B(),U(`div`,c5n,[S(`p`,l5n,T(q(n)(`settingsModal.modelTab.description`)),1),S(`div`,u5n,[S(`label`,d5n,T(q(n)(`settingsModal.modelTab.modelLabel`)),1),u(S(`select`,{id:`settings-model-chat-model`,"onUpdate:modelValue":t[0]||=e=>f.value=e,class:`w-full px-3 py-2 text-sm rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500`,"data-testid":`settings-model-model-select`,onChange:t[1]||=e=>j(g)},[S(`option`,f5n,T(q(n)(`settingsModal.modelTab.modelUnset`)),1),(B(!0),U(D,null,H(q(mI),e=>(B(),U(`option`,{key:e,value:e},T(e),9,p5n))),128))],544),[[i,f.value]]),S(`p`,m5n,T(q(n)(`settingsModal.modelTab.modelHelperText`)),1)]),S(`div`,h5n,[S(`label`,g5n,T(q(n)(`settingsModal.modelTab.effortLabel`)),1),u(S(`select`,{id:`settings-model-effort`,"onUpdate:modelValue":t[2]||=e=>o.value=e,class:`w-full px-3 py-2 text-sm rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500`,"data-testid":`settings-model-effort-select`,onChange:t[3]||=e=>j(d)},[S(`option`,_5n,T(q(n)(`settingsModal.modelTab.effortUnset`)),1),(B(!0),U(D,null,H(q(Ost),e=>(B(),U(`option`,{key:e,value:e},T(e),9,v5n))),128))],544),[[i,o.value]]),S(`p`,y5n,T(q(n)(`settingsModal.modelTab.helperText`)),1)]),S(`div`,b5n,[u(S(`input`,{id:`settings-model-user-settings`,"onUpdate:modelValue":t[4]||=e=>_.value=e,type:`checkbox`,class:`mt-1 h-4 w-4`,disabled:y.value||!C.value,"data-testid":`settings-model-user-settings-input`,onChange:M},null,40,x5n),[[ae,_.value]]),S(`label`,S5n,[S(`span`,C5n,T(q(n)(`settingsModal.modelTab.userSettingsLabel`)),1),S(`span`,w5n,T(q(n)(`settingsModal.modelTab.userSettingsHint`)),1),x.value?(B(),U(`span`,T5n,[J(T(q(n)(`settingsModal.modelTab.skillListingSummary`,{count:x.value.skillCount}))+` `,1),x.value.pluginNames.length>0?(B(),U(D,{key:0},[J(T(q(n)(`settingsModal.modelTab.skillListingPlugins`,{plugins:x.value.pluginNames.join(`, `)})),1)],64)):b(``,!0)])):b(``,!0),x.value?.heavy?(B(),U(`span`,E5n,T(q(n)(`settingsModal.modelTab.skillListingHeavy`)),1)):b(``,!0)])]),C.value&&!w.value?(B(),U(`div`,D5n,[S(`span`,{class:c(k(g)),"data-testid":`settings-model-model-status`},T(O.value),3),S(`span`,{class:c(k(d)),"data-testid":`settings-model-status`},T(E.value),3)])):b(``,!0),w.value?(B(),U(`p`,O5n,T(w.value),1)):b(``,!0)]))}});o(),M(),we(),le();var A5n={class:`space-y-3`,"data-testid":`settings-voice-tab`},j5n={class:`text-sm text-gray-700`},M5n={class:`text-xs text-gray-500`,"data-testid":`settings-voice-requirements`},N5n={key:0,class:`rounded border border-gray-300 bg-gray-50 p-3 text-sm text-gray-600`,"data-testid":`settings-voice-unsupported`},P5n={class:`flex items-start gap-3`},F5n=[`disabled`],I5n={for:`settings-voice-enabled`,class:`flex-1`},L5n={class:`block text-sm font-medium text-gray-800`},R5n={class:`block text-xs text-gray-500 mt-0.5`},z5n={class:`block`},B5n={class:`text-xs font-semibold text-gray-700`},V5n=[`disabled`],H5n=[`value`],U5n={key:0,class:`flex items-center gap-2 text-xs`,"data-testid":`settings-voice-status`},W5n={key:0,class:`text-blue-600`},G5n={key:1,class:`text-green-600`},K5n={key:2,class:`text-red-600`},q5n={key:2,class:`text-sm text-red-700`,role:`alert`,"data-testid":`settings-voice-error`},J5n=1500,Y5n=K({__name:`SettingsVoiceTab`,props:{reloadToken:{}},setup(e){let{t}=We(),n=e,r=[`large-v3-turbo`,`small`,`base`],a=V({capable:!1,enabled:!1,model:{name:`large-v3-turbo`,state:`idle`}}),o=V(!1),s=V(`large-v3-turbo`),c=V(!1),l=V(!1),d=V(``),f=null,p=m(()=>Math.round((a.value.model.progress??0)*100));function h(){f!==null&&(window.clearInterval(f),f=null)}async function g(){let e=await pN(SP.transcribe.model);if(!e.ok){c.value=!1,d.value=e.error||t(`settingsModal.voiceTab.loadError`);return}c.value=!0,a.value=e.data,e.data.model.state!==`downloading`&&h()}function v(){f===null&&(f=window.setInterval(()=>{g()},J5n))}async function y(){d.value=``;let e=await pN(SP.config.base);if(!e.ok){d.value=t(`settingsModal.voiceTab.loadError`);return}o.value=e.data.settings.voiceInput?.enabled??!1,s.value=e.data.settings.voiceInput?.model??`large-v3-turbo`,await g(),a.value.model.state===`downloading`&&v()}async function x(){l.value=!0,d.value=``;let e=await hN(SP.config.settings,{voiceInput:{enabled:o.value,model:s.value}});return l.value=!1,e.ok?!0:(d.value=e.error||t(`settingsModal.voiceTab.saveError`),!1)}async function C(){let e=await mN(SP.transcribe.modelDownload);if(!e.ok){d.value=e.error||t(`settingsModal.voiceTab.downloadError`);return}a.value=e.data,e.data.model.state===`downloading`&&v()}async function w(){if(!await x()){o.value=!o.value;return}o.value&&a.value.model.state!==`ready`&&await C()}async function E(){await x()&&(await g(),o.value&&a.value.model.state!==`ready`&&await C())}return Ve(()=>n.reloadToken,()=>{y()},{immediate:!0}),_(h),(e,n)=>(B(),U(`div`,A5n,[S(`p`,j5n,T(q(t)(`settingsModal.voiceTab.description`)),1),S(`p`,M5n,T(q(t)(`settingsModal.voiceTab.requirements`)),1),c.value&&!a.value.capable?(B(),U(`div`,N5n,T(q(t)(`settingsModal.voiceTab.unsupported`)),1)):c.value?(B(),U(D,{key:1},[S(`div`,P5n,[u(S(`input`,{id:`settings-voice-enabled`,"onUpdate:modelValue":n[0]||=e=>o.value=e,type:`checkbox`,class:`mt-1 h-4 w-4`,disabled:l.value,"data-testid":`settings-voice-enabled-input`,onChange:w},null,40,F5n),[[ae,o.value]]),S(`label`,I5n,[S(`span`,L5n,T(q(t)(`settingsModal.voiceTab.enableLabel`)),1),S(`span`,R5n,T(q(t)(`settingsModal.voiceTab.enableHint`)),1)])]),S(`label`,z5n,[S(`span`,B5n,T(q(t)(`settingsModal.voiceTab.modelLabel`)),1),u(S(`select`,{"onUpdate:modelValue":n[1]||=e=>s.value=e,class:`mt-1 w-full px-2 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:border-blue-400 disabled:opacity-50`,disabled:l.value,"data-testid":`settings-voice-model-select`,onChange:E},[(B(),U(D,null,H(r,e=>S(`option`,{key:e,value:e},T(e),9,H5n)),64))],40,V5n),[[i,s.value]])]),o.value?(B(),U(`div`,U5n,[a.value.model.state===`downloading`?(B(),U(`span`,W5n,T(q(t)(`settingsModal.voiceTab.downloading`,{percent:p.value})),1)):a.value.model.state===`ready`?(B(),U(`span`,G5n,T(q(t)(`settingsModal.voiceTab.ready`)),1)):a.value.model.state===`error`?(B(),U(`span`,K5n,T(q(t)(`settingsModal.voiceTab.downloadError`)),1)):b(``,!0),a.value.model.state===`error`?(B(),U(`button`,{key:3,class:`px-2 py-0.5 rounded bg-blue-500 text-white hover:bg-blue-600`,"data-testid":`settings-voice-retry-btn`,onClick:C},T(q(t)(`settingsModal.voiceTab.retry`)),1)):b(``,!0)])):b(``,!0)],64)):b(``,!0),d.value?(B(),U(`p`,q5n,T(d.value),1)):b(``,!0)]))}});o(),M(),we(),le();var X5n={class:`space-y-3`,"data-testid":`settings-chat-index-tab`},Z5n={class:`text-sm text-gray-700`},Q5n={class:`space-y-2`},$5n={class:`block text-sm font-medium text-gray-800`,for:`settings-chat-index-mode`},e7n=[`value`],t7n={class:`text-xs text-gray-500`},n7n={key:0,class:`flex items-center gap-3 text-xs`},r7n={key:1,class:`text-sm text-red-700`,role:`alert`,"data-testid":`settings-chat-index-error`},i7n=K({__name:`SettingsChatIndexTab`,props:{reloadToken:{}},emits:[`saved`],setup(e,{emit:t}){let n=[`off`,`haiku`,`sonnet`],{t:r}=We(),a=e,o=t,s=V(`off`),l=V(`off`),d=V(!1),f=V(!1),p=V(``),h=m(()=>f.value?r(`common.saving`):r(`settingsModal.chatIndexTab.status.${l.value}`)),g=m(()=>f.value||l.value===`off`?`text-gray-500`:`text-green-600`);async function _(){p.value=``;let e=await pN(SP.config.base);if(!e.ok){p.value=e.error||r(`settingsModal.chatIndexTab.loadError`);return}l.value=e.data.settings.chatIndex??`off`,s.value=l.value,d.value=!0}async function v(){if(f.value||s.value===l.value)return;let e=s.value;f.value=!0,p.value=``;let t={chatIndex:e===`off`?null:e},n=await hN(SP.config.settings,t);f.value=!1,y(n,e)}function y(e,t){if(!e.ok){p.value=e.error||r(`settingsModal.chatIndexTab.saveError`),s.value===t?s.value=l.value:v();return}l.value=t,o(`saved`),s.value!==t&&v()}return Ve(()=>a.reloadToken,()=>{_()},{immediate:!0}),(e,t)=>(B(),U(`div`,X5n,[S(`p`,Z5n,T(q(r)(`settingsModal.chatIndexTab.description`)),1),S(`div`,Q5n,[S(`label`,$5n,T(q(r)(`settingsModal.chatIndexTab.modeLabel`)),1),u(S(`select`,{id:`settings-chat-index-mode`,"onUpdate:modelValue":t[0]||=e=>s.value=e,class:`w-full px-3 py-2 text-sm rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500`,"data-testid":`settings-chat-index-mode-select`,onChange:v},[(B(),U(D,null,H(n,e=>S(`option`,{key:e,value:e},T(q(r)(`settingsModal.chatIndexTab.mode.${e}`)),9,e7n)),64))],544),[[i,s.value]]),S(`p`,t7n,T(q(r)(`settingsModal.chatIndexTab.helperText`)),1)]),d.value&&!p.value?(B(),U(`div`,n7n,[S(`span`,{class:c(g.value),"data-testid":`settings-chat-index-status`},T(h.value),3)])):b(``,!0),p.value?(B(),U(`p`,r7n,T(p.value),1)):b(``,!0)]))}});o(),M(),we(),le();var a7n={class:`space-y-3`,"data-testid":`settings-journal-tab`},o7n={class:`text-sm text-gray-700`},s7n={class:`space-y-2`},c7n={class:`block text-sm font-medium text-gray-800`,for:`settings-journal-mode`},l7n=[`value`],u7n={class:`text-xs text-gray-500`},d7n={key:0,class:`flex items-center gap-3 text-xs`},f7n={key:1,class:`text-sm text-red-700`,role:`alert`,"data-testid":`settings-journal-error`},p7n=K({__name:`SettingsJournalTab`,props:{reloadToken:{}},emits:[`saved`],setup(e,{emit:t}){let n=[`off`,`haiku`,`sonnet`],{t:r}=We(),a=e,o=t,s=V(`off`),l=V(`off`),d=V(!1),f=V(!1),p=V(``),h=m(()=>f.value?r(`common.saving`):r(`settingsModal.journalTab.status.${l.value}`)),g=m(()=>f.value||l.value===`off`?`text-gray-500`:`text-green-600`);async function _(){p.value=``;let e=await pN(SP.config.base);if(!e.ok){p.value=e.error||r(`settingsModal.journalTab.loadError`);return}l.value=e.data.settings.journal??`off`,s.value=l.value,d.value=!0}async function v(){if(f.value||s.value===l.value)return;let e=s.value;f.value=!0,p.value=``;let t={journal:e===`off`?null:e},n=await hN(SP.config.settings,t);f.value=!1,y(n,e)}function y(e,t){if(!e.ok){p.value=e.error||r(`settingsModal.journalTab.saveError`),s.value===t?s.value=l.value:v();return}l.value=t,o(`saved`),s.value!==t&&v()}return Ve(()=>a.reloadToken,()=>{_()},{immediate:!0}),(e,t)=>(B(),U(`div`,a7n,[S(`p`,o7n,T(q(r)(`settingsModal.journalTab.description`)),1),S(`div`,s7n,[S(`label`,c7n,T(q(r)(`settingsModal.journalTab.modeLabel`)),1),u(S(`select`,{id:`settings-journal-mode`,"onUpdate:modelValue":t[0]||=e=>s.value=e,class:`w-full px-3 py-2 text-sm rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500`,"data-testid":`settings-journal-mode-select`,onChange:v},[(B(),U(D,null,H(n,e=>S(`option`,{key:e,value:e},T(q(r)(`settingsModal.journalTab.mode.${e}`)),9,l7n)),64))],544),[[i,s.value]]),S(`p`,u7n,T(q(r)(`settingsModal.journalTab.helperText`)),1)]),d.value&&!p.value?(B(),U(`div`,d7n,[S(`span`,{class:c(g.value),"data-testid":`settings-journal-status`},T(h.value),3)])):b(``,!0),p.value?(B(),U(`p`,f7n,T(p.value),1)):b(``,!0)]))}});o(),M(),we(),le();var m7n={class:`space-y-3`,"data-testid":`settings-notifications-tab`},h7n={class:`text-sm text-gray-700`},g7n={class:`flex items-start gap-3`},_7n=[`disabled`],v7n={for:`settings-notifications-push-enabled`,class:`flex-1`},y7n={class:`block text-sm font-medium text-gray-800`},b7n={class:`block text-xs text-gray-500 mt-0.5`},x7n={class:`text-xs text-gray-500`,"data-testid":`settings-notifications-remote-note`},S7n={key:0,class:`flex items-center gap-3 text-xs`},C7n={key:1,class:`flex items-start gap-3 border-t border-gray-200 pt-3`},w7n=[`disabled`],T7n={for:`settings-notifications-macos-reminders`,class:`flex-1`},E7n={class:`block text-sm font-medium text-gray-800`},D7n={class:`block text-xs text-gray-500 mt-0.5`},O7n={key:0,class:`block text-xs text-amber-700 mt-1`,"data-testid":`settings-notifications-macos-reminders-forced`},k7n={key:2,class:`text-sm text-red-700`,role:`alert`,"data-testid":`settings-notifications-error`},A7n=K({__name:`SettingsNotificationsTab`,props:{reloadToken:{}},emits:[`saved`],setup(e,{emit:t}){let{t:n}=We(),r=e,i=t,a=V(!1),o=V(!1),s=V(!0),l=V(!0),d=V(!1),f=V(!1),p=V(!1),h=V(!1),g=V(``),_=m(()=>h.value?n(`common.saving`):g.value?g.value:o.value?n(`settingsModal.notificationsTab.statusOn`):n(`settingsModal.notificationsTab.statusOff`)),v=m(()=>h.value?`text-gray-500`:g.value?`text-red-600`:o.value?`text-green-600`:`text-gray-500`);async function y(){g.value=``;let e=await pN(SP.config.base);if(!e.ok){g.value=e.error||n(`settingsModal.notificationsTab.loadError`);return}let t=e.data.settings.pushEnabled??!1;o.value=t,a.value=t;let r=e.data.settings.macosRemindersEnabled??!0;l.value=r,s.value=r,d.value=e.data.macosReminders?.supported??!1,f.value=e.data.macosReminders?.forcedOffByEnv??!1,p.value=!0}async function x(){if(h.value||s.value===l.value)return;h.value=!0,g.value=``;let e=await hN(SP.config.settings,{macosRemindersEnabled:s.value});if(h.value=!1,!e.ok){g.value=e.error||n(`settingsModal.notificationsTab.saveError`),s.value=l.value;return}l.value=s.value,i(`saved`)}async function C(){if(h.value||a.value===o.value)return;h.value=!0,g.value=``;let e=await hN(SP.config.settings,{pushEnabled:a.value});if(h.value=!1,!e.ok){g.value=e.error||n(`settingsModal.notificationsTab.saveError`),a.value=o.value;return}o.value=a.value,i(`saved`)}return Ve(()=>r.reloadToken,()=>{y()},{immediate:!0}),(e,t)=>(B(),U(`div`,m7n,[S(`p`,h7n,T(q(n)(`settingsModal.notificationsTab.description`)),1),S(`div`,g7n,[u(S(`input`,{id:`settings-notifications-push-enabled`,"onUpdate:modelValue":t[0]||=e=>a.value=e,type:`checkbox`,class:`mt-1 h-4 w-4`,disabled:h.value,"data-testid":`settings-notifications-push-enabled-input`,onChange:C},null,40,_7n),[[ae,a.value]]),S(`label`,v7n,[S(`span`,y7n,T(q(n)(`settingsModal.notificationsTab.enableLabel`)),1),S(`span`,b7n,T(q(n)(`settingsModal.notificationsTab.enableHint`)),1)])]),S(`p`,x7n,T(q(n)(`settingsModal.notificationsTab.remoteHostNote`)),1),p.value?(B(),U(`div`,S7n,[S(`span`,{class:c(v.value),"data-testid":`settings-notifications-status`},T(_.value),3)])):b(``,!0),d.value?(B(),U(`div`,C7n,[u(S(`input`,{id:`settings-notifications-macos-reminders`,"onUpdate:modelValue":t[1]||=e=>s.value=e,type:`checkbox`,class:`mt-1 h-4 w-4`,disabled:h.value||f.value,"data-testid":`settings-notifications-macos-reminders-input`,onChange:x},null,40,w7n),[[ae,s.value]]),S(`label`,T7n,[S(`span`,E7n,T(q(n)(`settingsModal.notificationsTab.macosRemindersLabel`)),1),S(`span`,D7n,T(q(n)(`settingsModal.notificationsTab.macosRemindersHint`)),1),f.value?(B(),U(`span`,O7n,T(q(n)(`settingsModal.notificationsTab.macosRemindersForcedOff`)),1)):b(``,!0)])])):b(``,!0),g.value?(B(),U(`p`,k7n,T(g.value),1)):b(``,!0)]))}});o(),M(),we();var j7n={class:`space-y-3`,"data-testid":`settings-quit-tab`},M7n={class:`text-sm text-gray-700`},N7n={class:`text-xs text-gray-500`},P7n={key:0,class:`pt-1`},F7n=[`disabled`],I7n={key:1,class:`rounded border border-red-200 bg-red-50 p-3 space-y-2`,"data-testid":`settings-quit-confirm`},L7n={class:`text-sm text-red-900`},R7n={class:`flex gap-2`},z7n=[`disabled`],B7n=[`disabled`],V7n={key:2,class:`text-sm text-red-700`,role:`alert`,"data-testid":`settings-quit-error`},H7n=K({__name:`SettingsQuitTab`,emits:[`stopped`],setup(e,{emit:t}){let{t:n}=We(),r=t,i=V(!1),a=V(!1),o=V(``);async function s(){if(a.value)return;a.value=!0,o.value=``;let e=await mN(SP.shutdown,{});if(!e.ok){a.value=!1,i.value=!1,o.value=e.error||n(`settingsModal.quitTab.error`);return}r(`stopped`)}return(e,t)=>(B(),U(`div`,j7n,[S(`p`,M7n,T(q(n)(`settingsModal.quitTab.description`)),1),S(`p`,N7n,T(q(n)(`settingsModal.quitTab.restartHint`)),1),i.value?(B(),U(`div`,I7n,[S(`p`,L7n,T(q(n)(`settingsModal.quitTab.confirmBody`)),1),S(`div`,R7n,[S(`button`,{type:`button`,class:`rounded bg-red-700 px-3 py-1.5 text-sm font-medium text-white hover:bg-red-800 disabled:opacity-50`,disabled:a.value,"data-testid":`settings-quit-confirm-btn`,onClick:s},T(a.value?q(n)(`settingsModal.quitTab.stopping`):q(n)(`settingsModal.quitTab.confirmLabel`)),9,z7n),S(`button`,{type:`button`,class:`rounded border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100 disabled:opacity-50`,disabled:a.value,"data-testid":`settings-quit-cancel-btn`,onClick:t[1]||=e=>i.value=!1},T(q(n)(`common.cancel`)),9,B7n)])])):(B(),U(`div`,P7n,[S(`button`,{type:`button`,class:`rounded border border-red-300 bg-red-50 px-3 py-1.5 text-sm font-medium text-red-800 hover:bg-red-100 disabled:opacity-50`,disabled:a.value,"data-testid":`settings-quit-btn`,onClick:t[0]||=e=>i.value=!0},T(q(n)(`settingsModal.quitTab.quitLabel`)),9,F7n)])),o.value?(B(),U(`p`,V7n,T(o.value),1)):b(``,!0)]))}}),U7n=`person`,W7n=e=>typeof e==`string`&&e!==``,G7n=e=>{if(!Ma(e))return null;let{id:t,name:n,icon:r,prompt:i,availablePlugins:a,queries:o,model:s,excludedAlwaysActiveTools:c}=e;if(typeof t!=`string`||typeof n!=`string`||typeof r!=`string`||typeof i!=`string`||!Fa(a))return null;let l={id:t,name:n,icon:r,prompt:i,availablePlugins:a},u=W7n(s)?{...l,model:s}:l,d=Fa(c)?{...u,excludedAlwaysActiveTools:c}:u;return Fa(o)?{...d,queries:o}:d},K7n=e=>{if(!Ra(e))return null;let t=e.flatMap(e=>G7n(e)??[]);return t.length===e.length?t:null},q7n=e=>!Ma(e)||!Ma(e.data)?null:K7n(e.data.customRoles),J7n=e=>e.split(`
5906
5906
  `).map(e=>e.trim()).filter(Boolean),Y7n=e=>({id:e.id.trim(),name:e.name.trim(),icon:e.icon.trim()||`person`,prompt:e.prompt,availablePlugins:e.selectedPlugins,queries:J7n(e.queriesText),...e.model?{model:e.model}:{},...e.excludedAlwaysActiveTools.length>0?{excludedAlwaysActiveTools:e.excludedAlwaysActiveTools}:{}}),X7n=()=>({id:``,name:``,icon:U7n,prompt:``,selectedPlugins:[],queriesText:``,model:``,excludedAlwaysActiveTools:[]}),Z7n=e=>({id:e.id,name:e.name,icon:e.icon,prompt:e.prompt,selectedPlugins:[...e.availablePlugins],queriesText:(e.queries??[]).join(`