@neuralnomads/codenomad-dev 0.15.0-dev-20260511-efe3f505 → 0.15.0-dev-20260512-cf88dc06
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/filesystem/browser.js +21 -0
- package/dist/opencode-plugin/codenomad-opencode-plugin.tgz +0 -0
- package/dist/opencode-plugin.js +146 -0
- package/dist/opencode-plugin.test.js +28 -0
- package/dist/server/routes/filesystem.js +13 -0
- package/dist/server/routes/workspaces.js +2 -1
- package/dist/workspaces/__tests__/spawn.test.js +26 -8
- package/dist/workspaces/manager.js +8 -5
- package/dist/workspaces/spawn.js +35 -9
- package/package.json +3 -3
- package/public/assets/{ChangesTab-DGWzwppj.js → ChangesTab-WiAkKpjs.js} +2 -2
- package/public/assets/{DiffToolbar-dXDVyXwL.js → DiffToolbar-CszYc-5e.js} +1 -1
- package/public/assets/{FilesTab-IN-3vEym.js → FilesTab-DZa2lrGN.js} +2 -2
- package/public/assets/{GitChangesTab-yhDvCETZ.js → GitChangesTab-nr_mljFy.js} +2 -2
- package/public/assets/{SplitFilePanel-01YOnTOG.js → SplitFilePanel-BnKNINzw.js} +1 -1
- package/public/assets/{StatusTab-CI5m-66G.js → StatusTab-Bcw2TwXQ.js} +1 -1
- package/public/assets/{align-justify-DRTNZj9A.js → align-justify-CK6TIjhy.js} +1 -1
- package/public/assets/{bundle-full-D0o5M_wa.js → bundle-full-B0SERoqg.js} +1 -1
- package/public/assets/{diff-viewer-jXMkhi-L.js → diff-viewer-ES729gix.js} +1 -1
- package/public/assets/{index-Be11ZFEb.js → index-BIX31nDN.js} +1 -1
- package/public/assets/index-BcPnhqOk.js +1 -0
- package/public/assets/index-Bo2Zanex.js +2 -0
- package/public/assets/index-C2gIF7lT.css +1 -0
- package/public/assets/index-CQtJQxmF.js +1 -0
- package/public/assets/{index-Cb-FGBAx.js → index-CfI4uv3o.js} +1 -1
- package/public/assets/index-D9Iccxfo.js +1 -0
- package/public/assets/index-D9lYBPix.js +1 -0
- package/public/assets/index-Dir_tpmw.js +1 -0
- package/public/assets/index-HmgXZSSj.js +1 -0
- package/public/assets/{loading-BNcShOZ7.js → loading-W5eAwT4B.js} +1 -1
- package/public/assets/main-CuHfodsk.js +62 -0
- package/public/assets/{markdown-BO-eqU7M.js → markdown-BudrGEV0.js} +3 -3
- package/public/assets/{monaco-viewer-CUKSC3oL.js → monaco-viewer-B3iAKbO0.js} +1 -1
- package/public/assets/{tool-call-B2LR4TW4.js → tool-call-BsJm3dsD.js} +3 -3
- package/public/assets/{unified-picker-hHK-At_1.js → unified-picker-DBntm5nO.js} +1 -1
- package/public/assets/{wrap-text-y6UsswWF.js → wrap-text-DL9Owbno.js} +1 -1
- package/public/index.html +4 -4
- package/public/loading.html +4 -4
- package/public/sw.js +1 -1
- package/dist/opencode-config/README.md +0 -32
- package/dist/opencode-config/opencode.jsonc +0 -3
- package/dist/opencode-config/package-lock.json +0 -380
- package/dist/opencode-config/package.json +0 -9
- package/dist/opencode-config/plugin/codenomad.ts +0 -62
- package/dist/opencode-config/plugin/lib/background-process.ts +0 -265
- package/dist/opencode-config/plugin/lib/client.ts +0 -133
- package/dist/opencode-config/plugin/lib/request.ts +0 -214
- package/dist/opencode-config.js +0 -26
- package/public/assets/index-BBdin4zl.css +0 -1
- package/public/assets/index-CNG3sDWM.js +0 -1
- package/public/assets/index-CZr9LwXP.js +0 -1
- package/public/assets/index-CfmQyy0c.js +0 -1
- package/public/assets/index-CmWJRIhG.js +0 -1
- package/public/assets/index-Cpe_O_IY.js +0 -1
- package/public/assets/index-PvzRwXKl.js +0 -2
- package/public/assets/index-fZ-H5e-Q.js +0 -1
- package/public/assets/main-CkAUlWH0.js +0 -62
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/bundle-full-
|
|
2
|
-
var e1=Object.defineProperty;var Vr=a=>{throw TypeError(a)};var t1=(a,e,t)=>e in a?e1(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var j=(a,e,t)=>t1(a,typeof e!="symbol"?e+"":e,t),r1=(a,e,t)=>e.has(a)||Vr("Cannot "+t);var Xr=(a,e,t)=>e.has(a)?Vr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,t);var Fe=(a,e,t)=>(r1(a,e,"access private method"),t);import{t as a1,_ as n1}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/bundle-full-B0SERoqg.js","assets/index-Bo2Zanex.js","assets/git-diff-vendor-CSgooKT_.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css","assets/monaco-viewer-B3iAKbO0.js","assets/index-C2gIF7lT.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var e1=Object.defineProperty;var Vr=a=>{throw TypeError(a)};var t1=(a,e,t)=>e in a?e1(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var j=(a,e,t)=>t1(a,typeof e!="symbol"?e+"":e,t),r1=(a,e,t)=>e.has(a)||Vr("Cannot "+t);var Xr=(a,e,t)=>e.has(a)?Vr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,t);var Fe=(a,e,t)=>(r1(a,e,"access private method"),t);import{t as a1,_ as n1}from"./index-Bo2Zanex.js";import{k as i1}from"./monaco-viewer-B3iAKbO0.js";import{aq as at,ar as T0}from"./main-CuHfodsk.js";import"./git-diff-vendor-CSgooKT_.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";function cr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let ne=cr();function Ra(a){ne=a}const Ea=/[&<>"']/,s1=new RegExp(Ea.source,"g"),Ia=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,l1=new RegExp(Ia.source,"g"),o1={"&":"&","<":"<",">":">",'"':""","'":"'"},Yr=a=>o1[a];function v0(a,e){if(e){if(Ea.test(a))return a.replace(s1,Yr)}else if(Ia.test(a))return a.replace(l1,Yr);return a}const u1=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function h1(a){return a.replace(u1,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const c1=/(^|[^\[])\^/g;function X(a,e){let t=typeof a=="string"?a:a.source;e=e||"";const r={replace:(n,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(c1,"$1"),t=t.replace(n,l),r},getRegex:()=>new RegExp(t,e)};return r}function jr(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch{return null}return a}const ke={exec:()=>null};function Zr(a,e){const t=a.replace(/\|/g,(i,l,u)=>{let h=!1,d=l;for(;--d>=0&&u[d]==="\\";)h=!h;return h?"|":" |"}),r=t.split(/ \|/);let n=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(/\\\|/g,"|");return r}function Pe(a,e,t){const r=a.length;if(r===0)return"";let n=0;for(;n<r&&a.charAt(r-n-1)===e;)n++;return a.slice(0,r-n)}function m1(a,e){if(a.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<a.length;r++)if(a[r]==="\\")r++;else if(a[r]===e[0])t++;else if(a[r]===e[1]&&(t--,t<0))return r;return-1}function Kr(a,e,t,r){const n=e.href,i=e.title?v0(e.title):null,l=a[1].replace(/\\([\[\]])/g,"$1");if(a[0].charAt(0)!=="!"){r.state.inLink=!0;const u={type:"link",raw:t,href:n,title:i,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,u}return{type:"image",raw:t,href:n,title:i,text:v0(l)}}function d1(a,e){const t=a.match(/^(\s+)(?:```)/);if(t===null)return e;const r=t[1];return e.split(`
|
|
3
3
|
`).map(n=>{const i=n.match(/^\s+/);if(i===null)return n;const[l]=i;return l.length>=r.length?n.slice(r.length):n}).join(`
|
|
4
4
|
`)}class nt{constructor(e){j(this,"options");j(this,"rules");j(this,"lexer");this.options=e||ne}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const r=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Pe(r,`
|
|
5
5
|
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const r=t[0],n=d1(r,t[3]||"");return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(/#$/.test(r)){const n=Pe(r,"#");(this.options.pedantic||!n||/ $/.test(n))&&(r=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let r=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
|
@@ -301,7 +301,7 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
301
301
|
?)[ \r ]*`,hr="[̀-ͯ]",bs=new RegExp(hr+"+$"),ys="("+In+"+)|"+(gs+"|")+"([!-\\[\\]-‧-豈-]"+(hr+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(hr+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+vs)+("|"+ps+")");class Ta{constructor(e,t){this.input=e,this.settings=t,this.tokenRegex=new RegExp(ys,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new g0("EOF",new p0(this,t,t));var r=this.tokenRegex.exec(e);if(r===null||r.index!==t)throw new S("Unexpected character: '"+e[t]+"'",new g0(e[t],new p0(this,t,t+1)));var n=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[n]===14){var i=e.indexOf(`
|
|
302
302
|
`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new g0(n,new p0(this,t,this.tokenRegex.lastIndex))}}class xs{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new S("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,r){if(r===void 0&&(r=!1),r){for(var n=0;n<this.undefStack.length;n++)delete this.undefStack[n][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}}var ws=Sn;m("\\noexpand",function(a){var e=a.popToken();return a.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});m("\\expandafter",function(a){var e=a.popToken();return a.expandOnce(!0),{tokens:[e],numArgs:0}});m("\\@firstoftwo",function(a){var e=a.consumeArgs(2);return{tokens:e[0],numArgs:0}});m("\\@secondoftwo",function(a){var e=a.consumeArgs(2);return{tokens:e[1],numArgs:0}});m("\\@ifnextchar",function(a){var e=a.consumeArgs(3);a.consumeSpaces();var t=a.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});m("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");m("\\TextOrMath",function(a){var e=a.consumeArgs(2);return a.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var Aa={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};m("\\char",function(a){var e=a.popToken(),t,r=0;if(e.text==="'")t=8,e=a.popToken();else if(e.text==='"')t=16,e=a.popToken();else if(e.text==="`")if(e=a.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new S("\\char` missing argument");r=e.text.charCodeAt(0)}else t=10;if(t){if(r=Aa[e.text],r==null||r>=t)throw new S("Invalid base-"+t+" digit "+e.text);for(var n;(n=Aa[a.future().text])!=null&&n<t;)r*=t,r+=n,a.popToken()}return"\\@char{"+r+"}"});var Dr=(a,e,t,r)=>{var n=a.consumeArg().tokens;if(n.length!==1)throw new S("\\newcommand's first argument must be a macro name");var i=n[0].text,l=a.isDefined(i);if(l&&!e)throw new S("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!l&&!t)throw new S("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var u=0;if(n=a.consumeArg().tokens,n.length===1&&n[0].text==="["){for(var h="",d=a.expandNextToken();d.text!=="]"&&d.text!=="EOF";)h+=d.text,d=a.expandNextToken();if(!h.match(/^\s*[0-9]+\s*$/))throw new S("Invalid number of arguments: "+h);u=parseInt(h),n=a.consumeArg().tokens}return l&&r||a.macros.set(i,{tokens:n,numArgs:u}),""};m("\\newcommand",a=>Dr(a,!1,!0,!1));m("\\renewcommand",a=>Dr(a,!0,!1,!1));m("\\providecommand",a=>Dr(a,!0,!0,!0));m("\\message",a=>{var e=a.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""});m("\\errmessage",a=>{var e=a.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""});m("\\show",a=>{var e=a.popToken(),t=e.text;return console.log(e,a.macros.get(t),X0[t],K.math[t],K.text[t]),""});m("\\bgroup","{");m("\\egroup","}");m("~","\\nobreakspace");m("\\lq","`");m("\\rq","'");m("\\aa","\\r a");m("\\AA","\\r A");m("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");m("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");m("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");m("ℬ","\\mathscr{B}");m("ℰ","\\mathscr{E}");m("ℱ","\\mathscr{F}");m("ℋ","\\mathscr{H}");m("ℐ","\\mathscr{I}");m("ℒ","\\mathscr{L}");m("ℳ","\\mathscr{M}");m("ℛ","\\mathscr{R}");m("ℭ","\\mathfrak{C}");m("ℌ","\\mathfrak{H}");m("ℨ","\\mathfrak{Z}");m("\\Bbbk","\\Bbb{k}");m("\\llap","\\mathllap{\\textrm{#1}}");m("\\rlap","\\mathrlap{\\textrm{#1}}");m("\\clap","\\mathclap{\\textrm{#1}}");m("\\mathstrut","\\vphantom{(}");m("\\underbar","\\underline{\\text{#1}}");m("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');m("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");m("\\ne","\\neq");m("≠","\\neq");m("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");m("∉","\\notin");m("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");m("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");m("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");m("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");m("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");m("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");m("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");m("⟂","\\perp");m("‼","\\mathclose{!\\mkern-0.8mu!}");m("∌","\\notni");m("⌜","\\ulcorner");m("⌝","\\urcorner");m("⌞","\\llcorner");m("⌟","\\lrcorner");m("©","\\copyright");m("®","\\textregistered");m("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');m("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');m("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');m("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');m("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");m("⋮","\\vdots");m("\\varGamma","\\mathit{\\Gamma}");m("\\varDelta","\\mathit{\\Delta}");m("\\varTheta","\\mathit{\\Theta}");m("\\varLambda","\\mathit{\\Lambda}");m("\\varXi","\\mathit{\\Xi}");m("\\varPi","\\mathit{\\Pi}");m("\\varSigma","\\mathit{\\Sigma}");m("\\varUpsilon","\\mathit{\\Upsilon}");m("\\varPhi","\\mathit{\\Phi}");m("\\varPsi","\\mathit{\\Psi}");m("\\varOmega","\\mathit{\\Omega}");m("\\substack","\\begin{subarray}{c}#1\\end{subarray}");m("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");m("\\boxed","\\fbox{$\\displaystyle{#1}$}");m("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");m("\\implies","\\DOTSB\\;\\Longrightarrow\\;");m("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");m("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");m("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Ma={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},ks=new Set(["bin","rel"]);m("\\dots",function(a){var e="\\dotso",t=a.expandAfterFuture().text;return t in Ma?e=Ma[t]:(t.slice(0,4)==="\\not"||t in K.math&&ks.has(K.math[t].group))&&(e="\\dotsb"),e});var qr={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};m("\\dotso",function(a){var e=a.future().text;return e in qr?"\\ldots\\,":"\\ldots"});m("\\dotsc",function(a){var e=a.future().text;return e in qr&&e!==","?"\\ldots\\,":"\\ldots"});m("\\cdots",function(a){var e=a.future().text;return e in qr?"\\@cdots\\,":"\\@cdots"});m("\\dotsb","\\cdots");m("\\dotsm","\\cdots");m("\\dotsi","\\!\\cdots");m("\\dotsx","\\ldots\\,");m("\\DOTSI","\\relax");m("\\DOTSB","\\relax");m("\\DOTSX","\\relax");m("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");m("\\,","\\tmspace+{3mu}{.1667em}");m("\\thinspace","\\,");m("\\>","\\mskip{4mu}");m("\\:","\\tmspace+{4mu}{.2222em}");m("\\medspace","\\:");m("\\;","\\tmspace+{5mu}{.2777em}");m("\\thickspace","\\;");m("\\!","\\tmspace-{3mu}{.1667em}");m("\\negthinspace","\\!");m("\\negmedspace","\\tmspace-{4mu}{.2222em}");m("\\negthickspace","\\tmspace-{5mu}{.277em}");m("\\enspace","\\kern.5em ");m("\\enskip","\\hskip.5em\\relax");m("\\quad","\\hskip1em\\relax");m("\\qquad","\\hskip2em\\relax");m("\\tag","\\@ifstar\\tag@literal\\tag@paren");m("\\tag@paren","\\tag@literal{({#1})}");m("\\tag@literal",a=>{if(a.macros.get("\\df@tag"))throw new S("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});m("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");m("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");m("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");m("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");m("\\newline","\\\\\\relax");m("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Nn=M(C0["Main-Regular"][84][1]-.7*C0["Main-Regular"][65][1]);m("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Nn+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");m("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Nn+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");m("\\hspace","\\@ifstar\\@hspacer\\@hspace");m("\\@hspace","\\hskip #1\\relax");m("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");m("\\ordinarycolon",":");m("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");m("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');m("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');m("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');m("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');m("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');m("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');m("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');m("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');m("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');m("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');m("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');m("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');m("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');m("∷","\\dblcolon");m("∹","\\eqcolon");m("≔","\\coloneqq");m("≕","\\eqqcolon");m("⩴","\\Coloneqq");m("\\ratio","\\vcentcolon");m("\\coloncolon","\\dblcolon");m("\\colonequals","\\coloneqq");m("\\coloncolonequals","\\Coloneqq");m("\\equalscolon","\\eqqcolon");m("\\equalscoloncolon","\\Eqqcolon");m("\\colonminus","\\coloneq");m("\\coloncolonminus","\\Coloneq");m("\\minuscolon","\\eqcolon");m("\\minuscoloncolon","\\Eqcolon");m("\\coloncolonapprox","\\Colonapprox");m("\\coloncolonsim","\\Colonsim");m("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");m("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");m("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");m("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");m("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");m("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");m("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");m("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");m("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");m("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");m("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");m("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");m("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");m("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");m("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");m("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");m("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");m("\\nleqq","\\html@mathml{\\@nleqq}{≰}");m("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");m("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");m("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");m("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");m("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");m("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");m("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");m("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");m("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");m("\\imath","\\html@mathml{\\@imath}{ı}");m("\\jmath","\\html@mathml{\\@jmath}{ȷ}");m("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");m("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");m("⟦","\\llbracket");m("⟧","\\rrbracket");m("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");m("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");m("⦃","\\lBrace");m("⦄","\\rBrace");m("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");m("⦵","\\minuso");m("\\darr","\\downarrow");m("\\dArr","\\Downarrow");m("\\Darr","\\Downarrow");m("\\lang","\\langle");m("\\rang","\\rangle");m("\\uarr","\\uparrow");m("\\uArr","\\Uparrow");m("\\Uarr","\\Uparrow");m("\\N","\\mathbb{N}");m("\\R","\\mathbb{R}");m("\\Z","\\mathbb{Z}");m("\\alef","\\aleph");m("\\alefsym","\\aleph");m("\\Alpha","\\mathrm{A}");m("\\Beta","\\mathrm{B}");m("\\bull","\\bullet");m("\\Chi","\\mathrm{X}");m("\\clubs","\\clubsuit");m("\\cnums","\\mathbb{C}");m("\\Complex","\\mathbb{C}");m("\\Dagger","\\ddagger");m("\\diamonds","\\diamondsuit");m("\\empty","\\emptyset");m("\\Epsilon","\\mathrm{E}");m("\\Eta","\\mathrm{H}");m("\\exist","\\exists");m("\\harr","\\leftrightarrow");m("\\hArr","\\Leftrightarrow");m("\\Harr","\\Leftrightarrow");m("\\hearts","\\heartsuit");m("\\image","\\Im");m("\\infin","\\infty");m("\\Iota","\\mathrm{I}");m("\\isin","\\in");m("\\Kappa","\\mathrm{K}");m("\\larr","\\leftarrow");m("\\lArr","\\Leftarrow");m("\\Larr","\\Leftarrow");m("\\lrarr","\\leftrightarrow");m("\\lrArr","\\Leftrightarrow");m("\\Lrarr","\\Leftrightarrow");m("\\Mu","\\mathrm{M}");m("\\natnums","\\mathbb{N}");m("\\Nu","\\mathrm{N}");m("\\Omicron","\\mathrm{O}");m("\\plusmn","\\pm");m("\\rarr","\\rightarrow");m("\\rArr","\\Rightarrow");m("\\Rarr","\\Rightarrow");m("\\real","\\Re");m("\\reals","\\mathbb{R}");m("\\Reals","\\mathbb{R}");m("\\Rho","\\mathrm{P}");m("\\sdot","\\cdot");m("\\sect","\\S");m("\\spades","\\spadesuit");m("\\sub","\\subset");m("\\sube","\\subseteq");m("\\supe","\\supseteq");m("\\Tau","\\mathrm{T}");m("\\thetasym","\\vartheta");m("\\weierp","\\wp");m("\\Zeta","\\mathrm{Z}");m("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");m("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");m("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");m("\\bra","\\mathinner{\\langle{#1}|}");m("\\ket","\\mathinner{|{#1}\\rangle}");m("\\braket","\\mathinner{\\langle{#1}\\rangle}");m("\\Bra","\\left\\langle#1\\right|");m("\\Ket","\\left|#1\\right\\rangle");var Ln=a=>e=>{var t=e.consumeArg().tokens,r=e.consumeArg().tokens,n=e.consumeArg().tokens,i=e.consumeArg().tokens,l=e.macros.get("|"),u=e.macros.get("\\|");e.macros.beginGroup();var h=b=>y=>{a&&(y.macros.set("|",l),n.length&&y.macros.set("\\|",u));var x=b;if(!b&&n.length){var T=y.future();T.text==="|"&&(y.popToken(),x=!0)}return{tokens:x?n:r,numArgs:0}};e.macros.set("|",h(!1)),n.length&&e.macros.set("\\|",h(!0));var d=e.consumeArg().tokens,f=e.expandTokens([...i,...d,...t]);return e.macros.endGroup(),{tokens:f.reverse(),numArgs:0}};m("\\bra@ket",Ln(!1));m("\\bra@set",Ln(!0));m("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");m("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");m("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");m("\\angln","{\\angl n}");m("\\blue","\\textcolor{##6495ed}{#1}");m("\\orange","\\textcolor{##ffa500}{#1}");m("\\pink","\\textcolor{##ff00af}{#1}");m("\\red","\\textcolor{##df0030}{#1}");m("\\green","\\textcolor{##28ae7b}{#1}");m("\\gray","\\textcolor{gray}{#1}");m("\\purple","\\textcolor{##9d38bd}{#1}");m("\\blueA","\\textcolor{##ccfaff}{#1}");m("\\blueB","\\textcolor{##80f6ff}{#1}");m("\\blueC","\\textcolor{##63d9ea}{#1}");m("\\blueD","\\textcolor{##11accd}{#1}");m("\\blueE","\\textcolor{##0c7f99}{#1}");m("\\tealA","\\textcolor{##94fff5}{#1}");m("\\tealB","\\textcolor{##26edd5}{#1}");m("\\tealC","\\textcolor{##01d1c1}{#1}");m("\\tealD","\\textcolor{##01a995}{#1}");m("\\tealE","\\textcolor{##208170}{#1}");m("\\greenA","\\textcolor{##b6ffb0}{#1}");m("\\greenB","\\textcolor{##8af281}{#1}");m("\\greenC","\\textcolor{##74cf70}{#1}");m("\\greenD","\\textcolor{##1fab54}{#1}");m("\\greenE","\\textcolor{##0d923f}{#1}");m("\\goldA","\\textcolor{##ffd0a9}{#1}");m("\\goldB","\\textcolor{##ffbb71}{#1}");m("\\goldC","\\textcolor{##ff9c39}{#1}");m("\\goldD","\\textcolor{##e07d10}{#1}");m("\\goldE","\\textcolor{##a75a05}{#1}");m("\\redA","\\textcolor{##fca9a9}{#1}");m("\\redB","\\textcolor{##ff8482}{#1}");m("\\redC","\\textcolor{##f9685d}{#1}");m("\\redD","\\textcolor{##e84d39}{#1}");m("\\redE","\\textcolor{##bc2612}{#1}");m("\\maroonA","\\textcolor{##ffbde0}{#1}");m("\\maroonB","\\textcolor{##ff92c6}{#1}");m("\\maroonC","\\textcolor{##ed5fa6}{#1}");m("\\maroonD","\\textcolor{##ca337c}{#1}");m("\\maroonE","\\textcolor{##9e034e}{#1}");m("\\purpleA","\\textcolor{##ddd7ff}{#1}");m("\\purpleB","\\textcolor{##c6b9fc}{#1}");m("\\purpleC","\\textcolor{##aa87ff}{#1}");m("\\purpleD","\\textcolor{##7854ab}{#1}");m("\\purpleE","\\textcolor{##543b78}{#1}");m("\\mintA","\\textcolor{##f5f9e8}{#1}");m("\\mintB","\\textcolor{##edf2df}{#1}");m("\\mintC","\\textcolor{##e0e5cc}{#1}");m("\\grayA","\\textcolor{##f6f7f7}{#1}");m("\\grayB","\\textcolor{##f0f1f2}{#1}");m("\\grayC","\\textcolor{##e3e5e6}{#1}");m("\\grayD","\\textcolor{##d6d8da}{#1}");m("\\grayE","\\textcolor{##babec2}{#1}");m("\\grayF","\\textcolor{##888d93}{#1}");m("\\grayG","\\textcolor{##626569}{#1}");m("\\grayH","\\textcolor{##3b3e40}{#1}");m("\\grayI","\\textcolor{##21242c}{#1}");m("\\kaBlue","\\textcolor{##314453}{#1}");m("\\kaGreen","\\textcolor{##71B307}{#1}");var Hn={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Ss{constructor(e,t,r){this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new xs(ws,t.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new Ta(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,r,n;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:n,end:r}=this.consumeArg(["]"])}else({tokens:n,start:t,end:r}=this.consumeArg());return this.pushToken(new g0("EOF",r.loc)),this.pushTokens(n),new g0("",p0.range(t,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],r=e&&e.length>0;r||this.consumeSpaces();var n=this.future(),i,l=0,u=0;do{if(i=this.popToken(),t.push(i),i.text==="{")++l;else if(i.text==="}"){if(--l,l===-1)throw new S("Extra }",i)}else if(i.text==="EOF")throw new S("Unexpected end of input in a macro argument, expected '"+(e&&r?e[u]:"}")+"'",i);if(e&&r)if((l===0||l===1&&e[u]==="{")&&i.text===e[u]){if(++u,u===e.length){t.splice(-u,u);break}}else u=0}while(l!==0||r);return n.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:n,end:i}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new S("The length of delimiters doesn't match the number of args!");for(var r=t[0],n=0;n<r.length;n++){var i=this.popToken();if(r[n]!==i.text)throw new S("Use of the macro doesn't match its definition",i)}}for(var l=[],u=0;u<e;u++)l.push(this.consumeArg(t&&t[u+1]).tokens);return l}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new S("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),r=t.text,n=t.noexpand?null:this._getExpansion(r);if(n==null||e&&n.unexpandable){if(e&&n==null&&r[0]==="\\"&&!this.isDefined(r))throw new S("Undefined control sequence: "+r);return this.pushToken(t),!1}this.countExpansion(1);var i=n.tokens,l=this.consumeArgs(n.numArgs,n.delimiters);if(n.numArgs){i=i.slice();for(var u=i.length-1;u>=0;--u){var h=i[u];if(h.text==="#"){if(u===0)throw new S("Incomplete placeholder at end of macro body",h);if(h=i[--u],h.text==="#")i.splice(u+1,1);else if(/^[1-9]$/.test(h.text))i.splice(u,2,...l[+h.text-1]);else throw new S("Not a valid argument number",h)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new g0(e)]):void 0}expandTokens(e){var t=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var n=this.stack.pop();n.treatAsRelax&&(n.noexpand=!1,n.treatAsRelax=!1),t.push(n)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(r=>r.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var n=typeof t=="function"?t(this):t;if(typeof n=="string"){var i=0;if(n.includes("#"))for(var l=n.replace(/##/g,"");l.includes("#"+(i+1));)++i;for(var u=new Ta(n,this.settings),h=[],d=u.lex();d.text!=="EOF";)h.push(d),d=u.lex();h.reverse();var f={tokens:h,numArgs:i};return f}return n}isDefined(e){return this.macros.has(e)||X0.hasOwnProperty(e)||K.math.hasOwnProperty(e)||K.text.hasOwnProperty(e)||Hn.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:X0.hasOwnProperty(e)&&!X0[e].primitive}}var Ba=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Qe=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Xt={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Ca={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Mt{constructor(e,t){this.mode="math",this.gullet=new Ss(e,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new S("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new g0("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r}parseExpression(e,t){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var n=this.fetch();if(Mt.endOfExpression.has(n.text)||t&&n.text===t||e&&X0[n.text]&&X0[n.text].infix)break;var i=this.parseAtom(t);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var t=-1,r,n=0;n<e.length;n++){var i=e[n];if(i.type==="infix"){if(t!==-1)throw new S("only one infix operator per group",i.token);t=n,r=i.replaceWith}}if(t!==-1&&r){var l,u,h=e.slice(0,t),d=e.slice(t+1);h.length===1&&h[0].type==="ordgroup"?l=h[0]:l={type:"ordgroup",mode:this.mode,body:h},d.length===1&&d[0].type==="ordgroup"?u=d[0]:u={type:"ordgroup",mode:this.mode,body:d};var f;return r==="\\\\abovefrac"?f=this.callFunction(r,[l,e[t],u],[]):f=this.callFunction(r,[l,u],[]),[f]}else return e}handleSupSubscript(e){var t=this.fetch(),r=t.text;this.consume(),this.consumeSpaces();var n;do{var i;n=this.parseGroup(e)}while(((i=n)==null?void 0:i.type)==="internal");if(!n)throw new S("Expected group after '"+r+"'",t);return n}formatUnsupportedCmd(e){for(var t=[],r=0;r<e.length;r++)t.push({type:"textord",mode:"text",text:e[r]});var n={type:"text",mode:this.mode,body:t},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[n]};return i}parseAtom(e){var t=this.parseGroup("atom",e);if((t==null?void 0:t.type)==="internal"||this.mode==="text")return t;for(var r,n;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(t&&t.type==="op"){var l=i.text==="\\limits";t.limits=l,t.alwaysHandleSupSub=!0}else if(t&&t.type==="operatorname")t.alwaysHandleSupSub&&(t.limits=i.text==="\\limits");else throw new S("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new S("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(n)throw new S("Double subscript",i);n=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new S("Double superscript",i);var u={type:"textord",mode:this.mode,text:"\\prime"},h=[u];for(this.consume();this.fetch().text==="'";)h.push(u),this.consume();this.fetch().text==="^"&&h.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:h}}else if(Qe[i.text]){var d=Ba.test(i.text),f=[];for(f.push(new g0(Qe[i.text])),this.consume();;){var b=this.fetch().text;if(!Qe[b]||Ba.test(b)!==d)break;f.unshift(new g0(Qe[b])),this.consume()}var y=this.subparse(f);d?n={type:"ordgroup",mode:"math",body:y}:r={type:"ordgroup",mode:"math",body:y}}else break}return r||n?{type:"supsub",mode:this.mode,base:t,sup:r,sub:n}:t}parseFunction(e,t){var r=this.fetch(),n=r.text,i=X0[n];if(!i)return null;if(this.consume(),t&&t!=="atom"&&!i.allowedInArgument)throw new S("Got function '"+n+"' with no arguments"+(t?" as "+t:""),r);if(this.mode==="text"&&!i.allowedInText)throw new S("Can't use function '"+n+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new S("Can't use function '"+n+"' in math mode",r);var{args:l,optArgs:u}=this.parseArguments(n,i);return this.callFunction(n,l,u,r,e)}callFunction(e,t,r,n,i){var l={funcName:e,parser:this,token:n,breakOnTokenText:i},u=X0[e];if(u&&u.handler)return u.handler(l,t,r);throw new S("No function handler for "+e)}parseArguments(e,t){var r=t.numArgs+t.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var n=[],i=[],l=0;l<r;l++){var u=t.argTypes&&t.argTypes[l],h=l<t.numOptionalArgs;("primitive"in t&&t.primitive&&u==null||t.type==="sqrt"&&l===1&&i[0]==null)&&(u="primitive");var d=this.parseGroupOfType("argument to '"+e+"'",u,h);if(h)i.push(d);else if(d!=null)n.push(d);else throw new S("Null argument, please report this as a bug")}return{args:n,optArgs:i}}parseGroupOfType(e,t,r){switch(t){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,t);case"hbox":{var n=this.parseArgumentGroup(r,"text");return n!=null?{type:"styling",mode:n.mode,body:[n],style:"text"}:null}case"raw":{var i=this.parseStringGroup("raw",r);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(r)throw new S("A primitive argument cannot be optional");var l=this.parseGroup(e);if(l==null)throw new S("Expected group as "+e,this.fetch());return l}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new S("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,t){var r=this.gullet.scanArgument(t);if(r==null)return null;for(var n="",i;(i=this.fetch()).text!=="EOF";)n+=i.text,this.consume();return this.consume(),r.text=n,r}parseRegexGroup(e,t){for(var r=this.fetch(),n=r,i="",l;(l=this.fetch()).text!=="EOF"&&e.test(i+l.text);)n=l,i+=n.text,this.consume();if(i==="")throw new S("Invalid "+t+": '"+r.text+"'",r);return r.range(n,i)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(t==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!r)throw new S("Invalid color: '"+t.text+"'",t);var n=r[0];return/^[0-9a-f]{6}$/i.test(n)&&(n="#"+n),{type:"color-token",mode:this.mode,color:n}}parseSizeGroup(e){var t,r=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):t=this.parseStringGroup("size",e),!t)return null;!e&&t.text.length===0&&(t.text="0pt",r=!0);var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!n)throw new S("Invalid size: '"+t.text+"'",t);var i={number:+(n[1]+n[2]),unit:n[3]};if(!Wa(i))throw new S("Invalid unit: '"+i.unit+"'",t);return{type:"size",mode:this.mode,value:i,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),t==null)return null;var r=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,t){var r=this.gullet.scanArgument(e);if(r==null)return null;var n=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var l={type:"ordgroup",mode:this.mode,loc:r.loc,body:i};return t&&this.switchMode(n),l}parseGroup(e,t){var r=this.fetch(),n=r.text,i;if(n==="{"||n==="\\begingroup"){this.consume();var l=n==="{"?"}":"\\endgroup";this.gullet.beginGroup();var u=this.parseExpression(!1,l),h=this.fetch();this.expect(l),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:p0.range(r,h),body:u,semisimple:n==="\\begingroup"||void 0}}else if(i=this.parseFunction(t,e)||this.parseSymbol(),i==null&&n[0]==="\\"&&!Hn.hasOwnProperty(n)){if(this.settings.throwOnError)throw new S("Undefined control sequence: "+n,r);i=this.formatUnsupportedCmd(n),this.consume()}return i}formLigatures(e){for(var t=e.length-1,r=0;r<t;++r){var n=e[r];if(n.type==="textord"){var i=n.text,l=e[r+1];if(!(!l||l.type!=="textord")){if(i==="-"&&l.text==="-"){var u=e[r+2];r+1<t&&u&&u.type==="textord"&&u.text==="-"?(e.splice(r,3,{type:"textord",mode:"text",loc:p0.range(n,u),text:"---"}),t-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:p0.range(n,l),text:"--"}),t-=1)}(i==="'"||i==="`")&&l.text===i&&(e.splice(r,2,{type:"textord",mode:"text",loc:p0.range(n,l),text:i+i}),t-=1)}}}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var r=t.slice(5),n=r.charAt(0)==="*";if(n&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new S(`\\verb assertion failed --
|
|
303
303
|
please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:n}}Ca.hasOwnProperty(t[0])&&!K[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=Ca[t[0]]+t.slice(1));var i=bs.exec(t);i&&(t=t.substring(0,i.index),t==="i"?t="ı":t==="j"&&(t="ȷ"));var l;if(K[this.mode][t]){this.settings.strict&&this.mode==="math"&&tr.includes(t)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var u=K[this.mode][t].group,h=p0.range(e),d;if(yi.hasOwnProperty(u)){var f=u;d={type:"atom",mode:this.mode,family:f,loc:h,text:t}}else d={type:u,mode:this.mode,loc:h,text:t};l=d}else if(t.charCodeAt(0)>=128)this.settings.strict&&(Ua(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),l={type:"textord",mode:"text",loc:p0.range(e),text:t};else return null;if(this.consume(),i)for(var b=0;b<i[0].length;b++){var y=i[0][b];if(!Xt[y])throw new S("Unknown accent ' "+y+"'",e);var x=Xt[y][this.mode]||Xt[y].text;if(!x)throw new S("Accent "+y+" unsupported in "+this.mode+" mode",e);l={type:"accent",mode:this.mode,loc:p0.range(e),label:x,isStretchy:!1,isShifty:!0,base:l}}return l}}Mt.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Rr=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new Mt(e,t);delete r.gullet.macros.current["\\df@tag"];var n=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new S("\\tag works only in display equations");n=[{type:"tag",mode:"text",body:n,tag:r.subparse([new g0("\\df@tag")])}]}return n},$n=function(e,t,r){t.textContent="";var n=Er(e,r).toNode();t.appendChild(n)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),$n=function(){throw new S("KaTeX doesn't work in quirks mode.")});var zs=function(e,t){var r=Er(e,t).toMarkup();return r},Ts=function(e,t){var r=new yr(t);return Rr(e,r)},On=function(e,t,r){if(r.throwOnError||!(e instanceof S))throw e;var n=k(["katex-error"],[new b0(t)]);return n.setAttribute("title",e.toString()),n.setAttribute("style","color:"+r.errorColor),n},Er=function(e,t){var r=new yr(t);try{var n=Rr(e,r);return Ni(n,e,r)}catch(i){return On(i,e,r)}},As=function(e,t){var r=new yr(t);try{var n=Rr(e,r);return Li(n,e,r)}catch(i){return On(i,e,r)}},Ms="0.16.45",Bs={Span:ve,Anchor:pt,SymbolNode:b0,SvgNode:H0,PathNode:j0,LineNode:er},Cs={version:Ms,render:$n,renderToString:zs,ParseError:S,SETTINGS_SCHEMA:Qt,__parse:Ts,__renderToDomTree:Er,__renderToHTMLTree:As,__setFontMetrics:gi,__defineSymbol:s,__defineFunction:B,__defineMacro:m,__domTree:Bs};const Ds=/^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1(?=[\s?!\.,:?!。,:]|$)/,qs=/^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1/,Rs=/^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;function Es(a={}){return{extensions:[Is(a,Da(a,!1)),Ns(a,Da(a,!0))]}}function Da(a,e){return t=>Cs.renderToString(t.text,{...a,displayMode:t.displayMode})+(e?`
|
|
304
|
-
`:"")}function Is(a,e){const t=a&&a.nonStandard,r=t?qs:Ds;return{name:"inlineKatex",level:"inline",start(n){let i,l=n;for(;l;){if(i=l.indexOf("$"),i===-1)return;if((t?i>-1:i===0||l.charAt(i-1)===" ")&&l.substring(i).match(r))return i;l=l.substring(i+1).replace(/^\$+/,"")}},tokenizer(n,i){const l=n.match(r);if(l)return{type:"inlineKatex",raw:l[0],text:l[2].trim(),displayMode:l[1].length===2}},renderer:e}}function Ns(a,e){return{name:"blockKatex",level:"block",tokenizer(t,r){const n=t.match(Rs);if(n)return{type:"blockKatex",raw:n[0],text:n[2].trim(),displayMode:n[1].length===2}},renderer:e}}const Fn=i1("actions");let N0=null,te=null,mt="light",dt=!1,Te=!1,et=!1,qa=!1,Yt=null,Pn=null;const Ls=new Set(["a","blockquote","br","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","img","kbd","li","ol","p","pre","span","strong","sub","summary","sup","table","tbody","td","th","thead","tr","ul"]),Hs=new Set(["script","style","iframe","object","embed","meta","link"]);function $s(a,e,t){const r=t.trim();return r?e==="src"&&a==="img"?/^(https?:|data:image\/|\/|\.\/|\.\.\/|#)/i.test(r)?r:null:e==="href"&&a==="a"&&/^(https?:|mailto:|\/|\.\/|\.\.\/|#)/i.test(r)?r:null:null}function Os(a){const e=at(a);if(typeof document>"u")return T0(e);const t=document.createElement("template");t.innerHTML=e;const r=l=>{const u=l.tagName.toLowerCase();if(Hs.has(u)){l.remove();return}if(!Ls.has(u)){l.replaceWith(...Array.from(l.childNodes));return}for(const h of Array.from(l.attributes)){const d=h.name.toLowerCase();if(d.startsWith("on")||d==="style"){l.removeAttribute(h.name);continue}if(d==="href"||d==="src"){const f=$s(u,d,h.value);if(f){l.setAttribute(h.name,f);continue}l.removeAttribute(h.name);continue}d==="alt"||d==="title"||d==="width"||d==="height"||d==="open"||d==="id"||d==="class"||d==="name"||d.startsWith("aria-")||d.startsWith("data-")||l.removeAttribute(h.name)}u==="a"&&(l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer"))},n=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT),i=[];for(;n.nextNode();)i.push(n.currentNode);for(const l of i.reverse())r(l);return t.innerHTML}const Ae=new Set,jt=new Set,Me=[];let tt=!1;const rt=[];function Ks(a){return rt.push(a),()=>{const e=rt.indexOf(a);e>-1&&rt.splice(e,1)}}function Fs(){for(const a of rt)try{a()}catch(e){Fn.error("Error in language listener",e)}}async function Bt(){return N0||te||(te=(async()=>(await Gn()).createHighlighter({themes:["github-light","github-light-high-contrast","github-dark"],langs:[]}))().catch(a=>{throw te=null,a}),N0=await te,te=null,N0)}async function Gn(){return Yt||(Yt=n1(()=>import("./bundle-full-
|
|
304
|
+
`:"")}function Is(a,e){const t=a&&a.nonStandard,r=t?qs:Ds;return{name:"inlineKatex",level:"inline",start(n){let i,l=n;for(;l;){if(i=l.indexOf("$"),i===-1)return;if((t?i>-1:i===0||l.charAt(i-1)===" ")&&l.substring(i).match(r))return i;l=l.substring(i+1).replace(/^\$+/,"")}},tokenizer(n,i){const l=n.match(r);if(l)return{type:"inlineKatex",raw:l[0],text:l[2].trim(),displayMode:l[1].length===2}},renderer:e}}function Ns(a,e){return{name:"blockKatex",level:"block",tokenizer(t,r){const n=t.match(Rs);if(n)return{type:"blockKatex",raw:n[0],text:n[2].trim(),displayMode:n[1].length===2}},renderer:e}}const Fn=i1("actions");let N0=null,te=null,mt="light",dt=!1,Te=!1,et=!1,qa=!1,Yt=null,Pn=null;const Ls=new Set(["a","blockquote","br","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","img","kbd","li","ol","p","pre","span","strong","sub","summary","sup","table","tbody","td","th","thead","tr","ul"]),Hs=new Set(["script","style","iframe","object","embed","meta","link"]);function $s(a,e,t){const r=t.trim();return r?e==="src"&&a==="img"?/^(https?:|data:image\/|\/|\.\/|\.\.\/|#)/i.test(r)?r:null:e==="href"&&a==="a"&&/^(https?:|mailto:|\/|\.\/|\.\.\/|#)/i.test(r)?r:null:null}function Os(a){const e=at(a);if(typeof document>"u")return T0(e);const t=document.createElement("template");t.innerHTML=e;const r=l=>{const u=l.tagName.toLowerCase();if(Hs.has(u)){l.remove();return}if(!Ls.has(u)){l.replaceWith(...Array.from(l.childNodes));return}for(const h of Array.from(l.attributes)){const d=h.name.toLowerCase();if(d.startsWith("on")||d==="style"){l.removeAttribute(h.name);continue}if(d==="href"||d==="src"){const f=$s(u,d,h.value);if(f){l.setAttribute(h.name,f);continue}l.removeAttribute(h.name);continue}d==="alt"||d==="title"||d==="width"||d==="height"||d==="open"||d==="id"||d==="class"||d==="name"||d.startsWith("aria-")||d.startsWith("data-")||l.removeAttribute(h.name)}u==="a"&&(l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer"))},n=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT),i=[];for(;n.nextNode();)i.push(n.currentNode);for(const l of i.reverse())r(l);return t.innerHTML}const Ae=new Set,jt=new Set,Me=[];let tt=!1;const rt=[];function Ks(a){return rt.push(a),()=>{const e=rt.indexOf(a);e>-1&&rt.splice(e,1)}}function Fs(){for(const a of rt)try{a()}catch(e){Fn.error("Error in language listener",e)}}async function Bt(){return N0||te||(te=(async()=>(await Gn()).createHighlighter({themes:["github-light","github-light-high-contrast","github-dark"],langs:[]}))().catch(a=>{throw te=null,a}),N0=await te,te=null,N0)}async function Gn(){return Yt||(Yt=n1(()=>import("./bundle-full-B0SERoqg.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])).then(a=>(Pn=a.bundledLanguages,a))),Yt}function Un(){N0||te||Bt().catch(a=>{Fn.warn("Failed to initialize markdown highlighter",a)})}function Ir(a){return a.trim().toLowerCase()}function Nr(a){const e=Ir(a),t=Pn;if(!t)return{canonical:null,raw:e};if(e in t)return{canonical:e,raw:e};for(const[r,n]of Object.entries(t)){const i=n.aliases;if(i!=null&&i.includes(e))return{canonical:r,raw:e}}return{canonical:null,raw:e}}function Wn(a){const e=new Set;try{const t=O.lexer(a);O.walkTokens(t,r=>{if((r==null?void 0:r.type)!=="code")return;const n=typeof r.lang=="string"?r.lang:"";n.trim()&&e.add(n.trim())})}catch{return[]}return[...e]}function Qs(a){const e=Wn(a);for(const t of e){const r=Ir(t);if(!r||r==="text")continue;const{canonical:n,raw:i}=Nr(t),l=n||i;if(!(l==="text"||i==="text")&&(!N0||!Ae.has(l)))return!0}return!1}async function Ps(a){if(Te)return;const e=Wn(a);for(const t of e){const r=Ir(t);r&&r!=="text"&&(Ae.has(r)||jt.has(r)||(jt.add(r),Me.push(async()=>{try{await Gn();const{canonical:n,raw:i}=Nr(t),l=n||i;if(l==="text"||i==="text")return;await(await Bt()).loadLanguage(l),Ae.add(l),Ae.add(i),Fs()}catch{}finally{jt.delete(r)}})))}Me.length>0&&!tt&&Gs()}async function Gs(){if(!(tt||Me.length===0)){for(tt=!0;Me.length>0;){const a=Me.shift();a&&await a()}tt=!1}}function Vn(a){if(mt=a?"dark":"light",qa)return;O.setOptions({breaks:!0,gfm:!0}),O.use(Es({throwOnError:!1,nonStandard:!0,strict:"ignore"}));const e=new O.Renderer;e.code=(t,r)=>{const n=at(t),i=encodeURIComponent(n),l=r&&r.trim()?r.trim():"text",u=T0(l),h=T0(a1("markdown.copy")),d=`
|
|
305
305
|
<div class="code-block-header">
|
|
306
306
|
<span class="code-block-language">${u}</span>
|
|
307
307
|
<button class="code-block-copy" data-code="${i}">
|
|
@@ -12,7 +12,7 @@ ${a}
|
|
|
12
12
|
}`:yt(a,[`.${t}`],{extraProperties:e.extraProperties,propertyNameCache:r}).join(`
|
|
13
13
|
`)).join(`
|
|
14
14
|
`);return((i=e.cache)==null?void 0:i.create(e.name,o,e.componentId))||br(e.name,o,e.componentId)}function wr(e,t){"styleSheet"in e?e.styleSheet.cssText=t:(e.innerText="",e.appendChild(document.createTextNode(t)))}function Rs(e,t){for(const n in t){const r=t[n];r!==void 0&&(r===null?e.removeAttribute(n):e.setAttribute(n,r))}}function Ns(e,t){const n=document.createElement("style");return n.type="text/css",t&&Rs(n,t),wr(n,e),n}function Jt(e){let t=Number(e.getAttribute("data-uses"));t++,e.setAttribute("data-uses",t.toString())}const Tn="suid-injectFirst";function Us(e,t,n){Array.isArray(e)&&(e=e.join(`
|
|
15
|
-
`));const r=t==null?void 0:t.id,o=document.head||document.getElementsByTagName("head")[0],s=r&&document.getElementById(r);if(s&&s instanceof HTMLStyleElement)return wr(s,e),Jt(s),s;{s&&s.remove();const i=Ns(e,t);if(Jt(i),n){let a=o.querySelector(`#${Tn}`);a||(a=document.createElement("style"),a.setAttribute("id",Tn),o.prepend(a)),o.insertBefore(i,a)}else o.appendChild(i);return i}}function Bs(e,t="css-"){if(typeof e=="string")return document.getElementById(e);const n=[...e.classList].find(r=>r.startsWith(t));if(n)return document.getElementById(n.slice(t.length))}function Mn(e,t=!0){let n=Number(e.getAttribute("data-uses"));n--,n<=0?t?e.remove():e.setAttribute("data-uses","0"):e.setAttribute("data-uses",n.toString())}function Wc(e){if(typeof e!="string")throw new Error("MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}function zc(e,t=166){let n;function r(...o){const s=()=>{e.apply(null,o)};clearTimeout(n),n=setTimeout(s,t)}return r.clear=()=>{clearTimeout(n)},r}function Kc(e){const t=e.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}function _s(e){return e&&e.ownerDocument||document}function Hc(e){return _s(e).defaultView||window}function Cr(){return Math.random().toString(36).substring(2,15).slice(0,8)}let Mt=!0,qt=!1,En;const js={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function Vs(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&js[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function Ws(e){e.metaKey||e.altKey||e.ctrlKey||(Mt=!0)}function Nt(){Mt=!1}function zs(){this.visibilityState==="hidden"&&qt&&(Mt=!0)}function Ks(e){e.addEventListener("keydown",Ws,!0),e.addEventListener("mousedown",Nt,!0),e.addEventListener("pointerdown",Nt,!0),e.addEventListener("touchstart",Nt,!0),e.addEventListener("visibilitychange",zs,!0)}function Hs(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return Mt||Vs(t)}function Gc(){const e=s=>{s!=null&&Ks(s.ownerDocument)},[t,n]=M(!1);function r(){return t()?(qt=!0,window.clearTimeout(En),En=window.setTimeout(()=>{qt=!1},100),n(!1),!0):!1}function o(s){return Hs(s)?(n(!0),!0):!1}return{isFocusVisibleRef:{get current(){return t()}},onFocus:o,onBlur:r,ref:e}}const Gs=new Ds;function Js(e){return e?Array.isArray(e)?e.flat(1/0).filter(t=>!!t):[e]:[]}function qs(){if(!I.context)return Cr();const e=so().replaceAll("-",""),t=9,n=Math.ceil(e.length/t),r=[];for(let o=1;o<=n;++o){const s=(o-1)*t,i=Number(e.slice(s,s+t));r.push(i.toString(32))}return r.join("-")}function Sr(e){const t=Ye(Ho),[n,r]=M(""),o=qs();let s,i=!1;return ce(a=>{var u;const c=e();let l;if(c){const d=Es(Js(c));i="@global"in d,l=Fs({name:"css",props:d,cache:Gs,componentId:o}),s=Bs(l.id),s?Jt(s):s=Us(l.rules,{id:l.id,nonce:(u=t.cache)==null?void 0:u.nonce},t.injectFirst),a!=null&&a.styleElement&&Mn(a.styleElement)}return typeof(l==null?void 0:l.className)=="string"?r(l.className):r(""),{className:l==null?void 0:l.className,styleElement:s}},void 0),le(()=>{s&&Mn(s,t.cleanupStyles??i)}),n}function $e(e,t,n={}){for(const r in e){const o=e[r];if(pr(r))n[r]=$e(o,t);else if(Gt(r))n[r]=$e(o,t);else if(yr(r)){n[r]={};for(const s in o)n[r][s]=$e(o[s],t)}else if(mr(r))n[r]=$e(o,t);else{const s=t(r,o);if(s)for(const i in s)n[i]=Gt(i)?{...n[i],...s[i]}:s[i];else n[r]=o}}return n}const Xs=new Set(["animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","fontWeight","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","WebkitLineClamp","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);function xr(e,t){if(typeof t=="number")return{[e]:Xs.has(e)?t.toString():`${t}px`}}function Pn(e,t={}){return $e(e,xr,t)}function bt(e,t,n){if(typeof n!="string")return n;const r=n.split(".");let o=e[t];for(let s=0;s<r.length&&(o=o==null?void 0:o[r[s]],!!o);s++);return o??n}function Ys(e,t){return t.split(".").reduce((n,r)=>n&&n[r]?n[r]:null,e)}function Zs(e,t,n,r){const o=Ys(e,t)||n;return typeof o=="number"?s=>typeof s=="string"?s:o*s:Array.isArray(o)?s=>typeof s=="string"?s:o[s]:typeof o=="function"?o:()=>{}}const ie={x:["Left","Right"],y:["Top","Bottom"]};function Or(e){return typeof e=="number"?`${e}px`:e}function vr(e,t){return(n,r)=>t(e,n,r)}function f(e,t){return t?(n,r)=>({[e]:t(e,n,r)}):n=>({[e]:n})}function ze(e){return f(e,(t,n)=>Or(n))}function z(e,t,n){const r=t.map(o=>`${e}${o}`);return n?(o,s)=>r.reduce((i,a)=>(i[a]=n(a,o,s),i),{}):o=>r.reduce((s,i)=>(s[i]=o,s),{})}function Qs(){return{...ei(),...ti(),...ni(),...ri(),...oi(),...si(),...ii(),...ci(),...ai()}}function ei(){return{displayPrint:vr("displayPrint",(e,t)=>({"@media print":{display:t}})),displayRaw:f("display"),overflow:f("overflow"),textOverflow:f("textOverflow"),visibility:f("visibility"),whiteSpace:f("whiteSpace")}}function ti(){return{flexBasis:f("flexBasis"),flexDirection:f("flexDirection"),flexWrap:f("flexWrap"),justifyContent:f("justifyContent"),alignItems:f("alignItems"),alignContent:f("alignContent"),order:f("order"),flex:f("flex"),flexGrow:f("flexGrow"),flexShrink:f("flexShrink"),alignSelf:f("alignSelf"),justifyItems:f("justifyItems"),justifySelf:f("justifySelf")}}function ni(){const e=(t,n,r)=>Zs(r,"spacing",8)(n);return{gap:f("gap",e),columnGap:f("columnGap",e),rowGap:f("rowGap",e),gridColumn:f("gridColumn"),gridRow:f("gridRow"),gridAutoFlow:f("gridAutoFlow"),gridAutoColumns:f("gridAutoColumns"),gridAutoRows:f("gridAutoRows"),gridTemplateColumns:f("gridTemplateColumns"),gridTemplateRows:f("gridTemplateRows"),gridTemplateAreas:f("gridTemplateAreas"),gridArea:f("gridArea")}}function ri(){return{position:f("position"),zIndex:f("zIndex",(e,t,n)=>{var r;return((r=n.zIndex)==null?void 0:r[e])??t}),top:ze("top"),right:ze("right"),bottom:ze("bottom"),left:ze("left")}}function oi(){const e=(t,n,r)=>bt(r,"palette",n);return{color:f("color",e),bgcolor:f("backgroundColor",e),backgroundColor:f("backgroundColor",e)}}function si(){const e=(t,n,r)=>(t==="maxWidth"&&(n=r.breakpoints.values[t]??n),typeof n=="number"&&(n=n>0&&n<=1?`${n*100}%`:`${n}px`),n);return{width:f("width",e),maxWidth:f("maxWidth",e),minWidth:f("minWidth",e),height:f("height",e),maxHeight:f("maxHeight",e),minHeight:f("minHeight",e),boxSizing:f("boxSizing",e)}}function ii(){const e=(n,r)=>typeof r=="number"?`${r}px solid`:r,t=(n,r,o)=>bt(o,"palette",r);return{border:f("border",e),borderTop:f("borderTop",e),borderRight:f("borderRight",e),borderBottom:f("borderBottom",e),borderLeft:f("borderLeft",e),borderColor:f("borderColor",t),borderTopColor:f("borderTopColor",t),borderRightColor:f("borderRightColor",t),borderBottomColor:f("borderBottomColor",t),borderLeftColor:f("borderLeftColor",t),borderRadius:f("borderRadius",(n,r,o)=>typeof r=="number"?`${o.shape.borderRadius*r}px`:r)}}function ai(){const e=(t,n,r)=>bt(r,"typography",n);return{typography:vr("typography",(t,n,r)=>bt(r,"typography",n)),fontFamily:f("fontFamily",e),fontSize:f("fontSize",(t,n,r)=>Or(e(t,n,r))),fontStyle:f("fontStyle",e),fontWeight:f("fontWeight",e),letterSpacing:ze("letterSpacing"),lineHeight:f("lineHeight"),textAlign:f("textAlign"),textTransform:f("textTransform")}}function ci(){const e=(r,o,s)=>s.spacing(o),t="margin",n="padding";return{m:f(t,e),mt:f("marginTop",e),mr:f("marginRight",e),mb:f("marginBottom",e),ml:f("marginLeft",e),mx:z(t,ie.x,e),my:z(t,ie.y,e),margin:f(t,e),marginTop:f("marginTop",e),marginRight:f("marginRight",e),marginBottom:f("marginBottom",e),marginLeft:f("marginLeft",e),marginX:z(t,ie.x,e),marginY:z(t,ie.y,e),marginInline:z(t,["Inline","InlineStart"],e),marginInlineStart:f("marginInlineStart",e),marginInlineEnd:f("marginInlineEnd",e),marginBlock:z(t,["BlockStart","BlockEnd"],e),marginBlockStart:f("marginBlockStart",e),marginBlockEnd:f("marginBlockEnd",e),p:f(n,e),pt:f("paddingTop",e),pr:f("paddingRight",e),pb:f("paddingBottom",e),pl:f("paddingLeft",e),px:z(n,ie.x,e),py:z(n,ie.y,e),padding:f(n,e),paddingTop:f("paddingTop",e),paddingRight:f("paddingRight",e),paddingBottom:f("paddingBottom",e),paddingLeft:f("paddingLeft",e),paddingX:z(n,ie.x,e),paddingY:z(n,ie.y,e),paddingInline:z(n,["Inline","InlineStart"],e),paddingInlineStart:f("paddingInlineStart",e),paddingInlineEnd:f("paddingInlineEnd",e),paddingBlock:z(n,["BlockStart","BlockEnd"],e),paddingBlockStart:f("paddingBlockStart",e),paddingBlockEnd:f("paddingBlockEnd",e)}}const dn=Qs(),Jc=Object.keys(dn);function li(e,t,n){return dn[e](t,n)}function In(e,t,n){return e in dn?li(e,t,n):xr(e,t)}function ui(e,t){return $e(e,(n,r)=>{if(typeof r=="function"&&(r=r(t)),r==null)return r;if(typeof r=="object"){const o={};for(const s of t.breakpoints.keys)o[t.breakpoints.up(s)]={};return Object.assign(o,zo({theme:t},r,s=>In(n,s,t)??{[n]:s}))}else return In(n,r,t)})}function kr(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=kr(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function di(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=kr(e))&&(r&&(r+=" "),r+=t);return r}const $r=["ownerState","theme","sx","as"];function fi(e,t){var n,r;return(r=(n=t.components)==null?void 0:n[e])==null?void 0:r.styleOverrides}function gi(e,t,n,r,o={}){return L(()=>{const s=e(),i=fi(o.name,s),a=r.ownerState,c=n.reduce((u,d)=>{let g;return typeof d=="function"?g=d({ownerState:a,theme:s,get sx(){return r.sx},get as(){return r.as},props:r}):d&&(g=d),g&&u.push(Pn(g,{name:t,__resolved:!0})),u},[]);let l=[];return o.overridesResolver&&typeof o.overridesResolver=="function"&&i&&(l=o.overridesResolver(r,i).map(u=>u?Pn(u,{}):null).filter(Boolean)),c.concat(l)})}function Ar(e,t){e.__suid=t}function Ln(e){if(typeof e=="function")return e.__suid}function hi(e){return function(n,r={}){let o,s;if(r.name){const a=r.slot||"Root";s=o=`${r.name}-${a.slice(0,1).toLowerCase()+a.slice(1)}`}else s=`styled-${Cr()}`,o="css";const i=Ln(n);return function(...a){function c(l){let u;const d=()=>{const D=l.theme;return D||u||(u=e&&e.onUseTheme?e.onUseTheme():un())},[,g]=kt(l,r.skipProps||$r),m=gi(d,o,a,l,r),p=()=>{const D=l.sx;return D?Array.isArray(D)?D:[D]:[]},C=()=>{if(i)return n;const D=l.as;return D||n},b=i?()=>i:L(()=>Ln(C())),P=r.skipSx?()=>m():()=>{const D=d();return[...m(),...p().map(J=>J.__resolved?J:ui(J,D))]},R=Sr(()=>b()?void 0:P());return gr(C,Gn(g,{get children(){return l.children},get component(){return b()?l.component:null},get as(){return i?l.as:void 0},get sx(){return b()?P():void 0},get ownerState(){return b()==="system"?l.ownerState:void 0},get class(){return di([...new Set([l.class,s,R()])])}}))}return Ar(c,"system"),s&&(c.toString=()=>`.${s}`),c}}}const qc=[...$r,"classes"],Xc=hi({onUseTheme:()=>fr()}),mi="codenomad.client-id",pi="codenomad.connection-id";let it=null,at=null;function Xt(){return{clientId:yi(),connectionId:bi()}}function yi(){return it||(it=Tr(mi,window.localStorage),it)}function bi(){return at||(at=Tr(pi,window.sessionStorage),at)}function Tr(e,t){if(typeof window>"u")return Ut();try{const r=t.getItem(e);if(r&&r.trim())return r.trim()}catch{return Ut()}const n=Ut();try{t.setItem(e,n)}catch{}return n}function Ut(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var Yt={exports:{}},Bt,Dn;function wi(){if(Dn)return Bt;Dn=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,s=r*365.25;Bt=function(u,d){d=d||{};var g=typeof u;if(g==="string"&&u.length>0)return i(u);if(g==="number"&&isFinite(u))return d.long?c(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var g=parseFloat(d[1]),m=(d[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return g*s;case"weeks":case"week":case"w":return g*o;case"days":case"day":case"d":return g*r;case"hours":case"hour":case"hrs":case"hr":case"h":return g*n;case"minutes":case"minute":case"mins":case"min":case"m":return g*t;case"seconds":case"second":case"secs":case"sec":case"s":return g*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}function a(u){var d=Math.abs(u);return d>=r?Math.round(u/r)+"d":d>=n?Math.round(u/n)+"h":d>=t?Math.round(u/t)+"m":d>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var d=Math.abs(u);return d>=r?l(u,d,r,"day"):d>=n?l(u,d,n,"hour"):d>=t?l(u,d,t,"minute"):d>=e?l(u,d,e,"second"):u+" ms"}function l(u,d,g,m){var p=d>=g*1.5;return Math.round(u/g)+" "+m+(p?"s":"")}return Bt}function Ci(e){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=wi(),n.destroy=l,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let d=0;for(let g=0;g<u.length;g++)d=(d<<5)-d+u.charCodeAt(g),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(u){let d,g=null,m,p;function C(...b){if(!C.enabled)return;const P=C,R=Number(new Date),D=R-(d||R);P.diff=D,P.prev=d,P.curr=R,d=R,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let J=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(_,h)=>{if(_==="%%")return"%";J++;const w=n.formatters[h];if(typeof w=="function"){const v=b[J];_=w.call(P,v),b.splice(J,1),J--}return _}),n.formatArgs.call(P,b),(P.log||n.log).apply(P,b)}return C.namespace=u,C.useColors=n.useColors(),C.color=n.selectColor(u),C.extend=r,C.destroy=n.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(m!==n.namespaces&&(m=n.namespaces,p=n.enabled(u)),p),set:b=>{g=b}}),typeof n.init=="function"&&n.init(C),C}function r(u,d){const g=n(this.namespace+(typeof d>"u"?":":d)+u);return g.log=this.log,g}function o(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];const d=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const g of d)g[0]==="-"?n.skips.push(g.slice(1)):n.names.push(g)}function s(u,d){let g=0,m=0,p=-1,C=0;for(;g<u.length;)if(m<d.length&&(d[m]===u[g]||d[m]==="*"))d[m]==="*"?(p=m,C=g,m++):(g++,m++);else if(p!==-1)m=p+1,C++,g=C;else return!1;for(;m<d.length&&d[m]==="*";)m++;return m===d.length}function i(){const u=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),u}function a(u){for(const d of n.skips)if(s(u,d))return!1;for(const d of n.names)if(s(u,d))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var Si=Ci;(function(e,t){var n={};t.formatArgs=o,t.save=s,t.load=i,t.useColors=r,t.storage=a(),t.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let l;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;l.splice(1,0,u,"color: inherit");let d=0,g=0;l[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(d++,m==="%c"&&(g=d))}),l.splice(g,0,u)}t.log=console.debug||console.log||(()=>{});function s(l){try{l?t.storage.setItem("debug",l):t.storage.removeItem("debug")}catch{}}function i(){let l;try{l=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=n.DEBUG),l}function a(){try{return localStorage}catch{}}e.exports=Si(t);const{formatters:c}=e.exports;c.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(Yt,Yt.exports);var xi=Yt.exports;const Zt=co(xi),Ue=["sse","api","session","actions"],Mr="opencode:logger:namespaces",_t=new Map,Q=new Set,te=typeof globalThis<"u"?globalThis.console:void 0;function Qe(){Q.size===0?Zt.disable():Zt.enable(Array.from(Q).join(","))}function Et(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{window.localStorage.setItem(Mr,JSON.stringify(Array.from(Q)))}catch(t){(e=te==null?void 0:te.warn)==null||e.call(te,"Failed to persist logger namespaces",t)}}function Oi(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{const t=window.localStorage.getItem(Mr);if(!t)return;const n=JSON.parse(t);if(!Array.isArray(n))return;for(const r of n)Ue.includes(r)&&Q.add(r)}catch(t){(e=te==null?void 0:te.warn)==null||e.call(te,"Failed to hydrate logger namespaces",t)}}Oi();Qe();function vi(e){const n=Zt(e),r=(o,s)=>{n(o,...s)};return{log:(...o)=>n(...o),info:(...o)=>n(...o),warn:(...o)=>r("[warn]",o),error:(...o)=>r("[error]",o)}}function Ce(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);return _t.has(e)||_t.set(e,vi(e)),_t.get(e)}function ki(){return Ue.map(e=>({name:e,enabled:Q.has(e)}))}function $i(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);Q.has(e)||(Q.add(e),Et(),Qe())}function Ai(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);Q.has(e)&&(Q.delete(e),Et(),Qe())}function Ti(){Q.clear(),Et(),Qe()}function Mi(){Ue.forEach(e=>Q.add(e)),Et(),Qe()}const Ei={listLoggerNamespaces:ki,enableLogger:$i,disableLogger:Ai,enableAllLoggers:Mi,disableAllLoggers:Ti};function Pi(){typeof window>"u"||(window.codenomadLogger=Ei)}Pi();function Ii(e,t){let n=!1;e.onmessage=o=>{try{const s=JSON.parse(o.data);t.onEvent(s)}catch(s){t.logger.error("Failed to parse event",s)}};const r=o=>{var s;n||(n=!0,t.logger.warn(o),(s=t.onError)==null||s.call(t))};e.onerror=()=>{r("EventSource error, closing stream")},e.onclose=()=>{r("EventSource closed")},e.addEventListener("close",()=>{r("EventSource closed")}),e.addEventListener("codenomad.client.ping",o=>{var s;try{const i=o.data?JSON.parse(o.data):{};(s=t.onPing)==null||s.call(t,i)}catch(i){t.logger.error("Failed to parse ping event",i)}})}var Kn;const Li=typeof window<"u"?(Kn=window.location)==null?void 0:Kn.origin:void 0,Di=typeof window<"u"?window.__CODENOMAD_API_BASE__??Li:void 0,Fi=typeof window<"u"?window.__CODENOMAD_EVENTS_URL__??"/api/events":"/api/events",de=Di,jt=Ri(de,Fi),Yc=de;function Zc(e,t){const n=encodeURIComponent(e),r=encodeURIComponent(t);return Ni(`/workspaces/${n}/plugin/background-processes/${r}/stream`)}function Ri(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(e){const n=t.startsWith("/")?t:`/${t}`;return`${e}${n}`}return t}function Ni(e){if(e.startsWith("http://")||e.startsWith("https://")||!de)return e;const t=e.startsWith("/")?e:`/${e}`;return`${de}${t}`}const Fn=Ce("api"),Rn=Ce("sse");function Er(e){const t={};if(!e)return t;if(e instanceof Headers)return e.forEach((n,r)=>{t[r]=n}),t;if(Array.isArray(e)){for(const[n,r]of e)t[n]=r;return t}return{...e}}function me(e,t){if(t){Fn.info(e,t);return}Fn.info(e)}async function Pr(e){const t=await e.text();if(!t)return`Request failed with ${e.status}`;try{const n=JSON.parse(t);if(typeof(n==null?void 0:n.error)=="string"&&n.error.trim())return n.error;if(typeof(n==null?void 0:n.message)=="string"&&n.message.trim())return n.message}catch{}return t}async function y(e,t){const n=de?new URL(e,de).toString():e,r=Er(t==null?void 0:t.headers);(t==null?void 0:t.body)!==void 0&&(r["Content-Type"]="application/json");const o=((t==null?void 0:t.method)??"GET").toUpperCase(),s=Date.now();me(`${o} ${e}`);try{const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const c=await Pr(i);throw me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:c}),new Error(c||`Request failed with ${i.status}`)}const a=Date.now()-s;return me(`${o} ${e} -> ${i.status}`,{durationMs:a}),i.status===204?void 0:await i.json()}catch(i){throw me(`${o} ${e} failed`,{durationMs:Date.now()-s,error:i}),i}}async function Ui(e,t){const n=de?new URL(e,de).toString():e,r=Er(t==null?void 0:t.headers);(t==null?void 0:t.body)!==void 0&&!r["Content-Type"]&&(r["Content-Type"]="application/json");const o=((t==null?void 0:t.method)??"GET").toUpperCase(),s=Date.now();me(`${o} ${e}`);const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const a=await Pr(i);throw me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:a}),new Error(a||`Request failed with ${i.status}`)}return me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s}),i}const ee={fetchWorkspaces(){return y("/api/workspaces")},fetchWorktrees(e){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees`)},createWorktree(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees`,{method:"POST",body:JSON.stringify(t)})},deleteWorktree(e,t,n){const r=new URLSearchParams;n!=null&&n.force&&r.set("force","true");const o=r.toString()?`?${r.toString()}`:"";return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}${o}`,{method:"DELETE"})},readWorktreeMap(e){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`)},writeWorktreeMap(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`,{method:"PUT",body:JSON.stringify(t)})},createWorkspace(e){return y("/api/workspaces",{method:"POST",body:JSON.stringify(e)})},fetchSidecars(){return y("/api/sidecars")},createSidecar(e){return y("/api/sidecars",{method:"POST",body:JSON.stringify(e)})},updateSidecar(e,t){return y(`/api/sidecars/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteSidecar(e){return y(`/api/sidecars/${encodeURIComponent(e)}`,{method:"DELETE"})},createPreview(e){return y("/api/previews",{method:"POST",body:JSON.stringify(e)})},deletePreview(e){return y(`/api/previews/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchServerMeta(){return y("/api/meta")},probeRemoteServer(e){return y("/api/remote-servers/probe",{method:"POST",body:JSON.stringify(e)})},createRemoteProxySession(e){return y("/api/remote-proxy/sessions",{method:"POST",body:JSON.stringify(e)})},deleteRemoteProxySession(e){return y(`/api/remote-proxy/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchAuthStatus(){return y("/api/auth/status")},setServerPassword(e){return y("/api/auth/password",{method:"POST",body:JSON.stringify({password:e})})},deleteWorkspace(e){return y(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})},cloneWorkspaceRepository(e){return y("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})},listWorkspaceFiles(e,t="."){const n=new URLSearchParams({path:t});return y(`/api/workspaces/${encodeURIComponent(e)}/files?${n.toString()}`)},searchWorkspaceFiles(e,t,n){const r=t.trim();if(!r)return Promise.resolve([]);const o=new URLSearchParams({q:r});return n!=null&&n.limit&&o.set("limit",String(n.limit)),n!=null&&n.type&&o.set("type",n.type),y(`/api/workspaces/${encodeURIComponent(e)}/files/search?${o.toString()}`)},readWorkspaceFile(e,t){const n=new URLSearchParams({path:t});return y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${n.toString()}`)},writeWorkspaceFile(e,t,n){const r=new URLSearchParams({path:t});return y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${r.toString()}`,{method:"PUT",body:JSON.stringify({contents:n})})},fetchWorktreeGitStatus(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-status`)},fetchWorktreeGitDiff(e,t,n){const r=new URLSearchParams({path:n.path,scope:n.scope});return n.originalPath&&r.set("originalPath",n.originalPath),y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-diff?${r.toString()}`)},stageWorktreeGitPaths(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-stage`,{method:"POST",body:JSON.stringify(n)})},unstageWorktreeGitPaths(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-unstage`,{method:"POST",body:JSON.stringify(n)})},commitWorktreeGitChanges(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-commit`,{method:"POST",body:JSON.stringify(n)})},fetchConfigOwner(e){return y(`/api/storage/config/${encodeURIComponent(e)}`)},patchConfigOwner(e,t){return y(`/api/storage/config/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},fetchStateOwner(e){return y(`/api/storage/state/${encodeURIComponent(e)}`)},patchStateOwner(e,t){return y(`/api/storage/state/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},validateBinary(e){return y("/api/storage/binaries/validate",{method:"POST",body:JSON.stringify({path:e})})},fetchSpeechCapabilities(){return y("/api/speech/capabilities")},transcribeAudio(e){return y("/api/speech/transcribe",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeech(e){return y("/api/speech/synthesize",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeechStream(e,t){return Ui("/api/speech/synthesize/stream",{method:"POST",body:JSON.stringify(e),signal:t})},listFileSystem(e,t){const n=new URLSearchParams;e&&e!=="."&&n.set("path",e),(t==null?void 0:t.includeFiles)!==void 0&&n.set("includeFiles",String(t.includeFiles));const r=n.toString();return y(r?`/api/filesystem?${r}`:"/api/filesystem")},createFileSystemFolder(e,t){return y("/api/filesystem/folders",{method:"POST",body:JSON.stringify({parentPath:e,name:t})})},readInstanceData(e){return y(`/api/storage/instances/${encodeURIComponent(e)}`)},writeInstanceData(e,t){return y(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteInstanceData(e){return y(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"DELETE"})},listBackgroundProcesses(e){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes`)},stopBackgroundProcess(e,t){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/stop`,{method:"POST"})},terminateBackgroundProcess(e,t){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/terminate`,{method:"POST"})},updateVoiceMode(e,t){const n=Xt();return y(`/workspaces/${encodeURIComponent(e)}/plugin/voice-mode`,{method:"POST",body:JSON.stringify({...n,enabled:t})})},sendClientConnectionPong(e){return y("/api/client-connections/pong",{method:"POST",body:JSON.stringify(e)})},fetchBackgroundProcessOutput(e,t,n){const r=new URLSearchParams;n!=null&&n.method&&r.set("method",n.method),n!=null&&n.pattern&&r.set("pattern",n.pattern),n!=null&&n.lines&&r.set("lines",String(n.lines)),(n==null?void 0:n.maxBytes)!==void 0&&r.set("maxBytes",String(n.maxBytes));const o=r.toString(),s=o?`?${o}`:"";return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/output${s}`)},connectEvents(e,t,n){const r=Xt(),o=Bi(r);Rn.info(`Connecting to ${o}`);const s=new EventSource(o,{withCredentials:!0});return Ii(s,{onEvent:e,onError:t,onPing:n,logger:Rn}),s}};function Bi(e){const t=new URL(jt,typeof window<"u"?window.location.origin:"http://localhost");return t.searchParams.set("clientId",e.clientId),t.searchParams.set("connectionId",e.connectionId),jt.startsWith("http://")||jt.startsWith("https://")?t.toString():`${t.pathname}${t.search}`}const Nn=1e3,_i=1e4,Qt=Ce("sse");function ct(e,t){if(t){Qt.info(e,t);return}Qt.info(e)}class ji{constructor(){this.handlers=new Map,this.openHandlers=new Set,this.source=null,this.retryDelay=Nn,this.reconnectTimer=null,this.connect()}connect(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.source&&this.source.close(),ct("Connecting to backend events stream"),this.source=ee.connectEvents(t=>this.dispatch(t),()=>this.scheduleReconnect(),t=>{ee.sendClientConnectionPong({...Xt(),pingTs:t.ts}).catch(n=>{Qt.error("Failed to send client connection pong",n)})}),this.source.onopen=()=>{ct("Events stream connected"),this.retryDelay=Nn,this.openHandlers.forEach(t=>t())}}scheduleReconnect(){if(this.reconnectTimer!==null)return;const t=this.source;this.source=null,ct("Events stream disconnected, scheduling reconnect",{delayMs:this.retryDelay}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryDelay=Math.min(this.retryDelay*2,_i),this.connect()},this.retryDelay),t==null||t.close()}dispatch(t){var n,r;ct(`event ${t.type}`),(n=this.handlers.get("*"))==null||n.forEach(o=>o(t)),(r=this.handlers.get(t.type))==null||r.forEach(o=>o(t))}on(t,n){this.handlers.has(t)||this.handlers.set(t,new Set);const r=this.handlers.get(t);return r.add(n),()=>r.delete(n)}onOpen(t){return this.openHandlers.add(t),()=>this.openHandlers.delete(t)}}const Vt=new ji,Vi=Ce("actions"),Un={messageHistory:[],agentModelSelections:{}};function Bn(e,t){if(e===t)return!0;if(typeof e=="object"&&e!==null&&typeof t=="object"&&t!==null)try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){Vi.warn("Failed to compare config objects",n)}return!1}class Wi{constructor(){this.configOwnerCache=new Map,this.stateOwnerCache=new Map,this.configOwnerLoadPromises=new Map,this.stateOwnerLoadPromises=new Map,this.configOwnerListeners=new Map,this.stateOwnerListeners=new Map,this.instanceDataCache=new Map,this.instanceDataListeners=new Map,this.instanceLoadPromises=new Map,Vt.on("storage.configChanged",t=>{t.type==="storage.configChanged"&&this.setOwnerCache("config",t.owner,t.value)}),Vt.on("storage.stateChanged",t=>{t.type==="storage.stateChanged"&&this.setOwnerCache("state",t.owner,t.value)}),Vt.on("instance.dataChanged",t=>{t.type==="instance.dataChanged"&&this.setInstanceDataCache(t.instanceId,t.data)})}async loadConfigOwner(t){const n=this.configOwnerCache.get(t);if(n)return n;if(!this.configOwnerLoadPromises.has(t)){const r=ee.fetchConfigOwner(t).then(o=>(this.setOwnerCache("config",t,o),o)).finally(()=>{this.configOwnerLoadPromises.delete(t)});this.configOwnerLoadPromises.set(t,r)}return this.configOwnerLoadPromises.get(t)}async patchConfigOwner(t,n){const r=await ee.patchConfigOwner(t,n);return this.setOwnerCache("config",t,r),r}async loadStateOwner(t){const n=this.stateOwnerCache.get(t);if(n)return n;if(!this.stateOwnerLoadPromises.has(t)){const r=ee.fetchStateOwner(t).then(o=>(this.setOwnerCache("state",t,o),o)).finally(()=>{this.stateOwnerLoadPromises.delete(t)});this.stateOwnerLoadPromises.set(t,r)}return this.stateOwnerLoadPromises.get(t)}async patchStateOwner(t,n){const r=await ee.patchStateOwner(t,n);return this.setOwnerCache("state",t,r),r}async loadInstanceData(t){const n=this.instanceDataCache.get(t);if(n)return n;if(!this.instanceLoadPromises.has(t)){const r=ee.readInstanceData(t).then(o=>{const s=this.normalizeInstanceData(o);return this.setInstanceDataCache(t,s),s}).finally(()=>{this.instanceLoadPromises.delete(t)});this.instanceLoadPromises.set(t,r)}return this.instanceLoadPromises.get(t)}async saveInstanceData(t,n){const r=this.normalizeInstanceData(n);await ee.writeInstanceData(t,r),this.setInstanceDataCache(t,r)}async deleteInstanceData(t){await ee.deleteInstanceData(t),this.setInstanceDataCache(t,Un)}onConfigOwnerChanged(t,n){this.configOwnerListeners.has(t)||this.configOwnerListeners.set(t,new Set);const r=this.configOwnerListeners.get(t);r.add(n);const o=this.configOwnerCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.configOwnerListeners.delete(t)}}onStateOwnerChanged(t,n){this.stateOwnerListeners.has(t)||this.stateOwnerListeners.set(t,new Set);const r=this.stateOwnerListeners.get(t);r.add(n);const o=this.stateOwnerCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.stateOwnerListeners.delete(t)}}onInstanceDataChanged(t,n){this.instanceDataListeners.has(t)||this.instanceDataListeners.set(t,new Set);const r=this.instanceDataListeners.get(t);r.add(n);const o=this.instanceDataCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.instanceDataListeners.delete(t)}}setOwnerCache(t,n,r){if(n==="*"){t==="config"?this.configOwnerCache.clear():this.stateOwnerCache.clear();return}const o=t==="config"?this.configOwnerCache:this.stateOwnerCache,s=t==="config"?this.configOwnerListeners:this.stateOwnerListeners,i=o.get(n);if(i&&Bn(i,r)){o.set(n,r);return}o.set(n,r);const a=s.get(n);if(a)for(const c of a)c(r)}normalizeInstanceData(t){const n=t??Un,r=Array.isArray(n.messageHistory)?[...n.messageHistory]:[],o={...n.agentModelSelections??{}};return{...n,messageHistory:r,agentModelSelections:o}}setInstanceDataCache(t,n){const r=this.normalizeInstanceData(n),o=this.instanceDataCache.get(t);if(o&&Bn(o,r)){this.instanceDataCache.set(t,r);return}this.instanceDataCache.set(t,r),this.notifyInstanceDataChanged(t,r)}notifyInstanceDataChanged(t,n){const r=this.instanceDataListeners.get(t);if(r)for(const o of r)o(n)}}const Y=new Wi,Ir=Ce("api"),Pt={messageHistory:[],agentModelSelections:{}},[fn,Lr]=M(new Map),lt=new Map,Fe=new Map;function Dr(e){const t=e??Pt;return{...t,messageHistory:Array.isArray(t.messageHistory)?[...t.messageHistory]:[],agentModelSelections:{...t.agentModelSelections??{}}}}function _n(e){if(Fe.has(e))return;const t=Y.onInstanceDataChanged(e,n=>{wt(e,n)});Fe.set(e,t)}function zi(e){const t=Fe.get(e);t&&(t(),Fe.delete(e))}function wt(e,t){Lr(n=>{const r=new Map(n);return r.set(e,Dr(t)),r})}async function It(e){if(!e||fn().has(e))return;if(lt.has(e)){await lt.get(e);return}const t=Y.loadInstanceData(e).then(n=>{wt(e,n),_n(e)}).catch(n=>{Ir.warn("Failed to load instance data",n),wt(e,Pt),_n(e)}).finally(()=>{lt.delete(e)});lt.set(e,t),await t}async function Fr(e,t){if(!e)return;await It(e);const n=fn().get(e)??Pt,r=Dr(n);t(r);try{await Y.saveInstanceData(e,r)}catch(o){Ir.warn("Failed to persist instance data",o)}wt(e,r)}function Rr(e){return fn().get(e)??Pt}function Ki(e){Lr(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),zi(e)}const Hi=Ne(),Gi={getInstanceConfig:Rr,ensureInstanceConfig:It,updateInstanceConfig:Fr,clearInstanceConfig:Ki},Qc=e=>(le(()=>{for(const t of Fe.values())t();Fe.clear()}),ue(Hi.Provider,{value:Gi,get children(){return e.children}})),Ji=Ce("api"),[jn,en]=M(null),[el,Vn]=M(!1),[tl,gt]=M(null);let _e=null;async function qi(e=!1){return!e&&jn()?jn():_e||(Vn(!0),gt(null),_e=ee.fetchSpeechCapabilities().then(t=>(en(t),gt(null),t)).catch(t=>(Ji.error("Failed to load speech capabilities",t),en(null),gt(t instanceof Error?t.message:String(t)),null)).finally(()=>{Vn(!1),_e=null}),_e)}function Xi(){en(null),gt(null)}const A=Ce("actions"),Yi=20,Zi=5,Qi=50,T={showThinkingBlocks:!1,showKeyboardShortcutHints:!0,thinkingBlocksExpansion:"expanded",showMessageTimeline:!0,showTimelineTools:!0,holdLongAssistantReplies:!0,promptSubmitOnEnter:!1,showPromptVoiceInput:!0,diffViewMode:"split",toolOutputExpansion:"expanded",diagnosticsExpansion:"expanded",toolInputsVisibility:"collapsed",showUsageMetrics:!0,autoCleanupBlankSessions:!0,keepUnseenSubagentIdleStatus:!1,osNotificationsEnabled:!1,osNotificationsAllowWhenVisible:!1,notifyOnNeedsInput:!0,notifyOnIdle:!0},ve={provider:"openai-compatible",sttModel:"gpt-4o-mini-transcribe",ttsModel:"gpt-4o-mini-tts",ttsVoice:"alloy",playbackMode:"streaming",ttsFormat:"mp3"};function Nr(e){const t=e??{};return{showThinkingBlocks:t.showThinkingBlocks??T.showThinkingBlocks,showKeyboardShortcutHints:t.showKeyboardShortcutHints??T.showKeyboardShortcutHints,thinkingBlocksExpansion:t.thinkingBlocksExpansion??T.thinkingBlocksExpansion,showMessageTimeline:t.showMessageTimeline??T.showMessageTimeline,showTimelineTools:t.showTimelineTools??T.showTimelineTools,holdLongAssistantReplies:t.holdLongAssistantReplies??T.holdLongAssistantReplies,promptSubmitOnEnter:t.promptSubmitOnEnter??T.promptSubmitOnEnter,showPromptVoiceInput:t.showPromptVoiceInput??T.showPromptVoiceInput,locale:t.locale??T.locale,diffViewMode:t.diffViewMode??T.diffViewMode,toolOutputExpansion:t.toolOutputExpansion??T.toolOutputExpansion,diagnosticsExpansion:t.diagnosticsExpansion??T.diagnosticsExpansion,toolInputsVisibility:t.toolInputsVisibility==="hidden"||t.toolInputsVisibility==="collapsed"||t.toolInputsVisibility==="expanded"?t.toolInputsVisibility:T.toolInputsVisibility,showUsageMetrics:t.showUsageMetrics??T.showUsageMetrics,autoCleanupBlankSessions:t.autoCleanupBlankSessions??T.autoCleanupBlankSessions,keepUnseenSubagentIdleStatus:t.keepUnseenSubagentIdleStatus??T.keepUnseenSubagentIdleStatus,osNotificationsEnabled:t.osNotificationsEnabled??T.osNotificationsEnabled,osNotificationsAllowWhenVisible:t.osNotificationsAllowWhenVisible??T.osNotificationsAllowWhenVisible,notifyOnNeedsInput:t.notifyOnNeedsInput??T.notifyOnNeedsInput,notifyOnIdle:t.notifyOnIdle??T.notifyOnIdle}}function Ur(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return t}function Br(e){const t=e??{};return{provider:t.provider==="openai-compatible"?t.provider:ve.provider,apiKey:typeof t.apiKey=="string"&&t.apiKey.trim()?t.apiKey.trim():void 0,hasApiKey:t.hasApiKey===!0||typeof t.apiKey=="string"&&t.apiKey.trim().length>0,baseUrl:typeof t.baseUrl=="string"&&t.baseUrl.trim()?t.baseUrl.trim():void 0,sttModel:typeof t.sttModel=="string"&&t.sttModel.trim()?t.sttModel.trim():ve.sttModel,ttsModel:typeof t.ttsModel=="string"&&t.ttsModel.trim()?t.ttsModel.trim():ve.ttsModel,ttsVoice:typeof t.ttsVoice=="string"&&t.ttsVoice.trim()?t.ttsVoice.trim():ve.ttsVoice,playbackMode:t.playbackMode==="buffered"||t.playbackMode==="streaming"?t.playbackMode:ve.playbackMode,ttsFormat:t.ttsFormat==="wav"||t.ttsFormat==="opus"||t.ttsFormat==="aac"||t.ttsFormat==="mp3"?t.ttsFormat:ve.ttsFormat}}function je(e,t){if(!Array.isArray(e))return[];const n=[];for(const r of e){const o=t(r);o&&n.push(o)}return n}function ea(e){var n,r,o;const t=e??{};return{recentFolders:je(t.recentFolders,s=>{if(!s||typeof s!="object")return null;const i=s.path,a=s.lastAccessed;if(typeof i!="string")return null;const c=typeof a=="number"?a:Date.now();return{path:i,lastAccessed:c}}),opencodeBinaries:je(t.opencodeBinaries,s=>{if(!s||typeof s!="object")return null;const i=s.path;if(typeof i!="string")return null;const a=typeof s.lastUsed=="number"?s.lastUsed:Date.now(),c=typeof s.version=="string"?s.version:void 0,l=typeof s.label=="string"?s.label:void 0;return{path:i,version:c,label:l,lastUsed:a}}),remoteServers:je(t.remoteServers,s=>{if(!s||typeof s!="object")return null;const i=typeof s.id=="string"?s.id.trim():"",a=typeof s.name=="string"?s.name.trim():"",c=typeof s.baseUrl=="string"?s.baseUrl.trim():"";if(!i||!a||!c)return null;const l=typeof s.createdAt=="string"?s.createdAt:new Date().toISOString(),u=typeof s.updatedAt=="string"?s.updatedAt:l,d=typeof s.lastConnectedAt=="string"?s.lastConnectedAt:void 0;return{id:i,name:a,baseUrl:c,skipTlsVerify:!!s.skipTlsVerify,createdAt:l,updatedAt:u,lastConnectedAt:d}}).sort((s,i)=>{const a=s.lastConnectedAt??s.updatedAt;return(i.lastConnectedAt??i.updatedAt).localeCompare(a)}),models:{recents:je((n=t.models)==null?void 0:n.recents,s=>{if(!s||typeof s!="object")return null;const i=s.providerId,a=s.modelId;return typeof i!="string"||typeof a!="string"?null:{providerId:i,modelId:a}}),favorites:je((r=t.models)==null?void 0:r.favorites,s=>{if(!s||typeof s!="object")return null;const i=s.providerId,a=s.modelId;return typeof i!="string"||typeof a!="string"?null:{providerId:i,modelId:a}}),thinkingSelections:Ur((o=t.models)==null?void 0:o.thinkingSelections)}}}function ta(e){const t=e??{},n=t.listeningMode==="all"?"all":"local",r=t.logLevel==="INFO"||t.logLevel==="WARN"||t.logLevel==="ERROR"||t.logLevel==="DEBUG"?t.logLevel:"DEBUG",o=typeof t.opencodeBinary=="string"&&t.opencodeBinary.trim()?t.opencodeBinary:"opencode",s=Ur(t.environmentVariables),i=Br(t.speech);return{listeningMode:n,logLevel:r,opencodeBinary:o,environmentVariables:s,speech:i}}function _r(e){return`${e.providerId}/${e.modelId}`}function jr(e,t){const n=t.filter(r=>r.path!==e);return n.unshift({path:e,lastAccessed:Date.now()}),n.slice(0,Yi)}function gn(e,t,n){const r=Date.now(),o=n.find(i=>i.path===e);if(o){const i={...o,lastUsed:r,version:t??o.version},a=n.filter(c=>c.path!==e);return[i,...a]}return[t?{path:e,version:t,lastUsed:r}:{path:e,lastUsed:r},...n].slice(0,10)}function na(e,t){const n=e.id?t.find(o=>o.id===e.id):void 0,r=new Date().toISOString();return{id:(n==null?void 0:n.id)??e.id??ra(),name:e.name.trim(),baseUrl:e.baseUrl.trim(),skipTlsVerify:!!e.skipTlsVerify,createdAt:(n==null?void 0:n.createdAt)??r,updatedAt:r,lastConnectedAt:n==null?void 0:n.lastConnectedAt}}function Vr(e,t){const n=t.filter(r=>r.id!==e.id);return[e,...n].sort((r,o)=>{const s=r.lastConnectedAt??r.updatedAt;return(o.lastConnectedAt??o.updatedAt).localeCompare(s)})}function ra(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`remote-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const[hn,Ct]=M({}),[oa,St]=M({}),[sa,xt]=M({}),[Wr,He]=M(!1),ia=L(()=>Nr(hn().settings)),zr=L(()=>hn().theme??"system"),Se=L(()=>ta(oa())),re=L(()=>ea(sa())),B=ia,Lt=L(()=>re().recentFolders),et=L(()=>re().opencodeBinaries),Re=L(()=>re().remoteServers);let ut=null;async function Dt(){Wr()||(ut||(ut=Promise.all([Y.loadConfigOwner("ui"),Y.loadConfigOwner("server"),Y.loadStateOwner("ui")]).then(([e,t,n])=>{Ct(e),St(t),xt(n),He(!0)}).catch(e=>{A.error("Failed to load settings",e),Ct({}),St({}),xt({}),He(!0)}).finally(()=>{ut=null})),await ut)}async function se(e,t){await Dt();const n=await Y.patchConfigOwner(e,t);e==="ui"&&Ct(n),e==="server"&&St(n)}async function G(e,t){await Dt();const n=await Y.patchStateOwner(e,t);xt(n)}function W(e){const t=hn(),r={settings:Nr({...t.settings??{},...e})};se("ui",r).catch(o=>A.error("Failed to patch ui settings",o))}function Kr(e){W(e)}function aa(e){zr()!==e&&se("ui",{theme:e}).catch(t=>A.error("Failed to set theme",t))}async function ca(e){Se().listeningMode!==e&&await se("server",{listeningMode:e})}function mn(e){se("server",{environmentVariables:e}).catch(t=>A.error("Failed to update environment variables",t))}function la(e,t){const n=Se().environmentVariables;mn({...n,[e]:t})}function ua(e){const t=Se().environmentVariables,{[e]:n,...r}=t;mn(r)}function da(e){const t=e&&e.trim().length>0?e:"opencode";se("server",{opencodeBinary:t}).catch(r=>A.error("Failed to set default binary",r));const n=gn(t,void 0,et());G("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to update binary list",r))}function fa(e){se("server",{logLevel:e??"DEBUG"}).catch(n=>A.error("Failed to set log level",n))}async function ga(e){const t=e.apiKey,{apiKey:n,...r}=e,o=Br({...Se().speech,...r,...t===null?{}:{apiKey:t}}),{hasApiKey:s,...i}=o,a={...i,...t===null?{apiKey:null}:{}};try{await se("server",{speech:a})}catch(c){throw A.error("Failed to update speech settings",c),c}}function ha(e,t){const n=gn(e,t,et());G("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to add binary",r))}function ma(e){const t=et().filter(n=>n.path!==e);G("ui",{opencodeBinaries:t}).catch(n=>A.error("Failed to remove binary",n)),Se().opencodeBinary===e&&se("server",{opencodeBinary:"opencode"}).catch(n=>A.error("Failed to reset default binary",n))}function pa(e){const t=jr(e,Lt());G("ui",{recentFolders:t}).catch(n=>A.error("Failed to add recent folder",n))}function ya(e){const t=Lt().filter(n=>n.path!==e);G("ui",{recentFolders:t}).catch(n=>A.error("Failed to remove recent folder",n))}async function ba(e){const t=na(e,Re());return await G("ui",{remoteServers:Vr(t,Re())}),t}async function wa(e){const t=Re().find(o=>o.id===e);if(!t)return;const n=new Date().toISOString(),r={...t,updatedAt:n,lastConnectedAt:n};await G("ui",{remoteServers:Vr(r,Re())})}function Ca(e){const t=Re().filter(n=>n.id!==e);G("ui",{remoteServers:t}).catch(n=>A.error("Failed to remove remote server",n))}function Sa(e,t){const n=t&&t.trim().length>0?t:Se().opencodeBinary,r=jr(e,Lt()),o=gn(n,void 0,et());G("ui",{recentFolders:r,opencodeBinaries:o}).catch(s=>A.error("Failed to update ui state on launch",s)),se("server",{opencodeBinary:n}).catch(s=>A.error("Failed to persist selected binary",s))}function xa(e){if(!e.providerId||!e.modelId)return;const n=re().models.recents.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId),r=[e,...n].slice(0,Zi);G("ui",{models:{recents:r}}).catch(o=>A.error("Failed to update model recents",o))}function Oa(e){return!e.providerId||!e.modelId?!1:re().models.favorites.some(t=>t.providerId===e.providerId&&t.modelId===e.modelId)}function va(e){if(!e.providerId||!e.modelId)return;const t=re().models.favorites,r=t.some(o=>o.providerId===e.providerId&&o.modelId===e.modelId)?t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId):[e,...t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId)].slice(0,Qi);G("ui",{models:{favorites:r}}).catch(o=>A.error("Failed to update model favorites",o))}function ka(e){if(!(!e.providerId||!e.modelId))return re().models.thinkingSelections[_r(e)]}function $a(e,t){if(!e.providerId||!e.modelId)return;const n=_r(e);if(re().models.thinkingSelections[n]===t)return;const o={...re().models.thinkingSelections};t?o[n]=t:delete o[n],G("ui",{models:{thinkingSelections:o}}).catch(s=>A.error("Failed to update thinking selection",s))}function Aa(e){B().diffViewMode!==e&&W({diffViewMode:e})}function Ta(e){B().toolOutputExpansion!==e&&W({toolOutputExpansion:e})}function Ma(e){B().diagnosticsExpansion!==e&&W({diagnosticsExpansion:e})}function Ea(e){B().toolInputsVisibility!==e&&W({toolInputsVisibility:e})}function Pa(e){B().thinkingBlocksExpansion!==e&&W({thinkingBlocksExpansion:e})}function Ia(){W({showThinkingBlocks:!B().showThinkingBlocks})}function La(){Kr({showKeyboardShortcutHints:!B().showKeyboardShortcutHints})}function Da(){W({showTimelineTools:!B().showTimelineTools})}function Fa(){W({showMessageTimeline:!(B().showMessageTimeline??!0)})}function Ra(){W({showUsageMetrics:!B().showUsageMetrics})}function Na(){W({promptSubmitOnEnter:!B().promptSubmitOnEnter})}function Ua(){W({showPromptVoiceInput:!B().showPromptVoiceInput})}function Ba(){const e=!B().autoCleanupBlankSessions;A.info("toggle auto cleanup",{value:e}),W({autoCleanupBlankSessions:e})}async function _a(e,t,n){!e||!t||!n.providerId||!n.modelId||(await It(e),await Fr(e,r=>{const o={...r.agentModelSelections??{}},s=o[t];s&&s.providerId===n.providerId&&s.modelId===n.modelId||(o[t]=n,r.agentModelSelections=o)}))}async function ja(e,t){return!e||!t?void 0:(await It(e),(Rr(e).agentModelSelections??{})[t])}Dt().catch(e=>{A.error("Failed to initialize settings",e)});const Hr=Ne(),Va={isLoaded:Wr,preferences:B,updatePreferences:Kr,themePreference:zr,setThemePreference:aa,serverSettings:Se,setListeningMode:ca,updateEnvironmentVariables:mn,addEnvironmentVariable:la,removeEnvironmentVariable:ua,updateLastUsedBinary:da,updateLogLevel:fa,updateSpeechSettings:ga,recentFolders:Lt,opencodeBinaries:et,remoteServers:Re,uiState:re,addRecentFolder:pa,removeRecentFolder:ya,addOpenCodeBinary:ha,removeOpenCodeBinary:ma,saveRemoteServerProfile:ba,markRemoteServerConnected:wa,removeRemoteServerProfile:Ca,recordWorkspaceLaunch:Sa,addRecentModelPreference:xa,isFavoriteModelPreference:Oa,toggleFavoriteModelPreference:va,getModelThinkingSelection:ka,setModelThinkingSelection:$a,toggleShowThinkingBlocks:Ia,toggleKeyboardShortcutHints:La,toggleShowMessageTimeline:Fa,toggleShowTimelineTools:Da,toggleUsageMetrics:Ra,toggleAutoCleanupBlankSessions:Ba,togglePromptSubmitOnEnter:Na,toggleShowPromptVoiceInput:Ua,setDiffViewMode:Aa,setToolOutputExpansion:Ta,setDiagnosticsExpansion:Ma,setThinkingBlocksExpansion:Pa,setToolInputsVisibility:Ea,setAgentModelPreference:_a,getAgentModelPreference:ja},nl=e=>($t(()=>{Dt().catch(o=>{A.error("Failed to initialize settings",o)});const t=Y.onConfigOwnerChanged("ui",o=>{Ct(o),He(!0)}),n=Y.onConfigOwnerChanged("server",o=>{St(o),He(!0),Xi(),qi(!0)}),r=Y.onStateOwnerChanged("ui",o=>{xt(o),He(!0)});return()=>{t(),n(),r()}}),ue(Hr.Provider,{value:Va,get children(){return e.children}}));function Wa(){const e=Ye(Hr);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e}function za(e,t,n){const r={};return Object.keys(e).forEach(o=>{r[o]=e[o].reduce((s,i)=>(i&&(n&&n[i]&&s.push(n[i]),s.push(t(i))),s),[]).join(" ")}),r}const Ka=Symbol("solid-inspect"),Ha=Ne();function Ga(e){function t(n){var r;return(r=Ye(Ha))!=null&&r.enabled?{Component:t,props:n,$INSPECT:Ka}:e(n)}return Object.defineProperty(t,"name",{value:e.name}),t.toString=e.toString,t}function Gr(){return function(e){function t(a){const c=!!e.slotClasses,l=()=>{if(!e.slotClasses)throw new Error("'slotClasses' option is not defined");if(!e.utilityClass)throw new Error("'utilityClass' option is not defined");return za(e.slotClasses(a),e.utilityClass,a.classes??"")},u=No({});return c&&io(()=>{const d=l();Ae(()=>{for(const g in d)u[g]=d[g]})}),u}function n(a){const[c,l]=kt(a,e.selfPropNames);return{allProps:a,props:c,otherProps:l}}function r(a){return $s({propDefaults:a.propDefaults||e.propDefaults,props:a.props,name:e.name})}function o(a){const c=r({props:a});return n(c)}function s(a,c=!0){return a=Ga(a),a.toString=()=>`.${e.name}-root`,c&&Ar(a,"base"),a}function i(a){const c=s(function(u){const{allProps:d,otherProps:g,props:m}=o(u),p=e.autoCallUseClasses??!0?t(d):{};return a({allProps:d,otherProps:g,props:m,classes:p})});return Object.defineProperty(c,"name",{value:a.name}),c}return{name:e.name,selfPropNames:e.selfPropNames,component:i,defineComponent:s,useClasses:t,useThemeProps:r,useProps:o,splitInProps:n}}}const Ja=Gr()({name:"MuiGlobalStyles",selfPropNames:["styles"]}),qa=Ja.component(function({props:t}){return Sr(()=>({"@global":t.styles||{}})),[]}),Xa=Gr()({name:"MuiCssBaseline",selfPropNames:["children","enableColorScheme"],propDefaults:({set:e})=>e({enableColorScheme:!1})}),Ya=(e,t)=>({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%",...t&&{colorScheme:e.palette.mode}}),Za=e=>({color:e.palette.text.primary,...e.typography.body1,backgroundColor:e.palette.background.default,"@media print":{backgroundColor:e.palette.common.white}}),Qa=(e,t=!1)=>({html:Ya(e,t),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...Za(e),"&::backdrop":{backgroundColor:e.palette.background.default}}}),ec=Xa.component(function({props:t}){const n=fr();return ue(qa,{get styles(){return Qa(n,t.enableColorScheme)}})}),Jr=Ne();function Wn(e){if(!(typeof document>"u")){if(e==="system"){document.documentElement.removeAttribute("data-theme");return}document.documentElement.setAttribute("data-theme",e)}}const tc={backgroundDefault:"#ffffff",backgroundPaper:"#f5f5f5",primary:"#0066ff",primaryContrast:"#ffffff",textPrimary:"#1a1a1a",textSecondary:"#666666",divider:"#e0e0e0"},nc={backgroundDefault:"#1a1a1a",backgroundPaper:"#2a2a2a",primary:"#0080ff",primaryContrast:"#1a1a1a",textPrimary:"#cfd4dc",textSecondary:"#999999",divider:"#3a3a3a"},he=(e,t,n)=>{if(!n)return t;const r=n.getPropertyValue(e);return r&&r.trim()||t},rc=e=>{const t=e?nc:tc,n=typeof window<"u"?getComputedStyle(document.documentElement):null;return{backgroundDefault:he("--surface-base",t.backgroundDefault,n),backgroundPaper:he("--surface-secondary",t.backgroundPaper,n),primary:he("--accent-primary",t.primary,n),primaryContrast:he("--text-inverted",t.primaryContrast,n),textPrimary:he("--text-primary",t.textPrimary,n),textSecondary:he("--text-secondary",t.textSecondary,n),divider:he("--border-base",t.divider,n)}};function rl(e){const t=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,{themePreference:n,setThemePreference:r}=Wa(),[o,s]=M(!0),[i,a]=M(0),c=()=>n(),l=()=>{const p=c();return p==="dark"?!0:p==="light"?!1:(t==null?void 0:t.matches)??!1},u=()=>{const p=c(),C=l();Wn(p==="system"?"system":p),s(C),typeof window<"u"?requestAnimationFrame(()=>a(b=>b+1)):a(b=>b+1)};K(()=>{u()}),$t(()=>{if(!t)return;const p=()=>{u()};return t.addEventListener("change",p),()=>{t.removeEventListener("change",p)}});const d=p=>{r(p)},g=()=>{const p=c();d(p==="system"?"light":p==="light"?"dark":"system")},m=L(()=>{i();const p=rc(o());return lr({palette:{mode:o()?"dark":"light",primary:{main:p.primary,contrastText:p.primaryContrast},secondary:{main:p.primary},background:{default:p.backgroundDefault,paper:p.backgroundPaper},text:{primary:p.textPrimary,secondary:p.textSecondary},divider:p.divider},typography:{fontFamily:"var(--font-family-sans)"},shape:{borderRadius:8},components:{MuiIconButton:{styleOverrides:{root:{color:"inherit","&.Mui-disabled":{color:"var(--text-muted)",opacity:.55}}}},MuiDrawer:{styleOverrides:{paper:{backgroundColor:"var(--surface-secondary)",color:"var(--text-primary)"}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:"var(--surface-secondary)",color:"var(--text-primary)",boxShadow:"none",borderBottom:"1px solid var(--border-base)",zIndex:10}}},MuiToolbar:{styleOverrides:{root:{minHeight:"56px"}}}}})});return ue(Jr.Provider,{value:{isDark:o,themeMode:c,setThemeMode:d,cycleThemeMode:g},get children(){return ue(As,{get theme(){return m()},get children(){return[ue(ec,{}),bo(()=>e.children)]}})}})}function qr(){const e=Ye(Jr);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const oc=/(^|\n)@@/m,sc=/(^|\n)(diff --git |--- |\+\+\+)/,ic=/^\*\*\* (Begin|End) Patch/,ac=/^\*\*\* Update File: (.+)$/,cc=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function lc(e){const t=e.trim();if(!t.startsWith("```"))return t;const n=t.split(`
|
|
15
|
+
`));const r=t==null?void 0:t.id,o=document.head||document.getElementsByTagName("head")[0],s=r&&document.getElementById(r);if(s&&s instanceof HTMLStyleElement)return wr(s,e),Jt(s),s;{s&&s.remove();const i=Ns(e,t);if(Jt(i),n){let a=o.querySelector(`#${Tn}`);a||(a=document.createElement("style"),a.setAttribute("id",Tn),o.prepend(a)),o.insertBefore(i,a)}else o.appendChild(i);return i}}function Bs(e,t="css-"){if(typeof e=="string")return document.getElementById(e);const n=[...e.classList].find(r=>r.startsWith(t));if(n)return document.getElementById(n.slice(t.length))}function Mn(e,t=!0){let n=Number(e.getAttribute("data-uses"));n--,n<=0?t?e.remove():e.setAttribute("data-uses","0"):e.setAttribute("data-uses",n.toString())}function Wc(e){if(typeof e!="string")throw new Error("MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}function zc(e,t=166){let n;function r(...o){const s=()=>{e.apply(null,o)};clearTimeout(n),n=setTimeout(s,t)}return r.clear=()=>{clearTimeout(n)},r}function Kc(e){const t=e.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}function _s(e){return e&&e.ownerDocument||document}function Hc(e){return _s(e).defaultView||window}function Cr(){return Math.random().toString(36).substring(2,15).slice(0,8)}let Mt=!0,qt=!1,En;const js={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function Vs(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&js[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function Ws(e){e.metaKey||e.altKey||e.ctrlKey||(Mt=!0)}function Nt(){Mt=!1}function zs(){this.visibilityState==="hidden"&&qt&&(Mt=!0)}function Ks(e){e.addEventListener("keydown",Ws,!0),e.addEventListener("mousedown",Nt,!0),e.addEventListener("pointerdown",Nt,!0),e.addEventListener("touchstart",Nt,!0),e.addEventListener("visibilitychange",zs,!0)}function Hs(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return Mt||Vs(t)}function Gc(){const e=s=>{s!=null&&Ks(s.ownerDocument)},[t,n]=M(!1);function r(){return t()?(qt=!0,window.clearTimeout(En),En=window.setTimeout(()=>{qt=!1},100),n(!1),!0):!1}function o(s){return Hs(s)?(n(!0),!0):!1}return{isFocusVisibleRef:{get current(){return t()}},onFocus:o,onBlur:r,ref:e}}const Gs=new Ds;function Js(e){return e?Array.isArray(e)?e.flat(1/0).filter(t=>!!t):[e]:[]}function qs(){if(!I.context)return Cr();const e=so().replaceAll("-",""),t=9,n=Math.ceil(e.length/t),r=[];for(let o=1;o<=n;++o){const s=(o-1)*t,i=Number(e.slice(s,s+t));r.push(i.toString(32))}return r.join("-")}function Sr(e){const t=Ye(Ho),[n,r]=M(""),o=qs();let s,i=!1;return ce(a=>{var u;const c=e();let l;if(c){const d=Es(Js(c));i="@global"in d,l=Fs({name:"css",props:d,cache:Gs,componentId:o}),s=Bs(l.id),s?Jt(s):s=Us(l.rules,{id:l.id,nonce:(u=t.cache)==null?void 0:u.nonce},t.injectFirst),a!=null&&a.styleElement&&Mn(a.styleElement)}return typeof(l==null?void 0:l.className)=="string"?r(l.className):r(""),{className:l==null?void 0:l.className,styleElement:s}},void 0),le(()=>{s&&Mn(s,t.cleanupStyles??i)}),n}function $e(e,t,n={}){for(const r in e){const o=e[r];if(pr(r))n[r]=$e(o,t);else if(Gt(r))n[r]=$e(o,t);else if(yr(r)){n[r]={};for(const s in o)n[r][s]=$e(o[s],t)}else if(mr(r))n[r]=$e(o,t);else{const s=t(r,o);if(s)for(const i in s)n[i]=Gt(i)?{...n[i],...s[i]}:s[i];else n[r]=o}}return n}const Xs=new Set(["animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","fontWeight","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","WebkitLineClamp","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);function xr(e,t){if(typeof t=="number")return{[e]:Xs.has(e)?t.toString():`${t}px`}}function Pn(e,t={}){return $e(e,xr,t)}function bt(e,t,n){if(typeof n!="string")return n;const r=n.split(".");let o=e[t];for(let s=0;s<r.length&&(o=o==null?void 0:o[r[s]],!!o);s++);return o??n}function Ys(e,t){return t.split(".").reduce((n,r)=>n&&n[r]?n[r]:null,e)}function Zs(e,t,n,r){const o=Ys(e,t)||n;return typeof o=="number"?s=>typeof s=="string"?s:o*s:Array.isArray(o)?s=>typeof s=="string"?s:o[s]:typeof o=="function"?o:()=>{}}const ie={x:["Left","Right"],y:["Top","Bottom"]};function Or(e){return typeof e=="number"?`${e}px`:e}function vr(e,t){return(n,r)=>t(e,n,r)}function f(e,t){return t?(n,r)=>({[e]:t(e,n,r)}):n=>({[e]:n})}function ze(e){return f(e,(t,n)=>Or(n))}function z(e,t,n){const r=t.map(o=>`${e}${o}`);return n?(o,s)=>r.reduce((i,a)=>(i[a]=n(a,o,s),i),{}):o=>r.reduce((s,i)=>(s[i]=o,s),{})}function Qs(){return{...ei(),...ti(),...ni(),...ri(),...oi(),...si(),...ii(),...ci(),...ai()}}function ei(){return{displayPrint:vr("displayPrint",(e,t)=>({"@media print":{display:t}})),displayRaw:f("display"),overflow:f("overflow"),textOverflow:f("textOverflow"),visibility:f("visibility"),whiteSpace:f("whiteSpace")}}function ti(){return{flexBasis:f("flexBasis"),flexDirection:f("flexDirection"),flexWrap:f("flexWrap"),justifyContent:f("justifyContent"),alignItems:f("alignItems"),alignContent:f("alignContent"),order:f("order"),flex:f("flex"),flexGrow:f("flexGrow"),flexShrink:f("flexShrink"),alignSelf:f("alignSelf"),justifyItems:f("justifyItems"),justifySelf:f("justifySelf")}}function ni(){const e=(t,n,r)=>Zs(r,"spacing",8)(n);return{gap:f("gap",e),columnGap:f("columnGap",e),rowGap:f("rowGap",e),gridColumn:f("gridColumn"),gridRow:f("gridRow"),gridAutoFlow:f("gridAutoFlow"),gridAutoColumns:f("gridAutoColumns"),gridAutoRows:f("gridAutoRows"),gridTemplateColumns:f("gridTemplateColumns"),gridTemplateRows:f("gridTemplateRows"),gridTemplateAreas:f("gridTemplateAreas"),gridArea:f("gridArea")}}function ri(){return{position:f("position"),zIndex:f("zIndex",(e,t,n)=>{var r;return((r=n.zIndex)==null?void 0:r[e])??t}),top:ze("top"),right:ze("right"),bottom:ze("bottom"),left:ze("left")}}function oi(){const e=(t,n,r)=>bt(r,"palette",n);return{color:f("color",e),bgcolor:f("backgroundColor",e),backgroundColor:f("backgroundColor",e)}}function si(){const e=(t,n,r)=>(t==="maxWidth"&&(n=r.breakpoints.values[t]??n),typeof n=="number"&&(n=n>0&&n<=1?`${n*100}%`:`${n}px`),n);return{width:f("width",e),maxWidth:f("maxWidth",e),minWidth:f("minWidth",e),height:f("height",e),maxHeight:f("maxHeight",e),minHeight:f("minHeight",e),boxSizing:f("boxSizing",e)}}function ii(){const e=(n,r)=>typeof r=="number"?`${r}px solid`:r,t=(n,r,o)=>bt(o,"palette",r);return{border:f("border",e),borderTop:f("borderTop",e),borderRight:f("borderRight",e),borderBottom:f("borderBottom",e),borderLeft:f("borderLeft",e),borderColor:f("borderColor",t),borderTopColor:f("borderTopColor",t),borderRightColor:f("borderRightColor",t),borderBottomColor:f("borderBottomColor",t),borderLeftColor:f("borderLeftColor",t),borderRadius:f("borderRadius",(n,r,o)=>typeof r=="number"?`${o.shape.borderRadius*r}px`:r)}}function ai(){const e=(t,n,r)=>bt(r,"typography",n);return{typography:vr("typography",(t,n,r)=>bt(r,"typography",n)),fontFamily:f("fontFamily",e),fontSize:f("fontSize",(t,n,r)=>Or(e(t,n,r))),fontStyle:f("fontStyle",e),fontWeight:f("fontWeight",e),letterSpacing:ze("letterSpacing"),lineHeight:f("lineHeight"),textAlign:f("textAlign"),textTransform:f("textTransform")}}function ci(){const e=(r,o,s)=>s.spacing(o),t="margin",n="padding";return{m:f(t,e),mt:f("marginTop",e),mr:f("marginRight",e),mb:f("marginBottom",e),ml:f("marginLeft",e),mx:z(t,ie.x,e),my:z(t,ie.y,e),margin:f(t,e),marginTop:f("marginTop",e),marginRight:f("marginRight",e),marginBottom:f("marginBottom",e),marginLeft:f("marginLeft",e),marginX:z(t,ie.x,e),marginY:z(t,ie.y,e),marginInline:z(t,["Inline","InlineStart"],e),marginInlineStart:f("marginInlineStart",e),marginInlineEnd:f("marginInlineEnd",e),marginBlock:z(t,["BlockStart","BlockEnd"],e),marginBlockStart:f("marginBlockStart",e),marginBlockEnd:f("marginBlockEnd",e),p:f(n,e),pt:f("paddingTop",e),pr:f("paddingRight",e),pb:f("paddingBottom",e),pl:f("paddingLeft",e),px:z(n,ie.x,e),py:z(n,ie.y,e),padding:f(n,e),paddingTop:f("paddingTop",e),paddingRight:f("paddingRight",e),paddingBottom:f("paddingBottom",e),paddingLeft:f("paddingLeft",e),paddingX:z(n,ie.x,e),paddingY:z(n,ie.y,e),paddingInline:z(n,["Inline","InlineStart"],e),paddingInlineStart:f("paddingInlineStart",e),paddingInlineEnd:f("paddingInlineEnd",e),paddingBlock:z(n,["BlockStart","BlockEnd"],e),paddingBlockStart:f("paddingBlockStart",e),paddingBlockEnd:f("paddingBlockEnd",e)}}const dn=Qs(),Jc=Object.keys(dn);function li(e,t,n){return dn[e](t,n)}function In(e,t,n){return e in dn?li(e,t,n):xr(e,t)}function ui(e,t){return $e(e,(n,r)=>{if(typeof r=="function"&&(r=r(t)),r==null)return r;if(typeof r=="object"){const o={};for(const s of t.breakpoints.keys)o[t.breakpoints.up(s)]={};return Object.assign(o,zo({theme:t},r,s=>In(n,s,t)??{[n]:s}))}else return In(n,r,t)})}function kr(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=kr(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function di(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=kr(e))&&(r&&(r+=" "),r+=t);return r}const $r=["ownerState","theme","sx","as"];function fi(e,t){var n,r;return(r=(n=t.components)==null?void 0:n[e])==null?void 0:r.styleOverrides}function gi(e,t,n,r,o={}){return L(()=>{const s=e(),i=fi(o.name,s),a=r.ownerState,c=n.reduce((u,d)=>{let g;return typeof d=="function"?g=d({ownerState:a,theme:s,get sx(){return r.sx},get as(){return r.as},props:r}):d&&(g=d),g&&u.push(Pn(g,{name:t,__resolved:!0})),u},[]);let l=[];return o.overridesResolver&&typeof o.overridesResolver=="function"&&i&&(l=o.overridesResolver(r,i).map(u=>u?Pn(u,{}):null).filter(Boolean)),c.concat(l)})}function Ar(e,t){e.__suid=t}function Ln(e){if(typeof e=="function")return e.__suid}function hi(e){return function(n,r={}){let o,s;if(r.name){const a=r.slot||"Root";s=o=`${r.name}-${a.slice(0,1).toLowerCase()+a.slice(1)}`}else s=`styled-${Cr()}`,o="css";const i=Ln(n);return function(...a){function c(l){let u;const d=()=>{const D=l.theme;return D||u||(u=e&&e.onUseTheme?e.onUseTheme():un())},[,g]=kt(l,r.skipProps||$r),m=gi(d,o,a,l,r),p=()=>{const D=l.sx;return D?Array.isArray(D)?D:[D]:[]},C=()=>{if(i)return n;const D=l.as;return D||n},b=i?()=>i:L(()=>Ln(C())),P=r.skipSx?()=>m():()=>{const D=d();return[...m(),...p().map(J=>J.__resolved?J:ui(J,D))]},R=Sr(()=>b()?void 0:P());return gr(C,Gn(g,{get children(){return l.children},get component(){return b()?l.component:null},get as(){return i?l.as:void 0},get sx(){return b()?P():void 0},get ownerState(){return b()==="system"?l.ownerState:void 0},get class(){return di([...new Set([l.class,s,R()])])}}))}return Ar(c,"system"),s&&(c.toString=()=>`.${s}`),c}}}const qc=[...$r,"classes"],Xc=hi({onUseTheme:()=>fr()}),mi="codenomad.client-id",pi="codenomad.connection-id";let it=null,at=null;function Xt(){return{clientId:yi(),connectionId:bi()}}function yi(){return it||(it=Tr(mi,window.localStorage),it)}function bi(){return at||(at=Tr(pi,window.sessionStorage),at)}function Tr(e,t){if(typeof window>"u")return Ut();try{const r=t.getItem(e);if(r&&r.trim())return r.trim()}catch{return Ut()}const n=Ut();try{t.setItem(e,n)}catch{}return n}function Ut(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var Yt={exports:{}},Bt,Dn;function wi(){if(Dn)return Bt;Dn=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,s=r*365.25;Bt=function(u,d){d=d||{};var g=typeof u;if(g==="string"&&u.length>0)return i(u);if(g==="number"&&isFinite(u))return d.long?c(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var g=parseFloat(d[1]),m=(d[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return g*s;case"weeks":case"week":case"w":return g*o;case"days":case"day":case"d":return g*r;case"hours":case"hour":case"hrs":case"hr":case"h":return g*n;case"minutes":case"minute":case"mins":case"min":case"m":return g*t;case"seconds":case"second":case"secs":case"sec":case"s":return g*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}function a(u){var d=Math.abs(u);return d>=r?Math.round(u/r)+"d":d>=n?Math.round(u/n)+"h":d>=t?Math.round(u/t)+"m":d>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var d=Math.abs(u);return d>=r?l(u,d,r,"day"):d>=n?l(u,d,n,"hour"):d>=t?l(u,d,t,"minute"):d>=e?l(u,d,e,"second"):u+" ms"}function l(u,d,g,m){var p=d>=g*1.5;return Math.round(u/g)+" "+m+(p?"s":"")}return Bt}function Ci(e){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=wi(),n.destroy=l,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let d=0;for(let g=0;g<u.length;g++)d=(d<<5)-d+u.charCodeAt(g),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(u){let d,g=null,m,p;function C(...b){if(!C.enabled)return;const P=C,R=Number(new Date),D=R-(d||R);P.diff=D,P.prev=d,P.curr=R,d=R,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let J=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(_,h)=>{if(_==="%%")return"%";J++;const w=n.formatters[h];if(typeof w=="function"){const v=b[J];_=w.call(P,v),b.splice(J,1),J--}return _}),n.formatArgs.call(P,b),(P.log||n.log).apply(P,b)}return C.namespace=u,C.useColors=n.useColors(),C.color=n.selectColor(u),C.extend=r,C.destroy=n.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(m!==n.namespaces&&(m=n.namespaces,p=n.enabled(u)),p),set:b=>{g=b}}),typeof n.init=="function"&&n.init(C),C}function r(u,d){const g=n(this.namespace+(typeof d>"u"?":":d)+u);return g.log=this.log,g}function o(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];const d=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const g of d)g[0]==="-"?n.skips.push(g.slice(1)):n.names.push(g)}function s(u,d){let g=0,m=0,p=-1,C=0;for(;g<u.length;)if(m<d.length&&(d[m]===u[g]||d[m]==="*"))d[m]==="*"?(p=m,C=g,m++):(g++,m++);else if(p!==-1)m=p+1,C++,g=C;else return!1;for(;m<d.length&&d[m]==="*";)m++;return m===d.length}function i(){const u=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),u}function a(u){for(const d of n.skips)if(s(u,d))return!1;for(const d of n.names)if(s(u,d))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var Si=Ci;(function(e,t){var n={};t.formatArgs=o,t.save=s,t.load=i,t.useColors=r,t.storage=a(),t.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let l;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;l.splice(1,0,u,"color: inherit");let d=0,g=0;l[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(d++,m==="%c"&&(g=d))}),l.splice(g,0,u)}t.log=console.debug||console.log||(()=>{});function s(l){try{l?t.storage.setItem("debug",l):t.storage.removeItem("debug")}catch{}}function i(){let l;try{l=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=n.DEBUG),l}function a(){try{return localStorage}catch{}}e.exports=Si(t);const{formatters:c}=e.exports;c.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(Yt,Yt.exports);var xi=Yt.exports;const Zt=co(xi),Ue=["sse","api","session","actions"],Mr="opencode:logger:namespaces",_t=new Map,Q=new Set,te=typeof globalThis<"u"?globalThis.console:void 0;function Qe(){Q.size===0?Zt.disable():Zt.enable(Array.from(Q).join(","))}function Et(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{window.localStorage.setItem(Mr,JSON.stringify(Array.from(Q)))}catch(t){(e=te==null?void 0:te.warn)==null||e.call(te,"Failed to persist logger namespaces",t)}}function Oi(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{const t=window.localStorage.getItem(Mr);if(!t)return;const n=JSON.parse(t);if(!Array.isArray(n))return;for(const r of n)Ue.includes(r)&&Q.add(r)}catch(t){(e=te==null?void 0:te.warn)==null||e.call(te,"Failed to hydrate logger namespaces",t)}}Oi();Qe();function vi(e){const n=Zt(e),r=(o,s)=>{n(o,...s)};return{log:(...o)=>n(...o),info:(...o)=>n(...o),warn:(...o)=>r("[warn]",o),error:(...o)=>r("[error]",o)}}function Ce(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);return _t.has(e)||_t.set(e,vi(e)),_t.get(e)}function ki(){return Ue.map(e=>({name:e,enabled:Q.has(e)}))}function $i(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);Q.has(e)||(Q.add(e),Et(),Qe())}function Ai(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);Q.has(e)&&(Q.delete(e),Et(),Qe())}function Ti(){Q.clear(),Et(),Qe()}function Mi(){Ue.forEach(e=>Q.add(e)),Et(),Qe()}const Ei={listLoggerNamespaces:ki,enableLogger:$i,disableLogger:Ai,enableAllLoggers:Mi,disableAllLoggers:Ti};function Pi(){typeof window>"u"||(window.codenomadLogger=Ei)}Pi();function Ii(e,t){let n=!1;e.onmessage=o=>{try{const s=JSON.parse(o.data);t.onEvent(s)}catch(s){t.logger.error("Failed to parse event",s)}};const r=o=>{var s;n||(n=!0,t.logger.warn(o),(s=t.onError)==null||s.call(t))};e.onerror=()=>{r("EventSource error, closing stream")},e.onclose=()=>{r("EventSource closed")},e.addEventListener("close",()=>{r("EventSource closed")}),e.addEventListener("codenomad.client.ping",o=>{var s;try{const i=o.data?JSON.parse(o.data):{};(s=t.onPing)==null||s.call(t,i)}catch(i){t.logger.error("Failed to parse ping event",i)}})}var Kn;const Li=typeof window<"u"?(Kn=window.location)==null?void 0:Kn.origin:void 0,Di=typeof window<"u"?window.__CODENOMAD_API_BASE__??Li:void 0,Fi=typeof window<"u"?window.__CODENOMAD_EVENTS_URL__??"/api/events":"/api/events",de=Di,jt=Ri(de,Fi),Yc=de;function Zc(e,t){const n=encodeURIComponent(e),r=encodeURIComponent(t);return Ni(`/workspaces/${n}/plugin/background-processes/${r}/stream`)}function Ri(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(e){const n=t.startsWith("/")?t:`/${t}`;return`${e}${n}`}return t}function Ni(e){if(e.startsWith("http://")||e.startsWith("https://")||!de)return e;const t=e.startsWith("/")?e:`/${e}`;return`${de}${t}`}const Fn=Ce("api"),Rn=Ce("sse");function Er(e){const t={};if(!e)return t;if(e instanceof Headers)return e.forEach((n,r)=>{t[r]=n}),t;if(Array.isArray(e)){for(const[n,r]of e)t[n]=r;return t}return{...e}}function me(e,t){if(t){Fn.info(e,t);return}Fn.info(e)}async function Pr(e){const t=await e.text();if(!t)return`Request failed with ${e.status}`;try{const n=JSON.parse(t);if(typeof(n==null?void 0:n.error)=="string"&&n.error.trim())return n.error;if(typeof(n==null?void 0:n.message)=="string"&&n.message.trim())return n.message}catch{}return t}async function y(e,t){const n=de?new URL(e,de).toString():e,r=Er(t==null?void 0:t.headers);(t==null?void 0:t.body)!==void 0&&(r["Content-Type"]="application/json");const o=((t==null?void 0:t.method)??"GET").toUpperCase(),s=Date.now();me(`${o} ${e}`);try{const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const c=await Pr(i);throw me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:c}),new Error(c||`Request failed with ${i.status}`)}const a=Date.now()-s;return me(`${o} ${e} -> ${i.status}`,{durationMs:a}),i.status===204?void 0:await i.json()}catch(i){throw me(`${o} ${e} failed`,{durationMs:Date.now()-s,error:i}),i}}async function Ui(e,t){const n=de?new URL(e,de).toString():e,r=Er(t==null?void 0:t.headers);(t==null?void 0:t.body)!==void 0&&!r["Content-Type"]&&(r["Content-Type"]="application/json");const o=((t==null?void 0:t.method)??"GET").toUpperCase(),s=Date.now();me(`${o} ${e}`);const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const a=await Pr(i);throw me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:a}),new Error(a||`Request failed with ${i.status}`)}return me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s}),i}const ee={fetchWorkspaces(){return y("/api/workspaces")},fetchWorktrees(e){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees`)},createWorktree(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees`,{method:"POST",body:JSON.stringify(t)})},deleteWorktree(e,t,n){const r=new URLSearchParams;n!=null&&n.force&&r.set("force","true");const o=r.toString()?`?${r.toString()}`:"";return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}${o}`,{method:"DELETE"})},readWorktreeMap(e){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`)},writeWorktreeMap(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`,{method:"PUT",body:JSON.stringify(t)})},createWorkspace(e){return y("/api/workspaces",{method:"POST",body:JSON.stringify(e)})},fetchSidecars(){return y("/api/sidecars")},createSidecar(e){return y("/api/sidecars",{method:"POST",body:JSON.stringify(e)})},updateSidecar(e,t){return y(`/api/sidecars/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteSidecar(e){return y(`/api/sidecars/${encodeURIComponent(e)}`,{method:"DELETE"})},createPreview(e){return y("/api/previews",{method:"POST",body:JSON.stringify(e)})},deletePreview(e){return y(`/api/previews/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchServerMeta(){return y("/api/meta")},probeRemoteServer(e){return y("/api/remote-servers/probe",{method:"POST",body:JSON.stringify(e)})},createRemoteProxySession(e){return y("/api/remote-proxy/sessions",{method:"POST",body:JSON.stringify(e)})},deleteRemoteProxySession(e){return y(`/api/remote-proxy/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchAuthStatus(){return y("/api/auth/status")},setServerPassword(e){return y("/api/auth/password",{method:"POST",body:JSON.stringify({password:e})})},deleteWorkspace(e){return y(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})},cloneWorkspaceRepository(e){return y("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})},listWorkspaceFiles(e,t="."){const n=new URLSearchParams({path:t});return y(`/api/workspaces/${encodeURIComponent(e)}/files?${n.toString()}`)},searchWorkspaceFiles(e,t,n){const r=t.trim();if(!r)return Promise.resolve([]);const o=new URLSearchParams({q:r});return n!=null&&n.limit&&o.set("limit",String(n.limit)),n!=null&&n.type&&o.set("type",n.type),y(`/api/workspaces/${encodeURIComponent(e)}/files/search?${o.toString()}`)},readWorkspaceFile(e,t,n){const r=new URLSearchParams({path:t});return n!=null&&n.encoding&&r.set("encoding",n.encoding),y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${r.toString()}`)},writeWorkspaceFile(e,t,n){const r=new URLSearchParams({path:t});return y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${r.toString()}`,{method:"PUT",body:JSON.stringify({contents:n})})},fetchWorktreeGitStatus(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-status`)},fetchWorktreeGitDiff(e,t,n){const r=new URLSearchParams({path:n.path,scope:n.scope});return n.originalPath&&r.set("originalPath",n.originalPath),y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-diff?${r.toString()}`)},stageWorktreeGitPaths(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-stage`,{method:"POST",body:JSON.stringify(n)})},unstageWorktreeGitPaths(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-unstage`,{method:"POST",body:JSON.stringify(n)})},commitWorktreeGitChanges(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-commit`,{method:"POST",body:JSON.stringify(n)})},fetchConfigOwner(e){return y(`/api/storage/config/${encodeURIComponent(e)}`)},patchConfigOwner(e,t){return y(`/api/storage/config/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},fetchStateOwner(e){return y(`/api/storage/state/${encodeURIComponent(e)}`)},patchStateOwner(e,t){return y(`/api/storage/state/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},validateBinary(e){return y("/api/storage/binaries/validate",{method:"POST",body:JSON.stringify({path:e})})},fetchSpeechCapabilities(){return y("/api/speech/capabilities")},transcribeAudio(e){return y("/api/speech/transcribe",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeech(e){return y("/api/speech/synthesize",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeechStream(e,t){return Ui("/api/speech/synthesize/stream",{method:"POST",body:JSON.stringify(e),signal:t})},listFileSystem(e,t){const n=new URLSearchParams;e&&e!=="."&&n.set("path",e),(t==null?void 0:t.includeFiles)!==void 0&&n.set("includeFiles",String(t.includeFiles));const r=n.toString();return y(r?`/api/filesystem?${r}`:"/api/filesystem")},createFileSystemFolder(e,t){return y("/api/filesystem/folders",{method:"POST",body:JSON.stringify({parentPath:e,name:t})})},readFileSystemFile(e,t){const n=new URLSearchParams({path:e});return t!=null&&t.encoding&&n.set("encoding",t.encoding),y(`/api/filesystem/files/content?${n.toString()}`)},readInstanceData(e){return y(`/api/storage/instances/${encodeURIComponent(e)}`)},writeInstanceData(e,t){return y(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteInstanceData(e){return y(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"DELETE"})},listBackgroundProcesses(e){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes`)},stopBackgroundProcess(e,t){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/stop`,{method:"POST"})},terminateBackgroundProcess(e,t){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/terminate`,{method:"POST"})},updateVoiceMode(e,t){const n=Xt();return y(`/workspaces/${encodeURIComponent(e)}/plugin/voice-mode`,{method:"POST",body:JSON.stringify({...n,enabled:t})})},sendClientConnectionPong(e){return y("/api/client-connections/pong",{method:"POST",body:JSON.stringify(e)})},fetchBackgroundProcessOutput(e,t,n){const r=new URLSearchParams;n!=null&&n.method&&r.set("method",n.method),n!=null&&n.pattern&&r.set("pattern",n.pattern),n!=null&&n.lines&&r.set("lines",String(n.lines)),(n==null?void 0:n.maxBytes)!==void 0&&r.set("maxBytes",String(n.maxBytes));const o=r.toString(),s=o?`?${o}`:"";return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/output${s}`)},connectEvents(e,t,n){const r=Xt(),o=Bi(r);Rn.info(`Connecting to ${o}`);const s=new EventSource(o,{withCredentials:!0});return Ii(s,{onEvent:e,onError:t,onPing:n,logger:Rn}),s}};function Bi(e){const t=new URL(jt,typeof window<"u"?window.location.origin:"http://localhost");return t.searchParams.set("clientId",e.clientId),t.searchParams.set("connectionId",e.connectionId),jt.startsWith("http://")||jt.startsWith("https://")?t.toString():`${t.pathname}${t.search}`}const Nn=1e3,_i=1e4,Qt=Ce("sse");function ct(e,t){if(t){Qt.info(e,t);return}Qt.info(e)}class ji{constructor(){this.handlers=new Map,this.openHandlers=new Set,this.source=null,this.retryDelay=Nn,this.reconnectTimer=null,this.connect()}connect(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.source&&this.source.close(),ct("Connecting to backend events stream"),this.source=ee.connectEvents(t=>this.dispatch(t),()=>this.scheduleReconnect(),t=>{ee.sendClientConnectionPong({...Xt(),pingTs:t.ts}).catch(n=>{Qt.error("Failed to send client connection pong",n)})}),this.source.onopen=()=>{ct("Events stream connected"),this.retryDelay=Nn,this.openHandlers.forEach(t=>t())}}scheduleReconnect(){if(this.reconnectTimer!==null)return;const t=this.source;this.source=null,ct("Events stream disconnected, scheduling reconnect",{delayMs:this.retryDelay}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryDelay=Math.min(this.retryDelay*2,_i),this.connect()},this.retryDelay),t==null||t.close()}dispatch(t){var n,r;ct(`event ${t.type}`),(n=this.handlers.get("*"))==null||n.forEach(o=>o(t)),(r=this.handlers.get(t.type))==null||r.forEach(o=>o(t))}on(t,n){this.handlers.has(t)||this.handlers.set(t,new Set);const r=this.handlers.get(t);return r.add(n),()=>r.delete(n)}onOpen(t){return this.openHandlers.add(t),()=>this.openHandlers.delete(t)}}const Vt=new ji,Vi=Ce("actions"),Un={messageHistory:[],agentModelSelections:{}};function Bn(e,t){if(e===t)return!0;if(typeof e=="object"&&e!==null&&typeof t=="object"&&t!==null)try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){Vi.warn("Failed to compare config objects",n)}return!1}class Wi{constructor(){this.configOwnerCache=new Map,this.stateOwnerCache=new Map,this.configOwnerLoadPromises=new Map,this.stateOwnerLoadPromises=new Map,this.configOwnerListeners=new Map,this.stateOwnerListeners=new Map,this.instanceDataCache=new Map,this.instanceDataListeners=new Map,this.instanceLoadPromises=new Map,Vt.on("storage.configChanged",t=>{t.type==="storage.configChanged"&&this.setOwnerCache("config",t.owner,t.value)}),Vt.on("storage.stateChanged",t=>{t.type==="storage.stateChanged"&&this.setOwnerCache("state",t.owner,t.value)}),Vt.on("instance.dataChanged",t=>{t.type==="instance.dataChanged"&&this.setInstanceDataCache(t.instanceId,t.data)})}async loadConfigOwner(t){const n=this.configOwnerCache.get(t);if(n)return n;if(!this.configOwnerLoadPromises.has(t)){const r=ee.fetchConfigOwner(t).then(o=>(this.setOwnerCache("config",t,o),o)).finally(()=>{this.configOwnerLoadPromises.delete(t)});this.configOwnerLoadPromises.set(t,r)}return this.configOwnerLoadPromises.get(t)}async patchConfigOwner(t,n){const r=await ee.patchConfigOwner(t,n);return this.setOwnerCache("config",t,r),r}async loadStateOwner(t){const n=this.stateOwnerCache.get(t);if(n)return n;if(!this.stateOwnerLoadPromises.has(t)){const r=ee.fetchStateOwner(t).then(o=>(this.setOwnerCache("state",t,o),o)).finally(()=>{this.stateOwnerLoadPromises.delete(t)});this.stateOwnerLoadPromises.set(t,r)}return this.stateOwnerLoadPromises.get(t)}async patchStateOwner(t,n){const r=await ee.patchStateOwner(t,n);return this.setOwnerCache("state",t,r),r}async loadInstanceData(t){const n=this.instanceDataCache.get(t);if(n)return n;if(!this.instanceLoadPromises.has(t)){const r=ee.readInstanceData(t).then(o=>{const s=this.normalizeInstanceData(o);return this.setInstanceDataCache(t,s),s}).finally(()=>{this.instanceLoadPromises.delete(t)});this.instanceLoadPromises.set(t,r)}return this.instanceLoadPromises.get(t)}async saveInstanceData(t,n){const r=this.normalizeInstanceData(n);await ee.writeInstanceData(t,r),this.setInstanceDataCache(t,r)}async deleteInstanceData(t){await ee.deleteInstanceData(t),this.setInstanceDataCache(t,Un)}onConfigOwnerChanged(t,n){this.configOwnerListeners.has(t)||this.configOwnerListeners.set(t,new Set);const r=this.configOwnerListeners.get(t);r.add(n);const o=this.configOwnerCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.configOwnerListeners.delete(t)}}onStateOwnerChanged(t,n){this.stateOwnerListeners.has(t)||this.stateOwnerListeners.set(t,new Set);const r=this.stateOwnerListeners.get(t);r.add(n);const o=this.stateOwnerCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.stateOwnerListeners.delete(t)}}onInstanceDataChanged(t,n){this.instanceDataListeners.has(t)||this.instanceDataListeners.set(t,new Set);const r=this.instanceDataListeners.get(t);r.add(n);const o=this.instanceDataCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.instanceDataListeners.delete(t)}}setOwnerCache(t,n,r){if(n==="*"){t==="config"?this.configOwnerCache.clear():this.stateOwnerCache.clear();return}const o=t==="config"?this.configOwnerCache:this.stateOwnerCache,s=t==="config"?this.configOwnerListeners:this.stateOwnerListeners,i=o.get(n);if(i&&Bn(i,r)){o.set(n,r);return}o.set(n,r);const a=s.get(n);if(a)for(const c of a)c(r)}normalizeInstanceData(t){const n=t??Un,r=Array.isArray(n.messageHistory)?[...n.messageHistory]:[],o={...n.agentModelSelections??{}};return{...n,messageHistory:r,agentModelSelections:o}}setInstanceDataCache(t,n){const r=this.normalizeInstanceData(n),o=this.instanceDataCache.get(t);if(o&&Bn(o,r)){this.instanceDataCache.set(t,r);return}this.instanceDataCache.set(t,r),this.notifyInstanceDataChanged(t,r)}notifyInstanceDataChanged(t,n){const r=this.instanceDataListeners.get(t);if(r)for(const o of r)o(n)}}const Y=new Wi,Ir=Ce("api"),Pt={messageHistory:[],agentModelSelections:{}},[fn,Lr]=M(new Map),lt=new Map,Fe=new Map;function Dr(e){const t=e??Pt;return{...t,messageHistory:Array.isArray(t.messageHistory)?[...t.messageHistory]:[],agentModelSelections:{...t.agentModelSelections??{}}}}function _n(e){if(Fe.has(e))return;const t=Y.onInstanceDataChanged(e,n=>{wt(e,n)});Fe.set(e,t)}function zi(e){const t=Fe.get(e);t&&(t(),Fe.delete(e))}function wt(e,t){Lr(n=>{const r=new Map(n);return r.set(e,Dr(t)),r})}async function It(e){if(!e||fn().has(e))return;if(lt.has(e)){await lt.get(e);return}const t=Y.loadInstanceData(e).then(n=>{wt(e,n),_n(e)}).catch(n=>{Ir.warn("Failed to load instance data",n),wt(e,Pt),_n(e)}).finally(()=>{lt.delete(e)});lt.set(e,t),await t}async function Fr(e,t){if(!e)return;await It(e);const n=fn().get(e)??Pt,r=Dr(n);t(r);try{await Y.saveInstanceData(e,r)}catch(o){Ir.warn("Failed to persist instance data",o)}wt(e,r)}function Rr(e){return fn().get(e)??Pt}function Ki(e){Lr(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),zi(e)}const Hi=Ne(),Gi={getInstanceConfig:Rr,ensureInstanceConfig:It,updateInstanceConfig:Fr,clearInstanceConfig:Ki},Qc=e=>(le(()=>{for(const t of Fe.values())t();Fe.clear()}),ue(Hi.Provider,{value:Gi,get children(){return e.children}})),Ji=Ce("api"),[jn,en]=M(null),[el,Vn]=M(!1),[tl,gt]=M(null);let _e=null;async function qi(e=!1){return!e&&jn()?jn():_e||(Vn(!0),gt(null),_e=ee.fetchSpeechCapabilities().then(t=>(en(t),gt(null),t)).catch(t=>(Ji.error("Failed to load speech capabilities",t),en(null),gt(t instanceof Error?t.message:String(t)),null)).finally(()=>{Vn(!1),_e=null}),_e)}function Xi(){en(null),gt(null)}const A=Ce("actions"),Yi=20,Zi=5,Qi=50,T={showThinkingBlocks:!1,showKeyboardShortcutHints:!0,thinkingBlocksExpansion:"expanded",showMessageTimeline:!0,showTimelineTools:!0,holdLongAssistantReplies:!0,promptSubmitOnEnter:!1,showPromptVoiceInput:!0,diffViewMode:"split",toolOutputExpansion:"expanded",diagnosticsExpansion:"expanded",toolInputsVisibility:"collapsed",showUsageMetrics:!0,autoCleanupBlankSessions:!0,keepUnseenSubagentIdleStatus:!1,osNotificationsEnabled:!1,osNotificationsAllowWhenVisible:!1,notifyOnNeedsInput:!0,notifyOnIdle:!0},ve={provider:"openai-compatible",sttModel:"gpt-4o-mini-transcribe",ttsModel:"gpt-4o-mini-tts",ttsVoice:"alloy",playbackMode:"streaming",ttsFormat:"mp3"};function Nr(e){const t=e??{};return{showThinkingBlocks:t.showThinkingBlocks??T.showThinkingBlocks,showKeyboardShortcutHints:t.showKeyboardShortcutHints??T.showKeyboardShortcutHints,thinkingBlocksExpansion:t.thinkingBlocksExpansion??T.thinkingBlocksExpansion,showMessageTimeline:t.showMessageTimeline??T.showMessageTimeline,showTimelineTools:t.showTimelineTools??T.showTimelineTools,holdLongAssistantReplies:t.holdLongAssistantReplies??T.holdLongAssistantReplies,promptSubmitOnEnter:t.promptSubmitOnEnter??T.promptSubmitOnEnter,showPromptVoiceInput:t.showPromptVoiceInput??T.showPromptVoiceInput,locale:t.locale??T.locale,diffViewMode:t.diffViewMode??T.diffViewMode,toolOutputExpansion:t.toolOutputExpansion??T.toolOutputExpansion,diagnosticsExpansion:t.diagnosticsExpansion??T.diagnosticsExpansion,toolInputsVisibility:t.toolInputsVisibility==="hidden"||t.toolInputsVisibility==="collapsed"||t.toolInputsVisibility==="expanded"?t.toolInputsVisibility:T.toolInputsVisibility,showUsageMetrics:t.showUsageMetrics??T.showUsageMetrics,autoCleanupBlankSessions:t.autoCleanupBlankSessions??T.autoCleanupBlankSessions,keepUnseenSubagentIdleStatus:t.keepUnseenSubagentIdleStatus??T.keepUnseenSubagentIdleStatus,osNotificationsEnabled:t.osNotificationsEnabled??T.osNotificationsEnabled,osNotificationsAllowWhenVisible:t.osNotificationsAllowWhenVisible??T.osNotificationsAllowWhenVisible,notifyOnNeedsInput:t.notifyOnNeedsInput??T.notifyOnNeedsInput,notifyOnIdle:t.notifyOnIdle??T.notifyOnIdle}}function Ur(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return t}function Br(e){const t=e??{};return{provider:t.provider==="openai-compatible"?t.provider:ve.provider,apiKey:typeof t.apiKey=="string"&&t.apiKey.trim()?t.apiKey.trim():void 0,hasApiKey:t.hasApiKey===!0||typeof t.apiKey=="string"&&t.apiKey.trim().length>0,baseUrl:typeof t.baseUrl=="string"&&t.baseUrl.trim()?t.baseUrl.trim():void 0,sttModel:typeof t.sttModel=="string"&&t.sttModel.trim()?t.sttModel.trim():ve.sttModel,ttsModel:typeof t.ttsModel=="string"&&t.ttsModel.trim()?t.ttsModel.trim():ve.ttsModel,ttsVoice:typeof t.ttsVoice=="string"&&t.ttsVoice.trim()?t.ttsVoice.trim():ve.ttsVoice,playbackMode:t.playbackMode==="buffered"||t.playbackMode==="streaming"?t.playbackMode:ve.playbackMode,ttsFormat:t.ttsFormat==="wav"||t.ttsFormat==="opus"||t.ttsFormat==="aac"||t.ttsFormat==="mp3"?t.ttsFormat:ve.ttsFormat}}function je(e,t){if(!Array.isArray(e))return[];const n=[];for(const r of e){const o=t(r);o&&n.push(o)}return n}function ea(e){var n,r,o;const t=e??{};return{recentFolders:je(t.recentFolders,s=>{if(!s||typeof s!="object")return null;const i=s.path,a=s.lastAccessed;if(typeof i!="string")return null;const c=typeof a=="number"?a:Date.now();return{path:i,lastAccessed:c}}),opencodeBinaries:je(t.opencodeBinaries,s=>{if(!s||typeof s!="object")return null;const i=s.path;if(typeof i!="string")return null;const a=typeof s.lastUsed=="number"?s.lastUsed:Date.now(),c=typeof s.version=="string"?s.version:void 0,l=typeof s.label=="string"?s.label:void 0;return{path:i,version:c,label:l,lastUsed:a}}),remoteServers:je(t.remoteServers,s=>{if(!s||typeof s!="object")return null;const i=typeof s.id=="string"?s.id.trim():"",a=typeof s.name=="string"?s.name.trim():"",c=typeof s.baseUrl=="string"?s.baseUrl.trim():"";if(!i||!a||!c)return null;const l=typeof s.createdAt=="string"?s.createdAt:new Date().toISOString(),u=typeof s.updatedAt=="string"?s.updatedAt:l,d=typeof s.lastConnectedAt=="string"?s.lastConnectedAt:void 0;return{id:i,name:a,baseUrl:c,skipTlsVerify:!!s.skipTlsVerify,createdAt:l,updatedAt:u,lastConnectedAt:d}}).sort((s,i)=>{const a=s.lastConnectedAt??s.updatedAt;return(i.lastConnectedAt??i.updatedAt).localeCompare(a)}),models:{recents:je((n=t.models)==null?void 0:n.recents,s=>{if(!s||typeof s!="object")return null;const i=s.providerId,a=s.modelId;return typeof i!="string"||typeof a!="string"?null:{providerId:i,modelId:a}}),favorites:je((r=t.models)==null?void 0:r.favorites,s=>{if(!s||typeof s!="object")return null;const i=s.providerId,a=s.modelId;return typeof i!="string"||typeof a!="string"?null:{providerId:i,modelId:a}}),thinkingSelections:Ur((o=t.models)==null?void 0:o.thinkingSelections)}}}function ta(e){const t=e??{},n=t.listeningMode==="all"?"all":"local",r=t.logLevel==="INFO"||t.logLevel==="WARN"||t.logLevel==="ERROR"||t.logLevel==="DEBUG"?t.logLevel:"DEBUG",o=typeof t.opencodeBinary=="string"&&t.opencodeBinary.trim()?t.opencodeBinary:"opencode",s=Ur(t.environmentVariables),i=Br(t.speech);return{listeningMode:n,logLevel:r,opencodeBinary:o,environmentVariables:s,speech:i}}function _r(e){return`${e.providerId}/${e.modelId}`}function jr(e,t){const n=t.filter(r=>r.path!==e);return n.unshift({path:e,lastAccessed:Date.now()}),n.slice(0,Yi)}function gn(e,t,n){const r=Date.now(),o=n.find(i=>i.path===e);if(o){const i={...o,lastUsed:r,version:t??o.version},a=n.filter(c=>c.path!==e);return[i,...a]}return[t?{path:e,version:t,lastUsed:r}:{path:e,lastUsed:r},...n].slice(0,10)}function na(e,t){const n=e.id?t.find(o=>o.id===e.id):void 0,r=new Date().toISOString();return{id:(n==null?void 0:n.id)??e.id??ra(),name:e.name.trim(),baseUrl:e.baseUrl.trim(),skipTlsVerify:!!e.skipTlsVerify,createdAt:(n==null?void 0:n.createdAt)??r,updatedAt:r,lastConnectedAt:n==null?void 0:n.lastConnectedAt}}function Vr(e,t){const n=t.filter(r=>r.id!==e.id);return[e,...n].sort((r,o)=>{const s=r.lastConnectedAt??r.updatedAt;return(o.lastConnectedAt??o.updatedAt).localeCompare(s)})}function ra(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`remote-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const[hn,Ct]=M({}),[oa,St]=M({}),[sa,xt]=M({}),[Wr,He]=M(!1),ia=L(()=>Nr(hn().settings)),zr=L(()=>hn().theme??"system"),Se=L(()=>ta(oa())),re=L(()=>ea(sa())),B=ia,Lt=L(()=>re().recentFolders),et=L(()=>re().opencodeBinaries),Re=L(()=>re().remoteServers);let ut=null;async function Dt(){Wr()||(ut||(ut=Promise.all([Y.loadConfigOwner("ui"),Y.loadConfigOwner("server"),Y.loadStateOwner("ui")]).then(([e,t,n])=>{Ct(e),St(t),xt(n),He(!0)}).catch(e=>{A.error("Failed to load settings",e),Ct({}),St({}),xt({}),He(!0)}).finally(()=>{ut=null})),await ut)}async function se(e,t){await Dt();const n=await Y.patchConfigOwner(e,t);e==="ui"&&Ct(n),e==="server"&&St(n)}async function G(e,t){await Dt();const n=await Y.patchStateOwner(e,t);xt(n)}function W(e){const t=hn(),r={settings:Nr({...t.settings??{},...e})};se("ui",r).catch(o=>A.error("Failed to patch ui settings",o))}function Kr(e){W(e)}function aa(e){zr()!==e&&se("ui",{theme:e}).catch(t=>A.error("Failed to set theme",t))}async function ca(e){Se().listeningMode!==e&&await se("server",{listeningMode:e})}function mn(e){se("server",{environmentVariables:e}).catch(t=>A.error("Failed to update environment variables",t))}function la(e,t){const n=Se().environmentVariables;mn({...n,[e]:t})}function ua(e){const t=Se().environmentVariables,{[e]:n,...r}=t;mn(r)}function da(e){const t=e&&e.trim().length>0?e:"opencode";se("server",{opencodeBinary:t}).catch(r=>A.error("Failed to set default binary",r));const n=gn(t,void 0,et());G("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to update binary list",r))}function fa(e){se("server",{logLevel:e??"DEBUG"}).catch(n=>A.error("Failed to set log level",n))}async function ga(e){const t=e.apiKey,{apiKey:n,...r}=e,o=Br({...Se().speech,...r,...t===null?{}:{apiKey:t}}),{hasApiKey:s,...i}=o,a={...i,...t===null?{apiKey:null}:{}};try{await se("server",{speech:a})}catch(c){throw A.error("Failed to update speech settings",c),c}}function ha(e,t){const n=gn(e,t,et());G("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to add binary",r))}function ma(e){const t=et().filter(n=>n.path!==e);G("ui",{opencodeBinaries:t}).catch(n=>A.error("Failed to remove binary",n)),Se().opencodeBinary===e&&se("server",{opencodeBinary:"opencode"}).catch(n=>A.error("Failed to reset default binary",n))}function pa(e){const t=jr(e,Lt());G("ui",{recentFolders:t}).catch(n=>A.error("Failed to add recent folder",n))}function ya(e){const t=Lt().filter(n=>n.path!==e);G("ui",{recentFolders:t}).catch(n=>A.error("Failed to remove recent folder",n))}async function ba(e){const t=na(e,Re());return await G("ui",{remoteServers:Vr(t,Re())}),t}async function wa(e){const t=Re().find(o=>o.id===e);if(!t)return;const n=new Date().toISOString(),r={...t,updatedAt:n,lastConnectedAt:n};await G("ui",{remoteServers:Vr(r,Re())})}function Ca(e){const t=Re().filter(n=>n.id!==e);G("ui",{remoteServers:t}).catch(n=>A.error("Failed to remove remote server",n))}function Sa(e,t){const n=t&&t.trim().length>0?t:Se().opencodeBinary,r=jr(e,Lt()),o=gn(n,void 0,et());G("ui",{recentFolders:r,opencodeBinaries:o}).catch(s=>A.error("Failed to update ui state on launch",s)),se("server",{opencodeBinary:n}).catch(s=>A.error("Failed to persist selected binary",s))}function xa(e){if(!e.providerId||!e.modelId)return;const n=re().models.recents.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId),r=[e,...n].slice(0,Zi);G("ui",{models:{recents:r}}).catch(o=>A.error("Failed to update model recents",o))}function Oa(e){return!e.providerId||!e.modelId?!1:re().models.favorites.some(t=>t.providerId===e.providerId&&t.modelId===e.modelId)}function va(e){if(!e.providerId||!e.modelId)return;const t=re().models.favorites,r=t.some(o=>o.providerId===e.providerId&&o.modelId===e.modelId)?t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId):[e,...t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId)].slice(0,Qi);G("ui",{models:{favorites:r}}).catch(o=>A.error("Failed to update model favorites",o))}function ka(e){if(!(!e.providerId||!e.modelId))return re().models.thinkingSelections[_r(e)]}function $a(e,t){if(!e.providerId||!e.modelId)return;const n=_r(e);if(re().models.thinkingSelections[n]===t)return;const o={...re().models.thinkingSelections};t?o[n]=t:delete o[n],G("ui",{models:{thinkingSelections:o}}).catch(s=>A.error("Failed to update thinking selection",s))}function Aa(e){B().diffViewMode!==e&&W({diffViewMode:e})}function Ta(e){B().toolOutputExpansion!==e&&W({toolOutputExpansion:e})}function Ma(e){B().diagnosticsExpansion!==e&&W({diagnosticsExpansion:e})}function Ea(e){B().toolInputsVisibility!==e&&W({toolInputsVisibility:e})}function Pa(e){B().thinkingBlocksExpansion!==e&&W({thinkingBlocksExpansion:e})}function Ia(){W({showThinkingBlocks:!B().showThinkingBlocks})}function La(){Kr({showKeyboardShortcutHints:!B().showKeyboardShortcutHints})}function Da(){W({showTimelineTools:!B().showTimelineTools})}function Fa(){W({showMessageTimeline:!(B().showMessageTimeline??!0)})}function Ra(){W({showUsageMetrics:!B().showUsageMetrics})}function Na(){W({promptSubmitOnEnter:!B().promptSubmitOnEnter})}function Ua(){W({showPromptVoiceInput:!B().showPromptVoiceInput})}function Ba(){const e=!B().autoCleanupBlankSessions;A.info("toggle auto cleanup",{value:e}),W({autoCleanupBlankSessions:e})}async function _a(e,t,n){!e||!t||!n.providerId||!n.modelId||(await It(e),await Fr(e,r=>{const o={...r.agentModelSelections??{}},s=o[t];s&&s.providerId===n.providerId&&s.modelId===n.modelId||(o[t]=n,r.agentModelSelections=o)}))}async function ja(e,t){return!e||!t?void 0:(await It(e),(Rr(e).agentModelSelections??{})[t])}Dt().catch(e=>{A.error("Failed to initialize settings",e)});const Hr=Ne(),Va={isLoaded:Wr,preferences:B,updatePreferences:Kr,themePreference:zr,setThemePreference:aa,serverSettings:Se,setListeningMode:ca,updateEnvironmentVariables:mn,addEnvironmentVariable:la,removeEnvironmentVariable:ua,updateLastUsedBinary:da,updateLogLevel:fa,updateSpeechSettings:ga,recentFolders:Lt,opencodeBinaries:et,remoteServers:Re,uiState:re,addRecentFolder:pa,removeRecentFolder:ya,addOpenCodeBinary:ha,removeOpenCodeBinary:ma,saveRemoteServerProfile:ba,markRemoteServerConnected:wa,removeRemoteServerProfile:Ca,recordWorkspaceLaunch:Sa,addRecentModelPreference:xa,isFavoriteModelPreference:Oa,toggleFavoriteModelPreference:va,getModelThinkingSelection:ka,setModelThinkingSelection:$a,toggleShowThinkingBlocks:Ia,toggleKeyboardShortcutHints:La,toggleShowMessageTimeline:Fa,toggleShowTimelineTools:Da,toggleUsageMetrics:Ra,toggleAutoCleanupBlankSessions:Ba,togglePromptSubmitOnEnter:Na,toggleShowPromptVoiceInput:Ua,setDiffViewMode:Aa,setToolOutputExpansion:Ta,setDiagnosticsExpansion:Ma,setThinkingBlocksExpansion:Pa,setToolInputsVisibility:Ea,setAgentModelPreference:_a,getAgentModelPreference:ja},nl=e=>($t(()=>{Dt().catch(o=>{A.error("Failed to initialize settings",o)});const t=Y.onConfigOwnerChanged("ui",o=>{Ct(o),He(!0)}),n=Y.onConfigOwnerChanged("server",o=>{St(o),He(!0),Xi(),qi(!0)}),r=Y.onStateOwnerChanged("ui",o=>{xt(o),He(!0)});return()=>{t(),n(),r()}}),ue(Hr.Provider,{value:Va,get children(){return e.children}}));function Wa(){const e=Ye(Hr);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e}function za(e,t,n){const r={};return Object.keys(e).forEach(o=>{r[o]=e[o].reduce((s,i)=>(i&&(n&&n[i]&&s.push(n[i]),s.push(t(i))),s),[]).join(" ")}),r}const Ka=Symbol("solid-inspect"),Ha=Ne();function Ga(e){function t(n){var r;return(r=Ye(Ha))!=null&&r.enabled?{Component:t,props:n,$INSPECT:Ka}:e(n)}return Object.defineProperty(t,"name",{value:e.name}),t.toString=e.toString,t}function Gr(){return function(e){function t(a){const c=!!e.slotClasses,l=()=>{if(!e.slotClasses)throw new Error("'slotClasses' option is not defined");if(!e.utilityClass)throw new Error("'utilityClass' option is not defined");return za(e.slotClasses(a),e.utilityClass,a.classes??"")},u=No({});return c&&io(()=>{const d=l();Ae(()=>{for(const g in d)u[g]=d[g]})}),u}function n(a){const[c,l]=kt(a,e.selfPropNames);return{allProps:a,props:c,otherProps:l}}function r(a){return $s({propDefaults:a.propDefaults||e.propDefaults,props:a.props,name:e.name})}function o(a){const c=r({props:a});return n(c)}function s(a,c=!0){return a=Ga(a),a.toString=()=>`.${e.name}-root`,c&&Ar(a,"base"),a}function i(a){const c=s(function(u){const{allProps:d,otherProps:g,props:m}=o(u),p=e.autoCallUseClasses??!0?t(d):{};return a({allProps:d,otherProps:g,props:m,classes:p})});return Object.defineProperty(c,"name",{value:a.name}),c}return{name:e.name,selfPropNames:e.selfPropNames,component:i,defineComponent:s,useClasses:t,useThemeProps:r,useProps:o,splitInProps:n}}}const Ja=Gr()({name:"MuiGlobalStyles",selfPropNames:["styles"]}),qa=Ja.component(function({props:t}){return Sr(()=>({"@global":t.styles||{}})),[]}),Xa=Gr()({name:"MuiCssBaseline",selfPropNames:["children","enableColorScheme"],propDefaults:({set:e})=>e({enableColorScheme:!1})}),Ya=(e,t)=>({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%",...t&&{colorScheme:e.palette.mode}}),Za=e=>({color:e.palette.text.primary,...e.typography.body1,backgroundColor:e.palette.background.default,"@media print":{backgroundColor:e.palette.common.white}}),Qa=(e,t=!1)=>({html:Ya(e,t),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...Za(e),"&::backdrop":{backgroundColor:e.palette.background.default}}}),ec=Xa.component(function({props:t}){const n=fr();return ue(qa,{get styles(){return Qa(n,t.enableColorScheme)}})}),Jr=Ne();function Wn(e){if(!(typeof document>"u")){if(e==="system"){document.documentElement.removeAttribute("data-theme");return}document.documentElement.setAttribute("data-theme",e)}}const tc={backgroundDefault:"#ffffff",backgroundPaper:"#f5f5f5",primary:"#0066ff",primaryContrast:"#ffffff",textPrimary:"#1a1a1a",textSecondary:"#666666",divider:"#e0e0e0"},nc={backgroundDefault:"#1a1a1a",backgroundPaper:"#2a2a2a",primary:"#0080ff",primaryContrast:"#1a1a1a",textPrimary:"#cfd4dc",textSecondary:"#999999",divider:"#3a3a3a"},he=(e,t,n)=>{if(!n)return t;const r=n.getPropertyValue(e);return r&&r.trim()||t},rc=e=>{const t=e?nc:tc,n=typeof window<"u"?getComputedStyle(document.documentElement):null;return{backgroundDefault:he("--surface-base",t.backgroundDefault,n),backgroundPaper:he("--surface-secondary",t.backgroundPaper,n),primary:he("--accent-primary",t.primary,n),primaryContrast:he("--text-inverted",t.primaryContrast,n),textPrimary:he("--text-primary",t.textPrimary,n),textSecondary:he("--text-secondary",t.textSecondary,n),divider:he("--border-base",t.divider,n)}};function rl(e){const t=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,{themePreference:n,setThemePreference:r}=Wa(),[o,s]=M(!0),[i,a]=M(0),c=()=>n(),l=()=>{const p=c();return p==="dark"?!0:p==="light"?!1:(t==null?void 0:t.matches)??!1},u=()=>{const p=c(),C=l();Wn(p==="system"?"system":p),s(C),typeof window<"u"?requestAnimationFrame(()=>a(b=>b+1)):a(b=>b+1)};K(()=>{u()}),$t(()=>{if(!t)return;const p=()=>{u()};return t.addEventListener("change",p),()=>{t.removeEventListener("change",p)}});const d=p=>{r(p)},g=()=>{const p=c();d(p==="system"?"light":p==="light"?"dark":"system")},m=L(()=>{i();const p=rc(o());return lr({palette:{mode:o()?"dark":"light",primary:{main:p.primary,contrastText:p.primaryContrast},secondary:{main:p.primary},background:{default:p.backgroundDefault,paper:p.backgroundPaper},text:{primary:p.textPrimary,secondary:p.textSecondary},divider:p.divider},typography:{fontFamily:"var(--font-family-sans)"},shape:{borderRadius:8},components:{MuiIconButton:{styleOverrides:{root:{color:"inherit","&.Mui-disabled":{color:"var(--text-muted)",opacity:.55}}}},MuiDrawer:{styleOverrides:{paper:{backgroundColor:"var(--surface-secondary)",color:"var(--text-primary)"}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:"var(--surface-secondary)",color:"var(--text-primary)",boxShadow:"none",borderBottom:"1px solid var(--border-base)",zIndex:10}}},MuiToolbar:{styleOverrides:{root:{minHeight:"56px"}}}}})});return ue(Jr.Provider,{value:{isDark:o,themeMode:c,setThemeMode:d,cycleThemeMode:g},get children(){return ue(As,{get theme(){return m()},get children(){return[ue(ec,{}),bo(()=>e.children)]}})}})}function qr(){const e=Ye(Jr);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const oc=/(^|\n)@@/m,sc=/(^|\n)(diff --git |--- |\+\+\+)/,ic=/^\*\*\* (Begin|End) Patch/,ac=/^\*\*\* Update File: (.+)$/,cc=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function lc(e){const t=e.trim();if(!t.startsWith("```"))return t;const n=t.split(`
|
|
16
16
|
`);return n.length<2?"":n[n.length-1].startsWith("```")?n.slice(1,-1).join(`
|
|
17
17
|
`):t}function uc(e){var s;if(!e)return"";const n=lc(e.replace(/\r\n/g,`
|
|
18
18
|
`)).split(`
|