qraftbox 0.0.1 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,406 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-CU67Zn6k.js","assets/html-GMplVEZG.js","assets/javascript-wDzz0qaB.js","assets/css-DPfMkruS.js","assets/angular-ts-BwZT4LLn.js","assets/scss-OYdSNvt2.js","assets/apl-dKokRX4l.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-CbQHKStN.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-D4QpJJKB.js","assets/html-derivative-BFtXZ54Q.js","assets/sql-BLtJtn59.js","assets/bsl-BO_Y6i37.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/cobol-nwyudZeR.js","assets/coffee-Ch7k5sss.js","assets/cpp-CofmeUqb.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/c-BIGW1oBm.js","assets/crystal-tKQVLTB8.js","assets/shellscript-Yzrsuije.js","assets/edge-BkV0erSs.js","assets/elixir-CDX3lj18.js","assets/elm-DbKCFpqz.js","assets/erb-CgJxNhIT.js","assets/ruby-Cw6WdidG.js","assets/haml-B8DHNrY2.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-BOOCDP_w.js","assets/gdshader-DkwncUOv.js","assets/gdscript-C5YyOfLZ.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-Rg0-pVw9.js","assets/glimmer-ts-U6CK756n.js","assets/hack-CaT9iCJl.js","assets/handlebars-BL8al0AC.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-Bvhsp5Yf.js","assets/haxe-CzTSHFRz.js","assets/jinja-4LBKfQ-Z.js","assets/jison-wvAkD_A8.js","assets/julia-CxzCAyBv.js","assets/r-Dspwwk_N.js","assets/latex-DGMBWnxU.js","assets/tex-CvyZ59Mk.js","assets/liquid-DYVedYrR.js","assets/marko-DZsq8hO1.js","assets/less-B1dDrJ26.js","assets/mdc-DUICxH0z.js","assets/nginx-BpAMiNFr.js","assets/nim-CVrawwO9.js","assets/perl-C0TMdlhV.js","assets/php-Dhbhpdrm.js","assets/pug-CGlum2m_.js","assets/qml-3beO22l8.js","assets/razor-Uh8Bk_45.js","assets/csharp-COcwbKMJ.js","assets/rst-D5oM4XIm.js","assets/cmake-D1j8_8rp.js","assets/sas-cz2c8ADy.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-Brmx7dQM.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-BH5u7GGu.js","assets/surrealql-Bq5Q-fJD.js","assets/svelte-zxCyuUbr.js","assets/templ-P3uqSqPl.js","assets/go-CxLEBnE3.js","assets/ts-tags-zn1MmPIZ.js","assets/twig-ChbOoGGc.js","assets/vue-DN_0RTcg.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-CQOfvN7w.js","assets/stylus-BEDo0Tqx.js","assets/xsl-CtQFsRM5.js"])))=>i.map(i=>d[i]);
2
+ var ph=Object.defineProperty;var Ul=t=>{throw TypeError(t)};var _h=(t,e,r)=>e in t?ph(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Ee=(t,e,r)=>_h(t,typeof e!="symbol"?e+"":e,r),Jo=(t,e,r)=>e.has(t)||Ul("Cannot "+r);var Oe=(t,e,r)=>(Jo(t,e,"read from private field"),r?r.call(t):e.get(t)),Wt=(t,e,r)=>e.has(t)?Ul("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),jt=(t,e,r,n)=>(Jo(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),Xr=(t,e,r)=>(Jo(t,e,"access private method"),r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const d of s)if(d.type==="childList")for(const _ of d.addedNodes)_.tagName==="LINK"&&_.rel==="modulepreload"&&n(_)}).observe(document,{childList:!0,subtree:!0});function r(s){const d={};return s.integrity&&(d.integrity=s.integrity),s.referrerPolicy&&(d.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?d.credentials="include":s.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function n(s){if(s.ep)return;s.ep=!0;const d=r(s);fetch(s.href,d)}})();const vh="5";var sd;typeof window<"u"&&((sd=window.__svelte??(window.__svelte={})).v??(sd.v=new Set)).add(vh);const gh=1,mh=2,ld=4,bh=8,yh=16,xh=1,wh=4,Sh=8,Ch=16,cd=1,kh=2,Vr=Symbol(),Eh=Symbol("filename"),Ah="http://www.w3.org/1999/xhtml";var od,ad;const Vl=(ad=(od=globalThis.process)==null?void 0:od.env)==null?void 0:ad.NODE_ENV,mt=Vl&&!Vl.toLowerCase().startsWith("prod");var $a=Array.isArray,Th=Array.prototype.indexOf,Ln=Array.prototype.includes,Bo=Array.from,Rn=Object.defineProperty,En=Object.getOwnPropertyDescriptor,Ph=Object.getOwnPropertyDescriptors,Lh=Object.prototype,Rh=Array.prototype,dd=Object.getPrototypeOf,zl=Object.isExtensible;const Wl=()=>{};function Ih(t){for(var e=0;e<t.length;e++)t[e]()}function ud(){var t,e,r=new Promise((n,s)=>{t=n,e=s});return{promise:r,resolve:t,reject:e}}function Dh(t,e){if(Array.isArray(t))return t;if(!(Symbol.iterator in t))return Array.from(t);const r=[];for(const n of t)if(r.push(n),r.length===e)break;return r}const Wr=2,_o=4,No=8,hd=1<<24,$i=16,Ii=32,On=64,el=128,xi=512,jr=1024,$r=2048,en=4096,fi=8192,Ji=16384,tl=32768,$n=65536,vo=1<<17,fd=1<<18,os=1<<19,Mh=1<<20,Xi=1<<25,un=32768,xa=1<<21,jo=1<<22,an=1<<23,An=Symbol("$state"),Oh=Symbol("legacy props"),Bh=Symbol(""),pd=Symbol("proxy path"),Vn=new class extends Error{constructor(){super(...arguments);Ee(this,"name","StaleReactionError");Ee(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function _d(t){if(mt){const e=new Error(`lifecycle_outside_component
3
+ \`${t}(...)\` can only be used during component initialisation
4
+ https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Nh(){if(mt){const t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function ql(){if(mt){const t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function jh(){if(mt){const t=new Error(`derived_references_self
5
+ A derived value cannot reference itself recursively
6
+ https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function Hh(t){if(mt){const e=new Error(`effect_in_teardown
7
+ \`${t}\` cannot be used inside an effect cleanup function
8
+ https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function Fh(){if(mt){const t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Uh(t){if(mt){const e=new Error(`effect_orphan
9
+ \`${t}\` can only be used inside an effect (e.g. during component initialisation)
10
+ https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function Vh(){if(mt){const t=new Error(`effect_update_depth_exceeded
11
+ Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
12
+ https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function zh(t){if(mt){const e=new Error(`props_invalid_value
13
+ Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value
14
+ https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function Wh(t){if(mt){const e=new Error(`rune_outside_svelte
15
+ The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
16
+ https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function qh(){if(mt){const t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Gh(){if(mt){const t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Kh(){if(mt){const t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Xh(){if(mt){const t=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var rl="font-weight: bold",il="font-weight: normal";function Jh(){mt?console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\nhttps://svelte.dev/e/select_multiple_invalid_value",rl,il):console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Yo(t){mt?console.warn(`%c[svelte] state_proxy_equality_mismatch
17
+ %cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results
18
+ https://svelte.dev/e/state_proxy_equality_mismatch`,rl,il):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function Yh(){mt?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",rl,il):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function vd(t){return t===this.v}function Qh(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function gd(t){return!Qh(t,this.v)}let Zh=!1;function Ni(t,e){return t.label=e,md(t.v,e),t}function md(t,e){var r;return(r=t==null?void 0:t[pd])==null||r.call(t,e),t}function $h(t){const e=new Error,r=ef();return r.length===0?null:(r.unshift(`
19
+ `),Rn(e,"stack",{value:r.join(`
20
+ `)}),Rn(e,"name",{value:t}),e)}function ef(){const t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;const e=new Error().stack;if(Error.stackTraceLimit=t,!e)return[];const r=e.split(`
21
+ `),n=[];for(let s=0;s<r.length;s++){const d=r[s],_=d.replaceAll("\\","/");if(d.trim()!=="Error"){if(d.includes("validate_each_keys"))return[];_.includes("svelte/src/internal")||_.includes("node_modules/.vite")||n.push(d)}}return n}let Br=null;function es(t){Br=t}let Rs=null;function go(t){Rs=t}let Vs=null;function Gl(t){Vs=t}function Kt(t,e=!1,r){Br={p:Br,i:!1,c:null,e:null,s:t,x:null,l:null},mt&&(Br.function=r,Vs=r)}function Xt(t){var e=Br,r=e.e;if(r!==null){e.e=null;for(var n of r)Nd(n)}return t!==void 0&&(e.x=t),e.i=!0,Br=e.p,mt&&(Vs=(Br==null?void 0:Br.function)??null),t??{}}function bd(){return!0}let gn=[];function yd(){var t=gn;gn=[],Ih(t)}function Yi(t){if(gn.length===0&&!ks){var e=gn;queueMicrotask(()=>{e===gn&&yd()})}gn.push(t)}function tf(){for(;gn.length>0;)yd()}const wa=new WeakMap;function xd(t){var e=er;if(e===null)return qt.f|=an,t;if(mt&&t instanceof Error&&!wa.has(t)&&wa.set(t,rf(t,e)),(e.f&tl)===0){if((e.f&el)===0)throw mt&&!e.parent&&t instanceof Error&&wd(t),t;e.b.error(t)}else ts(t,e)}function ts(t,e){for(;e!==null;){if((e.f&el)!==0)try{e.b.error(t);return}catch(r){t=r}e=e.parent}throw mt&&t instanceof Error&&wd(t),t}function rf(t,e){var _,o,a;const r=En(t,"message");if(!(r&&!r.configurable)){for(var n=al?" ":" ",s=`
22
+ ${n}in ${((_=e.fn)==null?void 0:_.name)||"<unknown>"}`,d=e.ctx;d!==null;)s+=`
23
+ ${n}in ${(o=d.function)==null?void 0:o[Eh].split("/").pop()}`,d=d.p;return{message:t.message+`
24
+ ${s}
25
+ `,stack:(a=t.stack)==null?void 0:a.split(`
26
+ `).filter(c=>!c.includes("svelte/src/internal")).join(`
27
+ `)}}}function wd(t){const e=wa.get(t);e&&(Rn(t,"message",{value:e.message}),Rn(t,"stack",{value:e.stack}))}const nf=-7169;function Rr(t,e){t.f=t.f&nf|e}function nl(t){(t.f&xi)!==0||t.deps===null?Rr(t,jr):Rr(t,en)}function Sd(t){if(t!==null)for(const e of t)(e.f&Wr)===0||(e.f&un)===0||(e.f^=un,Sd(e.deps))}function Cd(t,e,r){(t.f&$r)!==0?e.add(t):(t.f&en)!==0&&r.add(t),Sd(t.deps),Rr(t,jr)}const Js=new Set;let Nt=null,mo=null,zr=null,ci=[],Ho=null,Sa=!1,ks=!1;var Gn,Kn,yn,Xn,js,Hs,xn,Jn,Wi,Ca,ka,kd;const Fl=class Fl{constructor(){Wt(this,Wi);Ee(this,"committed",!1);Ee(this,"current",new Map);Ee(this,"previous",new Map);Wt(this,Gn,new Set);Wt(this,Kn,new Set);Wt(this,yn,0);Wt(this,Xn,0);Wt(this,js,null);Wt(this,Hs,new Set);Wt(this,xn,new Set);Ee(this,"skipped_effects",new Set);Ee(this,"is_fork",!1);Wt(this,Jn,!1)}is_deferred(){return this.is_fork||Oe(this,Xn)>0}process(e){var s;ci=[],this.apply();var r=[],n=[];for(const d of e)Xr(this,Wi,Ca).call(this,d,r,n);if(this.is_deferred()){Xr(this,Wi,ka).call(this,n),Xr(this,Wi,ka).call(this,r);for(const d of this.skipped_effects)Pd(d)}else{for(const d of Oe(this,Gn))d();Oe(this,Gn).clear(),Oe(this,yn)===0&&Xr(this,Wi,kd).call(this),mo=this,Nt=null,Kl(n),Kl(r),mo=null,(s=Oe(this,js))==null||s.resolve()}zr=null}capture(e,r){r!==Vr&&!this.previous.has(e)&&this.previous.set(e,r),(e.f&an)===0&&(this.current.set(e,e.v),zr==null||zr.set(e,e.v))}activate(){Nt=this,this.apply()}deactivate(){Nt===this&&(Nt=null,zr=null)}flush(){if(this.activate(),ci.length>0){if(Ed(),Nt!==null&&Nt!==this)return}else Oe(this,yn)===0&&this.process([]);this.deactivate()}discard(){for(const e of Oe(this,Kn))e(this);Oe(this,Kn).clear()}increment(e){jt(this,yn,Oe(this,yn)+1),e&&jt(this,Xn,Oe(this,Xn)+1)}decrement(e){jt(this,yn,Oe(this,yn)-1),e&&jt(this,Xn,Oe(this,Xn)-1),!Oe(this,Jn)&&(jt(this,Jn,!0),Yi(()=>{jt(this,Jn,!1),this.is_deferred()?ci.length>0&&this.flush():this.revive()}))}revive(){for(const e of Oe(this,Hs))Oe(this,xn).delete(e),Rr(e,$r),Zi(e);for(const e of Oe(this,xn))Rr(e,en),Zi(e);this.flush()}oncommit(e){Oe(this,Gn).add(e)}ondiscard(e){Oe(this,Kn).add(e)}settled(){return(Oe(this,js)??jt(this,js,ud())).promise}static ensure(){if(Nt===null){const e=Nt=new Fl;Js.add(Nt),ks||Yi(()=>{Nt===e&&e.flush()})}return Nt}apply(){}};Gn=new WeakMap,Kn=new WeakMap,yn=new WeakMap,Xn=new WeakMap,js=new WeakMap,Hs=new WeakMap,xn=new WeakMap,Jn=new WeakMap,Wi=new WeakSet,Ca=function(e,r,n){e.f^=jr;for(var s=e.first,d=null;s!==null;){var _=s.f,o=(_&(Ii|On))!==0,a=o&&(_&jr)!==0,c=a||(_&fi)!==0||this.skipped_effects.has(s);if(!c&&s.fn!==null){o?s.f^=jr:d!==null&&(_&(_o|No|hd))!==0?d.b.defer_effect(s):(_&_o)!==0?r.push(s):Ws(s)&&((_&$i)!==0&&Oe(this,xn).add(s),Is(s));var g=s.first;if(g!==null){s=g;continue}}var h=s.parent;for(s=s.next;s===null&&h!==null;)h===d&&(d=null),s=h.next,h=h.parent}},ka=function(e){for(var r=0;r<e.length;r+=1)Cd(e[r],Oe(this,Hs),Oe(this,xn))},kd=function(){var s;if(Js.size>1){this.previous.clear();var e=zr,r=!0;for(const d of Js){if(d===this){r=!1;continue}const _=[];for(const[a,c]of this.current){if(d.current.has(a))if(r&&c!==d.current.get(a))d.current.set(a,c);else continue;_.push(a)}if(_.length===0)continue;const o=[...d.current.keys()].filter(a=>!this.current.has(a));if(o.length>0){var n=ci;ci=[];const a=new Set,c=new Map;for(const g of _)Ad(g,o,a,c);if(ci.length>0){Nt=d,d.apply();for(const g of ci)Xr(s=d,Wi,Ca).call(s,g,[],[]);d.deactivate()}ci=n}}Nt=null,zr=e}this.committed=!0,Js.delete(this)};let ln=Fl;function sf(t){var e=ks;ks=!0;try{for(var r;;){if(tf(),ci.length===0&&(Nt==null||Nt.flush(),ci.length===0))return Ho=null,r;Ed()}}finally{ks=e}}function Ed(){Sa=!0;var t=mt?new Set:null;try{for(var e=0;ci.length>0;){var r=ln.ensure();if(e++>1e3){if(mt){var n=new Map;for(const d of r.current.keys())for(const[_,o]of d.updated??[]){var s=n.get(_);s||(s={error:o.error,count:0},n.set(_,s)),s.count+=o.count}for(const d of n.values())d.error&&console.error(d.error)}of()}if(r.process(ci),cn.clear(),mt)for(const d of r.current.keys())t.add(d)}}finally{if(Sa=!1,Ho=null,mt)for(const d of t)d.updated=null}}function of(){try{Vh()}catch(t){mt&&Rn(t,"stack",{value:""}),ts(t,Ho)}}let ki=null;function Kl(t){var e=t.length;if(e!==0){for(var r=0;r<e;){var n=t[r++];if((n.f&(Ji|fi))===0&&Ws(n)&&(ki=new Set,Is(n),n.deps===null&&n.first===null&&n.nodes===null&&(n.teardown===null&&n.ac===null?Vd(n):n.fn=null),(ki==null?void 0:ki.size)>0)){cn.clear();for(const s of ki){if((s.f&(Ji|fi))!==0)continue;const d=[s];let _=s.parent;for(;_!==null;)ki.has(_)&&(ki.delete(_),d.push(_)),_=_.parent;for(let o=d.length-1;o>=0;o--){const a=d[o];(a.f&(Ji|fi))===0&&Is(a)}}ki.clear()}}ki=null}}function Ad(t,e,r,n){if(!r.has(t)&&(r.add(t),t.reactions!==null))for(const s of t.reactions){const d=s.f;(d&Wr)!==0?Ad(s,e,r,n):(d&(jo|$i))!==0&&(d&$r)===0&&Td(s,e,n)&&(Rr(s,$r),Zi(s))}}function Td(t,e,r){const n=r.get(t);if(n!==void 0)return n;if(t.deps!==null)for(const s of t.deps){if(Ln.call(e,s))return!0;if((s.f&Wr)!==0&&Td(s,e,r))return r.set(s,!0),!0}return r.set(t,!1),!1}function Zi(t){for(var e=Ho=t;e.parent!==null;){e=e.parent;var r=e.f;if(Sa&&e===er&&(r&$i)!==0&&(r&fd)===0)return;if((r&(On|Ii))!==0){if((r&jr)===0)return;e.f^=jr}}ci.push(e)}function Pd(t){if(!((t.f&Ii)!==0&&(t.f&jr)!==0)){Rr(t,jr);for(var e=t.first;e!==null;)Pd(e),e=e.next}}function af(t){let e=0,r=In(0),n;return mt&&Ni(r,"createSubscriber version"),()=>{cl()&&(i(r),Vo(()=>(e===0&&(n=Bn(()=>t(()=>Es(r)))),e+=1,()=>{Yi(()=>{e-=1,e===0&&(n==null||n(),n=void 0,Es(r))})})))}}var lf=$n|os|el;function cf(t,e,r){new df(t,e,r)}var gi,Za,ji,wn,Hi,mi,ri,Fi,qi,sn,Sn,on,Yn,Cn,Qn,Zn,Ui,Mo,Hr,uf,hf,Ea,ao,lo,Aa;class df{constructor(e,r,n){Wt(this,Hr);Ee(this,"parent");Ee(this,"is_pending",!1);Wt(this,gi);Wt(this,Za,null);Wt(this,ji);Wt(this,wn);Wt(this,Hi);Wt(this,mi,null);Wt(this,ri,null);Wt(this,Fi,null);Wt(this,qi,null);Wt(this,sn,null);Wt(this,Sn,0);Wt(this,on,0);Wt(this,Yn,!1);Wt(this,Cn,!1);Wt(this,Qn,new Set);Wt(this,Zn,new Set);Wt(this,Ui,null);Wt(this,Mo,af(()=>(jt(this,Ui,In(Oe(this,Sn))),mt&&Ni(Oe(this,Ui),"$effect.pending()"),()=>{jt(this,Ui,null)})));jt(this,gi,e),jt(this,ji,r),jt(this,wn,n),this.parent=er.b,this.is_pending=!!Oe(this,ji).pending,jt(this,Hi,ul(()=>{er.b=this;{var s=Xr(this,Hr,Ea).call(this);try{jt(this,mi,bi(()=>n(s)))}catch(d){this.error(d)}Oe(this,on)>0?Xr(this,Hr,lo).call(this):this.is_pending=!1}return()=>{var d;(d=Oe(this,sn))==null||d.remove()}},lf))}defer_effect(e){Cd(e,Oe(this,Qn),Oe(this,Zn))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!Oe(this,ji).pending}update_pending_count(e){Xr(this,Hr,Aa).call(this,e),jt(this,Sn,Oe(this,Sn)+e),!(!Oe(this,Ui)||Oe(this,Yn))&&(jt(this,Yn,!0),Yi(()=>{jt(this,Yn,!1),Oe(this,Ui)&&is(Oe(this,Ui),Oe(this,Sn))}))}get_effect_pending(){return Oe(this,Mo).call(this),i(Oe(this,Ui))}error(e){var r=Oe(this,ji).onerror;let n=Oe(this,ji).failed;if(Oe(this,Cn)||!r&&!n)throw e;Oe(this,mi)&&(ni(Oe(this,mi)),jt(this,mi,null)),Oe(this,ri)&&(ni(Oe(this,ri)),jt(this,ri,null)),Oe(this,Fi)&&(ni(Oe(this,Fi)),jt(this,Fi,null));var s=!1,d=!1;const _=()=>{if(s){Yh();return}s=!0,d&&Xh(),ln.ensure(),jt(this,Sn,0),Oe(this,Fi)!==null&&Tn(Oe(this,Fi),()=>{jt(this,Fi,null)}),this.is_pending=this.has_pending_snippet(),jt(this,mi,Xr(this,Hr,ao).call(this,()=>(jt(this,Cn,!1),bi(()=>Oe(this,wn).call(this,Oe(this,gi)))))),Oe(this,on)>0?Xr(this,Hr,lo).call(this):this.is_pending=!1};Yi(()=>{try{d=!0,r==null||r(e,_),d=!1}catch(o){ts(o,Oe(this,Hi)&&Oe(this,Hi).parent)}n&&jt(this,Fi,Xr(this,Hr,ao).call(this,()=>{ln.ensure(),jt(this,Cn,!0);try{return bi(()=>{n(Oe(this,gi),()=>e,()=>_)})}catch(o){return ts(o,Oe(this,Hi).parent),null}finally{jt(this,Cn,!1)}}))})}}gi=new WeakMap,Za=new WeakMap,ji=new WeakMap,wn=new WeakMap,Hi=new WeakMap,mi=new WeakMap,ri=new WeakMap,Fi=new WeakMap,qi=new WeakMap,sn=new WeakMap,Sn=new WeakMap,on=new WeakMap,Yn=new WeakMap,Cn=new WeakMap,Qn=new WeakMap,Zn=new WeakMap,Ui=new WeakMap,Mo=new WeakMap,Hr=new WeakSet,uf=function(){try{jt(this,mi,bi(()=>Oe(this,wn).call(this,Oe(this,gi))))}catch(e){this.error(e)}},hf=function(){const e=Oe(this,ji).pending;e&&(jt(this,ri,bi(()=>e(Oe(this,gi)))),Yi(()=>{var r=Xr(this,Hr,Ea).call(this);jt(this,mi,Xr(this,Hr,ao).call(this,()=>(ln.ensure(),bi(()=>Oe(this,wn).call(this,r))))),Oe(this,on)>0?Xr(this,Hr,lo).call(this):(Tn(Oe(this,ri),()=>{jt(this,ri,null)}),this.is_pending=!1)}))},Ea=function(){var e=Oe(this,gi);return this.is_pending&&(jt(this,sn,Qi()),Oe(this,gi).before(Oe(this,sn)),e=Oe(this,sn)),e},ao=function(e){var r=er,n=qt,s=Br;Ri(Oe(this,Hi)),Si(Oe(this,Hi)),es(Oe(this,Hi).ctx);try{return e()}catch(d){return xd(d),null}finally{Ri(r),Si(n),es(s)}},lo=function(){const e=Oe(this,ji).pending;Oe(this,mi)!==null&&(jt(this,qi,document.createDocumentFragment()),Oe(this,qi).append(Oe(this,sn)),qd(Oe(this,mi),Oe(this,qi))),Oe(this,ri)===null&&jt(this,ri,bi(()=>e(Oe(this,gi))))},Aa=function(e){var r;if(!this.has_pending_snippet()){this.parent&&Xr(r=this.parent,Hr,Aa).call(r,e);return}if(jt(this,on,Oe(this,on)+e),Oe(this,on)===0){this.is_pending=!1;for(const n of Oe(this,Qn))Rr(n,$r),Zi(n);for(const n of Oe(this,Zn))Rr(n,en),Zi(n);Oe(this,Qn).clear(),Oe(this,Zn).clear(),Oe(this,ri)&&Tn(Oe(this,ri),()=>{jt(this,ri,null)}),Oe(this,qi)&&(Oe(this,gi).before(Oe(this,qi)),jt(this,qi,null))}};function ff(t,e,r,n){const s=Fo;var d=t.filter(v=>!v.settled);if(r.length===0&&d.length===0){n(e.map(s));return}var _=Nt,o=er,a=pf(),c=d.length===1?d[0].promise:d.length>1?Promise.all(d.map(v=>v.promise)):null;function g(v){a();try{n(v)}catch(m){(o.f&Ji)===0&&ts(m,o)}_==null||_.deactivate(),Ta()}if(r.length===0){c.then(()=>g(e.map(s)));return}function h(){a(),Promise.all(r.map(v=>vf(v))).then(v=>g([...e.map(s),...v])).catch(v=>ts(v,o))}c?c.then(h):h()}function pf(){var t=er,e=qt,r=Br,n=Nt;if(mt)var s=Rs;return function(_=!0){Ri(t),Si(e),es(r),_&&(n==null||n.activate()),mt&&go(s)}}function Ta(){Ri(null),Si(null),es(null),mt&&go(null)}const _f=new Set;function Fo(t){var e=Wr|$r,r=qt!==null&&(qt.f&Wr)!==0?qt:null;return er!==null&&(er.f|=os),{ctx:Br,deps:null,effects:null,equals:vd,f:e,fn:t,reactions:null,rv:0,v:Vr,wv:0,parent:r??er,ac:null}}function vf(t,e,r){let n=er;n===null&&Nh();var s=n.b,d=void 0,_=In(Vr);mt&&(_.label=e);var o=!qt,a=new Map;return Rf(()=>{var m;var c=ud();d=c.promise;try{Promise.resolve(t()).then(c.resolve,c.reject).then(()=>{g===Nt&&g.committed&&g.deactivate(),Ta()})}catch(w){c.reject(w),Ta()}var g=Nt;if(o){var h=s.is_rendered();s.update_pending_count(1),g.increment(h),(m=a.get(g))==null||m.reject(Vn),a.delete(g),a.set(g,c)}const v=(w,b=void 0)=>{if(g.activate(),b)b!==Vn&&(_.f|=an,is(_,b));else{(_.f&an)!==0&&(_.f^=an),is(_,w);for(const[f,u]of a){if(a.delete(f),f===g)break;u.reject(Vn)}}o&&(s.update_pending_count(-1),g.decrement(h))};c.promise.then(v,w=>v(null,w||"unknown"))}),dl(()=>{for(const c of a.values())c.reject(Vn)}),mt&&(_.f|=jo),new Promise(c=>{function g(h){function v(){h===d?c(_):g(d)}h.then(v,v)}g(d)})}function ye(t){const e=Fo(t);return Gd(e),e}function Ld(t){const e=Fo(t);return e.equals=gd,e}function Pa(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)ni(e[r])}}let Qo=[];function gf(t){for(var e=t.parent;e!==null;){if((e.f&Wr)===0)return(e.f&Ji)===0?e:null;e=e.parent}return null}function sl(t){var e,r=er;if(Ri(gf(t)),mt){let n=rs;Xl(new Set);try{Ln.call(Qo,t)&&jh(),Qo.push(t),t.f&=~un,Pa(t),e=La(t)}finally{Ri(r),Xl(n),Qo.pop()}}else try{t.f&=~un,Pa(t),e=La(t)}finally{Ri(r)}return e}function Rd(t){var e=sl(t);if(!t.equals(e)&&(t.wv=Xd(),(!(Nt!=null&&Nt.is_fork)||t.deps===null)&&(t.v=e,t.deps===null))){Rr(t,jr);return}fn||(zr!==null?(cl()||Nt!=null&&Nt.is_fork)&&zr.set(t,e):nl(t))}let rs=new Set;const cn=new Map;function Xl(t){rs=t}let ol=!1;function mf(){ol=!0}function In(t,e){var r={f:0,v:t,reactions:null,equals:vd,rv:0,wv:0};return r}function q(t,e){const r=In(t);return Gd(r),r}function bf(t,e=!1,r=!0){const n=In(t);return e||(n.equals=gd),n}function x(t,e,r=!1){qt!==null&&(!Li||(qt.f&vo)!==0)&&bd()&&(qt.f&(Wr|$i|jo|vo))!==0&&(wi===null||!Ln.call(wi,t))&&Kh();let n=r?xt(e):e;return mt&&md(n,t.label),is(t,n)}function is(t,e){var s;if(!t.equals(e)){var r=t.v;fn?cn.set(t,e):cn.set(t,r),t.v=e;var n=ln.ensure();if(n.capture(t,r),mt){if(er!==null){t.updated??(t.updated=new Map);const d=(((s=t.updated.get(""))==null?void 0:s.count)??0)+1;if(t.updated.set("",{error:null,count:d}),d>5){const _=$h("updated at");if(_!==null){let o=t.updated.get(_.stack);o||(o={error:_,count:0},t.updated.set(_.stack,o)),o.count++}}}er!==null&&(t.set_during_effect=!0)}if((t.f&Wr)!==0){const d=t;(t.f&$r)!==0&&sl(d),nl(d)}t.wv=Xd(),Dd(t,$r),er!==null&&(er.f&jr)!==0&&(er.f&(Ii|On))===0&&(vi===null?Df([t]):vi.push(t)),!n.is_fork&&rs.size>0&&!ol&&Id()}return e}function Id(){ol=!1;for(const t of rs)(t.f&jr)!==0&&Rr(t,en),Ws(t)&&Is(t);rs.clear()}function Jl(t,e=1){var r=i(t),n=e===1?r++:r--;return x(t,r),n}function Es(t){x(t,t.v+1)}function Dd(t,e){var r=t.reactions;if(r!==null)for(var n=r.length,s=0;s<n;s++){var d=r[s],_=d.f;if(mt&&(_&vo)!==0){rs.add(d);continue}var o=(_&$r)===0;if(o&&Rr(d,e),(_&Wr)!==0){var a=d;zr==null||zr.delete(a),(_&un)===0&&(_&xi&&(d.f|=un),Dd(a,en))}else o&&((_&$i)!==0&&ki!==null&&ki.add(d),Zi(d))}}const yf=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function xt(t){if(typeof t!="object"||t===null||An in t)return t;const e=dd(t);if(e!==Lh&&e!==Rh)return t;var r=new Map,n=$a(t),s=q(0),d=Pn,_=g=>{if(Pn===d)return g();var h=qt,v=Pn;Si(null),Zl(d);var m=g();return Si(h),Zl(v),m};n&&(r.set("length",q(t.length)),mt&&(t=Sf(t)));var o="";let a=!1;function c(g){if(!a){a=!0,o=g,Ni(s,`${o} version`);for(const[h,v]of r)Ni(v,pn(o,h));a=!1}}return new Proxy(t,{defineProperty(g,h,v){(!("value"in v)||v.configurable===!1||v.enumerable===!1||v.writable===!1)&&qh();var m=r.get(h);return m===void 0?m=_(()=>{var w=q(v.value);return r.set(h,w),mt&&typeof h=="string"&&Ni(w,pn(o,h)),w}):x(m,v.value,!0),!0},deleteProperty(g,h){var v=r.get(h);if(v===void 0){if(h in g){const m=_(()=>q(Vr));r.set(h,m),Es(s),mt&&Ni(m,pn(o,h))}}else x(v,Vr),Es(s);return!0},get(g,h,v){var f;if(h===An)return t;if(mt&&h===pd)return c;var m=r.get(h),w=h in g;if(m===void 0&&(!w||(f=En(g,h))!=null&&f.writable)&&(m=_(()=>{var u=xt(w?g[h]:Vr),l=q(u);return mt&&Ni(l,pn(o,h)),l}),r.set(h,m)),m!==void 0){var b=i(m);return b===Vr?void 0:b}return Reflect.get(g,h,v)},getOwnPropertyDescriptor(g,h){var v=Reflect.getOwnPropertyDescriptor(g,h);if(v&&"value"in v){var m=r.get(h);m&&(v.value=i(m))}else if(v===void 0){var w=r.get(h),b=w==null?void 0:w.v;if(w!==void 0&&b!==Vr)return{enumerable:!0,configurable:!0,value:b,writable:!0}}return v},has(g,h){var b;if(h===An)return!0;var v=r.get(h),m=v!==void 0&&v.v!==Vr||Reflect.has(g,h);if(v!==void 0||er!==null&&(!m||(b=En(g,h))!=null&&b.writable)){v===void 0&&(v=_(()=>{var f=m?xt(g[h]):Vr,u=q(f);return mt&&Ni(u,pn(o,h)),u}),r.set(h,v));var w=i(v);if(w===Vr)return!1}return m},set(g,h,v,m){var C;var w=r.get(h),b=h in g;if(n&&h==="length")for(var f=v;f<w.v;f+=1){var u=r.get(f+"");u!==void 0?x(u,Vr):f in g&&(u=_(()=>q(Vr)),r.set(f+"",u),mt&&Ni(u,pn(o,f)))}if(w===void 0)(!b||(C=En(g,h))!=null&&C.writable)&&(w=_(()=>q(void 0)),mt&&Ni(w,pn(o,h)),x(w,xt(v)),r.set(h,w));else{b=w.v!==Vr;var l=_(()=>xt(v));x(w,l)}var p=Reflect.getOwnPropertyDescriptor(g,h);if(p!=null&&p.set&&p.set.call(m,v),!b){if(n&&typeof h=="string"){var y=r.get("length"),k=Number(h);Number.isInteger(k)&&k>=y.v&&x(y,k+1)}Es(s)}return!0},ownKeys(g){i(s);var h=Reflect.ownKeys(g).filter(w=>{var b=r.get(w);return b===void 0||b.v!==Vr});for(var[v,m]of r)m.v!==Vr&&!(v in g)&&h.push(v);return h},setPrototypeOf(){Gh()}})}function pn(t,e){return typeof e=="symbol"?`${t}[Symbol(${e.description??""})]`:yf.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function As(t){try{if(t!==null&&typeof t=="object"&&An in t)return t[An]}catch{}return t}function xf(t,e){return Object.is(As(t),As(e))}const wf=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function Sf(t){return new Proxy(t,{get(e,r,n){var s=Reflect.get(e,r,n);return wf.has(r)?function(...d){mf();var _=s.apply(this,d);return Id(),_}:s}})}function Cf(){const t=Array.prototype,e=Array.__svelte_cleanup;e&&e();const{indexOf:r,lastIndexOf:n,includes:s}=t;t.indexOf=function(d,_){const o=r.call(this,d,_);if(o===-1){for(let a=_??0;a<this.length;a+=1)if(As(this[a])===d){Yo("array.indexOf(...)");break}}return o},t.lastIndexOf=function(d,_){const o=n.call(this,d,_??this.length-1);if(o===-1){for(let a=0;a<=(_??this.length-1);a+=1)if(As(this[a])===d){Yo("array.lastIndexOf(...)");break}}return o},t.includes=function(d,_){const o=s.call(this,d,_);if(!o){for(let a=0;a<this.length;a+=1)if(As(this[a])===d){Yo("array.includes(...)");break}}return o},Array.__svelte_cleanup=()=>{t.indexOf=r,t.lastIndexOf=n,t.includes=s}}var hn,al,Md,Od;function kf(){if(hn===void 0){hn=window,al=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;Md=En(e,"firstChild").get,Od=En(e,"nextSibling").get,zl(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),zl(r)&&(r.__t=void 0),mt&&(t.__svelte_meta=null,Cf())}}function Qi(t=""){return document.createTextNode(t)}function di(t){return Md.call(t)}function zs(t){return Od.call(t)}function E(t,e){return di(t)}function Ye(t,e=!1){{var r=di(t);return r instanceof Comment&&r.data===""?zs(r):r}}function P(t,e=1,r=!1){let n=t;for(;e--;)n=zs(n);return n}function Ef(t){t.textContent=""}function Bd(){return!1}let Yl=!1;function Af(){Yl||(Yl=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(const r of t.target.elements)(e=r.__on_r)==null||e.call(r)})},{capture:!0}))}function Uo(t){var e=qt,r=er;Si(null),Ri(null);try{return t()}finally{Si(e),Ri(r)}}function ll(t,e,r,n=r){t.addEventListener(e,()=>Uo(r));const s=t.__on_r;s?t.__on_r=()=>{s(),n(!0)}:t.__on_r=()=>n(!0),Af()}function Tf(t){er===null&&(qt===null&&Uh(t),Fh()),fn&&Hh(t)}function Pf(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function tn(t,e,r){var n=er;if(mt)for(;n!==null&&(n.f&vo)!==0;)n=n.parent;n!==null&&(n.f&fi)!==0&&(t|=fi);var s={ctx:Br,deps:null,nodes:null,f:t|$r|xi,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};if(mt&&(s.component_function=Vs),r)try{Is(s),s.f|=tl}catch(o){throw ni(s),o}else e!==null&&Zi(s);var d=s;if(r&&d.deps===null&&d.teardown===null&&d.nodes===null&&d.first===d.last&&(d.f&os)===0&&(d=d.first,(t&$i)!==0&&(t&$n)!==0&&d!==null&&(d.f|=$n)),d!==null&&(d.parent=n,n!==null&&Pf(d,n),qt!==null&&(qt.f&Wr)!==0&&(t&On)===0)){var _=qt;(_.effects??(_.effects=[])).push(d)}return s}function cl(){return qt!==null&&!Li}function dl(t){const e=tn(No,null,!1);return Rr(e,jr),e.teardown=t,e}function gt(t){Tf("$effect"),mt&&Rn(t,"name",{value:"$effect"});var e=er.f,r=!qt&&(e&Ii)!==0&&(e&tl)===0;if(r){var n=Br;(n.e??(n.e=[])).push(t)}else return Nd(t)}function Nd(t){return tn(_o|Mh,t,!1)}function Lf(t){ln.ensure();const e=tn(On|os,t,!0);return(r={})=>new Promise(n=>{r.outro?Tn(e,()=>{ni(e),n(void 0)}):(ni(e),n(void 0))})}function jd(t){return tn(_o,t,!1)}function Rf(t){return tn(jo|os,t,!0)}function Vo(t,e=0){return tn(No|e,t,!0)}function de(t,e=[],r=[],n=[]){ff(n,e,r,s=>{tn(No,()=>t(...s.map(i)),!0)})}function ul(t,e=0){var r=tn($i|e,t,!0);return mt&&(r.dev_stack=Rs),r}function bi(t){return tn(Ii|os,t,!0)}function Hd(t){var e=t.teardown;if(e!==null){const r=fn,n=qt;Ql(!0),Si(null);try{e.call(null)}finally{Ql(r),Si(n)}}}function Fd(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){const s=r.ac;s!==null&&Uo(()=>{s.abort(Vn)});var n=r.next;(r.f&On)!==0?r.parent=null:ni(r,e),r=n}}function If(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&Ii)===0&&ni(e),e=r}}function ni(t,e=!0){var r=!1;(e||(t.f&fd)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(Ud(t.nodes.start,t.nodes.end),r=!0),Fd(t,e&&!r),bo(t,0),Rr(t,Ji);var n=t.nodes&&t.nodes.t;if(n!==null)for(const d of n)d.stop();Hd(t);var s=t.parent;s!==null&&s.first!==null&&Vd(t),mt&&(t.component_function=null),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function Ud(t,e){for(;t!==null;){var r=t===e?null:zs(t);t.remove(),t=r}}function Vd(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function Tn(t,e,r=!0){var n=[];zd(t,n,!0);var s=()=>{r&&ni(t),e&&e()},d=n.length;if(d>0){var _=()=>--d||s();for(var o of n)o.out(_)}else s()}function zd(t,e,r){if((t.f&fi)===0){t.f^=fi;var n=t.nodes&&t.nodes.t;if(n!==null)for(const o of n)(o.is_global||r)&&e.push(o);for(var s=t.first;s!==null;){var d=s.next,_=(s.f&$n)!==0||(s.f&Ii)!==0&&(t.f&$i)!==0;zd(s,e,_?r:!1),s=d}}}function hl(t){Wd(t,!0)}function Wd(t,e){if((t.f&fi)!==0){t.f^=fi,(t.f&jr)===0&&(Rr(t,$r),Zi(t));for(var r=t.first;r!==null;){var n=r.next,s=(r.f&$n)!==0||(r.f&Ii)!==0;Wd(r,s?e:!1),r=n}var d=t.nodes&&t.nodes.t;if(d!==null)for(const _ of d)(_.is_global||e)&&_.in()}}function qd(t,e){if(t.nodes)for(var r=t.nodes.start,n=t.nodes.end;r!==null;){var s=r===n?null:zs(r);e.append(r),r=s}}let co=!1,fn=!1;function Ql(t){fn=t}let qt=null,Li=!1;function Si(t){qt=t}let er=null;function Ri(t){er=t}let wi=null;function Gd(t){qt!==null&&(wi===null?wi=[t]:wi.push(t))}let ii=null,ai=0,vi=null;function Df(t){vi=t}let Kd=1,mn=0,Pn=mn;function Zl(t){Pn=t}function Xd(){return++Kd}function Ws(t){var e=t.f;if((e&$r)!==0)return!0;if(e&Wr&&(t.f&=~un),(e&en)!==0){for(var r=t.deps,n=r.length,s=0;s<n;s++){var d=r[s];if(Ws(d)&&Rd(d),d.wv>t.wv)return!0}(e&xi)!==0&&zr===null&&Rr(t,jr)}return!1}function Jd(t,e,r=!0){var n=t.reactions;if(n!==null&&!(wi!==null&&Ln.call(wi,t)))for(var s=0;s<n.length;s++){var d=n[s];(d.f&Wr)!==0?Jd(d,e,!1):e===d&&(r?Rr(d,$r):(d.f&jr)!==0&&Rr(d,en),Zi(d))}}function La(t){var b;var e=ii,r=ai,n=vi,s=qt,d=wi,_=Br,o=Li,a=Pn,c=t.f;ii=null,ai=0,vi=null,qt=(c&(Ii|On))===0?t:null,wi=null,es(t.ctx),Li=!1,Pn=++mn,t.ac!==null&&(Uo(()=>{t.ac.abort(Vn)}),t.ac=null);try{t.f|=xa;var g=t.fn,h=g(),v=t.deps,m=Nt==null?void 0:Nt.is_fork;if(ii!==null){var w;if(m||bo(t,ai),v!==null&&ai>0)for(v.length=ai+ii.length,w=0;w<ii.length;w++)v[ai+w]=ii[w];else t.deps=v=ii;if(cl()&&(t.f&xi)!==0)for(w=ai;w<v.length;w++)((b=v[w]).reactions??(b.reactions=[])).push(t)}else!m&&v!==null&&ai<v.length&&(bo(t,ai),v.length=ai);if(bd()&&vi!==null&&!Li&&v!==null&&(t.f&(Wr|en|$r))===0)for(w=0;w<vi.length;w++)Jd(vi[w],t);if(s!==null&&s!==t){if(mn++,s.deps!==null)for(let f=0;f<r;f+=1)s.deps[f].rv=mn;if(e!==null)for(const f of e)f.rv=mn;vi!==null&&(n===null?n=vi:n.push(...vi))}return(t.f&an)!==0&&(t.f^=an),h}catch(f){return xd(f)}finally{t.f^=xa,ii=e,ai=r,vi=n,qt=s,wi=d,es(_),Li=o,Pn=a}}function Mf(t,e){let r=e.reactions;if(r!==null){var n=Th.call(r,t);if(n!==-1){var s=r.length-1;s===0?r=e.reactions=null:(r[n]=r[s],r.pop())}}if(r===null&&(e.f&Wr)!==0&&(ii===null||!Ln.call(ii,e))){var d=e;(d.f&xi)!==0&&(d.f^=xi,d.f&=~un),nl(d),Pa(d),bo(d,0)}}function bo(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)Mf(t,r[n])}function Is(t){var e=t.f;if((e&Ji)===0){Rr(t,jr);var r=er,n=co;if(er=t,co=!0,mt){var s=Vs;Gl(t.component_function);var d=Rs;go(t.dev_stack??Rs)}try{(e&($i|hd))!==0?If(t):Fd(t),Hd(t);var _=La(t);t.teardown=typeof _=="function"?_:null,t.wv=Kd;var o;mt&&Zh&&(t.f&$r)!==0&&t.deps}finally{co=n,er=r,mt&&(Gl(s),go(d))}}}async function Yd(){await Promise.resolve(),sf()}function i(t){var e=t.f,r=(e&Wr)!==0;if(qt!==null&&!Li){var n=er!==null&&(er.f&Ji)!==0;if(!n&&(wi===null||!Ln.call(wi,t))){var s=qt.deps;if((qt.f&xa)!==0)t.rv<mn&&(t.rv=mn,ii===null&&s!==null&&s[ai]===t?ai++:ii===null?ii=[t]:ii.push(t));else{(qt.deps??(qt.deps=[])).push(t);var d=t.reactions;d===null?t.reactions=[qt]:Ln.call(d,qt)||d.push(qt)}}}if(mt&&_f.delete(t),fn&&cn.has(t))return cn.get(t);if(r){var _=t;if(fn){var o=_.v;return((_.f&jr)===0&&_.reactions!==null||Zd(_))&&(o=sl(_)),cn.set(_,o),o}var a=(_.f&xi)===0&&!Li&&qt!==null&&(co||(qt.f&xi)!==0),c=_.deps===null;Ws(_)&&(a&&(_.f|=xi),Rd(_)),a&&!c&&Qd(_)}if(zr!=null&&zr.has(t))return zr.get(t);if((t.f&an)!==0)throw t.v;return t.v}function Qd(t){if(t.deps!==null){t.f|=xi;for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),(e.f&Wr)!==0&&(e.f&xi)===0&&Qd(e)}}function Zd(t){if(t.v===Vr)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(cn.has(e)||(e.f&Wr)!==0&&Zd(e))return!0;return!1}function Bn(t){var e=Li;try{return Li=!0,t()}finally{Li=e}}const $d=new Set,Ra=new Set;function Of(t,e,r,n={}){function s(d){if(n.capture||bs.call(e,d),!d.cancelBubble)return Uo(()=>r==null?void 0:r.call(this,d))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Yi(()=>{e.addEventListener(t,s,n)}):e.addEventListener(t,s,n),s}function Sr(t,e,r,n,s){var d={capture:n,passive:s},_=Of(t,e,r,d);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&dl(()=>{e.removeEventListener(t,_,d)})}function tr(t){for(var e=0;e<t.length;e++)$d.add(t[e]);for(var r of Ra)r(t)}let $l=null;function bs(t){var f;var e=this,r=e.ownerDocument,n=t.type,s=((f=t.composedPath)==null?void 0:f.call(t))||[],d=s[0]||t.target;$l=t;var _=0,o=$l===t&&t.__root;if(o){var a=s.indexOf(o);if(a!==-1&&(e===document||e===window)){t.__root=e;return}var c=s.indexOf(e);if(c===-1)return;a<=c&&(_=a)}if(d=s[_]||t.target,d!==e){Rn(t,"currentTarget",{configurable:!0,get(){return d||r}});var g=qt,h=er;Si(null),Ri(null);try{for(var v,m=[];d!==null;){var w=d.assignedSlot||d.parentNode||d.host||null;try{var b=d["__"+n];b!=null&&(!d.disabled||t.target===d)&&b.call(d,t)}catch(u){v?m.push(u):v=u}if(t.cancelBubble||w===e||w===null)break;d=w}if(v){for(let u of m)queueMicrotask(()=>{throw u});throw v}}finally{t.__root=e,delete t.currentTarget,Si(g),Ri(h)}}}function fl(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","<!---->"),e.content}function Dn(t,e){var r=er;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function U(t,e){var r=(e&cd)!==0,n=(e&kh)!==0,s,d=!t.startsWith("<!>");return()=>{s===void 0&&(s=fl(d?t:"<!>"+t),r||(s=di(s)));var _=n||al?document.importNode(s,!0):s.cloneNode(!0);if(r){var o=di(_),a=_.lastChild;Dn(o,a)}else Dn(_,_);return _}}function Bf(t,e,r="svg"){var n=!t.startsWith("<!>"),s=(e&cd)!==0,d=`<${r}>${n?t:"<!>"+t}</${r}>`,_;return()=>{if(!_){var o=fl(d),a=di(o);if(s)for(_=document.createDocumentFragment();di(a);)_.appendChild(di(a));else _=di(a)}var c=_.cloneNode(!0);if(s){var g=di(c),h=c.lastChild;Dn(g,h)}else Dn(c,c);return c}}function Cr(t,e){return Bf(t,e,"svg")}function Lr(t=""){{var e=Qi(t+"");return Dn(e,e),e}}function _t(){var t=document.createDocumentFragment(),e=document.createComment(""),r=Qi();return t.append(e,r),Dn(e,r),t}function L(t,e){t!==null&&t.before(e)}const Nf=["touchstart","touchmove"];function jf(t){return Nf.includes(t)}function se(t,e){var r=e==null?"":typeof e=="object"?e+"":e;r!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=r,t.nodeValue=r+"")}function Hf(t,e){return Ff(t,e)}const Hn=new Map;function Ff(t,{target:e,anchor:r,props:n={},events:s,context:d,intro:_=!0}){kf();var o=new Set,a=h=>{for(var v=0;v<h.length;v++){var m=h[v];if(!o.has(m)){o.add(m);var w=jf(m);e.addEventListener(m,bs,{passive:w});var b=Hn.get(m);b===void 0?(document.addEventListener(m,bs,{passive:w}),Hn.set(m,1)):Hn.set(m,b+1)}}};a(Bo($d)),Ra.add(a);var c=void 0,g=Lf(()=>{var h=r??e.appendChild(Qi());return cf(h,{pending:()=>{}},v=>{if(d){Kt({});var m=Br;m.c=d}s&&(n.$$events=s),c=t(v,n)||{},d&&Xt()}),()=>{var w;for(var v of o){e.removeEventListener(v,bs);var m=Hn.get(v);--m===0?(document.removeEventListener(v,bs),Hn.delete(v)):Hn.set(v,m)}Ra.delete(a),h!==r&&((w=h.parentNode)==null||w.removeChild(h))}});return Uf.set(c,g),c}let Uf=new WeakMap;var Ai,Vi,li,kn,Fs,Us,Oo;class Vf{constructor(e,r=!0){Ee(this,"anchor");Wt(this,Ai,new Map);Wt(this,Vi,new Map);Wt(this,li,new Map);Wt(this,kn,new Set);Wt(this,Fs,!0);Wt(this,Us,()=>{var e=Nt;if(Oe(this,Ai).has(e)){var r=Oe(this,Ai).get(e),n=Oe(this,Vi).get(r);if(n)hl(n),Oe(this,kn).delete(r);else{var s=Oe(this,li).get(r);s&&(Oe(this,Vi).set(r,s.effect),Oe(this,li).delete(r),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),n=s.effect)}for(const[d,_]of Oe(this,Ai)){if(Oe(this,Ai).delete(d),d===e)break;const o=Oe(this,li).get(_);o&&(ni(o.effect),Oe(this,li).delete(_))}for(const[d,_]of Oe(this,Vi)){if(d===r||Oe(this,kn).has(d))continue;const o=()=>{if(Array.from(Oe(this,Ai).values()).includes(d)){var c=document.createDocumentFragment();qd(_,c),c.append(Qi()),Oe(this,li).set(d,{effect:_,fragment:c})}else ni(_);Oe(this,kn).delete(d),Oe(this,Vi).delete(d)};Oe(this,Fs)||!n?(Oe(this,kn).add(d),Tn(_,o,!1)):o()}}});Wt(this,Oo,e=>{Oe(this,Ai).delete(e);const r=Array.from(Oe(this,Ai).values());for(const[n,s]of Oe(this,li))r.includes(n)||(ni(s.effect),Oe(this,li).delete(n))});this.anchor=e,jt(this,Fs,r)}ensure(e,r){var n=Nt,s=Bd();if(r&&!Oe(this,Vi).has(e)&&!Oe(this,li).has(e))if(s){var d=document.createDocumentFragment(),_=Qi();d.append(_),Oe(this,li).set(e,{effect:bi(()=>r(_)),fragment:d})}else Oe(this,Vi).set(e,bi(()=>r(this.anchor)));if(Oe(this,Ai).set(n,e),s){for(const[o,a]of Oe(this,Vi))o===e?n.skipped_effects.delete(a):n.skipped_effects.add(a);for(const[o,a]of Oe(this,li))o===e?n.skipped_effects.delete(a.effect):n.skipped_effects.add(a.effect);n.oncommit(Oe(this,Us)),n.ondiscard(Oe(this,Oo))}else Oe(this,Us).call(this)}}Ai=new WeakMap,Vi=new WeakMap,li=new WeakMap,kn=new WeakMap,Fs=new WeakMap,Us=new WeakMap,Oo=new WeakMap;if(mt){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;Wh(e)},set:n=>{r=n}})}};var S2=t;t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function eu(t){Br===null&&_d("onMount"),gt(()=>{const e=Bn(t);if(typeof e=="function")return e})}function zf(t){Br===null&&_d("onDestroy"),eu(()=>()=>Bn(t))}function Y(t,e,r=!1){var n=new Vf(t),s=r?$n:0;function d(_,o){n.ensure(_,o)}ul(()=>{var _=!1;e((o,a=!0)=>{_=!0,d(a,o)}),_||d(!1,null)},s)}function ui(t,e){return e}function Wf(t,e,r){for(var n=[],s=e.length,d,_=e.length,o=0;o<s;o++){let h=e[o];Tn(h,()=>{if(d){if(d.pending.delete(h),d.done.add(h),d.pending.size===0){var v=t.outrogroups;Ia(Bo(d.done)),v.delete(d),v.size===0&&(t.outrogroups=null)}}else _-=1},!1)}if(_===0){var a=n.length===0&&r!==null;if(a){var c=r,g=c.parentNode;Ef(g),g.append(c),t.items.clear()}Ia(e,!a)}else d={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(d)}function Ia(t,e=!0){for(var r=0;r<t.length;r++)ni(t[r],e)}var ec;function Gt(t,e,r,n,s,d=null){var _=t,o=new Map,a=(e&ld)!==0;if(a){var c=t;_=c.appendChild(Qi())}var g=null,h=Ld(()=>{var u=r();return $a(u)?u:u==null?[]:Bo(u)}),v,m=!0;function w(){f.fallback=g,qf(f,v,_,e,n),g!==null&&(v.length===0?(g.f&Xi)===0?hl(g):(g.f^=Xi,ys(g,null,_)):Tn(g,()=>{g=null}))}var b=ul(()=>{v=i(h);for(var u=v.length,l=new Set,p=Nt,y=Bd(),k=0;k<u;k+=1){var C=v[k],A=n(C,k),S=m?null:o.get(A);S?(S.v&&is(S.v,C),S.i&&is(S.i,k),y&&p.skipped_effects.delete(S.e)):(S=Gf(o,m?_:ec??(ec=Qi()),C,A,k,s,e,r),m||(S.e.f|=Xi),o.set(A,S)),l.add(A)}if(u===0&&d&&!g&&(m?g=bi(()=>d(_)):(g=bi(()=>d(ec??(ec=Qi()))),g.f|=Xi)),!m)if(y){for(const[T,D]of o)l.has(T)||p.skipped_effects.add(D.e);p.oncommit(w),p.ondiscard(()=>{})}else w();i(h)}),f={effect:b,items:o,outrogroups:null,fallback:g};m=!1}function ds(t){for(;t!==null&&(t.f&Ii)===0;)t=t.next;return t}function qf(t,e,r,n,s){var D,H,W,M,G,X,le,me,xe;var d=(n&bh)!==0,_=e.length,o=t.items,a=ds(t.effect.first),c,g=null,h,v=[],m=[],w,b,f,u;if(d)for(u=0;u<_;u+=1)w=e[u],b=s(w,u),f=o.get(b).e,(f.f&Xi)===0&&((H=(D=f.nodes)==null?void 0:D.a)==null||H.measure(),(h??(h=new Set)).add(f));for(u=0;u<_;u+=1){if(w=e[u],b=s(w,u),f=o.get(b).e,t.outrogroups!==null)for(const R of t.outrogroups)R.pending.delete(f),R.done.delete(f);if((f.f&Xi)!==0)if(f.f^=Xi,f===a)ys(f,null,r);else{var l=g?g.next:a;f===t.effect.last&&(t.effect.last=f.prev),f.prev&&(f.prev.next=f.next),f.next&&(f.next.prev=f.prev),nn(t,g,f),nn(t,f,l),ys(f,l,r),g=f,v=[],m=[],a=ds(g.next);continue}if((f.f&fi)!==0&&(hl(f),d&&((M=(W=f.nodes)==null?void 0:W.a)==null||M.unfix(),(h??(h=new Set)).delete(f))),f!==a){if(c!==void 0&&c.has(f)){if(v.length<m.length){var p=m[0],y;g=p.prev;var k=v[0],C=v[v.length-1];for(y=0;y<v.length;y+=1)ys(v[y],p,r);for(y=0;y<m.length;y+=1)c.delete(m[y]);nn(t,k.prev,C.next),nn(t,g,k),nn(t,C,p),a=p,g=C,u-=1,v=[],m=[]}else c.delete(f),ys(f,a,r),nn(t,f.prev,f.next),nn(t,f,g===null?t.effect.first:g.next),nn(t,g,f),g=f;continue}for(v=[],m=[];a!==null&&a!==f;)(c??(c=new Set)).add(a),m.push(a),a=ds(a.next);if(a===null)continue}(f.f&Xi)===0&&v.push(f),g=f,a=ds(f.next)}if(t.outrogroups!==null){for(const R of t.outrogroups)R.pending.size===0&&(Ia(Bo(R.done)),(G=t.outrogroups)==null||G.delete(R));t.outrogroups.size===0&&(t.outrogroups=null)}if(a!==null||c!==void 0){var A=[];if(c!==void 0)for(f of c)(f.f&fi)===0&&A.push(f);for(;a!==null;)(a.f&fi)===0&&a!==t.fallback&&A.push(a),a=ds(a.next);var S=A.length;if(S>0){var T=(n&ld)!==0&&_===0?r:null;if(d){for(u=0;u<S;u+=1)(le=(X=A[u].nodes)==null?void 0:X.a)==null||le.measure();for(u=0;u<S;u+=1)(xe=(me=A[u].nodes)==null?void 0:me.a)==null||xe.fix()}Wf(t,A,T)}}d&&Yi(()=>{var R,j;if(h!==void 0)for(f of h)(j=(R=f.nodes)==null?void 0:R.a)==null||j.apply()})}function Gf(t,e,r,n,s,d,_,o){var a=(_&gh)!==0?(_&yh)===0?bf(r,!1,!1):In(r):null,c=(_&mh)!==0?In(s):null;return mt&&a&&(a.trace=()=>{o()[(c==null?void 0:c.v)??s]}),{v:a,i:c,e:bi(()=>(d(e,a??r,c??s,o),()=>{t.delete(n)}))}}function ys(t,e,r){if(t.nodes)for(var n=t.nodes.start,s=t.nodes.end,d=e&&(e.f&Xi)===0?e.nodes.start:r;n!==null;){var _=zs(n);if(d.before(n),n===s)return;n=_}}function nn(t,e,r){e===null?t.effect.first=r:e.next=r,r===null?t.effect.last=e:r.prev=e}function Gi(t,e,r=!1,n=!1,s=!1){var d=t,_="";de(()=>{var o=er;if(_!==(_=e()??"")&&(o.nodes!==null&&(Ud(o.nodes.start,o.nodes.end),o.nodes=null),_!=="")){var a=_+"";r?a=`<svg>${a}</svg>`:n&&(a=`<math>${a}</math>`);var c=fl(a);if((r||n)&&(c=di(c)),Dn(di(c),c.lastChild),r||n)for(;di(c);)d.before(di(c));else d.before(c)}})}function tu(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(r=tu(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Kf(){for(var t,e,r=0,n="",s=arguments.length;r<s;r++)(t=arguments[r])&&(e=tu(t))&&(n&&(n+=" "),n+=e);return n}function ns(t){return typeof t=="object"?Kf(t):t??""}const tc=[...`
28
+ \r\f \v\uFEFF`];function Xf(t,e,r){var n=t==null?"":""+t;if(e&&(n=n?n+" "+e:e),r){for(var s in r)if(r[s])n=n?n+" "+s:s;else if(n.length)for(var d=s.length,_=0;(_=n.indexOf(s,_))>=0;){var o=_+d;(_===0||tc.includes(n[_-1]))&&(o===n.length||tc.includes(n[o]))?n=(_===0?"":n.substring(0,_))+n.substring(o+1):_=o}}return n===""?null:n}function rc(t,e=!1){var r=e?" !important;":";",n="";for(var s in t){var d=t[s];d!=null&&d!==""&&(n+=" "+s+": "+d+r)}return n}function Zo(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function Jf(t,e){if(e){var r="",n,s;if(Array.isArray(e)?(n=e[0],s=e[1]):n=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var d=!1,_=0,o=!1,a=[];n&&a.push(...Object.keys(n).map(Zo)),s&&a.push(...Object.keys(s).map(Zo));var c=0,g=-1;const b=t.length;for(var h=0;h<b;h++){var v=t[h];if(o?v==="/"&&t[h-1]==="*"&&(o=!1):d?d===v&&(d=!1):v==="/"&&t[h+1]==="*"?o=!0:v==='"'||v==="'"?d=v:v==="("?_++:v===")"&&_--,!o&&d===!1&&_===0){if(v===":"&&g===-1)g=h;else if(v===";"||h===b-1){if(g!==-1){var m=Zo(t.substring(c,g).trim());if(!a.includes(m)){v!==";"&&h++;var w=t.substring(c,h).trim();r+=" "+w+";"}}c=h+1,g=-1}}}}return n&&(r+=rc(n)),s&&(r+=rc(s,!0)),r=r.trim(),r===""?null:r}return t==null?null:String(t)}function Ve(t,e,r,n,s,d){var _=t.__className;if(_!==r||_===void 0){var o=Xf(r,n,d);o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o),t.__className=r}else if(d&&s!==d)for(var a in d){var c=!!d[a];(s==null||c!==!!s[a])&&t.classList.toggle(a,c)}return d}function $o(t,e={},r,n){for(var s in r){var d=r[s];e[s]!==d&&(r[s]==null?t.style.removeProperty(s):t.style.setProperty(s,d,n))}}function hi(t,e,r,n){var s=t.__style;if(s!==e){var d=Jf(e,n);d==null?t.removeAttribute("style"):t.style.cssText=d,t.__style=e}else n&&(Array.isArray(n)?($o(t,r==null?void 0:r[0],n[0]),$o(t,r==null?void 0:r[1],n[1],"important")):$o(t,r,n));return n}function pl(t,e,r=!1){if(t.multiple){if(e==null)return;if(!$a(e))return Jh();for(var n of t.options)n.selected=e.includes(Ts(n));return}for(n of t.options){var s=Ts(n);if(xf(s,e)){n.selected=!0;return}}(!r||e!==void 0)&&(t.selectedIndex=-1)}function ru(t){var e=new MutationObserver(()=>{pl(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),dl(()=>{e.disconnect()})}function zi(t,e,r=e){var n=new WeakSet,s=!0;ll(t,"change",d=>{var _=d?"[selected]":":checked",o;if(t.multiple)o=[].map.call(t.querySelectorAll(_),Ts);else{var a=t.querySelector(_)??t.querySelector("option:not([disabled])");o=a&&Ts(a)}r(o),Nt!==null&&n.add(Nt)}),jd(()=>{var d=e();if(t===document.activeElement){var _=mo??Nt;if(n.has(_))return}if(pl(t,d,s),s&&d===void 0){var o=t.querySelector(":checked");o!==null&&(d=Ts(o),r(d))}t.__value=d,s=!1}),ru(t)}function Ts(t){return"__value"in t?t.__value:t.value}const Yf=Symbol("is custom element"),Qf=Symbol("is html");function _l(t,e){var r=iu(t);r.value===(r.value=e??void 0)||t.value===e&&(e!==0||t.nodeName!=="PROGRESS")||(t.value=e??"")}function Ge(t,e,r,n){var s=iu(t);s[e]!==(s[e]=r)&&(e==="loading"&&(t[Bh]=r),r==null?t.removeAttribute(e):typeof r!="string"&&Zf(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function iu(t){return t.__attributes??(t.__attributes={[Yf]:t.nodeName.includes("-"),[Qf]:t.namespaceURI===Ah})}var ic=new Map;function Zf(t){var e=t.getAttribute("is")||t.nodeName,r=ic.get(e);if(r)return r;ic.set(e,r=[]);for(var n,s=t,d=Element.prototype;d!==s;){n=Ph(s);for(var _ in n)n[_].set&&r.push(_);s=dd(s)}return r}function _r(t,e,r=e){var n=new WeakSet;ll(t,"input",async s=>{mt&&t.type==="checkbox"&&ql();var d=s?t.defaultValue:t.value;if(d=ea(t)?ta(d):d,r(d),Nt!==null&&n.add(Nt),await Yd(),d!==(d=e())){var _=t.selectionStart,o=t.selectionEnd,a=t.value.length;if(t.value=d??"",o!==null){var c=t.value.length;_===o&&o===a&&c>a?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=_,t.selectionEnd=Math.min(o,c))}}}),Bn(e)==null&&t.value&&(r(ea(t)?ta(t.value):t.value),Nt!==null&&n.add(Nt)),Vo(()=>{mt&&t.type==="checkbox"&&ql();var s=e();if(t===document.activeElement){var d=mo??Nt;if(n.has(d))return}ea(t)&&s===ta(t.value)||t.type==="date"&&!s&&!t.value||s!==t.value&&(t.value=s??"")})}function Da(t,e,r=e){ll(t,"change",n=>{var s=n?t.defaultChecked:t.checked;r(s)}),Bn(e)==null&&r(t.checked),Vo(()=>{var n=e();t.checked=!!n})}function ea(t){var e=t.type;return e==="number"||e==="range"}function ta(t){return t===""?null:+t}function nc(t,e){return t===e||(t==null?void 0:t[An])===e}function Nr(t={},e,r,n){return jd(()=>{var s,d;return Vo(()=>{s=d,d=[],Bn(()=>{t!==r(...d)&&(e(t,...d),s&&nc(r(...s),t)&&e(null,...s))})}),()=>{Yi(()=>{d&&nc(r(...d),t)&&e(null,...d)})}}),t}let Ys=!1;function $f(t){var e=Ys;try{return Ys=!1,[t(),Ys]}finally{Ys=e}}function Re(t,e,r,n){var l;var s=(r&Sh)!==0,d=(r&Ch)!==0,_=n,o=!0,a=()=>(o&&(o=!1,_=d?Bn(n):n),_),c;if(s){var g=An in t||Oh in t;c=((l=En(t,e))==null?void 0:l.set)??(g&&e in t?p=>t[e]=p:void 0)}var h,v=!1;s?[h,v]=$f(()=>t[e]):h=t[e],h===void 0&&n!==void 0&&(h=a(),c&&(zh(e),c(h)));var m;if(m=()=>{var p=t[e];return p===void 0?a():(o=!0,p)},(r&wh)===0)return m;if(c){var w=t.$$legacy;return(function(p,y){return arguments.length>0?((!y||w||v)&&c(y?m():p),p):m()})}var b=!1,f=((r&xh)!==0?Fo:Ld)(()=>(b=!1,m()));mt&&(f.label=e),s&&i(f);var u=er;return(function(p,y){if(arguments.length>0){const k=y?i(f):s?xt(p):p;return x(f,k),b=!0,_!==void 0&&(_=k),p}return fn&&b||(u.f&Ji)!==0?f.v:i(f)})}var _n=(t=>(t.CLAUDE="claude",t.CODEX="codex",t.GEMINI="gemini",t))(_n||{});function vl(){const t=typeof performance<"u"?Math.floor(performance.now()*1e3+performance.timeOrigin*1e3):Date.now()*1e3,e=String(t)+"Qraft";let r=2166136261;for(let n=0;n<e.length;n++)r^=e.charCodeAt(n),r=Math.imul(r,16777619);return`qs_${(r>>>0).toString(36)}`}const sc=new Set(["files","ai-session","commits","terminal","project","system-info","model-profiles","action-defaults"]);function yo(t){const r=t.replace(/^#\/?/,"").split("/").filter(Boolean);if(r.length>=2){const n=r[0]??null,s=r[1]??"files",d=s==="sessions"?"ai-session":s==="model-config"?"model-profiles":s;return{slug:n,screen:sc.has(d)?d:"files"}}if(r.length===1){const n=r[0]??"",s=n==="sessions"?"ai-session":n==="model-config"?"model-profiles":n;return sc.has(s)?{slug:null,screen:s}:{slug:n,screen:"files"}}return{slug:null,screen:"files"}}function ep(t){return yo(t).screen}function xs(t,e){return t!==null?`#/${t}/${e}`:`#/${e}`}function tp(t){const e={name:"",path:"",isDirectory:!0,children:[]};for(const r of t){const n=r.path.split("/");let s=e;for(let d=0;d<n.length;d++){const _=n[d];if(_===void 0||_.length===0)continue;const o=n.slice(0,d+1).join("/"),a=d===n.length-1,c=s.children??[],g=c.find(h=>h.name===_);if(g!==void 0)s=g;else{const h=a?{name:_,path:o,isDirectory:!1,status:r.status==="renamed"?"modified":r.status}:{name:_,path:o,isDirectory:!0,children:[]};c.push(h),s.children=c,s=h}}}return nu(e),e}function nu(t){if(!t.isDirectory||t.children===void 0)return;const e=t.children;e.sort((r,n)=>r.isDirectory&&!n.isDirectory?-1:!r.isDirectory&&n.isDirectory?1:r.name.localeCompare(n.name));for(const r of e)nu(r)}function gl(t,e){if(t.isDirectory&&t.children){const n=t.children.map(d=>gl(d,e));return n.some((d,_)=>d!==t.children[_])?{...t,children:n}:t}if(t.isDirectory&&t.children===void 0){const n=t.path===""?"":t.path+"/";for(const s of e.keys())if(s.startsWith(n))return{...t,status:"modified"};return t}const r=e.get(t.path);return r!==void 0&&t.status===void 0?{...t,status:r}:t}function ws(t){var r;const e=t.status==="added"||t.status==="modified"||t.status==="deleted"||t.status==="untracked"||t.status==="ignored"?t.status:void 0;return{name:t.name,path:t.path,isDirectory:t.type==="directory",children:(r=t.children)==null?void 0:r.map(ws),status:e,isBinary:t.isBinary===!0?!0:void 0}}function su(t,e,r){if(t.path===e&&t.isDirectory)return{...t,children:r};if(!t.isDirectory||t.children===void 0)return t;const n=t.children.map(d=>d.isDirectory&&(d.path===e||e.startsWith(d.path+"/"))?su(d,e,r):d);return n.some((d,_)=>d!==t.children[_])?{...t,children:n}:t}function ra(t){try{return JSON.parse(t)}catch{return null}}function rp(t,e){var r,n;if(typeof e.sessionId!="string")return t;if(e.type==="message"){const s=(r=e.data)==null?void 0:r.content;return typeof s!="string"?t:t.map(d=>d.id===e.sessionId?{...d,lastAssistantMessage:s,currentActivity:void 0}:d)}if(e.type==="thinking"||e.type==="session_started")return t.map(s=>s.id===e.sessionId?{...s,currentActivity:"Thinking..."}:s);if(e.type==="tool_use"){const s=(n=e.data)==null?void 0:n.toolName;return t.map(d=>d.id===e.sessionId?{...d,currentActivity:typeof s=="string"&&s.length>0?`Using ${s}...`:"Using tool..."}:d)}return e.type==="tool_result"?t.map(s=>s.id===e.sessionId?{...s,currentActivity:"Processing tool result..."}:s):t}function ou(t){const e=t.filter(n=>n.status==="running"),r=t.filter(n=>n.status==="queued");return{runningCount:e.length,queuedCount:r.length,runningSessionIds:[],totalCount:e.length+r.length}}function ip(t){const e=new Map;async function r(a){await t.fetchActiveSessions(),await t.fetchPromptQueue(),t.getRunningSessions().some(g=>g.id===a)||s(a)}function n(a){t.setRunningSessions(rp(t.getRunningSessions(),a))}function s(a){const c=e.get(a);c!==void 0&&(c.close(),e.delete(a))}function d(a){if(e.has(a))return;const c=new EventSource(`/api/ai/sessions/${a}/stream`);c.onmessage=v=>{const m=ra(v.data);m!==null&&n(m)};const g=()=>{s(a),r(a)};c.addEventListener("completed",g),c.addEventListener("failed",g),c.addEventListener("cancelled",g),c.addEventListener("error",v=>{if(!(v instanceof MessageEvent))return;const m=ra(v.data);if(m===null){g();return}if(m.type==="error"){g();return}n(m)});const h=["session_started","thinking","tool_use","tool_result","message"];for(const v of h)c.addEventListener(v,m=>{if(!(m instanceof MessageEvent))return;const w=ra(m.data);w!==null&&n(w)});c.onerror=()=>{r(a)},e.set(a,c)}function _(){const a=new Set(t.getRunningSessions().map(c=>c.id));for(const[c]of e)a.has(c)||s(c);for(const c of a)d(c)}function o(){for(const[,a]of e)a.close();e.clear()}return{sync:_,close:s,closeAll:o}}function oc(t,e){return`/api/ctx/${t}/files/file-raw/${e}`}function vr(t,e){if(!t.ok)throw new Error(`${e}: ${t.status}`);return t}async function np(){var r,n;const t=await fetch("/api/workspace");vr(t,"Failed to fetch workspace");const e=await t.json();return{tabs:e.workspace.tabs??[],activeTabId:e.workspace.activeTabId??null,metadata:{temporaryProjectMode:((r=e.metadata)==null?void 0:r.temporaryProjectMode)??!1,canManageProjects:((n=e.metadata)==null?void 0:n.canManageProjects)??!0}}}async function ac(t){const e=await fetch(`/api/workspace/tabs/${t}/activate`,{method:"POST"});vr(e,"Failed to activate tab")}async function sp(t){const e=await fetch(`/api/workspace/tabs/${t}`,{method:"DELETE"});vr(e,"Failed to close tab");const r=await e.json();return{tabs:r.workspace.tabs,activeTabId:r.workspace.activeTabId}}async function op(t){const e=await fetch("/api/workspace/tabs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!e.ok){const n=await e.json();throw new Error(n.error??`Failed to open (${e.status})`)}const r=await e.json();return{tab:r.tab,tabs:r.workspace.tabs}}async function ap(t){const e=await fetch(`/api/workspace/tabs/by-slug/${encodeURIComponent(t)}`,{method:"POST"});if(!e.ok){const n=await e.json();throw new Error(n.error??`Failed to open by slug (${e.status})`)}const r=await e.json();return{tab:r.tab,tabs:r.workspace.tabs}}async function lp(){const t=await fetch("/api/workspace/recent");return vr(t,"Failed to fetch recent projects"),(await t.json()).recent}async function cp(t){await fetch("/api/workspace/recent",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})})}async function dp(t){const e=await fetch("/api/browse/pick-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({startPath:t})});if(!e.ok){const n=await e.json();throw new Error(n.error??"Failed to open directory picker")}return(await e.json()).path}async function up(t){const e=await fetch(`/api/ctx/${t}/diff`);return vr(e,"Diff API error"),(await e.json()).files}async function ia(t,e,r){const n=new URLSearchParams({mode:"all"});e&&n.set("shallow","true"),(r==null?void 0:r.showIgnored)===!0&&n.set("showIgnored","true"),(r==null?void 0:r.showAllFiles)===!0&&n.set("showAllFiles","true");const s=await fetch(`/api/ctx/${t}/files?${n.toString()}`);return vr(s,"Files API error"),(await s.json()).tree}async function hp(t,e,r){const n=new URLSearchParams({path:e});(r==null?void 0:r.showIgnored)===!0&&n.set("showIgnored","true"),(r==null?void 0:r.showAllFiles)===!0&&n.set("showAllFiles","true");const s=await fetch(`/api/ctx/${t}/files/children?${n.toString()}`);return vr(s,"Children API error"),(await s.json()).children}async function fp(t,e){const r=await fetch(`/api/ctx/${t}/files/file/${e}`);return vr(r,"File API error"),await r.json()}async function pp(t){const e=await fetch("/api/ai/submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_immediately:t.runImmediately,message:t.message,context:t.context,project_path:t.projectPath,qraft_ai_session_id:t.qraftAiSessionId,force_new_session:t.forceNewSession===!0,ai_agent:t.aiAgent,model_profile_id:t.modelProfileId})});return vr(e,"AI submit error"),await e.json()}async function ml(){const t=await fetch("/api/model-config");return vr(t,"Model config API error"),await t.json()}async function _p(t){const e=await fetch("/api/model-config/profiles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return vr(e,"Failed to create model profile"),(await e.json()).profile}async function vp(t,e){const r=await fetch(`/api/model-config/profiles/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return vr(r,"Failed to update model profile"),(await r.json()).profile}async function gp(t){const e=await fetch(`/api/model-config/profiles/${t}`,{method:"DELETE"});vr(e,"Failed to delete model profile")}async function mp(t){const e=await fetch("/api/model-config/bindings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return vr(e,"Failed to update model bindings"),(await e.json()).operationBindings}async function bp(t){const e=await fetch("/api/model-config/languages",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return vr(e,"Failed to update operation languages"),(await e.json()).operationLanguages}async function lc(t,e){const r=new URLSearchParams;e!==void 0&&r.set("category",e);const n=r.toString(),s=`/api/ctx/${t}/prompts`,d=n.length>0?`${s}?${n}`:s,_=await fetch(d);return vr(_,"Failed to fetch prompt templates"),(await _.json()).prompts}async function cc(t,e){const r=await fetch(`/api/ctx/${t}/prompts/default/${e}`);return vr(r,"Failed to fetch default prompt"),(await r.json()).defaultId}async function dc(t,e,r){const n=await fetch(`/api/ctx/${t}/prompts/default/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:r})});vr(n,"Failed to update default prompt")}async function Fn(t){const e=await fetch(`/api/git-actions/prompts/${t}`);return vr(e,"Failed to fetch action prompt"),await e.json()}async function yp(t,e){const r=await fetch(`/api/git-actions/prompts/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})});return vr(r,"Failed to update action prompt"),await r.json()}async function xp(){const t=await fetch("/api/ai/prompt-queue");return vr(t,"Prompt queue error"),(await t.json()).prompts}async function wp(){const t=await fetch("/api/ai/sessions");return vr(t,"AI sessions error"),(await t.json()).sessions}async function Sp(){const t=await fetch("/api/ai/sessions/hidden");return vr(t,"Hidden AI sessions error"),(await t.json()).sessionIds}async function Cp(t,e){const r=await fetch(`/api/ai/sessions/${t}/hidden`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({hidden:e})});vr(r,"Failed to update hidden state")}async function kp(t){const e=await fetch(`/api/ai/sessions/${t}/cancel`,{method:"POST"});vr(e,"Failed to cancel session")}async function Ep(t){const e=await fetch(`/api/ai/prompt-queue/${t}/cancel`,{method:"POST"});vr(e,"Failed to cancel queued prompt")}function na(t){try{localStorage.setItem("qraftbox:recent-projects",JSON.stringify(t))}catch{}}function Ap(){try{const t=localStorage.getItem("qraftbox:recent-projects");if(t!==null)return JSON.parse(t)}catch{}return[]}function Tp(t){function e(){t.setDiffFiles([]),t.setSelectedPath(null),t.setAllFilesTree(null),t.setAllFilesTreeStale(!1),t.setFileContent(null)}async function r(u){const l=await up(u),p=t.getSelectedPath(),y=t.getFileTreeMode();if(t.setDiffFiles(l),l.length===0)return;if(p===null){l[0]!==void 0&&t.setSelectedPath(l[0].path);return}const k=l.some(C=>C.path===p);y==="diff"&&!k&&l[0]!==void 0&&t.setSelectedPath(l[0].path)}async function n(u){try{const l=await ap(u);return t.setWorkspaceTabs(l.tabs),await a(l.tab.id),!0}catch{return!1}}function s(){const u=t.getContextId();if(u===null)return null;const l=t.getWorkspaceTabs().find(p=>p.id===u);return(l==null?void 0:l.projectSlug)??null}function d(u){t.setCurrentScreen(u);const l=s(),p=xs(l,u);window.location.hash!==p&&(window.location.hash=p)}function _(u){if(t.getWorkspaceTabs().some(k=>k.path===u.path))return;const p=t.getRecentProjects(),y=[{path:u.path,name:u.name,isGitRepo:u.isGitRepo},...p.filter(k=>k.path!==u.path)].slice(0,20);t.setRecentProjects(y),na(y)}async function o(){const u=await np();t.setCanManageProjects(u.metadata.canManageProjects);const l=u.tabs;if(l.length>0){t.setWorkspaceTabs(l);const y=(u.activeTabId!==null?l.find(k=>k.id===u.activeTabId):void 0)??l[0];if(y!==void 0)return t.setProjectPath(y.path),y.id}return t.setWorkspaceTabs([]),t.setCurrentScreen("project"),""}async function a(u){if(!t.getCanManageProjects())return;const l=t.getWorkspaceTabs().find(p=>p.id===u);if(l!==void 0)try{if(await ac(u),t.setContextId(u),t.setProjectPath(l.path),e(),t.setLoading(!0),l.isGitRepo?(await r(u),t.getFileTreeMode()==="all"&&t.fetchAllFiles(u)):(t.setFileTreeMode("all"),t.setShowAllFiles(!0),t.fetchAllFiles(u)),t.fetchPromptQueue(),t.fetchActiveSessions(),t.getCurrentScreen()==="project")d("files");else if(l.projectSlug.length>0){const p=xs(l.projectSlug,t.getCurrentScreen());window.location.hash!==p&&(window.location.hash=p)}}catch(p){console.error("Failed to switch project:",p)}finally{t.setLoading(!1)}}async function c(u,l){if(!t.getCanManageProjects())return;l.stopPropagation();const p=t.getWorkspaceTabs().find(y=>y.id===u);try{const y=await sp(u);if(t.setWorkspaceTabs(y.tabs),p!==void 0&&_(p),u!==t.getContextId())return;const k=y.tabs;if(k.length===0){t.setContextId(null),t.setProjectPath(""),e(),t.setLoading(!1),d("project");return}const C=y.activeTabId!==null?k.find(A=>A.id===y.activeTabId):k[0];if(C===void 0)return;t.setContextId(C.id),t.setProjectPath(C.path),e(),C.isGitRepo?(await r(C.id),t.getFileTreeMode()==="all"&&t.fetchAllFiles(C.id)):(t.setFileTreeMode("all"),t.setShowAllFiles(!0),t.fetchAllFiles(C.id)),t.fetchPromptQueue(),t.fetchActiveSessions(),C.projectSlug.length>0&&(window.location.hash=xs(C.projectSlug,t.getCurrentScreen()))}catch(y){console.error("Failed to close project tab:",y)}}async function g(){try{const u=await lp(),l=t.getWorkspaceTabs(),p=new Set(l.map(A=>A.path)),y=t.getRecentProjects(),k=new Set(y.map(A=>A.path)),C=[...y];for(const A of u)!k.has(A.path)&&!p.has(A.path)&&C.push(A);t.setRecentProjects(C.slice(0,20))}catch{}}async function h(u){if(!t.getCanManageProjects()){t.setNewProjectError("Project management is disabled in temporary project mode");return}const l=u.trim();if(l.length!==0){t.setNewProjectLoading(!0),t.setNewProjectError(null);try{const p=await op(l);t.setWorkspaceTabs(p.tabs);const y=t.getRecentProjects().filter(k=>k.path!==l);t.setRecentProjects(y),na(y),t.setNewProjectPath(""),await a(p.tab.id)}catch(p){t.setNewProjectError(p instanceof Error?p.message:"Failed to open project")}finally{t.setNewProjectLoading(!1)}}}async function v(u){await h(u)}async function m(u){if(!t.getCanManageProjects())return;try{await cp(u)}catch{}const l=t.getRecentProjects().filter(p=>p.path!==u);t.setRecentProjects(l),na(l)}async function w(){if(t.getCanManageProjects()){if(t.setNewProjectError(null),t.isMobileDirectoryPickerClient()){t.setDirectoryPickerOpen(!0);return}t.setPickingDirectory(!0);try{const u=t.getProjectPath(),l=await dp(u.length>0?u:void 0);if(l===null)return;await h(l)}catch(u){t.setNewProjectError(u instanceof Error?u.message:"Failed to open directory picker")}finally{t.setPickingDirectory(!1)}}}function b(){const u=yo(window.location.hash);if(u.screen!==t.getCurrentScreen()&&t.setCurrentScreen(u.screen),u.slug!==null){const l=t.getWorkspaceTabs().find(p=>p.projectSlug===u.slug);if(l!==void 0&&l.id!==t.getContextId()){a(l.id);return}l===void 0&&t.getCanManageProjects()&&n(u.slug)}}async function f(){t.setRecentProjects(Ap());try{t.setLoading(!0),t.setError(null);const u=yo(window.location.hash),l=await o();if(l===""){if(u.slug!==null&&await n(u.slug)){g();return}g(),t.setLoading(!1);return}if(t.setContextId(l),u.slug!==null){const C=t.getWorkspaceTabs().find(A=>A.projectSlug===u.slug);if(C!==void 0&&C.id!==l)t.setContextId(C.id),t.setProjectPath(C.path),await ac(C.id);else if(C===void 0&&await n(u.slug)){g();return}}u.screen!==t.getCurrentScreen()&&t.setCurrentScreen(u.screen);const p=t.getWorkspaceTabs().find(C=>C.id===t.getContextId()),y=t.getContextId();y!==null&&((p==null?void 0:p.isGitRepo)===!0?(await r(y),t.getFileTreeMode()==="all"&&t.fetchAllFiles(y)):(t.setFileTreeMode("all"),t.setShowAllFiles(!0),t.fetchAllFiles(y))),t.fetchPromptQueue(),t.fetchActiveSessions(),g();const k=s();if(k!==null){const C=xs(k,t.getCurrentScreen());window.location.hash!==C&&(window.location.hash=C)}}catch(u){const l=u instanceof Error?u.message:"Failed to load";t.setError(l),console.error("Init error:",u)}finally{t.setLoading(!1)}}return{init:f,switchProject:a,closeProjectTab:c,fetchRecentProjects:g,openProjectByPath:h,openRecentProject:v,removeRecentProject:m,pickDirectory:w,fetchDiff:r,navigateToScreen:d,handleHashChange:b}}function Pp(t){let e=null,r=null,n=null,s=1e3;function d(){if(e!==null&&e.readyState<=WebSocket.OPEN)return;const o=location.protocol==="https:"?"wss:":"ws:";e=new WebSocket(`${o}//${location.host}/ws`),e.onopen=()=>{s=1e3},e.onmessage=a=>{try{const c=JSON.parse(a.data);if(c.event==="file-change"){const g=t.getContextId();if(g===null)return;const h=c.data,v=t.getSelectedPath(),m=t.getProjectPath(),w=h.projectPath===void 0||h.projectPath===m;t.markAllFilesTreeStale(),n!==null&&clearTimeout(n),n=setTimeout(()=>{const b=t.getContextId();b!==null&&(t.fetchDiff(b),t.refreshAllFiles(b)),n=null},500),w&&v!==null&&h.changes.some(b=>b.path===v)&&t.fetchFileContent(g,v);return}if(c.event==="ai:queue_update"){const g=c.data;t.setPromptQueue(g.prompts),t.setQueueStatus(ou(g.prompts)),t.fetchActiveSessions()}}catch{}},e.onclose=()=>{e=null,r=setTimeout(()=>{s=Math.min(s*2,1e4),d()},s)},e.onerror=()=>{}}function _(){r!==null&&(clearTimeout(r),r=null),n!==null&&(clearTimeout(n),n=null),e!==null&&(e.onclose=null,e.close(),e=null)}return{connect:d,disconnect:_}}const Lp="qraftbox-ai-completion-notifications-enabled";function au(){return typeof window<"u"&&"Notification"in window}function lu(){if(typeof window>"u")return!0;try{const t=localStorage.getItem(Lp);return t===null?!0:t!=="false"}catch{return!0}}function Rp(t){const e=t.trim().replace(/\s+/g," ");return e.length<=80?e:`${e.slice(0,77)}...`}async function Ip(){if(lu()&&au()&&Notification.permission==="default")try{await Notification.requestPermission()}catch{}}function Dp(t){if(!lu()||!au()||Notification.permission!=="granted")return;const e=Rp(t.prompt),r=e.length>0?e:"Your AI prompt execution has completed.";try{new Notification("QraftBox AI prompt completed",{body:r,tag:`qraftbox-ai-session-${t.id}`})}catch{}}function Mp(t){let e=null,r=!1;const n=new Set;async function s(){try{const w=await xp();t.setServerPromptQueue(w),t.setQueueStatus(ou(w))}catch{}}async function d(){try{const w=await wp(),b=[],f=[],u=[],l=[],p=Date.now(),y=6e4;for(const k of w){const C={...k,id:k.id,state:k.state,context:k.context,turns:[],currentActivity:k.currentActivity};if(C.state==="running")b.push(C);else if(C.state==="queued")f.push(C);else if(C.state==="completed"){l.push(C);const A=C.completedAt??C.startedAt??C.createdAt,S=new Date(A).getTime();(Number.isNaN(S)||p-S<y)&&u.push(C)}else if(C.state==="failed"||C.state==="cancelled"){const A=C.completedAt??C.startedAt??C.createdAt,S=new Date(A).getTime();(Number.isNaN(S)||p-S<y)&&u.push(C)}}if(r)for(const k of l)n.has(k.id)||(Dp(k),n.add(k.id));else{for(const k of l)n.add(k.id);r=!0}u.length>0?e={session:u[0],expiresAt:p+y}:e!==null&&e.expiresAt>p&&b.length===0&&f.length===0?u.push(e.session):e!==null&&e.expiresAt<=p&&(e=null),t.setRunningSessions(b),t.setQueuedSessions(f),t.setRecentlyCompletedSessions(u),s()}catch{}}async function _(w,b,f,u){if(t.getContextId()===null)return null;try{await Ip();const l=f.resumeSessionId??t.getQraftAiSessionId(),p={runImmediately:b,message:w,context:f,projectPath:t.getProjectPath(),qraftAiSessionId:l,forceNewSession:(u==null?void 0:u.forceNewSession)===!0,aiAgent:void 0,modelProfileId:f.modelProfileId},y=await pp(p);return t.setSessionMessageSubmitted(!0),s(),d(),y}catch(l){return console.error("AI prompt submit error:",l),null}}async function o(w){try{await kp(w),t.setRunningSessions(t.getRunningSessions().filter(b=>b.id!==w)),t.setQueuedSessions(t.getQueuedSessions().filter(b=>b.id!==w)),s()}catch(b){console.error("Failed to cancel session:",b)}}async function a(w){try{await Ep(w),t.setServerPromptQueue(t.getServerPromptQueue().filter(b=>b.id!==w)),s()}catch(b){console.error("Failed to cancel queued prompt:",b)}}function c(w){t.setQraftAiSessionId(w),t.setResumeDisplaySessionId(w),t.navigateToScreen("ai-session"),d(),s()}function g(w){t.getContextId()!==null&&(t.setQraftAiSessionId(w),t.setResumeDisplaySessionId(w),t.setSessionMessageSubmitted(!0),d(),s())}function h(){t.setResumeDisplaySessionId(null),t.setQraftAiSessionId(vl()),t.setSessionMessageSubmitted(!1)}function v(){t.navigateToScreen("ai-session"),d(),s()}function m(){return t.getRunningSessions().length>0||t.getQueuedSessions().length>0||t.getServerPromptQueue().some(w=>w.status==="queued"||w.status==="running")||t.getRecentlyCompletedSessions().length>0}return{submitPrompt:_,fetchPromptQueue:s,fetchActiveSessions:d,handleCancelActiveSession:o,handleCancelQueuedPrompt:a,handleResumeToChanges:c,handleResumeCliSession:g,handleNewSession:h,handleSearchSession:v,hasActiveSessionWork:m}}function Op(t){try{const e=localStorage.getItem(t.storageKey);if(e!==null){const r=Number(e);if(!Number.isNaN(r)&&r>=t.min&&r<=t.max)return r}}catch{}return t.fallback}function uc(t,e){try{localStorage.setItem(t,String(e))}catch{}}function Bp(t){async function e(o){if(!(t.getAllFilesTree()!==null&&!t.getAllFilesTreeStale())){t.setAllFilesLoading(t.getAllFilesTree()===null),t.setAllFilesTreeStale(!1);try{const a=t.getShowIgnored(),c=t.getShowAllFiles(),g=await ia(o,!0,{showIgnored:a,showAllFiles:c});t.setAllFilesTree(ws(g))}catch(a){console.error("Failed to fetch all files:",a)}finally{t.setAllFilesLoading(!1)}}}async function r(o){try{const a=t.getShowIgnored(),c=t.getShowAllFiles(),g=await ia(o,!1,{showIgnored:a,showAllFiles:c});t.setAllFilesTree(ws(g)),t.setAllFilesTreeStale(!1)}catch(a){console.error("Failed to refresh all files:",a)}}async function n(o){const a=t.getContextId();if(a!==null)try{const c=t.getShowIgnored(),g=t.getShowAllFiles(),h=await hp(a,o,{showIgnored:c,showAllFiles:g}),v=t.getAllFilesTree();if(v!==null){const m=h.map(ws);t.setAllFilesTree(su(v,o,m))}}catch(c){console.error(`Failed to load directory children for ${o}:`,c)}}async function s(){const o=t.getContextId();if(o!==null)try{const a=t.getShowIgnored(),c=t.getShowAllFiles(),g=await ia(o,!1,{showIgnored:a,showAllFiles:c}),h=ws(g);return t.setAllFilesTree(h),gl(h,t.getDiffStatusMap())}catch(a){console.error("Failed to load full tree:",a);return}}async function d(o,a){t.setFileContentLoading(!0);try{const c=await fp(o,a);t.setFileContent({path:c.path,content:c.content,language:c.language,isBinary:c.isBinary===!0?!0:void 0,isImage:c.isImage===!0?!0:void 0,isVideo:c.isVideo===!0?!0:void 0,isPdf:c.isPdf===!0?!0:void 0,mimeType:c.mimeType,ctxId:o})}catch(c){console.error("Failed to fetch file content:",c),t.setFileContent(null)}finally{t.setFileContentLoading(!1)}}function _(o,a){return o?a:"full-file"}return{fetchAllFiles:e,refreshAllFiles:r,handleDirectoryExpand:n,handleLoadFullTree:s,fetchFileContent:d,getEffectiveViewMode:_}}var Np=U('<button type="button" title="Create new branch"><svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M7.75 2a.75.75 0 01.75.75V7h4.25a.75.75 0 110 1.5H8.5v4.25a.75.75 0 11-1.5 0V8.5H2.75a.75.75 0 010-1.5H7V2.75A.75.75 0 017.75 2z"></path></svg></button>'),jp=U('<div class="text-[11px] text-danger-fg mt-1"> </div>'),Hp=U('<div class="text-[11px] text-danger-fg mt-1"> </div>'),Fp=U('<div class="px-3 py-2 border-b border-border-default bg-bg-secondary"><div class="flex items-center gap-1.5"><input type="text" placeholder="New branch name..."/> <button type="button"> </button></div> <!> <!></div>'),Up=U('<div class="px-3 py-1.5 text-xs bg-attention-subtle text-attention-fg border-b border-border-default flex items-center gap-1.5"><svg class="w-3.5 h-3.5 shrink-0" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M8.22 1.754a.25.25 0 00-.44 0L1.698 13.132a.25.25 0 00.22.368h12.164a.25.25 0 00.22-.368L8.22 1.754zm-1.763-.707c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0114.082 15H1.918a1.75 1.75 0 01-1.543-2.575L6.457 1.047zM9 11a1 1 0 11-2 0 1 1 0 012 0zm-.25-5.25a.75.75 0 00-1.5 0v2.5a.75.75 0 001.5 0v-2.5z"></path></svg> </div>'),Vp=U('<div class="px-3 py-1.5 text-xs bg-danger-subtle text-danger-fg border-b border-border-default"> </div>'),zp=U('<div class="px-3 py-4 text-sm text-text-secondary text-center">Loading branches...</div>'),Wp=U('<div class="px-3 py-4 text-sm text-text-secondary text-center"> </div>'),qp=Cr('<svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>'),Gp=U('<span class="text-[10px] px-1 py-0 rounded bg-accent-subtle text-accent-fg border border-accent-muted leading-tight">default</span>'),Kp=U('<span class="text-[10px] px-1 py-0 rounded bg-success-subtle text-success-fg border border-success-muted leading-tight">current</span>'),Xp=U('<span class="text-text-placeholder ml-1"> </span>'),Jp=U('<div class="text-[11px] text-text-tertiary truncate mt-0.5"> <!></div>'),Yp=U('<span title="Ahead of upstream"> </span>'),Qp=U('<span title="Behind upstream"> </span>'),Zp=U('<div class="flex items-center gap-1 text-[10px] text-text-tertiary shrink-0"><!> <!></div>'),$p=U(`<span class="w-6 h-6 flex items-center justify-center rounded shrink-0
29
+ text-text-tertiary hover:text-accent-fg hover:bg-bg-tertiary
30
+ transition-colors cursor-pointer" role="button" tabindex="-1" title="Fetch from remote"><svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor"><path d="M8 2a.75.75 0 01.75.75v7.19l2.72-2.72a.75.75 0 111.06 1.06l-4 4a.75.75 0 01-1.06 0l-4-4a.75.75 0 111.06-1.06l2.72 2.72V2.75A.75.75 0 018 2z"></path><path d="M2.75 13.5a.75.75 0 000 1.5h10.5a.75.75 0 000-1.5H2.75z"></path></svg></span>`),e_=U(`<span class="w-6 h-6 flex items-center justify-center rounded shrink-0
31
+ text-text-tertiary hover:text-success-fg hover:bg-bg-tertiary
32
+ transition-colors cursor-pointer" role="button" tabindex="-1"><svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M5 3.254V3.25v.005a.75.75 0 110-.005v.004zm.45 1.9a2.25 2.25 0 10-1.95.218v5.256a2.25 2.25 0 101.5 0V7.123A5.735 5.735 0 009.25 9h1.378a2.251 2.251 0 100-1.5H9.25a4.25 4.25 0 01-3.8-2.346zM12.75 9a.75.75 0 100-1.5.75.75 0 000 1.5zm-8.5 4.5a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg></span>`),t_=U('<button type="button" role="option"><span class="w-4 shrink-0 text-success-fg"><!></span> <div class="flex-1 min-w-0"><div class="flex items-center gap-1.5"><span> </span> <!> <!></div> <!></div> <!> <!> <!></button>'),r_=U('<div class="px-3 py-2 text-xs text-text-secondary text-center">Loading more...</div>'),i_=U("<!> <!>",1),n_=U(`<div class="flex flex-col max-h-80" role="listbox"><div class="px-3 py-2 border-b border-border-default"><div class="flex items-center justify-between mb-1.5"><div class="text-xs text-text-secondary font-semibold"> </div> <!></div> <input type="text" class="w-full px-2 py-1 text-sm bg-bg-secondary border border-border-default rounded
33
+ text-text-primary placeholder:text-text-placeholder
34
+ focus:outline-none focus:ring-1 focus:ring-accent-emphasis focus:border-accent-emphasis"/></div> <!> <!> <!> <div class="overflow-y-auto flex-1"><!></div> <div class="px-3 py-1.5 text-[11px] text-text-tertiary border-t border-border-default"> </div></div>`);function cu(t,e){Kt(e,!0);const r=Re(e,"filterPlaceholder",3,"Filter branches..."),n=Re(e,"warningMessage",3,void 0),s=Re(e,"disabled",3,!1),d=Re(e,"disableCurrentBranch",3,!1),_=Re(e,"selectedBranch",3,void 0),o=Re(e,"onCreateBranch",3,void 0),a=Re(e,"onFetchBranch",3,void 0),c=Re(e,"onMergeBranch",3,void 0),g=30;let h=q(""),v=q(xt([])),m=q(0),w=q(0),b=q(!1),f=q(!1);const u=ye(()=>i(v).length<i(m));let l=q(null),p=q(void 0),y=q(-1),k=q(void 0),C=q(""),A=q(!1),S=q(""),T=q(null),D=q(!1),H=q(void 0);const W=ye(()=>{if(i(S).trim().length===0)return!1;const _e=i(S).trim().toLowerCase();return i(v).some(Me=>Me.name.toLowerCase()===_e)});function M(_e){return!(_e.trim().length===0||/[ ~^:?*[\]\\@{]/.test(_e)||_e.includes("..")||_e.startsWith("/")||_e.endsWith("/")||_e.includes("//")||_e.endsWith(".lock"))}function G(){x(A,!i(A)),x(T,null),x(S,""),i(A)&&requestAnimationFrame(()=>{var _e;(_e=i(H))==null||_e.focus()})}function X(){if(o()===void 0||s())return;const _e=i(S).trim();if(_e.length===0){x(T,"Branch name is required");return}if(!M(_e)){x(T,"Invalid branch name");return}if(i(W)){x(T,`Branch '${_e}' already exists`);return}x(T,null),o()(_e)}const le=ye(()=>{if(i(h).trim().length===0)return i(v);const _e=i(h).toLowerCase();return i(v).filter(Me=>Me.name.toLowerCase().includes(_e))});async function me(_e,Me){x(Me?f:b,!0),x(l,null);try{const oe=new URLSearchParams({offset:String(_e),limit:String(g)}),pe=await fetch(`/api/ctx/${e.contextId}/branches?${oe.toString()}`);if(pe.ok){const Ce=await pe.json();Me?x(v,[...i(v),...Ce.branches],!0):(x(v,[...Ce.branches],!0),x(C,Ce.defaultBranch,!0)),x(m,Ce.total,!0),x(w,_e+Ce.branches.length)}else x(l,"Failed to load branches")}catch{x(l,"Failed to load branches")}finally{x(b,!1),x(f,!1)}}async function xe(){i(f)||!i(u)||await me(i(w),!0)}function R(){if(i(k)===void 0||i(f)||!i(u))return;const{scrollTop:_e,scrollHeight:Me,clientHeight:oe}=i(k);Me-_e-oe<100&&xe()}function j(){x(h,""),x(y,-1),x(l,null),x(v,[],!0),x(m,0),x(w,0),x(A,!1),x(S,""),x(T,null),x(D,!1),me(0,!1),requestAnimationFrame(()=>{var _e;(_e=i(p))==null||_e.focus()})}function N(_e){if(_e.key==="ArrowDown"){_e.preventDefault(),i(y)<i(le).length-1&&Jl(y);return}if(_e.key==="ArrowUp"){_e.preventDefault(),i(y)>0&&Jl(y,-1);return}if(_e.key==="Enter"&&i(y)>=0){_e.preventDefault();const Me=i(le)[i(y)];Me!==void 0&&!s()&&(d()&&Me.name===e.currentBranch||e.onSelect(Me))}}function V(_e){const oe=Date.now()-_e,pe=Math.floor(oe/6e4);if(pe<1)return"just now";if(pe<60)return`${String(pe)}m ago`;const Ce=Math.floor(pe/60);if(Ce<24)return`${String(Ce)}h ago`;const He=Math.floor(Ce/24);if(He<30)return`${String(He)}d ago`;const $e=Math.floor(He/30);return`${String($e)}mo ago`}var $={initialize:j},ee=n_();ee.__keydown=N;var ce=E(ee),ue=E(ce),B=E(ue),I=E(B),z=P(B,2);{var O=_e=>{var Me=Np();Me.__click=G,de(()=>{Ve(Me,1,`w-5 h-5 flex items-center justify-center rounded text-text-secondary
35
+ hover:text-accent-fg hover:bg-bg-tertiary transition-colors cursor-pointer
36
+ ${s()?"opacity-50 cursor-default":""}`),Me.disabled=s()}),L(_e,Me)};Y(z,_e=>{o()!==void 0&&_e(O)})}var ne=P(ue,2);ne.__input=()=>{x(y,-1)},Nr(ne,_e=>x(p,_e),()=>i(p));var ae=P(ce,2);{var te=_e=>{var Me=Fp(),oe=E(Me),pe=E(oe);pe.__keydown=at=>{at.key==="Enter"&&(at.preventDefault(),X()),at.key==="Escape"&&(at.preventDefault(),G())},Nr(pe,at=>x(H,at),()=>i(H));var Ce=P(pe,2);Ce.__click=X;var He=E(Ce),$e=P(oe,2);{var nt=at=>{var Ze=jp(),Le=E(Ze);de(Ae=>se(Le,`Branch '${Ae??""}' already exists`),[()=>i(S).trim()]),L(at,Ze)};Y($e,at=>{i(W)&&at(nt)})}var Fe=P($e,2);{var qe=at=>{var Ze=Hp(),Le=E(Ze);de(()=>se(Le,i(T))),L(at,Ze)};Y(Fe,at=>{i(T)!==null&&!i(W)&&at(qe)})}de((at,Ze)=>{Ve(pe,1,`flex-1 px-2 py-1 text-sm bg-bg-primary border rounded
37
+ text-text-primary placeholder:text-text-placeholder
38
+ focus:outline-none focus:ring-1 focus:ring-accent-emphasis
39
+ ${i(W)?"border-danger-emphasis":"border-border-default focus:border-accent-emphasis"}`),pe.disabled=i(D),Ve(Ce,1,`px-2 py-1 text-xs font-medium rounded transition-colors
40
+ ${at??""}`),Ce.disabled=Ze,se(He,i(D)?"Creating...":"Create")},[()=>i(S).trim().length===0||i(W)||i(D)||s()?"bg-bg-tertiary text-text-placeholder cursor-default":"bg-accent-emphasis text-white hover:bg-accent-fg cursor-pointer",()=>i(S).trim().length===0||i(W)||i(D)||s()]),_r(pe,()=>i(S),at=>x(S,at)),L(_e,Me)};Y(ae,_e=>{i(A)&&o()!==void 0&&_e(te)})}var ge=P(ae,2);{var we=_e=>{var Me=Up(),oe=P(E(Me));de(()=>se(oe,` ${n()??""}`)),L(_e,Me)};Y(ge,_e=>{n()!==void 0&&_e(we)})}var Ie=P(ge,2);{var Pe=_e=>{var Me=Vp(),oe=E(Me);de(()=>se(oe,i(l))),L(_e,Me)};Y(Ie,_e=>{i(l)!==null&&_e(Pe)})}var Se=P(Ie,2),Be=E(Se);{var Ue=_e=>{var Me=zp();L(_e,Me)},je=_e=>{var Me=_t(),oe=Ye(Me);{var pe=He=>{var $e=Wp(),nt=E($e);de(Fe=>se(nt,Fe),[()=>i(h).trim().length>0?"No branches match filter":"No branches found"]),L(He,$e)},Ce=He=>{var $e=i_(),nt=Ye($e);Gt(nt,17,()=>i(le),ui,(at,Ze,Le)=>{const Ae=ye(()=>i(Ze).name===e.currentBranch),it=ye(()=>_()!==void 0?i(Ze).name===_():!1),tt=ye(()=>s()||d()&&i(Ae));var vt=t_();vt.__click=()=>{i(tt)||e.onSelect(i(Ze))};var ft=E(vt),ht=E(ft);{var pt=Xe=>{var ie=qp();L(Xe,ie)};Y(ht,Xe=>{i(it)&&Xe(pt)})}var bt=P(ft,2),Tt=E(bt),et=E(Tt),Ct=E(et),kt=P(et,2);{var Mt=Xe=>{var ie=Gp();L(Xe,ie)};Y(kt,Xe=>{i(Ze).isDefault&&Xe(Mt)})}var Pt=P(kt,2);{var Rt=Xe=>{var ie=Kp();L(Xe,ie)};Y(Pt,Xe=>{i(Ae)&&Xe(Rt)})}var It=P(Tt,2);{var Ht=Xe=>{var ie=Jp(),ke=E(ie),De=P(ke);{var J=Z=>{var re=Xp(),F=E(re);de(Q=>se(F,Q),[()=>V(i(Ze).lastCommit.date)]),L(Z,re)};Y(De,Z=>{i(Ze).lastCommit.date>0&&Z(J)})}de(()=>se(ke,`${i(Ze).lastCommit.message??""} `)),L(Xe,ie)};Y(It,Xe=>{i(Ze).lastCommit.message.length>0&&Xe(Ht)})}var Et=P(bt,2);{var fe=Xe=>{var ie=Zp(),ke=E(ie);{var De=re=>{var F=Yp(),Q=E(F);de(()=>se(Q,`${i(Ze).aheadBehind.ahead??""}^`)),L(re,F)};Y(ke,re=>{i(Ze).aheadBehind.ahead>0&&re(De)})}var J=P(ke,2);{var Z=re=>{var F=Qp(),Q=E(F);de(()=>se(Q,`${i(Ze).aheadBehind.behind??""}v`)),L(re,F)};Y(J,re=>{i(Ze).aheadBehind.behind>0&&re(Z)})}L(Xe,ie)};Y(Et,Xe=>{i(Ze).aheadBehind!==void 0&&(i(Ze).aheadBehind.ahead>0||i(Ze).aheadBehind.behind>0)&&Xe(fe)})}var be=P(Et,2);{var We=Xe=>{var ie=$p();ie.__click=ke=>{var De;ke.stopPropagation(),(De=a())==null||De()},ie.__keydown=ke=>{var De;ke.key==="Enter"&&(ke.stopPropagation(),(De=a())==null||De())},L(Xe,ie)};Y(be,Xe=>{i(Ae)&&a()!==void 0&&Xe(We)})}var Je=P(be,2);{var ut=Xe=>{var ie=e_();ie.__click=ke=>{var De;ke.stopPropagation(),(De=c())==null||De(i(Ze))},ie.__keydown=ke=>{var De;ke.key==="Enter"&&(ke.stopPropagation(),(De=c())==null||De(i(Ze)))},de(()=>Ge(ie,"title",`Merge into ${e.currentBranch??""}`)),L(Xe,ie)};Y(Je,Xe=>{!i(Ae)&&c()!==void 0&&Xe(ut)})}de(()=>{Ve(vt,1,`w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 transition-colors
41
+ ${i(y)===Le?"bg-bg-tertiary":"hover:bg-bg-secondary"}
42
+ ${i(it)?"font-semibold":""}
43
+ ${i(tt)?"cursor-default opacity-50":"cursor-pointer"}`),vt.disabled=i(tt),Ge(vt,"aria-selected",i(it)),Ve(et,1,`font-mono text-xs truncate ${i(it)?"text-text-primary":"text-text-secondary"}`),se(Ct,i(Ze).name)}),Sr("mouseenter",vt,()=>{x(y,Le,!0)}),L(at,vt)});var Fe=P(nt,2);{var qe=at=>{var Ze=r_();L(at,Ze)};Y(Fe,at=>{i(f)&&at(qe)})}L(He,$e)};Y(oe,He=>{i(le).length===0?He(pe):He(Ce,!1)},!0)}L(_e,Me)};Y(Be,_e=>{i(b)?_e(Ue):_e(je,!1)})}Nr(Se,_e=>x(k,_e),()=>i(k));var ze=P(Se,2),Ne=E(ze);return de(()=>{Ge(ee,"aria-label",e.headerText),se(I,e.headerText),Ge(ne,"placeholder",r()),se(Ne,`${i(v).length??""} of ${i(m)??""} branches`)}),_r(ne,()=>i(h),_e=>x(h,_e)),Sr("scroll",Se,R),L(t,ee),Xt($)}tr(["keydown","click","input"]);var s_=U('<div class="px-3 py-1.5 text-xs bg-danger-subtle text-danger-fg border-b border-border-default"> </div>'),o_=U('<div class="px-3 py-1.5 text-xs bg-success-subtle text-success-fg border-b border-border-default"> </div>'),a_=U('<div class="fixed inset-0 z-40" role="presentation"></div> <div class="fixed w-[min(20rem,calc(100vw-1rem))] max-h-96 bg-bg-primary border border-border-default rounded-md shadow-lg z-50 flex flex-col"><!> <!> <!></div>',1),l_=U('<button type="button" title="Click to switch branches"><svg viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M11.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V6A2.5 2.5 0 0110 8.5H6a1 1 0 00-1 1v1.128a2.251 2.251 0 11-1.5 0V5.372a2.25 2.25 0 111.5 0v1.836A2.492 2.492 0 016 7h4a1 1 0 001-1v-.628A2.25 2.25 0 019.5 3.25zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zM3.5 3.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0z"></path></svg> <span> </span> <svg viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M12.78 6.22a.75.75 0 010 1.06l-4.25 4.25a.75.75 0 01-1.06 0L3.22 7.28a.75.75 0 011.06-1.06L8 9.94l3.72-3.72a.75.75 0 011.06 0z"></path></svg></button> <!>',1);function c_(t,e){Kt(e,!0);let r=q(!1),n=q(!1),s=q(null),d=q(null),_=q(!1),o=q(""),a=q(void 0),c=q(void 0),g=q(0),h=q(0),v=q(!1);function m(){return window.innerWidth<=768}function w(){i(r)?u():f()}async function b(){try{const X=await fetch("/api/git-actions/operating");if(X.ok){const le=await X.json();x(_,le.operating,!0),x(o,le.phase,!0)}}catch{x(_,!1),x(o,"")}}function f(){if(i(a)!==void 0){const X=i(a).getBoundingClientRect();x(g,X.bottom+4);const le=8,me=Math.min(320,window.innerWidth-16),xe=Math.max(le,window.innerWidth-me-le);x(h,Math.min(Math.max(X.left,le),xe),!0)}x(r,!0),x(s,null),x(d,null),b(),requestAnimationFrame(()=>{var X;(X=i(c))==null||X.initialize()})}function u(){x(r,!1),x(s,null)}async function l(X){if(X.name!==e.currentBranch){if(await b(),i(_)){x(s,`Cannot switch branches while ${i(o)} is in progress`);return}x(n,!0),x(s,null);try{const me=await(await fetch(`/api/ctx/${e.contextId}/branches/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:X.name})})).json();me.success?(x(d,`Switched to ${me.currentBranch}`),setTimeout(()=>{u(),x(d,null),window.location.reload()},800)):x(s,me.error??"Checkout failed",!0)}catch{x(s,"Checkout failed")}finally{x(n,!1)}}}async function p(X){if(await b(),i(_)){x(s,`Cannot create branches while ${i(o)} is in progress`);return}x(s,null);try{const me=await(await fetch(`/api/ctx/${e.contextId}/branches/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:X})})).json();me.success?(x(d,`Created branch '${me.branch}'`),setTimeout(()=>{u(),x(d,null),window.location.reload()},800)):x(s,me.error??"Branch creation failed",!0)}catch{x(s,"Branch creation failed")}}async function y(){if(await b(),i(_)){x(s,`Cannot fetch while ${i(o)} is in progress`);return}x(s,null);try{const le=await(await fetch(`/api/ctx/${e.contextId}/branches/fetch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:e.currentBranch})})).json();le.success?(x(d,`Fetched ${e.currentBranch}`),setTimeout(()=>{var me;x(d,null),(me=i(c))==null||me.initialize()},800)):x(s,le.error??"Fetch failed",!0)}catch{x(s,"Fetch failed")}}async function k(X){if(await b(),i(_)){x(s,`Cannot merge while ${i(o)} is in progress`);return}x(s,null);try{const me=await(await fetch(`/api/ctx/${e.contextId}/branches/merge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:X.name})})).json();me.success?(x(d,`Merged ${me.mergedBranch} into ${me.currentBranch}`),setTimeout(()=>{u(),x(d,null),window.location.reload()},1200)):x(s,me.error??"Merge failed",!0)}catch{x(s,"Merge failed")}}function C(X){X.key==="Escape"&&u()}gt(()=>{if(!i(r))return;const X=setInterval(()=>{b()},2e3);return()=>{clearInterval(X)}}),gt(()=>{const X=()=>{x(v,m(),!0)};return X(),window.addEventListener("resize",X),window.addEventListener("orientationchange",X),()=>{window.removeEventListener("resize",X),window.removeEventListener("orientationchange",X)}});var A=l_(),S=Ye(A);S.__click=w;var T=E(S),D=P(T,2),H=E(D),W=P(D,2);Nr(S,X=>x(a,X),()=>i(a));var M=P(S,2);{var G=X=>{var le=a_(),me=Ye(le);me.__click=()=>u(),me.__keydown=()=>{};var xe=P(me,2);xe.__keydown=C;var R=E(xe);{var j=ee=>{var ce=s_(),ue=E(ce);de(()=>se(ue,i(s))),L(ee,ce)};Y(R,ee=>{i(s)!==null&&ee(j)})}var N=P(R,2);{var V=ee=>{var ce=o_(),ue=E(ce);de(()=>se(ue,i(d))),L(ee,ce)};Y(N,ee=>{i(d)!==null&&ee(V)})}var $=P(N,2);{let ee=ye(()=>i(_)?`Branch switching disabled while ${i(o)} is in progress`:void 0);Nr(cu($,{get contextId(){return e.contextId},get currentBranch(){return e.currentBranch},headerText:"Switch branches",get warningMessage(){return i(ee)},get disabled(){return i(_)},onSelect:ce=>void l(ce),disableCurrentBranch:!1,get selectedBranch(){return e.currentBranch},onCreateBranch:ce=>void p(ce),onFetchBranch:()=>void y(),onMergeBranch:ce=>void k(ce)}),ce=>x(c,ce,!0),()=>i(c))}de(()=>hi(xe,`top: ${i(g)??""}px; left: ${i(h)??""}px;`)),L(X,le)};Y(M,X=>{i(r)&&X(G)})}de(()=>{Ve(S,1,`font-mono text-accent-fg hover:text-accent-emphasis hover:underline cursor-pointer
44
+ ${i(v)?"text-base px-2 py-1.5 min-h-[40px] gap-1.5":"text-sm"}
45
+ flex items-center transition-colors`),Ve(T,0,`${i(v)?"w-4.5 h-4.5":"w-3.5 h-3.5"} shrink-0`),se(H,e.currentBranch),Ve(W,0,`${i(v)?"w-4 h-4":"w-3 h-3"} shrink-0 transition-transform ${i(r)?"rotate-180":""}`)}),L(t,A),Xt()}tr(["click","keydown"]);var d_=U('<span class="px-1.5 py-0.5 text-xs rounded bg-attention-muted text-attention-fg"> </span>'),u_=U('<span class="text-border-default">|</span>'),h_=U('<a target="_blank" rel="noopener noreferrer" class="text-xs text-accent-fg hover:underline"> </a>'),f_=U('<div class="flex items-center gap-3 text-sm"><!> <!> <!> <!></div>');function p_(t,e){Kt(e,!0);let r=q(null),n=q(null),s=q(null);const d=ye(()=>{var C;return((C=i(r))==null?void 0:C.branch)??""}),_=ye(()=>{var C;return(C=i(n))!=null&&C.status.hasPR&&i(n).status.pr!==null&&i(n).status.pr.state==="open"?i(n).status.pr:null});async function o(){try{const C=await fetch(`/api/ctx/${e.contextId}/status`);C.ok&&x(r,await C.json(),!0)}catch{}}async function a(){try{const C=await fetch(`/api/ctx/${e.contextId}/pr/status`);C.ok&&x(n,await C.json(),!0)}catch{}}async function c(){try{const C=await fetch(`/api/ctx/${e.contextId}/worktree/${e.contextId}/worktree/main`);C.ok&&x(s,await C.json(),!0)}catch{}}function g(C){const A=C.replace(/\/$/,"").split("/"),S=A[A.length-1];return S!==void 0&&S.length>0?S:"/"}const h=ye(()=>e.projectPath!==void 0&&e.projectPath.length>0?g(e.projectPath):null);async function v(){await Promise.all([o(),a(),c()])}gt(()=>{v();const C=setInterval(()=>{v()},3e4);return()=>{clearInterval(C)}});var m=f_(),w=E(m);{var b=C=>{c_(C,{get contextId(){return e.contextId},get currentBranch(){return i(d)}})};Y(w,C=>{i(d).length>0&&C(b)})}var f=P(w,2);{var u=C=>{var A=d_(),S=E(A);de(()=>{Ge(A,"title",`Worktree: ${e.projectPath??""??""}`),se(S,`worktree:${i(h)??""}`)}),L(C,A)};Y(f,C=>{var A;(A=i(s))!=null&&A.isWorktree&&i(h)!==null&&C(u)})}var l=P(f,2);{var p=C=>{var A=u_();L(C,A)};Y(l,C=>{i(d).length>0&&i(_)!==null&&C(p)})}var y=P(l,2);{var k=C=>{var A=h_(),S=E(A);de(()=>{Ge(A,"href",i(_).url),se(S,`PR #${i(_).number??""}`)}),L(C,A)};Y(y,C=>{i(_)!==null&&C(k)})}L(t,m),Xt()}var __=U('<div class="fixed inset-0 z-40" role="presentation"></div>'),v_=U('<div class="mx-3 mt-3 p-2 rounded border border-danger-muted bg-danger-subtle text-danger-fg text-xs" role="alert"> </div>'),g_=U(`<div><label for="wt-base" class="block text-xs text-text-secondary mb-1">Base branch (optional)</label> <input id="wt-base" type="text" placeholder="main" class="w-full px-2 py-1.5 text-sm rounded border border-border-default
46
+ bg-bg-primary text-text-primary
47
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis
48
+ placeholder:text-text-tertiary"/></div>`),m_=U(`<div class="fixed w-[min(20rem,calc(100vw-1rem))] bg-bg-secondary border border-border-default rounded-lg shadow-lg z-50"><div class="p-3 border-b border-border-default"><h3 class="text-sm font-semibold text-text-primary">Create New Worktree</h3></div> <!> <div class="p-3 space-y-3"><div><label for="wt-branch" class="block text-xs text-text-secondary mb-1">Branch name</label> <input id="wt-branch" type="text" placeholder="feature/my-branch" class="w-full px-2 py-1.5 text-sm rounded border border-border-default
49
+ bg-bg-primary text-text-primary
50
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis
51
+ placeholder:text-text-tertiary"/></div> <label class="flex items-center gap-2 text-sm text-text-secondary"><input type="checkbox" class="rounded border-border-default"/> Create new branch</label> <!> <div class="flex items-center gap-2 pt-1"><button type="button" class="px-3 py-1.5 rounded text-sm font-medium
52
+ bg-success-emphasis hover:brightness-110 text-white
53
+ disabled:opacity-50 disabled:cursor-not-allowed
54
+ transition-colors"> </button> <button type="button" class="px-3 py-1.5 rounded text-sm
55
+ text-text-secondary hover:text-text-primary
56
+ hover:bg-bg-tertiary transition-colors">Cancel</button></div></div></div>`),b_=U('<div class="mx-3 mt-3 p-2 rounded border border-danger-muted bg-danger-subtle text-danger-fg text-xs shrink-0" role="alert"> </div>'),y_=U('<div class="flex items-center justify-center py-6"><svg class="animate-spin h-5 w-5 text-accent-fg" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg></div>'),x_=U('<div class="py-6 text-center text-sm text-text-tertiary">No worktrees found</div>'),w_=U('<span class="px-1.5 py-0.5 text-xs rounded bg-bg-tertiary text-text-secondary shrink-0">root</span>'),S_=U('<span class="px-1.5 py-0.5 text-xs rounded bg-accent-subtle text-accent-fg shrink-0">current</span>'),C_=U('<button type="button"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> <div class="flex-1 min-w-0"><div class="flex items-center gap-2"><span> </span> <!> <!></div> <p class="text-xs text-text-tertiary font-mono truncate mt-0.5"> </p></div></button>'),k_=U('<div class="fixed w-[min(20rem,calc(100vw-1rem))] max-h-96 bg-bg-secondary border border-border-default rounded-lg shadow-lg z-50 flex flex-col"><div class="p-3 border-b border-border-default shrink-0"><h3 class="text-sm font-semibold text-text-primary">Worktrees</h3></div> <!> <div class="flex-1 overflow-y-auto"><!></div></div>'),E_=U('<!> <div class="flex items-center h-full"><button type="button"><svg viewBox="0 0 16 16" fill="currentColor" class="shrink-0"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> Worktree</button> <button type="button"><svg viewBox="0 0 16 16" fill="currentColor"><path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></button></div> <!> <!>',1);function A_(t,e){Kt(e,!0);const r=Re(e,"disabled",3,!1);let n=q(!1),s=q(xt([])),d=q(!1),_=q(null),o=q(!1),a=q(""),c=q(!0),g=q(""),h=q(!1),v=q(null),m=q(void 0),w=q(void 0),b=q(0),f=q(0),u=q(!1);function l(){return window.innerWidth<=768}async function p(){try{x(d,!0),x(_,null);const $=await fetch(`/api/ctx/${e.contextId}/worktree/${e.contextId}/worktree`);if(!$.ok){const ce=await $.json();throw new Error(ce.error??`HTTP ${$.status}`)}const ee=await $.json();x(s,ee.worktrees,!0)}catch($){x(_,$ instanceof Error?$.message:"Failed to fetch worktrees",!0)}finally{x(d,!1)}}function y($){if($!==void 0){const ee=$.getBoundingClientRect();x(b,ee.bottom+4);const ce=8,ue=Math.min(320,window.innerWidth-16),B=Math.max(ce,window.innerWidth-ue-ce);x(f,Math.min(Math.max(ee.left,ce),B),!0)}}async function k(){if(i(n)){x(n,!1);return}y(i(m)),x(n,!0),x(o,!1),await p()}async function C(){if(i(o)){x(o,!1);return}y(i(m)),x(o,!0),x(n,!1),x(a,""),x(c,!0),x(g,""),x(v,null),await p()}async function A(){const $=i(a).trim();if($.length!==0)try{x(h,!0),x(v,null);const ee={branch:$};if(i(c)){ee.createBranch=!0;const B=i(g).trim();B.length>0&&(ee.baseBranch=B)}const ce=await fetch(`/api/ctx/${e.contextId}/worktree/${e.contextId}/worktree`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ee)});if(!ce.ok){const B=await ce.json();throw new Error(B.error??`HTTP ${ce.status}`)}const ue=await ce.json();if(!ue.success)throw new Error(ue.error??"Failed to create worktree");await S(ue.path),x(o,!1)}catch(ee){x(v,ee instanceof Error?ee.message:"Failed to create worktree",!0)}finally{x(h,!1)}}async function S($){if($===e.projectPath){x(n,!1);return}try{const ee=await fetch("/api/workspace/tabs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$})});if(!ee.ok){const ce=await ee.json();throw new Error(ce.error??`HTTP ${ee.status}`)}x(n,!1),x(o,!1),e.onWorktreeSwitch()}catch(ee){x(_,ee instanceof Error?ee.message:"Failed to switch directory",!0)}}function T(){x(n,!1),x(o,!1)}function D($,ee){return $.length<=ee?$:"..."+$.slice($.length-ee+3)}gt(()=>{const $=()=>{x(u,l(),!0)};return $(),window.addEventListener("resize",$),window.addEventListener("orientationchange",$),()=>{window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$)}});var H=E_(),W=Ye(H);{var M=$=>{var ee=__();ee.__click=T,ee.__keydown=()=>{},L($,ee)};Y(W,$=>{(i(n)||i(o))&&$(M)})}var G=P(W,2),X=E(G);X.__click=()=>{r()||C()};var le=E(X);Nr(X,$=>x(m,$),()=>i(m));var me=P(X,2);me.__click=()=>{r()||k()};var xe=E(me);Nr(me,$=>x(w,$),()=>i(w));var R=P(G,2);{var j=$=>{var ee=m_(),ce=P(E(ee),2);{var ue=Se=>{var Be=v_(),Ue=E(Be);de(()=>se(Ue,i(v))),L(Se,Be)};Y(ce,Se=>{i(v)!==null&&Se(ue)})}var B=P(ce,2),I=E(B),z=P(E(I),2);z.__keydown=Se=>{Se.key==="Enter"&&i(a).trim().length>0&&(Se.preventDefault(),A())};var O=P(I,2),ne=E(O),ae=P(O,2);{var te=Se=>{var Be=g_(),Ue=P(E(Be),2);_r(Ue,()=>i(g),je=>x(g,je)),L(Se,Be)};Y(ae,Se=>{i(c)&&Se(te)})}var ge=P(ae,2),we=E(ge);we.__click=()=>void A();var Ie=E(we),Pe=P(we,2);Pe.__click=()=>{x(o,!1)},de(Se=>{hi(ee,`top: ${i(b)??""}px; left: ${i(f)??""}px;`),we.disabled=Se,se(Ie,i(h)?"Creating...":"Create & Switch")},[()=>i(h)||i(a).trim().length===0]),_r(z,()=>i(a),Se=>x(a,Se)),Da(ne,()=>i(c),Se=>x(c,Se)),L($,ee)};Y(R,$=>{i(o)&&$(j)})}var N=P(R,2);{var V=$=>{var ee=k_(),ce=P(E(ee),2);{var ue=ne=>{var ae=b_(),te=E(ae);de(()=>se(te,i(_))),L(ne,ae)};Y(ce,ne=>{i(_)!==null&&ne(ue)})}var B=P(ce,2),I=E(B);{var z=ne=>{var ae=y_();L(ne,ae)},O=ne=>{var ae=_t(),te=Ye(ae);{var ge=Ie=>{var Pe=x_();L(Ie,Pe)},we=Ie=>{var Pe=_t(),Se=Ye(Pe);Gt(Se,17,()=>i(s),Be=>Be.path,(Be,Ue)=>{var je=C_();je.__click=()=>void S(i(Ue).path);var ze=E(je),Ne=P(ze,2),_e=E(Ne),Me=E(_e),oe=E(Me),pe=P(Me,2);{var Ce=qe=>{var at=w_();L(qe,at)};Y(pe,qe=>{i(Ue).isMain&&qe(Ce)})}var He=P(pe,2);{var $e=qe=>{var at=S_();L(qe,at)};Y(He,qe=>{i(Ue).path===e.projectPath&&qe($e)})}var nt=P(_e,2),Fe=E(nt);de(qe=>{Ve(je,1,`w-full text-left px-4 py-2.5 flex items-center gap-3
57
+ hover:bg-bg-tertiary transition-colors
58
+ border-b border-border-default last:border-b-0
59
+ ${i(Ue).path===e.projectPath?"bg-accent-subtle":""}`),je.disabled=i(Ue).path===e.projectPath,Ve(ze,0,`shrink-0 ${i(Ue).path===e.projectPath?"text-accent-fg":"text-text-tertiary"}`),Ve(Me,1,`text-sm text-text-primary truncate ${i(Ue).path===e.projectPath?"font-semibold":""}`),se(oe,i(Ue).branch??"(detached)"),Ge(nt,"title",i(Ue).path),se(Fe,qe)},[()=>D(i(Ue).path,50)]),L(Be,je)}),L(Ie,Pe)};Y(te,Ie=>{i(s).length===0?Ie(ge):Ie(we,!1)},!0)}L(ne,ae)};Y(I,ne=>{i(d)?ne(z):ne(O,!1)})}de(()=>hi(ee,`top: ${i(b)??""}px; left: ${i(f)??""}px;`)),L($,ee)};Y(N,$=>{i(n)&&$(V)})}de(()=>{Ve(X,1,`${i(u)?"px-3 py-2 min-h-[40px]":"px-2 py-1.5"} text-sm transition-colors h-full flex items-center gap-1
60
+ ${r()?"text-text-tertiary cursor-not-allowed opacity-50":i(o)?"text-text-primary font-semibold":"text-text-secondary hover:text-text-primary"}`),Ge(X,"title",r()?"Not a git repository":"Create new worktree"),X.disabled=r(),Ge(le,"width",i(u)?"16":"14"),Ge(le,"height",i(u)?"16":"14"),Ve(me,1,`${i(u)?"px-2.5 py-2 min-h-[40px] min-w-[32px]":"px-1 py-1.5"} text-sm transition-colors h-full flex items-center justify-center
61
+ ${r()?"text-text-tertiary cursor-not-allowed opacity-50":i(n)?"text-text-primary":"text-text-secondary hover:text-text-primary"}`),Ge(me,"title",r()?"Not a git repository":"Show worktrees"),me.disabled=r(),Ge(xe,"width",i(u)?"14":"12"),Ge(xe,"height",i(u)?"14":"12"),Ve(xe,0,`transition-transform ${i(n)?"rotate-180":""}`)}),L(t,H),Xt()}tr(["click","keydown"]);var T_=U('<!> <span class="text-border-default mx-1 shrink-0">|</span>',1),P_=U('<p class="px-4 py-2 text-xs text-danger-fg"> </p>'),L_=U(`<div class="border-t border-border-default my-1"></div> <button type="button" class="w-full text-left px-4 py-2 text-sm text-text-secondary hover:bg-bg-tertiary
62
+ hover:text-text-primary transition-colors disabled:opacity-50 disabled:cursor-not-allowed"> </button> <!>`,1),R_=U('<div class="absolute right-0 top-full mt-1 w-40 bg-bg-secondary border border-border-default rounded-md shadow-lg z-50 py-1"><button type="button">System Info</button> <button type="button">Model Profiles</button> <button type="button">Action Defaults</button> <!></div>'),I_=U('<div class="fixed inset-0 z-40" role="presentation"></div>'),D_=U('<div class="px-2 py-1.5 text-xs text-text-tertiary">No open projects</div>'),M_=U('<div class="group flex items-center rounded svelte-1heq4ss"><button type="button"><span class="truncate flex-1"> </span></button> <button type="button"><svg width="10" height="10" viewBox="0 0 16 16" fill="currentColor"><path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.75.75 0 1 1 1.06 1.06L9.06 8l3.22 3.22a.75.75 0 1 1-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 0 1-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button></div>'),O_=U('<div class="pl-4 pr-1 py-1 space-y-0.5"><!></div>'),B_=U('<aside class="fixed top-12 left-0 bottom-0 z-50 w-[22rem] max-w-[92vw] border-r border-border-default bg-bg-secondary shadow-xl flex flex-col"><div class="h-10 px-3 border-b border-border-default flex items-center justify-between"><span class="text-xs font-semibold uppercase tracking-wider text-text-tertiary">Workspace</span> <span class="text-xs text-text-tertiary"> </span></div> <div class="overflow-y-auto flex-1 p-2"><div class="flex items-center gap-1"><button type="button" class="flex-1 h-8 px-2 rounded text-sm text-left text-text-secondary hover:text-text-primary hover:bg-bg-tertiary flex items-center gap-2"><svg width="12" height="12" viewBox="0 0 16 16" fill="currentColor"><path d="M6.22 3.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 1 1-1.06-1.06L9.94 8 6.22 4.28a.75.75 0 0 1 0-1.06Z"></path></svg> <svg width="12" height="12" viewBox="0 0 16 16" fill="currentColor"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> <span>Projects</span></button> <button type="button" class="h-8 w-8 rounded border border-border-default text-sm text-text-secondary hover:text-text-primary hover:bg-bg-tertiary transition-colors disabled:opacity-50 disabled:cursor-not-allowed" title="New project" aria-label="New project">+</button></div> <!></div></aside>'),N_=U('<p class="mb-2 text-xs text-text-tertiary">Temporary project mode is active. Project add/change is disabled.</p>'),j_=U('<p class="mt-1.5 text-xs text-danger-fg"> </p>'),H_=U('<div class="flex items-center hover:bg-bg-tertiary transition-colors"><button type="button" class="flex-1 text-left px-4 py-1.5 text-sm text-text-secondary hover:text-text-primary transition-colors flex items-center gap-2 min-w-0"><svg width="12" height="12" viewBox="0 0 16 16" fill="currentColor"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> <span class="truncate flex-1"> </span> <span class="text-xs text-text-tertiary truncate max-w-[120px]"> </span></button> <button type="button" class="shrink-0 p-1 mr-2 rounded text-text-tertiary hover:text-danger-fg hover:bg-danger-subtle transition-colors" title="Remove from history"><svg width="10" height="10" viewBox="0 0 16 16" fill="currentColor"><path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.75.75 0 1 1 1.06 1.06L9.06 8l3.22 3.22a.75.75 0 1 1-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 0 1-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button></div>'),F_=U('<div class="border-t border-border-default py-2"><div class="px-4 pb-1 text-xs text-text-tertiary font-semibold uppercase tracking-wider">Previous Projects</div> <div class="max-h-60 overflow-y-auto"></div></div>'),U_=U(`<div class="fixed inset-0 z-[60] flex items-center justify-center p-4" role="dialog" aria-modal="true" aria-label="Project selector"><button type="button" class="absolute inset-0 bg-black/40" aria-label="Close project selector"></button> <div class="relative z-10 w-full max-w-xl bg-bg-secondary border border-border-default rounded-md shadow-xl"><div class="px-4 py-3 border-b border-border-default flex items-center justify-between gap-2"><h2 class="text-sm font-semibold text-text-primary">Select Project</h2> <button type="button" class="h-7 w-7 rounded text-text-tertiary hover:text-text-primary hover:bg-bg-tertiary transition-colors" aria-label="Close"><svg width="10" height="10" viewBox="0 0 16 16" fill="currentColor"><path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.75.75 0 1 1 1.06 1.06L9.06 8l3.22 3.22a.75.75 0 1 1-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 0 1-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button></div> <div class="p-3"><!> <label for="project-popup-open-directory-input" class="text-xs text-text-tertiary font-semibold uppercase tracking-wider mb-1.5 block">Open Directory</label> <form class="flex items-center gap-1.5"><input id="project-popup-open-directory-input" type="text" class="flex-1 px-2 py-1.5 text-sm rounded border border-border-default
63
+ bg-bg-primary text-text-primary font-mono
64
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis
65
+ placeholder:text-text-tertiary" placeholder="/path/to/project"/> <button type="button" class="p-1.5 rounded text-text-secondary hover:text-accent-fg hover:bg-bg-tertiary
66
+ disabled:opacity-50 disabled:cursor-not-allowed
67
+ transition-colors shrink-0" title="Browse directories"><svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg></button> <button type="submit" class="px-2 py-1.5 rounded text-sm font-medium
68
+ bg-bg-tertiary text-text-primary hover:bg-border-default
69
+ disabled:opacity-50 disabled:cursor-not-allowed
70
+ transition-colors shrink-0"> </button></form> <!></div> <!></div></div>`),V_=U(`<header class="h-12 border-b border-border-default flex items-center px-4 bg-bg-secondary gap-4"><div class="flex items-center gap-2 shrink-0"><h1 class="text-lg font-semibold">QraftBox</h1> <button type="button" class="h-9 max-w-[240px] px-3 rounded border border-border-default bg-bg-primary text-sm
71
+ text-text-secondary hover:text-text-primary hover:bg-bg-tertiary transition-colors
72
+ flex items-center gap-2"><svg width="12" height="12" viewBox="0 0 16 16" fill="currentColor"><path d="M6.22 3.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 1 1-1.06-1.06L9.94 8 6.22 4.28a.75.75 0 0 1 0-1.06Z"></path></svg> <svg width="13" height="13" viewBox="0 0 16 16" fill="currentColor"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> <span class="truncate"> </span> <span class="text-xs text-text-tertiary"> </span></button></div> <div class="flex items-center min-w-0 flex-1 gap-2 overflow-hidden"><nav class="flex items-center gap-0 h-full overflow-x-auto"><button type="button">Files</button> <button type="button">Sessions</button> <button type="button">Commits</button> <button type="button">Terminal</button></nav></div> <div class="ml-auto flex items-center gap-2"><!> <!> <div class="relative"><button type="button" class="p-2 rounded text-text-secondary hover:text-text-primary hover:bg-bg-tertiary transition-colors" aria-label="Open menu" title="Open menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M1 2.75A.75.75 0 0 1 1.75 2h12.5a.75.75 0 0 1 0 1.5H1.75A.75.75 0 0 1 1 2.75Zm0 5A.75.75 0 0 1 1.75 7h12.5a.75.75 0 0 1 0 1.5H1.75A.75.75 0 0 1 1 7.75ZM1.75 12h12.5a.75.75 0 0 1 0 1.5H1.75a.75.75 0 0 1 0-1.5Z"></path></svg></button> <!></div></div></header> <!> <!> <!>`,1);function z_(t,e){Kt(e,!0);let r=q(!1),n=q(!1),s=q(!1),d=q(!0),_=q(!1),o=q(null);const a=ye(()=>e.workspaceTabs.find(ue=>ue.id===e.contextId)??null),c=ye(()=>{var ue;return((ue=i(a))==null?void 0:ue.name)??"No Project"});function g(ue,B=30){return ue.length<=B?ue:"..."+ue.slice(-B)}async function h(){if(!(e.contextId===null||e.activeTabIsGitRepo||i(_))){x(_,!0),x(o,null);try{const ue=await fetch("/api/git-actions/init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath})});if(!ue.ok){const B=await ue.json().catch(()=>({}));throw new Error(B.error??`Git init failed with status ${ue.status}`)}await e.onPushSuccess("init"),x(r,!1)}catch(ue){x(o,ue instanceof Error?ue.message:"Git init failed",!0)}finally{x(_,!1)}}}var v=V_(),m=Ye(v),w=E(m),b=P(E(w),2);b.__click=()=>{x(s,!i(s)),i(s)&&x(r,!1)};var f=E(b),u=P(f,4),l=E(u),p=P(u,2),y=E(p),k=P(w,2),C=E(k),A=E(C);A.__click=()=>e.onNavigateToScreen("files");var S=P(A,2);S.__click=()=>e.onNavigateToScreen("ai-session");var T=P(S,2);T.__click=()=>e.onNavigateToScreen("commits");var D=P(T,2);D.__click=()=>e.onNavigateToScreen("terminal");var H=P(k,2),W=E(H);{var M=ue=>{{let B=ye(()=>!e.activeTabIsGitRepo);A_(ue,{get contextId(){return e.contextId},get projectPath(){return e.projectPath},get onWorktreeSwitch(){return e.onWorktreeSwitch},get disabled(){return i(B)}})}};Y(W,ue=>{e.contextId!==null&&ue(M)})}var G=P(W,2);{var X=ue=>{var B=T_(),I=Ye(B);p_(I,{get contextId(){return e.contextId},get projectPath(){return e.projectPath}}),L(ue,B)};Y(G,ue=>{e.contextId!==null&&e.activeTabIsGitRepo&&ue(X)})}var le=P(G,2),me=E(le);me.__click=()=>{x(r,!i(r)),i(r)&&(x(s,!1),x(n,!1))};var xe=P(me,2);{var R=ue=>{var B=R_(),I=E(B);I.__click=()=>{e.onNavigateToScreen("system-info"),x(r,!1)};var z=P(I,2);z.__click=()=>{e.onNavigateToScreen("model-profiles"),x(r,!1)};var O=P(z,2);O.__click=()=>{e.onNavigateToScreen("action-defaults"),x(r,!1)};var ne=P(O,2);{var ae=te=>{var ge=L_(),we=P(Ye(ge),2);we.__click=()=>void h();var Ie=E(we),Pe=P(we,2);{var Se=Be=>{var Ue=P_(),je=E(Ue);de(()=>se(je,i(o))),L(Be,Ue)};Y(Pe,Be=>{i(o)!==null&&Be(Se)})}de(()=>{we.disabled=i(_),se(Ie,i(_)?"Initializing Git Repository...":"Initialize Git Repository")}),L(te,ge)};Y(ne,te=>{e.contextId!==null&&!e.activeTabIsGitRepo&&te(ae)})}de(()=>{Ve(I,1,`w-full text-left px-4 py-2 text-sm hover:bg-bg-tertiary transition-colors
73
+ ${e.currentScreen==="system-info"?"text-text-primary font-semibold":"text-text-secondary"}`),Ve(z,1,`w-full text-left px-4 py-2 text-sm hover:bg-bg-tertiary transition-colors
74
+ ${e.currentScreen==="model-profiles"?"text-text-primary font-semibold":"text-text-secondary"}`),Ve(O,1,`w-full text-left px-4 py-2 text-sm hover:bg-bg-tertiary transition-colors
75
+ ${e.currentScreen==="action-defaults"?"text-text-primary font-semibold":"text-text-secondary"}`)}),L(ue,B)};Y(xe,ue=>{i(r)&&ue(R)})}var j=P(m,2);{var N=ue=>{var B=I_();B.__click=()=>{x(r,!1),x(s,!1)},B.__keydown=()=>{},L(ue,B)};Y(j,ue=>{(i(r)||i(s))&&ue(N)})}var V=P(j,2);{var $=ue=>{var B=B_(),I=E(B),z=P(E(I),2),O=E(z),ne=P(I,2),ae=E(ne),te=E(ae);te.__click=()=>{x(d,!i(d))};var ge=E(te),we=P(te,2);we.__click=()=>{e.canManageProjects&&(x(n,!0),e.onNewProjectPathChange(""),e.onFetchRecentProjects())};var Ie=P(ae,2);{var Pe=Se=>{var Be=O_(),Ue=E(Be);{var je=Ne=>{var _e=D_();L(Ne,_e)},ze=Ne=>{var _e=_t(),Me=Ye(_e);Gt(Me,17,()=>e.workspaceTabs,oe=>oe.id,(oe,pe)=>{var Ce=M_();Ce.__click=()=>{e.canManageProjects&&(x(s,!1),e.onSwitchProject(i(pe).id))};var He=E(Ce);He.__click=qe=>{qe.stopPropagation(),e.canManageProjects&&(x(s,!1),e.onSwitchProject(i(pe).id))};var $e=E(He),nt=E($e),Fe=P(He,2);Fe.__click=qe=>{e.canManageProjects&&e.onCloseProjectTab(i(pe).id,qe)},de(()=>{Ve(He,1,`flex-1 min-w-0 px-2 py-1.5 text-sm rounded text-left flex items-center gap-2 transition-colors
76
+ ${i(pe).id===e.contextId?"bg-bg-tertiary text-text-primary font-semibold":"text-text-secondary hover:text-text-primary hover:bg-bg-tertiary"}`),Ge(He,"title",i(pe).path),se(nt,i(pe).name),Ve(Fe,1,`project-tab-close w-5 h-5 flex items-center justify-center shrink-0 mr-1
77
+ rounded-sm text-text-tertiary hover:text-text-primary hover:bg-bg-tertiary
78
+ ${i(pe).id===e.contextId?"project-tab-close-active":""}`,"svelte-1heq4ss"),Ge(Fe,"title",`Close ${i(pe).name??""}`)}),L(oe,Ce)}),L(Ne,_e)};Y(Ue,Ne=>{e.workspaceTabs.length===0?Ne(je):Ne(ze,!1)})}L(Se,Be)};Y(Ie,Se=>{i(d)&&Se(Pe)})}de(()=>{se(O,`${e.workspaceTabs.length??""} projects`),Ve(ge,0,`transition-transform ${i(d)?"rotate-90":""}`),we.disabled=!e.canManageProjects}),L(ue,B)};Y(V,ue=>{i(s)&&ue($)})}var ee=P(V,2);{var ce=ue=>{var B=U_();B.__keydown=_e=>{_e.key==="Escape"&&x(n,!1)};var I=E(B);I.__click=()=>{x(n,!1)};var z=P(I,2),O=E(z),ne=P(E(O),2);ne.__click=()=>{x(n,!1)};var ae=P(O,2),te=E(ae);{var ge=_e=>{var Me=N_();L(_e,Me)};Y(te,_e=>{e.canManageProjects||_e(ge)})}var we=P(te,4),Ie=E(we);Ie.__input=_e=>e.onNewProjectPathChange(_e.currentTarget.value);var Pe=P(Ie,2);Pe.__click=()=>void e.onPickDirectory();var Se=P(Pe,2),Be=E(Se),Ue=P(we,2);{var je=_e=>{var Me=j_(),oe=E(Me);de(()=>se(oe,e.newProjectError)),L(_e,Me)};Y(Ue,_e=>{e.newProjectError!==null&&_e(je)})}var ze=P(ae,2);{var Ne=_e=>{var Me=F_(),oe=P(E(Me),2);Gt(oe,21,()=>e.availableRecentProjects,pe=>pe.path,(pe,Ce)=>{var He=H_(),$e=E(He);$e.__click=async()=>{e.canManageProjects&&(await e.onOpenRecentProject(i(Ce).path),x(n,!1),x(s,!1))};var nt=E($e),Fe=P(nt,2),qe=E(Fe),at=P(Fe,2),Ze=E(at),Le=P($e,2);Le.__click=Ae=>{Ae.stopPropagation(),e.canManageProjects&&e.onRemoveRecentProject(i(Ce).path)},de(Ae=>{$e.disabled=!e.canManageProjects,Ge($e,"title",i(Ce).path),Ve(nt,0,`shrink-0 ${i(Ce).isGitRepo?"text-accent-fg":"text-text-tertiary"}`),se(qe,i(Ce).name),se(Ze,Ae),Le.disabled=!e.canManageProjects},[()=>g(i(Ce).path,20)]),L(pe,He)}),L(_e,Me)};Y(ze,_e=>{e.availableRecentProjects.length>0&&_e(Ne)})}de(_e=>{_l(Ie,e.newProjectPath),Ie.disabled=!e.canManageProjects||e.newProjectLoading||e.pickingDirectory,Pe.disabled=!e.canManageProjects||e.pickingDirectory||e.newProjectLoading,Se.disabled=_e,se(Be,e.newProjectLoading?"...":"Open")},[()=>!e.canManageProjects||e.newProjectPath.trim().length===0||e.newProjectLoading]),Sr("submit",we,async _e=>{_e.preventDefault(),await e.onOpenProjectByPath(e.newProjectPath),x(n,!1),x(s,!1)}),L(ue,B)};Y(ee,ue=>{i(n)&&ue(ce)})}de(()=>{Ge(b,"title",e.projectPath),Ve(f,0,`transition-transform ${i(s)?"rotate-90":""}`),se(l,i(c)),se(y,`(${e.workspaceTabs.length??""})`),Ve(A,1,`px-3 py-1.5 text-sm transition-colors h-full border-b-2 whitespace-nowrap
79
+ ${e.currentScreen==="files"?"text-text-primary font-semibold border-accent-emphasis":"text-text-secondary border-transparent hover:text-text-primary hover:border-border-emphasis"}`),Ve(S,1,`px-3 py-1.5 text-sm transition-colors h-full border-b-2 whitespace-nowrap
80
+ ${e.currentScreen==="ai-session"?"text-text-primary font-semibold border-accent-emphasis":"text-text-secondary border-transparent hover:text-text-primary hover:border-border-emphasis"}`),Ve(T,1,`px-3 py-1.5 text-sm transition-colors h-full border-b-2 whitespace-nowrap
81
+ ${e.currentScreen==="commits"?"text-text-primary font-semibold border-accent-emphasis":"text-text-secondary border-transparent hover:text-text-primary hover:border-border-emphasis"}`),Ve(D,1,`px-3 py-1.5 text-sm transition-colors h-full border-b-2 whitespace-nowrap
82
+ ${e.currentScreen==="terminal"?"text-text-primary font-semibold border-accent-emphasis":"text-text-secondary border-transparent hover:text-text-primary hover:border-border-emphasis"}`)}),L(t,v),Xt()}tr(["click","keydown","input"]);var W_=U(`<span class="px-2 py-0.5 text-xs font-medium
83
+ bg-accent-subtle text-accent-fg rounded
84
+ flex-shrink-0" title="Git repository">Git</span>`),q_=U(`<span class="px-2 py-0.5 text-xs font-medium
85
+ bg-bg-secondary text-text-secondary rounded
86
+ flex-shrink-0" title="Hidden file">Hidden</span>`),G_=U('<span class="text-text-tertiary text-xs flex-shrink-0" title="Symbolic link">→</span>'),K_=U('<div class="flex-shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-text-tertiary" aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg></div>'),X_=U('<div role="option" tabindex="0"><div class="flex-shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path></path></svg></div> <div class="flex-1 min-w-0"><div class="flex items-center gap-2"><span> </span> <!> <!> <!></div></div> <!></div>');function J_(t,e){Kt(e,!0);let r=null;function n(){r!==null?(clearTimeout(r),r=null,e.onClick()):(e.onSelect(),r=setTimeout(()=>{r=null},300))}function s(S){S.key==="Enter"&&(S.preventDefault(),e.onClick())}const d=ye(()=>e.entry.isDirectory?(e.entry.isGitRepo,"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"):"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"),_=ye(()=>e.entry.isDirectory?e.entry.isGitRepo?"text-accent-fg":"text-attention-fg":"text-text-tertiary"),o=ye(()=>e.entry.isHidden?"text-text-tertiary opacity-60":"text-text-primary");var a=X_();a.__click=n,a.__keydown=s;var c=E(a),g=E(c),h=E(g),v=P(c,2),m=E(v),w=E(m),b=E(w),f=P(w,2);{var u=S=>{var T=W_();L(S,T)};Y(f,S=>{e.entry.isGitRepo&&e.entry.isDirectory&&S(u)})}var l=P(f,2);{var p=S=>{var T=q_();L(S,T)};Y(l,S=>{e.entry.isHidden&&S(p)})}var y=P(l,2);{var k=S=>{var T=G_();L(S,T)};Y(y,S=>{e.entry.isSymlink&&S(k)})}var C=P(v,2);{var A=S=>{var T=K_();L(S,T)};Y(C,S=>{e.entry.isDirectory&&S(A)})}de(()=>{Ge(a,"aria-selected",e.selected),Ve(a,1,`directory-entry px-6 py-3 min-h-[60px]
87
+ flex items-center gap-3
88
+ border-b border-border-default
89
+ hover:bg-bg-hover
90
+ cursor-pointer
91
+ transition-colors
92
+ ${e.selected?"bg-accent-subtle border-l-4 border-l-accent-fg":"border-l-4 border-l-transparent"}`,"svelte-kv9zjf"),Ve(g,0,ns(i(_)),"svelte-kv9zjf"),Ge(h,"d",i(d)),Ve(w,1,`text-base truncate ${i(o)??""}`,"svelte-kv9zjf"),se(b,e.entry.name)}),L(t,a),Xt()}tr(["click","keydown"]);var Y_=U(`<span class="px-1.5 py-0.5 text-xs font-medium
93
+ bg-accent-subtle text-accent-fg rounded
94
+ flex-shrink-0" title="Git repository">Git</span>`),Q_=U(`<button type="button" class="w-full px-4 py-3 text-left
95
+ flex items-start gap-3
96
+ hover:bg-bg-hover
97
+ border-b border-border-default last:border-b-0
98
+ focus:outline-none focus:bg-bg-hover
99
+ transition-colors svelte-1laeufy" role="menuitem"><div class="flex-shrink-0 pt-0.5"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path></svg></div> <div class="flex-1 min-w-0"><div class="flex items-center gap-2 mb-1"><span class="text-sm font-medium text-text-primary truncate"> </span> <!></div> <div class="flex items-center gap-2"><code class="text-xs text-text-tertiary font-mono truncate"> </code> <span class="text-xs text-text-tertiary flex-shrink-0"> </span></div></div></button>`),Z_=U(`<div class="absolute top-full left-0 mt-2 w-80
100
+ bg-bg-primary border border-border-default rounded-lg
101
+ shadow-xl z-10
102
+ max-h-96 overflow-y-auto svelte-1laeufy" role="menu"></div>`),$_=U(`<div class="recent-dropdown relative svelte-1laeufy"><button type="button" class="px-4 py-2 min-h-[48px]
103
+ flex items-center gap-2
104
+ text-text-primary bg-bg-tertiary
105
+ border border-border-default rounded-lg
106
+ hover:bg-bg-hover
107
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis
108
+ transition-colors svelte-1laeufy" aria-haspopup="true" title="Recent directories"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg> <span class="text-sm font-medium"> </span> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="6 9 12 15 18 9"></polyline></svg></button> <!></div>`),ev=U(`<div class="quick-access-bar px-6 py-3 border-b border-border-default
109
+ bg-bg-secondary flex items-center gap-3"><button type="button" class="px-4 py-2 min-h-[48px]
110
+ flex items-center gap-2
111
+ text-text-primary bg-bg-tertiary
112
+ border border-border-default rounded-lg
113
+ hover:bg-bg-hover
114
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis
115
+ transition-colors" title="Go to home directory"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg> <span class="text-sm font-medium">Home</span></button> <!></div>`);function tv(t,e){Kt(e,!0);let r=q(!1);function n(){x(r,!i(r))}function s(h){e.onRecentClick(h),x(r,!1)}function d(h){h.target.closest(".recent-dropdown")||x(r,!1)}function _(h){const m=Date.now()-h,w=Math.floor(m/1e3),b=Math.floor(w/60),f=Math.floor(b/60),u=Math.floor(f/24);return u>0?`${u}d ago`:f>0?`${f}h ago`:b>0?`${b}m ago`:"Just now"}var o=ev();Sr("click",hn,d);var a=E(o);a.__click=function(...h){var v;(v=e.onHomeClick)==null||v.apply(this,h)};var c=P(a,2);{var g=h=>{var v=$_(),m=E(v);m.__click=n;var w=P(E(m),2),b=E(w),f=P(w,2),u=P(m,2);{var l=p=>{var y=Z_();Gt(y,21,()=>e.recentDirectories,k=>k.path,(k,C)=>{var A=Q_();A.__click=()=>s(i(C).path);var S=E(A),T=E(S),D=P(S,2),H=E(D),W=E(H),M=E(W),G=P(W,2);{var X=N=>{var V=Y_();L(N,V)};Y(G,N=>{i(C).isGitRepo&&N(X)})}var le=P(H,2),me=E(le),xe=E(me),R=P(me,2),j=E(R);de(N=>{Ve(T,0,ns(i(C).isGitRepo?"text-accent-fg":"text-attention-fg")),se(M,i(C).name),Ge(me,"title",i(C).path),se(xe,i(C).path),se(j,N)},[()=>_(i(C).lastOpened)]),L(k,A)}),L(p,y)};Y(u,p=>{i(r)&&p(l)})}de(()=>{Ge(m,"aria-expanded",i(r)),se(b,`Recent (${e.recentDirectories.length??""})`),Ve(f,0,`transition-transform ${i(r)?"rotate-180":""}`)}),L(h,v)};Y(c,h=>{e.recentDirectories.length>0&&h(g)})}L(t,o),Xt()}tr(["click"]);var rv=U('<div class="flex items-center justify-center h-full text-text-tertiary"><div class="flex flex-col items-center gap-3"><svg class="animate-spin h-8 w-8" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" aria-hidden="true"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> <span class="text-sm">Loading...</span></div></div>'),iv=U('<div class="flex items-center justify-center h-full text-danger-fg px-6"><div class="text-center"><svg class="h-12 w-12 mx-auto mb-3" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg> <p class="text-sm"> </p></div></div>'),nv=U('<div class="flex items-center justify-center h-full text-text-tertiary"><div class="text-center"><svg class="h-12 w-12 mx-auto mb-3" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path></svg> <p class="text-sm">No entries in this directory</p></div></div>'),sv=U('<div role="listbox" aria-label="Directory entries"></div>'),ov=U(`<div class="directory-picker-overlay fixed inset-0 z-50 bg-black/50
116
+ flex items-center justify-center p-2 sm:p-4
117
+ backdrop-blur-sm svelte-5esbg5" role="dialog" aria-modal="true" aria-labelledby="picker-title"><div class="directory-picker-modal w-full max-w-3xl
118
+ h-[calc(100dvh-1rem)] max-h-[calc(100dvh-1rem)]
119
+ sm:h-[90vh] sm:max-h-[90vh]
120
+ bg-bg-primary rounded-lg shadow-2xl
121
+ flex flex-col
122
+ border border-border-default svelte-5esbg5"><div class="picker-header px-6 py-4 border-b border-border-default
123
+ flex items-center justify-between bg-bg-secondary"><h2 id="picker-title" class="text-xl font-semibold text-text-primary">Select Directory</h2> <button type="button" class="p-2 min-w-[44px] min-h-[44px]
124
+ text-text-secondary hover:text-text-primary
125
+ hover:bg-bg-hover rounded-lg
126
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis" aria-label="Close directory picker" title="Close (Esc)"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></button></div> <!> <div class="current-path px-6 py-3 border-b border-border-default
127
+ bg-bg-secondary flex items-center gap-2"><button type="button" class="p-2 min-w-[44px] min-h-[44px]
128
+ text-text-secondary hover:text-text-primary
129
+ hover:bg-bg-hover rounded
130
+ disabled:opacity-30 disabled:cursor-not-allowed
131
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis" aria-label="Go to parent directory" title="Up"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="18 15 12 9 6 15"></polyline></svg></button> <div class="flex-1 min-w-0"><code class="text-sm text-text-primary font-mono truncate block"> </code></div></div> <div class="directory-list flex-1 overflow-y-auto svelte-5esbg5"><!></div> <div class="picker-footer px-6 py-4 border-t border-border-default
132
+ pb-[calc(1rem+env(safe-area-inset-bottom,0px))]
133
+ pr-[calc(1.5rem+env(safe-area-inset-right,0px))]
134
+ pl-[calc(1.5rem+env(safe-area-inset-left,0px))]
135
+ bg-bg-secondary flex items-center justify-end gap-3"><button type="button" class="px-6 py-3 min-h-[52px] min-w-[100px]
136
+ text-text-primary bg-bg-tertiary
137
+ border border-border-default rounded-lg
138
+ hover:bg-bg-hover
139
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis
140
+ font-medium transition-colors">Cancel</button> <button type="button" class="px-6 py-3 min-h-[52px] min-w-[100px]
141
+ text-white bg-success-emphasis
142
+ rounded-lg
143
+ hover:brightness-110
144
+ disabled:opacity-50 disabled:cursor-not-allowed
145
+ focus:outline-none focus:ring-2 focus:ring-success-emphasis
146
+ font-medium transition-colors">Select</button></div></div></div>`);function av(t,e){Kt(e,!0);let r=q(""),n=q(xt([])),s=q(!1),d=q(null),_=q(null),o=q(null),a=q(!1);async function c(A){x(s,!0),x(d,null);try{const S=encodeURIComponent(A),T=await fetch(`/api/browse?path=${S}`);if(!T.ok)throw new Error(`Failed to load directory: ${T.statusText}`);const D=await T.json();x(r,D.path,!0),x(n,D.entries,!0),x(o,D.parentPath,!0),x(a,D.canGoUp,!0),x(_,D.path,!0),x(s,!1)}catch(S){const T=S instanceof Error?S.message:"Failed to load directory";x(d,T,!0),x(s,!1)}}async function g(){try{const A=await fetch("/api/browse/home");if(!A.ok)throw new Error(`Failed to get home directory: ${A.statusText}`);const S=await A.json();await c(S.path)}catch(A){const S=A instanceof Error?A.message:"Failed to load home directory";x(d,S,!0)}}async function h(){i(o)!==null&&i(a)&&await c(i(o))}async function v(A){A.isDirectory?await c(A.path):x(_,i(r),!0)}function m(A){A.isDirectory&&x(_,A.path,!0)}function w(){i(_)!==null&&e.onSelect(i(_))}function b(){e.onClose()}async function f(){await g()}async function u(A){await c(A)}function l(A){A.key==="Escape"?(A.preventDefault(),b()):A.key==="Enter"&&i(_)!==null&&(A.preventDefault(),w())}gt(()=>{e.isOpen&&i(r)===""&&g()});function p(A){A.target===A.currentTarget&&b()}var y=_t(),k=Ye(y);{var C=A=>{var S=ov();S.__click=p,S.__keydown=l;var T=E(S);T.__click=ce=>ce.stopPropagation();var D=E(T),H=P(E(D),2);H.__click=b;var W=P(D,2);tv(W,{get recentDirectories(){return e.recentDirectories},onHomeClick:f,onRecentClick:u});var M=P(W,2),G=E(M);G.__click=h;var X=P(G,2),le=E(X),me=E(le),xe=P(M,2),R=E(xe);{var j=ce=>{var ue=rv();L(ce,ue)},N=ce=>{var ue=_t(),B=Ye(ue);{var I=O=>{var ne=iv(),ae=E(ne),te=P(E(ae),2),ge=E(te);de(()=>se(ge,i(d))),L(O,ne)},z=O=>{var ne=_t(),ae=Ye(ne);{var te=we=>{var Ie=nv();L(we,Ie)},ge=we=>{var Ie=sv();Gt(Ie,21,()=>i(n),Pe=>Pe.path,(Pe,Se)=>{{let Be=ye(()=>i(_)===i(Se).path);J_(Pe,{get entry(){return i(Se)},get selected(){return i(Be)},onClick:()=>v(i(Se)),onSelect:()=>m(i(Se))})}}),L(we,Ie)};Y(ae,we=>{i(n).length===0?we(te):we(ge,!1)},!0)}L(O,ne)};Y(B,O=>{i(d)!==null?O(I):O(z,!1)},!0)}L(ce,ue)};Y(R,ce=>{i(s)?ce(j):ce(N,!1)})}var V=P(xe,2),$=E(V);$.__click=b;var ee=P($,2);ee.__click=w,de(()=>{G.disabled=!i(a),Ge(le,"title",i(r)),se(me,i(r)||"/"),ee.disabled=i(_)===null}),L(A,S)};Y(k,A=>{e.isOpen&&A(C)})}L(t,y),Xt()}tr(["click","keydown"]);var lv=U(`<button type="button" class="comment-trigger absolute left-0 top-1 w-6 h-6 flex items-center justify-center
147
+ rounded bg-accent-emphasis text-white text-xs font-bold
148
+ opacity-0 group-hover/gutter:opacity-100
149
+ hover:bg-accent-emphasis transition-opacity z-10 cursor-pointer svelte-1miguua">+</button>`),cv=U('<span class="highlighted-line svelte-1miguua"><!></span>'),dv=U('<pre class="m-0 p-0 svelte-1miguua"> </pre>'),uv=U('<div role="button" tabindex="0"><div class="w-16 flex-shrink-0 px-2 flex items-start justify-end text-text-secondary border-r border-border-default relative group/gutter"><!> <span class="cursor-pointer"> </span></div> <div><span class="font-bold"> </span></div> <div class="flex-1 px-2 overflow-x-auto cursor-pointer"><!></div></div>');function Ma(t,e){Kt(e,!0);let r=Re(e,"highlighted",3,void 0),n=Re(e,"selected",3,!1),s=Re(e,"onSelect",3,void 0),d=Re(e,"onLongPress",3,void 0),_=Re(e,"onCommentClick",3,void 0),o=q(void 0);function a(W){switch(W){case"add":return"bg-diff-add-bg";case"delete":return"bg-diff-del-bg";case"context":return"bg-transparent";default:const M=W;throw new Error(`Unhandled change type: ${M}`)}}function c(W){switch(W){case"add":return"+";case"delete":return"-";case"context":return" ";default:const M=W;throw new Error(`Unhandled change type: ${M}`)}}function g(W){switch(W){case"add":return"text-success-fg";case"delete":return"text-danger-fg";case"context":return"text-text-secondary";default:const M=W;throw new Error(`Unhandled change type: ${M}`)}}function h(){s()!==void 0&&s()()}function v(){d()!==void 0&&x(o,setTimeout(()=>{d()!==void 0&&d()()},500),!0)}function m(){i(o)!==void 0&&(clearTimeout(i(o)),x(o,void 0))}function w(){i(o)!==void 0&&(clearTimeout(i(o)),x(o,void 0))}var b=uv();b.__pointerdown=v,b.__pointerup=m;var f=E(b),u=E(f);{var l=W=>{var M=lv();M.__click=G=>{var X;G.stopPropagation(),(X=_())==null||X(G.shiftKey)},de(()=>Ge(M,"aria-label",`Add comment on line ${e.lineNumber??""}`)),L(W,M)};Y(u,W=>{_()!==void 0&&W(l)})}var p=P(u,2);p.__click=h;var y=E(p),k=P(f,2),C=E(k),A=E(C),S=P(k,2);S.__click=h;var T=E(S);{var D=W=>{var M=cv(),G=E(M);Gi(G,r),L(W,M)},H=W=>{var M=dv(),G=E(M);de(()=>se(G,e.change.content)),L(W,M)};Y(T,W=>{r()!==void 0?W(D):W(H,!1)})}de((W,M,G)=>{Ve(b,1,`diff-line-row flex font-mono text-xs leading-5 select-none overflow-hidden ${W??""} ${n()?"ring-2 ring-accent-emphasis ring-inset":""}`,"svelte-1miguua"),Ge(b,"aria-label",`Diff line ${e.lineNumber??""}: ${e.change.content??""}`),Ge(b,"aria-selected",n()),se(y,e.lineNumber),Ve(k,1,`w-8 flex-shrink-0 flex items-start justify-center ${M??""} border-r border-border-default`,"svelte-1miguua"),se(A,G)},[()=>a(e.change.type),()=>g(e.change.type),()=>c(e.change.type)]),Sr("pointerleave",b,w),L(t,b),Xt()}tr(["pointerdown","pointerup","click"]);var hv=U(`<div class="absolute bottom-full right-0 mb-1 w-48
150
+ bg-bg-primary border border-border-default rounded-lg shadow-lg z-50 p-1"><button type="button" class="w-full px-3 py-2 text-left text-sm text-text-primary
151
+ hover:bg-bg-hover rounded-md
152
+ transition-colors duration-150
153
+ focus:outline-none focus:ring-2 focus:ring-inset focus:ring-accent-emphasis"> </button></div>`),fv=U(`<div class="split-button-container relative flex"><button type="button" class="h-8 px-2 text-xs rounded-l bg-accent-muted text-accent-fg
154
+ border border-accent-emphasis/40 hover:bg-accent-muted/80
155
+ disabled:opacity-60 disabled:cursor-not-allowed font-medium
156
+ transition-colors duration-150
157
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis"> </button> <button type="button" class="h-8 px-1.5 text-xs rounded-r bg-accent-muted text-accent-fg
158
+ border border-l-0 border-accent-emphasis/40 hover:bg-accent-muted/80
159
+ disabled:opacity-60 disabled:cursor-not-allowed
160
+ transition-colors duration-150
161
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis" aria-label="More submit options" aria-haspopup="true"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="6 9 12 15 18 9"></polyline></svg></button> <!></div>`);function bl(t,e){Kt(e,!0);const r=Re(e,"disabled",3,!1),n=Re(e,"primaryLabel",3,"Submit"),s=Re(e,"secondaryLabel",3,"Submit & Run Now");let d=q(!1);function _(){x(d,!i(d))}function o(b){i(d)&&(b.target.closest(".split-button-container")||x(d,!1))}function a(b){b.key==="Escape"&&i(d)&&(b.preventDefault(),x(d,!1))}var c=fv();Sr("click",hn,o),Sr("keydown",hn,a);var g=E(c);g.__click=function(...b){var f;(f=e.onPrimaryClick)==null||f.apply(this,b)};var h=E(g),v=P(g,2);v.__click=_;var m=P(v,2);{var w=b=>{var f=hv(),u=E(f);u.__click=()=>{e.onSecondaryClick(),x(d,!1)};var l=E(u);de(()=>se(l,s())),L(b,f)};Y(m,b=>{i(d)&&b(w)})}de(()=>{g.disabled=r(),se(h,n()),v.disabled=r(),Ge(v,"aria-expanded",i(d))}),L(t,c),Xt()}tr(["click"]);var pv=U('<div class="flex items-center justify-center h-full text-text-secondary p-8"><p class="text-sm">No old content (new file)</p></div>'),_v=U("<div><!></div>"),vv=U('<div class="flex items-center justify-center h-full text-text-secondary p-8"><p class="text-sm">No new content (deleted file)</p></div>'),gv=U('<div class="mt-2 flex items-center justify-between gap-3 rounded border border-accent-emphasis/40 bg-accent-muted/10 px-2 py-1 text-xs text-text-secondary"><span class="truncate">AI session submitted.</span> <div class="flex items-center gap-2"><a class="text-accent-fg underline underline-offset-2 hover:opacity-80">View session history</a> <button type="button" class="text-text-secondary hover:text-text-primary">Close</button></div></div>'),mv=U(`<div class="max-w-4xl border-t-2 border-b-2 border-accent-emphasis bg-bg-secondary p-3"><textarea class="w-full min-h-28 resize-y rounded border border-border-default bg-bg-primary
162
+ px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-emphasis" placeholder="Ask AI about this code..."></textarea> <div class="flex items-center justify-between mt-2"><div class="text-xs text-text-tertiary font-mono"> </div> <div class="flex items-center gap-2"><button type="button" class="px-3 py-1 text-sm text-text-secondary hover:text-text-primary">Cancel</button> <!></div></div> <!></div>`),bv=U("<div><!></div> <!>",1),yv=U('<div class="flex w-full h-full"><div class="w-1/2 overflow-y-auto overflow-x-hidden border-r border-border-default svelte-ngva0x" style="scroll-behavior: smooth;"><div class="min-h-full svelte-ngva0x"><!></div></div> <div class="w-1/2 overflow-y-auto overflow-x-hidden svelte-ngva0x" style="scroll-behavior: smooth;"><div class="min-h-full svelte-ngva0x"><!></div></div></div>');function xv(t,e){Kt(e,!0);let r=Re(e,"onLineSelect",3,void 0),n=Re(e,"onCommentOpen",3,void 0),s=Re(e,"onCommentSubmit",3,void 0),d=Re(e,"onCommentCancel",3,void 0),_=Re(e,"commentLine",3,void 0);Re(e,"placeholder",3,"Ask AI about this line...");let o=Re(e,"rangeLines",19,()=>[]),a=Re(e,"oldHighlightMap",3,void 0),c=Re(e,"newHighlightMap",3,void 0),g=Re(e,"filePath",3,void 0),h=Re(e,"submittedSessionId",3,null),v=Re(e,"submittedSessionHistoryHref",3,null),m=Re(e,"onDismissSubmittedSession",3,void 0),w=q("");const b=ye(()=>{if(_()===void 0||g()===void 0)return"";const N=_().startLine===_().endLine?`L${_().startLine}`:`L${_().startLine}-L${_().endLine}`;return`${g()}:${N}`});let f=q(0),u=q(0),l=q(!1);function p(N){if(i(l))return;const V=N.target;V!==null&&(x(l,!0),x(f,V.scrollTop,!0),x(u,V.scrollTop,!0),requestAnimationFrame(()=>{x(l,!1)}))}function y(N){if(i(l))return;const V=N.target;V!==null&&(x(l,!0),x(u,V.scrollTop,!0),x(f,V.scrollTop,!0),requestAnimationFrame(()=>{x(l,!1)}))}const k=ye(()=>{const N=[];for(const V of e.chunks)for(const $ of V.changes)if($.type==="delete"||$.type==="context"){const ee=$.oldLine??0;N.push({change:$,lineNumber:ee})}return N}),C=ye(()=>{const N=[];for(const V of e.chunks)for(const $ of V.changes)if($.type==="add"||$.type==="context"){const ee=$.newLine??0;N.push({change:$,lineNumber:ee})}return N});function A(N){r()!==void 0&&r()("new",N)}function S(N,V){n()!==void 0&&n()("new",N,V)}function T(N,V){return _()===void 0||_().side!==N?!1:o().includes(V)}var D=yv(),H=E(D),W=E(H),M=E(W);{var G=N=>{var V=pv();L(N,V)},X=N=>{var V=_t(),$=Ye(V);Gt($,17,()=>i(k),ui,(ee,ce)=>{let ue=()=>i(ce).change,B=()=>i(ce).lineNumber;var I=_v(),z=E(I);{let O=ye(()=>{var ne;return(ne=a())==null?void 0:ne.get(B())});Ma(z,{get change(){return ue()},get lineNumber(){return B()},get highlighted(){return i(O)}})}de(O=>Ve(I,1,O),[()=>ns(T("old",B())?"bg-accent-muted":"")]),L(ee,I)}),L(N,V)};Y(M,N=>{i(k).length===0?N(G):N(X,!1)})}var le=P(H,2),me=E(le),xe=E(me);{var R=N=>{var V=vv();L(N,V)},j=N=>{var V=_t(),$=Ye(V);Gt($,17,()=>i(C),ui,(ee,ce)=>{let ue=()=>i(ce).change,B=()=>i(ce).lineNumber;var I=bv(),z=Ye(I),O=E(z);{let te=ye(()=>{var ge;return(ge=c())==null?void 0:ge.get(B())});Ma(O,{get change(){return ue()},get lineNumber(){return B()},get highlighted(){return i(te)},onSelect:()=>A(B()),onCommentClick:ge=>S(B(),ge)})}var ne=P(z,2);{var ae=te=>{var ge=mv(),we=E(ge);we.__keydown=_e=>{_e.key==="Enter"&&_e.ctrlKey&&s()!==void 0&&(_e.preventDefault(),s()(i(w),!0),x(w,"")),_e.key==="Escape"&&d()!==void 0&&(d()(),x(w,""))};var Ie=P(we,2),Pe=E(Ie),Se=E(Pe),Be=P(Pe,2),Ue=E(Be);Ue.__click=()=>{d()!==void 0&&(d()(),x(w,""))};var je=P(Ue,2);{let _e=ye(()=>i(w).trim().length===0);bl(je,{get disabled(){return i(_e)},onPrimaryClick:()=>{s()!==void 0&&(s()(i(w),!1),x(w,""))},onSecondaryClick:()=>{s()!==void 0&&(s()(i(w),!0),x(w,""))}})}var ze=P(Ie,2);{var Ne=_e=>{var Me=gv(),oe=P(E(Me),2),pe=E(oe),Ce=P(pe,2);Ce.__click=()=>{var He,$e;(He=m())==null||He(),($e=d())==null||$e()},de(()=>Ge(pe,"href",v())),L(_e,Me)};Y(ze,_e=>{h()!==null&&v()!==null&&_e(Ne)})}de(()=>se(Se,i(b))),_r(we,()=>i(w),_e=>x(w,_e)),L(te,ge)};Y(ne,te=>{_()!==void 0&&_().side==="new"&&_().endLine===B()&&te(ae)})}de(te=>Ve(z,1,te),[()=>ns(T("new",B())?"bg-accent-muted":"")]),L(ee,I)}),L(N,V)};Y(xe,N=>{i(C).length===0?N(R):N(j,!1)})}Sr("scroll",H,p),Sr("scroll",le,y),L(t,D),Xt()}tr(["keydown","click"]);var wv=U('<div class="flex items-center justify-center py-12 text-text-secondary text-sm">No changes to display</div>'),Sv=U(`<button type="button" class="absolute left-0 top-1 w-6 h-6 flex items-center justify-center
163
+ rounded bg-accent-emphasis text-white text-xs font-bold
164
+ opacity-0 group-hover/inlinerow:opacity-100
165
+ hover:bg-accent-fg transition-opacity z-10 cursor-pointer" aria-label="Add comment">+</button>`),Cv=U('<span class="leading-5"> </span>'),kv=U('<span class="leading-5 opacity-30">-</span>'),Ev=U('<span class="leading-5"> </span>'),Av=U('<span class="leading-5 opacity-30">-</span>'),Tv=U('<div class="mt-2 flex items-center justify-between gap-3 rounded border border-accent-emphasis/40 bg-accent-muted/10 px-2 py-1 text-xs text-text-secondary"><span class="truncate">AI session submitted.</span> <div class="flex items-center gap-2"><a class="text-accent-fg underline underline-offset-2 hover:opacity-80">View session history</a> <button type="button" class="text-text-secondary hover:text-text-primary">Close</button></div></div>'),Pv=U(`<div class="max-w-4xl border-t-2 border-b-2 border-accent-emphasis bg-bg-secondary p-3"><textarea class="w-full min-h-28 resize-y rounded border border-border-default bg-bg-primary
166
+ px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-emphasis svelte-1757rrd" placeholder="Ask AI about this code..."></textarea> <div class="flex items-center justify-between mt-2"><div class="text-xs text-text-tertiary font-mono"> </div> <div class="flex items-center gap-2"><button type="button" class="px-3 py-1 text-sm text-text-secondary hover:text-text-primary">Cancel</button> <!></div></div> <!></div>`),Lv=U('<div><div class="w-16 flex-shrink-0 px-2 flex items-start justify-end text-text-secondary bg-bg-secondary border-r border-border-default relative"><!> <!></div> <div class="w-16 flex-shrink-0 px-2 flex items-start justify-end text-text-secondary bg-bg-secondary border-r border-border-default"><!></div> <div class="flex-1"><!></div></div> <!>',1),Rv=U('<div class="w-full font-mono text-xs leading-5 svelte-1757rrd"><!></div>');function du(t,e){Kt(e,!0);let r=Re(e,"onLineSelect",3,void 0),n=Re(e,"onCommentOpen",3,void 0),s=Re(e,"onCommentSubmit",3,void 0),d=Re(e,"onCommentCancel",3,void 0),_=Re(e,"commentLine",3,void 0);Re(e,"placeholder",3,"Ask AI about this line...");let o=Re(e,"rangeLines",19,()=>[]),a=Re(e,"oldHighlightMap",3,void 0),c=Re(e,"newHighlightMap",3,void 0),g=Re(e,"filePath",3,void 0),h=Re(e,"submittedSessionId",3,null),v=Re(e,"submittedSessionHistoryHref",3,null),m=Re(e,"onDismissSubmittedSession",3,void 0),w=q("");const b=ye(()=>{if(_()===void 0||g()===void 0)return"";const T=_().startLine===_().endLine?`L${_().startLine}`:`L${_().startLine}-L${_().endLine}`;return`${g()}:${T}`}),f=ye(()=>{const T=[];let D=0;for(const H of e.chunks)for(const W of H.changes)T.push({change:W,chunkHeader:H.header,index:D++});return T});function u(T,D){r()!==void 0&&(D!==void 0?r()(D,"new"):T!==void 0&&r()(T,"old"))}function l(T,D,H){n()!==void 0&&(D!==void 0?n()(D,"new",H):T!==void 0&&n()(T,"old",H))}function p(T,D){return _()===void 0?!1:_().type==="new"&&D===_().endLine||_().type==="old"&&T===_().endLine}function y(T,D){return _()===void 0?!1:_().type==="new"&&D!==void 0?o().includes(D):_().type==="old"&&T!==void 0?o().includes(T):!1}var k=Rv(),C=E(k);{var A=T=>{var D=wv();L(T,D)},S=T=>{var D=_t(),H=Ye(D);Gt(H,17,()=>i(f),({change:W,index:M})=>M,(W,M)=>{let G=()=>i(M).change,X=()=>i(M).index;var le=Lv(),me=Ye(le),xe=E(me),R=E(xe);{var j=ae=>{var te=Sv();te.__click=ge=>{ge.stopPropagation(),l(G().oldLine,G().newLine,ge.shiftKey)},L(ae,te)};Y(R,ae=>{n()!==void 0&&ae(j)})}var N=P(R,2);{var V=ae=>{var te=Cv(),ge=E(te);de(()=>se(ge,G().oldLine)),L(ae,te)},$=ae=>{var te=kv();L(ae,te)};Y(N,ae=>{G().oldLine!==void 0?ae(V):ae($,!1)})}var ee=P(xe,2),ce=E(ee);{var ue=ae=>{var te=Ev(),ge=E(te);de(()=>se(ge,G().newLine)),L(ae,te)},B=ae=>{var te=Av();L(ae,te)};Y(ce,ae=>{G().newLine!==void 0?ae(ue):ae(B,!1)})}var I=P(ee,2),z=E(I);{let ae=ye(()=>G().newLine??G().oldLine??X()+1),te=ye(()=>{var ge,we;return G().type==="delete"?(ge=a())==null?void 0:ge.get(G().oldLine??0):(we=c())==null?void 0:we.get(G().newLine??0)});Ma(z,{get change(){return G()},get lineNumber(){return i(ae)},get highlighted(){return i(te)},onSelect:()=>u(G().oldLine,G().newLine)})}var O=P(me,2);{var ne=ae=>{var te=Pv(),ge=E(te);ge.__keydown=Ne=>{Ne.key==="Enter"&&Ne.ctrlKey&&s()!==void 0&&(Ne.preventDefault(),s()(i(w),!0),x(w,"")),Ne.key==="Escape"&&d()!==void 0&&(d()(),x(w,""))};var we=P(ge,2),Ie=E(we),Pe=E(Ie),Se=P(Ie,2),Be=E(Se);Be.__click=()=>{d()!==void 0&&(d()(),x(w,""))};var Ue=P(Be,2);{let Ne=ye(()=>i(w).trim().length===0);bl(Ue,{get disabled(){return i(Ne)},onPrimaryClick:()=>{s()!==void 0&&(s()(i(w),!1),x(w,""))},onSecondaryClick:()=>{s()!==void 0&&(s()(i(w),!0),x(w,""))}})}var je=P(we,2);{var ze=Ne=>{var _e=Tv(),Me=P(E(_e),2),oe=E(Me),pe=P(oe,2);pe.__click=()=>{var Ce,He;(Ce=m())==null||Ce(),(He=d())==null||He()},de(()=>Ge(oe,"href",v())),L(Ne,_e)};Y(je,Ne=>{h()!==null&&v()!==null&&Ne(ze)})}de(()=>se(Pe,i(b))),_r(ge,()=>i(w),Ne=>x(w,Ne)),L(ae,te)};Y(O,ae=>{p(G().oldLine,G().newLine)&&ae(ne)})}de(ae=>Ve(me,1,`flex diff-line-row group/inlinerow ${ae??""}`),[()=>y(G().oldLine,G().newLine)?"bg-accent-muted":""]),L(W,le)}),L(T,D)};Y(C,T=>{i(f).length===0?T(A):T(S,!1)})}L(t,k),Xt()}tr(["click","keydown"]);const Iv="modulepreload",Dv=function(t){return"/"+t},hc={},K=function(e,r,n){let s=Promise.resolve();if(r&&r.length>0){let _=function(c){return Promise.all(c.map(g=>Promise.resolve(g).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=_(r.map(c=>{if(c=Dv(c),c in hc)return;hc[c]=!0;const g=c.endsWith(".css"),h=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const v=document.createElement("link");if(v.rel=g?"stylesheet":Iv,g||(v.as="script"),v.crossOrigin="",v.href=c,a&&v.setAttribute("nonce",a),document.head.appendChild(v),g)return new Promise((m,w)=>{v.addEventListener("load",m),v.addEventListener("error",()=>w(Error(`Unable to preload CSS for ${c}`)))})}))}function d(_){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=_,window.dispatchEvent(o),!o.defaultPrevented)throw _}return s.then(_=>{for(const o of _||[])o.status==="rejected"&&d(o.reason);return e().catch(d)})};let Ar=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Mv(t){return yl(t)}function yl(t){return Array.isArray(t)?Ov(t):t instanceof RegExp?t:typeof t=="object"?Bv(t):t}function Ov(t){let e=[];for(let r=0,n=t.length;r<n;r++)e[r]=yl(t[r]);return e}function Bv(t){let e={};for(let r in t)e[r]=yl(t[r]);return e}function uu(t,...e){return e.forEach(r=>{for(let n in r)t[n]=r[n]}),t}function hu(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?hu(t.substring(0,t.length-1)):t.substr(~e+1)}var sa=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Qs=class{static hasCaptures(t){return t===null?!1:(sa.lastIndex=0,sa.test(t))}static replaceCaptures(t,e,r){return t.replace(sa,(n,s,d,_)=>{let o=r[parseInt(s||d,10)];if(o){let a=e.substring(o.start,o.end);for(;a[0]===".";)a=a.substring(1);switch(_){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return n})}};function fu(t,e){return t<e?-1:t>e?1:0}function pu(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let r=t.length,n=e.length;if(r===n){for(let s=0;s<r;s++){let d=fu(t[s],e[s]);if(d!==0)return d}return 0}return r-n}function fc(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function _u(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var vu=class{constructor(t){Ee(this,"cache",new Map);this.fn=t}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},xo=class{constructor(t,e,r){Ee(this,"_cachedMatchRoot",new vu(t=>this._root.match(t)));this._colorMap=t,this._defaults=e,this._root=r}static createFromRawTheme(t,e){return this.createFromParsedTheme(Hv(t),e)}static createFromParsedTheme(t,e){return Uv(t,e)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,n=this._cachedMatchRoot.get(e).find(s=>Nv(t.parent,s.parentScopes));return n?new gu(n.fontStyle,n.foreground,n.background):null}},oa=class uo{constructor(e,r){this.parent=e,this.scopeName=r}static push(e,r){for(const n of r)e=new uo(e,n);return e}static from(...e){let r=null;for(let n=0;n<e.length;n++)r=new uo(r,e[n]);return r}push(e){return new uo(this,e)}getSegments(){let e=this;const r=[];for(;e;)r.push(e.scopeName),e=e.parent;return r.reverse(),r}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const r=[];let n=this;for(;n&&n!==e;)r.push(n.scopeName),n=n.parent;return n===e?r.reverse():void 0}};function Nv(t,e){if(e.length===0)return!0;for(let r=0;r<e.length;r++){let n=e[r],s=!1;if(n===">"){if(r===e.length-1)return!1;n=e[++r],s=!0}for(;t&&!jv(t.scopeName,n);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function jv(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var gu=class{constructor(t,e,r){this.fontStyle=t,this.foregroundId=e,this.backgroundId=r}};function Hv(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,r=[],n=0;for(let s=0,d=e.length;s<d;s++){let _=e[s];if(!_.settings)continue;let o;if(typeof _.scope=="string"){let h=_.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),o=h.split(",")}else Array.isArray(_.scope)?o=_.scope:o=[""];let a=-1;if(typeof _.settings.fontStyle=="string"){a=0;let h=_.settings.fontStyle.split(" ");for(let v=0,m=h.length;v<m;v++)switch(h[v]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let c=null;typeof _.settings.foreground=="string"&&fc(_.settings.foreground)&&(c=_.settings.foreground);let g=null;typeof _.settings.background=="string"&&fc(_.settings.background)&&(g=_.settings.background);for(let h=0,v=o.length;h<v;h++){let w=o[h].trim().split(" "),b=w[w.length-1],f=null;w.length>1&&(f=w.slice(0,w.length-1),f.reverse()),r[n++]=new Fv(b,f,s,a,c,g)}}return r}var Fv=class{constructor(t,e,r,n,s,d){this.scope=t,this.parentScopes=e,this.index=r,this.fontStyle=n,this.foreground=s,this.background=d}},Yr=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(Yr||{});function Uv(t,e){t.sort((a,c)=>{let g=fu(a.scope,c.scope);return g!==0||(g=pu(a.parentScopes,c.parentScopes),g!==0)?g:a.index-c.index});let r=0,n="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let a=t.shift();a.fontStyle!==-1&&(r=a.fontStyle),a.foreground!==null&&(n=a.foreground),a.background!==null&&(s=a.background)}let d=new Vv(e),_=new gu(r,d.getId(n),d.getId(s)),o=new Wv(new Oa(0,null,-1,0,0),[]);for(let a=0,c=t.length;a<c;a++){let g=t[a];o.insert(0,g.scope,g.parentScopes,g.fontStyle,d.getId(g.foreground),d.getId(g.background))}return new xo(d,_,o)}var Vv=class{constructor(t){Ee(this,"_isFrozen");Ee(this,"_lastColorId");Ee(this,"_id2color");Ee(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,r=t.length;e<r;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},zv=Object.freeze([]),Oa=class mu{constructor(e,r,n,s,d){Ee(this,"scopeDepth");Ee(this,"parentScopes");Ee(this,"fontStyle");Ee(this,"foreground");Ee(this,"background");this.scopeDepth=e,this.parentScopes=r||zv,this.fontStyle=n,this.foreground=s,this.background=d}clone(){return new mu(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let r=[];for(let n=0,s=e.length;n<s;n++)r[n]=e[n].clone();return r}acceptOverwrite(e,r,n,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,r!==-1&&(this.fontStyle=r),n!==0&&(this.foreground=n),s!==0&&(this.background=s)}},Wv=class Ba{constructor(e,r=[],n={}){Ee(this,"_rulesWithParentScopes");this._mainRule=e,this._children=n,this._rulesWithParentScopes=r}static _cmpBySpecificity(e,r){if(e.scopeDepth!==r.scopeDepth)return r.scopeDepth-e.scopeDepth;let n=0,s=0;for(;e.parentScopes[n]===">"&&n++,r.parentScopes[s]===">"&&s++,!(n>=e.parentScopes.length||s>=r.parentScopes.length);){const d=r.parentScopes[s].length-e.parentScopes[n].length;if(d!==0)return d;n++,s++}return r.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let n=e.indexOf("."),s,d;if(n===-1?(s=e,d=""):(s=e.substring(0,n),d=e.substring(n+1)),this._children.hasOwnProperty(s))return this._children[s].match(d)}const r=this._rulesWithParentScopes.concat(this._mainRule);return r.sort(Ba._cmpBySpecificity),r}insert(e,r,n,s,d,_){if(r===""){this._doInsertHere(e,n,s,d,_);return}let o=r.indexOf("."),a,c;o===-1?(a=r,c=""):(a=r.substring(0,o),c=r.substring(o+1));let g;this._children.hasOwnProperty(a)?g=this._children[a]:(g=new Ba(this._mainRule.clone(),Oa.cloneArr(this._rulesWithParentScopes)),this._children[a]=g),g.insert(e+1,c,n,s,d,_)}_doInsertHere(e,r,n,s,d){if(r===null){this._mainRule.acceptOverwrite(e,n,s,d);return}for(let _=0,o=this._rulesWithParentScopes.length;_<o;_++){let a=this._rulesWithParentScopes[_];if(pu(a.parentScopes,r)===0){a.acceptOverwrite(e,n,s,d);return}}n===-1&&(n=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),d===0&&(d=this._mainRule.background),this._rulesWithParentScopes.push(new Oa(e,r,n,s,d))}},ss=class _i{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const r=_i.getLanguageId(e),n=_i.getTokenType(e),s=_i.getFontStyle(e),d=_i.getForeground(e),_=_i.getBackground(e);console.log({languageId:r,tokenType:n,fontStyle:s,foreground:d,background:_})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,r,n,s,d,_,o){let a=_i.getLanguageId(e),c=_i.getTokenType(e),g=_i.containsBalancedBrackets(e)?1:0,h=_i.getFontStyle(e),v=_i.getForeground(e),m=_i.getBackground(e);return r!==0&&(a=r),n!==8&&(c=n),s!==null&&(g=s?1:0),d!==-1&&(h=d),_!==0&&(v=_),o!==0&&(m=o),(a<<0|c<<8|g<<10|h<<11|v<<15|m<<24)>>>0}};function wo(t,e){const r=[],n=qv(t);let s=n.next();for(;s!==null;){let a=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=n.next()}let c=_();if(r.push({matcher:c,priority:a}),s!==",")break;s=n.next()}return r;function d(){if(s==="-"){s=n.next();const a=d();return c=>!!a&&!a(c)}if(s==="("){s=n.next();const a=o();return s===")"&&(s=n.next()),a}if(pc(s)){const a=[];do a.push(s),s=n.next();while(pc(s));return c=>e(a,c)}return null}function _(){const a=[];let c=d();for(;c;)a.push(c),c=d();return g=>a.every(h=>h(g))}function o(){const a=[];let c=_();for(;c&&(a.push(c),s==="|"||s===",");){do s=n.next();while(s==="|"||s===",");c=_()}return g=>a.some(h=>h(g))}}function pc(t){return!!t&&!!t.match(/[\w\.:]+/)}function qv(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,r=e.exec(t);return{next:()=>{if(!r)return null;const n=r[0];return r=e.exec(t),n}}}function bu(t){typeof t.dispose=="function"&&t.dispose()}var Ds=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},Gv=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},Kv=class{constructor(){Ee(this,"_references",[]);Ee(this,"_seenReferenceKeys",new Set);Ee(this,"visitedRule",new Set)}get references(){return this._references}add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},Xv=class{constructor(t,e){Ee(this,"seenFullScopeRequests",new Set);Ee(this,"seenPartialScopeRequests",new Set);Ee(this,"Q");this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ds(this.initialScopeName)]}processQueue(){const t=this.Q;this.Q=[];const e=new Kv;for(const r of t)Jv(r,this.initialScopeName,this.repo,e);for(const r of e.references)if(r instanceof Ds){if(this.seenFullScopeRequests.has(r.scopeName))continue;this.seenFullScopeRequests.add(r.scopeName),this.Q.push(r)}else{if(this.seenFullScopeRequests.has(r.scopeName)||this.seenPartialScopeRequests.has(r.toKey()))continue;this.seenPartialScopeRequests.add(r.toKey()),this.Q.push(r)}}};function Jv(t,e,r,n){const s=r.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const d=r.lookup(e);t instanceof Ds?ho({baseGrammar:d,selfGrammar:s},n):Na(t.ruleName,{baseGrammar:d,selfGrammar:s,repository:s.repository},n);const _=r.injections(t.scopeName);if(_)for(const o of _)n.add(new Ds(o))}function Na(t,e,r){if(e.repository&&e.repository[t]){const n=e.repository[t];So([n],e,r)}}function ho(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&So(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&So(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function So(t,e,r){for(const n of t){if(r.visitedRule.has(n))continue;r.visitedRule.add(n);const s=n.repository?uu({},e.repository,n.repository):e.repository;Array.isArray(n.patterns)&&So(n.patterns,{...e,repository:s},r);const d=n.include;if(!d)continue;const _=yu(d);switch(_.kind){case 0:ho({...e,selfGrammar:e.baseGrammar},r);break;case 1:ho(e,r);break;case 2:Na(_.ruleName,{...e,repository:s},r);break;case 3:case 4:const o=_.scopeName===e.selfGrammar.scopeName?e.selfGrammar:_.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(o){const a={baseGrammar:e.baseGrammar,selfGrammar:o,repository:s};_.kind===4?Na(_.ruleName,a,r):ho(a,r)}else _.kind===4?r.add(new Gv(_.scopeName,_.ruleName)):r.add(new Ds(_.scopeName));break}}}var Yv=class{constructor(){Ee(this,"kind",0)}},Qv=class{constructor(){Ee(this,"kind",1)}},Zv=class{constructor(t){Ee(this,"kind",2);this.ruleName=t}},$v=class{constructor(t){Ee(this,"kind",3);this.scopeName=t}},eg=class{constructor(t,e){Ee(this,"kind",4);this.scopeName=t,this.ruleName=e}};function yu(t){if(t==="$base")return new Yv;if(t==="$self")return new Qv;const e=t.indexOf("#");if(e===-1)return new $v(t);if(e===0)return new Zv(t.substring(1));{const r=t.substring(0,e),n=t.substring(e+1);return new eg(r,n)}}var tg=/\\(\d+)/,_c=/\\(\d+)/g,rg=-1,xu=-2;var qs=class{constructor(t,e,r,n){Ee(this,"$location");Ee(this,"id");Ee(this,"_nameIsCapturing");Ee(this,"_name");Ee(this,"_contentNameIsCapturing");Ee(this,"_contentName");this.$location=t,this.id=e,this._name=r||null,this._nameIsCapturing=Qs.hasCaptures(this._name),this._contentName=n||null,this._contentNameIsCapturing=Qs.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${hu(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:Qs.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Qs.replaceCaptures(this._contentName,t,e)}},ig=class extends qs{constructor(e,r,n,s,d){super(e,r,n,s);Ee(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=d}dispose(){}collectPatterns(e,r){throw new Error("Not supported!")}compile(e,r){throw new Error("Not supported!")}compileAG(e,r,n,s){throw new Error("Not supported!")}},ng=class extends qs{constructor(e,r,n,s,d){super(e,r,n,null);Ee(this,"_match");Ee(this,"captures");Ee(this,"_cachedCompiledPatterns");this._match=new Ms(s,this.id),this.captures=d,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,r){r.push(this._match)}compile(e,r){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,r,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Os,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},vc=class extends qs{constructor(e,r,n,s,d){super(e,r,n,s);Ee(this,"hasMissingPatterns");Ee(this,"patterns");Ee(this,"_cachedCompiledPatterns");this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,r){for(const n of this.patterns)e.getRule(n).collectPatterns(e,r)}compile(e,r){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,r,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Os,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ja=class extends qs{constructor(e,r,n,s,d,_,o,a,c,g){super(e,r,n,s);Ee(this,"_begin");Ee(this,"beginCaptures");Ee(this,"_end");Ee(this,"endHasBackReferences");Ee(this,"endCaptures");Ee(this,"applyEndPatternLast");Ee(this,"hasMissingPatterns");Ee(this,"patterns");Ee(this,"_cachedCompiledPatterns");this._begin=new Ms(d,this.id),this.beginCaptures=_,this._end=new Ms(o||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=c||!1,this.patterns=g.patterns,this.hasMissingPatterns=g.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,r){return this._end.resolveBackReferences(e,r)}collectPatterns(e,r){r.push(this._begin)}compile(e,r){return this._getCachedCompiledPatterns(e,r).compile(e)}compileAG(e,r,n,s){return this._getCachedCompiledPatterns(e,r).compileAG(e,n,s)}_getCachedCompiledPatterns(e,r){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Os;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,r):this._cachedCompiledPatterns.setSource(0,r)),this._cachedCompiledPatterns}},Co=class extends qs{constructor(e,r,n,s,d,_,o,a,c){super(e,r,n,s);Ee(this,"_begin");Ee(this,"beginCaptures");Ee(this,"whileCaptures");Ee(this,"_while");Ee(this,"whileHasBackReferences");Ee(this,"hasMissingPatterns");Ee(this,"patterns");Ee(this,"_cachedCompiledPatterns");Ee(this,"_cachedCompiledWhilePatterns");this._begin=new Ms(d,this.id),this.beginCaptures=_,this.whileCaptures=a,this._while=new Ms(o,xu),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,r){return this._while.resolveBackReferences(e,r)}collectPatterns(e,r){r.push(this._begin)}compile(e,r){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,r,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Os;for(const r of this.patterns)e.getRule(r).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,r){return this._getCachedCompiledWhilePatterns(e,r).compile(e)}compileWhileAG(e,r,n,s){return this._getCachedCompiledWhilePatterns(e,r).compileAG(e,n,s)}_getCachedCompiledWhilePatterns(e,r){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Os,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,r||"￿"),this._cachedCompiledWhilePatterns}},wu=class Jr{static createCaptureRule(e,r,n,s,d){return e.registerRule(_=>new ig(r,_,n,s,d))}static getCompiledRuleId(e,r,n){return e.id||r.registerRule(s=>{if(e.id=s,e.match)return new ng(e.$vscodeTextmateLocation,e.id,e.name,e.match,Jr._compileCaptures(e.captures,r,n));if(typeof e.begin>"u"){e.repository&&(n=uu({},n,e.repository));let d=e.patterns;return typeof d>"u"&&e.include&&(d=[{include:e.include}]),new vc(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,Jr._compilePatterns(d,r,n))}return e.while?new Co(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,Jr._compileCaptures(e.beginCaptures||e.captures,r,n),e.while,Jr._compileCaptures(e.whileCaptures||e.captures,r,n),Jr._compilePatterns(e.patterns,r,n)):new ja(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,Jr._compileCaptures(e.beginCaptures||e.captures,r,n),e.end,Jr._compileCaptures(e.endCaptures||e.captures,r,n),e.applyEndPatternLast,Jr._compilePatterns(e.patterns,r,n))}),e.id}static _compileCaptures(e,r,n){let s=[];if(e){let d=0;for(const _ in e){if(_==="$vscodeTextmateLocation")continue;const o=parseInt(_,10);o>d&&(d=o)}for(let _=0;_<=d;_++)s[_]=null;for(const _ in e){if(_==="$vscodeTextmateLocation")continue;const o=parseInt(_,10);let a=0;e[_].patterns&&(a=Jr.getCompiledRuleId(e[_],r,n)),s[o]=Jr.createCaptureRule(r,e[_].$vscodeTextmateLocation,e[_].name,e[_].contentName,a)}}return s}static _compilePatterns(e,r,n){let s=[];if(e)for(let d=0,_=e.length;d<_;d++){const o=e[d];let a=-1;if(o.include){const c=yu(o.include);switch(c.kind){case 0:case 1:a=Jr.getCompiledRuleId(n[o.include],r,n);break;case 2:let g=n[c.ruleName];g&&(a=Jr.getCompiledRuleId(g,r,n));break;case 3:case 4:const h=c.scopeName,v=c.kind===4?c.ruleName:null,m=r.getExternalGrammar(h,n);if(m)if(v){let w=m.repository[v];w&&(a=Jr.getCompiledRuleId(w,r,m.repository))}else a=Jr.getCompiledRuleId(m.repository.$self,r,m.repository);break}}else a=Jr.getCompiledRuleId(o,r,n);if(a!==-1){const c=r.getRule(a);let g=!1;if((c instanceof vc||c instanceof ja||c instanceof Co)&&c.hasMissingPatterns&&c.patterns.length===0&&(g=!0),g)continue;s.push(a)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},Ms=class Su{constructor(e,r){Ee(this,"source");Ee(this,"ruleId");Ee(this,"hasAnchor");Ee(this,"hasBackReferences");Ee(this,"_anchorCache");if(e&&typeof e=="string"){const n=e.length;let s=0,d=[],_=!1;for(let o=0;o<n;o++)if(e.charAt(o)==="\\"&&o+1<n){const c=e.charAt(o+1);c==="z"?(d.push(e.substring(s,o)),d.push("$(?!\\n)(?<!\\n)"),s=o+2):(c==="A"||c==="G")&&(_=!0),o++}this.hasAnchor=_,s===0?this.source=e:(d.push(e.substring(s,n)),this.source=d.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=r,typeof this.source=="string"?this.hasBackReferences=tg.test(this.source):this.hasBackReferences=!1}clone(){return new Su(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,r){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let n=r.map(s=>e.substring(s.start,s.end));return _c.lastIndex=0,this.source.replace(_c,(s,d)=>_u(n[parseInt(d,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],r=[],n=[],s=[],d,_,o,a;for(d=0,_=this.source.length;d<_;d++)o=this.source.charAt(d),e[d]=o,r[d]=o,n[d]=o,s[d]=o,o==="\\"&&d+1<_&&(a=this.source.charAt(d+1),a==="A"?(e[d+1]="￿",r[d+1]="￿",n[d+1]="A",s[d+1]="A"):a==="G"?(e[d+1]="￿",r[d+1]="G",n[d+1]="￿",s[d+1]="G"):(e[d+1]=a,r[d+1]=a,n[d+1]=a,s[d+1]=a),d++);return{A0_G0:e.join(""),A0_G1:r.join(""),A1_G0:n.join(""),A1_G1:s.join("")}}resolveAnchors(e,r){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?r?this._anchorCache.A1_G1:this._anchorCache.A1_G0:r?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Os=class{constructor(){Ee(this,"_items");Ee(this,"_hasAnchors");Ee(this,"_cached");Ee(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(r=>r.source);this._cached=new gc(t,e,this._items.map(r=>r.ruleId))}return this._cached}compileAG(t,e,r){return this._hasAnchors?e?r?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,r)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,r)),this._anchorCache.A1_G0):r?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,r)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,r)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,r){let n=this._items.map(s=>s.resolveAnchors(e,r));return new gc(t,n,this._items.map(s=>s.ruleId))}},gc=class{constructor(t,e,r){Ee(this,"scanner");this.regExps=e,this.rules=r,this.scanner=t.createOnigScanner(e)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,r=this.rules.length;e<r;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
167
+ `)}findNextMatchSync(t,e,r){const n=this.scanner.findNextMatchSync(t,e,r);return n?{ruleId:this.rules[n.index],captureIndices:n.captureIndices}:null}},aa=class{constructor(t,e){this.languageId=t,this.tokenType=e}},Ki,sg=(Ki=class{constructor(e,r){Ee(this,"_defaultAttributes");Ee(this,"_embeddedLanguagesMatcher");Ee(this,"_getBasicScopeAttributes",new vu(e=>{const r=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new aa(r,n)}));this._defaultAttributes=new aa(e,8),this._embeddedLanguagesMatcher=new og(Object.entries(r||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?Ki._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const r=e.match(Ki.STANDARD_TOKEN_TYPE_REGEXP);if(!r)return 8;switch(r[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},Ee(Ki,"_NULL_SCOPE_METADATA",new aa(0,0)),Ee(Ki,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Ki),og=class{constructor(t){Ee(this,"values");Ee(this,"scopesRegExp");if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([r,n])=>_u(r));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},mc=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Cu(t,e,r,n,s,d,_,o){const a=e.content.length;let c=!1,g=-1;if(_){const m=ag(t,e,r,n,s,d);s=m.stack,n=m.linePos,r=m.isFirstLine,g=m.anchorPosition}const h=Date.now();for(;!c;){if(o!==0&&Date.now()-h>o)return new mc(s,!0);v()}return new mc(s,!1);function v(){const m=lg(t,e,r,n,s,g);if(!m){d.produce(s,a),c=!0;return}const w=m.captureIndices,b=m.matchedRuleId,f=w&&w.length>0?w[0].end>n:!1;if(b===rg){const u=s.getRule(t);d.produce(s,w[0].start),s=s.withContentNameScopesList(s.nameScopesList),Ss(t,e,r,s,d,u.endCaptures,w),d.produce(s,w[0].end);const l=s;if(s=s.parent,g=l.getAnchorPos(),!f&&l.getEnterPos()===n){s=l,d.produce(s,a),c=!0;return}}else{const u=t.getRule(b);d.produce(s,w[0].start);const l=s,p=u.getName(e.content,w),y=s.contentNameScopesList.pushAttributed(p,t);if(s=s.push(b,n,g,w[0].end===a,null,y,y),u instanceof ja){const k=u;Ss(t,e,r,s,d,k.beginCaptures,w),d.produce(s,w[0].end),g=w[0].end;const C=k.getContentName(e.content,w),A=y.pushAttributed(C,t);if(s=s.withContentNameScopesList(A),k.endHasBackReferences&&(s=s.withEndRule(k.getEndWithResolvedBackReferences(e.content,w))),!f&&l.hasSameRuleAs(s)){s=s.pop(),d.produce(s,a),c=!0;return}}else if(u instanceof Co){const k=u;Ss(t,e,r,s,d,k.beginCaptures,w),d.produce(s,w[0].end),g=w[0].end;const C=k.getContentName(e.content,w),A=y.pushAttributed(C,t);if(s=s.withContentNameScopesList(A),k.whileHasBackReferences&&(s=s.withEndRule(k.getWhileWithResolvedBackReferences(e.content,w))),!f&&l.hasSameRuleAs(s)){s=s.pop(),d.produce(s,a),c=!0;return}}else if(Ss(t,e,r,s,d,u.captures,w),d.produce(s,w[0].end),s=s.pop(),!f){s=s.safePop(),d.produce(s,a),c=!0;return}}w[0].end>n&&(n=w[0].end,r=!1)}}function ag(t,e,r,n,s,d){let _=s.beginRuleCapturedEOL?0:-1;const o=[];for(let a=s;a;a=a.pop()){const c=a.getRule(t);c instanceof Co&&o.push({rule:c,stack:a})}for(let a=o.pop();a;a=o.pop()){const{ruleScanner:c,findOptions:g}=ug(a.rule,t,a.stack.endRule,r,n===_),h=c.findNextMatchSync(e,n,g);if(h){if(h.ruleId!==xu){s=a.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(d.produce(a.stack,h.captureIndices[0].start),Ss(t,e,r,a.stack,d,a.rule.whileCaptures,h.captureIndices),d.produce(a.stack,h.captureIndices[0].end),_=h.captureIndices[0].end,h.captureIndices[0].end>n&&(n=h.captureIndices[0].end,r=!1))}else{s=a.stack.pop();break}}return{stack:s,linePos:n,anchorPosition:_,isFirstLine:r}}function lg(t,e,r,n,s,d){const _=cg(t,e,r,n,s,d),o=t.getInjections();if(o.length===0)return _;const a=dg(o,t,e,r,n,s,d);if(!a)return _;if(!_)return a;const c=_.captureIndices[0].start,g=a.captureIndices[0].start;return g<c||a.priorityMatch&&g===c?a:_}function cg(t,e,r,n,s,d){const _=s.getRule(t),{ruleScanner:o,findOptions:a}=ku(_,t,s.endRule,r,n===d),c=o.findNextMatchSync(e,n,a);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function dg(t,e,r,n,s,d,_){let o=Number.MAX_VALUE,a=null,c,g=0;const h=d.contentNameScopesList.getScopeNames();for(let v=0,m=t.length;v<m;v++){const w=t[v];if(!w.matcher(h))continue;const b=e.getRule(w.ruleId),{ruleScanner:f,findOptions:u}=ku(b,e,null,n,s===_),l=f.findNextMatchSync(r,s,u);if(!l)continue;const p=l.captureIndices[0].start;if(!(p>=o)&&(o=p,a=l.captureIndices,c=l.ruleId,g=w.priority,o===s))break}return a?{priorityMatch:g===-1,captureIndices:a,matchedRuleId:c}:null}function ku(t,e,r,n,s){return{ruleScanner:t.compileAG(e,r,n,s),findOptions:0}}function ug(t,e,r,n,s){return{ruleScanner:t.compileWhileAG(e,r,n,s),findOptions:0}}function Ss(t,e,r,n,s,d,_){if(d.length===0)return;const o=e.content,a=Math.min(d.length,_.length),c=[],g=_[0].end;for(let h=0;h<a;h++){const v=d[h];if(v===null)continue;const m=_[h];if(m.length===0)continue;if(m.start>g)break;for(;c.length>0&&c[c.length-1].endPos<=m.start;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?s.produceFromScopes(c[c.length-1].scopes,m.start):s.produce(n,m.start),v.retokenizeCapturedWithRuleId){const b=v.getName(o,_),f=n.contentNameScopesList.pushAttributed(b,t),u=v.getContentName(o,_),l=f.pushAttributed(u,t),p=n.push(v.retokenizeCapturedWithRuleId,m.start,-1,!1,null,f,l),y=t.createOnigString(o.substring(0,m.end));Cu(t,y,r&&m.start===0,m.start,p,s,!1,0),bu(y);continue}const w=v.getName(o,_);if(w!==null){const f=(c.length>0?c[c.length-1].scopes:n.contentNameScopesList).pushAttributed(w,t);c.push(new hg(f,m.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var hg=class{constructor(t,e){Ee(this,"scopes");Ee(this,"endPos");this.scopes=t,this.endPos=e}};function fg(t,e,r,n,s,d,_,o){return new _g(t,e,r,n,s,d,_,o)}function bc(t,e,r,n,s){const d=wo(e,ko),_=wu.getCompiledRuleId(r,n,s.repository);for(const o of d)t.push({debugSelector:e,matcher:o.matcher,ruleId:_,grammar:s,priority:o.priority})}function ko(t,e){if(e.length<t.length)return!1;let r=0;return t.every(n=>{for(let s=r;s<e.length;s++)if(pg(e[s],n))return r=s+1,!0;return!1})}function pg(t,e){if(!t)return!1;if(t===e)return!0;const r=e.length;return t.length>r&&t.substr(0,r)===e&&t[r]==="."}var _g=class{constructor(t,e,r,n,s,d,_,o){Ee(this,"_rootId");Ee(this,"_lastRuleId");Ee(this,"_ruleId2desc");Ee(this,"_includedGrammars");Ee(this,"_grammarRepository");Ee(this,"_grammar");Ee(this,"_injections");Ee(this,"_basicScopeAttributesProvider");Ee(this,"_tokenTypeMatchers");if(this._rootScopeName=t,this.balancedBracketSelectors=d,this._onigLib=o,this._basicScopeAttributesProvider=new sg(r,n),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=_,this._grammar=yc(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const a of Object.keys(s)){const c=wo(a,ko);for(const g of c)this._tokenTypeMatchers.push({matcher:g.matcher,type:s[a]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],r=this._rootScopeName,n=t.lookup(r);if(n){const s=n.injections;if(s)for(let _ in s)bc(e,_,s[_],this,n);const d=this._grammarRepository.injections(r);d&&d.forEach(_=>{const o=this.getExternalGrammar(_);if(o){const a=o.injectionSelector;a&&bc(e,a,o,this,o)}})}return e.sort((s,d)=>s.priority-d.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,r=t(e);return this._ruleId2desc[e]=r,r}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const r=this._grammarRepository.lookup(t);if(r)return this._includedGrammars[t]=yc(r,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,r=0){const n=this._tokenize(t,e,!1,r);return{tokens:n.lineTokens.getResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}tokenizeLine2(t,e,r=0){const n=this._tokenize(t,e,!0,r);return{tokens:n.lineTokens.getBinaryResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}_tokenize(t,e,r,n){this._rootId===-1&&(this._rootId=wu.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===Ha.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),g=this.themeProvider.getDefaults(),h=ss.set(0,c.languageId,c.tokenType,null,g.fontStyle,g.foregroundId,g.backgroundId),v=this.getRule(this._rootId).getName(null,null);let m;v?m=Ps.createRootAndLookUpScopeName(v,h,this):m=Ps.createRoot("unknown",h),e=new Ha(null,this._rootId,-1,-1,!1,null,m,m)}else s=!1,e.reset();t=t+`
168
+ `;const d=this.createOnigString(t),_=d.content.length,o=new gg(r,t,this._tokenTypeMatchers,this.balancedBracketSelectors),a=Cu(this,d,s,0,e,o,!0,n);return bu(d),{lineLength:_,lineTokens:o,ruleStack:a.stack,stoppedEarly:a.stoppedEarly}}};function yc(t,e){return t=Mv(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var Ps=class Di{constructor(e,r,n){this.parent=e,this.scopePath=r,this.tokenAttributes=n}static fromExtension(e,r){let n=e,s=(e==null?void 0:e.scopePath)??null;for(const d of r)s=oa.push(s,d.scopeNames),n=new Di(n,s,d.encodedTokenAttributes);return n}static createRoot(e,r){return new Di(null,new oa(null,e),r)}static createRootAndLookUpScopeName(e,r,n){const s=n.getMetadataForScope(e),d=new oa(null,e),_=n.themeProvider.themeMatch(d),o=Di.mergeAttributes(r,s,_);return new Di(null,d,o)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return Di.equals(this,e)}static equals(e,r){do{if(e===r||!e&&!r)return!0;if(!e||!r||e.scopeName!==r.scopeName||e.tokenAttributes!==r.tokenAttributes)return!1;e=e.parent,r=r.parent}while(!0)}static mergeAttributes(e,r,n){let s=-1,d=0,_=0;return n!==null&&(s=n.fontStyle,d=n.foregroundId,_=n.backgroundId),ss.set(e,r.languageId,r.tokenType,null,s,d,_)}pushAttributed(e,r){if(e===null)return this;if(e.indexOf(" ")===-1)return Di._pushAttributed(this,e,r);const n=e.split(/ /g);let s=this;for(const d of n)s=Di._pushAttributed(s,d,r);return s}static _pushAttributed(e,r,n){const s=n.getMetadataForScope(r),d=e.scopePath.push(r),_=n.themeProvider.themeMatch(d),o=Di.mergeAttributes(e.tokenAttributes,s,_);return new Di(e,d,o)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){var s;const r=[];let n=this;for(;n&&n!==e;)r.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(((s=n.parent)==null?void 0:s.scopePath)??null)}),n=n.parent;return n===e?r.reverse():void 0}},yi,Ha=(yi=class{constructor(e,r,n,s,d,_,o,a){Ee(this,"_stackElementBrand");Ee(this,"_enterPos");Ee(this,"_anchorPos");Ee(this,"depth");this.parent=e,this.ruleId=r,this.beginRuleCapturedEOL=d,this.endRule=_,this.nameScopesList=o,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=s}equals(e){return e===null?!1:yi._equals(this,e)}static _equals(e,r){return e===r?!0:this._structuralEquals(e,r)?Ps.equals(e.contentNameScopesList,r.contentNameScopesList):!1}static _structuralEquals(e,r){do{if(e===r||!e&&!r)return!0;if(!e||!r||e.depth!==r.depth||e.ruleId!==r.ruleId||e.endRule!==r.endRule)return!1;e=e.parent,r=r.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){yi._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,r,n,s,d,_,o){return new yi(this,e,r,n,s,d,_,o)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,r){var n,s;return this.parent&&(r=this.parent._writeString(e,r)),e[r++]=`(${this.ruleId}, ${(n=this.nameScopesList)==null?void 0:n.toString()}, ${(s=this.contentNameScopesList)==null?void 0:s.toString()})`,r}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new yi(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let r=this;for(;r&&r._enterPos===e._enterPos;){if(r.ruleId===e.ruleId)return!0;r=r.parent}return!1}toStateStackFrame(){var e,r,n;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((r=this.nameScopesList)==null?void 0:r.getExtensionIfDefined(((e=this.parent)==null?void 0:e.nameScopesList)??null))??[],contentNameScopesList:((n=this.contentNameScopesList)==null?void 0:n.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(e,r){const n=Ps.fromExtension((e==null?void 0:e.nameScopesList)??null,r.nameScopesList);return new yi(e,r.ruleId,r.enterPos??-1,r.anchorPos??-1,r.beginRuleCapturedEOL,r.endRule,n,Ps.fromExtension(n,r.contentNameScopesList))}},Ee(yi,"NULL",new yi(null,0,0,0,!1,null,null,null)),yi),vg=class{constructor(t,e){Ee(this,"balancedBracketScopes");Ee(this,"unbalancedBracketScopes");Ee(this,"allowAny",!1);this.balancedBracketScopes=t.flatMap(r=>r==="*"?(this.allowAny=!0,[]):wo(r,ko).map(n=>n.matcher)),this.unbalancedBracketScopes=e.flatMap(r=>wo(r,ko).map(n=>n.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},gg=class{constructor(t,e,r,n){Ee(this,"_emitBinaryTokens");Ee(this,"_lineText");Ee(this,"_tokens");Ee(this,"_binaryTokens");Ee(this,"_lastTokenEndIndex");Ee(this,"_tokenTypeOverrides");this.balancedBracketSelectors=n,this._emitBinaryTokens=t,this._tokenTypeOverrides=r,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){var n;if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let s=(t==null?void 0:t.tokenAttributes)??0,d=!1;if((n=this.balancedBracketSelectors)!=null&&n.matchesAlways&&(d=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const _=(t==null?void 0:t.getScopeNames())??[];for(const o of this._tokenTypeOverrides)o.matcher(_)&&(s=ss.set(s,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(d=this.balancedBracketSelectors.match(_))}if(d&&(s=ss.set(s,0,8,d,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),this._lastTokenEndIndex=e;return}const r=(t==null?void 0:t.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:r}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const r=new Uint32Array(this._binaryTokens.length);for(let n=0,s=this._binaryTokens.length;n<s;n++)r[n]=this._binaryTokens[n];return r}},mg=class{constructor(t,e){Ee(this,"_grammars",new Map);Ee(this,"_rawGrammars",new Map);Ee(this,"_injectionGrammars",new Map);Ee(this,"_theme");this._onigLib=e,this._theme=t}dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,r,n,s){if(!this._grammars.has(t)){let d=this._rawGrammars.get(t);if(!d)return null;this._grammars.set(t,fg(t,d,e,r,n,s,this,this._onigLib))}return this._grammars.get(t)}},bg=class{constructor(e){Ee(this,"_options");Ee(this,"_syncRegistry");Ee(this,"_ensureGrammarCache");this._options=e,this._syncRegistry=new mg(xo.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,r){this._syncRegistry.setTheme(xo.createFromRawTheme(e,r))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,r,n){return this.loadGrammarWithConfiguration(e,r,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,r,n){return this._loadGrammar(e,r,n.embeddedLanguages,n.tokenTypes,new vg(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,r,n,s,d){const _=new Xv(this._syncRegistry,e);for(;_.Q.length>0;)_.Q.map(o=>this._loadSingleGrammar(o.scopeName)),_.processQueue();return this._grammarForScopeName(e,r,n,s,d)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const r=this._options.loadGrammar(e);if(r){const n=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(r,n)}}addGrammar(e,r=[],n=0,s=null){return this._syncRegistry.addGrammar(e,r),this._grammarForScopeName(e.scopeName,n,s)}_grammarForScopeName(e,r=0,n=null,s=null,d=null){return this._syncRegistry.grammarForScopeName(e,r,n,s,d)}},Fa=Ha.NULL;const yg=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Gs{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}Gs.prototype.normal={};Gs.prototype.property={};Gs.prototype.space=void 0;function Eu(t,e){const r={},n={};for(const s of t)Object.assign(r,s.property),Object.assign(n,s.normal);return new Gs(r,n,e)}function Ua(t){return t.toLowerCase()}class si{constructor(e,r){this.attribute=r,this.property=e}}si.prototype.attribute="";si.prototype.booleanish=!1;si.prototype.boolean=!1;si.prototype.commaOrSpaceSeparated=!1;si.prototype.commaSeparated=!1;si.prototype.defined=!1;si.prototype.mustUseProperty=!1;si.prototype.number=!1;si.prototype.overloadedBoolean=!1;si.prototype.property="";si.prototype.spaceSeparated=!1;si.prototype.space=void 0;let xg=0;const Dt=Nn(),Er=Nn(),Va=Nn(),Qe=Nn(),pr=Nn(),Wn=Nn(),oi=Nn();function Nn(){return 2**++xg}const za=Object.freeze(Object.defineProperty({__proto__:null,boolean:Dt,booleanish:Er,commaOrSpaceSeparated:oi,commaSeparated:Wn,number:Qe,overloadedBoolean:Va,spaceSeparated:pr},Symbol.toStringTag,{value:"Module"})),la=Object.keys(za);class xl extends si{constructor(e,r,n,s){let d=-1;if(super(e,r),xc(this,"space",s),typeof n=="number")for(;++d<la.length;){const _=la[d];xc(this,la[d],(n&za[_])===za[_])}}}xl.prototype.defined=!0;function xc(t,e,r){r&&(t[e]=r)}function as(t){const e={},r={};for(const[n,s]of Object.entries(t.properties)){const d=new xl(n,t.transform(t.attributes||{},n),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(d.mustUseProperty=!0),e[n]=d,r[Ua(n)]=n,r[Ua(d.attribute)]=n}return new Gs(e,r,t.space)}const Au=as({properties:{ariaActiveDescendant:null,ariaAtomic:Er,ariaAutoComplete:null,ariaBusy:Er,ariaChecked:Er,ariaColCount:Qe,ariaColIndex:Qe,ariaColSpan:Qe,ariaControls:pr,ariaCurrent:null,ariaDescribedBy:pr,ariaDetails:null,ariaDisabled:Er,ariaDropEffect:pr,ariaErrorMessage:null,ariaExpanded:Er,ariaFlowTo:pr,ariaGrabbed:Er,ariaHasPopup:null,ariaHidden:Er,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:pr,ariaLevel:Qe,ariaLive:null,ariaModal:Er,ariaMultiLine:Er,ariaMultiSelectable:Er,ariaOrientation:null,ariaOwns:pr,ariaPlaceholder:null,ariaPosInSet:Qe,ariaPressed:Er,ariaReadOnly:Er,ariaRelevant:null,ariaRequired:Er,ariaRoleDescription:pr,ariaRowCount:Qe,ariaRowIndex:Qe,ariaRowSpan:Qe,ariaSelected:Er,ariaSetSize:Qe,ariaSort:null,ariaValueMax:Qe,ariaValueMin:Qe,ariaValueNow:Qe,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Tu(t,e){return e in t?t[e]:e}function Pu(t,e){return Tu(t,e.toLowerCase())}const wg=as({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Wn,acceptCharset:pr,accessKey:pr,action:null,allow:null,allowFullScreen:Dt,allowPaymentRequest:Dt,allowUserMedia:Dt,alt:null,as:null,async:Dt,autoCapitalize:null,autoComplete:pr,autoFocus:Dt,autoPlay:Dt,blocking:pr,capture:null,charSet:null,checked:Dt,cite:null,className:pr,cols:Qe,colSpan:null,content:null,contentEditable:Er,controls:Dt,controlsList:pr,coords:Qe|Wn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Dt,defer:Dt,dir:null,dirName:null,disabled:Dt,download:Va,draggable:Er,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Dt,formTarget:null,headers:pr,height:Qe,hidden:Va,high:Qe,href:null,hrefLang:null,htmlFor:pr,httpEquiv:pr,id:null,imageSizes:null,imageSrcSet:null,inert:Dt,inputMode:null,integrity:null,is:null,isMap:Dt,itemId:null,itemProp:pr,itemRef:pr,itemScope:Dt,itemType:pr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Dt,low:Qe,manifest:null,max:null,maxLength:Qe,media:null,method:null,min:null,minLength:Qe,multiple:Dt,muted:Dt,name:null,nonce:null,noModule:Dt,noValidate:Dt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Dt,optimum:Qe,pattern:null,ping:pr,placeholder:null,playsInline:Dt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Dt,referrerPolicy:null,rel:pr,required:Dt,reversed:Dt,rows:Qe,rowSpan:Qe,sandbox:pr,scope:null,scoped:Dt,seamless:Dt,selected:Dt,shadowRootClonable:Dt,shadowRootDelegatesFocus:Dt,shadowRootMode:null,shape:null,size:Qe,sizes:null,slot:null,span:Qe,spellCheck:Er,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Qe,step:null,style:null,tabIndex:Qe,target:null,title:null,translate:null,type:null,typeMustMatch:Dt,useMap:null,value:Er,width:Qe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:pr,axis:null,background:null,bgColor:null,border:Qe,borderColor:null,bottomMargin:Qe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Dt,declare:Dt,event:null,face:null,frame:null,frameBorder:null,hSpace:Qe,leftMargin:Qe,link:null,longDesc:null,lowSrc:null,marginHeight:Qe,marginWidth:Qe,noResize:Dt,noHref:Dt,noShade:Dt,noWrap:Dt,object:null,profile:null,prompt:null,rev:null,rightMargin:Qe,rules:null,scheme:null,scrolling:Er,standby:null,summary:null,text:null,topMargin:Qe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Qe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Dt,disableRemotePlayback:Dt,prefix:null,property:null,results:Qe,security:null,unselectable:null},space:"html",transform:Pu}),Sg=as({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:oi,accentHeight:Qe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Qe,amplitude:Qe,arabicForm:null,ascent:Qe,attributeName:null,attributeType:null,azimuth:Qe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Qe,by:null,calcMode:null,capHeight:Qe,className:pr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Qe,diffuseConstant:Qe,direction:null,display:null,dur:null,divisor:Qe,dominantBaseline:null,download:Dt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Qe,enableBackground:null,end:null,event:null,exponent:Qe,externalResourcesRequired:null,fill:null,fillOpacity:Qe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Wn,g2:Wn,glyphName:Wn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Qe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Qe,horizOriginX:Qe,horizOriginY:Qe,id:null,ideographic:Qe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Qe,k:Qe,k1:Qe,k2:Qe,k3:Qe,k4:Qe,kernelMatrix:oi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Qe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Qe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Qe,overlineThickness:Qe,paintOrder:null,panose1:null,path:null,pathLength:Qe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:pr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Qe,pointsAtY:Qe,pointsAtZ:Qe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:oi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:oi,rev:oi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:oi,requiredFeatures:oi,requiredFonts:oi,requiredFormats:oi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Qe,specularExponent:Qe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Qe,strikethroughThickness:Qe,string:null,stroke:null,strokeDashArray:oi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Qe,strokeOpacity:Qe,strokeWidth:null,style:null,surfaceScale:Qe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:oi,tabIndex:Qe,tableValues:null,target:null,targetX:Qe,targetY:Qe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:oi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Qe,underlineThickness:Qe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Qe,values:null,vAlphabetic:Qe,vMathematical:Qe,vectorEffect:null,vHanging:Qe,vIdeographic:Qe,version:null,vertAdvY:Qe,vertOriginX:Qe,vertOriginY:Qe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Qe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Tu}),Lu=as({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),Ru=as({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Pu}),Iu=as({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),Cg=/[A-Z]/g,wc=/-[a-z]/g,kg=/^data[-\w.:]+$/i;function Eg(t,e){const r=Ua(e);let n=e,s=si;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&kg.test(e)){if(e.charAt(4)==="-"){const d=e.slice(5).replace(wc,Tg);n="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{const d=e.slice(4);if(!wc.test(d)){let _=d.replace(Cg,Ag);_.charAt(0)!=="-"&&(_="-"+_),e="data"+_}}s=xl}return new s(n,e)}function Ag(t){return"-"+t.toLowerCase()}function Tg(t){return t.charAt(1).toUpperCase()}const Pg=Eu([Au,wg,Lu,Ru,Iu],"html"),Du=Eu([Au,Sg,Lu,Ru,Iu],"svg"),Sc={}.hasOwnProperty;function Lg(t,e){const r=e||{};function n(s,...d){let _=n.invalid;const o=n.handlers;if(s&&Sc.call(s,t)){const a=String(s[t]);_=Sc.call(o,a)?o[a]:n.unknown}if(_)return _.call(this,s,...d)}return n.handlers=r.handlers||{},n.invalid=r.invalid,n.unknown=r.unknown,n}const Rg=/["&'<>`]/g,Ig=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Dg=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Mg=/[|\\{}()[\]^$+*?.]/g,Cc=new WeakMap;function Og(t,e){if(t=t.replace(e.subset?Bg(e.subset):Rg,n),e.subset||e.escapeOnly)return t;return t.replace(Ig,r).replace(Dg,n);function r(s,d,_){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,_.charCodeAt(d+2),e)}function n(s,d,_){return e.format(s.charCodeAt(0),_.charCodeAt(d+1),e)}}function Bg(t){let e=Cc.get(t);return e||(e=Ng(t),Cc.set(t,e)),e}function Ng(t){const e=[];let r=-1;for(;++r<t.length;)e.push(t[r].replace(Mg,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const jg=/[\dA-Fa-f]/;function Hg(t,e,r){const n="&#x"+t.toString(16).toUpperCase();return r&&e&&!jg.test(String.fromCharCode(e))?n:n+";"}const Fg=/\d/;function Ug(t,e,r){const n="&#"+String(t);return r&&e&&!Fg.test(String.fromCharCode(e))?n:n+";"}const Vg=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],ca={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},zg=["cent","copy","divide","gt","lt","not","para","times"],Mu={}.hasOwnProperty,Wa={};let Zs;for(Zs in ca)Mu.call(ca,Zs)&&(Wa[ca[Zs]]=Zs);const Wg=/[^\dA-Za-z]/;function qg(t,e,r,n){const s=String.fromCharCode(t);if(Mu.call(Wa,s)){const d=Wa[s],_="&"+d;return r&&Vg.includes(d)&&!zg.includes(d)&&(!n||e&&e!==61&&Wg.test(String.fromCharCode(e)))?_:_+";"}return""}function Gg(t,e,r){let n=Hg(t,e,r.omitOptionalSemicolons),s;if((r.useNamedReferences||r.useShortestReferences)&&(s=qg(t,e,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!s)&&r.useShortestReferences){const d=Ug(t,e,r.omitOptionalSemicolons);d.length<n.length&&(n=d)}return s&&(!r.useShortestReferences||s.length<n.length)?s:n}function qn(t,e){return Og(t,Object.assign({format:Gg},e))}const Kg=/^>|^->|<!--|-->|--!>|<!-$/g,Xg=[">"],Jg=["<",">"];function Yg(t,e,r,n){return n.settings.bogusComments?"<?"+qn(t.value,Object.assign({},n.settings.characterReferences,{subset:Xg}))+">":"<!--"+t.value.replace(Kg,s)+"-->";function s(d){return qn(d,Object.assign({},n.settings.characterReferences,{subset:Jg}))}}function Qg(t,e,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"}function kc(t,e){const r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,s=r.indexOf(e);for(;s!==-1;)n++,s=r.indexOf(e,s+e.length);return n}function Zg(t,e){const r=e||{};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}function $g(t){return t.join(" ").trim()}const em=/[ \t\n\f\r]/g;function wl(t){return typeof t=="object"?t.type==="text"?Ec(t.value):!1:Ec(t)}function Ec(t){return t.replace(em,"")===""}const Ir=Bu(1),Ou=Bu(-1),tm=[];function Bu(t){return e;function e(r,n,s){const d=r?r.children:tm;let _=(n||0)+t,o=d[_];if(!s)for(;o&&wl(o);)_+=t,o=d[_];return o}}const rm={}.hasOwnProperty;function Nu(t){return e;function e(r,n,s){return rm.call(t,r.tagName)&&t[r.tagName](r,n,s)}}const Sl=Nu({body:nm,caption:da,colgroup:da,dd:lm,dt:am,head:da,html:im,li:om,optgroup:cm,option:dm,p:sm,rp:Ac,rt:Ac,tbody:hm,td:Tc,tfoot:fm,th:Tc,thead:um,tr:pm});function da(t,e,r){const n=Ir(r,e,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&wl(n.value.charAt(0)))}function im(t,e,r){const n=Ir(r,e);return!n||n.type!=="comment"}function nm(t,e,r){const n=Ir(r,e);return!n||n.type!=="comment"}function sm(t,e,r){const n=Ir(r,e);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!r||!(r.type==="element"&&(r.tagName==="a"||r.tagName==="audio"||r.tagName==="del"||r.tagName==="ins"||r.tagName==="map"||r.tagName==="noscript"||r.tagName==="video"))}function om(t,e,r){const n=Ir(r,e);return!n||n.type==="element"&&n.tagName==="li"}function am(t,e,r){const n=Ir(r,e);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function lm(t,e,r){const n=Ir(r,e);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function Ac(t,e,r){const n=Ir(r,e);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function cm(t,e,r){const n=Ir(r,e);return!n||n.type==="element"&&n.tagName==="optgroup"}function dm(t,e,r){const n=Ir(r,e);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function um(t,e,r){const n=Ir(r,e);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function hm(t,e,r){const n=Ir(r,e);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function fm(t,e,r){return!Ir(r,e)}function pm(t,e,r){const n=Ir(r,e);return!n||n.type==="element"&&n.tagName==="tr"}function Tc(t,e,r){const n=Ir(r,e);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}const _m=Nu({body:mm,colgroup:bm,head:gm,html:vm,tbody:ym});function vm(t){const e=Ir(t,-1);return!e||e.type!=="comment"}function gm(t){const e=new Set;for(const n of t.children)if(n.type==="element"&&(n.tagName==="base"||n.tagName==="title")){if(e.has(n.tagName))return!1;e.add(n.tagName)}const r=t.children[0];return!r||r.type==="element"}function mm(t){const e=Ir(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&wl(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function bm(t,e,r){const n=Ou(r,e),s=Ir(t,-1,!0);return r&&n&&n.type==="element"&&n.tagName==="colgroup"&&Sl(n,r.children.indexOf(n),r)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function ym(t,e,r){const n=Ou(r,e),s=Ir(t,-1);return r&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&Sl(n,r.children.indexOf(n),r)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const $s={name:[[`
169
+ \f\r &/=>`.split(""),`
170
+ \f\r "&'/=>\``.split("")],[`\0
171
+ \f\r "&'/<=>`.split(""),`\0
172
+ \f\r "&'/<=>\``.split("")]],unquoted:[[`
173
+ \f\r &>`.split(""),`\0
174
+ \f\r "&'<=>\``.split("")],[`\0
175
+ \f\r "&'<=>\``.split(""),`\0
176
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function xm(t,e,r,n){const s=n.schema,d=s.space==="svg"?!1:n.settings.omitOptionalTags;let _=s.space==="svg"?n.settings.closeEmptyElements:n.settings.voids.includes(t.tagName.toLowerCase());const o=[];let a;s.space==="html"&&t.tagName==="svg"&&(n.schema=Du);const c=wm(n,t.properties),g=n.all(s.space==="html"&&t.tagName==="template"?t.content:t);return n.schema=s,g&&(_=!1),(c||!d||!_m(t,e,r))&&(o.push("<",t.tagName,c?" "+c:""),_&&(s.space==="svg"||n.settings.closeSelfClosing)&&(a=c.charAt(c.length-1),(!n.settings.tightSelfClosing||a==="/"||a&&a!=='"'&&a!=="'")&&o.push(" "),o.push("/")),o.push(">")),o.push(g),!_&&(!d||!Sl(t,e,r))&&o.push("</"+t.tagName+">"),o.join("")}function wm(t,e){const r=[];let n=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const d=Sm(t,s,e[s]);d&&r.push(d)}}for(;++n<r.length;){const d=t.settings.tightAttributes?r[n].charAt(r[n].length-1):void 0;n!==r.length-1&&d!=='"'&&d!=="'"&&(r[n]+=" ")}return r.join("")}function Sm(t,e,r){const n=Eg(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,d=t.settings.allowDangerousCharacters?0:1;let _=t.quote,o;if(n.overloadedBoolean&&(r===n.attribute||r==="")?r=!0:(n.boolean||n.overloadedBoolean)&&(typeof r!="string"||r===n.attribute||r==="")&&(r=!!r),r==null||r===!1||typeof r=="number"&&Number.isNaN(r))return"";const a=qn(n.attribute,Object.assign({},t.settings.characterReferences,{subset:$s.name[s][d]}));return r===!0||(r=Array.isArray(r)?(n.commaSeparated?Zg:$g)(r,{padLeft:!t.settings.tightCommaSeparatedLists}):String(r),t.settings.collapseEmptyAttributes&&!r)?a:(t.settings.preferUnquoted&&(o=qn(r,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:$s.unquoted[s][d]}))),o!==r&&(t.settings.quoteSmart&&kc(r,_)>kc(r,t.alternative)&&(_=t.alternative),o=_+qn(r,Object.assign({},t.settings.characterReferences,{subset:(_==="'"?$s.single:$s.double)[s][d],attribute:!0}))+_),a+(o&&"="+o))}const Cm=["<","&"];function ju(t,e,r,n){return r&&r.type==="element"&&(r.tagName==="script"||r.tagName==="style")?t.value:qn(t.value,Object.assign({},n.settings.characterReferences,{subset:Cm}))}function km(t,e,r,n){return n.settings.allowDangerousHtml?t.value:ju(t,e,r,n)}function Em(t,e,r,n){return n.all(t)}const Am=Lg("type",{invalid:Tm,unknown:Pm,handlers:{comment:Yg,doctype:Qg,element:xm,raw:km,root:Em,text:ju}});function Tm(t){throw new Error("Expected node, not `"+t+"`")}function Pm(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Lm={},Rm={},Im=[];function Dm(t,e){const r=e||Lm,n=r.quote||'"',s=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:Mm,all:Om,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||yg,characterReferences:r.characterReferences||Rm,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space==="svg"?Du:Pg,quote:n,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Mm(t,e,r){return Am(t,e,r,this)}function Om(t){const e=[],r=t&&t.children||Im;let n=-1;for(;++n<r.length;)e[n]=this.one(r[n],n,t);return e.join("")}function Eo(t,e){const r=typeof t=="string"?{}:{...t.colorReplacements},n=typeof t=="string"?t:t.name;for(const[s,d]of Object.entries((e==null?void 0:e.colorReplacements)||{}))typeof d=="string"?r[s]=d:s===n&&Object.assign(r,d);return r}function dn(t,e){return t&&((e==null?void 0:e[t==null?void 0:t.toLowerCase()])||t)}function Bm(t){return Array.isArray(t)?t:[t]}async function Hu(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function Cl(t){return!t||["plaintext","txt","text","plain"].includes(t)}function Fu(t){return t==="ansi"||Cl(t)}function kl(t){return t==="none"}function Uu(t){return kl(t)}function Vu(t,e){var n;if(!e)return t;t.properties||(t.properties={}),(n=t.properties).class||(n.class=[]),typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const r=Array.isArray(e)?e:e.split(/\s+/g);for(const s of r)s&&!t.properties.class.includes(s)&&t.properties.class.push(s);return t}function zo(t,e=!1){var d;if(t.length===0)return[["",0]];const r=t.split(/(\r?\n)/g);let n=0;const s=[];for(let _=0;_<r.length;_+=2){const o=e?r[_]+(r[_+1]||""):r[_];s.push([o,n]),n+=r[_].length,n+=((d=r[_+1])==null?void 0:d.length)||0}return s}function Nm(t){const e=zo(t,!0).map(([s])=>s);function r(s){if(s===t.length)return{line:e.length-1,character:e[e.length-1].length};let d=s,_=0;for(const o of e){if(d<o.length)break;d-=o.length,_++}return{line:_,character:d}}function n(s,d){let _=0;for(let o=0;o<s;o++)_+=e[o].length;return _+=d,_}return{lines:e,indexToPos:r,posToIndex:n}}const El="light-dark()",jm=["color","background-color"];function Hm(t,e){let r=0;const n=[];for(const s of e)s>r&&n.push({...t,content:t.content.slice(r,s),offset:t.offset+r}),r=s;return r<t.content.length&&n.push({...t,content:t.content.slice(r),offset:t.offset+r}),n}function Fm(t,e){const r=Array.from(e instanceof Set?e:new Set(e)).sort((n,s)=>n-s);return r.length?t.map(n=>n.flatMap(s=>{const d=r.filter(_=>s.offset<_&&_<s.offset+s.content.length).map(_=>_-s.offset).sort((_,o)=>_-o);return d.length?Hm(s,d):s})):t}function Um(t,e,r,n,s="css-vars"){const d={content:t.content,explanation:t.explanation,offset:t.offset},_=e.map(g=>Ao(t.variants[g])),o=new Set(_.flatMap(g=>Object.keys(g))),a={},c=(g,h)=>{const v=h==="color"?"":h==="background-color"?"-bg":`-${h}`;return r+e[g]+(h==="color"?"":v)};return _.forEach((g,h)=>{for(const v of o){const m=g[v]||"inherit";if(h===0&&n&&jm.includes(v))if(n===El&&_.length>1){const w=e.findIndex(l=>l==="light"),b=e.findIndex(l=>l==="dark");if(w===-1||b===-1)throw new Ar('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const f=_[w][v]||"inherit",u=_[b][v]||"inherit";a[v]=`light-dark(${f}, ${u})`,s==="css-vars"&&(a[c(h,v)]=m)}else a[v]=m;else s==="css-vars"&&(a[c(h,v)]=m)}}),d.htmlStyle=a,d}function Ao(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&Yr.Italic&&(e["font-style"]="italic"),t.fontStyle&Yr.Bold&&(e["font-weight"]="bold");const r=[];t.fontStyle&Yr.Underline&&r.push("underline"),t.fontStyle&Yr.Strikethrough&&r.push("line-through"),r.length&&(e["text-decoration"]=r.join(" "))}return e}function qa(t){return typeof t=="string"?t:Object.entries(t).map(([e,r])=>`${e}:${r}`).join(";")}const zu=new WeakMap;function Wo(t,e){zu.set(t,e)}function Bs(t){return zu.get(t)}class ls{constructor(...e){Ee(this,"_stacks",{});Ee(this,"lang");if(e.length===2){const[r,n]=e;this.lang=n,this._stacks=r}else{const[r,n,s]=e;this.lang=n,this._stacks={[s]:r}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,r){return new ls(Object.fromEntries(Bm(r).map(n=>[n,Fa])),e)}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Vm(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Vm(t){const e=[],r=new Set;function n(s){var _;if(r.has(s))return;r.add(s);const d=(_=s==null?void 0:s.nameScopesList)==null?void 0:_.scopeName;d&&e.push(d),s.parent&&n(s.parent)}return n(t),e}function zm(t,e){if(!(t instanceof ls))throw new Ar("Invalid grammar state");return t.getInternalStack(e)}function Wm(){const t=new WeakMap;function e(r){if(!t.has(r.meta)){let n=function(_){if(typeof _=="number"){if(_<0||_>r.source.length)throw new Ar(`Invalid decoration offset: ${_}. Code length: ${r.source.length}`);return{...s.indexToPos(_),offset:_}}else{const o=s.lines[_.line];if(o===void 0)throw new Ar(`Invalid decoration position ${JSON.stringify(_)}. Lines length: ${s.lines.length}`);let a=_.character;if(a<0&&(a=o.length+a),a<0||a>o.length)throw new Ar(`Invalid decoration position ${JSON.stringify(_)}. Line ${_.line} length: ${o.length}`);return{..._,character:a,offset:s.posToIndex(_.line,a)}}};const s=Nm(r.source),d=(r.options.decorations||[]).map(_=>({..._,start:n(_.start),end:n(_.end)}));qm(d),t.set(r.meta,{decorations:d,converter:s,source:r.source})}return t.get(r.meta)}return{name:"shiki:decorations",tokens(r){var _;if(!((_=this.options.decorations)!=null&&_.length))return;const s=e(this).decorations.flatMap(o=>[o.start.offset,o.end.offset]);return Fm(r,s)},code(r){var g;if(!((g=this.options.decorations)!=null&&g.length))return;const n=e(this),s=Array.from(r.children).filter(h=>h.type==="element"&&h.tagName==="span");if(s.length!==n.converter.lines.length)throw new Ar(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function d(h,v,m,w){const b=s[h];let f="",u=-1,l=-1;if(v===0&&(u=0),m===0&&(l=0),m===Number.POSITIVE_INFINITY&&(l=b.children.length),u===-1||l===-1)for(let y=0;y<b.children.length;y++)f+=Wu(b.children[y]),u===-1&&f.length===v&&(u=y+1),l===-1&&f.length===m&&(l=y+1);if(u===-1)throw new Ar(`Failed to find start index for decoration ${JSON.stringify(w.start)}`);if(l===-1)throw new Ar(`Failed to find end index for decoration ${JSON.stringify(w.end)}`);const p=b.children.slice(u,l);if(!w.alwaysWrap&&p.length===b.children.length)o(b,w,"line");else if(!w.alwaysWrap&&p.length===1&&p[0].type==="element")o(p[0],w,"token");else{const y={type:"element",tagName:"span",properties:{},children:p};o(y,w,"wrapper"),b.children.splice(u,p.length,y)}}function _(h,v){s[h]=o(s[h],v,"line")}function o(h,v,m){var f;const w=v.properties||{},b=v.transform||(u=>u);return h.tagName=v.tagName||"span",h.properties={...h.properties,...w,class:h.properties.class},(f=v.properties)!=null&&f.class&&Vu(h,v.properties.class),h=b(h,m)||h,h}const a=[],c=n.decorations.sort((h,v)=>v.start.offset-h.start.offset||h.end.offset-v.end.offset);for(const h of c){const{start:v,end:m}=h;if(v.line===m.line)d(v.line,v.character,m.character,h);else if(v.line<m.line){d(v.line,v.character,Number.POSITIVE_INFINITY,h);for(let w=v.line+1;w<m.line;w++)a.unshift(()=>_(w,h));d(m.line,0,m.character,h)}}a.forEach(h=>h())}}}function qm(t){for(let e=0;e<t.length;e++){const r=t[e];if(r.start.offset>r.end.offset)throw new Ar(`Invalid decoration range: ${JSON.stringify(r.start)} - ${JSON.stringify(r.end)}`);for(let n=e+1;n<t.length;n++){const s=t[n],d=r.start.offset<=s.start.offset&&s.start.offset<r.end.offset,_=r.start.offset<s.end.offset&&s.end.offset<=r.end.offset,o=s.start.offset<=r.start.offset&&r.start.offset<s.end.offset,a=s.start.offset<r.end.offset&&r.end.offset<=s.end.offset;if(d||_||o||a){if(d&&_||o&&a||o&&r.start.offset===r.end.offset||_&&s.start.offset===s.end.offset)continue;throw new Ar(`Decorations ${JSON.stringify(r.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Wu(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(Wu).join(""):""}const Gm=[Wm()];function To(t){const e=Km(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...Gm]}function Km(t){const e=[],r=[],n=[];for(const s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":r.push(s);break;default:n.push(s)}return{pre:e,post:r,normal:n}}var bn=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],ua={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Xm(t,e){const r=t.indexOf("\x1B",e);if(r!==-1&&t[r+1]==="["){const n=t.indexOf("m",r);if(n!==-1)return{sequence:t.substring(r+2,n).split(";"),startPosition:r,position:n+1}}return{position:t.length}}function Pc(t){const e=t.shift();if(e==="2"){const r=t.splice(0,3).map(n=>Number.parseInt(n));return r.length!==3||r.some(n=>Number.isNaN(n))?void 0:{type:"rgb",rgb:r}}else if(e==="5"){const r=t.shift();if(r)return{type:"table",index:Number(r)}}}function Jm(t){const e=[];for(;t.length>0;){const r=t.shift();if(!r)continue;const n=Number.parseInt(r);if(!Number.isNaN(n))if(n===0)e.push({type:"resetAll"});else if(n<=9)ua[n]&&e.push({type:"setDecoration",value:ua[n]});else if(n<=29){const s=ua[n-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(n<=37)e.push({type:"setForegroundColor",value:{type:"named",name:bn[n-30]}});else if(n===38){const s=Pc(t);s&&e.push({type:"setForegroundColor",value:s})}else if(n===39)e.push({type:"resetForegroundColor"});else if(n<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:bn[n-40]}});else if(n===48){const s=Pc(t);s&&e.push({type:"setBackgroundColor",value:s})}else n===49?e.push({type:"resetBackgroundColor"}):n===53?e.push({type:"setDecoration",value:"overline"}):n===55?e.push({type:"resetDecoration",value:"overline"}):n>=90&&n<=97?e.push({type:"setForegroundColor",value:{type:"named",name:bn[n-90+8]}}):n>=100&&n<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:bn[n-100+8]}})}return e}function Ym(){let t=null,e=null,r=new Set;return{parse(n){const s=[];let d=0;do{const _=Xm(n,d),o=_.sequence?n.substring(d,_.startPosition):n.substring(d);if(o.length>0&&s.push({value:o,foreground:t,background:e,decorations:new Set(r)}),_.sequence){const a=Jm(_.sequence);for(const c of a)c.type==="resetAll"?(t=null,e=null,r.clear()):c.type==="resetForegroundColor"?t=null:c.type==="resetBackgroundColor"?e=null:c.type==="resetDecoration"&&r.delete(c.value);for(const c of a)c.type==="setForegroundColor"?t=c.value:c.type==="setBackgroundColor"?e=c.value:c.type==="setDecoration"&&r.add(c.value)}d=_.position}while(d<n.length);return s}}}var Qm={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function Zm(t=Qm){function e(o){return t[o]}function r(o){return`#${o.map(a=>Math.max(0,Math.min(a,255)).toString(16).padStart(2,"0")).join("")}`}let n;function s(){if(n)return n;n=[];for(let c=0;c<bn.length;c++)n.push(e(bn[c]));let o=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let g=0;g<6;g++)for(let h=0;h<6;h++)n.push(r([o[c],o[g],o[h]]));let a=8;for(let c=0;c<24;c++,a+=10)n.push(r([a,a,a]));return n}function d(o){return s()[o]}function _(o){switch(o.type){case"named":return e(o.name);case"rgb":return r(o.rgb);case"table":return d(o.index)}}return{value:_}}const $m={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function e0(t,e,r){const n=Eo(t,r),s=zo(e),d=Object.fromEntries(bn.map(a=>{var h;const c=`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`,g=(h=t.colors)==null?void 0:h[c];return[a,g||$m[a]]})),_=Zm(d),o=Ym();return s.map(a=>o.parse(a[0]).map(c=>{let g,h;c.decorations.has("reverse")?(g=c.background?_.value(c.background):t.bg,h=c.foreground?_.value(c.foreground):t.fg):(g=c.foreground?_.value(c.foreground):t.fg,h=c.background?_.value(c.background):void 0),g=dn(g,n),h=dn(h,n),c.decorations.has("dim")&&(g=t0(g));let v=Yr.None;return c.decorations.has("bold")&&(v|=Yr.Bold),c.decorations.has("italic")&&(v|=Yr.Italic),c.decorations.has("underline")&&(v|=Yr.Underline),c.decorations.has("strikethrough")&&(v|=Yr.Strikethrough),{content:c.value,offset:a[1],color:g,bgColor:h,fontStyle:v}}))}function t0(t){const e=t.match(/#([0-9a-f]{3,8})/i);if(e){const n=e[1];if(n.length===8){const s=Math.round(Number.parseInt(n.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${n.slice(0,6)}${s}`}else{if(n.length===6)return`#${n}80`;if(n.length===4){const s=n[0],d=n[1],_=n[2],o=n[3],a=Math.round(Number.parseInt(`${o}${o}`,16)/2).toString(16).padStart(2,"0");return`#${s}${s}${d}${d}${_}${_}${a}`}else if(n.length===3){const s=n[0],d=n[1],_=n[2];return`#${s}${s}${d}${d}${_}${_}80`}}}const r=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return r?`var(${r[1]}-dim)`:t}function Al(t,e,r={}){const{theme:n=t.getLoadedThemes()[0]}=r,s=t.resolveLangAlias(r.lang||"text");if(Cl(s)||kl(n))return zo(e).map(a=>[{content:a[0],offset:a[1]}]);const{theme:d,colorMap:_}=t.setTheme(n);if(s==="ansi")return e0(d,e,r);const o=t.getLanguage(r.lang||"text");if(r.grammarState){if(r.grammarState.lang!==o.name)throw new Ar(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${o.name}"`);if(!r.grammarState.themes.includes(d.name))throw new Ar(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${d.name}"`)}return i0(e,o,d,_,r)}function r0(...t){if(t.length===2)return Bs(t[1]);const[e,r,n={}]=t,{lang:s="text",theme:d=e.getLoadedThemes()[0]}=n;if(Cl(s)||kl(d))throw new Ar("Plain language does not have grammar state");if(s==="ansi")throw new Ar("ANSI language does not have grammar state");const{theme:_,colorMap:o}=e.setTheme(d),a=e.getLanguage(s);return new ls(Tl(r,a,_,o,n).stateStack,a.name,_.name)}function i0(t,e,r,n,s){const d=Tl(t,e,r,n,s),_=new ls(d.stateStack,e.name,r.name);return Wo(d.tokens,_),d.tokens}function Tl(t,e,r,n,s){const d=Eo(r,s),{tokenizeMaxLineLength:_=0,tokenizeTimeLimit:o=500}=s,a=zo(t);let c=s.grammarState?zm(s.grammarState,r.name)??Fa:s.grammarContextCode!=null?Tl(s.grammarContextCode,e,r,n,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Fa,g=[];const h=[];for(let v=0,m=a.length;v<m;v++){const[w,b]=a[v];if(w===""){g=[],h.push([]);continue}if(_>0&&w.length>=_){g=[],h.push([{content:w,offset:b,color:"",fontStyle:0}]);continue}let f,u,l;s.includeExplanation&&(f=e.tokenizeLine(w,c,o),u=f.tokens,l=0);const p=e.tokenizeLine2(w,c,o),y=p.tokens.length/2;for(let k=0;k<y;k++){const C=p.tokens[2*k],A=k+1<y?p.tokens[2*k+2]:w.length;if(C===A)continue;const S=p.tokens[2*k+1],T=dn(n[ss.getForeground(S)],d),D=ss.getFontStyle(S),H={content:w.substring(C,A),offset:b+C,color:T,fontStyle:D};if(s.includeExplanation){const W=[];if(s.includeExplanation!=="scopeName")for(const G of r.settings){let X;switch(typeof G.scope){case"string":X=G.scope.split(/,/).map(le=>le.trim());break;case"object":X=G.scope;break;default:continue}W.push({settings:G,selectors:X.map(le=>le.split(/ /))})}H.explanation=[];let M=0;for(;C+M<A;){const G=u[l],X=w.substring(G.startIndex,G.endIndex);M+=X.length,H.explanation.push({content:X,scopes:s.includeExplanation==="scopeName"?n0(G.scopes):s0(W,G.scopes)}),l+=1}}g.push(H)}h.push(g),g=[],c=p.ruleStack}return{tokens:h,stateStack:c}}function n0(t){return t.map(e=>({scopeName:e}))}function s0(t,e){const r=[];for(let n=0,s=e.length;n<s;n++){const d=e[n];r[n]={scopeName:d,themeMatches:a0(t,d,e.slice(0,n))}}return r}function Lc(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function o0(t,e,r){if(!Lc(t[t.length-1],e))return!1;let n=t.length-2,s=r.length-1;for(;n>=0&&s>=0;)Lc(t[n],r[s])&&(n-=1),s-=1;return n===-1}function a0(t,e,r){const n=[];for(const{selectors:s,settings:d}of t)for(const _ of s)if(o0(_,e,r)){n.push(d);break}return n}function qu(t,e,r){const n=Object.entries(r.themes).filter(a=>a[1]).map(a=>({color:a[0],theme:a[1]})),s=n.map(a=>{const c=Al(t,e,{...r,theme:a.theme}),g=Bs(c),h=typeof a.theme=="string"?a.theme:a.theme.name;return{tokens:c,state:g,theme:h}}),d=l0(...s.map(a=>a.tokens)),_=d[0].map((a,c)=>a.map((g,h)=>{const v={content:g.content,variants:{},offset:g.offset};return"includeExplanation"in r&&r.includeExplanation&&(v.explanation=g.explanation),d.forEach((m,w)=>{const{content:b,explanation:f,offset:u,...l}=m[c][h];v.variants[n[w].color]=l}),v})),o=s[0].state?new ls(Object.fromEntries(s.map(a=>{var c;return[a.theme,(c=a.state)==null?void 0:c.getInternalStack(a.theme)]})),s[0].state.lang):void 0;return o&&Wo(_,o),_}function l0(...t){const e=t.map(()=>[]),r=t.length;for(let n=0;n<t[0].length;n++){const s=t.map(a=>a[n]),d=e.map(()=>[]);e.forEach((a,c)=>a.push(d[c]));const _=s.map(()=>0),o=s.map(a=>a[0]);for(;o.every(a=>a);){const a=Math.min(...o.map(c=>c.content.length));for(let c=0;c<r;c++){const g=o[c];g.content.length===a?(d[c].push(g),_[c]+=1,o[c]=s[c][_[c]]):(d[c].push({...g,content:g.content.slice(0,a)}),o[c]={...g,content:g.content.slice(a),offset:g.offset+a})}}}return e}function Po(t,e,r){let n,s,d,_,o,a;if("themes"in r){const{defaultColor:c="light",cssVariablePrefix:g="--shiki-",colorsRendering:h="css-vars"}=r,v=Object.entries(r.themes).filter(u=>u[1]).map(u=>({color:u[0],theme:u[1]})).sort((u,l)=>u.color===c?-1:l.color===c?1:0);if(v.length===0)throw new Ar("`themes` option must not be empty");const m=qu(t,e,r);if(a=Bs(m),c&&El!==c&&!v.find(u=>u.color===c))throw new Ar(`\`themes\` option must contain the defaultColor key \`${c}\``);const w=v.map(u=>t.getTheme(u.theme)),b=v.map(u=>u.color);d=m.map(u=>u.map(l=>Um(l,b,g,c,h))),a&&Wo(d,a);const f=v.map(u=>Eo(u.theme,r));s=Rc(v,w,f,g,c,"fg",h),n=Rc(v,w,f,g,c,"bg",h),_=`shiki-themes ${w.map(u=>u.name).join(" ")}`,o=c?void 0:[s,n].join(";")}else if("theme"in r){const c=Eo(r.theme,r);d=Al(t,e,r);const g=t.getTheme(r.theme);n=dn(g.bg,c),s=dn(g.fg,c),_=g.name,a=Bs(d)}else throw new Ar("Invalid options, either `theme` or `themes` must be provided");return{tokens:d,fg:s,bg:n,themeName:_,rootStyle:o,grammarState:a}}function Rc(t,e,r,n,s,d,_){return t.map((o,a)=>{const c=dn(e[a][d],r[a])||"inherit",g=`${n+o.color}${d==="bg"?"-bg":""}:${c}`;if(a===0&&s){if(s===El&&t.length>1){const h=t.findIndex(b=>b.color==="light"),v=t.findIndex(b=>b.color==="dark");if(h===-1||v===-1)throw new Ar('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const m=dn(e[h][d],r[h])||"inherit",w=dn(e[v][d],r[v])||"inherit";return`light-dark(${m}, ${w});${g}`}return c}return _==="css-vars"?g:null}).filter(o=>!!o).join(";")}function Lo(t,e,r,n={meta:{},options:r,codeToHast:(s,d)=>Lo(t,s,d),codeToTokens:(s,d)=>Po(t,s,d)}){var w,b;let s=e;for(const f of To(r))s=((w=f.preprocess)==null?void 0:w.call(n,s,r))||s;let{tokens:d,fg:_,bg:o,themeName:a,rootStyle:c,grammarState:g}=Po(t,s,r);const{mergeWhitespaces:h=!0,mergeSameStyleTokens:v=!1}=r;h===!0?d=d0(d):h==="never"&&(d=u0(d)),v&&(d=h0(d));const m={...n,get source(){return s}};for(const f of To(r))d=((b=f.tokens)==null?void 0:b.call(m,d))||d;return c0(d,{...r,fg:_,bg:o,themeName:a,rootStyle:r.rootStyle===!1?!1:r.rootStyle??c},m,g)}function c0(t,e,r,n=Bs(t)){var b,f,u,l;const s=To(e),d=[],_={type:"root",children:[]},{structure:o="classic",tabindex:a="0"}=e,c={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?c.style=e.rootStyle:c.style=`background-color:${e.bg};color:${e.fg}`),a!==!1&&a!=null&&(c.tabindex=a.toString());for(const[p,y]of Object.entries(e.meta||{}))p.startsWith("_")||(c[p]=y);let g={type:"element",tagName:"pre",properties:c,children:[],data:e.data},h={type:"element",tagName:"code",properties:{},children:d};const v=[],m={...r,structure:o,addClassToHast:Vu,get source(){return r.source},get tokens(){return t},get options(){return e},get root(){return _},get pre(){return g},get code(){return h},get lines(){return v}};if(t.forEach((p,y)=>{var A,S;y&&(o==="inline"?_.children.push({type:"element",tagName:"br",properties:{},children:[]}):o==="classic"&&d.push({type:"text",value:`
177
+ `}));let k={type:"element",tagName:"span",properties:{class:"line"},children:[]},C=0;for(const T of p){let D={type:"element",tagName:"span",properties:{...T.htmlAttrs},children:[{type:"text",value:T.content}]};const H=qa(T.htmlStyle||Ao(T));H&&(D.properties.style=H);for(const W of s)D=((A=W==null?void 0:W.span)==null?void 0:A.call(m,D,y+1,C,k,T))||D;o==="inline"?_.children.push(D):o==="classic"&&k.children.push(D),C+=T.content.length}if(o==="classic"){for(const T of s)k=((S=T==null?void 0:T.line)==null?void 0:S.call(m,k,y+1))||k;v.push(k),d.push(k)}else o==="inline"&&v.push(k)}),o==="classic"){for(const p of s)h=((b=p==null?void 0:p.code)==null?void 0:b.call(m,h))||h;g.children.push(h);for(const p of s)g=((f=p==null?void 0:p.pre)==null?void 0:f.call(m,g))||g;_.children.push(g)}else if(o==="inline"){const p=[];let y={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const A of _.children)A.type==="element"&&A.tagName==="br"?(p.push(y),y={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(A.type==="element"||A.type==="text")&&y.children.push(A);p.push(y);let C={type:"element",tagName:"code",properties:{},children:p};for(const A of s)C=((u=A==null?void 0:A.code)==null?void 0:u.call(m,C))||C;_.children=[];for(let A=0;A<C.children.length;A++){A>0&&_.children.push({type:"element",tagName:"br",properties:{},children:[]});const S=C.children[A];S.type==="element"&&_.children.push(...S.children)}}let w=_;for(const p of s)w=((l=p==null?void 0:p.root)==null?void 0:l.call(m,w))||w;return n&&Wo(w,n),w}function d0(t){return t.map(e=>{const r=[];let n="",s;return e.forEach((d,_)=>{const a=!(d.fontStyle&&(d.fontStyle&Yr.Underline||d.fontStyle&Yr.Strikethrough));a&&d.content.match(/^\s+$/)&&e[_+1]?(s===void 0&&(s=d.offset),n+=d.content):n?(a?r.push({...d,offset:s,content:n+d.content}):r.push({content:n,offset:s},d),s=void 0,n=""):r.push(d)}),r})}function u0(t){return t.map(e=>e.flatMap(r=>{if(r.content.match(/^\s+$/))return r;const n=r.content.match(/^(\s*)(.*?)(\s*)$/);if(!n)return r;const[,s,d,_]=n;if(!s&&!_)return r;const o=[{...r,offset:r.offset+s.length,content:d}];return s&&o.unshift({content:s,offset:r.offset}),_&&o.push({content:_,offset:r.offset+s.length+d.length}),o}))}function h0(t){return t.map(e=>{const r=[];for(const n of e){if(r.length===0){r.push({...n});continue}const s=r[r.length-1],d=qa(s.htmlStyle||Ao(s)),_=qa(n.htmlStyle||Ao(n)),o=s.fontStyle&&(s.fontStyle&Yr.Underline||s.fontStyle&Yr.Strikethrough),a=n.fontStyle&&(n.fontStyle&Yr.Underline||n.fontStyle&Yr.Strikethrough);!o&&!a&&d===_?s.content+=n.content:r.push({...n})}return r})}const f0=Dm;function p0(t,e,r){var d;const n={meta:{},options:r,codeToHast:(_,o)=>Lo(t,_,o),codeToTokens:(_,o)=>Po(t,_,o)};let s=f0(Lo(t,e,r,n));for(const _ of To(r))s=((d=_.postprocess)==null?void 0:d.call(n,s,r))||s;return s}const Ic={light:"#333333",dark:"#bbbbbb"},Dc={light:"#fffffe",dark:"#1e1e1e"},Mc="__shiki_resolved";function Pl(t){var o,a,c,g,h;if(t!=null&&t[Mc])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||(e.type="dark"),e.colorReplacements={...e.colorReplacements},e.settings||(e.settings=[]);let{bg:r,fg:n}=e;if(!r||!n){const v=e.settings?e.settings.find(m=>!m.name&&!m.scope):void 0;(o=v==null?void 0:v.settings)!=null&&o.foreground&&(n=v.settings.foreground),(a=v==null?void 0:v.settings)!=null&&a.background&&(r=v.settings.background),!n&&((c=e==null?void 0:e.colors)!=null&&c["editor.foreground"])&&(n=e.colors["editor.foreground"]),!r&&((g=e==null?void 0:e.colors)!=null&&g["editor.background"])&&(r=e.colors["editor.background"]),n||(n=e.type==="light"?Ic.light:Ic.dark),r||(r=e.type==="light"?Dc.light:Dc.dark),e.fg=n,e.bg=r}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const d=new Map;function _(v){var w;if(d.has(v))return d.get(v);s+=1;const m=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return(w=e.colorReplacements)!=null&&w[`#${m}`]?_(v):(d.set(v,m),m)}e.settings=e.settings.map(v=>{var f,u;const m=((f=v.settings)==null?void 0:f.foreground)&&!v.settings.foreground.startsWith("#"),w=((u=v.settings)==null?void 0:u.background)&&!v.settings.background.startsWith("#");if(!m&&!w)return v;const b={...v,settings:{...v.settings}};if(m){const l=_(v.settings.foreground);e.colorReplacements[l]=v.settings.foreground,b.settings.foreground=l}if(w){const l=_(v.settings.background);e.colorReplacements[l]=v.settings.background,b.settings.background=l}return b});for(const v of Object.keys(e.colors||{}))if((v==="editor.foreground"||v==="editor.background"||v.startsWith("terminal.ansi"))&&!((h=e.colors[v])!=null&&h.startsWith("#"))){const m=_(e.colors[v]);e.colorReplacements[m]=e.colors[v],e.colors[v]=m}return Object.defineProperty(e,Mc,{enumerable:!1,writable:!1,value:!0}),e}async function Gu(t){return Array.from(new Set((await Promise.all(t.filter(e=>!Fu(e)).map(async e=>await Hu(e).then(r=>Array.isArray(r)?r:[r])))).flat()))}async function Ku(t){return(await Promise.all(t.map(async r=>Uu(r)?null:Pl(await Hu(r))))).filter(r=>!!r)}let _0=3;function v0(t,e=3){e>_0||console.trace(`[SHIKI DEPRECATE]: ${t}`)}let zn=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Xu(t,e){if(!e)return t;if(e[t]){const r=new Set([t]);for(;e[t];){if(t=e[t],r.has(t))throw new zn(`Circular alias \`${Array.from(r).join(" -> ")} -> ${t}\``);r.add(t)}}return t}class g0 extends bg{constructor(r,n,s,d={}){super(r);Ee(this,"_resolvedThemes",new Map);Ee(this,"_resolvedGrammars",new Map);Ee(this,"_langMap",new Map);Ee(this,"_langGraph",new Map);Ee(this,"_textmateThemeCache",new WeakMap);Ee(this,"_loadedThemesCache",null);Ee(this,"_loadedLanguagesCache",null);this._resolver=r,this._themes=n,this._langs=s,this._alias=d,this._themes.map(_=>this.loadTheme(_)),this.loadLanguages(this._langs)}getTheme(r){return typeof r=="string"?this._resolvedThemes.get(r):this.loadTheme(r)}loadTheme(r){const n=Pl(r);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(r){let n=this._textmateThemeCache.get(r);n||(n=xo.createFromRawTheme(r),this._textmateThemeCache.set(r,n)),this._syncRegistry.setTheme(n)}getGrammar(r){return r=Xu(r,this._alias),this._resolvedGrammars.get(r)}loadLanguage(r){var _,o,a,c;if(this.getGrammar(r.name))return;const n=new Set([...this._langMap.values()].filter(g=>{var h;return(h=g.embeddedLangsLazy)==null?void 0:h.includes(r.name)}));this._resolver.addLanguage(r);const s={balancedBracketSelectors:r.balancedBracketSelectors||["*"],unbalancedBracketSelectors:r.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(r.scopeName,r);const d=this.loadGrammarWithConfiguration(r.scopeName,1,s);if(d.name=r.name,this._resolvedGrammars.set(r.name,d),r.aliases&&r.aliases.forEach(g=>{this._alias[g]=r.name}),this._loadedLanguagesCache=null,n.size)for(const g of n)this._resolvedGrammars.delete(g.name),this._loadedLanguagesCache=null,(o=(_=this._syncRegistry)==null?void 0:_._injectionGrammars)==null||o.delete(g.scopeName),(c=(a=this._syncRegistry)==null?void 0:a._grammars)==null||c.delete(g.scopeName),this.loadLanguage(this._langMap.get(g.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(r){for(const d of r)this.resolveEmbeddedLanguages(d);const n=Array.from(this._langGraph.entries()),s=n.filter(([d,_])=>!_);if(s.length){const d=n.filter(([_,o])=>{if(!o)return!1;const a=o.embeddedLanguages||o.embeddedLangs;return a==null?void 0:a.some(c=>s.map(([g])=>g).includes(c))}).filter(_=>!s.includes(_));throw new zn(`Missing languages ${s.map(([_])=>`\`${_}\``).join(", ")}, required by ${d.map(([_])=>`\`${_}\``).join(", ")}`)}for(const[d,_]of n)this._resolver.addLanguage(_);for(const[d,_]of n)this.loadLanguage(_)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(r){this._langMap.set(r.name,r),this._langGraph.set(r.name,r);const n=r.embeddedLanguages??r.embeddedLangs;if(n)for(const s of n)this._langGraph.set(s,this._langMap.get(s))}}class m0{constructor(e,r){Ee(this,"_langs",new Map);Ee(this,"_scopeToLang",new Map);Ee(this,"_injections",new Map);Ee(this,"_onigLib");this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},r.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(r=>{this._langs.set(r,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(r=>{this._injections.get(r)||this._injections.set(r,[]),this._injections.get(r).push(e.scopeName)})}getInjections(e){const r=e.split(".");let n=[];for(let s=1;s<=r.length;s++){const d=r.slice(0,s).join(".");n=[...n,...this._injections.get(d)||[]]}return n}}let us=0;function b0(t){us+=1,t.warnings!==!1&&us>=10&&us%10===0&&console.warn(`[Shiki] ${us} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new zn("`engine` option is required for synchronous mode");const r=(t.langs||[]).flat(1),n=(t.themes||[]).flat(1).map(Pl),s=new m0(t.engine,r),d=new g0(s,n,r,t.langAlias);let _;function o(p){return Xu(p,t.langAlias)}function a(p){u();const y=d.getGrammar(typeof p=="string"?p:p.name);if(!y)throw new zn(`Language \`${p}\` not found, you may need to load it first`);return y}function c(p){if(p==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();const y=d.getTheme(p);if(!y)throw new zn(`Theme \`${p}\` not found, you may need to load it first`);return y}function g(p){u();const y=c(p);_!==p&&(d.setTheme(y),_=p);const k=d.getColorMap();return{theme:y,colorMap:k}}function h(){return u(),d.getLoadedThemes()}function v(){return u(),d.getLoadedLanguages()}function m(...p){u(),d.loadLanguages(p.flat(1))}async function w(...p){return m(await Gu(p))}function b(...p){u();for(const y of p.flat(1))d.loadTheme(y)}async function f(...p){return u(),b(await Ku(p))}function u(){if(e)throw new zn("Shiki instance has been disposed")}function l(){e||(e=!0,d.dispose(),us-=1)}return{setTheme:g,getTheme:c,getLanguage:a,getLoadedThemes:h,getLoadedLanguages:v,resolveLangAlias:o,loadLanguage:w,loadLanguageSync:m,loadTheme:f,loadThemeSync:b,dispose:l,[Symbol.dispose]:l}}async function y0(t){t.engine||v0("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,r,n]=await Promise.all([Ku(t.themes||[]),Gu(t.langs||[]),t.engine]);return b0({...t,themes:e,langs:r,engine:n})}async function x0(t){const e=await y0(t);return{getLastGrammarState:(...r)=>r0(e,...r),codeToTokensBase:(r,n)=>Al(e,r,n),codeToTokensWithThemes:(r,n)=>qu(e,r,n),codeToTokens:(r,n)=>Po(e,r,n),codeToHast:(r,n)=>Lo(e,r,n),codeToHtml:(r,n)=>p0(e,r,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function w0(t){const e=t.langs,r=t.themes,n=t.engine;async function s(d){function _(h){var v;if(typeof h=="string"){if(h=((v=d.langAlias)==null?void 0:v[h])||h,Fu(h))return[];const m=e[h];if(!m)throw new Ar(`Language \`${h}\` is not included in this bundle. You may want to load it from external source.`);return m}return h}function o(h){if(Uu(h))return"none";if(typeof h=="string"){const v=r[h];if(!v)throw new Ar(`Theme \`${h}\` is not included in this bundle. You may want to load it from external source.`);return v}return h}const a=(d.themes??[]).map(h=>o(h)),c=(d.langs??[]).map(h=>_(h)),g=await x0({engine:d.engine??n(),...d,themes:a,langs:c});return{...g,loadLanguage(...h){return g.loadLanguage(...h.map(_))},loadTheme(...h){return g.loadTheme(...h.map(o))},getBundledLanguages(){return e},getBundledThemes(){return r}}}return s}const Ju=[{id:"abap",name:"ABAP",import:(()=>K(()=>import("./abap-BdImnpbu.js"),[]))},{id:"actionscript-3",name:"ActionScript",import:(()=>K(()=>import("./actionscript-3-CoDkCxhg.js"),[]))},{id:"ada",name:"Ada",import:(()=>K(()=>import("./ada-bCR0ucgS.js"),[]))},{id:"angular-html",name:"Angular HTML",import:(()=>K(()=>import("./angular-html-CU67Zn6k.js").then(t=>t.f),__vite__mapDeps([0,1,2,3])))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>K(()=>import("./angular-ts-BwZT4LLn.js"),__vite__mapDeps([4,0,1,2,3,5])))},{id:"apache",name:"Apache Conf",import:(()=>K(()=>import("./apache-Pmp26Uib.js"),[]))},{id:"apex",name:"Apex",import:(()=>K(()=>import("./apex-D8_7TLub.js"),[]))},{id:"apl",name:"APL",import:(()=>K(()=>import("./apl-dKokRX4l.js"),__vite__mapDeps([6,1,2,3,7,8,9])))},{id:"applescript",name:"AppleScript",import:(()=>K(()=>import("./applescript-Co6uUVPk.js"),[]))},{id:"ara",name:"Ara",import:(()=>K(()=>import("./ara-BRHolxvo.js"),[]))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>K(()=>import("./asciidoc-Dv7Oe6Be.js"),[]))},{id:"asm",name:"Assembly",import:(()=>K(()=>import("./asm-D_Q5rh1f.js"),[]))},{id:"astro",name:"Astro",import:(()=>K(()=>import("./astro-CbQHKStN.js"),__vite__mapDeps([10,9,2,11,3,12,13])))},{id:"awk",name:"AWK",import:(()=>K(()=>import("./awk-DMzUqQB5.js"),[]))},{id:"ballerina",name:"Ballerina",import:(()=>K(()=>import("./ballerina-BFfxhgS-.js"),[]))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>K(()=>import("./bat-BkioyH1T.js"),[]))},{id:"beancount",name:"Beancount",import:(()=>K(()=>import("./beancount-k_qm7-4y.js"),[]))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>K(()=>import("./berry-uYugtg8r.js"),[]))},{id:"bibtex",name:"BibTeX",import:(()=>K(()=>import("./bibtex-CHM0blh-.js"),[]))},{id:"bicep",name:"Bicep",import:(()=>K(()=>import("./bicep-Bmn6On1c.js"),[]))},{id:"blade",name:"Blade",import:(()=>K(()=>import("./blade-D4QpJJKB.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9])))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>K(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18])))},{id:"c",name:"C",import:(()=>K(()=>import("./c-BIGW1oBm.js"),[]))},{id:"c3",name:"C3",import:(()=>K(()=>import("./c3-VCDPK7BO.js"),[]))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>K(()=>import("./cadence-Bv_4Rxtq.js"),[]))},{id:"cairo",name:"Cairo",import:(()=>K(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20])))},{id:"clarity",name:"Clarity",import:(()=>K(()=>import("./clarity-D53aC0YG.js"),[]))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>K(()=>import("./clojure-P80f7IUj.js"),[]))},{id:"cmake",name:"CMake",import:(()=>K(()=>import("./cmake-D1j8_8rp.js"),[]))},{id:"cobol",name:"COBOL",import:(()=>K(()=>import("./cobol-nwyudZeR.js"),__vite__mapDeps([21,1,2,3,8])))},{id:"codeowners",name:"CODEOWNERS",import:(()=>K(()=>import("./codeowners-Bp6g37R7.js"),[]))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>K(()=>import("./codeql-DsOJ9woJ.js"),[]))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>K(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2])))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>K(()=>import("./common-lisp-Cg-RD9OK.js"),[]))},{id:"coq",name:"Coq",import:(()=>K(()=>import("./coq-DkFqJrB1.js"),[]))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>K(()=>import("./cpp-CofmeUqb.js"),__vite__mapDeps([23,24,25,26,16])))},{id:"crystal",name:"Crystal",import:(()=>K(()=>import("./crystal-tKQVLTB8.js"),__vite__mapDeps([27,1,2,3,16,26,28])))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>K(()=>import("./csharp-COcwbKMJ.js"),[]))},{id:"css",name:"CSS",import:(()=>K(()=>import("./css-DPfMkruS.js"),[]))},{id:"csv",name:"CSV",import:(()=>K(()=>import("./csv-fuZLfV_i.js"),[]))},{id:"cue",name:"CUE",import:(()=>K(()=>import("./cue-D82EKSYY.js"),[]))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>K(()=>import("./cypher-COkxafJQ.js"),[]))},{id:"d",name:"D",import:(()=>K(()=>import("./d-85-TOEBH.js"),[]))},{id:"dart",name:"Dart",import:(()=>K(()=>import("./dart-CF10PKvl.js"),[]))},{id:"dax",name:"DAX",import:(()=>K(()=>import("./dax-CEL-wOlO.js"),[]))},{id:"desktop",name:"Desktop",import:(()=>K(()=>import("./desktop-BmXAJ9_W.js"),[]))},{id:"diff",name:"Diff",import:(()=>K(()=>import("./diff-D97Zzqfu.js"),[]))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>K(()=>import("./docker-BcOcwvcX.js"),[]))},{id:"dotenv",name:"dotEnv",import:(()=>K(()=>import("./dotenv-Da5cRb03.js"),[]))},{id:"dream-maker",name:"Dream Maker",import:(()=>K(()=>import("./dream-maker-BtqSS_iP.js"),[]))},{id:"edge",name:"Edge",import:(()=>K(()=>import("./edge-BkV0erSs.js"),__vite__mapDeps([29,11,1,2,3,15])))},{id:"elixir",name:"Elixir",import:(()=>K(()=>import("./elixir-CDX3lj18.js"),__vite__mapDeps([30,1,2,3])))},{id:"elm",name:"Elm",import:(()=>K(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26])))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>K(()=>import("./emacs-lisp-C9XAeP06.js"),[]))},{id:"erb",name:"ERB",import:(()=>K(()=>import("./erb-CgJxNhIT.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>K(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40])))},{id:"fennel",name:"Fennel",import:(()=>K(()=>import("./fennel-BYunw83y.js"),[]))},{id:"fish",name:"Fish",import:(()=>K(()=>import("./fish-BvzEVeQv.js"),[]))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>K(()=>import("./fluent-C4IJs8-o.js"),[]))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>K(()=>import("./fortran-fixed-form-CkoXwp7k.js"),__vite__mapDeps([41,42])))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>K(()=>import("./fortran-free-form-BxgE0vQu.js"),[]))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>K(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40])))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>K(()=>import("./gdresource-BOOCDP_w.js"),__vite__mapDeps([44,45,46])))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>K(()=>import("./gdscript-C5YyOfLZ.js"),[]))},{id:"gdshader",name:"GDShader",import:(()=>K(()=>import("./gdshader-DkwncUOv.js"),[]))},{id:"genie",name:"Genie",import:(()=>K(()=>import("./genie-D0YGMca9.js"),[]))},{id:"gherkin",name:"Gherkin",import:(()=>K(()=>import("./gherkin-DyxjwDmM.js"),[]))},{id:"git-commit",name:"Git Commit Message",import:(()=>K(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48])))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>K(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28])))},{id:"gleam",name:"Gleam",import:(()=>K(()=>import("./gleam-BspZqrRM.js"),[]))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>K(()=>import("./glimmer-js-Rg0-pVw9.js"),__vite__mapDeps([50,2,11,3,1])))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>K(()=>import("./glimmer-ts-U6CK756n.js"),__vite__mapDeps([51,11,3,2,1])))},{id:"glsl",name:"GLSL",import:(()=>K(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26])))},{id:"gn",name:"GN",import:(()=>K(()=>import("./gn-n2N0HUVH.js"),[]))},{id:"gnuplot",name:"Gnuplot",import:(()=>K(()=>import("./gnuplot-DdkO51Og.js"),[]))},{id:"go",name:"Go",import:(()=>K(()=>import("./go-CxLEBnE3.js"),[]))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>K(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13])))},{id:"groovy",name:"Groovy",import:(()=>K(()=>import("./groovy-gcz8RCvz.js"),[]))},{id:"hack",name:"Hack",import:(()=>K(()=>import("./hack-CaT9iCJl.js"),__vite__mapDeps([52,1,2,3,16])))},{id:"haml",name:"Ruby Haml",import:(()=>K(()=>import("./haml-B8DHNrY2.js"),__vite__mapDeps([34,2,3])))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>K(()=>import("./handlebars-BL8al0AC.js"),__vite__mapDeps([53,1,2,3,38])))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>K(()=>import("./haskell-Df6bDoY_.js"),[]))},{id:"haxe",name:"Haxe",import:(()=>K(()=>import("./haxe-CzTSHFRz.js"),[]))},{id:"hcl",name:"HashiCorp HCL",import:(()=>K(()=>import("./hcl-BWvSN4gD.js"),[]))},{id:"hjson",name:"Hjson",import:(()=>K(()=>import("./hjson-D5-asLiD.js"),[]))},{id:"hlsl",name:"HLSL",import:(()=>K(()=>import("./hlsl-D3lLCCz7.js"),[]))},{id:"html",name:"HTML",import:(()=>K(()=>import("./html-GMplVEZG.js"),__vite__mapDeps([1,2,3])))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>K(()=>import("./html-derivative-BFtXZ54Q.js"),__vite__mapDeps([15,1,2,3])))},{id:"http",name:"HTTP",import:(()=>K(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13])))},{id:"hurl",name:"Hurl",import:(()=>K(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56])))},{id:"hxml",name:"HXML",import:(()=>K(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58])))},{id:"hy",name:"Hy",import:(()=>K(()=>import("./hy-DFXneXwc.js"),[]))},{id:"imba",name:"Imba",import:(()=>K(()=>import("./imba-DGztddWO.js"),[]))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>K(()=>import("./ini-BEwlwnbL.js"),[]))},{id:"java",name:"Java",import:(()=>K(()=>import("./java-CylS5w8V.js"),[]))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>K(()=>import("./javascript-wDzz0qaB.js"),[]))},{id:"jinja",name:"Jinja",import:(()=>K(()=>import("./jinja-4LBKfQ-Z.js"),__vite__mapDeps([59,1,2,3])))},{id:"jison",name:"Jison",import:(()=>K(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2])))},{id:"json",name:"JSON",import:(()=>K(()=>import("./json-Cp-IABpG.js"),[]))},{id:"json5",name:"JSON5",import:(()=>K(()=>import("./json5-C9tS-k6U.js"),[]))},{id:"jsonc",name:"JSON with Comments",import:(()=>K(()=>import("./jsonc-Des-eS-w.js"),[]))},{id:"jsonl",name:"JSON Lines",import:(()=>K(()=>import("./jsonl-DcaNXYhu.js"),[]))},{id:"jsonnet",name:"Jsonnet",import:(()=>K(()=>import("./jsonnet-DFQXde-d.js"),[]))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>K(()=>import("./jssm-C2t-YnRu.js"),[]))},{id:"jsx",name:"JSX",import:(()=>K(()=>import("./jsx-g9-lgVsj.js"),[]))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>K(()=>import("./julia-CxzCAyBv.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62])))},{id:"kdl",name:"KDL",import:(()=>K(()=>import("./kdl-DV7GczEv.js"),[]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>K(()=>import("./kotlin-BdnUsdx6.js"),[]))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>K(()=>import("./kusto-DZf3V79B.js"),[]))},{id:"latex",name:"LaTeX",import:(()=>K(()=>import("./latex-DGMBWnxU.js"),__vite__mapDeps([63,64,62])))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>K(()=>import("./lean-BZvkOJ9d.js"),[]))},{id:"less",name:"Less",import:(()=>K(()=>import("./less-B1dDrJ26.js"),[]))},{id:"liquid",name:"Liquid",import:(()=>K(()=>import("./liquid-DYVedYrR.js"),__vite__mapDeps([65,1,2,3,9])))},{id:"llvm",name:"LLVM IR",import:(()=>K(()=>import("./llvm-BtvRca6l.js"),[]))},{id:"log",name:"Log file",import:(()=>K(()=>import("./log-2UxHyX5q.js"),[]))},{id:"logo",name:"Logo",import:(()=>K(()=>import("./logo-BtOb2qkB.js"),[]))},{id:"lua",name:"Lua",import:(()=>K(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([37,26])))},{id:"luau",name:"Luau",import:(()=>K(()=>import("./luau-C-HG3fhB.js"),[]))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>K(()=>import("./make-CHLpvVh8.js"),[]))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>K(()=>import("./markdown-Cvjx9yec.js"),[]))},{id:"marko",name:"Marko",import:(()=>K(()=>import("./marko-DZsq8hO1.js"),__vite__mapDeps([66,3,67,5,11])))},{id:"matlab",name:"MATLAB",import:(()=>K(()=>import("./matlab-D7o27uSR.js"),[]))},{id:"mdc",name:"MDC",import:(()=>K(()=>import("./mdc-DUICxH0z.js"),__vite__mapDeps([68,40,38,15,1,2,3])))},{id:"mdx",name:"MDX",import:(()=>K(()=>import("./mdx-Cmh6b_Ma.js"),[]))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>K(()=>import("./mermaid-mWjccvbQ.js"),[]))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>K(()=>import("./mipsasm-CKIfxQSi.js"),[]))},{id:"mojo",name:"Mojo",import:(()=>K(()=>import("./mojo-B93PlW-d.js"),[]))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>K(()=>import("./moonbit-Ba13S78F.js"),[]))},{id:"move",name:"Move",import:(()=>K(()=>import("./move-IF9eRakj.js"),[]))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>K(()=>import("./narrat-DRg8JJMk.js"),[]))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>K(()=>import("./nextflow-BrzmwbiE.js"),[]))},{id:"nginx",name:"Nginx",import:(()=>K(()=>import("./nginx-BpAMiNFr.js"),__vite__mapDeps([69,37,26])))},{id:"nim",name:"Nim",import:(()=>K(()=>import("./nim-CVrawwO9.js"),__vite__mapDeps([70,26,1,2,3,7,8,25,40])))},{id:"nix",name:"Nix",import:(()=>K(()=>import("./nix-CwoSXNpI.js"),[]))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>K(()=>import("./nushell-C-sUppwS.js"),[]))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>K(()=>import("./objective-c-DXmwc3jG.js"),[]))},{id:"objective-cpp",name:"Objective-C++",import:(()=>K(()=>import("./objective-cpp-CLxacb5B.js"),[]))},{id:"ocaml",name:"OCaml",import:(()=>K(()=>import("./ocaml-C0hk2d4L.js"),[]))},{id:"odin",name:"Odin",import:(()=>K(()=>import("./odin-BBf5iR-q.js"),[]))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>K(()=>import("./openscad-C4EeE6gA.js"),[]))},{id:"pascal",name:"Pascal",import:(()=>K(()=>import("./pascal-D93ZcfNL.js"),[]))},{id:"perl",name:"Perl",import:(()=>K(()=>import("./perl-C0TMdlhV.js"),__vite__mapDeps([71,1,2,3,7,8,16])))},{id:"php",name:"PHP",import:(()=>K(()=>import("./php-Dhbhpdrm.js"),__vite__mapDeps([72,1,2,3,7,8,16,9])))},{id:"pkl",name:"Pkl",import:(()=>K(()=>import("./pkl-u5AG7uiY.js"),[]))},{id:"plsql",name:"PL/SQL",import:(()=>K(()=>import("./plsql-ChMvpjG-.js"),[]))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>K(()=>import("./po-BTJTHyun.js"),[]))},{id:"polar",name:"Polar",import:(()=>K(()=>import("./polar-C0HS_06l.js"),[]))},{id:"postcss",name:"PostCSS",import:(()=>K(()=>import("./postcss-CXtECtnM.js"),[]))},{id:"powerquery",name:"PowerQuery",import:(()=>K(()=>import("./powerquery-CEu0bR-o.js"),[]))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>K(()=>import("./powershell-Dpen1YoG.js"),[]))},{id:"prisma",name:"Prisma",import:(()=>K(()=>import("./prisma-Dd19v3D-.js"),[]))},{id:"prolog",name:"Prolog",import:(()=>K(()=>import("./prolog-CbFg5uaA.js"),[]))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>K(()=>import("./proto-C7zT0LnQ.js"),[]))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>K(()=>import("./pug-CGlum2m_.js"),__vite__mapDeps([73,2,3,1])))},{id:"puppet",name:"Puppet",import:(()=>K(()=>import("./puppet-BMWR74SV.js"),[]))},{id:"purescript",name:"PureScript",import:(()=>K(()=>import("./purescript-CklMAg4u.js"),[]))},{id:"python",name:"Python",aliases:["py"],import:(()=>K(()=>import("./python-B6aJPvgy.js"),[]))},{id:"qml",name:"QML",import:(()=>K(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([74,2])))},{id:"qmldir",name:"QML Directory",import:(()=>K(()=>import("./qmldir-C8lEn-DE.js"),[]))},{id:"qss",name:"Qt Style Sheets",import:(()=>K(()=>import("./qss-IeuSbFQv.js"),[]))},{id:"r",name:"R",import:(()=>K(()=>import("./r-Dspwwk_N.js"),[]))},{id:"racket",name:"Racket",import:(()=>K(()=>import("./racket-BqYA7rlc.js"),[]))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>K(()=>import("./raku-DXvB9xmW.js"),[]))},{id:"razor",name:"ASP.NET Razor",import:(()=>K(()=>import("./razor-Uh8Bk_45.js"),__vite__mapDeps([75,1,2,3,76])))},{id:"reg",name:"Windows Registry Script",import:(()=>K(()=>import("./reg-C-SQnVFl.js"),[]))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>K(()=>import("./regexp-CDVJQ6XC.js"),[]))},{id:"rel",name:"Rel",import:(()=>K(()=>import("./rel-C3B-1QV4.js"),[]))},{id:"riscv",name:"RISC-V",import:(()=>K(()=>import("./riscv-BM1_JUlF.js"),[]))},{id:"ron",name:"RON",import:(()=>K(()=>import("./ron-BhRPY-oY.js"),[]))},{id:"rosmsg",name:"ROS Interface",import:(()=>K(()=>import("./rosmsg-BJDFO7_C.js"),[]))},{id:"rst",name:"reStructuredText",import:(()=>K(()=>import("./rst-D5oM4XIm.js"),__vite__mapDeps([77,15,1,2,3,23,24,25,26,16,20,28,38,78,33,34,7,8,35,11,36,13,37])))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>K(()=>import("./ruby-Cw6WdidG.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>K(()=>import("./rust-B1yitclQ.js"),[]))},{id:"sas",name:"SAS",import:(()=>K(()=>import("./sas-cz2c8ADy.js"),__vite__mapDeps([79,16])))},{id:"sass",name:"Sass",import:(()=>K(()=>import("./sass-Cj5Yp3dK.js"),[]))},{id:"scala",name:"Scala",import:(()=>K(()=>import("./scala-C151Ov-r.js"),[]))},{id:"scheme",name:"Scheme",import:(()=>K(()=>import("./scheme-C98Dy4si.js"),[]))},{id:"scss",name:"SCSS",import:(()=>K(()=>import("./scss-OYdSNvt2.js"),__vite__mapDeps([5,3])))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>K(()=>import("./sdbl-DVxCFoDh.js"),[]))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>K(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([80,81])))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>K(()=>import("./shellscript-Yzrsuije.js"),[]))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>K(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([82,28])))},{id:"smalltalk",name:"Smalltalk",import:(()=>K(()=>import("./smalltalk-BERRCDM3.js"),[]))},{id:"solidity",name:"Solidity",import:(()=>K(()=>import("./solidity-rGO070M0.js"),[]))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>K(()=>import("./soy-Brmx7dQM.js"),__vite__mapDeps([83,1,2,3])))},{id:"sparql",name:"SPARQL",import:(()=>K(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([84,85])))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>K(()=>import("./splunk-BtCnVYZw.js"),[]))},{id:"sql",name:"SQL",import:(()=>K(()=>import("./sql-BLtJtn59.js"),[]))},{id:"ssh-config",name:"SSH Config",import:(()=>K(()=>import("./ssh-config-_ykCGR6B.js"),[]))},{id:"stata",name:"Stata",import:(()=>K(()=>import("./stata-BH5u7GGu.js"),__vite__mapDeps([86,16])))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>K(()=>import("./stylus-BEDo0Tqx.js"),[]))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>K(()=>import("./surrealql-Bq5Q-fJD.js"),__vite__mapDeps([87,2])))},{id:"svelte",name:"Svelte",import:(()=>K(()=>import("./svelte-zxCyuUbr.js"),__vite__mapDeps([88,2,11,3,12])))},{id:"swift",name:"Swift",import:(()=>K(()=>import("./swift-Dg5xB15N.js"),[]))},{id:"system-verilog",name:"SystemVerilog",import:(()=>K(()=>import("./system-verilog-CnnmHF94.js"),[]))},{id:"systemd",name:"Systemd Units",import:(()=>K(()=>import("./systemd-4A_iFExJ.js"),[]))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>K(()=>import("./talonscript-CkByrt1z.js"),[]))},{id:"tasl",name:"Tasl",import:(()=>K(()=>import("./tasl-QIJgUcNo.js"),[]))},{id:"tcl",name:"Tcl",import:(()=>K(()=>import("./tcl-dwOrl1Do.js"),[]))},{id:"templ",name:"Templ",import:(()=>K(()=>import("./templ-P3uqSqPl.js"),__vite__mapDeps([89,90,2,3])))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>K(()=>import("./terraform-BETggiCN.js"),[]))},{id:"tex",name:"TeX",import:(()=>K(()=>import("./tex-CvyZ59Mk.js"),__vite__mapDeps([64,62])))},{id:"toml",name:"TOML",import:(()=>K(()=>import("./toml-vGWfd6FD.js"),[]))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>K(()=>import("./ts-tags-zn1MmPIZ.js"),__vite__mapDeps([91,11,3,2,25,26,1,16,7,8])))},{id:"tsv",name:"TSV",import:(()=>K(()=>import("./tsv-B_m7g4N7.js"),[]))},{id:"tsx",name:"TSX",import:(()=>K(()=>import("./tsx-COt5Ahok.js"),[]))},{id:"turtle",name:"Turtle",import:(()=>K(()=>import("./turtle-BsS91CYL.js"),[]))},{id:"twig",name:"Twig",import:(()=>K(()=>import("./twig-ChbOoGGc.js"),__vite__mapDeps([92,3,2,5,72,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38])))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>K(()=>import("./typescript-BPQ3VLAy.js"),[]))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>K(()=>import("./typespec-BGHnOYBU.js"),[]))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>K(()=>import("./typst-DHCkPAjA.js"),[]))},{id:"v",name:"V",import:(()=>K(()=>import("./v-BcVCzyr7.js"),[]))},{id:"vala",name:"Vala",import:(()=>K(()=>import("./vala-CsfeWuGM.js"),[]))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>K(()=>import("./vb-D17OF-Vu.js"),[]))},{id:"verilog",name:"Verilog",import:(()=>K(()=>import("./verilog-BQ8w6xss.js"),[]))},{id:"vhdl",name:"VHDL",import:(()=>K(()=>import("./vhdl-CeAyd5Ju.js"),[]))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>K(()=>import("./viml-CJc9bBzg.js"),[]))},{id:"vue",name:"Vue",import:(()=>K(()=>import("./vue-DN_0RTcg.js"),__vite__mapDeps([93,3,2,11,9,1,15])))},{id:"vue-html",name:"Vue HTML",import:(()=>K(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([94,2])))},{id:"vue-vine",name:"Vue Vine",import:(()=>K(()=>import("./vue-vine-CQOfvN7w.js"),__vite__mapDeps([95,3,5,67,96,12,2])))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>K(()=>import("./vyper-CDx5xZoG.js"),[]))},{id:"wasm",name:"WebAssembly",import:(()=>K(()=>import("./wasm-MzD3tlZU.js"),[]))},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:(()=>K(()=>import("./wenyan-BV7otONQ.js"),[]))},{id:"wgsl",name:"WGSL",import:(()=>K(()=>import("./wgsl-Dx-B1_4e.js"),[]))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>K(()=>import("./wikitext-BhOHFoWU.js"),[]))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>K(()=>import("./wit-5i3qLPDT.js"),[]))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>K(()=>import("./wolfram-lXgVvXCa.js"),[]))},{id:"xml",name:"XML",import:(()=>K(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8])))},{id:"xsl",name:"XSL",import:(()=>K(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([97,7,8])))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>K(()=>import("./yaml-Buea-lGh.js"),[]))},{id:"zenscript",name:"ZenScript",import:(()=>K(()=>import("./zenscript-DVFEvuxE.js"),[]))},{id:"zig",name:"Zig",import:(()=>K(()=>import("./zig-VOosw3JB.js"),[]))}],S0=Object.fromEntries(Ju.map(t=>[t.id,t.import])),C0=Object.fromEntries(Ju.flatMap(t=>{var e;return((e=t.aliases)==null?void 0:e.map(r=>[r,t.import]))||[]})),k0={...S0,...C0},E0=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>K(()=>import("./andromeeda-C4gqWexZ.js"),[]))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>K(()=>import("./aurora-x-D-2ljcwZ.js"),[]))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>K(()=>import("./ayu-dark-CMjwMIkn.js"),[]))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>K(()=>import("./ayu-light-C47S-Tmv.js"),[]))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>K(()=>import("./ayu-mirage-CjoLj4QM.js"),[]))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:(()=>K(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>K(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>K(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>K(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>K(()=>import("./dark-plus-C3mMm8J8.js"),[]))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>K(()=>import("./dracula-BzJJZx-M.js"),[]))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>K(()=>import("./dracula-soft-BXkSAIEj.js"),[]))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>K(()=>import("./everforest-dark-BgDCqdQA.js"),[]))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>K(()=>import("./everforest-light-C8M2exoo.js"),[]))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>K(()=>import("./github-dark-DHJKELXO.js"),[]))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>K(()=>import("./github-dark-default-Cuk6v7N8.js"),[]))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>K(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>K(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>K(()=>import("./github-light-DAi9KRSo.js"),[]))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>K(()=>import("./github-light-default-D7oLnXFd.js"),[]))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>K(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>K(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>K(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>K(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>K(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>K(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>K(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>K(()=>import("./horizon-BUw7H-hv.js"),[]))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>K(()=>import("./houston-DnULxvSX.js"),[]))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>K(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>K(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>K(()=>import("./kanagawa-wave-DWedfzmr.js"),[]))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>K(()=>import("./laserwave-DUszq2jm.js"),[]))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>K(()=>import("./light-plus-B7mTdjB0.js"),[]))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>K(()=>import("./material-theme-D5KoaKCx.js"),[]))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>K(()=>import("./material-theme-darker-BfHTSMKl.js"),[]))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>K(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>K(()=>import("./material-theme-ocean-CyktbL80.js"),[]))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>K(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>K(()=>import("./min-dark-CafNBF8u.js"),[]))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>K(()=>import("./min-light-CTRr51gU.js"),[]))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>K(()=>import("./monokai-D4h5O-jR.js"),[]))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>K(()=>import("./night-owl-C39BiMTA.js"),[]))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>K(()=>import("./night-owl-light-CMTm3GFP.js"),[]))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>K(()=>import("./nord-Ddv68eIx.js"),[]))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>K(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>K(()=>import("./one-light-C3Wv6jpd.js"),[]))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>K(()=>import("./plastic-3e1v2bzS.js"),[]))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>K(()=>import("./poimandres-CS3Unz2-.js"),[]))},{id:"red",displayName:"Red",type:"dark",import:(()=>K(()=>import("./red-bN70gL4F.js"),[]))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:(()=>K(()=>import("./rose-pine-qdsjHGoJ.js"),[]))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:(()=>K(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:(()=>K(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>K(()=>import("./slack-dark-BthQWCQV.js"),[]))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>K(()=>import("./slack-ochin-DqwNpetd.js"),[]))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>K(()=>import("./snazzy-light-Bw305WKR.js"),[]))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>K(()=>import("./solarized-dark-DXbdFlpD.js"),[]))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>K(()=>import("./solarized-light-L9t79GZl.js"),[]))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>K(()=>import("./synthwave-84-CbfX1IO0.js"),[]))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>K(()=>import("./tokyo-night-hegEt444.js"),[]))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>K(()=>import("./vesper-DU1UobuO.js"),[]))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>K(()=>import("./vitesse-black-Bkuqu6BP.js"),[]))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>K(()=>import("./vitesse-dark-D0r3Knsf.js"),[]))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>K(()=>import("./vitesse-light-CVO1_9PV.js"),[]))}],A0=Object.fromEntries(E0.map(t=>[t.id,t.import]));class Ll extends Error{constructor(e){super(e),this.name="ShikiError"}}function T0(){return 2147483648}function P0(){return typeof performance<"u"?performance.now():Date.now()}const L0=(t,e)=>t+(e-t%e)%e;async function R0(t){let e,r;const n={};function s(m){r=m,n.HEAPU8=new Uint8Array(m),n.HEAPU32=new Uint32Array(m)}function d(m,w,b){n.HEAPU8.copyWithin(m,w,w+b)}function _(m){try{return e.grow(m-r.byteLength+65535>>>16),s(e.buffer),1}catch{}}function o(m){const w=n.HEAPU8.length;m=m>>>0;const b=T0();if(m>b)return!1;for(let f=1;f<=4;f*=2){let u=w*(1+.2/f);u=Math.min(u,m+100663296);const l=Math.min(b,L0(Math.max(m,u),65536));if(_(l))return!0}return!1}const a=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(m,w,b=1024){const f=w+b;let u=w;for(;m[u]&&!(u>=f);)++u;if(u-w>16&&m.buffer&&a)return a.decode(m.subarray(w,u));let l="";for(;w<u;){let p=m[w++];if(!(p&128)){l+=String.fromCharCode(p);continue}const y=m[w++]&63;if((p&224)===192){l+=String.fromCharCode((p&31)<<6|y);continue}const k=m[w++]&63;if((p&240)===224?p=(p&15)<<12|y<<6|k:p=(p&7)<<18|y<<12|k<<6|m[w++]&63,p<65536)l+=String.fromCharCode(p);else{const C=p-65536;l+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return l}function g(m,w){return m?c(n.HEAPU8,m,w):""}const h={emscripten_get_now:P0,emscripten_memcpy_big:d,emscripten_resize_heap:o,fd_write:()=>0};async function v(){const w=await t({env:h,wasi_snapshot_preview1:h});e=w.memory,s(e.buffer),Object.assign(n,w),n.UTF8ToString=g}return await v(),n}var I0=Object.defineProperty,D0=(t,e,r)=>e in t?I0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Pr=(t,e,r)=>D0(t,typeof e!="symbol"?e+"":e,r);let Or=null;function M0(t){throw new Ll(t.UTF8ToString(t.getLastOnigError()))}class qo{constructor(e){Pr(this,"utf16Length"),Pr(this,"utf8Length"),Pr(this,"utf16Value"),Pr(this,"utf8Value"),Pr(this,"utf16OffsetToUtf8"),Pr(this,"utf8OffsetToUtf16");const r=e.length,n=qo._utf8ByteLength(e),s=n!==r,d=s?new Uint32Array(r+1):null;s&&(d[r]=n);const _=s?new Uint32Array(n+1):null;s&&(_[n]=r);const o=new Uint8Array(n);let a=0;for(let c=0;c<r;c++){const g=e.charCodeAt(c);let h=g,v=!1;if(g>=55296&&g<=56319&&c+1<r){const m=e.charCodeAt(c+1);m>=56320&&m<=57343&&(h=(g-55296<<10)+65536|m-56320,v=!0)}s&&(d[c]=a,v&&(d[c+1]=a),h<=127?_[a+0]=c:h<=2047?(_[a+0]=c,_[a+1]=c):h<=65535?(_[a+0]=c,_[a+1]=c,_[a+2]=c):(_[a+0]=c,_[a+1]=c,_[a+2]=c,_[a+3]=c)),h<=127?o[a++]=h:h<=2047?(o[a++]=192|(h&1984)>>>6,o[a++]=128|(h&63)>>>0):h<=65535?(o[a++]=224|(h&61440)>>>12,o[a++]=128|(h&4032)>>>6,o[a++]=128|(h&63)>>>0):(o[a++]=240|(h&1835008)>>>18,o[a++]=128|(h&258048)>>>12,o[a++]=128|(h&4032)>>>6,o[a++]=128|(h&63)>>>0),v&&c++}this.utf16Length=r,this.utf8Length=n,this.utf16Value=e,this.utf8Value=o,this.utf16OffsetToUtf8=d,this.utf8OffsetToUtf16=_}static _utf8ByteLength(e){let r=0;for(let n=0,s=e.length;n<s;n++){const d=e.charCodeAt(n);let _=d,o=!1;if(d>=55296&&d<=56319&&n+1<s){const a=e.charCodeAt(n+1);a>=56320&&a<=57343&&(_=(d-55296<<10)+65536|a-56320,o=!0)}_<=127?r+=1:_<=2047?r+=2:_<=65535?r+=3:r+=4,o&&n++}return r}createString(e){const r=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,r),r}}const Go=class Mi{constructor(e){if(Pr(this,"id",++Mi.LAST_ID),Pr(this,"_onigBinding"),Pr(this,"content"),Pr(this,"utf16Length"),Pr(this,"utf8Length"),Pr(this,"utf16OffsetToUtf8"),Pr(this,"utf8OffsetToUtf16"),Pr(this,"ptr"),!Or)throw new Ll("Must invoke loadWasm first.");this._onigBinding=Or,this.content=e;const r=new qo(e);this.utf16Length=r.utf16Length,this.utf8Length=r.utf8Length,this.utf16OffsetToUtf8=r.utf16OffsetToUtf8,this.utf8OffsetToUtf16=r.utf8OffsetToUtf16,this.utf8Length<1e4&&!Mi._sharedPtrInUse?(Mi._sharedPtr||(Mi._sharedPtr=Or.omalloc(1e4)),Mi._sharedPtrInUse=!0,Or.HEAPU8.set(r.utf8Value,Mi._sharedPtr),this.ptr=Mi._sharedPtr):this.ptr=r.createString(Or)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===Mi._sharedPtr?Mi._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Pr(Go,"LAST_ID",0);Pr(Go,"_sharedPtr",0);Pr(Go,"_sharedPtrInUse",!1);let Yu=Go;class O0{constructor(e){if(Pr(this,"_onigBinding"),Pr(this,"_ptr"),!Or)throw new Ll("Must invoke loadWasm first.");const r=[],n=[];for(let o=0,a=e.length;o<a;o++){const c=new qo(e[o]);r[o]=c.createString(Or),n[o]=c.utf8Length}const s=Or.omalloc(4*e.length);Or.HEAPU32.set(r,s/4);const d=Or.omalloc(4*e.length);Or.HEAPU32.set(n,d/4);const _=Or.createOnigScanner(s,d,e.length);for(let o=0,a=e.length;o<a;o++)Or.ofree(r[o]);Or.ofree(d),Or.ofree(s),_===0&&M0(Or),this._onigBinding=Or,this._ptr=_}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,r,n){let s=0;if(typeof n=="number"&&(s=n),typeof e=="string"){e=new Yu(e);const d=this._findNextMatchSync(e,r,!1,s);return e.dispose(),d}return this._findNextMatchSync(e,r,!1,s)}_findNextMatchSync(e,r,n,s){const d=this._onigBinding,_=d.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(r),s);if(_===0)return null;const o=d.HEAPU32;let a=_/4;const c=o[a++],g=o[a++],h=[];for(let v=0;v<g;v++){const m=e.convertUtf8OffsetToUtf16(o[a++]),w=e.convertUtf8OffsetToUtf16(o[a++]);h[v]={start:m,end:w,length:w-m}}return{index:c,captureIndices:h}}}function B0(t){return typeof t.instantiator=="function"}function N0(t){return typeof t.default=="function"}function j0(t){return typeof t.data<"u"}function H0(t){return typeof Response<"u"&&t instanceof Response}function F0(t){var e;return typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||ArrayBuffer.isView(t))||typeof Buffer<"u"&&((e=Buffer.isBuffer)==null?void 0:e.call(Buffer,t))||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&t instanceof Uint32Array}let eo;function U0(t){if(eo)return eo;async function e(){Or=await R0(async r=>{let n=t;return n=await n,typeof n=="function"&&(n=await n(r)),typeof n=="function"&&(n=await n(r)),B0(n)?n=await n.instantiator(r):N0(n)?n=await n.default(r):(j0(n)&&(n=n.data),H0(n)?typeof WebAssembly.instantiateStreaming=="function"?n=await V0(n)(r):n=await z0(n)(r):F0(n)?n=await ha(n)(r):n instanceof WebAssembly.Module?n=await ha(n)(r):"default"in n&&n.default instanceof WebAssembly.Module&&(n=await ha(n.default)(r))),"instance"in n&&(n=n.instance),"exports"in n&&(n=n.exports),n})}return eo=e(),eo}function ha(t){return e=>WebAssembly.instantiate(t,e)}function V0(t){return e=>WebAssembly.instantiateStreaming(t,e)}function z0(t){return async e=>{const r=await t.arrayBuffer();return WebAssembly.instantiate(r,e)}}async function W0(t){return t&&await U0(t),{createScanner(e){return new O0(e.map(r=>typeof r=="string"?r:r.source))},createString(e){return new Yu(e)}}}const q0=w0({langs:k0,themes:A0,engine:()=>W0(K(()=>import("./wasm-CG6Dc4jp.js"),[]))});let to=null,ro=null;const Oc=new Set;async function G0(){return to!==null?to:ro!==null?ro:(ro=q0({themes:["github-dark"],langs:[]}),to=await ro,to)}async function K0(t,e){if(Oc.has(e))return!0;try{return await t.loadLanguage(e),Oc.add(e),!0}catch{return!1}}const X0={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",mts:"typescript",cts:"typescript",svelte:"svelte",vue:"vue",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",kt:"kotlin",kts:"kotlin",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hxx:"cpp",cs:"csharp",css:"css",scss:"scss",less:"less",html:"html",htm:"html",xml:"xml",svg:"xml",json:"json",jsonc:"jsonc",yaml:"yaml",yml:"yaml",md:"markdown",mdx:"mdx",sh:"bash",bash:"bash",zsh:"bash",fish:"fish",sql:"sql",toml:"toml",nix:"nix",lua:"lua",swift:"swift",php:"php",r:"r",graphql:"graphql",gql:"graphql",tf:"hcl",hcl:"hcl",proto:"protobuf",zig:"zig",elm:"elm",ex:"elixir",exs:"elixir",erl:"erlang",hs:"haskell",clj:"clojure",dart:"dart",scala:"scala",groovy:"groovy",pl:"perl",vim:"viml",ini:"ini",conf:"ini",cfg:"ini",diff:"diff",patch:"diff",ps1:"powershell",bat:"batch",cmd:"batch"},J0={dockerfile:"dockerfile",makefile:"makefile",cmakelists:"cmake",gemfile:"ruby",rakefile:"ruby",justfile:"just"};function Y0(t){const e=(t.split("/").pop()??"").toLowerCase(),r=e.split(".")[0]??e,n=J0[r];if(n!==void 0)return n;const s=e.includes(".")?e.split(".").pop()??"":"";return X0[s]??"text"}function fo(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Q0(t){return t.map(e=>{const r=fo(e.content);return e.color!==void 0?`<span style="color:${e.color}">${r}</span>`:r}).join("")}async function Ns(t,e){const r=Y0(e);if(r==="text"||t.length===0)return t.split(`
178
+ `).map(n=>fo(n));try{const n=await G0();return await K0(n,r)?n.codeToTokens(t,{lang:r,theme:"github-dark"}).tokens.map(_=>Q0(_)):t.split(`
179
+ `).map(_=>fo(_))}catch{return t.split(`
180
+ `).map(n=>fo(n))}}var Z0=U('<button type="button" title="Side by Side"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="2" width="6" height="12" rx="1" stroke="currentColor" stroke-width="1.5"></rect><rect x="9" y="2" width="6" height="12" rx="1" stroke="currentColor" stroke-width="1.5"></rect></svg></button>'),$0=U('<div class="flex items-center justify-center flex-1 text-text-secondary text-sm p-8"><p> </p></div>'),eb=U('<div class="flex items-center justify-center flex-1 text-danger-fg text-sm p-8"><p> </p></div>'),tb=U('<div class="diff-view-container w-full h-full flex flex-col svelte-1uewwyd"><div class="flex items-center justify-between px-2 min-h-[32px] bg-bg-secondary border-b border-border-default sticky top-0 z-10"><div class="flex items-center gap-2"><span class="text-xs font-medium text-text-primary truncate max-w-[300px]"> </span> <span class="text-[10px] text-text-secondary"> </span></div> <div class="flex items-center gap-1"><div class="flex items-center border border-border-default rounded-md overflow-hidden"><button type="button" title="Full File"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 2.5A1.5 1.5 0 014.5 1h5.586a1 1 0 01.707.293l2.414 2.414a1 1 0 01.293.707V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11z" stroke="currentColor" stroke-width="1.5"></path><line x1="5.5" y1="6" x2="11" y2="6" stroke="currentColor" stroke-width="1.2"></line><line x1="5.5" y1="8.5" x2="11" y2="8.5" stroke="currentColor" stroke-width="1.2"></line><line x1="5.5" y1="11" x2="9" y2="11" stroke="currentColor" stroke-width="1.2"></line></svg></button> <!> <button type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="2" width="14" height="12" rx="1" stroke="currentColor" stroke-width="1.5"></rect><line x1="4" y1="5.5" x2="12" y2="5.5" stroke="currentColor" stroke-width="1.2"></line><line x1="4" y1="8" x2="12" y2="8" stroke="currentColor" stroke-width="1.2"></line><line x1="4" y1="10.5" x2="10" y2="10.5" stroke="currentColor" stroke-width="1.2"></line></svg></button> <button type="button" title="Current"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 2.5A1.5 1.5 0 014.5 1h5.586a1 1 0 01.707.293l2.414 2.414a1 1 0 01.293.707V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11z" stroke="currentColor" stroke-width="1.5"></path></svg></button></div> <button type="button" title="Previous file" aria-label="Previous file"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 1.06L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"></path></svg></button> <button type="button" title="Next file" aria-label="Next file"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8.22 3.47a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.19 9H3.75a.75.75 0 0 1 0-1.5h7.44L8.22 4.53a.75.75 0 0 1 0-1.06Z"></path></svg></button></div></div> <!></div>');function rb(t,e){Kt(e,!0);let r=Re(e,"viewMode",3,"inline"),n=Re(e,"selectedHasDiff",3,!0),s=Re(e,"isIphone",3,!1),d=Re(e,"onSetViewMode",3,void 0),_=Re(e,"onLineSelect",3,void 0),o=Re(e,"onCommentSubmit",3,void 0),a=Re(e,"submittedSessionId",3,null),c=Re(e,"submittedSessionHistoryHref",3,null),g=Re(e,"onDismissSubmittedSession",3,void 0);Re(e,"highlightedLines",3,void 0);let h=Re(e,"onNavigatePrev",3,void 0),v=Re(e,"onNavigateNext",3,void 0),m=q(null),w=q(xt(new Map)),b=q(xt(new Map));gt(()=>{const z=[],O=[];for(const ge of e.file.chunks)for(const we of ge.changes)(we.type==="delete"||we.type==="context")&&we.oldLine!==void 0&&z.push({lineNumber:we.oldLine,content:we.content}),(we.type==="add"||we.type==="context")&&we.newLine!==void 0&&O.push({lineNumber:we.newLine,content:we.content});const ne=z.map(ge=>ge.content).join(`
181
+ `),ae=O.map(ge=>ge.content).join(`
182
+ `),te=e.file.path;Promise.all([Ns(ne,te),Ns(ae,te)]).then(([ge,we])=>{const Ie=new Map;for(let Se=0;Se<z.length;Se++){const Be=z[Se],Ue=ge[Se];Be!==void 0&&Ue!==void 0&&Ie.set(Be.lineNumber,Ue)}x(w,Ie,!0);const Pe=new Map;for(let Se=0;Se<O.length;Se++){const Be=O[Se],Ue=we[Se];Be!==void 0&&Ue!==void 0&&Pe.set(Be.lineNumber,Ue)}x(b,Pe,!0)})});function f(z,O){if(z!=="old"){if(i(m)!==null&&i(m).side===z){const ne=Math.min(i(m).startLine,O),ae=Math.max(i(m).endLine,O);x(m,{side:z,startLine:ne,endLine:ae},!0)}else x(m,{side:z,startLine:O,endLine:O},!0);_()!==void 0&&_()(O)}}function u(z,O){if(O!=="old"){if(i(m)!==null&&i(m).side===O){const ne=Math.min(i(m).startLine,z),ae=Math.max(i(m).endLine,z);x(m,{side:O,startLine:ne,endLine:ae},!0)}else x(m,{side:O,startLine:z,endLine:z},!0);_()!==void 0&&_()(z)}}function l(z,O,ne){if(z!=="old")if(ne&&i(m)!==null&&i(m).side===z){const ae=Math.min(i(m).startLine,O),te=Math.max(i(m).endLine,O);x(m,{side:z,startLine:ae,endLine:te},!0)}else x(m,{side:z,startLine:O,endLine:O},!0)}function p(z,O,ne){if(O!=="old")if(ne&&i(m)!==null&&i(m).side===O){const ae=Math.min(i(m).startLine,z),te=Math.max(i(m).endLine,z);x(m,{side:O,startLine:ae,endLine:te},!0)}else x(m,{side:O,startLine:z,endLine:z},!0)}function y(z,O){i(m)!==null&&o()!==void 0&&o()(i(m).startLine,i(m).endLine,i(m).side,e.file.path,z,O)}function k(){x(m,null)}const C=ye(()=>{if(i(m)===null)return"";const z=i(m).startLine===i(m).endLine?`L${i(m).startLine}`:`L${i(m).startLine}-L${i(m).endLine}`;return`Ask AI about ${e.file.path}:${z} ...`}),A=ye(()=>{if(i(m)===null)return[];const z=[];for(let O=i(m).startLine;O<=i(m).endLine;O++)z.push(O);return z}),S=ye(()=>i(m)!==null?{side:i(m).side,startLine:i(m).startLine,endLine:i(m).endLine}:void 0),T=ye(()=>i(m)!==null?{type:i(m).side,startLine:i(m).startLine,endLine:i(m).endLine}:void 0);var D=tb(),H=E(D),W=E(H),M=E(W),G=E(M),X=P(M,2),le=E(X),me=P(W,2),xe=E(me),R=E(xe);R.__click=()=>{var z;return(z=d())==null?void 0:z("full-file")};var j=P(R,2);{var N=z=>{var O=Z0();O.__click=()=>{var ne;n()&&((ne=d())==null||ne("side-by-side"))},de(()=>{Ve(O,1,`p-1 border-l border-border-default transition-colors
183
+ ${n()?r()==="side-by-side"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover":"text-text-disabled cursor-not-allowed opacity-40"}`),O.disabled=!n()}),L(z,O)};Y(j,z=>{s()||z(N)})}var V=P(j,2);V.__click=()=>{var z;n()&&((z=d())==null||z("inline"))};var $=P(V,2);$.__click=()=>{var z;n()&&((z=d())==null||z("current-state"))};var ee=P(xe,2);ee.__click=()=>{var z;return(z=h())==null?void 0:z()};var ce=P(ee,2);ce.__click=()=>{var z;return(z=v())==null?void 0:z()};var ue=P(H,2);{var B=z=>{var O=$0(),ne=E(O),ae=E(ne);de(()=>se(ae,`No changes to display for ${e.file.path??""}`)),L(z,O)},I=z=>{var O=_t(),ne=Ye(O);{var ae=ge=>{xv(ge,{get chunks(){return e.file.chunks},onLineSelect:f,onCommentOpen:l,onCommentSubmit:y,onCommentCancel:k,get commentLine(){return i(S)},get placeholder(){return i(C)},get rangeLines(){return i(A)},get oldHighlightMap(){return i(w)},get newHighlightMap(){return i(b)},get filePath(){return e.file.path},get submittedSessionId(){return a()},get submittedSessionHistoryHref(){return c()},get onDismissSubmittedSession(){return g()}})},te=ge=>{var we=_t(),Ie=Ye(we);{var Pe=Be=>{du(Be,{get chunks(){return e.file.chunks},onLineSelect:u,onCommentOpen:p,onCommentSubmit:y,onCommentCancel:k,get commentLine(){return i(T)},get placeholder(){return i(C)},get rangeLines(){return i(A)},get oldHighlightMap(){return i(w)},get newHighlightMap(){return i(b)},get filePath(){return e.file.path},get submittedSessionId(){return a()},get submittedSessionHistoryHref(){return c()},get onDismissSubmittedSession(){return g()}})},Se=Be=>{var Ue=eb(),je=E(Ue),ze=E(je);de(()=>se(ze,`Unknown view mode: ${e.mode??""}`)),L(Be,Ue)};Y(Ie,Be=>{e.mode==="inline"?Be(Pe):Be(Se,!1)},!0)}L(ge,we)};Y(ne,ge=>{e.mode==="side-by-side"?ge(ae):ge(te,!1)},!0)}L(z,O)};Y(ue,z=>{e.file.chunks.length===0?z(B):z(I,!1)})}de(()=>{se(G,e.file.path),se(le,`+${e.file.additions??""} -${e.file.deletions??""}`),Ve(R,1,`p-1 transition-colors
184
+ ${r()==="full-file"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover"}`),Ve(V,1,`p-1 border-l border-border-default transition-colors
185
+ ${n()?r()==="inline"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover":"text-text-disabled cursor-not-allowed opacity-40"}`),V.disabled=!n(),Ge(V,"title",s()?"Stack":"Inline"),Ve($,1,`p-1 border-l border-border-default transition-colors
186
+ ${n()?r()==="current-state"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover":"text-text-disabled cursor-not-allowed opacity-40"}`),$.disabled=!n(),Ve(ee,1,`p-1 rounded transition-colors ${h()!==void 0?"text-text-secondary hover:text-text-primary hover:bg-bg-tertiary cursor-pointer":"text-text-disabled cursor-default"}`),ee.disabled=h()===void 0,Ve(ce,1,`p-1 rounded transition-colors ${v()!==void 0?"text-text-secondary hover:text-text-primary hover:bg-bg-tertiary cursor-pointer":"text-text-disabled cursor-default"}`),ce.disabled=v()===void 0}),L(t,D),Xt()}tr(["click"]);var ib=U('<button type="button" title="Side by Side"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="2" width="6" height="12" rx="1" stroke="currentColor" stroke-width="1.5"></rect><rect x="9" y="2" width="6" height="12" rx="1" stroke="currentColor" stroke-width="1.5"></rect></svg></button>'),nb=U('<img class="max-w-full max-h-[80vh] object-contain"/>'),sb=U('<img class="max-w-full max-h-[80vh] object-contain"/>'),ob=U('<div class="flex items-center justify-center p-8"><!></div>'),ab=U('<div class="flex items-center justify-center p-8"><video controls class="max-w-full max-h-[80vh]"></video></div>',2),lb=U('<div class="w-full h-full min-h-[80vh] p-2"><iframe class="w-full h-full min-h-[80vh] border border-border-default rounded"></iframe></div>'),cb=U('<div class="flex flex-col items-center justify-center py-12 text-text-secondary text-sm gap-2"><div class="text-base font-medium">Binary file</div> <div class="text-xs"> </div> <div class="text-xs text-text-tertiary"> </div></div>'),db=U('<div class="flex items-center justify-center py-12 text-text-secondary text-sm">Empty file</div>'),ub=U(`<button type="button" class="absolute left-0 top-1 w-6 h-6 flex items-center justify-center
187
+ rounded bg-accent-emphasis text-white text-xs font-bold
188
+ opacity-0 group-hover/line:opacity-100
189
+ hover:bg-accent-fg transition-opacity z-10 cursor-pointer">+</button>`),hb=U('<span class="highlighted-line svelte-fshbtj"><!></span>'),fb=U('<pre class="m-0 p-0 svelte-fshbtj"> </pre>'),pb=U('<div class="mt-2 flex items-center justify-between gap-3 rounded border border-accent-emphasis/40 bg-accent-muted/10 px-2 py-1 text-xs text-text-secondary"><span class="truncate">AI session submitted.</span> <div class="flex items-center gap-2"><a class="text-accent-fg underline underline-offset-2 hover:opacity-80">View session history</a> <button type="button" class="text-text-secondary hover:text-text-primary">Close</button></div></div>'),_b=U(`<div class="max-w-4xl border-t-2 border-b-2 border-accent-emphasis bg-bg-secondary p-3"><textarea class="w-full min-h-28 resize-y rounded border border-border-default bg-bg-primary
190
+ px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-emphasis"></textarea> <div class="flex items-center gap-2 mt-2"><button type="button" class="px-3 py-1.5 text-xs rounded bg-accent-muted text-accent-fg
191
+ border border-accent-emphasis/40 hover:bg-accent-muted/80 font-medium">Submit</button> <button type="button" class="px-3 py-1 text-sm text-text-secondary hover:text-text-primary">Cancel</button></div> <!></div>`),vb=U('<div><div class="w-12 flex-shrink-0 px-1 flex items-start justify-end text-text-secondary bg-bg-secondary border-r border-border-default relative"><!> <button type="button" class="select-none cursor-pointer px-1 -mx-1 rounded hover:bg-bg-tertiary/50"> </button></div> <div class="flex-1 px-2 overflow-x-auto"><!></div></div> <!>',1),gb=U('<div class="file-viewer w-full h-full overflow-auto font-mono text-xs leading-5"><div class="flex items-center justify-between px-2 min-h-[32px] bg-bg-secondary border-b border-border-default sticky top-0 z-10"><div class="flex items-center gap-2"><span class="text-xs font-medium text-text-primary truncate max-w-[300px]"> </span></div> <div class="flex items-center gap-1"><div class="flex items-center border border-border-default rounded-md overflow-hidden"><button type="button" title="Full File"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 2.5A1.5 1.5 0 014.5 1h5.586a1 1 0 01.707.293l2.414 2.414a1 1 0 01.293.707V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11z" stroke="currentColor" stroke-width="1.5"></path><line x1="5.5" y1="6" x2="11" y2="6" stroke="currentColor" stroke-width="1.2"></line><line x1="5.5" y1="8.5" x2="11" y2="8.5" stroke="currentColor" stroke-width="1.2"></line><line x1="5.5" y1="11" x2="9" y2="11" stroke="currentColor" stroke-width="1.2"></line></svg></button> <!> <button type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="2" width="14" height="12" rx="1" stroke="currentColor" stroke-width="1.5"></rect><line x1="4" y1="5.5" x2="12" y2="5.5" stroke="currentColor" stroke-width="1.2"></line><line x1="4" y1="8" x2="12" y2="8" stroke="currentColor" stroke-width="1.2"></line><line x1="4" y1="10.5" x2="10" y2="10.5" stroke="currentColor" stroke-width="1.2"></line></svg></button> <button type="button" title="Current"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 2.5A1.5 1.5 0 014.5 1h5.586a1 1 0 01.707.293l2.414 2.414a1 1 0 01.293.707V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11z" stroke="currentColor" stroke-width="1.5"></path></svg></button></div> <button type="button" title="Previous file" aria-label="Previous file"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 1.06L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"></path></svg></button> <button type="button" title="Next file" aria-label="Next file"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8.22 3.47a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.19 9H3.75a.75.75 0 0 1 0-1.5h7.44L8.22 4.53a.75.75 0 0 1 0-1.06Z"></path></svg></button></div></div> <!></div>');function Bc(t,e){Kt(e,!0);let r=Re(e,"isBinary",3,void 0),n=Re(e,"isImage",3,void 0),s=Re(e,"isVideo",3,void 0),d=Re(e,"isPdf",3,void 0),_=Re(e,"mimeType",3,void 0),o=Re(e,"rawFileUrl",3,void 0),a=Re(e,"viewMode",3,"full-file"),c=Re(e,"selectedHasDiff",3,!0),g=Re(e,"isIphone",3,!1),h=Re(e,"onSetViewMode",3,void 0),v=Re(e,"onCommentSubmit",3,void 0),m=Re(e,"submittedSessionId",3,null),w=Re(e,"submittedSessionHistoryHref",3,null),b=Re(e,"onDismissSubmittedSession",3,void 0),f=Re(e,"onNavigatePrev",3,void 0),u=Re(e,"onNavigateNext",3,void 0),l=q(null),p=q(""),y=q(xt([]));const k=ye(()=>e.content.split(`
192
+ `));gt(()=>{const z=e.content,O=e.path;Ns(z,O).then(ne=>{x(y,ne,!0)})});function C(z,O){if(O&&i(l)!==null){const ne=Math.min(i(l).startLine,z),ae=Math.max(i(l).endLine,z);x(l,{startLine:ne,endLine:ae},!0)}else x(l,{startLine:z,endLine:z},!0)}function A(z){if(i(l)!==null){const O=Math.min(i(l).startLine,z),ne=Math.max(i(l).endLine,z);x(l,{startLine:O,endLine:ne},!0);return}x(l,{startLine:z,endLine:z},!0)}function S(z,O){i(l)!==null&&v()!==void 0&&v()(i(l).startLine,i(l).endLine,"new",e.path,z,O),x(p,"")}function T(){x(l,null),x(p,"")}const D=ye(()=>{if(i(l)===null)return"";const z=i(l).startLine===i(l).endLine?`L${i(l).startLine}`:`L${i(l).startLine}-L${i(l).endLine}`;return`Ask AI about ${e.path}:${z} ...`}),H=ye(()=>{if(i(l)===null)return[];const z=[];for(let O=i(l).startLine;O<=i(l).endLine;O++)z.push(O);return z});var W=gb(),M=E(W),G=E(M),X=E(G),le=E(X),me=P(G,2),xe=E(me),R=E(xe);R.__click=()=>{var z;return(z=h())==null?void 0:z("full-file")};var j=P(R,2);{var N=z=>{var O=ib();O.__click=()=>{var ne;c()&&((ne=h())==null||ne("side-by-side"))},de(()=>{Ve(O,1,`p-1 border-l border-border-default transition-colors
193
+ ${c()?a()==="side-by-side"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover":"text-text-disabled cursor-not-allowed opacity-40"}`),O.disabled=!c()}),L(z,O)};Y(j,z=>{g()||z(N)})}var V=P(j,2);V.__click=()=>{var z;c()&&((z=h())==null||z("inline"))};var $=P(V,2);$.__click=()=>{var z;c()&&((z=h())==null||z("current-state"))};var ee=P(xe,2);ee.__click=()=>{var z;return(z=f())==null?void 0:z()};var ce=P(ee,2);ce.__click=()=>{var z;return(z=u())==null?void 0:z()};var ue=P(M,2);{var B=z=>{var O=ob(),ne=E(O);{var ae=ge=>{var we=nb();de(()=>{Ge(we,"src",o()),Ge(we,"alt",e.path)}),L(ge,we)},te=ge=>{var we=sb();de(()=>{Ge(we,"src",`data:${_()??"image/png"??""};base64,${e.content??""}`),Ge(we,"alt",e.path)}),L(ge,we)};Y(ne,ge=>{o()!==void 0?ge(ae):ge(te,!1)})}L(z,O)},I=z=>{var O=_t(),ne=Ye(O);{var ae=ge=>{var we=ab(),Ie=E(we);de(()=>Ge(Ie,"src",o())),L(ge,we)},te=ge=>{var we=_t(),Ie=Ye(we);{var Pe=Be=>{var Ue=lb(),je=E(Ue);de(()=>{Ge(je,"src",o()),Ge(je,"title",e.path)}),L(Be,Ue)},Se=Be=>{var Ue=_t(),je=Ye(Ue);{var ze=_e=>{var Me=cb(),oe=P(E(Me),2),pe=E(oe),Ce=P(oe,2),He=E(Ce);de(()=>{se(pe,_()??"unknown type"),se(He,e.path)}),L(_e,Me)},Ne=_e=>{var Me=_t(),oe=Ye(Me);{var pe=He=>{var $e=db();L(He,$e)},Ce=He=>{var $e=_t(),nt=Ye($e);Gt(nt,17,()=>i(k),ui,(Fe,qe,at)=>{const Ze=ye(()=>at+1),Le=ye(()=>i(H).includes(i(Ze)));var Ae=vb(),it=Ye(Ae),tt=E(it),vt=E(tt);{var ft=Pt=>{var Rt=ub();Rt.__click=It=>{It.stopPropagation(),C(i(Ze),It.shiftKey)},de(()=>Ge(Rt,"aria-label",`Add comment on line ${i(Ze)??""}`)),L(Pt,Rt)};Y(vt,Pt=>{v()!==void 0&&Pt(ft)})}var ht=P(vt,2);ht.__click=()=>A(i(Ze));var pt=E(ht),bt=P(tt,2),Tt=E(bt);{var et=Pt=>{var Rt=hb(),It=E(Rt);Gi(It,()=>i(y)[at]),L(Pt,Rt)},Ct=Pt=>{var Rt=fb(),It=E(Rt);de(()=>se(It,i(qe))),L(Pt,Rt)};Y(Tt,Pt=>{i(y)[at]!==void 0?Pt(et):Pt(Ct,!1)})}var kt=P(it,2);{var Mt=Pt=>{var Rt=_b(),It=E(Rt);It.__keydown=Je=>{Je.key==="Enter"&&Je.ctrlKey&&v()!==void 0&&(Je.preventDefault(),S(i(p),!0)),Je.key==="Escape"&&T()};var Ht=P(It,2),Et=E(Ht);Et.__click=()=>S(i(p),!0);var fe=P(Et,2);fe.__click=()=>T();var be=P(Ht,2);{var We=Je=>{var ut=pb(),Xe=P(E(ut),2),ie=E(Xe),ke=P(ie,2);ke.__click=()=>{var De;(De=b())==null||De(),T()},de(()=>Ge(ie,"href",w())),L(Je,ut)};Y(be,Je=>{m()!==null&&w()!==null&&Je(We)})}de(()=>Ge(It,"placeholder",i(D))),_r(It,()=>i(p),Je=>x(p,Je)),L(Pt,Rt)};Y(kt,Pt=>{i(l)!==null&&i(l).endLine===i(Ze)&&Pt(Mt)})}de(()=>{Ve(it,1,`flex group/line ${i(Le)?"bg-accent-muted":""}`),Ge(ht,"aria-label",`Select line ${i(Ze)??""} for AI prompt`),se(pt,i(Ze))}),L(Fe,Ae)}),L(He,$e)};Y(oe,He=>{i(k).length===0?He(pe):He(Ce,!1)},!0)}L(_e,Me)};Y(je,_e=>{r()===!0?_e(ze):_e(Ne,!1)},!0)}L(Be,Ue)};Y(Ie,Be=>{r()===!0&&d()===!0&&o()!==void 0?Be(Pe):Be(Se,!1)},!0)}L(ge,we)};Y(ne,ge=>{r()===!0&&s()===!0&&o()!==void 0?ge(ae):ge(te,!1)},!0)}L(z,O)};Y(ue,z=>{r()===!0&&n()===!0?z(B):z(I,!1)})}de(()=>{se(le,e.path),Ve(R,1,`p-1 transition-colors
194
+ ${a()==="full-file"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover"}`),Ve(V,1,`p-1 border-l border-border-default transition-colors
195
+ ${c()?a()==="inline"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover":"text-text-disabled cursor-not-allowed opacity-40"}`),V.disabled=!c(),Ge(V,"title",g()?"Stack":"Inline"),Ve($,1,`p-1 border-l border-border-default transition-colors
196
+ ${c()?a()==="current-state"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover":"text-text-disabled cursor-not-allowed opacity-40"}`),$.disabled=!c(),Ve(ee,1,`p-1 rounded transition-colors ${f()!==void 0?"text-text-secondary hover:text-text-primary hover:bg-bg-tertiary cursor-pointer":"text-text-disabled cursor-default"}`),ee.disabled=f()===void 0,Ve(ce,1,`p-1 rounded transition-colors ${u()!==void 0?"text-text-secondary hover:text-text-primary hover:bg-bg-tertiary cursor-pointer":"text-text-disabled cursor-default"}`),ce.disabled=u()===void 0}),L(t,W),Xt()}tr(["click","keydown"]);var mb=U('<span class="text-[10px] font-medium text-text-tertiary bg-bg-tertiary px-1 rounded shrink-0" aria-label="Binary file">BIN</span>'),bb=U("<span> </span>"),yb=U('<button type="button" draggable="true"><svg class="file-icon w-3.5 h-3.5 text-text-tertiary shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> <span class="file-name text-text-primary text-xs truncate flex-1"> </span> <!> <!></button>');function xb(t,e){Kt(e,!0);let r=q(null);gt(()=>{e.selected&&i(r)!==null&&i(r).scrollIntoView({block:"nearest",behavior:"smooth"})});function n(b){if(b===void 0)return"";switch(b){case"added":return"[+]";case"modified":return"[M]";case"deleted":return"[-]";case"untracked":return"[?]";case"ignored":return"[I]";default:return""}}function s(b){if(b===void 0)return"";switch(b){case"added":return"text-success-fg";case"modified":return"text-attention-fg";case"deleted":return"text-danger-fg";case"untracked":return"text-success-fg";case"ignored":return"text-text-quaternary";default:return""}}function d(b){if(b===void 0)return"";switch(b){case"added":return"status-added";case"modified":return"status-modified";case"deleted":return"status-deleted";case"untracked":return"status-untracked";case"ignored":return"status-ignored";default:return""}}const _=ye(()=>1+e.depth*1.5+1);var o=yb();let a;o.__click=function(...b){var f;(f=e.onSelect)==null||f.apply(this,b)};var c=P(E(o),2),g=E(c),h=P(c,2);{var v=b=>{var f=mb();L(b,f)};Y(h,b=>{e.node.isBinary===!0&&b(v)})}var m=P(h,2);{var w=b=>{var f=bb(),u=E(f);de((l,p)=>{Ve(f,1,`status-badge text-xs font-medium shrink-0 ${l??""}`,"svelte-1ukt5k3"),Ge(f,"aria-label",`${e.node.status??""} file`),se(u,p)},[()=>s(e.node.status),()=>n(e.node.status)]),L(b,f)};Y(m,b=>{e.node.status!==void 0&&b(w)})}Nr(o,b=>x(r,b),()=>i(r)),de(b=>{a=Ve(o,1,`file-node group/filenode w-full text-left px-4 py-1 focus:outline-none transition-colors min-h-[28px] flex items-center gap-1.5 ${b??""}`,"svelte-1ukt5k3",a,{"bg-accent-subtle":e.selected&&!e.node.status,"border-l-4":e.selected,"border-accent-emphasis":e.selected}),hi(o,`padding-left: ${i(_)??""}rem`),Ge(o,"aria-label",`Select file ${e.node.name??""}`),Ge(o,"aria-current",e.selected?"true":void 0),se(g,e.node.name)},[()=>d(e.node.status)]),Sr("dragstart",o,b=>{var f,u;(f=b.dataTransfer)==null||f.setData("application/x-qraftbox-path",e.node.path),(u=b.dataTransfer)==null||u.setData("text/plain",e.node.path)}),L(t,o),Xt()}tr(["click"]);var wb=U('<span class="text-[10px] font-medium text-text-quaternary shrink-0" aria-label="Ignored by git">[I]</span>'),Sb=U('<span class="changed-indicator text-xs text-accent-fg shrink-0" aria-label="Contains changed files">•</span>'),Cb=U('<div class="flex items-center gap-1.5 py-1 text-xs text-text-tertiary"><svg class="animate-spin w-3 h-3" viewBox="0 0 24 24" fill="none" aria-hidden="true"><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3" opacity="0.25"></circle><path d="M4 12a8 8 0 018-8" stroke="currentColor" stroke-width="3" stroke-linecap="round"></path></svg> <span>Loading...</span></div>'),kb=U('<div role="treeitem"><button type="button" class="directory-button w-full text-left px-4 py-1 hover:bg-bg-tertiary focus:bg-bg-tertiary focus:outline-none transition-colors min-h-[28px] flex items-center gap-1.5 svelte-1d6le8d" draggable="true"><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg> <svg class="folder-icon w-3.5 h-3.5 text-text-tertiary shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path></svg> <span class="directory-name text-text-primary text-xs truncate flex-1"> </span> <!></button> <!></div>'),Eb=Cr('<path d="M8.5 3.5a.75.75 0 00-1.5 0v2.75A.75.75 0 007.75 7h2.75a.75.75 0 000-1.5H9.56l2.22-2.22a.75.75 0 00-1.06-1.06L8.5 4.44V3.5zM7.5 12.5a.75.75 0 001.5 0V9.75A.75.75 0 008.25 9H5.5a.75.75 0 000 1.5h.94l-2.22 2.22a.75.75 0 101.06 1.06l2.22-2.22v.94z"></path>'),Ab=Cr('<path d="M6.44 4.44L4.22 2.22a.75.75 0 10-1.06 1.06L5.38 5.5H4.5a.75.75 0 000 1.5h2.75A.75.75 0 008 6.25V3.5a.75.75 0 00-1.5 0v.94zM9.56 11.56l2.22 2.22a.75.75 0 001.06-1.06L10.62 10.5h.88a.75.75 0 000-1.5H8.75a.75.75 0 00-.75.75v2.75a.75.75 0 001.5 0v-.94z"></path>'),Tb=U('<button type="button" class="w-5 h-5 flex items-center justify-center rounded transition-colors text-text-tertiary hover:text-text-primary"><svg width="12" height="12" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><!></svg></button>'),Pb=U('<div class="px-2 py-1.5 border-b border-border-default flex items-start gap-1.5"><div class="min-w-0 flex-1"><div> </div></div> <div class="flex items-center gap-1 shrink-0 pt-0.5"><button type="button" class="w-5 h-5 flex items-center justify-center rounded transition-colors text-text-tertiary hover:text-text-primary" aria-label="Copy current directory"><svg width="12" height="12" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M0 4.75C0 3.784.784 3 1.75 3h7.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 019.25 14h-7.5A1.75 1.75 0 010 12.25v-7.5zM1.75 4.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path><path d="M4.75 1A1.75 1.75 0 003 2.75V3h1.5v-.25a.25.25 0 01.25-.25h7.5a.25.25 0 01.25.25v7.5a.25.25 0 01-.25.25H12V12h.25A1.75 1.75 0 0014 10.25v-7.5A1.75 1.75 0 0012.25 1h-7.5z"></path></svg></button> <!></div></div>'),Lb=U('<span class="text-success-fg"> </span>'),Rb=U('<span class="text-attention-fg"> </span>'),Ib=U('<span class="text-danger-fg"> </span>'),Db=U('<svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M2 1.75C2 .784 2.784 0 3.75 0h5.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0112.25 16h-8.5A1.75 1.75 0 012 14.25V1.75zm1.75-.25a.25.25 0 00-.25.25v12.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V4.664a.25.25 0 00-.073-.177l-2.914-2.914a.25.25 0 00-.177-.073H3.75zM8 7.25a.75.75 0 01.75.75v1.25H10a.75.75 0 010 1.5H8.75V12a.75.75 0 01-1.5 0v-1.25H6a.75.75 0 010-1.5h1.25V8A.75.75 0 018 7.25zM6 4.25a.75.75 0 01.75-.75h2.5a.75.75 0 010 1.5h-2.5a.75.75 0 01-.75-.75z"></path></svg> <span class="mode-toggle-label svelte-1d6le8d"><!></span>',1),Mb=U('<svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M2 2.75A.75.75 0 012.75 2h10.5a.75.75 0 010 1.5H2.75A.75.75 0 012 2.75zm0 5A.75.75 0 012.75 7h10.5a.75.75 0 010 1.5H2.75A.75.75 0 012 7.75zM2.75 12h10.5a.75.75 0 010 1.5H2.75a.75.75 0 010-1.5z"></path></svg> <span class="mode-toggle-label svelte-1d6le8d">All</span>',1),Ob=U('<div class="status-filter-dropdown svelte-1d6le8d"><button type="button"><span class="status-filter-option-check svelte-1d6le8d"><!></span> <span class="status-filter-option-label svelte-1d6le8d">All</span> <span class="status-filter-option-count svelte-1d6le8d"> </span></button> <button type="button"><span class="status-filter-option-check svelte-1d6le8d"><!></span> <span class="status-filter-option-label text-success-fg svelte-1d6le8d">Added (+)</span> <span class="status-filter-option-count svelte-1d6le8d"> </span></button> <button type="button"><span class="status-filter-option-check svelte-1d6le8d"><!></span> <span class="status-filter-option-label text-attention-fg svelte-1d6le8d">Modified (M)</span> <span class="status-filter-option-count svelte-1d6le8d"> </span></button> <button type="button"><span class="status-filter-option-check svelte-1d6le8d"><!></span> <span class="status-filter-option-label text-danger-fg svelte-1d6le8d">Deleted (-)</span> <span class="status-filter-option-count svelte-1d6le8d"> </span></button></div>'),Bb=U(`<button type="button" class="absolute right-1 top-1/2 -translate-y-1/2 w-4 h-4 flex items-center justify-center
197
+ text-text-tertiary hover:text-text-primary rounded" aria-label="Clear filter"><svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></button>`),Nb=U('<span class="text-[10px] text-text-tertiary whitespace-nowrap"> </span>'),jb=U('<div class="empty-state flex flex-col items-center justify-center h-full p-8 text-center"><svg class="w-16 h-16 text-text-tertiary mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path></svg> <p class="text-text-secondary text-sm">No files to display</p></div>'),Hb=U('<button type="button" class="w-5 h-5 flex items-center justify-center rounded transition-colors text-text-tertiary hover:text-text-primary shrink-0" title="Reload file tree" aria-label="Reload file tree"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 2.5a5.487 5.487 0 00-4.131 1.869l1.204 1.204A.25.25 0 014.896 6H1.25A.25.25 0 011 5.75V2.104a.25.25 0 01.427-.177l1.38 1.38A7.001 7.001 0 0114.95 7.16a.75.75 0 11-1.49.178A5.501 5.501 0 008 2.5zM1.705 8.005a.75.75 0 01.834.656 5.501 5.501 0 009.592 2.97l-1.204-1.204a.25.25 0 01.177-.427h3.646a.25.25 0 01.25.25v3.646a.25.25 0 01-.427.177l-1.38-1.38A7.001 7.001 0 011.05 8.84a.75.75 0 01.656-.834z"></path></svg></button>'),Fb=U('<span class="text-[11px] text-attention-fg font-medium truncate min-w-0"> </span>'),Ub=U('<button type="button" title="Narrow panel" aria-label="Narrow file tree panel"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M9.78 4.22a.75.75 0 010 1.06L7.56 7.5h6.69a.75.75 0 010 1.5H7.56l2.22 2.22a.75.75 0 11-1.06 1.06l-3.5-3.5a.75.75 0 010-1.06l3.5-3.5a.75.75 0 011.06 0zM2.75 3a.75.75 0 01.75.75v8.5a.75.75 0 01-1.5 0v-8.5A.75.75 0 012.75 3z"></path></svg></button>'),Vb=U('<button type="button" title="Widen panel" aria-label="Widen file tree panel"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M6.22 4.22a.75.75 0 011.06 0l3.5 3.5a.75.75 0 010 1.06l-3.5 3.5a.75.75 0 01-1.06-1.06L8.44 9H1.75a.75.75 0 010-1.5h6.69L6.22 5.28a.75.75 0 010-1.06zM13.25 3a.75.75 0 01.75.75v8.5a.75.75 0 01-1.5 0v-8.5a.75.75 0 01.75-.75z"></path></svg></button>'),zb=Cr('<svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 2c1.981 0 3.671.992 4.933 2.078 1.27 1.091 2.187 2.345 2.637 3.023a1.62 1.62 0 010 1.798c-.45.678-1.367 1.932-2.637 3.023C11.67 13.008 9.981 14 8 14c-1.981 0-3.671-.992-4.933-2.078C1.797 10.831.88 9.577.43 8.899a1.62 1.62 0 010-1.798c.45-.678 1.367-1.932 2.637-3.023C4.33 2.992 6.019 2 8 2zM1.679 7.932a.12.12 0 000 .136c.411.622 1.241 1.75 2.366 2.717C5.176 11.758 6.527 12.5 8 12.5c1.473 0 2.825-.742 3.955-1.715 1.124-.967 1.954-2.096 2.366-2.717a.12.12 0 000-.136c-.412-.621-1.242-1.75-2.366-2.717C10.824 4.242 9.473 3.5 8 3.5c-1.473 0-2.824.742-3.955 1.715-1.124.967-1.954 2.096-2.366 2.717zM8 10a2 2 0 11-.001-3.999A2 2 0 018 10z"></path></svg>'),Wb=Cr('<svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M.143 2.31a.75.75 0 011.047-.167l14 10a.75.75 0 11-.88 1.214l-2.248-1.606C11.346 12.076 10.259 12.5 9 12.5c-1.981 0-3.671-.992-4.933-2.078C2.797 9.331 1.88 8.077 1.43 7.399a1.62 1.62 0 010-1.798c.353-.533 1.063-1.46 2.025-2.347L.31 1.357A.75.75 0 01.143 2.31zm4.653 3.324c-.676.58-1.236 1.206-1.617 1.684a.12.12 0 000 .136c.412.621 1.242 1.75 2.366 2.717C6.676 11.258 8.027 12 9.5 12c.74 0 1.463-.214 2.145-.554L4.796 5.634zM16.57 7.399c-.45.678-1.367 1.932-2.637 3.023l-1.142-.816c1.03-.89 1.784-1.917 2.166-2.488a.12.12 0 000-.136c-.412-.621-1.242-1.75-2.366-2.717C11.46 3.242 10.11 2.5 8.636 2.5c-.96 0-1.886.28-2.748.747L4.667 2.37C5.734 1.712 6.887 1 8.636 1c1.981 0 3.671.992 4.933 2.078 1.27 1.091 2.187 2.345 2.637 3.023a1.62 1.62 0 010 1.798z"></path></svg>'),qb=U('<button type="button"><!></button>'),Gb=U(`<div class="file-tree flex flex-col h-full bg-bg-secondary svelte-1d6le8d" role="tree"><!> <div class="px-2 py-1.5 border-b border-border-default flex items-center gap-1.5"><div class="status-filter-container relative flex-shrink-0 svelte-1d6le8d"><div class="flex items-center"><button type="button"><!></button> <button type="button" aria-label="Filter by status"><svg width="10" height="10" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M4.427 7.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 7H4.604a.25.25 0 00-.177.427z"></path></svg></button></div> <!></div> <div class="relative flex-1 min-w-0"><svg class="absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-tertiary pointer-events-none" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg> <input type="text" class="w-full pl-7 pr-7 py-1 text-xs bg-bg-primary text-text-primary border border-border-default rounded
198
+ placeholder:text-text-tertiary focus:outline-none focus:ring-1 focus:ring-accent-emphasis focus:border-accent-emphasis" placeholder="Filter files..."/> <!></div> <div class="flex items-center gap-0.5 shrink-0"><button type="button" class="w-5 h-5 flex items-center justify-center text-text-tertiary hover:text-text-primary rounded transition-colors" title="Expand all directories" aria-label="Expand all directories"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6a2 2 0 0 1 2-2h5l2 2h7a2 2 0 0 1 2 2v1"></path><path d="M3 10h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-8z"></path><path d="M12 12v6"></path><path d="M9 15h6"></path></svg></button> <button type="button" class="w-5 h-5 flex items-center justify-center text-text-tertiary hover:text-text-primary rounded transition-colors" title="Collapse all directories" aria-label="Collapse all directories"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6a2 2 0 0 1 2-2h5l2 2h7a2 2 0 0 1 2 2v1"></path><path d="M3 10h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-8z"></path><path d="M9 15h6"></path></svg></button></div> <!></div> <div class="file-tree-content flex-1 overflow-y-auto"><!></div> <div class="shrink-0 h-6 border-t border-border-default flex items-center px-2 bg-bg-tertiary gap-1 min-w-0 overflow-hidden"><!> <!> <div class="ml-auto flex items-center gap-0.5 shrink-0"><!> <!> <!></div></div></div>`);function Kb(t,e){Kt(e,!0);const r=(fe,be=Wl,We=Wl)=>{var Je=_t(),ut=Ye(Je);{var Xe=ke=>{var De=kb();let J;var Z=E(De);Z.__click=()=>le(be().path);var re=E(Z);let F;var Q=P(re,4),ve=E(Q),Te=P(Q,2);{var rt=dt=>{var At=wb();L(dt,At)},ct=dt=>{var At=_t(),yt=Ye(At);{var st=ot=>{var Lt=Sb();L(ot,Lt)};Y(yt,ot=>{B(be())&&ot(st)},!0)}L(dt,At)};Y(Te,dt=>{be().status==="ignored"?dt(rt):dt(ct,!1)})}var wt=P(Z,2);{var he=dt=>{var At=_t(),yt=Ye(At);{var st=Lt=>{var rr=_t(),gr=Ye(rr);Gt(gr,17,()=>be().children,ur=>ur.path,(ur,Ot)=>{r(ur,()=>i(Ot),()=>We()+1)}),L(Lt,rr)},ot=Lt=>{var rr=_t(),gr=Ye(rr);{var ur=Ot=>{var Ft=Cb();de(()=>hi(Ft,`padding-left: ${1+(We()+1)*1.5}rem`)),L(Ot,Ft)};Y(gr,Ot=>{i(W).has(be().path)&&Ot(ur)},!0)}L(Lt,rr)};Y(yt,Lt=>{be().children!==void 0?Lt(st):Lt(ot,!1)})}L(dt,At)};Y(wt,dt=>{V(be().path)&&dt(he)})}de((dt,At)=>{J=Ve(De,1,"directory-node",null,J,{"opacity-50":be().status==="ignored"}),Ge(De,"aria-expanded",dt),hi(Z,`padding-left: ${1+We()*1.5}rem`),Ge(Z,"aria-label",`Toggle directory ${be().name??""}`),F=Ve(re,0,"chevron w-3 h-3 text-text-tertiary shrink-0 transition-transform svelte-1d6le8d",null,F,At),se(ve,be().name)},[()=>V(be().path),()=>({"rotate-90":V(be().path)})]),Sr("dragstart",Z,dt=>{var At,yt;(At=dt.dataTransfer)==null||At.setData("application/x-qraftbox-path",be().path),(yt=dt.dataTransfer)==null||yt.setData("text/plain",be().path)}),L(ke,De)},ie=ke=>{{let De=ye(()=>e.selectedPath===be().path);xb(ke,{get node(){return be()},get depth(){return We()},get selected(){return i(De)},onSelect:()=>e.onFileSelect(be().path)})}};Y(ut,ke=>{be().isDirectory?ke(Xe):ke(ie,!1)})}L(fe,Je)},n=Re(e,"changedCount",3,void 0),s=Re(e,"contextId",3,null),d=Re(e,"showIgnored",3,!1);Re(e,"showAllFiles",3,!1);const _=Re(e,"onShowIgnoredChange",3,void 0);Re(e,"onShowAllFilesChange",3,void 0);const o=Re(e,"onNarrow",3,void 0),a=Re(e,"onWiden",3,void 0),c=Re(e,"canNarrow",3,!0),g=Re(e,"canWiden",3,!0),h=Re(e,"onDirectoryExpand",3,void 0),v=Re(e,"onLoadFullTree",3,void 0),m=Re(e,"onReload",3,void 0),w=Re(e,"currentDirectory",3,""),b=52;let f=q(!1),u=q("idle"),l=null;function p(fe,be){return fe.length<=be?fe:`...${fe.slice(-49)}`}const y=ye(()=>w().trim().length>0),k=ye(()=>w().length>b),C=ye(()=>p(w(),b));async function A(){if(i(y)){try{if(typeof navigator.clipboard<"u"&&window.isSecureContext)await navigator.clipboard.writeText(w());else{const fe=document.createElement("textarea");fe.value=w(),fe.setAttribute("readonly",""),fe.style.position="absolute",fe.style.left="-9999px",document.body.appendChild(fe),fe.select();const be=document.execCommand("copy");if(document.body.removeChild(fe),!be)throw new Error("Copy command failed")}x(u,"copied")}catch{x(u,"failed")}l!==null&&clearTimeout(l),l=setTimeout(()=>{x(u,"idle"),l=null},1200)}}gt(()=>()=>{l!==null&&clearTimeout(l)});let S=q(xt(new Set)),T=q(""),D=q(null),H=q(!1),W=q(xt(new Set)),M=q(0);async function G(){if(!(s()===null||s()===void 0))try{const fe=await fetch(`/api/ctx/${s()}/status`);if(fe.ok){const be=await fe.json();x(M,be.staged.length+be.modified.length+be.untracked.length+be.conflicts.length)}}catch{}}let X=e.mode;gt(()=>{e.mode!==X&&(e.mode==="all"&&x(D,null),X=e.mode)}),gt(()=>{G();const fe=setInterval(()=>{G()},3e4);return()=>{clearInterval(fe)}});function le(fe){const be=new Set(i(S));if(be.has(fe))be.delete(fe),x(S,be,!0);else if(be.add(fe),x(S,be,!0),h()!==void 0){const We=me(e.tree,fe);if(We!==null&&We.isDirectory&&We.children===void 0){const Je=new Set(i(W));Je.add(fe),x(W,Je,!0),h()(fe).finally(()=>{const ut=new Set(i(W));ut.delete(fe),x(W,ut,!0)})}}}function me(fe,be){if(fe.path===be)return fe;if(!fe.isDirectory||fe.children===void 0)return null;for(const We of fe.children){const Je=me(We,be);if(Je!==null)return Je}return null}function xe(fe){if(fe.isDirectory){if(fe.children===void 0)return!0;for(const be of fe.children)if(xe(be))return!0}return!1}function R(fe){const be=[];if(fe.isDirectory&&fe.children){fe.path!==""&&be.push(fe.path);for(const We of fe.children)be.push(...R(We))}return be}async function j(){let fe;v()!==void 0&&xe(e.tree)&&(fe=await v()());const be=fe??i(z)??e.tree;x(S,new Set(R(be)),!0)}function N(){x(S,new Set,!0)}function V(fe){return i(T)!==""?i(ce).has(fe):i(S).has(fe)}function $(fe){if(i(T)==="")return!0;const be=i(T).toLowerCase();return fe.name.toLowerCase().includes(be)}function ee(fe,be){const We=new Set;if(fe.isDirectory&&fe.children){if($(fe)){for(const Je of be)We.add(Je);We.add(fe.path)}for(const Je of fe.children){const ut=ee(Je,[...be,fe.path]);for(const Xe of ut)We.add(Xe)}We.size>0&&We.add(fe.path)}else if($(fe)){for(const Je of be)We.add(Je);We.add(fe.path)}return We}const ce=ye(()=>i(T)===""?new Set:ee(e.tree,[]));gt(()=>{i(T)!==""&&xe(e.tree)&&v()!==void 0&&v()()});function ue(fe,be=!1){if(fe.isDirectory){if(fe.children===void 0||fe.children.length===0)return e.mode==="diff"||i(T)!==""||i(D)!==null?null:fe;const We=i(T)!==""&&$(fe),Je=be||We,ut=fe.children.map(Xe=>ue(Xe,Je)).filter(Xe=>Xe!==null);return ut.length===0?null:{...fe,children:ut}}else return e.mode==="diff"&&(fe.status===void 0||fe.status==="ignored")||i(D)!==null&&fe.status!==i(D)||!be&&i(T)!==""&&!$(fe)?null:fe}function B(fe){if(!fe.isDirectory)return!1;if(fe.children===void 0)return fe.status!==void 0;for(const be of fe.children)if(be.status!==void 0||be.isDirectory&&B(be))return!0;return!1}function I(fe){let be=0,We=0;function Je(ut){if(ut.isDirectory&&ut.children)for(const Xe of ut.children)Je(Xe);else We++,ut.status!==void 0&&be++}return Je(fe),{changed:be,total:We}}const z=ye(()=>ue(e.tree)),O=ye(()=>{if(i(T)==="")return 0;function fe(be){let We=0;if($(be)&&(We=1),be.isDirectory&&be.children)for(const Je of be.children)We+=fe(Je);return We}return fe(e.tree)}),ne=ye(()=>I(e.tree)),ae=ye(()=>{let fe=0,be=0,We=0;function Je(ut){if(ut.isDirectory&&ut.children)for(const Xe of ut.children)Je(Xe);else ut.status==="added"?fe++:ut.status==="modified"?be++:ut.status==="deleted"&&We++}return Je(e.tree),{added:fe,modified:be,deleted:We}});let te=null,ge=!1;gt(()=>{const fe=e.selectedPath;if(fe===te||(te=fe,fe===null))return;if(!ge){ge=!0;return}const be=fe.split("/");if(be.length<=1)return;const We=new Set(i(S));let Je=!1;for(let ut=1;ut<be.length;ut++){const Xe=be.slice(0,ut).join("/");We.has(Xe)||(We.add(Xe),Je=!0)}Je&&x(S,We,!0)}),gt(()=>{if(!i(H))return;function fe(be){be.target.closest(".status-filter-container")||x(H,!1)}return document.addEventListener("click",fe),()=>{document.removeEventListener("click",fe)}});var we=Gb(),Ie=E(we);{var Pe=fe=>{var be=Pb(),We=E(be),Je=E(We);let ut;var Xe=E(Je),ie=P(We,2),ke=E(ie);ke.__click=A;var De=P(ke,2);{var J=Z=>{var re=Tb();re.__click=()=>{x(f,!i(f))};var F=E(re),Q=E(F);{var ve=rt=>{var ct=Eb();L(rt,ct)},Te=rt=>{var ct=Ab();L(rt,ct)};Y(Q,rt=>{i(f)?rt(ve):rt(Te,!1)})}de(()=>{Ge(re,"aria-label",i(f)?"Collapse directory path":"Show full directory path"),Ge(re,"title",i(f)?"Collapse path":"Show full path"),Ge(re,"aria-pressed",i(f))}),L(Z,re)};Y(De,Z=>{i(k)&&Z(J)})}de(()=>{ut=Ve(Je,1,"text-xs text-text-secondary font-mono leading-4",null,ut,{truncate:!i(f),"break-all":i(f)}),Ge(Je,"title",w()),se(Xe,i(f)?w():i(C)),Ge(ke,"title",i(u)==="copied"?"Copied":i(u)==="failed"?"Copy failed":"Copy current directory")}),L(fe,be)};Y(Ie,fe=>{i(y)&&fe(Pe)})}var Se=P(Ie,2),Be=E(Se),Ue=E(Be),je=E(Ue);let ze;je.__click=()=>e.onModeChange(e.mode==="diff"?"all":"diff");var Ne=E(je);{var _e=fe=>{var be=Db(),We=P(Ye(be),2),Je=E(We);{var ut=ie=>{var ke=Lb(),De=E(ke);de(()=>se(De,`+${i(ae).added??""}`)),L(ie,ke)},Xe=ie=>{var ke=_t(),De=Ye(ke);{var J=re=>{var F=Rb(),Q=E(F);de(()=>se(Q,`M${i(ae).modified??""}`)),L(re,F)},Z=re=>{var F=_t(),Q=Ye(F);{var ve=rt=>{var ct=Ib(),wt=E(ct);de(()=>se(wt,`-${i(ae).deleted??""}`)),L(rt,ct)},Te=rt=>{var ct=Lr();de(()=>se(ct,n()??i(ne).changed)),L(rt,ct)};Y(Q,rt=>{i(D)==="deleted"?rt(ve):rt(Te,!1)},!0)}L(re,F)};Y(De,re=>{i(D)==="modified"?re(J):re(Z,!1)},!0)}L(ie,ke)};Y(Je,ie=>{i(D)==="added"?ie(ut):ie(Xe,!1)})}L(fe,be)},Me=fe=>{var be=Mb();L(fe,be)};Y(Ne,fe=>{e.mode==="diff"?fe(_e):fe(Me,!1)})}var oe=P(je,2);let pe;oe.__click=()=>x(H,!i(H));var Ce=P(Ue,2);{var He=fe=>{var be=Ob(),We=E(be);let Je;We.__click=()=>{x(D,null),x(H,!1)};var ut=E(We),Xe=E(ut);{var ie=Ft=>{var hr=Lr("✓");L(Ft,hr)};Y(Xe,Ft=>{i(D)===null&&Ft(ie)})}var ke=P(ut,4),De=E(ke),J=P(We,2);let Z;J.__click=()=>{x(D,"added"),x(H,!1)};var re=E(J),F=E(re);{var Q=Ft=>{var hr=Lr("✓");L(Ft,hr)};Y(F,Ft=>{i(D)==="added"&&Ft(Q)})}var ve=P(re,4),Te=E(ve),rt=P(J,2);let ct;rt.__click=()=>{x(D,"modified"),x(H,!1)};var wt=E(rt),he=E(wt);{var dt=Ft=>{var hr=Lr("✓");L(Ft,hr)};Y(he,Ft=>{i(D)==="modified"&&Ft(dt)})}var At=P(wt,4),yt=E(At),st=P(rt,2);let ot;st.__click=()=>{x(D,"deleted"),x(H,!1)};var Lt=E(st),rr=E(Lt);{var gr=Ft=>{var hr=Lr("✓");L(Ft,hr)};Y(rr,Ft=>{i(D)==="deleted"&&Ft(gr)})}var ur=P(Lt,4),Ot=E(ur);de(()=>{Je=Ve(We,1,"status-filter-option svelte-1d6le8d",null,Je,{"status-filter-option--active":i(D)===null}),se(De,i(ne).changed),Z=Ve(J,1,"status-filter-option svelte-1d6le8d",null,Z,{"status-filter-option--active":i(D)==="added"}),se(Te,i(ae).added),ct=Ve(rt,1,"status-filter-option svelte-1d6le8d",null,ct,{"status-filter-option--active":i(D)==="modified"}),se(yt,i(ae).modified),ot=Ve(st,1,"status-filter-option svelte-1d6le8d",null,ot,{"status-filter-option--active":i(D)==="deleted"}),se(Ot,i(ae).deleted)}),L(fe,be)};Y(Ce,fe=>{i(H)&&fe(He)})}var $e=P(Be,2),nt=P(E($e),2);nt.__keydown=fe=>{fe.key==="Escape"&&x(T,"")};var Fe=P(nt,2);{var qe=fe=>{var be=Bb();be.__click=()=>{x(T,"")},L(fe,be)};Y(Fe,fe=>{i(T)!==""&&fe(qe)})}var at=P($e,2),Ze=E(at);Ze.__click=j;var Le=P(Ze,2);Le.__click=N;var Ae=P(at,2);{var it=fe=>{var be=Nb(),We=E(be);de(()=>se(We,i(O))),L(fe,be)};Y(Ae,fe=>{i(T)!==""&&fe(it)})}var tt=P(Se,2),vt=E(tt);{var ft=fe=>{var be=jb();L(fe,be)},ht=fe=>{var be=_t(),We=Ye(be);Gt(We,17,()=>i(z).children??[],Je=>Je.path,(Je,ut)=>{r(Je,()=>i(ut),()=>0)}),L(fe,be)};Y(vt,fe=>{i(z)===null?fe(ft):fe(ht,!1)})}var pt=P(tt,2),bt=E(pt);{var Tt=fe=>{var be=Hb();be.__click=function(...We){var Je;(Je=m())==null||Je.apply(this,We)},L(fe,be)};Y(bt,fe=>{m()&&fe(Tt)})}var et=P(bt,2);{var Ct=fe=>{var be=Fb(),We=E(be);de(()=>se(We,`${i(M)??""} uncommitted`)),L(fe,be)};Y(et,fe=>{i(M)>0&&fe(Ct)})}var kt=P(et,2),Mt=E(kt);{var Pt=fe=>{var be=Ub();be.__click=function(...We){var Je;(Je=o())==null||Je.apply(this,We)},de(()=>{Ve(be,1,`w-5 h-5 flex items-center justify-center rounded transition-colors ${c()?"text-text-tertiary hover:text-text-primary cursor-pointer":"text-text-quaternary cursor-default"}`),be.disabled=!c()}),L(fe,be)};Y(Mt,fe=>{o()&&fe(Pt)})}var Rt=P(Mt,2);{var It=fe=>{var be=Vb();be.__click=function(...We){var Je;(Je=a())==null||Je.apply(this,We)},de(()=>{Ve(be,1,`w-5 h-5 flex items-center justify-center rounded transition-colors ${g()?"text-text-tertiary hover:text-text-primary cursor-pointer":"text-text-quaternary cursor-default"}`),be.disabled=!g()}),L(fe,be)};Y(Rt,fe=>{a()&&fe(It)})}var Ht=P(Rt,2);{var Et=fe=>{var be=qb();be.__click=()=>{var Xe;return(Xe=_())==null?void 0:Xe(!d())};var We=E(be);{var Je=Xe=>{var ie=zb();L(Xe,ie)},ut=Xe=>{var ie=Wb();L(Xe,ie)};Y(We,Xe=>{d()?Xe(Je):Xe(ut,!1)})}de(()=>{Ve(be,1,`w-5 h-5 flex items-center justify-center rounded transition-colors ${d()?"text-text-primary":"text-text-tertiary hover:text-text-primary"}`),Ge(be,"title",d()?"Hide ignored files":"Show ignored files"),Ge(be,"aria-label",d()?"Hide ignored files":"Show ignored files"),Ge(be,"aria-pressed",d())}),L(fe,be)};Y(Ht,fe=>{_()&&fe(Et)})}de(()=>{ze=Ve(je,1,"mode-toggle-btn svelte-1d6le8d",null,ze,{"mode-toggle-btn--diff":e.mode==="diff","mode-toggle-btn--filtered":i(D)!==null}),Ge(je,"aria-label",e.mode==="diff"?`Diff only (${n()??i(ne).changed} changed) - click for all`:"All files - click for diff only"),Ge(je,"title",e.mode==="diff"?`Diff (${n()??i(ne).changed})`:"All"),pe=Ve(oe,1,"status-filter-arrow svelte-1d6le8d",null,pe,{"status-filter-arrow--open":i(H),"status-filter-arrow--filtered":i(D)!==null}),Ge(oe,"aria-expanded",i(H))}),_r(nt,()=>i(T),fe=>x(T,fe)),L(t,we),Xt()}tr(["click","keydown"]);function Xb(t){const e=[];let r=[],n;for(const s of t.chunks)for(const d of s.changes)if(d.type==="delete")r.push(d),n===void 0&&d.oldLine!==void 0&&(n=d.oldLine);else{const _=Nc(r,n),o=d.type==="add"?"added":"unchanged";d.newLine!==void 0&&e.push({lineNumber:d.newLine,content:d.content,changeType:o,deletedBefore:_}),r=[],n=void 0}if(r.length>0){const s=Nc(r,n);if(s!==void 0){const d=e[e.length-1],_=d!==void 0?d.lineNumber+1:1;e.push({lineNumber:_,content:"",changeType:"unchanged",deletedBefore:s})}}return e}function Nc(t,e){if(t.length===0||e===void 0)return;const r=t.map(s=>s.content),n=e+t.length-1;return{id:`deleted-${e}-${n}`,lines:r,originalStart:e,originalEnd:n}}function jc(){return{expandedBlocks:new Set}}function Jb(){let t=jc();return{get expandedBlocks(){return Object.freeze(new Set(t.expandedBlocks))},toggleBlock(e){const r=new Set(t.expandedBlocks);r.has(e)?r.delete(e):r.add(e),t={expandedBlocks:r}},expandBlock(e){if(!t.expandedBlocks.has(e)){const r=new Set(t.expandedBlocks);r.add(e),t={expandedBlocks:r}}},collapseBlock(e){if(t.expandedBlocks.has(e)){const r=new Set(t.expandedBlocks);r.delete(e),t={expandedBlocks:r}}},expandAll(e){const r=new Set(t.expandedBlocks);for(const n of e)r.add(n);t={expandedBlocks:r}},collapseAll(){t={expandedBlocks:new Set}},isExpanded(e){return t.expandedBlocks.has(e)},reset(){t=jc()}}}var Yb=U(`<button type="button" class="comment-trigger absolute left-0 top-1 w-6 h-6 flex items-center justify-center
199
+ rounded bg-accent-emphasis text-white text-xs font-bold
200
+ opacity-0 group-hover/gutter:opacity-100
201
+ hover:bg-accent-fg transition-opacity z-10 cursor-pointer svelte-2vdjal">+</button>`),Qb=U('<span class="highlighted-line svelte-2vdjal"><!></span>'),Zb=U('<pre class="m-0 p-0 svelte-2vdjal"> </pre>'),$b=U('<div role="option" tabindex="0"><div class="w-16 flex-shrink-0 px-2 flex items-start justify-end text-text-secondary border-r border-border-default relative group/gutter"><!> <span> </span></div> <div><span class="font-bold"> </span></div> <div class="flex-1 px-2 overflow-x-auto"><!></div></div>');function e1(t,e){Kt(e,!0);const r=Re(e,"highlighted",3,void 0),n=Re(e,"selected",3,!1),s=Re(e,"onSelect",3,void 0),d=Re(e,"onLongPress",3,void 0),_=Re(e,"onCommentClick",3,void 0);let o=q(void 0);function a(){switch(e.line.changeType){case"added":return"bg-diff-add-bg";case"modified":return"bg-attention-muted";case"unchanged":return"bg-transparent";default:const M=e.line.changeType;throw new Error(`Unhandled change type: ${M}`)}}function c(){switch(e.line.changeType){case"added":return"+";case"modified":return"~";case"unchanged":return" ";default:const M=e.line.changeType;throw new Error(`Unhandled change type: ${M}`)}}function g(){switch(e.line.changeType){case"added":return"text-success-fg";case"modified":return"text-attention-fg";case"unchanged":return"text-text-secondary";default:const M=e.line.changeType;throw new Error(`Unhandled change type: ${M}`)}}function h(){s()!==void 0&&s()()}function v(){d()!==void 0&&x(o,setTimeout(()=>{d()!==void 0&&d()()},500),!0)}function m(){i(o)!==void 0&&(clearTimeout(i(o)),x(o,void 0))}function w(){i(o)!==void 0&&(clearTimeout(i(o)),x(o,void 0))}function b(M){(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),h())}var f=$b();f.__click=h,f.__keydown=b,f.__pointerdown=v,f.__pointerup=m;var u=E(f),l=E(u);{var p=M=>{var G=Yb();G.__click=X=>{var le;X.stopPropagation(),(le=_())==null||le(X.shiftKey)},de(()=>Ge(G,"aria-label",`Add comment on line ${e.line.lineNumber??""}`)),L(M,G)};Y(l,M=>{_()!==void 0&&M(p)})}var y=P(l,2),k=E(y),C=P(u,2),A=E(C),S=E(A),T=P(C,2),D=E(T);{var H=M=>{var G=Qb(),X=E(G);Gi(X,r),L(M,G)},W=M=>{var G=Zb(),X=E(G);de(()=>se(X,e.line.content)),L(M,G)};Y(D,M=>{r()!==void 0?M(H):M(W,!1)})}de((M,G,X)=>{Ve(f,1,`current-state-line-row flex font-mono text-xs leading-5 cursor-pointer select-none ${M??""} ${n()?"ring-2 ring-accent-emphasis ring-inset":""}`,"svelte-2vdjal"),Ge(f,"aria-label",`Line ${e.line.lineNumber??""}: ${e.line.content??""}`),Ge(f,"aria-selected",n()),se(k,e.line.lineNumber),Ve(C,1,`w-8 flex-shrink-0 flex items-start justify-center ${G??""} border-r border-border-default`,"svelte-2vdjal"),se(S,X)},[a,g,c]),Sr("pointerleave",f,w),L(t,f),Xt()}tr(["click","keydown","pointerdown","pointerup"]);var t1=U(`<div class="deleted-marker relative min-h-[28px] flex items-center cursor-pointer
202
+ group transition-all duration-150 svelte-6d0us2" role="button" tabindex="0" aria-expanded="false"><div class="w-16 flex-shrink-0 px-2 flex items-center justify-end text-text-tertiary border-r border-border-default"><span class="text-xs opacity-60"> </span></div> <div class="w-8 flex-shrink-0 flex items-center justify-center text-danger-fg border-r border-border-default"><span class="font-bold text-xs">-</span></div> <div class="flex-1 relative py-[13px]"><div></div> <div class="absolute left-3 top-1/2 -translate-y-1/2 px-2 py-1
203
+ bg-danger-subtle text-danger-fg text-xs rounded
204
+ opacity-0 group-hover:opacity-100 group-focus:opacity-100
205
+ transition-opacity duration-150 pointer-events-none
206
+ whitespace-nowrap"> </div></div></div>`);function r1(t,e){Kt(e,!0);const r=Re(e,"onPreview",3,void 0);let n=q(void 0),s=q(!1),d=q(!1);const _=ye(()=>e.block.lines.length===1?"1 deleted line":`${e.block.lines.length} deleted lines`),o=ye(()=>e.block.originalStart===e.block.originalEnd?`line ${e.block.originalStart}`:`lines ${e.block.originalStart}-${e.block.originalEnd}`);function a(){e.onExpand()}function c(){x(d,!0),r()!==void 0&&x(n,setTimeout(()=>{r()!==void 0&&r()()},500),!0)}function g(){x(d,!1),i(n)!==void 0&&(clearTimeout(i(n)),x(n,void 0))}function h(){x(d,!1),x(s,!1),i(n)!==void 0&&(clearTimeout(i(n)),x(n,void 0))}function v(){x(s,!0)}function m(C){(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),e.onExpand())}var w=t1();w.__click=a,w.__pointerdown=c,w.__pointerup=g,w.__keydown=m;var b=E(w),f=E(b),u=E(f),l=P(b,4),p=E(l),y=P(p,2),k=E(y);de(()=>{Ge(w,"aria-label",`Expand ${i(_)??""} (original ${i(o)??""})`),Ge(w,"data-block-id",e.block.id),se(u,e.block.originalStart),Ve(p,1,`absolute left-0 right-0 top-1/2 -translate-y-1/2 h-[2px] bg-danger-emphasis
207
+ ${i(s)||i(d)?"h-[4px]":""}`),se(k,`${i(_)??""} - tap to expand`)}),Sr("pointerleave",w,h),Sr("pointerenter",w,v),L(t,w),Xt()}tr(["click","pointerdown","pointerup","keydown"]);var i1=U('<span class="highlighted-line svelte-ou6g74"><!></span>'),n1=U('<pre class="m-0 p-0 svelte-ou6g74"> </pre>'),s1=U('<div class="flex font-mono text-xs leading-5 bg-danger-subtle border-b border-danger-emphasis last:border-b-0"><div class="w-16 flex-shrink-0 px-2 flex items-start justify-end text-danger-fg/60 border-r border-danger-emphasis"><span> </span></div> <div class="w-8 flex-shrink-0 flex items-start justify-center text-danger-fg border-r border-danger-emphasis"><span class="font-bold">-</span></div> <div class="flex-1 px-2 text-danger-fg overflow-x-auto"><!></div></div>'),o1=U(`<div class="expanded-deleted-block border-l-4 border-danger-emphasis bg-danger-subtle overflow-hidden svelte-ou6g74" role="region"><div class="flex items-center justify-between px-3 py-1 min-h-[28px] bg-danger-subtle border-b border-danger-emphasis"><div class="flex items-center gap-2 text-sm"><span class="text-danger-fg font-medium"> </span> <span class="text-danger-fg/60 text-xs"> </span></div> <button type="button" class="px-3 py-1.5 min-h-[32px] text-xs font-medium rounded
208
+ bg-danger-subtle text-danger-fg border border-danger-emphasis
209
+ hover:bg-danger-emphasis active:bg-danger-emphasis
210
+ focus:outline-none focus:ring-2 focus:ring-danger-emphasis focus:ring-offset-2 focus:ring-offset-danger-subtle
211
+ transition-colors duration-150" aria-label="Collapse deleted content"><span class="flex items-center gap-1.5"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="17 11 12 6 7 11"></polyline><polyline points="17 18 12 13 7 18"></polyline></svg> Collapse</span></button></div> <div class="deleted-lines"></div></div>`);function a1(t,e){Kt(e,!0);const r=Re(e,"highlightedLines",3,void 0),n=ye(()=>e.block.lines.length===1?"1 deleted line":`${e.block.lines.length} deleted lines`);function s(f){return e.block.originalStart+f}function d(){e.onCollapse()}function _(f){f.key==="Escape"&&(f.preventDefault(),e.onCollapse())}var o=o1();o.__keydown=_;var a=E(o),c=E(a),g=E(c),h=E(g),v=P(g,2),m=E(v),w=P(c,2);w.__click=d;var b=P(a,2);Gt(b,21,()=>e.block.lines,ui,(f,u,l)=>{var p=s1(),y=E(p),k=E(y),C=E(k),A=P(y,4),S=E(A);{var T=H=>{var W=i1(),M=E(W);Gi(M,()=>r()[l]),L(H,W)},D=H=>{var W=n1(),M=E(W);de(()=>se(M,i(u))),L(H,W)};Y(S,H=>{r()!==void 0&&r()[l]!==void 0?H(T):H(D,!1)})}de(H=>se(C,H),[()=>s(l)]),L(f,p)}),de(()=>{Ge(o,"aria-label",`Expanded deleted content: ${i(n)??""}`),Ge(o,"data-block-id",e.block.id),se(h,i(n)),se(m,`(original lines ${e.block.originalStart??""}-${e.block.originalEnd??""})`)}),L(t,o),Xt()}tr(["keydown","click"]);var l1=U('<button type="button" title="Side by Side"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="2" width="6" height="12" rx="1" stroke="currentColor" stroke-width="1.5"></rect><rect x="9" y="2" width="6" height="12" rx="1" stroke="currentColor" stroke-width="1.5"></rect></svg></button>'),c1=U('<div class="flex items-center justify-center h-full text-text-secondary"><span>No content to display</span></div>'),d1=U('<div class="mt-2 flex items-center justify-between gap-3 rounded border border-accent-emphasis/40 bg-accent-muted/10 px-2 py-1 text-xs text-text-secondary"><span class="truncate">AI session submitted.</span> <div class="flex items-center gap-2"><a class="text-accent-fg underline underline-offset-2 hover:opacity-80">View session history</a> <button type="button" class="text-text-secondary hover:text-text-primary">Close</button></div></div>'),u1=U(`<div class="max-w-4xl border-t-2 border-b-2 border-accent-emphasis bg-bg-secondary p-3"><textarea class="w-full min-h-28 resize-y rounded border border-border-default bg-bg-primary
212
+ px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-emphasis" placeholder="Ask AI about this code..."></textarea> <div class="flex items-center justify-between mt-2"><div class="text-xs text-text-tertiary font-mono"> </div> <div class="flex items-center gap-2"><button type="button" class="px-3 py-1 text-sm text-text-secondary hover:text-text-primary">Cancel</button> <!></div></div> <!></div>`),h1=U("<div><!></div> <!>",1),f1=U("<!> <!>",1),p1=U('<div class="lines-container svelte-wgyctu"></div>'),_1=U('<div class="current-state-view flex flex-col h-full bg-bg-primary svelte-wgyctu" role="region"><div class="flex items-center justify-between px-2 min-h-[32px] bg-bg-secondary border-b border-border-default sticky top-0 z-10"><div class="flex items-center gap-2"><span class="text-xs font-medium text-text-primary truncate max-w-[300px]"> </span> <span class="text-[10px] text-text-secondary"> </span></div> <div class="flex items-center gap-1"><div class="flex items-center border border-border-default rounded-md overflow-hidden"><button type="button" title="Full File"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 2.5A1.5 1.5 0 014.5 1h5.586a1 1 0 01.707.293l2.414 2.414a1 1 0 01.293.707V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11z" stroke="currentColor" stroke-width="1.5"></path><line x1="5.5" y1="6" x2="11" y2="6" stroke="currentColor" stroke-width="1.2"></line><line x1="5.5" y1="8.5" x2="11" y2="8.5" stroke="currentColor" stroke-width="1.2"></line><line x1="5.5" y1="11" x2="9" y2="11" stroke="currentColor" stroke-width="1.2"></line></svg></button> <!> <button type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="2" width="14" height="12" rx="1" stroke="currentColor" stroke-width="1.5"></rect><line x1="4" y1="5.5" x2="12" y2="5.5" stroke="currentColor" stroke-width="1.2"></line><line x1="4" y1="8" x2="12" y2="8" stroke="currentColor" stroke-width="1.2"></line><line x1="4" y1="10.5" x2="10" y2="10.5" stroke="currentColor" stroke-width="1.2"></line></svg></button> <button type="button" title="Current"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 2.5A1.5 1.5 0 014.5 1h5.586a1 1 0 01.707.293l2.414 2.414a1 1 0 01.293.707V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11z" stroke="currentColor" stroke-width="1.5"></path></svg></button></div> <button type="button" title="Previous file" aria-label="Previous file"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 1.06L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"></path></svg></button> <button type="button" title="Next file" aria-label="Next file"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8.22 3.47a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.19 9H3.75a.75.75 0 0 1 0-1.5h7.44L8.22 4.53a.75.75 0 0 1 0-1.06Z"></path></svg></button></div></div> <div class="flex-1 overflow-auto"><!></div></div>');function v1(t,e){Kt(e,!0);const r=Re(e,"viewMode",3,"current-state"),n=Re(e,"selectedHasDiff",3,!0),s=Re(e,"isIphone",3,!1),d=Re(e,"onSetViewMode",3,void 0),_=Re(e,"onLineSelect",3,void 0),o=Re(e,"onCommentSubmit",3,void 0),a=Re(e,"submittedSessionId",3,null),c=Re(e,"submittedSessionHistoryHref",3,null),g=Re(e,"onDismissSubmittedSession",3,void 0),h=Re(e,"onNavigatePrev",3,void 0),v=Re(e,"onNavigateNext",3,void 0),m=Jb(),w=ye(()=>Xb(e.file));let b=q(xt(new Map)),f=q(xt(new Map));gt(()=>{const te=i(w),ge=e.file.path,Ie=te.map(Se=>Se.content).join(`
213
+ `);Ns(Ie,ge).then(Se=>{const Be=new Map;for(let Ue=0;Ue<te.length;Ue++){const je=te[Ue],ze=Se[Ue];je!==void 0&&ze!==void 0&&Be.set(je.lineNumber,ze)}x(b,Be,!0)});const Pe=[];for(const Se of te)Se.deletedBefore!==void 0&&Pe.push(Se.deletedBefore);Pe.length>0&&Promise.all(Pe.map(Se=>Ns(Se.lines.join(`
214
+ `),ge).then(Be=>[Se.id,Be]))).then(Se=>{const Be=new Map;for(const[Ue,je]of Se)Be.set(Ue,je);x(f,Be,!0)})});let u=q(void 0),l=q(null),p=q("");const y=ye(()=>{if(i(l)===null)return[];const te=[];for(let ge=i(l).startLine;ge<=i(l).endLine;ge++)te.push(ge);return te}),k=ye(()=>{if(i(l)===null)return"";const te=i(l).startLine===i(l).endLine?`L${i(l).startLine}`:`L${i(l).startLine}-L${i(l).endLine}`;return`${e.file.path}:${te}`});function C(te,ge){if(ge&&i(l)!==null){const we=Math.min(i(l).startLine,te),Ie=Math.max(i(l).endLine,te);x(l,{startLine:we,endLine:Ie},!0)}else x(l,{startLine:te,endLine:te},!0)}function A(te,ge){i(l)!==null&&o()!==void 0&&o()(i(l).startLine,i(l).endLine,"new",e.file.path,te,ge),x(p,"")}function S(){x(l,null),x(p,"")}function T(te){x(u,te,!0),_()!==void 0&&_()(te)}function D(te){m.toggleBlock(te)}function H(te){return m.isExpanded(te)}function W(te){if(!(te.target instanceof HTMLInputElement||te.target instanceof HTMLTextAreaElement)){if(te.key==="j"&&i(u)!==void 0){const we=i(w).find(Ie=>Ie.lineNumber>i(u));we!==void 0&&T(we.lineNumber)}else if(te.key==="k"&&i(u)!==void 0){const we=i(w).filter(Ie=>Ie.lineNumber<i(u));if(we.length>0){const Ie=we[we.length-1];Ie!==void 0&&T(Ie.lineNumber)}}}}gt(()=>{e.file.path,m.reset()});var M=_1();Sr("keydown",hn,W);var G=E(M),X=E(G),le=E(X),me=E(le),xe=P(le,2),R=E(xe),j=P(X,2),N=E(j),V=E(N);V.__click=()=>{var te;return(te=d())==null?void 0:te("full-file")};var $=P(V,2);{var ee=te=>{var ge=l1();ge.__click=()=>{var we;n()&&((we=d())==null||we("side-by-side"))},de(()=>{Ve(ge,1,`p-1 border-l border-border-default transition-colors
215
+ ${n()?r()==="side-by-side"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover":"text-text-disabled cursor-not-allowed opacity-40"}`),ge.disabled=!n()}),L(te,ge)};Y($,te=>{s()||te(ee)})}var ce=P($,2);ce.__click=()=>{var te;n()&&((te=d())==null||te("inline"))};var ue=P(ce,2);ue.__click=()=>{var te;n()&&((te=d())==null||te("current-state"))};var B=P(N,2);B.__click=()=>{var te;return(te=h())==null?void 0:te()};var I=P(B,2);I.__click=()=>{var te;return(te=v())==null?void 0:te()};var z=P(G,2),O=E(z);{var ne=te=>{var ge=c1();L(te,ge)},ae=te=>{var ge=p1();Gt(ge,21,()=>i(w),we=>we.lineNumber,(we,Ie)=>{var Pe=f1(),Se=Ye(Pe);{var Be=ze=>{var Ne=_t(),_e=Ye(Ne);{var Me=pe=>{{let Ce=ye(()=>i(f).get(i(Ie).deletedBefore.id));a1(pe,{get block(){return i(Ie).deletedBefore},get highlightedLines(){return i(Ce)},onCollapse:()=>D(i(Ie).deletedBefore.id)})}},oe=pe=>{r1(pe,{get block(){return i(Ie).deletedBefore},onExpand:()=>D(i(Ie).deletedBefore.id)})};Y(_e,pe=>{H(i(Ie).deletedBefore.id)?pe(Me):pe(oe,!1)})}L(ze,Ne)};Y(Se,ze=>{i(Ie).deletedBefore!==void 0&&ze(Be)})}var Ue=P(Se,2);{var je=ze=>{var Ne=h1(),_e=Ye(Ne),Me=E(_e);{let Ce=ye(()=>i(b).get(i(Ie).lineNumber)),He=ye(()=>i(u)===i(Ie).lineNumber),$e=ye(()=>o()!==void 0?nt=>C(i(Ie).lineNumber,nt):void 0);e1(Me,{get line(){return i(Ie)},get highlighted(){return i(Ce)},get selected(){return i(He)},onSelect:()=>T(i(Ie).lineNumber),get onCommentClick(){return i($e)}})}var oe=P(_e,2);{var pe=Ce=>{var He=u1(),$e=E(He);$e.__keydown=tt=>{tt.key==="Enter"&&tt.ctrlKey&&(tt.preventDefault(),A(i(p),!0)),tt.key==="Escape"&&S()};var nt=P($e,2),Fe=E(nt),qe=E(Fe),at=P(Fe,2),Ze=E(at);Ze.__click=()=>S();var Le=P(Ze,2);{let tt=ye(()=>i(p).trim().length===0);bl(Le,{get disabled(){return i(tt)},onPrimaryClick:()=>A(i(p),!1),onSecondaryClick:()=>A(i(p),!0)})}var Ae=P(nt,2);{var it=tt=>{var vt=d1(),ft=P(E(vt),2),ht=E(ft),pt=P(ht,2);pt.__click=()=>{var bt;(bt=g())==null||bt(),S()},de(()=>Ge(ht,"href",c())),L(tt,vt)};Y(Ae,tt=>{a()!==null&&c()!==null&&tt(it)})}de(()=>se(qe,i(k))),_r($e,()=>i(p),tt=>x(p,tt)),L(Ce,He)};Y(oe,Ce=>{i(l)!==null&&i(Ie).lineNumber===i(l).endLine&&Ce(pe)})}de(Ce=>Ve(_e,1,Ce),[()=>ns(i(y).includes(i(Ie).lineNumber)?"bg-accent-muted":"")]),L(ze,Ne)};Y(Ue,ze=>{(i(Ie).content!==""||i(Ie).changeType!=="unchanged")&&ze(je)})}L(we,Pe)}),L(te,ge)};Y(O,te=>{i(w).length===0?te(ne):te(ae,!1)})}de(()=>{Ge(M,"aria-label",`Current state view for ${e.file.path??""}`),se(me,e.file.path),se(R,`+${e.file.additions??""} -${e.file.deletions??""}`),Ve(V,1,`p-1 transition-colors
216
+ ${r()==="full-file"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover"}`),Ve(ce,1,`p-1 border-l border-border-default transition-colors
217
+ ${n()?r()==="inline"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover":"text-text-disabled cursor-not-allowed opacity-40"}`),ce.disabled=!n(),Ge(ce,"title",s()?"Stack":"Inline"),Ve(ue,1,`p-1 border-l border-border-default transition-colors
218
+ ${n()?r()==="current-state"?"bg-bg-emphasis text-text-on-emphasis":"text-text-secondary hover:bg-bg-hover":"text-text-disabled cursor-not-allowed opacity-40"}`),ue.disabled=!n(),Ve(B,1,`p-1 rounded transition-colors ${h()!==void 0?"text-text-secondary hover:text-text-primary hover:bg-bg-tertiary cursor-pointer":"text-text-disabled cursor-default"}`),B.disabled=h()===void 0,Ve(I,1,`p-1 rounded transition-colors ${v()!==void 0?"text-text-secondary hover:text-text-primary hover:bg-bg-tertiary cursor-pointer":"text-text-disabled cursor-default"}`),I.disabled=v()===void 0}),L(t,M),Xt()}tr(["click","keydown"]);var g1=Cr('<svg class="animate-spin" width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 1.5a6.5 6.5 0 1 1-4.6 1.9" stroke-linecap="round"></path></svg> Pulling...',1),m1=Cr('<svg class="animate-spin" width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 1.5a6.5 6.5 0 1 1-4.6 1.9" stroke-linecap="round"></path></svg> AI generating...',1),b1=Cr('<svg class="animate-spin" width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 1.5a6.5 6.5 0 1 1-4.6 1.9" stroke-linecap="round"></path></svg> Pushing...',1),y1=Cr('<svg class="animate-spin" width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 1.5a6.5 6.5 0 1 1-4.6 1.9" stroke-linecap="round"></path></svg> AI generating...',1),x1=U(`<button type="button" class="px-3 py-1 text-xs font-medium border border-border-default rounded
219
+ bg-danger-emphasis text-white hover:opacity-90
220
+ transition-colors disabled:opacity-50 disabled:cursor-not-allowed"> </button>`),w1=U(`<button type="button" role="menuitem" class="w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors
221
+ text-text-primary disabled:opacity-50 disabled:cursor-not-allowed"> </button>`),S1=U(`<div class="px-3 py-2 border-t border-border-default bg-bg-primary" role="presentation"><textarea class="w-full h-20 px-2 py-1.5 text-xs bg-bg-secondary border border-border-default
222
+ rounded text-text-primary font-mono resize-y
223
+ focus:outline-none focus:border-accent-emphasis" placeholder="Enter additional context for commit..."></textarea> <button type="button" class="mt-1 px-3 py-1 text-xs bg-success-emphasis text-white rounded
224
+ hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed"> </button></div>`),C1=U('<span class="text-xs text-text-tertiary ml-1"> </span>'),k1=U('<span class="text-xs text-text-tertiary ml-1">(unavailable)</span>'),E1=U("<option> </option>"),A1=U('<div class="flex items-center gap-2 mb-2"><label for="create-pr-base" class="text-xs text-text-secondary">Base:</label> <select id="create-pr-base" class="flex-1 px-2 py-1 text-xs bg-bg-secondary border border-border-default rounded text-text-primary focus:outline-none focus:border-accent-emphasis"></select></div>'),T1=U('<div class="px-3 py-2 border-t border-border-default bg-bg-primary" role="presentation"><!> <button type="button" class="px-3 py-1 text-xs bg-success-emphasis text-white rounded hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed"> </button></div>'),P1=U('<span class="text-xs text-text-tertiary ml-1">(no PR)</span>'),L1=U('<button type="button" role="menuitem">Commit with custom ctx</button> <!> <div class="border-t border-border-default"></div> <button type="button" role="menuitem"> <!></button> <!> <div class="border-t border-border-default"></div> <button type="button" role="menuitem">Open current PR in Browser <!></button>',1),R1=U(`<div class="git-actions-dropdown fixed w-64 bg-bg-secondary border border-border-default
225
+ rounded-lg shadow-lg overflow-hidden" role="menu"><!></div>`),I1=Cr('<svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" class="shrink-0 mt-0.5"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575ZM8 5a.75.75 0 0 0-.75.75v2.5a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"></path></svg>'),D1=Cr('<svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" class="shrink-0 mt-0.5"><path d="M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16Zm3.78-9.72a.751.751 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.751.751 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0Z"></path></svg>'),M1=U('<div><div><!> <span class="toast-text svelte-h2ybgu"> </span> <button type="button" class="toast-dismiss svelte-h2ybgu"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.75.75 0 1 1 1.06 1.06L9.06 8l3.22 3.22a.75.75 0 1 1-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 0 1-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button></div></div>'),O1=U(`<div class="flex items-center gap-1 git-actions-menu-container"><button type="button" class="px-3 py-1 text-xs font-medium border border-border-default rounded
226
+ bg-attention-emphasis text-white hover:opacity-90
227
+ transition-colors disabled:opacity-50 disabled:cursor-not-allowed
228
+ flex items-center gap-1.5"><!></button> <button type="button" class="px-3 py-1 text-xs font-medium border border-border-default rounded
229
+ bg-success-emphasis text-white hover:opacity-90
230
+ transition-colors disabled:opacity-50 disabled:cursor-not-allowed
231
+ flex items-center gap-1.5"><!></button> <button type="button" class="px-3 py-1 text-xs font-medium border border-border-default rounded
232
+ bg-accent-emphasis text-white hover:opacity-90
233
+ transition-colors disabled:opacity-50 disabled:cursor-not-allowed
234
+ flex items-center gap-1.5"><!></button> <button type="button" class="px-3 py-1 text-xs font-medium border border-border-default rounded
235
+ bg-done-emphasis text-white hover:opacity-90
236
+ transition-colors disabled:opacity-50 disabled:cursor-not-allowed
237
+ flex items-center gap-1.5"><!></button> <!> <button type="button" class="px-1.5 py-1 text-sm border border-border-default rounded
238
+ hover:bg-bg-tertiary transition-colors text-text-secondary
239
+ disabled:opacity-50 disabled:cursor-not-allowed" aria-label="More git actions"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><circle cx="8" cy="3" r="1.5"></circle><circle cx="8" cy="8" r="1.5"></circle><circle cx="8" cy="13" r="1.5"></circle></svg></button></div> <!> <!>`,1);function B1(t,e){Kt(e,!0);const r=Re(e,"hasChanges",3,!0),n=Re(e,"isGitRepo",3,!0);let s=q(!1),d=q(null),_=q(""),o=q(0),a=q(0),c=q(null),g=q(!1),h=q("idle"),v=q(null),m=q(!1),w=q(null),b=q("success"),f=q(!1),u=null;function l(Le,Ae){u!==null&&clearTimeout(u),x(w,Le,!0),x(b,Ae,!0),x(f,!0),u=setTimeout(()=>{x(f,!1),setTimeout(()=>{x(w,null)},300)},Ae==="error"?5e3:3e3)}function p(){u!==null&&(clearTimeout(u),u=null),x(f,!1),setTimeout(()=>{x(w,null)},300)}function y(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`action_${Date.now()}_${Math.random().toString(36).slice(2,10)}`}let k=q(null),C=q(null),A=q(!1),S=q(!1),T=q(""),D=q(xt([])),H=q(!1),W=q("");const M=ye(()=>i(C)!==null),G=ye(()=>i(M)?"Update PR":"Create PR"),X=ye(()=>!i(g)&&!i(A)&&(i(S)||i(M))),le=ye(()=>i(g)&&(i(h)==="committing"||i(h)==="creating-pr")&&i(v)!==null&&!i(m));function me(){if(i(c)===null)return;const Le=i(c).getBoundingClientRect();x(o,Le.bottom+4),x(a,window.innerWidth-Le.right)}function xe(Le){Le.stopPropagation(),i(s)?(x(s,!1),x(d,null),x(_,"")):(me(),x(s,!0))}async function R(){x(A,!0);try{const Le=await fetch(`/api/git-actions/pr-status?projectPath=${encodeURIComponent(e.projectPath)}`);if(Le.ok){const Ae=await Le.json();Ae.status.hasPR&&Ae.status.pr!==null?(x(k,Ae.status.pr.url,!0),x(C,Ae.status.pr.number,!0)):(x(k,null),x(C,null)),x(S,Ae.status.canCreatePR,!0),x(T,Ae.status.baseBranch,!0),x(D,Ae.status.availableBaseBranches,!0),x(W,Ae.status.baseBranch,!0)}}catch{}finally{x(A,!1)}}async function j(){var Ae;const Le=y();x(g,!0),x(h,"committing"),x(v,Le,!0),x(m,!1);try{const it=await fetch("/api/git-actions/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath,actionId:Le})});if(!it.ok){const vt=await it.json().catch(()=>({}));throw new Error(vt.error??`Commit failed: ${it.status}`)}const tt=await it.json();if(!tt.success)throw new Error(tt.error??"Commit failed");l("Commit completed","success"),(Ae=e.onSuccess)==null||Ae.call(e,"commit")}catch(it){const tt=it instanceof Error?it.message:"Commit failed";l(tt,"error")}finally{x(g,!1),x(h,"idle"),x(v,null),x(m,!1)}}async function N(){var Le;x(g,!0),x(h,"pushing");try{const Ae=await fetch("/api/git-actions/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath})});if(!Ae.ok){const tt=await Ae.json().catch(()=>({}));throw new Error(tt.error??`Push failed: ${Ae.status}`)}const it=await Ae.json();if(!it.success)throw new Error(it.error??"Push failed");l("Push completed","success"),(Le=e.onSuccess)==null||Le.call(e,"push")}catch(Ae){const it=Ae instanceof Error?Ae.message:"Push failed";l(it,"error")}finally{x(g,!1),x(h,"idle")}}async function V(){var Le;x(g,!0),x(h,"pulling");try{const Ae=await fetch("/api/git-actions/pull",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath})});if(!Ae.ok){const tt=await Ae.json().catch(()=>({}));throw new Error(tt.error??`Pull failed: ${Ae.status}`)}const it=await Ae.json();if(!it.success)throw new Error(it.error??"Pull failed");l("Pull completed","success"),(Le=e.onSuccess)==null||Le.call(e,"pull")}catch(Ae){const it=Ae instanceof Error?Ae.message:"Pull failed";l(it,"error")}finally{x(g,!1),x(h,"idle")}}async function $(){var it;if(i(d)===null)return;const Le=i(_).trim(),Ae=y();x(g,!0),x(h,"committing"),x(v,Ae,!0),x(m,!1);try{const tt=await fetch("/api/git-actions/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath,actionId:Ae,...Le.length>0?{customCtx:Le}:{}})});if(!tt.ok){const ft=await tt.json().catch(()=>({}));throw new Error(ft.error??`Commit failed: ${tt.status}`)}const vt=await tt.json();if(!vt.success)throw new Error(vt.error??"Commit failed");l("Commit completed","success"),(it=e.onSuccess)==null||it.call(e,"commit"),x(d,null),x(_,""),x(s,!1)}catch(tt){const vt=tt instanceof Error?tt.message:"Operation failed";l(vt,"error")}finally{x(g,!1),x(h,"idle"),x(v,null),x(m,!1)}}function ee(){i(k)!==null&&window.open(i(k),"_blank"),x(s,!1)}function ce(Le){const Ae=/https:\/\/github\.com\/[^\s]+\/pull\/\d+/.exec(Le);return Ae!==null?Ae[0]:null}async function ue(){var tt;const Le=i(C)!==null,Ae=i(W).length>0?i(W):i(T).length>0?i(T):"main",it=y();x(g,!0),x(h,"creating-pr"),x(v,it,!0),x(m,!1);try{const ft=await fetch(Le?"/api/git-actions/update-pr":"/api/git-actions/create-pr",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath,baseBranch:Ae,actionId:it})});if(!ft.ok){const Tt=await ft.text().catch(()=>"");let et=null;try{et=JSON.parse(Tt)}catch{et=null}throw new Error((et!==null&&typeof et.error=="string"?et.error:Tt.trim().length>0?Tt:void 0)??`${Le?"Update PR":"Create PR"} failed: ${ft.status}`)}const ht=await ft.json();if(!ht.success)throw new Error(ht.error??`${Le?"Update PR":"Create PR"} failed`);let pt=ce(ht.output);pt===null?(await R(),pt=i(k)):await R();const bt=pt!==null?`PR ${Le?"updated":"created"}: ${pt}`:`PR ${Le?"updated":"created"}`;l(bt,"success"),(tt=e.onSuccess)==null||tt.call(e,"pr")}catch(vt){const ft=vt instanceof Error?vt.message:`${Le?"Update PR":"Create PR"} failed`;l(ft,"error")}finally{x(g,!1),x(h,"idle"),x(v,null),x(m,!1)}}async function B(){i(W)===""&&i(C)===null||(await ue(),x(H,!1),x(s,!1))}async function I(){if(!(!i(le)||i(v)===null)){x(m,!0);try{const Le=await fetch("/api/git-actions/cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({actionId:i(v)})});if(!Le.ok){const Ae=await Le.json().catch(()=>({}));throw new Error(Ae.error??`Cancel failed: ${Le.status}`)}l("Cancellation requested","success")}catch(Le){const Ae=Le instanceof Error?Le.message:"Failed to cancel operation";l(Ae,"error"),x(m,!1)}}}async function z(){var Le;x(g,!0),x(h,"initializing");try{const Ae=await fetch("/api/git-actions/init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath})});if(!Ae.ok){const tt=await Ae.json().catch(()=>({}));throw new Error(tt.error??`Git init failed: ${Ae.status}`)}const it=await Ae.json();if(!it.success)throw new Error(it.error??"Git init failed");l("Git repository initialized","success"),x(s,!1),(Le=e.onSuccess)==null||Le.call(e,"init")}catch(Ae){const it=Ae instanceof Error?Ae.message:"Git init failed";l(it,"error")}finally{x(g,!1),x(h,"idle")}}function O(Le){const Ae=Le.target;!Ae.closest(".git-actions-menu-container")&&!Ae.closest(".git-actions-dropdown")&&(x(s,!1),i(d)!==null&&(x(d,null),x(_,"")))}gt(()=>{n()&&R()});var ne=O1();Sr("click",hn,O);var ae=Ye(ne),te=E(ae);te.__click=()=>void V();var ge=E(te);{var we=Le=>{var Ae=g1();L(Le,Ae)},Ie=Le=>{var Ae=Lr("Pull");L(Le,Ae)};Y(ge,Le=>{i(g)&&i(h)==="pulling"?Le(we):Le(Ie,!1)})}var Pe=P(te,2);Pe.__click=()=>void j();var Se=E(Pe);{var Be=Le=>{var Ae=m1();L(Le,Ae)},Ue=Le=>{var Ae=Lr("Commit");L(Le,Ae)};Y(Se,Le=>{i(g)&&i(h)==="committing"?Le(Be):Le(Ue,!1)})}var je=P(Pe,2);je.__click=()=>void N();var ze=E(je);{var Ne=Le=>{var Ae=b1();L(Le,Ae)},_e=Le=>{var Ae=Lr("Push");L(Le,Ae)};Y(ze,Le=>{i(g)&&i(h)==="pushing"?Le(Ne):Le(_e,!1)})}var Me=P(je,2);Me.__click=()=>void ue();var oe=E(Me);{var pe=Le=>{var Ae=y1();L(Le,Ae)},Ce=Le=>{var Ae=Lr();de(()=>se(Ae,i(G))),L(Le,Ae)};Y(oe,Le=>{i(g)&&i(h)==="creating-pr"?Le(pe):Le(Ce,!1)})}var He=P(Me,2);{var $e=Le=>{var Ae=x1();Ae.__click=()=>void I();var it=E(Ae);de(()=>{Ae.disabled=!i(le),se(it,i(m)?"Cancelling...":"Cancel")}),L(Le,Ae)};Y(He,Le=>{i(g)&&(i(h)==="committing"||i(h)==="creating-pr")&&Le($e)})}var nt=P(He,2);nt.__click=xe,Nr(nt,Le=>x(c,Le),()=>i(c));var Fe=P(ae,2);{var qe=Le=>{var Ae=R1();Ae.__click=ft=>ft.stopPropagation(),Ae.__keydown=ft=>ft.stopPropagation();var it=E(Ae);{var tt=ft=>{var ht=w1();ht.__click=()=>void z();var pt=E(ht);de(()=>{ht.disabled=i(g),se(pt,i(g)&&i(h)==="initializing"?"Initializing...":"Initialize Git Repository")}),L(ft,ht)},vt=ft=>{var ht=L1(),pt=Ye(ht);pt.__click=be=>{be.stopPropagation(),x(d,i(d)==="commit"?null:"commit",!0),x(_,"")};var bt=P(pt,2);{var Tt=be=>{var We=S1(),Je=E(We),ut=P(Je,2);ut.__click=()=>void $();var Xe=E(ut);de(()=>{Je.disabled=i(g),ut.disabled=i(g),se(Xe,i(g)?"Running...":"Commit")}),_r(Je,()=>i(_),ie=>x(_,ie)),L(be,We)};Y(bt,be=>{i(d)==="commit"&&be(Tt)})}var et=P(bt,4);et.__click=be=>{be.stopPropagation(),x(H,!i(H))};var Ct=E(et),kt=P(Ct);{var Mt=be=>{var We=C1(),Je=E(We);de(()=>se(Je,`(#${i(C)??""})`)),L(be,We)},Pt=be=>{var We=_t(),Je=Ye(We);{var ut=Xe=>{var ie=k1();L(Xe,ie)};Y(Je,Xe=>{!i(S)&&!i(A)&&Xe(ut)},!0)}L(be,We)};Y(kt,be=>{i(C)!==null?be(Mt):be(Pt,!1)})}var Rt=P(et,2);{var It=be=>{var We=T1(),Je=E(We);{var ut=ke=>{var De=A1(),J=P(E(De),2);Gt(J,21,()=>i(D),ui,(Z,re)=>{var F=E1(),Q=E(F),ve={};de(()=>{se(Q,i(re)),ve!==(ve=i(re))&&(F.value=(F.__value=i(re))??"")}),L(Z,F)}),zi(J,()=>i(W),Z=>x(W,Z)),L(ke,De)};Y(Je,ke=>{i(C)===null&&ke(ut)})}var Xe=P(Je,2);Xe.__click=()=>void B();var ie=E(Xe);de(()=>{Xe.disabled=i(g)||i(C)===null&&i(W)==="",se(ie,i(g)&&i(h)==="creating-pr"?"AI generating...":i(G))}),L(be,We)};Y(Rt,be=>{i(H)&&(i(S)||i(C)!==null)&&be(It)})}var Ht=P(Rt,4);Ht.__click=ee;var Et=P(E(Ht));{var fe=be=>{var We=P1();L(be,We)};Y(Et,be=>{i(k)===null&&!i(A)&&be(fe)})}de(()=>{Ve(pt,1,`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors
240
+ text-text-primary ${i(d)==="commit"?"bg-bg-tertiary":""}`),pt.disabled=i(g),Ve(et,1,`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors
241
+ ${i(S)||i(C)!==null?"text-text-primary":"text-text-tertiary cursor-not-allowed"}
242
+ ${i(H)?"bg-bg-tertiary":""}`),et.disabled=!i(S)&&i(C)===null||i(A),se(Ct,`${i(G)??""} `),Ve(Ht,1,`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors
243
+ ${i(k)!==null?"text-text-primary":"text-text-tertiary cursor-not-allowed"}`),Ht.disabled=i(k)===null||i(A)}),L(ft,ht)};Y(it,ft=>{n()?ft(vt,!1):ft(tt)})}de(()=>hi(Ae,`top: ${i(o)??""}px; right: ${i(a)??""}px; z-index: 9999;`)),L(Le,Ae)};Y(Fe,Le=>{i(s)&&Le(qe)})}var at=P(Fe,2);{var Ze=Le=>{var Ae=M1();let it;var tt=E(Ae);let vt;var ft=E(tt);{var ht=Ct=>{var kt=I1();L(Ct,kt)},pt=Ct=>{var kt=D1();L(Ct,kt)};Y(ft,Ct=>{i(b)==="error"?Ct(ht):Ct(pt,!1)})}var bt=P(ft,2),Tt=E(bt),et=P(bt,2);et.__click=p,de(()=>{it=Ve(Ae,1,"toast-overlay svelte-h2ybgu",null,it,{"toast-visible":i(f),"toast-hidden":!i(f)}),vt=Ve(tt,1,"toast-content svelte-h2ybgu",null,vt,{"toast-success":i(b)==="success","toast-error":i(b)==="error"}),se(Tt,i(w))}),L(Le,Ae)};Y(at,Le=>{i(w)!==null&&Le(Ze)})}de(()=>{te.disabled=!n()||i(g),Ge(te,"title",n()?"":"Not a git repository"),Pe.disabled=!n()||i(g)||!r(),Ge(Pe,"title",n()?"":"Not a git repository"),je.disabled=!n()||i(g),Ge(je,"title",n()?"":"Not a git repository"),Me.disabled=!n()||!i(X),Ge(Me,"title",n()?"":"Not a git repository"),nt.disabled=i(g),Ge(nt,"title",i(g)?"Git operation in progress":"")}),L(t,ne),Xt()}tr(["click","keydown"]);var N1=U('<div class="p-4 text-sm text-text-secondary">Loading files...</div>'),j1=U('<div class="p-4 text-sm text-danger-fg"> </div>'),H1=U('<div class="p-4 text-sm text-text-secondary">Loading all files...</div>'),F1=U('<aside class="h-full border-r border-border-default bg-bg-secondary overflow-auto"><!></aside>'),U1=U('<div class="h-10 border-b border-border-default bg-bg-secondary px-2 flex items-center justify-end"><!></div>'),V1=U('<div class="p-8 text-center text-text-secondary">Loading diff...</div>'),z1=U('<div class="p-8 text-center text-danger-fg"> </div>'),W1=U('<div class="px-2 pb-2"><!></div>'),q1=U('<div class="px-2 pb-2"><!></div>'),G1=U('<div class="p-8 text-center text-text-secondary">Loading file...</div>'),K1=U('<div class="p-8 text-center text-text-secondary">Loading file...</div>'),X1=U('<div class="p-8 text-center text-text-secondary">Select a file to view</div>'),J1=U('<div class="relative flex flex-1 min-h-0 overflow-hidden"><div><!> <button type="button"><span> </span></button></div> <div class="flex flex-col flex-1 min-w-0 min-h-0 transition-transform duration-200 ease-out"><!> <main class="flex-1 min-h-0 overflow-auto bg-bg-primary"><!></main> <div><div class="shrink-0 h-8 border-t border-border-default flex items-center px-4 bg-bg-secondary text-xs text-text-secondary gap-4"><span> </span> <span class="text-success-fg"> </span> <span class="text-danger-fg"> </span></div></div></div></div>');function Y1(t,e){Kt(e,!0);let r=q(null),n=q(0),s=q(0),d=q(0),_=q(!1),o=q(!1),a=q(null);const c="ai_session_id";function g(){const B=navigator.userAgent;return(/iPhone|iPod/i.test(B)||/Macintosh/i.test(B)&&"maxTouchPoints"in navigator&&navigator.maxTouchPoints>1)&&window.innerWidth<=430}function h(){return window.innerWidth<=480}function v(){const B=navigator.userAgent;return/iPhone|iPod|Android/i.test(B)}function m(){const B=navigator.userAgent,I=/Safari/i.test(B)&&!/CriOS|FxiOS|EdgiOS|OPiOS/i.test(B);return g()&&I}function w(B){const{slug:I}=yo(window.location.hash),z=new URL(window.location.href);return z.searchParams.set(c,B),z.hash=xs(I,"ai-session"),`${z.pathname}${z.search}${z.hash}`}const b=ye(()=>i(a)===null?null:w(i(a)));gt(()=>{const B=()=>{x(_,g(),!0),x(o,h(),!0)};return B(),window.addEventListener("resize",B),window.addEventListener("orientationchange",B),()=>{window.removeEventListener("resize",B),window.removeEventListener("orientationchange",B)}}),gt(()=>{i(_)&&e.selectedHasDiff&&e.effectiveViewMode==="side-by-side"&&e.onSetViewMode("inline")}),gt(()=>{if(!i(o)||i(r)===null){x(n,0);return}const B=()=>{var z;x(n,((z=i(r))==null?void 0:z.offsetHeight)??0,!0)};B();const I=new ResizeObserver(B);return I.observe(i(r)),window.addEventListener("resize",B),window.addEventListener("orientationchange",B),()=>{I.disconnect(),window.removeEventListener("resize",B),window.removeEventListener("orientationchange",B)}}),gt(()=>{if(!i(o)){x(s,0),x(d,0);return}const B=window.visualViewport,I=()=>{const z=B===void 0?0:Math.max(0,window.innerHeight-(B.height+B.offsetTop)),O=B!==void 0&&B.height<window.innerHeight*.8;if(x(s,O?Math.round(z):0,!0),!v()||!m()){x(d,0);return}if(window.matchMedia("(display-mode: standalone)").matches||navigator.standalone===!0||O){x(d,0);return}x(d,z>0?0:52,!0)};return I(),window.addEventListener("resize",I),window.addEventListener("orientationchange",I),B==null||B.addEventListener("resize",I),B==null||B.addEventListener("scroll",I),()=>{window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),B==null||B.removeEventListener("resize",I),B==null||B.removeEventListener("scroll",I)}});function f(B,I,z,O,ne,ae,te){if(te==="diff"&&z==="old")return;const ge=te==="diff"||te==="current-state"?"Selection is from latest file lines (new/current side). Include related old-vs-new diff context in your answer.":void 0;e.onSubmitPrompt(ne,ae,{primaryFile:{path:O,startLine:B,endLine:I,content:""},references:[],diffSummary:ge,resumeSessionId:e.currentQraftAiSessionId}).then(we=>{x(a,(we==null?void 0:we.sessionId)??e.currentQraftAiSessionId,!0)})}function u(B){e.onFileSelect(B),(h()||v())&&!e.sidebarCollapsed&&e.onCollapseSidebar()}var l=J1(),p=E(l),y=E(p);{var k=B=>{var I=F1();let z;var O=E(I);{var ne=te=>{var ge=N1();L(te,ge)},ae=te=>{var ge=_t(),we=Ye(ge);{var Ie=Se=>{var Be=j1(),Ue=E(Be);de(()=>se(Ue,e.error)),L(Se,Be)},Pe=Se=>{var Be=_t(),Ue=Ye(Be);{var je=Ne=>{var _e=H1();L(Ne,_e)},ze=Ne=>{Kb(Ne,{get tree(){return e.fileTree},get currentDirectory(){return e.projectPath},get mode(){return e.fileTreeMode},get selectedPath(){return e.selectedPath},onFileSelect:u,get changedCount(){return e.diffFiles.length},get contextId(){return e.contextId},get showIgnored(){return e.showIgnored},get showAllFiles(){return e.showAllFiles},get onModeChange(){return e.onFileTreeModeChange},get onShowIgnoredChange(){return e.onShowIgnoredChange},get onShowAllFilesChange(){return e.onShowAllFilesChange},get onDirectoryExpand(){return e.onDirectoryExpand},get onLoadFullTree(){return e.onLoadFullTree},get onNarrow(){return e.onNarrowSidebar},get onWiden(){return e.onWidenSidebar},get canNarrow(){return e.canNarrow},get canWiden(){return e.canWiden},get onReload(){return e.onReloadFileTree}})};Y(Ue,Ne=>{e.allFilesLoading&&e.fileTreeMode==="all"?Ne(je):Ne(ze,!1)},!0)}L(Se,Be)};Y(we,Se=>{e.error!==null?Se(Ie):Se(Pe,!1)},!0)}L(te,ge)};Y(O,te=>{e.loading?te(ne):te(ae,!1)})}de(()=>z=hi(I,"",z,{width:`${e.sidebarWidth??""}px`})),L(B,I)};Y(y,B=>{e.sidebarCollapsed||B(k)})}var C=P(y,2);C.__click=function(...B){var I;(I=e.onToggleSidebar)==null||I.apply(this,B)};var A=E(C),S=E(A),T=P(p,2);let D;var H=E(T);{var W=B=>{var I=U1(),z=E(I);{let O=ye(()=>e.diffFiles.length>0);B1(z,{get contextId(){return e.contextId},get projectPath(){return e.projectPath},get hasChanges(){return i(O)},get onSuccess(){return e.onGitActionSuccess},get isGitRepo(){return e.isGitRepo}})}L(B,I)};Y(H,B=>{e.contextId!==null&&B(W)})}var M=P(H,2);let G;var X=E(M);{var le=B=>{var I=V1();L(B,I)},me=B=>{var I=_t(),z=Ye(I);{var O=ae=>{var te=z1(),ge=E(te);de(()=>se(ge,e.error)),L(ae,te)},ne=ae=>{var te=_t(),ge=Ye(te);{var we=Pe=>{var Se=W1(),Be=E(Se);v1(Be,{get file(){return e.selectedFile},get viewMode(){return e.effectiveViewMode},get selectedHasDiff(){return e.selectedHasDiff},get isIphone(){return i(_)},get onSetViewMode(){return e.onSetViewMode},onCommentSubmit:(Ue,je,ze,Ne,_e,Me)=>f(Ue,je,ze,Ne,_e,Me,"current-state"),get submittedSessionId(){return i(a)},get submittedSessionHistoryHref(){return i(b)},onDismissSubmittedSession:()=>{x(a,null)},get onNavigatePrev(){return e.navigatePrev},get onNavigateNext(){return e.navigateNext}}),L(Pe,Se)},Ie=Pe=>{var Se=_t(),Be=Ye(Se);{var Ue=ze=>{var Ne=q1(),_e=E(Ne);{let Me=ye(()=>e.effectiveViewMode==="side-by-side"?"side-by-side":"inline");rb(_e,{get file(){return e.selectedFile},get mode(){return i(Me)},get viewMode(){return e.effectiveViewMode},get selectedHasDiff(){return e.selectedHasDiff},get isIphone(){return i(_)},get onSetViewMode(){return e.onSetViewMode},onCommentSubmit:(oe,pe,Ce,He,$e,nt)=>f(oe,pe,Ce,He,$e,nt,"diff"),get submittedSessionId(){return i(a)},get submittedSessionHistoryHref(){return i(b)},onDismissSubmittedSession:()=>{x(a,null)},get onNavigatePrev(){return e.navigatePrev},get onNavigateNext(){return e.navigateNext}})}L(ze,Ne)},je=ze=>{var Ne=_t(),_e=Ye(Ne);{var Me=pe=>{var Ce=G1();L(pe,Ce)},oe=pe=>{var Ce=_t(),He=Ye(Ce);{var $e=Fe=>{{let qe=ye(()=>e.fileContent.ctxId!==void 0?oc(e.fileContent.ctxId,e.fileContent.path):void 0);Bc(Fe,{get path(){return e.fileContent.path},get content(){return e.fileContent.content},get language(){return e.fileContent.language},get isBinary(){return e.fileContent.isBinary},get isImage(){return e.fileContent.isImage},get isVideo(){return e.fileContent.isVideo},get isPdf(){return e.fileContent.isPdf},get mimeType(){return e.fileContent.mimeType},get rawFileUrl(){return i(qe)},get viewMode(){return e.effectiveViewMode},get selectedHasDiff(){return e.selectedHasDiff},get isIphone(){return i(_)},get onSetViewMode(){return e.onSetViewMode},get onNavigatePrev(){return e.navigatePrev},get onNavigateNext(){return e.navigateNext},onCommentSubmit:(at,Ze,Le,Ae,it,tt)=>f(at,Ze,Le,Ae,it,tt,"full-file"),get submittedSessionId(){return i(a)},get submittedSessionHistoryHref(){return i(b)},onDismissSubmittedSession:()=>{x(a,null)}})}},nt=Fe=>{var qe=_t(),at=Ye(qe);{var Ze=Ae=>{var it=K1();L(Ae,it)},Le=Ae=>{var it=_t(),tt=Ye(it);{var vt=ht=>{{let pt=ye(()=>e.fileContent.ctxId!==void 0?oc(e.fileContent.ctxId,e.fileContent.path):void 0);Bc(ht,{get path(){return e.fileContent.path},get content(){return e.fileContent.content},get language(){return e.fileContent.language},get isBinary(){return e.fileContent.isBinary},get isImage(){return e.fileContent.isImage},get isVideo(){return e.fileContent.isVideo},get isPdf(){return e.fileContent.isPdf},get mimeType(){return e.fileContent.mimeType},get rawFileUrl(){return i(pt)},get viewMode(){return e.effectiveViewMode},get selectedHasDiff(){return e.selectedHasDiff},get isIphone(){return i(_)},get onSetViewMode(){return e.onSetViewMode},get onNavigatePrev(){return e.navigatePrev},get onNavigateNext(){return e.navigateNext},onCommentSubmit:(bt,Tt,et,Ct,kt,Mt)=>f(bt,Tt,et,Ct,kt,Mt,"full-file"),get submittedSessionId(){return i(a)},get submittedSessionHistoryHref(){return i(b)},onDismissSubmittedSession:()=>{x(a,null)}})}},ft=ht=>{var pt=X1();L(ht,pt)};Y(tt,ht=>{e.fileContent!==null?ht(vt):ht(ft,!1)},!0)}L(Ae,it)};Y(at,Ae=>{e.fileContentLoading?Ae(Ze):Ae(Le,!1)},!0)}L(Fe,qe)};Y(He,Fe=>{e.effectiveViewMode==="full-file"&&e.fileContent!==null?Fe($e):Fe(nt,!1)},!0)}L(pe,Ce)};Y(_e,pe=>{e.effectiveViewMode==="full-file"&&e.fileContentLoading?pe(Me):pe(oe,!1)},!0)}L(ze,Ne)};Y(Be,ze=>{e.selectedFile!==null&&(e.effectiveViewMode==="side-by-side"||e.effectiveViewMode==="inline")?ze(Ue):ze(je,!1)},!0)}L(Pe,Se)};Y(ge,Pe=>{e.selectedFile!==null&&e.effectiveViewMode==="current-state"?Pe(we):Pe(Ie,!1)},!0)}L(ae,te)};Y(z,ae=>{e.error!==null?ae(O):ae(ne,!1)},!0)}L(B,I)};Y(X,B=>{e.loading?B(le):B(me,!1)})}var xe=P(M,2);let R;var j=E(xe),N=E(j),V=E(N),$=P(N,2),ee=E($),ce=P($,2),ue=E(ce);Nr(xe,B=>x(r,B),()=>i(r)),de(()=>{Ve(p,1,`relative ${i(o)?"absolute left-0 top-0 bottom-0 z-30":"flex shrink-0"}`),Ve(C,1,`absolute top-12 z-20 flex items-center justify-center
244
+ ${i(o)?"w-6 h-10":"w-4 h-7"}
245
+ ${i(o)?e.sidebarCollapsed?"-left-0.5":"-right-6":"-right-4"}
246
+ bg-bg-secondary border border-l-0 border-border-default
247
+ rounded-r text-text-secondary hover:text-text-primary hover:bg-bg-tertiary
248
+ transition-colors cursor-pointer`),Ge(C,"aria-label",e.sidebarCollapsed?"Show Sidebar":"Hide Sidebar"),Ge(C,"title",e.sidebarCollapsed?"Show Sidebar (b)":"Hide Sidebar (b)"),Ve(A,1,`${i(o)?"text-[12px]":"text-[9px]"} leading-none`),se(S,e.sidebarCollapsed?"▶":"◀"),D=hi(T,"",D,{transform:i(o)&&!e.sidebarCollapsed?`translateX(${e.sidebarWidth}px)`:void 0}),G=hi(M,"",G,{"padding-bottom":i(o)?`${i(n)}px`:void 0}),Ve(xe,1,ns(i(o)?"fixed left-0 right-0 bottom-0 z-40 bg-bg-secondary flex flex-col":"shrink-0 flex flex-col min-h-0")),R=hi(xe,"",R,{bottom:i(o)?`${i(s)}px`:void 0,"max-height":i(o)?"70dvh":void 0,"padding-bottom":i(o)?`calc(env(safe-area-inset-bottom, 0px) + ${i(d)}px)`:void 0}),se(V,`${e.stats.totalFiles??""} file${e.stats.totalFiles!==1?"s":""} changed`),se(ee,`+${e.stats.additions??""}`),se(ue,`-${e.stats.deletions??""}`)}),L(t,l),Xt()}tr(["click"]);const Q1=/<(local-command-caveat|command-name|local-command-stdout|command-message|command-args|system-reminder|qraftbox-internal-prompt)[^>]*>[\s\S]*?<\/\1>/g,Z1=/<\/?qraftbox-system-prompt[^>]*>/g;function Un(t){return t.replace(Q1,"").replace(Z1,"").replace(/\n{3,}/g,`
249
+
250
+ `).trim()}function $1(t,e,r="session-internal-v1"){const n=e.trim();return`<qraftbox-internal-prompt label="${t}" anchor="${r}">
251
+ ${n}
252
+ </qraftbox-internal-prompt>`}function Hc(t){const e=t.trim();return e.includes("<qraftbox-system-prompt")||e.startsWith("# AGENTS.md instructions")||e.startsWith("<environment_context>")||e.startsWith("<turn_aborted>")||e.includes("## Rule of the Responses")||e.includes("## Autonomous Operation Policy")}const ey={running:{label:"Running",badgeClass:"bg-accent-muted text-accent-fg"},queued:{label:"Queued",badgeClass:"bg-attention-muted text-attention-fg"},failed:{label:"Failed",badgeClass:"bg-danger-emphasis/15 text-danger-fg"},awaiting_input:{label:"Waiting for input",badgeClass:"bg-bg-tertiary text-text-secondary"}};function Fc(t){return t.hasRunningTask?"running":t.hasQueuedTask?"queued":t.hasFailedTask?"failed":"awaiting_input"}function Ls(t){return ey[t]}function Uc(t){return t==="running"?"Assistant is generating a response":t==="queued"?"Prompt is queued for processing":t==="failed"?"Prompt failed":"Waiting for next user input"}/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Qu,setPrototypeOf:Vc,isFrozen:ty,getPrototypeOf:ry,getOwnPropertyDescriptor:iy}=Object;let{freeze:ei,seal:Ci,create:Ga}=Object,{apply:Ka,construct:Xa}=typeof Reflect<"u"&&Reflect;ei||(ei=function(e){return e});Ci||(Ci=function(e){return e});Ka||(Ka=function(e,r){for(var n=arguments.length,s=new Array(n>2?n-2:0),d=2;d<n;d++)s[d-2]=arguments[d];return e.apply(r,s)});Xa||(Xa=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return new e(...n)});const io=ti(Array.prototype.forEach),ny=ti(Array.prototype.lastIndexOf),zc=ti(Array.prototype.pop),hs=ti(Array.prototype.push),sy=ti(Array.prototype.splice),po=ti(String.prototype.toLowerCase),fa=ti(String.prototype.toString),pa=ti(String.prototype.match),fs=ti(String.prototype.replace),oy=ti(String.prototype.indexOf),ay=ti(String.prototype.trim),Ei=ti(Object.prototype.hasOwnProperty),Qr=ti(RegExp.prototype.test),ps=ly(TypeError);function ti(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return Ka(t,e,n)}}function ly(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Xa(t,r)}}function Ut(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:po;Vc&&Vc(t,null);let n=e.length;for(;n--;){let s=e[n];if(typeof s=="string"){const d=r(s);d!==s&&(ty(e)||(e[n]=d),s=d)}t[s]=!0}return t}function cy(t){for(let e=0;e<t.length;e++)Ei(t,e)||(t[e]=null);return t}function Oi(t){const e=Ga(null);for(const[r,n]of Qu(t))Ei(t,r)&&(Array.isArray(n)?e[r]=cy(n):n&&typeof n=="object"&&n.constructor===Object?e[r]=Oi(n):e[r]=n);return e}function _s(t,e){for(;t!==null;){const n=iy(t,e);if(n){if(n.get)return ti(n.get);if(typeof n.value=="function")return ti(n.value)}t=ry(t)}function r(){return null}return r}const Wc=ei(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),_a=ei(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),va=ei(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),dy=ei(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ga=ei(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),uy=ei(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),qc=ei(["#text"]),Gc=ei(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ma=ei(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Kc=ei(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),no=ei(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),hy=Ci(/\{\{[\w\W]*|[\w\W]*\}\}/gm),fy=Ci(/<%[\w\W]*|[\w\W]*%>/gm),py=Ci(/\$\{[\w\W]*/gm),_y=Ci(/^data-[\-\w.\u00B7-\uFFFF]+$/),vy=Ci(/^aria-[\-\w]+$/),Zu=Ci(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),gy=Ci(/^(?:\w+script|data):/i),my=Ci(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$u=Ci(/^html$/i),by=Ci(/^[a-z][.\w]*(-[.\w]+)+$/i);var Xc=Object.freeze({__proto__:null,ARIA_ATTR:vy,ATTR_WHITESPACE:my,CUSTOM_ELEMENT:by,DATA_ATTR:_y,DOCTYPE_NAME:$u,ERB_EXPR:fy,IS_ALLOWED_URI:Zu,IS_SCRIPT_OR_DATA:gy,MUSTACHE_EXPR:hy,TMPLIT_EXPR:py});const vs={element:1,text:3,progressingInstruction:7,comment:8,document:9},yy=function(){return typeof window>"u"?null:window},xy=function(e,r){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";r&&r.hasAttribute(s)&&(n=r.getAttribute(s));const d="dompurify"+(n?"#"+n:"");try{return e.createPolicy(d,{createHTML(_){return _},createScriptURL(_){return _}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},Jc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function eh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:yy();const e=re=>eh(re);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==vs.document||!t.Element)return e.isSupported=!1,e;let{document:r}=t;const n=r,s=n.currentScript,{DocumentFragment:d,HTMLTemplateElement:_,Node:o,Element:a,NodeFilter:c,NamedNodeMap:g=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:v,trustedTypes:m}=t,w=a.prototype,b=_s(w,"cloneNode"),f=_s(w,"remove"),u=_s(w,"nextSibling"),l=_s(w,"childNodes"),p=_s(w,"parentNode");if(typeof _=="function"){const re=r.createElement("template");re.content&&re.content.ownerDocument&&(r=re.content.ownerDocument)}let y,k="";const{implementation:C,createNodeIterator:A,createDocumentFragment:S,getElementsByTagName:T}=r,{importNode:D}=n;let H=Jc();e.isSupported=typeof Qu=="function"&&typeof p=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:W,ERB_EXPR:M,TMPLIT_EXPR:G,DATA_ATTR:X,ARIA_ATTR:le,IS_SCRIPT_OR_DATA:me,ATTR_WHITESPACE:xe,CUSTOM_ELEMENT:R}=Xc;let{IS_ALLOWED_URI:j}=Xc,N=null;const V=Ut({},[...Wc,..._a,...va,...ga,...qc]);let $=null;const ee=Ut({},[...Gc,...ma,...Kc,...no]);let ce=Object.seal(Ga(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ue=null,B=null;const I=Object.seal(Ga(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let z=!0,O=!0,ne=!1,ae=!0,te=!1,ge=!0,we=!1,Ie=!1,Pe=!1,Se=!1,Be=!1,Ue=!1,je=!0,ze=!1;const Ne="user-content-";let _e=!0,Me=!1,oe={},pe=null;const Ce=Ut({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let He=null;const $e=Ut({},["audio","video","img","source","image","track"]);let nt=null;const Fe=Ut({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),qe="http://www.w3.org/1998/Math/MathML",at="http://www.w3.org/2000/svg",Ze="http://www.w3.org/1999/xhtml";let Le=Ze,Ae=!1,it=null;const tt=Ut({},[qe,at,Ze],fa);let vt=Ut({},["mi","mo","mn","ms","mtext"]),ft=Ut({},["annotation-xml"]);const ht=Ut({},["title","style","font","a","script"]);let pt=null;const bt=["application/xhtml+xml","text/html"],Tt="text/html";let et=null,Ct=null;const kt=r.createElement("form"),Mt=function(F){return F instanceof RegExp||F instanceof Function},Pt=function(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ct&&Ct===F)){if((!F||typeof F!="object")&&(F={}),F=Oi(F),pt=bt.indexOf(F.PARSER_MEDIA_TYPE)===-1?Tt:F.PARSER_MEDIA_TYPE,et=pt==="application/xhtml+xml"?fa:po,N=Ei(F,"ALLOWED_TAGS")?Ut({},F.ALLOWED_TAGS,et):V,$=Ei(F,"ALLOWED_ATTR")?Ut({},F.ALLOWED_ATTR,et):ee,it=Ei(F,"ALLOWED_NAMESPACES")?Ut({},F.ALLOWED_NAMESPACES,fa):tt,nt=Ei(F,"ADD_URI_SAFE_ATTR")?Ut(Oi(Fe),F.ADD_URI_SAFE_ATTR,et):Fe,He=Ei(F,"ADD_DATA_URI_TAGS")?Ut(Oi($e),F.ADD_DATA_URI_TAGS,et):$e,pe=Ei(F,"FORBID_CONTENTS")?Ut({},F.FORBID_CONTENTS,et):Ce,ue=Ei(F,"FORBID_TAGS")?Ut({},F.FORBID_TAGS,et):Oi({}),B=Ei(F,"FORBID_ATTR")?Ut({},F.FORBID_ATTR,et):Oi({}),oe=Ei(F,"USE_PROFILES")?F.USE_PROFILES:!1,z=F.ALLOW_ARIA_ATTR!==!1,O=F.ALLOW_DATA_ATTR!==!1,ne=F.ALLOW_UNKNOWN_PROTOCOLS||!1,ae=F.ALLOW_SELF_CLOSE_IN_ATTR!==!1,te=F.SAFE_FOR_TEMPLATES||!1,ge=F.SAFE_FOR_XML!==!1,we=F.WHOLE_DOCUMENT||!1,Se=F.RETURN_DOM||!1,Be=F.RETURN_DOM_FRAGMENT||!1,Ue=F.RETURN_TRUSTED_TYPE||!1,Pe=F.FORCE_BODY||!1,je=F.SANITIZE_DOM!==!1,ze=F.SANITIZE_NAMED_PROPS||!1,_e=F.KEEP_CONTENT!==!1,Me=F.IN_PLACE||!1,j=F.ALLOWED_URI_REGEXP||Zu,Le=F.NAMESPACE||Ze,vt=F.MATHML_TEXT_INTEGRATION_POINTS||vt,ft=F.HTML_INTEGRATION_POINTS||ft,ce=F.CUSTOM_ELEMENT_HANDLING||{},F.CUSTOM_ELEMENT_HANDLING&&Mt(F.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ce.tagNameCheck=F.CUSTOM_ELEMENT_HANDLING.tagNameCheck),F.CUSTOM_ELEMENT_HANDLING&&Mt(F.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ce.attributeNameCheck=F.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),F.CUSTOM_ELEMENT_HANDLING&&typeof F.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ce.allowCustomizedBuiltInElements=F.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),te&&(O=!1),Be&&(Se=!0),oe&&(N=Ut({},qc),$=[],oe.html===!0&&(Ut(N,Wc),Ut($,Gc)),oe.svg===!0&&(Ut(N,_a),Ut($,ma),Ut($,no)),oe.svgFilters===!0&&(Ut(N,va),Ut($,ma),Ut($,no)),oe.mathMl===!0&&(Ut(N,ga),Ut($,Kc),Ut($,no))),F.ADD_TAGS&&(typeof F.ADD_TAGS=="function"?I.tagCheck=F.ADD_TAGS:(N===V&&(N=Oi(N)),Ut(N,F.ADD_TAGS,et))),F.ADD_ATTR&&(typeof F.ADD_ATTR=="function"?I.attributeCheck=F.ADD_ATTR:($===ee&&($=Oi($)),Ut($,F.ADD_ATTR,et))),F.ADD_URI_SAFE_ATTR&&Ut(nt,F.ADD_URI_SAFE_ATTR,et),F.FORBID_CONTENTS&&(pe===Ce&&(pe=Oi(pe)),Ut(pe,F.FORBID_CONTENTS,et)),F.ADD_FORBID_CONTENTS&&(pe===Ce&&(pe=Oi(pe)),Ut(pe,F.ADD_FORBID_CONTENTS,et)),_e&&(N["#text"]=!0),we&&Ut(N,["html","head","body"]),N.table&&(Ut(N,["tbody"]),delete ue.tbody),F.TRUSTED_TYPES_POLICY){if(typeof F.TRUSTED_TYPES_POLICY.createHTML!="function")throw ps('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof F.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ps('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=F.TRUSTED_TYPES_POLICY,k=y.createHTML("")}else y===void 0&&(y=xy(m,s)),y!==null&&typeof k=="string"&&(k=y.createHTML(""));ei&&ei(F),Ct=F}},Rt=Ut({},[..._a,...va,...dy]),It=Ut({},[...ga,...uy]),Ht=function(F){let Q=p(F);(!Q||!Q.tagName)&&(Q={namespaceURI:Le,tagName:"template"});const ve=po(F.tagName),Te=po(Q.tagName);return it[F.namespaceURI]?F.namespaceURI===at?Q.namespaceURI===Ze?ve==="svg":Q.namespaceURI===qe?ve==="svg"&&(Te==="annotation-xml"||vt[Te]):!!Rt[ve]:F.namespaceURI===qe?Q.namespaceURI===Ze?ve==="math":Q.namespaceURI===at?ve==="math"&&ft[Te]:!!It[ve]:F.namespaceURI===Ze?Q.namespaceURI===at&&!ft[Te]||Q.namespaceURI===qe&&!vt[Te]?!1:!It[ve]&&(ht[ve]||!Rt[ve]):!!(pt==="application/xhtml+xml"&&it[F.namespaceURI]):!1},Et=function(F){hs(e.removed,{element:F});try{p(F).removeChild(F)}catch{f(F)}},fe=function(F,Q){try{hs(e.removed,{attribute:Q.getAttributeNode(F),from:Q})}catch{hs(e.removed,{attribute:null,from:Q})}if(Q.removeAttribute(F),F==="is")if(Se||Be)try{Et(Q)}catch{}else try{Q.setAttribute(F,"")}catch{}},be=function(F){let Q=null,ve=null;if(Pe)F="<remove></remove>"+F;else{const ct=pa(F,/^[\r\n\t ]+/);ve=ct&&ct[0]}pt==="application/xhtml+xml"&&Le===Ze&&(F='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+F+"</body></html>");const Te=y?y.createHTML(F):F;if(Le===Ze)try{Q=new v().parseFromString(Te,pt)}catch{}if(!Q||!Q.documentElement){Q=C.createDocument(Le,"template",null);try{Q.documentElement.innerHTML=Ae?k:Te}catch{}}const rt=Q.body||Q.documentElement;return F&&ve&&rt.insertBefore(r.createTextNode(ve),rt.childNodes[0]||null),Le===Ze?T.call(Q,we?"html":"body")[0]:we?Q.documentElement:rt},We=function(F){return A.call(F.ownerDocument||F,F,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Je=function(F){return F instanceof h&&(typeof F.nodeName!="string"||typeof F.textContent!="string"||typeof F.removeChild!="function"||!(F.attributes instanceof g)||typeof F.removeAttribute!="function"||typeof F.setAttribute!="function"||typeof F.namespaceURI!="string"||typeof F.insertBefore!="function"||typeof F.hasChildNodes!="function")},ut=function(F){return typeof o=="function"&&F instanceof o};function Xe(re,F,Q){io(re,ve=>{ve.call(e,F,Q,Ct)})}const ie=function(F){let Q=null;if(Xe(H.beforeSanitizeElements,F,null),Je(F))return Et(F),!0;const ve=et(F.nodeName);if(Xe(H.uponSanitizeElement,F,{tagName:ve,allowedTags:N}),ge&&F.hasChildNodes()&&!ut(F.firstElementChild)&&Qr(/<[/\w!]/g,F.innerHTML)&&Qr(/<[/\w!]/g,F.textContent)||F.nodeType===vs.progressingInstruction||ge&&F.nodeType===vs.comment&&Qr(/<[/\w]/g,F.data))return Et(F),!0;if(!(I.tagCheck instanceof Function&&I.tagCheck(ve))&&(!N[ve]||ue[ve])){if(!ue[ve]&&De(ve)&&(ce.tagNameCheck instanceof RegExp&&Qr(ce.tagNameCheck,ve)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(ve)))return!1;if(_e&&!pe[ve]){const Te=p(F)||F.parentNode,rt=l(F)||F.childNodes;if(rt&&Te){const ct=rt.length;for(let wt=ct-1;wt>=0;--wt){const he=b(rt[wt],!0);he.__removalCount=(F.__removalCount||0)+1,Te.insertBefore(he,u(F))}}}return Et(F),!0}return F instanceof a&&!Ht(F)||(ve==="noscript"||ve==="noembed"||ve==="noframes")&&Qr(/<\/no(script|embed|frames)/i,F.innerHTML)?(Et(F),!0):(te&&F.nodeType===vs.text&&(Q=F.textContent,io([W,M,G],Te=>{Q=fs(Q,Te," ")}),F.textContent!==Q&&(hs(e.removed,{element:F.cloneNode()}),F.textContent=Q)),Xe(H.afterSanitizeElements,F,null),!1)},ke=function(F,Q,ve){if(je&&(Q==="id"||Q==="name")&&(ve in r||ve in kt))return!1;if(!(O&&!B[Q]&&Qr(X,Q))){if(!(z&&Qr(le,Q))){if(!(I.attributeCheck instanceof Function&&I.attributeCheck(Q,F))){if(!$[Q]||B[Q]){if(!(De(F)&&(ce.tagNameCheck instanceof RegExp&&Qr(ce.tagNameCheck,F)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(F))&&(ce.attributeNameCheck instanceof RegExp&&Qr(ce.attributeNameCheck,Q)||ce.attributeNameCheck instanceof Function&&ce.attributeNameCheck(Q,F))||Q==="is"&&ce.allowCustomizedBuiltInElements&&(ce.tagNameCheck instanceof RegExp&&Qr(ce.tagNameCheck,ve)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(ve))))return!1}else if(!nt[Q]){if(!Qr(j,fs(ve,xe,""))){if(!((Q==="src"||Q==="xlink:href"||Q==="href")&&F!=="script"&&oy(ve,"data:")===0&&He[F])){if(!(ne&&!Qr(me,fs(ve,xe,"")))){if(ve)return!1}}}}}}}return!0},De=function(F){return F!=="annotation-xml"&&pa(F,R)},J=function(F){Xe(H.beforeSanitizeAttributes,F,null);const{attributes:Q}=F;if(!Q||Je(F))return;const ve={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$,forceKeepAttr:void 0};let Te=Q.length;for(;Te--;){const rt=Q[Te],{name:ct,namespaceURI:wt,value:he}=rt,dt=et(ct),At=he;let yt=ct==="value"?At:ay(At);if(ve.attrName=dt,ve.attrValue=yt,ve.keepAttr=!0,ve.forceKeepAttr=void 0,Xe(H.uponSanitizeAttribute,F,ve),yt=ve.attrValue,ze&&(dt==="id"||dt==="name")&&(fe(ct,F),yt=Ne+yt),ge&&Qr(/((--!?|])>)|<\/(style|title|textarea)/i,yt)){fe(ct,F);continue}if(dt==="attributename"&&pa(yt,"href")){fe(ct,F);continue}if(ve.forceKeepAttr)continue;if(!ve.keepAttr){fe(ct,F);continue}if(!ae&&Qr(/\/>/i,yt)){fe(ct,F);continue}te&&io([W,M,G],ot=>{yt=fs(yt,ot," ")});const st=et(F.nodeName);if(!ke(st,dt,yt)){fe(ct,F);continue}if(y&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!wt)switch(m.getAttributeType(st,dt)){case"TrustedHTML":{yt=y.createHTML(yt);break}case"TrustedScriptURL":{yt=y.createScriptURL(yt);break}}if(yt!==At)try{wt?F.setAttributeNS(wt,ct,yt):F.setAttribute(ct,yt),Je(F)?Et(F):zc(e.removed)}catch{fe(ct,F)}}Xe(H.afterSanitizeAttributes,F,null)},Z=function re(F){let Q=null;const ve=We(F);for(Xe(H.beforeSanitizeShadowDOM,F,null);Q=ve.nextNode();)Xe(H.uponSanitizeShadowNode,Q,null),ie(Q),J(Q),Q.content instanceof d&&re(Q.content);Xe(H.afterSanitizeShadowDOM,F,null)};return e.sanitize=function(re){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Q=null,ve=null,Te=null,rt=null;if(Ae=!re,Ae&&(re="<!-->"),typeof re!="string"&&!ut(re))if(typeof re.toString=="function"){if(re=re.toString(),typeof re!="string")throw ps("dirty is not a string, aborting")}else throw ps("toString is not a function");if(!e.isSupported)return re;if(Ie||Pt(F),e.removed=[],typeof re=="string"&&(Me=!1),Me){if(re.nodeName){const he=et(re.nodeName);if(!N[he]||ue[he])throw ps("root node is forbidden and cannot be sanitized in-place")}}else if(re instanceof o)Q=be("<!---->"),ve=Q.ownerDocument.importNode(re,!0),ve.nodeType===vs.element&&ve.nodeName==="BODY"||ve.nodeName==="HTML"?Q=ve:Q.appendChild(ve);else{if(!Se&&!te&&!we&&re.indexOf("<")===-1)return y&&Ue?y.createHTML(re):re;if(Q=be(re),!Q)return Se?null:Ue?k:""}Q&&Pe&&Et(Q.firstChild);const ct=We(Me?re:Q);for(;Te=ct.nextNode();)ie(Te),J(Te),Te.content instanceof d&&Z(Te.content);if(Me)return re;if(Se){if(Be)for(rt=S.call(Q.ownerDocument);Q.firstChild;)rt.appendChild(Q.firstChild);else rt=Q;return($.shadowroot||$.shadowrootmode)&&(rt=D.call(n,rt,!0)),rt}let wt=we?Q.outerHTML:Q.innerHTML;return we&&N["!doctype"]&&Q.ownerDocument&&Q.ownerDocument.doctype&&Q.ownerDocument.doctype.name&&Qr($u,Q.ownerDocument.doctype.name)&&(wt="<!DOCTYPE "+Q.ownerDocument.doctype.name+`>
253
+ `+wt),te&&io([W,M,G],he=>{wt=fs(wt,he," ")}),y&&Ue?y.createHTML(wt):wt},e.setConfig=function(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pt(re),Ie=!0},e.clearConfig=function(){Ct=null,Ie=!1},e.isValidAttribute=function(re,F,Q){Ct||Pt({});const ve=et(re),Te=et(F);return ke(ve,Te,Q)},e.addHook=function(re,F){typeof F=="function"&&hs(H[re],F)},e.removeHook=function(re,F){if(F!==void 0){const Q=ny(H[re],F);return Q===-1?void 0:sy(H[re],Q,1)[0]}return zc(H[re])},e.removeHooks=function(re){H[re]=[]},e.removeAllHooks=function(){H=Jc()},e}var wy=eh();function Rl(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var jn=Rl();function th(t){jn=t}var vn={exec:()=>null};function Qt(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(s,d)=>{let _=typeof d=="string"?d:d.source;return _=_.replace(Zr.caret,"$1"),r=r.replace(s,_),n},getRegex:()=>new RegExp(r,e)};return n}var Sy=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Zr={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Cy=/^(?:[ \t]*(?:\n|$))+/,ky=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ey=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ks=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ay=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Il=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,rh=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ih=Qt(rh).replace(/bull/g,Il).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ty=Qt(rh).replace(/bull/g,Il).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Dl=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Py=/^[^\n]+/,Ml=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ly=Qt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ml).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ry=Qt(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Il).getRegex(),Ko="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ol=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Iy=Qt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ol).replace("tag",Ko).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),nh=Qt(Dl).replace("hr",Ks).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex(),Dy=Qt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",nh).getRegex(),Bl={blockquote:Dy,code:ky,def:Ly,fences:Ey,heading:Ay,hr:Ks,html:Iy,lheading:ih,list:Ry,newline:Cy,paragraph:nh,table:vn,text:Py},Yc=Qt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ks).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex(),My={...Bl,lheading:Ty,table:Yc,paragraph:Qt(Dl).replace("hr",Ks).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Yc).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex()},Oy={...Bl,html:Qt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ol).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:vn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Qt(Dl).replace("hr",Ks).replace("heading",` *#{1,6} *[^
254
+ ]`).replace("lheading",ih).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},By=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ny=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,sh=/^( {2,}|\\)\n(?!\s*$)/,jy=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Xo=/[\p{P}\p{S}]/u,Nl=/[\s\p{P}\p{S}]/u,oh=/[^\s\p{P}\p{S}]/u,Hy=Qt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Nl).getRegex(),ah=/(?!~)[\p{P}\p{S}]/u,Fy=/(?!~)[\s\p{P}\p{S}]/u,Uy=/(?:[^\s\p{P}\p{S}]|~)/u,lh=/(?![*_])[\p{P}\p{S}]/u,Vy=/(?![*_])[\s\p{P}\p{S}]/u,zy=/(?:[^\s\p{P}\p{S}]|[*_])/u,Wy=Qt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Sy?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ch=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,qy=Qt(ch,"u").replace(/punct/g,Xo).getRegex(),Gy=Qt(ch,"u").replace(/punct/g,ah).getRegex(),dh="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ky=Qt(dh,"gu").replace(/notPunctSpace/g,oh).replace(/punctSpace/g,Nl).replace(/punct/g,Xo).getRegex(),Xy=Qt(dh,"gu").replace(/notPunctSpace/g,Uy).replace(/punctSpace/g,Fy).replace(/punct/g,ah).getRegex(),Jy=Qt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,oh).replace(/punctSpace/g,Nl).replace(/punct/g,Xo).getRegex(),Yy=Qt(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,lh).getRegex(),Qy="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Zy=Qt(Qy,"gu").replace(/notPunctSpace/g,zy).replace(/punctSpace/g,Vy).replace(/punct/g,lh).getRegex(),$y=Qt(/\\(punct)/,"gu").replace(/punct/g,Xo).getRegex(),ex=Qt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),tx=Qt(Ol).replace("(?:-->|$)","-->").getRegex(),rx=Qt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",tx).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ro=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,ix=Qt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ro).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),uh=Qt(/^!?\[(label)\]\[(ref)\]/).replace("label",Ro).replace("ref",Ml).getRegex(),hh=Qt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ml).getRegex(),nx=Qt("reflink|nolink(?!\\()","g").replace("reflink",uh).replace("nolink",hh).getRegex(),Qc=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,jl={_backpedal:vn,anyPunctuation:$y,autolink:ex,blockSkip:Wy,br:sh,code:Ny,del:vn,delLDelim:vn,delRDelim:vn,emStrongLDelim:qy,emStrongRDelimAst:Ky,emStrongRDelimUnd:Jy,escape:By,link:ix,nolink:hh,punctuation:Hy,reflink:uh,reflinkSearch:nx,tag:rx,text:jy,url:vn},sx={...jl,link:Qt(/^!?\[(label)\]\((.*?)\)/).replace("label",Ro).getRegex(),reflink:Qt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ro).getRegex()},Ja={...jl,emStrongRDelimAst:Xy,emStrongLDelim:Gy,delLDelim:Yy,delRDelim:Zy,url:Qt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Qc).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Qt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Qc).getRegex()},ox={...Ja,br:Qt(sh).replace("{2,}","*").getRegex(),text:Qt(Ja.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},so={normal:Bl,gfm:My,pedantic:Oy},gs={normal:jl,gfm:Ja,breaks:ox,pedantic:sx},ax={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Zc=t=>ax[t];function Bi(t,e){if(e){if(Zr.escapeTest.test(t))return t.replace(Zr.escapeReplace,Zc)}else if(Zr.escapeTestNoEncode.test(t))return t.replace(Zr.escapeReplaceNoEncode,Zc);return t}function $c(t){try{t=encodeURI(t).replace(Zr.percentDecode,"%")}catch{return null}return t}function ed(t,e){var d;let r=t.replace(Zr.findPipe,(_,o,a)=>{let c=!1,g=o;for(;--g>=0&&a[g]==="\\";)c=!c;return c?"|":" |"}),n=r.split(Zr.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!((d=n.at(-1))!=null&&d.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(Zr.slashPipe,"|");return n}function ms(t,e,r){let n=t.length;if(n===0)return"";let s=0;for(;s<n&&t.charAt(n-s-1)===e;)s++;return t.slice(0,n-s)}function lx(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function cx(t,e=0){let r=e,n="";for(let s of t)if(s===" "){let d=4-r%4;n+=" ".repeat(d),r+=d}else n+=s,r++;return n}function td(t,e,r,n,s){let d=e.href,_=e.title||null,o=t[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;let a={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:d,title:_,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,a}function dx(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let s=n[1];return e.split(`
255
+ `).map(d=>{let _=d.match(r.other.beginningSpace);if(_===null)return d;let[o]=_;return o.length>=s.length?d.slice(s.length):d}).join(`
256
+ `)}var Io=class{constructor(t){Ee(this,"options");Ee(this,"rules");Ee(this,"lexer");this.options=t||jn}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:ms(r,`
257
+ `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],n=dx(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let n=ms(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:ms(e[0],`
258
+ `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=ms(e[0],`
259
+ `).split(`
260
+ `),n="",s="",d=[];for(;r.length>0;){let _=!1,o=[],a;for(a=0;a<r.length;a++)if(this.rules.other.blockquoteStart.test(r[a]))o.push(r[a]),_=!0;else if(!_)o.push(r[a]);else break;r=r.slice(a);let c=o.join(`
261
+ `),g=c.replace(this.rules.other.blockquoteSetextReplace,`
262
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
263
+ ${c}`:c,s=s?`${s}
264
+ ${g}`:g;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,d,!0),this.lexer.state.top=h,r.length===0)break;let v=d.at(-1);if((v==null?void 0:v.type)==="code")break;if((v==null?void 0:v.type)==="blockquote"){let m=v,w=m.raw+`
265
+ `+r.join(`
266
+ `),b=this.blockquote(w);d[d.length-1]=b,n=n.substring(0,n.length-m.raw.length)+b.raw,s=s.substring(0,s.length-m.text.length)+b.text;break}else if((v==null?void 0:v.type)==="list"){let m=v,w=m.raw+`
267
+ `+r.join(`
268
+ `),b=this.list(w);d[d.length-1]=b,n=n.substring(0,n.length-v.raw.length)+b.raw,s=s.substring(0,s.length-m.raw.length)+b.raw,r=w.substring(d.at(-1).raw.length).split(`
269
+ `);continue}}return{type:"blockquote",raw:n,tokens:d,text:s}}}list(t){var r,n;let e=this.rules.block.list.exec(t);if(e){let s=e[1].trim(),d=s.length>1,_={type:"list",raw:"",ordered:d,start:d?+s.slice(0,-1):"",loose:!1,items:[]};s=d?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=d?s:"[*+-]");let o=this.rules.other.listItemRegex(s),a=!1;for(;t;){let g=!1,h="",v="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let m=cx(e[2].split(`
270
+ `,1)[0],e[1].length),w=t.split(`
271
+ `,1)[0],b=!m.trim(),f=0;if(this.options.pedantic?(f=2,v=m.trimStart()):b?f=e[1].length+1:(f=m.search(this.rules.other.nonSpaceChar),f=f>4?1:f,v=m.slice(f),f+=e[1].length),b&&this.rules.other.blankLine.test(w)&&(h+=w+`
272
+ `,t=t.substring(w.length+1),g=!0),!g){let u=this.rules.other.nextBulletRegex(f),l=this.rules.other.hrRegex(f),p=this.rules.other.fencesBeginRegex(f),y=this.rules.other.headingBeginRegex(f),k=this.rules.other.htmlBeginRegex(f),C=this.rules.other.blockquoteBeginRegex(f);for(;t;){let A=t.split(`
273
+ `,1)[0],S;if(w=A,this.options.pedantic?(w=w.replace(this.rules.other.listReplaceNesting," "),S=w):S=w.replace(this.rules.other.tabCharGlobal," "),p.test(w)||y.test(w)||k.test(w)||C.test(w)||u.test(w)||l.test(w))break;if(S.search(this.rules.other.nonSpaceChar)>=f||!w.trim())v+=`
274
+ `+S.slice(f);else{if(b||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||p.test(m)||y.test(m)||l.test(m))break;v+=`
275
+ `+w}b=!w.trim(),h+=A+`
276
+ `,t=t.substring(A.length+1),m=S.slice(f)}}_.loose||(a?_.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!0)),_.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,tokens:[]}),_.raw+=h}let c=_.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;_.raw=_.raw.trimEnd();for(let g of _.items){if(this.lexer.state.top=!1,g.tokens=this.lexer.blockTokens(g.text,[]),g.task){if(g.text=g.text.replace(this.rules.other.listReplaceTask,""),((r=g.tokens[0])==null?void 0:r.type)==="text"||((n=g.tokens[0])==null?void 0:n.type)==="paragraph"){g.tokens[0].raw=g.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),g.tokens[0].text=g.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let v=this.lexer.inlineQueue.length-1;v>=0;v--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[v].src)){this.lexer.inlineQueue[v].src=this.lexer.inlineQueue[v].src.replace(this.rules.other.listReplaceTask,"");break}}let h=this.rules.other.listTaskCheckbox.exec(g.raw);if(h){let v={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};g.checked=v.checked,_.loose?g.tokens[0]&&["paragraph","text"].includes(g.tokens[0].type)&&"tokens"in g.tokens[0]&&g.tokens[0].tokens?(g.tokens[0].raw=v.raw+g.tokens[0].raw,g.tokens[0].text=v.raw+g.tokens[0].text,g.tokens[0].tokens.unshift(v)):g.tokens.unshift({type:"paragraph",raw:v.raw,text:v.raw,tokens:[v]}):g.tokens.unshift(v)}}if(!_.loose){let h=g.tokens.filter(m=>m.type==="space"),v=h.length>0&&h.some(m=>this.rules.other.anyLine.test(m.raw));_.loose=v}}if(_.loose)for(let g of _.items){g.loose=!0;for(let h of g.tokens)h.type==="text"&&(h.type="paragraph")}return _}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:n,title:s}}}table(t){var _;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=ed(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(_=e[3])!=null&&_.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
277
+ `):[],d={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===n.length){for(let o of n)this.rules.other.tableAlignRight.test(o)?d.align.push("right"):this.rules.other.tableAlignCenter.test(o)?d.align.push("center"):this.rules.other.tableAlignLeft.test(o)?d.align.push("left"):d.align.push(null);for(let o=0;o<r.length;o++)d.header.push({text:r[o],tokens:this.lexer.inline(r[o]),header:!0,align:d.align[o]});for(let o of s)d.rows.push(ed(o,d.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:d.align[c]})));return d}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===`
278
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let d=ms(r.slice(0,-1),"\\");if((r.length-d.length)%2===0)return}else{let d=lx(e[2],"()");if(d===-2)return;if(d>-1){let _=(e[0].indexOf("!")===0?5:4)+e[1].length+d;e[2]=e[2].substring(0,d),e[0]=e[0].substring(0,_).trim(),e[3]=""}}let n=e[2],s="";if(this.options.pedantic){let d=this.rules.other.pedanticHrefTitle.exec(n);d&&(n=d[1],s=d[3])}else s=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),td(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[n.toLowerCase()];if(!s){let d=r[0].charAt(0);return{type:"text",raw:d,text:d}}return td(r,s,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!r||this.rules.inline.punctuation.exec(r))){let s=[...n[0]].length-1,d,_,o=s,a=0,c=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+s);(n=c.exec(e))!=null;){if(d=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!d)continue;if(_=[...d].length,n[3]||n[4]){o+=_;continue}else if((n[5]||n[6])&&s%3&&!((s+_)%3)){a+=_;continue}if(o-=_,o>0)continue;_=Math.min(_,_+o+a);let g=[...n[0]][0].length,h=t.slice(0,s+n.index+g+_);if(Math.min(s,_)%2){let m=h.slice(1,-1);return{type:"em",raw:h,text:m,tokens:this.lexer.inlineTokens(m)}}let v=h.slice(2,-2);return{type:"strong",raw:h,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,r=""){let n=this.rules.inline.delLDelim.exec(t);if(n&&(!n[1]||!r||this.rules.inline.punctuation.exec(r))){let s=[...n[0]].length-1,d,_,o=s,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*t.length+s);(n=a.exec(e))!=null;){if(d=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!d||(_=[...d].length,_!==s))continue;if(n[3]||n[4]){o+=_;continue}if(o-=_,o>0)continue;_=Math.min(_,_+o);let c=[...n[0]][0].length,g=t.slice(0,s+n.index+c+_),h=g.slice(s,-s);return{type:"del",raw:g,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let e;if(e=this.rules.inline.url.exec(t)){let n,s;if(e[2]==="@")n=e[0],s="mailto:"+n;else{let d;do d=e[0],e[0]=((r=this.rules.inline._backpedal.exec(e[0]))==null?void 0:r[0])??"";while(d!==e[0]);n=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},Ti=class Ya{constructor(e){Ee(this,"tokens");Ee(this,"options");Ee(this,"state");Ee(this,"inlineQueue");Ee(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||jn,this.options.tokenizer=this.options.tokenizer||new Io,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:Zr,block:so.normal,inline:gs.normal};this.options.pedantic?(r.block=so.pedantic,r.inline=gs.pedantic):this.options.gfm&&(r.block=so.gfm,this.options.breaks?r.inline=gs.breaks:r.inline=gs.gfm),this.tokenizer.rules=r}static get rules(){return{block:so,inline:gs}}static lex(e,r){return new Ya(r).lex(e)}static lexInline(e,r){return new Ya(r).inlineTokens(e)}lex(e){e=e.replace(Zr.carriageReturn,`
279
+ `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){var s,d,_;for(this.options.pedantic&&(e=e.replace(Zr.tabCharGlobal," ").replace(Zr.spaceLine,""));e;){let o;if((d=(s=this.options.extensions)==null?void 0:s.block)!=null&&d.some(c=>(o=c.call({lexer:this},e,r))?(e=e.substring(o.raw.length),r.push(o),!0):!1))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);let c=r.at(-1);o.raw.length===1&&c!==void 0?c.raw+=`
280
+ `:r.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
281
+ `)?"":`
282
+ `)+o.raw,c.text+=`
283
+ `+o.text,this.inlineQueue.at(-1).src=c.text):r.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
284
+ `)?"":`
285
+ `)+o.raw,c.text+=`
286
+ `+o.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},r.push(o));continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),r.push(o);continue}let a=e;if((_=this.options.extensions)!=null&&_.startBlock){let c=1/0,g=e.slice(1),h;this.options.extensions.startBlock.forEach(v=>{h=v.call({lexer:this},g),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(a=e.substring(0,c+1))}if(this.state.top&&(o=this.tokenizer.paragraph(a))){let c=r.at(-1);n&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
287
+ `)?"":`
288
+ `)+o.raw,c.text+=`
289
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(o),n=a.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
290
+ `)?"":`
291
+ `)+o.raw,c.text+=`
292
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(o);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var a,c,g,h,v;let n=e,s=null;if(this.tokens.links){let m=Object.keys(this.tokens.links);if(m.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)m.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let d;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)d=s[2]?s[2].length:0,n=n.slice(0,s.index+d)+"["+"a".repeat(s[0].length-d-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=((c=(a=this.options.hooks)==null?void 0:a.emStrongMask)==null?void 0:c.call({lexer:this},n))??n;let _=!1,o="";for(;e;){_||(o=""),_=!1;let m;if((h=(g=this.options.extensions)==null?void 0:g.inline)!=null&&h.some(b=>(m=b.call({lexer:this},e,r))?(e=e.substring(m.raw.length),r.push(m),!0):!1))continue;if(m=this.tokenizer.escape(e)){e=e.substring(m.raw.length),r.push(m);continue}if(m=this.tokenizer.tag(e)){e=e.substring(m.raw.length),r.push(m);continue}if(m=this.tokenizer.link(e)){e=e.substring(m.raw.length),r.push(m);continue}if(m=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(m.raw.length);let b=r.at(-1);m.type==="text"&&(b==null?void 0:b.type)==="text"?(b.raw+=m.raw,b.text+=m.text):r.push(m);continue}if(m=this.tokenizer.emStrong(e,n,o)){e=e.substring(m.raw.length),r.push(m);continue}if(m=this.tokenizer.codespan(e)){e=e.substring(m.raw.length),r.push(m);continue}if(m=this.tokenizer.br(e)){e=e.substring(m.raw.length),r.push(m);continue}if(m=this.tokenizer.del(e,n,o)){e=e.substring(m.raw.length),r.push(m);continue}if(m=this.tokenizer.autolink(e)){e=e.substring(m.raw.length),r.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(e))){e=e.substring(m.raw.length),r.push(m);continue}let w=e;if((v=this.options.extensions)!=null&&v.startInline){let b=1/0,f=e.slice(1),u;this.options.extensions.startInline.forEach(l=>{u=l.call({lexer:this},f),typeof u=="number"&&u>=0&&(b=Math.min(b,u))}),b<1/0&&b>=0&&(w=e.substring(0,b+1))}if(m=this.tokenizer.inlineText(w)){e=e.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(o=m.raw.slice(-1)),_=!0;let b=r.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=m.raw,b.text+=m.text):r.push(m);continue}if(e){let b="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(b);break}else throw new Error(b)}}return r}},Do=class{constructor(t){Ee(this,"options");Ee(this,"parser");this.options=t||jn}space(t){return""}code({text:t,lang:e,escaped:r}){var d;let n=(d=(e||"").match(Zr.notSpaceStart))==null?void 0:d[0],s=t.replace(Zr.endingNewline,"")+`
293
+ `;return n?'<pre><code class="language-'+Bi(n)+'">'+(r?s:Bi(s,!0))+`</code></pre>
294
+ `:"<pre><code>"+(r?s:Bi(s,!0))+`</code></pre>
295
+ `}blockquote({tokens:t}){return`<blockquote>
296
+ ${this.parser.parse(t)}</blockquote>
297
+ `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
298
+ `}hr(t){return`<hr>
299
+ `}list(t){let e=t.ordered,r=t.start,n="";for(let _=0;_<t.items.length;_++){let o=t.items[_];n+=this.listitem(o)}let s=e?"ol":"ul",d=e&&r!==1?' start="'+r+'"':"";return"<"+s+d+`>
300
+ `+n+"</"+s+`>
301
+ `}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
302
+ `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
303
+ `}table(t){let e="",r="";for(let s=0;s<t.header.length;s++)r+=this.tablecell(t.header[s]);e+=this.tablerow({text:r});let n="";for(let s=0;s<t.rows.length;s++){let d=t.rows[s];r="";for(let _=0;_<d.length;_++)r+=this.tablecell(d[_]);n+=this.tablerow({text:r})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
304
+ <thead>
305
+ `+e+`</thead>
306
+ `+n+`</table>
307
+ `}tablerow({text:t}){return`<tr>
308
+ ${t}</tr>
309
+ `}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
310
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Bi(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){let n=this.parser.parseInline(r),s=$c(t);if(s===null)return n;t=s;let d='<a href="'+t+'"';return e&&(d+=' title="'+Bi(e)+'"'),d+=">"+n+"</a>",d}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let s=$c(t);if(s===null)return Bi(r);t=s;let d=`<img src="${t}" alt="${Bi(r)}"`;return e&&(d+=` title="${Bi(e)}"`),d+=">",d}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Bi(t.text)}},Hl=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},Pi=class Qa{constructor(e){Ee(this,"options");Ee(this,"renderer");Ee(this,"textRenderer");this.options=e||jn,this.options.renderer=this.options.renderer||new Do,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Hl}static parse(e,r){return new Qa(r).parse(e)}static parseInline(e,r){return new Qa(r).parseInline(e)}parse(e){var n,s;let r="";for(let d=0;d<e.length;d++){let _=e[d];if((s=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&s[_.type]){let a=_,c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){r+=c||"";continue}}let o=_;switch(o.type){case"space":{r+=this.renderer.space(o);break}case"hr":{r+=this.renderer.hr(o);break}case"heading":{r+=this.renderer.heading(o);break}case"code":{r+=this.renderer.code(o);break}case"table":{r+=this.renderer.table(o);break}case"blockquote":{r+=this.renderer.blockquote(o);break}case"list":{r+=this.renderer.list(o);break}case"checkbox":{r+=this.renderer.checkbox(o);break}case"html":{r+=this.renderer.html(o);break}case"def":{r+=this.renderer.def(o);break}case"paragraph":{r+=this.renderer.paragraph(o);break}case"text":{r+=this.renderer.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,r=this.renderer){var s,d;let n="";for(let _=0;_<e.length;_++){let o=e[_];if((d=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&d[o.type]){let c=this.options.extensions.renderers[o.type].call({parser:this},o);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=c||"";continue}}let a=o;switch(a.type){case"escape":{n+=r.text(a);break}case"html":{n+=r.html(a);break}case"link":{n+=r.link(a);break}case"image":{n+=r.image(a);break}case"checkbox":{n+=r.checkbox(a);break}case"strong":{n+=r.strong(a);break}case"em":{n+=r.em(a);break}case"codespan":{n+=r.codespan(a);break}case"br":{n+=r.br(a);break}case"del":{n+=r.del(a);break}case"text":{n+=r.text(a);break}default:{let c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}},oo,Cs=(oo=class{constructor(t){Ee(this,"options");Ee(this,"block");this.options=t||jn}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?Ti.lex:Ti.lexInline}provideParser(){return this.block?Pi.parse:Pi.parseInline}},Ee(oo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Ee(oo,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),oo),ux=class{constructor(...t){Ee(this,"defaults",Rl());Ee(this,"options",this.setOptions);Ee(this,"parse",this.parseMarkdown(!0));Ee(this,"parseInline",this.parseMarkdown(!1));Ee(this,"Parser",Pi);Ee(this,"Renderer",Do);Ee(this,"TextRenderer",Hl);Ee(this,"Lexer",Ti);Ee(this,"Tokenizer",Io);Ee(this,"Hooks",Cs);this.use(...t)}walkTokens(t,e){var n,s;let r=[];for(let d of t)switch(r=r.concat(e.call(this,d)),d.type){case"table":{let _=d;for(let o of _.header)r=r.concat(this.walkTokens(o.tokens,e));for(let o of _.rows)for(let a of o)r=r.concat(this.walkTokens(a.tokens,e));break}case"list":{let _=d;r=r.concat(this.walkTokens(_.items,e));break}default:{let _=d;(s=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&s[_.type]?this.defaults.extensions.childTokens[_.type].forEach(o=>{let a=_[o].flat(1/0);r=r.concat(this.walkTokens(a,e))}):_.tokens&&(r=r.concat(this.walkTokens(_.tokens,e)))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let d=e.renderers[s.name];d?e.renderers[s.name]=function(..._){let o=s.renderer.apply(this,_);return o===!1&&(o=d.apply(this,_)),o}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let d=e[s.level];d?d.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),r.renderer){let s=this.defaults.renderer||new Do(this.defaults);for(let d in r.renderer){if(!(d in s))throw new Error(`renderer '${d}' does not exist`);if(["options","parser"].includes(d))continue;let _=d,o=r.renderer[_],a=s[_];s[_]=(...c)=>{let g=o.apply(s,c);return g===!1&&(g=a.apply(s,c)),g||""}}n.renderer=s}if(r.tokenizer){let s=this.defaults.tokenizer||new Io(this.defaults);for(let d in r.tokenizer){if(!(d in s))throw new Error(`tokenizer '${d}' does not exist`);if(["options","rules","lexer"].includes(d))continue;let _=d,o=r.tokenizer[_],a=s[_];s[_]=(...c)=>{let g=o.apply(s,c);return g===!1&&(g=a.apply(s,c)),g}}n.tokenizer=s}if(r.hooks){let s=this.defaults.hooks||new Cs;for(let d in r.hooks){if(!(d in s))throw new Error(`hook '${d}' does not exist`);if(["options","block"].includes(d))continue;let _=d,o=r.hooks[_],a=s[_];Cs.passThroughHooks.has(d)?s[_]=c=>{if(this.defaults.async&&Cs.passThroughHooksRespectAsync.has(d))return(async()=>{let h=await o.call(s,c);return a.call(s,h)})();let g=o.call(s,c);return a.call(s,g)}:s[_]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await o.apply(s,c);return h===!1&&(h=await a.apply(s,c)),h})();let g=o.apply(s,c);return g===!1&&(g=a.apply(s,c)),g}}n.hooks=s}if(r.walkTokens){let s=this.defaults.walkTokens,d=r.walkTokens;n.walkTokens=function(_){let o=[];return o.push(d.call(this,_)),s&&(o=o.concat(s.call(this,_))),o}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Ti.lex(t,e??this.defaults)}parser(t,e){return Pi.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let n={...r},s={...this.defaults,...n},d=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let _=s.hooks?await s.hooks.preprocess(e):e,o=await(s.hooks?await s.hooks.provideLexer():t?Ti.lex:Ti.lexInline)(_,s),a=s.hooks?await s.hooks.processAllTokens(o):o;s.walkTokens&&await Promise.all(this.walkTokens(a,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser():t?Pi.parse:Pi.parseInline)(a,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(d);try{s.hooks&&(e=s.hooks.preprocess(e));let _=(s.hooks?s.hooks.provideLexer():t?Ti.lex:Ti.lexInline)(e,s);s.hooks&&(_=s.hooks.processAllTokens(_)),s.walkTokens&&this.walkTokens(_,s.walkTokens);let o=(s.hooks?s.hooks.provideParser():t?Pi.parse:Pi.parseInline)(_,s);return s.hooks&&(o=s.hooks.postprocess(o)),o}catch(_){return d(_)}}}onError(t,e){return r=>{if(r.message+=`
311
+ Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error occurred:</p><pre>"+Bi(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Mn=new ux;function lr(t,e){return Mn.parse(t,e)}lr.options=lr.setOptions=function(t){return Mn.setOptions(t),lr.defaults=Mn.defaults,th(lr.defaults),lr};lr.getDefaults=Rl;lr.defaults=jn;lr.use=function(...t){return Mn.use(...t),lr.defaults=Mn.defaults,th(lr.defaults),lr};lr.walkTokens=function(t,e){return Mn.walkTokens(t,e)};lr.parseInline=Mn.parseInline;lr.Parser=Pi;lr.parser=Pi.parse;lr.Renderer=Do;lr.TextRenderer=Hl;lr.Lexer=Ti;lr.lexer=Ti.lex;lr.Tokenizer=Io;lr.Hooks=Cs;lr.parse=lr;lr.options;lr.setOptions;lr.use;lr.walkTokens;lr.parseInline;Pi.parse;Ti.lex;var hx=U('<div class="flex items-center gap-0.5"><button type="button" class="w-6 h-6 flex items-center justify-center rounded hover:bg-bg-tertiary text-text-tertiary hover:text-text-primary disabled:opacity-30 disabled:cursor-not-allowed transition-colors" aria-label="Previous message" title="Previous message"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"></polyline></svg></button> <button type="button" class="w-6 h-6 flex items-center justify-center rounded hover:bg-bg-tertiary text-text-tertiary hover:text-text-primary disabled:opacity-30 disabled:cursor-not-allowed transition-colors" aria-label="Next message" title="Next message"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg></button> <button type="button" class="w-6 h-6 flex items-center justify-center rounded hover:bg-bg-tertiary text-text-tertiary hover:text-text-primary disabled:opacity-30 disabled:cursor-not-allowed transition-colors" aria-label="Jump to first message" title="Jump to first message"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="11 17 6 12 11 7"></polyline><polyline points="18 17 13 12 18 7"></polyline></svg></button> <button type="button" class="w-6 h-6 flex items-center justify-center rounded hover:bg-bg-tertiary text-text-tertiary hover:text-text-primary disabled:opacity-30 disabled:cursor-not-allowed transition-colors" aria-label="Jump to last message" title="Jump to last message"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="13 17 18 12 13 7"></polyline><polyline points="6 17 11 12 6 7"></polyline></svg></button></div>'),fx=U('<div class="flex items-center justify-center gap-2 mb-3"><div class="flex bg-bg-tertiary rounded-md p-0.5"><button type="button">Chat</button> <button type="button">Carousel</button></div> <button type="button"> </button> <!></div>'),px=U('<div class="flex items-center justify-center py-12"><div class="flex items-center gap-2 text-text-tertiary"><svg class="animate-spin h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> <span class="text-sm">Loading transcript...</span></div></div>'),_x=U('<div class="flex items-center justify-center py-12"><div class="max-w-md p-4 bg-danger-muted border border-danger-emphasis rounded-lg"><h3 class="text-sm font-semibold text-danger-fg mb-2">Error loading transcript</h3> <p class="text-sm text-text-secondary"> </p></div></div>'),vx=U('<div class="flex items-center justify-center py-12"><p class="text-sm text-text-tertiary">No user or assistant messages found</p></div>'),gx=Cr('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-success-fg" aria-hidden="true"><polyline points="20 6 9 17 4 12"></polyline></svg>'),mx=Cr('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-text-tertiary" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>'),bx=U('<img class="h-20 w-20 rounded border border-border-default object-cover"/>'),yx=U('<div class="mt-3 flex flex-wrap gap-2"></div>'),xx=U('<button type="button" class="mt-2 text-xs text-accent-fg hover:underline"> </button>'),wx=U(`<div data-chat-tail-anchor="true"><div><div class="px-3 py-1.5 flex items-center justify-between"><span> </span> <div class="flex items-center gap-2"><span class="text-xs text-text-tertiary"> </span> <button type="button" class="p-0.5 hover:bg-bg-hover rounded transition-colors
312
+ focus:outline-none focus:ring-1 focus:ring-accent-emphasis" aria-label="Copy message to clipboard" title="Copy to clipboard"><!></button></div></div> <div class="px-3 py-2"><div><!></div> <!> <!></div></div></div>`),Sx=U('<img class="h-20 w-20 rounded border border-border-default object-cover"/>'),Cx=U('<div class="mt-3 flex flex-wrap gap-2"></div>'),kx=U('<div class="flex w-full justify-end" data-chat-tail-anchor="true" tabindex="-1"><div><div class="px-3 py-1.5 flex items-center justify-between"><span> </span></div> <div class="px-3 py-2"><div class="transcript-markdown text-sm leading-6 break-words text-text-primary svelte-el6yfs"><!></div> <!></div></div></div>'),Ex=U('<img class="h-20 w-20 rounded border border-border-default object-cover"/>'),Ax=U('<div class="mt-3 flex flex-wrap gap-2"></div>'),Tx=U('<div class="flex w-full justify-end" data-chat-tail-anchor="true" tabindex="-1"><div><div class="px-3 py-1.5 flex items-center justify-between"><span> </span></div> <div class="px-3 py-2"><div class="transcript-markdown text-sm leading-6 break-words text-text-primary svelte-el6yfs"><!></div> <!></div></div></div>'),Px=U('<div class="flex w-full justify-start" data-chat-tail-anchor="true" tabindex="-1"><div class="w-fit max-w-[92%] md:max-w-[85%] border-l-4 border-r-0 rounded-r border-success-emphasis bg-bg-secondary"><div class="px-3 py-1.5 flex items-center justify-between"><span class="text-xs font-semibold px-2 py-0.5 rounded bg-success-muted text-success-fg">assistant (live)</span></div> <div class="px-3 py-2"><div class="transcript-markdown text-sm leading-6 break-words text-text-primary svelte-el6yfs"><!></div></div></div></div>'),Lx=U('<div class="flex w-full justify-start" data-chat-tail-anchor="true" tabindex="-1"><div class="w-fit max-w-[92%] md:max-w-[85%] border-l-4 border-r-0 rounded-r border-success-emphasis bg-bg-secondary"><div class="px-3 py-1.5 flex items-center justify-between"><span class="text-xs font-semibold px-2 py-0.5 rounded bg-success-muted text-success-fg">assistant (thinking)</span></div> <div class="px-3 py-2"><div class="text-sm leading-6 font-mono text-text-secondary">Thinking...</div></div></div></div>'),Rx=U("<div><!> <!> <!> <!> <!></div>"),Ix=Cr('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-success-fg" aria-hidden="true"><polyline points="20 6 9 17 4 12"></polyline></svg>'),Dx=Cr('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-text-tertiary" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>'),Mx=U('<img class="h-16 w-16 rounded border border-border-default object-cover"/>'),Ox=U('<div class="mt-3 flex flex-wrap gap-2"></div>'),Bx=U(`<button type="button"><div><div class="flex items-center justify-between mb-3"><span> </span> <div class="flex items-center gap-2"><span class="text-xs text-text-tertiary"> </span> <div role="button" tabindex="0" class="p-0.5 hover:bg-bg-hover rounded transition-colors cursor-pointer
313
+ focus:outline-none focus:ring-1 focus:ring-accent-emphasis" aria-label="Copy message to clipboard" title="Copy to clipboard"><!></div></div></div> <div class="transcript-markdown max-h-[300px] overflow-y-auto text-xs leading-5 break-words text-text-primary svelte-el6yfs"><!></div> <!></div></button>`),Nx=U(`<div class="relative min-h-[200px]"><button type="button" class="absolute left-1 top-1/2 -translate-y-1/2 z-10
314
+ w-8 h-8 flex items-center justify-center rounded-full
315
+ bg-bg-tertiary/80 hover:bg-bg-hover text-text-secondary hover:text-text-primary
316
+ disabled:opacity-30 disabled:cursor-not-allowed
317
+ transition-all shadow-sm" aria-label="Previous message"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"></polyline></svg></button> <button type="button" class="absolute right-1 top-1/2 -translate-y-1/2 z-10
318
+ w-8 h-8 flex items-center justify-center rounded-full
319
+ bg-bg-tertiary/80 hover:bg-bg-hover text-text-secondary hover:text-text-primary
320
+ disabled:opacity-30 disabled:cursor-not-allowed
321
+ transition-all shadow-sm" aria-label="Next message"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg></button> <div class="overflow-hidden select-none"><div class="flex gap-3 transition-transform duration-150 ease-in-out"></div></div> <div class="text-xs text-text-tertiary text-center mt-2"> </div></div>`),jx=U("<div><!> <!></div>");function Hx(t,e){Kt(e,!0);const r=Re(e,"maxMessages",3,void 0),n=Re(e,"autoRefreshMs",3,0),s=Re(e,"followLatest",3,!1),d=Re(e,"focusTailNonce",3,0),_=Re(e,"optimisticUserMessage",3,void 0),o=Re(e,"optimisticUserStatus",3,"queued"),a=Re(e,"optimisticAssistantMessage",3,void 0),c=Re(e,"showAssistantThinking",3,!1),g=Re(e,"pendingUserMessages",19,()=>[]),h=Re(e,"optimisticUserImageAttachments",19,()=>[]),v=Re(e,"onRestartSeedChange",3,void 0),m="qraftbox:session-transcript-view-mode",w="qraftbox:session-transcript-show-system-prompts";function b(ie){const ke=lr.parse(ie,{async:!1,breaks:!0,gfm:!0}),De=typeof ke=="string"?ke:"";return wy.sanitize(De,{USE_PROFILES:{html:!0}})}const f=400,u=new Map;function l(ie){if(ie.length===0)return"";const ke=u.get(ie);if(ke!==void 0)return ke;const De=b(ie);if(u.set(ie,De),u.size>f){const J=u.keys().next().value;typeof J=="string"&&u.delete(J)}return De}function p(){try{const ie=localStorage.getItem(m);if(ie==="chat"||ie==="carousel")return ie}catch{}return"chat"}function y(){try{return localStorage.getItem(w)==="true"}catch{return!1}}let k=q(xt({status:"idle"})),C=q(xt(p())),A=q(xt(y())),S=q(0),T=q(xt(new Set)),D=q(null),H=q(null),W=q(null),M=q(void 0),G=q("queued"),X=q(xt([])),le=q(void 0),me=q(null);async function xe(ie,ke){try{await navigator.clipboard.writeText(ie),x(H,ke,!0),setTimeout(()=>{x(H,null)},1500)}catch{}}const R=ye(()=>i(k).status==="success"?i(k).data.filter(ie=>{if(ie.type!=="user"&&ie.type!=="assistant")return!1;const ke=_e(ie).trim(),De=He(ie).length>0;return!(ke.length===0&&!De||!i(A)&&ie.type==="user"&&Hc(Me(ie)))}):[]),j=ye(()=>{if(i(k).status!=="success"||i(A))return 0;let ie=0;for(const ke of i(k).data)ke.type==="user"&&Hc(Me(ke))&&(ie+=1);return ie}),N=ye(()=>{if(i(R).length!==2)return{canRestartFromFirstPrompt:!1,firstUserPrompt:""};const ie=i(R)[0],ke=i(R)[1];if((ie==null?void 0:ie.type)!=="user"||(ke==null?void 0:ke.type)!=="assistant")return{canRestartFromFirstPrompt:!1,firstUserPrompt:""};const De=_e(ie).trim();return De.length===0?{canRestartFromFirstPrompt:!1,firstUserPrompt:""}:{canRestartFromFirstPrompt:!0,firstUserPrompt:De}}),V=ye(()=>r()!==void 0&&i(R).length>r()?i(R).slice(-r()):i(R)),$=ye(()=>r()!==void 0);gt(()=>{try{localStorage.setItem(w,i(A)?"true":"false")}catch{}}),gt(()=>{v()!==void 0&&v()(i(N))});function ee(ie){return Un(ie).replace(/\s+/g," ").trim()}const ce=ye(()=>ee(i(M)??"")),ue=ye(()=>ee(a()??"")),B=ye(()=>{const ie=new Set;for(const ke of i(V)){const De=ee(_e(ke));De.length>0&&ie.add(De)}return ie});function I(ie){return ie.filter(ke=>typeof ke.dataUrl=="string"&&ke.dataUrl.startsWith("data:image/"))}const z=ye(()=>i(X)),O=ye(()=>{const ie=[],ke=new Set;for(const De of g()){const J=Un(De.message).trim(),Z=ee(J);Z.length!==0&&(i(B).has(Z)||ke.has(Z)||(ke.add(Z),ie.push({raw:J,normalized:Z,status:De.status})))}return ie}),ne=ye(()=>{const ie=new Set;for(const ke of i(O))ie.add(ke.normalized);return ie});function ae(ie){return i(ce).length>0&&ie.normalized===i(ce)?i(z):[]}const te=ye(()=>i(ce).length>0&&!i(B).has(i(ce))&&!i(ne).has(i(ce))),ge=ye(()=>i(ue).length>0&&!i(B).has(i(ue))),we=ye(()=>{if(i(V).length===0)return;const ie=i(V)[i(V).length-1];return ie==null?void 0:ie.type}),Ie=ye(()=>c()&&!i(ge)&&(i(te)||i(O).some(ie=>ie.status==="running")||i(V).length>0&&i(we)!=="assistant")),Pe=ye(()=>(i(te)?1:0)+(i(ge)?1:0)+(i(Ie)?1:0)),Se=ye(()=>(i(M)??"").length>0||(a()??"").length>0||i(O).length>0||i(Ie));gt(()=>{i(me)!==e.sessionId&&(x(me,e.sessionId,!0),x(M,void 0),x(G,"queued"),x(X,[],!0),x(le,void 0))}),gt(()=>{typeof _()=="string"&&ee(_()).length>0&&(x(M,_()),x(G,o()),x(X,I(h()),!0),x(le,ee(_()),!0))}),gt(()=>{i(M)===void 0||ee(i(M)).length===0||i(B).has(i(ce))&&(x(M,void 0),x(G,"queued"))});function Be(ie){const ke=He(ie);return ke.length>0?ke:ie.type!=="user"||i(X).length===0||i(le)===void 0?[]:ee(_e(ie))===i(le)?i(X):[]}const Ue=ye(()=>{const ie=[];for(const[ke,De]of i(V).entries()){const J=Ze(De,ke),Z=_e(De);ie.push({event:De,index:ke,eventId:J,textContent:Z,renderedHtml:l(Z),imageAttachments:Be(De),isLong:Le(Z),isExpanded:i(T).has(J)})}return ie}),je=ye(()=>l(Un(i(M)??""))),ze=ye(()=>l(Un(a()??"")));async function Ne(ie){const ke=(ie==null?void 0:ie.silent)===!0,De=(ie==null?void 0:ie.contextId)??e.contextId,J=(ie==null?void 0:ie.sessionId)??e.sessionId;ke||x(k,{status:"loading"},!0);try{const Z=await fetch(`/api/ctx/${De}/claude-sessions/sessions/${J}/transcript?limit=1000`);if(!Z.ok){const Q=(await Z.json()).error??"Failed to fetch transcript";if(Q.startsWith("Session not found:")&&J.startsWith("qs_")){x(k,{status:"success",data:[],total:0},!0);return}if(ke&&i(k).status==="success"||ke&&i(k).status==="error")return;x(k,{status:"error",error:Q},!0);return}const re=await Z.json();x(k,{status:"success",data:re.events,total:re.total},!0)}catch(Z){if(ke&&(i(k).status==="success"||i(k).status==="error"))return;x(k,{status:"error",error:Z instanceof Error?Z.message:"Unknown error occurred"},!0)}}gt(()=>{try{localStorage.setItem(m,i(C))}catch{}}),gt(()=>{const ie=e.contextId,ke=e.sessionId;Ne({contextId:ie,sessionId:ke})}),gt(()=>{const ie=e.contextId,ke=e.sessionId;if(n()<=0)return;const De=setInterval(()=>{Ne({silent:!0,contextId:ie,sessionId:ke})},n());return()=>clearInterval(De)}),gt(()=>{i(C)==="carousel"&&i(V).length>0&&x(S,i(V).length-1)}),gt(()=>{if(i(C)==="chat"&&i(k).status==="success"&&i(D)!==null){const ie=i(Pe),ke=i(V).length-1,De=i(W)!==e.sessionId;if(!(s()||De))return;if(x(W,e.sessionId,!0),ie>0){requestAnimationFrame(()=>{vt("auto",!1)});return}if(i(V).length===0)return;tt(ke,"auto",!1)}}),gt(()=>{d()===0||i(C)!=="chat"||i(D)===null||requestAnimationFrame(()=>{vt("auto",!1)})});function _e(ie){return Un(Me(ie))}function Me(ie){const ke=ie.raw;if(ie.type==="user"||ie.type==="assistant"){const De=pe(ke);if(typeof De=="string")return De;if(Array.isArray(De))return oe(De)}if(ie.type==="tool_use"){const De=typeof ke.name=="string"?ke.name:"unknown",J=ke.input;return`Tool: ${De}
322
+ ${J!==void 0?JSON.stringify(J,null,2):""}`}if(ie.type==="tool_result"){const De=ke.content;if(typeof De=="string")return De;if(De!==void 0)return JSON.stringify(De,null,2)}if(ie.type==="summary"){const De=ke.summary;if(typeof De=="string")return De}return ie.content!==void 0&&ie.content!==null?typeof ie.content=="string"?ie.content:JSON.stringify(ie.content,null,2):""}function oe(ie){const ke=[];for(const De of ie)if(typeof De=="string")ke.push(De);else if(typeof De=="object"&&De!==null&&"type"in De){const J=De;if((J.type==="text"||J.type==="input_text"||J.type==="output_text")&&typeof J.text=="string"){const Z=J.text.trim();if(Z.startsWith("<image")||Z==="</image>")continue;ke.push(J.text)}else if(J.type==="tool_use"){const Z=typeof J.name=="string"?J.name:"unknown";ke.push(`[Tool: ${Z}]`)}else if(J.type==="tool_result"){const Z=J.content;typeof Z=="string"&&ke.push(Z)}}return ke.join(`
323
+
324
+ `)}function pe(ie){const ke=ie.message;if(typeof ke=="object"&&ke!==null){const J=ke.content;if(J!==void 0)return J}const De=ie.payload;if(typeof De=="object"&&De!==null){const J=De.content;if(J!==void 0)return J}}function Ce(ie){const ke=ie.image_url;if(typeof ke=="string"&&ke.length>0)return ke;if(typeof ke=="object"&&ke!==null){const J=ke.url;if(typeof J=="string"&&J.length>0)return J}const De=ie.source;if(typeof De=="object"&&De!==null){const J=De,Z=typeof J.data=="string"?J.data:void 0,re=typeof J.media_type=="string"?J.media_type:typeof J.mime_type=="string"?J.mime_type:void 0;if(Z!==void 0&&re!==void 0)return`data:${re};base64,${Z}`}return null}function He(ie){if(ie.type!=="user"&&ie.type!=="assistant")return[];const ke=ie.raw,De=pe(ke);if(!Array.isArray(De))return[];const J=[];function Z(re){const F=Ce(re);if(F===null||!F.startsWith("data:image/")&&!F.startsWith("http"))return;const Q=typeof re.file_name=="string"?re.file_name:"image",ve=F.startsWith("data:image/")?F.slice(5,F.indexOf(";")):"image/*";J.push({fileName:Q,mimeType:ve,dataUrl:F})}for(const re of De){if(typeof re!="object"||re===null)continue;const F=re;if(Z(F),F.type!=="tool_result")continue;const Q=F.content;if(Array.isArray(Q))for(const ve of Q)typeof ve!="object"||ve===null||Z(ve)}return J}function $e(ie){switch(ie){case"user":return"border-accent-emphasis";case"assistant":return"border-success-emphasis";default:return"border-border-muted"}}function nt(ie){return ie==="user"?"justify-end":"justify-start"}function Fe(ie){return ie==="user"?"border-r-4 border-l-0 rounded-l":"border-l-4 border-r-0 rounded-r"}function qe(ie){switch(ie){case"user":return"bg-accent-muted text-accent-fg";case"assistant":return"bg-success-muted text-success-fg";default:return"bg-bg-tertiary text-text-tertiary"}}function at(ie){if(ie===void 0)return"";try{return new Date(ie).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return ie}}function Ze(ie,ke){return ie.uuid??`${ie.type}-${ke}`}function Le(ie){return ie.length>500||ie.split(`
325
+ `).length>15}function Ae(ie){const ke=new Set(i(T));ke.has(ie)?ke.delete(ie):ke.add(ie),x(T,ke,!0)}function it(ie){return i(D)===null?null:i(D).querySelector(`[data-chat-index="${ie}"]`)}function tt(ie,ke,De=!0){if(i(V).length===0)return;const J=Math.max(0,Math.min(ie,i(V).length-1));x(S,J,!0);const Z=it(J);if(Z!==null){Z.scrollIntoView({block:"nearest",behavior:ke}),De&&Z.focus({preventScroll:!0});return}requestAnimationFrame(()=>{const re=it(J);re!==null&&(re.scrollIntoView({block:"nearest",behavior:ke}),De&&re.focus({preventScroll:!0}))})}function vt(ie,ke=!0){if(i(D)===null)return;const De=i(D).querySelectorAll("[data-chat-tail-anchor='true']");if(De.length===0)return;const J=De[De.length-1];J!==void 0&&(J.scrollIntoView({block:"nearest",behavior:ie}),ke&&J.focus({preventScroll:!0}))}function ft(){i(C)==="chat"?tt(i(S)-1,"auto"):i(S)>0&&x(S,i(S)-1)}function ht(){i(C)==="chat"?tt(i(S)+1,"auto"):i(S)<i(V).length-1&&x(S,i(S)+1)}function pt(ie){x(S,ie,!0)}function bt(){i(C)==="carousel"?x(S,0):i(D)!==null&&tt(0,"auto")}function Tt(){i(C)==="carousel"?x(S,i(V).length-1):i(D)!==null&&tt(i(V).length-1,"auto")}let et=q(null),Ct=q(!1);const kt=50;function Mt(ie){const ke=ie.touches[0];ke!==void 0&&x(et,ke.clientX,!0)}function Pt(ie){if(i(et)===null)return;const ke=ie.changedTouches[0];if(ke===void 0)return;const De=i(et)-ke.clientX;De>kt?ht():De<-kt&&ft(),x(et,null)}function Rt(ie){ie.pointerType!=="touch"&&(x(et,ie.clientX,!0),x(Ct,!0))}function It(ie){i(Ct)&&ie.preventDefault()}function Ht(ie){if(!i(Ct)||i(et)===null)return;const ke=i(et)-ie.clientX;ke>kt?ht():ke<-kt&&ft(),x(et,null),x(Ct,!1)}function Et(ie){i(C)==="carousel"&&(ie.key==="ArrowLeft"?(ie.preventDefault(),ft()):ie.key==="ArrowRight"?(ie.preventDefault(),ht()):ie.key==="Home"?(ie.preventDefault(),bt()):ie.key==="End"&&(ie.preventDefault(),Tt()))}var fe=jx();Sr("keydown",hn,Et);var be=E(fe);{var We=ie=>{var ke=fx(),De=E(ke),J=E(De);J.__click=()=>x(C,"chat");var Z=P(J,2);Z.__click=()=>x(C,"carousel");var re=P(De,2);re.__click=()=>{x(A,!i(A))};var F=E(re),Q=P(re,2);{var ve=Te=>{var rt=hx(),ct=E(rt);ct.__click=ft;var wt=P(ct,2);wt.__click=ht;var he=P(wt,2);he.__click=bt;var dt=P(he,2);dt.__click=Tt,de(()=>{ct.disabled=i(S)===0,wt.disabled=i(S)>=i(V).length-1,he.disabled=i(S)===0,dt.disabled=i(S)>=i(V).length-1}),L(Te,rt)};Y(Q,Te=>{i(V).length>0&&Te(ve)})}de(()=>{Ve(J,1,`px-3 py-1 text-xs font-medium rounded transition-all ${i(C)==="chat"?"bg-bg-primary text-text-primary shadow-sm":"text-text-secondary hover:text-text-primary"}`),Ge(J,"aria-pressed",i(C)==="chat"),Ve(Z,1,`px-3 py-1 text-xs font-medium rounded transition-all ${i(C)==="carousel"?"bg-bg-primary text-text-primary shadow-sm":"text-text-secondary hover:text-text-primary"}`),Ge(Z,"aria-pressed",i(C)==="carousel"),Ve(re,1,`px-2 py-1 text-xs font-medium rounded border transition-colors
326
+ ${i(A)?"border-accent-emphasis/50 bg-accent-muted text-accent-fg":"border-border-default text-text-secondary hover:text-text-primary hover:bg-bg-hover"}`),Ge(re,"aria-pressed",i(A)),Ge(re,"title",i(A)?"Hide injected system prompts":"Show injected system prompts"),se(F,i(A)?"System Prompts: Shown":`System Prompts: Hidden${i(j)>0?` (${i(j)})`:""}`)}),L(ie,ke)};Y(be,ie=>{i($)||ie(We)})}var Je=P(be,2);{var ut=ie=>{var ke=px();L(ie,ke)},Xe=ie=>{var ke=_t(),De=Ye(ke);{var J=re=>{var F=_x(),Q=E(F),ve=P(E(Q),2),Te=E(ve);de(()=>se(Te,i(k).error)),L(re,F)},Z=re=>{var F=_t(),Q=Ye(F);{var ve=Te=>{var rt=_t(),ct=Ye(rt);{var wt=dt=>{var At=vx();L(dt,At)},he=dt=>{var At=_t(),yt=Ye(At);{var st=Lt=>{var rr=Rx(),gr=E(rr);Gt(gr,17,()=>i(Ue),Jt=>Jt.eventId,(Jt,Yt)=>{const sr=ye(()=>i(Yt).event),ar=ye(()=>i(Yt).index),Vt=ye(()=>i(Yt).eventId),Bt=ye(()=>i(Yt).textContent),Zt=ye(()=>i(Yt).imageAttachments),br=ye(()=>i(Yt).isLong),kr=ye(()=>i(Yt).isExpanded);var or=wx(),fr=E(or),yr=E(fr),wr=E(yr),Fr=E(wr),zt=P(wr,2),$t=E(zt),Ke=E($t),lt=P($t,2);lt.__click=dr=>{dr.stopPropagation(),xe(i(Bt),i(Vt))};var St=E(lt);{var ir=dr=>{var Mr=gx();L(dr,Mr)},nr=dr=>{var Mr=mx();L(dr,Mr)};Y(St,dr=>{i(H)===i(Vt)?dr(ir):dr(nr,!1)})}var mr=P(yr,2),Tr=E(mr),Ur=E(Tr);Gi(Ur,()=>i(Yt).renderedHtml);var Gr=P(Tr,2);{var cr=dr=>{var Mr=yx();Gt(Mr,21,()=>i(Zt),ui,(rn,Xs)=>{var cs=bx();de(()=>{Ge(cs,"src",i(Xs).dataUrl),Ge(cs,"alt",i(Xs).fileName)}),L(rn,cs)}),L(dr,Mr)};Y(Gr,dr=>{i(Zt).length>0&&dr(cr)})}var Kr=P(Gr,2);{var pi=dr=>{var Mr=xx();Mr.__click=()=>Ae(i(Vt));var rn=E(Mr);de(()=>se(rn,i(kr)?"Show less":"Show more")),L(dr,Mr)};Y(Kr,dr=>{i(br)&&dr(pi)})}de((dr,Mr,rn,Xs,cs)=>{Ve(or,1,`flex w-full ${dr??""}`,"svelte-el6yfs"),Ge(or,"data-chat-index",i(ar)),Ge(or,"tabindex",i(S)===i(ar)?0:-1),Ve(fr,1,`w-fit max-w-[92%] md:max-w-[85%] ${Mr??""} ${rn??""} bg-bg-secondary
327
+ ${i(S)===i(ar)?"ring-1 ring-accent-emphasis/55":""}`,"svelte-el6yfs"),Ve(wr,1,`text-xs font-semibold px-2 py-0.5 rounded ${Xs??""}`,"svelte-el6yfs"),se(Fr,i(sr).type),se(Ke,cs),Ve(Tr,1,`transcript-markdown text-sm leading-6 break-words text-text-primary ${i(br)&&!i(kr)?"transcript-markdown-collapsed":""}`,"svelte-el6yfs")},[()=>nt(i(sr).type),()=>Fe(i(sr).type),()=>$e(i(sr).type),()=>qe(i(sr).type),()=>at(i(sr).timestamp)]),L(Jt,or)});var ur=P(gr,2);Gt(ur,17,()=>i(O),ui,(Jt,Yt)=>{const sr=ye(()=>ae(i(Yt)));var ar=kx(),Vt=E(ar),Bt=E(Vt),Zt=E(Bt),br=E(Zt),kr=P(Bt,2),or=E(kr),fr=E(or);Gi(fr,()=>l(i(Yt).raw));var yr=P(or,2);{var wr=Fr=>{var zt=Cx();Gt(zt,21,()=>i(sr),ui,($t,Ke)=>{var lt=Sx();de(()=>{Ge(lt,"src",i(Ke).dataUrl),Ge(lt,"alt",i(Ke).fileName)}),L($t,lt)}),L(Fr,zt)};Y(yr,Fr=>{i(sr).length>0&&Fr(wr)})}de(()=>{Ve(Vt,1,`w-fit max-w-[92%] md:max-w-[85%] border-r-4 border-l-0 rounded-l
328
+ ${i(Yt).status==="running"?"border-accent-emphasis":"border-attention-emphasis"} bg-bg-secondary`),Ve(Zt,1,`text-xs font-semibold px-2 py-0.5 rounded ${i(Yt).status==="running"?"bg-accent-muted text-accent-fg":"bg-attention-muted text-attention-fg"}`),se(br,`user (${i(Yt).status??""})`)}),L(Jt,ar)});var Ot=P(ur,2);{var Ft=Jt=>{var Yt=Tx(),sr=E(Yt),ar=E(sr),Vt=E(ar),Bt=E(Vt),Zt=P(ar,2),br=E(Zt),kr=E(br);Gi(kr,()=>i(je));var or=P(br,2);{var fr=yr=>{var wr=Ax();Gt(wr,21,()=>i(z),ui,(Fr,zt)=>{var $t=Ex();de(()=>{Ge($t,"src",i(zt).dataUrl),Ge($t,"alt",i(zt).fileName)}),L(Fr,$t)}),L(yr,wr)};Y(or,yr=>{i(z).length>0&&yr(fr)})}de(()=>{Ve(sr,1,`w-fit max-w-[92%] md:max-w-[85%] border-r-4 border-l-0 rounded-l
329
+ ${i(G)==="running"?"border-accent-emphasis":"border-attention-emphasis"} bg-bg-secondary`),Ve(Vt,1,`text-xs font-semibold px-2 py-0.5 rounded ${i(G)==="running"?"bg-accent-muted text-accent-fg":"bg-attention-muted text-attention-fg"}`),se(Bt,`user (${i(G)??""})`)}),L(Jt,Yt)};Y(Ot,Jt=>{i(te)&&Jt(Ft)})}var hr=P(Ot,2);{var qr=Jt=>{var Yt=Px(),sr=E(Yt),ar=P(E(sr),2),Vt=E(ar),Bt=E(Vt);Gi(Bt,()=>i(ze)),L(Jt,Yt)};Y(hr,Jt=>{i(ge)&&Jt(qr)})}var xr=P(hr,2);{var Dr=Jt=>{var Yt=Lx();L(Jt,Yt)};Y(xr,Jt=>{i(Ie)&&Jt(Dr)})}Nr(rr,Jt=>x(D,Jt),()=>i(D)),de(()=>Ve(rr,1,`${i($)?"max-h-[120px]":"max-h-[600px]"} chat-scroll overflow-y-auto space-y-2`,"svelte-el6yfs")),L(Lt,rr)},ot=Lt=>{var rr=_t(),gr=Ye(rr);{var ur=Ot=>{var Ft=Nx(),hr=E(Ft);hr.__click=ft;var qr=P(hr,2);qr.__click=ht;var xr=P(qr,2);xr.__touchstart=Mt,xr.__touchend=Pt,xr.__pointerdown=Rt,xr.__pointermove=It,xr.__pointerup=Ht;var Dr=E(xr);Gt(Dr,21,()=>i(Ue),sr=>sr.eventId,(sr,ar)=>{const Vt=ye(()=>i(ar).event),Bt=ye(()=>i(ar).index),Zt=ye(()=>i(ar).textContent),br=ye(()=>i(ar).imageAttachments),kr=ye(()=>i(Bt)===i(S));var or=Bx();or.__click=()=>pt(i(Bt));var fr=E(or),yr=E(fr),wr=E(yr),Fr=E(wr),zt=P(wr,2),$t=E(zt),Ke=E($t),lt=P($t,2);lt.__click=cr=>{cr.stopPropagation(),xe(i(Zt),Ze(i(Vt),i(Bt)))},lt.__keydown=cr=>{(cr.key==="Enter"||cr.key===" ")&&(cr.preventDefault(),cr.stopPropagation(),xe(i(Zt),Ze(i(Vt),i(Bt))))};var St=E(lt);{var ir=cr=>{var Kr=Ix();L(cr,Kr)},nr=cr=>{var Kr=Dx();L(cr,Kr)};Y(St,cr=>{i(H)===Ze(i(Vt),i(Bt))?cr(ir):cr(nr,!1)})}var mr=P(yr,2),Tr=E(mr);Gi(Tr,()=>i(ar).renderedHtml);var Ur=P(mr,2);{var Gr=cr=>{var Kr=Ox();Gt(Kr,21,()=>i(br),ui,(pi,dr)=>{var Mr=Mx();de(()=>{Ge(Mr,"src",i(dr).dataUrl),Ge(Mr,"alt",i(dr).fileName)}),L(pi,Mr)}),L(cr,Kr)};Y(Ur,cr=>{i(br).length>0&&cr(Gr)})}de((cr,Kr)=>{Ve(or,1,`w-[45%] shrink-0 text-left transition-all duration-150
330
+ ${i(kr)?"opacity-100 scale-100":"opacity-40 scale-95"}`),Ge(or,"aria-label",`Message ${i(Bt)+1}: ${i(Vt).type??""}`),Ve(fr,1,`rounded-lg border bg-bg-secondary p-4 shadow-sm h-full
331
+ ${i(kr)?"border-accent-emphasis/40":"border-border-default"}`),Ve(wr,1,`text-xs font-semibold px-2 py-0.5 rounded ${cr??""}`,"svelte-el6yfs"),se(Fr,i(Vt).type),se(Ke,Kr)},[()=>qe(i(Vt).type),()=>at(i(Vt).timestamp)]),L(sr,or)});var Jt=P(xr,2),Yt=E(Jt);de(()=>{hr.disabled=i(S)===0,qr.disabled=i(S)===i(V).length-1,hi(Dr,`transform: translateX(calc(27.5% - ${i(S)*45}% - ${i(S)*12}px))`),se(Yt,`${i(S)+1} / ${i(V).length??""}`)}),Sr("pointerleave",xr,Ht),L(Ot,Ft)};Y(gr,Ot=>{i(C)==="carousel"&&Ot(ur)},!0)}L(Lt,rr)};Y(yt,Lt=>{i(C)==="chat"||i(V).length===0&&i(Se)?Lt(st):Lt(ot,!1)},!0)}L(dt,At)};Y(ct,dt=>{i(V).length===0&&!i(Se)?dt(wt):dt(he,!1)})}L(Te,rt)};Y(Q,Te=>{(i(k).status==="success"||i(Se))&&Te(ve)},!0)}L(re,F)};Y(De,re=>{i(k).status==="error"&&!i(Se)?re(J):re(Z,!1)},!0)}L(ie,ke)};Y(Je,ie=>{i(k).status==="loading"&&!i(Se)?ie(ut):ie(Xe,!1)})}de(()=>Ve(fe,1,`session-transcript-inline ${i($)?"px-4 py-1.5":"px-4 py-3"}`)),L(t,fe),Xt()}tr(["click","touchstart","touchend","pointerdown","pointermove","pointerup","keydown"]);var Fx=U('<span class="text-xs text-text-tertiary"> </span>'),Ux=U('<p class="mt-1 rounded border border-danger-emphasis/40 bg-danger-emphasis/10 px-2 py-1 text-xs text-danger-fg"> </p>'),Vx=Cr('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-success-fg" aria-hidden="true"><polyline points="20 6 9 17 4 12"></polyline></svg>'),zx=Cr('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>'),Wx=Cr('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-success-fg" aria-hidden="true"><polyline points="20 6 9 17 4 12"></polyline></svg>'),qx=Cr('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>'),Gx=U('<button type="button" class="px-2 py-1 rounded border border-border-default text-xs text-text-secondary hover:text-text-primary hover:bg-bg-hover disabled:opacity-60 disabled:cursor-not-allowed" aria-label="Refresh purpose" title="Run default refresh-purpose prompt"> </button> <button type="button" class="px-2 py-1 rounded border border-border-default text-xs text-text-secondary hover:text-text-primary hover:bg-bg-hover disabled:opacity-60 disabled:cursor-not-allowed" aria-label="Resume session" title="Run default resume-session prompt"> </button>',1),Kx=U('<button type="button" class="px-2 py-1 rounded border border-danger-emphasis/40 text-xs text-danger-fg hover:bg-danger-emphasis/10 disabled:opacity-60 disabled:cursor-not-allowed" aria-label="Cancel current prompt" title="Cancel prompt execution"> </button>'),Xx=U('<div class="h-full flex items-center justify-center text-sm text-text-tertiary">New session ready. Submit the first prompt to start.</div>'),Jx=U('<div class="h-full flex items-center justify-center text-sm text-text-tertiary">Context is unavailable.</div>'),Yx=U("<option>No profile available</option>"),Qx=U("<option> </option>"),Zx=U('<div class="mb-3 space-y-1"><label for="new-session-profile-select" class="block text-[11px] font-semibold uppercase tracking-wide text-text-secondary">Profile (new session)</label> <select id="new-session-profile-select" class="w-full rounded border border-border-default bg-bg-primary px-2 py-2 text-xs text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-emphasis"><!></select></div>'),$x=U('<div class="mb-3 space-y-1"><p class="text-[11px] font-semibold uppercase tracking-wide text-text-secondary">Profile (session)</p> <p class="text-[11px] text-text-tertiary"> </p></div>'),ew=U('<div class="flex items-center gap-2 rounded border border-border-default bg-bg-primary p-2"><img class="h-14 w-14 rounded object-cover border border-border-default/70"/> <div class="min-w-0 flex-1"><p class="truncate text-xs text-text-primary"> </p> <p class="text-[11px] text-text-tertiary"> </p></div> <button type="button" class="rounded border border-border-default px-2 py-1 text-[11px] text-text-secondary hover:bg-bg-hover">Remove</button></div>'),tw=U('<div class="mt-2 space-y-2"></div>'),rw=U('<p class="mt-2 text-xs text-danger-fg"> </p>'),iw=U('<p class="mt-2 text-xs text-danger-fg"> </p>'),nw=U('<p class="mt-2 text-xs text-danger-fg"> </p>'),sw=U(`<div class="mt-2 rounded border border-border-default bg-bg-primary p-2"><button type="button" class="w-full text-left px-2 py-1.5 text-xs rounded hover:bg-bg-hover
332
+ text-text-secondary disabled:opacity-60" title="Priority: run immediately and bypass normal queue order"> </button> <button type="button" class="mt-1 w-full text-left px-2 py-1.5 text-xs rounded hover:bg-bg-hover
333
+ text-text-secondary disabled:opacity-60" title="Start a brand-new session and navigate to it"> </button></div>`),ow=U('<p class="mt-1 text-[11px] text-text-tertiary font-mono"> </p>'),aw=U(`<div class="fixed inset-0 z-[130] bg-black/45 backdrop-blur-[1px]" role="presentation"><div class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2
334
+ w-[min(1200px,94vw)] h-[min(92vh,860px)]
335
+ border border-border-default bg-bg-primary rounded-xl shadow-2xl
336
+ overflow-hidden flex flex-col" role="dialog" aria-modal="true" aria-label="Session progress"><div class="shrink-0 px-4 py-3 border-b border-border-default bg-bg-secondary
337
+ flex items-start justify-between gap-4"><div class="min-w-0 flex-1"><div class="flex items-center gap-2 mb-1"><span> </span> <span> </span> <span class="inline-flex items-center px-2 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide bg-bg-tertiary text-text-secondary"> </span> <!></div> <h2 class="text-sm font-semibold text-text-primary truncate"> </h2> <p class="text-xs text-text-secondary mt-1 truncate"> </p> <p class="text-xs text-text-tertiary mt-0.5 truncate"> </p> <!> <div class="mt-1 flex flex-wrap items-start gap-x-4 gap-y-1"><div class="flex min-w-[320px] flex-1 items-center gap-1.5"><span class="shrink-0 text-[10px] uppercase tracking-wide text-text-tertiary">Qraft Session ID</span> <span class="min-w-0 truncate text-[11px] text-text-secondary font-mono"> </span> <button type="button" class="shrink-0 p-0.5 rounded text-text-tertiary hover:text-text-primary hover:bg-bg-hover
338
+ focus:outline-none focus:ring-1 focus:ring-accent-emphasis
339
+ disabled:opacity-60 disabled:cursor-not-allowed" aria-label="Copy Qraft session ID" title="Copy Qraft session ID"><!></button></div> <div class="flex min-w-[320px] flex-1 items-center gap-1.5"><span class="shrink-0 text-[10px] uppercase tracking-wide text-text-tertiary"> </span> <span class="min-w-0 truncate text-[11px] text-text-secondary font-mono"> </span> <button type="button" class="shrink-0 p-0.5 rounded text-text-tertiary hover:text-text-primary hover:bg-bg-hover
340
+ focus:outline-none focus:ring-1 focus:ring-accent-emphasis
341
+ disabled:opacity-60 disabled:cursor-not-allowed"><!></button></div></div></div> <div class="shrink-0 flex items-center gap-2"><!> <!> <button type="button" class="px-2 py-1 rounded border border-border-default text-xs text-text-secondary hover:text-text-primary hover:bg-bg-hover"> </button> <button type="button" class="w-7 h-7 rounded hover:bg-bg-hover text-text-tertiary hover:text-text-primary" aria-label="Close">✕</button></div></div> <div class="min-h-0 flex-1 grid grid-cols-1 lg:grid-cols-[1fr_340px]"><div class="min-h-0 overflow-hidden border-r border-border-default/70"><!></div> <div class="min-h-0 overflow-y-auto p-4 bg-bg-secondary/40"><!> <h3 class="text-xs font-semibold text-text-secondary uppercase tracking-wide mb-2">Next Prompt</h3> <textarea class="w-full h-40 resize-y min-h-28 rounded border border-border-default bg-bg-primary
342
+ px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-emphasis" placeholder="Add the next instruction for this session"></textarea> <input type="file" accept="image/*" multiple class="hidden"/> <div class="mt-2 flex items-center justify-between gap-2"><button type="button" class="inline-flex h-8 w-8 items-center justify-center rounded border border-border-default text-text-secondary hover:text-text-primary hover:bg-bg-hover" aria-label="Attach images" title="Attach images"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21.44 11.05l-8.49 8.49a6 6 0 01-8.49-8.49l8.49-8.49a4 4 0 015.66 5.66l-8.49 8.49a2 2 0 01-2.83-2.83l7.78-7.78"></path></svg></button> <p class="text-[11px] text-text-tertiary">Images only (PDF later).</p></div> <!> <!> <!> <!> <div class="mt-3"><div class="flex items-center gap-1"><button type="button" class="px-3 py-1.5 text-xs rounded bg-accent-muted text-accent-fg
343
+ border border-accent-emphasis/40 hover:bg-accent-muted/80 disabled:opacity-60 font-medium"> </button> <button type="button" class="px-2 py-1.5 text-xs rounded border border-border-default bg-bg-primary
344
+ text-text-secondary hover:bg-bg-hover disabled:opacity-60" aria-label="Toggle submit options"> </button></div> <!></div> <p class="mt-2 text-[11px] text-text-tertiary"> </p> <!></div></div></div></div>`);function lw(t,e){Kt(e,!0);const r=Re(e,"failureMessage",3,void 0),n=Re(e,"optimisticAssistantMessage",3,void 0),s=Re(e,"showModelProfileSelector",3,!1),d=Re(e,"modelProfiles",19,()=>[]),_=Re(e,"selectedModelProfileId",3,void 0),o=Re(e,"activeModelLabel",3,void 0),a=ye(()=>{if(typeof e.sessionId!="string")return null;const oe=e.sessionId.trim();return oe.length===0||oe==="undefined"||oe==="null"?null:oe}),c=ye(()=>{if(typeof e.qraftSessionId!="string")return null;const oe=e.qraftSessionId.trim();return oe.length===0||oe==="undefined"||oe==="null"?null:oe}),g=ye(()=>{if(typeof e.cliSessionId!="string")return null;const oe=e.cliSessionId.trim();return oe.length===0||oe==="undefined"||oe==="null"?null:oe}),h=ye(()=>e.aiAgent==="codex"||e.source==="codex-cli"?"Codex Session ID":"Claude Session ID");let v=q(null),m=null;function w(){m!==null&&(clearTimeout(m),m=null)}function b(oe){x(v,oe,!0),w(),m=setTimeout(()=>{x(v,null),m=null},1200)}async function f(oe,pe){if(!(pe===null||pe.length===0))try{await navigator.clipboard.writeText(pe),b(oe);return}catch{const Ce=document.createElement("textarea");Ce.value=pe,Ce.setAttribute("readonly","true"),Ce.style.position="fixed",Ce.style.left="-9999px",document.body.appendChild(Ce),Ce.select(),document.execCommand("copy"),document.body.removeChild(Ce),b(oe)}}let u=q(""),l=q(null),p=q(!1),y=q(null),k=q(null),C=q(void 0),A=q("queued"),S=q(void 0),T=q(0),D=q(!1),H=q(!1),W=q(!1);const M=10*1024*1024,G=40;let X=q(null),le=q(xt([]));function me(oe){return oe.ctrlKey||oe.metaKey||oe.altKey?!1:oe.key.length===1}function xe(oe,pe){if(oe.length===0)return 0;const Ce=[...oe].sort(($e,nt)=>$e-nt),He=Math.max(0,Math.min(Ce.length-1,Math.floor((Ce.length-1)*pe)));return Ce[He]??0}function R(oe){if(!Number.isFinite(oe)||oe<0)return;const pe=Math.round(oe*10)/10,Ce=[...i(le),pe];x(le,Ce.length>G?Ce.slice(Ce.length-G):Ce,!0)}const j=ye(()=>{const oe=i(le);if(oe.length===0)return null;const pe=oe[oe.length-1]??0,Ce=oe.reduce((nt,Fe)=>nt+Fe,0)/oe.length,He=xe(oe,.95),$e=Math.max(...oe);return{last:pe,avg:Ce,p95:He,max:$e,count:oe.length}});let N=q(xt([])),V=q(xt([]));function $(oe){return oe.replace(/[\\/]/g,"_")}function ee(oe,pe,Ce){return`${oe}:${pe}:${Ce}`}function ce(){return i(N).map(oe=>({path:`upload/${$(oe.fileName)}`,fileName:oe.fileName,mimeType:oe.mimeType,encoding:"base64",content:oe.base64,attachmentKind:"image"}))}function ue(){return i(N).map(oe=>({fileName:oe.fileName,mimeType:oe.mimeType,dataUrl:`data:${oe.mimeType};base64,${oe.base64}`}))}function B(){for(const oe of i(N))URL.revokeObjectURL(oe.previewUrl);x(N,[],!0)}function I(oe){const pe=i(N).find(Ce=>Ce.id===oe);pe!==void 0&&URL.revokeObjectURL(pe.previewUrl),x(N,i(N).filter(Ce=>Ce.id!==oe),!0)}function z(oe){return oe<1024?`${oe} B`:oe<1024*1024?`${(oe/1024).toFixed(1)} KB`:`${(oe/(1024*1024)).toFixed(1)} MB`}function O(oe){return new Promise((pe,Ce)=>{const He=new FileReader;He.onload=()=>{if(typeof He.result=="string"){pe(He.result);return}Ce(new Error("Failed to read image file."))},He.onerror=()=>Ce(new Error("Failed to read image file.")),He.readAsDataURL(oe)})}async function ne(oe){const pe=oe.currentTarget,Ce=pe.files;if(Ce===null||Ce.length===0)return;x(k,null);const He=[],$e=new Set(i(N).map(Fe=>ee(Fe.fileName,Fe.sizeBytes,Fe.mimeType))),nt=[...i(N)];for(const Fe of Array.from(Ce)){if(!Fe.type.startsWith("image/")){He.push(`${Fe.name}: only image files are supported.`);continue}if(Fe.size>M){He.push(`${Fe.name}: exceeds ${z(M)} limit.`);continue}const qe=ee(Fe.name,Fe.size,Fe.type);if(!$e.has(qe))try{const Ze=(await O(Fe)).split(",",2)[1];if(Ze===void 0||Ze.length===0){He.push(`${Fe.name}: failed to encode image.`);continue}nt.push({id:`${Date.now()}_${Math.random().toString(36).slice(2,8)}`,fileName:Fe.name,mimeType:Fe.type,sizeBytes:Fe.size,base64:Ze,previewUrl:URL.createObjectURL(Fe)}),$e.add(qe)}catch{He.push(`${Fe.name}: failed to read image.`)}}x(N,nt,!0),x(k,He.length>0?He.join(" "):null,!0),pe.value=""}function ae(oe){return oe.replace(/\s+/g," ").trim()}async function te(oe){const pe=i(u).trim();if(!(pe.length===0||i(p))){x(p,!0),x(y,null),x(C,pe,!0),x(A,oe?"running":"queued",!0),x(V,ue(),!0),x(T,i(T)+1);try{await e.onSubmitPrompt(pe,oe,ce()),x(u,""),x(k,null),B()}catch(Ce){x(y,Ce instanceof Error?Ce.message:"Failed to submit prompt",!0),x(C,void 0),x(A,"queued"),x(V,[],!0)}finally{x(p,!1)}}}async function ge(oe){const pe=i(u).trim();if(!(pe.length===0||i(p)||restartingFromBeginning)){x(p,!0),x(y,null),x(C,pe,!0),x(A,"queued",!0),x(V,ue(),!0),x(T,i(T)+1);try{await e.onSubmitPromptAsNewSession(pe,oe,ce()),x(u,""),x(k,null),B()}catch(Ce){x(y,Ce instanceof Error?Ce.message:"Failed to submit prompt",!0),x(C,void 0),x(A,"queued"),x(V,[],!0)}finally{x(p,!1)}}}async function we(oe){if(!e.canRunSessionDefaultPrompts||i(p))return;const pe=Ce=>{x(oe==="refresh-purpose"?H:W,Ce,!0)};pe(!0),x(y,null);try{oe==="refresh-purpose"?await e.onRunRefreshPurposePrompt():await e.onRunResumeSessionPrompt(),x(T,i(T)+1)}catch(Ce){x(y,Ce instanceof Error?Ce.message:"Failed to run default prompt",!0)}finally{pe(!1)}}function Ie(oe){if(me(oe)&&x(X,performance.now(),!0),!(i(p)||i(u).trim().length===0)&&oe.key==="Enter"&&!oe.shiftKey){if(oe.preventDefault(),oe.ctrlKey||oe.metaKey){te(!0);return}oe.altKey||te(!1)}}function Pe(){const oe=i(X);x(X,null),oe!==null&&requestAnimationFrame(()=>{const pe=performance.now()-oe;R(pe)})}function Se(){return typeof navigator>"u"?"Enter submits queued. Shift+Enter adds a newline. Ctrl/Cmd+Enter runs immediately.":navigator.platform.toLowerCase().includes("mac")||navigator.userAgent.toLowerCase().includes("macintosh")?"Enter submits queued. Shift+Enter adds a newline. Cmd+Enter runs immediately.":"Enter submits queued. Shift+Enter adds a newline. Ctrl+Enter runs immediately."}const Be=ye(Se),Ue=ye(()=>e.status==="running"||e.source==="codex-cli"),je=ye(()=>i(A)==="running"||e.pendingPromptMessages.some(oe=>oe.status==="running")),ze=ye(()=>e.status==="running"||i(je));gt(()=>{const oe=i(C);if(oe===void 0)return;const pe=ae(oe),Ce=e.pendingPromptMessages.find(He=>ae(He.message)===pe);if(Ce!==void 0){x(A,Ce.status,!0);return}(e.status==="awaiting_input"||e.status==="failed")&&(x(C,void 0),x(A,"queued"),x(V,[],!0))}),gt(()=>{const oe=n();if(typeof oe=="string"&&oe.trim().length>0){x(S,oe,!0);return}e.open||x(S,void 0)}),gt(()=>{if(!e.open){x(C,void 0),x(A,"queued"),x(V,[],!0),x(S,void 0),x(D,!1),x(k,null),x(X,null),x(le,[],!0),B();return}const oe=pe=>{pe.key==="Escape"&&e.onClose()};return window.addEventListener("keydown",oe),()=>{window.removeEventListener("keydown",oe)}}),gt(()=>()=>{w(),x(V,[],!0),B()});var Ne=_t(),_e=Ye(Ne);{var Me=oe=>{var pe=aw();pe.__click=Ke=>{Ke.target===Ke.currentTarget&&e.onClose()};var Ce=E(pe),He=E(Ce),$e=E(He),nt=E($e),Fe=E(nt),qe=E(Fe),at=P(Fe,2),Ze=E(at),Le=P(at,2),Ae=E(Le),it=P(Le,2);{var tt=Ke=>{var lt=Fx(),St=E(lt);de(()=>se(St,`${e.queuedPromptCount??""} queued`)),L(Ke,lt)};Y(it,Ke=>{e.queuedPromptCount>0&&Ke(tt)})}var vt=P(nt,2),ft=E(vt),ht=P(vt,2),pt=E(ht),bt=P(ht,2),Tt=E(bt),et=P(bt,2);{var Ct=Ke=>{var lt=Ux(),St=E(lt);de(()=>se(St,`Failure: ${r()??""}`)),L(Ke,lt)};Y(et,Ke=>{e.status==="failed"&&r()!==void 0&&Ke(Ct)})}var kt=P(et,2),Mt=E(kt),Pt=P(E(Mt),2),Rt=E(Pt),It=P(Pt,2);It.__click=()=>f("qraft",i(c));var Ht=E(It);{var Et=Ke=>{var lt=Vx();L(Ke,lt)},fe=Ke=>{var lt=zx();L(Ke,lt)};Y(Ht,Ke=>{i(v)==="qraft"?Ke(Et):Ke(fe,!1)})}var be=P(Mt,2),We=E(be),Je=E(We),ut=P(We,2),Xe=E(ut),ie=P(ut,2);ie.__click=()=>f("cli",i(g));var ke=E(ie);{var De=Ke=>{var lt=Wx();L(Ke,lt)},J=Ke=>{var lt=qx();L(Ke,lt)};Y(ke,Ke=>{i(v)==="cli"?Ke(De):Ke(J,!1)})}var Z=P($e,2),re=E(Z);{var F=Ke=>{var lt=Gx(),St=Ye(lt);St.__click=()=>{we("refresh-purpose")};var ir=E(St),nr=P(St,2);nr.__click=()=>{we("resume-session")};var mr=E(nr);de(()=>{St.disabled=i(p)||i(H)||i(W),se(ir,i(H)?"Refreshing...":"Refresh Purpose"),nr.disabled=i(p)||i(W)||i(H),se(mr,i(W)?"Resuming...":"Resume Session")}),L(Ke,lt)};Y(re,Ke=>{e.canRunSessionDefaultPrompts&&Ke(F)})}var Q=P(re,2);{var ve=Ke=>{var lt=Kx();lt.__click=()=>{e.onCancelPrompt()};var St=E(lt);de(()=>{lt.disabled=e.cancelPromptInProgress,se(St,e.cancelPromptInProgress?"Cancelling...":"Cancel Prompt")}),L(Ke,lt)};Y(Q,Ke=>{e.canCancelPrompt&&Ke(ve)})}var Te=P(Q,2);Te.__click=()=>{e.onToggleHidden()};var rt=E(Te),ct=P(Te,2);ct.__click=function(...Ke){var lt;(lt=e.onClose)==null||lt.apply(this,Ke)};var wt=P(He,2),he=E(wt),dt=E(he);{var At=Ke=>{{let lt=ye(()=>i(Ue)||i(p)?1500:0);Hx(Ke,{get sessionId(){return i(a)},get contextId(){return e.contextId},get autoRefreshMs(){return i(lt)},get followLatest(){return i(Ue)},get focusTailNonce(){return i(T)},get showAssistantThinking(){return i(ze)},get optimisticUserMessage(){return i(C)},get optimisticUserStatus(){return i(A)},get optimisticUserImageAttachments(){return i(V)},get optimisticAssistantMessage(){return i(S)},get pendingUserMessages(){return e.pendingPromptMessages}})}},yt=Ke=>{var lt=_t(),St=Ye(lt);{var ir=mr=>{var Tr=Xx();L(mr,Tr)},nr=mr=>{var Tr=Jx();L(mr,Tr)};Y(St,mr=>{i(a)===null?mr(ir):mr(nr,!1)},!0)}L(Ke,lt)};Y(dt,Ke=>{e.contextId!==null&&i(a)!==null?Ke(At):Ke(yt,!1)})}var st=P(he,2),ot=E(st);{var Lt=Ke=>{var lt=Zx(),St=P(E(lt),2);St.__change=Ur=>{var cr;const Gr=Ur.currentTarget.value;(cr=e.onModelProfileChange)==null||cr.call(e,Gr.length>0?Gr:void 0)};var ir=E(St);{var nr=Ur=>{var Gr=Yx();Gr.value=Gr.__value="",L(Ur,Gr)},mr=Ur=>{var Gr=_t(),cr=Ye(Gr);Gt(cr,17,d,Kr=>Kr.id,(Kr,pi)=>{var dr=Qx(),Mr=E(dr),rn={};de(()=>{se(Mr,`${i(pi).name??""} (${i(pi).vendor??""} / ${i(pi).model??""})`),rn!==(rn=i(pi).id)&&(dr.value=(dr.__value=i(pi).id)??"")}),L(Kr,dr)}),L(Ur,Gr)};Y(ir,Ur=>{d().length===0?Ur(nr):Ur(mr,!1)})}var Tr;ru(St),de(()=>{St.disabled=d().length===0||i(p),Tr!==(Tr=_())&&(St.value=(St.__value=_())??"",pl(St,_()))}),L(Ke,lt)},rr=Ke=>{var lt=$x(),St=P(E(lt),2),ir=E(St);de(()=>se(ir,o()??"-")),L(Ke,lt)};Y(ot,Ke=>{s()?Ke(Lt):Ke(rr,!1)})}var gr=P(ot,4);gr.__keydown=Ie,gr.__input=Pe;var ur=P(gr,2);ur.__change=ne,Nr(ur,Ke=>x(l,Ke),()=>i(l));var Ot=P(ur,2),Ft=E(Ot);Ft.__click=()=>{var Ke;return(Ke=i(l))==null?void 0:Ke.click()};var hr=P(Ot,2);{var qr=Ke=>{var lt=tw();Gt(lt,21,()=>i(N),St=>St.id,(St,ir)=>{var nr=ew(),mr=E(nr),Tr=P(mr,2),Ur=E(Tr),Gr=E(Ur),cr=P(Ur,2),Kr=E(cr),pi=P(Tr,2);pi.__click=()=>I(i(ir).id),de(dr=>{Ge(mr,"src",i(ir).previewUrl),Ge(mr,"alt",i(ir).fileName),se(Gr,i(ir).fileName),se(Kr,`${i(ir).mimeType??""} - ${dr??""}`),pi.disabled=i(p)},[()=>z(i(ir).sizeBytes)]),L(St,nr)}),L(Ke,lt)};Y(hr,Ke=>{i(N).length>0&&Ke(qr)})}var xr=P(hr,2);{var Dr=Ke=>{var lt=rw(),St=E(lt);de(()=>se(St,i(y))),L(Ke,lt)};Y(xr,Ke=>{i(y)!==null&&Ke(Dr)})}var Jt=P(xr,2);{var Yt=Ke=>{var lt=iw(),St=E(lt);de(()=>se(St,i(k))),L(Ke,lt)};Y(Jt,Ke=>{i(k)!==null&&Ke(Yt)})}var sr=P(Jt,2);{var ar=Ke=>{var lt=nw(),St=E(lt);de(()=>se(St,e.cancelPromptError)),L(Ke,lt)};Y(sr,Ke=>{e.cancelPromptError!==null&&Ke(ar)})}var Vt=P(sr,2),Bt=E(Vt),Zt=E(Bt);Zt.__click=()=>void te(!1);var br=E(Zt),kr=P(Zt,2);kr.__click=()=>{x(D,!i(D))};var or=E(kr),fr=P(Bt,2);{var yr=Ke=>{var lt=sw(),St=E(lt);St.__click=()=>void te(!0);var ir=E(St),nr=P(St,2);nr.__click=()=>void ge(!1);var mr=E(nr);de((Tr,Ur)=>{St.disabled=Tr,se(ir,i(p)?"Submitting...":"Run immediately"),nr.disabled=Ur,se(mr,i(p)?"Submitting...":"Submit as new session")},[()=>i(p)||i(u).trim().length===0,()=>i(p)||i(u).trim().length===0]),L(Ke,lt)};Y(fr,Ke=>{i(D)&&Ke(yr)})}var wr=P(Vt,2),Fr=E(wr),zt=P(wr,2);{var $t=Ke=>{var lt=ow(),St=E(lt);de((ir,nr,mr,Tr)=>se(St,`Input latency (keydown->paint): last ${ir??""}ms / avg ${nr??""}ms / p95 ${mr??""}ms / max ${Tr??""}ms (${i(j).count??""})`),[()=>i(j).last.toFixed(1),()=>i(j).avg.toFixed(1),()=>i(j).p95.toFixed(1),()=>i(j).max.toFixed(1)]),L(Ke,lt)};Y(zt,Ke=>{i(j)!==null&&Ke($t)})}de((Ke,lt,St,ir)=>{Ve(Fe,1,Ke),se(qe,lt),Ve(at,1,`inline-flex items-center px-2 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide ${e.source==="qraftbox"?"bg-success-muted text-success-fg":e.source==="claude-cli"?"bg-accent-muted text-accent-fg":e.source==="codex-cli"?"bg-attention-emphasis/20 text-attention-fg":"bg-bg-tertiary text-text-secondary"}`),se(Ze,e.source),se(Ae,e.aiAgent),se(ft,e.title),se(pt,`Purpose: ${e.purpose??""}`),se(Tt,`Latest activity: ${e.latestResponse??""}`),se(Rt,i(c)??"-"),It.disabled=i(c)===null,se(Je,i(h)),se(Xe,i(g)??"-"),ie.disabled=i(g)===null,Ge(ie,"aria-label",`Copy ${i(h)}`),Ge(ie,"title",`Copy ${i(h)}`),Ge(Te,"aria-label",e.isHidden?"Show session in grid":"Hide session"),Ge(Te,"title",e.isHidden?"Show session":"Hide session"),se(rt,e.isHidden?"Show":"Hide"),Ft.disabled=i(p),Zt.disabled=St,se(br,i(p)?"Submitting...":"Submit"),kr.disabled=ir,Ge(kr,"aria-expanded",i(D)),se(or,i(D)?"▲":"▼"),se(Fr,`Queue by default. ${i(Be)??""}`)},[()=>`inline-flex items-center px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${Ls(e.status).badgeClass}`,()=>Ls(e.status).label,()=>i(p)||i(u).trim().length===0,()=>i(p)||i(u).trim().length===0]),_r(gr,()=>i(u),Ke=>x(u,Ke)),L(oe,pe)};Y(_e,oe=>{e.open&&oe(Me)})}L(t,Ne),Xt()}tr(["click","change","keydown","input"]);var cw=U('<span class="text-xs text-text-tertiary">Searching chat...</span>'),dw=U('<div class="text-sm text-text-secondary">Loading sessions...</div>'),uw=U('<div class="text-sm text-danger-fg"> </div>'),hw=U('<span class="inline-flex items-center px-2 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide bg-danger-emphasis/15 text-danger-fg">Hidden</span>'),fw=U('<div class="pt-1 border-t border-border-default/60"><span class="text-[11px] text-attention-fg"> </span></div>'),pw=U(`<div class="w-full text-left rounded-lg border border-border-default bg-bg-secondary
345
+ hover:border-accent-emphasis/60 hover:bg-bg-hover transition-colors
346
+ p-2.5 flex flex-col gap-1.5 min-h-[142px] cursor-pointer
347
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis" role="button" tabindex="0"><div class="flex items-center justify-between gap-2"><div class="flex items-center gap-1.5"><span> </span> <span> </span> <span class="inline-flex items-center px-2 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide bg-bg-tertiary text-text-secondary"> </span> <!></div> <div class="flex items-center gap-2"><span class="text-[11px] text-text-tertiary"> </span> <button type="button" class="px-2 py-0.5 rounded border border-border-default text-[10px] text-text-secondary hover:text-text-primary hover:bg-bg-hover"> </button></div></div> <div class="space-y-1"><p class="text-[10px] text-text-tertiary uppercase tracking-wide">Purpose</p> <p class="text-[11px] text-text-secondary line-clamp-2"> </p></div> <div class="space-y-1 mt-auto"><p class="text-[10px] text-text-tertiary uppercase tracking-wide">Latest Activity</p> <p class="text-[11px] text-text-primary line-clamp-2"> </p></div> <!></div>`),_w=U(`<div class="pt-2 flex justify-center"><button type="button" class="px-4 py-2 rounded border border-border-default text-sm text-text-primary
348
+ bg-bg-secondary hover:bg-bg-hover disabled:opacity-60 disabled:cursor-not-allowed"> </button></div>`),vw=U('<div class="text-sm text-text-secondary"> </div>'),gw=U(`<div class="space-y-3"><div class="overview-grid svelte-ahzlfe"><button type="button" class="w-full rounded-lg border border-dashed border-accent-emphasis/60
349
+ bg-accent-muted/10 hover:bg-accent-muted/20 transition-colors
350
+ p-2.5 min-h-[142px] flex items-center justify-center" aria-label="Create new session"><span class="text-6xl leading-none font-light text-accent-fg">+</span></button> <!></div> <!> <!></div>`),mw=U(`<div class="h-full flex flex-col min-h-0 bg-bg-primary"><div class="px-4 py-2 border-b border-border-default bg-bg-primary"><div class="flex flex-col md:flex-row gap-2 md:items-center"><input type="text" class="flex-1 min-w-0 rounded border border-border-default bg-bg-secondary
351
+ px-3 py-1.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-emphasis" placeholder="Search session purpose/summary/chat text"/> <label class="inline-flex items-center gap-2 text-xs text-text-secondary"><input type="checkbox" class="rounded border-border-default"/> Include chat transcript</label> <label class="inline-flex items-center gap-2 text-xs text-text-secondary"><input type="checkbox" class="rounded border-border-default"/> Include hidden sessions</label> <!></div></div> <div class="flex-1 min-h-0 overflow-auto p-4"><!></div></div> <!>`,1);function bw(t,e){Kt(e,!0);const r=Re(e,"newSessionSeedId",3,null),n=Re(e,"recentTerminalSessions",19,()=>[]),s=Re(e,"newSessionModelProfiles",19,()=>[]),d=Re(e,"selectedNewSessionModelProfileId",3,void 0),_=20,o=4e3,a=2e4;let c=q(xt([])),g=q(!1),h=q(!1),v=q(!0),m=q(_),w=q(null),b=q(null),f=q(!1),u=q(!1),l=q(xt(new Map));const p=2e4;let y=q(xt(Date.now())),k=q(xt({title:"Session",qraftAiSessionId:null,cliSessionId:null,purpose:"No purpose available",latestResponse:"Waiting for next user input",source:"unknown",aiAgent:_n.CLAUDE,modelProfileId:void 0,modelVendor:void 0,modelName:void 0,status:"awaiting_input",queuedPromptCount:0,failureMessage:void 0})),C=q(""),A=q(""),S=q(!0),T=q(!1),D=q(xt(new Set));const H=new Map;let W=0,M=0,G=0;const X="ai_session_id";let le=q(null),me=q(null),xe=q(xt(new Set)),R=q(!1),j=q(!1),N=q(null);const V=ye(()=>e.runningSessions.length),$=ye(()=>e.queuedSessions.length),ee=ye(()=>e.pendingPrompts.length),ce=ye(()=>i(V)>0||i($)>0||i(ee)>0);function ue(J,Z){x(b,J,!0),x(f,!1),x(k,{...i(k),...Z},!0)}function B(J){x(b,J,!0),J!==null&&x(f,!1),x(u,!0)}function I(J,Z,re){const F=new Map(i(l));F.set(J,{message:Z,status:re,createdAtMs:Date.now()}),x(l,F,!0)}function z(J){return Un(J).replaceAll(`
352
+ `," ").replace(/\s+/g," ").trim()}function O(J){return z(J).toLowerCase()}function ne(J,Z){return J.length<=Z?J:`${J.slice(0,Z)}...`}function ae(){const Z=new URLSearchParams(window.location.search).get(X);return Z===null||Z.trim().length===0?null:Z.trim()}function te(J){const Z=new URL(window.location.href);J===null||J.length===0?Z.searchParams.delete(X):Z.searchParams.set(X,J);const re=`${Z.pathname}${Z.search}${Z.hash}`,F=`${window.location.pathname}${window.location.search}${window.location.hash}`;re!==F&&window.history.replaceState(window.history.state,"",re)}function ge(J){const Z=new Date(J);if(Number.isNaN(Z.getTime()))return"-";const F=new Date().getTime()-Z.getTime(),Q=Math.floor(F/6e4),ve=Math.floor(F/36e5),Te=Math.floor(F/864e5);return Q<1?"just now":Q<60?`${Q}m ago`:ve<24?`${ve}h ago`:Te===1?"yesterday":`${Te}d ago`}function we(J){return J.clientSessionId??J.id}const Ie=ye(()=>{const J=new Map;for(const Z of e.runningSessions)J.set(we(Z),Z);return J}),Pe=ye(()=>{const J=new Map;for(const Z of e.queuedSessions)J.set(we(Z),Z);return J}),Se=ye(()=>{const J=new Map;for(const Z of n())Z.state==="failed"&&J.set(we(Z),Z);return J}),Be=ye(()=>{const J=new Map;for(const Z of e.pendingPrompts){if(Z.status!=="queued"&&Z.status!=="running")continue;const re=Z.qraft_ai_session_id,F=J.get(re),Q={message:Z.message,status:Z.status,ai_agent:Z.ai_agent};if(F===void 0){J.set(re,[Q]);continue}F.push(Q)}return J});function Ue(J){const Z=i(Ie).get(J),re=i(Pe).get(J),F=i(Se).get(J);return{runningMatch:Z,queuedMatch:re,failedMatch:F}}function je(J){return i(Be).get(J)??[]}function ze(J){var st;const{runningMatch:Z,queuedMatch:re,failedMatch:F}=Ue(J.qraftAiSessionId),Q=je(J.qraftAiSessionId),ve=Fc({hasRunningTask:Z!==void 0,hasQueuedTask:re!==void 0||Q.length>0,hasFailedTask:F!==void 0}),Te=z(J.summary),rt=z(J.firstPrompt),ct=z((Z==null?void 0:Z.prompt)??(re==null?void 0:re.prompt)??""),wt=rt||ct||Te,he=z((Z==null?void 0:Z.currentActivity)??(Z==null?void 0:Z.lastAssistantMessage)??(re==null?void 0:re.currentActivity)??(re==null?void 0:re.lastAssistantMessage)??(F==null?void 0:F.error)??""),dt=F==null?void 0:F.error,At=z(((st=Q[0])==null?void 0:st.message)??""),yt=he||At||Te||Uc(ve);return{qraftAiSessionId:J.qraftAiSessionId,cliSessionId:J.sessionId,purpose:ne(wt||"No purpose available",90),latestResponse:ne(yt,160),source:J.source,aiAgent:J.aiAgent??(Z==null?void 0:Z.aiAgent)??(re==null?void 0:re.aiAgent)??_n.CLAUDE,modelProfileId:J.modelProfileId??(Z==null?void 0:Z.modelProfileId)??(re==null?void 0:re.modelProfileId),modelVendor:J.modelVendor??(Z==null?void 0:Z.modelVendor)??(re==null?void 0:re.modelVendor),modelName:J.modelName??(Z==null?void 0:Z.modelName)??(re==null?void 0:re.modelName),status:ve,queuedPromptCount:Q.length,failureMessage:dt,updatedAt:J.modified}}function Ne(J){var re,F;const Z=[];for(const Q of[...e.runningSessions,...e.queuedSessions]){const ve=we(Q);if(J.has(ve))continue;const Te=je(ve),rt=Fc({hasRunningTask:Q.state==="running",hasQueuedTask:Te.length>0||Q.state==="queued",hasFailedTask:Q.state==="failed"});Z.push({qraftAiSessionId:ve,cliSessionId:Q.claudeSessionId??null,purpose:ne(z(Q.prompt)||"No purpose available",90),latestResponse:ne(z(Q.currentActivity??Q.lastAssistantMessage??Q.error??((re=Te[0])==null?void 0:re.message)??Uc(rt)),160),source:"qraftbox",aiAgent:Q.aiAgent??((F=Te[0])==null?void 0:F.ai_agent)??_n.CLAUDE,modelProfileId:Q.modelProfileId,modelVendor:Q.modelVendor,modelName:Q.modelName,status:rt,queuedPromptCount:Te.length,failureMessage:Q.error,updatedAt:Q.completedAt??Q.startedAt??Q.createdAt})}return Z}function _e(J,Z){const re=O(Z);return re.length===0?!0:O(J.purpose).includes(re)||O(J.latestResponse).includes(re)}function Me(J){const Z=[];for(const re of J){if(typeof re!="object"||re===null)continue;const F=re;F.type==="text"&&typeof F.text=="string"&&Z.push(F.text)}return Z.join(" ")}function oe(J){const Z=J.raw;if((J.type==="user"||J.type==="assistant")&&typeof Z.message=="object"&&Z.message!==null){const F=Z.message.content;if(typeof F=="string")return F;if(Array.isArray(F))return Me(F)}return typeof J.content=="string"?J.content:typeof Z.summary=="string"?Z.summary:""}async function pe(J){const Z=H.get(J);if(Z!==void 0)return Z;if(e.contextId===null)return"";try{const re=await fetch(`/api/ctx/${e.contextId}/claude-sessions/sessions/${J}/transcript?limit=1000`);if(!re.ok)return H.set(J,""),"";const Q=(await re.json()).events.map(Te=>oe(Te)).join(" "),ve=O(Q);return H.set(J,ve),ve}catch{return H.set(J,""),""}}async function Ce(J,Z,re){const F=O(Z);if(F.length===0||e.contextId===null){x(D,new Set,!0),x(T,!1);return}x(T,!0);const Q=new Set;for(const wt of J){const he=`${wt.firstPrompt} ${wt.summary}`;O(he).includes(F)&&Q.add(wt.qraftAiSessionId)}const ve=J.filter(wt=>!Q.has(wt.qraftAiSessionId));let Te=0;const rt=Math.min(6,ve.length),ct=Array.from({length:rt},async()=>{for(;Te<ve.length;){const wt=Te;Te+=1;const he=ve[wt];if(he===void 0)continue;(await pe(he.qraftAiSessionId)).includes(F)&&Q.add(he.qraftAiSessionId)}});await Promise.all(ct),re===M&&(x(D,Q,!0),x(T,!1))}const He=ye(()=>{const J=i(c).map(ve=>ze(ve)),Z=new Set(J.map(ve=>ve.qraftAiSessionId)),re=Ne(Z),F=[...J,...re],Q=new Map;for(const ve of F){const Te=Q.get(ve.qraftAiSessionId);if(Te===void 0){Q.set(ve.qraftAiSessionId,ve);continue}const rt=new Date(Te.updatedAt).getTime();new Date(ve.updatedAt).getTime()>=rt&&Q.set(ve.qraftAiSessionId,ve)}return[...Q.values()].sort((ve,Te)=>{const rt=new Date(ve.updatedAt).getTime();return new Date(Te.updatedAt).getTime()-rt})}),$e=ye(()=>i(R)?i(He):i(He).filter(J=>!i(xe).has(J.qraftAiSessionId))),nt=ye(()=>{const J=i(A).trim();return J.length===0?i($e):i(S)?i($e).filter(Z=>i(D).has(Z.qraftAiSessionId)||_e(Z,J)):i($e).filter(Z=>_e(Z,J))}),Fe=ye(()=>{const J=new Map;for(const Z of i(He))J.set(Z.qraftAiSessionId,Z);return J}),qe=ye(()=>i(b)===null?null:i(Fe).get(i(b))??null),at=ye(()=>{var F,Q,ve;const J=((F=i(qe))==null?void 0:F.modelProfileId)??i(k).modelProfileId,Z=((Q=i(qe))==null?void 0:Q.modelVendor)??i(k).modelVendor,re=((ve=i(qe))==null?void 0:ve.modelName)??i(k).modelName;if(J!==void 0){const Te=s().find(rt=>rt.id===J);return Te!==void 0?`${Te.name} (${Te.vendor} / ${Te.model})`:J}if(Z!==void 0&&re!==void 0)return`${Z} / ${re}`}),Ze=ye(()=>{var Te,rt;const J=i(y);if(i(b)===null)return[];const Z=je(i(b)),re=i(l).get(i(b));if(re===void 0||J-re.createdAtMs>p||((Te=i(qe))==null?void 0:Te.status)==="awaiting_input"||((rt=i(qe))==null?void 0:rt.status)==="failed")return Z;const Q=z(re.message);return Z.some(ct=>z(ct.message)===Q)?Z:[re,...Z]}),Le=ye(()=>{if(i(b)===null)return;const J=i(Ie).get(i(b));if(J===void 0)return;const Z=J.lastAssistantMessage;if(!(typeof Z!="string"||Z.trim().length===0))return Z});gt(()=>{const J=i(y),Z=new Map(i(l));let re=!1;for(const[F,Q]of i(l)){const ve=J-Q.createdAtMs>p,Te=i(Fe).get(F),rt=(Te==null?void 0:Te.status)==="awaiting_input"||(Te==null?void 0:Te.status)==="failed";(ve||rt)&&(Z.delete(F),re=!0)}re&&x(l,Z,!0)}),gt(()=>{const J=setInterval(()=>{x(y,Date.now(),!0)},1e3);return()=>clearInterval(J)});async function Ae(J){if(i(g)&&(J==null?void 0:J.bypassCache)!==!0)return;const Z=++W;if(e.contextId===null||e.contextId.length===0){x(c,[],!0),x(v,!1),x(w,null);return}x(g,!0),x(w,null);try{const re=new URLSearchParams({offset:"0",limit:String(i(m)),sortBy:"modified",sortOrder:"desc"});(J==null?void 0:J.bypassCache)===!0&&re.set("_",String(Date.now())),e.projectPath.length>0&&re.set("workingDirectoryPrefix",e.projectPath);const F=await fetch(`/api/ctx/${e.contextId}/claude-sessions/sessions?${re.toString()}`);if(!F.ok)throw new Error(`Failed to load sessions (${F.status})`);const Q=await F.json();if(Z!==W)return;x(c,Q.sessions,!0),x(v,Q.sessions.length===i(m))}catch(re){if(Z!==W)return;x(c,[],!0),x(v,!1),x(w,re instanceof Error?re.message:"Failed to load sessions",!0),x(D,new Set,!0),x(T,!1)}finally{Z===W&&x(g,!1)}}async function it(){if(!(e.contextId===null||e.contextId.length===0||i(h)||!i(v))){x(h,!0),x(w,null);try{x(m,i(m)+_),await Ae({bypassCache:!0})}catch(J){x(w,J instanceof Error?J.message:"Failed to load more sessions",!0)}finally{x(h,!1)}}}async function tt(){const J=++G;try{const Z=await Sp();if(J!==G)return;x(xe,new Set(Z),!0)}catch{if(J!==G)return;x(xe,new Set,!0)}}async function vt(J){const Z=!i(xe).has(J);await Cp(J,Z);const re=new Set(i(xe));Z?re.add(J):re.delete(J),x(xe,re,!0),Z&&!i(R)&&i(b)===J&&(x(f,!1),x(b,null))}gt(()=>{const J=i(C),Z=setTimeout(()=>{x(A,J.trim(),!0)},250);return()=>{clearTimeout(Z)}}),gt(()=>{const J=()=>{B(ae())};return B(ae()),window.addEventListener("popstate",J),()=>{window.removeEventListener("popstate",J)}}),gt(()=>{const J=e.contextId,Z=e.projectPath,re=`${J??""}::${Z}`;re!==i(le)&&(x(le,re),x(me,null),x(m,_),x(v,!0),Ae({bypassCache:!0}),tt())}),gt(()=>{const J=e.contextId,Z=i(ce);if(J===null)return;const re=Z?o:a,F=Z?"active":"idle",Q=F!==i(me);x(me,F,!0),Q&&Ae();const ve=setInterval(()=>{Ae(),Z||tt()},re);return()=>clearInterval(ve)}),gt(()=>{const J=e.contextId,Z=i(c),re=i(A).trim(),F=i(S);M+=1;const Q=M;if(J===null||re.length===0||!F){x(D,new Set,!0),x(T,!1);return}Ce(Z,re,Q)}),gt(()=>{i(qe)!==null&&x(k,{title:i(qe).purpose,qraftAiSessionId:i(qe).qraftAiSessionId,cliSessionId:i(qe).cliSessionId,purpose:i(qe).purpose,latestResponse:i(qe).latestResponse,source:i(qe).source,status:i(qe).status,aiAgent:i(qe).aiAgent,modelProfileId:i(qe).modelProfileId,modelVendor:i(qe).modelVendor,modelName:i(qe).modelName,queuedPromptCount:i(qe).queuedPromptCount,failureMessage:i(qe).failureMessage},!0)}),gt(()=>{if(!i(f)||i(b)!==null||typeof r()!="string")return;const J=r().trim();J.length!==0&&x(b,J,!0)}),gt(()=>{i(u)&&te(i(b))});async function ft(J,Z,re){var Q;if(i(f)){if(e.onStartNewSessionPrompt===void 0)throw new Error("Unable to start a new session.");const ve=await e.onStartNewSessionPrompt(J,Z,re);if(ve===null)throw new Error("Prompt submission failed. Please retry.");const Te=i(b)??r()??ve.sessionId;I(Te,J,Z?"running":"queued"),ue(Te,{title:"New Session",qraftAiSessionId:Te,cliSessionId:ve.claudeSessionId??null,purpose:"New session",latestResponse:J,source:"qraftbox",aiAgent:_n.CLAUDE,modelProfileId:d(),modelVendor:void 0,modelName:void 0,status:Z?"running":"queued"}),await Ae({bypassCache:!0});return}if(i(b)===null)throw new Error("Session is not selected.");if(await e.onSubmitPrompt(i(b),J,Z,re,((Q=i(qe))==null?void 0:Q.modelProfileId)??i(k).modelProfileId)===null)throw new Error("Prompt submission failed. Please retry.");I(i(b),J,Z?"running":"queued"),await Ae({bypassCache:!0})}async function ht(J,Z,re){var ve;if(e.onStartNewSessionPrompt===void 0)throw new Error("Unable to start a new session.");const F=vl(),Q=await e.onStartNewSessionPrompt(J,Z,re,F);if(Q===null)throw new Error("Prompt submission failed. Please retry.");I(F,J,Z?"running":"queued"),ue(F,{title:"New Session",qraftAiSessionId:F,cliSessionId:Q.claudeSessionId??null,purpose:"New session",latestResponse:J,source:"qraftbox",aiAgent:_n.CLAUDE,modelProfileId:((ve=i(qe))==null?void 0:ve.modelProfileId)??i(k).modelProfileId,modelVendor:void 0,modelName:void 0,status:Z?"running":"queued"}),await Ae({bypassCache:!0})}async function pt(J){var F;const Z=J.trim();if(i(b)===null||Z.length===0)throw new Error("Session is not selected.");if(await e.onSubmitPrompt(i(b),Z,!0,[],((F=i(qe))==null?void 0:F.modelProfileId)??i(k).modelProfileId,!0)===null)throw new Error("Restart failed. Please retry.");I(i(b),Z,"running"),await Ae({bypassCache:!0})}async function bt(J){if(i(f)||i(b)===null)return;const Z=await Fn(J),re=$1(J,Z.content,"session-action-v1");await ft(re,!0)}const Tt=ye(()=>{var Z;if(i(f)||i(b)===null)return!1;const J=((Z=i(qe))==null?void 0:Z.status)??i(k).status;return typeof e.onCancelActiveSession=="function"&&(J==="running"||J==="queued")});async function et(){if(!(i(f)||i(b)===null||typeof e.onCancelActiveSession!="function"||i(j))){x(j,!0),x(N,null);try{await e.onCancelActiveSession(i(b)),await Ae({bypassCache:!0})}catch(J){x(N,J instanceof Error?J.message:"Failed to cancel prompt",!0)}finally{x(j,!1)}}}var Ct=mw(),kt=Ye(Ct),Mt=E(kt),Pt=E(Mt),Rt=E(Pt),It=P(Rt,2),Ht=E(It),Et=P(It,2),fe=E(Et),be=P(Et,2);{var We=J=>{var Z=cw();L(J,Z)};Y(be,J=>{i(T)&&J(We)})}var Je=P(Mt,2),ut=E(Je);{var Xe=J=>{var Z=dw();L(J,Z)},ie=J=>{var Z=_t(),re=Ye(Z);{var F=ve=>{var Te=uw(),rt=E(Te);de(()=>se(rt,i(w))),L(ve,Te)},Q=ve=>{var Te=gw(),rt=E(Te),ct=E(rt);ct.__click=()=>{var st;x(b,null),x(f,!0),x(k,{title:"New Session",qraftAiSessionId:null,cliSessionId:null,purpose:"New session",latestResponse:"Submit the first prompt to start this session",source:"qraftbox",aiAgent:_n.CLAUDE,status:"awaiting_input",queuedPromptCount:0,failureMessage:void 0},!0),(st=e.onNewSession)==null||st.call(e)};var wt=P(ct,2);Gt(wt,17,()=>i(nt),st=>st.qraftAiSessionId,(st,ot)=>{var Lt=pw();Lt.__click=()=>{ue(i(ot).qraftAiSessionId,{title:i(ot).purpose,qraftAiSessionId:i(ot).qraftAiSessionId,cliSessionId:i(ot).cliSessionId,purpose:i(ot).purpose,latestResponse:i(ot).latestResponse,source:i(ot).source,aiAgent:i(ot).aiAgent,status:i(ot).status,queuedPromptCount:i(ot).queuedPromptCount,failureMessage:i(ot).failureMessage})},Lt.__keydown=zt=>{(zt.key==="Enter"||zt.key===" ")&&(zt.preventDefault(),ue(i(ot).qraftAiSessionId,{title:i(ot).purpose,qraftAiSessionId:i(ot).qraftAiSessionId,cliSessionId:i(ot).cliSessionId,purpose:i(ot).purpose,latestResponse:i(ot).latestResponse,source:i(ot).source,aiAgent:i(ot).aiAgent,status:i(ot).status,queuedPromptCount:i(ot).queuedPromptCount,failureMessage:i(ot).failureMessage}))};var rr=E(Lt),gr=E(rr),ur=E(gr),Ot=E(ur),Ft=P(ur,2),hr=E(Ft),qr=P(Ft,2),xr=E(qr),Dr=P(qr,2);{var Jt=zt=>{var $t=hw();L(zt,$t)};Y(Dr,zt=>{i(xe).has(i(ot).qraftAiSessionId)&&zt(Jt)})}var Yt=P(gr,2),sr=E(Yt),ar=E(sr),Vt=P(sr,2);Vt.__click=zt=>{zt.stopPropagation(),vt(i(ot).qraftAiSessionId)};var Bt=E(Vt),Zt=P(rr,2),br=P(E(Zt),2),kr=E(br),or=P(Zt,2),fr=P(E(or),2),yr=E(fr),wr=P(or,2);{var Fr=zt=>{var $t=fw(),Ke=E($t),lt=E(Ke);de(()=>se(lt,`${i(ot).queuedPromptCount??""} prompt(s) waiting`)),L(zt,$t)};Y(wr,zt=>{i(ot).queuedPromptCount>0&&zt(Fr)})}de((zt,$t,Ke,lt,St,ir,nr)=>{Ge(Lt,"aria-label",zt),Ve(ur,1,$t,"svelte-ahzlfe"),se(Ot,Ke),Ve(Ft,1,`inline-flex items-center px-2 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide ${i(ot).source==="qraftbox"?"bg-success-muted text-success-fg":i(ot).source==="claude-cli"?"bg-accent-muted text-accent-fg":i(ot).source==="codex-cli"?"bg-attention-emphasis/20 text-attention-fg":"bg-bg-tertiary text-text-secondary"}`),se(hr,i(ot).source),se(xr,i(ot).aiAgent),se(ar,lt),Ge(Vt,"title",St),Ge(Vt,"aria-label",ir),se(Bt,nr),se(kr,i(ot).purpose),se(yr,i(ot).latestResponse)},[()=>`${Ls(i(ot).status).label} ${ge(i(ot).updatedAt)} ${i(ot).purpose} ${i(ot).latestResponse}`,()=>`inline-flex items-center px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${Ls(i(ot).status).badgeClass}`,()=>Ls(i(ot).status).label,()=>ge(i(ot).updatedAt),()=>i(xe).has(i(ot).qraftAiSessionId)?"Show session":"Hide session",()=>i(xe).has(i(ot).qraftAiSessionId)?"Show session":"Hide session",()=>i(xe).has(i(ot).qraftAiSessionId)?"Show":"Hide"]),L(st,Lt)});var he=P(rt,2);{var dt=st=>{var ot=_w(),Lt=E(ot);Lt.__click=()=>void it();var rr=E(Lt);de(()=>{Lt.disabled=i(h),se(rr,i(h)?"Loading more...":`Load ${_} more`)}),L(st,ot)};Y(he,st=>{i(v)&&st(dt)})}var At=P(he,2);{var yt=st=>{var ot=vw(),Lt=E(ot);de(()=>se(Lt,i(A).length>0?"No sessions matched your search.":"No sessions found for this project.")),L(st,ot)};Y(At,st=>{i(nt).length===0&&st(yt)})}L(ve,Te)};Y(re,ve=>{i(w)!==null&&i(He).length===0?ve(F):ve(Q,!1)},!0)}L(J,Z)};Y(ut,J=>{i(g)&&i(He).length===0?J(Xe):J(ie,!1)})}var ke=P(kt,2);{var De=J=>{{let Z=ye(()=>i(b)??null),re=ye(()=>{var st;return((st=i(qe))==null?void 0:st.qraftAiSessionId)??i(k).qraftAiSessionId??i(b)}),F=ye(()=>{var st;return((st=i(qe))==null?void 0:st.cliSessionId)??i(k).cliSessionId}),Q=ye(()=>{var st;return((st=i(qe))==null?void 0:st.purpose)??i(k).title}),ve=ye(()=>{var st;return((st=i(qe))==null?void 0:st.status)??i(k).status}),Te=ye(()=>{var st;return((st=i(qe))==null?void 0:st.purpose)??i(k).purpose}),rt=ye(()=>{var st;return((st=i(qe))==null?void 0:st.latestResponse)??i(k).latestResponse}),ct=ye(()=>{var st;return((st=i(qe))==null?void 0:st.source)??i(k).source}),wt=ye(()=>{var st;return((st=i(qe))==null?void 0:st.aiAgent)??i(k).aiAgent}),he=ye(()=>{var st;return((st=i(qe))==null?void 0:st.queuedPromptCount)??i(k).queuedPromptCount}),dt=ye(()=>{var st;return((st=i(qe))==null?void 0:st.failureMessage)??i(k).failureMessage}),At=ye(()=>i(b)!==null&&i(xe).has(i(b))),yt=ye(()=>!i(f)&&i(b)!==null);lw(J,{open:!0,get contextId(){return e.contextId},get sessionId(){return i(Z)},get qraftSessionId(){return i(re)},get cliSessionId(){return i(F)},get title(){return i(Q)},get status(){return i(ve)},get purpose(){return i(Te)},get latestResponse(){return i(rt)},get source(){return i(ct)},get aiAgent(){return i(wt)},get queuedPromptCount(){return i(he)},get failureMessage(){return i(dt)},get pendingPromptMessages(){return i(Ze)},get optimisticAssistantMessage(){return i(Le)},get isHidden(){return i(At)},onToggleHidden:async()=>{i(b)!==null&&await vt(i(b))},onClose:()=>{x(f,!1),x(b,null),x(j,!1),x(N,null)},onSubmitPrompt:(st,ot,Lt)=>ft(st,ot,Lt),onSubmitPromptAsNewSession:(st,ot,Lt)=>ht(st,ot,Lt),get showModelProfileSelector(){return i(f)},get modelProfiles(){return s()},get selectedModelProfileId(){return d()},get onModelProfileChange(){return e.onSelectNewSessionModelProfile},get activeModelLabel(){return i(at)},get canCancelPrompt(){return i(Tt)},get cancelPromptInProgress(){return i(j)},get cancelPromptError(){return i(N)},onCancelPrompt:et,get canRunSessionDefaultPrompts(){return i(yt)},onRunRefreshPurposePrompt:()=>bt("ai-session-refresh-purpose"),onRunResumeSessionPrompt:()=>bt("ai-session-resume"),onRestartSessionFromBeginning:pt})}};Y(ke,J=>{(i(b)!==null||i(f))&&J(De)})}_r(Rt,()=>i(C),J=>x(C,J)),Da(Ht,()=>i(S),J=>x(S,J)),Da(fe,()=>i(R),J=>x(R,J)),L(t,Ct),Xt()}tr(["click","keydown"]);var yw=U('<div class="relative flex flex-1 min-h-0 overflow-hidden bg-bg-primary"><!></div>');function xw(t,e){Kt(e,!0);let r=Re(e,"recentlyCompletedSessions",19,()=>[]),n=q(xt([])),s=q(void 0),d=q(!1);async function _(){try{const h=await ml();x(n,[...h.profiles],!0),x(s,h.operationBindings.aiDefaultProfileId??void 0,!0)}catch{x(n,[],!0),x(s,void 0)}}gt(()=>{i(d)||(x(d,!0),_())});async function o(h,v,m,w,b,f=!1){return typeof e.onResumeCliSession=="function"&&e.onResumeCliSession(h),e.onSubmitPrompt(v,m,{primaryFile:void 0,references:w,diffSummary:void 0,resumeSessionId:h,modelProfileId:b},{forceNewSession:f})}async function a(h,v,m,w){return e.onSubmitPrompt(h,v,{primaryFile:void 0,references:m,diffSummary:void 0,resumeSessionId:w??e.currentQraftAiSessionId,modelProfileId:i(s)})}var c=yw(),g=E(c);{let h=ye(()=>e.currentQraftAiSessionId??null);bw(g,{get contextId(){return e.contextId},get projectPath(){return e.projectPath},get runningSessions(){return e.runningSessions},get queuedSessions(){return e.queuedSessions},get recentTerminalSessions(){return r()},get pendingPrompts(){return e.pendingPrompts},get newSessionSeedId(){return i(h)},get newSessionModelProfiles(){return i(n)},get selectedNewSessionModelProfileId(){return i(s)},onSelectNewSessionModelProfile:v=>{x(s,v,!0)},get onNewSession(){return e.onNewSession},get onCancelActiveSession(){return e.onCancelActiveSession},onStartNewSessionPrompt:a,onSubmitPrompt:o})}L(t,c),Xt()}var ww=Cr('<svg class="animate-spin h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" aria-hidden="true"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> Opening picker...',1),Sw=Cr('<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> ',1),Cw=U('<div class="p-3 rounded-lg border border-danger-muted bg-danger-subtle text-danger-fg text-sm" role="alert"> </div>'),kw=U('<div class="flex items-center border-b border-border-default last:border-b-0 hover:bg-bg-tertiary transition-colors"><button type="button" class="flex-1 text-left px-4 py-2.5 text-sm flex items-center gap-3 min-w-0"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> <div class="flex-1 min-w-0"><span class="text-text-primary font-medium"> </span> <span class="text-xs text-text-tertiary ml-2 truncate"> </span></div></button> <button type="button" class="shrink-0 p-2 mr-2 rounded text-text-tertiary hover:text-danger-fg hover:bg-danger-subtle transition-colors" title="Remove from recent projects"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.75.75 0 1 1 1.06 1.06L9.06 8l3.22 3.22a.75.75 0 1 1-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 0 1-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button></div>'),Ew=U('<div class="w-full max-w-md"><h3 class="text-xs font-semibold text-text-tertiary uppercase tracking-wider mb-2 px-4">Recent Projects</h3> <div class="border border-border-default rounded-lg bg-bg-secondary overflow-hidden"></div></div>'),Aw=U('<p class="text-xs text-text-tertiary">Temporary project mode is active. Project add/change is disabled.</p>'),Tw=U(`<div class="flex flex-col items-center justify-center h-full gap-6 text-text-secondary"><svg width="48" height="48" viewBox="0 0 16 16" fill="currentColor" class="text-text-tertiary"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> <p class="text-lg">No project open</p> <p class="text-sm text-text-tertiary">Open a project directory to get started.</p> <div class="w-full max-w-md flex flex-col gap-3"><button type="button" class="w-full flex items-center justify-center gap-2 px-4 py-3 rounded-lg text-sm font-medium
353
+ bg-accent-emphasis hover:brightness-110 text-white
354
+ disabled:opacity-50 disabled:cursor-not-allowed
355
+ transition-all"><!></button> <div class="flex items-center gap-2"><div class="h-px flex-1 bg-border-default"></div> <span class="text-xs text-text-tertiary">or enter path</span> <div class="h-px flex-1 bg-border-default"></div></div> <form class="flex items-center gap-2"><input type="text" class="flex-1 px-3 py-2 text-sm rounded-lg border border-border-default
356
+ bg-bg-secondary text-text-primary font-mono
357
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis
358
+ placeholder:text-text-tertiary" placeholder="/path/to/project"/> <button type="submit" class="px-4 py-2 rounded-lg text-sm font-medium
359
+ bg-bg-tertiary hover:bg-border-default text-text-primary
360
+ border border-border-default
361
+ disabled:opacity-50 disabled:cursor-not-allowed
362
+ transition-colors"><!></button></form> <!></div> <!> <!></div>`);function Pw(t,e){Kt(e,!0);var r=Tw(),n=P(E(r),6),s=E(n);s.__click=()=>void e.onPickDirectory();var d=E(s);{var _=y=>{var k=ww();L(y,k)},o=y=>{var k=Sw(),C=P(Ye(k),1,!0);de(()=>se(C,e.chooseDirectoryLabel)),L(y,k)};Y(d,y=>{e.pickingDirectory?y(_):y(o,!1)})}var a=P(s,4),c=E(a);c.__input=y=>e.onNewProjectPathChange(y.currentTarget.value);var g=P(c,2),h=E(g);{var v=y=>{var k=Lr("Opening...");L(y,k)},m=y=>{var k=Lr("Open");L(y,k)};Y(h,y=>{e.newProjectLoading?y(v):y(m,!1)})}var w=P(a,2);{var b=y=>{var k=Cw(),C=E(k);de(()=>se(C,e.newProjectError)),L(y,k)};Y(w,y=>{e.newProjectError!==null&&y(b)})}var f=P(n,2);{var u=y=>{var k=Ew(),C=P(E(k),2);Gt(C,21,()=>e.availableRecentProjects,A=>A.path,(A,S)=>{var T=kw(),D=E(T);D.__click=()=>void e.onOpenRecentProject(i(S).path);var H=E(D),W=P(H,2),M=E(W),G=E(M),X=P(M,2),le=E(X),me=P(D,2);me.__click=()=>void e.onRemoveRecentProject(i(S).path),de(()=>{D.disabled=!e.canManageProjects,Ge(D,"title",i(S).path),Ve(H,0,`shrink-0 ${i(S).isGitRepo?"text-accent-fg":"text-text-tertiary"}`),se(G,i(S).name),se(le,i(S).path),me.disabled=!e.canManageProjects}),L(A,T)}),L(y,k)};Y(f,y=>{e.availableRecentProjects.length>0&&y(u)})}var l=P(f,2);{var p=y=>{var k=Aw();L(y,k)};Y(l,y=>{e.canManageProjects||y(p)})}de(y=>{s.disabled=!e.canManageProjects||e.pickingDirectory||e.newProjectLoading,_l(c,e.newProjectPath),c.disabled=!e.canManageProjects||e.newProjectLoading,g.disabled=y},[()=>!e.canManageProjects||e.newProjectPath.trim().length===0||e.newProjectLoading]),Sr("submit",a,y=>{y.preventDefault();const k=e.newProjectPath.trim();k.length>0&&e.onOpenProject(k)}),L(t,r),Xt()}tr(["click","input"]);var Lw=U(`<button type="button" class="absolute right-1 top-1/2 -translate-y-1/2
363
+ p-1 rounded
364
+ text-text-tertiary hover:text-text-primary hover:bg-bg-hover
365
+ transition-colors duration-150
366
+ focus:outline-none focus:ring-1 focus:ring-accent-emphasis" aria-label="Clear search" title="Clear search (Esc)"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></button>`),Rw=U(`<div><div class="absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none
367
+ text-text-tertiary" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.35-4.35"></path></svg></div> <input type="text" class="w-full pl-7 pr-7 py-1 text-sm rounded-md
368
+ bg-bg-secondary border border-bg-border
369
+ text-text-primary placeholder-text-tertiary
370
+ focus:outline-none focus:ring-1 focus:ring-accent-emphasis focus:border-transparent
371
+ transition-all duration-200" aria-label="Search" autocomplete="off" spellcheck="false"/> <!></div>`);function Iw(t,e){Kt(e,!0);const r=Re(e,"placeholder",3,"Search sessions..."),n=Re(e,"debounceMs",3,300);let s=q(xt(e.value)),d=q(null),_=q(!1);gt(()=>{x(s,e.value,!0)});function o(w){const b=w.target;x(s,b.value,!0),i(d)!==null&&clearTimeout(i(d)),x(d,window.setTimeout(()=>{e.onSearch(i(s)),x(d,null)},n()),!0)}function a(){x(s,""),e.onSearch(""),i(d)!==null&&(clearTimeout(i(d)),x(d,null))}function c(w){w.key==="Escape"&&(w.preventDefault(),a())}var g=Rw(),h=P(E(g),2);h.__input=o,h.__keydown=c;var v=P(h,2);{var m=w=>{var b=Lw();b.__click=a,L(w,b)};Y(v,w=>{i(s).length>0&&w(m)})}de(()=>{Ve(g,1,`search-input relative ml-auto ${i(_)?"w-56":"w-36"} transition-all duration-200`),_l(h,i(s)),Ge(h,"placeholder",r())}),Sr("focus",h,()=>x(_,!0)),Sr("blur",h,()=>x(_,!1)),L(t,g),Xt()}tr(["input","keydown","click"]);var Dw=U(" <!>",1),Mw=U(`<div class="flex flex-col items-center justify-center h-64" role="status"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="text-text-tertiary mb-4" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><line x1="4.93" y1="4.93" x2="19.07" y2="19.07"></line></svg> <p class="text-text-secondary text-lg mb-2">Not a Git Repository</p> <p class="text-text-tertiary text-sm">The current directory is not managed by git. Commit history is not
372
+ available.</p></div>`),Ow=U('<div class="loading-state flex flex-col items-center justify-center h-64" role="status" aria-live="polite"><svg class="animate-spin h-8 w-8 text-accent-fg mb-4 svelte-cti980" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" aria-hidden="true"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> <p class="text-text-secondary">Loading commits...</p></div>'),Bw=U('<div class="flex flex-col items-center justify-center h-64"><div class="p-4 rounded-lg border border-danger-emphasis/30 bg-danger-emphasis/10 text-danger-fg max-w-md"><div class="flex items-start gap-3"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="shrink-0 mt-0.5" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg> <div class="flex-1"><p class="font-medium">Error Loading Commits</p> <p class="text-sm mt-1"> </p></div></div> <div class="mt-3 flex justify-end"><button type="button" class="px-4 py-2 text-sm bg-bg-tertiary text-text-primary border border-border-default rounded hover:bg-bg-hover transition-colors">Retry</button></div></div></div>'),Nw=U('<div class="empty-state flex flex-col items-center justify-center h-64" role="status"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="text-text-tertiary mb-4" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg> <p class="text-text-secondary text-lg mb-2"> </p> <p class="text-text-tertiary text-sm"><!></p></div>'),jw=U('<div class="flex items-center gap-2 px-4 py-3 text-sm text-text-secondary"><div class="w-4 h-4 border-2 border-border-default border-t-accent-emphasis rounded-full animate-spin svelte-cti980"></div> Loading detail...</div>'),Hw=U('<div class="px-4 py-3 text-sm text-danger-fg"> </div>'),Fw=U('<div class="text-sm text-text-primary whitespace-pre-wrap bg-bg-primary p-3 rounded border border-border-default"> </div>'),Uw=U('<div class="text-sm text-text-primary"> </div>'),Vw=U('<span class="text-success-fg"> </span>'),zw=U('<span class="text-danger-fg"> </span>'),Ww=U('<div class="flex items-center gap-2 p-3 text-text-secondary"><div class="w-3 h-3 border-2 border-border-default border-t-accent-emphasis rounded-full animate-spin svelte-cti980"></div> Loading diff...</div>'),qw=U('<div class="p-3 text-danger-fg"> </div>'),Gw=U(`<div class="p-3 text-text-secondary">No diff available (binary file or empty
373
+ change)</div>`),Kw=U('<div class="border-t border-border-default bg-bg-primary overflow-x-auto text-xs"><!></div>'),Xw=U('<div><button type="button" class="w-full flex items-center gap-2 px-3 py-2 text-xs hover:bg-bg-tertiary transition-colors cursor-pointer"><span class="text-text-secondary shrink-0"> </span> <span> </span> <span class="font-mono text-text-primary truncate text-left"> </span> <div class="flex items-center gap-2 ml-auto shrink-0"><!> <!></div></button> <!></div>'),Jw=U('<div class="space-y-1"><div class="text-xs font-medium text-text-secondary uppercase tracking-wide">Changed Files</div> <div class="bg-bg-primary rounded border border-border-default divide-y divide-border-default"></div></div>'),Yw=U('<div class="px-4 pb-4 space-y-3"><div class="pt-3 text-xs text-text-secondary"><span class="font-mono select-all"> </span></div> <!> <div class="flex items-center gap-4 text-xs"><span class="text-text-secondary"> </span> <span class="text-success-fg"> </span> <span class="text-danger-fg"> </span></div> <!></div>'),Qw=U('<div class="border-x border-b border-accent-emphasis/40 rounded-b-lg overflow-hidden"><!></div>'),Zw=U('<div class="contents"><button type="button"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M6.22 3.22a.75.75 0 011.06 0l4.25 4.25a.75.75 0 010 1.06l-4.25 4.25a.75.75 0 01-1.06-1.06L9.94 8 6.22 4.28a.75.75 0 010-1.06z"></path></svg> <span class="shrink-0 px-1.5 py-0.5 rounded text-[10px] font-bold font-mono bg-bg-tertiary text-accent-fg"> </span> <span class="flex-1 text-sm truncate text-text-primary"> </span> <span class="text-xs text-text-tertiary shrink-0"> </span> <span class="text-xs text-text-tertiary shrink-0"> </span></button> <!></div>'),$w=U('<div class="mt-4 p-4 rounded-lg border border-danger-emphasis/30 bg-danger-emphasis/10 text-danger-fg text-sm"> </div>'),eS=U('<span class="flex items-center gap-2"><svg class="animate-spin h-4 w-4 svelte-cti980" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" aria-hidden="true"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> Loading...</span>'),tS=U(`<div class="pagination mt-6 flex justify-center"><button type="button" class="px-6 py-3 rounded-lg text-sm font-medium
374
+ bg-bg-secondary hover:bg-bg-hover text-text-primary
375
+ border border-bg-border hover:border-accent-emphasis/30
376
+ disabled:opacity-50 disabled:cursor-not-allowed
377
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis
378
+ transition-all duration-150" aria-label="Load more commits"><!></button></div>`),rS=U("<!> <!> <!>",1),iS=U('<div class="flex flex-col h-full bg-bg-primary text-text-primary"><div class="flex items-center gap-3 px-6 py-3 border-b border-bg-border bg-bg-secondary"><div class="text-sm text-text-tertiary shrink-0"><!></div> <div class="flex-1"></div> <!></div> <div class="content-area flex-1 overflow-y-auto px-6 pb-4"><!></div></div>');function nS(t,e){Kt(e,!0);const r=Re(e,"isGitRepo",3,!0);let n=q(xt([])),s=q(!0),d=q(!1),_=q(null),o=q(!1),a=q(0);const c=50;let g=q(""),h=q(null),v=q(null),m=q(!1),w=q(null),b=q(null),f=q(xt([])),u=q(!1),l=q(null),p=q(xt(new Map));function y(ee){x(g,ee,!0),x(a,0),x(n,[],!0),k(!1)}async function k(ee){x(ee?d:s,!0),x(_,null);try{const ce=new URLSearchParams;ce.set("limit",c.toString()),ce.set("offset",ee?i(a).toString():"0"),i(g).trim().length>0&&ce.set("search",i(g).trim());const ue=await fetch(`/api/ctx/${e.contextId}/commits?${ce.toString()}`);if(!ue.ok){const I=await ue.json().catch(()=>null);throw new Error((I==null?void 0:I.error)??`Failed to load commits (${ue.status})`)}const B=await ue.json();ee?x(n,[...i(n),...B.commits],!0):x(n,[...B.commits],!0),x(o,B.pagination.hasMore,!0),x(a,B.pagination.offset+B.pagination.limit)}catch(ce){x(_,ce instanceof Error?ce.message:"Failed to load commits",!0)}finally{x(s,!1),x(d,!1)}}function C(){i(d)||!i(o)||k(!0)}function A(){x(a,0),x(n,[],!0),k(!1)}async function S(ee){if(i(h)===ee){x(h,null),x(v,null),x(w,null),x(b,null),x(f,[],!0);return}x(h,ee,!0),x(v,null),x(w,null),x(b,null),x(f,[],!0),x(m,!0);try{const ce=await fetch(`/api/ctx/${e.contextId}/commits/${ee}`);if(!ce.ok){const ue=await ce.json().catch(()=>null);throw new Error((ue==null?void 0:ue.error)??`Failed to load commit detail (${ce.status})`)}x(v,await ce.json(),!0)}catch(ce){x(w,ce instanceof Error?ce.message:"Failed to load commit detail",!0)}finally{x(m,!1)}}async function T(ee){if(i(b)===ee){x(b,null),x(f,[],!0),x(l,null);return}if(x(b,ee,!0),x(f,[],!0),x(l,null),i(h)===null)return;const ce=i(p).get(i(h));if(ce!==void 0){const ue=ce.find(B=>B.path===ee);x(f,(ue==null?void 0:ue.chunks)??[],!0);return}x(u,!0);try{const ue=await fetch(`/api/ctx/${e.contextId}/commits/${i(h)}/diff`);if(!ue.ok)throw new Error(`Failed to load diff (${ue.status})`);const B=await ue.json(),I=new Map(i(p));I.set(i(h),B.files),x(p,I,!0);const z=B.files.find(O=>O.path===ee);x(f,(z==null?void 0:z.chunks)??[],!0)}catch(ue){x(l,ue instanceof Error?ue.message:"Failed to load file diff",!0)}finally{x(u,!1)}}function D(ee){const ce=new Date(ee),B=new Date().getTime()-ce.getTime(),I=Math.floor(B/(1e3*60*60*24));if(I===0){const z=Math.floor(B/36e5);if(z===0){const O=Math.floor(B/6e4);return O<=1?"just now":`${O} min ago`}return z===1?"1 hour ago":`${z} hours ago`}if(I===1)return"yesterday";if(I<7)return`${I} days ago`;if(I<30){const z=Math.floor(I/7);return z===1?"1 week ago":`${z} weeks ago`}return ce.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function H(ee){return ee.split(`
379
+ `)[0]??ee}function W(ee){switch(ee){case"A":return"Added";case"M":return"Modified";case"D":return"Deleted";case"R":return"Renamed";case"C":return"Copied";default:return ee}}function M(ee){switch(ee){case"A":return"text-success-fg";case"D":return"text-danger-fg";case"M":return"text-attention-fg";case"R":return"text-accent-fg";case"C":return"text-accent-fg";default:return"text-text-secondary"}}gt(()=>{r()&&k(!1)});var G=iS(),X=E(G),le=E(X),me=E(le);{var xe=ee=>{var ce=Dw(),ue=Ye(ce),B=P(ue);{var I=z=>{var O=Lr("(more available)");L(z,O)};Y(B,z=>{i(o)&&z(I)})}de(()=>se(ue,`${i(n).length??""} commit${i(n).length!==1?"s":""} `)),L(ee,ce)};Y(me,ee=>{i(n).length>0&&ee(xe)})}var R=P(le,4);Iw(R,{get value(){return i(g)},onSearch:y,placeholder:"Search commits..."});var j=P(X,2),N=E(j);{var V=ee=>{var ce=Mw();L(ee,ce)},$=ee=>{var ce=_t(),ue=Ye(ce);{var B=z=>{var O=Ow();L(z,O)},I=z=>{var O=_t(),ne=Ye(O);{var ae=ge=>{var we=Bw(),Ie=E(we),Pe=E(Ie),Se=P(E(Pe),2),Be=P(E(Se),2),Ue=E(Be),je=P(Pe,2),ze=E(je);ze.__click=A,de(()=>se(Ue,i(_))),L(ge,we)},te=ge=>{var we=_t(),Ie=Ye(we);{var Pe=Be=>{var Ue=Nw(),je=P(E(Ue),2),ze=E(je),Ne=P(je,2),_e=E(Ne);{var Me=pe=>{var Ce=Lr("Try adjusting your search query.");L(pe,Ce)},oe=pe=>{var Ce=Lr("No commits found for this repository.");L(pe,Ce)};Y(_e,pe=>{i(g).trim().length>0?pe(Me):pe(oe,!1)})}de(pe=>se(ze,pe),[()=>i(g).trim().length>0?"No commits match your search":"No commits found"]),L(Be,Ue)},Se=Be=>{var Ue=rS(),je=Ye(Ue);Gt(je,19,()=>i(n),oe=>oe.hash,(oe,pe,Ce)=>{const He=ye(()=>i(h)===i(pe).hash);var $e=Zw(),nt=E($e);nt.__click=()=>void S(i(pe).hash);var Fe=E(nt),qe=P(Fe,2),at=E(qe),Ze=P(qe,2),Le=E(Ze),Ae=P(Ze,2),it=E(Ae),tt=P(Ae,2),vt=E(tt),ft=P(nt,2);{var ht=pt=>{var bt=Qw(),Tt=E(bt);{var et=kt=>{var Mt=jw();L(kt,Mt)},Ct=kt=>{var Mt=_t(),Pt=Ye(Mt);{var Rt=Ht=>{var Et=Hw(),fe=E(Et);de(()=>se(fe,i(w))),L(Ht,Et)},It=Ht=>{var Et=_t(),fe=Ye(Et);{var be=We=>{var Je=Yw(),ut=E(Je),Xe=E(ut),ie=E(Xe),ke=P(ut,2);{var De=he=>{var dt=Fw(),At=E(dt);de(yt=>se(At,`${i(v).message??""}${yt??""}`),[()=>i(v).body.trim().length>0?`
380
+
381
+ `+i(v).body:""]),L(he,dt)},J=he=>{var dt=Uw(),At=E(dt);de(()=>se(At,i(v).message)),L(he,dt)};Y(ke,he=>{i(v).body.trim().length>0?he(De):he(J,!1)})}var Z=P(ke,2),re=E(Z),F=E(re),Q=P(re,2),ve=E(Q),Te=P(Q,2),rt=E(Te),ct=P(Z,2);{var wt=he=>{var dt=Jw(),At=P(E(dt),2);Gt(At,21,()=>i(v).files,yt=>yt.path,(yt,st)=>{const ot=ye(()=>i(b)===i(st).path);var Lt=Xw(),rr=E(Lt);rr.__click=()=>void T(i(st).path);var gr=E(rr),ur=E(gr),Ot=P(gr,2),Ft=E(Ot),hr=P(Ot,2),qr=E(hr),xr=P(hr,2),Dr=E(xr);{var Jt=Bt=>{var Zt=Vw(),br=E(Zt);de(()=>se(br,`+${i(st).additions??""}`)),L(Bt,Zt)};Y(Dr,Bt=>{i(st).additions>0&&Bt(Jt)})}var Yt=P(Dr,2);{var sr=Bt=>{var Zt=zw(),br=E(Zt);de(()=>se(br,`-${i(st).deletions??""}`)),L(Bt,Zt)};Y(Yt,Bt=>{i(st).deletions>0&&Bt(sr)})}var ar=P(rr,2);{var Vt=Bt=>{var Zt=Kw(),br=E(Zt);{var kr=fr=>{var yr=Ww();L(fr,yr)},or=fr=>{var yr=_t(),wr=Ye(yr);{var Fr=$t=>{var Ke=qw(),lt=E(Ke);de(()=>se(lt,i(l))),L($t,Ke)},zt=$t=>{var Ke=_t(),lt=Ye(Ke);{var St=nr=>{var mr=Gw();L(nr,mr)},ir=nr=>{du(nr,{get chunks(){return i(f)}})};Y(lt,nr=>{i(f).length===0?nr(St):nr(ir,!1)},!0)}L($t,Ke)};Y(wr,$t=>{i(l)!==null?$t(Fr):$t(zt,!1)},!0)}L(fr,yr)};Y(br,fr=>{i(u)?fr(kr):fr(or,!1)})}L(Bt,Zt)};Y(ar,Bt=>{i(ot)&&Bt(Vt)})}de((Bt,Zt)=>{Ge(rr,"aria-expanded",i(ot)),se(ur,i(ot)?"v":">"),Ve(Ot,1,`font-medium ${Bt??""}`,"svelte-cti980"),se(Ft,Zt),se(qr,i(st).path)},[()=>M(i(st).status),()=>W(i(st).status)]),L(yt,Lt)}),L(he,dt)};Y(ct,he=>{i(v).files.length>0&&he(wt)})}de(()=>{se(ie,i(v).hash),se(F,`${i(v).stats.filesChanged??""} file${i(v).stats.filesChanged!==1?"s":""} changed`),se(ve,`+${i(v).stats.additions??""}`),se(rt,`-${i(v).stats.deletions??""}`)}),L(We,Je)};Y(fe,We=>{i(v)!==null&&We(be)},!0)}L(Ht,Et)};Y(Pt,Ht=>{i(w)!==null?Ht(Rt):Ht(It,!1)},!0)}L(kt,Mt)};Y(Tt,kt=>{i(m)?kt(et):kt(Ct,!1)})}L(pt,bt)};Y(ft,pt=>{i(He)&&pt(ht)})}de((pt,bt,Tt)=>{Ge(nt,"aria-expanded",i(He)),Ve(nt,1,`sticky top-0 z-10 w-full flex items-center gap-3 px-4 py-3 bg-bg-primary hover:bg-bg-secondary transition-colors text-left border shadow-sm ${i(Ce)===0?"":"mt-3"} ${i(He)?"rounded-t-lg border-accent-emphasis/40":"rounded-lg border-border-default"}`),Ve(Fe,0,`w-4 h-4 text-text-tertiary transition-transform ${i(He)?"rotate-90":""}`),se(at,pt),se(Le,bt),se(it,i(pe).author.name),se(vt,Tt)},[()=>i(pe).shortHash||i(pe).hash.slice(0,7),()=>H(i(pe).message),()=>D(i(pe).date)]),L(oe,$e)});var ze=P(je,2);{var Ne=oe=>{var pe=$w(),Ce=E(pe);de(()=>se(Ce,i(_))),L(oe,pe)};Y(ze,oe=>{i(_)!==null&&i(n).length>0&&oe(Ne)})}var _e=P(ze,2);{var Me=oe=>{var pe=tS(),Ce=E(pe);Ce.__click=C;var He=E(Ce);{var $e=Fe=>{var qe=eS();L(Fe,qe)},nt=Fe=>{var qe=Lr("Load More");L(Fe,qe)};Y(He,Fe=>{i(d)?Fe($e):Fe(nt,!1)})}de(()=>Ce.disabled=i(d)),L(oe,pe)};Y(_e,oe=>{i(o)&&oe(Me)})}L(Be,Ue)};Y(Ie,Be=>{i(n).length===0?Be(Pe):Be(Se,!1)},!0)}L(ge,we)};Y(ne,ge=>{i(_)!==null&&i(n).length===0?ge(ae):ge(te,!1)},!0)}L(z,O)};Y(ue,z=>{i(s)?z(B):z(I,!1)},!0)}L(ee,ce)};Y(N,ee=>{r()?ee($,!1):ee(V)})}L(t,G),Xt()}tr(["click"]);var ba={exports:{}},rd;function sS(){return rd||(rd=1,(function(t,e){(function(r,n){t.exports=n()})(globalThis,(()=>(()=>{var r={4567:function(_,o,a){var c=this&&this.__decorate||function(l,p,y,k){var C,A=arguments.length,S=A<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(l,p,y,k);else for(var T=l.length-1;T>=0;T--)(C=l[T])&&(S=(A<3?C(S):A>3?C(p,y,S):C(p,y))||S);return A>3&&S&&Object.defineProperty(p,y,S),S},g=this&&this.__param||function(l,p){return function(y,k){p(y,k,l)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const h=a(9042),v=a(9924),m=a(844),w=a(4725),b=a(2585),f=a(3656);let u=o.AccessibilityManager=class extends m.Disposable{constructor(l,p,y,k){super(),this._terminal=l,this._coreBrowserService=y,this._renderService=k,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let C=0;C<this._terminal.rows;C++)this._rowElements[C]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[C]);if(this._topBoundaryFocusListener=C=>this._handleBoundaryFocus(C,0),this._bottomBoundaryFocusListener=C=>this._handleBoundaryFocus(C,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new v.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((C=>this._handleResize(C.rows)))),this.register(this._terminal.onRender((C=>this._refreshRows(C.start,C.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((C=>this._handleChar(C)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
382
+ `)))),this.register(this._terminal.onA11yTab((C=>this._handleTab(C)))),this.register(this._terminal.onKey((C=>this._handleKey(C.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,f.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,m.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(l){for(let p=0;p<l;p++)this._handleChar(" ")}_handleChar(l){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==l&&(this._charsToAnnounce+=l):this._charsToAnnounce+=l,l===`
383
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(l){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(l)||this._charsToConsume.push(l)}_refreshRows(l,p){this._liveRegionDebouncer.refresh(l,p,this._terminal.rows)}_renderRows(l,p){const y=this._terminal.buffer,k=y.lines.length.toString();for(let C=l;C<=p;C++){const A=y.lines.get(y.ydisp+C),S=[],T=(A==null?void 0:A.translateToString(!0,void 0,void 0,S))||"",D=(y.ydisp+C+1).toString(),H=this._rowElements[C];H&&(T.length===0?(H.innerText=" ",this._rowColumns.set(H,[0,1])):(H.textContent=T,this._rowColumns.set(H,S)),H.setAttribute("aria-posinset",D),H.setAttribute("aria-setsize",k))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(l,p){const y=l.target,k=this._rowElements[p===0?1:this._rowElements.length-2];if(y.getAttribute("aria-posinset")===(p===0?"1":`${this._terminal.buffer.lines.length}`)||l.relatedTarget!==k)return;let C,A;if(p===0?(C=y,A=this._rowElements.pop(),this._rowContainer.removeChild(A)):(C=this._rowElements.shift(),A=y,this._rowContainer.removeChild(C)),C.removeEventListener("focus",this._topBoundaryFocusListener),A.removeEventListener("focus",this._bottomBoundaryFocusListener),p===0){const S=this._createAccessibilityTreeNode();this._rowElements.unshift(S),this._rowContainer.insertAdjacentElement("afterbegin",S)}else{const S=this._createAccessibilityTreeNode();this._rowElements.push(S),this._rowContainer.appendChild(S)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(p===0?-1:1),this._rowElements[p===0?1:this._rowElements.length-2].focus(),l.preventDefault(),l.stopImmediatePropagation()}_handleSelectionChange(){var T;if(this._rowElements.length===0)return;const l=document.getSelection();if(!l)return;if(l.isCollapsed)return void(this._rowContainer.contains(l.anchorNode)&&this._terminal.clearSelection());if(!l.anchorNode||!l.focusNode)return void console.error("anchorNode and/or focusNode are null");let p={node:l.anchorNode,offset:l.anchorOffset},y={node:l.focusNode,offset:l.focusOffset};if((p.node.compareDocumentPosition(y.node)&Node.DOCUMENT_POSITION_PRECEDING||p.node===y.node&&p.offset>y.offset)&&([p,y]=[y,p]),p.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(p={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(p.node))return;const k=this._rowElements.slice(-1)[0];if(y.node.compareDocumentPosition(k)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(y={node:k,offset:((T=k.textContent)==null?void 0:T.length)??0}),!this._rowContainer.contains(y.node))return;const C=({node:D,offset:H})=>{const W=D instanceof Text?D.parentNode:D;let M=parseInt(W==null?void 0:W.getAttribute("aria-posinset"),10)-1;if(isNaN(M))return console.warn("row is invalid. Race condition?"),null;const G=this._rowColumns.get(W);if(!G)return console.warn("columns is null. Race condition?"),null;let X=H<G.length?G[H]:G.slice(-1)[0]+1;return X>=this._terminal.cols&&(++M,X=0),{row:M,column:X}},A=C(p),S=C(y);if(A&&S){if(A.row>S.row||A.row===S.row&&A.column>=S.column)throw new Error("invalid range");this._terminal.select(A.column,A.row,(S.row-A.row)*this._terminal.cols-A.column+S.column)}}_handleResize(l){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let p=this._rowContainer.children.length;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);for(;this._rowElements.length>l;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const l=this._coreBrowserService.mainDocument.createElement("div");return l.setAttribute("role","listitem"),l.tabIndex=-1,this._refreshRowDimensions(l),l}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let l=0;l<this._terminal.rows;l++)this._refreshRowDimensions(this._rowElements[l])}}_refreshRowDimensions(l){l.style.height=`${this._renderService.dimensions.css.cell.height}px`}};o.AccessibilityManager=u=c([g(1,b.IInstantiationService),g(2,w.ICoreBrowserService),g(3,w.IRenderService)],u)},3614:(_,o)=>{function a(v){return v.replace(/\r?\n/g,"\r")}function c(v,m){return m?"\x1B[200~"+v+"\x1B[201~":v}function g(v,m,w,b){v=c(v=a(v),w.decPrivateModes.bracketedPasteMode&&b.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(v,!0),m.value=""}function h(v,m,w){const b=w.getBoundingClientRect(),f=v.clientX-b.left-10,u=v.clientY-b.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${f}px`,m.style.top=`${u}px`,m.style.zIndex="1000",m.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=a,o.bracketTextForPaste=c,o.copyHandler=function(v,m){v.clipboardData&&v.clipboardData.setData("text/plain",m.selectionText),v.preventDefault()},o.handlePasteEvent=function(v,m,w,b){v.stopPropagation(),v.clipboardData&&g(v.clipboardData.getData("text/plain"),m,w,b)},o.paste=g,o.moveTextAreaUnderMouseCursor=h,o.rightClickHandler=function(v,m,w,b,f){h(v,m,w),f&&b.rightClickSelect(v),m.value=b.selectionText,m.select()}},7239:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const c=a(1505);o.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(g,h,v){this._css.set(g,h,v)}getCss(g,h){return this._css.get(g,h)}setColor(g,h,v){this._color.set(g,h,v)}getColor(g,h){return this._color.get(g,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(a,c,g,h){a.addEventListener(c,g,h);let v=!1;return{dispose:()=>{v||(v=!0,a.removeEventListener(c,g,h))}}}},3551:function(_,o,a){var c=this&&this.__decorate||function(u,l,p,y){var k,C=arguments.length,A=C<3?l:y===null?y=Object.getOwnPropertyDescriptor(l,p):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,l,p,y);else for(var S=u.length-1;S>=0;S--)(k=u[S])&&(A=(C<3?k(A):C>3?k(l,p,A):k(l,p))||A);return C>3&&A&&Object.defineProperty(l,p,A),A},g=this&&this.__param||function(u,l){return function(p,y){l(p,y,u)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const h=a(3656),v=a(8460),m=a(844),w=a(2585),b=a(4725);let f=o.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(u,l,p,y,k){super(),this._element=u,this._mouseService=l,this._renderService=p,this._bufferService=y,this._linkProviderService=k,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new v.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new v.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,m.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,m.toDisposable)((()=>{var C;this._lastMouseEvent=void 0,(C=this._activeProviderReplies)==null||C.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(u){this._lastMouseEvent=u;const l=this._positionFromMouseEvent(u,this._element,this._mouseService);if(!l)return;this._isMouseOut=!1;const p=u.composedPath();for(let y=0;y<p.length;y++){const k=p[y];if(k.classList.contains("xterm"))break;if(k.classList.contains("xterm-hover"))return}this._lastBufferCell&&l.x===this._lastBufferCell.x&&l.y===this._lastBufferCell.y||(this._handleHover(l),this._lastBufferCell=l)}_handleHover(u){if(this._activeLine!==u.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(u,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,u)||(this._clearCurrentLink(),this._askForLink(u,!0))}_askForLink(u,l){var y,k;this._activeProviderReplies&&l||((y=this._activeProviderReplies)==null||y.forEach((C=>{C==null||C.forEach((A=>{A.link.dispose&&A.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=u.y);let p=!1;for(const[C,A]of this._linkProviderService.linkProviders.entries())l?(k=this._activeProviderReplies)!=null&&k.get(C)&&(p=this._checkLinkProviderResult(C,u,p)):A.provideLinks(u.y,(S=>{var D,H;if(this._isMouseOut)return;const T=S==null?void 0:S.map((W=>({link:W})));(D=this._activeProviderReplies)==null||D.set(C,T),p=this._checkLinkProviderResult(C,u,p),((H=this._activeProviderReplies)==null?void 0:H.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(u.y,this._activeProviderReplies)}))}_removeIntersectingLinks(u,l){const p=new Set;for(let y=0;y<l.size;y++){const k=l.get(y);if(k)for(let C=0;C<k.length;C++){const A=k[C],S=A.link.range.start.y<u?0:A.link.range.start.x,T=A.link.range.end.y>u?this._bufferService.cols:A.link.range.end.x;for(let D=S;D<=T;D++){if(p.has(D)){k.splice(C--,1);break}p.add(D)}}}}_checkLinkProviderResult(u,l,p){var C;if(!this._activeProviderReplies)return p;const y=this._activeProviderReplies.get(u);let k=!1;for(let A=0;A<u;A++)this._activeProviderReplies.has(A)&&!this._activeProviderReplies.get(A)||(k=!0);if(!k&&y){const A=y.find((S=>this._linkAtPosition(S.link,l)));A&&(p=!0,this._handleNewLink(A))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!p)for(let A=0;A<this._activeProviderReplies.size;A++){const S=(C=this._activeProviderReplies.get(A))==null?void 0:C.find((T=>this._linkAtPosition(T.link,l)));if(S){p=!0,this._handleNewLink(S);break}}return p}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(u){if(!this._currentLink)return;const l=this._positionFromMouseEvent(u,this._element,this._mouseService);l&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,l)&&this._currentLink.link.activate(u,this._currentLink.link.text)}_clearCurrentLink(u,l){this._currentLink&&this._lastMouseEvent&&(!u||!l||this._currentLink.link.range.start.y>=u&&this._currentLink.link.range.end.y<=l)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,m.disposeArray)(this._linkCacheDisposables))}_handleNewLink(u){if(!this._lastMouseEvent)return;const l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._linkAtPosition(u.link,l)&&(this._currentLink=u,this._currentLink.state={decorations:{underline:u.link.decorations===void 0||u.link.decorations.underline,pointerCursor:u.link.decorations===void 0||u.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,u.link,this._lastMouseEvent),u.link.decorations={},Object.defineProperties(u.link.decorations,{pointerCursor:{get:()=>{var p,y;return(y=(p=this._currentLink)==null?void 0:p.state)==null?void 0:y.decorations.pointerCursor},set:p=>{var y;(y=this._currentLink)!=null&&y.state&&this._currentLink.state.decorations.pointerCursor!==p&&(this._currentLink.state.decorations.pointerCursor=p,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",p))}},underline:{get:()=>{var p,y;return(y=(p=this._currentLink)==null?void 0:p.state)==null?void 0:y.decorations.underline},set:p=>{var y,k,C;(y=this._currentLink)!=null&&y.state&&((C=(k=this._currentLink)==null?void 0:k.state)==null?void 0:C.decorations.underline)!==p&&(this._currentLink.state.decorations.underline=p,this._currentLink.state.isHovered&&this._fireUnderlineEvent(u.link,p))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((p=>{if(!this._currentLink)return;const y=p.start===0?0:p.start+1+this._bufferService.buffer.ydisp,k=this._bufferService.buffer.ydisp+1+p.end;if(this._currentLink.link.range.start.y>=y&&this._currentLink.link.range.end.y<=k&&(this._clearCurrentLink(y,k),this._lastMouseEvent)){const C=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);C&&this._askForLink(C,!1)}}))))}_linkHover(u,l,p){var y;(y=this._currentLink)!=null&&y.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!0),this._currentLink.state.decorations.pointerCursor&&u.classList.add("xterm-cursor-pointer")),l.hover&&l.hover(p,l.text)}_fireUnderlineEvent(u,l){const p=u.range,y=this._bufferService.buffer.ydisp,k=this._createLinkUnderlineEvent(p.start.x-1,p.start.y-y-1,p.end.x,p.end.y-y-1,void 0);(l?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(k)}_linkLeave(u,l,p){var y;(y=this._currentLink)!=null&&y.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!1),this._currentLink.state.decorations.pointerCursor&&u.classList.remove("xterm-cursor-pointer")),l.leave&&l.leave(p,l.text)}_linkAtPosition(u,l){const p=u.range.start.y*this._bufferService.cols+u.range.start.x,y=u.range.end.y*this._bufferService.cols+u.range.end.x,k=l.y*this._bufferService.cols+l.x;return p<=k&&k<=y}_positionFromMouseEvent(u,l,p){const y=p.getCoords(u,l,this._bufferService.cols,this._bufferService.rows);if(y)return{x:y[0],y:y[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(u,l,p,y,k){return{x1:u,y1:l,x2:p,y2:y,cols:this._bufferService.cols,fg:k}}};o.Linkifier=f=c([g(1,b.IMouseService),g(2,b.IRenderService),g(3,w.IBufferService),g(4,b.ILinkProviderService)],f)},9042:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(_,o,a){var c=this&&this.__decorate||function(b,f,u,l){var p,y=arguments.length,k=y<3?f:l===null?l=Object.getOwnPropertyDescriptor(f,u):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(b,f,u,l);else for(var C=b.length-1;C>=0;C--)(p=b[C])&&(k=(y<3?p(k):y>3?p(f,u,k):p(f,u))||k);return y>3&&k&&Object.defineProperty(f,u,k),k},g=this&&this.__param||function(b,f){return function(u,l){f(u,l,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const h=a(511),v=a(2585);let m=o.OscLinkProvider=class{constructor(b,f,u){this._bufferService=b,this._optionsService=f,this._oscLinkService=u}provideLinks(b,f){var T;const u=this._bufferService.buffer.lines.get(b-1);if(!u)return void f(void 0);const l=[],p=this._optionsService.rawOptions.linkHandler,y=new h.CellData,k=u.getTrimmedLength();let C=-1,A=-1,S=!1;for(let D=0;D<k;D++)if(A!==-1||u.hasContent(D)){if(u.loadCell(D,y),y.hasExtendedAttrs()&&y.extended.urlId){if(A===-1){A=D,C=y.extended.urlId;continue}S=y.extended.urlId!==C}else A!==-1&&(S=!0);if(S||A!==-1&&D===k-1){const H=(T=this._oscLinkService.getLinkData(C))==null?void 0:T.uri;if(H){const W={start:{x:A+1,y:b},end:{x:D+(S||D!==k-1?0:1),y:b}};let M=!1;if(!(p!=null&&p.allowNonHttpProtocols))try{const G=new URL(H);["http:","https:"].includes(G.protocol)||(M=!0)}catch{M=!0}M||l.push({text:H,range:W,activate:(G,X)=>p?p.activate(G,X,W):w(0,X),hover:(G,X)=>{var le;return(le=p==null?void 0:p.hover)==null?void 0:le.call(p,G,X,W)},leave:(G,X)=>{var le;return(le=p==null?void 0:p.leave)==null?void 0:le.call(p,G,X,W)}})}S=!1,y.hasExtendedAttrs()&&y.extended.urlId?(A=D,C=y.extended.urlId):(A=-1,C=-1)}}f(l)}};function w(b,f){if(confirm(`Do you want to navigate to ${f}?
384
+
385
+ WARNING: This link could potentially be dangerous`)){const u=window.open();if(u){try{u.opener=null}catch{}u.location.href=f}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=m=c([g(0,v.IBufferService),g(1,v.IOptionsService),g(2,v.IOscLinkService)],m)},6193:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(a,c){this._renderCallback=a,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(a,c,g){this._rowCount=g,a=a!==void 0?a:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const c=a(3614),g=a(3656),h=a(3551),v=a(9042),m=a(3730),w=a(1680),b=a(3107),f=a(5744),u=a(2950),l=a(1296),p=a(428),y=a(4269),k=a(5114),C=a(8934),A=a(3230),S=a(9312),T=a(4725),D=a(6731),H=a(8055),W=a(8969),M=a(8460),G=a(844),X=a(6114),le=a(8437),me=a(2584),xe=a(7399),R=a(5941),j=a(9074),N=a(2585),V=a(5435),$=a(4567),ee=a(779);class ce extends W.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(B={}){super(B),this.browser=X,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new G.MutableDisposable),this._onCursorMove=this.register(new M.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new M.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new M.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new M.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new M.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new M.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new M.EventEmitter),this._onBlur=this.register(new M.EventEmitter),this._onA11yCharEmitter=this.register(new M.EventEmitter),this._onA11yTabEmitter=this.register(new M.EventEmitter),this._onWillOpen=this.register(new M.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(j.DecorationService),this._instantiationService.setService(N.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ee.LinkProviderService),this._instantiationService.setService(T.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(m.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((I,z)=>this.refresh(I,z)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((I=>this._reportWindowsOptions(I)))),this.register(this._inputHandler.onColor((I=>this._handleColorEvent(I)))),this.register((0,M.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,M.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,M.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,M.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((I=>this._afterResize(I.cols,I.rows)))),this.register((0,G.toDisposable)((()=>{var I,z;this._customKeyEventHandler=void 0,(z=(I=this.element)==null?void 0:I.parentNode)==null||z.removeChild(this.element)})))}_handleColorEvent(B){if(this._themeService)for(const I of B){let z,O="";switch(I.index){case 256:z="foreground",O="10";break;case 257:z="background",O="11";break;case 258:z="cursor",O="12";break;default:z="ansi",O="4;"+I.index}switch(I.type){case 0:const ne=H.color.toColorRGB(z==="ansi"?this._themeService.colors.ansi[I.index]:this._themeService.colors[z]);this.coreService.triggerDataEvent(`${me.C0.ESC}]${O};${(0,R.toRgbString)(ne)}${me.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors((ae=>ae.ansi[I.index]=H.channels.toColor(...I.color)));else{const ae=z;this._themeService.modifyColors((te=>te[ae]=H.channels.toColor(...I.color)))}break;case 2:this._themeService.restoreColor(I.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(B){B?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(B){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(me.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var B;return(B=this.textarea)==null?void 0:B.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(me.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const B=this.buffer.ybase+this.buffer.y,I=this.buffer.lines.get(B);if(!I)return;const z=Math.min(this.buffer.x,this.cols-1),O=this._renderService.dimensions.css.cell.height,ne=I.getWidth(z),ae=this._renderService.dimensions.css.cell.width*ne,te=this.buffer.y*this._renderService.dimensions.css.cell.height,ge=z*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ge+"px",this.textarea.style.top=te+"px",this.textarea.style.width=ae+"px",this.textarea.style.height=O+"px",this.textarea.style.lineHeight=O+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(I=>{this.hasSelection()&&(0,c.copyHandler)(I,this._selectionService)})));const B=I=>(0,c.handlePasteEvent)(I,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",B)),this.register((0,g.addDisposableDomListener)(this.element,"paste",B)),X.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(I=>{I.button===2&&(0,c.rightClickHandler)(I,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(I=>{(0,c.rightClickHandler)(I,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),X.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(I=>{I.button===1&&(0,c.moveTextAreaUnderMouseCursor)(I,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(B=>this._keyUp(B)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(B=>this._keyDown(B)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(B=>this._keyPress(B)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(B=>this._compositionHelper.compositionupdate(B)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(B=>this._inputEvent(B)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(B){var z;if(!B)throw new Error("Terminal requires a parent element.");if(B.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((z=this.element)==null?void 0:z.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=B.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),B.appendChild(this.element);const I=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),I.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,g.addDisposableDomListener)(this.screenElement,"mousemove",(O=>this.updateCursorStyle(O)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),I.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",v.promptLabel),X.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(k.CoreBrowserService,this.textarea,B.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(T.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(O=>this._handleTextAreaFocus(O)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(T.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(D.ThemeService),this._instantiationService.setService(T.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(y.CharacterJoinerService),this._instantiationService.setService(T.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(A.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(T.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((O=>this._onRender.fire(O)))),this.onResize((O=>this._renderService.resize(O.cols,O.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(u.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(C.MouseService),this._instantiationService.setService(T.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(I);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((O=>this.scrollLines(O.amount,O.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(S.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(T.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((O=>this.scrollLines(O.amount,O.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((O=>this._renderService.handleSelectionChanged(O.start,O.end,O.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((O=>{this.textarea.value=O,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((O=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(b.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(O=>this._selectionService.handleMouseDown(O)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(O=>this._handleScreenReaderModeOptionChange(O)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(f.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(O=>{!this._overviewRulerRenderer&&O&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(f.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const B=this,I=this.element;function z(ae){const te=B._mouseService.getMouseReportCoords(ae,B.screenElement);if(!te)return!1;let ge,we;switch(ae.overrideType||ae.type){case"mousemove":we=32,ae.buttons===void 0?(ge=3,ae.button!==void 0&&(ge=ae.button<3?ae.button:3)):ge=1&ae.buttons?0:4&ae.buttons?1:2&ae.buttons?2:3;break;case"mouseup":we=0,ge=ae.button<3?ae.button:3;break;case"mousedown":we=1,ge=ae.button<3?ae.button:3;break;case"wheel":if(B._customWheelEventHandler&&B._customWheelEventHandler(ae)===!1||B.viewport.getLinesScrolled(ae)===0)return!1;we=ae.deltaY<0?0:1,ge=4;break;default:return!1}return!(we===void 0||ge===void 0||ge>4)&&B.coreMouseService.triggerMouseEvent({col:te.col,row:te.row,x:te.x,y:te.y,button:ge,action:we,ctrl:ae.ctrlKey,alt:ae.altKey,shift:ae.shiftKey})}const O={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ne={mouseup:ae=>(z(ae),ae.buttons||(this._document.removeEventListener("mouseup",O.mouseup),O.mousedrag&&this._document.removeEventListener("mousemove",O.mousedrag)),this.cancel(ae)),wheel:ae=>(z(ae),this.cancel(ae,!0)),mousedrag:ae=>{ae.buttons&&z(ae)},mousemove:ae=>{ae.buttons||z(ae)}};this.register(this.coreMouseService.onProtocolChange((ae=>{ae?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ae)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&ae?O.mousemove||(I.addEventListener("mousemove",ne.mousemove),O.mousemove=ne.mousemove):(I.removeEventListener("mousemove",O.mousemove),O.mousemove=null),16&ae?O.wheel||(I.addEventListener("wheel",ne.wheel,{passive:!1}),O.wheel=ne.wheel):(I.removeEventListener("wheel",O.wheel),O.wheel=null),2&ae?O.mouseup||(O.mouseup=ne.mouseup):(this._document.removeEventListener("mouseup",O.mouseup),O.mouseup=null),4&ae?O.mousedrag||(O.mousedrag=ne.mousedrag):(this._document.removeEventListener("mousemove",O.mousedrag),O.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(I,"mousedown",(ae=>{if(ae.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ae))return z(ae),O.mouseup&&this._document.addEventListener("mouseup",O.mouseup),O.mousedrag&&this._document.addEventListener("mousemove",O.mousedrag),this.cancel(ae)}))),this.register((0,g.addDisposableDomListener)(I,"wheel",(ae=>{if(!O.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ae)===!1)return!1;if(!this.buffer.hasScrollback){const te=this.viewport.getLinesScrolled(ae);if(te===0)return;const ge=me.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ae.deltaY<0?"A":"B");let we="";for(let Ie=0;Ie<Math.abs(te);Ie++)we+=ge;return this.coreService.triggerDataEvent(we,!0),this.cancel(ae,!0)}return this.viewport.handleWheel(ae)?this.cancel(ae):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(I,"touchstart",(ae=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ae),this.cancel(ae)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(I,"touchmove",(ae=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ae)?void 0:this.cancel(ae)}),{passive:!1}))}refresh(B,I){var z;(z=this._renderService)==null||z.refreshRows(B,I)}updateCursorStyle(B){var I;(I=this._selectionService)!=null&&I.shouldColumnSelect(B)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(B,I,z=0){var O;z===1?(super.scrollLines(B,I,z),this.refresh(0,this.rows-1)):(O=this.viewport)==null||O.scrollLines(B)}paste(B){(0,c.paste)(B,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(B){this._customKeyEventHandler=B}attachCustomWheelEventHandler(B){this._customWheelEventHandler=B}registerLinkProvider(B){return this._linkProviderService.registerLinkProvider(B)}registerCharacterJoiner(B){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const I=this._characterJoinerService.register(B);return this.refresh(0,this.rows-1),I}deregisterCharacterJoiner(B){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(B)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(B){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+B)}registerDecoration(B){return this._decorationService.registerDecoration(B)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(B,I,z){this._selectionService.setSelection(B,I,z)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var B;(B=this._selectionService)==null||B.clearSelection()}selectAll(){var B;(B=this._selectionService)==null||B.selectAll()}selectLines(B,I){var z;(z=this._selectionService)==null||z.selectLines(B,I)}_keyDown(B){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1)return!1;const I=this.browser.isMac&&this.options.macOptionIsMeta&&B.altKey;if(!I&&!this._compositionHelper.keydown(B))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;I||B.key!=="Dead"&&B.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const z=(0,xe.evaluateKeyboardEvent)(B,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(B),z.type===3||z.type===2){const O=this.rows-1;return this.scrollLines(z.type===2?-O:O),this.cancel(B,!0)}return z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,B)||(z.cancel&&this.cancel(B,!0),!z.key||!!(B.key&&!B.ctrlKey&&!B.altKey&&!B.metaKey&&B.key.length===1&&B.key.charCodeAt(0)>=65&&B.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(z.key!==me.C0.ETX&&z.key!==me.C0.CR||(this.textarea.value=""),this._onKey.fire({key:z.key,domEvent:B}),this._showCursor(),this.coreService.triggerDataEvent(z.key,!0),!this.optionsService.rawOptions.screenReaderMode||B.altKey||B.ctrlKey?this.cancel(B,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(B,I){const z=B.isMac&&!this.options.macOptionIsMeta&&I.altKey&&!I.ctrlKey&&!I.metaKey||B.isWindows&&I.altKey&&I.ctrlKey&&!I.metaKey||B.isWindows&&I.getModifierState("AltGraph");return I.type==="keypress"?z:z&&(!I.keyCode||I.keyCode>47)}_keyUp(B){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1||((function(I){return I.keyCode===16||I.keyCode===17||I.keyCode===18})(B)||this.focus(),this.updateCursorStyle(B),this._keyPressHandled=!1)}_keyPress(B){let I;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1)return!1;if(this.cancel(B),B.charCode)I=B.charCode;else if(B.which===null||B.which===void 0)I=B.keyCode;else{if(B.which===0||B.charCode===0)return!1;I=B.which}return!(!I||(B.altKey||B.ctrlKey||B.metaKey)&&!this._isThirdLevelShift(this.browser,B)||(I=String.fromCharCode(I),this._onKey.fire({key:I,domEvent:B}),this._showCursor(),this.coreService.triggerDataEvent(I,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(B){if(B.data&&B.inputType==="insertText"&&(!B.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const I=B.data;return this.coreService.triggerDataEvent(I,!0),this.cancel(B),!0}return!1}resize(B,I){B!==this.cols||I!==this.rows?super.resize(B,I):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(B,I){var z,O;(z=this._charSizeService)==null||z.measure(),(O=this.viewport)==null||O.syncScrollArea(!0)}clear(){var B;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let I=1;I<this.rows;I++)this.buffer.lines.push(this.buffer.getBlankLine(le.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(B=this.viewport)==null||B.reset(),this.refresh(0,this.rows-1)}}reset(){var I,z;this.options.rows=this.rows,this.options.cols=this.cols;const B=this._customKeyEventHandler;this._setup(),super.reset(),(I=this._selectionService)==null||I.reset(),this._decorationService.reset(),(z=this.viewport)==null||z.reset(),this._customKeyEventHandler=B,this.refresh(0,this.rows-1)}clearTextureAtlas(){var B;(B=this._renderService)==null||B.clearTextureAtlas()}_reportFocus(){var B;(B=this.element)!=null&&B.classList.contains("focus")?this.coreService.triggerDataEvent(me.C0.ESC+"[I"):this.coreService.triggerDataEvent(me.C0.ESC+"[O")}_reportWindowsOptions(B){if(this._renderService)switch(B){case V.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const I=this._renderService.dimensions.css.canvas.width.toFixed(0),z=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${me.C0.ESC}[4;${z};${I}t`);break;case V.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const O=this._renderService.dimensions.css.cell.width.toFixed(0),ne=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${me.C0.ESC}[6;${ne};${O}t`)}}cancel(B,I){if(this.options.cancelEvents||I)return B.preventDefault(),B.stopPropagation(),!1}}o.Terminal=ce},9924:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(a,c=1e3){this._renderCallback=a,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,c,g){this._rowCount=g,a=a!==void 0?a:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const v=h-this._lastRefreshMs,m=this._debounceThresholdMS-v;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),m)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,c)}}},1680:function(_,o,a){var c=this&&this.__decorate||function(u,l,p,y){var k,C=arguments.length,A=C<3?l:y===null?y=Object.getOwnPropertyDescriptor(l,p):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,l,p,y);else for(var S=u.length-1;S>=0;S--)(k=u[S])&&(A=(C<3?k(A):C>3?k(l,p,A):k(l,p))||A);return C>3&&A&&Object.defineProperty(l,p,A),A},g=this&&this.__param||function(u,l){return function(p,y){l(p,y,u)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const h=a(3656),v=a(4725),m=a(8460),w=a(844),b=a(2585);let f=o.Viewport=class extends w.Disposable{constructor(u,l,p,y,k,C,A,S){super(),this._viewportElement=u,this._scrollArea=l,this._bufferService=p,this._optionsService=y,this._charSizeService=k,this._renderService=C,this._coreBrowserService=A,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((T=>this._activeBuffer=T.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((T=>this._renderDimensions=T))),this._handleThemeChange(S.colors),this.register(S.onChangeColors((T=>this._handleThemeChange(T)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(u){this._viewportElement.style.backgroundColor=u.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(u){if(u)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const u=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==u&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=u),this._refreshAnimationFrame=null}syncScrollArea(u=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(u);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(u)}_handleScroll(u){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const l=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:l,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const u=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(u*(this._smoothScrollState.target-this._smoothScrollState.origin)),u<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(u,l){const p=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(l<0&&this._viewportElement.scrollTop!==0||l>0&&p<this._lastRecordedBufferHeight)||(u.cancelable&&u.preventDefault(),!1)}handleWheel(u){const l=this._getPixelsScrolled(u);return l!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+l:this._smoothScrollState.target+=l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=l,this._bubbleScroll(u,l))}scrollLines(u){if(u!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const l=u*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:u,suppressScrollEvent:!1})}_getPixelsScrolled(u){if(u.deltaY===0||u.shiftKey)return 0;let l=this._applyScrollModifier(u.deltaY,u);return u.deltaMode===WheelEvent.DOM_DELTA_LINE?l*=this._currentRowHeight:u.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._currentRowHeight*this._bufferService.rows),l}getBufferElements(u,l){var S;let p,y="";const k=[],C=l??this._bufferService.buffer.lines.length,A=this._bufferService.buffer.lines;for(let T=u;T<C;T++){const D=A.get(T);if(!D)continue;const H=(S=A.get(T+1))==null?void 0:S.isWrapped;if(y+=D.translateToString(!H),!H||T===A.length-1){const W=document.createElement("div");W.textContent=y,k.push(W),y.length>0&&(p=W),y=""}}return{bufferElements:k,cursorElement:p}}getLinesScrolled(u){if(u.deltaY===0||u.shiftKey)return 0;let l=this._applyScrollModifier(u.deltaY,u);return u.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=this._currentRowHeight+0,this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):u.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(u,l){const p=this._optionsService.rawOptions.fastScrollModifier;return p==="alt"&&l.altKey||p==="ctrl"&&l.ctrlKey||p==="shift"&&l.shiftKey?u*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:u*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(u){this._lastTouchY=u.touches[0].pageY}handleTouchMove(u){const l=this._lastTouchY-u.touches[0].pageY;return this._lastTouchY=u.touches[0].pageY,l!==0&&(this._viewportElement.scrollTop+=l,this._bubbleScroll(u,l))}};o.Viewport=f=c([g(2,b.IBufferService),g(3,b.IOptionsService),g(4,v.ICharSizeService),g(5,v.IRenderService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],f)},3107:function(_,o,a){var c=this&&this.__decorate||function(b,f,u,l){var p,y=arguments.length,k=y<3?f:l===null?l=Object.getOwnPropertyDescriptor(f,u):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(b,f,u,l);else for(var C=b.length-1;C>=0;C--)(p=b[C])&&(k=(y<3?p(k):y>3?p(f,u,k):p(f,u))||k);return y>3&&k&&Object.defineProperty(f,u,k),k},g=this&&this.__param||function(b,f){return function(u,l){f(u,l,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const h=a(4725),v=a(844),m=a(2585);let w=o.BufferDecorationRenderer=class extends v.Disposable{constructor(b,f,u,l,p){super(),this._screenElement=b,this._bufferService=f,this._coreBrowserService=u,this._decorationService=l,this._renderService=p,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((y=>this._removeDecoration(y)))),this.register((0,v.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const b of this._decorationService.decorations)this._renderDecoration(b);this._dimensionsChanged=!1}_renderDecoration(b){this._refreshStyle(b),this._dimensionsChanged&&this._refreshXPosition(b)}_createElement(b){var l;const f=this._coreBrowserService.mainDocument.createElement("div");f.classList.add("xterm-decoration"),f.classList.toggle("xterm-decoration-top-layer",((l=b==null?void 0:b.options)==null?void 0:l.layer)==="top"),f.style.width=`${Math.round((b.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,f.style.height=(b.options.height||1)*this._renderService.dimensions.css.cell.height+"px",f.style.top=(b.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",f.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const u=b.options.x??0;return u&&u>this._bufferService.cols&&(f.style.display="none"),this._refreshXPosition(b,f),f}_refreshStyle(b){const f=b.marker.line-this._bufferService.buffers.active.ydisp;if(f<0||f>=this._bufferService.rows)b.element&&(b.element.style.display="none",b.onRenderEmitter.fire(b.element));else{let u=this._decorationElements.get(b);u||(u=this._createElement(b),b.element=u,this._decorationElements.set(b,u),this._container.appendChild(u),b.onDispose((()=>{this._decorationElements.delete(b),u.remove()}))),u.style.top=f*this._renderService.dimensions.css.cell.height+"px",u.style.display=this._altBufferIsActive?"none":"block",b.onRenderEmitter.fire(u)}}_refreshXPosition(b,f=b.element){if(!f)return;const u=b.options.x??0;(b.options.anchor||"left")==="right"?f.style.right=u?u*this._renderService.dimensions.css.cell.width+"px":"":f.style.left=u?u*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(b){var f;(f=this._decorationElements.get(b))==null||f.remove(),this._decorationElements.delete(b),b.dispose()}};o.BufferDecorationRenderer=w=c([g(1,m.IBufferService),g(2,h.ICoreBrowserService),g(3,m.IDecorationService),g(4,h.IRenderService)],w)},5871:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(a){if(a.options.overviewRulerOptions){for(const c of this._zones)if(c.color===a.options.overviewRulerOptions.color&&c.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,a.marker.line))return;if(this._lineAdjacentToZone(c,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(c,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,c){return c>=a.startBufferLine&&c<=a.endBufferLine}_lineAdjacentToZone(a,c,g){return c>=a.startBufferLine-this._linePadding[g||"full"]&&c<=a.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(a,c){a.startBufferLine=Math.min(a.startBufferLine,c),a.endBufferLine=Math.max(a.endBufferLine,c)}}},5744:function(_,o,a){var c=this&&this.__decorate||function(p,y,k,C){var A,S=arguments.length,T=S<3?y:C===null?C=Object.getOwnPropertyDescriptor(y,k):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(p,y,k,C);else for(var D=p.length-1;D>=0;D--)(A=p[D])&&(T=(S<3?A(T):S>3?A(y,k,T):A(y,k))||T);return S>3&&T&&Object.defineProperty(y,k,T),T},g=this&&this.__param||function(p,y){return function(k,C){y(k,C,p)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const h=a(5871),v=a(4725),m=a(844),w=a(2585),b={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0};let l=o.OverviewRulerRenderer=class extends m.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(p,y,k,C,A,S,T){var H;super(),this._viewportElement=p,this._screenElement=y,this._bufferService=k,this._decorationService=C,this._renderService=A,this._optionsService=S,this._coreBrowserService=T,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(H=this._viewportElement.parentElement)==null||H.insertBefore(this._canvas,this._viewportElement);const D=this._canvas.getContext("2d");if(!D)throw new Error("Ctx cannot be null");this._ctx=D,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,m.toDisposable)((()=>{var W;(W=this._canvas)==null||W.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const p=Math.floor(this._canvas.width/3),y=Math.ceil(this._canvas.width/3);f.full=this._canvas.width,f.left=p,f.center=y,f.right=p,this._refreshDrawHeightConstants(),u.full=0,u.left=0,u.center=f.left,u.right=f.left+f.center}_refreshDrawHeightConstants(){b.full=Math.round(2*this._coreBrowserService.dpr);const p=this._canvas.height/this._bufferService.buffer.lines.length,y=Math.round(Math.max(Math.min(p,12),6)*this._coreBrowserService.dpr);b.left=y,b.center=y,b.right=y}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const y of this._decorationService.decorations)this._colorZoneStore.addDecoration(y);this._ctx.lineWidth=1;const p=this._colorZoneStore.zones;for(const y of p)y.position!=="full"&&this._renderColorZone(y);for(const y of p)y.position==="full"&&this._renderColorZone(y);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(p){this._ctx.fillStyle=p.color,this._ctx.fillRect(u[p.position||"full"],Math.round((this._canvas.height-1)*(p.startBufferLine/this._bufferService.buffers.active.lines.length)-b[p.position||"full"]/2),f[p.position||"full"],Math.round((this._canvas.height-1)*((p.endBufferLine-p.startBufferLine)/this._bufferService.buffers.active.lines.length)+b[p.position||"full"]))}_queueRefresh(p,y){this._shouldUpdateDimensions=p||this._shouldUpdateDimensions,this._shouldUpdateAnchor=y||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=l=c([g(2,w.IBufferService),g(3,w.IDecorationService),g(4,v.IRenderService),g(5,w.IOptionsService),g(6,v.ICoreBrowserService)],l)},2950:function(_,o,a){var c=this&&this.__decorate||function(b,f,u,l){var p,y=arguments.length,k=y<3?f:l===null?l=Object.getOwnPropertyDescriptor(f,u):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(b,f,u,l);else for(var C=b.length-1;C>=0;C--)(p=b[C])&&(k=(y<3?p(k):y>3?p(f,u,k):p(f,u))||k);return y>3&&k&&Object.defineProperty(f,u,k),k},g=this&&this.__param||function(b,f){return function(u,l){f(u,l,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const h=a(4725),v=a(2585),m=a(2584);let w=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(b,f,u,l,p,y){this._textarea=b,this._compositionView=f,this._bufferService=u,this._optionsService=l,this._coreService=p,this._renderService=y,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(b){this._compositionView.textContent=b.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(b){if(this._isComposing||this._isSendingComposition){if(b.keyCode===229||b.keyCode===16||b.keyCode===17||b.keyCode===18)return!1;this._finalizeComposition(!1)}return b.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(b){if(this._compositionView.classList.remove("active"),this._isComposing=!1,b){const f={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let u;this._isSendingComposition=!1,f.start+=this._dataAlreadySent.length,u=this._isComposing?this._textarea.value.substring(f.start,f.end):this._textarea.value.substring(f.start),u.length>0&&this._coreService.triggerDataEvent(u,!0)}}),0)}else{this._isSendingComposition=!1;const f=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(f,!0)}}_handleAnyTextareaChanges(){const b=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const f=this._textarea.value,u=f.replace(b,"");this._dataAlreadySent=u,f.length>b.length?this._coreService.triggerDataEvent(u,!0):f.length<b.length?this._coreService.triggerDataEvent(`${m.C0.DEL}`,!0):f.length===b.length&&f!==b&&this._coreService.triggerDataEvent(f,!0)}}),0)}updateCompositionElements(b){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const f=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),u=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,p=f*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=p+"px",this._compositionView.style.top=l+"px",this._compositionView.style.height=u+"px",this._compositionView.style.lineHeight=u+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const y=this._compositionView.getBoundingClientRect();this._textarea.style.left=p+"px",this._textarea.style.top=l+"px",this._textarea.style.width=Math.max(y.width,1)+"px",this._textarea.style.height=Math.max(y.height,1)+"px",this._textarea.style.lineHeight=y.height+"px"}b||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};o.CompositionHelper=w=c([g(2,v.IBufferService),g(3,v.IOptionsService),g(4,v.ICoreService),g(5,h.IRenderService)],w)},9806:(_,o)=>{function a(c,g,h){const v=h.getBoundingClientRect(),m=c.getComputedStyle(h),w=parseInt(m.getPropertyValue("padding-left")),b=parseInt(m.getPropertyValue("padding-top"));return[g.clientX-v.left-w,g.clientY-v.top-b]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=a,o.getCoords=function(c,g,h,v,m,w,b,f,u){if(!w)return;const l=a(c,g,h);return l?(l[0]=Math.ceil((l[0]+(u?b/2:0))/b),l[1]=Math.ceil(l[1]/f),l[0]=Math.min(Math.max(l[0],1),v+(u?1:0)),l[1]=Math.min(Math.max(l[1],1),m),l):void 0}},9504:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const c=a(2584);function g(f,u,l,p){const y=f-h(f,l),k=u-h(u,l),C=Math.abs(y-k)-(function(A,S,T){let D=0;const H=A-h(A,T),W=S-h(S,T);for(let M=0;M<Math.abs(H-W);M++){const G=v(A,S)==="A"?-1:1,X=T.buffer.lines.get(H+G*M);X!=null&&X.isWrapped&&D++}return D})(f,u,l);return b(C,w(v(f,u),p))}function h(f,u){let l=0,p=u.buffer.lines.get(f),y=p==null?void 0:p.isWrapped;for(;y&&f>=0&&f<u.rows;)l++,p=u.buffer.lines.get(--f),y=p==null?void 0:p.isWrapped;return l}function v(f,u){return f>u?"A":"B"}function m(f,u,l,p,y,k){let C=f,A=u,S="";for(;C!==l||A!==p;)C+=y?1:-1,y&&C>k.cols-1?(S+=k.buffer.translateBufferLineToString(A,!1,f,C),C=0,f=0,A++):!y&&C<0&&(S+=k.buffer.translateBufferLineToString(A,!1,0,f+1),C=k.cols-1,f=C,A--);return S+k.buffer.translateBufferLineToString(A,!1,f,C)}function w(f,u){const l=u?"O":"[";return c.C0.ESC+l+f}function b(f,u){f=Math.floor(f);let l="";for(let p=0;p<f;p++)l+=u;return l}o.moveToCellSequence=function(f,u,l,p){const y=l.buffer.x,k=l.buffer.y;if(!l.buffer.hasScrollback)return(function(S,T,D,H,W,M){return g(T,H,W,M).length===0?"":b(m(S,T,S,T-h(T,W),!1,W).length,w("D",M))})(y,k,0,u,l,p)+g(k,u,l,p)+(function(S,T,D,H,W,M){let G;G=g(T,H,W,M).length>0?H-h(H,W):T;const X=H,le=(function(me,xe,R,j,N,V){let $;return $=g(R,j,N,V).length>0?j-h(j,N):xe,me<R&&$<=j||me>=R&&$<j?"C":"D"})(S,T,D,H,W,M);return b(m(S,G,D,X,le==="C",W).length,w(le,M))})(y,k,f,u,l,p);let C;if(k===u)return C=y>f?"D":"C",b(Math.abs(y-f),w(C,p));C=k>u?"D":"C";const A=Math.abs(k-u);return b((function(S,T){return T.cols-S})(k>u?f:y,l)+(A-1)*l.cols+1+((k>u?y:f)-1),w(C,p))}},1296:function(_,o,a){var c=this&&this.__decorate||function(M,G,X,le){var me,xe=arguments.length,R=xe<3?G:le===null?le=Object.getOwnPropertyDescriptor(G,X):le;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(M,G,X,le);else for(var j=M.length-1;j>=0;j--)(me=M[j])&&(R=(xe<3?me(R):xe>3?me(G,X,R):me(G,X))||R);return xe>3&&R&&Object.defineProperty(G,X,R),R},g=this&&this.__param||function(M,G){return function(X,le){G(X,le,M)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const h=a(3787),v=a(2550),m=a(2223),w=a(6171),b=a(6052),f=a(4725),u=a(8055),l=a(8460),p=a(844),y=a(2585),k="xterm-dom-renderer-owner-",C="xterm-rows",A="xterm-fg-",S="xterm-bg-",T="xterm-focus",D="xterm-selection";let H=1,W=o.DomRenderer=class extends p.Disposable{constructor(M,G,X,le,me,xe,R,j,N,V,$,ee,ce){super(),this._terminal=M,this._document=G,this._element=X,this._screenElement=le,this._viewportElement=me,this._helperContainer=xe,this._linkifier2=R,this._charSizeService=N,this._optionsService=V,this._bufferService=$,this._coreBrowserService=ee,this._themeService=ce,this._terminalClass=H++,this._rowElements=[],this._selectionRenderModel=(0,b.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new l.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(C),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(D),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ue=>this._injectCss(ue)))),this._injectCss(this._themeService.colors),this._rowFactory=j.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(k+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ue=>this._handleLinkHover(ue)))),this.register(this._linkifier2.onHideLinkUnderline((ue=>this._handleLinkLeave(ue)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(k+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new v.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const M=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*M,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*M),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/M),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/M),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const X of this._rowElements)X.style.width=`${this.dimensions.css.canvas.width}px`,X.style.height=`${this.dimensions.css.cell.height}px`,X.style.lineHeight=`${this.dimensions.css.cell.height}px`,X.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const G=`${this._terminalSelector} .${C} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=G,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(M){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let G=`${this._terminalSelector} .${C} { color: ${M.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;G+=`${this._terminalSelector} .${C} .xterm-dim { color: ${u.color.multiplyOpacity(M.foreground,.5).css};}`,G+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const X=`blink_underline_${this._terminalClass}`,le=`blink_bar_${this._terminalClass}`,me=`blink_block_${this._terminalClass}`;G+=`@keyframes ${X} { 50% { border-bottom-style: hidden; }}`,G+=`@keyframes ${le} { 50% { box-shadow: none; }}`,G+=`@keyframes ${me} { 0% { background-color: ${M.cursor.css}; color: ${M.cursorAccent.css}; } 50% { background-color: inherit; color: ${M.cursor.css}; }}`,G+=`${this._terminalSelector} .${C}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${C}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${le} 1s step-end infinite;}${this._terminalSelector} .${C}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${me} 1s step-end infinite;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-block { background-color: ${M.cursor.css}; color: ${M.cursorAccent.css};}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${M.cursor.css} !important; color: ${M.cursorAccent.css} !important;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${M.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${M.cursor.css} inset;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${M.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,G+=`${this._terminalSelector} .${D} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${D} div { position: absolute; background-color: ${M.selectionBackgroundOpaque.css};}${this._terminalSelector} .${D} div { position: absolute; background-color: ${M.selectionInactiveBackgroundOpaque.css};}`;for(const[xe,R]of M.ansi.entries())G+=`${this._terminalSelector} .${A}${xe} { color: ${R.css}; }${this._terminalSelector} .${A}${xe}.xterm-dim { color: ${u.color.multiplyOpacity(R,.5).css}; }${this._terminalSelector} .${S}${xe} { background-color: ${R.css}; }`;G+=`${this._terminalSelector} .${A}${m.INVERTED_DEFAULT_COLOR} { color: ${u.color.opaque(M.background).css}; }${this._terminalSelector} .${A}${m.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${u.color.multiplyOpacity(u.color.opaque(M.background),.5).css}; }${this._terminalSelector} .${S}${m.INVERTED_DEFAULT_COLOR} { background-color: ${M.foreground.css}; }`,this._themeStyleElement.textContent=G}_setDefaultSpacing(){const M=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${M}px`,this._rowFactory.defaultSpacing=M}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(M,G){for(let X=this._rowElements.length;X<=G;X++){const le=this._document.createElement("div");this._rowContainer.appendChild(le),this._rowElements.push(le)}for(;this._rowElements.length>G;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(M,G){this._refreshRowElements(M,G),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(T),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(T),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(M,G,X){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(M,G,X),this.renderRows(0,this._bufferService.rows-1),!M||!G)return;this._selectionRenderModel.update(this._terminal,M,G,X);const le=this._selectionRenderModel.viewportStartRow,me=this._selectionRenderModel.viewportEndRow,xe=this._selectionRenderModel.viewportCappedStartRow,R=this._selectionRenderModel.viewportCappedEndRow;if(xe>=this._bufferService.rows||R<0)return;const j=this._document.createDocumentFragment();if(X){const N=M[0]>G[0];j.appendChild(this._createSelectionElement(xe,N?G[0]:M[0],N?M[0]:G[0],R-xe+1))}else{const N=le===xe?M[0]:0,V=xe===me?G[0]:this._bufferService.cols;j.appendChild(this._createSelectionElement(xe,N,V));const $=R-xe-1;if(j.appendChild(this._createSelectionElement(xe+1,0,this._bufferService.cols,$)),xe!==R){const ee=me===R?G[0]:this._bufferService.cols;j.appendChild(this._createSelectionElement(R,0,ee))}}this._selectionContainer.appendChild(j)}_createSelectionElement(M,G,X,le=1){const me=this._document.createElement("div"),xe=G*this.dimensions.css.cell.width;let R=this.dimensions.css.cell.width*(X-G);return xe+R>this.dimensions.css.canvas.width&&(R=this.dimensions.css.canvas.width-xe),me.style.height=le*this.dimensions.css.cell.height+"px",me.style.top=M*this.dimensions.css.cell.height+"px",me.style.left=`${xe}px`,me.style.width=`${R}px`,me}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const M of this._rowElements)M.replaceChildren()}renderRows(M,G){const X=this._bufferService.buffer,le=X.ybase+X.y,me=Math.min(X.x,this._bufferService.cols-1),xe=this._optionsService.rawOptions.cursorBlink,R=this._optionsService.rawOptions.cursorStyle,j=this._optionsService.rawOptions.cursorInactiveStyle;for(let N=M;N<=G;N++){const V=N+X.ydisp,$=this._rowElements[N],ee=X.lines.get(V);if(!$||!ee)break;$.replaceChildren(...this._rowFactory.createRow(ee,V,V===le,R,j,me,xe,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${k}${this._terminalClass}`}_handleLinkHover(M){this._setCellUnderline(M.x1,M.x2,M.y1,M.y2,M.cols,!0)}_handleLinkLeave(M){this._setCellUnderline(M.x1,M.x2,M.y1,M.y2,M.cols,!1)}_setCellUnderline(M,G,X,le,me,xe){X<0&&(M=0),le<0&&(G=0);const R=this._bufferService.rows-1;X=Math.max(Math.min(X,R),0),le=Math.max(Math.min(le,R),0),me=Math.min(me,this._bufferService.cols);const j=this._bufferService.buffer,N=j.ybase+j.y,V=Math.min(j.x,me-1),$=this._optionsService.rawOptions.cursorBlink,ee=this._optionsService.rawOptions.cursorStyle,ce=this._optionsService.rawOptions.cursorInactiveStyle;for(let ue=X;ue<=le;++ue){const B=ue+j.ydisp,I=this._rowElements[ue],z=j.lines.get(B);if(!I||!z)break;I.replaceChildren(...this._rowFactory.createRow(z,B,B===N,ee,ce,V,$,this.dimensions.css.cell.width,this._widthCache,xe?ue===X?M:0:-1,xe?(ue===le?G:me)-1:-1))}}};o.DomRenderer=W=c([g(7,y.IInstantiationService),g(8,f.ICharSizeService),g(9,y.IOptionsService),g(10,y.IBufferService),g(11,f.ICoreBrowserService),g(12,f.IThemeService)],W)},3787:function(_,o,a){var c=this&&this.__decorate||function(C,A,S,T){var D,H=arguments.length,W=H<3?A:T===null?T=Object.getOwnPropertyDescriptor(A,S):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(C,A,S,T);else for(var M=C.length-1;M>=0;M--)(D=C[M])&&(W=(H<3?D(W):H>3?D(A,S,W):D(A,S))||W);return H>3&&W&&Object.defineProperty(A,S,W),W},g=this&&this.__param||function(C,A){return function(S,T){A(S,T,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const h=a(2223),v=a(643),m=a(511),w=a(2585),b=a(8055),f=a(4725),u=a(4269),l=a(6171),p=a(3734);let y=o.DomRendererRowFactory=class{constructor(C,A,S,T,D,H,W){this._document=C,this._characterJoinerService=A,this._optionsService=S,this._coreBrowserService=T,this._coreService=D,this._decorationService=H,this._themeService=W,this._workCell=new m.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(C,A,S){this._selectionStart=C,this._selectionEnd=A,this._columnSelectMode=S}createRow(C,A,S,T,D,H,W,M,G,X,le){const me=[],xe=this._characterJoinerService.getJoinedCharacters(A),R=this._themeService.colors;let j,N=C.getNoBgTrimmedLength();S&&N<H+1&&(N=H+1);let V=0,$="",ee=0,ce=0,ue=0,B=!1,I=0,z=!1,O=0;const ne=[],ae=X!==-1&&le!==-1;for(let te=0;te<N;te++){C.loadCell(te,this._workCell);let ge=this._workCell.getWidth();if(ge===0)continue;let we=!1,Ie=te,Pe=this._workCell;if(xe.length>0&&te===xe[0][0]){we=!0;const Fe=xe.shift();Pe=new u.JoinedCellData(this._workCell,C.translateToString(!0,Fe[0],Fe[1]),Fe[1]-Fe[0]),Ie=Fe[1]-1,ge=Pe.getWidth()}const Se=this._isCellInSelection(te,A),Be=S&&te===H,Ue=ae&&te>=X&&te<=le;let je=!1;this._decorationService.forEachDecorationAtCell(te,A,void 0,(Fe=>{je=!0}));let ze=Pe.getChars()||v.WHITESPACE_CELL_CHAR;if(ze===" "&&(Pe.isUnderline()||Pe.isOverline())&&(ze=" "),O=ge*M-G.get(ze,Pe.isBold(),Pe.isItalic()),j){if(V&&(Se&&z||!Se&&!z&&Pe.bg===ee)&&(Se&&z&&R.selectionForeground||Pe.fg===ce)&&Pe.extended.ext===ue&&Ue===B&&O===I&&!Be&&!we&&!je){Pe.isInvisible()?$+=v.WHITESPACE_CELL_CHAR:$+=ze,V++;continue}V&&(j.textContent=$),j=this._document.createElement("span"),V=0,$=""}else j=this._document.createElement("span");if(ee=Pe.bg,ce=Pe.fg,ue=Pe.extended.ext,B=Ue,I=O,z=Se,we&&H>=te&&H<=Ie&&(H=te),!this._coreService.isCursorHidden&&Be&&this._coreService.isCursorInitialized){if(ne.push("xterm-cursor"),this._coreBrowserService.isFocused)W&&ne.push("xterm-cursor-blink"),ne.push(T==="bar"?"xterm-cursor-bar":T==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(D)switch(D){case"outline":ne.push("xterm-cursor-outline");break;case"block":ne.push("xterm-cursor-block");break;case"bar":ne.push("xterm-cursor-bar");break;case"underline":ne.push("xterm-cursor-underline")}}if(Pe.isBold()&&ne.push("xterm-bold"),Pe.isItalic()&&ne.push("xterm-italic"),Pe.isDim()&&ne.push("xterm-dim"),$=Pe.isInvisible()?v.WHITESPACE_CELL_CHAR:Pe.getChars()||v.WHITESPACE_CELL_CHAR,Pe.isUnderline()&&(ne.push(`xterm-underline-${Pe.extended.underlineStyle}`),$===" "&&($=" "),!Pe.isUnderlineColorDefault()))if(Pe.isUnderlineColorRGB())j.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(Pe.getUnderlineColor()).join(",")})`;else{let Fe=Pe.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Pe.isBold()&&Fe<8&&(Fe+=8),j.style.textDecorationColor=R.ansi[Fe].css}Pe.isOverline()&&(ne.push("xterm-overline"),$===" "&&($=" ")),Pe.isStrikethrough()&&ne.push("xterm-strikethrough"),Ue&&(j.style.textDecoration="underline");let Ne=Pe.getFgColor(),_e=Pe.getFgColorMode(),Me=Pe.getBgColor(),oe=Pe.getBgColorMode();const pe=!!Pe.isInverse();if(pe){const Fe=Ne;Ne=Me,Me=Fe;const qe=_e;_e=oe,oe=qe}let Ce,He,$e,nt=!1;switch(this._decorationService.forEachDecorationAtCell(te,A,void 0,(Fe=>{Fe.options.layer!=="top"&&nt||(Fe.backgroundColorRGB&&(oe=50331648,Me=Fe.backgroundColorRGB.rgba>>8&16777215,Ce=Fe.backgroundColorRGB),Fe.foregroundColorRGB&&(_e=50331648,Ne=Fe.foregroundColorRGB.rgba>>8&16777215,He=Fe.foregroundColorRGB),nt=Fe.options.layer==="top")})),!nt&&Se&&(Ce=this._coreBrowserService.isFocused?R.selectionBackgroundOpaque:R.selectionInactiveBackgroundOpaque,Me=Ce.rgba>>8&16777215,oe=50331648,nt=!0,R.selectionForeground&&(_e=50331648,Ne=R.selectionForeground.rgba>>8&16777215,He=R.selectionForeground)),nt&&ne.push("xterm-decoration-top"),oe){case 16777216:case 33554432:$e=R.ansi[Me],ne.push(`xterm-bg-${Me}`);break;case 50331648:$e=b.channels.toColor(Me>>16,Me>>8&255,255&Me),this._addStyle(j,`background-color:#${k((Me>>>0).toString(16),"0",6)}`);break;default:pe?($e=R.foreground,ne.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):$e=R.background}switch(Ce||Pe.isDim()&&(Ce=b.color.multiplyOpacity($e,.5)),_e){case 16777216:case 33554432:Pe.isBold()&&Ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ne+=8),this._applyMinimumContrast(j,$e,R.ansi[Ne],Pe,Ce,void 0)||ne.push(`xterm-fg-${Ne}`);break;case 50331648:const Fe=b.channels.toColor(Ne>>16&255,Ne>>8&255,255&Ne);this._applyMinimumContrast(j,$e,Fe,Pe,Ce,He)||this._addStyle(j,`color:#${k(Ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(j,$e,R.foreground,Pe,Ce,He)||pe&&ne.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}ne.length&&(j.className=ne.join(" "),ne.length=0),Be||we||je?j.textContent=$:V++,O!==this.defaultSpacing&&(j.style.letterSpacing=`${O}px`),me.push(j),te=Ie}return j&&V&&(j.textContent=$),me}_applyMinimumContrast(C,A,S,T,D,H){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,l.treatGlyphAsBackgroundColor)(T.getCode()))return!1;const W=this._getContrastCache(T);let M;if(D||H||(M=W.getColor(A.rgba,S.rgba)),M===void 0){const G=this._optionsService.rawOptions.minimumContrastRatio/(T.isDim()?2:1);M=b.color.ensureContrastRatio(D||A,H||S,G),W.setColor((D||A).rgba,(H||S).rgba,M??null)}return!!M&&(this._addStyle(C,`color:${M.css}`),!0)}_getContrastCache(C){return C.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(C,A){C.setAttribute("style",`${C.getAttribute("style")||""}${A};`)}_isCellInSelection(C,A){const S=this._selectionStart,T=this._selectionEnd;return!(!S||!T)&&(this._columnSelectMode?S[0]<=T[0]?C>=S[0]&&A>=S[1]&&C<T[0]&&A<=T[1]:C<S[0]&&A>=S[1]&&C>=T[0]&&A<=T[1]:A>S[1]&&A<T[1]||S[1]===T[1]&&A===S[1]&&C>=S[0]&&C<T[0]||S[1]<T[1]&&A===T[1]&&C<T[0]||S[1]<T[1]&&A===S[1]&&C>=S[0])}};function k(C,A,S){for(;C.length<S;)C=A+C;return C}o.DomRendererRowFactory=y=c([g(1,f.ICharacterJoinerService),g(2,w.IOptionsService),g(3,f.ICoreBrowserService),g(4,w.ICoreService),g(5,w.IDecorationService),g(6,f.IThemeService)],y)},2550:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(a,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const g=a.createElement("span");g.classList.add("xterm-char-measure-element");const h=a.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const v=a.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontStyle="italic";const m=a.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold",m.style.fontStyle="italic",this._measureElements=[g,h,v,m],this._container.appendChild(g),this._container.appendChild(h),this._container.appendChild(v),this._container.appendChild(m),c.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(a,c,g,h){a===this._font&&c===this._fontSize&&g===this._weight&&h===this._weightBold||(this._font=a,this._fontSize=c,this._weight=g,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(a,c,g){let h=0;if(!c&&!g&&a.length===1&&(h=a.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const w=this._measure(a,0);return w>0&&(this._flat[h]=w),w}let v=a;c&&(v+="B"),g&&(v+="I");let m=this._holey.get(v);if(m===void 0){let w=0;c&&(w|=1),g&&(w|=2),m=this._measure(a,w),m>0&&this._holey.set(v,m)}return m}_measure(a,c){const g=this._measureElements[c];return g.textContent=a.repeat(32),g.offsetWidth/32}}},2223:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const c=a(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(_,o)=>{function a(g){return 57508<=g&&g<=57558}function c(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},o.isPowerlineGlyph=a,o.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},o.isEmoji=c,o.allowRescaling=function(g,h,v,m){return h===1&&v>Math.ceil(1.5*m)&&g!==void 0&&g>255&&!c(g)&&!a(g)&&!(function(w){return 57344<=w&&w<=63743})(g)},o.treatGlyphAsBackgroundColor=function(g){return a(g)||(function(h){return 9472<=h&&h<=9631})(g)},o.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},o.computeNextVariantOffset=function(g,h,v=0){return(g-(2*Math.round(h)-v))%(2*Math.round(h))}},6052:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(g,h,v,m=!1){if(this.selectionStart=h,this.selectionEnd=v,!h||!v||h[0]===v[0]&&h[1]===v[1])return void this.clear();const w=g.buffers.active.ydisp,b=h[1]-w,f=v[1]-w,u=Math.max(b,0),l=Math.min(f,g.rows-1);u>=g.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=m,this.viewportStartRow=b,this.viewportEndRow=f,this.viewportCappedStartRow=u,this.viewportCappedEndRow=l,this.startCol=h[0],this.endCol=v[0])}isCellSelected(g,h,v){return!!this.hasSelection&&(v-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&v>=this.viewportCappedStartRow&&h<this.endCol&&v<=this.viewportCappedEndRow:h<this.startCol&&v>=this.viewportCappedStartRow&&h>=this.endCol&&v<=this.viewportCappedEndRow:v>this.viewportStartRow&&v<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&v===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportStartRow&&h>=this.startCol)}}o.createSelectionRenderModel=function(){return new a}},456:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(a){this._bufferService=a,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,c=this.selectionEnd;return!(!a||!c)&&(a[1]>c[1]||a[1]===c[1]&&a[0]>c[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(_,o,a){var c=this&&this.__decorate||function(l,p,y,k){var C,A=arguments.length,S=A<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(l,p,y,k);else for(var T=l.length-1;T>=0;T--)(C=l[T])&&(S=(A<3?C(S):A>3?C(p,y,S):C(p,y))||S);return A>3&&S&&Object.defineProperty(p,y,S),S},g=this&&this.__param||function(l,p){return function(y,k){p(y,k,l)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const h=a(2585),v=a(8460),m=a(844);let w=o.CharSizeService=class extends m.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(l,p,y){super(),this._optionsService=y,this.width=0,this.height=0,this._onCharSizeChange=this.register(new v.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new u(this._optionsService))}catch{this._measureStrategy=this.register(new f(l,p,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const l=this._measureStrategy.measure();l.width===this.width&&l.height===this.height||(this.width=l.width,this.height=l.height,this._onCharSizeChange.fire())}};o.CharSizeService=w=c([g(2,h.IOptionsService)],w);class b extends m.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(p,y){p!==void 0&&p>0&&y!==void 0&&y>0&&(this._result.width=p,this._result.height=y)}}class f extends b{constructor(p,y,k){super(),this._document=p,this._parentElement=y,this._optionsService=k,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class u extends b{constructor(p){super(),this._optionsService=p,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const y=this._ctx.measureText("W");if(!("width"in y&&"fontBoundingBoxAscent"in y&&"fontBoundingBoxDescent"in y))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const p=this._ctx.measureText("W");return this._validateAndSet(p.width,p.fontBoundingBoxAscent+p.fontBoundingBoxDescent),this._result}}},4269:function(_,o,a){var c=this&&this.__decorate||function(u,l,p,y){var k,C=arguments.length,A=C<3?l:y===null?y=Object.getOwnPropertyDescriptor(l,p):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,l,p,y);else for(var S=u.length-1;S>=0;S--)(k=u[S])&&(A=(C<3?k(A):C>3?k(l,p,A):k(l,p))||A);return C>3&&A&&Object.defineProperty(l,p,A),A},g=this&&this.__param||function(u,l){return function(p,y){l(p,y,u)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const h=a(3734),v=a(643),m=a(511),w=a(2585);class b extends h.AttributeData{constructor(l,p,y){super(),this.content=0,this.combinedData="",this.fg=l.fg,this.bg=l.bg,this.combinedData=p,this._width=y}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(l){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=b;let f=o.CharacterJoinerService=class fh{constructor(l){this._bufferService=l,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new m.CellData}register(l){const p={id:this._nextCharacterJoinerId++,handler:l};return this._characterJoiners.push(p),p.id}deregister(l){for(let p=0;p<this._characterJoiners.length;p++)if(this._characterJoiners[p].id===l)return this._characterJoiners.splice(p,1),!0;return!1}getJoinedCharacters(l){if(this._characterJoiners.length===0)return[];const p=this._bufferService.buffer.lines.get(l);if(!p||p.length===0)return[];const y=[],k=p.translateToString(!0);let C=0,A=0,S=0,T=p.getFg(0),D=p.getBg(0);for(let H=0;H<p.getTrimmedLength();H++)if(p.loadCell(H,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==T||this._workCell.bg!==D){if(H-C>1){const W=this._getJoinedRanges(k,S,A,p,C);for(let M=0;M<W.length;M++)y.push(W[M])}C=H,S=A,T=this._workCell.fg,D=this._workCell.bg}A+=this._workCell.getChars().length||v.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-C>1){const H=this._getJoinedRanges(k,S,A,p,C);for(let W=0;W<H.length;W++)y.push(H[W])}return y}_getJoinedRanges(l,p,y,k,C){const A=l.substring(p,y);let S=[];try{S=this._characterJoiners[0].handler(A)}catch(T){console.error(T)}for(let T=1;T<this._characterJoiners.length;T++)try{const D=this._characterJoiners[T].handler(A);for(let H=0;H<D.length;H++)fh._mergeRanges(S,D[H])}catch(D){console.error(D)}return this._stringRangesToCellRanges(S,k,C),S}_stringRangesToCellRanges(l,p,y){let k=0,C=!1,A=0,S=l[k];if(S){for(let T=y;T<this._bufferService.cols;T++){const D=p.getWidth(T),H=p.getString(T).length||v.WHITESPACE_CELL_CHAR.length;if(D!==0){if(!C&&S[0]<=A&&(S[0]=T,C=!0),S[1]<=A){if(S[1]=T,S=l[++k],!S)break;S[0]<=A?(S[0]=T,C=!0):C=!1}A+=H}}S&&(S[1]=this._bufferService.cols)}}static _mergeRanges(l,p){let y=!1;for(let k=0;k<l.length;k++){const C=l[k];if(y){if(p[1]<=C[0])return l[k-1][1]=p[1],l;if(p[1]<=C[1])return l[k-1][1]=Math.max(p[1],C[1]),l.splice(k,1),l;l.splice(k,1),k--}else{if(p[1]<=C[0])return l.splice(k,0,p),l;if(p[1]<=C[1])return C[0]=Math.min(p[0],C[0]),l;p[0]<C[1]&&(C[0]=Math.min(p[0],C[0]),y=!0)}}return y?l[l.length-1][1]=p[1]:l.push(p),l}};o.CharacterJoinerService=f=c([g(0,w.IBufferService)],f)},5114:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const c=a(844),g=a(8460),h=a(3656);class v extends c.Disposable{constructor(b,f,u){super(),this._textarea=b,this._window=f,this.mainDocument=u,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new m(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((l=>this._screenDprMonitor.setWindow(l)))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(b){this._window!==b&&(this._window=b,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}o.CoreBrowserService=v;class m extends c.Disposable{constructor(b){super(),this._parentWindow=b,this._windowResizeListener=this.register(new c.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,c.toDisposable)((()=>this.clearListener())))}setWindow(b){this._parentWindow=b,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var b;this._outerListener&&((b=this._resolutionMediaMatchList)==null||b.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const c=a(844);class g extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(v){return this.linkProviders.push(v),{dispose:()=>{const m=this.linkProviders.indexOf(v);m!==-1&&this.linkProviders.splice(m,1)}}}}o.LinkProviderService=g},8934:function(_,o,a){var c=this&&this.__decorate||function(w,b,f,u){var l,p=arguments.length,y=p<3?b:u===null?u=Object.getOwnPropertyDescriptor(b,f):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(w,b,f,u);else for(var k=w.length-1;k>=0;k--)(l=w[k])&&(y=(p<3?l(y):p>3?l(b,f,y):l(b,f))||y);return p>3&&y&&Object.defineProperty(b,f,y),y},g=this&&this.__param||function(w,b){return function(f,u){b(f,u,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const h=a(4725),v=a(9806);let m=o.MouseService=class{constructor(w,b){this._renderService=w,this._charSizeService=b}getCoords(w,b,f,u,l){return(0,v.getCoords)(window,w,b,f,u,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(w,b){const f=(0,v.getCoordsRelativeToElement)(window,w,b);if(this._charSizeService.hasValidSize)return f[0]=Math.min(Math.max(f[0],0),this._renderService.dimensions.css.canvas.width-1),f[1]=Math.min(Math.max(f[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(f[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(f[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(f[0]),y:Math.floor(f[1])}}};o.MouseService=m=c([g(0,h.IRenderService),g(1,h.ICharSizeService)],m)},3230:function(_,o,a){var c=this&&this.__decorate||function(l,p,y,k){var C,A=arguments.length,S=A<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(l,p,y,k);else for(var T=l.length-1;T>=0;T--)(C=l[T])&&(S=(A<3?C(S):A>3?C(p,y,S):C(p,y))||S);return A>3&&S&&Object.defineProperty(p,y,S),S},g=this&&this.__param||function(l,p){return function(y,k){p(y,k,l)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const h=a(6193),v=a(4725),m=a(8460),w=a(844),b=a(7226),f=a(2585);let u=o.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(l,p,y,k,C,A,S,T){super(),this._rowCount=l,this._charSizeService=k,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new b.DebouncedIdleTask,this._observerDisposable=this.register(new w.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new m.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new m.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new m.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new m.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((D,H)=>this._renderRows(D,H)),S),this.register(this._renderDebouncer),this.register(S.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(A.onResize((()=>this._fullRefresh()))),this.register(A.buffers.onBufferActivate((()=>{var D;return(D=this._renderer.value)==null?void 0:D.clear()}))),this.register(y.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(C.onDecorationRegistered((()=>this._fullRefresh()))),this.register(C.onDecorationRemoved((()=>this._fullRefresh()))),this.register(y.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(A.cols,A.rows),this._fullRefresh()}))),this.register(y.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(A.buffer.y,A.buffer.y,!0)))),this.register(T.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(S.window,p),this.register(S.onWindowChange((D=>this._registerIntersectionObserver(D,p))))}_registerIntersectionObserver(l,p){if("IntersectionObserver"in l){const y=new l.IntersectionObserver((k=>this._handleIntersectionChange(k[k.length-1])),{threshold:0});y.observe(p),this._observerDisposable.value=(0,w.toDisposable)((()=>y.disconnect()))}}_handleIntersectionChange(l){this._isPaused=l.isIntersecting===void 0?l.intersectionRatio===0:!l.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(l,p,y=!1){this._isPaused?this._needsFullRefresh=!0:(y||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(l,p,this._rowCount))}_renderRows(l,p){this._renderer.value&&(l=Math.min(l,this._rowCount-1),p=Math.min(p,this._rowCount-1),this._renderer.value.renderRows(l,p),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:l,end:p}),this._onRender.fire({start:l,end:p}),this._isNextRenderRedrawOnly=!0)}resize(l,p){this._rowCount=p,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(l){this._renderer.value=l,this._renderer.value&&(this._renderer.value.onRequestRedraw((p=>this.refreshRows(p.start,p.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(l){return this._renderDebouncer.addRefreshCallback(l)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var l,p;this._renderer.value&&((p=(l=this._renderer.value).clearTextureAtlas)==null||p.call(l),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(l,p){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var y;return(y=this._renderer.value)==null?void 0:y.handleResize(l,p)})):this._renderer.value.handleResize(l,p),this._fullRefresh())}handleCharSizeChanged(){var l;(l=this._renderer.value)==null||l.handleCharSizeChanged()}handleBlur(){var l;(l=this._renderer.value)==null||l.handleBlur()}handleFocus(){var l;(l=this._renderer.value)==null||l.handleFocus()}handleSelectionChanged(l,p,y){var k;this._selectionState.start=l,this._selectionState.end=p,this._selectionState.columnSelectMode=y,(k=this._renderer.value)==null||k.handleSelectionChanged(l,p,y)}handleCursorMove(){var l;(l=this._renderer.value)==null||l.handleCursorMove()}clear(){var l;(l=this._renderer.value)==null||l.clear()}};o.RenderService=u=c([g(2,f.IOptionsService),g(3,v.ICharSizeService),g(4,f.IDecorationService),g(5,f.IBufferService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],u)},9312:function(_,o,a){var c=this&&this.__decorate||function(S,T,D,H){var W,M=arguments.length,G=M<3?T:H===null?H=Object.getOwnPropertyDescriptor(T,D):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(S,T,D,H);else for(var X=S.length-1;X>=0;X--)(W=S[X])&&(G=(M<3?W(G):M>3?W(T,D,G):W(T,D))||G);return M>3&&G&&Object.defineProperty(T,D,G),G},g=this&&this.__param||function(S,T){return function(D,H){T(D,H,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const h=a(9806),v=a(9504),m=a(456),w=a(4725),b=a(8460),f=a(844),u=a(6114),l=a(4841),p=a(511),y=a(2585),k=" ",C=new RegExp(k,"g");let A=o.SelectionService=class extends f.Disposable{constructor(S,T,D,H,W,M,G,X,le){super(),this._element=S,this._screenElement=T,this._linkifier=D,this._bufferService=H,this._coreService=W,this._mouseService=M,this._optionsService=G,this._renderService=X,this._coreBrowserService=le,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new b.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new b.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new b.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new b.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=me=>this._handleMouseMove(me),this._mouseUpListener=me=>this._handleMouseUp(me),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((me=>this._handleTrim(me))),this.register(this._bufferService.buffers.onBufferActivate((me=>this._handleBufferActivate(me)))),this.enable(),this._model=new m.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,f.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const S=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!S||!T||S[0]===T[0]&&S[1]===T[1])}get selectionText(){const S=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;if(!S||!T)return"";const D=this._bufferService.buffer,H=[];if(this._activeSelectionMode===3){if(S[0]===T[0])return"";const W=S[0]<T[0]?S[0]:T[0],M=S[0]<T[0]?T[0]:S[0];for(let G=S[1];G<=T[1];G++){const X=D.translateBufferLineToString(G,!0,W,M);H.push(X)}}else{const W=S[1]===T[1]?T[0]:void 0;H.push(D.translateBufferLineToString(S[1],!0,S[0],W));for(let M=S[1]+1;M<=T[1]-1;M++){const G=D.lines.get(M),X=D.translateBufferLineToString(M,!0);G!=null&&G.isWrapped?H[H.length-1]+=X:H.push(X)}if(S[1]!==T[1]){const M=D.lines.get(T[1]),G=D.translateBufferLineToString(T[1],!0,0,T[0]);M&&M.isWrapped?H[H.length-1]+=G:H.push(G)}}return H.map((W=>W.replace(C," "))).join(u.isWindows?`\r
386
+ `:`
387
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(S){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),u.isLinux&&S&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(S){const T=this._getMouseBufferCoords(S),D=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!!(D&&H&&T)&&this._areCoordsInSelection(T,D,H)}isCellInSelection(S,T){const D=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!(!D||!H)&&this._areCoordsInSelection([S,T],D,H)}_areCoordsInSelection(S,T,D){return S[1]>T[1]&&S[1]<D[1]||T[1]===D[1]&&S[1]===T[1]&&S[0]>=T[0]&&S[0]<D[0]||T[1]<D[1]&&S[1]===D[1]&&S[0]<D[0]||T[1]<D[1]&&S[1]===T[1]&&S[0]>=T[0]}_selectWordAtCursor(S,T){var W,M;const D=(M=(W=this._linkifier.currentLink)==null?void 0:W.link)==null?void 0:M.range;if(D)return this._model.selectionStart=[D.start.x-1,D.start.y-1],this._model.selectionStartLength=(0,l.getRangeLength)(D,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const H=this._getMouseBufferCoords(S);return!!H&&(this._selectWordAt(H,T),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(S,T){this._model.clearSelection(),S=Math.max(S,0),T=Math.min(T,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,S],this._model.selectionEnd=[this._bufferService.cols,T],this.refresh(),this._onSelectionChange.fire()}_handleTrim(S){this._model.handleTrim(S)&&this.refresh()}_getMouseBufferCoords(S){const T=this._mouseService.getCoords(S,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(T)return T[0]--,T[1]--,T[1]+=this._bufferService.buffer.ydisp,T}_getMouseEventScrollAmount(S){let T=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,S,this._screenElement)[1];const D=this._renderService.dimensions.css.canvas.height;return T>=0&&T<=D?0:(T>D&&(T-=D),T=Math.min(Math.max(T,-50),50),T/=50,T/Math.abs(T)+Math.round(14*T))}shouldForceSelection(S){return u.isMac?S.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:S.shiftKey}handleMouseDown(S){if(this._mouseDownTimeStamp=S.timeStamp,(S.button!==2||!this.hasSelection)&&S.button===0){if(!this._enabled){if(!this.shouldForceSelection(S))return;S.stopPropagation()}S.preventDefault(),this._dragScrollAmount=0,this._enabled&&S.shiftKey?this._handleIncrementalClick(S):S.detail===1?this._handleSingleClick(S):S.detail===2?this._handleDoubleClick(S):S.detail===3&&this._handleTripleClick(S),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(S){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(S))}_handleSingleClick(S){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(S)?3:0,this._model.selectionStart=this._getMouseBufferCoords(S),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const T=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);T&&T.length!==this._model.selectionStart[0]&&T.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(S){this._selectWordAtCursor(S,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(S){const T=this._getMouseBufferCoords(S);T&&(this._activeSelectionMode=2,this._selectLineAt(T[1]))}shouldColumnSelect(S){return S.altKey&&!(u.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(S){if(S.stopImmediatePropagation(),!this._model.selectionStart)return;const T=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(S),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(S),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const D=this._bufferService.buffer;if(this._model.selectionEnd[1]<D.lines.length){const H=D.lines.get(this._model.selectionEnd[1]);H&&H.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}T&&T[0]===this._model.selectionEnd[0]&&T[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const S=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(S.ydisp+this._bufferService.rows,S.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=S.ydisp),this.refresh()}}_handleMouseUp(S){const T=S.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&T<500&&S.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const D=this._mouseService.getCoords(S,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(D&&D[0]!==void 0&&D[1]!==void 0){const H=(0,v.moveToCellSequence)(D[0]-1,D[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(H,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const S=this._model.finalSelectionStart,T=this._model.finalSelectionEnd,D=!(!S||!T||S[0]===T[0]&&S[1]===T[1]);D?S&&T&&(this._oldSelectionStart&&this._oldSelectionEnd&&S[0]===this._oldSelectionStart[0]&&S[1]===this._oldSelectionStart[1]&&T[0]===this._oldSelectionEnd[0]&&T[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(S,T,D)):this._oldHasSelection&&this._fireOnSelectionChange(S,T,D)}_fireOnSelectionChange(S,T,D){this._oldSelectionStart=S,this._oldSelectionEnd=T,this._oldHasSelection=D,this._onSelectionChange.fire()}_handleBufferActivate(S){this.clearSelection(),this._trimListener.dispose(),this._trimListener=S.activeBuffer.lines.onTrim((T=>this._handleTrim(T)))}_convertViewportColToCharacterIndex(S,T){let D=T;for(let H=0;T>=H;H++){const W=S.loadCell(H,this._workCell).getChars().length;this._workCell.getWidth()===0?D--:W>1&&T!==H&&(D+=W-1)}return D}setSelection(S,T,D){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[S,T],this._model.selectionStartLength=D,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(S){this._isClickInSelection(S)||(this._selectWordAtCursor(S,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(S,T,D=!0,H=!0){if(S[0]>=this._bufferService.cols)return;const W=this._bufferService.buffer,M=W.lines.get(S[1]);if(!M)return;const G=W.translateBufferLineToString(S[1],!1);let X=this._convertViewportColToCharacterIndex(M,S[0]),le=X;const me=S[0]-X;let xe=0,R=0,j=0,N=0;if(G.charAt(X)===" "){for(;X>0&&G.charAt(X-1)===" ";)X--;for(;le<G.length&&G.charAt(le+1)===" ";)le++}else{let ee=S[0],ce=S[0];M.getWidth(ee)===0&&(xe++,ee--),M.getWidth(ce)===2&&(R++,ce++);const ue=M.getString(ce).length;for(ue>1&&(N+=ue-1,le+=ue-1);ee>0&&X>0&&!this._isCharWordSeparator(M.loadCell(ee-1,this._workCell));){M.loadCell(ee-1,this._workCell);const B=this._workCell.getChars().length;this._workCell.getWidth()===0?(xe++,ee--):B>1&&(j+=B-1,X-=B-1),X--,ee--}for(;ce<M.length&&le+1<G.length&&!this._isCharWordSeparator(M.loadCell(ce+1,this._workCell));){M.loadCell(ce+1,this._workCell);const B=this._workCell.getChars().length;this._workCell.getWidth()===2?(R++,ce++):B>1&&(N+=B-1,le+=B-1),le++,ce++}}le++;let V=X+me-xe+j,$=Math.min(this._bufferService.cols,le-X+xe+R-j-N);if(T||G.slice(X,le).trim()!==""){if(D&&V===0&&M.getCodePoint(0)!==32){const ee=W.lines.get(S[1]-1);if(ee&&M.isWrapped&&ee.getCodePoint(this._bufferService.cols-1)!==32){const ce=this._getWordAt([this._bufferService.cols-1,S[1]-1],!1,!0,!1);if(ce){const ue=this._bufferService.cols-ce.start;V-=ue,$+=ue}}}if(H&&V+$===this._bufferService.cols&&M.getCodePoint(this._bufferService.cols-1)!==32){const ee=W.lines.get(S[1]+1);if(ee!=null&&ee.isWrapped&&ee.getCodePoint(0)!==32){const ce=this._getWordAt([0,S[1]+1],!1,!1,!0);ce&&($+=ce.length)}}return{start:V,length:$}}}_selectWordAt(S,T){const D=this._getWordAt(S,T);if(D){for(;D.start<0;)D.start+=this._bufferService.cols,S[1]--;this._model.selectionStart=[D.start,S[1]],this._model.selectionStartLength=D.length}}_selectToWordAt(S){const T=this._getWordAt(S,!0);if(T){let D=S[1];for(;T.start<0;)T.start+=this._bufferService.cols,D--;if(!this._model.areSelectionValuesReversed())for(;T.start+T.length>this._bufferService.cols;)T.length-=this._bufferService.cols,D++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?T.start:T.start+T.length,D]}}_isCharWordSeparator(S){return S.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(S.getChars())>=0}_selectLineAt(S){const T=this._bufferService.buffer.getWrappedRangeForLine(S),D={start:{x:0,y:T.first},end:{x:this._bufferService.cols-1,y:T.last}};this._model.selectionStart=[0,T.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,l.getRangeLength)(D,this._bufferService.cols)}};o.SelectionService=A=c([g(3,y.IBufferService),g(4,y.ICoreService),g(5,w.IMouseService),g(6,y.IOptionsService),g(7,w.IRenderService),g(8,w.ICoreBrowserService)],A)},4725:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const c=a(8343);o.ICharSizeService=(0,c.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),o.IMouseService=(0,c.createDecorator)("MouseService"),o.IRenderService=(0,c.createDecorator)("RenderService"),o.ISelectionService=(0,c.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,c.createDecorator)("ThemeService"),o.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(_,o,a){var c=this&&this.__decorate||function(A,S,T,D){var H,W=arguments.length,M=W<3?S:D===null?D=Object.getOwnPropertyDescriptor(S,T):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(A,S,T,D);else for(var G=A.length-1;G>=0;G--)(H=A[G])&&(M=(W<3?H(M):W>3?H(S,T,M):H(S,T))||M);return W>3&&M&&Object.defineProperty(S,T,M),M},g=this&&this.__param||function(A,S){return function(T,D){S(T,D,A)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const h=a(7239),v=a(8055),m=a(8460),w=a(844),b=a(2585),f=v.css.toColor("#ffffff"),u=v.css.toColor("#000000"),l=v.css.toColor("#ffffff"),p=v.css.toColor("#000000"),y={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const A=[v.css.toColor("#2e3436"),v.css.toColor("#cc0000"),v.css.toColor("#4e9a06"),v.css.toColor("#c4a000"),v.css.toColor("#3465a4"),v.css.toColor("#75507b"),v.css.toColor("#06989a"),v.css.toColor("#d3d7cf"),v.css.toColor("#555753"),v.css.toColor("#ef2929"),v.css.toColor("#8ae234"),v.css.toColor("#fce94f"),v.css.toColor("#729fcf"),v.css.toColor("#ad7fa8"),v.css.toColor("#34e2e2"),v.css.toColor("#eeeeec")],S=[0,95,135,175,215,255];for(let T=0;T<216;T++){const D=S[T/36%6|0],H=S[T/6%6|0],W=S[T%6];A.push({css:v.channels.toCss(D,H,W),rgba:v.channels.toRgba(D,H,W)})}for(let T=0;T<24;T++){const D=8+10*T;A.push({css:v.channels.toCss(D,D,D),rgba:v.channels.toRgba(D,D,D)})}return A})());let k=o.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(A){super(),this._optionsService=A,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new m.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:f,background:u,cursor:l,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:y,selectionBackgroundOpaque:v.color.blend(u,y),selectionInactiveBackgroundTransparent:y,selectionInactiveBackgroundOpaque:v.color.blend(u,y),ansi:o.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(A={}){const S=this._colors;if(S.foreground=C(A.foreground,f),S.background=C(A.background,u),S.cursor=C(A.cursor,l),S.cursorAccent=C(A.cursorAccent,p),S.selectionBackgroundTransparent=C(A.selectionBackground,y),S.selectionBackgroundOpaque=v.color.blend(S.background,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundTransparent=C(A.selectionInactiveBackground,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundOpaque=v.color.blend(S.background,S.selectionInactiveBackgroundTransparent),S.selectionForeground=A.selectionForeground?C(A.selectionForeground,v.NULL_COLOR):void 0,S.selectionForeground===v.NULL_COLOR&&(S.selectionForeground=void 0),v.color.isOpaque(S.selectionBackgroundTransparent)&&(S.selectionBackgroundTransparent=v.color.opacity(S.selectionBackgroundTransparent,.3)),v.color.isOpaque(S.selectionInactiveBackgroundTransparent)&&(S.selectionInactiveBackgroundTransparent=v.color.opacity(S.selectionInactiveBackgroundTransparent,.3)),S.ansi=o.DEFAULT_ANSI_COLORS.slice(),S.ansi[0]=C(A.black,o.DEFAULT_ANSI_COLORS[0]),S.ansi[1]=C(A.red,o.DEFAULT_ANSI_COLORS[1]),S.ansi[2]=C(A.green,o.DEFAULT_ANSI_COLORS[2]),S.ansi[3]=C(A.yellow,o.DEFAULT_ANSI_COLORS[3]),S.ansi[4]=C(A.blue,o.DEFAULT_ANSI_COLORS[4]),S.ansi[5]=C(A.magenta,o.DEFAULT_ANSI_COLORS[5]),S.ansi[6]=C(A.cyan,o.DEFAULT_ANSI_COLORS[6]),S.ansi[7]=C(A.white,o.DEFAULT_ANSI_COLORS[7]),S.ansi[8]=C(A.brightBlack,o.DEFAULT_ANSI_COLORS[8]),S.ansi[9]=C(A.brightRed,o.DEFAULT_ANSI_COLORS[9]),S.ansi[10]=C(A.brightGreen,o.DEFAULT_ANSI_COLORS[10]),S.ansi[11]=C(A.brightYellow,o.DEFAULT_ANSI_COLORS[11]),S.ansi[12]=C(A.brightBlue,o.DEFAULT_ANSI_COLORS[12]),S.ansi[13]=C(A.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),S.ansi[14]=C(A.brightCyan,o.DEFAULT_ANSI_COLORS[14]),S.ansi[15]=C(A.brightWhite,o.DEFAULT_ANSI_COLORS[15]),A.extendedAnsi){const T=Math.min(S.ansi.length-16,A.extendedAnsi.length);for(let D=0;D<T;D++)S.ansi[D+16]=C(A.extendedAnsi[D],o.DEFAULT_ANSI_COLORS[D+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(A){this._restoreColor(A),this._onChangeColors.fire(this.colors)}_restoreColor(A){if(A!==void 0)switch(A){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[A]=this._restoreColors.ansi[A]}else for(let S=0;S<this._restoreColors.ansi.length;++S)this._colors.ansi[S]=this._restoreColors.ansi[S]}modifyColors(A){A(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function C(A,S){if(A!==void 0)try{return v.css.toColor(A)}catch{}return S}o.ThemeService=k=c([g(0,b.IOptionsService)],k)},6349:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const c=a(8460),g=a(844);class h extends g.Disposable{constructor(m){super(),this._maxLength=m,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(m){if(this._maxLength===m)return;const w=new Array(m);for(let b=0;b<Math.min(m,this.length);b++)w[b]=this._array[this._getCyclicIndex(b)];this._array=w,this._maxLength=m,this._startIndex=0}get length(){return this._length}set length(m){if(m>this._length)for(let w=this._length;w<m;w++)this._array[w]=void 0;this._length=m}get(m){return this._array[this._getCyclicIndex(m)]}set(m,w){this._array[this._getCyclicIndex(m)]=w}push(m){this._array[this._getCyclicIndex(this._length)]=m,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(m,w,...b){if(w){for(let f=m;f<this._length-w;f++)this._array[this._getCyclicIndex(f)]=this._array[this._getCyclicIndex(f+w)];this._length-=w,this.onDeleteEmitter.fire({index:m,amount:w})}for(let f=this._length-1;f>=m;f--)this._array[this._getCyclicIndex(f+b.length)]=this._array[this._getCyclicIndex(f)];for(let f=0;f<b.length;f++)this._array[this._getCyclicIndex(m+f)]=b[f];if(b.length&&this.onInsertEmitter.fire({index:m,amount:b.length}),this._length+b.length>this._maxLength){const f=this._length+b.length-this._maxLength;this._startIndex+=f,this._length=this._maxLength,this.onTrimEmitter.fire(f)}else this._length+=b.length}trimStart(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,w,b){if(!(w<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+b<0)throw new Error("Cannot shift elements in list beyond index 0");if(b>0){for(let u=w-1;u>=0;u--)this.set(m+u+b,this.get(m+u));const f=m+w+b-this._length;if(f>0)for(this._length+=f;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let f=0;f<w;f++)this.set(m+f+b,this.get(m+f))}}_getCyclicIndex(m){return(this._startIndex+m)%this._maxLength}}o.CircularList=h},1439:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function a(c,g=5){if(typeof c!="object")return c;const h=Array.isArray(c)?[]:{};for(const v in c)h[v]=g<=1?c[v]:c[v]&&a(c[v],g-1);return h}},8055:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let a=0,c=0,g=0,h=0;var v,m,w,b,f;function u(p){const y=p.toString(16);return y.length<2?"0"+y:y}function l(p,y){return p<y?(y+.05)/(p+.05):(p+.05)/(y+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(p){p.toCss=function(y,k,C,A){return A!==void 0?`#${u(y)}${u(k)}${u(C)}${u(A)}`:`#${u(y)}${u(k)}${u(C)}`},p.toRgba=function(y,k,C,A=255){return(y<<24|k<<16|C<<8|A)>>>0},p.toColor=function(y,k,C,A){return{css:p.toCss(y,k,C,A),rgba:p.toRgba(y,k,C,A)}}})(v||(o.channels=v={})),(function(p){function y(k,C){return h=Math.round(255*C),[a,c,g]=f.toChannels(k.rgba),{css:v.toCss(a,c,g,h),rgba:v.toRgba(a,c,g,h)}}p.blend=function(k,C){if(h=(255&C.rgba)/255,h===1)return{css:C.css,rgba:C.rgba};const A=C.rgba>>24&255,S=C.rgba>>16&255,T=C.rgba>>8&255,D=k.rgba>>24&255,H=k.rgba>>16&255,W=k.rgba>>8&255;return a=D+Math.round((A-D)*h),c=H+Math.round((S-H)*h),g=W+Math.round((T-W)*h),{css:v.toCss(a,c,g),rgba:v.toRgba(a,c,g)}},p.isOpaque=function(k){return(255&k.rgba)==255},p.ensureContrastRatio=function(k,C,A){const S=f.ensureContrastRatio(k.rgba,C.rgba,A);if(S)return v.toColor(S>>24&255,S>>16&255,S>>8&255)},p.opaque=function(k){const C=(255|k.rgba)>>>0;return[a,c,g]=f.toChannels(C),{css:v.toCss(a,c,g),rgba:C}},p.opacity=y,p.multiplyOpacity=function(k,C){return h=255&k.rgba,y(k,h*C/255)},p.toColorRGB=function(k){return[k.rgba>>24&255,k.rgba>>16&255,k.rgba>>8&255]}})(m||(o.color=m={})),(function(p){let y,k;try{const C=document.createElement("canvas");C.width=1,C.height=1;const A=C.getContext("2d",{willReadFrequently:!0});A&&(y=A,y.globalCompositeOperation="copy",k=y.createLinearGradient(0,0,1,1))}catch{}p.toColor=function(C){if(C.match(/#[\da-f]{3,8}/i))switch(C.length){case 4:return a=parseInt(C.slice(1,2).repeat(2),16),c=parseInt(C.slice(2,3).repeat(2),16),g=parseInt(C.slice(3,4).repeat(2),16),v.toColor(a,c,g);case 5:return a=parseInt(C.slice(1,2).repeat(2),16),c=parseInt(C.slice(2,3).repeat(2),16),g=parseInt(C.slice(3,4).repeat(2),16),h=parseInt(C.slice(4,5).repeat(2),16),v.toColor(a,c,g,h);case 7:return{css:C,rgba:(parseInt(C.slice(1),16)<<8|255)>>>0};case 9:return{css:C,rgba:parseInt(C.slice(1),16)>>>0}}const A=C.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(A)return a=parseInt(A[1]),c=parseInt(A[2]),g=parseInt(A[3]),h=Math.round(255*(A[5]===void 0?1:parseFloat(A[5]))),v.toColor(a,c,g,h);if(!y||!k)throw new Error("css.toColor: Unsupported css format");if(y.fillStyle=k,y.fillStyle=C,typeof y.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(y.fillRect(0,0,1,1),[a,c,g,h]=y.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:v.toRgba(a,c,g,h),css:C}}})(w||(o.css=w={})),(function(p){function y(k,C,A){const S=k/255,T=C/255,D=A/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.0722*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))}p.relativeLuminance=function(k){return y(k>>16&255,k>>8&255,255&k)},p.relativeLuminance2=y})(b||(o.rgb=b={})),(function(p){function y(C,A,S){const T=C>>24&255,D=C>>16&255,H=C>>8&255;let W=A>>24&255,M=A>>16&255,G=A>>8&255,X=l(b.relativeLuminance2(W,M,G),b.relativeLuminance2(T,D,H));for(;X<S&&(W>0||M>0||G>0);)W-=Math.max(0,Math.ceil(.1*W)),M-=Math.max(0,Math.ceil(.1*M)),G-=Math.max(0,Math.ceil(.1*G)),X=l(b.relativeLuminance2(W,M,G),b.relativeLuminance2(T,D,H));return(W<<24|M<<16|G<<8|255)>>>0}function k(C,A,S){const T=C>>24&255,D=C>>16&255,H=C>>8&255;let W=A>>24&255,M=A>>16&255,G=A>>8&255,X=l(b.relativeLuminance2(W,M,G),b.relativeLuminance2(T,D,H));for(;X<S&&(W<255||M<255||G<255);)W=Math.min(255,W+Math.ceil(.1*(255-W))),M=Math.min(255,M+Math.ceil(.1*(255-M))),G=Math.min(255,G+Math.ceil(.1*(255-G))),X=l(b.relativeLuminance2(W,M,G),b.relativeLuminance2(T,D,H));return(W<<24|M<<16|G<<8|255)>>>0}p.blend=function(C,A){if(h=(255&A)/255,h===1)return A;const S=A>>24&255,T=A>>16&255,D=A>>8&255,H=C>>24&255,W=C>>16&255,M=C>>8&255;return a=H+Math.round((S-H)*h),c=W+Math.round((T-W)*h),g=M+Math.round((D-M)*h),v.toRgba(a,c,g)},p.ensureContrastRatio=function(C,A,S){const T=b.relativeLuminance(C>>8),D=b.relativeLuminance(A>>8);if(l(T,D)<S){if(D<T){const M=y(C,A,S),G=l(T,b.relativeLuminance(M>>8));if(G<S){const X=k(C,A,S);return G>l(T,b.relativeLuminance(X>>8))?M:X}return M}const H=k(C,A,S),W=l(T,b.relativeLuminance(H>>8));if(W<S){const M=y(C,A,S);return W>l(T,b.relativeLuminance(M>>8))?H:M}return H}},p.reduceLuminance=y,p.increaseLuminance=k,p.toChannels=function(C){return[C>>24&255,C>>16&255,C>>8&255,255&C]}})(f||(o.rgba=f={})),o.toPaddedHex=u,o.contrastRatio=l},8969:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const c=a(844),g=a(2585),h=a(4348),v=a(7866),m=a(744),w=a(7302),b=a(6975),f=a(8460),u=a(1753),l=a(1480),p=a(7994),y=a(9282),k=a(5435),C=a(5981),A=a(2660);let S=!1;class T extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new f.EventEmitter),this._onScroll.event((H=>{var W;(W=this._onScrollApi)==null||W.fire(H.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(H){for(const W in H)this.optionsService.options[W]=H[W]}constructor(H){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new f.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new f.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new w.OptionsService(H)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(v.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(b.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(u.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(l.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(A.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new k.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,f.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,f.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,f.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,f.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((W=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((W=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new C.WriteBuffer(((W,M)=>this._inputHandler.parse(W,M)))),this.register((0,f.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(H,W){this._writeBuffer.write(H,W)}writeSync(H,W){this._logService.logLevel<=g.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(H,W)}input(H,W=!0){this.coreService.triggerDataEvent(H,W)}resize(H,W){isNaN(H)||isNaN(W)||(H=Math.max(H,m.MINIMUM_COLS),W=Math.max(W,m.MINIMUM_ROWS),this._bufferService.resize(H,W))}scroll(H,W=!1){this._bufferService.scroll(H,W)}scrollLines(H,W,M){this._bufferService.scrollLines(H,W,M)}scrollPages(H){this.scrollLines(H*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(H){const W=H-this._bufferService.buffer.ydisp;W!==0&&this.scrollLines(W)}registerEscHandler(H,W){return this._inputHandler.registerEscHandler(H,W)}registerDcsHandler(H,W){return this._inputHandler.registerDcsHandler(H,W)}registerCsiHandler(H,W){return this._inputHandler.registerCsiHandler(H,W)}registerOscHandler(H,W){return this._inputHandler.registerOscHandler(H,W)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let H=!1;const W=this.optionsService.rawOptions.windowsPty;W&&W.buildNumber!==void 0&&W.buildNumber!==void 0?H=W.backend==="conpty"&&W.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(H=!0),H?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const H=[];H.push(this.onLineFeed(y.updateWindowsModeWrappedState.bind(null,this._bufferService))),H.push(this.registerCsiHandler({final:"H"},(()=>((0,y.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(const W of H)W.dispose()}))}}}o.CoreTerminal=T},8460:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===a)return void this._listeners.splice(c,1)}}})),this._event}fire(a,c){const g=[];for(let h=0;h<this._listeners.length;h++)g.push(this._listeners[h]);for(let h=0;h<g.length;h++)g[h].call(void 0,a,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(a,c){return a((g=>c.fire(g)))},o.runAndSubscribe=function(a,c){return c(void 0),a((g=>c(g)))}},5435:function(_,o,a){var c=this&&this.__decorate||function(xe,R,j,N){var V,$=arguments.length,ee=$<3?R:N===null?N=Object.getOwnPropertyDescriptor(R,j):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ee=Reflect.decorate(xe,R,j,N);else for(var ce=xe.length-1;ce>=0;ce--)(V=xe[ce])&&(ee=($<3?V(ee):$>3?V(R,j,ee):V(R,j))||ee);return $>3&&ee&&Object.defineProperty(R,j,ee),ee},g=this&&this.__param||function(xe,R){return function(j,N){R(j,N,xe)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const h=a(2584),v=a(7116),m=a(2015),w=a(844),b=a(482),f=a(8437),u=a(8460),l=a(643),p=a(511),y=a(3734),k=a(2585),C=a(1480),A=a(6242),S=a(6351),T=a(5941),D={"(":0,")":1,"*":2,"+":3,"-":1,".":2},H=131072;function W(xe,R){if(xe>24)return R.setWinLines||!1;switch(xe){case 1:return!!R.restoreWin;case 2:return!!R.minimizeWin;case 3:return!!R.setWinPosition;case 4:return!!R.setWinSizePixels;case 5:return!!R.raiseWin;case 6:return!!R.lowerWin;case 7:return!!R.refreshWin;case 8:return!!R.setWinSizeChars;case 9:return!!R.maximizeWin;case 10:return!!R.fullscreenWin;case 11:return!!R.getWinState;case 13:return!!R.getWinPosition;case 14:return!!R.getWinSizePixels;case 15:return!!R.getScreenSizePixels;case 16:return!!R.getCellSizePixels;case 18:return!!R.getWinSizeChars;case 19:return!!R.getScreenSizeChars;case 20:return!!R.getIconTitle;case 21:return!!R.getWinTitle;case 22:return!!R.pushTitle;case 23:return!!R.popTitle;case 24:return!!R.setWinLines}return!1}var M;(function(xe){xe[xe.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",xe[xe.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(M||(o.WindowsOptionsReportType=M={}));let G=0;class X extends w.Disposable{getAttrData(){return this._curAttrData}constructor(R,j,N,V,$,ee,ce,ue,B=new m.EscapeSequenceParser){super(),this._bufferService=R,this._charsetService=j,this._coreService=N,this._logService=V,this._optionsService=$,this._oscLinkService=ee,this._coreMouseService=ce,this._unicodeService=ue,this._parser=B,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new b.StringToUtf32,this._utf8Decoder=new b.Utf8ToUtf32,this._workCell=new p.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new u.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new u.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new u.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new u.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new u.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new u.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new u.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new u.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new u.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new u.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new u.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new u.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new le(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((I=>this._activeBuffer=I.activeBuffer))),this._parser.setCsiHandlerFallback(((I,z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(I),params:z.toArray()})})),this._parser.setEscHandlerFallback((I=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(I)})})),this._parser.setExecuteHandlerFallback((I=>{this._logService.debug("Unknown EXECUTE code: ",{code:I})})),this._parser.setOscHandlerFallback(((I,z,O)=>{this._logService.debug("Unknown OSC code: ",{identifier:I,action:z,data:O})})),this._parser.setDcsHandlerFallback(((I,z,O)=>{z==="HOOK"&&(O=O.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(I),action:z,payload:O})})),this._parser.setPrintHandler(((I,z,O)=>this.print(I,z,O))),this._parser.registerCsiHandler({final:"@"},(I=>this.insertChars(I))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(I=>this.scrollLeft(I))),this._parser.registerCsiHandler({final:"A"},(I=>this.cursorUp(I))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(I=>this.scrollRight(I))),this._parser.registerCsiHandler({final:"B"},(I=>this.cursorDown(I))),this._parser.registerCsiHandler({final:"C"},(I=>this.cursorForward(I))),this._parser.registerCsiHandler({final:"D"},(I=>this.cursorBackward(I))),this._parser.registerCsiHandler({final:"E"},(I=>this.cursorNextLine(I))),this._parser.registerCsiHandler({final:"F"},(I=>this.cursorPrecedingLine(I))),this._parser.registerCsiHandler({final:"G"},(I=>this.cursorCharAbsolute(I))),this._parser.registerCsiHandler({final:"H"},(I=>this.cursorPosition(I))),this._parser.registerCsiHandler({final:"I"},(I=>this.cursorForwardTab(I))),this._parser.registerCsiHandler({final:"J"},(I=>this.eraseInDisplay(I,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(I=>this.eraseInDisplay(I,!0))),this._parser.registerCsiHandler({final:"K"},(I=>this.eraseInLine(I,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(I=>this.eraseInLine(I,!0))),this._parser.registerCsiHandler({final:"L"},(I=>this.insertLines(I))),this._parser.registerCsiHandler({final:"M"},(I=>this.deleteLines(I))),this._parser.registerCsiHandler({final:"P"},(I=>this.deleteChars(I))),this._parser.registerCsiHandler({final:"S"},(I=>this.scrollUp(I))),this._parser.registerCsiHandler({final:"T"},(I=>this.scrollDown(I))),this._parser.registerCsiHandler({final:"X"},(I=>this.eraseChars(I))),this._parser.registerCsiHandler({final:"Z"},(I=>this.cursorBackwardTab(I))),this._parser.registerCsiHandler({final:"`"},(I=>this.charPosAbsolute(I))),this._parser.registerCsiHandler({final:"a"},(I=>this.hPositionRelative(I))),this._parser.registerCsiHandler({final:"b"},(I=>this.repeatPrecedingCharacter(I))),this._parser.registerCsiHandler({final:"c"},(I=>this.sendDeviceAttributesPrimary(I))),this._parser.registerCsiHandler({prefix:">",final:"c"},(I=>this.sendDeviceAttributesSecondary(I))),this._parser.registerCsiHandler({final:"d"},(I=>this.linePosAbsolute(I))),this._parser.registerCsiHandler({final:"e"},(I=>this.vPositionRelative(I))),this._parser.registerCsiHandler({final:"f"},(I=>this.hVPosition(I))),this._parser.registerCsiHandler({final:"g"},(I=>this.tabClear(I))),this._parser.registerCsiHandler({final:"h"},(I=>this.setMode(I))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(I=>this.setModePrivate(I))),this._parser.registerCsiHandler({final:"l"},(I=>this.resetMode(I))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(I=>this.resetModePrivate(I))),this._parser.registerCsiHandler({final:"m"},(I=>this.charAttributes(I))),this._parser.registerCsiHandler({final:"n"},(I=>this.deviceStatus(I))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(I=>this.deviceStatusPrivate(I))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(I=>this.softReset(I))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(I=>this.setCursorStyle(I))),this._parser.registerCsiHandler({final:"r"},(I=>this.setScrollRegion(I))),this._parser.registerCsiHandler({final:"s"},(I=>this.saveCursor(I))),this._parser.registerCsiHandler({final:"t"},(I=>this.windowOptions(I))),this._parser.registerCsiHandler({final:"u"},(I=>this.restoreCursor(I))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(I=>this.insertColumns(I))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(I=>this.deleteColumns(I))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(I=>this.selectProtected(I))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(I=>this.requestMode(I,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(I=>this.requestMode(I,!1))),this._parser.setExecuteHandler(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new A.OscHandler((I=>(this.setTitle(I),this.setIconName(I),!0)))),this._parser.registerOscHandler(1,new A.OscHandler((I=>this.setIconName(I)))),this._parser.registerOscHandler(2,new A.OscHandler((I=>this.setTitle(I)))),this._parser.registerOscHandler(4,new A.OscHandler((I=>this.setOrReportIndexedColor(I)))),this._parser.registerOscHandler(8,new A.OscHandler((I=>this.setHyperlink(I)))),this._parser.registerOscHandler(10,new A.OscHandler((I=>this.setOrReportFgColor(I)))),this._parser.registerOscHandler(11,new A.OscHandler((I=>this.setOrReportBgColor(I)))),this._parser.registerOscHandler(12,new A.OscHandler((I=>this.setOrReportCursorColor(I)))),this._parser.registerOscHandler(104,new A.OscHandler((I=>this.restoreIndexedColor(I)))),this._parser.registerOscHandler(110,new A.OscHandler((I=>this.restoreFgColor(I)))),this._parser.registerOscHandler(111,new A.OscHandler((I=>this.restoreBgColor(I)))),this._parser.registerOscHandler(112,new A.OscHandler((I=>this.restoreCursorColor(I)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const I in v.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:I},(()=>this.selectCharset("("+I))),this._parser.registerEscHandler({intermediates:")",final:I},(()=>this.selectCharset(")"+I))),this._parser.registerEscHandler({intermediates:"*",final:I},(()=>this.selectCharset("*"+I))),this._parser.registerEscHandler({intermediates:"+",final:I},(()=>this.selectCharset("+"+I))),this._parser.registerEscHandler({intermediates:"-",final:I},(()=>this.selectCharset("-"+I))),this._parser.registerEscHandler({intermediates:".",final:I},(()=>this.selectCharset("."+I))),this._parser.registerEscHandler({intermediates:"/",final:I},(()=>this.selectCharset("/"+I)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((I=>(this._logService.error("Parsing error: ",I),I))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new S.DcsHandler(((I,z)=>this.requestStatusString(I,z))))}_preserveStack(R,j,N,V){this._parseStack.paused=!0,this._parseStack.cursorStartX=R,this._parseStack.cursorStartY=j,this._parseStack.decodedLength=N,this._parseStack.position=V}_logSlowResolvingAsync(R){this._logService.logLevel<=k.LogLevelEnum.WARN&&Promise.race([R,new Promise(((j,N)=>setTimeout((()=>N("#SLOW_TIMEOUT")),5e3)))]).catch((j=>{if(j!=="#SLOW_TIMEOUT")throw j;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(R,j){let N,V=this._activeBuffer.x,$=this._activeBuffer.y,ee=0;const ce=this._parseStack.paused;if(ce){if(N=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,j))return this._logSlowResolvingAsync(N),N;V=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,R.length>H&&(ee=this._parseStack.position+H)}if(this._logService.logLevel<=k.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof R=="string"?` "${R}"`:` "${Array.prototype.map.call(R,(I=>String.fromCharCode(I))).join("")}"`),typeof R=="string"?R.split("").map((I=>I.charCodeAt(0))):R),this._parseBuffer.length<R.length&&this._parseBuffer.length<H&&(this._parseBuffer=new Uint32Array(Math.min(R.length,H))),ce||this._dirtyRowTracker.clearRange(),R.length>H)for(let I=ee;I<R.length;I+=H){const z=I+H<R.length?I+H:R.length,O=typeof R=="string"?this._stringDecoder.decode(R.substring(I,z),this._parseBuffer):this._utf8Decoder.decode(R.subarray(I,z),this._parseBuffer);if(N=this._parser.parse(this._parseBuffer,O))return this._preserveStack(V,$,O,I),this._logSlowResolvingAsync(N),N}else if(!ce){const I=typeof R=="string"?this._stringDecoder.decode(R,this._parseBuffer):this._utf8Decoder.decode(R,this._parseBuffer);if(N=this._parser.parse(this._parseBuffer,I))return this._preserveStack(V,$,I,0),this._logSlowResolvingAsync(N),N}this._activeBuffer.x===V&&this._activeBuffer.y===$||this._onCursorMove.fire();const ue=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),B=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);B<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(B,this._bufferService.rows-1),Math.min(ue,this._bufferService.rows-1))}print(R,j,N){let V,$;const ee=this._charsetService.charset,ce=this._optionsService.rawOptions.screenReaderMode,ue=this._bufferService.cols,B=this._coreService.decPrivateModes.wraparound,I=this._coreService.modes.insertMode,z=this._curAttrData;let O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&N-j>0&&O.getWidth(this._activeBuffer.x-1)===2&&O.setCellFromCodepoint(this._activeBuffer.x-1,0,1,z);let ne=this._parser.precedingJoinState;for(let ae=j;ae<N;++ae){if(V=R[ae],V<127&&ee){const Ie=ee[String.fromCharCode(V)];Ie&&(V=Ie.charCodeAt(0))}const te=this._unicodeService.charProperties(V,ne);$=C.UnicodeService.extractWidth(te);const ge=C.UnicodeService.extractShouldJoin(te),we=ge?C.UnicodeService.extractWidth(ne):0;if(ne=te,ce&&this._onA11yChar.fire((0,b.stringFromCodePoint)(V)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+$-we>ue){if(B){const Ie=O;let Pe=this._activeBuffer.x-we;for(this._activeBuffer.x=we,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),we>0&&O instanceof f.BufferLine&&O.copyCellsFrom(Ie,Pe,0,we,!1);Pe<ue;)Ie.setCellFromCodepoint(Pe++,0,1,z)}else if(this._activeBuffer.x=ue-1,$===2)continue}if(ge&&this._activeBuffer.x){const Ie=O.getWidth(this._activeBuffer.x-1)?1:2;O.addCodepointToCell(this._activeBuffer.x-Ie,V,$);for(let Pe=$-we;--Pe>=0;)O.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}else if(I&&(O.insertCells(this._activeBuffer.x,$-we,this._activeBuffer.getNullCell(z)),O.getWidth(ue-1)===2&&O.setCellFromCodepoint(ue-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,z)),O.setCellFromCodepoint(this._activeBuffer.x++,V,$,z),$>0)for(;--$;)O.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}this._parser.precedingJoinState=ne,this._activeBuffer.x<ue&&N-j>0&&O.getWidth(this._activeBuffer.x)===0&&!O.hasContent(this._activeBuffer.x)&&O.setCellFromCodepoint(this._activeBuffer.x,0,1,z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(R,j){return R.final!=="t"||R.prefix||R.intermediates?this._parser.registerCsiHandler(R,j):this._parser.registerCsiHandler(R,(N=>!W(N.params[0],this._optionsService.rawOptions.windowOptions)||j(N)))}registerDcsHandler(R,j){return this._parser.registerDcsHandler(R,new S.DcsHandler(j))}registerEscHandler(R,j){return this._parser.registerEscHandler(R,j)}registerOscHandler(R,j){return this._parser.registerOscHandler(R,new A.OscHandler(j))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var R;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&R.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);j.hasWidth(this._activeBuffer.x)&&!j.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const R=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-R),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(R=this._bufferService.cols-1){this._activeBuffer.x=Math.min(R,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(R,j){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=R,this._activeBuffer.y=this._activeBuffer.scrollTop+j):(this._activeBuffer.x=R,this._activeBuffer.y=j),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(R,j){this._restrictCursor(),this._setCursor(this._activeBuffer.x+R,this._activeBuffer.y+j)}cursorUp(R){const j=this._activeBuffer.y-this._activeBuffer.scrollTop;return j>=0?this._moveCursor(0,-Math.min(j,R.params[0]||1)):this._moveCursor(0,-(R.params[0]||1)),!0}cursorDown(R){const j=this._activeBuffer.scrollBottom-this._activeBuffer.y;return j>=0?this._moveCursor(0,Math.min(j,R.params[0]||1)):this._moveCursor(0,R.params[0]||1),!0}cursorForward(R){return this._moveCursor(R.params[0]||1,0),!0}cursorBackward(R){return this._moveCursor(-(R.params[0]||1),0),!0}cursorNextLine(R){return this.cursorDown(R),this._activeBuffer.x=0,!0}cursorPrecedingLine(R){return this.cursorUp(R),this._activeBuffer.x=0,!0}cursorCharAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(R){return this._setCursor(R.length>=2?(R.params[1]||1)-1:0,(R.params[0]||1)-1),!0}charPosAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(R){return this._moveCursor(R.params[0]||1,0),!0}linePosAbsolute(R){return this._setCursor(this._activeBuffer.x,(R.params[0]||1)-1),!0}vPositionRelative(R){return this._moveCursor(0,R.params[0]||1),!0}hVPosition(R){return this.cursorPosition(R),!0}tabClear(R){const j=R.params[0];return j===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:j===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let j=R.params[0]||1;for(;j--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let j=R.params[0]||1;for(;j--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(R){const j=R.params[0];return j===1&&(this._curAttrData.bg|=536870912),j!==2&&j!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(R,j,N,V=!1,$=!1){const ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);ee.replaceCells(j,N,this._activeBuffer.getNullCell(this._eraseAttrData()),$),V&&(ee.isWrapped=!1)}_resetBufferLine(R,j=!1){const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);N&&(N.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),j),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+R),N.isWrapped=!1)}eraseInDisplay(R,j=!1){let N;switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:for(N=this._activeBuffer.y,this._dirtyRowTracker.markDirty(N),this._eraseInBufferLine(N++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,j);N<this._bufferService.rows;N++)this._resetBufferLine(N,j);this._dirtyRowTracker.markDirty(N);break;case 1:for(N=this._activeBuffer.y,this._dirtyRowTracker.markDirty(N),this._eraseInBufferLine(N,0,this._activeBuffer.x+1,!0,j),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(N+1).isWrapped=!1);N--;)this._resetBufferLine(N,j);this._dirtyRowTracker.markDirty(0);break;case 2:for(N=this._bufferService.rows,this._dirtyRowTracker.markDirty(N-1);N--;)this._resetBufferLine(N,j);this._dirtyRowTracker.markDirty(0);break;case 3:const V=this._activeBuffer.lines.length-this._bufferService.rows;V>0&&(this._activeBuffer.lines.trimStart(V),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-V,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-V,0),this._onScroll.fire(0))}return!0}eraseInLine(R,j=!1){switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,j);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,j);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,j)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(R){this._restrictCursor();let j=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=this._activeBuffer.ybase+this._activeBuffer.y,V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-V+1;for(;j--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(N,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(R){this._restrictCursor();let j=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=this._activeBuffer.ybase+this._activeBuffer.y;let V;for(V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-V;j--;)this._activeBuffer.lines.splice(N,1),this._activeBuffer.lines.splice(V,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(R){this._restrictCursor();const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.insertCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(R){this._restrictCursor();const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.deleteCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(R){let j=R.params[0]||1;for(;j--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(R){let j=R.params[0]||1;for(;j--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(f.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);V.deleteCells(0,j,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);V.insertCells(0,j,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);V.insertCells(this._activeBuffer.x,j,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);V.deleteCells(this._activeBuffer.x,j,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(R){this._restrictCursor();const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(R.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(R){const j=this._parser.precedingJoinState;if(!j)return!0;const N=R.params[0]||1,V=C.UnicodeService.extractWidth(j),$=this._activeBuffer.x-V,ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString($),ce=new Uint32Array(ee.length*N);let ue=0;for(let I=0;I<ee.length;){const z=ee.codePointAt(I)||0;ce[ue++]=z,I+=z>65535?2:1}let B=ue;for(let I=1;I<N;++I)ce.copyWithin(B,0,ue),B+=ue;return this.print(ce,0,B),!0}sendDeviceAttributesPrimary(R){return R.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(R){return R.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(R.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(R){return(this._optionsService.rawOptions.termName+"").indexOf(R)===0}setMode(R){for(let j=0;j<R.length;j++)switch(R.params[j]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(R){for(let j=0;j<R.length;j++)switch(R.params[j]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,v.DEFAULT_CHARSET),this._charsetService.setgCharset(1,v.DEFAULT_CHARSET),this._charsetService.setgCharset(2,v.DEFAULT_CHARSET),this._charsetService.setgCharset(3,v.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(R){for(let j=0;j<R.length;j++)switch(R.params[j]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(R){for(let j=0;j<R.length;j++)switch(R.params[j]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),R.params[j]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(R,j){const N=this._coreService.decPrivateModes,{activeProtocol:V,activeEncoding:$}=this._coreMouseService,ee=this._coreService,{buffers:ce,cols:ue}=this._bufferService,{active:B,alt:I}=ce,z=this._optionsService.rawOptions,O=ge=>ge?1:2,ne=R.params[0];return ae=ne,te=j?ne===2?4:ne===4?O(ee.modes.insertMode):ne===12?3:ne===20?O(z.convertEol):0:ne===1?O(N.applicationCursorKeys):ne===3?z.windowOptions.setWinLines?ue===80?2:ue===132?1:0:0:ne===6?O(N.origin):ne===7?O(N.wraparound):ne===8?3:ne===9?O(V==="X10"):ne===12?O(z.cursorBlink):ne===25?O(!ee.isCursorHidden):ne===45?O(N.reverseWraparound):ne===66?O(N.applicationKeypad):ne===67?4:ne===1e3?O(V==="VT200"):ne===1002?O(V==="DRAG"):ne===1003?O(V==="ANY"):ne===1004?O(N.sendFocus):ne===1005?4:ne===1006?O($==="SGR"):ne===1015?4:ne===1016?O($==="SGR_PIXELS"):ne===1048?1:ne===47||ne===1047||ne===1049?O(B===I):ne===2004?O(N.bracketedPasteMode):0,ee.triggerDataEvent(`${h.C0.ESC}[${j?"":"?"}${ae};${te}$y`),!0;var ae,te}_updateAttrColor(R,j,N,V,$){return j===2?(R|=50331648,R&=-16777216,R|=y.AttributeData.fromColorRGB([N,V,$])):j===5&&(R&=-50331904,R|=33554432|255&N),R}_extractColor(R,j,N){const V=[0,0,-1,0,0,0];let $=0,ee=0;do{if(V[ee+$]=R.params[j+ee],R.hasSubParams(j+ee)){const ce=R.getSubParams(j+ee);let ue=0;do V[1]===5&&($=1),V[ee+ue+1+$]=ce[ue];while(++ue<ce.length&&ue+ee+1+$<V.length);break}if(V[1]===5&&ee+$>=2||V[1]===2&&ee+$>=5)break;V[1]&&($=1)}while(++ee+j<R.length&&ee+$<V.length);for(let ce=2;ce<V.length;++ce)V[ce]===-1&&(V[ce]=0);switch(V[0]){case 38:N.fg=this._updateAttrColor(N.fg,V[1],V[3],V[4],V[5]);break;case 48:N.bg=this._updateAttrColor(N.bg,V[1],V[3],V[4],V[5]);break;case 58:N.extended=N.extended.clone(),N.extended.underlineColor=this._updateAttrColor(N.extended.underlineColor,V[1],V[3],V[4],V[5])}return ee}_processUnderline(R,j){j.extended=j.extended.clone(),(!~R||R>5)&&(R=1),j.extended.underlineStyle=R,j.fg|=268435456,R===0&&(j.fg&=-268435457),j.updateExtended()}_processSGR0(R){R.fg=f.DEFAULT_ATTR_DATA.fg,R.bg=f.DEFAULT_ATTR_DATA.bg,R.extended=R.extended.clone(),R.extended.underlineStyle=0,R.extended.underlineColor&=-67108864,R.updateExtended()}charAttributes(R){if(R.length===1&&R.params[0]===0)return this._processSGR0(this._curAttrData),!0;const j=R.length;let N;const V=this._curAttrData;for(let $=0;$<j;$++)N=R.params[$],N>=30&&N<=37?(V.fg&=-50331904,V.fg|=16777216|N-30):N>=40&&N<=47?(V.bg&=-50331904,V.bg|=16777216|N-40):N>=90&&N<=97?(V.fg&=-50331904,V.fg|=16777224|N-90):N>=100&&N<=107?(V.bg&=-50331904,V.bg|=16777224|N-100):N===0?this._processSGR0(V):N===1?V.fg|=134217728:N===3?V.bg|=67108864:N===4?(V.fg|=268435456,this._processUnderline(R.hasSubParams($)?R.getSubParams($)[0]:1,V)):N===5?V.fg|=536870912:N===7?V.fg|=67108864:N===8?V.fg|=1073741824:N===9?V.fg|=2147483648:N===2?V.bg|=134217728:N===21?this._processUnderline(2,V):N===22?(V.fg&=-134217729,V.bg&=-134217729):N===23?V.bg&=-67108865:N===24?(V.fg&=-268435457,this._processUnderline(0,V)):N===25?V.fg&=-536870913:N===27?V.fg&=-67108865:N===28?V.fg&=-1073741825:N===29?V.fg&=2147483647:N===39?(V.fg&=-67108864,V.fg|=16777215&f.DEFAULT_ATTR_DATA.fg):N===49?(V.bg&=-67108864,V.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):N===38||N===48||N===58?$+=this._extractColor(R,$,V):N===53?V.bg|=1073741824:N===55?V.bg&=-1073741825:N===59?(V.extended=V.extended.clone(),V.extended.underlineColor=-1,V.updateExtended()):N===100?(V.fg&=-67108864,V.fg|=16777215&f.DEFAULT_ATTR_DATA.fg,V.bg&=-67108864,V.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",N);return!0}deviceStatus(R){switch(R.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const j=this._activeBuffer.y+1,N=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${j};${N}R`)}return!0}deviceStatusPrivate(R){if(R.params[0]===6){const j=this._activeBuffer.y+1,N=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${j};${N}R`)}return!0}softReset(R){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(R){const j=R.params[0]||1;switch(j){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const N=j%2==1;return this._optionsService.options.cursorBlink=N,!0}setScrollRegion(R){const j=R.params[0]||1;let N;return(R.length<2||(N=R.params[1])>this._bufferService.rows||N===0)&&(N=this._bufferService.rows),N>j&&(this._activeBuffer.scrollTop=j-1,this._activeBuffer.scrollBottom=N-1,this._setCursor(0,0)),!0}windowOptions(R){if(!W(R.params[0],this._optionsService.rawOptions.windowOptions))return!0;const j=R.length>1?R.params[1]:0;switch(R.params[0]){case 14:j!==2&&this._onRequestWindowsOptionsReport.fire(M.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(M.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:j!==0&&j!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),j!==0&&j!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:j!==0&&j!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),j!==0&&j!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(R){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(R){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(R){return this._windowTitle=R,this._onTitleChange.fire(R),!0}setIconName(R){return this._iconName=R,!0}setOrReportIndexedColor(R){const j=[],N=R.split(";");for(;N.length>1;){const V=N.shift(),$=N.shift();if(/^\d+$/.exec(V)){const ee=parseInt(V);if(me(ee))if($==="?")j.push({type:0,index:ee});else{const ce=(0,T.parseColor)($);ce&&j.push({type:1,index:ee,color:ce})}}}return j.length&&this._onColor.fire(j),!0}setHyperlink(R){const j=R.split(";");return!(j.length<2)&&(j[1]?this._createHyperlink(j[0],j[1]):!j[0]&&this._finishHyperlink())}_createHyperlink(R,j){this._getCurrentLinkId()&&this._finishHyperlink();const N=R.split(":");let V;const $=N.findIndex((ee=>ee.startsWith("id=")));return $!==-1&&(V=N[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:V,uri:j}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(R,j){const N=R.split(";");for(let V=0;V<N.length&&!(j>=this._specialColors.length);++V,++j)if(N[V]==="?")this._onColor.fire([{type:0,index:this._specialColors[j]}]);else{const $=(0,T.parseColor)(N[V]);$&&this._onColor.fire([{type:1,index:this._specialColors[j],color:$}])}return!0}setOrReportFgColor(R){return this._setOrReportSpecialColor(R,0)}setOrReportBgColor(R){return this._setOrReportSpecialColor(R,1)}setOrReportCursorColor(R){return this._setOrReportSpecialColor(R,2)}restoreIndexedColor(R){if(!R)return this._onColor.fire([{type:2}]),!0;const j=[],N=R.split(";");for(let V=0;V<N.length;++V)if(/^\d+$/.exec(N[V])){const $=parseInt(N[V]);me($)&&j.push({type:2,index:$})}return j.length&&this._onColor.fire(j),!0}restoreFgColor(R){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(R){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(R){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,v.DEFAULT_CHARSET),!0}selectCharset(R){return R.length!==2?(this.selectDefaultCharset(),!0):(R[0]==="/"||this._charsetService.setgCharset(D[R[0]],v.CHARSETS[R[1]]||v.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const R=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,R,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(R){return this._charsetService.setgLevel(R),!0}screenAlignmentPattern(){const R=new p.CellData;R.content=4194373,R.fg=this._curAttrData.fg,R.bg=this._curAttrData.bg,this._setCursor(0,0);for(let j=0;j<this._bufferService.rows;++j){const N=this._activeBuffer.ybase+this._activeBuffer.y+j,V=this._activeBuffer.lines.get(N);V&&(V.fill(R),V.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(R,j){const N=this._bufferService.buffer,V=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${$}${h.C0.ESC}\\`),!0))(R==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:R==='"p'?'P1$r61;1"p':R==="r"?`P1$r${N.scrollTop+1};${N.scrollBottom+1}r`:R==="m"?"P1$r0m":R===" q"?`P1$r${{block:2,underline:4,bar:6}[V.cursorStyle]-(V.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(R,j){this._dirtyRowTracker.markRangeDirty(R,j)}}o.InputHandler=X;let le=class{constructor(xe){this._bufferService=xe,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(xe){xe<this.start?this.start=xe:xe>this.end&&(this.end=xe)}markRangeDirty(xe,R){xe>R&&(G=xe,xe=R,R=G),xe<this.start&&(this.start=xe),R>this.end&&(this.end=R)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function me(xe){return 0<=xe&&xe<256}le=c([g(0,k.IBufferService)],le)},844:(_,o)=>{function a(c){for(const g of c)g.dispose();c.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const g=this._disposables.indexOf(c);g!==-1&&this._disposables.splice(g,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var g;this._isDisposed||c===this._value||((g=this._value)==null||g.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},o.toDisposable=function(c){return{dispose:c}},o.disposeArray=a,o.getDisposeArrayDisposable=function(c){return{dispose:()=>a(c)}}},1505:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(g,h,v){this._data[g]||(this._data[g]={}),this._data[g][h]=v}get(g,h){return this._data[g]?this._data[g][h]:void 0}clear(){this._data={}}}o.TwoKeyMap=a,o.FourKeyMap=class{constructor(){this._data=new a}set(c,g,h,v,m){this._data.get(c,g)||this._data.set(c,g,new a),this._data.get(c,g).set(h,v,m)}get(c,g,h,v){var m;return(m=this._data.get(c,g))==null?void 0:m.get(h,v)}clear(){this._data.clear()}}},6114:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const a=o.isNode?"node":navigator.userAgent,c=o.isNode?"node":navigator.platform;o.isFirefox=a.includes("Firefox"),o.isLegacyEdge=a.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(a),o.getSafariVersion=function(){if(!o.isSafari)return 0;const g=a.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),o.isIpad=c==="iPad",o.isIphone=c==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),o.isLinux=c.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(a)},6106:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let a=0;o.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(a=this._search(this._getKey(c)),this._array.splice(a,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const g=this._getKey(c);if(g===void 0||(a=this._search(g),a===-1)||this._getKey(this._array[a])!==g)return!1;do if(this._array[a]===c)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===g);return!1}*getKeyIterator(c){if(this._array.length!==0&&(a=this._search(c),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===c))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===c)}forEachByKey(c,g){if(this._array.length!==0&&(a=this._search(c),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===c))do g(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===c)}values(){return[...this._array].values()}_search(c){let g=0,h=this._array.length-1;for(;h>=g;){let v=g+h>>1;const m=this._getKey(this._array[v]);if(m>c)h=v-1;else{if(!(m<c)){for(;v>0&&this._getKey(this._array[v-1])===c;)v--;return v}g=v+1}}return g}}},7226:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const c=a(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(m){this._tasks.push(m),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(m){this._idleCallback=void 0;let w=0,b=0,f=m.timeRemaining(),u=0;for(;this._i<this._tasks.length;){if(w=Date.now(),this._tasks[this._i]()||this._i++,w=Math.max(1,Date.now()-w),b=Math.max(w,b),u=m.timeRemaining(),1.5*b>u)return f-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(f-w))}ms`),void this._start();f=u}this.clear()}}class h extends g{_requestCallback(m){return setTimeout((()=>m(this._createDeadline(16))))}_cancelCallback(m){clearTimeout(m)}_createDeadline(m){const w=Date.now()+m;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}o.PriorityTaskQueue=h,o.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(v){return requestIdleCallback(v)}_cancelCallback(v){cancelIdleCallback(v)}}:h,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(v){this._queue.clear(),this._queue.enqueue(v)}flush(){this._queue.flush()}}},9282:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const c=a(643);o.updateWindowsModeWrappedState=function(g){const h=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),v=h==null?void 0:h.get(g.cols-1),m=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);m&&v&&(m.isWrapped=v[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&v[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new a;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}o.AttributeData=a;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,v=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=v}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=c},9092:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const c=a(6349),g=a(7226),h=a(3734),v=a(8437),m=a(4634),w=a(511),b=a(643),f=a(4863),u=a(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(l,p,y){this._hasScrollback=l,this._optionsService=p,this._bufferService=y,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=v.DEFAULT_ATTR_DATA.clone(),this.savedCharset=u.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,b.NULL_CELL_CHAR,b.NULL_CELL_WIDTH,b.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,b.WHITESPACE_CELL_CHAR,b.WHITESPACE_CELL_WIDTH,b.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(l,p){return new v.BufferLine(this._bufferService.cols,this.getNullCell(l),p)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows}_getCorrectBufferLength(l){if(!this._hasScrollback)return l;const p=l+this._optionsService.rawOptions.scrollback;return p>o.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:p}fillViewportRows(l){if(this.lines.length===0){l===void 0&&(l=v.DEFAULT_ATTR_DATA);let p=this._rows;for(;p--;)this.lines.push(this.getBlankLine(l))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(l,p){const y=this.getNullCell(v.DEFAULT_ATTR_DATA);let k=0;const C=this._getCorrectBufferLength(p);if(C>this.lines.maxLength&&(this.lines.maxLength=C),this.lines.length>0){if(this._cols<l)for(let S=0;S<this.lines.length;S++)k+=+this.lines.get(S).resize(l,y);let A=0;if(this._rows<p)for(let S=this._rows;S<p;S++)this.lines.length<p+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new v.BufferLine(l,y)):this.ybase>0&&this.lines.length<=this.ybase+this.y+A+1?(this.ybase--,A++,this.ydisp>0&&this.ydisp--):this.lines.push(new v.BufferLine(l,y)));else for(let S=this._rows;S>p;S--)this.lines.length>p+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(C<this.lines.maxLength){const S=this.lines.length-C;S>0&&(this.lines.trimStart(S),this.ybase=Math.max(this.ybase-S,0),this.ydisp=Math.max(this.ydisp-S,0),this.savedY=Math.max(this.savedY-S,0)),this.lines.maxLength=C}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,p-1),A&&(this.y+=A),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=p-1,this._isReflowEnabled&&(this._reflow(l,p),this._cols>l))for(let A=0;A<this.lines.length;A++)k+=+this.lines.get(A).resize(l,y);this._cols=l,this._rows=p,this._memoryCleanupQueue.clear(),k>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let l=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,l=!1);let p=0;for(;this._memoryCleanupPosition<this.lines.length;)if(p+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),p>100)return!0;return l}get _isReflowEnabled(){const l=this._optionsService.rawOptions.windowsPty;return l&&l.buildNumber?this._hasScrollback&&l.backend==="conpty"&&l.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(l,p){this._cols!==l&&(l>this._cols?this._reflowLarger(l,p):this._reflowSmaller(l,p))}_reflowLarger(l,p){const y=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(v.DEFAULT_ATTR_DATA));if(y.length>0){const k=(0,m.reflowLargerCreateNewLayout)(this.lines,y);(0,m.reflowLargerApplyNewLayout)(this.lines,k.layout),this._reflowLargerAdjustViewport(l,p,k.countRemoved)}}_reflowLargerAdjustViewport(l,p,y){const k=this.getNullCell(v.DEFAULT_ATTR_DATA);let C=y;for(;C-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<p&&this.lines.push(new v.BufferLine(l,k))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-y,0)}_reflowSmaller(l,p){const y=this.getNullCell(v.DEFAULT_ATTR_DATA),k=[];let C=0;for(let A=this.lines.length-1;A>=0;A--){let S=this.lines.get(A);if(!S||!S.isWrapped&&S.getTrimmedLength()<=l)continue;const T=[S];for(;S.isWrapped&&A>0;)S=this.lines.get(--A),T.unshift(S);const D=this.ybase+this.y;if(D>=A&&D<A+T.length)continue;const H=T[T.length-1].getTrimmedLength(),W=(0,m.reflowSmallerGetNewLineLengths)(T,this._cols,l),M=W.length-T.length;let G;G=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+M):Math.max(0,this.lines.length-this.lines.maxLength+M);const X=[];for(let N=0;N<M;N++){const V=this.getBlankLine(v.DEFAULT_ATTR_DATA,!0);X.push(V)}X.length>0&&(k.push({start:A+T.length+C,newLines:X}),C+=X.length),T.push(...X);let le=W.length-1,me=W[le];me===0&&(le--,me=W[le]);let xe=T.length-M-1,R=H;for(;xe>=0;){const N=Math.min(R,me);if(T[le]===void 0)break;if(T[le].copyCellsFrom(T[xe],R-N,me-N,N,!0),me-=N,me===0&&(le--,me=W[le]),R-=N,R===0){xe--;const V=Math.max(xe,0);R=(0,m.getWrappedLineTrimmedLength)(T,V,this._cols)}}for(let N=0;N<T.length;N++)W[N]<l&&T[N].setCell(W[N],y);let j=M-G;for(;j-- >0;)this.ybase===0?this.y<p-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+C)-p&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+M,this.ybase+p-1)}if(k.length>0){const A=[],S=[];for(let le=0;le<this.lines.length;le++)S.push(this.lines.get(le));const T=this.lines.length;let D=T-1,H=0,W=k[H];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+C);let M=0;for(let le=Math.min(this.lines.maxLength-1,T+C-1);le>=0;le--)if(W&&W.start>D+M){for(let me=W.newLines.length-1;me>=0;me--)this.lines.set(le--,W.newLines[me]);le++,A.push({index:D+1,amount:W.newLines.length}),M+=W.newLines.length,W=k[++H]}else this.lines.set(le,S[D--]);let G=0;for(let le=A.length-1;le>=0;le--)A[le].index+=G,this.lines.onInsertEmitter.fire(A[le]),G+=A[le].amount;const X=Math.max(0,T+C-this.lines.maxLength);X>0&&this.lines.onTrimEmitter.fire(X)}}translateBufferLineToString(l,p,y=0,k){const C=this.lines.get(l);return C?C.translateToString(p,y,k):""}getWrappedRangeForLine(l){let p=l,y=l;for(;p>0&&this.lines.get(p).isWrapped;)p--;for(;y+1<this.lines.length&&this.lines.get(y+1).isWrapped;)y++;return{first:p,last:y}}setupTabStops(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.rawOptions.tabStopWidth)this.tabs[l]=!0}prevStop(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l}nextStop(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l}clearMarkers(l){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].line===l&&(this.markers[p].dispose(),this.markers.splice(p--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let l=0;l<this.markers.length;l++)this.markers[l].dispose(),this.markers.splice(l--,1);this._isClearing=!1}addMarker(l){const p=new f.Marker(l);return this.markers.push(p),p.register(this.lines.onTrim((y=>{p.line-=y,p.line<0&&p.dispose()}))),p.register(this.lines.onInsert((y=>{p.line>=y.index&&(p.line+=y.amount)}))),p.register(this.lines.onDelete((y=>{p.line>=y.index&&p.line<y.index+y.amount&&p.dispose(),p.line>y.index&&(p.line-=y.amount)}))),p.register(p.onDispose((()=>this._removeMarker(p)))),p}_removeMarker(l){this._isClearing||this.markers.splice(this.markers.indexOf(l),1)}}},8437:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const c=a(3734),g=a(511),h=a(643),v=a(482);o.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let m=0;class w{constructor(f,u,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*f);const p=u||g.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let y=0;y<f;++y)this.setCell(y,p);this.length=f}get(f){const u=this._data[3*f+0],l=2097151&u;return[this._data[3*f+1],2097152&u?this._combined[f]:l?(0,v.stringFromCodePoint)(l):"",u>>22,2097152&u?this._combined[f].charCodeAt(this._combined[f].length-1):l]}set(f,u){this._data[3*f+1]=u[h.CHAR_DATA_ATTR_INDEX],u[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[f]=u[1],this._data[3*f+0]=2097152|f|u[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*f+0]=u[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|u[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(f){return this._data[3*f+0]>>22}hasWidth(f){return 12582912&this._data[3*f+0]}getFg(f){return this._data[3*f+1]}getBg(f){return this._data[3*f+2]}hasContent(f){return 4194303&this._data[3*f+0]}getCodePoint(f){const u=this._data[3*f+0];return 2097152&u?this._combined[f].charCodeAt(this._combined[f].length-1):2097151&u}isCombined(f){return 2097152&this._data[3*f+0]}getString(f){const u=this._data[3*f+0];return 2097152&u?this._combined[f]:2097151&u?(0,v.stringFromCodePoint)(2097151&u):""}isProtected(f){return 536870912&this._data[3*f+2]}loadCell(f,u){return m=3*f,u.content=this._data[m+0],u.fg=this._data[m+1],u.bg=this._data[m+2],2097152&u.content&&(u.combinedData=this._combined[f]),268435456&u.bg&&(u.extended=this._extendedAttrs[f]),u}setCell(f,u){2097152&u.content&&(this._combined[f]=u.combinedData),268435456&u.bg&&(this._extendedAttrs[f]=u.extended),this._data[3*f+0]=u.content,this._data[3*f+1]=u.fg,this._data[3*f+2]=u.bg}setCellFromCodepoint(f,u,l,p){268435456&p.bg&&(this._extendedAttrs[f]=p.extended),this._data[3*f+0]=u|l<<22,this._data[3*f+1]=p.fg,this._data[3*f+2]=p.bg}addCodepointToCell(f,u,l){let p=this._data[3*f+0];2097152&p?this._combined[f]+=(0,v.stringFromCodePoint)(u):2097151&p?(this._combined[f]=(0,v.stringFromCodePoint)(2097151&p)+(0,v.stringFromCodePoint)(u),p&=-2097152,p|=2097152):p=u|4194304,l&&(p&=-12582913,p|=l<<22),this._data[3*f+0]=p}insertCells(f,u,l){if((f%=this.length)&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f-1,0,1,l),u<this.length-f){const p=new g.CellData;for(let y=this.length-f-u-1;y>=0;--y)this.setCell(f+u+y,this.loadCell(f+y,p));for(let y=0;y<u;++y)this.setCell(f+y,l)}else for(let p=f;p<this.length;++p)this.setCell(p,l);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,l)}deleteCells(f,u,l){if(f%=this.length,u<this.length-f){const p=new g.CellData;for(let y=0;y<this.length-f-u;++y)this.setCell(f+y,this.loadCell(f+u+y,p));for(let y=this.length-u;y<this.length;++y)this.setCell(y,l)}else for(let p=f;p<this.length;++p)this.setCell(p,l);f&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f-1,0,1,l),this.getWidth(f)!==0||this.hasContent(f)||this.setCellFromCodepoint(f,0,1,l)}replaceCells(f,u,l,p=!1){if(p)for(f&&this.getWidth(f-1)===2&&!this.isProtected(f-1)&&this.setCellFromCodepoint(f-1,0,1,l),u<this.length&&this.getWidth(u-1)===2&&!this.isProtected(u)&&this.setCellFromCodepoint(u,0,1,l);f<u&&f<this.length;)this.isProtected(f)||this.setCell(f,l),f++;else for(f&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f-1,0,1,l),u<this.length&&this.getWidth(u-1)===2&&this.setCellFromCodepoint(u,0,1,l);f<u&&f<this.length;)this.setCell(f++,l)}resize(f,u){if(f===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const l=3*f;if(f>this.length){if(this._data.buffer.byteLength>=4*l)this._data=new Uint32Array(this._data.buffer,0,l);else{const p=new Uint32Array(l);p.set(this._data),this._data=p}for(let p=this.length;p<f;++p)this.setCell(p,u)}else{this._data=this._data.subarray(0,l);const p=Object.keys(this._combined);for(let k=0;k<p.length;k++){const C=parseInt(p[k],10);C>=f&&delete this._combined[C]}const y=Object.keys(this._extendedAttrs);for(let k=0;k<y.length;k++){const C=parseInt(y[k],10);C>=f&&delete this._extendedAttrs[C]}}return this.length=f,4*l*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const f=new Uint32Array(this._data.length);return f.set(this._data),this._data=f,1}return 0}fill(f,u=!1){if(u)for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,f);else{this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,f)}}copyFrom(f){this.length!==f.length?this._data=new Uint32Array(f._data):this._data.set(f._data),this.length=f.length,this._combined={};for(const u in f._combined)this._combined[u]=f._combined[u];this._extendedAttrs={};for(const u in f._extendedAttrs)this._extendedAttrs[u]=f._extendedAttrs[u];this.isWrapped=f.isWrapped}clone(){const f=new w(0);f._data=new Uint32Array(this._data),f.length=this.length;for(const u in this._combined)f._combined[u]=this._combined[u];for(const u in this._extendedAttrs)f._extendedAttrs[u]=this._extendedAttrs[u];return f.isWrapped=this.isWrapped,f}getTrimmedLength(){for(let f=this.length-1;f>=0;--f)if(4194303&this._data[3*f+0])return f+(this._data[3*f+0]>>22);return 0}getNoBgTrimmedLength(){for(let f=this.length-1;f>=0;--f)if(4194303&this._data[3*f+0]||50331648&this._data[3*f+2])return f+(this._data[3*f+0]>>22);return 0}copyCellsFrom(f,u,l,p,y){const k=f._data;if(y)for(let A=p-1;A>=0;A--){for(let S=0;S<3;S++)this._data[3*(l+A)+S]=k[3*(u+A)+S];268435456&k[3*(u+A)+2]&&(this._extendedAttrs[l+A]=f._extendedAttrs[u+A])}else for(let A=0;A<p;A++){for(let S=0;S<3;S++)this._data[3*(l+A)+S]=k[3*(u+A)+S];268435456&k[3*(u+A)+2]&&(this._extendedAttrs[l+A]=f._extendedAttrs[u+A])}const C=Object.keys(f._combined);for(let A=0;A<C.length;A++){const S=parseInt(C[A],10);S>=u&&(this._combined[S-u+l]=f._combined[S])}}translateToString(f,u,l,p){u=u??0,l=l??this.length,f&&(l=Math.min(l,this.getTrimmedLength())),p&&(p.length=0);let y="";for(;u<l;){const k=this._data[3*u+0],C=2097151&k,A=2097152&k?this._combined[u]:C?(0,v.stringFromCodePoint)(C):h.WHITESPACE_CELL_CHAR;if(y+=A,p)for(let S=0;S<A.length;++S)p.push(u);u+=k>>22||1}return p&&p.push(u),y}}o.BufferLine=w},4841:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(a,c){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return c*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(_,o)=>{function a(c,g,h){if(g===c.length-1)return c[g].getTrimmedLength();const v=!c[g].hasContent(h-1)&&c[g].getWidth(h-1)===1,m=c[g+1].getWidth(0)===2;return v&&m?h-1:h}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(c,g,h,v,m){const w=[];for(let b=0;b<c.length-1;b++){let f=b,u=c.get(++f);if(!u.isWrapped)continue;const l=[c.get(b)];for(;f<c.length&&u.isWrapped;)l.push(u),u=c.get(++f);if(v>=b&&v<f){b+=l.length-1;continue}let p=0,y=a(l,p,g),k=1,C=0;for(;k<l.length;){const S=a(l,k,g),T=S-C,D=h-y,H=Math.min(T,D);l[p].copyCellsFrom(l[k],C,y,H,!1),y+=H,y===h&&(p++,y=0),C+=H,C===S&&(k++,C=0),y===0&&p!==0&&l[p-1].getWidth(h-1)===2&&(l[p].copyCellsFrom(l[p-1],h-1,y++,1,!1),l[p-1].setCell(h-1,m))}l[p].replaceCells(y,h,m);let A=0;for(let S=l.length-1;S>0&&(S>p||l[S].getTrimmedLength()===0);S--)A++;A>0&&(w.push(b+l.length-A),w.push(A)),b+=l.length-1}return w},o.reflowLargerCreateNewLayout=function(c,g){const h=[];let v=0,m=g[v],w=0;for(let b=0;b<c.length;b++)if(m===b){const f=g[++v];c.onDeleteEmitter.fire({index:b-w,amount:f}),b+=f-1,w+=f,m=g[++v]}else h.push(b);return{layout:h,countRemoved:w}},o.reflowLargerApplyNewLayout=function(c,g){const h=[];for(let v=0;v<g.length;v++)h.push(c.get(g[v]));for(let v=0;v<h.length;v++)c.set(v,h[v]);c.length=g.length},o.reflowSmallerGetNewLineLengths=function(c,g,h){const v=[],m=c.map(((u,l)=>a(c,l,g))).reduce(((u,l)=>u+l));let w=0,b=0,f=0;for(;f<m;){if(m-f<h){v.push(m-f);break}w+=h;const u=a(c,b,g);w>u&&(w-=u,b++);const l=c[b].getWidth(w-1)===2;l&&w--;const p=l?h-1:h;v.push(p),f+=p}return v},o.getWrappedLineTrimmedLength=a},5295:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const c=a(8460),g=a(844),h=a(9092);class v extends g.Disposable{constructor(w,b){super(),this._optionsService=w,this._bufferService=b,this._onBufferActivate=this.register(new c.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(w,b){this._normal.resize(w,b),this._alt.resize(w,b),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}o.BufferSet=v},511:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const c=a(482),g=a(643),h=a(3734);class v extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const b=new v;return b.setFromCharData(w),b}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let b=!1;if(w[g.CHAR_DATA_CHAR_INDEX].length>2)b=!0;else if(w[g.CHAR_DATA_CHAR_INDEX].length===2){const f=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=f&&f<=56319){const u=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=u&&u<=57343?this.content=1024*(f-55296)+u-56320+65536|w[g.CHAR_DATA_WIDTH_INDEX]<<22:b=!0}else b=!0}else this.content=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[g.CHAR_DATA_WIDTH_INDEX]<<22;b&&(this.combinedData=w[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=v},643:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const c=a(8460),g=a(844);class h{get id(){return this._id}constructor(m){this.line=m,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}o.Marker=h,h._nextId=1},7116:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(_,o)=>{var a,c,g;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
388
+ `,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""})(a||(o.C0=a={})),(function(h){h.PAD="€",h.HOP="",h.BPH="‚",h.NBH="ƒ",h.IND="„",h.NEL="…",h.SSA="†",h.ESA="‡",h.HTS="ˆ",h.HTJ="‰",h.VTS="Š",h.PLD="‹",h.PLU="Œ",h.RI="",h.SS2="Ž",h.SS3="",h.DCS="",h.PU1="‘",h.PU2="’",h.STS="“",h.CCH="”",h.MW="•",h.SPA="–",h.EPA="—",h.SOS="˜",h.SGCI="™",h.SCI="š",h.CSI="›",h.ST="œ",h.OSC="",h.PM="ž",h.APC="Ÿ"})(c||(o.C1=c={})),(function(h){h.ST=`${a.ESC}\\`})(g||(o.C1_ESCAPED=g={}))},7399:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const c=a(2584),g={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};o.evaluateKeyboardEvent=function(h,v,m,w){const b={type:0,cancel:!1,key:void 0},f=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?b.key=v?c.C0.ESC+"OA":c.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?b.key=v?c.C0.ESC+"OD":c.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?b.key=v?c.C0.ESC+"OC":c.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(b.key=v?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:b.key=h.ctrlKey?"\b":c.C0.DEL,h.altKey&&(b.key=c.C0.ESC+b.key);break;case 9:if(h.shiftKey){b.key=c.C0.ESC+"[Z";break}b.key=c.C0.HT,b.cancel=!0;break;case 13:b.key=h.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,b.cancel=!0;break;case 27:b.key=c.C0.ESC,h.altKey&&(b.key=c.C0.ESC+c.C0.ESC),b.cancel=!0;break;case 37:if(h.metaKey)break;f?(b.key=c.C0.ESC+"[1;"+(f+1)+"D",b.key===c.C0.ESC+"[1;3D"&&(b.key=c.C0.ESC+(m?"b":"[1;5D"))):b.key=v?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(h.metaKey)break;f?(b.key=c.C0.ESC+"[1;"+(f+1)+"C",b.key===c.C0.ESC+"[1;3C"&&(b.key=c.C0.ESC+(m?"f":"[1;5C"))):b.key=v?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(h.metaKey)break;f?(b.key=c.C0.ESC+"[1;"+(f+1)+"A",m||b.key!==c.C0.ESC+"[1;3A"||(b.key=c.C0.ESC+"[1;5A")):b.key=v?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(h.metaKey)break;f?(b.key=c.C0.ESC+"[1;"+(f+1)+"B",m||b.key!==c.C0.ESC+"[1;3B"||(b.key=c.C0.ESC+"[1;5B")):b.key=v?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(b.key=c.C0.ESC+"[2~");break;case 46:b.key=f?c.C0.ESC+"[3;"+(f+1)+"~":c.C0.ESC+"[3~";break;case 36:b.key=f?c.C0.ESC+"[1;"+(f+1)+"H":v?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:b.key=f?c.C0.ESC+"[1;"+(f+1)+"F":v?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:h.shiftKey?b.type=2:h.ctrlKey?b.key=c.C0.ESC+"[5;"+(f+1)+"~":b.key=c.C0.ESC+"[5~";break;case 34:h.shiftKey?b.type=3:h.ctrlKey?b.key=c.C0.ESC+"[6;"+(f+1)+"~":b.key=c.C0.ESC+"[6~";break;case 112:b.key=f?c.C0.ESC+"[1;"+(f+1)+"P":c.C0.ESC+"OP";break;case 113:b.key=f?c.C0.ESC+"[1;"+(f+1)+"Q":c.C0.ESC+"OQ";break;case 114:b.key=f?c.C0.ESC+"[1;"+(f+1)+"R":c.C0.ESC+"OR";break;case 115:b.key=f?c.C0.ESC+"[1;"+(f+1)+"S":c.C0.ESC+"OS";break;case 116:b.key=f?c.C0.ESC+"[15;"+(f+1)+"~":c.C0.ESC+"[15~";break;case 117:b.key=f?c.C0.ESC+"[17;"+(f+1)+"~":c.C0.ESC+"[17~";break;case 118:b.key=f?c.C0.ESC+"[18;"+(f+1)+"~":c.C0.ESC+"[18~";break;case 119:b.key=f?c.C0.ESC+"[19;"+(f+1)+"~":c.C0.ESC+"[19~";break;case 120:b.key=f?c.C0.ESC+"[20;"+(f+1)+"~":c.C0.ESC+"[20~";break;case 121:b.key=f?c.C0.ESC+"[21;"+(f+1)+"~":c.C0.ESC+"[21~";break;case 122:b.key=f?c.C0.ESC+"[23;"+(f+1)+"~":c.C0.ESC+"[23~";break;case 123:b.key=f?c.C0.ESC+"[24;"+(f+1)+"~":c.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(m&&!w||!h.altKey||h.metaKey)!m||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?b.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(b.key=c.C0.US),h.key==="@"&&(b.key=c.C0.NUL)):h.keyCode===65&&(b.type=1);else{const u=g[h.keyCode],l=u==null?void 0:u[h.shiftKey?1:0];if(l)b.key=c.C0.ESC+l;else if(h.keyCode>=65&&h.keyCode<=90){const p=h.ctrlKey?h.keyCode-64:h.keyCode+32;let y=String.fromCharCode(p);h.shiftKey&&(y=y.toUpperCase()),b.key=c.C0.ESC+y}else if(h.keyCode===32)b.key=c.C0.ESC+(h.ctrlKey?c.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let p=h.code.slice(3,4);h.shiftKey||(p=p.toLowerCase()),b.key=c.C0.ESC+p,b.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?b.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?b.key=c.C0.NUL:h.keyCode>=51&&h.keyCode<=55?b.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?b.key=c.C0.DEL:h.keyCode===219?b.key=c.C0.ESC:h.keyCode===220?b.key=c.C0.FS:h.keyCode===221&&(b.key=c.C0.GS)}return b}},482:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},o.utf32ToString=function(a,c=0,g=a.length){let h="";for(let v=c;v<g;++v){let m=a[v];m>65535?(m-=65536,h+=String.fromCharCode(55296+(m>>10))+String.fromCharCode(m%1024+56320)):h+=String.fromCharCode(m)}return h},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,c){const g=a.length;if(!g)return 0;let h=0,v=0;if(this._interim){const m=a.charCodeAt(v++);56320<=m&&m<=57343?c[h++]=1024*(this._interim-55296)+m-56320+65536:(c[h++]=this._interim,c[h++]=m),this._interim=0}for(let m=v;m<g;++m){const w=a.charCodeAt(m);if(55296<=w&&w<=56319){if(++m>=g)return this._interim=w,h;const b=a.charCodeAt(m);56320<=b&&b<=57343?c[h++]=1024*(w-55296)+b-56320+65536:(c[h++]=w,c[h++]=b)}else w!==65279&&(c[h++]=w)}return h}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,c){const g=a.length;if(!g)return 0;let h,v,m,w,b=0,f=0,u=0;if(this.interim[0]){let y=!1,k=this.interim[0];k&=(224&k)==192?31:(240&k)==224?15:7;let C,A=0;for(;(C=63&this.interim[++A])&&A<4;)k<<=6,k|=C;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=S-A;for(;u<T;){if(u>=g)return 0;if(C=a[u++],(192&C)!=128){u--,y=!0;break}this.interim[A++]=C,k<<=6,k|=63&C}y||(S===2?k<128?u--:c[b++]=k:S===3?k<2048||k>=55296&&k<=57343||k===65279||(c[b++]=k):k<65536||k>1114111||(c[b++]=k)),this.interim.fill(0)}const l=g-4;let p=u;for(;p<g;){for(;!(!(p<l)||128&(h=a[p])||128&(v=a[p+1])||128&(m=a[p+2])||128&(w=a[p+3]));)c[b++]=h,c[b++]=v,c[b++]=m,c[b++]=w,p+=4;if(h=a[p++],h<128)c[b++]=h;else if((224&h)==192){if(p>=g)return this.interim[0]=h,b;if(v=a[p++],(192&v)!=128){p--;continue}if(f=(31&h)<<6|63&v,f<128){p--;continue}c[b++]=f}else if((240&h)==224){if(p>=g)return this.interim[0]=h,b;if(v=a[p++],(192&v)!=128){p--;continue}if(p>=g)return this.interim[0]=h,this.interim[1]=v,b;if(m=a[p++],(192&m)!=128){p--;continue}if(f=(15&h)<<12|(63&v)<<6|63&m,f<2048||f>=55296&&f<=57343||f===65279)continue;c[b++]=f}else if((248&h)==240){if(p>=g)return this.interim[0]=h,b;if(v=a[p++],(192&v)!=128){p--;continue}if(p>=g)return this.interim[0]=h,this.interim[1]=v,b;if(m=a[p++],(192&m)!=128){p--;continue}if(p>=g)return this.interim[0]=h,this.interim[1]=v,this.interim[2]=m,b;if(w=a[p++],(192&w)!=128){p--;continue}if(f=(7&h)<<18|(63&v)<<12|(63&m)<<6|63&w,f<65536||f>1114111)continue;c[b++]=f}}return b}}},225:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const c=a(1480),g=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let v;o.UnicodeV6=class{constructor(){if(this.version="6",!v){v=new Uint8Array(65536),v.fill(1),v[0]=0,v.fill(0,1,32),v.fill(0,127,160),v.fill(2,4352,4448),v[9001]=2,v[9002]=2,v.fill(2,11904,42192),v[12351]=1,v.fill(2,44032,55204),v.fill(2,63744,64256),v.fill(2,65040,65050),v.fill(2,65072,65136),v.fill(2,65280,65377),v.fill(2,65504,65511);for(let m=0;m<g.length;++m)v.fill(0,g[m][0],g[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?v[m]:(function(w,b){let f,u=0,l=b.length-1;if(w<b[0][0]||w>b[l][1])return!1;for(;l>=u;)if(f=u+l>>1,w>b[f][1])u=f+1;else{if(!(w<b[f][0]))return!0;l=f-1}return!1})(m,h)?0:m>=131072&&m<=196605||m>=196608&&m<=262141?2:1}charProperties(m,w){let b=this.wcwidth(m),f=b===0&&w!==0;if(f){const u=c.UnicodeService.extractWidth(w);u===0?f=!1:u>b&&(b=u)}return c.UnicodeService.createPropertyValue(0,b,f)}}},5981:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const c=a(8460),g=a(844);class h extends g.Disposable{constructor(m){super(),this._action=m,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(m,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let b;for(this._isSyncWriting=!0;b=this._writeBuffer.shift();){this._action(b);const f=this._callbacks.shift();f&&f()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(m,w){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(w)}_innerWrite(m=0,w=!0){const b=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const f=this._writeBuffer[this._bufferOffset],u=this._action(f,w);if(u){const p=y=>Date.now()-b>=12?setTimeout((()=>this._innerWrite(0,y))):this._innerWrite(b,y);return void u.catch((y=>(queueMicrotask((()=>{throw y})),Promise.resolve(!1)))).then(p)}const l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=f.length,Date.now()-b>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}o.WriteBuffer=h},5941:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const a=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,c=/^[\da-f]+$/;function g(h,v){const m=h.toString(16),w=m.length<2?"0"+m:m;switch(v){case 4:return m[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}o.parseColor=function(h){if(!h)return;let v=h.toLowerCase();if(v.indexOf("rgb:")===0){v=v.slice(4);const m=a.exec(v);if(m){const w=m[1]?15:m[4]?255:m[7]?4095:65535;return[Math.round(parseInt(m[1]||m[4]||m[7]||m[10],16)/w*255),Math.round(parseInt(m[2]||m[5]||m[8]||m[11],16)/w*255),Math.round(parseInt(m[3]||m[6]||m[9]||m[12],16)/w*255)]}}else if(v.indexOf("#")===0&&(v=v.slice(1),c.exec(v)&&[3,6,9,12].includes(v.length))){const m=v.length/3,w=[0,0,0];for(let b=0;b<3;++b){const f=parseInt(v.slice(m*b,m*b+m),16);w[b]=m===1?f<<4:m===2?f:m===3?f>>4:f>>8}return w}},o.toRgbString=function(h,v=16){const[m,w,b]=h;return`rgb:${g(m,v)}/${g(w,v)}/${g(b,v)}`}},5770:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const c=a(482),g=a(8742),h=a(5770),v=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=v,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=v}registerHandler(w,b){this._handlers[w]===void 0&&(this._handlers[w]=[]);const f=this._handlers[w];return f.push(b),{dispose:()=>{const u=f.indexOf(b);u!==-1&&f.splice(u,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=v,this._ident=0}hook(w,b){if(this.reset(),this._ident=w,this._active=this._handlers[w]||v,this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].hook(b);else this._handlerFb(this._ident,"HOOK",b)}put(w,b,f){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(w,b,f);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(w,b,f))}unhook(w,b=!0){if(this._active.length){let f=!1,u=this._active.length-1,l=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,f=b,l=this._stack.fallThrough,this._stack.paused=!1),!l&&f===!1){for(;u>=0&&(f=this._active[u].unhook(w),f!==!0);u--)if(f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,f;u--}for(;u>=0;u--)if(f=this._active[u].unhook(!1),f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,f}else this._handlerFb(this._ident,"UNHOOK",w);this._active=v,this._ident=0}};const m=new g.Params;m.addParam(0),o.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=m,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():m,this._data="",this._hitLimit=!1}put(w,b,f){this._hitLimit||(this._data+=(0,c.utf32ToString)(w,b,f),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let b=!1;if(this._hitLimit)b=!1;else if(w&&(b=this._handler(this._data,this._params),b instanceof Promise))return b.then((f=>(this._params=m,this._data="",this._hitLimit=!1,f)));return this._params=m,this._data="",this._hitLimit=!1,b}}},2015:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const c=a(844),g=a(8742),h=a(6242),v=a(6351);class m{constructor(u){this.table=new Uint8Array(u)}setDefault(u,l){this.table.fill(u<<4|l)}add(u,l,p,y){this.table[l<<8|u]=p<<4|y}addMany(u,l,p,y){for(let k=0;k<u.length;k++)this.table[l<<8|u[k]]=p<<4|y}}o.TransitionTable=m;const w=160;o.VT500_TRANSITION_TABLE=(function(){const f=new m(4095),u=Array.apply(null,Array(256)).map(((A,S)=>S)),l=(A,S)=>u.slice(A,S),p=l(32,127),y=l(0,24);y.push(25),y.push.apply(y,l(28,32));const k=l(0,14);let C;for(C in f.setDefault(1,0),f.addMany(p,0,2,0),k)f.addMany([24,26,153,154],C,3,0),f.addMany(l(128,144),C,3,0),f.addMany(l(144,152),C,3,0),f.add(156,C,0,0),f.add(27,C,11,1),f.add(157,C,4,8),f.addMany([152,158,159],C,0,7),f.add(155,C,11,3),f.add(144,C,11,9);return f.addMany(y,0,3,0),f.addMany(y,1,3,1),f.add(127,1,0,1),f.addMany(y,8,0,8),f.addMany(y,3,3,3),f.add(127,3,0,3),f.addMany(y,4,3,4),f.add(127,4,0,4),f.addMany(y,6,3,6),f.addMany(y,5,3,5),f.add(127,5,0,5),f.addMany(y,2,3,2),f.add(127,2,0,2),f.add(93,1,4,8),f.addMany(p,8,5,8),f.add(127,8,5,8),f.addMany([156,27,24,26,7],8,6,0),f.addMany(l(28,32),8,0,8),f.addMany([88,94,95],1,0,7),f.addMany(p,7,0,7),f.addMany(y,7,0,7),f.add(156,7,0,0),f.add(127,7,0,7),f.add(91,1,11,3),f.addMany(l(64,127),3,7,0),f.addMany(l(48,60),3,8,4),f.addMany([60,61,62,63],3,9,4),f.addMany(l(48,60),4,8,4),f.addMany(l(64,127),4,7,0),f.addMany([60,61,62,63],4,0,6),f.addMany(l(32,64),6,0,6),f.add(127,6,0,6),f.addMany(l(64,127),6,0,0),f.addMany(l(32,48),3,9,5),f.addMany(l(32,48),5,9,5),f.addMany(l(48,64),5,0,6),f.addMany(l(64,127),5,7,0),f.addMany(l(32,48),4,9,5),f.addMany(l(32,48),1,9,2),f.addMany(l(32,48),2,9,2),f.addMany(l(48,127),2,10,0),f.addMany(l(48,80),1,10,0),f.addMany(l(81,88),1,10,0),f.addMany([89,90,92],1,10,0),f.addMany(l(96,127),1,10,0),f.add(80,1,11,9),f.addMany(y,9,0,9),f.add(127,9,0,9),f.addMany(l(28,32),9,0,9),f.addMany(l(32,48),9,9,12),f.addMany(l(48,60),9,8,10),f.addMany([60,61,62,63],9,9,10),f.addMany(y,11,0,11),f.addMany(l(32,128),11,0,11),f.addMany(l(28,32),11,0,11),f.addMany(y,10,0,10),f.add(127,10,0,10),f.addMany(l(28,32),10,0,10),f.addMany(l(48,60),10,8,10),f.addMany([60,61,62,63],10,0,11),f.addMany(l(32,48),10,9,12),f.addMany(y,12,0,12),f.add(127,12,0,12),f.addMany(l(28,32),12,0,12),f.addMany(l(32,48),12,9,12),f.addMany(l(48,64),12,0,11),f.addMany(l(64,127),12,12,13),f.addMany(l(64,127),10,12,13),f.addMany(l(64,127),9,12,13),f.addMany(y,13,13,13),f.addMany(p,13,13,13),f.add(127,13,0,13),f.addMany([27,156,24,26],13,14,0),f.add(w,0,2,0),f.add(w,8,5,8),f.add(w,6,0,6),f.add(w,11,0,11),f.add(w,13,13,13),f})();class b extends c.Disposable{constructor(u=o.VT500_TRANSITION_TABLE){super(),this._transitions=u,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(l,p,y)=>{},this._executeHandlerFb=l=>{},this._csiHandlerFb=(l,p)=>{},this._escHandlerFb=l=>{},this._errorHandlerFb=l=>l,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new v.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(u,l=[64,126]){let p=0;if(u.prefix){if(u.prefix.length>1)throw new Error("only one byte as prefix supported");if(p=u.prefix.charCodeAt(0),p&&60>p||p>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(u.intermediates){if(u.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let k=0;k<u.intermediates.length;++k){const C=u.intermediates.charCodeAt(k);if(32>C||C>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");p<<=8,p|=C}}if(u.final.length!==1)throw new Error("final must be a single byte");const y=u.final.charCodeAt(0);if(l[0]>y||y>l[1])throw new Error(`final must be in range ${l[0]} .. ${l[1]}`);return p<<=8,p|=y,p}identToString(u){const l=[];for(;u;)l.push(String.fromCharCode(255&u)),u>>=8;return l.reverse().join("")}setPrintHandler(u){this._printHandler=u}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(u,l){const p=this._identifier(u,[48,126]);this._escHandlers[p]===void 0&&(this._escHandlers[p]=[]);const y=this._escHandlers[p];return y.push(l),{dispose:()=>{const k=y.indexOf(l);k!==-1&&y.splice(k,1)}}}clearEscHandler(u){this._escHandlers[this._identifier(u,[48,126])]&&delete this._escHandlers[this._identifier(u,[48,126])]}setEscHandlerFallback(u){this._escHandlerFb=u}setExecuteHandler(u,l){this._executeHandlers[u.charCodeAt(0)]=l}clearExecuteHandler(u){this._executeHandlers[u.charCodeAt(0)]&&delete this._executeHandlers[u.charCodeAt(0)]}setExecuteHandlerFallback(u){this._executeHandlerFb=u}registerCsiHandler(u,l){const p=this._identifier(u);this._csiHandlers[p]===void 0&&(this._csiHandlers[p]=[]);const y=this._csiHandlers[p];return y.push(l),{dispose:()=>{const k=y.indexOf(l);k!==-1&&y.splice(k,1)}}}clearCsiHandler(u){this._csiHandlers[this._identifier(u)]&&delete this._csiHandlers[this._identifier(u)]}setCsiHandlerFallback(u){this._csiHandlerFb=u}registerDcsHandler(u,l){return this._dcsParser.registerHandler(this._identifier(u),l)}clearDcsHandler(u){this._dcsParser.clearHandler(this._identifier(u))}setDcsHandlerFallback(u){this._dcsParser.setHandlerFallback(u)}registerOscHandler(u,l){return this._oscParser.registerHandler(u,l)}clearOscHandler(u){this._oscParser.clearHandler(u)}setOscHandlerFallback(u){this._oscParser.setHandlerFallback(u)}setErrorHandler(u){this._errorHandler=u}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(u,l,p,y,k){this._parseStack.state=u,this._parseStack.handlers=l,this._parseStack.handlerPos=p,this._parseStack.transition=y,this._parseStack.chunkPos=k}parse(u,l,p){let y,k=0,C=0,A=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,A=this._parseStack.chunkPos+1;else{if(p===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const S=this._parseStack.handlers;let T=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(p===!1&&T>-1){for(;T>=0&&(y=S[T](this._params),y!==!0);T--)if(y instanceof Promise)return this._parseStack.handlerPos=T,y}this._parseStack.handlers=[];break;case 4:if(p===!1&&T>-1){for(;T>=0&&(y=S[T](),y!==!0);T--)if(y instanceof Promise)return this._parseStack.handlerPos=T,y}this._parseStack.handlers=[];break;case 6:if(k=u[this._parseStack.chunkPos],y=this._dcsParser.unhook(k!==24&&k!==26,p),y)return y;k===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(k=u[this._parseStack.chunkPos],y=this._oscParser.end(k!==24&&k!==26,p),y)return y;k===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,A=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let S=A;S<l;++S){switch(k=u[S],C=this._transitions.table[this.currentState<<8|(k<160?k:w)],C>>4){case 2:for(let M=S+1;;++M){if(M>=l||(k=u[M])<32||k>126&&k<w){this._printHandler(u,S,M),S=M-1;break}if(++M>=l||(k=u[M])<32||k>126&&k<w){this._printHandler(u,S,M),S=M-1;break}if(++M>=l||(k=u[M])<32||k>126&&k<w){this._printHandler(u,S,M),S=M-1;break}if(++M>=l||(k=u[M])<32||k>126&&k<w){this._printHandler(u,S,M),S=M-1;break}}break;case 3:this._executeHandlers[k]?this._executeHandlers[k]():this._executeHandlerFb(k),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:S,code:k,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const T=this._csiHandlers[this._collect<<8|k];let D=T?T.length-1:-1;for(;D>=0&&(y=T[D](this._params),y!==!0);D--)if(y instanceof Promise)return this._preserveStack(3,T,D,C,S),y;D<0&&this._csiHandlerFb(this._collect<<8|k,this._params),this.precedingJoinState=0;break;case 8:do switch(k){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(k-48)}while(++S<l&&(k=u[S])>47&&k<60);S--;break;case 9:this._collect<<=8,this._collect|=k;break;case 10:const H=this._escHandlers[this._collect<<8|k];let W=H?H.length-1:-1;for(;W>=0&&(y=H[W](),y!==!0);W--)if(y instanceof Promise)return this._preserveStack(4,H,W,C,S),y;W<0&&this._escHandlerFb(this._collect<<8|k),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|k,this._params);break;case 13:for(let M=S+1;;++M)if(M>=l||(k=u[M])===24||k===26||k===27||k>127&&k<w){this._dcsParser.put(u,S,M),S=M-1;break}break;case 14:if(y=this._dcsParser.unhook(k!==24&&k!==26),y)return this._preserveStack(6,[],0,C,S),y;k===27&&(C|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let M=S+1;;M++)if(M>=l||(k=u[M])<32||k>127&&k<w){this._oscParser.put(u,S,M),S=M-1;break}break;case 6:if(y=this._oscParser.end(k!==24&&k!==26),y)return this._preserveStack(5,[],0,C,S),y;k===27&&(C|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&C}}}o.EscapeSequenceParser=b},6242:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const c=a(5770),g=a(482),h=[];o.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(v,m){this._handlers[v]===void 0&&(this._handlers[v]=[]);const w=this._handlers[v];return w.push(m),{dispose:()=>{const b=w.indexOf(m);b!==-1&&w.splice(b,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].start();else this._handlerFb(this._id,"START")}_put(v,m,w){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(v,m,w);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(v,m,w))}start(){this.reset(),this._state=1}put(v,m,w){if(this._state!==3){if(this._state===1)for(;m<w;){const b=v[m++];if(b===59){this._state=2,this._start();break}if(b<48||57<b)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+b-48}this._state===2&&w-m>0&&this._put(v,m,w)}}end(v,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,b=this._active.length-1,f=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,w=m,f=this._stack.fallThrough,this._stack.paused=!1),!f&&w===!1){for(;b>=0&&(w=this._active[b].end(v),w!==!0);b--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,w;b--}for(;b>=0;b--)if(w=this._active[b].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",v);this._active=h,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(v){this._handler=v,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(v,m,w){this._hitLimit||(this._data+=(0,g.utf32ToString)(v,m,w),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(v){let m=!1;if(this._hitLimit)m=!1;else if(v&&(m=this._handler(this._data),m instanceof Promise))return m.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,m}}},8742:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const a=2147483647;class c{static fromArray(h){const v=new c;if(!h.length)return v;for(let m=Array.isArray(h[0])?1:0;m<h.length;++m){const w=h[m];if(Array.isArray(w))for(let b=0;b<w.length;++b)v.addSubParam(w[b]);else v.addParam(w)}return v}constructor(h=32,v=32){if(this.maxLength=h,this.maxSubParamsLength=v,v>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(v),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new c(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let v=0;v<this.length;++v){h.push(this.params[v]);const m=this._subParamsIdx[v]>>8,w=255&this._subParamsIdx[v];w-m>0&&h.push(Array.prototype.slice.call(this._subParams,m,w))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>a?a:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>a?a:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const v=this._subParamsIdx[h]>>8,m=255&this._subParamsIdx[h];return m-v>0?this._subParams.subarray(v,m):null}getSubParamsAll(){const h={};for(let v=0;v<this.length;++v){const m=this._subParamsIdx[v]>>8,w=255&this._subParamsIdx[v];w-m>0&&(h[v]=this._subParams.slice(m,w))}return h}addDigit(h){let v;if(this._rejectDigits||!(v=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const m=this._digitIsSub?this._subParams:this.params,w=m[v-1];m[v-1]=~w?Math.min(10*w+h,a):h}}o.Params=c},5741:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,c){const g={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(g),c.dispose=()=>this._wrappedAddonDispose(g),c.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let c=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===a){c=g;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(c,1)}}},8771:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const c=a(3785),g=a(511);o.BufferApiView=class{constructor(h,v){this._buffer=h,this.type=v}init(h){return this._buffer=h,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(h){const v=this._buffer.lines.get(h);if(v)return new c.BufferLineApiView(v)}getNullCell(){return new g.CellData}}},3785:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const c=a(511);o.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,h){if(!(g<0||g>=this._line.length))return h?(this._line.loadCell(g,h),h):this._line.loadCell(g,new c.CellData)}translateToString(g,h,v){return this._line.translateToString(g,h,v)}}},8285:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const c=a(8771),g=a(8460),h=a(844);class v extends h.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}o.BufferNamespaceApi=v},7975:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,c){return this._core.registerCsiHandler(a,(g=>c(g.toArray())))}addCsiHandler(a,c){return this.registerCsiHandler(a,c)}registerDcsHandler(a,c){return this._core.registerDcsHandler(a,((g,h)=>c(g,h.toArray())))}addDcsHandler(a,c){return this.registerDcsHandler(a,c)}registerEscHandler(a,c){return this._core.registerEscHandler(a,c)}addEscHandler(a,c){return this.registerEscHandler(a,c)}registerOscHandler(a,c){return this._core.registerOscHandler(a,c)}addOscHandler(a,c){return this.registerOscHandler(a,c)}}},7090:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(_,o,a){var c=this&&this.__decorate||function(f,u,l,p){var y,k=arguments.length,C=k<3?u:p===null?p=Object.getOwnPropertyDescriptor(u,l):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(f,u,l,p);else for(var A=f.length-1;A>=0;A--)(y=f[A])&&(C=(k<3?y(C):k>3?y(u,l,C):y(u,l))||C);return k>3&&C&&Object.defineProperty(u,l,C),C},g=this&&this.__param||function(f,u){return function(l,p){u(l,p,f)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const h=a(8460),v=a(844),m=a(5295),w=a(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let b=o.BufferService=class extends v.Disposable{get buffer(){return this.buffers.active}constructor(f){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(f.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(f.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new m.BufferSet(f,this))}resize(f,u){this.cols=f,this.rows=u,this.buffers.resize(f,u),this._onResize.fire({cols:f,rows:u})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(f,u=!1){const l=this.buffer;let p;p=this._cachedBlankLine,p&&p.length===this.cols&&p.getFg(0)===f.fg&&p.getBg(0)===f.bg||(p=l.getBlankLine(f,u),this._cachedBlankLine=p),p.isWrapped=u;const y=l.ybase+l.scrollTop,k=l.ybase+l.scrollBottom;if(l.scrollTop===0){const C=l.lines.isFull;k===l.lines.length-1?C?l.lines.recycle().copyFrom(p):l.lines.push(p.clone()):l.lines.splice(k+1,0,p.clone()),C?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{const C=k-y+1;l.lines.shiftElements(y+1,C-1,-1),l.lines.set(k,p.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)}scrollLines(f,u,l){const p=this.buffer;if(f<0){if(p.ydisp===0)return;this.isUserScrolling=!0}else f+p.ydisp>=p.ybase&&(this.isUserScrolling=!1);const y=p.ydisp;p.ydisp=Math.max(Math.min(p.ydisp+f,p.ybase),0),y!==p.ydisp&&(u||this._onScroll.fire(p.ydisp))}};o.BufferService=b=c([g(0,w.IOptionsService)],b)},7994:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,c){this._charsets[a]=c,this.glevel===a&&(this.charset=c)}}},1753:function(_,o,a){var c=this&&this.__decorate||function(p,y,k,C){var A,S=arguments.length,T=S<3?y:C===null?C=Object.getOwnPropertyDescriptor(y,k):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(p,y,k,C);else for(var D=p.length-1;D>=0;D--)(A=p[D])&&(T=(S<3?A(T):S>3?A(y,k,T):A(y,k))||T);return S>3&&T&&Object.defineProperty(y,k,T),T},g=this&&this.__param||function(p,y){return function(k,C){y(k,C,p)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const h=a(2585),v=a(8460),m=a(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:p=>p.button!==4&&p.action===1&&(p.ctrl=!1,p.alt=!1,p.shift=!1,!0)},VT200:{events:19,restrict:p=>p.action!==32},DRAG:{events:23,restrict:p=>p.action!==32||p.button!==3},ANY:{events:31,restrict:p=>!0}};function b(p,y){let k=(p.ctrl?16:0)|(p.shift?4:0)|(p.alt?8:0);return p.button===4?(k|=64,k|=p.action):(k|=3&p.button,4&p.button&&(k|=64),8&p.button&&(k|=128),p.action===32?k|=32:p.action!==0||y||(k|=3)),k}const f=String.fromCharCode,u={DEFAULT:p=>{const y=[b(p,!1)+32,p.col+32,p.row+32];return y[0]>255||y[1]>255||y[2]>255?"":`\x1B[M${f(y[0])}${f(y[1])}${f(y[2])}`},SGR:p=>{const y=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${b(p,!0)};${p.col};${p.row}${y}`},SGR_PIXELS:p=>{const y=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${b(p,!0)};${p.x};${p.y}${y}`}};let l=o.CoreMouseService=class extends m.Disposable{constructor(p,y){super(),this._bufferService=p,this._coreService=y,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new v.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const k of Object.keys(w))this.addProtocol(k,w[k]);for(const k of Object.keys(u))this.addEncoding(k,u[k]);this.reset()}addProtocol(p,y){this._protocols[p]=y}addEncoding(p,y){this._encodings[p]=y}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(p){if(!this._protocols[p])throw new Error(`unknown protocol "${p}"`);this._activeProtocol=p,this._onProtocolChange.fire(this._protocols[p].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(p){if(!this._encodings[p])throw new Error(`unknown encoding "${p}"`);this._activeEncoding=p}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(p){if(p.col<0||p.col>=this._bufferService.cols||p.row<0||p.row>=this._bufferService.rows||p.button===4&&p.action===32||p.button===3&&p.action!==32||p.button!==4&&(p.action===2||p.action===3)||(p.col++,p.row++,p.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,p,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(p))return!1;const y=this._encodings[this._activeEncoding](p);return y&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(y):this._coreService.triggerDataEvent(y,!0)),this._lastEvent=p,!0}explainEvents(p){return{down:!!(1&p),up:!!(2&p),drag:!!(4&p),move:!!(8&p),wheel:!!(16&p)}}_equalEvents(p,y,k){if(k){if(p.x!==y.x||p.y!==y.y)return!1}else if(p.col!==y.col||p.row!==y.row)return!1;return p.button===y.button&&p.action===y.action&&p.ctrl===y.ctrl&&p.alt===y.alt&&p.shift===y.shift}};o.CoreMouseService=l=c([g(0,h.IBufferService),g(1,h.ICoreService)],l)},6975:function(_,o,a){var c=this&&this.__decorate||function(l,p,y,k){var C,A=arguments.length,S=A<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(l,p,y,k);else for(var T=l.length-1;T>=0;T--)(C=l[T])&&(S=(A<3?C(S):A>3?C(p,y,S):C(p,y))||S);return A>3&&S&&Object.defineProperty(p,y,S),S},g=this&&this.__param||function(l,p){return function(y,k){p(y,k,l)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const h=a(1439),v=a(8460),m=a(844),w=a(2585),b=Object.freeze({insertMode:!1}),f=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let u=o.CoreService=class extends m.Disposable{constructor(l,p,y){super(),this._bufferService=l,this._logService=p,this._optionsService=y,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new v.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new v.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(b),this.decPrivateModes=(0,h.clone)(f)}reset(){this.modes=(0,h.clone)(b),this.decPrivateModes=(0,h.clone)(f)}triggerDataEvent(l,p=!1){if(this._optionsService.rawOptions.disableStdin)return;const y=this._bufferService.buffer;p&&this._optionsService.rawOptions.scrollOnUserInput&&y.ybase!==y.ydisp&&this._onRequestScrollToBottom.fire(),p&&this._onUserInput.fire(),this._logService.debug(`sending data "${l}"`,(()=>l.split("").map((k=>k.charCodeAt(0))))),this._onData.fire(l)}triggerBinaryEvent(l){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${l}"`,(()=>l.split("").map((p=>p.charCodeAt(0))))),this._onBinary.fire(l))}};o.CoreService=u=c([g(0,w.IBufferService),g(1,w.ILogService),g(2,w.IOptionsService)],u)},9074:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const c=a(8055),g=a(8460),h=a(844),v=a(6106);let m=0,w=0;class b extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new v.SortedList((l=>l==null?void 0:l.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(l){if(l.marker.isDisposed)return;const p=new f(l);if(p){const y=p.marker.onDispose((()=>p.dispose()));p.onDispose((()=>{p&&(this._decorations.delete(p)&&this._onDecorationRemoved.fire(p),y.dispose())})),this._decorations.insert(p),this._onDecorationRegistered.fire(p)}return p}reset(){for(const l of this._decorations.values())l.dispose();this._decorations.clear()}*getDecorationsAtCell(l,p,y){let k=0,C=0;for(const A of this._decorations.getKeyIterator(p))k=A.options.x??0,C=k+(A.options.width??1),l>=k&&l<C&&(!y||(A.options.layer??"bottom")===y)&&(yield A)}forEachDecorationAtCell(l,p,y,k){this._decorations.forEachByKey(p,(C=>{m=C.options.x??0,w=m+(C.options.width??1),l>=m&&l<w&&(!y||(C.options.layer??"bottom")===y)&&k(C)}))}}o.DecorationService=b;class f extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(l){super(),this.options=l,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=l.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const c=a(2585),g=a(8343);class h{constructor(...m){this._entries=new Map;for(const[w,b]of m)this.set(w,b)}set(m,w){const b=this._entries.get(m);return this._entries.set(m,w),b}forEach(m){for(const[w,b]of this._entries.entries())m(w,b)}has(m){return this._entries.has(m)}get(m){return this._entries.get(m)}}o.ServiceCollection=h,o.InstantiationService=class{constructor(){this._services=new h,this._services.set(c.IInstantiationService,this)}setService(v,m){this._services.set(v,m)}getService(v){return this._services.get(v)}createInstance(v,...m){const w=(0,g.getServiceDependencies)(v).sort(((u,l)=>u.index-l.index)),b=[];for(const u of w){const l=this._services.get(u.id);if(!l)throw new Error(`[createInstance] ${v.name} depends on UNKNOWN service ${u.id}.`);b.push(l)}const f=w.length>0?w[0].index:m.length;if(m.length!==f)throw new Error(`[createInstance] First service dependency of ${v.name} at position ${f+1} conflicts with ${m.length} static arguments`);return new v(...m,...b)}}},7866:function(_,o,a){var c=this&&this.__decorate||function(f,u,l,p){var y,k=arguments.length,C=k<3?u:p===null?p=Object.getOwnPropertyDescriptor(u,l):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(f,u,l,p);else for(var A=f.length-1;A>=0;A--)(y=f[A])&&(C=(k<3?y(C):k>3?y(u,l,C):y(u,l))||C);return k>3&&C&&Object.defineProperty(u,l,C),C},g=this&&this.__param||function(f,u){return function(l,p){u(l,p,f)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const h=a(844),v=a(2585),m={trace:v.LogLevelEnum.TRACE,debug:v.LogLevelEnum.DEBUG,info:v.LogLevelEnum.INFO,warn:v.LogLevelEnum.WARN,error:v.LogLevelEnum.ERROR,off:v.LogLevelEnum.OFF};let w,b=o.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(f){super(),this._optionsService=f,this._logLevel=v.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(f){for(let u=0;u<f.length;u++)typeof f[u]=="function"&&(f[u]=f[u]())}_log(f,u,l){this._evalLazyOptionalParams(l),f.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+u,...l)}trace(f,...u){var l;this._logLevel<=v.LogLevelEnum.TRACE&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.trace.bind(this._optionsService.options.logger))??console.log,f,u)}debug(f,...u){var l;this._logLevel<=v.LogLevelEnum.DEBUG&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.debug.bind(this._optionsService.options.logger))??console.log,f,u)}info(f,...u){var l;this._logLevel<=v.LogLevelEnum.INFO&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.info.bind(this._optionsService.options.logger))??console.info,f,u)}warn(f,...u){var l;this._logLevel<=v.LogLevelEnum.WARN&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.warn.bind(this._optionsService.options.logger))??console.warn,f,u)}error(f,...u){var l;this._logLevel<=v.LogLevelEnum.ERROR&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.error.bind(this._optionsService.options.logger))??console.error,f,u)}};o.LogService=b=c([g(0,v.IOptionsService)],b),o.setTraceLogger=function(f){w=f},o.traceCall=function(f,u,l){if(typeof l.value!="function")throw new Error("not supported");const p=l.value;l.value=function(...y){if(w.logLevel!==v.LogLevelEnum.TRACE)return p.apply(this,y);w.trace(`GlyphRenderer#${p.name}(${y.map((C=>JSON.stringify(C))).join(", ")})`);const k=p.apply(this,y);return w.trace(`GlyphRenderer#${p.name} return`,k),k}}},7302:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const c=a(8460),g=a(844),h=a(6114);o.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const v=["normal","bold","100","200","300","400","500","600","700","800","900"];class m extends g.Disposable{constructor(b){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;const f={...o.DEFAULT_OPTIONS};for(const u in b)if(u in f)try{const l=b[u];f[u]=this._sanitizeAndValidateOption(u,l)}catch(l){console.error(l)}this.rawOptions=f,this.options={...f},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(b,f){return this.onOptionChange((u=>{u===b&&f(this.rawOptions[b])}))}onMultipleOptionChange(b,f){return this.onOptionChange((u=>{b.indexOf(u)!==-1&&f()}))}_setupOptions(){const b=u=>{if(!(u in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${u}"`);return this.rawOptions[u]},f=(u,l)=>{if(!(u in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${u}"`);l=this._sanitizeAndValidateOption(u,l),this.rawOptions[u]!==l&&(this.rawOptions[u]=l,this._onOptionChange.fire(u))};for(const u in this.rawOptions){const l={get:b.bind(this,u),set:f.bind(this,u)};Object.defineProperty(this.options,u,l)}}_sanitizeAndValidateOption(b,f){switch(b){case"cursorStyle":if(f||(f=o.DEFAULT_OPTIONS[b]),!(function(u){return u==="block"||u==="underline"||u==="bar"})(f))throw new Error(`"${f}" is not a valid value for ${b}`);break;case"wordSeparator":f||(f=o.DEFAULT_OPTIONS[b]);break;case"fontWeight":case"fontWeightBold":if(typeof f=="number"&&1<=f&&f<=1e3)break;f=v.includes(f)?f:o.DEFAULT_OPTIONS[b];break;case"cursorWidth":f=Math.floor(f);case"lineHeight":case"tabStopWidth":if(f<1)throw new Error(`${b} cannot be less than 1, value: ${f}`);break;case"minimumContrastRatio":f=Math.max(1,Math.min(21,Math.round(10*f)/10));break;case"scrollback":if((f=Math.min(f,4294967295))<0)throw new Error(`${b} cannot be less than 0, value: ${f}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(f<=0)throw new Error(`${b} cannot be less than or equal to 0, value: ${f}`);break;case"rows":case"cols":if(!f&&f!==0)throw new Error(`${b} must be numeric, value: ${f}`);break;case"windowsPty":f=f??{}}return f}}o.OptionsService=m},2660:function(_,o,a){var c=this&&this.__decorate||function(m,w,b,f){var u,l=arguments.length,p=l<3?w:f===null?f=Object.getOwnPropertyDescriptor(w,b):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(m,w,b,f);else for(var y=m.length-1;y>=0;y--)(u=m[y])&&(p=(l<3?u(p):l>3?u(w,b,p):u(w,b))||p);return l>3&&p&&Object.defineProperty(w,b,p),p},g=this&&this.__param||function(m,w){return function(b,f){w(b,f,m)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const h=a(2585);let v=o.OscLinkService=class{constructor(m){this._bufferService=m,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(m){const w=this._bufferService.buffer;if(m.id===void 0){const y=w.addMarker(w.ybase+w.y),k={data:m,id:this._nextId++,lines:[y]};return y.onDispose((()=>this._removeMarkerFromLink(k,y))),this._dataByLinkId.set(k.id,k),k.id}const b=m,f=this._getEntryIdKey(b),u=this._entriesWithId.get(f);if(u)return this.addLineToLink(u.id,w.ybase+w.y),u.id;const l=w.addMarker(w.ybase+w.y),p={id:this._nextId++,key:this._getEntryIdKey(b),data:b,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(p,l))),this._entriesWithId.set(p.key,p),this._dataByLinkId.set(p.id,p),p.id}addLineToLink(m,w){const b=this._dataByLinkId.get(m);if(b&&b.lines.every((f=>f.line!==w))){const f=this._bufferService.buffer.addMarker(w);b.lines.push(f),f.onDispose((()=>this._removeMarkerFromLink(b,f)))}}getLinkData(m){var w;return(w=this._dataByLinkId.get(m))==null?void 0:w.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,w){const b=m.lines.indexOf(w);b!==-1&&(m.lines.splice(b,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};o.OscLinkService=v=c([g(0,h.IBufferService)],v)},8343:(_,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const a="di$target",c="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(g){return g[c]||[]},o.createDecorator=function(g){if(o.serviceRegistry.has(g))return o.serviceRegistry.get(g);const h=function(v,m,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(b,f,u){f[a]===f?f[c].push({id:b,index:u}):(f[c]=[{id:b,index:u}],f[a]=f)})(h,v,w)};return h.toString=()=>g,o.serviceRegistry.set(g,h),h}},2585:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const c=a(8343);var g;o.IBufferService=(0,c.createDecorator)("BufferService"),o.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),o.ICoreService=(0,c.createDecorator)("CoreService"),o.ICharsetService=(0,c.createDecorator)("CharsetService"),o.IInstantiationService=(0,c.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(g||(o.LogLevelEnum=g={})),o.ILogService=(0,c.createDecorator)("LogService"),o.IOptionsService=(0,c.createDecorator)("OptionsService"),o.IOscLinkService=(0,c.createDecorator)("OscLinkService"),o.IUnicodeService=(0,c.createDecorator)("UnicodeService"),o.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(_,o,a)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const c=a(8460),g=a(225);class h{static extractShouldJoin(m){return(1&m)!=0}static extractWidth(m){return m>>1&3}static extractCharKind(m){return m>>3}static createPropertyValue(m,w,b=!1){return(16777215&m)<<3|(3&w)<<1|(b?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;const m=new g.UnicodeV6;this.register(m),this._active=m.version,this._activeProvider=m}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(m){if(!this._providers[m])throw new Error(`unknown Unicode version "${m}"`);this._active=m,this._activeProvider=this._providers[m],this._onChange.fire(m)}register(m){this._providers[m.version]=m}wcwidth(m){return this._activeProvider.wcwidth(m)}getStringCellWidth(m){let w=0,b=0;const f=m.length;for(let u=0;u<f;++u){let l=m.charCodeAt(u);if(55296<=l&&l<=56319){if(++u>=f)return w+this.wcwidth(l);const k=m.charCodeAt(u);56320<=k&&k<=57343?l=1024*(l-55296)+k-56320+65536:w+=this.wcwidth(k)}const p=this.charProperties(l,b);let y=h.extractWidth(p);h.extractShouldJoin(p)&&(y-=h.extractWidth(b)),w+=y,b=p}return w}charProperties(m,w){return this._activeProvider.charProperties(m,w)}}o.UnicodeService=h}},n={};function s(_){var o=n[_];if(o!==void 0)return o.exports;var a=n[_]={exports:{}};return r[_].call(a.exports,a,a.exports,s),a.exports}var d={};return(()=>{var _=d;Object.defineProperty(_,"__esModule",{value:!0}),_.Terminal=void 0;const o=s(9042),a=s(3236),c=s(844),g=s(5741),h=s(8285),v=s(7975),m=s(7090),w=["cols","rows"];class b extends c.Disposable{constructor(u){super(),this._core=this.register(new a.Terminal(u)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const l=y=>this._core.options[y],p=(y,k)=>{this._checkReadonlyOptions(y),this._core.options[y]=k};for(const y in this._core.options){const k={get:l.bind(this,y),set:p.bind(this,y)};Object.defineProperty(this._publicOptions,y,k)}}_checkReadonlyOptions(u){if(w.includes(u))throw new Error(`Option "${u}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new v.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new m.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const u=this._core.coreService.decPrivateModes;let l="none";switch(this._core.coreMouseService.activeProtocol){case"X10":l="x10";break;case"VT200":l="vt200";break;case"DRAG":l="drag";break;case"ANY":l="any"}return{applicationCursorKeysMode:u.applicationCursorKeys,applicationKeypadMode:u.applicationKeypad,bracketedPasteMode:u.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:l,originMode:u.origin,reverseWraparoundMode:u.reverseWraparound,sendFocusMode:u.sendFocus,wraparoundMode:u.wraparound}}get options(){return this._publicOptions}set options(u){for(const l in u)this._publicOptions[l]=u[l]}blur(){this._core.blur()}focus(){this._core.focus()}input(u,l=!0){this._core.input(u,l)}resize(u,l){this._verifyIntegers(u,l),this._core.resize(u,l)}open(u){this._core.open(u)}attachCustomKeyEventHandler(u){this._core.attachCustomKeyEventHandler(u)}attachCustomWheelEventHandler(u){this._core.attachCustomWheelEventHandler(u)}registerLinkProvider(u){return this._core.registerLinkProvider(u)}registerCharacterJoiner(u){return this._checkProposedApi(),this._core.registerCharacterJoiner(u)}deregisterCharacterJoiner(u){this._checkProposedApi(),this._core.deregisterCharacterJoiner(u)}registerMarker(u=0){return this._verifyIntegers(u),this._core.registerMarker(u)}registerDecoration(u){return this._checkProposedApi(),this._verifyPositiveIntegers(u.x??0,u.width??0,u.height??0),this._core.registerDecoration(u)}hasSelection(){return this._core.hasSelection()}select(u,l,p){this._verifyIntegers(u,l,p),this._core.select(u,l,p)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(u,l){this._verifyIntegers(u,l),this._core.selectLines(u,l)}dispose(){super.dispose()}scrollLines(u){this._verifyIntegers(u),this._core.scrollLines(u)}scrollPages(u){this._verifyIntegers(u),this._core.scrollPages(u)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(u){this._verifyIntegers(u),this._core.scrollToLine(u)}clear(){this._core.clear()}write(u,l){this._core.write(u,l)}writeln(u,l){this._core.write(u),this._core.write(`\r
389
+ `,l)}paste(u){this._core.paste(u)}refresh(u,l){this._verifyIntegers(u,l),this._core.refresh(u,l)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(u){this._addonManager.loadAddon(this,u)}static get strings(){return o}_verifyIntegers(...u){for(const l of u)if(l===1/0||isNaN(l)||l%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...u){for(const l of u)if(l&&(l===1/0||isNaN(l)||l%1!=0||l<0))throw new Error("This API only accepts positive integers")}}_.Terminal=b})(),d})()))})(ba)),ba.exports}var oS=sS(),ya={exports:{}},id;function aS(){return id||(id=1,(function(t,e){(function(r,n){t.exports=n()})(self,(()=>(()=>{var r={};return(()=>{var n=r;Object.defineProperty(n,"__esModule",{value:!0}),n.FitAddon=void 0,n.FitAddon=class{activate(s){this._terminal=s}dispose(){}fit(){const s=this.proposeDimensions();if(!s||!this._terminal||isNaN(s.cols)||isNaN(s.rows))return;const d=this._terminal._core;this._terminal.rows===s.rows&&this._terminal.cols===s.cols||(d._renderService.clear(),this._terminal.resize(s.cols,s.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const s=this._terminal._core,d=s._renderService.dimensions;if(d.css.cell.width===0||d.css.cell.height===0)return;const _=this._terminal.options.scrollback===0?0:s.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(o.getPropertyValue("height")),c=Math.max(0,parseInt(o.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),h=a-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),v=c-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-_;return{cols:Math.max(2,Math.floor(v/d.css.cell.width)),rows:Math.max(1,Math.floor(h/d.css.cell.height))}}}})(),r})()))})(ya)),ya.exports}var lS=aS(),cS=U('<p class="mt-3 text-sm text-danger-fg"> </p>'),dS=U(`<div class="h-full w-full flex items-center justify-center"><div class="text-center"><button type="button" class="px-4 py-2 text-sm font-medium rounded-md
390
+ bg-accent-emphasis text-white hover:opacity-90 transition-opacity">connect</button> <!></div></div>`),uS=U('<p class="mt-2 text-xs text-text-tertiary"> </p>'),hS=U(`<div class="h-full w-full flex flex-col gap-2"><div class="flex justify-end gap-2 flex-wrap"><button type="button" class="px-2 py-1.5 text-xs font-medium rounded-md border border-border-default
391
+ bg-bg-secondary text-text-primary hover:bg-bg-tertiary transition-colors" aria-label="Increase terminal height" title="Increase terminal height"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M8 3v10M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg></button> <button type="button" class="px-2 py-1.5 text-xs font-medium rounded-md border border-border-default
392
+ bg-bg-secondary text-text-primary hover:bg-bg-tertiary transition-colors" aria-label="Decrease terminal height" title="Decrease terminal height"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg></button> <button type="button" class="px-2 py-1.5 text-xs font-medium rounded-md border border-border-default
393
+ bg-bg-secondary text-text-primary hover:bg-bg-tertiary transition-colors" aria-label="Reset terminal height" title="Reset terminal height"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M3 8a5 5 0 1 0 1.5-3.6M3 3v3h3" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg></button> <button type="button" class="px-3 py-1.5 text-xs font-medium rounded-md border border-border-default
394
+ bg-bg-secondary text-text-primary hover:bg-bg-tertiary transition-colors
395
+ disabled:opacity-50 disabled:cursor-not-allowed" aria-label="Disconnect terminal" title="Disconnect terminal"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M6 4.5A4.5 4.5 0 1 0 10 12" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path><path d="M10 3.5h3v3M13 3.5l-4 4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg></button></div> <div class="shrink-0 min-h-0 w-full rounded-md border border-border-default overflow-hidden bg-slate-900" role="button" tabindex="0"><div class="terminal-host h-full w-full svelte-10032sa"></div></div> <div class="h-5 cursor-row-resize flex items-center justify-center
396
+ group hover:bg-accent-muted/40 transition-colors rounded-sm" role="separator" aria-orientation="horizontal" aria-label="Resize terminal height"><div class="w-8 h-0.5 rounded-full bg-border-default group-hover:bg-accent-emphasis transition-colors"></div></div></div> <!>`,1),fS=U('<main class="terminal-screen flex-1 min-h-0 bg-bg-primary"><div class="h-full w-full p-2 sm:p-6"><!></div></main>');function pS(t,e){Kt(e,!0);let r=q(void 0),n=q(null),s=q(null),d=q(null),_=q(!1),o=q(!1),a=q(null),c=q(null),g=q(xt(e.contextId)),h=q(!1),v=q(void 0),m=q(void 0),w=q(void 0),b=q(void 0),f=q(null),u=q(!1),l=q(!1),p=0,y=0;function k(){return window.innerWidth<=768}function C(O,ne){return ne!==void 0&&ne.length>0?ne:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${O}`}function A(){xe(),i(d)!==null&&(i(d).onopen=null,i(d).onmessage=null,i(d).onerror=null,i(d).onclose=null,(i(d).readyState===WebSocket.OPEN||i(d).readyState===WebSocket.CONNECTING)&&i(d).close(),x(d,null)),i(n)!==null&&(i(n).dispose(),x(n,null)),x(s,null),x(_,!1),x(o,!1),x(c,null)}function S(){if(i(n)!==null||i(r)===void 0)return;const O=new oS.Terminal({convertEol:!1,cursorBlink:!0,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,scrollback:5e3,theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#93c5fd"}}),ne=new lS.FitAddon;O.loadAddon(ne),O.open(i(r)),ne.fit(),O.onData(ae=>{i(d)!==null&&i(d).readyState===WebSocket.OPEN&&i(d).send(JSON.stringify({type:"input",data:ae}))}),x(n,O,!0),x(s,ne,!0)}function T(){var O;(O=i(n))==null||O.focus()}function D(O){i(d)===null||i(d).readyState!==WebSocket.OPEN||i(d).send(JSON.stringify({type:"resize",rows:O.rows,cols:O.cols}))}function H(){if(i(s)===null||i(n)===null)return;i(s).fit();const O=i(s).proposeDimensions();O!==void 0&&D(O)}function W(){var Se,Be,Ue;const O=i(u)?160:220;if(i(v)===void 0)return Math.max(O,Math.floor(window.innerHeight*.8));const ne=((Se=i(m))==null?void 0:Se.offsetHeight)??0,ae=((Be=i(w))==null?void 0:Be.offsetHeight)??0,te=Number.parseFloat(window.getComputedStyle(i(v)).rowGap),ge=Number.isFinite(te)?te:0,we=ne+ae+ge*2,Ie=i(b)!==void 0?i(b).offsetHeight+8:0,Pe=(((Ue=i(v).parentElement)==null?void 0:Ue.clientHeight)??window.innerHeight)-Ie;return Math.max(O,Pe-we)}function M(O){const ne=i(u)?160:220;return Math.max(ne,Math.min(W(),O))}function G(){if(i(f)!==null)return;const O=i(u)?.96:.75;x(f,M(Math.floor(W()*O)),!0)}function X(O){G(),i(f)!==null&&(x(f,M(i(f)+O),!0),requestAnimationFrame(()=>{H()}))}function le(O){O.preventDefault(),G(),i(f)!==null&&(x(l,!0),p=O.clientY,y=i(f),document.body.style.cursor="row-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",me),window.addEventListener("mouseup",R))}function me(O){if(!i(l))return;const ne=O.clientY-p;x(f,M(y+ne),!0),requestAnimationFrame(()=>{H()})}function xe(){x(l,!1),document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",me),window.removeEventListener("mouseup",R)}function R(){xe()}function j(){x(f,null),G(),requestAnimationFrame(()=>{H()})}function N(O){if(i(n)!==null){if(O.type==="output"){i(n).write(O.data);return}if(O.type==="exit"){i(n).writeln(`\r
397
+ \r
398
+ [terminal exited with code ${O.code}]`),x(o,!1),x(c,null);return}O.type==="error"&&(i(n).writeln(`\r
399
+ [error] ${O.message}`),x(a,O.message,!0))}}async function V(){if(!(i(_)||i(o))){x(_,!0),x(a,null);try{const O=await fetch(`/api/ctx/${e.contextId}/terminal/connect`,{method:"POST"});if(!O.ok){const te=await O.json();throw new Error(te.error??`Failed to connect terminal (${O.status})`)}const ne=await O.json();if(x(c,ne.sessionId,!0),await Yd(),S(),i(n)===null)throw new Error("Terminal UI could not be initialized");i(n).reset(),i(n).writeln(`[connected to ${e.contextId} in ${new Date().toLocaleTimeString()}]`);const ae=new WebSocket(C(ne.websocketPath,ne.websocketUrl));ae.onopen=()=>{x(_,!1),x(o,!0),H(),T()},ae.onmessage=te=>{try{const ge=JSON.parse(te.data);N(ge)}catch{}},ae.onerror=()=>{x(a,"Terminal WebSocket error")},ae.onclose=()=>{x(_,!1),x(o,!1),x(c,null)},x(d,ae,!0)}catch(O){x(_,!1),x(o,!1),x(c,null),x(a,O instanceof Error?O.message:"Terminal connection failed",!0)}}}async function $(){if(!(i(_)||i(o)||i(h))){x(h,!0);try{const O=await fetch(`/api/ctx/${e.contextId}/terminal/status`);if(!O.ok)return;(await O.json()).hasSession&&await V()}catch{}finally{x(h,!1)}}}function ee(){i(_)||(async()=>{try{await fetch(`/api/ctx/${e.contextId}/terminal/disconnect`,{method:"POST"})}catch{}finally{A(),x(a,null)}})()}gt(()=>{e.contextId!==i(g)&&(x(g,e.contextId,!0),A(),x(a,null),$())}),eu(()=>{const O=()=>{x(u,k(),!0)};return O(),window.addEventListener("resize",O),$(),()=>{window.removeEventListener("resize",O)}}),gt(()=>{if(i(o)&&i(s)!==null){G();const O=()=>{i(f)!==null&&x(f,M(i(f)),!0),H()};return window.addEventListener("resize",O),()=>{window.removeEventListener("resize",O)}}}),zf(()=>{xe(),A()});var ce=fS(),ue=E(ce),B=E(ue);{var I=O=>{var ne=dS(),ae=E(ne),te=E(ae);te.__click=()=>void V();var ge=P(te,2);{var we=Ie=>{var Pe=cS(),Se=E(Pe);de(()=>se(Se,i(a))),L(Ie,Pe)};Y(ge,Ie=>{i(a)!==null&&Ie(we)})}L(O,ne)},z=O=>{var ne=hS(),ae=Ye(ne),te=E(ae),ge=E(te);ge.__click=()=>{X(120)};var we=P(ge,2);we.__click=()=>{X(-120)};var Ie=P(we,2);Ie.__click=j;var Pe=P(Ie,2);Pe.__click=ee,Nr(te,Ne=>x(m,Ne),()=>i(m));var Se=P(te,2);Se.__click=T,Se.__keydown=T;var Be=E(Se);Nr(Be,Ne=>x(r,Ne),()=>i(r));var Ue=P(Se,2);Ue.__mousedown=le,Nr(Ue,Ne=>x(w,Ne),()=>i(w)),Nr(ae,Ne=>x(v,Ne),()=>i(v));var je=P(ae,2);{var ze=Ne=>{var _e=uS(),Me=E(_e);Nr(_e,oe=>x(b,oe),()=>i(b)),de(()=>se(Me,`session: ${i(c)??""}`)),L(Ne,_e)};Y(je,Ne=>{i(c)!==null&&Ne(ze)})}de(Ne=>{Pe.disabled=i(_),hi(Se,Ne)},[()=>`height: ${i(f)??(i(u)?Math.floor(window.innerHeight*.55):480)}px;`]),L(O,ne)};Y(B,O=>{!i(o)&&!i(_)?O(I):O(z,!1)})}L(t,ce),Xt()}tr(["click","keydown","mousedown"]);var _S=U('<div class="flex items-center justify-center py-12" role="status" aria-live="polite"><svg class="animate-spin h-6 w-6 text-accent-fg" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" aria-hidden="true"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> <span class="ml-2 text-sm text-text-secondary">Loading system information...</span></div>'),vS=U(`<div class="flex flex-col items-center justify-center py-12 text-center"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="text-danger-fg mb-4" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg> <p class="text-text-secondary mb-2"> </p> <button type="button" class="px-4 py-2 text-sm font-medium
400
+ bg-bg-secondary hover:bg-bg-hover text-text-primary
401
+ border border-border-default rounded-lg
402
+ transition-colors
403
+ focus:outline-none focus:ring-2 focus:ring-accent-emphasis">Retry</button></div>`),gS=U('<p class="text-sm text-success-fg font-mono"> </p>'),mS=U('<p class="text-sm text-danger-fg"> </p>'),bS=U('<p class="text-sm text-text-tertiary">Version information not available</p>'),yS=U('<p class="text-sm text-success-fg font-mono"> </p>'),xS=U('<p class="text-sm text-danger-fg"> </p>'),wS=U('<p class="text-sm text-text-tertiary">Version information not available</p>'),SS=U('<p class="text-sm text-success-fg font-mono"> </p>'),CS=U('<p class="text-sm text-danger-fg"> </p>'),kS=U('<p class="text-sm text-text-tertiary">Version information not available</p>'),ES=U('<div class="flex items-center justify-between"><span class="text-sm text-text-secondary">First Session</span> <span class="text-sm text-text-primary font-mono"> </span></div>'),AS=U('<div class="flex items-center justify-between"><span class="text-sm text-text-secondary">Last Computed</span> <span class="text-sm text-text-primary font-mono"> </span></div>'),TS=U('<div class="space-y-1"><div class="text-sm font-medium text-text-primary"> </div> <div class="grid grid-cols-2 gap-2 text-xs"><div class="flex justify-between"><span class="text-text-secondary">Input:</span> <span class="text-text-primary font-mono tabular-nums"> </span></div> <div class="flex justify-between"><span class="text-text-secondary">Output:</span> <span class="text-text-primary font-mono tabular-nums"> </span></div> <div class="flex justify-between"><span class="text-text-secondary">Cache Read:</span> <span class="text-text-primary font-mono tabular-nums"> </span></div> <div class="flex justify-between"><span class="text-text-secondary">Cache Write:</span> <span class="text-text-primary font-mono tabular-nums"> </span></div></div></div>'),PS=U('<div class="mb-4 pb-4 border-b border-border-default"><h4 class="text-sm font-semibold text-text-primary mb-2">Model Usage</h4> <div class="space-y-3"></div></div>'),LS=U('<tr class="border-b border-border-default/50"><td class="py-2 pr-4 text-text-primary font-mono"> </td><td class="py-2 px-2 text-right text-text-primary font-mono tabular-nums"> </td><td class="py-2 px-2 text-right text-text-primary font-mono tabular-nums"> </td><td class="py-2 px-2 text-right text-text-primary font-mono tabular-nums"> </td><td class="py-2 pl-2 text-right text-text-primary font-mono tabular-nums"> </td></tr>'),RS=U('<div><h4 class="text-sm font-semibold text-text-primary mb-2">Recent Activity (Last 14 Days)</h4> <div class="overflow-x-auto"><table class="w-full text-xs"><thead><tr class="border-b border-border-default"><th class="text-left py-2 pr-4 text-text-secondary font-medium">Date</th><th class="text-right py-2 px-2 text-text-secondary font-medium">Messages</th><th class="text-right py-2 px-2 text-text-secondary font-medium">Sessions</th><th class="text-right py-2 px-2 text-text-secondary font-medium">Tool Calls</th><th class="text-right py-2 pl-2 text-text-secondary font-medium">Tokens</th></tr></thead><tbody></tbody></table></div></div>'),IS=U('<div class="rounded-lg border border-border-default bg-bg-secondary p-4"><div class="flex-1"><h3 class="text-sm font-semibold text-text-primary mb-3">Claude Code Usage</h3> <div class="space-y-2 mb-4 pb-4 border-b border-border-default"><div class="flex items-center justify-between"><span class="text-sm text-text-secondary">Total Sessions</span> <span class="text-sm text-text-primary font-mono tabular-nums"> </span></div> <div class="flex items-center justify-between"><span class="text-sm text-text-secondary">Total Messages</span> <span class="text-sm text-text-primary font-mono tabular-nums"> </span></div> <div class="flex items-center justify-between"><span class="text-sm text-text-secondary">Total Tokens (14 Days)</span> <span class="text-sm text-text-primary font-mono tabular-nums"> </span></div> <!> <!></div> <!> <!></div></div>'),DS=U('<div class="space-y-4 max-w-2xl"><div class="rounded-lg border border-border-default bg-bg-secondary p-4"><div class="flex items-start gap-3"><div class="flex-1"><h3 class="text-sm font-semibold text-text-primary mb-1">Git</h3> <!></div></div></div> <div class="rounded-lg border border-border-default bg-bg-secondary p-4"><div class="flex items-start gap-3"><div class="flex-1"><h3 class="text-sm font-semibold text-text-primary mb-1">Claude Code</h3> <!></div></div></div> <div class="rounded-lg border border-border-default bg-bg-secondary p-4"><div class="flex items-start gap-3"><div class="flex-1"><h3 class="text-sm font-semibold text-text-primary mb-1">Codex</h3> <!></div></div></div> <div class="rounded-lg border border-border-default bg-bg-secondary p-4"><div class="flex-1"><h3 class="text-sm font-semibold text-text-primary mb-3">Models</h3> <div class="space-y-2"><div class="flex items-center justify-between"><span class="text-sm text-text-secondary">Prompt Model</span> <span class="text-sm text-text-primary font-mono"> </span></div> <div class="flex items-center justify-between"><span class="text-sm text-text-secondary">Assistant Model</span> <span class="text-sm text-text-primary font-mono"> </span></div></div></div></div> <!></div>'),MS=U('<div class="system-info-screen flex flex-col h-full bg-bg-primary" role="main" aria-label="System information"><div class="px-4 py-3 border-b border-border-default bg-bg-secondary"><h2 class="text-lg font-semibold text-text-primary">System Information</h2></div> <div class="flex-1 overflow-y-auto px-4 py-4"><!></div></div>');function OS(t,e){Kt(e,!0);let r=q(null),n=q(!0),s=q(null);function d(u){return u>=1e9?`${(u/1e9).toFixed(1)}B`:u>=1e6?`${(u/1e6).toFixed(1)}M`:u>=1e3?`${(u/1e3).toFixed(1)}K`:u.toString()}function _(u){try{const l=u.split("-");return l.length===3?new Date(Number(l[0]),Number(l[1])-1,Number(l[2])).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):new Date(u).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return u}}function o(u){return u.includes("opus-4-6")?"Opus 4.6":u.includes("opus-4-5")?"Opus 4.5":u.includes("sonnet-4-5")?"Sonnet 4.5":u.includes("haiku")?"Haiku":u}function a(u){return[...u].sort((l,p)=>p.date.localeCompare(l.date))}function c(u){return u.tokensByModel===void 0?0:Object.values(u.tokensByModel).reduce((l,p)=>l+p,0)}function g(u){return u.reduce((l,p)=>l+c(p),0)}async function h(){try{x(n,!0),x(s,null);const u=await fetch("/api/system-info");if(!u.ok)throw new Error(`Failed to fetch system info: ${u.status}`);const l=await u.json();x(r,l,!0)}catch(u){x(s,u instanceof Error?u.message:"Failed to load system info",!0),console.error("Failed to fetch system info:",u)}finally{x(n,!1)}}gt(()=>{h()});var v=MS(),m=P(E(v),2),w=E(m);{var b=u=>{var l=_S();L(u,l)},f=u=>{var l=_t(),p=Ye(l);{var y=C=>{var A=vS(),S=P(E(A),2),T=E(S),D=P(S,2);D.__click=()=>void h(),de(()=>se(T,i(s))),L(C,A)},k=C=>{var A=_t(),S=Ye(A);{var T=D=>{var H=DS(),W=E(H),M=E(W),G=E(M),X=P(E(G),2);{var le=je=>{var ze=gS(),Ne=E(ze);de(()=>se(Ne,i(r).git.version)),L(je,ze)},me=je=>{var ze=_t(),Ne=Ye(ze);{var _e=oe=>{var pe=mS(),Ce=E(pe);de(()=>se(Ce,i(r).git.error)),L(oe,pe)},Me=oe=>{var pe=bS();L(oe,pe)};Y(Ne,oe=>{i(r).git.error!==null?oe(_e):oe(Me,!1)},!0)}L(je,ze)};Y(X,je=>{i(r).git.version!==null?je(le):je(me,!1)})}var xe=P(W,2),R=E(xe),j=E(R),N=P(E(j),2);{var V=je=>{var ze=yS(),Ne=E(ze);de(()=>se(Ne,i(r).claudeCode.version)),L(je,ze)},$=je=>{var ze=_t(),Ne=Ye(ze);{var _e=oe=>{var pe=xS(),Ce=E(pe);de(()=>se(Ce,i(r).claudeCode.error)),L(oe,pe)},Me=oe=>{var pe=wS();L(oe,pe)};Y(Ne,oe=>{i(r).claudeCode.error!==null?oe(_e):oe(Me,!1)},!0)}L(je,ze)};Y(N,je=>{i(r).claudeCode.version!==null?je(V):je($,!1)})}var ee=P(xe,2),ce=E(ee),ue=E(ce),B=P(E(ue),2);{var I=je=>{var ze=SS(),Ne=E(ze);de(()=>se(Ne,i(r).codexCode.version)),L(je,ze)},z=je=>{var ze=_t(),Ne=Ye(ze);{var _e=oe=>{var pe=CS(),Ce=E(pe);de(()=>se(Ce,i(r).codexCode.error)),L(oe,pe)},Me=oe=>{var pe=kS();L(oe,pe)};Y(Ne,oe=>{i(r).codexCode.error!==null?oe(_e):oe(Me,!1)},!0)}L(je,ze)};Y(B,je=>{i(r).codexCode.version!==null?je(I):je(z,!1)})}var O=P(ee,2),ne=E(O),ae=P(E(ne),2),te=E(ae),ge=P(E(te),2),we=E(ge),Ie=P(te,2),Pe=P(E(Ie),2),Se=E(Pe),Be=P(O,2);{var Ue=je=>{var ze=IS(),Ne=E(ze),_e=P(E(Ne),2),Me=E(_e),oe=P(E(Me),2),pe=E(oe),Ce=P(Me,2),He=P(E(Ce),2),$e=E(He),nt=P(Ce,2),Fe=P(E(nt),2),qe=E(Fe),at=P(nt,2);{var Ze=ht=>{var pt=ES(),bt=P(E(pt),2),Tt=E(bt);de(et=>se(Tt,et),[()=>_(i(r).claudeCodeUsage.firstSessionDate)]),L(ht,pt)};Y(at,ht=>{i(r).claudeCodeUsage.firstSessionDate!==null&&ht(Ze)})}var Le=P(at,2);{var Ae=ht=>{var pt=AS(),bt=P(E(pt),2),Tt=E(bt);de(et=>se(Tt,et),[()=>_(i(r).claudeCodeUsage.lastComputedDate)]),L(ht,pt)};Y(Le,ht=>{i(r).claudeCodeUsage.lastComputedDate!==null&&ht(Ae)})}var it=P(_e,2);{var tt=ht=>{var pt=PS(),bt=P(E(pt),2);Gt(bt,21,()=>Object.entries(i(r).claudeCodeUsage.modelUsage),ui,(Tt,et)=>{var Ct=ye(()=>Dh(i(et),2));let kt=()=>i(Ct)[0],Mt=()=>i(Ct)[1];var Pt=TS(),Rt=E(Pt),It=E(Rt),Ht=P(Rt,2),Et=E(Ht),fe=P(E(Et),2),be=E(fe),We=P(Et,2),Je=P(E(We),2),ut=E(Je),Xe=P(We,2),ie=P(E(Xe),2),ke=E(ie),De=P(Xe,2),J=P(E(De),2),Z=E(J);de((re,F,Q,ve,Te)=>{se(It,re),se(be,F),se(ut,Q),se(ke,ve),se(Z,Te)},[()=>o(kt()),()=>d(Mt().inputTokens),()=>d(Mt().outputTokens),()=>d(Mt().cacheReadInputTokens),()=>d(Mt().cacheCreationInputTokens)]),L(Tt,Pt)}),L(ht,pt)};Y(it,ht=>{Object.keys(i(r).claudeCodeUsage.modelUsage).length>0&&ht(tt)})}var vt=P(it,2);{var ft=ht=>{var pt=RS(),bt=P(E(pt),2),Tt=E(bt),et=P(E(Tt));Gt(et,21,()=>a(i(r).claudeCodeUsage.recentDailyActivity),ui,(Ct,kt)=>{var Mt=LS(),Pt=E(Mt),Rt=E(Pt),It=P(Pt),Ht=E(It),Et=P(It),fe=E(Et),be=P(Et),We=E(be),Je=P(be),ut=E(Je);de((Xe,ie)=>{se(Rt,Xe),se(Ht,i(kt).messageCount??0),se(fe,i(kt).sessionCount??0),se(We,i(kt).toolCallCount??0),se(ut,ie)},[()=>_(i(kt).date),()=>d(c(i(kt)))]),L(Ct,Mt)}),L(ht,pt)};Y(vt,ht=>{i(r).claudeCodeUsage.recentDailyActivity.length>0&&ht(ft)})}de((ht,pt,bt)=>{se(pe,ht),se($e,pt),se(qe,bt)},[()=>d(i(r).claudeCodeUsage.totalSessions),()=>d(i(r).claudeCodeUsage.totalMessages),()=>d(g(i(r).claudeCodeUsage.recentDailyActivity))]),L(je,ze)};Y(Be,je=>{i(r).claudeCodeUsage!==null&&je(Ue)})}de(()=>{se(we,i(r).models.promptModel),se(Se,i(r).models.assistantModel)}),L(D,H)};Y(S,D=>{i(r)!==null&&D(T)},!0)}L(C,A)};Y(p,C=>{i(s)!==null?C(y):C(k,!1)},!0)}L(u,l)};Y(w,u=>{i(n)?u(b):u(f,!1)})}L(t,v),Xt()}tr(["click"]);var BS=U('<p class="text-sm text-text-secondary">Loading model profiles...</p>'),NS=U('<div class="rounded border border-danger-emphasis bg-danger-subtle text-danger-fg px-3 py-2 text-sm"> </div>'),jS=U('<p class="text-sm text-text-secondary">No profiles registered.</p>'),HS=U('<label class="block text-sm"><span class="text-text-secondary">Name</span> <input class="mt-1 w-full rounded border border-border-default bg-bg-secondary px-2 py-1.5 text-sm"/></label> <label class="block text-sm"><span class="text-text-secondary">Vendor</span> <select class="mt-1 w-full rounded border border-border-default bg-bg-secondary px-2 py-1.5 text-sm"><option>anthropics</option><option>openai</option></select></label> <label class="block text-sm"><span class="text-text-secondary">Model</span> <input class="mt-1 w-full rounded border border-border-default bg-bg-secondary px-2 py-1.5 text-sm"/></label> <label class="block text-sm"><span class="text-text-secondary">Authentication</span> <select class="mt-1 w-full rounded border border-border-default bg-bg-secondary px-2 py-1.5 text-sm"><option>Use logged-in CLI auth</option><option>Use API key env vars</option></select></label> <label class="block text-sm"><span class="text-text-secondary">Arguments</span> <textarea rows="3" class="mt-1 w-full rounded border border-border-default bg-bg-secondary px-2 py-1.5 text-sm font-mono"></textarea></label> <div class="flex items-center gap-2"><button type="button" class="px-2.5 py-1.5 rounded text-xs bg-accent-emphasis text-white disabled:opacity-50">Save</button> <button type="button" class="px-2.5 py-1.5 rounded text-xs bg-bg-tertiary text-text-secondary disabled:opacity-50">Cancel</button></div>',1),FS=U('<div class="flex items-start justify-between gap-2"><div><p class="text-sm font-medium text-text-primary"> </p> <p class="text-xs text-text-secondary"> </p> <p class="text-xs text-text-secondary"> </p> <p class="text-xs text-text-tertiary font-mono break-all"> </p></div> <div class="flex items-center gap-2"><button type="button" class="px-2 py-1 rounded text-xs bg-bg-tertiary text-text-secondary disabled:opacity-50">Edit</button> <button type="button" class="px-2 py-1 rounded text-xs bg-danger-subtle text-danger-fg disabled:opacity-50">Delete</button></div></div>'),US=U('<div class="rounded border border-border-default bg-bg-primary px-3 py-3 space-y-2"><!></div>'),VS=U('<!> <section class="rounded-lg border border-border-default bg-bg-secondary p-4 space-y-3"><h3 class="text-sm font-semibold text-text-primary">Register Profile</h3> <label class="block text-sm"><span class="text-text-secondary">Name</span> <input class="mt-1 w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm" placeholder="e.g. Fast OpenAI"/></label> <label class="block text-sm"><span class="text-text-secondary">Vendor</span> <select class="mt-1 w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm"><option>anthropics</option><option>openai</option></select></label> <label class="block text-sm"><span class="text-text-secondary">Model</span> <input class="mt-1 w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm" placeholder="claude-opus-4-6 / gpt-5.3-codex"/></label> <label class="block text-sm"><span class="text-text-secondary">Authentication</span> <select class="mt-1 w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm"><option>Use logged-in CLI auth</option><option>Use API key env vars</option></select></label> <label class="block text-sm"><span class="text-text-secondary">Arguments (one token per line)</span> <textarea rows="4" class="mt-1 w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm font-mono" placeholder="--permission-mode bypassPermissions"></textarea></label> <button type="button" class="px-3 py-1.5 rounded bg-success-emphasis text-white text-sm disabled:opacity-50">Register profile</button></section> <section class="rounded-lg border border-border-default bg-bg-secondary p-4 space-y-2"><h3 class="text-sm font-semibold text-text-primary">Registered Profiles</h3> <!></section>',1),zS=U('<div class="h-full flex flex-col bg-bg-primary" role="main" aria-label="Model profiles"><div class="px-4 py-3 border-b border-border-default bg-bg-secondary"><h2 class="text-lg font-semibold text-text-primary">Model Profiles</h2> <p class="text-xs text-text-secondary mt-1">Register and manage reusable model profiles.</p></div> <div class="flex-1 overflow-y-auto px-4 py-4 space-y-4"><!></div></div>');function WS(t,e){Kt(e,!0);let r=q(!0),n=q(!1),s=q(null),d=q(xt([])),_=q(""),o=q("anthropics"),a=q("cli_auth"),c=q("claude-opus-4-6"),g=q(`--permission-mode
404
+ bypassPermissions`),h=q(null),v=q(""),m=q("anthropics"),w=q("cli_auth"),b=q(""),f=q("");async function u(){try{x(r,!0),x(s,null);const G=await ml();x(d,[...G.profiles],!0)}catch(G){x(s,G instanceof Error?G.message:"Failed to load model profiles",!0)}finally{x(r,!1)}}function l(G){return G.split(/\r?\n/).map(X=>X.trim()).filter(X=>X.length>0)}function p(G,X=!1){const le=G==="anthropics"?"claude-opus-4-6":"gpt-5.3-codex";if(X){x(m,G,!0),i(b).trim().length===0&&x(b,le,!0);return}x(o,G,!0),x(c,le,!0)}async function y(){const G=i(_).trim(),X=i(c).trim();if(G.length===0||X.length===0){x(s,"Name and model are required");return}try{x(n,!0),x(s,null),await _p({name:G,vendor:i(o),authMode:i(a),model:X,arguments:l(i(g))}),x(_,""),await u()}catch(le){x(s,le instanceof Error?le.message:"Failed to create profile",!0)}finally{x(n,!1)}}function k(G){x(h,G.id,!0),x(v,G.name,!0),x(m,G.vendor,!0),x(w,G.authMode,!0),x(b,G.model,!0),x(f,G.arguments.join(`
405
+ `),!0)}function C(){x(h,null),x(v,""),x(m,"anthropics"),x(w,"cli_auth"),x(b,""),x(f,"")}async function A(G){const X=i(v).trim(),le=i(b).trim();if(X.length===0||le.length===0){x(s,"Name and model are required");return}try{x(n,!0),x(s,null),await vp(G,{name:X,vendor:i(m),authMode:i(w),model:le,arguments:l(i(f))}),C(),await u()}catch(me){x(s,me instanceof Error?me.message:"Failed to update profile",!0)}finally{x(n,!1)}}async function S(G){try{x(n,!0),x(s,null),await gp(G),i(h)===G&&C(),await u()}catch(X){x(s,X instanceof Error?X.message:"Failed to delete profile",!0)}finally{x(n,!1)}}gt(()=>{u()});var T=zS(),D=P(E(T),2),H=E(D);{var W=G=>{var X=BS();L(G,X)},M=G=>{var X=VS(),le=Ye(X);{var me=Se=>{var Be=NS(),Ue=E(Be);de(()=>se(Ue,i(s))),L(Se,Be)};Y(le,Se=>{i(s)!==null&&Se(me)})}var xe=P(le,2),R=P(E(xe),2),j=P(E(R),2),N=P(R,2),V=P(E(N),2);V.__change=Se=>p(Se.currentTarget.value);var $=E(V);$.value=$.__value="anthropics";var ee=P($);ee.value=ee.__value="openai";var ce=P(N,2),ue=P(E(ce),2),B=P(ce,2),I=P(E(B),2),z=E(I);z.value=z.__value="cli_auth";var O=P(z);O.value=O.__value="api_key";var ne=P(B,2),ae=P(E(ne),2),te=P(ne,2);te.__click=()=>void y();var ge=P(xe,2),we=P(E(ge),2);{var Ie=Se=>{var Be=jS();L(Se,Be)},Pe=Se=>{var Be=_t(),Ue=Ye(Be);Gt(Ue,17,()=>i(d),je=>je.id,(je,ze)=>{var Ne=US(),_e=E(Ne);{var Me=pe=>{var Ce=HS(),He=Ye(Ce),$e=P(E(He),2),nt=P(He,2),Fe=P(E(nt),2);Fe.__change=et=>p(et.currentTarget.value,!0);var qe=E(Fe);qe.value=qe.__value="anthropics";var at=P(qe);at.value=at.__value="openai";var Ze=P(nt,2),Le=P(E(Ze),2),Ae=P(Ze,2),it=P(E(Ae),2),tt=E(it);tt.value=tt.__value="cli_auth";var vt=P(tt);vt.value=vt.__value="api_key";var ft=P(Ae,2),ht=P(E(ft),2),pt=P(ft,2),bt=E(pt);bt.__click=()=>void A(i(ze).id);var Tt=P(bt,2);Tt.__click=C,de(()=>{bt.disabled=i(n),Tt.disabled=i(n)}),_r($e,()=>i(v),et=>x(v,et)),zi(Fe,()=>i(m),et=>x(m,et)),_r(Le,()=>i(b),et=>x(b,et)),zi(it,()=>i(w),et=>x(w,et)),_r(ht,()=>i(f),et=>x(f,et)),L(pe,Ce)},oe=pe=>{var Ce=FS(),He=E(Ce),$e=E(He),nt=E($e),Fe=P($e,2),qe=E(Fe),at=P(Fe,2),Ze=E(at),Le=P(at,2),Ae=E(Le),it=P(He,2),tt=E(it);tt.__click=()=>k(i(ze));var vt=P(tt,2);vt.__click=()=>void S(i(ze).id),de(ft=>{se(nt,i(ze).name),se(qe,`${i(ze).vendor??""} / ${i(ze).model??""}`),se(Ze,`auth: ${i(ze).authMode==="api_key"?"API key env vars":"CLI authenticated session"}`),se(Ae,ft),tt.disabled=i(n),vt.disabled=i(n)},[()=>i(ze).arguments.join(" ")]),L(pe,Ce)};Y(_e,pe=>{i(h)===i(ze).id?pe(Me):pe(oe,!1)})}L(je,Ne)}),L(Se,Be)};Y(we,Se=>{i(d).length===0?Se(Ie):Se(Pe,!1)})}de(()=>te.disabled=i(n)),_r(j,()=>i(_),Se=>x(_,Se)),zi(V,()=>i(o),Se=>x(o,Se)),_r(ue,()=>i(c),Se=>x(c,Se)),zi(I,()=>i(a),Se=>x(a,Se)),_r(ae,()=>i(g),Se=>x(g,Se)),L(G,X)};Y(H,G=>{i(r)?G(W):G(M,!1)})}L(t,T),Xt()}tr(["change","click"]);var qS=U('<p class="text-sm text-text-secondary">Loading action defaults...</p>'),GS=U('<div class="rounded border border-danger-emphasis bg-danger-subtle text-danger-fg px-3 py-2 text-sm"> </div>'),KS=U('<div class="rounded border border-success-emphasis bg-success-subtle text-success-fg px-3 py-2 text-sm"> </div>'),XS=U("<option> </option>"),JS=U("<option> </option>"),YS=U("<option> </option>"),QS=U("<option> </option>"),ZS=U("<option> </option>"),$S=U('<!> <!> <section class="rounded-lg border border-border-default bg-bg-secondary p-4 space-y-3"><h3 class="text-sm font-semibold text-text-primary">Default Profiles</h3> <label class="block text-sm"><span class="text-text-secondary">Git Commit action profile</span> <select class="mt-1 w-full min-w-0 max-w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm"></select> <p class="mt-1 text-xs text-text-tertiary break-all"> </p></label> <label class="block text-sm"><span class="text-text-secondary">Git PR action profile</span> <select class="mt-1 w-full min-w-0 max-w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm"></select> <p class="mt-1 text-xs text-text-tertiary break-all"> </p></label> <label class="block text-sm"><span class="text-text-secondary">AI Ask default profile</span> <select class="mt-1 w-full min-w-0 max-w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm"></select> <p class="mt-1 text-xs text-text-tertiary break-all"> </p></label> <button type="button" class="px-3 py-1.5 rounded bg-accent-emphasis text-white text-sm disabled:opacity-50">Save default profiles</button></section> <section class="rounded-lg border border-border-default bg-bg-secondary p-4 space-y-3"><h3 class="text-sm font-semibold text-text-primary">Default Prompt Templates</h3> <label class="block text-sm"><span class="text-text-secondary">Git Commit default prompt</span> <select class="mt-1 w-full min-w-0 max-w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm"></select></label> <label class="block text-sm"><span class="text-text-secondary">Git PR default prompt</span> <select class="mt-1 w-full min-w-0 max-w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm"></select></label> <button type="button" class="px-3 py-1.5 rounded bg-accent-emphasis text-white text-sm disabled:opacity-50">Save prompt template defaults</button></section> <section class="rounded-lg border border-border-default bg-bg-secondary p-4 space-y-3"><h3 class="text-sm font-semibold text-text-primary">Output Language</h3> <label class="block text-sm"><span class="text-text-secondary">Git Commit</span> <input class="mt-1 w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm" list="action-language-options" placeholder="English / Japanese / ..."/></label> <label class="block text-sm"><span class="text-text-secondary">Git PR</span> <input class="mt-1 w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm" list="action-language-options" placeholder="English / Japanese / ..."/></label> <label class="block text-sm"><span class="text-text-secondary">AI Session Purpose Summary</span> <input class="mt-1 w-full rounded border border-border-default bg-bg-primary px-2 py-1.5 text-sm" list="action-language-options" placeholder="English / Japanese / ..."/></label> <datalist id="action-language-options"><option></option><option></option><option></option><option></option><option></option><option></option><option></option></datalist> <button type="button" class="px-3 py-1.5 rounded bg-accent-emphasis text-white text-sm disabled:opacity-50">Save output languages</button></section> <section class="rounded-lg border border-border-default bg-bg-secondary p-4 space-y-4"><h3 class="text-sm font-semibold text-text-primary">Action Execution Prompts</h3> <div class="space-y-2"><div class="text-sm font-medium text-text-primary">Git Commit prompt</div> <div class="text-xs text-text-tertiary font-mono break-all"> </div> <textarea rows="8" class="w-full rounded border border-border-default bg-bg-primary px-2 py-2 text-xs font-mono"></textarea> <button type="button" class="px-3 py-1.5 rounded bg-accent-emphasis text-white text-sm disabled:opacity-50">Save commit execution prompt</button></div> <div class="space-y-2"><div class="text-sm font-medium text-text-primary">Git PR prompt</div> <div class="text-xs text-text-tertiary font-mono break-all"> </div> <textarea rows="8" class="w-full rounded border border-border-default bg-bg-primary px-2 py-2 text-xs font-mono"></textarea> <button type="button" class="px-3 py-1.5 rounded bg-accent-emphasis text-white text-sm disabled:opacity-50">Save PR execution prompt</button></div> <div class="space-y-2"><div class="text-sm font-medium text-text-primary">AI Session Purpose prompt</div> <div class="text-xs text-text-tertiary font-mono break-all"> </div> <textarea rows="8" class="w-full rounded border border-border-default bg-bg-primary px-2 py-2 text-xs font-mono"></textarea> <button type="button" class="px-3 py-1.5 rounded bg-accent-emphasis text-white text-sm disabled:opacity-50">Save session-purpose prompt</button></div> <div class="space-y-2"><div class="text-sm font-medium text-text-primary">AI Session Refresh Purpose prompt</div> <div class="text-xs text-text-tertiary font-mono break-all"> </div> <textarea rows="4" class="w-full rounded border border-border-default bg-bg-primary px-2 py-2 text-xs font-mono"></textarea> <button type="button" class="px-3 py-1.5 rounded bg-accent-emphasis text-white text-sm disabled:opacity-50">Save refresh-purpose prompt</button></div> <div class="space-y-2"><div class="text-sm font-medium text-text-primary">AI Session Resume prompt</div> <div class="text-xs text-text-tertiary font-mono break-all"> </div> <textarea rows="3" class="w-full rounded border border-border-default bg-bg-primary px-2 py-2 text-xs font-mono"></textarea> <button type="button" class="px-3 py-1.5 rounded bg-accent-emphasis text-white text-sm disabled:opacity-50">Save resume-session prompt</button></div></section>',1),e2=U('<div class="h-full flex flex-col bg-bg-primary" role="main" aria-label="Action defaults"><div class="px-4 py-3 border-b border-border-default bg-bg-secondary"><h2 class="text-lg font-semibold text-text-primary">Action Defaults</h2> <p class="text-xs text-text-secondary mt-1">Assign default profiles and execution prompts for each AI-driven action.</p></div> <div class="flex-1 overflow-y-auto overflow-x-hidden px-4 py-4 space-y-4"><!></div></div>');function t2(t,e){Kt(e,!0);let r=q(!0),n=q(!1),s=q(null),d=q(null),_=q(xt([])),o=q(xt({gitCommitProfileId:null,gitPrProfileId:null,aiDefaultProfileId:null})),a=q(xt({gitCommitLanguage:"English",gitPrLanguage:"English",aiSessionPurposeLanguage:"English"})),c=q(""),g=q(""),h=q(""),v=q(""),m=q(""),w=q(""),b=q(""),f=q(""),u=q(""),l=q(""),p=q(xt([])),y=q(xt([])),k=q(""),C=q("");function A(j){x(d,j,!0),setTimeout(()=>{x(d,null)},2e3)}async function S(){if(e.contextId===null){x(s,"No active project context"),x(r,!1);return}try{x(r,!0),x(s,null);const[j,N,V,$,ee,ce,ue,B,I,z]=await Promise.all([ml(),Fn("commit"),Fn("create-pr"),Fn("ai-session-purpose"),Fn("ai-session-refresh-purpose"),Fn("ai-session-resume"),lc(e.contextId,"commit"),lc(e.contextId,"pr"),cc(e.contextId,"commit"),cc(e.contextId,"pr")]),O=j;x(_,[...O.profiles],!0),x(o,O.operationBindings,!0),x(a,O.operationLanguages,!0),x(c,N.content,!0),x(g,V.content,!0),x(h,$.content,!0),x(v,ee.content,!0),x(m,ce.content,!0),x(w,N.path,!0),x(b,V.path,!0),x(f,$.path,!0),x(u,ee.path,!0),x(l,ce.path,!0),x(p,ue,!0),x(y,B,!0),x(k,I??"",!0),x(C,z??"",!0)}catch(j){x(s,j instanceof Error?j.message:"Failed to load action defaults",!0)}finally{x(r,!1)}}function T(j){return j.name}function D(j){if(j===null)return"No profile selected";const N=i(_).find(V=>V.id===j);return N===void 0?"Selected profile is unavailable":`${N.vendor} / ${N.model}`}async function H(){try{x(n,!0),x(s,null),x(o,await mp(i(o)),!0),A("Default profiles saved")}catch(j){x(s,j instanceof Error?j.message:"Failed to save default profiles",!0)}finally{x(n,!1)}}async function W(){try{x(n,!0),x(s,null),x(a,await bp(i(a)),!0),A("Output languages saved")}catch(j){x(s,j instanceof Error?j.message:"Failed to save output languages",!0)}finally{x(n,!1)}}async function M(){if(e.contextId===null){x(s,"No active project context");return}if(i(k).length===0){x(s,"Commit default prompt template is required");return}if(i(C).length===0){x(s,"PR default prompt template is required");return}try{x(n,!0),x(s,null),await Promise.all([dc(e.contextId,"commit",i(k)),dc(e.contextId,"pr",i(C))]),A("Default prompt templates saved")}catch(j){x(s,j instanceof Error?j.message:"Failed to save default prompt templates",!0)}finally{x(n,!1)}}async function G(j){try{x(n,!0),x(s,null);const N=i(j==="commit"?c:j==="create-pr"?g:j==="ai-session-purpose"?h:j==="ai-session-refresh-purpose"?v:m),V=await yp(j,N);j==="commit"?(x(c,V.content,!0),x(w,V.path,!0)):j==="create-pr"?(x(g,V.content,!0),x(b,V.path,!0)):j==="ai-session-purpose"?(x(h,V.content,!0),x(f,V.path,!0)):j==="ai-session-refresh-purpose"?(x(v,V.content,!0),x(u,V.path,!0)):(x(m,V.content,!0),x(l,V.path,!0)),A(`Saved ${j} prompt`)}catch(N){x(s,N instanceof Error?N.message:"Failed to save action prompt",!0)}finally{x(n,!1)}}gt(()=>{e.contextId,S()});var X=e2(),le=P(E(X),2),me=E(le);{var xe=j=>{var N=qS();L(j,N)},R=j=>{var N=$S(),V=Ye(N);{var $=Q=>{var ve=GS(),Te=E(ve);de(()=>se(Te,i(s))),L(Q,ve)};Y(V,Q=>{i(s)!==null&&Q($)})}var ee=P(V,2);{var ce=Q=>{var ve=KS(),Te=E(ve);de(()=>se(Te,i(d))),L(Q,ve)};Y(ee,Q=>{i(d)!==null&&Q(ce)})}var ue=P(ee,2),B=P(E(ue),2),I=P(E(B),2);Gt(I,21,()=>i(_),Q=>Q.id,(Q,ve)=>{var Te=XS(),rt=E(Te),ct={};de(wt=>{se(rt,wt),ct!==(ct=i(ve).id)&&(Te.value=(Te.__value=i(ve).id)??"")},[()=>T(i(ve))]),L(Q,Te)});var z=P(I,2),O=E(z),ne=P(B,2),ae=P(E(ne),2);Gt(ae,21,()=>i(_),Q=>Q.id,(Q,ve)=>{var Te=JS(),rt=E(Te),ct={};de(wt=>{se(rt,wt),ct!==(ct=i(ve).id)&&(Te.value=(Te.__value=i(ve).id)??"")},[()=>T(i(ve))]),L(Q,Te)});var te=P(ae,2),ge=E(te),we=P(ne,2),Ie=P(E(we),2);Gt(Ie,21,()=>i(_),Q=>Q.id,(Q,ve)=>{var Te=YS(),rt=E(Te),ct={};de(wt=>{se(rt,wt),ct!==(ct=i(ve).id)&&(Te.value=(Te.__value=i(ve).id)??"")},[()=>T(i(ve))]),L(Q,Te)});var Pe=P(Ie,2),Se=E(Pe),Be=P(we,2);Be.__click=()=>void H();var Ue=P(ue,2),je=P(E(Ue),2),ze=P(E(je),2);Gt(ze,21,()=>i(p),Q=>Q.id,(Q,ve)=>{var Te=QS(),rt=E(Te),ct={};de(()=>{se(rt,i(ve).name),ct!==(ct=i(ve).id)&&(Te.value=(Te.__value=i(ve).id)??"")}),L(Q,Te)});var Ne=P(je,2),_e=P(E(Ne),2);Gt(_e,21,()=>i(y),Q=>Q.id,(Q,ve)=>{var Te=ZS(),rt=E(Te),ct={};de(()=>{se(rt,i(ve).name),ct!==(ct=i(ve).id)&&(Te.value=(Te.__value=i(ve).id)??"")}),L(Q,Te)});var Me=P(Ne,2);Me.__click=()=>void M();var oe=P(Ue,2),pe=P(E(oe),2),Ce=P(E(pe),2),He=P(pe,2),$e=P(E(He),2),nt=P(He,2),Fe=P(E(nt),2),qe=P(nt,2),at=E(qe);at.value=at.__value="English";var Ze=P(at);Ze.value=Ze.__value="Japanese";var Le=P(Ze);Le.value=Le.__value="Spanish";var Ae=P(Le);Ae.value=Ae.__value="French";var it=P(Ae);it.value=it.__value="German";var tt=P(it);tt.value=tt.__value="Chinese";var vt=P(tt);vt.value=vt.__value="Korean";var ft=P(qe,2);ft.__click=()=>void W();var ht=P(oe,2),pt=P(E(ht),2),bt=P(E(pt),2),Tt=E(bt),et=P(bt,2),Ct=P(et,2);Ct.__click=()=>void G("commit");var kt=P(pt,2),Mt=P(E(kt),2),Pt=E(Mt),Rt=P(Mt,2),It=P(Rt,2);It.__click=()=>void G("create-pr");var Ht=P(kt,2),Et=P(E(Ht),2),fe=E(Et),be=P(Et,2),We=P(be,2);We.__click=()=>void G("ai-session-purpose");var Je=P(Ht,2),ut=P(E(Je),2),Xe=E(ut),ie=P(ut,2),ke=P(ie,2);ke.__click=()=>void G("ai-session-refresh-purpose");var De=P(Je,2),J=P(E(De),2),Z=E(J),re=P(J,2),F=P(re,2);F.__click=()=>void G("ai-session-resume"),de((Q,ve,Te)=>{se(O,Q),se(ge,ve),se(Se,Te),Be.disabled=i(n)||i(_).length===0,Me.disabled=i(n)||i(p).length===0||i(y).length===0,ft.disabled=i(n),se(Tt,i(w)),Ct.disabled=i(n),se(Pt,i(b)),It.disabled=i(n),se(fe,i(f)),We.disabled=i(n),se(Xe,i(u)),ke.disabled=i(n),se(Z,i(l)),F.disabled=i(n)},[()=>D(i(o).gitCommitProfileId),()=>D(i(o).gitPrProfileId),()=>D(i(o).aiDefaultProfileId)]),zi(I,()=>i(o).gitCommitProfileId,Q=>i(o).gitCommitProfileId=Q),zi(ae,()=>i(o).gitPrProfileId,Q=>i(o).gitPrProfileId=Q),zi(Ie,()=>i(o).aiDefaultProfileId,Q=>i(o).aiDefaultProfileId=Q),zi(ze,()=>i(k),Q=>x(k,Q)),zi(_e,()=>i(C),Q=>x(C,Q)),_r(Ce,()=>i(a).gitCommitLanguage,Q=>i(a).gitCommitLanguage=Q),_r($e,()=>i(a).gitPrLanguage,Q=>i(a).gitPrLanguage=Q),_r(Fe,()=>i(a).aiSessionPurposeLanguage,Q=>i(a).aiSessionPurposeLanguage=Q),_r(et,()=>i(c),Q=>x(c,Q)),_r(Rt,()=>i(g),Q=>x(g,Q)),_r(be,()=>i(h),Q=>x(h,Q)),_r(ie,()=>i(v),Q=>x(v,Q)),_r(re,()=>i(m),Q=>x(m,Q)),L(j,N)};Y(me,j=>{i(r)?j(xe):j(R,!1)})}L(t,X),Xt()}tr(["click"]);var r2=U('Merge into <span class="font-mono text-accent-fg"> </span>',1),i2=U('<div class="px-4 py-3 text-sm bg-success-subtle text-success-fg border-b border-border-default flex items-center gap-2"><svg class="w-4 h-4 shrink-0" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg> </div>'),n2=U('<div class="px-4 py-2 text-xs bg-danger-subtle text-danger-fg border-b border-border-default"> </div>'),s2=U('<div class="px-4 py-8 text-sm text-text-secondary text-center">Loading status...</div>'),o2=U('Merge <span class="font-mono text-text-secondary"> </span> into <span class="font-mono text-text-secondary"> </span>',1),a2=U('<div class="flex-1 overflow-hidden"><!></div> <div class="flex items-center justify-between px-4 py-3 border-t border-border-default"><div class="text-xs text-text-tertiary"><!></div> <div class="flex items-center gap-2"><button type="button" class="px-3 py-1.5 text-sm rounded border border-border-default text-text-secondary hover:bg-bg-tertiary transition-colors">Cancel</button> <button type="button"><!></button></div></div>',1),l2=U('<div class="fixed inset-0 bg-black/50 z-50 flex items-center justify-center" role="presentation"><div class="w-96 max-h-[80vh] bg-bg-primary border border-border-default rounded-lg shadow-xl flex flex-col" role="dialog" aria-label="Merge branch"><div class="flex items-center justify-between px-4 py-3 border-b border-border-default"><h2 class="text-sm font-semibold text-text-primary"><!></h2> <button type="button" class="p-1 rounded text-text-secondary hover:text-text-primary hover:bg-bg-tertiary transition-colors" aria-label="Close"><svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"></path></svg></button></div> <!> <!> <!></div></div>');function c2(t,e){Kt(e,!0);let r=q(""),n=q(!1),s=q(!0),d=q(null),_=q(!1),o=q(null),a=q(null),c=q(void 0);const g=ye(()=>i(d)!==null&&i(d)!==i(r)&&!i(n)&&!i(_));async function h(){x(s,!0);try{const X=await fetch(`/api/ctx/${e.contextId}/status`);if(X.ok){const le=await X.json();x(r,le.branch,!0),x(n,!le.clean)}}catch{}finally{x(s,!1)}}function v(X){X.name!==i(r)&&(x(d,X.name,!0),x(o,null))}async function m(){if(!(!i(g)||i(d)===null)){x(_,!0),x(o,null);try{const le=await(await fetch(`/api/ctx/${e.contextId}/branches/merge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:i(d)})})).json();le.success?(x(a,`Merged ${le.mergedBranch} into ${le.currentBranch}`),setTimeout(()=>{e.onClose(),window.location.reload()},1200)):x(o,le.error??"Merge failed",!0)}catch{x(o,"Merge failed")}finally{x(_,!1)}}}function w(X){X.key==="Escape"&&e.onClose()}let b=q(!1);gt(()=>{h()}),gt(()=>{!i(s)&&i(c)!==void 0&&!i(b)&&(x(b,!0),i(c).initialize())});var f=l2();f.__click=X=>{X.target===X.currentTarget&&e.onClose()},f.__keydown=w;var u=E(f);u.__click=X=>X.stopPropagation(),u.__keydown=w;var l=E(u),p=E(l),y=E(p);{var k=X=>{var le=r2(),me=P(Ye(le)),xe=E(me);de(()=>se(xe,i(r))),L(X,le)},C=X=>{var le=Lr("Merge Branch");L(X,le)};Y(y,X=>{i(r).length>0?X(k):X(C,!1)})}var A=P(p,2);A.__click=function(...X){var le;(le=e.onClose)==null||le.apply(this,X)};var S=P(l,2);{var T=X=>{var le=i2(),me=P(E(le));de(()=>se(me,` ${i(a)??""}`)),L(X,le)};Y(S,X=>{i(a)!==null&&X(T)})}var D=P(S,2);{var H=X=>{var le=n2(),me=E(le);de(()=>se(me,i(o))),L(X,le)};Y(D,X=>{i(o)!==null&&X(H)})}var W=P(D,2);{var M=X=>{var le=s2();L(X,le)},G=X=>{var le=a2(),me=Ye(le),xe=E(me);{let O=ye(()=>i(n)?"Uncommitted changes -- merge disabled":void 0),ne=ye(()=>i(d)??void 0);Nr(cu(xe,{get contextId(){return e.contextId},get currentBranch(){return i(r)},headerText:"Select branch to merge",filterPlaceholder:"Filter branches...",get warningMessage(){return i(O)},onSelect:v,disableCurrentBranch:!0,get selectedBranch(){return i(ne)}}),ae=>x(c,ae,!0),()=>i(c))}var R=P(me,2),j=E(R),N=E(j);{var V=O=>{var ne=o2(),ae=P(Ye(ne)),te=E(ae),ge=P(ae,2),we=E(ge);de(()=>{se(te,i(d)),se(we,i(r))}),L(O,ne)},$=O=>{var ne=Lr("Select a branch to merge");L(O,ne)};Y(N,O=>{i(d)!==null?O(V):O($,!1)})}var ee=P(j,2),ce=E(ee);ce.__click=function(...O){var ne;(ne=e.onClose)==null||ne.apply(this,O)};var ue=P(ce,2);ue.__click=()=>void m();var B=E(ue);{var I=O=>{var ne=Lr("Merging...");L(O,ne)},z=O=>{var ne=Lr("Merge");L(O,ne)};Y(B,O=>{i(_)?O(I):O(z,!1)})}de(()=>{Ve(ue,1,`px-3 py-1.5 text-sm rounded font-semibold transition-colors
406
+ ${i(g)?"bg-success-emphasis text-text-on-emphasis hover:bg-success-emphasis/90":"bg-bg-tertiary text-text-placeholder cursor-not-allowed"}`),ue.disabled=!i(g)}),L(X,le)};Y(W,X=>{i(s)?X(M):X(G,!1)})}L(t,f),Xt()}tr(["click","keydown"]);var d2=U('<main class="flex-1 overflow-hidden"><!></main>'),u2=U('<main class="flex-1 overflow-hidden"><!></main>'),h2=U('<main class="flex-1 overflow-hidden"><!></main>'),f2=U('<main class="flex-1 overflow-hidden"><!></main>'),p2=U('<main class="flex-1 overflow-hidden"><!></main>'),_2=U('<main class="flex-1 overflow-hidden"><!></main>'),v2=U('<div class="flex flex-col h-[100dvh] bg-bg-primary text-text-primary"><!> <div class="flex flex-1 min-h-0 overflow-hidden"><!></div> <!> <!></div>');function g2(t,e){Kt(e,!0);function r(){if(typeof window>"u")return!1;const he=/iPhone|iPod|Android/i.test(navigator.userAgent),dt=window.innerWidth<=480;return he||dt}function n(){if(typeof window>"u")return!1;const he=navigator.userAgent,dt=/iPhone|iPad|iPod/i.test(he),At=/Android/i.test(he),yt=window.innerWidth<=768;return(dt||At)&&yt}let s=q(null),d=q(xt([])),_=q(null),o=q("full-file"),a=q("all"),c=q(xt(r()));const g=160,h=480,v=64;let w=q(xt(Op({storageKey:"qraftbox-sidebar-width",min:g,max:h,fallback:256}))),b=q(!0),f=q(null),u=q(""),l=q(xt([])),p=q(xt(ep(window.location.hash))),y=q(xt([])),k=q(!0),C=q(""),A=q(null),S=q(!1),T=q(!1),D=q(!1),H=q(!1),W=q(xt({runningCount:0,queuedCount:0,runningSessionIds:[],totalCount:0})),M=q(xt([])),G=q(xt([])),X=q(xt([])),le=null,me=q(null),xe=q(xt(vl())),R=q(!1),j=q(xt([]));const N=ye(()=>i(y).filter(he=>!i(l).some(dt=>dt.path===he.path))),V=ye(()=>n()?"Browse Host Directories...":"Choose on Host..."),$=ye(()=>i(y).map(he=>({path:he.path,name:he.name,isGitRepo:he.isGitRepo,lastOpened:Date.now()}))),ee=ye(()=>{var he;return i(s)!==null?((he=i(l).find(dt=>dt.id===i(s)))==null?void 0:he.isGitRepo)??!1:!1}),ce=ye(()=>i(_)!==null?i(d).find(he=>he.path===i(_))??null:i(d)[0]??null),ue=ye(()=>i(_)??(i(ce)!==null?i(ce).path:null)),B=ye(()=>i(ce)!==null?i(d).findIndex(he=>he.path===i(ce).path):-1),I=ye(()=>i(B)>0?()=>{const he=i(d)[i(B)-1];he!==void 0&&x(_,he.path,!0)}:void 0),z=ye(()=>i(B)>=0&&i(B)<i(d).length-1?()=>{const he=i(d)[i(B)+1];he!==void 0&&x(_,he.path,!0)}:void 0),O=ye(()=>tp(i(d)));let ne=q(null),ae=q(!1),te=!1,ge=q(!1),we=q(!1);const Ie=ye(()=>new Map(i(d).map(he=>[he.path,he.status==="renamed"?"modified":he.status]))),Pe=Bp({getContextId:()=>i(s),getAllFilesTree:()=>i(ne),setAllFilesTree:he=>x(ne,he,!0),getAllFilesTreeStale:()=>te,setAllFilesTreeStale:he=>te=he,setAllFilesLoading:he=>x(ae,he,!0),getDiffStatusMap:()=>i(Ie),setFileContent:he=>x(pe,he,!0),setFileContentLoading:he=>x(Ce,he,!0),getShowIgnored:()=>i(ge),getShowAllFiles:()=>i(we)}),{fetchAllFiles:Se,refreshAllFiles:Be,handleDirectoryExpand:Ue,handleLoadFullTree:je,fetchFileContent:ze,getEffectiveViewMode:Ne}=Pe,_e=ye(()=>i(a)==="diff"?i(O):i(ne)!==null?gl(i(ne),i(Ie)):i(O)),Me=ye(()=>i(ue)!==null&&i(d).some(he=>he.path===i(ue))),oe=ye(()=>Ne(i(Me),i(o)));let pe=q(null),Ce=q(!1);const He=ye(()=>({totalFiles:i(d).length,additions:i(d).reduce((he,dt)=>he+dt.additions,0),deletions:i(d).reduce((he,dt)=>he+dt.deletions,0)}));let $e=async()=>{},nt=async()=>{};const Fe=Tp({getContextId:()=>i(s),setContextId:he=>x(s,he,!0),getProjectPath:()=>i(u),setProjectPath:he=>x(u,he,!0),getWorkspaceTabs:()=>i(l),setWorkspaceTabs:he=>x(l,he,!0),getCurrentScreen:()=>i(p),setCurrentScreen:he=>x(p,he,!0),setError:he=>x(f,he,!0),getRecentProjects:()=>i(y),setRecentProjects:he=>x(y,he,!0),setNewProjectPath:he=>x(C,he,!0),setNewProjectError:he=>x(A,he,!0),setNewProjectLoading:he=>x(S,he,!0),setPickingDirectory:he=>x(T,he,!0),setDirectoryPickerOpen:he=>x(D,he,!0),getCanManageProjects:()=>i(k),setCanManageProjects:he=>x(k,he,!0),isMobileDirectoryPickerClient:()=>n(),setLoading:he=>x(b,he,!0),getFileTreeMode:()=>i(a),setFileTreeMode:he=>x(a,he,!0),setShowAllFiles:he=>x(we,he,!0),setDiffFiles:he=>x(d,he,!0),getSelectedPath:()=>i(_),setSelectedPath:he=>x(_,he,!0),setAllFilesTree:he=>x(ne,he,!0),setAllFilesTreeStale:he=>te=he,setFileContent:he=>x(pe,he,!0),fetchAllFiles:Se,fetchPromptQueue:()=>$e(),fetchActiveSessions:()=>nt()}),{init:qe,switchProject:at,closeProjectTab:Ze,fetchRecentProjects:Le,openProjectByPath:Ae,openRecentProject:it,removeRecentProject:tt,pickDirectory:vt,fetchDiff:ft,navigateToScreen:ht,handleHashChange:pt}=Fe;function bt(he){x(_,he,!0)}function Tt(he){x(o,he,!0)}function et(){x(c,!i(c))}function Ct(){x(c,!0)}function kt(){x(w,Math.max(g,i(w)-v),!0),uc("qraftbox-sidebar-width",i(w))}function Mt(){x(w,Math.min(h,i(w)+v),!0),uc("qraftbox-sidebar-width",i(w))}async function Pt(he){if(he==="init"){await qe();return}i(s)!==null&&(await ft(i(s)),he==="pull"&&i(a)==="all"&&await Be(i(s)))}const Rt=Mp({getContextId:()=>i(s),getProjectPath:()=>i(u),getQraftAiSessionId:()=>i(xe),setQraftAiSessionId:he=>x(xe,he,!0),getRunningSessions:()=>i(M),setRunningSessions:he=>x(M,he,!0),getQueuedSessions:()=>i(G),setQueuedSessions:he=>x(G,he,!0),getRecentlyCompletedSessions:()=>i(X),setRecentlyCompletedSessions:he=>x(X,he,!0),getServerPromptQueue:()=>i(j),setServerPromptQueue:he=>x(j,he,!0),setQueueStatus:he=>x(W,he,!0),setResumeDisplaySessionId:he=>x(me,he,!0),setSessionMessageSubmitted:he=>x(R,he,!0),navigateToScreen:ht}),{submitPrompt:It,fetchPromptQueue:Ht,fetchActiveSessions:Et,handleCancelActiveSession:fe,handleCancelQueuedPrompt:be,handleResumeCliSession:We,handleNewSession:Je,hasActiveSessionWork:ut}=Rt;$e=Ht,nt=Et;const Xe=ip({getRunningSessions:()=>i(M),setRunningSessions:he=>{x(M,he,!0)},fetchActiveSessions:Et,fetchPromptQueue:Ht});function ie(){ut()&&le===null?le=setInterval(()=>{Ht(),Et()},2e3):!ut()&&le!==null&&(clearInterval(le),le=null)}gt(()=>{i(M).length,i(G).length,i(j).length,i(X).length,ie()}),gt(()=>{i(M).map(he=>he.id).join(","),Xe.sync()});const ke=ye(()=>i(d).map(he=>he.path));function De(he){const dt=he.target instanceof HTMLInputElement||he.target instanceof HTMLTextAreaElement;if(dt&&he.key==="Escape"){he.target.blur();return}dt||he.key==="b"&&!he.ctrlKey&&!he.metaKey&&(he.preventDefault(),et())}const J=Pp({getContextId:()=>i(s),getProjectPath:()=>i(u),getSelectedPath:()=>i(_),getFileTreeMode:()=>i(a),markAllFilesTreeStale:()=>{te=!0},fetchDiff:ft,refreshAllFiles:Be,fetchFileContent:ze,setPromptQueue:he=>{x(j,he,!0)},setQueueStatus:he=>{x(W,he,!0)},fetchActiveSessions:Et});gt(()=>(qe(),J.connect(),window.addEventListener("keydown",De),window.addEventListener("hashchange",pt),()=>{window.removeEventListener("keydown",De),window.removeEventListener("hashchange",pt),J.disconnect(),le!==null&&(clearInterval(le),le=null),Xe.closeAll()})),gt(()=>{i(ue)!==null&&i(s)!==null&&(i(oe)==="full-file"||!i(Me)&&i(a)==="all")?ze(i(s),i(ue)):x(pe,null)}),gt(()=>{(i(p)==="files"||i(p)==="ai-session")&&r()&&x(c,!0)}),gt(()=>{if(i(s)===null||!i(ee))return;const he=()=>{if(document.visibilityState!=="visible"||i(p)!=="files"&&i(p)!=="ai-session")return;const st=i(s);st!==null&&ft(st)},dt=()=>{he()},At=()=>{document.visibilityState==="visible"&&he()},yt=setInterval(he,15e3);return window.addEventListener("focus",dt),document.addEventListener("visibilitychange",At),()=>{clearInterval(yt),window.removeEventListener("focus",dt),document.removeEventListener("visibilitychange",At)}});var Z=v2(),re=E(Z);z_(re,{get currentScreen(){return i(p)},get workspaceTabs(){return i(l)},get contextId(){return i(s)},get projectPath(){return i(u)},get activeTabIsGitRepo(){return i(ee)},get availableRecentProjects(){return i(N)},get newProjectPath(){return i(C)},get newProjectError(){return i(A)},get newProjectLoading(){return i(S)},get pickingDirectory(){return i(T)},get canManageProjects(){return i(k)},get onNavigateToScreen(){return ht},get onSwitchProject(){return at},get onCloseProjectTab(){return Ze},get onFetchRecentProjects(){return Le},onNewProjectPathChange:he=>{x(C,he,!0),x(A,null)},get onOpenProjectByPath(){return Ae},get onOpenRecentProject(){return it},get onRemoveRecentProject(){return tt},get onPickDirectory(){return vt},get onWorktreeSwitch(){return qe},onPushSuccess:Pt});var F=P(re,2),Q=E(F);{var ve=he=>{{let dt=ye(()=>i(w)>g),At=ye(()=>i(w)<h);Y1(he,{get loading(){return i(b)},get error(){return i(f)},get sidebarCollapsed(){return i(c)},get sidebarWidth(){return i(w)},get allFilesLoading(){return i(ae)},get projectPath(){return i(u)},get fileTree(){return i(_e)},get fileTreeMode(){return i(a)},get selectedPath(){return i(_)},get diffFiles(){return i(d)},get contextId(){return i(s)},get isGitRepo(){return i(ee)},get selectedFile(){return i(ce)},get effectiveViewMode(){return i(oe)},get selectedHasDiff(){return i(Me)},get fileContentLoading(){return i(Ce)},get fileContent(){return i(pe)},get stats(){return i(He)},get navigatePrev(){return i(I)},get navigateNext(){return i(z)},get canNarrow(){return i(dt)},get canWiden(){return i(At)},get currentQraftAiSessionId(){return i(xe)},onToggleSidebar:et,onFileSelect:bt,onFileTreeModeChange:yt=>{x(a,yt,!0),yt==="all"&&i(s)!==null&&Se(i(s))},get showIgnored(){return i(ge)},onShowIgnoredChange:yt=>{x(ge,yt,!0),x(ne,null),te=!0,i(s)!==null&&i(a)==="all"&&Se(i(s))},get showAllFiles(){return i(we)},onShowAllFilesChange:yt=>{x(we,yt,!0),x(ne,null),te=!0,i(s)!==null&&i(a)==="all"&&Se(i(s))},onReloadFileTree:()=>{i(s)!==null&&(ft(i(s)),i(a)==="all"&&(x(ne,null),te=!0,Se(i(s))))},get onDirectoryExpand(){return Ue},get onLoadFullTree(){return je},onCollapseSidebar:Ct,onNarrowSidebar:kt,onWidenSidebar:Mt,onSetViewMode:Tt,get onSubmitPrompt(){return It},onGitActionSuccess:Pt})}},Te=he=>{var dt=_t(),At=Ye(dt);{var yt=ot=>{{let Lt=ye(()=>i(w)>g),rr=ye(()=>i(w)<h),gr=ye(()=>i(j).filter(Ot=>Ot.status==="queued"||Ot.status==="running")),ur=ye(()=>!i(R));xw(ot,{get loading(){return i(b)},get error(){return i(f)},get sidebarCollapsed(){return i(c)},get sidebarWidth(){return i(w)},get allFilesLoading(){return i(ae)},get fileTree(){return i(_e)},get fileTreeMode(){return i(a)},get selectedPath(){return i(_)},get diffFiles(){return i(d)},get contextId(){return i(s)},get canNarrow(){return i(Lt)},get canWiden(){return i(rr)},get queueStatus(){return i(W)},get changedFilePaths(){return i(ke)},get projectPath(){return i(u)},get runningSessions(){return i(M)},get queuedSessions(){return i(G)},get recentlyCompletedSessions(){return i(X)},get pendingPrompts(){return i(gr)},get resumeDisplaySessionId(){return i(me)},get currentQraftAiSessionId(){return i(xe)},get isFirstMessage(){return i(ur)},onToggleSidebar:et,onFileSelect:bt,onFileTreeModeChange:Ot=>{x(a,Ot,!0),Ot==="all"&&i(s)!==null&&Se(i(s))},get showIgnored(){return i(ge)},onShowIgnoredChange:Ot=>{x(ge,Ot,!0),x(ne,null),te=!0,i(s)!==null&&i(a)==="all"&&Se(i(s))},get showAllFiles(){return i(we)},onShowAllFilesChange:Ot=>{x(we,Ot,!0),x(ne,null),te=!0,i(s)!==null&&i(a)==="all"&&Se(i(s))},onReloadFileTree:()=>{i(s)!==null&&(ft(i(s)),i(a)==="all"&&(x(ne,null),te=!0,Se(i(s))))},get onDirectoryExpand(){return Ue},get onLoadFullTree(){return je},onCollapseSidebar:Ct,onNarrowSidebar:kt,onWidenSidebar:Mt,get onSubmitPrompt(){return It},get onNewSession(){return Je},get onResumeCliSession(){return We},get onCancelActiveSession(){return fe},get onCancelQueuedPrompt(){return be}})}},st=ot=>{var Lt=_t(),rr=Ye(Lt);{var gr=Ot=>{var Ft=d2(),hr=E(Ft);{var qr=xr=>{nS(xr,{get contextId(){return i(s)},get isGitRepo(){return i(ee)}})};Y(hr,xr=>{i(s)!==null&&xr(qr)})}L(Ot,Ft)},ur=Ot=>{var Ft=_t(),hr=Ye(Ft);{var qr=Dr=>{var Jt=u2(),Yt=E(Jt);{var sr=ar=>{pS(ar,{get contextId(){return i(s)}})};Y(Yt,ar=>{i(s)!==null&&ar(sr)})}L(Dr,Jt)},xr=Dr=>{var Jt=_t(),Yt=Ye(Jt);{var sr=Vt=>{var Bt=h2(),Zt=E(Bt);Pw(Zt,{get pickingDirectory(){return i(T)},get newProjectLoading(){return i(S)},get newProjectPath(){return i(C)},get newProjectError(){return i(A)},get chooseDirectoryLabel(){return i(V)},get availableRecentProjects(){return i(N)},get canManageProjects(){return i(k)},get onPickDirectory(){return vt},onNewProjectPathChange:br=>{x(C,br,!0)},get onOpenProject(){return Ae},get onOpenRecentProject(){return it},get onRemoveRecentProject(){return tt}}),L(Vt,Bt)},ar=Vt=>{var Bt=_t(),Zt=Ye(Bt);{var br=or=>{var fr=f2(),yr=E(fr);OS(yr,{}),L(or,fr)},kr=or=>{var fr=_t(),yr=Ye(fr);{var wr=zt=>{var $t=p2(),Ke=E($t);WS(Ke,{}),L(zt,$t)},Fr=zt=>{var $t=_t(),Ke=Ye($t);{var lt=St=>{var ir=_2(),nr=E(ir);t2(nr,{get contextId(){return i(s)}}),L(St,ir)};Y(Ke,St=>{i(p)==="action-defaults"&&St(lt)},!0)}L(zt,$t)};Y(yr,zt=>{i(p)==="model-profiles"?zt(wr):zt(Fr,!1)},!0)}L(or,fr)};Y(Zt,or=>{i(p)==="system-info"?or(br):or(kr,!1)},!0)}L(Vt,Bt)};Y(Yt,Vt=>{i(p)==="project"?Vt(sr):Vt(ar,!1)},!0)}L(Dr,Jt)};Y(hr,Dr=>{i(p)==="terminal"?Dr(qr):Dr(xr,!1)},!0)}L(Ot,Ft)};Y(rr,Ot=>{i(p)==="commits"?Ot(gr):Ot(ur,!1)},!0)}L(ot,Lt)};Y(At,ot=>{i(p)==="ai-session"?ot(yt):ot(st,!1)},!0)}L(he,dt)};Y(Q,he=>{i(p)==="files"?he(ve):he(Te,!1)})}var rt=P(F,2);{var ct=he=>{c2(he,{get contextId(){return i(s)},onClose:()=>{x(H,!1)}})};Y(rt,he=>{i(H)&&i(s)!==null&&he(ct)})}var wt=P(rt,2);av(wt,{get isOpen(){return i(D)},get recentDirectories(){return i($)},onClose:()=>{x(D,!1)},onSelect:he=>{x(D,!1),Ae(he)}}),L(t,Z),Xt()}const nd=document.getElementById("app");nd!==null&&Hf(g2,{target:nd});